@brightbeamai/chap-coordinator-mcp 0.2.9 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schemas.cjs CHANGED
@@ -181,6 +181,11 @@ var SCHEMAS = {
181
181
  workspace: WORKSPACE_ID,
182
182
  from: PARTICIPANT_URI,
183
183
  task_id: TASK_ID,
184
+ approved_artefact_digest: {
185
+ type: "string",
186
+ pattern: "^sha256:[0-9a-f]{64}$",
187
+ description: "Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch."
188
+ },
184
189
  comment: { type: "string" },
185
190
  tags: { type: "array", items: { type: "string" } }
186
191
  },
@@ -192,6 +197,11 @@ var SCHEMAS = {
192
197
  workspace: WORKSPACE_ID,
193
198
  from: PARTICIPANT_URI,
194
199
  task_id: TASK_ID,
200
+ approved_artefact_digest: {
201
+ type: "string",
202
+ pattern: "^sha256:[0-9a-f]{64}$",
203
+ description: "Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch."
204
+ },
195
205
  comment: { type: "string" },
196
206
  tags: { type: "array", items: { type: "string" } },
197
207
  request_revision: { type: "boolean", description: "If true, task returns to in_progress instead of declined." }
@@ -201,6 +211,11 @@ var SCHEMAS = {
201
211
  "chap.decide.override": {
202
212
  type: "object",
203
213
  properties: {
214
+ approved_artefact_digest: {
215
+ type: "string",
216
+ pattern: "^sha256:[0-9a-f]{64}$",
217
+ description: "Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch."
218
+ },
204
219
  workspace: WORKSPACE_ID,
205
220
  from: PARTICIPANT_URI,
206
221
  task_id: TASK_ID,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator-mcp/schemas\n *\n * JSON Schema definitions for each CHAP method, used as the\n * inputSchema for the corresponding MCP tool. Each schema describes\n * the params object that the CHAP envelope would carry; the tool\n * handler wraps the params in a JSON-RPC 2.0 envelope before dispatch.\n *\n * These schemas are tuned for MCP UX: the descriptions are what an\n * LLM client sees when deciding whether to call the tool, so they're\n * written for that audience as well as for validation.\n *\n * Aligned with CHAP 0.2 (see profiles/*.md) and MCP 2025-11-25.\n */\n\nexport interface JsonSchema {\n type?: string;\n description?: string;\n properties?: Record<string, JsonSchema>;\n required?: string[];\n enum?: string[];\n items?: JsonSchema;\n additionalProperties?: boolean | JsonSchema;\n oneOf?: JsonSchema[];\n default?: unknown;\n}\n\n// Common reusable fragments.\nconst PARTICIPANT_URI: JsonSchema = {\n type: \"string\",\n description: \"Participant URI, e.g. 'human:alice@example.org' or 'agent:bot@local'.\",\n};\n\nconst WORKSPACE_ID: JsonSchema = {\n type: \"string\",\n description: \"Workspace identifier, e.g. 'wsp_techcorp_support'.\",\n};\n\nconst TASK_ID: JsonSchema = {\n type: \"string\",\n description: \"Task identifier returned by chap.task.create.\",\n};\n\nconst ROUTING_HINTS: JsonSchema = {\n type: \"object\",\n description: \"Optional signals for the routing/1.0 profile.\",\n properties: {\n criticality: { type: \"string\", enum: [\"low\", \"medium\", \"high\", \"critical\"] },\n deadline: { type: \"string\", description: \"ISO 8601 timestamp.\" },\n risk_tier: { type: \"string\" },\n max_cost_usd: { type: \"number\" },\n },\n additionalProperties: true,\n};\n\n// ============================================================\n// Core\n// ============================================================\n\nexport const SCHEMAS: Record<string, JsonSchema> = {\n \"chap.workspace.create\": {\n type: \"object\",\n properties: {\n workspace: { ...WORKSPACE_ID, description: \"Workspace id to create. If omitted, one is generated.\" },\n profiles: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Profile identifiers to enable, e.g. ['core/1.0', 'review/1.0'].\",\n },\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"trial\" },\n mode_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"production\" },\n },\n additionalProperties: false,\n },\n\n \"chap.workspace.describe\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID },\n required: [\"workspace\"],\n },\n\n \"chap.workspace.set_profiles\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n profiles: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"profiles\"],\n },\n\n \"chap.participant.join\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n type: { type: \"string\", enum: [\"human\", \"agent\", \"service\", \"group\", \"workspace\"] },\n role: { type: \"string\", description: \"Operator-defined role, e.g. 'reviewer' or 'drafter'.\" },\n display_name: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"type\"],\n },\n\n \"chap.participant.leave\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.task.create\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: { ...PARTICIPANT_URI, description: \"Delegator URI.\" },\n kind: { type: \"string\", description: \"Task kind, e.g. 'draft_response' or 'review'.\" },\n assignee: { ...PARTICIPANT_URI, description: \"Who the task is assigned to. Must be a workspace member.\" },\n input: { type: \"object\", description: \"Task-specific input payload.\", additionalProperties: true },\n routing_hints: ROUTING_HINTS,\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n },\n required: [\"workspace\", \"from\", \"kind\", \"assignee\", \"input\"],\n },\n\n \"chap.task.update\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n state: { type: \"string\", enum: [\"in_progress\", \"review_requested\", \"declined\", \"paused\", \"cancelled\", \"completed\"] },\n progress_note: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"state\"],\n },\n\n \"chap.task.complete\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n output: { description: \"The task's output artefact. Pass as a JSON object or array, not a JSON-encoded string.\" },\n confidence: { type: \"number\", description: \"Self-reported confidence (0-1), where supported.\" },\n routing_hints: ROUTING_HINTS,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.audit.read\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\", description: \"Start sequence number (inclusive).\" },\n to_seq: { type: \"integer\", description: \"End sequence number (exclusive).\" },\n },\n },\n filter: {\n type: \"object\",\n properties: {\n method: { type: \"string\" },\n from: { type: \"string\" },\n task_id: { type: \"string\" },\n },\n },\n },\n required: [\"workspace\"],\n },\n\n // ============================================================\n // review/1.0\n // ============================================================\n\n \"chap.review.request\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n to: {\n oneOf: [PARTICIPANT_URI, { type: \"array\", items: PARTICIPANT_URI }],\n description: \"One or more reviewers. A single URI string, or a JSON array of URI strings (not a JSON-encoded string).\",\n },\n rule: {\n type: \"string\",\n enum: [\"any_one_approves\", \"all_approve\", \"quorum:2\", \"quorum:3\"],\n default: \"any_one_approves\",\n },\n artefact: { description: \"The draft being submitted for review. Pass as a JSON object or array, not a JSON-encoded string.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"artefact\"],\n },\n\n \"chap.decide.approve\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.reject\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n request_revision: { type: \"boolean\", description: \"If true, task returns to in_progress instead of declined.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.override\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n diff: {\n type: \"array\",\n description: \"RFC 6902 JSON Patch operations applied to the artefact under review.\",\n items: {\n type: \"object\",\n properties: {\n op: { type: \"string\", enum: [\"add\", \"replace\", \"remove\", \"copy\", \"move\", \"test\"] },\n path: { type: \"string\" },\n value: {},\n from: { type: \"string\" },\n },\n required: [\"op\", \"path\"],\n },\n },\n rationale: { type: \"string\", description: \"Why the override was applied. Required for the structured-override audit trail.\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n policy_refs: { type: \"array\", items: { type: \"string\" } },\n logical_id: { type: \"string\" },\n intent_preserved: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"diff\", \"rationale\"],\n },\n\n \"chap.abstain.declare\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n reason: { type: \"string\" },\n category: { type: \"string\", enum: [\"conflict_of_interest\", \"insufficient_context\", \"out_of_scope\", \"other\"] },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"reason\"],\n },\n\n \"chap.escalate.raise\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n original_task_id: TASK_ID,\n new_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"assignee\"],\n },\n },\n required: [\"workspace\", \"from\", \"original_task_id\", \"new_task\"],\n },\n\n // ============================================================\n // whisper/1.0\n // ============================================================\n\n \"chap.whisper.ask\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Who is being asked.\" },\n question: { type: \"string\" },\n options: {\n type: \"array\",\n items: { type: \"object\", properties: { id: { type: \"string\" }, label: { type: \"string\" }}, required: [\"id\"] },\n description: \"Optional multiple-choice options. If present, answer_option must be one of these ids.\",\n },\n deadline_ms: { type: \"integer\", description: \"Time-to-live in milliseconds from now.\" },\n default_if_lapsed: { description: \"Value applied if the whisper lapses without an answer.\" },\n urgency: { type: \"string\", enum: [\"low\", \"medium\", \"high\"], default: \"low\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"question\", \"deadline_ms\", \"default_if_lapsed\"],\n },\n\n \"chap.whisper.answer\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n whisper_id: { type: \"string\" },\n answer_option: { type: \"string\", description: \"Option id (required when the whisper has options).\" },\n answer: { type: \"string\", description: \"Free-text answer (when no options).\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"whisper_id\"],\n },\n\n // ============================================================\n // deliberation/1.0\n // ============================================================\n\n \"chap.deliberate.open\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Deliberation participants.\" },\n task_id: TASK_ID,\n rule: {\n type: \"string\",\n description: \"Voting rule. Examples: any_one_approves, all_approve, quorum:N, weighted_vote:T, weighted_vote_with_veto:T.\",\n },\n question: { type: \"string\" },\n weights: { type: \"object\", additionalProperties: { type: \"number\" }, description: \"Voter -> weight map (for weighted rules).\" },\n veto: { type: \"object\", additionalProperties: { type: \"boolean\" }, description: \"Voter -> can-veto map.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to\", \"rule\"],\n },\n\n \"chap.deliberate.comment\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"comment\"],\n },\n\n \"chap.deliberate.vote\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n vote: { type: \"string\", enum: [\"yea\", \"nay\", \"abstain\"] },\n weight: { type: \"number\" },\n comment: { type: \"string\" },\n veto_invoked: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"vote\"],\n },\n\n \"chap.deliberate.close\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\"],\n },\n\n // ============================================================\n // handoff/1.0\n // ============================================================\n\n \"chap.handoff.propose\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"string\", description: \"Recipient (URI or 'group:...').\" },\n tasks: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n task_id: TASK_ID,\n title: { type: \"string\" },\n status_summary: { type: \"string\" },\n next_action: { type: \"string\" },\n blockers: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"task_id\"],\n },\n },\n summary: { type: \"string\" },\n context_links: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"workspace\", \"from\", \"to\", \"tasks\"],\n },\n\n \"chap.handoff.accept\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n accepted_task_ids: { type: \"array\", items: TASK_ID, description: \"If omitted, all proposed tasks are accepted.\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n \"chap.handoff.decline\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n reason: { type: \"string\" },\n suggested_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n // ============================================================\n // control/1.0\n // ============================================================\n\n \"chap.control.pause\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n in_flight_policy: { type: \"string\", enum: [\"allow_to_complete\", \"interrupt\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.resume\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.cancel\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.control.snapshot\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n label: { type: \"string\" },\n include: { type: \"array\", items: { type: \"string\" }, description: \"Aspects to snapshot, e.g. ['members', 'open_tasks', 'mode_ceiling'].\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.rollback\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to_snapshot_artefact_id: { type: \"string\" },\n what_to_restore: { type: \"array\", items: { type: \"string\" }},\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to_snapshot_artefact_id\"],\n },\n\n \"chap.control.supersede\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n successor_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"kind\"],\n },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"successor_task\"],\n },\n\n \"chap.control.set_mode_ceiling\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n new_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"new_ceiling\"],\n },\n\n // ============================================================\n // routing/1.0\n // ============================================================\n\n \"chap.task.route\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n candidates: { type: \"array\", items: PARTICIPANT_URI, description: \"Candidate assignees.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"candidates\"],\n },\n\n \"chap.review.depth\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n artefact_routing_hints: {\n type: \"object\",\n description: \"Per-artefact signals like confidence, model_id, cost_consumed_usd.\",\n additionalProperties: true,\n },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.escalate.auto\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n default_escalation_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n // ============================================================\n // security-signed/1.0\n // ============================================================\n\n \"chap.participant.rotate_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n old_kid: { type: \"string\" },\n new_jwk: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"from\", \"old_kid\", \"new_jwk\"],\n },\n\n \"chap.participant.revoke_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n target_uri: PARTICIPANT_URI,\n kid: { type: \"string\" },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"target_uri\", \"kid\"],\n },\n\n // ============================================================\n // audit-scitt/1.0\n // ============================================================\n\n \"chap.audit.submit_to_scitt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\" },\n to_seq: { type: \"integer\" },\n },\n },\n issuer: { type: \"string\" },\n },\n required: [\"workspace\"],\n },\n\n \"chap.audit.verify_receipt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n receipt: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"receipt\"],\n },\n\n \"chap.audit.verify_chain\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\"],\n },\n};\n\n/** Methods that map to MCP tools. Currently: all 39 CHAP methods. */\nexport const TOOL_NAMES = Object.keys(SCHEMAS);\n\n/** Get the JSON Schema for a tool, or null if not a known CHAP method. */\nexport function schemaFor(toolName: string): JsonSchema | null {\n return SCHEMAS[toolName] ?? null;\n}\n\n/** Map an MCP tool name back to its CHAP method name. */\nexport function methodForTool(toolName: string): string | null {\n if (!toolName.startsWith(\"chap.\")) return null;\n return toolName.slice(\"chap.\".length);\n}\n\n// ============================================================\n// Stringified-JSON coercion\n// ============================================================\n//\n// LLM MCP clients (Claude Desktop, Cursor, and others) frequently\n// serialise structured tool arguments as JSON-encoded *strings* rather\n// than as native JSON objects/arrays. For example, an `artefact` that\n// should arrive as { \"draft\": \"...\" } arrives as the string\n// \"{\\\"draft\\\": \\\"...\\\"}\", and a `to` that should be [\"human:me@local\"]\n// arrives as \"[\\\"human:me@local\\\"]\".\n//\n// The CHAP protocol core is deliberately strict: it stores artefacts\n// and applies JSON Patches against whatever it receives. A stringified\n// object therefore (a) pollutes the audit log with the wrong type and\n// (b) makes object-path patches in decide.override impossible, because\n// there is no object to traverse.\n//\n// We fix this at the adapter boundary, leaving the protocol core\n// untouched. Before an argument is wrapped in a CHAP envelope, any\n// string value whose schema admits a non-string type is JSON-parsed\n// when (and only when) it parses cleanly to a type the schema allows.\n// Plain strings that the schema accepts as strings (participant URIs,\n// task ids, rationales) are never touched, so a bare \"human:me@local\"\n// passed to a string|array `to` field is preserved as-is.\n\n/** True if the schema admits `object` as a value type. */\nfunction admitsType(schema: JsonSchema | undefined, t: \"object\" | \"array\"): boolean {\n if (!schema) return false;\n if (schema.type === t) return true;\n if (schema.oneOf) return schema.oneOf.some((s) => admitsType(s, t));\n // A field declared with neither `type` nor `oneOf` (e.g. `output`,\n // `artefact`) is an opaque payload: it admits any JSON value, so we\n // allow coercion to both object and array for it.\n if (schema.type === undefined && !schema.oneOf && !schema.enum) return true;\n return false;\n}\n\n/**\n * Coerce a single argument value against its parameter schema. Returns\n * the parsed value when the string is stringified JSON the schema\n * accepts; otherwise returns the value unchanged.\n */\nfunction coerceValue(value: unknown, schema: JsonSchema | undefined): unknown {\n if (typeof value !== \"string\") return value;\n const trimmed = value.trim();\n if (trimmed.length === 0) return value;\n const looksLikeObject = trimmed.startsWith(\"{\");\n const looksLikeArray = trimmed.startsWith(\"[\");\n if (!looksLikeObject && !looksLikeArray) return value;\n\n const wantObject = looksLikeObject && admitsType(schema, \"object\");\n const wantArray = looksLikeArray && admitsType(schema, \"array\");\n if (!wantObject && !wantArray) return value;\n\n try {\n const parsed = JSON.parse(value);\n // Only accept the parse if its type is one the schema admits. This\n // guards against, say, a string that happens to start with \"[\" but\n // is meant to be a literal string in a string-only field.\n if (Array.isArray(parsed) && admitsType(schema, \"array\")) return parsed;\n if (parsed !== null && typeof parsed === \"object\" && !Array.isArray(parsed)\n && admitsType(schema, \"object\")) return parsed;\n return value;\n } catch {\n // Not valid JSON: leave it for the coordinator to validate/reject.\n return value;\n }\n}\n\n/**\n * Normalise the arguments object for a tool call, coercing any\n * stringified-JSON values whose parameter schema admits a structured\n * type. Unknown keys (not in the schema) are passed through untouched.\n *\n * This is a pure function: it returns a new object and does not mutate\n * its input. Coordinator dispatch sees correctly-typed params, so the\n * audit log records the right shapes and decide.override patches apply\n * against real objects.\n */\nexport function coerceToolArgs(\n toolName: string,\n args: Record<string, unknown>,\n): Record<string, unknown> {\n const schema = schemaFor(toolName);\n const props = schema?.properties;\n if (!props) return args;\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(args)) {\n out[key] = coerceValue(value, props[key]);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BA,IAAM,kBAA8B;AAAA,EAClC,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,eAA2B;AAAA,EAC/B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,UAAsB;AAAA,EAC1B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,gBAA4B;AAAA,EAChC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,IACV,aAAa,EAAE,MAAM,UAAU,MAAM,CAAC,OAAO,UAAU,QAAQ,UAAU,EAAE;AAAA,IAC3E,UAAa,EAAE,MAAM,UAAU,aAAa,sBAAsB;AAAA,IAClE,WAAa,EAAE,MAAM,SAAS;AAAA,IAC9B,cAAc,EAAE,MAAM,SAAS;AAAA,EACjC;AAAA,EACA,sBAAsB;AACxB;AAMO,IAAM,UAAsC;AAAA,EACjD,yBAAyB;AAAA,IACvB,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW,EAAE,GAAG,cAAc,aAAa,wDAAwD;AAAA,MACnG,UAAU;AAAA,QACR,MAAM;AAAA,QACN,OAAO,EAAE,MAAM,SAAS;AAAA,QACxB,aAAa;AAAA,MACf;AAAA,MACA,MAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,GAAG,SAAS,QAAQ;AAAA,MAC1F,cAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,GAAG,SAAS,aAAa;AAAA,IACjG;AA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AQ,QAAQ;AACjE,QAAM,YAAa,kBAAmB,WAAW,QAAQ,OAAO;AAChE,MAAI,CAAC,cAAc,CAAC,UAAW,QAAO;AAEtC,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,KAAK;AAI/B,QAAI,MAAM,QAAQ,MAAM,KAAK,WAAW,QAAQ,OAAO,EAAG,QAAO;AACjE,QAAI,WAAW,QAAQ,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,KACnE,WAAW,QAAQ,QAAQ,EAAG,QAAO;AAC5C,WAAO;AAAA,EACT,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;AAYO,SAAS,eACd,UACA,MACyB;AACzB,QAAM,SAAS,UAAU,QAAQ;AACjC,QAAM,QAAQ,QAAQ;AACtB,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,MAA+B,CAAC;AACtC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC/C,QAAI,GAAG,IAAI,YAAY,OAAO,MAAM,GAAG,CAAC;AAAA,EAC1C;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/schemas.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator-mcp/schemas\n *\n * JSON Schema definitions for each CHAP method, used as the\n * inputSchema for the corresponding MCP tool. Each schema describes\n * the params object that the CHAP envelope would carry; the tool\n * handler wraps the params in a JSON-RPC 2.0 envelope before dispatch.\n *\n * These schemas are tuned for MCP UX: the descriptions are what an\n * LLM client sees when deciding whether to call the tool, so they're\n * written for that audience as well as for validation.\n *\n * Aligned with CHAP 0.2 (see profiles/*.md) and MCP 2025-11-25.\n */\n\nexport interface JsonSchema {\n type?: string;\n description?: string;\n properties?: Record<string, JsonSchema>;\n required?: string[];\n enum?: string[];\n items?: JsonSchema;\n additionalProperties?: boolean | JsonSchema;\n oneOf?: JsonSchema[];\n default?: unknown;\n /** JSON Schema `pattern`, used where a string has a fixed wire shape. */\n pattern?: string;\n}\n\n// Common reusable fragments.\nconst PARTICIPANT_URI: JsonSchema = {\n type: \"string\",\n description: \"Participant URI, e.g. 'human:alice@example.org' or 'agent:bot@local'.\",\n};\n\nconst WORKSPACE_ID: JsonSchema = {\n type: \"string\",\n description: \"Workspace identifier, e.g. 'wsp_techcorp_support'.\",\n};\n\nconst TASK_ID: JsonSchema = {\n type: \"string\",\n description: \"Task identifier returned by chap.task.create.\",\n};\n\nconst ROUTING_HINTS: JsonSchema = {\n type: \"object\",\n description: \"Optional signals for the routing/1.0 profile.\",\n properties: {\n criticality: { type: \"string\", enum: [\"low\", \"medium\", \"high\", \"critical\"] },\n deadline: { type: \"string\", description: \"ISO 8601 timestamp.\" },\n risk_tier: { type: \"string\" },\n max_cost_usd: { type: \"number\" },\n },\n additionalProperties: true,\n};\n\n// ============================================================\n// Core\n// ============================================================\n\nexport const SCHEMAS: Record<string, JsonSchema> = {\n \"chap.workspace.create\": {\n type: \"object\",\n properties: {\n workspace: { ...WORKSPACE_ID, description: \"Workspace id to create. If omitted, one is generated.\" },\n profiles: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Profile identifiers to enable, e.g. ['core/1.0', 'review/1.0'].\",\n },\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"trial\" },\n mode_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"production\" },\n },\n additionalProperties: false,\n },\n\n \"chap.workspace.describe\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID },\n required: [\"workspace\"],\n },\n\n \"chap.workspace.set_profiles\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n profiles: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"profiles\"],\n },\n\n \"chap.participant.join\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n type: { type: \"string\", enum: [\"human\", \"agent\", \"service\", \"group\", \"workspace\"] },\n role: { type: \"string\", description: \"Operator-defined role, e.g. 'reviewer' or 'drafter'.\" },\n display_name: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"type\"],\n },\n\n \"chap.participant.leave\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.task.create\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: { ...PARTICIPANT_URI, description: \"Delegator URI.\" },\n kind: { type: \"string\", description: \"Task kind, e.g. 'draft_response' or 'review'.\" },\n assignee: { ...PARTICIPANT_URI, description: \"Who the task is assigned to. Must be a workspace member.\" },\n input: { type: \"object\", description: \"Task-specific input payload.\", additionalProperties: true },\n routing_hints: ROUTING_HINTS,\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n },\n required: [\"workspace\", \"from\", \"kind\", \"assignee\", \"input\"],\n },\n\n \"chap.task.update\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n state: { type: \"string\", enum: [\"in_progress\", \"review_requested\", \"declined\", \"paused\", \"cancelled\", \"completed\"] },\n progress_note: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"state\"],\n },\n\n \"chap.task.complete\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n output: { description: \"The task's output artefact. Pass as a JSON object or array, not a JSON-encoded string.\" },\n confidence: { type: \"number\", description: \"Self-reported confidence (0-1), where supported.\" },\n routing_hints: ROUTING_HINTS,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.audit.read\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\", description: \"Start sequence number (inclusive).\" },\n to_seq: { type: \"integer\", description: \"End sequence number (exclusive).\" },\n },\n },\n filter: {\n type: \"object\",\n properties: {\n method: { type: \"string\" },\n from: { type: \"string\" },\n task_id: { type: \"string\" },\n },\n },\n },\n required: [\"workspace\"],\n },\n\n // ============================================================\n // review/1.0\n // ============================================================\n\n \"chap.review.request\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n to: {\n oneOf: [PARTICIPANT_URI, { type: \"array\", items: PARTICIPANT_URI }],\n description: \"One or more reviewers. A single URI string, or a JSON array of URI strings (not a JSON-encoded string).\",\n },\n rule: {\n type: \"string\",\n enum: [\"any_one_approves\", \"all_approve\", \"quorum:2\", \"quorum:3\"],\n default: \"any_one_approves\",\n },\n artefact: { description: \"The draft being submitted for review. Pass as a JSON object or array, not a JSON-encoded string.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"artefact\"],\n },\n\n \"chap.decide.approve\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n approved_artefact_digest: {\n type: \"string\",\n pattern: \"^sha256:[0-9a-f]{64}$\",\n description: \"Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch.\",\n },\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.reject\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n approved_artefact_digest: {\n type: \"string\",\n pattern: \"^sha256:[0-9a-f]{64}$\",\n description: \"Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch.\",\n },\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n request_revision: { type: \"boolean\", description: \"If true, task returns to in_progress instead of declined.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.override\": {\n type: \"object\",\n properties: {\n approved_artefact_digest: {\n type: \"string\",\n pattern: \"^sha256:[0-9a-f]{64}$\",\n description: \"Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch.\",\n },\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n diff: {\n type: \"array\",\n description: \"RFC 6902 JSON Patch operations applied to the artefact under review.\",\n items: {\n type: \"object\",\n properties: {\n op: { type: \"string\", enum: [\"add\", \"replace\", \"remove\", \"copy\", \"move\", \"test\"] },\n path: { type: \"string\" },\n value: {},\n from: { type: \"string\" },\n },\n required: [\"op\", \"path\"],\n },\n },\n rationale: { type: \"string\", description: \"Why the override was applied. Required for the structured-override audit trail.\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n policy_refs: { type: \"array\", items: { type: \"string\" } },\n logical_id: { type: \"string\" },\n intent_preserved: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"diff\", \"rationale\"],\n },\n\n \"chap.abstain.declare\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n reason: { type: \"string\" },\n category: { type: \"string\", enum: [\"conflict_of_interest\", \"insufficient_context\", \"out_of_scope\", \"other\"] },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"reason\"],\n },\n\n \"chap.escalate.raise\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n original_task_id: TASK_ID,\n new_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"assignee\"],\n },\n },\n required: [\"workspace\", \"from\", \"original_task_id\", \"new_task\"],\n },\n\n // ============================================================\n // whisper/1.0\n // ============================================================\n\n \"chap.whisper.ask\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Who is being asked.\" },\n question: { type: \"string\" },\n options: {\n type: \"array\",\n items: { type: \"object\", properties: { id: { type: \"string\" }, label: { type: \"string\" }}, required: [\"id\"] },\n description: \"Optional multiple-choice options. If present, answer_option must be one of these ids.\",\n },\n deadline_ms: { type: \"integer\", description: \"Time-to-live in milliseconds from now.\" },\n default_if_lapsed: { description: \"Value applied if the whisper lapses without an answer.\" },\n urgency: { type: \"string\", enum: [\"low\", \"medium\", \"high\"], default: \"low\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"question\", \"deadline_ms\", \"default_if_lapsed\"],\n },\n\n \"chap.whisper.answer\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n whisper_id: { type: \"string\" },\n answer_option: { type: \"string\", description: \"Option id (required when the whisper has options).\" },\n answer: { type: \"string\", description: \"Free-text answer (when no options).\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"whisper_id\"],\n },\n\n // ============================================================\n // deliberation/1.0\n // ============================================================\n\n \"chap.deliberate.open\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Deliberation participants.\" },\n task_id: TASK_ID,\n rule: {\n type: \"string\",\n description: \"Voting rule. Examples: any_one_approves, all_approve, quorum:N, weighted_vote:T, weighted_vote_with_veto:T.\",\n },\n question: { type: \"string\" },\n weights: { type: \"object\", additionalProperties: { type: \"number\" }, description: \"Voter -> weight map (for weighted rules).\" },\n veto: { type: \"object\", additionalProperties: { type: \"boolean\" }, description: \"Voter -> can-veto map.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to\", \"rule\"],\n },\n\n \"chap.deliberate.comment\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"comment\"],\n },\n\n \"chap.deliberate.vote\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n vote: { type: \"string\", enum: [\"yea\", \"nay\", \"abstain\"] },\n weight: { type: \"number\" },\n comment: { type: \"string\" },\n veto_invoked: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"vote\"],\n },\n\n \"chap.deliberate.close\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\"],\n },\n\n // ============================================================\n // handoff/1.0\n // ============================================================\n\n \"chap.handoff.propose\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"string\", description: \"Recipient (URI or 'group:...').\" },\n tasks: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n task_id: TASK_ID,\n title: { type: \"string\" },\n status_summary: { type: \"string\" },\n next_action: { type: \"string\" },\n blockers: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"task_id\"],\n },\n },\n summary: { type: \"string\" },\n context_links: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"workspace\", \"from\", \"to\", \"tasks\"],\n },\n\n \"chap.handoff.accept\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n accepted_task_ids: { type: \"array\", items: TASK_ID, description: \"If omitted, all proposed tasks are accepted.\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n \"chap.handoff.decline\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n reason: { type: \"string\" },\n suggested_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n // ============================================================\n // control/1.0\n // ============================================================\n\n \"chap.control.pause\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n in_flight_policy: { type: \"string\", enum: [\"allow_to_complete\", \"interrupt\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.resume\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.cancel\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.control.snapshot\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n label: { type: \"string\" },\n include: { type: \"array\", items: { type: \"string\" }, description: \"Aspects to snapshot, e.g. ['members', 'open_tasks', 'mode_ceiling'].\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.rollback\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to_snapshot_artefact_id: { type: \"string\" },\n what_to_restore: { type: \"array\", items: { type: \"string\" }},\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to_snapshot_artefact_id\"],\n },\n\n \"chap.control.supersede\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n successor_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"kind\"],\n },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"successor_task\"],\n },\n\n \"chap.control.set_mode_ceiling\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n new_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"new_ceiling\"],\n },\n\n // ============================================================\n // routing/1.0\n // ============================================================\n\n \"chap.task.route\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n candidates: { type: \"array\", items: PARTICIPANT_URI, description: \"Candidate assignees.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"candidates\"],\n },\n\n \"chap.review.depth\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n artefact_routing_hints: {\n type: \"object\",\n description: \"Per-artefact signals like confidence, model_id, cost_consumed_usd.\",\n additionalProperties: true,\n },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.escalate.auto\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n default_escalation_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n // ============================================================\n // security-signed/1.0\n // ============================================================\n\n \"chap.participant.rotate_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n old_kid: { type: \"string\" },\n new_jwk: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"from\", \"old_kid\", \"new_jwk\"],\n },\n\n \"chap.participant.revoke_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n target_uri: PARTICIPANT_URI,\n kid: { type: \"string\" },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"target_uri\", \"kid\"],\n },\n\n // ============================================================\n // audit-scitt/1.0\n // ============================================================\n\n \"chap.audit.submit_to_scitt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\" },\n to_seq: { type: \"integer\" },\n },\n },\n issuer: { type: \"string\" },\n },\n required: [\"workspace\"],\n },\n\n \"chap.audit.verify_receipt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n receipt: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"receipt\"],\n },\n\n \"chap.audit.verify_chain\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\"],\n },\n};\n\n/** Methods that map to MCP tools. Currently: all 39 CHAP methods. */\nexport const TOOL_NAMES = Object.keys(SCHEMAS);\n\n/** Get the JSON Schema for a tool, or null if not a known CHAP method. */\nexport function schemaFor(toolName: string): JsonSchema | null {\n return SCHEMAS[toolName] ?? null;\n}\n\n/** Map an MCP tool name back to its CHAP method name. */\nexport function methodForTool(toolName: string): string | null {\n if (!toolName.startsWith(\"chap.\")) return null;\n return toolName.slice(\"chap.\".length);\n}\n\n// ============================================================\n// Stringified-JSON coercion\n// ============================================================\n//\n// LLM MCP clients (Claude Desktop, Cursor, and others) frequently\n// serialise structured tool arguments as JSON-encoded *strings* rather\n// than as native JSON objects/arrays. For example, an `artefact` that\n// should arrive as { \"draft\": \"...\" } arrives as the string\n// \"{\\\"draft\\\": \\\"...\\\"}\", and a `to` that should be [\"human:me@local\"]\n// arrives as \"[\\\"human:me@local\\\"]\".\n//\n// The CHAP protocol core is deliberately strict: it stores artefacts\n// and applies JSON Patches against whatever it receives. A stringified\n// object therefore (a) pollutes the audit log with the wrong type and\n// (b) makes object-path patches in decide.override impossible, because\n// there is no object to traverse.\n//\n// We fix this at the adapter boundary, leaving the protocol core\n// untouched. Before an argument is wrapped in a CHAP envelope, any\n// string value whose schema admits a non-string type is JSON-parsed\n// when (and only when) it parses cleanly to a type the schema allows.\n// Plain strings that the schema accepts as strings (participant URIs,\n// task ids, rationales) are never touched, so a bare \"human:me@local\"\n// passed to a string|array `to` field is preserved as-is.\n\n/** True if the schema admits `object` as a value type. */\nfunction admitsType(schema: JsonSchema | undefined, t: \"object\" | \"array\"): boolean {\n if (!schema) return false;\n if (schema.type === t) return true;\n if (schema.oneOf) return schema.oneOf.some((s) => admitsType(s, t));\n // A field declared with neither `type` nor `oneOf` (e.g. `output`,\n // `artefact`) is an opaque payload: it admits any JSON value, so we\n // allow coercion to both object and array for it.\n if (schema.type === undefined && !schema.oneOf && !schema.enum) return true;\n return false;\n}\n\n/**\n * Coerce a single argument value against its parameter schema. Returns\n * the parsed value when the string is stringified JSON the schema\n * accepts; otherwise returns the value unchanged.\n */\nfunction coerceValue(value: unknown, schema: JsonSchema | undefined): unknown {\n if (typeof value !== \"string\") return value;\n const trimmed = value.trim();\n if (trimmed.length === 0) return value;\n const looksLikeObject = trimmed.startsWith(\"{\");\n const looksLikeArray = trimmed.startsWith(\"[\");\n if (!looksLikeObject && !looksLikeArray) return value;\n\n const wantObject = looksLikeObject && admitsType(schema, \"object\");\n const wantArray = looksLikeArray && admitsType(schema, \"array\");\n if (!wantObject && !wantArray) return value;\n\n try {\n const parsed = JSON.parse(value);\n // Only accept the parse if its type is one the schema admits. This\n // guards against, say, a string that happens to start with \"[\" but\n // is meant to be a literal string in a string-only field.\n if (Array.isArray(parsed) && admitsType(schema, \"array\")) return parsed;\n if (parsed !== null && typeof parsed === \"object\" && !Array.isArray(parsed)\n && admitsType(schema, \"object\")) return parsed;\n return value;\n } catch {\n // Not valid JSON: leave it for the coordinator to validate/reject.\n return value;\n }\n}\n\n/**\n * Normalise the arguments object for a tool call, coercing any\n * stringified-JSON values whose parameter schema admits a structured\n * type. Unknown keys (not in the schema) are passed through untouched.\n *\n * This is a pure function: it returns a new object and does not mutate\n * its input. Coordinator dispatch sees correctly-typed params, so the\n * audit log records the right shapes and decide.override patches apply\n * against real objects.\n */\nexport function coerceToolArgs(\n toolName: string,\n args: Record<string, unknown>,\n): Record<string, unknown> {\n const schema = schemaFor(toolName);\n const props = schema?.properties;\n if (!props) return args;\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(args)) {\n out[key] = coerceValue(value, props[key]);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BA,IAAM,kBAA8B;AAAA,EAClC,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,eAA2B;AAAA,EAC/B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,UAAsB;AAAA,EAC1B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,gBAA4B;AAAA,EAChC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,IACV,aAAa,EAAE,MAAM,UAAU,MAAM,CAAC,OAAO,UAAU,QAAQ,UAAU,EAAE;AAAA,IAC3E,UAAa,EAAE,MAAM,UAAU,aAAa,sBAAsB;AAAA,IAClE,WAAa,EAAE,MAAM,SAAS;AAAA,IAC9B,cAAc,EAAE,MAAM,SAAS;AAAA,EACjC;AAAA,EACA,sBAAsB;AACxB;AAMO,IAAM,UAAsC;AAAA,EACjD,yBAAyB;AAAA,IACvB,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW,EAAE,GAAG,cAAc,aAAa,wDAAwD;AAAA,MACnG,UAAU;AAAA,QACR,MAAM;AAAA,QACN,OAAO,EAAE,MAAM,SAAS;AAAA,QACxB,aAAa;AAAA,MACf;AAAA,MACA,MAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,GAAG,SAAS,QAAQ;AAAA,MAC1F,cAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,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,QAAyC;AAC5E,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,kBAAkB,QAAQ,WAAW,GAAG;AAC9C,QAAM,iBAAkB,QAAQ,WAAW,GAAG;AAC9C,MAAI,CAAC,mBAAmB,CAAC,eAAgB,QAAO;AAEhD,QAAM,aAAa,mBAAmB,WAAW,QAAQ,QAAQ;AACjE,QAAM,YAAa,kBAAmB,WAAW,QAAQ,OAAO;AAChE,MAAI,CAAC,cAAc,CAAC,UAAW,QAAO;AAEtC,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,KAAK;AAI/B,QAAI,MAAM,QAAQ,MAAM,KAAK,WAAW,QAAQ,OAAO,EAAG,QAAO;AACjE,QAAI,WAAW,QAAQ,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,KACnE,WAAW,QAAQ,QAAQ,EAAG,QAAO;AAC5C,WAAO;AAAA,EACT,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;AAYO,SAAS,eACd,UACA,MACyB;AACzB,QAAM,SAAS,UAAU,QAAQ;AACjC,QAAM,QAAQ,QAAQ;AACtB,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,MAA+B,CAAC;AACtC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC/C,QAAI,GAAG,IAAI,YAAY,OAAO,MAAM,GAAG,CAAC;AAAA,EAC1C;AACA,SAAO;AACT;","names":[]}
@@ -22,6 +22,8 @@ interface JsonSchema {
22
22
  additionalProperties?: boolean | JsonSchema;
23
23
  oneOf?: JsonSchema[];
24
24
  default?: unknown;
25
+ /** JSON Schema `pattern`, used where a string has a fixed wire shape. */
26
+ pattern?: string;
25
27
  }
26
28
  declare const SCHEMAS: Record<string, JsonSchema>;
27
29
  /** Methods that map to MCP tools. Currently: all 39 CHAP methods. */
package/dist/schemas.d.ts CHANGED
@@ -22,6 +22,8 @@ interface JsonSchema {
22
22
  additionalProperties?: boolean | JsonSchema;
23
23
  oneOf?: JsonSchema[];
24
24
  default?: unknown;
25
+ /** JSON Schema `pattern`, used where a string has a fixed wire shape. */
26
+ pattern?: string;
25
27
  }
26
28
  declare const SCHEMAS: Record<string, JsonSchema>;
27
29
  /** Methods that map to MCP tools. Currently: all 39 CHAP methods. */
package/dist/schemas.js CHANGED
@@ -153,6 +153,11 @@ var SCHEMAS = {
153
153
  workspace: WORKSPACE_ID,
154
154
  from: PARTICIPANT_URI,
155
155
  task_id: TASK_ID,
156
+ approved_artefact_digest: {
157
+ type: "string",
158
+ pattern: "^sha256:[0-9a-f]{64}$",
159
+ description: "Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch."
160
+ },
156
161
  comment: { type: "string" },
157
162
  tags: { type: "array", items: { type: "string" } }
158
163
  },
@@ -164,6 +169,11 @@ var SCHEMAS = {
164
169
  workspace: WORKSPACE_ID,
165
170
  from: PARTICIPANT_URI,
166
171
  task_id: TASK_ID,
172
+ approved_artefact_digest: {
173
+ type: "string",
174
+ pattern: "^sha256:[0-9a-f]{64}$",
175
+ description: "Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch."
176
+ },
167
177
  comment: { type: "string" },
168
178
  tags: { type: "array", items: { type: "string" } },
169
179
  request_revision: { type: "boolean", description: "If true, task returns to in_progress instead of declined." }
@@ -173,6 +183,11 @@ var SCHEMAS = {
173
183
  "chap.decide.override": {
174
184
  type: "object",
175
185
  properties: {
186
+ approved_artefact_digest: {
187
+ type: "string",
188
+ pattern: "^sha256:[0-9a-f]{64}$",
189
+ description: "Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch."
190
+ },
176
191
  workspace: WORKSPACE_ID,
177
192
  from: PARTICIPANT_URI,
178
193
  task_id: TASK_ID,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator-mcp/schemas\n *\n * JSON Schema definitions for each CHAP method, used as the\n * inputSchema for the corresponding MCP tool. Each schema describes\n * the params object that the CHAP envelope would carry; the tool\n * handler wraps the params in a JSON-RPC 2.0 envelope before dispatch.\n *\n * These schemas are tuned for MCP UX: the descriptions are what an\n * LLM client sees when deciding whether to call the tool, so they're\n * written for that audience as well as for validation.\n *\n * Aligned with CHAP 0.2 (see profiles/*.md) and MCP 2025-11-25.\n */\n\nexport interface JsonSchema {\n type?: string;\n description?: string;\n properties?: Record<string, JsonSchema>;\n required?: string[];\n enum?: string[];\n items?: JsonSchema;\n additionalProperties?: boolean | JsonSchema;\n oneOf?: JsonSchema[];\n default?: unknown;\n}\n\n// Common reusable fragments.\nconst PARTICIPANT_URI: JsonSchema = {\n type: \"string\",\n description: \"Participant URI, e.g. 'human:alice@example.org' or 'agent:bot@local'.\",\n};\n\nconst WORKSPACE_ID: JsonSchema = {\n type: \"string\",\n description: \"Workspace identifier, e.g. 'wsp_techcorp_support'.\",\n};\n\nconst TASK_ID: JsonSchema = {\n type: \"string\",\n description: \"Task identifier returned by chap.task.create.\",\n};\n\nconst ROUTING_HINTS: JsonSchema = {\n type: \"object\",\n description: \"Optional signals for the routing/1.0 profile.\",\n properties: {\n criticality: { type: \"string\", enum: [\"low\", \"medium\", \"high\", \"critical\"] },\n deadline: { type: \"string\", description: \"ISO 8601 timestamp.\" },\n risk_tier: { type: \"string\" },\n max_cost_usd: { type: \"number\" },\n },\n additionalProperties: true,\n};\n\n// ============================================================\n// Core\n// ============================================================\n\nexport const SCHEMAS: Record<string, JsonSchema> = {\n \"chap.workspace.create\": {\n type: \"object\",\n properties: {\n workspace: { ...WORKSPACE_ID, description: \"Workspace id to create. If omitted, one is generated.\" },\n profiles: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Profile identifiers to enable, e.g. ['core/1.0', 'review/1.0'].\",\n },\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"trial\" },\n mode_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"production\" },\n },\n additionalProperties: false,\n },\n\n \"chap.workspace.describe\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID },\n required: [\"workspace\"],\n },\n\n \"chap.workspace.set_profiles\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n profiles: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"profiles\"],\n },\n\n \"chap.participant.join\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n type: { type: \"string\", enum: [\"human\", \"agent\", \"service\", \"group\", \"workspace\"] },\n role: { type: \"string\", description: \"Operator-defined role, e.g. 'reviewer' or 'drafter'.\" },\n display_name: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"type\"],\n },\n\n \"chap.participant.leave\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.task.create\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: { ...PARTICIPANT_URI, description: \"Delegator URI.\" },\n kind: { type: \"string\", description: \"Task kind, e.g. 'draft_response' or 'review'.\" },\n assignee: { ...PARTICIPANT_URI, description: \"Who the task is assigned to. Must be a workspace member.\" },\n input: { type: \"object\", description: \"Task-specific input payload.\", additionalProperties: true },\n routing_hints: ROUTING_HINTS,\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n },\n required: [\"workspace\", \"from\", \"kind\", \"assignee\", \"input\"],\n },\n\n \"chap.task.update\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n state: { type: \"string\", enum: [\"in_progress\", \"review_requested\", \"declined\", \"paused\", \"cancelled\", \"completed\"] },\n progress_note: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"state\"],\n },\n\n \"chap.task.complete\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n output: { description: \"The task's output artefact. Pass as a JSON object or array, not a JSON-encoded string.\" },\n confidence: { type: \"number\", description: \"Self-reported confidence (0-1), where supported.\" },\n routing_hints: ROUTING_HINTS,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.audit.read\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\", description: \"Start sequence number (inclusive).\" },\n to_seq: { type: \"integer\", description: \"End sequence number (exclusive).\" },\n },\n },\n filter: {\n type: \"object\",\n properties: {\n method: { type: \"string\" },\n from: { type: \"string\" },\n task_id: { type: \"string\" },\n },\n },\n },\n required: [\"workspace\"],\n },\n\n // ============================================================\n // review/1.0\n // ============================================================\n\n \"chap.review.request\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n to: {\n oneOf: [PARTICIPANT_URI, { type: \"array\", items: PARTICIPANT_URI }],\n description: \"One or more reviewers. A single URI string, or a JSON array of URI strings (not a JSON-encoded string).\",\n },\n rule: {\n type: \"string\",\n enum: [\"any_one_approves\", \"all_approve\", \"quorum:2\", \"quorum:3\"],\n default: \"any_one_approves\",\n },\n artefact: { description: \"The draft being submitted for review. Pass as a JSON object or array, not a JSON-encoded string.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"artefact\"],\n },\n\n \"chap.decide.approve\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.reject\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n request_revision: { type: \"boolean\", description: \"If true, task returns to in_progress instead of declined.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.override\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n diff: {\n type: \"array\",\n description: \"RFC 6902 JSON Patch operations applied to the artefact under review.\",\n items: {\n type: \"object\",\n properties: {\n op: { type: \"string\", enum: [\"add\", \"replace\", \"remove\", \"copy\", \"move\", \"test\"] },\n path: { type: \"string\" },\n value: {},\n from: { type: \"string\" },\n },\n required: [\"op\", \"path\"],\n },\n },\n rationale: { type: \"string\", description: \"Why the override was applied. Required for the structured-override audit trail.\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n policy_refs: { type: \"array\", items: { type: \"string\" } },\n logical_id: { type: \"string\" },\n intent_preserved: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"diff\", \"rationale\"],\n },\n\n \"chap.abstain.declare\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n reason: { type: \"string\" },\n category: { type: \"string\", enum: [\"conflict_of_interest\", \"insufficient_context\", \"out_of_scope\", \"other\"] },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"reason\"],\n },\n\n \"chap.escalate.raise\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n original_task_id: TASK_ID,\n new_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"assignee\"],\n },\n },\n required: [\"workspace\", \"from\", \"original_task_id\", \"new_task\"],\n },\n\n // ============================================================\n // whisper/1.0\n // ============================================================\n\n \"chap.whisper.ask\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Who is being asked.\" },\n question: { type: \"string\" },\n options: {\n type: \"array\",\n items: { type: \"object\", properties: { id: { type: \"string\" }, label: { type: \"string\" }}, required: [\"id\"] },\n description: \"Optional multiple-choice options. If present, answer_option must be one of these ids.\",\n },\n deadline_ms: { type: \"integer\", description: \"Time-to-live in milliseconds from now.\" },\n default_if_lapsed: { description: \"Value applied if the whisper lapses without an answer.\" },\n urgency: { type: \"string\", enum: [\"low\", \"medium\", \"high\"], default: \"low\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"question\", \"deadline_ms\", \"default_if_lapsed\"],\n },\n\n \"chap.whisper.answer\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n whisper_id: { type: \"string\" },\n answer_option: { type: \"string\", description: \"Option id (required when the whisper has options).\" },\n answer: { type: \"string\", description: \"Free-text answer (when no options).\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"whisper_id\"],\n },\n\n // ============================================================\n // deliberation/1.0\n // ============================================================\n\n \"chap.deliberate.open\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Deliberation participants.\" },\n task_id: TASK_ID,\n rule: {\n type: \"string\",\n description: \"Voting rule. Examples: any_one_approves, all_approve, quorum:N, weighted_vote:T, weighted_vote_with_veto:T.\",\n },\n question: { type: \"string\" },\n weights: { type: \"object\", additionalProperties: { type: \"number\" }, description: \"Voter -> weight map (for weighted rules).\" },\n veto: { type: \"object\", additionalProperties: { type: \"boolean\" }, description: \"Voter -> can-veto map.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to\", \"rule\"],\n },\n\n \"chap.deliberate.comment\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"comment\"],\n },\n\n \"chap.deliberate.vote\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n vote: { type: \"string\", enum: [\"yea\", \"nay\", \"abstain\"] },\n weight: { type: \"number\" },\n comment: { type: \"string\" },\n veto_invoked: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"vote\"],\n },\n\n \"chap.deliberate.close\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\"],\n },\n\n // ============================================================\n // handoff/1.0\n // ============================================================\n\n \"chap.handoff.propose\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"string\", description: \"Recipient (URI or 'group:...').\" },\n tasks: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n task_id: TASK_ID,\n title: { type: \"string\" },\n status_summary: { type: \"string\" },\n next_action: { type: \"string\" },\n blockers: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"task_id\"],\n },\n },\n summary: { type: \"string\" },\n context_links: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"workspace\", \"from\", \"to\", \"tasks\"],\n },\n\n \"chap.handoff.accept\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n accepted_task_ids: { type: \"array\", items: TASK_ID, description: \"If omitted, all proposed tasks are accepted.\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n \"chap.handoff.decline\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n reason: { type: \"string\" },\n suggested_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n // ============================================================\n // control/1.0\n // ============================================================\n\n \"chap.control.pause\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n in_flight_policy: { type: \"string\", enum: [\"allow_to_complete\", \"interrupt\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.resume\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.cancel\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.control.snapshot\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n label: { type: \"string\" },\n include: { type: \"array\", items: { type: \"string\" }, description: \"Aspects to snapshot, e.g. ['members', 'open_tasks', 'mode_ceiling'].\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.rollback\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to_snapshot_artefact_id: { type: \"string\" },\n what_to_restore: { type: \"array\", items: { type: \"string\" }},\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to_snapshot_artefact_id\"],\n },\n\n \"chap.control.supersede\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n successor_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"kind\"],\n },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"successor_task\"],\n },\n\n \"chap.control.set_mode_ceiling\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n new_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"new_ceiling\"],\n },\n\n // ============================================================\n // routing/1.0\n // ============================================================\n\n \"chap.task.route\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n candidates: { type: \"array\", items: PARTICIPANT_URI, description: \"Candidate assignees.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"candidates\"],\n },\n\n \"chap.review.depth\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n artefact_routing_hints: {\n type: \"object\",\n description: \"Per-artefact signals like confidence, model_id, cost_consumed_usd.\",\n additionalProperties: true,\n },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.escalate.auto\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n default_escalation_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n // ============================================================\n // security-signed/1.0\n // ============================================================\n\n \"chap.participant.rotate_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n old_kid: { type: \"string\" },\n new_jwk: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"from\", \"old_kid\", \"new_jwk\"],\n },\n\n \"chap.participant.revoke_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n target_uri: PARTICIPANT_URI,\n kid: { type: \"string\" },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"target_uri\", \"kid\"],\n },\n\n // ============================================================\n // audit-scitt/1.0\n // ============================================================\n\n \"chap.audit.submit_to_scitt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\" },\n to_seq: { type: \"integer\" },\n },\n },\n issuer: { type: \"string\" },\n },\n required: [\"workspace\"],\n },\n\n \"chap.audit.verify_receipt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n receipt: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"receipt\"],\n },\n\n \"chap.audit.verify_chain\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\"],\n },\n};\n\n/** Methods that map to MCP tools. Currently: all 39 CHAP methods. */\nexport const TOOL_NAMES = Object.keys(SCHEMAS);\n\n/** Get the JSON Schema for a tool, or null if not a known CHAP method. */\nexport function schemaFor(toolName: string): JsonSchema | null {\n return SCHEMAS[toolName] ?? null;\n}\n\n/** Map an MCP tool name back to its CHAP method name. */\nexport function methodForTool(toolName: string): string | null {\n if (!toolName.startsWith(\"chap.\")) return null;\n return toolName.slice(\"chap.\".length);\n}\n\n// ============================================================\n// Stringified-JSON coercion\n// ============================================================\n//\n// LLM MCP clients (Claude Desktop, Cursor, and others) frequently\n// serialise structured tool arguments as JSON-encoded *strings* rather\n// than as native JSON objects/arrays. For example, an `artefact` that\n// should arrive as { \"draft\": \"...\" } arrives as the string\n// \"{\\\"draft\\\": \\\"...\\\"}\", and a `to` that should be [\"human:me@local\"]\n// arrives as \"[\\\"human:me@local\\\"]\".\n//\n// The CHAP protocol core is deliberately strict: it stores artefacts\n// and applies JSON Patches against whatever it receives. A stringified\n// object therefore (a) pollutes the audit log with the wrong type and\n// (b) makes object-path patches in decide.override impossible, because\n// there is no object to traverse.\n//\n// We fix this at the adapter boundary, leaving the protocol core\n// untouched. Before an argument is wrapped in a CHAP envelope, any\n// string value whose schema admits a non-string type is JSON-parsed\n// when (and only when) it parses cleanly to a type the schema allows.\n// Plain strings that the schema accepts as strings (participant URIs,\n// task ids, rationales) are never touched, so a bare \"human:me@local\"\n// passed to a string|array `to` field is preserved as-is.\n\n/** True if the schema admits `object` as a value type. */\nfunction admitsType(schema: JsonSchema | undefined, t: \"object\" | \"array\"): boolean {\n if (!schema) return false;\n if (schema.type === t) return true;\n if (schema.oneOf) return schema.oneOf.some((s) => admitsType(s, t));\n // A field declared with neither `type` nor `oneOf` (e.g. `output`,\n // `artefact`) is an opaque payload: it admits any JSON value, so we\n // allow coercion to both object and array for it.\n if (schema.type === undefined && !schema.oneOf && !schema.enum) return true;\n return false;\n}\n\n/**\n * Coerce a single argument value against its parameter schema. Returns\n * the parsed value when the string is stringified JSON the schema\n * accepts; otherwise returns the value unchanged.\n */\nfunction coerceValue(value: unknown, schema: JsonSchema | undefined): unknown {\n if (typeof value !== \"string\") return value;\n const trimmed = value.trim();\n if (trimmed.length === 0) return value;\n const looksLikeObject = trimmed.startsWith(\"{\");\n const looksLikeArray = trimmed.startsWith(\"[\");\n if (!looksLikeObject && !looksLikeArray) return value;\n\n const wantObject = looksLikeObject && admitsType(schema, \"object\");\n const wantArray = looksLikeArray && admitsType(schema, \"array\");\n if (!wantObject && !wantArray) return value;\n\n try {\n const parsed = JSON.parse(value);\n // Only accept the parse if its type is one the schema admits. This\n // guards against, say, a string that happens to start with \"[\" but\n // is meant to be a literal string in a string-only field.\n if (Array.isArray(parsed) && admitsType(schema, \"array\")) return parsed;\n if (parsed !== null && typeof parsed === \"object\" && !Array.isArray(parsed)\n && admitsType(schema, \"object\")) return parsed;\n return value;\n } catch {\n // Not valid JSON: leave it for the coordinator to validate/reject.\n return value;\n }\n}\n\n/**\n * Normalise the arguments object for a tool call, coercing any\n * stringified-JSON values whose parameter schema admits a structured\n * type. Unknown keys (not in the schema) are passed through untouched.\n *\n * This is a pure function: it returns a new object and does not mutate\n * its input. Coordinator dispatch sees correctly-typed params, so the\n * audit log records the right shapes and decide.override patches apply\n * against real objects.\n */\nexport function coerceToolArgs(\n toolName: string,\n args: Record<string, unknown>,\n): Record<string, unknown> {\n const schema = schemaFor(toolName);\n const props = schema?.properties;\n if (!props) return args;\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(args)) {\n out[key] = coerceValue(value, props[key]);\n }\n return out;\n}\n"],"mappings":";AA4BA,IAAM,kBAA8B;AAAA,EAClC,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,eAA2B;AAAA,EAC/B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,UAAsB;AAAA,EAC1B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,gBAA4B;AAAA,EAChC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,IACV,aAAa,EAAE,MAAM,UAAU,MAAM,CAAC,OAAO,UAAU,QAAQ,UAAU,EAAE;AAAA,IAC3E,UAAa,EAAE,MAAM,UAAU,aAAa,sBAAsB;AAAA,IAClE,WAAa,EAAE,MAAM,SAAS;AAAA,IAC9B,cAAc,EAAE,MAAM,SAAS;AAAA,EACjC;AAAA,EACA,sBAAsB;AACxB;AAMO,IAAM,UAAsC;AAAA,EACjD,yBAAyB;AAAA,IACvB,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW,EAAE,GAAG,cAAc,aAAa,wDAAwD;AAAA,MACnG,UAAU;AAAA,QACR,MAAM;AAAA,QACN,OAAO,EAAE,MAAM,SAAS;AAAA,QACxB,aAAa;AAAA,MACf;AAAA,MACA,MAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,GAAG,SAAS,QAAQ;AAAA,MAC1F,cAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,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hD,QAAM,aAAa,mBAAmB,WAAW,QAAQ,QAAQ;AACjE,QAAM,YAAa,kBAAmB,WAAW,QAAQ,OAAO;AAChE,MAAI,CAAC,cAAc,CAAC,UAAW,QAAO;AAEtC,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,KAAK;AAI/B,QAAI,MAAM,QAAQ,MAAM,KAAK,WAAW,QAAQ,OAAO,EAAG,QAAO;AACjE,QAAI,WAAW,QAAQ,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,KACnE,WAAW,QAAQ,QAAQ,EAAG,QAAO;AAC5C,WAAO;AAAA,EACT,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;AAYO,SAAS,eACd,UACA,MACyB;AACzB,QAAM,SAAS,UAAU,QAAQ;AACjC,QAAM,QAAQ,QAAQ;AACtB,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,MAA+B,CAAC;AACtC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC/C,QAAI,GAAG,IAAI,YAAY,OAAO,MAAM,GAAG,CAAC;AAAA,EAC1C;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/schemas.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator-mcp/schemas\n *\n * JSON Schema definitions for each CHAP method, used as the\n * inputSchema for the corresponding MCP tool. Each schema describes\n * the params object that the CHAP envelope would carry; the tool\n * handler wraps the params in a JSON-RPC 2.0 envelope before dispatch.\n *\n * These schemas are tuned for MCP UX: the descriptions are what an\n * LLM client sees when deciding whether to call the tool, so they're\n * written for that audience as well as for validation.\n *\n * Aligned with CHAP 0.2 (see profiles/*.md) and MCP 2025-11-25.\n */\n\nexport interface JsonSchema {\n type?: string;\n description?: string;\n properties?: Record<string, JsonSchema>;\n required?: string[];\n enum?: string[];\n items?: JsonSchema;\n additionalProperties?: boolean | JsonSchema;\n oneOf?: JsonSchema[];\n default?: unknown;\n /** JSON Schema `pattern`, used where a string has a fixed wire shape. */\n pattern?: string;\n}\n\n// Common reusable fragments.\nconst PARTICIPANT_URI: JsonSchema = {\n type: \"string\",\n description: \"Participant URI, e.g. 'human:alice@example.org' or 'agent:bot@local'.\",\n};\n\nconst WORKSPACE_ID: JsonSchema = {\n type: \"string\",\n description: \"Workspace identifier, e.g. 'wsp_techcorp_support'.\",\n};\n\nconst TASK_ID: JsonSchema = {\n type: \"string\",\n description: \"Task identifier returned by chap.task.create.\",\n};\n\nconst ROUTING_HINTS: JsonSchema = {\n type: \"object\",\n description: \"Optional signals for the routing/1.0 profile.\",\n properties: {\n criticality: { type: \"string\", enum: [\"low\", \"medium\", \"high\", \"critical\"] },\n deadline: { type: \"string\", description: \"ISO 8601 timestamp.\" },\n risk_tier: { type: \"string\" },\n max_cost_usd: { type: \"number\" },\n },\n additionalProperties: true,\n};\n\n// ============================================================\n// Core\n// ============================================================\n\nexport const SCHEMAS: Record<string, JsonSchema> = {\n \"chap.workspace.create\": {\n type: \"object\",\n properties: {\n workspace: { ...WORKSPACE_ID, description: \"Workspace id to create. If omitted, one is generated.\" },\n profiles: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Profile identifiers to enable, e.g. ['core/1.0', 'review/1.0'].\",\n },\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"trial\" },\n mode_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"], default: \"production\" },\n },\n additionalProperties: false,\n },\n\n \"chap.workspace.describe\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID },\n required: [\"workspace\"],\n },\n\n \"chap.workspace.set_profiles\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n profiles: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"profiles\"],\n },\n\n \"chap.participant.join\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n type: { type: \"string\", enum: [\"human\", \"agent\", \"service\", \"group\", \"workspace\"] },\n role: { type: \"string\", description: \"Operator-defined role, e.g. 'reviewer' or 'drafter'.\" },\n display_name: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"type\"],\n },\n\n \"chap.participant.leave\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.task.create\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: { ...PARTICIPANT_URI, description: \"Delegator URI.\" },\n kind: { type: \"string\", description: \"Task kind, e.g. 'draft_response' or 'review'.\" },\n assignee: { ...PARTICIPANT_URI, description: \"Who the task is assigned to. Must be a workspace member.\" },\n input: { type: \"object\", description: \"Task-specific input payload.\", additionalProperties: true },\n routing_hints: ROUTING_HINTS,\n mode: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n },\n required: [\"workspace\", \"from\", \"kind\", \"assignee\", \"input\"],\n },\n\n \"chap.task.update\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n state: { type: \"string\", enum: [\"in_progress\", \"review_requested\", \"declined\", \"paused\", \"cancelled\", \"completed\"] },\n progress_note: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"state\"],\n },\n\n \"chap.task.complete\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n output: { description: \"The task's output artefact. Pass as a JSON object or array, not a JSON-encoded string.\" },\n confidence: { type: \"number\", description: \"Self-reported confidence (0-1), where supported.\" },\n routing_hints: ROUTING_HINTS,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.audit.read\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\", description: \"Start sequence number (inclusive).\" },\n to_seq: { type: \"integer\", description: \"End sequence number (exclusive).\" },\n },\n },\n filter: {\n type: \"object\",\n properties: {\n method: { type: \"string\" },\n from: { type: \"string\" },\n task_id: { type: \"string\" },\n },\n },\n },\n required: [\"workspace\"],\n },\n\n // ============================================================\n // review/1.0\n // ============================================================\n\n \"chap.review.request\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID,\n from: PARTICIPANT_URI,\n task_id: TASK_ID,\n to: {\n oneOf: [PARTICIPANT_URI, { type: \"array\", items: PARTICIPANT_URI }],\n description: \"One or more reviewers. A single URI string, or a JSON array of URI strings (not a JSON-encoded string).\",\n },\n rule: {\n type: \"string\",\n enum: [\"any_one_approves\", \"all_approve\", \"quorum:2\", \"quorum:3\"],\n default: \"any_one_approves\",\n },\n artefact: { description: \"The draft being submitted for review. Pass as a JSON object or array, not a JSON-encoded string.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"artefact\"],\n },\n\n \"chap.decide.approve\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n approved_artefact_digest: {\n type: \"string\",\n pattern: \"^sha256:[0-9a-f]{64}$\",\n description: \"Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch.\",\n },\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.reject\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n approved_artefact_digest: {\n type: \"string\",\n pattern: \"^sha256:[0-9a-f]{64}$\",\n description: \"Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch.\",\n },\n comment: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n request_revision: { type: \"boolean\", description: \"If true, task returns to in_progress instead of declined.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.decide.override\": {\n type: \"object\",\n properties: {\n approved_artefact_digest: {\n type: \"string\",\n pattern: \"^sha256:[0-9a-f]{64}$\",\n description: \"Optional. SHA-256 over the JCS canonicalisation of the artefact under review, as `sha256:<hex>`. Binds the decision to the exact content reviewed; refused with -32074 on mismatch.\",\n },\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n diff: {\n type: \"array\",\n description: \"RFC 6902 JSON Patch operations applied to the artefact under review.\",\n items: {\n type: \"object\",\n properties: {\n op: { type: \"string\", enum: [\"add\", \"replace\", \"remove\", \"copy\", \"move\", \"test\"] },\n path: { type: \"string\" },\n value: {},\n from: { type: \"string\" },\n },\n required: [\"op\", \"path\"],\n },\n },\n rationale: { type: \"string\", description: \"Why the override was applied. Required for the structured-override audit trail.\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n policy_refs: { type: \"array\", items: { type: \"string\" } },\n logical_id: { type: \"string\" },\n intent_preserved: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"diff\", \"rationale\"],\n },\n\n \"chap.abstain.declare\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n reason: { type: \"string\" },\n category: { type: \"string\", enum: [\"conflict_of_interest\", \"insufficient_context\", \"out_of_scope\", \"other\"] },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"reason\"],\n },\n\n \"chap.escalate.raise\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n original_task_id: TASK_ID,\n new_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"assignee\"],\n },\n },\n required: [\"workspace\", \"from\", \"original_task_id\", \"new_task\"],\n },\n\n // ============================================================\n // whisper/1.0\n // ============================================================\n\n \"chap.whisper.ask\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI, task_id: TASK_ID,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Who is being asked.\" },\n question: { type: \"string\" },\n options: {\n type: \"array\",\n items: { type: \"object\", properties: { id: { type: \"string\" }, label: { type: \"string\" }}, required: [\"id\"] },\n description: \"Optional multiple-choice options. If present, answer_option must be one of these ids.\",\n },\n deadline_ms: { type: \"integer\", description: \"Time-to-live in milliseconds from now.\" },\n default_if_lapsed: { description: \"Value applied if the whisper lapses without an answer.\" },\n urgency: { type: \"string\", enum: [\"low\", \"medium\", \"high\"], default: \"low\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"to\", \"question\", \"deadline_ms\", \"default_if_lapsed\"],\n },\n\n \"chap.whisper.answer\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n whisper_id: { type: \"string\" },\n answer_option: { type: \"string\", description: \"Option id (required when the whisper has options).\" },\n answer: { type: \"string\", description: \"Free-text answer (when no options).\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"whisper_id\"],\n },\n\n // ============================================================\n // deliberation/1.0\n // ============================================================\n\n \"chap.deliberate.open\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"array\", items: PARTICIPANT_URI, description: \"Deliberation participants.\" },\n task_id: TASK_ID,\n rule: {\n type: \"string\",\n description: \"Voting rule. Examples: any_one_approves, all_approve, quorum:N, weighted_vote:T, weighted_vote_with_veto:T.\",\n },\n question: { type: \"string\" },\n weights: { type: \"object\", additionalProperties: { type: \"number\" }, description: \"Voter -> weight map (for weighted rules).\" },\n veto: { type: \"object\", additionalProperties: { type: \"boolean\" }, description: \"Voter -> can-veto map.\" },\n deadline: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to\", \"rule\"],\n },\n\n \"chap.deliberate.comment\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"comment\"],\n },\n\n \"chap.deliberate.vote\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n vote: { type: \"string\", enum: [\"yea\", \"nay\", \"abstain\"] },\n weight: { type: \"number\" },\n comment: { type: \"string\" },\n veto_invoked: { type: \"boolean\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\", \"vote\"],\n },\n\n \"chap.deliberate.close\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n deliberation_id: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"deliberation_id\"],\n },\n\n // ============================================================\n // handoff/1.0\n // ============================================================\n\n \"chap.handoff.propose\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to: { type: \"string\", description: \"Recipient (URI or 'group:...').\" },\n tasks: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n task_id: TASK_ID,\n title: { type: \"string\" },\n status_summary: { type: \"string\" },\n next_action: { type: \"string\" },\n blockers: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"task_id\"],\n },\n },\n summary: { type: \"string\" },\n context_links: { type: \"array\", items: { type: \"string\" }},\n },\n required: [\"workspace\", \"from\", \"to\", \"tasks\"],\n },\n\n \"chap.handoff.accept\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n accepted_task_ids: { type: \"array\", items: TASK_ID, description: \"If omitted, all proposed tasks are accepted.\" },\n comment: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n \"chap.handoff.decline\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n handoff_id: { type: \"string\" },\n reason: { type: \"string\" },\n suggested_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"handoff_id\"],\n },\n\n // ============================================================\n // control/1.0\n // ============================================================\n\n \"chap.control.pause\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n in_flight_policy: { type: \"string\", enum: [\"allow_to_complete\", \"interrupt\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.resume\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n scope: { type: \"string\", enum: [\"task\", \"participant\", \"workspace\"], default: \"task\" },\n task_id: TASK_ID,\n participant_uri: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.cancel\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.control.snapshot\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n label: { type: \"string\" },\n include: { type: \"array\", items: { type: \"string\" }, description: \"Aspects to snapshot, e.g. ['members', 'open_tasks', 'mode_ceiling'].\" },\n },\n required: [\"workspace\", \"from\"],\n },\n\n \"chap.control.rollback\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n to_snapshot_artefact_id: { type: \"string\" },\n what_to_restore: { type: \"array\", items: { type: \"string\" }},\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"to_snapshot_artefact_id\"],\n },\n\n \"chap.control.supersede\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n successor_task: {\n type: \"object\",\n properties: {\n kind: { type: \"string\" },\n assignee: PARTICIPANT_URI,\n input: { type: \"object\", additionalProperties: true },\n },\n required: [\"kind\"],\n },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"successor_task\"],\n },\n\n \"chap.control.set_mode_ceiling\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n new_ceiling: { type: \"string\", enum: [\"shadow\", \"trial\", \"production\"] },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"new_ceiling\"],\n },\n\n // ============================================================\n // routing/1.0\n // ============================================================\n\n \"chap.task.route\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n candidates: { type: \"array\", items: PARTICIPANT_URI, description: \"Candidate assignees.\" },\n },\n required: [\"workspace\", \"from\", \"task_id\", \"candidates\"],\n },\n\n \"chap.review.depth\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n artefact_routing_hints: {\n type: \"object\",\n description: \"Per-artefact signals like confidence, model_id, cost_consumed_usd.\",\n additionalProperties: true,\n },\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n \"chap.escalate.auto\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n task_id: TASK_ID,\n default_escalation_target: PARTICIPANT_URI,\n },\n required: [\"workspace\", \"from\", \"task_id\"],\n },\n\n // ============================================================\n // security-signed/1.0\n // ============================================================\n\n \"chap.participant.rotate_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n old_kid: { type: \"string\" },\n new_jwk: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"from\", \"old_kid\", \"new_jwk\"],\n },\n\n \"chap.participant.revoke_key\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n target_uri: PARTICIPANT_URI,\n kid: { type: \"string\" },\n reason: { type: \"string\" },\n },\n required: [\"workspace\", \"from\", \"target_uri\", \"kid\"],\n },\n\n // ============================================================\n // audit-scitt/1.0\n // ============================================================\n\n \"chap.audit.submit_to_scitt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n range: {\n type: \"object\",\n properties: {\n from_seq: { type: \"integer\" },\n to_seq: { type: \"integer\" },\n },\n },\n issuer: { type: \"string\" },\n },\n required: [\"workspace\"],\n },\n\n \"chap.audit.verify_receipt\": {\n type: \"object\",\n properties: {\n workspace: WORKSPACE_ID, from: PARTICIPANT_URI,\n receipt: { type: \"object\", additionalProperties: true },\n },\n required: [\"workspace\", \"receipt\"],\n },\n\n \"chap.audit.verify_chain\": {\n type: \"object\",\n properties: { workspace: WORKSPACE_ID, from: PARTICIPANT_URI },\n required: [\"workspace\"],\n },\n};\n\n/** Methods that map to MCP tools. Currently: all 39 CHAP methods. */\nexport const TOOL_NAMES = Object.keys(SCHEMAS);\n\n/** Get the JSON Schema for a tool, or null if not a known CHAP method. */\nexport function schemaFor(toolName: string): JsonSchema | null {\n return SCHEMAS[toolName] ?? null;\n}\n\n/** Map an MCP tool name back to its CHAP method name. */\nexport function methodForTool(toolName: string): string | null {\n if (!toolName.startsWith(\"chap.\")) return null;\n return toolName.slice(\"chap.\".length);\n}\n\n// ============================================================\n// Stringified-JSON coercion\n// ============================================================\n//\n// LLM MCP clients (Claude Desktop, Cursor, and others) frequently\n// serialise structured tool arguments as JSON-encoded *strings* rather\n// than as native JSON objects/arrays. For example, an `artefact` that\n// should arrive as { \"draft\": \"...\" } arrives as the string\n// \"{\\\"draft\\\": \\\"...\\\"}\", and a `to` that should be [\"human:me@local\"]\n// arrives as \"[\\\"human:me@local\\\"]\".\n//\n// The CHAP protocol core is deliberately strict: it stores artefacts\n// and applies JSON Patches against whatever it receives. A stringified\n// object therefore (a) pollutes the audit log with the wrong type and\n// (b) makes object-path patches in decide.override impossible, because\n// there is no object to traverse.\n//\n// We fix this at the adapter boundary, leaving the protocol core\n// untouched. Before an argument is wrapped in a CHAP envelope, any\n// string value whose schema admits a non-string type is JSON-parsed\n// when (and only when) it parses cleanly to a type the schema allows.\n// Plain strings that the schema accepts as strings (participant URIs,\n// task ids, rationales) are never touched, so a bare \"human:me@local\"\n// passed to a string|array `to` field is preserved as-is.\n\n/** True if the schema admits `object` as a value type. */\nfunction admitsType(schema: JsonSchema | undefined, t: \"object\" | \"array\"): boolean {\n if (!schema) return false;\n if (schema.type === t) return true;\n if (schema.oneOf) return schema.oneOf.some((s) => admitsType(s, t));\n // A field declared with neither `type` nor `oneOf` (e.g. `output`,\n // `artefact`) is an opaque payload: it admits any JSON value, so we\n // allow coercion to both object and array for it.\n if (schema.type === undefined && !schema.oneOf && !schema.enum) return true;\n return false;\n}\n\n/**\n * Coerce a single argument value against its parameter schema. Returns\n * the parsed value when the string is stringified JSON the schema\n * accepts; otherwise returns the value unchanged.\n */\nfunction coerceValue(value: unknown, schema: JsonSchema | undefined): unknown {\n if (typeof value !== \"string\") return value;\n const trimmed = value.trim();\n if (trimmed.length === 0) return value;\n const looksLikeObject = trimmed.startsWith(\"{\");\n const looksLikeArray = trimmed.startsWith(\"[\");\n if (!looksLikeObject && !looksLikeArray) return value;\n\n const wantObject = looksLikeObject && admitsType(schema, \"object\");\n const wantArray = looksLikeArray && admitsType(schema, \"array\");\n if (!wantObject && !wantArray) return value;\n\n try {\n const parsed = JSON.parse(value);\n // Only accept the parse if its type is one the schema admits. This\n // guards against, say, a string that happens to start with \"[\" but\n // is meant to be a literal string in a string-only field.\n if (Array.isArray(parsed) && admitsType(schema, \"array\")) return parsed;\n if (parsed !== null && typeof parsed === \"object\" && !Array.isArray(parsed)\n && admitsType(schema, \"object\")) return parsed;\n return value;\n } catch {\n // Not valid JSON: leave it for the coordinator to validate/reject.\n return value;\n }\n}\n\n/**\n * Normalise the arguments object for a tool call, coercing any\n * stringified-JSON values whose parameter schema admits a structured\n * type. Unknown keys (not in the schema) are passed through untouched.\n *\n * This is a pure function: it returns a new object and does not mutate\n * its input. Coordinator dispatch sees correctly-typed params, so the\n * audit log records the right shapes and decide.override patches apply\n * against real objects.\n */\nexport function coerceToolArgs(\n toolName: string,\n args: Record<string, unknown>,\n): Record<string, unknown> {\n const schema = schemaFor(toolName);\n const props = schema?.properties;\n if (!props) return args;\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(args)) {\n out[key] = coerceValue(value, props[key]);\n }\n return out;\n}\n"],"mappings":";AA8BA,IAAM,kBAA8B;AAAA,EAClC,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,eAA2B;AAAA,EAC/B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,UAAsB;AAAA,EAC1B,MAAM;AAAA,EACN,aAAa;AACf;AAEA,IAAM,gBAA4B;AAAA,EAChC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,IACV,aAAa,EAAE,MAAM,UAAU,MAAM,CAAC,OAAO,UAAU,QAAQ,UAAU,EAAE;AAAA,IAC3E,UAAa,EAAE,MAAM,UAAU,aAAa,sBAAsB;AAAA,IAClE,WAAa,EAAE,MAAM,SAAS;AAAA,IAC9B,cAAc,EAAE,MAAM,SAAS;AAAA,EACjC;AAAA,EACA,sBAAsB;AACxB;AAMO,IAAM,UAAsC;AAAA,EACjD,yBAAyB;AAAA,IACvB,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW,EAAE,GAAG,cAAc,aAAa,wDAAwD;AAAA,MACnG,UAAU;AAAA,QACR,MAAM;AAAA,QACN,OAAO,EAAE,MAAM,SAAS;AAAA,QACxB,aAAa;AAAA,MACf;AAAA,MACA,MAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,GAAG,SAAS,QAAQ;AAAA,MAC1F,cAAc,EAAE,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,YAAY,GAAG,SAAS,aAAa;AAAA,IACjG;AAAA,IACA,sBA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;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,kBAAkB,QAAQ,WAAW,GAAG;AAC9C,QAAM,iBAAkB,QAAQ,WAAW,GAAG;AAC9C,MAAI,CAAC,mBAAmB,CAAC,eAAgB,QAAO;AAEhD,QAAM,aAAa,mBAAmB,WAAW,QAAQ,QAAQ;AACjE,QAAM,YAAa,kBAAmB,WAAW,QAAQ,OAAO;AAChE,MAAI,CAAC,cAAc,CAAC,UAAW,QAAO;AAEtC,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,KAAK;AAI/B,QAAI,MAAM,QAAQ,MAAM,KAAK,WAAW,QAAQ,OAAO,EAAG,QAAO;AACjE,QAAI,WAAW,QAAQ,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,KACnE,WAAW,QAAQ,QAAQ,EAAG,QAAO;AAC5C,WAAO;AAAA,EACT,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;AAYO,SAAS,eACd,UACA,MACyB;AACzB,QAAM,SAAS,UAAU,QAAQ;AACjC,QAAM,QAAQ,QAAQ;AACtB,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,MAA+B,CAAC;AACtC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC/C,QAAI,GAAG,IAAI,YAAY,OAAO,MAAM,GAAG,CAAC;AAAA,EAC1C;AACA,SAAO;AACT;","names":[]}
package/dist/tools.cjs CHANGED
@@ -71,7 +71,7 @@ var TOOL_DESCRIPTIONS = {
71
71
  // audit-scitt/1.0
72
72
  "chap.audit.submit_to_scitt": "Build COSE_Sign1-shaped audit statements for a range of envelopes and submit them to the configured SCITT transparency service.",
73
73
  "chap.audit.verify_receipt": "Verify a SCITT receipt against the configured verifier.",
74
- "chap.audit.verify_chain": "Verify the local prev-hash chain across a workspace's audit log."
74
+ "chap.audit.verify_chain": "Verify the local prev-hash chain across a workspace's audit log. Only status verified with ok true means the log was checked and is intact. Status not_evaluated with ok false means part of the log was never checked, so its integrity is unknown and must not be reported as verified; entries_unchecked says how much. Errors mean the chain is broken or absent."
75
75
  };
76
76
  // Annotate the CommonJS export names for ESM import in node:
77
77
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tools.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator-mcp/tools\n *\n * One-line descriptions for each CHAP method exposed as an MCP tool.\n * These show up in MCP-client UIs (Claude Desktop, Cursor, etc.) and\n * are what the LLM reads when deciding whether to call the tool.\n * Tuned for clarity over brevity.\n */\n\nexport const TOOL_DESCRIPTIONS: Record<string, string> = {\n // Core\n \"chap.workspace.create\":\n \"Create a new CHAP workspace where humans and agents can collaborate on tasks. \" +\n \"Returns the workspace id.\",\n\n \"chap.workspace.describe\":\n \"Get the current state of a workspace: members, profiles, audit length, task and override counts.\",\n\n \"chap.workspace.set_profiles\":\n \"Change which CHAP profiles are enabled on a workspace.\",\n\n \"chap.participant.join\":\n \"Add a participant (human, agent, or service) to a workspace.\",\n\n \"chap.participant.leave\":\n \"Remove a participant from a workspace.\",\n\n \"chap.task.create\":\n \"Create a new task in a workspace. Tasks are units of work assigned to a participant. \" +\n \"Pass routing_hints (criticality, deadline) to inform later routing decisions.\",\n\n \"chap.task.update\":\n \"Update a task's state (e.g. in_progress, declined, paused). Only legal transitions are accepted.\",\n\n \"chap.task.complete\":\n \"Mark a task as completed, attaching the output artefact. Use chap.review.request afterwards if review is required.\",\n\n \"chap.audit.read\":\n \"Read entries from a workspace's audit log. Supports a sequence-number range and a filter by method, sender, or task id.\",\n\n // review/1.0\n \"chap.review.request\":\n \"Open a review on a completed task. Pass one or more reviewers in 'to' and the draft artefact. \" +\n \"The reviewers then call chap.decide.approve / .reject / .override or chap.abstain.declare.\",\n\n \"chap.decide.approve\":\n \"Approve a task that's under review. Resolves the review and marks the task completed.\",\n\n \"chap.decide.reject\":\n \"Reject a task that's under review. Pass request_revision: true to send it back to in_progress instead of declined.\",\n\n \"chap.decide.override\":\n \"Apply an RFC 6902 JSON Patch to the artefact under review and accept the result. \" +\n \"Carries a structured override artefact: diff + rationale + tags. \" +\n \"This is the structured-override-as-learning-signal mechanism that distinguishes CHAP from approve/reject-only workflows.\",\n\n \"chap.abstain.declare\":\n \"Decline to review a task with a reason (e.g. conflict_of_interest). The task transitions to abstained.\",\n\n \"chap.escalate.raise\":\n \"Create a new task that supersedes the original, typically assigned to a more senior reviewer. \" +\n \"Use when the current reviewer cannot decide.\",\n\n // whisper/1.0\n \"chap.whisper.ask\":\n \"Pose a deadline-bound question to one or more participants. Carries a default that's applied if the deadline lapses. \" +\n \"Use for quick clarifications that shouldn't block a task indefinitely.\",\n\n \"chap.whisper.answer\":\n \"Answer a previously asked whisper. If the whisper had options, answer_option must be one of them.\",\n\n // deliberation/1.0\n \"chap.deliberate.open\":\n \"Open a multi-participant deliberation with a voting rule (any_one_approves, all_approve, quorum:N, weighted_vote:T, weighted_vote_with_veto:T).\",\n\n \"chap.deliberate.comment\":\n \"Add a comment to an open deliberation.\",\n\n \"chap.deliberate.vote\":\n \"Cast a vote (yea / nay / abstain) in a deliberation. Each voter votes at most once.\",\n\n \"chap.deliberate.close\":\n \"Close a deliberation and compute the outcome based on its voting rule.\",\n\n // handoff/1.0\n \"chap.handoff.propose\":\n \"Propose handing off one or more open tasks to another participant. Recipient may be a single URI or a group:... URI.\",\n\n \"chap.handoff.accept\":\n \"Accept a previously proposed handoff. The accepted tasks are reassigned to the accepting participant.\",\n\n \"chap.handoff.decline\":\n \"Decline a previously proposed handoff. Optionally suggest a different target.\",\n\n // control/1.0\n \"chap.control.pause\":\n \"Pause work, scoped to a single task, a participant, or the whole workspace.\",\n\n \"chap.control.resume\":\n \"Resume previously paused work.\",\n\n \"chap.control.cancel\":\n \"Cancel a task that is not yet terminal.\",\n\n \"chap.control.snapshot\":\n \"Capture the current workspace state as an artefact (members, open tasks, mode ceiling, etc.). Used as the rollback target.\",\n\n \"chap.control.rollback\":\n \"Roll the workspace back to a previously captured snapshot. Specify what_to_restore to scope the rollback.\",\n\n \"chap.control.supersede\":\n \"Mark a task superseded by a new successor task in one envelope. Use when a task needs to be replaced wholesale rather than re-routed.\",\n\n \"chap.control.set_mode_ceiling\":\n \"Set the maximum operating mode allowed in the workspace (shadow, trial, production). Tasks requesting higher modes are rejected.\",\n\n // routing/1.0\n \"chap.task.route\":\n \"Pick an assignee for a task from a list of candidates. Produces a route_decision artefact recording the policy used.\",\n\n \"chap.review.depth\":\n \"Decide the review depth for a task (skip / spot_check / full) based on routing hints. Produces a route_decision artefact.\",\n\n \"chap.escalate.auto\":\n \"Evaluate whether a task should be auto-escalated based on its routing hints (criticality, confidence). Produces a route_decision artefact.\",\n\n // security-signed/1.0\n \"chap.participant.rotate_key\":\n \"Rotate a participant's signing key. The old key remains valid for verifying historical envelopes via valid_until.\",\n\n \"chap.participant.revoke_key\":\n \"Revoke a signing key (e.g. on suspected compromise). Envelopes signed with the revoked key after revoke time are rejected.\",\n\n // audit-scitt/1.0\n \"chap.audit.submit_to_scitt\":\n \"Build COSE_Sign1-shaped audit statements for a range of envelopes and submit them to the configured SCITT transparency service.\",\n\n \"chap.audit.verify_receipt\":\n \"Verify a SCITT receipt against the configured verifier.\",\n\n \"chap.audit.verify_chain\":\n \"Verify the local prev-hash chain across a workspace's audit log.\",\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,oBAA4C;AAAA;AAAA,EAEvD,yBACE;AAAA,EAGF,2BACE;AAAA,EAEF,+BACE;AAAA,EAEF,yBACE;AAAA,EAEF,0BACE;AAAA,EAEF,oBACE;AAAA,EAGF,oBACE;AAAA,EAEF,sBACE;AAAA,EAEF,mBACE;AAAA;AAAA,EAGF,uBACE;AAAA,EAGF,uBACE;AAAA,EAEF,sBACE;AAAA,EAEF,wBACE;AAAA,EAIF,wBACE;AAAA,EAEF,uBACE;AAAA;AAAA,EAIF,oBACE;AAAA,EAGF,uBACE;AAAA;AAAA,EAGF,wBACE;AAAA,EAEF,2BACE;AAAA,EAEF,wBACE;AAAA,EAEF,yBACE;AAAA;AAAA,EAGF,wBACE;AAAA,EAEF,uBACE;AAAA,EAEF,wBACE;AAAA;AAAA,EAGF,sBACE;AAAA,EAEF,uBACE;AAAA,EAEF,uBACE;AAAA,EAEF,yBACE;AAAA,EAEF,yBACE;AAAA,EAEF,0BACE;AAAA,EAEF,iCACE;AAAA;AAAA,EAGF,mBACE;AAAA,EAEF,qBACE;AAAA,EAEF,sBACE;AAAA;AAAA,EAGF,+BACE;AAAA,EAEF,+BACE;AAAA;AAAA,EAGF,8BACE;AAAA,EAEF,6BACE;AAAA,EAEF,2BACE;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/tools.ts"],"sourcesContent":["/**\n * @brightbeamai/chap-coordinator-mcp/tools\n *\n * One-line descriptions for each CHAP method exposed as an MCP tool.\n * These show up in MCP-client UIs (Claude Desktop, Cursor, etc.) and\n * are what the LLM reads when deciding whether to call the tool.\n * Tuned for clarity over brevity.\n */\n\nexport const TOOL_DESCRIPTIONS: Record<string, string> = {\n // Core\n \"chap.workspace.create\":\n \"Create a new CHAP workspace where humans and agents can collaborate on tasks. \" +\n \"Returns the workspace id.\",\n\n \"chap.workspace.describe\":\n \"Get the current state of a workspace: members, profiles, audit length, task and override counts.\",\n\n \"chap.workspace.set_profiles\":\n \"Change which CHAP profiles are enabled on a workspace.\",\n\n \"chap.participant.join\":\n \"Add a participant (human, agent, or service) to a workspace.\",\n\n \"chap.participant.leave\":\n \"Remove a participant from a workspace.\",\n\n \"chap.task.create\":\n \"Create a new task in a workspace. Tasks are units of work assigned to a participant. \" +\n \"Pass routing_hints (criticality, deadline) to inform later routing decisions.\",\n\n \"chap.task.update\":\n \"Update a task's state (e.g. in_progress, declined, paused). Only legal transitions are accepted.\",\n\n \"chap.task.complete\":\n \"Mark a task as completed, attaching the output artefact. Use chap.review.request afterwards if review is required.\",\n\n \"chap.audit.read\":\n \"Read entries from a workspace's audit log. Supports a sequence-number range and a filter by method, sender, or task id.\",\n\n // review/1.0\n \"chap.review.request\":\n \"Open a review on a completed task. Pass one or more reviewers in 'to' and the draft artefact. \" +\n \"The reviewers then call chap.decide.approve / .reject / .override or chap.abstain.declare.\",\n\n \"chap.decide.approve\":\n \"Approve a task that's under review. Resolves the review and marks the task completed.\",\n\n \"chap.decide.reject\":\n \"Reject a task that's under review. Pass request_revision: true to send it back to in_progress instead of declined.\",\n\n \"chap.decide.override\":\n \"Apply an RFC 6902 JSON Patch to the artefact under review and accept the result. \" +\n \"Carries a structured override artefact: diff + rationale + tags. \" +\n \"This is the structured-override-as-learning-signal mechanism that distinguishes CHAP from approve/reject-only workflows.\",\n\n \"chap.abstain.declare\":\n \"Decline to review a task with a reason (e.g. conflict_of_interest). The task transitions to abstained.\",\n\n \"chap.escalate.raise\":\n \"Create a new task that supersedes the original, typically assigned to a more senior reviewer. \" +\n \"Use when the current reviewer cannot decide.\",\n\n // whisper/1.0\n \"chap.whisper.ask\":\n \"Pose a deadline-bound question to one or more participants. Carries a default that's applied if the deadline lapses. \" +\n \"Use for quick clarifications that shouldn't block a task indefinitely.\",\n\n \"chap.whisper.answer\":\n \"Answer a previously asked whisper. If the whisper had options, answer_option must be one of them.\",\n\n // deliberation/1.0\n \"chap.deliberate.open\":\n \"Open a multi-participant deliberation with a voting rule (any_one_approves, all_approve, quorum:N, weighted_vote:T, weighted_vote_with_veto:T).\",\n\n \"chap.deliberate.comment\":\n \"Add a comment to an open deliberation.\",\n\n \"chap.deliberate.vote\":\n \"Cast a vote (yea / nay / abstain) in a deliberation. Each voter votes at most once.\",\n\n \"chap.deliberate.close\":\n \"Close a deliberation and compute the outcome based on its voting rule.\",\n\n // handoff/1.0\n \"chap.handoff.propose\":\n \"Propose handing off one or more open tasks to another participant. Recipient may be a single URI or a group:... URI.\",\n\n \"chap.handoff.accept\":\n \"Accept a previously proposed handoff. The accepted tasks are reassigned to the accepting participant.\",\n\n \"chap.handoff.decline\":\n \"Decline a previously proposed handoff. Optionally suggest a different target.\",\n\n // control/1.0\n \"chap.control.pause\":\n \"Pause work, scoped to a single task, a participant, or the whole workspace.\",\n\n \"chap.control.resume\":\n \"Resume previously paused work.\",\n\n \"chap.control.cancel\":\n \"Cancel a task that is not yet terminal.\",\n\n \"chap.control.snapshot\":\n \"Capture the current workspace state as an artefact (members, open tasks, mode ceiling, etc.). Used as the rollback target.\",\n\n \"chap.control.rollback\":\n \"Roll the workspace back to a previously captured snapshot. Specify what_to_restore to scope the rollback.\",\n\n \"chap.control.supersede\":\n \"Mark a task superseded by a new successor task in one envelope. Use when a task needs to be replaced wholesale rather than re-routed.\",\n\n \"chap.control.set_mode_ceiling\":\n \"Set the maximum operating mode allowed in the workspace (shadow, trial, production). Tasks requesting higher modes are rejected.\",\n\n // routing/1.0\n \"chap.task.route\":\n \"Pick an assignee for a task from a list of candidates. Produces a route_decision artefact recording the policy used.\",\n\n \"chap.review.depth\":\n \"Decide the review depth for a task (skip / spot_check / full) based on routing hints. Produces a route_decision artefact.\",\n\n \"chap.escalate.auto\":\n \"Evaluate whether a task should be auto-escalated based on its routing hints (criticality, confidence). Produces a route_decision artefact.\",\n\n // security-signed/1.0\n \"chap.participant.rotate_key\":\n \"Rotate a participant's signing key. The old key remains valid for verifying historical envelopes via valid_until.\",\n\n \"chap.participant.revoke_key\":\n \"Revoke a signing key (e.g. on suspected compromise). Envelopes signed with the revoked key after revoke time are rejected.\",\n\n // audit-scitt/1.0\n \"chap.audit.submit_to_scitt\":\n \"Build COSE_Sign1-shaped audit statements for a range of envelopes and submit them to the configured SCITT transparency service.\",\n\n \"chap.audit.verify_receipt\":\n \"Verify a SCITT receipt against the configured verifier.\",\n\n \"chap.audit.verify_chain\":\n \"Verify the local prev-hash chain across a workspace's audit log. Only status verified with ok true means the log was checked and is intact. Status not_evaluated with ok false means part of the log was never checked, so its integrity is unknown and must not be reported as verified; entries_unchecked says how much. Errors mean the chain is broken or absent.\",\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,oBAA4C;AAAA;AAAA,EAEvD,yBACE;AAAA,EAGF,2BACE;AAAA,EAEF,+BACE;AAAA,EAEF,yBACE;AAAA,EAEF,0BACE;AAAA,EAEF,oBACE;AAAA,EAGF,oBACE;AAAA,EAEF,sBACE;AAAA,EAEF,mBACE;AAAA;AAAA,EAGF,uBACE;AAAA,EAGF,uBACE;AAAA,EAEF,sBACE;AAAA,EAEF,wBACE;AAAA,EAIF,wBACE;AAAA,EAEF,uBACE;AAAA;AAAA,EAIF,oBACE;AAAA,EAGF,uBACE;AAAA;AAAA,EAGF,wBACE;AAAA,EAEF,2BACE;AAAA,EAEF,wBACE;AAAA,EAEF,yBACE;AAAA;AAAA,EAGF,wBACE;AAAA,EAEF,uBACE;AAAA,EAEF,wBACE;AAAA;AAAA,EAGF,sBACE;AAAA,EAEF,uBACE;AAAA,EAEF,uBACE;AAAA,EAEF,yBACE;AAAA,EAEF,yBACE;AAAA,EAEF,0BACE;AAAA,EAEF,iCACE;AAAA;AAAA,EAGF,mBACE;AAAA,EAEF,qBACE;AAAA,EAEF,sBACE;AAAA;AAAA,EAGF,+BACE;AAAA,EAEF,+BACE;AAAA;AAAA,EAGF,8BACE;AAAA,EAEF,6BACE;AAAA,EAEF,2BACE;AACJ;","names":[]}
package/dist/tools.js CHANGED
@@ -47,7 +47,7 @@ var TOOL_DESCRIPTIONS = {
47
47
  // audit-scitt/1.0
48
48
  "chap.audit.submit_to_scitt": "Build COSE_Sign1-shaped audit statements for a range of envelopes and submit them to the configured SCITT transparency service.",
49
49
  "chap.audit.verify_receipt": "Verify a SCITT receipt against the configured verifier.",
50
- "chap.audit.verify_chain": "Verify the local prev-hash chain across a workspace's audit log."
50
+ "chap.audit.verify_chain": "Verify the local prev-hash chain across a workspace's audit log. Only status verified with ok true means the log was checked and is intact. Status not_evaluated with ok false means part of the log was never checked, so its integrity is unknown and must not be reported as verified; entries_unchecked says how much. Errors mean the chain is broken or absent."
51
51
  };
52
52
  export {
53
53
  TOOL_DESCRIPTIONS