@loomcycle/client 1.91.0 → 1.92.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/dist/cjs/client.js +21 -0
- package/dist/client.d.ts +17 -1
- package/dist/client.js +21 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +62 -2
- package/package.json +1 -1
package/dist/cjs/client.js
CHANGED
|
@@ -140,6 +140,9 @@ function runBody(opts) {
|
|
|
140
140
|
body.run_timeout_seconds = opts.runTimeoutSeconds;
|
|
141
141
|
if (opts.sampling !== undefined)
|
|
142
142
|
body.sampling = samplingToWire(opts.sampling);
|
|
143
|
+
// Same keys on the wire as in the option (mode / name / until).
|
|
144
|
+
if (opts.toolChoice !== undefined)
|
|
145
|
+
body.tool_choice = opts.toolChoice;
|
|
143
146
|
if (opts.compaction !== undefined)
|
|
144
147
|
body.compaction = compactionToWire(opts.compaction);
|
|
145
148
|
if (opts.context !== undefined)
|
|
@@ -272,6 +275,8 @@ class LoomcycleClient {
|
|
|
272
275
|
body.run_timeout_seconds = opts.runTimeoutSeconds;
|
|
273
276
|
if (opts.sampling !== undefined)
|
|
274
277
|
body.sampling = samplingToWire(opts.sampling);
|
|
278
|
+
if (opts.toolChoice !== undefined)
|
|
279
|
+
body.tool_choice = opts.toolChoice;
|
|
275
280
|
if (opts.compaction !== undefined)
|
|
276
281
|
body.compaction = compactionToWire(opts.compaction);
|
|
277
282
|
if (opts.context !== undefined)
|
|
@@ -342,6 +347,17 @@ class LoomcycleClient {
|
|
|
342
347
|
async getRunConfig(runId, opts) {
|
|
343
348
|
return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/config`, opts);
|
|
344
349
|
}
|
|
350
|
+
/** Read the prompt a run's first model call received (RFC DI). Mirrors
|
|
351
|
+
* `GET /v1/runs/{run_id}/prompt`. Recorded when the model was called, not
|
|
352
|
+
* re-derived now, so it is what the model saw even if a document or memory
|
|
353
|
+
* it quoted has changed since.
|
|
354
|
+
*
|
|
355
|
+
* Raises {@link NotFoundError} (404) for an unknown run and for another
|
|
356
|
+
* tenant's run alike, and also — with code `no_prompt_snapshot` — for a run
|
|
357
|
+
* that never reached a model call or predates prompt snapshots. */
|
|
358
|
+
async getRunPrompt(runId, opts) {
|
|
359
|
+
return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/prompt`, opts);
|
|
360
|
+
}
|
|
345
361
|
/** Read what a run will ACTUALLY use, field by field, with the layer that
|
|
346
362
|
* decided each. Mirrors `GET /v1/runs/{run_id}/effective-config`.
|
|
347
363
|
*
|
|
@@ -539,6 +555,11 @@ class LoomcycleClient {
|
|
|
539
555
|
* NOT whole-run cancel ({@link LoomcycleClient.cancelAgent}), which terminates
|
|
540
556
|
* the run. Returns `{ run_id, stopped, parked }`.
|
|
541
557
|
*
|
|
558
|
+
* A team walk's run (the `run_id` a detached `runTeam` returns) has no turns,
|
|
559
|
+
* so this ENDS the walk and the runs it spawned: `{ stopped: true, parked:
|
|
560
|
+
* false }`, recorded as cancelled. Walks are reachable on the replica running
|
|
561
|
+
* them only.
|
|
562
|
+
*
|
|
542
563
|
* Rejects with RunBusyError (409) when the run isn't mid-turn or isn't
|
|
543
564
|
* interactive, and AgentNotFoundError (404) for an unknown / cross-tenant run.
|
|
544
565
|
* Mirrors POST /v1/runs/{run_id}/cancel. (RFC BH)
|
package/dist/client.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { InteractiveSession } from "./interactive.js";
|
|
27
27
|
import { ClientToolHost, type ConnectClientToolsOptions } from "./client-tools.js";
|
|
28
|
-
import type { CredentialListResponse, CredentialMeta, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RetuneRunResponse, RunConfigResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, PersistentVolumesResponse, EphemeralVolumesResponse, RegisterHookOptions, RegisterHookResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, ReplaySessionResult, CancelTurnResult, RunBatchOptions, RunBatchResult, RunOptions, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, TranscriptResponse, WhoamiResponse, UsageDimension, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest } from "./types.js";
|
|
28
|
+
import type { CredentialListResponse, CredentialMeta, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, PersistentVolumesResponse, EphemeralVolumesResponse, RegisterHookOptions, RegisterHookResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, ReplaySessionResult, CancelTurnResult, RunBatchOptions, RunBatchResult, RunOptions, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, TranscriptResponse, WhoamiResponse, UsageDimension, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest } from "./types.js";
|
|
29
29
|
export declare class LoomcycleClient {
|
|
30
30
|
private ctx;
|
|
31
31
|
constructor(opts?: ClientOptions);
|
|
@@ -120,6 +120,17 @@ export declare class LoomcycleClient {
|
|
|
120
120
|
getRunConfig(runId: string, opts?: {
|
|
121
121
|
signal?: AbortSignal;
|
|
122
122
|
}): Promise<RunConfigResponse>;
|
|
123
|
+
/** Read the prompt a run's first model call received (RFC DI). Mirrors
|
|
124
|
+
* `GET /v1/runs/{run_id}/prompt`. Recorded when the model was called, not
|
|
125
|
+
* re-derived now, so it is what the model saw even if a document or memory
|
|
126
|
+
* it quoted has changed since.
|
|
127
|
+
*
|
|
128
|
+
* Raises {@link NotFoundError} (404) for an unknown run and for another
|
|
129
|
+
* tenant's run alike, and also — with code `no_prompt_snapshot` — for a run
|
|
130
|
+
* that never reached a model call or predates prompt snapshots. */
|
|
131
|
+
getRunPrompt(runId: string, opts?: {
|
|
132
|
+
signal?: AbortSignal;
|
|
133
|
+
}): Promise<RunPromptResponse>;
|
|
123
134
|
/** Read what a run will ACTUALLY use, field by field, with the layer that
|
|
124
135
|
* decided each. Mirrors `GET /v1/runs/{run_id}/effective-config`.
|
|
125
136
|
*
|
|
@@ -283,6 +294,11 @@ export declare class LoomcycleClient {
|
|
|
283
294
|
* NOT whole-run cancel ({@link LoomcycleClient.cancelAgent}), which terminates
|
|
284
295
|
* the run. Returns `{ run_id, stopped, parked }`.
|
|
285
296
|
*
|
|
297
|
+
* A team walk's run (the `run_id` a detached `runTeam` returns) has no turns,
|
|
298
|
+
* so this ENDS the walk and the runs it spawned: `{ stopped: true, parked:
|
|
299
|
+
* false }`, recorded as cancelled. Walks are reachable on the replica running
|
|
300
|
+
* them only.
|
|
301
|
+
*
|
|
286
302
|
* Rejects with RunBusyError (409) when the run isn't mid-turn or isn't
|
|
287
303
|
* interactive, and AgentNotFoundError (404) for an unknown / cross-tenant run.
|
|
288
304
|
* Mirrors POST /v1/runs/{run_id}/cancel. (RFC BH)
|
package/dist/client.js
CHANGED
|
@@ -137,6 +137,9 @@ function runBody(opts) {
|
|
|
137
137
|
body.run_timeout_seconds = opts.runTimeoutSeconds;
|
|
138
138
|
if (opts.sampling !== undefined)
|
|
139
139
|
body.sampling = samplingToWire(opts.sampling);
|
|
140
|
+
// Same keys on the wire as in the option (mode / name / until).
|
|
141
|
+
if (opts.toolChoice !== undefined)
|
|
142
|
+
body.tool_choice = opts.toolChoice;
|
|
140
143
|
if (opts.compaction !== undefined)
|
|
141
144
|
body.compaction = compactionToWire(opts.compaction);
|
|
142
145
|
if (opts.context !== undefined)
|
|
@@ -269,6 +272,8 @@ export class LoomcycleClient {
|
|
|
269
272
|
body.run_timeout_seconds = opts.runTimeoutSeconds;
|
|
270
273
|
if (opts.sampling !== undefined)
|
|
271
274
|
body.sampling = samplingToWire(opts.sampling);
|
|
275
|
+
if (opts.toolChoice !== undefined)
|
|
276
|
+
body.tool_choice = opts.toolChoice;
|
|
272
277
|
if (opts.compaction !== undefined)
|
|
273
278
|
body.compaction = compactionToWire(opts.compaction);
|
|
274
279
|
if (opts.context !== undefined)
|
|
@@ -339,6 +344,17 @@ export class LoomcycleClient {
|
|
|
339
344
|
async getRunConfig(runId, opts) {
|
|
340
345
|
return jsonFetch(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/config`, opts);
|
|
341
346
|
}
|
|
347
|
+
/** Read the prompt a run's first model call received (RFC DI). Mirrors
|
|
348
|
+
* `GET /v1/runs/{run_id}/prompt`. Recorded when the model was called, not
|
|
349
|
+
* re-derived now, so it is what the model saw even if a document or memory
|
|
350
|
+
* it quoted has changed since.
|
|
351
|
+
*
|
|
352
|
+
* Raises {@link NotFoundError} (404) for an unknown run and for another
|
|
353
|
+
* tenant's run alike, and also — with code `no_prompt_snapshot` — for a run
|
|
354
|
+
* that never reached a model call or predates prompt snapshots. */
|
|
355
|
+
async getRunPrompt(runId, opts) {
|
|
356
|
+
return jsonFetch(this.ctx, `/v1/runs/${encodeURIComponent(runId)}/prompt`, opts);
|
|
357
|
+
}
|
|
342
358
|
/** Read what a run will ACTUALLY use, field by field, with the layer that
|
|
343
359
|
* decided each. Mirrors `GET /v1/runs/{run_id}/effective-config`.
|
|
344
360
|
*
|
|
@@ -536,6 +552,11 @@ export class LoomcycleClient {
|
|
|
536
552
|
* NOT whole-run cancel ({@link LoomcycleClient.cancelAgent}), which terminates
|
|
537
553
|
* the run. Returns `{ run_id, stopped, parked }`.
|
|
538
554
|
*
|
|
555
|
+
* A team walk's run (the `run_id` a detached `runTeam` returns) has no turns,
|
|
556
|
+
* so this ENDS the walk and the runs it spawned: `{ stopped: true, parked:
|
|
557
|
+
* false }`, recorded as cancelled. Walks are reachable on the replica running
|
|
558
|
+
* them only.
|
|
559
|
+
*
|
|
539
560
|
* Rejects with RunBusyError (409) when the run isn't mid-turn or isn't
|
|
540
561
|
* interactive, and AgentNotFoundError (404) for an unknown / cross-tenant run.
|
|
541
562
|
* Mirrors POST /v1/runs/{run_id}/cancel. (RFC BH)
|
package/dist/index.d.ts
CHANGED
|
@@ -128,5 +128,5 @@ export { InteractiveSession } from "./interactive.js";
|
|
|
128
128
|
export type { InteractiveSessionOps } from "./interactive.js";
|
|
129
129
|
export { ClientToolHost, clientToolsURL, CLIENT_TOOL_SUBPROTOCOL } from "./client-tools.js";
|
|
130
130
|
export type { ClientToolSchema, ClientToolInvocation, ConnectClientToolsOptions, WebSocketLike, WebSocketCtor, } from "./client-tools.js";
|
|
131
|
-
export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, Agent, AgentStatus, AgentUsage, CancelAgentResult, ListAgentsResponse, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, CancelTurnResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, UserTokenMeta, ListUserTokensResponse, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, PauseResult, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, Hook, HookFailMode, HookPhase, HookToolCall, HookToolResult, ListHooksResponse, PostHookCall, PostHookResult, PreHookCall, PreHookResult, RegisterHookOptions, RegisterHookResponse, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, EnsureCodeAgentOptions, EnsureCodeAgentResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, EffectiveConfigResponse, EffectiveConfigSource, EffectiveValue, RetuneRunResponse, RunConfigRecord, RunConfigResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, } from "./types.js";
|
|
131
|
+
export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, Agent, AgentStatus, AgentUsage, RunResult, ToolChoiceOptions, CancelAgentResult, ListAgentsResponse, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, CancelTurnResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, UserTokenMeta, ListUserTokensResponse, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, PauseResult, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, Hook, HookFailMode, HookPhase, HookToolCall, HookToolResult, ListHooksResponse, PostHookCall, PostHookResult, PreHookCall, PreHookResult, RegisterHookOptions, RegisterHookResponse, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, EnsureCodeAgentOptions, EnsureCodeAgentResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, EffectiveConfigResponse, EffectiveConfigSource, EffectiveValue, RetuneRunResponse, RunConfigRecord, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, } from "./types.js";
|
|
132
132
|
export { AgentIDInUseError, AgentNotFoundError, AlreadyPausingError, AuthError, BackpressureError, HookNotFoundError, NotFoundError, InvalidArgumentError, ChannelCursorRegressionError, LoomcycleError, NotPausedError, PauseNotConfiguredError, PerUserQuotaExhaustedError, SessionBusyError, SessionNotFoundError, SnapshotNotFoundError, SnapshotTooLargeError, SnapshotVersionError, SubstrateToolRefusedError, UnavailableError, } from "./errors.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `client.ts` for the input shapes (RunOptions, CreateSnapshotOptions,
|
|
8
8
|
* etc.) — those are translated to snake_case in the request body.
|
|
9
9
|
*/
|
|
10
|
-
export type EventType = "started" | "text" | "tool_call" | "tool_result" | "usage" | "done" | "error" | "retry" | "host_widened" | "session" | "agent" | "awaiting_input" | "steer" | "context_compaction" | "capability_inert" | "limit" | "override" | "context_recap" | "context_state" | "context_distill_declined" | "context_exhausted" | "thinking" | "turn_cancelled" | "provider_fallback" | "fallback_suppressed" | "model_downgraded" | "cache_invalidated" | "reasoning_invalidated" | "channel_publish" | "channel_delivery" | "interruption_pending" | "spawn_child_started" | "spawn_child_result" | "_meta";
|
|
10
|
+
export type EventType = "started" | "text" | "tool_call" | "tool_result" | "usage" | "done" | "error" | "retry" | "host_widened" | "session" | "agent" | "awaiting_input" | "steer" | "context_compaction" | "capability_inert" | "limit" | "override" | "context_recap" | "context_state" | "context_distill_declined" | "context_exhausted" | "thinking" | "turn_cancelled" | "provider_fallback" | "fallback_suppressed" | "model_downgraded" | "cache_invalidated" | "reasoning_invalidated" | "channel_publish" | "channel_delivery" | "interruption_pending" | "spawn_child_started" | "spawn_child_result" | "prompt_snapshot" | "_meta";
|
|
11
11
|
export interface ToolUse {
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
@@ -129,6 +129,28 @@ export interface RunConfigResponse {
|
|
|
129
129
|
model: string;
|
|
130
130
|
config: RunConfigRecord;
|
|
131
131
|
}
|
|
132
|
+
/** Payload on a `prompt_snapshot` transcript event (RFC DI): the system blocks
|
|
133
|
+
* and the run's input its first model call received. */
|
|
134
|
+
export interface RunPromptSnapshot {
|
|
135
|
+
system: PromptBlock[];
|
|
136
|
+
input: PromptBlock[];
|
|
137
|
+
}
|
|
138
|
+
/** One block of a {@link RunPromptResponse}. `text` blocks carry the prompt
|
|
139
|
+
* text; an `image` block keeps its `media_type` but not its bytes. */
|
|
140
|
+
export interface PromptBlock {
|
|
141
|
+
type: string;
|
|
142
|
+
text?: string;
|
|
143
|
+
media_type?: string;
|
|
144
|
+
}
|
|
145
|
+
/** The reply from `GET /v1/runs/{run_id}/prompt` (RFC DI) — what the run's first
|
|
146
|
+
* model call was sent, as assembled: skills, memory injection, `{{...}}`
|
|
147
|
+
* expansion and metadata already applied. `input` is this run's own input
|
|
148
|
+
* (for a continuation, the new message rather than the whole history). */
|
|
149
|
+
export interface RunPromptResponse {
|
|
150
|
+
run_id: string;
|
|
151
|
+
system: PromptBlock[];
|
|
152
|
+
input: PromptBlock[];
|
|
153
|
+
}
|
|
132
154
|
/** The reply from `GET /v1/runs/{run_id}/effective-config` — for every
|
|
133
155
|
* overridable field, the value this run will actually use and which layer
|
|
134
156
|
* decided it.
|
|
@@ -476,6 +498,8 @@ export interface AgentEvent {
|
|
|
476
498
|
turn_cancelled?: TurnCancelledInfo;
|
|
477
499
|
/** Payload on `spawn_child_started` / `spawn_child_result`. */
|
|
478
500
|
spawn_child?: SpawnChildInfo;
|
|
501
|
+
/** Payload on `prompt_snapshot` (transcript only). */
|
|
502
|
+
prompt_snapshot?: RunPromptSnapshot;
|
|
479
503
|
/** The assistant turn's accumulated reasoning trace, on `done`. Empty for
|
|
480
504
|
* non-thinking models. */
|
|
481
505
|
reasoning?: string;
|
|
@@ -655,6 +679,9 @@ export interface RunOptions extends RunOverrideOptions {
|
|
|
655
679
|
* agent's own sampling (this wins; unset fields inherit). Omitted =
|
|
656
680
|
* inherit entirely. */
|
|
657
681
|
sampling?: SamplingOptions;
|
|
682
|
+
/** Per-run tool choice (RFC DI): whether and which tool the model must
|
|
683
|
+
* call, and for how many calls. REPLACES the agent's own whole. */
|
|
684
|
+
toolChoice?: ToolChoiceOptions;
|
|
658
685
|
/** Per-run context-compaction override (v0.32.0), merged PER FIELD over
|
|
659
686
|
* the agent's own compaction block (this wins; unset fields inherit).
|
|
660
687
|
* Omitted = inherit entirely. Trigger compaction mid-run with
|
|
@@ -695,6 +722,21 @@ export interface RunOptions extends RunOverrideOptions {
|
|
|
695
722
|
* `temperature: 0` is deterministic, NOT "unset". Each provider maps what it
|
|
696
723
|
* supports (e.g. topK is Anthropic/Gemini/Ollama; frequencyPenalty/
|
|
697
724
|
* presencePenalty/seed are OpenAI/DeepSeek/Ollama). */
|
|
725
|
+
/** Whether and which tool the model must call, and for how many calls
|
|
726
|
+
* (RFC DI). Same shape per-agent (AgentDef `tool_choice`) and per-run; a
|
|
727
|
+
* per-run value REPLACES the agent's whole. A model that cannot enforce it
|
|
728
|
+
* runs anyway, with a `capability_inert` event naming what was not enforced. */
|
|
729
|
+
export interface ToolChoiceOptions {
|
|
730
|
+
/** `auto` (provider default), `none` (no tool calls), `required` (some
|
|
731
|
+
* tool), `tool` (the tool named in `name`). */
|
|
732
|
+
mode: "auto" | "none" | "required" | "tool";
|
|
733
|
+
/** The tool to call — required with mode `tool`, refused otherwise. */
|
|
734
|
+
name?: string;
|
|
735
|
+
/** How long it applies: `first_call` (default), `until_called` (until the
|
|
736
|
+
* model makes a call that satisfies it), `always` (refused for `required`
|
|
737
|
+
* and `tool`, which could then never finish). */
|
|
738
|
+
until?: "first_call" | "until_called" | "always";
|
|
739
|
+
}
|
|
698
740
|
export interface SamplingOptions {
|
|
699
741
|
temperature?: number;
|
|
700
742
|
topP?: number;
|
|
@@ -887,6 +929,9 @@ export interface ContinueOptions extends RunOverrideOptions {
|
|
|
887
929
|
runTimeoutSeconds?: number;
|
|
888
930
|
/** Per-continuation LLM sampling override — see {@link RunOptions.sampling}. */
|
|
889
931
|
sampling?: SamplingOptions;
|
|
932
|
+
/** Per-run tool choice (RFC DI): whether and which tool the model must
|
|
933
|
+
* call, and for how many calls. REPLACES the agent's own whole. */
|
|
934
|
+
toolChoice?: ToolChoiceOptions;
|
|
890
935
|
/** Per-continuation context-compaction override — see {@link RunOptions.compaction}. */
|
|
891
936
|
compaction?: CompactionOptions;
|
|
892
937
|
/** Per-continuation context-distillation override — see
|
|
@@ -946,6 +991,18 @@ export interface Agent {
|
|
|
946
991
|
* can attribute a child sub-agent's cost to the user-initiated request
|
|
947
992
|
* in a single fetch. Omitted when the run carried no context. */
|
|
948
993
|
parent_context?: ParentContext;
|
|
994
|
+
/** The run's answer (RFC DI) — what the row had no field for; `stop_reason`,
|
|
995
|
+
* `error` and `usage` are above. Present on {@link LoomcycleClient.getAgent}
|
|
996
|
+
* only (listings omit it), and only once the run has finished with
|
|
997
|
+
* something to report. */
|
|
998
|
+
result?: RunResult;
|
|
999
|
+
}
|
|
1000
|
+
/** A finished run's answer (RFC DI). */
|
|
1001
|
+
export interface RunResult {
|
|
1002
|
+
/** The text of the run's last assistant turn. */
|
|
1003
|
+
final_text?: string;
|
|
1004
|
+
/** The final structured state of a stateful run. */
|
|
1005
|
+
state?: Record<string, unknown>;
|
|
949
1006
|
}
|
|
950
1007
|
export interface ListAgentsResponse {
|
|
951
1008
|
agents: Agent[];
|
|
@@ -1113,7 +1170,8 @@ export interface ReplaySessionResult {
|
|
|
1113
1170
|
/** Result of {@link LoomcycleClient.cancelTurn} (RFC BH) — the current turn was
|
|
1114
1171
|
* stopped and the interactive run parked at awaiting_input (session +
|
|
1115
1172
|
* transcript intact). This is NOT whole-run cancel ({@link
|
|
1116
|
-
* LoomcycleClient.cancelAgent}).
|
|
1173
|
+
* LoomcycleClient.cancelAgent}). For a team walk `parked` is false: the walk
|
|
1174
|
+
* was ended, not parked. */
|
|
1117
1175
|
export interface CancelTurnResult {
|
|
1118
1176
|
run_id: string;
|
|
1119
1177
|
stopped: boolean;
|
|
@@ -2672,6 +2730,8 @@ export interface AgentDefOverlay {
|
|
|
2672
2730
|
code_body?: string;
|
|
2673
2731
|
tier?: string;
|
|
2674
2732
|
effort?: string;
|
|
2733
|
+
/** Whether and which tool the model must call (RFC DI). */
|
|
2734
|
+
tool_choice?: ToolChoiceOptions;
|
|
2675
2735
|
max_tokens?: number;
|
|
2676
2736
|
max_iterations?: number;
|
|
2677
2737
|
max_concurrent_children?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcycle/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.92.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",
|