@khoavu882/doflow 2.0.0-beta.3 → 2.0.0-beta.4

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 (167) hide show
  1. package/bin/doflow.js +2 -2
  2. package/core/.claude-plugin/plugin.json +1 -1
  3. package/core/.codex-plugin/plugin.json +1 -1
  4. package/core/.plugin/plugin.json +1 -1
  5. package/core/registry/storage.json +87 -83
  6. package/core/registry/verification.json +1 -1
  7. package/core/shared/scripts/doflow/bash/render-puml.sh +2 -2
  8. package/core/shared/skills/do-execute-plan/references/scaffold.md +2 -2
  9. package/package.json +4 -2
  10. package/src/adapters/antigravity/{index.ts → index.js} +60 -60
  11. package/src/adapters/claude/{index.ts → index.js} +48 -48
  12. package/src/adapters/claude/{mcp.ts → mcp.js} +16 -16
  13. package/src/adapters/codex/{agents.ts → agents.js} +24 -24
  14. package/src/adapters/codex/{config.ts → config.js} +49 -49
  15. package/src/adapters/codex/{hooks.ts → hooks.js} +23 -23
  16. package/src/adapters/codex/{index.ts → index.js} +98 -98
  17. package/src/adapters/codex/{mcp.ts → mcp.js} +38 -38
  18. package/src/adapters/codex/{native-projection.ts → native-projection.js} +5 -5
  19. package/src/adapters/copilot/{index.ts → index.js} +42 -42
  20. package/src/adapters/{copy-tree.ts → copy-tree.js} +70 -70
  21. package/src/adapters/gemini/{hooks.ts → hooks.js} +24 -24
  22. package/src/adapters/gemini/{index.ts → index.js} +41 -41
  23. package/src/adapters/{hook-commands.ts → hook-commands.js} +8 -8
  24. package/src/adapters/{index.ts → index.js} +13 -13
  25. package/src/adapters/kiro/{index.ts → index.js} +34 -34
  26. package/src/adapters/{mcp-entries.ts → mcp-entries.js} +55 -55
  27. package/src/adapters/opencode/{index.ts → index.js} +52 -52
  28. package/src/adapters/pi/{index.ts → index.js} +30 -30
  29. package/src/adapters/pi/{json-members.ts → json-members.js} +23 -23
  30. package/src/adapters/pi/{mcp.ts → mcp.js} +70 -70
  31. package/src/adapters/{resolve-source.ts → resolve-source.js} +1 -1
  32. package/src/cli/commands/{install.ts → install.js} +24 -24
  33. package/src/cli/commands/{list-backups.ts → list-backups.js} +4 -4
  34. package/src/cli/commands/{reconcile.ts → reconcile.js} +19 -19
  35. package/src/cli/commands/{remove.ts → remove.js} +10 -10
  36. package/src/cli/commands/{rollback.ts → rollback.js} +17 -17
  37. package/src/cli/commands/{self-update.ts → self-update.js} +3 -3
  38. package/src/cli/commands/{status.ts → status.js} +24 -24
  39. package/src/cli/commands/{tools.ts → tools.js} +16 -16
  40. package/src/cli/commands/{update.ts → update.js} +19 -19
  41. package/src/cli/{index.ts → index.js} +26 -26
  42. package/src/cli/{runtime-commands.ts → runtime-commands.js} +48 -48
  43. package/src/cli/{shared.ts → shared.js} +40 -40
  44. package/src/helper/{bash-helper.ts → bash-helper.js} +7 -7
  45. package/src/helper/{git.ts → git.js} +2 -2
  46. package/src/helper/{guardrails.ts → guardrails.js} +10 -10
  47. package/src/helper/{harness-paths.ts → harness-paths.js} +24 -24
  48. package/src/helper/{marker-merge.ts → marker-merge.js} +4 -4
  49. package/src/helper/{prompt.ts → prompt.js} +5 -5
  50. package/src/helper/{repo-root.ts → repo-root.js} +2 -2
  51. package/src/helper/{settings-merge.ts → settings-merge.js} +27 -27
  52. package/src/helper/{settings-scope.ts → settings-scope.js} +3 -3
  53. package/src/helper/{toml.ts → toml.js} +48 -48
  54. package/src/install/{backup-set.ts → backup-set.js} +16 -16
  55. package/src/install/{backup.ts → backup.js} +65 -65
  56. package/src/install/{context.ts → context.js} +15 -15
  57. package/src/install/{manifest.ts → manifest.js} +27 -27
  58. package/src/install/{mcp.ts → mcp.js} +30 -30
  59. package/src/install/{paths.ts → paths.js} +15 -15
  60. package/src/install/{targets.ts → targets.js} +10 -10
  61. package/src/install/{tool-lifecycle.ts → tool-lifecycle.js} +20 -20
  62. package/src/lifecycle/{bash-availability.ts → bash-availability.js} +1 -1
  63. package/src/lifecycle/{index.ts → index.js} +140 -140
  64. package/src/lifecycle/{mcp-index.ts → mcp-index.js} +1 -1
  65. package/src/lifecycle/{policies.ts → policies.js} +11 -11
  66. package/src/lifecycle/{view.ts → view.js} +28 -28
  67. package/src/registry/{index.ts → index.js} +60 -60
  68. package/src/release/build-package.js +91 -0
  69. package/src/release/changelog-section.js +70 -0
  70. package/src/release/{sync-plugin-versions.ts → sync-plugin-versions.js} +4 -4
  71. package/src/runtime/advice/{cli.ts → cli.js} +31 -31
  72. package/src/runtime/advice/{client.ts → client.js} +44 -44
  73. package/src/runtime/advice/{config.ts → config.js} +16 -16
  74. package/src/runtime/advice/{doctor.ts → doctor.js} +32 -32
  75. package/src/runtime/advice/{endpoint-guard.ts → endpoint-guard.js} +20 -20
  76. package/src/runtime/advice/{kinds.ts → kinds.js} +16 -16
  77. package/src/runtime/advice/providers/{ollama-systemone.ts → ollama-systemone.js} +21 -21
  78. package/src/runtime/advice/{record.ts → record.js} +19 -19
  79. package/src/runtime/advice/{registry.ts → registry.js} +16 -16
  80. package/src/runtime/advice/{strength.ts → strength.js} +7 -7
  81. package/src/runtime/{brief-tools.ts → brief-tools.js} +50 -50
  82. package/src/runtime/{c4-project.ts → c4-project.js} +27 -27
  83. package/src/runtime/{capability-router.ts → capability-router.js} +39 -39
  84. package/src/runtime/{checkouts.ts → checkouts.js} +21 -21
  85. package/src/runtime/{claims.ts → claims.js} +30 -30
  86. package/src/runtime/{cli-result.ts → cli-result.js} +4 -4
  87. package/src/runtime/{cli.ts → cli.js} +37 -37
  88. package/src/runtime/{command-detect.ts → command-detect.js} +47 -47
  89. package/src/runtime/{context-pack.ts → context-pack.js} +20 -20
  90. package/src/runtime/{decision-register.ts → decision-register.js} +67 -67
  91. package/src/runtime/{evidence-ledger.ts → evidence-ledger.js} +25 -25
  92. package/src/runtime/failure/{capture.ts → capture.js} +29 -29
  93. package/src/runtime/failure/{classifier.ts → classifier.js} +4 -4
  94. package/src/runtime/failure/{cli.ts → cli.js} +30 -30
  95. package/src/runtime/failure/{home.ts → home.js} +6 -6
  96. package/src/runtime/failure/{store.ts → store.js} +32 -32
  97. package/src/runtime/{feature-resolve.ts → feature-resolve.js} +6 -6
  98. package/src/runtime/{freshness.ts → freshness.js} +15 -15
  99. package/src/runtime/{health.ts → health.js} +72 -72
  100. package/src/runtime/{history-compactor.ts → history-compactor.js} +25 -25
  101. package/src/runtime/{implementation-gate.ts → implementation-gate.js} +30 -30
  102. package/src/runtime/inventory/{coverage.ts → coverage.js} +10 -10
  103. package/src/runtime/inventory/{identity.ts → identity.js} +2 -2
  104. package/src/runtime/inventory/{index.ts → index.js} +36 -36
  105. package/src/runtime/inventory/{precedence.ts → precedence.js} +2 -2
  106. package/src/runtime/inventory/{read-scopes.ts → read-scopes.js} +9 -9
  107. package/src/runtime/inventory/{siblings.ts → siblings.js} +15 -15
  108. package/src/runtime/knowledge/{chunker.ts → chunker.js} +12 -12
  109. package/src/runtime/knowledge/{hybrid.ts → hybrid.js} +17 -17
  110. package/src/runtime/knowledge/{index-store.ts → index-store.js} +23 -23
  111. package/src/runtime/knowledge/{retrieval.ts → retrieval.js} +27 -27
  112. package/src/runtime/{leak-scan.ts → leak-scan.js} +12 -12
  113. package/src/runtime/lifecycle/{cli.ts → cli.js} +32 -32
  114. package/src/runtime/lifecycle/{event-store.ts → event-store.js} +48 -48
  115. package/src/runtime/lifecycle/{fold.ts → fold.js} +41 -41
  116. package/src/runtime/lifecycle/{followup.ts → followup.js} +54 -54
  117. package/src/runtime/lifecycle/{goal.ts → goal.js} +50 -50
  118. package/src/runtime/lifecycle/{intent-writer.ts → intent-writer.js} +5 -5
  119. package/src/runtime/lifecycle/{overview.ts → overview.js} +47 -47
  120. package/src/runtime/lifecycle/{release.ts → release.js} +29 -29
  121. package/src/runtime/lifecycle/{report-store.ts → report-store.js} +25 -25
  122. package/src/runtime/lifecycle/{retention.ts → retention.js} +37 -37
  123. package/src/runtime/lifecycle/{root.ts → root.js} +9 -9
  124. package/src/runtime/lifecycle/{status.ts → status.js} +64 -64
  125. package/src/runtime/lifecycle/{store-upkeep.ts → store-upkeep.js} +46 -46
  126. package/src/runtime/{locator-resolve.ts → locator-resolve.js} +7 -7
  127. package/src/runtime/{mask.ts → mask.js} +22 -22
  128. package/src/runtime/{mcp-consultations.ts → mcp-consultations.js} +54 -54
  129. package/src/runtime/{mcp-reach.ts → mcp-reach.js} +24 -24
  130. package/src/runtime/{model-router.ts → model-router.js} +20 -20
  131. package/src/runtime/{outcome.ts → outcome.js} +27 -27
  132. package/src/runtime/{reach.ts → reach.js} +21 -21
  133. package/src/runtime/{readiness-record.ts → readiness-record.js} +12 -12
  134. package/src/runtime/{readiness.ts → readiness.js} +35 -35
  135. package/src/runtime/{recovery.ts → recovery.js} +15 -15
  136. package/src/runtime/{research-request.ts → research-request.js} +34 -34
  137. package/src/runtime/{retrieval-plan.ts → retrieval-plan.js} +40 -40
  138. package/src/runtime/scaffold/{artifacts.ts → artifacts.js} +19 -19
  139. package/src/runtime/scaffold/{fingerprint.ts → fingerprint.js} +3 -3
  140. package/src/runtime/scaffold/{generate.ts → generate.js} +109 -109
  141. package/src/runtime/scaffold/{languages.ts → languages.js} +34 -34
  142. package/src/runtime/storage/{cli.ts → cli.js} +9 -9
  143. package/src/runtime/storage/{engine.ts → engine.js} +37 -37
  144. package/src/runtime/storage/{registry.ts → registry.js} +19 -19
  145. package/src/runtime/storage/{roots.ts → roots.js} +8 -8
  146. package/src/runtime/storage/{rules.ts → rules.js} +26 -26
  147. package/src/runtime/storage/{upkeep.ts → upkeep.js} +35 -35
  148. package/src/runtime/storage/{work-status.ts → work-status.js} +39 -39
  149. package/src/runtime/{task-attempts.ts → task-attempts.js} +61 -61
  150. package/src/runtime/{task-classifier.ts → task-classifier.js} +34 -34
  151. package/src/runtime/{task-scope.ts → task-scope.js} +13 -13
  152. package/src/runtime/{task-state.ts → task-state.js} +15 -15
  153. package/src/runtime/trace/{indicators.ts → indicators.js} +22 -22
  154. package/src/runtime/trace/{ledger.ts → ledger.js} +42 -42
  155. package/src/runtime/trace/{render.ts → render.js} +7 -7
  156. package/src/runtime/trace/{views.ts → views.js} +40 -40
  157. package/src/runtime/verification/{contract-runner.ts → contract-runner.js} +23 -23
  158. package/src/runtime/verification/{engine.ts → engine.js} +143 -143
  159. package/src/runtime/verification/{registry.ts → registry.js} +6 -6
  160. package/src/runtime/verification/{scope-bound.ts → scope-bound.js} +50 -50
  161. package/src/runtime/verification/{test-selection.ts → test-selection.js} +28 -28
  162. package/src/runtime/{workflow-engine.ts → workflow-engine.js} +50 -50
  163. package/src/runtime/{workflow-orchestrator.ts → workflow-orchestrator.js} +91 -91
  164. package/src/runtime/{worktree.ts → worktree.js} +31 -31
  165. package/src/state/{index.ts → index.js} +26 -26
  166. package/src/state/{lockfile.ts → lockfile.js} +20 -20
  167. package/src/state/{run-lock.ts → run-lock.js} +44 -44
