@loomcycle/client 1.92.0 → 1.94.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.
@@ -138,11 +138,15 @@ function runBody(opts) {
138
138
  body.metadata = opts.metadata;
139
139
  if (opts.runTimeoutSeconds !== undefined)
140
140
  body.run_timeout_seconds = opts.runTimeoutSeconds;
141
+ if (opts.reviewTtlSeconds !== undefined)
142
+ body.review_ttl_seconds = opts.reviewTtlSeconds;
141
143
  if (opts.sampling !== undefined)
142
144
  body.sampling = samplingToWire(opts.sampling);
143
145
  // Same keys on the wire as in the option (mode / name / until).
144
146
  if (opts.toolChoice !== undefined)
145
147
  body.tool_choice = opts.toolChoice;
148
+ if (opts.outputFormat !== undefined)
149
+ body.output_format = opts.outputFormat;
146
150
  if (opts.compaction !== undefined)
147
151
  body.compaction = compactionToWire(opts.compaction);
148
152
  if (opts.context !== undefined)
@@ -196,6 +200,8 @@ function applyOverridesToWire(body, opts) {
196
200
  body.interactive = opts.interactive;
197
201
  if (opts.interruption !== undefined)
198
202
  body.interruption = opts.interruption;
203
+ if (opts.review !== undefined)
204
+ body.review = opts.review;
199
205
  }
200
206
  class LoomcycleClient {
201
207
  ctx;
@@ -273,10 +279,14 @@ class LoomcycleClient {
273
279
  body.metadata = opts.metadata;
274
280
  if (opts.runTimeoutSeconds !== undefined)
275
281
  body.run_timeout_seconds = opts.runTimeoutSeconds;
282
+ if (opts.reviewTtlSeconds !== undefined)
283
+ body.review_ttl_seconds = opts.reviewTtlSeconds;
276
284
  if (opts.sampling !== undefined)
277
285
  body.sampling = samplingToWire(opts.sampling);
278
286
  if (opts.toolChoice !== undefined)
279
287
  body.tool_choice = opts.toolChoice;
288
+ if (opts.outputFormat !== undefined)
289
+ body.output_format = opts.outputFormat;
280
290
  if (opts.compaction !== undefined)
281
291
  body.compaction = compactionToWire(opts.compaction);
282
292
  if (opts.context !== undefined)
@@ -355,6 +365,47 @@ class LoomcycleClient {
355
365
  * Raises {@link NotFoundError} (404) for an unknown run and for another
356
366
  * tenant's run alike, and also — with code `no_prompt_snapshot` — for a run
357
367
  * that never reached a model call or predates prompt snapshots. */
368
+ /** Create a run WITHOUT starting it (RFC DI): a configured run holds its
369
+ * request, runs nothing and takes no slot until
370
+ * {@link LoomcycleClient.startConfiguredRun}. It is validated now exactly as
371
+ * a run would be; admission and the budget check happen at start. It never
372
+ * stores a secret — pass `userBearer` / `userCredentials` to the start. */
373
+ async createConfiguredRun(opts) {
374
+ const body = runBody(opts);
375
+ body.start = false;
376
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/runs", body, { signal: opts.signal });
377
+ }
378
+ /** Replace fields of a configured run's request. Set fields replace the
379
+ * draft's; `remove` names wire fields (snake_case, e.g. `"sampling"`) to
380
+ * drop. The agent, the identity and secrets cannot be changed. Refused
381
+ * (409) once the run has started. */
382
+ async updateConfiguredRun(runId, patch, opts) {
383
+ // runBody serializes only the fields that are set, so a partial patch
384
+ // stays partial on the wire.
385
+ const body = runBody(patch);
386
+ delete body.agent;
387
+ for (const k of opts?.remove ?? [])
388
+ body[k] = null;
389
+ return (0, fetch_helpers_js_1.patchJSON)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}`, body, { signal: opts?.signal });
390
+ }
391
+ /** Start a configured run and stream it, exactly as
392
+ * {@link LoomcycleClient.runStreaming} streams a new one. Admission happens
393
+ * here: a refusal (429 / 503) throws before any event and leaves the run
394
+ * configured, to be started again later. Secrets the draft never stored
395
+ * are passed here. */
396
+ async *startConfiguredRun(runId, opts) {
397
+ const body = {};
398
+ if (opts?.userBearer !== undefined)
399
+ body.user_bearer = opts.userBearer;
400
+ if (opts?.userCredentials !== undefined)
401
+ body.user_credentials = opts.userCredentials;
402
+ yield* this.streamSSE(`/v1/runs/${encodeURIComponent(runId)}/start`, body, opts?.signal, opts?.debug);
403
+ }
404
+ /** Discard a configured run and its session. A live run is not discarded —
405
+ * cancel it instead. */
406
+ async deleteConfiguredRun(runId, opts) {
407
+ await (0, fetch_helpers_js_1.deleteRequest)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}`, opts);
408
+ }
358
409
  async getRunPrompt(runId, opts) {
359
410
  return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/prompt`, opts);
360
411
  }
@@ -570,6 +621,26 @@ class LoomcycleClient {
570
621
  body.reason = opts.reason;
571
622
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/cancel`, body, opts);
572
623
  }
624
+ /**
625
+ * Deliver a verdict on a run held for review (one started or retuned with
626
+ * `review: true`, whose stream has emitted `awaiting_review`).
627
+ *
628
+ * - `approve` — the run completes on the answer it was held on.
629
+ * - `reject` with `feedback` — the feedback becomes the run's next user turn;
630
+ * it revises and is held again.
631
+ * - `reject` without feedback — the run ends with status `rejected`.
632
+ *
633
+ * Rejects with a LoomcycleError of status 409 (body code `not_held`) when
634
+ * the run is live but not held, NotFoundError (404) for an unknown, finished
635
+ * or cross-tenant run, and InvalidArgumentError (400) for feedback on an
636
+ * approval. Mirrors POST /v1/runs/{run_id}/review.
637
+ */
638
+ async reviewRun(runId, decision, opts) {
639
+ const body = { decision };
640
+ if (opts?.feedback !== undefined)
641
+ body.feedback = opts.feedback;
642
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/review`, body, opts);
643
+ }
573
644
  // ---- Agent metadata ----
574
645
  /** Read one agent's status + usage stats. Raises AgentNotFoundError
575
646
  * when the agent_id is unknown. */
@@ -1045,11 +1116,13 @@ class LoomcycleClient {
1045
1116
  });
1046
1117
  }
1047
1118
  // ---- Hook management (hooks-connector series, PR C) ----
1048
- /** Register a pre- or post-tool webhook. The callback_url must be
1049
- * an http:// or https:// endpoint the CONSUMER runs — loomcycle
1050
- * POSTs PreHookCall / PostHookCall payloads to it. This method
1051
- * manages registration only; the receiver is the consumer's own
1052
- * HTTP framework (Express, Next.js, etc.).
1119
+ /** Register a pre- or post-tool hook. Its body is a webhook — the
1120
+ * callback_url must be an http:// or https:// endpoint the CONSUMER
1121
+ * runs; loomcycle POSTs PreHookCall / PostHookCall payloads to it —
1122
+ * or a code-js body (`code`), run in-process by loomcycle. Set
1123
+ * exactly one. This method manages registration only; a webhook's
1124
+ * receiver is the consumer's own HTTP framework (Express, Next.js,
1125
+ * etc.).
1053
1126
  *
1054
1127
  * Re-registering the same (owner, name) replaces the prior entry
1055
1128
  * with a fresh id (idempotent app-restart contract).
@@ -1061,8 +1134,11 @@ class LoomcycleClient {
1061
1134
  owner: opts.owner,
1062
1135
  name: opts.name,
1063
1136
  phase: opts.phase,
1064
- callback_url: opts.callbackUrl,
1065
1137
  };
1138
+ if (opts.callbackUrl !== undefined)
1139
+ body.callback_url = opts.callbackUrl;
1140
+ if (opts.code !== undefined)
1141
+ body.code = opts.code;
1066
1142
  if (opts.agents !== undefined)
1067
1143
  body.agents = opts.agents;
1068
1144
  if (opts.tools !== undefined)
@@ -1463,6 +1539,10 @@ class LoomcycleClient {
1463
1539
  body.mode = target.mode;
1464
1540
  if (target.breakpoints !== undefined)
1465
1541
  body.breakpoints = target.breakpoints;
1542
+ if (target.review !== undefined)
1543
+ body.review = target.review;
1544
+ if (target.reviewTtlSeconds !== undefined)
1545
+ body.review_ttl_seconds = target.reviewTtlSeconds;
1466
1546
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_teamdef", body, opts);
1467
1547
  }
1468
1548
  /** Read the debug breakpoints armed on a live team walk
@@ -1483,10 +1563,11 @@ class LoomcycleClient {
1483
1563
  * off switch. A malformed entry is refused whole and leaves the previous
1484
1564
  * arming exactly as it was.
1485
1565
  *
1486
- * Each entry is a starter state id — `"review"` arms both phases,
1487
- * `"review:before_dispatch"` or `"review:after_collection"` arms one. An arm
1488
- * takes effect at the next pause the walk reaches; disarming RELEASES
1489
- * whatever is still pending rather than stranding it.
1566
+ * Each entry is a starter state id — `"wave"` (or `"wave:before_dispatch"`)
1567
+ * pauses the state before it dispatches, and `"wave:review"` holds its member
1568
+ * runs for a verdict ({@link LoomcycleClient.reviewRun}). An arm takes effect
1569
+ * at the next point the walk reaches; disarming RELEASES whatever is still
1570
+ * pending rather than stranding it.
1490
1571
  *
1491
1572
  * A pause is read and answered through the run's interrupts. */
1492
1573
  async setRunBreakpoints(runId, breakpoints, opts) {
package/dist/client.d.ts CHANGED
@@ -25,7 +25,7 @@
25
25
  */
26
26
  import { InteractiveSession } from "./interactive.js";
27
27
  import { ClientToolHost, type ConnectClientToolsOptions } from "./client-tools.js";
28
- import type { CredentialListResponse, CredentialMeta, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, PersistentVolumesResponse, EphemeralVolumesResponse, RegisterHookOptions, RegisterHookResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, ReplaySessionResult, CancelTurnResult, RunBatchOptions, RunBatchResult, RunOptions, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, TranscriptResponse, WhoamiResponse, UsageDimension, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest } from "./types.js";
28
+ import type { CredentialListResponse, CredentialMeta, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, PersistentVolumesResponse, EphemeralVolumesResponse, RegisterHookOptions, RegisterHookResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, ReplaySessionResult, CancelTurnResult, ReviewRunResult, RunBatchOptions, RunBatchResult, RunOptions, ConfiguredRun, ConfiguredRunPatch, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, TranscriptResponse, WhoamiResponse, UsageDimension, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest } from "./types.js";
29
29
  export declare class LoomcycleClient {
30
30
  private ctx;
31
31
  constructor(opts?: ClientOptions);
@@ -128,6 +128,36 @@ export declare class LoomcycleClient {
128
128
  * Raises {@link NotFoundError} (404) for an unknown run and for another
129
129
  * tenant's run alike, and also — with code `no_prompt_snapshot` — for a run
130
130
  * that never reached a model call or predates prompt snapshots. */
131
+ /** Create a run WITHOUT starting it (RFC DI): a configured run holds its
132
+ * request, runs nothing and takes no slot until
133
+ * {@link LoomcycleClient.startConfiguredRun}. It is validated now exactly as
134
+ * a run would be; admission and the budget check happen at start. It never
135
+ * stores a secret — pass `userBearer` / `userCredentials` to the start. */
136
+ createConfiguredRun(opts: Omit<RunOptions, "userBearer" | "userCredentials" | "sessionId" | "debug">): Promise<ConfiguredRun>;
137
+ /** Replace fields of a configured run's request. Set fields replace the
138
+ * draft's; `remove` names wire fields (snake_case, e.g. `"sampling"`) to
139
+ * drop. The agent, the identity and secrets cannot be changed. Refused
140
+ * (409) once the run has started. */
141
+ updateConfiguredRun(runId: string, patch: ConfiguredRunPatch, opts?: {
142
+ remove?: string[];
143
+ signal?: AbortSignal;
144
+ }): Promise<ConfiguredRun>;
145
+ /** Start a configured run and stream it, exactly as
146
+ * {@link LoomcycleClient.runStreaming} streams a new one. Admission happens
147
+ * here: a refusal (429 / 503) throws before any event and leaves the run
148
+ * configured, to be started again later. Secrets the draft never stored
149
+ * are passed here. */
150
+ startConfiguredRun(runId: string, opts?: {
151
+ userBearer?: string;
152
+ userCredentials?: Record<string, string>;
153
+ signal?: AbortSignal;
154
+ debug?: boolean;
155
+ }): AsyncIterable<AgentEvent>;
156
+ /** Discard a configured run and its session. A live run is not discarded —
157
+ * cancel it instead. */
158
+ deleteConfiguredRun(runId: string, opts?: {
159
+ signal?: AbortSignal;
160
+ }): Promise<void>;
131
161
  getRunPrompt(runId: string, opts?: {
132
162
  signal?: AbortSignal;
133
163
  }): Promise<RunPromptResponse>;
@@ -307,6 +337,24 @@ export declare class LoomcycleClient {
307
337
  reason?: string;
308
338
  signal?: AbortSignal;
309
339
  }): Promise<CancelTurnResult>;
340
+ /**
341
+ * Deliver a verdict on a run held for review (one started or retuned with
342
+ * `review: true`, whose stream has emitted `awaiting_review`).
343
+ *
344
+ * - `approve` — the run completes on the answer it was held on.
345
+ * - `reject` with `feedback` — the feedback becomes the run's next user turn;
346
+ * it revises and is held again.
347
+ * - `reject` without feedback — the run ends with status `rejected`.
348
+ *
349
+ * Rejects with a LoomcycleError of status 409 (body code `not_held`) when
350
+ * the run is live but not held, NotFoundError (404) for an unknown, finished
351
+ * or cross-tenant run, and InvalidArgumentError (400) for feedback on an
352
+ * approval. Mirrors POST /v1/runs/{run_id}/review.
353
+ */
354
+ reviewRun(runId: string, decision: "approve" | "reject", opts?: {
355
+ feedback?: string;
356
+ signal?: AbortSignal;
357
+ }): Promise<ReviewRunResult>;
310
358
  /** Read one agent's status + usage stats. Raises AgentNotFoundError
311
359
  * when the agent_id is unknown. */
312
360
  getAgent(agentId: string, opts?: {
@@ -648,11 +696,13 @@ export declare class LoomcycleClient {
648
696
  resolvedBy?: string;
649
697
  signal?: AbortSignal;
650
698
  }): Promise<unknown>;
651
- /** Register a pre- or post-tool webhook. The callback_url must be
652
- * an http:// or https:// endpoint the CONSUMER runs — loomcycle
653
- * POSTs PreHookCall / PostHookCall payloads to it. This method
654
- * manages registration only; the receiver is the consumer's own
655
- * HTTP framework (Express, Next.js, etc.).
699
+ /** Register a pre- or post-tool hook. Its body is a webhook — the
700
+ * callback_url must be an http:// or https:// endpoint the CONSUMER
701
+ * runs; loomcycle POSTs PreHookCall / PostHookCall payloads to it —
702
+ * or a code-js body (`code`), run in-process by loomcycle. Set
703
+ * exactly one. This method manages registration only; a webhook's
704
+ * receiver is the consumer's own HTTP framework (Express, Next.js,
705
+ * etc.).
656
706
  *
657
707
  * Re-registering the same (owner, name) replaces the prior entry
658
708
  * with a fresh id (idempotent app-restart contract).
@@ -1013,10 +1063,11 @@ export declare class LoomcycleClient {
1013
1063
  * off switch. A malformed entry is refused whole and leaves the previous
1014
1064
  * arming exactly as it was.
1015
1065
  *
1016
- * Each entry is a starter state id — `"review"` arms both phases,
1017
- * `"review:before_dispatch"` or `"review:after_collection"` arms one. An arm
1018
- * takes effect at the next pause the walk reaches; disarming RELEASES
1019
- * whatever is still pending rather than stranding it.
1066
+ * Each entry is a starter state id — `"wave"` (or `"wave:before_dispatch"`)
1067
+ * pauses the state before it dispatches, and `"wave:review"` holds its member
1068
+ * runs for a verdict ({@link LoomcycleClient.reviewRun}). An arm takes effect
1069
+ * at the next point the walk reaches; disarming RELEASES whatever is still
1070
+ * pending rather than stranding it.
1020
1071
  *
1021
1072
  * A pause is read and answered through the run's interrupts. */
1022
1073
  setRunBreakpoints(runId: string, breakpoints: string[], opts?: {
package/dist/client.js CHANGED
@@ -135,11 +135,15 @@ function runBody(opts) {
135
135
  body.metadata = opts.metadata;
136
136
  if (opts.runTimeoutSeconds !== undefined)
137
137
  body.run_timeout_seconds = opts.runTimeoutSeconds;
138
+ if (opts.reviewTtlSeconds !== undefined)
139
+ body.review_ttl_seconds = opts.reviewTtlSeconds;
138
140
  if (opts.sampling !== undefined)
139
141
  body.sampling = samplingToWire(opts.sampling);
140
142
  // Same keys on the wire as in the option (mode / name / until).
141
143
  if (opts.toolChoice !== undefined)
142
144
  body.tool_choice = opts.toolChoice;
145
+ if (opts.outputFormat !== undefined)
146
+ body.output_format = opts.outputFormat;
143
147
  if (opts.compaction !== undefined)
144
148
  body.compaction = compactionToWire(opts.compaction);
145
149
  if (opts.context !== undefined)
@@ -193,6 +197,8 @@ function applyOverridesToWire(body, opts) {
193
197
  body.interactive = opts.interactive;
194
198
  if (opts.interruption !== undefined)
195
199
  body.interruption = opts.interruption;
200
+ if (opts.review !== undefined)
201
+ body.review = opts.review;
196
202
  }
197
203
  export class LoomcycleClient {
198
204
  ctx;
@@ -270,10 +276,14 @@ export class LoomcycleClient {
270
276
  body.metadata = opts.metadata;
271
277
  if (opts.runTimeoutSeconds !== undefined)
272
278
  body.run_timeout_seconds = opts.runTimeoutSeconds;
279
+ if (opts.reviewTtlSeconds !== undefined)
280
+ body.review_ttl_seconds = opts.reviewTtlSeconds;
273
281
  if (opts.sampling !== undefined)
274
282
  body.sampling = samplingToWire(opts.sampling);
275
283
  if (opts.toolChoice !== undefined)
276
284
  body.tool_choice = opts.toolChoice;
285
+ if (opts.outputFormat !== undefined)
286
+ body.output_format = opts.outputFormat;
277
287
  if (opts.compaction !== undefined)
278
288
  body.compaction = compactionToWire(opts.compaction);
279
289
  if (opts.context !== undefined)
@@ -352,6 +362,47 @@ export class LoomcycleClient {
352
362
  * Raises {@link NotFoundError} (404) for an unknown run and for another
353
363
  * tenant's run alike, and also — with code `no_prompt_snapshot` — for a run
354
364
  * that never reached a model call or predates prompt snapshots. */
365
+ /** Create a run WITHOUT starting it (RFC DI): a configured run holds its
366
+ * request, runs nothing and takes no slot until
367
+ * {@link LoomcycleClient.startConfiguredRun}. It is validated now exactly as
368
+ * a run would be; admission and the budget check happen at start. It never
369
+ * stores a secret — pass `userBearer` / `userCredentials` to the start. */
370
+ async createConfiguredRun(opts) {
371
+ const body = runBody(opts);
372
+ body.start = false;
373
+ return postJSON(this.ctx, "/v1/runs", body, { signal: opts.signal });
374
+ }
375
+ /** Replace fields of a configured run's request. Set fields replace the
376
+ * draft's; `remove` names wire fields (snake_case, e.g. `"sampling"`) to
377
+ * drop. The agent, the identity and secrets cannot be changed. Refused
378
+ * (409) once the run has started. */
379
+ async updateConfiguredRun(runId, patch, opts) {
380
+ // runBody serializes only the fields that are set, so a partial patch
381
+ // stays partial on the wire.
382
+ const body = runBody(patch);
383
+ delete body.agent;
384
+ for (const k of opts?.remove ?? [])
385
+ body[k] = null;
386
+ return patchJSON(this.ctx, `/v1/runs/${encodeURIComponent(runId)}`, body, { signal: opts?.signal });
387
+ }
388
+ /** Start a configured run and stream it, exactly as
389
+ * {@link LoomcycleClient.runStreaming} streams a new one. Admission happens
390
+ * here: a refusal (429 / 503) throws before any event and leaves the run
391
+ * configured, to be started again later. Secrets the draft never stored
392
+ * are passed here. */
393
+ async *startConfiguredRun(runId, opts) {
394
+ const body = {};
395
+ if (opts?.userBearer !== undefined)
396
+ body.user_bearer = opts.userBearer;
397
+ if (opts?.userCredentials !== undefined)
398
+ body.user_credentials = opts.userCredentials;
399
+ yield* this.streamSSE(`/v1/runs/${encodeURIComponent(runId)}/start`, body, opts?.signal, opts?.debug);
400
+ }
401
+ /** Discard a configured run and its session. A live run is not discarded —
402
+ * cancel it instead. */
403
+ async deleteConfiguredRun(runId, opts) {
404
+ await deleteRequest(this.ctx, `/v1/runs/${encodeURIComponent(runId)}`, opts);
405
+ }
355
406
  async getRunPrompt(runId, opts) {
356
407
  return jsonFetch(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/prompt`, opts);
357
408
  }
