@loomcycle/client 0.10.2 → 0.10.4

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.
@@ -422,6 +422,47 @@ class LoomcycleClient {
422
422
  async mcpServerDef(input, opts) {
423
423
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_mcpserverdef", input, opts);
424
424
  }
425
+ // ---- v0.10.3 Library v2 enumeration (read-only, merged yaml+substrate) ----
426
+ /** List every agent the runtime knows about — yaml-static + dynamic
427
+ * AgentDefs merged into one envelope per name. Each entry carries
428
+ * `source: "static-only" | "dynamic-only" | "both"` so callers can
429
+ * badge / filter by origin. Static-source entries inline the
430
+ * yaml-side definition body in `static_definition`; dynamic-only
431
+ * entries omit it (fetch the active version's body via
432
+ * `agentDef({op: "get", name})` when needed).
433
+ *
434
+ * Wraps the v0.9.3 endpoint `GET /v1/_library/agents`. Bearer-authed.
435
+ * Deterministic alphabetical sort by name.
436
+ *
437
+ * Typical use: populate an integration's "which agent to dispatch?"
438
+ * dropdown (n8n, Slack slash commands, custom workflow editors).
439
+ *
440
+ * Raises {@link AuthError} on 401; {@link UnavailableError} on 503
441
+ * (store unwired in test configurations). */
442
+ async listLibraryAgents(opts) {
443
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_library/agents", opts);
444
+ }
445
+ /** List every skill the runtime knows about — bundled skills (Approach
446
+ * A) + filesystem overlay + dynamic SkillDefs merged into one
447
+ * envelope per name. See {@link LoomcycleClient.listLibraryAgents}
448
+ * for the source-tagging contract; the only difference is the
449
+ * `static_definition` shape ({@link LibrarySkillDefinition}).
450
+ *
451
+ * Wraps `GET /v1/_library/skills` (v0.9.3). */
452
+ async listLibrarySkills(opts) {
453
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_library/skills", opts);
454
+ }
455
+ /** List every MCP server the runtime knows about — yaml-declared
456
+ * servers + dynamic MCPServerDef registrations merged into one
457
+ * envelope per name. Static entries additionally inline the cached
458
+ * `discovered_tools` snapshot when the pool inspector is wired
459
+ * AND the pool has finished init for that server (omitted otherwise
460
+ * — re-check after the pool finishes).
461
+ *
462
+ * Wraps `GET /v1/_library/mcp-servers` (v0.9.3). */
463
+ async listLibraryMcpServers(opts) {
464
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_library/mcp-servers", opts);
465
+ }
425
466
  // ---- Internal helpers ----
426
467
  /** Shared SSE POST → stream-of-AgentEvent path. Used by
427
468
  * runStreaming + continueSession.
package/dist/cjs/index.js CHANGED
@@ -47,6 +47,11 @@
47
47
  * agentDef(input): Promise<SubstrateToolResponse>
48
48
  * skillDef(input): Promise<SubstrateToolResponse>
49
49
  *
50
+ * // Library v2 enumeration (v0.10.3 — yaml+substrate merged)
51
+ * listLibraryAgents(): Promise<LibraryListResponse<LibraryAgentDefinition>>
52
+ * listLibrarySkills(): Promise<LibraryListResponse<LibrarySkillDefinition>>
53
+ * listLibraryMcpServers(): Promise<LibraryListResponse<LibraryMcpServerDefinition>>
54
+ *
50
55
  * Errors (typed subclasses of LoomcycleError; see README for the
51
56
  * full HTTP-status → typed-error mapping table):
52
57
  * LoomcycleError, AgentNotFoundError, SessionNotFoundError,
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, ChannelPeekResult, ChannelPublishResult, ChannelSubscribeResult, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, ListUsersResponse, 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, ChannelPeekResult, ChannelPublishResult, ChannelSubscribeResult, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopesResponse, PauseResult, RegisterHookOptions, RegisterHookResponse, ResolveInterruptOptions, ResumeResult, RunOptions, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, TranscriptResponse } from "./types.js";
27
27
  export declare class LoomcycleClient {
28
28
  private ctx;
29
29
  constructor(opts?: ClientOptions);
@@ -289,6 +289,46 @@ export declare class LoomcycleClient {
289
289
  mcpServerDef(input: SubstrateToolInput, opts?: {
290
290
  signal?: AbortSignal;
291
291
  }): Promise<SubstrateToolResponse>;
292
+ /** List every agent the runtime knows about — yaml-static + dynamic
293
+ * AgentDefs merged into one envelope per name. Each entry carries
294
+ * `source: "static-only" | "dynamic-only" | "both"` so callers can
295
+ * badge / filter by origin. Static-source entries inline the
296
+ * yaml-side definition body in `static_definition`; dynamic-only
297
+ * entries omit it (fetch the active version's body via
298
+ * `agentDef({op: "get", name})` when needed).
299
+ *
300
+ * Wraps the v0.9.3 endpoint `GET /v1/_library/agents`. Bearer-authed.
301
+ * Deterministic alphabetical sort by name.
302
+ *
303
+ * Typical use: populate an integration's "which agent to dispatch?"
304
+ * dropdown (n8n, Slack slash commands, custom workflow editors).
305
+ *
306
+ * Raises {@link AuthError} on 401; {@link UnavailableError} on 503
307
+ * (store unwired in test configurations). */
308
+ listLibraryAgents(opts?: {
309
+ signal?: AbortSignal;
310
+ }): Promise<LibraryListResponse<LibraryAgentDefinition>>;
311
+ /** List every skill the runtime knows about — bundled skills (Approach
312
+ * A) + filesystem overlay + dynamic SkillDefs merged into one
313
+ * envelope per name. See {@link LoomcycleClient.listLibraryAgents}
314
+ * for the source-tagging contract; the only difference is the
315
+ * `static_definition` shape ({@link LibrarySkillDefinition}).
316
+ *
317
+ * Wraps `GET /v1/_library/skills` (v0.9.3). */
318
+ listLibrarySkills(opts?: {
319
+ signal?: AbortSignal;
320
+ }): Promise<LibraryListResponse<LibrarySkillDefinition>>;
321
+ /** List every MCP server the runtime knows about — yaml-declared
322
+ * servers + dynamic MCPServerDef registrations merged into one
323
+ * envelope per name. Static entries additionally inline the cached
324
+ * `discovered_tools` snapshot when the pool inspector is wired
325
+ * AND the pool has finished init for that server (omitted otherwise
326
+ * — re-check after the pool finishes).
327
+ *
328
+ * Wraps `GET /v1/_library/mcp-servers` (v0.9.3). */
329
+ listLibraryMcpServers(opts?: {
330
+ signal?: AbortSignal;
331
+ }): Promise<LibraryListResponse<LibraryMcpServerDefinition>>;
292
332
  /** Shared SSE POST → stream-of-AgentEvent path. Used by
293
333
  * runStreaming + continueSession.
294
334
  *
package/dist/client.js CHANGED
@@ -419,6 +419,47 @@ export class LoomcycleClient {
419
419
  async mcpServerDef(input, opts) {
420
420
  return postJSON(this.ctx, "/v1/_mcpserverdef", input, opts);
421
421
  }
422
+ // ---- v0.10.3 Library v2 enumeration (read-only, merged yaml+substrate) ----
423
+ /** List every agent the runtime knows about — yaml-static + dynamic
424
+ * AgentDefs merged into one envelope per name. Each entry carries
425
+ * `source: "static-only" | "dynamic-only" | "both"` so callers can
426
+ * badge / filter by origin. Static-source entries inline the
427
+ * yaml-side definition body in `static_definition`; dynamic-only
428
+ * entries omit it (fetch the active version's body via
429
+ * `agentDef({op: "get", name})` when needed).
430
+ *
431
+ * Wraps the v0.9.3 endpoint `GET /v1/_library/agents`. Bearer-authed.
432
+ * Deterministic alphabetical sort by name.
433
+ *
434
+ * Typical use: populate an integration's "which agent to dispatch?"
435
+ * dropdown (n8n, Slack slash commands, custom workflow editors).
436
+ *
437
+ * Raises {@link AuthError} on 401; {@link UnavailableError} on 503
438
+ * (store unwired in test configurations). */
439
+ async listLibraryAgents(opts) {
440
+ return jsonFetch(this.ctx, "/v1/_library/agents", opts);
441
+ }
442
+ /** List every skill the runtime knows about — bundled skills (Approach
443
+ * A) + filesystem overlay + dynamic SkillDefs merged into one
444
+ * envelope per name. See {@link LoomcycleClient.listLibraryAgents}
445
+ * for the source-tagging contract; the only difference is the
446
+ * `static_definition` shape ({@link LibrarySkillDefinition}).
447
+ *
448
+ * Wraps `GET /v1/_library/skills` (v0.9.3). */
449
+ async listLibrarySkills(opts) {
450
+ return jsonFetch(this.ctx, "/v1/_library/skills", opts);
451
+ }
452
+ /** List every MCP server the runtime knows about — yaml-declared
453
+ * servers + dynamic MCPServerDef registrations merged into one
454
+ * envelope per name. Static entries additionally inline the cached
455
+ * `discovered_tools` snapshot when the pool inspector is wired
456
+ * AND the pool has finished init for that server (omitted otherwise
457
+ * — re-check after the pool finishes).
458
+ *
459
+ * Wraps `GET /v1/_library/mcp-servers` (v0.9.3). */
460
+ async listLibraryMcpServers(opts) {
461
+ return jsonFetch(this.ctx, "/v1/_library/mcp-servers", opts);
462
+ }
422
463
  // ---- Internal helpers ----
423
464
  /** Shared SSE POST → stream-of-AgentEvent path. Used by
424
465
  * runStreaming + continueSession.
package/dist/index.d.ts CHANGED
@@ -46,6 +46,11 @@
46
46
  * agentDef(input): Promise<SubstrateToolResponse>
47
47
  * skillDef(input): Promise<SubstrateToolResponse>
48
48
  *
49
+ * // Library v2 enumeration (v0.10.3 — yaml+substrate merged)
50
+ * listLibraryAgents(): Promise<LibraryListResponse<LibraryAgentDefinition>>
51
+ * listLibrarySkills(): Promise<LibraryListResponse<LibrarySkillDefinition>>
52
+ * listLibraryMcpServers(): Promise<LibraryListResponse<LibraryMcpServerDefinition>>
53
+ *
49
54
  * Errors (typed subclasses of LoomcycleError; see README for the
50
55
  * full HTTP-status → typed-error mapping table):
51
56
  * LoomcycleError, AgentNotFoundError, SessionNotFoundError,
@@ -64,5 +69,5 @@
64
69
  * See `adapters/ts/README.md` for usage examples.
65
70
  */
66
71
  export { LoomcycleClient } from "./client.js";
67
- export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, 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, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, } from "./types.js";
72
+ export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, 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, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, } from "./types.js";
68
73
  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
