@fungi.computer/shiitake-extensions 0.0.2 → 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
@@ -36,36 +36,15 @@ export function homeFilesRouting(connections, home) {
36
36
  },
37
37
  list: async (input, context) => {
38
38
  const { port, path, locate } = resolve(input.path);
39
- const result = await port.list({ ...input, path }, context);
40
- return {
41
- ...result,
42
- path: input.path,
43
- entries: result.entries.map((entry) => ({
44
- ...entry,
45
- path: locate(entry.path),
46
- })),
47
- };
39
+ return locateSearch(await port.list({ ...input, path }, context), input.path, locate);
48
40
  },
49
41
  glob: async (input, context) => {
50
42
  const { port, path, locate } = resolve(input.path);
51
- const result = await port.glob({ ...input, path }, context);
52
- return {
53
- ...result,
54
- path: input.path,
55
- matches: result.matches.map(locate),
56
- };
43
+ return locateSearch(await port.glob({ ...input, path }, context), input.path, locate);
57
44
  },
58
45
  grep: async (input, context) => {
59
46
  const { port, path, locate } = resolve(input.path);
60
- const result = await port.grep({ ...input, path }, context);
61
- return {
62
- ...result,
63
- path: input.path,
64
- matches: result.matches.map((match) => ({
65
- ...match,
66
- path: locate(match.path),
67
- })),
68
- };
47
+ return locateSearch(await port.grep({ ...input, path }, context), input.path, locate);
69
48
  },