@@ -9,25 +9,25 @@ const fs = require('node:fs');
9
9
  const os = require('node:os');
10
10
  const path = require('node:path');
11
11
  const crypto = require('node:crypto');
12
- const { configPath, fingerprint: configFingerprint, parseToml, planCodexConfig, applyCodexConfig } = require('./config.ts');
13
- const { renderServer, planCodexMcp, applyCodexMcp, ownedCodexMcpIds, userDefinedCodexMcpIds, serverTableText } = require('./mcp.ts');
14
- const { agentDirectory, discoverCodexAgents, planCodexAgents, applyCodexAgents } = require('./agents.ts');
15
- const { planCodexHooks, deployCodexHooks, removeCodexHookScripts } = require('./hooks.ts');
16
- const { planTree, applyTree, removeTree, verifyTree, copyTreeAssets, copyTreeDestDir, ledgerFileResources, ledgerSiblingFingerprints, siblingReplacedNotices } = require('../copy-tree.ts');
17
- const { mergeMarkedSection, removeMarkedSection, MARKER_START, MARKER_END } = require('../../helper/marker-merge.ts');
18
- const { nativeMcpCatalog } = require('../../registry/index.ts');
19
- const { declaredHarnessPaths, resolveHarnessPaths } = require('../../helper/harness-paths.ts');
12
+ const { configPath, fingerprint: configFingerprint, parseToml, planCodexConfig, applyCodexConfig } = require('./config.js');
13
+ const { renderServer, planCodexMcp, applyCodexMcp, ownedCodexMcpIds, userDefinedCodexMcpIds, serverTableText } = require('./mcp.js');
14
+ const { agentDirectory, discoverCodexAgents, planCodexAgents, applyCodexAgents } = require('./agents.js');
15
+ const { planCodexHooks, deployCodexHooks, removeCodexHookScripts } = require('./hooks.js');
16
+ const { planTree, applyTree, removeTree, verifyTree, copyTreeAssets, copyTreeDestDir, ledgerFileResources, ledgerSiblingFingerprints, siblingReplacedNotices } = require('../copy-tree.js');
17
+ const { mergeMarkedSection, removeMarkedSection, MARKER_START, MARKER_END } = require('../../helper/marker-merge.js');
18
+ const { nativeMcpCatalog } = require('../../registry/index.js');
19
+ const { declaredHarnessPaths, resolveHarnessPaths } = require('../../helper/harness-paths.js');
20
20
 
