workspai 0.65.0 → 0.66.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 (195) hide show
  1. package/README.md +4 -1
  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 +113 -0
  5. package/contracts/extension-cli-compatibility.v1.json +2 -0
  6. package/contracts/published-contract-catalog.v1.json +10 -0
  7. package/contracts/runtime-command-surface.v1.json +47 -2
  8. package/contracts/workspace-activity-event.v1.json +132 -0
  9. package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
  10. package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
  11. package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
  12. package/contracts/workspace-intelligence/project-context-agent.v1.json +49 -7
  13. package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
  14. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +97 -2
  15. package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
  16. package/dist/analyze-UJQWGNM2.js +1 -0
  17. package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-M2XBS2IU.js} +1 -1
  18. package/dist/autopilot-release-U6F4M2BQ.js +1 -0
  19. package/dist/capabilities-command-XUKPO25Z.js +1 -0
  20. package/dist/chunk-2LIVMG5C.js +2 -0
  21. package/dist/{chunk-XGE2FDI4.js → chunk-2PACEMNE.js} +1 -1
  22. package/dist/chunk-334J2KIP.js +7 -0
  23. package/dist/{chunk-6TBTMWNA.js → chunk-3H5ACWWZ.js} +1 -1
  24. package/dist/{chunk-HCFWT42C.js → chunk-3NM3JAZW.js} +1 -1
  25. package/dist/chunk-4XEH3WNV.js +13 -0
  26. package/dist/chunk-5OA33JH2.js +2 -0
  27. package/dist/chunk-5TY74LLW.js +2 -0
  28. package/dist/{chunk-QCKWQFCD.js → chunk-5U4L6VF2.js} +1 -1
  29. package/dist/{chunk-W6FHVXNL.js → chunk-5XGR3LRI.js} +1 -1
  30. package/dist/{chunk-KTN2ARZJ.js → chunk-6JX56VAL.js} +3 -3
  31. package/dist/chunk-6UNATTB7.js +1 -0
  32. package/dist/{chunk-J3X56S7L.js → chunk-727IQFGN.js} +1 -1
  33. package/dist/chunk-7FF5EOIO.js +2 -0
  34. package/dist/{chunk-D5YJOQYK.js → chunk-AP4PV6WJ.js} +1 -1
  35. package/dist/chunk-AXUA7PFV.js +2 -0
  36. package/dist/chunk-B4IVVTMQ.js +2 -0
  37. package/dist/{chunk-LNXIMF3O.js → chunk-C4S22E6S.js} +1 -1
  38. package/dist/{chunk-PXWKMPPI.js → chunk-D4UHRJAP.js} +1 -1
  39. package/dist/chunk-DUBOKZMA.js +49 -0
  40. package/dist/{chunk-VYDURWN7.js → chunk-ECLMYTWT.js} +1 -1
  41. package/dist/{chunk-2RL6RRT2.js → chunk-EHH4SKVH.js} +50 -50
  42. package/dist/chunk-EP4CUWOO.js +9 -0
  43. package/dist/chunk-FY4X2VOE.js +39 -0
  44. package/dist/chunk-GAYK3WGV.js +2 -0
  45. package/dist/{chunk-YUGKQ44M.js → chunk-H5RJCS5E.js} +1 -1
  46. package/dist/{chunk-YN5X2FTP.js → chunk-H7MRINGP.js} +1 -1
  47. package/dist/chunk-HJLGXFMK.js +1 -0
  48. package/dist/{chunk-VRGEPPUB.js → chunk-HLWDIIWL.js} +1 -1
  49. package/dist/{chunk-HDNATYW7.js → chunk-IIFFEEMX.js} +1 -1
  50. package/dist/chunk-IVF6NEHS.js +1 -0
  51. package/dist/chunk-JC4XSU7G.js +1 -0
  52. package/dist/chunk-JRP6WP5C.js +681 -0
  53. package/dist/chunk-JZJBA2V2.js +1 -0
  54. package/dist/{chunk-N4QQADXX.js → chunk-L5CCIIF2.js} +1 -1
  55. package/dist/chunk-L5Q2S5GY.js +3 -0
  56. package/dist/chunk-LPCZHKD5.js +1 -0
  57. package/dist/chunk-MZ7U4BIQ.js +157 -0
  58. package/dist/chunk-NMXGSVMD.js +1 -0
  59. package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
  60. package/dist/chunk-O37UBRMX.js +4 -0
  61. package/dist/chunk-OI2VOU6S.js +1 -0
  62. package/dist/chunk-PD7Y6HIM.js +2 -0
  63. package/dist/chunk-PJPS7CNH.js +1 -0
  64. package/dist/chunk-QGAPGZPL.js +97 -0
  65. package/dist/chunk-R2M5OJOK.js +5 -0
  66. package/dist/chunk-SX6A656X.js +1 -0
  67. package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
  68. package/dist/chunk-TTHO4MFC.js +2 -0
  69. package/dist/chunk-U5ENEDJA.js +7 -0
  70. package/dist/chunk-UOCERSAN.js +1 -0
  71. package/dist/chunk-UPIPSSXY.js +1 -0
  72. package/dist/chunk-UTV4DTNM.js +1 -0
  73. package/dist/chunk-VA5VSOBL.js +2 -0
  74. package/dist/chunk-VQOWB26M.js +12 -0
  75. package/dist/chunk-VQZ5PI5J.js +1 -0
  76. package/dist/chunk-WTWRSEOW.js +1 -0
  77. package/dist/{chunk-D65FCQIO.js → chunk-XESFJN52.js} +1 -1
  78. package/dist/{chunk-YYQEWAES.js → chunk-XQFWUM2P.js} +1 -1
  79. package/dist/chunk-XWKGZRHN.js +1 -0
  80. package/dist/{chunk-WRQWVSBJ.js → chunk-YX5VWPR5.js} +1 -1
  81. package/dist/chunk-ZQH2I5RQ.js +1 -0
  82. package/dist/{create-ALT2ME6H.js → create-SOLLXXAB.js} +1 -1
  83. package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
  84. package/dist/{doctor-RW4R3O5C.js → doctor-NQ5PUCUP.js} +1 -1
  85. package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
  86. package/dist/{goal-lifecycle-VYOKS6E6.js → goal-lifecycle-IPNY7KNR.js} +1 -1
  87. package/dist/goal-pack-2WV3EA4Y.js +1 -0
  88. package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
  89. package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
  90. package/dist/index.d.ts +8 -2
  91. package/dist/index.js +170 -170
  92. package/dist/live-command-Q6E45N7S.js +18 -0
  93. package/dist/{pipeline-U4N2DVD7.js → pipeline-MIMENSI7.js} +1 -1
  94. package/dist/{project-agent-entry-YAQCHIMP.js → project-agent-entry-OWLJ3IHQ.js} +1 -1
  95. package/dist/project-intelligence-lens-I67EO6AE.js +1 -0
  96. package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-OPDVSFPH.js} +1 -1
  97. package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
  98. package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
  99. package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
  100. package/dist/verified-goal-46JWNCDY.js +1 -0
  101. package/dist/{workspace-HGUZWNAB.js → workspace-KO37XHF6.js} +1 -1
  102. package/dist/{workspace-agent-sync-GEN3KBAX.js → workspace-agent-sync-32FIJQBH.js} +1 -1
  103. package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-6R5DRNZW.js} +1 -1
  104. package/dist/{workspace-context-4WIWFW26.js → workspace-context-JKRPX775.js} +1 -1
  105. package/dist/{workspace-contract-7DXK4GF5.js → workspace-contract-4T3NYNK5.js} +1 -1
  106. package/dist/workspace-explain-MOGL4GEA.js +1 -0
  107. package/dist/workspace-explain-contract-W2E6LF4Q.js +1 -0
  108. package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-6VQ7T4CR.js} +1 -1
  109. package/dist/{workspace-foundation-J3NNRMI3.js → workspace-foundation-GHWO3BZU.js} +1 -1
  110. package/dist/{workspace-graph-stream-PQI7OGCE.js → workspace-graph-stream-PTVS47NJ.js} +1 -1
  111. package/dist/workspace-graph-token-efficiency-Z5JD5NHI.js +1 -0
  112. package/dist/{workspace-history-SYCDK7FO.js → workspace-history-M2K4M2JY.js} +1 -1
  113. package/dist/{workspace-intelligence-6FS26JOQ.js → workspace-intelligence-PJIPTXL3.js} +1 -1
  114. package/dist/{workspace-intelligence-evaluation-CQDKOYZZ.js → workspace-intelligence-evaluation-GONCRE6O.js} +1 -1
  115. package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-M47QR3JM.js} +1 -1
  116. package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-FFGQF4A7.js} +1 -1
  117. package/dist/workspace-knowledge-graph-V2EAYDCL.js +1 -0
  118. package/dist/{workspace-knowledge-graph-contract-L3CLAM2M.js → workspace-knowledge-graph-contract-VANN7RCA.js} +1 -1
  119. package/dist/{workspace-knowledge-graph-query-FZXSPWGK.js → workspace-knowledge-graph-query-RASPF7FS.js} +1 -1
  120. package/dist/workspace-knowledge-graph-snapshot-5YIG6EMG.js +1 -0
  121. package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
  122. package/dist/workspace-mcp-serve-YRORNE4P.js +3 -0
  123. package/dist/workspace-model-VSVKLX7M.js +1 -0
  124. package/dist/{workspace-onboarding-X3PWRIIS.js → workspace-onboarding-2VMJZVLZ.js} +1 -1
  125. package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
  126. package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-6X3GLTBM.js} +2 -2
  127. package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-QVSJKKTX.js} +1 -1
  128. package/dist/workspace-repair-engine-WSKV3Q4V.js +3 -0
  129. package/dist/workspace-run-3BXKTLVL.js +1 -0
  130. package/dist/{workspace-verify-USRRIM2F.js → workspace-verify-EJCSOBIK.js} +1 -1
  131. package/dist/{workspace-watch-43YZPLF7.js → workspace-watch-JTIFBF4Z.js} +1 -1
  132. package/docs/SETUP.md +10 -0
  133. package/docs/agent-entry.md +22 -7
  134. package/docs/ci-workflows.md +1 -1
  135. package/docs/commands-reference.md +41 -7
  136. package/docs/contracts/ARTIFACT_CATALOG.md +63 -44
  137. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
  138. package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
  139. package/docs/contracts/README.md +4 -3
  140. package/docs/real-world-qualification.md +19 -3
  141. package/docs/workspace-knowledge-graph.md +95 -27
  142. package/docs/workspace-live-activity.md +199 -0
  143. package/docs/workspace-operations.md +32 -9
  144. package/package.json +1 -1
  145. package/dist/analyze-5PDVWECJ.js +0 -1
  146. package/dist/autopilot-release-JVIJCTKX.js +0 -1
  147. package/dist/capabilities-command-LHM3XIS6.js +0 -1
  148. package/dist/chunk-2647BYBC.js +0 -1
  149. package/dist/chunk-27UR373Z.js +0 -1
  150. package/dist/chunk-2C5ZBVBI.js +0 -2
  151. package/dist/chunk-6JWNDWOA.js +0 -1
  152. package/dist/chunk-CCDGHPEJ.js +0 -2
  153. package/dist/chunk-DFG33SBR.js +0 -2
  154. package/dist/chunk-FY4IIAIF.js +0 -1
  155. package/dist/chunk-HEZZ72V4.js +0 -94
  156. package/dist/chunk-HN7P4T3B.js +0 -681
  157. package/dist/chunk-ILIBOMYL.js +0 -1
  158. package/dist/chunk-J7QYANXK.js +0 -8
  159. package/dist/chunk-JD3A5QM6.js +0 -2
  160. package/dist/chunk-JQLJBK5N.js +0 -1
  161. package/dist/chunk-KLSSPJTV.js +0 -1
  162. package/dist/chunk-L22EABIC.js +0 -7
  163. package/dist/chunk-MDTI3UEB.js +0 -1
  164. package/dist/chunk-MOSXTVPU.js +0 -1
  165. package/dist/chunk-MYJQGGIU.js +0 -5
  166. package/dist/chunk-NOV6723U.js +0 -1
  167. package/dist/chunk-NYEAMMUL.js +0 -1
  168. package/dist/chunk-NZ3WZYD5.js +0 -1
  169. package/dist/chunk-O5B2L3R2.js +0 -1
  170. package/dist/chunk-OWB5KWSS.js +0 -13
  171. package/dist/chunk-P5PSZQPB.js +0 -2
  172. package/dist/chunk-QI3HG6IG.js +0 -144
  173. package/dist/chunk-SWGSFLTC.js +0 -1
  174. package/dist/chunk-THIOE2PB.js +0 -2
  175. package/dist/chunk-U5FCQTVL.js +0 -4
  176. package/dist/chunk-UXEO5QCF.js +0 -33
  177. package/dist/chunk-VR6XMUF3.js +0 -2
  178. package/dist/chunk-VVJK5NFY.js +0 -2
  179. package/dist/chunk-VXKWWX7S.js +0 -8
  180. package/dist/chunk-W322YDHS.js +0 -49
  181. package/dist/chunk-WPRLXKWC.js +0 -8
  182. package/dist/chunk-Y5YAP4F3.js +0 -2
  183. package/dist/chunk-YOCN7GF4.js +0 -1
  184. package/dist/goal-pack-YWPI43QL.js +0 -1
  185. package/dist/project-intelligence-lens-MRQR2LQW.js +0 -1
  186. package/dist/verified-goal-WM34TTGE.js +0 -1
  187. package/dist/workspace-explain-TE2LGOAV.js +0 -1
  188. package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
  189. package/dist/workspace-graph-token-efficiency-2I4X374C.js +0 -1
  190. package/dist/workspace-knowledge-graph-SWCKDTPF.js +0 -1
  191. package/dist/workspace-knowledge-graph-snapshot-M572JRB4.js +0 -1
  192. package/dist/workspace-mcp-serve-IBMTFQDY.js +0 -3
  193. package/dist/workspace-model-ZL6WCICX.js +0 -1
  194. package/dist/workspace-repair-engine-NX7I632M.js +0 -3
  195. package/dist/workspace-run-6GT5OBQ5.js +0 -1
