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
@@ -80,4 +80,3 @@ export class ValidatorRegistry {
80
80
  }
81
81
  }
82
82
  }
83
- //# sourceMappingURL=registry.js.map
@@ -179,4 +179,3 @@ export async function validateDependencyVulnerabilities(ctx) {
179
179
  }
180
180
  export const validateCredentialsCheck = validateSecretDetection;
181
181
  export const validateGitignoredEnvCheck = validateGitignoredEnv;
182
- //# sourceMappingURL=security.js.map
@@ -139,4 +139,3 @@ export async function validateTestingContracts(ctx) {
139
139
  }
140
140
  export const validateVerificationContracts = validateTestingContracts;
141
141
  export const validateContractVerification = validateTestingContracts;
142
- //# sourceMappingURL=testing.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=types.js.map
@@ -331,4 +331,3 @@ export async function validateRecoveryRehearsal(ctx) {
331
331
  evidence: { file: 'ROLLBACK.md' },
332
332
  };
333
333
  }
334
- //# sourceMappingURL=undo-kit.js.map
@@ -219,4 +219,3 @@ export function renderRoutingTable() {
219
219
  });
220
220
  return ['| Type | Nature | Max context | Verification |', '| --- | --- | --- | --- |', ...rows].join('\n');
221
221
  }
222
- //# sourceMappingURL=routing.js.map
@@ -333,4 +333,3 @@ export async function listTasks(ws, opts = {}) {
333
333
  tasks.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
334
334
  return { tasks, corrupt };
335
335
  }
336
- //# sourceMappingURL=task.js.map
@@ -15,4 +15,3 @@ export function runCleanups() {
15
15
  }
16
16
  callbacks.clear();
17
17
  }
18
- //# sourceMappingURL=cleanup.js.map
package/dist/utils/fs.js CHANGED
@@ -161,4 +161,3 @@ export async function writeJsonIfChanged(file, value) {
161
161
  JSON.parse(text);
162
162
  return writeTextIfChanged(file, text);
163
163
  }
164
- //# sourceMappingURL=fs.js.map
@@ -1,8 +1,10 @@
1
+ import { randomBytes } from 'node:crypto';
1
2
  import { promises as fs, unlinkSync } from 'node:fs';
2
3
  import path from 'node:path';
3
4
  import { DevWorkspaceError } from '../errors/index.js';
4
5
  import { ensureDir } from './fs.js';
5
6
  import { onCleanup } from './cleanup.js';
