workspai 0.70.0 → 0.72.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 (108) hide show
  1. package/README.md +43 -80
  2. package/contracts/artifact-remediation-plan.v1.json +49 -0
  3. package/contracts/workspace-intelligence/goal-lifecycle-result.v1.json +19 -0
  4. package/contracts/workspace-repair-capabilities.v1.json +7 -1
  5. package/dist/analyze-5ENZTHOT.js +1 -0
  6. package/dist/{artifact-remediation-plan-URQL5MBN.js → artifact-remediation-plan-WDK5ISRU.js} +1 -1
  7. package/dist/autopilot-release-PNSWAVZG.js +1 -0
  8. package/dist/{chunk-EP6Q2QBU.js → chunk-2RF75G5T.js} +1 -1
  9. package/dist/{chunk-4R7STECB.js → chunk-5OLNT6YD.js} +63 -63
  10. package/dist/{chunk-GED7JURY.js → chunk-5PFFR5S7.js} +1 -1
  11. package/dist/{chunk-QZODGRAI.js → chunk-5TKRCE6F.js} +1 -1
  12. package/dist/{chunk-IGJA6GBQ.js → chunk-62YBFWHY.js} +1 -1
  13. package/dist/chunk-6WOFOOM7.js +7 -0
  14. package/dist/{chunk-ZLCLGIM6.js → chunk-7LKCWDX6.js} +1 -1
  15. package/dist/chunk-7Q7X4X5I.js +1 -0
  16. package/dist/chunk-BVWDG66W.js +1 -0
  17. package/dist/{chunk-DNZHKBQ3.js → chunk-COBU44T5.js} +1 -1
  18. package/dist/chunk-CQBM6BBP.js +2 -0
  19. package/dist/chunk-CY4QZ3PE.js +3 -0
  20. package/dist/{chunk-LE2I2E6R.js → chunk-D5RUGSBC.js} +2 -2
  21. package/dist/chunk-EDPUQXP6.js +5 -0
  22. package/dist/{chunk-IBJEQHJR.js → chunk-HV6EQMUJ.js} +24 -7
  23. package/dist/{chunk-V52R2W2Q.js → chunk-IX5Z6EK6.js} +1 -1
  24. package/dist/{chunk-N6FJZ62B.js → chunk-JQINCVK5.js} +1 -1
  25. package/dist/{chunk-GL3KLNIG.js → chunk-KVPTZMEV.js} +1 -1
  26. package/dist/{chunk-UT57IFS4.js → chunk-LDNX2R6V.js} +6 -6
  27. package/dist/{chunk-WUXJCSYO.js → chunk-LLEKVSMX.js} +1 -1
  28. package/dist/{chunk-ZPOZ6MDX.js → chunk-N2PAAQKI.js} +1 -1
  29. package/dist/{chunk-S2TOSHQW.js → chunk-ONV6WW7A.js} +1 -1
  30. package/dist/{chunk-TEMFNVO2.js → chunk-QVUVJU56.js} +1 -1
  31. package/dist/{chunk-AGZWDYMF.js → chunk-QYXX6G5O.js} +8 -8
  32. package/dist/{chunk-S42KDOGG.js → chunk-S66NO5BX.js} +1 -1
  33. package/dist/{chunk-KFTJVVJR.js → chunk-SATPH22S.js} +1 -1
  34. package/dist/{chunk-IFHM2SI6.js → chunk-SG3QRCMM.js} +1 -1
  35. package/dist/{chunk-Z7JIUA6I.js → chunk-SS7X2YF5.js} +1 -1
  36. package/dist/{chunk-IET57ZKN.js → chunk-T6KHOIEY.js} +1 -1
  37. package/dist/{chunk-TLMP2MGH.js → chunk-T6LCDLJ7.js} +1 -1
  38. package/dist/{chunk-QNHKUSBH.js → chunk-TDQ2PRHV.js} +1 -1
  39. package/dist/{chunk-3S2U7WRM.js → chunk-TQQEZQLC.js} +1 -1
  40. package/dist/{chunk-LU6CYDLN.js → chunk-UHAPXPGW.js} +1 -1
  41. package/dist/chunk-V4LCPLV6.js +1 -0
  42. package/dist/{chunk-GYN6RPNU.js → chunk-WMC2H7MJ.js} +1 -1
  43. package/dist/{chunk-PTSEDZIV.js → chunk-WPZUKU2B.js} +1 -1
  44. package/dist/chunk-X5ZNFXFI.js +1 -0
  45. package/dist/{create-BBALBC3U.js → create-7CWWGDXQ.js} +1 -1
  46. package/dist/{doctor-WWVY7NB6.js → doctor-WYBSI3GC.js} +1 -1
  47. package/dist/{dotnet-webapi-clean-XL4IBUQV.js → dotnet-webapi-clean-VJX6SGGP.js} +39 -33
  48. package/dist/{goal-lifecycle-CEUTKUNV.js → goal-lifecycle-PSPYQ4TR.js} +1 -1
  49. package/dist/{goal-pack-JQL3YOKT.js → goal-pack-G7SAYDIC.js} +1 -1
  50. package/dist/{gofiber-standard-OHHMCNMJ.js → gofiber-standard-I6ASLOEE.js} +77 -66
  51. package/dist/{gogin-standard-BAZXPOKL.js → gogin-standard-U2LSRLIP.js} +78 -67
  52. package/dist/index.js +121 -121
  53. package/dist/{pipeline-V46WWMP4.js → pipeline-NDV7DBB7.js} +1 -1
  54. package/dist/{project-agent-entry-MRAYG7QD.js → project-agent-entry-HEBGPLMX.js} +1 -1
  55. package/dist/{project-intelligence-lens-4BKPN4PE.js → project-intelligence-lens-QTQEZXUY.js} +1 -1
  56. package/dist/{project-test-coverage-4RRCHY5W.js → project-test-coverage-4BGDDBBL.js} +1 -1
  57. package/dist/{proof-carrying-change-B7ONTBYO.js → proof-carrying-change-SHO2E3DX.js} +1 -1
  58. package/dist/{rust-axum-CCJ6UCBW.js → rust-axum-JMV7UPO7.js} +25 -20
  59. package/dist/{springboot-standard-M5JQEJML.js → springboot-standard-OC2RS3KC.js} +41 -39
  60. package/dist/verified-goal-BSREU6R7.js +1 -0
  61. package/dist/{workspace-FJ6JRYWA.js → workspace-E3MM3AIE.js} +1 -1
  62. package/dist/{workspace-agent-sync-V33UGII3.js → workspace-agent-sync-NBIOSXCG.js} +1 -1
  63. package/dist/{workspace-context-O6UBCBEA.js → workspace-context-ZDXF6S7S.js} +1 -1
  64. package/dist/{workspace-contract-S2JYDA4K.js → workspace-contract-E7GVWM7W.js} +1 -1
  65. package/dist/{workspace-explain-RP6VJ6QM.js → workspace-explain-YB66UFAS.js} +1 -1
  66. package/dist/{workspace-foundation-7QXEJJKZ.js → workspace-foundation-LRLYPR36.js} +1 -1
  67. package/dist/{workspace-graph-stream-YY65R5EC.js → workspace-graph-stream-SJUCBPS4.js} +1 -1
  68. package/dist/workspace-graph-token-efficiency-BTIS6JXL.js +1 -0
  69. package/dist/{workspace-intelligence-LMR42ICR.js → workspace-intelligence-3IAAM3H3.js} +1 -1
  70. package/dist/{workspace-intelligence-benchmark-S5OXVNLC.js → workspace-intelligence-benchmark-UCGDKMDF.js} +1 -1
  71. package/dist/{workspace-intelligence-runner-FXFSTCHC.js → workspace-intelligence-runner-FPPKTSNK.js} +1 -1
  72. package/dist/{workspace-knowledge-graph-3564KQXT.js → workspace-knowledge-graph-WNQMNAVL.js} +1 -1
  73. package/dist/{workspace-knowledge-graph-query-WHCGPBGS.js → workspace-knowledge-graph-query-3GPXGWYN.js} +1 -1
  74. package/dist/workspace-knowledge-graph-snapshot-MTFTCVFF.js +1 -0
  75. package/dist/{workspace-mcp-serve-ZK46EZUD.js → workspace-mcp-serve-KSZ2O66S.js} +1 -1
  76. package/dist/{workspace-model-6UMQAGUK.js → workspace-model-5FA2636K.js} +1 -1
  77. package/dist/{workspace-onboarding-C57OQ7XZ.js → workspace-onboarding-RJMTHN7Z.js} +1 -1
  78. package/dist/{workspace-registry-summary-GLQO4ZUF.js → workspace-registry-summary-WKENOFEA.js} +1 -1
  79. package/dist/workspace-repair-engine-4JTNNDZL.js +3 -0
  80. package/dist/workspace-run-HFOY2UYT.js +1 -0
  81. package/dist/{workspace-verify-LQHXBH2D.js → workspace-verify-37QL2JYE.js} +1 -1
  82. package/dist/{workspace-watch-Z32443UP.js → workspace-watch-P5X6TAFK.js} +1 -1
  83. package/docs/README.md +5 -2
  84. package/docs/README_CONTENT_CONTRACT.md +14 -9
  85. package/docs/ci-workflows.md +1 -1
  86. package/docs/commands-reference.md +53 -34
  87. package/docs/contracts/ARTIFACT_CATALOG.md +4 -1
  88. package/docs/doctor-command.md +13 -0
  89. package/docs/native-kit-baselines.md +82 -0
  90. package/docs/workspace-knowledge-graph.md +17 -2
  91. package/docs/workspace-repair-engine.md +9 -1
  92. package/docs/workspace-run.md +29 -0
  93. package/package.json +1 -1
  94. package/dist/analyze-OGWDSPXQ.js +0 -1
  95. package/dist/autopilot-release-QQDFEPT7.js +0 -1
  96. package/dist/chunk-DWL3PPLA.js +0 -1
  97. package/dist/chunk-EZPLMAW2.js +0 -1
  98. package/dist/chunk-IHKG5C6G.js +0 -1
  99. package/dist/chunk-IRLKWRLP.js +0 -3
  100. package/dist/chunk-TKXRP2B4.js +0 -1
  101. package/dist/chunk-U5ENEDJA.js +0 -7
  102. package/dist/chunk-WCJU3CFG.js +0 -1
  103. package/dist/chunk-XSSNM4F5.js +0 -5
  104. package/dist/verified-goal-YNSBL7L3.js +0 -1
  105. package/dist/workspace-graph-token-efficiency-WNAFAN2F.js +0 -1
  106. package/dist/workspace-knowledge-graph-snapshot-P27RPMV5.js +0 -1
  107. package/dist/workspace-repair-engine-5ZSSF3T5.js +0 -3
  108. package/dist/workspace-run-UGWGT3K2.js +0 -1
@@ -1,34 +1,5 @@
1
1
  # Commands Reference
2
2
 
3
- ## Live cross-terminal activity
4
-
5
- ```bash
6
- workspai live [target]
7
- workspai live --global [--max-scopes <count>]
8
- workspai live --run <run-id>
9
- workspai live --once --json
10
- workspai live --once --json --projection monitor|board
11
- workspai live --no-motion --no-color
12
- workspai live --ascii|--accessible|--classic
13
- workspai live --capture <file.svg> [--capture-preset github|linkedin|x|square|wide]
14
- workspai live --replay <run-id> [--replay-speed <0.25..64>]
15
- ```
16
-
17
- `workspai live` observes versioned run/block/activity journals emitted by every
18
- Workspai CLI command in the same project or workspace. It works without
19
- `adopt`; adoption adds workspace correlation and cross-project intelligence.
20
- Its default TTY surface is a bounded interactive Flow Board with live block and
21
- edge state, durable per-block retry attempts, semantic phase rails, an adaptive
22
- Inspector, a deduplicated multi-workspace Fleet Cockpit, deterministic
23
- redacted-by-default SVG capture, durable replay, responsive compaction and
24
- changed-row rendering. Use `--accessible` for stable screen-reader output or
25
- `--classic` for the compatibility line view.
26
- `--projection board` exposes the same bounded renderer-neutral run/node/edge
27
- model used by the terminal and SVG adapters, so IDE and web consumers do not
28
- need to reconstruct topology from raw events. The default `monitor` projection
29
- is backward compatible.
30
- See [Workspai Live Activity](./workspace-live-activity.md).
31
-
32
3
  Human-readable CLI syntax for the Workspai CLI. The machine-complete command,
33
4
  argument, option, alias, ownership, and integrity inventory is available through
34
5
  `workspai commands --json` and
@@ -51,6 +22,38 @@ project`, and a complete ownership-grouped command map. Scoped help carries
51
22
  exact flags and examples. `commands --json` remains the machine-complete
52
23
  inventory used to prevent the human map from drifting.
53
24
 
25
+ ## Start with the core loop
26
+
27
+ ```bash
28
+ npx workspai adopt .
29
+ npx workspai workspace intelligence run --for-agent generic --strict --json
30
+ npx workspai goal "Describe the required outcome" --for-agent generic
31
+ npx workspai agent bootstrap --for-agent generic --strict --json
32
+ ```
33
+
34
+ For source-changing work, continue through `change begin`, bounded
35
+ authorization, effect receipts, independent verification, and capsule
36
+ validation. For exact syntax, see the lifecycle section below.
37
+
38
+ ## Live cross-terminal activity
39
+
40
+ ```bash
41
+ workspai live [target]
42
+ workspai live --global [--max-scopes <count>]
43
+ workspai live --run <run-id>
44
+ workspai live --once --json --projection monitor|board
45
+ workspai live --ascii|--accessible|--classic
46
+ workspai live --capture <file.svg> [--capture-preset github|linkedin|x|square|wide]
47
+ workspai live --replay <run-id> [--replay-speed <0.25..64>]
48
+ ```
49
+
50
+ `workspai live` observes versioned activity emitted by CLI and Studio without
51
+ changing command outcomes or upgrading telemetry into verification proof. The
52
+ default TTY is an interactive Flow Board; the `board` JSON projection is the
53
+ shared renderer-neutral surface for IDE, web, replay, and capture consumers.
54
+ Use `--accessible` for stable screen-reader output and `--classic` for the
55
+ compatibility view. See [Workspai Live Activity](./workspace-live-activity.md).
56
+
54
57
  ## Workspace lifecycle
55
58
 
56
59
  ```bash