@@ -567,6 +618,26 @@ export class LoomcycleClient {
567
618
  body.reason = opts.reason;
568
619
  return postJSON(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/cancel`, body, opts);
569
620
  }
621
+ /**
622
+ * Deliver a verdict on a run held for review (one started or retuned with
623
+ * `review: true`, whose stream has emitted `awaiting_review`).
624
+ *
625
+ * - `approve` — the run completes on the answer it was held on.
626
+ * - `reject` with `feedback` — the feedback becomes the run's next user turn;
627
+ * it revises and is held again.
628
+ * - `reject` without feedback — the run ends with status `rejected`.
629
+ *
630
+ * Rejects with a LoomcycleError of status 409 (body code `not_held`) when
631
+ * the run is live but not held, NotFoundError (404) for an unknown, finished
632
+ * or cross-tenant run, and InvalidArgumentError (400) for feedback on an
633
+ * approval. Mirrors POST /v1/runs/{run_id}/review.
634
+ */
635
+ async reviewRun(runId, decision, opts) {
636
+ const body = { decision };
637
+ if (opts?.feedback !== undefined)
638
+ body.feedback = opts.feedback;
639
+ return postJSON(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/review`, body, opts);
640
+ }
570
641
  // ---- Agent metadata ----
571
642
  /** Read one agent's status + usage stats. Raises AgentNotFoundError
572
643
  * when the agent_id is unknown. */
