@xandreed/core 0.4.0 → 0.11.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.
Files changed (164) hide show
  1. package/README.md +1 -1
  2. package/dist/conformance.entity.d.ts +15 -0
  3. package/dist/conformance.entity.js +7 -0
  4. package/dist/decision-record.entity.d.ts +23 -23
  5. package/dist/decision-record.entity.functions.d.ts +6 -0
  6. package/dist/decision-record.entity.functions.js +3 -0
  7. package/dist/decision-record.entity.js +4 -4
  8. package/dist/domain/agent-failure.entity.d.ts +6 -6
  9. package/dist/domain/agent-failure.entity.js +12 -1
  10. package/dist/domain/failure.entity.d.ts +2 -2
  11. package/dist/domain/loop-event.entity.d.ts +2 -0
  12. package/dist/domain/message.entity.d.ts +143 -156
  13. package/dist/domain/message.entity.js +6 -6
  14. package/dist/domain/model-call-policy.entity.d.ts +3 -3
  15. package/dist/domain/model-call-policy.entity.js +1 -1
  16. package/dist/domain/model-catalog.entity.d.ts +4 -4
  17. package/dist/domain/model-catalog.entity.js +1 -1
  18. package/dist/domain/model-selection.entity.d.ts +6 -13
  19. package/dist/domain/prompt-provenance.entity.d.ts +6 -6
  20. package/dist/domain/prompt-provenance.entity.js +4 -4
  21. package/dist/domain/token-usage.entity.d.ts +4 -4
  22. package/dist/harness/capability.entity.d.ts +88 -41
  23. package/dist/harness/capability.entity.functions.d.ts +30 -1
  24. package/dist/harness/capability.entity.functions.js +55 -2
  25. package/dist/harness/capability.entity.js +33 -12
  26. package/dist/harness/config.entity.d.ts +28 -28
  27. package/dist/harness/config.entity.js +4 -4
  28. package/dist/harness/plugin-stack.adapter.d.ts +24 -0
  29. package/dist/harness/plugin-stack.adapter.js +8 -0
  30. package/dist/harness/plugin-stack.adapter.test.d.ts +1 -0
  31. package/dist/harness/plugin.adapter.d.ts +15 -4
  32. package/dist/harness/plugin.adapter.js +18 -11
  33. package/dist/harness/plugin.adapter.test.d.ts +1 -0
  34. package/dist/harness/plugin.entity.d.ts +26 -10
  35. package/dist/harness/plugin.entity.js +1 -1
  36. package/dist/harness/session.entity.d.ts +20 -20
  37. package/dist/harness/session.entity.js +1 -1
  38. package/dist/harness/skill-files.d.ts +17 -0
  39. package/dist/harness/skill-files.js +25 -0
  40. package/dist/index.d.ts +47 -4
  41. package/dist/index.js +45 -4
  42. package/dist/loop/cacheKey.d.ts +3 -3
  43. package/dist/loop/cacheKey.js +4 -2
  44. package/dist/loop/mapping.d.ts +4 -5
  45. package/dist/loop/mapping.js +8 -16
  46. package/dist/loop/modelPolicy.d.ts +4 -4
  47. package/dist/loop/modelPolicy.js +2 -2
  48. package/dist/loop/promptProvenance.d.ts +2 -2
  49. package/dist/loop/promptProvenance.js +2 -2
  50. package/dist/loop/stepContext.d.ts +2 -2
  51. package/dist/loop/stepContext.js +2 -2
  52. package/dist/loop/streamFold.js +3 -3
  53. package/dist/loop/toolSchema.d.ts +17 -0
  54. package/dist/loop/toolSchema.js +25 -0
  55. package/dist/loop/toolSchema.test.d.ts +1 -0
  56. package/dist/mcp/bridge.d.ts +15 -15
  57. package/dist/mcp/bridge.js +14 -14
  58. package/dist/memory/memory-log.entity.d.ts +320 -0
  59. package/dist/memory/memory-log.entity.functions.d.ts +89 -0
  60. package/dist/memory/memory-log.entity.functions.js +180 -0
  61. package/dist/memory/memory-log.entity.js +75 -0
  62. package/dist/memory/memory-log.entity.test.d.ts +1 -0
  63. package/dist/memory/memory-session.d.ts +51 -0
  64. package/dist/memory/memory-session.js +97 -0
  65. package/dist/memory/memory-session.test.d.ts +1 -0
  66. package/dist/memory/memory.conformance.d.ts +32 -0
  67. package/dist/memory/memory.conformance.js +102 -0
  68. package/dist/ports/auth-store.port.d.ts +16 -18
  69. package/dist/ports/auth-store.port.js +13 -9
  70. package/dist/ports/capability.port.d.ts +131 -7
  71. package/dist/ports/capability.port.js +2 -2
  72. package/dist/ports/conversation-store.port.d.ts +54 -177
  73. package/dist/ports/conversation-store.port.js +9 -9
  74. package/dist/ports/file-system.port.d.ts +5 -7
  75. package/dist/ports/file-system.port.js +1 -1
  76. package/dist/ports/harness.port.d.ts +19 -13
  77. package/dist/ports/harness.port.js +10 -10
  78. package/dist/ports/mcp-client.port.d.ts +15 -47
  79. package/dist/ports/mcp-client.port.js +3 -3
  80. package/dist/ports/memory.port.d.ts +116 -0
  81. package/dist/ports/memory.port.js +7 -0
  82. package/dist/ports/model-catalog.port.d.ts +1 -1
  83. package/dist/ports/model-catalog.port.js +1 -1
  84. package/dist/ports/permission.port.d.ts +10 -0
  85. package/dist/ports/permission.port.js +4 -0
  86. package/dist/ports/run-context.port.d.ts +28 -0
  87. package/dist/ports/run-context.port.js +4 -0
  88. package/dist/ports/session-log.port.d.ts +25 -0
  89. package/dist/ports/session-log.port.js +4 -0
  90. package/dist/ports/sessions.port.d.ts +141 -0
  91. package/dist/ports/sessions.port.js +4 -0
  92. package/dist/ports/settings-store.port.d.ts +18 -56
  93. package/dist/ports/settings-store.port.js +3 -3
  94. package/dist/ports/shell.port.d.ts +9 -21
  95. package/dist/ports/shell.port.js +1 -1
  96. package/dist/ports/step-loop.port.d.ts +85 -0
  97. package/dist/ports/step-loop.port.js +4 -0
  98. package/dist/ports/tasks.port.d.ts +59 -0
  99. package/dist/ports/tasks.port.js +10 -0
  100. package/dist/ports/tool-registry.port.d.ts +53 -0
  101. package/dist/ports/tool-registry.port.js +4 -0
  102. package/dist/ports/turn-admission.port.d.ts +23 -0
  103. package/dist/ports/turn-admission.port.js +4 -0
  104. package/dist/ports/turn-events.port.d.ts +55 -0
  105. package/dist/ports/turn-events.port.js +7 -0
  106. package/dist/ports/turn-scope.port.d.ts +101 -0
  107. package/dist/ports/turn-scope.port.js +10 -0
  108. package/dist/ports/turn.port.d.ts +113 -0
  109. package/dist/ports/turn.port.js +0 -0
  110. package/dist/ports/utility-llm.port.d.ts +12 -31
  111. package/dist/ports/utility-llm.port.js +1 -1
  112. package/dist/session/chassis.js +7 -7
  113. package/dist/session/session-event.entity.d.ts +55 -0
  114. package/dist/session/session-event.entity.functions.d.ts +31 -0
  115. package/dist/session/session-event.entity.functions.js +42 -0
  116. package/dist/session/session-event.entity.js +37 -0
  117. package/dist/session/session-event.entity.test.d.ts +1 -0
  118. package/dist/session/session-log.conformance.d.ts +13 -0
  119. package/dist/session/session-log.conformance.js +167 -0
  120. package/dist/session/session-log.entity.d.ts +164 -0
  121. package/dist/session/session-log.entity.js +82 -0
  122. package/dist/session/session-log.memory.adapter.d.ts +7 -0
  123. package/dist/session/session-log.memory.adapter.js +82 -0
  124. package/dist/session/session-log.memory.adapter.test.d.ts +1 -0
  125. package/dist/session/sessions.entity.d.ts +201 -0
  126. package/dist/session/sessions.entity.js +98 -0
  127. package/dist/session/tasks.entity.d.ts +39 -0
  128. package/dist/session/tasks.entity.js +26 -0
  129. package/dist/session/turn-admission.open.adapter.d.ts +4 -0
  130. package/dist/session/turn-admission.open.adapter.js +3 -0
  131. package/dist/spec/SpecDoc.d.ts +30 -117
  132. package/dist/spec/SpecDoc.js +10 -10
  133. package/dist/spec/codec.js +1 -1
  134. package/dist/turn/model-request.entity.d.ts +99 -0
  135. package/dist/turn/model-request.entity.functions.d.ts +108 -0
  136. package/dist/turn/model-request.entity.functions.js +167 -0
  137. package/dist/turn/model-request.entity.js +41 -0
  138. package/dist/turn/model-request.entity.test.d.ts +1 -0
  139. package/dist/turn/prompt-sections.d.ts +10 -0
  140. package/dist/turn/prompt-sections.js +3 -0
  141. package/dist/turn/step-loop.conformance.d.ts +16 -0
  142. package/dist/turn/step-loop.conformance.js +164 -0
  143. package/dist/turn/testing.d.ts +30 -0
  144. package/dist/turn/turn-bus.d.ts +23 -0
  145. package/dist/turn/turn-bus.js +54 -0
  146. package/dist/turn/turn-bus.test.d.ts +1 -0
  147. package/dist/turn/turn-event.entity.d.ts +263 -0
  148. package/dist/turn/turn-event.entity.functions.d.ts +35 -0
  149. package/dist/turn/turn-event.entity.functions.js +21 -0
  150. package/dist/turn/turn-event.entity.js +101 -0
  151. package/dist/turn/turn-lifecycle.d.ts +32 -0
  152. package/dist/turn/turn-lifecycle.js +48 -0
  153. package/dist/turn/turn-run.d.ts +26 -0
  154. package/dist/turn/turn-run.js +105 -0
  155. package/dist/turn/turn.adapter.d.ts +21 -0
  156. package/dist/turn/turn.adapter.js +126 -0
  157. package/dist/turn/turn.adapter.test.d.ts +1 -0
  158. package/dist/turn/turn.conformance.d.ts +20 -0
  159. package/dist/turn/turn.conformance.js +74 -0
  160. package/dist/turn/user-message.entity.d.ts +14 -0
  161. package/dist/turn/user-message.entity.js +10 -0
  162. package/dist/util/json.d.ts +2 -2
  163. package/dist/util/json.js +10 -10
  164. package/package.json +3 -3
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @xandreed/core
2
2
 
