@loomcycle/client 1.144.0 → 1.145.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 +23 -0
- package/dist/cjs/client.js +43 -0
- package/dist/client.d.ts +48 -1
- package/dist/client.js +43 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +67 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -865,6 +865,29 @@ const meta = await client.getCredential({ scope: "user", name: "GIT_TOKEN" });
|
|
|
865
865
|
console.log(meta.allowed_urls ?? "unrestricted");
|
|
866
866
|
```
|
|
867
867
|
|
|
868
|
+
### OAuth credentials
|
|
869
|
+
|
|
870
|
+
An **OAuth credential** (`usage: "oauth"`) holds a connection to an OAuth-protected server, such as a remote MCP server. Its owner connects it once by approving a code in a browser (the OAuth device grant); loomcycle then refreshes the access token itself and sends it wherever config names `$oauth:<name>`. No call returns an access token, a refresh token or the device code. These calls are made outside a run: `scope: "user"` is your own connection, `scope: "tenant"` needs `substrate:tenant`. `getCredential` / `listCredentials` report the `oauth` block too; `deleteCredential` revokes the grant (best effort) and removes it. See `docs/CREDENTIALS.md`, "Connecting through OAuth".
|
|
871
|
+
|
|
872
|
+
| Method | Returns | Notes |
|
|
873
|
+
|---|---|---|
|
|
874
|
+
| `createOAuthCredential({ scope, name, oauth, allowed_urls? })` | `Promise<CredentialMeta>` | `oauth` is `{ resource, issuer?, scopes?, client?: { token_endpoint_auth? } }` (`OAuthCredentialConfig`); `resource` is the server's https URL. Starts `pending_connect`. Create-only: delete and create again to change it. `{op: "create", usage: "oauth"}`. |
|
|
875
|
+
| `oauthConnectStart({ scope, name })` | `Promise<OAuthConnectStart>` | `{ user_code, verification_uri, verification_uri_complete?, expires_in, interval, status: "pending_connect" }`. Show the person the URI and code. `{op: "oauth_connect_start"}`. |
|
|
876
|
+
| `oauthConnectStatus({ scope, name })` | `Promise<CredentialMeta>` | `oauth.state` (`pending_connect` / `connected` / `needs_reauth` / `revoked`), `oauth.connected_as`, `oauth.access_expires_at`, `oauth.last_error`. Poll every `interval` seconds while connecting. `{op: "oauth_connect_status"}`. |
|
|
877
|
+
| `oauthDisconnect({ scope, name })` | `Promise<CredentialMeta>` | Revokes the grant (best effort) and clears it; `oauth.state` becomes `revoked`. `{op: "oauth_disconnect"}`. |
|
|
878
|
+
|
|
879
|
+
```ts
|
|
880
|
+
await client.createOAuthCredential({ scope: "user", name: "docs-server", oauth: { resource: "https://docs.example.com/mcp" } });
|
|
881
|
+
const start = await client.oauthConnectStart({ scope: "user", name: "docs-server" });
|
|
882
|
+
console.log(`Open ${start.verification_uri} and enter ${start.user_code}`);
|
|
883
|
+
const deadline = Date.now() + start.expires_in * 1000;
|
|
884
|
+
let meta = await client.oauthConnectStatus({ scope: "user", name: "docs-server" });
|
|
885
|
+
while (meta.oauth?.state === "pending_connect" && Date.now() < deadline) {
|
|
886
|
+
await new Promise((r) => setTimeout(r, start.interval * 1000));
|
|
887
|
+
meta = await client.oauthConnectStatus({ scope: "user", name: "docs-server" });
|
|
888
|
+
}
|
|
889
|
+
```
|
|
890
|
+
|
|
868
891
|
### Crypto keys + the Crypto tool (RFC EP)
|
|
869
892
|
|
|
870
893
|
A **crypto key** is a credential with `usage: "crypto"`: a `key_type` fixed for its life, numbered versions, and a `min_version` below which versions are retired. No call ever returns key material. `getCredential` / `listCredentials` report a crypto key's `usage`, `key_type`, `current_version`, `min_version` and `versions` (`{version, created_at, retired}`).
|
package/dist/cjs/client.js
CHANGED
|
@@ -3764,6 +3764,49 @@ class LoomcycleClient {
|
|
|
3764
3764
|
async deleteCredential(input, opts) {
|
|
3765
3765
|
return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_credentialdef", { op: "delete", ...input }, opts);
|
|
3766
3766
|
}
|
|
3767
|
+
// ── OAuth credentials ────────────────────────────────────────────────────
|
|
3768
|
+
//
|
|
3769
|
+
// An OAuth credential holds a connection to an OAuth-protected server (an
|
|
3770
|
+
// MCP server, say): its owner connects it once by approving a code in a
|
|
3771
|
+
// browser, and loomcycle refreshes the access token itself wherever config
|
|
3772
|
+
// names it as `$oauth:<name>`. None of these calls returns a token, a
|
|
3773
|
+
// refresh token or the device code. They are made outside a run. Scope
|
|
3774
|
+
// `user` is the caller's own; `tenant` needs `substrate:tenant`. Read one
|
|
3775
|
+
// with `getCredential`, delete one (its grant is revoked first, best
|
|
3776
|
+
// effort) with `deleteCredential`. All post to `POST /v1/_credentialdef`.
|
|
3777
|
+
/** Create an OAuth credential for the protected resource `oauth.resource`
|
|
3778
|
+
* (an https URL). It starts as `pending_connect`; connect it with
|
|
3779
|
+
* {@link oauthConnectStart}. Create-only: to change it, delete and create
|
|
3780
|
+
* it again. `allowed_urls` defaults to `[resource]`. Mirrors
|
|
3781
|
+
* `{op:create, usage:"oauth"}`. */
|
|
3782
|
+
async createOAuthCredential(input, opts) {
|
|
3783
|
+
return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_credentialdef", { op: "create", usage: "oauth", ...input }, opts);
|
|
3784
|
+
}
|
|
3785
|
+
/** Start connecting an OAuth credential (the OAuth device grant). Show the
|
|
3786
|
+
* person `verification_uri` (or `verification_uri_complete`) and
|
|
3787
|
+
* `user_code`; once they approve, the server finishes the connect on its
|
|
3788
|
+
* own. Poll {@link oauthConnectStatus} every `interval` seconds until
|
|
3789
|
+
* `oauth.state` is `connected`, or until `expires_in` passes. A second
|
|
3790
|
+
* start supersedes the first, and on a connected credential drops the
|
|
3791
|
+
* current grant until the new one is approved. Mirrors
|
|
3792
|
+
* `{op:oauth_connect_start}`. */
|
|
3793
|
+
async oauthConnectStart(input, opts) {
|
|
3794
|
+
return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_credentialdef", { op: "oauth_connect_start", ...input }, opts);
|
|
3795
|
+
}
|
|
3796
|
+
/** An OAuth credential's state (`oauth.state`), the account it is
|
|
3797
|
+
* connected as, when its access token expires and the last error. A
|
|
3798
|
+
* check also finishes a connect the server lost track of across a
|
|
3799
|
+
* restart. Mirrors `{op:oauth_connect_status}`. */
|
|
3800
|
+
async oauthConnectStatus(input, opts) {
|
|
3801
|
+
return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_credentialdef", { op: "oauth_connect_status", ...input }, opts);
|
|
3802
|
+
}
|
|
3803
|
+
/** Disconnect an OAuth credential: revoke the grant at the server (best
|
|
3804
|
+
* effort) and clear it here; `oauth.state` becomes `revoked`. The
|
|
3805
|
+
* credential and its client registration stay, ready for the next
|
|
3806
|
+
* {@link oauthConnectStart}. Mirrors `{op:oauth_disconnect}`. */
|
|
3807
|
+
async oauthDisconnect(input, opts) {
|
|
3808
|
+
return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_credentialdef", { op: "oauth_disconnect", ...input }, opts);
|
|
3809
|
+
}
|
|
3767
3810
|
// ── Crypto keys (RFC EP) ─────────────────────────────────────────────────
|
|
3768
3811
|
//
|
|
3769
3812
|
// A crypto key is a credential with usage "crypto": a key type fixed at
|
package/dist/client.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { InteractiveSession } from "./interactive.js";
|
|
27
27
|
import { LoomcycleOAuth } from "./oauth.js";
|
|
28
28
|
import { ClientToolHost, type ConnectClientToolsOptions } from "./client-tools.js";
|
|
29
|
-
import type { ChangeFeedFrame, StreamChangesOptions, DocumentFeedFrame, DocumentFeedOptions, CredentialListResponse, CredentialMeta, CryptoKeyEncoding, CryptoKeyExport, CryptoKeyExternal, CryptoKeyType, CryptoRequest, CryptoResultByOp, DecideRequest, DecideResponse, DecisionModelsResponse, SpeechOptions, SpeechResult, TranscribeOptions, TranscribeResult, SpeechInfo, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, MergeSubjectsResult, ReviewQueueFilter, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, ListRulingsResult, ApplyReviewPolicyResult, BindSubjectPrincipalResult, Agent, AgentEvent, AgentList, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RunFileInput, RunInboxDownload, 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, TokenSurface, ListUserTokensResponse, UserIdentitiesResponse, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentitiesResponse, GateTenantStatus, 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, DocumentCopyInput, DocumentMoveInput, DocumentFindDuplicatesInput, DocumentFindDuplicatesResult, DocumentTransferResult, HistoryToolInput, HistoryToolResponse, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationAggregate, TranscriptResponse, WhoamiResponse, UsageDimension, UsageBucket, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest, AclBinding, AclBindingListResponse, AclCatalog, AclDefInput, AclDefListResponse, AclDefNamesResponse, AclDefRow, AclRule, AclValidateResult, AuthzDecision, AuthzEvaluationRequest, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzExplainResponse, AuthzSimulateRequest, AuthzSimulateResponse, CreateAclBindingBody, CreateGroupBody, GroupDetail, GroupEffective, GroupListResponse, GroupMemberChange, GroupMemberKind, GroupRow, AppClientConfig, AppClientEntry, ClientDefInput, ClientDefListResponse, ClientDefNamesResponse, ClientDefRecord, ClientDefRetireResult, ClientDefVerifyResult, DeviceLoginOptions, DeviceLoginResult } from "./types.js";
|
|
29
|
+
import type { ChangeFeedFrame, StreamChangesOptions, DocumentFeedFrame, DocumentFeedOptions, CredentialListResponse, CredentialMeta, OAuthConnectStart, OAuthCredentialConfig, CryptoKeyEncoding, CryptoKeyExport, CryptoKeyExternal, CryptoKeyType, CryptoRequest, CryptoResultByOp, DecideRequest, DecideResponse, DecisionModelsResponse, SpeechOptions, SpeechResult, TranscribeOptions, TranscribeResult, SpeechInfo, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, MergeSubjectsResult, ReviewQueueFilter, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, ListRulingsResult, ApplyReviewPolicyResult, BindSubjectPrincipalResult, Agent, AgentEvent, AgentList, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RunFileInput, RunInboxDownload, 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, TokenSurface, ListUserTokensResponse, UserIdentitiesResponse, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentitiesResponse, GateTenantStatus, 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, DocumentCopyInput, DocumentMoveInput, DocumentFindDuplicatesInput, DocumentFindDuplicatesResult, DocumentTransferResult, HistoryToolInput, HistoryToolResponse, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationAggregate, TranscriptResponse, WhoamiResponse, UsageDimension, UsageBucket, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest, AclBinding, AclBindingListResponse, AclCatalog, AclDefInput, AclDefListResponse, AclDefNamesResponse, AclDefRow, AclRule, AclValidateResult, AuthzDecision, AuthzEvaluationRequest, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzExplainResponse, AuthzSimulateRequest, AuthzSimulateResponse, CreateAclBindingBody, CreateGroupBody, GroupDetail, GroupEffective, GroupListResponse, GroupMemberChange, GroupMemberKind, GroupRow, AppClientConfig, AppClientEntry, ClientDefInput, ClientDefListResponse, ClientDefNamesResponse, ClientDefRecord, ClientDefRetireResult, ClientDefVerifyResult, DeviceLoginOptions, DeviceLoginResult } from "./types.js";
|
|
30
30
|
export declare class LoomcycleClient {
|
|
31
31
|
private ctx;
|
|
32
32
|
private readonly tokenProvider?;
|
|
@@ -2656,6 +2656,53 @@ export declare class LoomcycleClient {
|
|
|
2656
2656
|
scope: string;
|
|
2657
2657
|
deleted: boolean;
|
|
2658
2658
|
}>;
|
|
2659
|
+
/** Create an OAuth credential for the protected resource `oauth.resource`
|
|
2660
|
+
* (an https URL). It starts as `pending_connect`; connect it with
|
|
2661
|
+
* {@link oauthConnectStart}. Create-only: to change it, delete and create
|
|
2662
|
+
* it again. `allowed_urls` defaults to `[resource]`. Mirrors
|
|
2663
|
+
* `{op:create, usage:"oauth"}`. */
|
|
2664
|
+
createOAuthCredential(input: {
|
|
2665
|
+
scope: CredentialScope;
|
|
2666
|
+
name: string;
|
|
2667
|
+
oauth: OAuthCredentialConfig;
|
|
2668
|
+
allowed_urls?: string[];
|
|
2669
|
+
}, opts?: {
|
|
2670
|
+
signal?: AbortSignal;
|
|
2671
|
+
}): Promise<CredentialMeta>;
|
|
2672
|
+
/** Start connecting an OAuth credential (the OAuth device grant). Show the
|
|
2673
|
+
* person `verification_uri` (or `verification_uri_complete`) and
|
|
2674
|
+
* `user_code`; once they approve, the server finishes the connect on its
|
|
2675
|
+
* own. Poll {@link oauthConnectStatus} every `interval` seconds until
|
|
2676
|
+
* `oauth.state` is `connected`, or until `expires_in` passes. A second
|
|
2677
|
+
* start supersedes the first, and on a connected credential drops the
|
|
2678
|
+
* current grant until the new one is approved. Mirrors
|
|
2679
|
+
* `{op:oauth_connect_start}`. */
|
|
2680
|
+
oauthConnectStart(input: {
|
|
2681
|
+
scope: CredentialScope;
|
|
2682
|
+
name: string;
|
|
2683
|
+
}, opts?: {
|
|
2684
|
+
signal?: AbortSignal;
|
|
2685
|
+
}): Promise<OAuthConnectStart>;
|
|
2686
|
+
/** An OAuth credential's state (`oauth.state`), the account it is
|
|
2687
|
+
* connected as, when its access token expires and the last error. A
|
|
2688
|
+
* check also finishes a connect the server lost track of across a
|
|
2689
|
+
* restart. Mirrors `{op:oauth_connect_status}`. */
|
|
2690
|
+
oauthConnectStatus(input: {
|
|
2691
|
+
scope: CredentialScope;
|
|
2692
|
+
name: string;
|
|
2693
|
+
}, opts?: {
|
|
2694
|
+
signal?: AbortSignal;
|
|
2695
|
+
}): Promise<CredentialMeta>;
|
|
2696
|
+
/** Disconnect an OAuth credential: revoke the grant at the server (best
|
|
2697
|
+
* effort) and clear it here; `oauth.state` becomes `revoked`. The
|
|
2698
|
+
* credential and its client registration stay, ready for the next
|
|
2699
|
+
* {@link oauthConnectStart}. Mirrors `{op:oauth_disconnect}`. */
|
|
2700
|
+
oauthDisconnect(input: {
|
|
2701
|
+
scope: CredentialScope;
|
|
2702
|
+
name: string;
|
|
2703
|
+
}, opts?: {
|
|
2704
|
+
signal?: AbortSignal;
|
|
2705
|
+
}): Promise<CredentialMeta>;
|
|
2659
2706
|
/** Make a new crypto key nobody ever sees: the server generates the
|
|
2660
2707
|
* material. Version 1 is current. Mirrors `{op:generate}`. A name another
|
|
2661
2708
|
* reachable scope already uses for a crypto key is refused
|
package/dist/client.js
CHANGED
|
@@ -3761,6 +3761,49 @@ export class LoomcycleClient {
|
|
|
3761
3761
|
async deleteCredential(input, opts) {
|
|
3762
3762
|
return postJSON(this.ctx, "/v1/_credentialdef", { op: "delete", ...input }, opts);
|
|
3763
3763
|
}
|
|
3764
|
+
// ── OAuth credentials ────────────────────────────────────────────────────
|
|
3765
|
+
//
|
|
3766
|
+
// An OAuth credential holds a connection to an OAuth-protected server (an
|
|
3767
|
+
// MCP server, say): its owner connects it once by approving a code in a
|
|
3768
|
+
// browser, and loomcycle refreshes the access token itself wherever config
|
|
3769
|
+
// names it as `$oauth:<name>`. None of these calls returns a token, a
|
|
3770
|
+
// refresh token or the device code. They are made outside a run. Scope
|
|
3771
|
+
// `user` is the caller's own; `tenant` needs `substrate:tenant`. Read one
|
|
3772
|
+
// with `getCredential`, delete one (its grant is revoked first, best
|
|
3773
|
+
// effort) with `deleteCredential`. All post to `POST /v1/_credentialdef`.
|
|
3774
|
+
/** Create an OAuth credential for the protected resource `oauth.resource`
|
|
3775
|
+
* (an https URL). It starts as `pending_connect`; connect it with
|
|
3776
|
+
* {@link oauthConnectStart}. Create-only: to change it, delete and create
|
|
3777
|
+
* it again. `allowed_urls` defaults to `[resource]`. Mirrors
|
|
3778
|
+
* `{op:create, usage:"oauth"}`. */
|
|
3779
|
+
async createOAuthCredential(input, opts) {
|
|
3780
|
+
return postJSON(this.ctx, "/v1/_credentialdef", { op: "create", usage: "oauth", ...input }, opts);
|
|
3781
|
+
}
|
|
3782
|
+
/** Start connecting an OAuth credential (the OAuth device grant). Show the
|
|
3783
|
+
* person `verification_uri` (or `verification_uri_complete`) and
|
|
3784
|
+
* `user_code`; once they approve, the server finishes the connect on its
|
|
3785
|
+
* own. Poll {@link oauthConnectStatus} every `interval` seconds until
|
|
3786
|
+
* `oauth.state` is `connected`, or until `expires_in` passes. A second
|
|
3787
|
+
* start supersedes the first, and on a connected credential drops the
|
|
3788
|
+
* current grant until the new one is approved. Mirrors
|
|
3789
|
+
* `{op:oauth_connect_start}`. */
|
|
3790
|
+
async oauthConnectStart(input, opts) {
|
|
3791
|
+
return postJSON(this.ctx, "/v1/_credentialdef", { op: "oauth_connect_start", ...input }, opts);
|
|
3792
|
+
}
|
|
3793
|
+
/** An OAuth credential's state (`oauth.state`), the account it is
|
|
3794
|
+
* connected as, when its access token expires and the last error. A
|
|
3795
|
+
* check also finishes a connect the server lost track of across a
|
|
3796
|
+
* restart. Mirrors `{op:oauth_connect_status}`. */
|
|
3797
|
+
async oauthConnectStatus(input, opts) {
|
|
3798
|
+
return postJSON(this.ctx, "/v1/_credentialdef", { op: "oauth_connect_status", ...input }, opts);
|
|
3799
|
+
}
|
|
3800
|
+
/** Disconnect an OAuth credential: revoke the grant at the server (best
|
|
3801
|
+
* effort) and clear it here; `oauth.state` becomes `revoked`. The
|
|
3802
|
+
* credential and its client registration stay, ready for the next
|
|
3803
|
+
* {@link oauthConnectStart}. Mirrors `{op:oauth_disconnect}`. */
|
|
3804
|
+
async oauthDisconnect(input, opts) {
|
|
3805
|
+
return postJSON(this.ctx, "/v1/_credentialdef", { op: "oauth_disconnect", ...input }, opts);
|
|
3806
|
+
}
|
|
3764
3807
|
// ── Crypto keys (RFC EP) ─────────────────────────────────────────────────
|
|
3765
3808
|
//
|
|
3766
3809
|
// A crypto key is a credential with usage "crypto": a key type fixed at
|
package/dist/index.d.ts
CHANGED
|
@@ -219,5 +219,5 @@ export { ClientToolHost, clientToolsURL, CLIENT_TOOL_SUBPROTOCOL } from "./clien
|
|
|
219
219
|
export type { ClientToolSchema, ClientToolInvocation, ConnectClientToolsOptions, WebSocketLike, WebSocketCtor, } from "./client-tools.js";
|
|
220
220
|
export { LoomcycleOAuth, OAuthTokenProvider, parseAuthorizeResponse, pkceChallenge } from "./oauth.js";
|
|
221
221
|
export type { LoomcycleOAuthOptions, OAuthTokenProviderOptions } from "./oauth.js";
|
|
222
|
-
export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, RunOverrideOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, ListUserAgentsOptions, AgentList, WalkRunsPage, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, RunTreeDeletion, RunTreeNotReached, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureAccess, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, MergeSubjectsResult, SubjectRef, BindSubjectPrincipalResult, ReviewQueueFilter, ReviewQueueGroup, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, RulingBreakdown, RulingItem, RulingSelector, RulingRecord, ListRulingsResult, PolicyRuleCount, ApplyReviewPolicyResult, ErasureBoundSubject, ErasureTokenRef, CancelTurnResult, ReviewRunResult, ReplaySessionResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserStatus, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenRestrictions, TokenSurface, UserTokenMeta, ListUserTokensResponse, UserIdentity, UserIdentitiesResponse, AuthGateKind, AuthGate, AuthGateKey, AuthGateRemoval, AuthGateProbe, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteState, AuthInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentity, GateIdentitiesResponse, GateTenantStatus, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, WhoamiEffective, WhoamiAuth, PauseResult, RetentionOverride, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchDocumentFilter, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, CreateTeamOptions, ForkTeamOptions, DefNameSummary, DefNamesResponse, OperatorTokenDefNameSummary, OperatorTokenDefNamesResponse, ScheduleListEntry, ScheduleListResponse, ScheduleActiveRun, ScheduleStateView, ScheduleRunNowResult, SchedulePauseResult, ModelAlias, ModelAliasesResponse, RoutingResponse, RoutingUserTier, RoutingTier, RoutingCandidate, RoutingThroughput, RoutingProvider, SearchRoutingProvider, RoutingEmbedder, RoutingDecision, RoutingDecisionModel, ProviderModelsResponse, TeamRunStep, TeamDecisionHandler, TeamDecisionQuestion, TeamDecisionAnswer, PathToolInput, PathToolResponse, DocumentToolInput, DocumentEdgeEvidence, DocumentToolResponse, DocumentCopyInput, DocumentMoveInput, DocumentTransferEntry, DocumentTransferResult, DocumentFindDuplicatesInput, DocumentDuplicatePair, DocumentFindDuplicatesResult, DocumentSearchFilter, DocumentSearchHit, DocumentSearchResult, DocumentRelatedResult, GraphSnapshot, HistoryToolInput, HistoryToolResponse, EvaluationEmitterRole, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationScoreStats, EvaluationAggregate, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, ChangeFeedError, ChangeFeedFrame, ChangeFeedStatus, EmbedderHealth, MemoryChange, MemoryChangeScope, MemoryChangeType, StreamChangesOptions, DocumentFeedChange, DocumentFeedChangeType, DocumentFeedFrame, DocumentFeedOptions, DocumentFeedStatus, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, AgentRouting, AgentChannelACL, AgentInterruptionACL, AgentDecision, MemoryRerank, AgentSampling, AgentCompaction, AgentTranscription, AgentSpeech, AgentContext, TierCandidate, CoreBlock, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, EnsureCodeAgentOptions, EnsureCodeAgentResult, CreateDefOptions, ForkDefOptions, EnsureHookDefOptions, EnsureHookDefResult, HookDefBody, HookDefForkOverlay, HookDefInput, HookDefMatch, HookDefOverlay, HookDefRowResponse, HookDefVerifyResult, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, ScheduledRunHook, ScheduledRunPromptContent, ScheduledRunPromptSegment, WebhookDefAuth, WebhookDefFilter, WebhookDefInput, WebhookDefOverlay, WebhookDefRateLimit, WebhookDefRowResponse, WebhookDefDeliveries, WebhookDefSyncResponse, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageBucket, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, FileCapturedInfo, TranscriptionInfo, AdmissionInfo, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, OverrideInfo, FallbackInfo, InterruptionEventInfo, SpawnChildInfo, TurnCancelledInfo, ChannelEventInfo, ContextCompactionInfo, ContextRecapInfo, ContextStateInfo, ContextExhaustedInfo, ContextTierVerdict, ContextDistillDeclinedInfo, EffectiveConfigResponse, RunFileInput, RunFileImportSource, RunFileExtractStructure, RunFileImportHeading, RunInboxDownload, EffectiveConfigSource, EffectiveValue, InertContextSetting, AgentOverridableResponse, OverridableField, OverrideLockReason, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, CryptoKeyVersion, CryptoKeyExport, CryptoKeyType, CryptoKeyEncoding, CryptoKeyBackend, CryptoKeyExternal, CryptoOp, CryptoRequestBase, CryptoKeyRef, CryptoEncryptRequest, CryptoDecryptRequest, CryptoRewrapRequest, CryptoMacRequest, CryptoVerifyMacRequest, CryptoSignRequest, CryptoVerifyRequest, CryptoPublicKeyRequest, CryptoTotpRequest, CryptoHashRequest, CryptoRandomRequest, CryptoHashPasswordRequest, CryptoVerifyPasswordRequest, CryptoRequest, CryptoEncryptResult, CryptoDecryptResult, CryptoRewrapResult, CryptoMacResult, CryptoVerifyResult, CryptoSignResult, CryptoPublicJWK, CryptoPublicKeyResult, CryptoTotpResult, CryptoHashResult, CryptoRandomResult, CryptoHashPasswordResult, CryptoVerifyPasswordResult, CryptoResultByOp, CryptoResult, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, SpeechFormat, SpeechOptions, SpeechResult, TranscribeOptions, TranscribeResult, TranscriptSegment, SpeechInfo, SpeechDirectionInfo, SpeechLanguageInfo, TranscriptionDirectionInfo, AclMode, AclSource, AclEffect, AclSubjectKind, AclCondition, AclRule, AclList, AclDefRow, AclDefListResponse, AclDefNamesResponse, AclValidateResult, AclCatalogType, AclCatalog, AclDefOp, AclDefInput, GroupRow, GroupMemberKind, GroupMember, GroupListResponse, GroupDetail, GroupEffective, CreateGroupBody, GroupMemberChange, AclBinding, AclBindingListResponse, CreateAclBindingBody, AuthzReason, AuthzDecision, AuthzRequestContext, AuthzEvaluationRequest, AuthzEvaluationsSemantic, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzTrace, AuthzAppliedBinding, AuthzExplainResponse, AuthzDraftBinding, AuthzSimulateRequest, AuthzSimulateResult, AuthzSimulateResponse, OAuthServerMetadata, OAuthTokenResponse, OAuthTokenSet, BeginAuthorizeOptions, AuthorizeRequest, AuthorizeResponseParams, CompleteAuthorizeOptions, RefreshTokenOptions, RevokeTokenOptions, TokenProvider, AppClientRefresh, AppClientConfig, ClientDefInput, ClientDefRecord, ConfigAppClient, AppClientEntry, ClientDefListResponse, ClientDefVerifyResult, ClientDefRetireResult, ClientDefNameSummary, ClientDefNamesResponse, DeviceLoginPrompt, DeviceLoginOptions, DeviceLoginResult, } from "./types.js";
|
|
222
|
+
export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, RunOverrideOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, ListUserAgentsOptions, AgentList, WalkRunsPage, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, RunTreeDeletion, RunTreeNotReached, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureAccess, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, MergeSubjectsResult, SubjectRef, BindSubjectPrincipalResult, ReviewQueueFilter, ReviewQueueGroup, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, RulingBreakdown, RulingItem, RulingSelector, RulingRecord, ListRulingsResult, PolicyRuleCount, ApplyReviewPolicyResult, ErasureBoundSubject, ErasureTokenRef, CancelTurnResult, ReviewRunResult, ReplaySessionResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserStatus, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenRestrictions, TokenSurface, UserTokenMeta, ListUserTokensResponse, UserIdentity, UserIdentitiesResponse, AuthGateKind, AuthGate, AuthGateKey, AuthGateRemoval, AuthGateProbe, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteState, AuthInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentity, GateIdentitiesResponse, GateTenantStatus, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, WhoamiEffective, WhoamiAuth, PauseResult, RetentionOverride, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchDocumentFilter, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, CreateTeamOptions, ForkTeamOptions, DefNameSummary, DefNamesResponse, OperatorTokenDefNameSummary, OperatorTokenDefNamesResponse, ScheduleListEntry, ScheduleListResponse, ScheduleActiveRun, ScheduleStateView, ScheduleRunNowResult, SchedulePauseResult, ModelAlias, ModelAliasesResponse, RoutingResponse, RoutingUserTier, RoutingTier, RoutingCandidate, RoutingThroughput, RoutingProvider, SearchRoutingProvider, RoutingEmbedder, RoutingDecision, RoutingDecisionModel, ProviderModelsResponse, TeamRunStep, TeamDecisionHandler, TeamDecisionQuestion, TeamDecisionAnswer, PathToolInput, PathToolResponse, DocumentToolInput, DocumentEdgeEvidence, DocumentToolResponse, DocumentCopyInput, DocumentMoveInput, DocumentTransferEntry, DocumentTransferResult, DocumentFindDuplicatesInput, DocumentDuplicatePair, DocumentFindDuplicatesResult, DocumentSearchFilter, DocumentSearchHit, DocumentSearchResult, DocumentRelatedResult, GraphSnapshot, HistoryToolInput, HistoryToolResponse, EvaluationEmitterRole, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationScoreStats, EvaluationAggregate, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, ChangeFeedError, ChangeFeedFrame, ChangeFeedStatus, EmbedderHealth, MemoryChange, MemoryChangeScope, MemoryChangeType, StreamChangesOptions, DocumentFeedChange, DocumentFeedChangeType, DocumentFeedFrame, DocumentFeedOptions, DocumentFeedStatus, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, AgentRouting, AgentChannelACL, AgentInterruptionACL, AgentDecision, MemoryRerank, AgentSampling, AgentCompaction, AgentTranscription, AgentSpeech, AgentContext, TierCandidate, CoreBlock, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, EnsureCodeAgentOptions, EnsureCodeAgentResult, CreateDefOptions, ForkDefOptions, EnsureHookDefOptions, EnsureHookDefResult, HookDefBody, HookDefForkOverlay, HookDefInput, HookDefMatch, HookDefOverlay, HookDefRowResponse, HookDefVerifyResult, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, ScheduledRunHook, ScheduledRunPromptContent, ScheduledRunPromptSegment, WebhookDefAuth, WebhookDefFilter, WebhookDefInput, WebhookDefOverlay, WebhookDefRateLimit, WebhookDefRowResponse, WebhookDefDeliveries, WebhookDefSyncResponse, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageBucket, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, FileCapturedInfo, TranscriptionInfo, AdmissionInfo, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, OverrideInfo, FallbackInfo, InterruptionEventInfo, SpawnChildInfo, TurnCancelledInfo, ChannelEventInfo, ContextCompactionInfo, ContextRecapInfo, ContextStateInfo, ContextExhaustedInfo, ContextTierVerdict, ContextDistillDeclinedInfo, EffectiveConfigResponse, RunFileInput, RunFileImportSource, RunFileExtractStructure, RunFileImportHeading, RunInboxDownload, EffectiveConfigSource, EffectiveValue, InertContextSetting, AgentOverridableResponse, OverridableField, OverrideLockReason, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, OAuthConnectStart, OAuthCredentialConfig, OAuthCredentialState, OAuthCredentialStatus, OAuthTokenEndpointAuth, CredentialListResponse, CryptoKeyVersion, CryptoKeyExport, CryptoKeyType, CryptoKeyEncoding, CryptoKeyBackend, CryptoKeyExternal, CryptoOp, CryptoRequestBase, CryptoKeyRef, CryptoEncryptRequest, CryptoDecryptRequest, CryptoRewrapRequest, CryptoMacRequest, CryptoVerifyMacRequest, CryptoSignRequest, CryptoVerifyRequest, CryptoPublicKeyRequest, CryptoTotpRequest, CryptoHashRequest, CryptoRandomRequest, CryptoHashPasswordRequest, CryptoVerifyPasswordRequest, CryptoRequest, CryptoEncryptResult, CryptoDecryptResult, CryptoRewrapResult, CryptoMacResult, CryptoVerifyResult, CryptoSignResult, CryptoPublicJWK, CryptoPublicKeyResult, CryptoTotpResult, CryptoHashResult, CryptoRandomResult, CryptoHashPasswordResult, CryptoVerifyPasswordResult, CryptoResultByOp, CryptoResult, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, SpeechFormat, SpeechOptions, SpeechResult, TranscribeOptions, TranscribeResult, TranscriptSegment, SpeechInfo, SpeechDirectionInfo, SpeechLanguageInfo, TranscriptionDirectionInfo, AclMode, AclSource, AclEffect, AclSubjectKind, AclCondition, AclRule, AclList, AclDefRow, AclDefListResponse, AclDefNamesResponse, AclValidateResult, AclCatalogType, AclCatalog, AclDefOp, AclDefInput, GroupRow, GroupMemberKind, GroupMember, GroupListResponse, GroupDetail, GroupEffective, CreateGroupBody, GroupMemberChange, AclBinding, AclBindingListResponse, CreateAclBindingBody, AuthzReason, AuthzDecision, AuthzRequestContext, AuthzEvaluationRequest, AuthzEvaluationsSemantic, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzTrace, AuthzAppliedBinding, AuthzExplainResponse, AuthzDraftBinding, AuthzSimulateRequest, AuthzSimulateResult, AuthzSimulateResponse, OAuthServerMetadata, OAuthTokenResponse, OAuthTokenSet, BeginAuthorizeOptions, AuthorizeRequest, AuthorizeResponseParams, CompleteAuthorizeOptions, RefreshTokenOptions, RevokeTokenOptions, TokenProvider, AppClientRefresh, AppClientConfig, ClientDefInput, ClientDefRecord, ConfigAppClient, AppClientEntry, ClientDefListResponse, ClientDefVerifyResult, ClientDefRetireResult, ClientDefNameSummary, ClientDefNamesResponse, DeviceLoginPrompt, DeviceLoginOptions, DeviceLoginResult, } from "./types.js";
|
|
223
223
|
export { AclDeniedError, AgentIDInUseError, AgentNotFoundError, AlreadyPausingError, AuthError, BackpressureError, DeviceLoginError, NotFoundError, InsufficientScopeError, InvalidArgumentError, ChannelCursorRegressionError, LoomcycleError, NotPausedError, OAuthError, PauseNotConfiguredError, PerUserQuotaExhaustedError, PromptTooLargeError, RateLimitedError, RequestTooLargeError, SessionBusyError, SessionNotFoundError, SnapshotNotFoundError, SnapshotTooLargeError, SnapshotVersionError, SubstrateToolRefusedError, TokenLimitExceededError, UnavailableError, } from "./errors.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -6692,9 +6692,13 @@ export interface CredentialMeta {
|
|
|
6692
6692
|
/** Present with `expires_at`: true once that time has passed. An expired
|
|
6693
6693
|
* credential is kept so it can be seen and rotated, but resolves nowhere. */
|
|
6694
6694
|
expired?: boolean;
|
|
6695
|
-
/** `"crypto"` for a key the Crypto tool uses (RFC EP)
|
|
6696
|
-
*
|
|
6697
|
-
|
|
6695
|
+
/** `"crypto"` for a key the Crypto tool uses (RFC EP), `"oauth"` for an
|
|
6696
|
+
* OAuth connection (then `oauth` is set); absent for an ordinary secret.
|
|
6697
|
+
* The crypto fields below are present only for a crypto key. */
|
|
6698
|
+
usage?: "crypto" | "oauth";
|
|
6699
|
+
/** An OAuth credential's config and connection state. Never a token, a
|
|
6700
|
+
* device code or a client secret. */
|
|
6701
|
+
oauth?: OAuthCredentialStatus;
|
|
6698
6702
|
/** The crypto key's type, fixed for its life. */
|
|
6699
6703
|
key_type?: CryptoKeyType;
|
|
6700
6704
|
/** The external KMS holding the key; absent for a key held by loomcycle.
|
|
@@ -6716,6 +6720,66 @@ export interface CryptoKeyVersion {
|
|
|
6716
6720
|
created_at: string;
|
|
6717
6721
|
retired: boolean;
|
|
6718
6722
|
}
|
|
6723
|
+
/** Where an OAuth credential's connection stands. `pending_connect`: created,
|
|
6724
|
+
* or a connect started and not yet approved. `connected`: usable as
|
|
6725
|
+
* `$oauth:<name>`. `needs_reauth`: the grant failed (or a snapshot restored
|
|
6726
|
+
* it without one); its owner connects it again. `revoked`: disconnected. */
|
|
6727
|
+
export type OAuthCredentialState = "pending_connect" | "connected" | "needs_reauth" | "revoked";
|
|
6728
|
+
/** How loomcycle authenticates to the authorization server's token endpoint. */
|
|
6729
|
+
export type OAuthTokenEndpointAuth = "none" | "client_secret_basic" | "client_secret_post";
|
|
6730
|
+
/** The `oauth` object of {@link LoomcycleClient.createOAuthCredential}. */
|
|
6731
|
+
export interface OAuthCredentialConfig {
|
|
6732
|
+
/** The protected resource: the MCP server's https URL. The authorization
|
|
6733
|
+
* server is discovered from it. */
|
|
6734
|
+
resource: string;
|
|
6735
|
+
/** The authorization server to use when the resource lists more than one. */
|
|
6736
|
+
issuer?: string;
|
|
6737
|
+
/** Scopes to ask for. */
|
|
6738
|
+
scopes?: string[];
|
|
6739
|
+
client?: {
|
|
6740
|
+
/** Only `"dynamic"` (dynamic client registration) is accepted. */
|
|
6741
|
+
registration?: "dynamic";
|
|
6742
|
+
/** Default `"none"`. */
|
|
6743
|
+
token_endpoint_auth?: OAuthTokenEndpointAuth;
|
|
6744
|
+
};
|
|
6745
|
+
}
|
|
6746
|
+
/** {@link CredentialMeta.oauth}: an OAuth credential's config and state.
|
|
6747
|
+
* Timestamps are RFC3339. */
|
|
6748
|
+
export interface OAuthCredentialStatus {
|
|
6749
|
+
resource: string;
|
|
6750
|
+
registration: string;
|
|
6751
|
+
state: OAuthCredentialState;
|
|
6752
|
+
issuer?: string;
|
|
6753
|
+
scopes?: string[];
|
|
6754
|
+
token_endpoint_auth?: string;
|
|
6755
|
+
/** The account the grant belongs to, for display only. Empty when the
|
|
6756
|
+
* server names none. */
|
|
6757
|
+
connected_as?: string;
|
|
6758
|
+
connected_at?: string;
|
|
6759
|
+
last_refresh_at?: string;
|
|
6760
|
+
/** When the current access token expires; loomcycle refreshes it itself. */
|
|
6761
|
+
access_expires_at?: string;
|
|
6762
|
+
/** Why the last connect or refresh failed. Never carries a token. */
|
|
6763
|
+
last_error?: string;
|
|
6764
|
+
}
|
|
6765
|
+
/** What {@link LoomcycleClient.oauthConnectStart} returns: the code a person
|
|
6766
|
+
* approves (OAuth device grant). It holds no token and no device code. */
|
|
6767
|
+
export interface OAuthConnectStart {
|
|
6768
|
+
name: string;
|
|
6769
|
+
scope: string;
|
|
6770
|
+
status: "pending_connect";
|
|
6771
|
+
/** The code to enter at `verification_uri`. */
|
|
6772
|
+
user_code: string;
|
|
6773
|
+
verification_uri: string;
|
|
6774
|
+
/** `verification_uri` with the code filled in, when the server gives one. */
|
|
6775
|
+
verification_uri_complete?: string;
|
|
6776
|
+
/** Seconds until the code expires. */
|
|
6777
|
+
expires_in: number;
|
|
6778
|
+
/** Seconds between status checks. */
|
|
6779
|
+
interval: number;
|
|
6780
|
+
/** A human-readable next step. */
|
|
6781
|
+
next?: string;
|
|
6782
|
+
}
|
|
6719
6783
|
/** CredentialListResponse is the {op:list} result: metadata for the given scope. */
|
|
6720
6784
|
export interface CredentialListResponse {
|
|
6721
6785
|
scope: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcycle/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.145.0",
|
|
4
4
|
"description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 71 methods covering run streaming, agent metadata, pause/resume/state, resolver re-probe (resolveProbe — issue #88 operator escape hatch), operator-token admin (operatorTokenDef — RFC L OSS multi-tenant auth) + whoami (RFC L authoritative principal, v0.17.0) + tenant-scoped listUsers / listUserAgents, dynamic MCP registration (mcpServerDef + v0.18.0 typed mcpServerDefVerify + ensureMcpServer idempotent register-if-changed), snapshot lifecycle, memory admin (incl. v0.9.0 Vector Memory embed_stats + reembed AND v0.11.5 setMemoryEntry + deleteMemoryEntry), interruption resolve, hook management, v0.8.22 substrate admin (agentDef + skillDef), v0.9.x n8n Phase 0 (listChannels + streamUserRunStates), v0.9.x Channel CRUD (publishChannel + subscribeChannel + peekChannel + ackChannel), v0.11.5 Channel admin CRUD (createChannel + updateChannel + deleteChannel — runtime substrate; yaml channels refuse mutation with HTTP 409), v0.9.x content_sha256 verify, v0.9.1 transcript first-cycle, v0.9.x dynamic MCP server registration (mcpServerDef + MCPServerDefVerifyResult), v0.10.3 Library v2 enumeration (listLibraryAgents + listLibrarySkills + listLibraryMcpServers), and v0.11.0 LLM Gateway (llmChat + llmStream — direct provider routing without agent overhead; primary target is n8n's LoomCycleChatModel AI Agent sub-node and any LangChain-compatible consumer). v0.10.1 — dual ESM + CommonJS distribution (additive — ESM consumers unchanged; CJS consumers like n8n's community-node loader now work). v0.19.0 — typed inline code-js agent ingestion (AgentDefOverlay.code_body + ensureCodeAgent — register a deterministic code agent through the substrate with no host filesystem bind; RFC J). v0.20.0 — ensureMcpServer surfaces discoveredToolCount straight from create (loomcycle now auto-discovers MCP tools at ingestion); rediscover is now an explicit force-refresh. v0.21.0 — run/continue accept optional non-secret `metadata` (repo name, review policy, …) passed to the agent, symmetric with the WebHook/Schedule trigger paths. v0.22.0 — version-aligned lockstep release; no client-surface change (RFC N tenant isolation of the agent/skill/MCP/Schedule/Webhook definition plane + real op-schemas on the builtin MCP meta-tools are both server-side). v0.23.0 — version-aligned lockstep release; no client-surface change (RFCs O/P/R MCP-server hardening + thin client and the RFC Q DeepSeek tool-content fix are all server-side / MCP-transport-side). v0.24.0 — purgeChannel clears a channel's buffered messages without deleting its definition (allowed on yaml-declared channels too, unlike deleteChannel — F20); AgentDefOverlay gains channels / evaluation_scopes / interruption so a COMPLETE interactive/multi-agent agent round-trips over the substrate (F14). (Consolidates the interim 0.24/0.25 package bumps, which were never tag-published, back into lockstep with the loomcycle v0.24.0 tag.) v0.25.0 — adds the RFC S channel fan-in/fan-out client twins: awaitChannels() (wait for any/all/at_least N messages across channels, or a timeout — non-committing) + broadcastChannels() (publish one payload to N channels in one atomic-pre-flight call), the client-facing counterparts of the in-band Channel.await / Channel.broadcast tool ops (the rest of v0.25.0 — the manual-management Web UI console + Context op=time + max_fires self-retiring schedules — is server-side / in-band, no client-surface change). v0.29.1 — Usage gains optional `max_context_tokens` (the serving model's context-window ceiling, stamped by the loop from Provider.Capabilities() on each usage event) so a consumer can render a 'context used / max' gauge without a hard-coded per-model table; additive + optional, no behavior change. (Lockstep catch-up: the field landed in loomcycle v0.29.0 but the adapter publish skipped on a version mismatch; v0.29.1 realigns the package version with the release tag so it publishes.) v0.33.0 — gRPC + TS client parity for the RFC Y external fan-out and the compaction surface: spawnRunBatch() (POST /v1/runs:batch — spawn up to 32 fresh runs concurrently in one call, combined index-aligned envelope, per-child failures in-envelope) + compactRun(runId) (POST /v1/runs/{run_id}/compact — summarize a parked run's context); plus per-run sampling + compaction overrides now accepted on runStreaming / continueSession (an explicit temperature 0 is preserved as deterministic, not dropped as falsy). (The gRPC half adds the matching SpawnRunBatch / CompactRun RPCs + the sampling/compaction fields on RunRequest/ContinueRequest — server-side.) v0.34.0 — version-aligned lockstep release; no client-surface change (context-transform plugins / RFC Z Phase 1a are server-side config; the exp7 hardening pass is server-side; the R2 cross-provider thinking-model downgrade surfaces a new `model_downgraded` SSE event the generic stream passes through unchanged). v0.35.0 — RFC AH dynamic filesystem volumes: volumeDef() (POST /v1/_volumedef — op-discriminated create/get/list/delete/purge; a Volume is flat, so delete unmaps + purge RemoveAll's, no retire/promote/fork) + listVolumes() / listEphemeralVolumes() (GET /v1/_volumes[/ephemeral] — tenant-scoped; host paths redacted for non-operator callers). Tenant-confined; the runtime derives the path inside an operator-blessed dynamic_root, so callers pass name + mode, never a host path. v1.1.1 — RFC AI interactive agentic sessions: an `interactive: true` flag on runStreaming/continueSession (a run that parks at end_turn for steering) + sendRunInput(runId, text) (POST /v1/runs/{id}/input — steer a live run) + streamRunByID(runId, {fromSeq}) (GET /v1/runs/{id}/stream — re-attach by run_id; the operator's prior turns replay as `steer` events so a cold client reconstructs the whole conversation) + a high-level InteractiveSession driver (client.interactiveSession / attachInteractiveSession — events()/send()/cancel(), the adapter port of the Web UI run terminal). The AgentEvent union gains awaiting_input/steer/context_compaction frames. Version-aligned with the loomcycle v1.1.x line so the v1.1.1 tag publishes it (also carrying the previously-unpublished v0.35.0 volume surface). v1.4.0 — RFC AL Path VFS + RFC AK Document on the wire: path(input) (POST /v1/_path — a Unix-like filesystem over Memory/Volumes/Documents; resolve/ls/stat/mkdir/mv/rm) + document(input) (POST /v1/_document — chunked-graph documents; 13 ops, needs SQL Memory on the sidecar). Scope (agent/user/tenant) + tenant are resolved server-side from the authenticated principal, never the wire; an off-run scope:'user' op keys on the principal subject so it interoperates with that user's agent runs. New PathToolInput / DocumentToolInput types; responses are op-varying (unknown — narrow as needed). v1.7.0 — RFC AT image/vision input: the PromptContent union gains an `image` variant ({ type:'image'; media_type: ImageMediaType; data: base64-no-prefix }) accepted in a user segment by runStreaming / continueSession (segments pass through unchanged — no method change). The model must be vision-capable or the run errors before the call. New ImageMediaType type (image/png|jpeg|gif|webp). v1.12.1 — Path/Document browse-by-subject + the full Document op set (RFC AS/AK): path(input, opts) / document(input, opts) accept optional scopeId / tenant browse overrides sent as ?scope_id= / ?tenant= query params (server reads them from the URL, re-checks authorization; omit both to browse your own subject — byte-identical to the pre-RFC-AS request), and DocumentToolInput.op now covers all 16 backend ops (adds set_path, export_md, import_md) with the matching include_metadata / markdown fields. Additive — existing path() / document() callers are unchanged. v1.16.0 — RFC BC client-executed tools (local tool host): connectClientTools({tools,onInvoke}) opens a persistent WebSocket to /v1/client-tools, registers tools this client runs on the user's machine (browser DOM / files / shell), and answers the invoke frames loomcycle routes when an agent of your principal calls a client:<tool> — returning your reply as an ordinary tool result. Returns a ClientToolHost driver (.close() to stop; auto-reconnect); dependency-free (global WebSocket in browsers / Node 22+, or an injected WebSocketImpl like the ws package on older Node); the bearer rides the Sec-WebSocket-Protocol subprotocol (browsers can't set an Authorization header on a WebSocket). The runtime's first WebSocket surface. v1.45.0 — RFC BL P5 subject erasure: erasureReport(subject, {tenant}) (GET /v1/_erasure — what this deployment holds about one subject, in three tiers: deletable with existing primitives, subject-keyed but not deletable, and facts ABOUT the subject in scopes they do not own) + erasureExecute(subject, {dryRun, confirm, tenant}) (POST /v1/_erasure — removes tiers 1 and 2). DEFAULTS TO A DRY RUN: dryRun defaults true and a live run also requires confirm === subject. The tier-3 residue is traceable only through the subject's chats, which a live run deletes, so a report afterwards shows rows: 0 while those facts remain — the returned object is the only durable record of what was not reached; persist it. New ErasureReport / ErasureResult / ErasureTier / ErasureResidue types. v1.47.0 — RFC BV memory-view SDK: memorySearch() (POST /v1/_memory/search — off-run unified semantic search spanning k/v entries AND document-chunk bodies in one ranked list, each hit tagged kind memory|document with chunk_id on document hits) + memoryEmbedStats(scope) + reembedMemory(scope, scopeId, {dryRun,limit}) (the Vector Memory embed-admin reads the memory-view console needs; dry_run defaults true). Fact reads (list_facts + get_chunk's entity block) ride the existing document() passthrough. Additive — existing callers unchanged. v1.61.0 — RFC CJ per-run context-window override: runStreaming / continueSession accept an optional maxContextTokens (integer tokens) that wins over the agent's own max_context_tokens; omitted inherits it (which defers to the provider/driver default). Distinct from a model's output cap; primarily for local inference (Ollama num_ctx). Serialized as the snake_case max_context_tokens field on POST /v1/runs + the continuation body; additive, existing callers unchanged. v1.72.1 — the TeamDef version lifecycle: listTeamVersions(name) (op=list — every version of one team, newest first), promoteTeam(defId) (op=promote — point the active pointer, which is what a run BY NAME executes; forkTeam defaults to promote:false, so authoring and putting in force stay two steps), retireTeam(defId, retired) (op=retire — reversible and version-scoped, unlike deleteTeam) and verifyTeam(name, contentSha256) (op=verify — the drift check for a workflow kept in source control and pushed to several deployments; an absent team answers deployed:false rather than raising). The ops existed on the substrate and over HTTP; a client that could author a team could not put one in force.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|