project-tiny-context-harness 0.8.12 → 0.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -28
- package/assets/README.md +98 -45
- package/assets/README.zh-CN.md +68 -32
- package/assets/agents/AGENTS_CORE.md +10 -6
- package/assets/agents/long-task-implementation.toml +1 -1
- package/assets/skills/context_development_engineer/SKILL.md +9 -1
- package/assets/skills/design-resource-authoring/SKILL.md +7 -5
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +2 -2
- package/assets/skills/design-resource-authoring/references/open-design-provider.md +22 -2
- package/assets/skills/design-resource-authoring/references/recovery-and-writeback.md +199 -0
- package/assets/skills/design-resource-authoring/references/resource-selection.md +2 -2
- package/assets/skills/long-task-workflow/SKILL.md +14 -12
- package/assets/skills/long-task-workflow/agents/openai.yaml +1 -1
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +1 -1
- package/assets/skills/long-task-workflow/references/contract-authoring.md +27 -22
- package/assets/skills/long-task-workflow/references/evidence-design.md +49 -32
- package/assets/skills/long-task-workflow/references/source-authoring.md +2 -2
- package/dist/commands/design-resource-recovery.d.ts +1 -0
- package/dist/commands/design-resource-recovery.js +152 -0
- package/dist/commands/design-resource.js +20 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/long-task-revision.js +4 -4
- package/dist/lib/design-resource-reconciliation-codec.d.ts +2 -0
- package/dist/lib/design-resource-reconciliation-codec.js +174 -0
- package/dist/lib/design-resource-reconciliation-types.d.ts +62 -0
- package/dist/lib/design-resource-reconciliation-types.js +1 -0
- package/dist/lib/design-resource-reconciliation.d.ts +3 -0
- package/dist/lib/design-resource-reconciliation.js +224 -0
- package/dist/lib/design-resource-recovery-authority-policy.d.ts +8 -0
- package/dist/lib/design-resource-recovery-authority-policy.js +123 -0
- package/dist/lib/design-resource-recovery-catalog-resources.d.ts +6 -0
- package/dist/lib/design-resource-recovery-catalog-resources.js +121 -0
- package/dist/lib/design-resource-recovery-catalog-shape.d.ts +3 -0
- package/dist/lib/design-resource-recovery-catalog-shape.js +104 -0
- package/dist/lib/design-resource-recovery-catalog.d.ts +9 -0
- package/dist/lib/design-resource-recovery-catalog.js +103 -0
- package/dist/lib/design-resource-recovery-cleanup.d.ts +2 -0
- package/dist/lib/design-resource-recovery-cleanup.js +11 -0
- package/dist/lib/design-resource-recovery-codec-primitives.d.ts +19 -0
- package/dist/lib/design-resource-recovery-codec-primitives.js +92 -0
- package/dist/lib/design-resource-recovery-codec.d.ts +4 -0
- package/dist/lib/design-resource-recovery-codec.js +93 -0
- package/dist/lib/design-resource-recovery-current.d.ts +9 -0
- package/dist/lib/design-resource-recovery-current.js +41 -0
- package/dist/lib/design-resource-recovery-delta-policy.d.ts +5 -0
- package/dist/lib/design-resource-recovery-delta-policy.js +108 -0
- package/dist/lib/design-resource-recovery-files.d.ts +37 -0
- package/dist/lib/design-resource-recovery-files.js +204 -0
- package/dist/lib/design-resource-recovery-final-disposition-shape.d.ts +2 -0
- package/dist/lib/design-resource-recovery-final-disposition-shape.js +47 -0
- package/dist/lib/design-resource-recovery-patch-types.d.ts +54 -0
- package/dist/lib/design-resource-recovery-patch-types.js +1 -0
- package/dist/lib/design-resource-recovery-replay.d.ts +7 -0
- package/dist/lib/design-resource-recovery-replay.js +112 -0
- package/dist/lib/design-resource-recovery-repository-bindings.d.ts +9 -0
- package/dist/lib/design-resource-recovery-repository-bindings.js +49 -0
- package/dist/lib/design-resource-recovery-schema.d.ts +5 -0
- package/dist/lib/design-resource-recovery-schema.js +5 -0
- package/dist/lib/design-resource-recovery-shape.d.ts +10 -0
- package/dist/lib/design-resource-recovery-shape.js +184 -0
- package/dist/lib/design-resource-recovery-source-authority.d.ts +5 -0
- package/dist/lib/design-resource-recovery-source-authority.js +219 -0
- package/dist/lib/design-resource-recovery-text.d.ts +17 -0
- package/dist/lib/design-resource-recovery-text.js +186 -0
- package/dist/lib/design-resource-recovery-types.d.ts +197 -0
- package/dist/lib/design-resource-recovery-types.js +1 -0
- package/dist/lib/design-resource-recovery-writeback-policy.d.ts +5 -0
- package/dist/lib/design-resource-recovery-writeback-policy.js +326 -0
- package/dist/lib/design-resource-recovery-writeback-shape.d.ts +6 -0
- package/dist/lib/design-resource-recovery-writeback-shape.js +155 -0
- package/dist/lib/design-resource-recovery.d.ts +44 -0
- package/dist/lib/design-resource-recovery.js +216 -0
- package/dist/lib/long-task-acceptance-shape.js +8 -2
- package/dist/lib/long-task-activation-validation.js +13 -3
- package/dist/lib/long-task-admitted-observation-records.d.ts +25 -0
- package/dist/lib/long-task-admitted-observation-records.js +40 -0
- package/dist/lib/long-task-admitted-observation.d.ts +93 -0
- package/dist/lib/long-task-admitted-observation.js +201 -0
- package/dist/lib/long-task-artifacts.d.ts +1 -0
- package/dist/lib/long-task-artifacts.js +1 -0
- package/dist/lib/long-task-authority-material-diff.js +1 -0
- package/dist/lib/long-task-authority-policy.d.ts +2 -0
- package/dist/lib/long-task-authority-policy.js +2 -0
- package/dist/lib/long-task-authority-revision-brief.js +3 -1
- package/dist/lib/long-task-authority-revision-details.js +3 -1
- package/dist/lib/long-task-authority-revision-summary.js +6 -2
- package/dist/lib/long-task-authority-revision-types.d.ts +2 -0
- package/dist/lib/long-task-authority.js +2 -1
- package/dist/lib/long-task-check-execution-policy.js +5 -0
- package/dist/lib/long-task-check-runner.d.ts +2 -2
- package/dist/lib/long-task-check-runner.js +440 -23
- package/dist/lib/long-task-claims.d.ts +18 -0
- package/dist/lib/long-task-claims.js +35 -0
- package/dist/lib/long-task-compact-structure-targets.js +1 -0
- package/dist/lib/long-task-conformance-policy.js +3 -1
- package/dist/lib/long-task-counterfactual-claim-policy.d.ts +3 -4
- package/dist/lib/long-task-counterfactual-claim-policy.js +11 -3
- package/dist/lib/long-task-counterfactual-sandbox.js +1 -0
- package/dist/lib/long-task-counterfactual-types.d.ts +2 -0
- package/dist/lib/long-task-delivery-compiler.js +2 -0
- package/dist/lib/long-task-design-resource-method-binding.js +8 -2
- package/dist/lib/long-task-evidence-capability-policy.d.ts +3 -2
- package/dist/lib/long-task-evidence-capability-policy.js +114 -8
- package/dist/lib/long-task-evidence-capability-runtime.d.ts +5 -2
- package/dist/lib/long-task-evidence-capability-runtime.js +149 -5
- package/dist/lib/long-task-evidence-sensitivity-policy.d.ts +9 -0
- package/dist/lib/long-task-evidence-sensitivity-policy.js +31 -1
- package/dist/lib/long-task-evidence-v2.d.ts +4 -4
- package/dist/lib/long-task-evidence-v2.js +321 -43
- package/dist/lib/long-task-exact-comparison.d.ts +16 -0
- package/dist/lib/long-task-exact-comparison.js +28 -0
- package/dist/lib/long-task-execution-observation.d.ts +24 -0
- package/dist/lib/long-task-execution-observation.js +332 -0
- package/dist/lib/long-task-explain-acceptance-link.d.ts +4 -0
- package/dist/lib/long-task-explain-acceptance-link.js +4 -0
- package/dist/lib/long-task-explain-claim-links.d.ts +2 -0
- package/dist/lib/long-task-explain-claim-links.js +2 -0
- package/dist/lib/long-task-explain-source-links.d.ts +6 -0
- package/dist/lib/long-task-final-v2.js +7 -4
- package/dist/lib/long-task-git.d.ts +26 -0
- package/dist/lib/long-task-git.js +130 -0
- package/dist/lib/long-task-json-pointer-observation.d.ts +59 -0
- package/dist/lib/long-task-json-pointer-observation.js +184 -0
- package/dist/lib/long-task-observation-artifact.d.ts +8 -0
- package/dist/lib/long-task-observation-artifact.js +58 -0
- package/dist/lib/long-task-observation-authority.d.ts +17 -0
- package/dist/lib/long-task-observation-authority.js +348 -0
- package/dist/lib/long-task-paths.js +2 -2
- package/dist/lib/long-task-process-observation.d.ts +6 -0
- package/dist/lib/long-task-process-observation.js +117 -0
- package/dist/lib/long-task-process-runtime-closure.d.ts +13 -0
- package/dist/lib/long-task-process-runtime-closure.js +207 -0
- package/dist/lib/long-task-progress.js +2 -0
- package/dist/lib/long-task-protected-files.d.ts +1 -1
- package/dist/lib/long-task-protected-files.js +1 -30
- package/dist/lib/long-task-risk.js +8 -3
- package/dist/lib/long-task-root-shape.js +10 -1
- package/dist/lib/long-task-runner-environment.d.ts +1 -1
- package/dist/lib/long-task-runner-environment.js +4 -4
- package/dist/lib/long-task-runner-freeze.d.ts +4 -2
- package/dist/lib/long-task-runner-freeze.js +128 -28
- package/dist/lib/long-task-runtime-types.d.ts +111 -0
- package/dist/lib/long-task-scoped-binding.d.ts +13 -0
- package/dist/lib/long-task-scoped-binding.js +11 -0
- package/dist/lib/long-task-semantic-contract-types.d.ts +1 -0
- package/dist/lib/long-task-semantic-fact-contract-closure.js +3 -3
- package/dist/lib/long-task-semantic-fact-evidence.d.ts +3 -3
- package/dist/lib/long-task-semantic-fact-evidence.js +75 -58
- package/dist/lib/long-task-source-claim-validation.js +4 -1
- package/dist/lib/long-task-source-target-continuity.d.ts +2 -2
- package/dist/lib/long-task-source-target-continuity.js +35 -2
- package/dist/lib/long-task-source-target-index.d.ts +3 -0
- package/dist/lib/long-task-source-target-index.js +19 -0
- package/dist/lib/long-task-stage-policy.js +10 -4
- package/dist/lib/long-task-static-observation-freeze.d.ts +83 -0
- package/dist/lib/long-task-static-observation-freeze.js +428 -0
- package/dist/lib/long-task-status-projection.js +5 -1
- package/dist/lib/long-task-target-policy.d.ts +1 -1
- package/dist/lib/long-task-target-policy.js +3 -0
- package/dist/lib/long-task-verifier-authority.js +2 -0
- package/dist/lib/long-task-verifier-dependency-closure.js +7 -3
- package/dist/lib/long-task-verifier-v2.js +70 -9
- package/dist/lib/long-task-workspace-manifest.d.ts +8 -0
- package/dist/lib/long-task-workspace-manifest.js +173 -0
- package/dist/lib/long-task-workspace-snapshot.d.ts +8 -0
- package/dist/lib/long-task-workspace-snapshot.js +176 -0
- package/dist/lib/long-task-workspace.d.ts +5 -26
- package/dist/lib/long-task-workspace.js +4 -444
- package/dist/lib/repository-path-safety.d.ts +14 -0
- package/dist/lib/repository-path-safety.js +126 -0
- package/dist/long-task-hook.js +12 -3
- package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +53 -8
- package/migrations/README.md +77 -0
- package/package.json +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { parseDesignResourceRecoveryCreateInput } from "../lib/design-resource-recovery-codec.js";
|
|
2
|
+
import { readRecoveryRepositoryFile } from "../lib/design-resource-recovery-files.js";
|
|
3
|
+
import { applyDesignResourceRecoveryWriteback, createDesignResourceRecoveryCheckpoint, inspectDesignResourceRecovery, previewDesignResourceRecoveryWriteback, reconcileDesignResourceRecovery, removeDesignResourceRecoveryCheckpoint, updateDesignResourceRecoveryCheckpoint, } from "../lib/design-resource-recovery.js";
|
|
4
|
+
import { canonicalJson } from "../lib/strict-codec.js";
|
|
5
|
+
export async function designResourceRecoveryCommand(args) {
|
|
6
|
+
const [action, sessionId, ...rest] = args;
|
|
7
|
+
if (!action || !sessionId)
|
|
8
|
+
throw new Error("usage: ty-context design-resource recovery <create|update|inspect|preview|apply|reconcile|remove> <session> [options]");
|
|
9
|
+
const options = recoveryOptions(rest);
|
|
10
|
+
let result;
|
|
11
|
+
if (action === "create")
|
|
12
|
+
result = await create(process.cwd(), sessionId, options);
|
|
13
|
+
else if (action === "update")
|
|
14
|
+
result = await update(process.cwd(), sessionId, options);
|
|
15
|
+
else if (action === "inspect") {
|
|
16
|
+
assertNoValueOptions(options, action);
|
|
17
|
+
result = await inspectDesignResourceRecovery(process.cwd(), sessionId);
|
|
18
|
+
}
|
|
19
|
+
else if (action === "preview") {
|
|
20
|
+
assertNoValueOptions(options, action);
|
|
21
|
+
result = await previewDesignResourceRecoveryWriteback(process.cwd(), sessionId);
|
|
22
|
+
}
|
|
23
|
+
else if (action === "apply")
|
|
24
|
+
result = await apply(process.cwd(), sessionId, options);
|
|
25
|
+
else if (action === "reconcile")
|
|
26
|
+
result = await reconcile(process.cwd(), sessionId, options);
|
|
27
|
+
else if (action === "remove")
|
|
28
|
+
result = await remove(process.cwd(), sessionId, options);
|
|
29
|
+
else
|
|
30
|
+
throw new Error(`Unknown design-resource recovery action: ${action}`);
|
|
31
|
+
if (options.json)
|
|
32
|
+
process.stdout.write(canonicalJson(result));
|
|
33
|
+
else
|
|
34
|
+
printRecoveryResult(action, result);
|
|
35
|
+
if ((action === "apply" || action === "reconcile") &&
|
|
36
|
+
result.status === "blocked")
|
|
37
|
+
process.exitCode = 2;
|
|
38
|
+
if (action === "remove" &&
|
|
39
|
+
result.status === "partial")
|
|
40
|
+
process.exitCode = 2;
|
|
41
|
+
}
|
|
42
|
+
async function create(repository, sessionId, options) {
|
|
43
|
+
if (!options.input || options.audit || options.expectedSha256)
|
|
44
|
+
usage("create <session> --input <state.json>");
|
|
45
|
+
const input = await readCreateInput(repository, options.input);
|
|
46
|
+
if (input.session_id !== sessionId)
|
|
47
|
+
throw new Error("design_resource_recovery_invalid:create_session_identity_mismatch");
|
|
48
|
+
return createDesignResourceRecoveryCheckpoint(repository, input);
|
|
49
|
+
}
|
|
50
|
+
async function apply(repository, sessionId, options) {
|
|
51
|
+
if (!options.audit || options.input || options.expectedSha256)
|
|
52
|
+
usage("apply <session> --audit <audit.json>");
|
|
53
|
+
return applyDesignResourceRecoveryWriteback(repository, sessionId, options.audit);
|
|
54
|
+
}
|
|
55
|
+
async function reconcile(repository, sessionId, options) {
|
|
56
|
+
if (!options.audit || options.input || options.expectedSha256)
|
|
57
|
+
usage("reconcile <session> --audit <audit.json>");
|
|
58
|
+
return reconcileDesignResourceRecovery(repository, sessionId, options.audit);
|
|
59
|
+
}
|
|
60
|
+
async function update(repository, sessionId, options) {
|
|
61
|
+
if (!options.input || !options.expectedSha256 || options.audit)
|
|
62
|
+
usage("update <session> --input <state.json> --expected-sha256 <sha256>");
|
|
63
|
+
const input = await readCreateInput(repository, options.input);
|
|
64
|
+
if (input.session_id !== sessionId)
|
|
65
|
+
throw new Error("design_resource_recovery_invalid:update_session_identity_mismatch");
|
|
66
|
+
return updateDesignResourceRecoveryCheckpoint(repository, input, options.expectedSha256);
|
|
67
|
+
}
|
|
68
|
+
async function remove(repository, sessionId, options) {
|
|
69
|
+
if (!options.expectedSha256 || options.input || options.audit)
|
|
70
|
+
usage("remove <session> --expected-sha256 <sha256>");
|
|
71
|
+
return removeDesignResourceRecoveryCheckpoint(repository, sessionId, options.expectedSha256);
|
|
72
|
+
}
|
|
73
|
+
function recoveryOptions(args) {
|
|
74
|
+
const result = { json: false };
|
|
75
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
76
|
+
const item = args[index];
|
|
77
|
+
if (item === "--json") {
|
|
78
|
+
result.json = true;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const value = args[index + 1];
|
|
82
|
+
if (!value || value.startsWith("--"))
|
|
83
|
+
throw new Error(`${item} requires a value`);
|
|
84
|
+
if (item === "--input")
|
|
85
|
+
result.input = value;
|
|
86
|
+
else if (item === "--audit")
|
|
87
|
+
result.audit = value;
|
|
88
|
+
else if (item === "--expected-sha256")
|
|
89
|
+
result.expectedSha256 = value;
|
|
90
|
+
else
|
|
91
|
+
throw new Error(`Unknown design-resource recovery option: ${item}`);
|
|
92
|
+
index += 1;
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
function assertNoValueOptions(options, action) {
|
|
97
|
+
if (options.input || options.audit || options.expectedSha256)
|
|
98
|
+
usage(`${action} <session>`);
|
|
99
|
+
}
|
|
100
|
+
function usage(value) {
|
|
101
|
+
throw new Error(`usage: ty-context design-resource recovery ${value} [--json]`);
|
|
102
|
+
}
|
|
103
|
+
async function readCreateInput(repository, locator) {
|
|
104
|
+
const inputSnapshot = await readRecoveryRepositoryFile(repository, locator, "design_resource_recovery_create_input");
|
|
105
|
+
return parseDesignResourceRecoveryCreateInput(inputSnapshot.bytes.toString("utf8"));
|
|
106
|
+
}
|
|
107
|
+
function printRecoveryResult(action, result) {
|
|
108
|
+
const row = result;
|
|
109
|
+
if (action === "create" || action === "update") {
|
|
110
|
+
console.log(`DRA recovery checkpoint: ${row.status}`);
|
|
111
|
+
console.log(`Path: ${row.checkpoint_path}`);
|
|
112
|
+
console.log(`SHA-256: ${row.checkpoint_raw_byte_digest}`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (action === "inspect" || action === "preview") {
|
|
116
|
+
printInspection(row);
|
|
117
|
+
if (action === "preview")
|
|
118
|
+
printPatch(row);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (action === "apply") {
|
|
122
|
+
console.log(`DRA writeback: ${row.status}`);
|
|
123
|
+
console.log(`Write transaction: ${row.write_transaction}`);
|
|
124
|
+
console.log(`Reconciliation: ${JSON.stringify(row.reconciliation)}`);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (action === "reconcile") {
|
|
128
|
+
console.log(`DRA reconciliation: ${row.status}`);
|
|
129
|
+
console.log(`Write transaction: ${row.write_transaction}`);
|
|
130
|
+
console.log(`Reconciliation: ${JSON.stringify(row.reconciliation)}`);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
console.log(`DRA recovery cleanup: ${row.status}`);
|
|
134
|
+
console.log(`Path: ${row.path}`);
|
|
135
|
+
if (row.status === "partial")
|
|
136
|
+
console.log(`Retained: ${JSON.stringify(row.retained_entries)}`);
|
|
137
|
+
}
|
|
138
|
+
function printInspection(row) {
|
|
139
|
+
const replay = row.replay;
|
|
140
|
+
console.log(`Base: ${replay.base.locator}@${replay.base.raw_byte_digest}`);
|
|
141
|
+
console.log(`Delta: ${replay.ordered_active_accepted_deltas.length} accepted / ${replay.rejected_deltas.length} rejected / ${replay.unresolved_deltas.length} unresolved`);
|
|
142
|
+
console.log(`Explicitly unchanged: ${replay.explicitly_unchanged_keys.join(", ") || "none"}`);
|
|
143
|
+
console.log(`Writeback: ${JSON.stringify(row.writeback)}`);
|
|
144
|
+
}
|
|
145
|
+
function printPatch(row) {
|
|
146
|
+
const patch = row.patch;
|
|
147
|
+
for (const operation of patch.patch.operations) {
|
|
148
|
+
console.log(`Patch ${operation.operation_id} [${operation.target_key}]:`);
|
|
149
|
+
console.log(`- ${operation.before_text}`);
|
|
150
|
+
console.log(`+ ${operation.after_text}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { publishDesignResourceHandoffBundle } from "../lib/design-resource-handoff-bundle.js";
|
|
2
2
|
import { preflightDesignResourceHandoff } from "../lib/design-resource-handoff-validation.js";
|
|
3
|
+
import { designResourceRecoveryCommand } from "./design-resource-recovery.js";
|
|
3
4
|
import { normalizeRepositoryCwd, normalizeRepositoryFile, } from "../lib/long-task-paths.js";
|
|
4
5
|
import { canonicalJson } from "../lib/strict-codec.js";
|
|
5
6
|
export async function designResource(args) {
|
|
@@ -12,6 +13,10 @@ export async function designResource(args) {
|
|
|
12
13
|
await bundle(rest);
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
16
|
+
if (subcommand === "recovery") {
|
|
17
|
+
await designResourceRecoveryCommand(rest);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
15
20
|
if (subcommand !== "preflight")
|
|
16
21
|
throw new Error(`Unknown design-resource subcommand: ${subcommand}`);
|
|
17
22
|
const json = rest.includes("--json");
|
|
@@ -95,5 +100,19 @@ function help() {
|
|
|
95
100
|
--max-handoff-bytes <bytes> [--json]
|
|
96
101
|
Validate manifest-backed one-target handoffs and
|
|
97
102
|
atomically publish the complete target set; the
|
|
98
|
-
output parent directory must already exist
|
|
103
|
+
output parent directory must already exist
|
|
104
|
+
recovery create <session> --input <state.json> [--json]
|
|
105
|
+
Create one explicit ignored task-local checkpoint
|
|
106
|
+
recovery update <session> --input <state.json> --expected-sha256 <sha256> [--json]
|
|
107
|
+
CAS-replace one existing task-local checkpoint
|
|
108
|
+
recovery inspect <session> [--json]
|
|
109
|
+
Revalidate Base and derive replay/CAS state
|
|
110
|
+
recovery preview <session> [--json]
|
|
111
|
+
Show the frozen exact writeback patch without writing
|
|
112
|
+
recovery apply <session> --audit <audit.json> [--json]
|
|
113
|
+
CAS-apply and reread only after fresh balanced audit
|
|
114
|
+
recovery reconcile <session> --audit <audit.json> [--json]
|
|
115
|
+
Read-only reconciliation for a no-writeback checkpoint
|
|
116
|
+
recovery remove <session> --expected-sha256 <sha256> [--json]
|
|
117
|
+
Remove only the digest-matched helper-owned checkpoint`);
|
|
99
118
|
}
|
package/dist/commands/index.js
CHANGED
|
@@ -55,7 +55,7 @@ export function help() {
|
|
|
55
55
|
Enforce touched handwritten source file modularity
|
|
56
56
|
validate-harness Run validate-context and validate-code-modularity
|
|
57
57
|
design-resource <subcommand>
|
|
58
|
-
Validate
|
|
58
|
+
Validate handoffs or operate explicit DRA recovery
|
|
59
59
|
long-task <subcommand>
|
|
60
60
|
Manage one Canonical Delivery Contract in the current workspace
|
|
61
61
|
delivery-set <subcommand>
|
|
@@ -90,7 +90,7 @@ function printCompileResult(compiled, previous, preserveProgress, revisionPropos
|
|
|
90
90
|
? projectAuthorityRevisionDecision(revisionProposal)
|
|
91
91
|
: null,
|
|
92
92
|
next_action: firstAuthorityLock
|
|
93
|
-
? "End this turn now. Do not implement, edit files, build, or test. After the user handles the model change in the host,
|
|
93
|
+
? "End this turn now. Do not implement, edit files, build, or test. After the user handles the model change in the host, ask them to reply exactly: model checkpoint cleared, continue. This is package-managed prompt guidance; Harness cannot observe the next host message or verify the model change."
|
|
94
94
|
: authorityChanged
|
|
95
95
|
? "Run status or resume, then continue rolling implementation or repair under the adopted Authority Revision."
|
|
96
96
|
: "Continue rolling implementation or repair under the active Authority.",
|
|
@@ -158,7 +158,7 @@ function executionModelCheckpoint(firstAuthorityLock) {
|
|
|
158
158
|
required: true,
|
|
159
159
|
phase: "post_authority_lock_pre_implementation",
|
|
160
160
|
action: "change_model_in_host_then_continue",
|
|
161
|
-
resume_token: "continue",
|
|
161
|
+
resume_token: "model checkpoint cleared, continue",
|
|
162
162
|
turn_boundary: "end_current_turn",
|
|
163
163
|
blocked_until_resume: [
|
|
164
164
|
"product_implementation",
|
|
@@ -168,8 +168,8 @@ function executionModelCheckpoint(firstAuthorityLock) {
|
|
|
168
168
|
],
|
|
169
169
|
model_change_owner: "host_or_user",
|
|
170
170
|
model_change_observable_by_harness: false,
|
|
171
|
-
generic_continue_satisfies:
|
|
172
|
-
message: "Authority Lock created. End the current turn before product implementation, file edits, builds, or tests. After handling the model change,
|
|
171
|
+
generic_continue_satisfies: false,
|
|
172
|
+
message: "Authority Lock created. End the current turn before product implementation, file edits, builds, or tests. After handling the model change, reply exactly: model checkpoint cleared, continue. This is package-managed prompt guidance; Harness cannot observe the next host message or verify the model change.",
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
175
|
function message(error) {
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_RECOVERY_AUDIT_SCHEMA } from "./design-resource-recovery-schema.js";
|
|
2
|
+
import { arrayOf, digest, literal, object, oneOf, optionalArrayOf, parseStrictJsonObject, stringSet, text, } from "./design-resource-recovery-codec-primitives.js";
|
|
3
|
+
import { parseAuthorityIdentity, parseDecisionAuthority, } from "./design-resource-recovery-shape.js";
|
|
4
|
+
import { parseDesignResourceFinalDisposition } from "./design-resource-recovery-final-disposition-shape.js";
|
|
5
|
+
const ORIGINS = [
|
|
6
|
+
"user-direct",
|
|
7
|
+
"necessary-derived",
|
|
8
|
+
"repository-evidence-backed",
|
|
9
|
+
"provider-suggested",
|
|
10
|
+
];
|
|
11
|
+
const STATUSES = ["accepted", "rejected", "unresolved"];
|
|
12
|
+
const SEMANTIC_KINDS = [
|
|
13
|
+
"exact-visual",
|
|
14
|
+
"product",
|
|
15
|
+
"business",
|
|
16
|
+
"permission",
|
|
17
|
+
"data",
|
|
18
|
+
"algorithm",
|
|
19
|
+
"commercial",
|
|
20
|
+
"safety-security",
|
|
21
|
+
"technical",
|
|
22
|
+
];
|
|
23
|
+
export function parseDesignResourceReconciliationAudit(content) {
|
|
24
|
+
const row = object(parseStrictJsonObject(content, "reconciliation_audit"), "reconciliation_audit", [
|
|
25
|
+
"schema_version",
|
|
26
|
+
"session_id",
|
|
27
|
+
"base_raw_byte_digest",
|
|
28
|
+
"design_authority",
|
|
29
|
+
"provider_run",
|
|
30
|
+
"resource_identities",
|
|
31
|
+
"accepted_delta_ids",
|
|
32
|
+
"rejected_delta_ids",
|
|
33
|
+
"unresolved_delta_ids",
|
|
34
|
+
"changed_keys",
|
|
35
|
+
"explicitly_unchanged",
|
|
36
|
+
"requirements_to_resource",
|
|
37
|
+
"resource_to_requirements",
|
|
38
|
+
"unexpected_blast_radius",
|
|
39
|
+
"inactive_delta_leakage",
|
|
40
|
+
], ["writeback_target_raw_byte_digest"]);
|
|
41
|
+
literal(row.schema_version, DESIGN_RESOURCE_RECOVERY_AUDIT_SCHEMA, "reconciliation_audit.schema_version");
|
|
42
|
+
return {
|
|
43
|
+
schema_version: DESIGN_RESOURCE_RECOVERY_AUDIT_SCHEMA,
|
|
44
|
+
session_id: text(row.session_id, "reconciliation_audit.session_id"),
|
|
45
|
+
base_raw_byte_digest: digest(row.base_raw_byte_digest, "reconciliation_audit.base_raw_byte_digest"),
|
|
46
|
+
design_authority: parseAuthorityIdentity(row.design_authority, "reconciliation_audit.design_authority"),
|
|
47
|
+
provider_run: parseProviderRun(row.provider_run),
|
|
48
|
+
resource_identities: optionalArrayOf(row.resource_identities, "reconciliation_audit.resource_identities", parseResourceIdentity),
|
|
49
|
+
...(row.writeback_target_raw_byte_digest === undefined
|
|
50
|
+
? {}
|
|
51
|
+
: {
|
|
52
|
+
writeback_target_raw_byte_digest: digest(row.writeback_target_raw_byte_digest, "reconciliation_audit.writeback_target_raw_byte_digest"),
|
|
53
|
+
}),
|
|
54
|
+
accepted_delta_ids: stringSet(row.accepted_delta_ids, "reconciliation_audit.accepted_delta_ids", { allowEmpty: true }),
|
|
55
|
+
rejected_delta_ids: stringSet(row.rejected_delta_ids, "reconciliation_audit.rejected_delta_ids", { allowEmpty: true }),
|
|
56
|
+
unresolved_delta_ids: stringSet(row.unresolved_delta_ids, "reconciliation_audit.unresolved_delta_ids", { allowEmpty: true }),
|
|
57
|
+
changed_keys: stringSet(row.changed_keys, "reconciliation_audit.changed_keys", { allowEmpty: true }),
|
|
58
|
+
explicitly_unchanged: optionalArrayOf(row.explicitly_unchanged, "reconciliation_audit.explicitly_unchanged", parseUnchanged),
|
|
59
|
+
requirements_to_resource: optionalArrayOf(row.requirements_to_resource, "reconciliation_audit.requirements_to_resource", parseRequirementFinding),
|
|
60
|
+
resource_to_requirements: optionalArrayOf(row.resource_to_requirements, "reconciliation_audit.resource_to_requirements", parseResourceFinding),
|
|
61
|
+
unexpected_blast_radius: optionalArrayOf(row.unexpected_blast_radius, "reconciliation_audit.unexpected_blast_radius", parseBlastFinding),
|
|
62
|
+
inactive_delta_leakage: optionalArrayOf(row.inactive_delta_leakage, "reconciliation_audit.inactive_delta_leakage", parseLeakage),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function parseProviderRun(value) {
|
|
66
|
+
const row = object(value, "reconciliation_audit.provider_run", [
|
|
67
|
+
"key",
|
|
68
|
+
"locator",
|
|
69
|
+
"immutable_identity",
|
|
70
|
+
]);
|
|
71
|
+
return {
|
|
72
|
+
key: text(row.key, "provider_run.key"),
|
|
73
|
+
locator: text(row.locator, "provider_run.locator"),
|
|
74
|
+
immutable_identity: text(row.immutable_identity, "provider_run.immutable_identity"),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function parseResourceIdentity(value, label) {
|
|
78
|
+
const row = object(value, label, ["key", "raw_byte_digest"]);
|
|
79
|
+
return {
|
|
80
|
+
key: text(row.key, `${label}.key`),
|
|
81
|
+
raw_byte_digest: digest(row.raw_byte_digest, `${label}.raw_byte_digest`),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function parseUnchanged(value, label) {
|
|
85
|
+
const row = object(value, label, [
|
|
86
|
+
"key",
|
|
87
|
+
"verdict",
|
|
88
|
+
"resource_refs",
|
|
89
|
+
"condition_refs",
|
|
90
|
+
"basis_source_refs",
|
|
91
|
+
]);
|
|
92
|
+
return {
|
|
93
|
+
key: text(row.key, `${label}.key`),
|
|
94
|
+
verdict: oneOf(row.verdict, ["preserved", "changed", "unresolved"], `${label}.verdict`),
|
|
95
|
+
resource_refs: stringSet(row.resource_refs, `${label}.resource_refs`),
|
|
96
|
+
condition_refs: stringSet(row.condition_refs, `${label}.condition_refs`),
|
|
97
|
+
basis_source_refs: stringSet(row.basis_source_refs, `${label}.basis_source_refs`),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function parseRequirementFinding(value, label) {
|
|
101
|
+
const row = object(value, label, [
|
|
102
|
+
"key",
|
|
103
|
+
"verdict",
|
|
104
|
+
"delta_ids",
|
|
105
|
+
"resource_refs",
|
|
106
|
+
"condition_refs",
|
|
107
|
+
]);
|
|
108
|
+
return {
|
|
109
|
+
key: text(row.key, `${label}.key`),
|
|
110
|
+
verdict: oneOf(row.verdict, ["covered", "missing", "distorted", "unsupported", "unresolved"], `${label}.verdict`),
|
|
111
|
+
delta_ids: stringSet(row.delta_ids, `${label}.delta_ids`),
|
|
112
|
+
resource_refs: stringSet(row.resource_refs, `${label}.resource_refs`),
|
|
113
|
+
condition_refs: stringSet(row.condition_refs, `${label}.condition_refs`),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function parseResourceFinding(value, label) {
|
|
117
|
+
const row = object(value, label, [
|
|
118
|
+
"key",
|
|
119
|
+
"resource_ref",
|
|
120
|
+
"status",
|
|
121
|
+
"semantic_kind",
|
|
122
|
+
"delta_ids",
|
|
123
|
+
"condition_refs",
|
|
124
|
+
"requirement_bindings",
|
|
125
|
+
]);
|
|
126
|
+
return {
|
|
127
|
+
key: text(row.key, `${label}.key`),
|
|
128
|
+
resource_ref: text(row.resource_ref, `${label}.resource_ref`),
|
|
129
|
+
status: oneOf(row.status, STATUSES, `${label}.status`),
|
|
130
|
+
semantic_kind: oneOf(row.semantic_kind, SEMANTIC_KINDS, `${label}.semantic_kind`),
|
|
131
|
+
delta_ids: stringSet(row.delta_ids, `${label}.delta_ids`),
|
|
132
|
+
condition_refs: stringSet(row.condition_refs, `${label}.condition_refs`),
|
|
133
|
+
requirement_bindings: arrayOf(row.requirement_bindings, `${label}.requirement_bindings`, parseRequirementBinding),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function parseRequirementBinding(value, label) {
|
|
137
|
+
const row = object(value, label, [
|
|
138
|
+
"binding_id",
|
|
139
|
+
"requirement_key",
|
|
140
|
+
"delta_id",
|
|
141
|
+
"origin",
|
|
142
|
+
"decision_authority",
|
|
143
|
+
"source_refs",
|
|
144
|
+
"final_disposition",
|
|
145
|
+
]);
|
|
146
|
+
return {
|
|
147
|
+
binding_id: text(row.binding_id, `${label}.binding_id`),
|
|
148
|
+
requirement_key: text(row.requirement_key, `${label}.requirement_key`),
|
|
149
|
+
delta_id: text(row.delta_id, `${label}.delta_id`),
|
|
150
|
+
origin: oneOf(row.origin, ORIGINS, `${label}.origin`),
|
|
151
|
+
decision_authority: parseDecisionAuthority(row.decision_authority, `${label}.decision_authority`),
|
|
152
|
+
source_refs: stringSet(row.source_refs, `${label}.source_refs`, {
|
|
153
|
+
allowEmpty: true,
|
|
154
|
+
}),
|
|
155
|
+
final_disposition: parseDesignResourceFinalDisposition(row.final_disposition, `${label}.final_disposition`),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function parseBlastFinding(value, label) {
|
|
159
|
+
const row = object(value, label, ["key", "verdict"]);
|
|
160
|
+
return {
|
|
161
|
+
key: text(row.key, `${label}.key`),
|
|
162
|
+
verdict: oneOf(row.verdict, ["expected", "unexpected", "unresolved"], `${label}.verdict`),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function parseLeakage(value, label) {
|
|
166
|
+
const row = object(value, label, ["delta_id", "inactive_reason", "leaked"]);
|
|
167
|
+
if (typeof row.leaked !== "boolean")
|
|
168
|
+
throw new Error(`design_resource_recovery_invalid:${label}.leaked:boolean_required`);
|
|
169
|
+
return {
|
|
170
|
+
delta_id: text(row.delta_id, `${label}.delta_id`),
|
|
171
|
+
inactive_reason: oneOf(row.inactive_reason, ["rejected", "unresolved", "superseded"], `${label}.inactive_reason`),
|
|
172
|
+
leaked: row.leaked,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_RECOVERY_AUDIT_SCHEMA } from "./design-resource-recovery-schema.js";
|
|
2
|
+
import type { DesignResourceAuthorityIdentity, DesignResourceDecisionAuthority, DesignResourceDecisionOrigin, DesignResourceDecisionStatus, DesignResourceFinalDisposition, DesignResourceProviderIdentity, DesignResourceSemanticKind } from "./design-resource-recovery-types.js";
|
|
3
|
+
export interface DesignResourceReconciliationAudit {
|
|
4
|
+
schema_version: typeof DESIGN_RESOURCE_RECOVERY_AUDIT_SCHEMA;
|
|
5
|
+
session_id: string;
|
|
6
|
+
base_raw_byte_digest: string;
|
|
7
|
+
design_authority: DesignResourceAuthorityIdentity;
|
|
8
|
+
provider_run: DesignResourceProviderIdentity;
|
|
9
|
+
resource_identities: Array<{
|
|
10
|
+
key: string;
|
|
11
|
+
raw_byte_digest: string;
|
|
12
|
+
}>;
|
|
13
|
+
writeback_target_raw_byte_digest?: string;
|
|
14
|
+
accepted_delta_ids: string[];
|
|
15
|
+
rejected_delta_ids: string[];
|
|
16
|
+
unresolved_delta_ids: string[];
|
|
17
|
+
changed_keys: string[];
|
|
18
|
+
explicitly_unchanged: Array<{
|
|
19
|
+
key: string;
|
|
20
|
+
verdict: "preserved" | "changed" | "unresolved";
|
|
21
|
+
resource_refs: string[];
|
|
22
|
+
condition_refs: string[];
|
|
23
|
+
basis_source_refs: string[];
|
|
24
|
+
}>;
|
|
25
|
+
requirements_to_resource: Array<{
|
|
26
|
+
key: string;
|
|
27
|
+
verdict: "covered" | "missing" | "distorted" | "unsupported" | "unresolved";
|
|
28
|
+
delta_ids: string[];
|
|
29
|
+
resource_refs: string[];
|
|
30
|
+
condition_refs: string[];
|
|
31
|
+
}>;
|
|
32
|
+
resource_to_requirements: Array<{
|
|
33
|
+
key: string;
|
|
34
|
+
resource_ref: string;
|
|
35
|
+
status: DesignResourceDecisionStatus;
|
|
36
|
+
semantic_kind: DesignResourceSemanticKind;
|
|
37
|
+
delta_ids: string[];
|
|
38
|
+
condition_refs: string[];
|
|
39
|
+
requirement_bindings: Array<{
|
|
40
|
+
binding_id: string;
|
|
41
|
+
requirement_key: string;
|
|
42
|
+
delta_id: string;
|
|
43
|
+
origin: DesignResourceDecisionOrigin;
|
|
44
|
+
decision_authority: DesignResourceDecisionAuthority;
|
|
45
|
+
source_refs: string[];
|
|
46
|
+
final_disposition: DesignResourceFinalDisposition;
|
|
47
|
+
}>;
|
|
48
|
+
}>;
|
|
49
|
+
unexpected_blast_radius: Array<{
|
|
50
|
+
key: string;
|
|
51
|
+
verdict: "expected" | "unexpected" | "unresolved";
|
|
52
|
+
}>;
|
|
53
|
+
inactive_delta_leakage: Array<{
|
|
54
|
+
delta_id: string;
|
|
55
|
+
inactive_reason: "rejected" | "unresolved" | "superseded";
|
|
56
|
+
leaked: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
}
|
|
59
|
+
export interface DesignResourceReconciliationResult {
|
|
60
|
+
status: "reconciliation-balanced" | "blocked";
|
|
61
|
+
findings: string[];
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DesignResourceRecoveryCheckpoint } from "./design-resource-recovery-types.js";
|
|
2
|
+
import type { DesignResourceReconciliationAudit, DesignResourceReconciliationResult } from "./design-resource-reconciliation-types.js";
|
|
3
|
+
export declare function reconcileDesignResourceWriteback(checkpoint: DesignResourceRecoveryCheckpoint, audit: DesignResourceReconciliationAudit): DesignResourceReconciliationResult;
|