workspai 0.45.0 → 0.47.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 (177) hide show
  1. package/README.md +307 -532
  2. package/contracts/agent-customization-pack.v1.json +6 -1
  3. package/contracts/bootstrap-compliance.v1.json +14 -0
  4. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +8 -0
  5. package/contracts/extension-cli-compatibility.v1.json +9 -2
  6. package/contracts/mirror-ops.v1.json +16 -0
  7. package/contracts/published-contract-catalog.v1.json +38 -1
  8. package/contracts/runtime-command-surface.v1.json +190 -7
  9. package/contracts/transparency-evidence.v1.json +13 -0
  10. package/contracts/workspace-archive-capabilities.v1.json +17 -6
  11. package/contracts/workspace-contract.v1.json +78 -0
  12. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +4 -0
  13. package/contracts/workspace-intelligence/workspace-context.v1.json +20 -0
  14. package/contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json +72 -0
  15. package/contracts/workspace-intelligence/workspace-intelligence-run.v1.json +212 -0
  16. package/contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json +200 -0
  17. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +260 -0
  18. package/contracts/workspace-intelligence/workspace-knowledge-search.v1.json +60 -0
  19. package/contracts/workspace-intelligence-architecture.v1.json +7 -4
  20. package/contracts/workspace-intelligence-chain.v1.json +51 -4
  21. package/contracts/workspace-share-bundle.v1.json +16 -0
  22. package/dist/analyze-UVXPRGYZ.js +1 -0
  23. package/dist/artifact-remediation-plan-EPALZ2LC.js +3 -0
  24. package/dist/autopilot-release-5BQ6F5L2.js +1 -0
  25. package/dist/chunk-22NJ2ZMG.js +2 -0
  26. package/dist/{chunk-XIVFLY6G.js → chunk-2GHUZDYA.js} +1 -1
  27. package/dist/chunk-2TEDAKP6.js +2 -0
  28. package/dist/chunk-52PBRX7F.js +1 -0
  29. package/dist/chunk-6SWRNA47.js +4 -0
  30. package/dist/chunk-76YOPAOT.js +1 -0
  31. package/dist/chunk-7VLCK5JW.js +1 -0
  32. package/dist/{chunk-DXPU4DDV.js → chunk-BSRVO52Y.js} +92 -78
  33. package/dist/chunk-COARSXRC.js +1 -0
  34. package/dist/chunk-CV5HKU4P.js +1 -0
  35. package/dist/chunk-CW7PGBIQ.js +13 -0
  36. package/dist/{chunk-KU4S7RCM.js → chunk-DV6GJD4K.js} +1 -1
  37. package/dist/chunk-EYJ2CQSK.js +1 -0
  38. package/dist/chunk-FB7SCXAZ.js +1 -0
  39. package/dist/chunk-FPJNWPKU.js +1 -0
  40. package/dist/{chunk-JP25YL3J.js → chunk-FTY7GGXJ.js} +2 -2
  41. package/dist/chunk-FXQJX34Z.js +1 -0
  42. package/dist/{chunk-J4AICQFB.js → chunk-HSGFUKCN.js} +1 -1
  43. package/dist/{chunk-OOOPYUL2.js → chunk-ITCAMC2E.js} +1 -1
  44. package/dist/chunk-KB44JP4M.js +2 -0
  45. package/dist/{chunk-WANW4QA4.js → chunk-KZZ36CK5.js} +1 -1
  46. package/dist/chunk-LNRAB7UY.js +1 -0
  47. package/dist/chunk-MEMHNE7Y.js +80 -0
  48. package/dist/chunk-MER6ZBN2.js +13 -0
  49. package/dist/chunk-NOFM7MNA.js +2 -0
  50. package/dist/chunk-NRYS4CLR.js +2 -0
  51. package/dist/chunk-OA537ZQ5.js +1 -0
  52. package/dist/chunk-PBHP6JNY.js +8 -0
  53. package/dist/chunk-QDWYIRHR.js +8 -0
  54. package/dist/chunk-RWRLFSKW.js +2 -0
  55. package/dist/chunk-SK6XRKGG.js +1 -0
  56. package/dist/chunk-THIOE2PB.js +2 -0
  57. package/dist/chunk-TNQI5VCW.js +36 -0
  58. package/dist/chunk-TWNFECMN.js +2 -0
  59. package/dist/{chunk-2QOWRBQD.js → chunk-U5EZHZBX.js} +1 -1
  60. package/dist/{chunk-K63BSU56.js → chunk-VBSQ7MF6.js} +62 -51
  61. package/dist/chunk-WDKNMTJQ.js +1 -0
  62. package/dist/chunk-YCL3I2JO.js +2 -0
  63. package/dist/chunk-ZDN7RHXJ.js +1 -0
  64. package/dist/chunk-ZM5NQ5Z2.js +1 -0
  65. package/dist/{create-KFR6FLRT.js → create-7JKJDAQV.js} +1 -1
  66. package/dist/doctor-PGPNIS76.js +1 -0
  67. package/dist/{dotnet-webapi-clean-BYUUHX5Y.js → dotnet-webapi-clean-6TVFBTVI.js} +20 -20
  68. package/dist/{gofiber-standard-B6UK5GR7.js → gofiber-standard-2BL7GWZB.js} +1 -1
  69. package/dist/{gogin-standard-BXU44VEM.js → gogin-standard-XGP3KBXA.js} +1 -1
  70. package/dist/index.d.ts +112 -16
  71. package/dist/index.js +198 -195
  72. package/dist/pipeline-IB6ILJSV.js +5 -0
  73. package/dist/{platform-capabilities-YICBF4FA.js → platform-capabilities-2B4QMZXE.js} +1 -1
  74. package/dist/{pythonRapidkitExec-UJYIB6FL.js → pythonRapidkitExec-CVCIK225.js} +1 -1
  75. package/dist/{springboot-standard-PEHDKH2L.js → springboot-standard-JJNUID6M.js} +6 -6
  76. package/dist/workspace-H3QXBFGB.js +1 -0
  77. package/dist/{workspace-agent-sync-G5YVI3BJ.js → workspace-agent-sync-C7SG2Z5W.js} +1 -1
  78. package/dist/workspace-archive-P76EDIUG.js +10 -0
  79. package/dist/{workspace-context-E3UFWL5X.js → workspace-context-BKQBKA4C.js} +1 -1
  80. package/dist/workspace-contract-RPQQBQXR.js +1 -0
  81. package/dist/workspace-dependency-graph-23BI2HG7.js +1 -0
  82. package/dist/workspace-explain-WVN7JH3U.js +1 -0
  83. package/dist/workspace-explain-contract-SEFTVF6J.js +1 -0
  84. package/dist/{workspace-feedback-YY6WQPWQ.js → workspace-feedback-WAID3IOE.js} +1 -1
  85. package/dist/{workspace-foundation-3C2DLCVI.js → workspace-foundation-5OOJEO2D.js} +1 -1
  86. package/dist/workspace-graph-token-efficiency-CFGFCJ5V.js +1 -0
  87. package/dist/{workspace-history-VF3CHDYQ.js → workspace-history-C6OP3IAQ.js} +1 -1
  88. package/dist/workspace-intelligence-VKDL3H2J.js +1 -0
  89. package/dist/workspace-intelligence-runner-LVALAZY7.js +1 -0
  90. package/dist/workspace-knowledge-graph-FE2NTZKV.js +1 -0
  91. package/dist/workspace-knowledge-graph-change-overlay-XG6FC4IX.js +1 -0
  92. package/dist/workspace-knowledge-graph-query-VOSPPH4W.js +1 -0
  93. package/dist/workspace-mcp-serve-KT2I676Z.js +3 -0
  94. package/dist/workspace-model-S33CIB2R.js +1 -0
  95. package/dist/workspace-model-hash-MHXK5MEI.js +1 -0
  96. package/dist/workspace-python-engine-state-2MLKJYQG.js +2 -0
  97. package/dist/workspace-registry-summary-A3YDL63D.js +1 -0
  98. package/dist/workspace-run-M4LNJILC.js +1 -0
  99. package/dist/{workspace-verify-ZNT6JX7D.js → workspace-verify-ZGH3NXAH.js} +1 -1
  100. package/dist/workspace-watch-EVBJTMV7.js +1 -0
  101. package/docs/AI_DYNAMIC_INTEGRATION.md +73 -432
  102. package/docs/AI_EXAMPLES.md +37 -395
  103. package/docs/AI_FEATURES.md +76 -465
  104. package/docs/AI_QUICKSTART.md +49 -209
  105. package/docs/DEVELOPMENT.md +5 -5
  106. package/docs/From Code to Shared Understanding.png +0 -0
  107. package/docs/GLOSSARY.md +60 -0
  108. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +91 -9
  109. package/docs/OPTIMIZATION_GUIDE.md +19 -51
  110. package/docs/PACKAGE_MANAGER_POLICY.md +4 -1
  111. package/docs/README.md +91 -42
  112. package/docs/SECURITY.md +13 -6
  113. package/docs/SETUP.md +6 -3
  114. package/docs/UTILITIES.md +8 -20
  115. package/docs/WORKSPACE_MARKER_SPEC.md +27 -20
  116. package/docs/ci-workflows.md +19 -5
  117. package/docs/commands-reference.md +88 -13
  118. package/docs/config-file-guide.md +67 -246
  119. package/docs/contracts/ARTIFACT_CATALOG.md +78 -36
  120. package/docs/contracts/CLI_LOG_EVENT_STREAM.md +1 -1
  121. package/docs/contracts/README.md +48 -9
  122. package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +4 -4
  123. package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +14 -10
  124. package/docs/creating-workspaces-and-projects.md +649 -0
  125. package/docs/doctor-command.md +5 -4
  126. package/docs/examples/ci-agent-grounding.yml +16 -10
  127. package/docs/from-code-to-shared-understanding.md +69 -38
  128. package/docs/graph-benchmark-methodology.md +121 -0
  129. package/docs/workspace-intelligence-runner.md +186 -0
  130. package/docs/workspace-knowledge-graph.md +295 -0
  131. package/docs/workspace-operations.md +78 -11
  132. package/docs/workspace-run.md +4 -1
  133. package/package.json +10 -8
  134. package/rapidkit.config.example.cjs +5 -5
  135. package/scripts/enforce-package-manager.cjs +1 -1
  136. package/scripts/prepack-enterprise.mjs +4 -0
  137. package/workspai.config.example.cjs +12 -47
  138. package/dist/analyze-YLV7NVLF.js +0 -1
  139. package/dist/artifact-remediation-plan-WLZGROUU.js +0 -3
  140. package/dist/autopilot-release-YBN3SWAA.js +0 -1
  141. package/dist/chunk-2K3GYCPS.js +0 -1
  142. package/dist/chunk-42G2OK64.js +0 -1
  143. package/dist/chunk-5AKYMAIL.js +0 -1
  144. package/dist/chunk-5GNT4RJI.js +0 -8
  145. package/dist/chunk-5PVEQ6CZ.js +0 -13
  146. package/dist/chunk-6AA3WWQZ.js +0 -2
  147. package/dist/chunk-6ZENXBMG.js +0 -33
  148. package/dist/chunk-7RIWU5TZ.js +0 -1
  149. package/dist/chunk-7UZVOYF5.js +0 -2
  150. package/dist/chunk-BJLE5CH7.js +0 -4
  151. package/dist/chunk-G3H5R3RR.js +0 -1
  152. package/dist/chunk-HYJK7W3B.js +0 -1
  153. package/dist/chunk-IMUU5Q2V.js +0 -13
  154. package/dist/chunk-KPPGZCUW.js +0 -78
  155. package/dist/chunk-LCRROMRR.js +0 -2
  156. package/dist/chunk-LG6RFLPZ.js +0 -1
  157. package/dist/chunk-P424XYHP.js +0 -1
  158. package/dist/chunk-P7SCWJFG.js +0 -8
  159. package/dist/chunk-QWU2CZBG.js +0 -2
  160. package/dist/chunk-V2H2KRMZ.js +0 -1
  161. package/dist/chunk-XZGVNGRB.js +0 -1
  162. package/dist/chunk-ZWO6K24C.js +0 -2
  163. package/dist/doctor-YJDM5XBH.js +0 -1
  164. package/dist/imported-projects-registry-FOIE27WT.js +0 -1
  165. package/dist/pipeline-FEDYO3IA.js +0 -5
  166. package/dist/workspace-PLXOO6ST.js +0 -1
  167. package/dist/workspace-archive-EEGLHZDW.js +0 -10
  168. package/dist/workspace-contract-LQJDZV36.js +0 -1
  169. package/dist/workspace-explain-G74ZIF23.js +0 -1
  170. package/dist/workspace-explain-contract-KT757JGQ.js +0 -1
  171. package/dist/workspace-intelligence-3GG7GEDQ.js +0 -1
  172. package/dist/workspace-mcp-serve-MJMUV4RY.js +0 -3
  173. package/dist/workspace-model-NG45SRM5.js +0 -1
  174. package/dist/workspace-python-engine-state-MTWIIZPY.js +0 -2
  175. package/dist/workspace-registry-summary-JM2XY52C.js +0 -1
  176. package/dist/workspace-run-WEQYIERE.js +0 -1
  177. package/dist/workspace-watch-W47T4RX2.js +0 -1