@@ -1042,11 +1113,13 @@ export class LoomcycleClient {
1042
1113
  });
1043
1114
  }
1044
1115
  // ---- Hook management (hooks-connector series, PR C) ----
1045
- /** Register a pre- or post-tool webhook. The callback_url must be
1046
- * an http:// or https:// endpoint the CONSUMER runs — loomcycle
1047
- * POSTs PreHookCall / PostHookCall payloads to it. This method
1048
- * manages registration only; the receiver is the consumer's own
1049
- * HTTP framework (Express, Next.js, etc.).
1116
+ /** Register a pre- or post-tool hook. Its body is a webhook — the
1117
+ * callback_url must be an http:// or https:// endpoint the CONSUMER
1118
+ * runs; loomcycle POSTs PreHookCall / PostHookCall payloads to it —
1119
+ * or a code-js body (`code`), run in-process by loomcycle. Set
1120
+ * exactly one. This method manages registration only; a webhook's
1121
+ * receiver is the consumer's own HTTP framework (Express, Next.js,
1122
+ * etc.).
1050
1123
  *
1051
1124
  * Re-registering the same (owner, name) replaces the prior entry
1052
1125
  * with a fresh id (idempotent app-restart contract).
@@ -1058,8 +1131,11 @@ export class LoomcycleClient {
1058
1131
  owner: opts.owner,
1059
1132
  name: opts.name,
1060
1133
  phase: opts.phase,
1061
- callback_url: opts.callbackUrl,
1062
1134
  };
1135
+ if (opts.callbackUrl !== undefined)
1136
+ body.callback_url = opts.callbackUrl;
1137
+ if (opts.code !== undefined)
1138
+ body.code = opts.code;
1063
1139
  if (opts.agents !== undefined)
1064
1140
  body.agents = opts.agents;
1065
1141
  if (opts.tools !== undefined)
@@ -1460,6 +1536,10 @@ export class LoomcycleClient {
1460
1536
  body.mode = target.mode;
1461
1537
  if (target.breakpoints !== undefined)
1462
1538
  body.breakpoints = target.breakpoints;
1539
+ if (target.review !== undefined)
1540
+ body.review = target.review;
1541
+ if (target.reviewTtlSeconds !== undefined)
1542
+ body.review_ttl_seconds = target.reviewTtlSeconds;
1463
1543
  return postJSON(this.ctx, "/v1/_teamdef", body, opts);
1464
1544
  }
1465
1545
  /** Read the debug breakpoints armed on a live team walk
@@ -1480,10 +1560,11 @@ export class LoomcycleClient {
1480
1560
  * off switch. A malformed entry is refused whole and leaves the previous
1481
1561
  * arming exactly as it was.
1482
1562
  *
1483
- * Each entry is a starter state id — `"review"` arms both phases,
1484
- * `"review:before_dispatch"` or `"review:after_collection"` arms one. An arm
1485
- * takes effect at the next pause the walk reaches; disarming RELEASES
1486
- * whatever is still pending rather than stranding it.
1563
+ * Each entry is a starter state id — `"wave"` (or `"wave:before_dispatch"`)
1564
+ * pauses the state before it dispatches, and `"wave:review"` holds its member
1565
+ * runs for a verdict ({@link LoomcycleClient.reviewRun}). An arm takes effect
1566
+ * at the next point the walk reaches; disarming RELEASES whatever is still
1567
+ * pending rather than stranding it.
1487
1568
  *
1488
1569
  * A pause is read and answered through the run's interrupts. */
