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
@@ -2,13 +2,15 @@
2
2
 
3
3
  Workspai's deterministic unit, contract, integration, and adversarial suites
4
4
  remain the release gates. Real-world qualification complements them by running
5
- the installed CLI against explicitly selected, linked reference repositories
5
+ the installed CLI against explicitly selected reference repositories through
6
+ local, network-free Git snapshots
6
7
  without installing dependencies or executing project lifecycle commands.
7
8
 
8
9
  ## Isolated and cumulative layouts
9
10
 
10
11
  Use one isolated workspace per repository when diagnosing detection, adoption,
11
- Doctor, model, graph, context, contract, and readiness behavior:
12
+ Doctor, model, graph, Goal Pack, agent handoff, context, contract, and readiness
13
+ behavior:
12
14
 
13
15
  ```bash
14
16
  REFERENCE_ROOT=/path/to/reference-repositories
@@ -20,6 +22,11 @@ npm run test:real-world -- \
20
22
  --report "$QUALIFICATION_ROOT/isolated.json"
21
23
  ```
22
24
 
25
+ Snapshot mode is the default and never changes adoption metadata, grounding, or
26
+ workspace links in the source repository. `--source-mode linked` remains an
27
+ explicit diagnostic escape hatch when uncommitted worktree content must be
28
+ qualified; it may update governed Workspai metadata in that linked checkout.
29
+
23
30
  Use `--shared-workspace` to adopt the repositories cumulatively into one fresh
24
31
  workspace. Every addition reruns the canonical chain, so transition and scale
25
32
  failures are observable rather than hidden behind the final state:
@@ -35,6 +42,12 @@ npm run test:real-world -- \
35
42
  --report "$QUALIFICATION_ROOT/shared.json"
36
43
  ```
37
44
 
45
+ At each cumulative adoption boundary, the harness also previews a
46
+ workspace-scoped Goal and requires its scope and baseline count to match every
47
+ project adopted so far. This catches stale Model/Graph or partial-scope
48
+ handoffs before the final large-workspace state hides the transition that
49
+ introduced them.
50
+
38
51
  After the shared workspace qualifies, exercise bounded queries, full graph
39
52
  exports, diff/impact/verify/trace, agent dry runs, portable archives, snapshots,
40
53
  and destructive-operation dry runs:
@@ -48,7 +61,9 @@ npm run test:real-world:enterprise -- \
48
61
 
49
62
  ## Safety and interpretation
50
63
 
51
- - Reference repositories are linked; source is never moved or copied.
64
+ - Reference repositories are cloned locally with `git clone --shared`; no
65
+ network request is made and the original checkout is read-only. Snapshot
66
+ adoption metadata and agent grounding remain under `--run-root`.
52
67
  - `--reference-root` is mandatory. The harness has no developer-machine default.
53
68
  - Qualification reports are publication-safe by construction: project names are
54
69
  anonymized, absolute paths and command arguments are omitted, and raw command
@@ -60,6 +75,10 @@ npm run test:real-world:enterprise -- \
60
75
  - Dependency installation, project build/test/start/init, infrastructure
61
76
  mutation, publication, and model network calls are not permitted.
62
77
  - Agent customization and destructive project operations are dry-run only.
78
+ - Goal qualification publishes one system-understanding Goal inside the
79
+ isolated test workspace, validates its lifecycle binding, and previews
80
+ runtime-specific coverage and release-readiness goals without executing
81
+ project tests or mutating project source.
63
82
  - Exit codes `1` and `2` may be valid domain outcomes when their documented JSON
64
83
  contracts parse successfully; unexpected process, timeout, buffer, or schema
65
84
  failures fail qualification.
@@ -54,8 +54,10 @@ npx workspai workspace import team.workspai-archive.zip --output ./team --json
54
54
  - Writes `.workspai/project.json`, `.workspai/adopt.json`, and `.workspai/adopt-readiness.json`.
55
55
  - Registry and contract sync include adopted projects for `workspace model`, `workspace context`, Dashboard, and agents.
56
56
  - Managed grounding writes a portable project lens, project grounding, and a
57
- bounded managed section in `AGENTS.md`. User-authored `AGENTS.md` content is
58
- preserved, and an authored tracked deletion of that file is never resurrected.
57
+ bounded managed section in `AGENTS.md`. It also publishes the portable agent
58
+ entry manifest and host adapters. User-authored instruction content and
59
+ symbolic links are preserved, and an authored tracked deletion is never
60
+ resurrected.
59
61
  - `--dry-run --json` previews detection without writing metadata. Its versioned
60
62
  `adoptedProject.effects` record also declares project metadata files,
61
63
  conditional `.gitignore`/`AGENTS.md` reconciliation, and the registration,
@@ -107,6 +109,7 @@ entry point into its canonical workspace:
107
109
  ```bash
108
110
  cd /absolute/path/to/project
109
111
  npx workspai project workspace status --json
112
+ npx workspai agent bootstrap --for-agent codex --json
110
113
  npx workspai doctor workspace --json=summary
111
114
  npx workspai doctor project --json
112
115
  npx workspai workspace graph search "authentication endpoint" --limit 12 --json
@@ -121,12 +124,13 @@ one workspace silently when ownership is ambiguous.
121
124
 
122
125
  The project receives four distinct surfaces:
123
126
 
124
- | File | Purpose | Portable |
125
- | ---------------------------------------------- | ----------------------------------------------------------------------------- | --------------------- |
126
- | `.workspai/workspace-link.local.json` | Machine-local canonical workspace binding | No; always gitignored |
127
- | `.workspai/reports/project-context-agent.json` | Bounded project view of model, graph, proofs, diagnostics, and safe commands | Yes |
128
- | `.workspai/PROJECT-GROUNDING.md` | Human- and agent-readable project entry guide | Yes |
129
- | `AGENTS.md` managed section | Tells compatible agents where to start and when to cross the project boundary | Yes |
127
+ | File | Purpose | Portable |
128
+ | ---------------------------------------------- | ------------------------------------------------------------------------------ | --------------------- |
129
+ | `.workspai/workspace-link.local.json` | Machine-local canonical workspace binding | No; always gitignored |
130
+ | `.workspai/agent-entry.v1.json` | Versioned host coverage, read order, authority boundaries, and integrity proof | Yes |
131
+ | `.workspai/reports/project-context-agent.json` | Bounded project view of model, graph, proofs, diagnostics, and safe commands | Yes |
132
+ | `.workspai/PROJECT-GROUNDING.md` | Human- and agent-readable project entry guide | Yes |
133
+ | `AGENTS.md` and host adapters | Route supported hosts to the same canonical-first bootstrap | Yes |
130
134
 
131
135
  The bounded context includes project identity and commands, dependencies and
132
136
  dependents, related API/deployment/test surfaces, current project findings,
@@ -142,6 +146,10 @@ Mode reconciliation is convergent: changing modes removes stale managed
142
146
  sections, portable files, or ignore rules that the new mode no longer owns,
143
147
  while preserving user-authored `AGENTS.md` and `.gitignore` content.
144
148
 
149
+ Run `project agent-entry verify --for-agent all --strict --json` to audit every
150
+ host projection. See [Canonical-first agent entry](./agent-entry.md) for status,
151
+ freshness, privacy, and consumer rules.
152
+
145
153
  If a workspace moved, or a cloned project has no valid local link, reconcile
146
154
  it explicitly:
147
155
 
@@ -70,8 +70,11 @@ same exact producer runs again before aggregate Workspace Intelligence verificat
70
70
  `propose` is the dynamic repair boundary for IDE models. A model may provide bounded complete-file
71
71
  writes/deletes and optional structured audit/test/build commands. The CLI rejects stale source
72
72
  hashes, duplicate targets, workspace evidence edits, Git internals, installed dependency trees,
73
- secret-bearing files, path/link escapes, and ungoverned commands. Dependency manifest proposals
74
- still receive CLI-inferred reconcile, audit, test, and build stages before strict verification.
73
+ secret-bearing files, path/link escapes, and ungoverned commands. For a linked project, proposal
74
+ paths may leave the central workspace only when the target resolves to exactly one canonical
75
+ project in `workspace.contract.json`; the authorized boundary is that project's exact root, never
76
+ its parent or a sibling repository. Dependency manifest proposals still receive CLI-inferred
77
+ reconcile, audit, test, and build stages before strict verification.
75
78
 
76
79
  Doctor also publishes a distinct `dependency-materialization` transaction when manifests exist
77
80
  but the installed runtime tree is missing. Its install or restore invocation is the repair stage
@@ -95,8 +98,10 @@ tool before the environment-creation stage runs.
95
98
  package fetching through `npx` is rejected.
96
99
  - Force and breaking changes require explicit policy approval. A different policy means a new
97
100
  plan and a new approval.
98
- - Files are bounded to the workspace, regular files only, at most 5 MiB each and 25 MiB per
99
- transaction. A source change between planning and execution expires approval.
101
+ - Files are bounded to the workspace or the exact root of one canonically registered linked
102
+ project, regular files only, at most 5 MiB each and 25 MiB per transaction. Absolute proposal
103
+ paths, unregistered external roots, parent/sibling escapes, and symbolic-link boundaries fail
104
+ closed. A source change between planning and execution expires approval.
100
105
  - A workspace-level owner lock prevents concurrent repair writers and is not stolen from a live
101
106
  process merely because a long transaction exceeded a wall-clock threshold. Resume skips
102
107
  durable passed stages.
@@ -112,6 +117,11 @@ tool before the environment-creation stage runs.
112
117
  missing or changed toolchain expires approval instead of starting a partial transaction.
113
118
  - The exact card producer is run twice: first as a no-mutation causal precondition, then after
114
119
  repair as card-local evidence. An aggregate workspace gate cannot substitute for either run.
120
+ - A Goal-bound proposal is linked to the active Goal before execution. Closure seals the fresh
121
+ structural Model hash, exact canonical Graph hash, and stable Graph input fingerprint into the
122
+ verification receipt. The receipt receives its own closure hash and remains acceptable as a
123
+ source transition only while the approved plan, proposal, checkpoint outputs, verification,
124
+ Goal identity, and current source fingerprints still agree.
115
125
 
116
126
  ## Runtime adapters
117
127
 
@@ -142,7 +152,7 @@ is durable under `.workspai/repair/transactions/<transaction-id>/`. Consumers sh
142
152
  the `workspace repair` action from `runtime-command-surface.v1.json`, render its stages and
143
153
  events, and send explicit user decisions back to the CLI. They must not reproduce the executor.
144
154
 
145
- The consumer protocol is fail-closed on four additional invariants:
155
+ The consumer protocol is fail-closed on these invariants:
146
156
 
147
157
  - `mutationAuthority=cli-only`: an IDE or model may inspect and propose, but it cannot run a
148
158
  parallel package-manager, file-write, or remediation executor.
@@ -153,6 +163,27 @@ The consumer protocol is fail-closed on four additional invariants:
153
163
  transaction recorded a different post-execution hash. Planned checkpoint files are not edits.
154
164
  - `consumerTimeline=durable-transaction-events`: progress, decisions, rollback, and closure are
155
165
  projections of ordered transaction/session events, not optimistic UI copy.
166
+ - `registeredLinkedProjectMutationBoundary=true`: an external source root is writable only when
167
+ it is exactly one project in the canonical workspace contract; parent and sibling roots never
168
+ inherit that authority.
169
+ - `sourceProposalIntegrity=project-bound-hash-pinned`: every proposed change is bound to the
170
+ selected project and the SHA-256 value observed before planning.
171
+ - `completionAuthority=cli-verification-receipt`: model prose, an IDE diff, or a successful build
172
+ cannot close a repair without the CLI transaction's exact-target verification receipt.
173
+ - `goalSourceTransition=closed-integrity-bound-transaction`: an immutable Goal may move from its
174
+ original Model/Graph binding only through a linked, approved, closed Repair transaction whose
175
+ current output and post-repair source binding still validate. Evidence-only regeneration with
176
+ identical live inputs remains valid; unlinked or unrelated source drift fails closed.
177
+
178
+ The runtime advertises this boundary as the capability invariants
179
+ `goalSourceTransition=closed-integrity-bound-v1` and
180
+ `goalAttemptBudget=durable-serialized-v1`. Consumers must probe them before a
181
+ Goal mutation; the package version alone is not sufficient proof.
182
+
183
+ Consumers must render changed files relative to the selected project (or workspace when no
184
+ project is selected). Portable `../` paths retained by the CLI transaction are execution identity,
185
+ not presentation text; absolute host paths and checkpoint internals must never cross into an IDE
186
+ card, model transcript, export, screenshot, or diagnostic bundle.
156
187
 
