@brightbeamai/chap-coordinator 0.2.13 → 0.3.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/dist/index.d.cts CHANGED
@@ -1,12 +1,22 @@
1
- import { C as CoordinatorOptions, a as Coordinator } from './api-DiiL0sil.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-DiiL0sil.cjs';
1
+ import { C as CoordinatorOptions, a as Coordinator } from './api-BkvwN42r.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-BkvwN42r.cjs';
3
3
  export { MethodName, MethodParams, MethodResult, MethodTable } from './methods.cjs';
4
+ import { AuditEntry, Envelope } from './types.cjs';
5
+ export { ArtefactId, ArtefactRoutingHints, AuditListener, Deliberation, DeliberationVote, Handoff, HandoffTaskItem, JsonPatchOp, Jwk, KeyRecord, Member, Mode, OverrideArtefact, ParticipantType, ParticipantUri, PauseScope, RefusalOutcome, ReviewDecision, RouteDecisionArtefact, SnapshotArtefact, Task, TaskId, TaskRoutingHints, TaskState, WhisperPrompt, Workspace, WorkspaceId, WorkspaceState, modeLE } from './types.cjs';
4
6
  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
7
  export { E, isValidEnvelope, rpcError } from './jsonrpc.cjs';
7
8
  export { PatchError, applyJsonPatch, diffJsonPatch } from './patch.cjs';
8
9
  import { KeyObject } from 'node:crypto';
9
10
 
11
+ /** The value an entry's chain link hashes. */
12
+ declare function entryRecord(entry: AuditEntry): unknown;
13
+ /** The call an entry records, whether it took effect or was refused. */
14
+ declare function entryCall(entry: AuditEntry): Envelope | undefined;
15
+ /** True when an entry records a refused call. */
16
+ declare function isRefusal(entry: AuditEntry): boolean;
17
+ /** chain_head = SHA-256( JCS(record) || prev_hash ). */
18
+ declare function linkHash(record: unknown, prev: string): string;
19
+
10
20
  /**
11
21
  * @brightbeamai/chap-coordinator/canonical
12
22
  *
@@ -83,8 +93,11 @@ declare function deriveKeypair(uri: string): {
83
93
  * CoordinatorOptions.
84
94
  *
85
95
  * 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:
96
+ * apply the same review-depth and escalation rules. Routing differs: this
97
+ * routing policy takes the first candidate as given, so a first candidate
98
+ * who is not a member is refused with -32510 and one who is paused with
99
+ * -32063, where the built-in default passes over both. This factory exists
100
+ * so that the legacy call site can keep using:
88
101
  *
89
102
  * new Coordinator({ ...makeDefaultPolicy(SENIOR_URI), ... })
90
103
  *
@@ -107,7 +120,7 @@ declare function makeDefaultPolicy(seniorTarget: string): Pick<CoordinatorOption
107
120
  * happened outside CHAP, wrap it so the audit log carries a faithful,
108
121
  * citable record.
109
122
  *
110
- * Spec target: CHAP 0.2. MCP 2026-07-28. A2A 1.0.
123
+ * Spec target: CHAP 0.3. MCP 2026-07-28. A2A 1.0.
111
124
  */
112
125
 
