@loomcycle/client 1.112.0 → 1.113.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 +285 -29
- package/dist/cjs/client.js +542 -18
- package/dist/cjs/errors.js +119 -15
- package/dist/cjs/fetch-helpers.js +39 -8
- package/dist/cjs/index.js +53 -8
- package/dist/cjs/interactive.js +5 -1
- package/dist/cjs/signature.js +119 -0
- package/dist/client.d.ts +393 -29
- package/dist/client.js +542 -18
- package/dist/errors.d.ts +92 -14
- package/dist/errors.js +116 -14
- package/dist/fetch-helpers.d.ts +3 -0
- package/dist/fetch-helpers.js +40 -9
- package/dist/index.d.ts +51 -9
- package/dist/index.js +49 -8
- package/dist/interactive.js +5 -1
- package/dist/signature.d.ts +73 -0
- package/dist/signature.js +115 -0
- package/dist/types.d.ts +1217 -17
- package/package.json +1 -1
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 { CredentialListResponse, CredentialMeta, DecideRequest, DecideResponse, DecisionModelsResponse, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent,
|
|
28
|
+
import type { ChangeFeedFrame, StreamChangesOptions, CredentialListResponse, CredentialMeta, DecideRequest, DecideResponse, DecisionModelsResponse, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, Agent, AgentEvent, AgentList, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, AgentOverridableResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureHookDefOptions, EnsureHookDefResult, HookDefInput, HookDefOverlay, HookDefRowResponse, CreateDefOptions, ForkDefOptions, HookDefForkOverlay, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, WebhookDefInput, WebhookDefOverlay, WebhookDefRowResponse, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, InterruptListResponse, InterruptStatus, ListUserAgentsOptions, WalkRunsPage, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelPeekResult, TeamChannelReleaseResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, 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, RetentionOverride, PersistentVolumesResponse, EphemeralVolumesResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, RunTreeDeletion, ReplaySessionResult, CancelTurnResult, ReviewRunResult, RunBatchOptions, RunBatchResult, RunOptions, ConfiguredRun, ConfiguredRunPatch, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, CreateTeamOptions, DefNamesResponse, ForkTeamOptions, ModelAliasesResponse, OperatorTokenDefNamesResponse, ProviderModelsResponse, RoutingResponse, ScheduleListResponse, SchedulePauseResult, ScheduleRunNowResult, ScheduleStateView, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamDraft, TeamDraftVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationAggregate, 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);
|
|
@@ -183,6 +183,24 @@ export declare class LoomcycleClient {
|
|
|
183
183
|
getEffectiveConfig(runId: string, opts?: {
|
|
184
184
|
signal?: AbortSignal;
|
|
185
185
|
}): Promise<EffectiveConfigResponse>;
|
|
186
|
+
/** Which per-run overrides a run of `name` may set, for this caller — what a
|
|
187
|
+
* run form needs before it sends anything. Mirrors
|
|
188
|
+
* `GET /v1/_agentdef/{name}/overridable`.
|
|
189
|
+
*
|
|
190
|
+
* Folds the agent's `allow_overrides` with the caller's token overrides
|
|
191
|
+
* policy, through the same checks the run path refuses with; a refused field
|
|
192
|
+
* names which (`reason`). Overridable fields carry what the run path then
|
|
193
|
+
* accepts: `narrow_only`, `max`, and `values` for a closed set.
|
|
194
|
+
*
|
|
195
|
+
* `substrate:tenant` (a non-isolated member too). A token limited to certain
|
|
196
|
+
* agents may ask about those agents only. Raises {@link AgentNotFoundError}
|
|
197
|
+
* (404) for an unknown or another tenant's agent, and a 403
|
|
198
|
+
* `agent_not_allowed` for an agent outside the token's allowlist. */
|
|
199
|
+
getAgentOverridable(name: string, opts?: {
|
|
200
|
+
/** Admin-only tenant focus (?tenant=); ignored for a tenant principal. */
|
|
201
|
+
tenant?: string;
|
|
202
|
+
signal?: AbortSignal;
|
|
203
|
+
}): Promise<AgentOverridableResponse>;
|
|
186
204
|
/** Re-attach to a run's event stream by `run_id` (RFC AI), replaying from
|
|
187
205
|
* `fromSeq` (default 0) then live-tailing — the gRPC-free twin of the Web
|
|
188
206
|
* UI's resume-in-terminal. Mirrors `GET /v1/runs/{run_id}/stream`. The
|
|
@@ -413,22 +431,21 @@ export declare class LoomcycleClient {
|
|
|
413
431
|
reason?: string;
|
|
414
432
|
signal?: AbortSignal;
|
|
415
433
|
}): Promise<CancelAgentResult>;
|
|
416
|
-
/** List a user's recent agent runs, optionally filtered by
|
|
417
|
-
* `status` only running runs are returned; `"all"` returns
|
|
434
|
+
/** List a user's recent agent runs (at most 100), optionally filtered by
|
|
435
|
+
* status. With no `status` only running runs are returned; `"all"` returns
|
|
436
|
+
* every status; several statuses list a run in any of them.
|
|
437
|
+
*
|
|
438
|
+
* `awaitedState` lists only running runs blocked on one of the named waits
|
|
439
|
+
* (`"review"`, `"input"`, …). The state is derived per run, so the server
|
|
440
|
+
* reads at most 1,000 running runs; the returned array carries
|
|
441
|
+
* `truncated: true` when it stopped with some unread.
|
|
418
442
|
*
|
|
419
443
|
* v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
|
|
420
444
|
* whose `parent_agent_id` matches. The server still returns the
|
|
421
445
|
* full set (server-side `?parent_agent_id=` filter is a future
|
|
422
446
|
* request); the adapter trims before returning. Useful for the
|
|
423
447
|
* n8n trigger pattern "show me all sub-runs spawned by parent X." */
|
|
424
|
-
listUserAgents(userId: string, opts?:
|
|
425
|
-
status?: AgentStatus | "all";
|
|
426
|
-
parentAgentId?: string;
|
|
427
|
-
/** Super-admin tenant-focus (?tenant=, RFC L v0.17.0). Ignored
|
|
428
|
-
* server-side for a tenant principal — its own tenant is forced. */
|
|
429
|
-
tenant?: string;
|
|
430
|
-
signal?: AbortSignal;
|
|
431
|
-
}): Promise<Agent[]>;
|
|
448
|
+
listUserAgents(userId: string, opts?: ListUserAgentsOptions): Promise<AgentList>;
|
|
432
449
|
/** One page of a team walk's runs — the walk's own run (its run id IS the
|
|
433
450
|
* walk id) and every member it spawned, oldest first. The walk's own row
|
|
434
451
|
* carries its `result` (with the `terminal` it reached); member rows do
|
|
@@ -706,6 +723,38 @@ export declare class LoomcycleClient {
|
|
|
706
723
|
resolveProbe(opts?: {
|
|
707
724
|
signal?: AbortSignal;
|
|
708
725
|
}): Promise<ResolverMatrix>;
|
|
726
|
+
/** The configured model aliases — the operator's top-level `models:` map,
|
|
727
|
+
* alias name → `{provider, model, kind?}` (`GET /v1/_models`). Non-secret and
|
|
728
|
+
* global (the same set for every tenant); tenant-readable. Store an alias on
|
|
729
|
+
* an agent or fork rather than the concrete model it names, and the agent
|
|
730
|
+
* follows when the operator retargets the alias. */
|
|
731
|
+
listModels(opts?: {
|
|
732
|
+
signal?: AbortSignal;
|
|
733
|
+
}): Promise<ModelAliasesResponse>;
|
|
734
|
+
/** For each user tier × tier, the ordered provider/model cascade a run
|
|
735
|
+
* resolves to now, top first, with live availability and the candidate
|
|
736
|
+
* `selected` (`GET /v1/_routing`). Tenant-readable. A non-admin caller gets
|
|
737
|
+
* `admin: false`, no raw `last_error`, and — when the operator-key gate
|
|
738
|
+
* restricts it — only the providers it can key itself
|
|
739
|
+
* (`operator_key_restricted: true`). */
|
|
740
|
+
getRouting(opts?: {
|
|
741
|
+
signal?: AbortSignal;
|
|
742
|
+
}): Promise<RoutingResponse>;
|
|
743
|
+
/** List the models a provider serves right now, by a live round-trip to it
|
|
744
|
+
* (`GET /v1/_providers/{id}/models`) rather than the cached probe matrix.
|
|
745
|
+
*
|
|
746
|
+
* **Requires an admin token.** A `substrate:tenant` token is refused with a
|
|
747
|
+
* {@link LoomcycleError} whose `status` is 403 ("insufficient scope"); a
|
|
748
|
+
* model picker built on a tenant token should fall back to
|
|
749
|
+
* {@link LoomcycleClient.listModels} plus free-text model entry.
|
|
750
|
+
*
|
|
751
|
+
* Errors carry the server's code on `e.code`: 404 `provider_unknown` (no such
|
|
752
|
+
* driver), 503 `provider_unavailable` (known, but not configured — e.g. no
|
|
753
|
+
* key), 502 `provider_list_failed` (the round-trip failed; bounded at 10 s
|
|
754
|
+
* server-side). */
|
|
755
|
+
listProviderModels(providerId: string, opts?: {
|
|
756
|
+
signal?: AbortSignal;
|
|
757
|
+
}): Promise<ProviderModelsResponse>;
|
|
709
758
|
/** Capture running-state into a per-section-semver JSON envelope.
|
|
710
759
|
* Raises SnapshotTooLargeError on 413 when the envelope exceeds
|
|
711
760
|
* LOOMCYCLE_SNAPSHOT_MAX_BYTES (default 512 MiB). */
|
|
@@ -996,10 +1045,29 @@ export declare class LoomcycleClient {
|
|
|
996
1045
|
* Raises {@link SubstrateToolRefusedError} on tool-level refusals
|
|
997
1046
|
* (static-name collision, missing required credential, invalid
|
|
998
1047
|
* cron, etc.); {@link InvalidArgumentError} on 400 (malformed
|
|
999
|
-
* JSON); {@link AuthError} on 401.
|
|
1000
|
-
|
|
1048
|
+
* JSON); {@link AuthError} on 401.
|
|
1049
|
+
*
|
|
1050
|
+
* Annotate the input as {@link ScheduleDefInput} to have the overlay and
|
|
1051
|
+
* each op's fields checked (including `add_hook` / `remove_hook`, which the
|
|
1052
|
+
* loose {@link SubstrateToolInput} does not list); a loose input is sent
|
|
1053
|
+
* as it is. For create / fork, {@link LoomcycleClient.createScheduleDef} /
|
|
1054
|
+
* {@link LoomcycleClient.forkScheduleDef} check a bare literal too. */
|
|
1055
|
+
scheduleDef(input: ScheduleDefInput | SubstrateToolInput, opts?: {
|
|
1001
1056
|
signal?: AbortSignal;
|
|
1002
1057
|
}): Promise<SubstrateToolResponse>;
|
|
1058
|
+
/** `scheduleDef({op: "create"})` with the overlay typed and no loose
|
|
1059
|
+
* fallback. {@link ScheduleDefOverlay} stays OPEN (the server drops keys it
|
|
1060
|
+
* does not know), so a misspelt key still compiles here; what fails is a
|
|
1061
|
+
* wrong type or value on a key it declares (`concurrency_policy: "skip"`,
|
|
1062
|
+
* an `on_complete` entry missing its `tool`). New versions are promoted
|
|
1063
|
+
* unless `promote: false`. */
|
|
1064
|
+
createScheduleDef(name: string, overlay: ScheduleDefOverlay, opts?: CreateDefOptions): Promise<ScheduleDefRowResponse>;
|
|
1065
|
+
/** `scheduleDef({op: "fork"})`, typed like
|
|
1066
|
+
* {@link LoomcycleClient.createScheduleDef}. A field the overlay leaves out
|
|
1067
|
+
* keeps the parent's; the credential maps merge key by key. Forks the
|
|
1068
|
+
* active version of `name` (or its yaml template) unless `parentDefId` is
|
|
1069
|
+
* given; promoted unless `promote: false`. */
|
|
1070
|
+
forkScheduleDef(name: string, overlay: ScheduleDefOverlay, opts?: ForkDefOptions): Promise<ScheduleDefRowResponse>;
|
|
1003
1071
|
/** Invoke the v1.x RFC G A2AServerCardDef substrate tool over HTTP.
|
|
1004
1072
|
* Author + fork + retire A2A server-card definitions at runtime.
|
|
1005
1073
|
* Mirror of {@link LoomcycleClient.scheduleDef} for A2A server cards.
|
|
@@ -1041,10 +1109,29 @@ export declare class LoomcycleClient {
|
|
|
1041
1109
|
*
|
|
1042
1110
|
* Raises {@link SubstrateToolRefusedError} on tool-level refusals;
|
|
1043
1111
|
* {@link InvalidArgumentError} on 400 (malformed JSON);
|
|
1044
|
-
* {@link AuthError} on 401.
|
|
1045
|
-
|
|
1112
|
+
* {@link AuthError} on 401.
|
|
1113
|
+
*
|
|
1114
|
+
* Annotate the input as {@link WebhookDefInput} to have the overlay and
|
|
1115
|
+
* each op's fields checked; a loose input is sent as it is. For create /
|
|
1116
|
+
* fork, {@link LoomcycleClient.createWebhookDef} /
|
|
1117
|
+
* {@link LoomcycleClient.forkWebhookDef} check a bare literal too. */
|
|
1118
|
+
webhookDef(input: WebhookDefInput | SubstrateToolInput, opts?: {
|
|
1046
1119
|
signal?: AbortSignal;
|
|
1047
1120
|
}): Promise<SubstrateToolResponse>;
|
|
1121
|
+
/** `webhookDef({op: "create"})` with the overlay typed and no loose
|
|
1122
|
+
* fallback. {@link WebhookDefOverlay} stays OPEN for now (the server drops
|
|
1123
|
+
* keys it does not know), so a misspelt key still compiles here; what
|
|
1124
|
+
* fails is a wrong type or value on a key it declares (`delivery: "run"`,
|
|
1125
|
+
* `auth.kind: "basic"`, a misspelt key inside `rate_limit`). Promoted
|
|
1126
|
+
* unless `promote: false`. */
|
|
1127
|
+
createWebhookDef(name: string, overlay: WebhookDefOverlay, opts?: CreateDefOptions): Promise<WebhookDefRowResponse>;
|
|
1128
|
+
/** `webhookDef({op: "fork"})`, typed like
|
|
1129
|
+
* {@link LoomcycleClient.createWebhookDef}. A field the overlay leaves out
|
|
1130
|
+
* keeps the parent's; naming exactly one of `agent` / `channel` / `team`
|
|
1131
|
+
* clears the other two. Forks the active version of `name` (or its yaml
|
|
1132
|
+
* template) unless `parentDefId` is given; promoted unless
|
|
1133
|
+
* `promote: false`. */
|
|
1134
|
+
forkWebhookDef(name: string, overlay: WebhookDefOverlay, opts?: ForkDefOptions): Promise<WebhookDefRowResponse>;
|
|
1048
1135
|
/** Invoke the RFC I MR-3a MemoryBackendDef substrate tool over HTTP.
|
|
1049
1136
|
* Author + fork + retire named memory backend definitions at runtime.
|
|
1050
1137
|
* Mirror of {@link LoomcycleClient.webhookDef} for memory backends.
|
|
@@ -1073,10 +1160,51 @@ export declare class LoomcycleClient {
|
|
|
1073
1160
|
* matches, its body (code-js or a webhook URL), fail mode and timeout.
|
|
1074
1161
|
* Tenant-confined like agentDef. A HookDef fires on nothing by itself; an
|
|
1075
1162
|
* agent definition, a team definition or a run names it. Mirrors
|
|
1076
|
-
* POST /v1/_hookdef.
|
|
1077
|
-
|
|
1163
|
+
* POST /v1/_hookdef.
|
|
1164
|
+
*
|
|
1165
|
+
* Annotate the input as {@link HookDefInput} to have the overlay checked
|
|
1166
|
+
* against the definition the server decodes STRICTLY — an unknown overlay
|
|
1167
|
+
* key is then a compile error instead of a refusal. A loose
|
|
1168
|
+
* {@link SubstrateToolInput} is sent as it is — including a bare literal
|
|
1169
|
+
* with a misspelt key, which falls through to that loose shape. To have a
|
|
1170
|
+
* bare literal checked, use {@link LoomcycleClient.createHookDef} /
|
|
1171
|
+
* {@link LoomcycleClient.forkHookDef}. */
|
|
1172
|
+
hookDef(input: HookDefInput | SubstrateToolInput, opts?: {
|
|
1078
1173
|
signal?: AbortSignal;
|
|
1079
1174
|
}): Promise<SubstrateToolResponse>;
|
|
1175
|
+
/** `hookDef({op: "create"})` with no loose fallback: `overlay` is the
|
|
1176
|
+
* CLOSED {@link HookDefOverlay}, so any key the server would refuse is a
|
|
1177
|
+
* compile error, even in a bare literal. Every create mints a new version
|
|
1178
|
+
* (use {@link LoomcycleClient.ensureHookDef} to register only on change);
|
|
1179
|
+
* promoted unless `promote: false`. */
|
|
1180
|
+
createHookDef(name: string, overlay: HookDefOverlay, opts?: CreateDefOptions): Promise<HookDefRowResponse>;
|
|
1181
|
+
/** `hookDef({op: "fork"})`, closed like
|
|
1182
|
+
* {@link LoomcycleClient.createHookDef}. Each top-level field given replaces
|
|
1183
|
+
* the parent's; `null` clears one. Forks the active version of `name` in
|
|
1184
|
+
* your tenant unless `parentDefId` is given. NOT promoted unless
|
|
1185
|
+
* `promote: true` — authoring and putting in force are two steps. */
|
|
1186
|
+
forkHookDef(name: string, overlay: HookDefForkOverlay, opts?: ForkDefOptions): Promise<HookDefRowResponse>;
|
|
1187
|
+
/** Register a HookDef idempotently — the register-on-every-boot
|
|
1188
|
+
* convenience, sibling of {@link LoomcycleClient.ensureMcpServer}.
|
|
1189
|
+
*
|
|
1190
|
+
* Unlike MCPServerDef and AgentDef, a HookDef `create` is NOT
|
|
1191
|
+
* content-addressed: every create mints a new version. And the hash
|
|
1192
|
+
* `verify` compares is computed over the server's own JSON encoding of the
|
|
1193
|
+
* definition, which this client cannot reproduce byte for byte. So instead
|
|
1194
|
+
* this reads the active version (`verify` for its def_id — it answers
|
|
1195
|
+
* `deployed: false` rather than raising — then `get`) and compares its
|
|
1196
|
+
* stored definition with `overlay`, both normalized the way the server
|
|
1197
|
+
* normalizes (`fail_mode` defaults to `"open"`, an empty `match.tools`,
|
|
1198
|
+
* description, header map or timeout is dropped). Equal → no write,
|
|
1199
|
+
* `changed: false`. Otherwise `create` with the default promote, which
|
|
1200
|
+
* makes the new version active.
|
|
1201
|
+
*
|
|
1202
|
+
* The normalization only collapses what the server collapses, so a real
|
|
1203
|
+
* change is never skipped; should the server come to normalize something
|
|
1204
|
+
* more, the cost is a redundant version, not a lost one. The rationale
|
|
1205
|
+
* in {@link EnsureHookDefOptions.description} is not part of the
|
|
1206
|
+
* definition and does not count as a change. */
|
|
1207
|
+
ensureHookDef(name: string, overlay: HookDefOverlay, opts?: EnsureHookDefOptions): Promise<EnsureHookDefResult>;
|
|
1080
1208
|
/** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
|
|
1081
1209
|
* RFC L OSS multi-tenant authorization. Operator-admin only. The
|
|
1082
1210
|
* token plaintext is returned ONCE in the create/rotate response.
|
|
@@ -1106,6 +1234,101 @@ export declare class LoomcycleClient {
|
|
|
1106
1234
|
volumeDef(input: SubstrateToolInput, opts?: {
|
|
1107
1235
|
signal?: AbortSignal;
|
|
1108
1236
|
}): Promise<SubstrateToolResponse>;
|
|
1237
|
+
private listDefNames;
|
|
1238
|
+
/** Every AgentDef name (`GET /v1/_agentdef/names`). */
|
|
1239
|
+
listAgentDefNames(opts?: {
|
|
1240
|
+
tenant?: string;
|
|
1241
|
+
signal?: AbortSignal;
|
|
1242
|
+
}): Promise<DefNamesResponse>;
|
|
1243
|
+
/** Every SkillDef name (`GET /v1/_skilldef/names`). */
|
|
1244
|
+
listSkillDefNames(opts?: {
|
|
1245
|
+
tenant?: string;
|
|
1246
|
+
signal?: AbortSignal;
|
|
1247
|
+
}): Promise<DefNamesResponse>;
|
|
1248
|
+
/** Every HookDef name (`GET /v1/_hookdef/names`). */
|
|
1249
|
+
listHookDefNames(opts?: {
|
|
1250
|
+
tenant?: string;
|
|
1251
|
+
signal?: AbortSignal;
|
|
1252
|
+
}): Promise<DefNamesResponse>;
|
|
1253
|
+
/** Every MCPServerDef name (`GET /v1/_mcpserverdef/names`). */
|
|
1254
|
+
listMcpServerDefNames(opts?: {
|
|
1255
|
+
tenant?: string;
|
|
1256
|
+
signal?: AbortSignal;
|
|
1257
|
+
}): Promise<DefNamesResponse>;
|
|
1258
|
+
/** Every ScheduleDef name (`GET /v1/_scheduledef/names`). Substrate only —
|
|
1259
|
+
* {@link LoomcycleClient.listAllSchedules} merges in the static yaml ones. */
|
|
1260
|
+
listScheduleDefNames(opts?: {
|
|
1261
|
+
tenant?: string;
|
|
1262
|
+
signal?: AbortSignal;
|
|
1263
|
+
}): Promise<DefNamesResponse>;
|
|
1264
|
+
/** Every A2AServerCardDef name (`GET /v1/_a2aservercarddef/names`). */
|
|
1265
|
+
listA2AServerCardDefNames(opts?: {
|
|
1266
|
+
tenant?: string;
|
|
1267
|
+
signal?: AbortSignal;
|
|
1268
|
+
}): Promise<DefNamesResponse>;
|
|
1269
|
+
/** Every A2AAgentDef name (`GET /v1/_a2aagentdef/names`). */
|
|
1270
|
+
listA2AAgentDefNames(opts?: {
|
|
1271
|
+
tenant?: string;
|
|
1272
|
+
signal?: AbortSignal;
|
|
1273
|
+
}): Promise<DefNamesResponse>;
|
|
1274
|
+
/** Every WebhookDef name (`GET /v1/_webhookdef/names`). */
|
|
1275
|
+
listWebhookDefNames(opts?: {
|
|
1276
|
+
tenant?: string;
|
|
1277
|
+
signal?: AbortSignal;
|
|
1278
|
+
}): Promise<DefNamesResponse>;
|
|
1279
|
+
/** Every MemoryBackendDef name (`GET /v1/_memorybackenddef/names`). */
|
|
1280
|
+
listMemoryBackendDefNames(opts?: {
|
|
1281
|
+
tenant?: string;
|
|
1282
|
+
signal?: AbortSignal;
|
|
1283
|
+
}): Promise<DefNamesResponse>;
|
|
1284
|
+
/** Every DocumentSourceDef name (`GET /v1/_documentsourcedef/names`). */
|
|
1285
|
+
listDocumentSourceDefNames(opts?: {
|
|
1286
|
+
tenant?: string;
|
|
1287
|
+
signal?: AbortSignal;
|
|
1288
|
+
}): Promise<DefNamesResponse>;
|
|
1289
|
+
/** Every OperatorTokenDef name (`GET /v1/_operatortokendef/names`), with its
|
|
1290
|
+
* subject and token counts — never a token. **Admin token only**: token
|
|
1291
|
+
* minting stays operator-only, so a `substrate:tenant` token is refused
|
|
1292
|
+
* with 403. */
|
|
1293
|
+
listOperatorTokenDefNames(opts?: {
|
|
1294
|
+
tenant?: string;
|
|
1295
|
+
signal?: AbortSignal;
|
|
1296
|
+
}): Promise<OperatorTokenDefNamesResponse>;
|
|
1297
|
+
/** Every schedule: static yaml `scheduled_runs` and ScheduleDefs, merged by
|
|
1298
|
+
* name (`GET /v1/_schedules/list-all`), sorted by name. A tenant token sees
|
|
1299
|
+
* only its own tenant's ScheduleDefs — static schedules are operator
|
|
1300
|
+
* automation and appear only for an admin, who may focus one tenant with
|
|
1301
|
+
* `tenant`. */
|
|
1302
|
+
listAllSchedules(opts?: {
|
|
1303
|
+
tenant?: string;
|
|
1304
|
+
signal?: AbortSignal;
|
|
1305
|
+
}): Promise<ScheduleListResponse>;
|
|
1306
|
+
/** One schedule's runtime state (`GET /v1/_schedules/{def_id}/state`): last
|
|
1307
|
+
* and next fire, pause, the last slot claim, the catch-up backlog and the
|
|
1308
|
+
* runs it has in flight. 404 when the def has no state row (never promoted,
|
|
1309
|
+
* retired, or not yours). */
|
|
1310
|
+
getScheduleState(defId: string, opts?: {
|
|
1311
|
+
signal?: AbortSignal;
|
|
1312
|
+
}): Promise<ScheduleStateView>;
|
|
1313
|
+
/** Fire a schedule now (`POST /v1/_schedules/{def_id}/run-now`). The run
|
|
1314
|
+
* starts on the scheduler's next tick, not during this call, and the regular
|
|
1315
|
+
* cadence continues after it. A run already in flight is handled by the
|
|
1316
|
+
* schedule's `concurrency_policy`. 404 for an unknown def. */
|
|
1317
|
+
runScheduleNow(defId: string, opts?: {
|
|
1318
|
+
signal?: AbortSignal;
|
|
1319
|
+
}): Promise<ScheduleRunNowResult>;
|
|
1320
|
+
/** Pause a schedule indefinitely (`POST /v1/_schedules/{def_id}/pause`) until
|
|
1321
|
+
* {@link LoomcycleClient.resumeSchedule}. Takes no duration: the server sets
|
|
1322
|
+
* `paused_until` about 100 years ahead. Distinct from
|
|
1323
|
+
* {@link LoomcycleClient.pauseRuntime}, which stops the whole runtime. */
|
|
1324
|
+
pauseSchedule(defId: string, opts?: {
|
|
1325
|
+
signal?: AbortSignal;
|
|
1326
|
+
}): Promise<SchedulePauseResult>;
|
|
1327
|
+
/** Clear a schedule's pause (`POST /v1/_schedules/{def_id}/resume`), so the
|
|
1328
|
+
* scheduler considers it due again; `next_run_at` is left as it was. */
|
|
1329
|
+
resumeSchedule(defId: string, opts?: {
|
|
1330
|
+
signal?: AbortSignal;
|
|
1331
|
+
}): Promise<SchedulePauseResult>;
|
|
1109
1332
|
/** List every team the caller may see (GET /v1/_teamdef/names), each with its
|
|
1110
1333
|
* version roll-up. Tenant-scoped server-side. `names` is `null` when empty. */
|
|
1111
1334
|
listTeams(opts?: {
|
|
@@ -1125,16 +1348,22 @@ export declare class LoomcycleClient {
|
|
|
1125
1348
|
}): Promise<TeamDefDetail>;
|
|
1126
1349
|
/** Author a new TeamDef (op=create). `overlay` is the workflow graph
|
|
1127
1350
|
* (`{entry, states, transitions, max_iterations?, colors?}`), validated
|
|
1128
|
-
* server-side — an invalid graph raises {@link SubstrateToolRefusedError}.
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1351
|
+
* server-side — an invalid graph raises {@link SubstrateToolRefusedError}.
|
|
1352
|
+
*
|
|
1353
|
+
* `opts.promote` and `opts.description` ride beside `signal`, as on
|
|
1354
|
+
* {@link LoomcycleClient.forkTeam}; each is sent only when set. Omitted,
|
|
1355
|
+
* the server promotes a create (unlike a fork); `promote: false` authors the
|
|
1356
|
+
* version without putting it in force. */
|
|
1357
|
+
createTeam(name: string, overlay: Record<string, unknown>, opts?: CreateTeamOptions): Promise<CreatedTeam>;
|
|
1132
1358
|
/** Save an edited graph as a NEW version of an existing team (op=fork). With
|
|
1133
|
-
* no
|
|
1134
|
-
* replaces it. Validated server-side ({@link SubstrateToolRefusedError}).
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1359
|
+
* no `parentDefId` the server forks the name's active def; `overlay` (a full
|
|
1360
|
+
* graph) replaces it. Validated server-side ({@link SubstrateToolRefusedError}).
|
|
1361
|
+
*
|
|
1362
|
+
* The fork's own fields ride in `opts` beside `signal` — the pattern
|
|
1363
|
+
* {@link LoomcycleClient.setRunBreakpoints} uses — so existing two- and
|
|
1364
|
+
* three-argument calls are unchanged. `promote: true` puts the new version
|
|
1365
|
+
* in force in the same call; omitted, it is authored but not active. */
|
|
1366
|
+
forkTeam(name: string, overlay: Record<string, unknown>, opts?: ForkTeamOptions): Promise<CreatedTeam>;
|
|
1138
1367
|
/** List every version of ONE team, newest first (op=list) — the lineage
|
|
1139
1368
|
* behind {@link LoomcycleClient.listTeams}' roll-up. Tenant-scoped
|
|
1140
1369
|
* server-side; a name with no versions returns an empty list rather than
|
|
@@ -1201,6 +1430,9 @@ export declare class LoomcycleClient {
|
|
|
1201
1430
|
}, opts?: {
|
|
1202
1431
|
signal?: AbortSignal;
|
|
1203
1432
|
}): Promise<TeamRunResult>;
|
|
1433
|
+
runTeam(target: TeamRunTarget, opts?: {
|
|
1434
|
+
signal?: AbortSignal;
|
|
1435
|
+
}): Promise<TeamRunResult | TeamRunDetached>;
|
|
1204
1436
|
/** Read the debug breakpoints armed on a live team walk
|
|
1205
1437
|
* (`GET /v1/runs/{run_id}/breakpoints`), and the review deadline its
|
|
1206
1438
|
* member holds get (`review_ttl_seconds`, 0 = none).
|
|
@@ -1335,6 +1567,69 @@ export declare class LoomcycleClient {
|
|
|
1335
1567
|
history(input: HistoryToolInput, opts?: {
|
|
1336
1568
|
signal?: AbortSignal;
|
|
1337
1569
|
}): Promise<HistoryToolResponse>;
|
|
1570
|
+
/** Invoke the Evaluation tool outside a run (`POST /v1/_evaluation`):
|
|
1571
|
+
* record scores against runs and read them back. Op-discriminated
|
|
1572
|
+
* (`submit` / `get` / `list_for_run` / `list_for_def` / `aggregate`); the
|
|
1573
|
+
* return type follows the op. The `*Evaluation*` methods below are the same
|
|
1574
|
+
* call with positional arguments.
|
|
1575
|
+
*
|
|
1576
|
+
* What a token may do: `substrate:tenant` every op, inside its own tenant;
|
|
1577
|
+
* admin every op, in every tenant; any other token (an isolated
|
|
1578
|
+
* `substrate:user`, a tenant member) `submit_self` only, which a call from
|
|
1579
|
+
* outside a run cannot use — it is not the run's agent — so each op is
|
|
1580
|
+
* refused. A token without `runs:read` gets a 403.
|
|
1581
|
+
*
|
|
1582
|
+
* Another tenant's evaluation or run reads exactly like one that does not
|
|
1583
|
+
* exist. Raises {@link SubstrateToolRefusedError} on a tool refusal (an
|
|
1584
|
+
* unknown id, an op the token may not use); {@link InvalidArgumentError}
|
|
1585
|
+
* on 400; {@link AuthError} on 401. */
|
|
1586
|
+
evaluation(input: EvaluationSubmitInput, opts?: {
|
|
1587
|
+
signal?: AbortSignal;
|
|
1588
|
+
}): Promise<EvaluationSubmitResult>;
|
|
1589
|
+
evaluation(input: EvaluationGetInput, opts?: {
|
|
1590
|
+
signal?: AbortSignal;
|
|
1591
|
+
}): Promise<EvaluationRecord>;
|
|
1592
|
+
evaluation(input: EvaluationListForRunInput, opts?: {
|
|
1593
|
+
signal?: AbortSignal;
|
|
1594
|
+
}): Promise<EvaluationListForRunResult>;
|
|
1595
|
+
evaluation(input: EvaluationListForDefInput, opts?: {
|
|
1596
|
+
signal?: AbortSignal;
|
|
1597
|
+
}): Promise<EvaluationListForDefResult>;
|
|
1598
|
+
evaluation(input: EvaluationAggregateInput, opts?: {
|
|
1599
|
+
signal?: AbortSignal;
|
|
1600
|
+
}): Promise<EvaluationAggregate>;
|
|
1601
|
+
evaluation(input: EvaluationInput, opts?: {
|
|
1602
|
+
signal?: AbortSignal;
|
|
1603
|
+
}): Promise<EvaluationSubmitResult | EvaluationRecord | EvaluationListForRunResult | EvaluationListForDefResult | EvaluationAggregate>;
|
|
1604
|
+
/** Record a score against a run — `evaluation({op:"submit"})`. Scores are
|
|
1605
|
+
* additive: a second submit records another evaluation. */
|
|
1606
|
+
submitEvaluation(runId: string, score: number, opts?: {
|
|
1607
|
+
dimensions?: Record<string, number>;
|
|
1608
|
+
judgement?: unknown;
|
|
1609
|
+
rationale?: string;
|
|
1610
|
+
signal?: AbortSignal;
|
|
1611
|
+
}): Promise<EvaluationSubmitResult>;
|
|
1612
|
+
/** One evaluation by id — `evaluation({op:"get"})`. */
|
|
1613
|
+
getEvaluation(evalId: string, opts?: {
|
|
1614
|
+
signal?: AbortSignal;
|
|
1615
|
+
}): Promise<EvaluationRecord>;
|
|
1616
|
+
/** Every evaluation of one run — `evaluation({op:"list_for_run"})`. */
|
|
1617
|
+
listEvaluationsForRun(runId: string, opts?: {
|
|
1618
|
+
limit?: number;
|
|
1619
|
+
signal?: AbortSignal;
|
|
1620
|
+
}): Promise<EvaluationListForRunResult>;
|
|
1621
|
+
/** Every evaluation of one definition version, in your tenant —
|
|
1622
|
+
* `evaluation({op:"list_for_def"})`. */
|
|
1623
|
+
listEvaluationsForDef(defId: string, opts?: {
|
|
1624
|
+
limit?: number;
|
|
1625
|
+
signal?: AbortSignal;
|
|
1626
|
+
}): Promise<EvaluationListForDefResult>;
|
|
1627
|
+
/** A definition's scores rolled up — `evaluation({op:"aggregate"})`.
|
|
1628
|
+
* `includeLineage` adds the ancestors' evaluations along parent_def_id. */
|
|
1629
|
+
aggregateEvaluations(defId: string, opts?: {
|
|
1630
|
+
includeLineage?: boolean;
|
|
1631
|
+
signal?: AbortSignal;
|
|
1632
|
+
}): Promise<EvaluationAggregate>;
|
|
1338
1633
|
/** List the PERSISTENT volume universe for the caller's tenant — every
|
|
1339
1634
|
* static volume (the shared bind floor, `source: "static"`, read-only)
|
|
1340
1635
|
* plus the tenant's own dynamic VolumeDefs (`source: "dynamic"`). Host
|
|
@@ -1593,11 +1888,11 @@ export declare class LoomcycleClient {
|
|
|
1593
1888
|
*
|
|
1594
1889
|
* v1.78.0 — `walkId` is a SERVER-side filter: only the runs one team
|
|
1595
1890
|
* walk spawned. A walk's own run_id IS its walk id, so a caller that
|
|
1596
|
-
* started a team with `
|
|
1891
|
+
* started a team with `mode: "detach"` passes back the handle it already
|
|
1597
1892
|
* holds and gets a live view of that workflow's agents:
|
|
1598
1893
|
*
|
|
1599
1894
|
* ```ts
|
|
1600
|
-
* const { run_id } = await client.runTeam({
|
|
1895
|
+
* const { run_id } = await client.runTeam({ name: "triage", mode: "detach" });
|
|
1601
1896
|
* for await (const item of client.streamUserRunStates(userId, { walkId: run_id })) {
|
|
1602
1897
|
* if (item.kind === "event") place(item.payload.parent_context?.wave_index);
|
|
1603
1898
|
* }
|
|
@@ -1614,6 +1909,43 @@ export declare class LoomcycleClient {
|
|
|
1614
1909
|
* "stream re-opened / closed" log entries without inferring
|
|
1615
1910
|
* from timing. Default false. */
|
|
1616
1911
|
streamUserRunStates(userId: string, opts?: StreamUserRunStatesOptions): AsyncIterable<RunStateStreamItem>;
|
|
1912
|
+
/** Tail the caller's tenant's MEMORY change feed (RFC CD Part C) — one
|
|
1913
|
+
* value-free coordinate per `memory.set` / `memory.delete` /
|
|
1914
|
+
* `memory.scope_deleted`. Mirrors `GET /v1/_memory/changes?since=<seq>`.
|
|
1915
|
+
*
|
|
1916
|
+
* The first item is always `{ kind: "feed", payload: ChangeFeedStatus }`,
|
|
1917
|
+
* then one `{ kind: "change", payload: MemoryChange }` per change, oldest
|
|
1918
|
+
* first. Pull the current value through the data API; the feed never
|
|
1919
|
+
* carries it.
|
|
1920
|
+
*
|
|
1921
|
+
* - The feed is EMPTY unless the server runs with
|
|
1922
|
+
* `LOOMCYCLE_MEMORY_CHANGES_ENABLED`. The stream still opens and idles,
|
|
1923
|
+
* so read `payload.enabled` on the feed frame instead of waiting.
|
|
1924
|
+
* - Scope is the caller's OWN tenant; there is no cross-tenant feed.
|
|
1925
|
+
* - Needs `substrate:tenant` (or admin). A tenant MEMBER's token is refused
|
|
1926
|
+
* — the feed exposes the tenant's write pattern, which is operator
|
|
1927
|
+
* observability, not member data.
|
|
1928
|
+
* - To resume after a disconnect, persist the last `payload.seq` you
|
|
1929
|
+
* processed and pass it back as `since`. A cursor older than the
|
|
1930
|
+
* server's change retention resumes past the pruned gap without saying
|
|
1931
|
+
* so.
|
|
1932
|
+
* - A `{ kind: "error", payload: ChangeFeedError }` item means the server
|
|
1933
|
+
* could not read its change log. It is NOT fatal and iteration
|
|
1934
|
+
* continues: the server retries with backoff without advancing its
|
|
1935
|
+
* cursor, so changes resume after recovery with no gap. One item per
|
|
1936
|
+
* failure streak.
|
|
1937
|
+
* - The stream has no end of its own: iteration ends when the server
|
|
1938
|
+
* closes it (shutdown — reconnect with `since`) or throws an
|
|
1939
|
+
* `AbortError` when `signal` aborts. */
|
|
1940
|
+
streamMemoryChanges(opts?: StreamChangesOptions): AsyncIterable<ChangeFeedFrame>;
|
|
1941
|
+
/** Tail the caller's tenant's DOCUMENT change feed (RFC CD Part C) — one
|
|
1942
|
+
* coordinate per `document.chunk.updated` / `document.chunk.deleted`,
|
|
1943
|
+
* naming the `chunk_id`. Mirrors `GET /v1/_document/changes?since=<seq>`.
|
|
1944
|
+
* Same frames, scope, auth and resume contract as
|
|
1945
|
+
* {@link LoomcycleClient.streamMemoryChanges}; a reader wanting both
|
|
1946
|
+
* families opens both. */
|
|
1947
|
+
streamDocumentChanges(opts?: StreamChangesOptions): AsyncIterable<ChangeFeedFrame>;
|
|
1948
|
+
private streamChangeFeed;
|
|
1617
1949
|
/** List credential METADATA for a scope (RFC AR) — never a secret value.
|
|
1618
1950
|
* `user` = your own subject's tokens (per-user, e.g. a personal Telegram bot
|
|
1619
1951
|
* token); `tenant` = shared across the tenant (operator authority). RFC CN: a
|
|
@@ -1624,11 +1956,43 @@ export declare class LoomcycleClient {
|
|
|
1624
1956
|
}): Promise<CredentialListResponse>;
|
|
1625
1957
|
/** Store or rotate a credential (RFC AR). The plaintext `value` is write-only:
|
|
1626
1958
|
* the server encrypts it, masks it from the transcript, and never returns it.
|
|
1627
|
-
* Returns the stored row's metadata. Mirrors `POST /v1/_credentialdef {op:create}`.
|
|
1959
|
+
* Returns the stored row's metadata. Mirrors `POST /v1/_credentialdef {op:create}`.
|
|
1960
|
+
*
|
|
1961
|
+
* `allowed_urls` restricts where the value may be sent: https URLs, each
|
|
1962
|
+
* covering itself and everything under it. `[]` stores a value that is
|
|
1963
|
+
* sent nowhere. Leave it out for no restriction, or, when the credential
|
|
1964
|
+
* already exists, to keep the list it has. A restricted credential is used
|
|
1965
|
+
* only where the destination is known and covered (an MCP server's or a
|
|
1966
|
+
* hook's header, a remote peer's key, a git source), never as a provider
|
|
1967
|
+
* key.
|
|
1968
|
+
*
|
|
1969
|
+
* `username` is the user name sent with the value where a destination
|
|
1970
|
+
* takes one (HTTP basic auth for a git source). Leave it out to keep the
|
|
1971
|
+
* stored one; `""` removes it.
|
|
1972
|
+
*
|
|
1973
|
+
* `expires_at` is an RFC3339 timestamp (`"2026-12-31T00:00:00Z"`) stored
|
|
1974
|
+
* with the credential and reported back in its metadata; any other format
|
|
1975
|
+
* is refused. `backend` is where the value is kept: `"inline"` (encrypted
|
|
1976
|
+
* in loomcycle's own store, the default) is the only one accepted. */
|
|
1628
1977
|
createCredential(input: {
|
|
1629
1978
|
scope: CredentialScope;
|
|
1630
1979
|
name: string;
|
|
1631
1980
|
value: string;
|
|
1981
|
+
allowed_urls?: string[];
|
|
1982
|
+
username?: string;
|
|
1983
|
+
expires_at?: string;
|
|
1984
|
+
backend?: "inline";
|
|
1985
|
+
}, opts?: {
|
|
1986
|
+
signal?: AbortSignal;
|
|
1987
|
+
}): Promise<CredentialMeta>;
|
|
1988
|
+
/** Read ONE credential's metadata (RFC AR) — never its value. Answers
|
|
1989
|
+
* whether a name is stored, and its `allowed_urls` / `username` /
|
|
1990
|
+
* `expires_at`, without listing the whole scope. An absent name raises
|
|
1991
|
+
* {@link SubstrateToolRefusedError}. Mirrors
|
|
1992
|
+
* `POST /v1/_credentialdef {op:get}`. */
|
|
1993
|
+
getCredential(input: {
|
|
1994
|
+
scope: CredentialScope;
|
|
1995
|
+
name: string;
|
|
1632
1996
|
}, opts?: {
|
|
1633
1997
|
signal?: AbortSignal;
|
|
1634
1998
|
}): Promise<CredentialMeta>;
|