workspai 0.58.0 → 0.59.1

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 (140) hide show
  1. package/README.md +80 -32
  2. package/contracts/agent-customization-pack.v1.json +52 -4
  3. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +90 -0
  4. package/contracts/extension-cli-compatibility.v1.json +3 -1
  5. package/contracts/project-workspace-resolution.v1.json +15 -2
  6. package/contracts/published-contract-catalog.v1.json +10 -0
  7. package/contracts/runtime-command-surface.v1.json +54 -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-index.v1.json +7 -1
  11. package/contracts/workspace-intelligence/goal-pack.v1.json +2 -1
  12. package/contracts/workspace-intelligence/project-agent-entry.v1.json +204 -0
  13. package/contracts/workspace-intelligence/project-context-agent.v1.json +43 -26
  14. package/contracts/workspace-intelligence/workspace-context.v1.json +14 -1
  15. package/contracts/workspace-intelligence/workspace-repair-transaction.v1.json +15 -2
  16. package/contracts/workspace-repair-capabilities.v1.json +5 -0
  17. package/dist/analyze-52TEGLDR.js +1 -0
  18. package/dist/{artifact-remediation-plan-JRX4XZ7C.js → artifact-remediation-plan-HPNQTNJ2.js} +1 -1
  19. package/dist/autopilot-release-NFLAKBA3.js +1 -0
  20. package/dist/capabilities-command-VBLZXP2T.js +1 -0
  21. package/dist/{chunk-TTLVG5AR.js → chunk-3CGR6435.js} +1 -1
  22. package/dist/chunk-4PUJVYRM.js +1 -0
  23. package/dist/{chunk-4NN5QWOB.js → chunk-5NIZNXRS.js} +1 -1
  24. package/dist/{chunk-HYY5PQCV.js → chunk-5PSKBJKJ.js} +1 -1
  25. package/dist/{chunk-AA4PNQKR.js → chunk-5SFCBZOH.js} +1 -1
  26. package/dist/{chunk-MFJ6ZP7S.js → chunk-6FBNSTUS.js} +1 -1
  27. package/dist/{chunk-FY6OHOXR.js → chunk-7DSYI7YN.js} +1 -1
  28. package/dist/chunk-7SFXADXO.js +2 -0
  29. package/dist/{chunk-GRGUPSNP.js → chunk-CCDGHPEJ.js} +1 -1
  30. package/dist/{chunk-T63WRURN.js → chunk-D65FCQIO.js} +1 -1
  31. package/dist/{chunk-YYCPRYP7.js → chunk-DGGTTRYE.js} +1 -1
  32. package/dist/chunk-DQ6VXTDE.js +1 -0
  33. package/dist/{chunk-SM55RK3C.js → chunk-ENKGGWRX.js} +1 -1
  34. package/dist/chunk-FLTIFYTJ.js +142 -0
  35. package/dist/{chunk-RMDVRNU7.js → chunk-GPOZILMY.js} +1 -1
  36. package/dist/{chunk-C4NYG57I.js → chunk-HCFWT42C.js} +1 -1
  37. package/dist/{chunk-RJDGC6AQ.js → chunk-HS3DJMU5.js} +1 -1
  38. package/dist/{chunk-HI7ONEFI.js → chunk-J3X56S7L.js} +1 -1
  39. package/dist/{chunk-N3DFX4BY.js → chunk-KBR4Y4RW.js} +1 -1
  40. package/dist/{chunk-H545P6LN.js → chunk-KTN2ARZJ.js} +1 -1
  41. package/dist/chunk-LPCWROQ3.js +1 -0
  42. package/dist/chunk-MZKKRAAJ.js +2 -0
  43. package/dist/{chunk-LGJAAPNR.js → chunk-N4QQADXX.js} +1 -1
  44. package/dist/{chunk-FXIE2WVG.js → chunk-NOZ4JCH7.js} +1 -1
  45. package/dist/chunk-NZ3WZYD5.js +1 -0
  46. package/dist/{chunk-VAWV3UKV.js → chunk-OFWSZYUX.js} +1 -1
  47. package/dist/{chunk-XC26FNRL.js → chunk-P2WH7W2H.js} +11 -11
  48. package/dist/chunk-PVXSIYLP.js +1 -0
  49. package/dist/{chunk-7KXRA5ST.js → chunk-PXWKMPPI.js} +1 -1
  50. package/dist/{chunk-II4ROT6X.js → chunk-QCKWQFCD.js} +1 -1
  51. package/dist/{chunk-4YICCES6.js → chunk-QFBVQUKV.js} +1 -1
  52. package/dist/{chunk-G4VMNWSU.js → chunk-QJCCZLOF.js} +1 -1
  53. package/dist/{chunk-A3JCETSF.js → chunk-QMPFNXI7.js} +1 -1
  54. package/dist/{chunk-CFBAGPB4.js → chunk-QPE6VCDW.js} +1 -1
  55. package/dist/chunk-RTDEFUTL.js +39 -0
  56. package/dist/{chunk-YMY6EFX4.js → chunk-RVKMGKYL.js} +1 -1
  57. package/dist/chunk-S4CWUZ4K.js +1 -0
  58. package/dist/{chunk-EEMRRCGR.js → chunk-SP5EHSWG.js} +1 -1
  59. package/dist/{chunk-CHMCKYJJ.js → chunk-U3MGJN7A.js} +1 -1
  60. package/dist/{chunk-WSDVFLHT.js → chunk-W6FHVXNL.js} +1 -1
  61. package/dist/{chunk-M2BK3XTP.js → chunk-WQX3JYEP.js} +1 -1
  62. package/dist/{chunk-AUCHMXUZ.js → chunk-WSRUPDZN.js} +1 -1
  63. package/dist/{chunk-6TNSCVR4.js → chunk-Y4B55J5S.js} +1 -1
  64. package/dist/{chunk-GVS5OFUB.js → chunk-YEEAWZWI.js} +1 -1
  65. package/dist/{chunk-I5PDN2P2.js → chunk-ZJCM37KX.js} +1 -1
  66. package/dist/{create-QIN56Y4M.js → create-HUEDWYDM.js} +1 -1
  67. package/dist/{doctor-RP4Q2CKJ.js → doctor-NAZEKMGU.js} +1 -1
  68. package/dist/goal-lifecycle-NUKWVUAL.js +1 -0
  69. package/dist/goal-pack-TWOXHXN6.js +1 -0
  70. package/dist/index.d.ts +8 -1
  71. package/dist/index.js +134 -132
  72. package/dist/{pipeline-77NUVYQD.js → pipeline-62A2SDLC.js} +1 -1
  73. package/dist/project-agent-entry-7SYHRY7J.js +1 -0
  74. package/dist/{project-intelligence-lens-AM2B2PXU.js → project-intelligence-lens-BSG5LK6N.js} +1 -1
  75. package/dist/{project-test-coverage-MUSS7Z7V.js → project-test-coverage-HP37HUV2.js} +1 -1
  76. package/dist/{verified-goal-ZSIZYNVO.js → verified-goal-B6HQOZWA.js} +1 -1
  77. package/dist/{workspace-LFESVKE7.js → workspace-BNRSBWSL.js} +1 -1
  78. package/dist/{workspace-agent-sync-JMRX6J2Y.js → workspace-agent-sync-ANBHBZ2H.js} +1 -1
  79. package/dist/{workspace-archive-MFHCFCDO.js → workspace-archive-ZBCKJHXS.js} +1 -1
  80. package/dist/{workspace-context-TBKRMVMT.js → workspace-context-RAO62QVU.js} +1 -1
  81. package/dist/{workspace-contract-KKVC2DUQ.js → workspace-contract-ACSIHJIO.js} +1 -1
  82. package/dist/workspace-explain-RH27OQB4.js +1 -0
  83. package/dist/workspace-explain-contract-ZL4NMLZI.js +1 -0
  84. package/dist/{workspace-feedback-O6J3RQML.js → workspace-feedback-RQ4TGJW6.js} +1 -1
  85. package/dist/{workspace-foundation-JQWT7YGC.js → workspace-foundation-EWYJPPT6.js} +1 -1
  86. package/dist/{workspace-graph-stream-V5WOXP4B.js → workspace-graph-stream-ZZZEQQTE.js} +1 -1
  87. package/dist/workspace-graph-token-efficiency-D7CUT6NX.js +1 -0
  88. package/dist/{workspace-history-TOCRMJUJ.js → workspace-history-SYCDK7FO.js} +1 -1
  89. package/dist/{workspace-intelligence-SDBIRKMK.js → workspace-intelligence-3YERTBA3.js} +1 -1
  90. package/dist/{workspace-intelligence-evaluation-E4UMWDAZ.js → workspace-intelligence-evaluation-CQDKOYZZ.js} +1 -1
  91. package/dist/{workspace-intelligence-runner-DIMNL6CJ.js → workspace-intelligence-runner-QLLBUD6G.js} +1 -1
  92. package/dist/{workspace-intelligence-runtime-registry-YGWB2RRS.js → workspace-intelligence-runtime-registry-IW6J53LO.js} +1 -1
  93. package/dist/{workspace-knowledge-graph-MUW6UAGI.js → workspace-knowledge-graph-HZZP6ZRB.js} +1 -1
  94. package/dist/{workspace-knowledge-graph-query-6DAOXGGT.js → workspace-knowledge-graph-query-ON45H6Y7.js} +1 -1
  95. package/dist/workspace-knowledge-graph-snapshot-7DWHMEM2.js +1 -0
  96. package/dist/{workspace-mcp-serve-2SWLIH4I.js → workspace-mcp-serve-5TTAN243.js} +1 -1
  97. package/dist/{workspace-model-VPFCKTYQ.js → workspace-model-EIQSKDX7.js} +1 -1
  98. package/dist/{workspace-onboarding-GHI6UTQJ.js → workspace-onboarding-UW3CSURE.js} +1 -1
  99. package/dist/{workspace-readme-RASXBZRQ.js → workspace-readme-56YZ4EAZ.js} +1 -1
  100. package/dist/{workspace-registry-summary-7QT7YMIU.js → workspace-registry-summary-OV5KX3WC.js} +1 -1
  101. package/dist/workspace-repair-engine-DHH2UUJN.js +3 -0
  102. package/dist/workspace-run-BLHRXT2N.js +1 -0
  103. package/dist/{workspace-verify-RYCQZYYB.js → workspace-verify-W4P6LBIH.js} +1 -1
  104. package/dist/{workspace-watch-U3YGN3GG.js → workspace-watch-EZ4D4VCF.js} +1 -1
  105. package/docs/GLOSSARY.md +13 -10
  106. package/docs/README.md +24 -19
  107. package/docs/README_CONTENT_CONTRACT.md +12 -8
  108. package/docs/agent-entry.md +194 -0
  109. package/docs/ci-workflows.md +18 -1
  110. package/docs/commands-reference.md +26 -2
  111. package/docs/contracts/ARTIFACT_CATALOG.md +9 -3
  112. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +3 -0
  113. package/docs/contracts/README.md +22 -2
  114. package/docs/goal-packs.md +70 -9
  115. package/docs/workspace-operations.md +16 -8
  116. package/docs/workspace-repair-engine.md +36 -5
  117. package/package.json +4 -2
  118. package/scripts/enterprise-package-smoke.mjs +4 -0
  119. package/dist/analyze-MAU36FTX.js +0 -1
  120. package/dist/autopilot-release-TA2L7SCB.js +0 -1
  121. package/dist/capabilities-command-HE2FICLG.js +0 -1
  122. package/dist/chunk-42Q5E2YV.js +0 -1
  123. package/dist/chunk-7IRGSM25.js +0 -1
  124. package/dist/chunk-CNWUIXF3.js +0 -1
  125. package/dist/chunk-FPJNWPKU.js +0 -1
  126. package/dist/chunk-HH54C3XJ.js +0 -1
  127. package/dist/chunk-NQ5H4R2I.js +0 -83
  128. package/dist/chunk-PCXBPQO6.js +0 -1
  129. package/dist/chunk-QXW3SLEX.js +0 -1
  130. package/dist/chunk-TMOKXYAQ.js +0 -2
  131. package/dist/chunk-VIFTO53Y.js +0 -1
  132. package/dist/chunk-ZDYGO3T7.js +0 -36
  133. package/dist/goal-lifecycle-YTBU3ICP.js +0 -1
  134. package/dist/goal-pack-MYYH7K43.js +0 -1
  135. package/dist/workspace-explain-RGGZL5IW.js +0 -1
  136. package/dist/workspace-explain-contract-4ZZ6CJ44.js +0 -1
  137. package/dist/workspace-graph-token-efficiency-TF23UYEF.js +0 -1
  138. package/dist/workspace-knowledge-graph-snapshot-7IU2QAXI.js +0 -1
  139. package/dist/workspace-repair-engine-AZTJIFCY.js +0 -3
  140. package/dist/workspace-run-VMZY6LIF.js +0 -1
