@loomcycle/client 1.110.0 → 1.112.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.
package/README.md CHANGED
@@ -143,6 +143,9 @@ The low-level primitives (`runStreaming({interactive:true})` + `sendRunInput` +
143
143
  | `cancelAgent(agentId, opts?)` | `Promise<{ cancelledCount: number }>` | Cascades to children via `parent_agent_id`. Idempotent. |
144
144
  | `listUserAgents(userId, opts?)` | `Promise<Agent[]>` | Optional filter by status (`running` / `completed` / `failed` / `cancelled`). |
145
145
  | `listWalkRuns(walkId, { limit?, cursor? })` | `Promise<WalkRunsPage>` | One page of a team walk's runs — its own run and every member, oldest first: `{ agents, next_cursor }`. Pass `next_cursor` back as `cursor`; `""` on the last page. `limit` defaults to 100, at most 1000. Raises `NotFoundError` for a walk you cannot read. |
146
+ | `listChildRuns(parentRunId, { limit?, cursor? })` | `Promise<WalkRunsPage>` | One page of a run's direct children (the runs it started itself), of every status, oldest first, paged like `listWalkRuns`. Not the run itself, and not its grandchildren. Raises `NotFoundError` for a run you cannot read. |
147
+ | `deleteRunTree(runId)` | `Promise<RunTreeDeletion>` | Permanently delete a run and every run it spawned, with what is stored about them. The usage ledger is kept. Needs the `runs:delete` scope. Returns `{ deleted_runs, counts, kept, not_reached }`; an unknown, already deleted or unreadable run returns `deleted_runs: 0` instead of raising. A tree with a live or paused run deletes nothing and raises with `code: "run_tree_live"`. |
148
+ | `deleteSession(sessionId, { cascade: "children" })` | `Promise<RunTreeDeletion>` | The same for every run of a session, each with the runs it spawned. `cascade: "children"` is required. |
146
149
  | `getTranscript(sessionId)` | `Promise<TranscriptResponse>` | Persisted event log; one row per event with seq/run_id/ts_ns/type/event. |
147
150
  | `health()` | `Promise<HealthResponse>` | Liveness probe. Hits `/healthz` (no `/v1` prefix). Unauthenticated. |
148
151
  | `getConfig(opts?)` | `Promise<ConfigResponse>` | v1.38.0 — instance configuration: build identity, the feature matrix, and the live provider/model/search cascade with `active`/`selected`. `view` names the disclosure level (`public` / `authenticated` / `admin`). Also readable with **no bearer** against a deployment running `LOOMCYCLE_PUBLIC_CONFIG=1`, which serves the narrower `public` view — the landing-page case. |
@@ -138,6 +138,8 @@ function runBody(opts) {
138
138
  body.idempotency_key = opts.idempotencyKey;
139
139
  if (opts.maxWallSeconds !== undefined)
140
140
  body.max_wall_seconds = opts.maxWallSeconds;
141
+ if (opts.retention !== undefined)
142
+ body.retention = opts.retention;
141
143
  if (opts.metadata !== undefined)
142
144
  body.metadata = opts.metadata;
143
145
  if (opts.runTimeoutSeconds !== undefined)
@@ -601,6 +603,35 @@ class LoomcycleClient {
601
603
  body.reason = opts.reason;
602
604
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/compact`, body, opts);
603
605
  }
606
+ /** Permanently delete a run and every run it spawned, with what is stored
607
+ * about them: transcripts, their sessions when no other run is left in
608
+ * them, interrupts, evaluations of them, queued memory rows and indexed
609
+ * turns. The usage ledger (tokens, cost) is kept. Mirrors
610
+ * `DELETE /v1/runs/{run_id}/tree`.
611
+ *
612
+ * Needs the `runs:delete` scope (an admin and a tenant operator have it;
613
+ * any other token only if it was granted at mint) — a token without it
614
+ * raises `LoomcycleError` with status 403. A run that does not exist, was
615
+ * already deleted, or is not yours to read resolves with `deleted_runs: 0`
616
+ * rather than raising, so repeating the call is safe. A tree holding a run
617
+ * that is still running, awaiting input or paused deletes nothing and
618
+ * raises `LoomcycleError` with `code: "run_tree_live"` (status 409): cancel
619
+ * it first. `not_reached` names where a copy may remain that this call
620
+ * cannot remove. To discard a configured run that never started, use
621
+ * {@link LoomcycleClient.deleteConfiguredRun}. */
622
+ async deleteRunTree(runId, opts) {
623
+ return (0, fetch_helpers_js_1.deleteJSON)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/tree`, opts);
624
+ }
625
+ /** Permanently delete every run of a session, each with the runs it
626
+ * spawned — {@link LoomcycleClient.deleteRunTree} for all of them at once.
627
+ * `cascade: "children"` is required and is the only mode: there is no
628
+ * delete that leaves sub-agent runs behind. Mirrors
629
+ * `DELETE /v1/sessions/{session_id}?cascade=children`. Same scope, same
630
+ * zero-count answer for a session you cannot read, same `run_tree_live`
631
+ * refusal. */
632
+ async deleteSession(sessionId, opts) {
633
+ return (0, fetch_helpers_js_1.deleteJSON)(this.ctx, `/v1/sessions/${encodeURIComponent(sessionId)}?cascade=${encodeURIComponent(opts.cascade)}`, opts);
634
+ }
604
635
  /**
605
636
  * Replay a session's transcript into a NEW session bound to a (possibly
606
637
  * different) target agent, so that agent continues from the same context
@@ -678,7 +709,8 @@ class LoomcycleClient {
678
709
  const resp = await (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/agents/${encodeURIComponent(agentId)}/cancel`, { reason: opts?.reason ?? "" }, opts);
679
710
  return { cancelledCount: resp.cancelled_count };
680
711
  }
681
- /** List a user's recent agent runs, optionally filtered by status.
712
+ /** List a user's recent agent runs, optionally filtered by status. With no
713
+ * `status` only running runs are returned; `"all"` returns every status.
682
714
  *
683
715
  * v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
684
716
  * whose `parent_agent_id` matches. The server still returns the
@@ -715,6 +747,23 @@ class LoomcycleClient {
715
747
  const resp = await (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/runs?${params.toString()}`, opts);
716
748
  return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
717
749
  }
750
+ /** One page of a run's direct children — the runs it started itself, for
751
+ * example through the Agent tool — of every status, oldest first. Not the
752
+ * run itself, and not its grandchildren: call it again on a child for
753
+ * those. Rows are {@link LoomcycleClient.listWalkRuns}' rows, and none
754
+ * carries a `result`. Pass the page's `next_cursor` back as `cursor` for
755
+ * the next one; it is "" on the last. `limit` defaults to 100, at most
756
+ * 1000. Mirrors `GET /v1/runs?parent_run_id=`. Raises NotFoundError for an
757
+ * unknown run, or one the caller may not see. */
758
+ async listChildRuns(parentRunId, opts) {
759
+ const params = new URLSearchParams({ parent_run_id: parentRunId });
760
+ if (opts?.limit !== undefined)
761
+ params.set("limit", String(opts.limit));
762
+ if (opts?.cursor)
763
+ params.set("cursor", opts.cursor);
764
+ const resp = await (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/runs?${params.toString()}`, opts);
765
+ return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
766
+ }
718
767
  /** Aggregated token-usage + cost report (RFC AV). Group by any of
719
768
  * tenant/user/provider/model/source over an optional time window; group by
720
769
  * `source` for the operator-vs-tenant split. Tenant-scoped server-side: a
@@ -772,6 +821,36 @@ class LoomcycleClient {
772
821
  params.set("tenant", opts.tenant);
773
822
  return (0, fetch_helpers_js_1.deleteRequest)(this.ctx, `/v1/_limits?${params.toString()}`, opts);
774
823
  }
824
+ /** The timed no-trace overrides in force: agents whose runs are being
825
+ * stored although they normally store none. An admin sees every tenant's
826
+ * (or one with `tenant`); a tenant operator sees its own. Mirrors
827
+ * `GET /v1/_retention/overrides`. */
828
+ async listRetentionOverrides(opts) {
829
+ const q = opts?.tenant ? `?tenant=${encodeURIComponent(opts.tenant)}` : "";
830
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/_retention/overrides${q}`, opts);
831
+ }
832
+ /** Store the runs of one no-trace agent until `until`, to debug it. At
833
+ * most 24 hours ahead; setting one replaces the last. It lifts a mode
834
+ * that came from the agent's definition or the run request, never one a
835
+ * token requires. Audited. `tenant` is admin-only: a tenant operator's
836
+ * override is always for its own tenant. Mirrors
837
+ * `PUT /v1/_retention/overrides`. */
838
+ async setRetentionOverride(body, opts) {
839
+ const until = body.until instanceof Date ? body.until.toISOString() : body.until;
840
+ const wire = { agent: body.agent, until };
841
+ if (body.tenant !== undefined)
842
+ wire.tenant = body.tenant;
843
+ return (0, fetch_helpers_js_1.putJSON)(this.ctx, "/v1/_retention/overrides", wire, opts);
844
+ }
845
+ /** End an agent's no-trace override before it runs out. Clearing one that
846
+ * is not there is not an error. Mirrors
847
+ * `DELETE /v1/_retention/overrides`. */
848
+ async clearRetentionOverride(agent, opts) {
849
+ const params = new URLSearchParams({ agent });
850
+ if (opts?.tenant)
851
+ params.set("tenant", opts.tenant);
852
+ return (0, fetch_helpers_js_1.deleteRequest)(this.ctx, `/v1/_retention/overrides?${params.toString()}`, opts);
853
+ }
775
854
  /** Ask a decision model typed questions (`choice` / `noul` / `score`) about
776
855
  * `state` and get each answer with its probabilities. A decision model does
777
856
  * not write: there is no reply to parse and the call costs a few output
@@ -851,9 +930,51 @@ class LoomcycleClient {
851
930
  * scopes are DERIVED server-side from the member's access_mode (never sent),
852
931
  * and the plaintext `token` is returned exactly ONCE — store it now, it is
853
932
  * never retrievable again. 404 for an unknown/cross-tenant subject; 409 for
854
- * a disabled user. */
933
+ * a disabled user.
934
+ *
935
+ * `ttlSeconds` gives the token a fixed lifetime: it stops authenticating
936
+ * when that runs out, and the answer carries `expires_at`. It cannot run
937
+ * past the end of the token making the call. `name` labels it (stored as
938
+ * `u-<name>`).
939
+ * `maxActive` keeps at most that many of the user's tokens alive — the
940
+ * oldest beyond it are retired at once and listed in `retired`.
941
+ *
942
+ * `agents` limits the token to starting those agents as top-level runs, and
943
+ * to the run endpoints: it is refused everywhere else (403
944
+ * `restricted_token`), and refused any other agent (403
945
+ * `agent_not_allowed`). An agent that a listed one spawns is not limited.
946
+ * An empty list is refused; omit the option for no limit.
947
+ *
948
+ * `overrides` locks the per-run settings for runs the token starts, and
949
+ * for retunes it makes: `"none"` locks them all (model, provider, tier,
950
+ * effort, sampling, limits, output format and the rest), a list names the
951
+ * ones it may still set. A request that sets a locked one is refused with
952
+ * 403 `override_not_allowed`.
953
+ *
954
+ * `rate` bounds how often the token may start runs: `perMinute` runs a
955
+ * minute, with `burst` allowed at once from idle (default: `perMinute`).
956
+ * A start past the rate is refused with 429 `rate_limited` and a
957
+ * `Retry-After` header.
958
+ *
959
+ * With none of the options the request has no body, as before. */
855
960
  async mintUserToken(subject, opts) {
856
- return (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/_users/${encodeURIComponent(subject)}/tokens`, undefined, opts);
961
+ const body = {};
962
+ if (opts?.ttlSeconds !== undefined)
963
+ body.ttl_seconds = opts.ttlSeconds;
964
+ if (opts?.name !== undefined)
965
+ body.name = opts.name;
966
+ if (opts?.maxActive !== undefined)
967
+ body.max_active = opts.maxActive;
968
+ if (opts?.agents !== undefined)
969
+ body.agents = opts.agents;
970
+ if (opts?.overrides !== undefined)
971
+ body.overrides = opts.overrides;
972
+ if (opts?.rate !== undefined) {
973
+ body.rate = { per_minute: opts.rate.perMinute, burst: opts.rate.burst };
974
+ }
975
+ if (opts?.retention !== undefined)
976
+ body.retention = opts.retention;
977
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/_users/${encodeURIComponent(subject)}/tokens`, Object.keys(body).length > 0 ? body : undefined, { signal: opts?.signal });
857
978
  }
858
979
  /** List the caller's own user's delegated tokens — METADATA ONLY (never the
859
980
  * plaintext or hash). `active` applies the auth-layer validity rule so a
@@ -2323,6 +2444,9 @@ class LoomcycleClient {
2323
2444
  if (opts?.walkId) {
2324
2445
  params.set("walk_id", opts.walkId);
2325
2446
  }
2447
+ if (opts?.parentRunId) {
2448
+ params.set("parent_run_id", opts.parentRunId);
2449
+ }
2326
2450
  const qs = params.toString();
2327
2451
  const path = `/v1/users/${encodeURIComponent(userId)}/agents/stream` +
2328
2452
  (qs ? `?${qs}` : "");
package/dist/cjs/index.js CHANGED
@@ -17,6 +17,8 @@
17
17
  * cancelAgent(agentId, opts?): Promise<CancelAgentResult>
18
18
  * listUserAgents(userId, opts?): Promise<Agent[]>
19
19
  * listWalkRuns(walkId, opts?): Promise<WalkRunsPage>
20
+ * deleteRunTree(runId, opts?): Promise<RunTreeDeletion> // needs runs:delete
21
+ * deleteSession(sessionId, {cascade: "children"}): Promise<RunTreeDeletion>
20
22
  * getTranscript(sessionId): Promise<TranscriptResponse>
21
23
  * health(): Promise<HealthResponse>
22
24
  * listUsers(opts?): Promise<ListUsersResponse> // tenant-scoped (RFC L)
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, DecideRequest, DecideResponse, DecisionModelsResponse, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, InterruptListResponse, InterruptStatus, WalkRunsPage, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelPeekResult, TeamChannelReleaseResult, TeamChannelsResult, 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, 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, TeamDraft, TeamDraftVerification, 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, DecideRequest, DecideResponse, DecisionModelsResponse, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, InterruptListResponse, InterruptStatus, WalkRunsPage, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelPeekResult, TeamChannelReleaseResult, TeamChannelsResult, 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, RetentionOverride, PersistentVolumesResponse, EphemeralVolumesResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, RunTreeDeletion, 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, TeamDraft, TeamDraftVerification, 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);
@@ -312,6 +312,36 @@ export declare class LoomcycleClient {
312
312
  reason?: string;
313
313
  signal?: AbortSignal;
314
314
  }): Promise<CompactRunResult>;
315
+ /** Permanently delete a run and every run it spawned, with what is stored
316
+ * about them: transcripts, their sessions when no other run is left in
317
+ * them, interrupts, evaluations of them, queued memory rows and indexed
318
+ * turns. The usage ledger (tokens, cost) is kept. Mirrors
319
+ * `DELETE /v1/runs/{run_id}/tree`.
320
+ *
321
+ * Needs the `runs:delete` scope (an admin and a tenant operator have it;
322
+ * any other token only if it was granted at mint) — a token without it
323
+ * raises `LoomcycleError` with status 403. A run that does not exist, was
324
+ * already deleted, or is not yours to read resolves with `deleted_runs: 0`
325
+ * rather than raising, so repeating the call is safe. A tree holding a run
326
+ * that is still running, awaiting input or paused deletes nothing and
327
+ * raises `LoomcycleError` with `code: "run_tree_live"` (status 409): cancel
328
+ * it first. `not_reached` names where a copy may remain that this call
329
+ * cannot remove. To discard a configured run that never started, use
330
+ * {@link LoomcycleClient.deleteConfiguredRun}. */
331
+ deleteRunTree(runId: string, opts?: {
332
+ signal?: AbortSignal;
333
+ }): Promise<RunTreeDeletion>;
334
+ /** Permanently delete every run of a session, each with the runs it
335
+ * spawned — {@link LoomcycleClient.deleteRunTree} for all of them at once.
336
+ * `cascade: "children"` is required and is the only mode: there is no
337
+ * delete that leaves sub-agent runs behind. Mirrors
338
+ * `DELETE /v1/sessions/{session_id}?cascade=children`. Same scope, same
339
+ * zero-count answer for a session you cannot read, same `run_tree_live`
340
+ * refusal. */
341
+ deleteSession(sessionId: string, opts: {
342
+ cascade: "children";
343
+ signal?: AbortSignal;
344
+ }): Promise<RunTreeDeletion>;
315
345
  /**
316
346
  * Replay a session's transcript into a NEW session bound to a (possibly
317
347
  * different) target agent, so that agent continues from the same context
@@ -383,7 +413,8 @@ export declare class LoomcycleClient {
383
413
  reason?: string;
384
414
  signal?: AbortSignal;
385
415
  }): Promise<CancelAgentResult>;
386
- /** List a user's recent agent runs, optionally filtered by status.
416
+ /** List a user's recent agent runs, optionally filtered by status. With no
417
+ * `status` only running runs are returned; `"all"` returns every status.
387
418
  *
388
419
  * v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
389
420
  * whose `parent_agent_id` matches. The server still returns the
@@ -391,7 +422,7 @@ export declare class LoomcycleClient {
391
422
  * request); the adapter trims before returning. Useful for the
392
423
  * n8n trigger pattern "show me all sub-runs spawned by parent X." */
393
424
  listUserAgents(userId: string, opts?: {
394
- status?: AgentStatus;
425
+ status?: AgentStatus | "all";
395
426
  parentAgentId?: string;
396
427
  /** Super-admin tenant-focus (?tenant=, RFC L v0.17.0). Ignored
397
428
  * server-side for a tenant principal — its own tenant is forced. */
@@ -410,6 +441,19 @@ export declare class LoomcycleClient {
410
441
  cursor?: string;
411
442
  signal?: AbortSignal;
412
443
  }): Promise<WalkRunsPage>;
444
+ /** One page of a run's direct children — the runs it started itself, for
445
+ * example through the Agent tool — of every status, oldest first. Not the
446
+ * run itself, and not its grandchildren: call it again on a child for
447
+ * those. Rows are {@link LoomcycleClient.listWalkRuns}' rows, and none
448
+ * carries a `result`. Pass the page's `next_cursor` back as `cursor` for
449
+ * the next one; it is "" on the last. `limit` defaults to 100, at most
450
+ * 1000. Mirrors `GET /v1/runs?parent_run_id=`. Raises NotFoundError for an
451
+ * unknown run, or one the caller may not see. */
452
+ listChildRuns(parentRunId: string, opts?: {
453
+ limit?: number;
454
+ cursor?: string;
455
+ signal?: AbortSignal;
456
+ }): Promise<WalkRunsPage>;
413
457
  /** Aggregated token-usage + cost report (RFC AV). Group by any of
414
458
  * tenant/user/provider/model/source over an optional time window; group by
415
459
  * `source` for the operator-vs-tenant split. Tenant-scoped server-side: a
@@ -464,6 +508,38 @@ export declare class LoomcycleClient {
464
508
  tenant?: string;
465
509
  signal?: AbortSignal;
466
510
  }): Promise<void>;
511
+ /** The timed no-trace overrides in force: agents whose runs are being
512
+ * stored although they normally store none. An admin sees every tenant's
513
+ * (or one with `tenant`); a tenant operator sees its own. Mirrors
514
+ * `GET /v1/_retention/overrides`. */
515
+ listRetentionOverrides(opts?: {
516
+ /** Admin-only tenant focus; ignored for a tenant operator. */
517
+ tenant?: string;
518
+ signal?: AbortSignal;
519
+ }): Promise<{
520
+ overrides: RetentionOverride[];
521
+ }>;
522
+ /** Store the runs of one no-trace agent until `until`, to debug it. At
523
+ * most 24 hours ahead; setting one replaces the last. It lifts a mode
524
+ * that came from the agent's definition or the run request, never one a
525
+ * token requires. Audited. `tenant` is admin-only: a tenant operator's
526
+ * override is always for its own tenant. Mirrors
527
+ * `PUT /v1/_retention/overrides`. */
528
+ setRetentionOverride(body: {
529
+ agent: string;
530
+ until: string | Date;
531
+ tenant?: string;
532
+ }, opts?: {
533
+ signal?: AbortSignal;
534
+ }): Promise<RetentionOverride>;
535
+ /** End an agent's no-trace override before it runs out. Clearing one that
536
+ * is not there is not an error. Mirrors
537
+ * `DELETE /v1/_retention/overrides`. */
538
+ clearRetentionOverride(agent: string, opts?: {
539
+ /** Admin-only target tenant; ignored for a tenant operator. */
540
+ tenant?: string;
541
+ signal?: AbortSignal;
542
+ }): Promise<void>;
467
543
  /** Ask a decision model typed questions (`choice` / `noul` / `score`) about
468
544
  * `state` and get each answer with its probabilities. A decision model does
469
545
  * not write: there is no reply to parse and the call costs a few output
@@ -530,9 +606,47 @@ export declare class LoomcycleClient {
530
606
  * scopes are DERIVED server-side from the member's access_mode (never sent),
531
607
  * and the plaintext `token` is returned exactly ONCE — store it now, it is
532
608
  * never retrievable again. 404 for an unknown/cross-tenant subject; 409 for
533
- * a disabled user. */
609
+ * a disabled user.
610
+ *
611
+ * `ttlSeconds` gives the token a fixed lifetime: it stops authenticating
612
+ * when that runs out, and the answer carries `expires_at`. It cannot run
613
+ * past the end of the token making the call. `name` labels it (stored as
614
+ * `u-<name>`).
615
+ * `maxActive` keeps at most that many of the user's tokens alive — the
616
+ * oldest beyond it are retired at once and listed in `retired`.
617
+ *
618
+ * `agents` limits the token to starting those agents as top-level runs, and
619
+ * to the run endpoints: it is refused everywhere else (403
620
+ * `restricted_token`), and refused any other agent (403
621
+ * `agent_not_allowed`). An agent that a listed one spawns is not limited.
622
+ * An empty list is refused; omit the option for no limit.
623
+ *
624
+ * `overrides` locks the per-run settings for runs the token starts, and
625
+ * for retunes it makes: `"none"` locks them all (model, provider, tier,
626
+ * effort, sampling, limits, output format and the rest), a list names the
627
+ * ones it may still set. A request that sets a locked one is refused with
628
+ * 403 `override_not_allowed`.
629
+ *
630
+ * `rate` bounds how often the token may start runs: `perMinute` runs a
631
+ * minute, with `burst` allowed at once from idle (default: `perMinute`).
632
+ * A start past the rate is refused with 429 `rate_limited` and a
633
+ * `Retry-After` header.
634
+ *
635
+ * With none of the options the request has no body, as before. */
534
636
  mintUserToken(subject: string, opts?: {
535
637
  signal?: AbortSignal;
638
+ ttlSeconds?: number;
639
+ name?: string;
640
+ maxActive?: number;
641
+ agents?: string[];
642
+ overrides?: "none" | string[];
643
+ rate?: {
644
+ perMinute: number;
645
+ burst?: number;
646
+ };
647
+ /** `"none"`: every run the token starts is a no-trace run, whatever
648
+ * the request or the agent says. */
649
+ retention?: "none";
536
650
  }): Promise<MintedUserToken>;
537
651
  /** List the caller's own user's delegated tokens — METADATA ONLY (never the
538
652
  * plaintext or hash). `active` applies the auth-layer validity rule so a
package/dist/client.js CHANGED
@@ -135,6 +135,8 @@ function runBody(opts) {
135
135
  body.idempotency_key = opts.idempotencyKey;
136
136
  if (opts.maxWallSeconds !== undefined)
137
137
  body.max_wall_seconds = opts.maxWallSeconds;
138
+ if (opts.retention !== undefined)
139
+ body.retention = opts.retention;
138
140
  if (opts.metadata !== undefined)
139
141
  body.metadata = opts.metadata;
140
142
  if (opts.runTimeoutSeconds !== undefined)
@@ -598,6 +600,35 @@ export class LoomcycleClient {
598
600
  body.reason = opts.reason;
599
601
  return postJSON(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/compact`, body, opts);
600
602
  }
603
+ /** Permanently delete a run and every run it spawned, with what is stored
604
+ * about them: transcripts, their sessions when no other run is left in
605
+ * them, interrupts, evaluations of them, queued memory rows and indexed
606
+ * turns. The usage ledger (tokens, cost) is kept. Mirrors
607
+ * `DELETE /v1/runs/{run_id}/tree`.
608
+ *
609
+ * Needs the `runs:delete` scope (an admin and a tenant operator have it;
610
+ * any other token only if it was granted at mint) — a token without it
611
+ * raises `LoomcycleError` with status 403. A run that does not exist, was
612
+ * already deleted, or is not yours to read resolves with `deleted_runs: 0`
613
+ * rather than raising, so repeating the call is safe. A tree holding a run
614
+ * that is still running, awaiting input or paused deletes nothing and
615
+ * raises `LoomcycleError` with `code: "run_tree_live"` (status 409): cancel
616
+ * it first. `not_reached` names where a copy may remain that this call
617
+ * cannot remove. To discard a configured run that never started, use
618
+ * {@link LoomcycleClient.deleteConfiguredRun}. */
619
+ async deleteRunTree(runId, opts) {
620
+ return deleteJSON(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/tree`, opts);
621
+ }
622
+ /** Permanently delete every run of a session, each with the runs it
623
+ * spawned — {@link LoomcycleClient.deleteRunTree} for all of them at once.
624
+ * `cascade: "children"` is required and is the only mode: there is no
625
+ * delete that leaves sub-agent runs behind. Mirrors
626
+ * `DELETE /v1/sessions/{session_id}?cascade=children`. Same scope, same
627
+ * zero-count answer for a session you cannot read, same `run_tree_live`
628
+ * refusal. */
629
+ async deleteSession(sessionId, opts) {
630
+ return deleteJSON(this.ctx, `/v1/sessions/${encodeURIComponent(sessionId)}?cascade=${encodeURIComponent(opts.cascade)}`, opts);
631
+ }
601
632
  /**
602
633
  * Replay a session's transcript into a NEW session bound to a (possibly
603
634
  * different) target agent, so that agent continues from the same context
@@ -675,7 +706,8 @@ export class LoomcycleClient {
675
706
  const resp = await postJSON(this.ctx, `/v1/agents/${encodeURIComponent(agentId)}/cancel`, { reason: opts?.reason ?? "" }, opts);
676
707
  return { cancelledCount: resp.cancelled_count };
677
708
  }
678
- /** List a user's recent agent runs, optionally filtered by status.
709
+ /** List a user's recent agent runs, optionally filtered by status. With no
710
+ * `status` only running runs are returned; `"all"` returns every status.
679
711
  *
680
712
  * v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
681
713
  * whose `parent_agent_id` matches. The server still returns the
@@ -712,6 +744,23 @@ export class LoomcycleClient {
712
744
  const resp = await jsonFetch(this.ctx, `/v1/runs?${params.toString()}`, opts);
713
745
  return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
714
746
  }
747
+ /** One page of a run's direct children — the runs it started itself, for
748
+ * example through the Agent tool — of every status, oldest first. Not the
749
+ * run itself, and not its grandchildren: call it again on a child for
750
+ * those. Rows are {@link LoomcycleClient.listWalkRuns}' rows, and none
751
+ * carries a `result`. Pass the page's `next_cursor` back as `cursor` for
752
+ * the next one; it is "" on the last. `limit` defaults to 100, at most
753
+ * 1000. Mirrors `GET /v1/runs?parent_run_id=`. Raises NotFoundError for an
754
+ * unknown run, or one the caller may not see. */
755
+ async listChildRuns(parentRunId, opts) {
756
+ const params = new URLSearchParams({ parent_run_id: parentRunId });
757
+ if (opts?.limit !== undefined)
758
+ params.set("limit", String(opts.limit));
759
+ if (opts?.cursor)
760
+ params.set("cursor", opts.cursor);
761
+ const resp = await jsonFetch(this.ctx, `/v1/runs?${params.toString()}`, opts);
762
+ return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
763
+ }
715
764
  /** Aggregated token-usage + cost report (RFC AV). Group by any of
716
765
  * tenant/user/provider/model/source over an optional time window; group by
717
766
  * `source` for the operator-vs-tenant split. Tenant-scoped server-side: a
@@ -769,6 +818,36 @@ export class LoomcycleClient {
769
818
  params.set("tenant", opts.tenant);
770
819
  return deleteRequest(this.ctx, `/v1/_limits?${params.toString()}`, opts);
771
820
  }
821
+ /** The timed no-trace overrides in force: agents whose runs are being
822
+ * stored although they normally store none. An admin sees every tenant's
823
+ * (or one with `tenant`); a tenant operator sees its own. Mirrors
824
+ * `GET /v1/_retention/overrides`. */
825
+ async listRetentionOverrides(opts) {
826
+ const q = opts?.tenant ? `?tenant=${encodeURIComponent(opts.tenant)}` : "";
827
+ return jsonFetch(this.ctx, `/v1/_retention/overrides${q}`, opts);
828
+ }
829
+ /** Store the runs of one no-trace agent until `until`, to debug it. At
830
+ * most 24 hours ahead; setting one replaces the last. It lifts a mode
831
+ * that came from the agent's definition or the run request, never one a
832
+ * token requires. Audited. `tenant` is admin-only: a tenant operator's
833
+ * override is always for its own tenant. Mirrors
834
+ * `PUT /v1/_retention/overrides`. */
835
+ async setRetentionOverride(body, opts) {
836
+ const until = body.until instanceof Date ? body.until.toISOString() : body.until;
837
+ const wire = { agent: body.agent, until };
838
+ if (body.tenant !== undefined)
839
+ wire.tenant = body.tenant;
840
+ return putJSON(this.ctx, "/v1/_retention/overrides", wire, opts);
841
+ }
842
+ /** End an agent's no-trace override before it runs out. Clearing one that
843
+ * is not there is not an error. Mirrors
844
+ * `DELETE /v1/_retention/overrides`. */
845
+ async clearRetentionOverride(agent, opts) {
846
+ const params = new URLSearchParams({ agent });
847
+ if (opts?.tenant)
848
+ params.set("tenant", opts.tenant);
849
+ return deleteRequest(this.ctx, `/v1/_retention/overrides?${params.toString()}`, opts);
850
+ }
772
851
  /** Ask a decision model typed questions (`choice` / `noul` / `score`) about
773
852
  * `state` and get each answer with its probabilities. A decision model does
774
853
  * not write: there is no reply to parse and the call costs a few output
@@ -848,9 +927,51 @@ export class LoomcycleClient {
848
927
  * scopes are DERIVED server-side from the member's access_mode (never sent),
849
928
  * and the plaintext `token` is returned exactly ONCE — store it now, it is
850
929
  * never retrievable again. 404 for an unknown/cross-tenant subject; 409 for
851
- * a disabled user. */
930
+ * a disabled user.
931
+ *
932
+ * `ttlSeconds` gives the token a fixed lifetime: it stops authenticating
933
+ * when that runs out, and the answer carries `expires_at`. It cannot run
934
+ * past the end of the token making the call. `name` labels it (stored as
935
+ * `u-<name>`).
936
+ * `maxActive` keeps at most that many of the user's tokens alive — the
937
+ * oldest beyond it are retired at once and listed in `retired`.
938
+ *
939
+ * `agents` limits the token to starting those agents as top-level runs, and
940
+ * to the run endpoints: it is refused everywhere else (403
941
+ * `restricted_token`), and refused any other agent (403
942
+ * `agent_not_allowed`). An agent that a listed one spawns is not limited.
943
+ * An empty list is refused; omit the option for no limit.
944
+ *
945
+ * `overrides` locks the per-run settings for runs the token starts, and
946
+ * for retunes it makes: `"none"` locks them all (model, provider, tier,
947
+ * effort, sampling, limits, output format and the rest), a list names the
948
+ * ones it may still set. A request that sets a locked one is refused with
949
+ * 403 `override_not_allowed`.
950
+ *
951
+ * `rate` bounds how often the token may start runs: `perMinute` runs a
952
+ * minute, with `burst` allowed at once from idle (default: `perMinute`).
953
+ * A start past the rate is refused with 429 `rate_limited` and a
954
+ * `Retry-After` header.
955
+ *
956
+ * With none of the options the request has no body, as before. */
852
957
  async mintUserToken(subject, opts) {
853
- return postJSON(this.ctx, `/v1/_users/${encodeURIComponent(subject)}/tokens`, undefined, opts);
958
+ const body = {};
959
+ if (opts?.ttlSeconds !== undefined)
960
+ body.ttl_seconds = opts.ttlSeconds;
961
+ if (opts?.name !== undefined)
962
+ body.name = opts.name;
963
+ if (opts?.maxActive !== undefined)
964
+ body.max_active = opts.maxActive;
965
+ if (opts?.agents !== undefined)
966
+ body.agents = opts.agents;
967
+ if (opts?.overrides !== undefined)
968
+ body.overrides = opts.overrides;
969
+ if (opts?.rate !== undefined) {
970
+ body.rate = { per_minute: opts.rate.perMinute, burst: opts.rate.burst };
971
+ }
972
+ if (opts?.retention !== undefined)
973
+ body.retention = opts.retention;
974
+ return postJSON(this.ctx, `/v1/_users/${encodeURIComponent(subject)}/tokens`, Object.keys(body).length > 0 ? body : undefined, { signal: opts?.signal });
854
975
  }
855
976
  /** List the caller's own user's delegated tokens — METADATA ONLY (never the
856
977
  * plaintext or hash). `active` applies the auth-layer validity rule so a
@@ -2320,6 +2441,9 @@ export class LoomcycleClient {
2320
2441
  if (opts?.walkId) {
2321
2442
  params.set("walk_id", opts.walkId);
2322
2443
  }
2444
+ if (opts?.parentRunId) {
2445
+ params.set("parent_run_id", opts.parentRunId);
2446
+ }
2323
2447
  const qs = params.toString();
2324
2448
  const path = `/v1/users/${encodeURIComponent(userId)}/agents/stream` +
2325
2449
  (qs ? `?${qs}` : "");
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@
16
16
  * cancelAgent(agentId, opts?): Promise<CancelAgentResult>
17
17
  * listUserAgents(userId, opts?): Promise<Agent[]>
18
18
  * listWalkRuns(walkId, opts?): Promise<WalkRunsPage>
19
+ * deleteRunTree(runId, opts?): Promise<RunTreeDeletion> // needs runs:delete
20
+ * deleteSession(sessionId, {cascade: "children"}): Promise<RunTreeDeletion>
19
21
  * getTranscript(sessionId): Promise<TranscriptResponse>
20
22
  * health(): Promise<HealthResponse>
21
23
  * listUsers(opts?): Promise<ListUsersResponse> // tenant-scoped (RFC L)
@@ -132,5 +134,5 @@ export { InteractiveSession } from "./interactive.js";
132
134
  export type { InteractiveSessionOps } from "./interactive.js";
133
135
  export { ClientToolHost, clientToolsURL, CLIENT_TOOL_SUBPROTOCOL } from "./client-tools.js";
134
136
  export type { ClientToolSchema, ClientToolInvocation, ConnectClientToolsOptions, WebSocketLike, WebSocketCtor, } from "./client-tools.js";
135
- export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, WalkRunsPage, 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, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, 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, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, 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, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, 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, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, EffectiveConfigResponse, EffectiveConfigSource, EffectiveValue, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, } from "./types.js";
137
+ export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, WalkRunsPage, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, RunTreeDeletion, RunTreeNotReached, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, CancelTurnResult, ReviewRunResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenRestrictions, UserTokenMeta, ListUserTokensResponse, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, PauseResult, RetentionOverride, 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, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, 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, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, 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, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, 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, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, EffectiveConfigResponse, EffectiveConfigSource, EffectiveValue, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, } from "./types.js";
136
138
  export { AgentIDInUseError, AgentNotFoundError, AlreadyPausingError, AuthError, BackpressureError, NotFoundError, InvalidArgumentError, ChannelCursorRegressionError, LoomcycleError, NotPausedError, PauseNotConfiguredError, PerUserQuotaExhaustedError, PromptTooLargeError, RequestTooLargeError, SessionBusyError, SessionNotFoundError, SnapshotNotFoundError, SnapshotTooLargeError, SnapshotVersionError, SubstrateToolRefusedError, TokenLimitExceededError, UnavailableError, } from "./errors.js";
package/dist/index.js CHANGED
@@ -16,6 +16,8 @@
16
16
  * cancelAgent(agentId, opts?): Promise<CancelAgentResult>
17
17
  * listUserAgents(userId, opts?): Promise<Agent[]>
18
18
  * listWalkRuns(walkId, opts?): Promise<WalkRunsPage>
19
+ * deleteRunTree(runId, opts?): Promise<RunTreeDeletion> // needs runs:delete
20
+ * deleteSession(sessionId, {cascade: "children"}): Promise<RunTreeDeletion>
19
21
  * getTranscript(sessionId): Promise<TranscriptResponse>
20
22
  * health(): Promise<HealthResponse>
21
23
  * listUsers(opts?): Promise<ListUsersResponse> // tenant-scoped (RFC L)
package/dist/types.d.ts CHANGED
@@ -859,6 +859,17 @@ export interface RunOptions extends RunOverrideOptions {
859
859
  * is the time bound for a `mode: "detach"` batch child, where `timeoutMs`
860
860
  * is refused. Any agent, model-driven or code-js. */
861
861
  maxWallSeconds?: number;
862
+ /** `"none"` makes this a no-trace run: what it says is delivered on this
863
+ * stream and stored nowhere — the server keeps a marker for each event
864
+ * (its type and size) and a class for an error, never the text. Omit (or
865
+ * `"default"`) to leave the mode to the agent and your token, either of
866
+ * which may still make the run no-trace: the strictest wins.
867
+ *
868
+ * A no-trace run cannot be interactive, held for review, put in an
869
+ * existing session, continued, compacted or retuned; each is refused with
870
+ * `retention_none_unsupported`. A detached one returns its id and nothing
871
+ * readable afterwards, so the agent must deliver its own result. */
872
+ retention?: "none" | "default";
862
873
  /** Optional NON-SECRET structured metadata passed to the agent (repo
863
874
  * name, review policy, preferred skills, …) — symmetric with the
864
875
  * WebHook/Schedule trigger paths. As a first-party (bearer-authed)
@@ -1096,7 +1107,14 @@ export interface ParentContext {
1096
1107
  * agent within the walk rather than merely inside it — a fan-out of N
1097
1108
  * agents shares one `wave_id` and differs only by `wave_index`.
1098
1109
  *
1099
- * Absent on any run no team walk spawned. */
1110
+ * A run a member starts (a sub-agent, at any depth) carries the member's
1111
+ * `walk_id`, `state` and `state_visit` too, so it is in
1112
+ * {@link LoomcycleClient.listWalkRuns} and on the walk-filtered stream.
1113
+ * It is told from a member by `parent_run_id`: a member's is the walk's
1114
+ * run id, a sub-agent's is the run that started it. The wave fields stay
1115
+ * the member's alone.
1116
+ *
1117
+ * Absent on any run outside a team walk. */
1100
1118
  walk_id?: string;
1101
1119
  wave_id?: string;
1102
1120
  /** Position within the wave, 0-based. Sent even when 0 (unlike the string
@@ -1105,7 +1123,8 @@ export interface ParentContext {
1105
1123
  wave_index?: number;
1106
1124
  /** Which state of the walk ran this run — set on EVERY run a team walk
1107
1125
  * spawns (agent, parallel, consolidator and starter members alike), where
1108
- * the wave fields are a starter's alone. */
1126
+ * the wave fields are a starter's alone. A member's sub-agent carries the
1127
+ * member's. */
1109
1128
  state?: string;
1110
1129
  /** The walk's own ordinal of state visits (1, 2, …): the runs of one visit
1111
1130
  * share it, and a revisit of the same state gets a new one. Absent outside
@@ -1229,6 +1248,9 @@ export interface Agent {
1229
1248
  started_at: string;
1230
1249
  completed_at: string | null;
1231
1250
  stop_reason: string | null;
1251
+ /** `"none"` for a no-trace run: its transcript holds markers, not content,
1252
+ * and `error` is a class. Absent on every other run. */
1253
+ retention?: string;
1232
1254
  error: string | null;
1233
1255
  usage: AgentUsage;
1234
1256
  last_heartbeat_at: string | null;
@@ -1291,6 +1313,10 @@ export type ConfiguredRunPatch = Partial<Omit<RunOptions, "agent" | "sessionId"
1291
1313
  * Keys and nested values are the server's snake_case wire names (not the
1292
1314
  * camelCase request options), so nested blocks are left untyped. */
1293
1315
  export interface RunSpec {
1316
+ /** `"none"` for a no-trace run, whose record holds its mode and none of
1317
+ * its settings: such a run stores no content and is never resumed. Absent
1318
+ * on every other run. */
1319
+ retention?: string;
1294
1320
  sampling?: Record<string, unknown>;
1295
1321
  tool_choice?: ToolChoiceOptions;
1296
1322
  output_format?: OutputFormatOptions;
@@ -1655,6 +1681,35 @@ export interface CompactRunResult {
1655
1681
  after_tokens: number;
1656
1682
  applied: "live" | "marker" | "noop";
1657
1683
  }
1684
+ /** One place a run-tree delete could not reach: a copy of the deleted
1685
+ * content may still be there. */
1686
+ export interface RunTreeNotReached {
1687
+ /** `snapshots`, `retention_exports`, `derived_facts` or `trace_index`. */
1688
+ name: string;
1689
+ /** How many items may be affected. Absent when that is not cheap to know. */
1690
+ count?: number;
1691
+ /** The count stopped at a bound: there may be more. */
1692
+ count_is_floor?: boolean;
1693
+ reason: string;
1694
+ }
1695
+ /** Result of {@link LoomcycleClient.deleteRunTree} and
1696
+ * {@link LoomcycleClient.deleteSession}. */
1697
+ export interface RunTreeDeletion {
1698
+ /** The root that was asked for (one of the two). */
1699
+ run_id?: string;
1700
+ session_id?: string;
1701
+ /** How many runs went: the root and its descendants. 0 when the root does
1702
+ * not exist, was already deleted, or is not the caller's to read. */
1703
+ deleted_runs: number;
1704
+ /** Rows removed, by table (`runs`, `events`, `sessions`,
1705
+ * `session_embeddings`, `interrupts`, `evaluations`, `memory_pending`,
1706
+ * `trace_index`). Every table is present, at 0 when nothing went. */
1707
+ counts: Record<string, number>;
1708
+ /** What is left in place on purpose, and why (the usage ledger). */
1709
+ kept: Record<string, string>;
1710
+ /** Empty when nothing was deleted. */
1711
+ not_reached: RunTreeNotReached[];
1712
+ }
1658
1713
  /** Result of {@link LoomcycleClient.replaySession} (RFC BJ Phase 4) — a NEW
1659
1714
  * session bound to the target agent, seeded with the source conversation.
1660
1715
  * Continue `new_session_id` with the normal message/run path; the carried
@@ -1792,8 +1847,31 @@ export interface MintedUserToken {
1792
1847
  name: string;
1793
1848
  scopes: string[];
1794
1849
  created_at: string;
1850
+ /** Set when the token was minted with a lifetime: it stops authenticating
1851
+ * at this instant. */
1852
+ expires_at?: string;
1853
+ /** def_ids of the user's older tokens that `maxActive` retired. */
1854
+ retired?: string[];
1855
+ /** What narrows the token below its scopes, when anything does. */
1856
+ restrictions?: TokenRestrictions;
1795
1857
  warning: string;
1796
1858
  }
1859
+ /** A token's restrictions. `agents` is the complete list of agents the token
1860
+ * may start as top-level runs; a token carrying one is also limited to the
1861
+ * run endpoints. */
1862
+ export interface TokenRestrictions {
1863
+ agents?: string[];
1864
+ /** `"none"` when every per-run override is locked, or the overrides the
1865
+ * token may still set. Absent when nothing is locked. */
1866
+ overrides?: "none" | string[];
1867
+ /** How often the token may start runs. */
1868
+ rate?: {
1869
+ per_minute: number;
1870
+ burst?: number;
1871
+ };
1872
+ /** `"none"` when every run the token starts is a no-trace run. */
1873
+ retention?: "none";
1874
+ }
1797
1875
  /** One token row from GET /v1/_users/{subject}/tokens — METADATA ONLY (never
1798
1876
  * the plaintext or hash). `active` applies the auth-layer validity rule. */
1799
1877
  export interface UserTokenMeta {
@@ -1802,6 +1880,9 @@ export interface UserTokenMeta {
1802
1880
  scopes: string[];
1803
1881
  created_at: string;
1804
1882
  retired_at?: string;
1883
+ expires_at?: string;
1884
+ restrictions?: TokenRestrictions;
1885
+ /** False once the token is retired or expired. */
1805
1886
  active: boolean;
1806
1887
  }
1807
1888
  export interface ListUserTokensResponse {
@@ -1830,12 +1911,28 @@ export interface WhoamiResponse {
1830
1911
  open_mode?: boolean;
1831
1912
  }
1832
1913
  export type RuntimeStateStatus = "running" | "pausing" | "paused";
1914
+ /** A timed override of an agent's no-trace mode: until `until`, runs of
1915
+ * `agent` in `tenant` are stored like any other. It lifts a mode that came
1916
+ * from the agent's definition or the run request, never one a token
1917
+ * requires. */
1918
+ export interface RetentionOverride {
1919
+ tenant: string;
1920
+ agent: string;
1921
+ /** RFC 3339. */
1922
+ until: string;
1923
+ set_by?: string;
1924
+ created_at?: string;
1925
+ }
1833
1926
  export interface PauseResult {
1834
1927
  state: string;
1835
1928
  duration_ms: number;
1836
1929
  /** Always 0: pause cancels no tool call. Kept for wire compatibility. */
1837
1930
  force_cancelled_count: number;
1838
1931
  paused_runs_count: number;
1932
+ /** No-trace runs on the serving replica that the pause did not park: they
1933
+ * have nothing stored to resume from, keep running, and are left out of a
1934
+ * snapshot. Absent when there are none. */
1935
+ unpausable_runs_count?: number;
1839
1936
  warnings?: string[];
1840
1937
  }
1841
1938
  export interface ResumeResult {
@@ -3336,6 +3433,10 @@ export interface RunStateStreamOpen {
3336
3433
  * are a stream that stays quiet. Comparing this to what you sent tells the
3337
3434
  * two apart before you wait on an empty stream. Empty when unfiltered. */
3338
3435
  filter_walk_id?: string;
3436
+ /** The parent-run filter the server applied, echoed back like
3437
+ * `filter_walk_id`. Empty when unfiltered, absent on a server that
3438
+ * predates the filter (which then streams every run). */
3439
+ filter_parent_run_id?: string;
3339
3440
  keepalive_interval: number;
3340
3441
  }
3341
3442
  /** Yielded by {@link LoomcycleClient.streamUserRunStates}.
@@ -3376,6 +3477,13 @@ export interface StreamUserRunStatesOptions {
3376
3477
  * callback sees. The server echoes it back on the open frame as
3377
3478
  * {@link RunStateStreamOpen.filter_walk_id}. */
3378
3479
  walkId?: string;
3480
+ /** SERVER-side filter: only one run's direct children, the events whose
3481
+ * `parent_run_id` is this run id. The run's own transitions are not in
3482
+ * it, nor its grandchildren's. It is the live twin of
3483
+ * {@link LoomcycleClient.listChildRuns}. With `walkId`, an event must pass
3484
+ * both. Echoed on the open frame as
3485
+ * {@link RunStateStreamOpen.filter_parent_run_id}. */
3486
+ parentRunId?: string;
3379
3487
  /** v0.9.x — client-side filter on the run's parent_agent_id.
3380
3488
  * Useful for "show me only the sub-runs spawned by agent X."
3381
3489
  * The filter is applied AFTER the SSE frame is parsed, so this
@@ -3661,6 +3769,15 @@ export interface AgentDefOverlay {
3661
3769
  * (only where an operator generated them). A chunk found through a unit carries
3662
3770
  * `matched_unit: {kind, text}`. */
3663
3771
  memory_units?: boolean;
3772
+ /** `false` locks the agent's per-run overrides for every caller: a run
3773
+ * request that sets one (model, effort, limits, sampling, hooks, …) is
3774
+ * refused with `override_not_allowed`. Unset or `true` leaves them to the
3775
+ * caller. A fork that does not send it keeps its parent's. */
3776
+ allow_overrides?: boolean;
3777
+ /** `"none"` makes every run of the agent a no-trace run: its content is
3778
+ * delivered to the caller and stored nowhere. A fork that does not send it
3779
+ * keeps its parent's, and `"default"` on a no-trace parent is refused. */
3780
+ retention?: "none" | "default";
3664
3781
  memory_quota_bytes?: number;
3665
3782
  memory_backend?: string;
3666
3783
  retry_attempts?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "1.110.0",
3
+ "version": "1.112.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",