@aiwg/cli 2026.9.4 → 2026.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/THIRD_PARTY_NOTICES.md +16 -0
  2. package/agentic/code/providers/capability-matrix.yaml +45 -3
  3. package/agentic/code/providers/deepseek-harness/README.md +8 -0
  4. package/agentic/code/providers/deepseek-harness/aiwg.cordis.patch.yml +10 -0
  5. package/agentic/code/providers/model-capabilities.v1.json +11 -0
  6. package/agentic/code/providers/model-catalog.v1.json +8 -0
  7. package/bin/aiwg.mjs +1 -0
  8. package/dist/src/api/index.d.ts +14 -0
  9. package/dist/src/api/index.js +14 -0
  10. package/dist/src/artifacts/corpus-tools/source-types.js +1 -0
  11. package/dist/src/artifacts/index-files.js +17 -2
  12. package/dist/src/artifacts/repair.js +55 -6
  13. package/dist/src/catalog/cli.js +21 -7
  14. package/dist/src/catalog/cli.mjs +22 -7
  15. package/dist/src/cli/agent-spawn.js +10 -1
  16. package/dist/src/cli/handlers/artifacts.js +22 -3
  17. package/dist/src/cli/handlers/help.js +3 -0
  18. package/dist/src/cli/handlers/index.js +5 -1
  19. package/dist/src/cli/handlers/models.js +2 -2
  20. package/dist/src/cli/handlers/output-mode.js +1 -1
  21. package/dist/src/cli/handlers/runtime-info.js +1 -1
  22. package/dist/src/cli/handlers/sessions.js +55 -15
  23. package/dist/src/cli/handlers/steward.js +1 -1
  24. package/dist/src/cli/handlers/subcommands.js +5 -0
  25. package/dist/src/cli/handlers/writer-profile.js +110 -0
  26. package/dist/src/cli/handlers/writing.js +122 -0
  27. package/dist/src/cli/router.js +5 -1
  28. package/dist/src/config/project-artifacts-runtime.mjs +33 -1
  29. package/dist/src/config/project-artifacts.js +1 -1
  30. package/dist/src/dataset/fortemi-dataset-execution.d.ts +23 -0
  31. package/dist/src/dataset/fortemi-dataset-execution.js +158 -0
  32. package/dist/src/dataset/fortemi-live-qualification.d.ts +4 -2
  33. package/dist/src/dataset/fortemi-live-qualification.js +20 -21
  34. package/dist/src/dataset/fortemi-run-receipt.d.ts +44 -0
  35. package/dist/src/dataset/fortemi-run-receipt.js +74 -0
  36. package/dist/src/dataset/index.d.ts +2 -0
  37. package/dist/src/dataset/index.js +2 -0
  38. package/dist/src/extensions/commands/definitions.js +24 -0
  39. package/dist/src/extensions/manifest.js +3 -0
  40. package/dist/src/mcp/server.mjs +2 -0
  41. package/dist/src/mcp/tools/writer-profiles.mjs +40 -0
  42. package/dist/src/models/model-capabilities.v1.json +11 -0
  43. package/dist/src/models/model-catalog.v1.json +8 -0
  44. package/dist/src/models/provider-policy.js +1 -1
  45. package/dist/src/network-analysis/analyzer.js +667 -0
  46. package/dist/src/network-analysis/citations.js +107 -0
  47. package/dist/src/network-analysis/forensics.js +132 -0
  48. package/dist/src/network-analysis/governance.js +216 -0
  49. package/dist/src/network-analysis/index.js +10 -0
  50. package/dist/src/network-analysis/probe.js +405 -0
  51. package/dist/src/network-analysis/recipes.js +88 -0
  52. package/dist/src/network-analysis/research.js +181 -0
  53. package/dist/src/network-analysis/termshark.js +252 -0
  54. package/dist/src/network-analysis/verification.js +171 -0
  55. package/dist/src/output-modes/registry.js +37 -6
  56. package/dist/src/output-modes/runtime.js +164 -28
  57. package/dist/src/providers/capability-matrix.yaml +45 -3
  58. package/dist/src/providers/provider-definitions.js +49 -0
  59. package/dist/src/providers/provider-inventory.js +1 -0
  60. package/dist/src/providers/transformation-receipt.js +3 -2
  61. package/dist/src/sessions/adapters/deepseek-harness.js +178 -0
  62. package/dist/src/sessions/batch-import.js +7 -0
  63. package/dist/src/sessions/contracts.js +2 -1
  64. package/dist/src/sessions/index.js +1 -0
  65. package/dist/src/sessions/workspace-discovery.js +5 -1
  66. package/dist/src/skills/deployer.js +6 -6
  67. package/dist/src/smiths/context-pipeline/workspace-context.js +7 -0
  68. package/dist/src/writing/channel-packs.js +13 -0
  69. package/dist/src/writing/contextual-diagnostics.js +142 -0
  70. package/dist/src/writing/example-generator.js +7 -6
  71. package/dist/src/writing/exemplar-selection.js +186 -0
  72. package/dist/src/writing/fidelity.js +61 -0
  73. package/dist/src/writing/validation-engine.js +32 -15
  74. package/dist/src/writing/voice-evaluation.js +301 -0
  75. package/dist/src/writing/voice-revision.js +201 -0
  76. package/dist/src/writing/writer-migration.js +216 -0
  77. package/dist/src/writing/writer-profile-legacy.js +145 -0
  78. package/dist/src/writing/writer-profile-store.js +117 -0
  79. package/dist/src/writing/writer-profile.js +222 -0
  80. package/dist/src/writing/writing-brief.js +166 -0
  81. package/dist/src/writing/writing-channels.js +63 -0
  82. package/dist/src/writing/writing-consumer.js +39 -0
  83. package/dist/src/writing/writing-receipt.js +266 -0
  84. package/package.json +1 -1
  85. package/schemas/dataset/fortemi-live-qualification-receipt.v2.schema.json +196 -0
  86. package/schemas/dataset/fortemi-run-receipt/validation-1.0.1/authority.json +12 -0
  87. package/schemas/dataset/fortemi-run-receipt/validation-1.0.1/run-receipt.schema.json +819 -0
  88. package/tools/agents/deploy-agents.mjs +7 -3
  89. package/tools/agents/providers/antigravity.mjs +1 -1
  90. package/tools/agents/providers/base.mjs +3 -2
  91. package/tools/agents/providers/deepseek-harness.mjs +66 -0
  92. package/tools/agents/providers/hermes.mjs +1 -1
  93. package/tools/agents/providers/openhuman.mjs +2 -2
