@brightbeamai/chap-coordinator 0.3.4 → 0.3.5
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 +54 -8
- package/dist/{api-59aU01Bs.d.cts → api-CjZQnj63.d.cts} +128 -14
- package/dist/{api-CxciGFHA.d.ts → api-DG0VFGVr.d.ts} +128 -14
- package/dist/api.cjs +3 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +3 -1
- package/dist/api.js.map +1 -1
- package/dist/index.cjs +1336 -219
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +1336 -219
- package/dist/index.js.map +1 -1
- package/dist/jsonrpc.cjs +1 -0
- package/dist/jsonrpc.cjs.map +1 -1
- package/dist/jsonrpc.d.cts +1 -0
- package/dist/jsonrpc.d.ts +1 -0
- package/dist/jsonrpc.js +1 -0
- package/dist/jsonrpc.js.map +1 -1
- package/dist/methods.cjs.map +1 -1
- package/dist/methods.d.cts +36 -3
- package/dist/methods.d.ts +36 -3
- package/dist/storage/sqlite.cjs +81 -19
- package/dist/storage/sqlite.cjs.map +1 -1
- package/dist/storage/sqlite.d.cts +19 -9
- package/dist/storage/sqlite.d.ts +19 -9
- package/dist/storage/sqlite.js +81 -19
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/storage/store.cjs +20 -15
- package/dist/storage/store.cjs.map +1 -1
- package/dist/storage/store.d.cts +24 -6
- package/dist/storage/store.d.ts +24 -6
- package/dist/storage/store.js +20 -15
- package/dist/storage/store.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +56 -1
- package/dist/types.d.ts +56 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
package/dist/jsonrpc.cjs
CHANGED
|
@@ -65,6 +65,7 @@ var E = {
|
|
|
65
65
|
SIG_KEY_REVOKED: -32072,
|
|
66
66
|
SIG_ROTATION_KEY_MISMATCH: -32073,
|
|
67
67
|
SIG_ARTEFACT_DIGEST_MISMATCH: -32074,
|
|
68
|
+
SIG_ALREADY_ACCEPTED: -32075,
|
|
68
69
|
// audit-scitt/1.0 profile (profiles/audit-scitt.md S8)
|
|
69
70
|
SCITT_UNREACHABLE: -32080,
|
|
70
71
|
SCITT_STATEMENT_REJECTED: -32081,
|
package/dist/jsonrpc.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/jsonrpc.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator/jsonrpc\n *\n * Error codes (JSON-RPC standard + CHAP private range) and helpers.\n *\n * Error code allocations come directly from each profile spec. See\n * profiles/*.md for the authoritative definitions.\n */\n\nexport const E = {\n // JSON-RPC 2.0 standard\n PARSE: -32700,\n REQUEST: -32600,\n METHOD: -32601,\n PARAMS: -32602,\n INTERNAL: -32603,\n\n // review/1.0 profile\n NOT_REVIEWABLE: -32010,\n NOT_AUTHORISED: -32011,\n PATCH_FAILED: -32012,\n REVIEW_LAPSED: -32013,\n REVIEW_ALREADY_OPEN: -32014,\n\n // whisper/1.0 profile (profiles/whisper.md S6)\n WHISPER_ALREADY_ANSWERED: -32020,\n WHISPER_LAPSED: -32021,\n WHISPER_OPTION_NOT_IN_SET: -32022,\n\n // deliberation/1.0 profile (profiles/deliberation.md S5)\n DELIB_VOTER_NOT_IN_LIST: -32030,\n DELIB_ALREADY_VOTED: -32031,\n DELIB_CLOSED_OR_LAPSED: -32032,\n DELIB_UNKNOWN_RULE: -32033,\n\n // modes/1.0 profile (profiles/modes.md S6)\n MODE_CEILING_EXCEEDED: -32040,\n MODE_STEP_UP_REQUIRED: -32041,\n\n // handoff/1.0 profile (profiles/handoff.md S6)\n HANDOFF_TASKS_NOT_ASSIGNED_TO_PROPOSER: -32050,\n HANDOFF_ALREADY_RESOLVED: -32051,\n HANDOFF_RECIPIENT_NOT_MEMBER: -32052,\n\n // control/1.0 profile (profiles/control.md S6)\n CONTROL_STEP_UP_REQUIRED: -32060,\n CONTROL_NOT_AUTHORISED: -32061,\n CONTROL_SNAPSHOT_NOT_FOUND: -32062,\n CONTROL_WORKSPACE_PAUSED: -32063,\n\n // security-signed/1.0 profile (profiles/security-signed.md S7)\n SIG_VERIFY_FAILED: -32070,\n SIG_KEY_NOT_FOUND: -32071,\n SIG_KEY_REVOKED: -32072,\n SIG_ROTATION_KEY_MISMATCH: -32073,\n SIG_ARTEFACT_DIGEST_MISMATCH: -32074,\n\n // audit-scitt/1.0 profile (profiles/audit-scitt.md S8)\n SCITT_UNREACHABLE: -32080,\n SCITT_STATEMENT_REJECTED: -32081,\n SCITT_RECEIPT_INVALID: -32082,\n\n // identity-oidc/1.0 profile (profiles/identity-oidc.md S8)\n OIDC_STEP_UP_REQUIRED: -32402,\n OIDC_TOKEN_INVALID: -32403,\n OIDC_CNF_MISMATCH: -32404,\n OIDC_SCOPE_MISSING: -32405,\n\n // identity-vc/1.0 profile (profiles/identity-vc.md S8)\n VC_VP_INVALID: -32410,\n VC_HOLDER_BINDING_INVALID: -32411,\n VC_CREDENTIAL_REVOKED: -32412,\n VC_SCHEMA_UNKNOWN: -32413,\n\n // routing/1.0 profile (profiles/routing.md S3-S5)\n ROUTING_NO_ELIGIBLE_ASSIGNEE: -32510,\n ROUTING_POLICY_VIOLATION: -32511,\n ROUTING_AUTO_ESCALATION_TRIGGERED: -32512,\n ROUTING_CANDIDATES_EMPTY: -32513,\n ROUTING_DEPTH_NOT_APPLICABLE: -32514,\n ROUTING_POLICY_UNREACHABLE: -32515,\n ROUTING_ESC_TARGET_UNAVAILABLE: -32516,\n} as const;\n\nexport function rpcError(code: number, message: string, data?: unknown) {\n return { code, message, ...(data !== undefined ? { data } : {}) };\n}\n\nexport function isValidEnvelope(env: unknown): boolean {\n if (typeof env !== \"object\" || env === null) return false;\n const e = env as Record<string, unknown>;\n return e.jsonrpc === \"2.0\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,IAAI;AAAA;AAAA,EAEf,OAAU;AAAA,EACV,SAAU;AAAA,EACV,QAAU;AAAA,EACV,QAAU;AAAA,EACV,UAAU;AAAA;AAAA,EAGV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,cAAgB;AAAA,EAChB,eAAgB;AAAA,EAChB,qBAAqB;AAAA;AAAA,EAGrB,0BAA6B;AAAA,EAC7B,gBAA6B;AAAA,EAC7B,2BAA6B;AAAA;AAAA,EAG7B,yBAAyB;AAAA,EACzB,qBAAyB;AAAA,EACzB,wBAAyB;AAAA,EACzB,oBAAyB;AAAA;AAAA,EAGzB,uBAAyB;AAAA,EACzB,uBAAyB;AAAA;AAAA,EAGzB,wCAAwC;AAAA,EACxC,0BAAwC;AAAA,EACxC,8BAAwC;AAAA;AAAA,EAGxC,0BAA6B;AAAA,EAC7B,wBAA6B;AAAA,EAC7B,4BAA6B;AAAA,EAC7B,0BAA6B;AAAA;AAAA,EAG7B,mBAA2B;AAAA,EAC3B,mBAA2B;AAAA,EAC3B,iBAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,8BAA8B;AAAA;AAAA,EAG9B,mBAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,uBAA0B;AAAA;AAAA,EAG1B,uBAAuB;AAAA,EACvB,oBAAuB;AAAA,EACvB,mBAAuB;AAAA,EACvB,oBAAuB;AAAA;AAAA,EAGvB,eAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,uBAA2B;AAAA,EAC3B,mBAA2B;AAAA;AAAA,EAG3B,8BAAgC;AAAA,EAChC,0BAAgC;AAAA,EAChC,mCAAmC;AAAA,EACnC,0BAAgC;AAAA,EAChC,8BAAgC;AAAA,EAChC,4BAAgC;AAAA,EAChC,gCAAgC;AAClC;AAEO,SAAS,SAAS,MAAc,SAAiB,MAAgB;AACtE,SAAO,EAAE,MAAM,SAAS,GAAI,SAAS,SAAY,EAAE,KAAK,IAAI,CAAC,EAAG;AAClE;AAEO,SAAS,gBAAgB,KAAuB;AACrD,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AACpD,QAAM,IAAI;AACV,SAAO,EAAE,YAAY;AACvB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/jsonrpc.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator/jsonrpc\n *\n * Error codes (JSON-RPC standard + CHAP private range) and helpers.\n *\n * Error code allocations come directly from each profile spec. See\n * profiles/*.md for the authoritative definitions.\n */\n\nexport const E = {\n // JSON-RPC 2.0 standard\n PARSE: -32700,\n REQUEST: -32600,\n METHOD: -32601,\n PARAMS: -32602,\n INTERNAL: -32603,\n\n // review/1.0 profile\n NOT_REVIEWABLE: -32010,\n NOT_AUTHORISED: -32011,\n PATCH_FAILED: -32012,\n REVIEW_LAPSED: -32013,\n REVIEW_ALREADY_OPEN: -32014,\n\n // whisper/1.0 profile (profiles/whisper.md S6)\n WHISPER_ALREADY_ANSWERED: -32020,\n WHISPER_LAPSED: -32021,\n WHISPER_OPTION_NOT_IN_SET: -32022,\n\n // deliberation/1.0 profile (profiles/deliberation.md S5)\n DELIB_VOTER_NOT_IN_LIST: -32030,\n DELIB_ALREADY_VOTED: -32031,\n DELIB_CLOSED_OR_LAPSED: -32032,\n DELIB_UNKNOWN_RULE: -32033,\n\n // modes/1.0 profile (profiles/modes.md S6)\n MODE_CEILING_EXCEEDED: -32040,\n MODE_STEP_UP_REQUIRED: -32041,\n\n // handoff/1.0 profile (profiles/handoff.md S6)\n HANDOFF_TASKS_NOT_ASSIGNED_TO_PROPOSER: -32050,\n HANDOFF_ALREADY_RESOLVED: -32051,\n HANDOFF_RECIPIENT_NOT_MEMBER: -32052,\n\n // control/1.0 profile (profiles/control.md S6)\n CONTROL_STEP_UP_REQUIRED: -32060,\n CONTROL_NOT_AUTHORISED: -32061,\n CONTROL_SNAPSHOT_NOT_FOUND: -32062,\n CONTROL_WORKSPACE_PAUSED: -32063,\n\n // security-signed/1.0 profile (profiles/security-signed.md S7)\n SIG_VERIFY_FAILED: -32070,\n SIG_KEY_NOT_FOUND: -32071,\n SIG_KEY_REVOKED: -32072,\n SIG_ROTATION_KEY_MISMATCH: -32073,\n SIG_ARTEFACT_DIGEST_MISMATCH: -32074,\n SIG_ALREADY_ACCEPTED: -32075,\n\n // audit-scitt/1.0 profile (profiles/audit-scitt.md S8)\n SCITT_UNREACHABLE: -32080,\n SCITT_STATEMENT_REJECTED: -32081,\n SCITT_RECEIPT_INVALID: -32082,\n\n // identity-oidc/1.0 profile (profiles/identity-oidc.md S8)\n OIDC_STEP_UP_REQUIRED: -32402,\n OIDC_TOKEN_INVALID: -32403,\n OIDC_CNF_MISMATCH: -32404,\n OIDC_SCOPE_MISSING: -32405,\n\n // identity-vc/1.0 profile (profiles/identity-vc.md S8)\n VC_VP_INVALID: -32410,\n VC_HOLDER_BINDING_INVALID: -32411,\n VC_CREDENTIAL_REVOKED: -32412,\n VC_SCHEMA_UNKNOWN: -32413,\n\n // routing/1.0 profile (profiles/routing.md S3-S5)\n ROUTING_NO_ELIGIBLE_ASSIGNEE: -32510,\n ROUTING_POLICY_VIOLATION: -32511,\n ROUTING_AUTO_ESCALATION_TRIGGERED: -32512,\n ROUTING_CANDIDATES_EMPTY: -32513,\n ROUTING_DEPTH_NOT_APPLICABLE: -32514,\n ROUTING_POLICY_UNREACHABLE: -32515,\n ROUTING_ESC_TARGET_UNAVAILABLE: -32516,\n} as const;\n\nexport function rpcError(code: number, message: string, data?: unknown) {\n return { code, message, ...(data !== undefined ? { data } : {}) };\n}\n\nexport function isValidEnvelope(env: unknown): boolean {\n if (typeof env !== \"object\" || env === null) return false;\n const e = env as Record<string, unknown>;\n return e.jsonrpc === \"2.0\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,IAAI;AAAA;AAAA,EAEf,OAAU;AAAA,EACV,SAAU;AAAA,EACV,QAAU;AAAA,EACV,QAAU;AAAA,EACV,UAAU;AAAA;AAAA,EAGV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,cAAgB;AAAA,EAChB,eAAgB;AAAA,EAChB,qBAAqB;AAAA;AAAA,EAGrB,0BAA6B;AAAA,EAC7B,gBAA6B;AAAA,EAC7B,2BAA6B;AAAA;AAAA,EAG7B,yBAAyB;AAAA,EACzB,qBAAyB;AAAA,EACzB,wBAAyB;AAAA,EACzB,oBAAyB;AAAA;AAAA,EAGzB,uBAAyB;AAAA,EACzB,uBAAyB;AAAA;AAAA,EAGzB,wCAAwC;AAAA,EACxC,0BAAwC;AAAA,EACxC,8BAAwC;AAAA;AAAA,EAGxC,0BAA6B;AAAA,EAC7B,wBAA6B;AAAA,EAC7B,4BAA6B;AAAA,EAC7B,0BAA6B;AAAA;AAAA,EAG7B,mBAA2B;AAAA,EAC3B,mBAA2B;AAAA,EAC3B,iBAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,8BAA8B;AAAA,EAC9B,sBAA8B;AAAA;AAAA,EAG9B,mBAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,uBAA0B;AAAA;AAAA,EAG1B,uBAAuB;AAAA,EACvB,oBAAuB;AAAA,EACvB,mBAAuB;AAAA,EACvB,oBAAuB;AAAA;AAAA,EAGvB,eAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,uBAA2B;AAAA,EAC3B,mBAA2B;AAAA;AAAA,EAG3B,8BAAgC;AAAA,EAChC,0BAAgC;AAAA,EAChC,mCAAmC;AAAA,EACnC,0BAAgC;AAAA,EAChC,8BAAgC;AAAA,EAChC,4BAAgC;AAAA,EAChC,gCAAgC;AAClC;AAEO,SAAS,SAAS,MAAc,SAAiB,MAAgB;AACtE,SAAO,EAAE,MAAM,SAAS,GAAI,SAAS,SAAY,EAAE,KAAK,IAAI,CAAC,EAAG;AAClE;AAEO,SAAS,gBAAgB,KAAuB;AACrD,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AACpD,QAAM,IAAI;AACV,SAAO,EAAE,YAAY;AACvB;","names":[]}
|
package/dist/jsonrpc.d.cts
CHANGED
|
@@ -38,6 +38,7 @@ declare const E: {
|
|
|
38
38
|
readonly SIG_KEY_REVOKED: -32072;
|
|
39
39
|
readonly SIG_ROTATION_KEY_MISMATCH: -32073;
|
|
40
40
|
readonly SIG_ARTEFACT_DIGEST_MISMATCH: -32074;
|
|
41
|
+
readonly SIG_ALREADY_ACCEPTED: -32075;
|
|
41
42
|
readonly SCITT_UNREACHABLE: -32080;
|
|
42
43
|
readonly SCITT_STATEMENT_REJECTED: -32081;
|
|
43
44
|
readonly SCITT_RECEIPT_INVALID: -32082;
|
package/dist/jsonrpc.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare const E: {
|
|
|
38
38
|
readonly SIG_KEY_REVOKED: -32072;
|
|
39
39
|
readonly SIG_ROTATION_KEY_MISMATCH: -32073;
|
|
40
40
|
readonly SIG_ARTEFACT_DIGEST_MISMATCH: -32074;
|
|
41
|
+
readonly SIG_ALREADY_ACCEPTED: -32075;
|
|
41
42
|
readonly SCITT_UNREACHABLE: -32080;
|
|
42
43
|
readonly SCITT_STATEMENT_REJECTED: -32081;
|
|
43
44
|
readonly SCITT_RECEIPT_INVALID: -32082;
|
package/dist/jsonrpc.js
CHANGED
|
@@ -39,6 +39,7 @@ var E = {
|
|
|
39
39
|
SIG_KEY_REVOKED: -32072,
|
|
40
40
|
SIG_ROTATION_KEY_MISMATCH: -32073,
|
|
41
41
|
SIG_ARTEFACT_DIGEST_MISMATCH: -32074,
|
|
42
|
+
SIG_ALREADY_ACCEPTED: -32075,
|
|
42
43
|
// audit-scitt/1.0 profile (profiles/audit-scitt.md S8)
|
|
43
44
|
SCITT_UNREACHABLE: -32080,
|
|
44
45
|
SCITT_STATEMENT_REJECTED: -32081,
|
package/dist/jsonrpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/jsonrpc.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator/jsonrpc\n *\n * Error codes (JSON-RPC standard + CHAP private range) and helpers.\n *\n * Error code allocations come directly from each profile spec. See\n * profiles/*.md for the authoritative definitions.\n */\n\nexport const E = {\n // JSON-RPC 2.0 standard\n PARSE: -32700,\n REQUEST: -32600,\n METHOD: -32601,\n PARAMS: -32602,\n INTERNAL: -32603,\n\n // review/1.0 profile\n NOT_REVIEWABLE: -32010,\n NOT_AUTHORISED: -32011,\n PATCH_FAILED: -32012,\n REVIEW_LAPSED: -32013,\n REVIEW_ALREADY_OPEN: -32014,\n\n // whisper/1.0 profile (profiles/whisper.md S6)\n WHISPER_ALREADY_ANSWERED: -32020,\n WHISPER_LAPSED: -32021,\n WHISPER_OPTION_NOT_IN_SET: -32022,\n\n // deliberation/1.0 profile (profiles/deliberation.md S5)\n DELIB_VOTER_NOT_IN_LIST: -32030,\n DELIB_ALREADY_VOTED: -32031,\n DELIB_CLOSED_OR_LAPSED: -32032,\n DELIB_UNKNOWN_RULE: -32033,\n\n // modes/1.0 profile (profiles/modes.md S6)\n MODE_CEILING_EXCEEDED: -32040,\n MODE_STEP_UP_REQUIRED: -32041,\n\n // handoff/1.0 profile (profiles/handoff.md S6)\n HANDOFF_TASKS_NOT_ASSIGNED_TO_PROPOSER: -32050,\n HANDOFF_ALREADY_RESOLVED: -32051,\n HANDOFF_RECIPIENT_NOT_MEMBER: -32052,\n\n // control/1.0 profile (profiles/control.md S6)\n CONTROL_STEP_UP_REQUIRED: -32060,\n CONTROL_NOT_AUTHORISED: -32061,\n CONTROL_SNAPSHOT_NOT_FOUND: -32062,\n CONTROL_WORKSPACE_PAUSED: -32063,\n\n // security-signed/1.0 profile (profiles/security-signed.md S7)\n SIG_VERIFY_FAILED: -32070,\n SIG_KEY_NOT_FOUND: -32071,\n SIG_KEY_REVOKED: -32072,\n SIG_ROTATION_KEY_MISMATCH: -32073,\n SIG_ARTEFACT_DIGEST_MISMATCH: -32074,\n\n // audit-scitt/1.0 profile (profiles/audit-scitt.md S8)\n SCITT_UNREACHABLE: -32080,\n SCITT_STATEMENT_REJECTED: -32081,\n SCITT_RECEIPT_INVALID: -32082,\n\n // identity-oidc/1.0 profile (profiles/identity-oidc.md S8)\n OIDC_STEP_UP_REQUIRED: -32402,\n OIDC_TOKEN_INVALID: -32403,\n OIDC_CNF_MISMATCH: -32404,\n OIDC_SCOPE_MISSING: -32405,\n\n // identity-vc/1.0 profile (profiles/identity-vc.md S8)\n VC_VP_INVALID: -32410,\n VC_HOLDER_BINDING_INVALID: -32411,\n VC_CREDENTIAL_REVOKED: -32412,\n VC_SCHEMA_UNKNOWN: -32413,\n\n // routing/1.0 profile (profiles/routing.md S3-S5)\n ROUTING_NO_ELIGIBLE_ASSIGNEE: -32510,\n ROUTING_POLICY_VIOLATION: -32511,\n ROUTING_AUTO_ESCALATION_TRIGGERED: -32512,\n ROUTING_CANDIDATES_EMPTY: -32513,\n ROUTING_DEPTH_NOT_APPLICABLE: -32514,\n ROUTING_POLICY_UNREACHABLE: -32515,\n ROUTING_ESC_TARGET_UNAVAILABLE: -32516,\n} as const;\n\nexport function rpcError(code: number, message: string, data?: unknown) {\n return { code, message, ...(data !== undefined ? { data } : {}) };\n}\n\nexport function isValidEnvelope(env: unknown): boolean {\n if (typeof env !== \"object\" || env === null) return false;\n const e = env as Record<string, unknown>;\n return e.jsonrpc === \"2.0\";\n}\n"],"mappings":";AASO,IAAM,IAAI;AAAA;AAAA,EAEf,OAAU;AAAA,EACV,SAAU;AAAA,EACV,QAAU;AAAA,EACV,QAAU;AAAA,EACV,UAAU;AAAA;AAAA,EAGV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,cAAgB;AAAA,EAChB,eAAgB;AAAA,EAChB,qBAAqB;AAAA;AAAA,EAGrB,0BAA6B;AAAA,EAC7B,gBAA6B;AAAA,EAC7B,2BAA6B;AAAA;AAAA,EAG7B,yBAAyB;AAAA,EACzB,qBAAyB;AAAA,EACzB,wBAAyB;AAAA,EACzB,oBAAyB;AAAA;AAAA,EAGzB,uBAAyB;AAAA,EACzB,uBAAyB;AAAA;AAAA,EAGzB,wCAAwC;AAAA,EACxC,0BAAwC;AAAA,EACxC,8BAAwC;AAAA;AAAA,EAGxC,0BAA6B;AAAA,EAC7B,wBAA6B;AAAA,EAC7B,4BAA6B;AAAA,EAC7B,0BAA6B;AAAA;AAAA,EAG7B,mBAA2B;AAAA,EAC3B,mBAA2B;AAAA,EAC3B,iBAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,8BAA8B;AAAA;AAAA,EAG9B,mBAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,uBAA0B;AAAA;AAAA,EAG1B,uBAAuB;AAAA,EACvB,oBAAuB;AAAA,EACvB,mBAAuB;AAAA,EACvB,oBAAuB;AAAA;AAAA,EAGvB,eAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,uBAA2B;AAAA,EAC3B,mBAA2B;AAAA;AAAA,EAG3B,8BAAgC;AAAA,EAChC,0BAAgC;AAAA,EAChC,mCAAmC;AAAA,EACnC,0BAAgC;AAAA,EAChC,8BAAgC;AAAA,EAChC,4BAAgC;AAAA,EAChC,gCAAgC;AAClC;AAEO,SAAS,SAAS,MAAc,SAAiB,MAAgB;AACtE,SAAO,EAAE,MAAM,SAAS,GAAI,SAAS,SAAY,EAAE,KAAK,IAAI,CAAC,EAAG;AAClE;AAEO,SAAS,gBAAgB,KAAuB;AACrD,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AACpD,QAAM,IAAI;AACV,SAAO,EAAE,YAAY;AACvB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/jsonrpc.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator/jsonrpc\n *\n * Error codes (JSON-RPC standard + CHAP private range) and helpers.\n *\n * Error code allocations come directly from each profile spec. See\n * profiles/*.md for the authoritative definitions.\n */\n\nexport const E = {\n // JSON-RPC 2.0 standard\n PARSE: -32700,\n REQUEST: -32600,\n METHOD: -32601,\n PARAMS: -32602,\n INTERNAL: -32603,\n\n // review/1.0 profile\n NOT_REVIEWABLE: -32010,\n NOT_AUTHORISED: -32011,\n PATCH_FAILED: -32012,\n REVIEW_LAPSED: -32013,\n REVIEW_ALREADY_OPEN: -32014,\n\n // whisper/1.0 profile (profiles/whisper.md S6)\n WHISPER_ALREADY_ANSWERED: -32020,\n WHISPER_LAPSED: -32021,\n WHISPER_OPTION_NOT_IN_SET: -32022,\n\n // deliberation/1.0 profile (profiles/deliberation.md S5)\n DELIB_VOTER_NOT_IN_LIST: -32030,\n DELIB_ALREADY_VOTED: -32031,\n DELIB_CLOSED_OR_LAPSED: -32032,\n DELIB_UNKNOWN_RULE: -32033,\n\n // modes/1.0 profile (profiles/modes.md S6)\n MODE_CEILING_EXCEEDED: -32040,\n MODE_STEP_UP_REQUIRED: -32041,\n\n // handoff/1.0 profile (profiles/handoff.md S6)\n HANDOFF_TASKS_NOT_ASSIGNED_TO_PROPOSER: -32050,\n HANDOFF_ALREADY_RESOLVED: -32051,\n HANDOFF_RECIPIENT_NOT_MEMBER: -32052,\n\n // control/1.0 profile (profiles/control.md S6)\n CONTROL_STEP_UP_REQUIRED: -32060,\n CONTROL_NOT_AUTHORISED: -32061,\n CONTROL_SNAPSHOT_NOT_FOUND: -32062,\n CONTROL_WORKSPACE_PAUSED: -32063,\n\n // security-signed/1.0 profile (profiles/security-signed.md S7)\n SIG_VERIFY_FAILED: -32070,\n SIG_KEY_NOT_FOUND: -32071,\n SIG_KEY_REVOKED: -32072,\n SIG_ROTATION_KEY_MISMATCH: -32073,\n SIG_ARTEFACT_DIGEST_MISMATCH: -32074,\n SIG_ALREADY_ACCEPTED: -32075,\n\n // audit-scitt/1.0 profile (profiles/audit-scitt.md S8)\n SCITT_UNREACHABLE: -32080,\n SCITT_STATEMENT_REJECTED: -32081,\n SCITT_RECEIPT_INVALID: -32082,\n\n // identity-oidc/1.0 profile (profiles/identity-oidc.md S8)\n OIDC_STEP_UP_REQUIRED: -32402,\n OIDC_TOKEN_INVALID: -32403,\n OIDC_CNF_MISMATCH: -32404,\n OIDC_SCOPE_MISSING: -32405,\n\n // identity-vc/1.0 profile (profiles/identity-vc.md S8)\n VC_VP_INVALID: -32410,\n VC_HOLDER_BINDING_INVALID: -32411,\n VC_CREDENTIAL_REVOKED: -32412,\n VC_SCHEMA_UNKNOWN: -32413,\n\n // routing/1.0 profile (profiles/routing.md S3-S5)\n ROUTING_NO_ELIGIBLE_ASSIGNEE: -32510,\n ROUTING_POLICY_VIOLATION: -32511,\n ROUTING_AUTO_ESCALATION_TRIGGERED: -32512,\n ROUTING_CANDIDATES_EMPTY: -32513,\n ROUTING_DEPTH_NOT_APPLICABLE: -32514,\n ROUTING_POLICY_UNREACHABLE: -32515,\n ROUTING_ESC_TARGET_UNAVAILABLE: -32516,\n} as const;\n\nexport function rpcError(code: number, message: string, data?: unknown) {\n return { code, message, ...(data !== undefined ? { data } : {}) };\n}\n\nexport function isValidEnvelope(env: unknown): boolean {\n if (typeof env !== \"object\" || env === null) return false;\n const e = env as Record<string, unknown>;\n return e.jsonrpc === \"2.0\";\n}\n"],"mappings":";AASO,IAAM,IAAI;AAAA;AAAA,EAEf,OAAU;AAAA,EACV,SAAU;AAAA,EACV,QAAU;AAAA,EACV,QAAU;AAAA,EACV,UAAU;AAAA;AAAA,EAGV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,cAAgB;AAAA,EAChB,eAAgB;AAAA,EAChB,qBAAqB;AAAA;AAAA,EAGrB,0BAA6B;AAAA,EAC7B,gBAA6B;AAAA,EAC7B,2BAA6B;AAAA;AAAA,EAG7B,yBAAyB;AAAA,EACzB,qBAAyB;AAAA,EACzB,wBAAyB;AAAA,EACzB,oBAAyB;AAAA;AAAA,EAGzB,uBAAyB;AAAA,EACzB,uBAAyB;AAAA;AAAA,EAGzB,wCAAwC;AAAA,EACxC,0BAAwC;AAAA,EACxC,8BAAwC;AAAA;AAAA,EAGxC,0BAA6B;AAAA,EAC7B,wBAA6B;AAAA,EAC7B,4BAA6B;AAAA,EAC7B,0BAA6B;AAAA;AAAA,EAG7B,mBAA2B;AAAA,EAC3B,mBAA2B;AAAA,EAC3B,iBAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,8BAA8B;AAAA,EAC9B,sBAA8B;AAAA;AAAA,EAG9B,mBAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,uBAA0B;AAAA;AAAA,EAG1B,uBAAuB;AAAA,EACvB,oBAAuB;AAAA,EACvB,mBAAuB;AAAA,EACvB,oBAAuB;AAAA;AAAA,EAGvB,eAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,uBAA2B;AAAA,EAC3B,mBAA2B;AAAA;AAAA,EAG3B,8BAAgC;AAAA,EAChC,0BAAgC;AAAA,EAChC,mCAAmC;AAAA,EACnC,0BAAgC;AAAA,EAChC,8BAAgC;AAAA,EAChC,4BAAgC;AAAA,EAChC,gCAAgC;AAClC;AAEO,SAAS,SAAS,MAAc,SAAiB,MAAgB;AACtE,SAAO,EAAE,MAAM,SAAS,GAAI,SAAS,SAAY,EAAE,KAAK,IAAI,CAAC,EAAG;AAClE;AAEO,SAAS,gBAAgB,KAAuB;AACrD,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AACpD,QAAM,IAAI;AACV,SAAO,EAAE,YAAY;AACvB;","names":[]}
|
package/dist/methods.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/methods.ts"],"sourcesContent":["/**\n * Typed method definitions.\n *\n * Every CHAP method that ships in either reference implementation\n * gets a typed `Params` and `Result` shape here. The Coordinator's\n * typed facade (`coord.workspace.create`, `coord.task.complete`, …)\n * uses these types so callers get autocomplete and compile-time\n * checking without having to remember field names.\n *\n * These types are hand-maintained against the canonical JSON Schemas\n * under `schemas/`. A future revision will generate this file from\n * the schemas automatically; for now the source of truth remains\n * the running tests under `tests/`.\n *\n * Scope: 39 method handlers shipped by both reference\n * implementations (Core + every shipped profile). Spec-only methods\n * are excluded - they would mislead callers into thinking the local\n * Coordinator can dispatch them.\n */\n\nimport type {\n ArtefactId, JsonPatchOp, ParticipantUri, TaskId,\n Workspace, WorkspaceId,\n} from \"./types.js\";\n\n// ---- shared building blocks ---------------------------------------\n\nexport interface WorkspaceParam { workspace: WorkspaceId }\nexport interface ActorParam { from: ParticipantUri }\nexport interface TaskParam { task_id: TaskId }\n\nexport interface OkResult { ok: true }\n\n// ============================================================\n// workspace.*\n// ============================================================\n\nexport interface WorkspaceCreateParams extends Partial<WorkspaceParam> {\n profiles?: string[];\n routing_policy_uri?: string;\n mode?: \"shadow\" | \"trial\" | \"production\";\n mode_ceiling?: \"shadow\" | \"trial\" | \"production\";\n}\nexport interface WorkspaceCreateResult { workspace: WorkspaceId }\n\nexport interface WorkspaceDescribeParams extends WorkspaceParam {}\nexport interface WorkspaceDescribeResult { workspace: Workspace }\n\nexport interface WorkspaceSetProfilesParams extends WorkspaceParam, ActorParam {\n profiles: string[];\n}\nexport type WorkspaceSetProfilesResult = OkResult;\n\n// ============================================================\n// participant.*\n// ============================================================\n\nexport interface ParticipantJoinParams extends WorkspaceParam, ActorParam {\n type: \"human\" | \"agent\" | \"service\" | \"group\" | \"workspace\";\n role?: string;\n scopes?: string[];\n capabilities?: Record<string, unknown>;\n oidc_token?: unknown;\n vc?: unknown;\n pubkey?: unknown;\n}\nexport type ParticipantJoinResult = OkResult;\n\nexport interface ParticipantLeaveParams extends WorkspaceParam, ActorParam {\n reason?: string;\n}\nexport type ParticipantLeaveResult = OkResult;\n\nexport interface ParticipantRotateKeyParams extends WorkspaceParam, ActorParam {\n pubkey: unknown;\n reason?: string;\n}\nexport type ParticipantRotateKeyResult = OkResult;\n\nexport interface ParticipantRevokeKeyParams extends WorkspaceParam, ActorParam {\n kid: string;\n reason?: string;\n}\nexport type ParticipantRevokeKeyResult = OkResult;\n\n// ============================================================\n// task.*\n// ============================================================\n\nexport interface TaskCreateParams extends WorkspaceParam, ActorParam {\n kind: string;\n input: unknown;\n assignee?: ParticipantUri;\n to?: ParticipantUri; // alias for assignee\n routing_hints?: Record<string, unknown>;\n deadline?: string;\n idempotency_key?: string;\n}\nexport interface TaskCreateResult { task_id: TaskId }\n\nexport interface TaskUpdateParams extends WorkspaceParam, ActorParam, TaskParam {\n state?: string;\n output?: unknown;\n progress?: Record<string, unknown>;\n}\nexport type TaskUpdateResult = OkResult;\n\nexport interface TaskCompleteParams extends WorkspaceParam, ActorParam, TaskParam {\n output?: unknown;\n confidence?: number | string;\n}\nexport type TaskCompleteResult = OkResult;\n\n// ============================================================\n// review.* and decide.*\n// ============================================================\n\nexport interface ReviewRequestParams extends WorkspaceParam, ActorParam, TaskParam {\n artefact: unknown;\n to: ParticipantUri | ParticipantUri[];\n rule?: string;\n deadline?: string;\n}\nexport interface ReviewRequestResult { state: string; review_id: TaskId }\n\nexport interface DecideApproveParams extends WorkspaceParam, ActorParam, TaskParam {\n rationale?: string;\n}\nexport type DecideApproveResult = OkResult;\n\nexport interface DecideRejectParams extends WorkspaceParam, ActorParam, TaskParam {\n rationale: string;\n category?: string;\n}\nexport type DecideRejectResult = OkResult;\n\nexport interface DecideOverrideParams extends WorkspaceParam, ActorParam, TaskParam {\n diff: JsonPatchOp[];\n rationale: string;\n tags?: string[];\n policy_refs?: string[];\n logical_id?: string;\n instance_id?: string;\n intent_preserved?: boolean;\n based_on_artefact?: unknown;\n}\nexport interface DecideOverrideResult {\n state: \"completed\";\n override_artefact_id: ArtefactId;\n applied: unknown;\n}\n\nexport interface AbstainDeclareParams extends WorkspaceParam, ActorParam, TaskParam {\n category: string;\n rationale?: string;\n}\nexport type AbstainDeclareResult = OkResult;\n\nexport interface EscalateRaiseParams extends WorkspaceParam, ActorParam, TaskParam {\n to?: ParticipantUri;\n rationale?: string;\n}\nexport interface EscalateRaiseResult { ok: true; to?: ParticipantUri }\n\n// ============================================================\n// whisper.* (whisper/1.0)\n// ============================================================\n\nexport interface WhisperAskParams extends WorkspaceParam, ActorParam, TaskParam {\n to: ParticipantUri;\n question: string;\n options?: string[];\n default_on_lapse?: string;\n lapse_ms?: number;\n}\nexport interface WhisperAskResult { whisper_id: string }\n\nexport interface WhisperAnswerParams extends WorkspaceParam, ActorParam {\n whisper_id: string;\n answer: string;\n}\nexport type WhisperAnswerResult = OkResult;\n\n// ============================================================\n// deliberate.* (deliberation/1.0)\n// ============================================================\n\nexport interface DeliberateOpenParams extends WorkspaceParam, ActorParam, TaskParam {\n rule: Record<string, unknown>;\n proposition: unknown;\n voters: ParticipantUri[];\n}\nexport interface DeliberateOpenResult { deliberation_id: string }\n\nexport interface DeliberateCommentParams extends WorkspaceParam, ActorParam {\n deliberation_id: string;\n text: string;\n}\nexport type DeliberateCommentResult = OkResult;\n\nexport interface DeliberateVoteParams extends WorkspaceParam, ActorParam {\n deliberation_id: string;\n vote: \"yea\" | \"nay\" | \"abstain\";\n weight?: number;\n rationale?: string;\n}\nexport type DeliberateVoteResult = OkResult;\n\nexport interface DeliberateCloseParams extends WorkspaceParam, ActorParam {\n deliberation_id: string;\n}\nexport interface DeliberateCloseResult { outcome: \"approved\" | \"rejected\" | \"no_quorum\" }\n\n// ============================================================\n// handoff.* (handoff/1.0)\n// ============================================================\n\nexport interface HandoffProposeParams extends WorkspaceParam, ActorParam {\n to: ParticipantUri;\n task_ids: TaskId[];\n summary: string;\n active_constraints?: Record<string, unknown>;\n}\nexport interface HandoffProposeResult { handoff_id: string }\n\nexport interface HandoffAcceptParams extends WorkspaceParam, ActorParam {\n handoff_id: string;\n}\nexport type HandoffAcceptResult = OkResult;\n\nexport interface HandoffDeclineParams extends WorkspaceParam, ActorParam {\n handoff_id: string;\n reason?: string;\n}\nexport type HandoffDeclineResult = OkResult;\n\n// ============================================================\n// control.* (control/1.0)\n// ============================================================\n\nexport interface ControlPauseParams extends WorkspaceParam, ActorParam {\n reason?: string;\n}\nexport type ControlPauseResult = OkResult;\n\nexport interface ControlResumeParams extends WorkspaceParam, ActorParam {\n reason?: string;\n}\nexport type ControlResumeResult = OkResult;\n\nexport interface ControlCancelParams extends WorkspaceParam, ActorParam, TaskParam {\n reason?: string;\n}\nexport type ControlCancelResult = OkResult;\n\nexport interface ControlSupersedeParams extends WorkspaceParam, ActorParam, TaskParam {\n replacement: unknown;\n logical_id?: string;\n intent_preserved?: boolean;\n reason?: string;\n}\nexport interface ControlSupersedeResult { artefact_id: ArtefactId }\n\nexport interface ControlSnapshotParams extends WorkspaceParam, ActorParam {\n label?: string;\n}\nexport interface ControlSnapshotResult { snapshot_id: string }\n\nexport interface ControlRollbackParams extends WorkspaceParam, ActorParam {\n snapshot_id: string;\n reason?: string;\n}\nexport type ControlRollbackResult = OkResult;\n\nexport interface ControlSetModeCeilingParams extends WorkspaceParam, ActorParam {\n ceiling: \"shadow\" | \"trial\" | \"production\";\n}\nexport type ControlSetModeCeilingResult = OkResult;\n\n// ============================================================\n// routing.* (routing/1.0)\n// ============================================================\n\nexport interface TaskRouteParams extends WorkspaceParam, ActorParam, TaskParam {\n candidates: ParticipantUri[];\n}\nexport interface TaskRouteResult {\n selected: ParticipantUri;\n rationale: Record<string, unknown>;\n}\n\nexport interface ReviewDepthParams extends WorkspaceParam, ActorParam, TaskParam {\n artefact?: unknown;\n hints?: Record<string, unknown>;\n}\nexport interface ReviewDepthResult {\n depth: \"skip\" | \"spot_check\" | \"full\" | \"escalated\";\n sampling_probability?: number;\n rationale: Record<string, unknown>;\n}\n\nexport interface EscalateAutoParams extends WorkspaceParam, ActorParam, TaskParam {\n hints?: Record<string, unknown>;\n}\nexport interface EscalateAutoResult {\n escalated: boolean;\n to?: ParticipantUri;\n triggered_rule?: Record<string, unknown>;\n}\n\n// ============================================================\n// audit.* (Core + audit-scitt/1.0)\n// ============================================================\n\nexport interface AuditReadParams extends WorkspaceParam {\n from_seq?: number;\n limit?: number;\n}\nexport interface AuditReadResult { entries: unknown[] }\n\nexport interface AuditSubmitToScittParams extends WorkspaceParam, ActorParam {\n seq: number;\n statement?: Record<string, unknown>;\n}\nexport interface AuditSubmitToScittResult { receipt: Record<string, unknown> }\n\nexport interface AuditVerifyReceiptParams extends WorkspaceParam {\n receipt: Record<string, unknown>;\n}\nexport interface AuditVerifyReceiptResult { valid: boolean }\n\nexport interface AuditVerifyChainParams extends WorkspaceParam {\n /** Not implemented. Supplying either is refused; see SPECIFICATION.md 10.2. */\n from_seq?: number;\n /** Not implemented. Supplying either is refused; see SPECIFICATION.md 10.2. */\n to_seq?: number;\n}\n/**\n * The verdict of a local prev_hash chain replay.\n *\n * `status` is terminal and the three outcomes are mutually exclusive: a\n * broken chain is a JSON-RPC error, an unevaluated range is\n * `not_evaluated`, and `verified` requires complete coverage. A caller\n * reading `ok` alone therefore fails closed on a range that was never\n * checked, instead of taking a pass over entries no evidence covers.\n */\nexport interface AuditVerifyChainResult {\n status: \"verified\" | \"not_evaluated\";\n /** True only when `status` is \"verified\". Never true beside a gap. */\n ok: boolean;\n /** Present only when `status` is \"not_evaluated\". */\n reason?: \"unchained_prefix\";\n entries_total: number;\n entries_checked: number;\n entries_unchecked: number;\n /** Seq of the first entry inside coverage; null when nothing was checked. */\n checked_from_seq: number | null;\n chain_head: string;\n}\n\n// ============================================================\n// Method-name → {params, result} map (single source of truth)\n// ============================================================\n\nexport interface MethodTable {\n \"workspace.create\": { params: WorkspaceCreateParams, result: WorkspaceCreateResult };\n \"workspace.describe\": { params: WorkspaceDescribeParams, result: WorkspaceDescribeResult };\n \"workspace.set_profiles\": { params: WorkspaceSetProfilesParams, result: WorkspaceSetProfilesResult };\n\n \"participant.join\": { params: ParticipantJoinParams, result: ParticipantJoinResult };\n \"participant.leave\": { params: ParticipantLeaveParams, result: ParticipantLeaveResult };\n \"participant.rotate_key\": { params: ParticipantRotateKeyParams, result: ParticipantRotateKeyResult };\n \"participant.revoke_key\": { params: ParticipantRevokeKeyParams, result: ParticipantRevokeKeyResult };\n\n \"task.create\": { params: TaskCreateParams, result: TaskCreateResult };\n \"task.update\": { params: TaskUpdateParams, result: TaskUpdateResult };\n \"task.complete\": { params: TaskCompleteParams, result: TaskCompleteResult };\n\n \"review.request\": { params: ReviewRequestParams, result: ReviewRequestResult };\n \"decide.approve\": { params: DecideApproveParams, result: DecideApproveResult };\n \"decide.reject\": { params: DecideRejectParams, result: DecideRejectResult };\n \"decide.override\": { params: DecideOverrideParams, result: DecideOverrideResult };\n \"abstain.declare\": { params: AbstainDeclareParams, result: AbstainDeclareResult };\n \"escalate.raise\": { params: EscalateRaiseParams, result: EscalateRaiseResult };\n\n \"whisper.ask\": { params: WhisperAskParams, result: WhisperAskResult };\n \"whisper.answer\": { params: WhisperAnswerParams, result: WhisperAnswerResult };\n\n \"deliberate.open\": { params: DeliberateOpenParams, result: DeliberateOpenResult };\n \"deliberate.comment\": { params: DeliberateCommentParams, result: DeliberateCommentResult };\n \"deliberate.vote\": { params: DeliberateVoteParams, result: DeliberateVoteResult };\n \"deliberate.close\": { params: DeliberateCloseParams, result: DeliberateCloseResult };\n\n \"handoff.propose\": { params: HandoffProposeParams, result: HandoffProposeResult };\n \"handoff.accept\": { params: HandoffAcceptParams, result: HandoffAcceptResult };\n \"handoff.decline\": { params: HandoffDeclineParams, result: HandoffDeclineResult };\n\n \"control.pause\": { params: ControlPauseParams, result: ControlPauseResult };\n \"control.resume\": { params: ControlResumeParams, result: ControlResumeResult };\n \"control.cancel\": { params: ControlCancelParams, result: ControlCancelResult };\n \"control.supersede\": { params: ControlSupersedeParams, result: ControlSupersedeResult };\n \"control.snapshot\": { params: ControlSnapshotParams, result: ControlSnapshotResult };\n \"control.rollback\": { params: ControlRollbackParams, result: ControlRollbackResult };\n \"control.set_mode_ceiling\": { params: ControlSetModeCeilingParams, result: ControlSetModeCeilingResult };\n\n \"task.route\": { params: TaskRouteParams, result: TaskRouteResult };\n \"review.depth\": { params: ReviewDepthParams, result: ReviewDepthResult };\n \"escalate.auto\": { params: EscalateAutoParams, result: EscalateAutoResult };\n\n \"audit.read\": { params: AuditReadParams, result: AuditReadResult };\n \"audit.submit_to_scitt\": { params: AuditSubmitToScittParams, result: AuditSubmitToScittResult };\n \"audit.verify_receipt\": { params: AuditVerifyReceiptParams, result: AuditVerifyReceiptResult };\n \"audit.verify_chain\": { params: AuditVerifyChainParams, result: AuditVerifyChainResult };\n}\n\nexport type MethodName = keyof MethodTable;\nexport type MethodParams<M extends MethodName> = MethodTable[M][\"params\"];\nexport type MethodResult<M extends MethodName> = MethodTable[M][\"result\"];\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/methods.ts"],"sourcesContent":["/**\n * Typed method definitions.\n *\n * Every CHAP method that ships in either reference implementation\n * gets a typed `Params` and `Result` shape here. The Coordinator's\n * typed facade (`coord.workspace.create`, `coord.task.complete`, …)\n * uses these types so callers get autocomplete and compile-time\n * checking without having to remember field names.\n *\n * These types are hand-maintained against the canonical JSON Schemas\n * under `schemas/`. A future revision will generate this file from\n * the schemas automatically; for now the source of truth remains\n * the running tests under `tests/`.\n *\n * Scope: 40 method handlers shipped by both reference\n * implementations (Core + every shipped profile). Spec-only methods\n * are excluded - they would mislead callers into thinking the local\n * Coordinator can dispatch them.\n */\n\nimport type {\n ArtefactId, JoinPolicy, JsonPatchOp, ParticipantType, ParticipantUri, SignaturePolicy, TaskId,\n Workspace, WorkspaceId,\n} from \"./types.js\";\n\n// ---- shared building blocks ---------------------------------------\n\nexport interface WorkspaceParam { workspace: WorkspaceId }\nexport interface ActorParam { from: ParticipantUri }\nexport interface TaskParam { task_id: TaskId }\n\nexport interface OkResult { ok: true }\n\n// ============================================================\n// workspace.*\n// ============================================================\n\nexport interface WorkspaceCreateParams extends Partial<WorkspaceParam> {\n profiles?: string[];\n routing_policy_uri?: string;\n mode?: \"shadow\" | \"trial\" | \"production\";\n mode_ceiling?: \"shadow\" | \"trial\" | \"production\";\n signature_policy?: SignaturePolicy;\n join_policy?: JoinPolicy;\n review_rule?: string;\n}\nexport interface WorkspaceCreateResult { workspace: WorkspaceId }\n\nexport interface WorkspaceDescribeParams extends WorkspaceParam {}\nexport interface WorkspaceDescribeResult { workspace: Workspace }\n\nexport interface WorkspaceSetProfilesParams extends WorkspaceParam, ActorParam {\n profiles: string[];\n}\nexport type WorkspaceSetProfilesResult = OkResult;\n\nexport interface WorkspaceInviteParams extends WorkspaceParam, ActorParam {\n uri: ParticipantUri;\n type: ParticipantType;\n role?: string;\n jwks?: { keys: Array<Record<string, unknown>> };\n oidc_sub?: string;\n}\nexport interface WorkspaceInviteResult {\n invited: true;\n uri: ParticipantUri;\n /** The kids registered, where the invitation was for a member that held no key in force. */\n registered?: string[];\n}\n\n// ============================================================\n// participant.*\n// ============================================================\n\nexport interface ParticipantJoinParams extends WorkspaceParam, ActorParam {\n type: \"human\" | \"agent\" | \"service\" | \"group\" | \"workspace\";\n role?: string;\n scopes?: string[];\n capabilities?: Record<string, unknown>;\n oidc_token?: unknown;\n vc?: unknown;\n pubkey?: unknown;\n}\nexport type ParticipantJoinResult = OkResult;\n\nexport interface ParticipantLeaveParams extends WorkspaceParam, ActorParam {\n reason?: string;\n}\nexport type ParticipantLeaveResult = OkResult;\n\nexport interface ParticipantRotateKeyParams extends WorkspaceParam, ActorParam {\n pubkey: unknown;\n reason?: string;\n}\nexport type ParticipantRotateKeyResult = OkResult;\n\nexport interface ParticipantRevokeKeyParams extends WorkspaceParam, ActorParam {\n kid: string;\n reason?: string;\n}\nexport type ParticipantRevokeKeyResult = OkResult;\n\n// ============================================================\n// task.*\n// ============================================================\n\nexport interface TaskCreateParams extends WorkspaceParam, ActorParam {\n kind: string;\n input: unknown;\n assignee?: ParticipantUri;\n to?: ParticipantUri; // alias for assignee\n routing_hints?: Record<string, unknown>;\n deadline?: string;\n idempotency_key?: string;\n}\nexport interface TaskCreateResult { task_id: TaskId }\n\nexport interface TaskUpdateParams extends WorkspaceParam, ActorParam, TaskParam {\n state?: string;\n output?: unknown;\n progress?: Record<string, unknown>;\n}\nexport type TaskUpdateResult = OkResult;\n\nexport interface TaskCompleteParams extends WorkspaceParam, ActorParam, TaskParam {\n output?: unknown;\n confidence?: number | string;\n}\nexport type TaskCompleteResult = OkResult;\n\n// ============================================================\n// review.* and decide.*\n// ============================================================\n\nexport interface ReviewRequestParams extends WorkspaceParam, ActorParam, TaskParam {\n artefact: unknown;\n to: ParticipantUri | ParticipantUri[];\n rule?: string;\n deadline?: string;\n}\nexport interface ReviewRequestResult { state: string; review_id: TaskId }\n\nexport interface ReviewAcknowledgeParams extends WorkspaceParam, ActorParam, TaskParam {}\n/** `requested_at` is when the round acknowledged opened, and names it. */\nexport interface ReviewAcknowledgeResult { acknowledged: true; requested_at: string }\n\nexport interface DecideApproveParams extends WorkspaceParam, ActorParam, TaskParam {\n rationale?: string;\n}\nexport type DecideApproveResult = OkResult;\n\nexport interface DecideRejectParams extends WorkspaceParam, ActorParam, TaskParam {\n rationale: string;\n category?: string;\n}\nexport type DecideRejectResult = OkResult;\n\nexport interface DecideOverrideParams extends WorkspaceParam, ActorParam, TaskParam {\n diff: JsonPatchOp[];\n rationale: string;\n tags?: string[];\n policy_refs?: string[];\n logical_id?: string;\n instance_id?: string;\n intent_preserved?: boolean;\n based_on_artefact?: unknown;\n}\nexport interface DecideOverrideResult {\n state: \"completed\";\n override_artefact_id: ArtefactId;\n applied: unknown;\n}\n\nexport interface AbstainDeclareParams extends WorkspaceParam, ActorParam, TaskParam {\n category: string;\n rationale?: string;\n}\nexport type AbstainDeclareResult = OkResult;\n\nexport interface EscalateRaiseParams extends WorkspaceParam, ActorParam, TaskParam {\n to?: ParticipantUri;\n rationale?: string;\n}\nexport interface EscalateRaiseResult { ok: true; to?: ParticipantUri }\n\n// ============================================================\n// whisper.* (whisper/1.0)\n// ============================================================\n\nexport interface WhisperAskParams extends WorkspaceParam, ActorParam, TaskParam {\n to: ParticipantUri;\n question: string;\n options?: string[];\n default_on_lapse?: string;\n lapse_ms?: number;\n}\nexport interface WhisperAskResult { whisper_id: string }\n\nexport interface WhisperAnswerParams extends WorkspaceParam, ActorParam {\n whisper_id: string;\n answer: string;\n}\nexport type WhisperAnswerResult = OkResult;\n\n// ============================================================\n// deliberate.* (deliberation/1.0)\n// ============================================================\n\nexport interface DeliberateOpenParams extends WorkspaceParam, ActorParam, TaskParam {\n rule: Record<string, unknown>;\n proposition: unknown;\n voters: ParticipantUri[];\n}\nexport interface DeliberateOpenResult { deliberation_id: string }\n\nexport interface DeliberateCommentParams extends WorkspaceParam, ActorParam {\n deliberation_id: string;\n text: string;\n}\nexport type DeliberateCommentResult = OkResult;\n\nexport interface DeliberateVoteParams extends WorkspaceParam, ActorParam {\n deliberation_id: string;\n vote: \"yea\" | \"nay\" | \"abstain\";\n weight?: number;\n rationale?: string;\n}\nexport type DeliberateVoteResult = OkResult;\n\nexport interface DeliberateCloseParams extends WorkspaceParam, ActorParam {\n deliberation_id: string;\n}\nexport interface DeliberateCloseResult { outcome: \"approved\" | \"rejected\" | \"no_quorum\" }\n\n// ============================================================\n// handoff.* (handoff/1.0)\n// ============================================================\n\nexport interface HandoffProposeParams extends WorkspaceParam, ActorParam {\n to: ParticipantUri;\n task_ids: TaskId[];\n summary: string;\n active_constraints?: Record<string, unknown>;\n}\nexport interface HandoffProposeResult { handoff_id: string }\n\nexport interface HandoffAcceptParams extends WorkspaceParam, ActorParam {\n handoff_id: string;\n}\nexport type HandoffAcceptResult = OkResult;\n\nexport interface HandoffDeclineParams extends WorkspaceParam, ActorParam {\n handoff_id: string;\n reason?: string;\n}\nexport type HandoffDeclineResult = OkResult;\n\n// ============================================================\n// control.* (control/1.0)\n// ============================================================\n\nexport interface ControlPauseParams extends WorkspaceParam, ActorParam {\n reason?: string;\n}\nexport type ControlPauseResult = OkResult;\n\nexport interface ControlResumeParams extends WorkspaceParam, ActorParam {\n reason?: string;\n}\nexport type ControlResumeResult = OkResult;\n\nexport interface ControlCancelParams extends WorkspaceParam, ActorParam, TaskParam {\n reason?: string;\n}\nexport type ControlCancelResult = OkResult;\n\nexport interface ControlSupersedeParams extends WorkspaceParam, ActorParam, TaskParam {\n replacement: unknown;\n logical_id?: string;\n intent_preserved?: boolean;\n reason?: string;\n}\nexport interface ControlSupersedeResult { artefact_id: ArtefactId }\n\nexport interface ControlSnapshotParams extends WorkspaceParam, ActorParam {\n label?: string;\n}\nexport interface ControlSnapshotResult { snapshot_id: string }\n\nexport interface ControlRollbackParams extends WorkspaceParam, ActorParam {\n snapshot_id: string;\n reason?: string;\n}\nexport type ControlRollbackResult = OkResult;\n\nexport interface ControlSetModeCeilingParams extends WorkspaceParam, ActorParam {\n ceiling: \"shadow\" | \"trial\" | \"production\";\n}\nexport type ControlSetModeCeilingResult = OkResult;\n\n// ============================================================\n// routing.* (routing/1.0)\n// ============================================================\n\nexport interface TaskRouteParams extends WorkspaceParam, ActorParam, TaskParam {\n candidates: ParticipantUri[];\n}\nexport interface TaskRouteResult {\n selected: ParticipantUri;\n rationale: Record<string, unknown>;\n}\n\nexport interface ReviewDepthParams extends WorkspaceParam, ActorParam, TaskParam {\n artefact?: unknown;\n hints?: Record<string, unknown>;\n}\nexport interface ReviewDepthResult {\n depth: \"skip\" | \"spot_check\" | \"full\" | \"escalated\";\n sampling_probability?: number;\n rationale: Record<string, unknown>;\n}\n\nexport interface EscalateAutoParams extends WorkspaceParam, ActorParam, TaskParam {\n hints?: Record<string, unknown>;\n}\nexport interface EscalateAutoResult {\n escalated: boolean;\n to?: ParticipantUri;\n triggered_rule?: Record<string, unknown>;\n}\n\n// ============================================================\n// audit.* (Core + audit-scitt/1.0)\n// ============================================================\n\nexport interface AuditReadParams extends WorkspaceParam {\n from_seq?: number;\n limit?: number;\n}\nexport interface AuditReadResult { entries: unknown[] }\n\nexport interface AuditSubmitToScittParams extends WorkspaceParam, ActorParam {\n seq: number;\n statement?: Record<string, unknown>;\n}\nexport interface AuditSubmitToScittResult { receipt: Record<string, unknown> }\n\nexport interface AuditVerifyReceiptParams extends WorkspaceParam {\n receipt: Record<string, unknown>;\n}\nexport interface AuditVerifyReceiptResult { valid: boolean }\n\nexport interface AuditVerifyChainParams extends WorkspaceParam {\n /** Not implemented. Supplying either is refused; see SPECIFICATION.md 10.2. */\n from_seq?: number;\n /** Not implemented. Supplying either is refused; see SPECIFICATION.md 10.2. */\n to_seq?: number;\n}\n/**\n * The verdict of a local prev_hash chain replay.\n *\n * `status` is terminal and the three outcomes are mutually exclusive: a\n * broken chain is a JSON-RPC error, an unevaluated range is\n * `not_evaluated`, and `verified` requires complete coverage. A caller\n * reading `ok` alone therefore fails closed on a range that was never\n * checked, instead of taking a pass over entries no evidence covers.\n */\nexport interface AuditVerifyChainResult {\n status: \"verified\" | \"not_evaluated\";\n /** True only when `status` is \"verified\". Never true beside a gap. */\n ok: boolean;\n /** Present only when `status` is \"not_evaluated\". */\n reason?: \"unchained_prefix\";\n entries_total: number;\n entries_checked: number;\n entries_unchecked: number;\n /** Seq of the first entry inside coverage; null when nothing was checked. */\n checked_from_seq: number | null;\n chain_head: string;\n}\n\n// ============================================================\n// Method-name → {params, result} map (single source of truth)\n// ============================================================\n\nexport interface MethodTable {\n \"workspace.create\": { params: WorkspaceCreateParams, result: WorkspaceCreateResult };\n \"workspace.describe\": { params: WorkspaceDescribeParams, result: WorkspaceDescribeResult };\n \"workspace.set_profiles\": { params: WorkspaceSetProfilesParams, result: WorkspaceSetProfilesResult };\n \"workspace.invite\": { params: WorkspaceInviteParams, result: WorkspaceInviteResult };\n\n \"participant.join\": { params: ParticipantJoinParams, result: ParticipantJoinResult };\n \"participant.leave\": { params: ParticipantLeaveParams, result: ParticipantLeaveResult };\n \"participant.rotate_key\": { params: ParticipantRotateKeyParams, result: ParticipantRotateKeyResult };\n \"participant.revoke_key\": { params: ParticipantRevokeKeyParams, result: ParticipantRevokeKeyResult };\n\n \"task.create\": { params: TaskCreateParams, result: TaskCreateResult };\n \"task.update\": { params: TaskUpdateParams, result: TaskUpdateResult };\n \"task.complete\": { params: TaskCompleteParams, result: TaskCompleteResult };\n\n \"review.request\": { params: ReviewRequestParams, result: ReviewRequestResult };\n \"review.acknowledge\": { params: ReviewAcknowledgeParams, result: ReviewAcknowledgeResult };\n \"decide.approve\": { params: DecideApproveParams, result: DecideApproveResult };\n \"decide.reject\": { params: DecideRejectParams, result: DecideRejectResult };\n \"decide.override\": { params: DecideOverrideParams, result: DecideOverrideResult };\n \"abstain.declare\": { params: AbstainDeclareParams, result: AbstainDeclareResult };\n \"escalate.raise\": { params: EscalateRaiseParams, result: EscalateRaiseResult };\n\n \"whisper.ask\": { params: WhisperAskParams, result: WhisperAskResult };\n \"whisper.answer\": { params: WhisperAnswerParams, result: WhisperAnswerResult };\n\n \"deliberate.open\": { params: DeliberateOpenParams, result: DeliberateOpenResult };\n \"deliberate.comment\": { params: DeliberateCommentParams, result: DeliberateCommentResult };\n \"deliberate.vote\": { params: DeliberateVoteParams, result: DeliberateVoteResult };\n \"deliberate.close\": { params: DeliberateCloseParams, result: DeliberateCloseResult };\n\n \"handoff.propose\": { params: HandoffProposeParams, result: HandoffProposeResult };\n \"handoff.accept\": { params: HandoffAcceptParams, result: HandoffAcceptResult };\n \"handoff.decline\": { params: HandoffDeclineParams, result: HandoffDeclineResult };\n\n \"control.pause\": { params: ControlPauseParams, result: ControlPauseResult };\n \"control.resume\": { params: ControlResumeParams, result: ControlResumeResult };\n \"control.cancel\": { params: ControlCancelParams, result: ControlCancelResult };\n \"control.supersede\": { params: ControlSupersedeParams, result: ControlSupersedeResult };\n \"control.snapshot\": { params: ControlSnapshotParams, result: ControlSnapshotResult };\n \"control.rollback\": { params: ControlRollbackParams, result: ControlRollbackResult };\n \"control.set_mode_ceiling\": { params: ControlSetModeCeilingParams, result: ControlSetModeCeilingResult };\n\n \"task.route\": { params: TaskRouteParams, result: TaskRouteResult };\n \"review.depth\": { params: ReviewDepthParams, result: ReviewDepthResult };\n \"escalate.auto\": { params: EscalateAutoParams, result: EscalateAutoResult };\n\n \"audit.read\": { params: AuditReadParams, result: AuditReadResult };\n \"audit.submit_to_scitt\": { params: AuditSubmitToScittParams, result: AuditSubmitToScittResult };\n \"audit.verify_receipt\": { params: AuditVerifyReceiptParams, result: AuditVerifyReceiptResult };\n \"audit.verify_chain\": { params: AuditVerifyChainParams, result: AuditVerifyChainResult };\n}\n\nexport type MethodName = keyof MethodTable;\nexport type MethodParams<M extends MethodName> = MethodTable[M][\"params\"];\nexport type MethodResult<M extends MethodName> = MethodTable[M][\"result\"];\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/methods.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkspaceId, Workspace, ParticipantUri, TaskId, JsonPatchOp, ArtefactId } from './types.cjs';
|
|
1
|
+
import { WorkspaceId, SignaturePolicy, JoinPolicy, Workspace, ParticipantUri, ParticipantType, TaskId, JsonPatchOp, ArtefactId } from './types.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Typed method definitions.
|
|
@@ -14,7 +14,7 @@ import { WorkspaceId, Workspace, ParticipantUri, TaskId, JsonPatchOp, ArtefactId
|
|
|
14
14
|
* the schemas automatically; for now the source of truth remains
|
|
15
15
|
* the running tests under `tests/`.
|
|
16
16
|
*
|
|
17
|
-
* Scope:
|
|
17
|
+
* Scope: 40 method handlers shipped by both reference
|
|
18
18
|
* implementations (Core + every shipped profile). Spec-only methods
|
|
19
19
|
* are excluded - they would mislead callers into thinking the local
|
|
20
20
|
* Coordinator can dispatch them.
|
|
@@ -37,6 +37,9 @@ interface WorkspaceCreateParams extends Partial<WorkspaceParam> {
|
|
|
37
37
|
routing_policy_uri?: string;
|
|
38
38
|
mode?: "shadow" | "trial" | "production";
|
|
39
39
|
mode_ceiling?: "shadow" | "trial" | "production";
|
|
40
|
+
signature_policy?: SignaturePolicy;
|
|
41
|
+
join_policy?: JoinPolicy;
|
|
42
|
+
review_rule?: string;
|
|
40
43
|
}
|
|
41
44
|
interface WorkspaceCreateResult {
|
|
42
45
|
workspace: WorkspaceId;
|
|
@@ -50,6 +53,21 @@ interface WorkspaceSetProfilesParams extends WorkspaceParam, ActorParam {
|
|
|
50
53
|
profiles: string[];
|
|
51
54
|
}
|
|
52
55
|
type WorkspaceSetProfilesResult = OkResult;
|
|
56
|
+
interface WorkspaceInviteParams extends WorkspaceParam, ActorParam {
|
|
57
|
+
uri: ParticipantUri;
|
|
58
|
+
type: ParticipantType;
|
|
59
|
+
role?: string;
|
|
60
|
+
jwks?: {
|
|
61
|
+
keys: Array<Record<string, unknown>>;
|
|
62
|
+
};
|
|
63
|
+
oidc_sub?: string;
|
|
64
|
+
}
|
|
65
|
+
interface WorkspaceInviteResult {
|
|
66
|
+
invited: true;
|
|
67
|
+
uri: ParticipantUri;
|
|
68
|
+
/** The kids registered, where the invitation was for a member that held no key in force. */
|
|
69
|
+
registered?: string[];
|
|
70
|
+
}
|
|
53
71
|
interface ParticipantJoinParams extends WorkspaceParam, ActorParam {
|
|
54
72
|
type: "human" | "agent" | "service" | "group" | "workspace";
|
|
55
73
|
role?: string;
|
|
@@ -107,6 +125,13 @@ interface ReviewRequestResult {
|
|
|
107
125
|
state: string;
|
|
108
126
|
review_id: TaskId;
|
|
109
127
|
}
|
|
128
|
+
interface ReviewAcknowledgeParams extends WorkspaceParam, ActorParam, TaskParam {
|
|
129
|
+
}
|
|
130
|
+
/** `requested_at` is when the round acknowledged opened, and names it. */
|
|
131
|
+
interface ReviewAcknowledgeResult {
|
|
132
|
+
acknowledged: true;
|
|
133
|
+
requested_at: string;
|
|
134
|
+
}
|
|
110
135
|
interface DecideApproveParams extends WorkspaceParam, ActorParam, TaskParam {
|
|
111
136
|
rationale?: string;
|
|
112
137
|
}
|
|
@@ -324,6 +349,10 @@ interface MethodTable {
|
|
|
324
349
|
params: WorkspaceSetProfilesParams;
|
|
325
350
|
result: WorkspaceSetProfilesResult;
|
|
326
351
|
};
|
|
352
|
+
"workspace.invite": {
|
|
353
|
+
params: WorkspaceInviteParams;
|
|
354
|
+
result: WorkspaceInviteResult;
|
|
355
|
+
};
|
|
327
356
|
"participant.join": {
|
|
328
357
|
params: ParticipantJoinParams;
|
|
329
358
|
result: ParticipantJoinResult;
|
|
@@ -356,6 +385,10 @@ interface MethodTable {
|
|
|
356
385
|
params: ReviewRequestParams;
|
|
357
386
|
result: ReviewRequestResult;
|
|
358
387
|
};
|
|
388
|
+
"review.acknowledge": {
|
|
389
|
+
params: ReviewAcknowledgeParams;
|
|
390
|
+
result: ReviewAcknowledgeResult;
|
|
391
|
+
};
|
|
359
392
|
"decide.approve": {
|
|
360
393
|
params: DecideApproveParams;
|
|
361
394
|
result: DecideApproveResult;
|
|
@@ -473,4 +506,4 @@ type MethodName = keyof MethodTable;
|
|
|
473
506
|
type MethodParams<M extends MethodName> = MethodTable[M]["params"];
|
|
474
507
|
type MethodResult<M extends MethodName> = MethodTable[M]["result"];
|
|
475
508
|
|
|
476
|
-
export type { AbstainDeclareParams, AbstainDeclareResult, ActorParam, AuditReadParams, AuditReadResult, AuditSubmitToScittParams, AuditSubmitToScittResult, AuditVerifyChainParams, AuditVerifyChainResult, AuditVerifyReceiptParams, AuditVerifyReceiptResult, ControlCancelParams, ControlCancelResult, ControlPauseParams, ControlPauseResult, ControlResumeParams, ControlResumeResult, ControlRollbackParams, ControlRollbackResult, ControlSetModeCeilingParams, ControlSetModeCeilingResult, ControlSnapshotParams, ControlSnapshotResult, ControlSupersedeParams, ControlSupersedeResult, DecideApproveParams, DecideApproveResult, DecideOverrideParams, DecideOverrideResult, DecideRejectParams, DecideRejectResult, DeliberateCloseParams, DeliberateCloseResult, DeliberateCommentParams, DeliberateCommentResult, DeliberateOpenParams, DeliberateOpenResult, DeliberateVoteParams, DeliberateVoteResult, EscalateAutoParams, EscalateAutoResult, EscalateRaiseParams, EscalateRaiseResult, HandoffAcceptParams, HandoffAcceptResult, HandoffDeclineParams, HandoffDeclineResult, HandoffProposeParams, HandoffProposeResult, MethodName, MethodParams, MethodResult, MethodTable, OkResult, ParticipantJoinParams, ParticipantJoinResult, ParticipantLeaveParams, ParticipantLeaveResult, ParticipantRevokeKeyParams, ParticipantRevokeKeyResult, ParticipantRotateKeyParams, ParticipantRotateKeyResult, ReviewDepthParams, ReviewDepthResult, ReviewRequestParams, ReviewRequestResult, TaskCompleteParams, TaskCompleteResult, TaskCreateParams, TaskCreateResult, TaskParam, TaskRouteParams, TaskRouteResult, TaskUpdateParams, TaskUpdateResult, WhisperAnswerParams, WhisperAnswerResult, WhisperAskParams, WhisperAskResult, WorkspaceCreateParams, WorkspaceCreateResult, WorkspaceDescribeParams, WorkspaceDescribeResult, WorkspaceParam, WorkspaceSetProfilesParams, WorkspaceSetProfilesResult };
|
|
509
|
+
export type { AbstainDeclareParams, AbstainDeclareResult, ActorParam, AuditReadParams, AuditReadResult, AuditSubmitToScittParams, AuditSubmitToScittResult, AuditVerifyChainParams, AuditVerifyChainResult, AuditVerifyReceiptParams, AuditVerifyReceiptResult, ControlCancelParams, ControlCancelResult, ControlPauseParams, ControlPauseResult, ControlResumeParams, ControlResumeResult, ControlRollbackParams, ControlRollbackResult, ControlSetModeCeilingParams, ControlSetModeCeilingResult, ControlSnapshotParams, ControlSnapshotResult, ControlSupersedeParams, ControlSupersedeResult, DecideApproveParams, DecideApproveResult, DecideOverrideParams, DecideOverrideResult, DecideRejectParams, DecideRejectResult, DeliberateCloseParams, DeliberateCloseResult, DeliberateCommentParams, DeliberateCommentResult, DeliberateOpenParams, DeliberateOpenResult, DeliberateVoteParams, DeliberateVoteResult, EscalateAutoParams, EscalateAutoResult, EscalateRaiseParams, EscalateRaiseResult, HandoffAcceptParams, HandoffAcceptResult, HandoffDeclineParams, HandoffDeclineResult, HandoffProposeParams, HandoffProposeResult, MethodName, MethodParams, MethodResult, MethodTable, OkResult, ParticipantJoinParams, ParticipantJoinResult, ParticipantLeaveParams, ParticipantLeaveResult, ParticipantRevokeKeyParams, ParticipantRevokeKeyResult, ParticipantRotateKeyParams, ParticipantRotateKeyResult, ReviewAcknowledgeParams, ReviewAcknowledgeResult, ReviewDepthParams, ReviewDepthResult, ReviewRequestParams, ReviewRequestResult, TaskCompleteParams, TaskCompleteResult, TaskCreateParams, TaskCreateResult, TaskParam, TaskRouteParams, TaskRouteResult, TaskUpdateParams, TaskUpdateResult, WhisperAnswerParams, WhisperAnswerResult, WhisperAskParams, WhisperAskResult, WorkspaceCreateParams, WorkspaceCreateResult, WorkspaceDescribeParams, WorkspaceDescribeResult, WorkspaceInviteParams, WorkspaceInviteResult, WorkspaceParam, WorkspaceSetProfilesParams, WorkspaceSetProfilesResult };
|
package/dist/methods.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkspaceId, Workspace, ParticipantUri, TaskId, JsonPatchOp, ArtefactId } from './types.js';
|
|
1
|
+
import { WorkspaceId, SignaturePolicy, JoinPolicy, Workspace, ParticipantUri, ParticipantType, TaskId, JsonPatchOp, ArtefactId } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Typed method definitions.
|
|
@@ -14,7 +14,7 @@ import { WorkspaceId, Workspace, ParticipantUri, TaskId, JsonPatchOp, ArtefactId
|
|
|
14
14
|
* the schemas automatically; for now the source of truth remains
|
|
15
15
|
* the running tests under `tests/`.
|
|
16
16
|
*
|
|
17
|
-
* Scope:
|
|
17
|
+
* Scope: 40 method handlers shipped by both reference
|
|
18
18
|
* implementations (Core + every shipped profile). Spec-only methods
|
|
19
19
|
* are excluded - they would mislead callers into thinking the local
|
|
20
20
|
* Coordinator can dispatch them.
|
|
@@ -37,6 +37,9 @@ interface WorkspaceCreateParams extends Partial<WorkspaceParam> {
|
|
|
37
37
|
routing_policy_uri?: string;
|
|
38
38
|
mode?: "shadow" | "trial" | "production";
|
|
39
39
|
mode_ceiling?: "shadow" | "trial" | "production";
|
|
40
|
+
signature_policy?: SignaturePolicy;
|
|
41
|
+
join_policy?: JoinPolicy;
|
|
42
|
+
review_rule?: string;
|
|
40
43
|
}
|
|
41
44
|
interface WorkspaceCreateResult {
|
|
42
45
|
workspace: WorkspaceId;
|
|
@@ -50,6 +53,21 @@ interface WorkspaceSetProfilesParams extends WorkspaceParam, ActorParam {
|
|
|
50
53
|
profiles: string[];
|
|
51
54
|
}
|
|
52
55
|
type WorkspaceSetProfilesResult = OkResult;
|
|
56
|
+
interface WorkspaceInviteParams extends WorkspaceParam, ActorParam {
|
|
57
|
+
uri: ParticipantUri;
|
|
58
|
+
type: ParticipantType;
|
|
59
|
+
role?: string;
|
|
60
|
+
jwks?: {
|
|
61
|
+
keys: Array<Record<string, unknown>>;
|
|
62
|
+
};
|
|
63
|
+
oidc_sub?: string;
|
|
64
|
+
}
|
|
65
|
+
interface WorkspaceInviteResult {
|
|
66
|
+
invited: true;
|
|
67
|
+
uri: ParticipantUri;
|
|
68
|
+
/** The kids registered, where the invitation was for a member that held no key in force. */
|
|
69
|
+
registered?: string[];
|
|
70
|
+
}
|
|
53
71
|
interface ParticipantJoinParams extends WorkspaceParam, ActorParam {
|
|
54
72
|
type: "human" | "agent" | "service" | "group" | "workspace";
|
|
55
73
|
role?: string;
|
|
@@ -107,6 +125,13 @@ interface ReviewRequestResult {
|
|
|
107
125
|
state: string;
|
|
108
126
|
review_id: TaskId;
|
|
109
127
|
}
|
|
128
|
+
interface ReviewAcknowledgeParams extends WorkspaceParam, ActorParam, TaskParam {
|
|
129
|
+
}
|
|
130
|
+
/** `requested_at` is when the round acknowledged opened, and names it. */
|
|
131
|
+
interface ReviewAcknowledgeResult {
|
|
132
|
+
acknowledged: true;
|
|
133
|
+
requested_at: string;
|
|
134
|
+
}
|
|
110
135
|
interface DecideApproveParams extends WorkspaceParam, ActorParam, TaskParam {
|
|
111
136
|
rationale?: string;
|
|
112
137
|
}
|
|
@@ -324,6 +349,10 @@ interface MethodTable {
|
|
|
324
349
|
params: WorkspaceSetProfilesParams;
|
|
325
350
|
result: WorkspaceSetProfilesResult;
|
|
326
351
|
};
|
|
352
|
+
"workspace.invite": {
|
|
353
|
+
params: WorkspaceInviteParams;
|
|
354
|
+
result: WorkspaceInviteResult;
|
|
355
|
+
};
|
|
327
356
|
"participant.join": {
|
|
328
357
|
params: ParticipantJoinParams;
|
|
329
358
|
result: ParticipantJoinResult;
|
|
@@ -356,6 +385,10 @@ interface MethodTable {
|
|
|
356
385
|
params: ReviewRequestParams;
|
|
357
386
|
result: ReviewRequestResult;
|
|
358
387
|
};
|
|
388
|
+
"review.acknowledge": {
|
|
389
|
+
params: ReviewAcknowledgeParams;
|
|
390
|
+
result: ReviewAcknowledgeResult;
|
|
391
|
+
};
|
|
359
392
|
"decide.approve": {
|
|
360
393
|
params: DecideApproveParams;
|
|
361
394
|
result: DecideApproveResult;
|
|
@@ -473,4 +506,4 @@ type MethodName = keyof MethodTable;
|
|
|
473
506
|
type MethodParams<M extends MethodName> = MethodTable[M]["params"];
|
|
474
507
|
type MethodResult<M extends MethodName> = MethodTable[M]["result"];
|
|
475
508
|
|
|
476
|
-
export type { AbstainDeclareParams, AbstainDeclareResult, ActorParam, AuditReadParams, AuditReadResult, AuditSubmitToScittParams, AuditSubmitToScittResult, AuditVerifyChainParams, AuditVerifyChainResult, AuditVerifyReceiptParams, AuditVerifyReceiptResult, ControlCancelParams, ControlCancelResult, ControlPauseParams, ControlPauseResult, ControlResumeParams, ControlResumeResult, ControlRollbackParams, ControlRollbackResult, ControlSetModeCeilingParams, ControlSetModeCeilingResult, ControlSnapshotParams, ControlSnapshotResult, ControlSupersedeParams, ControlSupersedeResult, DecideApproveParams, DecideApproveResult, DecideOverrideParams, DecideOverrideResult, DecideRejectParams, DecideRejectResult, DeliberateCloseParams, DeliberateCloseResult, DeliberateCommentParams, DeliberateCommentResult, DeliberateOpenParams, DeliberateOpenResult, DeliberateVoteParams, DeliberateVoteResult, EscalateAutoParams, EscalateAutoResult, EscalateRaiseParams, EscalateRaiseResult, HandoffAcceptParams, HandoffAcceptResult, HandoffDeclineParams, HandoffDeclineResult, HandoffProposeParams, HandoffProposeResult, MethodName, MethodParams, MethodResult, MethodTable, OkResult, ParticipantJoinParams, ParticipantJoinResult, ParticipantLeaveParams, ParticipantLeaveResult, ParticipantRevokeKeyParams, ParticipantRevokeKeyResult, ParticipantRotateKeyParams, ParticipantRotateKeyResult, ReviewDepthParams, ReviewDepthResult, ReviewRequestParams, ReviewRequestResult, TaskCompleteParams, TaskCompleteResult, TaskCreateParams, TaskCreateResult, TaskParam, TaskRouteParams, TaskRouteResult, TaskUpdateParams, TaskUpdateResult, WhisperAnswerParams, WhisperAnswerResult, WhisperAskParams, WhisperAskResult, WorkspaceCreateParams, WorkspaceCreateResult, WorkspaceDescribeParams, WorkspaceDescribeResult, WorkspaceParam, WorkspaceSetProfilesParams, WorkspaceSetProfilesResult };
|
|
509
|
+
export type { AbstainDeclareParams, AbstainDeclareResult, ActorParam, AuditReadParams, AuditReadResult, AuditSubmitToScittParams, AuditSubmitToScittResult, AuditVerifyChainParams, AuditVerifyChainResult, AuditVerifyReceiptParams, AuditVerifyReceiptResult, ControlCancelParams, ControlCancelResult, ControlPauseParams, ControlPauseResult, ControlResumeParams, ControlResumeResult, ControlRollbackParams, ControlRollbackResult, ControlSetModeCeilingParams, ControlSetModeCeilingResult, ControlSnapshotParams, ControlSnapshotResult, ControlSupersedeParams, ControlSupersedeResult, DecideApproveParams, DecideApproveResult, DecideOverrideParams, DecideOverrideResult, DecideRejectParams, DecideRejectResult, DeliberateCloseParams, DeliberateCloseResult, DeliberateCommentParams, DeliberateCommentResult, DeliberateOpenParams, DeliberateOpenResult, DeliberateVoteParams, DeliberateVoteResult, EscalateAutoParams, EscalateAutoResult, EscalateRaiseParams, EscalateRaiseResult, HandoffAcceptParams, HandoffAcceptResult, HandoffDeclineParams, HandoffDeclineResult, HandoffProposeParams, HandoffProposeResult, MethodName, MethodParams, MethodResult, MethodTable, OkResult, ParticipantJoinParams, ParticipantJoinResult, ParticipantLeaveParams, ParticipantLeaveResult, ParticipantRevokeKeyParams, ParticipantRevokeKeyResult, ParticipantRotateKeyParams, ParticipantRotateKeyResult, ReviewAcknowledgeParams, ReviewAcknowledgeResult, ReviewDepthParams, ReviewDepthResult, ReviewRequestParams, ReviewRequestResult, TaskCompleteParams, TaskCompleteResult, TaskCreateParams, TaskCreateResult, TaskParam, TaskRouteParams, TaskRouteResult, TaskUpdateParams, TaskUpdateResult, WhisperAnswerParams, WhisperAnswerResult, WhisperAskParams, WhisperAskResult, WorkspaceCreateParams, WorkspaceCreateResult, WorkspaceDescribeParams, WorkspaceDescribeResult, WorkspaceInviteParams, WorkspaceInviteResult, WorkspaceParam, WorkspaceSetProfilesParams, WorkspaceSetProfilesResult };
|
package/dist/storage/sqlite.cjs
CHANGED
|
@@ -34,7 +34,8 @@ var COLLECTIONS = [
|
|
|
34
34
|
"deliberations",
|
|
35
35
|
"handoffs",
|
|
36
36
|
"snapshots",
|
|
37
|
-
"route_decisions"
|
|
37
|
+
"route_decisions",
|
|
38
|
+
"invitations"
|
|
38
39
|
];
|
|
39
40
|
var IDEMPOTENCY_KEYS = "idempotency_keys";
|
|
40
41
|
var StoreConflictError = class extends Error {
|
|
@@ -45,7 +46,7 @@ var StoreConflictError = class extends Error {
|
|
|
45
46
|
base;
|
|
46
47
|
constructor(workspace, held, base) {
|
|
47
48
|
super(
|
|
48
|
-
`The store holds ${held} audit entries for workspace ${workspace} and this write expected ${base}, so nothing was written. Another coordinator may be writing to this workspace, the store may have been changed outside this coordinator
|
|
49
|
+
`The store holds ${held} audit entries for workspace ${workspace} and this write expected ${base}, so nothing was written. Another coordinator may be writing to this workspace, or the store may have been changed outside this coordinator. A coordinator reloads the workspace and answers the call as failed, and the call may be sent again.`
|
|
49
50
|
);
|
|
50
51
|
this.name = "StoreConflictError";
|
|
51
52
|
this.workspace = workspace;
|
|
@@ -122,6 +123,54 @@ function assembleSnapshot(meta, entries, objects) {
|
|
|
122
123
|
|
|
123
124
|
// src/storage/sqlite.ts
|
|
124
125
|
var import_meta = {};
|
|
126
|
+
function fromNodeSqlite(db) {
|
|
127
|
+
const transaction = (fn) => {
|
|
128
|
+
const run = (begin) => (...args) => {
|
|
129
|
+
db.exec(begin);
|
|
130
|
+
try {
|
|
131
|
+
const result = fn(...args);
|
|
132
|
+
db.exec("COMMIT");
|
|
133
|
+
return result;
|
|
134
|
+
} catch (err) {
|
|
135
|
+
db.exec("ROLLBACK");
|
|
136
|
+
throw err;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return Object.assign(run("BEGIN"), { immediate: run("BEGIN IMMEDIATE") });
|
|
140
|
+
};
|
|
141
|
+
return {
|
|
142
|
+
exec: (sql) => db.exec(sql),
|
|
143
|
+
prepare: (sql) => db.prepare(sql),
|
|
144
|
+
pragma: (name, options) => {
|
|
145
|
+
const row = db.prepare(`PRAGMA ${name}`).get();
|
|
146
|
+
return options?.simple ? row ? Object.values(row)[0] : void 0 : row;
|
|
147
|
+
},
|
|
148
|
+
transaction,
|
|
149
|
+
close: () => db.close()
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function openDatabase(path, driver) {
|
|
153
|
+
const failures = [];
|
|
154
|
+
const load = (name) => {
|
|
155
|
+
try {
|
|
156
|
+
return (0, import_node_module.createRequire)(typeof __filename === "string" ? __filename : import_meta.url)(name);
|
|
157
|
+
} catch (err) {
|
|
158
|
+
failures.push(`${name}: ${err instanceof Error ? err.message.split("\n")[0] : String(err)}`);
|
|
159
|
+
return void 0;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
if (driver !== "node:sqlite") {
|
|
163
|
+
const Database = load("better-sqlite3");
|
|
164
|
+
if (Database) return new Database(path);
|
|
165
|
+
}
|
|
166
|
+
if (driver !== "better-sqlite3") {
|
|
167
|
+
const sqlite = load("node:sqlite");
|
|
168
|
+
if (sqlite) return fromNodeSqlite(new sqlite.DatabaseSync(path));
|
|
169
|
+
}
|
|
170
|
+
throw new Error(
|
|
171
|
+
`SqliteStore needs the \`better-sqlite3\` package, or Node 22.13 or later for node:sqlite. Install it with \`npm install better-sqlite3\` or use MemoryStore for non-persistent workloads (${failures.join("; ")})`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
125
174
|
var SCHEMA = `
|
|
126
175
|
CREATE TABLE IF NOT EXISTS chap_meta (
|
|
127
176
|
workspace TEXT PRIMARY KEY,
|
|
@@ -148,23 +197,15 @@ var LEGACY_VIEW = `CREATE VIEW IF NOT EXISTS ${LEGACY_TABLE} AS SELECT m.workspa
|
|
|
148
197
|
"'$.audit', json((SELECT json_group_array(json(e.data)) FROM (SELECT data FROM chap_entries WHERE workspace = m.workspace ORDER BY seq) AS e))",
|
|
149
198
|
...[...COLLECTIONS, IDEMPOTENCY_KEYS].map((c) => `'$.${c}', json((SELECT json_group_object(id, json(data)) FROM chap_objects WHERE workspace = m.workspace AND collection = '${c}'))`)
|
|
150
199
|
].join(", ") + ") AS data, m.version AS version, m.updated_at AS updated_at FROM chap_meta AS m";
|
|
200
|
+
var LEGACY_VIEW_RECORDED = LEGACY_VIEW.replace("CREATE VIEW IF NOT EXISTS ", "CREATE VIEW ");
|
|
151
201
|
var SqliteStore = class {
|
|
152
202
|
db;
|
|
153
203
|
stmt;
|
|
154
204
|
txWrite;
|
|
155
205
|
txDelete;
|
|
156
206
|
constructor(path, options = {}) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const here = typeof __filename === "string" ? __filename : import_meta.url;
|
|
160
|
-
Database = (0, import_node_module.createRequire)(here)("better-sqlite3");
|
|
161
|
-
} catch (err) {
|
|
162
|
-
const detail = err instanceof Error ? `: ${err.message.split("\n")[0]}` : "";
|
|
163
|
-
throw new Error(
|
|
164
|
-
`SqliteStore requires the \`better-sqlite3\` package. Install it with \`npm install better-sqlite3\` or use MemoryStore for non-persistent workloads${detail}`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
this.db = new Database(path);
|
|
207
|
+
this.db = openDatabase(path, options.driver);
|
|
208
|
+
this.db.pragma("busy_timeout = 5000");
|
|
168
209
|
if (path !== ":memory:" && options.wal !== false) {
|
|
169
210
|
this.db.pragma("journal_mode = WAL");
|
|
170
211
|
}
|
|
@@ -188,7 +229,10 @@ var SqliteStore = class {
|
|
|
188
229
|
dropObjects: prepare("DELETE FROM chap_objects WHERE workspace = ?"),
|
|
189
230
|
metas: prepare("SELECT workspace, data, version, updated_at FROM chap_meta"),
|
|
190
231
|
entries: prepare("SELECT workspace, seq, data FROM chap_entries ORDER BY workspace, seq"),
|
|
191
|
-
objects: prepare("SELECT workspace, collection, id, data FROM chap_objects ORDER BY rowid")
|
|
232
|
+
objects: prepare("SELECT workspace, collection, id, data FROM chap_objects ORDER BY rowid"),
|
|
233
|
+
metaOf: prepare("SELECT workspace, data, version, updated_at FROM chap_meta WHERE workspace = ?"),
|
|
234
|
+
entriesOf: prepare("SELECT workspace, seq, data FROM chap_entries WHERE workspace = ? ORDER BY seq"),
|
|
235
|
+
objectsOf: prepare("SELECT workspace, collection, id, data FROM chap_objects WHERE workspace = ? ORDER BY rowid")
|
|
192
236
|
};
|
|
193
237
|
this.txWrite = this.db.transaction((change) => this.write(change));
|
|
194
238
|
this.txDelete = this.db.transaction((id) => this.drop(id));
|
|
@@ -230,6 +274,8 @@ var SqliteStore = class {
|
|
|
230
274
|
}
|
|
231
275
|
this.db.exec("DROP INDEX IF EXISTS idx_chap_workspaces_updated_at");
|
|
232
276
|
}
|
|
277
|
+
const view = this.db.prepare("SELECT type, sql FROM sqlite_master WHERE name = ?").get(LEGACY_TABLE);
|
|
278
|
+
if (view?.type === "view" && view.sql !== LEGACY_VIEW_RECORDED) this.db.exec(`DROP VIEW ${LEGACY_TABLE}`);
|
|
233
279
|
if (!this.stmt.hasName.get(LEGACY_TABLE)) this.db.exec(LEGACY_VIEW);
|
|
234
280
|
}).immediate();
|
|
235
281
|
for (const id of unreadable) {
|
|
@@ -263,12 +309,28 @@ var SqliteStore = class {
|
|
|
263
309
|
this.stmt.dropObjects.run(id);
|
|
264
310
|
}
|
|
265
311
|
load() {
|
|
266
|
-
return this.db.transaction(() => this.
|
|
312
|
+
return this.db.transaction(() => this.read(
|
|
313
|
+
this.stmt.metas.all(),
|
|
314
|
+
this.stmt.entries.all(),
|
|
315
|
+
this.stmt.objects.all()
|
|
316
|
+
))();
|
|
317
|
+
}
|
|
318
|
+
loadOne(id) {
|
|
319
|
+
return this.db.transaction(() => this.read(
|
|
320
|
+
this.stmt.metaOf.all(id),
|
|
321
|
+
this.stmt.entriesOf.all(id),
|
|
322
|
+
this.stmt.objectsOf.all(id)
|
|
323
|
+
))()[0];
|
|
324
|
+
}
|
|
325
|
+
version(id) {
|
|
326
|
+
if (!this.stmt.hasMeta.get(id)) return void 0;
|
|
327
|
+
const last = this.stmt.held.get(id)?.last;
|
|
328
|
+
return last === null || last === void 0 ? 0 : last + 1;
|
|
267
329
|
}
|
|
268
|
-
|
|
330
|
+
read(metas, entryRows, objectRows) {
|
|
269
331
|
const broken = /* @__PURE__ */ new Map();
|
|
270
332
|
const entries = /* @__PURE__ */ new Map();
|
|
271
|
-
for (const r of
|
|
333
|
+
for (const r of entryRows) {
|
|
272
334
|
if (broken.has(r.workspace)) continue;
|
|
273
335
|
let list = entries.get(r.workspace);
|
|
274
336
|
if (!list) entries.set(r.workspace, list = []);
|
|
@@ -283,7 +345,7 @@ var SqliteStore = class {
|
|
|
283
345
|
}
|
|
284
346
|
}
|
|
285
347
|
const objects = /* @__PURE__ */ new Map();
|
|
286
|
-
for (const r of
|
|
348
|
+
for (const r of objectRows) {
|
|
287
349
|
if (broken.has(r.workspace)) continue;
|
|
288
350
|
let list = objects.get(r.workspace);
|
|
289
351
|
if (!list) objects.set(r.workspace, list = []);
|
|
@@ -294,7 +356,7 @@ var SqliteStore = class {
|
|
|
294
356
|
}
|
|
295
357
|
}
|
|
296
358
|
const out = [];
|
|
297
|
-
for (const r of
|
|
359
|
+
for (const r of metas) {
|
|
298
360
|
let meta;
|
|
299
361
|
if (!broken.has(r.workspace)) {
|
|
300
362
|
try {
|