7
+ const localLockQueues = new Map();
6
8
  function pidAlive(pid) {
7
9
  try {
8
10
  process.kill(pid, 0);
@@ -18,68 +20,109 @@ export async function withLock(workspaceDir, fn, opts = {}) {
18
20
  const staleMs = opts.staleMs ?? 60_000;
19
21
  const dir = path.join(workspaceDir, 'local');
20
22
  const lockPath = path.join(dir, opts.name ?? 'workspace.lock');
21
- await ensureDir(dir);
22
- const started = Date.now();
23
- let winPermRetries = 0;
24
- for (;;) {
25
- try {
26
- const fh = await fs.open(lockPath, 'wx');
27
- await fh.writeFile(JSON.stringify({ pid: process.pid, at: Date.now() }));
28
- await fh.close();
29
- break;
30
- }
31
- catch (e) {
32
- const code = e.code;
33
- // On Windows, opening a recently unlinked lock file while its handle is closing can briefly raise EPERM/EACCES.
34
- if (process.platform === 'win32' && (code === 'EPERM' || code === 'EACCES') && winPermRetries < 25 && Date.now() - started <= timeoutMs) {
35
- winPermRetries++;
36
- await new Promise((r) => setTimeout(r, 15 + Math.floor(Math.random() * 25)));
37
- continue;
38
- }
39
- if (code !== 'EEXIST') {
40
- throw new DevWorkspaceError('IO', 'Could not acquire the workspace lock.', { cause: e });
41
- }
42
- let stale;
23
+ const queueKey = process.platform === 'win32' ? path.resolve(lockPath).toLowerCase() : path.resolve(lockPath);
24
+ const myToken = randomBytes(8).toString('hex');
25
+ const previous = localLockQueues.get(queueKey) ?? Promise.resolve();
26
+ let releaseLocal;
27
+ const currentSlot = new Promise((resolve) => {
28
+ releaseLocal = resolve;
29
+ });
30
+ const chained = previous.then(() => currentSlot);
31
+ localLockQueues.set(queueKey, chained);
32
+ await previous;
33
+ try {
34
+ await ensureDir(dir);
35
+ const started = Date.now();
36
+ let winPermRetries = 0;
37
+ for (;;) {
43
38
  try {
44
- const info = JSON.parse(await fs.readFile(lockPath, 'utf8'));
45
- const age = Date.now() - (info.at ?? 0);
46
- stale = age > staleMs || (typeof info.pid === 'number' && !pidAlive(info.pid));
39
+ const fh = await fs.open(lockPath, 'wx');
40
+ try {
41
+ await fh.writeFile(JSON.stringify({ pid: process.pid, at: Date.now(), token: myToken }));
42
+ }
43
+ finally {
44
+ await fh.close();
45
+ }
46
+ break;
47
47
  }
48
- catch {
49
- // Unreadable lock: another process may be mid-write, so only break it once it is old.
48
+ catch (e) {
49
+ const code = e.code;
50
+ // On Windows, opening a recently unlinked lock file while its handle is closing can briefly raise EPERM/EACCES.
51
+ if (process.platform === 'win32' && (code === 'EPERM' || code === 'EACCES') && winPermRetries < 25 && Date.now() - started <= timeoutMs) {
52
+ winPermRetries++;
53
+ await new Promise((r) => setTimeout(r, 15 + Math.floor(Math.random() * 25)));
54
+ continue;
55
+ }
56
+ if (code !== 'EEXIST') {
57
+ throw new DevWorkspaceError('IO', 'Could not acquire the workspace lock.', { cause: e });
58
+ }
59
+ let stale = false;
60
+ let disappeared = false;
50
61
  try {
51
- stale = Date.now() - (await fs.stat(lockPath)).mtimeMs > 2000;
62
+ const info = JSON.parse(await fs.readFile(lockPath, 'utf8'));
63
+ const age = Date.now() - (info.at ?? 0);
64
+ stale = age > staleMs || (typeof info.pid === 'number' && !pidAlive(info.pid));
52
65
  }
53
66
  catch {
54
- stale = true;
67
+ // Unreadable lock: another process may be mid-write, or the lock was just released.
68
+ try {
69
+ stale = Date.now() - (await fs.stat(lockPath)).mtimeMs > 2000;
70
+ }
71
+ catch {
72
+ disappeared = true;
73
+ }
74
+ }
75
+ if (disappeared) {
76
+ continue;
77
+ }
78
+ if (stale) {
79
+ const staleTrash = `${lockPath}.stale.${randomBytes(4).toString('hex')}`;
80
+ try {
81
+ await fs.rename(lockPath, staleTrash);
82
+ await fs.rm(staleTrash, { force: true }).catch(() => undefined);
83
+ }
84
+ catch {
85
+ // Another waiter already broke or removed the lock; retry cleanly.
86
+ }
87
+ continue;
55
88
  }
89
+ if (Date.now() - started > timeoutMs) {
90
+ throw new DevWorkspaceError('LOCKED', 'Another DevWorkspace process is modifying this workspace.', {
91
+ hint: `Wait for it to finish, or delete ${path.join('.devworkspace', 'local', opts.name ?? 'workspace.lock')} if no process is running.`,
92
+ });
93
+ }
94
+ await new Promise((r) => setTimeout(r, 25 + Math.floor(Math.random() * 50)));
56
95
  }
57
- if (stale) {
58
- await fs.rm(lockPath, { force: true });
59
- continue;
96
+ }
97
+ const dispose = onCleanup(() => {
98
+ try {
99
+ unlinkSync(lockPath);
60
100
  }
61
- if (Date.now() - started > timeoutMs) {
62
- throw new DevWorkspaceError('LOCKED', 'Another DevWorkspace process is modifying this workspace.', {
63
- hint: `Wait for it to finish, or delete ${path.join('.devworkspace', 'local', opts.name ?? 'workspace.lock')} if no process is running.`,
64
- });
101
+ catch {
102
+ /* already gone */
65
103
  }
66
- await new Promise((r) => setTimeout(r, 25 + Math.floor(Math.random() * 50)));
67
- }
68
- }
69
- const dispose = onCleanup(() => {
104
+ });
70
105
  try {
71
- unlinkSync(lockPath);
106
+ return await fn();
72
107
  }
73
- catch {
74
- /* already gone */
108
+ finally {
109
+ dispose();
110
+ try {
111
+ const raw = await fs.readFile(lockPath, 'utf8');
112
+ const info = JSON.parse(raw);
113
+ if (info.token === myToken) {
114
+ await fs.rm(lockPath, { force: true }).catch(() => undefined);
115
+ }
116
+ }
117
+ catch {
118
+ // Lock was already removed (e.g. via cleanup hook or external stale break).
119
+ }
75
120
  }
76
- });
77
- try {
78
- return await fn();
79
121
  }
80
122
  finally {
81
- dispose();
82
- await fs.rm(lockPath, { force: true }).catch(() => undefined);
123
+ releaseLocal();
124
+ if (localLockQueues.get(queueKey) === chained) {
125
+ localLockQueues.delete(queueKey);
126
+ }
83
127
  }
84
128
  }
85
- //# sourceMappingURL=lock.js.map
@@ -15,4 +15,3 @@ export function createLogger(level, write = (l) => process.stderr.write(l + '\n'
15
15
  };
16
16
  }
17
17
  export const silentLogger = createLogger('error', () => undefined);
18
- //# sourceMappingURL=logger.js.map
@@ -121,4 +121,3 @@ export function findAbsolutePaths(text) {
121
121
  const hits = text.match(/(?:\b[A-Za-z]:\\[^\s"'`<>|]+|\/(?:Users|home)\/[^\s"'`<>|]+)/g);
122
122
  return hits ? [...new Set(hits)] : [];
123
123
  }
124
- //# sourceMappingURL=paths.js.map
@@ -13,11 +13,23 @@ export interface RunOptions {
13
13
  maxBytes?: number;
14
14
  /** Extra environment variables merged over process.env (undefined values unset the variable). */
15
15
  env?: Record<string, string | undefined>;
16
+ /** When true, use `env` as the full environment instead of merging over process.env. */
17
+ replaceEnv?: boolean;
16
18
  /** Abort (kill) the process when the signal fires. */
17
19
  signal?: AbortSignal;
18
20
  /** Windows only: pass the argument string through unmodified (used for cmd.exe /c with pre-validated arguments). */
19
21
  windowsVerbatimArguments?: boolean;
20
22
  }
23
+ /** Build a minimal process environment containing OS/runtime basics without leaking secrets. */
24
+ export declare function createMinimalExecutionEnv(baseEnv?: NodeJS.ProcessEnv, extraAllowKeys?: string[], overrides?: Record<string, string | undefined>): NodeJS.ProcessEnv;
25
+ /**
26
+ * Spawn an executable with an argument array without blocking on child exit until `done` is awaited.
27
+ * Never uses a shell, so project- or user-supplied values cannot be interpreted as shell syntax.
28
+ */
29
+ export declare function startRun(command: string, args: string[], opts?: RunOptions): {
30
+ spawned: boolean;
31
+ done: Promise<RunResult>;
32
+ };
21
33
  /**
22
34
  * Run an executable with an argument array. Never uses a shell, so project- or
23
35
  * user-supplied values cannot be interpreted as shell syntax.
@@ -1,62 +1,117 @@
1
- import { spawn } from 'node:child_process';
1
+ import { spawn, spawnSync } from 'node:child_process';
2
2
  import { promises as fs } from 'node:fs';
3
3
  import path from 'node:path';
4
+ const MINIMAL_ENV_ALLOW = new RegExp('^(?:' + [
5
+ 'PATH', 'PATHEXT', 'HOME', 'USER', 'USERNAME', 'LOGNAME', 'SHELL', 'TERM', 'LANG', 'LANGUAGE', 'LC_[A-Z_]+', 'TZ',
6
+ 'TMPDIR', 'TMP', 'TEMP', 'XDG_[A-Z_]+',
7
+ 'SYSTEMROOT', 'SYSTEMDRIVE', 'WINDIR', 'COMSPEC', 'OS', 'USERDOMAIN', 'USERPROFILE', 'HOMEDRIVE', 'HOMEPATH',
8
+ 'APPDATA', 'LOCALAPPDATA', 'PROGRAMDATA', 'PROGRAMFILES', 'PROGRAMFILES\\(X86\\)', 'PROGRAMW6432',
9
+ 'COMMONPROGRAMFILES', 'ALLUSERSPROFILE', 'PUBLIC', 'PROCESSOR_ARCHITECTURE', 'NUMBER_OF_PROCESSORS',
10
+ 'NODE_EXTRA_CA_CERTS', 'SSL_CERT_FILE', 'SSL_CERT_DIR',
11
+ ].join('|') + ')$', 'i');
12
+ /** Build a minimal process environment containing OS/runtime basics without leaking secrets. */
13
+ export function createMinimalExecutionEnv(baseEnv = process.env, extraAllowKeys = [], overrides = {}) {
14
+ const allowExtra = new Set(extraAllowKeys.map((k) => k.trim().toLowerCase()).filter(Boolean));
15
+ const merged = {};
16
+ for (const [k, v] of Object.entries(baseEnv)) {
17
+ if (v !== undefined && (MINIMAL_ENV_ALLOW.test(k) || allowExtra.has(k.toLowerCase()))) {
18
+ merged[k] = v;
19
+ }
20
+ }
21
+ for (const [k, v] of Object.entries(overrides)) {
22
+ if (v === undefined)
23
+ delete merged[k];
24
+ else
25
+ merged[k] = v;
26
+ }
27
+ return merged;
28
+ }
29
+ function killProcessTree(child) {
30
+ if (!child?.pid) {
31
+ child?.kill();
32
+ return;
33
+ }
34
+ if (process.platform === 'win32') {
35
+ try {
36
+ spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], { windowsHide: true });
37
+ }
38
+ catch {
39
+ child.kill();
40
+ }
41
+ return;
42
+ }
43
+ try {
44
+ process.kill(-child.pid, 'SIGKILL');
45
+ }
46
+ catch {
47
+ try {
48
+ child.kill('SIGKILL');
49
+ }
50
+ catch {
51
+ child.kill();
52
+ }
53
+ }
54
+ }
4
55
  /**
5
- * Run an executable with an argument array. Never uses a shell, so project- or
6
- * user-supplied values cannot be interpreted as shell syntax.
56
+ * Spawn an executable with an argument array without blocking on child exit until `done` is awaited.
57
+ * Never uses a shell, so project- or user-supplied values cannot be interpreted as shell syntax.
7
58
  */
8
- export function run(command, args, opts = {}) {
59
+ export function startRun(command, args, opts = {}) {
9
60
  const timeoutMs = opts.timeoutMs ?? 15_000;
10
61
  const maxBytes = opts.maxBytes ?? 4 * 1024 * 1024;
11
- return new Promise((resolve) => {
12
- let stdout = '';
13
- let stderr = '';
14
- let timedOut = false;
15
- let aborted = false;
16
- let settled = false;
17
- // eslint-disable-next-line prefer-const -- assigned after spawn; finish() may run first if spawn throws
18
- let timer;
62
+ let stdout = '';
63
+ let stderr = '';
64
+ let timedOut = false;
65
+ let aborted = false;
66
+ let settled = false;
67
+ if (opts.signal?.aborted) {
68
+ return {
69
+ spawned: false,
70
+ done: Promise.resolve({ ok: false, code: null, stdout, stderr, timedOut: false, aborted: true, error: 'aborted' }),
71
+ };
72
+ }
73
+ let child;
74
+ try {
75
+ const env = opts.replaceEnv
76
+ ? { ...(opts.env ?? {}) }
77
+ : opts.env ? { ...process.env, ...opts.env } : process.env;
78
+ for (const [k, v] of Object.entries(env))
79
+ if (v === undefined)
80
+ delete env[k];
81
+ child = spawn(command, args, {
82
+ cwd: opts.cwd,
83
+ env,
84
+ shell: false,
85
+ windowsHide: true,
86
+ windowsVerbatimArguments: opts.windowsVerbatimArguments,
87
+ detached: process.platform !== 'win32',
88
+ stdio: ['ignore', 'pipe', 'pipe'],
89
+ });
90
+ }
91
+ catch (e) {
92
+ return {
93
+ spawned: false,
94
+ done: Promise.resolve({ ok: false, code: null, stdout, stderr, timedOut: false, error: e.message }),
95
+ };
96
+ }
97
+ const c = child;
98
+ const done = new Promise((resolve) => {
19
99
  const onAbort = () => {
20
100
  aborted = true;
21
- child?.kill();
101
+ killProcessTree(c);
22
102
  };
103
+ const timer = setTimeout(() => {
104
+ timedOut = true;
105
+ killProcessTree(c);
106
+ }, timeoutMs);
23
107
  const finish = (r) => {
24
108
  if (settled)
25
109
  return;
26
110
  settled = true;
27
- if (timer)
28
- clearTimeout(timer);
111
+ clearTimeout(timer);
29
112
  opts.signal?.removeEventListener('abort', onAbort);
30
113
  resolve(aborted ? { ...r, ok: false, aborted: true } : r);
31
114
  };
32
- let child;
33
- if (opts.signal?.aborted) {
34
- finish({ ok: false, code: null, stdout, stderr, timedOut: false, aborted: true, error: 'aborted' });
35
- return;
36
- }
37
- try {
38
- const env = opts.env ? { ...process.env, ...opts.env } : process.env;
39
- for (const [k, v] of Object.entries(env))
40
- if (v === undefined)
41
- delete env[k];
42
- child = spawn(command, args, {
43
- cwd: opts.cwd,
44
- env,
45
- shell: false,
46
- windowsHide: true,
47
- windowsVerbatimArguments: opts.windowsVerbatimArguments,
48
- stdio: ['ignore', 'pipe', 'pipe'],
49
- });
50
- }
51
- catch (e) {
52
- finish({ ok: false, code: null, stdout, stderr, timedOut: false, error: e.message });
53
- return;
54
- }
55
- const c = child;
56
- timer = setTimeout(() => {
57
- timedOut = true;
58
- c.kill();
59
- }, timeoutMs);
60
115
  opts.signal?.addEventListener('abort', onAbort, { once: true });
61
116
  c.stdout?.on('data', (d) => {
62
117
  if (stdout.length < maxBytes)
@@ -69,6 +124,14 @@ export function run(command, args, opts = {}) {
69
124
  c.on('error', (e) => finish({ ok: false, code: null, stdout, stderr, timedOut, error: e.message }));
70
125
  c.on('close', (code) => finish({ ok: code === 0 && !timedOut && !aborted, code, stdout, stderr, timedOut }));
71
126
  });
127
+ return { spawned: true, done };
128
+ }
129
+ /**
130
+ * Run an executable with an argument array. Never uses a shell, so project- or
131
+ * user-supplied values cannot be interpreted as shell syntax.
132
+ */
133
+ export function run(command, args, opts = {}) {
134
+ return startRun(command, args, opts).done;
72
135
  }
73
136
  /** Locate an executable on PATH (honouring PATHEXT on Windows) without executing anything. */
74
137
  export async function which(name, env = process.env) {
@@ -112,4 +175,3 @@ export async function which(name, env = process.env) {
112
175
  export function isShellShim(file) {
113
176
  return /\.(cmd|bat)$/i.test(file);
114
177
  }
115
- //# sourceMappingURL=proc.js.map
@@ -117,4 +117,3 @@ export async function removeDeclaration(ws, pkg) {
117
117
  export function isDeclared(decls, pkg, check) {
118
118
  return decls.find((d) => d.package === pkg && d.checks.includes(check));
119
119
  }
120
- //# sourceMappingURL=safety.js.map
@@ -116,4 +116,3 @@ export function scopeByPackage(changes, contract) {
116
116
  }
117
117
  return out;
118
118
  }
119
- //# sourceMappingURL=scope.js.map
package/docs/agents.md CHANGED
@@ -96,6 +96,21 @@ devworkspace setup --agent claude-code --launcher direct
96
96
  devworkspace setup --agent claude-code --launcher auto
97
97
  ```
98
98
 
99
+ ## Execution vs. Verification Lifecycle
100
+
101
+ DevWorkspace's orchestration subsystem (`src/intelligence/`) enforces a strict separation between planning, preparation, execution, verification, and verified completion:
102
+
103
+ | Stage / State | Meaning | `ok` / `verified` |
104
+ | --- | --- | --- |
105
+ | **Generated Plan** (`orchestrate plan`) | Routing analysis selecting specialist roles, skills, file claims, and destructive approvals. | `state: READY` or `AWAITING_APPROVAL` |
106
+ | **Prepared Instructions** (`ExternalAgentAdapter` default) | CLI prompt/instructions assembled without invoking an external agent process. | `status: PREPARED`, `ok: false`, `verified: false` |
107
+ | **Unconfigured No-Op** (`NativeRuntimeAdapter` / `GoogleAdkAdapter`) | No executable command or local runner configured; generating a summary is never execution. | `status: NOT_EXECUTED` or `UNSUPPORTED`, `ok: false` |
108
+ | **Actual Execution** (`command` or `agent`) | Real child process ran (`shell: false`, minimal env, timeout & tree cleanup) and exited `0`. | `status: SUCCEEDED`, `ok: true`, `verificationStatus: NOT_TESTED` |
109
+ | **Independent Verification** (`IndependentVerificationEngine`) | Contract checks run + `IndependentReviewer` inspects bounded file contents against bound `executionId` and `workspaceFingerprint`. | `verificationStatus: PASS` (or `FAIL`/`ERROR`/`TIMED_OUT`/`SKIPPED`) |
110
+ | **Verified Completion** (`OrchestrationEngine`) | Stage becomes `COMPLETED` **only** when execution succeeded **and** verification returned `PASS` matching current workspace state. Workspace edits invalidate stale receipts via `invalidateStaleReceipts()`. | `stage.status: COMPLETED`, `receipt.verified: true` |
111
+
112
+ > **Isolation boundary:** DevWorkspace runtime adapters report `sandboxed: false` (`sandboxCapability: "unavailable-cwd-only"`). Setting `cwd` or `sandboxPath` sets the child working directory only and is **not** an OS-level container, chroot, or network sandbox.
113
+
99
114
  ## Adding a New Agent Adapter
100
115
 
101
116
  To add support for a new coding agent: