@loomcycle/client 1.108.1 → 1.110.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.
@@ -1583,6 +1583,8 @@ class LoomcycleClient {
1583
1583
  body.review = target.review;
1584
1584
  if (target.reviewTtlSeconds !== undefined)
1585
1585
  body.review_ttl_seconds = target.reviewTtlSeconds;
1586
+ if (target.idempotencyKey !== undefined)
1587
+ body.idempotency_key = target.idempotencyKey;
1586
1588
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_teamdef", body, opts);
1587
1589
  }
1588
1590
  /** Read the debug breakpoints armed on a live team walk
package/dist/client.js CHANGED
@@ -1580,6 +1580,8 @@ export class LoomcycleClient {
1580
1580
  body.review = target.review;
1581
1581
  if (target.reviewTtlSeconds !== undefined)
1582
1582
  body.review_ttl_seconds = target.reviewTtlSeconds;
1583
+ if (target.idempotencyKey !== undefined)
1584
+ body.idempotency_key = target.idempotencyKey;
1583
1585
  return postJSON(this.ctx, "/v1/_teamdef", body, opts);
1584
1586
  }
1585
1587
  /** Read the debug breakpoints armed on a live team walk
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;
@@ -2373,7 +2400,7 @@ export interface TeamVerification {
2373
2400
  }
2374
2401
  /** What a {@link TeamIssue} is about. A wire enum that only grows: a kind this
2375
2402
  * client does not know is still a `string`, so a new one never breaks a build. */
2376
- export type TeamIssueKind = "name_invalid" | "parent_not_found" | "overlay_invalid" | "graph_invalid" | "size_cap" | "channel_reserved" | "channel_authority" | "acl_missing" | "channel_undeclared" | "local_channel_invalid" | "local_channel_missing" | "local_agent_invalid" | "local_agent_authority" | "local_agent_collision" | "local_agent_missing" | "local_agent_unreferenced" | "local_skill_invalid" | "local_webhook_authority" | "local_webhook_invalid" | "agent_missing" | "uncheckable" | (string & {});
2403
+ export type TeamIssueKind = "name_invalid" | "parent_not_found" | "overlay_invalid" | "graph_invalid" | "size_cap" | "channel_reserved" | "channel_authority" | "acl_missing" | "channel_undeclared" | "local_channel_invalid" | "local_channel_missing" | "local_agent_invalid" | "local_agent_authority" | "local_agent_collision" | "local_agent_missing" | "local_agent_unreferenced" | "local_skill_invalid" | "local_webhook_authority" | "local_webhook_invalid" | "agent_missing" | "decision_authority" | "decision_unconfigured" | "decision_model_unknown" | "decision_limits" | "uncheckable" | (string & {});
2377
2404
  /** One problem with a team definition, from {@link LoomcycleClient.verifyTeam}.
2378
2405
  *
2379
2406
  * `severity`: `refused` — a create or fork would be refused (its `detail` is
@@ -2430,6 +2457,79 @@ export interface TeamDraftVerification extends TeamVerification {
2430
2457
  * empty when there are none. */
2431
2458
  issues: TeamIssue[];
2432
2459
  }
