@loomcycle/client 1.98.0 → 1.99.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 +4 -0
- package/dist/client.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +83 -5
- package/package.json +1 -1
package/dist/cjs/client.js
CHANGED
|
@@ -2050,6 +2050,8 @@ class LoomcycleClient {
|
|
|
2050
2050
|
body.period = opts.period;
|
|
2051
2051
|
if (opts.hold !== undefined)
|
|
2052
2052
|
body.hold = opts.hold;
|
|
2053
|
+
if (opts.hooks !== undefined)
|
|
2054
|
+
body.hooks = opts.hooks;
|
|
2053
2055
|
return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_channels", body, {
|
|
2054
2056
|
signal: opts.signal,
|
|
2055
2057
|
});
|
|
@@ -2069,6 +2071,8 @@ class LoomcycleClient {
|
|
|
2069
2071
|
body.semantic = opts.semantic;
|
|
2070
2072
|
if (opts.hold !== undefined)
|
|
2071
2073
|
body.hold = opts.hold;
|
|
2074
|
+
if (opts.hooks !== undefined)
|
|
2075
|
+
body.hooks = opts.hooks;
|
|
2072
2076
|
return (0, fetch_helpers_js_1.patchJSON)(this.ctx, `/v1/_channels/${encodeURIComponent(name)}`, body, { signal: opts.signal });
|
|
2073
2077
|
}
|
|
2074
2078
|
/** Delete a runtime-substrate channel + cascade its persisted
|
package/dist/client.js
CHANGED
|
@@ -2047,6 +2047,8 @@ export class LoomcycleClient {
|
|
|
2047
2047
|
body.period = opts.period;
|
|
2048
2048
|
if (opts.hold !== undefined)
|
|
2049
2049
|
body.hold = opts.hold;
|
|
2050
|
+
if (opts.hooks !== undefined)
|
|
2051
|
+
body.hooks = opts.hooks;
|
|
2050
2052
|
return postJSON(this.ctx, "/v1/_channels", body, {
|
|
2051
2053
|
signal: opts.signal,
|
|
2052
2054
|
});
|
|
@@ -2066,6 +2068,8 @@ export class LoomcycleClient {
|
|
|
2066
2068
|
body.semantic = opts.semantic;
|
|
2067
2069
|
if (opts.hold !== undefined)
|
|
2068
2070
|
body.hold = opts.hold;
|
|
2071
|
+
if (opts.hooks !== undefined)
|
|
2072
|
+
body.hooks = opts.hooks;
|
|
2069
2073
|
return patchJSON(this.ctx, `/v1/_channels/${encodeURIComponent(name)}`, body, { signal: opts.signal });
|
|
2070
2074
|
}
|
|
2071
2075
|
/** Delete a runtime-substrate channel + cascade its persisted
|
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, RunResult, RunSpec, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, 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, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, 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, 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, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, 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, RunSpec, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, 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, 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, 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, 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, NotFoundError, InvalidArgumentError, ChannelCursorRegressionError, LoomcycleError, NotPausedError, PauseNotConfiguredError, PerUserQuotaExhaustedError, SessionBusyError, SessionNotFoundError, SnapshotNotFoundError, SnapshotTooLargeError, SnapshotVersionError, SubstrateToolRefusedError, UnavailableError, } from "./errors.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -292,9 +292,13 @@ export interface HookDecisionInfo {
|
|
|
292
292
|
/** The call a tool hook decided on; absent for agent_start / agent_stop. */
|
|
293
293
|
tool_use_id?: string;
|
|
294
294
|
tool_name?: string;
|
|
295
|
+
/** The message a `channel_publish` hook decided on. */
|
|
296
|
+
channel?: string;
|
|
297
|
+
message_id?: string;
|
|
295
298
|
/** `block` and `hold` are agent_stop's: the model was sent back with
|
|
296
|
-
* `reason`, or the answer is held for a verdict.
|
|
297
|
-
|
|
299
|
+
* `reason`, or the answer is held for a verdict. `release`,
|
|
300
|
+
* `rewrite_body` and `drop` are a channel hook's (it may `hold` too). */
|
|
301
|
+
decision: "deny" | "rewrite_input" | "rewrite_output" | "context" | "block" | "hold" | "unavailable" | "release" | "rewrite_body" | "drop";
|
|
298
302
|
/** For `unavailable`: `open` (the call went ahead) or `closed` (refused). */
|
|
299
303
|
fail_mode?: "open" | "closed";
|
|
300
304
|
/** A deny's or block's text, a hold's reason, or the error that made the
|
|
@@ -1843,7 +1847,10 @@ export interface ResolveInterruptOptions {
|
|
|
1843
1847
|
}
|
|
1844
1848
|
/** `post_failure` runs only when the tool failed, before the post chain, with
|
|
1845
1849
|
* the failure's classification in the payload. */
|
|
1846
|
-
export type HookPhase = "pre" | "post" | "post_failure" | "agent_start" | "agent_stop" | "subagent_start" | "subagent_stop" | "pre_compact" | "post_compact" | "run_end"
|
|
1850
|
+
export type HookPhase = "pre" | "post" | "post_failure" | "agent_start" | "agent_stop" | "subagent_start" | "subagent_stop" | "pre_compact" | "post_compact" | "run_end"
|
|
1851
|
+
/** A channel's event: runs on each message published to a channel that
|
|
1852
|
+
* carries hooks, before any reader sees it. */
|
|
1853
|
+
| "channel_publish";
|
|
1847
1854
|
export type HookFailMode = "open" | "closed";
|
|
1848
1855
|
export interface HookToolCall {
|
|
1849
1856
|
id: string;
|
|
@@ -1891,6 +1898,35 @@ export interface PostHookCall {
|
|
|
1891
1898
|
tool_call: HookToolCall;
|
|
1892
1899
|
tool_result: HookToolResult;
|
|
1893
1900
|
}
|
|
1901
|
+
/** What a `channel_publish` webhook receives: one message, before any reader
|
|
1902
|
+
* of the channel sees it. */
|
|
1903
|
+
export interface ChannelHookCall {
|
|
1904
|
+
phase: "channel_publish";
|
|
1905
|
+
/** `"channel:<name>"`. */
|
|
1906
|
+
owner: string;
|
|
1907
|
+
hook_name: string;
|
|
1908
|
+
channel: string;
|
|
1909
|
+
scope: string;
|
|
1910
|
+
scope_id?: string;
|
|
1911
|
+
/** The same on every call for this message — a retry, or after a restart. */
|
|
1912
|
+
message_id: string;
|
|
1913
|
+
published_at: string;
|
|
1914
|
+
published_by?: string;
|
|
1915
|
+
/** `"starter_sink"` for a Starter's per-run result: a drop delivers it as
|
|
1916
|
+
* an error result rather than removing it. */
|
|
1917
|
+
origin?: string;
|
|
1918
|
+
/** Counts this hook's calls for this message, from 1. */
|
|
1919
|
+
attempt: number;
|
|
1920
|
+
/** The message as the previous hook in the chain left it. */
|
|
1921
|
+
body: unknown;
|
|
1922
|
+
}
|
|
1923
|
+
/** What a `channel_publish` webhook returns. An empty body releases the
|
|
1924
|
+
* message as it is. `updated_body` goes with `release` only. */
|
|
1925
|
+
export interface ChannelHookResult {
|
|
1926
|
+
decision?: "release" | "drop" | "hold";
|
|
1927
|
+
updated_body?: unknown;
|
|
1928
|
+
reason?: string;
|
|
1929
|
+
}
|
|
1894
1930
|
/** Input shape for {@link LoomcycleClient.agentDef} and
|
|
1895
1931
|
* {@link LoomcycleClient.skillDef}. Mirrors the in-process tool
|
|
1896
1932
|
* input — `op` discriminates create / fork / get / list / promote
|
|
@@ -2369,7 +2405,13 @@ export interface ChannelDescriptor {
|
|
|
2369
2405
|
max_messages?: number;
|
|
2370
2406
|
/** Breakpoint: publishes are stored but never delivered until released. */
|
|
2371
2407
|
hold?: boolean;
|
|
2408
|
+
/** Hooks that decide each message before any reader sees it. */
|
|
2409
|
+
hooks?: EventHooks;
|
|
2372
2410
|
message_count: number;
|
|
2411
|
+
/** Messages held for a release, and waiting for the channel's hooks —
|
|
2412
|
+
* both counted in `message_count`. */
|
|
2413
|
+
held_count?: number;
|
|
2414
|
+
awaiting_hooks_count?: number;
|
|
2373
2415
|
/** RFC3339 — empty when count == 0. */
|
|
2374
2416
|
oldest_visible_at?: string;
|
|
2375
2417
|
newest_visible_at?: string;
|
|
@@ -2414,6 +2456,13 @@ export interface ChannelPublishResult {
|
|
|
2414
2456
|
created_at: string;
|
|
2415
2457
|
/** RFC3339Nano. Omitted when the publish was immediate. */
|
|
2416
2458
|
visible_at?: string;
|
|
2459
|
+
/** The channel holds: stored, not delivered until released. */
|
|
2460
|
+
held?: boolean;
|
|
2461
|
+
/** The channel carries hooks: stored, delivered only if they release it. */
|
|
2462
|
+
awaiting_hooks?: boolean;
|
|
2463
|
+
/** How many of the channel's oldest messages the write trimmed to stay
|
|
2464
|
+
* within max_messages. */
|
|
2465
|
+
dropped_oldest?: number;
|
|
2417
2466
|
}
|
|
2418
2467
|
/** Options for {@link LoomcycleClient.subscribeChannel}. The call is a
|
|
2419
2468
|
* single-round-trip long-poll, NOT an open SSE stream — returns
|
|
@@ -2531,6 +2580,9 @@ export interface ChannelBroadcastEntry {
|
|
|
2531
2580
|
created_at?: string;
|
|
2532
2581
|
visible_at?: string;
|
|
2533
2582
|
error?: string;
|
|
2583
|
+
/** As on a single publish. */
|
|
2584
|
+
held?: boolean;
|
|
2585
|
+
awaiting_hooks?: boolean;
|
|
2534
2586
|
}
|
|
2535
2587
|
/** Response shape for {@link LoomcycleClient.broadcastChannels}.
|
|
2536
2588
|
* `published` + `failed` = the deduped channel count. */
|
|
@@ -2546,7 +2598,7 @@ export interface ChannelBroadcastResult {
|
|
|
2546
2598
|
export interface CreateChannelOptions {
|
|
2547
2599
|
name: string;
|
|
2548
2600
|
description?: string;
|
|
2549
|
-
/** "global" | "agent" | "user". Defaults to "global" if omitted. */
|
|
2601
|
+
/** "global" | "tenant" | "agent" | "user". Defaults to "global" if omitted. */
|
|
2550
2602
|
scope?: string;
|
|
2551
2603
|
/** "queue" | "topic". Defaults to "queue" if omitted. */
|
|
2552
2604
|
semantic?: string;
|
|
@@ -2561,6 +2613,11 @@ export interface CreateChannelOptions {
|
|
|
2561
2613
|
/** Breakpoint: publishes are stored but never delivered until
|
|
2562
2614
|
* {@link LoomcycleClient.releaseChannel} hands them over. */
|
|
2563
2615
|
hold?: boolean;
|
|
2616
|
+
/** Hooks that decide each message published to the channel before any
|
|
2617
|
+
* reader sees it: `{ channel_publish: [HookDef name | inline webhook] }`.
|
|
2618
|
+
* Skipped while the server runs no channel hooks; an unknown HookDef is
|
|
2619
|
+
* refused (400 `channel_hooks_invalid`). */
|
|
2620
|
+
hooks?: EventHooks;
|
|
2564
2621
|
signal?: AbortSignal;
|
|
2565
2622
|
}
|
|
2566
2623
|
/** Options for {@link LoomcycleClient.updateChannel}. Nil fields
|
|
@@ -2574,6 +2631,8 @@ export interface UpdateChannelOptions {
|
|
|
2574
2631
|
/** Turn the breakpoint on or off. Messages already held stay held
|
|
2575
2632
|
* until released — turning it off does not flush the queue. */
|
|
2576
2633
|
hold?: boolean;
|
|
2634
|
+
/** Replace the channel's hooks; `{}` removes them. */
|
|
2635
|
+
hooks?: EventHooks;
|
|
2577
2636
|
signal?: AbortSignal;
|
|
2578
2637
|
}
|
|
2579
2638
|
/** Options for {@link LoomcycleClient.releaseChannel}. */
|
|
@@ -2869,7 +2928,9 @@ export interface AgentInterruptionACL {
|
|
|
2869
2928
|
}
|
|
2870
2929
|
/** A hook event: a tool call's `pre` / `post` / `post_failure`, or a point in
|
|
2871
2930
|
* the run. */
|
|
2872
|
-
export type HookEvent = "pre" | "post" | "post_failure" | "agent_start" | "agent_stop" | "subagent_start" | "subagent_stop" | "pre_compact" | "post_compact" | "run_end"
|
|
2931
|
+
export type HookEvent = "pre" | "post" | "post_failure" | "agent_start" | "agent_stop" | "subagent_start" | "subagent_stop" | "pre_compact" | "post_compact" | "run_end"
|
|
2932
|
+
/** A channel's own event; an agent, a team or a run cannot attach it. */
|
|
2933
|
+
| "channel_publish";
|
|
2873
2934
|
/** A webhook written into the definition that attaches it. */
|
|
2874
2935
|
export interface InlineWebhook {
|
|
2875
2936
|
name: string;
|
|
@@ -2893,6 +2954,15 @@ export interface ToolEntry {
|
|
|
2893
2954
|
name: string;
|
|
2894
2955
|
hooks: Partial<Record<"pre" | "post" | "post_failure", HookEntry[]>>;
|
|
2895
2956
|
}
|
|
2957
|
+
/** An agent's opt-in to the listwise search rerank (`memory_rerank`). A fork
|
|
2958
|
+
* overlay merges it per field. */
|
|
2959
|
+
export interface MemoryRerank {
|
|
2960
|
+
enabled?: boolean;
|
|
2961
|
+
/** How many search candidates the model is shown (2-50). Default 20. */
|
|
2962
|
+
candidates?: number;
|
|
2963
|
+
/** Per-candidate character budget (200-20000). Default 1200. */
|
|
2964
|
+
max_chars?: number;
|
|
2965
|
+
}
|
|
2896
2966
|
export interface AgentDefOverlay {
|
|
2897
2967
|
provider?: string;
|
|
2898
2968
|
model?: string;
|
|
@@ -2939,6 +3009,14 @@ export interface AgentDefOverlay {
|
|
|
2939
3009
|
* `history_scope`, and needs the trace index enabled AND backfilled — an empty
|
|
2940
3010
|
* index yields zero turns silently. */
|
|
2941
3011
|
recall_attach_traces?: boolean;
|
|
3012
|
+
/** Rerank this agent's document searches: `Memory op=search`, `Document
|
|
3013
|
+
* op=search`, and `recall` when it asks for documents, reorder their first
|
|
3014
|
+
* candidates with the operator's
|
|
3015
|
+
* `memory.reranker` model. Costs one model call per search (about 6,000 prompt
|
|
3016
|
+
* tokens), which is why it is set here and has NO tool parameter. The response
|
|
3017
|
+
* reports `reranked` (and `rerank_reason` when false); a failed or unavailable
|
|
3018
|
+
* rerank keeps the search's own order. */
|
|
3019
|
+
memory_rerank?: MemoryRerank;
|
|
2942
3020
|
memory_quota_bytes?: number;
|
|
2943
3021
|
memory_backend?: string;
|
|
2944
3022
|
retry_attempts?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcycle/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.99.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",
|