@@ -0,0 +1 @@
1
+ import {c as c$5}from'./chunk-5PSKBJKJ.js';import {c}from'./chunk-RVKMGKYL.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-DQ6VXTDE.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-DQ6VXTDE.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";
@@ -258,6 +261,8 @@ declare function getVersionContract(): {
258
261
  projectWorkspaceLink: "project-workspace-link.v1";
259
262
  projectWorkspaceResolution: "project-workspace-resolution.v1";
260
263
  projectContextAgent: "project-context-agent.v1";
264
+ projectAgentEntry: "workspai.agent-entry.v1";
265
+ agentBootstrapReceipt: "workspai.agent-bootstrap-receipt.v1";
261
266
  doctorProjectEvidence: "doctor-project-evidence-v1";
262
267
  doctorWorkspaceEvidence: "doctor-workspace-evidence-v1";
263
268
  doctorGraphDiagnosis: "doctor-graph-diagnosis.v1";
@@ -456,6 +461,8 @@ declare function getGlobalCommandCapabilities(): {
456
461
  projectWorkspaceLink: "project-workspace-link.v1";
457
462
  projectWorkspaceResolution: "project-workspace-resolution.v1";
458
463
  projectContextAgent: "project-context-agent.v1";
464
+ projectAgentEntry: "workspai.agent-entry.v1";
465
+ agentBootstrapReceipt: "workspai.agent-bootstrap-receipt.v1";
459
466
  doctorProjectEvidence: "doctor-project-evidence-v1";
460
467
  doctorWorkspaceEvidence: "doctor-workspace-evidence-v1";
461
468
  doctorGraphDiagnosis: "doctor-graph-diagnosis.v1";