workspai 0.57.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.md +80 -30
  2. package/contracts/agent-customization-pack.v1.json +62 -4
  3. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +167 -0
  4. package/contracts/extension-cli-compatibility.v1.json +8 -1
  5. package/contracts/project-workspace-resolution.v1.json +15 -2
  6. package/contracts/published-contract-catalog.v1.json +35 -0
  7. package/contracts/runtime-command-surface.v1.json +99 -0
  8. package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +247 -0
  9. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +16 -1
  10. package/contracts/workspace-intelligence/goal-agent-handoff.v1.json +96 -0
  11. package/contracts/workspace-intelligence/goal-index.v1.json +51 -0
  12. package/contracts/workspace-intelligence/goal-lifecycle-result.v1.json +96 -0
  13. package/contracts/workspace-intelligence/goal-pack.v1.json +251 -0
  14. package/contracts/workspace-intelligence/goal-plan-result.v1.json +46 -0
  15. package/contracts/workspace-intelligence/project-agent-entry.v1.json +204 -0
  16. package/contracts/workspace-intelligence/project-context-agent.v1.json +43 -26
  17. package/contracts/workspace-intelligence/workspace-context.v1.json +14 -1
  18. package/contracts/workspace-intelligence/workspace-repair-proposal.v1.json +1 -0
  19. package/contracts/workspace-intelligence/workspace-repair-transaction.v1.json +15 -2
  20. package/contracts/workspace-intelligence-architecture.v1.json +20 -0
  21. package/contracts/workspace-repair-capabilities.v1.json +5 -0
  22. package/dist/analyze-52TEGLDR.js +1 -0
  23. package/dist/{artifact-remediation-plan-BPLON5VX.js → artifact-remediation-plan-HPNQTNJ2.js} +1 -1
  24. package/dist/autopilot-release-KQGDM2AA.js +1 -0
  25. package/dist/capabilities-command-VBLZXP2T.js +1 -0
  26. package/dist/chunk-4PUJVYRM.js +1 -0
  27. package/dist/{workspace-knowledge-graph-snapshot-XSQADCNR.js → chunk-5NIZNXRS.js} +1 -1
  28. package/dist/chunk-5PSKBJKJ.js +1 -0
  29. package/dist/{chunk-AA4PNQKR.js → chunk-5SFCBZOH.js} +1 -1
  30. package/dist/{chunk-N2BIIUDH.js → chunk-6FBNSTUS.js} +1 -1
  31. package/dist/{chunk-YJTEMJFV.js → chunk-7DSYI7YN.js} +1 -1
  32. package/dist/chunk-7SFXADXO.js +2 -0
  33. package/dist/{chunk-ADL3CK44.js → chunk-CCDGHPEJ.js} +1 -1
  34. package/dist/{chunk-LYVDRRDO.js → chunk-D65FCQIO.js} +1 -1
  35. package/dist/{chunk-YM77FQB3.js → chunk-DGGTTRYE.js} +1 -1
  36. package/dist/{chunk-TTFQWH55.js → chunk-ENKGGWRX.js} +1 -1
  37. package/dist/{chunk-ZPA6ECBJ.js → chunk-GPOZILMY.js} +1 -1
  38. package/dist/{chunk-L36ZASME.js → chunk-HCFWT42C.js} +1 -1
  39. package/dist/chunk-HOUQIT7U.js +1 -0
  40. package/dist/{chunk-IXOLHPTN.js → chunk-HS3DJMU5.js} +1 -1
  41. package/dist/{chunk-XMTLKDPP.js → chunk-J3X56S7L.js} +1 -1
  42. package/dist/{chunk-64JUYYRC.js → chunk-KBR4Y4RW.js} +1 -1
  43. package/dist/{chunk-E53BGUOW.js → chunk-KTN2ARZJ.js} +1 -1
  44. package/dist/chunk-LPCWROQ3.js +1 -0
  45. package/dist/{chunk-VL3APTVB.js → chunk-M3IKRWXA.js} +1 -1
  46. package/dist/{chunk-P475BOJW.js → chunk-M4UOXP5T.js} +1 -1
  47. package/dist/{chunk-GBMCHFOV.js → chunk-N4QQADXX.js} +1 -1
  48. package/dist/{chunk-75HOCFNH.js → chunk-NOZ4JCH7.js} +1 -1
  49. package/dist/chunk-NZ3WZYD5.js +1 -0
  50. package/dist/{chunk-QHY6F4SS.js → chunk-OFWSZYUX.js} +1 -1
  51. package/dist/{chunk-IUYZ3NHS.js → chunk-OLC7EYUA.js} +3 -3
  52. package/dist/chunk-PVXSIYLP.js +1 -0
  53. package/dist/{chunk-NHTLE3WN.js → chunk-PXWKMPPI.js} +1 -1
  54. package/dist/{chunk-V5EYVQ63.js → chunk-QCKWQFCD.js} +1 -1
  55. package/dist/{chunk-GDKFN3CM.js → chunk-QFBVQUKV.js} +1 -1
  56. package/dist/{chunk-W5ZFXKSL.js → chunk-QJCCZLOF.js} +1 -1
  57. package/dist/{chunk-Z57G62KE.js → chunk-QMPFNXI7.js} +1 -1
  58. package/dist/chunk-RBBBXFEU.js +1 -0
  59. package/dist/{chunk-DF4NWPB7.js → chunk-RHK53ZK7.js} +1 -1
  60. package/dist/chunk-S45YGN2I.js +142 -0
  61. package/dist/chunk-S4CWUZ4K.js +1 -0
  62. package/dist/{chunk-SNO3WG4V.js → chunk-SP5EHSWG.js} +1 -1
  63. package/dist/chunk-TCURN5VD.js +2 -0
  64. package/dist/{chunk-GTJY55QK.js → chunk-UVBPEX3E.js} +1 -1
  65. package/dist/chunk-V3ABABV5.js +39 -0
  66. package/dist/{chunk-IZLEMTES.js → chunk-W6FHVXNL.js} +1 -1
  67. package/dist/{chunk-UQEQ6CXU.js → chunk-WQX3JYEP.js} +1 -1
  68. package/dist/{chunk-GXTCU4WF.js → chunk-WSRUPDZN.js} +1 -1
  69. package/dist/{chunk-6OFGLNFS.js → chunk-YEEAWZWI.js} +1 -1
  70. package/dist/{chunk-QK5QOXOE.js → chunk-ZJCM37KX.js} +1 -1
  71. package/dist/{create-O2KLTN5H.js → create-6QWIJTGU.js} +1 -1
  72. package/dist/{doctor-AL5YWO5X.js → doctor-NAZEKMGU.js} +1 -1
  73. package/dist/goal-command-contract-CHE7U6YY.js +1 -0
  74. package/dist/goal-lifecycle-ECIRCHN5.js +1 -0
  75. package/dist/goal-pack-HBOPVZFO.js +1 -0
  76. package/dist/index.d.ts +25 -3
  77. package/dist/index.js +150 -148
  78. package/dist/{pipeline-4ST4BQWY.js → pipeline-5LLFP5ZH.js} +1 -1
  79. package/dist/project-agent-entry-AFKDDRDL.js +1 -0
  80. package/dist/{project-intelligence-lens-JHYECYOK.js → project-intelligence-lens-U2V3VNZG.js} +1 -1
  81. package/dist/project-test-coverage-HP37HUV2.js +1 -0
  82. package/dist/{verified-goal-KFNRGOKT.js → verified-goal-HUYJ6LBI.js} +1 -1
  83. package/dist/{workspace-O4E5CCGK.js → workspace-CQ43AWUF.js} +1 -1
  84. package/dist/{workspace-agent-sync-N5DPGU2E.js → workspace-agent-sync-YMXYUGYY.js} +1 -1
  85. package/dist/{workspace-archive-BA3ONVXX.js → workspace-archive-ZBCKJHXS.js} +1 -1
  86. package/dist/{workspace-context-ETZNEHOJ.js → workspace-context-RAO62QVU.js} +1 -1
  87. package/dist/{workspace-contract-OSI7NBXS.js → workspace-contract-ACSIHJIO.js} +1 -1
  88. package/dist/workspace-explain-RH27OQB4.js +1 -0
  89. package/dist/workspace-explain-contract-ZL4NMLZI.js +1 -0
  90. package/dist/{workspace-feedback-PCZKXG5R.js → workspace-feedback-RQ4TGJW6.js} +1 -1
  91. package/dist/{workspace-foundation-QQHX66KE.js → workspace-foundation-JH2GFSAZ.js} +1 -1
  92. package/dist/{workspace-graph-stream-UZJQ75XZ.js → workspace-graph-stream-ZZZEQQTE.js} +1 -1
  93. package/dist/workspace-graph-token-efficiency-D7CUT6NX.js +1 -0
  94. package/dist/{workspace-history-CHJOABME.js → workspace-history-SYCDK7FO.js} +1 -1
  95. package/dist/{workspace-intelligence-A7O7MN6T.js → workspace-intelligence-3YERTBA3.js} +1 -1
  96. package/dist/{workspace-intelligence-evaluation-YMY3C5AW.js → workspace-intelligence-evaluation-CQDKOYZZ.js} +1 -1
  97. package/dist/{workspace-intelligence-runner-4EF66L66.js → workspace-intelligence-runner-YXMOT6GK.js} +1 -1
  98. package/dist/{workspace-intelligence-runtime-registry-NCVHKCMP.js → workspace-intelligence-runtime-registry-IW6J53LO.js} +1 -1
  99. package/dist/{workspace-knowledge-graph-BVN4NTJ6.js → workspace-knowledge-graph-HZZP6ZRB.js} +1 -1
  100. package/dist/{workspace-knowledge-graph-query-6DAOXGGT.js → workspace-knowledge-graph-query-ON45H6Y7.js} +1 -1
  101. package/dist/workspace-knowledge-graph-snapshot-7DWHMEM2.js +1 -0
  102. package/dist/{workspace-mcp-serve-TKX4J3SX.js → workspace-mcp-serve-5TTAN243.js} +1 -1
  103. package/dist/{workspace-model-7ESEP366.js → workspace-model-EIQSKDX7.js} +1 -1
  104. package/dist/{workspace-onboarding-SY255V7L.js → workspace-onboarding-SHHW4R4G.js} +1 -1
  105. package/dist/{workspace-readme-IVJXSIBS.js → workspace-readme-56YZ4EAZ.js} +1 -1
  106. package/dist/{workspace-registry-summary-7ISKYEPM.js → workspace-registry-summary-OV5KX3WC.js} +1 -1
  107. package/dist/workspace-repair-engine-BNXZHW35.js +3 -0
  108. package/dist/workspace-run-7EJEBHAH.js +1 -0
  109. package/dist/{workspace-verify-CNXZPWS5.js → workspace-verify-W4P6LBIH.js} +1 -1
  110. package/dist/{workspace-watch-HGFL2EU3.js → workspace-watch-EZ4D4VCF.js} +1 -1
  111. package/docs/GLOSSARY.md +13 -10
  112. package/docs/README.md +24 -17
  113. package/docs/README_CONTENT_CONTRACT.md +12 -8
  114. package/docs/agent-entry.md +194 -0
  115. package/docs/ci-workflows.md +1 -1
  116. package/docs/commands-reference.md +38 -2
  117. package/docs/contracts/ARTIFACT_CATALOG.md +17 -0
  118. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +4 -0
  119. package/docs/contracts/README.md +7 -0
  120. package/docs/goal-packs.md +235 -0
  121. package/docs/real-world-qualification.md +22 -3
  122. package/docs/workspace-operations.md +16 -8
  123. package/docs/workspace-repair-engine.md +36 -5
  124. package/package.json +3 -2
  125. package/scripts/enterprise-package-smoke.mjs +4 -0
  126. package/dist/analyze-HJ774J3E.js +0 -1
  127. package/dist/autopilot-release-WIFFFQKW.js +0 -1
  128. package/dist/capabilities-command-44JVOE5S.js +0 -1
  129. package/dist/chunk-3U4VLIGW.js +0 -1
  130. package/dist/chunk-5EPPPMAS.js +0 -1
  131. package/dist/chunk-CNWUIXF3.js +0 -1
  132. package/dist/chunk-D4RST2HE.js +0 -1
  133. package/dist/chunk-DT4X7I5M.js +0 -81
  134. package/dist/chunk-FPJNWPKU.js +0 -1
  135. package/dist/chunk-PKIRVQLG.js +0 -1
  136. package/dist/chunk-RPHM7LQW.js +0 -36
  137. package/dist/chunk-VUR7H2FU.js +0 -2
  138. package/dist/chunk-VZPWIILU.js +0 -1
  139. package/dist/project-test-coverage-FRMVYTFB.js +0 -1
  140. package/dist/workspace-explain-EM7IUV6L.js +0 -1
  141. package/dist/workspace-explain-contract-KVQO57RC.js +0 -1
  142. package/dist/workspace-graph-token-efficiency-TF23UYEF.js +0 -1
  143. package/dist/workspace-repair-engine-GMA2YTCF.js +0 -3
  144. package/dist/workspace-run-ZZXVNFUS.js +0 -1
