@xandreed/core 0.12.0 → 0.14.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 (155) hide show
  1. package/README.md +1 -1
  2. package/dist/conformance.functions.d.ts +34 -0
  3. package/dist/conformance.functions.js +25 -0
  4. package/dist/domain/bash.entity.d.ts +82 -0
  5. package/dist/domain/bash.entity.functions.d.ts +17 -0
  6. package/dist/domain/bash.entity.functions.js +26 -0
  7. package/dist/domain/bash.entity.functions.test.d.ts +1 -0
  8. package/dist/domain/bash.entity.js +30 -0
  9. package/dist/domain/file-system.entity.d.ts +91 -0
  10. package/dist/domain/file-system.entity.functions.d.ts +18 -0
  11. package/dist/domain/file-system.entity.functions.js +30 -0
  12. package/dist/domain/file-system.entity.js +37 -0
  13. package/dist/domain/loop-event.entity.d.ts +9 -0
  14. package/dist/domain/media.entity.d.ts +79 -0
  15. package/dist/domain/media.entity.functions.d.ts +76 -0
  16. package/dist/domain/media.entity.functions.js +110 -0
  17. package/dist/domain/media.entity.js +38 -0
  18. package/dist/domain/media.entity.test.d.ts +1 -0
  19. package/dist/domain/message.entity.d.ts +157 -5
  20. package/dist/domain/message.entity.js +8 -4
  21. package/dist/domain/model-catalog.entity.d.ts +2 -0
  22. package/dist/domain/model-catalog.entity.js +2 -1
  23. package/dist/domain/token-usage.entity.d.ts +45 -1
  24. package/dist/domain/token-usage.entity.functions.d.ts +30 -1
  25. package/dist/domain/token-usage.entity.functions.js +24 -4
  26. package/dist/domain/token-usage.entity.js +19 -2
  27. package/dist/domain/token-usage.entity.test.d.ts +1 -0
  28. package/dist/harness/capability.entity.functions.js +2 -1
  29. package/dist/harness/plugin.adapter.d.ts +3 -0
  30. package/dist/harness/plugin.adapter.js +7 -1
  31. package/dist/harness/skill-files.entity.d.ts +101 -0
  32. package/dist/harness/skill-files.entity.functions.d.ts +58 -0
  33. package/dist/harness/skill-files.entity.functions.js +150 -0
  34. package/dist/harness/skill-files.entity.functions.test.d.ts +1 -0
  35. package/dist/harness/skill-files.entity.js +25 -0
  36. package/dist/index.d.ts +48 -10
  37. package/dist/index.js +67 -14
  38. package/dist/loop/cacheKey.d.ts +1 -1
  39. package/dist/loop/mapping.d.ts +13 -7
  40. package/dist/loop/mapping.js +30 -6
  41. package/dist/loop/stepContext.d.ts +8 -0
  42. package/dist/loop/stepContext.js +1 -1
  43. package/dist/loop/traceContent.d.ts +29 -0
  44. package/dist/loop/traceContent.js +4 -0
  45. package/dist/loop/traceContent.test.d.ts +1 -0
  46. package/dist/memory/memory-log.entity.d.ts +152 -14
  47. package/dist/memory/memory-log.entity.functions.d.ts +35 -5
  48. package/dist/memory/memory-log.entity.functions.js +59 -20
  49. package/dist/memory/memory-log.entity.js +19 -6
  50. package/dist/memory/memory-session.js +10 -6
  51. package/dist/memory/memory.conformance.d.ts +8 -1
  52. package/dist/memory/memory.conformance.js +32 -0
  53. package/dist/models/auth-store.conformance.d.ts +13 -0
  54. package/dist/models/auth-store.conformance.js +73 -0
  55. package/dist/models/auth-store.conformance.test.d.ts +1 -0
  56. package/dist/models/model-catalog.conformance.d.ts +15 -0
  57. package/dist/models/model-catalog.conformance.js +27 -0
  58. package/dist/models/model-catalog.conformance.test.d.ts +1 -0
  59. package/dist/models/settings-store.conformance.d.ts +26 -0
  60. package/dist/models/settings-store.conformance.js +80 -0
  61. package/dist/models/settings-store.conformance.test.d.ts +1 -0
  62. package/dist/ports/activity.port.d.ts +35 -0
  63. package/dist/ports/activity.port.js +7 -0
  64. package/dist/ports/auth-store.port.d.ts +7 -5
  65. package/dist/ports/bash.port.d.ts +22 -0
  66. package/dist/ports/bash.port.js +4 -0
  67. package/dist/ports/capability.port.d.ts +11 -1
  68. package/dist/ports/file-system.port.d.ts +44 -15
  69. package/dist/ports/file-system.port.js +1 -7
  70. package/dist/ports/harness.port.d.ts +1 -99
  71. package/dist/ports/harness.port.js +0 -24
  72. package/dist/ports/memory.port.d.ts +13 -1
  73. package/dist/ports/model-catalog.port.d.ts +4 -1
  74. package/dist/ports/run-context.port.d.ts +6 -1
  75. package/dist/ports/session-log.port.d.ts +4 -1
  76. package/dist/ports/sessions.port.d.ts +35 -6
  77. package/dist/ports/settings-store.port.d.ts +11 -7
  78. package/dist/ports/step-loop.port.d.ts +30 -2
  79. package/dist/ports/tasks.port.d.ts +5 -1
  80. package/dist/ports/turn-admission.port.d.ts +8 -2
  81. package/dist/ports/turn-events.port.d.ts +8 -1
  82. package/dist/ports/turn-scope.port.d.ts +19 -1
  83. package/dist/ports/turn.port.d.ts +70 -5
  84. package/dist/ports/utility-llm.port.d.ts +2 -0
  85. package/dist/session/activity.entity.d.ts +42 -0
  86. package/dist/session/activity.entity.functions.d.ts +21 -0
  87. package/dist/session/activity.entity.functions.js +23 -0
  88. package/dist/session/activity.entity.functions.test.d.ts +1 -0
  89. package/dist/session/activity.entity.js +15 -0
  90. package/dist/session/chassis.js +2 -1
  91. package/dist/session/session-event.entity.d.ts +68 -6
  92. package/dist/session/session-event.entity.functions.d.ts +34 -2
  93. package/dist/session/session-event.entity.functions.js +54 -16
  94. package/dist/session/session-event.entity.js +19 -2
  95. package/dist/session/session-log.conformance.d.ts +4 -3
  96. package/dist/session/session-log.conformance.js +16 -14
  97. package/dist/session/session-log.recovery.conformance.d.ts +40 -0
  98. package/dist/session/session-log.recovery.conformance.js +143 -0
  99. package/dist/session/session-log.recovery.conformance.test.d.ts +1 -0
  100. package/dist/session/sessions.conformance.d.ts +79 -0
  101. package/dist/session/sessions.conformance.js +355 -0
  102. package/dist/session/sessions.entity.d.ts +36 -3
  103. package/dist/session/sessions.entity.functions.d.ts +42 -0
  104. package/dist/session/sessions.entity.functions.js +26 -0
  105. package/dist/session/sessions.entity.js +17 -4
  106. package/dist/session/sessions.entity.test.d.ts +1 -0
  107. package/dist/session/tasks.conformance.d.ts +70 -0
  108. package/dist/session/tasks.conformance.js +213 -0
  109. package/dist/session/tasks.conformance.test.d.ts +1 -0
  110. package/dist/turn/model-request.entity.d.ts +4 -0
  111. package/dist/turn/model-request.entity.js +7 -2
  112. package/dist/turn/step-loop.conformance.d.ts +4 -1
  113. package/dist/turn/step-loop.conformance.js +73 -7
  114. package/dist/turn/tool-registry.conformance.d.ts +38 -0
  115. package/dist/turn/tool-registry.conformance.js +206 -0
  116. package/dist/turn/turn-bus.js +4 -3
  117. package/dist/turn/turn-event.entity.d.ts +134 -34
  118. package/dist/turn/turn-event.entity.functions.d.ts +11 -0
  119. package/dist/turn/turn-event.entity.functions.js +9 -1
  120. package/dist/turn/turn-event.entity.js +76 -3
  121. package/dist/turn/turn-event.entity.test.d.ts +1 -0
  122. package/dist/turn/turn-lifecycle.d.ts +46 -8
  123. package/dist/turn/turn-lifecycle.js +33 -3
  124. package/dist/turn/turn-lifecycle.test.d.ts +1 -0
  125. package/dist/turn/turn-run.d.ts +15 -3
  126. package/dist/turn/turn-run.js +37 -9
  127. package/dist/turn/turn.adapter.d.ts +6 -5
  128. package/dist/turn/turn.adapter.js +15 -3
  129. package/dist/turn/turn.conformance.d.ts +11 -2
  130. package/dist/turn/turn.conformance.js +63 -2
  131. package/dist/turn/user-message.entity.d.ts +14 -4
  132. package/dist/turn/user-message.entity.functions.d.ts +21 -0
  133. package/dist/turn/user-message.entity.functions.js +24 -0
  134. package/dist/turn/user-message.entity.js +6 -8
  135. package/dist/turn/user-message.entity.test.d.ts +1 -0
  136. package/dist/util/glob.d.ts +30 -0
  137. package/dist/util/glob.js +91 -0
  138. package/dist/util/glob.test.d.ts +1 -0
  139. package/dist/workspace/bash.conformance.d.ts +37 -0
  140. package/dist/workspace/bash.conformance.js +120 -0
  141. package/dist/workspace/bash.conformance.test.d.ts +1 -0
  142. package/dist/workspace/file-system.conformance.d.ts +38 -0
  143. package/dist/workspace/file-system.conformance.js +254 -0
  144. package/dist/workspace/file-system.conformance.test.d.ts +1 -0
  145. package/dist/workspace/file-system.memory.adapter.d.ts +23 -0
  146. package/dist/workspace/file-system.memory.adapter.js +132 -0
  147. package/package.json +6 -6
  148. package/dist/harness/session.entity.d.ts +0 -33
  149. package/dist/harness/session.entity.js +0 -25
  150. package/dist/harness/skill-files.d.ts +0 -17
  151. package/dist/harness/skill-files.js +0 -25
  152. package/dist/ports/conversation-store.port.d.ts +0 -127
  153. package/dist/ports/conversation-store.port.js +0 -36
  154. package/dist/ports/shell.port.d.ts +0 -32
  155. package/dist/ports/shell.port.js +0 -16
