workspai 0.65.0 → 0.67.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 (211) hide show
  1. package/README.md +28 -23
  2. package/contracts/agent-customization-pack.v1.json +4 -2
  3. package/contracts/analyze-last-run.v1.json +9 -1
  4. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +117 -0
  5. package/contracts/extension-cli-compatibility.v1.json +6 -0
  6. package/contracts/published-contract-catalog.v1.json +30 -0
  7. package/contracts/runtime-command-surface.v1.json +100 -2
  8. package/contracts/workspace-activity-board.v1.json +114 -0
  9. package/contracts/workspace-activity-event.v1.json +132 -0
  10. package/contracts/workspace-activity-monitor-fleet.v1.json +18 -0
  11. package/contracts/workspace-activity-monitor-snapshot.v1.json +161 -0
  12. package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
  13. package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
  14. package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
  15. package/contracts/workspace-intelligence/project-context-agent.v1.json +49 -7
  16. package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
  17. package/contracts/workspace-intelligence/workspace-intelligence-benchmark.v1.json +196 -0
  18. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +97 -2
  19. package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
  20. package/contracts/workspace-intelligence-architecture.v1.json +17 -0
  21. package/contracts/workspace-intelligence-chain.v1.json +17 -0
  22. package/dist/analyze-IC2KRVCG.js +1 -0
  23. package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-GFFHC2ZU.js} +1 -1
  24. package/dist/autopilot-release-RECEZAZI.js +1 -0
  25. package/dist/capabilities-command-X4WZIJNR.js +1 -0
  26. package/dist/chunk-2LIVMG5C.js +2 -0
  27. package/dist/chunk-2M62CU3O.js +2 -0
  28. package/dist/chunk-2MTJWPQ4.js +1 -0
  29. package/dist/chunk-2MVIRJJR.js +1 -0
  30. package/dist/chunk-2RPFCBS4.js +1 -0
  31. package/dist/chunk-3O7LZPKA.js +4 -0
  32. package/dist/chunk-3OGPTLI2.js +1 -0
  33. package/dist/{chunk-6TBTMWNA.js → chunk-4RV4JVGR.js} +1 -1
  34. package/dist/{chunk-YYQEWAES.js → chunk-4WVOAX2V.js} +1 -1
  35. package/dist/{chunk-N4QQADXX.js → chunk-5EVDW7JM.js} +1 -1
  36. package/dist/{chunk-J3X56S7L.js → chunk-5ME4W4LN.js} +1 -1
  37. package/dist/chunk-5OA33JH2.js +2 -0
  38. package/dist/chunk-5TY74LLW.js +2 -0
  39. package/dist/chunk-6254CWUY.js +49 -0
  40. package/dist/{chunk-D5YJOQYK.js → chunk-6E2Y3XGT.js} +1 -1
  41. package/dist/chunk-ARUFY5W3.js +1 -0
  42. package/dist/chunk-B4IVVTMQ.js +2 -0
  43. package/dist/{chunk-HDNATYW7.js → chunk-BHFRP7TV.js} +1 -1
  44. package/dist/{chunk-KTN2ARZJ.js → chunk-BHM6RHTA.js} +3 -3
  45. package/dist/chunk-BRYJTW6S.js +2 -0
  46. package/dist/{chunk-HCFWT42C.js → chunk-BUYLM6QV.js} +1 -1
  47. package/dist/chunk-CPR2CMOY.js +1 -0
  48. package/dist/{chunk-XGE2FDI4.js → chunk-CZVT7T2X.js} +1 -1
  49. package/dist/chunk-EHCKITR4.js +2 -0
  50. package/dist/chunk-ENZPM52J.js +1 -0
  51. package/dist/chunk-FPDH3N3A.js +7 -0
  52. package/dist/{chunk-PXWKMPPI.js → chunk-FX5J6JCK.js} +1 -1
  53. package/dist/chunk-FY4X2VOE.js +39 -0
  54. package/dist/chunk-GIQ4SDRJ.js +1 -0
  55. package/dist/chunk-H77ZNH5O.js +1 -0
  56. package/dist/{chunk-2RL6RRT2.js → chunk-HQLBO23O.js} +50 -50
  57. package/dist/chunk-HYE5UHPV.js +2 -0
  58. package/dist/{chunk-D65FCQIO.js → chunk-IKUFNK46.js} +1 -1
  59. package/dist/{chunk-WRQWVSBJ.js → chunk-IQQMFRWM.js} +1 -1
  60. package/dist/chunk-JCGSIDMC.js +2 -0
  61. package/dist/chunk-KENOAC2Q.js +13 -0
  62. package/dist/chunk-KQ2TMI26.js +97 -0
  63. package/dist/chunk-L5Q2S5GY.js +3 -0
  64. package/dist/chunk-LPCZHKD5.js +1 -0
  65. package/dist/chunk-N4QFNOAI.js +1 -0
  66. package/dist/chunk-NMXGSVMD.js +1 -0
  67. package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
  68. package/dist/{chunk-W6FHVXNL.js → chunk-OCNPOYMA.js} +1 -1
  69. package/dist/chunk-PSYQ6IJA.js +12 -0
  70. package/dist/{chunk-VRGEPPUB.js → chunk-QMQBX3RV.js} +1 -1
  71. package/dist/{chunk-YUGKQ44M.js → chunk-SLFOUSRW.js} +1 -1
  72. package/dist/chunk-SRLWHOLF.js +1 -0
  73. package/dist/chunk-SVYY55IS.js +157 -0
  74. package/dist/chunk-SX6A656X.js +1 -0
  75. package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
  76. package/dist/chunk-THIG2YQP.js +681 -0
  77. package/dist/chunk-TP7VKEUF.js +1 -0
  78. package/dist/chunk-U5ENEDJA.js +7 -0
  79. package/dist/chunk-UTV4DTNM.js +1 -0
  80. package/dist/chunk-VI4ZRAY6.js +1 -0
  81. package/dist/chunk-VQZ5PI5J.js +1 -0
  82. package/dist/chunk-VWBMDGPY.js +9 -0
  83. package/dist/chunk-XDPTAV2T.js +2 -0
  84. package/dist/chunk-XWKGZRHN.js +1 -0
  85. package/dist/chunk-Y35VLVF6.js +5 -0
  86. package/dist/{chunk-VYDURWN7.js → chunk-Y4Z6CEII.js} +1 -1
  87. package/dist/chunk-YYY2WXOH.js +1 -0
  88. package/dist/chunk-ZGHJIQXL.js +1 -0
  89. package/dist/chunk-ZI2E7P6O.js +4 -0
  90. package/dist/{create-ALT2ME6H.js → create-72ITVZXV.js} +1 -1
  91. package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
  92. package/dist/{doctor-RW4R3O5C.js → doctor-CVYUESRQ.js} +1 -1
  93. package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
  94. package/dist/{goal-lifecycle-VYOKS6E6.js → goal-lifecycle-H55AGFCB.js} +1 -1
  95. package/dist/goal-pack-6OBZOPCD.js +1 -0
  96. package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
  97. package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
  98. package/dist/index.d.ts +20 -2
  99. package/dist/index.js +177 -177
  100. package/dist/live-command-5VXPR43F.js +15 -0
  101. package/dist/{pipeline-U4N2DVD7.js → pipeline-SKYOXWHW.js} +1 -1
  102. package/dist/{project-agent-entry-YAQCHIMP.js → project-agent-entry-5IUBEREI.js} +1 -1
  103. package/dist/project-intelligence-lens-LQCN65P2.js +1 -0
  104. package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-KD4LLFGV.js} +1 -1
  105. package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
  106. package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
  107. package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
  108. package/dist/verified-goal-HN7G532B.js +1 -0
  109. package/dist/{workspace-HGUZWNAB.js → workspace-5W7FYGDQ.js} +1 -1
  110. package/dist/{workspace-agent-sync-GEN3KBAX.js → workspace-agent-sync-OZCDQORK.js} +1 -1
  111. package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-NOSGRKRZ.js} +1 -1
  112. package/dist/{workspace-context-4WIWFW26.js → workspace-context-L65BR5L6.js} +1 -1
  113. package/dist/{workspace-contract-7DXK4GF5.js → workspace-contract-JYHNEJPV.js} +1 -1
  114. package/dist/workspace-explain-SUBK6FLO.js +1 -0
  115. package/dist/workspace-explain-contract-WMREJWHF.js +1 -0
  116. package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-MWGCT5R2.js} +1 -1
  117. package/dist/{workspace-foundation-J3NNRMI3.js → workspace-foundation-VIB3PXNH.js} +1 -1
  118. package/dist/{workspace-graph-stream-PQI7OGCE.js → workspace-graph-stream-45JHE4MG.js} +1 -1
  119. package/dist/workspace-graph-token-efficiency-NPECU6Y5.js +1 -0
  120. package/dist/{workspace-history-SYCDK7FO.js → workspace-history-JKW3VJO3.js} +1 -1
  121. package/dist/{workspace-intelligence-6FS26JOQ.js → workspace-intelligence-3C47PK4L.js} +1 -1
  122. package/dist/workspace-intelligence-benchmark-SRDIHX3X.js +1 -0
  123. package/dist/workspace-intelligence-evaluation-OJIQS5SN.js +1 -0
  124. package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-OWN5ZI6W.js} +1 -1
  125. package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-UKFB3BI7.js} +1 -1
  126. package/dist/workspace-knowledge-graph-AKG5NUU6.js +1 -0
  127. package/dist/{workspace-knowledge-graph-contract-L3CLAM2M.js → workspace-knowledge-graph-contract-X52KXBXJ.js} +1 -1
  128. package/dist/{workspace-knowledge-graph-query-FZXSPWGK.js → workspace-knowledge-graph-query-DXA4CROE.js} +1 -1
  129. package/dist/workspace-knowledge-graph-snapshot-SNI5K2RL.js +1 -0
  130. package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
  131. package/dist/workspace-mcp-serve-PK226GMV.js +3 -0
  132. package/dist/workspace-model-R4ISKDB2.js +1 -0
  133. package/dist/{workspace-onboarding-X3PWRIIS.js → workspace-onboarding-Y5RPEFUD.js} +1 -1
  134. package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
  135. package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-PL5V3UDH.js} +2 -2
  136. package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-STGUGROG.js} +1 -1
  137. package/dist/workspace-repair-engine-FNLL5ZDK.js +3 -0
  138. package/dist/workspace-run-GFBFGUFM.js +1 -0
  139. package/dist/{workspace-verify-USRRIM2F.js → workspace-verify-AXVX3PF3.js} +1 -1
  140. package/dist/{workspace-watch-43YZPLF7.js → workspace-watch-RLBEJKXE.js} +1 -1
  141. package/docs/DEVELOPMENT.md +19 -0
  142. package/docs/README.md +19 -16
  143. package/docs/SETUP.md +10 -0
  144. package/docs/agent-entry.md +22 -7
  145. package/docs/ci-workflows.md +1 -1
  146. package/docs/commands-reference.md +58 -8
  147. package/docs/contracts/ARTIFACT_CATALOG.md +64 -44
  148. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
  149. package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
  150. package/docs/contracts/README.md +7 -3
  151. package/docs/real-world-qualification.md +19 -3
  152. package/docs/workspace-intelligence-benchmark.md +82 -0
  153. package/docs/workspace-knowledge-graph.md +95 -27
  154. package/docs/workspace-live-activity.md +209 -0
  155. package/docs/workspace-operations.md +32 -9
  156. package/package.json +4 -2
  157. package/dist/analyze-5PDVWECJ.js +0 -1
  158. package/dist/autopilot-release-JVIJCTKX.js +0 -1
  159. package/dist/capabilities-command-LHM3XIS6.js +0 -1
  160. package/dist/chunk-2647BYBC.js +0 -1
  161. package/dist/chunk-27UR373Z.js +0 -1
  162. package/dist/chunk-2C5ZBVBI.js +0 -2
  163. package/dist/chunk-6JWNDWOA.js +0 -1
  164. package/dist/chunk-CCDGHPEJ.js +0 -2
  165. package/dist/chunk-DFG33SBR.js +0 -2
  166. package/dist/chunk-FY4IIAIF.js +0 -1
  167. package/dist/chunk-HEZZ72V4.js +0 -94
  168. package/dist/chunk-HN7P4T3B.js +0 -681
  169. package/dist/chunk-ILIBOMYL.js +0 -1
  170. package/dist/chunk-J7QYANXK.js +0 -8
  171. package/dist/chunk-JD3A5QM6.js +0 -2
  172. package/dist/chunk-JQLJBK5N.js +0 -1
  173. package/dist/chunk-KLSSPJTV.js +0 -1
  174. package/dist/chunk-L22EABIC.js +0 -7
  175. package/dist/chunk-LNXIMF3O.js +0 -1
  176. package/dist/chunk-MDTI3UEB.js +0 -1
  177. package/dist/chunk-MOSXTVPU.js +0 -1
  178. package/dist/chunk-MYJQGGIU.js +0 -5
  179. package/dist/chunk-NOV6723U.js +0 -1
  180. package/dist/chunk-NYEAMMUL.js +0 -1
  181. package/dist/chunk-NZ3WZYD5.js +0 -1
  182. package/dist/chunk-O5B2L3R2.js +0 -1
  183. package/dist/chunk-OWB5KWSS.js +0 -13
  184. package/dist/chunk-P5PSZQPB.js +0 -2
  185. package/dist/chunk-QCKWQFCD.js +0 -1
  186. package/dist/chunk-QI3HG6IG.js +0 -144
  187. package/dist/chunk-SWGSFLTC.js +0 -1
  188. package/dist/chunk-THIOE2PB.js +0 -2
  189. package/dist/chunk-U5FCQTVL.js +0 -4
  190. package/dist/chunk-UXEO5QCF.js +0 -33
  191. package/dist/chunk-VR6XMUF3.js +0 -2
  192. package/dist/chunk-VVJK5NFY.js +0 -2
  193. package/dist/chunk-VXKWWX7S.js +0 -8
  194. package/dist/chunk-W322YDHS.js +0 -49
  195. package/dist/chunk-WPRLXKWC.js +0 -8
  196. package/dist/chunk-Y5YAP4F3.js +0 -2
  197. package/dist/chunk-YN5X2FTP.js +0 -1
  198. package/dist/chunk-YOCN7GF4.js +0 -1
  199. package/dist/goal-pack-YWPI43QL.js +0 -1
  200. package/dist/project-intelligence-lens-MRQR2LQW.js +0 -1
  201. package/dist/verified-goal-WM34TTGE.js +0 -1
  202. package/dist/workspace-explain-TE2LGOAV.js +0 -1
  203. package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
  204. package/dist/workspace-graph-token-efficiency-2I4X374C.js +0 -1
  205. package/dist/workspace-intelligence-evaluation-CQDKOYZZ.js +0 -1
  206. package/dist/workspace-knowledge-graph-SWCKDTPF.js +0 -1
  207. package/dist/workspace-knowledge-graph-snapshot-M572JRB4.js +0 -1
  208. package/dist/workspace-mcp-serve-IBMTFQDY.js +0 -3
  209. package/dist/workspace-model-ZL6WCICX.js +0 -1
  210. package/dist/workspace-repair-engine-NX7I632M.js +0 -3
  211. package/dist/workspace-run-6GT5OBQ5.js +0 -1
