@fungi.computer/shiitake-extensions 0.0.1 → 0.1.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 (66) hide show
  1. package/README.md +43 -13
  2. package/dist/almanac/contract.d.ts +94 -0
  3. package/dist/almanac/contract.js +71 -5
  4. package/dist/goal/client.d.ts +5 -2
  5. package/dist/goal/client.js +66 -72
  6. package/dist/goal/contract.d.ts +181 -64
  7. package/dist/goal/contract.js +102 -12
  8. package/dist/goal/host.js +188 -113
  9. package/dist/home/contract.d.ts +18 -0
  10. package/dist/home/contract.js +24 -3
  11. package/dist/home/host.d.ts +3 -0
  12. package/dist/home/host.js +1 -2
  13. package/dist/home/routing.js +13 -24
  14. package/dist/internal/history.d.ts +16 -0
  15. package/dist/internal/history.js +8 -0
  16. package/dist/loop/client.d.ts +1 -1
  17. package/dist/loop/client.js +28 -34
  18. package/dist/loop/contract.d.ts +113 -84
  19. package/dist/loop/contract.js +77 -9
  20. package/dist/loop/host.d.ts +1 -0
  21. package/dist/loop/host.js +17 -30
  22. package/dist/plan/client.d.ts +1 -1
  23. package/dist/plan/contract.d.ts +33 -0
  24. package/dist/plan/contract.js +28 -3
  25. package/dist/plan/host.js +12 -7
  26. package/dist/question/client.d.ts +1 -1
  27. package/dist/question/contract.d.ts +158 -0
  28. package/dist/question/contract.js +92 -7
  29. package/dist/question/host.js +34 -20
  30. package/dist/roster/conversation-agents.d.ts +31 -0
  31. package/dist/roster/conversation-agents.js +114 -0
  32. package/dist/roster.js +1 -0
  33. package/dist/skills/host.d.ts +1 -0
  34. package/dist/skills/host.js +22 -17
  35. package/dist/skills/source.d.ts +34 -0
  36. package/dist/subagents/client.d.ts +1 -1
  37. package/dist/subagents/client.js +43 -12
  38. package/dist/subagents/contract.d.ts +46 -8
  39. package/dist/subagents/contract.js +38 -8
  40. package/dist/subagents/host.d.ts +20 -8
  41. package/dist/subagents/host.js +58 -12
  42. package/docs/api/README.md +35 -0
  43. package/docs/api/almanac/contract.md +90 -0
  44. package/docs/api/almanac/host.md +19 -0
  45. package/docs/api/goal/client.md +26 -0
  46. package/docs/api/goal/contract.md +247 -0
  47. package/docs/api/goal/host.md +29 -0
  48. package/docs/api/home/contract.md +58 -0
  49. package/docs/api/home/host.md +55 -0
  50. package/docs/api/loop/client.md +25 -0
  51. package/docs/api/loop/contract.md +159 -0
  52. package/docs/api/loop/host.md +30 -0
  53. package/docs/api/plan/client.md +26 -0
  54. package/docs/api/plan/contract.md +163 -0
  55. package/docs/api/plan/host.md +19 -0
  56. package/docs/api/question/client.md +25 -0
  57. package/docs/api/question/contract.md +377 -0
  58. package/docs/api/question/host.md +19 -0
  59. package/docs/api/roster/conversation-agents.md +80 -0
  60. package/docs/api/roster.md +40 -0
  61. package/docs/api/skills/host.md +39 -0
  62. package/docs/api/skills/source.md +104 -0
  63. package/docs/api/subagents/client.md +26 -0
  64. package/docs/api/subagents/contract.md +131 -0
  65. package/docs/api/subagents/host.md +115 -0
  66. package/package.json +14 -8
@@ -1,15 +1,68 @@
1
1
  import { defineClientEntry, } from "@fungi.computer/shiitake/client-entry";
2
2
  import { goalContract } from "./contract.js";