@@ -0,0 +1,260 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://getrapidkit.com/schemas/workspace-knowledge-graph.v1.json",
4
+ "title": "Workspai Evidence-backed Workspace Knowledge Graph",
5
+ "description": "Portable, provider-neutral workspace entities, relations and proof paths with the canonical project dependency topology embedded as a projection.",
6
+ "type": "object",
7
+ "required": [
8
+ "schemaVersion",
9
+ "generatedAt",
10
+ "source",
11
+ "workspace",
12
+ "projectTopology",
13
+ "entities",
14
+ "relations",
15
+ "proofs",
16
+ "providers",
17
+ "quality",
18
+ "diagnostics"
19
+ ],
20
+ "properties": {
21
+ "schemaVersion": { "const": "workspace-knowledge-graph.v1" },
22
+ "generatedAt": { "type": "string", "format": "date-time" },
23
+ "source": {
24
+ "type": "object",
25
+ "required": ["kind", "artifact", "hashAlgorithm", "hash"],
26
+ "properties": {
27
+ "kind": { "enum": ["workspace-model", "workspace-contract", "workspace-sources"] },
28
+ "artifact": { "type": "string", "minLength": 1 },
29
+ "hashAlgorithm": { "const": "sha256" },
30
+ "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
31
+ },
32
+ "additionalProperties": false
33
+ },
34
+ "workspace": {
35
+ "type": "object",
36
+ "required": ["name"],
37
+ "properties": {
38
+ "name": { "type": "string", "minLength": 1 },
39
+ "profile": { "type": "string" }
40
+ },
41
+ "additionalProperties": false
42
+ },
43
+ "projectTopology": { "$ref": "workspace-dependency-graph.v1.json" },
44
+ "entities": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "object",
48
+ "required": ["id", "kind", "label", "identity", "attributes", "proofIds"],
49
+ "properties": {
50
+ "id": { "type": "string", "minLength": 1 },
51
+ "kind": {
52
+ "enum": [
53
+ "workspace",
54
+ "project",
55
+ "service",
56
+ "api",
57
+ "endpoint",
58
+ "schema",
59
+ "package",
60
+ "module",
61
+ "file",
62
+ "symbol",
63
+ "database",
64
+ "queue",
65
+ "container",
66
+ "deployment",
67
+ "pipeline",
68
+ "environment",
69
+ "document",
70
+ "decision",
71
+ "test-suite",
72
+ "owner"
73
+ ]
74
+ },
75
+ "label": { "type": "string", "minLength": 1 },
76
+ "projectId": { "type": "string", "minLength": 1 },
77
+ "identity": {
78
+ "type": "object",
79
+ "required": ["key", "scope", "aliases", "fingerprint"],
80
+ "properties": {
81
+ "key": { "type": "string", "minLength": 1 },
82
+ "scope": { "enum": ["workspace", "project"] },
83
+ "aliases": { "type": "array", "items": { "type": "string" } },
84
+ "fingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
85
+ },
86
+ "additionalProperties": false
87
+ },
88
+ "attributes": {
89
+ "type": "object",
90
+ "additionalProperties": {
91
+ "type": ["string", "number", "boolean", "null", "array"],
92
+ "items": { "type": ["string", "number", "boolean", "null"] }
93
+ }
94
+ },
95
+ "proofIds": {
96
+ "type": "array",
97
+ "items": { "type": "string", "minLength": 1 },
98
+ "uniqueItems": true
99
+ }
100
+ },
101
+ "additionalProperties": false
102
+ }
103
+ },
104
+ "relations": {
105
+ "type": "array",
106
+ "items": {
107
+ "type": "object",
108
+ "required": ["id", "from", "to", "kind", "derivation", "trust", "confidence", "proofIds"],
109
+ "properties": {
110
+ "id": { "type": "string", "minLength": 1 },
111
+ "from": { "type": "string", "minLength": 1 },
112
+ "to": { "type": "string", "minLength": 1 },
113
+ "kind": {
114
+ "enum": [
115
+ "contains",
116
+ "defines",
117
+ "imports",
118
+ "depends-on",
119
+ "exposes",
120
+ "implements",
121
+ "calls",
122
+ "reads-from",
123
+ "writes-to",
124
+ "publishes",
125
+ "consumes",
126
+ "deploys",
127
+ "runs-on",
128
+ "routes-to",
129
+ "documents",
130
+ "decided-by",
131
+ "tests",
132
+ "owns",
133
+ "generated-by",
134
+ "configured-by",
135
+ "references"
136
+ ]
137
+ },
138
+ "derivation": { "enum": ["extracted", "inferred", "authored"] },
139
+ "trust": { "enum": ["authoritative", "corroborated", "observed", "ambiguous"] },
140
+ "confidence": { "enum": ["high", "medium", "low"] },
141
+ "proofIds": {
142
+ "type": "array",
143
+ "items": { "type": "string", "minLength": 1 },
144
+ "minItems": 1,
145
+ "uniqueItems": true
146
+ }
147
+ },
148
+ "additionalProperties": false
149
+ }
150
+ },
151
+ "proofs": {
152
+ "type": "array",
153
+ "items": {
154
+ "type": "object",
155
+ "required": [
156
+ "id",
157
+ "provider",
158
+ "artifact",
159
+ "observedAt",
160
+ "derivation",
161
+ "trust",
162
+ "confidence",
163
+ "freshness"
164
+ ],
165
+ "properties": {
166
+ "id": { "type": "string", "minLength": 1 },
167
+ "provider": { "type": "string", "minLength": 1 },
168
+ "artifact": {
169
+ "type": "string",
170
+ "minLength": 1,
171
+ "not": { "pattern": "^(?:/|[A-Za-z]:[\\\\/])" }
172
+ },
173
+ "pointer": { "type": "string" },
174
+ "line": { "type": "integer", "minimum": 1 },
175
+ "column": { "type": "integer", "minimum": 1 },
176
+ "contentHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
177
+ "observedAt": { "type": "string", "format": "date-time" },
178
+ "derivation": { "enum": ["extracted", "inferred", "authored"] },
179
+ "trust": { "enum": ["authoritative", "corroborated", "observed", "ambiguous"] },
180
+ "confidence": { "enum": ["high", "medium", "low"] },
181
+ "freshness": { "enum": ["fresh", "stale", "unknown"] },
182
+ "detail": { "type": "string" }
183
+ },
184
+ "additionalProperties": false
185
+ }
186
+ },
187
+ "providers": {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "object",
191
+ "required": [
192
+ "id",
193
+ "version",
194
+ "status",
195
+ "permission",
196
+ "discoveredEntities",
197
+ "discoveredRelations",
198
+ "proofCount",
199
+ "diagnostics"
200
+ ],
201
+ "properties": {
202
+ "id": { "type": "string", "minLength": 1 },
203
+ "version": { "type": "string", "minLength": 1 },
204
+ "status": { "enum": ["passed", "partial", "skipped", "failed"] },
205
+ "permission": { "enum": ["filesystem-read", "git-read", "runtime-probe", "network"] },
206
+ "discoveredEntities": { "type": "integer", "minimum": 0 },
207
+ "discoveredRelations": { "type": "integer", "minimum": 0 },
208
+ "proofCount": { "type": "integer", "minimum": 0 },
209
+ "diagnostics": { "type": "array", "items": { "type": "string" } }
210
+ },
211
+ "additionalProperties": false
212
+ }
213
+ },
214
+ "quality": {
215
+ "type": "object",
216
+ "required": [
217
+ "entityCount",
218
+ "relationCount",
219
+ "proofCount",
220
+ "entityProofCoverageRatio",
221
+ "relationProofCoverageRatio",
222
+ "providerSuccessRatio",
223
+ "conflictCount",
224
+ "unknownCount",
225
+ "portable",
226
+ "secretValuesEmitted"
227
+ ],
228
+ "properties": {
229
+ "entityCount": { "type": "integer", "minimum": 0 },
230
+ "relationCount": { "type": "integer", "minimum": 0 },
231
+ "proofCount": { "type": "integer", "minimum": 0 },
232
+ "entityProofCoverageRatio": { "type": "number", "minimum": 0, "maximum": 1 },
233
+ "relationProofCoverageRatio": { "type": "number", "minimum": 0, "maximum": 1 },
234
+ "providerSuccessRatio": { "type": "number", "minimum": 0, "maximum": 1 },
235
+ "conflictCount": { "type": "integer", "minimum": 0 },
236
+ "unknownCount": { "type": "integer", "minimum": 0 },
237
+ "portable": { "const": true },
238
+ "secretValuesEmitted": { "const": false }
239
+ },
240
+ "additionalProperties": false
241
+ },
242
+ "diagnostics": {
243
+ "type": "array",
244
+ "items": {
245
+ "type": "object",
246
+ "required": ["code", "severity", "message"],
247
+ "properties": {
248
+ "code": { "type": "string", "minLength": 1 },
249
+ "severity": { "enum": ["info", "warning", "error"] },
250
+ "message": { "type": "string", "minLength": 1 },
251
+ "entityIds": { "type": "array", "items": { "type": "string" } },
252
+ "relationIds": { "type": "array", "items": { "type": "string" } },
253
+ "recommendation": { "type": "string" }
254
+ },
255
+ "additionalProperties": false
256
+ }
257
+ }
258
+ },
259
+ "additionalProperties": false
260
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://getrapidkit.com/schemas/workspace-knowledge-search.v1.json",
4
+ "title": "Workspai Bounded Knowledge Graph Search",
5
+ "description": "A deterministic, bounded, proof-carrying retrieval projection intended for agents, MCP clients, IDEs, and CI consumers.",
6
+ "type": "object",
7
+ "required": [
8
+ "schemaVersion",
9
+ "query",
10
+ "kind",
11
+ "limit",
12
+ "totalMatches",
13
+ "truncated",
14
+ "entities",
15
+ "relatedEntities",
16
+ "relations",
17
+ "proofs"
18
+ ],
19
+ "properties": {
20
+ "schemaVersion": { "const": "workspace-knowledge-search.v1" },
21
+ "query": { "type": "string", "minLength": 1 },
22
+ "kind": {
23
+ "oneOf": [
24
+ { "type": "null" },
25
+ { "$ref": "workspace-knowledge-graph.v1.json#/properties/entities/items/properties/kind" }
26
+ ]
27
+ },
28
+ "limit": { "type": "integer", "minimum": 1, "maximum": 100 },
29
+ "totalMatches": { "type": "integer", "minimum": 0 },
30
+ "truncated": { "type": "boolean" },
31
+ "entities": {
32
+ "type": "array",
33
+ "maxItems": 100,
34
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/entities/items" }
35
+ },
36
+ "relatedEntities": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "object",
40
+ "required": ["id", "kind", "label"],
41
+ "properties": {
42
+ "id": { "type": "string", "minLength": 1 },
43
+ "kind": { "$ref": "workspace-knowledge-graph.v1.json#/properties/entities/items/properties/kind" },
44
+ "label": { "type": "string", "minLength": 1 },
45
+ "projectId": { "type": "string", "minLength": 1 }
46
+ },
47
+ "additionalProperties": false
48
+ }
49
+ },
50
+ "relations": {
51
+ "type": "array",
52
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/relations/items" }
53
+ },
54
+ "proofs": {
55
+ "type": "array",
56
+ "items": { "$ref": "workspace-knowledge-graph.v1.json#/properties/proofs/items" }
57
+ }
58
+ },
59
+ "additionalProperties": false
60
+ }
@@ -159,6 +159,7 @@
159
159
  "label": "System understanding",