@@ -56,6 +56,9 @@ Useful follow-up questions:
56
56
  # What APIs and endpoints exist?
57
57
  npx workspai workspace graph entities endpoint --json
58
58
 
59
+ # Which languages are evidenced in one project? The flag form is equivalent.
60
+ npx workspai workspace graph entities --kind language --scope project:billing --limit 100 --json
61
+
59
62
  # Why does Workspai believe this entity exists?
60
63
  npx workspai workspace graph evidence "GET /users" --json
61
64
 
@@ -116,6 +119,13 @@ symbols are not implied to have been extracted. The graph diagnostic reports
116
119
  the sampled and indexed candidate counts and must not be read as exhaustive
117
120
  symbol coverage.
118
121
 
122
+ Language inventory is intentionally broader than source-structure parsing.
123
+ The complete eligible-path inventory recognizes systems languages and compiler
124
+ DSLs such as Assembly, CUDA, Fortran, HLSL, LLVM IR/MIR, MLIR, Objective-C,
125
+ OpenCL, and TableGen even when Workspai has no safe generic symbol parser for
126
+ that syntax. Language counts therefore remain project-wide inventory facts;
127
+ symbols, imports, and calls remain bounded to parser-supported source inputs.
128
+
119
129
  Call binding follows the same proof boundary. Workspai binds a call only when
120
130
  its target is uniquely defined in the same file or in a locally imported file
121
131
  that the Graph already resolved. Overloads, dynamic dispatch, and ambiguous
@@ -140,13 +150,14 @@ only when all of the following remain true:
140
150
  - no proof is marked stale;
141
151
  - the graph fingerprint contains exactly one workspace scope and every
142
152
  canonical project scope with compatible scan limits;
143
- - a fresh bounded scan produces the same aggregate live-input hash.
153
+ - a fresh complete eligible-path inventory produces the same aggregate
154
+ live-input hash.
144
155
 
145
156
  Git-backed scopes use `git-worktree-v2`, covering tracked tree state plus
146
- modified, deleted, renamed, untracked, and relevant ignored files. If Git cannot
157
+ modified, deleted, renamed, and non-ignored untracked files. If Git cannot
147
158
  prove the scanned inventory safely—for example because a traversed initialized
148
159
  submodule or hidden index flag is present—Workspai falls back to
149
- `content-merkle-v1`, which hashes each bounded file by portable path and content.
160
+ `content-merkle-v1`, which hashes each eligible file by portable path and content.
150
161
  The graph records the combined strategy as `hybrid-git-content-v2`.
151
162
 
152
163
  A miss rebuilds from live sources. Use `--refresh-graph` when the caller requires
@@ -156,9 +167,38 @@ an explicit rebuild even if the persisted snapshot is compatible:
156
167
  npx workspai workspace graph search "protobuf ownership" --refresh-graph --json
