devworkspace 0.5.0 → 0.5.2

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 (384) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +57 -509
  3. package/dist/agents/claude/adapter.js +0 -1
  4. package/dist/agents/claude/content.js +0 -1
  5. package/dist/agents/codex/adapter.js +0 -1
  6. package/dist/agents/copilot/adapter.js +0 -1
  7. package/dist/agents/cursor/adapter.js +0 -1
  8. package/dist/agents/index.js +0 -1
  9. package/dist/agents/shared.js +0 -1
  10. package/dist/agents/types.js +0 -1
  11. package/dist/cli/args.d.ts +16 -0
  12. package/dist/cli/args.js +5 -1
  13. package/dist/cli/help.js +59 -17
  14. package/dist/cli/main.js +0 -1
  15. package/dist/cli/prompt.d.ts +15 -0
  16. package/dist/cli/prompt.js +113 -0
  17. package/dist/cli/render.d.ts +10 -0
  18. package/dist/cli/render.js +174 -4
  19. package/dist/cli/run.d.ts +3 -0
  20. package/dist/cli/run.js +366 -17
  21. package/dist/config/feature-gate.d.ts +15 -0
  22. package/dist/config/feature-gate.js +77 -0
  23. package/dist/config/feature-registry.d.ts +49 -0
  24. package/dist/config/feature-registry.js +451 -0
  25. package/dist/config/schemas.js +0 -1
  26. package/dist/config/settings.d.ts +54 -0
  27. package/dist/config/settings.js +293 -0
  28. package/dist/config/validate.js +0 -1
  29. package/dist/core/artifacts.js +0 -1
  30. package/dist/core/contracts.js +0 -1
  31. package/dist/core/migrations.js +0 -1
  32. package/dist/core/version.js +0 -1
  33. package/dist/core/versioned.js +0 -1
  34. package/dist/core/workspace.d.ts +1 -0
  35. package/dist/core/workspace.js +1 -1
  36. package/dist/decisions/decision.js +0 -1
  37. package/dist/discovery/cache.js +0 -1
  38. package/dist/discovery/commands.js +0 -1
  39. package/dist/discovery/detect.js +0 -1
  40. package/dist/discovery/docs.js +0 -1
  41. package/dist/discovery/entrypoints.js +0 -1
  42. package/dist/discovery/ignore.js +0 -1
  43. package/dist/discovery/scan.js +0 -1
  44. package/dist/discovery/types.js +0 -1
  45. package/dist/dx/dashboard.js +2 -1
  46. package/dist/dx/guidance.js +0 -1
  47. package/dist/dx/guided-setup.d.ts +102 -0
  48. package/dist/dx/guided-setup.js +508 -0
  49. package/dist/dx/index.js +0 -1
  50. package/dist/dx/onboarding.js +0 -1
  51. package/dist/dx/types.js +0 -1
  52. package/dist/errors/index.js +0 -1
  53. package/dist/features/schema.js +0 -1
  54. package/dist/features/types.js +0 -1
  55. package/dist/features/validate.js +0 -1
  56. package/dist/git/git.js +0 -1
  57. package/dist/index.d.ts +15 -5
  58. package/dist/index.js +10 -2
  59. package/dist/integrations/adapters/agent-skills.js +0 -1
  60. package/dist/integrations/adapters/claudePlugin.js +0 -1
  61. package/dist/integrations/adapters/graphify.js +0 -1
  62. package/dist/integrations/adapters/omniroute.js +0 -1
  63. package/dist/integrations/adapters/pluginSkill.js +0 -1
  64. package/dist/integrations/adapters/ponytail.js +0 -1
  65. package/dist/integrations/exec.js +0 -1
  66. package/dist/integrations/index.js +0 -1
  67. package/dist/integrations/manager.d.ts +2 -1
  68. package/dist/integrations/manager.js +22 -3
  69. package/dist/integrations/notices.js +0 -1
  70. package/dist/integrations/persistentPath.js +0 -1
  71. package/dist/integrations/protect.js +0 -1
  72. package/dist/integrations/state.js +0 -1
  73. package/dist/integrations/types.d.ts +1 -1
  74. package/dist/integrations/types.js +1 -1
  75. package/dist/intelligence/agents/profiles.js +0 -1
  76. package/dist/intelligence/agents/registry.js +0 -1
  77. package/dist/intelligence/agents/types.js +0 -1
  78. package/dist/intelligence/observability/tracer.js +0 -1
  79. package/dist/intelligence/observability/types.js +0 -1
  80. package/dist/intelligence/orchestration/engine.d.ts +21 -3
  81. package/dist/intelligence/orchestration/engine.js +486 -48
  82. package/dist/intelligence/orchestration/lock-manager.js +0 -1
  83. package/dist/intelligence/orchestration/store.js +0 -1
  84. package/dist/intelligence/orchestration/types.d.ts +40 -2
  85. package/dist/intelligence/orchestration/types.js +2 -3
  86. package/dist/intelligence/routing/matcher.js +0 -1
  87. package/dist/intelligence/routing/router.js +0 -1
  88. package/dist/intelligence/routing/types.js +0 -1
  89. package/dist/intelligence/runtime/adk/adapter.js +21 -33
  90. package/dist/intelligence/runtime/adk/detector.js +0 -1
  91. package/dist/intelligence/runtime/auth-provider.d.ts +63 -0
  92. package/dist/intelligence/runtime/auth-provider.js +201 -0
  93. package/dist/intelligence/runtime/boundary.d.ts +142 -0
  94. package/dist/intelligence/runtime/boundary.js +845 -0
  95. package/dist/intelligence/runtime/changes.d.ts +59 -0
  96. package/dist/intelligence/runtime/changes.js +362 -0
  97. package/dist/intelligence/runtime/external.d.ts +1 -0
  98. package/dist/intelligence/runtime/external.js +38 -61
  99. package/dist/intelligence/runtime/native.js +23 -56
  100. package/dist/intelligence/runtime/types.d.ts +91 -1
  101. package/dist/intelligence/runtime/types.js +11 -2
  102. package/dist/intelligence/security/audit.js +8 -2
  103. package/dist/intelligence/security/policy.js +0 -1
  104. package/dist/intelligence/security/types.d.ts +8 -0
  105. package/dist/intelligence/security/types.js +0 -1
  106. package/dist/intelligence/skills/builtins.js +0 -1
  107. package/dist/intelligence/skills/loader.js +0 -1
  108. package/dist/intelligence/skills/registry.js +0 -1
  109. package/dist/intelligence/skills/types.js +0 -1
  110. package/dist/intelligence/verification/engine.d.ts +30 -8
  111. package/dist/intelligence/verification/engine.js +126 -21
  112. package/dist/intelligence/verification/reviewer.d.ts +18 -2
  113. package/dist/intelligence/verification/reviewer.js +356 -4
  114. package/dist/intelligence/verification/types.d.ts +71 -0
  115. package/dist/intelligence/verification/types.js +0 -1
  116. package/dist/knowledge/facts.js +0 -1
  117. package/dist/mcp/protocol.js +0 -1
  118. package/dist/mcp/server.js +38 -2
  119. package/dist/mcp/setup.js +5 -2
  120. package/dist/mcp/tools.js +0 -1
  121. package/dist/mcp/types.js +0 -1
  122. package/dist/mcp/verify.js +0 -1
  123. package/dist/portability/bundle.js +0 -1
  124. package/dist/prompts/onboarding.js +0 -1
  125. package/dist/prompts/refresh.js +0 -1
  126. package/dist/prompts/requirements.js +0 -1
  127. package/dist/security/files.js +0 -1
  128. package/dist/security/redact.js +0 -1
  129. package/dist/services/agent.js +2 -1
  130. package/dist/services/analysis.js +0 -1
  131. package/dist/services/common.js +0 -1
  132. package/dist/services/doctor.js +13 -2
  133. package/dist/services/drift.js +0 -1
  134. package/dist/services/features.js +5 -1
  135. package/dist/services/graph.js +4 -1
  136. package/dist/services/init.js +0 -1
  137. package/dist/services/integrations.d.ts +2 -1
  138. package/dist/services/integrations.js +29 -6
  139. package/dist/services/intelligence.d.ts +2 -2
  140. package/dist/services/intelligence.js +38 -36
  141. package/dist/services/knowledge.js +0 -1
  142. package/dist/services/migrate.js +0 -1
  143. package/dist/services/modules.d.ts +85 -0
  144. package/dist/services/modules.js +313 -0
  145. package/dist/services/portability.js +0 -1
  146. package/dist/services/records.js +5 -1
  147. package/dist/services/refresh.js +0 -1
  148. package/dist/services/reset.js +0 -1
  149. package/dist/services/settings.d.ts +36 -0
  150. package/dist/services/settings.js +102 -0
  151. package/dist/services/setup.d.ts +4 -5
  152. package/dist/services/setup.js +40 -28
  153. package/dist/services/standards.js +10 -1
  154. package/dist/services/status.js +0 -1
  155. package/dist/services/taskContext.js +0 -1
  156. package/dist/services/tasks.js +9 -1
  157. package/dist/services/verify.js +7 -2
  158. package/dist/sessions/session.js +0 -1
  159. package/dist/standards/acquisition/ingest.js +0 -1
  160. package/dist/standards/applicability/engine.js +0 -1
  161. package/dist/standards/builtin/code-quality.js +0 -1
  162. package/dist/standards/builtin/database-safety.js +0 -1
  163. package/dist/standards/builtin/index.js +0 -1
  164. package/dist/standards/builtin/security-baseline.js +0 -1
  165. package/dist/standards/builtin/testing-contracts.js +0 -1
  166. package/dist/standards/builtin/undo-kit.js +0 -1
  167. package/dist/standards/config/config.js +0 -1
  168. package/dist/standards/distribution/cache.d.ts +1 -0
  169. package/dist/standards/distribution/cache.js +199 -186
  170. package/dist/standards/distribution/index.js +0 -1
  171. package/dist/standards/distribution/keys.js +0 -1
  172. package/dist/standards/distribution/package.js +6 -1
  173. package/dist/standards/distribution/server.js +0 -1
  174. package/dist/standards/distribution/sync.d.ts +7 -2
  175. package/dist/standards/distribution/sync.js +41 -9
  176. package/dist/standards/distribution/types.js +0 -1
  177. package/dist/standards/engine/compliance.js +0 -1
  178. package/dist/standards/engine/engine.js +0 -1
  179. package/dist/standards/engine/reporter.js +0 -1
  180. package/dist/standards/index.js +0 -1
  181. package/dist/standards/registry/registry.js +0 -1
  182. package/dist/standards/schema/types.js +0 -1
  183. package/dist/standards/schema/validate.js +0 -1
  184. package/dist/standards/templates/index.js +0 -1
  185. package/dist/standards/validators/database.js +0 -1
  186. package/dist/standards/validators/quality.js +0 -1
  187. package/dist/standards/validators/registry.js +0 -1
  188. package/dist/standards/validators/security.js +0 -1
  189. package/dist/standards/validators/testing.js +0 -1
  190. package/dist/standards/validators/types.js +0 -1
  191. package/dist/standards/validators/undo-kit.js +0 -1
  192. package/dist/tasks/routing.js +0 -1
  193. package/dist/tasks/task.js +0 -1
  194. package/dist/utils/cleanup.js +0 -1
  195. package/dist/utils/fs.js +0 -1
  196. package/dist/utils/lock.js +92 -49
  197. package/dist/utils/logger.js +0 -1
  198. package/dist/utils/paths.js +0 -1
  199. package/dist/utils/proc.d.ts +12 -0
  200. package/dist/utils/proc.js +106 -44
  201. package/dist/verification/safety.js +0 -1
  202. package/dist/verification/scope.js +0 -1
  203. package/docs/agents.md +15 -0
  204. package/docs/architecture/global-standards-architecture.md +287 -0
  205. package/docs/archive/global-standards/GLOBAL_STANDARDS_AUDIT.md +99 -0
  206. package/docs/archive/global-standards/GLOBAL_STANDARDS_FINAL_STATUS.md +138 -0
  207. package/docs/archive/global-standards/GLOBAL_STANDARDS_IMPLEMENTATION_PLAN.md +100 -0
  208. package/docs/archive/global-standards/GLOBAL_STANDARDS_INDEPENDENT_AUDIT.md +219 -0
  209. package/docs/archive/global-standards/GLOBAL_STANDARDS_SECURITY_REPORT.md +184 -0
  210. package/docs/configuration.md +67 -0
  211. package/docs/contributing.md +15 -5
  212. package/docs/development/EXECUTION_STATE.md +50 -0
  213. package/docs/features.md +80 -0
  214. package/docs/getting-started.md +69 -111
  215. package/docs/guides/global-standards-migration.md +100 -0
  216. package/docs/integrations.md +7 -0
  217. package/docs/mcp.md +13 -0
  218. package/docs/security/THIRD_PARTY_LICENSES.md +41 -0
  219. package/docs/security.md +8 -2
  220. package/docs/testing/FINAL_CORRECTION_AND_CLEANUP_REPORT.md +92 -0
  221. package/docs/testing/global-standards-real-project-tests.md +218 -0
  222. package/docs/testing/global-standards-test-report.md +89 -0
  223. package/docs/testing/global-standards-verification-matrix.md +174 -0
  224. package/docs/troubleshooting.md +3 -0
  225. package/package.json +1 -1
  226. package/dist/agents/claude/adapter.js.map +0 -1
  227. package/dist/agents/claude/content.js.map +0 -1
  228. package/dist/agents/codex/adapter.js.map +0 -1
  229. package/dist/agents/copilot/adapter.js.map +0 -1
  230. package/dist/agents/cursor/adapter.js.map +0 -1
  231. package/dist/agents/index.js.map +0 -1
  232. package/dist/agents/shared.js.map +0 -1
  233. package/dist/agents/types.js.map +0 -1
  234. package/dist/cli/args.js.map +0 -1
  235. package/dist/cli/help.js.map +0 -1
  236. package/dist/cli/main.js.map +0 -1
  237. package/dist/cli/render.js.map +0 -1
  238. package/dist/cli/run.js.map +0 -1
  239. package/dist/config/schemas.js.map +0 -1
  240. package/dist/config/validate.js.map +0 -1
  241. package/dist/core/artifacts.js.map +0 -1
  242. package/dist/core/contracts.js.map +0 -1
  243. package/dist/core/migrations.js.map +0 -1
  244. package/dist/core/version.js.map +0 -1
  245. package/dist/core/versioned.js.map +0 -1
  246. package/dist/core/workspace.js.map +0 -1
  247. package/dist/decisions/decision.js.map +0 -1
  248. package/dist/discovery/cache.js.map +0 -1
  249. package/dist/discovery/commands.js.map +0 -1
  250. package/dist/discovery/detect.js.map +0 -1
  251. package/dist/discovery/docs.js.map +0 -1
  252. package/dist/discovery/entrypoints.js.map +0 -1
  253. package/dist/discovery/ignore.js.map +0 -1
  254. package/dist/discovery/scan.js.map +0 -1
  255. package/dist/discovery/types.js.map +0 -1
  256. package/dist/dx/dashboard.js.map +0 -1
  257. package/dist/dx/guidance.js.map +0 -1
  258. package/dist/dx/index.js.map +0 -1
  259. package/dist/dx/onboarding.js.map +0 -1
  260. package/dist/dx/types.js.map +0 -1
  261. package/dist/errors/index.js.map +0 -1
  262. package/dist/features/schema.js.map +0 -1
  263. package/dist/features/types.js.map +0 -1
  264. package/dist/features/validate.js.map +0 -1
  265. package/dist/git/git.js.map +0 -1
  266. package/dist/index.js.map +0 -1
  267. package/dist/integrations/adapters/agent-skills.js.map +0 -1
  268. package/dist/integrations/adapters/claudePlugin.js.map +0 -1
  269. package/dist/integrations/adapters/graphify.js.map +0 -1
  270. package/dist/integrations/adapters/omniroute.js.map +0 -1
  271. package/dist/integrations/adapters/pluginSkill.js.map +0 -1
  272. package/dist/integrations/adapters/ponytail.js.map +0 -1
  273. package/dist/integrations/exec.js.map +0 -1
  274. package/dist/integrations/index.js.map +0 -1
  275. package/dist/integrations/manager.js.map +0 -1
  276. package/dist/integrations/notices.js.map +0 -1
  277. package/dist/integrations/persistentPath.js.map +0 -1
  278. package/dist/integrations/protect.js.map +0 -1
  279. package/dist/integrations/state.js.map +0 -1
  280. package/dist/integrations/types.js.map +0 -1
  281. package/dist/intelligence/agents/profiles.js.map +0 -1
  282. package/dist/intelligence/agents/registry.js.map +0 -1
  283. package/dist/intelligence/agents/types.js.map +0 -1
  284. package/dist/intelligence/observability/tracer.js.map +0 -1
  285. package/dist/intelligence/observability/types.js.map +0 -1
  286. package/dist/intelligence/orchestration/engine.js.map +0 -1
  287. package/dist/intelligence/orchestration/lock-manager.js.map +0 -1
  288. package/dist/intelligence/orchestration/store.js.map +0 -1
  289. package/dist/intelligence/orchestration/types.js.map +0 -1
  290. package/dist/intelligence/routing/matcher.js.map +0 -1
  291. package/dist/intelligence/routing/router.js.map +0 -1
  292. package/dist/intelligence/routing/types.js.map +0 -1
  293. package/dist/intelligence/runtime/adk/adapter.js.map +0 -1
  294. package/dist/intelligence/runtime/adk/detector.js.map +0 -1
  295. package/dist/intelligence/runtime/external.js.map +0 -1
  296. package/dist/intelligence/runtime/native.js.map +0 -1
  297. package/dist/intelligence/runtime/types.js.map +0 -1
  298. package/dist/intelligence/security/audit.js.map +0 -1
  299. package/dist/intelligence/security/policy.js.map +0 -1
  300. package/dist/intelligence/security/types.js.map +0 -1
  301. package/dist/intelligence/skills/builtins.js.map +0 -1
  302. package/dist/intelligence/skills/loader.js.map +0 -1
  303. package/dist/intelligence/skills/registry.js.map +0 -1
  304. package/dist/intelligence/skills/types.js.map +0 -1
  305. package/dist/intelligence/verification/engine.js.map +0 -1
  306. package/dist/intelligence/verification/reviewer.js.map +0 -1
  307. package/dist/intelligence/verification/types.js.map +0 -1
  308. package/dist/knowledge/facts.js.map +0 -1
  309. package/dist/mcp/protocol.js.map +0 -1
  310. package/dist/mcp/server.js.map +0 -1
  311. package/dist/mcp/setup.js.map +0 -1
  312. package/dist/mcp/tools.js.map +0 -1
  313. package/dist/mcp/types.js.map +0 -1
  314. package/dist/mcp/verify.js.map +0 -1
  315. package/dist/portability/bundle.js.map +0 -1
  316. package/dist/prompts/onboarding.js.map +0 -1
  317. package/dist/prompts/refresh.js.map +0 -1
  318. package/dist/prompts/requirements.js.map +0 -1
  319. package/dist/security/files.js.map +0 -1
  320. package/dist/security/redact.js.map +0 -1
  321. package/dist/services/agent.js.map +0 -1
  322. package/dist/services/analysis.js.map +0 -1
  323. package/dist/services/common.js.map +0 -1
  324. package/dist/services/doctor.js.map +0 -1
  325. package/dist/services/drift.js.map +0 -1
  326. package/dist/services/features.js.map +0 -1
  327. package/dist/services/graph.js.map +0 -1
  328. package/dist/services/init.js.map +0 -1
  329. package/dist/services/integrations.js.map +0 -1
  330. package/dist/services/intelligence.js.map +0 -1
  331. package/dist/services/knowledge.js.map +0 -1
  332. package/dist/services/migrate.js.map +0 -1
  333. package/dist/services/portability.js.map +0 -1
  334. package/dist/services/records.js.map +0 -1
  335. package/dist/services/refresh.js.map +0 -1
  336. package/dist/services/reset.js.map +0 -1
  337. package/dist/services/setup.js.map +0 -1
  338. package/dist/services/standards.js.map +0 -1
  339. package/dist/services/status.js.map +0 -1
  340. package/dist/services/taskContext.js.map +0 -1
  341. package/dist/services/tasks.js.map +0 -1
  342. package/dist/services/verify.js.map +0 -1
  343. package/dist/sessions/session.js.map +0 -1
  344. package/dist/standards/acquisition/ingest.js.map +0 -1
  345. package/dist/standards/applicability/engine.js.map +0 -1
  346. package/dist/standards/builtin/code-quality.js.map +0 -1
  347. package/dist/standards/builtin/database-safety.js.map +0 -1
  348. package/dist/standards/builtin/index.js.map +0 -1
  349. package/dist/standards/builtin/security-baseline.js.map +0 -1
  350. package/dist/standards/builtin/testing-contracts.js.map +0 -1
  351. package/dist/standards/builtin/undo-kit.js.map +0 -1
  352. package/dist/standards/config/config.js.map +0 -1
  353. package/dist/standards/distribution/cache.js.map +0 -1
  354. package/dist/standards/distribution/index.js.map +0 -1
  355. package/dist/standards/distribution/keys.js.map +0 -1
  356. package/dist/standards/distribution/package.js.map +0 -1
  357. package/dist/standards/distribution/server.js.map +0 -1
  358. package/dist/standards/distribution/sync.js.map +0 -1
  359. package/dist/standards/distribution/types.js.map +0 -1
  360. package/dist/standards/engine/compliance.js.map +0 -1
  361. package/dist/standards/engine/engine.js.map +0 -1
  362. package/dist/standards/engine/reporter.js.map +0 -1
  363. package/dist/standards/index.js.map +0 -1
  364. package/dist/standards/registry/registry.js.map +0 -1
  365. package/dist/standards/schema/types.js.map +0 -1
  366. package/dist/standards/schema/validate.js.map +0 -1
  367. package/dist/standards/templates/index.js.map +0 -1
  368. package/dist/standards/validators/database.js.map +0 -1
  369. package/dist/standards/validators/quality.js.map +0 -1
  370. package/dist/standards/validators/registry.js.map +0 -1
  371. package/dist/standards/validators/security.js.map +0 -1
  372. package/dist/standards/validators/testing.js.map +0 -1
  373. package/dist/standards/validators/types.js.map +0 -1
  374. package/dist/standards/validators/undo-kit.js.map +0 -1
  375. package/dist/tasks/routing.js.map +0 -1
  376. package/dist/tasks/task.js.map +0 -1
  377. package/dist/utils/cleanup.js.map +0 -1
  378. package/dist/utils/fs.js.map +0 -1
  379. package/dist/utils/lock.js.map +0 -1
  380. package/dist/utils/logger.js.map +0 -1
  381. package/dist/utils/paths.js.map +0 -1
  382. package/dist/utils/proc.js.map +0 -1
  383. package/dist/verification/safety.js.map +0 -1
  384. package/dist/verification/scope.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ export interface WorkspaceRename {
2
+ from: string;
3
+ to: string;
4
+ }
5
+ export interface WorkspaceSymlinkEntry {
6
+ path: string;
7
+ linkTarget: string;
8
+ resolvedTarget?: string;
9
+ external: boolean;
10
+ dangling: boolean;
11
+ }
12
+ export interface WorkspaceChangeManifest {
13
+ created: string[];
14
+ modified: string[];
15
+ deleted: string[];
16
+ renamed: WorkspaceRename[];
17
+ /** Sorted relative paths currently present and created/modified/renamed by execution. */
18
+ changedFiles: string[];
19
+ /** Symlinks observed across before/after workspace snapshots with target provenance. */
20
+ symlinksObserved?: WorkspaceSymlinkEntry[];
21
+ /** Relative paths of external or unresolvable symlinks detected in workspace. */
22
+ externalSymlinks?: string[];
23
+ /** True only when before and after workspace snapshots scanned every reachable entry without truncation, read errors, or unsafe symlinks. */
24
+ snapshotComplete: boolean;
25
+ /** Explicit reasons explaining why snapshot inspection was incomplete, if any. */
26
+ snapshotIncompleteReasons: string[];
27
+ }
28
+ export interface WorkspaceSnapshotResult {
29
+ files: Map<string, string>;
30
+ symlinks: WorkspaceSymlinkEntry[];
31
+ externalSymlinks: string[];
32
+ complete: boolean;
33
+ truncatedAtFileLimit: boolean;
34
+ maxFiles: number;
35
+ scannedFiles: number;
36
+ unreadableFiles: string[];
37
+ unreadableDirs: string[];
38
+ incompleteReasons: string[];
39
+ }
40
+ export interface CaptureWorkspaceSnapshotOptions {
41
+ maxFiles?: number;
42
+ /** Optional hook for deterministic unreadable-file testing across platforms. */
43
+ readFileHashFn?: (fullPath: string, size: number) => Promise<string>;
44
+ }
45
+ export declare const MAX_SNAPSHOT_FILE_BYTES: number;
46
+ export declare const DEFAULT_MAX_SNAPSHOT_FILES = 5000;
47
+ /**
48
+ * Capture a complete map of workspace-relative POSIX paths to SHA-256 digests plus completeness metadata.
49
+ * Marks snapshots incomplete whenever unreadable entries or the explicit maxFiles limit prevent full inspection.
50
+ */
51
+ export declare function captureWorkspaceSnapshotDetailed(workspaceRoot: string | undefined, options?: CaptureWorkspaceSnapshotOptions): Promise<WorkspaceSnapshotResult>;
52
+ /** Capture a deterministic map of workspace-relative POSIX paths to content hashes (skipping symlinks & generated dirs). */
53
+ export declare function captureWorkspaceSnapshot(workspaceRoot: string | undefined, options?: CaptureWorkspaceSnapshotOptions): Promise<Map<string, string>>;
54
+ /** Optionally query Git rename status when workspaceRoot is a Git repository. */
55
+ export declare function detectGitRenames(workspaceRoot: string | undefined): Promise<WorkspaceRename[]>;
56
+ /** Diff before/after workspace snapshots to record created, modified, deleted, and renamed files. */
57
+ export declare function diffWorkspaceSnapshots(before: Map<string, string> | WorkspaceSnapshotResult, after: Map<string, string> | WorkspaceSnapshotResult, gitRenames?: WorkspaceRename[]): WorkspaceChangeManifest;
58
+ /** Deterministic SHA-256 fingerprint of the current workspace file tree snapshot (including completeness metadata). */
59
+ export declare function hashWorkspaceSnapshot(snapshot: Map<string, string> | WorkspaceSnapshotResult): string;
@@ -0,0 +1,362 @@
1
+ import crypto from 'node:crypto';
2
+ import fsSync, { promises as fs } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { run } from '../../utils/proc.js';
5
+ import { isInside } from '../../utils/paths.js';
6
+ const IGNORED_DIRS = new Set(['.git', 'node_modules', '.devworkspace', 'dist', 'coverage']);
7
+ export const MAX_SNAPSHOT_FILE_BYTES = 1024 * 1024;
8
+ export const DEFAULT_MAX_SNAPSHOT_FILES = 5000;
9
+ async function streamSha256File(fullPath) {
10
+ return new Promise((resolve, reject) => {
11
+ const hash = crypto.createHash('sha256');
12
+ const stream = fsSync.createReadStream(fullPath);
13
+ stream.on('data', (chunk) => hash.update(chunk));
14
+ stream.on('error', reject);
15
+ stream.on('end', () => resolve(hash.digest('hex')));
16
+ });
17
+ }
18
+ async function hashFileEntry(fullPath) {
19
+ const st = await fs.lstat(fullPath);
20
+ if (st.size > MAX_SNAPSHOT_FILE_BYTES) {
21
+ // Stream large files (> 1 MB) incrementally to compute exact content SHA-256 rather than relying on size/mtime.
22
+ return streamSha256File(fullPath);
23
+ }
24
+ const buf = await fs.readFile(fullPath);
25
+ return crypto.createHash('sha256').update(buf).digest('hex');
26
+ }
27
+ /**
28
+ * Capture a complete map of workspace-relative POSIX paths to SHA-256 digests plus completeness metadata.
29
+ * Marks snapshots incomplete whenever unreadable entries or the explicit maxFiles limit prevent full inspection.
30
+ */
31
+ export async function captureWorkspaceSnapshotDetailed(workspaceRoot, options = {}) {
32
+ const maxFiles = Math.max(1, options.maxFiles ?? DEFAULT_MAX_SNAPSHOT_FILES);
33
+ const files = new Map();
34
+ const symlinks = [];
35
+ const externalSymlinks = [];
36
+ const unreadableFiles = [];
37
+ const unreadableDirs = [];
38
+ const incompleteReasons = [];
39
+ let truncatedAtFileLimit = false;
40
+ let scannedFiles = 0;
41
+ if (!workspaceRoot) {
42
+ incompleteReasons.push('Workspace root was not supplied for snapshot capture.');
43
+ return {
44
+ files,
45
+ symlinks,
46
+ externalSymlinks,
47
+ complete: false,
48
+ truncatedAtFileLimit: false,
49
+ maxFiles,
50
+ scannedFiles: 0,
51
+ unreadableFiles,
52
+ unreadableDirs,
53
+ incompleteReasons,
54
+ };
55
+ }
56
+ const root = path.resolve(workspaceRoot);
57
+ let realRoot = root;
58
+ try {
59
+ const rootStat = await fs.stat(root);
60
+ if (!rootStat.isDirectory()) {
61
+ incompleteReasons.push(`Workspace root "${workspaceRoot}" is not a directory.`);
62
+ return {
63
+ files,
64
+ symlinks,
65
+ externalSymlinks,
66
+ complete: false,
67
+ truncatedAtFileLimit: false,
68
+ maxFiles,
69
+ scannedFiles: 0,
70
+ unreadableFiles,
71
+ unreadableDirs,
72
+ incompleteReasons,
73
+ };
74
+ }
75
+ realRoot = await fs.realpath(root);
76
+ }
77
+ catch (err) {
78
+ unreadableDirs.push('.');
79
+ incompleteReasons.push(`Workspace root "${workspaceRoot}" cannot be read: ${err.message}`);
80
+ return {
81
+ files,
82
+ symlinks,
83
+ externalSymlinks,
84
+ complete: false,
85
+ truncatedAtFileLimit: false,
86
+ maxFiles,
87
+ scannedFiles: 0,
88
+ unreadableFiles,
89
+ unreadableDirs,
90
+ incompleteReasons,
91
+ };
92
+ }
93
+ async function walk(dir) {
94
+ if (truncatedAtFileLimit)
95
+ return;
96
+ let entries;
97
+ try {
98
+ entries = await fs.readdir(dir, { withFileTypes: true });
99
+ }
100
+ catch {
101
+ const relDir = path.relative(root, dir).replace(/\\/g, '/') || '.';
102
+ unreadableDirs.push(relDir);
103
+ return;
104
+ }
105
+ entries.sort((a, b) => a.name.localeCompare(b.name));
106
+ for (const e of entries) {
107
+ const full = path.join(dir, e.name);
108
+ const rel = path.relative(root, full).replace(/\\/g, '/');
109
+ if (e.isSymbolicLink()) {
110
+ if (IGNORED_DIRS.has(e.name))
111
+ continue;
112
+ if (files.size >= maxFiles) {
113
+ truncatedAtFileLimit = true;
114
+ return;
115
+ }
116
+ scannedFiles++;
117
+ let linkTarget;
118
+ try {
119
+ linkTarget = await fs.readlink(full);
120
+ }
121
+ catch {
122
+ unreadableFiles.push(rel);
123
+ continue;
124
+ }
125
+ let resolvedTarget;
126
+ let dangling = false;
127
+ let external;
128
+ try {
129
+ resolvedTarget = await fs.realpath(full);
130
+ external = !isInside(realRoot, resolvedTarget);
131
+ }
132
+ catch {
133
+ dangling = true;
134
+ external = true;
135
+ }
136
+ symlinks.push({ path: rel, linkTarget, resolvedTarget, external, dangling });
137
+ if (external || dangling) {
138
+ externalSymlinks.push(rel);
139
+ files.set(rel, `symlink:${linkTarget}->${dangling ? 'dangling' : resolvedTarget}`);
140
+ }
141
+ else if (resolvedTarget) {
142
+ const relTarget = path.relative(realRoot, resolvedTarget).replace(/\\/g, '/');
143
+ let targetDigest = 'dir';
144
+ let targetReadable = true;
145
+ try {
146
+ const targetStat = await fs.stat(resolvedTarget);
147
+ if (targetStat.isFile()) {
148
+ targetDigest = options.readFileHashFn
149
+ ? await options.readFileHashFn(resolvedTarget, targetStat.size)
150
+ : await hashFileEntry(resolvedTarget);
151
+ }
152
+ }
153
+ catch {
154
+ targetReadable = false;
155
+ externalSymlinks.push(rel);
156
+ }
157
+ files.set(rel, `symlink:${linkTarget}->${relTarget}:${targetReadable ? targetDigest : 'unreadable'}`);
158
+ }
159
+ continue;
160
+ }
161
+ if (e.isDirectory()) {
162
+ if (IGNORED_DIRS.has(e.name))
163
+ continue;
164
+ await walk(full);
165
+ if (truncatedAtFileLimit)
166
+ return;
167
+ }
168
+ else if (e.isFile()) {
169
+ if (files.size >= maxFiles) {
170
+ truncatedAtFileLimit = true;
171
+ return;
172
+ }
173
+ scannedFiles++;
174
+ try {
175
+ let digest;
176
+ if (options.readFileHashFn) {
177
+ const st = await fs.lstat(full);
178
+ digest = await options.readFileHashFn(full, st.size);
179
+ }
180
+ else {
181
+ digest = await hashFileEntry(full);
182
+ }
183
+ files.set(rel, digest);
184
+ }
185
+ catch {
186
+ unreadableFiles.push(rel);
187
+ }
188
+ }
189
+ }
190
+ }
191
+ await walk(root);
192
+ if (truncatedAtFileLimit) {
193
+ incompleteReasons.push(`Workspace exceeded snapshot file limit (${maxFiles} files); full workspace was not inspected.`);
194
+ }
195
+ if (unreadableDirs.length > 0) {
196
+ incompleteReasons.push(`Unreadable director${unreadableDirs.length === 1 ? 'y' : 'ies'}: ${unreadableDirs.slice(0, 10).join(', ')}`);
197
+ }
198
+ if (unreadableFiles.length > 0) {
199
+ incompleteReasons.push(`Unreadable file(s): ${unreadableFiles.slice(0, 10).join(', ')}`);
200
+ }
201
+ if (externalSymlinks.length > 0) {
202
+ incompleteReasons.push(`External or dangling symlink(s) detected: ${externalSymlinks.slice(0, 10).join(', ')}`);
203
+ }
204
+ return {
205
+ files,
206
+ symlinks,
207
+ externalSymlinks,
208
+ complete: !truncatedAtFileLimit &&
209
+ unreadableDirs.length === 0 &&
210
+ unreadableFiles.length === 0 &&
211
+ externalSymlinks.length === 0,
212
+ truncatedAtFileLimit,
213
+ maxFiles,
214
+ scannedFiles,
215
+ unreadableFiles,
216
+ unreadableDirs,
217
+ incompleteReasons,
218
+ };
219
+ }
220
+ /** Capture a deterministic map of workspace-relative POSIX paths to content hashes (skipping symlinks & generated dirs). */
221
+ export async function captureWorkspaceSnapshot(workspaceRoot, options) {
222
+ const res = await captureWorkspaceSnapshotDetailed(workspaceRoot, options);
223
+ return res.files;
224
+ }
225
+ /** Optionally query Git rename status when workspaceRoot is a Git repository. */
226
+ export async function detectGitRenames(workspaceRoot) {
227
+ if (!workspaceRoot)
228
+ return [];
229
+ try {
230
+ const res = await run('git', ['status', '--porcelain=v1', '-z'], { cwd: workspaceRoot, timeoutMs: 2_000 });
231
+ if (!res.ok || !res.stdout)
232
+ return [];
233
+ const tokens = res.stdout.split('\0');
234
+ const renames = [];
235
+ for (let i = 0; i < tokens.length; i++) {
236
+ const entry = tokens[i];
237
+ if (!entry || entry.length < 4)
238
+ continue;
239
+ if (entry[0] === 'R' || entry[1] === 'R') {
240
+ const to = entry.slice(3).replace(/\\/g, '/');
241
+ const from = (tokens[i + 1] ?? '').replace(/\\/g, '/');
242
+ if (from && to) {
243
+ renames.push({ from, to });
244
+ }
245
+ i++;
246
+ }
247
+ }
248
+ return renames;
249
+ }
250
+ catch {
251
+ return [];
252
+ }
253
+ }
254
+ /** Diff before/after workspace snapshots to record created, modified, deleted, and renamed files. */
255
+ export function diffWorkspaceSnapshots(before, after, gitRenames = []) {
256
+ const beforeMap = before instanceof Map ? before : before.files;
257
+ const afterMap = after instanceof Map ? after : after.files;
258
+ const snapshotIncompleteReasons = [
259
+ ...(before instanceof Map ? [] : before.incompleteReasons),
260
+ ...(after instanceof Map ? [] : after.incompleteReasons),
261
+ ];
262
+ const snapshotComplete = (before instanceof Map ? true : before.complete) &&
263
+ (after instanceof Map ? true : after.complete);
264
+ const symlinksObservedMap = new Map();
265
+ if (!(before instanceof Map)) {
266
+ for (const s of before.symlinks)
267
+ symlinksObservedMap.set(`before:${s.path}`, s);
268
+ }
269
+ if (!(after instanceof Map)) {
270
+ for (const s of after.symlinks)
271
+ symlinksObservedMap.set(`after:${s.path}`, s);
272
+ }
273
+ const externalSymlinks = [...new Set([
274
+ ...(before instanceof Map ? [] : before.externalSymlinks),
275
+ ...(after instanceof Map ? [] : after.externalSymlinks),
276
+ ])].sort();
277
+ const createdRaw = [];
278
+ const modified = [];
279
+ const deletedRaw = [];
280
+ for (const [file, hash] of afterMap.entries()) {
281
+ const prev = beforeMap.get(file);
282
+ if (prev === undefined) {
283
+ createdRaw.push(file);
284
+ }
285
+ else if (prev !== hash) {
286
+ modified.push(file);
287
+ }
288
+ }
289
+ for (const file of beforeMap.keys()) {
290
+ if (!afterMap.has(file)) {
291
+ deletedRaw.push(file);
292
+ }
293
+ }
294
+ const renamed = [];
295
+ const createdSet = new Set(createdRaw);
296
+ const deletedSet = new Set(deletedRaw);
297
+ // 1. Honor explicit git-detected renames where old path vanished and new path appeared
298
+ for (const r of gitRenames) {
299
+ if (deletedSet.has(r.from) && createdSet.has(r.to)) {
300
+ renamed.push({ from: r.from, to: r.to });
301
+ deletedSet.delete(r.from);
302
+ createdSet.delete(r.to);
303
+ }
304
+ }
305
+ // 2. Match remaining vanished+appeared files with identical unique non-empty content hash
306
+ const hashToDeleted = new Map();
307
+ for (const d of deletedSet) {
308
+ const h = beforeMap.get(d);
309
+ if (!h)
310
+ continue;
311
+ const list = hashToDeleted.get(h) ?? [];
312
+ list.push(d);
313
+ hashToDeleted.set(h, list);
314
+ }
315
+ const hashToCreated = new Map();
316
+ for (const c of createdSet) {
317
+ const h = afterMap.get(c);
318
+ if (!h)
319
+ continue;
320
+ const list = hashToCreated.get(h) ?? [];
321
+ list.push(c);
322
+ hashToCreated.set(h, list);
323
+ }
324
+ for (const [h, delList] of hashToDeleted.entries()) {
325
+ const crList = hashToCreated.get(h);
326
+ if (delList.length === 1 && crList && crList.length === 1) {
327
+ const from = delList[0];
328
+ const to = crList[0];
329
+ renamed.push({ from, to });
330
+ deletedSet.delete(from);
331
+ createdSet.delete(to);
332
+ }
333
+ }
334
+ const created = [...createdSet].sort();
335
+ const deleted = [...deletedSet].sort();
336
+ modified.sort();
337
+ renamed.sort((a, b) => a.to.localeCompare(b.to));
338
+ const changedFiles = [...new Set([...created, ...modified, ...renamed.map((r) => r.to)])].sort();
339
+ return {
340
+ created,
341
+ modified,
342
+ deleted,
343
+ renamed,
344
+ changedFiles,
345
+ symlinksObserved: [...symlinksObservedMap.values()],
346
+ externalSymlinks,
347
+ snapshotComplete,
348
+ snapshotIncompleteReasons: [...new Set(snapshotIncompleteReasons)],
349
+ };
350
+ }
351
+ /** Deterministic SHA-256 fingerprint of the current workspace file tree snapshot (including completeness metadata). */
352
+ export function hashWorkspaceSnapshot(snapshot) {
353
+ const files = snapshot instanceof Map ? snapshot : snapshot.files;
354
+ const complete = snapshot instanceof Map ? true : snapshot.complete;
355
+ const reasons = snapshot instanceof Map ? [] : snapshot.incompleteReasons;
356
+ const h = crypto.createHash('sha256');
357
+ h.update(`complete:${complete};reasons:${reasons.join('|')}\n`);
358
+ for (const rel of [...files.keys()].sort()) {
359
+ h.update(`${rel}:${files.get(rel)}\n`);
360
+ }
361
+ return h.digest('hex');
362
+ }
@@ -4,6 +4,7 @@ export declare class ExternalAgentAdapter implements AgentRuntimeAdapter {
4
4
  readonly name: string;
5
5
  private cliName;
6
6
  constructor(id: string, name?: string, cliName?: string);
7
+ /** Report whether the provider CLI binary is discoverable on PATH (does not prove task/execution capability). */
7
8
  checkAvailability(): Promise<RuntimeAvailability>;
8
9
  execute(request: AgentExecutionRequest): Promise<AgentExecutionResponse>;
9
10
  }