@@ -0,0 +1 @@
1
+ import {c as c$5}from'./chunk-5PSKBJKJ.js';import {c}from'./chunk-RBBBXFEU.js';import {i,h as h$1,d as d$1,f as f$2,c as c$3,e as e$1}from'./chunk-HOUQIT7U.js';export{b as GOAL_AGENT_HANDOFF_SCHEMA_VERSION,f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,g as GOAL_LIFECYCLE_RESULT_SCHEMA_VERSION,d as GOAL_PACK_LAST_RUN_PATH,a as GOAL_PACK_SCHEMA_VERSION,c as GOAL_PLAN_RESULT_SCHEMA_VERSION}from'./chunk-HOUQIT7U.js';import {f as f$3}from'./chunk-4PUJVYRM.js';import {b}from'./chunk-GPOZILMY.js';import {a as a$1}from'./chunk-5NIZNXRS.js';import {c as c$4}from'./chunk-QFBVQUKV.js';import {d,c as c$1}from'./chunk-EWZZUQBR.js';import {c as c$2,f as f$1}from'./chunk-CCDGHPEJ.js';import {a}from'./chunk-AFIFZTOY.js';import {f,e}from'./chunk-NZ3WZYD5.js';import h from'path';import G from'fs-extra';var ce=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,ie=/(?:^|\s)(?:\/(?:home|Users|private|var|tmp|mnt|opt|srv|root|workspace|workspaces|data|Volumes|etc|usr|run|dev|proc|sys)\/[^\s]+|[A-Za-z]:[\\/][^\s]+|\\\\[^\\\s]+\\[^\s]+)/,le=/(?:-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\b(?:github_pat_|gh[pousr]_|glpat-|npm_|xox[baprs]-|sk-(?:proj-)?)[A-Za-z0-9_-]{12,}|\b(?:AKIA|ASIA)[A-Z0-9]{16}\b|\bAIza[A-Za-z0-9_-]{20,}|\bBearer\s+[A-Za-z0-9._~+/-]{16,}|[a-z][a-z0-9+.-]*:\/\/[^\s:/]+:[^\s@/]+@|\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*[^\s]{6,})/i,pe=[{category:"test-coverage",patterns:[/\b(?:test\s+)?coverage\b/i,/\bcoverage\s+(?:to|above|at least)\b/i]},{category:"dependency-security",patterns:[/\b(?:dependency|dependencies|package|packages)\b.*\b(?:security|vulnerab|audit)\b/i,/\b(?:security|vulnerab|audit)\b.*\b(?:dependency|dependencies|package|packages)\b/i]},{category:"release-readiness",patterns:[/\brelease[ -]readiness\b/i,/\bready (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare\b[^\n]{0,80}\bfor release\b/i]},{category:"defect-repair",patterns:[/\b(?:fix|repair|resolve|debug)\b.*\b(?:bug|error|failure|issue|regression)\b/i]},{category:"performance",patterns:[/\b(?:performance|latency|throughput|memory|cpu|optimi[sz]e|faster|slower)\b/i]},{category:"refactor",patterns:[/\b(?:refactor|restructure|decouple|extract|simplify|cleanup|clean up)\b/i]},{category:"documentation",patterns:[/\b(?:document|documentation|readme|guide|tutorial|docs)\b/i]},{category:"feature-change",patterns:[/\b(?:add|build|create|implement|introduce|support)\b/i]},{category:"system-understanding",patterns:[/\b(?:understand|explain|map|find|where|how|architecture|analy[sz]e|search)\b/i]}];function de(e){if(typeof e!="string")throw new Error("Goal intent must be text.");let t=e.trim().replace(/\s+/g," ");if(!t)throw new Error("Goal intent cannot be empty.");if(t.length>2e3)throw new Error("Goal intent exceeds the 2000 character safety limit.");if(ce.test(t))throw new Error("Goal intent contains unsupported control characters.");if(ie.test(t))throw new Error("Goal intent contains a machine-local absolute path. Use a workspace-relative path or project scope.");if(le.test(t))throw new Error("Goal intent appears to contain secret material and was not persisted.");return t}function ue(e){let t=e.match(/\b(?:coverage\D{0,24})?(100|\d{1,2})(?:\.\d+)?\s*%/i);if(!t||!/coverage/i.test(e))return null;let o=Number(t[1]);return Number.isFinite(o)&&o>=0&&o<=100?o:null}function Z(e){let t=de(e),o=pe.filter(c=>c.patterns.some(m=>m.test(t))).map(c=>c.category),r=o[0]??"feature-change",i=ue(t),l=[];return o.length>1&&o[0]!=="test-coverage"&&l.push(`The intent also contains signals for: ${o.slice(1).join(", ")}.`),r==="test-coverage"&&i===null&&l.push("A numeric test coverage target is required for machine verification."),{original:t,normalized:t.toLocaleLowerCase("en-US"),statement:t.replace(/[.!?]+$/,""),category:r,confidence:o.length===1?"high":o.length>1?"medium":"low",ambiguities:l,...i===null?{}:{requestedTarget:{metric:"test-coverage-percent",operator:"at-least",value:i}}}}function X(e){let t={"test-coverage":["test suite coverage configuration instrumentation","CI tests LCOV Cobertura JaCoCo LLVM coverage"],"dependency-security":["dependency manifest lockfile security audit vulnerability"],"release-readiness":["release pipeline readiness gates build test deploy"],"defect-repair":["failure error test implementation call path"],"feature-change":["API implementation module dependency tests"],refactor:["module dependency ownership implementation tests"],performance:["performance benchmark latency throughput runtime"],documentation:["documentation README guide architecture decision"],"system-understanding":["architecture service API dependency ownership"]};return [...new Set([e.statement,...t[e.category]])].slice(0,3)}var Q="contracts/workspace-intelligence/goal-pack.v1.json",Y="contracts/workspace-intelligence/goal-agent-handoff.v1.json",me="contracts/workspace-intelligence/goal-plan-result.v1.json",te="contracts/workspace-intelligence/goal-index.v1.json";function ee(e){return e.split(h.sep).join("/")}function q(e,t){return h.resolve(t.absolutePath??h.join(e,t.path))}function ge(e){let t=e.requested.trim().replace(/^project:/,"");if(!t)throw new Error("Project goal scope must name a project.");let o=h.isAbsolute(t)?h.resolve(t):null,r=e.model.projects.filter(i=>i.name===t||ee(i.path)===ee(t)||o!==null&&q(e.workspacePath,i)===o);if(r.length!==1)throw new Error(r.length===0?`Project goal scope was not found in the canonical model: ${t}`:`Project goal scope is ambiguous in the canonical model: ${t}`);return r[0]}async function fe(e){let t=await a$1(e);if(t.status==="miss")throw new Error(`Canonical model and live graph evidence are required (${t.reason}). Run \`workspai workspace intelligence run --for-agent generic --strict --json\` or retry with --refresh.`);let{model:o,graph:r}=t;return a(o,"contracts/workspace-intelligence/workspace-model.v1.json","Goal source model"),a(r,"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json","Goal source graph"),c$4(r,o),{model:o,graph:r}}function he(e){if(e.explicitScope?.trim()==="workspace")return {kind:"workspace",projects:e.model.projects.map(t=>t.name).sort(),selectionSource:"explicit"};if(e.explicitScope?.trim())return {kind:"project",projects:[ge({workspacePath:e.workspacePath,model:e.model,requested:e.explicitScope}).name],selectionSource:"explicit"};if(e.invocationProjectPath){let t=h.resolve(e.invocationProjectPath),o=e.model.projects.filter(r=>q(e.workspacePath,r)===t);if(o.length!==1)throw new Error("The invocation project is not represented uniquely in the canonical workspace model. Refresh intelligence or pass --scope explicitly.");return {kind:"project",projects:[o[0].name],selectionSource:"invocation-project"}}return {kind:"workspace",projects:e.model.projects.map(t=>t.name).sort(),selectionSource:"workspace"}}function ke(e,t){if(t.kind==="workspace")return {entities:e.quality.entityCount,relationships:e.quality.relationCount,proofs:e.quality.proofCount,unresolved:e.quality.unknownCount,proofCoveragePercent:Number((e.quality.relationProofCoverageRatio*100).toFixed(2))};let o=new Set(t.projects),r=e.entities.filter(p=>p.projectId!==void 0&&o.has(p.projectId)),i=new Set(r.map(p=>p.id)),l=e.relations.filter(p=>i.has(p.from)||i.has(p.to)),c=new Set([...r.flatMap(p=>p.proofIds),...l.flatMap(p=>p.proofIds)]),m=l.filter(p=>p.proofIds.length>0).length;return {entities:r.length,relationships:l.length,proofs:c.size,unresolved:l.length-m,proofCoveragePercent:l.length===0?100:Number((m/l.length*100).toFixed(2))}}async function we(e$1){let t=new Set(["node","bun","deno","python","go","java","dotnet","rust","php","ruby","elixir","clojure","scala","kotlin","c","cpp","unknown"]),o=h.join(e$1.workspacePath,e.intelligenceRun),r=await G.readJson(o).catch(()=>null),l=(Array.isArray(r?.stages)?r.stages:[]).filter(a=>a.status==="blocked"||a.status==="failed").map(a=>String(a.id??"unknown")).sort(),c=r?.status,m={status:c==="passed"?"passed":c==="blocked"||c==="failed"?"blocked":"unknown",artifact:e.intelligenceRun,blockedStages:l},p={status:"not-applicable",runtime:null,runner:null,existingEvidence:[],prerequisites:[]};if(e$1.intent.category==="test-coverage"){let a=await Promise.all(e$1.projects.map(async n=>({project:n,capability:await c$5(q(e$1.workspacePath,n),t.has(n.runtime)?n.runtime:"unknown")}))),u=a.map(n=>n.capability.status);p={status:u.includes("unsupported")?"unsupported":u.includes("requires-setup")?"requires-setup":"available",runtime:a.length===1?a[0].capability.runtime:[...new Set(a.map(n=>n.capability.runtime))].join(","),runner:a.length===1?a[0].capability.runner:[...new Set(a.flatMap(n=>n.capability.runner?[n.capability.runner]:[]))].join(",")||null,existingEvidence:a.flatMap(n=>n.capability.existingEvidence.map(d=>({project:n.project.name,...d}))).filter((n,d,f)=>f.findIndex(w=>w.project===n.project&&w.path===n.path&&w.sha256===n.sha256)===d).sort((n,d)=>n.project.localeCompare(d.project)||n.path.localeCompare(d.path)),prerequisites:[...new Set(a.flatMap(n=>n.capability.prerequisites))].sort()};}let x=X(e$1.intent),P=x.map(a=>{let u=e$1.projects.map(f=>f$3(e$1.graph,{query:a,projectId:f.name,limit:20,relationsPerEntity:0,minimumTermMatches:2}).entities),n=[],d=new Set;for(let f=0;u.some(w=>f<w.length);f+=1)for(let w of u){let N=w[f];!N||d.has(N.id)||(d.add(N.id),n.push(N));}return n}),E={"test-coverage":["test-suite"],"dependency-security":["package","module"],"release-readiness":["pipeline","deployment","lifecycle-stage"],"defect-repair":["test-suite","lifecycle-stage"],"feature-change":["project","runtime-unit","api","package","module","test-suite"],refactor:["package","module","api","test-suite"],performance:["lifecycle-stage","test-suite","pipeline"],documentation:["document","decision"],"system-understanding":["project","service","api","package","protocol"]},R=new Set(e$1.projects.map(a=>a.name)),S=e$1.graph.entities.filter(a=>a.proofIds.length>0&&(!a.projectId||R.has(a.projectId))&&E[e$1.intent.category].includes(a.kind)).sort((a,u)=>E[e$1.intent.category].indexOf(a.kind)-E[e$1.intent.category].indexOf(u.kind)||a.label.localeCompare(u.label)),s=[],b=new Set,k=a=>{!a||s.length>=20||b.has(a.id)||(b.add(a.id),s.push(a));},A=(e$1.intent.statement.match(/[A-Za-z][A-Za-z0-9+#.-]{1,}/g)??[]).length>=2,T=A?P[0]??[]:[];for(let a of T.slice(0,12))k(a);if(!A)for(let a of S)k(a);for(let a=0;s.length<20&&P.slice(1).some(u=>a<u.length);a+=1)for(let u of P.slice(1))k(u[a]);if(A)for(let a of S)k(a);for(let a of T.slice(12))k(a);let C=s.map(a=>({entityId:a.id,kind:a.kind,label:a.label,proofIds:a.proofIds.slice(0,12)})),g=P[0]?.length??0;return {workspaceIntelligence:m,measurement:p,retrieval:{status:A&&g>=3?"grounded":C.length>0?"partial":"empty",strategy:"deterministic-category-v1",queries:x,anchors:C}}}async function ye(e){let t=h.join(e,f$2);if(!await G.pathExists(t))return {schemaVersion:e$1,generatedAt:new Date(0).toISOString(),activeGoalId:null,goals:[]};let o=await G.readJson(t);return a(o,te,"Goal index"),h$1(o),o}function Pe(e,t,o){let r=e.goals.find(c=>c.id===t.id),i=t.state==="ready-to-plan",l={id:t.id,fingerprint:t.fingerprint,objective:t.intent.statement,category:t.intent.category,state:t.state,lifecycle:r?.lifecycle==="cancelled"?"cancelled":i?"active":"planned",scope:t.scope,createdAt:r?.createdAt??t.generatedAt,updatedAt:o,goalPack:t.artifacts.goalPack,agentHandoff:t.artifacts.agentHandoff,...r?.verifiedGoalId?{verifiedGoalId:r.verifiedGoalId}:{},...r?.repairTransactionId?{repairTransactionId:r.repairTransactionId}:{},...r?.repairTransactionIds?{repairTransactionIds:r.repairTransactionIds}:{}};return {schemaVersion:e$1,generatedAt:o,activeGoalId:l.lifecycle==="active"?t.id:e.activeGoalId,goals:[...e.goals.filter(c=>c.id!==t.id).map(c=>l.lifecycle==="active"&&c.lifecycle==="active"?{...c,lifecycle:"planned",updatedAt:o}:c),l].sort((c,m)=>c.id.localeCompare(m.id))}}async function Me(e$1){let t=b({startPath:h.resolve(e$1.startPath),explicitWorkspacePath:e$1.workspacePath,strict:true,requireProjectMembership:true});if(!t)throw new Error("No canonical Workspai workspace could be resolved.");let o=h.resolve(t.workspacePath);e$1.refresh&&await c({workspacePath:o,strict:false,agent:"generic"});let{model:r,graph:i$1}=await fe(o),l=he({workspacePath:o,invocationProjectPath:t.projectPath,model:r,explicitScope:e$1.scope}),c$4=r.projects.filter(g=>l.projects.includes(g.name));if(c$4.length===0)throw new Error("A Goal Pack requires at least one registered project in its selected scope.");let m=e$1.maxAttempts??5;if(!Number.isInteger(m)||m<1||m>25)throw new Error("--max-attempts must be an integer from 1 to 25.");let p=new Date().toISOString(),x=d(r),P=Z(e$1.intent),E=await we({workspacePath:o,projects:c$4,graph:i$1,intent:P}),R={generatedAt:p,intent:P,workspaceName:r.workspace.name,scope:l,sourceBinding:{model:{artifact:e.model,schemaVersion:f.model,hashAlgorithm:"sha256",hashSemantics:"workspace-model-structural-v1",hash:x,generatedAt:r.generatedAt},graph:{artifact:e.knowledgeGraph,schemaVersion:f.knowledgeGraph,hashAlgorithm:"sha256",hashSemantics:"canonical-json-v1",hash:c$1(i$1),generatedAt:i$1.generatedAt,modelHash:i$1.source.hash,...i$1.source.inputs?.hash?{inputHash:i$1.source.inputs.hash}:{}}},preflight:E,baseline:{projectCount:c$4.length,runtimes:[...new Set(c$4.flatMap(g=>g.runtimeCandidates))].sort(),frameworks:[...new Set(c$4.map(g=>g.framework))].sort(),graph:ke(i$1,l)},maxAttempts:m,consumer:e$1.consumer??"generic"},S={digestCanonical:c$1},{goalPack:s,handoff:b$1}=i(R,S);a(s,Q,"Goal Pack"),a(b$1,Y,"Goal agent handoff");let k=false,A=async()=>{let g=h.join(o,s.artifacts.goalPack),a$1=h.join(o,s.artifacts.agentHandoff),[u,n]=await Promise.all([G.pathExists(g),G.pathExists(a$1)]);if(u!==n)throw new Error(`Goal Pack instance is incomplete and cannot be resumed: ${s.id}`);if(!u)return;let[d,f]=await Promise.all([G.readJson(g),G.readJson(a$1)]);a(d,Q,"Persisted Goal Pack"),a(f,Y,"Persisted goal agent handoff");let w=i({...R,generatedAt:d.generatedAt,sourceBinding:d.sourceBinding},S);if(d.id!==s.id||f.goalId!==s.id||c$1(d)!==c$1(w.goalPack)||c$1(f)!==c$1(w.handoff))throw new Error(`Goal Pack instance failed immutable integrity validation: ${s.id}`);s=d,b$1=f,k=true;};if(e$1.dryRun)await A();else {let g=`.workspai/goals/${s.id}/publication`;await c$2(o,g,async()=>{await A();let a$1=Pe(await ye(o),s,new Date().toISOString());a(a$1,te,"Goal index"),h$1(a$1),await f$1(o,d$1,k?[{relativePath:d$1,payload:s},{relativePath:f$2,payload:a$1}]:[{relativePath:s.artifacts.goalPack,payload:s},{relativePath:s.artifacts.agentHandoff,payload:b$1},{relativePath:d$1,payload:s},{relativePath:f$2,payload:a$1}]);});}let T=[s.artifacts.goalPack,s.artifacts.agentHandoff,d$1,f$2],C={schemaVersion:c$3,result:s.state==="needs-confirmation"?"needs-confirmation":s.state==="blocked"?"blocked":s.state==="needs-evidence"?"needs-evidence":"planned",resolution:{source:t.source,invocationScope:t.projectPath?"project":"workspace"},goalPack:s,agentHandoff:b$1,writtenArtifacts:e$1.dryRun?[]:k?[d$1,f$2]:T,dryRun:e$1.dryRun===true,resumed:k};return a(C,me,"Goal plan result"),C}export{Me as planGoalPack};
package/dist/index.d.ts CHANGED
@@ -14,12 +14,13 @@ type ProjectGroundingMode = (typeof PROJECT_GROUNDING_MODE_VALUES)[number];
14
14
  interface AdoptProjectFilePreimage {
15
15
  path: string;
16
16
  contents: Buffer | null;
17
- preserve?: 'symbolic-link';
17
+ preserve?: 'symbolic-link' | 'unsafe-parent';
18
18
  }
19
19
  interface AdoptProjectRollbackSnapshot {
20
20
  workspacePath: string;
21
21
  projectPath: string;
22
22
  files: AdoptProjectFilePreimage[];
23
+ createdAdapterDirectories: string[];
23
24
  }
24
25
 
25
26
  declare function getPublishedContractVersions(): {
@@ -54,6 +55,8 @@ declare function getPublishedContractVersions(): {
54
55
  projectWorkspaceLink: "project-workspace-link.v1";
55
56
  projectWorkspaceResolution: "project-workspace-resolution.v1";
56
57
  projectContextAgent: "project-context-agent.v1";
58
+ projectAgentEntry: "workspai.agent-entry.v1";
59
+ agentBootstrapReceipt: "workspai.agent-bootstrap-receipt.v1";
57
60
  doctorProjectEvidence: "doctor-project-evidence-v1";
58
61
  doctorWorkspaceEvidence: "doctor-workspace-evidence-v1";
59
62
  doctorGraphDiagnosis: "doctor-graph-diagnosis.v1";
@@ -65,6 +68,11 @@ declare function getPublishedContractVersions(): {
65
68
  projectTestCoverage: "workspai.project-test-coverage.v1";
66
69
  verifiedGoal: string;
67
70
  verifiedGoalStatus: "workspai.verified-goal-status.v1";
71
+ goalPack: "workspai.goal-pack.v1";
72
+ goalAgentHandoff: "workspai.goal-agent-handoff.v1";
73
+ goalPlanResult: "workspai.goal-plan-result.v1";
74
+ goalIndex: "workspai.goal-index.v1";
75
+ goalLifecycleResult: "workspai.goal-lifecycle-result.v1";
68
76
  workspaceIntelligenceArchitecture: string;
69
77
  workspaceIntelligenceChain: "workspai-workspace-intelligence-chain-v1";
70
78
  workspaceIntelligenceArtifacts: {
@@ -253,6 +261,8 @@ declare function getVersionContract(): {
253
261
  projectWorkspaceLink: "project-workspace-link.v1";
254
262
  projectWorkspaceResolution: "project-workspace-resolution.v1";
255
263
  projectContextAgent: "project-context-agent.v1";
264
+ projectAgentEntry: "workspai.agent-entry.v1";
265
+ agentBootstrapReceipt: "workspai.agent-bootstrap-receipt.v1";
256
266
  doctorProjectEvidence: "doctor-project-evidence-v1";
257
267
  doctorWorkspaceEvidence: "doctor-workspace-evidence-v1";
258
268
  doctorGraphDiagnosis: "doctor-graph-diagnosis.v1";
@@ -264,6 +274,11 @@ declare function getVersionContract(): {
264
274
  projectTestCoverage: "workspai.project-test-coverage.v1";
265
275
  verifiedGoal: string;
266
276
  verifiedGoalStatus: "workspai.verified-goal-status.v1";
277
+ goalPack: "workspai.goal-pack.v1";
278
+ goalAgentHandoff: "workspai.goal-agent-handoff.v1";
279
+ goalPlanResult: "workspai.goal-plan-result.v1";
280
+ goalIndex: "workspai.goal-index.v1";
281
+ goalLifecycleResult: "workspai.goal-lifecycle-result.v1";
267
282
  workspaceIntelligenceArchitecture: string;
268
283
  workspaceIntelligenceChain: "workspai-workspace-intelligence-chain-v1";
269
284
  workspaceIntelligenceArtifacts: {
@@ -446,6 +461,8 @@ declare function getGlobalCommandCapabilities(): {
446
461
  projectWorkspaceLink: "project-workspace-link.v1";
447
462
  projectWorkspaceResolution: "project-workspace-resolution.v1";
448
463
  projectContextAgent: "project-context-agent.v1";
464
+ projectAgentEntry: "workspai.agent-entry.v1";
465
+ agentBootstrapReceipt: "workspai.agent-bootstrap-receipt.v1";
449
466
  doctorProjectEvidence: "doctor-project-evidence-v1";
450
467
  doctorWorkspaceEvidence: "doctor-workspace-evidence-v1";
451
468
  doctorGraphDiagnosis: "doctor-graph-diagnosis.v1";
@@ -457,6 +474,11 @@ declare function getGlobalCommandCapabilities(): {
457
474
  projectTestCoverage: "workspai.project-test-coverage.v1";
458
475
  verifiedGoal: string;
459
476
  verifiedGoalStatus: "workspai.verified-goal-status.v1";
477
+ goalPack: "workspai.goal-pack.v1";
478
+ goalAgentHandoff: "workspai.goal-agent-handoff.v1";
479
+ goalPlanResult: "workspai.goal-plan-result.v1";
480
+ goalIndex: "workspai.goal-index.v1";
481
+ goalLifecycleResult: "workspai.goal-lifecycle-result.v1";
460
482
  workspaceIntelligenceArchitecture: string;
461
483
  workspaceIntelligenceChain: "workspai-workspace-intelligence-chain-v1";
462
484
  workspaceIntelligenceArtifacts: {
@@ -578,8 +600,8 @@ declare function getGlobalCommandCapabilities(): {
578
600
  };
579
601
  workspace: {
580
602
  command: string;
581
- subcommands: ("archive" | "snapshot" | "list" | "import" | "init" | "sync" | "agent-sync" | "contract" | "model" | "share" | "remediation-plan" | "run" | "diff" | "impact" | "verify" | "explain" | "why" | "trace" | "registry" | "foundation" | "intelligence" | "goal" | "graph" | "watch" | "context" | "repair" | "feedback" | "eval" | "mcp" | "policy" | "export" | "hydrate" | "connect")[];
582
- intelligenceSubcommands: ("snapshot" | "agent-sync" | "contract" | "model" | "remediation-plan" | "diff" | "impact" | "verify" | "explain" | "why" | "trace" | "intelligence" | "goal" | "graph" | "watch" | "context" | "repair" | "feedback" | "eval" | "mcp")[];
603
+ subcommands: ("archive" | "snapshot" | "list" | "import" | "goal" | "init" | "sync" | "agent-sync" | "contract" | "model" | "share" | "remediation-plan" | "run" | "diff" | "impact" | "verify" | "explain" | "why" | "trace" | "registry" | "foundation" | "intelligence" | "graph" | "watch" | "context" | "repair" | "feedback" | "eval" | "mcp" | "policy" | "export" | "hydrate" | "connect")[];
604
+ intelligenceSubcommands: ("snapshot" | "goal" | "agent-sync" | "contract" | "model" | "remediation-plan" | "diff" | "impact" | "verify" | "explain" | "why" | "trace" | "intelligence" | "graph" | "watch" | "context" | "repair" | "feedback" | "eval" | "mcp")[];
583
605
  };
584
606
  commandMap: any;
585
607
  runtimeInventory: RuntimeCommandInventoryPayload;