@brightbeamai/chap-coordinator 0.2.8 → 0.2.9

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.
@@ -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 v0.2 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}\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 from_seq?: number;\n to_seq?: number;\n}\nexport interface AuditVerifyChainResult {\n valid: boolean;\n breaks?: number[];\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: 39 method handlers shipped by both v0.2 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 from_seq?: number;\n to_seq?: number;\n}\nexport interface AuditVerifyChainResult {\n valid: boolean;\n breaks?: number[];\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":[]}
@@ -81,6 +81,7 @@ interface TaskCreateParams extends WorkspaceParam, ActorParam {
81
81
  to?: ParticipantUri;
82
82
  routing_hints?: Record<string, unknown>;
83
83
  deadline?: string;
84
+ idempotency_key?: string;
84
85
  }
85
86
  interface TaskCreateResult {
86
87
  task_id: TaskId;
package/dist/methods.d.ts CHANGED
@@ -81,6 +81,7 @@ interface TaskCreateParams extends WorkspaceParam, ActorParam {
81
81
  to?: ParticipantUri;
82
82
  routing_hints?: Record<string, unknown>;
83
83
  deadline?: string;
84
+ idempotency_key?: string;
84
85
  }
85
86
  interface TaskCreateResult {
86
87
  task_id: TaskId;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator. type vocabulary\n *\n * Wire-shape and in-memory types for the Coordinator. The schemas at\n * schemas/ are the normative wire types; these mirror them in\n * TypeScript for in-process use.\n */\n\nexport type ParticipantUri = string;\nexport type WorkspaceId = string;\nexport type TaskId = string;\nexport type ArtefactId = string;\n\nexport type ParticipantType = \"human\" | \"agent\" | \"service\" | \"group\" | \"workspace\";\n\nexport interface Envelope {\n jsonrpc: \"2.0\";\n id?: string | number;\n method?: string;\n params?: Record<string, unknown>;\n result?: unknown;\n error?: { code: number; message: string; data?: unknown };\n /** security-signed/1.0: top-level signature, signed over JCS of the\n * envelope with this field removed. Form: ``ed25519:<kid>:<b64>``. */\n sig?: string;\n}\n\nexport type Mode = \"shadow\" | \"trial\" | \"production\";\nexport type WorkspaceState = \"active\" | \"paused\" | \"closed\";\nexport type PauseScope = \"task\" | \"participant\" | \"workspace\";\n\nexport type TaskState =\n | \"created\"\n | \"in_progress\"\n | \"review_requested\"\n | \"completed\"\n | \"declined\"\n | \"abstained\"\n | \"escalated\"\n | \"superseded\"\n | \"paused\"\n | \"cancelled\";\n\n// ============================================================\n// Key records (security-signed/1.0)\n// ============================================================\n\nexport interface Jwk {\n kty: \"OKP\";\n crv: \"Ed25519\";\n kid: string;\n x: string;\n use?: string;\n alg?: string;\n}\n\n/** A participant's JWK plus the validity window. Lookup by\n * (participant, kid, ts) so historical envelopes verify across\n * rotation per security-signed/1.0 S3-S5. */\nexport interface KeyRecord {\n jwk: Jwk;\n kid: string;\n valid_from: string; // ISO timestamp; inclusive\n valid_until?: string; // ISO timestamp; exclusive; absent = unbounded\n revoked_at?: string;\n revoked_reason?: string;\n}\n\n// ============================================================\n// Participants\n// ============================================================\n\nexport interface Member {\n uri: ParticipantUri;\n type: ParticipantType;\n role: string;\n joined: string;\n display_name?: string;\n capabilities?: Record<string, unknown>;\n scopes?: string[];\n keys: KeyRecord[];\n paused: boolean; // control.pause scope=participant\n oidc_sub?: string;\n oidc_auth_time?: number; // unix seconds\n vc_holder?: string;\n}\n\n// ============================================================\n// Routing hints\n// ============================================================\n\nexport interface TaskRoutingHints {\n criticality?: \"low\" | \"medium\" | \"high\" | \"critical\";\n deadline?: string;\n max_cost_usd?: number;\n risk_tier?: string;\n [extra: string]: unknown;\n}\n\nexport interface ArtefactRoutingHints {\n confidence?: number | string;\n model_id?: string;\n cost_consumed_usd?: number;\n latency_ms?: number;\n [extra: string]: unknown;\n}\n\n// ============================================================\n// JSON Patch (RFC 6902)\n// ============================================================\n\nexport interface JsonPatchOp {\n op: \"add\" | \"replace\" | \"remove\" | \"copy\" | \"move\" | \"test\";\n path: string;\n value?: unknown;\n from?: string;\n}\n\n// ============================================================\n// Override artefact (review/1.0)\n// ============================================================\n\nexport interface OverrideArtefact {\n id: ArtefactId;\n task_id: TaskId;\n reviewer: ParticipantUri;\n based_on_artefact: unknown;\n diff: JsonPatchOp[];\n result: unknown;\n rationale: string;\n tags: string[];\n policy_refs: string[];\n ts: string;\n logical_id?: string;\n instance_id?: string;\n intent_preserved?: boolean;\n}\n\n// ============================================================\n// Route decision artefact (routing/1.0)\n// ============================================================\n\nexport interface RouteDecisionArtefact {\n id: ArtefactId;\n kind: \"route_decision\";\n decision_type: \"task.route\" | \"review.depth\" | \"escalate.auto\";\n outcome: unknown;\n produced_by: ParticipantUri;\n produced_at: string;\n task?: TaskId;\n policy_id?: string;\n hints_observed: Record<string, unknown>;\n rationale: string;\n // Auxiliary fields per decision_type:\n // task.route: alternatives_considered\n // review.depth: sampling_probability\n // escalate.auto: escalation_target\n [extra: string]: unknown;\n}\n\n// ============================================================\n// Snapshot artefact (control/1.0)\n// ============================================================\n\nexport interface SnapshotArtefact {\n id: ArtefactId;\n kind: \"snapshot\";\n ts: string;\n by: ParticipantUri;\n workspace: WorkspaceId;\n audit_seq: number;\n label?: string;\n include: string[];\n state: Record<string, unknown>;\n}\n\n// ============================================================\n// Whisper (whisper/1.0)\n// ============================================================\n\nexport interface WhisperPrompt {\n id: ArtefactId;\n task_id: TaskId;\n asker: ParticipantUri;\n askee: ParticipantUri[];\n question: string;\n options?: Array<{ id: string; label?: string }>;\n asked_at: string;\n deadline_ms: number;\n default_if_lapsed: unknown;\n urgency: \"low\" | \"medium\" | \"high\";\n state: \"pending\" | \"answered\" | \"lapsed\";\n answered_at?: string;\n answered_by?: ParticipantUri;\n answer_option?: string;\n answer_text?: string;\n comment?: string;\n default_applied?: unknown;\n}\n\n// ============================================================\n// Deliberation (deliberation/1.0)\n// ============================================================\n\nexport interface DeliberationVote {\n ts: string;\n voter: ParticipantUri;\n vote: \"yea\" | \"nay\" | \"abstain\";\n weight?: number;\n comment?: string;\n veto_invoked?: boolean;\n}\n\nexport interface Deliberation {\n id: string;\n task_id?: TaskId;\n opener: ParticipantUri;\n participants: ParticipantUri[];\n rule: string; // raw rule string\n question?: string;\n weights?: Record<ParticipantUri, number>;\n veto?: Record<ParticipantUri, boolean>;\n deadline?: string;\n state: \"open\" | \"closed\" | \"lapsed\";\n comments: { ts: string; from: ParticipantUri; text: string }[];\n votes: DeliberationVote[];\n outcome?: {\n outcome: \"approved\" | \"rejected\" | \"error\";\n rule: string;\n tally?: { yea: number; nay: number };\n vetoes?: ParticipantUri[];\n reason?: string;\n };\n opened_at: string;\n}\n\n// ============================================================\n// Handoff (handoff/1.0)\n// ============================================================\n\nexport interface HandoffTaskItem {\n task_id: TaskId;\n title?: string;\n status_summary?: string;\n next_action?: string;\n blockers?: string[];\n}\n\nexport interface Handoff {\n id: string;\n proposer: ParticipantUri;\n recipient: ParticipantUri; // single URI or \"group:...\"\n proposed_at: string;\n tasks: HandoffTaskItem[];\n summary?: string;\n context_links: string[];\n state: \"proposed\" | \"accepted\" | \"declined\";\n resolved_at?: string;\n accepted_by?: ParticipantUri;\n accepted_task_ids?: TaskId[];\n accept_comment?: string;\n decline_reason?: string;\n decline_suggested_target?: ParticipantUri;\n}\n\n// ============================================================\n// Review decision (review/1.0)\n// ============================================================\n\nexport interface ReviewDecision {\n reviewer: ParticipantUri;\n kind: \"approve\" | \"reject\" | \"override\" | \"abstain\";\n ts: string;\n comment?: string;\n tags?: string[];\n override_artefact_id?: ArtefactId;\n abstain_category?: string;\n}\n\n// ============================================================\n// Task\n// ============================================================\n\nexport interface Task {\n id: TaskId;\n kind: string;\n state: TaskState;\n assignee: ParticipantUri;\n delegator: ParticipantUri;\n input: Record<string, unknown>;\n output?: unknown;\n confidence?: number | string;\n deadline?: string;\n created_at: string;\n updated_at: string;\n mode: Mode;\n review_required?: boolean;\n routing_hints?: TaskRoutingHints;\n artefact_routing_hints?: ArtefactRoutingHints;\n review?: {\n requested_at: string;\n requested_to: ParticipantUri[];\n rule: string;\n deadline?: string;\n decisions: ReviewDecision[];\n };\n history: { ts: string; from: ParticipantUri; state: TaskState; note?: string }[];\n supersedes?: TaskId;\n superseded_by?: TaskId;\n parent?: TaskId;\n paused: boolean;\n /** Transient: holds the artefact passed to review.request so\n * decide.override can use it as the patch base. */\n pending_artefact?: unknown;\n}\n\n// ============================================================\n// Audit\n// ============================================================\n\nexport interface AuditEntry {\n seq: number;\n arrived: string;\n envelope: Envelope;\n prev_hash?: string;\n}\n\n// ============================================================\n// Workspace\n// ============================================================\n\nexport interface Workspace {\n id: WorkspaceId;\n created: string;\n state: WorkspaceState;\n profiles: string[];\n mode: Mode;\n mode_ceiling: Mode;\n routing_policy_uri?: string;\n step_up_window_sec: number;\n members: Map<ParticipantUri, Member>;\n tasks: Map<TaskId, Task>;\n overrides: Map<ArtefactId, OverrideArtefact>;\n whispers: Map<string, WhisperPrompt>;\n deliberations: Map<string, Deliberation>;\n handoffs: Map<string, Handoff>;\n snapshots: Map<ArtefactId, SnapshotArtefact>;\n route_decisions: Map<ArtefactId, RouteDecisionArtefact>;\n audit: AuditEntry[];\n chain_head?: string;\n chain_enabled: boolean;\n}\n\n/**\n * Listener callback invoked synchronously when an envelope is appended\n * to the workspace audit log.\n */\nexport type AuditListener = (workspace: Workspace, entry: AuditEntry) => void;\n\n/** True iff mode `a` is <= ceiling. */\nexport function modeLE(a: Mode, ceiling: Mode): boolean {\n const order: Record<Mode, number> = { shadow: 0, trial: 1, production: 2 };\n return order[a] <= order[ceiling];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwWO,SAAS,OAAO,GAAS,SAAwB;AACtD,QAAM,QAA8B,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,EAAE;AACzE,SAAO,MAAM,CAAC,KAAK,MAAM,OAAO;AAClC;","names":[]}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator. type vocabulary\n *\n * Wire-shape and in-memory types for the Coordinator. The schemas at\n * schemas/ are the normative wire types; these mirror them in\n * TypeScript for in-process use.\n */\n\nexport type ParticipantUri = string;\nexport type WorkspaceId = string;\nexport type TaskId = string;\nexport type ArtefactId = string;\n\nexport type ParticipantType = \"human\" | \"agent\" | \"service\" | \"group\" | \"workspace\";\n\nexport interface Envelope {\n jsonrpc: \"2.0\";\n id?: string | number;\n method?: string;\n params?: Record<string, unknown>;\n result?: unknown;\n error?: { code: number; message: string; data?: unknown };\n /** security-signed/1.0: top-level signature, signed over JCS of the\n * envelope with this field removed. Form: ``ed25519:<kid>:<b64>``. */\n sig?: string;\n}\n\nexport type Mode = \"shadow\" | \"trial\" | \"production\";\nexport type WorkspaceState = \"active\" | \"paused\" | \"closed\";\nexport type PauseScope = \"task\" | \"participant\" | \"workspace\";\n\nexport type TaskState =\n | \"created\"\n | \"in_progress\"\n | \"review_requested\"\n | \"completed\"\n | \"declined\"\n | \"abstained\"\n | \"escalated\"\n | \"superseded\"\n | \"paused\"\n | \"cancelled\";\n\n// ============================================================\n// Key records (security-signed/1.0)\n// ============================================================\n\nexport interface Jwk {\n kty: \"OKP\";\n crv: \"Ed25519\";\n kid: string;\n x: string;\n use?: string;\n alg?: string;\n}\n\n/** A participant's JWK plus the validity window. Lookup by\n * (participant, kid, ts) so historical envelopes verify across\n * rotation per security-signed/1.0 S3-S5. */\nexport interface KeyRecord {\n jwk: Jwk;\n kid: string;\n valid_from: string; // ISO timestamp; inclusive\n valid_until?: string; // ISO timestamp; exclusive; absent = unbounded\n revoked_at?: string;\n revoked_reason?: string;\n}\n\n// ============================================================\n// Participants\n// ============================================================\n\nexport interface Member {\n uri: ParticipantUri;\n type: ParticipantType;\n role: string;\n joined: string;\n display_name?: string;\n capabilities?: Record<string, unknown>;\n scopes?: string[];\n keys: KeyRecord[];\n paused: boolean; // control.pause scope=participant\n oidc_sub?: string;\n oidc_auth_time?: number; // unix seconds\n oidc_acr?: string;\n vc_holder?: string;\n}\n\n// ============================================================\n// Routing hints\n// ============================================================\n\nexport interface TaskRoutingHints {\n criticality?: \"low\" | \"medium\" | \"high\" | \"critical\";\n deadline?: string;\n max_cost_usd?: number;\n risk_tier?: string;\n [extra: string]: unknown;\n}\n\nexport interface ArtefactRoutingHints {\n confidence?: number | string;\n model_id?: string;\n cost_consumed_usd?: number;\n latency_ms?: number;\n [extra: string]: unknown;\n}\n\n// ============================================================\n// JSON Patch (RFC 6902)\n// ============================================================\n\nexport interface JsonPatchOp {\n op: \"add\" | \"replace\" | \"remove\" | \"copy\" | \"move\" | \"test\";\n path: string;\n value?: unknown;\n from?: string;\n}\n\n// ============================================================\n// Override artefact (review/1.0)\n// ============================================================\n\nexport interface OverrideArtefact {\n id: ArtefactId;\n task_id: TaskId;\n reviewer: ParticipantUri;\n based_on_artefact: unknown;\n diff: JsonPatchOp[];\n result: unknown;\n rationale: string;\n tags: string[];\n policy_refs: string[];\n ts: string;\n logical_id?: string;\n instance_id?: string;\n intent_preserved?: boolean;\n}\n\n// ============================================================\n// Route decision artefact (routing/1.0)\n// ============================================================\n\nexport interface RouteDecisionArtefact {\n id: ArtefactId;\n kind: \"route_decision\";\n decision_type: \"task.route\" | \"review.depth\" | \"escalate.auto\";\n outcome: unknown;\n produced_by: ParticipantUri;\n produced_at: string;\n task?: TaskId;\n policy_id?: string;\n hints_observed: Record<string, unknown>;\n rationale: string;\n // Auxiliary fields per decision_type:\n // task.route: alternatives_considered\n // review.depth: sampling_probability\n // escalate.auto: escalation_target\n [extra: string]: unknown;\n}\n\n// ============================================================\n// Snapshot artefact (control/1.0)\n// ============================================================\n\nexport interface SnapshotArtefact {\n id: ArtefactId;\n kind: \"snapshot\";\n ts: string;\n by: ParticipantUri;\n workspace: WorkspaceId;\n audit_seq: number;\n label?: string;\n include: string[];\n state: Record<string, unknown>;\n}\n\n// ============================================================\n// Whisper (whisper/1.0)\n// ============================================================\n\nexport interface WhisperPrompt {\n id: ArtefactId;\n task_id: TaskId;\n asker: ParticipantUri;\n askee: ParticipantUri[];\n question: string;\n options?: Array<{ id: string; label?: string }>;\n asked_at: string;\n deadline_ms: number;\n default_if_lapsed: unknown;\n urgency: \"low\" | \"medium\" | \"high\";\n state: \"pending\" | \"answered\" | \"lapsed\";\n answered_at?: string;\n answered_by?: ParticipantUri;\n answer_option?: string;\n answer_text?: string;\n comment?: string;\n default_applied?: unknown;\n}\n\n// ============================================================\n// Deliberation (deliberation/1.0)\n// ============================================================\n\nexport interface DeliberationVote {\n ts: string;\n voter: ParticipantUri;\n vote: \"yea\" | \"nay\" | \"abstain\";\n weight?: number;\n comment?: string;\n veto_invoked?: boolean;\n}\n\nexport interface Deliberation {\n id: string;\n task_id?: TaskId;\n opener: ParticipantUri;\n participants: ParticipantUri[];\n rule: string; // raw rule string\n question?: string;\n weights?: Record<ParticipantUri, number>;\n veto?: Record<ParticipantUri, boolean>;\n deadline?: string;\n state: \"open\" | \"closed\" | \"lapsed\";\n comments: { ts: string; from: ParticipantUri; text: string }[];\n votes: DeliberationVote[];\n outcome?: {\n outcome: \"approved\" | \"rejected\" | \"error\";\n rule: string;\n tally?: { yea: number; nay: number };\n vetoes?: ParticipantUri[];\n reason?: string;\n };\n opened_at: string;\n}\n\n// ============================================================\n// Handoff (handoff/1.0)\n// ============================================================\n\nexport interface HandoffTaskItem {\n task_id: TaskId;\n title?: string;\n status_summary?: string;\n next_action?: string;\n blockers?: string[];\n}\n\nexport interface Handoff {\n id: string;\n proposer: ParticipantUri;\n recipient: ParticipantUri; // single URI or \"group:...\"\n proposed_at: string;\n tasks: HandoffTaskItem[];\n summary?: string;\n context_links: string[];\n state: \"proposed\" | \"accepted\" | \"declined\";\n resolved_at?: string;\n accepted_by?: ParticipantUri;\n accepted_task_ids?: TaskId[];\n accept_comment?: string;\n decline_reason?: string;\n decline_suggested_target?: ParticipantUri;\n}\n\n// ============================================================\n// Review decision (review/1.0)\n// ============================================================\n\nexport interface ReviewDecision {\n reviewer: ParticipantUri;\n kind: \"approve\" | \"reject\" | \"override\" | \"abstain\";\n ts: string;\n comment?: string;\n tags?: string[];\n override_artefact_id?: ArtefactId;\n abstain_category?: string;\n}\n\n// ============================================================\n// Task\n// ============================================================\n\nexport interface Task {\n id: TaskId;\n kind: string;\n state: TaskState;\n assignee: ParticipantUri;\n delegator: ParticipantUri;\n input: Record<string, unknown>;\n output?: unknown;\n confidence?: number | string;\n deadline?: string;\n created_at: string;\n updated_at: string;\n mode: Mode;\n review_required?: boolean;\n routing_hints?: TaskRoutingHints;\n artefact_routing_hints?: ArtefactRoutingHints;\n review?: {\n requested_at: string;\n requested_to: ParticipantUri[];\n rule: string;\n deadline?: string;\n decisions: ReviewDecision[];\n };\n history: { ts: string; from: ParticipantUri; state: TaskState; note?: string }[];\n supersedes?: TaskId;\n superseded_by?: TaskId;\n parent?: TaskId;\n paused: boolean;\n /** Transient: holds the artefact passed to review.request so\n * decide.override can use it as the patch base. */\n pending_artefact?: unknown;\n}\n\n// ============================================================\n// Audit\n// ============================================================\n\nexport interface AuditEntry {\n seq: number;\n arrived: string;\n envelope: Envelope;\n prev_hash?: string;\n}\n\n// ============================================================\n// Workspace\n// ============================================================\n\nexport interface Workspace {\n id: WorkspaceId;\n created: string;\n state: WorkspaceState;\n profiles: string[];\n mode: Mode;\n mode_ceiling: Mode;\n routing_policy_uri?: string;\n step_up_window_sec: number;\n min_acr?: string;\n members: Map<ParticipantUri, Member>;\n tasks: Map<TaskId, Task>;\n overrides: Map<ArtefactId, OverrideArtefact>;\n whispers: Map<string, WhisperPrompt>;\n deliberations: Map<string, Deliberation>;\n handoffs: Map<string, Handoff>;\n snapshots: Map<ArtefactId, SnapshotArtefact>;\n route_decisions: Map<ArtefactId, RouteDecisionArtefact>;\n // task.create idempotency: caller-supplied key -> task_id.\n idempotency_keys: Record<string, TaskId>;\n audit: AuditEntry[];\n chain_head?: string;\n chain_enabled: boolean;\n}\n\n/**\n * Listener callback invoked synchronously when an envelope is appended\n * to the workspace audit log.\n */\nexport type AuditListener = (workspace: Workspace, entry: AuditEntry) => void;\n\n/** True iff mode `a` is <= ceiling. */\nexport function modeLE(a: Mode, ceiling: Mode): boolean {\n const order: Record<Mode, number> = { shadow: 0, trial: 1, production: 2 };\n return order[a] <= order[ceiling];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4WO,SAAS,OAAO,GAAS,SAAwB;AACtD,QAAM,QAA8B,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,EAAE;AACzE,SAAO,MAAM,CAAC,KAAK,MAAM,OAAO;AAClC;","names":[]}
package/dist/types.d.cts CHANGED
@@ -60,6 +60,7 @@ interface Member {
60
60
  paused: boolean;
61
61
  oidc_sub?: string;
62
62
  oidc_auth_time?: number;
63
+ oidc_acr?: string;
63
64
  vc_holder?: string;
64
65
  }
65
66
  interface TaskRoutingHints {
@@ -264,6 +265,7 @@ interface Workspace {
264
265
  mode_ceiling: Mode;
265
266
  routing_policy_uri?: string;
266
267
  step_up_window_sec: number;
268
+ min_acr?: string;
267
269
  members: Map<ParticipantUri, Member>;
268
270
  tasks: Map<TaskId, Task>;
269
271
  overrides: Map<ArtefactId, OverrideArtefact>;
@@ -272,6 +274,7 @@ interface Workspace {
272
274
  handoffs: Map<string, Handoff>;
273
275
  snapshots: Map<ArtefactId, SnapshotArtefact>;
274
276
  route_decisions: Map<ArtefactId, RouteDecisionArtefact>;
277
+ idempotency_keys: Record<string, TaskId>;
275
278
  audit: AuditEntry[];
276
279
  chain_head?: string;
277
280
  chain_enabled: boolean;
package/dist/types.d.ts CHANGED
@@ -60,6 +60,7 @@ interface Member {
60
60
  paused: boolean;
61
61
  oidc_sub?: string;
62
62
  oidc_auth_time?: number;
63
+ oidc_acr?: string;
63
64
  vc_holder?: string;
64
65
  }
65
66
  interface TaskRoutingHints {
@@ -264,6 +265,7 @@ interface Workspace {
264
265
  mode_ceiling: Mode;
265
266
  routing_policy_uri?: string;
266
267
  step_up_window_sec: number;
268
+ min_acr?: string;
267
269
  members: Map<ParticipantUri, Member>;
268
270
  tasks: Map<TaskId, Task>;
269
271
  overrides: Map<ArtefactId, OverrideArtefact>;
@@ -272,6 +274,7 @@ interface Workspace {
272
274
  handoffs: Map<string, Handoff>;
273
275
  snapshots: Map<ArtefactId, SnapshotArtefact>;
274
276
  route_decisions: Map<ArtefactId, RouteDecisionArtefact>;
277
+ idempotency_keys: Record<string, TaskId>;
275
278
  audit: AuditEntry[];
276
279
  chain_head?: string;
277
280
  chain_enabled: boolean;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator. type vocabulary\n *\n * Wire-shape and in-memory types for the Coordinator. The schemas at\n * schemas/ are the normative wire types; these mirror them in\n * TypeScript for in-process use.\n */\n\nexport type ParticipantUri = string;\nexport type WorkspaceId = string;\nexport type TaskId = string;\nexport type ArtefactId = string;\n\nexport type ParticipantType = \"human\" | \"agent\" | \"service\" | \"group\" | \"workspace\";\n\nexport interface Envelope {\n jsonrpc: \"2.0\";\n id?: string | number;\n method?: string;\n params?: Record<string, unknown>;\n result?: unknown;\n error?: { code: number; message: string; data?: unknown };\n /** security-signed/1.0: top-level signature, signed over JCS of the\n * envelope with this field removed. Form: ``ed25519:<kid>:<b64>``. */\n sig?: string;\n}\n\nexport type Mode = \"shadow\" | \"trial\" | \"production\";\nexport type WorkspaceState = \"active\" | \"paused\" | \"closed\";\nexport type PauseScope = \"task\" | \"participant\" | \"workspace\";\n\nexport type TaskState =\n | \"created\"\n | \"in_progress\"\n | \"review_requested\"\n | \"completed\"\n | \"declined\"\n | \"abstained\"\n | \"escalated\"\n | \"superseded\"\n | \"paused\"\n | \"cancelled\";\n\n// ============================================================\n// Key records (security-signed/1.0)\n// ============================================================\n\nexport interface Jwk {\n kty: \"OKP\";\n crv: \"Ed25519\";\n kid: string;\n x: string;\n use?: string;\n alg?: string;\n}\n\n/** A participant's JWK plus the validity window. Lookup by\n * (participant, kid, ts) so historical envelopes verify across\n * rotation per security-signed/1.0 S3-S5. */\nexport interface KeyRecord {\n jwk: Jwk;\n kid: string;\n valid_from: string; // ISO timestamp; inclusive\n valid_until?: string; // ISO timestamp; exclusive; absent = unbounded\n revoked_at?: string;\n revoked_reason?: string;\n}\n\n// ============================================================\n// Participants\n// ============================================================\n\nexport interface Member {\n uri: ParticipantUri;\n type: ParticipantType;\n role: string;\n joined: string;\n display_name?: string;\n capabilities?: Record<string, unknown>;\n scopes?: string[];\n keys: KeyRecord[];\n paused: boolean; // control.pause scope=participant\n oidc_sub?: string;\n oidc_auth_time?: number; // unix seconds\n vc_holder?: string;\n}\n\n// ============================================================\n// Routing hints\n// ============================================================\n\nexport interface TaskRoutingHints {\n criticality?: \"low\" | \"medium\" | \"high\" | \"critical\";\n deadline?: string;\n max_cost_usd?: number;\n risk_tier?: string;\n [extra: string]: unknown;\n}\n\nexport interface ArtefactRoutingHints {\n confidence?: number | string;\n model_id?: string;\n cost_consumed_usd?: number;\n latency_ms?: number;\n [extra: string]: unknown;\n}\n\n// ============================================================\n// JSON Patch (RFC 6902)\n// ============================================================\n\nexport interface JsonPatchOp {\n op: \"add\" | \"replace\" | \"remove\" | \"copy\" | \"move\" | \"test\";\n path: string;\n value?: unknown;\n from?: string;\n}\n\n// ============================================================\n// Override artefact (review/1.0)\n// ============================================================\n\nexport interface OverrideArtefact {\n id: ArtefactId;\n task_id: TaskId;\n reviewer: ParticipantUri;\n based_on_artefact: unknown;\n diff: JsonPatchOp[];\n result: unknown;\n rationale: string;\n tags: string[];\n policy_refs: string[];\n ts: string;\n logical_id?: string;\n instance_id?: string;\n intent_preserved?: boolean;\n}\n\n// ============================================================\n// Route decision artefact (routing/1.0)\n// ============================================================\n\nexport interface RouteDecisionArtefact {\n id: ArtefactId;\n kind: \"route_decision\";\n decision_type: \"task.route\" | \"review.depth\" | \"escalate.auto\";\n outcome: unknown;\n produced_by: ParticipantUri;\n produced_at: string;\n task?: TaskId;\n policy_id?: string;\n hints_observed: Record<string, unknown>;\n rationale: string;\n // Auxiliary fields per decision_type:\n // task.route: alternatives_considered\n // review.depth: sampling_probability\n // escalate.auto: escalation_target\n [extra: string]: unknown;\n}\n\n// ============================================================\n// Snapshot artefact (control/1.0)\n// ============================================================\n\nexport interface SnapshotArtefact {\n id: ArtefactId;\n kind: \"snapshot\";\n ts: string;\n by: ParticipantUri;\n workspace: WorkspaceId;\n audit_seq: number;\n label?: string;\n include: string[];\n state: Record<string, unknown>;\n}\n\n// ============================================================\n// Whisper (whisper/1.0)\n// ============================================================\n\nexport interface WhisperPrompt {\n id: ArtefactId;\n task_id: TaskId;\n asker: ParticipantUri;\n askee: ParticipantUri[];\n question: string;\n options?: Array<{ id: string; label?: string }>;\n asked_at: string;\n deadline_ms: number;\n default_if_lapsed: unknown;\n urgency: \"low\" | \"medium\" | \"high\";\n state: \"pending\" | \"answered\" | \"lapsed\";\n answered_at?: string;\n answered_by?: ParticipantUri;\n answer_option?: string;\n answer_text?: string;\n comment?: string;\n default_applied?: unknown;\n}\n\n// ============================================================\n// Deliberation (deliberation/1.0)\n// ============================================================\n\nexport interface DeliberationVote {\n ts: string;\n voter: ParticipantUri;\n vote: \"yea\" | \"nay\" | \"abstain\";\n weight?: number;\n comment?: string;\n veto_invoked?: boolean;\n}\n\nexport interface Deliberation {\n id: string;\n task_id?: TaskId;\n opener: ParticipantUri;\n participants: ParticipantUri[];\n rule: string; // raw rule string\n question?: string;\n weights?: Record<ParticipantUri, number>;\n veto?: Record<ParticipantUri, boolean>;\n deadline?: string;\n state: \"open\" | \"closed\" | \"lapsed\";\n comments: { ts: string; from: ParticipantUri; text: string }[];\n votes: DeliberationVote[];\n outcome?: {\n outcome: \"approved\" | \"rejected\" | \"error\";\n rule: string;\n tally?: { yea: number; nay: number };\n vetoes?: ParticipantUri[];\n reason?: string;\n };\n opened_at: string;\n}\n\n// ============================================================\n// Handoff (handoff/1.0)\n// ============================================================\n\nexport interface HandoffTaskItem {\n task_id: TaskId;\n title?: string;\n status_summary?: string;\n next_action?: string;\n blockers?: string[];\n}\n\nexport interface Handoff {\n id: string;\n proposer: ParticipantUri;\n recipient: ParticipantUri; // single URI or \"group:...\"\n proposed_at: string;\n tasks: HandoffTaskItem[];\n summary?: string;\n context_links: string[];\n state: \"proposed\" | \"accepted\" | \"declined\";\n resolved_at?: string;\n accepted_by?: ParticipantUri;\n accepted_task_ids?: TaskId[];\n accept_comment?: string;\n decline_reason?: string;\n decline_suggested_target?: ParticipantUri;\n}\n\n// ============================================================\n// Review decision (review/1.0)\n// ============================================================\n\nexport interface ReviewDecision {\n reviewer: ParticipantUri;\n kind: \"approve\" | \"reject\" | \"override\" | \"abstain\";\n ts: string;\n comment?: string;\n tags?: string[];\n override_artefact_id?: ArtefactId;\n abstain_category?: string;\n}\n\n// ============================================================\n// Task\n// ============================================================\n\nexport interface Task {\n id: TaskId;\n kind: string;\n state: TaskState;\n assignee: ParticipantUri;\n delegator: ParticipantUri;\n input: Record<string, unknown>;\n output?: unknown;\n confidence?: number | string;\n deadline?: string;\n created_at: string;\n updated_at: string;\n mode: Mode;\n review_required?: boolean;\n routing_hints?: TaskRoutingHints;\n artefact_routing_hints?: ArtefactRoutingHints;\n review?: {\n requested_at: string;\n requested_to: ParticipantUri[];\n rule: string;\n deadline?: string;\n decisions: ReviewDecision[];\n };\n history: { ts: string; from: ParticipantUri; state: TaskState; note?: string }[];\n supersedes?: TaskId;\n superseded_by?: TaskId;\n parent?: TaskId;\n paused: boolean;\n /** Transient: holds the artefact passed to review.request so\n * decide.override can use it as the patch base. */\n pending_artefact?: unknown;\n}\n\n// ============================================================\n// Audit\n// ============================================================\n\nexport interface AuditEntry {\n seq: number;\n arrived: string;\n envelope: Envelope;\n prev_hash?: string;\n}\n\n// ============================================================\n// Workspace\n// ============================================================\n\nexport interface Workspace {\n id: WorkspaceId;\n created: string;\n state: WorkspaceState;\n profiles: string[];\n mode: Mode;\n mode_ceiling: Mode;\n routing_policy_uri?: string;\n step_up_window_sec: number;\n members: Map<ParticipantUri, Member>;\n tasks: Map<TaskId, Task>;\n overrides: Map<ArtefactId, OverrideArtefact>;\n whispers: Map<string, WhisperPrompt>;\n deliberations: Map<string, Deliberation>;\n handoffs: Map<string, Handoff>;\n snapshots: Map<ArtefactId, SnapshotArtefact>;\n route_decisions: Map<ArtefactId, RouteDecisionArtefact>;\n audit: AuditEntry[];\n chain_head?: string;\n chain_enabled: boolean;\n}\n\n/**\n * Listener callback invoked synchronously when an envelope is appended\n * to the workspace audit log.\n */\nexport type AuditListener = (workspace: Workspace, entry: AuditEntry) => void;\n\n/** True iff mode `a` is <= ceiling. */\nexport function modeLE(a: Mode, ceiling: Mode): boolean {\n const order: Record<Mode, number> = { shadow: 0, trial: 1, production: 2 };\n return order[a] <= order[ceiling];\n}\n"],"mappings":";AAwWO,SAAS,OAAO,GAAS,SAAwB;AACtD,QAAM,QAA8B,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,EAAE;AACzE,SAAO,MAAM,CAAC,KAAK,MAAM,OAAO;AAClC;","names":[]}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator. type vocabulary\n *\n * Wire-shape and in-memory types for the Coordinator. The schemas at\n * schemas/ are the normative wire types; these mirror them in\n * TypeScript for in-process use.\n */\n\nexport type ParticipantUri = string;\nexport type WorkspaceId = string;\nexport type TaskId = string;\nexport type ArtefactId = string;\n\nexport type ParticipantType = \"human\" | \"agent\" | \"service\" | \"group\" | \"workspace\";\n\nexport interface Envelope {\n jsonrpc: \"2.0\";\n id?: string | number;\n method?: string;\n params?: Record<string, unknown>;\n result?: unknown;\n error?: { code: number; message: string; data?: unknown };\n /** security-signed/1.0: top-level signature, signed over JCS of the\n * envelope with this field removed. Form: ``ed25519:<kid>:<b64>``. */\n sig?: string;\n}\n\nexport type Mode = \"shadow\" | \"trial\" | \"production\";\nexport type WorkspaceState = \"active\" | \"paused\" | \"closed\";\nexport type PauseScope = \"task\" | \"participant\" | \"workspace\";\n\nexport type TaskState =\n | \"created\"\n | \"in_progress\"\n | \"review_requested\"\n | \"completed\"\n | \"declined\"\n | \"abstained\"\n | \"escalated\"\n | \"superseded\"\n | \"paused\"\n | \"cancelled\";\n\n// ============================================================\n// Key records (security-signed/1.0)\n// ============================================================\n\nexport interface Jwk {\n kty: \"OKP\";\n crv: \"Ed25519\";\n kid: string;\n x: string;\n use?: string;\n alg?: string;\n}\n\n/** A participant's JWK plus the validity window. Lookup by\n * (participant, kid, ts) so historical envelopes verify across\n * rotation per security-signed/1.0 S3-S5. */\nexport interface KeyRecord {\n jwk: Jwk;\n kid: string;\n valid_from: string; // ISO timestamp; inclusive\n valid_until?: string; // ISO timestamp; exclusive; absent = unbounded\n revoked_at?: string;\n revoked_reason?: string;\n}\n\n// ============================================================\n// Participants\n// ============================================================\n\nexport interface Member {\n uri: ParticipantUri;\n type: ParticipantType;\n role: string;\n joined: string;\n display_name?: string;\n capabilities?: Record<string, unknown>;\n scopes?: string[];\n keys: KeyRecord[];\n paused: boolean; // control.pause scope=participant\n oidc_sub?: string;\n oidc_auth_time?: number; // unix seconds\n oidc_acr?: string;\n vc_holder?: string;\n}\n\n// ============================================================\n// Routing hints\n// ============================================================\n\nexport interface TaskRoutingHints {\n criticality?: \"low\" | \"medium\" | \"high\" | \"critical\";\n deadline?: string;\n max_cost_usd?: number;\n risk_tier?: string;\n [extra: string]: unknown;\n}\n\nexport interface ArtefactRoutingHints {\n confidence?: number | string;\n model_id?: string;\n cost_consumed_usd?: number;\n latency_ms?: number;\n [extra: string]: unknown;\n}\n\n// ============================================================\n// JSON Patch (RFC 6902)\n// ============================================================\n\nexport interface JsonPatchOp {\n op: \"add\" | \"replace\" | \"remove\" | \"copy\" | \"move\" | \"test\";\n path: string;\n value?: unknown;\n from?: string;\n}\n\n// ============================================================\n// Override artefact (review/1.0)\n// ============================================================\n\nexport interface OverrideArtefact {\n id: ArtefactId;\n task_id: TaskId;\n reviewer: ParticipantUri;\n based_on_artefact: unknown;\n diff: JsonPatchOp[];\n result: unknown;\n rationale: string;\n tags: string[];\n policy_refs: string[];\n ts: string;\n logical_id?: string;\n instance_id?: string;\n intent_preserved?: boolean;\n}\n\n// ============================================================\n// Route decision artefact (routing/1.0)\n// ============================================================\n\nexport interface RouteDecisionArtefact {\n id: ArtefactId;\n kind: \"route_decision\";\n decision_type: \"task.route\" | \"review.depth\" | \"escalate.auto\";\n outcome: unknown;\n produced_by: ParticipantUri;\n produced_at: string;\n task?: TaskId;\n policy_id?: string;\n hints_observed: Record<string, unknown>;\n rationale: string;\n // Auxiliary fields per decision_type:\n // task.route: alternatives_considered\n // review.depth: sampling_probability\n // escalate.auto: escalation_target\n [extra: string]: unknown;\n}\n\n// ============================================================\n// Snapshot artefact (control/1.0)\n// ============================================================\n\nexport interface SnapshotArtefact {\n id: ArtefactId;\n kind: \"snapshot\";\n ts: string;\n by: ParticipantUri;\n workspace: WorkspaceId;\n audit_seq: number;\n label?: string;\n include: string[];\n state: Record<string, unknown>;\n}\n\n// ============================================================\n// Whisper (whisper/1.0)\n// ============================================================\n\nexport interface WhisperPrompt {\n id: ArtefactId;\n task_id: TaskId;\n asker: ParticipantUri;\n askee: ParticipantUri[];\n question: string;\n options?: Array<{ id: string; label?: string }>;\n asked_at: string;\n deadline_ms: number;\n default_if_lapsed: unknown;\n urgency: \"low\" | \"medium\" | \"high\";\n state: \"pending\" | \"answered\" | \"lapsed\";\n answered_at?: string;\n answered_by?: ParticipantUri;\n answer_option?: string;\n answer_text?: string;\n comment?: string;\n default_applied?: unknown;\n}\n\n// ============================================================\n// Deliberation (deliberation/1.0)\n// ============================================================\n\nexport interface DeliberationVote {\n ts: string;\n voter: ParticipantUri;\n vote: \"yea\" | \"nay\" | \"abstain\";\n weight?: number;\n comment?: string;\n veto_invoked?: boolean;\n}\n\nexport interface Deliberation {\n id: string;\n task_id?: TaskId;\n opener: ParticipantUri;\n participants: ParticipantUri[];\n rule: string; // raw rule string\n question?: string;\n weights?: Record<ParticipantUri, number>;\n veto?: Record<ParticipantUri, boolean>;\n deadline?: string;\n state: \"open\" | \"closed\" | \"lapsed\";\n comments: { ts: string; from: ParticipantUri; text: string }[];\n votes: DeliberationVote[];\n outcome?: {\n outcome: \"approved\" | \"rejected\" | \"error\";\n rule: string;\n tally?: { yea: number; nay: number };\n vetoes?: ParticipantUri[];\n reason?: string;\n };\n opened_at: string;\n}\n\n// ============================================================\n// Handoff (handoff/1.0)\n// ============================================================\n\nexport interface HandoffTaskItem {\n task_id: TaskId;\n title?: string;\n status_summary?: string;\n next_action?: string;\n blockers?: string[];\n}\n\nexport interface Handoff {\n id: string;\n proposer: ParticipantUri;\n recipient: ParticipantUri; // single URI or \"group:...\"\n proposed_at: string;\n tasks: HandoffTaskItem[];\n summary?: string;\n context_links: string[];\n state: \"proposed\" | \"accepted\" | \"declined\";\n resolved_at?: string;\n accepted_by?: ParticipantUri;\n accepted_task_ids?: TaskId[];\n accept_comment?: string;\n decline_reason?: string;\n decline_suggested_target?: ParticipantUri;\n}\n\n// ============================================================\n// Review decision (review/1.0)\n// ============================================================\n\nexport interface ReviewDecision {\n reviewer: ParticipantUri;\n kind: \"approve\" | \"reject\" | \"override\" | \"abstain\";\n ts: string;\n comment?: string;\n tags?: string[];\n override_artefact_id?: ArtefactId;\n abstain_category?: string;\n}\n\n// ============================================================\n// Task\n// ============================================================\n\nexport interface Task {\n id: TaskId;\n kind: string;\n state: TaskState;\n assignee: ParticipantUri;\n delegator: ParticipantUri;\n input: Record<string, unknown>;\n output?: unknown;\n confidence?: number | string;\n deadline?: string;\n created_at: string;\n updated_at: string;\n mode: Mode;\n review_required?: boolean;\n routing_hints?: TaskRoutingHints;\n artefact_routing_hints?: ArtefactRoutingHints;\n review?: {\n requested_at: string;\n requested_to: ParticipantUri[];\n rule: string;\n deadline?: string;\n decisions: ReviewDecision[];\n };\n history: { ts: string; from: ParticipantUri; state: TaskState; note?: string }[];\n supersedes?: TaskId;\n superseded_by?: TaskId;\n parent?: TaskId;\n paused: boolean;\n /** Transient: holds the artefact passed to review.request so\n * decide.override can use it as the patch base. */\n pending_artefact?: unknown;\n}\n\n// ============================================================\n// Audit\n// ============================================================\n\nexport interface AuditEntry {\n seq: number;\n arrived: string;\n envelope: Envelope;\n prev_hash?: string;\n}\n\n// ============================================================\n// Workspace\n// ============================================================\n\nexport interface Workspace {\n id: WorkspaceId;\n created: string;\n state: WorkspaceState;\n profiles: string[];\n mode: Mode;\n mode_ceiling: Mode;\n routing_policy_uri?: string;\n step_up_window_sec: number;\n min_acr?: string;\n members: Map<ParticipantUri, Member>;\n tasks: Map<TaskId, Task>;\n overrides: Map<ArtefactId, OverrideArtefact>;\n whispers: Map<string, WhisperPrompt>;\n deliberations: Map<string, Deliberation>;\n handoffs: Map<string, Handoff>;\n snapshots: Map<ArtefactId, SnapshotArtefact>;\n route_decisions: Map<ArtefactId, RouteDecisionArtefact>;\n // task.create idempotency: caller-supplied key -> task_id.\n idempotency_keys: Record<string, TaskId>;\n audit: AuditEntry[];\n chain_head?: string;\n chain_enabled: boolean;\n}\n\n/**\n * Listener callback invoked synchronously when an envelope is appended\n * to the workspace audit log.\n */\nexport type AuditListener = (workspace: Workspace, entry: AuditEntry) => void;\n\n/** True iff mode `a` is <= ceiling. */\nexport function modeLE(a: Mode, ceiling: Mode): boolean {\n const order: Record<Mode, number> = { shadow: 0, trial: 1, production: 2 };\n return order[a] <= order[ceiling];\n}\n"],"mappings":";AA4WO,SAAS,OAAO,GAAS,SAAwB;AACtD,QAAM,QAA8B,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,EAAE;AACzE,SAAO,MAAM,CAAC,KAAK,MAAM,OAAO;AAClC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightbeamai/chap-coordinator",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Collaborative Human-Agent Protocol (CHAP): reference TypeScript implementation. Coordinator with Core + every shipped profile, plus pluggable storage and typed method facade.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Brightbeam AI <oss@brightbeam.com>",
@@ -18,7 +18,7 @@
18
18
  "human-ai", "human-agent", "review", "override", "scitt", "mcp", "a2a"
19
19
  ],
20
20
  "type": "module",
21
- "engines": { "node": ">=18" },
21
+ "engines": { "node": ">=20" },
22
22
  "files": ["dist", "README.md", "LICENSE"],
23
23
  "main": "./dist/index.cjs",
24
24
  "module": "./dist/index.js",