@brightbeamai/chap-coordinator 0.2.8
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/LICENSE +201 -0
- package/README.md +271 -0
- package/dist/api-C3nkEk-B.d.cts +260 -0
- package/dist/api-CmSvlIqO.d.ts +260 -0
- package/dist/api.cjs +125 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +4 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.js +98 -0
- package/dist/api.js.map +1 -0
- package/dist/index.cjs +2804 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +175 -0
- package/dist/index.d.ts +175 -0
- package/dist/index.js +2762 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonrpc.cjs +103 -0
- package/dist/jsonrpc.cjs.map +1 -0
- package/dist/jsonrpc.d.cts +65 -0
- package/dist/jsonrpc.d.ts +65 -0
- package/dist/jsonrpc.js +76 -0
- package/dist/jsonrpc.js.map +1 -0
- package/dist/methods.cjs +19 -0
- package/dist/methods.cjs.map +1 -0
- package/dist/methods.d.cts +455 -0
- package/dist/methods.d.ts +455 -0
- package/dist/methods.js +1 -0
- package/dist/methods.js.map +1 -0
- package/dist/patch.cjs +277 -0
- package/dist/patch.cjs.map +1 -0
- package/dist/patch.d.cts +29 -0
- package/dist/patch.d.ts +29 -0
- package/dist/patch.js +250 -0
- package/dist/patch.js.map +1 -0
- package/dist/storage/sqlite.cjs +94 -0
- package/dist/storage/sqlite.cjs.map +1 -0
- package/dist/storage/sqlite.d.cts +67 -0
- package/dist/storage/sqlite.d.ts +67 -0
- package/dist/storage/sqlite.js +76 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/storage/store.cjs +45 -0
- package/dist/storage/store.cjs.map +1 -0
- package/dist/storage/store.d.cts +53 -0
- package/dist/storage/store.d.ts +53 -0
- package/dist/storage/store.js +20 -0
- package/dist/storage/store.js.map +1 -0
- package/dist/types.cjs +34 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +287 -0
- package/dist/types.d.ts +287 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { C as CoordinatorOptions, a as Coordinator } from './api-C3nkEk-B.cjs';
|
|
2
|
+
export { b as CoordinatorApi, c as CoordinatorError, d as CredentialVerifier, E as EscalationPolicyFn, H as Handler, I as IdFactory, P as PRIVILEGED_METHODS, R as ReviewDepthPolicyFn, e as RoutingPolicyFn, S as ScittReceiptVerifier, f as ScittSubmitter, T as TokenVerifier, g as call, m as makeApi } from './api-C3nkEk-B.cjs';
|
|
3
|
+
export { MethodName, MethodParams, MethodResult, MethodTable } from './methods.cjs';
|
|
4
|
+
export { MemoryStore, Store, WorkspaceRecord } from './storage/store.cjs';
|
|
5
|
+
export { ArtefactId, ArtefactRoutingHints, AuditEntry, AuditListener, Deliberation, DeliberationVote, Envelope, Handoff, HandoffTaskItem, JsonPatchOp, Jwk, KeyRecord, Member, Mode, OverrideArtefact, ParticipantType, ParticipantUri, PauseScope, ReviewDecision, RouteDecisionArtefact, SnapshotArtefact, Task, TaskId, TaskRoutingHints, TaskState, WhisperPrompt, Workspace, WorkspaceId, WorkspaceState, modeLE } from './types.cjs';
|
|
6
|
+
export { E, isValidEnvelope, rpcError } from './jsonrpc.cjs';
|
|
7
|
+
export { PatchError, applyJsonPatch, diffJsonPatch } from './patch.cjs';
|
|
8
|
+
import { KeyObject } from 'node:crypto';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @brightbeamai/chap-coordinator/canonical
|
|
12
|
+
*
|
|
13
|
+
* Deterministic JSON canonicalisation for CHAP. CHAP signs and hashes the
|
|
14
|
+
* canonicalisation of envelopes.
|
|
15
|
+
*
|
|
16
|
+
* Follows RFC 8785 (JCS) for objects, arrays, strings, booleans, and null,
|
|
17
|
+
* with one deliberate restriction on numbers. RFC 8785 mandates the
|
|
18
|
+
* ECMAScript number-to-string algorithm, which is hard to reproduce
|
|
19
|
+
* byte-identically across languages; a subtle mismatch would make a chain
|
|
20
|
+
* written by one implementation fail verification against another. To make
|
|
21
|
+
* cross-implementation agreement provable rather than approximate, a CHAP
|
|
22
|
+
* canonical number MUST be an integer within the safe-integer range
|
|
23
|
+
* (abs value <= Number.MAX_SAFE_INTEGER). Non-integers and larger
|
|
24
|
+
* magnitudes are rejected: represent them as strings. The Python reference
|
|
25
|
+
* enforces the identical rule.
|
|
26
|
+
*/
|
|
27
|
+
declare const ZERO_HASH: string;
|
|
28
|
+
/** Return the JCS canonical UTF-8 bytes for a JSON-compatible value. */
|
|
29
|
+
declare function canonicalize(value: unknown): Buffer;
|
|
30
|
+
/** Return ``sha256:<64-hex>`` digest of bytes. */
|
|
31
|
+
declare function sha256Hex(data: Buffer | string): string;
|
|
32
|
+
/** Convenience: content hash for an artefact payload via JCS. */
|
|
33
|
+
declare function contentHash(content: unknown): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @brightbeamai/chap-coordinator/crypto
|
|
37
|
+
*
|
|
38
|
+
* Ed25519 signing/verification for the security-signed/1.0 profile.
|
|
39
|
+
*
|
|
40
|
+
* Uses Node's built-in crypto (no external dependencies). Keys are
|
|
41
|
+
* represented as RFC 7517 JWKs with kty=OKP, crv=Ed25519.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
interface Jwk {
|
|
45
|
+
kty: "OKP";
|
|
46
|
+
crv: "Ed25519";
|
|
47
|
+
kid: string;
|
|
48
|
+
x: string;
|
|
49
|
+
d?: string;
|
|
50
|
+
use?: string;
|
|
51
|
+
alg?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Deterministically derive a 32-byte Ed25519 seed from a participant URI.
|
|
55
|
+
* Demo / test only. production deployments supply real keys.
|
|
56
|
+
*/
|
|
57
|
+
declare function deriveSeed(uri: string): Buffer;
|
|
58
|
+
/** Public key bytes (32 bytes) from a private key. */
|
|
59
|
+
declare function publicKeyBytes(privateKey: KeyObject): Buffer;
|
|
60
|
+
/** Public KeyObject from raw 32-byte Ed25519 public key. */
|
|
61
|
+
declare function publicKeyFromRaw(raw: Buffer): KeyObject;
|
|
62
|
+
/** Render a JWK from a Node private KeyObject. */
|
|
63
|
+
declare function jwkFromPrivateKey(uri: string, key: KeyObject): Jwk;
|
|
64
|
+
/** Sign canonical bytes; return ``ed25519:<kid>:<base64>``. */
|
|
65
|
+
declare function signEnvelope(canonical: Buffer, privateKey: KeyObject, kid: string): string;
|
|
66
|
+
/** Verify a CHAP sig string against canonical bytes and a public key. */
|
|
67
|
+
declare function verifyEnvelope(canonical: Buffer, sigTag: string, publicKey: KeyObject): boolean;
|
|
68
|
+
/** Parse a JWK x (base64url) into a Node public KeyObject. */
|
|
69
|
+
declare function publicKeyFromJwk(jwk: Jwk): KeyObject;
|
|
70
|
+
/** Demo helper: build a deterministic keypair + JWK for a URI. */
|
|
71
|
+
declare function deriveKeypair(uri: string): {
|
|
72
|
+
privateKey: KeyObject;
|
|
73
|
+
jwk: Jwk;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Default routing policy factory.
|
|
78
|
+
*
|
|
79
|
+
* Returns a partial CoordinatorOptions configured with the three
|
|
80
|
+
* routing hooks (routingPolicy, reviewDepthPolicy, escalationPolicy)
|
|
81
|
+
* that the playground and demo use out of the box. Operators can
|
|
82
|
+
* override individual hooks by passing their own functions in
|
|
83
|
+
* CoordinatorOptions.
|
|
84
|
+
*
|
|
85
|
+
* The defaults shipped with the Coordinator (in profiles/routing.ts)
|
|
86
|
+
* implement the same logic; this factory exists so that the legacy
|
|
87
|
+
* call site can keep using:
|
|
88
|
+
*
|
|
89
|
+
* new Coordinator({ ...makeDefaultPolicy(SENIOR_URI), ... })
|
|
90
|
+
*
|
|
91
|
+
* The seniorTarget argument is the URI auto-escalation routes to
|
|
92
|
+
* when no other target is supplied.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
declare function makeDefaultPolicy(seniorTarget: string): Pick<CoordinatorOptions, "routingPolicy" | "reviewDepthPolicy" | "escalationPolicy">;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @brightbeamai/chap-coordinator/transports/wrap
|
|
99
|
+
*
|
|
100
|
+
* Inward integration helpers: turn an external tool/agent event into
|
|
101
|
+
* a CHAP envelope landing in a workspace's audit log. Library
|
|
102
|
+
* counterpart to the patterns described in
|
|
103
|
+
* ``integrations/CHAP-with-MCP.md`` and ``integrations/CHAP-with-A2A.md``.
|
|
104
|
+
*
|
|
105
|
+
* The outward transports let external clients drive a CHAP workspace.
|
|
106
|
+
* These helpers go the other direction: when work has already
|
|
107
|
+
* happened outside CHAP, wrap it so the audit log carries a faithful,
|
|
108
|
+
* citable record.
|
|
109
|
+
*
|
|
110
|
+
* Spec target: CHAP 0.2. MCP 2025-11-25. A2A 1.0.
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
interface WrapMcpToolCallOptions {
|
|
114
|
+
/** Participant URI making the call. Must already be a workspace member. */
|
|
115
|
+
caller: string;
|
|
116
|
+
/** MCP tool name, e.g. ``"github.create_issue"``. */
|
|
117
|
+
tool: string;
|
|
118
|
+
/** Arguments passed to the MCP tool. */
|
|
119
|
+
args: Record<string, unknown>;
|
|
120
|
+
/** Return value from the MCP tool. */
|
|
121
|
+
result: unknown;
|
|
122
|
+
/** Optional MCP server identifier, e.g. "github". */
|
|
123
|
+
server?: string;
|
|
124
|
+
/** Override the default task kind ``"mcp_call:<tool>"``. */
|
|
125
|
+
taskKind?: string;
|
|
126
|
+
/** Optional routing hints attached to the CHAP task. */
|
|
127
|
+
routingHints?: Record<string, unknown>;
|
|
128
|
+
/** Optional confidence value attached to task.complete. */
|
|
129
|
+
confidence?: number | string;
|
|
130
|
+
}
|
|
131
|
+
interface WrapResult {
|
|
132
|
+
task_id: string;
|
|
133
|
+
input_hash: string;
|
|
134
|
+
output_hash: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Wrap a completed MCP tool call as a CHAP task pair.
|
|
138
|
+
*
|
|
139
|
+
* Emits ``task.create`` + ``task.complete`` envelopes into the
|
|
140
|
+
* workspace so the MCP call shows up as a first-class audit entry.
|
|
141
|
+
* The result artefact is the MCP tool's return value, plus a
|
|
142
|
+
* ``citations[]`` entry with the input/output hashes per
|
|
143
|
+
* ``integrations/CHAP-with-MCP.md`` §2.
|
|
144
|
+
*/
|
|
145
|
+
declare function wrapMcpToolCall(coord: Coordinator, workspace: string, options: WrapMcpToolCallOptions): WrapResult;
|
|
146
|
+
interface WrapA2aExchangeOptions {
|
|
147
|
+
/** URI of the local bridge participant. Must be a workspace member. */
|
|
148
|
+
bridgeUri: string;
|
|
149
|
+
/** Identifier of the remote A2A agent. Recorded in the citation. */
|
|
150
|
+
remoteAgent: string;
|
|
151
|
+
/** The A2A message body sent outbound. */
|
|
152
|
+
sent: Record<string, unknown>;
|
|
153
|
+
/** The A2A message body received in response. */
|
|
154
|
+
received: Record<string, unknown>;
|
|
155
|
+
/** CHAP task kind. Default ``"a2a_exchange"``. */
|
|
156
|
+
taskKind?: string;
|
|
157
|
+
/** Optional routing hints attached to the task. */
|
|
158
|
+
routingHints?: Record<string, unknown>;
|
|
159
|
+
/** Optional confidence value attached to task.complete. */
|
|
160
|
+
confidence?: number | string;
|
|
161
|
+
}
|
|
162
|
+
interface WrapA2aResult {
|
|
163
|
+
task_id: string;
|
|
164
|
+
sent_hash: string;
|
|
165
|
+
received_hash: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Wrap a completed A2A message exchange as a CHAP task pair.
|
|
169
|
+
*
|
|
170
|
+
* Implements the bridge-participant pattern from
|
|
171
|
+
* ``integrations/CHAP-with-A2A.md`` §3 as a library helper.
|
|
172
|
+
*/
|
|
173
|
+
declare function wrapA2aMessageExchange(coord: Coordinator, workspace: string, options: WrapA2aExchangeOptions): WrapA2aResult;
|
|
174
|
+
|
|
175
|
+
export { Coordinator, CoordinatorOptions, type Jwk as CryptoJwk, type WrapA2aExchangeOptions, type WrapA2aResult, type WrapMcpToolCallOptions, type WrapResult, ZERO_HASH, canonicalize, contentHash, deriveKeypair, deriveSeed, jwkFromPrivateKey, makeDefaultPolicy, publicKeyBytes, publicKeyFromJwk, publicKeyFromRaw, sha256Hex, signEnvelope, verifyEnvelope, wrapA2aMessageExchange, wrapMcpToolCall };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { C as CoordinatorOptions, a as Coordinator } from './api-CmSvlIqO.js';
|
|
2
|
+
export { b as CoordinatorApi, c as CoordinatorError, d as CredentialVerifier, E as EscalationPolicyFn, H as Handler, I as IdFactory, P as PRIVILEGED_METHODS, R as ReviewDepthPolicyFn, e as RoutingPolicyFn, S as ScittReceiptVerifier, f as ScittSubmitter, T as TokenVerifier, g as call, m as makeApi } from './api-CmSvlIqO.js';
|
|
3
|
+
export { MethodName, MethodParams, MethodResult, MethodTable } from './methods.js';
|
|
4
|
+
export { MemoryStore, Store, WorkspaceRecord } from './storage/store.js';
|
|
5
|
+
export { ArtefactId, ArtefactRoutingHints, AuditEntry, AuditListener, Deliberation, DeliberationVote, Envelope, Handoff, HandoffTaskItem, JsonPatchOp, Jwk, KeyRecord, Member, Mode, OverrideArtefact, ParticipantType, ParticipantUri, PauseScope, ReviewDecision, RouteDecisionArtefact, SnapshotArtefact, Task, TaskId, TaskRoutingHints, TaskState, WhisperPrompt, Workspace, WorkspaceId, WorkspaceState, modeLE } from './types.js';
|
|
6
|
+
export { E, isValidEnvelope, rpcError } from './jsonrpc.js';
|
|
7
|
+
export { PatchError, applyJsonPatch, diffJsonPatch } from './patch.js';
|
|
8
|
+
import { KeyObject } from 'node:crypto';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @brightbeamai/chap-coordinator/canonical
|
|
12
|
+
*
|
|
13
|
+
* Deterministic JSON canonicalisation for CHAP. CHAP signs and hashes the
|
|
14
|
+
* canonicalisation of envelopes.
|
|
15
|
+
*
|
|
16
|
+
* Follows RFC 8785 (JCS) for objects, arrays, strings, booleans, and null,
|
|
17
|
+
* with one deliberate restriction on numbers. RFC 8785 mandates the
|
|
18
|
+
* ECMAScript number-to-string algorithm, which is hard to reproduce
|
|
19
|
+
* byte-identically across languages; a subtle mismatch would make a chain
|
|
20
|
+
* written by one implementation fail verification against another. To make
|
|
21
|
+
* cross-implementation agreement provable rather than approximate, a CHAP
|
|
22
|
+
* canonical number MUST be an integer within the safe-integer range
|
|
23
|
+
* (abs value <= Number.MAX_SAFE_INTEGER). Non-integers and larger
|
|
24
|
+
* magnitudes are rejected: represent them as strings. The Python reference
|
|
25
|
+
* enforces the identical rule.
|
|
26
|
+
*/
|
|
27
|
+
declare const ZERO_HASH: string;
|
|
28
|
+
/** Return the JCS canonical UTF-8 bytes for a JSON-compatible value. */
|
|
29
|
+
declare function canonicalize(value: unknown): Buffer;
|
|
30
|
+
/** Return ``sha256:<64-hex>`` digest of bytes. */
|
|
31
|
+
declare function sha256Hex(data: Buffer | string): string;
|
|
32
|
+
/** Convenience: content hash for an artefact payload via JCS. */
|
|
33
|
+
declare function contentHash(content: unknown): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @brightbeamai/chap-coordinator/crypto
|
|
37
|
+
*
|
|
38
|
+
* Ed25519 signing/verification for the security-signed/1.0 profile.
|
|
39
|
+
*
|
|
40
|
+
* Uses Node's built-in crypto (no external dependencies). Keys are
|
|
41
|
+
* represented as RFC 7517 JWKs with kty=OKP, crv=Ed25519.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
interface Jwk {
|
|
45
|
+
kty: "OKP";
|
|
46
|
+
crv: "Ed25519";
|
|
47
|
+
kid: string;
|
|
48
|
+
x: string;
|
|
49
|
+
d?: string;
|
|
50
|
+
use?: string;
|
|
51
|
+
alg?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Deterministically derive a 32-byte Ed25519 seed from a participant URI.
|
|
55
|
+
* Demo / test only. production deployments supply real keys.
|
|
56
|
+
*/
|
|
57
|
+
declare function deriveSeed(uri: string): Buffer;
|
|
58
|
+
/** Public key bytes (32 bytes) from a private key. */
|
|
59
|
+
declare function publicKeyBytes(privateKey: KeyObject): Buffer;
|
|
60
|
+
/** Public KeyObject from raw 32-byte Ed25519 public key. */
|
|
61
|
+
declare function publicKeyFromRaw(raw: Buffer): KeyObject;
|
|
62
|
+
/** Render a JWK from a Node private KeyObject. */
|
|
63
|
+
declare function jwkFromPrivateKey(uri: string, key: KeyObject): Jwk;
|
|
64
|
+
/** Sign canonical bytes; return ``ed25519:<kid>:<base64>``. */
|
|
65
|
+
declare function signEnvelope(canonical: Buffer, privateKey: KeyObject, kid: string): string;
|
|
66
|
+
/** Verify a CHAP sig string against canonical bytes and a public key. */
|
|
67
|
+
declare function verifyEnvelope(canonical: Buffer, sigTag: string, publicKey: KeyObject): boolean;
|
|
68
|
+
/** Parse a JWK x (base64url) into a Node public KeyObject. */
|
|
69
|
+
declare function publicKeyFromJwk(jwk: Jwk): KeyObject;
|
|
70
|
+
/** Demo helper: build a deterministic keypair + JWK for a URI. */
|
|
71
|
+
declare function deriveKeypair(uri: string): {
|
|
72
|
+
privateKey: KeyObject;
|
|
73
|
+
jwk: Jwk;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Default routing policy factory.
|
|
78
|
+
*
|
|
79
|
+
* Returns a partial CoordinatorOptions configured with the three
|
|
80
|
+
* routing hooks (routingPolicy, reviewDepthPolicy, escalationPolicy)
|
|
81
|
+
* that the playground and demo use out of the box. Operators can
|
|
82
|
+
* override individual hooks by passing their own functions in
|
|
83
|
+
* CoordinatorOptions.
|
|
84
|
+
*
|
|
85
|
+
* The defaults shipped with the Coordinator (in profiles/routing.ts)
|
|
86
|
+
* implement the same logic; this factory exists so that the legacy
|
|
87
|
+
* call site can keep using:
|
|
88
|
+
*
|
|
89
|
+
* new Coordinator({ ...makeDefaultPolicy(SENIOR_URI), ... })
|
|
90
|
+
*
|
|
91
|
+
* The seniorTarget argument is the URI auto-escalation routes to
|
|
92
|
+
* when no other target is supplied.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
declare function makeDefaultPolicy(seniorTarget: string): Pick<CoordinatorOptions, "routingPolicy" | "reviewDepthPolicy" | "escalationPolicy">;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @brightbeamai/chap-coordinator/transports/wrap
|
|
99
|
+
*
|
|
100
|
+
* Inward integration helpers: turn an external tool/agent event into
|
|
101
|
+
* a CHAP envelope landing in a workspace's audit log. Library
|
|
102
|
+
* counterpart to the patterns described in
|
|
103
|
+
* ``integrations/CHAP-with-MCP.md`` and ``integrations/CHAP-with-A2A.md``.
|
|
104
|
+
*
|
|
105
|
+
* The outward transports let external clients drive a CHAP workspace.
|
|
106
|
+
* These helpers go the other direction: when work has already
|
|
107
|
+
* happened outside CHAP, wrap it so the audit log carries a faithful,
|
|
108
|
+
* citable record.
|
|
109
|
+
*
|
|
110
|
+
* Spec target: CHAP 0.2. MCP 2025-11-25. A2A 1.0.
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
interface WrapMcpToolCallOptions {
|
|
114
|
+
/** Participant URI making the call. Must already be a workspace member. */
|
|
115
|
+
caller: string;
|
|
116
|
+
/** MCP tool name, e.g. ``"github.create_issue"``. */
|
|
117
|
+
tool: string;
|
|
118
|
+
/** Arguments passed to the MCP tool. */
|
|
119
|
+
args: Record<string, unknown>;
|
|
120
|
+
/** Return value from the MCP tool. */
|
|
121
|
+
result: unknown;
|
|
122
|
+
/** Optional MCP server identifier, e.g. "github". */
|
|
123
|
+
server?: string;
|
|
124
|
+
/** Override the default task kind ``"mcp_call:<tool>"``. */
|
|
125
|
+
taskKind?: string;
|
|
126
|
+
/** Optional routing hints attached to the CHAP task. */
|
|
127
|
+
routingHints?: Record<string, unknown>;
|
|
128
|
+
/** Optional confidence value attached to task.complete. */
|
|
129
|
+
confidence?: number | string;
|
|
130
|
+
}
|
|
131
|
+
interface WrapResult {
|
|
132
|
+
task_id: string;
|
|
133
|
+
input_hash: string;
|
|
134
|
+
output_hash: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Wrap a completed MCP tool call as a CHAP task pair.
|
|
138
|
+
*
|
|
139
|
+
* Emits ``task.create`` + ``task.complete`` envelopes into the
|
|
140
|
+
* workspace so the MCP call shows up as a first-class audit entry.
|
|
141
|
+
* The result artefact is the MCP tool's return value, plus a
|
|
142
|
+
* ``citations[]`` entry with the input/output hashes per
|
|
143
|
+
* ``integrations/CHAP-with-MCP.md`` §2.
|
|
144
|
+
*/
|
|
145
|
+
declare function wrapMcpToolCall(coord: Coordinator, workspace: string, options: WrapMcpToolCallOptions): WrapResult;
|
|
146
|
+
interface WrapA2aExchangeOptions {
|
|
147
|
+
/** URI of the local bridge participant. Must be a workspace member. */
|
|
148
|
+
bridgeUri: string;
|
|
149
|
+
/** Identifier of the remote A2A agent. Recorded in the citation. */
|
|
150
|
+
remoteAgent: string;
|
|
151
|
+
/** The A2A message body sent outbound. */
|
|
152
|
+
sent: Record<string, unknown>;
|
|
153
|
+
/** The A2A message body received in response. */
|
|
154
|
+
received: Record<string, unknown>;
|
|
155
|
+
/** CHAP task kind. Default ``"a2a_exchange"``. */
|
|
156
|
+
taskKind?: string;
|
|
157
|
+
/** Optional routing hints attached to the task. */
|
|
158
|
+
routingHints?: Record<string, unknown>;
|
|
159
|
+
/** Optional confidence value attached to task.complete. */
|
|
160
|
+
confidence?: number | string;
|
|
161
|
+
}
|
|
162
|
+
interface WrapA2aResult {
|
|
163
|
+
task_id: string;
|
|
164
|
+
sent_hash: string;
|
|
165
|
+
received_hash: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Wrap a completed A2A message exchange as a CHAP task pair.
|
|
169
|
+
*
|
|
170
|
+
* Implements the bridge-participant pattern from
|
|
171
|
+
* ``integrations/CHAP-with-A2A.md`` §3 as a library helper.
|
|
172
|
+
*/
|
|
173
|
+
declare function wrapA2aMessageExchange(coord: Coordinator, workspace: string, options: WrapA2aExchangeOptions): WrapA2aResult;
|
|
174
|
+
|
|
175
|
+
export { Coordinator, CoordinatorOptions, type Jwk as CryptoJwk, type WrapA2aExchangeOptions, type WrapA2aResult, type WrapMcpToolCallOptions, type WrapResult, ZERO_HASH, canonicalize, contentHash, deriveKeypair, deriveSeed, jwkFromPrivateKey, makeDefaultPolicy, publicKeyBytes, publicKeyFromJwk, publicKeyFromRaw, sha256Hex, signEnvelope, verifyEnvelope, wrapA2aMessageExchange, wrapMcpToolCall };
|