@skillcap/gdh 0.23.0 → 0.24.0

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 (128) hide show
  1. package/INSTALL-BUNDLE.json +1 -1
  2. package/RELEASE-SPAN-UPDATE-CONTRACTS.json +64 -0
  3. package/node_modules/@gdh/adapters/dist/authoring-hook-render.d.ts.map +1 -1
  4. package/node_modules/@gdh/adapters/dist/authoring-hook-render.js +2 -1
  5. package/node_modules/@gdh/adapters/dist/authoring-hook-render.js.map +1 -1
  6. package/node_modules/@gdh/adapters/dist/claude-statusline-render.d.ts.map +1 -1
  7. package/node_modules/@gdh/adapters/dist/claude-statusline-render.js +2 -1
  8. package/node_modules/@gdh/adapters/dist/claude-statusline-render.js.map +1 -1
  9. package/node_modules/@gdh/adapters/dist/claude-update-hook-render.d.ts.map +1 -1
  10. package/node_modules/@gdh/adapters/dist/claude-update-hook-render.js +2 -1
  11. package/node_modules/@gdh/adapters/dist/claude-update-hook-render.js.map +1 -1
  12. package/node_modules/@gdh/adapters/dist/claude-update-worker-render.d.ts.map +1 -1
  13. package/node_modules/@gdh/adapters/dist/claude-update-worker-render.js +2 -1
  14. package/node_modules/@gdh/adapters/dist/claude-update-worker-render.js.map +1 -1
  15. package/node_modules/@gdh/adapters/dist/deferred-actions-advisory.d.ts +71 -0
  16. package/node_modules/@gdh/adapters/dist/deferred-actions-advisory.d.ts.map +1 -0
  17. package/node_modules/@gdh/adapters/dist/deferred-actions-advisory.js +89 -0
  18. package/node_modules/@gdh/adapters/dist/deferred-actions-advisory.js.map +1 -0
  19. package/node_modules/@gdh/adapters/dist/durable-backup.d.ts +209 -0
  20. package/node_modules/@gdh/adapters/dist/durable-backup.d.ts.map +1 -0
  21. package/node_modules/@gdh/adapters/dist/durable-backup.js +346 -0
  22. package/node_modules/@gdh/adapters/dist/durable-backup.js.map +1 -0
  23. package/node_modules/@gdh/adapters/dist/index.d.ts +10 -1
  24. package/node_modules/@gdh/adapters/dist/index.d.ts.map +1 -1
  25. package/node_modules/@gdh/adapters/dist/index.js +24 -2
  26. package/node_modules/@gdh/adapters/dist/index.js.map +1 -1
  27. package/node_modules/@gdh/adapters/dist/inventory-sweep.d.ts +53 -0
  28. package/node_modules/@gdh/adapters/dist/inventory-sweep.d.ts.map +1 -0
  29. package/node_modules/@gdh/adapters/dist/inventory-sweep.js +98 -0
  30. package/node_modules/@gdh/adapters/dist/inventory-sweep.js.map +1 -0
  31. package/node_modules/@gdh/adapters/dist/process-orchestration.d.ts +223 -0
  32. package/node_modules/@gdh/adapters/dist/process-orchestration.d.ts.map +1 -0
  33. package/node_modules/@gdh/adapters/dist/process-orchestration.js +368 -0
  34. package/node_modules/@gdh/adapters/dist/process-orchestration.js.map +1 -0
  35. package/node_modules/@gdh/adapters/dist/self-update-mechanics.d.ts +157 -14
  36. package/node_modules/@gdh/adapters/dist/self-update-mechanics.d.ts.map +1 -1
  37. package/node_modules/@gdh/adapters/dist/self-update-mechanics.js +570 -89
  38. package/node_modules/@gdh/adapters/dist/self-update-mechanics.js.map +1 -1
  39. package/node_modules/@gdh/adapters/dist/skill-rendering.d.ts.map +1 -1
  40. package/node_modules/@gdh/adapters/dist/skill-rendering.js +25 -0
  41. package/node_modules/@gdh/adapters/dist/skill-rendering.js.map +1 -1
  42. package/node_modules/@gdh/adapters/package.json +8 -8
  43. package/node_modules/@gdh/authoring/package.json +2 -2
  44. package/node_modules/@gdh/cli/dist/index.d.ts +9 -0
  45. package/node_modules/@gdh/cli/dist/index.d.ts.map +1 -1
  46. package/node_modules/@gdh/cli/dist/index.js +244 -2
  47. package/node_modules/@gdh/cli/dist/index.js.map +1 -1
  48. package/node_modules/@gdh/cli/dist/migrate.d.ts +152 -1
  49. package/node_modules/@gdh/cli/dist/migrate.d.ts.map +1 -1
  50. package/node_modules/@gdh/cli/dist/migrate.js +290 -6
  51. package/node_modules/@gdh/cli/dist/migrate.js.map +1 -1
  52. package/node_modules/@gdh/cli/dist/self-update.d.ts +14 -0
  53. package/node_modules/@gdh/cli/dist/self-update.d.ts.map +1 -1
  54. package/node_modules/@gdh/cli/dist/self-update.js +197 -15
  55. package/node_modules/@gdh/cli/dist/self-update.js.map +1 -1
  56. package/node_modules/@gdh/cli/package.json +10 -10
  57. package/node_modules/@gdh/core/dist/index.d.ts +97 -5
  58. package/node_modules/@gdh/core/dist/index.d.ts.map +1 -1
  59. package/node_modules/@gdh/core/dist/index.js +23 -5
  60. package/node_modules/@gdh/core/dist/index.js.map +1 -1
  61. package/node_modules/@gdh/core/dist/migrations/entries/s2c2_to_s2c3_rules_schema_v2_to_v3.d.ts +3 -0
  62. package/node_modules/@gdh/core/dist/migrations/entries/s2c2_to_s2c3_rules_schema_v2_to_v3.d.ts.map +1 -0
  63. package/node_modules/@gdh/core/dist/migrations/entries/s2c2_to_s2c3_rules_schema_v2_to_v3.js +247 -0
  64. package/node_modules/@gdh/core/dist/migrations/entries/s2c2_to_s2c3_rules_schema_v2_to_v3.js.map +1 -0
  65. package/node_modules/@gdh/core/dist/migrations/entries/s3c8_to_s3c9_register_runtime_bridge_autoload.d.ts +3 -0
  66. package/node_modules/@gdh/core/dist/migrations/entries/s3c8_to_s3c9_register_runtime_bridge_autoload.d.ts.map +1 -0
  67. package/node_modules/@gdh/core/dist/migrations/entries/s3c8_to_s3c9_register_runtime_bridge_autoload.js +152 -0
  68. package/node_modules/@gdh/core/dist/migrations/entries/s3c8_to_s3c9_register_runtime_bridge_autoload.js.map +1 -0
  69. package/node_modules/@gdh/core/dist/migrations/envelopes/envelope-output-validator.d.ts +3 -0
  70. package/node_modules/@gdh/core/dist/migrations/envelopes/envelope-output-validator.d.ts.map +1 -0
  71. package/node_modules/@gdh/core/dist/migrations/envelopes/envelope-output-validator.js +67 -0
  72. package/node_modules/@gdh/core/dist/migrations/envelopes/envelope-output-validator.js.map +1 -0
  73. package/node_modules/@gdh/core/dist/migrations/envelopes/index.d.ts +37 -0
  74. package/node_modules/@gdh/core/dist/migrations/envelopes/index.d.ts.map +1 -0
  75. package/node_modules/@gdh/core/dist/migrations/envelopes/index.js +60 -0
  76. package/node_modules/@gdh/core/dist/migrations/envelopes/index.js.map +1 -0
  77. package/node_modules/@gdh/core/dist/migrations/envelopes/types.d.ts +121 -0
  78. package/node_modules/@gdh/core/dist/migrations/envelopes/types.d.ts.map +1 -0
  79. package/node_modules/@gdh/core/dist/migrations/envelopes/types.js +2 -0
  80. package/node_modules/@gdh/core/dist/migrations/envelopes/types.js.map +1 -0
  81. package/node_modules/@gdh/core/dist/migrations/golden-harness.d.ts +40 -0
  82. package/node_modules/@gdh/core/dist/migrations/golden-harness.d.ts.map +1 -0
  83. package/node_modules/@gdh/core/dist/migrations/golden-harness.js +71 -0
  84. package/node_modules/@gdh/core/dist/migrations/golden-harness.js.map +1 -0
  85. package/node_modules/@gdh/core/dist/migrations/managed-surface-classes.d.ts +322 -0
  86. package/node_modules/@gdh/core/dist/migrations/managed-surface-classes.d.ts.map +1 -0
  87. package/node_modules/@gdh/core/dist/migrations/managed-surface-classes.js +384 -0
  88. package/node_modules/@gdh/core/dist/migrations/managed-surface-classes.js.map +1 -0
  89. package/node_modules/@gdh/core/dist/migrations/probes.d.ts +58 -0
  90. package/node_modules/@gdh/core/dist/migrations/probes.d.ts.map +1 -0
  91. package/node_modules/@gdh/core/dist/migrations/probes.js +112 -0
  92. package/node_modules/@gdh/core/dist/migrations/probes.js.map +1 -0
  93. package/node_modules/@gdh/core/dist/migrations/registry.d.ts +205 -0
  94. package/node_modules/@gdh/core/dist/migrations/registry.d.ts.map +1 -0
  95. package/node_modules/@gdh/core/dist/migrations/registry.js +214 -0
  96. package/node_modules/@gdh/core/dist/migrations/registry.js.map +1 -0
  97. package/node_modules/@gdh/core/dist/state/atomic-write.d.ts +19 -0
  98. package/node_modules/@gdh/core/dist/state/atomic-write.d.ts.map +1 -0
  99. package/node_modules/@gdh/core/dist/state/atomic-write.js +34 -0
  100. package/node_modules/@gdh/core/dist/state/atomic-write.js.map +1 -0
  101. package/node_modules/@gdh/core/dist/state/migration-state.d.ts +135 -0
  102. package/node_modules/@gdh/core/dist/state/migration-state.d.ts.map +1 -0
  103. package/node_modules/@gdh/core/dist/state/migration-state.js +186 -0
  104. package/node_modules/@gdh/core/dist/state/migration-state.js.map +1 -0
  105. package/node_modules/@gdh/core/dist/state/processes-snapshot.d.ts +72 -0
  106. package/node_modules/@gdh/core/dist/state/processes-snapshot.d.ts.map +1 -0
  107. package/node_modules/@gdh/core/dist/state/processes-snapshot.js +113 -0
  108. package/node_modules/@gdh/core/dist/state/processes-snapshot.js.map +1 -0
  109. package/node_modules/@gdh/core/dist/state/render-inventory.d.ts +54 -0
  110. package/node_modules/@gdh/core/dist/state/render-inventory.d.ts.map +1 -0
  111. package/node_modules/@gdh/core/dist/state/render-inventory.js +77 -0
  112. package/node_modules/@gdh/core/dist/state/render-inventory.js.map +1 -0
  113. package/node_modules/@gdh/core/package.json +1 -1
  114. package/node_modules/@gdh/docs/dist/agent-contract.d.ts.map +1 -1
  115. package/node_modules/@gdh/docs/dist/agent-contract.js +2 -1
  116. package/node_modules/@gdh/docs/dist/agent-contract.js.map +1 -1
  117. package/node_modules/@gdh/docs/dist/guidance.d.ts.map +1 -1
  118. package/node_modules/@gdh/docs/dist/guidance.js +3 -1
  119. package/node_modules/@gdh/docs/dist/guidance.js.map +1 -1
  120. package/node_modules/@gdh/docs/package.json +2 -2
  121. package/node_modules/@gdh/mcp/package.json +8 -8
  122. package/node_modules/@gdh/observability/package.json +2 -2
  123. package/node_modules/@gdh/runtime/dist/bridge-surface.js +63 -2
  124. package/node_modules/@gdh/runtime/dist/bridge-surface.js.map +1 -1
  125. package/node_modules/@gdh/runtime/package.json +2 -2
  126. package/node_modules/@gdh/scan/package.json +3 -3
  127. package/node_modules/@gdh/verify/package.json +7 -7
  128. package/package.json +11 -11
