effect-durable-agent 0.2.2 → 0.3.0
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/{compaction-D7WJa899.js → compaction-Dlq4wgZE.js} +12 -9
- package/dist/compaction-Dlq4wgZE.js.map +1 -0
- package/dist/{delivery-GCO7QmXQ.d.ts → delivery-BKYmgnKC.d.ts} +2 -2
- package/dist/domain/command-queues.d.ts +1 -1
- package/dist/domain/message-transcript.d.ts +1 -1
- package/dist/domain/message-transcript.js +15 -7
- package/dist/domain/message-transcript.js.map +1 -1
- package/dist/domain/reduced-state.d.ts +2 -2
- package/dist/domain/reduced-state.js +21 -5
- package/dist/domain/reduced-state.js.map +1 -1
- package/dist/domain/run-scheduling.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{reduced-state-BGI8EJN5.d.ts → reduced-state-DV0696_s.d.ts} +16 -4
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/compaction.js +1 -1
- package/dist/services/decider.d.ts +1 -1
- package/dist/services/decider.js +1 -1
- package/dist/services/model-call.d.ts +1 -1
- package/dist/services/prompt-projector.d.ts +1 -1
- package/dist/services/run-scheduler.d.ts +1 -1
- package/dist/services/runtime-layer.d.ts +1 -1
- package/dist/services/runtime-layer.js +4 -4
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +1 -1
- package/dist/services/session-query.d.ts +1 -1
- package/dist/services/session-query.js +1 -1
- package/dist/services/session-state.d.ts +1 -1
- package/dist/services/session-state.js +2 -2
- package/dist/services/session-store.js +1 -1
- package/dist/services/sink-registry.d.ts +1 -1
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/tool-registry.d.ts +1 -1
- package/dist/{session-admission-WE8J_0z9.js → session-admission-DC98zwtj.js} +1 -2
- package/dist/session-admission-DC98zwtj.js.map +1 -0
- package/dist/{session-state-OY3Wih8X.js → session-state-BbJW2_P0.js} +8 -19
- package/dist/session-state-BbJW2_P0.js.map +1 -0
- package/dist/{sink-registry-AOjX5_A1.js → sink-registry-CjdKeTUM.js} +2 -2
- package/dist/{sink-registry-AOjX5_A1.js.map → sink-registry-CjdKeTUM.js.map} +1 -1
- package/dist/testkit/layers.d.ts +1 -1
- package/dist/testkit/layers.js +4 -4
- package/dist/websocket/events.d.ts +1 -1
- package/dist/websocket.d.ts +1 -1
- package/package.json +1 -1
- package/dist/compaction-D7WJa899.js.map +0 -1
- package/dist/session-admission-WE8J_0z9.js.map +0 -1
- package/dist/session-state-OY3Wih8X.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RunSchedulingWakeup } from "./run-scheduling-wakeup.js";
|
|
2
2
|
import { RunScheduler } from "./run-scheduler.js";
|
|
3
|
-
import { d as InferenceRunner, f as ToolExecutor, l as SessionState, p as LiveEventBus, u as TurnRunner } from "../session-state-
|
|
4
|
-
import { t as RegisteredAppEvents } from "../session-admission-
|
|
3
|
+
import { d as InferenceRunner, f as ToolExecutor, l as SessionState, p as LiveEventBus, u as TurnRunner } from "../session-state-BbJW2_P0.js";
|
|
4
|
+
import { t as RegisteredAppEvents } from "../session-admission-DC98zwtj.js";
|
|
5
5
|
import { EDASessionStore, registerAppEvents } from "./session-store.js";
|
|
6
|
-
import { a as CompactionPolicy, n as CompactionExecutor, o as CompactionRunner } from "../compaction-
|
|
6
|
+
import { a as CompactionPolicy, n as CompactionExecutor, o as CompactionRunner } from "../compaction-Dlq4wgZE.js";
|
|
7
7
|
import { EDAPromptProjector } from "./prompt-projector.js";
|
|
8
8
|
import { n as SessionContext, t as EventFactory } from "../event-factory-BUoBwqAy.js";
|
|
9
9
|
import { EDAToolRegistry } from "./tool-registry.js";
|
|
@@ -11,7 +11,7 @@ import { IdGenerator } from "./id-generator.js";
|
|
|
11
11
|
import { EDAKeepAlive } from "./keep-alive.js";
|
|
12
12
|
import { SessionEventObserver } from "./session-event-observer.js";
|
|
13
13
|
import { EDAReducerRegistry } from "./reducer-registry.js";
|
|
14
|
-
import { n as EDASinkRegistry } from "../sink-registry-
|
|
14
|
+
import { n as EDASinkRegistry } from "../sink-registry-CjdKeTUM.js";
|
|
15
15
|
import { EDADeciderRegistry, makeEDADeciderRegistry } from "./decider.js";
|
|
16
16
|
import { EDASessionQuery } from "./session-query.js";
|
|
17
17
|
import { EDARuntime } from "./runtime.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { G as
|
|
1
|
+
import { G as CommittedCommandTerminalEvent, J as EDARuntimeConfig, K as EDACommandTerminalEvent, X as EDARuntimeShape, Y as EDARuntimeError, Z as EDARuntimeSubmit, q as EDARuntime } from "../reduced-state-DV0696_s.js";
|
|
2
2
|
export { CommittedCommandTerminalEvent, EDACommandTerminalEvent, EDARuntime, EDARuntimeConfig, EDARuntimeError, EDARuntimeShape, EDARuntimeSubmit };
|
package/dist/services/runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DurablePosition, SequenceNumber, durablePosition } from "../types/core.js";
|
|
2
2
|
import { d as NonNegativeInt, h as SystemPromptText, u as ModelSelectionPayload } from "../envelope-BSI_Xh-f.js";
|
|
3
3
|
import { w as CommandFailedEvent, x as CommandCompletedEvent, y as CommandCancelledEvent } from "../durable-Da57Rcml.js";
|
|
4
|
-
import { l as SessionState } from "../session-state-
|
|
4
|
+
import { l as SessionState } from "../session-state-BbJW2_P0.js";
|
|
5
5
|
import { annotateEdaSpan, committedBatchAttributes } from "./tracing.js";
|
|
6
6
|
import { EDASessionQuery } from "./session-query.js";
|
|
7
7
|
import * as Context from "effect/Context";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _n as
|
|
1
|
+
import { _n as EDASessionEventPage, bn as EDASessionSnapshot, vn as EDASessionQuery, yn as EDASessionQueryShape } from "../reduced-state-DV0696_s.js";
|
|
2
2
|
export { EDASessionEventPage, EDASessionQuery, EDASessionQueryShape, EDASessionSnapshot };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SequenceNumber } from "../types/core.js";
|
|
2
2
|
import { f as PositionedEvent } from "../envelope-BSI_Xh-f.js";
|
|
3
3
|
import { Xn as durableEventEnvelope } from "../durable-Da57Rcml.js";
|
|
4
|
-
import { l as SessionState, p as LiveEventBus } from "../session-state-
|
|
4
|
+
import { l as SessionState, p as LiveEventBus } from "../session-state-BbJW2_P0.js";
|
|
5
5
|
import { ReducedStateSchema } from "../domain/reduced-state-schema.js";
|
|
6
6
|
import { EDASessionStore } from "./session-store.js";
|
|
7
7
|
import { annotateEdaSpan } from "./tracing.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as SessionCommandAdmissionError, Q as EDASubmittable, at as SessionDecideError, ct as SessionForkedCommand, dt as SessionRunInput, et as SessionCommandCancelled, ft as SessionState, ht as SessionStateSnapshotData, it as SessionCommandResult, lt as SessionNoRunnableCommand, mt as SessionStateShape, nt as SessionCommandFailed, ot as SessionDrainProcessed, pt as SessionStateError, rt as SessionCommandOutcome, st as SessionDrainResult, tt as SessionCommandCompleted, ut as SessionNoRunnableReason, zn as SessionCommandAdmissionConflict } from "../reduced-state-DV0696_s.js";
|
|
2
2
|
export { EDASubmittable, SessionCommandAdmissionConflict, SessionCommandAdmissionError, SessionCommandCancelled, SessionCommandCompleted, SessionCommandFailed, SessionCommandOutcome, SessionCommandResult, SessionDecideError, SessionDrainProcessed, SessionDrainResult, SessionForkedCommand, SessionNoRunnableCommand, SessionNoRunnableReason, SessionRunInput, SessionState, SessionStateError, SessionStateShape, SessionStateSnapshotData };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as SessionForkedCommand, c as SessionRunInput, i as SessionCommandOutcome, l as SessionState, n as SessionCommandCompleted, o as SessionNoRunnableCommand, r as SessionCommandFailed, s as SessionNoRunnableReason, t as SessionCommandCancelled } from "../session-state-
|
|
2
|
-
import { n as SessionCommandAdmissionConflict } from "../session-admission-
|
|
1
|
+
import { a as SessionForkedCommand, c as SessionRunInput, i as SessionCommandOutcome, l as SessionState, n as SessionCommandCompleted, o as SessionNoRunnableCommand, r as SessionCommandFailed, s as SessionNoRunnableReason, t as SessionCommandCancelled } from "../session-state-BbJW2_P0.js";
|
|
2
|
+
import { n as SessionCommandAdmissionConflict } from "../session-admission-DC98zwtj.js";
|
|
3
3
|
export { SessionCommandAdmissionConflict, SessionCommandCancelled, SessionCommandCompleted, SessionCommandFailed, SessionCommandOutcome, SessionForkedCommand, SessionNoRunnableCommand, SessionNoRunnableReason, SessionRunInput, SessionState };
|
|
@@ -2,7 +2,7 @@ import { CommandId, DurablePosition, SequenceNumber, durablePosition } from "../
|
|
|
2
2
|
import { t as DurableEventEnvelope } from "../envelope-BSI_Xh-f.js";
|
|
3
3
|
import { Fn as commandAdmittedEventType, Gn as contextRebasedEventType, Mr as decodeRetainingExcess, W as DecodedDurableEvent, Xn as durableEventEnvelope, _r as summaryCreatedEventType, qn as decodeDurableEventSync } from "../durable-Da57Rcml.js";
|
|
4
4
|
import { CompactionSummaryArtifact } from "../domain/context-projection.js";
|
|
5
|
-
import { i as eventSchemaNamespaces } from "../session-admission-
|
|
5
|
+
import { i as eventSchemaNamespaces } from "../session-admission-DC98zwtj.js";
|
|
6
6
|
import { m as makeTranscriptDefinition, p as emptyTranscriptMappings } from "../interpreter-BwYN2PCC.js";
|
|
7
7
|
import { T as TranscriptLogIncarnation } from "../records-D0ZIAOzd.js";
|
|
8
8
|
import { a as maintainTranscripts, i as initialTranscriptState, r as inMemoryTranscriptWindowSource } from "../in-memory-E497WhtS.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { At as
|
|
1
|
+
import { At as EDASink, Dt as EDAProjectedSink, Et as EDAProjectedDurableSinkDefinition, Ft as EDASinkRawDurableBatch, It as EDASinkRegistry, Lt as EDASinkRegistryShape, Mt as EDASinkContext, Nt as EDASinkDurableBatch, Ot as EDARawDurableSinkDefinition, Pt as EDASinkInterests, Rt as EDASinkRunnerStartInput, Tt as EDAEphemeralSinkDefinition, jt as EDASinkCheckpoint, kt as EDARawSink, wt as EDADurableSinkDefinition } from "../reduced-state-DV0696_s.js";
|
|
2
2
|
export { EDADurableSinkDefinition, EDAEphemeralSinkDefinition, EDAProjectedDurableSinkDefinition, EDAProjectedSink, EDARawDurableSinkDefinition, EDARawSink, EDASink, EDASinkCheckpoint, EDASinkContext, EDASinkDurableBatch, EDASinkInterests, EDASinkRawDurableBatch, EDASinkRegistry, EDASinkRegistryShape, EDASinkRunnerStartInput };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EDASinkRegistry, t as EDASink } from "../sink-registry-
|
|
1
|
+
import { n as EDASinkRegistry, t as EDASink } from "../sink-registry-CjdKeTUM.js";
|
|
2
2
|
export { EDASink, EDASinkRegistry };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as EDAToolExecutionContext, dn as ToolParamsSchema, fn as ToolRecovery, gn as toolRecoveryPolicy, hn as maxToolCallAttempts, ln as EDAToolRegistry, mn as makeEDAToolkit, pn as ToolRecoveryPolicy, sn as EDAModelToolkit, un as EDAToolRegistryShape } from "../reduced-state-DV0696_s.js";
|
|
2
2
|
export { EDAModelToolkit, EDAToolExecutionContext, EDAToolRegistry, EDAToolRegistryShape, ToolParamsSchema, ToolRecovery, ToolRecoveryPolicy, makeEDAToolkit, maxToolCallAttempts, toolRecoveryPolicy };
|
|
@@ -13,7 +13,6 @@ import * as Brand from "effect/Brand";
|
|
|
13
13
|
*/
|
|
14
14
|
var SessionCommandAdmissionConflict = class extends Schema.TaggedError()("SessionCommandAdmissionConflict", {
|
|
15
15
|
code: Schema.Literals([
|
|
16
|
-
"queue_paused",
|
|
17
16
|
"paused_queue_changed",
|
|
18
17
|
"event_too_large",
|
|
19
18
|
"framework_event",
|
|
@@ -135,4 +134,4 @@ const appEventConflict = (refusal) => new SessionCommandAdmissionConflict({
|
|
|
135
134
|
//#endregion
|
|
136
135
|
export { jsonBytes as a, eventSchemaNamespaces as i, SessionCommandAdmissionConflict as n, makeAppEventAdmission as o, appEventConflict as r, storedJsonForm as s, RegisteredAppEvents as t };
|
|
137
136
|
|
|
138
|
-
//# sourceMappingURL=session-admission-
|
|
137
|
+
//# sourceMappingURL=session-admission-DC98zwtj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-admission-DC98zwtj.js","names":[],"sources":["../src/services/session-admission.ts"],"sourcesContent":["import * as Brand from \"effect/Brand\";\nimport * as Context from \"effect/Context\";\nimport * as Result from \"effect/Result\";\nimport * as Schema from \"effect/Schema\";\nimport type * as SchemaAST from \"effect/SchemaAST\";\n\nimport { MessageId } from \"../types/core\";\nimport {\n type DurableEventEnvelope,\n effectDurableAgentNamespace,\n maxAppEventBytes,\n} from \"../types/events/envelope\";\nimport { decodeDurableEventSync } from \"../types/events/durable\";\nimport { decodeRetainingExcess } from \"../types/events/internal\";\n\n/**\n * Admission rules every app-written durable event passes before it reaches the store, shared by\n * `submit`, decider drafts, tool `emitDurable` and sink `stageDurable`. A refusal here is not a\n * store error, so it never makes the live runtime fatal. Internal: not an exported subpath.\n */\n\nexport class SessionCommandAdmissionConflict extends Schema.TaggedError<SessionCommandAdmissionConflict>()(\n \"SessionCommandAdmissionConflict\",\n {\n code: Schema.Literals([\n \"paused_queue_changed\",\n \"event_too_large\",\n \"framework_event\",\n \"invalid_event\",\n \"payload_not_json\",\n ]),\n message: Schema.String,\n pausedMessageIds: Schema.Array(MessageId),\n },\n) {}\n\n/** Why an app event is refused. */\nexport interface AppEventRefusal {\n readonly code: \"event_too_large\" | \"framework_event\" | \"invalid_event\" | \"payload_not_json\";\n readonly message: string;\n}\n\n/**\n * Framework event types app code may still write through `submit`, decider drafts, `emitDurable`\n * and `stageDurable`: a session seed (`SessionConfigured`, `SystemMessageCommitted`) and imported\n * history. Every other `effect-durable-agent` event is the framework's alone; a forged\n * `DeciderAccepted` would make a later decision replay a result nobody decided.\n */\nexport const appWritableFrameworkEventTypes: ReadonlySet<string> = new Set([\n \"SessionConfigured\",\n \"SystemMessageCommitted\",\n \"AssistantMessageImported\",\n]);\n\n/** App event schemas are a union of structs with literal namespaces; throw for any other shape. */\nexport const eventSchemaNamespaces = (ast: SchemaAST.AST): ReadonlyArray<string> => {\n if (ast._tag === \"Union\") return ast.types.flatMap(eventSchemaNamespaces);\n if (ast._tag === \"Objects\") {\n const namespace = ast.propertySignatures.find((field) => field.name === \"namespace\")?.type;\n if (namespace?._tag === \"Literal\" && typeof namespace.literal === \"string\")\n return [namespace.literal];\n }\n throw new Error(\"App event schemas must be a union of structs with literal namespaces\");\n};\n\n/**\n * The JSON form the store keeps, `JSON.parse(JSON.stringify(value))`, or why `value` has none.\n * The round trip may only drop an object property whose value is `undefined`; anything else it\n * would change is refused rather than silently rewritten: anything with a prototype (`Redacted`,\n * `Option`, `Date`, a class instance), `undefined` in an array, a non-finite number, a bigint, a\n * function, a symbol or a cycle. Every check that must hold for what is stored runs on this form.\n */\nexport const storedJsonForm = (\n value: unknown,\n path: string,\n): Result.Result<Schema.Json, string> => {\n const violation = jsonNativeAt(value, path, new Set());\n if (violation !== undefined) return Result.fail(violation);\n const json: Schema.Json = JSON.parse(JSON.stringify(value));\n return Result.succeed(json);\n};\n\nconst jsonNativeAt = (value: unknown, path: string, seen: Set<object>): string | undefined => {\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") return undefined;\n if (typeof value === \"number\") {\n return Number.isFinite(value) ? undefined : `${path} is the non-finite number ${value}`;\n }\n if (typeof value !== \"object\") return `${path} is a ${typeof value}`;\n if (seen.has(value)) return `${path} is a cycle`;\n seen.add(value);\n try {\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index += 1) {\n if (!(index in value) || value[index] === undefined) {\n return `${path}[${index}] is undefined`;\n }\n const violation = jsonNativeAt(value[index], `${path}[${index}]`, seen);\n if (violation !== undefined) return violation;\n }\n return undefined;\n }\n const prototype: unknown = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n const name =\n typeof prototype === \"object\" &&\n prototype !== null &&\n \"constructor\" in prototype &&\n typeof prototype.constructor === \"function\"\n ? prototype.constructor.name\n : \"unknown\";\n return `${path} is not a plain object (prototype ${name || \"anonymous\"})`;\n }\n if (Object.getOwnPropertySymbols(value).length > 0) return `${path} has symbol keys`;\n for (const [key, entry] of Object.entries(value)) {\n if (entry === undefined) continue;\n const violation = jsonNativeAt(entry, `${path}.${key}`, seen);\n if (violation !== undefined) return violation;\n }\n return undefined;\n } finally {\n seen.delete(value);\n }\n};\n\nconst jsonEncoder = new TextEncoder();\n\n/** UTF-8 size of a JSON-native value's JSON text. */\nexport const jsonBytes = (value: unknown): number => {\n const json: string | undefined = JSON.stringify(value);\n return json === undefined ? 0 : jsonEncoder.encode(json).byteLength;\n};\n\n/** The registered application event union, if the runtime has one. */\nexport type AppEventCodec = Schema.Codec<DurableEventEnvelope, unknown, never, never>;\n\n/** The runtime's registered `appEvents` union; absent for a framework-only runtime. */\nexport const RegisteredAppEvents = Context.Reference<AppEventCodec | undefined>(\n \"effect-durable-agent/RegisteredAppEvents\",\n { defaultValue: () => undefined },\n);\n\n/**\n * An app-written durable event that passed admission. Its payload is already the JSON form the\n * store keeps, so what is appended is exactly what was checked. Only `admit` makes one.\n */\nexport type AdmittedAppEvent = DurableEventEnvelope & Brand.Brand<\"AdmittedAppEvent\">;\nconst AdmittedAppEvent = Brand.nominal<AdmittedAppEvent>();\n\n/** Admits app-written durable events under the runtime's rules. */\nexport interface AppEventAdmission {\n /**\n * The event to append in place of `event`, or why it is refused. The payload is replaced by its\n * stored JSON form first; the size, framework-schema and `appEvents` checks all read that form.\n */\n readonly admit: (event: DurableEventEnvelope) => Result.Result<AdmittedAppEvent, AppEventRefusal>;\n}\n\n/** Build the checker for a runtime, with its registered `appEvents` codec if any. */\nexport const makeAppEventAdmission = (appEvents: AppEventCodec | undefined): AppEventAdmission => {\n const namespaces = new Set(appEvents === undefined ? [] : eventSchemaNamespaces(appEvents.ast));\n const decode = appEvents === undefined ? undefined : decodeRetainingExcess(appEvents);\n const describe = (event: DurableEventEnvelope) =>\n `Event ${event.namespace}/${event.type} ${event.eventId}`;\n const refuse = (code: AppEventRefusal[\"code\"], message: string) =>\n Result.fail<AppEventRefusal>({ code, message });\n return {\n admit: (event) => {\n const isFramework = event.namespace === effectDurableAgentNamespace;\n if (isFramework && !appWritableFrameworkEventTypes.has(event.type)) {\n return refuse(\n \"framework_event\",\n `${describe(event)} is a framework lifecycle event; app code may write only ${Array.from(appWritableFrameworkEventTypes).join(\", \")}`,\n );\n }\n const payload = storedJsonForm(event.payload, \"payload\");\n if (Result.isFailure(payload)) {\n return refuse(\n \"payload_not_json\",\n `${describe(event)} payload is not JSON-native: ${payload.failure}. Encode it before writing; the store keeps JSON only.`,\n );\n }\n const stored = { ...event, payload: payload.success };\n const bytes = jsonBytes(stored.payload);\n if (bytes > maxAppEventBytes) {\n return refuse(\n \"event_too_large\",\n `${describe(event)} payload is ${bytes} bytes; the limit is ${maxAppEventBytes} bytes`,\n );\n }\n try {\n // The store decodes framework events with their own schema and would fail a malformed one\n // as a store error, so an allowlisted type is checked against that schema here.\n if (isFramework) decodeDurableEventSync(stored);\n } catch (cause) {\n return refuse(\n \"invalid_event\",\n `${describe(event)} does not match its framework event schema once stored as JSON: ${String(cause)}`,\n );\n }\n try {\n if (decode !== undefined && namespaces.has(event.namespace)) decode(stored);\n } catch (cause) {\n return refuse(\n \"invalid_event\",\n `${describe(event)} does not match the registered appEvents schema once stored as JSON: ${String(cause)}`,\n );\n }\n return Result.succeed(AdmittedAppEvent(stored));\n },\n };\n};\n\n/** The admission conflict a refused `submit` item fails with. */\nexport const appEventConflict = (refusal: AppEventRefusal): SessionCommandAdmissionConflict =>\n new SessionCommandAdmissionConflict({\n code: refusal.code,\n message: refusal.message,\n pausedMessageIds: [],\n });\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAa,kCAAb,cAAqD,OAAO,YAA6C,CAAC,CACxG,mCACA;CACE,MAAM,O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{ n as assertNeverError, t as assertNever } from "./assert-never-CoyUpoRB.js";
|
|
11
11
|
import { activeTurnIdentityForCommand, classifyRecoverableWork, decodeReducedStateCheckpoint, encodeReducedStateCheckpoint, foldReducedState, frameworkReducedStateReducerName, initialReducedState, reducedStateCheckpointEventSeqs } from "./domain/reduced-state.js";
|
|
12
12
|
import { ContextProjection, emptyContextProjection } from "./domain/context-projection.js";
|
|
13
|
-
import { a as jsonBytes, n as SessionCommandAdmissionConflict, o as makeAppEventAdmission, r as appEventConflict, t as RegisteredAppEvents } from "./session-admission-
|
|
13
|
+
import { a as jsonBytes, n as SessionCommandAdmissionConflict, o as makeAppEventAdmission, r as appEventConflict, t as RegisteredAppEvents } from "./session-admission-DC98zwtj.js";
|
|
14
14
|
import { CommittedDurableEvent, EDASessionStore, EDASessionStoreError, hasEDASessionStoreError, queryCommittedEvents } from "./services/session-store.js";
|
|
15
|
-
import { o as CompactionRunner, p as makeUsagePayload } from "./compaction-
|
|
15
|
+
import { o as CompactionRunner, p as makeUsagePayload } from "./compaction-Dlq4wgZE.js";
|
|
16
16
|
import { EDAPromptProjector, buildEDAPrompt } from "./services/prompt-projector.js";
|
|
17
17
|
import { n as SessionContext, t as EventFactory } from "./event-factory-BUoBwqAy.js";
|
|
18
18
|
import { EDAToolRegistry, toolRecoveryPolicy } from "./services/tool-registry.js";
|
|
@@ -21,7 +21,7 @@ import { annotateEdaSpan, committedBatchAttributes, currentOrRootEDAEventTrace,
|
|
|
21
21
|
import { EDAKeepAlive } from "./services/keep-alive.js";
|
|
22
22
|
import { SessionEventObserver } from "./services/session-event-observer.js";
|
|
23
23
|
import { EDAReducerRegistry, decodeReducerState, encodeReducerState, reducerSchemaVersion } from "./services/reducer-registry.js";
|
|
24
|
-
import { n as EDASinkRegistry } from "./sink-registry-
|
|
24
|
+
import { n as EDASinkRegistry } from "./sink-registry-CjdKeTUM.js";
|
|
25
25
|
import { EDADeciderError, EDADeciderRegistry, deciderIdempotencyKeyViolation, deciderMarkerDedupeKey, encodeDeciderJson, maxDeciderResultBytes } from "./services/decider.js";
|
|
26
26
|
import * as Context from "effect/Context";
|
|
27
27
|
import * as Effect from "effect/Effect";
|
|
@@ -1697,7 +1697,7 @@ const makeLiveSessionState = Effect.gen(function* () {
|
|
|
1697
1697
|
}));
|
|
1698
1698
|
const buildReducerCheckpointSnapshot = (snapshot) => [{
|
|
1699
1699
|
name: frameworkReducedStateReducerName,
|
|
1700
|
-
schemaVersion:
|
|
1700
|
+
schemaVersion: 8,
|
|
1701
1701
|
throughSeq: snapshot.reduced.lastSeq,
|
|
1702
1702
|
payload: encodeReducedStateCheckpoint(snapshot.reduced),
|
|
1703
1703
|
updatedAtMs: snapshot.updatedAtMs
|
|
@@ -1834,18 +1834,7 @@ const makeLiveSessionState = Effect.gen(function* () {
|
|
|
1834
1834
|
const current = yield* Ref.get(state);
|
|
1835
1835
|
const pausedMessageIds = current.reduced.commandQueues.pausedQueue.map((message) => message.messageId);
|
|
1836
1836
|
const requestedClear = admitted.expectedPausedMessageIdsToCancel;
|
|
1837
|
-
if (
|
|
1838
|
-
if (requestedClear === void 0) return yield* new SessionCommandAdmissionConflict({
|
|
1839
|
-
code: "queue_paused",
|
|
1840
|
-
message: "Queue paused because you interrupted",
|
|
1841
|
-
pausedMessageIds
|
|
1842
|
-
});
|
|
1843
|
-
if (!sameMessageIdSet(requestedClear, pausedMessageIds)) return yield* new SessionCommandAdmissionConflict({
|
|
1844
|
-
code: "paused_queue_changed",
|
|
1845
|
-
message: "Paused queue changed; confirm the current messages before clearing",
|
|
1846
|
-
pausedMessageIds
|
|
1847
|
-
});
|
|
1848
|
-
} else if (requestedClear !== void 0 && !sameMessageIdSet(requestedClear, pausedMessageIds)) return yield* new SessionCommandAdmissionConflict({
|
|
1837
|
+
if (requestedClear !== void 0 && !sameMessageIdSet(requestedClear, pausedMessageIds)) return yield* new SessionCommandAdmissionConflict({
|
|
1849
1838
|
code: "paused_queue_changed",
|
|
1850
1839
|
message: "Paused queue changed; confirm the current messages before clearing",
|
|
1851
1840
|
pausedMessageIds
|
|
@@ -3436,8 +3425,8 @@ const hydrateReducedStateCheckpoint = (store, checkpoint) => Effect.gen(function
|
|
|
3436
3425
|
});
|
|
3437
3426
|
const hydrateFrameworkReducedState = (store) => Effect.gen(function* () {
|
|
3438
3427
|
const checkpoint = yield* store.loadReducerCheckpoint(frameworkReducedStateReducerName);
|
|
3439
|
-
const checkpointState = checkpoint === void 0 || checkpoint.schemaVersion !==
|
|
3440
|
-
const checkpointSeq = checkpoint === void 0 || checkpoint.schemaVersion !==
|
|
3428
|
+
const checkpointState = checkpoint === void 0 || checkpoint.schemaVersion !== 8 ? initialReducedState : yield* hydrateReducedStateCheckpoint(store, checkpoint);
|
|
3429
|
+
const checkpointSeq = checkpoint === void 0 || checkpoint.schemaVersion !== 8 ? SequenceNumber.make(0) : checkpoint.throughSeq;
|
|
3441
3430
|
return {
|
|
3442
3431
|
state: yield* store.eventsAfter(checkpointSeq).pipe(Stream.chunks, Stream.runFold(() => checkpointState, foldReducedState)),
|
|
3443
3432
|
checkpointSeq
|
|
@@ -3523,4 +3512,4 @@ const isSessionNoRunnableCommand = (result) => "_tag" in result && result._tag =
|
|
|
3523
3512
|
//#endregion
|
|
3524
3513
|
export { SessionForkedCommand as a, SessionRunInput as c, InferenceRunner as d, ToolExecutor as f, SessionCommandOutcome as i, SessionState as l, SessionCommandCompleted as n, SessionNoRunnableCommand as o, LiveEventBus as p, SessionCommandFailed as r, SessionNoRunnableReason as s, SessionCommandCancelled as t, TurnRunner as u };
|
|
3525
3514
|
|
|
3526
|
-
//# sourceMappingURL=session-state-
|
|
3515
|
+
//# sourceMappingURL=session-state-BbJW2_P0.js.map
|