21
21
  const HARNESS = 'codex';
22
22
 
23
23
  /** Every server a capability provider names as its MCP server. */
24
- function providerMcpServers(registry: any) {
25
- return Object.values<any>(registry?.capabilities || {}).flatMap((capability) => (capability.providers || []).map((provider: any) => provider.mcp?.server)).filter(Boolean);
24
+ function providerMcpServers(registry ) {
25
+ return Object.values (registry?.capabilities || {}).flatMap((capability) => (capability.providers || []).map((provider ) => provider.mcp?.server)).filter(Boolean);
26
26
  }
27
27
 
28
28
  /** The servers config.toml defines among `names`, whoever wrote them: the tables DoFlow owns plus the
29
29
  * user's own. `null` while the file is absent or cannot be parsed. */
30
- function configuredCodexMcpIds({ config, scope, fsImpl, mcpRecords, names }: any) {
30
+ function configuredCodexMcpIds({ config, scope, fsImpl, mcpRecords, names } ) {
31
31
  try {
32
32
  if (!fsImpl.existsSync(config)) return null;
33
33
  parseToml(fsImpl.readFileSync(config, 'utf8'));
@@ -44,7 +44,7 @@ function configuredCodexMcpIds({ config, scope, fsImpl, mcpRecords, names }: any
44
44
  * configured instance so direct callers keep their historical shape.
45
45
  */
46
46
  function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] } = {}) {
47
- function normalizeContext({ scope, scopeRoot, projectRoot, codexDir, homeDir }: any = {}) {
47
+ function normalizeContext({ scope, scopeRoot, projectRoot, codexDir, homeDir } = {}) {
48
48
  if (!['project', 'global', 'user'].includes(scope)) throw new Error(`Unsupported Codex scope '${scope}'`);
49
49
  if (scope === 'project') {
50
50
  // Logic residue (input normalization, not a path fact): scopeRoot is accepted as the selected
@@ -65,7 +65,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
65
65
 
66
66
  const nativeContext = normalizeContext;
67
67
 
68
- function discover(options: any, { fsImpl = fs }: any = {}) {
68
+ function discover(options , { fsImpl = fs } = {}) {
69
69
  const context = nativeContext(options);
70
70
  const paths = context.paths;
71
71
  const config = paths.configFile;
@@ -85,9 +85,9 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
85
85
  };
86
86
  }
87
87
 
88
- function render({ registry, asset }: any) {
88
+ function render({ registry, asset } ) {
89
89
  if (!registry || !asset) throw new Error('render requires registry and asset');
90
- const harness = registry.harnesses.find((item: any) => item.id === HARNESS);
90
+ const harness = registry.harnesses.find((item ) => item.id === HARNESS);
91
91
  if (!harness) throw new Error('Registry does not define the Codex harness');
92
92
  const projection = asset.projection?.[HARNESS];
93
93
  if (!projection) return { harness: HARNESS, assetId: asset.id, status: 'not-applicable' };
@@ -105,20 +105,20 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
105
105
  };
106
106
  }
107
107
 
108
- function assetIdFor(options: any, componentName: any) {
108
+ function assetIdFor(options , componentName ) {
109
109
  const explicit = options.projection?.assetIds?.[componentName];
110
110
  if (explicit) return explicit;
111
111
  const assets = options.assets || [];
112
- if (componentName === 'agents') return assets.find((asset: any) => asset.id === 'agents.shared')?.id ?? assets[0]?.id;
113
- return assets.find((asset: any) => asset.id === 'guidance.codex-pointer')?.id ?? assets[0]?.id ?? `codex.${componentName}`;
112
+ if (componentName === 'agents') return assets.find((asset ) => asset.id === 'agents.shared')?.id ?? assets[0]?.id;
113
+ return assets.find((asset ) => asset.id === 'guidance.codex-pointer')?.id ?? assets[0]?.id ?? `codex.${componentName}`;
114
114
  }
115
115
 
116
- function ownershipKind(componentName: any) {
117
- return ({ config: 'configuration-entry', mcp: 'mcp-server', agents: 'custom-agent', hooks: 'hooks-file' } as Record<string, string>)[componentName] ?? componentName;
116
+ function ownershipKind(componentName ) {
117
+ return ({ config: 'configuration-entry', mcp: 'mcp-server', agents: 'custom-agent', hooks: 'hooks-file' } )[componentName] ?? componentName;
118
118
  }
119
- function ownershipIdentity(componentName: any, identity: any) { return `doflow:codex:${ownershipKind(componentName)}:${identity}`; }
119
+ function ownershipIdentity(componentName , identity ) { return `doflow:codex:${ownershipKind(componentName)}:${identity}`; }
120
120
 
121
- function addChanges(output: any, assetId: any, component: any, componentName: any) {
121
+ function addChanges(output , assetId , component , componentName ) {
122
122
  for (const change of component?.changes || []) output.push({
123
123
  harness: HARNESS,
124
124
  assetId,
@@ -134,8 +134,8 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
134
134
  });
135
135
  }
136
136
 
137
- function sha256(text: any) { return `sha256:${crypto.createHash('sha256').update(text).digest('hex')}`; }
138
- function lifecycleResource({ scope, assetId, kind, identity, target, fingerprint, sourceVersion, selection, recoveryRef, projection }: any) {
137
+ function sha256(text ) { return `sha256:${crypto.createHash('sha256').update(text).digest('hex')}`; }
138
+ function lifecycleResource({ scope, assetId, kind, identity, target, fingerprint, sourceVersion, selection, recoveryRef, projection } ) {
139
139
  return { harness: HARNESS, scope, assetId, kind, identity, target, ownershipIdentity: `doflow:codex:${kind}:${identity}`,
140
140
  fingerprint, sourceVersion: sourceVersion ?? 'unknown', selection: selection ?? true, recoveryRef: recoveryRef ?? null, projection };
141
141
  }
@@ -143,8 +143,8 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
143
143
  /** Convert neutral ledger entries to the legacy planner's ownership record.
144
144
  * An absolute target must match the exact native file this component will
145
145
  * reconcile; a record from another Codex project cannot authorize this plan. */
146
- function nativeManagedResources(resources: any, context: any, { kind, target, directory }: any = {}) {
147
- return (resources || []).flatMap((resource: any) => {
146
+ function nativeManagedResources(resources , context , { kind, target, directory } = {}) {
147
+ return (resources || []).flatMap((resource ) => {
148
148
  if (!resource || resource.kind !== kind) return [];
149
149
  // Retain the pre-registry native record shape for direct callers/tests.
150
150
  if (!resource.harness && resource.target === HARNESS) {
@@ -162,36 +162,36 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
162
162
  /** Whether a row of the OTHER scope claims `target` (for a config or MCP entry: the same entry in
163
163
  * that file). A project rooted at $HOME shares `~/.codex`, `~/.agents` and the one ledger with the
164
164
  * global install, so its removal must leave whatever the global rows still own, and vice versa. */
165
- function claimedByOtherScope(resources: any, context: any, target: any, identity?: any) {
165
+ function claimedByOtherScope(resources , context , target , identity ) {
166
166
  if (typeof target !== 'string') return false;
167
- return (resources || []).some((resource: any) => resource?.scope && resource.scope !== context.scope
167
+ return (resources || []).some((resource ) => resource?.scope && resource.scope !== context.scope
168
168
  && typeof resource.target === 'string' && path.resolve(resource.target) === path.resolve(target)
169
169
  && (identity === undefined || resource.identity === identity));
170
170
  }
171
171
 
172
- function claimedRowElsewhere(resources: any, context: any, resource: any) {
172
+ function claimedRowElsewhere(resources , context , resource ) {
173
173
  return claimedByOtherScope(resources, context, resource.target,
174
174
  ['configuration-entry', 'config-entry', 'mcp-server'].includes(resource.kind) ? resource.identity : undefined);
175
175
  }
176
176
 
177
177
  /** The rows a removal may act on: this scope's own, minus any path the other scope still claims. */
178
- function removableRows(resources: any, context: any) {
179
- return (resources || []).filter((resource: any) => (!resource?.scope || resource.scope === context.scope)
178
+ function removableRows(resources , context ) {
179
+ return (resources || []).filter((resource ) => (!resource?.scope || resource.scope === context.scope)
180
180
  && !claimedRowElsewhere(resources, context, resource));
181
181
  }
182
182
 
183
183
  /** This scope's rows on a path the other scope still claims become retained removals: the
184
184
  * lifecycle releases the row and never hands the change to remove(), so nothing is deleted. */
185
- function retainedRemovals(resources: any, context: any) {
186
- return (resources || []).filter((resource: any) => resource?.harness === HARNESS && resource.scope === context.scope
185
+ function retainedRemovals(resources , context ) {
186
+ return (resources || []).filter((resource ) => resource?.harness === HARNESS && resource.scope === context.scope
187
187
  && claimedRowElsewhere(resources, context, resource))
188
- .map((resource: any) => ({ harness: HARNESS, assetId: resource.assetId, target: resource.target, operation: 'remove',
188
+ .map((resource ) => ({ harness: HARNESS, assetId: resource.assetId, target: resource.target, operation: 'remove',
189
189
  ownershipIdentity: resource.ownershipIdentity, kind: resource.kind, identity: resource.identity,
190
190
  retained: true, retainedFor: [`${HARNESS} (${context.scope === 'global' ? 'project' : 'global'} scope)`] }));
191
191
  }
192
192
 
193
- function ownedRemovalPlan(resources: any, context: any, kind: any, directory?: any) {
194
- const entries = (resources || []).filter((resource: any) => resource?.harness === HARNESS && resource.kind === kind);
193
+ function ownedRemovalPlan(resources , context , kind , directory ) {
194
+ const entries = (resources || []).filter((resource ) => resource?.harness === HARNESS && resource.kind === kind);
195
195
  const changes = []; const conflicts = [];
196
196
  for (const resource of entries) {
197
197
  const target = kind === 'custom-agent'
@@ -207,38 +207,38 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
207
207
  return { ok: conflicts.length === 0, status: conflicts.length ? 'conflict' : (changes.length ? 'change' : 'unchanged'), changes, conflicts, directRemove: true };
208
208
  }
209
209
 
210
- function configResourcesFrom(config: any, { scope, sourceVersion, recoveryRef }: any) {
210
+ function configResourcesFrom(config , { scope, sourceVersion, recoveryRef } ) {
211
211
  return (config?.managedResources || [])
212
- .filter((record: any) => record.kind === 'configuration-entry' || record.kind === 'config-entry')
213
- .map((record: any) => lifecycleResource({ scope, assetId: 'guidance.codex-pointer', kind: 'configuration-entry', identity: record.identity,
212
+ .filter((record ) => record.kind === 'configuration-entry' || record.kind === 'config-entry')
213
+ .map((record ) => lifecycleResource({ scope, assetId: 'guidance.codex-pointer', kind: 'configuration-entry', identity: record.identity,
214
214
  target: config.file, fingerprint: record.fingerprint, sourceVersion: record.sourceVersion ?? sourceVersion, recoveryRef,
215
215
  projection: { renderer: 'codex-config' } }));
216
216
  }
217
217
 
218
- function mcpResourcesFrom(mcp: any, { scope, sourceVersion, recoveryRef }: any) {
218
+ function mcpResourcesFrom(mcp , { scope, sourceVersion, recoveryRef } ) {
219
219
  return (mcp?.managedResources || [])
220
- .filter((record: any) => record.kind === 'mcp-server')
221
- .map((record: any) => lifecycleResource({ scope, assetId: 'guidance.codex-pointer', kind: 'mcp-server', identity: record.identity,
220
+ .filter((record ) => record.kind === 'mcp-server')
221
+ .map((record ) => lifecycleResource({ scope, assetId: 'guidance.codex-pointer', kind: 'mcp-server', identity: record.identity,
222
222
  target: mcp.file, fingerprint: record.fingerprint, sourceVersion: record.sourceVersion ?? sourceVersion, selection: record.selection, recoveryRef,
223
223
  projection: { renderer: 'codex-mcp' } }));
224
224
  }
225
225
 
226
- function agentResourcesFrom(agents: any, { scope, sourceVersion, recoveryRef }: any) {
226
+ function agentResourcesFrom(agents , { scope, sourceVersion, recoveryRef } ) {
227
227
  return (agents?.managedResources || [])
228
- .filter((record: any) => record.kind === 'custom-agent')
229
- .map((record: any) => lifecycleResource({ scope, assetId: 'agents.shared', kind: 'custom-agent', identity: record.identity,
228
+ .filter((record ) => record.kind === 'custom-agent')
229
+ .map((record ) => lifecycleResource({ scope, assetId: 'agents.shared', kind: 'custom-agent', identity: record.identity,
230
230
  target: path.join(agents.directory, `${record.identity.replace(/^agent:/, '')}.toml`), fingerprint: record.fingerprint,
231
231
  sourceVersion: record.sourceVersion ?? sourceVersion, recoveryRef, projection: { renderer: 'codex-agent' } }));
232
232
  }
233
233
 
234
- function hooksResourceFrom(hooks: any, { scope, sourceVersion, recoveryRef }: any) {
234
+ function hooksResourceFrom(hooks , { scope, sourceVersion, recoveryRef } ) {
235
235
  if (!hooks?.applied || !hooks.destination) return [];
236
236
  return [lifecycleResource({ scope, assetId: 'guidance.codex-pointer', kind: 'hooks-file', identity: 'hooks.json',
237
237
  target: hooks.destination, fingerprint: sha256(fs.readFileSync(hooks.destination, 'utf8')), sourceVersion, recoveryRef,
238
238
  projection: { renderer: 'codex-hooks' } })];
239
239
  }
240
240
 
241
- function resourcesFromApplied({ components, scope, sourceVersion, recoveryRef }: any) {
241
+ function resourcesFromApplied({ components, scope, sourceVersion, recoveryRef } ) {
242
242
  const shared = { scope, sourceVersion, recoveryRef };
243
243
  return [
244
244
  ...configResourcesFrom(components.config, shared),
@@ -250,8 +250,8 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
250
250
 
251
251
  // ---- copy-tree assets (rules, skills, agents, templates, scripts, references) ----
252
252
 
253
- function codexConfigDir(context: any) { return context.paths.configDir; }
254
- function sourceDirFor(asset: any, repoRoot: any) {
253
+ function codexConfigDir(context ) { return context.paths.configDir; }
254
+ function sourceDirFor(asset , repoRoot ) {
255
255
  if (!asset || typeof asset.source !== 'string') throw new Error('Codex asset requires a source path');
256
256
  const root = repoRoot ? path.resolve(repoRoot) : process.cwd();
257
257
  const source = path.resolve(root, asset.source);
@@ -269,16 +269,16 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
269
269
  // declared in harnesses.json (paths.instructions). The registry declares this asset's codex
270
270
  // projection as renderer "codex-agents" (see core/registry/assets.json).
271
271
 
272
- function instructionsAsset(assets: any) { return (assets || []).find((asset: any) => asset?.renderer === 'codex-agents'); }
273
- function instructionsPath(context: any) {
272
+ function instructionsAsset(assets ) { return (assets || []).find((asset ) => asset?.renderer === 'codex-agents'); }
273
+ function instructionsPath(context ) {
274
274
  return context.paths.instructions;
275
275
  }
276
- function sha256Text(text: any) { return crypto.createHash('sha256').update(text).digest('hex'); }
276
+ function sha256Text(text ) { return crypto.createHash('sha256').update(text).digest('hex'); }
277
277
 
278
- function planInstructionsAsset({ assets, context, removing, repoRoot, claimedElsewhere = () => false }: any) {
278
+ function planInstructionsAsset({ assets, context, removing, repoRoot, claimedElsewhere = () => false } ) {
279
279
  const asset = instructionsAsset(assets);
280
- const changes: any[] = [];
281
- const conflicts: any[] = [];
280
+ const changes = [];
281
+ const conflicts = [];
282
282
  if (!asset) return { changes, conflicts };
283
283
  const target = instructionsPath(context);
284
284
  // Broken markers are a plan conflict, as for Claude: found only while applying, they would stop
@@ -306,22 +306,22 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
306
306
  return { changes, conflicts };
307
307
  }
308
308
 
309
- function applyInstructionsAsset(changes: any) {
309
+ function applyInstructionsAsset(changes ) {
310
310
  for (const change of changes) {
311
311
  if (change.projection?.renderer !== 'codex-agents' || change.operation === 'remove') continue;
312
312
  mergeMarkedSection(change.source, change.target);
313
313
  }
314
314
  }
315
315
 
316
- function removeInstructionsAsset(changes: any) {
316
+ function removeInstructionsAsset(changes ) {
317
317
  for (const change of changes) {
318
318
  if (change.projection?.renderer === 'codex-agents' && change.operation === 'remove') removeMarkedSection(change.target);
319
319
  }
320
320
  }
321
321
 
322
- function verifyInstructionsAsset({ assets, context, repoRoot }: any) {
322
+ function verifyInstructionsAsset({ assets, context, repoRoot } ) {
323
323
  const asset = instructionsAsset(assets);
324
- const statuses: any[] = []; const resources: any[] = [];
324
+ const statuses = []; const resources = [];
325
325
  if (!asset) return { statuses, resources };
326
326
  const target = instructionsPath(context);
327
327
  const existing = fs.existsSync(target) ? fs.readFileSync(target, 'utf8') : null;
@@ -335,7 +335,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
335
335
  return { statuses, resources };
336
336
  }
337
337
 
338
- function planCopyTreeAssets({ assets, context, neutralResources, removing, repoRoot, sourceVersion, force = false }: any) {
338
+ function planCopyTreeAssets({ assets, context, neutralResources, removing, repoRoot, sourceVersion, force = false } ) {
339
339
  const changes = [];
340
340
  const conflicts = [];
341
341
  const treeResults = [];
@@ -352,10 +352,10 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
352
352
  // never deleted, forced or not.
353
353
  force: !removing && force === true });
354
354
  treeResults.push(result);
355
- conflicts.push(...result.conflicts.map((reason: any) => `${asset.id}: ${reason}`));
355
+ conflicts.push(...result.conflicts.map((reason ) => `${asset.id}: ${reason}`));
356
356
  // A hand-edited file at a path DoFlow no longer writes is the user's: it stays, only its
357
357
  // ownership row is released.
358
- notices.push(...result.kept.map((item: any) => `kept hand-edited ${path.relative(context.paths.root, item.target)}; DoFlow no longer manages it`));
358
+ notices.push(...result.kept.map((item ) => `kept hand-edited ${path.relative(context.paths.root, item.target)}; DoFlow no longer manages it`));
359
359
  for (const change of result.changes) {
360
360
  changes.push({
361
361
  assetId: asset.id, target: change.target, source: change.source, operation: change.operation,
@@ -370,19 +370,19 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
370
370
  return { changes, conflicts, notices: [...siblingReplacedNotices(treeResults), ...notices] };
371
371
  }
372
372
 
373
- function applyCopyTreeAssets(changes: any) {
374
- const treeChanges = changes.filter((change: any) => change.projection?.renderer === 'copy-tree' && change.operation !== 'remove')
375
- .map((change: any) => ({ relPath: change.identity, target: change.target, source: change.source, operation: change.operation, fingerprint: change.fingerprint }));
373
+ function applyCopyTreeAssets(changes ) {
374
+ const treeChanges = changes.filter((change ) => change.projection?.renderer === 'copy-tree' && change.operation !== 'remove')
375
+ .map((change ) => ({ relPath: change.identity, target: change.target, source: change.source, operation: change.operation, fingerprint: change.fingerprint }));
376
376
  return applyTree({ changes: treeChanges }).applied;
377
377
  }
378
378
 
379
- function removeCopyTreeAssets(changes: any) {
380
- const treeChanges = changes.filter((change: any) => change.projection?.renderer === 'copy-tree' && change.operation === 'remove' && !change.retained)
381
- .map((change: any) => ({ relPath: change.identity, target: change.target, operation: 'remove', fingerprint: change.fingerprint, pruneGuard: change.pruneGuard }));
379
+ function removeCopyTreeAssets(changes ) {
380
+ const treeChanges = changes.filter((change ) => change.projection?.renderer === 'copy-tree' && change.operation === 'remove' && !change.retained)
381
+ .map((change ) => ({ relPath: change.identity, target: change.target, operation: 'remove', fingerprint: change.fingerprint, pruneGuard: change.pruneGuard }));
382
382
  return removeTree({ changes: treeChanges }).removed;
383
383
  }
384
384
 
385
- function verifyCopyTreeAssets({ assets, context, repoRoot, sourceVersion, plannedWrites }: any) {
385
+ function verifyCopyTreeAssets({ assets, context, repoRoot, sourceVersion, plannedWrites } ) {
386
386
  const statuses = [];
387
387
  const resources = [];
388
388
  const conflicts = [];
@@ -390,7 +390,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
390
390
  const destDir = copyTreeDestDir(codexConfigDir(context), asset);
391
391
  const sourceDir = sourceDirFor(asset, repoRoot);
392
392
  const result = verifyTree({ sourceDir, destDir, layout: asset.layout, plannedWrites });
393
- conflicts.push(...result.conflicts.map((reason: any) => `${asset.id}: ${reason}`));
393
+ conflicts.push(...result.conflicts.map((reason ) => `${asset.id}: ${reason}`));
394
394
  for (const resource of result.resources) {
395
395
  resources.push({
396
396
  assetId: asset.id, target: resource.target, ownershipIdentity: `doflow:codex:copy-tree:${asset.id}:${resource.relPath}`,
@@ -408,11 +408,11 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
408
408
  * callers may still use legacy option names; lifecycle callers pass `assets`,
409
409
  * `mcp`, `policies`, and optionally `projection` for source-bearing surfaces.
410
410
  * Native source paths are never guessed from an asset's renderer. */
411
- function projectedNativeOptions(options: any) {
411
+ function projectedNativeOptions(options ) {
412
412
  const projection = options.projection || {};
413
413
  const configResources = projection.configResources ?? options.configResources ?? options.context?.codexConfigResources;
414
414
  const mcpCatalog = projection.mcp?.catalog ?? options.mcpCatalog ?? options.mcp ?? [];
415
- const selectedMcp = projection.mcp?.selected ?? options.selectedMcp ?? (options.mcp ? options.mcp.map((server: any) => server.id) : undefined);
415
+ const selectedMcp = projection.mcp?.selected ?? options.selectedMcp ?? (options.mcp ? options.mcp.map((server ) => server.id) : undefined);
416
416
  const agentsSourceDir = projection.agents?.sourceDir ?? options.agentsSourceDir ?? options.context?.codexAgentsSourceDir;
417
417
  const hooksSourceFile = projection.hooks?.sourceFile ?? options.hooksSourceFile ?? options.context?.codexHooksSourceFile;
418
418
  const hooksSourceDir = projection.hooks?.sourceHooksDir ?? options.hooksSourceDir ?? options.context?.codexHooksSourceDir;
@@ -421,7 +421,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
421
421
  return { configResources, mcpCatalog, selectedMcp, agentsSourceDir, hooksSourceFile, hooksSourceDir, hooksConfig, hooksTrusted };
422
422
  }
423
423
 
424
- function planConfigComponent({ native, neutralResources, context, configFile, removing, adopt = false }: any) {
424
+ function planConfigComponent({ native, neutralResources, context, configFile, removing, adopt = false } ) {
425
425
  if (native.configResources === undefined) return undefined;
426
426
  const managedResources = nativeManagedResources(neutralResources, context, { kind: 'configuration-entry', target: configFile });
427
427
  const component = planCodexConfig({ file: configFile, scope: context.scope, managedResources, desiredResources: removing ? [] : native.configResources, adopt: !removing && adopt });
@@ -433,7 +433,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
433
433
  return component;
434
434
  }
435
435
 
436
- function planMcpComponent({ native, neutralResources, context, configFile, removing, options }: any) {
436
+ function planMcpComponent({ native, neutralResources, context, configFile, removing, options } ) {
437
437
  if (native.selectedMcp === undefined) return undefined;
438
438
  const catalog = nativeMcpCatalog(native.mcpCatalog);
439
439
  const managedResources = nativeManagedResources(neutralResources, context, { kind: 'mcp-server', target: configFile });
@@ -445,7 +445,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
445
445
  /** Codex hooks.json is only replaced when the file on disk still matches the ledger's last-known
446
446
  * fingerprint — a foreign edit (or a record the ledger never owned) downgrades an otherwise-clean
447
447
  * plan to a conflict rather than silently overwriting it. */
448
- function planHooksComponent({ native, neutralResources, context, adopt = false }: any) {
448
+ function planHooksComponent({ native, neutralResources, context, adopt = false } ) {
449
449
  let hooks = planCodexHooks({ config: native.hooksConfig, sourceFile: native.hooksSourceFile,
450
450
  sourceHooksDir: native.hooksSourceDir, trusted: native.hooksTrusted, destinationContext: context });
451
451
  const hooksFile = hooks.destination;
@@ -466,7 +466,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
466
466
 
467
467
  /** Agents/hooks share one removing-vs-planning fork: removal always owns both via the neutral
468
468
  * ledger's own records, regardless of what native input the caller provided this run. */
469
- function planAgentsAndHooksComponents({ native, neutralResources, context, agentsDirectory, removing, options, adopt = false }: any) {
469
+ function planAgentsAndHooksComponents({ native, neutralResources, context, agentsDirectory, removing, options, adopt = false } ) {
470
470
  if (removing) {
471
471
  return {
472
472
  agents: ownedRemovalPlan(neutralResources, context, 'custom-agent', agentsDirectory),
@@ -475,7 +475,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
475
475
  scriptsDir: native.hooksSourceDir, destinationHooksDir: context.paths.hooksDirectory },
476
476
  };
477
477
  }
478
- const components: Record<string, any> = {};
478
+ const components = {};
479
479
  if (native.agentsSourceDir !== undefined) {
480
480
  const managedResources = nativeManagedResources(neutralResources, context, { kind: 'custom-agent', directory: agentsDirectory });
481
481
  // `...context` is the NARROW native context (scope/codexDir/paths) and carries no adopt, so
@@ -493,7 +493,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
493
493
  * its desired input, which prevents a generic plan from accidentally removing
494
494
  * an owned configuration entry or MCP server merely because it was omitted.
495
495
  */
496
- function plan(options: any) {
496
+ function plan(options ) {
497
497
  const context = nativeContext(options);
498
498
  const removing = options.context?.operation === 'remove';
499
499
  const ledgerRows = options.managedResources || options.ledger?.resources || [];
@@ -501,7 +501,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
501
501
  const native = projectedNativeOptions(options);
502
502
  const configFile = context.paths.configFile;
503
503
  const agentsDirectory = context.paths.agentsDirectory;
504
- const components: Record<string, any> = {};
504
+ const components = {};
505
505
  // `options.context` is the lifecycle context; `context` is this adapter's narrow native one.
506
506
  // copyTree below already reads force off the former — adopt is read the same way.
507
507
  const adopt = options.context?.adopt === true;
@@ -514,7 +514,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
514
514
  repoRoot: options.context?.repoRoot, sourceVersion: options.sourceVersion ?? options.context?.sourceVersion,
515
515
  force: options.context?.force === true });
516
516
  const instructions = planInstructionsAsset({ assets: options.assets, context, removing, repoRoot: options.context?.repoRoot,
517
- claimedElsewhere: (target: any) => claimedByOtherScope(ledgerRows, context, target) });
517
+ claimedElsewhere: (target ) => claimedByOtherScope(ledgerRows, context, target) });
518
518
  // Two pseudo-components: their changes are already in final adapter shape (unlike the other
519
519
  // components' native shape, which addChanges() below converts), so they're appended to `changes`
520
520
  // directly rather than run through addChanges. Registering them in `components` still gets their
@@ -522,8 +522,8 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
522
522
  // adapterConflicts() component scan, with no special-casing needed in either.
523
523
  components.copyTree = { ok: copyTree.conflicts.length === 0, conflicts: copyTree.conflicts };
524
524
  components.instructions = { ok: instructions.conflicts.length === 0, conflicts: instructions.conflicts };
525
- const failures = Object.entries(components).filter(([, component]: [string, any]) => !component.ok);
526
- const changes: any[] = [];
525
+ const failures = Object.entries(components).filter(([, component] ) => !component.ok);
526
+ const changes = [];
527
527
  addChanges(changes, assetIdFor(options, 'config'), components.config, 'config');
528
528
  addChanges(changes, assetIdFor(options, 'mcp'), components.mcp, 'mcp');
529
529
  addChanges(changes, assetIdFor(options, 'agents'), components.agents, 'agents');
@@ -531,7 +531,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
531
531
  changes.push(...copyTree.changes, ...instructions.changes);
532
532
  if (removing) changes.push(...retainedRemovals(ledgerRows, context));
533
533
  const requiredNativeResources = [
534
- ...Object.entries(components).flatMap(([component, result]: [string, any]) => (result.changes || []).map((change: any) => ({
534
+ ...Object.entries(components).flatMap(([component, result] ) => (result.changes || []).map((change ) => ({
535
535
  harness: HARNESS, component, target: change.target ?? change.file ?? result.file ?? result.destination ?? result.directory,
536
536
  operation: change.operation ?? change.type, identity: change.identity ?? null,
537
537
  }))),
@@ -545,7 +545,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
545
545
  /** Apply only native plans emitted by this adapter. MCP is first because it and
546
546
  * config.toml share a file; config is then re-planned over the MCP result so it
547
547
  * cannot overwrite an adjacent MCP table. */
548
- function apply({ changes = [], dryRun = false, scope, sourceVersion, recoveryRef }: any = {}) {
548
+ function apply({ changes = [], dryRun = false, scope, sourceVersion, recoveryRef } = {}) {
549
549
  const components = new Map();
550
550
  for (const change of changes) if (change?.nativeComponent && change.nativePlan) components.set(change.nativeComponent, change.nativePlan);
551
551
  let mcp = components.get('mcp');
@@ -576,7 +576,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
576
576
  /** Removal reuses the same fingerprint-checked native plans. Only config/MCP
577
577
  * plans generated with context.operation=remove contain safe removals; hooks
578
578
  * and agents are intentionally never blindly deleted. */
579
- function remove({ changes = [], dryRun = false }: any = {}) {
579
+ function remove({ changes = [], dryRun = false } = {}) {
580
580
  const result = apply({ changes, dryRun });
581
581
  const direct = new Map();
582
582
  for (const change of changes) if (change?.nativePlan?.directRemove) direct.set(change.target, change);
@@ -586,13 +586,13 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
586
586
  if (current !== change.fingerprint) throw new Error(`Refusing to remove modified Codex resource '${change.identity}'`);
587
587
  if (!dryRun) fs.unlinkSync(change.target);
588
588
  }
589
- const hooksPlan = changes.find((change: any) => change?.nativeComponent === 'hooks' && change.nativePlan?.directRemove)?.nativePlan;
589
+ const hooksPlan = changes.find((change ) => change?.nativeComponent === 'hooks' && change.nativePlan?.directRemove)?.nativePlan;
590
590
  if (hooksPlan) removeCodexHookScripts(hooksPlan, { dryRun });
591
591
  if (!dryRun) removeInstructionsAsset(changes);
592
- return { ...result, removed: changes.filter((change: any) => (change.operation ?? change.type) === 'remove').length };
592
+ return { ...result, removed: changes.filter((change ) => (change.operation ?? change.type) === 'remove').length };
593
593
  }
594
594
 
595
- function verifyConfigResources({ native, parsed, context, options, sourceVersion, recoveryRef }: any) {
595
+ function verifyConfigResources({ native, parsed, context, options, sourceVersion, recoveryRef } ) {
596
596
  const statuses = []; const resources = [];
597
597
  for (const resource of native.configResources || []) {
598
598
  const entry = parsed?.entries.get(resource.identity);
@@ -607,7 +607,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
607
607
 
608
608
  /** A server is recorded only when its table now holds DoFlow's rendering. One discovery found as
609
609
  * the user's at plan time is reported `not-managed` and never recorded, even when its bytes match. */
610
- function verifyMcpResources({ native, configText, context, options, sourceVersion, recoveryRef }: any) {
610
+ function verifyMcpResources({ native, configText, context, options, sourceVersion, recoveryRef } ) {
611
611
  const statuses = []; const resources = [];
612
612
  const catalog = nativeMcpCatalog(native.mcpCatalog);
613
613
  const userDefined = new Set(options.discovery?.mcpUserDefined || []);
@@ -625,8 +625,8 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
625
625
  return { statuses, resources };
626
626
  }
627
627
 
628
- function verifyAgentResources({ native, context, options, sourceVersion, recoveryRef }: any) {
629
- const statuses: any[] = []; const resources: any[] = [];
628
+ function verifyAgentResources({ native, context, options, sourceVersion, recoveryRef } ) {
629
+ const statuses = []; const resources = [];
630
630
  if (!native.agentsSourceDir) return { statuses, resources };
631
631
  for (const agent of discoverCodexAgents(native.agentsSourceDir)) {
632
632
  const target = path.join(agentDirectory(context), agent.fileName);
@@ -640,8 +640,8 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
640
640
  return { statuses, resources };
641
641
  }
642
642
 
643
- function verifyHooksResource({ native, context, options, sourceVersion, recoveryRef }: any) {
644
- const statuses: any[] = []; const resources: any[] = []; const conflicts: any[] = [];
643
+ function verifyHooksResource({ native, context, options, sourceVersion, recoveryRef } ) {
644
+ const statuses = []; const resources = []; const conflicts = [];
645
645
  if (!native.hooksSourceFile && !native.hooksConfig) return { statuses, resources, conflicts };
646
646
  const hooks = planCodexHooks({ config: native.hooksConfig, sourceFile: native.hooksSourceFile, sourceHooksDir: native.hooksSourceDir,
647
647
  trusted: native.hooksTrusted, destinationContext: context });
@@ -654,11 +654,11 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
654
654
  return { statuses, resources, conflicts };
655
655
  }
656
656
 
657
- function verifyAssetRenderStatuses({ registry, assets }: any) {
658
- return assets.map((asset: any) => render({ registry, asset })).filter((rendered: any) => rendered.status !== 'renderable');
657
+ function verifyAssetRenderStatuses({ registry, assets } ) {
658
+ return assets.map((asset ) => render({ registry, asset })).filter((rendered ) => rendered.status !== 'renderable');
659
659
  }
660
660
 
661
- function verify(options: any = {}) {
661
+ function verify(options = {}) {
662
662
  const { registry, assets = [], plan: proposed } = options;
663
663
  const context = nativeContext(options);
664
664
  const native = projectedNativeOptions(options);
@@ -668,7 +668,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
668
668
  if (fs.existsSync(context.paths.configFile)) configText = fs.readFileSync(context.paths.configFile, 'utf8');
669
669
  let parsed;
670
670
  const conflicts = [];
671
- try { parsed = parseToml(configText); } catch (error: any) { conflicts.push(`Malformed Codex config: ${error.message}`); }
671
+ try { parsed = parseToml(configText); } catch (error ) { conflicts.push(`Malformed Codex config: ${error.message}`); }
672
672
 
673
673
  const shared = { context, options, sourceVersion, recoveryRef };
674
674
  const config = verifyConfigResources({ native, parsed, ...shared });
@@ -685,7 +685,7 @@ function createCodexAdapter({ declaredPaths = declaredHarnessPaths()[HARNESS] }
685
685
  ];
686
686
  const resources = [...config.resources, ...mcp.resources, ...agents.resources, ...hooks.resources, ...copyTree.resources, ...instructions.resources];
687
687
  conflicts.push(...hooks.conflicts, ...copyTree.conflicts);
688
- const componentFailures = Object.values<any>(proposed?.components || {}).filter((component) => !component.ok);
688
+ const componentFailures = Object.values (proposed?.components || {}).filter((component) => !component.ok);
689
689
  for (const component of componentFailures) conflicts.push(...(component.conflicts || component.errors || []));
690
690
 
691
691
  return { ok: conflicts.length === 0 && statuses.every((status) => status.status !== 'missing' && status.status !== 'conflict'), resources, statuses, conflicts };