@loomcycle/client 0.14.1 → 0.17.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/README.md CHANGED
@@ -6,12 +6,14 @@ TypeScript client for the [loomcycle](https://github.com/denn-gubsky/loomcycle)
6
6
 
7
7
  ## Status
8
8
 
9
- **v0.11.4** — 42 methods covering run streaming, agent metadata, transcript, pause/resume/state, snapshot lifecycle, memory admin, interruption resolve, hook registration, **v0.8.22 substrate admin (agentDef + skillDef)**, **v0.9.x n8n Phase 0 (listChannels + streamUserRunStates)**, **v0.9.x content_sha256**, **v0.9.x dynamic MCP server registration (mcpServerDef)**, **v0.10.3 Library v2 enumeration (listLibraryAgents/Skills/McpServers)**, **v0.11.0 LLM Gateway (llmChat + llmStream)**, **v0.11.4 OpenAI Embeddings (embeddings)**, and health.
9
+ **v0.17.0** — 49 methods covering run streaming, agent metadata, transcript, pause/resume/state, snapshot lifecycle, memory admin, interruption resolve, hook registration, **v0.8.22 substrate admin (agentDef + skillDef)**, **v0.9.x n8n Phase 0 (listChannels + streamUserRunStates)**, **v0.9.x content_sha256**, **v0.9.x dynamic MCP server registration (mcpServerDef)**, **v0.10.3 Library v2 enumeration (listLibraryAgents/Skills/McpServers)**, **v0.11.0 LLM Gateway (llmChat + llmStream)**, **v0.11.4 OpenAI Embeddings (embeddings)**, **v0.17.0 OSS multi-tenant auth (operatorTokenDef + whoami + tenant-scoped listUsers / listUserAgents — RFC L)**, and health.
10
10
 
11
11
  > Migrating from raw `fetch` against `/v1/*`? See **[docs/MIGRATING-FROM-HTTP.md](./docs/MIGRATING-FROM-HTTP.md)** for a side-by-side walkthrough.
12
12
 
13
13
  ### What's new since v0.8.18
14
14
 
15
+ - **`operatorTokenDef` / `whoami` + tenant-scoped reads** (v0.17.0, RFC L) — the OSS multi-tenant authorization surface. `operatorTokenDef` is the op-discriminated admin tool over the `OperatorTokenDef` substrate (create / rotate / retire per-principal bearer tokens); `whoami()` returns the authoritative `(tenant, subject, scopes, is_admin)` resolved from the calling bearer; `listUsers({ tenant })` / `listUserAgents(userId, { tenant })` accept a super-admin tenant-focus (ignored server-side for a tenant principal — its own tenant is forced).
16
+
15
17
  - **`llmChat` / `llmStream`** (v0.11.0) — direct LLM call surface that bypasses the agent loop. Provider routing + auth + retry without the ~50-200 ms per-turn overhead of a full `runStreaming` spawn. Drives n8n's `LoomCycleChatModel` AI Agent sub-node + any LangChain `BaseChatModel` consumer.
16
18
  - **`listLibraryAgents` / `listLibrarySkills` / `listLibraryMcpServers`** (v0.10.3) — typed wrappers around the v0.9.3 Library v2 endpoints. Each returns a `LibraryListResponse<T>` with source-tagged entries (`"static-only"` / `"dynamic-only"` / `"both"`) merging yaml + substrate views.
17
19
  - **`mcpServerDef`** (v0.9.x) — runtime registration of HTTP / Streamable-HTTP MCP servers without yaml edits. Same op grammar (create / fork / promote / retire / rediscover) as `agentDef` / `skillDef`.
@@ -122,6 +124,7 @@ All methods are async / return `Promise<T>` unless noted; streaming methods retu
122
124
  | `pauseRuntime(opts?: { timeoutMs? })` | `Promise<PauseResult>` | Quiesce the runtime. Raises `AlreadyPausingError` on 409, `PauseNotConfiguredError` on 503. |
123
125
  | `resumeRuntime()` | `Promise<ResumeResult>` | Release the quiesce. Raises `NotPausedError` on 409. |
124
126
  | `getRuntimeState()` | `Promise<RuntimeStateResponse>` | Current state + paused-runs count. |
127
+ | `resolveProbe()` | `Promise<ResolverMatrix>` | Force an immediate provider re-probe; returns the refreshed availability matrix. Raises `UnavailableError` on 503 (no resolver / no probe loop). |
125
128
 
126
129
  ### Snapshot lifecycle (v0.8.17 / v0.8.18)
127
130
 
@@ -156,7 +156,12 @@ class LoomcycleClient {
156
156
  * request); the adapter trims before returning. Useful for the
157
157
  * n8n trigger pattern "show me all sub-runs spawned by parent X." */
158
158
  async listUserAgents(userId, opts) {
159
- const q = opts?.status ? `?status=${encodeURIComponent(opts.status)}` : "";
159
+ const params = new URLSearchParams();
160
+ if (opts?.status)
161
+ params.set("status", opts.status);
162
+ if (opts?.tenant)
163
+ params.set("tenant", opts.tenant);
164
+ const q = params.toString() ? `?${params.toString()}` : "";
160
165
  const resp = await (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/users/${encodeURIComponent(userId)}/agents${q}`, opts);
161
166
  const all = resp.agents ?? [];
162
167
  if (opts?.parentAgentId !== undefined && opts.parentAgentId !== "") {
@@ -174,10 +179,20 @@ class LoomcycleClient {
174
179
  async health(opts) {
175
180
  return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/healthz", opts);
176
181
  }
177
- /** Admin: list known users with running-count summary. Drives the
178
- * Web UI's user picker; operators with bearer auth can call too. */
182
+ /** List known users with running-count summary. Drives the Web UI's
183
+ * user picker. Tenant-scoped server-side since v0.17.0 (RFC L): a
184
+ * tenant principal sees only its own tenant's users; an admin sees all,
185
+ * or focuses one tenant via `tenant` (?tenant=). */
179
186
  async listUsers(opts) {
180
- return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_users", opts);
187
+ const q = opts?.tenant ? `?tenant=${encodeURIComponent(opts.tenant)}` : "";
188
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/_users${q}`, opts);
189
+ }
190
+ /** Whoami — the authenticated principal (RFC L v0.17.0). Any
191
+ * authenticated bearer; returns its authoritative tenant / subject /
192
+ * scopes + `is_admin`. `open_mode: true` when the server runs without
193
+ * the token substrate (single shared LOOMCYCLE_AUTH_TOKEN). */
194
+ async whoami(opts) {
195
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_me", opts);
181
196
  }
182
197
  // ---- v0.8.17/8.18 Pause / Resume / State ----
183
198
  /** Quiesce the runtime. Idempotent tools cancel immediately;
@@ -199,6 +214,14 @@ class LoomcycleClient {
199
214
  async getRuntimeState(opts) {
200
215
  return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_state", opts);
201
216
  }
217
+ /** Trigger an immediate re-probe of every configured provider and
218
+ * return the refreshed availability matrix. Operator-only escape
219
+ * hatch when a transient outage stalls every provider and the
220
+ * runtime would otherwise 503 until the next periodic probe.
221
+ * Mirrors POST /v1/_resolve/probe. */
222
+ async resolveProbe(opts) {
223
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_resolve/probe", undefined, opts);
224
+ }
202
225
  // ---- Snapshot lifecycle ----
203
226
  /** Capture running-state into a per-section-semver JSON envelope.
204
227
  * Raises SnapshotTooLargeError on 413 when the envelope exceeds
@@ -507,6 +530,28 @@ class LoomcycleClient {
507
530
  async webhookDef(input, opts) {
508
531
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_webhookdef", input, opts);
509
532
  }
533
+ /** Invoke the RFC I MR-3a MemoryBackendDef substrate tool over HTTP.
534
+ * Author + fork + retire named memory backend definitions at runtime.
535
+ * Mirror of {@link LoomcycleClient.webhookDef} for memory backends.
536
+ *
537
+ * Operator-admin-only: this endpoint requires the bearer token.
538
+ *
539
+ * Op-discriminated input: `{op: "create" | "fork" | "get" |
540
+ * "list" | "retire", ...}`.
541
+ *
542
+ * Raises {@link SubstrateToolRefusedError} on tool-level refusals;
543
+ * {@link InvalidArgumentError} on 400 (malformed JSON);
544
+ * {@link AuthError} on 401. */
545
+ async memoryBackendDef(input, opts) {
546
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_memorybackenddef", input, opts);
547
+ }
548
+ /** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
549
+ * RFC L OSS multi-tenant authorization. Operator-admin only. The
550
+ * token plaintext is returned ONCE in the create/rotate response.
551
+ * Mirrors POST /v1/_operatortokendef. */
552
+ async operatorTokenDef(input, opts) {
553
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_operatortokendef", input, opts);
554
+ }
510
555
  // ---- v0.10.3 Library v2 enumeration (read-only, merged yaml+substrate) ----
511
556
  /** List every agent the runtime knows about — yaml-static + dynamic
512
557
  * AgentDefs merged into one envelope per name. Each entry carries
package/dist/cjs/index.js CHANGED
@@ -17,12 +17,14 @@
17
17
  * listUserAgents(userId, opts?): Promise<Agent[]>
18
18
  * getTranscript(sessionId): Promise<TranscriptResponse>
19
19
  * health(): Promise<HealthResponse>
20
- * listUsers(): Promise<ListUsersResponse>
20
+ * listUsers(opts?): Promise<ListUsersResponse> // tenant-scoped (RFC L)
21
+ * whoami(): Promise<WhoamiResponse> // RFC L principal (v0.17.0)
21
22
  *
22
23
  * // Pause / Resume / State (v0.8.17/8.18)
23
24
  * pauseRuntime(opts?): Promise<PauseResult>
24
25
  * resumeRuntime(): Promise<ResumeResult>
25
26
  * getRuntimeState(): Promise<RuntimeStateResponse>
27
+ * resolveProbe(opts?): Promise<ResolverMatrix>
26
28
  *
27
29
  * // Snapshot lifecycle (v0.8.17/8.18)
28
30
  * createSnapshot(opts?): Promise<SnapshotCreateResponse>
package/dist/client.d.ts CHANGED
@@ -23,7 +23,7 @@
23
23
  * via fetch-helpers.ts:raiseFromResponse — see README.md for the
24
24
  * full mapping table.
25
25
  */
26
- import type { Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, CreateSnapshotOptions, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, ChannelAckResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopesResponse, PauseResult, RegisterHookOptions, RegisterHookResponse, ResolveInterruptOptions, ResumeResult, RunOptions, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, TranscriptResponse } from "./types.js";
26
+ import type { Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, CreateSnapshotOptions, HealthResponse, Hook, InterruptListResponse, InterruptStatus, AckChannelOptions, ChannelAckResult, ChannelDescriptor, ChannelPeekResult, ChannelPublishResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopesResponse, PauseResult, RegisterHookOptions, RegisterHookResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, RunOptions, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, TranscriptResponse, WhoamiResponse } from "./types.js";
27
27
  export declare class LoomcycleClient {
28
28
  private ctx;
29
29
  constructor(opts?: ClientOptions);
@@ -89,6 +89,9 @@ export declare class LoomcycleClient {
89
89
  listUserAgents(userId: string, opts?: {
90
90
  status?: AgentStatus;
91
91
  parentAgentId?: string;
92
+ /** Super-admin tenant-focus (?tenant=, RFC L v0.17.0). Ignored
93
+ * server-side for a tenant principal — its own tenant is forced. */
94
+ tenant?: string;
92
95
  signal?: AbortSignal;
93
96
  }): Promise<Agent[]>;
94
97
  /** Read the full event log for a session. Each entry has seq,
@@ -101,11 +104,21 @@ export declare class LoomcycleClient {
101
104
  health(opts?: {
102
105
  signal?: AbortSignal;
103
106
  }): Promise<HealthResponse>;
104
- /** Admin: list known users with running-count summary. Drives the
105
- * Web UI's user picker; operators with bearer auth can call too. */
107
+ /** List known users with running-count summary. Drives the Web UI's
108
+ * user picker. Tenant-scoped server-side since v0.17.0 (RFC L): a
109
+ * tenant principal sees only its own tenant's users; an admin sees all,
110
+ * or focuses one tenant via `tenant` (?tenant=). */
106
111
  listUsers(opts?: {
112
+ tenant?: string;
107
113
  signal?: AbortSignal;
108
114
  }): Promise<ListUsersResponse>;
115
+ /** Whoami — the authenticated principal (RFC L v0.17.0). Any
116
+ * authenticated bearer; returns its authoritative tenant / subject /
117
+ * scopes + `is_admin`. `open_mode: true` when the server runs without
118
+ * the token substrate (single shared LOOMCYCLE_AUTH_TOKEN). */
119
+ whoami(opts?: {
120
+ signal?: AbortSignal;
121
+ }): Promise<WhoamiResponse>;
109
122
  /** Quiesce the runtime. Idempotent tools cancel immediately;
110
123
  * non-idempotent + external tools get a grace window then
111
124
  * force-cancel. Raises AlreadyPausingError on 409,
@@ -123,6 +136,14 @@ export declare class LoomcycleClient {
123
136
  getRuntimeState(opts?: {
124
137
  signal?: AbortSignal;
125
138
  }): Promise<RuntimeStateResponse>;
139
+ /** Trigger an immediate re-probe of every configured provider and
140
+ * return the refreshed availability matrix. Operator-only escape
141
+ * hatch when a transient outage stalls every provider and the
142
+ * runtime would otherwise 503 until the next periodic probe.
143
+ * Mirrors POST /v1/_resolve/probe. */
144
+ resolveProbe(opts?: {
145
+ signal?: AbortSignal;
146
+ }): Promise<ResolverMatrix>;
126
147
  /** Capture running-state into a per-section-semver JSON envelope.
127
148
  * Raises SnapshotTooLargeError on 413 when the envelope exceeds
128
149
  * LOOMCYCLE_SNAPSHOT_MAX_BYTES (default 512 MiB). */
@@ -366,6 +387,28 @@ export declare class LoomcycleClient {
366
387
  webhookDef(input: SubstrateToolInput, opts?: {
367
388
  signal?: AbortSignal;
368
389
  }): Promise<SubstrateToolResponse>;
390
+ /** Invoke the RFC I MR-3a MemoryBackendDef substrate tool over HTTP.
391
+ * Author + fork + retire named memory backend definitions at runtime.
392
+ * Mirror of {@link LoomcycleClient.webhookDef} for memory backends.
393
+ *
394
+ * Operator-admin-only: this endpoint requires the bearer token.
395
+ *
396
+ * Op-discriminated input: `{op: "create" | "fork" | "get" |
397
+ * "list" | "retire", ...}`.
398
+ *
399
+ * Raises {@link SubstrateToolRefusedError} on tool-level refusals;
400
+ * {@link InvalidArgumentError} on 400 (malformed JSON);
401
+ * {@link AuthError} on 401. */
402
+ memoryBackendDef(input: SubstrateToolInput, opts?: {
403
+ signal?: AbortSignal;
404
+ }): Promise<SubstrateToolResponse>;
405
+ /** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
406
+ * RFC L OSS multi-tenant authorization. Operator-admin only. The
407
+ * token plaintext is returned ONCE in the create/rotate response.
408
+ * Mirrors POST /v1/_operatortokendef. */
409
+ operatorTokenDef(input: SubstrateToolInput, opts?: {
410
+ signal?: AbortSignal;
411
+ }): Promise<SubstrateToolResponse>;
369
412
  /** List every agent the runtime knows about — yaml-static + dynamic
370
413
  * AgentDefs merged into one envelope per name. Each entry carries
371
414
  * `source: "static-only" | "dynamic-only" | "both"` so callers can
package/dist/client.js CHANGED
@@ -153,7 +153,12 @@ export class LoomcycleClient {
153
153
  * request); the adapter trims before returning. Useful for the
154
154
  * n8n trigger pattern "show me all sub-runs spawned by parent X." */
155
155
  async listUserAgents(userId, opts) {
156
- const q = opts?.status ? `?status=${encodeURIComponent(opts.status)}` : "";
156
+ const params = new URLSearchParams();
157
+ if (opts?.status)
158
+ params.set("status", opts.status);
159
+ if (opts?.tenant)
160
+ params.set("tenant", opts.tenant);
161
+ const q = params.toString() ? `?${params.toString()}` : "";
157
162
  const resp = await jsonFetch(this.ctx, `/v1/users/${encodeURIComponent(userId)}/agents${q}`, opts);
158
163
  const all = resp.agents ?? [];
159
164
  if (opts?.parentAgentId !== undefined && opts.parentAgentId !== "") {
@@ -171,10 +176,20 @@ export class LoomcycleClient {
171
176
  async health(opts) {
172
177
  return jsonFetch(this.ctx, "/healthz", opts);
173
178
  }
174
- /** Admin: list known users with running-count summary. Drives the
175
- * Web UI's user picker; operators with bearer auth can call too. */
179
+ /** List known users with running-count summary. Drives the Web UI's
180
+ * user picker. Tenant-scoped server-side since v0.17.0 (RFC L): a
181
+ * tenant principal sees only its own tenant's users; an admin sees all,
182
+ * or focuses one tenant via `tenant` (?tenant=). */
176
183
  async listUsers(opts) {
177
- return jsonFetch(this.ctx, "/v1/_users", opts);
184
+ const q = opts?.tenant ? `?tenant=${encodeURIComponent(opts.tenant)}` : "";
185
+ return jsonFetch(this.ctx, `/v1/_users${q}`, opts);
186
+ }
187
+ /** Whoami — the authenticated principal (RFC L v0.17.0). Any
188
+ * authenticated bearer; returns its authoritative tenant / subject /
189
+ * scopes + `is_admin`. `open_mode: true` when the server runs without
190
+ * the token substrate (single shared LOOMCYCLE_AUTH_TOKEN). */
191
+ async whoami(opts) {
192
+ return jsonFetch(this.ctx, "/v1/_me", opts);
178
193
  }
179
194
  // ---- v0.8.17/8.18 Pause / Resume / State ----
180
195
  /** Quiesce the runtime. Idempotent tools cancel immediately;
@@ -196,6 +211,14 @@ export class LoomcycleClient {
196
211
  async getRuntimeState(opts) {
197
212
  return jsonFetch(this.ctx, "/v1/_state", opts);
198
213
  }
214
+ /** Trigger an immediate re-probe of every configured provider and
215
+ * return the refreshed availability matrix. Operator-only escape
216
+ * hatch when a transient outage stalls every provider and the
217
+ * runtime would otherwise 503 until the next periodic probe.
218
+ * Mirrors POST /v1/_resolve/probe. */
219
+ async resolveProbe(opts) {
220
+ return postJSON(this.ctx, "/v1/_resolve/probe", undefined, opts);
221
+ }
199
222
  // ---- Snapshot lifecycle ----
200
223
  /** Capture running-state into a per-section-semver JSON envelope.
201
224
  * Raises SnapshotTooLargeError on 413 when the envelope exceeds
@@ -504,6 +527,28 @@ export class LoomcycleClient {
504
527
  async webhookDef(input, opts) {
505
528
  return postJSON(this.ctx, "/v1/_webhookdef", input, opts);
506
529
  }
530
+ /** Invoke the RFC I MR-3a MemoryBackendDef substrate tool over HTTP.
531
+ * Author + fork + retire named memory backend definitions at runtime.
532
+ * Mirror of {@link LoomcycleClient.webhookDef} for memory backends.
533
+ *
534
+ * Operator-admin-only: this endpoint requires the bearer token.
535
+ *
536
+ * Op-discriminated input: `{op: "create" | "fork" | "get" |
537
+ * "list" | "retire", ...}`.
538
+ *
539
+ * Raises {@link SubstrateToolRefusedError} on tool-level refusals;
540
+ * {@link InvalidArgumentError} on 400 (malformed JSON);
541
+ * {@link AuthError} on 401. */
542
+ async memoryBackendDef(input, opts) {
543
+ return postJSON(this.ctx, "/v1/_memorybackenddef", input, opts);
544
+ }
545
+ /** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
546
+ * RFC L OSS multi-tenant authorization. Operator-admin only. The
547
+ * token plaintext is returned ONCE in the create/rotate response.
548
+ * Mirrors POST /v1/_operatortokendef. */
549
+ async operatorTokenDef(input, opts) {
550
+ return postJSON(this.ctx, "/v1/_operatortokendef", input, opts);
551
+ }
507
552
  // ---- v0.10.3 Library v2 enumeration (read-only, merged yaml+substrate) ----
508
553
  /** List every agent the runtime knows about — yaml-static + dynamic
509
554
  * AgentDefs merged into one envelope per name. Each entry carries
package/dist/index.d.ts CHANGED
@@ -16,12 +16,14 @@
16
16
  * listUserAgents(userId, opts?): Promise<Agent[]>
17
17
  * getTranscript(sessionId): Promise<TranscriptResponse>
18
18
  * health(): Promise<HealthResponse>
19
- * listUsers(): Promise<ListUsersResponse>
19
+ * listUsers(opts?): Promise<ListUsersResponse> // tenant-scoped (RFC L)
20
+ * whoami(): Promise<WhoamiResponse> // RFC L principal (v0.17.0)
20
21
  *
21
22
  * // Pause / Resume / State (v0.8.17/8.18)
22
23
  * pauseRuntime(opts?): Promise<PauseResult>
23
24
  * resumeRuntime(): Promise<ResumeResult>
24
25
  * getRuntimeState(): Promise<RuntimeStateResponse>
26
+ * resolveProbe(opts?): Promise<ResolverMatrix>
25
27
  *
26
28
  * // Snapshot lifecycle (v0.8.17/8.18)
27
29
  * createSnapshot(opts?): Promise<SnapshotCreateResponse>
@@ -78,5 +80,5 @@
78
80
  * See `adapters/ts/README.md` for usage examples.
79
81
  */
80
82
  export { LoomcycleClient } from "./client.js";
81
- export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, ToolUse, Usage, Agent, AgentStatus, AgentUsage, CancelAgentResult, ListAgentsResponse, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, PauseResult, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, Hook, HookFailMode, HookPhase, HookToolCall, HookToolResult, ListHooksResponse, PostHookCall, PostHookResult, PreHookCall, PreHookResult, RegisterHookOptions, RegisterHookResponse, SubstrateToolInput, SubstrateToolResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ChannelPublishResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, CreateChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, } from "./types.js";
83
+ export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, ToolUse, Usage, Agent, AgentStatus, AgentUsage, CancelAgentResult, ListAgentsResponse, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, WhoamiResponse, PauseResult, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, Hook, HookFailMode, HookPhase, HookToolCall, HookToolResult, ListHooksResponse, PostHookCall, PostHookResult, PreHookCall, PreHookResult, RegisterHookOptions, RegisterHookResponse, SubstrateToolInput, SubstrateToolResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ChannelPublishResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, CreateChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, } from "./types.js";
82
84
  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/index.js CHANGED
@@ -16,12 +16,14 @@
16
16
  * listUserAgents(userId, opts?): Promise<Agent[]>
17
17
  * getTranscript(sessionId): Promise<TranscriptResponse>
18
18
  * health(): Promise<HealthResponse>
19
- * listUsers(): Promise<ListUsersResponse>
19
+ * listUsers(opts?): Promise<ListUsersResponse> // tenant-scoped (RFC L)
20
+ * whoami(): Promise<WhoamiResponse> // RFC L principal (v0.17.0)
20
21
  *
21
22
  * // Pause / Resume / State (v0.8.17/8.18)
22
23
  * pauseRuntime(opts?): Promise<PauseResult>
23
24
  * resumeRuntime(): Promise<ResumeResult>
24
25
  * getRuntimeState(): Promise<RuntimeStateResponse>
26
+ * resolveProbe(opts?): Promise<ResolverMatrix>
25
27
  *
26
28
  * // Snapshot lifecycle (v0.8.17/8.18)
27
29
  * createSnapshot(opts?): Promise<SnapshotCreateResponse>
package/dist/types.d.ts CHANGED
@@ -336,6 +336,18 @@ export interface UserSummary {
336
336
  export interface ListUsersResponse {
337
337
  users: UserSummary[];
338
338
  }
339
+ /** GET /v1/_me — the authenticated principal resolved from the bearer.
340
+ * `open_mode` is true when the server runs without the OperatorTokenDef
341
+ * substrate (single shared LOOMCYCLE_AUTH_TOKEN); `legacy` is true for a
342
+ * shared-token principal when the substrate IS enabled. */
343
+ export interface WhoamiResponse {
344
+ tenant_id: string;
345
+ subject: string;
346
+ scopes: string[];
347
+ is_admin: boolean;
348
+ legacy: boolean;
349
+ open_mode?: boolean;
350
+ }
339
351
  export type RuntimeStateStatus = "running" | "pausing" | "paused";
340
352
  export interface PauseResult {
341
353
  state: string;
@@ -353,6 +365,25 @@ export interface RuntimeStateResponse {
353
365
  state: RuntimeStateStatus;
354
366
  paused_runs_count: number;
355
367
  }
368
+ export interface ResolverModelStatus {
369
+ listed: boolean;
370
+ stalled: boolean;
371
+ }
372
+ export interface ResolverProviderAvailability {
373
+ excluded: boolean;
374
+ reachable: boolean;
375
+ models: Record<string, ResolverModelStatus>;
376
+ /** RFC3339 timestamp of the last probe for this provider. */
377
+ last_check: string;
378
+ last_error?: string;
379
+ }
380
+ /** The resolver availability matrix, captured right after a forced
381
+ * re-probe. Same shape as GET /v1/_resolver. */
382
+ export interface ResolverMatrix {
383
+ /** RFC3339 timestamp when this matrix snapshot was assembled. */
384
+ generated_at: string;
385
+ providers: Record<string, ResolverProviderAvailability>;
386
+ }
356
387
  export interface SnapshotDescriptor {
357
388
  id: string;
358
389
  created_at: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "0.14.1",
4
- "description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 46 methods covering run streaming, agent metadata, pause/resume/state, 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).",
3
+ "version": "0.17.0",
4
+ "description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 49 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, 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).",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "repository": {