1489
1570
  async setRunBreakpoints(runId, breakpoints, opts) {
package/dist/index.d.ts CHANGED
@@ -128,5 +128,5 @@ export { InteractiveSession } from "./interactive.js";
128
128
  export type { InteractiveSessionOps } from "./interactive.js";
129
129
  export { ClientToolHost, clientToolsURL, CLIENT_TOOL_SUBPROTOCOL } from "./client-tools.js";
130
130
  export type { ClientToolSchema, ClientToolInvocation, ConnectClientToolsOptions, WebSocketLike, WebSocketCtor, } from "./client-tools.js";
131
- export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, Agent, AgentStatus, AgentUsage, RunResult, ToolChoiceOptions, CancelAgentResult, ListAgentsResponse, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, CancelTurnResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, UserTokenMeta, ListUserTokensResponse, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, PauseResult, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, Hook, HookFailMode, HookPhase, HookToolCall, HookToolResult, ListHooksResponse, PostHookCall, PostHookResult, PreHookCall, PreHookResult, RegisterHookOptions, RegisterHookResponse, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, EnsureCodeAgentOptions, EnsureCodeAgentResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, EffectiveConfigResponse, EffectiveConfigSource, EffectiveValue, RetuneRunResponse, RunConfigRecord, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, } from "./types.js";
131
+ export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, Agent, AgentStatus, AgentUsage, RunResult, RunSpec, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, CancelTurnResult, ReviewRunResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, UserTokenMeta, ListUserTokensResponse, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, PauseResult, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, Hook, HookFailMode, HookPhase, HookToolCall, HookToolResult, ListHooksResponse, PostHookCall, PostHookResult, PreHookCall, PreHookResult, RegisterHookOptions, RegisterHookResponse, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, EnsureCodeAgentOptions, EnsureCodeAgentResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, EffectiveConfigResponse, EffectiveConfigSource, EffectiveValue, RetuneRunResponse, RunConfigRecord, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, } from "./types.js";
132
132
  export { AgentIDInUseError, AgentNotFoundError, AlreadyPausingError, AuthError, BackpressureError, HookNotFoundError, NotFoundError, InvalidArgumentError, ChannelCursorRegressionError, LoomcycleError, NotPausedError, PauseNotConfiguredError, PerUserQuotaExhaustedError, SessionBusyError, SessionNotFoundError, SnapshotNotFoundError, SnapshotTooLargeError, SnapshotVersionError, SubstrateToolRefusedError, UnavailableError, } from "./errors.js";
package/dist/types.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * `client.ts` for the input shapes (RunOptions, CreateSnapshotOptions,
8
8
  * etc.) — those are translated to snake_case in the request body.
9
9
  */