2460
+ /** One question of a `decision` state: the shape {@link DecisionQuestion}
2461
+ * has on a decision call. */
2462
+ export interface TeamDecisionQuestion {
2463
+ type: "choice" | "noul" | "score";
2464
+ /** The question itself, in plain words. */
2465
+ instructions: string;
2466
+ /** `choice` (required): each option mapped to a description, or to `null`
2467
+ * when the option explains itself; the option names are the answers a state
2468
+ * routes on. `noul` (optional): descriptions of `"true"` and/or `"false"`.
2469
+ * `score` (required): level descriptions, lowest first. */
2470
+ criteria?: Record<string, string | null> | string[];
2471
+ }
2472
+ /** The handler of a team state of kind `decision`: one call to a decision
2473
+ * model, with no agent run. It binds what was answered through `capture`
2474
+ * and, when it names a `route`, takes the transition that answer selects.
2475
+ *
2476
+ * A save refuses a routed answer with nowhere to go: every option of a routed
2477
+ * `choice` needs a `conditional:<option>` transition, and a routed `noul`
2478
+ * both `conditional:true` and `conditional:false`, unless the state has a
2479
+ * `success` transition, which takes any answer without its own. */
2480
+ export interface TeamDecisionHandler {
2481
+ kind: "decision";
2482
+ /** One of the operator's decision models; omitted means the default. A
2483
+ * model this deployment does not offer is stored and reported by
2484
+ * `verifyTeam` as `decision_model_unknown`. */
2485
+ model?: string;
2486
+ /** The JSON object the questions are about. Its string values, at any
2487
+ * depth, are expanded when the state runs: `${var.<name>}`, `${now.*}`,
2488
+ * `${team.*}`, and `{{thread.output}}` for what the previous state handed
2489
+ * over. No other `{{…}}` placeholder is allowed. */
2490
+ about: Record<string, unknown>;
2491
+ questions: Record<string, TeamDecisionQuestion>;
2492
+ /** The question whose answer picks the transition: a `choice` or a `noul`.
2493
+ * Omitted: the state advances on `success`. */
2494
+ route?: string;
2495
+ /** For a routed `noul`: the probability of yes at or above which the answer
2496
+ * is `true`. Default 0.5; above 0 and below 1. */
2497
+ threshold?: number;
2498
+ /** Variable name → JSONPath into the answer, e.g. `$.answers.route.choice`,
2499
+ * `$.answers.urgent.noul`, `$.answers.route.probabilities.billing`. */
2500
+ capture?: Record<string, string>;
2501
+ /** Bounds the call. 0 or omitted: the model's own timeout. */
2502
+ timeout_ms?: number;
2503
+ }
2504
+ /** What a `decision` state's model answered: the object a decision call
2505
+ * returns. On a walk's step as `answer`. */
2506
+ export interface TeamDecisionAnswer {
2507
+ /** The model asked, by the operator's name for it. */
2508
+ model: string;
2509
+ provider: string;
2510
+ served_model: string;
2511
+ /** One entry per question, under the question's name. */
2512
+ answers: Record<string, Record<string, unknown>>;
2513
+ usage: {
2514
+ input_tokens: number;
2515
+ output_tokens: number;
2516
+ };
2517
+ }
2518
+ /** One executed state of a team walk, in {@link TeamRunResult.steps}. */
2519
+ export interface TeamRunStep {
2520
+ state: string;
2521
+ /** The state's agent, for an `agent` or `consolidator` state; else "". */
2522
+ agent: string;
2523
+ /** The transition label taken, and the state it led to. */
2524
+ edge: string;
2525
+ next: string;
2526
+ /** What the state handed to the next one. A `decision`, `vars` or `channel`
2527
+ * state hands on what it was handed. */
2528
+ output: string;
2529
+ /** A `decision` state's answer. Absent on every other kind. */
2530
+ answer?: TeamDecisionAnswer;
2531
+ [extra: string]: unknown;
2532
+ }
2433
2533
  /** Result of {@link LoomcycleClient.runTeam} (op=run) — the walk trace. `status`
2434
2534
  * is `"completed"` (a terminal state was reached) or `"iteration_cap"` (a
2435
2535
  * state's cycle cap tripped; `capped_state` + `iteration_count` describe it).
@@ -2451,7 +2551,12 @@ export interface TeamRunResult {
2451
2551
  capped_state?: string;
2452
2552
  max_iterations?: number;
2453
2553
  iteration_count?: number;
2454
- steps: Array<Record<string, unknown>>;
2554
+ /** The per-state trace. Absent when `deduplicated` is set. */
2555
+ steps: TeamRunStep[];
2556
+ /** Set (true) when the request's `idempotencyKey` was already held: nothing
2557
+ * was started, and this is the walk that holds it, as it is now — `status`
2558
+ * may be "running", and there are no `steps`. */
2559
+ deduplicated?: boolean;
2455
2560
  [extra: string]: unknown;
2456
2561
  }
2457
2562
  /** What team {@link LoomcycleClient.runTeam} walks, and how. */
@@ -2503,6 +2608,21 @@ export interface TeamRunTarget {
2503
2608
  * seconds as rejected. Omit for no deadline. Changeable while the walk
2504
2609
  * runs — see {@link LoomcycleClient.setRunBreakpoints}. */
2505
2610
  reviewTtlSeconds?: number;
2611
+ /** Makes starting this walk safe to retry: 1 to 200 characters of
2612
+ * `[A-Za-z0-9:._-]`. A second `runTeam` with the same key, from the same
2613
+ * tenant and user, starts nothing and is answered with the walk the key
2614
+ * already holds, marked `deduplicated: true`.
2615
+ *
2616
+ * Use one key per press of Start and send it again on a retry of that
2617
+ * press: a start whose answer was lost then returns the walk it started,
2618
+ * not a second one. The rest of the request is not compared.
2619
+ *
2620
+ * The answer to a retry is the walk's `run_id` and `status`, plus
2621
+ * `final_state` and `final_output` once it has ended. It is returned at
2622
+ * once in every mode (a retry does not wait for a walk still running), and
2623
+ * it has no `steps`: read the walk's member runs for those. Refused with
2624
+ * `boardChunkId`, which already resumes a stored position. */
2625
+ idempotencyKey?: string;
2506
2626
  }
2507
2627
  /** What {@link LoomcycleClient.runTeam} returns for `mode: "detach"` — the
2508
2628
  * handle, immediately, with the walk still running behind it.
@@ -2516,8 +2636,12 @@ export interface TeamRunDetached {
2516
2636
  def_id: string;
2517
2637
  /** Address every other run surface with this. */
2518
2638
  run_id: string;
2519
- /** Always "running" — the walk has been started, not awaited. */
2639
+ /** "running" for a walk this call started. For a retry answered from an
2640
+ * `idempotencyKey`, the walk's status now, which may be an ended one. */
2520
2641
  status: string;
2642
+ /** Set (true) when the request's `idempotencyKey` was already held: nothing
2643
+ * was started, and this is the walk that holds it. */
2644
+ deduplicated?: boolean;
2521
2645
  [extra: string]: unknown;
2522
2646
  }
2523
2647
  /** The armed debug breakpoints of a live team walk, as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "1.108.1",
3
+ "version": "1.110.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",