@loomcycle/client 0.17.0 → 0.18.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 +2 -1
- package/dist/cjs/client.js +55 -2
- package/dist/cjs/index.js +2 -0
- package/dist/client.d.ts +28 -3
- package/dist/client.js +55 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/types.d.ts +38 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,12 +6,13 @@ TypeScript client for the [loomcycle](https://github.com/denn-gubsky/loomcycle)
|
|
|
6
6
|
|
|
7
7
|
## Status
|
|
8
8
|
|
|
9
|
-
**v0.
|
|
9
|
+
**v0.18.0** — 51 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.18.0 typed `mcpServerDefVerify` + `ensureMcpServer` (idempotent register-if-changed)**, **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
|
+
- **`ensureMcpServer` / `mcpServerDefVerify`** (v0.18.0) — typed ergonomics for the dynamic-MCP dedup flow. `ensureMcpServer({name, url, headers?, rediscover?})` registers a callback MCP server **idempotently**: it runs `create` (a no-op in loomcycle ≥ v0.18.0 when the active def already carries identical content) plus an optional `rediscover` (a no-op on unchanged tools), and returns `{defId, version, changed, discoveredToolCount?}` — so a consumer re-registering on every startup gets `changed: false` once its registration content is stable. Keep `${run.*}` / `${LOOMCYCLE_*}` header placeholders **literal** (don't bake a per-restart token) or the content varies each boot and dedup can't engage. `mcpServerDefVerify(name, sha)` is the typed `op: verify` wrapper (`matches: true` = no-op signal).
|
|
15
16
|
- **`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
17
|
|
|
17
18
|
- **`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.
|
package/dist/cjs/client.js
CHANGED
|
@@ -442,8 +442,10 @@ class LoomcycleClient {
|
|
|
442
442
|
* Hard constraints (substrate refuses these):
|
|
443
443
|
* - Transport must be `http` or `streamable-http` (stdio stays
|
|
444
444
|
* yaml-only — dynamic registration doesn't allow process spawn).
|
|
445
|
-
* - URL hostname must be in LOOMCYCLE_HTTP_HOST_ALLOWLIST (
|
|
446
|
-
*
|
|
445
|
+
* - URL hostname must be in LOOMCYCLE_HTTP_HOST_ALLOWLIST or (since
|
|
446
|
+
* v0.17.x) LOOMCYCLE_HTTP_PRIVATE_HOST_ALLOWLIST — the latter is where
|
|
447
|
+
* a self-hosted loopback callback like `http://localhost:3000/api/mcp`
|
|
448
|
+
* belongs (SSRF defence at the registration boundary).
|
|
447
449
|
* - Name colliding with a static cfg.MCPServers entry is refused
|
|
448
450
|
* (yaml is ground truth; use a different name).
|
|
449
451
|
*
|
|
@@ -453,6 +455,57 @@ class LoomcycleClient {
|
|
|
453
455
|
async mcpServerDef(input, opts) {
|
|
454
456
|
return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_mcpserverdef", input, opts);
|
|
455
457
|
}
|
|
458
|
+
/** Typed `MCPServerDef verify` — "is `contentSha256` the active version's
|
|
459
|
+
* hash for `name`?" `matches: true` is the no-op signal (the analog of
|
|
460
|
+
* the agent/skill verify-before-create dedup). Thin typed wrapper over
|
|
461
|
+
* {@link mcpServerDef}. */
|
|
462
|
+
async mcpServerDefVerify(name, contentSha256, opts) {
|
|
463
|
+
return (await this.mcpServerDef({ op: "verify", name, content_sha256: contentSha256 }, opts));
|
|
464
|
+
}
|
|
465
|
+
/** Register (or refresh) a dynamic MCP server idempotently — the typed
|
|
466
|
+
* "register-if-changed" convenience for a consumer that re-registers its
|
|
467
|
+
* own callback server on every startup.
|
|
468
|
+
*
|
|
469
|
+
* Runs `create` (which is content-addressed-idempotent in loomcycle
|
|
470
|
+
* ≥ v0.18.0 — a byte-identical re-registration is a no-op, not a new
|
|
471
|
+
* version) and, when {@link EnsureMcpServerOptions.rediscover} is set, a
|
|
472
|
+
* `tools/list` rediscover (also idempotent on unchanged tools). The
|
|
473
|
+
* returned {@link EnsureMcpServerResult.changed} is false when loomcycle
|
|
474
|
+
* deduped both — so a stable-content re-register on every boot is a clean
|
|
475
|
+
* no-op. Keep `${run.*}` / `${LOOMCYCLE_*}` header placeholders LITERAL
|
|
476
|
+
* (don't resolve a per-restart token) or the content varies each boot and
|
|
477
|
+
* dedup can't engage. */
|
|
478
|
+
async ensureMcpServer(opts, callOpts) {
|
|
479
|
+
const overlay = {
|
|
480
|
+
transport: opts.transport ?? "http",
|
|
481
|
+
url: opts.url,
|
|
482
|
+
};
|
|
483
|
+
if (opts.headers)
|
|
484
|
+
overlay.headers = opts.headers;
|
|
485
|
+
const createInput = { op: "create", name: opts.name, overlay };
|
|
486
|
+
if (opts.description)
|
|
487
|
+
createInput.description = opts.description;
|
|
488
|
+
const created = (await this.mcpServerDef(createInput, callOpts));
|
|
489
|
+
let row = created;
|
|
490
|
+
let changed = created.deduplicated !== true;
|
|
491
|
+
let discoveredToolCount;
|
|
492
|
+
if (opts.rediscover) {
|
|
493
|
+
const red = (await this.mcpServerDef({ op: "rediscover", name: opts.name }, callOpts));
|
|
494
|
+
row = red;
|
|
495
|
+
if (red.deduplicated !== true)
|
|
496
|
+
changed = true;
|
|
497
|
+
discoveredToolCount = red.discovered;
|
|
498
|
+
}
|
|
499
|
+
const result = {
|
|
500
|
+
name: opts.name,
|
|
501
|
+
defId: row.def_id,
|
|
502
|
+
version: row.version,
|
|
503
|
+
changed,
|
|
504
|
+
};
|
|
505
|
+
if (discoveredToolCount !== undefined)
|
|
506
|
+
result.discoveredToolCount = discoveredToolCount;
|
|
507
|
+
return result;
|
|
508
|
+
}
|
|
456
509
|
/** Invoke the v1.x RFC E ScheduleDef substrate tool over HTTP.
|
|
457
510
|
* Author + fork + retire scheduled-run definitions at runtime.
|
|
458
511
|
* Mirror of {@link LoomcycleClient.agentDef} for schedules — the
|
package/dist/cjs/index.js
CHANGED
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
* agentDef(input): Promise<SubstrateToolResponse>
|
|
50
50
|
* skillDef(input): Promise<SubstrateToolResponse>
|
|
51
51
|
* mcpServerDef(input): Promise<SubstrateToolResponse>
|
|
52
|
+
* mcpServerDefVerify(name, sha): Promise<MCPServerDefVerifyResult> // v0.18.0
|
|
53
|
+
* ensureMcpServer(opts): Promise<EnsureMcpServerResult> // v0.18.0 — idempotent register-if-changed
|
|
52
54
|
* scheduleDef(input): Promise<SubstrateToolResponse>
|
|
53
55
|
*
|
|
54
56
|
* // Library v2 enumeration (v0.10.3 — yaml+substrate merged)
|
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, ResolverMatrix, RunOptions, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, TranscriptResponse, WhoamiResponse } from "./types.js";
|
|
26
|
+
import type { Agent, AgentEvent, AgentStatus, CancelAgentResult, ClientOptions, ContinueOptions, CreateSnapshotOptions, EnsureMcpServerOptions, EnsureMcpServerResult, 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, MCPServerDefVerifyResult, 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);
|
|
@@ -299,8 +299,10 @@ export declare class LoomcycleClient {
|
|
|
299
299
|
* Hard constraints (substrate refuses these):
|
|
300
300
|
* - Transport must be `http` or `streamable-http` (stdio stays
|
|
301
301
|
* yaml-only — dynamic registration doesn't allow process spawn).
|
|
302
|
-
* - URL hostname must be in LOOMCYCLE_HTTP_HOST_ALLOWLIST (
|
|
303
|
-
*
|
|
302
|
+
* - URL hostname must be in LOOMCYCLE_HTTP_HOST_ALLOWLIST or (since
|
|
303
|
+
* v0.17.x) LOOMCYCLE_HTTP_PRIVATE_HOST_ALLOWLIST — the latter is where
|
|
304
|
+
* a self-hosted loopback callback like `http://localhost:3000/api/mcp`
|
|
305
|
+
* belongs (SSRF defence at the registration boundary).
|
|
304
306
|
* - Name colliding with a static cfg.MCPServers entry is refused
|
|
305
307
|
* (yaml is ground truth; use a different name).
|
|
306
308
|
*
|
|
@@ -310,6 +312,29 @@ export declare class LoomcycleClient {
|
|
|
310
312
|
mcpServerDef(input: SubstrateToolInput, opts?: {
|
|
311
313
|
signal?: AbortSignal;
|
|
312
314
|
}): Promise<SubstrateToolResponse>;
|
|
315
|
+
/** Typed `MCPServerDef verify` — "is `contentSha256` the active version's
|
|
316
|
+
* hash for `name`?" `matches: true` is the no-op signal (the analog of
|
|
317
|
+
* the agent/skill verify-before-create dedup). Thin typed wrapper over
|
|
318
|
+
* {@link mcpServerDef}. */
|
|
319
|
+
mcpServerDefVerify(name: string, contentSha256: string, opts?: {
|
|
320
|
+
signal?: AbortSignal;
|
|
321
|
+
}): Promise<MCPServerDefVerifyResult>;
|
|
322
|
+
/** Register (or refresh) a dynamic MCP server idempotently — the typed
|
|
323
|
+
* "register-if-changed" convenience for a consumer that re-registers its
|
|
324
|
+
* own callback server on every startup.
|
|
325
|
+
*
|
|
326
|
+
* Runs `create` (which is content-addressed-idempotent in loomcycle
|
|
327
|
+
* ≥ v0.18.0 — a byte-identical re-registration is a no-op, not a new
|
|
328
|
+
* version) and, when {@link EnsureMcpServerOptions.rediscover} is set, a
|
|
329
|
+
* `tools/list` rediscover (also idempotent on unchanged tools). The
|
|
330
|
+
* returned {@link EnsureMcpServerResult.changed} is false when loomcycle
|
|
331
|
+
* deduped both — so a stable-content re-register on every boot is a clean
|
|
332
|
+
* no-op. Keep `${run.*}` / `${LOOMCYCLE_*}` header placeholders LITERAL
|
|
333
|
+
* (don't resolve a per-restart token) or the content varies each boot and
|
|
334
|
+
* dedup can't engage. */
|
|
335
|
+
ensureMcpServer(opts: EnsureMcpServerOptions, callOpts?: {
|
|
336
|
+
signal?: AbortSignal;
|
|
337
|
+
}): Promise<EnsureMcpServerResult>;
|
|
313
338
|
/** Invoke the v1.x RFC E ScheduleDef substrate tool over HTTP.
|
|
314
339
|
* Author + fork + retire scheduled-run definitions at runtime.
|
|
315
340
|
* Mirror of {@link LoomcycleClient.agentDef} for schedules — the
|
package/dist/client.js
CHANGED
|
@@ -439,8 +439,10 @@ export class LoomcycleClient {
|
|
|
439
439
|
* Hard constraints (substrate refuses these):
|
|
440
440
|
* - Transport must be `http` or `streamable-http` (stdio stays
|
|
441
441
|
* yaml-only — dynamic registration doesn't allow process spawn).
|
|
442
|
-
* - URL hostname must be in LOOMCYCLE_HTTP_HOST_ALLOWLIST (
|
|
443
|
-
*
|
|
442
|
+
* - URL hostname must be in LOOMCYCLE_HTTP_HOST_ALLOWLIST or (since
|
|
443
|
+
* v0.17.x) LOOMCYCLE_HTTP_PRIVATE_HOST_ALLOWLIST — the latter is where
|
|
444
|
+
* a self-hosted loopback callback like `http://localhost:3000/api/mcp`
|
|
445
|
+
* belongs (SSRF defence at the registration boundary).
|
|
444
446
|
* - Name colliding with a static cfg.MCPServers entry is refused
|
|
445
447
|
* (yaml is ground truth; use a different name).
|
|
446
448
|
*
|
|
@@ -450,6 +452,57 @@ export class LoomcycleClient {
|
|
|
450
452
|
async mcpServerDef(input, opts) {
|
|
451
453
|
return postJSON(this.ctx, "/v1/_mcpserverdef", input, opts);
|
|
452
454
|
}
|
|
455
|
+
/** Typed `MCPServerDef verify` — "is `contentSha256` the active version's
|
|
456
|
+
* hash for `name`?" `matches: true` is the no-op signal (the analog of
|
|
457
|
+
* the agent/skill verify-before-create dedup). Thin typed wrapper over
|
|
458
|
+
* {@link mcpServerDef}. */
|
|
459
|
+
async mcpServerDefVerify(name, contentSha256, opts) {
|
|
460
|
+
return (await this.mcpServerDef({ op: "verify", name, content_sha256: contentSha256 }, opts));
|
|
461
|
+
}
|
|
462
|
+
/** Register (or refresh) a dynamic MCP server idempotently — the typed
|
|
463
|
+
* "register-if-changed" convenience for a consumer that re-registers its
|
|
464
|
+
* own callback server on every startup.
|
|
465
|
+
*
|
|
466
|
+
* Runs `create` (which is content-addressed-idempotent in loomcycle
|
|
467
|
+
* ≥ v0.18.0 — a byte-identical re-registration is a no-op, not a new
|
|
468
|
+
* version) and, when {@link EnsureMcpServerOptions.rediscover} is set, a
|
|
469
|
+
* `tools/list` rediscover (also idempotent on unchanged tools). The
|
|
470
|
+
* returned {@link EnsureMcpServerResult.changed} is false when loomcycle
|
|
471
|
+
* deduped both — so a stable-content re-register on every boot is a clean
|
|
472
|
+
* no-op. Keep `${run.*}` / `${LOOMCYCLE_*}` header placeholders LITERAL
|
|
473
|
+
* (don't resolve a per-restart token) or the content varies each boot and
|
|
474
|
+
* dedup can't engage. */
|
|
475
|
+
async ensureMcpServer(opts, callOpts) {
|
|
476
|
+
const overlay = {
|
|
477
|
+
transport: opts.transport ?? "http",
|
|
478
|
+
url: opts.url,
|
|
479
|
+
};
|
|
480
|
+
if (opts.headers)
|
|
481
|
+
overlay.headers = opts.headers;
|
|
482
|
+
const createInput = { op: "create", name: opts.name, overlay };
|
|
483
|
+
if (opts.description)
|
|
484
|
+
createInput.description = opts.description;
|
|
485
|
+
const created = (await this.mcpServerDef(createInput, callOpts));
|
|
486
|
+
let row = created;
|
|
487
|
+
let changed = created.deduplicated !== true;
|
|
488
|
+
let discoveredToolCount;
|
|
489
|
+
if (opts.rediscover) {
|
|
490
|
+
const red = (await this.mcpServerDef({ op: "rediscover", name: opts.name }, callOpts));
|
|
491
|
+
row = red;
|
|
492
|
+
if (red.deduplicated !== true)
|
|
493
|
+
changed = true;
|
|
494
|
+
discoveredToolCount = red.discovered;
|
|
495
|
+
}
|
|
496
|
+
const result = {
|
|
497
|
+
name: opts.name,
|
|
498
|
+
defId: row.def_id,
|
|
499
|
+
version: row.version,
|
|
500
|
+
changed,
|
|
501
|
+
};
|
|
502
|
+
if (discoveredToolCount !== undefined)
|
|
503
|
+
result.discoveredToolCount = discoveredToolCount;
|
|
504
|
+
return result;
|
|
505
|
+
}
|
|
453
506
|
/** Invoke the v1.x RFC E ScheduleDef substrate tool over HTTP.
|
|
454
507
|
* Author + fork + retire scheduled-run definitions at runtime.
|
|
455
508
|
* Mirror of {@link LoomcycleClient.agentDef} for schedules — the
|
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
* agentDef(input): Promise<SubstrateToolResponse>
|
|
49
49
|
* skillDef(input): Promise<SubstrateToolResponse>
|
|
50
50
|
* mcpServerDef(input): Promise<SubstrateToolResponse>
|
|
51
|
+
* mcpServerDefVerify(name, sha): Promise<MCPServerDefVerifyResult> // v0.18.0
|
|
52
|
+
* ensureMcpServer(opts): Promise<EnsureMcpServerResult> // v0.18.0 — idempotent register-if-changed
|
|
51
53
|
* scheduleDef(input): Promise<SubstrateToolResponse>
|
|
52
54
|
*
|
|
53
55
|
* // Library v2 enumeration (v0.10.3 — yaml+substrate merged)
|
|
@@ -80,5 +82,5 @@
|
|
|
80
82
|
* See `adapters/ts/README.md` for usage examples.
|
|
81
83
|
*/
|
|
82
84
|
export { LoomcycleClient } from "./client.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";
|
|
85
|
+
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, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, } from "./types.js";
|
|
84
86
|
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
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
* agentDef(input): Promise<SubstrateToolResponse>
|
|
49
49
|
* skillDef(input): Promise<SubstrateToolResponse>
|
|
50
50
|
* mcpServerDef(input): Promise<SubstrateToolResponse>
|
|
51
|
+
* mcpServerDefVerify(name, sha): Promise<MCPServerDefVerifyResult> // v0.18.0
|
|
52
|
+
* ensureMcpServer(opts): Promise<EnsureMcpServerResult> // v0.18.0 — idempotent register-if-changed
|
|
51
53
|
* scheduleDef(input): Promise<SubstrateToolResponse>
|
|
52
54
|
*
|
|
53
55
|
* // Library v2 enumeration (v0.10.3 — yaml+substrate merged)
|
package/dist/types.d.ts
CHANGED
|
@@ -607,7 +607,7 @@ export interface PostHookCall {
|
|
|
607
607
|
* the adapter doesn't re-validate. Use the optional `extra` index
|
|
608
608
|
* signature for forward-compat fields. */
|
|
609
609
|
export type SubstrateToolInput = {
|
|
610
|
-
op: "create" | "fork" | "get" | "list" | "promote" | "retire";
|
|
610
|
+
op: "create" | "fork" | "get" | "list" | "promote" | "retire" | "rediscover" | "verify";
|
|
611
611
|
name?: string;
|
|
612
612
|
def_id?: string;
|
|
613
613
|
parent_def_id?: string;
|
|
@@ -938,6 +938,43 @@ export interface MCPServerDefRowResponse {
|
|
|
938
938
|
content_sha256?: string;
|
|
939
939
|
/** Only populated on `set` / `fork` responses (auto-promoted?). */
|
|
940
940
|
promoted?: boolean;
|
|
941
|
+
/** True when create/rediscover was a content-addressed no-op
|
|
942
|
+
* (loomcycle ≥ v0.18.0): the active def already carried identical
|
|
943
|
+
* content (create) or identical discovered_tools (rediscover), so no
|
|
944
|
+
* new version was minted. Absent (undefined) on a real mint. */
|
|
945
|
+
deduplicated?: boolean;
|
|
946
|
+
/** Only on `rediscover` responses — the number of tools discovered. */
|
|
947
|
+
discovered?: number;
|
|
948
|
+
}
|
|
949
|
+
/** Options for {@link LoomcycleClient.ensureMcpServer}. */
|
|
950
|
+
export interface EnsureMcpServerOptions {
|
|
951
|
+
/** Substrate name (not a static cfg.MCPServers name). */
|
|
952
|
+
name: string;
|
|
953
|
+
/** Absolute MCP endpoint, e.g. `http://localhost:3000/api/mcp`. */
|
|
954
|
+
url: string;
|
|
955
|
+
/** Default `"http"`. */
|
|
956
|
+
transport?: "http" | "streamable-http";
|
|
957
|
+
/** Per-request headers, stored verbatim. Keep `${run.*}` / `${LOOMCYCLE_*}`
|
|
958
|
+
* substitution placeholders LITERAL (don't resolve a token yourself) so
|
|
959
|
+
* the registration content is stable across restarts — that's what lets
|
|
960
|
+
* loomcycle's idempotent create dedup the re-registration. */
|
|
961
|
+
headers?: Record<string, string>;
|
|
962
|
+
description?: string;
|
|
963
|
+
/** Run a `tools/list` rediscover after registering. Default false. */
|
|
964
|
+
rediscover?: boolean;
|
|
965
|
+
}
|
|
966
|
+
/** Result of {@link LoomcycleClient.ensureMcpServer}. */
|
|
967
|
+
export interface EnsureMcpServerResult {
|
|
968
|
+
name: string;
|
|
969
|
+
defId: string;
|
|
970
|
+
version: number;
|
|
971
|
+
/** True when this call minted a new version (create and/or rediscover);
|
|
972
|
+
* false when loomcycle deduped it (active def already current). A
|
|
973
|
+
* consumer re-registering on every boot expects `changed: false` once
|
|
974
|
+
* the registration content is stable. */
|
|
975
|
+
changed: boolean;
|
|
976
|
+
/** Populated when `rediscover` ran: the number of tools discovered. */
|
|
977
|
+
discoveredToolCount?: number;
|
|
941
978
|
}
|
|
942
979
|
/** Response shape for `MCPServerDef verify`. Same semantics as
|
|
943
980
|
* AgentDefVerifyResult / SkillDefVerifyResult — answers "is the
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcycle/client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript client for the loomcycle sidecar (HTTP+SSE).
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 51 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).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|