70
49
  replace: async (input, context) => {
71
50
  const { port, path } = resolve(input.path);
@@ -78,3 +57,13 @@ export function homeFilesRouting(connections, home) {
78
57
  const patch = home.patch?.bind(home);
79
58
  return patch === undefined ? routing : { ...routing, patch };
80
59
  }
60
+ function locateSearch(result, path, locate) {
61
+ return {
62
+ ...result,
63
+ path,
64
+ results: result.results.map((found) => ({
65
+ ...found,
66
+ path: locate(found.path),
67
+ })),
68
+ };
69
+ }
@@ -1,25 +1,41 @@
1
1
  import * as Schema from "effect/Schema";
2
2
  /** Producer state: committed event identity survives reconnection and trimming. */
3
3
  export declare function historySchema<E, EI>(event: Schema.Codec<E, EI>): Schema.Struct<{
4
+ /** Sequence to assign to the next committed event. */
4
5
  readonly nextSequence: Schema.Int;
6
+ /** Number of older events removed by retention. */
5
7
  readonly omitted: Schema.Int;
8
+ /** Retained committed events in sequence order. */
6
9
  readonly events: Schema.$Array<Schema.Struct<{
10
+ /** Stable event identity within this producer's history. */
7
11
  readonly id: Schema.String;
12
+ /** Producer-assigned event order. */
8
13
  readonly sequence: Schema.Int;
14
+ /** Event timestamp supplied by the owner. */
9
15
  readonly at: Schema.Int;
16
+ /** Associated accepted command, or null when none applies. */
10
17
  readonly commandId: Schema.NullOr<Schema.String>;
18
+ /** Extension-specific event payload. */
11
19
  readonly event: Schema.Codec<E, EI, never, never>;
12
20
  }>>;
13
21
  }>;
14
22
  /** The extension's own persisted history, not a core cursor. */
15
23
  export type History<E> = Readonly<{
24
+ /** Sequence to assign to the next committed event. */
16
25
  nextSequence: number;
26
+ /** Number of older events removed by retention. */
17
27
  omitted: number;
28
+ /** Retained committed events in sequence order. */
18
29
  events: readonly Readonly<{
30
+ /** Stable event identity within this producer's history. */
19
31
  id: string;
32
+ /** Producer-assigned event order. */
20
33
  sequence: number;
34
+ /** Event timestamp supplied by the owner. */
21
35
  at: number;
36
+ /** Associated accepted command, or null when none applies. */
22
37
  commandId: string | null;
38
+ /** Extension-specific event payload. */
23
39
  event: E;
24
40
  }>[];
25
41
  }>;
@@ -2,13 +2,21 @@ import * as Schema from "effect/Schema";
2
2
  /** Producer state: committed event identity survives reconnection and trimming. */
3
3
  export function historySchema(event) {
4
4
  return Schema.Struct({
5
+ /** Sequence to assign to the next committed event. */
5
6
  nextSequence: Schema.Int.check(Schema.isGreaterThan(0)),
7
+ /** Number of older events removed by retention. */
6
8
  omitted: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
9
+ /** Retained committed events in sequence order. */
7
10
  events: Schema.Array(Schema.Struct({
11
+ /** Stable event identity within this producer's history. */
8
12
  id: Schema.String,
13
+ /** Producer-assigned event order. */
9
14
  sequence: Schema.Int,
15
+ /** Event timestamp supplied by the owner. */
10
16
  at: Schema.Int,
17
+ /** Associated accepted command, or null when none applies. */
11
18
  commandId: Schema.NullOr(Schema.String),
19
+ /** Extension-specific event payload. */
12
20
  event,
13
21
  })),
14
22
  });
@@ -3,7 +3,7 @@ import { type ClientContributionV1 } from "@fungi.computer/shiitake/client-entry
3
3
  declare const _default: Readonly<{
4
4
  protocol: "shiitake.client/v1";
5
5
  id: import("@fungi.computer/shiitake/extensions").ExtensionId;
6
- correlatedPrompts?: "note";
6
+ promptPresentation?: "footer";
7
7
  attach?: (context: import("@fungi.computer/shiitake/client-entry").ClientExtensionContextV1) => import("effect/Effect").Effect<void, Error, import("effect/Scope").Scope>;
8
8
  contribute?: (slot: import("@fungi.computer/shiitake").ExtensionSlotV0 | undefined) => ClientContributionV1;
9
9
  }>;
@@ -1,5 +1,10 @@
1
1
  import { defineClientEntry, } from "@fungi.computer/shiitake/client-entry";
2
2
  import { loopContract } from "./contract.js";
3
+ /** One footer line: the full prompt stays in the row's detail. */
4
+ const summary = (text) => {
5
+ const line = text.replace(/\s+/gu, " ").trim();
6
+ return line.length <= 60 ? line : `${line.slice(0, 59)}…`;
7
+ };
3
8
  const tone = (loop) => loop.state === "failed"
4
9
  ? "error"
5
10
  : loop.state === "active"
@@ -17,6 +22,7 @@ const due = (at) => new Intl.DateTimeFormat(undefined, {
17
22
  }).format(at);
18
23
  /** Loop supplies its own absolute due copy and advertised stop intent. */
19
24
  export default defineClientEntry(loopContract, {
25
+ promptPresentation: "footer",
20
26
  contribute: (view) => {
21
27
  if (view.status !== "running" || view.value === null)
22
28
  return {
@@ -25,10 +31,10 @@ export default defineClientEntry(loopContract, {
25
31
  timeline: { cells: [], omitted: 0 },
26
32
  waiting: null,
27
33
  };
28
- const { loop, history } = view.value;
29
- const waiting = loop !== null && loop.state === "active" && loop.nextDueAt !== null;
34
+ const { loop } = view.value;
35
+ const waiting = loop.state === "active" && loop.nextDueAt !== null;
30
36
  return {
31
- chips: loop === null || (loop.state !== "active" && loop.state !== "paused")
37
+ chips: loop.state !== "active" && loop.state !== "paused"
32
38
  ? []
33
39
  : [
34
40
  {
@@ -41,39 +47,27 @@ export default defineClientEntry(loopContract, {
41
47
  },
42
48
  },
43
49
  ],
44
- panel: loop === null
45
- ? []
46
- : [
47
- {
48
- id: "loop",
49
- title: `Loop · ${loop.state} · ${loop.mode === "self_paced" ? "self-paced" : `${loop.cron?.expression ?? "fixed"} ${loop.cron?.timeZone ?? ""}`}${loop.nextDueAt === null ? "" : ` · Next ${due(loop.nextDueAt)}`}`,
50
- detail: loop.prompt.slice(0, 1024),
51
- tone: tone(loop),
52
- },
53
- ...(loop.lastError === null
54
- ? []
55
- : [
56
- {
57
- id: "error",
58
- title: loop.lastError.slice(0, 4096),
59
- tone: "error",
60
- },
61
- ]),
62
- ],
63
- timeline: {
64
- omitted: history.omitted,
65
- cells: history.events.map(({ event, ...cell }) => ({
66
- ...cell,
67
- rows: [
50
+ panel: [
51
+ {
52
+ id: "loop",
53
+ title: `Loop · ${loop.state} · ${loop.mode === "self_paced" ? "self-paced" : `${loop.cron?.expression ?? "fixed"} ${loop.cron?.timeZone ?? ""}`}${loop.nextDueAt === null ? "" : ` · Next ${due(loop.nextDueAt)}`} · ${summary(loop.prompt)}`,
54
+ detail: [loop.reason, loop.prompt]
55
+ .filter((part) => part !== null)
56
+ .join("\n")
57
+ .slice(0, 1024),
58
+ tone: tone(loop),
59
+ },
60
+ ...(loop.lastError === null
61
+ ? []
62
+ : [
68
63
  {
69
- id: "loop",
70
- title: `Loop ${event.state}`,
71
- detail: (event.lastError ?? event.reason ?? event.prompt).slice(0, 1024),
72
- tone: tone(event),
64
+ id: "error",
65
+ title: loop.lastError.slice(0, 4096),
66
+ tone: "error",
73
67
  },
74
- ],
75
- })),
76
- },
68
+ ]),
69
+ ],
70
+ timeline: { cells: [], omitted: 0 },
77
71
  waiting: waiting
78
72
  ? {
79
73
  summary: `Waiting until ${due(loop.nextDueAt)}`,
@@ -1,22 +1,31 @@
1
1
  import * as Schema from "effect/Schema";
2
2
  /** A named cron cadence evaluated in one IANA time zone. */
3
3
  export declare const LoopCron: Schema.Struct<{
4
+ /** Cron expression for the fixed cadence. */
4
5
  readonly expression: Schema.String;
6
+ /** IANA time zone in which the expression is evaluated. */
5
7
  readonly timeZone: Schema.String;
6
8
  }>;
7
9
  /** One Session's loop as every client sees it. */
8
10
  export declare const Loop: Schema.Struct<{
11
+ /** Identity of the loop whose occurrences are being tracked. */
9
12
  readonly loopId: Schema.String;
13
+ /** Whether a person or the model started this loop. */
10
14
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
15
+ /** Configured expiry timestamp, or null when absent. */
11
16
  readonly expiresAt: Schema.NullOr<Schema.Int>;
12
17
  /** Original instruction repeated for every occurrence. */
13
18
  readonly prompt: Schema.String;
19
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
14
20
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
15
21
  /** Cadence of a fixed-interval loop; null when the model paces it. */
16
22
  readonly cron: Schema.NullOr<Schema.Struct<{
23
+ /** Cron expression for the fixed cadence. */
17
24
  readonly expression: Schema.String;
25
+ /** IANA time zone in which the expression is evaluated. */
18
26
  readonly timeZone: Schema.String;
19
27
  }>>;
28
+ /** Current loop lifecycle state. */
20
29
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
21
30
  /** Latest accepted command associated with this loop. */
22
31
  readonly commandId: Schema.String;
@@ -35,26 +44,38 @@ export type Loop = Schema.Schema.Type<typeof Loop>;
35
44
  * interval. A bare call opens the controls.
36
45
  */
37
46
  export declare const LoopCommandInput: Schema.Union<readonly [Schema.Struct<{
47
+ /** Select the loop-starting control. */
38
48
  readonly action: Schema.Literal<"start">;
49
+ /** Human prompt text, optionally prefixed with an interval. */
39
50
  readonly text: Schema.String;
51
+ /** Idempotency key for this start command. */
40
52
  readonly requestId: Schema.String;
41
53
  }>, Schema.Struct<{
54
+ /** Select an existing-loop control or open new-loop entry. */
42
55
  readonly action: Schema.Literals<readonly ["status", "pause", "resume", "stop", "new"]>;
43
56
  }>, Schema.Struct<{}>]>;
44
57
  /** Loop's contract: Session-scope controls and one projection slot. */
45
58
  export declare const LoopProjection: Schema.Struct<{
46
- readonly loop: Schema.NullOr<Schema.Struct<{
59
+ /** Loop currently visible to Session clients. */
60
+ readonly loop: Schema.Struct<{
61
+ /** Identity of the loop whose occurrences are being tracked. */
47
62
  readonly loopId: Schema.String;
63
+ /** Whether a person or the model started this loop. */
48
64
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
65
+ /** Configured expiry timestamp, or null when absent. */
49
66
  readonly expiresAt: Schema.NullOr<Schema.Int>;
50
67
  /** Original instruction repeated for every occurrence. */
51
68
  readonly prompt: Schema.String;
69
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
52
70
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
53
71
  /** Cadence of a fixed-interval loop; null when the model paces it. */
54
72
  readonly cron: Schema.NullOr<Schema.Struct<{
73
+ /** Cron expression for the fixed cadence. */
55
74
  readonly expression: Schema.String;
75
+ /** IANA time zone in which the expression is evaluated. */
56
76
  readonly timeZone: Schema.String;
57
77
  }>>;
78
+ /** Current loop lifecycle state. */
58
79
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
59
80
  /** Latest accepted command associated with this loop. */
60
81
  readonly commandId: Schema.String;
@@ -64,82 +85,66 @@ export declare const LoopProjection: Schema.Struct<{
64
85
  readonly nextDueAt: Schema.NullOr<Schema.Int>;
65
86
  /** Visible explanation when loop work failed. */
66
87
  readonly lastError: Schema.NullOr<Schema.String>;
67
- }>>;
68
- readonly history: Schema.Struct<{
69
- readonly nextSequence: Schema.Int;
70
- readonly omitted: Schema.Int;
71
- readonly events: Schema.$Array<Schema.Struct<{
72
- readonly id: Schema.String;
73
- readonly sequence: Schema.Int;
74
- readonly at: Schema.Int;
75
- readonly commandId: Schema.NullOr<Schema.String>;
76
- readonly event: Schema.Codec<{
77
- readonly loopId: string;
78
- readonly origin: "human" | "model";
79
- readonly expiresAt: number | null;
80
- readonly prompt: string;
81
- readonly mode: "self_paced" | "fixed_interval";
82
- readonly cron: {
83
- readonly expression: string;
84
- readonly timeZone: string;
85
- } | null;
86
- readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
87
- readonly commandId: string;
88
- readonly reason: string | null;
89
- readonly nextDueAt: number | null;
90
- readonly lastError: string | null;
91
- }, {
92
- readonly loopId: string;
93
- readonly origin: "human" | "model";
94
- readonly expiresAt: number | null;
95
- readonly prompt: string;
96
- readonly mode: "self_paced" | "fixed_interval";
97
- readonly cron: {
98
- readonly expression: string;
99
- readonly timeZone: string;
100
- } | null;
101
- readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
102
- readonly commandId: string;
103
- readonly reason: string | null;
104
- readonly nextDueAt: number | null;
105
- readonly lastError: string | null;
106
- }, never, never>;
107
- }>>;
108
88
  }>;
109
89
  }>;
90
+ /** Session-owned loop controls and their visible state. */
110
91
  export declare const loopContract: {
92
+ /** Stable extension identity. */
111
93
  readonly id: string & import("effect/Brand").Brand<"ExtensionId">;
94
+ /** Loop operations admitted by the Session owner. */
112
95
  readonly commands: {
96
+ /** Open or answer the human loop controls. */
113
97
  readonly loop: {
98
+ /** The Session owns this loop. */
114
99
  readonly scope: "session";
100
+ /** Decode the selected human action. */
115
101
  readonly input: Schema.Union<readonly [Schema.Struct<{
102
+ /** Select the loop-starting control. */
116
103
  readonly action: Schema.Literal<"start">;
104
+ /** Human prompt text, optionally prefixed with an interval. */
117
105
  readonly text: Schema.String;
106
+ /** Idempotency key for this start command. */
118
107
  readonly requestId: Schema.String;
119
108
  }>, Schema.Struct<{
109
+ /** Select an existing-loop control or open new-loop entry. */
120
110
  readonly action: Schema.Literals<readonly ["status", "pause", "resume", "stop", "new"]>;
121
111
  }>, Schema.Struct<{}>]>;
112
+ /** Return the server-owned conversation step. */
122
113
  readonly output: Schema.declare<import("@fungi.computer/whistle/catalog").WhistleCatalogStepV1, import("@fungi.computer/whistle/catalog").WhistleCatalogStepV1>;
123
114
  };
115
+ /** Start a loop whose next occurrence is chosen by the model. */
124
116
  readonly startSelfPaced: {
117
+ /** The Session owns this loop. */
125
118
  readonly scope: "session";
119
+ /** Decode the repeated prompt and command identity. */
126
120
  readonly input: Schema.Struct<{
121
+ /** Instruction repeated on every occurrence. */
127
122
  readonly prompt: Schema.String;
123
+ /** Idempotency key for the start command. */
128
124
  readonly requestId: Schema.String;
129
125
  }>;
126
+ /** Return the loop and admission receipt. */
130
127
  readonly output: Schema.Struct<{
128
+ /** Newly started loop. */
131
129
  readonly loop: Schema.Struct<{
130
+ /** Identity of the loop whose occurrences are being tracked. */
132
131
  readonly loopId: Schema.String;
132
+ /** Whether a person or the model started this loop. */
133
133
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
134
+ /** Configured expiry timestamp, or null when absent. */
134
135
  readonly expiresAt: Schema.NullOr<Schema.Int>;
135
136
  /** Original instruction repeated for every occurrence. */
136
137
  readonly prompt: Schema.String;
138
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
137
139
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
138
140
  /** Cadence of a fixed-interval loop; null when the model paces it. */
139
141
  readonly cron: Schema.NullOr<Schema.Struct<{
142
+ /** Cron expression for the fixed cadence. */
140
143
  readonly expression: Schema.String;
144
+ /** IANA time zone in which the expression is evaluated. */
141
145
  readonly timeZone: Schema.String;
142
146
  }>>;
147
+ /** Current loop lifecycle state. */
143
148
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
144
149
  /** Latest accepted command associated with this loop. */
145
150
  readonly commandId: Schema.String;
@@ -150,33 +155,52 @@ export declare const loopContract: {
150
155
  /** Visible explanation when loop work failed. */
151
156
  readonly lastError: Schema.NullOr<Schema.String>;
152
157
  }>;
158
+ /** Admission receipt for the start command. */
153
159
  readonly accepted: Schema.Struct<{
160
+ /** Successful admission discriminator. */
154
161
  readonly status: Schema.Literal<"accepted">;
162
+ /** Identity of the accepted start command. */
155
163
  readonly commandId: Schema.String;
156
164
  }>;
157
165
  }>;
158
166
  };
167
+ /** Start a loop with a fixed cron cadence. */
159
168
  readonly startFixedInterval: {
169
+ /** The Session owns this loop. */
160
170
  readonly scope: "session";
171
+ /** Decode the prompt, cadence and command identity. */
161
172
  readonly input: Schema.Struct<{
173
+ /** Cron expression for the fixed cadence. */
162
174
  readonly expression: Schema.String;
175
+ /** IANA time zone in which the expression is evaluated. */
163
176
  readonly timeZone: Schema.String;
177
+ /** Instruction repeated on every occurrence. */
164
178
  readonly prompt: Schema.String;
179
+ /** Idempotency key for the start command. */
165
180
  readonly requestId: Schema.String;
166
181
  }>;
182
+ /** Return the loop and admission receipt. */
167
183
  readonly output: Schema.Struct<{
184
+ /** Newly started loop. */
168
185
  readonly loop: Schema.Struct<{
186
+ /** Identity of the loop whose occurrences are being tracked. */
169
187
  readonly loopId: Schema.String;
188
+ /** Whether a person or the model started this loop. */
170
189
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
190
+ /** Configured expiry timestamp, or null when absent. */
171
191
  readonly expiresAt: Schema.NullOr<Schema.Int>;
172
192
  /** Original instruction repeated for every occurrence. */
173
193
  readonly prompt: Schema.String;
194
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
174
195
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
175
196
  /** Cadence of a fixed-interval loop; null when the model paces it. */
176
197
  readonly cron: Schema.NullOr<Schema.Struct<{
198
+ /** Cron expression for the fixed cadence. */
177
199
  readonly expression: Schema.String;
200
+ /** IANA time zone in which the expression is evaluated. */
178
201
  readonly timeZone: Schema.String;
179
202
  }>>;
203
+ /** Current loop lifecycle state. */
180
204
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
181
205
  /** Latest accepted command associated with this loop. */
182
206
  readonly commandId: Schema.String;
@@ -187,27 +211,41 @@ export declare const loopContract: {
187
211
  /** Visible explanation when loop work failed. */
188
212
  readonly lastError: Schema.NullOr<Schema.String>;
189
213
  }>;
214
+ /** Admission receipt for the start command. */
190
215
  readonly accepted: Schema.Struct<{
216
+ /** Successful admission discriminator. */
191
217
  readonly status: Schema.Literal<"accepted">;
218
+ /** Identity of the accepted start command. */
192
219
  readonly commandId: Schema.String;
193
220
  }>;
194
221
  }>;
195
222
  };
223
+ /** Suspend the current loop. */
196
224
  readonly pause: {
225
+ /** The Session owns this loop. */
197
226
  readonly scope: "session";
227
+ /** No additional arguments are required. */
198
228
  readonly input: Schema.Struct<{}>;
229
+ /** Return the paused loop. */
199
230
  readonly output: Schema.Struct<{
231
+ /** Identity of the loop whose occurrences are being tracked. */
200
232
  readonly loopId: Schema.String;
233
+ /** Whether a person or the model started this loop. */
201
234
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
235
+ /** Configured expiry timestamp, or null when absent. */
202
236
  readonly expiresAt: Schema.NullOr<Schema.Int>;
203
237
  /** Original instruction repeated for every occurrence. */
204
238
  readonly prompt: Schema.String;
239
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
205
240
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
206
241
  /** Cadence of a fixed-interval loop; null when the model paces it. */
207
242
  readonly cron: Schema.NullOr<Schema.Struct<{
243
+ /** Cron expression for the fixed cadence. */
208
244
  readonly expression: Schema.String;
245
+ /** IANA time zone in which the expression is evaluated. */
209
246
  readonly timeZone: Schema.String;
210
247
  }>>;
248
+ /** Current loop lifecycle state. */
211
249
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
212
250
  /** Latest accepted command associated with this loop. */
213
251
  readonly commandId: Schema.String;
@@ -219,21 +257,32 @@ export declare const loopContract: {
219
257
  readonly lastError: Schema.NullOr<Schema.String>;
220
258
  }>;
221
259
  };
260
+ /** Resume the current paused loop. */
222
261
  readonly resume: {
262
+ /** The Session owns this loop. */
223
263
  readonly scope: "session";
264
+ /** No additional arguments are required. */
224
265
  readonly input: Schema.Struct<{}>;
266
+ /** Return the resumed loop. */
225
267
  readonly output: Schema.Struct<{
268
+ /** Identity of the loop whose occurrences are being tracked. */
226
269
  readonly loopId: Schema.String;
270
+ /** Whether a person or the model started this loop. */
227
271
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
272
+ /** Configured expiry timestamp, or null when absent. */
228
273
  readonly expiresAt: Schema.NullOr<Schema.Int>;
229
274
  /** Original instruction repeated for every occurrence. */
230
275
  readonly prompt: Schema.String;
276
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
231
277
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
232
278
  /** Cadence of a fixed-interval loop; null when the model paces it. */
233
279
  readonly cron: Schema.NullOr<Schema.Struct<{
280
+ /** Cron expression for the fixed cadence. */
234
281
  readonly expression: Schema.String;
282
+ /** IANA time zone in which the expression is evaluated. */
235
283
  readonly timeZone: Schema.String;
236
284
  }>>;
285
+ /** Current loop lifecycle state. */
237
286
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
238
287
  /** Latest accepted command associated with this loop. */
239
288
  readonly commandId: Schema.String;
@@ -245,21 +294,32 @@ export declare const loopContract: {
245
294
  readonly lastError: Schema.NullOr<Schema.String>;
246
295
  }>;
247
296
  };
297
+ /** Stop future occurrences of the current loop. */
248
298
  readonly stop: {
299
+ /** The Session owns this loop. */
249
300
  readonly scope: "session";
301
+ /** No additional arguments are required. */
250
302
  readonly input: Schema.Struct<{}>;
303
+ /** Return the stopped loop. */
251
304
  readonly output: Schema.Struct<{
305
+ /** Identity of the loop whose occurrences are being tracked. */
252
306
  readonly loopId: Schema.String;
307
+ /** Whether a person or the model started this loop. */
253
308
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
309
+ /** Configured expiry timestamp, or null when absent. */
254
310
  readonly expiresAt: Schema.NullOr<Schema.Int>;
255
311
  /** Original instruction repeated for every occurrence. */
256
312
  readonly prompt: Schema.String;
313
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
257
314
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
258
315
  /** Cadence of a fixed-interval loop; null when the model paces it. */
259
316
  readonly cron: Schema.NullOr<Schema.Struct<{
317
+ /** Cron expression for the fixed cadence. */
260
318
  readonly expression: Schema.String;
319
+ /** IANA time zone in which the expression is evaluated. */
261
320
  readonly timeZone: Schema.String;
262
321
  }>>;
322
+ /** Current loop lifecycle state. */
263
323
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
264
324
  /** Latest accepted command associated with this loop. */
265
325
  readonly commandId: Schema.String;
@@ -272,20 +332,30 @@ export declare const loopContract: {
272
332
  }>;
273
333
  };
274
334
  };
335
+ /** Current loop visible to Session clients. */
275
336
  readonly projection: {
337
+ /** Decoder for projected loop state. */
276
338
  readonly schema: Schema.Struct<{
277
- readonly loop: Schema.NullOr<Schema.Struct<{
339
+ /** Loop currently visible to Session clients. */
340
+ readonly loop: Schema.Struct<{
341
+ /** Identity of the loop whose occurrences are being tracked. */
278
342
  readonly loopId: Schema.String;
343
+ /** Whether a person or the model started this loop. */
279
344
  readonly origin: Schema.Literals<readonly ["human", "model"]>;
345
+ /** Configured expiry timestamp, or null when absent. */
280
346
  readonly expiresAt: Schema.NullOr<Schema.Int>;
281
347
  /** Original instruction repeated for every occurrence. */
282
348
  readonly prompt: Schema.String;
349
+ /** Whether the model or a fixed cron cadence schedules occurrences. */
283
350
  readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
284
351
  /** Cadence of a fixed-interval loop; null when the model paces it. */
285
352
  readonly cron: Schema.NullOr<Schema.Struct<{
353
+ /** Cron expression for the fixed cadence. */
286
354
  readonly expression: Schema.String;
355
+ /** IANA time zone in which the expression is evaluated. */
287
356
  readonly timeZone: Schema.String;
288
357
  }>>;
358
+ /** Current loop lifecycle state. */
289
359
  readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
290
360
  /** Latest accepted command associated with this loop. */
291
361
  readonly commandId: Schema.String;
@@ -295,47 +365,6 @@ export declare const loopContract: {
295
365
  readonly nextDueAt: Schema.NullOr<Schema.Int>;
296
366
  /** Visible explanation when loop work failed. */
297
367
  readonly lastError: Schema.NullOr<Schema.String>;
298
- }>>;
299
- readonly history: Schema.Struct<{
300
- readonly nextSequence: Schema.Int;
301
- readonly omitted: Schema.Int;
302
- readonly events: Schema.$Array<Schema.Struct<{
303
- readonly id: Schema.String;
304
- readonly sequence: Schema.Int;
305
- readonly at: Schema.Int;
306
- readonly commandId: Schema.NullOr<Schema.String>;
307
- readonly event: Schema.Codec<{
308
- readonly loopId: string;
309
- readonly origin: "human" | "model";
310
- readonly expiresAt: number | null;
311
- readonly prompt: string;
312
- readonly mode: "self_paced" | "fixed_interval";
313
- readonly cron: {
314
- readonly expression: string;
315
- readonly timeZone: string;
316
- } | null;
317
- readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
318
- readonly commandId: string;
319
- readonly reason: string | null;
320
- readonly nextDueAt: number | null;
321
- readonly lastError: string | null;
322
- }, {
323
- readonly loopId: string;
324
- readonly origin: "human" | "model";
325
- readonly expiresAt: number | null;
326
- readonly prompt: string;
327
- readonly mode: "self_paced" | "fixed_interval";
328
- readonly cron: {
329
- readonly expression: string;
330
- readonly timeZone: string;
331
- } | null;
332
- readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
333
- readonly commandId: string;
334
- readonly reason: string | null;
335
- readonly nextDueAt: number | null;
336
- readonly lastError: string | null;
337
- }, never, never>;
338
- }>>;
339
368
  }>;
340
369
  }>;
341
370
  };