@loomcycle/client 1.109.0 → 1.111.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,7 @@ 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. |
146
147
  | `getTranscript(sessionId)` | `Promise<TranscriptResponse>` | Persisted event log; one row per event with seq/run_id/ts_ns/type/event. |
147
148
  | `health()` | `Promise<HealthResponse>` | Liveness probe. Hits `/healthz` (no `/v1` prefix). Unauthenticated. |
148
149
  | `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. |
@@ -678,7 +678,8 @@ class LoomcycleClient {
678
678
  const resp = await (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/agents/${encodeURIComponent(agentId)}/cancel`, { reason: opts?.reason ?? "" }, opts);
679
679
  return { cancelledCount: resp.cancelled_count };
680
680
  }
681
- /** List a user's recent agent runs, optionally filtered by status.
681
+ /** List a user's recent agent runs, optionally filtered by status. With no
682
+ * `status` only running runs are returned; `"all"` returns every status.
682
683
  *
683
684
  * v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
684
685
  * whose `parent_agent_id` matches. The server still returns the
@@ -715,6 +716,23 @@ class LoomcycleClient {
715
716
  const resp = await (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/runs?${params.toString()}`, opts);
716
717
  return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
717
718
  }
719
+ /** One page of a run's direct children — the runs it started itself, for
720
+ * example through the Agent tool — of every status, oldest first. Not the
721
+ * run itself, and not its grandchildren: call it again on a child for
722
+ * those. Rows are {@link LoomcycleClient.listWalkRuns}' rows, and none
723
+ * carries a `result`. Pass the page's `next_cursor` back as `cursor` for
724
+ * the next one; it is "" on the last. `limit` defaults to 100, at most
725
+ * 1000. Mirrors `GET /v1/runs?parent_run_id=`. Raises NotFoundError for an
726
+ * unknown run, or one the caller may not see. */
727
+ async listChildRuns(parentRunId, opts) {
728
+ const params = new URLSearchParams({ parent_run_id: parentRunId });
729
+ if (opts?.limit !== undefined)
730
+ params.set("limit", String(opts.limit));
731
+ if (opts?.cursor)
732
+ params.set("cursor", opts.cursor);
733
+ const resp = await (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/runs?${params.toString()}`, opts);
734
+ return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
735
+ }
718
736
  /** Aggregated token-usage + cost report (RFC AV). Group by any of
719
737
  * tenant/user/provider/model/source over an optional time window; group by
720
738
  * `source` for the operator-vs-tenant split. Tenant-scoped server-side: a
@@ -2323,6 +2341,9 @@ class LoomcycleClient {
2323
2341
  if (opts?.walkId) {
2324
2342
  params.set("walk_id", opts.walkId);
2325
2343
  }
2344
+ if (opts?.parentRunId) {
2345
+ params.set("parent_run_id", opts.parentRunId);
2346
+ }
2326
2347
  const qs = params.toString();
2327
2348
  const path = `/v1/users/${encodeURIComponent(userId)}/agents/stream` +
2328
2349
  (qs ? `?${qs}` : "");
package/dist/client.d.ts CHANGED
@@ -383,7 +383,8 @@ export declare class LoomcycleClient {
383
383
  reason?: string;
384
384
  signal?: AbortSignal;
385
385
  }): Promise<CancelAgentResult>;
386
- /** List a user's recent agent runs, optionally filtered by status.
386
+ /** List a user's recent agent runs, optionally filtered by status. With no
387
+ * `status` only running runs are returned; `"all"` returns every status.
387
388
  *
388
389
  * v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
389
390
  * whose `parent_agent_id` matches. The server still returns the
@@ -391,7 +392,7 @@ export declare class LoomcycleClient {
391
392
  * request); the adapter trims before returning. Useful for the
392
393
  * n8n trigger pattern "show me all sub-runs spawned by parent X." */
393
394
  listUserAgents(userId: string, opts?: {
394
- status?: AgentStatus;
395
+ status?: AgentStatus | "all";
395
396
  parentAgentId?: string;
396
397
  /** Super-admin tenant-focus (?tenant=, RFC L v0.17.0). Ignored
397
398
  * server-side for a tenant principal — its own tenant is forced. */
@@ -410,6 +411,19 @@ export declare class LoomcycleClient {
410
411
  cursor?: string;
411
412
  signal?: AbortSignal;
412
413
  }): Promise<WalkRunsPage>;
414
+ /** One page of a run's direct children — the runs it started itself, for
415
+ * example through the Agent tool — of every status, oldest first. Not the
416
+ * run itself, and not its grandchildren: call it again on a child for
417
+ * those. Rows are {@link LoomcycleClient.listWalkRuns}' rows, and none
418
+ * carries a `result`. Pass the page's `next_cursor` back as `cursor` for
419
+ * the next one; it is "" on the last. `limit` defaults to 100, at most
420
+ * 1000. Mirrors `GET /v1/runs?parent_run_id=`. Raises NotFoundError for an
421
+ * unknown run, or one the caller may not see. */
422
+ listChildRuns(parentRunId: string, opts?: {
423
+ limit?: number;
424
+ cursor?: string;
425
+ signal?: AbortSignal;
426
+ }): Promise<WalkRunsPage>;
413
427
  /** Aggregated token-usage + cost report (RFC AV). Group by any of
414
428
  * tenant/user/provider/model/source over an optional time window; group by
415
429
  * `source` for the operator-vs-tenant split. Tenant-scoped server-side: a
package/dist/client.js CHANGED
@@ -675,7 +675,8 @@ export class LoomcycleClient {
675
675
  const resp = await postJSON(this.ctx, `/v1/agents/${encodeURIComponent(agentId)}/cancel`, { reason: opts?.reason ?? "" }, opts);
676
676
  return { cancelledCount: resp.cancelled_count };
677
677
  }
678
- /** List a user's recent agent runs, optionally filtered by status.
678
+ /** List a user's recent agent runs, optionally filtered by status. With no
679
+ * `status` only running runs are returned; `"all"` returns every status.
679
680
  *
680
681
  * v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
681
682
  * whose `parent_agent_id` matches. The server still returns the
@@ -712,6 +713,23 @@ export class LoomcycleClient {
712
713
  const resp = await jsonFetch(this.ctx, `/v1/runs?${params.toString()}`, opts);
713
714
  return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
714
715
  }
716
+ /** One page of a run's direct children — the runs it started itself, for
717
+ * example through the Agent tool — of every status, oldest first. Not the
718
+ * run itself, and not its grandchildren: call it again on a child for
719
+ * those. Rows are {@link LoomcycleClient.listWalkRuns}' rows, and none
720
+ * carries a `result`. Pass the page's `next_cursor` back as `cursor` for
721
+ * the next one; it is "" on the last. `limit` defaults to 100, at most
722
+ * 1000. Mirrors `GET /v1/runs?parent_run_id=`. Raises NotFoundError for an
723
+ * unknown run, or one the caller may not see. */
724
+ async listChildRuns(parentRunId, opts) {
725
+ const params = new URLSearchParams({ parent_run_id: parentRunId });
726
+ if (opts?.limit !== undefined)
727
+ params.set("limit", String(opts.limit));
728
+ if (opts?.cursor)
729
+ params.set("cursor", opts.cursor);
730
+ const resp = await jsonFetch(this.ctx, `/v1/runs?${params.toString()}`, opts);
731
+ return { agents: resp.agents ?? [], next_cursor: resp.next_cursor ?? "" };
732
+ }
715
733
  /** Aggregated token-usage + cost report (RFC AV). Group by any of
716
734
  * tenant/user/provider/model/source over an optional time window; group by
717
735
  * `source` for the operator-vs-tenant split. Tenant-scoped server-side: a
@@ -2320,6 +2338,9 @@ export class LoomcycleClient {
2320
2338
  if (opts?.walkId) {
2321
2339
  params.set("walk_id", opts.walkId);
2322
2340
  }
2341
+ if (opts?.parentRunId) {
2342
+ params.set("parent_run_id", opts.parentRunId);
2343
+ }
2323
2344
  const qs = params.toString();
2324
2345
  const path = `/v1/users/${encodeURIComponent(userId)}/agents/stream` +
2325
2346
  (qs ? `?${qs}` : "");
package/dist/index.d.ts CHANGED
@@ -132,5 +132,5 @@ export { InteractiveSession } from "./interactive.js";
132
132
  export type { InteractiveSessionOps } from "./interactive.js";
133
133
  export { ClientToolHost, clientToolsURL, CLIENT_TOOL_SUBPROTOCOL } from "./client-tools.js";
134
134
  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, 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";
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";
136
136
  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/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" | "awaiting_review" | "subagent_hold" | "awaiting_children" | "children_note" | "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" | "spawn_child_read" | "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" | "subagent_hold" | "awaiting_children" | "children_note" | "steer" | "context_compaction" | "capability_inert" | "hook_decision" | "limit" | "override" | "context_recap" | "context_state" | "context_distill_declined" | "context_exhausted" | "thinking" | "team_decision" | "turn_cancelled" | "provider_fallback" | "fallback_suppressed" | "model_downgraded" | "cache_invalidated" | "reasoning_invalidated" | "channel_publish" | "channel_delivery" | "interruption_pending" | "spawn_child_started" | "spawn_child_result" | "spawn_child_read" | "prompt_snapshot" | "_meta";
11
11
  export interface ToolUse {
12
12
  id: string;
13
13
  name: string;
@@ -311,6 +311,28 @@ export interface ErrorInfo {
311
311
  * shape may be the cause. */
312
312
  correct_call_format?: CallFormat;
313
313
  }
314
+ /** One visit of a team walk to a `decision` state (the `team_decision`
315
+ * payload), recorded on the walk's own run. A decision state starts no
316
+ * member run, and a walk started with `mode: "detach"` returns no steps, so
317
+ * this is where a client holding the walk's `run_id` finds the answer. */
318
+ export interface TeamDecisionInfo {
319
+ /** The decision state's id. */
320
+ state: string;
321
+ /** The walk's ordinal of state visits at this one: 1 for the walk's first
322
+ * state, never reused, and the number a member run of the walk carries as
323
+ * `parent_context.state_visit`. Two passes through one state are two
324
+ * events with different visits. */
325
+ visit: number;
326
+ /** The transition the walk took out of the state: `conditional:<option>`,
327
+ * `conditional:true` / `conditional:false`, or `success` when the answer
328
+ * had no transition of its own or the state routes on nothing. */
329
+ edge: string;
330
+ /** The state that transition leads to. */
331
+ next: string;
332
+ /** What the model answered: the object a waited-for walk's step carries as
333
+ * `answer`. */
334
+ answer: TeamDecisionAnswer;
335
+ }
314
336
  /** What one hook did to one call, or to the run (the `hook_decision`
315
337
  * payload). */
316
338
  export interface HookDecisionInfo {
@@ -597,6 +619,11 @@ export interface AgentEvent {
597
619
  capability_inert?: CapabilityInertInfo;
598
620
  /** Payload on `event: hook_decision`. */
599
621
  hook_decision?: HookDecisionInfo;
622
+ /** Payload on `event: team_decision`: one visit of a team walk to a
623
+ * decision state. Read it from the WALK's run, with
624
+ * {@link LoomcycleClient.streamRunByID}: while the walk runs, and after
625
+ * it has ended. */
626
+ team_decision?: TeamDecisionInfo;
600
627
  /** Set on `event: override` frames — what the operator changed, and from
601
628
  * what to what. */
602
629
  override?: OverrideInfo;
@@ -1069,7 +1096,14 @@ export interface ParentContext {
1069
1096
  * agent within the walk rather than merely inside it — a fan-out of N
1070
1097
  * agents shares one `wave_id` and differs only by `wave_index`.
1071
1098
  *
1072
- * Absent on any run no team walk spawned. */
1099
+ * A run a member starts (a sub-agent, at any depth) carries the member's
1100
+ * `walk_id`, `state` and `state_visit` too, so it is in
1101
+ * {@link LoomcycleClient.listWalkRuns} and on the walk-filtered stream.
1102
+ * It is told from a member by `parent_run_id`: a member's is the walk's
1103
+ * run id, a sub-agent's is the run that started it. The wave fields stay
1104
+ * the member's alone.
1105
+ *
1106
+ * Absent on any run outside a team walk. */
1073
1107
  walk_id?: string;
1074
1108
  wave_id?: string;
1075
1109
  /** Position within the wave, 0-based. Sent even when 0 (unlike the string
@@ -1078,7 +1112,8 @@ export interface ParentContext {
1078
1112
  wave_index?: number;
1079
1113
  /** Which state of the walk ran this run — set on EVERY run a team walk
1080
1114
  * spawns (agent, parallel, consolidator and starter members alike), where
1081
- * the wave fields are a starter's alone. */
1115
+ * the wave fields are a starter's alone. A member's sub-agent carries the
1116
+ * member's. */
1082
1117
  state?: string;
1083
1118
  /** The walk's own ordinal of state visits (1, 2, …): the runs of one visit
1084
1119
  * share it, and a revisit of the same state gets a new one. Absent outside
@@ -3309,6 +3344,10 @@ export interface RunStateStreamOpen {
3309
3344
  * are a stream that stays quiet. Comparing this to what you sent tells the
3310
3345
  * two apart before you wait on an empty stream. Empty when unfiltered. */
3311
3346
  filter_walk_id?: string;
3347
+ /** The parent-run filter the server applied, echoed back like
3348
+ * `filter_walk_id`. Empty when unfiltered, absent on a server that
3349
+ * predates the filter (which then streams every run). */
3350
+ filter_parent_run_id?: string;
3312
3351
  keepalive_interval: number;
3313
3352
  }
3314
3353
  /** Yielded by {@link LoomcycleClient.streamUserRunStates}.
@@ -3349,6 +3388,13 @@ export interface StreamUserRunStatesOptions {
3349
3388
  * callback sees. The server echoes it back on the open frame as
3350
3389
  * {@link RunStateStreamOpen.filter_walk_id}. */
3351
3390
  walkId?: string;
3391
+ /** SERVER-side filter: only one run's direct children, the events whose
3392
+ * `parent_run_id` is this run id. The run's own transitions are not in
3393
+ * it, nor its grandchildren's. It is the live twin of
3394
+ * {@link LoomcycleClient.listChildRuns}. With `walkId`, an event must pass
3395
+ * both. Echoed on the open frame as
3396
+ * {@link RunStateStreamOpen.filter_parent_run_id}. */
3397
+ parentRunId?: string;
3352
3398
  /** v0.9.x — client-side filter on the run's parent_agent_id.
3353
3399
  * Useful for "show me only the sub-runs spawned by agent X."
3354
3400
  * The filter is applied AFTER the SSE frame is parsed, so this
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "1.109.0",
3
+ "version": "1.111.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",