frontend-project-context 1.3.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +51 -2
  2. package/README.md +156 -40
  3. package/UPGRADING.md +55 -1
  4. package/docs/04-PROGRAM-DESIGN.md +34 -4
  5. package/docs/05-ACCEPTANCE-CONTRACT.md +40 -3
  6. package/docs/08-INSTALLATION-AND-DISTRIBUTION.md +67 -22
  7. package/docs/14-FORMAL-RELEASE-READINESS.md +30 -1
  8. package/docs/18-BRANCH-AWARE-STAGED-CONTEXT-DESIGN.md +2 -2
  9. package/docs/19-POST-1.3.1-AI-TAKEOVER-EVIDENCE-AND-UPGRADE-PLAN.md +579 -0
  10. package/docs/20-PHASE-A-AI-TAKEOVER-AND-HEALTH-CLOSURE-DESIGN.md +535 -0
  11. package/docs/21-PHASE-B-EVIDENCE-FEEDBACK-PROTOCOL-DESIGN.md +347 -0
  12. package/docs/22-PHASE-C-TARGET-UPGRADE-PROTOCOL-DESIGN.md +398 -0
  13. package/docs/23-ADAPTIVE-BOUNDED-TASK-CONTEXT-DESIGN.md +432 -0
  14. package/docs/24-A130-REAL-HOST-TARGET-PROJECT-COMPARISON.md +210 -0
  15. package/docs/25-REAL-PROJECT-SOURCE-OF-TRUTH-MAINTENANCE-DESIGN.md +409 -0
  16. package/docs/26-A130-QUALITY-CLOSURE-AND-ADAPTIVE-DELIVERY-REPAIR-DESIGN.md +609 -0
  17. package/docs/README.md +38 -6
  18. package/docs/USER-AND-AI-OPERATION-MANUAL.md +840 -0
  19. package/examples/README.md +29 -2
  20. package/examples/package.json +6 -2
  21. package/migration-manifest.json +110 -0
  22. package/package.json +3 -2
  23. package/schemas/action-plan.schema.json +31 -3
  24. package/schemas/adaptive-context-bundle.schema.json +70 -0
  25. package/schemas/capabilities.schema.json +64 -18
  26. package/schemas/context-query.schema.json +69 -0
  27. package/schemas/coverage-audit.schema.json +32 -0
  28. package/schemas/evidence-bundle.schema.json +64 -0
  29. package/schemas/evidence-input.schema.json +82 -0
  30. package/schemas/host-promotion-evidence.schema.json +33 -0
  31. package/schemas/migration-manifest.schema.json +29 -0
  32. package/schemas/migration-plan.schema.json +32 -0
  33. package/schemas/project-status.schema.json +75 -0
  34. package/schemas/projection-lock.schema.json +48 -0
  35. package/schemas/review-bundle.schema.json +3 -3
  36. package/schemas/routing-index.schema.json +58 -0
  37. package/schemas/truth-reconciliation-input.schema.json +60 -0
  38. package/schemas/truth-reconciliation-review-bundle.schema.json +155 -0
  39. package/schemas/upgrade-assessment.schema.json +48 -0
  40. package/schemas/upgrade-result-bundle.schema.json +35 -0
  41. package/src/project-context/a130-evaluation.mjs +91 -0
  42. package/src/project-context/adaptive-context-schema.mjs +392 -0
  43. package/src/project-context/adaptive-context.mjs +547 -0
  44. package/src/project-context/ai-entry.mjs +320 -0
  45. package/src/project-context/assist.mjs +4 -2
  46. package/src/project-context/capabilities.mjs +62 -17
  47. package/src/project-context/checker.mjs +24 -6
  48. package/src/project-context/cli.mjs +113 -3
  49. package/src/project-context/contract-schema.mjs +30 -16
  50. package/src/project-context/dashboard-model.mjs +4 -4
  51. package/src/project-context/dashboard-renderer.mjs +3 -3
  52. package/src/project-context/discovery.mjs +13 -8
  53. package/src/project-context/evidence-schema.mjs +209 -0
  54. package/src/project-context/evidence.mjs +99 -0
  55. package/src/project-context/exchange-schema.mjs +23 -12
  56. package/src/project-context/exchange.mjs +26 -4
  57. package/src/project-context/maintenance.mjs +4 -4
  58. package/src/project-context/migration-manifest.mjs +168 -0
  59. package/src/project-context/project-status.mjs +157 -0
  60. package/src/project-context/projection-store.mjs +8 -1
  61. package/src/project-context/renderer.mjs +75 -1
  62. package/src/project-context/source-reader.mjs +63 -30
  63. package/src/project-context/task-context.mjs +14 -2
  64. package/src/project-context/truth-reconciliation-schema.mjs +488 -0
  65. package/src/project-context/truth-reconciliation.mjs +543 -0
  66. package/src/project-context/upgrade-schema.mjs +219 -0
  67. package/src/project-context/upgrade.mjs +494 -0
@@ -8,6 +8,15 @@
8
8
  npm run context:setup -- --id my-project --name "My Project" --write --json
9
9
  ```
10
10
 
11
+ 为完全新窗口写入稳定入口并查询治理健康:
12
+
13
+ ```bash
14
+ npm run context:entry -- --write --json
15
+ npm run context:status -- --json
16
+ ```
17
+
18
+ 入口只拥有 `AGENTS.md` 标记区域;区域外人工内容可继续维护。首次写入会把 projection lock 从 schema 1 延迟升级为 schema 2,回退约束见根目录 `migration-manifest.json`。
19
+
11
20
  日常维护时生成只读变化工作单元:
12
21
 
13
22
  ```bash
