workspai 0.68.0 → 0.69.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 +134 -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 +62 -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-GPYPXXRT.js +1 -0
- package/dist/{artifact-remediation-plan-I7IKC5MR.js → artifact-remediation-plan-JHHZ4L24.js} +1 -1
- package/dist/autopilot-release-FL47VMF7.js +1 -0
- package/dist/capabilities-command-MYSLJIYS.js +1 -0
- package/dist/chunk-2LZWBUJD.js +1 -0
- package/dist/{chunk-7DDEMDG2.js → chunk-37ZLNFV5.js} +2 -2
- package/dist/{chunk-OFYY4725.js → chunk-3G5FF2JZ.js} +1 -1
- package/dist/chunk-3HFFKW4Q.js +2 -0
- package/dist/{chunk-BHM6RHTA.js → chunk-3WHE7V4M.js} +1 -1
- package/dist/chunk-A3MYO55A.js +3 -0
- package/dist/chunk-ABMB6MJT.js +1 -0
- package/dist/chunk-AD4ZY3RF.js +12 -0
- package/dist/chunk-BM2F5C4J.js +1 -0
- package/dist/chunk-COICGD62.js +1 -0
- package/dist/{chunk-4WVOAX2V.js → chunk-DWL3PPLA.js} +1 -1
- package/dist/{chunk-3Z4SVBMR.js → chunk-EBEAJIBI.js} +1 -1
- package/dist/chunk-EBQS5T7Q.js +7 -0
- package/dist/{chunk-5OV2WXAR.js → chunk-EG6EZ7HW.js} +1 -1
- package/dist/chunk-ERVWW5HX.js +1 -0
- package/dist/chunk-EZPLMAW2.js +1 -0
- package/dist/chunk-FIK343LI.js +1 -0
- package/dist/chunk-GSSJJS5M.js +6 -0
- package/dist/{chunk-TMRCPT7S.js → chunk-GYN6RPNU.js} +1 -1
- package/dist/{chunk-6E2Y3XGT.js → chunk-HCFOVANQ.js} +1 -1
- package/dist/chunk-I3UCODXU.js +1 -0
- package/dist/{chunk-3BMYMZQB.js → chunk-IGJA6GBQ.js} +1 -1
- package/dist/{chunk-FX5J6JCK.js → chunk-IVYPC36J.js} +1 -1
- package/dist/chunk-K33JJVQZ.js +2 -0
- package/dist/{chunk-KDY4X7SQ.js → chunk-M37ALD4V.js} +1 -1
- package/dist/{chunk-3XF7O66C.js → chunk-MAWHHHU3.js} +5 -5
- package/dist/chunk-MBICKDYP.js +1 -0
- package/dist/{chunk-QMQBX3RV.js → chunk-MGL6DBOR.js} +1 -1
- package/dist/chunk-MHQHRMKU.js +5 -0
- package/dist/{chunk-2C5XJBYI.js → chunk-N2Q4MSSP.js} +64 -64
- package/dist/chunk-N4B2M44I.js +1 -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-OU3BBWH5.js +49 -0
- package/dist/chunk-OZXCNVGW.js +2 -0
- package/dist/{chunk-SLFOUSRW.js → chunk-QYEQVNBF.js} +1 -1
- package/dist/chunk-RVOW3BHQ.js +2 -0
- package/dist/chunk-TKXRP2B4.js +1 -0
- package/dist/chunk-UNXG3ZFV.js +1 -0
- package/dist/chunk-UW4SESKD.js +2 -0
- package/dist/{chunk-2MTJWPQ4.js → chunk-V52R2W2Q.js} +1 -1
- package/dist/chunk-V6TIT6M3.js +157 -0
- package/dist/chunk-VNKAISFE.js +8 -0
- package/dist/chunk-W6WRT77T.js +1 -0
- package/dist/chunk-WHR5SL33.js +4 -0
- package/dist/{chunk-IXXQMD34.js → chunk-WZ5V5U2K.js} +1 -1
- package/dist/chunk-XPGCFVGC.js +4 -0
- package/dist/chunk-YKY4JFCF.js +1 -0
- package/dist/{chunk-VIN7NJW3.js → chunk-YWZBGSFE.js} +3 -3
- package/dist/chunk-YZL7ZY7J.js +2 -0
- package/dist/{create-U5PQHOZ4.js → create-GWBQ74ZI.js} +1 -1
- package/dist/doctor-OQAXSMEM.js +1 -0
- package/dist/goal-lifecycle-YWBVQ2DF.js +1 -0
- package/dist/goal-pack-KUXPZVNO.js +1 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +239 -239
- package/dist/pipeline-PGB5TEV3.js +5 -0
- package/dist/{project-agent-entry-MH7364BE.js → project-agent-entry-H3JAGNLS.js} +1 -1
- package/dist/{project-intelligence-lens-ZCCHUKVI.js → project-intelligence-lens-7NMKHV5N.js} +1 -1
- package/dist/{project-test-coverage-JPWTBSSJ.js → project-test-coverage-3DKZKLWY.js} +1 -1
- package/dist/proof-carrying-change-QFH7WI2E.js +1 -0
- package/dist/verified-goal-7XHRWYSE.js +1 -0
- package/dist/{workspace-B33BFZZ3.js → workspace-TJHCETBV.js} +1 -1
- package/dist/{workspace-agent-sync-T3MJO2MX.js → workspace-agent-sync-Z35NTXCB.js} +1 -1
- package/dist/{workspace-archive-NOSGRKRZ.js → workspace-archive-OSMU3CK6.js} +1 -1
- package/dist/{workspace-context-KOCEP4MJ.js → workspace-context-KNJQUJWC.js} +1 -1
- package/dist/{workspace-contract-MQ3QE52V.js → workspace-contract-VIUQT5SZ.js} +1 -1
- package/dist/workspace-explain-HM6GMK26.js +1 -0
- package/dist/workspace-explain-contract-KV7RTEJU.js +1 -0
- package/dist/{workspace-feedback-3YLIUFQ7.js → workspace-feedback-YSPEGCON.js} +1 -1
- package/dist/{workspace-foundation-O7O3QIS4.js → workspace-foundation-PLXFPI3J.js} +1 -1
- package/dist/{workspace-graph-stream-XTGGBD7D.js → workspace-graph-stream-FNRQ2FTB.js} +1 -1
- package/dist/workspace-graph-token-efficiency-WNAFAN2F.js +1 -0
- package/dist/{workspace-history-7HDZZ4G5.js → workspace-history-HDDFG6LH.js} +1 -1
- package/dist/{workspace-intelligence-TFEQBPUP.js → workspace-intelligence-QLSD5EEV.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-4EW4T2OW.js} +1 -1
- package/dist/workspace-intelligence-runtime-registry-ZLPF7BAY.js +1 -0
- package/dist/{workspace-knowledge-graph-AUXYL3L6.js → workspace-knowledge-graph-EEOW5VAJ.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-X347REDB.js +1 -0
- package/dist/workspace-mcp-serve-NQ42PE2I.js +3 -0
- package/dist/{workspace-model-GVXNLSQM.js → workspace-model-NCOOY5LC.js} +1 -1
- package/dist/{workspace-onboarding-ECZ2KJ2A.js → workspace-onboarding-JNC7ZFMR.js} +1 -1
- package/dist/{workspace-readme-6N5Y2ZSJ.js → workspace-readme-OV2ADTLW.js} +2 -2
- package/dist/{workspace-registry-summary-5SFBTRGQ.js → workspace-registry-summary-ONT4VOJX.js} +1 -1
- package/dist/{workspace-repair-engine-CKJCTWKX.js → workspace-repair-engine-WMJCYWO4.js} +2 -2
- package/dist/workspace-run-3S35MDX6.js +1 -0
- package/dist/{workspace-verify-D3QTMAUI.js → workspace-verify-MLABQUWK.js} +1 -1
- package/dist/{workspace-watch-XYJEW2Z2.js → workspace-watch-MJOG5AZ3.js} +1 -1
- package/docs/README.md +2 -0
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +23 -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 +65 -0
- package/docs/proof-carrying-change.implementation.v1.json +118 -0
- package/docs/proof-carrying-change.md +202 -0
- 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-DFVG4DDZ.js +0 -6
- 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-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-run-ZZ5WHL7W.js +0 -1
|
@@ -269,12 +269,13 @@
|
|
|
269
269
|
},
|
|
270
270
|
"commands": {
|
|
271
271
|
"type": "object",
|
|
272
|
-
"required": ["refreshEvidence", "inspectGraph", "proposeRepair"],
|
|
272
|
+
"required": ["refreshEvidence", "inspectGraph", "beginChange", "proposeRepair"],
|
|
273
273
|
"properties": {
|
|
274
274
|
"refreshEvidence": {
|
|
275
275
|
"const": "workspai workspace intelligence run --for-agent generic --strict --json"
|
|
276
276
|
},
|
|
277
277
|
"inspectGraph": { "type": "string", "pattern": "^workspai workspace graph search " },
|
|
278
|
+
"beginChange": { "type": "string", "pattern": "^workspai change begin --goal [^ ]+ --json$" },
|
|
278
279
|
"planVerifiedGoal": { "type": "string", "pattern": "^workspai workspace goal plan " },
|
|
279
280
|
"proposeRepair": {
|
|
280
281
|
"const": "workspai workspace repair propose --file <proposal.json> --json"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://workspai.dev/schemas/workspace-intelligence/predicted-architecture-change.v1.json",
|
|
4
|
+
"title": "Workspai Predicted Architecture Change",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "changeId", "goalId", "generatedAt", "baselineGeneration", "nonCanonical", "proofEligible", "operations", "assumptions", "predictedRisk"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": "workspai.predicted-architecture-change.v1" },
|
|
9
|
+
"changeId": { "type": "string", "pattern": "^change-[a-z0-9][a-z0-9-]{7,95}$" },
|
|
10
|
+
"goalId": { "type": "string", "minLength": 1 },
|
|
11
|
+
"generatedAt": { "type": "string", "format": "date-time" },
|
|
12
|
+
"baselineGeneration": { "$ref": "decision-event.v1.json#/$defs/sha256" },
|
|
13
|
+
"nonCanonical": { "const": true },
|
|
14
|
+
"proofEligible": { "const": false },
|
|
15
|
+
"operations": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"required": ["operation", "targetKind", "targetId", "rationale", "confidence"],
|
|
20
|
+
"properties": {
|
|
21
|
+
"operation": { "enum": ["add", "remove", "change"] },
|
|
22
|
+
"targetKind": { "enum": ["entity", "relation", "proof", "artifact"] },
|
|
23
|
+
"targetId": { "type": "string", "minLength": 1 },
|
|
24
|
+
"rationale": { "type": "string", "minLength": 1 },
|
|
25
|
+
"confidence": { "enum": ["high", "medium", "low"] }
|
|
26
|
+
},
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"assumptions": { "type": "array", "items": { "type": "string" } },
|
|
31
|
+
"predictedRisk": { "enum": ["none", "low", "medium", "high"] }
|
|
32
|
+
},
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://workspai.dev/schemas/workspace-intelligence/proof-carrying-change-capsule-export.v1.json",
|
|
4
|
+
"title": "Workspai Proof-Carrying Change Capsule Export",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "changeId", "outputPath", "validation"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": "workspai.proof-carrying-change-capsule-export.v1" },
|
|
9
|
+
"changeId": { "type": "string", "pattern": "^change-[a-z0-9][a-z0-9-]{7,95}$" },
|
|
10
|
+
"outputPath": { "type": "string", "minLength": 1 },
|
|
11
|
+
"validation": { "$ref": "proof-carrying-change-capsule-validation.v1.json" }
|
|
12
|
+
},
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://workspai.dev/schemas/workspace-intelligence/proof-carrying-change-capsule-validation.v1.json",
|
|
4
|
+
"title": "Workspai Proof-Carrying Change Capsule Validation",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "changeId", "validatedAt", "valid", "errors", "capsule"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": "workspai.proof-carrying-change-capsule-validation.v1" },
|
|
9
|
+
"changeId": { "type": "string", "pattern": "^change-[a-z0-9][a-z0-9-]{7,95}$" },
|
|
10
|
+
"validatedAt": { "type": "string", "format": "date-time" },
|
|
11
|
+
"valid": { "type": "boolean" },
|
|
12
|
+
"errors": { "type": "array", "items": { "type": "string", "minLength": 1 } },
|
|
13
|
+
"capsule": { "$ref": "proof-carrying-change-capsule.v1.json" }
|
|
14
|
+
},
|
|
15
|
+
"additionalProperties": false
|
|
16
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://workspai.dev/schemas/workspace-intelligence/proof-carrying-change-capsule.v1.json",
|
|
4
|
+
"title": "Workspai Proof-Carrying Change Capsule",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "changeId", "goalId", "generatedAt", "status", "workspace", "scope", "decision", "intent", "baseline", "prediction", "actualOverlay", "surpriseReport", "effects", "verification", "assurances", "remainingUncertainty", "integrity"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": "workspai.proof-carrying-change-capsule.v1" },
|
|
9
|
+
"changeId": { "type": "string", "pattern": "^change-[a-z0-9][a-z0-9-]{7,95}$" },
|
|
10
|
+
"goalId": { "type": "string", "minLength": 1 },
|
|
11
|
+
"generatedAt": { "type": "string", "format": "date-time" },
|
|
12
|
+
"status": { "enum": ["open", "blocked", "verified", "sealed", "aborted"] },
|
|
13
|
+
"workspace": { "type": "object", "required": ["name"], "properties": { "name": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
|
|
14
|
+
"scope": { "$ref": "decision-event.v1.json#/$defs/scope" },
|
|
15
|
+
"decision": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": ["transaction", "eventHeadDigest", "effectHeadDigest", "state", "generation"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"transaction": { "$ref": "decision-event.v1.json#/$defs/artifactReference" },
|
|
20
|
+
"eventHeadDigest": { "$ref": "decision-event.v1.json#/$defs/sha256" },
|
|
21
|
+
"effectHeadDigest": { "$ref": "decision-event.v1.json#/$defs/sha256" },
|
|
22
|
+
"state": { "type": "string", "minLength": 1 },
|
|
23
|
+
"generation": { "type": "integer", "minimum": 1 }
|
|
24
|
+
},
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
},
|
|
27
|
+
"intent": { "$ref": "decision-event.v1.json#/$defs/artifactReference" },
|
|
28
|
+
"baseline": { "$ref": "architecture-change-lease.v1.json#/properties/baseline" },
|
|
29
|
+
"prediction": { "oneOf": [{ "$ref": "decision-event.v1.json#/$defs/artifactReference" }, { "type": "null" }] },
|
|
30
|
+
"actualOverlay": { "oneOf": [{ "$ref": "decision-event.v1.json#/$defs/artifactReference" }, { "type": "null" }] },
|
|
31
|
+
"surpriseReport": { "oneOf": [{ "$ref": "decision-event.v1.json#/$defs/artifactReference" }, { "type": "null" }] },
|
|
32
|
+
"effects": { "type": "array", "items": { "$ref": "decision-event.v1.json#/$defs/artifactReference" } },
|
|
33
|
+
"verification": { "type": "array", "items": { "$ref": "decision-event.v1.json#/$defs/artifactReference" } },
|
|
34
|
+
"assurances": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["id", "status", "summary"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"id": { "enum": ["intent-bound", "baseline-pinned", "effects-receipted", "architecture-reobserved", "independently-verified"] },
|
|
41
|
+
"status": { "enum": ["passed", "failed", "pending"] },
|
|
42
|
+
"summary": { "type": "string", "minLength": 1 }
|
|
43
|
+
},
|
|
44
|
+
"additionalProperties": false
|
|
45
|
+
},
|
|
46
|
+
"minItems": 5,
|
|
47
|
+
"maxItems": 5
|
|
48
|
+
},
|
|
49
|
+
"remainingUncertainty": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
|
|
50
|
+
"integrity": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"required": ["algorithm", "semantics", "capsuleDigest"],
|
|
53
|
+
"properties": {
|
|
54
|
+
"algorithm": { "const": "sha256" },
|
|
55
|
+
"semantics": { "const": "canonical-json-v1" },
|
|
56
|
+
"capsuleDigest": { "$ref": "decision-event.v1.json#/$defs/sha256" }
|
|
57
|
+
},
|
|
58
|
+
"additionalProperties": false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"additionalProperties": false
|
|
62
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://workspai.dev/schemas/workspace-intelligence/proof-carrying-change-list.v1.json",
|
|
4
|
+
"title": "Workspai Proof-Carrying Change List",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "generatedAt", "workspace", "changes", "summary"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": "workspai.proof-carrying-change-list.v1" },
|
|
9
|
+
"generatedAt": { "type": "string", "format": "date-time" },
|
|
10
|
+
"workspace": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["name"],
|
|
13
|
+
"properties": { "name": { "type": "string", "minLength": 1 } },
|
|
14
|
+
"additionalProperties": false
|
|
15
|
+
},
|
|
16
|
+
"changes": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"items": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"required": [
|
|
21
|
+
"changeId",
|
|
22
|
+
"goalId",
|
|
23
|
+
"state",
|
|
24
|
+
"status",
|
|
25
|
+
"createdAt",
|
|
26
|
+
"updatedAt",
|
|
27
|
+
"scope",
|
|
28
|
+
"assurance",
|
|
29
|
+
"blockers",
|
|
30
|
+
"capsuleArtifact",
|
|
31
|
+
"valid",
|
|
32
|
+
"errors"
|
|
33
|
+
],
|
|
34
|
+
"properties": {
|
|
35
|
+
"changeId": { "type": "string", "pattern": "^change-[a-z0-9][a-z0-9-]{7,95}$" },
|
|
36
|
+
"goalId": { "type": ["string", "null"] },
|
|
37
|
+
"state": { "type": ["string", "null"] },
|
|
38
|
+
"status": { "enum": ["open", "blocked", "verified", "sealed", "aborted", "invalid"] },
|
|
39
|
+
"createdAt": {
|
|
40
|
+
"oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }]
|
|
41
|
+
},
|
|
42
|
+
"updatedAt": {
|
|
43
|
+
"oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }]
|
|
44
|
+
},
|
|
45
|
+
"scope": {
|
|
46
|
+
"oneOf": [{ "$ref": "decision-event.v1.json#/$defs/scope" }, { "type": "null" }]
|
|
47
|
+
},
|
|
48
|
+
"assurance": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"required": ["passed", "total"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"passed": { "type": "integer", "minimum": 0 },
|
|
53
|
+
"total": { "type": "integer", "minimum": 0 }
|
|
54
|
+
},
|
|
55
|
+
"additionalProperties": false
|
|
56
|
+
},
|
|
57
|
+
"blockers": { "type": "array", "items": { "type": "string" } },
|
|
58
|
+
"capsuleArtifact": { "type": "string", "minLength": 1 },
|
|
59
|
+
"valid": { "type": "boolean" },
|
|
60
|
+
"errors": { "type": "array", "items": { "type": "string", "minLength": 1 } }
|
|
61
|
+
},
|
|
62
|
+
"additionalProperties": false
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"summary": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"required": ["total", "open", "blocked", "sealed", "aborted", "invalid"],
|
|
68
|
+
"properties": {
|
|
69
|
+
"total": { "type": "integer", "minimum": 0 },
|
|
70
|
+
"open": { "type": "integer", "minimum": 0 },
|
|
71
|
+
"blocked": { "type": "integer", "minimum": 0 },
|
|
72
|
+
"sealed": { "type": "integer", "minimum": 0 },
|
|
73
|
+
"aborted": { "type": "integer", "minimum": 0 },
|
|
74
|
+
"invalid": { "type": "integer", "minimum": 0 }
|
|
75
|
+
},
|
|
76
|
+
"additionalProperties": false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"additionalProperties": false
|
|
80
|
+
}
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"allOf": [
|
|
36
36
|
{ "$ref": "#/$defs/changeSet" },
|
|
37
37
|
{
|
|
38
|
+
"type": "object",
|
|
38
39
|
"properties": {
|
|
39
40
|
"added": {
|
|
40
41
|
"type": "array",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"allOf": [
|
|
54
55
|
{ "$ref": "#/$defs/changeSet" },
|
|
55
56
|
{
|
|
57
|
+
"type": "object",
|
|
56
58
|
"properties": {
|
|
57
59
|
"added": {
|
|
58
60
|
"type": "array",
|
|
@@ -71,6 +73,7 @@
|
|
|
71
73
|
"allOf": [
|
|
72
74
|
{ "$ref": "#/$defs/changeSet" },
|
|
73
75
|
{
|
|
76
|
+
"type": "object",
|
|
74
77
|
"properties": {
|
|
75
78
|
"added": {
|
|
76
79
|
"type": "array",
|
|
@@ -145,7 +148,12 @@
|
|
|
145
148
|
},
|
|
146
149
|
"changeSet": {
|
|
147
150
|
"type": "object",
|
|
148
|
-
"required": ["added", "removed", "changed"]
|
|
151
|
+
"required": ["added", "removed", "changed"],
|
|
152
|
+
"properties": {
|
|
153
|
+
"added": {},
|
|
154
|
+
"removed": {},
|
|
155
|
+
"changed": {}
|
|
156
|
+
}
|
|
149
157
|
},
|
|
150
158
|
"entityChange": {
|
|
151
159
|
"type": "object",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-YWZBGSFE.js';
|
package/dist/{artifact-remediation-plan-I7IKC5MR.js → artifact-remediation-plan-JHHZ4L24.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as buildArtifactRemediationPlan,b as writeArtifactRemediationPlan}from'./chunk-
|
|
1
|
+
export{a as buildArtifactRemediationPlan,b as writeArtifactRemediationPlan}from'./chunk-A3MYO55A.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-VNKAISFE.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as runDoctorCapabilities}from'./chunk-GSSJJS5M.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {k,q}from'./chunk-46QH3ZVI.js';import {a as a$6}from'./chunk-HTYMXMQM.js';import {b as b$2,c as c$2,a as a$3}from'./chunk-V52R2W2Q.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {d,a as a$1,p as p$1,g as g$2,f as f$2,e}from'./chunk-UW4SESKD.js';import {c,b as b$1,j as j$1,z as z$1,f}from'./chunk-KFTJVVJR.js';import {m,l}from'./chunk-U5ENEDJA.js';import {a as a$5}from'./chunk-GR6442P7.js';import {i,f as f$1,a as a$4,g as g$1}from'./chunk-OZXCNVGW.js';import {a}from'./chunk-2LIVMG5C.js';import {d as d$1,c as c$1}from'./chunk-EWZZUQBR.js';import {q as q$1,p,t as t$1,s}from'./chunk-ODK4LCEL.js';import {t}from'./chunk-VQZ5PI5J.js';import g from'path';import P from'fs-extra';import It from'crypto';import {execFile}from'child_process';import {promisify}from'util';import {createRequire}from'module';var Rt=new Set(c().map(e=>e.id)),At=[...k().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.id,runtime:"node",runtimeCandidates:["node"],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.minNodeVersion?{runtimeRequirements:{node:`>=${e.minNodeVersion}`}}:e.minNodeMajor?{runtimeRequirements:{node:`>=${e.minNodeMajor}`}}:{}})),...q().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.framework,runtime:e.runtime,runtimeCandidates:[...e.runtimeCandidates],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.nodeSupport?{runtimeRequirements:{node:e.nodeSupport.requirement}}:{}})),{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"node",runtimeCandidates:["node","php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",plannerFramework:"symfony",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",plannerFramework:"rails",runtime:"ruby",runtimeCandidates:["ruby"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["rails new <name>"],adoptAfterCreate:true}],H=new Map;for(let e of At){H.set(e.id,e);for(let t of e.aliases)H.set(t,e);}var Mt=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function K(e){return e?.trim().toLowerCase()||void 0}function Qe(e){let t=K(e.kitId)??K(e.framework)??K(e.runtime)??"unknown";if(e.projectExists)return {lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let r=e.kitId?b$1(e.kitId):void 0;if(r&&Rt.has(r))return {lane:"native",status:"available",canExecuteCreate:true,requested:t,resolved:r,reason:"Workspai owns the create contract, project marker, registry, doctor, and workspace model path."};let o=H.get(t)??H.get(K(e.framework)??"")??H.get(K(e.runtime)??"");if(o)return {lane:"official",status:o.status,canExecuteCreate:o.canExecuteCreate,requested:t,resolved:o.id,officialCommands:o.officialCommands,fallbackLane:o.canExecuteCreate?void 0:"existing",reason:o.status==="available"?"Workspai runs the official ecosystem generator, then registers the project in Workspace Intelligence.":"Official generator support is planned but not enabled; use adopt/import until Workspai owns the post-create contract."};let s=K(e.runtime);return s&&Mt.has(s)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:s,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function $r(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var Lr="rapidkit-freshness-metadata-v1";function fe(e){if(Array.isArray(e))return e.map(t=>fe(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=fe(e[r]);return t}return e}function Ft(e){return JSON.stringify(fe(e))}function G(e){return It.createHash("sha256").update(Ft(e)).digest("hex")}var Ze=".workspai/workspace-graph.overrides.json",Dt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),Ot=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),tt=600,rt=5,Gt=256*1024,et={inferred:1,contract:2,manual:3};function _t(e){return e.split(g.sep).join("/")}function Z(e,t){return _t(g.relative(e,t)||".")}function nt(e){let t=new Map;for(let r of e.projects)t.has(r.name)||t.set(r.name,{id:r.name,path:r.path,...r.runtime?{runtime:r.runtime}:{},...r.framework?{framework:r.framework}:{},...r.kind?{kind:r.kind}:{}});return [...t.values()].sort((r,o)=>r.id.localeCompare(o.id))}function ot(e,t){let r=new Map,o=new Map;for(let n of t.projects){if(r.has(n.name))continue;let c=n.absolutePath?g.resolve(n.absolutePath):g.resolve(e,n.path);r.set(n.name,c),o.has(c)||o.set(c,n.name);}let s=[...o.entries()].map(([n,c])=>({dir:n,id:c})).sort((n,c)=>c.dir.length-n.dir.length||n.dir.localeCompare(c.dir));return {idToDir:r,dirToId:o,sortedDirs:s}}function ee(e,t){let r=g.resolve(t);for(let{dir:o,id:s}of e.sortedDirs)if(r===o||r.startsWith(`${o}${g.sep}`))return s;return null}async function he(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function ye(e){try{return await P.pathExists(e)?await P.readFile(e,"utf8"):null}catch{return null}}async function st(e,t){let r=[],o=new Map;for(let[s,n]of t.idToDir.entries()){let c=await he(g.join(n,"package.json")),a=typeof c?.name=="string"?c.name.trim():"";a&&!o.has(a)&&o.set(a,s);}for(let[s,n]of t.idToDir.entries()){let c=await he(g.join(n,"package.json"));if(c){let a=["dependencies","devDependencies","peerDependencies","optionalDependencies"],i=new Set;for(let l of a){let u=c[l];if(!(!u||typeof u!="object"||Array.isArray(u)))for(let p of Object.keys(u)){let d=o.get(p);!d||d===s||i.has(d)||(i.add(d),r.push({from:s,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(n,"package.json")),detail:`declares dependency ${p}`}]}));}}}r.push(...await Tt(e,t,s,n)),r.push(...await Nt(e,t,s,n));}return r}async function Tt(e,t,r,o){let s=await ye(g.join(o,"pyproject.toml"));if(!s)return [];let n=[],c=new Set,a=/path\s*=\s*["']([^"']+)["']/g,i;for(;(i=a.exec(s))!==null;){let l=ee(t,g.resolve(o,i[1]));!l||l===r||c.has(l)||(c.add(l),n.push({from:r,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(o,"pyproject.toml")),detail:`path dependency ${i[1]}`}]}));}return n}async function Nt(e,t,r,o){let s=await ye(g.join(o,"go.mod"));if(!s)return [];let n=[],c=new Set,a=/replace\s+\S+\s+=>\s+(\.[^\s]+)/g,i;for(;(i=a.exec(s))!==null;){let l=ee(t,g.resolve(o,i[1]));!l||l===r||c.has(l)||(c.add(l),n.push({from:r,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,g.join(o,"go.mod")),detail:`go.mod replace ${i[1]}`}]}));}return n}async function Kt(e,t){let r=[],o=[e];for(;o.length>0&&r.length<t;){let s=o.shift();if(!s)continue;let n=[];try{n=await P.readdir(s,{withFileTypes:true});}catch{continue}let c=[],a=[];for(let i of n)if(i.isDirectory()){if(Ot.has(i.name)||a$5(i.name)||i.name.startsWith("."))continue;c.push(g.join(s,i.name));}else i.isFile()&&Dt.has(g.extname(i.name))&&a.push(g.join(s,i.name));a.sort((i,l)=>i.localeCompare(l)),c.sort((i,l)=>i.localeCompare(l));for(let i of a){if(r.length>=t)break;r.push(i);}o.push(...c);}return r}var $t=[/\bfrom\s+["']([^"']+)["']/g,/\bimport\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g];function Vt(e){let t=new Set;for(let r of $t){r.lastIndex=0;let o;for(;(o=r.exec(e))!==null;){let s=o[1];s.startsWith(".")&&t.add(s);}}return [...t]}async function ke(e,t,r,o){let s=new Map;for(let[n,c]of t.idToDir.entries()){if(o&&!o.has(n))continue;let a=await Kt(c,r);for(let i of a){let l=await P.stat(i).catch(()=>null);if(!l||l.size>Gt)continue;let u=await ye(i);if(u)for(let p of Vt(u)){let d=g.resolve(g.dirname(i),p),f=ee(t,d);if(!f||f===n)continue;let y=`${n}\0${f}`,m=s.get(y);m||(m={from:n,to:f,evidence:[]},s.set(y,m)),m.evidence.length<rt&&m.evidence.push({file:Z(e,i),detail:`imports ${p}`});}}}return [...s.values()].map(n=>({from:n.from,to:n.to,kind:"code-import",source:"inferred",confidence:"medium",evidence:n.evidence}))}function Ht(e,t,r){let o=new Map;for(let s of r.projects){let n=Bt(e,t,s);n&&o.set(s.slug,n);}return o}function Bt(e,t,r){let o=[r.relativePath,r.externalPath].filter(s=>typeof s=="string"&&s.length>0);for(let s of o){let n=g.resolve(e,s),c=t.dirToId.get(n)??ee(t,n);if(c)return c}return t.idToDir.has(r.slug)?r.slug:null}function at(e,t,r){let o=[],s=Ht(e,t,r),n=g$2,c=new Map,a=new Map;for(let i of r.projects){let l=s.get(i.slug);if(!l)continue;let u=i.contracts??{publishes:[],consumes:[],dependsOn:[]};for(let p of u.dependsOn??[]){let d=s.get(p);!d||d===l||o.push({from:l,to:d,kind:"service-dependsOn",source:"contract",confidence:"high",evidence:[{file:n,detail:`dependsOn ${p}`}]});}for(let p of u.publishes??[])c.has(p)||c.set(p,new Set),c.get(p)?.add(l);for(let p of u.consumes??[])a.has(p)||a.set(p,new Set),a.get(p)?.add(l);}for(let[i,l]of c.entries()){let u=a.get(i);if(u)for(let p of u)for(let d of l)p!==d&&o.push({from:p,to:d,kind:"event-pub-sub",source:"contract",confidence:"high",evidence:[{file:n,detail:`consumes event ${i}`}]});}return o.push(...Lt(r,s)),o}function me(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function Lt(e,t){let r=[],o=e.projects.map(s=>({project:s,id:t.get(s.slug)})).filter(s=>!!s.id).filter(s=>me(s.project.slug).length>=3);for(let s of e.projects){let n=t.get(s.slug);if(!n)continue;let c=s.contracts?.env??[];if(c.length===0)continue;let a=new Set;for(let i of c){let l=me(i);for(let u of o)u.id===n||a.has(u.id)||!(l.includes(me(u.project.slug))&&(u.project.ports?.length??0)>0)||(a.add(u.id),r.push({from:n,to:u.id,kind:"shared-resource",source:"inferred",confidence:"low",evidence:[{file:g$2,detail:`env ${i} references ${u.project.slug}`}]}));}}return r}async function it(e,t){let r=await he(g.join(e,Ze)),o=Array.isArray(r?.edges)?r?.edges:[],s=[],n=new Set(f$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$1,t,r,o){let s=qt(r.filter(i=>t.has(i.from)&&t.has(i.to))),n=Zt(e$1,s),c=er(e$1,s),a=tr(e$1,s,c);return {schemaVersion:e,generatedAt:(o??new Date).toISOString(),nodes:n,edges:s,stats:c,...a.length>0?{diagnostics:a}:{}}}async function dt(e){let t=g.resolve(e.workspacePath),r=e.maxImportFilesPerProject??tt,o=nt(e.model),s=new Set(o.map(a=>a.id)),n=ot(t,e.model),c=[];return c.push(...await st(t,n)),c.push(...await ke(t,n,r)),e.contract&&c.push(...at(t,n,e.contract)),c.push(...await it(t,s)),ct(o,s,c,e.now)}async function pt(e){let t=g.resolve(e.workspacePath),r=e.maxImportFilesPerProject??tt,o=nt(e.model),s=new Set(o.map(a=>a.id)),n=ot(t,e.model),c=[];if(c.push(...await st(t,n)),e.structuralChange)c.push(...await ke(t,n,r));else {c.push(...await ke(t,n,r,e.changedProjectIds));for(let a of e.previousGraph.edges)a.kind==="code-import"&&a.source==="inferred"&&!e.changedProjectIds.has(a.from)&&s.has(a.from)&&s.has(a.to)&&c.push({from:a.from,to:a.to,kind:"code-import",source:"inferred",confidence:a.confidence,evidence:a.evidence});}return e.contract&&c.push(...at(t,n,e.contract)),c.push(...await it(t,s)),ct(o,s,c,e.now)}var te="workspace-model-producer.v3";var ve=s.workspaceModelCache.schemaVersion,we=t$1.workspaceModelCache,ir=["package.json","pyproject.toml","setup.py","requirements.txt","requirements.in","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","Gemfile.lock","mix.exs","mix.lock","deno.json","deno.jsonc","deno.lock","bun.lock","bun.lockb","bunfig.toml",".bunfig.toml","deps.edn","project.clj","build.sbt","CMakeLists.txt","meson.build","workspai.project.json",".workspai/project.json",".workspai/context.json","rapidkit.project.json",".rapidkit/project.json",".rapidkit/context.json"],cr=[".csproj",".fsproj",".vbproj",".sln",".slnx",".gemspec"],lt=[t$1.workspaceContract,".workspai/workspace.json","workspai.workspace.json",".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],ut=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".vue",".svelte",".rb",".go",".py",".java",".kt",".kts",".rs",".cs",".php",".ex",".exs",".clj",".cljs",".scala",".c",".cc",".cpp",".cxx",".h",".hh",".hpp",".hxx",".proto",".graphql",".gql",".sql",".sh"]),dr=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),pr=1500,re=promisify(execFile);function lr(e){return ut.has(g.extname(e).toLowerCase())}async function ur(e){try{let{stdout:t}=await re("git",["-C",e,"rev-parse","--show-toplevel"],{encoding:"utf8",timeout:1e4,maxBuffer:1048576}),r=t.trim();if(!r)return null;let o=g.relative(r,e).split(g.sep).join("/");if(o===".."||o.startsWith("../"))return null;let s=o||".",n=o?`HEAD:${o}`:"HEAD^{tree}",{stdout:c}=await re("git",["-C",r,"rev-parse",n],{encoding:"utf8",timeout:1e4,maxBuffer:1024*1024}),[a,i]=await Promise.all([re("git",["-C",r,"diff","--name-only","-z","HEAD","--",s],{encoding:"buffer",timeout:2e4,maxBuffer:64*1024*1024}),re("git",["-C",r,"ls-files","--others","--exclude-standard","-z","--",s],{encoding:"buffer",timeout:2e4,maxBuffer:64*1024*1024})]),l=new Set([a.stdout,i.stdout].flatMap(p=>p.toString("utf8").split("\0")).filter(Boolean)),u=[`git-tree:${c.trim()}`];for(let p of [...l].sort((d,f)=>d.localeCompare(f))){let d=g.resolve(r,p),f=g.relative(e,d).split(g.sep).join("/");f===".."||f.startsWith("../")||!lr(f)||u.push(`${f}:${await L(d)??"<deleted>"}`);}return u}catch{return null}}var B=null;function be(){if(B)return B;try{B=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{B="0.0.0";}return B}async function L(e){try{let t=await P.readFile(e);return It.createHash("sha256").update(t).digest("hex")}catch{return null}}async function ft(e){let t={};for(let o of ir){let s=await L(g.join(e,o));s&&(t[o]=s);}let r=await P.readdir(e).catch(()=>[]);for(let o of r.sort((s,n)=>s.localeCompare(n))){if(!cr.some(n=>o.toLowerCase().endsWith(n)))continue;let s=await L(g.join(e,o));s&&(t[o]=s);}return t}async function fr(e){let t=await ft(e),r=await ur(e),o=r??[];if(r)return G({manifests:t,source:o});let s=[e];for(;s.length>0&&o.length<pr;){let n=s.shift();if(!n)continue;let c=[];try{c=await P.readdir(n,{withFileTypes:true});}catch{continue}let a=[];for(let i of c)if(i.isDirectory()){if(dr.has(i.name)||a$5(i.name)||i.name.startsWith("."))continue;a.push(g.join(n,i.name));}else if(i.isFile()&&ut.has(g.extname(i.name))){let l=g.join(n,i.name),u=await P.stat(l).catch(()=>null);if(u){let p=g.relative(e,l).split(g.sep).join("/");o.push(`${p}:${u.size}:${Math.round(u.mtimeMs)}`);}}a.sort((i,l)=>i.localeCompare(l)),s.push(...a);}return o.sort((n,c)=>n.localeCompare(c)),G({manifests:t,source:o})}async function ne(e,t){let r=g.resolve(e),o={},s=[...new Set(t.map(n=>g.relative(r,g.resolve(n)).split(g.sep).join("/")))].sort((n,c)=>n.localeCompare(c));for(let n of s)o[n]=await fr(g.join(r,n));return o}async function oe(e){let t=g.resolve(e),r={};for(let o of lt){let s=await L(g.join(t,o));s&&(r[o]=s);}return r}async function se(e){let t=g.resolve(e.workspacePath),r=[...new Set(e.projectPaths.map(n=>g.relative(t,g.resolve(n)).split(g.sep).join("/")))].sort((n,c)=>n.localeCompare(c)),o=[];for(let n of r){let c=await ft(g.join(t,n));o.push({project:n,manifests:c});}let s={};for(let n of lt){let c=await L(g.join(t,n));c&&(s[n]=c);}return G({cacheSchema:ve,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:o,workspaceFiles:s})}async function je(e){let t=await f$1(e,we)??a$4(e,we);try{if(!await P.pathExists(t))return null;let r=await P.readJson(t);return !r||r.schemaVersion!==ve||r.producerRevision!==te||typeof r.inputsHash!="string"||typeof r.cliVersion!="string"||!r.model?null:r}catch{return null}}async function ae(e,t){let r={schemaVersion:ve,producerRevision:te,...t};return g$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=s.projectKnowledgeGraphReference.schemaVersion;function wt(e,t){let r=wr(e,t),o={schemaVersion:vr,generatedAt:e.generatedAt,project:{name:t},canonical:{graph:"workspace:.workspai/reports/workspace-knowledge-graph.json",boundedQuery:`workspai workspace graph search <task-query> --scope project:${t} --limit 12 --json`,sourceHash:e.source.hash,projectionHash:c$1(r)},summary:{entityCount:r.entities.length,relationCount:r.relations.length,proofCount:r.proofs.length}};return {...o,integrity:{algorithm:"sha256",payloadHash:c$1(o),portable:true,absolutePathsEmitted:false}}}function vt(e,t){return g.resolve(t.absolutePath??g.join(e,t.path))}var br=q$1.model,ie=p.model;function Pe(e){return e.projectTopology??e.graph}function jt(e){return !!(e.projectTopology&&e.graph&&c$1(e.projectTopology)===c$1(e.graph))}function eo(e){let t=e.engineStatus==="hit"||e.engineStatus==="unchanged"?"reused":e.engineStatus==="incremental"?"partially-reused":"rebuilt";return {schemaVersion:"workspace-model-build.v1",mode:e.mode,outcome:t,engineStatus:e.engineStatus}}var jr=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","bunfig.toml",".bunfig.toml","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","terraform.tf"],Cr=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function Ct(e,t){return (g.relative(e,t)||".").split(g.sep).join("/")}async function Pt(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function Pr(e,t){for(let r of t)if(await P.pathExists(g.join(e,r)))return true;return false}function Se(e){let t=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),r=typeof e=="number"&&Number.isFinite(e)?e:Number.isFinite(t)?t:4;return Math.min(12,Math.max(1,Math.trunc(r)))}async function Sr(e,t){let r=g.resolve(e),o=[{dirPath:r,depth:0}],s=new Set,n=new Set;for(;o.length>0;){let c=o.shift();if(!c)continue;let a=g.resolve(c.dirPath);if(n.has(a))continue;if(n.add(a),a!==r&&await Pr(a,jr)){s.add(a);continue}if(c.depth>=t)continue;let i=[];try{i=await P.readdir(a,{withFileTypes:true});}catch{continue}for(let l of i)!l.isDirectory()||Cr.has(l.name)||a$5(l.name)||l.name.startsWith(".")&&l.name!==".config"||o.push({dirPath:g.join(a,l.name),depth:c.depth+1});}return Array.from(s).sort((c,a)=>c.localeCompare(a))}function Er(e){let t=new Set,r=[];for(let o of e){let s=g.resolve(o);t.has(s)||(t.add(s),r.push(s));}return r.sort((o,s)=>o.localeCompare(s))}function bt(e,t){let r=e?.[t];return typeof r=="string"&&r.trim()?r.trim():void 0}function Wr(e,t){return e?.[t]===true}function xr(e,t,r){let o=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,s=bt(o,"generator"),n=bt(o,"command_display"),c=typeof t=="string"&&t.startsWith("frontend.");if(!(!s&&!c))return {...s?{id:s}:{},...t?{kit:t}:{},displayName:r,source:Wr(o,"official_generator")?"official-generator":"metadata",...n?{commandDisplay:n}:{}}}async function Rr(e){let t=[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json","package.json","product.json","tsconfig.json","pnpm-workspace.yaml","bunfig.toml",".bunfig.toml","nx.json","turbo.json","pyproject.toml","requirements.txt","go.mod","go.work","go.work.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","rust-toolchain.toml","rust-toolchain","CMakeLists.txt","meson.build","Makefile","WORKSPACE","WORKSPACE.bazel","MODULE.bazel","BUILD","BUILD.bazel",".bazelrc","composer.json","Gemfile","mix.exs","deno.json","setup.py","setup.cfg","Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","README.md"],r=[];for(let s of t)await P.pathExists(g.join(e,s))&&r.push(s);let o=new Set(["package.json","pyproject.toml","go.mod","go.work","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","CMakeLists.txt","meson.build","composer.json","Gemfile","mix.exs","deno.json"]);if(!r.some(s=>o.has(s))){let s=[],n=new Set([".git",".workspai",".rapidkit",".venv","build","dist","node_modules","target","third_party","vendor"]),c=(p,d)=>{let f=p.toLowerCase();return ["package.json","pyproject.toml","go.mod","pom.xml","build.gradle","build.gradle.kts","cargo.toml","cmakelists.txt","meson.build","composer.json","gemfile","mix.exs","deno.json"].includes(f)||f.endsWith(".gemspec")||f==="description"&&d.toLowerCase()==="r"},a=async(p,d)=>{if(d>3||s.length>=512)return;let f=await P.readdir(p,{withFileTypes:true}).catch(()=>[]);for(let y of f.sort((m,v)=>m.name.localeCompare(v.name))){if(s.length>=512)return;y.isFile()&&c(y.name,g.basename(p))?s.push(g.relative(e,g.join(p,y.name)).split(g.sep).join("/")):y.isDirectory()&&!n.has(y.name)&&await a(g.join(p,y.name),d+1);}};await a(e,0);let i=new Map;for(let p of s){let d=p.split("/")[0],f=i.get(d)??[];f.push(p),i.set(d,f);}for(let p of i.values())p.sort((d,f)=>d.split("/").length-f.split("/").length||d.localeCompare(f));let l=[],u=[...i.keys()].sort();for(let p=0;l.length<16&&u.some(d=>p<(i.get(d)?.length??0));p+=1)for(let d of u){let f=i.get(d)?.[p];f&&l.length<16&&l.push(f);}r.push(...l.filter(p=>!r.includes(p)));}return r}async function R(e,t,r,o=t){let s=await f$1(e,t),n=s!==null,c={path:o.split(g.sep).join("/"),exists:n};if(s&&r){let a=await Pt(s);typeof a?.generatedAt=="string"&&(c.generatedAt=a.generatedAt);let i=a?.status??a?.result??a?.verdict;typeof i=="string"&&(c.status=i);}return c}async function Ar(e,t,r){let o=Ct(e,t),s=".workspai/reports",n=i=>R(t,`${s}/${i}`,r,`${o}/${s}/${i}`),c=await n("doctor-project-last-run.json");return {doctor:c?.exists===true?c:await n("doctor-last-run.json"),remediationPlan:await n("doctor-remediation-plan-last-run.json"),fixResult:await n("doctor-fix-result-last-run.json"),analyze:await n("analyze-last-run.json"),readiness:await n("release-readiness-last-run.json")}}async function Mr(e,t,r){let o=j$1(t),s=m(t,o),n=z$1(t),c=f(s.runtime),a=await b$2(t,o,{runtime:s.runtime,framework:s.key}),i=r.contractProject?.slug?r.contractProject.slug:typeof o?.name=="string"&&o.name.trim()?o.name.trim():g.basename(t),l$1=typeof o?.kit_name=="string"?o.kit_name:typeof o?.kit=="string"?o.kit:r.contractProject?.kit,u=typeof o?.engine=="string"?o.engine:n.engine!=="unknown"?n.engine:void 0,p=xr(o,l$1,s.displayName),d=Qe({kitId:l$1,framework:s.key,runtime:s.runtime}),f$1=l(t),y=[s.runtime,...f$1.filter(v=>v!==s.runtime)],m$1=await c$2({projectPath:t,declaration:r.contractProject?.governance});return {name:i,path:Ct(e,t),...r.includeAbsolutePaths?{absolutePath:t}:{},kind:a,category:a$3(a),runtime:s.runtime,runtimeCandidates:y,framework:s.key,frameworkDisplayName:s.displayName,confidence:s.confidence,detectionSource:s.source,supportTier:s.supportTier,runtimeSupportTier:c.tier,runtimeDoctorSupport:c.doctorSupport,moduleSupport:n.moduleSupport,...l$1?{kit:l$1}:{},...u?{engine:u}:{},...p?{generator:p}:{},createCapability:d,commands:{supported:n.supportedCommands,unsupported:n.unsupportedCommands,global:n.globalCommands,fleetStages:n.fleetStages,localOnly:n.localOnlyCommands,map:n.commandMap},importantFiles:await Rr(t),governance:m$1,evidence:await Ar(e,t,r.includeEvidence),provenance:{path:r.contractProject?"workspace contract declaration reconciled with filesystem discovery":"filesystem discovery",runtime:s.source,framework:s.source,commands:"project command capability matrix",createCapability:"create planner capability contract",governance:r.contractProject?.governance!==void 0?"workspace contract declaration reconciled with repository evidence":"repository and documented external governance discovery",evidence:"project .workspai/reports"}}}async function Ir(e){for(let t$1 of t(e,"workspace.json")){let r=await Pt(t$1);if(r)return r}return null}function Fr(e){if(e.length===0)return "empty-workspace";let t=new Set(e.map(r=>r.category));return t.size>1?"polyglot-product-workspace":t.has("frontend")&&e.length>1?"full-stack-workspace":t.has("frontend")?"frontend-workspace":t.has("desktop")?"desktop-application-workspace":t.has("extension")?"extension-workspace":t.has("platform")?"platform-workspace":t.has("library")?"library-workspace":e.length>1?"backend-platform":"backend-workspace"}function Dr(e){let t=new Set;for(let r of e){let o=`${r.name} ${r.path}`.toLowerCase();for(let s of ["auth","billing","payment","notification","order","admin","report","search","analytics"])o.includes(s)&&t.add(s);}return Array.from(t).sort()}function C(e,t,r,o){return {severity:e,code:t,message:r,target:o}}function St(e){let t=[];e.workspace.name.trim()||t.push(C("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(C("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(C("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(C("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",e.contracts.workspaceContractPath));let r=new Map;for(let n of e.projects){let c=n.name.toLowerCase(),a=r.get(c)??[];a.push(n),r.set(c,a),n.importantFiles.length||t.push(C("warning","project.markers.missing",`Project ${n.name} has no important manifest files recorded.`,n.path));let i=g.isAbsolute(n.path)?n.path:g.resolve(e.workspace.root,n.path);P.existsSync(i)||t.push(C("warning","project.path.missing",`Registered project ${n.name} is not available at its declared path.`,n.path)),n.runtime==="unknown"&&t.push(C("warning","project.runtime.unknown",`Project ${n.name} runtime could not be confidently detected.`,n.path));let l=["test","build"];for(let d of l)n.commands.supported.includes(d)&&n.commands.unsupported.includes(d)&&t.push(C("error","project.commands.conflict",`Project ${n.name} marks ${d} as both supported and unsupported.`,n.path));let u=new Set(n.commands.fleetStages),p=new Set(n.commands.localOnly);for(let d of n.commands.fleetStages){p.has(d)&&t.push(C("error","project.commands.scope-conflict",`Project ${n.name} marks ${d} as both fleet and local-only.`,n.path));let f=n.commands.map[d];(!f||f.status!=="supported"||f.fleetEligible!==true||f.executionScope!=="fleet")&&t.push(C("error","project.commands.fleet-stage-invalid",`Project ${n.name} advertises ${d} as a fleet stage without a supported fleet capability.`,n.path));}for(let d of n.commands.localOnly){let f=n.commands.map[d];(!f||f.status!=="supported"||f.executionScope!=="local-only"||f.fleetEligible===true)&&t.push(C("error","project.commands.local-only-invalid",`Project ${n.name} advertises ${d} as local-only without a matching local-only capability.`,n.path));}for(let d of Object.values(n.commands.map))d.status==="supported"&&(d.fleetEligible===true&&!u.has(d.command)&&t.push(C("error","project.commands.fleet-stage-missing",`Project ${n.name} capability ${d.command} is fleet-eligible but missing from fleetStages.`,n.path)),d.executionScope==="local-only"&&d.fleetEligible!==true&&!p.has(d.command)&&t.push(C("error","project.commands.local-only-missing",`Project ${n.name} capability ${d.command} is local-only but missing from localOnly commands.`,n.path)));}for(let[n,c]of r.entries())c.length>1&&t.push(C("error","project.name.duplicate",`Project name "${n}" is ambiguous across ${c.length} project roots.`,c.map(a=>a.path).join(", ")));e.projectTopology&&e.graph&&c$1({...e.projectTopology,generatedAt:"<ignored>"})!==c$1({...e.graph,generatedAt:"<ignored>"})&&t.push(C("error","workspace.project-topology.alias-mismatch","Deprecated model.graph must remain structurally identical to canonical model.projectTopology during the v1 migration window.","projectTopology"));let o=t.filter(n=>n.severity==="error").length,s=t.filter(n=>n.severity==="warning").length;return {status:o>0?"failed":s>0?"warning":"passed",errors:o,warnings:s,issues:t}}function to(e){return St(e)}function j(e){return e.join(".")}function Or(e,t){let r=ie,o=e.generatedAt,s=[b({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),b({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),b({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),b({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),b({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),b({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:j(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})],n=Pe(e);n&&s.push(b({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:n.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??o,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),b({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:n.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??o,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[c,a]of e.projects.entries()){let i=`projects[${c}]`,l={kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};s.push(b({id:`project.${a.name}.kind`,label:`${a.name} kind`,scope:"project",project:a.name,value:a.kind,freshness:{...l,sourcePath:j([i,"kind"])}}),b({id:`project.${a.name}.category`,label:`${a.name} category`,scope:"project",project:a.name,value:a.category,freshness:{...l,sourcePath:j([i,"category"])}}),b({id:`project.${a.name}.runtime`,label:`${a.name} runtime`,scope:"project",project:a.name,value:a.runtime,freshness:{...l,sourcePath:j([i,"runtime"])}}),b({id:`project.${a.name}.framework`,label:`${a.name} framework`,scope:"project",project:a.name,value:a.frameworkDisplayName,freshness:{...l,sourcePath:j([i,"frameworkDisplayName"])}}),b({id:`project.${a.name}.supportTier`,label:`${a.name} support tier`,scope:"project",project:a.name,value:a.supportTier,freshness:{...l,sourcePath:j([i,"supportTier"])}}),b({id:`project.${a.name}.safeFleetStages`,label:`${a.name} safe fleet stages`,scope:"command",project:a.name,value:a.commands.fleetStages,freshness:{...l,sourcePath:j([i,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}),...["ci","release","ownership"].map(u=>b({id:`project.${a.name}.governance.${u}`,label:`${a.name} ${u} governance`,scope:"policy",project:a.name,value:a.governance?.[u]??{status:"unknown",provider:null,evidence:[],reference:null},freshness:{...l,sourcePath:j([i,"governance",u]),reason:"Governance truth is reconciled from repository surfaces and explicit workspace contract declarations."}})));for(let[u,p]of Object.entries(a.evidence))s.push(b({id:`project.${a.name}.evidence.${u}`,label:`${a.name} ${u} evidence`,scope:"evidence",project:a.name,value:p?{path:p.path,exists:p.exists,status:p.status??null}:{exists:false},freshness:{kind:p?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:p?.generatedAt??o,now:t,status:p?.exists?void 0:"unknown",sourceArtifact:p?.path??r,sourcePath:j([i,"evidence",u]),verifyBeforeUse:true,reason:p?.exists?"Evidence reports can expire or become stale after source changes.":"Missing evidence must be generated before this fact is used for verification."}}));}for(let[c,a]of Object.entries(e.evidence))s.push(b({id:`workspace.evidence.${c}`,label:`Workspace ${c} evidence`,scope:"evidence",value:a?{path:a.path,exists:a.exists,status:a.status??null}:null,freshness:{kind:a?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:a?.generatedAt??o,now:t,status:a?.exists?void 0:"unknown",sourceArtifact:a?.path??r,sourcePath:j(["evidence",c]),verifyBeforeUse:true,reason:a?.exists?"Workspace evidence can expire or become stale after project, dependency, or policy changes.":"Missing workspace evidence must be generated before release or repair decisions."}}));return s}async function Ee(e,t){let[r,o,s,n,c,a$3]=await Promise.all([a(e),Ir(e),We(e),a$1(e),a$2(e,{descendIntoMatchedProjects:false}),Sr(e,t)]),i=new Map;for(let u of s?.projects??[]){let p=u.externalPath?g.resolve(e,u.externalPath):g.resolve(e,u.relativePath);i.set(p,u);}let l=Er([...c,...a$3,...i.keys(),...n.map(u=>g.isAbsolute(u.path)?u.path:g.join(e,u.path))]);return {marker:r,workspaceJson:o,workspaceContract:s,contractProjectPaths:i,projectPaths:l}}async function ce(e){let t$2=g.resolve(e.workspacePath),r=e.includeAbsolutePaths===true,o=e.includeEvidence===true,s=Se(e.observableScanDepth),n=e.now??new Date,{marker:c,workspaceJson:a,workspaceContract:i,contractProjectPaths:l,projectPaths:u}=await Ee(t$2,s),p$1=e.reuseProjectModels,d=await Promise.all(u.map(k=>{if(p$1){let xt=g.relative(t$2,g.resolve(k)).split(g.sep).join("/"),xe=p$1.get(xt);if(xe)return Promise.resolve(xe)}return Mr(t$2,k,{includeAbsolutePaths:r,includeEvidence:o,contractProject:l.get(g.resolve(k))})})),f=typeof a?.workspace_name=="string"?a.workspace_name:typeof a?.name=="string"?a.name:c?.name||i?.workspace.name||g.basename(t$2),y=typeof a?.profile=="string"?a.profile:typeof a?.mode=="string"?a.mode:i?.workspace.profile,m=Array.from(new Set(d.map(k=>k.kind))).sort(),v=Array.from(new Set(d.map(k=>k.category))).sort(),x=Array.from(new Set(d.flatMap(k=>k.runtimeCandidates.length>0?k.runtimeCandidates:[k.runtime]))).sort(),q=Array.from(new Set(d.map(k=>k.framework))).sort(),_=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(k=>P.existsSync(g.join(t$2,k))),J=t(t$2,"workspace.contract.json").map(k=>g.relative(t$2,k).split(g.sep).join("/")).find(k=>P.existsSync(g.join(t$2,k)))??t$1.workspaceContract,D=await P.pathExists(g.join(t$2,J)),X={schemaVersion:br,generatedAt:n.toISOString(),workspace:{name:f,root:t$2,...y?{profile:y}:{},type:c?"rapidkit-workspace":"observed-workspace",...c?{marker:{createdBy:c.createdBy,version:c.version,createdAt:c.createdAt}}:{}},identity:{workspaceType:Fr(d),surfaces:m,categories:v,runtimeFamilies:x,businessCapabilities:Dr(d)},discovery:{observableScanDepth:s},projects:d,policies:{mode:typeof a?.policy_mode=="string"?a.policy_mode:typeof a?.policyMode=="string"?a.policyMode:"warn",source:_??null,exists:!!_},contracts:{workspaceContractPath:J,exists:D,status:D?"known":"missing"},evidence:{doctor:await R(t$2,p.doctor,o),projectDoctor:await R(t$2,t$1.doctorProject,o),doctorRemediationPlan:await R(t$2,t$1.doctorRemediationPlan,o),artifactRemediationPlan:await R(t$2,t$1.artifactRemediationPlan,o),doctorFixResult:await R(t$2,t$1.doctorFixResult,o),analyze:await R(t$2,p.analyze,o),readiness:await R(t$2,p.readiness,o),pipeline:await R(t$2,t$1.pipelineLastRun,o)},summary:{projectCount:d.length,runtimes:x,frameworks:q,firstClassProjects:d.filter(k=>k.supportTier==="first-class").length,extendedProjects:d.filter(k=>k.supportTier==="extended").length,observedProjects:d.filter(k=>k.supportTier==="observed").length}},S=await Et(t$2,X,{contractExists:D,now:n,incrementalGraph:e.incrementalGraph}),E={...X,projectTopology:S,graph:S},O=St(E),T=Or({...E},n),Wt=gt({facts:T,generatedAt:n.toISOString(),now:n});return {...E,facts:T,factFreshness:Wt,validation:O}}async function ro(e){if(e.cache!==true)return {model:await ce(e),cache:"disabled"};let t=g.resolve(e.workspacePath),r=Se(e.observableScanDepth),o=be(),{marker:s,workspaceJson:n,projectPaths:c}=await Ee(t,r),a=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:c,workspaceJson:n,marker:s}),i=await je(t);if(i&&i.cliVersion===o&&i.inputsHash===a&&jt(i.model))return {model:i.model,cache:"hit"};let l=await ce({...e}),[u,p]=await Promise.all([ne(t,c),oe(t)]);return await ae(t,{cliVersion:o,inputsHash:a,generatedAt:(e.now??new Date).toISOString(),model:l,projectSignatures:u,workspaceFileSignatures:p}),{model:l,cache:"miss"}}function Gr(e,t){let r=new Set,o=new Set,s=new Set;for(let[n,c]of Object.entries(t))n in e?e[n]!==c&&r.add(n):o.add(n);for(let n of Object.keys(e))n in t||s.add(n);return {changed:r,added:o,removed:s}}function _r(e={},t={}){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of r)if(e[o]!==t[o])return false;return true}async function no(e){let t=g.resolve(e.workspacePath),r=Se(e.observableScanDepth),o=be(),s=e.now??new Date,{marker:n,workspaceJson:c,projectPaths:a}=await Ee(t,r),i=await je(t),l=async()=>{let S=await ce({...e}),E=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:a,workspaceJson:c,marker:n}),[O,T]=await Promise.all([ne(t,a),oe(t)]);return await ae(t,{cliVersion:o,inputsHash:E,generatedAt:s.toISOString(),model:S,projectSignatures:O,workspaceFileSignatures:T}),{model:S,mode:"full"}},u=i?Pe(i.model):void 0;if(!i||i.cliVersion!==o||!i.projectSignatures||!u||!jt(i.model))return l();let p=await oe(t);if(!_r(i.workspaceFileSignatures,p))return l();let d=await ne(t,a),{changed:f,added:y,removed:m}=Gr(i.projectSignatures,d);if(f.size===0&&y.size===0&&m.size===0)return {model:i.model,mode:"unchanged"};let v=new Set([...f,...y]),x=new Map;for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");!v.has(E)&&!m.has(E)&&x.set(E,S);}let q=new Set,_=false;for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");f.has(E)&&q.add(S.name);}let J=y.size>0||m.size>0,D=await ce({...e,reuseProjectModels:x,incrementalGraph:{previousGraph:u,changedProjectIds:q,structuralChange:J||_}});for(let S of i.model.projects){let E=S.path.split(g.sep).join("/");if(!f.has(E))continue;let O=D.projects.find(T=>T.path.split(g.sep).join("/")===E);if(O&&O.name!==S.name){_=true;break}}if(_)return l();let X=await se({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:a,workspaceJson:c,marker:n});return await ae(t,{cliVersion:o,inputsHash:X,generatedAt:s.toISOString(),model:D,projectSignatures:d,workspaceFileSignatures:p}),{model:D,mode:"incremental"}}async function We(e){try{let{contract:t}=await p$1({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function Et(e,t,r){let o=r.contractExists?await We(e):null;try{return r.incrementalGraph?await pt({workspacePath:e,model:t,contract:o,now:r.now,previousGraph:r.incrementalGraph.previousGraph,changedProjectIds:r.incrementalGraph.changedProjectIds,structuralChange:r.incrementalGraph.structuralChange}):await dt({workspacePath:e,model:t,contract:o,now:r.now})}catch{let s=t.projects.map(n=>({id:n.name,path:n.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:r.now.toISOString(),nodes:s,edges:[],stats:{nodeCount:s.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:s.length,connectedNodeCount:0,density:0,edgeCoverageRatio:s.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:s.length>1?[{code:"graph.inference.failed",severity:"warning",message:"Dependency graph inference failed; model contains projects but no dependency edges.",recommendation:"Run workspace model again after fixing graph inputs, or add workspace contract/manual graph overrides.",nodeIds:s.map(n=>n.id).sort((n,c)=>n.localeCompare(c))}]:void 0}}}async function oo(e,t,r={}){let o=e.contracts.exists?await We(t):null,{buildWorkspaceKnowledgeGraph:s}=await import('./workspace-knowledge-graph-EEOW5VAJ.js'),n=d(e),c=r.refreshKnowledgeGraph?null:await P.readJson(g.join(t,p.knowledgeGraph)).then(p=>p).catch(()=>null),a=await s({workspacePath:t,workspace:{name:e.workspace.name,...e.workspace.profile?{profile:e.workspace.profile}:{}},projects:e.projects.map(p=>({id:p.name,path:p.path,...p.absolutePath?{absolutePath:p.absolutePath}:{},runtime:p.runtime,runtimeCandidates:p.runtimeCandidates,framework:p.framework,kind:p.kind,category:p.category,...p.governance?{governance:p.governance}:{},...p.kit?{kit:p.kit}:{}})),projectTopology:Pe(e)??await Et(t,e,{contractExists:e.contracts.exists,now:new Date(e.generatedAt)}),contract:o,now:new Date(e.generatedAt),source:{kind:"workspace-model",artifact:ie,hashAlgorithm:"sha256",hash:d$1(n)},previousGraph:c}),i$1=[],l=new Map;for(let p of e.projects){let d=vt(t,p);if(!(await P.stat(d).catch(()=>null))?.isDirectory())continue;let y=await P.realpath(d),m=l.get(y);if(m)throw new Error(`Projects ${m} and ${p.name} resolve to the same graph artifact root: ${d}`);l.set(y,p.name),i$1.push({rootPath:d,relativePath:t$1.projectKnowledgeGraphReference,payload:wt(a,p.name)});}let u=await i(t,ie,[{rootPath:t,relativePath:p.knowledgeGraph,payload:a},{rootPath:t,relativePath:ie,payload:n},...i$1]);for(let p$1 of i$1){let d=g.join(p$1.rootPath,p.knowledgeGraph);(await P.readJson(d).catch(()=>null))?.schemaVersion===q$1.knowledgeGraph&&await P.remove(d).catch(()=>{});}return u[1]}export{Qe as a,$r as b,Lr as c,G as d,mt as e,b as f,gt as g,ht as h,kt as i,wr as j,br as k,ie as l,Pe as m,eo as n,to as o,Or as p,ce as q,ro as r,no as s,oo as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-JEI6BTZI.js';import {a}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-JEI6BTZI.js';import {a}from'./chunk-IVYPC36J.js';import {c,e,d}from'./chunk-QYEQVNBF.js';import {d as d$1,b}from'./chunk-W6WRT77T.js';import {g}from'./chunk-3HFFKW4Q.js';import {q as q$1,m}from'./chunk-2LZWBUJD.js';import {p,d as d$2}from'./chunk-UW4SESKD.js';import {g as g$1}from'./chunk-OZXCNVGW.js';import {b as b$1}from'./chunk-K33JJVQZ.js';import {a as a$2}from'./chunk-AFIFZTOY.js';import j from'path';import W from'fs-extra';function X(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function q(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function P(e,n,o){try{if(!await W.pathExists(e))return null;let r=await W.readJson(e);return n?b$1(n,r,e):o&&a$2(r,o,e),r}catch(r){if((n||o)&&await W.pathExists(e))throw r;return null}}function Y(e,n){if(!e)return null;let o=n.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===o||r.relativePath.toLowerCase()===o)??null}function Q(e,n,o){let r=o.trim().toLowerCase(),t=(m(e)?.nodes.map(i=>i.id)??e.projects.map(i=>i.name)).find(i=>i.toLowerCase()===r);if(t)return t;let m$1=e.projects.find(i=>[i.name,i.path,j.basename(i.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(m$1)return m$1.name;let p=Y(n,o);if(p){let i=e.projects.find(u=>u.path===p.relativePath||u.path.endsWith(`/${p.relativePath}`));if(i)return i.name}return o}function U(e,n){if(!e)return [];let o=n.trim().toLowerCase(),r=new Set;for(let d of e.projects){d.contracts.dependsOn?.some(t=>t.toLowerCase()===o)&&r.add(d.slug);for(let t of d.contracts.consumes??[])for(let m of e.projects)m.contracts.publishes?.includes(t)&&m.slug===o&&r.add(d.slug);}return [...r].sort()}function Z(e,n){if(!e)return [];let o=n.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===o&&r.command?.display).map(r=>r.command.display).slice(0,8)}function l(e,n,o){return {id:e,title:n,body:o.trim()}}async function ke(e){let n=j.resolve(e.workspacePath),o=(e.now??new Date).toISOString(),r=e.model??await q$1({workspacePath:n,includeEvidence:true}),d=e.contract;if(d===void 0)try{d=(await p({workspacePath:n})).contract;}catch{d=null;}let t=e.verify;t===void 0&&(t=await P(j.join(n,d$1),d$1));let m$1=e.impact;if(m$1===void 0&&(m$1=await P(j.join(n,g),g)),e.target.kind==="release-blocked"){let s=t?.blockingReasons??[],c=(r.summary?.projectCount??r.projects.length)===0,g=[l("verdict",c?"Workspace scaffold posture":"Release verdict",t?c?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx workspai workspace verify --json --write` first."),l("blockers",c?"Pre-project signals":"Blocking reasons",s.length?s.map(h=>`- ${h}`).join(`
|
|
2
2
|
`):c?"No pre-project signals in the latest verify report.":"No blocking reasons in the latest verify report.")];return t?.resolutionHints?.length&&g.push(l("resolution","Resolution hints",t.resolutionHints.map(h=>`- **${h.blockerId}** (${h.resolutionClass}): ${h.commandRetryHint??h.fixHints[0]?.detail??"See fix hints"}`).join(`
|
|
3
3
|
`))),{schemaVersion:a,generatedAt:o,workspacePath:n,target:e.target,summary:t?c?b(s.length,t.summary.verdict):s.length>0||t.summary.verdict==="blocked"?`Release blocked: ${t.summary.verdict} with ${s.length} blocking reason(s).`:t.summary.verdict==="needs-attention"?"Release needs attention: advisory or incomplete verification evidence remains; no blocking reason was reported.":`Release posture: ${t.summary.verdict}; no blocking reason was reported.`:"Release posture unknown \u2014 verify report missing.",sections:g,releaseVerdict:t?.summary.verdict,evidenceFreshness:t?.freshness.verdict,blocking:!!(t&&(t.summary.verdict==="blocked"||s.length>0)),releaseRisk:t?.impact.risk,blockingReasons:s,resolutionHints:t?.resolutionHints}}if(e.target.kind==="blocker"){let s=e.target,f=t?.resolutionHints?.find(g=>g.blockerId===s.blockerId),c=t?.blockingReasons.find(g=>g.includes(s.blockerId))??t?.blockingReasons[0];return {schemaVersion:a,generatedAt:o,workspacePath:n,target:s,summary:f?`Blocker ${s.blockerId}: ${f.resolutionClass}`:`Blocker ${s.blockerId} (no structured hint)`,sections:[l("reason","Blocking signal",c??"No matching blocking reason in verify."),l("hint","Resolution class",f?`${f.resolutionClass}
|
|
4
4
|
|
|
@@ -10,4 +10,4 @@ ${f.fixHints.map(g=>`- ${g.detail}`).join(`
|
|
|
10
10
|
`):"No transitive impact report."),l("gate","Subgraph gate",y?`Directly changed: ${y.directlyChanged}; transitive dependents: ${y.transitiveDependents}; covered: ${y.covered}; uncovered: ${y.uncovered}; unverifiable: ${y.unverifiable}.`:"No verify subgraph coverage available.")],releaseRisk:m$1?.summary?.risk??t?.impact.risk,blockingReasons:t?.blockingReasons}}let p$1=e.target.project,i=Q(r,d,p$1),u=m(r),k=u?a$1(u,i):{found:false,centrality:null,directDependents:[],transitiveDependents:[]},w=Y(d,p$1),E=U(d,p$1),x=Z(t,p$1),v=r.projects.find(s=>s.name.toLowerCase()===p$1.toLowerCase()),A=[l("overview","Project overview",v?`${v.name} (${v.frameworkDisplayName}, ${v.runtime}) at \`${v.path}\`.`:`Project **${p$1}** ${k.found?"exists in graph":"not found in workspace model"}.`),l("consumers","Consumers / dependents",[`Direct dependents: ${k.directDependents.join(", ")||"none"}`,`Contract consumers: ${E.join(", ")||"none"}`,`Transitive dependents (blast radius): ${k.transitiveDependents.length}`].join(`
|
|
11
11
|
`)),l("contracts","Critical contracts",w?[`Owns: ${w.contracts?.owns?.join(", ")||"none"}`,`Publishes: ${w.contracts.publishes.join(", ")||"none"}`,`Consumes: ${w.contracts.consumes.join(", ")||"none"}`,`APIs: ${w.contracts.apis.map(s=>s.name).join(", ")||"none"}`].join(`
|
|
12
12
|
`):"No workspace.contract.json entry for this project."),l("verification","Required verification",x.length?x.map(s=>`- ${s}`).join(`
|
|
13
|
-
`):"- `npx workspai workspace verify --json`\n- Project test/build via `workspace run` when configured")];k.centrality&&A.push(l("centrality","Graph centrality",`fanIn ${k.centrality.fanIn}, fanOut ${k.centrality.fanOut}, reach ${k.centrality.reach}, hotspot ${k.centrality.isHotspot?"yes":"no"}.`));let I=p$1.trim().toLowerCase(),T=s=>s.project?.name?.toLowerCase()===I||s.target.toLowerCase()===I,S=m$1?.affectedProjects?.find(T)?.risk??m$1?.transitiveImpact?.find(T)?.risk??t?.impact.risk??"unknown";return {schemaVersion:a,generatedAt:o,workspacePath:n,target:e.target,summary:`${p$1}: ${E.length} consumer(s), release risk **${S}**.`,sections:A,releaseRisk:String(S)}}async function he(e,n,o="explain"){let r=q(o);return await
|
|
13
|
+
`):"- `npx workspai workspace verify --json`\n- Project test/build via `workspace run` when configured")];k.centrality&&A.push(l("centrality","Graph centrality",`fanIn ${k.centrality.fanIn}, fanOut ${k.centrality.fanOut}, reach ${k.centrality.reach}, hotspot ${k.centrality.isHotspot?"yes":"no"}.`));let I=p$1.trim().toLowerCase(),T=s=>s.project?.name?.toLowerCase()===I||s.target.toLowerCase()===I,S=m$1?.affectedProjects?.find(T)?.risk??m$1?.transitiveImpact?.find(T)?.risk??t?.impact.risk??"unknown";return {schemaVersion:a,generatedAt:o,workspacePath:n,target:e.target,summary:`${p$1}: ${E.length} consumer(s), release risk **${S}**.`,sections:A,releaseRisk:String(S)}}async function he(e,n,o="explain"){let r=q(o);return await g$1(n,r,d$2(e)),r}export{q as a,ke as b,he as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d,m}from'./chunk-
|
|
1
|
+
import {d,m}from'./chunk-2LZWBUJD.js';import {a,b}from'./chunk-S5KTATOU.js';function u(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,d(n));return s}function w(r){let s=u(r),n=m(r)??{nodes:r.projects.map(t=>({id:t.name,path:t.path})),edges:[]},a$1=a(n),o=new Map;for(let t of n.nodes){let e=s.get(t.id)??d({missing:t.id}),l=[...b(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,f)=>c.localeCompare(f)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:d({own:e,dependencies:l})});}return o}function y(r,s){if(!s||Object.keys(s).length===0)return {verdict:"unknown",baseline:"none",changed:[],added:[],removed:[]};let n=[],a=[];for(let[e,i]of r.entries())e in s?s[e]!==i.transitiveInputsHash&&n.push(e):a.push(e);let o=[];for(let e of Object.keys(s))r.has(e)||o.push(e);return n.sort((e,i)=>e.localeCompare(i)),a.sort((e,i)=>e.localeCompare(i)),o.sort((e,i)=>e.localeCompare(i)),{verdict:n.length>0||a.length>0||o.length>0?"stale":"fresh",baseline:"recorded",changed:n,added:a,removed:o}}function M(r){let s={};for(let[n,a]of [...r.entries()].sort((o,t)=>o[0].localeCompare(t[0])))s[n]=a.transitiveInputsHash;return s}export{u as a,w as b,y as c,M as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {q as q$1,l,m,k as k$1}from'./chunk-2LZWBUJD.js';import {a}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {d as d$1}from'./chunk-UW4SESKD.js';import {g}from'./chunk-OZXCNVGW.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {e,d,b as b$1}from'./chunk-EWZZUQBR.js';import {q,p}from'./chunk-ODK4LCEL.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=q.snapshot,L=q.diff,_=p.snapshot,ae=p.diff,he=q.impact,we=p.impact;function ye(e$1){if(e$1.model.projectTopology||!e$1.model.graph||e$1.modelHash!==e(e$1.model))return null;let t={...e$1.model,projectTopology:e$1.model.graph,graph:e$1.model.graph};return {...e$1,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$1({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 g(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$1({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 g(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 g(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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-GR6442P7.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {
|
|
1
|
+
import {a}from'./chunk-GR6442P7.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {t}from'./chunk-ODK4LCEL.js';import {k as k$1,t as t$1,q as q$1,w}from'./chunk-VQZ5PI5J.js';import z from'crypto';import Y from'os';import l from'path';import {once}from'events';import {createWriteStream,createReadStream}from'fs';import*as Q from'readline';import {Transform,Readable}from'stream';import {pipeline}from'stream/promises';import {lookup}from'dns/promises';import T from'net';import p from'fs-extra';import*as ee from'yauzl';import*as te from'yazl';var qe="workspai-workspace-archive-capabilities-v1",q="workspai-workspace-archive-manifest-v1",k="workspai-workspace-archive-operation-result-v1";var K="contracts/workspace-archive-manifest.v1.json",Z="contracts/workspace-archive-operation-result.v1.json",Ke={archiveCompression:{signature:"--archive-compression <mode>",description:"Archive compression: store (default) or deflate",appliesTo:["export"]},maxDownloadSize:{signature:"--max-download-size <size>",description:"Maximum remote archive download size (secure default: 5gb)",appliesTo:["inspect","verify","doctor","hydrate","import"]},maxExpandedSize:{signature:"--max-expanded-size <size>",description:"Maximum expanded archive payload size (secure default: 20gb)",appliesTo:["inspect","verify","doctor","hydrate","import"]},downloadTimeoutMs:{signature:"--download-timeout-ms <ms>",description:"Remote archive download timeout in milliseconds; 0 disables it",appliesTo:["inspect","verify","doctor","hydrate","import"]},allowPrivateNetwork:{signature:"--allow-private-network",description:"Allow archive downloads from loopback/private networks (unsafe for untrusted input)",appliesTo:["inspect","verify","doctor","hydrate","import"]}};var A=".workspai/archive-manifest.json",R=".rapidkit/archive-manifest.json",de="workspai.workspace.archive",ye=300*1e3,ve=5*1024*1024*1024,we=20*1024*1024*1024,J=2e5,ge=5*1024*1024*1024,ke=1e3,M=5,Ee=64*1024*1024;function Ae(r){let t=r.toLowerCase().split("%")[0];if(T.isIPv4(t)){let e=t.split(".").map(Number);return e[0]===0||e[0]===10||e[0]===127||e[0]===169&&e[1]===254||e[0]===172&&e[1]>=16&&e[1]<=31||e[0]===192&&e[1]===168||e[0]===100&&e[1]>=64&&e[1]<=127||e[0]>=224}return T.isIPv6(t)?t==="::"||t==="::1"||t.startsWith("fc")||t.startsWith("fd")||/^fe[89ab]/.test(t)||t.startsWith("ff")||t.startsWith("::ffff:127.")||t.startsWith("::ffff:10.")||t.startsWith("::ffff:192.168."):true}async function X(r,t){let e=new URL(r);if(e.protocol!=="https:"&&e.protocol!=="http:")throw new Error(`Workspace archive URL protocol is not supported: ${e.protocol}`);if(e.protocol!=="https:"&&!t)throw new Error("Remote workspace archives require HTTPS unless private-network access is explicitly enabled.");if(e.username||e.password)throw new Error("Workspace archive URL must not contain embedded credentials.");if(t)return e;let i=e.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(i==="localhost"||i.endsWith(".localhost"))throw new Error("Workspace archive URL resolves to a private or local network address.");let a=T.isIP(i)?[{address:i}]:await lookup(i,{all:true,verbatim:true});if(a.length===0||a.some(({address:s})=>Ae(s)))throw new Error("Workspace archive URL resolves to a private or local network address.");return e}async function Pe(r,t,e){let i=await X(r,e);for(let a=0;a<=M;a+=1){let s=await fetch(i,{signal:t,redirect:"manual",credentials:"omit"});if(![301,302,303,307,308].includes(s.status))return s;let n=s.headers.get("location");if(await s.body?.cancel(),!n)throw new Error("Workspace archive redirect is missing a Location header.");if(a===M)throw new Error(`Workspace archive download exceeded ${M} redirects.`);i=await X(new URL(n,i).href,e);}throw new Error("Workspace archive redirect policy failed.")}var We=new Set(["__pycache__",".venv","venv","node_modules",".git","dist","build","target",".pytest_cache",".mypy_cache",".ruff_cache","htmlcov",".next",".turbo",".cache"]),be=new Set([".DS_Store","Thumbs.db",".coverage","npm-debug.log","yarn-error.log","pnpm-debug.log","workspace-link.local.json","imported-projects.json","workspace-registry.v1.json"]),Se=[/^\.env$/i,/^\.env\.(?!example$|sample$|template$).+/i,/^.*\.pem$/i,/^.*\.key$/i,/^id_rsa$/i,/^id_ed25519$/i];function _(r){return r.replace(/\\/g,"/")}function re(r){return r.trim().replace(/\.workspai-archive\.zip$/i,"").replace(/\.rapidkit-archive\.zip$/i,"").replace(/\.zip$/i,"").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,64)||"imported-workspace"}function ie(r){let t=_(r).trim();if(!t||t.startsWith("/")||t.startsWith("~")||/^[a-zA-Z]:\//.test(t)||t.includes("\0"))return false;let e=t.split("/").filter(Boolean);return e.length>0&&!e.some(i=>i===".."||i===".")}function ae(r){if(!ie(r))throw new Error(`Archive contains an unsafe path: ${r}`)}function Re(r,t){let e=l.relative(t,r);return e===""||!!e&&!e.startsWith("..")&&!l.isAbsolute(e)}function _e(r,t$1){let e=_(r),i=e.split("/").filter(Boolean);if(i.some((n,o)=>(n===".workspai"||n===".rapidkit")&&["cache","reports"].includes(i[o+1]||""))||i.some(n=>We.has(n)||a(n)))return true;let s=i[i.length-1]||"";return e===t.workspaceContract||e===".rapidkit/workspace.contract.json"||be.has(s)||/\.(?:workspai|rapidkit)-archive\.zip$/i.test(s)||!t$1?.includeEnv&&Se.some(n=>n.test(s))?true:s.endsWith(".pyc")||s.endsWith(".log")}async function Ce(r){for(let t of [l.join(r,".workspai","workspace.contract.json"),l.join(r,".rapidkit","workspace.contract.json")])if(await p.pathExists(t))try{return await p.readJson(t)}catch(e){throw new Error(`Workspace contract could not be inspected safely for archive portability: ${t}: ${e instanceof Error?e.message:String(e)}`)}return null}function xe(r){return (r?.projects??[]).filter(t=>typeof t.externalPath=="string"||typeof t.relativePath=="string"&&t.relativePath.startsWith("external/")).map(t=>({name:t.slug||t.relativePath||"external-project",relationship:["adopted","linked","imported","managed","restored"].includes(String(t.relationship))?t.relationship:"adopted",included:false,requiredAction:"relink"})).sort((t,e)=>t.name.localeCompare(e.name))}function Oe(r){if(r)return {...r,workspace:{...r.workspace},projects:r.projects.filter(t=>typeof t.externalPath!="string"&&!t.relativePath.startsWith("external/")).map(({externalPath:t,...e})=>({...e,modules:[...e.modules],ports:e.ports.map(i=>({...i})),contracts:{owns:[...e.contracts.owns],apis:e.contracts.apis.map(i=>({...i})),publishes:[...e.contracts.publishes],consumes:[...e.contracts.consumes],dependsOn:[...e.contracts.dependsOn],env:[...e.contracts.env]}}))}}async function*se(r,t,e){let i=(await p.readdir(t,{withFileTypes:true})).sort((a,s)=>a.name.localeCompare(s.name));for(let a of i){let s=l.join(t,a.name),n=_(l.relative(r,s));if(!(!n||_e(n,e))){if(a.isDirectory()){yield*se(r,s,e);continue}a.isFile()&&(yield {relativePath:n,fullPath:s});}}}async function ze(r){for(let t of t$1(r,"workspace.json"))try{let e=await p.readJson(t);if(typeof e.workspace_name=="string"&&e.workspace_name.trim())return e.workspace_name.trim();if(typeof e.name=="string"&&e.name.trim())return e.name.trim()}catch{}return l.basename(l.resolve(r))}async function Ne(r){let t=await p.stat(r.fullPath),e=z.createHash("sha256"),i=0;for await(let s of createReadStream(r.fullPath)){let n=Buffer.isBuffer(s)?s:Buffer.from(s);i+=n.length,e.update(n);}let a=await p.stat(r.fullPath);if(t.size!==a.size||t.mtimeMs!==a.mtimeMs||i!==a.size)throw new Error(`Workspace file changed while preparing archive: ${r.relativePath}`);return {...r,size:i,mtimeMs:a.mtimeMs,sha256:e.digest("hex")}}async function E(r,t){r.write(t)||await once(r,"drain");}async function ne(r){await new Promise((t,e)=>{r.once("error",e),r.end(t);});}async function*O(r){let t=Q.createInterface({input:createReadStream(r),crlfDelay:1/0});for await(let e of t){let i=e.trim();i&&(yield JSON.parse(i));}}async function Me(r){let t=createWriteStream(r.manifestPath,{flags:"wx"});try{await E(t,`{
|
|
2
2
|
`);for(let[i,a]of Object.entries(r.manifestBase))await E(t,` ${JSON.stringify(i)}: ${JSON.stringify(a,null,2)},
|
|
3
3
|
`);await E(t,` "files": [
|
|
4
4
|
`);let e=true;for await(let i of O(r.spoolPath)){let{mtimeMs:a,...s}=i;await E(t,`${e?"":`,
|