@@ -1,127 +0,0 @@
1
- import { Context, Option, Schema } from "effect";
2
- import type { Effect } from "effect";
3
- import { AgentMessage, ConversationId } from "../domain/message.entity.js";
4
- import type { Checkpoint } from "../domain/message.entity.js";
5
- declare const StoreError_base: Schema.Class<StoreError, Schema.TaggedStruct<"StoreError", {
6
- readonly message: Schema.String;
7
- }>, import("effect/Cause").YieldableError>;
8
- export declare class StoreError extends StoreError_base {
9
- }
10
- declare const RunOutcomeRecord_base: Schema.Class<RunOutcomeRecord, Schema.Struct<{
11
- readonly conversationId: Schema.brand<Schema.String, "ConversationId">;
12
- /** Epoch millis. */
13
- readonly at: Schema.Number;
14
- readonly outcome: Schema.Literals<readonly ["ok", "partial"]>;
15
- readonly reason: Schema.Literals<readonly ["completed", "step-cap", "degenerate-loop"]>;
16
- }>, {}>;
17
- /** How a run ENDED — persisted beside the trail so the database alone says
18
- * whether the last run completed on its own or was stopped by the step cap
19
- * or the degenerate-loop breaker (the loop's `agent_end` was in-memory only). */
20
- export declare class RunOutcomeRecord extends RunOutcomeRecord_base {
21
- }
22
- declare const ConversationSummary_base: Schema.Class<ConversationSummary, Schema.Struct<{
23
- readonly id: Schema.brand<Schema.String, "ConversationId">;
24
- readonly createdAt: Schema.Number;
25
- readonly firstPrompt: Schema.OptionFromOptional<Schema.String>;
26
- readonly title: Schema.OptionFromOptional<Schema.String>;
27
- /** The latest recorded run outcome, when a run has finished in it. */
28
- readonly lastOutcome: Schema.OptionFromOptional<Schema.Struct<{
29
- readonly outcome: Schema.Literals<readonly ["ok", "partial"]>;
30
- readonly reason: Schema.Literals<readonly ["completed", "step-cap", "degenerate-loop"]>;
31
- }>>;
32
- }>, {}>;
33
- export declare class ConversationSummary extends ConversationSummary_base {
34
- }
35
- declare const StoredMessage_base: Schema.Class<StoredMessage, Schema.Struct<{
36
- readonly position: Schema.Int;
37
- readonly message: Schema.Union<readonly [Schema.Struct<{
38
- readonly role: Schema.Literal<"user">;
39
- readonly content: Schema.String;
40
- readonly providerOptions: Schema.optional<Schema.Unknown>;
41
- }>, Schema.Struct<{
42
- readonly role: Schema.Literal<"assistant">;
43
- readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
44
- readonly type: Schema.Literal<"text">;
45
- readonly text: Schema.String;
46
- readonly providerOptions: Schema.optional<Schema.Unknown>;
47
- }>, Schema.Struct<{
48
- readonly type: Schema.Literal<"reasoning">;
49
- readonly text: Schema.String;
50
- readonly providerOptions: Schema.optional<Schema.Unknown>;
51
- }>, Schema.Struct<{
52
- readonly type: Schema.Literal<"tool-call">;
53
- readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
54
- readonly toolName: Schema.String;
55
- readonly input: Schema.Unknown;
56
- readonly providerOptions: Schema.optional<Schema.Unknown>;
57
- readonly providerExecuted: Schema.optional<Schema.Boolean>;
58
- }>]>>;
59
- readonly providerOptions: Schema.optional<Schema.Unknown>;
60
- }>, Schema.Struct<{
61
- readonly role: Schema.Literal<"tool">;
62
- readonly content: Schema.$Array<Schema.Struct<{
63
- readonly type: Schema.Literal<"tool-result">;
64
- readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
65
- readonly toolName: Schema.String;
66
- readonly output: Schema.Unknown;
67
- readonly providerOptions: Schema.optional<Schema.Unknown>;
68
- readonly isError: Schema.optional<Schema.Boolean>;
69
- }>>;
70
- readonly providerOptions: Schema.optional<Schema.Unknown>;
71
- }>]>;
72
- }>, {}>;
73
- /** A persisted row WITH its durable position — what the active window is
74
- * made of, so a loader never reconstructs positions by arithmetic (an
75
- * undecodable row in between would shift every later one). */
76
- export declare class StoredMessage extends StoredMessage_base {
77
- }
78
- declare const ConversationStore_base: Context.ServiceClass<ConversationStore, "@xandreed/core/ConversationStore", {
79
- readonly create: (workspaceDir?: string) => Effect.Effect<ConversationId, StoreError>;
80
- readonly append: (id: ConversationId, message: AgentMessage) => Effect.Effect<number, StoreError>;
81
- /** One turn's rows land TOGETHER or not at all — an assistant tool call
82
- * without its results is a row the next run cannot send. Returns the
83
- * positions, aligned with the input. */
84
- readonly appendAll: (id: ConversationId, messages: ReadonlyArray<AgentMessage>) => Effect.Effect<ReadonlyArray<number>, StoreError>;
85
- readonly list: (id: ConversationId) => Effect.Effect<ReadonlyArray<AgentMessage>, StoreError>;
86
- /** The rows after the latest fold, each with its position. */
87
- readonly listActive: (id: ConversationId) => Effect.Effect<ReadonlyArray<StoredMessage>, StoreError>;
88
- readonly checkpoint: (id: ConversationId, summary: string) => Effect.Effect<void, StoreError>;
89
- /** A fold up to an EXPLICIT position (the within-run compaction seam):
90
- * rows at or before it are covered by the summary; `listActive` returns
91
- * only the rows after. `checkpoint` folds everything appended so far. */
92
- readonly checkpointAt: (id: ConversationId, summary: string, messagePosition: number) => Effect.Effect<void, StoreError>;
93
- readonly latestCheckpoint: (id: ConversationId) => Effect.Effect<Option.Option<Checkpoint>, StoreError>;
94
- readonly setTitle: (id: ConversationId, title: string) => Effect.Effect<void, StoreError>;
95
- /** Record how a run ended (appended; the latest is the conversation's). */
96
- readonly recordOutcome: (id: ConversationId, outcome: RunOutcomeRecord["outcome"], reason: RunOutcomeRecord["reason"]) => Effect.Effect<void, StoreError>;
97
- readonly latestOutcome: (id: ConversationId) => Effect.Effect<Option.Option<RunOutcomeRecord>, StoreError>;
98
- readonly listByWorkspace: (workspaceDir: string) => Effect.Effect<ReadonlyArray<ConversationSummary>, StoreError>;
99
- /** BRANCH: copy rows [0..upToPosition] (default: all) into a NEW
100
- * conversation in the same workspace, along with the latest covered
101
- * checkpoint — the original stays untouched; the fork continues
102
- * independently (git-branch semantics over the trail). */
103
- readonly fork: (id: ConversationId, upToPosition?: number) => Effect.Effect<ConversationId, StoreError>;
104
- /** RETENTION: delete whole conversations created before `beforeEpochMs`
105
- * (messages + checkpoints + the conversation row) and reclaim the
106
- * space. Nothing calls this automatically — deletion is a deliberate,
107
- * human-initiated act on an otherwise append-only store. Returns the
108
- * number of conversations removed. */
109
- readonly prune: (beforeEpochMs: number) => Effect.Effect<number, StoreError>;
110
- }>;
111
- /**
112
- * @deprecated Positional compatibility projection over SessionLog. New composable
113
- * hosts use Sessions, TurnWriter and ConversationMemory directly.
114
- *
115
- * The conversation persistence port. Positions are the durable identity:
116
- * `append` assigns a monotonic, immutable absolute position per conversation,
117
- * and UIs key their blocks on it so a live-streamed block and a later
118
- * re-projection of the same message reconcile instead of duplicating.
119
- *
120
- * A checkpoint FOLDS the history for loading purposes only: `list` always
121
- * returns every row; `listActive` returns the rows after the latest fold.
122
- * The loop prepends the fold's summary itself (domain logic stays here,
123
- * not in the adapter).
124
- */
125
- export declare class ConversationStore extends ConversationStore_base {
126
- }
127
- export {};
@@ -1,36 +0,0 @@
1
- import { Context, Option, Schema } from "effect";
2
- import { AgentMessage, ConversationId } from "../domain/message.entity.js";
3
-
4
- export class StoreError extends Schema.TaggedError()("StoreError", {
5
- message: Schema.String
6
- }) {
7
- }
8
-
9
- export class RunOutcomeRecord extends Schema.Class("RunOutcomeRecord")({
10
- conversationId: ConversationId,
11
- at: Schema.Number,
12
- outcome: Schema.Literals(["ok", "partial"]),
13
- reason: Schema.Literals(["completed", "step-cap", "degenerate-loop"])
14
- }) {
15
- }
16
-
17
- export class ConversationSummary extends Schema.Class("ConversationSummary")({
18
- id: ConversationId,
19
- createdAt: Schema.Number,
20
- firstPrompt: Schema.OptionFromOptional(Schema.String),
21
- title: Schema.OptionFromOptional(Schema.String),
22
- lastOutcome: Schema.OptionFromOptional(Schema.Struct({
23
- outcome: Schema.Literals(["ok", "partial"]),
24
- reason: Schema.Literals(["completed", "step-cap", "degenerate-loop"])
25
- }))
26
- }) {
27
- }
28
-
29
- export class StoredMessage extends Schema.Class("StoredMessage")({
30
- position: Schema.Int,
31
- message: AgentMessage
32
- }) {
33
- }
34
-
35
- export class ConversationStore extends Context.Service()("@xandreed/core/ConversationStore") {
36
- }
@@ -1,32 +0,0 @@
1
- import { Context, Schema } from "effect";
2
- import type { Effect } from "effect";
3
- declare const ShellError_base: Schema.Class<ShellError, Schema.TaggedStruct<"ShellError", {
4
- readonly message: Schema.String;
5
- }>, import("effect/Cause").YieldableError>;
6
- export declare class ShellError extends ShellError_base {
7
- }
8
- declare const ShellResult_base: Schema.Class<ShellResult, Schema.Struct<{
9
- readonly stdout: Schema.String;
10
- readonly stderr: Schema.String;
11
- readonly exitCode: Schema.Number;
12
- }>, {}>;
13
- export declare class ShellResult extends ShellResult_base {
14
- }
15
- declare const Shell_base: Context.ServiceClass<Shell, "@xandreed/core/Shell", {
16
- readonly exec: (command: string, options?: {
17
- readonly cwd?: string;
18
- readonly timeoutMs?: number;
19
- /** BEST-EFFORT live tap: called with each output chunk (stdout and
20
- * stderr) as it arrives, so a long build stops looking dead. Sync
21
- * and advisory — the settled `ShellResult` stays the contract. */
22
- readonly onChunk?: (chunk: string) => void;
23
- }) => Effect.Effect<ShellResult, ShellError>;
24
- }>;
25
- /**
26
- * Subprocess execution. A non-zero exit is a RESULT (the model reads the
27
- * code + stderr and adapts), never an error — the error channel carries only
28
- * spawn/timeout infrastructure failures.
29
- */
30
- export declare class Shell extends Shell_base {
31
- }
32
- export {};
@@ -1,16 +0,0 @@
1
- import { Context, Schema } from "effect";
2
-
3
- export class ShellError extends Schema.TaggedError()("ShellError", {
4
- message: Schema.String
5
- }) {
6
- }
7
-
8
- export class ShellResult extends Schema.Class("ShellResult")({
9
- stdout: Schema.String,
10
- stderr: Schema.String,
11
- exitCode: Schema.Number
12
- }) {
13
- }
14
-
15
- export class Shell extends Context.Service()("@xandreed/core/Shell") {
16
- }