@@ -0,0 +1,186 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { writeFileAtomic } from "./atomic-write.js";
4
+ import { isEnvelopeOutput } from "../migrations/envelopes/envelope-output-validator.js";
5
+ /**
6
+ * Path of the GDH migration-state envelope (D-12 / D-15 / D-16).
7
+ *
8
+ * Holds the post-rebake `last_applied_at` provenance and a typed
9
+ * `deferred_actions` list. Closed-kind `verify.kind` enum + structured
10
+ * `verify.payload` (no shell strings) eliminates the shell-injection
11
+ * surface called out in T-72-05-01.
12
+ */
13
+ export const MIGRATION_STATE_RELATIVE_PATH = ".gdh-state/migration.json";
14
+ const KNOWN_VERIFY_KINDS = [
15
+ "agent_skill_metadata_reload",
16
+ "process_restart",
17
+ ];
18
+ const KNOWN_STATUSES = [
19
+ "pending",
20
+ "clean",
21
+ "stale",
22
+ ];
23
+ function isVerify(value) {
24
+ if (typeof value !== "object" || value === null)
25
+ return false;
26
+ const v = value;
27
+ if (!KNOWN_VERIFY_KINDS.includes(v["kind"])) {
28
+ return false;
29
+ }
30
+ const payload = v["payload"];
31
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+ function isDeferredAction(value) {
37
+ if (typeof value !== "object" || value === null)
38
+ return false;
39
+ const v = value;
40
+ if (typeof v["id"] !== "string")
41
+ return false;
42
+ if (typeof v["description"] !== "string")
43
+ return false;
44
+ if (!isVerify(v["verify"]))
45
+ return false;
46
+ if (!KNOWN_STATUSES.includes(v["status"])) {
47
+ return false;
48
+ }
49
+ if (v["last_checked_at"] !== undefined &&
50
+ typeof v["last_checked_at"] !== "string") {
51
+ return false;
52
+ }
53
+ return true;
54
+ }
55
+ function isAppliedAt(value) {
56
+ if (typeof value !== "object" || value === null)
57
+ return false;
58
+ const v = value;
59
+ return (typeof v["package"] === "string" &&
60
+ typeof v["schema"] === "number" &&
61
+ typeof v["agentContract"] === "number");
62
+ }
63
+ function isAttempt(value) {
64
+ if (typeof value !== "object" || value === null || Array.isArray(value))
65
+ return false;
66
+ const v = value;
67
+ if (typeof v["recorded_at"] !== "string")
68
+ return false;
69
+ if (typeof v["from_pin"] !== "string")
70
+ return false;
71
+ if (typeof v["to_pin"] !== "string")
72
+ return false;
73
+ if (!isEnvelopeOutput(v["output_contract"]))
74
+ return false;
75
+ return true;
76
+ }
77
+ function isEnvelopeSlot(value) {
78
+ if (typeof value !== "object" || value === null || Array.isArray(value))
79
+ return false;
80
+ const v = value;
81
+ if (typeof v["recorded_at"] !== "string")
82
+ return false;
83
+ if (typeof v["from_pin"] !== "string")
84
+ return false;
85
+ if (typeof v["to_pin"] !== "string")
86
+ return false;
87
+ if (!isEnvelopeOutput(v["output_contract"]))
88
+ return false;
89
+ if (!Array.isArray(v["attempts"]))
90
+ return false;
91
+ return v["attempts"].every(isAttempt);
92
+ }
93
+ function isEnvelopeSlotMap(value) {
94
+ if (typeof value !== "object" || value === null || Array.isArray(value))
95
+ return false;
96
+ const v = value;
97
+ return Object.values(v).every(isEnvelopeSlot);
98
+ }
99
+ function isPendingEnvelopeResumeMarker(value) {
100
+ if (typeof value !== "object" || value === null || Array.isArray(value))
101
+ return false;
102
+ const v = value;
103
+ if (typeof v["envelope_ref"] !== "string" || v["envelope_ref"].length === 0)
104
+ return false;
105
+ if (typeof v["from_pin"] !== "string")
106
+ return false;
107
+ if (typeof v["to_pin"] !== "string")
108
+ return false;
109
+ return true;
110
+ }
111
+ function isMigrationState(value) {
112
+ if (typeof value !== "object" || value === null)
113
+ return false;
114
+ const v = value;
115
+ if (v["migration_version"] !== 1)
116
+ return false;
117
+ if (!isAppliedAt(v["last_applied_at"]))
118
+ return false;
119
+ if (!Array.isArray(v["deferred_actions"]))
120
+ return false;
121
+ if (!v["deferred_actions"].every(isDeferredAction))
122
+ return false;
123
+ // Phase 73 D-08 — optional envelopes slot map.
124
+ if (v["envelopes"] !== undefined && !isEnvelopeSlotMap(v["envelopes"]))
125
+ return false;
126
+ // Phase 73 D-11 — optional in-flight resume marker.
127
+ if (v["pending_envelope_resume"] !== undefined &&
128
+ !isPendingEnvelopeResumeMarker(v["pending_envelope_resume"])) {
129
+ return false;
130
+ }
131
+ return true;
132
+ }
133
+ /**
134
+ * Read the migration-state envelope if present.
135
+ *
136
+ * Returns null when missing, parse-failed, or schema-invalid (T-72-05-04
137
+ * mitigation: degraded fallback prevents corrupted manifest from crashing
138
+ * status). Caller treats null as "no prior state" and the advisory gate
139
+ * keeps `deferredActions: []` with `backupAdvisory: null`.
140
+ */
141
+ export async function readMigrationState(targetPath) {
142
+ const filePath = path.join(targetPath, MIGRATION_STATE_RELATIVE_PATH);
143
+ const raw = await fs.readFile(filePath, "utf8").catch(() => null);
144
+ if (raw === null)
145
+ return null;
146
+ let parsed;
147
+ try {
148
+ parsed = JSON.parse(raw);
149
+ }
150
+ catch {
151
+ return null;
152
+ }
153
+ if (!isMigrationState(parsed))
154
+ return null;
155
+ return parsed;
156
+ }
157
+ /**
158
+ * Write the migration-state envelope atomically (D-15).
159
+ *
160
+ * Uses {@link writeFileAtomic} (temp-file + POSIX rename) so the destination
161
+ * is either the previous state or the new state — never half-written content
162
+ * if the process is interrupted between writeFile and rename.
163
+ */
164
+ export async function writeMigrationState(targetPath, state) {
165
+ const filePath = path.join(targetPath, MIGRATION_STATE_RELATIVE_PATH);
166
+ await writeFileAtomic(filePath, `${JSON.stringify(state, null, 2)}\n`);
167
+ }
168
+ /**
169
+ * Idempotent first-run bootstrap (D-16).
170
+ *
171
+ * Returns the existing state when present; otherwise returns a fresh empty
172
+ * envelope using `defaultLastAppliedAt`. Never throws — corrupted state files
173
+ * degrade to a fresh empty envelope so the caller can re-establish provenance
174
+ * at the next rebake.
175
+ */
176
+ export async function bootstrapMigrationStateOrEmpty(targetPath, defaultLastAppliedAt) {
177
+ const existing = await readMigrationState(targetPath);
178
+ if (existing !== null)
179
+ return existing;
180
+ return {
181
+ migration_version: 1,
182
+ last_applied_at: defaultLastAppliedAt,
183
+ deferred_actions: [],
184
+ };
185
+ }
186
+ //# sourceMappingURL=migration-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-state.js","sourceRoot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CAAC;AACJ,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Path of the captured-process snapshot used by Plan 06's
3
+ * capture/stop/restart orchestration (WFL-01 / D-18).
4
+ *
5
+ * D-23: this file is GDH-owned machine-local state; it is OUT of the
6
+ * managed-surface classification scope (not a Class-1/2/3 surface in the
7
+ * migration sense). The name intentionally avoids `.gdh-state/inventory.json`
8
+ * (owned by `packages/scan/src/inventory-cache.ts`) and `.gdh-state/render-inventory.json`
9
+ * (owned by Plan 03 for the render set).
10
+ */
11
+ export declare const PROCESSES_SNAPSHOT_RELATIVE_PATH = ".gdh-state/processes-snapshot.json";
12
+ /** Closed enum for the kind of GDH-owned process captured in a snapshot row. */
13
+ export type GdhCapturedProcessKind = "mcp" | "broker";
14
+ /**
15
+ * Closed enum for how a captured process was stopped during the orchestration
16
+ * window. `null` indicates the row has been captured but stop has not yet been
17
+ * attempted (initial state). `"none"` indicates the stop attempt found the
18
+ * process already gone (idempotent stop).
19
+ */
20
+ export type GdhCapturedProcessStopMethod = "graceful_sigterm" | "hard_kill" | "broker_prune" | "none";
21
+ /**
22
+ * One captured process row. `pid`/`cmd`/`args`/`cwd` are the spawn fingerprint
23
+ * needed to re-spawn after VERIFY succeeds; `env_subset` is the allowlisted
24
+ * environment carried over (T-72-06-01 mitigation: never the full process.env).
25
+ */
26
+ export interface GdhCapturedProcess {
27
+ readonly kind: GdhCapturedProcessKind;
28
+ readonly pid: number;
29
+ readonly cmd: string;
30
+ readonly args: readonly string[];
31
+ readonly cwd: string | null;
32
+ readonly env_subset: Record<string, string>;
33
+ readonly stop_method: GdhCapturedProcessStopMethod | null;
34
+ }
35
+ /**
36
+ * Snapshot envelope. `inventory_version`-style closed integer field for forward
37
+ * compatibility; readers refuse unknown versions and degrade to null (Pattern:
38
+ * Lean versioned envelope with degraded-null fallback).
39
+ */
40
+ export interface GdhProcessesSnapshot {
41
+ readonly snapshot_version: 1;
42
+ readonly captured_at: string;
43
+ readonly processes: readonly GdhCapturedProcess[];
44
+ }
45
+ /**
46
+ * Read the captured-process snapshot if present.
47
+ *
48
+ * Returns null when missing, malformed, or schema-invalid (degraded fallback
49
+ * pattern from Plan 03). Never throws — caller treats null as "no captured
50
+ * processes" and skips stop/restart orchestration.
51
+ */
52
+ export declare function readProcessesSnapshot(targetPath: string): Promise<GdhProcessesSnapshot | null>;
53
+ /**
54
+ * Write the captured-process snapshot atomically (D-15: temp-file in same
55
+ * directory + rename). The destination is either the previous snapshot or the
56
+ * new one; never half-written content.
57
+ */
58
+ export declare function writeProcessesSnapshot(targetPath: string, snapshot: GdhProcessesSnapshot): Promise<void>;
59
+ /**
60
+ * Delete the captured-process snapshot. Returns `{ state: "deleted" }` if the
61
+ * file existed and is now removed; `{ state: "absent" }` if the file was not
62
+ * present. Never throws on absence.
63
+ *
64
+ * Plan 08 calls this after `restartFromSnapshot` reports `all_restarted` so
65
+ * subsequent runs do not see a stale snapshot (D-18 step 12 success path).
66
+ */
67
+ export declare function deleteProcessesSnapshot(targetPath: string): Promise<{
68
+ readonly state: "deleted";
69
+ } | {
70
+ readonly state: "absent";
71
+ }>;
72
+ //# sourceMappingURL=processes-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processes-snapshot.d.ts","sourceRoot":"","sources":["../../src/state/processes-snapshot.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,eAAO,MAAM,gCAAgC,uCAAuC,CAAC;AAErF,gFAAgF;AAChF,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GACpC,kBAAkB,GAClB,WAAW,GACX,cAAc,GACd,MAAM,CAAC;AAEX;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,4BAA4B,GAAG,IAAI,CAAC;CAC3D;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACnD;AA6CD;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAWtC;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC,CASvE"}
@@ -0,0 +1,113 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { writeFileAtomic } from "./atomic-write.js";
4
+ /**
5
+ * Path of the captured-process snapshot used by Plan 06's
6
+ * capture/stop/restart orchestration (WFL-01 / D-18).
7
+ *
8
+ * D-23: this file is GDH-owned machine-local state; it is OUT of the
9
+ * managed-surface classification scope (not a Class-1/2/3 surface in the
10
+ * migration sense). The name intentionally avoids `.gdh-state/inventory.json`
11
+ * (owned by `packages/scan/src/inventory-cache.ts`) and `.gdh-state/render-inventory.json`
12
+ * (owned by Plan 03 for the render set).
13
+ */
14
+ export const PROCESSES_SNAPSHOT_RELATIVE_PATH = ".gdh-state/processes-snapshot.json";
15
+ const KNOWN_KINDS = ["mcp", "broker"];
16
+ const KNOWN_STOP_METHODS = [
17
+ "graceful_sigterm",
18
+ "hard_kill",
19
+ "broker_prune",
20
+ "none",
21
+ ];
22
+ function isCapturedProcess(value) {
23
+ if (typeof value !== "object" || value === null)
24
+ return false;
25
+ const v = value;
26
+ if (!KNOWN_KINDS.includes(v["kind"]))
27
+ return false;
28
+ if (typeof v["pid"] !== "number" || !Number.isFinite(v["pid"]))
29
+ return false;
30
+ if (typeof v["cmd"] !== "string")
31
+ return false;
32
+ if (!Array.isArray(v["args"]))
33
+ return false;
34
+ if (!v["args"].every((entry) => typeof entry === "string"))
35
+ return false;
36
+ if (v["cwd"] !== null && typeof v["cwd"] !== "string")
37
+ return false;
38
+ const envSubset = v["env_subset"];
39
+ if (typeof envSubset !== "object" || envSubset === null || Array.isArray(envSubset)) {
40
+ return false;
41
+ }
42
+ if (!Object.values(envSubset).every((e) => typeof e === "string")) {
43
+ return false;
44
+ }
45
+ const stopMethod = v["stop_method"];
46
+ if (stopMethod !== null &&
47
+ !KNOWN_STOP_METHODS.includes(stopMethod)) {
48
+ return false;
49
+ }
50
+ return true;
51
+ }
52
+ function isProcessesSnapshot(value) {
53
+ if (typeof value !== "object" || value === null)
54
+ return false;
55
+ const v = value;
56
+ if (v["snapshot_version"] !== 1)
57
+ return false;
58
+ if (typeof v["captured_at"] !== "string")
59
+ return false;
60
+ if (!Array.isArray(v["processes"]))
61
+ return false;
62
+ return v["processes"].every(isCapturedProcess);
63
+ }
64
+ /**
65
+ * Read the captured-process snapshot if present.
66
+ *
67
+ * Returns null when missing, malformed, or schema-invalid (degraded fallback
68
+ * pattern from Plan 03). Never throws — caller treats null as "no captured
69
+ * processes" and skips stop/restart orchestration.
70
+ */
71
+ export async function readProcessesSnapshot(targetPath) {
72
+ const filePath = path.join(targetPath, PROCESSES_SNAPSHOT_RELATIVE_PATH);
73
+ const raw = await fs.readFile(filePath, "utf8").catch(() => null);
74
+ if (raw === null)
75
+ return null;
76
+ let parsed;
77
+ try {
78
+ parsed = JSON.parse(raw);
79
+ }
80
+ catch {
81
+ return null;
82
+ }
83
+ return isProcessesSnapshot(parsed) ? parsed : null;
84
+ }
85
+ /**
86
+ * Write the captured-process snapshot atomically (D-15: temp-file in same
87
+ * directory + rename). The destination is either the previous snapshot or the
88
+ * new one; never half-written content.
89
+ */
90
+ export async function writeProcessesSnapshot(targetPath, snapshot) {
91
+ const filePath = path.join(targetPath, PROCESSES_SNAPSHOT_RELATIVE_PATH);
92
+ await writeFileAtomic(filePath, `${JSON.stringify(snapshot, null, 2)}\n`);
93
+ }
94
+ /**
95
+ * Delete the captured-process snapshot. Returns `{ state: "deleted" }` if the
96
+ * file existed and is now removed; `{ state: "absent" }` if the file was not
97
+ * present. Never throws on absence.
98
+ *
99
+ * Plan 08 calls this after `restartFromSnapshot` reports `all_restarted` so
100
+ * subsequent runs do not see a stale snapshot (D-18 step 12 success path).
101
+ */
102
+ export async function deleteProcessesSnapshot(targetPath) {
103
+ const filePath = path.join(targetPath, PROCESSES_SNAPSHOT_RELATIVE_PATH);
104
+ const existed = await fs
105
+ .stat(filePath)
106
+ .then(() => true)
107
+ .catch(() => false);
108
+ if (!existed)
109
+ return { state: "absent" };
110
+ await fs.rm(filePath, { force: true });
111
+ return { state: "deleted" };
112
+ }
113
+ //# sourceMappingURL=processes-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processes-snapshot.js","sourceRoot":"","sources":["../../src/state/processes-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,oCAAoC,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C;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAkB,EAClB,QAA8B;IAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gCAAgC,CAAC,CAAC;IACzE,MAAM,eAAe,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,UAAkB;IAElB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gCAAgC,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,MAAM,EAAE;SACrB,IAAI,CAAC,QAAQ,CAAC;SACd,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;SAChB,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IACtB,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACzC,MAAM,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Path of the migration render inventory.
3
+ *
4
+ * Critical: NOT `.gdh-state/inventory.json` — that path is owned by
5
+ * `packages/scan/src/inventory-cache.ts` (GdhProjectInventory schema for the
6
+ * Godot project scan cache). See 72-RESEARCH.md Pitfall 1 and the explicit
7
+ * collision-check unit test in `render-inventory.test.ts`.
8
+ */
9
+ export declare const RENDER_INVENTORY_RELATIVE_PATH = ".gdh-state/render-inventory.json";
10
+ /**
11
+ * Rendered-at metadata: the package version and version-pair the inventory was
12
+ * written under. Caller is responsible for setting these to the post-rebake
13
+ * state. The rendered_at field is informational only — the sweep does not
14
+ * use it to gate behaviour; it exists to make stale render-inventory.json
15
+ * files diagnosable.
16
+ */
17
+ export interface GdhRenderInventoryRenderedAt {
18
+ readonly package: string;
19
+ readonly schema: number;
20
+ readonly agentContract: number;
21
+ }
22
+ /**
23
+ * Render inventory envelope (D-11). Lean by design — set-diff orphan
24
+ * detection is the only consumer today. `inventory_version` allows future
25
+ * fields without breaking existing readers (degraded fallback returns null
26
+ * for unknown versions; caller treats as "no prior inventory").
27
+ */
28
+ export interface GdhRenderInventory {
29
+ readonly inventory_version: 1;
30
+ readonly rendered_at: GdhRenderInventoryRenderedAt;
31
+ /** Workspace-relative POSIX paths, sorted ascending for stable diffs. */
32
+ readonly paths: readonly string[];
33
+ }
34
+ /**
35
+ * Read the render inventory if present.
36
+ *
37
+ * Returns null when missing or schema-invalid (degraded fallback per D-16
38
+ * legacy first-run bootstrap). Never throws — caller treats null as
39
+ * "no prior inventory" and skips set-diff input from this source.
40
+ */
41
+ export declare function readRenderInventory(targetPath: string): Promise<GdhRenderInventory | null>;
42
+ /**
43
+ * Write the render inventory atomically.
44
+ *
45
+ * Paths are sorted ascending before serialisation (stable diff property:
46
+ * the same input produces byte-equal output across repeat runs, regardless
47
+ * of caller insertion order).
48
+ *
49
+ * Atomic write via {@link writeFileAtomic} — no partial-write survives a
50
+ * crash; the destination is either the previous inventory or the new
51
+ * inventory, never half-written content.
52
+ */
53
+ export declare function writeRenderInventory(targetPath: string, inventory: GdhRenderInventory): Promise<void>;
54
+ //# sourceMappingURL=render-inventory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-inventory.d.ts","sourceRoot":"","sources":["../../src/state/render-inventory.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,qCAAqC,CAAC;AAEjF;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,4BAA4B,CAAC;IACnD,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAqBD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAYpC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -0,0 +1,77 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { writeFileAtomic } from "./atomic-write.js";
4
+ /**
5
+ * Path of the migration render inventory.
6
+ *
7
+ * Critical: NOT `.gdh-state/inventory.json` — that path is owned by
8
+ * `packages/scan/src/inventory-cache.ts` (GdhProjectInventory schema for the
9
+ * Godot project scan cache). See 72-RESEARCH.md Pitfall 1 and the explicit
10
+ * collision-check unit test in `render-inventory.test.ts`.
11
+ */
12
+ export const RENDER_INVENTORY_RELATIVE_PATH = ".gdh-state/render-inventory.json";
13
+ function isRenderedAt(value) {
14
+ if (typeof value !== "object" || value === null)
15
+ return false;
16
+ const v = value;
17
+ return (typeof v["package"] === "string" &&
18
+ typeof v["schema"] === "number" &&
19
+ typeof v["agentContract"] === "number");
20
+ }
21
+ function isRenderInventory(value) {
22
+ if (typeof value !== "object" || value === null)
23
+ return false;
24
+ const v = value;
25
+ if (v["inventory_version"] !== 1)
26
+ return false;
27
+ if (!isRenderedAt(v["rendered_at"]))
28
+ return false;
29
+ if (!Array.isArray(v["paths"]))
30
+ return false;
31
+ return v["paths"].every((entry) => typeof entry === "string");
32
+ }
33
+ /**
34
+ * Read the render inventory if present.
35
+ *
36
+ * Returns null when missing or schema-invalid (degraded fallback per D-16
37
+ * legacy first-run bootstrap). Never throws — caller treats null as
38
+ * "no prior inventory" and skips set-diff input from this source.
39
+ */
40
+ export async function readRenderInventory(targetPath) {
41
+ const filePath = path.join(targetPath, RENDER_INVENTORY_RELATIVE_PATH);
42
+ const raw = await fs.readFile(filePath, "utf8").catch(() => null);
43
+ if (raw === null)
44
+ return null;
45
+ let parsed;
46
+ try {
47
+ parsed = JSON.parse(raw);
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ if (!isRenderInventory(parsed))
53
+ return null;
54
+ return parsed;
55
+ }
56
+ /**
57
+ * Write the render inventory atomically.
58
+ *
59
+ * Paths are sorted ascending before serialisation (stable diff property:
60
+ * the same input produces byte-equal output across repeat runs, regardless
61
+ * of caller insertion order).
62
+ *
63
+ * Atomic write via {@link writeFileAtomic} — no partial-write survives a
64
+ * crash; the destination is either the previous inventory or the new
65
+ * inventory, never half-written content.
66
+ */
67
+ export async function writeRenderInventory(targetPath, inventory) {
68
+ const sortedPaths = [...inventory.paths].sort((a, b) => a.localeCompare(b));
69
+ const normalised = {
70
+ inventory_version: 1,
71
+ rendered_at: inventory.rendered_at,
72
+ paths: sortedPaths,
73
+ };
74
+ const filePath = path.join(targetPath, RENDER_INVENTORY_RELATIVE_PATH);
75
+ await writeFileAtomic(filePath, `${JSON.stringify(normalised, null, 2)}\n`);
76
+ }
77
+ //# sourceMappingURL=render-inventory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-in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@
1
- {"version":3,"file":"agent-contract.d.ts","sourceRoot":"","sources":["../src/agent-contract.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAChC,MAAM,WAAW,CAAC;AAInB,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAC/E,eAAO,MAAM,yBAAyB,oCAAoC,CAAC;AAC3E,eAAO,MAAM,kCAAkC,yBAAyB,CAAC;AAEzE,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAErE,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,6BAAkC,GAC1C,MAAM,CAOR;AAqCD,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,MAAM,CAeR;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,0BAA0B,CAAC,CAWrC;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,sBAAsB,CAAC,CAmBjC"}
1
+ {"version":3,"file":"agent-contract.d.ts","sourceRoot":"","sources":["../src/agent-contract.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAChC,MAAM,WAAW,CAAC;AAMnB,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAC/E,eAAO,MAAM,yBAAyB,oCAAoC,CAAC;AAC3E,eAAO,MAAM,kCAAkC,yBAAyB,CAAC;AAEzE,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAErE,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,6BAAkC,GAC1C,MAAM,CAOR;AAqCD,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,MAAM,CAeR;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,0BAA0B,CAAC,CAWrC;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,sBAAsB,CAAC,CAmBjC"}
@@ -1,7 +1,8 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { GDH_AGENT_CONTRACT_VERSION, } from "@gdh/core";
3
+ import { GDH_AGENT_CONTRACT_VERSION, assertClassRegistered, } from "@gdh/core";
4
4
  import { createArtifactWrite } from "./files.js";
5
+ assertClassRegistered("agents_md_managed_block", "deterministic");
5
6
  export const AGENT_CONTRACT_RELATIVE_PATH = "AGENTS.md";
6
7
  export const AGENT_CONTRACT_BEGIN_MARKER = "<!-- BEGIN GDH AGENT CONTRACT -->";
7
8
  export const AGENT_CONTRACT_END_MARKER = "<!-- END GDH AGENT CONTRACT -->";
@@ -1 +1 @@
1
- {"version":3,"file":"agent-contract.js","sourceRoot":"","sources":["../src/agent-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,0BAA0B,GAG3B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,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0B,CAC9C,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,gBAAgB,GAC9B,OAAO,CAAC,SAAS,0BAA0B,EAAE,CAAC,CAuBhD;AAED,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAqB1C;AAED,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC,CA4B7C;AAED,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAYzF"}
@@ -1,9 +1,11 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { GDH_GUIDANCE_INDEX_VERSION, GDH_GUIDANCE_UNIT_VERSION, } from "@gdh/core";
3
+ import { GDH_GUIDANCE_INDEX_VERSION, GDH_GUIDANCE_UNIT_VERSION, assertClassRegistered, } from "@gdh/core";
4
4
  import { parse } from "yaml";
5
5
  import { createArtifactWrite } from "./files.js";
6
6
  import { readRulesDocument } from "./rules.js";
7
+ assertClassRegistered("guidance_unit_set", "deterministic");
8
+ assertClassRegistered("guidance_index", "deterministic");
7
9
  const GUIDANCE_INDEX_RELATIVE_PATH = "docs/agent/README.md";
8
10
  export function createDefaultGuidanceUnits(projectConfig) {
9
11
  return [