@@ -0,0 +1,199 @@
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 --refresh-ms 500 --max-runs 10
30
+ workspai live --no-motion --no-color
31
+ workspai live --ascii
32
+ workspai live --accessible
33
+ workspai live --classic
34
+ workspai live --capture workspai-live.svg
35
+ workspai live --capture launch.svg --capture-preset linkedin --capture-theme obsidian
36
+ workspai live --capture internal.svg --no-capture-redact
37
+ workspai live --replay <run-id> --replay-speed 4
38
+ ```
39
+
40
+ `target` defaults to the current directory. `--once` is suitable for scripts,
41
+ diagnostics and tests. Without a TTY, `--json` emits a new snapshot only when
42
+ projected activity changes. `--global` discovers bounded machine-local activity
43
+ channels and produces one fleet view across projects and workspaces; it cannot
44
+ be combined with `target`.
45
+
46
+ `--capture` writes an atomic, deterministic SVG from the same Activity Board
47
+ Model used by the terminal and exits. Captures are redacted by default: local
48
+ scope, project, run and command-argument details are replaced while semantic
49
+ stage and outcome data remain. Presets are `github` (1280×720), `linkedin`
50
+ (1200×627), `x`/`wide` (1600×900) and `square` (1080×1080); themes are
51
+ `obsidian`, `light` and `mono`. Use `--no-capture-redact` only for an explicitly
52
+ internal artifact.
53
+
54
+ `--replay <run-id>` reconstructs the selected run from immutable event prefixes
55
+ instead of inventing UI state. Replay defaults to 4× speed, accepts
56
+ `--replay-speed 0.25..64`, and is scoped to the target project or workspace.
57
+
58
+ ## Flow Board
59
+
60
+ The default TTY renderer is a bounded full-screen Flow Board, not an appended
61
+ log. Each command publishes a versioned execution blueprint containing stable
62
+ block and edge IDs. The board then projects real transitions onto that graph:
63
+
64
+ - a running block uses an active cyan border;
65
+ - successful, warning/blocked and failed blocks become green, yellow and red;
66
+ - a running handoff animates on the edge entering the next block;
67
+ - full-board connections terminate in weight-matched ports on the card frame;
68
+ font-dependent triangle arrowheads are not mixed with box-drawing lines, and
69
+ direction is conveyed by an aligned moving wire segment plus the serpentine
70
+ flow layout;
71
+ - cards reserve their frame for topology and their content row for a stable
72
+ `QUEUE/RUN/DONE/WARN/BLOCK/FAIL` status rail, attempt and progress metadata;
73
+ - a block started again after a terminal outcome is a new durable attempt; its
74
+ card shows `↻2`, `↻3`, and so on, retains earlier attempt outcomes and
75
+ reactivates the incoming flow wire;
76
+ - independent runs may have multiple active blocks at the same time;
77
+ - phase rails are emitted by command blueprints, so grouping reflects command
78
+ architecture rather than a repository-specific UI assumption;
79
+ - terminals at least 132 columns wide receive a factual Inspector for the
80
+ selected active/problem block: state, phase, attempt, progress, elapsed time,
81
+ touches, artifacts and warnings; `i` or `Tab` toggles it;
82
+ - the selected run receives the full flow graph; other running commands are
83
+ reduced to one minimal `ALSO ACTIVE` dock in local mode; global mode uses a
84
+ Fleet Cockpit with location, command, active block, status and elapsed time
85
+ before the selected run graph;
86
+ - journals left running by a process that no longer exists are projected as
87
+ orphaned/cancelled and never inflate the active counter or active-run dock;
88
+ - narrow or short terminals automatically collapse to chips without losing
89
+ status or ordering.
90
+
91
+ The renderer updates changed terminal rows only and uses the alternate screen,
92
+ so monitoring does not produce an unbounded scrollback stream. Resize triggers
93
+ a safe full redraw. Interactive controls are:
94
+
95
+ | Key | Effect |
96
+ | -------------------- | --------------------------------------------- |
97
+ | `↑` / `↓`, `j` / `k` | Select a run |
98
+ | `Enter` | Focus/unfocus the selected run |
99
+ | `i`, `Tab` | Toggle the adaptive Inspector |
100
+ | `f` | Toggle active runs only |
101
+ | `q`, `Ctrl+C` | Close the monitor without cancelling commands |
102
+
103
+ Replay controls are `Space` to play/pause, `←`/`→` (or `,`/`.`) to step one
104
+ durable event backward/forward, and `q` to close. Reaching the last event pauses
105
+ the replay instead of exiting, which keeps the terminal ready for inspection.
106
+
107
+ `NO_COLOR`, `TERM=dumb`, `WORKSPAI_LIVE_ASCII=1` and
108
+ `WORKSPAI_LIVE_REDUCED_MOTION=1` are honored. `--accessible` uses a stable,
109
+ non-animated linear projection with no terminal control sequences for screen
110
+ readers and captured output. `--classic` preserves the compatibility renderer.
111
+
112
+ The implementation intentionally keeps this pipeline renderer-independent:
113
+
114
+ ```text
115
+ workspace-activity-event.v1
116
+ -> deterministic monitor snapshot
117
+ -> Activity Board Model (runs, nodes, edges, selection, counters)
118
+ -> terminal + deterministic SVG adapters today / web and IDE adapters later
119
+ ```
120
+
121
+ No TUI framework is part of the Activity runtime. This prevents React/Yoga or
122
+ terminal-widget lifecycle state from entering the future package boundary and
123
+ keeps browser/IDE renderers able to consume the same Board Model.
124
+
125
+ ## Project and workspace behavior
126
+
127
+ The command works before adoption and does not create metadata in an ordinary
128
+ project. Activity journals are stored in machine-local state:
129
+
130
+ - Linux: `$XDG_STATE_HOME/workspai/activity`, or `~/.local/state/workspai/activity`;
131
+ - macOS: `~/Library/Application Support/Workspai/activity`;
132
+ - Windows: `%LOCALAPPDATA%\Workspai\activity`.
133
+
134
+ `WORKSPAI_ACTIVITY_STATE_DIR` overrides this location. Set
135
+ `WORKSPAI_ACTIVITY_DISABLE=1` to disable journaling.
136
+
137
+ An adopted or linked project keeps its stable physical project channel and
138
+ mirrors the same event/run identities into its workspace channel. This allows a
139
+ monitor opened before `adopt` to keep following the run while a monitor at the
140
+ workspace root receives subsequent linked-project activity.
141
+
142
+ `workspai live --global` scans the bounded local channel registry, deduplicates
143
+ mirrored records by event identity, then groups runs by semantic scope. Every
144
+ run also carries a machine-local origin identity, so two projects in one
145
+ workspace remain distinguishable while sharing one workspace lane, and projects
146
+ from different workspaces retain separate scope labels. The selected run owns
147
+ the full graph; concurrent activity from other origins stays visible in the
148
+ Fleet Cockpit without merging independent timelines.
149
+
150
+ ## Event contract
151
+
152
+ Every NDJSON line conforms to:
153
+
154
+ ```text
155
+ contracts/workspace-activity-event.v1.json
156
+ ```
157
+
158
+ The stream contains run, block, attempt, origin, declared-edge, operation,
159
+ touch, artifact and warning data. Blueprint edges are explicit `sequence`, `parallel`, `gate` or
160
+ `handoff` relations; older journals without declared edges receive a
161
+ deterministic sequential projection for compatibility.
162
+ Stable semantic block IDs describe architecture stages rather than source line
163
+ numbers or function names.
164
+
165
+ Activity is not evidence or authorization:
166
+
167
+ - progress does not prove a result;
168
+ - an exit code does not verify an engineering outcome;
169
+ - a planned touch is not an observed effect;
170
+ - the Activity journal is not the Evidence or Decision Ledger.
171
+
172
+ Canonical domain artifacts and receipts remain owned by Model, Graph, Doctor,
173
+ Security, Decisions and their existing contracts.
174
+
175
+ ## Privacy and retention
176
+
177
+ - sensitive command options and metadata keys are redacted before persistence;
178
+ - absolute paths are converted to project-relative locators when possible;
179
+ - external targets expose only an `<external>/<basename>` locator;
180
+ - environment variables, file contents and raw subprocess output are not stored;
181
+ - the runtime retains at most 200 journals and 14 days per channel by default,
182
+ even when no monitor is open;
183
+ - replay applies bounded per-journal read windows, a 20,000-event scoped ceiling
184
+ and a 50,000-event global ceiling so corrupt or oversized history cannot grow
185
+ monitor memory without limit;
186
+ - state directories and journals are created with user-only permissions where
187
+ the platform supports POSIX modes.
188
+
189
+ ## Current limitations
190
+
191
+ - live transport uses bounded journal polling rather than an IPC broker;
192
+ - the local web/SSE renderer is planned but not implemented;
193
+ - arbitrary shell commands require a future explicit wrapper or SDK for
194
+ semantic block attribution;
195
+ - full filesystem reconciliation and syscall-level deep tracing are not part of
196
+ the default profile.
197
+
198
+ The future package boundary and extraction gates are documented in
199
+ `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.66.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": [
@@ -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};
@@ -1,2 +0,0 @@
1
- import {b as b$1}from'./chunk-B6FJ6RG6.js';import {k,q}from'./chunk-GQSRNUCU.js';import {a}from'./chunk-P5PSZQPB.js';import {c,q as q$1,m as m$1}from'./chunk-J7QYANXK.js';import {e,f as f$1}from'./chunk-X6TNBARH.js';import {b}from'./chunk-UJXE4UAX.js';import {l,s,j as j$1,t,k as k$2}from'./chunk-MOSXTVPU.js';import ce,{promises}from'fs';import c$1 from'path';import T,{homedir}from'os';import {pathToFileURL}from'url';import m from'process';import k$1 from'fs-extra';function z(o){let t=o.label.indexOf(" \u2014 ");return t>=0?o.label.slice(t+3).trim():o.label.trim()}function Q(){let o=c().map(n=>({value:n.id,label:`${K(n.category)} \xB7 ${z(n)}`,hint:`${n.runtime} \xB7 tested baseline`,name:n.label})),e=k().map(n=>({value:n.kitId,label:`Frontend \xB7 ${n.displayName}`,hint:"official \xB7 latest stable",name:`${n.displayName} \u2014 ${n.framework}`})),t=q().map(n=>({value:n.kitId,label:`${K(n.category)} \xB7 ${n.displayName}`,hint:`${n.runtimeCandidates.join(" + ")} \xB7 official latest stable`,name:`${n.displayName} \u2014 ${n.category}`})),i=[...o,...e,...t].sort((n,r)=>{let s=["Backend","Frontend","Desktop","Extension"],a=n.label?.split(" \xB7 ")[0]??"",l=r.label?.split(" \xB7 ")[0]??"";return s.indexOf(a)-s.indexOf(l)||(n.label??"").localeCompare(r.label??"")});return D(i),i}function K(o){return o.charAt(0).toUpperCase()+o.slice(1)}function D(o){let e=new Set,t=new Set;for(let i of o){let n=i.label??i.name??String(i.value),r=String(i.value);if(e.has(n))throw new Error(`Duplicate kit picker label: ${n}`);if(t.has(r))throw new Error(`Duplicate kit picker value: ${r}`);e.add(n),t.add(r);}}var Z=".workspairc.json",ee=".rapidkitrc.json",oe=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"],te=["workspai.config.json","rapidkit.config.json"];function U(o){return typeof o=="object"&&o!==null&&"code"in o&&o.code==="ENOENT"}function R(o,e){let t=e instanceof Error?e.message:String(e),i=o.endsWith(".js")&&/module is not defined in ES module scope/i.test(t)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${o}.${i} Cause: ${t}`}async function Qe(){for(let o of [c$1.join(T.homedir(),Z),c$1.join(T.homedir(),ee)])try{let e$1=await promises.readFile(o,"utf-8"),t=JSON.parse(e$1);return e.debug(`Loaded config from ${o}`),t}catch{}return e.debug("No user config found, using defaults"),{}}async function Xe(o=process.cwd(),e$1={}){let t=o,i=c$1.parse(t).root;for(;t!==i;){for(let n of te){let r=c$1.join(t,n);try{let s=await promises.readFile(r,"utf-8"),a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))throw new Error("configuration root must be a JSON object");return e.debug(`Loaded data-only Workspai config from ${n}`),a}catch(s){if(U(s))continue;throw new Error(R(r,s))}}for(let n of oe){let r=c$1.join(t,n);try{await promises.access(r);}catch(s){if(U(s))continue;throw new Error(R(r,s))}if(e.debug(`Found config file: ${r}`),!e$1.trustExecutableConfig)throw new Error(`Refusing to execute Workspai config at ${r} without explicit trust. Use a data-only workspai.config.json file, pass --trust-config, or set WORKSPAI_TRUST_CONFIG=1.`);try{let a=await import(pathToFileURL(r).href),l=a.default||a;return e.debug(`Loaded Workspai config from ${n}`),l}catch(s){throw new Error(R(r,s))}}t=c$1.dirname(t);}return e.debug("No Workspai config file found, using defaults"),{}}function Ze(o,e,t){return {author:t.author||e.workspace?.defaultAuthor||o.author,pythonVersion:t.pythonVersion||e.workspace?.pythonVersion||o.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||e.workspace?.installMethod||o.defaultInstallMethod,defaultKit:t.defaultKit||e.projects?.defaultKit||o.defaultKit,skipGit:t.skipGit??e.projects?.skipGit??o.skipGit,license:t.license||o.license,testRapidKitPath:t.testRapidKitPath||o.testRapidKitPath}}function eo(o){return f$1("DEV_PATH")||o.testRapidKitPath||void 0}var x=class extends Error{constructor(t,i){super(["Workspai workspaces cannot be nested.",`Target: ${t}`,`Containing workspace: ${i}`,"Choose Managed home or pass --output <path> with a location outside the current workspace."].join(`
2
- `));this.targetPath=t;this.containingWorkspacePath=i;this.name="NestedWorkspaceCreationError";}targetPath;containingWorkspacePath;code="WORKSPACE_NESTING_NOT_SUPPORTED"};async function ie(o){try{return !!await k$1.stat(o)}catch{return false}}function re(o,e){let t=o.indexOf(e);if(t>=0&&t+1<o.length)return o[t+1];let i=o.find(n=>n.startsWith(`${e}=`));if(i)return i.slice(e.length+1)}function se(o){return o.includes("--here")}async function G(o){let e=c$1.resolve(o);for(;;){let t=[c$1.join(e,".workspai-workspace"),c$1.join(e,".rapidkit-workspace"),c$1.join(e,".workspai","workspace.json"),c$1.join(e,".rapidkit","workspace.json")];if((await Promise.all(t.map(ie))).some(Boolean))return e;let i=c$1.dirname(e);if(i===e)return;e=i;}}async function po(o){let e=c$1.resolve(o),t=await G(c$1.dirname(e));if(t)throw new x(e,t)}async function ae(o,e=homedir()){let i=[{value:"managed",label:"Managed home",hint:k$2(e)}];return await G(o)||i.push({value:"here",label:"Current directory",hint:o}),i}function J(o,e=m.cwd()){if(se(o))return c$1.resolve(e);let t=re(o,"--output");if(t)return c$1.resolve(t)}function uo(o,e=m.cwd()){let t=c$1.resolve(o),i=c$1.resolve(e),n=c$1.relative(i,t);return n.length>0&&!n.startsWith("..")&&!c$1.isAbsolute(n)?`cd ${n}`:`cd ${t}`}function mo(o,e={}){let t=e.argv??[],i=e.outputParent??J(t,m.cwd());return l(o.trim(),{homeDir:e.homeDir,outputDir:i})}function fo(o,e,t={}){return o?c$1.resolve(o)===c$1.resolve(e)?true:t.outputParent===void 0:false}async function go(o,e={}){let t=e.cwd??m.cwd(),i=e.homeDir??homedir(),n=J(o,t);if(n!==void 0)return n;let r=e.hasYes??(o.includes("--yes")||o.includes("-y"));if(!(e.interactive??(!r&&!!m.stdin.isTTY&&!b())))return;let a=await ae(t,i);if(a.length===1)return;let{location:l}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:a,default:0}]);if(l==="here")return c$1.resolve(t)}var pe=["minimal","python-only","node-only","go-only","java-only","dotnet-only","polyglot","enterprise"],de=new Set(["minimal","node-only","go-only","java-only","dotnet-only"]),xo=new Set(["python-only","polyglot","enterprise"]);function ue(o){return typeof o=="string"&&pe.includes(o)}function jo(o){return ue(o)&&de.has(o)}var Y={"python-only":"python","node-only":"node","go-only":"go","java-only":"java","dotnet-only":"dotnet"},me={python:"Python",node:"Node",go:"Go",java:"Java",dotnet:".NET",php:"PHP",ruby:"Ruby",rust:"Rust",elixir:"Elixir",clojure:"Clojure",scala:"Scala",kotlin:"Kotlin",deno:"Deno",bun:"Bun",c:"C",cpp:"C++",unknown:"Unknown"},fe={python:"python-only",node:"node-only",go:"go-only",java:"java-only",dotnet:"dotnet-only"},V=["node","deno","bun","python","go","java","kotlin","scala","dotnet","php","ruby","rust","elixir","clojure","c","cpp","unknown"];function j(o){return o==="bun"||o==="deno"?"node":o==="kotlin"||o==="scala"?"java":o}function E(o){return typeof o!="string"||o.trim().length===0?"minimal":o.trim().toLowerCase()}function f(o){if(typeof o!="string")return "unknown";let e=o.trim().toLowerCase();return e==="python"||e==="node"||e==="go"||e==="java"||e==="dotnet"||e==="php"||e==="ruby"||e==="rust"||e==="elixir"||e==="clojure"||e==="scala"||e==="kotlin"||e==="deno"||e==="bun"||e==="c"||e==="cpp"?e:e==="c++"||e==="cplusplus"||e==="cc"||e==="clang++"||e==="g++"?"cpp":e==="clang"||e==="gcc"?"c":"unknown"}function P(o){let e=new Set;for(let t of o)e.add(f(t));return [...e].sort((t,i)=>V.indexOf(t)-V.indexOf(i))}function ge(o){let e=P(o).filter(t=>t!=="unknown");if(e.length!==0)return e.length===1?fe[e[0]]:"polyglot"}function H(o,e={}){return `npx workspai bootstrap --profile ${o}${e.ci?" --ci --json":""}`}function ke(o,e){return o?"none":e==="strict"?"error":"warning"}function g(o){let e=o.ok?void 0:ge(o.runtimes)??"polyglot";return {ok:o.ok,checkId:o.checkId,status:o.ok?"passed":"failed",profile:o.profile,runtimes:o.runtimes,message:o.message,recommendedProfile:e,recommendedCommand:e?H(e):void 0,ciRecommendedCommand:e?H(e,{ci:true}):void 0,severity:ke(o.ok,o.mode)}}function Eo(o){let e=E(o.profile),t=P(o.runtimes),i=o.mode??"warn",n=Y[e];if(n){let r=t.length===0||t.every(s=>j(s)===n);return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:t,message:r?`${e} profile validated for discovered projects.`:`${e} profile mismatch: detected runtimes [${t.join(", ")}].`,mode:i})}if(e==="minimal"){let r=t.filter(l=>l!=="unknown"),a=new Set(r.map(l=>j(l))).size<=1;return g({ok:a,checkId:"profile.minimal",profile:e,runtimes:t,message:a?"minimal profile is compatible with detected runtime mix.":`minimal profile mismatch: multiple runtimes detected [${r.join(", ")}].`,mode:i})}return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:t,message:`${e} profile accepts the detected runtime mix.`,mode:i})}function vo(o){let e=E(o.profile),t=f(o.runtime),i=o.mode??"warn",n=Y[e];if(!n||t==="unknown")return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:[t],message:t==="unknown"?`Project "${o.subjectLabel}" runtime is unknown; profile compatibility will be checked by workspace doctor.`:`${e} profile accepts project "${o.subjectLabel}".`,mode:i});let r=j(t)===n;return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:r?[t]:P([n,t]),message:r?`Project "${o.subjectLabel}" is compatible with workspace profile "${e}".`:`Project "${o.subjectLabel}" is ${me[t]}, but workspace profile is "${e}".`,mode:i})}async function Fo(o){let e=(await Promise.all(s(o,"policies.yml").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "warn";try{return (await k$1.readFile(e,"utf-8")).match(/^\s*mode:\s*(warn|strict)\s*(?:#.*)?$/m)?.[1]==="strict"?"strict":"warn"}catch{return "warn"}}async function Io(o){let e=(await Promise.all(s(o,"workspace.json").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "minimal";try{let t=await k$1.readJson(e);return E(t.profile)}catch{return "minimal"}}async function $o(o,e={}){let t$1=new Set,i=[],n=new Set,r=[o];for(;r.length>0;){let s=r.pop();if(!s||n.has(s))continue;n.add(s);let a=[];try{a=await ce.promises.readdir(s,{withFileTypes:true});}catch{continue}for(let l of a){if(!l.isDirectory()||l.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(l.name))continue;let p=c$1.join(s,l.name);if(p!==o&&j$1(p))continue;if((await Promise.all([...t(p,"context.json"),...t(p,"project.json")].map(async q=>k$1.pathExists(q)))).some(Boolean)){i.push(p);continue}r.push(p);}}for(let s of i){let a=q$1(s);t$1.add(f(m$1(s,a).runtime));}for(let s of await a(o))t$1.add(f(s.runtime));for(let s of e.additionalRuntimes??[])t$1.add(f(s));return P(t$1)}function Ao(o,e={}){let t=e.ci?o.ciRecommendedCommand:o.recommendedCommand;return t?`Recommended: ${t}`:null}export{Q as a,Qe as b,Xe as c,Ze as d,eo as e,po as f,uo as g,mo as h,fo as i,go as j,xo as k,jo as l,Eo as m,vo as n,Fo as o,Io as p,$o as q,Ao as r};
@@ -1 +0,0 @@
1
- import {k,q}from'./chunk-GQSRNUCU.js';import {b as b$2,c as c$2,a as a$4}from'./chunk-SWGSFLTC.js';import {a as a$2}from'./chunk-27UR373Z.js';import {a as a$6}from'./chunk-HTYMXMQM.js';import {a as a$1,p,d,g,f as f$3,e as e$2}from'./chunk-P5PSZQPB.js';import {c,b as b$1,q as q$1,m,G,n,l,k as k$1}from'./chunk-J7QYANXK.js';import {a as a$3}from'./chunk-GR6442P7.js';import {f as f$2,d as d$2,a as a$5,e as e$1}from'./chunk-CCDGHPEJ.js';import {a}from'./chunk-Y5YAP4F3.js';import {d as d$1,c as c$1}from'./chunk-EWZZUQBR.js';import {f,e,i,h}from'./chunk-NZ3WZYD5.js';import {s}from'./chunk-MOSXTVPU.js';import f$1 from'path';import S from'fs-extra';import Rt from'crypto';import {createRequire}from'module';var Et=new Set(c().map(e=>e.id)),Wt=[...k().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.id,runtime:"node",runtimeCandidates:["node"],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.minNodeVersion?{runtimeRequirements:{node:`>=${e.minNodeVersion}`}}:e.minNodeMajor?{runtimeRequirements:{node:`>=${e.minNodeMajor}`}}:{}})),...q().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.framework,runtime:e.runtime,runtimeCandidates:[...e.runtimeCandidates],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.nodeSupport?{runtimeRequirements:{node:e.nodeSupport.requirement}}:{}})),{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"node",runtimeCandidates:["node","php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",plannerFramework:"symfony",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",plannerFramework:"rails",runtime:"ruby",runtimeCandidates:["ruby"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["rails new <name>"],adoptAfterCreate:true}],K=new Map;for(let e of Wt){K.set(e.id,e);for(let t of e.aliases)K.set(t,e);}var xt=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function _(e){return e?.trim().toLowerCase()||void 0}function rt(e){let t=_(e.kitId)??_(e.framework)??_(e.runtime)??"unknown";if(e.projectExists)return {lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let r=e.kitId?b$1(e.kitId):void 0;if(r&&Et.has(r))return {lane:"native",status:"available",canExecuteCreate:true,requested:t,resolved:r,reason:"Workspai owns the create contract, project marker, registry, doctor, and workspace model path."};let s=K.get(t)??K.get(_(e.framework)??"")??K.get(_(e.runtime)??"");if(s)return {lane:"official",status:s.status,canExecuteCreate:s.canExecuteCreate,requested:t,resolved:s.id,officialCommands:s.officialCommands,fallbackLane:s.canExecuteCreate?void 0:"existing",reason:s.status==="available"?"Workspai runs the official ecosystem generator, then registers the project in Workspace Intelligence.":"Official generator support is planned but not enabled; use adopt/import until Workspai owns the post-create contract."};let o=_(e.runtime);return o&&xt.has(o)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:o,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function Er(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var Ar="rapidkit-freshness-metadata-v1";function he(e){if(Array.isArray(e))return e.map(t=>he(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=he(e[r]);return t}return e}function At(e){return JSON.stringify(he(e))}function $(e){return Rt.createHash("sha256").update(At(e)).digest("hex")}var nt=".workspai/workspace-graph.overrides.json",Mt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),It=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),st=600,at=5,Ft=256*1024,ot={inferred:1,contract:2,manual:3};function Dt(e){return e.split(f$1.sep).join("/")}function te(e,t){return Dt(f$1.relative(e,t)||".")}function it(e){let t=new Map;for(let r of e.projects)t.has(r.name)||t.set(r.name,{id:r.name,path:r.path,...r.runtime?{runtime:r.runtime}:{},...r.framework?{framework:r.framework}:{},...r.kind?{kind:r.kind}:{}});return [...t.values()].sort((r,s)=>r.id.localeCompare(s.id))}function ct(e,t){let r=new Map,s=new Map;for(let n of t.projects){if(r.has(n.name))continue;let i=n.absolutePath?f$1.resolve(n.absolutePath):f$1.resolve(e,n.path);r.set(n.name,i),s.has(i)||s.set(i,n.name);}let o=[...s.entries()].map(([n,i])=>({dir:n,id:i})).sort((n,i)=>i.dir.length-n.dir.length||n.dir.localeCompare(i.dir));return {idToDir:r,dirToId:s,sortedDirs:o}}function re(e,t){let r=f$1.resolve(t);for(let{dir:s,id:o}of e.sortedDirs)if(r===s||r.startsWith(`${s}${f$1.sep}`))return o;return null}async function we(e){try{if(!await S.pathExists(e))return null;let t=await S.readJSON(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function be(e){try{return await S.pathExists(e)?await S.readFile(e,"utf8"):null}catch{return null}}async function dt(e,t){let r=[],s=new Map;for(let[o,n]of t.idToDir.entries()){let i=await we(f$1.join(n,"package.json")),a=typeof i?.name=="string"?i.name.trim():"";a&&!s.has(a)&&s.set(a,o);}for(let[o,n]of t.idToDir.entries()){let i=await we(f$1.join(n,"package.json"));if(i){let a=["dependencies","devDependencies","peerDependencies","optionalDependencies"],c=new Set;for(let d of a){let u=i[d];if(!(!u||typeof u!="object"||Array.isArray(u)))for(let p of Object.keys(u)){let l=s.get(p);!l||l===o||c.has(l)||(c.add(l),r.push({from:o,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:te(e,f$1.join(n,"package.json")),detail:`declares dependency ${p}`}]}));}}}r.push(...await Ot(e,t,o,n)),r.push(...await Gt(e,t,o,n));}return r}async function Ot(e,t,r,s){let o=await be(f$1.join(s,"pyproject.toml"));if(!o)return [];let n=[],i=new Set,a=/path\s*=\s*["']([^"']+)["']/g,c;for(;(c=a.exec(o))!==null;){let d=re(t,f$1.resolve(s,c[1]));!d||d===r||i.has(d)||(i.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:te(e,f$1.join(s,"pyproject.toml")),detail:`path dependency ${c[1]}`}]}));}return n}async function Gt(e,t,r,s){let o=await be(f$1.join(s,"go.mod"));if(!o)return [];let n=[],i=new Set,a=/replace\s+\S+\s+=>\s+(\.[^\s]+)/g,c;for(;(c=a.exec(o))!==null;){let d=re(t,f$1.resolve(s,c[1]));!d||d===r||i.has(d)||(i.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:te(e,f$1.join(s,"go.mod")),detail:`go.mod replace ${c[1]}`}]}));}return n}async function _t(e,t){let r=[],s=[e];for(;s.length>0&&r.length<t;){let o=s.shift();if(!o)continue;let n=[];try{n=await S.readdir(o,{withFileTypes:true});}catch{continue}let i=[],a=[];for(let c of n)if(c.isDirectory()){if(It.has(c.name)||a$3(c.name)||c.name.startsWith("."))continue;i.push(f$1.join(o,c.name));}else c.isFile()&&Mt.has(f$1.extname(c.name))&&a.push(f$1.join(o,c.name));a.sort((c,d)=>c.localeCompare(d)),i.sort((c,d)=>c.localeCompare(d));for(let c of a){if(r.length>=t)break;r.push(c);}s.push(...i);}return r}var Tt=[/\bfrom\s+["']([^"']+)["']/g,/\bimport\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g];function Nt(e){let t=new Set;for(let r of Tt){r.lastIndex=0;let s;for(;(s=r.exec(e))!==null;){let o=s[1];o.startsWith(".")&&t.add(o);}}return [...t]}async function ve(e,t,r,s){let o=new Map;for(let[n,i]of t.idToDir.entries()){if(s&&!s.has(n))continue;let a=await _t(i,r);for(let c of a){let d=await S.stat(c).catch(()=>null);if(!d||d.size>Ft)continue;let u=await be(c);if(u)for(let p of Nt(u)){let l=f$1.resolve(f$1.dirname(c),p),m=re(t,l);if(!m||m===n)continue;let w=`${n}\0${m}`,h=o.get(w);h||(h={from:n,to:m,evidence:[]},o.set(w,h)),h.evidence.length<at&&h.evidence.push({file:te(e,c),detail:`imports ${p}`});}}}return [...o.values()].map(n=>({from:n.from,to:n.to,kind:"code-import",source:"inferred",confidence:"medium",evidence:n.evidence}))}function $t(e,t,r){let s=new Map;for(let o of r.projects){let n=Vt(e,t,o);n&&s.set(o.slug,n);}return s}function Vt(e,t,r){let s=[r.relativePath,r.externalPath].filter(o=>typeof o=="string"&&o.length>0);for(let o of s){let n=f$1.resolve(e,o),i=t.dirToId.get(n)??re(t,n);if(i)return i}return t.idToDir.has(r.slug)?r.slug:null}function pt(e,t,r){let s=[],o=$t(e,t,r),n=g,i=new Map,a=new Map;for(let c of r.projects){let d=o.get(c.slug);if(!d)continue;let u=c.contracts??{publishes:[],consumes:[],dependsOn:[]};for(let p of u.dependsOn??[]){let l=o.get(p);!l||l===d||s.push({from:d,to:l,kind:"service-dependsOn",source:"contract",confidence:"high",evidence:[{file:n,detail:`dependsOn ${p}`}]});}for(let p of u.publishes??[])i.has(p)||i.set(p,new Set),i.get(p)?.add(d);for(let p of u.consumes??[])a.has(p)||a.set(p,new Set),a.get(p)?.add(d);}for(let[c,d]of i.entries()){let u=a.get(c);if(u)for(let p of u)for(let l of d)p!==l&&s.push({from:p,to:l,kind:"event-pub-sub",source:"contract",confidence:"high",evidence:[{file:n,detail:`consumes event ${c}`}]});}return s.push(...Ht(r,o)),s}function ke(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function Ht(e,t){let r=[],s=e.projects.map(o=>({project:o,id:t.get(o.slug)})).filter(o=>!!o.id).filter(o=>ke(o.project.slug).length>=3);for(let o of e.projects){let n=t.get(o.slug);if(!n)continue;let i=o.contracts?.env??[];if(i.length===0)continue;let a=new Set;for(let c of i){let d=ke(c);for(let u of s)u.id===n||a.has(u.id)||!(d.includes(ke(u.project.slug))&&(u.project.ports?.length??0)>0)||(a.add(u.id),r.push({from:n,to:u.id,kind:"shared-resource",source:"inferred",confidence:"low",evidence:[{file:g,detail:`env ${c} references ${u.project.slug}`}]}));}}return r}async function lt(e,t){let r=await we(f$1.join(e,nt)),s=Array.isArray(r?.edges)?r?.edges:[],o=[],n=new Set(f$3);for(let i of s){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i,c=typeof a.from=="string"?a.from:"",d=typeof a.to=="string"?a.to:"",u=typeof a.kind=="string"?a.kind:"";if(!t.has(c)||!t.has(d)||c===d||!n.has(u))continue;let p=Array.isArray(a.evidence)?a.evidence.map(l=>l&&typeof l=="object"&&typeof l.file=="string"?{file:l.file,...typeof l.detail=="string"?{detail:l.detail}:{}}:null).filter(l=>!!l):[];o.push({from:c,to:d,kind:u,source:"manual",confidence:"high",evidence:p.length>0?p:[{file:nt,detail:"manual edge"}]});}return o}function Bt(e){return `${e.from}\0${e.to}\0${e.kind}`}function Kt(e){let t=new Set,r=[];for(let s of e){let o=`${s.file}\0${s.detail??""}`;t.has(o)||(t.add(o),r.push(s));}return r.sort((s,o)=>s.file.localeCompare(o.file)||(s.detail??"").localeCompare(o.detail??"")).slice(0,at)}function Lt(e){let t=new Map;for(let r of e){let s=Bt(r),o=t.get(s);if(!o){t.set(s,{...r,evidence:[...r.evidence]});continue}let n=ot[o.source],i=ot[r.source];i>n?t.set(s,{...r,evidence:[...r.evidence,...o.evidence]}):i===n&&o.evidence.push(...r.evidence);}return [...t.values()].map(r=>({from:r.from,to:r.to,kind:r.kind,source:r.source,confidence:r.confidence,evidence:Kt(r.evidence)})).sort((r,s)=>r.from.localeCompare(s.from)||r.to.localeCompare(s.to)||r.kind.localeCompare(s.kind)||r.source.localeCompare(s.source))}function ye(e){return Math.round(e*1e3)/1e3}function Ut(e){return Math.max(0,Math.min(100,Math.round(e)))}function zt(e){return e>=75?"critical":e>=50?"high":e>=20?"medium":"low"}function qt(e){return e==="critical"||e==="high"?"strict":e==="medium"?"elevated":"normal"}function Jt(e,t){let r=a$6({nodes:e,edges:t}),s=new Map;for(let o of e){let n=r.byId.get(o.id)??{fanIn:0,fanOut:0,reach:0,betweenness:0,isHotspot:false},i=t.filter(m=>m.from===o.id||m.to===o.id),a=i.filter(m=>m.source==="contract"||m.source==="manual").length,c=i.filter(m=>m.confidence==="low").length,d=[],u=n.reach*20+n.fanIn*14+n.fanOut*8+Math.min(20,n.betweenness*4)+a*8;n.isHotspot&&(u+=24,d.push("Critical-path hotspot in dependency graph")),n.reach>0&&d.push(`Change reaches ${n.reach} dependent project(s)`),n.fanIn>0&&d.push(`${n.fanIn} direct dependent project(s)`),n.fanOut>0&&d.push(`${n.fanOut} direct dependency project(s)`),a>0&&d.push(`${a} contract/manual edge(s)`),c>0&&d.push(`${c} low-confidence inferred edge(s) need review`),i.length===0&&d.push(e.length===1?"Single-project workspace; inter-project dependency edges are not applicable":"No dependency evidence connected to this project yet");let p=Ut(u),l=zt(p);s.set(o.id,{weight:l,score:p,verificationPriority:qt(l),reasons:d.slice(0,5),centrality:{fanIn:n.fanIn,fanOut:n.fanOut,reach:n.reach,betweenness:n.betweenness,isHotspot:n.isHotspot}});}return s}function Xt(e,t){let r=Jt(e,t);return e.map(s=>({...s,operationalProfile:r.get(s.id)}))}function Yt(e,t){let r=new Set;for(let c of t)r.add(c.from),r.add(c.to);let s=e.length,o=t.length,n=e.filter(c=>r.has(c.id)).length,i=Math.max(0,s-n),a=a$6({nodes:e,edges:t});return {nodeCount:s,edgeCount:o,inferredEdges:t.filter(c=>c.source==="inferred").length,contractEdges:t.filter(c=>c.source==="contract").length,manualEdges:t.filter(c=>c.source==="manual").length,authoritativeEdges:t.filter(c=>c.source==="contract"||c.source==="manual").length,lowConfidenceEdges:t.filter(c=>c.confidence==="low").length,orphanCount:i,connectedNodeCount:n,density:ye(s>1?o/(s*(s-1)):0),edgeCoverageRatio:ye(s>0?n/s:1),evidenceCoverageRatio:ye(o>0?t.filter(c=>c.evidence.length>0).length/o:1),hotspotCount:a.hotspots.length,hasCycle:Zt(e,t)}}function Qt(e,t,r){let s=[],o=e.filter(n=>!t.some(i=>i.from===n.id||i.to===n.id)).map(n=>n.id).sort((n,i)=>n.localeCompare(i));return r.nodeCount===0&&s.push({code:"graph.empty",severity:"info",message:"Workspace model has no projects, so dependency reasoning is unavailable.",recommendation:"Import, scaffold, or register projects before relying on graph-aware impact."}),r.nodeCount>1&&r.edgeCount===0?s.push({code:"graph.edges.missing",severity:"warning",message:"Projects were detected, but no inter-project dependency edges were found.",recommendation:"Run graph explain, add workspace contract relationships, or define manual graph overrides for operational dependencies that code imports cannot reveal.",nodeIds:o}):r.nodeCount>1&&r.orphanCount>0&&s.push({code:"graph.orphans.detected",severity:"warning",message:`${r.orphanCount} project(s) have no dependency evidence connected to the graph.`,recommendation:"Review isolated projects and add package, contract, or manual edges when they participate in release-critical flows.",nodeIds:o.slice(0,12)}),r.lowConfidenceEdges>0&&s.push({code:"graph.low_confidence_edges",severity:"info",message:`${r.lowConfidenceEdges} inferred edge(s) are low confidence.`,recommendation:"Promote important low-confidence relationships to workspace contract or manual overrides."}),r.edgeCount>0&&r.evidenceCoverageRatio<1&&s.push({code:"graph.evidence.partial",severity:"warning",message:"Some dependency edges do not include file-level evidence.",recommendation:"Attach evidence to manual overrides so agents can audit why a relationship exists."}),r.hasCycle&&s.push({code:"graph.cycle.detected",severity:"error",message:"The dependency graph contains at least one directed cycle.",recommendation:"Break the cycle or document the relationship explicitly before using graph-aware release gates."}),s.sort((n,i)=>{let a={error:0,warning:1,info:2};return a[n.severity]-a[i.severity]||n.code.localeCompare(i.code)})}function Zt(e,t){let r=new Map;for(let c of e)r.set(c.id,[]);for(let c of t)r.has(c.from)||r.set(c.from,[]),r.get(c.from)?.push(c.to);let s=0,o=1,n=2,i=new Map;for(let c of r.keys())i.set(c,s);let a=c=>{let d=[{id:c,index:0}];for(i.set(c,o);d.length>0;){let u=d[d.length-1],p=r.get(u.id)??[];if(u.index>=p.length){i.set(u.id,n),d.pop();continue}let l=p[u.index];u.index+=1;let m=i.get(l)??s;if(m===o)return true;m===s&&(i.set(l,o),d.push({id:l,index:0}));}return false};for(let c of [...r.keys()].sort())if(i.get(c)===s&&a(c))return true;return false}function ut(e,t,r,s){let o=Lt(r.filter(c=>t.has(c.from)&&t.has(c.to))),n=Xt(e,o),i=Yt(e,o),a=Qt(e,o,i);return {schemaVersion:e$2,generatedAt:(s??new Date).toISOString(),nodes:n,edges:o,stats:i,...a.length>0?{diagnostics:a}:{}}}async function mt(e){let t=f$1.resolve(e.workspacePath),r=e.maxImportFilesPerProject??st,s=it(e.model),o=new Set(s.map(a=>a.id)),n=ct(t,e.model),i=[];return i.push(...await dt(t,n)),i.push(...await ve(t,n,r)),e.contract&&i.push(...pt(t,n,e.contract)),i.push(...await lt(t,o)),ut(s,o,i,e.now)}async function ft(e){let t=f$1.resolve(e.workspacePath),r=e.maxImportFilesPerProject??st,s=it(e.model),o=new Set(s.map(a=>a.id)),n=ct(t,e.model),i=[];if(i.push(...await dt(t,n)),e.structuralChange)i.push(...await ve(t,n,r));else {i.push(...await ve(t,n,r,e.changedProjectIds));for(let a of e.previousGraph.edges)a.kind==="code-import"&&a.source==="inferred"&&!e.changedProjectIds.has(a.from)&&o.has(a.from)&&o.has(a.to)&&i.push({from:a.from,to:a.to,kind:"code-import",source:"inferred",confidence:a.confidence,evidence:a.evidence});}return e.contract&&i.push(...pt(t,n,e.contract)),i.push(...await lt(t,o)),ut(s,o,i,e.now)}var ne="workspace-model-producer.v3";var Pe=h.workspaceModelCache.schemaVersion,je=i.workspaceModelCache,gt=["package.json","pyproject.toml","requirements.txt","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","workspai.project.json",".workspai/project.json",".workspai/context.json","rapidkit.project.json",".rapidkit/project.json",".rapidkit/context.json"],ht=[i.workspaceContract,".workspai/workspace.json","workspai.workspace.json",".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],rr=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),nr=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),or=1500,L=null;function Ce(){if(L)return L;try{L=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{L="0.0.0";}return L}async function oe(e){try{let t=await S.readFile(e);return Rt.createHash("sha256").update(t).digest("hex")}catch{return null}}async function sr(e){let t={};for(let o of gt){let n=await oe(f$1.join(e,o));n&&(t[o]=n);}let r=[],s=[e];for(;s.length>0&&r.length<or;){let o=s.shift();if(!o)continue;let n=[];try{n=await S.readdir(o,{withFileTypes:true});}catch{continue}let i=[];for(let a of n)if(a.isDirectory()){if(nr.has(a.name)||a$3(a.name)||a.name.startsWith("."))continue;i.push(f$1.join(o,a.name));}else if(a.isFile()&&rr.has(f$1.extname(a.name))){let c=f$1.join(o,a.name),d=await S.stat(c).catch(()=>null);if(d){let u=f$1.relative(e,c).split(f$1.sep).join("/");r.push(`${u}:${d.size}:${Math.round(d.mtimeMs)}`);}}i.sort((a,c)=>a.localeCompare(c)),s.push(...i);}return r.sort((o,n)=>o.localeCompare(n)),$({manifests:t,source:r})}async function se(e,t){let r=f$1.resolve(e),s={},o=[...new Set(t.map(n=>f$1.relative(r,f$1.resolve(n)).split(f$1.sep).join("/")))].sort((n,i)=>n.localeCompare(i));for(let n of o)s[n]=await sr(f$1.join(r,n));return s}async function ae(e){let t=f$1.resolve(e),r={};for(let s of ht){let o=await oe(f$1.join(t,s));o&&(r[s]=o);}return r}async function ie(e){let t=f$1.resolve(e.workspacePath),r=[...new Set(e.projectPaths.map(n=>f$1.relative(t,f$1.resolve(n)).split(f$1.sep).join("/")))].sort((n,i)=>n.localeCompare(i)),s=[];for(let n of r){let i={};for(let a of gt){let c=await oe(f$1.join(t,n,a));c&&(i[a]=c);}s.push({project:n,manifests:i});}let o={};for(let n of ht){let i=await oe(f$1.join(t,n));i&&(o[n]=i);}return $({cacheSchema:Pe,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:s,workspaceFiles:o})}async function Se(e){let t=await d$2(e,je)??a$5(e,je);try{if(!await S.pathExists(t))return null;let r=await S.readJson(t);return !r||r.schemaVersion!==Pe||r.producerRevision!==ne||typeof r.inputsHash!="string"||typeof r.cliVersion!="string"||!r.model?null:r}catch{return null}}async function ce(e,t){let r={schemaVersion:Pe,producerRevision:ne,...t};return e$1(e,je,r)}var kt="rapidkit-fact-freshness-v1",z={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function ar(e){switch(e){case "durable":return z.durable;case "derived":return z.derived;case "evidence-backed":return z.evidenceBacked;case "live":return z.live;case "verify-before-use":return z.verifyBeforeUse}}function ir(e){if(e.status)return e.status;if(e.ttlSeconds===null)return "unknown";let t=Date.parse(e.generatedAt);if(!Number.isFinite(t))return "unknown";let r=t+e.ttlSeconds*1e3;return e.now.getTime()>r?"stale":"fresh"}function cr(e){let t=e.now??new Date,r=e.generatedAt??t.toISOString(),s=Date.parse(r),o=Number.isFinite(s),n=o?r:t.toISOString(),i=e.ttlSeconds===void 0?ar(e.kind):e.ttlSeconds,a=ir({generatedAt:n,ttlSeconds:i,status:e.status??(o?void 0:"unknown"),now:t}),c=Date.parse(n),d=i===null||!Number.isFinite(c)?void 0:new Date(c+i*1e3),u=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||a!=="fresh");return {schemaVersion:kt,kind:e.kind,category:e.category,generatedAt:n,ttlSeconds:i,...d?{expiresAt:d.toISOString()}:{},status:a,verifyBeforeUse:u,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??$(e.value??null),reason:e.reason}}function b(e){return {id:e.id,label:e.label,scope:e.scope,value:e.value,...e.project?{project:e.project}:{},freshness:cr({...e.freshness,value:e.value})}}function yt(e){let t=e.generatedAt??(e.now??new Date).toISOString(),r={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},s={structure:0,verification:0,state:0},o=0,n=0,i=0,a=0;for(let c of e.facts)r[c.freshness.kind]+=1,s[c.freshness.category]+=1,c.freshness.status==="stale"&&(o+=1),c.freshness.status==="unknown"&&(n+=1),c.freshness.kind==="live"&&(i+=1),c.freshness.verifyBeforeUse&&(a+=1);return {schemaVersion:kt,generatedAt:t,status:o>0?"stale":n>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:o,unknownFacts:n,liveFacts:i,verifyBeforeUseFacts:a,byKind:r,byCategory:s}}var dr=f.model,de=e.model;function Ee(e){return e.projectTopology??e.graph}function vt(e){return !!(e.projectTopology&&e.graph&&c$1(e.projectTopology)===c$1(e.graph))}function xn(e){let t=e.engineStatus==="hit"||e.engineStatus==="unchanged"?"reused":e.engineStatus==="incremental"?"partially-reused":"rebuilt";return {schemaVersion:"workspace-model-build.v1",mode:e.mode,outcome:t,engineStatus:e.engineStatus}}var pr=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","bunfig.toml",".bunfig.toml","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","terraform.tf"],lr=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function bt(e,t){return (f$1.relative(e,t)||".").split(f$1.sep).join("/")}async function jt(e){try{if(!await S.pathExists(e))return null;let t=await S.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function ur(e,t){for(let r of t)if(await S.pathExists(f$1.join(e,r)))return true;return false}function We(e){let t=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),r=typeof e=="number"&&Number.isFinite(e)?e:Number.isFinite(t)?t:4;return Math.min(12,Math.max(1,Math.trunc(r)))}async function xe(e,t){let r=f$1.resolve(e),s=[{dirPath:r,depth:0}],o=new Set,n=new Set;for(;s.length>0;){let i=s.shift();if(!i)continue;let a=f$1.resolve(i.dirPath);if(n.has(a))continue;if(n.add(a),a!==r&&await ur(a,pr)){o.add(a);continue}if(i.depth>=t)continue;let c=[];try{c=await S.readdir(a,{withFileTypes:true});}catch{continue}for(let d of c)!d.isDirectory()||lr.has(d.name)||a$3(d.name)||d.name.startsWith(".")&&d.name!==".config"||s.push({dirPath:f$1.join(a,d.name),depth:i.depth+1});}return Array.from(o).sort((i,a)=>i.localeCompare(a))}function Re(e){let t=new Set,r=[];for(let s of e){let o=f$1.resolve(s);t.has(o)||(t.add(o),r.push(o));}return r.sort((s,o)=>s.localeCompare(o))}function wt(e,t){let r=e?.[t];return typeof r=="string"&&r.trim()?r.trim():void 0}function mr(e,t){return e?.[t]===true}function fr(e,t,r){let s=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,o=wt(s,"generator"),n=wt(s,"command_display"),i=typeof t=="string"&&t.startsWith("frontend.");if(!(!o&&!i))return {...o?{id:o}:{},...t?{kit:t}:{},displayName:r,source:mr(s,"official_generator")?"official-generator":"metadata",...n?{commandDisplay:n}:{}}}async function gr(e){let t=[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json","package.json","product.json","tsconfig.json","pnpm-workspace.yaml","bunfig.toml",".bunfig.toml","nx.json","turbo.json","pyproject.toml","requirements.txt","go.mod","go.work","go.work.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","rust-toolchain.toml","rust-toolchain","CMakeLists.txt","meson.build","Makefile","WORKSPACE","WORKSPACE.bazel","MODULE.bazel","BUILD","BUILD.bazel",".bazelrc","composer.json","Gemfile","mix.exs","deno.json","setup.py","setup.cfg","Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","README.md"],r=[];for(let o of t)await S.pathExists(f$1.join(e,o))&&r.push(o);let s=new Set(["package.json","pyproject.toml","go.mod","go.work","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","CMakeLists.txt","meson.build","composer.json","Gemfile","mix.exs","deno.json"]);if(!r.some(o=>s.has(o))){let o=[],n=new Set([".git",".workspai",".rapidkit",".venv","build","dist","node_modules","target","third_party","vendor"]),i=(p,l)=>{let m=p.toLowerCase();return ["package.json","pyproject.toml","go.mod","pom.xml","build.gradle","build.gradle.kts","cargo.toml","cmakelists.txt","meson.build","composer.json","gemfile","mix.exs","deno.json"].includes(m)||m.endsWith(".gemspec")||m==="description"&&l.toLowerCase()==="r"},a=async(p,l)=>{if(l>3||o.length>=512)return;let m=await S.readdir(p,{withFileTypes:true}).catch(()=>[]);for(let w of m.sort((h,E)=>h.name.localeCompare(E.name))){if(o.length>=512)return;w.isFile()&&i(w.name,f$1.basename(p))?o.push(f$1.relative(e,f$1.join(p,w.name)).split(f$1.sep).join("/")):w.isDirectory()&&!n.has(w.name)&&await a(f$1.join(p,w.name),l+1);}};await a(e,0);let c=new Map;for(let p of o){let l=p.split("/")[0],m=c.get(l)??[];m.push(p),c.set(l,m);}for(let p of c.values())p.sort((l,m)=>l.split("/").length-m.split("/").length||l.localeCompare(m));let d=[],u=[...c.keys()].sort();for(let p=0;d.length<16&&u.some(l=>p<(c.get(l)?.length??0));p+=1)for(let l of u){let m=c.get(l)?.[p];m&&d.length<16&&d.push(m);}r.push(...d.filter(p=>!r.includes(p)));}return r}async function x(e,t,r,s=t){let o=await d$2(e,t),n=o!==null,i={path:s.split(f$1.sep).join("/"),exists:n};if(o&&r){let a=await jt(o);typeof a?.generatedAt=="string"&&(i.generatedAt=a.generatedAt);let c=a?.status??a?.result??a?.verdict;typeof c=="string"&&(i.status=c);}return i}async function hr(e,t,r){let s=bt(e,t),o=".workspai/reports",n=c=>x(t,`${o}/${c}`,r,`${s}/${o}/${c}`),i=await n("doctor-project-last-run.json");return {doctor:i?.exists===true?i:await n("doctor-last-run.json"),remediationPlan:await n("doctor-remediation-plan-last-run.json"),fixResult:await n("doctor-fix-result-last-run.json"),analyze:await n("analyze-last-run.json"),readiness:await n("release-readiness-last-run.json")}}async function kr(e,t,r){let s=q$1(t),o=m(t,s),n$1=G(t),i=n(o.runtime),a=await b$2(t,s,{runtime:o.runtime,framework:o.key}),c=r.contractProject?.slug?r.contractProject.slug:typeof s?.name=="string"&&s.name.trim()?s.name.trim():f$1.basename(t),d=typeof s?.kit_name=="string"?s.kit_name:typeof s?.kit=="string"?s.kit:r.contractProject?.kit,u=typeof s?.engine=="string"?s.engine:n$1.engine!=="unknown"?n$1.engine:void 0,p=fr(s,d,o.displayName),l$1=rt({kitId:d,framework:o.key,runtime:o.runtime}),m$1=f$1.relative(e,t),h=m$1===".."||m$1.startsWith(`..${f$1.sep}`)?l(t):k$1(t),E=[o.runtime,...h.filter(A=>A!==o.runtime)],R=await c$2({projectPath:t,declaration:r.contractProject?.governance});return {name:c,path:bt(e,t),...r.includeAbsolutePaths?{absolutePath:t}:{},kind:a,category:a$4(a),runtime:o.runtime,runtimeCandidates:E,framework:o.key,frameworkDisplayName:o.displayName,confidence:o.confidence,detectionSource:o.source,supportTier:o.supportTier,runtimeSupportTier:i.tier,runtimeDoctorSupport:i.doctorSupport,moduleSupport:n$1.moduleSupport,...d?{kit:d}:{},...u?{engine:u}:{},...p?{generator:p}:{},createCapability:l$1,commands:{supported:n$1.supportedCommands,unsupported:n$1.unsupportedCommands,global:n$1.globalCommands,fleetStages:n$1.fleetStages,localOnly:n$1.localOnlyCommands,map:n$1.commandMap},importantFiles:await gr(t),governance:R,evidence:await hr(e,t,r.includeEvidence),provenance:{path:r.contractProject?"workspace contract declaration reconciled with filesystem discovery":"filesystem discovery",runtime:o.source,framework:o.source,commands:"project command capability matrix",createCapability:"create planner capability contract",governance:r.contractProject?.governance!==void 0?"workspace contract declaration reconciled with repository evidence":"repository and documented external governance discovery",evidence:"project .workspai/reports"}}}async function Ae(e){for(let t of s(e,"workspace.json")){let r=await jt(t);if(r)return r}return null}function yr(e){if(e.length===0)return "empty-workspace";let t=new Set(e.map(r=>r.category));return t.size>1?"polyglot-product-workspace":t.has("frontend")&&e.length>1?"full-stack-workspace":t.has("frontend")?"frontend-workspace":t.has("desktop")?"desktop-application-workspace":t.has("extension")?"extension-workspace":t.has("platform")?"platform-workspace":t.has("library")?"library-workspace":e.length>1?"backend-platform":"backend-workspace"}function wr(e){let t=new Set;for(let r of e){let s=`${r.name} ${r.path}`.toLowerCase();for(let o of ["auth","billing","payment","notification","order","admin","report","search","analytics"])s.includes(o)&&t.add(o);}return Array.from(t).sort()}function P(e,t,r,s){return {severity:e,code:t,message:r,target:s}}function Pt(e){let t=[];e.workspace.name.trim()||t.push(P("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(P("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(P("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(P("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",e.contracts.workspaceContractPath));let r=new Map;for(let n of e.projects){let i=n.name.toLowerCase(),a=r.get(i)??[];a.push(n),r.set(i,a),n.importantFiles.length||t.push(P("warning","project.markers.missing",`Project ${n.name} has no important manifest files recorded.`,n.path));let c=f$1.isAbsolute(n.path)?n.path:f$1.resolve(e.workspace.root,n.path);S.existsSync(c)||t.push(P("warning","project.path.missing",`Registered project ${n.name} is not available at its declared path.`,n.path)),n.runtime==="unknown"&&t.push(P("warning","project.runtime.unknown",`Project ${n.name} runtime could not be confidently detected.`,n.path));let d=["test","build"];for(let l of d)n.commands.supported.includes(l)&&n.commands.unsupported.includes(l)&&t.push(P("error","project.commands.conflict",`Project ${n.name} marks ${l} as both supported and unsupported.`,n.path));let u=new Set(n.commands.fleetStages),p=new Set(n.commands.localOnly);for(let l of n.commands.fleetStages){p.has(l)&&t.push(P("error","project.commands.scope-conflict",`Project ${n.name} marks ${l} as both fleet and local-only.`,n.path));let m=n.commands.map[l];(!m||m.status!=="supported"||m.fleetEligible!==true||m.executionScope!=="fleet")&&t.push(P("error","project.commands.fleet-stage-invalid",`Project ${n.name} advertises ${l} as a fleet stage without a supported fleet capability.`,n.path));}for(let l of n.commands.localOnly){let m=n.commands.map[l];(!m||m.status!=="supported"||m.executionScope!=="local-only"||m.fleetEligible===true)&&t.push(P("error","project.commands.local-only-invalid",`Project ${n.name} advertises ${l} as local-only without a matching local-only capability.`,n.path));}for(let l of Object.values(n.commands.map))l.status==="supported"&&(l.fleetEligible===true&&!u.has(l.command)&&t.push(P("error","project.commands.fleet-stage-missing",`Project ${n.name} capability ${l.command} is fleet-eligible but missing from fleetStages.`,n.path)),l.executionScope==="local-only"&&l.fleetEligible!==true&&!p.has(l.command)&&t.push(P("error","project.commands.local-only-missing",`Project ${n.name} capability ${l.command} is local-only but missing from localOnly commands.`,n.path)));}for(let[n,i]of r.entries())i.length>1&&t.push(P("error","project.name.duplicate",`Project name "${n}" is ambiguous across ${i.length} project roots.`,i.map(a=>a.path).join(", ")));e.projectTopology&&e.graph&&c$1({...e.projectTopology,generatedAt:"<ignored>"})!==c$1({...e.graph,generatedAt:"<ignored>"})&&t.push(P("error","workspace.project-topology.alias-mismatch","Deprecated model.graph must remain structurally identical to canonical model.projectTopology during the v1 migration window.","projectTopology"));let s=t.filter(n=>n.severity==="error").length,o=t.filter(n=>n.severity==="warning").length;return {status:s>0?"failed":o>0?"warning":"passed",errors:s,warnings:o,issues:t}}function Rn(e){return Pt(e)}function j(e){return e.join(".")}function vr(e,t){let r=de,s=e.generatedAt,o=[b({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),b({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),b({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),b({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),b({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),b({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})],n=Ee(e);n&&o.push(b({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:n.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??s,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),b({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:n.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??s,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[i,a]of e.projects.entries()){let c=`projects[${i}]`,d={kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};o.push(b({id:`project.${a.name}.kind`,label:`${a.name} kind`,scope:"project",project:a.name,value:a.kind,freshness:{...d,sourcePath:j([c,"kind"])}}),b({id:`project.${a.name}.category`,label:`${a.name} category`,scope:"project",project:a.name,value:a.category,freshness:{...d,sourcePath:j([c,"category"])}}),b({id:`project.${a.name}.runtime`,label:`${a.name} runtime`,scope:"project",project:a.name,value:a.runtime,freshness:{...d,sourcePath:j([c,"runtime"])}}),b({id:`project.${a.name}.framework`,label:`${a.name} framework`,scope:"project",project:a.name,value:a.frameworkDisplayName,freshness:{...d,sourcePath:j([c,"frameworkDisplayName"])}}),b({id:`project.${a.name}.supportTier`,label:`${a.name} support tier`,scope:"project",project:a.name,value:a.supportTier,freshness:{...d,sourcePath:j([c,"supportTier"])}}),b({id:`project.${a.name}.safeFleetStages`,label:`${a.name} safe fleet stages`,scope:"command",project:a.name,value:a.commands.fleetStages,freshness:{...d,sourcePath:j([c,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}),...["ci","release","ownership"].map(u=>b({id:`project.${a.name}.governance.${u}`,label:`${a.name} ${u} governance`,scope:"policy",project:a.name,value:a.governance?.[u]??{status:"unknown",provider:null,evidence:[],reference:null},freshness:{...d,sourcePath:j([c,"governance",u]),reason:"Governance truth is reconciled from repository surfaces and explicit workspace contract declarations."}})));for(let[u,p]of Object.entries(a.evidence))o.push(b({id:`project.${a.name}.evidence.${u}`,label:`${a.name} ${u} evidence`,scope:"evidence",project:a.name,value:p?{path:p.path,exists:p.exists,status:p.status??null}:{exists:false},freshness:{kind:p?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:p?.generatedAt??s,now:t,status:p?.exists?void 0:"unknown",sourceArtifact:p?.path??r,sourcePath:j([c,"evidence",u]),verifyBeforeUse:true,reason:p?.exists?"Evidence reports can expire or become stale after source changes.":"Missing evidence must be generated before this fact is used for verification."}}));}for(let[i,a]of Object.entries(e.evidence))o.push(b({id:`workspace.evidence.${i}`,label:`Workspace ${i} evidence`,scope:"evidence",value:a?{path:a.path,exists:a.exists,status:a.status??null}:null,freshness:{kind:a?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:a?.generatedAt??s,now:t,status:a?.exists?void 0:"unknown",sourceArtifact:a?.path??r,sourcePath:j(["evidence",i]),verifyBeforeUse:true,reason:a?.exists?"Workspace evidence can expire or become stale after project, dependency, or policy changes.":"Missing workspace evidence must be generated before release or repair decisions."}}));return o}async function pe(e$1){let t=f$1.resolve(e$1.workspacePath),r=e$1.includeAbsolutePaths===true,s$1=e$1.includeEvidence===true,o=We(e$1.observableScanDepth),n=e$1.now??new Date,[i$1,a$3,c,d,u,p]=await Promise.all([a(t),Ae(t),Me(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),xe(t,o)]),l=new Map;for(let g of c?.projects??[]){let ue=g.externalPath?f$1.resolve(g.externalPath):f$1.resolve(t,g.relativePath);l.set(ue,g);}let m=Re([...u,...p,...l.keys(),...d.map(g=>f$1.isAbsolute(g.path)?g.path:f$1.join(t,g.path))]),w=e$1.reuseProjectModels,h=await Promise.all(m.map(g=>{if(w){let ue=f$1.relative(t,f$1.resolve(g)).split(f$1.sep).join("/"),Ie=w.get(ue);if(Ie)return Promise.resolve(Ie)}return kr(t,g,{includeAbsolutePaths:r,includeEvidence:s$1,contractProject:l.get(f$1.resolve(g))})})),E=typeof a$3?.workspace_name=="string"?a$3.workspace_name:typeof a$3?.name=="string"?a$3.name:i$1?.name||c?.workspace.name||f$1.basename(t),R=typeof a$3?.profile=="string"?a$3.profile:typeof a$3?.mode=="string"?a$3.mode:c?.workspace.profile,A=Array.from(new Set(h.map(g=>g.kind))).sort(),le=Array.from(new Set(h.map(g=>g.category))).sort(),H=Array.from(new Set(h.flatMap(g=>g.runtimeCandidates.length>0?g.runtimeCandidates:[g.runtime]))).sort(),q=Array.from(new Set(h.map(g=>g.framework))).sort(),D=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(g=>S.existsSync(f$1.join(t,g))),J=s(t,"workspace.contract.json").map(g=>f$1.relative(t,g).split(f$1.sep).join("/")).find(g=>S.existsSync(f$1.join(t,g)))??i.workspaceContract,M=await S.pathExists(f$1.join(t,J)),X={schemaVersion:dr,generatedAt:n.toISOString(),workspace:{name:E,root:t,...R?{profile:R}:{},type:i$1?"rapidkit-workspace":"observed-workspace",...i$1?{marker:{createdBy:i$1.createdBy,version:i$1.version,createdAt:i$1.createdAt}}:{}},identity:{workspaceType:yr(h),surfaces:A,categories:le,runtimeFamilies:H,businessCapabilities:wr(h)},discovery:{observableScanDepth:o},projects:h,policies:{mode:typeof a$3?.policy_mode=="string"?a$3.policy_mode:typeof a$3?.policyMode=="string"?a$3.policyMode:"warn",source:D??null,exists:!!D},contracts:{workspaceContractPath:J,exists:M,status:M?"known":"missing"},evidence:{doctor:await x(t,e.doctor,s$1),projectDoctor:await x(t,i.doctorProject,s$1),doctorRemediationPlan:await x(t,i.doctorRemediationPlan,s$1),artifactRemediationPlan:await x(t,i.artifactRemediationPlan,s$1),doctorFixResult:await x(t,i.doctorFixResult,s$1),analyze:await x(t,e.analyze,s$1),readiness:await x(t,e.readiness,s$1),pipeline:await x(t,i.pipelineLastRun,s$1)},summary:{projectCount:h.length,runtimes:H,frameworks:q,firstClassProjects:h.filter(g=>g.supportTier==="first-class").length,observedProjects:h.filter(g=>g.supportTier==="observed").length}},v=await Ct(t,X,{contractExists:M,now:n,incrementalGraph:e$1.incrementalGraph}),C={...X,projectTopology:v,graph:v},I=Pt(C),O=vr({...C},n),St=yt({facts:O,generatedAt:n.toISOString(),now:n});return {...C,facts:O,factFreshness:St,validation:I}}async function An(e){if(e.cache!==true)return {model:await pe(e),cache:"disabled"};let t=f$1.resolve(e.workspacePath),r=We(e.observableScanDepth),s=Ce(),[o,n,i,a$3,c]=await Promise.all([a(t),Ae(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),xe(t,r)]),d=Re([...a$3,...c,...i.map(h=>f$1.isAbsolute(h.path)?h.path:f$1.join(t,h.path))]),u=await ie({workspacePath:t,cliVersion:s,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:d,workspaceJson:n,marker:o}),p=await Se(t);if(p&&p.cliVersion===s&&p.inputsHash===u&&vt(p.model))return {model:p.model,cache:"hit"};let l=await pe({...e}),[m,w]=await Promise.all([se(t,d),ae(t)]);return await ce(t,{cliVersion:s,inputsHash:u,generatedAt:(e.now??new Date).toISOString(),model:l,projectSignatures:m,workspaceFileSignatures:w}),{model:l,cache:"miss"}}function br(e,t){let r=new Set,s=new Set,o=new Set;for(let[n,i]of Object.entries(t))n in e?e[n]!==i&&r.add(n):s.add(n);for(let n of Object.keys(e))n in t||o.add(n);return {changed:r,added:s,removed:o}}function jr(e={},t={}){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return false;return true}async function Mn(e){let t=f$1.resolve(e.workspacePath),r=We(e.observableScanDepth),s=Ce(),o=e.now??new Date,[n,i,a$3,c,d]=await Promise.all([a(t),Ae(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),xe(t,r)]),u=Re([...c,...d,...a$3.map(v=>f$1.isAbsolute(v.path)?v.path:f$1.join(t,v.path))]),p=await Se(t),l=async()=>{let v=await pe({...e}),C=await ie({workspacePath:t,cliVersion:s,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:u,workspaceJson:i,marker:n}),[I,O]=await Promise.all([se(t,u),ae(t)]);return await ce(t,{cliVersion:s,inputsHash:C,generatedAt:o.toISOString(),model:v,projectSignatures:I,workspaceFileSignatures:O}),{model:v,mode:"full"}},m=p?Ee(p.model):void 0;if(!p||p.cliVersion!==s||!p.projectSignatures||!m||!vt(p.model))return l();let w=await ae(t);if(!jr(p.workspaceFileSignatures,w))return l();let h=await se(t,u),{changed:E,added:R,removed:A}=br(p.projectSignatures,h);if(E.size===0&&R.size===0&&A.size===0)return {model:p.model,mode:"unchanged"};let le=new Set([...E,...R]),H=new Map;for(let v of p.model.projects){let C=v.path.split(f$1.sep).join("/");!le.has(C)&&!A.has(C)&&H.set(C,v);}let q=new Set,D=false;for(let v of p.model.projects){let C=v.path.split(f$1.sep).join("/");E.has(C)&&q.add(v.name);}let J=R.size>0||A.size>0,M=await pe({...e,reuseProjectModels:H,incrementalGraph:{previousGraph:m,changedProjectIds:q,structuralChange:J||D}});for(let v of p.model.projects){let C=v.path.split(f$1.sep).join("/");if(!E.has(C))continue;let I=M.projects.find(O=>O.path.split(f$1.sep).join("/")===C);if(I&&I.name!==v.name){D=true;break}}if(D)return l();let X=await ie({workspacePath:t,cliVersion:s,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:u,workspaceJson:i,marker:n});return await ce(t,{cliVersion:s,inputsHash:X,generatedAt:o.toISOString(),model:M,projectSignatures:h,workspaceFileSignatures:w}),{model:M,mode:"incremental"}}async function Me(e){try{let{contract:t}=await p({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function Ct(e,t,r){let s=r.contractExists?await Me(e):null;try{return r.incrementalGraph?await ft({workspacePath:e,model:t,contract:s,now:r.now,previousGraph:r.incrementalGraph.previousGraph,changedProjectIds:r.incrementalGraph.changedProjectIds,structuralChange:r.incrementalGraph.structuralChange}):await mt({workspacePath:e,model:t,contract:s,now:r.now})}catch{let o=t.projects.map(n=>({id:n.name,path:n.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:r.now.toISOString(),nodes:o,edges:[],stats:{nodeCount:o.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:o.length,connectedNodeCount:0,density:0,edgeCoverageRatio:o.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:o.length>1?[{code:"graph.inference.failed",severity:"warning",message:"Dependency graph inference failed; model contains projects but no dependency edges.",recommendation:"Run workspace model again after fixing graph inputs, or add workspace contract/manual graph overrides.",nodeIds:o.map(n=>n.id).sort((n,i)=>n.localeCompare(i))}]:void 0}}}async function In(e$1,t){let r=e$1.contracts.exists?await Me(t):null,{buildWorkspaceKnowledgeGraph:s}=await import('./workspace-knowledge-graph-SWCKDTPF.js'),o=d(e$1),n=await S.readJson(f$1.join(t,e.knowledgeGraph)).then(c=>c).catch(()=>null),i=await s({workspacePath:t,workspace:{name:e$1.workspace.name,...e$1.workspace.profile?{profile:e$1.workspace.profile}:{}},projects:e$1.projects.map(c=>({id:c.name,path:c.path,...c.absolutePath?{absolutePath:c.absolutePath}:{},runtime:c.runtime,runtimeCandidates:c.runtimeCandidates,framework:c.framework,kind:c.kind,category:c.category,...c.governance?{governance:c.governance}:{},...c.kit?{kit:c.kit}:{}})),projectTopology:Ee(e$1)??await Ct(t,e$1,{contractExists:e$1.contracts.exists,now:new Date(e$1.generatedAt)}),contract:r,now:new Date(e$1.generatedAt),source:{kind:"workspace-model",artifact:de,hashAlgorithm:"sha256",hash:d$1(o)},previousGraph:n}),[,a]=await f$2(t,de,[{relativePath:e.knowledgeGraph,payload:i},{relativePath:de,payload:o}]);return a}export{rt as a,Er as b,Ar as c,$ as d,kt as e,b as f,yt as g,dr as h,de as i,Ee as j,xn as k,Rn as l,vr as m,pe as n,An as o,Mn as p,In as q};