160
160
  "artifacts": [
161
161
  ".workspai/reports/workspace-model.json",
162
+ ".workspai/reports/workspace-knowledge-graph.json",
162
163
  ".workspai/reports/workspace-model-diff-last-run.json",
163
164
  ".workspai/reports/workspace-impact-last-run.json"
164
165
  ],
@@ -302,9 +303,10 @@
302
303
  "workspace graph mermaid"
303
304
  ],
304
305
  "reads": [
305
- ".workspai/reports/workspace-model.json#graph"
306
+ ".workspai/reports/workspace-model.json",
307
+ ".workspai/reports/workspace-knowledge-graph.json"
306
308
  ],
307
- "role": "Inspect or render the graph already embedded in the workspace model.",
309
+ "role": "Query the proof-backed graph derived from the canonical workspace model.",
308
310
  "chainStep": false
309
311
  },
310
312
  {
@@ -345,7 +347,8 @@
345
347
  "workspace model --json --write"
346
348
  ],
347
349
  "artifacts": [
348
- ".workspai/reports/workspace-model.json"
350
+ ".workspai/reports/workspace-model.json",
351
+ ".workspai/reports/workspace-knowledge-graph.json"
349
352
  ]
350
353
  },
351
354
  {
@@ -408,7 +411,7 @@
408
411
  "status": "available",
409
412
  "purpose": "Refresh release-readiness evidence before the definitive gate.",
410
413
  "commands": [
411
- "readiness --json"
414
+ "readiness --json --skip-verify"
412
415
  ],
413
416
  "artifacts": [
414
417
  ".workspai/reports/release-readiness-last-run.json"
@@ -102,6 +102,12 @@
102
102
  "schemaVersion": "workspace-model.v1",
103
103
  "schemaContract": "contracts/workspace-intelligence/workspace-model.v1.json"
104
104
  },
105
+ {
106
+ "id": "knowledgeGraph",
107
+ "path": ".workspai/reports/workspace-knowledge-graph.json",
108
+ "schemaVersion": "workspace-knowledge-graph.v1",
109
+ "schemaContract": "contracts/workspace-intelligence/workspace-knowledge-graph.v1.json"
110
+ },
105
111
  {
106
112
  "id": "snapshot",
107
113
  "path": ".workspai/reports/workspace-model-snapshot.json",
@@ -191,9 +197,44 @@
191
197
  "path": ".workspai/reports/workspace-explain-last-run.json",
192
198
  "schemaVersion": "workspace-explain.v1",
193
199
  "schemaContract": "contracts/workspace-intelligence/workspace-explain.v1.json"
200
+ },
201
+ {
202
+ "id": "intelligenceRun",
203
+ "path": ".workspai/reports/workspace-intelligence-run-last-run.json",
204
+ "schemaVersion": "workspace-intelligence-run.v1",
205
+ "schemaContract": "contracts/workspace-intelligence/workspace-intelligence-run.v1.json"
194
206
  }
195
207
  ]
196
208
  },
