workspai 0.68.0 → 0.70.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.
- package/README.md +38 -18
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +459 -0
- package/contracts/extension-cli-compatibility.v1.json +11 -0
- package/contracts/published-contract-catalog.v1.json +55 -0
- package/contracts/runtime-command-surface.v1.json +282 -0
- package/contracts/workspace-intelligence/architecture-change-lease.v1.json +50 -0
- package/contracts/workspace-intelligence/architecture-surprise-report.v1.json +46 -0
- package/contracts/workspace-intelligence/change-operation-result.v1.json +43 -0
- package/contracts/workspace-intelligence/decision-checkpoint.v1.json +18 -0
- package/contracts/workspace-intelligence/decision-event.v1.json +154 -0
- package/contracts/workspace-intelligence/decision-transaction.v1.json +29 -0
- package/contracts/workspace-intelligence/goal-index.v1.json +13 -0
- package/contracts/workspace-intelligence/goal-pack.v1.json +2 -1
- package/contracts/workspace-intelligence/predicted-architecture-change.v1.json +34 -0
- package/contracts/workspace-intelligence/proof-carrying-change-capsule-export.v1.json +14 -0
- package/contracts/workspace-intelligence/proof-carrying-change-capsule-validation.v1.json +16 -0
- package/contracts/workspace-intelligence/proof-carrying-change-capsule.v1.json +63 -0
- package/contracts/workspace-intelligence/proof-carrying-change-list.v1.json +80 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json +9 -1
- package/dist/analyze-OGWDSPXQ.js +1 -0
- package/dist/{artifact-remediation-plan-I7IKC5MR.js → artifact-remediation-plan-URQL5MBN.js} +1 -1
- package/dist/autopilot-release-QQDFEPT7.js +1 -0
- package/dist/capabilities-command-NFGX42CH.js +1 -0
- package/dist/chunk-37SWTS2B.js +1 -0
- package/dist/{chunk-KDY4X7SQ.js → chunk-3S2U7WRM.js} +1 -1
- package/dist/{chunk-BHM6RHTA.js → chunk-3WHE7V4M.js} +1 -1
- package/dist/{chunk-2C5XJBYI.js → chunk-4R7STECB.js} +64 -64
- package/dist/chunk-AGZWDYMF.js +12 -0
- package/dist/chunk-COICGD62.js +1 -0
- package/dist/chunk-DNZHKBQ3.js +49 -0
- package/dist/{chunk-4WVOAX2V.js → chunk-DWL3PPLA.js} +1 -1
- package/dist/chunk-EBQS5T7Q.js +7 -0
- package/dist/chunk-EP6Q2QBU.js +1 -0
- package/dist/chunk-EZPLMAW2.js +1 -0
- package/dist/chunk-FE5R6EUV.js +2 -0
- package/dist/chunk-FIK343LI.js +1 -0
- package/dist/chunk-GED7JURY.js +157 -0
- package/dist/{chunk-3Z4SVBMR.js → chunk-GL3KLNIG.js} +1 -1
- package/dist/{chunk-TMRCPT7S.js → chunk-GYN6RPNU.js} +1 -1
- package/dist/{chunk-6E2Y3XGT.js → chunk-HCFOVANQ.js} +1 -1
- package/dist/{chunk-7DDEMDG2.js → chunk-IET57ZKN.js} +2 -2
- package/dist/{chunk-5OV2WXAR.js → chunk-IFHM2SI6.js} +1 -1
- package/dist/{chunk-3BMYMZQB.js → chunk-IGJA6GBQ.js} +1 -1
- package/dist/chunk-IHKG5C6G.js +1 -0
- package/dist/chunk-IRLKWRLP.js +3 -0
- package/dist/{chunk-FX5J6JCK.js → chunk-IVYPC36J.js} +1 -1
- package/dist/{chunk-DFVG4DDZ.js → chunk-JK6XEF7K.js} +3 -3
- package/dist/chunk-K33JJVQZ.js +2 -0
- package/dist/{chunk-3XF7O66C.js → chunk-LE2I2E6R.js} +5 -5
- package/dist/chunk-LU6CYDLN.js +1 -0
- package/dist/{chunk-QMQBX3RV.js → chunk-MGL6DBOR.js} +1 -1
- package/dist/chunk-N4B2M44I.js +1 -0
- package/dist/chunk-N6FJZ62B.js +2 -0
- package/dist/chunk-NSH7TTSV.js +1 -0
- package/dist/chunk-O5XQP5E7.js +1 -0
- package/dist/chunk-ODK4LCEL.js +1 -0
- package/dist/chunk-PTSEDZIV.js +2 -0
- package/dist/chunk-QNHKUSBH.js +1 -0
- package/dist/{chunk-SLFOUSRW.js → chunk-QYEQVNBF.js} +1 -1
- package/dist/chunk-QZODGRAI.js +2 -0
- package/dist/chunk-S2TOSHQW.js +4 -0
- package/dist/chunk-S42KDOGG.js +1 -0
- package/dist/chunk-TEMFNVO2.js +2 -0
- package/dist/chunk-TKXRP2B4.js +1 -0
- package/dist/{chunk-IXXQMD34.js → chunk-TLMP2MGH.js} +1 -1
- package/dist/chunk-UNXG3ZFV.js +1 -0
- package/dist/chunk-UT57IFS4.js +8 -0
- package/dist/{chunk-2MTJWPQ4.js → chunk-V52R2W2Q.js} +1 -1
- package/dist/chunk-WUXJCSYO.js +9 -0
- package/dist/chunk-XSSNM4F5.js +5 -0
- package/dist/chunk-XVTN5DDV.js +1 -0
- package/dist/{chunk-OFYY4725.js → chunk-Z7JIUA6I.js} +1 -1
- package/dist/chunk-ZLCLGIM6.js +1 -0
- package/dist/chunk-ZPOZ6MDX.js +4 -0
- package/dist/{create-U5PQHOZ4.js → create-BBALBC3U.js} +1 -1
- package/dist/doctor-WWVY7NB6.js +1 -0
- package/dist/goal-lifecycle-CEUTKUNV.js +1 -0
- package/dist/goal-pack-JQL3YOKT.js +1 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +239 -239
- package/dist/pipeline-V46WWMP4.js +5 -0
- package/dist/{project-agent-entry-MH7364BE.js → project-agent-entry-MRAYG7QD.js} +1 -1
- package/dist/{project-intelligence-lens-ZCCHUKVI.js → project-intelligence-lens-4BKPN4PE.js} +1 -1
- package/dist/{project-test-coverage-JPWTBSSJ.js → project-test-coverage-4RRCHY5W.js} +1 -1
- package/dist/proof-carrying-change-B7ONTBYO.js +1 -0
- package/dist/verified-goal-YNSBL7L3.js +1 -0
- package/dist/{workspace-B33BFZZ3.js → workspace-FJ6JRYWA.js} +1 -1
- package/dist/{workspace-agent-sync-T3MJO2MX.js → workspace-agent-sync-V33UGII3.js} +1 -1
- package/dist/{workspace-archive-NOSGRKRZ.js → workspace-archive-OSMU3CK6.js} +1 -1
- package/dist/{workspace-context-KOCEP4MJ.js → workspace-context-O6UBCBEA.js} +1 -1
- package/dist/{workspace-contract-MQ3QE52V.js → workspace-contract-S2JYDA4K.js} +1 -1
- package/dist/workspace-explain-RP6VJ6QM.js +1 -0
- package/dist/workspace-explain-contract-KV7RTEJU.js +1 -0
- package/dist/{workspace-feedback-3YLIUFQ7.js → workspace-feedback-D6HJLKBQ.js} +1 -1
- package/dist/{workspace-foundation-O7O3QIS4.js → workspace-foundation-7QXEJJKZ.js} +1 -1
- package/dist/{workspace-graph-stream-XTGGBD7D.js → workspace-graph-stream-YY65R5EC.js} +1 -1
- package/dist/workspace-graph-token-efficiency-WNAFAN2F.js +1 -0
- package/dist/{workspace-history-7HDZZ4G5.js → workspace-history-WWPS4U7H.js} +1 -1
- package/dist/{workspace-intelligence-TFEQBPUP.js → workspace-intelligence-LMR42ICR.js} +1 -1
- package/dist/{workspace-intelligence-benchmark-PLVUBGWO.js → workspace-intelligence-benchmark-S5OXVNLC.js} +1 -1
- package/dist/{workspace-intelligence-evaluation-OJIQS5SN.js → workspace-intelligence-evaluation-QDSOOUHH.js} +1 -1
- package/dist/{workspace-intelligence-runner-6ZAV6RO4.js → workspace-intelligence-runner-FXFSTCHC.js} +1 -1
- package/dist/workspace-intelligence-runtime-registry-ZLPF7BAY.js +1 -0
- package/dist/{workspace-knowledge-graph-AUXYL3L6.js → workspace-knowledge-graph-3564KQXT.js} +1 -1
- package/dist/workspace-knowledge-graph-change-overlay-FIIAFLO6.js +1 -0
- package/dist/{workspace-knowledge-graph-contract-X52KXBXJ.js → workspace-knowledge-graph-contract-FVX5T7SU.js} +1 -1
- package/dist/{workspace-knowledge-graph-query-A7TKONWY.js → workspace-knowledge-graph-query-WHCGPBGS.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-P27RPMV5.js +1 -0
- package/dist/workspace-mcp-serve-ZK46EZUD.js +3 -0
- package/dist/{workspace-model-GVXNLSQM.js → workspace-model-6UMQAGUK.js} +1 -1
- package/dist/{workspace-onboarding-ECZ2KJ2A.js → workspace-onboarding-C57OQ7XZ.js} +1 -1
- package/dist/{workspace-readme-6N5Y2ZSJ.js → workspace-readme-HA6XLDME.js} +2 -2
- package/dist/{workspace-registry-summary-5SFBTRGQ.js → workspace-registry-summary-GLQO4ZUF.js} +1 -1
- package/dist/workspace-repair-engine-5ZSSF3T5.js +3 -0
- package/dist/workspace-run-UGWGT3K2.js +1 -0
- package/dist/{workspace-verify-D3QTMAUI.js → workspace-verify-LQHXBH2D.js} +1 -1
- package/dist/{workspace-watch-XYJEW2Z2.js → workspace-watch-Z32443UP.js} +1 -1
- package/docs/README.md +35 -31
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +26 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +37 -18
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +17 -0
- package/docs/contracts/PROOF_CARRYING_CHANGE_CONTRACT_PLAN.md +68 -0
- package/docs/proof-carrying-change.implementation.v1.json +119 -0
- package/docs/proof-carrying-change.md +236 -0
- package/docs/real-world-qualification.md +8 -3
- package/package.json +1 -1
- package/dist/analyze-JDEWUBC6.js +0 -1
- package/dist/autopilot-release-OELUFNLL.js +0 -1
- package/dist/capabilities-command-RAAYENQ6.js +0 -1
- package/dist/chunk-2KX6KHEC.js +0 -1
- package/dist/chunk-3KU3YUWD.js +0 -2
- package/dist/chunk-3NF3M3RE.js +0 -1
- package/dist/chunk-3OGPTLI2.js +0 -1
- package/dist/chunk-5ME4W4LN.js +0 -1
- package/dist/chunk-5XUAAQSV.js +0 -5
- package/dist/chunk-5YZ2W57R.js +0 -8
- package/dist/chunk-7DZNZ3GM.js +0 -3
- package/dist/chunk-BG6IX6HA.js +0 -1
- package/dist/chunk-BMAFHX6A.js +0 -1
- package/dist/chunk-BUYLM6QV.js +0 -1
- package/dist/chunk-C2VTO5WT.js +0 -2
- package/dist/chunk-CPR2CMOY.js +0 -1
- package/dist/chunk-CSZPE637.js +0 -2
- package/dist/chunk-EHLGPLIU.js +0 -1
- package/dist/chunk-FPDH3N3A.js +0 -7
- package/dist/chunk-GVQKAINC.js +0 -49
- package/dist/chunk-IKUFNK46.js +0 -2
- package/dist/chunk-JYMO7QXQ.js +0 -1
- package/dist/chunk-KY2GOSO5.js +0 -1
- package/dist/chunk-LEOFD3W5.js +0 -12
- package/dist/chunk-LPCZHKD5.js +0 -1
- package/dist/chunk-N5HPMATQ.js +0 -1
- package/dist/chunk-P3622IM5.js +0 -4
- package/dist/chunk-Q7UGDNSM.js +0 -1
- package/dist/chunk-RVAOJOXA.js +0 -2
- package/dist/chunk-TCLKGPXF.js +0 -2
- package/dist/chunk-VIN7NJW3.js +0 -9
- package/dist/chunk-W5VKBDSD.js +0 -157
- package/dist/chunk-WRZSQDZV.js +0 -1
- package/dist/chunk-Y4Z6CEII.js +0 -1
- package/dist/chunk-ZEEV5J4I.js +0 -1
- package/dist/chunk-ZGHJIQXL.js +0 -1
- package/dist/doctor-D7YI7LSA.js +0 -1
- package/dist/goal-lifecycle-BMS6GSIU.js +0 -1
- package/dist/goal-pack-RBSVQMMX.js +0 -1
- package/dist/pipeline-QOMXH2EK.js +0 -5
- package/dist/verified-goal-XUXU2X5H.js +0 -1
- package/dist/workspace-explain-DTFCKYXK.js +0 -1
- package/dist/workspace-explain-contract-WMREJWHF.js +0 -1
- package/dist/workspace-graph-token-efficiency-5LJKQU2J.js +0 -1
- package/dist/workspace-intelligence-runtime-registry-UKFB3BI7.js +0 -1
- package/dist/workspace-knowledge-graph-change-overlay-XG6FC4IX.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-GPBDAKAU.js +0 -1
- package/dist/workspace-mcp-serve-TDUXJUAA.js +0 -3
- package/dist/workspace-repair-engine-CKJCTWKX.js +0 -3
- package/dist/workspace-run-ZZ5WHL7W.js +0 -1
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Proof-Carrying Change
|
|
2
|
+
|
|
3
|
+
Status: released in Workspai CLI v0.69.0; deletion-tombstone and overlapping
|
|
4
|
+
artifact-identity hardening released in v0.70.0.
|
|
5
|
+
|
|
6
|
+
> Every change carries its intent, pinned architecture baseline, predicted
|
|
7
|
+
> impact, authorized effects, actual architecture delta, independent
|
|
8
|
+
> verification, and remaining uncertainty.
|
|
9
|
+
|
|
10
|
+
Proof-Carrying Change (PCC) is a product composition, not a second Graph or
|
|
11
|
+
transaction system. Goal Pack owns intent and acceptance criteria. The
|
|
12
|
+
extraction-safe Decisions kernel owns lifecycle, causal ordering, authorization,
|
|
13
|
+
effect receipts, verification receipts, resume, and the tamper-evident ledger.
|
|
14
|
+
Model and Graph own architecture truth. Workspace Verify and domain verifiers
|
|
15
|
+
own verdicts. The CLI composes references to those owners into one capsule.
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
Start from a current adopted project or workspace:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 1. Create an immutable Goal Pack.
|
|
23
|
+
workspai goal "Improve retry behavior without breaking clients" --json
|
|
24
|
+
|
|
25
|
+
# 2. Pin that Goal and the exact Model/Graph/input generation.
|
|
26
|
+
workspai change begin --json
|
|
27
|
+
|
|
28
|
+
# Discover resumable and sealed changes without scanning directories.
|
|
29
|
+
workspai change list --json
|
|
30
|
+
|
|
31
|
+
# 3. Optionally attach an explicit prediction. It is never proof.
|
|
32
|
+
workspai change predict --change <change-id> --file prediction.json --json
|
|
33
|
+
|
|
34
|
+
# 4. A human grants only the effect classes required by the change.
|
|
35
|
+
workspai change authorize --change <change-id> \
|
|
36
|
+
--effects filesystem,command --granted-by maintainer --json
|
|
37
|
+
|
|
38
|
+
# 5. An agent, extension, or CLI tool records every observed effect.
|
|
39
|
+
workspai change effect record --change <change-id> \
|
|
40
|
+
--file effect-receipt.json --json
|
|
41
|
+
|
|
42
|
+
# 6. Rebuild/re-observe architecture and run independent verification.
|
|
43
|
+
workspai change verify --change <change-id> --strict --json
|
|
44
|
+
|
|
45
|
+
# 7. Validate or export the sealed manifest.
|
|
46
|
+
workspai change capsule validate --change <change-id> --json
|
|
47
|
+
workspai change capsule export --change <change-id> \
|
|
48
|
+
--output .workspai/exports/<change-id>.json --json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For Goals with additional release, security, or coverage criteria, `change
|
|
52
|
+
verify` first records canonical Workspace Verify and the actual Graph overlay.
|
|
53
|
+
The owning domain/CI adapter can then admit an exact-generation receipt:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
workspai change verification record --change <change-id> \
|
|
57
|
+
--file verification-receipt.json --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If a transaction is blocked, it remains durable. A human may resume it into an
|
|
61
|
+
explicit state; history is never erased:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
workspai change resume --change <change-id> --to authorized \
|
|
65
|
+
--reason "Add receipts for observed generated files" --json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Ownership and invariants
|
|
69
|
+
|
|
70
|
+
| Concern | Owner | PCC behavior |
|
|
71
|
+
| -------------------------------- | ---------------------------------- | --------------------------------------------------------------------------- |
|
|
72
|
+
| Intent, scope, success criteria | Goal Pack | References the immutable Goal and criterion IDs. |
|
|
73
|
+
| State, ledger, effects, receipts | Decisions kernel | Uses one digest-linked event stream and derived projection. |
|
|
74
|
+
| Architecture baseline and delta | Model / Graph | Pins exact hashes and reuses `workspace-knowledge-graph-change-overlay.v1`. |
|
|
75
|
+
| Verification | Workspace Verify / domain verifier | Admits only receipts bound to the current Model, Graph, and effect head. |
|
|
76
|
+
| Product view | CLI / IDE / CI | Consumes the same capsule without redefining truth. |
|
|
77
|
+
|
|
78
|
+
The runtime enforces these rules:
|
|
79
|
+
|
|
80
|
+
- prediction is `nonCanonical: true` and `proofEligible: false`;
|
|
81
|
+
- authorization names allowed effect classes before receipts are admitted;
|
|
82
|
+
- receipt idempotency keys cannot be reused;
|
|
83
|
+
- verification binds the exact current Model, Graph, and effect-head digest;
|
|
84
|
+
- observed changed artifacts must be covered by successful effect receipts;
|
|
85
|
+
- removed artifacts must be covered by validated deletion tombstones rather
|
|
86
|
+
than references to files that no longer exist;
|
|
87
|
+
- a changed Graph with no effect receipt blocks verification;
|
|
88
|
+
- every required Goal criterion needs a latest passing receipt before commit;
|
|
89
|
+
- failed or uncertain effects block the transaction;
|
|
90
|
+
- terminal transactions cannot accept later events;
|
|
91
|
+
- optimistic compare-and-append prevents concurrent history forks;
|
|
92
|
+
- capsule validation replays the event chain and checks local reference digests.
|
|
93
|
+
|
|
94
|
+
## Architecture lease
|
|
95
|
+
|
|
96
|
+
`change begin` requires a fresh Goal Pack and a current canonical Graph. It
|
|
97
|
+
creates `workspai.architecture-change-lease.v1`, binding Goal ID, workspace,
|
|
98
|
+
scope, structural Model hash, canonical Graph hash, live Graph input
|
|
99
|
+
fingerprint, and a derived generation ID.
|
|
100
|
+
|
|
101
|
+
Before prediction or authorization, the generation must still match. The lease
|
|
102
|
+
is an optimistic guard, not a filesystem or Git lock.
|
|
103
|
+
|
|
104
|
+
Because the canonical Graph path is renewed in place, begin also writes a
|
|
105
|
+
private, non-authoritative, hash-bound baseline materialization. It exists only
|
|
106
|
+
to derive the later base-to-head overlay. The capsule cites the canonical
|
|
107
|
+
baseline identity, not the cache as architecture truth.
|
|
108
|
+
|
|
109
|
+
## Typed receipts
|
|
110
|
+
|
|
111
|
+
An effect receipt includes an ID, effect class, result, summary, observation
|
|
112
|
+
time, idempotency key, optional command argv, present artifact references, and
|
|
113
|
+
optional deleted-artifact tombstones. Artifact references use labeled digest
|
|
114
|
+
semantics:
|
|
115
|
+
|
|
116
|
+
- `canonical-json-v1` for JSON evidence;
|
|
117
|
+
- `raw-bytes-v1` for source or command-output files;
|
|
118
|
+
- `workspace-model-structural-v1` for canonical Model identity.
|
|
119
|
+
|
|
120
|
+
A deletion is not represented by a fake file digest. CLI and IDE consumers may
|
|
121
|
+
submit the compact input below; the CLI normalizes it into a
|
|
122
|
+
`deletion-tombstone-v1` reference before the event enters the ledger:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"id": "remove-obsolete-retry",
|
|
127
|
+
"effectClass": "filesystem",
|
|
128
|
+
"status": "succeeded",
|
|
129
|
+
"summary": "Removed the obsolete retry implementation.",
|
|
130
|
+
"artifacts": [],
|
|
131
|
+
"deletedArtifacts": [{ "artifact": "api/src/obsolete-retry.ts" }],
|
|
132
|
+
"observedAt": "2026-08-31T12:00:00.000Z",
|
|
133
|
+
"idempotencyKey": "remove-obsolete-retry-v1"
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Admission proves that each deleted path is absent and remains inside the
|
|
138
|
+
workspace or an explicitly contracted linked-project root. Verification then
|
|
139
|
+
requires the fresh Graph overlay to report the same removal. Recreating the
|
|
140
|
+
path invalidates capsule validation. A tombstone intentionally carries no
|
|
141
|
+
unverifiable claim about the deleted bytes; the pinned baseline Graph owns the
|
|
142
|
+
pre-change architecture identity.
|
|
143
|
+
|
|
144
|
+
When adopted scopes overlap, one physical source file can have both an
|
|
145
|
+
aggregate-project Graph label and a nested-project Graph label. Effect coverage
|
|
146
|
+
resolves those portable labels through the workspace contract and treats them
|
|
147
|
+
as one mutation only when they map to the same contained filesystem target. It
|
|
148
|
+
never requires duplicate receipts for one physical effect, and it never uses
|
|
149
|
+
label similarity as proof of equivalence.
|
|
150
|
+
|
|
151
|
+
Verification receipts add a Goal criterion ID and an exact target. Domain
|
|
152
|
+
receipts are admitted only after `change verify` has re-observed the Graph and
|
|
153
|
+
recorded passing Workspace Verify evidence.
|
|
154
|
+
|
|
155
|
+
## Artifact layout
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
.workspai/decisions/<change-id>/
|
|
159
|
+
events.jsonl # authoritative causal ledger
|
|
160
|
+
transaction.json # replay-derived projection
|
|
161
|
+
checkpoint.json # generation and head integrity checkpoint
|
|
162
|
+
|
|
163
|
+
.workspai/changes/<change-id>/
|
|
164
|
+
lease.json
|
|
165
|
+
predicted-overlay.json # optional, noncanonical
|
|
166
|
+
actual-overlay.json
|
|
167
|
+
architecture-surprises.json
|
|
168
|
+
capsule.json
|
|
169
|
+
private/baseline-graph.json
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`capsule.json` is a portable hash-index and assurance summary. It does not copy
|
|
173
|
+
the Goal, event ledger, Model, Graph, or verification reports. Absolute paths,
|
|
174
|
+
secrets, prompts, and unbounded command output are not capsule content.
|
|
175
|
+
Use the schema-validated `change list --json` projection for IDE and automation
|
|
176
|
+
discovery; filesystem directory order is never lifecycle truth.
|
|
177
|
+
|
|
178
|
+
Every CLI operation also emits a Live activity observation correlated by the
|
|
179
|
+
change ID, and every PCC artifact write flows through the shared artifact
|
|
180
|
+
publisher. Live remains execution telemetry rather than verification proof;
|
|
181
|
+
the capsule references Decision, Graph, effect, and verifier evidence instead
|
|
182
|
+
of upgrading an observed activity event into an assurance claim.
|
|
183
|
+
|
|
184
|
+
Read-only MCP consumers receive the same ledger-derived projections through
|
|
185
|
+
`listProofCarryingChanges`, `getProofCarryingChange`, and
|
|
186
|
+
`validateProofCarryingChange`. No PCC mutation tool is exposed over MCP; effect
|
|
187
|
+
authorization and execution remain behind explicit CLI or IDE approval
|
|
188
|
+
boundaries.
|
|
189
|
+
|
|
190
|
+
CI can fail closed on capsule integrity and assurance without parsing terminal
|
|
191
|
+
text:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
workspai change capsule validate --change "$CHANGE_ID" --json
|
|
195
|
+
workspai change status --change "$CHANGE_ID" --json
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
An invalid capsule exits non-zero. Policy automation should additionally
|
|
199
|
+
require `capsule.status == "sealed"` when a sealed change is a merge or release
|
|
200
|
+
condition.
|
|
201
|
+
|
|
202
|
+
## Decision states
|
|
203
|
+
|
|
204
|
+
The Decisions owner derives these states from events:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
draft -> scoped -> evidence-ready -> authorized -> executing -> verifying
|
|
208
|
+
\-> blocked/awaiting-human -> resumed
|
|
209
|
+
verifying -> committed
|
|
210
|
+
any nonterminal state -> aborted/rejected/superseded
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The product-facing capsule reports `open`, `blocked`, `verified`, `sealed`, or
|
|
214
|
+
`aborted`. A sealed capsule means all immutable Goal criteria have passing
|
|
215
|
+
post-effect receipts. It does not mean unsupported external claims became true.
|
|
216
|
+
|
|
217
|
+
## Prediction versus observation
|
|
218
|
+
|
|
219
|
+
The prediction lists expected add/remove/change operations for entities,
|
|
220
|
+
relations, proofs, or artifacts. `change verify` derives the actual overlay from
|
|
221
|
+
the pinned Graph and fresh canonical head, then emits matched operations,
|
|
222
|
+
unpredicted actual operations, predicted operations not observed, and an honest
|
|
223
|
+
`exact`, `within-expectation`, `surprising`, or `no-prediction` verdict.
|
|
224
|
+
|
|
225
|
+
Surprise analysis is explanatory evidence. It is not self-corroborating proof
|
|
226
|
+
and cannot replace verification.
|
|
227
|
+
|
|
228
|
+
## Deferred work
|
|
229
|
+
|
|
230
|
+
Rich hosted PR annotations remain separate from the machine-readable CI gate
|
|
231
|
+
above. Semantic multi-change overlap, immutable historical Graph queries,
|
|
232
|
+
isolated patch simulation, and remote attestation remain separate follow-up
|
|
233
|
+
capabilities. No current command claims those behaviors.
|
|
234
|
+
|
|
235
|
+
See the [contract reference](./contracts/PROOF_CARRYING_CHANGE_CONTRACT_PLAN.md)
|
|
236
|
+
and [implementation manifest](./proof-carrying-change.implementation.v1.json).
|
|
@@ -5,8 +5,9 @@ remain the release gates. Real-world qualification complements them by running
|
|
|
5
5
|
the installed CLI against explicitly selected reference repositories through
|
|
6
6
|
local, network-free Git snapshots
|
|
7
7
|
without installing dependencies or executing project lifecycle commands.
|
|
8
|
-
Every isolated workspace also receives
|
|
9
|
-
`--run-root`; qualification cannot
|
|
8
|
+
Every isolated workspace also receives private `WORKSPAI_STATE_DIR` and
|
|
9
|
+
`WORKSPAI_ACTIVITY_STATE_DIR` roots beneath `--run-root`; qualification cannot
|
|
10
|
+
read or update the user's canonical registry, activity journals, transaction
|
|
10
11
|
journals, or legacy registry mirror.
|
|
11
12
|
|
|
12
13
|
## Isolated and cumulative layouts
|
|
@@ -96,7 +97,9 @@ that safety boundary as a command failure.
|
|
|
96
97
|
- Runtime candidates describe observed nested composition; the authoritative
|
|
97
98
|
project runtime controls repair-adapter assertions. An aggregate boundary with
|
|
98
99
|
runtime `unknown` therefore follows the governed manual-repair path instead of
|
|
99
|
-
promoting its first nested runtime candidate.
|
|
100
|
+
promoting its first nested runtime candidate. Analyze reports a confirmed
|
|
101
|
+
multi-runtime aggregate as informational architecture rather than an
|
|
102
|
+
unknown-stack blocker.
|
|
100
103
|
- Goal qualification publishes one system-understanding Goal inside the
|
|
101
104
|
isolated test workspace, validates its lifecycle binding, and previews
|
|
102
105
|
runtime-specific coverage and release-readiness goals without executing
|
|
@@ -110,6 +113,8 @@ that safety boundary as a command failure.
|
|
|
110
113
|
are wrong.
|
|
111
114
|
- Full graphs belong in `--output` artifacts. Agents and IDEs consume bounded
|
|
112
115
|
`search`, `entities`, `evidence`, and `path` results.
|
|
116
|
+
- Every qualification also reads the renderer-neutral Live Board projection
|
|
117
|
+
from its isolated activity state and requires at least one observed CLI run.
|
|
113
118
|
|
|
114
119
|
These suites are explicit and opt-in because they require local reference
|
|
115
120
|
repositories. They do not replace cross-platform CI fixtures or release gates.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workspai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.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": [
|
package/dist/analyze-JDEWUBC6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-VIN7NJW3.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-5YZ2W57R.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as runDoctorCapabilities}from'./chunk-DFVG4DDZ.js';
|
package/dist/chunk-2KX6KHEC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {k,q}from'./chunk-46QH3ZVI.js';import {b as b$2,c as c$2,a as a$3}from'./chunk-2MTJWPQ4.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {a as a$6}from'./chunk-HTYMXMQM.js';import {d,a as a$1,p,g as g$2,f as f$2,e as e$2}from'./chunk-TCLKGPXF.js';import {c,b as b$1,j as j$1,z as z$1,f as f$1}from'./chunk-KFTJVVJR.js';import {m,l}from'./chunk-U5ENEDJA.js';import {a as a$5}from'./chunk-GR6442P7.js';import {g as g$1,d as d$2,a as a$4,e as e$1}from'./chunk-C2VTO5WT.js';import {a}from'./chunk-2LIVMG5C.js';import {d as d$1,c as c$1}from'./chunk-EWZZUQBR.js';import {f,e,i,h}from'./chunk-ZGHJIQXL.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$2);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,t,r,o){let s=qt(r.filter(i=>t.has(i.from)&&t.has(i.to))),n=Zt(e,s),c=er(e,s),a=tr(e,s,c);return {schemaVersion:e$2,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=h.workspaceModelCache.schemaVersion,we=i.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=[i.workspaceContract,".workspai/workspace.json","workspai.workspace.json",".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],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 d$2(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 e$1(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=h.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=f.model,ie=e.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 d$2(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$1(t),s=m(t,o),n=z$1(t),c=f$1(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=l(t),y=[s.runtime,...f.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$1){let t$1=g.resolve(e$1.workspacePath),r=e$1.includeAbsolutePaths===true,o=e$1.includeEvidence===true,s=Se(e$1.observableScanDepth),n=e$1.now??new Date,{marker:c,workspaceJson:a,workspaceContract:i$1,contractProjectPaths:l,projectPaths:u}=await Ee(t$1,s),p=e$1.reuseProjectModels,d=await Promise.all(u.map(k=>{if(p){let xt=g.relative(t$1,g.resolve(k)).split(g.sep).join("/"),xe=p.get(xt);if(xe)return Promise.resolve(xe)}return Mr(t$1,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$1?.workspace.name||g.basename(t$1),y=typeof a?.profile=="string"?a.profile:typeof a?.mode=="string"?a.mode:i$1?.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$1,k))),J=t(t$1,"workspace.contract.json").map(k=>g.relative(t$1,k).split(g.sep).join("/")).find(k=>P.existsSync(g.join(t$1,k)))??i.workspaceContract,D=await P.pathExists(g.join(t$1,J)),X={schemaVersion:br,generatedAt:n.toISOString(),workspace:{name:f,root:t$1,...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$1,e.doctor,o),projectDoctor:await R(t$1,i.doctorProject,o),doctorRemediationPlan:await R(t$1,i.doctorRemediationPlan,o),artifactRemediationPlan:await R(t$1,i.artifactRemediationPlan,o),doctorFixResult:await R(t$1,i.doctorFixResult,o),analyze:await R(t$1,e.analyze,o),readiness:await R(t$1,e.readiness,o),pipeline:await R(t$1,i.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$1,X,{contractExists:D,now:n,incrementalGraph:e$1.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({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$1,t,r={}){let o=e$1.contracts.exists?await We(t):null,{buildWorkspaceKnowledgeGraph:s}=await import('./workspace-knowledge-graph-AUXYL3L6.js'),n=d(e$1),c=r.refreshKnowledgeGraph?null:await P.readJson(g.join(t,e.knowledgeGraph)).then(p=>p).catch(()=>null),a=await s({workspacePath:t,workspace:{name:e$1.workspace.name,...e$1.workspace.profile?{profile:e$1.workspace.profile}:{}},projects:e$1.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$1)??await Et(t,e$1,{contractExists:e$1.contracts.exists,now:new Date(e$1.generatedAt)}),contract:o,now:new Date(e$1.generatedAt),source:{kind:"workspace-model",artifact:ie,hashAlgorithm:"sha256",hash:d$1(n)},previousGraph:c}),i$1=[],l=new Map;for(let p of e$1.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$1.push({rootPath:d,relativePath:i.projectKnowledgeGraphReference,payload:wt(a,p.name)});}let u=await g$1(t,ie,[{rootPath:t,relativePath:e.knowledgeGraph,payload:a},{rootPath:t,relativePath:ie,payload:n},...i$1]);for(let p of i$1){let d=g.join(p.rootPath,e.knowledgeGraph);(await P.readJson(d).catch(()=>null))?.schemaVersion===f.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};
|
package/dist/chunk-3KU3YUWD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {q,l,m,k as k$1}from'./chunk-2KX6KHEC.js';import {a}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {d as d$1}from'./chunk-TCLKGPXF.js';import {e as e$2}from'./chunk-C2VTO5WT.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {e as e$1,d,b as b$1}from'./chunk-EWZZUQBR.js';import {f,e}from'./chunk-ZGHJIQXL.js';import k from'path';import V from'fs-extra';import {spawnSync}from'child_process';function ue(){let e={...process.env};return delete e.GIT_DIR,delete e.GIT_WORK_TREE,delete e.GIT_INDEX_FILE,delete e.GIT_PREFIX,e}function $(e,t,a){let r=spawnSync("git",t,{cwd:e,env:ue(),encoding:"utf8",stdio:["ignore","pipe","ignore"]});if(r.status!==0)return {ok:false,stdout:""};let i=r.stdout??"";return {ok:true,stdout:a?.preserveWhitespace?i:i.trim()}}function ge(e){let t=e.replace(/\\/g,"/").replace(/^\.\//,"");return t===".workspai/AGENT-GROUNDING.md"?true:[".workspai/reports/",".workspai/cache/",".rapidkit/reports/",".rapidkit/cache/"].some(a=>t.startsWith(a))}function ke(e){let t=[],a=[],r=[];for(let i of e.split(`
|
|
2
|
-
`)){if(!i.trim())continue;let n=i.slice(0,2),c=i.slice(3).trim();if(c&&!ge(c)){if(n==="??"){a.push(c);continue}n.includes("D")&&r.push(c),t.push(c);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(a)].sort(),deletedFiles:[...new Set(r)].sort()}}function Q(e,t){let a={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},r=$(e,["rev-parse","--is-inside-work-tree"]);if(!r.ok||r.stdout!=="true")return a;let i=$(e,["rev-parse","--abbrev-ref","HEAD"]),n=$(e,["rev-parse","HEAD"]),c=$(e,["status","--porcelain=v1","--untracked-files=all"],{preserveWhitespace:true}),p=ke(c.stdout),m=p.changedFiles.length>0||p.untrackedFiles.length>0||p.deletedFiles.length>0;return {available:true,branch:i.ok?i.stdout:void 0,commit:n.ok?n.stdout:void 0,ref:t?.ref,dirty:m,changedFiles:p.changedFiles,untrackedFiles:p.untrackedFiles,deletedFiles:p.deletedFiles}}var oe=f.snapshot,L=f.diff,_=e.snapshot,ae=e.diff,he=f.impact,we=e.impact;function ye(e){if(e.model.projectTopology||!e.model.graph||e.modelHash!==e$1(e.model))return null;let t={...e.model,projectTopology:e.model.graph,graph:e.model.graph};return {...e,modelHash:d(t),model:t}}function ne(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function We(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function se(e,t){return k.isAbsolute(t)?t:k.join(e,t)}async function be(e){let t=await V.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let a=t;if(a.schemaVersion===oe){a$1(t,"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",`Workspace model snapshot ${e}`);let r=a;if(!r.model||r.model.schemaVersion!==k$1)throw new Error(`Invalid workspace model snapshot: ${e}`);let i=d(r.model);if(r.modelHash!==i){let n=ye(r);if(!n)throw new Error(`Workspace model snapshot hash mismatch: ${e}`);return {model:n.model,hash:n.modelHash}}return {model:r.model,hash:r.modelHash}}if(a.schemaVersion===k$1){a$1(t,"contracts/workspace-intelligence/workspace-model.v1.json",`Workspace model ${e}`);let r=a;return {model:r,hash:d(r)}}throw a.schemaVersion===L?new Error(`workspace diff --from received a diff report (${k.basename(e)}). Use a workspace model snapshot or model report as baseline, e.g. ${_}. To analyze an existing diff report, run: npx workspai workspace impact --from ${k.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(a.schemaVersion)}`)}async function ve(e){let t=await V.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let a=t;if(a.schemaVersion!==L)return null;a$1(t,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Workspace model diff ${e}`);let r=a;if(!r.currentModel||r.currentModel.schemaVersion!==k$1||!r.summary||!Array.isArray(r.changes))throw new Error(`Invalid workspace model diff report: ${e}`);if(r.toHash!==d(r.currentModel))throw new Error(`Workspace model diff current-model hash mismatch: ${e}`);return r}async function Ye(e){let t=e.model??await q({workspacePath:e.workspacePath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {schemaVersion:oe,generatedAt:(e.now??new Date).toISOString(),modelHash:d(t),modelRef:l,model:t}}async function Qe(e,t){return e$2(t,_,d$1(e))}function x(e){return {name:e.name,path:e.path,kind:e.kind,category:e.category,runtime:e.runtime,framework:e.framework,generator:e.generator,supportTier:e.supportTier,commands:e.commands,importantFiles:e.importantFiles}}function h(e,t){e.push(t);}function Me(e,t){let a=[],r=["name","profile","type"],i=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let n of r){let c=e.workspace[n],p=t.workspace[n];b$1(c)!==b$1(p)&&h(a,{type:"workspace.changed",severity:"info",target:`workspace.${n}`,message:`Workspace metadata field changed: ${String(n)}`,before:c,after:p});}for(let n of i){let c=e.identity[n],p=t.identity[n];b$1(c)!==b$1(p)&&h(a,{type:"workspace.changed",severity:"info",target:`identity.${n}`,message:`Workspace identity field changed: ${String(n)}`,before:c,after:p});}return b$1(e.policies)!==b$1(t.policies)&&h(a,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),b$1(e.discovery)!==b$1(t.discovery)&&h(a,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&h(a,{type:"workspace.changed",severity:t.contracts.exists?"info":"warning",target:t.contracts.workspaceContractPath,message:"Workspace contract presence changed.",before:e.contracts.exists,after:t.contracts.exists}),a}function je(e,t){let a=e.validation??null,r=t.validation??null;return b$1(a)===b$1(r)?[]:[{type:"validation.changed",severity:r?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:a,after:r}]}function Ie(e,t){let a=[],r=new Map(e.projects.map(n=>[n.path,n])),i=new Map(t.projects.map(n=>[n.path,n]));for(let[n,c]of i.entries()){let p=r.get(n);if(!p){h(a,{type:"project.added",severity:"info",target:n,message:`Project added: ${c.name}`,after:x(c)});continue}let m=x(p),l=x(c);if(b$1(m)!==b$1(l)){let u=p.runtime!==c.runtime||p.framework!==c.framework;h(a,{type:"project.changed",severity:u?"warning":"info",target:n,message:`Project changed: ${c.name}`,before:m,after:l});}}for(let[n,c]of r.entries())i.has(n)||h(a,{type:"project.removed",severity:"warning",target:n,message:`Project removed: ${c.name}`,before:x(c)});return a.sort((n,c)=>`${n.type}:${n.target}`.localeCompare(`${c.type}:${c.target}`))}async function Pe(e){let t=k.resolve(e.workspacePath),a=ne(e.fromPath),r=a?We(e.fromPath):void 0,i=e.fromPath;if(a){let f=k.join(t,_);if(!await V.pathExists(f))throw new Error("Git-aware workspace diff requires an existing snapshot at .workspai/reports/workspace-model-snapshot.json. Run: npx workspai workspace snapshot --json");i=_;}let n=se(t,i),c=await be(n),p=e.model??await q({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),m=d(p),l$1=[...Me(c.model,p),...Ie(c.model,p),...je(c.model,p)],u;e.includeGitObservation!==false&&(u=e.gitObservation??Q(t,{ref:r}),u.available&&Ee(l$1,u,p));let v=l$1.filter(f=>f.type.startsWith("git.")).length,R=c.hash!==m,w=a?`git:${r??"HEAD"}`:k.relative(t,n).split(k.sep).join("/");return {schemaVersion:L,generatedAt:(e.now??new Date).toISOString(),fromRef:w,toRef:l,fromHash:c.hash,toHash:m,summary:{changed:R||v>0,addedProjects:l$1.filter(f=>f.type==="project.added").length,removedProjects:l$1.filter(f=>f.type==="project.removed").length,changedProjects:l$1.filter(f=>f.type==="project.changed").length,workspaceChanges:l$1.filter(f=>f.type==="workspace.changed").length,validationChanges:l$1.filter(f=>f.type==="validation.changed").length,gitChangedFiles:v},git:u?.available?Oe(u,r):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:l$1,currentModel:p}}async function Ze(e,t){return e$2(t,ae,d$1(e))}function I(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function Z(e){return e.reduce((t,a)=>I(a)>I(t)?a:t,"none")}var N=["none","low","medium","high","critical"];function Re(e){let t=Math.max(1,I(e)-1);return N[t]}function Ce(e){let t=Math.min(N.length-1,I(e)+1);return N[t]}function ee(e){return e.join(" ")}function b(e,t,a,r){return {id:e,label:t,scope:r.scope,project:r.project,display:ee(["npx","workspai",...a]),execute:ee(["npx","--yes","--package","workspai","workspai",...a]),required:r.required!==false}}function te(e){let t=`project:${e.name}`,a=e.commands.fleetStages,r={init:`Run init for ${e.name}`,test:`Run tests for ${e.name}`,build:`Run build for ${e.name}`,start:`Run start for ${e.name}`};return ["init","test","build","start"].filter(i=>a.includes(i)).map(i=>b(`project.${e.name}.${i}`,r[i],["workspace","run",i,"--scope",t,"--json"],{scope:"project",project:e.name}))}function T(){return [b("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),b("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),b("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),b("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),b("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false}),b("workspace.doctor-fix","Verify doctor fix result",["doctor","workspace","--fix","--json"],{scope:"workspace",required:false})]}function Se(e,t){let a=t.split(k.sep).join("/");return e.projects.filter(i=>{let n=i.path.split(k.sep).join("/");return a===n||a.startsWith(`${n}/`)}).sort((i,n)=>n.path.length-i.path.length)[0]}function Ee(e,t,a){let r=new Set(e.map(n=>n.target)),i=(n,c)=>{let p=c.split(k.sep).join("/"),m=`git:${p}`;if(r.has(m))return;let l=Se(a,p),u=l?`${l.name} (${l.path})`:"workspace";h(e,{type:n,severity:n==="git.deleted"?"warning":"info",target:m,message:`Git ${n==="git.untracked"?"untracked":n==="git.deleted"?"deleted":"changed"} file affects ${u}: ${p}`,after:{path:p,project:l?.name,projectPath:l?.path}}),r.add(m);};for(let n of t.changedFiles)i("git.file.changed",n);for(let n of t.untrackedFiles)i("git.untracked",n);for(let n of t.deletedFiles)i("git.deleted",n);}function Oe(e,t){return {available:true,ref:t??e.ref,branch:e.branch,commit:e.commit,dirty:e.dirty,changedFiles:e.changedFiles.length,untrackedFiles:e.untrackedFiles.length,deletedFiles:e.deletedFiles.length}}function Ae(e){let t=new Set,a=[];for(let r of e){let i=`${r.scope}:${r.project??""}:${r.display}`;t.has(i)||(t.add(i),a.push(r));}return a}function De(e){return e.type==="project.removed"?"high":e.severity==="critical"?"critical":e.severity==="warning"?"high":("medium")}function Fe(e,t){return e.severity==="critical"?"critical":e.target==="policies"||e.target.includes("contract")?"high":e.type==="validation.changed"?(t?.projectCount??0)===0?"low":"high":e.target==="evidence"?"low":e.severity==="warning"?"medium":"low"}function $e(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(a=>a.severity==="critical"?false:a.type.startsWith("git.")||a.type==="validation.changed")?e.risk:I(e.risk)>=I("high")||e.risk==="medium"?"low":e.risk}function re(e,t){if(!e||e==="workspace")return true;let a=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,k.basename(t.path),t.absolutePath].filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim().toLowerCase()).includes(a)}function xe(e){if(!e.changed)return {headline:"No workspace model impact detected.",bullets:["The current workspace model matches the provided snapshot/report."],unsafeAssumptions:["Do not claim runtime verification passed unless a report exists."]};let t=e.affectedProjects.map(a=>a.project?.name??a.target);return {headline:`Workspace impact risk: ${e.risk}.`,bullets:[`Affected projects: ${t.length?t.join(", "):"none"}.`,`Workspace-level items: ${e.workspaceImpact.length}.`,"Use the verification plan before recommending apply, rollback, or release actions."],unsafeAssumptions:["Do not infer test/build success from impact alone.","Do not apply fixes without project scope and verification evidence.","Use display commands for users and execute commands for automation."]}}async function et(e){let t=k.resolve(e.workspacePath),a$1=ne(e.fromPath),r=e.diff;if(!r&&!a$1){let o=se(t,e.fromPath);r=await ve(o)??void 0;}r||(r=await Pe({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let i=new Map(r.currentModel.projects.map(o=>[o.path,o])),n=new Map(r.currentModel.projects.map(o=>[o.name,o])),c$1=r.changes.filter(o=>o.type.startsWith("project.")),p=new Map;for(let o of c$1){let d=(i.get(o.target)??(typeof o.before?.name=="string"?n.get(o.before.name):void 0))?.path??o.target,y=p.get(d)??[];y.push(o),p.set(d,y);}let m$1=[];for(let[o,s]of p.entries()){let d=i.get(o);if(d&&!re(e.scope,d))continue;let y=Z(s.map(De)),C=d?.name??(typeof s[0]?.before?.name=="string"?String(s[0].before.name):o);m$1.push({id:`project:${C}`,scope:"project",target:o,title:`Project impact: ${C}`,summary:s.map(M=>M.message).join(" "),risk:y,reasons:s.map(M=>`${M.type}: ${M.message}`),project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?te(d):T()});}let l=m(r.currentModel),u=l?a(l):void 0,v=new Set(m$1.map(o=>o.project?.name).filter(o=>typeof o=="string")),R=new Map;for(let o of m$1)if(o.project?.name){let s=u?.byId.get(o.project.name);s&&(o.centrality={fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness,isHotspot:s.isHotspot},s.isHotspot&&(o.risk=Ce(o.risk),o.reasons=[...o.reasons,`graph.hotspot: critical-path project with ${s.reach} transitive dependent(s); risk escalated.`])),o.origin="direct",o.distance=0,R.set(o.project.name,o.risk);}let w=[],f=0;if(l&&v.size>0){let o=c(l,v);for(let s of o.values()){if(s.distance===0||v.has(s.id))continue;let d=n.get(s.id);if(d&&!re(e.scope,d))continue;let y=s.path[0],C=s.path[s.path.length-2]??y,M=R.get(y)??"medium",de=Re(M),j=u?.byId.get(s.id);f=Math.max(f,s.distance),w.push({id:`transitive:${s.id}`,scope:"project",target:d?.path??s.id,title:`Transitive impact: ${s.id}`,summary:`Depends on changed project ${y}${s.via?` via ${s.via}`:""} (distance ${s.distance}).`,risk:de,reasons:[`graph.dependent: depends on ${C}${s.via?` via ${s.via}`:""} (path ${s.path.join(" -> ")})`],project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?te(d):T(),origin:"transitive",distance:s.distance,path:s.path,via:s.via,...j?{centrality:{fanIn:j.fanIn,fanOut:j.fanOut,reach:j.reach,betweenness:j.betweenness,isHotspot:j.isHotspot}}:{}});}}w.sort((o,s)=>o.target.localeCompare(s.target));let ie=u?u.hotspots.flatMap(o=>{let s=u.byId.get(o);return s?[{project:o,fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness}]:[]}):[],ce=r.changes.filter(o=>!o.type.startsWith("project.")),K=r.currentModel.summary?.projectCount??r.currentModel.projects.length,P=ce.map(o=>({id:`workspace:${o.target}`,scope:"workspace",target:o.target,title:`Workspace impact: ${o.target}`,summary:o.message,risk:Fe(o,{projectCount:K}),reasons:[`${o.type}: ${o.message}`],verification:T()})),B=Ae([...m$1.flatMap(o=>o.verification),...w.flatMap(o=>o.verification),...P.flatMap(o=>o.verification),...r.summary.changed?T():[]]).filter(o=>o.required),pe=Z([...m$1.map(o=>o.risk),...w.map(o=>o.risk),...P.map(o=>o.risk)]),z=$e({risk:pe,affectedProjects:m$1.length,projectCount:K,changes:r.changes}),q={changed:r.summary.changed,risk:z,affectedProjects:m$1.length,workspaceItems:P.length,recommendedCommands:B.length,blastRadius:{directlyAffected:m$1.length,transitivelyAffected:w.length,maxDistance:f,graphEdges:l?.edges.length??0}};return {schemaVersion:he,generatedAt:(e.now??new Date).toISOString(),fromRef:r.fromRef,diffRef:ae,workspace:{name:r.currentModel.workspace.name,profile:r.currentModel.workspace.profile,type:r.currentModel.workspace.type},summary:q,affectedProjects:m$1.sort((o,s)=>o.target.localeCompare(s.target)),transitiveImpact:w,criticalPathHotspots:ie,workspaceImpact:P.sort((o,s)=>o.target.localeCompare(s.target)),verificationPlan:B,agentBrief:xe({changed:q.changed,risk:z,affectedProjects:m$1,workspaceImpact:P}),diff:r}}async function tt(e,t){return e$2(t,we,d$1(e))}export{Q as a,oe as b,L as c,_ as d,ae as e,he as f,we as g,ye as h,ne as i,We as j,Ye as k,Qe as l,Pe as m,Ze as n,T as o,et as p,tt as q};
|
package/dist/chunk-3NF3M3RE.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b,d as d$1}from'./chunk-LEOFD3W5.js';import {d}from'./chunk-C2VTO5WT.js';import {e,f}from'./chunk-ZGHJIQXL.js';import A from'fs-extra';function t(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function S(e){let s=t(e);return !!(s&&s.schemaVersion===f.model&&t(s.workspace)&&Array.isArray(s.projects)&&(t(s.projectTopology)||t(s.graph)))}function W(e){let s=t(e);return !!(s&&s.schemaVersion===f.knowledgeGraph&&t(s.source)&&t(s.workspace)&&Array.isArray(s.entities)&&Array.isArray(s.relations)&&Array.isArray(s.proofs)&&Array.isArray(s.providers)&&t(s.quality))}async function g(e){try{return await A.readJson(e)}catch{return null}}async function I(e$1){let[s,i]=await Promise.all([d(e$1,e.model),d(e$1,e.knowledgeGraph)]);if(!s)return {status:"miss",reason:"missing-model"};if(!i)return {status:"miss",reason:"missing-graph"};let[n,o]=await Promise.all([g(s),g(i)]);if(!S(n))return {status:"miss",reason:"invalid-model"};if(!W(o))return {status:"miss",reason:"invalid-graph"};if(o.proofs.some(r=>r.freshness==="stale"))return {status:"miss",reason:"stale-proof"};try{b(o,n);}catch{return {status:"miss",reason:"source-mismatch"}}let a=o.source.inputs;if(!a)return {status:"miss",reason:"missing-input-fingerprint"};let f=a.scopes.filter(r=>r.kind==="workspace"),m=a.scopes.filter(r=>r.kind==="project"),k=n.projects.map(r=>r.name).sort(),w=m.map(r=>r.id).sort(),y=new Set(m.map(r=>r.fileLimit));if(a.schemaVersion!=="workspace-knowledge-graph-inputs.v1"||a.strategy!=="hybrid-git-content-v2"||a.hashAlgorithm!=="sha256"||f.length!==1||y.size>1||JSON.stringify(k)!==JSON.stringify(w))return {status:"miss",reason:"invalid-input-fingerprint"};let u;try{u=await d$1({workspacePath:e$1,projects:n.projects.map(r=>({id:r.name,path:r.path,...r.absolutePath?{absolutePath:r.absolutePath}:{}})),expected:a});}catch{return {status:"miss",reason:"input-scan-failed"}}return u?{status:"hit",model:n,graph:o,modelPath:s,graphPath:i}:{status:"miss",reason:"live-input-mismatch"}}export{I as a};
|
package/dist/chunk-3OGPTLI2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {e,i,p,f,g}from'./chunk-ZGHJIQXL.js';var l="workspai-workspace-intelligence-chain-v1",u="contracts/workspace-intelligence-chain.v1.json";function v(){let e$1=e,t=p,s=[{id:"model",ordinal:1,phase:"understand",label:"Model",command:[...t.model.command],consumes:["workspace markers","project metadata","registry","contract","policies"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules","existing-evidence"],consumesArtifacts:[],produces:[...t.model.produces],dependsOn:[],exitPolicy:"stop-on-error",purpose:"Build the canonical current model and its structurally bound, derived Knowledge Graph."},{id:"diff",ordinal:2,phase:"change",label:"Diff",command:[...t.diff.command],consumes:[e$1.model,e$1.snapshot],inputRefs:["changes","model-baseline"],consumesArtifacts:[e$1.model,e$1.snapshot],produces:[...t.diff.produces],dependsOn:["model"],exitPolicy:"stop-on-error",purpose:"Describe structural change against the selected baseline."},{id:"impact",ordinal:3,phase:"change",label:"Impact",command:[...t.impact.command],consumes:[e$1.model,e$1.diff],inputRefs:[],consumesArtifacts:[e$1.model,e$1.diff],produces:[...t.impact.produces],dependsOn:["diff"],exitPolicy:"stop-on-error",purpose:"Calculate transitive blast radius over the workspace graph."},{id:"doctor-evidence",ordinal:4,phase:"evidence",label:"Doctor Evidence",command:[...t["doctor-evidence"].command],consumes:["workspace runtime and project health signals"],inputRefs:["projects-repositories","runtime-dependencies","existing-evidence"],consumesArtifacts:[],produces:[...t["doctor-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh health evidence after the impact artifact exists."},{id:"contract-evidence",ordinal:5,phase:"evidence",label:"Contract Evidence",command:[...t["contract-evidence"].command],consumes:[i.workspaceContract],inputRefs:["workspace-rules"],consumesArtifacts:[],produces:[...t["contract-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh structural contract evidence without hiding failed verdicts."},{id:"analyze-evidence",ordinal:6,phase:"evidence",label:"Analyze Evidence",command:[...t["analyze-evidence"].command],consumes:[e$1.model,"workspace runtime and dependency signals"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules"],consumesArtifacts:[e$1.model],produces:[...t["analyze-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh analysis evidence required by the release-readiness gate."},{id:"readiness-evidence",ordinal:7,phase:"evidence",label:"Readiness Evidence",command:[...t["readiness-evidence"].command],consumes:["doctor, analysis, runtime, and release signals"],inputRefs:["runtime-dependencies","existing-evidence"],consumesArtifacts:[e$1.doctor,e$1.contractVerify,e$1.analyze],produces:[...t["readiness-evidence"].produces],dependsOn:["doctor-evidence","contract-evidence","analyze-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh release-readiness evidence before the definitive gate."},{id:"verify",ordinal:8,phase:"gate",label:"Verify",command:[...t.verify.command],consumes:[e$1.impact,e$1.doctor,e$1.contractVerify,e$1.readiness],inputRefs:[],consumesArtifacts:[e$1.impact,e$1.doctor,e$1.contractVerify,e$1.readiness],produces:[...t.verify.produces],dependsOn:["impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Emit the definitive evidence-backed workspace gate."},{id:"context",ordinal:9,phase:"ground",label:"Agent Context",command:[...t.context.command],consumes:[e$1.model,e$1.impact,e$1.verify],inputRefs:[],consumesArtifacts:[e$1.model,e$1.impact,e$1.verify],produces:[...t.context.produces],dependsOn:["verify"],exitPolicy:"stop-on-error",purpose:"Build compact agent context from the same verified evidence."},{id:"agent-sync",ordinal:10,phase:"distribute",label:"Agent Grounding",command:[...t["agent-sync"].command],consumerArgs:{vscode:["--target","vscode"]},consumes:[e$1.agentContext],inputRefs:[],consumesArtifacts:[e$1.agentContext],produces:[...t["agent-sync"].produces],dependsOn:["context"],exitPolicy:"stop-on-error",purpose:"Distribute one context into portable agent and IDE surfaces."},{id:"explain",ordinal:11,phase:"explain",label:"Explain",command:[...t.explain.command],consumes:[e$1.verify,e$1.impact],inputRefs:[],consumesArtifacts:[e$1.verify,e$1.impact],produces:[...t.explain.produces],dependsOn:["verify"],exitPolicy:"continue-on-structured-verdict",purpose:"Translate evidence and blockers into a human and agent-readable narrative."}];return {schemaVersion:l,name:"Workspace Intelligence Chain",contractPath:u,invariant:"Every consumer must preserve step identity, dependencies, artifact flow, and verdict semantics; presentation may change, chain meaning may not.",invariants:["Missing or unreadable input is unknown or unavailable; it must not be presented as verified absence.","Freshness and provenance travel with evidence and must not be discarded by projections.","The current graph is an evidence-backed workspace knowledge graph with bounded source intelligence, not a complete cross-language symbol or call graph.","Simple and standard presentations summarize the contract; their contractRefs must preserve complete traceability.","Conditional provider outputs must be resolved through their dedicated inventory contract.","Auxiliary capabilities expose or refresh intelligence but are not mandatory execution-chain steps.","Canonical step commands are stage-pure: they must not implicitly execute a downstream chain step or regenerate an upstream artifact.","Canonical JSON artifacts must satisfy their registered schema both when produced and when consumed across CLI, MCP, IDE, and CI trust boundaries.","Schema validity is necessary but not sufficient: hashes, embedded models, summaries, counts, graph statistics, and artifact references must remain semantically coherent.","Persisted impact evidence must be rejected as stale when the current workspace model or Git observation no longer matches its embedded diff.","Canonical artifact replacement must be atomic and workspace-contained; an interrupted or denied write must preserve the last valid artifact.","Concurrent history updates must be serialized without silently dropping entries, and invalid history must never be overwritten as if it were absent.","The canonical global registry is ~/.workspai/workspaces.json; ~/.rapidkit/workspaces.json is a non-authoritative compatibility mirror for legacy consumers and must not diverge after a CLI registry mutation."],semantics:{workspace:"The governed operating boundary that relates one or more projects and repositories to shared metadata, policies, contracts, evidence, and consumers.",repository:"A source-control boundary that may contain one or more projects and may live inside or outside the workspace root.",project:"A discoverable build or runtime unit with its own path, metadata or observable manifests, command capabilities, and evidence.",evidence:"A sourced observation or generated verification result with provenance and freshness; evidence may be consumed by a later run.",artifact:"A durable generated file that another command or consumer can read without parsing terminal prose.",gate:"A structured verdict with reasons and exit semantics derived from current evidence."},workspaceLifecycle:{ingestionRoutes:[{id:"create",label:"Create",commands:["create workspace","create project"],result:"Create a workspace or supported project and write canonical Workspai metadata."},{id:"adopt",label:"Adopt",commands:["adopt"],result:"Register an existing project in place without requiring source relocation."},{id:"import",label:"Import",commands:["import","workspace import"],result:"Attach an existing project or repository path to the workspace inventory."}],durableState:[{id:"workspace-identity",paths:[".workspai-workspace",".workspai/workspace.json"],purpose:"Identify the workspace boundary, profile, and canonical root."},{id:"project-inventory",paths:[".workspai/project.json",".workspai/context.json",".workspai/adopt.json","~/.workspai/workspaces.json","~/.rapidkit/workspaces.json (legacy compatibility mirror)"],purpose:"Record native, adopted, imported, and globally registered project locations while preserving a non-authoritative mirror for legacy extension discovery."},{id:"governance",paths:[".workspai/policies.yml",i.workspaceContract],purpose:"Define workspace policy and explicit structural relationships."},{id:"graph-overrides",paths:[".workspai/workspace-graph.overrides.json"],purpose:"Provide explicit dependency edges that override inferred relationships."}],rule:"Create, adopt, and import are ingestion routes, not intelligence facts. Their durable state becomes observable input to Model."},runtimeRegistry:{authority:"contracts/workspace-intelligence-runtime-registry.ts",artifacts:Object.entries(e).map(([r,a])=>({id:r,path:a,schemaVersion:f[r],schemaContract:g[r]}))},executionEnvelope:{rule:"Sync and baseline resolution are deterministic execution prerequisites, not canonical intelligence stages; every run reports them separately and preserves the exact canonical stage sequence.",operations:[{id:"sync",executionPoint:"before:model",artifacts:[i.workspaceContract,i.workspaceRegistry],failurePolicy:"stop-and-report",purpose:"Reconcile portable workspace inventory and contract inputs before modeling."},{id:"baseline",executionPoint:"after:model-before:diff",artifacts:[e$1.snapshot],failurePolicy:"stop-and-report",purpose:"Create an initial structural baseline when absent or reuse the existing baseline before Diff."}],report:{artifact:e$1.intelligenceRun,schemaVersion:f.intelligenceRun,invariant:"The report must preserve exact preflight and stage order, registry-owned artifacts, failure propagation, and aggregate status/exit semantics."}},boundaries:{inputs:[{id:"projects-repositories",label:"Projects and repositories",sources:["projects","repositories","services","modules","imported paths"],entersAt:"model"},{id:"runtime-dependencies",label:"Runtime and dependencies",sources:["runtime manifests","lockfiles","scripts","framework markers","package dependencies","bounded multi-language source observations for supported file extensions"],entersAt:"model"},{id:"workspace-rules",label:"Workspace rules",sources:["workspace markers","registry","project metadata","contracts","policies","ownership","graph overrides"],entersAt:"model"},{id:"changes",label:"Changes",sources:["repository state","git state","model baseline","workspace diff"],entersAt:"diff"},{id:"model-baseline",label:"Explicit model baseline",sources:[e$1.snapshot],entersAt:"diff"},{id:"existing-evidence",label:"Existing evidence",sources:["doctor reports","analysis reports","contract verification","release readiness","pipeline results","tests and runtime evidence","previous intelligence artifacts"],entersAt:"doctor-evidence"}],outputs:[{id:"understanding",label:"System understanding",artifacts:[e$1.model,e$1.knowledgeGraph,e$1.diff,e$1.impact],producedBy:["model","diff","impact"],inventory:"complete-for-chain"},{id:"governance-evidence",label:"Governance evidence",artifacts:[e$1.doctor,e$1.contractVerify,e$1.analyze,e$1.readiness,e$1.verify,e$1.history],producedBy:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify"],inventory:"complete-for-chain"},{id:"agent-grounding",label:"Agent grounding",artifacts:[e$1.agentContext,e$1.agentIndex,e$1.agentCustomizationPack,e$1.skillsIndex,e$1.agents],producedBy:["context","agent-sync"],inventory:"canonical-minimum",inventoryContract:"contracts/agent-customization-pack.v1.json"},{id:"explanations",label:"Explainable decisions",artifacts:[e$1.explain],producedBy:["explain"],inventory:"complete-for-chain"}],consumers:[{id:"developers",label:"Developers",channels:["CLI","reports","AGENTS.md"]},{id:"ci",label:"CI",channels:["JSON artifacts","exit codes","release gates"]},{id:"ides",label:"IDEs",channels:["synced contracts","extension","agent context"]},{id:"ai-agents",label:"AI agents",channels:["INDEX.json","context","skills","MCP"]}]},deliveryChannels:[{id:"artifacts",carries:["reports","models","context","grounding","skills"],authority:"canonical"},{id:"json-stdout",carries:["structured command results"],authority:"projection"},{id:"human-cli",carries:["summaries","diagnostics","next actions"],authority:"projection"},{id:"exit-codes",carries:["gate and command status"],authority:"projection"},{id:"watch-events",carries:["incremental workspace change events"],authority:"projection"},{id:"mcp",carries:["read-mostly access to current workspace artifacts"],authority:"projection"}],feedback:{from:["developers","ci","ides","ai-agents"],signals:["source commits","dependency updates","policy and contract edits","repairs","test and runtime results","agent action outcomes"],reentersThrough:["projects-repositories","runtime-dependencies","workspace-rules","changes","existing-evidence"],rule:"Consumer actions are not silently treated as truth. They re-enter as observable changes or evidence and must be modeled and verified again."},auxiliaryCapabilities:[{id:"graph",commands:["workspace graph emit","workspace graph explain","workspace graph entities","workspace graph evidence","workspace graph path","workspace graph search","workspace graph benchmark","workspace graph benchmark-suite","workspace graph overlay","workspace graph dot","workspace graph mermaid","workspace graph jsonld","workspace graph graphml","workspace graph gexf"],reads:[e$1.model,e$1.knowledgeGraph],produces:[i.workspaceIntelligenceBenchmark],role:"Query the proof-backed graph derived from the canonical workspace model.",chainStep:false},{id:"evaluation",commands:["workspace eval init","workspace eval record","workspace eval status","workspace eval report","workspace eval compare"],reads:[e$1.evaluationLive,e$1.evaluationLastRun],produces:[e$1.evaluationLive,e$1.evaluationLastRun],role:"Measure model usage, activity, cost provenance, and verified outcomes without storing prompt or response bodies.",chainStep:false},{id:"activity",commands:["live","live --json --projection monitor","live --json --projection board"],reads:["local workspace activity journals"],role:"Project observational command activity into versioned monitor and renderer-neutral board contracts without treating activity as verification evidence.",chainStep:false},{id:"watch",commands:["workspace watch"],reads:["workspace inputs",e$1.model],role:"Refresh the model incrementally and emit deterministic change events.",chainStep:false},{id:"mcp",commands:["workspace mcp serve"],reads:["workspace evidence artifacts"],role:"Expose read-mostly workspace evidence to compatible clients.",chainStep:false}],presentations:{simple:{layers:["inputs","intelligence","outputs","consumers"],nodes:[{id:"input-layer",kind:"inputs",label:"Input Layer",summary:"Projects \xB7 Repositories \xB7 Dependencies \xB7 Changes",contractRefs:["projects-repositories","runtime-dependencies","workspace-rules","changes","model-baseline","existing-evidence"]},{id:"workspace-intelligence",kind:"intelligence",label:"Workspace Intelligence",summary:"Model \xB7 Graph \xB7 Impact \xB7 Verify",contractRefs:s.map(r=>r.id)},{id:"agent-grounding",kind:"outputs",label:"Agent Grounding",summary:"AGENTS.md \xB7 Skills \xB7 Context",contractRefs:["agent-grounding"]},{id:"evidence-and-decisions",kind:"outputs",label:"Evidence Contracts",summary:"Reports \xB7 Artifacts \xB7 Gates",contractRefs:["understanding","governance-evidence","explanations"]},{id:"shared-consumers",kind:"consumers",label:"Shared Consumers",summary:"Developers \xB7 CI \xB7 IDEs \xB7 AI agents",contractRefs:["developers","ci","ides","ai-agents"]}],rule:"Use concrete user-facing language for first-contact explanations. Every input, output, consumer, and chain step must remain traceable through contractRefs even when details are summarized."},standard:{phases:["understand","change","evidence","gate","ground","distribute","explain"],nodes:[{id:"understand",label:"Understand",question:"What exists in the current workspace?",stepRefs:["model"]},{id:"change",label:"Change",question:"What changed, and what can it affect?",stepRefs:["diff","impact"]},{id:"evidence",label:"Evidence",question:"What health, contract, and readiness facts were observed?",stepRefs:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"]},{id:"gate",label:"Gate",question:"Is the current state acceptable and trustworthy?",stepRefs:["verify"]},{id:"ground",label:"Ground",question:"What should an agent know before acting?",stepRefs:["context"]},{id:"distribute",label:"Distribute",question:"Which durable agent and IDE surfaces receive that context?",stepRefs:["agent-sync"]},{id:"explain",label:"Explain",question:"Why did the system reach this result or verdict?",stepRefs:["explain"]}],rule:"Use for architecture education and product surfaces. Every phase must appear once and in order."},advanced:{steps:s.map(r=>r.id),requiredFields:["command","inputRefs","consumesArtifacts","produces","dependsOn","exitPolicy","purpose"],rule:"Use for implementers, adapters, IDEs, and CI. Preserve every step and its artifact and verdict semantics."}},steps:s,diagram:{direction:"TB",nodes:s.map(({id:r,label:a,phase:p})=>({id:r,label:a,phase:p})),edges:s.flatMap(r=>r.dependsOn.map(a=>({from:a,to:r.id,meaning:"required before"})))},consumers:{agents:{canonicalReadOrder:[e$1.agentIndex,i.goalIndex,i.goalPackLastRun,e$1.agentContext,e$1.skillsIndex,e$1.verify,e$1.impact,e$1.explain],entrypoints:[e$1.agents,".workspai/AGENT-GROUNDING.md"],rule:"Agents must cite current artifacts, preserve verified versus inferred status, and re-run the producing step when evidence is missing or stale."},ideAndCi:{requiredArtifacts:[e$1.model,e$1.knowledgeGraph,e$1.impact,e$1.verify],rule:"IDEs and CI must consume structured artifacts and verdict exit semantics rather than parse human help or terminal prose."},docsAndDiagrams:{rule:"Documentation and diagrams must derive labels, ordering, and edges from this contract and must not invent implemented steps."}}}}export{l as a,v as b};
|
package/dist/chunk-5ME4W4LN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {h}from'./chunk-ZGHJIQXL.js';var i=h.doctorFixResult.schemaVersion,n="npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json";function a(t){return {schemaVersion:i,generatedAt:new Date().toISOString(),appliedFixes:t.appliedFixes,remainingBlockers:t.remainingBlockers,verifyRecommended:t.verifyRecommended??n}}var g="workspai.doctor-summary.v1";var m="doctor-graph-diagnosis.v1";export{i as a,n as b,a as c,m as d,g as e};
|