157
168
  ```
158
169
 
159
- The fingerprint proves compatibility of the exact bounded provider inventory;
160
- if a scope reports `truncated: true`, it must not be interpreted as proof about
161
- files beyond that declared limit.
170
+ The fingerprint normally covers every eligible Git-tracked and non-ignored
171
+ untracked file in each project scope. The default `500000`-file limit is an
172
+ emergency safety boundary, not a semantic completeness target. A scope with
173
+ `truncated: true` or `inventoryMode: emergency-bounded` must not be interpreted
174
+ as proof about files beyond that boundary. Git inventories publish an exact
175
+ `eligibleFileCount`; a non-Git fallback that reaches the boundary publishes
176
+ `eligibleFileCountExact: false` instead of inventing a total.
177
+
178
+ Path inventory and content-heavy extraction have separate budgets. Complete
179
+ inventory feeds freshness, manifest discovery, language counts, architecture
180
+ contracts, CI, ownership, infrastructure, and targeted providers. Semantic and
181
+ deep providers receive deterministic adaptive selections distributed across
182
+ component and language buckets. This prevents a large package, vendored tree,
183
+ or alphabetically early directory from starving the rest of a polyglot
184
+ monorepo. Every provider publishes `inputCoverage`; successful execution over a
185
+ bounded selection is reported as `partial`, never as exhaustive coverage.
186
+
187
+ Defaults scale with the eligible project population up to these safety
188
+ ceilings:
189
+
190
+ - complete inventory emergency bound: `500000` files per project;
191
+ - adaptive semantic input: up to `100000` files per project;
192
+ - adaptive deep-provider input: up to `25000` files per project;
193
+ - source extraction: up to `20000` files per project.
194
+
195
+ Use `--graph-inventory-limit`, `--graph-semantic-budget`,
196
+ `--graph-deep-budget`, and `--graph-source-budget` on `workspace graph`, or the
197
+ equivalent `WORKSPAI_GRAPH_INVENTORY_LIMIT`,
198
+ `WORKSPAI_GRAPH_SEMANTIC_BUDGET`, `WORKSPAI_GRAPH_DEEP_BUDGET`, and
199
+ `WORKSPAI_GRAPH_SOURCE_BUDGET` environment variables for non-interactive model,
200
+ Adopt, and Intelligence runs. Increasing deep budgets affects cost, not the
201
+ canonical per-project storage boundary.
162
202
 
163
203
  Workspai-generated agent entry projections are downstream consumers and are
164
204
  excluded from Graph inventory and Git diff hashing. Regenerating `AGENTS.md`,
@@ -167,17 +207,17 @@ Graph that produced them or become circular architecture evidence.
167
207
 
168
208
  ## Pick the command by question
169
209
 
170
- | You want to know… | Use |
171
- | ---------------------------------------------------- | ------------------------------------------------------- |
172
- | What is relevant to a natural-language question? | `workspace graph search <query> --limit <n> --json` |
173
- | Which entities of one type exist? | `workspace graph entities <kind> --json` |
174
- | Why does Workspai believe an item exists? | `workspace graph evidence <entity-or-relation> --json` |
175
- | How are two things connected? | `workspace graph path <from> <to> --json` |
176
- | What changed between graph revisions? | `workspace graph overlay --from <graph.json> --json` |
177
- | What is the full portable graph? | `workspace graph emit --output graph.json --json` |
178
- | How do I render the project topology? | `workspace graph dot\|mermaid [--output <file>]` |
179
- | How do I export to semantic or graph-analysis tools? | `workspace graph jsonld\|graphml\|gexf --output <file>` |
180
- | How much retrieval payload did one query avoid? | `workspace graph benchmark <query> --limit <n> --json` |
210
+ | You want to know… | Use |
211
+ | ---------------------------------------------------- | ----------------------------------------------------------------------------- |
212
+ | What is relevant to a natural-language question? | `workspace graph search <query> --limit <n> --json` |
213
+ | Which entities of one type exist? | `workspace graph entities <kind> [--scope project:name] [--limit <n>] --json` |
214
+ | Why does Workspai believe an item exists? | `workspace graph evidence <entity-or-relation> --json` |
215
+ | How are two things connected? | `workspace graph path <from> <to> --json` |
216
+ | What changed between graph revisions? | `workspace graph overlay --from <graph.json> --json` |
217
+ | What is the full portable graph? | `workspace graph emit --output graph.json --json` |
218
+ | How do I render the project topology? | `workspace graph dot\|mermaid [--output <file>]` |
219
+ | How do I export to semantic or graph-analysis tools? | `workspace graph jsonld\|graphml\|gexf --output <file>` |
220
+ | How much retrieval payload did one query avoid? | `workspace graph benchmark <query> --limit <n> --json` |
181
221
 
182
222
  `graph emit --json` writes the complete dependency and Knowledge Graph to
183
223
  stdout and can be very large. Automation, IDEs, and agents should pass
@@ -293,9 +333,10 @@ in `project.runtimeCandidates` and aggregates them into
293
333
  monorepo's internal services, contracts, delivery surfaces, and proofs without
294
334
  pretending that the primary runtime describes the whole repository.
295
335
 
296
- The two artifacts are published under one workspace lock using a
297
- rollback-capable artifact transaction. Each file replacement is atomic; if any
298
- write fails, Workspai restores both preimages. `graph.source.kind` is fixed to
336
+ The model, workspace aggregate, and all project graph artifacts are published
337
+ under one workspace lock using a rollback-capable multi-root artifact
338
+ transaction. Each file replacement is atomic; if any write fails, Workspai
339
+ restores every preimage. `graph.source.kind` is fixed to
299
340
  `workspace-model`, `graph.source.artifact` is fixed to
300
341
  `.workspai/reports/workspace-model.json`, and `graph.source.hash` contains the
301
342
  stable structural hash of the persisted model. A current-state consumer must
@@ -375,14 +416,23 @@ into a false “complete” claim.
375
416
 
376
417
  ## Outputs and consumers
377
418
 
378
- `workspace model --write` publishes these two artifacts as one locked,
379
- rollback-capable artifact set:
419
+ `workspace model --write` publishes the canonical model, one complete workspace
420
+ aggregate, and one compact integrity-bound reference for every registered
421
+ project as one locked, rollback-capable multi-root artifact set:
380
422
 
381
423
  ```text