@@ -0,0 +1,158 @@
1
+ import { canonicalFortemiDatasetJson, fortemiDatasetDigest, verifyFortemiDatasetRunReceipt } from "./fortemi-run-receipt.js";
2
+ export const FORTEMI_DATASET_EXECUTION_TOOL = "manage_dataset_execution";
3
+ export function fortemiDatasetRequestDigest(request) {
4
+ return fortemiDatasetDigest({
5
+ contractVersions: request.contractVersions || {},
6
+ schemaVersions: request.schemaVersions || {},
7
+ negotiation: request.negotiation || {},
8
+ plan: request.plan,
9
+ batch: request.batch,
10
+ resourceEnvelope: request.resourceEnvelope,
11
+ profiles: request.profiles || {},
12
+ inputSchemaDigest: request.inputSchemaDigest,
13
+ outputSchemaDigest: request.outputSchemaDigest,
14
+ });
15
+ }
16
+ function object(value) {
17
+ if (!value || typeof value !== "object" || Array.isArray(value))
18
+ throw new Error("CONFORMANCE_FORTEMI_RESPONSE_INVALID");
19
+ return value;
20
+ }
21
+ /** MCP transport binding; receipt verification is implemented independently in AIWG. */
22
+ export class FortemiDatasetExecutionClient {
23
+ client;
24
+ runs = new Map();
25
+ constructor(client) {
26
+ this.client = client;
27
+ }
28
+ async call(action, parameters = {}) {
29
+ const response = object(await this.client.callTool(FORTEMI_DATASET_EXECUTION_TOOL, { ...parameters, action }));
30
+ if (response.isError === true)
31
+ throw new Error("CONFORMANCE_FORTEMI_TOOL_FAILED");
32
+ if (Array.isArray(response.content)) {
33
+ const blocks = response.content.map(object);
34
+ if (blocks.length !== 1 || blocks[0].type !== "text" || typeof blocks[0].text !== "string")
35
+ throw new Error("CONFORMANCE_FORTEMI_RESPONSE_INVALID");
36
+ return object(JSON.parse(blocks[0].text));
37
+ }
38
+ return response;
39
+ }
40
+ async capabilities() {
41
+ const result = await this.call("capabilities");
42
+ if (object(result.contracts).receipt !== "fortemi.dataset-run-receipt/v1"
43
+ || object(result.schemaVersions).receipt !== "1.0.0"
44
+ || object(result.receiptValidation).revision !== "1.0.1"
45
+ || object(result.receiptValidation).requestBindingRevision !== "1.0.1")
46
+ throw new Error("CONFORMANCE_FORTEMI_RECEIPT_REVISION_UNSUPPORTED");
47
+ return result;
48
+ }
49
+ async preview(request) {
50
+ await this.capabilities();
51
+ const result = await this.call("preview", { request });
52
+ if (result.noSideEffects !== true)
53
+ throw new Error("CONFORMANCE_FORTEMI_PREVIEW_INVALID");
54
+ if (result.accepted === true && result.requestDigest !== fortemiDatasetRequestDigest(request))
55
+ throw new Error("CONFORMANCE_FORTEMI_PREVIEW_BINDING_MISMATCH");
56
+ return result;
57
+ }
58
+ /** The caller must approve the exact digest returned by read-only preview. */
59
+ async execute(request, approvedRequestDigest) {
60
+ request = structuredClone(request);
61
+ if (!/^sha256:[a-f0-9]{64}$/.test(approvedRequestDigest))
62
+ throw new Error("CONFORMANCE_LIVE_AUTHORIZATION_REQUIRED");
63
+ if (fortemiDatasetRequestDigest(request) !== approvedRequestDigest)
64
+ throw new Error("CONFORMANCE_FORTEMI_PLAN_NOT_APPROVED");
65
+ const preview = await this.preview(request);
66
+ if (preview.accepted !== true || preview.requestDigest !== approvedRequestDigest)
67
+ throw new Error("CONFORMANCE_FORTEMI_PLAN_NOT_APPROVED");
68
+ if (typeof request.runId !== "string")
69
+ throw new Error("CONFORMANCE_FORTEMI_RUN_INVALID");
70
+ const previous = this.runs.get(request.runId);
71
+ if (previous && previous.digest !== approvedRequestDigest)
72
+ throw new Error("CONFORMANCE_FORTEMI_PLAN_NOT_APPROVED");
73
+ this.runs.set(request.runId, { request: structuredClone(request), digest: approvedRequestDigest });
74
+ const result = await this.call("execute", { request });
75
+ return this.verifyResult(result, request, approvedRequestDigest);
76
+ }
77
+ verifyResult(result, request, approvedRequestDigest) {
78
+ const errors = verifyFortemiDatasetRunReceipt(result.receipt);
79
+ if (errors.length)
80
+ throw new Error(`CONFORMANCE_FORTEMI_RECEIPT_INVALID:${errors.join(",")}`);
81
+ const receipt = result.receipt;
82
+ if (receipt.requestDigest !== approvedRequestDigest || receipt.runId !== request.runId
83
+ || receipt.namespaceId !== object(object(request.plan).destination).dataset
84
+ || receipt.state !== result.state || receipt.verification !== result.verification)
85
+ throw new Error("CONFORMANCE_FORTEMI_RECEIPT_BINDING_MISMATCH");
86
+ const plan = object(request.plan);
87
+ const batch = object(request.batch);
88
+ if (["planId", "sourceRevision", "mode", "planDigest", "configurationDigest", "transformationDigest"].some(key => receipt.bindings[key] !== plan[key])
89
+ || receipt.bindings.inputSchemaDigest !== request.inputSchemaDigest || receipt.bindings.outputSchemaDigest !== request.outputSchemaDigest
90
+ || receipt.bindings.inputDigest !== fortemiDatasetDigest(batch.mutations)
91
+ || receipt.idempotencyKey !== (batch.idempotencyKey || approvedRequestDigest)
92
+ || canonicalFortemiDatasetJson(receipt.resourceEnvelope) !== canonicalFortemiDatasetJson(request.resourceEnvelope)
93
+ || canonicalFortemiDatasetJson(receipt.profiles) !== canonicalFortemiDatasetJson(request.profiles || {})
94
+ || canonicalFortemiDatasetJson(receipt.checkpoint.after) !== canonicalFortemiDatasetJson(batch.checkpointAfter)
95
+ || canonicalFortemiDatasetJson(receipt.checkpoint.before || null) !== canonicalFortemiDatasetJson(batch.checkpointBefore || null))
96
+ throw new Error("CONFORMANCE_FORTEMI_RECEIPT_BINDING_MISMATCH");
97
+ return receipt;
98
+ }
99
+ knownRun(runId) {
100
+ const run = this.runs.get(runId);
101
+ if (!run)
102
+ throw new Error("CONFORMANCE_FORTEMI_RUN_UNKNOWN");
103
+ return run;
104
+ }
105
+ async retry(runId, action = "retry") {
106
+ const run = this.knownRun(runId);
107
+ return this.verifyResult(await this.call(action, { runId }), run.request, run.digest);
108
+ }
109
+ async status(runId) {
110
+ const run = this.knownRun(runId);
111
+ const result = await this.call("status", { runId });
112
+ if (result.runId !== runId)
113
+ throw new Error("CONFORMANCE_FORTEMI_RECEIPT_BINDING_MISMATCH");
114
+ if (result.receipt)
115
+ this.verifyResult(result, run.request, run.digest);
116
+ else if (result.state !== "running" || result.verification !== "pending")
117
+ throw new Error("CONFORMANCE_FORTEMI_RESPONSE_INVALID");
118
+ return result;
119
+ }
120
+ async checkpoint(runId) {
121
+ this.knownRun(runId);
122
+ const result = await this.call("checkpoint", { runId });
123
+ if (result.runId !== runId || (result.checkpoint !== undefined && !["committed", "degraded"].includes(String(result.state))))
124
+ throw new Error("CONFORMANCE_FORTEMI_CHECKPOINT_UNVERIFIED");
125
+ if (result.checkpoint !== undefined) {
126
+ const status = await this.status(runId);
127
+ const receipt = status.receipt;
128
+ if (result.receiptDigest !== receipt.receiptDigest || canonicalFortemiDatasetJson(result.checkpoint) !== canonicalFortemiDatasetJson(receipt.checkpoint.after))
129
+ throw new Error("CONFORMANCE_FORTEMI_CHECKPOINT_UNVERIFIED");
130
+ }
131
+ return result;
132
+ }
133
+ async cancel(runId) {
134
+ this.knownRun(runId);
135
+ const result = await this.call("cancel", { runId });
136
+ if (result.runId !== runId)
137
+ throw new Error("CONFORMANCE_FORTEMI_RECEIPT_BINDING_MISMATCH");
138
+ return result;
139
+ }
140
+ async archive(runId) {
141
+ const run = this.knownRun(runId);
142
+ const status = await this.status(runId);
143
+ const receipt = status.receipt;
144
+ if (!receipt || !["committed", "degraded", "failed"].includes(receipt.state))
145
+ throw new Error("CONFORMANCE_FORTEMI_ARCHIVE_UNRESOLVED");
146
+ const result = await this.call("archive", { runId });
147
+ if (result.namespaceId !== object(object(run.request.plan).destination).dataset
148
+ || typeof result.complete !== "boolean" || !Array.isArray(result.unresolved)
149
+ || result.unresolved.some(value => typeof value !== "string" || !/^sha256:[a-f0-9]{64}$/.test(value))
150
+ || (result.complete && result.unresolved.length !== 0)
151
+ || !Number.isSafeInteger(result.archived) || Number(result.archived) < 0
152
+ || !Number.isSafeInteger(result.alreadyArchived) || Number(result.alreadyArchived) < 0
153
+ || Number(result.archived) + Number(result.alreadyArchived) + result.unresolved.length !== receipt.counts.committed)
154
+ throw new Error("CONFORMANCE_FORTEMI_ARCHIVE_INVALID");
155
+ return result;
156
+ }
157
+ }
158
+ //# sourceMappingURL=fortemi-dataset-execution.js.map
@@ -1,9 +1,10 @@
1
1
  import type { McpClientLike } from "../storage/backends/fortemi.js";
