@loomcycle/client 1.111.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 +287 -29
- package/dist/cjs/client.js +647 -20
- package/dist/cjs/errors.js +119 -15
- package/dist/cjs/fetch-helpers.js +39 -8
- package/dist/cjs/index.js +55 -8
- package/dist/cjs/interactive.js +5 -1
- package/dist/cjs/signature.js +119 -0
- package/dist/client.d.ts +494 -30
- package/dist/client.js +647 -20
- 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 +53 -9
- package/dist/index.js +51 -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 +1315 -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
|
|
@@ -312,6 +330,36 @@ export declare class LoomcycleClient {
|
|
|
312
330
|
reason?: string;
|
|
313
331
|
signal?: AbortSignal;
|
|
314
332
|
}): Promise<CompactRunResult>;
|
|
333
|
+
/** Permanently delete a run and every run it spawned, with what is stored
|
|
334
|
+
* about them: transcripts, their sessions when no other run is left in
|
|
335
|
+
* them, interrupts, evaluations of them, queued memory rows and indexed
|
|
336
|
+
* turns. The usage ledger (tokens, cost) is kept. Mirrors
|
|
337
|
+
* `DELETE /v1/runs/{run_id}/tree`.
|
|
338
|
+
*
|
|
339
|
+
* Needs the `runs:delete` scope (an admin and a tenant operator have it;
|
|
340
|
+
* any other token only if it was granted at mint) — a token without it
|
|
341
|
+
* raises `LoomcycleError` with status 403. A run that does not exist, was
|
|
342
|
+
* already deleted, or is not yours to read resolves with `deleted_runs: 0`
|
|
343
|
+
* rather than raising, so repeating the call is safe. A tree holding a run
|
|
344
|
+
* that is still running, awaiting input or paused deletes nothing and
|
|
345
|
+
* raises `LoomcycleError` with `code: "run_tree_live"` (status 409): cancel
|
|
346
|
+
* it first. `not_reached` names where a copy may remain that this call
|
|
347
|
+
* cannot remove. To discard a configured run that never started, use
|
|
348
|
+
* {@link LoomcycleClient.deleteConfiguredRun}. */
|
|
349
|
+
deleteRunTree(runId: string, opts?: {
|
|
350
|
+
signal?: AbortSignal;
|
|
351
|
+
}): Promise<RunTreeDeletion>;
|
|
352
|
+
/** Permanently delete every run of a session, each with the runs it
|
|
353
|
+
* spawned — {@link LoomcycleClient.deleteRunTree} for all of them at once.
|
|
354
|
+
* `cascade: "children"` is required and is the only mode: there is no
|
|
355
|
+
* delete that leaves sub-agent runs behind. Mirrors
|
|
356
|
+
* `DELETE /v1/sessions/{session_id}?cascade=children`. Same scope, same
|
|
357
|
+
* zero-count answer for a session you cannot read, same `run_tree_live`
|
|
358
|
+
* refusal. */
|
|
359
|
+
deleteSession(sessionId: string, opts: {
|
|
360
|
+
cascade: "children";
|
|
361
|
+
signal?: AbortSignal;
|
|
362
|
+
}): Promise<RunTreeDeletion>;
|
|
315
363
|
/**
|
|
316
364
|
* Replay a session's transcript into a NEW session bound to a (possibly
|
|
317
365
|
* different) target agent, so that agent continues from the same context
|
|
@@ -383,22 +431,21 @@ export declare class LoomcycleClient {
|
|
|
383
431
|
reason?: string;
|
|
384
432
|
signal?: AbortSignal;
|
|
385
433
|
}): Promise<CancelAgentResult>;
|
|
386
|
-
/** List a user's recent agent runs, optionally filtered by
|
|
387
|
-
* `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.
|
|
388
442
|
*
|
|
389
443
|
* v0.9.x — `parentAgentId` narrows the result CLIENT-SIDE to runs
|
|
390
444
|
* whose `parent_agent_id` matches. The server still returns the
|
|
391
445
|
* full set (server-side `?parent_agent_id=` filter is a future
|
|
392
446
|
* request); the adapter trims before returning. Useful for the
|
|
393
447
|
* n8n trigger pattern "show me all sub-runs spawned by parent X." */
|
|
394
|
-
listUserAgents(userId: string, opts?:
|
|
395
|
-
status?: AgentStatus | "all";
|
|
396
|
-
parentAgentId?: string;
|
|
397
|
-
/** Super-admin tenant-focus (?tenant=, RFC L v0.17.0). Ignored
|
|
398
|
-
* server-side for a tenant principal — its own tenant is forced. */
|
|
399
|
-
tenant?: string;
|
|
400
|
-
signal?: AbortSignal;
|
|
401
|
-
}): Promise<Agent[]>;
|
|
448
|
+
listUserAgents(userId: string, opts?: ListUserAgentsOptions): Promise<AgentList>;
|
|
402
449
|
/** One page of a team walk's runs — the walk's own run (its run id IS the
|
|
403
450
|
* walk id) and every member it spawned, oldest first. The walk's own row
|
|
404
451
|
* carries its `result` (with the `terminal` it reached); member rows do
|
|
@@ -478,6 +525,38 @@ export declare class LoomcycleClient {
|
|
|
478
525
|
tenant?: string;
|
|
479
526
|
signal?: AbortSignal;
|
|
480
527
|
}): Promise<void>;
|
|
528
|
+
/** The timed no-trace overrides in force: agents whose runs are being
|
|
529
|
+
* stored although they normally store none. An admin sees every tenant's
|
|
530
|
+
* (or one with `tenant`); a tenant operator sees its own. Mirrors
|
|
531
|
+
* `GET /v1/_retention/overrides`. */
|
|
532
|
+
listRetentionOverrides(opts?: {
|
|
533
|
+
/** Admin-only tenant focus; ignored for a tenant operator. */
|
|
534
|
+
tenant?: string;
|
|
535
|
+
signal?: AbortSignal;
|
|
536
|
+
}): Promise<{
|
|
537
|
+
overrides: RetentionOverride[];
|
|
538
|
+
}>;
|
|
539
|
+
/** Store the runs of one no-trace agent until `until`, to debug it. At
|
|
540
|
+
* most 24 hours ahead; setting one replaces the last. It lifts a mode
|
|
541
|
+
* that came from the agent's definition or the run request, never one a
|
|
542
|
+
* token requires. Audited. `tenant` is admin-only: a tenant operator's
|
|
543
|
+
* override is always for its own tenant. Mirrors
|
|
544
|
+
* `PUT /v1/_retention/overrides`. */
|
|
545
|
+
setRetentionOverride(body: {
|
|
546
|
+
agent: string;
|
|
547
|
+
until: string | Date;
|
|
548
|
+
tenant?: string;
|
|
549
|
+
}, opts?: {
|
|
550
|
+
signal?: AbortSignal;
|
|
551
|
+
}): Promise<RetentionOverride>;
|
|
552
|
+
/** End an agent's no-trace override before it runs out. Clearing one that
|
|
553
|
+
* is not there is not an error. Mirrors
|
|
554
|
+
* `DELETE /v1/_retention/overrides`. */
|
|
555
|
+
clearRetentionOverride(agent: string, opts?: {
|
|
556
|
+
/** Admin-only target tenant; ignored for a tenant operator. */
|
|
557
|
+
tenant?: string;
|
|
558
|
+
signal?: AbortSignal;
|
|
559
|
+
}): Promise<void>;
|
|
481
560
|
/** Ask a decision model typed questions (`choice` / `noul` / `score`) about
|
|
482
561
|
* `state` and get each answer with its probabilities. A decision model does
|
|
483
562
|
* not write: there is no reply to parse and the call costs a few output
|
|
@@ -544,9 +623,47 @@ export declare class LoomcycleClient {
|
|
|
544
623
|
* scopes are DERIVED server-side from the member's access_mode (never sent),
|
|
545
624
|
* and the plaintext `token` is returned exactly ONCE — store it now, it is
|
|
546
625
|
* never retrievable again. 404 for an unknown/cross-tenant subject; 409 for
|
|
547
|
-
* a disabled user.
|
|
626
|
+
* a disabled user.
|
|
627
|
+
*
|
|
628
|
+
* `ttlSeconds` gives the token a fixed lifetime: it stops authenticating
|
|
629
|
+
* when that runs out, and the answer carries `expires_at`. It cannot run
|
|
630
|
+
* past the end of the token making the call. `name` labels it (stored as
|
|
631
|
+
* `u-<name>`).
|
|
632
|
+
* `maxActive` keeps at most that many of the user's tokens alive — the
|
|
633
|
+
* oldest beyond it are retired at once and listed in `retired`.
|
|
634
|
+
*
|
|
635
|
+
* `agents` limits the token to starting those agents as top-level runs, and
|
|
636
|
+
* to the run endpoints: it is refused everywhere else (403
|
|
637
|
+
* `restricted_token`), and refused any other agent (403
|
|
638
|
+
* `agent_not_allowed`). An agent that a listed one spawns is not limited.
|
|
639
|
+
* An empty list is refused; omit the option for no limit.
|
|
640
|
+
*
|
|
641
|
+
* `overrides` locks the per-run settings for runs the token starts, and
|
|
642
|
+
* for retunes it makes: `"none"` locks them all (model, provider, tier,
|
|
643
|
+
* effort, sampling, limits, output format and the rest), a list names the
|
|
644
|
+
* ones it may still set. A request that sets a locked one is refused with
|
|
645
|
+
* 403 `override_not_allowed`.
|
|
646
|
+
*
|
|
647
|
+
* `rate` bounds how often the token may start runs: `perMinute` runs a
|
|
648
|
+
* minute, with `burst` allowed at once from idle (default: `perMinute`).
|
|
649
|
+
* A start past the rate is refused with 429 `rate_limited` and a
|
|
650
|
+
* `Retry-After` header.
|
|
651
|
+
*
|
|
652
|
+
* With none of the options the request has no body, as before. */
|
|
548
653
|
mintUserToken(subject: string, opts?: {
|
|
549
654
|
signal?: AbortSignal;
|
|
655
|
+
ttlSeconds?: number;
|
|
656
|
+
name?: string;
|
|
657
|
+
maxActive?: number;
|
|
658
|
+
agents?: string[];
|
|
659
|
+
overrides?: "none" | string[];
|
|
660
|
+
rate?: {
|
|
661
|
+
perMinute: number;
|
|
662
|
+
burst?: number;
|
|
663
|
+
};
|
|
664
|
+
/** `"none"`: every run the token starts is a no-trace run, whatever
|
|
665
|
+
* the request or the agent says. */
|
|
666
|
+
retention?: "none";
|
|
550
667
|
}): Promise<MintedUserToken>;
|
|
551
668
|
/** List the caller's own user's delegated tokens — METADATA ONLY (never the
|
|
552
669
|
* plaintext or hash). `active` applies the auth-layer validity rule so a
|
|
@@ -606,6 +723,38 @@ export declare class LoomcycleClient {
|
|
|
606
723
|
resolveProbe(opts?: {
|
|
607
724
|
signal?: AbortSignal;
|
|
608
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>;
|
|
609
758
|
/** Capture running-state into a per-section-semver JSON envelope.
|
|
610
759
|
* Raises SnapshotTooLargeError on 413 when the envelope exceeds
|
|
611
760
|
* LOOMCYCLE_SNAPSHOT_MAX_BYTES (default 512 MiB). */
|
|
@@ -896,10 +1045,29 @@ export declare class LoomcycleClient {
|
|
|
896
1045
|
* Raises {@link SubstrateToolRefusedError} on tool-level refusals
|
|
897
1046
|
* (static-name collision, missing required credential, invalid
|
|
898
1047
|
* cron, etc.); {@link InvalidArgumentError} on 400 (malformed
|
|
899
|
-
* JSON); {@link AuthError} on 401.
|
|
900
|
-
|
|
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?: {
|
|
901
1056
|
signal?: AbortSignal;
|
|
902
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>;
|
|
903
1071
|
/** Invoke the v1.x RFC G A2AServerCardDef substrate tool over HTTP.
|
|
904
1072
|
* Author + fork + retire A2A server-card definitions at runtime.
|
|
905
1073
|
* Mirror of {@link LoomcycleClient.scheduleDef} for A2A server cards.
|
|
@@ -941,10 +1109,29 @@ export declare class LoomcycleClient {
|
|
|
941
1109
|
*
|
|
942
1110
|
* Raises {@link SubstrateToolRefusedError} on tool-level refusals;
|
|
943
1111
|
* {@link InvalidArgumentError} on 400 (malformed JSON);
|
|
944
|
-
* {@link AuthError} on 401.
|
|
945
|
-
|
|
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?: {
|
|
946
1119
|
signal?: AbortSignal;
|
|
947
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>;
|
|
948
1135
|
/** Invoke the RFC I MR-3a MemoryBackendDef substrate tool over HTTP.
|
|
949
1136
|
* Author + fork + retire named memory backend definitions at runtime.
|
|
950
1137
|
* Mirror of {@link LoomcycleClient.webhookDef} for memory backends.
|
|
@@ -973,10 +1160,51 @@ export declare class LoomcycleClient {
|
|
|
973
1160
|
* matches, its body (code-js or a webhook URL), fail mode and timeout.
|
|
974
1161
|
* Tenant-confined like agentDef. A HookDef fires on nothing by itself; an
|
|
975
1162
|
* agent definition, a team definition or a run names it. Mirrors
|
|
976
|
-
* POST /v1/_hookdef.
|
|
977
|
-
|
|
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?: {
|
|
978
1173
|
signal?: AbortSignal;
|
|
979
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>;
|
|
980
1208
|
/** OperatorTokenDef substrate ops (create/rotate/retire/get/list) —
|
|
981
1209
|
* RFC L OSS multi-tenant authorization. Operator-admin only. The
|
|
982
1210
|
* token plaintext is returned ONCE in the create/rotate response.
|
|
@@ -1006,6 +1234,101 @@ export declare class LoomcycleClient {
|
|
|
1006
1234
|
volumeDef(input: SubstrateToolInput, opts?: {
|
|
1007
1235
|
signal?: AbortSignal;
|
|
1008
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>;
|
|
1009
1332
|
/** List every team the caller may see (GET /v1/_teamdef/names), each with its
|
|
1010
1333
|
* version roll-up. Tenant-scoped server-side. `names` is `null` when empty. */
|
|
1011
1334
|
listTeams(opts?: {
|
|
@@ -1025,16 +1348,22 @@ export declare class LoomcycleClient {
|
|
|
1025
1348
|
}): Promise<TeamDefDetail>;
|
|
1026
1349
|
/** Author a new TeamDef (op=create). `overlay` is the workflow graph
|
|
1027
1350
|
* (`{entry, states, transitions, max_iterations?, colors?}`), validated
|
|
1028
|
-
* server-side — an invalid graph raises {@link SubstrateToolRefusedError}.
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
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>;
|
|
1032
1358
|
/** Save an edited graph as a NEW version of an existing team (op=fork). With
|
|
1033
|
-
* no
|
|
1034
|
-
* replaces it. Validated server-side ({@link SubstrateToolRefusedError}).
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
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>;
|
|
1038
1367
|
/** List every version of ONE team, newest first (op=list) — the lineage
|
|
1039
1368
|
* behind {@link LoomcycleClient.listTeams}' roll-up. Tenant-scoped
|
|
1040
1369
|
* server-side; a name with no versions returns an empty list rather than
|
|
@@ -1101,6 +1430,9 @@ export declare class LoomcycleClient {
|
|
|
1101
1430
|
}, opts?: {
|
|
1102
1431
|
signal?: AbortSignal;
|
|
1103
1432
|
}): Promise<TeamRunResult>;
|
|
1433
|
+
runTeam(target: TeamRunTarget, opts?: {
|
|
1434
|
+
signal?: AbortSignal;
|
|
1435
|
+
}): Promise<TeamRunResult | TeamRunDetached>;
|
|
1104
1436
|
/** Read the debug breakpoints armed on a live team walk
|
|
1105
1437
|
* (`GET /v1/runs/{run_id}/breakpoints`), and the review deadline its
|
|
1106
1438
|
* member holds get (`review_ttl_seconds`, 0 = none).
|
|
@@ -1235,6 +1567,69 @@ export declare class LoomcycleClient {
|
|
|
1235
1567
|
history(input: HistoryToolInput, opts?: {
|
|
1236
1568
|
signal?: AbortSignal;
|
|
1237
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>;
|
|
1238
1633
|
/** List the PERSISTENT volume universe for the caller's tenant — every
|
|
1239
1634
|
* static volume (the shared bind floor, `source: "static"`, read-only)
|
|
1240
1635
|
* plus the tenant's own dynamic VolumeDefs (`source: "dynamic"`). Host
|
|
@@ -1493,11 +1888,11 @@ export declare class LoomcycleClient {
|
|
|
1493
1888
|
*
|
|
1494
1889
|
* v1.78.0 — `walkId` is a SERVER-side filter: only the runs one team
|
|
1495
1890
|
* walk spawned. A walk's own run_id IS its walk id, so a caller that
|
|
1496
|
-
* started a team with `
|
|
1891
|
+
* started a team with `mode: "detach"` passes back the handle it already
|
|
1497
1892
|
* holds and gets a live view of that workflow's agents:
|
|
1498
1893
|
*
|
|
1499
1894
|
* ```ts
|
|
1500
|
-
* const { run_id } = await client.runTeam({
|
|
1895
|
+
* const { run_id } = await client.runTeam({ name: "triage", mode: "detach" });
|
|
1501
1896
|
* for await (const item of client.streamUserRunStates(userId, { walkId: run_id })) {
|
|
1502
1897
|
* if (item.kind === "event") place(item.payload.parent_context?.wave_index);
|
|
1503
1898
|
* }
|
|
@@ -1514,6 +1909,43 @@ export declare class LoomcycleClient {
|
|
|
1514
1909
|
* "stream re-opened / closed" log entries without inferring
|
|
1515
1910
|
* from timing. Default false. */
|
|
1516
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;
|
|
1517
1949
|
/** List credential METADATA for a scope (RFC AR) — never a secret value.
|
|
1518
1950
|
* `user` = your own subject's tokens (per-user, e.g. a personal Telegram bot
|
|
1519
1951
|
* token); `tenant` = shared across the tenant (operator authority). RFC CN: a
|
|
@@ -1524,11 +1956,43 @@ export declare class LoomcycleClient {
|
|
|
1524
1956
|
}): Promise<CredentialListResponse>;
|
|
1525
1957
|
/** Store or rotate a credential (RFC AR). The plaintext `value` is write-only:
|
|
1526
1958
|
* the server encrypts it, masks it from the transcript, and never returns it.
|
|
1527
|
-
* 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. */
|
|
1528
1977
|
createCredential(input: {
|
|
1529
1978
|
scope: CredentialScope;
|
|
1530
1979
|
name: string;
|
|
1531
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;
|
|
1532
1996
|
}, opts?: {
|
|
1533
1997
|
signal?: AbortSignal;
|
|
1534
1998
|
}): Promise<CredentialMeta>;
|