@@ -24,14 +33,32 @@ npm run context:preflight -- --plan .project-context/action-plan.json --json
24
33
  采用分阶段上下文协议时,宿主必须把每份前序 Stage Receipt 与生成该 receipt 的 Stage Context Bundle 成对传入:
25
34
 
26
35
  ```bash
27
- npx project-context stage-context --project . --plan task-context-plan.json --stage stage-render \
36
+ npm exec --offline -- project-context stage-context --project . --plan task-context-plan.json --stage stage-render \
28
37
  --receipt stage-understand.receipt.json --receipt-bundle stage-understand.bundle.json --json
29
- npx project-context integration-review --project . --plan task-context-plan.json \
38
+ npm exec --offline -- project-context integration-review --project . --plan task-context-plan.json \
30
39
  --receipt stage-understand.receipt.json --receipt-bundle stage-understand.bundle.json --json
31
40
  ```
32
41
 
33
42
  两条命令都会重建 receipt 的输入 Bundle;缺失、重复、错配、篡改、过期 baseline、blocked bundle 或不完整依赖链均失败封闭,且不会创建 task store、读取 Git 或执行任务。
34
43
 
44
+ 如需把一次已经脱敏的目标项目观察交给人审查,先按 Evidence Input schema 1 准备项目内 JSON,再运行:
45
+
46
+ ```bash
47
+ npm run context:evidence -- --input evidence-input.json --json
48
+ ```
49
+
50
+ 输出只到 stdout,永远标记 `human-review-required`,不会保存或上传。人工仍需检查两个自由文本 summary,再决定是否转交。
51
+
52
+ Host 在产品边界外把依赖和 lockfile 固定到精确目标版本后,可生成短生命周期 assessment、单步 plan,并先 preview:
53
+
54
+ ```bash
55
+ npm run context:upgrade-check -- --from-version 1.5.0 --json
56
+ npm exec --offline -- project-context upgrade-plan --project . --assessment .project-context/upgrade-assessment.json --json
57
+ npm exec --offline -- project-context upgrade-apply --project . --plan .project-context/migration-plan.json --json
58
+ ```
59
+
60
+ 只有人审查精确 plan 后才可为最后一条命令增加 `--write`。每次只执行一个产品自有迁移单元;包管理器、Git、项目测试、独立新窗口复核和临时工件清理由 Host 负责。
61
+
35
62
  团队和 CI 的只读 Gate:
36
63
 