382
- .workspai/reports/workspace-model.json
383
- .workspai/reports/workspace-knowledge-graph.json
424
+ <workspace>/.workspai/reports/workspace-model.json
425
+ <workspace>/.workspai/reports/workspace-knowledge-graph.json
426
+ <project>/.workspai/reports/project-knowledge-graph-reference.json
384
427
  ```
385
428
 
429
+ The workspace artifact preserves all registered projects and cross-project
430
+ relations for Graph, Doctor, Context, Goal, and MCP consumers. Each project
431
+ reference carries source and projection hashes, summary counts, a bounded query,
432
+ and a portable canonical URI; it does not duplicate graph entities or proofs.
433
+ Nested and external projects follow the same rule. Any publication failure
434
+ restores the model, aggregate, and all project reference preimages together.
435
+
386
436
  The Knowledge Graph is consumed by:
387
437
 
388
438
  - `workspace graph search|entities|evidence|path|overlay`;
@@ -403,8 +453,12 @@ The Knowledge Graph is consumed by:
403
453
  topology, rich graph, and quality summary in one response.
404
454
 
405
455
  The complete graph is an interchange artifact, not a prompt. Agents should
406
- start with `INDEX.json`, use bounded search, then retrieve evidence or a path
407
- for the selected result.
456
+ start with compact project context, use bounded search, then retrieve evidence
457
+ or a path for the selected result. Generated `project-context-agent.json`,
458
+ `agent-entry.v1.json`, and bootstrap receipts expose a small project graph
459
+ reference separately from the `workspace:` aggregate. Bootstrap schema-validates
460
+ the reference and compares its projection hash with a fresh projection of the
461
+ aggregate before it allows architecture claims. The complete graph is stored once.
408
462
 
409
463
  ### Interchange and visualization
410
464
 
@@ -469,7 +523,11 @@ hashes. Query indexes are cached per immutable graph object; replacing the graph
469
523
  is the in-memory invalidation boundary. Across CLI processes, compatible
470
524
  persisted read queries validate the live Git/Merkle fingerprint before reuse.
471
525
  `workspace model --cache` and `--incremental` avoid unnecessary model/project
472
- work when inputs are unchanged.
526
+ work when inputs are unchanged. Full, cached, and incremental builds use the
527
+ same project-discovery contract, including adopted/imported projects and
528
+ projects declared only through a workspace contract `externalPath`. Manifest
529
+ or source changes under an external project therefore invalidate the same
530
+ signatures as equivalent in-workspace projects.
473
531
 
474
532
  Use full graph export for interchange or offline analysis. Use bounded search
475
533
  for interactive agents. The latter keeps response size proportional to the
@@ -487,6 +545,16 @@ remains unknown until a method/path or operation-id binding is proven. Consumers
487
545
  can distinguish the two guarantees through `bindingCoverage.apiRuntimeRegistration`
488
546
  and `bindingCoverage.apiImplementation`.
489
547
 
548
+ Runtime-registration eligibility is explicit. Network and event contracts such
549
+ as OpenAPI, server-root GraphQL schemas, AsyncAPI, and authored workspace API
550
+ contracts participate; command palettes, console scripts, chat participants,
551
+ shared protocol identities, and client GraphQL operations do not. GraphQL query,
552
+ mutation, subscription, and fragment documents are modeled as proof-backed
553
+ symbols that consume the GraphQL protocol. Only an authored root `schema` or
554
+ non-extension `Query`, `Mutation`, or `Subscription` type establishes a
555
+ runtime-served GraphQL API. This prevents client-heavy repositories from
556
+ inflating API registration unknowns while preserving their operation topology.
557
+
490
558
  ## Measuring retrieval payload reduction
491
559
 
492
560
  Workspai does not publish an unqualified “N× fewer tokens” claim. Such a claim
@@ -0,0 +1,209 @@
1
+ # Workspai Live Activity
2
+
3
+ `workspai live` renders the execution graph of Workspai commands running in
4
+ other terminals for the same project or workspace.
5
+
6
+ ```bash
7
+ # Terminal A
8
+ workspai live
9
+
10
+ # Terminal B
11
+ workspai workspace intelligence run
12
+
13
+ # Terminal C
14
+ workspai doctor workspace
15
+ ```
16
+
17
+ The monitor is observational. Closing it does not cancel commands, and a
18
+ journal or renderer failure cannot change command success.
19
+
20
+ ## Commands
21
+
22
+ ```bash
23
+ workspai live [target]
24
+ workspai live --global
25
+ workspai live --global --max-scopes 20 --max-runs 20
26
+ workspai live --run <run-id>
27
+ workspai live --once
28
+ workspai live --once --json
29
+ workspai live --once --json --projection board
30
+ workspai live --refresh-ms 500 --max-runs 10
31
+ workspai live --no-motion --no-color
32
+ workspai live --ascii
33
+ workspai live --accessible
34
+ workspai live --classic
35
+ workspai live --capture workspai-live.svg
36
+ workspai live --capture launch.svg --capture-preset linkedin --capture-theme obsidian
37
+ workspai live --capture internal.svg --no-capture-redact
38
+ workspai live --replay <run-id> --replay-speed 4
39
+ ```
40
+
41
+ `target` defaults to the current directory. `--once` is suitable for scripts,
42
+ diagnostics and tests. Without a TTY, `--json` emits a new snapshot only when
43
+ projected activity changes. `--global` discovers bounded machine-local activity
44
+ channels and produces one fleet view across projects and workspaces; it cannot
45
+ be combined with `target`.
46
+
47
+ JSON defaults to the backward-compatible monitor projection. Use
48
+ `--projection board` for the public `workspace-activity-board.v1` projection
49
+ consumed by IDE, browser, dashboard and capture adapters. It contains bounded
50
+ runs, nodes, edges, selection, counters and diagnostics; consumers must not
51
+ infer verification success from activity state.
52
+
53
+ `--capture` writes an atomic, deterministic SVG from the same Activity Board
54
+ Model used by the terminal and exits. Captures are redacted by default: local
55
+ scope, project, run and command-argument details are replaced while semantic
56
+ stage and outcome data remain. Presets are `github` (1280×720), `linkedin`
57
+ (1200×627), `x`/`wide` (1600×900) and `square` (1080×1080); themes are
58
+ `obsidian`, `light` and `mono`. Use `--no-capture-redact` only for an explicitly
59
+ internal artifact.
60
+
61
+ `--replay <run-id>` reconstructs the selected run from immutable event prefixes
62
+ instead of inventing UI state. Replay defaults to 4× speed, accepts
63
+ `--replay-speed 0.25..64`, and is scoped to the target project or workspace.
64
+
65
+ ## Flow Board
66
+
67
+ The default TTY renderer is a bounded full-screen Flow Board, not an appended
68
+ log. Each command publishes a versioned execution blueprint containing stable
69
+ block and edge IDs. The board then projects real transitions onto that graph:
70
+
71
+ - a running block uses an active cyan border;
72
+ - successful, warning/blocked and failed blocks become green, yellow and red;
73
+ - a running handoff animates on the edge entering the next block;
74
+ - full-board connections terminate in weight-matched ports on the card frame;
75
+ font-dependent triangle arrowheads are not mixed with box-drawing lines, and
76
+ direction is conveyed by an aligned moving wire segment plus the serpentine
77
+ flow layout;
78
+ - cards reserve their frame for topology and their content row for a stable
79
+ `QUEUE/RUN/DONE/WARN/BLOCK/FAIL` status rail, attempt and progress metadata;
80
+ - a block started again after a terminal outcome is a new durable attempt; its
81
+ card shows `↻2`, `↻3`, and so on, retains earlier attempt outcomes and
82
+ reactivates the incoming flow wire;
83
+ - independent runs may have multiple active blocks at the same time;
84
+ - phase rails are emitted by command blueprints, so grouping reflects command
85
+ architecture rather than a repository-specific UI assumption;
86
+ - terminals at least 132 columns wide receive a factual Inspector for the
87
+ selected active/problem block: state, phase, attempt, progress, elapsed time,
88
+ touches, artifacts and warnings; `i` or `Tab` toggles it;
89
+ - the selected run receives the full flow graph; other running commands are
90
+ reduced to one minimal `ALSO ACTIVE` dock in local mode; global mode uses a
91
+ Fleet Cockpit with location, command, active block, status and elapsed time
92
+ before the selected run graph;
93
+ - journals left running by a process that no longer exists are projected as
94
+ orphaned/cancelled and never inflate the active counter or active-run dock;
95
+ - narrow or short terminals automatically collapse to chips without losing
96
+ status or ordering.
97
+
98
+ The renderer updates changed terminal rows only and uses the alternate screen,
99
+ so monitoring does not produce an unbounded scrollback stream. Resize triggers
100
+ a safe full redraw. Interactive controls are:
101
+
102
+ | Key | Effect |
103
+ | -------------------- | --------------------------------------------- |
104
+ | `↑` / `↓`, `j` / `k` | Select a run |
105
+ | `Enter` | Focus/unfocus the selected run |
106
+ | `i`, `Tab` | Toggle the adaptive Inspector |
107
+ | `f` | Toggle active runs only |
108
+ | `q`, `Ctrl+C` | Close the monitor without cancelling commands |
109
+
110
+ Replay controls are `Space` to play/pause, `←`/`→` (or `,`/`.`) to step one
111
+ durable event backward/forward, and `q` to close. Reaching the last event pauses
112
+ the replay instead of exiting, which keeps the terminal ready for inspection.
113
+
114
+ `NO_COLOR`, `TERM=dumb`, `WORKSPAI_LIVE_ASCII=1` and
115
+ `WORKSPAI_LIVE_REDUCED_MOTION=1` are honored. `--accessible` uses a stable,
116
+ non-animated linear projection with no terminal control sequences for screen
117
+ readers and captured output. `--classic` preserves the compatibility renderer.
118
+
119
+ The implementation intentionally keeps this pipeline renderer-independent:
120
+
121
+ ```text
122
+ workspace-activity-event.v1
123
+ -> deterministic monitor snapshot
124
+ -> workspace-activity-board.v1 (runs, nodes, edges, selection, counters)
125
+ -> terminal + deterministic SVG adapters today / web and IDE adapters later
126
+ ```
127
+
128
+ No TUI framework is part of the Activity runtime. This prevents React/Yoga or
129
+ terminal-widget lifecycle state from entering the future package boundary and
130
+ keeps browser/IDE renderers able to consume the same Board Model.
131
+
132
+ ## Project and workspace behavior
133
+
134
+ The command works before adoption and does not create metadata in an ordinary
135
+ project. Activity journals are stored in machine-local state:
136
+
137
+ - Linux: `$XDG_STATE_HOME/workspai/activity`, or `~/.local/state/workspai/activity`;
138
+ - macOS: `~/Library/Application Support/Workspai/activity`;
139
+ - Windows: `%LOCALAPPDATA%\Workspai\activity`.
140
+
141
+ `WORKSPAI_ACTIVITY_STATE_DIR` overrides this location. Set
142
+ `WORKSPAI_ACTIVITY_DISABLE=1` to disable journaling.
143
+
144
+ An adopted or linked project keeps its stable physical project channel and
145
+ mirrors the same event/run identities into its workspace channel. This allows a
146
+ monitor opened before `adopt` to keep following the run while a monitor at the
147
+ workspace root receives subsequent linked-project activity.
148
+
149
+ `workspai live --global` scans the bounded local channel registry, deduplicates
150
+ mirrored records by event identity, then groups runs by semantic scope. Every
151
+ run also carries a machine-local origin identity, so two projects in one
152
+ workspace remain distinguishable while sharing one workspace lane, and projects
153
+ from different workspaces retain separate scope labels. The selected run owns
154
+ the full graph; concurrent activity from other origins stays visible in the
155
+ Fleet Cockpit without merging independent timelines.
156
+
157
+ ## Event contract
158
+
159
+ Every NDJSON line conforms to:
160
+
161
+ ```text
162
+ contracts/workspace-activity-event.v1.json
163
+ contracts/workspace-activity-monitor-snapshot.v1.json
164
+ contracts/workspace-activity-monitor-fleet.v1.json
165
+ contracts/workspace-activity-board.v1.json
166
+ ```
167
+
168
+ The stream contains run, block, attempt, origin, declared-edge, operation,
169
+ touch, artifact and warning data. Blueprint edges are explicit `sequence`, `parallel`, `gate` or
170
+ `handoff` relations; older journals without declared edges receive a
171
+ deterministic sequential projection for compatibility.
172
+ Stable semantic block IDs describe architecture stages rather than source line
173
+ numbers or function names.
174
+
175
+ Activity is not evidence or authorization:
176
+
177
+ - progress does not prove a result;
178
+ - an exit code does not verify an engineering outcome;
179
+ - a planned touch is not an observed effect;
180
+ - the Activity journal is not the Evidence or Decision Ledger.
181
+
182
+ Canonical domain artifacts and receipts remain owned by Model, Graph, Doctor,
183
+ Security, Decisions and their existing contracts.
184
+
185
+ ## Privacy and retention
186
+
187
+ - sensitive command options and metadata keys are redacted before persistence;
188
+ - absolute paths are converted to project-relative locators when possible;
189
+ - external targets expose only an `<external>/<basename>` locator;
190
+ - environment variables, file contents and raw subprocess output are not stored;
191
+ - the runtime retains at most 200 journals and 14 days per channel by default,
192
+ even when no monitor is open;
193
+ - replay applies bounded per-journal read windows, a 20,000-event scoped ceiling
194
+ and a 50,000-event global ceiling so corrupt or oversized history cannot grow
195
+ monitor memory without limit;
196
+ - state directories and journals are created with user-only permissions where
197
+ the platform supports POSIX modes.
198
+
199
+ ## Current limitations
200
+
201
+ - live transport uses bounded journal polling rather than an IPC broker;
202
+ - the local web/SSE renderer is planned but not implemented;
203
+ - arbitrary shell commands require a future explicit wrapper or SDK for
204
+ semantic block attribution;
205
+ - full filesystem reconciliation and syscall-level deep tracing are not part of
206
+ the default profile.
207
+
208
+ The future package boundary and extraction gates are documented in
209
+ `Docs/npm/Packages/ACTIVITY_PLANE_EXTRACTION_PLAN.md`.
@@ -88,7 +88,7 @@ versioned archive operation result instead.
88
88
 
89
89
  Workspace creation publishes the initial contract, canonical model, Knowledge
90
90
  Graph, structural baseline, context, report index, profile-aware `README.md`,
91
- `AGENTS.md`, operational skills, and supported IDE/agent surfaces—even before
91
+ `AGENTS.md`, applicable operational skills, and supported IDE/agent surfaces—even before
92
92
  the first project exists. The README's Workspai-managed section shows the
93
93
  current profile, project count, canonical intelligence loop, and consumer entry
94
94
  points while preserving user-authored content. Successful project creation,
@@ -97,6 +97,14 @@ projections in the background. The structural baseline is created once and
97
97
  preserved; current model, graph, diff, impact, context, README, and project
98
98
  grounding move forward with workspace membership.
99
99
 
100
+ Operational Skill generation is evidence-driven. Release readiness remains
101
+ available at workspace scope, while API, schema, dependency, contract, runtime,
102
+ test, delivery, and polyglot playbooks are emitted only for matching projects.
103
+ `.workspai/reports/workspace-skills-index.json` records both generated and
104
+ suppressed candidates, including the signals behind each decision. This keeps
105
+ agent discovery useful without claiming capabilities the repository does not
106
+ have.
107
+
100
108
  Doctor, Analyze, Readiness, and Verify remain explicit checks because they may
101
109
  run project tools or enforce release policy. Use `workspace intelligence run`
102
110
  when you want that governed decision chain, rather than only lifecycle sync.
@@ -122,21 +130,30 @@ Workspai returns a specific error for an invalid explicit workspace, malformed
122
130
  or stale link, ambiguous registration, or an unlinked project. It never picks
123
131
  one workspace silently when ownership is ambiguous.
124
132
 
125
- The project receives four distinct surfaces:
133
+ The project receives seven complementary surfaces. They are different views of
134
+ one canonical workspace binding, not seven copies of the model or graph:
126
135
 
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 |
136
+ | File | Purpose | Portable |
137
+ | ---------------------------------------------------------- | ------------------------------------------------------------------------------ | --------------------- |
138
+ | `.workspai/workspace-link.local.json` | Machine-local canonical workspace binding | No; always gitignored |
139
+ | `.workspai/agent-entry.v1.json` | Versioned host coverage, read order, authority boundaries, and integrity proof | Yes |
140
+ | `.workspai/reports/project-context-agent.json` | Bounded project view of model, graph, proofs, diagnostics, and safe commands | Yes |
141
+ | `.workspai/reports/project-knowledge-graph-reference.json` | Integrity-bound locator for the canonical project graph projection | Yes |
142
+ | `.workspai/PROJECT-GROUNDING.md` | Human- and agent-readable project entry guide | Yes |
143
+ | `.agents/skills/workspai-*/SKILL.md` | Native project Skill wrappers for canonical workspace playbooks | Yes |
144
+ | `AGENTS.md` and host adapters | Route supported hosts to the same canonical-first bootstrap | Yes |
134
145
 
135
146
  The bounded context includes project identity and commands, dependencies and
136
147
  dependents, related API/deployment/test surfaces, current project findings,
137
148
  portable proof locators, and model/graph freshness. It deliberately references
138
149
  rather than duplicates workspace-wide evidence.
139
150
 
151
+ Representative graph entities are selected with a stratified round-robin
152
+ budget, so a large early-sorted kind cannot hide later architectural kinds.
153
+ `intelligence.projection` records the entity and byte budgets, selected and
154
+ omitted counts per kind, and the scoped graph-search command for retrieving
155
+ anything outside the lens. Aggregate counts in the lens remain exhaustive.
156
+
140
157
  Use `--project-grounding managed` (default) to publish all portable surfaces,
141
158
  `local` to keep the project lens and grounding gitignored without managing
142
159
  `AGENTS.md`, or `off` to disable project grounding for that operation. The
@@ -417,6 +434,12 @@ Artifacts:
417
434
  | `workspace run` | Workspace orchestrator | Fleet stage execution |
418
435
  | `infra` | Workspace sidecar | Contract-driven local dependencies |
419
436
 
437
+ The readiness `env` gate only treats runtimes represented in
438
+ `.workspai/toolchain.lock` as pinned. A Workspai Node pin does not prove a
439
+ native C/C++ compiler or another unrepresented project toolchain; those scopes
440
+ remain `warn` until the project build contract or organization CI policy
441
+ provides verifiable toolchain evidence.
442
+
420
443
  The unified intelligence runner keeps `sync` and baseline resolution in a
421
444
  separate two-entry execution envelope and emits exactly 11 canonical stages.
422
445
  Exit `2` means the evidence gate blocked readiness after successful execution;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.65.0",
3
+ "version": "0.67.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": [
@@ -116,6 +116,7 @@
116
116
  "test:scenarios:docker": "bash scripts/scenario-matrix.sh",
117
117
  "test:runtime-matrix": "node scripts/runtime-acceptance-matrix.mjs",
118
118
  "test:runtime-contract": "node scripts/runtime-acceptance-matrix.mjs --contract-only",
119
+ "prepush:test:runtime-contract": "node scripts/run-cached-prepush-gate.mjs runtime-contract",
119
120
  "test:runtime-matrix:full": "node scripts/runtime-acceptance-matrix.mjs --full",
120
121
  "test:real-world": "node scripts/real-world-qualification.mjs",
121
122
  "test:real-world:enterprise": "node scripts/enterprise-workspace-qualification.mjs",
@@ -141,6 +142,7 @@
141
142
  "smoke:frontend-generators:network": "tsup && node scripts/smoke-frontend-generators.mjs --execute",
142
143
  "smoke:official-generators": "tsup && node scripts/smoke-official-generators.mjs",
143
144
  "smoke:official-generators:no-build": "node scripts/smoke-official-generators.mjs",
145
+ "prepush:smoke:official-generators": "node scripts/run-cached-prepush-gate.mjs official-generators-contract",
144
146
  "smoke:official-generators:network": "tsup && node scripts/smoke-official-generators.mjs --execute",
145
147
  "check:generator-smoke-coverage": "node scripts/check-generator-smoke-coverage.mjs",
146
148
  "sync:contracts": "node scripts/sync-contracts.mjs",
@@ -151,7 +153,7 @@
151
153
  "size-check:no-build": "size-limit",
152
154
  "bench": "npx tsx scripts/benchmarks.ts",
153
155
  "quality": "corepack npm run check:package-manager && corepack npm run typecheck && corepack npm run lint && corepack npm run format:check && corepack npm test && corepack npm run size-check && corepack npm run check:workspace-intelligence-runtime && corepack npm run check:workspace-intelligence-adversarial && corepack npm run check:doctor-capabilities && corepack npm run test:runtime-contract && corepack npm run security && corepack npm run validate:docs && corepack npm run check:generator-smoke-coverage && corepack npm run smoke:official-generators && corepack npm run check:contracts && corepack npm run check:shared-contracts && corepack npm run check:parity-snapshot && corepack npm run check:agent-customization-drift",
154
- "quality:push": "corepack npm run check:package-manager && corepack npm run check:windows-registry && corepack npm run typecheck && corepack npm run lint && corepack npm run format:check && corepack npm run build && corepack npm run test:no-build && corepack npm run size-check:no-build && corepack npm run check:workspace-intelligence-runtime && corepack npm run check:workspace-intelligence-adversarial && corepack npm run check:doctor-capabilities && corepack npm run test:runtime-contract && corepack npm run validate:docs && corepack npm run check:generator-smoke-coverage && corepack npm run smoke:official-generators:no-build && corepack npm run contracts:check:local && corepack npm run validate:contracts:tests",
156
+ "quality:push": "corepack npm run check:package-manager && corepack npm run check:windows-registry && corepack npm run typecheck && corepack npm run lint && corepack npm run format:check && corepack npm run build && corepack npm run test:no-build && corepack npm run size-check:no-build && corepack npm run check:workspace-intelligence-runtime && corepack npm run check:workspace-intelligence-adversarial && corepack npm run check:doctor-capabilities && corepack npm run prepush:test:runtime-contract && corepack npm run validate:docs && corepack npm run check:generator-smoke-coverage && corepack npm run prepush:smoke:official-generators && corepack npm run contracts:check:local && corepack npm run validate:contracts:tests",
155
157
  "act-matrix": "act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-22.04 -P macos-latest=ghcr.io/catthehacker/ubuntu:act-22.04 -P windows-latest=ghcr.io/catthehacker/ubuntu:act-22.04 --pull=false -j build-test-matrix",
156
158
  "release:dry": "bash scripts/release.sh --no-publish --yes --allow-dirty",
157
159
  "release:patch": "bash scripts/release.sh patch",
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-WPRLXKWC.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-HDNATYW7.js';
@@ -1 +0,0 @@
1
- export{b as runDoctorCapabilities}from'./chunk-6TBTMWNA.js';
@@ -1 +0,0 @@
1
- import y from'fs';import u from'path';var b="polyglot-lifecycle-plan.v1",x=new Set([".git",".workspai",".rapidkit",".venv","bin","build","dist","node_modules","obj","target","third_party","vendor","fixture","fixtures","__fixtures__","testdata"]);function f(o,i){return u.relative(o,i).split(u.sep).join("/")||"."}function P(o,i){let t=[],s=(r,n)=>{if(n>i)return;let m=[];try{m=y.readdirSync(r,{withFileTypes:true});}catch{return}for(let d of m.sort((a,c)=>a.name.localeCompare(c.name))){let a=u.join(r,d.name);if(d.isDirectory()){x.has(d.name)||s(a,n+1);continue}d.isFile()&&(["package.json","pyproject.toml","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts","CMakeLists.txt","meson.build"].includes(d.name)||/\.(?:cs|fs|vb)proj$/i.test(d.name))&&t.push(a);}};return s(o,0),t}function h(o,i){if(u.basename(i)!=="package.json")return false;let t=f(o,i).toLowerCase().split("/"),s=t.findIndex(r=>["test","tests","spec","specs","e2e","integration","integration-tests"].includes(r));return s<0?false:t.length-s>2}function e(o,i,t="high"){return {stage:o,command:i,confidence:t,preflight:"executable-and-inputs"}}function S(o,i){let t={};try{let n=JSON.parse(i);n.scripts&&typeof n.scripts=="object"&&!Array.isArray(n.scripts)&&(t=n.scripts);}catch{}let s=y.existsSync(u.join(o,"pnpm-lock.yaml"))?"pnpm":y.existsSync(u.join(o,"yarn.lock"))?"yarn":"npm",r=n=>`${s} run ${n}`;return [e("init",s==="yarn"?"yarn install":`${s} install`),...typeof t.test=="string"?[e("test",r("test"))]:[],...typeof t.build=="string"?[e("build",r("build"))]:[],...typeof t.start=="string"?[e("start",r("start"))]:[]]}function j(o,i){let t=u.basename(i),s=u.dirname(i),r=f(o,s),n=f(o,i),m=n.toLowerCase().split("/"),d=m.some(l=>["example","examples","sample","samples","worked"].includes(l))?"example":m.some(l=>["test","tests","e2e","integration","integration-tests"].includes(l))?"test":m.some(l=>["script","scripts","tool","tools","tooling"].includes(l))?"tooling":"production",a="";try{a=y.readFileSync(i,"utf8");}catch{return null}let c,g,p;if(t==="package.json")c="node",g="npm",p=S(s,a);else if(t==="pyproject.toml")c="python",g="python",p=[e("init","python -m pip install -e ."),...y.existsSync(u.join(s,"tests"))||/\[tool\.pytest/i.test(a)?[e("test","python -m pytest")]:[],.../\[build-system\]/.test(a)?[e("build","python -m build","medium")]:[]];else if(t==="go.mod")c="go",g="go",p=[e("init","go mod download"),e("test","go test ./..."),e("build","go build ./...")];else if(t==="Cargo.toml")c="rust",g="cargo",p=[e("init","cargo fetch"),e("test","cargo test"),e("build","cargo build"),...y.existsSync(u.join(s,"src","main.rs"))?[e("start","cargo run")]:[]];else if(t==="pom.xml"){c="java",g="maven";let l=y.existsSync(u.join(s,"mvnw"))?"./mvnw":"mvn";p=[e("init",`${l} dependency:go-offline`),e("test",`${l} test`),e("build",`${l} package`)];}else if(t==="build.gradle"||t==="build.gradle.kts"){c="java",g="gradle";let l=y.existsSync(u.join(s,"gradlew"))?"./gradlew":"gradle";p=[e("init",`${l} dependencies`),e("test",`${l} test`),e("build",`${l} build`)];}else if(/\.(?:cs|fs|vb)proj$/i.test(t)){c="dotnet",g="nuget";let l=d==="test"||/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test(a)||/PackageReference\s+Include=["']Microsoft\.NET\.Test\.Sdk["']/i.test(a);p=[e("init",`dotnet restore ${t}`),...l?[e("test",`dotnet test ${t}`)]:[],e("build",`dotnet build ${t}`)];}else if(t==="CMakeLists.txt")c=/(?:\bcxx\b|\bcplusplus\b|\bc\+\+\b)/iu.test(a)?"cpp":"c",g="cmake",p=[e("init","cmake -S . -B build"),e("test","ctest --test-dir build --output-on-failure","medium"),e("build","cmake --build build")];else if(t==="meson.build")c=/(?:cpp|c\+\+)/iu.test(a)?"cpp":"c",g="meson",p=[e("init","meson setup build"),e("test","meson test -C build","medium"),e("build","meson compile -C build")];else return null;return {id:`${c}:${r}:${n}`,runtime:c,ecosystem:g,role:d,root:r,manifest:n,stages:p}}function R(o,i={}){let t=u.resolve(o),s=P(t,Math.max(0,Math.min(i.maxDepth??4,12))).filter(n=>!h(t,n)).map(n=>j(t,n)).filter(n=>!!n).filter(n=>i.includeExamples===true||n.role!=="example").sort((n,m)=>n.runtime.localeCompare(m.runtime)||n.root.localeCompare(m.root)||n.manifest.localeCompare(m.manifest)),r=[...new Set(s.map(n=>n.runtime))].sort();return {schemaVersion:b,projectRoot:".",polyglot:r.length>1,runtimes:r,units:s}}export{R as a};
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-GR6442P7.js';import {j,a,b as b$1,t}from'./chunk-MOSXTVPU.js';import {promises}from'fs';import c from'path';var v=new Set(["node_modules","dist","build","target","coverage","htmlcov",".workspai",".rapidkit",".venv"]);function b(t,r){if(r.has(t)||a$1(t))return true;let i=t.toLowerCase();return !!(i==="dist"||i.startsWith("dist-")||i.startsWith("dist_")||i==="build"||i.startsWith("build-")||i.startsWith("build_"))}async function D(t){try{return await promises.access(t),true}catch{return false}}async function w(t$1){for(let r of t(t$1,"context.json"))if(await D(r))return true;for(let r of t(t$1,"project.json"))if(await D(r))return true;return false}async function M(t,r){let i=[],o=[c.resolve(t)],u=new Set,P=r?.skipDirs??v,g=r?.includeHiddenDirs===true,y=r?.descendIntoMatchedProjects!==false,j$1=r?.isProjectDir??w,d=c.resolve(t);for(;o.length>0;){let e=o.shift();if(!e||u.has(e)||(u.add(e),e!==d&&j(e))||await j$1(e,d)&&(i.push(e),!y))continue;let s=[];try{s=await promises.readdir(e,{withFileTypes:true});}catch{continue}for(let n of s)n.isDirectory()&&(!g&&n.name.startsWith(".")||b(n.name,P)||n.name===a||n.name===b$1||o.push(c.join(e,n.name)));}return i.sort((e,s)=>e.localeCompare(s))}export{M as a};
@@ -1,2 +0,0 @@
1
- import {b as b$1}from'./chunk-LNXIMF3O.js';import {b}from'./chunk-VXKWWX7S.js';import {n,f as f$1,g}from'./chunk-FY4IIAIF.js';import {d}from'./chunk-P5PSZQPB.js';import {e as e$1,d as d$1}from'./chunk-CCDGHPEJ.js';import {f,e}from'./chunk-NZ3WZYD5.js';import E from'path';import S from'fs-extra';var te=f.agentContext,se=e.agentContext;function ae(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let r=e.trim().toLowerCase();return r==="codex"||r==="claude"||r==="cursor"||r==="gemini"||r==="qwen"||r==="kimi"||r==="grok"||r==="copilot"||r==="windsurf"||r==="amazon-q"||r==="orca"?r:"generic"}function L(e){return `npx --yes --package workspai workspai ${e}`.trim()}function j(e){return `npx workspai ${e}`.trim()}async function v(e,r,i){let s=E.join(e,r);if(!await S.pathExists(s))return null;try{let a=await S.readJson(s);return !a||a.schemaVersion!==i?null:a}catch{return null}}function p(e$1){return {id:e$1.id,scope:e$1.scope,display:j(e$1.args),execute:L(e$1.args),description:e$1.description,...e$1.project?{project:e$1.project}:{},freshness:f$1({id:`command.${e$1.id}`,label:`${e$1.id} command`,scope:"command",value:{display:j(e$1.args),execute:L(e$1.args)},...e$1.project?{project:e$1.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e$1.generatedAt,now:e$1.now,sourceArtifact:e.model,sourcePath:`safeCommands.${e$1.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function D(e,r){return `workspace run ${r} --scope project:${e.name}`}function ne(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function oe(e){return [e.name,e.path,E.basename(e.path),e.absolutePath].filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim().toLowerCase())}function ie(e,r,i){let s={generatedAt:e.generatedAt,now:i},a=[p({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...s}),p({id:"workspace.graph.entities",scope:"workspace",args:"workspace graph entities --json",description:"Query proof-backed workspace entities without loading the full graph.",...s}),p({id:"workspace.graph.evidence",scope:"workspace",args:"workspace graph evidence <entity-or-relation> --json",description:"Resolve portable evidence for a graph entity or relation.",...s}),p({id:"workspace.graph.path",scope:"workspace",args:"workspace graph path <from> <to> --json",description:"Find a shortest proof-carrying path between workspace entities.",...s}),p({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...s}),p({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...s}),p({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...s}),p({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...s})],c=r?[r]:e.projects;for(let n of c)n.commands.fleetStages.includes("test")&&a.push(p({id:`project.${n.name}.test`,scope:"project",project:n.name,args:D(n,"test"),description:`Run tests for ${n.name} through workspace orchestration.`,...s})),n.commands.fleetStages.includes("build")&&a.push(p({id:`project.${n.name}.build`,scope:"project",project:n.name,args:D(n,"build"),description:`Build ${n.name} through workspace orchestration.`,...s}));return a}function ce(e){return e.commands.fleetStages.filter(r=>r==="test"||r==="build").map(r=>`workspace run ${r}`)}function de(e,r){if(!r?.startsWith("project:"))return;let i=ne(r);if(i)return e.projects.find(s=>oe(s).includes(i))}function me(e,r,i){let s=[...e.validation?.issues??[]];r?.startsWith("project:")&&!i&&s.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${r}`,target:r});let a=s.filter(n=>n.severity==="error").length,c=s.filter(n=>n.severity==="warning").length;return {status:a>0?"failed":c>0?"warning":"passed",errors:a,warnings:c,issues:s}}async function pe(e,r){let i=[],s=[];for(let[a,c]of Object.entries(e.evidence))c&&await d$1(r,c.path)!==null?i.push(`${a}: ${c.path}`):s.push(a);return {available:i.sort(),missing:s.sort()}}function le(e){let r=e.summary.projectCount,i=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",s=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${r} project${r===1?"":"s"}, ${i}, and ${s}.`}function ge(e){let r=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||r.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&r.push("Some projects are observed rather than first-class; command support may be partial."),r}async function xe(e$1){let r=e$1.model??await n({workspacePath:e$1.workspacePath,includeEvidence:e$1.includeEvidence===true,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),i=ae(e$1.agent),s=de(r,e$1.scope),a=me(r,e$1.scope,s);if(e$1.strict===true&&a.status!=="passed"){let t=a.issues.map(g=>`${g.severity}:${g.code}:${g.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${t}`)}let c=e$1.now??new Date,n$1=r.facts??[],K=new Set((s?[s]:r.projects).map(t=>t.name)),F=n$1.filter(t=>t.project?K.has(t.project):true),H=(s?[s]:r.projects).map(t=>{let g=F.filter(d=>d.project===t.name);return {name:t.name,path:t.path,kind:t.kind,category:t.category,runtime:t.runtime,framework:t.frameworkDisplayName,...t.generator?{generator:t.generator}:{},createCapability:t.createCapability,supportTier:t.supportTier,...t.governance?{governance:t.governance}:{},safeCommands:ce(t),importantFiles:t.importantFiles,facts:g}}),A=await pe(r,e$1.workspacePath),R=E.join(e$1.workspacePath,e.knowledgeGraph),u=await S.pathExists(R)?await S.readJson(R).catch(()=>null):null,$=false;if(u?.schemaVersion===f.knowledgeGraph)try{b(u,r),$=true;}catch{}let M=le(r),I=ie(r,s,c),C=await v(e$1.workspacePath,e.impact,f.impact),l=await v(e$1.workspacePath,e.doctor,f.doctor),b$2=await v(e$1.workspacePath,e.analyze,f.analyze),k=await v(e$1.workspacePath,e.readiness,f.readiness),h=await v(e$1.workspacePath,e.verify,f.verify),w=await v(e$1.workspacePath,e.explain,f.explain),f$2=await v(e$1.workspacePath,e.diff,f.diff),B=C?.summary?{changed:C.summary.changed,risk:C.summary.risk,affectedProjects:C.summary.affectedProjects,blastRadius:C.summary.blastRadius,recommendedCommands:C.summary.recommendedCommands}:void 0,U=l?.summary?{verdict:l.summary.verdict,totalIssues:l.summary.totalIssues,advisoryFindings:l.summary.advisoryFindings,blockingFindings:l.summary.blockingFindings,unknownFindings:l.summary.unknownFindings,hasSystemErrors:l.summary.hasSystemErrors,topSignals:(()=>{let t=Array.isArray(l.projects)?l.projects:[],g=[];for(let d of t.slice(0,6)){let re=Array.isArray(d?.probes)?d.probes:[];for(let y of re.slice(0,10))(y?.status==="fail"||y?.severity==="error")&&g.push({label:y.label,scope:y.scope,issueClass:y.issueClass,status:y.status,severity:y.severity,recommendation:y.recommendation});}return g.slice(0,8)})()}:void 0,J=b$2?.summary?{score:b$2.summary.score,verdict:b$2.summary.verdict,findingCounts:b$2.summary.findings,topFindings:(Array.isArray(b$2.findings)?b$2.findings:[]).filter(d=>d?.severity==="fail"||d?.severity==="warn").slice(0,8).map(d=>({severity:d.severity,title:d.title,target:d.target,remediation:d.remediation}))}:void 0,X=k?{overallStatus:k.overallStatus,blocking:k.blocking,blockingReasons:k.blockingReasons,evidencePath:k.evidencePath,gates:Array.isArray(k.gates)?k.gates.slice(0,6).map(t=>({gate:t.gate,status:t.status,summary:t.summary})):void 0}:void 0,Q=h?.summary?{verdict:h.summary.verdict,exitCode:h.summary.exitCode,stepsFailed:h.summary.stepsFailed,stepsMissing:h.summary.stepsMissing,blockingReasons:h.blockingReasons,missingEvidence:h.missingEvidence}:void 0,Y=w?{summary:w.summary,blockingReasons:w.blockingReasons,releaseVerdict:w.releaseVerdict,evidenceFreshness:w.evidenceFreshness,sections:Array.isArray(w.sections)?w.sections.slice(0,4).map(t=>({id:t.id,title:t.title,body:t.body})):void 0}:void 0,Z=f$2?.summary?{changed:f$2.summary.changed,addedProjects:f$2.summary.addedProjects,removedProjects:f$2.summary.removedProjects,changedProjects:f$2.summary.changedProjects,workspaceChanges:f$2.summary.workspaceChanges,validationChanges:f$2.summary.validationChanges,gitChangedFiles:f$2.summary.gitChangedFiles}:void 0,ee=I.map(t=>f$1({id:`context.command.${t.id}`,label:`${t.id} safe command`,scope:"command",value:{display:t.display,execute:t.execute,scope:t.scope},...t.project?{project:t.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:r.generatedAt,now:c,sourceArtifact:e.agentContext,sourcePath:`safeCommands.${t.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),T=[...F,...ee],x=g({facts:T,generatedAt:c.toISOString(),now:c}),W=b$1();return {schemaVersion:te,generatedAt:c.toISOString(),agent:i,workspaceSummary:M,modelRef:e.model,knowledgeGraph:{artifact:e.knowledgeGraph,schemaVersion:f.knowledgeGraph,available:$,...typeof u?.quality?.entityCount=="number"?{entityCount:u.quality.entityCount}:{},...typeof u?.quality?.relationCount=="number"?{relationCount:u.quality.relationCount}:{},...typeof u?.quality?.proofCount=="number"?{proofCount:u.quality.proofCount}:{},queryCommands:[j("workspace graph search <query> --limit 12 --json"),j("workspace graph entities [kind] --json"),j("workspace graph evidence <entity-or-relation> --json"),j("workspace graph path <from> <to> --json")]},intelligenceChain:{schemaVersion:W.schemaVersion,contractPath:W.contractPath,currentStep:"context",canonicalReadOrder:[...W.consumers.agents.canonicalReadOrder]},workspace:{name:r.workspace.name,root:`workspace:${r.workspace.name}`,type:r.identity.workspaceType,...r.workspace.profile?{profile:r.workspace.profile}:{}},scope:{requested:e$1.scope??"workspace",...s?{activeProject:s.name}:{}},projects:H,safeCommands:I,facts:T,factFreshness:x,evidence:A,policies:{mode:r.policies.mode,source:r.policies.source},contracts:{exists:r.contracts.exists,path:r.contracts.workspaceContractPath},validation:a,agentInstructions:[`Read \`${e.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use `workspace graph search <query> --limit 12 --json` for bounded, proof-backed retrieval before loading the full graph.",`Load \`${e.knowledgeGraph}\` only when a complete graph export is explicitly required.`,"Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx workspai workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[...ge(r),...x.verifyBeforeUseFacts>0?[`${x.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[M,`Evidence available: ${A.available.length}. Missing evidence groups: ${A.missing.join(", ")||"none"}.`,s?`Active project scope: ${s.name} (${s.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
2
- `),impactSummary:B,doctorSummary:U,analyzeSummary:J,readinessSummary:X,verifySummary:Q,explainSummary:Y,diffSummary:Z}}async function We(e,r){return e$1(r,se,d(e))}export{te as a,se as b,xe as c,We as d};
@@ -1 +0,0 @@
1
- import e from'path';import N from'fs-extra';import F from'chalk';async function K(n,o={}){let t=e.resolve(n),{WORKSPACE_CONTRACT_PATH:i,syncWorkspaceContract:c,verifyWorkspaceContract:m,writeWorkspaceContractVerifyEvidence:k}=await import('./workspace-contract-7DXK4GF5.js'),p=await c({workspacePath:t,strict:true}),{syncWorkspaceReadme:f,WORKSPACE_README_PATH:d}=await import('./workspace-readme-G7TZ3V5T.js'),h=await f({workspacePath:t,workspaceName:p.contract.workspace.name,profile:p.contract.workspace.profile??"minimal",projectCount:p.contract.projects.length}),{buildWorkspaceModel:u,writeWorkspaceModel:g}=await import('./workspace-model-ZL6WCICX.js'),a=await u({workspacePath:t,includeEvidence:true}),P=await g(a,t),{buildWorkspaceImpact:W,buildWorkspaceModelSnapshot:C,diffWorkspaceModel:y,writeWorkspaceImpact:A,writeWorkspaceModelDiff:j,writeWorkspaceModelSnapshot:E}=await import('./workspace-intelligence-6FS26JOQ.js'),{WORKSPACE_INTELLIGENCE_ARTIFACTS:s}=await import('./workspace-intelligence-runtime-registry-IW6J53LO.js'),R=e.join(t,s.snapshot),l=false;if(!await N.pathExists(R)){let r=await C({workspacePath:t,model:a});await E(r,t),l=true;}let S=await y({workspacePath:t,fromPath:s.snapshot,model:a}),b=await j(S,t),v=await W({workspacePath:t,fromPath:s.diff}),O=await A(v,t),T=await m({workspacePath:t,strict:true}),_=await k({workspacePath:t,result:T}),{syncWorkspaceAgentGrounding:M}=await import('./workspace-agent-sync-GEN3KBAX.js'),w=await M({workspacePath:t,model:a,write:true,refreshContext:true,strict:false,preset:"enterprise",targets:["all"],projectGrounding:o.projectGrounding??"managed"}),x=[i,(await import('./workspace-registry-summary-LJN4WHIZ.js')).WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,e.relative(t,h).split(e.sep).join("/")||d,e.relative(t,P).split(e.sep).join("/"),s.knowledgeGraph,...l?[s.snapshot]:[],e.relative(t,b).split(e.sep).join("/"),e.relative(t,O).split(e.sep).join("/"),e.relative(t,_).split(e.sep).join("/"),...w.writtenFiles].filter((r,I,G)=>G.indexOf(r)===I);return o.silent||console.log(F.gray(`\u2713 Workspace Intelligence synced \xB7 ${a.summary.projectCount} project(s) \xB7 model + graph + agent grounding`)),{workspacePath:t,projectCount:a.summary.projectCount,baselineCreated:l,writtenFiles:x,warnings:w.projectLenses?.skipped.map(r=>`${r.name}: ${r.reason}`)??[]}}async function D(n,o={}){let t=e.resolve(n),i=o.workspaceName??e.basename(t),{registerWorkspaceStrict:c}=await import('./workspace-HGUZWNAB.js');return await c(t,i),K(t,{silent:o.silent})}export{K as a,D as b};
@@ -1,2 +0,0 @@
1
- import {b as b$1}from'./chunk-D65FCQIO.js';import {v,w}from'./chunk-MOSXTVPU.js';import l from'path';import {randomUUID}from'crypto';import {open}from'fs/promises';import c from'fs-extra';function k(t,e){let n=l.resolve(t),r=e.trim();if(!r||l.isAbsolute(r))throw new Error(`Workspace artifact path must be non-empty and relative: ${e}`);let a=l.resolve(n,r),o=l.relative(n,a);if(o===".."||o.startsWith(`..${l.sep}`)||l.isAbsolute(o))throw new Error(`Workspace artifact path escapes workspace root: ${e}`);return a}function u(t,e){return k(t,v(e))}function N(t,e){return k(t,w(e))}async function S(t,e){let n=l.resolve(t);await c.ensureDir(n);let r=l.dirname(e);await c.ensureDir(r);let[a,o]=await Promise.all([c.realpath(n),c.realpath(r)]),i=l.relative(a,o);if(i===".."||i.startsWith(`..${l.sep}`)||l.isAbsolute(i))throw new Error(`Workspace artifact parent resolves outside workspace root: ${r}`)}async function _(t,e){let n=l.resolve(t),[r,a]=await Promise.all([c.realpath(n),c.realpath(e)]),o=l.relative(r,a);if(o===".."||o.startsWith(`..${l.sep}`)||l.isAbsolute(o))throw new Error(`Workspace artifact resolves outside workspace root: ${e}`)}function F(t){let e=t?.code;return process.platform==="win32"&&(e==="EPERM"||e==="EINVAL"||e==="ENOSYS")}function b(t,e=process.platform){if(e!=="win32")return false;let n=t?.code;return n==="EPERM"||n==="EACCES"||n==="EBUSY"}async function p(t){let e=process.platform==="win32"?6:1,n;for(let r=0;r<e;r+=1)try{await c.remove(t);return}catch(a){if(n=a,!b(a)||r===e-1)throw a;await new Promise(o=>setTimeout(o,10*2**r));}throw n}var m=new Map;async function J(t,e){let n=m.get(t)??Promise.resolve(),r,a=new Promise(i=>{r=i;}),o=n.catch(()=>{}).then(()=>a);m.set(t,o),await n.catch(()=>{});try{return await e()}finally{r(),m.get(t)===o&&m.delete(t);}}async function I(t){try{await t.sync();}catch(e){if(!F(e))throw e}}async function h(t,e,n){await S(t,e);let r=l.dirname(e),a=`${l.basename(e)}.`,o=Date.now();for(let s of await c.readdir(r)){if(!s.startsWith(a)||!s.endsWith(".tmp"))continue;let w=l.join(r,s),f=await c.stat(w).catch(()=>null);f&&o-f.mtimeMs>3e4&&await c.remove(w).catch(()=>{});}let i=`${e}.${process.pid}.${randomUUID()}.tmp`;try{await n(i);let s=await open(i,"r");try{await I(s);}finally{await s.close();}let w=Number(process.env.WORKSPAI_TEST_ATOMIC_WRITE_DELAY_MS??0);Number.isFinite(w)&&w>0&&await new Promise(f=>setTimeout(f,Math.min(w,3e4)));try{await c.rename(i,e);}catch(f){let d=f.code;if(d!=="EEXIST"&&d!=="EPERM")throw f;await c.move(i,e,{overwrite:true});}}finally{await c.remove(i).catch(()=>{});}}async function D(t,e,n,r={}){let a=u(t,e);await S(t,a);let o=`${a}.lock`;return J(o,()=>L(o,e,n,r))}async function L(t,e,n,r){let a=r.timeoutMs??1e4,o=r.staleAfterMs??3e4,i=Date.now(),s;for(;!s;)try{s=await open(t,"wx"),await s.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
2
- `),await I(s);}catch(w){if(!(w.code==="EEXIST"||b(w)))throw s&&(await s.close().catch(()=>{}),s=void 0,await p(t).catch(()=>{})),w;s&&(await s.close().catch(()=>{}),s=void 0,await p(t).catch(()=>{}));let[P,M]=await Promise.all([c.stat(t).catch(()=>null),c.readJson(t).catch(()=>null)]),g=Number(M?.pid),E=Number.isInteger(g)&&g>0,A=false;if(E)try{process.kill(g,0),A=true;}catch(y){A=y.code==="EPERM";}let R=!E&&!!(P&&Date.now()-P.mtimeMs>o);if(E&&!A||R){await p(t).catch(()=>{});continue}if(Date.now()-i>=a)throw new Error(`Timed out waiting for workspace artifact lock: ${e}`);await new Promise(y=>setTimeout(y,20));}try{return await n()}finally{await s.close().catch(()=>{}),await p(t);}}async function K(t,e){let n=[u(t,e),N(t,e)];for(let r of n)if(await c.pathExists(r))return await _(t,r),r;return null}async function X(t,e,n){b$1(e,n);let r=u(t,e);return await h(t,r,a=>c.writeJson(a,n,{spaces:2})),r}async function V(t,e,n){if(n.length===0)return [];let r=n.map(o=>({...o,path:u(t,o.relativePath)})),a=r.find((o,i)=>r.findIndex(s=>s.path===o.path)!==i);if(a)throw new Error(`Duplicate workspace artifact transaction target: ${a.relativePath}`);for(let o of r)b$1(o.relativePath,o.payload);return D(t,e,async()=>{let o=await Promise.all(r.map(async i=>({path:i.path,exists:await c.pathExists(i.path),contents:await c.readFile(i.path).catch(()=>null)})));try{for(let i=0;i<r.length;i+=1){let s=r[i];await h(t,s.path,f=>c.writeJson(f,s.payload,{spaces:2}));let w=Number(process.env.WORKSPAI_TEST_FAIL_ARTIFACT_SET_AFTER??0);if(Number.isInteger(w)&&w===i+1)throw new Error(`Injected artifact-set failure after ${w} write(s).`)}return r.map(i=>i.path)}catch(i){let w=(await Promise.allSettled(o.map(async f=>{if(!f.exists||f.contents===null){await c.remove(f.path);return}await h(t,f.path,d=>c.writeFile(d,f.contents));}))).filter(f=>f.status==="rejected");throw w.length>0?new AggregateError([i,...w.map(f=>f.reason)],"Workspace artifact transaction failed and rollback was incomplete."):i}})}async function q(t,e,n){let r=u(t,e);return await h(t,r,a=>c.writeFile(a,n,"utf-8")),r}export{u as a,N as b,D as c,K as d,X as e,V as f,q as g};