@loomcycle/client 1.51.0 → 1.55.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.
@@ -763,6 +763,43 @@ class LoomcycleClient {
763
763
  * rows processed per call (server default 1000). The response is a
764
764
  * discriminated union on `dry_run` — narrow before reading its
765
765
  * arm-specific fields. */
766
+ // backfillEmbeddings embeds rows that carry none — what an embedder added AFTER the
767
+ // rows were written leaves behind.
768
+ //
769
+ // dry_run defaults TRUE server-side and this only ever sends `false` to commit, the
770
+ // same posture as reembedMemory: an omitted flag cannot accidentally spend thousands
771
+ // of embedder calls.
772
+ async backfillEmbeddings(scope, scopeId, opts) {
773
+ const query = { scope, scope_id: scopeId };
774
+ if (opts?.dryRun === false)
775
+ query.dry_run = "false";
776
+ if (opts?.limit !== undefined && opts.limit > 0)
777
+ query.limit = String(opts.limit);
778
+ if (opts?.prefix)
779
+ query.prefix = opts.prefix;
780
+ // An ADMIN token must name the tenant: memory rows are keyed on it, so omitting it
781
+ // silently targets the default tenant and reports a truthful-looking zero.
782
+ if (opts?.tenant !== undefined)
783
+ query.tenant = opts.tenant;
784
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_memory/backfill_embeddings", undefined, { query, signal: opts?.signal });
785
+ }
786
+ // purgeStaleEmbeddings drops embeddings from rows that have no indexable text.
787
+ //
788
+ // THIS ONE DELETES, so the dry-run default matters more than on its siblings — and a
789
+ // zero `stale` with `truncated: true` means the scan was cut short, not that the scope
790
+ // is clean.
791
+ async purgeStaleEmbeddings(scope, scopeId, opts) {
792
+ const query = { scope, scope_id: scopeId };
793
+ if (opts?.dryRun === false)
794
+ query.dry_run = "false";
795
+ if (opts?.limit !== undefined && opts.limit > 0)
796
+ query.limit = String(opts.limit);
797
+ if (opts?.prefix)
798
+ query.prefix = opts.prefix;
799
+ if (opts?.tenant !== undefined)
800
+ query.tenant = opts.tenant;
801
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_memory/purge_stale_embeddings", undefined, { query, signal: opts?.signal });
802
+ }
766
803
  async reembedMemory(scope, scopeId, opts) {
767
804
  const query = { scope, scope_id: scopeId };
768
805
  // Only send dry_run=false to commit; an omitted flag leaves the
@@ -1104,6 +1141,14 @@ class LoomcycleClient {
1104
1141
  async memoryBackendDef(input, opts) {
1105
1142
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_memorybackenddef", input, opts);
1106
1143
  }
1144
+ /** DocumentSourceDef substrate ops (create/fork/get/list/retire) — RFC CE
1145
+ * remote-document-source registration. Operator-admin only. Authors + forks
1146
+ * named peer document sources the Document tool's set_remote/sync consume.
1147
+ * Static document_sources.<name>: yaml stays immutable ground truth; this
1148
+ * produces the derived layer. Mirrors POST /v1/_documentsourcedef. */
1149
+ async documentSourceDef(input, opts) {
1150
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_documentsourcedef", input, opts);
1151
+ }
1107
1152
  /** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
1108
1153
  * RFC L OSS multi-tenant authorization. Operator-admin only. The
1109
1154
  * token plaintext is returned ONCE in the create/rotate response.
@@ -1191,6 +1236,10 @@ class LoomcycleClient {
1191
1236
  body.def_id = target.defId;
1192
1237
  if (target.input !== undefined)
1193
1238
  body.input = target.input;
1239
+ if (target.boardChunkId !== undefined)
1240
+ body.board_chunk_id = target.boardChunkId;
1241
+ if (target.boardScope !== undefined)
1242
+ body.board_scope = target.boardScope;
1194
1243
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_teamdef", body, opts);
1195
1244
  }
1196
1245
  /** Invoke the RFC AL Path VFS tool over HTTP (`POST /v1/_path`). A
package/dist/cjs/index.js CHANGED
@@ -51,6 +51,8 @@
51
51
  * memorySearch(input): Promise<MemorySearchResponse> // unified k/v + document-chunk search
52
52
  * memoryEmbedStats(scope): Promise<MemoryEmbedStatsResponse>
53
53
  * reembedMemory(scope, scopeId, opts?): Promise<MemoryReembedResponse> // dry_run defaults true
54
+ * backfillEmbeddings(scope, scopeId, opts?): Promise<MemoryBackfillResponse> // embeds rows that have none
55
+ * purgeStaleEmbeddings(scope, scopeId, opts?): Promise<MemoryPurgeResponse> // DELETES; dry_run defaults true
54
56
  *
55
57
  * // Interruption (v0.8.16; decline RFC BH)
56
58
  * listUserInterrupts(userId, opts?): Promise<InterruptListResponse>
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 { DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, 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, TeamDefDetail, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, TranscriptResponse, WhoamiResponse, UsageDimension, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest } from "./types.js";
28
+ import type { DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelPurgeResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, 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, TeamDefDetail, 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);
@@ -522,6 +522,20 @@ export declare class LoomcycleClient {
522
522
  * rows processed per call (server default 1000). The response is a
523
523
  * discriminated union on `dry_run` — narrow before reading its
524
524
  * arm-specific fields. */
525
+ backfillEmbeddings(scope: string, scopeId: string, opts?: {
526
+ dryRun?: boolean;
527
+ limit?: number;
528
+ prefix?: string;
529
+ tenant?: string;
530
+ signal?: AbortSignal;
531
+ }): Promise<MemoryBackfillResponse>;
532
+ purgeStaleEmbeddings(scope: string, scopeId: string, opts?: {
533
+ dryRun?: boolean;
534
+ limit?: number;
535
+ prefix?: string;
536
+ tenant?: string;
537
+ signal?: AbortSignal;
538
+ }): Promise<MemoryPurgeResponse>;
525
539
  reembedMemory(scope: string, scopeId: string, opts?: {
526
540
  dryRun?: boolean;
527
541
  limit?: number;
@@ -779,6 +793,14 @@ export declare class LoomcycleClient {
779
793
  memoryBackendDef(input: SubstrateToolInput, opts?: {
780
794
  signal?: AbortSignal;
781
795
  }): Promise<SubstrateToolResponse>;
796
+ /** DocumentSourceDef substrate ops (create/fork/get/list/retire) — RFC CE
797
+ * remote-document-source registration. Operator-admin only. Authors + forks
798
+ * named peer document sources the Document tool's set_remote/sync consume.
799
+ * Static document_sources.<name>: yaml stays immutable ground truth; this
800
+ * produces the derived layer. Mirrors POST /v1/_documentsourcedef. */
801
+ documentSourceDef(input: SubstrateToolInput, opts?: {
802
+ signal?: AbortSignal;
803
+ }): Promise<SubstrateToolResponse>;
782
804
  /** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
783
805
  * RFC L OSS multi-tenant authorization. Operator-admin only. The
784
806
  * token plaintext is returned ONCE in the create/rotate response.
@@ -855,6 +877,14 @@ export declare class LoomcycleClient {
855
877
  name?: string;
856
878
  defId?: string;
857
879
  input?: string;
880
+ /** Bind the walk to a Document chunk task board (RFC BT P4): each state
881
+ * transition persists `chunk.status` = the current team state, and every
882
+ * handler run this walk spawns carries the task key on its
883
+ * `parent_context` (so a board client can pin the live agent to the
884
+ * card). Omit for an ephemeral run. */
885
+ boardChunkId?: string;
886
+ /** The Document scope of `boardChunkId` (agent | user, default user). */
887
+ boardScope?: "agent" | "user";
858
888
  }, opts?: {
859
889
  signal?: AbortSignal;
860
890
  }): Promise<TeamRunResult>;
package/dist/client.js CHANGED
@@ -760,6 +760,43 @@ export class LoomcycleClient {
760
760
  * rows processed per call (server default 1000). The response is a
761
761
  * discriminated union on `dry_run` — narrow before reading its
762
762
  * arm-specific fields. */
763
+ // backfillEmbeddings embeds rows that carry none — what an embedder added AFTER the
764
+ // rows were written leaves behind.
765
+ //
766
+ // dry_run defaults TRUE server-side and this only ever sends `false` to commit, the
767
+ // same posture as reembedMemory: an omitted flag cannot accidentally spend thousands
768
+ // of embedder calls.
769
+ async backfillEmbeddings(scope, scopeId, opts) {
770
+ const query = { scope, scope_id: scopeId };
771
+ if (opts?.dryRun === false)
772
+ query.dry_run = "false";
773
+ if (opts?.limit !== undefined && opts.limit > 0)
774
+ query.limit = String(opts.limit);
775
+ if (opts?.prefix)
776
+ query.prefix = opts.prefix;
777
+ // An ADMIN token must name the tenant: memory rows are keyed on it, so omitting it
778
+ // silently targets the default tenant and reports a truthful-looking zero.
779
+ if (opts?.tenant !== undefined)
780
+ query.tenant = opts.tenant;
781
+ return postJSON(this.ctx, "/v1/_memory/backfill_embeddings", undefined, { query, signal: opts?.signal });
782
+ }
783
+ // purgeStaleEmbeddings drops embeddings from rows that have no indexable text.
784
+ //
785
+ // THIS ONE DELETES, so the dry-run default matters more than on its siblings — and a
786
+ // zero `stale` with `truncated: true` means the scan was cut short, not that the scope
787
+ // is clean.
788
+ async purgeStaleEmbeddings(scope, scopeId, opts) {
789
+ const query = { scope, scope_id: scopeId };
790
+ if (opts?.dryRun === false)
791
+ query.dry_run = "false";
792
+ if (opts?.limit !== undefined && opts.limit > 0)
793
+ query.limit = String(opts.limit);
794
+ if (opts?.prefix)
795
+ query.prefix = opts.prefix;
796
+ if (opts?.tenant !== undefined)
797
+ query.tenant = opts.tenant;
798
+ return postJSON(this.ctx, "/v1/_memory/purge_stale_embeddings", undefined, { query, signal: opts?.signal });
799
+ }
763
800
  async reembedMemory(scope, scopeId, opts) {
764
801
  const query = { scope, scope_id: scopeId };
765
802
  // Only send dry_run=false to commit; an omitted flag leaves the
@@ -1101,6 +1138,14 @@ export class LoomcycleClient {
1101
1138
  async memoryBackendDef(input, opts) {
1102
1139
  return postJSON(this.ctx, "/v1/_memorybackenddef", input, opts);
1103
1140
  }
1141
+ /** DocumentSourceDef substrate ops (create/fork/get/list/retire) — RFC CE
1142
+ * remote-document-source registration. Operator-admin only. Authors + forks
1143
+ * named peer document sources the Document tool's set_remote/sync consume.
1144
+ * Static document_sources.<name>: yaml stays immutable ground truth; this
1145
+ * produces the derived layer. Mirrors POST /v1/_documentsourcedef. */
1146
+ async documentSourceDef(input, opts) {
1147
+ return postJSON(this.ctx, "/v1/_documentsourcedef", input, opts);
1148
+ }
1104
1149
  /** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
1105
1150
  * RFC L OSS multi-tenant authorization. Operator-admin only. The
1106
1151
  * token plaintext is returned ONCE in the create/rotate response.
@@ -1188,6 +1233,10 @@ export class LoomcycleClient {
1188
1233
  body.def_id = target.defId;
1189
1234
  if (target.input !== undefined)
1190
1235
  body.input = target.input;
1236
+ if (target.boardChunkId !== undefined)
1237
+ body.board_chunk_id = target.boardChunkId;
1238
+ if (target.boardScope !== undefined)
1239
+ body.board_scope = target.boardScope;
1191
1240
  return postJSON(this.ctx, "/v1/_teamdef", body, opts);
1192
1241
  }
1193
1242
  /** Invoke the RFC AL Path VFS tool over HTTP (`POST /v1/_path`). A
package/dist/index.d.ts CHANGED
@@ -50,6 +50,8 @@
50
50
  * memorySearch(input): Promise<MemorySearchResponse> // unified k/v + document-chunk search
51
51
  * memoryEmbedStats(scope): Promise<MemoryEmbedStatsResponse>
52
52
  * reembedMemory(scope, scopeId, opts?): Promise<MemoryReembedResponse> // dry_run defaults true
53
+ * backfillEmbeddings(scope, scopeId, opts?): Promise<MemoryBackfillResponse> // embeds rows that have none
54
+ * purgeStaleEmbeddings(scope, scopeId, opts?): Promise<MemoryPurgeResponse> // DELETES; dry_run defaults true
53
55
  *
54
56
  * // Interruption (v0.8.16; decline RFC BH)
55
57
  * listUserInterrupts(userId, opts?): Promise<InterruptListResponse>
package/dist/index.js CHANGED
@@ -50,6 +50,8 @@
50
50
  * memorySearch(input): Promise<MemorySearchResponse> // unified k/v + document-chunk search
51
51
  * memoryEmbedStats(scope): Promise<MemoryEmbedStatsResponse>
52
52
  * reembedMemory(scope, scopeId, opts?): Promise<MemoryReembedResponse> // dry_run defaults true
53
+ * backfillEmbeddings(scope, scopeId, opts?): Promise<MemoryBackfillResponse> // embeds rows that have none
54
+ * purgeStaleEmbeddings(scope, scopeId, opts?): Promise<MemoryPurgeResponse> // DELETES; dry_run defaults true
53
55
  *
54
56
  * // Interruption (v0.8.16; decline RFC BH)
55
57
  * listUserInterrupts(userId, opts?): Promise<InterruptListResponse>
package/dist/types.d.ts CHANGED
@@ -283,6 +283,13 @@ export interface ParentContext {
283
283
  /** The consumer's tier marker captured at root-run time (distinct from
284
284
  * `userTier`, which is loomcycle's resolver policy). */
285
285
  tier_at_run?: string;
286
+ /** Workflow-board correlation (loomboard, RFC BT P4). A board-bound
287
+ * `TeamDef op=run` stamps these onto each handler run it spawns, so a client
288
+ * folding the run-state stream (RunStateEvent.parent_context) can pin the
289
+ * live agent to its kanban card. Absent for non-board runs. */
290
+ board_scope?: string;
291
+ board_chunk_id?: string;
292
+ board_document_id?: string;
286
293
  }
287
294
  export interface ContinueOptions {
288
295
  /** Required — the session to continue. */
@@ -1179,7 +1186,7 @@ export type PathToolInput = {
1179
1186
  * requires the operator to grant BOTH `memory_scopes` and `sql_scopes` with
1180
1187
  * `tenant`, since a document spans both planes. */
1181
1188
  export type DocumentToolInput = {
1182
- op: "create_document" | "get_document" | "documents_summary" | "query_documents" | "delete_document" | "set_path" | "create_chunk" | "upsert_chunk" | "get_chunk" | "update_chunk" | "delete_chunk" | "supersede_chunk" | "graph_recall" | "move_chunk" | "reorder_chunk" | "link_chunks" | "unlink_chunks" | "get_edges" | "query_chunks" | "add_tags" | "remove_tags" | "list_tags" | "define_type" | "list_types" | "set_asset" | "get_asset" | "export_md" | "import_md" | "backlinks" | "related" | "unlinked_mentions" | "history" | "get_version" | "diff" | "export_canvas" | "import_canvas";
1189
+ op: "create_document" | "get_document" | "documents_summary" | "query_documents" | "delete_document" | "set_path" | "create_chunk" | "upsert_chunk" | "get_chunk" | "update_chunk" | "delete_chunk" | "supersede_chunk" | "graph_recall" | "move_chunk" | "reorder_chunk" | "link_chunks" | "unlink_chunks" | "get_edges" | "query_chunks" | "add_tags" | "remove_tags" | "list_tags" | "define_type" | "list_types" | "set_asset" | "get_asset" | "export_md" | "import_md" | "backlinks" | "related" | "unlinked_mentions" | "history" | "get_version" | "diff" | "export_canvas" | "import_canvas" | "list_facts" | "judge_fact" | "verbatim_answer" | "verification_stats" | "remember" | "propose_entity" | "search" | "set_remote" | "sync" | "diff_remote";
1183
1190
  scope?: "agent" | "user" | "tenant";
1184
1191
  /** Document id (get/delete_document) or chunk id (get/update/delete/move_chunk). */
1185
1192
  id?: string;
@@ -1225,6 +1232,40 @@ export type DocumentToolInput = {
1225
1232
  /** export_md: embed round-trippable chunk metadata + edges as HTML comments
1226
1233
  * (default true server-side). false = clean human-facing Markdown. */
1227
1234
  include_metadata?: boolean;
1235
+ /** search / graph_recall: free text. search matches it semantically against
1236
+ * chunk BODIES; graph_recall uses it to find starting chunks by title.
1237
+ * verbatim_answer: the lookup question to answer. */
1238
+ query?: string;
1239
+ /** upsert_chunk: the stable identity of this fact — upserting twice with the
1240
+ * same key updates ONE chunk. judge_fact: name the fact by key instead of id. */
1241
+ natural_key?: string;
1242
+ /** The entity this fact is about, paired with `type` (RFC CC). Documents
1243
+ * carry neither, which is what lets the ontology gate tell them apart. */
1244
+ subject?: string;
1245
+ /** upsert_chunk: the span of source text this fact was drawn from — the
1246
+ * evidence a judge checks the claim against. */
1247
+ source_quote?: string;
1248
+ /** judge_fact: whether the fact's recorded span supports it. The confidence
1249
+ * each maps to is set by the SERVER, so a caller cannot invent a scale.
1250
+ * `mistyped` = the span does support the claim, but it is filed as the wrong
1251
+ * kind of thing; the fix is a retype, so it stays visible. */
1252
+ verdict?: "supported" | "unclear" | "unsupported" | "mistyped";
1253
+ /** judge_fact: why. Required — a withheld fact whose ground is not stated is
1254
+ * indistinguishable from a bug. */
1255
+ reason?: string;
1256
+ /** list_facts / graph_recall: also return facts a judge marked unsupported.
1257
+ * They are withheld by default and never deleted, so this is how to read what
1258
+ * was refused, and why. */
1259
+ include_refuted?: boolean;
1260
+ /** remember: a statement to store as a fact that cites ITSELF — the text becomes both
1261
+ * the claim and its source span, so write what you want recorded rather than an
1262
+ * instruction about it. Additive only; it is never a way to delete. */
1263
+ text?: string;
1264
+ /** verbatim_answer: how close a match must be before it can be quoted as an
1265
+ * answer (default 0.6 server-side). Cosine scale is a property of the
1266
+ * EMBEDDING MODEL, so tune this against your own — the response reports the
1267
+ * actual score even when it declines to answer. */
1268
+ min_score?: number;
1228
1269
  /** import_md: an export_md-shaped Markdown document (headings = hierarchy;
1229
1270
  * `<!-- loom: ... -->` metadata; `<!-- loom-edges: ... -->` trailer). Omit
1230
1271
  * document_id to create a new document; pass it (+ optional parent_id) to
@@ -2248,3 +2289,35 @@ export interface SetTokenLimitRequest {
2248
2289
  soft_limit?: number;
2249
2290
  hard_limit?: number;
2250
2291
  }
2292
+ export interface MemoryBackfillResponse {
2293
+ scope: string;
2294
+ scope_id: string;
2295
+ prefix?: string;
2296
+ dry_run: boolean;
2297
+ /** Unembedded rows this call SAW, bounded by limit. */
2298
+ candidates: number;
2299
+ embedded?: number;
2300
+ failed?: number;
2301
+ skipped_empty?: number;
2302
+ /** The limit was reached with candidates outstanding — another call has work. */
2303
+ more?: boolean;
2304
+ failed_keys?: string[];
2305
+ sample_keys?: string[];
2306
+ notes?: string[];
2307
+ }
2308
+ export interface MemoryPurgeResponse {
2309
+ scope: string;
2310
+ scope_id: string;
2311
+ prefix?: string;
2312
+ dry_run: boolean;
2313
+ scanned: number;
2314
+ /** Rows with no indexable text that nonetheless carry an embedding. */
2315
+ stale: number;
2316
+ purged: number;
2317
+ failed?: number;
2318
+ truncated: boolean;
2319
+ sample_keys?: string[];
2320
+ failed_keys?: string[];
2321
+ first_failure?: string;
2322
+ notes?: string[];
2323
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "1.51.0",
3
+ "version": "1.55.0",
4
4
  "description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 67 methods covering run streaming, agent metadata, pause/resume/state, resolver re-probe (resolveProbe \u2014 issue #88 operator escape hatch), operator-token admin (operatorTokenDef \u2014 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 \u2014 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 \u2014 direct provider routing without agent overhead; primary target is n8n's LoomCycleChatModel AI Agent sub-node and any LangChain-compatible consumer). v0.10.1 \u2014 dual ESM + CommonJS distribution (additive \u2014 ESM consumers unchanged; CJS consumers like n8n's community-node loader now work). v0.19.0 \u2014 typed inline code-js agent ingestion (AgentDefOverlay.code_body + ensureCodeAgent \u2014 register a deterministic code agent through the substrate with no host filesystem bind; RFC J). v0.20.0 \u2014 ensureMcpServer surfaces discoveredToolCount straight from create (loomcycle now auto-discovers MCP tools at ingestion); rediscover is now an explicit force-refresh. v0.21.0 \u2014 run/continue accept optional non-secret `metadata` (repo name, review policy, \u2026) passed to the agent, symmetric with the WebHook/Schedule trigger paths. v0.22.0 \u2014 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 \u2014 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 \u2014 purgeChannel clears a channel's buffered messages without deleting its definition (allowed on yaml-declared channels too, unlike deleteChannel \u2014 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 \u2014 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 \u2014 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 \u2014 the manual-management Web UI console + Context op=time + max_fires self-retiring schedules \u2014 is server-side / in-band, no client-surface change). v0.29.1 \u2014 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 \u2014 gRPC + TS client parity for the RFC Y external fan-out and the compaction surface: spawnRunBatch() (POST /v1/runs:batch \u2014 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 \u2014 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 \u2014 server-side.) v0.34.0 \u2014 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 \u2014 RFC AH dynamic filesystem volumes: volumeDef() (POST /v1/_volumedef \u2014 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] \u2014 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 \u2014 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 \u2014 steer a live run) + streamRunByID(runId, {fromSeq}) (GET /v1/runs/{id}/stream \u2014 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 \u2014 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 \u2014 RFC AL Path VFS + RFC AK Document on the wire: path(input) (POST /v1/_path \u2014 a Unix-like filesystem over Memory/Volumes/Documents; resolve/ls/stat/mkdir/mv/rm) + document(input) (POST /v1/_document \u2014 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 \u2014 narrow as needed). v1.7.0 \u2014 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 \u2014 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 \u2014 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 \u2014 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 \u2014 existing path() / document() callers are unchanged. v1.16.0 \u2014 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> \u2014 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 \u2014 RFC BL P5 subject erasure: erasureReport(subject, {tenant}) (GET /v1/_erasure \u2014 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 \u2014 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 \u2014 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.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",