3
- const tone = (goal) => goal.state === "blocked"
4
- ? "error"
5
- : goal.state === "complete"
6
- ? "settled"
7
- : goal.state === "paused"
8
- ? "muted"
9
- : "running";
10
- /** Product copy and controls belong to Goal; every host renders plain rows. */
3
+ /** One footer line: the full objective stays in the row's detail. */
4
+ const summary = (text) => {
5
+ const line = text.replace(/\s+/gu, " ").trim();
6
+ return line.length <= 80 ? line : `${line.slice(0, 79)}…`;
7
+ };
8
+ /** The local wall-clock time a goal started, as 14:02. */
9
+ const clockTime = (epochMillis) => {
10
+ const at = new Date(epochMillis);
11
+ return `${String(at.getHours()).padStart(2, "0")}:${String(at.getMinutes()).padStart(2, "0")}`;
12
+ };
13
+ /**
14
+ * The one footer row for a live or paused goal, with its one control. The
15
+ * line itself says why a goal paused, so every host shows it without opening
16
+ * the row; the detail keeps an objective the line had to shorten.
17
+ */
18
+ function currentRow(goal) {
19
+ const active = goal.state === "active";
20
+ const status = active
21
+ ? `Pursuing goal since ${clockTime(goal.startedAt)}`
22
+ : "Goal paused (/goal resume)";
23
+ const reason = !active && goal.pauseCause?.detail != null
24
+ ? [summary(goal.pauseCause.detail)]
25
+ : [];
26
+ const row = {
27
+ id: "goal",
28
+ title: [status, summary(goal.objective), ...reason].join(" · "),
29
+ tone: active ? "running" : "muted",
30
+ actions: [
31
+ {
32
+ id: "goal",
33
+ label: active ? "Pause goal" : "Resume goal",
34
+ input: { action: active ? "pause" : "resume" },
35
+ },
36
+ ],
37
+ };
38
+ return summary(goal.objective) === goal.objective
39
+ ? row
40
+ : { ...row, detail: goal.objective.slice(0, 1024) };
41
+ }
42
+ /** One chat line at the Session position committed when the goal ended. */
43
+ function endedCell(ended) {
44
+ const line = {
45
+ id: "goal-ended",
46
+ title: `${ended.outcome === "achieved" ? "Goal achieved" : "Goal cleared"} · ${summary(ended.objective)}`,
47
+ tone: ended.outcome === "achieved" ? "settled" : "muted",
48
+ };
49
+ // An achieved goal keeps the model's evidence as the line's detail.
50
+ const row = ended.reason === null ? line : { ...line, detail: ended.reason };
51
+ return {
52
+ id: String(ended.sequence),
53
+ sequence: ended.sequence,
54
+ at: ended.endedAt,
55
+ commandId: null,
56
+ afterSequence: ended.afterSequence,
57
+ rows: [row],
58
+ };
59
+ }
60
+ /**
61
+ * Product copy and controls belong to Goal; every host renders plain rows.
62
+ * The footer shows only a live or paused goal; finished goals are chat lines.
63
+ */
11
64
  export default defineClientEntry(goalContract, {
12
- correlatedPrompts: "note",
65
+ promptPresentation: "footer",
13
66
  contribute: (view) => {
14
67
  if (view.status !== "running" || view.value === null)
15
68
  return {
@@ -18,70 +71,11 @@ export default defineClientEntry(goalContract, {
18
71
  timeline: { cells: [], omitted: 0 },
19
72
  waiting: null,
20
73
  };
21
- const { goal, history } = view.value;
22
- const panel = [];
23
- if (goal !== null) {
24
- const row = {
25
- id: "goal",
26
- title: goal.objective,
27
- detail: `Goal · ${goal.state}`,
28
- tone: tone(goal),
29
- };
30
- panel.push(goal.state === "active" || goal.state === "paused"
31
- ? {
32
- ...row,
33
- actions: [
34
- {
35
- id: "goal",
36
- label: goal.state === "active" ? "Pause goal" : "Resume goal",
37
- input: {
38
- action: goal.state === "active" ? "pause" : "resume",
39
- },
40
- },
41
- ],
42
- }
43
- : row);
44
- if (goal.stopReason !== null)
45
- panel.push({
46
- id: "reason",
47
- title: goal.stopReason.slice(0, 4096),
48
- tone: "attention",
49
- });
50
- }
74
+ const { goal, ended, omitted } = view.value;
51
75
  return {
52
- chips: goal === null
53
- ? []
54
- : [
55
- {
56
- id: "goal",
57
- order: 1,
58
- row: {
59
- id: "goal",
60
- title: `Goal ${goal.state}${goal.stopReason?.startsWith("Stalled:") ? ": stalled" : ""}`,
61
- tone: tone(goal),
62
- },
63
- },
64
- ],
65
- panel,
66
- timeline: {
67
- omitted: history.omitted,
68
- cells: history.events.map(({ event, ...cell }) => ({
69
- ...cell,
70
- rows: [
71
- { id: "state", title: `Goal ${event.state}`, tone: tone(event) },
72
- { id: "objective", title: event.objective },
73
- ...(event.stopReason === null
74
- ? []
75
- : [
76
- {
77
- id: "reason",
78
- title: event.stopReason.slice(0, 4096),
79
- tone: tone(event),
80
- },
81
- ]),
82
- ],
83
- })),
84
- },
76
+ chips: [],
77
+ panel: goal === null ? [] : [currentRow(goal)],
78
+ timeline: { cells: ended.map(endedCell), omitted },
85
79
  waiting: null,
86
80
  };
87
81
  },
@@ -1,172 +1,289 @@
1
1
  import * as Schema from "effect/Schema";
2
2
  /**
3
3
  * Session goal: one durable objective per Session that Shiitake keeps
4
- * working toward until the model reports it complete or blocked. Shared by
5
- * the server extension and every client; its schemas are the one decoder.
4
+ * working toward until the model reports it achieved or a person clears it.
5
+ * Only a live or paused goal is current; a finished goal is history. Shared
6
+ * by the server extension and every client; its schemas are the one decoder.
6
7
  */
7
8
  /** A goal objective: stored exactly as sent, never blank. */
8
9
  export declare const Objective: Schema.String;
10
+ /** Nonblank explanation recorded when a goal is achieved. */
9
11
  export declare const GoalReason: Schema.String;
10
- /** The committed goal every client sees; provisional terminals stay private. */
12
+ /** Why work paused, independent of the words shown to a person. */
13
+ export declare const GoalPauseCause: Schema.Struct<{
14
+ /** Typed origin of the pause. */
15
+ readonly kind: Schema.Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>;
16
+ /** Additional explanation, or null when no detail was supplied. */
17
+ readonly detail: Schema.NullOr<Schema.String>;
18
+ }>;
19
+ /** Typed pause cause and optional explanation. */
20
+ export type GoalPauseCause = Schema.Schema.Type<typeof GoalPauseCause>;
21
+ /** The current goal every client sees; provisional terminals stay private. */
11
22
  export declare const Goal: Schema.Struct<{
12
23
  /** Owner-issued revision that guards an explicit replacement. */
13
24
  readonly revision: Schema.String;
25
+ /** Objective being pursued by this Session. */
14
26
  readonly objective: Schema.String;
15
- readonly state: Schema.Literals<readonly ["active", "paused", "complete", "blocked"]>;
16
- /** Why continuation stopped (for example failed work); a resume retries. */
17
- readonly stopReason: Schema.NullOr<Schema.String>;
27
+ /** Live, or paused until a person resumes it (a blocked goal is paused). */
28
+ readonly state: Schema.Literals<readonly ["active", "paused"]>;
29
+ /** When this goal was set, in epoch milliseconds. */
30
+ readonly startedAt: Schema.Int;
31
+ /** A typed cause while paused; null while active. */
32
+ readonly pauseCause: Schema.NullOr<Schema.Struct<{
33
+ /** Typed origin of the pause. */
34
+ readonly kind: Schema.Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>;
35
+ /** Additional explanation, or null when no detail was supplied. */
36
+ readonly detail: Schema.NullOr<Schema.String>;
37
+ }>>;
18
38
  }>;
19
- /** The committed goal every client sees. */
39
+ /** The current goal every client sees. */
20
40
  export type Goal = Schema.Schema.Type<typeof Goal>;
41
+ /** One finished goal: history only, never current. */
42
+ export declare const EndedGoal: Schema.Struct<{
43
+ /** Per-Session order of endings, starting at 1. */
44
+ readonly sequence: Schema.Int;
45
+ /** Objective that finished or was cleared. */
46
+ readonly objective: Schema.String;
47
+ /** Whether the model achieved the goal or a person cleared it. */
48
+ readonly outcome: Schema.Literals<readonly ["achieved", "cleared"]>;
49
+ /** The model's evidence for an achieved goal; null when cleared. */
50
+ readonly reason: Schema.NullOr<Schema.String>;
51
+ /** Completion time in epoch milliseconds. */
52
+ readonly endedAt: Schema.Int;
53
+ /** Committed Session position when this goal ended; zero before any entry. */
54
+ readonly afterSequence: Schema.Int;
55
+ }>;
56
+ /** One finished goal. */
57
+ export type EndedGoal = Schema.Schema.Type<typeof EndedGoal>;
58
+ /** How many finished goals a Session keeps for its chat lines. */
59
+ export declare const endedGoalLimit = 16;
21
60
  /**
22
61
  * Arguments of the human `/goal` command. A bare call opens the controls; each
23
62
  * reply is a catalog step, so the conversation stays on the server.
24
63
  */
25
64
  export declare const GoalCommandInput: Schema.Union<readonly [Schema.Struct<{
65
+ /** Select the explicit goal-setting action. */
26
66
  readonly action: Schema.Literal<"set">;
67
+ /** New objective supplied by the person. */
27
68
  readonly objective: Schema.String;
69
+ /** Idempotency key for setting this objective. */
28
70
  readonly requestId: Schema.String;
29
71
  /** The revision the human confirmed replacing, when they confirmed one. */
30
72
  readonly expectedRevision: Schema.optional<Schema.NullOr<Schema.String>>;
31
73
  /** The human's answer to "replace the current goal?". */
32
74
  readonly confirmed: Schema.optional<Schema.Boolean>;
33
75
  }>, Schema.Struct<{
76
+ /** Select an existing-goal control. */
34
77
  readonly action: Schema.Literals<readonly ["pause", "resume", "replace", "clear"]>;
35
78
  }>, Schema.Struct<{}>]>;
36
79
  /** Goal's contract: Session-scope human controls and one projection slot. */
37
80
  export declare const GoalProjection: Schema.Struct<{
81
+ /** The live or paused goal, or null when none is current. */
38
82
  readonly goal: Schema.NullOr<Schema.Struct<{
39
83
  /** Owner-issued revision that guards an explicit replacement. */
40
84
  readonly revision: Schema.String;
85
+ /** Objective being pursued by this Session. */
41
86
  readonly objective: Schema.String;
42
- readonly state: Schema.Literals<readonly ["active", "paused", "complete", "blocked"]>;
43
- /** Why continuation stopped (for example failed work); a resume retries. */
44
- readonly stopReason: Schema.NullOr<Schema.String>;
45
- }>>;
46
- readonly history: Schema.Struct<{
47
- readonly nextSequence: Schema.Int;
48
- readonly omitted: Schema.Int;
49
- readonly events: Schema.$Array<Schema.Struct<{
50
- readonly id: Schema.String;
51
- readonly sequence: Schema.Int;
52
- readonly at: Schema.Int;
53
- readonly commandId: Schema.NullOr<Schema.String>;
54
- readonly event: Schema.Codec<{
55
- readonly revision: string;
56
- readonly objective: string;
57
- readonly state: "active" | "paused" | "complete" | "blocked";
58
- readonly stopReason: string | null;
59
- }, {
60
- readonly revision: string;
61
- readonly objective: string;
62
- readonly state: "active" | "paused" | "complete" | "blocked";
63
- readonly stopReason: string | null;
64
- }, never, never>;
87
+ /** Live, or paused until a person resumes it (a blocked goal is paused). */
88
+ readonly state: Schema.Literals<readonly ["active", "paused"]>;
89
+ /** When this goal was set, in epoch milliseconds. */
90
+ readonly startedAt: Schema.Int;
91
+ /** A typed cause while paused; null while active. */
92
+ readonly pauseCause: Schema.NullOr<Schema.Struct<{
93
+ /** Typed origin of the pause. */
94
+ readonly kind: Schema.Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>;
95
+ /** Additional explanation, or null when no detail was supplied. */
96
+ readonly detail: Schema.NullOr<Schema.String>;
65
97
  }>>;
66
- }>;
98
+ }>>;
99
+ /** The newest finished goals, oldest first. */
100
+ readonly ended: Schema.$Array<Schema.Struct<{
101
+ /** Per-Session order of endings, starting at 1. */
102
+ readonly sequence: Schema.Int;
103
+ /** Objective that finished or was cleared. */
104
+ readonly objective: Schema.String;
105
+ /** Whether the model achieved the goal or a person cleared it. */
106
+ readonly outcome: Schema.Literals<readonly ["achieved", "cleared"]>;
107
+ /** The model's evidence for an achieved goal; null when cleared. */
108
+ readonly reason: Schema.NullOr<Schema.String>;
109
+ /** Completion time in epoch milliseconds. */
110
+ readonly endedAt: Schema.Int;
111
+ /** Committed Session position when this goal ended; zero before any entry. */
112
+ readonly afterSequence: Schema.Int;
113
+ }>>;
114
+ /** Finished goals older than `ended` that this Session no longer keeps. */
115
+ readonly omitted: Schema.Int;
67
116
  }>;
117
+ /** Session-owned goal controls and their visible projection. */
68
118
  export declare const goalContract: {
119
+ /** Stable extension identity. */
69
120
  readonly id: string & import("effect/Brand").Brand<"ExtensionId">;
121
+ /** Goal commands admitted by the Session owner. */
70
122
  readonly commands: {
123
+ /** Open or answer the human goal controls. */
71
124
  readonly goal: {
125
+ /** The Session owns this goal. */
72
126
  readonly scope: "session";
127
+ /** Decode the control action. */
73
128
  readonly input: Schema.Union<readonly [Schema.Struct<{
129
+ /** Select the explicit goal-setting action. */
74
130
  readonly action: Schema.Literal<"set">;
131
+ /** New objective supplied by the person. */
75
132
  readonly objective: Schema.String;
133
+ /** Idempotency key for setting this objective. */
76
134
  readonly requestId: Schema.String;
77
135
  /** The revision the human confirmed replacing, when they confirmed one. */
78
136
  readonly expectedRevision: Schema.optional<Schema.NullOr<Schema.String>>;
79
137
  /** The human's answer to "replace the current goal?". */
80
138
  readonly confirmed: Schema.optional<Schema.Boolean>;
81
139
  }>, Schema.Struct<{
140
+ /** Select an existing-goal control. */
82
141
  readonly action: Schema.Literals<readonly ["pause", "resume", "replace", "clear"]>;
83
142
  }>, Schema.Struct<{}>]>;
143
+ /** Return the server-owned conversation step. */
84
144
  readonly output: Schema.declare<import("@fungi.computer/whistle/catalog").WhistleCatalogStepV1, import("@fungi.computer/whistle/catalog").WhistleCatalogStepV1>;
85
145
  };
146
+ /** Pause work on the current goal. */
86
147
  readonly pause: {
148
+ /** The Session owns this goal. */
87
149
  readonly scope: "session";
150
+ /** No additional arguments are required. */
88
151
  readonly input: Schema.Struct<{}>;
152
+ /** Return the paused goal. */
89
153
  readonly output: Schema.Struct<{
90
154
  /** Owner-issued revision that guards an explicit replacement. */
91
155
  readonly revision: Schema.String;
156
+ /** Objective being pursued by this Session. */
92
157
  readonly objective: Schema.String;
93
- readonly state: Schema.Literals<readonly ["active", "paused", "complete", "blocked"]>;
94
- /** Why continuation stopped (for example failed work); a resume retries. */
95
- readonly stopReason: Schema.NullOr<Schema.String>;
158
+ /** Live, or paused until a person resumes it (a blocked goal is paused). */
159
+ readonly state: Schema.Literals<readonly ["active", "paused"]>;
160
+ /** When this goal was set, in epoch milliseconds. */
161
+ readonly startedAt: Schema.Int;
162
+ /** A typed cause while paused; null while active. */
163
+ readonly pauseCause: Schema.NullOr<Schema.Struct<{
164
+ /** Typed origin of the pause. */
165
+ readonly kind: Schema.Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>;
166
+ /** Additional explanation, or null when no detail was supplied. */
167
+ readonly detail: Schema.NullOr<Schema.String>;
168
+ }>>;
96
169
  }>;
97
170
  };
171
+ /** Resume work on a paused goal. */
98
172
  readonly resume: {
173
+ /** The Session owns this goal. */
99
174
  readonly scope: "session";
175
+ /** No additional arguments are required. */
100
176
  readonly input: Schema.Struct<{}>;
177
+ /** Return the active goal. */
101
178
  readonly output: Schema.Struct<{
102
179
  /** Owner-issued revision that guards an explicit replacement. */
103
180
  readonly revision: Schema.String;
181
+ /** Objective being pursued by this Session. */
104
182
  readonly objective: Schema.String;
105
- readonly state: Schema.Literals<readonly ["active", "paused", "complete", "blocked"]>;
106
- /** Why continuation stopped (for example failed work); a resume retries. */
107
- readonly stopReason: Schema.NullOr<Schema.String>;
183
+ /** Live, or paused until a person resumes it (a blocked goal is paused). */
184
+ readonly state: Schema.Literals<readonly ["active", "paused"]>;
185
+ /** When this goal was set, in epoch milliseconds. */
186
+ readonly startedAt: Schema.Int;
187
+ /** A typed cause while paused; null while active. */
188
+ readonly pauseCause: Schema.NullOr<Schema.Struct<{
189
+ /** Typed origin of the pause. */
190
+ readonly kind: Schema.Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>;
191
+ /** Additional explanation, or null when no detail was supplied. */
192
+ readonly detail: Schema.NullOr<Schema.String>;
193
+ }>>;
108
194
  }>;
109
195
  };
196
+ /** Clear the current objective. */
110
197
  readonly clear: {
198
+ /** The Session owns this goal. */
111
199
  readonly scope: "session";
200
+ /** No additional arguments are required. */
112
201
  readonly input: Schema.Struct<{}>;
202
+ /** A successful clear has no result fields. */
113
203
  readonly output: Schema.Struct<{}>;
114
204
  };
205
+ /** Set an objective against the revision the person saw. */
115
206
  readonly set: {
207
+ /** The Session owns this goal. */
116
208
  readonly scope: "session";
209
+ /** Decode the new objective and replacement fence. */
117
210
  readonly input: Schema.Struct<{
211
+ /** New objective to pursue. */
118
212
  readonly objective: Schema.String;
119
213
  /** The revision the user saw, or null when they saw no goal. */
120
214
  readonly expectedRevision: Schema.NullOr<Schema.String>;
215
+ /** Idempotency key for this setting command. */
121
216
  readonly requestId: Schema.String;
122
217
  }>;
218
+ /** Return the goal and its admission receipt. */
123
219
  readonly output: Schema.Struct<{
220
+ /** Newly current goal. */
124
221
  readonly goal: Schema.Struct<{
125
222
  /** Owner-issued revision that guards an explicit replacement. */
126
223
  readonly revision: Schema.String;
224
+ /** Objective being pursued by this Session. */
127
225
  readonly objective: Schema.String;
128
- readonly state: Schema.Literals<readonly ["active", "paused", "complete", "blocked"]>;
129
- /** Why continuation stopped (for example failed work); a resume retries. */
130
- readonly stopReason: Schema.NullOr<Schema.String>;
226
+ /** Live, or paused until a person resumes it (a blocked goal is paused). */
227
+ readonly state: Schema.Literals<readonly ["active", "paused"]>;
228
+ /** When this goal was set, in epoch milliseconds. */
229
+ readonly startedAt: Schema.Int;
230
+ /** A typed cause while paused; null while active. */
231
+ readonly pauseCause: Schema.NullOr<Schema.Struct<{
232
+ /** Typed origin of the pause. */
233
+ readonly kind: Schema.Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>;
234
+ /** Additional explanation, or null when no detail was supplied. */
235
+ readonly detail: Schema.NullOr<Schema.String>;
236
+ }>>;
131
237
  }>;
238
+ /** Receipt for the accepted setting command. */
132
239
  readonly accepted: Schema.Struct<{
240
+ /** Successful admission discriminator. */
133
241
  readonly status: Schema.Literal<"accepted">;
242
+ /** Identity of the admitted command. */
134
243
  readonly commandId: Schema.String;
135
244
  }>;
136
245
  }>;
137
246
  };
138
247
  };
248
+ /** Current and ended goals visible to clients. */
139
249
  readonly projection: {
250
+ /** Decoder for the goal projection. */
140
251
  readonly schema: Schema.Struct<{
252
+ /** The live or paused goal, or null when none is current. */
141
253
  readonly goal: Schema.NullOr<Schema.Struct<{
142
254
  /** Owner-issued revision that guards an explicit replacement. */
143
255
  readonly revision: Schema.String;
256
+ /** Objective being pursued by this Session. */
144
257
  readonly objective: Schema.String;
145
- readonly state: Schema.Literals<readonly ["active", "paused", "complete", "blocked"]>;
146
- /** Why continuation stopped (for example failed work); a resume retries. */
147
- readonly stopReason: Schema.NullOr<Schema.String>;
148
- }>>;
149
- readonly history: Schema.Struct<{
150
- readonly nextSequence: Schema.Int;
151
- readonly omitted: Schema.Int;
152
- readonly events: Schema.$Array<Schema.Struct<{
153
- readonly id: Schema.String;
154
- readonly sequence: Schema.Int;
155
- readonly at: Schema.Int;
156
- readonly commandId: Schema.NullOr<Schema.String>;
157
- readonly event: Schema.Codec<{
158
- readonly revision: string;
159
- readonly objective: string;
160
- readonly state: "active" | "paused" | "complete" | "blocked";
161
- readonly stopReason: string | null;
162
- }, {
163
- readonly revision: string;
164
- readonly objective: string;
165
- readonly state: "active" | "paused" | "complete" | "blocked";
166
- readonly stopReason: string | null;
167
- }, never, never>;
258
+ /** Live, or paused until a person resumes it (a blocked goal is paused). */
259
+ readonly state: Schema.Literals<readonly ["active", "paused"]>;
260
+ /** When this goal was set, in epoch milliseconds. */
261
+ readonly startedAt: Schema.Int;
262
+ /** A typed cause while paused; null while active. */
263
+ readonly pauseCause: Schema.NullOr<Schema.Struct<{
264
+ /** Typed origin of the pause. */
265
+ readonly kind: Schema.Literals<readonly ["person", "blocked", "stalled", "cancelled", "failed", "no-terminal"]>;
266
+ /** Additional explanation, or null when no detail was supplied. */
267
+ readonly detail: Schema.NullOr<Schema.String>;
168
268
  }>>;
169
- }>;
269
+ }>>;
270
+ /** The newest finished goals, oldest first. */
271
+ readonly ended: Schema.$Array<Schema.Struct<{
272
+ /** Per-Session order of endings, starting at 1. */
273
+ readonly sequence: Schema.Int;
274
+ /** Objective that finished or was cleared. */
275
+ readonly objective: Schema.String;
276
+ /** Whether the model achieved the goal or a person cleared it. */
277
+ readonly outcome: Schema.Literals<readonly ["achieved", "cleared"]>;
278
+ /** The model's evidence for an achieved goal; null when cleared. */
279
+ readonly reason: Schema.NullOr<Schema.String>;
280
+ /** Completion time in epoch milliseconds. */
281
+ readonly endedAt: Schema.Int;
282
+ /** Committed Session position when this goal ended; zero before any entry. */
283
+ readonly afterSequence: Schema.Int;
284
+ }>>;
285
+ /** Finished goals older than `ended` that this Session no longer keeps. */
286
+ readonly omitted: Schema.Int;
170
287
  }>;
171
288
  };
172
289
  };