37
64
  ```bash
@@ -7,9 +7,13 @@
7
7
  "context:dashboard": "project-context dashboard --project .",
8
8
  "context:sync": "project-context sync --project .",
9
9
  "context:capabilities": "project-context capabilities --project .",
10
- "context:preflight": "project-context preflight --project ."
10
+ "context:evidence": "project-context evidence --project .",
11
+ "context:status": "project-context status --project .",
12
+ "context:entry": "project-context publish-entry --project . --output AGENTS.md",
13
+ "context:preflight": "project-context preflight --project .",
14
+ "context:upgrade-check": "project-context upgrade-check --project ."
11
15
  },
12
16
  "devDependencies": {
13
- "frontend-project-context": "1.3.1"
17
+ "frontend-project-context": "1.7.0"
14
18
  }
15
19
  }
@@ -0,0 +1,110 @@
1
+ {
2
+ "acceptanceCommands": ["npm run check", "project-context status --project . --json"],
3
+ "builtInMigrations": [
4
+ {
5
+ "id": "upgrade.republish-ai-entry.v1",
6
+ "input": {"beforeDigestRequired": true, "schemaVersions": [1, 2]},
7
+ "kind": "republish-ai-entry",
8
+ "reverseMigrationId": null,
9
+ "rollbackClass": "forward-only",
10
+ "targetType": "ai-entry",
11
+ "writes": true
12
+ },
13
+ {
14
+ "id": "upgrade.republish-projection.v1",
15
+ "input": {"beforeDigestRequired": true, "schemaVersions": [1, 2]},
16
+ "kind": "republish-projection",
17
+ "reverseMigrationId": null,
18
+ "rollbackClass": "forward-only",
19
+ "targetType": "projection",
20
+ "writes": true
21
+ }
22
+ ],
23
+ "consumerChanges": {
24
+ "actionPlan": {"reason": "Action Plan schema 1 and 2 readers remain compatible; writers remain schema 2.", "state": "preserve"},
25
+ "adaptiveContextBundle": {"reason": "Schema 1 Adaptive Context Bundles lack task lineage and strict withheld-delivery semantics; regenerate as schema 2.", "state": "regenerate"},
26
+ "capabilities": {"reason": "Consumers must branch on capabilities schema 7 and exchange protocol 7.", "state": "regenerate"},
27
+ "contextQuery": {"reason": "Context Query schema 1 is short-lived and must use current snapshots.", "state": "regenerate"},
28
+ "coverageAudit": {"reason": "Coverage Audit schema 1 is derived from the current Contract and filesystem evidence.", "state": "regenerate"},
29
+ "evidenceBundle": {"reason": "Evidence Bundle schema 1 remains readable and separate from upgrade results.", "state": "preserve"},
30
+ "evidenceInput": {"reason": "Evidence Input schema 1 remains readable and is never rewritten by upgrade.", "state": "preserve"},
31
+ "exchange": {"reason": "Exchange protocol capability metadata changes to version 7.", "state": "regenerate"},
32
+ "hostPromotionEvidence": {"reason": "Host Promotion Evidence is short-lived and remains bound to exact code, artifact, and Project Context snapshots.", "state": "regenerate"},
33
+ "integrationReviewBundle": {"reason": "Short-lived integration review bundles must be regenerated against current baselines.", "state": "regenerate"},
34
+ "reviewBundle": {"reason": "Review Bundle schema 2 remains readable but short-lived reviews must be regenerated when their baselines change.", "state": "regenerate"},
35
+ "routingIndex": {"reason": "Routing Index schema 1 is disposable derived data and must be rebuilt from the current Contract.", "state": "invalidate"},
36
+ "stageContextBundle": {"reason": "Short-lived stage context bundles must be regenerated against current receipts.", "state": "regenerate"},
37
+ "stageReceipt": {"reason": "Existing receipts remain evidence but do not grant next-stage or upgrade authority.", "state": "preserve"},
38
+ "taskContextPlan": {"reason": "Short-lived task plans must be regenerated when their project baselines change.", "state": "regenerate"}
39
+ ,"truthReconciliationInput": {"reason": "Schema 1 inputs lack previous-review-bound resolution attempts; regenerate as schema 2 from the current baseline.", "state": "regenerate"}
40
+ ,"truthReconciliationReviewBundle": {"reason": "Schema 1 reviews lack finding digests and machine-verifiable resolution outcomes; recompute as schema 2.", "state": "regenerate"}
41
+ },
42
+ "externalEffects": {"automaticUpgrade": false, "businessCode": false, "git": false, "network": false, "packageManager": false, "projectTests": false},
43
+ "manifestDigest": "sha256:34b1b611ebf31471f2e136eb3f84ad627df612998d0358654e7cdde4713de777",
44
+ "package": {"name": "frontend-project-context", "version": "1.7.0"},
45
+ "paths": [
46
+ {
47
+ "acceptance": ["project-context-clean", "target-renderers-current"],
48
+ "classification": "package-only",
49
+ "fromVersion": "1.3.1",
50
+ "migrationIds": ["upgrade.republish-ai-entry.v1", "upgrade.republish-projection.v1"],
51
+ "requiresHumanReview": false,
52
+ "rollbackClass": "package-only"
53
+ },
54
+ {
55
+ "acceptance": ["project-context-clean", "target-renderers-current"],
56
+ "classification": "package-only",
57
+ "fromVersion": "1.4.0",
58
+ "migrationIds": ["upgrade.republish-ai-entry.v1", "upgrade.republish-projection.v1"],
59
+ "requiresHumanReview": false,
60
+ "rollbackClass": "package-only"
61
+ },
62
+ {
63
+ "acceptance": ["project-context-clean", "target-renderers-current"],
64
+ "classification": "package-only",
65
+ "fromVersion": "1.5.0",
66
+ "migrationIds": ["upgrade.republish-ai-entry.v1", "upgrade.republish-projection.v1"],
67
+ "requiresHumanReview": false,
68
+ "rollbackClass": "package-only"
69
+ },
70
+ {
71
+ "acceptance": ["project-context-clean", "target-renderers-current"],
72
+ "classification": "package-only",
73
+ "fromVersion": "1.6.0",
74
+ "migrationIds": ["upgrade.republish-ai-entry.v1"],
75
+ "requiresHumanReview": false,
76
+ "rollbackClass": "package-only"
77
+ }
78
+ ],
79
+ "protocols": {
80
+ "actionPlan": {"readable": [1, 2], "written": 2},
81
+ "adaptiveContextBundle": {"readable": [2], "written": 2},
82
+ "contextQuery": {"readable": [2], "written": 2},
83
+ "coverageAudit": {"readable": [1], "written": 1},
84
+ "evidenceBundle": {"readable": [1], "written": 1},
85
+ "evidenceInput": {"readable": [1], "written": 1},
86
+ "exchange": {"readable": [4, 5, 6, 7], "written": 7},
87
+ "hostPromotionEvidence": {"readable": [1], "written": 1},
88
+ "integrationReviewBundle": {"readable": [1], "written": 1},
89
+ "reviewBundle": {"readable": [1, 2], "written": 2},
90
+ "routingIndex": {"readable": [1, 2], "written": 2},
91
+ "stageContextBundle": {"readable": [1], "written": 1},
92
+ "stageReceipt": {"readable": [1], "written": 1},
93
+ "taskContextPlan": {"readable": [1], "written": 1},
94
+ "truthReconciliationInput": {"readable": [2], "written": 2},
95
+ "truthReconciliationReviewBundle": {"readable": [2], "written": 2}
96
+ },
97
+ "renderers": {
98
+ "aiEntry": {"readable": [1, 2, 3], "written": 3},
99
+ "projection": {"readable": [1, 2, 3], "written": 3}
100
+ },
101
+ "rollback": {"automatic": false, "defaultClass": "package-only", "externalRestoreRequired": true},
102
+ "schemaVersion": 2,
103
+ "stores": {
104
+ "contract": {"readable": [1, 2], "written": [1, 2]},
105
+ "projectionLock": {"readable": [1, 2], "written": [1, 2]},
106
+ "proposal": {"readable": [1], "written": [1]},
107
+ "sourceLock": {"readable": [1], "written": [1]}
108
+ },
109
+ "upgradeFrom": ["1.3.1", "1.4.0", "1.5.0", "1.6.0"]
110
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-project-context",
3
- "version": "1.3.1",
3
+ "version": "1.7.0",
4
4
  "description": "Govern, compile, and verify project-local context for AI coding tools.",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -16,6 +16,7 @@
16
16
  "schemas/",
17
17
  "docs/",
18
18
  "examples/",
19
+ "migration-manifest.json",
19
20
  "CHANGELOG.md",
20
21
  "UPGRADING.md",
21
22
  "LICENSE",
@@ -26,7 +27,7 @@
26
27
  },
27
28
  "scripts": {
28
29
  "check": "node --check bin/project-context.mjs && npm test",
29
- "test": "node --test test/project-context/acceptance.test.mjs test/project-context/assist.test.mjs test/project-context/cli.test.mjs test/project-context/dashboard.test.mjs test/project-context/exchange.test.mjs test/project-context/maintenance.test.mjs test/project-context/source-lifecycle.test.mjs test/project-context/task-context.test.mjs test/release/acceptance.test.mjs",
30
+ "test": "node --test test/project-context/acceptance.test.mjs test/project-context/adaptive-context.test.mjs test/project-context/adaptive-delivery-v2.test.mjs test/project-context/assist.test.mjs test/project-context/cli.test.mjs test/project-context/dashboard.test.mjs test/project-context/evidence.test.mjs test/project-context/exchange.test.mjs test/project-context/maintenance.test.mjs test/project-context/source-lifecycle.test.mjs test/project-context/task-context.test.mjs test/project-context/takeover.test.mjs test/project-context/truth-reconciliation.test.mjs test/project-context/upgrade.test.mjs test/release/acceptance.test.mjs",
30
31
  "prepack": "npm run check"
31
32
  },
32
33
  "engines": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:frontend-project-context:schema:action-plan:1",
3
+ "$id": "urn:frontend-project-context:schema:action-plan:2",
4
4
  "title": "Frontend Project Context Action Plan",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "required": ["schemaVersion", "projectId", "baselines", "actions"],
8
8
  "properties": {
9
- "schemaVersion": { "const": 1 },
9
+ "schemaVersion": { "enum": [1, 2] },
10
10
  "projectId": { "$ref": "#/$defs/id" },
11
11
  "baselines": { "$ref": "#/$defs/baselines" },
12
12
  "actions": {
@@ -21,7 +21,9 @@
21
21
  { "$ref": "#/$defs/deprecateItem" },
22
22
  { "$ref": "#/$defs/deprecateSource" },
23
23
  { "$ref": "#/$defs/requestItemApproval" },
24
- { "$ref": "#/$defs/publishProjection" }
24
+ { "$ref": "#/$defs/publishProjection" },
25
+ { "$ref": "#/$defs/publishAiEntry" },
26
+ { "$ref": "#/$defs/removeAiEntry" }
25
27
  ]
26
28
  }
27
29
  }
@@ -226,6 +228,32 @@
226
228
  }
227
229
  }
228
230
  },
231
+ "entryActionInput": {
232
+ "type": "object",
233
+ "additionalProperties": false,
234
+ "required": ["output"],
235
+ "properties": { "output": { "$ref": "#/$defs/path" } }
236
+ },
237
+ "publishAiEntry": {
238
+ "type": "object",
239
+ "additionalProperties": false,
240
+ "required": ["id", "kind", "input"],
241
+ "properties": {
242
+ "id": { "$ref": "#/$defs/id" },
243
+ "kind": { "const": "publish-ai-entry" },
244
+ "input": { "$ref": "#/$defs/entryActionInput" }
245
+ }
246
+ },
247
+ "removeAiEntry": {
248
+ "type": "object",
249
+ "additionalProperties": false,
250
+ "required": ["id", "kind", "input"],
251
+ "properties": {
252
+ "id": { "$ref": "#/$defs/id" },
253
+ "kind": { "const": "remove-ai-entry" },
254
+ "input": { "$ref": "#/$defs/entryActionInput" }
255
+ }
256
+ },
229
257
  "publishProjection": {
230
258
  "type": "object",
231
259
  "additionalProperties": false,
@@ -0,0 +1,70 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:adaptive-context-bundle:2",
4
+ "title": "Frontend Project Context Adaptive Context Bundle",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "project", "task", "queryDigest", "taskDigest", "level", "expansionDepth", "snapshots", "routing", "guarantees", "globalHealth", "taskHealth", "targetStates", "hydratedItems", "retainedItemIds", "deferredItems", "sources", "evidenceEdges", "readTargets", "findings", "excluded", "metrics", "budget", "delivery", "bundleDigest"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 2 },
10
+ "kind": { "const": "adaptive-context-bundle" },
11
+ "project": { "type": "object", "additionalProperties": false, "required": ["id", "name"], "properties": { "id": { "type": "string" }, "name": { "type": "string" } } },
12
+ "task": { "$ref": "context-query.schema.json#/properties/task" },
13
+ "queryDigest": { "$ref": "#/$defs/digest" },
14
+ "taskDigest": { "$ref": "#/$defs/digest" },
15
+ "previousBundleDigest": { "$ref": "#/$defs/digest" },
16
+ "level": { "enum": ["initial", "expanded", "complete"] },
17
+ "expansionDepth": { "type": "integer", "minimum": 0, "maximum": 1 },
18
+ "snapshots": { "$ref": "context-query.schema.json#/$defs/snapshots" },
19
+ "routing": { "type": "object", "additionalProperties": false, "required": ["indexDigest", "indexState"], "properties": { "indexDigest": { "$ref": "#/$defs/digest" }, "indexState": { "enum": ["current", "invalid-rebuilt-in-memory", "stale-rebuilt-in-memory", "missing-rebuilt-in-memory"] }, "rejectedDigest": { "$ref": "#/$defs/digest" } } },
20
+ "guarantees": { "type": "object", "additionalProperties": false, "required": ["registrationCoverage", "mandatoryCoverage", "declaredDependencyCoverage", "retrievalStatus", "semanticCompleteness", "freshness"], "properties": { "registrationCoverage": { "type": "string" }, "mandatoryCoverage": { "enum": ["complete", "blocked"] }, "declaredDependencyCoverage": { "enum": ["complete", "missing", "not-declared"] }, "retrievalStatus": { "enum": ["matched", "no-candidate", "ambiguous", "complete"] }, "semanticCompleteness": { "const": "not-claimed" }, "freshness": { "enum": ["strict-current", "snapshot-and-signal-bound"] } } },
21
+ "globalHealth": { "enum": ["clean", "attention", "conflict", "not-checked", "snapshot-stale"] },
22
+ "taskHealth": { "enum": ["ready", "needs-expansion", "blocked"] },
23
+ "targetStates": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["path", "state"], "properties": { "path": { "type": "string" }, "state": { "enum": ["existing", "prospective-or-deleted"] } } } },
24
+ "hydratedItems": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["id", "kind", "subject", "value", "statement", "scope", "sourceIds", "overrides", "selectionReasons", "itemDigest"], "properties": { "id": { "$ref": "#/$defs/id" }, "kind": { "enum": ["fact", "policy", "reference", "validation-description"] }, "subject": { "$ref": "#/$defs/id" }, "value": {}, "statement": { "type": "string", "minLength": 1 }, "scope": { "$ref": "#/$defs/scope" }, "sourceIds": { "$ref": "#/$defs/ids" }, "overrides": { "$ref": "#/$defs/ids" }, "verification": {}, "selectionReasons": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }, "itemDigest": { "$ref": "#/$defs/digest" } } } },
25
+ "retainedItemIds": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
26
+ "deferredItems": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["id", "kind", "subject", "scope", "sourceIds", "itemDigest", "reason"], "properties": { "id": { "$ref": "#/$defs/id" }, "kind": { "enum": ["fact", "policy", "reference", "validation-description"] }, "subject": { "$ref": "#/$defs/id" }, "scope": { "$ref": "#/$defs/scope" }, "sourceIds": { "$ref": "#/$defs/ids" }, "itemDigest": { "$ref": "#/$defs/digest" }, "reason": { "const": "applicable-not-selected" } } } },
27
+ "sources": { "type": "array", "items": { "$ref": "#/$defs/sourceEvidence" } },
28
+ "evidenceEdges": { "type": "array", "items": { "type": "object", "additionalProperties": false, "required": ["itemId", "sourceId"], "properties": { "itemId": { "type": "string" }, "sourceId": { "type": "string" } } } },
29
+ "readTargets": { "type": "array", "items": { "$ref": "#/$defs/readTarget" } },
30
+ "findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } },
31
+ "excluded": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
32
+ "metrics": { "type": "object", "additionalProperties": false, "required": ["sourceDigestReads", "sourceBodyReads", "sourceIdentityReads", "hydratedItemCount", "retainedItemCount", "deferredItemCount", "hostToolCalls"], "properties": { "sourceDigestReads": { "type": "integer" }, "sourceBodyReads": { "type": "integer" }, "sourceIdentityReads": { "type": "integer" }, "hydratedItemCount": { "type": "integer" }, "retainedItemCount": { "type": "integer" }, "deferredItemCount": { "type": "integer" }, "hostToolCalls": { "const": 1 } } },
33
+ "budget": { "type": "object", "additionalProperties": false, "required": ["unit", "audit", "delivery", "readTargets"], "properties": { "unit": { "const": "canonical-utf8-bytes" }, "audit": { "$ref": "#/$defs/auditBudget" }, "delivery": { "$ref": "#/$defs/deliveryBudget" }, "readTargets": { "$ref": "#/$defs/readBudget" } } },
34
+ "delivery": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["status", "format", "mode", "itemIds", "contentDigest", "utf8Bytes"],
38
+ "properties": {
39
+ "status": { "enum": ["ready", "withheld"] },
40
+ "format": { "const": "project-context-markdown" },
41
+ "mode": { "type": ["string", "null"], "enum": ["adaptive", "complete", null] },
42
+ "itemIds": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
43
+ "contentDigest": { "oneOf": [{ "$ref": "#/$defs/digest" }, { "type": "null" }] },
44
+ "utf8Bytes": { "type": "integer", "minimum": 0 }
45
+ }
46
+ },
47
+ "bundleDigest": { "$ref": "#/$defs/digest" }
48
+ },
49
+ "$defs": {
50
+ "id": { "type": "string", "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$" },
51
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
52
+ "nullableDigest": { "oneOf": [{ "$ref": "#/$defs/digest" }, { "type": "null" }] },
53
+ "ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/id" } },
54
+ "paths": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
55
+ "scope": { "oneOf": [
56
+ { "type": "object", "additionalProperties": false, "required": ["kind"], "properties": { "kind": { "const": "project" } } },
57
+ { "type": "object", "additionalProperties": false, "required": ["kind", "path"], "properties": { "kind": { "enum": ["path-prefix", "file"] }, "path": { "type": "string", "minLength": 1 } } }
58
+ ] },
59
+ "locator": { "oneOf": [
60
+ { "type": "object", "additionalProperties": false, "required": ["path"], "properties": { "path": { "type": "string", "minLength": 1 }, "pointer": { "type": "string" } } },
61
+ { "type": "object", "additionalProperties": false, "required": ["reference"], "properties": { "reference": { "type": "string", "minLength": 1 } } }
62
+ ] },
63
+ "sourceEvidence": { "type": "object", "additionalProperties": false, "required": ["id", "kind", "locator", "sourceDigest", "freshness"], "properties": { "id": { "$ref": "#/$defs/id" }, "kind": { "type": "string", "minLength": 1 }, "locator": { "$ref": "#/$defs/locator" }, "sourceDigest": { "$ref": "#/$defs/digest" }, "freshness": { "enum": ["current", "drifted", "unreadable", "unverifiable-non-local"] }, "expectedDigest": { "$ref": "#/$defs/nullableDigest" }, "actualDigest": { "$ref": "#/$defs/nullableDigest" } } },
64
+ "readTarget": { "type": "object", "additionalProperties": false, "required": ["path", "reason"], "properties": { "path": { "type": "string", "minLength": 1 }, "reason": { "enum": ["task-target", "host-changed-path-signal", "contract-source"] }, "sourceId": { "$ref": "#/$defs/id" } } },
65
+ "finding": { "type": "object", "additionalProperties": false, "required": ["code", "severity"], "properties": { "code": { "type": "string", "minLength": 1 }, "severity": { "enum": ["attention", "needs-expansion", "blocked"] }, "itemId": { "$ref": "#/$defs/id" }, "requiredItemId": { "$ref": "#/$defs/id" }, "sourceId": { "$ref": "#/$defs/id" }, "subject": { "$ref": "#/$defs/id" }, "itemIds": { "$ref": "#/$defs/ids" }, "path": { "type": "string", "minLength": 1 }, "paths": { "$ref": "#/$defs/paths" }, "expected": {}, "actual": {}, "expectedDigest": { "$ref": "#/$defs/nullableDigest" }, "actualDigest": { "$ref": "#/$defs/nullableDigest" }, "reason": { "type": "string", "minLength": 1 }, "state": { "type": "string", "minLength": 1 }, "target": { "type": "integer", "minimum": 0 }, "limit": { "type": "integer", "minimum": 0 }, "required": { "type": "integer", "minimum": 0 }, "conflicts": { "type": "array" }, "projectFinding": {} } },
66
+ "auditBudget": { "type": "object", "additionalProperties": false, "required": ["targetUtf8Bytes", "maxUtf8Bytes", "usedUtf8Bytes"], "properties": { "targetUtf8Bytes": { "type": "integer", "minimum": 1 }, "maxUtf8Bytes": { "type": "integer", "minimum": 1 }, "usedUtf8Bytes": { "type": "integer", "minimum": 1 } } },
67
+ "deliveryBudget": { "type": "object", "additionalProperties": false, "required": ["completeBelowUtf8Bytes", "maxUtf8Bytes", "usedUtf8Bytes"], "properties": { "completeBelowUtf8Bytes": { "type": "integer", "minimum": 1 }, "maxUtf8Bytes": { "type": "integer", "minimum": 1 }, "usedUtf8Bytes": { "type": "integer", "minimum": 0 } } },
68
+ "readBudget": { "type": "object", "additionalProperties": false, "required": ["target", "max", "count"], "properties": { "target": { "type": "integer", "minimum": 1 }, "max": { "type": "integer", "minimum": 1 }, "count": { "type": "integer", "minimum": 0 } } }
69
+ }
70
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:frontend-project-context:schema:capabilities:1",
3
+ "$id": "urn:frontend-project-context:schema:capabilities:7",
4
4
  "title": "Frontend Project Context Capabilities",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
@@ -18,58 +18,92 @@
18
18
  "boundaries"
19
19
  ],
20
20
  "properties": {
21
- "schemaVersion": { "const": 1 },
21
+ "schemaVersion": { "const": 7 },
22
22
  "package": {
23
23
  "type": "object",
24
24
  "additionalProperties": false,
25
25
  "required": ["name", "version"],
26
26
  "properties": {
27
27
  "name": { "const": "frontend-project-context" },
28
- "version": { "type": "string" }
28
+ "version": { "const": "1.7.0" }
29
29
  }
30
30
  },
31
- "exchangeProtocolVersion": { "const": 1 },
31
+ "exchangeProtocolVersion": { "const": 7 },
32
32
  "schemas": {
33
33
  "type": "object",
34
34
  "additionalProperties": false,
35
35
  "required": [
36
36
  "actionPlan",
37
+ "adaptiveContextBundle",
37
38
  "assistBundle",
38
39
  "capabilities",
39
40
  "contract",
41
+ "contextQuery",
42
+ "coverageAudit",
40
43
  "dashboardViewModel",
44
+ "evidenceBundle",
45
+ "evidenceInput",
46
+ "hostPromotionEvidence",
41
47
  "integrationReviewBundle",
42
48
  "projectionLock",
49
+ "projectionLockReadable",
50
+ "projectionLockWritten",
43
51
  "projectionRenderer",
44
52
  "proposal",
53
+ "projectStatus",
54
+ "aiEntryRenderer",
55
+ "migrationManifest",
56
+ "migrationPlan",
45
57
  "reviewBundle",
58
+ "routingIndex",
46
59
  "sourceLock",
47
60
  "stageContextBundle",
48
61
  "stageReceipt",
49
- "taskContextPlan"
62
+ "taskContextPlan",
63
+ "truthReconciliationInput",
64
+ "truthReconciliationReviewBundle",
65
+ "upgradeAssessment",
66
+ "upgradeResultBundle"
50
67
  ],
51
68
  "properties": {
52
- "actionPlan": { "const": 1 },
69
+ "actionPlan": { "const": 2 },
70
+ "adaptiveContextBundle": { "const": 2 },
53
71
  "assistBundle": { "const": 1 },
54
- "capabilities": { "const": 1 },
55
- "contract": { "type": "integer" },
72
+ "capabilities": { "const": 7 },
73
+ "contract": { "const": 2 },
74
+ "contextQuery": { "const": 2 },
75
+ "coverageAudit": { "const": 1 },
56
76
  "dashboardViewModel": { "type": "integer" },
77
+ "evidenceBundle": { "const": 1 },
78
+ "evidenceInput": { "const": 1 },
79
+ "hostPromotionEvidence": { "const": 1 },
57
80
  "integrationReviewBundle": { "const": 1 },
58
- "projectionLock": { "type": "integer" },
81
+ "projectionLock": { "const": 2 },
82
+ "projectionLockReadable": { "const": [1, 2] },
83
+ "projectionLockWritten": { "enum": [1, 2] },
59
84
  "projectionRenderer": { "type": "integer" },
60
- "proposal": { "type": "integer" },
61
- "reviewBundle": { "const": 1 },
62
- "sourceLock": { "type": "integer" },
85
+ "proposal": { "const": 1 },
86
+ "projectStatus": { "const": 1 },
87
+ "aiEntryRenderer": { "const": 3 },
88
+ "migrationManifest": { "const": 2 },
89
+ "migrationPlan": { "const": 1 },
90
+ "reviewBundle": { "const": 2 },
91
+ "routingIndex": { "const": 2 },
92
+ "sourceLock": { "const": 1 },
63
93
  "stageContextBundle": { "const": 1 },
64
94
  "stageReceipt": { "const": 1 },
65
- "taskContextPlan": { "const": 1 }
95
+ "taskContextPlan": { "const": 1 },
96
+ "truthReconciliationInput": { "const": 2 },
97
+ "truthReconciliationReviewBundle": { "const": 2 },
98
+ "upgradeAssessment": { "const": 1 },
99
+ "upgradeResultBundle": { "const": 1 }
66
100
  }
67
101
  },
68
- "commands": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string" } },
102
+ "commands": { "type": "array", "minItems": 1, "uniqueItems": true, "allOf": [{"contains": {"const": "upgrade-check"}}, {"contains": {"const": "upgrade-plan"}}, {"contains": {"const": "upgrade-apply"}}], "items": { "type": "string" } },
69
103
  "actionKinds": {
70
104
  "type": "array",
71
- "minItems": 8,
72
- "maxItems": 8,
105
+ "minItems": 10,
106
+ "maxItems": 10,
73
107
  "uniqueItems": true,
74
108
  "items": {
75
109
  "enum": [
@@ -77,8 +111,10 @@
77
111
  "deprecate-item",
78
112
  "deprecate-source",
79
113
  "propose-item",
114
+ "publish-ai-entry",
80
115
  "publish-projection",
81
116
  "register-source",
117
+ "remove-ai-entry",
82
118
  "request-item-approval",
83
119
  "revise-item"
84
120
  ]
@@ -125,7 +161,12 @@
125
161
  "stagePathBodyReads",
126
162
  "applyPlan",
127
163
  "scheduler",
128
- "daemon"
164
+ "daemon",
165
+ "telemetry",
166
+ "selfUpdate",
167
+ "automaticEvidenceUpload",
168
+ "packageManager",
169
+ "automaticUpgrade"
129
170
  ],
130
171
  "properties": {
131
172
  "provider": { "const": false },
@@ -139,7 +180,12 @@
139
180
  "stagePathBodyReads": { "const": false },
140
181
  "applyPlan": { "const": false },
141
182
  "scheduler": { "const": false },
142
- "daemon": { "const": false }
183
+ "daemon": { "const": false },
184
+ "telemetry": { "const": false },
185
+ "selfUpdate": { "const": false },
186
+ "automaticEvidenceUpload": { "const": false },
187
+ "packageManager": { "const": false },
188
+ "automaticUpgrade": { "const": false }
143
189
  }
144
190
  }
145
191
  }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:context-query:2",
4
+ "title": "Frontend Project Context Query",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "projectId", "snapshots", "task", "level", "freshness", "budget", "expansion"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 2 },
10
+ "kind": { "const": "context-query" },
11
+ "projectId": { "$ref": "#/$defs/id" },
12
+ "snapshots": { "$ref": "#/$defs/snapshots" },
13
+ "task": {
14
+ "type": "object", "additionalProperties": false,
15
+ "required": ["text", "paths", "topics", "itemIds", "changedPaths"],
16
+ "properties": {
17
+ "text": { "type": "string", "minLength": 1 },
18
+ "paths": { "$ref": "#/$defs/nonEmptyPaths" },
19
+ "topics": { "$ref": "#/$defs/texts" },
20
+ "itemIds": { "$ref": "#/$defs/ids" },
21
+ "changedPaths": { "$ref": "#/$defs/paths" }
22
+ }
23
+ },
24
+ "level": { "enum": ["initial", "expanded", "complete"] },
25
+ "freshness": { "enum": ["snapshot-and-signal-bound", "strict-current"] },
26
+ "budget": {
27
+ "type": "object", "additionalProperties": false, "required": ["audit", "delivery", "readTargets"],
28
+ "properties": {
29
+ "audit": { "$ref": "#/$defs/auditBudget" },
30
+ "delivery": { "$ref": "#/$defs/deliveryBudget" },
31
+ "readTargets": { "$ref": "#/$defs/readBudget" }
32
+ }
33
+ },
34
+ "expansion": {
35
+ "oneOf": [
36
+ { "type": "null" },
37
+ {
38
+ "type": "object", "additionalProperties": false,
39
+ "required": ["previousBundleDigest", "requestedItemIds", "requestedSubjects", "requestedSourceIds"],
40
+ "properties": {
41
+ "previousBundleDigest": { "$ref": "#/$defs/digest" },
42
+ "requestedItemIds": { "$ref": "#/$defs/ids" },
43
+ "requestedSubjects": { "$ref": "#/$defs/ids" },
44
+ "requestedSourceIds": { "$ref": "#/$defs/ids" }
45
+ }
46
+ }
47
+ ]
48
+ }
49
+ },
50
+ "allOf": [
51
+ { "if": { "properties": { "level": { "const": "expanded" } } }, "then": { "properties": { "expansion": { "type": "object" } } } },
52
+ { "if": { "properties": { "level": { "enum": ["initial", "complete"] } } }, "then": { "properties": { "expansion": { "type": "null" } } } }
53
+ ],
54
+ "$defs": {
55
+ "id": { "type": "string", "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$" },
56
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
57
+ "ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/id" } },
58
+ "paths": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
59
+ "nonEmptyPaths": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
60
+ "texts": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
61
+ "snapshots": {
62
+ "type": "object", "additionalProperties": false, "required": ["contract", "sourcesLock", "projectionsLock"],
63
+ "properties": { "contract": { "$ref": "#/$defs/digest" }, "sourcesLock": { "$ref": "#/$defs/digest" }, "projectionsLock": { "$ref": "#/$defs/digest" } }
64
+ },
65
+ "auditBudget": { "type": "object", "additionalProperties": false, "required": ["targetUtf8Bytes", "maxUtf8Bytes"], "properties": { "targetUtf8Bytes": { "type": "integer", "minimum": 1 }, "maxUtf8Bytes": { "type": "integer", "minimum": 1 } } },
66
+ "deliveryBudget": { "type": "object", "additionalProperties": false, "required": ["completeBelowUtf8Bytes", "maxUtf8Bytes"], "properties": { "completeBelowUtf8Bytes": { "type": "integer", "minimum": 1 }, "maxUtf8Bytes": { "type": "integer", "minimum": 1 } } },
67
+ "readBudget": { "type": "object", "additionalProperties": false, "required": ["target", "max"], "properties": { "target": { "type": "integer", "minimum": 1 }, "max": { "type": "integer", "minimum": 1 } } }
68
+ }
69
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:coverage-audit:1",
4
+ "title": "Frontend Project Context Coverage Audit",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "project", "snapshots", "profile", "registrationCoverage", "categories", "guarantee", "auditDigest"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "kind": { "const": "coverage-audit" },
11
+ "project": { "type": "object", "additionalProperties": false, "required": ["id", "name"], "properties": { "id": { "type": "string" }, "name": { "type": "string" } } },
12
+ "snapshots": { "$ref": "context-query.schema.json#/$defs/snapshots" },
13
+ "profile": { "type": ["object", "null"] },
14
+ "registrationCoverage": { "enum": ["not-declared", "review-required", "closed-for-declared-scope"] },
15
+ "categories": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["registered", "excluded-approved", "review-required", "outside-declared-coverage"],
19
+ "properties": {
20
+ "registered": { "$ref": "#/$defs/candidates" },
21
+ "excluded-approved": { "$ref": "#/$defs/candidates" },
22
+ "review-required": { "$ref": "#/$defs/candidates" },
23
+ "outside-declared-coverage": { "$ref": "#/$defs/candidates" }
24
+ }
25
+ },
26
+ "guarantee": { "const": "declared-scope-only-never-all-project-truth" },
27
+ "auditDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
28
+ },
29
+ "$defs": {
30
+ "candidates": { "type": "array", "items": { "type": "object", "required": ["path", "origin"], "properties": { "path": { "type": "string" }, "origin": { "type": "string" }, "proposedSourceId": { "type": "string" } } } }
31
+ }
32
+ }