157
188
  IDE-generated input follows
158
189
  `contracts/workspace-intelligence/workspace-repair-proposal.v1.json`. The proposal is evidence,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.57.0",
3
+ "version": "0.59.0",
4
4
  "type": "module",
5
5
  "description": "Open-source workspace intelligence CLI for software systems: create, adopt, govern, verify, and align polyglot workspaces for humans, CI, IDEs, and AI agents.",
6
6
  "keywords": [
@@ -119,7 +119,8 @@
119
119
  "test:runtime-matrix:full": "node scripts/runtime-acceptance-matrix.mjs --full",
120
120
  "test:real-world": "node scripts/real-world-qualification.mjs",
121
121
  "test:real-world:enterprise": "node scripts/enterprise-workspace-qualification.mjs",
122
- "lint": "eslint src --ext .ts",
122
+ "check:english-text": "node ../../scripts/english-text-guard.mjs --all",
123
+ "lint": "corepack npm run check:english-text && eslint src --ext .ts",
123
124
  "lint:fix": "eslint src --ext .ts --fix",
124
125
  "format": "prettier --write \"src/**/*.ts\"",
125
126
  "format:check": "prettier --check \"src/**/*.ts\"",
@@ -205,6 +205,8 @@ const REQUIRED_PACKAGE_FILES = [
205
205
  'contracts/workspace-repair-capabilities.v1.json',
206
206
  'contracts/workspace-intelligence/workspace-repair-proposal.v1.json',
207
207
  'contracts/workspace-intelligence/workspace-repair-transaction.v1.json',
208
+ 'contracts/workspace-intelligence/project-agent-entry.v1.json',
209
+ 'contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json',
208
210
  'contracts/extension-cli-compatibility.v1.json',
209
211
  'data/modules-embeddings.json',
210
212
  'templates/kits/fastapi-standard/README.md.j2',
@@ -507,6 +509,8 @@ for (const relativePath of [
507
509
  'contracts/workspace-repair-capabilities.v1.json',
508
510
  'contracts/workspace-intelligence/workspace-repair-proposal.v1.json',
509
511
  'contracts/workspace-intelligence/workspace-repair-transaction.v1.json',
512
+ 'contracts/workspace-intelligence/project-agent-entry.v1.json',
513
+ 'contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json',
510
514
  'contracts/extension-cli-compatibility.v1.json',
511
515
  'data/modules-embeddings.json',
512
516
  ]) {
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-YM77FQB3.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-DF4NWPB7.js';
@@ -1 +0,0 @@
1
- export{b as runDoctorCapabilities}from'./chunk-IXOLHPTN.js';
@@ -1 +0,0 @@
1
- import {a}from'./chunk-W5ZFXKSL.js';import {a as a$1}from'./chunk-GR6442P7.js';import {f,e}from'./chunk-ADL3CK44.js';import {h,i}from'./chunk-5EPPPMAS.js';import {createHash}from'crypto';import c from'path';import {execa}from'execa';import u from'fs-extra';var V=h.projectTestCoverage.schemaVersion,k=i.projectTestCoverage,$=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deps.edn","project.clj","build.sbt","CMakeLists.txt","meson.build","deno.json","deno.jsonc"];function p(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:0}function m(e,t,o=0){let n=p(e),r=Math.min(p(t),n),i=p(o);return {total:n,covered:r,skipped:i,percent:n>0?Math.round(r/n*1e4)/100:null}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;return m(t.total,t.covered,t.skipped)}function y(e,t){let o=c.isAbsolute(t)?t:c.resolve(e,t),n=c.relative(e,o);return n&&!n.startsWith("..")?n.split(c.sep).join("/"):t}async function x(e){return createHash("sha256").update(await u.readFile(e)).digest("hex")}async function H(e){let t=c.resolve(e);for(;;){if(await u.pathExists(c.join(t,".workspai","project.json"))||await u.pathExists(c.join(t,".rapidkit","project.json"))||(await Promise.all($.map(r=>u.pathExists(c.join(t,r))))).some(Boolean))return t;let n=c.dirname(t);if(n===t)return c.resolve(e);t=n;}}async function D(e){if(await u.pathExists(c.join(e,"deno.json"))||await u.pathExists(c.join(e,"deno.jsonc")))return "deno";if(await u.pathExists(c.join(e,"bun.lock"))||await u.pathExists(c.join(e,"bun.lockb")))return "bun";if(await u.pathExists(c.join(e,"package.json")))return "node";if(await u.pathExists(c.join(e,"pyproject.toml"))||await u.pathExists(c.join(e,"requirements.txt")))return "python";if(await u.pathExists(c.join(e,"go.mod")))return "go";let t=await u.pathExists(c.join(e,"pom.xml"))||await u.pathExists(c.join(e,"build.gradle"))||await u.pathExists(c.join(e,"build.gradle.kts"));return t&&(await P(e,o=>o.endsWith(".kt")||o.endsWith(".kts")&&o!=="build.gradle.kts"&&o!=="settings.gradle.kts",4)).length>0?"kotlin":t?"java":await u.pathExists(c.join(e,"Cargo.toml"))?"rust":await u.pathExists(c.join(e,"composer.json"))?"php":await u.pathExists(c.join(e,"Gemfile"))?"ruby":await u.pathExists(c.join(e,"mix.exs"))?"elixir":await u.pathExists(c.join(e,"deps.edn"))||await u.pathExists(c.join(e,"project.clj"))?"clojure":await u.pathExists(c.join(e,"build.sbt"))?"scala":await u.pathExists(c.join(e,"CMakeLists.txt"))?(await P(e,n=>/\.(c|cc|cpp|cxx)$/.test(n),3)).some(n=>/\.(cc|cpp|cxx)$/.test(n))?"cpp":"c":(await P(e,o=>/\.(sln|csproj)$/.test(o),2)).length>0?"dotnet":"unknown"}async function P(e,t,o=5){let n=[],r=[{dir:e,depth:0}],i=new Set([".git",".workspai",".rapidkit","node_modules",".venv","vendor","deps"]);for(;r.length>0;){let s=r.shift();if(!s)break;let a=await u.readdir(s.dir,{withFileTypes:true}).catch(()=>[]);for(let l of a){if(i.has(l.name)||a$1(l.name))continue;let d=c.join(s.dir,l.name),g=c.relative(e,d).split(c.sep).join("/");l.isFile()&&t(l.name,g)&&n.push(d),l.isDirectory()&&s.depth<o&&r.push({dir:d,depth:s.depth+1});}}return n}async function L(e,t){let o=await u.readJson(t),n=o.total??o,r={};for(let s of ["lines","branches","functions","statements"]){let a=W(n[s]);a&&(r[s]=a);}let i=[];for(let[s,a]of Object.entries(o)){if(s==="total"||!a||typeof a!="object"||Array.isArray(a))continue;let l=a,d={};for(let g of ["lines","branches","functions","statements"]){let b=W(l[g]);b&&(d[g]=b);}i.push({path:y(e,s),metrics:d});}return {metrics:r,files:i,source:{format:"istanbul-json",path:t,sha256:await x(t)}}}async function G(e,t){let o=await u.readJson(t),n=o.totals??{},r={lines:m(n.num_statements,n.covered_lines)};p(n.num_branches)>0&&(r.branches=m(n.num_branches,n.covered_branches));let i=[];for(let[s,a]of Object.entries(o.files??{})){let l=a?.summary??{};i.push({path:y(e,s),metrics:{lines:m(l.num_statements,l.covered_lines),...p(l.num_branches)>0?{branches:m(l.num_branches,l.covered_branches)}:{}}});}return {metrics:r,files:i,source:{format:"coverage-py-json",path:t,sha256:await x(t)}}}function j(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o=p(t.count),n=p(t.covered);return o>0?m(o,n):void 0}async function q(e,t){let o=await u.readJson(t),n=Array.isArray(o.data)?o.data[0]??{}:o,r=n.totals??{},i={};i.lines=j(r.lines),i.functions=j(r.functions),i.branches=j(r.branches),i.statements=j(r.regions);let s=[];for(let a of Array.isArray(n.files)?n.files:[]){if(!a||typeof a!="object"||Array.isArray(a))continue;let l=a,d=l.summary??{};s.push({path:y(e,String(l.filename??"unknown")),metrics:{lines:j(d.lines),functions:j(d.functions),branches:j(d.branches),statements:j(d.regions)}});}return {metrics:i,files:s,source:{format:"llvm-cov-json",path:t,sha256:await x(t)}}}async function A(e,t){let o=await u.readFile(t,"utf8"),n=[],r="",i=0,s=0,a=0,l=0,d=0,g=0,b=v=>{r&&(n.push({path:y(e,r),metrics:{lines:m(v.lineTotal,v.lineCovered),functions:m(v.functionTotal,v.functionCovered),branches:m(v.branchTotal,v.branchCovered)}}),i+=v.lineTotal,s+=v.lineCovered,a+=v.functionTotal,l+=v.functionCovered,d+=v.branchTotal,g+=v.branchCovered);},h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0};for(let v of o.split(/\r?\n/))v.startsWith("SF:")?r=v.slice(3):v.startsWith("LF:")?h.lineTotal=p(v.slice(3)):v.startsWith("LH:")?h.lineCovered=p(v.slice(3)):v.startsWith("FNF:")?h.functionTotal=p(v.slice(4)):v.startsWith("FNH:")?h.functionCovered=p(v.slice(4)):v.startsWith("BRF:")?h.branchTotal=p(v.slice(4)):v.startsWith("BRH:")?h.branchCovered=p(v.slice(4)):v==="end_of_record"&&(b(h),r="",h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0});return {metrics:{lines:m(i,s),functions:m(a,l),branches:m(d,g)},files:n,source:{format:"lcov",path:t,sha256:await x(t)}}}async function U(e,t){let o=await u.readFile(t,"utf8"),n=new Map;for(let s of o.split(/\r?\n/).slice(1)){let a=/^(.+?):\d+\.\d+,\d+\.\d+\s+(\d+)\s+(\d+)$/.exec(s.trim());if(!a)continue;let l=n.get(a[1])??{total:0,covered:0},d=p(a[2]);l.total+=d,p(a[3])>0&&(l.covered+=d),n.set(a[1],l);}let r=[...n.entries()].map(([s,a])=>({path:y(e,s),metrics:{statements:m(a.total,a.covered)}})),i=[...n.values()].reduce((s,a)=>({total:s.total+a.total,covered:s.covered+a.covered}),{total:0,covered:0});return {metrics:{statements:m(i.total,i.covered)},files:r,source:{format:"go-coverprofile",path:t,sha256:await x(t)}}}function T(e,t){let n=[...e.matchAll(new RegExp(`<counter\\s+type=["']${t}["']\\s+missed=["'](\\d+)["']\\s+covered=["'](\\d+)["']\\s*\\/?\\s*>`,"gi"))].at(-1);return n?m(Number(n[1])+Number(n[2]),n[2]):void 0}async function C(e,t){let o=await u.readFile(e,"utf8"),n={};if(t==="cobertura-xml"){let r=/<coverage\b([^>]*)>/i.exec(o)?.[1]??"",i=/\bline-rate=["']([\d.]+)["']/i.exec(r)?.[1],s=/\bbranch-rate=["']([\d.]+)["']/i.exec(r)?.[1];i&&(n.lines=m(1e4,Math.round(Number(i)*1e4))),s&&(n.branches=m(1e4,Math.round(Number(s)*1e4)));}if(t==="clover-xml"){let i=[...o.matchAll(/<metrics\b([^>]*)\/?>/gi)].at(-1)?.[1]??"",s=g=>p(new RegExp(`\\b${g}=["'](\\d+)["']`,"i").exec(i)?.[1]),a=s("statements"),l=s("methods"),d=s("conditionals");a>0&&(n.statements=m(a,s("coveredstatements"))),l>0&&(n.functions=m(l,s("coveredmethods"))),d>0&&(n.branches=m(d,s("coveredconditionals")));}return n.lines??=T(o,"LINE"),n.branches??=T(o,"BRANCH"),n.functions??=T(o,"METHOD"),n.statements??=T(o,"INSTRUCTION"),{metrics:n,files:[],source:{format:t,path:e,sha256:await x(e)}}}async function z(e){let t=await u.readFile(e,"utf8"),o=/<scoverage\b([^>]*)>/i.exec(t)?.[1]??"",n=b=>p(new RegExp(`\\b${b}=["']([\\d.]+)["']`,"i").exec(o)?.[1]),r=n("statement-count"),i=n("statements-invoked"),s=n("branch-count"),a=n("branches-invoked"),l=n("statement-rate"),d=n("branch-rate"),g={};return r>0?g.statements=m(r,i):l>0&&(g.statements=m(1e4,Math.round(l*100))),s>0?g.branches=m(s,a):d>0&&(g.branches=m(1e4,Math.round(d*100))),{metrics:g,files:[],source:{format:"scoverage-xml",path:e,sha256:await x(e)}}}async function B(e,t){let o=await u.readJson(t),n=new Map;for(let s of Object.values(o)){let a=s?.coverage;if(!(!a||typeof a!="object"||Array.isArray(a)))for(let[l,d]of Object.entries(a)){if(!Array.isArray(d))continue;let g=n.get(l)??[];d.forEach((b,h)=>{typeof b=="number"&&(g[h]=Math.max(g[h]??0,b));}),n.set(l,g);}}let r=[...n.entries()].map(([s,a])=>{let l=a.filter(d=>typeof d=="number");return {path:y(e,s),metrics:{lines:m(l.length,l.filter(d=>d>0).length)}}}),i=r.reduce((s,a)=>{let l=a.metrics.lines;return {total:s.total+(l?.total??0),covered:s.covered+(l?.covered??0)}},{total:0,covered:0});return {metrics:{lines:m(i.total,i.covered)},files:r,source:{format:"simplecov-json",path:t,sha256:await x(t)}}}async function K(e){let t=[{relativePath:"coverage/coverage-summary.json",parser:r=>L(e,r)},{relativePath:"coverage.json",parser:async r=>{let i=await u.readJson(r);return Array.isArray(i.data)?q(e,r):G(e,r)}},{relativePath:"coverage/lcov.info",parser:r=>A(e,r)},{relativePath:"cover/lcov.info",parser:r=>A(e,r)},{relativePath:"lcov.info",parser:r=>A(e,r)},{relativePath:"coverage.out",parser:r=>U(e,r)},{relativePath:"target/site/jacoco/jacoco.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"build/reports/jacoco/test/jacocoTestReport.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"coverage.xml",parser:r=>C(r,"clover-xml")},{relativePath:".resultset.json",parser:r=>B(e,r)}];for(let r of t){let i=c.join(e,r.relativePath);if(await u.pathExists(i))return r.parser(i)}let n=(await P(e,(r,i)=>r==="coverage.cobertura.xml"||r==="jacoco.xml"||r==="clover.xml"||r==="scoverage.xml"||i.endsWith("/coverage-summary.json"),7)).sort()[0];return n?n.endsWith("coverage-summary.json")?L(e,n):n.endsWith("jacoco.xml")?C(n,"jacoco-xml"):n.endsWith("coverage.cobertura.xml")?C(n,"cobertura-xml"):n.endsWith("scoverage.xml")?z(n):C(n,"clover-xml"):null}async function X(e){return u.readJson(c.join(e,"package.json")).catch(()=>null)}async function Q(e,t){let o=(n,r)=>({cwd:e,executable:n,args:r});if(t==="node"||t==="bun"){let r=(await X(e))?.scripts??{},i=["test:coverage","test:cov","coverage"].find(a=>typeof r[a]=="string"),s=t==="bun"?"bun":await u.pathExists(c.join(e,"pnpm-lock.yaml"))?"pnpm":await u.pathExists(c.join(e,"yarn.lock"))?"yarn":"npm";if(i)return {runner:String(r[i]).split(/\s+/)[0]||s,invocations:[o(s,s==="yarn"?[i]:["run",i])],diagnostics:[]};if(typeof r.test=="string"){let a=s==="yarn"?["test","--coverage"]:s==="bun"?["test","--coverage","--coverage-reporter=lcov"]:["test","--","--coverage"];return {runner:String(r.test).split(/\s+/)[0]||s,invocations:[o(s,a)],diagnostics:[]}}return {runner:null,invocations:[],diagnostics:["No project-owned test or coverage script was detected."]}}if(t==="deno")return {runner:"deno",invocations:[o("deno",["test","--coverage=coverage"]),o("deno",["coverage","--lcov","--output=coverage/lcov.info","coverage"])],diagnostics:[]};if(t==="python")return {runner:"pytest-cov",invocations:[o(await u.pathExists(c.join(e,".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"))?c.join(".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"):process.platform==="win32"?"python":"python3",["-m","pytest","--cov=.","--cov-report=json:coverage.json"])],diagnostics:[]};if(t==="go")return {runner:"go test",invocations:[o("go",["test","./...","-coverprofile=coverage.out"])],diagnostics:[]};if(t==="java"){let n=await u.pathExists(c.join(e,"gradlew")),r=await u.pathExists(c.join(e,"gradlew.bat")),i=n||r,s=await u.pathExists(c.join(e,"mvnw")),a=await u.pathExists(c.join(e,"mvnw.cmd")),l=i?process.platform==="win32"&&r?".\\gradlew.bat":"./gradlew":await u.pathExists(c.join(e,"pom.xml"))?process.platform==="win32"&&a?".\\mvnw.cmd":s?"./mvnw":"mvn":"gradle";return {runner:i?"jacoco/gradle":"jacoco/maven",invocations:[o(l,i?["test","jacocoTestReport"]:["test","jacoco:report"])],diagnostics:[]}}return t==="dotnet"?{runner:"dotnet coverlet",invocations:[o("dotnet",["test","--collect:XPlat Code Coverage"])],diagnostics:[]}:t==="rust"?{runner:"cargo llvm-cov",invocations:[o("cargo",["llvm-cov","--json","--output-path","coverage.json"])],diagnostics:["cargo-llvm-cov must be available in the project toolchain."]}:t==="php"?{runner:"phpunit",invocations:[o(process.platform==="win32"?"vendor\\bin\\phpunit.bat":"vendor/bin/phpunit",["--coverage-clover","coverage.xml"])],diagnostics:[]}:t==="ruby"?{runner:"simplecov",invocations:[o("bundle",["exec","rspec"])],diagnostics:["The test suite must enable SimpleCov to emit .resultset.json."]}:t==="elixir"?{runner:"mix cover",invocations:[o("mix",["test","--cover"])],diagnostics:["Configure ExCoveralls for JSON or LCOV interchange when machine-readable coverage is required."]}:t==="clojure"?{runner:"cloverage",invocations:[o("clojure",["-M:coverage"])],diagnostics:["The project must declare a coverage alias such as cloverage."]}:t==="scala"?{runner:"sbt-scoverage",invocations:[o("sbt",["clean","coverage","test","coverageReport"])],diagnostics:["The project must declare the scoverage plugin."]}:t==="kotlin"?{runner:"jacoco/gradle",invocations:[o(await u.pathExists(c.join(e,process.platform==="win32"?"gradlew.bat":"gradlew"))?process.platform==="win32"?".\\gradlew.bat":"./gradlew":"gradle",["test","jacocoTestReport"])],diagnostics:["The project must declare the JaCoCo Gradle plugin."]}:t==="c"||t==="cpp"?{runner:"CTest/LLVM coverage",invocations:[o("ctest",["--test-dir","build","--output-on-failure"])],diagnostics:["The native build must be instrumented for coverage and export LCOV, Cobertura, or LLVM JSON evidence."]}:{runner:null,invocations:[],diagnostics:["Project runtime could not be detected."]}}function Y(e,t){let o=e?c.relative(e,t).split(c.sep).join("/"):c.resolve(t),n=c.basename(t).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"project",r=createHash("sha256").update(o).digest("hex").slice(0,12);return `${n}--${r}`}function Z(e){return e.lines?"lines":e.statements?"statements":e.branches?"branches":"functions"}async function ue(e$1={}){let t=await H(e$1.projectPath??process.cwd()),o=a(t),n=await D(t),r=Math.max(0,Math.min(100,Math.round(e$1.target??80))),i=await Q(t,n),s=[],a$1=Date.now();if(e$1.run)for(let f of i.invocations){let w=await execa(f.executable,f.args,{cwd:f.cwd,reject:false,timeout:6e5}).catch(()=>({exitCode:1}));if(s.push(Number(w.exitCode??1)),Number(w.exitCode??1)!==0)break}let l=await K(t).catch(()=>null),d=l?Z(l.metrics):"lines",g=l?.metrics[d]?.percent??null,b=e$1.run&&s.some(f=>f!==0)?"failed":g===null?"unavailable":g>=r?"passed":"below-target",h=Y(o,t),v=c.join(t,k),E=o?`.workspai/reports/projects/${h}/project-test-coverage-last-run.json`:null,R={schemaVersion:V,generatedAt:new Date().toISOString(),status:b,project:{id:h,name:c.basename(t),path:t,workspacePath:o},runtime:n,runner:i.runner,target:{metric:d,percent:r},metrics:l?.metrics??{},files:l?.files??[],lowCoverageFiles:(l?.files??[]).map(f=>{let w=f.metrics[d]??f.metrics.lines??f.metrics.statements;return {path:f.path,percent:w?.percent??null,uncovered:Math.max(0,(w?.total??0)-(w?.covered??0))}}).filter(f=>f.percent===null||f.percent<r).sort((f,w)=>w.uncovered-f.uncovered||f.path.localeCompare(w.path)),source:l?.source??{format:"unknown",path:null,sha256:null},execution:{requested:e$1.run===true,invocations:i.invocations,exitCodes:s,durationMs:Date.now()-a$1},diagnostics:[...i.diagnostics,...l?[]:["No supported machine-readable coverage artifact was found."]],artifactPaths:{project:v,workspaceLatest:o?c.join(o,k):null,workspaceProject:o&&E?c.join(o,E):null}};return o&&E&&await f(o,k,[{relativePath:k,payload:R},{relativePath:E,payload:R}]),await e(t,k,R),R}export{V as a,k as b,ue as c};
@@ -1 +0,0 @@
1
- var r="workspai.doctor-capabilities.v1",k="universal-doctor-capabilities-v1",t="workspai.doctor-validation.v1",w="doctor-disease-corpus-v1";var o={model:".workspai/reports/workspace-model.json",knowledgeGraph:".workspai/reports/workspace-knowledge-graph.json",snapshot:".workspai/reports/workspace-model-snapshot.json",diff:".workspai/reports/workspace-model-diff-last-run.json",impact:".workspai/reports/workspace-impact-last-run.json",analyze:".workspai/reports/analyze-last-run.json",doctor:".workspai/reports/doctor-last-run.json",contractVerify:".workspai/reports/workspace-contract-verify-last-run.json",readiness:".workspai/reports/release-readiness-last-run.json",verify:".workspai/reports/workspace-verify-last-run.json",history:".workspai/reports/workspace-intelligence-history.json",agentContext:".workspai/reports/workspace-context-agent.json",agentIndex:".workspai/reports/INDEX.json",agentCustomizationPack:".workspai/reports/agent-customization-pack.json",skillsIndex:".workspai/reports/workspace-skills-index.json",agents:"AGENTS.md",explain:".workspai/reports/workspace-explain-last-run.json",intelligenceRun:".workspai/reports/workspace-intelligence-run-last-run.json",evaluationLive:".workspai/reports/workspace-intelligence-evaluation-live.json",evaluationLastRun:".workspai/reports/workspace-intelligence-evaluation-last-run.json",verifiedGoalStatus:".workspai/reports/verified-goal-last-run.json",repairTransaction:".workspai/reports/workspace-repair-last-run.json"},s={model:"workspace-model.v1",knowledgeGraph:"workspace-knowledge-graph.v1",snapshot:"workspace-model-snapshot.v1",diff:"workspace-model-diff.v1",impact:"workspace-impact.v1",analyze:"rapidkit-analyze-v1",doctor:"doctor-workspace-evidence-v1",contractVerify:"workspace-contract-verify.v1",readiness:"release-readiness-v1",verify:"workspace-verify.v1",history:"workspace-intelligence-history.v1",agentContext:"workspace-context.v1",agentIndex:"rapidkit-agent-reports-index.v1",agentCustomizationPack:"rapidkit-agent-customization-pack.v1",skillsIndex:"workspace-skills-index.v1",agents:null,explain:"workspace-explain.v1",intelligenceRun:"workspace-intelligence-run.v1",evaluationLive:"workspace-intelligence-evaluation.v1",evaluationLastRun:"workspace-intelligence-evaluation.v1",verifiedGoalStatus:"workspai.verified-goal-status.v1",repairTransaction:"workspai.workspace-repair-transaction.v1"},c={model:"contracts/workspace-intelligence/workspace-model.v1.json",knowledgeGraph:"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json",snapshot:"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",diff:"contracts/workspace-intelligence/workspace-model-diff.v1.json",impact:"contracts/workspace-intelligence/workspace-impact.v1.json",analyze:"contracts/analyze-last-run.v1.json",doctor:"contracts/doctor-workspace-evidence.v1.json",contractVerify:"contracts/workspace-intelligence/workspace-contract-verify.v1.json",readiness:"contracts/release-readiness.v1.json",verify:"contracts/workspace-intelligence/workspace-verify.v1.json",history:"contracts/workspace-intelligence/workspace-intelligence-history.v1.json",agentContext:"contracts/workspace-intelligence/workspace-context.v1.json",agentIndex:"contracts/workspace-intelligence/agent-reports-index.v1.json",agentCustomizationPack:"contracts/workspace-intelligence/agent-customization-pack-report.v1.json",skillsIndex:"contracts/workspace-intelligence/workspace-skills-index.v1.json",agents:null,explain:"contracts/workspace-intelligence/workspace-explain.v1.json",intelligenceRun:"contracts/workspace-intelligence/workspace-intelligence-run.v1.json",evaluationLive:"contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",evaluationLastRun:"contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",verifiedGoalStatus:"contracts/workspace-intelligence/verified-goal-status.v1.json",repairTransaction:"contracts/workspace-intelligence/workspace-repair-transaction.v1.json"},l={projectWorkspaceLink:{artifactPath:".workspai/workspace-link.local.json",schemaVersion:"project-workspace-link.v1",contractPath:"contracts/project-workspace-link.v1.json",producerCommands:[["adopt"],["import"],["project","workspace","relink"],["workspace","sync"]]},projectContextAgent:{artifactPath:".workspai/reports/project-context-agent.json",schemaVersion:"project-context-agent.v1",contractPath:"contracts/workspace-intelligence/project-context-agent.v1.json",producerCommands:[["adopt"],["import"],["workspace","sync"],["workspace","agent-sync","--write"]]},workspaceContract:{artifactPath:".workspai/workspace.contract.json",schemaVersion:1,contractPath:"contracts/workspace-contract.v1.json",producerCommands:[["workspace","sync"],["workspace","contract","sync"]]},workspaceModelCache:{artifactPath:".workspai/cache/workspace-model.v1.json",schemaVersion:"workspace-model-cache.v1",contractPath:"contracts/workspace-model-cache.v1.json",producerCommands:[["workspace","model"]]},workspaceRegistry:{artifactPath:".workspai/workspace-registry.v1.json",schemaVersion:"workspace-registry.v1",contractPath:"contracts/workspace-registry.v1.json",producerCommands:[["workspace","sync"]]},compatibilityMatrix:{artifactPath:".workspai/compatibility-matrix.json",schemaVersion:"rapidkit.compatibility-matrix.v1",contractPath:"contracts/compatibility-matrix.v1.json",producerCommands:[["bootstrap"]]},doctorWorkspaceCache:{artifactPath:".workspai/reports/doctor-workspace-cache.json",schemaVersion:"doctor-workspace-cache-v2",contractPath:"contracts/doctor-workspace-cache.v2.json",producerCommands:[["doctor","workspace"]]},doctorCapabilities:{artifactPath:".workspai/reports/doctor-capabilities.json",schemaVersion:r,contractPath:"contracts/workspace-intelligence/doctor-capabilities.v1.json",producerCommands:[["doctor","capabilities","--write"]]},doctorValidation:{artifactPath:".workspai/reports/doctor-validation-last-run.json",schemaVersion:t,contractPath:"contracts/workspace-intelligence/doctor-validation.v1.json",producerCommands:[["doctor","capabilities","--validate","--write"]]},bootstrapCompliance:{artifactPath:".workspai/reports/bootstrap-compliance.latest.json",schemaVersion:"bootstrap-compliance.v1",contractPath:"contracts/bootstrap-compliance.v1.json",producerCommands:[["bootstrap"]]},mirrorOps:{artifactPath:".workspai/reports/mirror-ops.latest.json",schemaVersion:"mirror-ops.v1",contractPath:"contracts/mirror-ops.v1.json",producerCommands:[["mirror","status"]]},transparencyEvidence:{artifactPath:".workspai/reports/transparency-evidence.latest.json",schemaVersion:"transparency-evidence.v1",contractPath:"contracts/transparency-evidence.v1.json",producerCommands:[["mirror","sync"]]},workspaceShareBundle:{artifactPath:".workspai/reports/share-bundle.json",schemaVersion:"1.1",schemaVersionField:"schema_version",contractPath:"contracts/workspace-share-bundle.v1.json",producerCommands:[["workspace","share"]]},doctorProject:{artifactPath:".workspai/reports/doctor-project-last-run.json",schemaVersion:"doctor-project-evidence-v1",contractPath:"contracts/doctor-project-evidence.v1.json",producerCommands:[["doctor","project"]]},doctorReceipt:{artifactPath:".workspai/reports/doctor-receipt-last-run.json",schemaVersion:"workspai.doctor-receipt.v1",contractPath:"contracts/workspace-intelligence/doctor-receipt.v1.json",producerCommands:[["doctor","workspace"],["doctor","project"]]},projectTestCoverage:{artifactPath:".workspai/reports/project-test-coverage-last-run.json",schemaVersion:"workspai.project-test-coverage.v1",contractPath:"contracts/project-test-coverage.v1.json",producerCommands:[["project","coverage"]]},doctorRemediationPlan:{artifactPath:".workspai/reports/doctor-remediation-plan-last-run.json",schemaVersion:"doctor-remediation-plan-v2",contractPath:"contracts/doctor-remediation-plan.v2.json",producerCommands:[["workspace","remediation-plan"]]},artifactRemediationPlan:{artifactPath:".workspai/reports/artifact-remediation-plan-last-run.json",schemaVersion:"artifact-remediation-plan-v1",contractPath:"contracts/artifact-remediation-plan.v1.json",producerCommands:[["workspace","remediation-plan"]]},doctorFixResult:{artifactPath:".workspai/reports/doctor-fix-result-last-run.json",schemaVersion:"rapidkit-doctor-fix-result-v1",contractPath:"contracts/workspace-intelligence/doctor-fix-result.v1.json",producerCommands:[["doctor","workspace"]]},pipelineLastRun:{artifactPath:".workspai/reports/pipeline-last-run.json",schemaVersion:"rapidkit-pipeline-v1",contractPath:"contracts/pipeline-last-run.v1.json",producerCommands:[["pipeline"]]},autopilotReleaseLastRun:{artifactPath:".workspai/reports/autopilot-release-last-run.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json",producerCommands:[["autopilot","release"]]},autopilotReleaseAlias:{artifactPath:".workspai/reports/autopilot-release.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json",producerCommands:[["autopilot","release"]]},workspaceRunLast:{artifactPath:".workspai/reports/workspace-run-last.json",schemaVersion:"workspace-run-v1",contractPath:"contracts/workspace-run-last.v1.json",producerCommands:[["workspace","run"]]},workspaiMcpDesign:{artifactPath:".workspai/reports/workspai-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json",producerCommands:[["workspace","agent-sync","--write"]]},legacyMcpDesign:{artifactPath:".workspai/reports/rapidkit-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json",producerCommands:[["workspace","agent-sync","--write"]]},workspaceWhy:{artifactPath:".workspai/reports/workspace-why-last-run.json",schemaVersion:s.explain,contractPath:c.explain,producerCommands:[["workspace","why"]]},workspaceTrace:{artifactPath:".workspai/reports/workspace-trace-last-run.json",schemaVersion:s.explain,contractPath:c.explain,producerCommands:[["workspace","trace"]]},agentHooks:{artifactPath:".vscode/workspai-agent-hooks.json",schemaVersion:"workspai-agent-hooks.v1",contractPath:"contracts/workspace-intelligence/agent-hooks.v1.json",producerCommands:[["workspace","agent-sync"]]},infraPlan:{artifactPath:".workspai/reports/infra-plan.json",schemaVersion:"rapidkit.infra-plan.v1",contractPath:"contracts/infra-plan.v1.json",producerCommands:[["infra","plan"]]}},h=Object.freeze(Object.fromEntries(Object.entries(l).map(([a,n])=>[a,n.artifactPath]))),g={[o.intelligenceRun]:[["workspace","intelligence","run"]],[o.snapshot]:[["workspace","snapshot"]],[o.history]:[["workspace","feedback","record","--json"]],[o.evaluationLive]:[["workspace","eval","init"],["workspace","eval","record","--json"]],[o.evaluationLastRun]:[["workspace","eval","report","--json"]],[o.verifiedGoalStatus]:[["workspace","goal","plan"],["workspace","goal","verify"]],[o.repairTransaction]:[["workspace","repair","plan"],["workspace","repair","propose"],["workspace","repair","approve"],["workspace","repair","decide"],["workspace","repair","execute"],["workspace","repair","resume"],["workspace","repair","rollback"],["workspace","repair","cancel"]]},j={analyze:"analyze",workspace:"workspace <action> [subaction] [key] [value]",doctor:"doctor [scope]",readiness:"readiness"},f=["analyze","readiness","doctor","workspace"],C=["model","diff","impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify","context","agent-sync","explain"],P=["sync","baseline"],I={sync:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],baseline:[o.snapshot]},e=o,d={model:{command:["workspace","model","--json","--write"],produces:[e.model,e.knowledgeGraph]},diff:{command:["workspace","diff","--from",e.snapshot,"--json"],produces:[e.diff]},impact:{command:["workspace","impact","--from",e.diff,"--json"],produces:[e.impact]},"doctor-evidence":{command:["doctor","workspace","--json"],produces:[e.doctor]},"contract-evidence":{command:["workspace","contract","verify","--strict","--json"],produces:[e.contractVerify]},"analyze-evidence":{command:["analyze","--json"],produces:[e.analyze]},"readiness-evidence":{command:["readiness","--json","--skip-verify"],produces:[e.readiness]},verify:{command:["workspace","verify","--from-impact",e.impact,"--json"],produces:[e.verify,e.history]},context:{command:["workspace","context","--for-agent","--json","--write","--no-agent-sync"],produces:[e.agentContext]},"agent-sync":{command:["workspace","agent-sync","--write","--json","--preset","enterprise"],produces:[e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents]},explain:{command:["workspace","explain","release-blocked","--json","--write"],produces:[e.explain]}};function y(a){return d[a]}export{r as a,k as b,t as c,w as d,o as e,s as f,c as g,l as h,h as i,g as j,j as k,f as l,C as m,P as n,I as o,d as p,y as q};
@@ -1 +0,0 @@
1
- var X="workspace-knowledge-search.v1";function b(e){return e.trim().toLowerCase()}var z=new WeakMap;function A(e){let t=z.get(e);if(t)return t;let o=new Map(e.relations.map(s=>[s.id,s])),a=new Map(e.entities.map(s=>[s.id,s])),l=new Map(e.proofs.map(s=>[s.id,s])),r=new Map,d=new Map,f=(s,p)=>{let g=d.get(s)??[];g.push(p),d.set(s,g);};for(let s of e.entities){let p=[s.id,s.label,s.identity.key,...s.kind==="project"&&s.projectId?[s.projectId]:[],...s.identity.aliases];for(let g of new Set(p.map(b))){let m=r.get(g)??[];m.push(s),r.set(g,m);}}for(let s of e.relations)f(s.from,{from:s.from,to:s.to,relationId:s.id,kind:s.kind,direction:"forward",proofIds:s.proofIds}),f(s.to,{from:s.to,to:s.from,relationId:s.id,kind:s.kind,direction:"reverse",proofIds:s.proofIds});for(let s of r.values())s.sort((p,g)=>p.id.localeCompare(g.id));for(let s of d.values())s.sort((p,g)=>p.to.localeCompare(g.to)||p.relationId.localeCompare(g.relationId));let c={entitiesById:a,relationsById:o,entitiesByAlias:r,proofsById:l,adjacency:d};return z.set(e,c),c}function _(e,t){let o=A(e),a=o.relationsById.get(t);if(a)return {found:true,targetType:"relation",relation:a};let l=b(t),r=o.entitiesByAlias.get(l)??[];return r.length===1?{found:true,targetType:"entity",entity:r[0]}:{found:false,query:t,candidates:r.map(d=>d.id).sort()}}function fe(e,t){let o=_(e,t);if(!o.found)return {query:t,found:false,target:null,proofs:[],candidates:o.candidates};let a=o.targetType==="entity"?o.entity:o.relation,l=new Set(a.proofIds);return {query:t,found:true,target:a,candidates:[],proofs:[...l].map(r=>A(e).proofsById.get(r)).filter(r=>!!r).sort((r,d)=>r.id.localeCompare(d.id))}}function ue(e,t,o){let a=_(e,t),l=_(e,o);if(!a.found||a.targetType!=="entity"||!l.found||l.targetType!=="entity")return {from:t,to:o,found:false,resolvedFrom:a.found&&a.targetType==="entity"?a.entity.id:null,resolvedTo:l.found&&l.targetType==="entity"?l.entity.id:null,entityPath:[],hops:[],proofs:[]};let r=A(e),d=[a.entity.id],f=new Map,c=new Set(d),s=0;for(;s<d.length&&!c.has(l.entity.id);){let h=d[s++];for(let w of r.adjacency.get(h)??[])c.has(w.to)||(c.add(w.to),f.set(w.to,w),d.push(w.to));}if(!c.has(l.entity.id))return {from:t,to:o,found:false,resolvedFrom:a.entity.id,resolvedTo:l.entity.id,entityPath:[],hops:[],proofs:[]};let p=[],g=l.entity.id;for(;g!==a.entity.id;){let h=f.get(g);if(!h)break;p.push(h),g=h.from;}p.reverse();let m=new Set(p.flatMap(h=>h.proofIds));return {from:t,to:o,found:true,resolvedFrom:a.entity.id,resolvedTo:l.entity.id,entityPath:[a.entity.id,...p.map(h=>h.to)],hops:p,proofs:[...m].map(h=>r.proofsById.get(h)).filter(h=>!!h).sort((h,w)=>h.id.localeCompare(w.id))}}function ke(e,t){return e.entities.filter(o=>!t||o.kind===t).sort((o,a)=>o.kind.localeCompare(a.kind)||o.label.localeCompare(a.label))}var y={relations:24,relatedEntities:24,proofs:16,proofIdsPerItem:4,aliasesPerEntity:8,attributeArrayItems:8,attributeStringCharacters:256};function Z(e){let t=[],o=new Set;for(let a=0;a<y.proofIdsPerItem&&t.length<y.proofs;a+=1)for(let l of e){let r=l.proofIds[a];if(!(!r||o.has(r))&&(o.add(r),t.push(r),t.length>=y.proofs))break}return t}function J(e,t,o){let a=e.identity.aliases.slice(0,y.aliasesPerEntity);o.aliases+=e.identity.aliases.length-a.length;let l=Object.fromEntries(Object.entries(e.attributes).map(([d,f])=>{if(Array.isArray(f)){let c=f.slice(0,y.attributeArrayItems);return o.attributeValues+=f.length-c.length,[d,c]}return typeof f=="string"&&f.length>y.attributeStringCharacters?(o.attributeValues+=1,[d,f.slice(0,y.attributeStringCharacters)]):[d,f]})),r=e.proofIds.filter(d=>t.has(d)).slice(0,y.proofIdsPerItem);return o.proofReferences+=e.proofIds.length-r.length,{...e,identity:{...e.identity,aliases:a},attributes:l,proofIds:r}}function ee(e){let t=Object.values(e.attributes).flatMap(o=>Array.isArray(o)?o:[o]);return [e.id,e.kind,e.label,e.projectId??"",e.identity.key,...e.identity.aliases,...t.map(o=>String(o??""))].join(" ").toLowerCase()}var te=new Set(["a","an","and","are","as","at","be","been","being","by","can","check","could","did","do","does","find","for","from","give","had","has","have","how","i","in","into","is","it","its","may","might","of","on","or","our","show","should","that","the","their","them","then","there","these","they","this","those","tell","to","was","we","were","what","when","where","which","who","why","will","with","would","you","your"]);function j(e){let t=o=>b(o).split(/[^a-z0-9]+/u).filter(a=>a.length>1);return [...new Set([...t(e),...t(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"))])]}function ne(e){let t=b(e.label),o=b(e.identity.key),a=e.identity.aliases.map(b),l=ee(e);return {entity:e,label:t,identity:o,aliases:a,haystack:l,labelTokens:new Set(j(e.label)),identityTokens:new Set(j(e.identity.key)),aliasTokens:new Set(e.identity.aliases.flatMap(j)),allTokens:new Set(j(l))}}function S(e,t){return e.has(t)||t.length>=3&&[...e].some(o=>o.startsWith(t))}function O(e,t){return S(e.labelTokens,t)||S(e.identityTokens,t)||S(e.aliasTokens,t)||S(e.allTokens,t)}function oe(e,t,o,a){let{label:l,identity:r,aliases:d,haystack:f}=e,c=0;(l===t||r===t||d.includes(t))&&(c+=1e4),(l.startsWith(t)||r.startsWith(t))&&(c+=250),f.includes(t)&&(c+=100);let s=0;for(let p of o){let g=a.get(p)??1,m=S(e.labelTokens,p),h=S(e.identityTokens,p),w=S(e.aliasTokens,p),u=O(e,p);u&&(s+=1),l===p?c+=80*g:m&&(c+=36*g),h&&(c+=24*g),w&&(c+=20*g),u&&(c+=10*g);}return o.length>0&&(c+=s/o.length*120),c}function se(e,t){return t.filter(o=>O(e,o)).length}var ae=new Map([["clojure","clojure"],["cplusplus","cpp"],["cpp","cpp"],["typescript","typescript"],["ts","typescript"],["javascript","javascript"],["js","javascript"],["nodejs","javascript"],["python","python"],["py","python"],["go","go"],["golang","go"],["csharp","csharp"],["dotnet","csharp"],["dart","dart"],["elixir","elixir"],["fsharp","fsharp"],["java","java"],["kotlin","kotlin"],["lua","lua"],["php","php"],["ruby","ruby"],["rust","rust"],["scala","scala"],["svelte","svelte"],["swift","swift"],["vue","vue"]]);function re(e){return new Set(e.map(t=>ae.get(t)).filter(t=>!!t))}function F(e){let t=e.attributes.language;return typeof t=="string"?b(t):null}function ie(e){return {project:1e3,service:900,api:900,package:850,endpoint:800,container:700,deployment:700,environment:650,pipeline:600,"test-suite":550,owner:500,decision:450,document:400}[e.kind]??0}function ce(e,t){let o=t.has("language")||t.has("languages"),a=t.has("binding")||t.has("bindings")||t.has("bridge")||t.has("bridges"),l=t.has("dependency")||t.has("dependencies")||t.has("depends"),r=t.has("core")||t.has("runtime"),d=t.has("owner")||t.has("owners")||t.has("ownership")||t.has("maintainer"),f=t.has("ci")||t.has("pipeline")||t.has("pipelines")||t.has("workflow"),c=t.has("deploy")||t.has("deployment")||t.has("infrastructure")||t.has("container"),s=t.has("doc")||t.has("docs")||t.has("document")||t.has("documentation"),p=t.has("service")||t.has("services")||t.has("api")||t.has("rpc"),g=t.has("schema")||t.has("schemas")||t.has("message")||t.has("protobuf")||t.has("proto")||t.has("contract"),m=typeof e.attributes.mechanism=="string"?b(e.attributes.mechanism):"",h=typeof e.attributes.specification=="string"?b(e.attributes.specification):"",w=b(e.label),u=0;if(o&&e.kind==="language"){let P=typeof e.attributes.fileCount=="number"?e.attributes.fileCount:0;u+=900+Math.min(P,1e4)/10;}return a&&e.kind==="protocol"&&(u+=800),l&&e.kind==="package"&&(u+=650),r&&e.kind==="package"&&/(?:^|[_-])core(?:$|[_-])/u.test(w)&&(u+=700),r&&e.kind==="protocol"&&m.includes("core")&&(u+=300),d&&e.kind==="owner"&&(u+=850),f&&e.kind==="pipeline"&&(u+=800),c&&["deployment","container","environment"].includes(e.kind)&&(u+=775),s&&["document","decision"].includes(e.kind)&&(u+=725),p&&["api","endpoint","service"].includes(e.kind)&&(u+=700),g&&(e.kind==="schema"||(e.kind==="api"||e.kind==="protocol")&&(h.includes("protobuf")||m.includes("protobuf")))&&(u+=750),u}function le(e){return [e.has("language")||e.has("languages"),e.has("binding")||e.has("bindings")||e.has("bridge")||e.has("bridges"),e.has("dependency")||e.has("dependencies")||e.has("depends"),e.has("core")||e.has("runtime"),e.has("owner")||e.has("ownership")||e.has("maintainer"),e.has("ci")||e.has("pipeline")||e.has("workflow"),e.has("deploy")||e.has("deployment")||e.has("infrastructure"),e.has("doc")||e.has("docs")||e.has("documentation"),e.has("service")||e.has("api")||e.has("rpc"),e.has("schema")||e.has("protobuf")||e.has("proto")||e.has("contract")].filter(Boolean).length>=3}function we(e,t){let o=b(t.query),a=[...new Set(j(t.query))],l=new Set(j(t.projectId??"")),r=t.projectId?a.filter(n=>!l.has(n)):a,d=!!(t.projectId&&a.length>0&&r.length===0),f=r.filter(n=>!te.has(n)),c=f.length>0?f:r,s=re(c),p=new Set(c),g=le(p),m=c.length<=1?c.length:Math.min(3,Math.ceil(c.length/3)),h=Math.max(1,Math.min(Math.trunc(t.limit??12),100)),w=Math.max(0,Math.min(Math.trunc(t.relationsPerEntity??4),20)),u=new Set;if(t.projectId){let n=new Set(e.entities.filter(i=>i.kind==="project"&&(i.projectId===t.projectId||i.label===t.projectId)).map(i=>i.id));for(let i of e.relations)n.has(i.from)&&u.add(i.to),n.has(i.to)&&u.add(i.from);}let P=e.entities.filter(n=>(!t.kind||n.kind===t.kind)&&(!t.projectId||n.projectId===t.projectId||n.projectId===void 0&&u.has(n.id))).map(ne),U=new Map(c.map(n=>{let i=P.filter(k=>O(k,n)).length;return [n,Math.log((P.length+1)/(i+1))+1]})),M=P.map(n=>{let i=se(n,c),k=F(n.entity),I=k&&s.has(k)?400:0,K=ce(n.entity,p);return {entity:n.entity,matchedTerms:i,intentScore:K,score:d?ie(n.entity):oe(n,o,c,U)+I+K}}).filter(n=>{let i=F(n.entity);return (s.size===0||i===null||s.has(i))&&(o.length===0||n.score>0&&(d||n.matchedTerms>=m||n.intentScore>0&&(g||c.length<=2)))}).sort((n,i)=>i.score-n.score||n.entity.kind.localeCompare(i.entity.kind)||n.entity.label.localeCompare(i.entity.label)),E=(g?(()=>{let n=[],i=[],k=new Map,I=new Set;for(let K of M){let q=k.get(K.entity.kind)??0,V=b(K.entity.label);q<2&&!I.has(V)?(n.push(K),k.set(K.entity.kind,q+1),I.add(V)):i.push(K);}return [...n,...i]})():M).slice(0,h).map(n=>n.entity),v=new Set(E.map(n=>n.id)),G=new Map,x=e.relations.filter(n=>{if(!(v.has(n.from)||v.has(n.to)))return false;let k=v.has(n.from)?n.from:n.to,I=G.get(k)??0;return I>=w?false:(G.set(k,I+1),true)}),W=t.projection==="agent",T=W?x.slice(0,y.relations):x,D=A(e),B=[...new Set(T.flatMap(n=>[n.from,n.to]).filter(n=>!v.has(n)))].map(n=>D.entitiesById.get(n)).filter(n=>!!n).map(({id:n,kind:i,label:k,projectId:I})=>({id:n,kind:i,label:k,...I?{projectId:I}:{}})).sort((n,i)=>n.kind.localeCompare(i.kind)||n.label.localeCompare(i.label)),H=W?B.slice(0,y.relatedEntities):B,L=new Set([...E.flatMap(n=>n.proofIds),...T.flatMap(n=>n.proofIds)]),Q=W?Z([...E,...T]):[...L],C=new Set(Q),R={entities:M.length-E.length,relations:x.length-T.length,relatedEntities:B.length-H.length,proofs:L.size-C.size,proofReferences:0,aliases:0,attributeValues:0},N=W?E.map(n=>J(n,C,R)):E,$=W?T.map(n=>{let i=n.proofIds.filter(k=>C.has(k)).slice(0,y.proofIdsPerItem);return R.proofReferences+=n.proofIds.length-i.length,{...n,proofIds:i}}):T,Y=[...C].map(n=>D.proofsById.get(n)).filter(n=>!!n).sort((n,i)=>n.id.localeCompare(i.id));return {schemaVersion:X,query:t.query,kind:t.kind??null,...t.projectId?{projectId:t.projectId}:{},limit:h,totalMatches:M.length,truncated:M.length>N.length||W&&Object.values(R).some(n=>n>0),entities:N,relatedEntities:H,relations:$,proofs:Y,...W?{budget:{mode:"agent",limits:{...y},omitted:R}}:{}}}export{X as a,_ as b,fe as c,ue as d,ke as e,we as f};
@@ -1 +0,0 @@
1
- import {h}from'./chunk-5EPPPMAS.js';var _=h.artifactRemediationPlan.schemaVersion;export{_ as a};
@@ -1,81 +0,0 @@
1
- import {c}from'./chunk-ZPA6ECBJ.js';import {c as c$1}from'./chunk-X7FYEKLI.js';import {d as d$1,b as b$1,a as a$1}from'./chunk-3RBUSW7H.js';import {d}from'./chunk-EWZZUQBR.js';import {a}from'./chunk-AFIFZTOY.js';import {h,e,i}from'./chunk-5EPPPMAS.js';import {t,h as h$1,g}from'./chunk-MOSXTVPU.js';import te from'crypto';import D from'fs';import j from'fs/promises';import p from'path';import {execa}from'execa';import ae from'fs-extra';var ce=h.projectContextAgent.schemaVersion,De=["managed","local","off"],ne="<!-- WORKSPAI:PROJECT-GROUNDING:START -->",re="<!-- WORKSPAI:PROJECT-GROUNDING:END -->";function z(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}async function b(e){try{return JSON.parse(await j.readFile(e,"utf8"))}catch(n){return null}}function R(e){return e.replace(/\\/g,"/").replace(/^\.\/+/,"")}function x(e,n,r){let o=e.replace(/\\/g,"/"),i=/^[A-Za-z]:\//.test(o);if(!p.isAbsolute(e)&&!i)return R(o);if(i&&process.platform!=="win32")return null;let c=p.resolve(e),a=p.relative(r,c);if(a&&!a.startsWith("..")&&!p.isAbsolute(a))return R(a);let l=p.relative(n,c);return l&&!l.startsWith("..")&&!p.isAbsolute(l)?`workspace:${R(l)}`:null}function y(e,n,r){return [[r,"project:"],[r.replace(/\\/g,"/"),"project:"],[n,"workspace:"],[n.replace(/\\/g,"/"),"workspace:"]].reduce((i,[c,a])=>c.length>0?i.split(c).join(a):i,e)}function oe(e,n){return z(e?.adoption)?.mode==="linked"?"adopted":z(e?.import)?"imported":n}function le(e){if(!e.model)return null;let n=R(e.relativePath);return e.model.projects.find(r=>r.name===e.projectName||R(r.path)===n)??null}function X(e,n){e[n]=(e[n]??0)+1;}var pe=["project","language","service","api","endpoint","schema","protocol","runtime-unit","lifecycle-stage","database","queue","container","deployment","pipeline","environment","test-suite","owner","decision","document","package","file","module","symbol"];function de(e,n=160){let r={language:32,api:32,service:32,endpoint:32,schema:32,protocol:32,"runtime-unit":32,"lifecycle-stage":32,file:8,module:8,symbol:8},o=[];for(let i of pe){let c=e.filter(a=>a.kind===i).sort((a,l)=>a.label.localeCompare(l.label)||a.id.localeCompare(l.id)).slice(0,r[i]??32);for(let a of c){if(o.length>=n)return o;o.push(a);}}return o}function ge(e,n){if(!e)return {entityCount:0,relationCount:0,proofCount:0,entitiesByKind:{},relationsByKind:{},languages:{},semantic:{protocolConceptCount:0,protocolImplementationBindings:0,equivalenceBindings:0,generationBindings:0,runtimeUnitCount:0,lifecycleStageCount:0,runtimeCoverage:[]},relatedProjects:[],proofArtifacts:[],entities:[],relations:[],proofs:[],topology:{status:"unavailable",dependencies:[],dependents:[]},diagnostics:[]};let r=e.entities.find(t=>t.kind==="project"&&(t.id===n||t.label===n||t.projectId===n)),o=new Set(e.entities.filter(t=>t.projectId===n||t.id===r?.id||t.kind==="project"&&t.label===n).map(t=>t.id));r&&o.add(r.id);let i=e.relations.filter(t=>o.has(t.from)||o.has(t.to)),c=new Set(o);for(let t of i)c.add(t.from),c.add(t.to);let a=e.entities.filter(t=>c.has(t.id)),l=new Set,d={},u={},m={},k=new Set(a.filter(t=>t.kind==="language").map(t=>t.attributes.language).filter(t=>typeof t=="string"));for(let t of a){X(d,t.kind);let s=typeof t.attributes.language=="string"?t.attributes.language:void 0;if(s&&t.kind==="language")m[s]={fileCount:typeof t.attributes.fileCount=="number"?t.attributes.fileCount:0,symbolCount:m[s]?.symbolCount??0,generatedFileCount:typeof t.attributes.generatedFileCount=="number"?t.attributes.generatedFileCount:0};else if(s&&(t.kind==="file"||t.kind==="symbol")){let h=m[s]??{fileCount:0,symbolCount:0,generatedFileCount:0};t.kind==="file"&&!k.has(s)?(h.fileCount+=1,t.attributes.generated===true&&(h.generatedFileCount+=1)):t.kind==="symbol"&&(h.symbolCount+=1),m[s]=h;}for(let h of t.proofIds)l.add(h);}for(let t of i){X(u,t.kind);for(let s of t.proofIds)l.add(s);}let w=e.proofs.filter(t=>l.has(t.id)),P=[...new Set(e.entities.filter(t=>c.has(t.id)&&t.projectId&&t.projectId!==n).map(t=>t.projectId))].sort(),f=e.diagnostics.filter(t=>t.entityIds?.some(s=>c.has(s))||t.relationIds?.some(s=>i.some(h=>h.id===s))).map(t=>({code:t.code,severity:t.severity,message:t.message,...t.recommendation?{recommendation:t.recommendation}:{}})),g=(t,s)=>({project:s,kind:t.kind,source:t.source,confidence:t.confidence,evidence:[...new Set(t.evidence.map(h=>h.file.replace(/\\/g,"/")))].sort()}),C=e.projectTopology.edges.filter(t=>t.from===n).map(t=>g(t,t.to)).sort((t,s)=>`${t.project}:${t.kind}`.localeCompare(`${s.project}:${s.kind}`)),S=e.projectTopology.edges.filter(t=>t.to===n).map(t=>g(t,t.from)).sort((t,s)=>`${t.project}:${t.kind}`.localeCompare(`${s.project}:${s.kind}`)),T=de(a),$=a.filter(t=>t.kind==="runtime-unit"),A=new Set(T.map(t=>t.id)),L=[...i].sort((t,s)=>{let h=Number(A.has(t.from)||A.has(t.to));return Number(A.has(s.from)||A.has(s.to))-h||t.id.localeCompare(s.id)}).slice(0,128),I=new Set([...T.flatMap(t=>t.proofIds),...L.flatMap(t=>t.proofIds)]);return {entityCount:a.length,relationCount:i.length,proofCount:w.length,entitiesByKind:d,relationsByKind:u,languages:Object.fromEntries(Object.entries(m).sort(([t],[s])=>t.localeCompare(s))),semantic:{protocolConceptCount:d.protocol??0,protocolImplementationBindings:u["implements-protocol"]??0,equivalenceBindings:u["equivalent-to"]??0,generationBindings:(u["generated-from"]??0)+(u["generated-by"]??0),runtimeUnitCount:$.length,lifecycleStageCount:d["lifecycle-stage"]??0,runtimeCoverage:[...new Set($.map(t=>t.attributes.runtime).filter(t=>typeof t=="string"))].sort()},relatedProjects:P,proofArtifacts:[...new Set(w.map(t=>t.artifact))].sort(),entities:T,relations:L,proofs:w.filter(t=>I.has(t.id)).sort((t,s)=>t.id.localeCompare(s.id)).slice(0,128),topology:{status:C.length>0||S.length>0?"proven":e.projectTopology.nodes.some(t=>t.id===n)?"unproven":"unavailable",dependencies:C,dependents:S},diagnostics:f}}function se(e,n,r){return Array.isArray(e)?e.map(o=>typeof o=="string"?y(o,n,r):o):typeof e=="string"?y(e,n,r):e}function ue(e,n,r){return {id:e.id,kind:e.kind,label:y(e.label,n,r),attributes:Object.fromEntries(Object.entries(e.attributes).map(([o,i])=>[o,se(i,n,r)])),proofIds:[...e.proofIds].sort()}}function me(e,n,r){let o=(...c)=>e.filter(a=>c.includes(a.kind)).map(a=>ue(a,n,r)).slice(0,32),i=[];for(let c of e){for(let[a,l]of Object.entries(c.attributes))if(/(?:^|[-_.])ports?(?:$|[-_.])/i.test(a)&&(i.push({entityId:c.id,label:y(c.label,n,r),attribute:a,value:se(l,n,r)}),i.length>=32))break;if(i.length>=32)break}return {services:o("service"),packages:o("package"),protocols:o("protocol"),runtimeUnits:o("runtime-unit"),lifecycleStages:o("lifecycle-stage"),apis:o("api"),endpoints:o("endpoint"),dataStores:o("database","queue"),deployments:o("container","deployment","environment"),pipelines:o("pipeline"),tests:o("test-suite"),owners:o("owner"),decisions:o("decision"),ports:i}}function fe(e,n,r){let o=x(e.artifact,n,r);return o?{id:e.id,provider:e.provider,artifact:o,...e.pointer?{pointer:y(e.pointer,n,r)}:{},...e.line!==void 0?{line:e.line}:{},derivation:e.derivation,trust:e.trust,confidence:e.confidence,freshness:e.freshness}:null}async function he(e,n,r){let o=[],i=await b(p.join(e,".workspai","reports","INDEX.json"));if(Array.isArray(i?.blockers))for(let a of i.blockers)typeof a=="string"&&(a.startsWith(`${r}:`)||a.includes(`project:${r}`)||a.includes(`project ${r}`))&&o.push({source:"workspace-report-index",severity:"error",message:y(a,e,n)});let c=await b(p.join(e,".workspai","reports","doctor-project-last-run.json"));if(c?.projectName===r)for(let a of c$1({project:c.project}))o.push({source:"doctor-project",severity:a.status==="blocking"?"error":"warning",message:y(a.message,e,n),...a.id?{code:a.id}:{}});return [...new Map(o.map(a=>[`${a.source}:${a.code??""}:${a.message}`,a])).values()].slice(0,32)}function M(e,n=[]){return typeof e=="string"?/^[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(e)||n.some(r=>r.length>0&&(e.includes(r)||e.includes(r.replace(/\\/g,"/")))):Array.isArray(e)?e.some(r=>M(r,n)):e&&typeof e=="object"?Object.values(e).some(r=>M(r,n)):false}function ke(e){return te.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function je(e$1){let n=p.resolve(e$1.workspacePath),r=p.resolve(e$1.projectPath),o=t(r,"project.json").find(s=>D.existsSync(s)),i$1=o?await b(o):null,c=await b(p.join(n,".workspai","workspace.contract.json")),a$1=p.resolve(r),l=c?.projects?.find(s=>s.externalPath?p.resolve(s.externalPath)===a$1:!s.relativePath||s.relativePath.startsWith("external/")?false:p.resolve(n,s.relativePath)===a$1)??c?.projects?.find(s=>s.slug===e$1.projectName||s.slug===p.basename(r)),d$1=e$1.projectName??(typeof i$1?.name=="string"?i$1.name:void 0)??l?.slug??p.basename(r),u=l?.relativePath??(()=>{let s=R(p.relative(n,r));return !s||s.startsWith("..")?`external/${d$1}`:s})(),m=await b(p.join(n,e.model)),k=await b(p.join(n,e.knowledgeGraph)),w=m?d(m):void 0,P=!!(w&&k?.source.hash===w),f=le({model:m,projectName:d$1,relativePath:u}),g=ge(P?k:null,d$1),C=await he(n,r,d$1),S=g.proofs.map(s=>s.freshness),T=k?!P||S.includes("stale")?"stale":S.includes("unknown")?"unknown":"fresh":"missing",$=m?m.factFreshness?.status??"unknown":"missing",A=[...m?[]:[{code:"project.context.model-missing",severity:"warning",message:"The canonical Workspace Model has not been generated yet. Refresh workspace intelligence before relying on project topology."}],...m&&!f?[{code:"project.context.project-not-materialized",severity:"warning",message:"The project is registered in the workspace contract but is not present in the current Workspace Model."}]:[],...k?[]:[{code:"project.context.graph-missing",severity:"warning",message:"The Workspace Knowledge Graph has not been generated yet. Run the workspace intelligence loop to build proof-backed relationships."}],...k&&!P?[{code:"project.context.graph-model-mismatch",severity:"warning",message:"The persisted Knowledge Graph does not match the current Workspace Model and was excluded from this project lens."}]:[]],L=oe(i$1,e$1.relationship??l?.relationship??"managed"),I={schemaVersion:ce,generatedAt:(e$1.now??new Date).toISOString(),workspace:{name:c?.workspace?.name??m?.workspace.name??p.basename(n),...c?.workspace?.profile||m?.workspace.profile?{profile:c?.workspace?.profile??m?.workspace.profile}:{},relationship:L,contract:i.workspaceContract,model:e.model,knowledgeGraph:e.knowledgeGraph,access:{localBinding:i.projectWorkspaceLink,canonicalEvidenceAvailableAtGeneration:true}},project:{name:d$1,relativePath:u,...f?.kind?{kind:f.kind}:{},...f?.runtime||l?.runtime?{runtime:f?.runtime??l?.runtime}:{},...f?.runtimeCandidates?.length?{runtimeCandidates:[...f.runtimeCandidates].sort()}:{},...f?.framework||l?.framework?{framework:f?.framework??l?.framework}:{},...f?.kit||l?.kit?{kit:f?.kit??l?.kit}:{},...f?.supportTier?{supportTier:f.supportTier}:{},commands:{supported:[...f?.commands.supported??[]].sort(),unsupported:[...f?.commands.unsupported??[]].sort(),fleetStages:[...f?.commands.fleetStages??[]].sort()},importantFiles:[...new Set((f?.importantFiles??[]).map(s=>x(s,n,r)).filter(s=>s!==null))].sort()},intelligence:{...m?.generatedAt?{modelGeneratedAt:m.generatedAt}:{},...k?.generatedAt?{graphGeneratedAt:k.generatedAt}:{},...k?.source.hash?{graphModelHash:k.source.hash}:{},entityCount:g.entityCount,relationCount:g.relationCount,proofCount:g.proofCount,entitiesByKind:g.entitiesByKind,relationsByKind:g.relationsByKind,languages:g.languages,semantic:g.semantic,relatedProjects:g.relatedProjects,freshness:{model:$,graph:T,graphMatchesModel:P},topology:{...g.topology,dependencies:g.topology.dependencies.map(s=>({...s,evidence:s.evidence.map(h=>x(h,n,r)).filter(h=>h!==null)})),dependents:g.topology.dependents.map(s=>({...s,evidence:s.evidence.map(h=>x(h,n,r)).filter(h=>h!==null)}))},surfaces:me(g.entities,n,r),diagnostics:[...A,...g.diagnostics].map(s=>({...s,message:y(s.message,n,r),...s.recommendation?{recommendation:y(s.recommendation,n,r)}:{}}))},evidence:{readOrder:[".workspai/PROJECT-GROUNDING.md",i.projectContextAgent,"AGENTS.md","workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json",`workspace:${e.model}`,`workspace:${e.knowledgeGraph}`],projectProofArtifacts:[...new Set(g.proofArtifacts.map(s=>x(s,n,r)).filter(s=>s!==null))],relations:g.relations.map(s=>({id:s.id,from:s.from,to:s.to,kind:s.kind,derivation:s.derivation,trust:s.trust,confidence:s.confidence,proofIds:[...s.proofIds].sort()})),proofs:g.proofs.map(s=>fe(s,n,r)).filter(s=>s!==null)},blockers:C,agentRouting:{enforcement:"required",mandatoryPreflight:{command:"npx workspai project workspace status --json",successCondition:"resolved"},workspaceEvidenceRequiredFor:["repository-analysis","architecture-analysis","change-impact","cross-project-change","contract-change","infrastructure-change","release-readiness"],requiredReadOrder:[i.projectContextAgent,"command:npx workspai project workspace status --json","workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json",`command:npx workspai workspace graph search ${JSON.stringify(d$1)} --scope ${JSON.stringify(`project:${d$1}`)} --limit 12 --json`],degradedMode:{allowCompleteArchitectureClaims:false,requireDisclosure:true}},commands:{refresh:"npx workspai workspace intelligence run --for-agent generic --strict --json",verify:"npx workspai workspace verify --strict --json",graphSearch:`npx workspai workspace graph search ${JSON.stringify(d$1)} --scope ${JSON.stringify(`project:${d$1}`)} --limit 12 --json`,doctor:"npx workspai doctor project --json",workspaceStatus:"npx workspai project workspace status --json"}};if(M(I,[n,r]))throw new Error("Project context lens rejected a non-portable absolute path.");let t$1={...I,integrity:{algorithm:"sha256",...w?{modelHash:w}:{},payloadHash:ke(I),portable:true,absolutePathsEmitted:false}};return a(t$1,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent"),t$1}function we(e){let n=e.intelligence.relatedProjects.length>0?e.intelligence.relatedProjects.map(i=>`\`${i}\``).join(", "):"No proven cross-project relation is currently available.",r=e.intelligence.diagnostics.length>0?e.intelligence.diagnostics.slice(0,8).map(i=>`- **${i.severity} \xB7 ${i.code}:** ${i.message}`).join(`
2
- `):"- No project-scoped graph diagnostic is currently recorded.",o=e.blockers.length>0?e.blockers.slice(0,12).map(i=>`- **${i.severity}${i.code?` \xB7 ${i.code}`:""}:** ${i.message}`).join(`
3
- `):"- No current project-scoped blocker is recorded.";return `# Workspai project grounding
4
-
5
- This project is part of the **${e.workspace.name}** Workspai workspace.
6
- Commands launched from this project resolve that workspace automatically; you do not need to change directories first.
7
-
8
- ## Start here
9
-
10
- This is a mandatory agent preflight, not optional background material:
11
-
12
- 1. Read \`.workspai/reports/project-context-agent.json\` before broad source discovery.
13
- 2. Run \`${e.commands.workspaceStatus}\` and require a resolved workspace.
14
- 3. For repository analysis, architecture analysis, change impact, contracts, infrastructure, or release readiness, read the canonical workspace \`.workspai/reports/INDEX.json\` and \`workspace-context-agent.json\` even when the request names only this repository.
15
- 4. Run the bounded agent graph search below before broad source scanning, then use targeted graph evidence/path queries as needed.
16
- 5. Use source inspection to verify and deepen the workspace evidence, not to silently replace it.
17
- 6. Do not claim complete architecture, independence, health, readiness, or verification without current Workspai evidence.
18
-
19
- If workspace resolution, required reports, or graph retrieval is unavailable, explicitly report degraded mode and the missing evidence. In degraded mode an agent may inspect source, but must not claim a complete architectural understanding.
20
-
21
- The Workspace Model owns canonical project identity and its compact \`projectTopology\`.
22
- The Workspace Knowledge Graph is a separate, proof-backed enrichment containing
23
- files, symbols, APIs, infrastructure, tests, owners, and decisions. Do not treat
24
- an unproven topology edge as proof that two projects are independent.
25
-
26
- ## Project
27
-
28
- - Name: \`${e.project.name}\`
29
- - Workspace-relative identity: \`${e.project.relativePath}\`
30
- - Runtime: \`${e.project.runtime??"unknown"}\`
31
- - Framework: \`${e.project.framework??"unknown"}\`
32
- - Relationship: \`${e.workspace.relationship}\`
33
- - Related projects: ${n}
34
- - Topology status: \`${e.intelligence.topology.status}\`
35
- - Model freshness: \`${e.intelligence.freshness.model}\`
36
- - Knowledge Graph freshness: \`${e.intelligence.freshness.graph}\`
37
-
38
- ## Current evidence coverage
39
-
40
- - Project-scoped entities: ${e.intelligence.entityCount}
41
- - Project-scoped relations: ${e.intelligence.relationCount}
42
- - Portable proofs: ${e.intelligence.proofCount}
43
-
44
- ${r}
45
-
46
- ## Current project blockers
47
-
48
- ${o}
49
-
50
- ## Safe commands from this project
51
-
52
- \`\`\`bash
53
- ${e.commands.workspaceStatus}
54
- ${e.commands.doctor}
55
- ${e.commands.graphSearch}
56
- ${e.commands.verify}
57
- \`\`\`
58
-
59
- The machine-local workspace path lives only in \`.workspai/workspace-link.local.json\`, which is gitignored. Portable grounding files never publish that path.
60
- `}function ye(e){return `# Workspai project boundary
61
-
62
- - Project: \`${e.project.name}\`
63
- - Canonical workspace: \`${e.workspace.name}\`
64
- - Portable project lens: \`.workspai/reports/project-context-agent.json\`
65
- - Project grounding: \`.workspai/PROJECT-GROUNDING.md\`
66
- - Workspace discovery: run \`npx workspai project workspace status --json\`
67
-
68
- Before broad source discovery, every agent must read the project lens and run \`${e.commands.workspaceStatus}\`; continue as fully grounded only when workspace resolution succeeds. Repository analysis, architecture analysis, change impact, contracts, APIs, infrastructure, and release readiness always require canonical workspace evidence and the bounded agent graph search, even when the request names only this repository. Source inspection verifies and deepens that evidence; it does not replace it silently. If required evidence is unavailable or stale, disclose degraded mode and do not claim complete architecture, independence, health, readiness, or verification. The user does not need to preload the graph. \`projectTopology\` is the compact project dependency view in the canonical Workspace Model, while the Workspace Knowledge Graph is the proof-backed detail layer. Workspai commands launched here resolve the canonical workspace automatically. Never copy the machine-local workspace link into answers, commits, or generated portable artifacts.`}function Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(e,n){return new RegExp(`${Z(e)}[\\s\\S]*?${Z(n)}`,"m")}function ie(e){let n=e.replace(Y(ne,re),"");return d$1(n)?.includes("# Workspai project boundary")&&(n=n.replace(Y(a$1,b$1),"")),n.replace(/\n{3,}/g,`
69
-
70
- `).trim()}function Pe(e,n){let r=ie(e),o=`${ne}
71
- ${n.trim()}
72
- ${re}`;return r?`${r}
73
-
74
- ${o}
75
- `:`${o}
76
- `}async function O(e,n){await j.mkdir(p.dirname(e),{recursive:true});let r=`${e}.${process.pid}.${te.randomUUID()}.tmp`;try{await j.writeFile(r,n,"utf8");try{await j.rename(r,e);}catch(o){let i=o.code;if(i!=="EEXIST"&&i!=="EPERM")throw o;await ae.move(r,e,{overwrite:true});}}finally{await j.rm(r,{force:true}).catch(()=>{});}}async function be(e,n){let r;try{r=await execa("git",["rev-parse","--show-toplevel"],{cwd:e,reject:false});}catch{return false}if(r?.exitCode!==0)return false;let o=r.stdout.trim();if(!o)return false;let i,c;try{[i,c]=await Promise.all([j.realpath(p.resolve(o)),j.realpath(e)]);}catch{return false}let a=p.resolve(c,n),l=p.relative(i,a).replace(/\\/g,"/");if(!l||p.isAbsolute(l)||l===".."||l.startsWith("../"))return false;let d;try{d=await execa("git",["cat-file","-e",`HEAD:${l}`],{cwd:i,reject:false});}catch{return false}if(d?.exitCode!==0)return false;let u;try{u=await execa("git",["ls-files","--deleted","--error-unmatch","--",`:(top)${l}`],{cwd:i,reject:false});}catch{return false}return u?.exitCode===0}async function Q(e,n){let r=p.join(e,".gitignore"),o=await j.readFile(r,"utf8").catch(l=>{if(l.code==="ENOENT")return "";throw l}),i=[g,h$1],c=o.split(/\r?\n/).filter(l=>l.trim()!=="# Workspai local project grounding"&&!i.includes(l.trim()));for(;c.length>0&&c[c.length-1]==="";)c.pop();n==="local"&&(c.length>0&&c.push(""),c.push("# Workspai local project grounding",...i));let a=c.length>0?`${c.join(`
77
- `)}
78
- `:"";a!==o&&await O(r,a);}async function ee(e,n,r){let o=p.join(e,"AGENTS.md"),i=await j.lstat(o).catch(u=>{if(u.code==="ENOENT")return null;throw u});if(i?.isSymbolicLink())return;let c=i?.isFile()===true,a=await j.readFile(o,"utf8").catch(u=>{if(u.code==="ENOENT")return "";throw u});if(n==="managed"&&!r)throw new Error("Managed project grounding requires a project context.");if(n==="managed"&&!c&&await be(e,"AGENTS.md"))return;let l=n==="managed"&&r?Pe(a,ye(r)):ie(a);if(!l){c&&await j.rm(o,{force:true});return}let d=`${l.trimEnd()}
79
- `;return d!==a&&await O(o,d),n==="managed"?o:void 0}async function ve(e){let n=e.mode??"managed",r=p.resolve(e.workspacePath),o=p.resolve(e.projectPath);if(n==="off"){let k=t(o,"project.json").find(C=>D.existsSync(C)),w=k?await b(k):null,P=e.projectName??(typeof w?.name=="string"?w.name:void 0)??p.basename(o),f=oe(w,e.relationship??"managed"),g$1=await c({workspacePath:r,projectPath:o,projectName:P,relationship:f,now:e.now});return await Q(o,n),await ee(o,n),await Promise.all([j.rm(p.join(o,h$1),{force:true}),j.rm(p.join(o,g),{force:true})]),{mode:n,projectPath:o,linkPath:g$1.linkPath,writtenFiles:[i.projectWorkspaceLink]}}let i$1=await je(e),c$1=i$1.workspace.relationship,a=await c({workspacePath:r,projectPath:o,projectName:i$1.project.name,relationship:c$1,workspaceName:i$1.workspace.name,relativePath:i$1.project.relativePath,now:e.now});await Q(o,n);let l=await ee(o,n,i$1),d=p.join(o,h$1),u=p.join(o,g);await O(d,`${JSON.stringify(i$1,null,2)}
80
- `),await O(u,`${we(i$1).trimEnd()}
81
- `);let m=[i.projectWorkspaceLink,h$1,g];return l&&m.push("AGENTS.md"),{mode:n,projectPath:o,linkPath:a.linkPath,groundingPath:u,contextPath:d,agentsPath:l,writtenFiles:m}}async function Fe(e){let n=p.resolve(e.workspacePath),r=e.mode??"managed",o=await Ee(n),i=[],c=[];for(let a of o.resolved)try{i.push(await ve({workspacePath:n,projectPath:a.projectPath,projectName:a.name,relationship:a.relationship,mode:r,now:e.now}));}catch(l){c.push({name:a.name,reason:l instanceof Error?l.message:String(l)});}return {workspacePath:n,mode:r,projects:i,skipped:[...o.skipped,...c]}}async function Ee(e){let n=p.resolve(e),r=await b(p.join(n,".workspai","workspace.contract.json")),o=[],i=[];for(let c of r?.projects??[]){let a=c.slug??c.relativePath??"unknown-project",l=typeof c.externalPath=="string"?p.resolve(c.externalPath):typeof c.relativePath=="string"&&!c.relativePath.startsWith("external/")?p.resolve(n,c.relativePath):null;if(!l||!D.existsSync(l)){i.push({name:a,reason:"project path is unavailable on this machine"});continue}o.push({name:a,projectPath:l,relationship:c.relationship??"managed"});}return {resolved:o,skipped:i}}export{ce as a,De as b,ne as c,re as d,je as e,ve as f,Fe as g,Ee as h};
@@ -1 +0,0 @@
1
- var r="workspai-cli-operation-result-v1";function i(e,s,t){return {schemaVersion:r,operation:e,status:"success",exitCode:0,artifact:s,...t?{outputPath:t}:{}}}function a(e){return {schemaVersion:r,operation:e.operation,status:"error",exitCode:e.exitCode??1,error:{code:e.code,message:e.message},...e.context?{context:e.context}:{},...e.examples?{examples:e.examples}:{},...e.nextActions?{nextActions:e.nextActions}:{}}}export{r as a,i as b,a as c};
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-FPJNWPKU.js';import {f,e as e$1,g as g$1,i}from'./chunk-5EPPPMAS.js';var v="workspai.studio-card-repair-capabilities.v1",k="npx workspai workspace verify --json",r=e$1,a=i;function e(f,n,c,o={}){return {cardId:f,scope:o.scope??"workspace",producerCommand:n,producerArtifact:c,verifyCommand:n,verifyArtifact:c,aggregateVerifyCommand:k,targetClosure:"exact-producer-and-causal-action-set",workspacePosture:"reported-separately",repairPolicy:o.repairPolicy??"refresh-producer",remediationArtifacts:o.remediationArtifacts??[]}}var b=[e("doctor","npx workspai doctor workspace --json",r.doctor,{repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.doctorRemediationPlan,a.artifactRemediationPlan]}),e("projectDoctor","npx workspai doctor project --json",a.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.doctorRemediationPlan,a.artifactRemediationPlan]}),e("pipeline","npx workspai pipeline --json --strict",a.pipelineLastRun,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("analyze","npx workspai analyze --json",r.analyze,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("readiness","npx workspai readiness --json",r.readiness,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("bootstrap","npx workspai bootstrap --ci --json",a.bootstrapCompliance,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("workspaceSync","npx workspai workspace sync --json",a.workspaceRegistry),e("foundation","npx workspai workspace foundation ensure --json",".workspai/workspace.json"),e("contract","npx workspai workspace contract verify --strict --json",r.contractVerify,{repairPolicy:"source-repair-then-produce"}),e("autopilot","npx workspai autopilot release --json",a.autopilotReleaseLastRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceRun","npx workspai workspace run test --json",a.workspaceRunLast,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("setup","npx workspai setup --json",".workspai/toolchain.lock",{repairPolicy:"source-repair-then-produce"}),e("importReadiness","npx workspai doctor project --json",a.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.artifactRemediationPlan]}),e("snapshot","npx workspai snapshot create --json",".workspai/reports/snapshot-last-run.json"),e("workspaceModel","npx workspai workspace model --json --write",r.model),e("intelligenceSnapshot","npx workspai workspace snapshot --json",r.snapshot),e("workspaceDiff",`npx workspai workspace diff --from ${r.snapshot} --json`,r.diff),e("workspaceImpact",`npx workspai workspace impact --from ${r.diff} --json`,r.impact),e("workspaceIntelligenceRun","npx workspai workspace intelligence run --for-agent generic --strict --json",r.intelligenceRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceVerify",k,r.verify,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("workspaceExplain","npx workspai workspace explain release-blocked --json --write",r.explain),e("workspaceWhy","npx workspai workspace why release-blocked --json --write",a.workspaceWhy),e("workspaceTrace",`npx workspai workspace trace --from ${r.diff} --json --write`,a.workspaceTrace),e("workspaceWatch","npx workspai workspace watch --once --json",r.model),e("workspaceContextAgent","npx workspai workspace context --for-agent --json --write",r.agentContext),e("agentGrounding","npx workspai workspace agent-sync --write --refresh-context --json --preset enterprise --target vscode",r.agentCustomizationPack),e("share",`npx workspai workspace share --output ${a.workspaceShareBundle} --json`,a.workspaceShareBundle),e("archive","npx workspai workspace export --output team-workspace.workspai-archive.zip --json",".workspai/archive-manifest.json"),e("mirror","npx workspai mirror status --json",a.mirrorOps),e("cache","npx workspai cache status --json",".workspai/cache-config.yml"),e("policy","npx workspai workspace policy show --json",".workspai/policies.yml",{repairPolicy:"source-repair-then-produce"}),e("infra","npx workspai infra plan --json",a.infraPlan,{repairPolicy:"source-repair-then-produce"})];var g=f.repairTransaction,h=e$1.repairTransaction,E=g$1.repairTransaction;var m="workspai.workspace-repair-proposal.v1",I="contracts/workspace-intelligence/workspace-repair-proposal.v1.json";var R="workspai.workspace-repair-capabilities.v1",y="workspai.workspace-repair-consumer-protocol.v1",w=[{id:"node",ecosystem:"JavaScript / TypeScript",manifests:["package.json"],lockfiles:["package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],packageManagers:["npm","pnpm","yarn","bun"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["selected package manager"]},{id:"python",ecosystem:"Python",manifests:["pyproject.toml","requirements.txt"],lockfiles:["uv.lock","poetry.lock","requirements.txt"],packageManagers:["uv","poetry","pip"],support:"conditional",stages:{reconcile:"conditional",audit:"conditional",test:"conditional",build:"declared"},requiredToolFamilies:["isolated Python","selected environment manager","pip-audit or governed Doctor audit"],limitation:"A bounded isolated environment and an installed audit surface are required."},{id:"go",ecosystem:"Go",manifests:["go.mod"],lockfiles:["go.sum"],packageManagers:["go modules"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["go","govulncheck"],limitation:"govulncheck must be installed; the engine never fetches an unreviewed tool."},{id:"rust",ecosystem:"Rust",manifests:["Cargo.toml"],lockfiles:["Cargo.lock"],packageManagers:["cargo"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["cargo","cargo-audit"],limitation:"The cargo-audit subcommand must already be installed."},{id:"php-composer",ecosystem:"PHP",manifests:["composer.json"],lockfiles:["composer.lock"],packageManagers:["composer"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["composer"]},{id:"ruby-bundler",ecosystem:"Ruby",manifests:["Gemfile"],lockfiles:["Gemfile.lock"],packageManagers:["bundler"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"declared",build:"declared"},requiredToolFamilies:["bundle","bundle-audit"],limitation:"bundle-audit and the declared Rake tasks must already exist."},{id:"elixir-mix",ecosystem:"Elixir",manifests:["mix.exs"],lockfiles:["mix.lock"],packageManagers:["mix"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mix","Hex audit task"],limitation:"The project must expose the Hex audit task used by its dependency policy."},{id:"deno",ecosystem:"Deno",manifests:["deno.json","deno.jsonc"],lockfiles:["deno.lock"],packageManagers:["deno"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["deno"]},{id:"dotnet",ecosystem:".NET",manifests:["*.sln","*.csproj","*.fsproj","*.vbproj"],lockfiles:["Directory.Packages.props","packages.lock.json"],packageManagers:["NuGet / dotnet"],support:"full",stages:{reconcile:"native",audit:"native",test:"native",build:"native"},requiredToolFamilies:["dotnet"]},{id:"jvm-maven",ecosystem:"JVM / Maven",manifests:["pom.xml"],lockfiles:[],packageManagers:["Maven Wrapper","Maven"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mvnw or mvn","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"jvm-gradle",ecosystem:"JVM / Gradle",manifests:["build.gradle.kts","build.gradle"],lockfiles:["gradle.lockfile","gradle/libs.versions.toml"],packageManagers:["Gradle Wrapper","Gradle"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["gradlew or gradle","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"clojure",ecosystem:"Clojure",manifests:["deps.edn","project.clj"],lockfiles:[],packageManagers:["Clojure CLI","Leiningen"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"conditional",build:"conditional"},requiredToolFamilies:["clojure or lein","governed project audit"],limitation:"Tests and builds run only when the selected Clojure project surface declares a deterministic entrypoint."},{id:"scala-sbt",ecosystem:"Scala / sbt",manifests:["build.sbt"],lockfiles:[],packageManagers:["sbt"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["sbt","governed project audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."}];function M(){return {schemaVersion:R,owner:"Workspai CLI",workflow:["plan","preconditions","approval","target-precondition","checkpoint","execute","reconcile","audit","test","build","target-producer-verify","canonical-verify","close-or-rollback-or-decision"],invariants:{multiAdapterProjects:true,missingTools:"decision-required",unsupportedEcosystems:"decision-required",silentFallbackToModelExecution:false,mutationAuthority:"cli-only",targetClosure:"selected-causal-action-set",changeReceipt:"checkpoint-hash-delta",consumerTimeline:"durable-transaction-events",typedDecisionCauses:true,consumerHandshakeRequired:true,ephemeralProposalsAreEvidence:false,approvalBoundToPlanHash:true,canonicalVerificationRequired:true,rollbackConflictDetection:true},consumerProtocol:{protocolVersion:y,versionProbe:{args:["--version","--json"],schemaVersion:"rapidkit-version-v1"},capabilityProbe:{args:["workspace","repair","capabilities","--json"],schemaVersion:R},invocation:{command:"workspace repair",workspaceResolution:["process-cwd","--workspace"],actions:["capabilities","plan","propose","approve","decide","execute","resume","status","list","rollback","cancel"]},contracts:{operationResult:a$1,proposal:m,transaction:g},transientPaths:[".workspai/repair/inbox/*.json",".workspai/repair/engine.lock"]},adapters:w}}export{v as a,b,g as c,h as d,E as e,m as f,I as g,R as h,w as i,M as j};