@@ -71,10 +74,12 @@ npx workspai change authorize --change <change-id> --effects <classes> [--grante
71
74
  npx workspai change effect record --change <change-id> --file <effect-receipt.json> [--workspace <path>] [--json]
72
75
  npx workspai change verify --change <change-id> [--strict] [--no-refresh] [--workspace <path>] [--json]
73
76
  npx workspai change verification record --change <change-id> --file <verification-receipt.json> [--workspace <path>] [--json]
74
- npx workspai change <status|explain> --change <change-id> [--workspace <path>] [--json]
77
+ npx workspai change status --change <change-id> [--workspace <path>] [--json]
78
+ npx workspai change explain --change <change-id> [--workspace <path>] [--json]
75
79
  npx workspai change resume --change <change-id> --to <authorized|executing|verifying> --reason <text> [--actor <identity>] [--json]
76
80
  npx workspai change abort --change <change-id> --reason <text> [--actor <identity>] [--json]
77
- npx workspai change capsule <validate|export> --change <change-id> [--output <path>] [--json]
81
+ npx workspai change capsule validate --change <change-id> [--workspace <path>] [--json]
82
+ npx workspai change capsule export --change <change-id> --output <path> [--workspace <path>] [--json]
78
83
  npx workspai agent bootstrap [--project <path>] [--for-agent <host>] [--no-live-inputs] [--strict] [--json]
79
84
  ```
80
85
 
@@ -135,7 +140,7 @@ npx workspai workspace snapshot [--workspace <path>] [--json] [--include-paths]
135
140
  npx workspai workspace diff --from <snapshot-or-model|git[:ref]> [--workspace <path>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>] [--strict]
136
141
  npx workspai workspace impact --from <workspace-diff-report> [--workspace <path>] [--scope project:<name>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>] [--strict]
137
142
  npx workspai workspace verify [--from-impact <file>] [--workspace <path>] [--scope project:<name>] [--strict] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
138
- npx workspai workspace graph [emit|explain|search|benchmark|entities|evidence|path|overlay|dot|mermaid|jsonld|graphml|gexf] [key] [value] [--from <graph.json>] [--output <file>] [--limit <1..100>] [--kind <entity-kind>] [--workspace <path>] [--scope project:<name>] [--refresh-graph] [--graph-inventory-limit <count>] [--graph-semantic-budget <count>] [--graph-deep-budget <count>] [--graph-source-budget <count>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
143
+ npx workspai workspace graph [emit|explain|search|benchmark|benchmark-suite|entities|evidence|path|overlay|dot|mermaid|jsonld|graphml|gexf] [key] [value] [--from <graph.json>] [--output <file>] [--limit <1..100>] [--kind <entity-kind>] [--workspace <path>] [--scope project:<name>] [--refresh-graph] [--graph-inventory-limit <count>] [--graph-semantic-budget <count>] [--graph-deep-budget <count>] [--graph-source-budget <count>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
139
144
  npx workspai workspace eval [init <task> [strategy]|record|status|report|compare --from <report>] [--workspace <path>] [--output <file>] [--json]
140
145
  npx workspai workspace watch [--workspace <path>] [--json] [--graph-stream] [--once] [--scan-depth <count>]
141
146
  npx workspai workspace explain <target> [--workspace <path>] [--json] [--write]
@@ -296,7 +301,9 @@ complete graph. New responses also expose `graphSourceHash`, allowing IDE and
296
301
  agent activity consumers to correlate returned entity/proof IDs only with the
297
302
  exact Graph revision that authored them. Ranking is deterministic and offline: it removes natural-language
298
303
  stopwords, weights rarer graph terms more strongly, and prefers exact labels and
299
- identities. `workspace graph benchmark <query> --limit <n> --json` compares
304
+ identities. Authored source ranks ahead of compiled, generated, vendored,
305
+ fixture, and test-data matches unless the query explicitly names one of those
306
+ surfaces. `workspace graph benchmark <query> --limit <n> --json` compares
300
307
  that retrieval payload with the readable proof-indexed corpus using a labelled
301
308
  `characters / 4` estimate. It measures payload reduction only; it does not
302
309
  assert equivalent answer quality or model-specific billing savings.
@@ -314,6 +321,9 @@ verified outcomes. See [Workspace Intelligence Benchmark](./workspace-intelligen
314
321
 
315
322
  Add `--scope project:<name>` to retrieve project-owned facts plus
316
323
  workspace-level shared entities proven to be connected to that project. The
324
+ same scope constrains exact entity aliases used by `graph evidence` and `graph
325
+ path`; a matching alias in another project cannot make a scoped target
326
+ ambiguous. The
317
327
  `search` mode also accepts `--kind <entity-kind>` so agents can retrieve a
318
328
  precise semantic surface such as `runtime-unit`, `endpoint`, or `owner`. The
319
329
  agent projection reports explicit omission budgets for relations, related
@@ -379,6 +389,12 @@ lifecycle units to `workspace run`; inspect them without execution using
379
389
  `workspace run <stage> --plan`, and select one runtime family with
380
390
  `--runtime <runtime>`.
381
391
 
392
+ For npm, pnpm, and Cargo monorepos, the owning workspace manifest represents its
393
+ matching members as one dependency-materialization boundary. Explicitly
394
+ registered nested projects remain independent, while aggregate parents do not
395
+ execute them a second time. Embedded eval, benchmark, integration, test-data,
396
+ and fixture manifests are excluded unless they expose real lifecycle evidence.
397
+
382
398
  Core module/template commands are intentionally narrower than runtime detection.
383
399
  RapidKit Core modules are guaranteed only for RapidKit Core module-enabled kits:
384
400
  `fastapi.standard`, `fastapi.ddd`, and `nestjs.standard`. They are not enabled
@@ -475,7 +491,10 @@ Supported keys: `mode`, `dependency_sharing_mode`, `rules.enforce_workspace_mark
475
491
 
476
492
  ## Setup and warm dependencies
477
493
 
478
- `setup <runtime>` validates toolchain and updates `.workspai/toolchain.lock`.
494
+ `setup <runtime>` validates an already installed host runtime and updates
495
+ `.workspai/toolchain.lock`. It does not install system runtimes. When the executable is missing,
496
+ the remediation plan emits an external prerequisite and blocks setup/bootstrap until fresh
497
+ environment evidence is available.
479
498
 
480
499
  `--warm-deps` adds optional dependency warm-up (Node lock/deps, Go modules). Warm-deps is non-fatal and reports `completed` / `failed` / `skipped`.
481
500
 
@@ -132,7 +132,10 @@ handoff for governance artifacts outside Doctor: Bootstrap compliance, Analyze,
132
132
  Pipeline, Workspace Run, Workspace Verify, and Doctor plan bridging. Consumers should ask npm for
133
133
  this plan before inventing per-card repair logic. The plan carries ordered actions, safe file
134
134
  operations where deterministic, refresh/verify commands, risk, approval state, and rollback
135
- strategy.
135
+ strategy. Each action can also declare typed executable/action requirements and a retry boundary.
136
+ The root `execution` projection identifies actions eligible in the current environment and one
137
+ canonical next action, so IDEs do not infer readiness from array order. Missing host tools produce
138
+ guidance plus blocked downstream actions; they are never advertised as executable.
136
139
 
137
140
  When `doctor project` runs inside a workspace, the project-local report is written beside the
138
141
  project and the workspace receives both a latest alias and a collision-safe project copy under
@@ -179,6 +179,12 @@ runtime health endpoint, database migrations, or an executable boot entrypoint
179
179
  are retained as explicit `not-applicable` evidence for non-deployable
180
180
  archetypes instead of becoming false warnings.
181
181
 
182
+ Frontend application-only probes follow the same rule. Framework config,
183
+ application source-tree, and application script checks are `not-applicable` for
184
+ libraries, SDKs, platforms, plugins, and monorepo roots. Tooling dependencies at
185
+ a private workspace root therefore do not create a false frontend application
186
+ or an irrelevant repair such as adding an application test script.
187
+
182
188
  The default terminal view is summary-first and uses portable boundaries such
183
189
  as `$WORKSPACE`, `$PROJECT`, and `external/<project>`. `--verbose` expands all
184
190
  probes and lifecycle capabilities. JSON continues to retain canonical absolute
@@ -575,6 +581,13 @@ These probes are intentionally evidence-first. Missing optional surfaces are sur
575
581
  or manual repair capabilities, while deterministic repairs are promoted into `--fix` only when the
576
582
  change is safe enough for Doctor to apply with approval and post-fix verification.
577
583
 
584
+ Runtime-dependent repairs are executable only when the required host tool can
585
+ actually launch from the governed working directory. Doctor and the Repair
586
+ executor use the same probe for Node, Python, Go, JVM, Rust, .NET, PHP, Ruby,
587
+ and other supported runtimes. An unavailable executable is represented as a
588
+ typed prerequisite with a blocking reason and retry policy; dependent setup or
589
+ dependency steps remain blocked until fresh evidence proves the prerequisite.
590
+
578
591
  Workspace scans are bounded and cache-safe. Doctor fingerprints manifests plus relevant source,
579
592
  test, and module trees, includes content hashes for small files, writes cache artifacts atomically,
580
593
  and limits project concurrency (four workers by default; configurable with
@@ -0,0 +1,82 @@
1
+ # Native Kit Baselines
2
+
3
+ Workspai owns the generated source, build, container, and CI contract for these
4
+ native kits:
5
+
6
+ - `gofiber.standard`
7
+ - `gogin.standard`
8
+ - `springboot.standard`
9
+ - `dotnet.webapi.clean`
10
+ - `rust.axum`
11
+
12
+ This policy does not cover FastAPI or NestJS kits owned by the RapidKit Python
13
+ engine. It also does not cover generators delegated to an upstream official
14
+ CLI, such as Next.js, Astro, Angular, Vue, Svelte, Nuxt, or React Native.
15
+
16
+ ## Current tested baseline
17
+
18
+ Reviewed: August 31, 2026
19
+
20
+ | Kit | Runtime baseline | Framework baseline | Compatibility policy |
21
+ | ------------ | ------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------- |
22
+ | Go/Fiber | Go 1.26 | Fiber 2.52.15 | Stay on the maintained v2 line until a separately qualified v3 migration is complete. |
23
+ | Go/Gin | Go 1.26 | Gin 1.12.0 | Generate and test against the same supported Go baseline. |
24
+ | Spring Boot | Java 21 | Spring Boot 3.5.16, springdoc 2.9.0 | Build on Java 21 and verify the generated project on Java 21 and 25. |
25
+ | .NET Web API | .NET 10 LTS | ASP.NET Core 10.0.11 | Use `net10.0` consistently across source, tests, containers, and CI. |
26
+ | Rust/Axum | Rust 1.98.0, edition 2024 | Axum 0.8.9 | Pin the toolchain so local, CI, and container builds use one compiler contract. |
27
+
28
+ The executable source of truth is
29
+ [`native-kit-baselines.ts`](../src/generators/native-kit-baselines.ts). A
30
+ baseline review changes that file and the affected generator tests together so
31
+ templates cannot silently drift apart.
32
+
33
+ ## Enterprise generation contract
34
+
35
+ Every owned native kit must generate:
36
+
37
+ - deterministic runtime and framework versions rather than `latest`;
38
+ - health/readiness endpoints and runtime smoke tests;
39
+ - a multi-stage container with a non-root runtime user;
40
+ - CI with explicit read-only permissions and pinned action major versions;
41
+ - formatting, linting, build, and test gates appropriate to the ecosystem;
42
+ - automated dependency and GitHub Actions update discovery through Dependabot;
43
+ - portable Workspai metadata and lifecycle launchers.
44
+
45
+ The Spring kit additionally emits an OWASP dependency scan and CycloneDX SBOM.
46
+ The .NET kit uses the SDK's transitive vulnerability audit. Go and Rust security
47
+ scanner adoption remains gated on selecting and qualifying a pinned scanner
48
+ contract; a floating install is not an acceptable substitute.
49
+
50
+ ## Upgrade rules
51
+
52
+ 1. Prefer a supported, mature runtime line over a release published only days
53
+ before the Workspai release.
54
+ 2. Treat framework major upgrades as migrations, not version bumps. They need
55
+ generated-source compatibility, runtime smoke, Docker, and cross-platform CI
56
+ evidence.
57
+ 3. Keep runtime, package, container, CI, documentation, and warning text on the
58
+ same baseline.
59
+ 4. Never use floating tool versions in generated CI.
60
+ 5. Run generator golden tests without host runtimes, then qualify generated
61
+ projects with their real runtime before promoting a preview kit to stable.
62
+ 6. Review baselines for every Workspai minor release and immediately after a
63
+ relevant security or end-of-support announcement.
64
+
65
+ ## Validation
66
+
67
+ The local generator contract is network-free:
68
+
69
+ ```bash
70
+ npm --workspace workspai run typecheck
71
+ npm --workspace workspai run test:no-build -- \
72
+ src/__tests__/generators/gofiber-standard.test.ts \
73
+ src/__tests__/generators/gogin-standard.test.ts \
74
+ src/__tests__/generators/springboot-standard.test.ts \
75
+ src/__tests__/generators/dotnet-webapi-clean.test.ts \
76
+ src/__tests__/project-taxonomy-and-new-kits.test.ts
77
+ ```
78
+
79
+ Release qualification must also generate every owned kit in an isolated
80
+ workspace and run its native restore, format/lint, build, test, and container
81
+ checks on supported CI hosts. A machine without Go, .NET, or Rust can validate
82
+ the scaffold contract, but it cannot provide runtime qualification evidence.
@@ -203,8 +203,12 @@ canonical per-project storage boundary.
203
203
 
204
204
  Workspai-generated agent entry projections are downstream consumers and are
205
205
  excluded from Graph inventory and Git diff hashing. Regenerating `AGENTS.md`,
206
- adapter entry files, or the Amazon Q entry rule therefore cannot invalidate the
207
- Graph that produced them or become circular architecture evidence.
206
+ adapter entry files, GitHub agent definitions, or the Amazon Q entry rule
207
+ therefore cannot invalidate the Graph that produced them or become circular
208
+ architecture evidence. The reserved `.workspai-workspace` marker is excluded
209
+ for the same ownership reason: its extension/CLI usage telemetry and other
210
+ operational metadata describe Workspai activity, not source architecture. Real
211
+ repository and workspace source changes remain part of the live fingerprint.
208
212
 
209
213
  ## Pick the command by question
210
214
 
@@ -534,6 +538,17 @@ Use full graph export for interchange or offline analysis. Use bounded search
534
538
  for interactive agents. The latter keeps response size proportional to the
535
539
  question instead of workspace size.
536
540
 
541
+ Interactive ranking preserves source intent. When otherwise relevant matches
542
+ compete, authored source is preferred over compiled output, generated code,
543
+ vendored dependencies, fixtures, and test-data. Those surfaces remain
544
+ retrievable when the query explicitly asks for them; they are not silently
545
+ removed from the canonical Graph.
546
+
547
+ Project scope also applies while resolving exact evidence and path endpoints.
548
+ Aliases from another project cannot make a scoped target ambiguous, and shared
549
+ workspace entities are admitted only when the Graph proves their connection to
550
+ the selected project.
551
+
537
552
  ### Runtime-generated API topology
538
553
 
539
554
  When an authored API contract is wired through framework registration or
@@ -160,7 +160,10 @@ tool before the environment-creation stage runs.
160
160
  next repair target and never trigger rollback of a valid bounded repair.
161
161
  - Required executables are resolved before approval and again immediately before execution. A
162
162
  missing, broken-shebang, or changed toolchain expires approval instead of starting a partial
163
- transaction. Filesystem presence alone is not launchability proof.
163
+ transaction. Filesystem presence alone is not launchability proof. Planning and execution use
164
+ the same launchability probe across every runtime adapter. A missing executable forbids retry of
165
+ the unchanged plan generation; install or configure it externally, refresh evidence, and create
166
+ a fresh plan.
164
167
  - The exact card producer is run twice: first as a no-mutation causal precondition, then after
165
168
  repair as card-local evidence. An aggregate workspace gate cannot substitute for either run.
166
169
  - A Goal-bound proposal is linked to the active Goal before execution. Closure seals the fresh
@@ -184,6 +187,11 @@ transaction. If a manifest, required executable, isolated environment, project-d
184
187
  validation, or audit surface is unavailable, the engine returns `decision-required`; it never
185
188
  hides the gap behind a model fallback.
186
189
 
190
+ Runtime prerequisites form an explicit dependency graph: host executable, canonical toolchain
191
+ pin, workspace bootstrap, dependency materialization, declared test/build stages, and canonical
192
+ verification. `workspai setup <runtime>` validates and pins an already installed host runtime; it
193
+ does not silently install system software.
194
+
187
195
  The same capability contract publishes an executable qualification matrix over
188
196
  adapter, scope, failure family, and recovery path. Every failure family has one
189
197
  bounded terminal policy: refresh stale/missing evidence, replan no-op/source
@@ -35,6 +35,19 @@ family. Vendored trees, build outputs, fixtures, and nested test fixture package
35
35
  manifests are excluded from lifecycle discovery so orchestration does not turn
36
36
  sample inputs into install targets.
37
37
 
38
+ Workspace ownership is resolved before commands are selected. An npm
39
+ `workspaces` declaration, `pnpm-workspace.yaml`, or Cargo `[workspace]` owns
40
+ matching member manifests and their explicit exclusions. Workspai therefore
41
+ runs the owning install or fetch command once instead of scheduling the same
42
+ dependency materialization for every member. Metadata-only packages and nested
43
+ eval, benchmark, integration, test-data, and fixture inputs are not promoted to
44
+ standalone lifecycle units without executable lifecycle evidence.
45
+
46
+ Registered project boundaries take precedence over aggregate discovery. When a
47
+ nested directory is already an explicit workspace project, an aggregate parent
48
+ does not execute that child's runtime unit again. `--plan --json` exposes the
49
+ resulting ownership so operators can review the exact units before execution.
50
+
38
51
  Planning and `init` do not require Doctor or release-readiness evidence. Real
39
52
  `test`, `build`, and `start` runs enforce the `doctor-workspace` and `readiness`
40
53
  gates by default. A failed gate prevents project commands from starting and is
@@ -47,6 +60,22 @@ The authoritative scaffold/import/lifecycle tiers are in
47
60
  Inspect one project's effective surface with
48
61
  `npx workspai project commands --json` before orchestration.
49
62
 
63
+ ## Cold initialization and progress
64
+
65
+ Dependency initialization uses a longer bounded budget than ordinary test or
66
+ build stages. Python, JVM, .NET, and Rust cold starts receive up to ten minutes;
67
+ other runtimes receive up to five. An explicit
68
+ `RAPIDKIT_WORKSPACE_RUN_STAGE_TIMEOUT_MS` value always takes precedence.
69
+
70
+ Human-readable runs stream child progress so a slow package restore does not
71
+ look frozen. JSON mode keeps stdout machine-readable. The final report records
72
+ the command that actually ran, status, exit code, duration, diagnostic, and
73
+ runtime unit instead of repeating only the planned command.
74
+
75
+ Full workspace `init` continues after a project failure so one run reports every
76
+ missing runtime or failed dependency bootstrap. Each failure remains explicit,
77
+ and the overall run still fails when any project fails.
78
+
50
79
  ## Enterprise configuration
51
80
 
52
81
  Override stage commands per project via `.workspai/context.json`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.70.0",
3
+ "version": "0.72.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-WUXJCSYO.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-UT57IFS4.js';
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-LPCWROQ3.js';import {q,p,r as r$1,t}from'./chunk-ODK4LCEL.js';var R=q.repairTransaction,C=p.repairTransaction,E=r$1.repairTransaction;var y="workspai.workspace-repair-proposal.v1",j="contracts/workspace-intelligence/workspace-repair-proposal.v1.json";var A="workspai.workspace-repair-capabilities.v1",b="workspai.workspace-repair-consumer-protocol.v1",v=["project","workspace","linked-project","polyglot-project"],d=["missing-tool","stale-evidence","missing-artifact","no-op-proposal","source-drift","validation-failure","producer-failure","provider-outage","interrupted-rollback","unsupported-runtime"],u=["automatic-refresh","bounded-replan","decision-required","checkpoint-rollback","durable-resume","manual-repair"],w={"missing-tool":"decision-required","stale-evidence":"automatic-refresh","missing-artifact":"automatic-refresh","no-op-proposal":"bounded-replan","source-drift":"bounded-replan","validation-failure":"checkpoint-rollback","producer-failure":"bounded-replan","provider-outage":"durable-resume","interrupted-rollback":"durable-resume","unsupported-runtime":"manual-repair"};function P(){let i=[],s=c.map(o=>o.id);new Set(s).size!==s.length&&i.push("adapter ids are not unique"),v.length<4&&i.push("scope matrix is incomplete"),d.length<10&&i.push("failure-family matrix is incomplete"),u.length<6&&i.push("recovery-path matrix is incomplete");for(let o of d){let t=w[o];u.includes(t)||i.push(`${o} has no bounded recovery policy`);}for(let o of c)for(let t of ["reconcile","audit","test","build"])o.stages[t]||i.push(`${o.id}.${t} is undeclared`);return i}var c=[{id:"node",ecosystem:"JavaScript / TypeScript",manifests:["package.json"],lockfiles:["package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],packageManagers:["npm","pnpm","yarn","bun"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["selected package manager"]},{id:"python",ecosystem:"Python",manifests:["pyproject.toml","requirements.txt"],lockfiles:["uv.lock","poetry.lock","requirements.txt"],packageManagers:["uv","poetry","pip"],support:"conditional",stages:{reconcile:"conditional",audit:"conditional",test:"conditional",build:"declared"},requiredToolFamilies:["isolated Python","selected environment manager","pip-audit or governed Doctor audit"],limitation:"A bounded isolated environment and an installed audit surface are required."},{id:"go",ecosystem:"Go",manifests:["go.mod"],lockfiles:["go.sum"],packageManagers:["go modules"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["go","govulncheck"],limitation:"govulncheck must be installed; the engine never fetches an unreviewed tool."},{id:"rust",ecosystem:"Rust",manifests:["Cargo.toml"],lockfiles:["Cargo.lock"],packageManagers:["cargo"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["cargo","cargo-audit"],limitation:"The cargo-audit subcommand must already be installed."},{id:"php-composer",ecosystem:"PHP",manifests:["composer.json"],lockfiles:["composer.lock"],packageManagers:["composer"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["composer"]},{id:"ruby-bundler",ecosystem:"Ruby",manifests:["Gemfile"],lockfiles:["Gemfile.lock"],packageManagers:["bundler"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"declared",build:"declared"},requiredToolFamilies:["bundle","bundle-audit"],limitation:"bundle-audit and the declared Rake tasks must already exist."},{id:"elixir-mix",ecosystem:"Elixir",manifests:["mix.exs"],lockfiles:["mix.lock"],packageManagers:["mix"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mix","Hex audit task"],limitation:"The project must expose the Hex audit task used by its dependency policy."},{id:"deno",ecosystem:"Deno",manifests:["deno.json","deno.jsonc"],lockfiles:["deno.lock"],packageManagers:["deno"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["deno"]},{id:"dotnet",ecosystem:".NET",manifests:["*.sln","*.csproj","*.fsproj","*.vbproj"],lockfiles:["Directory.Packages.props","packages.lock.json"],packageManagers:["NuGet / dotnet"],support:"full",stages:{reconcile:"native",audit:"native",test:"native",build:"native"},requiredToolFamilies:["dotnet"]},{id:"jvm-maven",ecosystem:"JVM / Maven",manifests:["pom.xml"],lockfiles:[],packageManagers:["Maven Wrapper","Maven"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mvnw or mvn","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"jvm-gradle",ecosystem:"JVM / Gradle",manifests:["build.gradle.kts","build.gradle"],lockfiles:["gradle.lockfile","gradle/libs.versions.toml"],packageManagers:["Gradle Wrapper","Gradle"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["gradlew or gradle","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"clojure",ecosystem:"Clojure",manifests:["deps.edn","project.clj"],lockfiles:[],packageManagers:["Clojure CLI","Leiningen"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"conditional",build:"conditional"},requiredToolFamilies:["clojure or lein","governed project audit"],limitation:"Tests and builds run only when the selected Clojure project surface declares a deterministic entrypoint."},{id:"scala-sbt",ecosystem:"Scala / sbt",manifests:["build.sbt"],lockfiles:[],packageManagers:["sbt"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["sbt","governed project audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."}];function M(){let i=P();if(i.length>0)throw new Error(`Workspace Repair qualification matrix is incomplete: ${i.join("; ")}`);return {schemaVersion:A,owner:"Workspai CLI",workflow:["plan","preconditions","approval","target-precondition","checkpoint","execute","reconcile","audit","test","build","target-producer-verify","canonical-verify","close-or-rollback-or-decision"],invariants:{multiAdapterProjects:true,missingTools:"decision-required",unsupportedEcosystems:"decision-required",silentFallbackToModelExecution:false,mutationAuthority:"cli-only",targetClosure:"selected-causal-action-set",changeReceipt:"checkpoint-hash-delta",consumerTimeline:"durable-transaction-events",typedDecisionCauses:true,registeredLinkedProjectMutationBoundary:true,sourceProposalIntegrity:"project-bound-hash-pinned",completionAuthority:"cli-verification-receipt",goalSourceTransition:"closed-integrity-bound-v1",goalAttemptBudget:"durable-serialized-v1",consumerHandshakeRequired:true,ephemeralProposalsAreEvidence:false,approvalBoundToPlanHash:true,canonicalVerificationRequired:true,rollbackConflictDetection:true},consumerProtocol:{protocolVersion:b,versionProbe:{args:["--version","--json"],schemaVersion:"rapidkit-version-v1"},capabilityProbe:{args:["workspace","repair","capabilities","--json"],schemaVersion:A},invocation:{command:"workspace repair",workspaceResolution:["process-cwd","--workspace"],actions:["capabilities","plan","propose","approve","decide","execute","resume","status","list","rollback","cancel"]},contracts:{operationResult:a$1,proposal:y,transaction:R},transientPaths:[".workspai/repair/inbox/*.json",".workspai/repair/engine.lock"]},qualificationMatrix:{schemaVersion:"workspai.workspace-repair-qualification-matrix.v1",status:"contract-enforced",dimensions:{adapters:c.map(s=>s.id),scopes:v,failureFamilies:d,recoveryPaths:u,failureRecoveryPolicy:w},invariants:{everyAdapterDeclaresClosureStages:true,everyFailureTerminates:true,everyMutationIsCheckpointed:true,workspaceAndProjectScopesUseTheSameEngine:true,linkedProjectsRemainBoundaryChecked:true}},adapters:c}}var V="workspai.studio-card-repair-capabilities.v1",h="npx workspai workspace verify --json",r=p,a=t;function e(i,s,o,t={}){return {cardId:i,scope:t.scope??"workspace",producerCommand:s,producerArtifact:o,verifyCommand:s,verifyArtifact:o,aggregateVerifyCommand:h,targetClosure:"exact-producer-and-causal-action-set",aggregateRepair:"sequential-causal-queue",transactionScope:"one-causal-finding-family",workspacePosture:"reported-separately",repairPolicy:t.repairPolicy??"refresh-producer",remediationArtifacts:t.remediationArtifacts??[]}}var H=[e("doctor","npx workspai doctor workspace --json",r.doctor,{repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.doctorRemediationPlan,a.artifactRemediationPlan]}),e("projectDoctor","npx workspai doctor project --json",a.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.doctorRemediationPlan,a.artifactRemediationPlan]}),e("pipeline","npx workspai pipeline --json --strict",a.pipelineLastRun,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("analyze","npx workspai analyze --json",r.analyze,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("readiness","npx workspai readiness --json",r.readiness,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("bootstrap","npx workspai bootstrap --ci --json",a.bootstrapCompliance,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("workspaceSync","npx workspai workspace sync --json",a.workspaceRegistry),e("foundation","npx workspai workspace foundation ensure --json",".workspai/workspace.json"),e("contract","npx workspai workspace contract verify --strict --json",r.contractVerify,{repairPolicy:"source-repair-then-produce"}),e("autopilot","npx workspai autopilot release --json",a.autopilotReleaseLastRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceRun","npx workspai workspace run test --json",a.workspaceRunLast,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("setup","npx workspai setup --json",".workspai/toolchain.lock",{repairPolicy:"source-repair-then-produce"}),e("importReadiness","npx workspai doctor project --json",a.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.artifactRemediationPlan]}),e("snapshot","npx workspai snapshot create --json",".workspai/reports/snapshot-last-run.json"),e("workspaceModel","npx workspai workspace model --json --write",r.model),e("intelligenceSnapshot","npx workspai workspace snapshot --json",r.snapshot),e("workspaceDiff",`npx workspai workspace diff --from ${r.snapshot} --json`,r.diff),e("workspaceImpact",`npx workspai workspace impact --from ${r.diff} --json`,r.impact),e("workspaceIntelligenceRun","npx workspai workspace intelligence run --for-agent generic --strict --json",r.intelligenceRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceVerify",h,r.verify,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("workspaceExplain","npx workspai workspace explain release-blocked --json --write",r.explain),e("workspaceWhy","npx workspai workspace why release-blocked --json --write",a.workspaceWhy),e("workspaceTrace",`npx workspai workspace trace --from ${r.diff} --json --write`,a.workspaceTrace),e("workspaceWatch","npx workspai workspace watch --once --json",r.model),e("workspaceContextAgent","npx workspai workspace context --for-agent --json --write",r.agentContext),e("agentGrounding","npx workspai workspace agent-sync --write --refresh-context --json --preset enterprise --target vscode",r.agentCustomizationPack),e("share",`npx workspai workspace share --output ${a.workspaceShareBundle} --json`,a.workspaceShareBundle),e("archive","npx workspai workspace export --output team-workspace.workspai-archive.zip --json",".workspai/archive-manifest.json"),e("mirror","npx workspai mirror status --json",a.mirrorOps),e("cache","npx workspai cache status --json",".workspai/cache-config.yml"),e("policy","npx workspai workspace policy show --json",".workspai/policies.yml",{repairPolicy:"source-repair-then-produce"}),e("infra","npx workspai infra plan --json",a.infraPlan,{repairPolicy:"source-repair-then-produce"})];export{R as a,C as b,E as c,y as d,j as e,A as f,c as g,M as h,V as i,H as j};
@@ -1 +0,0 @@
1
- var ne="workspace-knowledge-search.v1";function b(e){return e.trim().toLowerCase()}var V=new WeakMap;function B(e){let t=V.get(e);if(t)return t;let s=new Map(e.relations.map(a=>[a.id,a])),o=new Map(e.entities.map(a=>[a.id,a])),i=new Map(e.proofs.map(a=>[a.id,a])),r=new Map,d=new Map,h=(a,g)=>{let p=d.get(a)??[];p.push(g),d.set(a,p);};for(let a of e.entities){let g=[a.id,a.label,a.identity.key,...a.kind==="project"&&a.projectId?[a.projectId]:[],...a.identity.aliases];for(let p of new Set(g.map(b))){let k=r.get(p)??[];k.push(a),r.set(p,k);}}for(let a of e.relations)h(a.from,{from:a.from,to:a.to,relationId:a.id,kind:a.kind,direction:"forward",proofIds:a.proofIds}),h(a.to,{from:a.to,to:a.from,relationId:a.id,kind:a.kind,direction:"reverse",proofIds:a.proofIds});for(let a of r.values())a.sort((g,p)=>g.id.localeCompare(p.id));for(let a of d.values())a.sort((g,p)=>g.to.localeCompare(p.to)||g.relationId.localeCompare(p.relationId));let l={entitiesById:o,relationsById:s,entitiesByAlias:r,proofsById:i,adjacency:d};return V.set(e,l),l}function D(e,t){let s=B(e),o=s.relationsById.get(t);if(o)return {found:true,targetType:"relation",relation:o};let i=b(t),r=s.entitiesByAlias.get(i)??[];return r.length===1?{found:true,targetType:"entity",entity:r[0]}:{found:false,query:t,candidates:r.map(d=>d.id).sort()}}function Ke(e,t){let s=D(e,t);if(!s.found)return {query:t,found:false,target:null,proofs:[],candidates:s.candidates};let o=s.targetType==="entity"?s.entity:s.relation,i=new Set(o.proofIds);return {query:t,found:true,target:o,candidates:[],proofs:[...i].map(r=>B(e).proofsById.get(r)).filter(r=>!!r).sort((r,d)=>r.id.localeCompare(d.id))}}function Se(e,t,s){let o=D(e,t),i=D(e,s);if(!o.found||o.targetType!=="entity"||!i.found||i.targetType!=="entity")return {from:t,to:s,found:false,resolvedFrom:o.found&&o.targetType==="entity"?o.entity.id:null,resolvedTo:i.found&&i.targetType==="entity"?i.entity.id:null,entityPath:[],hops:[],proofs:[]};let r=B(e),d=[o.entity.id],h=new Map,l=new Set(d),a=0;for(;a<d.length&&!l.has(i.entity.id);){let u=d[a++];for(let w of r.adjacency.get(u)??[])l.has(w.to)||(l.add(w.to),h.set(w.to,w),d.push(w.to));}if(!l.has(i.entity.id))return {from:t,to:s,found:false,resolvedFrom:o.entity.id,resolvedTo:i.entity.id,entityPath:[],hops:[],proofs:[]};let g=[],p=i.entity.id;for(;p!==o.entity.id;){let u=h.get(p);if(!u)break;g.push(u),p=u.from;}g.reverse();let k=new Set(g.flatMap(u=>u.proofIds));return {from:t,to:s,found:true,resolvedFrom:o.entity.id,resolvedTo:i.entity.id,entityPath:[o.entity.id,...g.map(u=>u.to)],hops:g,proofs:[...k].map(u=>r.proofsById.get(u)).filter(u=>!!u).sort((u,w)=>u.id.localeCompare(w.id))}}function Ee(e,t,s){return e.entities.filter(o=>(!t||o.kind===t)&&(!s||o.projectId===s)).sort((o,i)=>o.kind.localeCompare(i.kind)||o.label.localeCompare(i.label))}var m={relations:12,relatedEntities:12,proofs:8,proofIdsPerItem:4,aliasesPerEntity:8,attributeArrayItems:8,attributeStringCharacters:256};function oe(e){let t=[],s=new Set;for(let o=0;o<m.proofIdsPerItem&&t.length<m.proofs;o+=1)for(let i of e){let r=i.proofIds[o];if(!(!r||s.has(r))&&(s.add(r),t.push(r),t.length>=m.proofs))break}return t}function se(e,t,s){let o=e.identity.aliases.slice(0,m.aliasesPerEntity);s.aliases+=e.identity.aliases.length-o.length;let i=Object.fromEntries(Object.entries(e.attributes).map(([d,h])=>{if(Array.isArray(h)){let l=h.slice(0,m.attributeArrayItems);return s.attributeValues+=h.length-l.length,[d,l]}return typeof h=="string"&&h.length>m.attributeStringCharacters?(s.attributeValues+=1,[d,h.slice(0,m.attributeStringCharacters)]):[d,h]})),r=e.proofIds.filter(d=>t.has(d)).slice(0,m.proofIdsPerItem);return s.proofReferences+=e.proofIds.length-r.length,{...e,identity:{...e.identity,aliases:o},attributes:i,proofIds:r}}function ae(e){let t=Object.values(e.attributes).flatMap(s=>Array.isArray(s)?s:[s]);return [e.id,e.kind,e.label,e.projectId??"",e.identity.key,...e.identity.aliases,...t.map(s=>String(s??""))].join(" ").toLowerCase()}var ie=new Set(["a","an","and","are","as","at","be","been","being","by","can","check","could","did","do","does","find","for","from","give","had","has","have","how","i","in","into","is","it","its","may","might","of","on","or","our","show","should","that","the","their","them","then","there","these","they","this","those","tell","to","was","we","were","what","when","where","which","who","why","will","with","would","you","your"]),re=new Map([["authenticate","auth"],["authenticated","auth"],["authentication","auth"],["authorization","auth"],["authorizing","auth"],["config","configuration"],["configs","configuration"],["dependencies","dependency"],["connected","connect"],["connecting","connect"],["connection","connect"],["connections","connect"],["diagnostics","diagnostic"],["reliable","reliability"],["tested","test"],["testing","test"],["tests","test"],["verification","verify"],["verified","verify"],["verifies","verify"],["verifying","verify"]]);function M(e){let t=s=>b(s).replace(/\bc\+\+/gu," cplusplus ").replace(/\bc#/gu," csharp ").split(/[^a-z0-9]+/u).filter(o=>o.length>1||o==="c"||o==="r").map(o=>re.get(o)??o);return [...new Set([...t(e),...t(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"))])]}function ce(e){let t=b(e.label),s=b(e.identity.key),o=e.identity.aliases.map(b),i=ae(e);return {entity:e,label:t,identity:s,aliases:o,haystack:i,labelTokens:new Set(M(e.label)),identityTokens:new Set(M(e.identity.key)),aliasTokens:new Set(e.identity.aliases.flatMap(M)),allTokens:new Set(M(i))}}function E(e,t){return e.has(t)||t.length>=3&&[...e].some(s=>s.startsWith(t))}function _(e,t){return E(e.labelTokens,t)||E(e.identityTokens,t)||E(e.aliasTokens,t)||E(e.allTokens,t)}function le(e,t,s,o){let{label:i,identity:r,aliases:d,haystack:h}=e,l=0;(i===t||r===t||d.includes(t))&&(l+=1e4),(i.startsWith(t)||r.startsWith(t))&&(l+=250),h.includes(t)&&(l+=100);let a=0;for(let g of s){let p=o.get(g)??1,k=E(e.labelTokens,g),u=E(e.identityTokens,g),w=E(e.aliasTokens,g),f=_(e,g);f&&(a+=1),i===g?l+=80*p:k&&(l+=36*p),u&&(l+=24*p),w&&(l+=20*p),f&&(l+=10*p);}return s.length>0&&(l+=a/s.length*120),l}function F(e,t){let s=new Set;for(let o of t){let i=e.allTokens.has(o)?o:void 0,r=i===void 0&&o.length>=3?[...e.allTokens].find(h=>h.startsWith(o)&&!s.has(h)):void 0,d=i??r;d&&!s.has(d)&&s.add(d);}return s.size}var de=new Map([["c","c"],["clojure","clojure"],["cplusplus","cpp"],["cpp","cpp"],["typescript","typescript"],["ts","typescript"],["javascript","javascript"],["js","javascript"],["nodejs","javascript"],["python","python"],["py","python"],["go","go"],["golang","go"],["csharp","csharp"],["ada","ada"],["assembly","assembly"],["asm","assembly"],["cuda","cuda"],["dotnet","csharp"],["dart","dart"],["elixir","elixir"],["fsharp","fsharp"],["fortran","fortran"],["java","java"],["kotlin","kotlin"],["hlsl","hlsl"],["llvmir","llvm-ir"],["mlir","mlir"],["lua","lua"],["php","php"],["r","r"],["ruby","ruby"],["rust","rust"],["tablegen","tablegen"],["scala","scala"],["svelte","svelte"],["swift","swift"],["vue","vue"]]);function pe(e){return new Set(e.map(t=>de.get(t)).filter(t=>!!t))}function Y(e){let t=e.attributes.language;return typeof t=="string"?b(t):null}function ge(e){return {project:1e3,service:900,api:900,package:850,endpoint:800,container:700,deployment:700,environment:650,pipeline:600,"test-suite":550,owner:500,decision:450,document:400}[e.kind]??0}var he=new Set(["language","languages","binding","bindings","bridge","bridges","dependency","dependencies","depends","core","runtime","owner","owners","ownership","maintainer","ci","pipeline","pipelines","workflow","deploy","deployment","infrastructure","container","doc","docs","document","documentation","service","services","api","rpc","schema","schemas","message","protobuf","proto","contract"]),ue=new Set(["app","application","applications","call","calls","code","communicate","communication","connect","define","defined","expose","exposed","handle","handled","implement","implementation","integrate","integration","interact","interaction","project","provide","provided","system","use","used","uses","using"]);function fe(e){return he.has(e)||ue.has(e)}function ye(e,t){let s=t.has("language")||t.has("languages"),o=t.has("binding")||t.has("bindings")||t.has("bridge")||t.has("bridges"),i=t.has("dependency")||t.has("dependencies")||t.has("depends"),r=t.has("core")||t.has("runtime"),d=t.has("owner")||t.has("owners")||t.has("ownership")||t.has("maintainer"),h=t.has("ci")||t.has("pipeline")||t.has("pipelines")||t.has("workflow"),l=t.has("deploy")||t.has("deployment")||t.has("infrastructure")||t.has("container"),a=t.has("doc")||t.has("docs")||t.has("document")||t.has("documentation"),g=t.has("service")||t.has("services")||t.has("api")||t.has("rpc"),p=t.has("schema")||t.has("schemas")||t.has("message")||t.has("protobuf")||t.has("proto")||t.has("contract"),k=typeof e.attributes.mechanism=="string"?b(e.attributes.mechanism):"",u=typeof e.attributes.specification=="string"?b(e.attributes.specification):"",w=b(e.label),f=0;if(s&&e.kind==="language"){let O=typeof e.attributes.fileCount=="number"?e.attributes.fileCount:0;f+=900+Math.min(O,1e4)/10;}return o&&e.kind==="protocol"&&(f+=800),i&&e.kind==="package"&&(f+=650),r&&e.kind==="package"&&/(?:^|[_-])core(?:$|[_-])/u.test(w)&&(f+=700),r&&e.kind==="protocol"&&k.includes("core")&&(f+=300),d&&e.kind==="owner"&&(f+=850),h&&e.kind==="pipeline"&&(f+=800),l&&["deployment","container","environment"].includes(e.kind)&&(f+=775),a&&["document","decision"].includes(e.kind)&&(f+=725),g&&["api","endpoint","service"].includes(e.kind)&&(f+=700),p&&(e.kind==="schema"||(e.kind==="api"||e.kind==="protocol")&&(u.includes("protobuf")||k.includes("protobuf")))&&(f+=750),f}function we(e){return [e.has("language")||e.has("languages"),e.has("binding")||e.has("bindings")||e.has("bridge")||e.has("bridges"),e.has("dependency")||e.has("dependencies")||e.has("depends"),e.has("core")||e.has("runtime"),e.has("owner")||e.has("ownership")||e.has("maintainer"),e.has("ci")||e.has("pipeline")||e.has("workflow"),e.has("deploy")||e.has("deployment")||e.has("infrastructure"),e.has("doc")||e.has("docs")||e.has("documentation"),e.has("service")||e.has("api")||e.has("rpc"),e.has("schema")||e.has("protobuf")||e.has("proto")||e.has("contract")].filter(Boolean).length>=3}function We(e,t){let s=b(t.query),o=[...new Set(M(t.query))],i=new Set(M(t.projectId??"")),r=t.projectId?o.filter(n=>!i.has(n)):o,d=!!(t.projectId&&o.length>0&&r.length===0),h=r.filter(n=>!ie.has(n)),l=h.length>0?h:r,a=pe(l),g=new Set(l),p=l.filter(n=>!fe(n)),k=we(g),u=l.length<=1?l.length:Math.min(2,Math.ceil(l.length/3)),w=t.minimumTermMatches===void 0?u:Math.min(u,Math.max(1,Math.trunc(t.minimumTermMatches))),f=Math.max(1,Math.min(Math.trunc(t.limit??12),100)),O=Math.max(0,Math.min(Math.trunc(t.relationsPerEntity??4),20)),G=new Set;if(t.projectId){let n=new Set(e.entities.filter(c=>c.kind==="project"&&(c.projectId===t.projectId||c.label===t.projectId)).map(c=>c.id));for(let c of e.relations)n.has(c.from)&&G.add(c.to),n.has(c.to)&&G.add(c.from);}let P=e.entities.filter(n=>(!t.kind||n.kind===t.kind)&&(!t.projectId||n.projectId===t.projectId||n.projectId===void 0&&G.has(n.id))).map(ce),$=new Map(l.map(n=>{let c=P.filter(y=>_(y,n)).length;return [n,Math.log((P.length+1)/(c+1))+1]})),X=p.some(n=>P.some(c=>_(c,n))),v=P.map(n=>{let c=F(n,l),y=F(n,p),I=Y(n.entity),S=I&&a.has(I)?400:0,x=ye(n.entity,g),j=p.length===0||p.some(te=>_(n,te))?x:0;return {entity:n.entity,matchedTerms:c,matchedQualifiers:y,intentScore:j,score:d?ge(n.entity):le(n,s,l,$)+y*300+S+j}}).filter(n=>{let c=Y(n.entity);return (a.size===0||c===null||a.has(c))&&(s.length===0||n.score>0&&(!X||p.length===0||n.matchedQualifiers>0)&&(d||n.matchedTerms>=w||n.intentScore>0&&(k||l.length<=2)))}).sort((n,c)=>c.score-n.score||n.entity.kind.localeCompare(c.entity.kind)||n.entity.label.localeCompare(c.entity.label)),W=(k?(()=>{let n=[],c=[],y=new Map,I=new Set;for(let S of v){let x=y.get(S.entity.kind)??0,j=b(S.entity.label);x<2&&!I.has(j)?(n.push(S),y.set(S.entity.kind,x+1),I.add(j)):c.push(S);}return [...n,...c]})():v).slice(0,f).map(n=>n.entity),R=new Set(W.map(n=>n.id)),L=new Map,H=e.relations.filter(n=>{if(!(R.has(n.from)||R.has(n.to)))return false;let y=R.has(n.from)?n.from:n.to,I=L.get(y)??0;return I>=O?false:(L.set(y,I+1),true)}),K=t.projection==="agent",T=K?H.slice(0,m.relations):H,z=B(e),N=[...new Set(T.flatMap(n=>[n.from,n.to]).filter(n=>!R.has(n)))].map(n=>z.entitiesById.get(n)).filter(n=>!!n).map(({id:n,kind:c,label:y,projectId:I})=>({id:n,kind:c,label:y,...I?{projectId:I}:{}})).sort((n,c)=>n.kind.localeCompare(c.kind)||n.label.localeCompare(c.label)),Q=K?N.slice(0,m.relatedEntities):N,q=new Set([...W.flatMap(n=>n.proofIds),...T.flatMap(n=>n.proofIds)]),Z=K?oe([...W,...T]):[...q],C=new Set(Z),A={entities:v.length-W.length,relations:H.length-T.length,relatedEntities:N.length-Q.length,proofs:q.size-C.size,proofReferences:0,aliases:0,attributeValues:0},U=K?W.map(n=>se(n,C,A)):W,J=K?T.map(n=>{let c=n.proofIds.filter(y=>C.has(y)).slice(0,m.proofIdsPerItem);return A.proofReferences+=n.proofIds.length-c.length,{...n,proofIds:c}}):T,ee=[...C].map(n=>z.proofsById.get(n)).filter(n=>!!n).sort((n,c)=>n.id.localeCompare(c.id));return {schemaVersion:ne,graphSourceHash:e.source.hash,query:t.query,kind:t.kind??null,...t.projectId?{projectId:t.projectId}:{},limit:f,totalMatches:v.length,truncated:v.length>U.length||K&&Object.values(A).some(n=>n>0),entities:U,relatedEntities:Q,relations:J,proofs:ee,...K?{budget:{mode:"agent",limits:{...m},omitted:A}}:{}}}export{ne as a,D as b,Ke as c,Se as d,Ee as e,We as f};
@@ -1 +0,0 @@
1
- import {k,q}from'./chunk-46QH3ZVI.js';import {a as a$6}from'./chunk-HTYMXMQM.js';import {b as b$2,c as c$2,a as a$3}from'./chunk-V52R2W2Q.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {d,a as a$1,p as p$1,g as g$2,f as f$1,e}from'./chunk-PTSEDZIV.js';import {c,b as b$1,j as j$2,z as z$1,f}from'./chunk-KFTJVVJR.js';import {m,l}from'./chunk-U5ENEDJA.js';import {a as a$5}from'./chunk-GR6442P7.js';import {j as j$1,g as g$1,a as a$4,h}from'./chunk-FE5R6EUV.js';import {a}from'./chunk-2LIVMG5C.js';import {d as d$1,c as c$1}from'./chunk-EWZZUQBR.js';import {q as q$1,p,t as t$1,s}from'./chunk-ODK4LCEL.js';import {t}from'./chunk-VQZ5PI5J.js';import g from'path';import P from'fs-extra';import It from'crypto';import {execFile}from'child_process';import {promisify}from'util';import {createRequire}from'module';var Rt=new Set(c().map(e=>e.id)),At=[...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}],H=new Map;for(let e of At){H.set(e.id,e);for(let t of e.aliases)H.set(t,e);}var Mt=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function K(e){return e?.trim().toLowerCase()||void 0}function Qe(e){let t=K(e.kitId)??K(e.framework)??K(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&&Rt.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 o=H.get(t)??H.get(K(e.framework)??"")??H.get(K(e.runtime)??"");if(o)return {lane:"official",status:o.status,canExecuteCreate:o.canExecuteCreate,requested:t,resolved:o.id,officialCommands:o.officialCommands,fallbackLane:o.canExecuteCreate?void 0:"existing",reason:o.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 s=K(e.runtime);return s&&Mt.has(s)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:s,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 $r(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var Lr="rapidkit-freshness-metadata-v1";function fe(e){if(Array.isArray(e))return e.map(t=>fe(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=fe(e[r]);return t}return e}function Ft(e){return JSON.stringify(fe(e))}function G(e){return It.createHash("sha256").update(Ft(e)).digest("hex")}var Ze=".workspai/workspace-graph.overrides.json",Dt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),Ot=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),tt=600,rt=5,Gt=256*1024,et={inferred:1,contract:2,manual:3};function _t(e){return e.split(g.sep).join("/")}function Z(e,t){return _t(g.relative(e,t)||".")}function nt(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,o)=>r.id.localeCompare(o.id))}function ot(e,t){let r=new Map,o=new Map;for(let n of t.projects){if(r.has(n.name))continue;let c=n.absolutePath?g.resolve(n.absolutePath):g.resolve(e,n.path);r.set(n.name,c),o.has(c)||o.set(c,n.name);}let s=[...o.entries()].map(([n,c])=>({dir:n,id:c})).sort((n,c)=>c.dir.length-n.dir.length||n.dir.localeCompare(c.dir));return {idToDir:r,dirToId:o,sortedDirs:s}}function ee(e,t){let r=g.resolve(t);for(let{dir:o,id:s}of e.sortedDirs)if(r===o||r.startsWith(`${o}${g.sep}`))return s;return null}async function he(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function ye(e){try{return await P.pathExists(e)?await P.readFile(e,"utf8"):null}catch{return null}}async function st(e,t){let r=[],o=new Map;for(let[s,n]of t.idToDir.entries()){let c=await he(g.join(n,"package.json")),a=typeof c?.name=="string"?c.name.trim():"";a&&!o.has(a)&&o.set(a,s);}for(let[s,n]of t.idToDir.entries()){let c=await he(g.join(n,"package.json"));if(c){let a=["dependencies","devDependencies","peerDependencies","optionalDependencies"],i=new Set;for(let l of a){let u=c[l];if(!(!u||typeof u!="object"||Array.isArray(u)))for(let p of Object.keys(u)){let d=o.get(p);!d||d===s||i.has(d)||(i.add(d),r.push({from:s,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(n,"package.json")),detail:`declares dependency ${p}`}]}));}}}r.push(...await Tt(e,t,s,n)),r.push(...await Nt(e,t,s,n));}return r}async function Tt(e,t,r,o){let s=await ye(g.join(o,"pyproject.toml"));if(!s)return [];let n=[],c=new Set,a=/path\s*=\s*["']([^"']+)["']/g,i;for(;(i=a.exec(s))!==null;){let l=ee(t,g.resolve(o,i[1]));!l||l===r||c.has(l)||(c.add(l),n.push({from:r,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(o,"pyproject.toml")),detail:`path dependency ${i[1]}`}]}));}return n}async function Nt(e,t,r,o){let s=await ye(g.join(o,"go.mod"));if(!s)return [];let n=[],c=new Set,a=/replace\s+\S+\s+=>\s+(\.[^\s]+)/g,i;for(;(i=a.exec(s))!==null;){let l=ee(t,g.resolve(o,i[1]));!l||l===r||c.has(l)||(c.add(l),n.push({from:r,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(o,"go.mod")),detail:`go.mod replace ${i[1]}`}]}));}return n}async function Kt(e,t){let r=[],o=[e];for(;o.length>0&&r.length<t;){let s=o.shift();if(!s)continue;let n=[];try{n=await P.readdir(s,{withFileTypes:true});}catch{continue}let c=[],a=[];for(let i of n)if(i.isDirectory()){if(Ot.has(i.name)||a$5(i.name)||i.name.startsWith("."))continue;c.push(g.join(s,i.name));}else i.isFile()&&Dt.has(g.extname(i.name))&&a.push(g.join(s,i.name));a.sort((i,l)=>i.localeCompare(l)),c.sort((i,l)=>i.localeCompare(l));for(let i of a){if(r.length>=t)break;r.push(i);}o.push(...c);}return r}var $t=[/\bfrom\s+["']([^"']+)["']/g,/\bimport\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g];function Vt(e){let t=new Set;for(let r of $t){r.lastIndex=0;let o;for(;(o=r.exec(e))!==null;){let s=o[1];s.startsWith(".")&&t.add(s);}}return [...t]}async function ke(e,t,r,o){let s=new Map;for(let[n,c]of t.idToDir.entries()){if(o&&!o.has(n))continue;let a=await Kt(c,r);for(let i of a){let l=await P.stat(i).catch(()=>null);if(!l||l.size>Gt)continue;let u=await ye(i);if(u)for(let p of Vt(u)){let d=g.resolve(g.dirname(i),p),f=ee(t,d);if(!f||f===n)continue;let y=`${n}\0${f}`,m=s.get(y);m||(m={from:n,to:f,evidence:[]},s.set(y,m)),m.evidence.length<rt&&m.evidence.push({file:Z(e,i),detail:`imports ${p}`});}}}return [...s.values()].map(n=>({from:n.from,to:n.to,kind:"code-import",source:"inferred",confidence:"medium",evidence:n.evidence}))}function Ht(e,t,r){let o=new Map;for(let s of r.projects){let n=Bt(e,t,s);n&&o.set(s.slug,n);}return o}function Bt(e,t,r){let o=[r.relativePath,r.externalPath].filter(s=>typeof s=="string"&&s.length>0);for(let s of o){let n=g.resolve(e,s),c=t.dirToId.get(n)??ee(t,n);if(c)return c}return t.idToDir.has(r.slug)?r.slug:null}function at(e,t,r){let o=[],s=Ht(e,t,r),n=g$2,c=new Map,a=new Map;for(let i of r.projects){let l=s.get(i.slug);if(!l)continue;let u=i.contracts??{publishes:[],consumes:[],dependsOn:[]};for(let p of u.dependsOn??[]){let d=s.get(p);!d||d===l||o.push({from:l,to:d,kind:"service-dependsOn",source:"contract",confidence:"high",evidence:[{file:n,detail:`dependsOn ${p}`}]});}for(let p of u.publishes??[])c.has(p)||c.set(p,new Set),c.get(p)?.add(l);for(let p of u.consumes??[])a.has(p)||a.set(p,new Set),a.get(p)?.add(l);}for(let[i,l]of c.entries()){let u=a.get(i);if(u)for(let p of u)for(let d of l)p!==d&&o.push({from:p,to:d,kind:"event-pub-sub",source:"contract",confidence:"high",evidence:[{file:n,detail:`consumes event ${i}`}]});}return o.push(...Lt(r,s)),o}function me(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function Lt(e,t){let r=[],o=e.projects.map(s=>({project:s,id:t.get(s.slug)})).filter(s=>!!s.id).filter(s=>me(s.project.slug).length>=3);for(let s of e.projects){let n=t.get(s.slug);if(!n)continue;let c=s.contracts?.env??[];if(c.length===0)continue;let a=new Set;for(let i of c){let l=me(i);for(let u of o)u.id===n||a.has(u.id)||!(l.includes(me(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$2,detail:`env ${i} references ${u.project.slug}`}]}));}}return r}async function it(e,t){let r=await he(g.join(e,Ze)),o=Array.isArray(r?.edges)?r?.edges:[],s=[],n=new Set(f$1);for(let c of o){if(!c||typeof c!="object"||Array.isArray(c))continue;let a=c,i=typeof a.from=="string"?a.from:"",l=typeof a.to=="string"?a.to:"",u=typeof a.kind=="string"?a.kind:"";if(!t.has(i)||!t.has(l)||i===l||!n.has(u))continue;let p=Array.isArray(a.evidence)?a.evidence.map(d=>d&&typeof d=="object"&&typeof d.file=="string"?{file:d.file,...typeof d.detail=="string"?{detail:d.detail}:{}}:null).filter(d=>!!d):[];s.push({from:i,to:l,kind:u,source:"manual",confidence:"high",evidence:p.length>0?p:[{file:Ze,detail:"manual edge"}]});}return s}function Ut(e){return `${e.from}\0${e.to}\0${e.kind}`}function zt(e){let t=new Set,r=[];for(let o of e){let s=`${o.file}\0${o.detail??""}`;t.has(s)||(t.add(s),r.push(o));}return r.sort((o,s)=>o.file.localeCompare(s.file)||(o.detail??"").localeCompare(s.detail??"")).slice(0,rt)}function qt(e){let t=new Map;for(let r of e){let o=Ut(r),s=t.get(o);if(!s){t.set(o,{...r,evidence:[...r.evidence]});continue}let n=et[s.source],c=et[r.source];c>n?t.set(o,{...r,evidence:[...r.evidence,...s.evidence]}):c===n&&s.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:zt(r.evidence)})).sort((r,o)=>r.from.localeCompare(o.from)||r.to.localeCompare(o.to)||r.kind.localeCompare(o.kind)||r.source.localeCompare(o.source))}function ge(e){return Math.round(e*1e3)/1e3}function Jt(e){return Math.max(0,Math.min(100,Math.round(e)))}function Xt(e){return e>=75?"critical":e>=50?"high":e>=20?"medium":"low"}function Yt(e){return e==="critical"||e==="high"?"strict":e==="medium"?"elevated":"normal"}function Qt(e,t){let r=a$6({nodes:e,edges:t}),o=new Map;for(let s of e){let n=r.byId.get(s.id)??{fanIn:0,fanOut:0,reach:0,betweenness:0,isHotspot:false},c=t.filter(f=>f.from===s.id||f.to===s.id),a=c.filter(f=>f.source==="contract"||f.source==="manual").length,i=c.filter(f=>f.confidence==="low").length,l=[],u=n.reach*20+n.fanIn*14+n.fanOut*8+Math.min(20,n.betweenness*4)+a*8;n.isHotspot&&(u+=24,l.push("Critical-path hotspot in dependency graph")),n.reach>0&&l.push(`Change reaches ${n.reach} dependent project(s)`),n.fanIn>0&&l.push(`${n.fanIn} direct dependent project(s)`),n.fanOut>0&&l.push(`${n.fanOut} direct dependency project(s)`),a>0&&l.push(`${a} contract/manual edge(s)`),i>0&&l.push(`${i} low-confidence inferred edge(s) need review`),c.length===0&&l.push(e.length===1?"Single-project workspace; inter-project dependency edges are not applicable":"No dependency evidence connected to this project yet");let p=Jt(u),d=Xt(p);o.set(s.id,{weight:d,score:p,verificationPriority:Yt(d),reasons:l.slice(0,5),centrality:{fanIn:n.fanIn,fanOut:n.fanOut,reach:n.reach,betweenness:n.betweenness,isHotspot:n.isHotspot}});}return o}function Zt(e,t){let r=Qt(e,t);return e.map(o=>({...o,operationalProfile:r.get(o.id)}))}function er(e,t){let r=new Set;for(let i of t)r.add(i.from),r.add(i.to);let o=e.length,s=t.length,n=e.filter(i=>r.has(i.id)).length,c=Math.max(0,o-n),a=a$6({nodes:e,edges:t});return {nodeCount:o,edgeCount:s,inferredEdges:t.filter(i=>i.source==="inferred").length,contractEdges:t.filter(i=>i.source==="contract").length,manualEdges:t.filter(i=>i.source==="manual").length,authoritativeEdges:t.filter(i=>i.source==="contract"||i.source==="manual").length,lowConfidenceEdges:t.filter(i=>i.confidence==="low").length,orphanCount:c,connectedNodeCount:n,density:ge(o>1?s/(o*(o-1)):0),edgeCoverageRatio:ge(o>0?n/o:1),evidenceCoverageRatio:ge(s>0?t.filter(i=>i.evidence.length>0).length/s:1),hotspotCount:a.hotspots.length,hasCycle:rr(e,t)}}function tr(e,t,r){let o=[],s=e.filter(n=>!t.some(c=>c.from===n.id||c.to===n.id)).map(n=>n.id).sort((n,c)=>n.localeCompare(c));return r.nodeCount===0&&o.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?o.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:s}):r.nodeCount>1&&r.orphanCount>0&&o.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:s.slice(0,12)}),r.lowConfidenceEdges>0&&o.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&&o.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&&o.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."}),o.sort((n,c)=>{let a={error:0,warning:1,info:2};return a[n.severity]-a[c.severity]||n.code.localeCompare(c.code)})}function rr(e,t){let r=new Map;for(let i of e)r.set(i.id,[]);for(let i of t)r.has(i.from)||r.set(i.from,[]),r.get(i.from)?.push(i.to);let o=0,s=1,n=2,c=new Map;for(let i of r.keys())c.set(i,o);let a=i=>{let l=[{id:i,index:0}];for(c.set(i,s);l.length>0;){let u=l[l.length-1],p=r.get(u.id)??[];if(u.index>=p.length){c.set(u.id,n),l.pop();continue}let d=p[u.index];u.index+=1;let f=c.get(d)??o;if(f===s)return true;f===o&&(c.set(d,s),l.push({id:d,index:0}));}return false};for(let i of [...r.keys()].sort())if(c.get(i)===o&&a(i))return true;return false}function ct(e$1,t,r,o){let s=qt(r.filter(i=>t.has(i.from)&&t.has(i.to))),n=Zt(e$1,s),c=er(e$1,s),a=tr(e$1,s,c);return {schemaVersion:e,generatedAt:(o??new Date).toISOString(),nodes:n,edges:s,stats:c,...a.length>0?{diagnostics:a}:{}}}async function dt(e){let t=g.resolve(e.workspacePath),r=e.maxImportFilesPerProject??tt,o=nt(e.model),s=new Set(o.map(a=>a.id)),n=ot(t,e.model),c=[];return c.push(...await st(t,n)),c.push(...await ke(t,n,r)),e.contract&&c.push(...at(t,n,e.contract)),c.push(...await it(t,s)),ct(o,s,c,e.now)}async function pt(e){let t=g.resolve(e.workspacePath),r=e.maxImportFilesPerProject??tt,o=nt(e.model),s=new Set(o.map(a=>a.id)),n=ot(t,e.model),c=[];if(c.push(...await st(t,n)),e.structuralChange)c.push(...await ke(t,n,r));else {c.push(...await ke(t,n,r,e.changedProjectIds));for(let a of e.previousGraph.edges)a.kind==="code-import"&&a.source==="inferred"&&!e.changedProjectIds.has(a.from)&&s.has(a.from)&&s.has(a.to)&&c.push({from:a.from,to:a.to,kind:"code-import",source:"inferred",confidence:a.confidence,evidence:a.evidence});}return e.contract&&c.push(...at(t,n,e.contract)),c.push(...await it(t,s)),ct(o,s,c,e.now)}var te="workspace-model-producer.v3";var ve=s.workspaceModelCache.schemaVersion,we=t$1.workspaceModelCache,ir=["package.json","pyproject.toml","setup.py","requirements.txt","requirements.in","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","Gemfile.lock","mix.exs","mix.lock","deno.json","deno.jsonc","deno.lock","bun.lock","bun.lockb","bunfig.toml",".bunfig.toml","deps.edn","project.clj","build.sbt","CMakeLists.txt","meson.build","workspai.project.json",".workspai/project.json",".workspai/context.json","rapidkit.project.json",".rapidkit/project.json",".rapidkit/context.json"],cr=[".csproj",".fsproj",".vbproj",".sln",".slnx",".gemspec"],lt=[t$1.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"],ut=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".vue",".svelte",".rb",".go",".py",".java",".kt",".kts",".rs",".cs",".php",".ex",".exs",".clj",".cljs",".scala",".c",".cc",".cpp",".cxx",".h",".hh",".hpp",".hxx",".proto",".graphql",".gql",".sql",".sh"]),dr=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),pr=1500,re=promisify(execFile);function lr(e){return ut.has(g.extname(e).toLowerCase())}async function ur(e){try{let{stdout:t}=await re("git",["-C",e,"rev-parse","--show-toplevel"],{encoding:"utf8",timeout:1e4,maxBuffer:1048576}),r=t.trim();if(!r)return null;let o=g.relative(r,e).split(g.sep).join("/");if(o===".."||o.startsWith("../"))return null;let s=o||".",n=o?`HEAD:${o}`:"HEAD^{tree}",{stdout:c}=await re("git",["-C",r,"rev-parse",n],{encoding:"utf8",timeout:1e4,maxBuffer:1024*1024}),[a,i]=await Promise.all([re("git",["-C",r,"diff","--name-only","-z","HEAD","--",s],{encoding:"buffer",timeout:2e4,maxBuffer:64*1024*1024}),re("git",["-C",r,"ls-files","--others","--exclude-standard","-z","--",s],{encoding:"buffer",timeout:2e4,maxBuffer:64*1024*1024})]),l=new Set([a.stdout,i.stdout].flatMap(p=>p.toString("utf8").split("\0")).filter(Boolean)),u=[`git-tree:${c.trim()}`];for(let p of [...l].sort((d,f)=>d.localeCompare(f))){let d=g.resolve(r,p),f=g.relative(e,d).split(g.sep).join("/");f===".."||f.startsWith("../")||!lr(f)||u.push(`${f}:${await L(d)??"<deleted>"}`);}return u}catch{return null}}var B=null;function be(){if(B)return B;try{B=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{B="0.0.0";}return B}async function L(e){try{let t=await P.readFile(e);return It.createHash("sha256").update(t).digest("hex")}catch{return null}}async function ft(e){let t={};for(let o of ir){let s=await L(g.join(e,o));s&&(t[o]=s);}let r=await P.readdir(e).catch(()=>[]);for(let o of r.sort((s,n)=>s.localeCompare(n))){if(!cr.some(n=>o.toLowerCase().endsWith(n)))continue;let s=await L(g.join(e,o));s&&(t[o]=s);}return t}async function fr(e){let t=await ft(e),r=await ur(e),o=r??[];if(r)return G({manifests:t,source:o});let s=[e];for(;s.length>0&&o.length<pr;){let n=s.shift();if(!n)continue;let c=[];try{c=await P.readdir(n,{withFileTypes:true});}catch{continue}let a=[];for(let i of c)if(i.isDirectory()){if(dr.has(i.name)||a$5(i.name)||i.name.startsWith("."))continue;a.push(g.join(n,i.name));}else if(i.isFile()&&ut.has(g.extname(i.name))){let l=g.join(n,i.name),u=await P.stat(l).catch(()=>null);if(u){let p=g.relative(e,l).split(g.sep).join("/");o.push(`${p}:${u.size}:${Math.round(u.mtimeMs)}`);}}a.sort((i,l)=>i.localeCompare(l)),s.push(...a);}return o.sort((n,c)=>n.localeCompare(c)),G({manifests:t,source:o})}async function ne(e,t){let r=g.resolve(e),o={},s=[...new Set(t.map(n=>g.relative(r,g.resolve(n)).split(g.sep).join("/")))].sort((n,c)=>n.localeCompare(c));for(let n of s)o[n]=await fr(g.join(r,n));return o}async function oe(e){let t=g.resolve(e),r={};for(let o of lt){let s=await L(g.join(t,o));s&&(r[o]=s);}return r}async function se(e){let t=g.resolve(e.workspacePath),r=[...new Set(e.projectPaths.map(n=>g.relative(t,g.resolve(n)).split(g.sep).join("/")))].sort((n,c)=>n.localeCompare(c)),o=[];for(let n of r){let c=await ft(g.join(t,n));o.push({project:n,manifests:c});}let s={};for(let n of lt){let c=await L(g.join(t,n));c&&(s[n]=c);}return G({cacheSchema:ve,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:o,workspaceFiles:s})}async function je(e){let t=await g$1(e,we)??a$4(e,we);try{if(!await P.pathExists(t))return null;let r=await P.readJson(t);return !r||r.schemaVersion!==ve||r.producerRevision!==te||typeof r.inputsHash!="string"||typeof r.cliVersion!="string"||!r.model?null:r}catch{return null}}async function ae(e,t){let r={schemaVersion:ve,producerRevision:te,...t};return h(e,we,r)}var mt="rapidkit-fact-freshness-v1",U={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function mr(e){switch(e){case "durable":return U.durable;case "derived":return U.derived;case "evidence-backed":return U.evidenceBacked;case "live":return U.live;case "verify-before-use":return U.verifyBeforeUse}}function gr(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 hr(e){let t=e.now??new Date,r=e.generatedAt??t.toISOString(),o=Date.parse(r),s=Number.isFinite(o),n=s?r:t.toISOString(),c=e.ttlSeconds===void 0?mr(e.kind):e.ttlSeconds,a=gr({generatedAt:n,ttlSeconds:c,status:e.status??(s?void 0:"unknown"),now:t}),i=Date.parse(n),l=c===null||!Number.isFinite(i)?void 0:new Date(i+c*1e3),u=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||a!=="fresh");return {schemaVersion:mt,kind:e.kind,category:e.category,generatedAt:n,ttlSeconds:c,...l?{expiresAt:l.toISOString()}:{},status:a,verifyBeforeUse:u,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??G(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:hr({...e.freshness,value:e.value})}}function gt(e){let t=e.generatedAt??(e.now??new Date).toISOString(),r={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},o={structure:0,verification:0,state:0},s=0,n=0,c=0,a=0;for(let i of e.facts)r[i.freshness.kind]+=1,o[i.freshness.category]+=1,i.freshness.status==="stale"&&(s+=1),i.freshness.status==="unknown"&&(n+=1),i.freshness.kind==="live"&&(c+=1),i.freshness.verifyBeforeUse&&(a+=1);return {schemaVersion:mt,generatedAt:t,status:s>0?"stale":n>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:s,unknownFacts:n,liveFacts:c,verifyBeforeUseFacts:a,byKind:r,byCategory:o}}function z(e,t){let r=[...new Set(e)],o=r.filter(s=>t.has(s)).length;return {eligibleCount:r.length,boundCount:o,unknownCount:r.length-o,coverageRatio:r.length===0?null:o/r.length}}function ht(e,t){let r=e.filter(d=>d.kind==="project").map(d=>d.id),o=e.filter(d=>d.kind==="endpoint").map(d=>d.id),s=new Set(o),n=e.filter(d=>d.kind==="api"&&!!d.projectId&&d.attributes.runtimeRegistrationRequired===true).map(d=>d.id),c=new Set(n),a=new Map(e.map(d=>[d.id,d.kind])),i=new Set(t.filter(d=>d.kind==="implements"||d.kind==="defines"&&a.get(d.from)==="file"&&a.get(d.to)==="endpoint").flatMap(d=>s.has(d.from)?[d.from]:s.has(d.to)?[d.to]:[])),l=new Set(t.filter(d=>d.kind==="implements"&&(a.get(d.from)==="runtime-unit"||a.get(d.to)==="runtime-unit")).flatMap(d=>c.has(d.from)?[d.from]:c.has(d.to)?[d.to]:[])),u=new Set(r),p=d=>new Set(t.filter(f=>f.kind===d).flatMap(f=>[f.from,f.to]).filter(f=>u.has(f)));return {apiImplementation:z(o,i),apiRuntimeRegistration:z(n,l),projectTests:z(r,p("tests")),projectDeployment:z(r,p("deploys")),projectOwnership:z(r,p("owns"))}}function kt(e,t){return e.filter(o=>o.code.includes("unknown")||o.code.includes("unresolved")||o.code.includes("limit_reached")||o.code.endsWith(".empty_result")).reduce((o,s)=>o+Math.max(s.entityIds?.length??0,s.relationIds?.length??0,1),0)+Object.values(t).reduce((o,s)=>o+s.unknownCount,0)}function Ce(e,t){return t===0?1:e/t}function kr(e,t,r,o){return e.entityIds?.some(s=>t.has(s))||e.relationIds?.some(s=>r.has(s))?true:e.entityIds?.length||e.relationIds?.length?false:!/\bproject\b/i.test(e.message)||e.message.includes(o)}function yr(e,t,r,o,s){let n=new Set(s.filter(a=>a.provider===e.id).map(a=>a.id)),c=e.inputCoverage?.filter(a=>a.scope==="workspace"||a.scope==="project"&&a.scopeId===t);return {...e,discoveredEntities:r.filter(a=>a.proofIds.some(i=>n.has(i))).length,discoveredRelations:o.filter(a=>a.proofIds.some(i=>n.has(i))).length,proofCount:n.size,...c?{inputCoverage:c}:{}}}function wr(e,t){let r=new Set(e.entities.filter(m=>m.projectId===t).map(m=>m.id)),o=e.relations.filter(m=>r.has(m.from)||r.has(m.to)),s=new Set(r);for(let m of o)s.add(m.from),s.add(m.to);let n=e.entities.filter(m=>s.has(m.id)),c=new Set([...n,...o].flatMap(m=>m.proofIds)),a=e.proofs.filter(m=>c.has(m.id)),i=new Set(o.map(m=>m.id)),l=e.diagnostics.filter(m=>kr(m,s,i,t)),u=e.providers.map(m=>yr(m,t,n,o,a)),p=e.source.inputs?.scopes.filter(m=>m.kind==="workspace"||m.kind==="project"&&m.id===t)??[],d=p.filter(m=>!m.truncated).length,f=u.reduce((m,v)=>(v.status==="failed"?m.failed+=1:v.status==="skipped"||v.inputCoverage?.every(x=>x.status==="not-applicable")?m.notApplicable+=1:v.status==="partial"||v.inputCoverage?.some(x=>x.status==="bounded")?m.bounded+=1:m.complete+=1,m),{complete:0,bounded:0,notApplicable:0,failed:0}),y=ht(n,o);return {...e,entities:n,relations:o,proofs:a,providers:u,quality:{entityCount:n.length,relationCount:o.length,proofCount:a.length,entityProofCoverageRatio:Ce(n.filter(m=>m.proofIds.length>0).length,n.length),relationProofCoverageRatio:Ce(o.filter(m=>m.proofIds.length>0).length,o.length),providerSuccessRatio:Ce(u.filter(m=>m.status!=="failed").length,u.length),conflictCount:l.filter(m=>m.code.includes("conflict")).length,unknownCount:kt(l,y),bindingCoverage:y,...e.quality.completeness?{completeness:{status:p.some(m=>m.truncated)||f.bounded>0||f.failed>0?"bounded":"complete",inventory:{scopeCount:p.length,completeScopes:d,boundedScopes:p.length-d,eligibleFiles:p.reduce((m,v)=>m+(v.eligibleFileCount??v.fileCount),0),indexedFiles:p.reduce((m,v)=>m+v.fileCount,0),eligibleFileCountExact:p.every(m=>m.eligibleFileCountExact!==false)},providers:f}}:{},portable:true,secretValuesEmitted:false},diagnostics:l}}var vr=s.projectKnowledgeGraphReference.schemaVersion;function wt(e,t){let r=wr(e,t),o={schemaVersion:vr,generatedAt:e.generatedAt,project:{name:t},canonical:{graph:"workspace:.workspai/reports/workspace-knowledge-graph.json",boundedQuery:`workspai workspace graph search <task-query> --scope project:${t} --limit 12 --json`,sourceHash:e.source.hash,projectionHash:c$1(r)},summary:{entityCount:r.entities.length,relationCount:r.relations.length,proofCount:r.proofs.length}};return {...o,integrity:{algorithm:"sha256",payloadHash:c$1(o),portable:true,absolutePathsEmitted:false}}}function vt(e,t){return g.resolve(t.absolutePath??g.join(e,t.path))}var br=q$1.model,ie=p.model;function Pe(e){return e.projectTopology??e.graph}function jt(e){return !!(e.projectTopology&&e.graph&&c$1(e.projectTopology)===c$1(e.graph))}function eo(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 jr=["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"],Cr=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function Ct(e,t){return (g.relative(e,t)||".").split(g.sep).join("/")}async function Pt(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function Pr(e,t){for(let r of t)if(await P.pathExists(g.join(e,r)))return true;return false}function Se(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 Sr(e,t){let r=g.resolve(e),o=[{dirPath:r,depth:0}],s=new Set,n=new Set;for(;o.length>0;){let c=o.shift();if(!c)continue;let a=g.resolve(c.dirPath);if(n.has(a))continue;if(n.add(a),a!==r&&await Pr(a,jr)){s.add(a);continue}if(c.depth>=t)continue;let i=[];try{i=await P.readdir(a,{withFileTypes:true});}catch{continue}for(let l of i)!l.isDirectory()||Cr.has(l.name)||a$5(l.name)||l.name.startsWith(".")&&l.name!==".config"||o.push({dirPath:g.join(a,l.name),depth:c.depth+1});}return Array.from(s).sort((c,a)=>c.localeCompare(a))}function Er(e){let t=new Set,r=[];for(let o of e){let s=g.resolve(o);t.has(s)||(t.add(s),r.push(s));}return r.sort((o,s)=>o.localeCompare(s))}function bt(e,t){let r=e?.[t];return typeof r=="string"&&r.trim()?r.trim():void 0}function Wr(e,t){return e?.[t]===true}function xr(e,t,r){let o=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,s=bt(o,"generator"),n=bt(o,"command_display"),c=typeof t=="string"&&t.startsWith("frontend.");if(!(!s&&!c))return {...s?{id:s}:{},...t?{kit:t}:{},displayName:r,source:Wr(o,"official_generator")?"official-generator":"metadata",...n?{commandDisplay:n}:{}}}async function Rr(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 s of t)await P.pathExists(g.join(e,s))&&r.push(s);let o=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(s=>o.has(s))){let s=[],n=new Set([".git",".workspai",".rapidkit",".venv","build","dist","node_modules","target","third_party","vendor"]),c=(p,d)=>{let f=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(f)||f.endsWith(".gemspec")||f==="description"&&d.toLowerCase()==="r"},a=async(p,d)=>{if(d>3||s.length>=512)return;let f=await P.readdir(p,{withFileTypes:true}).catch(()=>[]);for(let y of f.sort((m,v)=>m.name.localeCompare(v.name))){if(s.length>=512)return;y.isFile()&&c(y.name,g.basename(p))?s.push(g.relative(e,g.join(p,y.name)).split(g.sep).join("/")):y.isDirectory()&&!n.has(y.name)&&await a(g.join(p,y.name),d+1);}};await a(e,0);let i=new Map;for(let p of s){let d=p.split("/")[0],f=i.get(d)??[];f.push(p),i.set(d,f);}for(let p of i.values())p.sort((d,f)=>d.split("/").length-f.split("/").length||d.localeCompare(f));let l=[],u=[...i.keys()].sort();for(let p=0;l.length<16&&u.some(d=>p<(i.get(d)?.length??0));p+=1)for(let d of u){let f=i.get(d)?.[p];f&&l.length<16&&l.push(f);}r.push(...l.filter(p=>!r.includes(p)));}return r}async function R(e,t,r,o=t){let s=await g$1(e,t),n=s!==null,c={path:o.split(g.sep).join("/"),exists:n};if(s&&r){let a=await Pt(s);typeof a?.generatedAt=="string"&&(c.generatedAt=a.generatedAt);let i=a?.status??a?.result??a?.verdict;typeof i=="string"&&(c.status=i);}return c}async function Ar(e,t,r){let o=Ct(e,t),s=".workspai/reports",n=i=>R(t,`${s}/${i}`,r,`${o}/${s}/${i}`),c=await n("doctor-project-last-run.json");return {doctor:c?.exists===true?c: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 Mr(e,t,r){let o=j$2(t),s=m(t,o),n=z$1(t),c=f(s.runtime),a=await b$2(t,o,{runtime:s.runtime,framework:s.key}),i=r.contractProject?.slug?r.contractProject.slug:typeof o?.name=="string"&&o.name.trim()?o.name.trim():g.basename(t),l$1=typeof o?.kit_name=="string"?o.kit_name:typeof o?.kit=="string"?o.kit:r.contractProject?.kit,u=typeof o?.engine=="string"?o.engine:n.engine!=="unknown"?n.engine:void 0,p=xr(o,l$1,s.displayName),d=Qe({kitId:l$1,framework:s.key,runtime:s.runtime}),f$1=l(t),y=[s.runtime,...f$1.filter(v=>v!==s.runtime)],m$1=await c$2({projectPath:t,declaration:r.contractProject?.governance});return {name:i,path:Ct(e,t),...r.includeAbsolutePaths?{absolutePath:t}:{},kind:a,category:a$3(a),runtime:s.runtime,runtimeCandidates:y,framework:s.key,frameworkDisplayName:s.displayName,confidence:s.confidence,detectionSource:s.source,supportTier:s.supportTier,runtimeSupportTier:c.tier,runtimeDoctorSupport:c.doctorSupport,moduleSupport:n.moduleSupport,...l$1?{kit:l$1}:{},...u?{engine:u}:{},...p?{generator:p}:{},createCapability:d,commands:{supported:n.supportedCommands,unsupported:n.unsupportedCommands,global:n.globalCommands,fleetStages:n.fleetStages,localOnly:n.localOnlyCommands,map:n.commandMap},importantFiles:await Rr(t),governance:m$1,evidence:await Ar(e,t,r.includeEvidence),provenance:{path:r.contractProject?"workspace contract declaration reconciled with filesystem discovery":"filesystem discovery",runtime:s.source,framework:s.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 Ir(e){for(let t$1 of t(e,"workspace.json")){let r=await Pt(t$1);if(r)return r}return null}function Fr(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 Dr(e){let t=new Set;for(let r of e){let o=`${r.name} ${r.path}`.toLowerCase();for(let s of ["auth","billing","payment","notification","order","admin","report","search","analytics"])o.includes(s)&&t.add(s);}return Array.from(t).sort()}function C(e,t,r,o){return {severity:e,code:t,message:r,target:o}}function St(e){let t=[];e.workspace.name.trim()||t.push(C("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(C("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(C("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(C("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 c=n.name.toLowerCase(),a=r.get(c)??[];a.push(n),r.set(c,a),n.importantFiles.length||t.push(C("warning","project.markers.missing",`Project ${n.name} has no important manifest files recorded.`,n.path));let i=g.isAbsolute(n.path)?n.path:g.resolve(e.workspace.root,n.path);P.existsSync(i)||t.push(C("warning","project.path.missing",`Registered project ${n.name} is not available at its declared path.`,n.path)),n.runtime==="unknown"&&t.push(C("warning","project.runtime.unknown",`Project ${n.name} runtime could not be confidently detected.`,n.path));let l=["test","build"];for(let d of l)n.commands.supported.includes(d)&&n.commands.unsupported.includes(d)&&t.push(C("error","project.commands.conflict",`Project ${n.name} marks ${d} as both supported and unsupported.`,n.path));let u=new Set(n.commands.fleetStages),p=new Set(n.commands.localOnly);for(let d of n.commands.fleetStages){p.has(d)&&t.push(C("error","project.commands.scope-conflict",`Project ${n.name} marks ${d} as both fleet and local-only.`,n.path));let f=n.commands.map[d];(!f||f.status!=="supported"||f.fleetEligible!==true||f.executionScope!=="fleet")&&t.push(C("error","project.commands.fleet-stage-invalid",`Project ${n.name} advertises ${d} as a fleet stage without a supported fleet capability.`,n.path));}for(let d of n.commands.localOnly){let f=n.commands.map[d];(!f||f.status!=="supported"||f.executionScope!=="local-only"||f.fleetEligible===true)&&t.push(C("error","project.commands.local-only-invalid",`Project ${n.name} advertises ${d} as local-only without a matching local-only capability.`,n.path));}for(let d of Object.values(n.commands.map))d.status==="supported"&&(d.fleetEligible===true&&!u.has(d.command)&&t.push(C("error","project.commands.fleet-stage-missing",`Project ${n.name} capability ${d.command} is fleet-eligible but missing from fleetStages.`,n.path)),d.executionScope==="local-only"&&d.fleetEligible!==true&&!p.has(d.command)&&t.push(C("error","project.commands.local-only-missing",`Project ${n.name} capability ${d.command} is local-only but missing from localOnly commands.`,n.path)));}for(let[n,c]of r.entries())c.length>1&&t.push(C("error","project.name.duplicate",`Project name "${n}" is ambiguous across ${c.length} project roots.`,c.map(a=>a.path).join(", ")));e.projectTopology&&e.graph&&c$1({...e.projectTopology,generatedAt:"<ignored>"})!==c$1({...e.graph,generatedAt:"<ignored>"})&&t.push(C("error","workspace.project-topology.alias-mismatch","Deprecated model.graph must remain structurally identical to canonical model.projectTopology during the v1 migration window.","projectTopology"));let o=t.filter(n=>n.severity==="error").length,s=t.filter(n=>n.severity==="warning").length;return {status:o>0?"failed":s>0?"warning":"passed",errors:o,warnings:s,issues:t}}function to(e){return St(e)}function j(e){return e.join(".")}function Or(e,t){let r=ie,o=e.generatedAt,s=[b({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:o,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:o,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:o,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:o,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:o,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:o,now:t,sourceArtifact:r,sourcePath:j(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})],n=Pe(e);n&&s.push(b({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:n.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??o,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??o,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[c,a]of e.projects.entries()){let i=`projects[${c}]`,l={kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};s.push(b({id:`project.${a.name}.kind`,label:`${a.name} kind`,scope:"project",project:a.name,value:a.kind,freshness:{...l,sourcePath:j([i,"kind"])}}),b({id:`project.${a.name}.category`,label:`${a.name} category`,scope:"project",project:a.name,value:a.category,freshness:{...l,sourcePath:j([i,"category"])}}),b({id:`project.${a.name}.runtime`,label:`${a.name} runtime`,scope:"project",project:a.name,value:a.runtime,freshness:{...l,sourcePath:j([i,"runtime"])}}),b({id:`project.${a.name}.framework`,label:`${a.name} framework`,scope:"project",project:a.name,value:a.frameworkDisplayName,freshness:{...l,sourcePath:j([i,"frameworkDisplayName"])}}),b({id:`project.${a.name}.supportTier`,label:`${a.name} support tier`,scope:"project",project:a.name,value:a.supportTier,freshness:{...l,sourcePath:j([i,"supportTier"])}}),b({id:`project.${a.name}.safeFleetStages`,label:`${a.name} safe fleet stages`,scope:"command",project:a.name,value:a.commands.fleetStages,freshness:{...l,sourcePath:j([i,"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:{...l,sourcePath:j([i,"governance",u]),reason:"Governance truth is reconciled from repository surfaces and explicit workspace contract declarations."}})));for(let[u,p]of Object.entries(a.evidence))s.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??o,now:t,status:p?.exists?void 0:"unknown",sourceArtifact:p?.path??r,sourcePath:j([i,"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[c,a]of Object.entries(e.evidence))s.push(b({id:`workspace.evidence.${c}`,label:`Workspace ${c} 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??o,now:t,status:a?.exists?void 0:"unknown",sourceArtifact:a?.path??r,sourcePath:j(["evidence",c]),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 s}async function Ee(e,t){let[r,o,s,n,c,a$3]=await Promise.all([a(e),Ir(e),We(e),a$1(e),a$2(e,{descendIntoMatchedProjects:false}),Sr(e,t)]),i=new Map;for(let u of s?.projects??[]){let p=u.externalPath?g.resolve(e,u.externalPath):g.resolve(e,u.relativePath);i.set(p,u);}let l=Er([...c,...a$3,...i.keys(),...n.map(u=>g.isAbsolute(u.path)?u.path:g.join(e,u.path))]);return {marker:r,workspaceJson:o,workspaceContract:s,contractProjectPaths:i,projectPaths:l}}async function ce(e){let t$2=g.resolve(e.workspacePath),r=e.includeAbsolutePaths===true,o=e.includeEvidence===true,s=Se(e.observableScanDepth),n=e.now??new Date,{marker:c,workspaceJson:a,workspaceContract:i,contractProjectPaths:l,projectPaths:u}=await Ee(t$2,s),p$1=e.reuseProjectModels,d=await Promise.all(u.map(k=>{if(p$1){let xt=g.relative(t$2,g.resolve(k)).split(g.sep).join("/"),xe=p$1.get(xt);if(xe)return Promise.resolve(xe)}return Mr(t$2,k,{includeAbsolutePaths:r,includeEvidence:o,contractProject:l.get(g.resolve(k))})})),f=typeof a?.workspace_name=="string"?a.workspace_name:typeof a?.name=="string"?a.name:c?.name||i?.workspace.name||g.basename(t$2),y=typeof a?.profile=="string"?a.profile:typeof a?.mode=="string"?a.mode:i?.workspace.profile,m=Array.from(new Set(d.map(k=>k.kind))).sort(),v=Array.from(new Set(d.map(k=>k.category))).sort(),x=Array.from(new Set(d.flatMap(k=>k.runtimeCandidates.length>0?k.runtimeCandidates:[k.runtime]))).sort(),q=Array.from(new Set(d.map(k=>k.framework))).sort(),_=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(k=>P.existsSync(g.join(t$2,k))),J=t(t$2,"workspace.contract.json").map(k=>g.relative(t$2,k).split(g.sep).join("/")).find(k=>P.existsSync(g.join(t$2,k)))??t$1.workspaceContract,D=await P.pathExists(g.join(t$2,J)),X={schemaVersion:br,generatedAt:n.toISOString(),workspace:{name:f,root:t$2,...y?{profile:y}:{},type:c?"rapidkit-workspace":"observed-workspace",...c?{marker:{createdBy:c.createdBy,version:c.version,createdAt:c.createdAt}}:{}},identity:{workspaceType:Fr(d),surfaces:m,categories:v,runtimeFamilies:x,businessCapabilities:Dr(d)},discovery:{observableScanDepth:s},projects:d,policies:{mode:typeof a?.policy_mode=="string"?a.policy_mode:typeof a?.policyMode=="string"?a.policyMode:"warn",source:_??null,exists:!!_},contracts:{workspaceContractPath:J,exists:D,status:D?"known":"missing"},evidence:{doctor:await R(t$2,p.doctor,o),projectDoctor:await R(t$2,t$1.doctorProject,o),doctorRemediationPlan:await R(t$2,t$1.doctorRemediationPlan,o),artifactRemediationPlan:await R(t$2,t$1.artifactRemediationPlan,o),doctorFixResult:await R(t$2,t$1.doctorFixResult,o),analyze:await R(t$2,p.analyze,o),readiness:await R(t$2,p.readiness,o),pipeline:await R(t$2,t$1.pipelineLastRun,o)},summary:{projectCount:d.length,runtimes:x,frameworks:q,firstClassProjects:d.filter(k=>k.supportTier==="first-class").length,extendedProjects:d.filter(k=>k.supportTier==="extended").length,observedProjects:d.filter(k=>k.supportTier==="observed").length}},S=await Et(t$2,X,{contractExists:D,now:n,incrementalGraph:e.incrementalGraph}),E={...X,projectTopology:S,graph:S},O=St(E),T=Or({...E},n),Wt=gt({facts:T,generatedAt:n.toISOString(),now:n});return {...E,facts:T,factFreshness:Wt,validation:O}}async function ro(e){if(e.cache!==true)return {model:await ce(e),cache:"disabled"};let t=g.resolve(e.workspacePath),r=Se(e.observableScanDepth),o=be(),{marker:s,workspaceJson:n,projectPaths:c}=await Ee(t,r),a=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:c,workspaceJson:n,marker:s}),i=await je(t);if(i&&i.cliVersion===o&&i.inputsHash===a&&jt(i.model))return {model:i.model,cache:"hit"};let l=await ce({...e}),[u,p]=await Promise.all([ne(t,c),oe(t)]);return await ae(t,{cliVersion:o,inputsHash:a,generatedAt:(e.now??new Date).toISOString(),model:l,projectSignatures:u,workspaceFileSignatures:p}),{model:l,cache:"miss"}}function Gr(e,t){let r=new Set,o=new Set,s=new Set;for(let[n,c]of Object.entries(t))n in e?e[n]!==c&&r.add(n):o.add(n);for(let n of Object.keys(e))n in t||s.add(n);return {changed:r,added:o,removed:s}}function _r(e={},t={}){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of r)if(e[o]!==t[o])return false;return true}async function no(e){let t=g.resolve(e.workspacePath),r=Se(e.observableScanDepth),o=be(),s=e.now??new Date,{marker:n,workspaceJson:c,projectPaths:a}=await Ee(t,r),i=await je(t),l=async()=>{let S=await ce({...e}),E=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:a,workspaceJson:c,marker:n}),[O,T]=await Promise.all([ne(t,a),oe(t)]);return await ae(t,{cliVersion:o,inputsHash:E,generatedAt:s.toISOString(),model:S,projectSignatures:O,workspaceFileSignatures:T}),{model:S,mode:"full"}},u=i?Pe(i.model):void 0;if(!i||i.cliVersion!==o||!i.projectSignatures||!u||!jt(i.model))return l();let p=await oe(t);if(!_r(i.workspaceFileSignatures,p))return l();let d=await ne(t,a),{changed:f,added:y,removed:m}=Gr(i.projectSignatures,d);if(f.size===0&&y.size===0&&m.size===0)return {model:i.model,mode:"unchanged"};let v=new Set([...f,...y]),x=new Map;for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");!v.has(E)&&!m.has(E)&&x.set(E,S);}let q=new Set,_=false;for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");f.has(E)&&q.add(S.name);}let J=y.size>0||m.size>0,D=await ce({...e,reuseProjectModels:x,incrementalGraph:{previousGraph:u,changedProjectIds:q,structuralChange:J||_}});for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");if(!f.has(E))continue;let O=D.projects.find(T=>T.path.split(g.sep).join("/")===E);if(O&&O.name!==S.name){_=true;break}}if(_)return l();let X=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:a,workspaceJson:c,marker:n});return await ae(t,{cliVersion:o,inputsHash:X,generatedAt:s.toISOString(),model:D,projectSignatures:d,workspaceFileSignatures:p}),{model:D,mode:"incremental"}}async function We(e){try{let{contract:t}=await p$1({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function Et(e,t,r){let o=r.contractExists?await We(e):null;try{return r.incrementalGraph?await pt({workspacePath:e,model:t,contract:o,now:r.now,previousGraph:r.incrementalGraph.previousGraph,changedProjectIds:r.incrementalGraph.changedProjectIds,structuralChange:r.incrementalGraph.structuralChange}):await dt({workspacePath:e,model:t,contract:o,now:r.now})}catch{let s=t.projects.map(n=>({id:n.name,path:n.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:r.now.toISOString(),nodes:s,edges:[],stats:{nodeCount:s.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:s.length,connectedNodeCount:0,density:0,edgeCoverageRatio:s.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:s.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:s.map(n=>n.id).sort((n,c)=>n.localeCompare(c))}]:void 0}}}async function oo(e,t,r={}){let o=e.contracts.exists?await We(t):null,{buildWorkspaceKnowledgeGraph:s}=await import('./workspace-knowledge-graph-3564KQXT.js'),n=d(e),c=r.refreshKnowledgeGraph?null:await P.readJson(g.join(t,p.knowledgeGraph)).then(p=>p).catch(()=>null),a=await s({workspacePath:t,workspace:{name:e.workspace.name,...e.workspace.profile?{profile:e.workspace.profile}:{}},projects:e.projects.map(p=>({id:p.name,path:p.path,...p.absolutePath?{absolutePath:p.absolutePath}:{},runtime:p.runtime,runtimeCandidates:p.runtimeCandidates,framework:p.framework,kind:p.kind,category:p.category,...p.governance?{governance:p.governance}:{},...p.kit?{kit:p.kit}:{}})),projectTopology:Pe(e)??await Et(t,e,{contractExists:e.contracts.exists,now:new Date(e.generatedAt)}),contract:o,now:new Date(e.generatedAt),source:{kind:"workspace-model",artifact:ie,hashAlgorithm:"sha256",hash:d$1(n)},previousGraph:c}),i=[],l=new Map;for(let p of e.projects){let d=vt(t,p);if(!(await P.stat(d).catch(()=>null))?.isDirectory())continue;let y=await P.realpath(d),m=l.get(y);if(m)throw new Error(`Projects ${m} and ${p.name} resolve to the same graph artifact root: ${d}`);l.set(y,p.name),i.push({rootPath:d,relativePath:t$1.projectKnowledgeGraphReference,payload:wt(a,p.name)});}let u=await j$1(t,ie,[{rootPath:t,relativePath:p.knowledgeGraph,payload:a},{rootPath:t,relativePath:ie,payload:n},...i]);for(let p$1 of i){let d=g.join(p$1.rootPath,p.knowledgeGraph);(await P.readJson(d).catch(()=>null))?.schemaVersion===q$1.knowledgeGraph&&await P.remove(d).catch(()=>{});}return u[1]}export{Qe as a,$r as b,Lr as c,G as d,mt as e,b as f,gt as g,ht as h,kt as i,wr as j,br as k,ie as l,Pe as m,eo as n,to as o,Or as p,ce as q,ro as r,no as s,oo as t};