10
- export type EventType = "started" | "text" | "tool_call" | "tool_result" | "usage" | "done" | "error" | "retry" | "host_widened" | "session" | "agent" | "awaiting_input" | "steer" | "context_compaction" | "capability_inert" | "limit" | "override" | "context_recap" | "context_state" | "context_distill_declined" | "context_exhausted" | "thinking" | "turn_cancelled" | "provider_fallback" | "fallback_suppressed" | "model_downgraded" | "cache_invalidated" | "reasoning_invalidated" | "channel_publish" | "channel_delivery" | "interruption_pending" | "spawn_child_started" | "spawn_child_result" | "prompt_snapshot" | "_meta";
10
+ export type EventType = "started" | "text" | "tool_call" | "tool_result" | "usage" | "done" | "error" | "retry" | "host_widened" | "session" | "agent" | "awaiting_input" | "awaiting_review" | "steer" | "context_compaction" | "capability_inert" | "hook_decision" | "limit" | "override" | "context_recap" | "context_state" | "context_distill_declined" | "context_exhausted" | "thinking" | "turn_cancelled" | "provider_fallback" | "fallback_suppressed" | "model_downgraded" | "cache_invalidated" | "reasoning_invalidated" | "channel_publish" | "channel_delivery" | "interruption_pending" | "spawn_child_started" | "spawn_child_result" | "prompt_snapshot" | "_meta";
11
11
  export interface ToolUse {
12
12
  id: string;
13
13
  name: string;
@@ -74,6 +74,7 @@ export interface RunConfigRecord {
74
74
  context?: Record<string, unknown>;
75
75
  max_context_tokens?: number;
76
76
  run_timeout_seconds?: number;
77
+ review_ttl_seconds?: number;
77
78
  routing?: {
78
79
  provider?: string;
79
80
  model?: string;
@@ -93,6 +94,7 @@ export interface RunConfigRecord {
93
94
  inject_tool_guide?: boolean;
94
95
  };
95
96
  interactive?: boolean;
97
+ review?: boolean;
96
98
  interruption?: {
97
99
  enabled?: boolean;
98
100
  kinds?: string[];
@@ -251,6 +253,29 @@ export interface ErrorInfo {
251
253
  * instructions. */
252
254
  retry_after_ms?: number;
253
255
  }
256
+ /** What one hook did to one call, or to the run (the `hook_decision`
257
+ * payload). */
258
+ export interface HookDecisionInfo {
259
+ /** `"<owner>/<name>"`. */
260
+ hook: string;
261
+ phase: HookPhase;
262
+ /** The call a tool hook decided on; absent for agent_start / agent_stop. */
263
+ tool_use_id?: string;
264
+ tool_name?: string;
265
+ /** `block` and `hold` are agent_stop's: the model was sent back with
266
+ * `reason`, or the answer is held for a verdict. */
267
+ decision: "deny" | "rewrite_input" | "rewrite_output" | "context" | "block" | "hold" | "unavailable";
268
+ /** For `unavailable`: `open` (the call went ahead) or `closed` (refused). */
269
+ fail_mode?: "open" | "closed";
270
+ /** A deny's or block's text, a hold's reason, or the error that made the
271
+ * hook unavailable. */
272
+ reason?: string;
273
+ /** For `rewrite_input`: the input the tool actually ran with. */
274
+ updated_input?: unknown;
275
+ /** For `context`: what was appended to the tool result (or, for
276
+ * agent_start, to the prompt). */
277
+ additional_context?: string;
278
+ }
254
279
  /** The payload on a `capability_inert` event: one tool the agent holds and
255
280
  * cannot use, because the capability gate that tool reads grants nothing.
256
281
  *
@@ -449,6 +474,16 @@ export interface AgentEvent {
449
474
  awaiting_input?: {
450
475
  since_turn?: number;
451
476
  };
477
+ /** Payload on `event: awaiting_review` — the run is held for a verdict.
478
+ * `round` is 1 on the first answer and counts up with each revision.
479
+ * `held_by` names the agent_stop hook that held it; absent when review
480
+ * arming did (and only that kind is released by disarming review). */
481
+ awaiting_review?: {
482
+ since_turn?: number;
483
+ round?: number;
484
+ expires_at?: string;
485
+ held_by?: string;
486
+ };
452
487
  /** Payload on `event: steer` (RFC AI) — the operator's drained turn. On a
453
488
  * re-attach replay, `source` is `"replay"`. Nil on all other event types. */
454
489
  user_input?: {
@@ -461,6 +496,8 @@ export interface AgentEvent {
461
496
  limit?: LimitInfo;
462
497
  /** Set on `capability_inert` events: a tool the agent holds and cannot use. */
463
498
  capability_inert?: CapabilityInertInfo;
499
+ /** Payload on `event: hook_decision`. */
500
+ hook_decision?: HookDecisionInfo;
464
501
  /** Set on `event: override` frames — what the operator changed, and from
465
502
  * what to what. */
466
503
  override?: OverrideInfo;
@@ -586,6 +623,12 @@ export interface RunOverrideOptions {
586
623
  * `false` releases a run that was started interactive. Omit to keep whatever
587
624
  * the run has; a retune of anything else must not disturb this. */
588
625
  interactive?: boolean;
626
+ /** Hold the run for an operator's verdict each time its model finishes,
627
+ * instead of completing: {@link LoomcycleClient.reviewRun} approves it, or
628
+ * rejects it with feedback it revises from (and is held again), or rejects
629
+ * it outright (status `rejected`). Settable while the run is going; `false`
630
+ * on a run that is held releases it as approved. */
631
+ review?: boolean;
589
632
  /** Let this run's agent ASK a human a question, overriding what its
590
633
  * definition allows.
591
634
  *
@@ -675,6 +718,10 @@ export interface RunOptions extends RunOverrideOptions {
675
718
  * its budget spans that wait, so the CPU-oriented default is often too low.
676
719
  * Ignored by LLM agents. 0 / omitted = inherit. */
677
720
  runTimeoutSeconds?: number;
721
+ /** With `review`: end a held answer that gets no verdict within this many
722
+ * seconds as rejected (stop reason `review_expired`). Each hold gets the
723
+ * full window; omit for no deadline. Set at start only. */
724
+ reviewTtlSeconds?: number;
678
725
  /** Per-run LLM sampling override (v0.28.0), merged PER FIELD over the
679
726
  * agent's own sampling (this wins; unset fields inherit). Omitted =
680
727
  * inherit entirely. */
@@ -682,6 +729,10 @@ export interface RunOptions extends RunOverrideOptions {
682
729
  /** Per-run tool choice (RFC DI): whether and which tool the model must
683
730
  * call, and for how many calls. REPLACES the agent's own whole. */
684
731
  toolChoice?: ToolChoiceOptions;
732
+ /** Per-run answer schema (RFC DI): the final answer is held to it where
733
+ * the model supports it, and returned parsed as `result.structured`.
734
+ * REPLACES the agent's own whole. */
735
+ outputFormat?: OutputFormatOptions;
685
736
  /** Per-run context-compaction override (v0.32.0), merged PER FIELD over
686
737
  * the agent's own compaction block (this wins; unset fields inherit).
687
738
  * Omitted = inherit entirely. Trigger compaction mid-run with
@@ -717,11 +768,19 @@ export interface RunOptions extends RunOverrideOptions {
717
768
  debug?: boolean;
718
769
  signal?: AbortSignal;
719
770
  }
720
- /** Per-run LLM sampling override (v0.28.0). Mirrors config.Sampling — every
721
- * field optional; an unset field inherits the agent's value. An explicit
722
- * `temperature: 0` is deterministic, NOT "unset". Each provider maps what it
723
- * supports (e.g. topK is Anthropic/Gemini/Ollama; frequencyPenalty/
724
- * presencePenalty/seed are OpenAI/DeepSeek/Ollama). */
771
+ /** The JSON schema a run's final answer must follow (RFC DI) — structured
772
+ * output. Same shape per-agent (AgentDef `output_format`) and per-run; a
773
+ * per-run value REPLACES the agent's whole. The parsed answer is
774
+ * `result.structured`. A model that cannot enforce it runs anyway, with a
775
+ * `capability_inert` event naming what was not enforced. */
776
+ export interface OutputFormatOptions {
777
+ /** The only kind, and the default when omitted. */
778
+ type?: "json_schema";
779
+ /** Label where a provider needs one (OpenAI does). Default "output". */
780
+ name?: string;
781
+ /** A JSON Schema whose root is `type: "object"`. */
782
+ schema: Record<string, unknown>;
783
+ }
725
784
  /** Whether and which tool the model must call, and for how many calls
726
785
  * (RFC DI). Same shape per-agent (AgentDef `tool_choice`) and per-run; a
727
786
  * per-run value REPLACES the agent's whole. A model that cannot enforce it
@@ -737,6 +796,11 @@ export interface ToolChoiceOptions {
737
796
  * and `tool`, which could then never finish). */
738
797
  until?: "first_call" | "until_called" | "always";
739
798
  }
799
+ /** Per-run LLM sampling override (v0.28.0). Mirrors config.Sampling — every
800
+ * field optional; an unset field inherits the agent's value. An explicit
801
+ * `temperature: 0` is deterministic, NOT "unset". Each provider maps what it
802
+ * supports (e.g. topK is Anthropic/Gemini/Ollama; frequencyPenalty/
803
+ * presencePenalty/seed are OpenAI/DeepSeek/Ollama). */
740
804
  export interface SamplingOptions {
741
805
  temperature?: number;
742
806
  topP?: number;
@@ -927,11 +991,19 @@ export interface ContinueOptions extends RunOverrideOptions {
927
991
  /** Optional ad-hoc per-run code-js wall-clock budget (seconds) for the
928
992
  * continuation's new run — see {@link RunOptions.runTimeoutSeconds}. */
929
993
  runTimeoutSeconds?: number;
994
+ /** With `review`: end a held answer that gets no verdict within this many
995
+ * seconds as rejected (stop reason `review_expired`). Each hold gets the
996
+ * full window; omit for no deadline. Set at start only. */
997
+ reviewTtlSeconds?: number;
930
998
  /** Per-continuation LLM sampling override — see {@link RunOptions.sampling}. */
931
999
  sampling?: SamplingOptions;
932
1000
  /** Per-run tool choice (RFC DI): whether and which tool the model must
933
1001
  * call, and for how many calls. REPLACES the agent's own whole. */
934
1002
  toolChoice?: ToolChoiceOptions;
1003
+ /** Per-run answer schema (RFC DI): the final answer is held to it where
1004
+ * the model supports it, and returned parsed as `result.structured`.
1005
+ * REPLACES the agent's own whole. */
1006
+ outputFormat?: OutputFormatOptions;
935
1007
  /** Per-continuation context-compaction override — see {@link RunOptions.compaction}. */
936
1008
  compaction?: CompactionOptions;
937
1009
  /** Per-continuation context-distillation override — see
@@ -962,7 +1034,9 @@ export interface ClientOptions {
962
1034
  * own fetch (e.g. node-fetch on older Node). */
963
1035
  fetch?: typeof fetch;
964
1036
  }
965
- export type AgentStatus = "running" | "completed" | "failed" | "cancelled";
1037
+ /** `configured` is a run created but not yet started (RFC DI). */
1038
+ /** `rejected` is a run a reviewer turned down without feedback (RFC DJ). */
1039
+ export type AgentStatus = "configured" | "running" | "completed" | "failed" | "cancelled" | "rejected";
966
1040
  export interface AgentUsage {
967
1041
  input_tokens?: number;
968
1042
  output_tokens?: number;
@@ -996,6 +1070,52 @@ export interface Agent {
996
1070
  * only (listings omit it), and only once the run has finished with
997
1071
  * something to report. */
998
1072
  result?: RunResult;
1073
+ /** The run's own configuration (RFC DI): the overrides it ran with, merged
1074
+ * over its definition. {@link LoomcycleClient.getAgent} only, like
1075
+ * `result`; absent when the run overrode nothing. */
1076
+ spec?: RunSpec;
1077
+ /** A CONFIGURED run's request as it will start (RFC DI) — what
1078
+ * {@link LoomcycleClient.updateConfiguredRun} edits. Snake_case wire keys;
1079
+ * present only while the run is configured, and never holds a secret. */
1080
+ draft?: Record<string, unknown>;
1081
+ }
1082
+ /** A run created without being started (RFC DI). */
1083
+ export interface ConfiguredRun {
1084
+ run_id: string;
1085
+ agent_id?: string;
1086
+ session_id?: string;
1087
+ status: "configured";
1088
+ /** The stored request, snake_case wire keys. */
1089
+ draft: Record<string, unknown>;
1090
+ }
1091
+ /** The fields {@link LoomcycleClient.updateConfiguredRun} may replace: a run's
1092
+ * options minus its agent, identity, secrets and transport knobs. */
1093
+ export type ConfiguredRunPatch = Partial<Omit<RunOptions, "agent" | "sessionId" | "tenantId" | "userId" | "agentId" | "userBearer" | "userCredentials" | "signal" | "debug">>;
1094
+ /** A run's own configuration record (RFC DI), as persisted — the values it
1095
+ * ran with after its per-run overrides were merged over its definition.
1096
+ * Keys and nested values are the server's snake_case wire names (not the
1097
+ * camelCase request options), so nested blocks are left untyped. */
1098
+ export interface RunSpec {
1099
+ sampling?: Record<string, unknown>;
1100
+ tool_choice?: ToolChoiceOptions;
1101
+ output_format?: OutputFormatOptions;
1102
+ compaction?: Record<string, unknown>;
1103
+ context?: Record<string, unknown>;
1104
+ max_context_tokens?: number;
1105
+ run_timeout_seconds?: number;
1106
+ review_ttl_seconds?: number;
1107
+ /** Which model serves the run: model / provider / tier / effort. */
1108
+ routing?: Record<string, unknown>;
1109
+ /** The run's budget: max_tokens / max_iterations / … */
1110
+ resources?: Record<string, unknown>;
1111
+ tuning?: Record<string, unknown>;
1112
+ /** Whether the run parks at its turn boundaries (current, after any retune). */
1113
+ interactive?: boolean;
1114
+ /** Whether the run is held for review when it finishes (current, after any retune). */
1115
+ review?: boolean;
1116
+ interruption?: Record<string, unknown>;
1117
+ /** The caller's host narrowing. */
1118
+ hosts?: Record<string, unknown>;
999
1119
  }
1000
1120
  /** A finished run's answer (RFC DI). */
1001
1121
  export interface RunResult {
@@ -1003,6 +1123,9 @@ export interface RunResult {
1003
1123
  final_text?: string;
1004
1124
  /** The final structured state of a stateful run. */
1005
1125
  state?: Record<string, unknown>;
1126
+ /** The final answer parsed against the run's `outputFormat`; absent when
1127
+ * the run had none or the answer was not a JSON object. */
1128
+ structured?: Record<string, unknown>;
1006
1129
  }
1007
1130
  export interface ListAgentsResponse {
1008
1131
  agents: Agent[];
@@ -1172,6 +1295,12 @@ export interface ReplaySessionResult {
1172
1295
  * transcript intact). This is NOT whole-run cancel ({@link
1173
1296
  * LoomcycleClient.cancelAgent}). For a team walk `parked` is false: the walk
1174
1297
  * was ended, not parked. */
1298
+ /** Result of {@link LoomcycleClient.reviewRun}. */
1299
+ export interface ReviewRunResult {
1300
+ run_id: string;
1301
+ decision: "approve" | "reject";
1302
+ delivered: boolean;
1303
+ }
1175
1304
  export interface CancelTurnResult {
1176
1305
  run_id: string;
1177
1306
  stopped: boolean;
@@ -1662,7 +1791,9 @@ export interface ResolveInterruptOptions {
1662
1791
  * the waiting Question tool proceeds. */
1663
1792
  disposition?: "answer" | "declined";
1664
1793
  }
1665
- export type HookPhase = "pre" | "post";
1794
+ /** `post_failure` runs only when the tool failed, before the post chain, with
1795
+ * the failure's classification in the payload. */
1796
+ export type HookPhase = "pre" | "post" | "post_failure" | "agent_start" | "agent_stop";
1666
1797
  export type HookFailMode = "open" | "closed";
1667
1798
  /** Hook is the full descriptor returned by listHooks. The id +
1668
1799
  * registered_at are loomcycle-assigned; the rest mirrors what was
@@ -1679,6 +1810,8 @@ export interface Hook {
1679
1810
  fail_mode: HookFailMode;
1680
1811
  timeout_ms: number;
1681
1812
  registered_at: string;
1813
+ /** The code-js body, when the hook has one instead of a callback_url. */
1814
+ code?: string;
1682
1815
  }
1683
1816
  /** RegisterHookOptions uses camelCase (JS norm for method parameters)
1684
1817
  * and is translated to snake_case in the request body — same split as
@@ -1695,12 +1828,18 @@ export interface RegisterHookOptions {
1695
1828
  /** Tool name globs (same syntax). Empty matches every tool. */
1696
1829
  tools?: string[];
1697
1830
  /** http:// or https:// URL loomcycle POSTs PreHookCall /
1698
- * PostHookCall payloads to. */
1699
- callbackUrl: string;
1831
+ * PostHookCall payloads to. Set this or `code`. */
1832
+ callbackUrl?: string;
1833
+ /** A code-js body in place of a webhook: JavaScript defining a
1834
+ * top-level `hook(ev)` that returns the decision. Its only tool is
1835
+ * `Interruption` (ask, notify). Needs code hooks enabled on the
1836
+ * server. Set this or `callbackUrl`. */
1837
+ code?: string;
1700
1838
  /** "open" (default) — webhook errors pass through. "closed" — webhook
1701
1839
  * errors fail the tool call with IsError=true. */
1702
1840
  failMode?: HookFailMode;
1703
- /** Per-call timeout. 0 / omitted = registry default (5 s). */
1841
+ /** Per-call timeout. 0 / omitted = registry default (5 s; 50 ms for a
1842
+ * code body, where it bounds each run of the code, capped at 1 s). */
1704
1843
  timeoutMs?: number;
1705
1844
  }
1706
1845
  export interface RegisterHookResponse {
@@ -1916,14 +2055,25 @@ export interface TeamRunTarget {
1916
2055
  * returns `run_id`, so a second connection can debug a walk you await. */
1917
2056
  mode?: "detach";
1918
2057
  /** Starter state ids to pause at, armed before the walk starts. Each is
1919
- * `"<state>"` (both phases) or `"<state>:before_dispatch"` /
1920
- * `"<state>:after_collection"`.
2058
+ * `"<state>"` or `"<state>:before_dispatch"`: the walk pauses before the
2059
+ * state dispatches its wave, with every prompt composed and nothing run.
1921
2060
  *
1922
2061
  * A walk can also be armed AFTER it starts — see
1923
2062
  * {@link LoomcycleClient.setRunBreakpoints} — which is the case this
1924
2063
  * argument cannot serve: you start a run expecting it to work, watch a wave
1925
- * go wrong, and want to stop before the next one. */
2064
+ * go wrong, and want to stop before the next one.
2065
+ *
2066
+ * `"<state>:review"` arms review instead — see {@link TeamRunTarget.review}. */
1926
2067
  breakpoints?: string[];
2068
+ /** Starter state ids whose member runs are held for an operator's verdict
2069
+ * when they finish: approve with {@link LoomcycleClient.reviewRun}, reject
2070
+ * with feedback the member revises from, or reject. A rejected member
2071
+ * reaches the sink as status `"rejected"` and does not count toward the
2072
+ * wave's `wait`. Also armable live as the breakpoint `"<state>:review"`. */
2073
+ review?: string[];
2074
+ /** With `review`: end a member hold nobody rules on within this many
2075
+ * seconds as rejected. Omit for no deadline. */
2076
+ reviewTtlSeconds?: number;
1927
2077
  }
1928
2078
  /** What {@link LoomcycleClient.runTeam} returns for `mode: "detach"` — the
1929
2079
  * handle, immediately, with the walk still running behind it.
@@ -2732,6 +2882,8 @@ export interface AgentDefOverlay {
2732
2882
  effort?: string;
2733
2883
  /** Whether and which tool the model must call (RFC DI). */
2734
2884
  tool_choice?: ToolChoiceOptions;
2885
+ /** The JSON schema the answer must follow (RFC DI). */
2886
+ output_format?: OutputFormatOptions;
2735
2887
  max_tokens?: number;
2736
2888
  max_iterations?: number;
2737
2889
  max_concurrent_children?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "1.92.0",
3
+ "version": "1.94.0",
4
4
  "description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 71 methods covering run streaming, agent metadata, pause/resume/state, resolver re-probe (resolveProbe — issue #88 operator escape hatch), operator-token admin (operatorTokenDef — RFC L OSS multi-tenant auth) + whoami (RFC L authoritative principal, v0.17.0) + tenant-scoped listUsers / listUserAgents, dynamic MCP registration (mcpServerDef + v0.18.0 typed mcpServerDefVerify + ensureMcpServer idempotent register-if-changed), snapshot lifecycle, memory admin (incl. v0.9.0 Vector Memory embed_stats + reembed AND v0.11.5 setMemoryEntry + deleteMemoryEntry), interruption resolve, hook management, v0.8.22 substrate admin (agentDef + skillDef), v0.9.x n8n Phase 0 (listChannels + streamUserRunStates), v0.9.x Channel CRUD (publishChannel + subscribeChannel + peekChannel + ackChannel), v0.11.5 Channel admin CRUD (createChannel + updateChannel + deleteChannel — runtime substrate; yaml channels refuse mutation with HTTP 409), v0.9.x content_sha256 verify, v0.9.1 transcript first-cycle, v0.9.x dynamic MCP server registration (mcpServerDef + MCPServerDefVerifyResult), v0.10.3 Library v2 enumeration (listLibraryAgents + listLibrarySkills + listLibraryMcpServers), and v0.11.0 LLM Gateway (llmChat + llmStream — direct provider routing without agent overhead; primary target is n8n's LoomCycleChatModel AI Agent sub-node and any LangChain-compatible consumer). v0.10.1 — dual ESM + CommonJS distribution (additive — ESM consumers unchanged; CJS consumers like n8n's community-node loader now work). v0.19.0 — typed inline code-js agent ingestion (AgentDefOverlay.code_body + ensureCodeAgent — register a deterministic code agent through the substrate with no host filesystem bind; RFC J). v0.20.0 — ensureMcpServer surfaces discoveredToolCount straight from create (loomcycle now auto-discovers MCP tools at ingestion); rediscover is now an explicit force-refresh. v0.21.0 — run/continue accept optional non-secret `metadata` (repo name, review policy, …) passed to the agent, symmetric with the WebHook/Schedule trigger paths. v0.22.0 — version-aligned lockstep release; no client-surface change (RFC N tenant isolation of the agent/skill/MCP/Schedule/Webhook definition plane + real op-schemas on the builtin MCP meta-tools are both server-side). v0.23.0 — version-aligned lockstep release; no client-surface change (RFCs O/P/R MCP-server hardening + thin client and the RFC Q DeepSeek tool-content fix are all server-side / MCP-transport-side). v0.24.0 — purgeChannel clears a channel's buffered messages without deleting its definition (allowed on yaml-declared channels too, unlike deleteChannel — F20); AgentDefOverlay gains channels / evaluation_scopes / interruption so a COMPLETE interactive/multi-agent agent round-trips over the substrate (F14). (Consolidates the interim 0.24/0.25 package bumps, which were never tag-published, back into lockstep with the loomcycle v0.24.0 tag.) v0.25.0 — adds the RFC S channel fan-in/fan-out client twins: awaitChannels() (wait for any/all/at_least N messages across channels, or a timeout — non-committing) + broadcastChannels() (publish one payload to N channels in one atomic-pre-flight call), the client-facing counterparts of the in-band Channel.await / Channel.broadcast tool ops (the rest of v0.25.0 — the manual-management Web UI console + Context op=time + max_fires self-retiring schedules — is server-side / in-band, no client-surface change). v0.29.1 — Usage gains optional `max_context_tokens` (the serving model's context-window ceiling, stamped by the loop from Provider.Capabilities() on each usage event) so a consumer can render a 'context used / max' gauge without a hard-coded per-model table; additive + optional, no behavior change. (Lockstep catch-up: the field landed in loomcycle v0.29.0 but the adapter publish skipped on a version mismatch; v0.29.1 realigns the package version with the release tag so it publishes.) v0.33.0 — gRPC + TS client parity for the RFC Y external fan-out and the compaction surface: spawnRunBatch() (POST /v1/runs:batch — spawn up to 32 fresh runs concurrently in one call, combined index-aligned envelope, per-child failures in-envelope) + compactRun(runId) (POST /v1/runs/{run_id}/compact — summarize a parked run's context); plus per-run sampling + compaction overrides now accepted on runStreaming / continueSession (an explicit temperature 0 is preserved as deterministic, not dropped as falsy). (The gRPC half adds the matching SpawnRunBatch / CompactRun RPCs + the sampling/compaction fields on RunRequest/ContinueRequest — server-side.) v0.34.0 — version-aligned lockstep release; no client-surface change (context-transform plugins / RFC Z Phase 1a are server-side config; the exp7 hardening pass is server-side; the R2 cross-provider thinking-model downgrade surfaces a new `model_downgraded` SSE event the generic stream passes through unchanged). v0.35.0 — RFC AH dynamic filesystem volumes: volumeDef() (POST /v1/_volumedef — op-discriminated create/get/list/delete/purge; a Volume is flat, so delete unmaps + purge RemoveAll's, no retire/promote/fork) + listVolumes() / listEphemeralVolumes() (GET /v1/_volumes[/ephemeral] — tenant-scoped; host paths redacted for non-operator callers). Tenant-confined; the runtime derives the path inside an operator-blessed dynamic_root, so callers pass name + mode, never a host path. v1.1.1 — RFC AI interactive agentic sessions: an `interactive: true` flag on runStreaming/continueSession (a run that parks at end_turn for steering) + sendRunInput(runId, text) (POST /v1/runs/{id}/input — steer a live run) + streamRunByID(runId, {fromSeq}) (GET /v1/runs/{id}/stream — re-attach by run_id; the operator's prior turns replay as `steer` events so a cold client reconstructs the whole conversation) + a high-level InteractiveSession driver (client.interactiveSession / attachInteractiveSession — events()/send()/cancel(), the adapter port of the Web UI run terminal). The AgentEvent union gains awaiting_input/steer/context_compaction frames. Version-aligned with the loomcycle v1.1.x line so the v1.1.1 tag publishes it (also carrying the previously-unpublished v0.35.0 volume surface). v1.4.0 — RFC AL Path VFS + RFC AK Document on the wire: path(input) (POST /v1/_path — a Unix-like filesystem over Memory/Volumes/Documents; resolve/ls/stat/mkdir/mv/rm) + document(input) (POST /v1/_document — chunked-graph documents; 13 ops, needs SQL Memory on the sidecar). Scope (agent/user/tenant) + tenant are resolved server-side from the authenticated principal, never the wire; an off-run scope:'user' op keys on the principal subject so it interoperates with that user's agent runs. New PathToolInput / DocumentToolInput types; responses are op-varying (unknown — narrow as needed). v1.7.0 — RFC AT image/vision input: the PromptContent union gains an `image` variant ({ type:'image'; media_type: ImageMediaType; data: base64-no-prefix }) accepted in a user segment by runStreaming / continueSession (segments pass through unchanged — no method change). The model must be vision-capable or the run errors before the call. New ImageMediaType type (image/png|jpeg|gif|webp). v1.12.1 — Path/Document browse-by-subject + the full Document op set (RFC AS/AK): path(input, opts) / document(input, opts) accept optional scopeId / tenant browse overrides sent as ?scope_id= / ?tenant= query params (server reads them from the URL, re-checks authorization; omit both to browse your own subject — byte-identical to the pre-RFC-AS request), and DocumentToolInput.op now covers all 16 backend ops (adds set_path, export_md, import_md) with the matching include_metadata / markdown fields. Additive — existing path() / document() callers are unchanged. v1.16.0 — RFC BC client-executed tools (local tool host): connectClientTools({tools,onInvoke}) opens a persistent WebSocket to /v1/client-tools, registers tools this client runs on the user's machine (browser DOM / files / shell), and answers the invoke frames loomcycle routes when an agent of your principal calls a client:<tool> — returning your reply as an ordinary tool result. Returns a ClientToolHost driver (.close() to stop; auto-reconnect); dependency-free (global WebSocket in browsers / Node 22+, or an injected WebSocketImpl like the ws package on older Node); the bearer rides the Sec-WebSocket-Protocol subprotocol (browsers can't set an Authorization header on a WebSocket). The runtime's first WebSocket surface. v1.45.0 — RFC BL P5 subject erasure: erasureReport(subject, {tenant}) (GET /v1/_erasure — what this deployment holds about one subject, in three tiers: deletable with existing primitives, subject-keyed but not deletable, and facts ABOUT the subject in scopes they do not own) + erasureExecute(subject, {dryRun, confirm, tenant}) (POST /v1/_erasure — removes tiers 1 and 2). DEFAULTS TO A DRY RUN: dryRun defaults true and a live run also requires confirm === subject. The tier-3 residue is traceable only through the subject's chats, which a live run deletes, so a report afterwards shows rows: 0 while those facts remain — the returned object is the only durable record of what was not reached; persist it. New ErasureReport / ErasureResult / ErasureTier / ErasureResidue types. v1.47.0 — RFC BV memory-view SDK: memorySearch() (POST /v1/_memory/search — off-run unified semantic search spanning k/v entries AND document-chunk bodies in one ranked list, each hit tagged kind memory|document with chunk_id on document hits) + memoryEmbedStats(scope) + reembedMemory(scope, scopeId, {dryRun,limit}) (the Vector Memory embed-admin reads the memory-view console needs; dry_run defaults true). Fact reads (list_facts + get_chunk's entity block) ride the existing document() passthrough. Additive — existing callers unchanged. v1.61.0 — RFC CJ per-run context-window override: runStreaming / continueSession accept an optional maxContextTokens (integer tokens) that wins over the agent's own max_context_tokens; omitted inherits it (which defers to the provider/driver default). Distinct from a model's output cap; primarily for local inference (Ollama num_ctx). Serialized as the snake_case max_context_tokens field on POST /v1/runs + the continuation body; additive, existing callers unchanged. v1.72.1 — the TeamDef version lifecycle: listTeamVersions(name) (op=list — every version of one team, newest first), promoteTeam(defId) (op=promote — point the active pointer, which is what a run BY NAME executes; forkTeam defaults to promote:false, so authoring and putting in force stay two steps), retireTeam(defId, retired) (op=retire — reversible and version-scoped, unlike deleteTeam) and verifyTeam(name, contentSha256) (op=verify — the drift check for a workflow kept in source control and pushed to several deployments; an absent team answers deployed:false rather than raising). The ops existed on the substrate and over HTTP; a client that could author a team could not put one in force.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",