@@ -46,6 +46,11 @@
46
46
  * agentDef(input): Promise<SubstrateToolResponse>
47
47
  * skillDef(input): Promise<SubstrateToolResponse>
48
48
  *
49
+ * // Library v2 enumeration (v0.10.3 — yaml+substrate merged)
50
+ * listLibraryAgents(): Promise<LibraryListResponse<LibraryAgentDefinition>>
51
+ * listLibrarySkills(): Promise<LibraryListResponse<LibrarySkillDefinition>>
52
+ * listLibraryMcpServers(): Promise<LibraryListResponse<LibraryMcpServerDefinition>>
53
+ *
49
54
  * Errors (typed subclasses of LoomcycleError; see README for the
50
55
  * full HTTP-status → typed-error mapping table):
51
56
  * LoomcycleError, AgentNotFoundError, SessionNotFoundError,
package/dist/types.d.ts CHANGED
@@ -811,3 +811,71 @@ export interface MCPServerDefVerifyResult {
811
811
  /** True if an active row exists for this name. */
812
812
  deployed: boolean;
813
813
  }
814
+ /** Static-side agent definition body. Snake_case keys mirror
815
+ * internal/lookup.SubstrateAgentDef so substrate-side and static-side
816
+ * definitions share one renderer. Forward-compatible: unknown fields
817
+ * on newer binaries flow through transparently. */
818
+ export interface LibraryAgentDefinition {
819
+ provider?: string;
820
+ model?: string;
821
+ tier?: string;
822
+ effort?: string;
823
+ max_tokens?: number;
824
+ max_iterations?: number;
825
+ system_prompt?: string;
826
+ system_prompt_base?: string;
827
+ allowed_tools?: string[];
828
+ skills?: string[];
829
+ providers?: string[];
830
+ /** Per-tier candidate list. Server-side opaque shape — kept as
831
+ * Record<string, unknown> for forward-compat. */
832
+ models?: Record<string, unknown>;
833
+ memory_scopes?: string[];
834
+ memory_quota_bytes?: number;
835
+ }
836
+ /** Static-side skill definition body. */
837
+ export interface LibrarySkillDefinition {
838
+ body?: string;
839
+ description?: string;
840
+ allowed_tools?: string[];
841
+ }
842
+ /** Static-side MCP server definition body. Mirrors
843
+ * internal/api/http.marshalStaticMCPServer (transport + url + headers
844
+ * for http/streamable-http; command/args/env/pool_size for stdio;
845
+ * allowed_tools narrowing; discovered_tools cached from the pool
846
+ * inspector when ready). */
847
+ export interface LibraryMcpServerDefinition {
848
+ transport?: "http" | "streamable-http" | "stdio";
849
+ url?: string;
850
+ headers?: Record<string, string>;
851
+ command?: string;
852
+ args?: string[];
853
+ env?: Record<string, string>;
854
+ pool_size?: number;
855
+ allowed_tools?: string[];
856
+ /** Substrate-mirror shape of the pool's PeekTools snapshot.
857
+ * Omitted when the pool inspector returns nil (init pending or
858
+ * failed) — re-check after pool init completes. */
859
+ discovered_tools?: unknown;
860
+ }
861
+ /** One row of the library envelope. T is the per-endpoint definition
862
+ * type — LibraryAgentDefinition for /v1/_library/agents, etc. */
863
+ export interface LibraryEntry<T = unknown> {
864
+ name: string;
865
+ source: "static-only" | "dynamic-only" | "both";
866
+ in_static: boolean;
867
+ in_substrate: boolean;
868
+ version_count: number;
869
+ active_def_id?: string;
870
+ latest_version?: number;
871
+ last_updated?: string;
872
+ /** Static-side definition body. Omitted when in_static is false
873
+ * (dynamic-only entries have no static body — query the substrate
874
+ * via AgentDef/SkillDef/MCPServerDef tools to fetch the active
875
+ * version's payload). */
876
+ static_definition?: T;
877
+ }
878
+ /** Envelope returned by all three GET /v1/_library/* endpoints. */
879
+ export interface LibraryListResponse<T = unknown> {
880
+ entries: LibraryEntry<T>[];
881
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "0.10.2",
4
- "description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 36 methods covering run streaming, agent metadata, pause/resume/state, snapshot lifecycle, memory admin (incl. v0.9.0 Vector Memory embed_stats + reembed), interruption resolve, hook management, v0.8.22 substrate admin (agentDef + skillDef), v0.9.x n8n Phase 0 (listChannels + streamUserRunStates — with debug-mode synthetic open/close meta-frames + client-side parentAgentId filter), v0.9.x Channel CRUD (publishChannel + subscribeChannel + peekChannel + ackChannel — admin scope=global + per-user scope=user surfaces), v0.9.x content_sha256 (AgentDefVerifyResult + SkillDefVerifyResult types for the bundle-vs-deployed comparison workflow), v0.9.1 transcript first-cycle (SystemPromptPayload + UserInputPayload), and v0.9.x dynamic MCP server registration (mcpServerDef + MCPServerDefVerifyResult — register HTTP/Streamable-HTTP MCP servers at runtime without yaml edits). v0.10.1 — dual ESM + CommonJS distribution (additive — ESM consumers unchanged; CJS consumers like n8n's community-node loader now work).",
3
+ "version": "0.10.4",
4
+ "description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 39 methods covering run streaming, agent metadata, pause/resume/state, snapshot lifecycle, memory admin (incl. v0.9.0 Vector Memory embed_stats + reembed), interruption resolve, hook management, v0.8.22 substrate admin (agentDef + skillDef), v0.9.x n8n Phase 0 (listChannels + streamUserRunStates — with debug-mode synthetic open/close meta-frames + client-side parentAgentId filter), v0.9.x Channel CRUD (publishChannel + subscribeChannel + peekChannel + ackChannel — admin scope=global + per-user scope=user surfaces), v0.9.x content_sha256 (AgentDefVerifyResult + SkillDefVerifyResult types for the bundle-vs-deployed comparison workflow), v0.9.1 transcript first-cycle (SystemPromptPayload + UserInputPayload), v0.9.x dynamic MCP server registration (mcpServerDef + MCPServerDefVerifyResult — register HTTP/Streamable-HTTP MCP servers at runtime without yaml edits), and v0.10.3 Library v2 enumeration (listLibraryAgents + listLibrarySkills + listLibraryMcpServers — typed wrappers around the v0.9.3 yaml+substrate merged endpoints for n8n + workflow-editor integrations). 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": {