@loomcycle/client 1.83.0 → 1.85.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 +35 -0
- package/dist/client.js +35 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +99 -0
- package/package.json +1 -1
package/dist/cjs/client.js
CHANGED
|
@@ -68,6 +68,37 @@ function compactionToWire(c) {
|
|
|
68
68
|
w.model = c.model;
|
|
69
69
|
return w;
|
|
70
70
|
}
|
|
71
|
+
/** contextToWire maps the camelCase ContextOptions to the snake_case `context`
|
|
72
|
+
* block the server decodes.
|
|
73
|
+
*
|
|
74
|
+
* Note `autorecapAtPct` -> `autorecap_at_pct`: the wire key has no underscore
|
|
75
|
+
* after "auto", unlike compaction's `autocompact_at_pct`. The two blocks are
|
|
76
|
+
* spelled differently on the wire and a shared helper would have to special-
|
|
77
|
+
* case one of them, so they stay separate functions. */
|
|
78
|
+
function contextToWire(c) {
|
|
79
|
+
const w = {};
|
|
80
|
+
if (c.mode !== undefined)
|
|
81
|
+
w.mode = c.mode;
|
|
82
|
+
if (c.keepLastN !== undefined)
|
|
83
|
+
w.keep_last_n = c.keepLastN;
|
|
84
|
+
if (c.reasoning !== undefined)
|
|
85
|
+
w.reasoning = c.reasoning;
|
|
86
|
+
if (c.recapMaxChars !== undefined)
|
|
87
|
+
w.recap_max_chars = c.recapMaxChars;
|
|
88
|
+
if (c.autorecapAtPct !== undefined)
|
|
89
|
+
w.autorecap_at_pct = c.autorecapAtPct;
|
|
90
|
+
if (c.stateSchema !== undefined)
|
|
91
|
+
w.state_schema = c.stateSchema;
|
|
92
|
+
if (c.onInvalidPatch !== undefined)
|
|
93
|
+
w.on_invalid_patch = c.onInvalidPatch;
|
|
94
|
+
if (c.maxPatchRetries !== undefined)
|
|
95
|
+
w.max_patch_retries = c.maxPatchRetries;
|
|
96
|
+
if (c.recall !== undefined)
|
|
97
|
+
w.recall = c.recall;
|
|
98
|
+
if (c.harvestToMemory !== undefined)
|
|
99
|
+
w.harvest_to_memory = c.harvestToMemory;
|
|
100
|
+
return w;
|
|
101
|
+
}
|
|
71
102
|
/** runBody builds the snake_case /v1/runs request body from RunOptions,
|
|
72
103
|
* omitting unset fields (preserves the server's nil semantics — notably
|
|
73
104
|
* `allowedHosts: null` is treated as "omit", not deny-all). Shared by
|
|
@@ -109,6 +140,8 @@ function runBody(opts) {
|
|
|
109
140
|
body.sampling = samplingToWire(opts.sampling);
|
|
110
141
|
if (opts.compaction !== undefined)
|
|
111
142
|
body.compaction = compactionToWire(opts.compaction);
|
|
143
|
+
if (opts.context !== undefined)
|
|
144
|
+
body.context = contextToWire(opts.context);
|
|
112
145
|
if (opts.maxContextTokens !== undefined)
|
|
113
146
|
body.max_context_tokens = opts.maxContextTokens;
|
|
114
147
|
if (opts.interactive !== undefined)
|
|
@@ -239,6 +272,8 @@ class LoomcycleClient {
|
|
|
239
272
|
body.sampling = samplingToWire(opts.sampling);
|
|
240
273
|
if (opts.compaction !== undefined)
|
|
241
274
|
body.compaction = compactionToWire(opts.compaction);
|
|
275
|
+
if (opts.context !== undefined)
|
|
276
|
+
body.context = contextToWire(opts.context);
|
|
242
277
|
if (opts.maxContextTokens !== undefined)
|
|
243
278
|
body.max_context_tokens = opts.maxContextTokens;
|
|
244
279
|
if (opts.interactive !== undefined)
|
package/dist/client.js
CHANGED
|
@@ -65,6 +65,37 @@ function compactionToWire(c) {
|
|
|
65
65
|
w.model = c.model;
|
|
66
66
|
return w;
|
|
67
67
|
}
|
|
68
|
+
/** contextToWire maps the camelCase ContextOptions to the snake_case `context`
|
|
69
|
+
* block the server decodes.
|
|
70
|
+
*
|
|
71
|
+
* Note `autorecapAtPct` -> `autorecap_at_pct`: the wire key has no underscore
|
|
72
|
+
* after "auto", unlike compaction's `autocompact_at_pct`. The two blocks are
|
|
73
|
+
* spelled differently on the wire and a shared helper would have to special-
|
|
74
|
+
* case one of them, so they stay separate functions. */
|
|
75
|
+
function contextToWire(c) {
|
|
76
|
+
const w = {};
|
|
77
|
+
if (c.mode !== undefined)
|
|
78
|
+
w.mode = c.mode;
|
|
79
|
+
if (c.keepLastN !== undefined)
|
|
80
|
+
w.keep_last_n = c.keepLastN;
|
|
81
|
+
if (c.reasoning !== undefined)
|
|
82
|
+
w.reasoning = c.reasoning;
|
|
83
|
+
if (c.recapMaxChars !== undefined)
|
|
84
|
+
w.recap_max_chars = c.recapMaxChars;
|
|
85
|
+
if (c.autorecapAtPct !== undefined)
|
|
86
|
+
w.autorecap_at_pct = c.autorecapAtPct;
|
|
87
|
+
if (c.stateSchema !== undefined)
|
|
88
|
+
w.state_schema = c.stateSchema;
|
|
89
|
+
if (c.onInvalidPatch !== undefined)
|
|
90
|
+
w.on_invalid_patch = c.onInvalidPatch;
|
|
91
|
+
if (c.maxPatchRetries !== undefined)
|
|
92
|
+
w.max_patch_retries = c.maxPatchRetries;
|
|
93
|
+
if (c.recall !== undefined)
|
|
94
|
+
w.recall = c.recall;
|
|
95
|
+
if (c.harvestToMemory !== undefined)
|
|
96
|
+
w.harvest_to_memory = c.harvestToMemory;
|
|
97
|
+
return w;
|
|
98
|
+
}
|
|
68
99
|
/** runBody builds the snake_case /v1/runs request body from RunOptions,
|
|
69
100
|
* omitting unset fields (preserves the server's nil semantics — notably
|
|
70
101
|
* `allowedHosts: null` is treated as "omit", not deny-all). Shared by
|
|
@@ -106,6 +137,8 @@ function runBody(opts) {
|
|
|
106
137
|
body.sampling = samplingToWire(opts.sampling);
|
|
107
138
|
if (opts.compaction !== undefined)
|
|
108
139
|
body.compaction = compactionToWire(opts.compaction);
|
|
140
|
+
if (opts.context !== undefined)
|
|
141
|
+
body.context = contextToWire(opts.context);
|
|
109
142
|
if (opts.maxContextTokens !== undefined)
|
|
110
143
|
body.max_context_tokens = opts.maxContextTokens;
|
|
111
144
|
if (opts.interactive !== undefined)
|
|
@@ -236,6 +269,8 @@ export class LoomcycleClient {
|
|
|
236
269
|
body.sampling = samplingToWire(opts.sampling);
|
|
237
270
|
if (opts.compaction !== undefined)
|
|
238
271
|
body.compaction = compactionToWire(opts.compaction);
|
|
272
|
+
if (opts.context !== undefined)
|
|
273
|
+
body.context = contextToWire(opts.context);
|
|
239
274
|
if (opts.maxContextTokens !== undefined)
|
|
240
275
|
body.max_context_tokens = opts.maxContextTokens;
|
|
241
276
|
if (opts.interactive !== undefined)
|
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, 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, 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";
|
|
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
|
@@ -465,6 +465,14 @@ export interface RunOptions extends RunOverrideOptions {
|
|
|
465
465
|
* Omitted = inherit entirely. Trigger compaction mid-run with
|
|
466
466
|
* {@link LoomcycleClient.compactRun}. */
|
|
467
467
|
compaction?: CompactionOptions;
|
|
468
|
+
/** Per-run context-DISTILLATION override, merged PER FIELD over the agent's
|
|
469
|
+
* own `context` block (this wins; unset fields inherit).
|
|
470
|
+
*
|
|
471
|
+
* Start-only — see {@link ContextOptions}. This is what varies the
|
|
472
|
+
* distillation strategy for a run without forking the agent, and outside
|
|
473
|
+
* `mode: "append"` it, not {@link RunOptions.compaction}, is the block the
|
|
474
|
+
* runtime reads. */
|
|
475
|
+
context?: ContextOptions;
|
|
468
476
|
/** Per-run context-WINDOW override in tokens (RFC CJ). Wins over the agent's
|
|
469
477
|
* own `max_context_tokens` when > 0; omitted = inherit it (which itself
|
|
470
478
|
* defers to the provider/driver default). Distinct from a model's output
|
|
@@ -519,6 +527,81 @@ export interface CompactionOptions {
|
|
|
519
527
|
* provider. Omitted = the run's model. */
|
|
520
528
|
model?: string;
|
|
521
529
|
}
|
|
530
|
+
/** Per-run context-distillation override. Mirrors the server's `context`
|
|
531
|
+
* block — every field optional; an unset field inherits the agent's value,
|
|
532
|
+
* merged per field.
|
|
533
|
+
*
|
|
534
|
+
* DISTINCT from {@link CompactionOptions}, and the two are not
|
|
535
|
+
* interchangeable: `compaction` is the append-mode summariser, while this
|
|
536
|
+
* chooses HOW history is distilled at all. Outside `mode: "append"` the
|
|
537
|
+
* compaction knobs are never consulted — so setting `autocompactAtPct` on a
|
|
538
|
+
* recap or stateful run does nothing. The server reports settings in that
|
|
539
|
+
* state under `inert` on GET /v1/runs/{id}/effective-config.
|
|
540
|
+
*
|
|
541
|
+
* START-ONLY. These are accepted when a run BEGINS, not by retune: `mode` is
|
|
542
|
+
* latched before the loop starts (the stateful branch is taken or not, and
|
|
543
|
+
* the tool catalogue is already resolved), so a retune could apply the
|
|
544
|
+
* thresholds and silently ignore the mode. */
|
|
545
|
+
export interface ContextOptions {
|
|
546
|
+
/** How history is distilled.
|
|
547
|
+
* - `append` — keep everything; the compaction knobs apply here and
|
|
548
|
+
* ONLY here.
|
|
549
|
+
* - `recap` — fold the evicted span into a running progress note.
|
|
550
|
+
* - `stateful` — a different loop: the model emits a patch + action each
|
|
551
|
+
* step and carries state rather than transcript.
|
|
552
|
+
* - `auto` — resolved at run start from the provider: a local backend
|
|
553
|
+
* or an interactive run takes `recap`, a frontier API takes
|
|
554
|
+
* `stateful`. */
|
|
555
|
+
mode?: "append" | "recap" | "stateful" | "auto";
|
|
556
|
+
/** Keep the last N messages verbatim (default 6; 0 = distil all).
|
|
557
|
+
*
|
|
558
|
+
* ⚠️ This is a FLOOR on what can be distilled: a conversation of N+1
|
|
559
|
+
* messages or fewer has nothing left after the pinned first turn, so it
|
|
560
|
+
* never distils however full the window is. A chat of few enormous turns
|
|
561
|
+
* is exactly that shape. The run reports it as a `context_distill_declined`
|
|
562
|
+
* event with reason `split_declined`, carrying both numbers. */
|
|
563
|
+
keepLastN?: number;
|
|
564
|
+
/** What happens to the evicted span in recap mode.
|
|
565
|
+
* - `recap` (default) — summarise it into a running note.
|
|
566
|
+
* - `drop` — discard it with no note.
|
|
567
|
+
* - `keep` — distil nothing. Reported as a `reasoning_keep`
|
|
568
|
+
* decline WHEN THE THRESHOLD IS REACHED, so the run
|
|
569
|
+
* says why the window is not being reclaimed. Below
|
|
570
|
+
* the threshold there is nothing to report and no
|
|
571
|
+
* frame is emitted — absence of a decline means the
|
|
572
|
+
* gate did not open, not that distillation is
|
|
573
|
+
* broken. */
|
|
574
|
+
reasoning?: "recap" | "drop" | "keep";
|
|
575
|
+
/** Character budget for the running recap note (default 512).
|
|
576
|
+
*
|
|
577
|
+
* ⚠️ The summariser's token budget is derived from this
|
|
578
|
+
* (`recapMaxChars/4 + 64`), so the default allows ~192 tokens. A model that
|
|
579
|
+
* spends its budget on reasoning can return nothing at all, which the run
|
|
580
|
+
* reports as a `context_distill_declined` event with reason
|
|
581
|
+
* `empty_summary`. Raise this, or pick an effort that stops the model
|
|
582
|
+
* thinking. */
|
|
583
|
+
recapMaxChars?: number;
|
|
584
|
+
/** Auto-distil when used/window ≥ N% (50..95; default 80). This is the live
|
|
585
|
+
* threshold in recap mode — NOT `compaction.autocompactAtPct`. */
|
|
586
|
+
autorecapAtPct?: number;
|
|
587
|
+
/** JSON Schema the stateful mode validates every state patch against.
|
|
588
|
+
* Stateful mode only. */
|
|
589
|
+
stateSchema?: Record<string, unknown>;
|
|
590
|
+
/** What a stateful run does with a patch that fails the schema
|
|
591
|
+
* (`retry` default, or `fail`). */
|
|
592
|
+
onInvalidPatch?: "retry" | "fail";
|
|
593
|
+
/** How many times a rejected patch may be retried (default 2). */
|
|
594
|
+
maxPatchRetries?: number;
|
|
595
|
+
/** Grant the Recall tool so the agent can fetch back detail the
|
|
596
|
+
* distillation dropped. */
|
|
597
|
+
recall?: boolean;
|
|
598
|
+
/** Bank each evicted span for the memory consolidator.
|
|
599
|
+
*
|
|
600
|
+
* This is the flag the recap and stateful paths actually read —
|
|
601
|
+
* `compaction.memoryFlush` installs the banking callback but nothing
|
|
602
|
+
* outside append mode calls it. */
|
|
603
|
+
harvestToMemory?: boolean;
|
|
604
|
+
}
|
|
522
605
|
/** Opaque caller-tracking lineage (v0.12.x) attached to a run and
|
|
523
606
|
* propagated to all its sub-agents. The runtime stores and echoes
|
|
524
607
|
* these fields verbatim and never interprets them. All fields
|
|
@@ -602,6 +685,9 @@ export interface ContinueOptions extends RunOverrideOptions {
|
|
|
602
685
|
sampling?: SamplingOptions;
|
|
603
686
|
/** Per-continuation context-compaction override — see {@link RunOptions.compaction}. */
|
|
604
687
|
compaction?: CompactionOptions;
|
|
688
|
+
/** Per-continuation context-distillation override — see
|
|
689
|
+
* {@link RunOptions.context}. */
|
|
690
|
+
context?: ContextOptions;
|
|
605
691
|
/** Per-continuation context-WINDOW override in tokens — see
|
|
606
692
|
* {@link RunOptions.maxContextTokens}. */
|
|
607
693
|
maxContextTokens?: number;
|
|
@@ -2395,6 +2481,19 @@ export interface AgentDefOverlay {
|
|
|
2395
2481
|
* models they do not make it. Also gated by `history_scope`: this decides whether
|
|
2396
2482
|
* turns are OFFERED, history_scope whether they may be READ. */
|
|
2397
2483
|
recall_include_turns?: boolean;
|
|
2484
|
+
/** Also run the QUESTION-anchored trace search on every `recall` and return those
|
|
2485
|
+
* turns as their own block, beside the facts.
|
|
2486
|
+
*
|
|
2487
|
+
* Distinct from `recall_include_turns`, which attaches the turn each recalled FACT
|
|
2488
|
+
* was distilled from: fact-anchored retrieval can only reach turns some fact was
|
|
2489
|
+
* already extracted from, and the turns that answer the rest are the ones the
|
|
2490
|
+
* extractor passed over. Measured on one corpus the two routes differ by 24 points.
|
|
2491
|
+
*
|
|
2492
|
+
* Operator-set, with deliberately NO tool parameter: told to pass the sibling's
|
|
2493
|
+
* parameter on every call, one model passed it on 51 of 128. Also gated by
|
|
2494
|
+
* `history_scope`, and needs the trace index enabled AND backfilled — an empty
|
|
2495
|
+
* index yields zero turns silently. */
|
|
2496
|
+
recall_attach_traces?: boolean;
|
|
2398
2497
|
memory_quota_bytes?: number;
|
|
2399
2498
|
memory_backend?: string;
|
|
2400
2499
|
retry_attempts?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcycle/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.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",
|