209
+ "executionEnvelope": {
210
+ "rule": "Sync and baseline resolution are deterministic execution prerequisites, not canonical intelligence stages; every run reports them separately and preserves the exact canonical stage sequence.",
211
+ "operations": [
212
+ {
213
+ "id": "sync",
214
+ "executionPoint": "before:model",
215
+ "artifacts": [
216
+ ".workspai/workspace.contract.json",
217
+ ".workspai/workspace-registry.v1.json"
218
+ ],
219
+ "failurePolicy": "stop-and-report",
220
+ "purpose": "Reconcile portable workspace inventory and contract inputs before modeling."
221
+ },
222
+ {
223
+ "id": "baseline",
224
+ "executionPoint": "after:model-before:diff",
225
+ "artifacts": [
226
+ ".workspai/reports/workspace-model-snapshot.json"
227
+ ],
228
+ "failurePolicy": "stop-and-report",
229
+ "purpose": "Create an initial structural baseline when absent or reuse the existing baseline before Diff."
230
+ }
231
+ ],
232
+ "report": {
233
+ "artifact": ".workspai/reports/workspace-intelligence-run-last-run.json",
234
+ "schemaVersion": "workspace-intelligence-run.v1",
235
+ "invariant": "The report must preserve exact preflight and stage order, registry-owned artifacts, failure propagation, and aggregate status/exit semantics."
236
+ }
237
+ },
197
238
  "boundaries": {
198
239
  "inputs": [
199
240
  {
@@ -275,6 +316,7 @@
275
316
  "label": "System understanding",
276
317
  "artifacts": [
277
318
  ".workspai/reports/workspace-model.json",
319
+ ".workspai/reports/workspace-knowledge-graph.json",
278
320
  ".workspai/reports/workspace-model-diff-last-run.json",
279
321
  ".workspai/reports/workspace-impact-last-run.json"
280
322
  ],
@@ -458,9 +500,10 @@
458
500
  "workspace graph mermaid"
459
501
  ],
460
502
  "reads": [
461
- ".workspai/reports/workspace-model.json#graph"
503
+ ".workspai/reports/workspace-model.json",
504
+ ".workspai/reports/workspace-knowledge-graph.json"
462
505
  ],
463
- "role": "Inspect or render the graph already embedded in the workspace model.",
506
+ "role": "Query the proof-backed graph derived from the canonical workspace model.",
464
507
  "chainStep": false
465
508
  },
466
509
  {
@@ -691,7 +734,8 @@
691
734
  ],
692
735
  "consumesArtifacts": [],
693
736
  "produces": [
694
- ".workspai/reports/workspace-model.json"
737
+ ".workspai/reports/workspace-model.json",
738
+ ".workspai/reports/workspace-knowledge-graph.json"
695
739
  ],
696
740
  "dependsOn": [],
697
741
  "exitPolicy": "stop-on-error",
@@ -853,7 +897,8 @@
853
897
  "label": "Readiness Evidence",
854
898
  "command": [
855
899
  "readiness",
856
- "--json"
900
+ "--json",
901
+ "--skip-verify"
857
902
  ],
858
903
  "consumes": [
859
904
  "doctor, analysis, runtime, and release signals"
@@ -1170,6 +1215,7 @@
1170
1215
  ".workspai/reports/workspace-impact-last-run.json",
1171
1216
  ".workspai/reports/workspace-explain-last-run.json",
1172
1217
  ".workspai/reports/workspace-model.json",
1218
+ ".workspai/reports/workspace-knowledge-graph.json",
1173
1219
  ".workspai/reports/agent-customization-pack.json",
1174
1220
  ".workspai/reports/workspace-skills-index.json"
1175
1221
  ],
@@ -1182,6 +1228,7 @@
1182
1228
  "ideAndCi": {
1183
1229
  "requiredArtifacts": [
1184
1230
  ".workspai/reports/workspace-model.json",
1231
+ ".workspai/reports/workspace-knowledge-graph.json",
1185
1232
  ".workspai/reports/workspace-impact-last-run.json",
1186
1233
  ".workspai/reports/workspace-verify-last-run.json"
1187
1234
  ],
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://getrapidkit.com/schemas/workspace-share-bundle.v1.json",
4
+ "type": "object",
5
+ "required": ["schema_version", "generated_at", "generated_by", "workspace", "summary", "reports", "projects"],
6
+ "properties": {
7
+ "schema_version": { "const": "1.1" },
8
+ "generated_at": { "type": "string", "format": "date-time" },
9
+ "generated_by": { "const": "workspai" },
10
+ "workspace": { "type": "object" },
11
+ "summary": { "type": "object" },
12
+ "reports": { "type": "object" },
13
+ "projects": { "type": "array", "items": { "type": "object" } }
14
+ },
15
+ "additionalProperties": true
16
+ }
@@ -0,0 +1 @@
1
+ export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-PBHP6JNY.js';
@@ -0,0 +1,3 @@
1
+ import {a as a$1}from'./chunk-2E6WGUN6.js';import {a,e,b}from'./chunk-2TEDAKP6.js';import y from'path';import {existsSync}from'fs';import x from'fs-extra';var I=[{artifactKind:"bootstrap-compliance",cardId:"bootstrap",fileNames:["bootstrap-compliance.latest.json"]},{artifactKind:"doctor-workspace",cardId:"doctor",fileNames:["doctor-remediation-plan-last-run.json"]},{artifactKind:"analyze",cardId:"analyze",fileNames:["analyze-last-run.json"]},{artifactKind:"readiness",cardId:"readiness",fileNames:["release-readiness-last-run.json"]},{artifactKind:"pipeline",cardId:"pipeline",fileNames:["pipeline-last-run.json"]},{artifactKind:"workspace-run",cardId:"workspaceRun",fileNames:["workspace-run-last.json"]},{artifactKind:"workspace-verify",cardId:"workspaceVerify",fileNames:["workspace-verify-last-run.json"]}];function m(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function f(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[]}function k(e){return [...new Set(e.map(r=>r.trim()).filter(Boolean))]}function K(e,r,t){return t?r:y.relative(e,r)}function C(e){let r=e?.trim()||"npx workspai bootstrap";if(!/(?:^|\s)--ci(?:\s|$)/.test(r)&&/(?:^|\s)--json(?:\s|$)/.test(r))return r.replace(/(?:^|\s)--json(?:\s|$)/,i=>{let n=i.startsWith(" ")?" ":"",c=i.endsWith(" ")?" ":"";return `${n}--ci --json${c}`}).trim();let t=/(?:^|\s)--ci(?:\s|$)/.test(r)?r:`${r} --ci`;return /(?:^|\s)--json(?:\s|$)/.test(t)?t:`${t} --json`}function M(e){return `${JSON.stringify({schemaVersion:"rapidkit.compatibility-matrix.v1",generatedAt:e,source:"workspai workspace remediation-plan",runtimes:{},notes:["Minimal enterprise baseline. Add runtime and toolchain entries as governance matures."]},null,2)}
2
+ `}function N(e){return `${JSON.stringify({schema_version:"1.0",enabled:false,strategy:"on-demand",artifacts:[],created_at:e,note:"Minimal enterprise baseline. Set enabled: true and add artifact entries to activate mirroring."},null,2)}
3
+ `}function $(e){let r=e.payload,t=f(r.blockers),i=f(r.blockingReasons),n=f(r.failures),c=f(r.reasons),d=f(r.policyViolations),a=m(r.summary),l=f(a?.blockers);if(e.artifactKind==="analyze"){let o=(Array.isArray(r.findings)?r.findings:[]).map(s=>m(s)).filter(s=>!!s).map(s=>String(s.message??s.title??s.id??"").trim()).filter(Boolean);return k([...t,...o,...i])}if(e.artifactKind==="workspace-run"){let u=m(r.stages),o=Object.entries(u??{}).flatMap(([s,b])=>{let h=m(b);return (Array.isArray(h?.projects)?h.projects:[]).map(p=>m(p)).filter(p=>!!p).filter(p=>p.status==="failed"||p.ok===false).map(p=>`${s}: ${String(p.project??p.name??"project")} failed`)});return k([...t,...o,...i])}return k([...t,...i,...n,...c,...d,...l])}function g(e){return {id:e.id,artifactKind:e.artifactKind,cardId:e.cardId,title:e.title,order:e.order,phase:e.phase,scope:"workspace",status:e.status??"ready",mode:e.mode,risk:e.risk,requiresApproval:true,blocker:e.blocker,summary:e.summary,...e.command?{command:e.command}:{},verifyCommand:e.verifyCommand,cwd:"workspace",files:e.files??[],...e.operation?{operation:e.operation}:{},rollback:{available:!!e.operation,strategy:e.operation?"idempotent":"none"},notes:e.notes??[]}}function P(e){let r=[],t=C("npx workspai bootstrap --json");for(let i of e.blockers)i.includes("profile.enterprise.ci")&&r.push(g({id:"bootstrap.enterprise-ci",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Run bootstrap in deterministic CI mode",order:10,phase:"bootstrap-preflight",blocker:i,summary:"Enterprise bootstrap compliance requires --ci for deterministic execution.",mode:"run-command",risk:"safe",command:t,verifyCommand:t})),i.includes("profile.enterprise.compatibility-matrix")&&r.push(g({id:"bootstrap.compatibility-matrix",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise compatibility matrix baseline",order:20,phase:"bootstrap-config",blocker:i,summary:"Create the missing compatibility matrix baseline without overwriting user data.",mode:"edit-file",risk:"safe",verifyCommand:t,files:[".workspai/compatibility-matrix.json"],operation:{type:"file-create",path:".workspai/compatibility-matrix.json",content:M(e.generatedAt),overwrite:false}})),i.includes("profile.enterprise.mirror-config")&&r.push(g({id:"bootstrap.mirror-config",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise mirror config baseline",order:30,phase:"bootstrap-config",blocker:i,summary:"Create the missing mirror configuration baseline without enabling mirroring.",mode:"edit-file",risk:"safe",verifyCommand:t,files:[".workspai/mirror-config.json"],operation:{type:"file-create",path:".workspai/mirror-config.json",content:N(e.generatedAt),overwrite:false}}));return r}function S(e){if(e.report.artifactKind==="readiness"&&/dependenc(?:y|ies).*vulnerabil|vulnerabil.*dependenc(?:y|ies)|security audit/i.test(e.blocker))return g({id:`${e.report.cardId}.doctor-owner.${e.order}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:"Resolve dependency vulnerability through Doctor",order:e.order,phase:"dependency-remediation",blocker:e.blocker,summary:"Release Readiness is the aggregate gate; use the project-scoped Doctor remediation capability that owns this dependency failure.",mode:"verify-before-fix",risk:"guarded",status:"review-required",command:"npx workspai doctor workspace --plan --json",verifyCommand:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",notes:["Read doctor-remediation-plan-last-run.json and execute the matching surface-security-hygiene capability before rerunning Readiness.","Do not treat a Readiness refresh as remediation for a source dependency vulnerability."]});let t={analyze:{title:"Refresh analyze evidence",phase:"analysis",command:"npx workspai analyze --strict --json",verify:"npx workspai analyze --strict --json"},readiness:{title:"Refresh release readiness",phase:"release-readiness",command:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",verify:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json"},pipeline:{title:"Rerun governance pipeline",phase:"governance-pipeline",command:"npx workspai pipeline --json --strict",verify:"npx workspai pipeline --json --strict"},"workspace-run":{title:"Rerun failed workspace stage",phase:"fleet-run",command:e.ciMode?"npx workspai workspace run test --strict --json":"npx workspai workspace run test --json",verify:e.ciMode?"npx workspai workspace run test --strict --json":"npx workspai workspace run test --json"},"workspace-verify":{title:"Refresh workspace verify gate",phase:"verification",command:e.ciMode?"npx workspai workspace verify --strict --json":"npx workspai workspace verify --json",verify:e.ciMode?"npx workspai workspace verify --strict --json":"npx workspai workspace verify --json"},"doctor-workspace":{title:"Use Doctor remediation plan",phase:"doctor-remediation",command:"npx workspai doctor workspace --plan --json",verify:"npx workspai doctor workspace --json"}}[e.report.artifactKind]??{title:"Refresh artifact evidence",phase:"evidence-refresh",command:"npx workspai pipeline --json --strict",verify:"npx workspai pipeline --json --strict"};return g({id:`${e.report.cardId}.refresh.${e.order}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:t.title,order:e.order,phase:t.phase,blocker:e.blocker,summary:"No deterministic file operation is available for this artifact yet; refresh the evidence and continue with the card-specific plan.",mode:e.report.artifactKind==="doctor-workspace"?"verify-before-fix":"run-command",risk:"guarded",status:e.report.artifactKind==="doctor-workspace"?"review-required":"ready",command:t.command,verifyCommand:t.verify,notes:e.report.artifactKind==="doctor-workspace"?["Read doctor-remediation-plan-last-run.json for ordered file-level steps."]:[]})}async function O(e){let r=[a(e,".workspai/reports"),b(e,".workspai/reports")],t=[],i=new Set;for(let n of I)for(let c of n.fileNames){let d=(await Promise.all(r.map(a=>y.join(a,c)))).find(a=>existsSync(a));if(!(!d||i.has(`${n.artifactKind}:${c}`))){i.add(`${n.artifactKind}:${c}`);try{let a=await x.readJSON(d),l=m(a);if(!l)continue;t.push({artifactKind:n.artifactKind,cardId:n.cardId,fileName:c,absolutePath:d,payload:l});}catch{t.push({artifactKind:n.artifactKind,cardId:n.cardId,fileName:c,absolutePath:d,payload:{blockers:[`${n.artifactKind}: report exists but could not be parsed.`]}});}}}return t}async function F(e){let r=y.resolve(e.workspacePath),t=e.includeAbsolutePaths===true,i=e.ciMode===true,n=new Date().toISOString(),c=a(r,".workspai/reports"),d=await O(r),a$2=[],l=1;for(let o of d){let s=$(o);if(s.length!==0){if(o.artifactKind==="bootstrap-compliance"){a$2.push(...P({blockers:s,generatedAt:n})),l=a$2.length+1;continue}for(let b of s.slice(0,8))a$2.push(S({report:o,blocker:b,order:l,ciMode:i})),l+=1;}}let u={safe:a$2.filter(o=>o.risk==="safe").length,guarded:a$2.filter(o=>o.risk==="guarded").length,invasive:a$2.filter(o=>o.risk==="invasive").length};return {schemaVersion:a$1,generatedAt:n,workspace:{name:y.basename(r),...t?{path:r}:{}},source:{command:"workspace remediation-plan",reportsDir:K(r,c,t),includeAbsolutePaths:t,ciMode:i},summary:{artifactsScanned:d.length,cardsCovered:k(a$2.map(o=>o.cardId)).length,totalActions:a$2.length,executableActions:a$2.filter(o=>o.status==="ready").length,risk:u},actions:a$2}}async function W(e$1,r){return e(r,".workspai/reports/artifact-remediation-plan-last-run.json",e$1)}export{F as buildArtifactRemediationPlan,W as writeArtifactRemediationPlan};
@@ -0,0 +1 @@
1
+ export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-QDWYIRHR.js';
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-FXQJX34Z.js';import {w}from'./chunk-TWNFECMN.js';import {a as a$2,d,c,e as e$1}from'./chunk-2TEDAKP6.js';import {b as b$1}from'./chunk-YCL3I2JO.js';import {a,b}from'./chunk-LNRAB7UY.js';import {e}from'./chunk-RO73VVHW.js';import {p,o}from'./chunk-5XATWNME.js';import {l}from'./chunk-OCGZNSOE.js';import m from'path';import g from'fs-extra';var ne="unknown-run";function M(e$1){let t=e();return !t||t===ne?e$1:{...e$1,runId:t}}var be="workspace-dependency-graph.v1",L=["code-import","package-dep","event-pub-sub","service-dependsOn","shared-resource"],U=["inferred","contract","manual"];var C=".workspai/workspace.contract.json",ae=a.contractVerify,v=1,se=b.contractVerify,j=class extends Error{constructor(o){super(`Workspace contract verification failed: ${o.violations.join("; ")}`);this.verification=o;this.name="WorkspaceContractVerificationError";}verification};function Z(e){return e.replace(/\\/g,"/")}function O(e){let t=Z(e).trim();return !t||t.startsWith("/")||t.startsWith("~")||/^[a-zA-Z]:\//.test(t)||t.includes("\0")?false:!t.split("/").filter(Boolean).some(o=>o===".."||o===".")}function z(e,t){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,80)||t}function ce(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}function ie(e){let o=(Array.isArray(e.ports)?e.ports:[]).map(c=>{if(!c||typeof c!="object"||Array.isArray(c))return null;let d=c,f=Number(d.port);if(!Number.isInteger(f)||f<1||f>65535)return null;let u=d.protocol==="https"||d.protocol==="grpc"||d.protocol==="tcp"||d.protocol==="udp"?d.protocol:"http";return {name:typeof d.name=="string"&&d.name.trim()?d.name:"http",port:f,protocol:u}}).filter(c=>c!==null);if(o.length>0)return o;let n=e.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,s=Number(e.port??n?.default_port);return Number.isInteger(s)&&s>=1&&s<=65535?[{name:"http",port:s,protocol:"http"}]:[]}async function A(e){for(let t of e)if(await g.pathExists(t))return t;return null}async function pe(e){for(let t of o(e,"workspace.json"))try{let o=await g.readJson(t);return {name:typeof o.workspace_name=="string"&&o.workspace_name.trim()||typeof o.name=="string"&&o.name.trim()||m.basename(e),profile:typeof o.profile=="string"?o.profile:void 0}}catch{}return {name:m.basename(e)}}async function de(e){let t=[],o=[e],n=new Set,s=new Set([".git",".workspai",".rapidkit","node_modules",".venv","venv","dist","build","target",".next",".turbo",".cache"]);for(;o.length>0;){let c=o.shift();if(!c||n.has(c))continue;n.add(c);let d=await A(p(c,"project.json")),f=await A(p(c,"context.json"));if(d||f){t.push(d??f??"");continue}let u;try{u=await g.readdir(c,{withFileTypes:true});}catch{continue}for(let l of u)!l.isDirectory()||s.has(l.name)||o.push(m.join(c,l.name));}return t.sort()}function ue(e){let t=(e||"").toLowerCase();if(t.includes("fastapi"))return "fastapi";if(t.includes("nestjs"))return "nestjs";if(t.includes("springboot"))return "springboot";if(t.includes("gofiber"))return "fiber";if(t.includes("gogin"))return "gin"}function le(e,t){let o=(e||"").toLowerCase(),n=(t||"").toLowerCase();return o.includes("fastapi")?8e3:o.includes("nestjs")?3e3:o.includes("springboot")?8080:o.includes("gofiber")?3e3:o.includes("gogin")?8080:n==="node"?3e3:n==="python"?8e3:n==="java"||n==="go"?8080:null}function Y(e,t){let o=e;for(;t.has(o)&&o<65535;)o+=1;return o}function _(e,t,o){let n=e!==void 0&&e.source===void 0,s=le(t.kit,t.runtime),c=e?.ports||[],d=t.ports||[],u=(c.length>0?c:d.length>0?d:s?[{name:"http",port:Y(s,o),protocol:"http"}]:[]).map(i=>({...i,port:Y(i.port,o)}));for(let i of u)o.add(i.port);let l={...t,...e,slug:e?.slug||t.slug,relativePath:n&&e?.relativePath&&O(e.relativePath)?e.relativePath:t.relativePath,source:n&&e?.source||t.source,relationship:n&&e?.relationship||t.relationship,externalPath:n&&e?.externalPath||t.externalPath,runtime:e?.runtime||t.runtime,framework:e?.framework||t.framework,kit:e?.kit||t.kit,modules:e?.modules?.length?e.modules:t.modules,ports:u,contracts:{owns:e?.contracts?.owns||[],apis:e?.contracts?.apis||[],publishes:e?.contracts?.publishes||[],consumes:e?.contracts?.consumes||[],dependsOn:e?.contracts?.dependsOn||[],env:e?.contracts?.env||[]}},a=JSON.stringify(e||null)!==JSON.stringify(l);return {project:l,changed:a}}async function Q(e){let t=m.resolve(e.workspacePath),o=await pe(t),n=await de(t),s=await a$1(t),c=[];for(let l of s){let a=m.resolve(l.path),i=await A(p(a,"project.json"))??await A(p(a,"context.json"));!i||n.some(k=>m.resolve(k)===m.resolve(i))||c.push({projectJsonPath:i,registryEntry:l});}let d=[],f=[...n.map(l=>({projectJsonPath:l})),...c];for(let{projectJsonPath:l,registryEntry:a}of f){let i=m.dirname(m.dirname(l)),k=Z(m.relative(t,i)),h=a!==void 0&&!O(k),r=z(a?.name||m.basename(i),m.basename(i)),p=h?`external/${r}`:k||r,w=await g.readJson(l),y=typeof w.kit_name=="string"&&w.kit_name||typeof w.kit=="string"&&w.kit||void 0,R=typeof w.framework=="string"&&w.framework||ue(y);d.push({slug:a?.name||p||m.basename(i),relativePath:p,source:a?.source??"workspace",relationship:a?.relationship,externalPath:h?i:void 0,runtime:typeof w.runtime=="string"?w.runtime:void 0,framework:R,kit:y,modules:ce(w.modules),ports:ie(w),contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}});}let u=new Map;for(let l of d){let a=z(l.slug,l.relativePath),i=u.get(a);(!i||i.source!=="workspace"&&l.source==="workspace")&&u.set(a,l);}return {schemaVersion:v,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:o,projects:[...u.values()]}}async function Te(e){let t=m.resolve(e.outputPath||a$2(e.workspacePath,C));if(await g.pathExists(t)&&e.force!==true)throw new Error(`Workspace contract already exists: ${t}. Use --force to overwrite.`);let o=await Q({workspacePath:e.workspacePath,now:e.now}),n=new Set,s={...o,projects:o.projects.map(d=>_(void 0,d,n).project)},c=await te({workspacePath:e.workspacePath,contractPath:t,contract:s});if(e.strict&&c.status==="failed")throw new j(c);return await X({workspacePath:e.workspacePath,contractPath:t,contract:s,now:e.now}),{contractPath:t,contract:s}}async function Ve(e){let t=m.resolve(e.workspacePath),o=a$2(t,C),n=await d(t,C)??o,s=await Q({workspacePath:t,now:e.now}),c=await g.pathExists(n)?await g.readJson(n):null,d$1=new Map((c?.projects||[]).map(h=>[h.slug,h])),f=new Set,u=[],l=[],a=[];for(let h of s.projects){let r=d$1.get(h.slug),p=_(r,h,f);r?p.changed&&l.push(h.slug):u.push(h.slug),a.push(p.project),d$1.delete(h.slug);}for(let h of d$1.values()){if(h.source)continue;let r=_(h,h,f);a.push(r.project);}let i={schemaVersion:v,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:{...s.workspace,...c?.workspace||{},name:c?.workspace?.name||s.workspace.name},projects:a.sort((h,r)=>h.slug.localeCompare(r.slug))},k=await te({workspacePath:t,contractPath:o,contract:i});if(e.strict&&k.status==="failed")throw new j(k);return await X({workspacePath:t,contractPath:o,contract:i,now:e.now}),{contractPath:o,contract:i,addedProjects:u,updatedProjects:l,verification:k}}async function q(e){return await g.pathExists(e)?{exists:true,contents:await g.readFile(e)}:{exists:false}}async function B(e,t){if(!t.exists){await g.remove(e);return}await g.outputFile(e,t.contents);}async function X(e){let{buildWorkspaceRegistrySummary:t,WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH:o}=await import('./workspace-registry-summary-A3YDL63D.js'),n=await t(e.workspacePath,{now:e.now,contract:e.contract}),s=a$2(e.workspacePath,o),c$1=d=>{if(!d||typeof d!="object"||Array.isArray(d))return JSON.stringify(d);let{generatedAt:f,...u}=d;return JSON.stringify(u)};if(await g.pathExists(e.contractPath)&&await g.pathExists(s)){let[d,f]=await Promise.all([g.readJson(e.contractPath),g.readJson(s)]);if(c$1(d)===c$1(e.contract)&&c$1(f)===c$1(n))return}b$1(C,e.contract),b$1(o,n),await c(e.workspacePath,C,async()=>{let[d,f]=await Promise.all([q(e.contractPath),q(s)]);try{if(e.contractPath===a$2(e.workspacePath,C)?await e$1(e.workspacePath,C,e.contract):(await g.ensureDir(m.dirname(e.contractPath)),await g.writeJson(e.contractPath,e.contract,{spaces:2})),process.env.WORKSPAI_TEST_FAIL_WORKSPACE_REGISTRY_PUBLISH==="1")throw new Error("Injected workspace registry summary publication failure.");await e$1(e.workspacePath,o,n);}catch(u){let a=(await Promise.allSettled([B(e.contractPath,d),B(s,f)])).filter(i=>i.status==="rejected");throw a.length>0?new AggregateError([u,...a.map(i=>i.reason)],"Workspace contract publication failed and rollback was incomplete."):u}});}async function ee(e){let t=e.contractPath??(await d(e.workspacePath,C)||a$2(e.workspacePath,C)),o=await g.readJson(t);return {contractPath:t,contract:o}}var me={metadata:[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json"],manifests:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","pyproject.toml","poetry.lock","requirements.txt","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","Gemfile","composer.json"],entrypoints:["src/main.ts","src/index.ts","src/app.ts","src/main.js","src/index.js","main.py","app/main.py","manage.py","main.go","cmd/main.go","Program.cs"],apiSpecifications:["openapi.yaml","openapi.yml","openapi.json","swagger.yaml","swagger.yml","swagger.json"],infrastructure:["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","k8s","kubernetes","terraform"],documentation:["README.md","ARCHITECTURE.md","CONTRIBUTING.md","docs"]};function ge(e,t){return t.externalPath?m.resolve(t.externalPath):m.resolve(e,t.relativePath)}async function fe(e){let t={metadata:[],manifests:[],entrypoints:[],apiSpecifications:[],infrastructure:[],documentation:[]};for(let[o,n]of Object.entries(me))for(let s of n)await g.pathExists(m.join(e,s))&&t[o].push(s);try{let o=await g.readdir(e,{withFileTypes:true});for(let n of o)n.isFile()&&(n.name.endsWith(".csproj")||n.name.endsWith(".sln"))&&t.manifests.push(n.name),n.isFile()&&n.name.endsWith(".tf")&&t.infrastructure.push(n.name);}catch{}for(let o of Object.values(t))o.sort((n,s)=>n.localeCompare(s));return t}function W(e){return !e||typeof e!="object"||Array.isArray(e)?[]:Object.keys(e).sort((t,o)=>t.localeCompare(o))}async function he(e){try{let t=await g.readJson(m.join(e,"package.json")),o={runtime:W(t.dependencies),development:W(t.devDependencies),peer:W(t.peerDependencies),optional:W(t.optionalDependencies)};return {...typeof t.name=="string"?{name:t.name}:{},...typeof t.version=="string"?{version:t.version}:{},...typeof t.private=="boolean"?{private:t.private}:{},scripts:W(t.scripts),dependencies:o,dependencyCount:new Set(Object.values(o).flat()).size}}catch{return}}async function ke(e){for(let t of [".env.example",".env.sample",".env.template"])try{return (await g.readFile(m.join(e,t),"utf8")).split(/\r?\n/).map(n=>n.trim()).filter(n=>n.length>0&&!n.startsWith("#")&&n.includes("=")).map(n=>n.slice(0,n.indexOf("=")).trim()).filter(n=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)).sort((n,s)=>n.localeCompare(s))}catch{}return []}function we(e,t){try{let o=w(e);if(o.engine!=="unknown")return o;let n=g.pathExistsSync(m.join(e,"package.json"))?"npm":g.pathExistsSync(m.join(e,"pyproject.toml"))?"python":g.pathExistsSync(m.join(e,"requirements.txt"))?"pip":"unknown";return {...o,engine:n,runtime:t.runtime??o.runtime,framework:t.framework??o.framework,frameworkDisplayName:t.framework??o.frameworkDisplayName}}catch{return {schemaVersion:1,scope:"project",projectRoot:null,engine:"unknown",runtime:"unknown",framework:"unknown",frameworkDisplayName:"Unknown",frameworkConfidence:"low",frameworkSupportTier:"observed",runtimeSupportTier:"observed",runtimeDoctorSupport:"observed",moduleSupport:false,fleetStages:[],localOnlyCommands:[],commandMap:{},supportedCommands:[],unsupportedCommands:[],globalCommands:[]}}}function Pe(e,t,o){let n=e.projects.map(s=>({id:s.slug,path:s.relativePath,runtime:s.runtime,framework:s.framework}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:t,nodes:n,edges:[],stats:{nodeCount:n.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:n.length,connectedNodeCount:0,density:0,edgeCoverageRatio:n.length===0?1:0,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:[{code:"graph.enrichment.failed",severity:"warning",message:o,recommendation:"Review project manifests and graph overrides, then rerun workspace contract graph."}]}}async function Ke(e){let{contractPath:t,contract:o}=await ee(e),n=e.now??new Date,s=n.toISOString(),c;try{let{inferWorkspaceDependencyGraph:r}=await import('./workspace-dependency-graph-23BI2HG7.js');c=await r({workspacePath:e.workspacePath,contract:o,now:n,model:{projects:o.projects.map(p=>({name:p.slug,path:p.relativePath,...p.externalPath?{absolutePath:p.externalPath}:{},...p.runtime?{runtime:p.runtime}:{},...p.framework?{framework:p.framework}:{},...p.framework?{kind:p.framework}:{}}))}});}catch(r){c=Pe(o,s,`Graph enrichment failed: ${r instanceof Error?r.message:String(r)}`);}let d=new Map(c.nodes.map(r=>[r.id,r.operationalProfile])),{buildWorkspaceKnowledgeGraph:f}=await import('./workspace-knowledge-graph-FE2NTZKV.js'),u=await f({workspacePath:e.workspacePath,workspace:o.workspace,contract:o,projectTopology:c,now:n,projects:o.projects.map(r=>({id:r.slug,path:r.relativePath,...r.externalPath?{absolutePath:r.externalPath}:{},...r.runtime?{runtime:r.runtime}:{},...r.framework?{framework:r.framework}:{},...r.kit?{kit:r.kit}:{}}))}),l=await Promise.all(o.projects.map(async r=>{let p=ge(e.workspacePath,r),[w,y,R]=await Promise.all([fe(p),he(p),ke(p)]),P=we(p,r);return {id:r.slug,label:r.slug,relativePath:r.relativePath,source:r.source,relationship:r.relationship,externalPath:r.externalPath,runtime:r.runtime??P.runtime,framework:r.framework??P.framework,kit:r.kit,modules:r.modules,ports:r.ports,apis:r.contracts.apis,owns:r.contracts.owns,env:[...new Set([...r.contracts.env,...R])].sort((re,oe)=>re.localeCompare(oe)),contracts:{owns:[...r.contracts.owns],apis:[...r.contracts.apis],publishes:[...r.contracts.publishes],consumes:[...r.contracts.consumes],dependsOn:[...r.contracts.dependsOn],env:[...r.contracts.env]},capabilities:{engine:P.engine,supportTier:P.frameworkSupportTier,runtimeSupportTier:P.runtimeSupportTier,doctorSupport:P.runtimeDoctorSupport,moduleSupport:P.moduleSupport,fleetStages:[...P.fleetStages],localOnlyCommands:[...P.localOnlyCommands],supportedCommands:[...P.supportedCommands]},files:w,...y?{package:y}:{},...d.get(r.slug)?{operationalProfile:d.get(r.slug)}:{}}})),a=new Set(l.map(r=>r.id)),i=new Map,k=[];for(let r of o.projects){for(let p of r.contracts.dependsOn||[])a.has(p)&&k.push({from:p,to:r.slug,type:"dependency",label:"dependsOn"});for(let p of r.contracts.publishes||[])i.has(p)||i.set(p,new Set),i.get(p)?.add(r.slug);}for(let r of o.projects)for(let p of r.contracts.consumes||[]){let w=i.get(p);if(w)for(let y of w)y!==r.slug&&k.push({from:y,to:r.slug,type:"event",label:p});}let h={schemaVersion:1,kind:"rapidkit.workspace.contract.graph",workspace:o.workspace,generatedAt:s,nodes:l.sort((r,p)=>r.id.localeCompare(p.id)),edges:k.sort((r,p)=>`${r.from}:${r.to}:${r.type}:${r.label}`.localeCompare(`${p.from}:${p.to}:${p.type}:${p.label}`)),dependencyGraph:c,knowledgeGraph:u,semantics:{legacyEdges:"producer-to-consumer",dependencyGraphEdges:"consumer-to-dependency"},summary:{projectCount:l.length,dependencyEdges:k.filter(r=>r.type==="dependency").length,eventEdges:k.filter(r=>r.type==="event").length,portCount:l.reduce((r,p)=>r+p.ports.length,0),apiCount:l.reduce((r,p)=>r+p.apis.length,0),relationshipEdges:c.stats.edgeCount,inferredEdges:c.stats.inferredEdges,authoritativeEdges:c.stats.authoritativeEdges,orphanProjects:c.stats.orphanCount,hotspotProjects:c.stats.hotspotCount,evidenceCoverageRatio:c.stats.evidenceCoverageRatio,edgeCoverageRatio:c.stats.edgeCoverageRatio,connectedProjects:c.stats.connectedNodeCount,lowConfidenceEdges:c.stats.lowConfidenceEdges,hasCycle:c.stats.hasCycle,manifestCount:l.reduce((r,p)=>r+p.files.manifests.length,0),entrypointCount:l.reduce((r,p)=>r+p.files.entrypoints.length,0),diagnostics:c.diagnostics?.length??0,relationshipKinds:Object.fromEntries(L.map(r=>[r,c.edges.filter(p=>p.kind===r).length])),relationshipSources:Object.fromEntries(U.map(r=>[r,c.edges.filter(p=>p.source===r).length])),entityCount:u.quality.entityCount,knowledgeRelations:u.quality.relationCount,proofCount:u.quality.proofCount,providerCount:u.providers.length,knowledgeUnknowns:u.quality.unknownCount}};return {contractPath:t,graph:h}}async function te(e){let t=e.contract?{contractPath:e.contractPath??a$2(e.workspacePath,C),contract:e.contract}:await ee(e),{contractPath:o,contract:n}=t,s=[],c=[];n.kind!=="rapidkit.workspace.contract"&&s.push("Contract kind must be rapidkit.workspace.contract."),n.schemaVersion!==v&&s.push(`Contract schemaVersion must be ${v}.`),n.workspace?.name||s.push("Contract workspace.name is required."),Array.isArray(n.projects)||s.push("Contract projects must be an array.");let d=new Set,f=new Map;for(let a of n.projects||[]){if(!a.slug){s.push("Every project must declare slug.");continue}d.has(a.slug)&&s.push(`Duplicate project slug: ${a.slug}.`),d.add(a.slug),a.relativePath?O(a.relativePath)||s.push(`Project ${a.slug} declares unsafe relativePath: ${a.relativePath}.`):s.push(`Project ${a.slug} must declare relativePath.`),a.externalPath&&(a.relationship==="adopted"||a.source==="adopted-local"||a.source==="local-folder"||a.source==="git-url"||s.push(`Project ${a.slug} declares externalPath without imported/adopted provenance.`),m.isAbsolute(a.externalPath)||s.push(`Project ${a.slug} declares non-absolute externalPath.`));for(let i of a.ports||[]){(!Number.isInteger(i.port)||i.port<1||i.port>65535)&&s.push(`Project ${a.slug} declares invalid port: ${i.port}.`);let k=f.get(i.port);k&&s.push(`Port ${i.port} is claimed by both ${k} and ${a.slug}.`),f.set(i.port,a.slug);}for(let i of a.contracts?.apis||[])(!i.name?.trim()||!i.basePath?.startsWith("/"))&&s.push(`Project ${a.slug} declares invalid API contract.`);for(let i of [...a.contracts?.publishes||[],...a.contracts?.consumes||[]])i.trim()||s.push(`Project ${a.slug} declares an empty event contract.`);for(let i of a.contracts?.env||[])/^[A-Z_][A-Z0-9_]*$/.test(i)||s.push(`Project ${a.slug} declares invalid env contract: ${i}.`);for(let i of a.contracts?.dependsOn||[])d.has(i);}for(let a of n.projects||[])for(let i of a.contracts?.dependsOn||[])d.has(i)||s.push(`Project ${a.slug} depends on unknown project: ${i}.`);c.push({id:"schema",status:n.kind==="rapidkit.workspace.contract"&&n.schemaVersion===v?"passed":"failed",message:"Contract schema and kind are valid."}),c.push({id:"projects",status:Array.isArray(n.projects)?"passed":"failed",message:`Contract declares ${Array.isArray(n.projects)?n.projects.length:0} project(s).`}),c.push({id:"ports",status:s.some(a=>a.toLowerCase().includes("port"))?"failed":"passed",message:"Project port declarations are valid and collision-free."}),c.push({id:"dependencies",status:s.some(a=>a.includes("depends on unknown project"))?"failed":"passed",message:"Project dependencies point to known project slugs."}),c.push({id:"contracts",status:s.some(a=>a.includes("unsafe relativePath")||a.includes("invalid API contract")||a.includes("event contract")||a.includes("env contract"))?"failed":"passed",message:"Project path, API, event, and env contracts are valid."});let u=await l(e.workspacePath);if(u.moduleCount>0){for(let a of u.issues)s.push(`${m.basename(a.projectRoot)}: ${a.message} (slug=${a.slug})`);c.push({id:"module-paths",status:u.status,message:u.status==="passed"?`All ${u.moduleCount} registered module(s) resolve under canonical paths.`:`${u.issues.length} registered module(s) missing canonical install paths.`});}else e.strict&&c.push({id:"module-paths",status:"passed",message:"No registry-backed modules declared in workspace projects."});return {status:s.length>0?"failed":"passed",contractPath:o,projectCount:Array.isArray(n.projects)?n.projects.length:0,checks:c,violations:s}}async function $e(e){let t=m.resolve(e.workspacePath),o={schemaVersion:se,generatedAt:e.generatedAt??new Date().toISOString(),status:e.result.status,contractPath:e.result.contractPath,projectCount:e.result.projectCount,checks:e.result.checks,violations:e.result.violations};return e$1(t,ae,M(o))}
2
+ export{M as a,be as b,L as c,C as d,ae as e,v as f,se as g,j as h,de as i,Q as j,Te as k,Ve as l,ee as m,Ke as n,te as o,$e as p};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-5AKYMAIL.js';var r=".workspai/skills";var e=a$1.skillsIndex,a=a$1.explain,_=".workspai/reports/workspace-why-last-run.json",c=".workspai/reports/workspace-trace-last-run.json",O=".workspai/AGENT-GROUNDING.md",P=".rapidkit/AGENT-GROUNDING.md",I=".cursor/rules/workspai-grounding.mdc",A=".cursor/rules/rapidkit-grounding.mdc",T=".claude/rules/workspai-evidence.md",E=".claude/rules/rapidkit-evidence.md",R=".github/instructions/workspai-workspace.instructions.md",L=".github/instructions/rapidkit-workspace.instructions.md",d=".github/instructions/workspai-evidence.instructions.md",S=".github/instructions/rapidkit-evidence.instructions.md",C=".github/prompts/workspai-diagnose.prompt.md",k=".github/prompts/rapidkit-diagnose.prompt.md",l=".github/prompts/workspai-repair.prompt.md",m=".github/prompts/rapidkit-repair.prompt.md",N=".github/prompts/workspai-release-readiness.prompt.md",u=".github/prompts/rapidkit-release-readiness.prompt.md",g=".github/prompts/workspai-project-onboard.prompt.md",K=".github/prompts/rapidkit-project-onboard.prompt.md",G=".github/prompts/workspai-adopt-project.prompt.md",w=".github/prompts/rapidkit-adopt-project.prompt.md",x=".github/skills/workspai-grounding/SKILL.md",H=".github/skills/rapidkit-grounding/SKILL.md",D=".github/skills/workspai-workspace-intelligence/SKILL.md",W=".github/skills/rapidkit-workspace-intelligence/SKILL.md",h=".workspai/reports/workspai-mcp-design.json",U=".workspai/reports/rapidkit-mcp-design.json",b=".vscode/workspai-agent-hooks.json",Y=".vscode/rapidkit-agent-hooks.json";function M(t){let s=t.trim();if(!s||s.includes("..")||s.includes("/"))throw new Error(`Invalid operational skill id: ${t}`);return `${r}/${s}.md`}var f={"workspai-diagnose-api-failure":"workspai-diagnose","workspai-release-readiness":"workspai-release-readiness","workspai-safe-schema-migration":"workspai-safe-schema-migration","workspai-dependency-upgrade":"workspai-dependency-upgrade","workspai-rename-contract":"workspai-rename-contract"};export{H as A,D as B,W as C,h as D,U as E,b as F,Y as G,M as H,f as I,r as a,e as b,a as c,_ as d,c as e,O as f,P as g,I as h,A as i,T as j,E as k,R as l,L as m,d as n,S as o,C as p,k as q,l as r,m as s,N as t,u,g as v,K as w,G as x,w as y,x as z};
1
+ import {a as a$1}from'./chunk-LNRAB7UY.js';var r=".workspai/skills";var e=a$1.skillsIndex,a=a$1.explain,_=".workspai/reports/workspace-why-last-run.json",c=".workspai/reports/workspace-trace-last-run.json",O=".workspai/AGENT-GROUNDING.md",P=".rapidkit/AGENT-GROUNDING.md",I=".cursor/rules/workspai-grounding.mdc",A=".cursor/rules/rapidkit-grounding.mdc",T=".claude/rules/workspai-evidence.md",E=".claude/rules/rapidkit-evidence.md",R=".github/instructions/workspai-workspace.instructions.md",L=".github/instructions/rapidkit-workspace.instructions.md",d=".github/instructions/workspai-evidence.instructions.md",S=".github/instructions/rapidkit-evidence.instructions.md",C=".github/prompts/workspai-diagnose.prompt.md",k=".github/prompts/rapidkit-diagnose.prompt.md",l=".github/prompts/workspai-repair.prompt.md",m=".github/prompts/rapidkit-repair.prompt.md",N=".github/prompts/workspai-release-readiness.prompt.md",u=".github/prompts/rapidkit-release-readiness.prompt.md",g=".github/prompts/workspai-project-onboard.prompt.md",K=".github/prompts/rapidkit-project-onboard.prompt.md",G=".github/prompts/workspai-adopt-project.prompt.md",w=".github/prompts/rapidkit-adopt-project.prompt.md",x=".github/skills/workspai-grounding/SKILL.md",H=".github/skills/rapidkit-grounding/SKILL.md",D=".github/skills/workspai-workspace-intelligence/SKILL.md",W=".github/skills/rapidkit-workspace-intelligence/SKILL.md",h=".workspai/reports/workspai-mcp-design.json",U=".workspai/reports/rapidkit-mcp-design.json",b=".vscode/workspai-agent-hooks.json",Y=".vscode/rapidkit-agent-hooks.json";function M(t){let s=t.trim();if(!s||s.includes("..")||s.includes("/"))throw new Error(`Invalid operational skill id: ${t}`);return `${r}/${s}.md`}var f={"workspai-diagnose-api-failure":"workspai-diagnose","workspai-release-readiness":"workspai-release-readiness","workspai-safe-schema-migration":"workspai-safe-schema-migration","workspai-dependency-upgrade":"workspai-dependency-upgrade","workspai-rename-contract":"workspai-rename-contract"};export{H as A,D as B,W as C,h as D,U as E,b as F,Y as G,M as H,f as I,r as a,e as b,a as c,_ as d,c as e,O as f,P as g,I as h,A as i,T as j,E as k,R as l,L as m,d as n,S as o,C as p,k as q,l as r,m as s,N as t,u,g as v,K as w,G as x,w as y,x as z};
@@ -0,0 +1,2 @@
1
+ import {b}from'./chunk-YCL3I2JO.js';import {r,s}from'./chunk-5XATWNME.js';import c from'path';import {randomUUID}from'crypto';import {open}from'fs/promises';import i from'fs-extra';function x(e,t){let s=c.resolve(e),r=t.trim();if(!r||c.isAbsolute(r))throw new Error(`Workspace artifact path must be non-empty and relative: ${t}`);let l=c.resolve(s,r),a=c.relative(s,l);if(a===".."||a.startsWith(`..${c.sep}`)||c.isAbsolute(a))throw new Error(`Workspace artifact path escapes workspace root: ${t}`);return l}function p(e,t){return x(e,r(t))}function $(e,t){return x(e,s(t))}async function W(e,t){let s=c.resolve(e);await i.ensureDir(s);let r=c.dirname(t);await i.ensureDir(r);let[l,a]=await Promise.all([i.realpath(s),i.realpath(r)]),o=c.relative(l,a);if(o===".."||o.startsWith(`..${c.sep}`)||c.isAbsolute(o))throw new Error(`Workspace artifact parent resolves outside workspace root: ${r}`)}async function M(e,t){let s=c.resolve(e),[r,l]=await Promise.all([i.realpath(s),i.realpath(t)]),a=c.relative(r,l);if(a===".."||a.startsWith(`..${c.sep}`)||c.isAbsolute(a))throw new Error(`Workspace artifact resolves outside workspace root: ${t}`)}function R(e){let t=e?.code;return process.platform==="win32"&&(t==="EPERM"||t==="EINVAL"||t==="ENOSYS")}async function T(e){try{await e.sync();}catch(t){if(!R(t))throw t}}async function y(e,t,s){await W(e,t);let r=c.dirname(t),l=`${c.basename(t)}.`,a=Date.now();for(let w of await i.readdir(r)){if(!w.startsWith(l)||!w.endsWith(".tmp"))continue;let f=c.join(r,w),n=await i.stat(f).catch(()=>null);n&&a-n.mtimeMs>3e4&&await i.remove(f).catch(()=>{});}let o=`${t}.${process.pid}.${randomUUID()}.tmp`;try{await s(o);let w=await open(o,"r");try{await T(w);}finally{await w.close();}let f=Number(process.env.WORKSPAI_TEST_ATOMIC_WRITE_DELAY_MS??0);Number.isFinite(f)&&f>0&&await new Promise(n=>setTimeout(n,Math.min(f,3e4)));try{await i.rename(o,t);}catch(n){let d=n.code;if(d!=="EEXIST"&&d!=="EPERM")throw n;await i.move(o,t,{overwrite:true});}}finally{await i.remove(o).catch(()=>{});}}async function _(e,t,s,r={}){let l=p(e,t);await W(e,l);let a=`${l}.lock`,o=r.timeoutMs??1e4,w=r.staleAfterMs??3e4,f=Date.now(),n;for(;!n;)try{n=await open(a,"wx"),await n.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
2
+ `),await T(n);}catch(d){if(d.code!=="EEXIST")throw n&&(await n.close().catch(()=>{}),n=void 0,await i.remove(a).catch(()=>{})),d;let[A,S]=await Promise.all([i.stat(a).catch(()=>null),i.readJson(a).catch(()=>null)]),u=Number(S?.pid),m=Number.isInteger(u)&&u>0,h=false;if(m)try{process.kill(u,0),h=true;}catch(g){h=g.code==="EPERM";}let I=!m&&!!(A&&Date.now()-A.mtimeMs>w);if(m&&!h||I){await i.remove(a).catch(()=>{});continue}if(Date.now()-f>=o)throw new Error(`Timed out waiting for workspace artifact lock: ${t}`);await new Promise(g=>setTimeout(g,20));}try{return await s()}finally{await n.close().catch(()=>{}),await i.remove(a).catch(()=>{});}}async function z(e,t){let s=[p(e,t),$(e,t)];for(let r of s)if(await i.pathExists(r))return await M(e,r),r;return null}async function B(e,t,s){b(t,s);let r=p(e,t);return await y(e,r,l=>i.writeJson(l,s,{spaces:2})),r}async function H(e,t,s){if(s.length===0)return [];let r=s.map(a=>({...a,path:p(e,a.relativePath)})),l=r.find((a,o)=>r.findIndex(w=>w.path===a.path)!==o);if(l)throw new Error(`Duplicate workspace artifact transaction target: ${l.relativePath}`);for(let a of r)b(a.relativePath,a.payload);return _(e,t,async()=>{let a=await Promise.all(r.map(async o=>({path:o.path,exists:await i.pathExists(o.path),contents:await i.readFile(o.path).catch(()=>null)})));try{for(let o=0;o<r.length;o+=1){let w=r[o];await y(e,w.path,n=>i.writeJson(n,w.payload,{spaces:2}));let f=Number(process.env.WORKSPAI_TEST_FAIL_ARTIFACT_SET_AFTER??0);if(Number.isInteger(f)&&f===o+1)throw new Error(`Injected artifact-set failure after ${f} write(s).`)}return r.map(o=>o.path)}catch(o){let f=(await Promise.allSettled(a.map(async n=>{if(!n.exists||n.contents===null){await i.remove(n.path);return}await y(e,n.path,d=>i.writeFile(d,n.contents));}))).filter(n=>n.status==="rejected");throw f.length>0?new AggregateError([o,...f.map(n=>n.reason)],"Workspace artifact transaction failed and rollback was incomplete."):o}})}export{p as a,$ as b,_ as c,z as d,B as e,H as f};
@@ -0,0 +1 @@
1
+ var i="workspai-workspace-archive-capabilities-v1",r="workspai-workspace-archive-manifest-v1",s="workspai-workspace-archive-operation-result-v1";var a="contracts/workspace-archive-manifest.v1.json",o="contracts/workspace-archive-operation-result.v1.json",n={archiveCompression:{signature:"--archive-compression <mode>",description:"Archive compression: store (default) or deflate",appliesTo:["export"]},maxDownloadSize:{signature:"--max-download-size <size>",description:"Maximum remote archive download size (secure default: 5gb)",appliesTo:["inspect","verify","doctor","hydrate"]},maxExpandedSize:{signature:"--max-expanded-size <size>",description:"Maximum expanded archive payload size (secure default: 20gb)",appliesTo:["inspect","verify","doctor","hydrate"]},downloadTimeoutMs:{signature:"--download-timeout-ms <ms>",description:"Remote archive download timeout in milliseconds; 0 disables it",appliesTo:["inspect","verify","doctor","hydrate"]},allowPrivateNetwork:{signature:"--allow-private-network",description:"Allow archive downloads from loopback/private networks (unsafe for untrusted input)",appliesTo:["inspect","verify","doctor","hydrate"]}};export{i as a,r as b,s as c,a as d,o as e,n as f};