3
- Efferent composable agent framework, 0.4.0. Bun on Linux.
3
+ Efferent composable agent framework, 0.11.0. Node 24 or Bun.
4
4
 
5
5
  Documentation: https://github.com/xandreeddev/efferent
@@ -0,0 +1,15 @@
1
+ import { Schema } from "effect";
2
+ import type { Effect } from "effect";
3
+ declare const ConformanceFailure_base: Schema.Class<ConformanceFailure, Schema.TaggedStruct<"ConformanceFailure", {
4
+ readonly check: Schema.String;
5
+ readonly message: Schema.String;
6
+ }>, import("effect/Cause").YieldableError>;
7
+ /** A port contract that an implementation broke. */
8
+ export declare class ConformanceFailure extends ConformanceFailure_base {
9
+ }
10
+ /** One contract check of a conformance kit, runnable under any test runner. */
11
+ export interface ConformanceCheck {
12
+ readonly name: string;
13
+ readonly run: Effect.Effect<void, ConformanceFailure>;
14
+ }
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Schema } from "effect";
2
+
3
+ export class ConformanceFailure extends Schema.TaggedError()("ConformanceFailure", {
4
+ check: Schema.String,
5
+ message: Schema.String
6
+ }) {
7
+ }
@@ -1,31 +1,31 @@
1
1
  import { Schema } from "effect";
