refactor(form): model links as fields (#36129)
This commit is contained in:
@@ -18,6 +18,15 @@ let captured: Form.CreateInput | undefined
|
||||
let reject = false
|
||||
let deny = false
|
||||
const capturedInput = () => captured
|
||||
const questionInput = {
|
||||
questions: [
|
||||
{
|
||||
question: "Continue?",
|
||||
header: "Continue",
|
||||
options: [{ label: "Yes", description: "Continue" }],
|
||||
},
|
||||
],
|
||||
}
|
||||
const permission = Layer.succeed(
|
||||
PermissionV2.Service,
|
||||
PermissionV2.Service.of({
|
||||
@@ -90,7 +99,7 @@ describe("QuestionTool", () => {
|
||||
yield* settleTool(registry, {
|
||||
sessionID,
|
||||
...toolIdentity,
|
||||
call: { type: "tool-call", id: "call-question-denied", name: "question", input: { questions: [] } },
|
||||
call: { type: "tool-call", id: "call-question-denied", name: "question", input: questionInput },
|
||||
}),
|
||||
).toEqual({
|
||||
result: { type: "error", value: "Permission denied: question" },
|
||||
@@ -158,7 +167,6 @@ describe("QuestionTool", () => {
|
||||
sessionID,
|
||||
title: "Questions",
|
||||
metadata: { kind: "question", tool: { messageID: toolIdentity.assistantMessageID, callID: "call-question" } },
|
||||
mode: "form",
|
||||
fields: [
|
||||
{
|
||||
key: "q0",
|
||||
@@ -199,14 +207,22 @@ describe("QuestionTool", () => {
|
||||
yield* executeTool(registryService, {
|
||||
sessionID,
|
||||
...toolIdentity,
|
||||
call: { type: "tool-call", id: "call-question", name: "question", input: { questions: [] } },
|
||||
call: { type: "tool-call", id: "call-question", name: "question", input: questionInput },
|
||||
})
|
||||
expect(capturedInput()).toEqual({
|
||||
sessionID,
|
||||
title: "Questions",
|
||||
metadata: { kind: "question", tool: { messageID: toolIdentity.assistantMessageID, callID: "call-question" } },
|
||||
mode: "form",
|
||||
fields: [],
|
||||
fields: [
|
||||
{
|
||||
key: "q0",
|
||||
title: "Continue",
|
||||
description: "Continue?",
|
||||
options: [{ value: "Yes", label: "Yes", description: "Continue" }],
|
||||
custom: true,
|
||||
type: "string",
|
||||
},
|
||||
],
|
||||
})
|
||||
}),
|
||||
)
|
||||
@@ -220,7 +236,7 @@ describe("QuestionTool", () => {
|
||||
const fiber = yield* executeTool(registryService, {
|
||||
sessionID,
|
||||
...toolIdentity,
|
||||
call: { type: "tool-call", id: "call-question", name: "question", input: { questions: [] } },
|
||||
call: { type: "tool-call", id: "call-question", name: "question", input: questionInput },
|
||||
}).pipe(Effect.forkScoped)
|
||||
|
||||
const exit = yield* Fiber.await(fiber)
|
||||
|
||||
Reference in New Issue
Block a user