113
126
  interface WrapMcpToolCallOptions {
@@ -127,6 +140,8 @@ interface WrapMcpToolCallOptions {
127
140
  routingHints?: Record<string, unknown>;
128
141
  /** Optional confidence value attached to task.complete. */
129
142
  confidence?: number | string;
143
+ /** Optional id of the decision this call fulfils; recorded as a ``fulfils`` link on the result artefact. Asserted by the caller and not verified by the coordinator. */
144
+ fulfils?: string;
130
145
  }
131
146
  interface WrapResult {
132
147
  task_id: string;
@@ -158,6 +173,8 @@ interface WrapA2aExchangeOptions {
158
173
  routingHints?: Record<string, unknown>;
159
174
  /** Optional confidence value attached to task.complete. */
160
175
  confidence?: number | string;
176
+ /** Optional id of the decision this exchange fulfils; recorded as a ``fulfils`` link on the result artefact. Asserted by the caller and not verified by the coordinator. */
177
+ fulfils?: string;
161
178
  }
162
179
  interface WrapA2aResult {
163
180
  task_id: string;
@@ -172,4 +189,4 @@ interface WrapA2aResult {
172
189
  */
173
190
  declare function wrapA2aMessageExchange(coord: Coordinator, workspace: string, options: WrapA2aExchangeOptions): WrapA2aResult;
174
191
 
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 };
192
+ export { AuditEntry, Coordinator, CoordinatorOptions, type Jwk as CryptoJwk, Envelope, type WrapA2aExchangeOptions, type WrapA2aResult, type WrapMcpToolCallOptions, type WrapResult, ZERO_HASH, canonicalize, contentHash, deriveKeypair, deriveSeed, entryCall, entryRecord, isRefusal, jwkFromPrivateKey, linkHash, makeDefaultPolicy, publicKeyBytes, publicKeyFromJwk, publicKeyFromRaw, sha256Hex, signEnvelope, verifyEnvelope, wrapA2aMessageExchange, wrapMcpToolCall };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,22 @@
1
- import { C as CoordinatorOptions, a as Coordinator } from './api-BOGEBNmX.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-BOGEBNmX.js';
1
+ import { C as CoordinatorOptions, a as Coordinator } from './api-Ddy9fqkY.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-Ddy9fqkY.js';
3
3
  export { MethodName, MethodParams, MethodResult, MethodTable } from './methods.js';
4
+ import { AuditEntry, Envelope } from './types.js';
5
+ export { ArtefactId, ArtefactRoutingHints, AuditListener, Deliberation, DeliberationVote, Handoff, HandoffTaskItem, JsonPatchOp, Jwk, KeyRecord, Member, Mode, OverrideArtefact, ParticipantType, ParticipantUri, PauseScope, RefusalOutcome, ReviewDecision, RouteDecisionArtefact, SnapshotArtefact, Task, TaskId, TaskRoutingHints, TaskState, WhisperPrompt, Workspace, WorkspaceId, WorkspaceState, modeLE } from './types.js';
4
6
  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
7
  export { E, isValidEnvelope, rpcError } from './jsonrpc.js';
7
8
  export { PatchError, applyJsonPatch, diffJsonPatch } from './patch.js';
8
9
  import { KeyObject } from 'node:crypto';
9
10
 
11
+ /** The value an entry's chain link hashes. */
12
+ declare function entryRecord(entry: AuditEntry): unknown;
13
+ /** The call an entry records, whether it took effect or was refused. */
14
+ declare function entryCall(entry: AuditEntry): Envelope | undefined;
15
+ /** True when an entry records a refused call. */
16
+ declare function isRefusal(entry: AuditEntry): boolean;
17
+ /** chain_head = SHA-256( JCS(record) || prev_hash ). */
18
+ declare function linkHash(record: unknown, prev: string): string;
19
+
10
20
  /**
11
21
  * @brightbeamai/chap-coordinator/canonical
12
22
  *
@@ -83,8 +93,11 @@ declare function deriveKeypair(uri: string): {
83
93
  * CoordinatorOptions.
84
94
  *
85
95
  * 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:
96
+ * apply the same review-depth and escalation rules. Routing differs: this
97
+ * routing policy takes the first candidate as given, so a first candidate
98
+ * who is not a member is refused with -32510 and one who is paused with
99
+ * -32063, where the built-in default passes over both. This factory exists
100
+ * so that the legacy call site can keep using:
88
101
  *
89
102
  * new Coordinator({ ...makeDefaultPolicy(SENIOR_URI), ... })
90
103
  *
@@ -107,7 +120,7 @@ declare function makeDefaultPolicy(seniorTarget: string): Pick<CoordinatorOption
107
120
  * happened outside CHAP, wrap it so the audit log carries a faithful,
108
121
  * citable record.
109
122
  *
110
- * Spec target: CHAP 0.2. MCP 2026-07-28. A2A 1.0.
123
+ * Spec target: CHAP 0.3. MCP 2026-07-28. A2A 1.0.
111
124
  */
112
125
 
113
126
  interface WrapMcpToolCallOptions {
@@ -127,6 +140,8 @@ interface WrapMcpToolCallOptions {
127
140
  routingHints?: Record<string, unknown>;
128
141
  /** Optional confidence value attached to task.complete. */
129
142
  confidence?: number | string;
143
+ /** Optional id of the decision this call fulfils; recorded as a ``fulfils`` link on the result artefact. Asserted by the caller and not verified by the coordinator. */
144
+ fulfils?: string;
130
145
  }
131
146
  interface WrapResult {
132
147
  task_id: string;
@@ -158,6 +173,8 @@ interface WrapA2aExchangeOptions {
158
173
  routingHints?: Record<string, unknown>;
159
174
  /** Optional confidence value attached to task.complete. */
160
175
  confidence?: number | string;
176
+ /** Optional id of the decision this exchange fulfils; recorded as a ``fulfils`` link on the result artefact. Asserted by the caller and not verified by the coordinator. */
177
+ fulfils?: string;
161
178
  }
162
179
  interface WrapA2aResult {
163
180
  task_id: string;
@@ -172,4 +189,4 @@ interface WrapA2aResult {
172
189
  */
173
190
  declare function wrapA2aMessageExchange(coord: Coordinator, workspace: string, options: WrapA2aExchangeOptions): WrapA2aResult;
174
191
 
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 };
192
+ export { AuditEntry, Coordinator, CoordinatorOptions, type Jwk as CryptoJwk, Envelope, type WrapA2aExchangeOptions, type WrapA2aResult, type WrapMcpToolCallOptions, type WrapResult, ZERO_HASH, canonicalize, contentHash, deriveKeypair, deriveSeed, entryCall, entryRecord, isRefusal, jwkFromPrivateKey, linkHash, makeDefaultPolicy, publicKeyBytes, publicKeyFromJwk, publicKeyFromRaw, sha256Hex, signEnvelope, verifyEnvelope, wrapA2aMessageExchange, wrapMcpToolCall };