@effect-agent/testing 0.1.0-beta.45 → 0.1.0-beta.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{certification.d.mts → Certification.d.mts} +7 -4
- package/dist/{certification.mjs → Certification.mjs} +23 -7
- package/dist/Certification.mjs.map +1 -0
- package/dist/{chaos.d.mts → Chaos.d.mts} +7 -5
- package/dist/{chaos.mjs → Chaos.mjs} +21 -7
- package/dist/Chaos.mjs.map +1 -0
- package/dist/{code-executor.d.mts → CodeExecutorConformance.d.mts} +6 -21
- package/dist/{code-executor.mjs → CodeExecutorConformance.mjs} +6 -340
- package/dist/CodeExecutorConformance.mjs.map +1 -0
- package/dist/CodeExecutorSubstitute.d.mts +21 -0
- package/dist/CodeExecutorSubstitute.mjs +341 -0
- package/dist/CodeExecutorSubstitute.mjs.map +1 -0
- package/dist/{docs-researcher.d.mts → DocsResearcher.d.mts} +23 -16
- package/dist/{docs-researcher.mjs → DocsResearcher.mjs} +15 -5
- package/dist/DocsResearcher.mjs.map +1 -0
- package/dist/{scripted-model-dOa_e0-n.d.mts → ScriptedModel-Dx8aW73W.d.mts} +5 -3
- package/dist/ScriptedModel.d.mts +2 -0
- package/dist/{scripted-model-C2y0ztuj.mjs → ScriptedModel.mjs} +13 -3
- package/dist/ScriptedModel.mjs.map +1 -0
- package/dist/{travel-planner.d.mts → TravelPlanner.d.mts} +35 -24
- package/dist/{travel-planner.mjs → TravelPlanner.mjs} +18 -7
- package/dist/TravelPlanner.mjs.map +1 -0
- package/dist/{deterministic-layers-CKyYxBhN.mjs → deterministic-layers-Eka0fMZq.mjs} +7 -3
- package/dist/deterministic-layers-Eka0fMZq.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +1 -1
- package/src/{certification.ts → Certification.ts} +37 -32
- package/src/{chaos.ts → Chaos.ts} +36 -32
- package/src/{code-executor-conformance.ts → CodeExecutorConformance.ts} +5 -3
- package/src/{code-executor-substitute.ts → CodeExecutorSubstitute.ts} +2 -2
- package/src/{fixtures/docs-researcher/index.ts → DocsResearcher.ts} +67 -4
- package/src/TravelPlanner.ts +244 -0
- package/src/fixtures/docs-researcher/definition.ts +5 -3
- package/src/fixtures/docs-researcher/harness.ts +9 -16
- package/src/fixtures/docs-researcher/mcp.ts +1 -1
- package/src/fixtures/travel-planner/definition.ts +2 -1
- package/src/fixtures/travel-planner/deterministic-layers.ts +4 -2
- package/src/fixtures/travel-planner/phase2.ts +2 -1
- package/src/fixtures/travel-planner/phase3.ts +4 -4
- package/src/fixtures/travel-planner/phase4.ts +8 -8
- package/src/fixtures/travel-planner/phase5.ts +14 -7
- package/src/fixtures/travel-planner/phase6.ts +6 -7
- package/src/fixtures/travel-planner/scenarios.ts +1 -1
- package/src/fixtures/travel-planner/subagents-durable.ts +9 -15
- package/src/fixtures/travel-planner/subagents.ts +6 -4
- package/src/index.ts +1 -2
- package/dist/certification.mjs.map +0 -1
- package/dist/chaos.mjs.map +0 -1
- package/dist/code-executor.mjs.map +0 -1
- package/dist/deterministic-layers-CKyYxBhN.mjs.map +0 -1
- package/dist/docs-researcher.mjs.map +0 -1
- package/dist/scripted-model-C2y0ztuj.mjs.map +0 -1
- package/dist/travel-planner.mjs.map +0 -1
- package/src/code-executor.ts +0 -3
- package/src/docs-researcher.ts +0 -2
- package/src/fixtures/travel-planner/index.ts +0 -11
- package/src/travel-planner.ts +0 -2
- /package/src/{scripted-model.ts → ScriptedModel.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocsResearcher.mjs","names":[],"sources":["../src/fixtures/docs-researcher/definition.ts","../src/fixtures/docs-researcher/mcp.ts","../src/fixtures/docs-researcher/harness.ts"],"sourcesContent":["import * as Subagent from \"@effect-agent/capabilities/Subagent\";\nimport { SubagentPolicy, SubagentRuntime } from \"@effect-agent/capabilities/Subagent\";\nimport * as Agent from \"@effect-agent/core/Agent\";\nimport { AgentPolicy } from \"@effect-agent/core/AgentPolicy\";\nimport { type RuntimeBinding } from \"@effect-agent/engine/AgentRuntime\";\nimport { Context, Effect, Schema } from \"effect\";\nimport { Tool, Toolkit } from \"effect/unstable/ai\";\n\n// ---------------------------------------------------------------------------\n// Docs Researcher (P7 internal agent #3, plan §6): a coordinator that\n// delegates per-document summarization to a doc-summarizer child through the\n// S2 durable delegation surface, with the child's content tools served —\n// and validated — through the MCP connector against a scripted MCP fixture.\n// The corpus, tools, and both Agent Definitions are deterministic fixtures in\n// the travel-planner style so DN tests (and any later DC assembly) reuse them.\n// ---------------------------------------------------------------------------\n\nexport const ResearchDocumentId = Schema.NonEmptyString.check(Schema.isMaxLength(64)).pipe(\n Schema.brand(\"@effect-agent/testing/docs-researcher/ResearchDocumentId\"),\n);\n\nexport type ResearchDocumentId = typeof ResearchDocumentId.Type;\n\nconst BoundedTitle = Schema.NonEmptyString.check(Schema.isMaxLength(120));\nconst BoundedBody = Schema.NonEmptyString.check(Schema.isMaxLength(16 * 1024));\n\n/** Bounded summary text: the ONLY child-derived text that may cross to the parent. */\nexport const BoundedSummary = Schema.NonEmptyString.check(Schema.isMaxLength(240));\n\nexport class DocumentQuery extends Schema.Class<DocumentQuery>(\"DocumentQuery\")({\n documentId: ResearchDocumentId,\n}) {}\n\n/** One bounded research document as the MCP content server exposes it. */\nexport class ResearchDocument extends Schema.Class<ResearchDocument>(\"ResearchDocument\")({\n documentId: ResearchDocumentId,\n title: BoundedTitle,\n body: BoundedBody,\n}) {}\n\nexport class DocumentUnavailable extends Schema.TaggedError<DocumentUnavailable>()(\n \"DocumentUnavailable\",\n {\n documentId: ResearchDocumentId,\n message: Schema.String,\n },\n) {}\n\n/** The content store behind the scripted MCP server. */\nexport class DocumentLibrary extends Context.Service<\n DocumentLibrary,\n {\n readonly fetch: (query: DocumentQuery) => Effect.Effect<ResearchDocument, DocumentUnavailable>;\n }\n>()(\"@effect-agent/testing/docs-researcher/DocumentLibrary\") {}\n\n/**\n * The one content tool the doc-summarizer child uses. Its authored JSON\n * schema is what MCP discovery must serve byte-for-byte: the scripted MCP\n * fixture derives its discovery entry from `Tool.getJsonSchema(FetchDocument)`\n * and `validateMcpDiscovery` re-derives and digests both sides (CAP-009).\n */\nexport const FetchDocument = Tool.make(\"fetch_document\", {\n description: \"Fetch one bounded research document by its identifier.\",\n parameters: DocumentQuery,\n success: ResearchDocument,\n failure: DocumentUnavailable,\n failureMode: \"error\",\n dependencies: [DocumentLibrary],\n});\n\nexport const DocContentToolkit = Toolkit.make(FetchDocument);\n\nexport const docContentToolkitLayer = DocContentToolkit.toLayer({\n fetch_document: (query) => Effect.flatMap(DocumentLibrary, (library) => library.fetch(query)),\n});\n\n// ---------------------------------------------------------------------------\n// Deterministic corpus. Every body deliberately embeds BOTH a secret marker\n// and a distinctive body phrase: the tests assert that neither ever reaches\n// the parent Thread, the parent prompts, or a redacted preview — only\n// the bounded summary crosses the delegation boundary (SUB-015, SEC-008).\n// ---------------------------------------------------------------------------\n\n/** Never allowed outside a child Thread or an unredacted fixture value. */\nexport const docsDocumentBodySecret = \"docs-vault-secret-771\";\n\nconst decodeDocumentId = Schema.decodeSync(ResearchDocumentId);\n\ninterface CorpusEntry {\n readonly document: ResearchDocument;\n readonly bodyPhrase: string;\n readonly summary: string;\n}\n\nconst corpusEntries = new Map<string, CorpusEntry>(\n [\n {\n documentId: \"durability-notes\",\n title: \"Durability protocol notes\",\n bodyPhrase: \"amber-ledger-passage\",\n summary:\n \"Settlement results are recorded exactly once while external side effects stay at-least-once.\",\n },\n {\n documentId: \"subagent-notes\",\n title: \"Subagent join notes\",\n bodyPhrase: \"cobalt-join-corridor\",\n summary: \"A parent joins only the verified settlement of its own established child.\",\n },\n ].map((entry) => [\n entry.documentId,\n {\n document: ResearchDocument.make({\n documentId: decodeDocumentId(entry.documentId),\n title: entry.title,\n body: `${entry.bodyPhrase}: internal working notes. ${docsDocumentBodySecret}. ${entry.summary} Raw notes stay inside the child Thread.`,\n }),\n bodyPhrase: entry.bodyPhrase,\n summary: entry.summary,\n },\n ]),\n);\n\n/** The corpus document ids in canonical fixture order. */\nexport const researchCorpusDocumentIds: ReadonlyArray<ResearchDocumentId> = [\n decodeDocumentId(\"durability-notes\"),\n decodeDocumentId(\"subagent-notes\"),\n];\n\nconst requireCorpusEntry = (documentId: string): CorpusEntry => {\n const entry = corpusEntries.get(documentId);\n\n if (entry === undefined) {\n throw new Error(`No deterministic corpus entry exists for document ${documentId}`);\n }\n\n return entry;\n};\n\n/** Deterministic library lookup shared by the scripted MCP content handlers. */\nexport const researchDocumentLookup = (\n query: DocumentQuery,\n): Effect.Effect<ResearchDocument, DocumentUnavailable> => {\n const entry = corpusEntries.get(query.documentId);\n\n return entry === undefined\n ? Effect.fail(\n DocumentUnavailable.make({\n documentId: query.documentId,\n message: \"No deterministic corpus entry exists for this document.\",\n }),\n )\n : Effect.succeed(entry.document);\n};\n\n/** The full fixture document (body includes the secret marker — child-side only). */\nexport const researchDocumentFor = (documentId: string): ResearchDocument =>\n requireCorpusEntry(documentId).document;\n\n/** The distinctive body phrase used by context-isolation assertions. */\nexport const documentBodyPhrase = (documentId: string): string =>\n requireCorpusEntry(documentId).bodyPhrase;\n\n// ---------------------------------------------------------------------------\n// Doc Summarizer: the child Agent Definition. Its toolkit is the authored\n// `DocContentToolkit`; the harness registers its worker Binding only after\n// MCP discovery validates that exact toolkit (mcp.ts).\n// ---------------------------------------------------------------------------\n\nexport class SummaryBrief extends Schema.Class<SummaryBrief>(\"SummaryBrief\")({\n documentId: ResearchDocumentId,\n focus: Schema.NonEmptyString,\n}) {}\n\nexport class DocumentSummary extends Schema.Class<DocumentSummary>(\"DocumentSummary\")({\n documentId: ResearchDocumentId,\n summary: BoundedSummary,\n}) {}\n\n/** The summary the scripted child writes after fetching the document. */\nexport const documentSummaryFor = (documentId: string): DocumentSummary =>\n DocumentSummary.make({\n documentId: requireCorpusEntry(documentId).document.documentId,\n summary: requireCorpusEntry(documentId).summary,\n });\n\nexport const encodedDocumentSummary = (documentId: string): string =>\n JSON.stringify(Schema.encodeSync(DocumentSummary)(documentSummaryFor(documentId)));\n\nexport const DocSummarizer = Agent.make(\"doc-summarizer\", {\n input: SummaryBrief,\n output: DocumentSummary,\n instructions:\n \"Fetch the briefed document with fetch_document exactly once, then return only a JSON document summary. Never copy raw notes or secrets into the summary.\",\n toolkit: DocContentToolkit,\n policy: AgentPolicy.make({\n maxTurns: 2,\n maxToolCalls: 1,\n maxDuration: \"30 seconds\",\n toolConcurrency: 1,\n }),\n description: \"Summarize one bounded research document fetched through MCP content tools.\",\n metadata: { deploymentClass: \"DN\", phase: \"P7\" },\n});\n\n// ---------------------------------------------------------------------------\n// Delegation Definition: the coordinator sees exactly one Tool with explicit\n// projections and finite bounds. `projectResult` is the declassification\n// boundary (SUB-015): only the bounded summary crosses; the fetched body —\n// secret marker included — stays in the child Thread.\n// ---------------------------------------------------------------------------\n\nexport class SummaryRequest extends Schema.Class<SummaryRequest>(\"SummaryRequest\")({\n documentId: ResearchDocumentId,\n}) {}\n\nexport class SummaryFinding extends Schema.Class<SummaryFinding>(\"SummaryFinding\")({\n documentId: ResearchDocumentId,\n summary: BoundedSummary,\n}) {}\n\nexport class DocumentSummaryFailed extends Schema.TaggedError<DocumentSummaryFailed>()(\n \"DocumentSummaryFailed\",\n {\n childErrorTag: Schema.NonEmptyString,\n },\n) {}\n\n/** Finite per-invocation bounds (SUB-009): one fetch per child, two children per Run. */\nexport const documentSummaryPolicy = SubagentPolicy.make({\n maxChildren: 2,\n maxConcurrency: 2,\n maxTurns: 2,\n maxToolCalls: 1,\n maxDuration: \"10 seconds\",\n});\n\nexport const delegateDocumentSummary = Subagent.define(\"delegate_document_summary\", {\n description:\n \"Summarize one research document through the doc-summarizer child and return a bounded finding.\",\n target: DocSummarizer,\n parameters: SummaryRequest,\n success: SummaryFinding,\n failure: DocumentSummaryFailed,\n prepareInput: (request) =>\n Effect.succeed(\n SummaryBrief.make({\n documentId: request.documentId,\n focus: \"summarize:durability-claims\",\n }),\n ),\n projectResult: (summary) =>\n Effect.succeed(\n SummaryFinding.make({\n documentId: summary.documentId,\n summary: summary.summary,\n }),\n ),\n policy: documentSummaryPolicy,\n});\n\n/** Total mapping from every expected child Run failure to the declared Tool failure (SUB-028). */\nexport const mapSummaryChildFailure = (failure: { readonly _tag: string }): DocumentSummaryFailed =>\n DocumentSummaryFailed.make({ childErrorTag: failure._tag });\n\n/** The exact digest strings the durable declaration AND host registration must share (SUB-023). */\nexport const docsSummarizerDigestStrings = {\n agent: \"50\".repeat(32),\n model: \"51\".repeat(32),\n tools: \"52\".repeat(32),\n} as const;\n\n/** Runtime wiring: the immutable delegation plus one explicit child Binding (S2 declaration). */\nexport const docsSummaryHandlersLayer = <Provider, ModelProvides, ModelRequires>(\n childBinding: RuntimeBinding<\n typeof SummaryBrief,\n typeof DocumentSummary,\n string,\n Toolkit.Tools<typeof DocContentToolkit>,\n Provider,\n ModelProvides,\n ModelRequires\n >,\n) =>\n SubagentRuntime.layer(delegateDocumentSummary, childBinding, {\n mapChildFailure: mapSummaryChildFailure,\n durable: { targetDigests: docsSummarizerDigestStrings },\n });\n\n// ---------------------------------------------------------------------------\n// Docs Researcher: the parent Agent Definition.\n// ---------------------------------------------------------------------------\n\nexport class ResearchRequest extends Schema.Class<ResearchRequest>(\"ResearchRequest\")({\n question: Schema.NonEmptyString,\n documentIds: Schema.Array(ResearchDocumentId).check(Schema.isMinLength(1)),\n}) {}\n\nexport class ResearchDigest extends Schema.Class<ResearchDigest>(\"ResearchDigest\")({\n findings: Schema.Array(SummaryFinding),\n nextAction: Schema.Literal(\"review\"),\n}) {}\n\n/** Parent-only transcript markers proving child context isolation (SUB-006/SUB-015). */\nexport const docsCoordinatorConfidentialMarker = \"docs-coordinator-vault-19x\";\nexport const docsMissionConfidentialMarker = \"docs-mission-dossier-42f\";\n\nexport const DocsResearcherToolkit = Toolkit.make(delegateDocumentSummary.tool);\n\nexport const DocsResearcher = Agent.make(\"docs-researcher\", {\n input: ResearchRequest,\n output: ResearchDigest,\n instructions: [\n \"You are the Effect Agent P7 docs-researcher coordinator.\",\n `Coordinator-only context: ${docsCoordinatorConfidentialMarker}.`,\n \"Call delegate_document_summary once per requested document in one Tool batch.\",\n \"Return only a JSON digest built from the delegated findings. This is read-only research.\",\n ].join(\"\\n\"),\n toolkit: DocsResearcherToolkit,\n policy: AgentPolicy.make({\n maxTurns: 2,\n maxToolCalls: 2,\n maxDuration: \"30 seconds\",\n toolConcurrency: 2,\n }),\n description: \"Coordinate per-document summarization through one declared delegation Tool.\",\n metadata: { deploymentClass: \"DN\", phase: \"P7\" },\n});\n\n/** The default two-document research mission. */\nexport const researchMissionRequest = ResearchRequest.make({\n question: `Summarize the durability and subagent notes; keep ${docsMissionConfidentialMarker} inside the coordinator thread.`,\n documentIds: researchCorpusDocumentIds,\n});\n\n/** The coordinator's expected final digest for the given documents. */\nexport const expectedResearchDigest = (\n documentIds: ReadonlyArray<string> = researchCorpusDocumentIds,\n): ResearchDigest =>\n ResearchDigest.make({\n findings: documentIds.map((documentId) => {\n const summary = documentSummaryFor(documentId);\n\n return SummaryFinding.make({\n documentId: summary.documentId,\n summary: summary.summary,\n });\n }),\n nextAction: \"review\",\n });\n","import {\n McpConnectionRequest,\n McpConnector,\n McpServerIdentity,\n McpToolkitMismatch,\n type McpConnection,\n} from \"@effect-agent/capabilities/Mcp\";\nimport type { JsonSchema } from \"effect\";\nimport { Effect, JsonPointer, Layer, Schema } from \"effect\";\nimport { Tool } from \"effect/unstable/ai\";\nimport * as McpSchema from \"effect/unstable/ai/McpSchema\";\n\nimport { DocContentToolkit, FetchDocument } from \"./definition.ts\";\n\n// ---------------------------------------------------------------------------\n// Scripted MCP fixture: a deterministic `McpConnector` adapter that serves the\n// doc-summarizer's content tool. Discovery entries are DERIVED from the\n// authored Tool (`Tool.getJsonSchema`), so `validateMcpDiscovery` digesting\n// both sides is a real check, not a tautology; the mismatch and over-limit\n// connectors below serve deliberately wrong contracts so tests can pin the\n// fail-closed paths (CAP-009, SEC-013).\n// ---------------------------------------------------------------------------\n\n/** Framework-side hard bounds one docs-researcher assembly requests. */\nexport const docsMcpRequest = McpConnectionRequest.make({\n serverId: \"docs-content-mcp\",\n maxToolCount: 4,\n maxToolDescriptionBytes: 256,\n maxDiscoveryBytes: 16_384,\n connectTimeoutMillis: 1_000,\n});\n\nexport const docsMcpIdentity = McpServerIdentity.make({\n serverId: docsMcpRequest.serverId,\n implementation: McpSchema.Implementation.make({\n name: \"docs-researcher-content-fixture\",\n version: \"1.0.0\",\n }),\n});\n\n/**\n * `Tool.getJsonSchema` produces a `$ref`/`$defs`-shaped schema for\n * `FetchDocument`'s named, refined parameters type, but `McpSchema.Tool`'s\n * `inputSchema` requires a flat `{ type: \"object\", ... }` root — the shape a\n * real MCP server advertises on the wire. This inlines the single top-level\n * `$ref` so the derivation described above still holds byte-for-byte.\n */\nconst JsonSchemaDefinitions = Schema.Record(\n Schema.String,\n Schema.Record(Schema.String, Schema.Unknown),\n);\n\nconst decodeJsonSchemaDefinitions = Schema.decodeUnknownSync(JsonSchemaDefinitions);\nconst decodeToolJsonSchema = Schema.decodeUnknownSync(McpSchema.ToolJsonSchema);\n\nconst flattenTopLevelRef = (schema: JsonSchema.JsonSchema): McpSchema.ToolJsonSchema => {\n const ref = schema[\"$ref\"];\n\n if (typeof ref !== \"string\") {\n return decodeToolJsonSchema(schema);\n }\n\n const defs = decodeJsonSchemaDefinitions(schema[\"$defs\"]);\n\n const key = ref.startsWith(\"#/$defs/\")\n ? JsonPointer.unescapeToken(ref.slice(\"#/$defs/\".length))\n : undefined;\n\n const resolved = key !== undefined && Object.hasOwn(defs, key) ? defs[key] : undefined;\n\n return decodeToolJsonSchema(resolved ?? schema);\n};\n\nconst fetchDocumentOutputSchema = flattenTopLevelRef(\n Tool.getJsonSchemaFromSchema(FetchDocument.successSchema),\n);\n\nconst discoveredFetchDocument = McpSchema.Tool.make({\n name: FetchDocument.name,\n description: \"Fetch one bounded research document by its identifier.\",\n inputSchema: flattenTopLevelRef(Tool.getJsonSchema(FetchDocument)),\n // `validateMcpDiscovery` only compares an `outputSchema` derived down to an\n // object type; mirror that so this fixture stays a real round-trip check.\n ...(fetchDocumentOutputSchema.type === \"object\"\n ? { outputSchema: fetchDocumentOutputSchema }\n : {}),\n});\n\nconst scriptedConnector = (tools: ReadonlyArray<McpSchema.Tool>): Layer.Layer<McpConnector> =>\n Layer.succeed(McpConnector)({\n connect: () =>\n Effect.acquireRelease(\n Effect.succeed({\n identity: docsMcpIdentity,\n capabilities: McpSchema.ServerCapabilities.make({}),\n tools,\n toolkit: DocContentToolkit,\n }),\n () => Effect.void,\n ),\n });\n\n/** The well-behaved scripted content server. */\nexport const docsMcpConnectorLayer: Layer.Layer<McpConnector> = scriptedConnector([\n discoveredFetchDocument,\n]);\n\n/** Serves a tool description exceeding `maxToolDescriptionBytes` (SEC-013 bound). */\nexport const docsMcpOversizedConnectorLayer: Layer.Layer<McpConnector> = scriptedConnector([\n McpSchema.Tool.make({\n name: discoveredFetchDocument.name,\n description: \"x\".repeat(1_024),\n inputSchema: discoveredFetchDocument.inputSchema,\n }),\n]);\n\n/** Serves a discovery schema that disagrees with the authored toolkit (drift fails closed). */\nexport const docsMcpMismatchedConnectorLayer: Layer.Layer<McpConnector> = scriptedConnector([\n McpSchema.Tool.make({\n name: discoveredFetchDocument.name,\n description: discoveredFetchDocument.description,\n inputSchema: { type: \"object\", properties: { url: { type: \"string\" } } },\n }),\n]);\n\nconst isJsonEqual = (left: unknown, right: unknown): boolean =>\n JSON.stringify(left) === JSON.stringify(right);\n\n/**\n * Bind DISCOVERY to AUTHORING: `validateMcpDiscovery` (inside `connectMcp`)\n * already proved the served discovery matches the connection's own Toolkit;\n * this check additionally proves that Toolkit is the exact toolkit the\n * doc-summarizer was AUTHORED against — same tool names, same derived JSON\n * schemas — so a connector cannot substitute a look-alike toolkit. The\n * docs-researcher harness runs it before any worker Binding registration and\n * fails closed on any drift.\n */\nexport const assertDiscoveryMatchesAuthoredToolkit = Effect.fn(\n \"DocsResearcher.assertDiscoveryMatchesAuthoredToolkit\",\n)(function* (connection: McpConnection): Effect.fn.Return<void, McpToolkitMismatch> {\n const authored = Object.values(DocContentToolkit.tools)\n .map((tool) => ({ name: tool.name, inputSchema: Tool.getJsonSchema(tool) }))\n .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));\n\n const discovered = Object.values(connection.toolkit.tools)\n .map((tool) => ({ name: tool.name, inputSchema: Tool.getJsonSchema(tool) }))\n .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));\n\n const matches =\n authored.length === discovered.length &&\n authored.every(\n (tool, index) =>\n tool.name === discovered[index]?.name &&\n isJsonEqual(tool.inputSchema, discovered[index]?.inputSchema),\n );\n\n if (!matches) {\n return yield* McpToolkitMismatch.make({\n serverId: connection.discovery.identity.serverId,\n message:\n \"The MCP-discovered toolkit does not match the doc-summarizer's authored content toolkit\",\n });\n }\n});\n\n/** Round-trip guard for encoded discovery values persisted as fixture evidence. */\nexport const DocsMcpDiscoveryEvidence = Schema.Struct({\n serverId: Schema.NonEmptyString,\n toolCount: Schema.Natural,\n encodedBytes: Schema.Natural,\n toolkitSchemaDigest: Schema.String,\n});\n","import { connectMcp, type McpDiscovery } from \"@effect-agent/capabilities/Mcp\";\nimport {\n Redactor,\n type RedactedPreview,\n type RedactionError,\n} from \"@effect-agent/capabilities/Redaction\";\nimport { SubagentReservationsMemoryLive } from \"@effect-agent/capabilities/SubagentReservations\";\nimport * as Agent from \"@effect-agent/core/Agent\";\nimport { type ThreadId } from \"@effect-agent/core/Identifiers\";\nimport { DurableWorkerBinding, type ResolvedBinding } from \"@effect-agent/thread/AgentRegistration\";\nimport { type DurableSubmitOptions } from \"@effect-agent/thread/DurableAgentRuntime\";\nimport { DefinitionDigests, DeploymentId, Digest, ProducerId } from \"@effect-agent/thread/Records\";\nimport { Principal, type IdempotencyKey } from \"@effect-agent/thread/SubmissionLedger\";\nimport type { Crypto } from \"effect\";\nimport { Effect, Layer, Ref, Schema, Stream } from \"effect\";\nimport { LanguageModel, Model, type Response } from \"effect/unstable/ai\";\n\nimport { DeterministicIdGeneratorLayer } from \"../travel-planner/deterministic-layers.ts\";\nimport {\n DocsResearcher,\n DocSummarizer,\n DocumentLibrary,\n docContentToolkitLayer,\n docsSummaryHandlersLayer,\n encodedDocumentSummary,\n expectedResearchDigest,\n ResearchDigest,\n ResearchDocument,\n researchCorpusDocumentIds,\n researchDocumentFor,\n researchDocumentLookup,\n} from \"./definition.ts\";\nimport {\n assertDiscoveryMatchesAuthoredToolkit,\n docsMcpConnectorLayer,\n docsMcpRequest,\n} from \"./mcp.ts\";\n\n// ---------------------------------------------------------------------------\n// DN durable harness for the docs-researcher (P7 plan §6 agent #3), following\n// `makeDurableResearchHarness` conventions: invocation counters and captured\n// prompts live OUTSIDE the Model Layers so they survive Layer rebuilds across\n// Attempts and separate runtime handles over the same SQLite file.\n// ---------------------------------------------------------------------------\n\nexport const docsResearcherDeploymentId = Schema.decodeSync(DeploymentId)(\n \"docs-researcher-p7-deployment\",\n);\n\nexport const docsResearcherProducerId = Schema.decodeSync(ProducerId)(\n \"docs-researcher-p7-producer\",\n);\n\nexport const docsResearcherPrincipal = Schema.decodeSync(Principal)(\"docs-researcher-p7-principal\");\n\nconst digestOf = (pair: string) => Schema.decodeSync(Digest)(pair.repeat(32));\n\n/** Redacted, deterministic coordinator definition digests for this fixture version. */\nexport const docsCoordinatorDigests = DefinitionDigests.make({\n agent: digestOf(\"40\"),\n model: digestOf(\"41\"),\n tools: digestOf(\"42\"),\n});\n\n/** The child registration digests — byte-equal to `docsSummarizerDigestStrings` (SUB-023). */\nexport const docsSummarizerDigests = DefinitionDigests.make({\n agent: digestOf(\"50\"),\n model: digestOf(\"51\"),\n tools: digestOf(\"52\"),\n});\n\n/** Durable admission options for one docs-researcher Submission on one mission lane. */\nexport const docsResearcherSubmitOptions = (\n threadId: ThreadId,\n idempotencyKey: IdempotencyKey,\n): DurableSubmitOptions => ({\n threadId,\n principal: docsResearcherPrincipal,\n idempotencyKey,\n definitions: docsCoordinatorDigests,\n});\n\n/** The structural submit slice of the coordinator Binding (`DurableAgentRuntime.submit`). */\nexport const docsResearcherSubmitAgent = {\n definition: { id: DocsResearcher.id, input: DocsResearcher.input },\n} as const;\n\n/** The deterministic delegation Tool Call identity for one document. */\nexport const summarizeCallId = (documentId: string): string => `summarize-${documentId}`;\n\n/** The child's own scripted fetch Tool Call identity for one document. */\nexport const fetchCallId = (documentId: string): string => `fetch-${documentId}`;\n\nconst scriptedUsage = { inputTokens: { total: 96 }, outputTokens: { total: 64 } };\n\nconst summaryDelegationParts = (\n documentIds: ReadonlyArray<string>,\n): ReadonlyArray<Response.StreamPartEncoded> => [\n ...documentIds.map((documentId): Response.StreamPartEncoded => ({\n type: \"tool-call\",\n id: summarizeCallId(documentId),\n name: \"delegate_document_summary\",\n params: { documentId },\n providerExecuted: false,\n })),\n { type: \"finish\", reason: \"tool-calls\", usage: scriptedUsage },\n];\n\nconst digestParts = (\n documentIds: ReadonlyArray<string>,\n): ReadonlyArray<Response.StreamPartEncoded> => [\n { type: \"text-start\", id: \"digest\" },\n {\n type: \"text-delta\",\n id: \"digest\",\n delta: JSON.stringify(Schema.encodeSync(ResearchDigest)(expectedResearchDigest(documentIds))),\n },\n { type: \"text-end\", id: \"digest\" },\n { type: \"finish\", reason: \"stop\", usage: scriptedUsage },\n];\n\nconst fetchParts = (documentId: string): ReadonlyArray<Response.StreamPartEncoded> => [\n {\n type: \"tool-call\",\n id: fetchCallId(documentId),\n name: \"fetch_document\",\n params: { documentId },\n providerExecuted: false,\n },\n { type: \"finish\", reason: \"tool-calls\", usage: scriptedUsage },\n];\n\nconst summaryParts = (documentId: string): ReadonlyArray<Response.StreamPartEncoded> => [\n { type: \"text-start\", id: \"document-summary\" },\n { type: \"text-delta\", id: \"document-summary\", delta: encodedDocumentSummary(documentId) },\n { type: \"text-end\", id: \"document-summary\" },\n { type: \"finish\", reason: \"stop\", usage: scriptedUsage },\n];\n\n/**\n * One prompt-aware scripted model with externally observable counters. A DN\n * Attempt may resume on a fresh Layer build, so responses derive from the\n * committed history in the prompt — never from an in-Layer turn counter.\n */\nconst makeCountingModel = (\n name: string,\n decide: (promptJson: string) => Effect.Effect<ReadonlyArray<Response.StreamPartEncoded>>,\n) =>\n Effect.gen(function* () {\n const calls = yield* Ref.make(0);\n const prompts = yield* Ref.make<ReadonlyArray<string>>([]);\n\n const model = Model.make(\n \"scripted\",\n name,\n Layer.effect(\n LanguageModel.LanguageModel,\n LanguageModel.make({\n generateText: () => Effect.succeed([]),\n streamText: (request) =>\n Stream.unwrap(\n Effect.gen(function* () {\n yield* Ref.update(calls, (value) => value + 1);\n const promptJson = JSON.stringify(request.prompt);\n\n yield* Ref.update(prompts, (previous) => [...previous, promptJson]);\n\n return Stream.fromIterable(yield* decide(promptJson));\n }),\n ),\n }),\n ),\n );\n\n return { model, calls: Ref.get(calls), prompts: Ref.get(prompts) };\n });\n\n/** Optional overrides for one docs-researcher harness. */\nexport interface DocsResearcherHarnessOptions {\n /** Documents to research; defaults to the full two-document corpus. */\n readonly documentIds?: ReadonlyArray<string> | undefined;\n}\n\n/** One durable coordinator/summarizer pair with observable counters and MCP evidence. */\nexport interface DocsResearcherHarness {\n /** Resolved registrations for the parent and child workers. */\n readonly bindings: ReadonlyArray<ResolvedBinding>;\n /** The validated MCP discovery the child toolkit registration was gated on. */\n readonly discovery: McpDiscovery;\n /** Total coordinator model invocations across every Attempt and runtime handle. */\n readonly parentModelCalls: Effect.Effect<number>;\n /** JSON-encoded coordinator prompts in request order. */\n readonly parentPrompts: Effect.Effect<ReadonlyArray<string>>;\n /** Total summarizer model invocations across every Attempt and runtime handle. */\n readonly childModelCalls: Effect.Effect<number>;\n /** JSON-encoded summarizer prompts in request order (context-isolation evidence). */\n readonly childPrompts: Effect.Effect<ReadonlyArray<string>>;\n /** MCP content-tool handler executions for one document (external side-effect record). */\n readonly fetchInvocations: (documentId: string) => Effect.Effect<number>;\n}\n\n/**\n * Build the docs-researcher harness. Order matters and is the point: the\n * child's content toolkit is only registered as a worker Binding AFTER the\n * MCP connector's bounded discovery validated the authored toolkit\n * byte-for-byte (`connectMcp` + `assertDiscoveryMatchesAuthoredToolkit`), so\n * \"the tools the summarizer runs are the tools discovery served\" is enforced\n * at assembly, not assumed. Content-tool execution then flows through the\n * counting `DocumentLibrary` — the scripted MCP server's content store.\n */\nexport const makeDocsResearcherHarness = (options?: DocsResearcherHarnessOptions) =>\n Effect.gen(function* () {\n const documentIds = options?.documentIds ?? researchCorpusDocumentIds;\n\n // MCP discovery gate (CAP-009): bounded, digest-verified, fail-closed.\n const discovery = yield* Effect.scoped(\n Effect.gen(function* () {\n const connection = yield* connectMcp(docsMcpRequest);\n\n yield* assertDiscoveryMatchesAuthoredToolkit(connection);\n\n return connection.discovery;\n }),\n ).pipe(Effect.provide(docsMcpConnectorLayer));\n\n const fetchCounts = yield* Ref.make<ReadonlyMap<string, number>>(new Map());\n\n const libraryLayer = Layer.succeed(\n DocumentLibrary,\n DocumentLibrary.of({\n fetch: (query) =>\n Ref.update(fetchCounts, (current) =>\n new Map(current).set(query.documentId, (current.get(query.documentId) ?? 0) + 1),\n ).pipe(Effect.andThen(researchDocumentLookup(query))),\n }),\n );\n\n const childToolkitLayer = docContentToolkitLayer.pipe(Layer.provideMerge(libraryLayer));\n\n const childModel = yield* makeCountingModel(\"doc-summarizer-p7\", (promptJson) =>\n Effect.suspend(() => {\n const documentId = documentIds.find((candidate) => promptJson.includes(candidate));\n\n if (documentId === undefined) {\n return Effect.die(new Error(\"The summarizer prompt names no corpus document\"));\n }\n\n return Effect.succeed(\n promptJson.includes(fetchCallId(documentId))\n ? summaryParts(documentId)\n : fetchParts(documentId),\n );\n }),\n );\n\n const childBinding = Agent.withModel(DocSummarizer, childModel.model);\n\n const firstCallId = summarizeCallId(documentIds[0] ?? \"durability-notes\");\n\n const parentModel = yield* makeCountingModel(\"docs-researcher-p7\", (promptJson) =>\n Effect.succeed(\n promptJson.includes(firstCallId)\n ? digestParts(documentIds)\n : summaryDelegationParts(documentIds),\n ),\n );\n\n const parentBinding = Agent.withModel(DocsResearcher, parentModel.model);\n\n const delegationLayer = docsSummaryHandlersLayer(childBinding).pipe(\n Layer.provide(\n Layer.mergeAll(\n childToolkitLayer,\n SubagentReservationsMemoryLive,\n DeterministicIdGeneratorLayer,\n ),\n ),\n );\n\n const parentResolved: ResolvedBinding = yield* DurableWorkerBinding.make(\n parentBinding,\n docsCoordinatorDigests,\n ).pipe(Effect.provide(delegationLayer));\n\n const childResolved: ResolvedBinding = yield* DurableWorkerBinding.make(\n childBinding,\n docsSummarizerDigests,\n ).pipe(Effect.provide(childToolkitLayer));\n\n const harness: DocsResearcherHarness = {\n bindings: [parentResolved, childResolved],\n discovery,\n parentModelCalls: parentModel.calls,\n parentPrompts: parentModel.prompts,\n childModelCalls: childModel.calls,\n childPrompts: childModel.prompts,\n fetchInvocations: (documentId) =>\n Ref.get(fetchCounts).pipe(Effect.map((current) => current.get(documentId) ?? 0)),\n };\n\n return harness;\n });\n\nconst encodeResearchDocument = Schema.encodeEffect(ResearchDocument);\n\n/**\n * The audit-surface preview of one fetched document: the raw document —\n * secret marker and all — passes through the configured structural `Redactor`\n * before anything may quote it outside the child Thread (SEC-008,\n * CAP-013). Tests assert the preview keeps shape but no scalar content.\n */\nexport const redactedDocumentPreview = Effect.fn(\"DocsResearcher.redactedDocumentPreview\")(\n function* (documentId: string): Effect.fn.Return<RedactedPreview, RedactionError, Redactor> {\n const redactor = yield* Redactor;\n\n const encoded = yield* encodeResearchDocument(researchDocumentFor(documentId)).pipe(\n Effect.orDie,\n );\n\n return yield* redactor.redact(encoded);\n },\n);\n\n// Crypto is deliberately in the harness requirements (`connectMcp` digests\n// discovery): callers provide a platform Crypto Layer, keeping this fixture\n// platform-neutral.\nexport type DocsResearcherHarnessRequirements = Crypto.Crypto;\n"],"m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AAyB,YAAY,CAAC,CAAC,KAC7D,MAAM,QACJ,MAAM,SACJ,mBACA,gCACA,6BACF,CACF,CACF;CAuBA,OAAO;EAVL,UAAU,CAAC,OAXkC,qBAAqB,KAClE,eACA,sBACF,CAAC,CAAC,KAAK,OAAO,QAAQ,eAAe,CAAC,GAQT,OANiB,qBAAqB,KACjE,cACA,qBACF,CAAC,CAAC,KAAK,OAAO,QAAQ,iBAAiB,CAAC,CAGE;EACxC;EACA,kBAAkB,YAAY;EAC9B,eAAe,YAAY;EAC3B,iBAAiB,WAAW;EAC5B,cAAc,WAAW;EACzB,mBAAmB,eACjB,IAAI,IAAI,WAAW,CAAC,CAAC,KAAK,OAAO,KAAK,YAAY,QAAQ,IAAI,UAAU,KAAK,CAAC,CAAC;CAGtE;AACf,CAAC;AAEH,MAAM,yBAAyB,OAAO,aAAa,gBAAgB;;;;;;;AAQnE,MAAa,0BAA0B,OAAO,GAAG,wCAAwC,CAAC,CACxF,WAAW,YAAiF;CAC1F,MAAM,WAAW,OAAO;CAExB,MAAM,UAAU,OAAO,uBAAuB,oBAAoB,UAAU,CAAC,CAAC,CAAC,KAC7E,OAAO,KACT;CAEA,OAAO,OAAO,SAAS,OAAO,OAAO;AACvC,CACF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
2
|
import { AiError, LanguageModel, Response } from "effect/unstable/ai";
|
|
3
|
-
|
|
3
|
+
declare namespace ScriptedModel_d_exports {
|
|
4
|
+
export { ScriptedGeneratePart, ScriptedGenerateTurn, ScriptedModel, ScriptedRequest, ScriptedRequestKind, ScriptedStreamPart, ScriptedStreamTermination, ScriptedStreamTurn, ScriptedTurn, ScriptedTurnHooks, ScriptedTurnInput };
|
|
5
|
+
}
|
|
4
6
|
/**
|
|
5
7
|
* Schema for encoded, non-streaming Effect AI response parts.
|
|
6
8
|
*
|
|
@@ -673,5 +675,5 @@ declare class ScriptedModel extends ScriptedModel_base {
|
|
|
673
675
|
static layer(turns: ReadonlyArray<ScriptedTurnInput>): Layer.Layer<LanguageModel.LanguageModel | ScriptedModel, never, never>;
|
|
674
676
|
}
|
|
675
677
|
//#endregion
|
|
676
|
-
export {
|
|
677
|
-
//# sourceMappingURL=
|
|
678
|
+
export { ScriptedRequest as a, ScriptedStreamTermination as c, ScriptedTurnHooks as d, ScriptedTurnInput as f, ScriptedModel_d_exports as i, ScriptedStreamTurn as l, ScriptedGenerateTurn as n, ScriptedRequestKind as o, ScriptedModel as r, ScriptedStreamPart as s, ScriptedGeneratePart as t, ScriptedTurn as u };
|
|
679
|
+
//# sourceMappingURL=ScriptedModel-Dx8aW73W.d.mts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ScriptedRequest, c as ScriptedStreamTermination, d as ScriptedTurnHooks, f as ScriptedTurnInput, l as ScriptedStreamTurn, n as ScriptedGenerateTurn, o as ScriptedRequestKind, r as ScriptedModel, s as ScriptedStreamPart, t as ScriptedGeneratePart, u as ScriptedTurn } from "./ScriptedModel-Dx8aW73W.mjs";
|
|
2
|
+
export { ScriptedGeneratePart, ScriptedGenerateTurn, ScriptedModel, ScriptedRequest, ScriptedRequestKind, ScriptedStreamPart, ScriptedStreamTermination, ScriptedStreamTurn, ScriptedTurn, ScriptedTurnHooks, ScriptedTurnInput };
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
1
2
|
import { Context, Effect, Layer, Ref, Schema, Stream } from "effect";
|
|
2
3
|
import { AiError, LanguageModel, Response } from "effect/unstable/ai";
|
|
3
|
-
//#region src/
|
|
4
|
+
//#region src/ScriptedModel.ts
|
|
5
|
+
var ScriptedModel_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
ScriptedGeneratePart: () => ScriptedGeneratePart,
|
|
7
|
+
ScriptedGenerateTurn: () => ScriptedGenerateTurn,
|
|
8
|
+
ScriptedModel: () => ScriptedModel,
|
|
9
|
+
ScriptedStreamPart: () => ScriptedStreamPart,
|
|
10
|
+
ScriptedStreamTermination: () => ScriptedStreamTermination,
|
|
11
|
+
ScriptedStreamTurn: () => ScriptedStreamTurn,
|
|
12
|
+
ScriptedTurn: () => ScriptedTurn
|
|
13
|
+
});
|
|
4
14
|
const ScriptedPartMetadata = Schema.Record(Schema.String, Schema.NullOr(Schema.Json));
|
|
5
15
|
const ScriptedPartBase = { metadata: Schema.optionalKey(ScriptedPartMetadata) };
|
|
6
16
|
const ScriptedToolCallPart = Schema.Struct({
|
|
@@ -162,6 +172,6 @@ var ScriptedModel = class ScriptedModel extends Context.Service()("@effect-agent
|
|
|
162
172
|
}
|
|
163
173
|
};
|
|
164
174
|
//#endregion
|
|
165
|
-
export {
|
|
175
|
+
export { ScriptedGeneratePart, ScriptedGenerateTurn, ScriptedModel, ScriptedStreamPart, ScriptedStreamTermination, ScriptedStreamTurn, ScriptedTurn, ScriptedModel_exports as t };
|
|
166
176
|
|
|
167
|
-
//# sourceMappingURL=
|
|
177
|
+
//# sourceMappingURL=ScriptedModel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScriptedModel.mjs","names":[],"sources":["../src/ScriptedModel.ts"],"sourcesContent":["import { Context, Effect, Layer, Ref, Schema, Stream } from \"effect\";\nimport { AiError, LanguageModel, Response } from \"effect/unstable/ai\";\n\nconst ScriptedPartMetadata = Schema.Record(Schema.String, Schema.NullOr(Schema.Json));\n\nconst ScriptedPartBase = {\n metadata: Schema.optionalKey(ScriptedPartMetadata),\n};\n\nconst ScriptedToolCallPart = Schema.Struct({\n ...ScriptedPartBase,\n type: Schema.Literal(\"tool-call\"),\n id: Schema.String,\n name: Schema.String,\n params: Schema.Unknown,\n providerExecuted: Schema.optionalKey(Schema.Boolean),\n});\n\nconst ScriptedToolResultPart = Schema.Struct({\n ...ScriptedPartBase,\n type: Schema.Literal(\"tool-result\"),\n id: Schema.String,\n name: Schema.String,\n result: Schema.Unknown,\n isFailure: Schema.Boolean,\n providerExecuted: Schema.optionalKey(Schema.Boolean),\n preliminary: Schema.optionalKey(Schema.Boolean),\n});\n\n/**\n * Schema for encoded, non-streaming Effect AI response parts.\n *\n * Generic Tool payloads remain explicitly unknown here. `LanguageModel.make`\n * performs the toolkit-specific decode when the scripted response is consumed.\n */\nexport const ScriptedGeneratePart = Schema.Union([\n Schema.toEncoded(Response.TextPart),\n Schema.toEncoded(Response.ReasoningPart),\n Schema.toEncoded(Response.ReasoningDeltaPart),\n Schema.toEncoded(Response.ReasoningEndPart),\n ScriptedToolCallPart,\n ScriptedToolResultPart,\n Schema.toEncoded(Response.ToolApprovalRequestPart),\n Schema.toEncoded(Response.FilePart),\n Schema.toEncoded(Response.DocumentSourcePart),\n Schema.toEncoded(Response.UrlSourcePart),\n Schema.toEncoded(Response.ResponseMetadataPart),\n Schema.toEncoded(Response.FinishPart),\n]).annotate({ identifier: \"ScriptedGeneratePart\" });\n\nexport type ScriptedGeneratePart = typeof ScriptedGeneratePart.Type;\n\n/**\n * Schema for encoded Effect AI streaming response parts.\n */\nexport const ScriptedStreamPart = Schema.Union([\n Schema.toEncoded(Response.TextStartPart),\n Schema.toEncoded(Response.TextDeltaPart),\n Schema.toEncoded(Response.TextEndPart),\n Schema.toEncoded(Response.ReasoningStartPart),\n Schema.toEncoded(Response.ReasoningDeltaPart),\n Schema.toEncoded(Response.ReasoningEndPart),\n Schema.toEncoded(Response.ToolParamsStartPart),\n Schema.toEncoded(Response.ToolParamsDeltaPart),\n Schema.toEncoded(Response.ToolParamsEndPart),\n ScriptedToolCallPart,\n ScriptedToolResultPart,\n Schema.toEncoded(Response.ToolApprovalRequestPart),\n Schema.toEncoded(Response.FilePart),\n Schema.toEncoded(Response.DocumentSourcePart),\n Schema.toEncoded(Response.UrlSourcePart),\n Schema.toEncoded(Response.ResponseMetadataPart),\n Schema.toEncoded(Response.FinishPart),\n Schema.toEncoded(Response.ErrorPart),\n]).annotate({ identifier: \"ScriptedStreamPart\" });\n\nexport type ScriptedStreamPart = typeof ScriptedStreamPart.Type;\n\n/** Controls whether a scripted stream completes, fails, or waits for interruption. */\nexport const ScriptedStreamTermination = Schema.Union([\n Schema.TaggedStruct(\"Complete\", {}),\n Schema.TaggedStruct(\"Fail\", {\n description: Schema.String,\n }),\n Schema.TaggedStruct(\"Hang\", {}),\n]);\n\nexport type ScriptedStreamTermination = typeof ScriptedStreamTermination.Type;\n\n/** One non-streaming invocation and the encoded response parts it returns. */\nexport const ScriptedGenerateTurn = Schema.TaggedStruct(\"Generate\", {\n parts: Schema.Array(ScriptedGeneratePart),\n});\n\nexport type ScriptedGenerateTurn = typeof ScriptedGenerateTurn.Type;\n\n/** One streaming invocation with its encoded parts and terminal behavior. */\nexport const ScriptedStreamTurn = Schema.TaggedStruct(\"Stream\", {\n parts: Schema.Array(ScriptedStreamPart),\n termination: ScriptedStreamTermination,\n});\n\nexport type ScriptedStreamTurn = typeof ScriptedStreamTurn.Type;\n\n/**\n * Serializable grammar for one finite scripted provider invocation.\n */\nexport const ScriptedTurn = Schema.Union([ScriptedGenerateTurn, ScriptedStreamTurn]);\nexport type ScriptedTurn = typeof ScriptedTurn.Type;\n\nexport type ScriptedRequestKind = \"generate\" | \"stream\";\n\n/**\n * A request after Effect AI has normalized its prompt, tools, response format,\n * tool choice, span, and incremental-response fields.\n */\nexport interface ScriptedRequest {\n readonly kind: ScriptedRequestKind;\n readonly options: LanguageModel.ProviderOptions;\n}\n\n/** Optional request assertions and stream lifecycle effects for one scripted turn. */\nexport interface ScriptedTurnHooks {\n /** Runs against the normalized provider request before producing the response. */\n readonly assertRequest?: (\n request: LanguageModel.ProviderOptions,\n ) => Effect.Effect<void, AiError.AiError> | void;\n /** Runs immediately before the scripted stream begins emitting parts. */\n readonly onStreamStart?: Effect.Effect<void> | undefined;\n /** Runs when the scripted stream completes, fails, or is interrupted. */\n readonly onStreamFinalize?: Effect.Effect<void> | undefined;\n}\n\n/**\n * Runtime hooks are deliberately separate from the serializable turn grammar.\n */\nexport type ScriptedTurnInput = ScriptedTurn & ScriptedTurnHooks;\n\ninterface ScriptState {\n readonly remaining: ReadonlyArray<ScriptedTurnInput>;\n readonly requests: ReadonlyArray<ScriptedRequest>;\n}\n\nconst scriptedError = (method: string, description: string): AiError.AiError =>\n AiError.AiError.make({\n module: \"@effect-agent/testing/ScriptedModel\",\n method,\n reason: AiError.UnknownError.make({ description }),\n });\n\nconst runAssertion = Effect.fn(\"ScriptedModel.runAssertion\")((\n assertion: ScriptedTurnHooks[\"assertRequest\"],\n request: LanguageModel.ProviderOptions,\n): Effect.Effect<void, AiError.AiError> => {\n if (assertion === undefined) {\n return Effect.void;\n }\n\n return Effect.suspend(() => {\n const result = assertion(request);\n\n return Effect.isEffect(result) ? result : Effect.void;\n });\n});\n\nconst takeTurn = Effect.fn(\"ScriptedModel.takeTurn\")(\n (\n state: Ref.Ref<ScriptState>,\n kind: ScriptedRequestKind,\n options: LanguageModel.ProviderOptions,\n ): Effect.Effect<ScriptedTurnInput, AiError.AiError> =>\n Ref.modify(state, (current) => {\n const turn = current.remaining[0];\n\n if (turn === undefined) {\n return [\n undefined,\n {\n ...current,\n requests: [...current.requests, { kind, options }],\n },\n ] as const;\n }\n\n return [\n turn,\n {\n remaining: current.remaining.slice(1),\n requests: [...current.requests, { kind, options }],\n },\n ] as const;\n }).pipe(\n Effect.flatMap((turn) =>\n turn === undefined\n ? Effect.fail(scriptedError(kind, `Script exhausted before the ${kind} request`))\n : Effect.succeed(turn),\n ),\n ),\n);\n\nconst requireGenerateTurn = (\n turn: ScriptedTurnInput,\n): Effect.Effect<ScriptedGenerateTurn & ScriptedTurnHooks, AiError.AiError> =>\n turn._tag === \"Generate\"\n ? Effect.succeed(turn)\n : Effect.fail(scriptedError(\"generate\", `Expected a Generate turn but found ${turn._tag}`));\n\nconst requireStreamTurn = (\n turn: ScriptedTurnInput,\n): Effect.Effect<ScriptedStreamTurn & ScriptedTurnHooks, AiError.AiError> =>\n turn._tag === \"Stream\"\n ? Effect.succeed(turn)\n : Effect.fail(scriptedError(\"stream\", `Expected a Stream turn but found ${turn._tag}`));\n\nconst streamForTurn = (\n turn: ScriptedStreamTurn & ScriptedTurnHooks,\n): Stream.Stream<Response.StreamPartEncoded, AiError.AiError> => {\n let stream: Stream.Stream<Response.StreamPartEncoded, AiError.AiError> = Stream.fromIterable(\n turn.parts,\n );\n\n switch (turn.termination._tag) {\n case \"Complete\": {\n break;\n }\n case \"Fail\": {\n stream = stream.pipe(\n Stream.concat(Stream.fail(scriptedError(\"stream\", turn.termination.description))),\n );\n break;\n }\n case \"Hang\": {\n stream = stream.pipe(Stream.concat(Stream.never));\n break;\n }\n }\n if (turn.onStreamStart !== undefined) {\n stream = Stream.fromEffectDrain(turn.onStreamStart).pipe(Stream.concat(stream));\n }\n if (turn.onStreamFinalize !== undefined) {\n stream = stream.pipe(Stream.ensuring(turn.onStreamFinalize));\n }\n\n return stream;\n};\n\n/** Inspection service for a deterministic LanguageModel backed by finite scripted turns. */\nexport class ScriptedModel extends Context.Service<\n ScriptedModel,\n {\n /** Normalized provider requests captured in invocation order. */\n readonly requests: Effect.Effect<ReadonlyArray<ScriptedRequest>>;\n /** Number of scripted turns not yet consumed. */\n readonly remaining: Effect.Effect<number>;\n /** Fails with `AiError` when any scripted turns remain. */\n readonly assertExhausted: Effect.Effect<void, AiError.AiError>;\n }\n>()(\"@effect-agent/testing/ScriptedModel\") {\n /**\n * Provides the native Effect AI `LanguageModel` and this inspection service.\n * Supplying the extra inspection service does not add it to model-call\n * requirements. Each model invocation consumes one turn before assertion and\n * turn-kind validation.\n */\n static layer(\n turns: ReadonlyArray<ScriptedTurnInput>,\n ): Layer.Layer<LanguageModel.LanguageModel | ScriptedModel, never, never> {\n return Layer.effectContext(\n Effect.gen(function* () {\n const state = yield* Ref.make<ScriptState>({\n remaining: [...turns],\n requests: [],\n });\n\n const languageModel = yield* LanguageModel.make({\n generateText: (options) =>\n Effect.gen(function* () {\n const turn = yield* takeTurn(state, \"generate\", options);\n\n yield* runAssertion(turn.assertRequest, options);\n const generateTurn = yield* requireGenerateTurn(turn);\n\n return [...generateTurn.parts];\n }),\n streamText: (options) =>\n Stream.unwrap(\n Effect.gen(function* () {\n const turn = yield* takeTurn(state, \"stream\", options);\n\n yield* runAssertion(turn.assertRequest, options);\n const streamTurn = yield* requireStreamTurn(turn);\n\n return streamForTurn(streamTurn);\n }),\n ),\n });\n\n const inspection = ScriptedModel.of({\n requests: Ref.get(state).pipe(Effect.map((current) => current.requests)),\n remaining: Ref.get(state).pipe(Effect.map((current) => current.remaining.length)),\n assertExhausted: Ref.get(state).pipe(\n Effect.flatMap((current) =>\n current.remaining.length === 0\n ? Effect.void\n : Effect.fail(\n scriptedError(\n \"assertExhausted\",\n `${current.remaining.length} scripted turn(s) remain`,\n ),\n ),\n ),\n ),\n });\n\n return Context.make(LanguageModel.LanguageModel, languageModel).pipe(\n Context.add(ScriptedModel, inspection),\n );\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,MAAM,uBAAuB,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,OAAO,IAAI,CAAC;AAEpF,MAAM,mBAAmB,EACvB,UAAU,OAAO,YAAY,oBAAoB,EACnD;AAEA,MAAM,uBAAuB,OAAO,OAAO;CACzC,GAAG;CACH,MAAM,OAAO,QAAQ,WAAW;CAChC,IAAI,OAAO;CACX,MAAM,OAAO;CACb,QAAQ,OAAO;CACf,kBAAkB,OAAO,YAAY,OAAO,OAAO;AACrD,CAAC;AAED,MAAM,yBAAyB,OAAO,OAAO;CAC3C,GAAG;CACH,MAAM,OAAO,QAAQ,aAAa;CAClC,IAAI,OAAO;CACX,MAAM,OAAO;CACb,QAAQ,OAAO;CACf,WAAW,OAAO;CAClB,kBAAkB,OAAO,YAAY,OAAO,OAAO;CACnD,aAAa,OAAO,YAAY,OAAO,OAAO;AAChD,CAAC;;;;;;;AAQD,MAAa,uBAAuB,OAAO,MAAM;CAC/C,OAAO,UAAU,SAAS,QAA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/C,MAAM,aAAa,OAAO,kBAAkB,IAAI;KAEhD,OAAO,cAAc,UAAU;IACjC,CAAC,CACH;GACJ,CAAC;GAED,MAAM,aAAa,cAAc,GAAG;IAClC,UAAU,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,OAAO,KAAK,YAAY,QAAQ,QAAQ,CAAC;IACvE,WAAW,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,OAAO,KAAK,YAAY,QAAQ,UAAU,MAAM,CAAC;IAChF,iBAAiB,IAAI,IAAI,KAAK,CAAC,CAAC,KAC9B,OAAO,SAAS,YACd,QAAQ,UAAU,WAAW,IACzB,OAAO,OACP,OAAO,KACL,cACE,mBACA,GAAG,QAAQ,UAAU,OAAO,yBAC9B,CACF,CACN,CACF;GACF,CAAC;GAED,OAAO,QAAQ,KAAK,cAAc,eAAe,aAAa,CAAC,CAAC,KAC9D,QAAQ,IAAI,eAAe,UAAU,CACvC;EACF,CAAC,CACH;CACF;AACF"}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as ScriptedTurnInput, r as ScriptedModel } from "./ScriptedModel-Dx8aW73W.mjs";
|
|
2
2
|
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
3
3
|
import { LanguageModel, Model, Response, Tool, Toolkit } from "effect/unstable/ai";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
4
|
+
import * as Subagent from "@effect-agent/capabilities/Subagent";
|
|
5
|
+
import { SubagentPolicy } from "@effect-agent/capabilities/Subagent";
|
|
6
|
+
import * as Agent from "@effect-agent/core/Agent";
|
|
7
|
+
import { ThreadId } from "@effect-agent/core/Identifiers";
|
|
8
|
+
import { IdGenerator } from "@effect-agent/core/IdGenerator";
|
|
9
|
+
import { DurableStep, DurableStepError } from "@effect-agent/engine/DurableStep";
|
|
10
|
+
import { ResolvedBinding } from "@effect-agent/thread/AgentRegistration";
|
|
11
|
+
import { DurableSubmitOptions, Receipt } from "@effect-agent/thread/DurableAgentRuntime";
|
|
12
|
+
import { CanonicalBatch, CanonicalRecordEnvelope, DefinitionDigests, ProducerId } from "@effect-agent/thread/Records";
|
|
13
|
+
import { IdempotencyKey } from "@effect-agent/thread/SubmissionLedger";
|
|
14
|
+
import { ThreadCheckpoint } from "@effect-agent/thread/ThreadStore";
|
|
15
|
+
import { ToolReconciler } from "@effect-agent/thread/ToolReconciler";
|
|
16
|
+
import { RuntimeBinding } from "@effect-agent/engine/AgentRuntime";
|
|
17
|
+
import { ThreadHistory } from "@effect-agent/engine/ThreadHistory";
|
|
18
|
+
import { ThreadProjection } from "@effect-agent/thread/ThreadProjection";
|
|
8
19
|
//#region src/fixtures/travel-planner/definition.d.ts
|
|
9
20
|
declare const AirportCode: Schema.brand<Schema.NonEmptyString, "@effect-agent/testing/travel-planner/AirportCode">;
|
|
10
21
|
type AirportCode = typeof AirportCode.Type;
|
|
@@ -172,7 +183,7 @@ declare const TravelPlannerToolkitLayer: import("effect/Layer").Layer<Tool.Handl
|
|
|
172
183
|
readonly failureMode: "error";
|
|
173
184
|
}, LodgingCatalog>;
|
|
174
185
|
}>, never, never>;
|
|
175
|
-
declare const TravelPlanner:
|
|
186
|
+
declare const TravelPlanner: Agent.Definition<typeof TripRequest, typeof TravelPlan, (input: TripRequest) => Effect.Effect<string, GuidanceFailure, TravelGuidance>, Toolkit.Toolkit<{
|
|
176
187
|
readonly search_activities: Tool.Tool<"search_activities", {
|
|
177
188
|
readonly parameters: typeof ActivityQuery;
|
|
178
189
|
readonly success: typeof ActivitySearchResult;
|
|
@@ -320,7 +331,7 @@ declare class SupplierBookingDesk extends SupplierBookingDesk_base {
|
|
|
320
331
|
}
|
|
321
332
|
declare const TravelGuidanceLayer: Layer.Layer<TravelGuidance, never, never>;
|
|
322
333
|
declare const DeterministicIdGeneratorLayer: Layer.Layer<IdGenerator, never, never>;
|
|
323
|
-
declare const TravelPlannerRuntimeLayer: Layer.Layer<ActivityCatalog | FlightCatalog | IdGenerator | LodgingCatalog | import("@effect-agent/engine").RunContextPreparation | ThreadHistory | TravelGuidance | import("effect/unstable/ai/Tool").HandlersFor<{
|
|
334
|
+
declare const TravelPlannerRuntimeLayer: Layer.Layer<ActivityCatalog | FlightCatalog | IdGenerator | LodgingCatalog | import("@effect-agent/engine/RunOptions").RunContextPreparation | ThreadHistory | TravelGuidance | import("effect/unstable/ai/Tool").HandlersFor<{
|
|
324
335
|
readonly search_activities: import("effect/unstable/ai/Tool").Tool<"search_activities", {
|
|
325
336
|
readonly parameters: typeof ActivityQuery;
|
|
326
337
|
readonly success: typeof ActivitySearchResult;
|
|
@@ -424,7 +435,7 @@ declare const TravelPlannerPhase2ToolkitLayer: import("effect/Layer").Layer<Tool
|
|
|
424
435
|
readonly failureMode: "error";
|
|
425
436
|
}, LodgingCatalog>;
|
|
426
437
|
}>, never, never>;
|
|
427
|
-
declare const TravelPlannerPhase2:
|
|
438
|
+
declare const TravelPlannerPhase2: Agent.Definition<typeof TripRequest, typeof TravelPlan, (input: TripRequest) => Effect.Effect<string, GuidanceFailure, TravelGuidance>, Toolkit.Toolkit<{
|
|
428
439
|
readonly hold_itinerary: Tool.Tool<"hold_itinerary", {
|
|
429
440
|
readonly parameters: typeof ItineraryHoldRequest;
|
|
430
441
|
readonly success: typeof ItineraryHold;
|
|
@@ -629,7 +640,7 @@ declare const TravelPlannerPhase4ToolkitLayer: Layer.Layer<Tool.HandlersFor<{
|
|
|
629
640
|
* runtime. The searches are read-only and safe to repeat across Attempts (D6); supplier booking
|
|
630
641
|
* is deliberately absent because DN does NOT claim replay-safe external mutation (P5 scope).
|
|
631
642
|
*/
|
|
632
|
-
declare const TravelPlannerPhase4:
|
|
643
|
+
declare const TravelPlannerPhase4: Agent.Definition<typeof TripRequest, typeof TravelPlan, (input: TripRequest) => Effect.Effect<string, GuidanceFailure, TravelGuidance>, Toolkit.Toolkit<{
|
|
633
644
|
readonly search_activities: Tool.Tool<"search_activities", {
|
|
634
645
|
readonly parameters: Schema.Struct<{
|
|
635
646
|
readonly destination: Schema.brand<Schema.NonEmptyString, "@effect-agent/testing/travel-planner/AirportCode">;
|
|
@@ -669,7 +680,7 @@ declare const TravelPlannerPhase4: import("@effect-agent/core").Definition<typeo
|
|
|
669
680
|
* The scripted Layer is rebuilt per Run, so every Run of one Binding replays the same
|
|
670
681
|
* deterministic script.
|
|
671
682
|
*/
|
|
672
|
-
declare const makePhase4TravelPlannerAgent: (turns?: ReadonlyArray<ScriptedTurnInput>) =>
|
|
683
|
+
declare const makePhase4TravelPlannerAgent: (turns?: ReadonlyArray<ScriptedTurnInput>) => Agent.Binding<Agent.Definition<typeof TripRequest, typeof TravelPlan, (input: TripRequest) => Effect.Effect<string, GuidanceFailure, TravelGuidance>, Toolkit.Toolkit<{
|
|
673
684
|
readonly search_activities: Tool.Tool<"search_activities", {
|
|
674
685
|
readonly parameters: Schema.Struct<{
|
|
675
686
|
readonly destination: Schema.brand<Schema.NonEmptyString, "@effect-agent/testing/travel-planner/AirportCode">;
|
|
@@ -1013,7 +1024,7 @@ declare const TravelSupplierReconcilerLayer: Layer.Layer<ToolReconciler, never,
|
|
|
1013
1024
|
* idempotent-by-contract cancellation, and one Durable Tool whose Steps carry supplier
|
|
1014
1025
|
* idempotency keys.
|
|
1015
1026
|
*/
|
|
1016
|
-
declare const TravelPlannerPhase5:
|
|
1027
|
+
declare const TravelPlannerPhase5: Agent.Definition<typeof TripRequest, typeof TravelBookingReport, string, Toolkit.Toolkit<{
|
|
1017
1028
|
readonly book_flight: Tool.Tool<"book_flight", {
|
|
1018
1029
|
readonly parameters: typeof FlightBookingRequest;
|
|
1019
1030
|
readonly success: typeof SupplierBookingConfirmation;
|
|
@@ -1183,7 +1194,7 @@ declare const DestinationReport_base: Schema.Class<DestinationReport, Schema.Str
|
|
|
1183
1194
|
readonly advisory: Schema.NonEmptyString;
|
|
1184
1195
|
}>, {}>;
|
|
1185
1196
|
declare class DestinationReport extends DestinationReport_base {}
|
|
1186
|
-
declare const DestinationResearcher:
|
|
1197
|
+
declare const DestinationResearcher: Agent.Definition<typeof DestinationBrief, typeof DestinationReport, "Consult lookup_destination exactly once for the briefed airport, then return only a JSON destination report.", Toolkit.Toolkit<{
|
|
1187
1198
|
readonly lookup_destination: Tool.Tool<"lookup_destination", {
|
|
1188
1199
|
readonly parameters: typeof DestinationQuery;
|
|
1189
1200
|
readonly success: typeof DestinationFacts;
|
|
@@ -1232,7 +1243,7 @@ declare class ResearchDispatchGate extends ResearchDispatchGate_base {
|
|
|
1232
1243
|
* most two running concurrently.
|
|
1233
1244
|
*/
|
|
1234
1245
|
declare const destinationResearchPolicy: SubagentPolicy;
|
|
1235
|
-
declare const destinationResearchDelegation:
|
|
1246
|
+
declare const destinationResearchDelegation: Subagent.SubagentDelegation<"delegate_destination_research", typeof DestinationBrief, typeof DestinationReport, "Consult lookup_destination exactly once for the briefed airport, then return only a JSON destination report.", {
|
|
1236
1247
|
readonly lookup_destination: Tool.Tool<"lookup_destination", {
|
|
1237
1248
|
readonly parameters: typeof DestinationQuery;
|
|
1238
1249
|
readonly success: typeof DestinationFacts;
|
|
@@ -1240,7 +1251,7 @@ declare const destinationResearchDelegation: import("@effect-agent/capabilities"
|
|
|
1240
1251
|
readonly failureMode: "error";
|
|
1241
1252
|
}, DestinationGuide>;
|
|
1242
1253
|
}, typeof DestinationResearchRequest, typeof DestinationResearchFindings, typeof DestinationResearchFailed, ResearchDispatchGate, never, "error"> & {
|
|
1243
|
-
readonly target:
|
|
1254
|
+
readonly target: Agent.Definition<typeof DestinationBrief, typeof DestinationReport, "Consult lookup_destination exactly once for the briefed airport, then return only a JSON destination report.", Toolkit.Toolkit<{
|
|
1244
1255
|
readonly lookup_destination: Tool.Tool<"lookup_destination", {
|
|
1245
1256
|
readonly parameters: typeof DestinationQuery;
|
|
1246
1257
|
readonly success: typeof DestinationFacts;
|
|
@@ -1254,7 +1265,7 @@ declare const mapResearchChildFailure: (failure: {
|
|
|
1254
1265
|
readonly _tag: string;
|
|
1255
1266
|
}) => DestinationResearchFailed;
|
|
1256
1267
|
/** Runtime wiring: pair the immutable delegation with one explicit child Binding. */
|
|
1257
|
-
declare const destinationResearchHandlersLayer: <Provider, ModelProvides, ModelRequires>(childBinding: RuntimeBinding<typeof DestinationBrief, typeof DestinationReport, string, Toolkit.Tools<typeof DestinationResearcherToolkit>, Provider, ModelProvides, ModelRequires>) => Layer.Layer<Tool.Handler<"delegate_destination_research">, never,
|
|
1268
|
+
declare const destinationResearchHandlersLayer: <Provider, ModelProvides, ModelRequires>(childBinding: RuntimeBinding<typeof DestinationBrief, typeof DestinationReport, string, Toolkit.Tools<typeof DestinationResearcherToolkit>, Provider, ModelProvides, ModelRequires>) => Layer.Layer<Tool.Handler<"delegate_destination_research">, never, Subagent.SubagentLayerRequirements<typeof DestinationBrief, typeof DestinationReport, string, {
|
|
1258
1269
|
readonly lookup_destination: Tool.Tool<"lookup_destination", {
|
|
1259
1270
|
readonly parameters: typeof DestinationQuery;
|
|
1260
1271
|
readonly success: typeof DestinationFacts;
|
|
@@ -1286,17 +1297,17 @@ declare const TravelCoordinatorToolkit: Toolkit.Toolkit<{
|
|
|
1286
1297
|
readonly delegate_destination_research: Tool.Tool<"delegate_destination_research", {
|
|
1287
1298
|
readonly parameters: typeof DestinationResearchRequest;
|
|
1288
1299
|
readonly success: typeof DestinationResearchFindings;
|
|
1289
|
-
readonly failure:
|
|
1300
|
+
readonly failure: Subagent.SubagentToolFailure<typeof DestinationResearchFailed>;
|
|
1290
1301
|
readonly failureMode: "error";
|
|
1291
|
-
}, import("@effect-agent/engine").AgentSpawner | import("@effect-agent/core").IdGenerator | import("@effect-agent/engine").RunEventSink | import("@effect-agent/engine").SubagentDurability>;
|
|
1302
|
+
}, import("@effect-agent/engine/AgentRuntime").AgentSpawner | import("@effect-agent/core/IdGenerator").IdGenerator | import("@effect-agent/engine/RunEventSink").RunEventSink | import("@effect-agent/engine/AgentRuntime").SubagentDurability>;
|
|
1292
1303
|
}>;
|
|
1293
|
-
declare const TravelCoordinator:
|
|
1304
|
+
declare const TravelCoordinator: Agent.Definition<typeof ResearchMission, typeof DestinationShortlist, string, Toolkit.Toolkit<{
|
|
1294
1305
|
readonly delegate_destination_research: Tool.Tool<"delegate_destination_research", {
|
|
1295
1306
|
readonly parameters: typeof DestinationResearchRequest;
|
|
1296
1307
|
readonly success: typeof DestinationResearchFindings;
|
|
1297
|
-
readonly failure:
|
|
1308
|
+
readonly failure: Subagent.SubagentToolFailure<typeof DestinationResearchFailed>;
|
|
1298
1309
|
readonly failureMode: "error";
|
|
1299
|
-
}, import("@effect-agent/engine").AgentSpawner | import("@effect-agent/core").IdGenerator | import("@effect-agent/engine").RunEventSink | import("@effect-agent/engine").SubagentDurability>;
|
|
1310
|
+
}, import("@effect-agent/engine/AgentRuntime").AgentSpawner | import("@effect-agent/core/IdGenerator").IdGenerator | import("@effect-agent/engine/RunEventSink").RunEventSink | import("@effect-agent/engine/AgentRuntime").SubagentDurability>;
|
|
1300
1311
|
}>, undefined, undefined>;
|
|
1301
1312
|
declare const researchMission: ResearchMission;
|
|
1302
1313
|
declare const expectedDestinationShortlist: DestinationShortlist;
|
|
@@ -1696,7 +1707,7 @@ declare const s2CoordinatorSubmitAgent: {
|
|
|
1696
1707
|
* evidence in the S2 tests checks the ledger reservation rows and the
|
|
1697
1708
|
* canonical `SubagentJoined.finalAccounting` against exactly this value.
|
|
1698
1709
|
*/
|
|
1699
|
-
declare const durableResearchAllocation: import("@effect-agent/core").SubagentReservationAmounts;
|
|
1710
|
+
declare const durableResearchAllocation: import("@effect-agent/core/SubagentContract").SubagentReservationAmounts;
|
|
1700
1711
|
/** The one scripted delegation Tool Call id of the durable coordinator Run. */
|
|
1701
1712
|
declare const durableResearchCallId = "research-lhr-1";
|
|
1702
1713
|
/** The child's own scripted guide-lookup Tool Call id. */
|
|
@@ -1722,7 +1733,7 @@ declare const makeInvocationCountingModel: (name: string, script: (call: number)
|
|
|
1722
1733
|
prompts: Effect.Effect<readonly string[], never, never>;
|
|
1723
1734
|
}, never, never>;
|
|
1724
1735
|
/** Runtime wiring for the durable slice: the S1 delegation plus the S2 digest declaration. */
|
|
1725
|
-
declare const durableDestinationResearchHandlersLayer: <Provider, ModelProvides, ModelRequires>(childBinding: RuntimeBinding<typeof DestinationBrief, typeof DestinationReport, string, Toolkit.Tools<typeof DestinationResearcherToolkit>, Provider, ModelProvides, ModelRequires>) => Layer.Layer<import("effect/unstable/ai/Tool").Handler<"delegate_destination_research">, never, import("@effect-agent/capabilities").SubagentLayerRequirements<typeof DestinationBrief, typeof DestinationReport, string, {
|
|
1736
|
+
declare const durableDestinationResearchHandlersLayer: <Provider, ModelProvides, ModelRequires>(childBinding: RuntimeBinding<typeof DestinationBrief, typeof DestinationReport, string, Toolkit.Tools<typeof DestinationResearcherToolkit>, Provider, ModelProvides, ModelRequires>) => Layer.Layer<import("effect/unstable/ai/Tool").Handler<"delegate_destination_research">, never, import("@effect-agent/capabilities/Subagent").SubagentLayerRequirements<typeof DestinationBrief, typeof DestinationReport, string, {
|
|
1726
1737
|
readonly lookup_destination: import("effect/unstable/ai/Tool").Tool<"lookup_destination", {
|
|
1727
1738
|
readonly parameters: typeof DestinationQuery;
|
|
1728
1739
|
readonly success: typeof DestinationFacts;
|
|
@@ -1772,5 +1783,5 @@ interface DurableResearchHarness {
|
|
|
1772
1783
|
*/
|
|
1773
1784
|
declare const makeDurableResearchHarness: (options?: DurableResearchHarnessOptions) => Effect.Effect<DurableResearchHarness, never, never>;
|
|
1774
1785
|
//#endregion
|
|
1775
|
-
export { ActivityCatalog, ActivityCatalogLayer, ActivityQuery, ActivitySearchResult, ActivityUnavailable, AirportCode, BookFlight, BookItinerary, BookingRef, CancelBooking, CancelBookingRequest, CancellationConfirmation, CatalogLifecycle, CatalogLifecycleCounts, CrossPlatformEvidenceIdentity, DestinationBrief, DestinationFacts, DestinationGuide, DestinationGuideLayer, DestinationGuideUnavailable, DestinationQuery, DestinationRecommendation, DestinationReport, DestinationResearchCall, DestinationResearchFailed, DestinationResearchFindings, DestinationResearchRequest, DestinationResearchSupportLayer, DestinationResearcher, DestinationResearcherControls, DestinationResearcherToolkit, DestinationResearcherToolkitLayer, DestinationShortlist, DeterministicIdGeneratorLayer, DurableResearchHarness, DurableResearchHarnessOptions, DurableSearchActivities, DurableSearchFlights, DurableSearchLodging, FlightBookingRequest, FlightCatalog, FlightCatalogLayer, FlightOption, FlightQuery, FlightUnavailable, GuidanceFailure, HoldItinerary, Itinerary, ItineraryBookingRequest, ItineraryConfirmation, ItineraryHold, ItineraryHoldGateway, ItineraryHoldRequest, ItineraryHoldUnavailable, LodgingCatalog, LodgingCatalogLayer, LodgingOption, LodgingQuery, LodgingUnavailable, LookupDestination, PHASE7_LIVE_CREDENTIAL_ENV, PHASE7_LIVE_GATE_ENV, Phase7LiveGateEnvironment, QuoteId, ResearchDispatchGate, ResearchMission, ReverseCompletionToolkitLayer, SearchActivities, SearchFlights, SearchLodging, SupplierBookRequest, SupplierBookingConfirmation, SupplierBookingDesk, SupplierBookingRecord, SupplierHoldControls, SupplierOperation, SupplierUnavailable, TravelBookingReport, TravelCoordinator, TravelCoordinatorToolkit, TravelGuidance, TravelGuidanceLayer, TravelPlan, TravelPlanner, TravelPlannerBookingEvidenceError, TravelPlannerBookingProfile, TravelPlannerCloudflareProfile, TravelPlannerCompletionControls, TravelPlannerDurabilityProfile, TravelPlannerDurableEvidenceError, TravelPlannerPersistenceProfile, TravelPlannerPhase2, TravelPlannerPhase2Toolkit, TravelPlannerPhase2ToolkitLayer, TravelPlannerPhase4, TravelPlannerPhase4Toolkit, TravelPlannerPhase4ToolkitLayer, TravelPlannerPhase5, TravelPlannerPhase5Toolkit, TravelPlannerPhase5ToolkitLayer, TravelPlannerPhase7Profile, TravelPlannerProjectionError, TravelPlannerRuntimeLayer, TravelPlannerSubagentDurabilityProfile, TravelPlannerToolkit, TravelPlannerToolkitLayer, TravelSupplierReconcilerLayer, TravelerRef, TripRequest, assertSettledBookingsExistAtSupplier, bookFlightIdempotencyKey, cancelBookingIdempotencyKey, coordinatorConfidentialMarker, coordinatorResearchTurn, coordinatorShortlistTurn, destinationLookup, destinationReportFor, destinationResearchDelegation, destinationResearchHandlersLayer, destinationResearchPolicy, durableChildLookupCallId, durableDestinationResearchHandlersLayer, durableResearchAllocation, durableResearchCallId, durableResearchFinding, durableResearchShortlist, encodedDestinationFacts, encodedDestinationReport, expectedDestinationShortlist, expectedTravelPlan, itineraryStepIdempotencyKey, makeDestinationResearcherModel, makeDurableResearchHarness, makeInvocationCountingModel, makePhase3TravelPlannerCheckpoint, makePhase4TravelPlannerAgent, makePhase6TravelPlannerBindings, mapResearchChildFailure, missionConfidentialMarker, normalizeCrossPlatformTravelPlannerEvidence, normalizeDurableTravelPlannerEvidence, phase1HappyPathTurns, phase1Trip, phase3TravelPlannerBatches, phase3TravelPlannerCompletionBatch, phase3TravelPlannerDefinitionDigests, phase3TravelPlannerEncodedFixture, phase3TravelPlannerInitialBatch, phase3TravelPlannerProducerId, phase3TravelPlannerProfile, phase3TravelPlannerRunId, phase3TravelPlannerThreadId, phase4TravelPlannerDefinitionDigests, phase4TravelPlannerDeploymentId, phase4TravelPlannerPrincipal, phase4TravelPlannerProducerId, phase4TravelPlannerProfile, phase4TravelPlannerSubmitOptions, phase4TravelPlannerWorkerLayer, phase5TravelPlannerDefinitionDigests, phase5TravelPlannerDeploymentId, phase5TravelPlannerPrincipal, phase5TravelPlannerProducerId, phase5TravelPlannerProfile, phase5TravelPlannerSubmitOptions, phase5TravelPlannerWorkerLayer, phase6ActivityCallId, phase6BookingModel, phase6BookingRef, phase6BookingToolCallId, phase6BookingTrip, phase6ChildLookupCallId, phase6CoordinatorModel, phase6FlightCallId, phase6GatedPlannerDefinitionDigests, phase6GatedPlannerModel, phase6GatedTrip, phase6GuideInvocationCount, phase6LodgingCallId, phase6PlannerModel, phase6ResearchDestination, phase6ResearchMission, phase6ResearcherModel, phase6SupplierDesk, phase6SupplierDeskLayer, phase6SupplierReconcilerLayer, phase6TravelPlannerDeploymentId, phase6TravelPlannerGoldenEvidence, phase6TravelPlannerProducerId, phase6TravelPlannerProducerPrefix, phase6TravelPlannerProfile, phase7LiveProfileEnabled, phase7TravelPlannerProfile, releasePhase6PlannerGate, releasePhase6ResearcherGate, researchMission, researcherHappyPathTurns, resetPhase6PlannerGate, resetPhase6ResearcherGate, s2CoordinatorDigests, s2CoordinatorSubmitAgent, s2ResearcherDigestStrings, s2ResearcherDigests, s2TravelPlannerDeploymentId, s2TravelPlannerPrincipal, s2TravelPlannerProducerId, s2TravelPlannerProfile, s2TravelPlannerSubmitOptions, supplierBookingRefFor, travelPlanFromDurableSettlement, travelPlanFromProjection };
|
|
1776
|
-
//# sourceMappingURL=
|
|
1786
|
+
export { ActivityCatalog, ActivityCatalogLayer, ActivityQuery, ActivitySearchResult, ActivityUnavailable, AirportCode, BookFlight, BookItinerary, BookingRef, CancelBooking, CancelBookingRequest, CancellationConfirmation, CatalogLifecycle, CatalogLifecycleCounts, type CrossPlatformEvidenceIdentity, DestinationBrief, DestinationFacts, DestinationGuide, DestinationGuideLayer, DestinationGuideUnavailable, DestinationQuery, DestinationRecommendation, DestinationReport, type DestinationResearchCall, DestinationResearchFailed, DestinationResearchFindings, DestinationResearchRequest, DestinationResearchSupportLayer, DestinationResearcher, type DestinationResearcherControls, DestinationResearcherToolkit, DestinationResearcherToolkitLayer, DestinationShortlist, DeterministicIdGeneratorLayer, type DurableResearchHarness, type DurableResearchHarnessOptions, DurableSearchActivities, DurableSearchFlights, DurableSearchLodging, FlightBookingRequest, FlightCatalog, FlightCatalogLayer, FlightOption, FlightQuery, FlightUnavailable, GuidanceFailure, HoldItinerary, Itinerary, ItineraryBookingRequest, ItineraryConfirmation, ItineraryHold, ItineraryHoldGateway, ItineraryHoldRequest, ItineraryHoldUnavailable, LodgingCatalog, LodgingCatalogLayer, LodgingOption, LodgingQuery, LodgingUnavailable, LookupDestination, PHASE7_LIVE_CREDENTIAL_ENV, PHASE7_LIVE_GATE_ENV, type Phase7LiveGateEnvironment, QuoteId, ResearchDispatchGate, ResearchMission, ReverseCompletionToolkitLayer, SearchActivities, SearchFlights, SearchLodging, type SupplierBookRequest, SupplierBookingConfirmation, SupplierBookingDesk, SupplierBookingRecord, type SupplierHoldControls, SupplierOperation, SupplierUnavailable, TravelBookingReport, TravelCoordinator, TravelCoordinatorToolkit, TravelGuidance, TravelGuidanceLayer, TravelPlan, TravelPlanner, TravelPlannerBookingEvidenceError, TravelPlannerBookingProfile, TravelPlannerCloudflareProfile, type TravelPlannerCompletionControls, TravelPlannerDurabilityProfile, TravelPlannerDurableEvidenceError, TravelPlannerPersistenceProfile, TravelPlannerPhase2, TravelPlannerPhase2Toolkit, TravelPlannerPhase2ToolkitLayer, TravelPlannerPhase4, TravelPlannerPhase4Toolkit, TravelPlannerPhase4ToolkitLayer, TravelPlannerPhase5, TravelPlannerPhase5Toolkit, TravelPlannerPhase5ToolkitLayer, TravelPlannerPhase7Profile, TravelPlannerProjectionError, TravelPlannerRuntimeLayer, TravelPlannerSubagentDurabilityProfile, TravelPlannerToolkit, TravelPlannerToolkitLayer, TravelSupplierReconcilerLayer, TravelerRef, TripRequest, assertSettledBookingsExistAtSupplier, bookFlightIdempotencyKey, cancelBookingIdempotencyKey, coordinatorConfidentialMarker, coordinatorResearchTurn, coordinatorShortlistTurn, destinationLookup, destinationReportFor, destinationResearchDelegation, destinationResearchHandlersLayer, destinationResearchPolicy, durableChildLookupCallId, durableDestinationResearchHandlersLayer, durableResearchAllocation, durableResearchCallId, durableResearchFinding, durableResearchShortlist, encodedDestinationFacts, encodedDestinationReport, expectedDestinationShortlist, expectedTravelPlan, itineraryStepIdempotencyKey, makeDestinationResearcherModel, makeDurableResearchHarness, makeInvocationCountingModel, makePhase3TravelPlannerCheckpoint, makePhase4TravelPlannerAgent, makePhase6TravelPlannerBindings, mapResearchChildFailure, missionConfidentialMarker, normalizeCrossPlatformTravelPlannerEvidence, normalizeDurableTravelPlannerEvidence, phase1HappyPathTurns, phase1Trip, phase3TravelPlannerBatches, phase3TravelPlannerCompletionBatch, phase3TravelPlannerDefinitionDigests, phase3TravelPlannerEncodedFixture, phase3TravelPlannerInitialBatch, phase3TravelPlannerProducerId, phase3TravelPlannerProfile, phase3TravelPlannerRunId, phase3TravelPlannerThreadId, phase4TravelPlannerDefinitionDigests, phase4TravelPlannerDeploymentId, phase4TravelPlannerPrincipal, phase4TravelPlannerProducerId, phase4TravelPlannerProfile, phase4TravelPlannerSubmitOptions, phase4TravelPlannerWorkerLayer, phase5TravelPlannerDefinitionDigests, phase5TravelPlannerDeploymentId, phase5TravelPlannerPrincipal, phase5TravelPlannerProducerId, phase5TravelPlannerProfile, phase5TravelPlannerSubmitOptions, phase5TravelPlannerWorkerLayer, phase6ActivityCallId, phase6BookingModel, phase6BookingRef, phase6BookingToolCallId, phase6BookingTrip, phase6ChildLookupCallId, phase6CoordinatorModel, phase6FlightCallId, phase6GatedPlannerDefinitionDigests, phase6GatedPlannerModel, phase6GatedTrip, phase6GuideInvocationCount, phase6LodgingCallId, phase6PlannerModel, phase6ResearchDestination, phase6ResearchMission, phase6ResearcherModel, phase6SupplierDesk, phase6SupplierDeskLayer, phase6SupplierReconcilerLayer, phase6TravelPlannerDeploymentId, phase6TravelPlannerGoldenEvidence, phase6TravelPlannerProducerId, phase6TravelPlannerProducerPrefix, phase6TravelPlannerProfile, phase7LiveProfileEnabled, phase7TravelPlannerProfile, releasePhase6PlannerGate, releasePhase6ResearcherGate, researchMission, researcherHappyPathTurns, resetPhase6PlannerGate, resetPhase6ResearcherGate, s2CoordinatorDigests, s2CoordinatorSubmitAgent, s2ResearcherDigestStrings, s2ResearcherDigests, s2TravelPlannerDeploymentId, s2TravelPlannerPrincipal, s2TravelPlannerProducerId, s2TravelPlannerProfile, s2TravelPlannerSubmitOptions, supplierBookingRefFor, travelPlanFromDurableSettlement, travelPlanFromProjection };
|
|
1787
|
+
//# sourceMappingURL=TravelPlanner.d.mts.map
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as LodgingQuery, B as TravelPlannerToolkitLayer, C as FlightOption, D as Itinerary, E as GuidanceFailure, F as SearchLodging, I as TravelGuidance, L as TravelPlan, M as QuoteId, N as SearchActivities, O as LodgingCatalog, P as SearchFlights, R as TravelPlanner, S as FlightCatalog, T as FlightUnavailable, V as TripRequest, _ as ActivityCatalog, a as DeterministicIdGeneratorLayer, b as ActivityUnavailable, c as ReverseCompletionToolkitLayer, d as SupplierOperation, f as SupplierUnavailable, g as supplierBookingRefFor, h as cancelBookingIdempotencyKey, i as CatalogLifecycleCounts, j as LodgingUnavailable, k as LodgingOption, l as SupplierBookingDesk, m as TravelPlannerRuntimeLayer, n as BookingRef, o as FlightCatalogLayer, p as TravelGuidanceLayer, r as CatalogLifecycle, s as LodgingCatalogLayer, t as ActivityCatalogLayer, u as SupplierBookingRecord, v as ActivityQuery, w as FlightQuery, x as AirportCode, y as ActivitySearchResult, z as TravelPlannerToolkit } from "./deterministic-layers-
|
|
1
|
+
import { ScriptedModel } from "./ScriptedModel.mjs";
|
|
2
|
+
import { A as LodgingQuery, B as TravelPlannerToolkitLayer, C as FlightOption, D as Itinerary, E as GuidanceFailure, F as SearchLodging, I as TravelGuidance, L as TravelPlan, M as QuoteId, N as SearchActivities, O as LodgingCatalog, P as SearchFlights, R as TravelPlanner, S as FlightCatalog, T as FlightUnavailable, V as TripRequest, _ as ActivityCatalog, a as DeterministicIdGeneratorLayer, b as ActivityUnavailable, c as ReverseCompletionToolkitLayer, d as SupplierOperation, f as SupplierUnavailable, g as supplierBookingRefFor, h as cancelBookingIdempotencyKey, i as CatalogLifecycleCounts, j as LodgingUnavailable, k as LodgingOption, l as SupplierBookingDesk, m as TravelPlannerRuntimeLayer, n as BookingRef, o as FlightCatalogLayer, p as TravelGuidanceLayer, r as CatalogLifecycle, s as LodgingCatalogLayer, t as ActivityCatalogLayer, u as SupplierBookingRecord, v as ActivityQuery, w as FlightQuery, x as AirportCode, y as ActivitySearchResult, z as TravelPlannerToolkit } from "./deterministic-layers-Eka0fMZq.mjs";
|
|
3
3
|
import { Context, Deferred, Duration, Effect, Layer, Option, Ref, Schema, Stream } from "effect";
|
|
4
4
|
import { LanguageModel, Model, Tool, Toolkit } from "effect/unstable/ai";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
5
|
+
import * as Subagent from "@effect-agent/capabilities/Subagent";
|
|
6
|
+
import { SubagentPolicy, SubagentRuntime, delegationAllocationFromPolicy } from "@effect-agent/capabilities/Subagent";
|
|
7
|
+
import { SubagentReservationsMemoryLive } from "@effect-agent/capabilities/SubagentReservations";
|
|
8
|
+
import * as Agent from "@effect-agent/core/Agent";
|
|
9
|
+
import { AgentPolicy } from "@effect-agent/core/AgentPolicy";
|
|
10
|
+
import { AgentId, RunId, SubmissionId, ThreadId } from "@effect-agent/core/Identifiers";
|
|
11
|
+
import { DurableStep, DurableStepError, ToolExecutionClass } from "@effect-agent/engine/DurableStep";
|
|
12
|
+
import { DurableWorkerBinding } from "@effect-agent/thread/AgentRegistration";
|
|
13
|
+
import "@effect-agent/thread/DurableAgentRuntime";
|
|
14
|
+
import { BatchId, CanonicalBatch, CanonicalRecordEnvelope, DefinitionDigests, DeploymentId, Digest, PersistedJson, ProducerId, RecordEnvelope, RecordId } from "@effect-agent/thread/Records";
|
|
15
|
+
import { Principal } from "@effect-agent/thread/SubmissionLedger";
|
|
16
|
+
import { ThreadCheckpoint } from "@effect-agent/thread/ThreadStore";
|
|
17
|
+
import { ReconciliationCompleted, ReconciliationSafeToRetry, ReconciliationUncertain, ToolReconciler, ToolReconcilerError } from "@effect-agent/thread/ToolReconciler";
|
|
18
|
+
import "@effect-agent/engine/AgentRuntime";
|
|
19
|
+
import { ThreadProjection } from "@effect-agent/thread/ThreadProjection";
|
|
9
20
|
//#region src/fixtures/travel-planner/phase2.ts
|
|
10
21
|
var ItineraryHoldRequest = class extends Schema.Class("@effect-agent/testing/travel-planner/ItineraryHoldRequest")({
|
|
11
22
|
quoteId: QuoteId,
|
|
@@ -2100,4 +2111,4 @@ const phase7LiveProfileEnabled = (env) => env["EFFECT_AGENT_LIVE"] === "1" && (e
|
|
|
2100
2111
|
//#endregion
|
|
2101
2112
|
export { ActivityCatalog, ActivityCatalogLayer, ActivityQuery, ActivitySearchResult, ActivityUnavailable, AirportCode, BookFlight, BookItinerary, BookingRef, CancelBooking, CancelBookingRequest, CancellationConfirmation, CatalogLifecycle, CatalogLifecycleCounts, DestinationBrief, DestinationFacts, DestinationGuide, DestinationGuideLayer, DestinationGuideUnavailable, DestinationQuery, DestinationRecommendation, DestinationReport, DestinationResearchFailed, DestinationResearchFindings, DestinationResearchRequest, DestinationResearchSupportLayer, DestinationResearcher, DestinationResearcherToolkit, DestinationResearcherToolkitLayer, DestinationShortlist, DeterministicIdGeneratorLayer, DurableSearchActivities, DurableSearchFlights, DurableSearchLodging, FlightBookingRequest, FlightCatalog, FlightCatalogLayer, FlightOption, FlightQuery, FlightUnavailable, GuidanceFailure, HoldItinerary, Itinerary, ItineraryBookingRequest, ItineraryConfirmation, ItineraryHold, ItineraryHoldGateway, ItineraryHoldRequest, ItineraryHoldUnavailable, LodgingCatalog, LodgingCatalogLayer, LodgingOption, LodgingQuery, LodgingUnavailable, LookupDestination, PHASE7_LIVE_CREDENTIAL_ENV, PHASE7_LIVE_GATE_ENV, QuoteId, ResearchDispatchGate, ResearchMission, ReverseCompletionToolkitLayer, SearchActivities, SearchFlights, SearchLodging, SupplierBookingConfirmation, SupplierBookingDesk, SupplierBookingRecord, SupplierOperation, SupplierUnavailable, TravelBookingReport, TravelCoordinator, TravelCoordinatorToolkit, TravelGuidance, TravelGuidanceLayer, TravelPlan, TravelPlanner, TravelPlannerBookingEvidenceError, TravelPlannerBookingProfile, TravelPlannerCloudflareProfile, TravelPlannerDurabilityProfile, TravelPlannerDurableEvidenceError, TravelPlannerPersistenceProfile, TravelPlannerPhase2, TravelPlannerPhase2Toolkit, TravelPlannerPhase2ToolkitLayer, TravelPlannerPhase4, TravelPlannerPhase4Toolkit, TravelPlannerPhase4ToolkitLayer, TravelPlannerPhase5, TravelPlannerPhase5Toolkit, TravelPlannerPhase5ToolkitLayer, TravelPlannerPhase7Profile, TravelPlannerProjectionError, TravelPlannerRuntimeLayer, TravelPlannerSubagentDurabilityProfile, TravelPlannerToolkit, TravelPlannerToolkitLayer, TravelSupplierReconcilerLayer, TravelerRef, TripRequest, assertSettledBookingsExistAtSupplier, bookFlightIdempotencyKey, cancelBookingIdempotencyKey, coordinatorConfidentialMarker, coordinatorResearchTurn, coordinatorShortlistTurn, destinationLookup, destinationReportFor, destinationResearchDelegation, destinationResearchHandlersLayer, destinationResearchPolicy, durableChildLookupCallId, durableDestinationResearchHandlersLayer, durableResearchAllocation, durableResearchCallId, durableResearchFinding, durableResearchShortlist, encodedDestinationFacts, encodedDestinationReport, expectedDestinationShortlist, expectedTravelPlan, itineraryStepIdempotencyKey, makeDestinationResearcherModel, makeDurableResearchHarness, makeInvocationCountingModel, makePhase3TravelPlannerCheckpoint, makePhase4TravelPlannerAgent, makePhase6TravelPlannerBindings, mapResearchChildFailure, missionConfidentialMarker, normalizeCrossPlatformTravelPlannerEvidence, normalizeDurableTravelPlannerEvidence, phase1HappyPathTurns, phase1Trip, phase3TravelPlannerBatches, phase3TravelPlannerCompletionBatch, phase3TravelPlannerDefinitionDigests, phase3TravelPlannerEncodedFixture, phase3TravelPlannerInitialBatch, phase3TravelPlannerProducerId, phase3TravelPlannerProfile, phase3TravelPlannerRunId, phase3TravelPlannerThreadId, phase4TravelPlannerDefinitionDigests, phase4TravelPlannerDeploymentId, phase4TravelPlannerPrincipal, phase4TravelPlannerProducerId, phase4TravelPlannerProfile, phase4TravelPlannerSubmitOptions, phase4TravelPlannerWorkerLayer, phase5TravelPlannerDefinitionDigests, phase5TravelPlannerDeploymentId, phase5TravelPlannerPrincipal, phase5TravelPlannerProducerId, phase5TravelPlannerProfile, phase5TravelPlannerSubmitOptions, phase5TravelPlannerWorkerLayer, phase6ActivityCallId, phase6BookingModel, phase6BookingRef, phase6BookingToolCallId, phase6BookingTrip, phase6ChildLookupCallId, phase6CoordinatorModel, phase6FlightCallId, phase6GatedPlannerDefinitionDigests, phase6GatedPlannerModel, phase6GatedTrip, phase6GuideInvocationCount, phase6LodgingCallId, phase6PlannerModel, phase6ResearchDestination, phase6ResearchMission, phase6ResearcherModel, phase6SupplierDesk, phase6SupplierDeskLayer, phase6SupplierReconcilerLayer, phase6TravelPlannerDeploymentId, phase6TravelPlannerGoldenEvidence, phase6TravelPlannerProducerId, phase6TravelPlannerProducerPrefix, phase6TravelPlannerProfile, phase7LiveProfileEnabled, phase7TravelPlannerProfile, releasePhase6PlannerGate, releasePhase6ResearcherGate, researchMission, researcherHappyPathTurns, resetPhase6PlannerGate, resetPhase6ResearcherGate, s2CoordinatorDigests, s2CoordinatorSubmitAgent, s2ResearcherDigestStrings, s2ResearcherDigests, s2TravelPlannerDeploymentId, s2TravelPlannerPrincipal, s2TravelPlannerProducerId, s2TravelPlannerProfile, s2TravelPlannerSubmitOptions, supplierBookingRefFor, travelPlanFromDurableSettlement, travelPlanFromProjection };
|
|
2102
2113
|
|
|
2103
|
-
//# sourceMappingURL=
|
|
2114
|
+
//# sourceMappingURL=TravelPlanner.mjs.map
|