@volter/supercode-orchestrator 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ontology.d.ts ADDED
@@ -0,0 +1,557 @@
1
+ // GENERATED from `supercode ontology schema` — do not edit; run node sdk/orchestrator/scripts/generate-types.mjs
2
+ //
3
+ // The Rust records in `crates/interchange/src/world/` and
4
+ // `crates/interchange/src/ontology/` are the source of truth (`docs/ONTOLOGY.md` §2).
5
+
6
+ /** The access record, as Hermes's stores hold it. */
7
+ export interface Access {
8
+ /** Allowed senders per platform. */
9
+ allowlist?: Record<string, string[]>;
10
+ /** Admins per platform. */
11
+ admins?: Record<string, string[]>;
12
+ /** Policy per platform; `allowlist` when absent. */
13
+ policy?: Record<string, AccessPolicy>;
14
+ }
15
+
16
+ /** Per-platform policy. */
17
+ export type AccessPolicy =
18
+ /** Only allowlisted (or paired) senders. */
19
+ | 'allowlist'
20
+ /** Anyone. */
21
+ | 'open';
22
+
23
+ /** What one artifact reached on the way in or out. */
24
+ export interface ArtifactFidelity {
25
+ /** Path relative to the home the codec read or wrote. */
26
+ path: string;
27
+ /** The tier reached. */
28
+ fidelity: Fidelity;
29
+ /** Named loss; non-empty only when `fidelity` tolerates residue. */
30
+ loss?: string[];
31
+ }
32
+
33
+ /** Something attached to an outbound message. */
34
+ export interface Attachment {
35
+ /** `image` | `file` | `video` | `audio`. */
36
+ kind: string;
37
+ /** File name. */
38
+ name?: string | null;
39
+ /** MIME type. */
40
+ mime?: string | null;
41
+ /** Size in bytes. */
42
+ size?: number | null;
43
+ /** A URL to fetch it from. */
44
+ url?: string | null;
45
+ /** A local path. */
46
+ path?: string | null;
47
+ /** Adapter data to re-fetch it. */
48
+ ref?: unknown;
49
+ }
50
+
51
+ /** The conversation record. */
52
+ export interface Binding {
53
+ /** The surface; degenerate (all `None`) on a terminal. */
54
+ key: SurfaceKey;
55
+ /** The profile that owns it (`None` = the home's default). */
56
+ profile?: string | null;
57
+ /** The worker session. */
58
+ worker: Worker;
59
+ /**
60
+ * Why the conversation exists. The orchestrator's own store keeps no
61
+ * trigger column (it is derived from the key and recurrence), so the
62
+ * wire may omit it.
63
+ */
64
+ trigger?: Trigger;
65
+ /** The job this conversation is a fire of. */
66
+ recurrence?: Recurrence | null;
67
+ /** Moved (or moving) to another surface. */
68
+ handoff?: Handoff | null;
69
+ /** RFC3339 instants where the source has them. */
70
+ started_at?: string | null;
71
+ /** Last activity, RFC3339. */
72
+ last_activity_at?: string | null;
73
+ /** End, RFC3339, when ended. */
74
+ ended_at?: string | null;
75
+ /** Why it ended. */
76
+ end_reason?: EndReason | null;
77
+ /** Source fields the record does not model, verbatim. */
78
+ residue?: Residue;
79
+ }
80
+
81
+ /** One platform's configuration. */
82
+ export interface ChannelConfig {
83
+ /** The platform name (`telegram`, `slack`, `api_server`, …). */
84
+ platform: string;
85
+ /** Whether the adapter is enabled. */
86
+ enabled?: boolean;
87
+ /** Credential keys by reference; presence is checked at load, values never held. */
88
+ credentials?: Record<string, SecretRef>;
89
+ /** Adapter-specific settings, verbatim (`extra.<key>` for the nested block). */
90
+ extra?: Record<string, unknown>;
91
+ }
92
+
93
+ /** Why a binding ended (`docs/ORCHESTRATOR-IR.md` §2.5). */
94
+ export type EndReason =
95
+ /** Idle expiry. */
96
+ | 'idle'
97
+ /** The daily reset boundary. */
98
+ | 'daily'
99
+ /** `/reset` (or the operator verb). */
100
+ | 'reset'
101
+ /** `/new` (or the operator verb). */
102
+ | 'new'
103
+ /** Moved to another surface. */
104
+ | 'handoff'
105
+ /** The worker failed. */
106
+ | 'error';
107
+
108
+ /** A worker environment value: a literal, or a secret by reference. */
109
+ export type EnvValue =
110
+ /** A plain, non-secret value. */
111
+ | string
112
+ /** A secret, named and never held. */
113
+ | SecretRef;
114
+
115
+ /**
116
+ * How faithfully a reconstruction reproduces its source.
117
+ *
118
+ * One vocabulary for every surface that has to state what it gave up. It was
119
+ * introduced for session ARTIFACTS (`harness.v1.sessions.export` reports a
120
+ * level plus a named residue list); session LOADS report the same pair,
121
+ * because a read-only VIEW of a session is allowed to settle for
122
+ * [`Fidelity::Semantic`] where a continuation is not (see
123
+ * a session loader's explicitly semantic/read-only mode).
124
+ */
125
+ export type Fidelity =
126
+ /** The reconstruction reproduces the source bytes exactly. */
127
+ | 'byte_lossless'
128
+ /** Every value survives; only the container bytes were re-synthesized. */
129
+ | 'value_lossless'
130
+ /** Meaning survives; the named residue says exactly what did not. */
131
+ | 'semantic';
132
+
133
+ /** One fire. */
134
+ export interface Fire {
135
+ /** The fire id, which is also its session name `cron_<job_id>_<ts>`. */
136
+ id: string;
137
+ /** The job. */
138
+ job_id: string;
139
+ /** The session it opened, when known. */
140
+ session_id?: string | null;
141
+ /** Status. */
142
+ status: FireStatus;
143
+ /** Claim instant. */
144
+ claimed_at: string;
145
+ /** Start instant. */
146
+ started_at?: string | null;
147
+ /** Finish instant. */
148
+ finished_at?: string | null;
149
+ /** The error, on failure. */
150
+ error?: string | null;
151
+ /** The delivery this fire produced, if any. */
152
+ obligation_id?: string | null;
153
+ /** Ledger columns the record does not model (`source`, `pid`, …), verbatim. */
154
+ residue?: Residue;
155
+ }
156
+
157
+ /**
158
+ * A fire's status. `unknown` is Hermes's own word for a fire whose scheduler
159
+ * restarted under it; `completed` ⇄ `succeeded` on the codec boundary and
160
+ * `timeout` writes back as `failed`.
161
+ */
162
+ export type FireStatus =
163
+ /** Claimed, not yet started. */
164
+ | 'claimed'
165
+ /** Running (read from Hermes; never written by us). */
166
+ | 'running'
167
+ /** Finished with a result. */
168
+ | 'succeeded'
169
+ /** Finished with an error. */
170
+ | 'failed'
171
+ /** The session ended without a result. */
172
+ | 'timeout'
173
+ /** The scheduler restarted under it. */
174
+ | 'unknown';
175
+
176
+ /** A conversation moved (or moving) to another surface — Hermes `handoff_*`. */
177
+ export interface Handoff {
178
+ /** The destination platform. */
179
+ to?: string | null;
180
+ /** `pending` | `done` | `failed` (the source's own word, verbatim). */
181
+ state: string;
182
+ /** The failure, when `state` is `failed`. */
183
+ error?: string | null;
184
+ }
185
+
186
+ /** Extensible identifier for a coding harness. */
187
+ export type HarnessId = string;
188
+
189
+ /** One scheduled job. */
190
+ export interface Job {
191
+ /** The id (a file-name-safe token). */
192
+ id: string;
193
+ /** When it fires. */
194
+ schedule: Schedule;
195
+ /** The prompt. */
196
+ prompt?: string | null;
197
+ /** Working directory: relative to the profile dir, or absolute. */
198
+ workdir?: string | null;
199
+ /** Model override. */
200
+ model?: string | null;
201
+ /** Skills to load. */
202
+ skills?: string[];
203
+ /** Job ids (or `self`) whose newest output is prepended at fire time. */
204
+ context_from?: string[] | null;
205
+ /** Where the result goes. */
206
+ deliver: Target;
207
+ /** Where a failure goes; `deliver` with a prefix when absent. */
208
+ failure_deliver?: Target | null;
209
+ /** The creating conversation. */
210
+ origin?: JobOrigin | null;
211
+ /** Hermes: mirror the fire's output into the target conversation's transcript. */
212
+ attach_to_session?: boolean | null;
213
+ /** Remaining-runs counter for `once` jobs. */
214
+ repeat?: Repeat | null;
215
+ /** Whether it fires at all. */
216
+ enabled?: boolean;
217
+ /** Next fire, RFC3339. */
218
+ next_run_at?: string | null;
219
+ /** Last fire, RFC3339. */
220
+ last_run_at?: string | null;
221
+ /** Last fire's status word. */
222
+ last_status?: string | null;
223
+ /** Creation, RFC3339. */
224
+ created_at?: string | null;
225
+ /** Source fields the record does not model, verbatim. */
226
+ residue?: Residue;
227
+ }
228
+
229
+ /** The conversation a job was created from (Hermes `origin`). */
230
+ export interface JobOrigin {
231
+ /** The platform. */
232
+ platform: string;
233
+ /** The chat type, when known. */
234
+ chat_type?: string | null;
235
+ /** The chat. */
236
+ chat_id?: string | null;
237
+ /** The thread. */
238
+ thread_id?: string | null;
239
+ }
240
+
241
+ /** One delivery obligation. */
242
+ export interface Obligation {
243
+ /** The id. */
244
+ id: string;
245
+ /** The surface it goes to. */
246
+ target: SurfaceKey;
247
+ /** Hermes's `session_key` column, verbatim. */
248
+ session_key?: string | null;
249
+ /** What is delivered. */
250
+ content: OutboundContent;
251
+ /** State. */
252
+ state: ObligationState;
253
+ /** Attempts so far. */
254
+ attempts?: number;
255
+ /** The last failure. */
256
+ last_error?: string | null;
257
+ /** Creation instant (Hermes: epoch seconds as text). */
258
+ created_at: string;
259
+ /** Last transition instant. */
260
+ updated_at: string;
261
+ /** When it was sent. */
262
+ delivered_at?: string | null;
263
+ /** The platform's handle for what was sent. */
264
+ posted?: Posted | null;
265
+ /** Where it came from. */
266
+ source: ObligationSource;
267
+ /** Ledger columns the record does not model, verbatim. */
268
+ residue?: Residue;
269
+ }
270
+
271
+ /** Where an obligation came from. */
272
+ export type ObligationSource =
273
+ /** A conversation's turn. */
274
+ | { key?: SurfaceKey | null; kind: 'turn' }
275
+ /** A job fire. */
276
+ | { fire_id: string; kind: 'fire' }
277
+ /** A webhook. */
278
+ | { name: string; kind: 'webhook' };
279
+
280
+ /** Delivery state; `sent` is Hermes's `delivered`. */
281
+ export type ObligationState =
282
+ /** Not yet delivered. */
283
+ | 'pending'
284
+ /** Delivered. */
285
+ | 'sent'
286
+ /** Gave up. */
287
+ | 'failed'
288
+ /** Dropped on purpose. */
289
+ | 'dropped';
290
+
291
+ /**
292
+ * The whole home: the persisted half of `OrchestratorState` (§2.1); the
293
+ * runtime half is never written and is not part of the wire.
294
+ */
295
+ export interface Orchestration {
296
+ /** The home folder. */
297
+ root: string;
298
+ /** `default` is the root folder; the rest are `profiles/<name>/`. */
299
+ profiles: Record<string, Profile>;
300
+ }
301
+
302
+ /** What is delivered. */
303
+ export interface OutboundContent {
304
+ /** The text. */
305
+ text: string;
306
+ /** Attachments. */
307
+ attachments?: Attachment[] | null;
308
+ /** The message this replies to. */
309
+ reply_to?: string | null;
310
+ /** `text` | `markdown`. */
311
+ format?: string | null;
312
+ }
313
+
314
+ /** What happens to a worker's permission prompt when no human answers. */
315
+ export type PermissionDefault =
316
+ /** Refuse after the timeout. */
317
+ | 'deny'
318
+ /** Allow after the timeout. */
319
+ | 'allow';
320
+
321
+ /** How prompts are answered when no human is reachable (§4.6). */
322
+ export interface PermissionPolicy {
323
+ /** Seconds a relayed prompt waits for an answer. */
324
+ timeout_seconds?: number;
325
+ /** The answer given when nobody replies in time. */
326
+ default?: PermissionDefault;
327
+ /** The answer given at once where nobody attends: a cron fire or a webhook turn. */
328
+ unattended?: PermissionUnattended;
329
+ }
330
+
331
+ /**
332
+ * What a prompt raised where nobody attends (a cron fire, a webhook turn) is answered with, at
333
+ * once (Hermes `approvals.cron_mode`).
334
+ */
335
+ export type PermissionUnattended =
336
+ /** Refuse it. */
337
+ | 'deny'
338
+ /** Approve it. */
339
+ | 'approve';
340
+
341
+ /** The persona: `AGENTS.md` at the profile root, content hash first. */
342
+ export interface PersonaRef {
343
+ /** Always `AGENTS.md` in our folder (`SOUL.md` in a Hermes home). */
344
+ path: string;
345
+ /** The text, when loaded. */
346
+ text?: string | null;
347
+ /** Hex sha256 of the text. */
348
+ sha256: string;
349
+ }
350
+
351
+ /** The platform's handle for what was sent. */
352
+ export interface Posted {
353
+ /** The platform message id. */
354
+ message_id: string;
355
+ }
356
+
357
+ /** One profile: a folder with `AGENTS.md` at its root. */
358
+ export interface Profile {
359
+ /** `default` for the root, else the folder name. */
360
+ name: string;
361
+ /** The folder. */
362
+ dir: string;
363
+ /** O — which harness runs it. */
364
+ worker?: WorkerSpec | null;
365
+ /** O — `AGENTS.md`. */
366
+ persona?: PersonaRef | null;
367
+ /** H — `config.yaml` `platforms:` blocks. */
368
+ channels?: Record<string, ChannelConfig>;
369
+ /** H — `gateway.profile_routes`. */
370
+ routes?: Route[];
371
+ /** H — `cron/jobs.json`. */
372
+ jobs?: Record<string, Job>;
373
+ /** H — `webhook_subscriptions.json`. */
374
+ subscriptions?: Record<string, WebhookSubscription>;
375
+ /** H — allowlists and pairing. */
376
+ access?: Access;
377
+ /**
378
+ * O — the conversations, keyed by their slot (the surface key string for
379
+ * a live one, `<key>#<started_at>[#n]` for ended ones).
380
+ */
381
+ bindings?: Record<string, Binding>;
382
+ /** H — `cron/executions.db`. */
383
+ fires?: Fire[];
384
+ /** H — `delivery_obligations`. */
385
+ obligations?: Obligation[];
386
+ /** What the model does not interpret. */
387
+ residue?: ProfileResidue;
388
+ }
389
+
390
+ /** What a profile carries that the model does not interpret. */
391
+ export interface ProfileResidue {
392
+ /** `config.yaml` keys that are the source harness's, verbatim. */
393
+ config?: Record<string, unknown>;
394
+ /** Unmodeled files, by path relative to the profile dir; copied verbatim. */
395
+ files?: string[];
396
+ }
397
+
398
+ /** ORCH-3: the job a recurring session belongs to. */
399
+ export interface Recurrence {
400
+ /** The job id. */
401
+ job_id: string;
402
+ /** `cron` | `heartbeat`. */
403
+ kind?: string;
404
+ }
405
+
406
+ /** Hermes 0.21.0's `repeat`: `{times: N | null, completed: M}`; `null` times = forever. */
407
+ export interface Repeat {
408
+ /** Remaining fires, or `None` for forever. */
409
+ times?: number | null;
410
+ /** Fires so far. */
411
+ completed?: number;
412
+ }
413
+
414
+ /** Unmodeled source fields, keyed by the source's own field name. */
415
+ export type Residue = Record<string, unknown>;
416
+
417
+ /** One route. */
418
+ export interface Route {
419
+ /** Optional name. */
420
+ name?: string | null;
421
+ /** What it matches. */
422
+ match: RouteMatch;
423
+ /** The profile that answers. */
424
+ profile: string;
425
+ /** Unmodeled fields of the route, verbatim. */
426
+ residue?: Residue;
427
+ }
428
+
429
+ /** What a route matches; most specific wins. */
430
+ export interface RouteMatch {
431
+ /** The platform. */
432
+ platform: string;
433
+ /** Discord-style guild id. */
434
+ guild_id?: string | null;
435
+ /** The chat. */
436
+ chat_id?: string | null;
437
+ /** The thread. */
438
+ thread_id?: string | null;
439
+ }
440
+
441
+ /** When a job fires. */
442
+ export type Schedule =
443
+ /** Once, at an instant. */
444
+ | { run_at: string; kind: 'once' }
445
+ /** Every N minutes. */
446
+ | { minutes: number; kind: 'interval' }
447
+ /** A five-field cron expression in a timezone. */
448
+ | { expr: string; tz?: string | null; kind: 'cron' };
449
+
450
+ /** Where a secret value lives. Wire form: `{"env": NAME}` or `{"dotenv": KEY}`. */
451
+ export type SecretRef =
452
+ /** An environment variable of the process that resolves it. */
453
+ | { env: string }
454
+ /** A key in the home's own `.env` file. */
455
+ | { dotenv: string };
456
+
457
+ /**
458
+ * ORCH-3: the conversation identity on a surface. Full tuple on a channel;
459
+ * degenerate (all `None`) on a terminal.
460
+ */
461
+ export interface SurfaceKey {
462
+ /** The harness's own key string, verbatim. */
463
+ key?: string | null;
464
+ /** Transport / platform (`telegram`, `slack`, `acp`, …). */
465
+ platform?: string | null;
466
+ /**
467
+ * `dm` | `group` | `channel` | `thread` | `main` (harness vocabulary, verbatim).
468
+ * `chat_type` is the orchestrator IR's spelling of the same field.
469
+ */
470
+ kind?: string | null;
471
+ /** The chat / group / channel id on the platform. */
472
+ chat_id?: string | null;
473
+ /** The thread or topic within the chat. */
474
+ thread_id?: string | null;
475
+ /** The participant, when the surface is per person. */
476
+ participant_id?: string | null;
477
+ }
478
+
479
+ /** Where a result goes. */
480
+ export type Target =
481
+ /** The surface the job was created from. */
482
+ | { kind: 'origin' }
483
+ /** The profile's `/sethome` surface. */
484
+ | { kind: 'home' }
485
+ /** A file under the profile dir (the fire's own output file). */
486
+ | { kind: 'local' }
487
+ /** A named surface, as `hermes send --to` spells one. */
488
+ | { platform: string; chat_id?: string | null; thread_id?: string | null; kind: 'explicit' };
489
+
490
+ /** ORCH-3: why a session exists (the trigger noun; `docs/HERMES-IDEAL-SUPPORT-DESIGN.md` §3). */
491
+ export type Trigger =
492
+ /** A person started it on a terminal, IDE, or chat surface. */
493
+ | 'human'
494
+ /** A message on a channel opened it. */
495
+ | 'channel'
496
+ /** A scheduled job fired it. */
497
+ | 'cron'
498
+ /** A periodic main-session turn. */
499
+ | 'heartbeat'
500
+ /** An inbound webhook / mapped hook. */
501
+ | 'webhook'
502
+ /** Spawned by a parent session (delegate / subagent). */
503
+ | 'parent'
504
+ /** An HTTP API / bridge client. */
505
+ | 'api'
506
+ /** A board's dispatcher spawned it to work a task (the workflow layer). */
507
+ | 'task'
508
+ /** The source does not say. */
509
+ | 'unknown';
510
+
511
+ /** One subscription: the route is `/webhooks/<name>`. */
512
+ export interface WebhookSubscription {
513
+ /** The name. */
514
+ name: string;
515
+ /** The HMAC secret, by reference. */
516
+ secret?: SecretRef | null;
517
+ /** Accepted event names; all when absent. */
518
+ events?: string[] | null;
519
+ /** The prompt, rendered with the payload. */
520
+ prompt_template?: string;
521
+ /** Where the answer goes. */
522
+ deliver?: Target | null;
523
+ /** Skills to load. */
524
+ skills?: string[];
525
+ /** Description. */
526
+ description?: string | null;
527
+ /** Creation, RFC3339. */
528
+ created_at?: string | null;
529
+ /** Unmodeled fields, verbatim. */
530
+ residue?: Residue;
531
+ }
532
+
533
+ /** The worker session a binding points at. */
534
+ export interface Worker {
535
+ /** Which harness runs the conversation. */
536
+ harness: HarnessId;
537
+ /** The harness's own session id, when one exists yet. */
538
+ session_id?: string | null;
539
+ /** Where that session's transcript can be read (a path or store address). */
540
+ locator?: string | null;
541
+ }
542
+
543
+ /** The worker specification (O-record; Hermes has no worker choice). */
544
+ export interface WorkerSpec {
545
+ /** Any registry id whose runtime can start a session. */
546
+ harness: HarnessId;
547
+ /** Model, where the harness's door accepts one. */
548
+ model?: string | null;
549
+ /** supercode preset name. */
550
+ preset?: string | null;
551
+ /** Relative to the profile dir; `.` by default. */
552
+ cwd?: string;
553
+ /** Extra environment for the worker process; secrets by reference. */
554
+ env?: Record<string, EnvValue>;
555
+ /** Permission prompt policy. */
556
+ permission?: PermissionPolicy;
557
+ }