2
- export declare const FORTEMI_DATASET_LIVE_CONTRACT: "aiwg.fortemi-dataset-live-qualification/v1";
2
+ export declare const FORTEMI_DATASET_LIVE_CONTRACT: "aiwg.fortemi-dataset-live-qualification/v2";
3
+ declare const LEGACY_LIVE_CONTRACT: "aiwg.fortemi-dataset-live-qualification/v1";
3
4
  export declare const FORTEMI_DATASET_CAPABILITIES_TOOL = "dataset_capabilities";
4
5
  export declare const FORTEMI_DATASET_EXECUTE_TOOL = "dataset_execute";
5
6
  export interface FortemiDatasetLiveReceipt {
6
- contract: typeof FORTEMI_DATASET_LIVE_CONTRACT;
7
+ contract: typeof FORTEMI_DATASET_LIVE_CONTRACT | typeof LEGACY_LIVE_CONTRACT;
7
8
  outcome: "pending" | "supported";
8
9
  diagnostic: "CONFORMANCE_FORTEMI_DATASET_CONTRACT_UNAVAILABLE" | "CONFORMANCE_FORTEMI_DATASET_PREFLIGHT_SUPPORTED";
9
10
  receiptDigest: string;
@@ -50,4 +51,5 @@ export declare function qualifyFortemiDatasetLivePreflight(input: {
50
51
  export declare function verifyFortemiDatasetLiveReceipt(value: unknown): string[];
51
52
  /** Atomically creates private evidence without replacing an existing receipt. */
52
53
  export declare function writeFortemiDatasetLiveReceipt(path: string, receipt: FortemiDatasetLiveReceipt): Promise<void>;
54
+ export {};
53
55
  //# sourceMappingURL=fortemi-live-qualification.d.ts.map
@@ -1,18 +1,22 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { link, mkdir, unlink, writeFile } from "node:fs/promises";
3
3
  import { dirname } from "node:path";
4
+ import { FORTEMI_DATASET_EXECUTION_TOOL } from "./fortemi-dataset-execution.js";
4
5
  import { endpointFingerprint, fortemiReceiptDigest, } from "../storage/fortemi-qualification-receipt.js";
5
- export const FORTEMI_DATASET_LIVE_CONTRACT = "aiwg.fortemi-dataset-live-qualification/v1";
6
+ export const FORTEMI_DATASET_LIVE_CONTRACT = "aiwg.fortemi-dataset-live-qualification/v2";
7
+ const LEGACY_LIVE_CONTRACT = "aiwg.fortemi-dataset-live-qualification/v1";
6
8
  export const FORTEMI_DATASET_CAPABILITIES_TOOL = "dataset_capabilities";
7
9
  export const FORTEMI_DATASET_EXECUTE_TOOL = "dataset_execute";
8
10
  const UUID_NAMESPACE = /^aiwg-dataset-qualification-[0-9a-f-]{36}$/u;
9
11
  const COMMIT = /^[0-9a-f]{40}$/u;
10
12
  const DIGEST = /^sha256:[0-9a-f]{64}$/u;
11
13
  const SAFE = /^[A-Za-z0-9._:/-]+$/u;
12
- const REQUIRED_TOOLS = [
14
+ const LEGACY_TOOLS = [
13
15
  FORTEMI_DATASET_CAPABILITIES_TOOL,
14
16
  FORTEMI_DATASET_EXECUTE_TOOL,
15
17
  ];
18
+ const REQUIRED_TOOLS = [FORTEMI_DATASET_EXECUTION_TOOL];
19
+ const REQUIRED_ACTIONS = ["capabilities", "preview", "execute", "status", "checkpoint", "cancel", "resume", "retry", "verify", "archive"];
16
20
  const MAX_TOOL_COUNT = 256;
17
21
  const MAX_SCHEMA_BYTES = 1_048_576;
18
22
  function record(value) {
@@ -81,24 +85,18 @@ export async function qualifyFortemiDatasetLivePreflight(input) {
81
85
  observedSchemaBytes > MAX_SCHEMA_BYTES)
82
86
  throw new Error("CONFORMANCE_RESOURCE_ENVELOPE_EXCEEDED");
83
87
  const tools = new Map(inventory.map((tool) => [tool.name, tool]));
84
- const specifications = [
85
- {
86
- tool: FORTEMI_DATASET_CAPABILITIES_TOOL,
87
- required: { contract_version: "string" },
88
- },
89
- {
90
- tool: FORTEMI_DATASET_EXECUTE_TOOL,
91
- required: {
92
- contract_version: "string",
93
- namespace: "string",
94
- plan: "object",
95
- records: "array",
96
- },
97
- },
98
- ];
88
+ const specifications = [{ tool: FORTEMI_DATASET_EXECUTION_TOOL, required: { action: "string" } }];
99
89
  const checks = specifications.map(({ tool, required }) => {
100
90
  const unique = inventory.filter((candidate) => candidate.name === tool).length === 1;
101
- const compatible = unique && inputSchemaCompatible(tools.get(tool)?.inputSchema, required);
91
+ const compatible = unique && inputSchemaCompatible(tools.get(tool)?.inputSchema, required)
92
+ && (() => {
93
+ const properties = record(record(tools.get(tool)?.inputSchema)?.properties);
94
+ const actions = record(properties?.action)?.enum;
95
+ return Array.isArray(actions) && REQUIRED_ACTIONS.every(action => actions.includes(action))
96
+ && record(properties?.request)?.type === "object"
97
+ && record(properties?.runId)?.type === "string"
98
+ && record(properties?.receipt)?.type === "object";
99
+ })();
102
100
  return {
103
101
  tool,
104
102
  compatible,
@@ -211,7 +209,7 @@ export function verifyFortemiDatasetLiveReceipt(value) {
211
209
  "code",
212
210
  ])))
213
211
  errors.push("CONFORMANCE_RECEIPT_SHAPE_INVALID");
214
- if (receipt.contract !== FORTEMI_DATASET_LIVE_CONTRACT)
212
+ if (receipt.contract !== FORTEMI_DATASET_LIVE_CONTRACT && receipt.contract !== LEGACY_LIVE_CONTRACT)
215
213
  errors.push("CONFORMANCE_RECEIPT_CONTRACT_MISMATCH");
216
214
  if (!COMMIT.test(receipt.bindings.aiwgCommit) ||
217
215
  !DIGEST.test(receipt.bindings.endpointFingerprint) ||
@@ -231,8 +229,9 @@ export function verifyFortemiDatasetLiveReceipt(value) {
231
229
  receipt.resources.networkAttempts !== 1)
232
230
  errors.push("CONFORMANCE_RECEIPT_MUTATION_INVALID");
233
231
  const operationNames = receipt.operations.map((operation) => operation.tool);
234
- const inventoryValid = receipt.operations.length === REQUIRED_TOOLS.length &&
235
- REQUIRED_TOOLS.every((tool) => operationNames.filter((name) => name === tool).length === 1);
232
+ const requiredTools = receipt.contract === LEGACY_LIVE_CONTRACT ? LEGACY_TOOLS : REQUIRED_TOOLS;
233
+ const inventoryValid = receipt.operations.length === requiredTools.length &&
234
+ requiredTools.every((tool) => operationNames.filter((name) => name === tool).length === 1);
236
235
  if (!inventoryValid ||
237
236
  receipt.operations.some((operation) => operation.code !==
238
237
  (operation.compatible
@@ -0,0 +1,44 @@
1
+ /** Independent implementation of the Fortemi wire canonicalization contract. */
2
+ export declare function canonicalFortemiDatasetJson(value: unknown): string;
3
+ export declare function fortemiDatasetDigest(value: unknown): string;
4
+ interface Checkpoint {
5
+ sequence: number;
6
+ scope: {
7
+ dataset: string;
8
+ [key: string]: string;
9
+ };
10
+ }
11
+ export interface FortemiDatasetRunReceipt {
12
+ receiptDigest: string;
13
+ requestDigest: string;
14
+ runId: string;
15
+ idempotencyKey: string;
16
+ profiles: unknown;
17
+ namespaceId: string;
18
+ bindings: Record<string, string>;
19
+ effects: Array<{
20
+ outcome: "committed" | "conflict" | "rejected" | "unverifiable";
21
+ }>;
22
+ counts: {
23
+ attempted: number;
24
+ committed: number;
25
+ rejected: number;
26
+ };
27
+ checkpoint: {
28
+ before?: Checkpoint;
29
+ after: Checkpoint;
30
+ };
31
+ capabilityDecision: {
32
+ selected: string[];
33
+ degradations: unknown[];
34
+ };
35
+ resourceEnvelope: {
36
+ maxRecords: number;
37
+ };
38
+ state: "running" | "committed" | "degraded" | "failed" | "cancelled" | "ambiguous";
39
+ verification: "pending" | "verified" | "failed" | "unverifiable";
40
+ }
41
+ /** Schema validity, semantic consistency, and checksum integrity; not issuer authentication. */
42
+ export declare function verifyFortemiDatasetRunReceipt(value: unknown): string[];
43
+ export {};
44
+ //# sourceMappingURL=fortemi-run-receipt.d.ts.map
@@ -0,0 +1,74 @@
1
+ import { createHash } from "node:crypto";
2
+ import { readFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import Ajv2020 from "ajv/dist/2020.js";
6
+ import addFormats from "ajv-formats";
7
+ /** Independent implementation of the Fortemi wire canonicalization contract. */
8
+ export function canonicalFortemiDatasetJson(value) {
9
+ if (value === null)
10
+ return "null";
11
+ if (typeof value === "string" || typeof value === "boolean")
12
+ return JSON.stringify(value);
13
+ if (typeof value === "number" && Number.isFinite(value))
14
+ return JSON.stringify(value);
15
+ if (Array.isArray(value))
16
+ return `[${value.map(canonicalFortemiDatasetJson).join(",")}]`;
17
+ if (typeof value === "object") {
18
+ const object = value;
19
+ return `{${Object.keys(object).sort().map(key => `${JSON.stringify(key)}:${canonicalFortemiDatasetJson(object[key])}`).join(",")}}`;
20
+ }
21
+ throw new Error("RECEIPT_VALUE_INVALID");
22
+ }
23
+ export function fortemiDatasetDigest(value) {
24
+ return `sha256:${createHash("sha256").update(canonicalFortemiDatasetJson(value), "utf8").digest("hex")}`;
25
+ }
26
+ function schemaPath() {
27
+ let directory = dirname(fileURLToPath(import.meta.url));
28
+ for (;;) {
29
+ try {
30
+ const metadata = JSON.parse(readFileSync(join(directory, "package.json"), "utf8"));
31
+ if (metadata.name === "aiwg" || metadata.name === "@aiwg/cli") {
32
+ return join(directory, "schemas/dataset/fortemi-run-receipt/validation-1.0.1/run-receipt.schema.json");
33
+ }
34
+ }
35
+ catch { /* Source and built installations have different depths. */ }
36
+ const parent = dirname(directory);
37
+ if (parent === directory)
38
+ throw new Error("FORTEMI_RECEIPT_SCHEMA_UNAVAILABLE");
39
+ directory = parent;
40
+ }
41
+ }
42
+ const ajv = new Ajv2020({ strict: true, allErrors: true });
43
+ addFormats(ajv);
44
+ const validate = ajv.compile(JSON.parse(readFileSync(schemaPath(), "utf8")));
45
+ /** Schema validity, semantic consistency, and checksum integrity; not issuer authentication. */
46
+ export function verifyFortemiDatasetRunReceipt(value) {
47
+ if (!validate(value))
48
+ return ["RECEIPT_STRUCTURE_INVALID"];
49
+ const receipt = value;
50
+ const errors = [];
51
+ const { receiptDigest, ...payload } = receipt;
52
+ if (fortemiDatasetDigest(payload) !== receiptDigest)
53
+ errors.push("RECEIPT_DIGEST_MISMATCH");
54
+ const { attempted, committed, rejected } = receipt.counts;
55
+ if (committed + rejected !== attempted)
56
+ errors.push("RECEIPT_COUNTS_INCONSISTENT");
57
+ const committedEffects = receipt.effects.filter(effect => effect.outcome === "committed").length;
58
+ if (receipt.effects.length !== attempted || committedEffects !== committed || attempted - committedEffects !== rejected)
59
+ errors.push("RECEIPT_EFFECTS_INCONSISTENT");
60
+ if (receipt.state === "failed" && committed !== 0)
61
+ errors.push("RECEIPT_STATE_INCONSISTENT");
62
+ if (receipt.bindings.outputDigest !== fortemiDatasetDigest(receipt.effects)
63
+ || receipt.bindings.resourceEnvelopeDigest !== fortemiDatasetDigest(receipt.resourceEnvelope)
64
+ || receipt.bindings.negotiationDigest !== fortemiDatasetDigest({ selected: receipt.capabilityDecision.selected, degradations: receipt.capabilityDecision.degradations, diagnostics: [] }))
65
+ errors.push("RECEIPT_BINDINGS_INCONSISTENT");
66
+ const { before, after } = receipt.checkpoint;
67
+ if (after.scope.dataset !== receipt.namespaceId || receipt.bindings.destinationDigest !== fortemiDatasetDigest(after.scope)
68
+ || (before && (canonicalFortemiDatasetJson(before.scope) !== canonicalFortemiDatasetJson(after.scope) || before.sequence >= after.sequence)))
69
+ errors.push("RECEIPT_CHECKPOINT_INCONSISTENT");
70
+ if (attempted > receipt.resourceEnvelope.maxRecords)
71
+ errors.push("RECEIPT_RESOURCE_LIMIT_EXCEEDED");
72
+ return errors;
73
+ }
74
+ //# sourceMappingURL=fortemi-run-receipt.js.map
@@ -15,6 +15,8 @@ export * from './file-orchestration-repository.js';
15
15
  export * from './local-execution-backend.js';
16
16
  export * from './fortemi-execution-bridge.js';
17
17
  export * from './fortemi-live-qualification.js';
18
+ export * from './fortemi-run-receipt.js';
19
+ export * from './fortemi-dataset-execution.js';
18
20
  export * from './orchestration-service.js';
19
21
  export * from './presentation.js';
20
22
  export * from './conformance-types.js';
@@ -15,6 +15,8 @@ export * from './file-orchestration-repository.js';
15
15
  export * from './local-execution-backend.js';
16
16
  export * from './fortemi-execution-bridge.js';
17
17
  export * from './fortemi-live-qualification.js';
18
+ export * from './fortemi-run-receipt.js';
19
+ export * from './fortemi-dataset-execution.js';
18
20
  export * from './orchestration-service.js';
19
21
  export * from './presentation.js';
20
22
  export * from './conformance-types.js';
@@ -1079,6 +1079,28 @@ export const sessionCommand = {
1079
1079
  },
1080
1080
  },
1081
1081
  };
1082
+ export const writingCommand = {
1083
+ id: 'writing', type: 'command', name: 'Writing',
1084
+ description: 'Prepare grounded writing plans and apply authorized proofreading corrections with canonical receipts',
1085
+ version: '1.0.0', capabilities: ['cli', 'voice', 'writing', 'proofread'],
1086
+ keywords: ['writing', 'brief', 'proofread', 'author', 'receipt'],
1087
+ category: 'project', platforms: { claude: 'full', generic: 'full' },
1088
+ deployment: { pathTemplate: '.{platform}/commands/{id}.md', core: true },
1089
+ metadata: { type: 'command', template: 'utility', argumentHint: '<plan|proofread> --brief <file> --profile <id> [--output <new-file>]', allowedTools: ['Read', 'Write', 'Bash'] },
1090
+ };
1091
+ export const writerProfileCommand = {
1092
+ id: 'writer-profile', type: 'command', name: 'Writer Profiles',
1093
+ description: 'Import, inspect, export, version, compile, revoke, and delete author-controlled writer sidecars',
1094
+ version: '1.0.0', capabilities: ['cli', 'voice', 'writer-profile'],
1095
+ keywords: ['writer-profile', 'author', 'voice', 'sample', 'provenance'],
1096
+ category: 'project', platforms: { claude: 'full', generic: 'full' },
1097
+ deployment: { pathTemplate: '.{platform}/commands/{id}.md', core: true },
1098
+ metadata: {
1099
+ type: 'command', template: 'utility',
1100
+ argumentHint: '<list|import|inspect|export|version|compile|revoke|delete> [id] [--scope project|user]',
1101
+ allowedTools: ['Read', 'Write', 'Bash'],
1102
+ },
1103
+ };
1082
1104
  export const outputModeCommand = {
1083
1105
  id: 'output-mode',
1084
1106
  type: 'command',
@@ -3801,6 +3823,8 @@ export const commandDefinitions = [
3801
3823
  sessionCommand,
3802
3824
  sessionsCommand,
3803
3825
  outputModeCommand,
3826
+ writerProfileCommand,
3827
+ writingCommand,
3804
3828
  schemaCommand,
3805
3829
  datasetCommand,
3806
3830
  ];
@@ -119,11 +119,14 @@ export const ProviderConfigSchema = z.object({
119
119
  'codex',
120
120
  'copilot',
121
121
  'cursor',
122
+ 'deepseek-harness',
122
123
  'factory',
123
124
  'hermes',
124
125
  'opencode',
125
126
  'openclaw',
126
127
  'openhuman',
128
+ 'omp',
129
+ 'pi',
127
130
  'warp',
128
131
  'windsurf',
129
132
  ]),
@@ -18,6 +18,7 @@ import { z } from 'zod';
18
18
  import fs from 'fs/promises';
19
19
  import path from 'path';
20
20
  import { fileURLToPath } from 'url';
21
+ import { registerWriterProfileResources } from './tools/writer-profiles.mjs';
21
22
  import { registerDiscoveryTools } from './tools/discovery.mjs';
22
23
  import { registerCommandRunTool } from './tools/command-run.mjs';
23
24
  import { registerInteractionTools } from './tools/interaction.mjs';
@@ -51,6 +52,7 @@ export function createServer() {
51
52
  // rule-list, rule-show, agent-show, template-list, template-show
52
53
  // ============================================
53
54
  registerDiscoveryTools(server);
55
+ registerWriterProfileResources(server);
54
56
 
55
57
  // ============================================
56
58
  // Command-run dispatch (#1312) — registers:
@@ -0,0 +1,40 @@
1
+ import { access } from 'node:fs/promises';
2
+ import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { z } from 'zod';
4
+ import { findProjectRoot } from '../helpers.mjs';
5
+
6
+ async function builtModule(name) {
7
+ for (const location of [new URL(`../../writing/${name}.js`, import.meta.url), new URL(`../../../dist/src/writing/${name}.js`, import.meta.url)]) {
8
+ try { await access(location); } catch { continue; }
9
+ return import(location.href);
10
+ }
11
+ throw new Error('Writer profile resources require the built CLI package.');
12
+ }
13
+
14
+ /** Scope-bound metadata listing; explicit reads always use the shared export policy. */
15
+ export function registerWriterProfileResources(server, options = {}) {
16
+ const projectRoot = () => options.projectRoot ? Promise.resolve(options.projectRoot) : findProjectRoot();
17
+ const api = options.loadApi ?? (async () => ({ ...await builtModule('writer-profile'), ...await builtModule('writer-profile-store') }));
18
+ server.registerResource('writer-profiles', 'aiwg://writer-profiles/catalog', {
19
+ title: 'Writer Profile Catalog', description: 'Scoped writer profile identifiers and revisions; excludes raw samples.', mimeType: 'application/json',
20
+ }, async () => {
21
+ const cwd = await projectRoot(); const { WriterProfileStore, inspectWriterProfile } = await api();
22
+ const profiles = [];
23
+ for (const scope of ['project', 'user']) {
24
+ const store = new WriterProfileStore({ cwd, scope });
25
+ for (const id of await store.list()) {
26
+ const metadata = inspectWriterProfile(await store.read(id));
27
+ profiles.push({ scope, ...metadata, uri: `aiwg://writer-profiles/${scope}/${encodeURIComponent(id)}` });
28
+ }
29
+ }
30
+ return { contents: [{ uri: 'aiwg://writer-profiles/catalog', mimeType: 'application/json', text: JSON.stringify({ profiles, providerInterception: false }) }] };
31
+ });
32
+ server.registerResource('writer-profile', new ResourceTemplate('aiwg://writer-profiles/{scope}/{id}', { list: undefined }), {
33
+ title: 'Shared Writer Profile', description: 'Explicit scoped read using profile sharing approvals; private exports are unavailable through this resource.', mimeType: 'application/json',
34
+ }, async (uri, variables) => {
35
+ const selection = z.object({ scope: z.enum(['project', 'user']), id: z.string().regex(/^[a-z0-9][a-z0-9.-]{0,79}$/) }).strict().parse(variables);
36
+ const cwd = await projectRoot(); const { WriterProfileStore, exportWriterProfile } = await api();
37
+ const profile = await new WriterProfileStore({ cwd, scope: selection.scope }).read(selection.id);
38
+ return { contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify(exportWriterProfile(profile, 'shared')) }] };
39
+ });
40
+ }
@@ -118,6 +118,17 @@
118
118
  "verification": "Inspect strict JSONL state and the selected provider/model",
119
119
  "sourceUrl": "https://github.com/earendil-works/pi/tree/main/packages/coding-agent#cli-reference", "verifiedAt": "2026-09-04"
120
120
  },
121
+ "deepseek-harness": {
122
+ "agent": "native", "skill": "inherited", "globalChild": "native",
123
+ "identifierSyntax": "provider/model passed through the SDK initialize request or agent-default-model Cordis row",
124
+ "effortValues": ["minimal", "low", "medium", "high", "xhigh"],
125
+ "inheritance": "Subagents inherit the configured Harness route unless explicitly overridden",
126
+ "invalidPinFallback": "Explicit unavailable routes or models fail the request",
127
+ "configTarget": "Ephemeral Cordis route patch and SDK initialize request",
128
+ "artifactFormat": "agent-default-model config; JSON-RPC initialize params",
129
+ "verification": "Pinned source contract plus opt-in headless OpenRouter smoke",
130
+ "sourceUrl": "https://github.com/deepseek-ai/deepseek-harness", "verifiedAt": "2026-09-05"
131
+ },
121
132
  "windsurf": {
122
133
  "agent": "unsupported", "skill": "unsupported", "globalChild": "inherited",
123
134
  "identifierSyntax": "UI-selected provider model",
@@ -89,6 +89,14 @@
89
89
  },
90
90
  "sourceUrl": "https://github.com/earendil-works/pi/tree/main/packages/coding-agent#providers--models", "verifiedAt": "2026-09-04"
91
91
  },
92
+ "deepseek-harness": {
93
+ "roles": {
94
+ "reasoning": { "id": "configured/reasoning", "status": "unverified", "observed": false },
95
+ "coding": { "id": "configured/coding", "status": "unverified", "observed": false },
96
+ "efficiency": { "id": "configured/efficiency", "status": "unverified", "observed": false }
97
+ },
98
+ "sourceUrl": "https://github.com/deepseek-ai/deepseek-harness", "verifiedAt": "2026-09-05"
99
+ },
92
100
  "warp": {
93
101
  "roles": {
94
102
  "reasoning": { "id": "profile-selected", "status": "unverified", "observed": false },
@@ -26,7 +26,7 @@ function requireModelResource(filename) {
26
26
  const capabilityData = requireModelResource('model-capabilities.v1.json');
27
27
  const catalogData = requireModelResource('model-catalog.v1.json');
28
28
  const ProviderSchema = z.enum([
29
- 'antigravity', 'claude', 'codex', 'copilot', 'cursor', 'factory', 'hermes',
29
+ 'antigravity', 'claude', 'codex', 'copilot', 'cursor', 'deepseek-harness', 'factory', 'hermes',
30
30
  'opencode', 'openclaw', 'openhuman', 'omp', 'pi', 'warp', 'windsurf',
31
31
  ]);
32
32
  const OutcomeSchema = z.enum([