@effect-agent/testing 0.1.0-beta.48 → 0.1.0-beta.50
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.mjs +1 -0
- package/dist/Certification.mjs.map +1 -1
- package/dist/Chaos.d.mts +1 -1
- package/dist/ScriptedModel-DAvxIiud.d.mts +220 -0
- package/dist/ScriptedModel.d.mts +1 -1
- package/dist/ScriptedModel.mjs +5 -27
- package/dist/ScriptedModel.mjs.map +1 -1
- package/dist/TravelPlanner.d.mts +8 -130
- package/dist/TravelPlanner.mjs +6 -162
- package/dist/TravelPlanner.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/package.json +1 -1
- package/src/Certification.ts +1 -0
- package/src/ScriptedModel.ts +4 -25
- package/src/TravelPlanner.ts +0 -12
- package/src/fixtures/travel-planner/phase3.ts +0 -18
- package/src/fixtures/travel-planner/phase4.ts +0 -23
- package/src/fixtures/travel-planner/phase5.ts +0 -30
- package/src/fixtures/travel-planner/phase6.ts +1 -44
- package/src/fixtures/travel-planner/phase7.ts +4 -102
- package/src/fixtures/travel-planner/subagents-durable.ts +1 -34
- package/dist/ScriptedModel-Dx8aW73W.d.mts +0 -679
|
@@ -1 +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,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ACtB,MAAM,OAAO,OAAO,SAAS,OAAO,UAAU,OAAO;KAErD,OAAO,aAAa,KAAK,eAAe,OAAO;KAC/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
|
+
{"version":3,"file":"ScriptedModel.mjs","names":[],"sources":["../src/ScriptedModel.ts"],"sourcesContent":["import { Context, Effect, Layer, Ref, Schema, Stream } from \"effect\";\nimport { AiError, LanguageModel, Response, Toolkit } 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.Part(Toolkit.empty)),\n // PartEncoded also admits these reasoning markers, which the Part schema omits.\n Schema.toEncoded(Response.ReasoningDeltaPart),\n Schema.toEncoded(Response.ReasoningEndPart),\n ScriptedToolCallPart,\n ScriptedToolResultPart,\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.StreamPart(Toolkit.empty)),\n ScriptedToolCallPart,\n ScriptedToolResultPart,\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 );\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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"}
|
package/dist/TravelPlanner.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as ScriptedTurnInput, r as ScriptedModel } from "./ScriptedModel-
|
|
1
|
+
import { f as ScriptedTurnInput, r as ScriptedModel } from "./ScriptedModel-DAvxIiud.mjs";
|
|
2
2
|
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
3
3
|
import { LanguageModel, Model, Response, Tool, Toolkit } from "effect/unstable/ai";
|
|
4
4
|
import * as Subagent from "@effect-agent/capabilities/Subagent";
|
|
@@ -463,17 +463,6 @@ declare const TravelPlannerPhase2: Agent.Definition<typeof TripRequest, typeof T
|
|
|
463
463
|
}>, undefined, undefined>;
|
|
464
464
|
//#endregion
|
|
465
465
|
//#region src/fixtures/travel-planner/phase3.d.ts
|
|
466
|
-
declare const TravelPlannerPersistenceProfile_base: Schema.Class<TravelPlannerPersistenceProfile, Schema.Struct<{
|
|
467
|
-
readonly deploymentClass: Schema.Literal<"P">;
|
|
468
|
-
readonly durableAcceptedWork: Schema.Literal<false>;
|
|
469
|
-
readonly canonicalSchemaVersion: Schema.Literal<1>;
|
|
470
|
-
}>, {}>;
|
|
471
|
-
/**
|
|
472
|
-
* The Phase 3 profile persists Thread history but deliberately does not
|
|
473
|
-
* claim durable admission or recovery of accepted work.
|
|
474
|
-
*/
|
|
475
|
-
declare class TravelPlannerPersistenceProfile extends TravelPlannerPersistenceProfile_base {}
|
|
476
|
-
declare const phase3TravelPlannerProfile: TravelPlannerPersistenceProfile;
|
|
477
466
|
declare const phase3TravelPlannerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
|
|
478
467
|
declare const phase3TravelPlannerProducerId: string & import("effect/Brand").Brand<"@effect-agent/thread/ProducerId">;
|
|
479
468
|
declare const phase3TravelPlannerRunId: string & import("effect/Brand").Brand<"@effect-agent/core/RunId">;
|
|
@@ -499,21 +488,6 @@ declare const travelPlanFromProjection: (projection: ThreadProjection) => Effect
|
|
|
499
488
|
declare const makePhase3TravelPlannerCheckpoint: (projection: ThreadProjection) => ThreadCheckpoint;
|
|
500
489
|
//#endregion
|
|
501
490
|
//#region src/fixtures/travel-planner/phase4.d.ts
|
|
502
|
-
declare const TravelPlannerDurabilityProfile_base: Schema.Class<TravelPlannerDurabilityProfile, Schema.Struct<{
|
|
503
|
-
readonly deploymentClass: Schema.Literal<"DN">;
|
|
504
|
-
readonly durableAcceptedWork: Schema.Literal<true>;
|
|
505
|
-
readonly canonicalSchemaVersion: Schema.Literal<1>;
|
|
506
|
-
/** Supplier booking replay safety is P5 (Durable Tools) scope; DN does not claim it. */
|
|
507
|
-
readonly supplierBookingReplaySafe: Schema.Literal<false>;
|
|
508
|
-
}>, {}>;
|
|
509
|
-
/**
|
|
510
|
-
* The Phase 4 profile claims durable accepted work on the Node/SQLite runtime (deployment class
|
|
511
|
-
* DN): once `submit` returns a Receipt, the Submission settles exactly once even across process
|
|
512
|
-
* loss. The claim is limited to safe-to-repeat toolkits (D6): supplier booking is explicitly NOT
|
|
513
|
-
* claimed safely replayable — replay-safe external mutation is P5 (Durable Tools) scope.
|
|
514
|
-
*/
|
|
515
|
-
declare class TravelPlannerDurabilityProfile extends TravelPlannerDurabilityProfile_base {}
|
|
516
|
-
declare const phase4TravelPlannerProfile: TravelPlannerDurabilityProfile;
|
|
517
491
|
declare const phase4TravelPlannerDeploymentId: string & import("effect/Brand").Brand<"@effect-agent/thread/DeploymentId">;
|
|
518
492
|
declare const phase4TravelPlannerProducerId: string & import("effect/Brand").Brand<"@effect-agent/thread/ProducerId">;
|
|
519
493
|
declare const phase4TravelPlannerPrincipal: string & import("effect/Brand").Brand<"@effect-agent/thread/Principal">;
|
|
@@ -776,26 +750,6 @@ declare const travelPlanFromDurableSettlement: (records: readonly CanonicalRecor
|
|
|
776
750
|
declare const normalizeDurableTravelPlannerEvidence: (records: readonly CanonicalRecordEnvelope[], receipt: Receipt) => Effect.Effect<Schema.Json, TravelPlannerDurableEvidenceError, never>;
|
|
777
751
|
//#endregion
|
|
778
752
|
//#region src/fixtures/travel-planner/phase5.d.ts
|
|
779
|
-
declare const TravelPlannerBookingProfile_base: Schema.Class<TravelPlannerBookingProfile, Schema.Struct<{
|
|
780
|
-
readonly deploymentClass: Schema.Literal<"DN">;
|
|
781
|
-
readonly durableAcceptedWork: Schema.Literal<true>;
|
|
782
|
-
readonly canonicalSchemaVersion: Schema.Literal<1>;
|
|
783
|
-
/** P5: supplier mutations get prepared/settled records, Unknown Outcomes, and reconciliation. */
|
|
784
|
-
readonly supplierBookingUncertaintyProtocol: Schema.Literal<true>;
|
|
785
|
-
/** P5: Durable Steps are exactly-once-RECORDED; their side effects stay at-least-once. */
|
|
786
|
-
readonly durableStepsRecorded: Schema.Literal<true>;
|
|
787
|
-
/** Never claimed at any phase (DUR-003). */
|
|
788
|
-
readonly exactlyOnceExternalEffects: Schema.Literal<false>;
|
|
789
|
-
}>, {}>;
|
|
790
|
-
/**
|
|
791
|
-
* The Phase 5 profile extends the P4 `DN` claim to consequential supplier mutation: booking
|
|
792
|
-
* Tools enter the prepared/settled uncertainty protocol, unresolved external effects stop at
|
|
793
|
-
* Unknown Outcomes instead of replaying, Durable Steps replay recorded results, and queued
|
|
794
|
-
* traveler input joins the active Run. Exactly-once EXTERNAL execution is still — deliberately —
|
|
795
|
-
* not claimed (DUR-003): the supplier's own idempotency keys are what dedupe repeats.
|
|
796
|
-
*/
|
|
797
|
-
declare class TravelPlannerBookingProfile extends TravelPlannerBookingProfile_base {}
|
|
798
|
-
declare const phase5TravelPlannerProfile: TravelPlannerBookingProfile;
|
|
799
753
|
declare const phase5TravelPlannerDeploymentId: string & import("effect/Brand").Brand<"@effect-agent/thread/DeploymentId">;
|
|
800
754
|
declare const phase5TravelPlannerProducerId: string & import("effect/Brand").Brand<"@effect-agent/thread/ProducerId">;
|
|
801
755
|
declare const phase5TravelPlannerPrincipal: string & import("effect/Brand").Brand<"@effect-agent/thread/Principal">;
|
|
@@ -1350,30 +1304,7 @@ declare const makeDestinationResearcherModel: (destinations: ReadonlyArray<strin
|
|
|
1350
1304
|
}, never, CatalogLifecycle>;
|
|
1351
1305
|
//#endregion
|
|
1352
1306
|
//#region src/fixtures/travel-planner/phase6.d.ts
|
|
1353
|
-
|
|
1354
|
-
readonly deploymentClass: Schema.Literal<"DC">;
|
|
1355
|
-
readonly durableAcceptedWork: Schema.Literal<true>;
|
|
1356
|
-
readonly canonicalSchemaVersion: Schema.Literal<1>;
|
|
1357
|
-
/** P5 semantics under DC recovery: prepared/settled records, Unknown Outcomes, approvals. */
|
|
1358
|
-
readonly supplierBookingUncertaintyProtocol: Schema.Literal<true>;
|
|
1359
|
-
/** S2 semantics under DC recovery: cross-Object establishment/join, completed child never re-runs. */
|
|
1360
|
-
readonly durableAttachedSubagents: Schema.Literal<true>;
|
|
1361
|
-
/** DN and DC produce byte-equal cross-platform normalized canonical evidence (one golden). */
|
|
1362
|
-
readonly cloudflareEquivalence: Schema.Literal<true>;
|
|
1363
|
-
/** Never claimed at any phase on any platform (DUR-003). */
|
|
1364
|
-
readonly exactlyOnceExternalEffects: Schema.Literal<false>;
|
|
1365
|
-
}>, {}>;
|
|
1366
|
-
/**
|
|
1367
|
-
* The Phase 6 profile: the P4/P5/S2 Travel Planner claims re-earned on the Cloudflare Durable
|
|
1368
|
-
* Object runtime (deployment class `DC`), where eviction and alarm redelivery replace process
|
|
1369
|
-
* kill and restart as the exercised recovery path. `cloudflareEquivalence` is the claim the S2
|
|
1370
|
-
* fixture explicitly deferred to P6 (`TravelPlannerSubagentDurabilityProfile` pins it `false`
|
|
1371
|
-
* for `DN`): it flips to `true` here ONLY because the phase-6 suites assert byte-equal
|
|
1372
|
-
* cross-platform normalized canonical evidence against one committed golden. Exactly-once
|
|
1373
|
-
* EXTERNAL effects remain — deliberately — unclaimed on every platform (DUR-003).
|
|
1374
|
-
*/
|
|
1375
|
-
declare class TravelPlannerCloudflareProfile extends TravelPlannerCloudflareProfile_base {}
|
|
1376
|
-
declare const phase6TravelPlannerProfile: TravelPlannerCloudflareProfile;
|
|
1307
|
+
/** Platform-neutral bindings and canonical evidence shared by Node and Cloudflare tests. */
|
|
1377
1308
|
declare const phase6TravelPlannerDeploymentId: string & import("effect/Brand").Brand<"@effect-agent/thread/DeploymentId">;
|
|
1378
1309
|
/** Producer prefix of the DC host; each Object mints `{prefix}:{threadId}`. */
|
|
1379
1310
|
declare const phase6TravelPlannerProducerPrefix = "travel-planner-p6-producer";
|
|
@@ -1520,56 +1451,15 @@ declare const makePhase6TravelPlannerBindings: Effect.Effect<ReadonlyArray<Resol
|
|
|
1520
1451
|
declare const phase6TravelPlannerGoldenEvidence: Schema.Json;
|
|
1521
1452
|
//#endregion
|
|
1522
1453
|
//#region src/fixtures/travel-planner/phase7.d.ts
|
|
1523
|
-
|
|
1524
|
-
readonly phase: Schema.Literal<"P7">;
|
|
1525
|
-
readonly offlineConformanceDeterministic: Schema.Literal<true>;
|
|
1526
|
-
readonly offlineRequiresCredentials: Schema.Literal<false>;
|
|
1527
|
-
readonly liveProfileOptIn: Schema.Literal<true>;
|
|
1528
|
-
readonly liveModelLayers: Schema.Literal<true>;
|
|
1529
|
-
readonly liveSupplierLayers: Schema.Literal<false>;
|
|
1530
|
-
readonly structurallyRedactedTranscripts: Schema.Literal<true>;
|
|
1531
|
-
readonly exactlyOnceExternalEffects: Schema.Literal<false>;
|
|
1532
|
-
}>, {}>;
|
|
1533
|
-
/**
|
|
1534
|
-
* The P7 dual-profile claim, schema-first so the exact scope of "live
|
|
1535
|
-
* integration profiles" is a committed, decodable value:
|
|
1536
|
-
*
|
|
1537
|
-
* - `offlineConformanceDeterministic` / `offlineRequiresCredentials`: the
|
|
1538
|
-
* cumulative conformance suites stay deterministic and credential-free.
|
|
1539
|
-
* - `liveProfileOptIn`: live suites are excluded from ordinary gates by the
|
|
1540
|
-
* environment predicate (`phase7LiveProfileEnabled`), never by test-runner
|
|
1541
|
-
* configuration that could silently drift.
|
|
1542
|
-
* - `liveModelLayers` / `liveSupplierLayers`: live profiles exercise real
|
|
1543
|
-
* model Layers over the SAME deterministic supplier desk — no claim of a
|
|
1544
|
-
* live supplier integration is made anywhere (decision 9).
|
|
1545
|
-
* - `structurallyRedactedTranscripts`: transcript evidence a live profile
|
|
1546
|
-
* emits passes through the structural `Redactor` first (SEC-008,
|
|
1547
|
-
* testing.md §12: "live model and supplier profiles are opt-in smoke or
|
|
1548
|
-
* release tests, rate-limited and structurally redacted").
|
|
1549
|
-
* - `exactlyOnceExternalEffects`: never claimed at any phase (DUR-003).
|
|
1550
|
-
*/
|
|
1551
|
-
declare class TravelPlannerPhase7Profile extends TravelPlannerPhase7Profile_base {}
|
|
1552
|
-
declare const phase7TravelPlannerProfile: TravelPlannerPhase7Profile;
|
|
1553
|
-
/**
|
|
1554
|
-
* The one opt-in switch for EVERY live profile in this repository. `"1"` is
|
|
1555
|
-
* the only enabling value: an unset, empty, or differently-truthy value keeps
|
|
1556
|
-
* the suite skipped, so CI and ordinary developer runs stay offline.
|
|
1557
|
-
*/
|
|
1454
|
+
/** Explicit opt-in switch for live integration tests. */
|
|
1558
1455
|
declare const PHASE7_LIVE_GATE_ENV = "EFFECT_AGENT_LIVE";
|
|
1559
|
-
/** The credential
|
|
1456
|
+
/** The credential required by the Travel Planner live-model tests. */
|
|
1560
1457
|
declare const PHASE7_LIVE_CREDENTIAL_ENV = "OPENAI_API_KEY";
|
|
1561
|
-
/** Structural shape of
|
|
1458
|
+
/** Structural shape of an environment without importing Node types. */
|
|
1562
1459
|
interface Phase7LiveGateEnvironment {
|
|
1563
1460
|
readonly [name: string]: string | undefined;
|
|
1564
1461
|
}
|
|
1565
|
-
/**
|
|
1566
|
-
* The test-side live gate (P7 plan §6: no test-side live-gating pattern
|
|
1567
|
-
* existed before this — the demo gates at serve time via
|
|
1568
|
-
* `Config.redacted("OPENAI_API_KEY")`). Suites use it as
|
|
1569
|
-
* `describe.skipIf(!phase7LiveProfileEnabled(process.env))`, which keeps the
|
|
1570
|
-
* live block out of ordinary gates while the SAME file's ungated tests keep
|
|
1571
|
-
* pinning the profile schema on every run.
|
|
1572
|
-
*/
|
|
1462
|
+
/** Enable live tests only when both the opt-in flag and credential are present. */
|
|
1573
1463
|
declare const phase7LiveProfileEnabled: (env: Phase7LiveGateEnvironment) => boolean;
|
|
1574
1464
|
//#endregion
|
|
1575
1465
|
//#region src/fixtures/travel-planner/scenarios.d.ts
|
|
@@ -1661,19 +1551,7 @@ declare const phase1HappyPathTurns: [{
|
|
|
1661
1551
|
}];
|
|
1662
1552
|
//#endregion
|
|
1663
1553
|
//#region src/fixtures/travel-planner/subagents-durable.d.ts
|
|
1664
|
-
|
|
1665
|
-
readonly deploymentClass: Schema.Literal<"DN">;
|
|
1666
|
-
readonly durableAttachedSubagents: Schema.Literal<true>;
|
|
1667
|
-
readonly canonicalSchemaVersion: Schema.Literal<1>;
|
|
1668
|
-
/** Establishment/join replay converges on one child Receipt, Thread, and join batch. */
|
|
1669
|
-
readonly subagentReplaySafe: Schema.Literal<true>;
|
|
1670
|
-
/** Never claimed (rule 8): child ordinary Tools stop at Unknown Outcomes, they do not replay. */
|
|
1671
|
-
readonly childExternalEffectsExactlyOnce: Schema.Literal<false>;
|
|
1672
|
-
/** The same conformance suite under DO eviction/alarms is P6 scope (spec §17 `DC`). */
|
|
1673
|
-
readonly cloudflareEquivalence: Schema.Literal<false>;
|
|
1674
|
-
}>, {}>;
|
|
1675
|
-
declare class TravelPlannerSubagentDurabilityProfile extends TravelPlannerSubagentDurabilityProfile_base {}
|
|
1676
|
-
declare const s2TravelPlannerProfile: TravelPlannerSubagentDurabilityProfile;
|
|
1554
|
+
/** Registered coordinator and researcher bindings for durable delegation tests. */
|
|
1677
1555
|
declare const s2TravelPlannerDeploymentId: string & import("effect/Brand").Brand<"@effect-agent/thread/DeploymentId">;
|
|
1678
1556
|
declare const s2TravelPlannerProducerId: string & import("effect/Brand").Brand<"@effect-agent/thread/ProducerId">;
|
|
1679
1557
|
declare const s2TravelPlannerPrincipal: string & import("effect/Brand").Brand<"@effect-agent/thread/Principal">;
|
|
@@ -1783,5 +1661,5 @@ interface DurableResearchHarness {
|
|
|
1783
1661
|
*/
|
|
1784
1662
|
declare const makeDurableResearchHarness: (options?: DurableResearchHarnessOptions) => Effect.Effect<DurableResearchHarness, never, never>;
|
|
1785
1663
|
//#endregion
|
|
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,
|
|
1664
|
+
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, type TravelPlannerCompletionControls, TravelPlannerDurableEvidenceError, TravelPlannerPhase2, TravelPlannerPhase2Toolkit, TravelPlannerPhase2ToolkitLayer, TravelPlannerPhase4, TravelPlannerPhase4Toolkit, TravelPlannerPhase4ToolkitLayer, TravelPlannerPhase5, TravelPlannerPhase5Toolkit, TravelPlannerPhase5ToolkitLayer, TravelPlannerProjectionError, TravelPlannerRuntimeLayer, 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, phase3TravelPlannerRunId, phase3TravelPlannerThreadId, phase4TravelPlannerDefinitionDigests, phase4TravelPlannerDeploymentId, phase4TravelPlannerPrincipal, phase4TravelPlannerProducerId, phase4TravelPlannerSubmitOptions, phase4TravelPlannerWorkerLayer, phase5TravelPlannerDefinitionDigests, phase5TravelPlannerDeploymentId, phase5TravelPlannerPrincipal, phase5TravelPlannerProducerId, 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, phase7LiveProfileEnabled, releasePhase6PlannerGate, releasePhase6ResearcherGate, researchMission, researcherHappyPathTurns, resetPhase6PlannerGate, resetPhase6ResearcherGate, s2CoordinatorDigests, s2CoordinatorSubmitAgent, s2ResearcherDigestStrings, s2ResearcherDigests, s2TravelPlannerDeploymentId, s2TravelPlannerPrincipal, s2TravelPlannerProducerId, s2TravelPlannerSubmitOptions, supplierBookingRefFor, travelPlanFromDurableSettlement, travelPlanFromProjection };
|
|
1787
1665
|
//# sourceMappingURL=TravelPlanner.d.mts.map
|
package/dist/TravelPlanner.mjs
CHANGED
|
@@ -168,20 +168,6 @@ const phase1HappyPathTurns = [{
|
|
|
168
168
|
}];
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/fixtures/travel-planner/phase3.ts
|
|
171
|
-
/**
|
|
172
|
-
* The Phase 3 profile persists Thread history but deliberately does not
|
|
173
|
-
* claim durable admission or recovery of accepted work.
|
|
174
|
-
*/
|
|
175
|
-
var TravelPlannerPersistenceProfile = class extends Schema.Class("@effect-agent/testing/travel-planner/TravelPlannerPersistenceProfile")({
|
|
176
|
-
deploymentClass: Schema.Literal("P"),
|
|
177
|
-
durableAcceptedWork: Schema.Literal(false),
|
|
178
|
-
canonicalSchemaVersion: Schema.Literal(1)
|
|
179
|
-
}) {};
|
|
180
|
-
const phase3TravelPlannerProfile = TravelPlannerPersistenceProfile.make({
|
|
181
|
-
deploymentClass: "P",
|
|
182
|
-
durableAcceptedWork: false,
|
|
183
|
-
canonicalSchemaVersion: 1
|
|
184
|
-
});
|
|
185
171
|
const phase3TravelPlannerThreadId = Schema.decodeSync(ThreadId)("travel-planner-p3-thread");
|
|
186
172
|
const phase3TravelPlannerProducerId = Schema.decodeSync(ProducerId)("travel-planner-p3-producer");
|
|
187
173
|
const phase3TravelPlannerRunId = Schema.decodeSync(RunId)("travel-planner-p3-run");
|
|
@@ -263,25 +249,6 @@ const makePhase3TravelPlannerCheckpoint = (projection) => Schema.decodeSync(Thre
|
|
|
263
249
|
});
|
|
264
250
|
//#endregion
|
|
265
251
|
//#region src/fixtures/travel-planner/phase4.ts
|
|
266
|
-
/**
|
|
267
|
-
* The Phase 4 profile claims durable accepted work on the Node/SQLite runtime (deployment class
|
|
268
|
-
* DN): once `submit` returns a Receipt, the Submission settles exactly once even across process
|
|
269
|
-
* loss. The claim is limited to safe-to-repeat toolkits (D6): supplier booking is explicitly NOT
|
|
270
|
-
* claimed safely replayable — replay-safe external mutation is P5 (Durable Tools) scope.
|
|
271
|
-
*/
|
|
272
|
-
var TravelPlannerDurabilityProfile = class extends Schema.Class("@effect-agent/testing/travel-planner/TravelPlannerDurabilityProfile")({
|
|
273
|
-
deploymentClass: Schema.Literal("DN"),
|
|
274
|
-
durableAcceptedWork: Schema.Literal(true),
|
|
275
|
-
canonicalSchemaVersion: Schema.Literal(1),
|
|
276
|
-
/** Supplier booking replay safety is P5 (Durable Tools) scope; DN does not claim it. */
|
|
277
|
-
supplierBookingReplaySafe: Schema.Literal(false)
|
|
278
|
-
}) {};
|
|
279
|
-
const phase4TravelPlannerProfile = TravelPlannerDurabilityProfile.make({
|
|
280
|
-
deploymentClass: "DN",
|
|
281
|
-
durableAcceptedWork: true,
|
|
282
|
-
canonicalSchemaVersion: 1,
|
|
283
|
-
supplierBookingReplaySafe: false
|
|
284
|
-
});
|
|
285
252
|
const phase4TravelPlannerDeploymentId = Schema.decodeSync(DeploymentId)("travel-planner-p4-deployment");
|
|
286
253
|
const phase4TravelPlannerProducerId = Schema.decodeSync(ProducerId)("travel-planner-p4-producer");
|
|
287
254
|
const phase4TravelPlannerPrincipal = Schema.decodeSync(Principal)("travel-planner-p4-principal");
|
|
@@ -404,32 +371,6 @@ const normalizeDurableTravelPlannerEvidence = Effect.fn("TravelPlannerPhase4.nor
|
|
|
404
371
|
});
|
|
405
372
|
//#endregion
|
|
406
373
|
//#region src/fixtures/travel-planner/phase5.ts
|
|
407
|
-
/**
|
|
408
|
-
* The Phase 5 profile extends the P4 `DN` claim to consequential supplier mutation: booking
|
|
409
|
-
* Tools enter the prepared/settled uncertainty protocol, unresolved external effects stop at
|
|
410
|
-
* Unknown Outcomes instead of replaying, Durable Steps replay recorded results, and queued
|
|
411
|
-
* traveler input joins the active Run. Exactly-once EXTERNAL execution is still — deliberately —
|
|
412
|
-
* not claimed (DUR-003): the supplier's own idempotency keys are what dedupe repeats.
|
|
413
|
-
*/
|
|
414
|
-
var TravelPlannerBookingProfile = class extends Schema.Class("@effect-agent/testing/travel-planner/TravelPlannerBookingProfile")({
|
|
415
|
-
deploymentClass: Schema.Literal("DN"),
|
|
416
|
-
durableAcceptedWork: Schema.Literal(true),
|
|
417
|
-
canonicalSchemaVersion: Schema.Literal(1),
|
|
418
|
-
/** P5: supplier mutations get prepared/settled records, Unknown Outcomes, and reconciliation. */
|
|
419
|
-
supplierBookingUncertaintyProtocol: Schema.Literal(true),
|
|
420
|
-
/** P5: Durable Steps are exactly-once-RECORDED; their side effects stay at-least-once. */
|
|
421
|
-
durableStepsRecorded: Schema.Literal(true),
|
|
422
|
-
/** Never claimed at any phase (DUR-003). */
|
|
423
|
-
exactlyOnceExternalEffects: Schema.Literal(false)
|
|
424
|
-
}) {};
|
|
425
|
-
const phase5TravelPlannerProfile = TravelPlannerBookingProfile.make({
|
|
426
|
-
deploymentClass: "DN",
|
|
427
|
-
durableAcceptedWork: true,
|
|
428
|
-
canonicalSchemaVersion: 1,
|
|
429
|
-
supplierBookingUncertaintyProtocol: true,
|
|
430
|
-
durableStepsRecorded: true,
|
|
431
|
-
exactlyOnceExternalEffects: false
|
|
432
|
-
});
|
|
433
374
|
const phase5TravelPlannerDeploymentId = Schema.decodeSync(DeploymentId)("travel-planner-p5-deployment");
|
|
434
375
|
const phase5TravelPlannerProducerId = Schema.decodeSync(ProducerId)("travel-planner-p5-producer");
|
|
435
376
|
const phase5TravelPlannerPrincipal = Schema.decodeSync(Principal)("travel-planner-p5-principal");
|
|
@@ -1049,25 +990,7 @@ const makeDestinationResearcherModel = (destinations) => Effect.gen(function* ()
|
|
|
1049
990
|
});
|
|
1050
991
|
//#endregion
|
|
1051
992
|
//#region src/fixtures/travel-planner/subagents-durable.ts
|
|
1052
|
-
|
|
1053
|
-
deploymentClass: Schema.Literal("DN"),
|
|
1054
|
-
durableAttachedSubagents: Schema.Literal(true),
|
|
1055
|
-
canonicalSchemaVersion: Schema.Literal(1),
|
|
1056
|
-
/** Establishment/join replay converges on one child Receipt, Thread, and join batch. */
|
|
1057
|
-
subagentReplaySafe: Schema.Literal(true),
|
|
1058
|
-
/** Never claimed (rule 8): child ordinary Tools stop at Unknown Outcomes, they do not replay. */
|
|
1059
|
-
childExternalEffectsExactlyOnce: Schema.Literal(false),
|
|
1060
|
-
/** The same conformance suite under DO eviction/alarms is P6 scope (spec §17 `DC`). */
|
|
1061
|
-
cloudflareEquivalence: Schema.Literal(false)
|
|
1062
|
-
}) {};
|
|
1063
|
-
const s2TravelPlannerProfile = TravelPlannerSubagentDurabilityProfile.make({
|
|
1064
|
-
deploymentClass: "DN",
|
|
1065
|
-
durableAttachedSubagents: true,
|
|
1066
|
-
canonicalSchemaVersion: 1,
|
|
1067
|
-
subagentReplaySafe: true,
|
|
1068
|
-
childExternalEffectsExactlyOnce: false,
|
|
1069
|
-
cloudflareEquivalence: false
|
|
1070
|
-
});
|
|
993
|
+
/** Registered coordinator and researcher bindings for durable delegation tests. */
|
|
1071
994
|
const s2TravelPlannerDeploymentId = Schema.decodeSync(DeploymentId)("travel-planner-s2-deployment");
|
|
1072
995
|
const s2TravelPlannerProducerId = Schema.decodeSync(ProducerId)("travel-planner-s2-producer");
|
|
1073
996
|
const s2TravelPlannerPrincipal = Schema.decodeSync(Principal)("travel-planner-s2-principal");
|
|
@@ -1268,37 +1191,7 @@ const makeDurableResearchHarness = (options) => Effect.gen(function* () {
|
|
|
1268
1191
|
});
|
|
1269
1192
|
//#endregion
|
|
1270
1193
|
//#region src/fixtures/travel-planner/phase6.ts
|
|
1271
|
-
/**
|
|
1272
|
-
* The Phase 6 profile: the P4/P5/S2 Travel Planner claims re-earned on the Cloudflare Durable
|
|
1273
|
-
* Object runtime (deployment class `DC`), where eviction and alarm redelivery replace process
|
|
1274
|
-
* kill and restart as the exercised recovery path. `cloudflareEquivalence` is the claim the S2
|
|
1275
|
-
* fixture explicitly deferred to P6 (`TravelPlannerSubagentDurabilityProfile` pins it `false`
|
|
1276
|
-
* for `DN`): it flips to `true` here ONLY because the phase-6 suites assert byte-equal
|
|
1277
|
-
* cross-platform normalized canonical evidence against one committed golden. Exactly-once
|
|
1278
|
-
* EXTERNAL effects remain — deliberately — unclaimed on every platform (DUR-003).
|
|
1279
|
-
*/
|
|
1280
|
-
var TravelPlannerCloudflareProfile = class extends Schema.Class("@effect-agent/testing/travel-planner/TravelPlannerCloudflareProfile")({
|
|
1281
|
-
deploymentClass: Schema.Literal("DC"),
|
|
1282
|
-
durableAcceptedWork: Schema.Literal(true),
|
|
1283
|
-
canonicalSchemaVersion: Schema.Literal(1),
|
|
1284
|
-
/** P5 semantics under DC recovery: prepared/settled records, Unknown Outcomes, approvals. */
|
|
1285
|
-
supplierBookingUncertaintyProtocol: Schema.Literal(true),
|
|
1286
|
-
/** S2 semantics under DC recovery: cross-Object establishment/join, completed child never re-runs. */
|
|
1287
|
-
durableAttachedSubagents: Schema.Literal(true),
|
|
1288
|
-
/** DN and DC produce byte-equal cross-platform normalized canonical evidence (one golden). */
|
|
1289
|
-
cloudflareEquivalence: Schema.Literal(true),
|
|
1290
|
-
/** Never claimed at any phase on any platform (DUR-003). */
|
|
1291
|
-
exactlyOnceExternalEffects: Schema.Literal(false)
|
|
1292
|
-
}) {};
|
|
1293
|
-
const phase6TravelPlannerProfile = TravelPlannerCloudflareProfile.make({
|
|
1294
|
-
deploymentClass: "DC",
|
|
1295
|
-
durableAcceptedWork: true,
|
|
1296
|
-
canonicalSchemaVersion: 1,
|
|
1297
|
-
supplierBookingUncertaintyProtocol: true,
|
|
1298
|
-
durableAttachedSubagents: true,
|
|
1299
|
-
cloudflareEquivalence: true,
|
|
1300
|
-
exactlyOnceExternalEffects: false
|
|
1301
|
-
});
|
|
1194
|
+
/** Platform-neutral bindings and canonical evidence shared by Node and Cloudflare tests. */
|
|
1302
1195
|
const phase6TravelPlannerDeploymentId = Schema.decodeSync(DeploymentId)("travel-planner-p6-deployment");
|
|
1303
1196
|
/** Producer prefix of the DC host; each Object mints `{prefix}:{threadId}`. */
|
|
1304
1197
|
const phase6TravelPlannerProducerPrefix = "travel-planner-p6-producer";
|
|
@@ -2053,62 +1946,13 @@ const phase6TravelPlannerGoldenEvidence = [
|
|
|
2053
1946
|
];
|
|
2054
1947
|
//#endregion
|
|
2055
1948
|
//#region src/fixtures/travel-planner/phase7.ts
|
|
2056
|
-
/**
|
|
2057
|
-
* The P7 dual-profile claim, schema-first so the exact scope of "live
|
|
2058
|
-
* integration profiles" is a committed, decodable value:
|
|
2059
|
-
*
|
|
2060
|
-
* - `offlineConformanceDeterministic` / `offlineRequiresCredentials`: the
|
|
2061
|
-
* cumulative conformance suites stay deterministic and credential-free.
|
|
2062
|
-
* - `liveProfileOptIn`: live suites are excluded from ordinary gates by the
|
|
2063
|
-
* environment predicate (`phase7LiveProfileEnabled`), never by test-runner
|
|
2064
|
-
* configuration that could silently drift.
|
|
2065
|
-
* - `liveModelLayers` / `liveSupplierLayers`: live profiles exercise real
|
|
2066
|
-
* model Layers over the SAME deterministic supplier desk — no claim of a
|
|
2067
|
-
* live supplier integration is made anywhere (decision 9).
|
|
2068
|
-
* - `structurallyRedactedTranscripts`: transcript evidence a live profile
|
|
2069
|
-
* emits passes through the structural `Redactor` first (SEC-008,
|
|
2070
|
-
* testing.md §12: "live model and supplier profiles are opt-in smoke or
|
|
2071
|
-
* release tests, rate-limited and structurally redacted").
|
|
2072
|
-
* - `exactlyOnceExternalEffects`: never claimed at any phase (DUR-003).
|
|
2073
|
-
*/
|
|
2074
|
-
var TravelPlannerPhase7Profile = class extends Schema.Class("@effect-agent/testing/travel-planner/TravelPlannerPhase7Profile")({
|
|
2075
|
-
phase: Schema.Literal("P7"),
|
|
2076
|
-
offlineConformanceDeterministic: Schema.Literal(true),
|
|
2077
|
-
offlineRequiresCredentials: Schema.Literal(false),
|
|
2078
|
-
liveProfileOptIn: Schema.Literal(true),
|
|
2079
|
-
liveModelLayers: Schema.Literal(true),
|
|
2080
|
-
liveSupplierLayers: Schema.Literal(false),
|
|
2081
|
-
structurallyRedactedTranscripts: Schema.Literal(true),
|
|
2082
|
-
exactlyOnceExternalEffects: Schema.Literal(false)
|
|
2083
|
-
}) {};
|
|
2084
|
-
const phase7TravelPlannerProfile = TravelPlannerPhase7Profile.make({
|
|
2085
|
-
phase: "P7",
|
|
2086
|
-
offlineConformanceDeterministic: true,
|
|
2087
|
-
offlineRequiresCredentials: false,
|
|
2088
|
-
liveProfileOptIn: true,
|
|
2089
|
-
liveModelLayers: true,
|
|
2090
|
-
liveSupplierLayers: false,
|
|
2091
|
-
structurallyRedactedTranscripts: true,
|
|
2092
|
-
exactlyOnceExternalEffects: false
|
|
2093
|
-
});
|
|
2094
|
-
/**
|
|
2095
|
-
* The one opt-in switch for EVERY live profile in this repository. `"1"` is
|
|
2096
|
-
* the only enabling value: an unset, empty, or differently-truthy value keeps
|
|
2097
|
-
* the suite skipped, so CI and ordinary developer runs stay offline.
|
|
2098
|
-
*/
|
|
1949
|
+
/** Explicit opt-in switch for live integration tests. */
|
|
2099
1950
|
const PHASE7_LIVE_GATE_ENV = "EFFECT_AGENT_LIVE";
|
|
2100
|
-
/** The credential
|
|
1951
|
+
/** The credential required by the Travel Planner live-model tests. */
|
|
2101
1952
|
const PHASE7_LIVE_CREDENTIAL_ENV = "OPENAI_API_KEY";
|
|
2102
|
-
/**
|
|
2103
|
-
* The test-side live gate (P7 plan §6: no test-side live-gating pattern
|
|
2104
|
-
* existed before this — the demo gates at serve time via
|
|
2105
|
-
* `Config.redacted("OPENAI_API_KEY")`). Suites use it as
|
|
2106
|
-
* `describe.skipIf(!phase7LiveProfileEnabled(process.env))`, which keeps the
|
|
2107
|
-
* live block out of ordinary gates while the SAME file's ungated tests keep
|
|
2108
|
-
* pinning the profile schema on every run.
|
|
2109
|
-
*/
|
|
1953
|
+
/** Enable live tests only when both the opt-in flag and credential are present. */
|
|
2110
1954
|
const phase7LiveProfileEnabled = (env) => env["EFFECT_AGENT_LIVE"] === "1" && (env["OPENAI_API_KEY"] ?? "") !== "";
|
|
2111
1955
|
//#endregion
|
|
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,
|
|
1956
|
+
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, TravelPlannerDurableEvidenceError, TravelPlannerPhase2, TravelPlannerPhase2Toolkit, TravelPlannerPhase2ToolkitLayer, TravelPlannerPhase4, TravelPlannerPhase4Toolkit, TravelPlannerPhase4ToolkitLayer, TravelPlannerPhase5, TravelPlannerPhase5Toolkit, TravelPlannerPhase5ToolkitLayer, TravelPlannerProjectionError, TravelPlannerRuntimeLayer, 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, phase3TravelPlannerRunId, phase3TravelPlannerThreadId, phase4TravelPlannerDefinitionDigests, phase4TravelPlannerDeploymentId, phase4TravelPlannerPrincipal, phase4TravelPlannerProducerId, phase4TravelPlannerSubmitOptions, phase4TravelPlannerWorkerLayer, phase5TravelPlannerDefinitionDigests, phase5TravelPlannerDeploymentId, phase5TravelPlannerPrincipal, phase5TravelPlannerProducerId, 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, phase7LiveProfileEnabled, releasePhase6PlannerGate, releasePhase6ResearcherGate, researchMission, researcherHappyPathTurns, resetPhase6PlannerGate, resetPhase6ResearcherGate, s2CoordinatorDigests, s2CoordinatorSubmitAgent, s2ResearcherDigestStrings, s2ResearcherDigests, s2TravelPlannerDeploymentId, s2TravelPlannerPrincipal, s2TravelPlannerProducerId, s2TravelPlannerSubmitOptions, supplierBookingRefFor, travelPlanFromDurableSettlement, travelPlanFromProjection };
|
|
2113
1957
|
|
|
2114
1958
|
//# sourceMappingURL=TravelPlanner.mjs.map
|