sealbridge 0.0.1 → 0.2.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/NOTICE +43 -0
- package/README.ja.md +397 -0
- package/README.md +567 -1
- package/dist/cli/dist/acp.d.ts +2 -0
- package/dist/cli/dist/acp.js +6 -0
- package/dist/cli/dist/acp.js.map +1 -0
- package/dist/cli/dist/approval-summary.d.ts +2 -0
- package/dist/cli/dist/approval-summary.js +32 -0
- package/dist/cli/dist/approval-summary.js.map +1 -0
- package/dist/cli/dist/board.d.ts +47 -0
- package/dist/cli/dist/board.js +255 -0
- package/dist/cli/dist/board.js.map +1 -0
- package/dist/cli/dist/contacts.d.ts +18 -0
- package/dist/cli/dist/contacts.js +154 -0
- package/dist/cli/dist/contacts.js.map +1 -0
- package/dist/cli/dist/doctor.d.ts +13 -0
- package/dist/cli/dist/doctor.js +30 -0
- package/dist/cli/dist/doctor.js.map +1 -0
- package/dist/cli/dist/error-messages.d.ts +2 -0
- package/dist/cli/dist/error-messages.js +24 -0
- package/dist/cli/dist/error-messages.js.map +1 -0
- package/dist/cli/dist/index.d.ts +2 -0
- package/dist/cli/dist/index.js +194 -0
- package/dist/cli/dist/index.js.map +1 -0
- package/dist/cli/dist/invite-share.d.ts +16 -0
- package/dist/cli/dist/invite-share.js +163 -0
- package/dist/cli/dist/invite-share.js.map +1 -0
- package/dist/cli/dist/mcp.d.ts +17 -0
- package/dist/cli/dist/mcp.js +105 -0
- package/dist/cli/dist/mcp.js.map +1 -0
- package/dist/cli/dist/network.d.ts +1 -0
- package/dist/cli/dist/network.js +396 -0
- package/dist/cli/dist/network.js.map +1 -0
- package/dist/cli/dist/public-settings.d.ts +27 -0
- package/dist/cli/dist/public-settings.js +33 -0
- package/dist/cli/dist/public-settings.js.map +1 -0
- package/dist/cli/dist/receipt.d.ts +39 -0
- package/dist/cli/dist/receipt.js +90 -0
- package/dist/cli/dist/receipt.js.map +1 -0
- package/dist/cli/dist/receive-hook.d.ts +2 -0
- package/dist/cli/dist/receive-hook.js +35 -0
- package/dist/cli/dist/receive-hook.js.map +1 -0
- package/dist/cli/dist/task-input.d.ts +2 -0
- package/dist/cli/dist/task-input.js +19 -0
- package/dist/cli/dist/task-input.js.map +1 -0
- package/dist/cli/dist/wake-hook.d.ts +3 -0
- package/dist/cli/dist/wake-hook.js +32 -0
- package/dist/cli/dist/wake-hook.js.map +1 -0
- package/dist/examples/two-owner-demo/alice-policy.json +4 -0
- package/dist/examples/two-owner-demo/bob-policy.json +4 -0
- package/dist/examples/two-owner-demo/dist/run-demo.d.ts +71 -0
- package/dist/examples/two-owner-demo/dist/run-demo.js +383 -0
- package/dist/examples/two-owner-demo/dist/run-demo.js.map +1 -0
- package/dist/package.json +1 -0
- package/dist/packages/adapters/dist/command.d.ts +122 -0
- package/dist/packages/adapters/dist/command.js +378 -0
- package/dist/packages/adapters/dist/command.js.map +1 -0
- package/dist/packages/adapters/dist/credential-proxy.d.ts +37 -0
- package/dist/packages/adapters/dist/credential-proxy.js +363 -0
- package/dist/packages/adapters/dist/credential-proxy.js.map +1 -0
- package/dist/packages/adapters/dist/index.d.ts +6 -0
- package/dist/packages/adapters/dist/index.js +6 -0
- package/dist/packages/adapters/dist/index.js.map +1 -0
- package/dist/packages/adapters/dist/mcp.d.ts +32 -0
- package/dist/packages/adapters/dist/mcp.js +87 -0
- package/dist/packages/adapters/dist/mcp.js.map +1 -0
- package/dist/packages/adapters/dist/openai.d.ts +23 -0
- package/dist/packages/adapters/dist/openai.js +81 -0
- package/dist/packages/adapters/dist/openai.js.map +1 -0
- package/dist/packages/adapters/dist/sandbox.d.ts +45 -0
- package/dist/packages/adapters/dist/sandbox.js +60 -0
- package/dist/packages/adapters/dist/sandbox.js.map +1 -0
- package/dist/packages/core/dist/capability.d.ts +36 -0
- package/dist/packages/core/dist/capability.js +203 -0
- package/dist/packages/core/dist/capability.js.map +1 -0
- package/dist/packages/core/dist/contract.d.ts +33 -0
- package/dist/packages/core/dist/contract.js +97 -0
- package/dist/packages/core/dist/contract.js.map +1 -0
- package/dist/packages/core/dist/crypto.d.ts +34 -0
- package/dist/packages/core/dist/crypto.js +329 -0
- package/dist/packages/core/dist/crypto.js.map +1 -0
- package/dist/packages/core/dist/discovery.d.ts +129 -0
- package/dist/packages/core/dist/discovery.js +527 -0
- package/dist/packages/core/dist/discovery.js.map +1 -0
- package/dist/packages/core/dist/edge.d.ts +4 -0
- package/dist/packages/core/dist/edge.js +6 -0
- package/dist/packages/core/dist/edge.js.map +1 -0
- package/dist/packages/core/dist/index.d.ts +9 -0
- package/dist/packages/core/dist/index.js +10 -0
- package/dist/packages/core/dist/index.js.map +1 -0
- package/dist/packages/core/dist/receipts.d.ts +9 -0
- package/dist/packages/core/dist/receipts.js +67 -0
- package/dist/packages/core/dist/receipts.js.map +1 -0
- package/dist/packages/core/dist/relay-auth.d.ts +40 -0
- package/dist/packages/core/dist/relay-auth.js +106 -0
- package/dist/packages/core/dist/relay-auth.js.map +1 -0
- package/dist/packages/core/dist/revocation.d.ts +58 -0
- package/dist/packages/core/dist/revocation.js +112 -0
- package/dist/packages/core/dist/revocation.js.map +1 -0
- package/dist/packages/core/dist/schema.d.ts +11 -0
- package/dist/packages/core/dist/schema.js +48 -0
- package/dist/packages/core/dist/schema.js.map +1 -0
- package/dist/packages/core/dist/types.d.ts +172 -0
- package/dist/packages/core/dist/types.js +2 -0
- package/dist/packages/core/dist/types.js.map +1 -0
- package/dist/packages/ledger/dist/index.d.ts +84 -0
- package/dist/packages/ledger/dist/index.js +269 -0
- package/dist/packages/ledger/dist/index.js.map +1 -0
- package/dist/packages/relay/dist/fetch.d.ts +250 -0
- package/dist/packages/relay/dist/fetch.js +1401 -0
- package/dist/packages/relay/dist/fetch.js.map +1 -0
- package/dist/packages/relay/dist/index.d.ts +103 -0
- package/dist/packages/relay/dist/index.js +855 -0
- package/dist/packages/relay/dist/index.js.map +1 -0
- package/dist/packages/relay/dist/journal.d.ts +77 -0
- package/dist/packages/relay/dist/journal.js +339 -0
- package/dist/packages/relay/dist/journal.js.map +1 -0
- package/dist/packages/relay/dist/notifications.d.ts +63 -0
- package/dist/packages/relay/dist/notifications.js +55 -0
- package/dist/packages/relay/dist/notifications.js.map +1 -0
- package/dist/packages/relay/dist/retry.d.ts +12 -0
- package/dist/packages/relay/dist/retry.js +59 -0
- package/dist/packages/relay/dist/retry.js.map +1 -0
- package/dist/packages/relay/dist/ssrf.d.ts +32 -0
- package/dist/packages/relay/dist/ssrf.js +213 -0
- package/dist/packages/relay/dist/ssrf.js.map +1 -0
- package/dist/packages/relay/dist/worker.d.ts +92 -0
- package/dist/packages/relay/dist/worker.js +460 -0
- package/dist/packages/relay/dist/worker.js.map +1 -0
- package/dist/packages/runtime/dist/a2a.d.ts +8 -0
- package/dist/packages/runtime/dist/a2a.js +69 -0
- package/dist/packages/runtime/dist/a2a.js.map +1 -0
- package/dist/packages/runtime/dist/adapter.d.ts +51 -0
- package/dist/packages/runtime/dist/adapter.js +2 -0
- package/dist/packages/runtime/dist/adapter.js.map +1 -0
- package/dist/packages/runtime/dist/approval-providers.d.ts +99 -0
- package/dist/packages/runtime/dist/approval-providers.js +269 -0
- package/dist/packages/runtime/dist/approval-providers.js.map +1 -0
- package/dist/packages/runtime/dist/daily-limit.d.ts +2 -0
- package/dist/packages/runtime/dist/daily-limit.js +54 -0
- package/dist/packages/runtime/dist/daily-limit.js.map +1 -0
- package/dist/packages/runtime/dist/gateway.d.ts +35 -0
- package/dist/packages/runtime/dist/gateway.js +92 -0
- package/dist/packages/runtime/dist/gateway.js.map +1 -0
- package/dist/packages/runtime/dist/inbox.d.ts +10 -0
- package/dist/packages/runtime/dist/inbox.js +24 -0
- package/dist/packages/runtime/dist/inbox.js.map +1 -0
- package/dist/packages/runtime/dist/index.d.ts +13 -0
- package/dist/packages/runtime/dist/index.js +14 -0
- package/dist/packages/runtime/dist/index.js.map +1 -0
- package/dist/packages/runtime/dist/mcp-server.d.ts +90 -0
- package/dist/packages/runtime/dist/mcp-server.js +647 -0
- package/dist/packages/runtime/dist/mcp-server.js.map +1 -0
- package/dist/packages/runtime/dist/mcp-tool-catalog.d.ts +3 -0
- package/dist/packages/runtime/dist/mcp-tool-catalog.js +507 -0
- package/dist/packages/runtime/dist/mcp-tool-catalog.js.map +1 -0
- package/dist/packages/runtime/dist/mcp.d.ts +73 -0
- package/dist/packages/runtime/dist/mcp.js +67 -0
- package/dist/packages/runtime/dist/mcp.js.map +1 -0
- package/dist/packages/runtime/dist/policy.d.ts +19 -0
- package/dist/packages/runtime/dist/policy.js +41 -0
- package/dist/packages/runtime/dist/policy.js.map +1 -0
- package/dist/packages/runtime/dist/quota.d.ts +39 -0
- package/dist/packages/runtime/dist/quota.js +147 -0
- package/dist/packages/runtime/dist/quota.js.map +1 -0
- package/dist/packages/runtime/dist/session-audit.d.ts +107 -0
- package/dist/packages/runtime/dist/session-audit.js +520 -0
- package/dist/packages/runtime/dist/session-audit.js.map +1 -0
- package/dist/packages/runtime/dist/session-timeouts.d.ts +33 -0
- package/dist/packages/runtime/dist/session-timeouts.js +62 -0
- package/dist/packages/runtime/dist/session-timeouts.js.map +1 -0
- package/dist/packages/runtime/dist/session.d.ts +323 -0
- package/dist/packages/runtime/dist/session.js +2252 -0
- package/dist/packages/runtime/dist/session.js.map +1 -0
- package/dist/packages/runtime/dist/task-journal.d.ts +36 -0
- package/dist/packages/runtime/dist/task-journal.js +104 -0
- package/dist/packages/runtime/dist/task-journal.js.map +1 -0
- package/dist/packages/runtime/dist/verifier.d.ts +64 -0
- package/dist/packages/runtime/dist/verifier.js +109 -0
- package/dist/packages/runtime/dist/verifier.js.map +1 -0
- package/dist/packages/sandbox/dist/container.d.ts +33 -0
- package/dist/packages/sandbox/dist/container.js +189 -0
- package/dist/packages/sandbox/dist/container.js.map +1 -0
- package/dist/packages/sandbox/dist/index.d.ts +34 -0
- package/dist/packages/sandbox/dist/index.js +179 -0
- package/dist/packages/sandbox/dist/index.js.map +1 -0
- package/dist/packages/sandbox/dist/permission.d.ts +58 -0
- package/dist/packages/sandbox/dist/permission.js +90 -0
- package/dist/packages/sandbox/dist/permission.js.map +1 -0
- package/dist/spec/README.ja.md +76 -0
- package/dist/spec/README.md +135 -0
- package/dist/spec/ack-receipt.schema.json +77 -0
- package/dist/spec/agent-card.schema.json +83 -0
- package/dist/spec/approval-receipt.schema.json +94 -0
- package/dist/spec/audit-entry.schema.json +101 -0
- package/dist/spec/capability-token.schema.json +133 -0
- package/dist/spec/envelope.schema.json +197 -0
- package/dist/spec/examples/sample-ack-receipt.json +16 -0
- package/dist/spec/examples/sample-agent-card.json +35 -0
- package/dist/spec/examples/sample-approval-receipt.json +18 -0
- package/dist/spec/examples/sample-audit-entry.json +37 -0
- package/dist/spec/examples/sample-capability-token.json +39 -0
- package/dist/spec/examples/sample-envelope.json +21 -0
- package/dist/spec/examples/sample-task-manifest.json +141 -0
- package/dist/spec/examples/sample-usage-receipt.json +19 -0
- package/dist/spec/task-manifest.schema.json +422 -0
- package/dist/spec/usage-receipt.schema.json +91 -0
- package/package.json +61 -5
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import type { Json, KeyPair, Schema, TaskManifest, Signed, SignedAgentCard, SignedEnvelope, CapabilityToken, BudgetSpec, OpenPolicy, RevocationList, Invite, SignedRevocationNotice } from '@acp/core';
|
|
2
|
+
import { type AuditBundle, type AuditEntry } from '@acp/ledger';
|
|
3
|
+
import type { RelayClientSecurityOptions, RelayTransport, RelayConnectionStatus } from '@acp/relay';
|
|
4
|
+
import type { AgentAdapter, ProgressPayload, ProtocolEnvelope } from './adapter.js';
|
|
5
|
+
import type { ApprovalProvider, WorkerAcceptancePolicy } from './approval-providers.js';
|
|
6
|
+
import type { ToolBackend, ToolDefinition } from './mcp.js';
|
|
7
|
+
import { VerificationEngine } from './verifier.js';
|
|
8
|
+
import type { VerificationResult } from './verifier.js';
|
|
9
|
+
import { PeerRejectedError } from './session-audit.js';
|
|
10
|
+
import type { SessionTimeoutOptions } from './session-timeouts.js';
|
|
11
|
+
export type { SessionTimeoutOptions } from './session-timeouts.js';
|
|
12
|
+
export interface WorkspaceCleanupFailure {
|
|
13
|
+
taskId: string;
|
|
14
|
+
workspaceDir: string;
|
|
15
|
+
code: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SessionResult {
|
|
18
|
+
taskId: string;
|
|
19
|
+
state: 'SETTLED' | 'CANCELLED';
|
|
20
|
+
deliverable: Json | null;
|
|
21
|
+
bundle: AuditBundle;
|
|
22
|
+
verification?: VerificationResult;
|
|
23
|
+
}
|
|
24
|
+
/** Daemon workers stay finite unless the owner raises the cap. */
|
|
25
|
+
export declare const DEFAULT_MAX_CONCURRENT_TASKS = 8;
|
|
26
|
+
export interface WorkerNodeOptions extends WorkerAcceptancePolicy, SessionTimeoutOptions {
|
|
27
|
+
/** Startup invite and signed card lifetime in seconds. Default 86400 (24 hours). */
|
|
28
|
+
inviteTtlSeconds?: number;
|
|
29
|
+
/** Shared host state, independent of requester and worker identity. */
|
|
30
|
+
dailyLimit?: {
|
|
31
|
+
path: string;
|
|
32
|
+
maxTasks: number;
|
|
33
|
+
};
|
|
34
|
+
/** Explicit admission policy. Defaults to invite-only. */
|
|
35
|
+
accessMode?: 'invite-only' | 'open';
|
|
36
|
+
openPolicy?: OpenPolicy;
|
|
37
|
+
owner: KeyPair;
|
|
38
|
+
relay: RelayTransport | string;
|
|
39
|
+
relayUrl?: string;
|
|
40
|
+
adapter: AgentAdapter;
|
|
41
|
+
name?: string;
|
|
42
|
+
agentDid?: string;
|
|
43
|
+
/** Controls agentDid when it is not owner.did. Required to sign the delegation. */
|
|
44
|
+
agentKey?: KeyPair;
|
|
45
|
+
approvalProvider?: ApprovalProvider;
|
|
46
|
+
/** Bilateral audit path; enables adjacent task checkpoints when inboxPath is absent. */
|
|
47
|
+
auditPath?: string;
|
|
48
|
+
/** Append accepted messages as private JSONL; also enables adjacent task checkpoints. */
|
|
49
|
+
inboxPath?: string;
|
|
50
|
+
/** Best-effort notification after a successful inbox append; never awaited. */
|
|
51
|
+
onInboxRecord?: (record: string) => void | Promise<void>;
|
|
52
|
+
tools?: Record<string, ToolDefinition>;
|
|
53
|
+
toolBackend?: ToolBackend;
|
|
54
|
+
revocation?: RevocationList;
|
|
55
|
+
/** Residual workspace after bounded cleanup retries. Defaults to a console warning. */
|
|
56
|
+
onWorkspaceCleanupError?: (failure: WorkspaceCleanupFailure) => void | Promise<void>;
|
|
57
|
+
onStatus?: (status: RelayConnectionStatus, error?: Error) => void;
|
|
58
|
+
onEvent?: (event: string, taskId: string, error?: ErrorDiagnostic) => void;
|
|
59
|
+
/** Opt in to loopback and RFC1918 relays. Network invites stay blocked by default. */
|
|
60
|
+
allowPrivateRelay?: boolean;
|
|
61
|
+
lookup?: RelayClientSecurityOptions['lookup'];
|
|
62
|
+
/**
|
|
63
|
+
* Accept cleartext session envelopes. Default false: PROPOSE and later frames
|
|
64
|
+
* throw UNENCRYPTED_ENVELOPE_REJECTED unless they were encrypted to this owner.
|
|
65
|
+
*/
|
|
66
|
+
allowUnencryptedEnvelopes?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export declare class WorkerNode {
|
|
69
|
+
readonly options: WorkerNodeOptions;
|
|
70
|
+
readonly relay: RelayTransport;
|
|
71
|
+
readonly agentCard: SignedAgentCard;
|
|
72
|
+
readonly approvalProvider: ApprovalProvider;
|
|
73
|
+
readonly acceptance: WorkerAcceptancePolicy;
|
|
74
|
+
private completed;
|
|
75
|
+
private activeTasks;
|
|
76
|
+
private readonly taskJournal?;
|
|
77
|
+
private reconciled;
|
|
78
|
+
private readonly proposalTimes;
|
|
79
|
+
private readonly mailboxes;
|
|
80
|
+
private readonly forwardedQueue;
|
|
81
|
+
private readonly forwardedWaiters;
|
|
82
|
+
readonly controller: AbortController;
|
|
83
|
+
lastResult?: SessionResult;
|
|
84
|
+
/** Notices learned from the relay inbox. Always present, even without options.revocation. */
|
|
85
|
+
private readonly inboxRevocations;
|
|
86
|
+
/** Capability notices whose issuer is not yet matched to a verified chain. */
|
|
87
|
+
private readonly pendingCapabilities;
|
|
88
|
+
/** Chains that passed verifyCapabilityChain, so a later REVOKE can hit callTool. */
|
|
89
|
+
private readonly liveChains;
|
|
90
|
+
/** Inbox registry composed with options.revocation when the caller passed one. */
|
|
91
|
+
readonly revocation: RevocationList;
|
|
92
|
+
constructor(options: WorkerNodeOptions);
|
|
93
|
+
invite(expiresInSeconds?: number): string;
|
|
94
|
+
register(): Promise<void>;
|
|
95
|
+
stop(): void;
|
|
96
|
+
/** Public registration is opt-in, including for PolicyAutoApprovalProvider. */
|
|
97
|
+
private publishes;
|
|
98
|
+
private get concurrentLimit();
|
|
99
|
+
private rateBudget;
|
|
100
|
+
/** Count a PROPOSE from this requester. Returns a reason when the window is full. */
|
|
101
|
+
private consumeRate;
|
|
102
|
+
/** Budget, allowlist, and rate checks that can be decided before execution starts. */
|
|
103
|
+
private intakeRejection;
|
|
104
|
+
private status?;
|
|
105
|
+
private listenerStatus;
|
|
106
|
+
private listen;
|
|
107
|
+
start(options?: {
|
|
108
|
+
once?: boolean;
|
|
109
|
+
signal?: AbortSignal;
|
|
110
|
+
}): Promise<SessionResult | undefined>;
|
|
111
|
+
private notifyOutcome;
|
|
112
|
+
private reconcileTasks;
|
|
113
|
+
private sealedTaskResult;
|
|
114
|
+
private recoverProposal;
|
|
115
|
+
private deliver;
|
|
116
|
+
/** Local signed diagnostics are separate from the bilateral hash-chain ledger. */
|
|
117
|
+
private reportRejection;
|
|
118
|
+
private beginTask;
|
|
119
|
+
/** Keep reading the shared inbox until a single task finishes, without dropping its peer's mail. */
|
|
120
|
+
private pumpUntil;
|
|
121
|
+
runOnce(signal?: AbortSignal): Promise<SessionResult>;
|
|
122
|
+
private executeTask;
|
|
123
|
+
/**
|
|
124
|
+
* Hide REVOKE envelopes from task reads. start, runOnce, and pumpUntil all
|
|
125
|
+
* receive through this relay, so a FIFO head of one or more REVOKE messages
|
|
126
|
+
* is applied before the following PROPOSE is observed.
|
|
127
|
+
*/
|
|
128
|
+
private isRequesterBoundFrame;
|
|
129
|
+
private revocationAwareRelay;
|
|
130
|
+
/** True when the envelope was a REVOKE and must not be treated as a proposal. */
|
|
131
|
+
private consumeRevocation;
|
|
132
|
+
private ingestRevocation;
|
|
133
|
+
private recordNotice;
|
|
134
|
+
private assertInviteActive;
|
|
135
|
+
/**
|
|
136
|
+
* Before ACCEPT, every verified capability chain is checked against revocation
|
|
137
|
+
* notices. A notice is stored and applied only when its issuer signed that
|
|
138
|
+
* token or an ancestor in a chain that has passed verifyCapabilityChain.
|
|
139
|
+
* An unverified chain, including one whose payload.issuer was rewritten,
|
|
140
|
+
* cannot promote a pending notice into the registry.
|
|
141
|
+
*/
|
|
142
|
+
private assertCapabilitiesActive;
|
|
143
|
+
private verifiedEntries;
|
|
144
|
+
private promotePending;
|
|
145
|
+
private verifiedChainRevoked;
|
|
146
|
+
/**
|
|
147
|
+
* Pending and stored notices apply only when their issuer controls this
|
|
148
|
+
* verified token. A bare target-id hit from another issuer does not.
|
|
149
|
+
*/
|
|
150
|
+
private capabilityTargetRevoked;
|
|
151
|
+
private listedNotices;
|
|
152
|
+
private rememberChains;
|
|
153
|
+
private verifiedLiveEntries;
|
|
154
|
+
private capabilityNoticeAuthorized;
|
|
155
|
+
private sameCapabilityTarget;
|
|
156
|
+
}
|
|
157
|
+
export interface ErrorDetail {
|
|
158
|
+
field: string;
|
|
159
|
+
expected: string;
|
|
160
|
+
actual: string;
|
|
161
|
+
hint: string;
|
|
162
|
+
}
|
|
163
|
+
export interface ErrorDiagnostic {
|
|
164
|
+
code: string;
|
|
165
|
+
detail?: ErrorDetail;
|
|
166
|
+
}
|
|
167
|
+
export interface RequesterClientOptions extends SessionTimeoutOptions {
|
|
168
|
+
owner: KeyPair;
|
|
169
|
+
relay?: RelayTransport | string;
|
|
170
|
+
approvalProvider?: ApprovalProvider;
|
|
171
|
+
verificationEngine?: VerificationEngine;
|
|
172
|
+
auditPath?: string;
|
|
173
|
+
allowPrivateRelay?: boolean;
|
|
174
|
+
/** DNS resolver used before a string relay URL is dialed. */
|
|
175
|
+
lookup?: RelayClientSecurityOptions['lookup'];
|
|
176
|
+
/**
|
|
177
|
+
* Accept cleartext session envelopes. Default false: ACCEPT, PROGRESS, DELIVER,
|
|
178
|
+
* and the other session frames throw UNENCRYPTED_ENVELOPE_REJECTED.
|
|
179
|
+
*/
|
|
180
|
+
allowUnencryptedEnvelopes?: boolean;
|
|
181
|
+
}
|
|
182
|
+
export interface DelegateOptions extends SessionTimeoutOptions {
|
|
183
|
+
to: string;
|
|
184
|
+
discover?: {
|
|
185
|
+
skillId?: string;
|
|
186
|
+
taskType?: string;
|
|
187
|
+
};
|
|
188
|
+
relay?: RelayTransport | string;
|
|
189
|
+
title: string;
|
|
190
|
+
description: string;
|
|
191
|
+
input: Json;
|
|
192
|
+
outputSchema?: Schema;
|
|
193
|
+
budget?: Partial<BudgetSpec>;
|
|
194
|
+
manifest?: TaskManifest;
|
|
195
|
+
auditPath?: string;
|
|
196
|
+
signal?: AbortSignal;
|
|
197
|
+
capabilities?: TaskManifest['permissions']['grantedCapabilities'];
|
|
198
|
+
/**
|
|
199
|
+
* Chains to send on PROPOSE. When omitted, chains are minted from
|
|
200
|
+
* grantedCapabilities. Supply them to revoke a known token id before send.
|
|
201
|
+
*/
|
|
202
|
+
capabilityChains?: CapabilityToken[][];
|
|
203
|
+
minimumIsolationLevel?: string;
|
|
204
|
+
onProgress?: (progress: ProgressPayload, envelope: ProtocolEnvelope<ProgressPayload>) => void | Promise<void>;
|
|
205
|
+
}
|
|
206
|
+
export interface DelegateWorkerTarget {
|
|
207
|
+
workerDid: string;
|
|
208
|
+
inviteToken?: string | Signed<Invite>;
|
|
209
|
+
relayUrl?: string;
|
|
210
|
+
}
|
|
211
|
+
export interface DelegateReceipt {
|
|
212
|
+
workerDid: string;
|
|
213
|
+
taskId: string;
|
|
214
|
+
outputDigest: string;
|
|
215
|
+
deliverable: Json;
|
|
216
|
+
bundle: AuditBundle;
|
|
217
|
+
accepted: boolean;
|
|
218
|
+
}
|
|
219
|
+
/** Locally verified delivery whose bilateral checkpoint did not finish. Never an audit bundle. */
|
|
220
|
+
export interface IncompleteDelegateReceipt extends Omit<DelegateReceipt, 'bundle'> {
|
|
221
|
+
checkpointComplete: false;
|
|
222
|
+
delivery: SignedEnvelope;
|
|
223
|
+
verification: VerificationResult;
|
|
224
|
+
entries: AuditEntry[];
|
|
225
|
+
completionError: string;
|
|
226
|
+
}
|
|
227
|
+
/** Completion failure preserves local verification without claiming a sealed checkpoint. */
|
|
228
|
+
export declare class IncompleteSettlementError extends Error {
|
|
229
|
+
readonly incompleteReceipt: IncompleteDelegateReceipt;
|
|
230
|
+
readonly code?: string;
|
|
231
|
+
readonly detail?: ErrorDetail;
|
|
232
|
+
readonly recovery?: PeerRejectedError['recovery'];
|
|
233
|
+
constructor(incompleteReceipt: IncompleteDelegateReceipt, cause: unknown);
|
|
234
|
+
}
|
|
235
|
+
export interface DelegateMultiResult {
|
|
236
|
+
mode: 'race' | 'quorum';
|
|
237
|
+
status: 'SETTLED';
|
|
238
|
+
deliverable: Json;
|
|
239
|
+
outputDigest: string;
|
|
240
|
+
taskIds: string[];
|
|
241
|
+
winners: Array<{
|
|
242
|
+
workerDid: string;
|
|
243
|
+
taskId: string;
|
|
244
|
+
outputDigest: string;
|
|
245
|
+
}>;
|
|
246
|
+
receipts: DelegateReceipt[];
|
|
247
|
+
incompleteReceipts: IncompleteDelegateReceipt[];
|
|
248
|
+
cancelled: string[];
|
|
249
|
+
}
|
|
250
|
+
export interface DelegateMultiOptions extends SessionTimeoutOptions {
|
|
251
|
+
workers: DelegateWorkerTarget[];
|
|
252
|
+
mode: 'race' | 'quorum';
|
|
253
|
+
quorumSize?: number;
|
|
254
|
+
/** Completion grace for delivered sessions after a winner is selected. Default 45000 ms. */
|
|
255
|
+
completionTimeoutMs?: number;
|
|
256
|
+
title: string;
|
|
257
|
+
description: string;
|
|
258
|
+
input: Json;
|
|
259
|
+
outputSchema?: Schema;
|
|
260
|
+
budget?: Partial<BudgetSpec>;
|
|
261
|
+
capabilities?: DelegateOptions['capabilities'];
|
|
262
|
+
minimumIsolationLevel?: string;
|
|
263
|
+
signal?: AbortSignal;
|
|
264
|
+
onProgress?: DelegateOptions['onProgress'];
|
|
265
|
+
auditPath?: string;
|
|
266
|
+
}
|
|
267
|
+
export interface DeliverRevocationOptions {
|
|
268
|
+
relay: RelayTransport | string;
|
|
269
|
+
from: KeyPair;
|
|
270
|
+
recipientDid: string;
|
|
271
|
+
notice: SignedRevocationNotice;
|
|
272
|
+
/** Routing id carried in the envelope header. Defaults to the revocation id. */
|
|
273
|
+
taskId?: string;
|
|
274
|
+
seq?: number;
|
|
275
|
+
/** Encrypt the notice to recipientDid. Default true. */
|
|
276
|
+
encrypt?: boolean;
|
|
277
|
+
allowPrivateRelay?: boolean;
|
|
278
|
+
lookup?: RelayClientSecurityOptions['lookup'];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Queue a signed REVOKE envelope on a worker inbox.
|
|
282
|
+
* The payload is a SignedRevocationNotice. Encryption is on unless encrypt is false,
|
|
283
|
+
* so an offline worker reads the notice in FIFO order before a later PROPOSE.
|
|
284
|
+
*/
|
|
285
|
+
export declare function deliverRevocation(options: DeliverRevocationOptions): Promise<SignedEnvelope>;
|
|
286
|
+
export declare class RequesterClient {
|
|
287
|
+
readonly options: RequesterClientOptions;
|
|
288
|
+
readonly approvalProvider: ApprovalProvider;
|
|
289
|
+
constructor(options: RequesterClientOptions);
|
|
290
|
+
/**
|
|
291
|
+
* Send an encrypted REVOKE for an invite or capability to a worker inbox.
|
|
292
|
+
* `to` is a worker DID or an acp-invite token. The notice is signed by this client.
|
|
293
|
+
*/
|
|
294
|
+
sendRevocation(options: {
|
|
295
|
+
to: string;
|
|
296
|
+
relay?: RelayTransport | string;
|
|
297
|
+
targetType?: 'invite' | 'capability';
|
|
298
|
+
targetId?: string;
|
|
299
|
+
reason?: string;
|
|
300
|
+
notice?: SignedRevocationNotice;
|
|
301
|
+
taskId?: string;
|
|
302
|
+
encrypt?: boolean;
|
|
303
|
+
}): Promise<SignedEnvelope>;
|
|
304
|
+
delegate(options: DelegateOptions, hooks?: {
|
|
305
|
+
onProgress?: DelegateOptions['onProgress'];
|
|
306
|
+
/** @internal Multi-delegation stops cancelling execution once DELIVER is recorded. */
|
|
307
|
+
onDelivered?: () => void;
|
|
308
|
+
}): Promise<SessionResult>;
|
|
309
|
+
delegateMulti(options: DelegateMultiOptions): Promise<DelegateMultiResult>;
|
|
310
|
+
}
|
|
311
|
+
export declare function buildTaskManifest(options: {
|
|
312
|
+
ownerDid: string;
|
|
313
|
+
workerDid: string;
|
|
314
|
+
agentDid?: string;
|
|
315
|
+
skillId?: string;
|
|
316
|
+
taskType?: string;
|
|
317
|
+
title: string;
|
|
318
|
+
description: string;
|
|
319
|
+
outputSchema?: Schema;
|
|
320
|
+
budget?: Partial<BudgetSpec>;
|
|
321
|
+
taskTimeoutMs?: number;
|
|
322
|
+
capabilities?: TaskManifest['permissions']['grantedCapabilities'];
|
|
323
|
+
}): TaskManifest;
|