@@ -1,6 +1,6 @@
1
- import { run, which } from '../../utils/proc.js';
1
+ import { executeBoundedCommand, nonExecutedResponse } from './boundary.js';
2
+ import { createMinimalExecutionEnv, run, which } from '../../utils/proc.js';
2
3
  import { redact } from '../../security/redact.js';
3
- const MAX_EXTERNAL_OUTPUT_BYTES = 50_000;
4
4
  export class ExternalAgentAdapter {
5
5
  id;
6
6
  name;
@@ -10,12 +10,17 @@ export class ExternalAgentAdapter {
10
10
  this.name = name ?? (id.charAt(0).toUpperCase() + id.slice(1));
11
11
  this.cliName = cliName ?? id;
12
12
  }
13
+ /** Report whether the provider CLI binary is discoverable on PATH (does not prove task/execution capability). */
13
14
  async checkAvailability() {
14
15
  const exe = await which(this.cliName);
15
16
  let version;
16
17
  if (exe) {
17
18
  try {
18
- const vRes = await run(exe, ['--version'], { timeoutMs: 5_000 });
19
+ const vRes = await run(exe, ['--version'], {
20
+ timeoutMs: 5_000,
21
+ env: createMinimalExecutionEnv(process.env),
22
+ replaceEnv: true,
23
+ });
19
24
  if (vRes.ok) {
20
25
  version = vRes.stdout.trim().split('\n')[0] ?? undefined;
21
26
  }
@@ -29,74 +34,46 @@ export class ExternalAgentAdapter {
29
34
  provider: this.id,
30
35
  version,
31
36
  supportsStreaming: true,
32
- supportsNativeSubagents: this.id === 'claude-code' || this.id === 'claude',
33
- reason: exe ? undefined : `CLI "${this.cliName}" not found on system PATH.`,
37
+ supportsNativeSubagents: false,
38
+ sandboxed: false,
39
+ sandboxCapability: 'unavailable-cwd-only',
40
+ reason: exe
41
+ ? `CLI "${this.cliName}" detected at ${exe}; provider execution requires explicit scoped approval and verification.`
42
+ : `CLI "${this.cliName}" not found on system PATH.`,
34
43
  };
35
44
  }
36
45
  async execute(request) {
37
46
  if (request.isPlaceholder) {
38
- return {
39
- ok: false,
40
- output: '',
47
+ return nonExecutedResponse('FAILED', {
48
+ executionKind: 'none',
49
+ reason: 'Placeholder runtime cannot return a successful execution.',
41
50
  error: 'Placeholder runtime cannot return a successful execution.',
42
- durationMs: 0,
43
- filesModified: [],
44
51
  isPlaceholder: true,
45
- };
52
+ });
46
53
  }
47
- const avail = await this.checkAvailability();
48
- if (!avail.available) {
49
- return {
50
- ok: false,
51
- output: '',
52
- error: avail.reason || `${this.name} is not available.`,
53
- durationMs: 0,
54
- filesModified: [],
55
- };
54
+ const exe = await which(this.cliName);
55
+ if (!exe) {
56
+ return nonExecutedResponse('BLOCKED', {
57
+ executionKind: 'none',
58
+ reason: `CLI "${this.cliName}" not found on system PATH.`,
59
+ remediation: `Install the ${this.name} CLI and ensure "${this.cliName}" is on PATH.`,
60
+ cwd: request.sandboxPath ?? request.cwd,
61
+ });
56
62
  }
57
- const start = Date.now();
58
- // If sandbox execution is explicitly requested with sandboxPath or custom command
59
- if (request.allowExternalExecution && (request.sandboxPath || request.command)) {
60
- const exe = (await which(this.cliName)) || this.cliName;
61
- const cmdArgs = request.command && request.command.length > 0
62
- ? request.command
63
- : [this.cliName, '-p', request.prompt, '--output-format', 'json'];
64
- const result = await run(cmdArgs[0] ?? exe, cmdArgs.slice(1), {
63
+ // Preparing CLI instructions is never execution success.
64
+ if (!request.allowExternalExecution || (!request.sandboxPath && (!request.command || request.command.length === 0))) {
65
+ const preparedText = redact(`[${this.name}] Prepared execution instructions for ${request.role}.`);
66
+ return nonExecutedResponse('PREPARED', {
67
+ executionKind: 'preparation',
68
+ output: preparedText,
69
+ reason: `${this.name} CLI (${exe}) prepared instructions only; external execution requires allowExternalExecution and an exact approval grant.`,
70
+ remediation: 'Enable external provider execution with a scoped ApprovalGrant for the exact command and workspace.',
65
71
  cwd: request.sandboxPath ?? request.cwd,
66
- timeoutMs: request.timeoutMs ?? 60_000,
67
- signal: request.signal,
68
- maxBytes: request.maxBytes ?? MAX_EXTERNAL_OUTPUT_BYTES,
69
- env: request.env,
70
72
  });
71
- const boundedStdout = result.stdout.slice(0, MAX_EXTERNAL_OUTPUT_BYTES);
72
- const boundedStderr = result.stderr.slice(0, MAX_EXTERNAL_OUTPUT_BYTES);
73
- const outputText = boundedStdout || boundedStderr;
74
- return {
75
- ok: result.ok,
76
- output: redact(outputText),
77
- error: result.ok ? undefined : redact(result.stderr || result.error || `Process exited with code ${result.code}`),
78
- durationMs: Date.now() - start,
79
- tokensUsed: 1500,
80
- filesModified: request.contextFiles ?? [],
81
- exitCode: result.code ?? (result.ok ? 0 : 1),
82
- stdout: redact(boundedStdout),
83
- stderr: redact(boundedStderr),
84
- timedOut: result.timedOut,
85
- aborted: result.aborted,
86
- };
87
73
  }
88
- // Default safe instruction handoff without running untrusted external processes
89
- const output = `[${this.name}] Prepared execution instructions for ${request.role}.`;
90
- return {
91
- ok: true,
92
- output: redact(output),
93
- durationMs: Date.now() - start,
94
- tokensUsed: 1500,
95
- filesModified: [],
96
- exitCode: 0,
97
- stdout: redact(output),
98
- stderr: '',
99
- };
74
+ const cmdArgs = request.command && request.command.length > 0
75
+ ? request.command
76
+ : [exe, '-p', request.prompt, '--output-format', 'json'];
77
+ return executeBoundedCommand(request, cmdArgs, 'agent', 60_000, true, ['external-agent']);
100
78
  }
101
79
  }
102
- //# sourceMappingURL=external.js.map
@@ -1,6 +1,5 @@
1
- import { run } from '../../utils/proc.js';
2
- import { redact } from '../../security/redact.js';
3
- const MAX_OUTPUT_CHARS = 50_000;
1
+ import { executeBoundedCommand, nonExecutedResponse } from './boundary.js';
2
+ import { packageVersion } from '../../core/version.js';
4
3
  export class NativeRuntimeAdapter {
5
4
  id = 'native';
6
5
  name = 'DevWorkspace Native Deterministic Runtime';
@@ -9,63 +8,32 @@ export class NativeRuntimeAdapter {
9
8
  return {
10
9
  available: true,
11
10
  provider: 'native',
12
- version: '0.5.0',
11
+ version: packageVersion(),
13
12
  supportsStreaming: false,
14
13
  supportsNativeSubagents: true,
14
+ sandboxed: false,
15
+ sandboxCapability: 'unavailable-cwd-only',
15
16
  };
16
17
  }
17
18
  async execute(request) {
18
- const start = Date.now();
19
- // Reject simulated placeholder runtime execution
20
19
  if (request.isPlaceholder) {
21
- return {
22
- ok: false,
23
- output: '',
20
+ return nonExecutedResponse('FAILED', {
21
+ executionKind: 'none',
22
+ reason: 'Placeholder runtime cannot return a successful execution.',
24
23
  error: 'Placeholder runtime cannot return a successful execution.',
25
- durationMs: 0,
26
- filesModified: [],
27
24
  isPlaceholder: true,
28
- };
25
+ });
29
26
  }
30
- // Execute real deterministic command if provided
31
27
  if (request.command && request.command.length > 0) {
32
- const [cmd, ...args] = request.command;
33
- const result = await run(cmd, args, {
34
- cwd: request.cwd,
35
- timeoutMs: request.timeoutMs ?? 30_000,
36
- signal: request.signal,
37
- maxBytes: request.maxBytes ?? MAX_OUTPUT_CHARS,
38
- env: request.env,
39
- });
40
- const boundedStdout = result.stdout.slice(0, MAX_OUTPUT_CHARS);
41
- const boundedStderr = result.stderr.slice(0, MAX_OUTPUT_CHARS);
42
- const outputText = boundedStdout || boundedStderr;
43
- return {
44
- ok: result.ok,
45
- output: redact(outputText),
46
- error: result.ok ? undefined : redact(result.stderr || result.error || `Command exited with code ${result.code}`),
47
- durationMs: Date.now() - start,
48
- tokensUsed: 0,
49
- filesModified: request.contextFiles ?? [],
50
- exitCode: result.code ?? (result.ok ? 0 : 1),
51
- stdout: redact(boundedStdout),
52
- stderr: redact(boundedStderr),
53
- timedOut: result.timedOut,
54
- aborted: result.aborted,
55
- };
28
+ return executeBoundedCommand(request, request.command, 'command', 30_000, false);
56
29
  }
57
- // Deterministic task inspection within local workspace boundaries
58
- const summary = `[Native Runtime] Executed stage for ${request.role} (${request.agentId}). Handled deterministically within project boundaries.`;
59
- return {
60
- ok: true,
61
- output: redact(summary),
62
- durationMs: Date.now() - start,
63
- tokensUsed: 0,
64
- filesModified: request.contextFiles ?? [],
65
- exitCode: 0,
66
- stdout: redact(summary),
67
- stderr: '',
68
- };
30
+ // Generating a summary/plan without a concrete command is never reported as execution success.
31
+ return nonExecutedResponse('NOT_EXECUTED', {
32
+ executionKind: 'none',
33
+ reason: `No executable command or action configured for ${request.role} (${request.agentId}).`,
34
+ remediation: 'Provide an explicit executable command or agent runtime runner; planning alone does not modify or execute code.',
35
+ cwd: request.cwd,
36
+ });
69
37
  }
70
38
  }
71
39
  /**
@@ -83,17 +51,16 @@ export class PlaceholderRuntimeAdapter {
83
51
  reason: 'Placeholder runtimes cannot execute tasks.',
84
52
  supportsStreaming: false,
85
53
  supportsNativeSubagents: false,
54
+ sandboxed: false,
55
+ sandboxCapability: 'unavailable-cwd-only',
86
56
  };
87
57
  }
88
58
  async execute(_request) {
89
- return {
90
- ok: false,
91
- output: '',
59
+ return nonExecutedResponse('FAILED', {
60
+ executionKind: 'none',
61
+ reason: 'Placeholder runtime cannot return a successful execution.',
92
62
  error: 'Placeholder runtime cannot return a successful execution.',
93
- durationMs: 0,
94
- filesModified: [],
95
63
  isPlaceholder: true,
96
- };
64
+ });
97
65
  }
98
66
  }
99
- //# sourceMappingURL=native.js.map