2
- export declare const DecisionId: Schema.brand<typeof Schema.NonEmptyTrimmedString, "DecisionId">;
2
+ export declare const DecisionId: Schema.brand<Schema.Trimmed, "DecisionId">;
3
3
  export declare const DecisionRecord: Schema.Struct<{
4
- version: Schema.Literal<[1]>;
5
- id: Schema.brand<typeof Schema.NonEmptyTrimmedString, "DecisionId">;
6
- family: typeof Schema.NonEmptyString;
7
- contextHash: typeof Schema.String;
8
- candidateHash: typeof Schema.String;
9
- policyVersion: typeof Schema.String;
10
- candidates: Schema.Array$<Schema.Struct<{
11
- id: typeof Schema.String;
12
- description: typeof Schema.String;
4
+ readonly version: Schema.Literal<1>;
5
+ readonly id: Schema.brand<Schema.Trimmed, "DecisionId">;
6
+ readonly family: Schema.NonEmptyString;
7
+ readonly contextHash: Schema.String;
8
+ readonly candidateHash: Schema.String;
9
+ readonly policyVersion: Schema.String;
10
+ readonly candidates: Schema.$Array<Schema.Struct<{
11
+ readonly id: Schema.String;
12
+ readonly description: Schema.String;
13
13
  }>>;
14
- attempts: Schema.Array$<typeof Schema.String>;
15
- selection: Schema.OptionFromNullOr<typeof Schema.String>;
16
- validation: Schema.Literal<["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]>;
17
- fallback: Schema.OptionFromNullOr<typeof Schema.String>;
18
- applied: Schema.OptionFromNullOr<typeof Schema.String>;
19
- probabilities: Schema.OptionFromNullOr<Schema.Record$<typeof Schema.String, Schema.filter<typeof Schema.Number>>>;
14
+ readonly attempts: Schema.$Array<Schema.String>;
15
+ readonly selection: Schema.OptionFromNullOr<Schema.String>;
16
+ readonly validation: Schema.Literals<readonly ["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]>;
17
+ readonly fallback: Schema.OptionFromNullOr<Schema.String>;
18
+ readonly applied: Schema.OptionFromNullOr<Schema.String>;
19
+ readonly probabilities: Schema.OptionFromNullOr<Schema.$Record<Schema.String, Schema.Number>>;
20
20
  }>;
21
21
  export type DecisionRecord = typeof DecisionRecord.Type;
22
22
  export declare const DecisionOutcome: Schema.Struct<{
23
- version: Schema.Literal<[1]>;
24
- decisionId: Schema.brand<typeof Schema.NonEmptyTrimmedString, "DecisionId">;
25
- runId: typeof Schema.String;
26
- status: Schema.Literal<["completed", "failed", "cancelled", "incomplete"]>;
27
- toolInvocations: Schema.Array$<typeof Schema.String>;
28
- modelAttempts: Schema.Array$<typeof Schema.String>;
29
- deliveredSequences: Schema.Array$<typeof Schema.Int>;
23
+ readonly version: Schema.Literal<1>;
24
+ readonly decisionId: Schema.brand<Schema.Trimmed, "DecisionId">;
25
+ readonly runId: Schema.String;
26
+ readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "incomplete"]>;
27
+ readonly toolInvocations: Schema.$Array<Schema.String>;
28
+ readonly modelAttempts: Schema.$Array<Schema.String>;
29
+ readonly deliveredSequences: Schema.$Array<Schema.Int>;
30
30
  }>;
31
31
  export type DecisionOutcome = typeof DecisionOutcome.Type;
@@ -0,0 +1,6 @@
1
+ import { Effect } from "effect";
2
+ import type { HarnessError } from "./harness/plugin.entity.js";
3
+ import { RunContext } from "./ports/run-context.port.js";
4
+ import type { DecisionRecord } from "./decision-record.entity.js";
5
+ /** Journal a decision on the current turn's bus (`decision.recorded`). */
6
+ export declare const recordDecision: (record: DecisionRecord) => Effect.Effect<void, HarnessError, RunContext>;
@@ -0,0 +1,3 @@
1
+ import { Effect } from "effect";
2
+ import { RunContext } from "./ports/run-context.port.js";
3
+ export const recordDecision = (record) => RunContext.pipe(Effect.flatMap((run) => run.events.publish({ _tag: "decision.recorded", record })));
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- export const DecisionId = Schema.NonEmptyTrimmedString.pipe(Schema.brand("DecisionId")), DecisionRecord = Schema.Struct({
2
+ export const DecisionId = Schema.Trimmed.check(Schema.isNonEmpty()).pipe(Schema.brand("DecisionId")), DecisionRecord = Schema.Struct({
3
3
  version: Schema.Literal(1),
4
4
  id: DecisionId,
5
5
  family: Schema.NonEmptyString,
@@ -9,15 +9,15 @@ export const DecisionId = Schema.NonEmptyTrimmedString.pipe(Schema.brand("Decisi
9
9
  candidates: Schema.Array(Schema.Struct({ id: Schema.String, description: Schema.String })),
10
10
  attempts: Schema.Array(Schema.String),
11
11
  selection: Schema.OptionFromNullOr(Schema.String),
12
- validation: Schema.Literal("accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"),
12
+ validation: Schema.Literals(["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]),
13
13
  fallback: Schema.OptionFromNullOr(Schema.String),
14
14
  applied: Schema.OptionFromNullOr(Schema.String),
15
- probabilities: Schema.OptionFromNullOr(Schema.Record({ key: Schema.String, value: Schema.Number.pipe(Schema.between(0, 1)) }))
15
+ probabilities: Schema.OptionFromNullOr(Schema.Record(Schema.String, Schema.Number.pipe(Schema.check(Schema.isBetween({ minimum: 0, maximum: 1 })))))
16
16
  }), DecisionOutcome = Schema.Struct({
17
17
  version: Schema.Literal(1),
18
18
  decisionId: DecisionId,
19
19
  runId: Schema.String,
20
- status: Schema.Literal("completed", "failed", "cancelled", "incomplete"),
20
+ status: Schema.Literals(["completed", "failed", "cancelled", "incomplete"]),
21
21
  toolInvocations: Schema.Array(Schema.String),
22
22
  modelAttempts: Schema.Array(Schema.String),
23
23
  deliveredSequences: Schema.Array(Schema.Int)
@@ -1,12 +1,12 @@
1
1
  import { Schema } from "effect";
2
2
  /** Stable, serializable failure context shared by products and evaluations. */
3
- export declare const AgentFailureCategory: Schema.Literal<["authentication", "authorization", "rate-limit", "timeout", "transport", "protocol", "validation", "tool", "persistence", "unknown"]>;
3
+ export declare const AgentFailureCategory: Schema.Literals<readonly ["authentication", "authorization", "rate-limit", "timeout", "transport", "protocol", "validation", "tool", "persistence", "unknown"]>;
4
4
  export type AgentFailureCategory = typeof AgentFailureCategory.Type;
5
5
  export declare const AgentFailure: Schema.Struct<{
6
- code: typeof Schema.String;
7
- category: Schema.Literal<["authentication", "authorization", "rate-limit", "timeout", "transport", "protocol", "validation", "tool", "persistence", "unknown"]>;
8
- stage: typeof Schema.String;
9
- message: typeof Schema.String;
10
- retryable: typeof Schema.Boolean;
6
+ readonly code: Schema.String;
7
+ readonly category: Schema.Literals<readonly ["authentication", "authorization", "rate-limit", "timeout", "transport", "protocol", "validation", "tool", "persistence", "unknown"]>;
8
+ readonly stage: Schema.String;
9
+ readonly message: Schema.String;
10
+ readonly retryable: Schema.Boolean;
11
11
  }>;
12
12
  export type AgentFailure = typeof AgentFailure.Type;
@@ -1,5 +1,16 @@
1
1
  import { Schema } from "effect";
2
- export const AgentFailureCategory = Schema.Literal("authentication", "authorization", "rate-limit", "timeout", "transport", "protocol", "validation", "tool", "persistence", "unknown"), AgentFailure = Schema.Struct({
2
+ export const AgentFailureCategory = Schema.Literals([
3
+ "authentication",
4
+ "authorization",
5
+ "rate-limit",
6
+ "timeout",
7
+ "transport",
8
+ "protocol",
9
+ "validation",
10
+ "tool",
11
+ "persistence",
12
+ "unknown"
13
+ ]), AgentFailure = Schema.Struct({
3
14
  code: Schema.String,
4
15
  category: AgentFailureCategory,
5
16
  stage: Schema.String,
@@ -6,7 +6,7 @@ import { Schema } from "effect";
6
6
  * `message` says exactly what to fix; the model corrects in the same run.
7
7
  */
8
8
  export declare const Failure: Schema.Struct<{
9
- error: typeof Schema.String;
10
- message: typeof Schema.String;
9
+ readonly error: Schema.String;
10
+ readonly message: Schema.String;
11
11
  }>;
12
12
  export type Failure = typeof Failure.Type;
@@ -67,6 +67,8 @@ export type LoopEvent = {
67
67
  readonly args: unknown;
68
68
  readonly ok: boolean;
69
69
  readonly result: unknown;
70
+ /** The schema-encoded result — the persisted, provider-visible form. */
71
+ readonly encoded?: unknown;
70
72
  }
71
73
  /** The mid-run fold: the buffer outgrew the healthy context range and the
72
74
  * older turns were replaced by a handoff summary — `kept` verbatim
@@ -5,140 +5,127 @@ import { Schema } from "effect";
5
5
  * an opaque blob that round-trips provider-private fields (e.g. Gemini's
6
6
  * `thought_signature` on a reasoning part) without the engine inspecting them.
7
7
  */
8
- export declare const ConversationId: Schema.brand<typeof Schema.UUID, "ConversationId">;
8
+ export declare const ConversationId: Schema.brand<Schema.String, "ConversationId">;
9
9
  export type ConversationId = typeof ConversationId.Type;
10
10
  /** A tool call's pairing key — the provider's id, or the loop's deterministic
11
11
  * `<turnIndex>:<toolName>:<ordinal>` mint when the provider omits one. */
12
- export declare const ToolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
12
+ export declare const ToolCallId: Schema.brand<Schema.String, "ToolCallId">;
13
13
  export type ToolCallId = typeof ToolCallId.Type;
14
- declare const Checkpoint_base: Schema.Class<Checkpoint, {
15
- conversationId: Schema.brand<typeof Schema.UUID, "ConversationId">;
14
+ declare const Checkpoint_base: Schema.Class<Checkpoint, Schema.Struct<{
15
+ readonly conversationId: Schema.brand<Schema.String, "ConversationId">;
16
16
  /** The absolute message position this fold covers (inclusive). */
17
- messagePosition: typeof Schema.Number;
18
- summary: typeof Schema.String;
19
- createdAt: typeof Schema.Number;
20
- }, Schema.Struct.Encoded<{
21
- conversationId: Schema.brand<typeof Schema.UUID, "ConversationId">;
22
- /** The absolute message position this fold covers (inclusive). */
23
- messagePosition: typeof Schema.Number;
24
- summary: typeof Schema.String;
25
- createdAt: typeof Schema.Number;
26
- }>, never, {
27
- readonly conversationId: string & import("effect/Brand").Brand<"ConversationId">;
28
- } & {
29
- readonly messagePosition: number;
30
- } & {
31
- readonly summary: string;
32
- } & {
33
- readonly createdAt: number;
34
- }, {}, {}>;
17
+ readonly messagePosition: Schema.Number;
18
+ readonly summary: Schema.String;
19
+ readonly createdAt: Schema.Number;
20
+ }>, {}>;
35
21
  export declare class Checkpoint extends Checkpoint_base {
36
22
  }
37
23
  export declare const TextPart: Schema.Struct<{
38
- type: Schema.Literal<["text"]>;
39
- text: typeof Schema.String;
40
- providerOptions: Schema.optional<typeof Schema.Unknown>;
24
+ readonly type: Schema.Literal<"text">;
25
+ readonly text: Schema.String;
26
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
41
27
  }>;
42
28
  export type TextPart = typeof TextPart.Type;
43
29
  export declare const ReasoningPart: Schema.Struct<{
44
- type: Schema.Literal<["reasoning"]>;
45
- text: typeof Schema.String;
46
- providerOptions: Schema.optional<typeof Schema.Unknown>;
30
+ readonly type: Schema.Literal<"reasoning">;
31
+ readonly text: Schema.String;
32
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
47
33
  }>;
48
34
  export type ReasoningPart = typeof ReasoningPart.Type;
49
35
  export declare const ToolCallPart: Schema.Struct<{
50
- type: Schema.Literal<["tool-call"]>;
51
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
52
- toolName: typeof Schema.String;
53
- input: typeof Schema.Unknown;
54
- providerOptions: Schema.optional<typeof Schema.Unknown>;
55
- providerExecuted: Schema.optional<typeof Schema.Boolean>;
36
+ readonly type: Schema.Literal<"tool-call">;
37
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
38
+ readonly toolName: Schema.String;
39
+ readonly input: Schema.Unknown;
40
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
41
+ readonly providerExecuted: Schema.optional<Schema.Boolean>;
56
42
  }>;
57
43
  export type ToolCallPart = typeof ToolCallPart.Type;
58
44
  export declare const ToolResultPart: Schema.Struct<{
59
- type: Schema.Literal<["tool-result"]>;
60
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
61
- toolName: typeof Schema.String;
62
- output: typeof Schema.Unknown;
63
- providerOptions: Schema.optional<typeof Schema.Unknown>;
64
- isError: Schema.optional<typeof Schema.Boolean>;
45
+ readonly type: Schema.Literal<"tool-result">;
46
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
47
+ readonly toolName: Schema.String;
48
+ readonly output: Schema.Unknown;
49
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
50
+ readonly isError: Schema.optional<Schema.Boolean>;
65
51
  }>;
66
52
  export type ToolResultPart = typeof ToolResultPart.Type;
67
- export declare const UserMessage: Schema.Struct<{
68
- role: Schema.Literal<["user"]>;
69
- content: typeof Schema.String;
70
- providerOptions: Schema.optional<typeof Schema.Unknown>;
53
+ /** A model-visible message in the user role (the user's own words, turn context, host notes). */
54
+ export declare const UserRoleMessage: Schema.Struct<{
55
+ readonly role: Schema.Literal<"user">;
56
+ readonly content: Schema.String;
57
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
71
58
  }>;
72
- export type UserMessage = typeof UserMessage.Type;
59
+ export type UserRoleMessage = typeof UserRoleMessage.Type;
73
60
  export declare const AssistantMessage: Schema.Struct<{
74
- role: Schema.Literal<["assistant"]>;
75
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
76
- type: Schema.Literal<["text"]>;
77
- text: typeof Schema.String;
78
- providerOptions: Schema.optional<typeof Schema.Unknown>;
61
+ readonly role: Schema.Literal<"assistant">;
62
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
63
+ readonly type: Schema.Literal<"text">;
64
+ readonly text: Schema.String;
65
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
79
66
  }>, Schema.Struct<{
80
- type: Schema.Literal<["reasoning"]>;
81
- text: typeof Schema.String;
82
- providerOptions: Schema.optional<typeof Schema.Unknown>;
67
+ readonly type: Schema.Literal<"reasoning">;
68
+ readonly text: Schema.String;
69
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
83
70
  }>, Schema.Struct<{
84
- type: Schema.Literal<["tool-call"]>;
85
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
86
- toolName: typeof Schema.String;
87
- input: typeof Schema.Unknown;
88
- providerOptions: Schema.optional<typeof Schema.Unknown>;
89
- providerExecuted: Schema.optional<typeof Schema.Boolean>;
71
+ readonly type: Schema.Literal<"tool-call">;
72
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
73
+ readonly toolName: Schema.String;
74
+ readonly input: Schema.Unknown;
75
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
76
+ readonly providerExecuted: Schema.optional<Schema.Boolean>;
90
77
  }>]>>;
91
- providerOptions: Schema.optional<typeof Schema.Unknown>;
78
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
92
79
  }>;
93
80
  export type AssistantMessage = typeof AssistantMessage.Type;
94
81
  export declare const ToolMessage: Schema.Struct<{
95
- role: Schema.Literal<["tool"]>;
96
- content: Schema.Array$<Schema.Struct<{
97
- type: Schema.Literal<["tool-result"]>;
98
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
99
- toolName: typeof Schema.String;
100
- output: typeof Schema.Unknown;
101
- providerOptions: Schema.optional<typeof Schema.Unknown>;
102
- isError: Schema.optional<typeof Schema.Boolean>;
82
+ readonly role: Schema.Literal<"tool">;
83
+ readonly content: Schema.$Array<Schema.Struct<{
84
+ readonly type: Schema.Literal<"tool-result">;
85
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
86
+ readonly toolName: Schema.String;
87
+ readonly output: Schema.Unknown;
88
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
89
+ readonly isError: Schema.optional<Schema.Boolean>;
103
90
  }>>;
104
- providerOptions: Schema.optional<typeof Schema.Unknown>;
91
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
105
92
  }>;
106
93
  export type ToolMessage = typeof ToolMessage.Type;
107
94
  /** The single conversation unit — persisted as-is, one row per entry. */
108
- export declare const AgentMessage: Schema.Union<[Schema.Struct<{
109
- role: Schema.Literal<["user"]>;
110
- content: typeof Schema.String;
111
- providerOptions: Schema.optional<typeof Schema.Unknown>;
95
+ export declare const AgentMessage: Schema.Union<readonly [Schema.Struct<{
96
+ readonly role: Schema.Literal<"user">;
97
+ readonly content: Schema.String;
98
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
112
99
  }>, Schema.Struct<{
113
- role: Schema.Literal<["assistant"]>;
114
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
115
- type: Schema.Literal<["text"]>;
116
- text: typeof Schema.String;
117
- providerOptions: Schema.optional<typeof Schema.Unknown>;
100
+ readonly role: Schema.Literal<"assistant">;
101
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
102
+ readonly type: Schema.Literal<"text">;
103
+ readonly text: Schema.String;
104
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
118
105
  }>, Schema.Struct<{
119
- type: Schema.Literal<["reasoning"]>;
120
- text: typeof Schema.String;
121
- providerOptions: Schema.optional<typeof Schema.Unknown>;
106
+ readonly type: Schema.Literal<"reasoning">;
107
+ readonly text: Schema.String;
108
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
122
109
  }>, Schema.Struct<{
123
- type: Schema.Literal<["tool-call"]>;
124
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
125
- toolName: typeof Schema.String;
126
- input: typeof Schema.Unknown;
127
- providerOptions: Schema.optional<typeof Schema.Unknown>;
128
- providerExecuted: Schema.optional<typeof Schema.Boolean>;
110
+ readonly type: Schema.Literal<"tool-call">;
111
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
112
+ readonly toolName: Schema.String;
113
+ readonly input: Schema.Unknown;
114
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
115
+ readonly providerExecuted: Schema.optional<Schema.Boolean>;
129
116
  }>]>>;
130
- providerOptions: Schema.optional<typeof Schema.Unknown>;
117
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
131
118
  }>, Schema.Struct<{
132
- role: Schema.Literal<["tool"]>;
133
- content: Schema.Array$<Schema.Struct<{
134
- type: Schema.Literal<["tool-result"]>;
135
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
136
- toolName: typeof Schema.String;
137
- output: typeof Schema.Unknown;
138
- providerOptions: Schema.optional<typeof Schema.Unknown>;
139
- isError: Schema.optional<typeof Schema.Boolean>;
119
+ readonly role: Schema.Literal<"tool">;
120
+ readonly content: Schema.$Array<Schema.Struct<{
121
+ readonly type: Schema.Literal<"tool-result">;
122
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
123
+ readonly toolName: Schema.String;
124
+ readonly output: Schema.Unknown;
125
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
126
+ readonly isError: Schema.optional<Schema.Boolean>;
140
127
  }>>;
141
- providerOptions: Schema.optional<typeof Schema.Unknown>;
128
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
142
129
  }>]>;
143
130
  export type AgentMessage = typeof AgentMessage.Type;
144
131
  /**
@@ -147,81 +134,81 @@ export type AgentMessage = typeof AgentMessage.Type;
147
134
  * never reconstruct it by index arithmetic on `messages`.
148
135
  */
149
136
  export declare const AgentResult: Schema.Struct<{
150
- finalText: typeof Schema.String;
151
- messages: Schema.Array$<Schema.Union<[Schema.Struct<{
152
- role: Schema.Literal<["user"]>;
153
- content: typeof Schema.String;
154
- providerOptions: Schema.optional<typeof Schema.Unknown>;
137
+ readonly finalText: Schema.String;
138
+ readonly messages: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
139
+ readonly role: Schema.Literal<"user">;
140
+ readonly content: Schema.String;
141
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
155
142
  }>, Schema.Struct<{
156
- role: Schema.Literal<["assistant"]>;
157
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
158
- type: Schema.Literal<["text"]>;
159
- text: typeof Schema.String;
160
- providerOptions: Schema.optional<typeof Schema.Unknown>;
143
+ readonly role: Schema.Literal<"assistant">;
144
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
145
+ readonly type: Schema.Literal<"text">;
146
+ readonly text: Schema.String;
147
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
161
148
  }>, Schema.Struct<{
162
- type: Schema.Literal<["reasoning"]>;
163
- text: typeof Schema.String;
164
- providerOptions: Schema.optional<typeof Schema.Unknown>;
149
+ readonly type: Schema.Literal<"reasoning">;
150
+ readonly text: Schema.String;
151
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
165
152
  }>, Schema.Struct<{
166
- type: Schema.Literal<["tool-call"]>;
167
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
168
- toolName: typeof Schema.String;
169
- input: typeof Schema.Unknown;
170
- providerOptions: Schema.optional<typeof Schema.Unknown>;
171
- providerExecuted: Schema.optional<typeof Schema.Boolean>;
153
+ readonly type: Schema.Literal<"tool-call">;
154
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
155
+ readonly toolName: Schema.String;
156
+ readonly input: Schema.Unknown;
157
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
158
+ readonly providerExecuted: Schema.optional<Schema.Boolean>;
172
159
  }>]>>;
173
- providerOptions: Schema.optional<typeof Schema.Unknown>;
160
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
174
161
  }>, Schema.Struct<{
175
- role: Schema.Literal<["tool"]>;
176
- content: Schema.Array$<Schema.Struct<{
177
- type: Schema.Literal<["tool-result"]>;
178
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
179
- toolName: typeof Schema.String;
180
- output: typeof Schema.Unknown;
181
- providerOptions: Schema.optional<typeof Schema.Unknown>;
182
- isError: Schema.optional<typeof Schema.Boolean>;
162
+ readonly role: Schema.Literal<"tool">;
163
+ readonly content: Schema.$Array<Schema.Struct<{
164
+ readonly type: Schema.Literal<"tool-result">;
165
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
166
+ readonly toolName: Schema.String;
167
+ readonly output: Schema.Unknown;
168
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
169
+ readonly isError: Schema.optional<Schema.Boolean>;
183
170
  }>>;
184
- providerOptions: Schema.optional<typeof Schema.Unknown>;
171
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
185
172
  }>]>>;
186
- newTail: Schema.Array$<Schema.Union<[Schema.Struct<{
187
- role: Schema.Literal<["user"]>;
188
- content: typeof Schema.String;
189
- providerOptions: Schema.optional<typeof Schema.Unknown>;
173
+ readonly newTail: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
174
+ readonly role: Schema.Literal<"user">;
175
+ readonly content: Schema.String;
176
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
190
177
  }>, Schema.Struct<{
191
- role: Schema.Literal<["assistant"]>;
192
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
193
- type: Schema.Literal<["text"]>;
194
- text: typeof Schema.String;
195
- providerOptions: Schema.optional<typeof Schema.Unknown>;
178
+ readonly role: Schema.Literal<"assistant">;
179
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
180
+ readonly type: Schema.Literal<"text">;
181
+ readonly text: Schema.String;
182
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
196
183
  }>, Schema.Struct<{
197
- type: Schema.Literal<["reasoning"]>;
198
- text: typeof Schema.String;
199
- providerOptions: Schema.optional<typeof Schema.Unknown>;
184
+ readonly type: Schema.Literal<"reasoning">;
185
+ readonly text: Schema.String;
186
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
200
187
  }>, Schema.Struct<{
201
- type: Schema.Literal<["tool-call"]>;
202
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
203
- toolName: typeof Schema.String;
204
- input: typeof Schema.Unknown;
205
- providerOptions: Schema.optional<typeof Schema.Unknown>;
206
- providerExecuted: Schema.optional<typeof Schema.Boolean>;
188
+ readonly type: Schema.Literal<"tool-call">;
189
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
190
+ readonly toolName: Schema.String;
191
+ readonly input: Schema.Unknown;
192
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
193
+ readonly providerExecuted: Schema.optional<Schema.Boolean>;
207
194
  }>]>>;
208
- providerOptions: Schema.optional<typeof Schema.Unknown>;
195
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
209
196
  }>, Schema.Struct<{
210
- role: Schema.Literal<["tool"]>;
211
- content: Schema.Array$<Schema.Struct<{
212
- type: Schema.Literal<["tool-result"]>;
213
- toolCallId: Schema.brand<typeof Schema.String, "ToolCallId">;
214
- toolName: typeof Schema.String;
215
- output: typeof Schema.Unknown;
216
- providerOptions: Schema.optional<typeof Schema.Unknown>;
217
- isError: Schema.optional<typeof Schema.Boolean>;
197
+ readonly role: Schema.Literal<"tool">;
198
+ readonly content: Schema.$Array<Schema.Struct<{
199
+ readonly type: Schema.Literal<"tool-result">;
200
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
201
+ readonly toolName: Schema.String;
202
+ readonly output: Schema.Unknown;
203
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
204
+ readonly isError: Schema.optional<Schema.Boolean>;
218
205
  }>>;
219
- providerOptions: Schema.optional<typeof Schema.Unknown>;
206
+ readonly providerOptions: Schema.optional<Schema.Unknown>;
220
207
  }>]>>;
221
208
  /** "ok" — the model finished on its own; "partial" — the step cap or the
222
209
  * degenerate-loop breaker stopped it, so `finalText` is NOT a deliverable. */
223
- outcome: Schema.Literal<["ok", "partial"]>;
224
- reason: Schema.Literal<["completed", "step-cap", "degenerate-loop"]>;
210
+ readonly outcome: Schema.Literals<readonly ["ok", "partial"]>;
211
+ readonly reason: Schema.Literals<readonly ["completed", "step-cap", "degenerate-loop"]>;
225
212
  }>;
226
213
  export type AgentResult = typeof AgentResult.Type;
227
214
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- export const ConversationId = Schema.UUID.pipe(Schema.brand("ConversationId")), ToolCallId = Schema.String.pipe(Schema.brand("ToolCallId"));
2
+ export const ConversationId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("ConversationId")), ToolCallId = Schema.String.pipe(Schema.brand("ToolCallId"));
3
3
 
4
4
  export class Checkpoint extends Schema.Class("Checkpoint")({
5
5
  conversationId: ConversationId,
@@ -30,22 +30,22 @@ export const TextPart = Schema.Struct({
30
30
  output: Schema.Unknown,
31
31
  providerOptions: Schema.optional(Schema.Unknown),
32
32
  isError: Schema.optional(Schema.Boolean)
33
- }), UserMessage = Schema.Struct({
33
+ }), UserRoleMessage = Schema.Struct({
34
34
  role: Schema.Literal("user"),
35
35
  content: Schema.String,
36
36
  providerOptions: Schema.optional(Schema.Unknown)
37
37
  }), AssistantMessage = Schema.Struct({
38
38
  role: Schema.Literal("assistant"),
39
- content: Schema.Array(Schema.Union(TextPart, ReasoningPart, ToolCallPart)),
39
+ content: Schema.Array(Schema.Union([TextPart, ReasoningPart, ToolCallPart])),
40
40
  providerOptions: Schema.optional(Schema.Unknown)
41
41
  }), ToolMessage = Schema.Struct({
42
42
  role: Schema.Literal("tool"),
43
43
  content: Schema.Array(ToolResultPart),
44
44
  providerOptions: Schema.optional(Schema.Unknown)
45
- }), AgentMessage = Schema.Union(UserMessage, AssistantMessage, ToolMessage), AgentResult = Schema.Struct({
45
+ }), AgentMessage = Schema.Union([UserRoleMessage, AssistantMessage, ToolMessage]), AgentResult = Schema.Struct({
46
46
  finalText: Schema.String,
47
47
  messages: Schema.Array(AgentMessage),
48
48
  newTail: Schema.Array(AgentMessage),
49
- outcome: Schema.Literal("ok", "partial"),
50
- reason: Schema.Literal("completed", "step-cap", "degenerate-loop")
49
+ outcome: Schema.Literals(["ok", "partial"]),
50
+ reason: Schema.Literals(["completed", "step-cap", "degenerate-loop"])
51
51
  });
@@ -3,10 +3,10 @@ import { Schema } from "effect";
3
3
  * subscription dialect (accepted, reasoning_tokens 0); `minimal` was
4
4
  * REJECTED there and stays out of the vocabulary. Non-codex adapters clamp
5
5
  * `none` to their nearest supported value. */
6
- export declare const ReasoningEffort: Schema.Literal<["none", "low", "medium", "high", "xhigh", "max"]>;
6
+ export declare const ReasoningEffort: Schema.Literals<readonly ["none", "low", "medium", "high", "xhigh", "max"]>;
7
7
  export type ReasoningEffort = typeof ReasoningEffort.Type;
8
8
  export declare const ModelCallPolicy: Schema.Struct<{
9
- effort: Schema.Literal<["none", "low", "medium", "high", "xhigh", "max"]>;
10
- maxOutputTokens: Schema.optional<typeof Schema.Number>;
9
+ readonly effort: Schema.Literals<readonly ["none", "low", "medium", "high", "xhigh", "max"]>;
10
+ readonly maxOutputTokens: Schema.optional<Schema.Number>;
11
11
  }>;
12
12
  export type ModelCallPolicy = typeof ModelCallPolicy.Type;
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- export const ReasoningEffort = Schema.Literal("none", "low", "medium", "high", "xhigh", "max"), ModelCallPolicy = Schema.Struct({
2
+ export const ReasoningEffort = Schema.Literals(["none", "low", "medium", "high", "xhigh", "max"]), ModelCallPolicy = Schema.Struct({
3
3
  effort: ReasoningEffort,
4
4
  maxOutputTokens: Schema.optional(Schema.Number)
5
5
  });