dsh-github-copilot 0.1.0-alpha.1.dsh.0.2.1.alpha.5
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/AGENTS.md +439 -0
- package/CHANGELOG.md +875 -0
- package/CONTRIBUTING.md +55 -0
- package/LICENSE +21 -0
- package/README.md +366 -0
- package/README.zh.md +341 -0
- package/SECURITY.md +29 -0
- package/cordis.patch.yml +16 -0
- package/deployment-baseline.json +1580 -0
- package/docs/account-management-experience.md +143 -0
- package/docs/agent-readiness.md +110 -0
- package/docs/auto-high-cost.md +255 -0
- package/docs/auto-iteration-review.json +22 -0
- package/docs/auto-review-sampling.md +60 -0
- package/docs/auto-task-routing.md +341 -0
- package/docs/automatic-model-routing.md +236 -0
- package/docs/copilot-accounts.md +424 -0
- package/docs/copilot-compaction.md +148 -0
- package/docs/copilot-usage.md +133 -0
- package/docs/dual-model.md +66 -0
- package/docs/evidence-driven-iteration.md +86 -0
- package/docs/image-input-compatibility.md +64 -0
- package/docs/images/copilot-accounts-credits.png +0 -0
- package/docs/images/copilot-accounts.png +0 -0
- package/docs/images/copilot-current-provenance.json +39 -0
- package/docs/images/copilot-model-preferences.png +0 -0
- package/docs/images/copilot-search-routing.png +0 -0
- package/docs/images/copilot-session-continuation.png +0 -0
- package/docs/images/dual-model-desktop.png +0 -0
- package/docs/images/dual-model-mobile.png +0 -0
- package/docs/images/dual-model-provenance.json +35 -0
- package/docs/images/parent-model-follow.png +0 -0
- package/docs/manual-compaction-recovery.md +109 -0
- package/docs/mockups/copilot-account-dropdown.html +71 -0
- package/docs/mockups/copilot-account-management.html +393 -0
- package/docs/model-compatibility-acceptance.md +182 -0
- package/docs/npm-distribution.md +202 -0
- package/docs/official-first-016-alpha2.md +66 -0
- package/docs/official-first-020-rc1.md +32 -0
- package/docs/official-first-020-rc2.md +17 -0
- package/docs/official-first-021-alpha4.md +157 -0
- package/docs/official-first-021-alpha5.md +83 -0
- package/docs/plugin-diagnostics.md +605 -0
- package/docs/session-continuation.md +141 -0
- package/docs/session-search-routing.md +133 -0
- package/docs/single-route-migration.md +131 -0
- package/docs/web-lifecycle-rc2.md +55 -0
- package/lib/client.js +13236 -0
- package/lib/client.js.map +1 -0
- package/lib/copilot-identity-DRZY_d2X.js +15 -0
- package/lib/diagnostics-analysis-io.js +78 -0
- package/lib/diagnostics-analysis.js +427 -0
- package/lib/diagnostics-types-CF-qg8Do.js +708 -0
- package/lib/index.js +15661 -0
- package/lib/manual-compaction-recovery.js +485 -0
- package/lib/remote.js +1507 -0
- package/lib/request-budget-DLY_aRq0.js +87 -0
- package/lib/routed-web.js +120 -0
- package/lib/search-routing-CV2hs8as.js +792 -0
- package/lib/types/account-dropdown.d.ts +22 -0
- package/lib/types/account-model-auth.d.ts +15 -0
- package/lib/types/account-model-catalog.d.ts +70 -0
- package/lib/types/account-model-source.d.ts +85 -0
- package/lib/types/agent-compaction.d.ts +4 -0
- package/lib/types/authorization-code-clipboard.d.ts +4 -0
- package/lib/types/authorization-controller.d.ts +121 -0
- package/lib/types/auto-allocation-card.d.ts +9 -0
- package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
- package/lib/types/auto-allocation-evidence.d.ts +44 -0
- package/lib/types/auto-allocation.d.ts +47 -0
- package/lib/types/auto-assessment-evidence.d.ts +111 -0
- package/lib/types/auto-model-host.d.ts +30 -0
- package/lib/types/auto-model-intent.d.ts +36 -0
- package/lib/types/auto-model-presentation.d.ts +57 -0
- package/lib/types/auto-model-routing.d.ts +64 -0
- package/lib/types/auto-review-sampling.d.ts +6 -0
- package/lib/types/auto-selection-explanation.d.ts +9 -0
- package/lib/types/auto-task-assessment.d.ts +49 -0
- package/lib/types/auto-task-classifier.d.ts +10 -0
- package/lib/types/background-compaction.d.ts +30 -0
- package/lib/types/client.d.ts +129 -0
- package/lib/types/compact-account.d.ts +42 -0
- package/lib/types/compaction-continuation-ui.d.ts +29 -0
- package/lib/types/compaction-continuation.d.ts +48 -0
- package/lib/types/compaction-input-estimate.d.ts +28 -0
- package/lib/types/compaction-pressure.d.ts +23 -0
- package/lib/types/compaction-replay.d.ts +18 -0
- package/lib/types/compatibility.d.ts +17 -0
- package/lib/types/composer-notice-style.d.ts +7 -0
- package/lib/types/config.d.ts +141 -0
- package/lib/types/content-file.d.ts +10 -0
- package/lib/types/context-evidence-ui.d.ts +28 -0
- package/lib/types/context-evidence.d.ts +256 -0
- package/lib/types/context-usage.d.ts +4 -0
- package/lib/types/copilot-account-presentation.d.ts +7 -0
- package/lib/types/copilot-accounts-card.d.ts +43 -0
- package/lib/types/copilot-accounts-host.d.ts +93 -0
- package/lib/types/copilot-accounts-remote.d.ts +85 -0
- package/lib/types/copilot-accounts-types.d.ts +43 -0
- package/lib/types/copilot-auth.d.ts +31 -0
- package/lib/types/copilot-grant.d.ts +11 -0
- package/lib/types/copilot-identity.d.ts +11 -0
- package/lib/types/copilot-request.d.ts +11 -0
- package/lib/types/copilot-stream-liveness.d.ts +23 -0
- package/lib/types/copilot-usage-card.d.ts +51 -0
- package/lib/types/copilot-usage-host.d.ts +61 -0
- package/lib/types/copilot-usage-normalize.d.ts +9 -0
- package/lib/types/copilot-usage-remote.d.ts +63 -0
- package/lib/types/copilot-usage-types.d.ts +20 -0
- package/lib/types/copilot-usage-ui.d.ts +4 -0
- package/lib/types/current-provider.d.ts +59 -0
- package/lib/types/deepseek-search-fallback.d.ts +11 -0
- package/lib/types/diagnostics-analysis-io.d.ts +23 -0
- package/lib/types/diagnostics-analysis.d.ts +298 -0
- package/lib/types/diagnostics-card.d.ts +12 -0
- package/lib/types/diagnostics-client.d.ts +13 -0
- package/lib/types/diagnostics-collector.d.ts +50 -0
- package/lib/types/diagnostics-host.d.ts +183 -0
- package/lib/types/diagnostics-remote.d.ts +113 -0
- package/lib/types/diagnostics-types.d.ts +893 -0
- package/lib/types/dual-model-host.d.ts +119 -0
- package/lib/types/dual-model-remote.d.ts +63 -0
- package/lib/types/dual-model-types.d.ts +34 -0
- package/lib/types/external-link.d.ts +3 -0
- package/lib/types/failure.d.ts +38 -0
- package/lib/types/http.d.ts +48 -0
- package/lib/types/image-input-admission.d.ts +5 -0
- package/lib/types/index.d.ts +39 -0
- package/lib/types/manual-compaction-recovery.d.ts +67 -0
- package/lib/types/migration-status.d.ts +50 -0
- package/lib/types/model-exclusions.d.ts +15 -0
- package/lib/types/model-preferences-card.d.ts +9 -0
- package/lib/types/model-protocol.d.ts +31 -0
- package/lib/types/native-select-style.d.ts +4 -0
- package/lib/types/native-settings-style.d.ts +10 -0
- package/lib/types/parent-model-follow-card.d.ts +32 -0
- package/lib/types/parent-model-follow.d.ts +44 -0
- package/lib/types/pi-provider-bridge.d.ts +22 -0
- package/lib/types/plan.d.ts +148 -0
- package/lib/types/pre-step-pressure.d.ts +8 -0
- package/lib/types/preview-provider.d.ts +77 -0
- package/lib/types/preview-route.d.ts +76 -0
- package/lib/types/probe.d.ts +39 -0
- package/lib/types/remote-codec.d.ts +10 -0
- package/lib/types/remote.d.ts +202 -0
- package/lib/types/replay-recovery-host.d.ts +28 -0
- package/lib/types/replay-recovery-remote.d.ts +14 -0
- package/lib/types/replay-recovery-types.d.ts +24 -0
- package/lib/types/replay-recovery-ui.d.ts +28 -0
- package/lib/types/replay-recovery.d.ts +17 -0
- package/lib/types/request-body-composition.d.ts +17 -0
- package/lib/types/request-body-evidence.d.ts +37 -0
- package/lib/types/request-body-timeout-marker.d.ts +2 -0
- package/lib/types/request-body-timeout.d.ts +4 -0
- package/lib/types/request-budget.d.ts +58 -0
- package/lib/types/request-diagnostics.d.ts +278 -0
- package/lib/types/request-upload-evidence.d.ts +23 -0
- package/lib/types/response-error-body.d.ts +3 -0
- package/lib/types/responses-reasoning-text.d.ts +24 -0
- package/lib/types/responses-reasoning.d.ts +7 -0
- package/lib/types/responses-replay-compat.d.ts +31 -0
- package/lib/types/responses-request-compression.d.ts +33 -0
- package/lib/types/route-ownership.d.ts +70 -0
- package/lib/types/routed-web.d.ts +50 -0
- package/lib/types/search-backend.d.ts +16 -0
- package/lib/types/search-routing-host.d.ts +19 -0
- package/lib/types/search-routing-policy.d.ts +18 -0
- package/lib/types/search-routing-remote.d.ts +20 -0
- package/lib/types/search-routing.d.ts +43 -0
- package/lib/types/search-tool-routing.d.ts +22 -0
- package/lib/types/serialize.d.ts +106 -0
- package/lib/types/session-accounts-controller.d.ts +20 -0
- package/lib/types/session-accounts-host.d.ts +33 -0
- package/lib/types/session-accounts-remote.d.ts +114 -0
- package/lib/types/session-accounts.d.ts +38 -0
- package/lib/types/session-continuation-host.d.ts +45 -0
- package/lib/types/session-continuation-remote.d.ts +22 -0
- package/lib/types/session-continuation-types.d.ts +62 -0
- package/lib/types/session-continuation-ui.d.ts +49 -0
- package/lib/types/session-continuation.d.ts +14 -0
- package/lib/types/settings-reader.d.ts +16 -0
- package/lib/types/sse.d.ts +28 -0
- package/lib/types/temporary-models.d.ts +25 -0
- package/lib/types/tool-schema-compat.d.ts +17 -0
- package/lib/types/traditional-search.d.ts +17 -0
- package/lib/types/turn-model-provenance.d.ts +45 -0
- package/lib/types/turn-request-models.d.ts +55 -0
- package/lib/types/turn-selection-card.d.ts +24 -0
- package/lib/types/turn-selection-host.d.ts +35 -0
- package/lib/types/turn-selection-remote.d.ts +17 -0
- package/lib/types/turn-selection.d.ts +186 -0
- package/lib/types/turn-usage-evidence.d.ts +66 -0
- package/lib/types/turn-usage-notice.d.ts +7 -0
- package/lib/types/types.d.ts +69 -0
- package/lib/types/usage.d.ts +26 -0
- package/lib/types/watchdog.d.ts +22 -0
- package/lib/types/web-delegate.d.ts +12 -0
- package/lib/types/web-search-routing-card.d.ts +16 -0
- package/lib/types/web-search-routing-config.d.ts +12 -0
- package/lib/types/wire-anthropic.d.ts +37 -0
- package/lib/types/wire.d.ts +56 -0
- package/lib/web-delegate.js +9 -0
- package/output/auto-model-mockup/index.html +207 -0
- package/package.json +261 -0
- package/scripts/analyze-diagnostics.mjs +91 -0
- package/scripts/check-search-composition.mjs +191 -0
- package/scripts/iteration-review.mjs +53 -0
- package/scripts/release-policy.mjs +353 -0
- package/scripts/select-core-release.mjs +11 -0
package/package.json
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-github-copilot",
|
|
3
|
+
"description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
4
|
+
"version": "0.1.0-alpha.1.dsh.0.2.1.alpha.5",
|
|
5
|
+
"releaseNotes": "CHANGELOG.md",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"registry": "https://registry.npmjs.org/",
|
|
9
|
+
"tag": "alpha"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/cloga/dsh-github-copilot.git"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./client": {
|
|
22
|
+
"types": "./lib/types/client.d.ts",
|
|
23
|
+
"default": "./lib/client.js"
|
|
24
|
+
},
|
|
25
|
+
"./remote": {
|
|
26
|
+
"types": "./lib/types/remote.d.ts",
|
|
27
|
+
"default": "./lib/remote.js"
|
|
28
|
+
},
|
|
29
|
+
"./web-delegate": {
|
|
30
|
+
"types": "./lib/types/web-delegate.d.ts",
|
|
31
|
+
"default": "./lib/web-delegate.js"
|
|
32
|
+
},
|
|
33
|
+
"./routed-web": {
|
|
34
|
+
"types": "./lib/types/routed-web.d.ts",
|
|
35
|
+
"default": "./lib/routed-web.js"
|
|
36
|
+
},
|
|
37
|
+
"./manual-compaction-recovery": {
|
|
38
|
+
"types": "./lib/types/manual-compaction-recovery.d.ts",
|
|
39
|
+
"default": "./lib/manual-compaction-recovery.js"
|
|
40
|
+
},
|
|
41
|
+
"./deployment-baseline.json": "./deployment-baseline.json",
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"cordis.patch.yml",
|
|
46
|
+
"deployment-baseline.json",
|
|
47
|
+
"lib/*.js",
|
|
48
|
+
"lib/*.js.map",
|
|
49
|
+
"lib/types/**/*.d.ts",
|
|
50
|
+
"README.md",
|
|
51
|
+
"README.zh.md",
|
|
52
|
+
"CHANGELOG.md",
|
|
53
|
+
"CONTRIBUTING.md",
|
|
54
|
+
"SECURITY.md",
|
|
55
|
+
"AGENTS.md",
|
|
56
|
+
"docs/agent-readiness.md",
|
|
57
|
+
"docs/model-compatibility-acceptance.md",
|
|
58
|
+
"docs/auto-review-sampling.md",
|
|
59
|
+
"docs/single-route-migration.md",
|
|
60
|
+
"docs/session-search-routing.md",
|
|
61
|
+
"docs/npm-distribution.md",
|
|
62
|
+
"docs/dual-model.md",
|
|
63
|
+
"docs/official-first-016-alpha2.md",
|
|
64
|
+
"docs/official-first-020-rc1.md",
|
|
65
|
+
"docs/official-first-020-rc2.md",
|
|
66
|
+
"docs/official-first-021-alpha4.md",
|
|
67
|
+
"docs/official-first-021-alpha5.md",
|
|
68
|
+
"docs/web-lifecycle-rc2.md",
|
|
69
|
+
"docs/copilot-compaction.md",
|
|
70
|
+
"docs/manual-compaction-recovery.md",
|
|
71
|
+
"docs/copilot-usage.md",
|
|
72
|
+
"docs/copilot-accounts.md",
|
|
73
|
+
"docs/session-continuation.md",
|
|
74
|
+
"docs/account-management-experience.md",
|
|
75
|
+
"docs/mockups/copilot-account-management.html",
|
|
76
|
+
"docs/mockups/copilot-account-dropdown.html",
|
|
77
|
+
"docs/automatic-model-routing.md",
|
|
78
|
+
"docs/auto-task-routing.md",
|
|
79
|
+
"docs/auto-high-cost.md",
|
|
80
|
+
"docs/evidence-driven-iteration.md",
|
|
81
|
+
"docs/plugin-diagnostics.md",
|
|
82
|
+
"docs/auto-iteration-review.json",
|
|
83
|
+
"scripts/analyze-diagnostics.mjs",
|
|
84
|
+
"scripts/iteration-review.mjs",
|
|
85
|
+
"docs/image-input-compatibility.md",
|
|
86
|
+
"output/auto-model-mockup/index.html",
|
|
87
|
+
"docs/images/dual-model-provenance.json",
|
|
88
|
+
"scripts/check-search-composition.mjs",
|
|
89
|
+
"scripts/select-core-release.mjs",
|
|
90
|
+
"scripts/release-policy.mjs",
|
|
91
|
+
"docs/images/"
|
|
92
|
+
],
|
|
93
|
+
"keywords": [
|
|
94
|
+
"dsh",
|
|
95
|
+
"deepseek-harness",
|
|
96
|
+
"plugin",
|
|
97
|
+
"cordis",
|
|
98
|
+
"github-copilot",
|
|
99
|
+
"oauth",
|
|
100
|
+
"model-provider",
|
|
101
|
+
"hosted-search",
|
|
102
|
+
"web-search",
|
|
103
|
+
"openai-responses",
|
|
104
|
+
"typescript"
|
|
105
|
+
],
|
|
106
|
+
"license": "MIT",
|
|
107
|
+
"engines": {
|
|
108
|
+
"node": ">=22.19.0",
|
|
109
|
+
"dsh": "0.2.1-alpha.5"
|
|
110
|
+
},
|
|
111
|
+
"peerDependencies": {
|
|
112
|
+
"@deepseek-ai/cordis": "4.0.5-alpha.2",
|
|
113
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.5",
|
|
114
|
+
"@deepseek-ai/dsh-agent-default-model": "0.2.1-alpha.5",
|
|
115
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.1-alpha.5",
|
|
116
|
+
"@deepseek-ai/dsh-authorization": "0.2.1-alpha.5",
|
|
117
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.5",
|
|
118
|
+
"@deepseek-ai/dsh-client-ui-settings-models": "0.2.1-alpha.5",
|
|
119
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.5",
|
|
120
|
+
"@deepseek-ai/dsh-commands": "0.2.1-alpha.5",
|
|
121
|
+
"@deepseek-ai/dsh-compaction": "0.2.1-alpha.5",
|
|
122
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.1-alpha.5",
|
|
123
|
+
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.5",
|
|
124
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.1-alpha.5",
|
|
125
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.5",
|
|
126
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.1-alpha.5",
|
|
127
|
+
"@deepseek-ai/dsh-scope": "0.2.1-alpha.5",
|
|
128
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.5",
|
|
129
|
+
"@deepseek-ai/dsh-settings": "0.2.1-alpha.5",
|
|
130
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.5",
|
|
131
|
+
"@deepseek-ai/dsh-web": "0.2.1-alpha.5",
|
|
132
|
+
"@deepseek-ai/dsh-web-search-deepseek": "0.2.1-alpha.5",
|
|
133
|
+
"@deepseek-ai/schemastery": "3.18.5-alpha.2"
|
|
134
|
+
},
|
|
135
|
+
"peerDependenciesMeta": {
|
|
136
|
+
"@deepseek-ai/dsh-web-search-deepseek": {
|
|
137
|
+
"optional": true
|
|
138
|
+
},
|
|
139
|
+
"@deepseek-ai/dsh-launch-environment": {
|
|
140
|
+
"optional": true
|
|
141
|
+
},
|
|
142
|
+
"@deepseek-ai/dsh-api-remotes": {
|
|
143
|
+
"optional": true
|
|
144
|
+
},
|
|
145
|
+
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
146
|
+
"optional": true
|
|
147
|
+
},
|
|
148
|
+
"@deepseek-ai/dsh-client-ui-settings-models": {
|
|
149
|
+
"optional": true
|
|
150
|
+
},
|
|
151
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
152
|
+
"optional": true
|
|
153
|
+
},
|
|
154
|
+
"@deepseek-ai/dsh-typert-protocol": {
|
|
155
|
+
"optional": true
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"dependencies": {
|
|
159
|
+
"@earendil-works/pi-ai": "1.1.0",
|
|
160
|
+
"undici": "6.28.1",
|
|
161
|
+
"zod": "4.4.3"
|
|
162
|
+
},
|
|
163
|
+
"devDependencies": {
|
|
164
|
+
"@deepseek-ai/cordis": "4.0.5-alpha.2",
|
|
165
|
+
"@deepseek-ai/cordis-plugin-loader": "1.0.6-alpha.2",
|
|
166
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.5",
|
|
167
|
+
"@deepseek-ai/dsh-agent-default-model": "0.2.1-alpha.5",
|
|
168
|
+
"@deepseek-ai/dsh-api-gateway": "0.2.1-alpha.5",
|
|
169
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.1-alpha.5",
|
|
170
|
+
"@deepseek-ai/dsh-app-boot": "0.2.1-alpha.5",
|
|
171
|
+
"@deepseek-ai/dsh-attachment": "0.2.1-alpha.5",
|
|
172
|
+
"@deepseek-ai/dsh-authorization": "0.2.1-alpha.5",
|
|
173
|
+
"@deepseek-ai/dsh-client-connection": "0.2.1-alpha.5",
|
|
174
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.5",
|
|
175
|
+
"@deepseek-ai/dsh-client-ui-settings-models": "0.2.1-alpha.5",
|
|
176
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.5",
|
|
177
|
+
"@deepseek-ai/dsh-commands": "0.2.1-alpha.5",
|
|
178
|
+
"@deepseek-ai/dsh-compaction": "0.2.1-alpha.5",
|
|
179
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.1-alpha.5",
|
|
180
|
+
"@deepseek-ai/dsh-config-editor": "0.2.1-alpha.5",
|
|
181
|
+
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.5",
|
|
182
|
+
"@deepseek-ai/dsh-experimental-auto-review": "0.2.1-alpha.5",
|
|
183
|
+
"@deepseek-ai/dsh-fs": "0.2.1-alpha.5",
|
|
184
|
+
"@deepseek-ai/dsh-jobs": "0.2.1-alpha.5",
|
|
185
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.1-alpha.5",
|
|
186
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.5",
|
|
187
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.1-alpha.5",
|
|
188
|
+
"@deepseek-ai/dsh-permission-presets": "0.2.1-alpha.5",
|
|
189
|
+
"@deepseek-ai/dsh-scope": "0.2.1-alpha.5",
|
|
190
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.5",
|
|
191
|
+
"@deepseek-ai/dsh-session-format-catalog": "0.2.1-alpha.5",
|
|
192
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.5",
|
|
193
|
+
"@deepseek-ai/dsh-settings": "0.2.1-alpha.5",
|
|
194
|
+
"@deepseek-ai/dsh-storage": "0.2.1-alpha.5",
|
|
195
|
+
"@deepseek-ai/dsh-storage-domain": "0.2.1-alpha.5",
|
|
196
|
+
"@deepseek-ai/dsh-storage-json": "0.2.1-alpha.5",
|
|
197
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.5",
|
|
198
|
+
"@deepseek-ai/dsh-tool-web": "0.2.1-alpha.5",
|
|
199
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.5",
|
|
200
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.5",
|
|
201
|
+
"@deepseek-ai/dsh-typert-registry": "0.2.1-alpha.5",
|
|
202
|
+
"@deepseek-ai/dsh-user-approval": "0.2.1-alpha.5",
|
|
203
|
+
"@deepseek-ai/dsh-web": "0.2.1-alpha.5",
|
|
204
|
+
"@deepseek-ai/dsh-web-search-deepseek": "0.2.1-alpha.5",
|
|
205
|
+
"@deepseek-ai/schemastery": "3.18.5-alpha.2",
|
|
206
|
+
"@types/node": "^22.0.0",
|
|
207
|
+
"@types/react": "~18.3.1",
|
|
208
|
+
"@types/react-dom": "18.3.7",
|
|
209
|
+
"jsdom": "^26.1.0",
|
|
210
|
+
"react": "^18.2.0",
|
|
211
|
+
"react-dom": "18.3.1",
|
|
212
|
+
"tsdown": "^0.22.2",
|
|
213
|
+
"typescript": "^5.9.0",
|
|
214
|
+
"unrun": "^0.3.1",
|
|
215
|
+
"vitest": "^3.2.0"
|
|
216
|
+
},
|
|
217
|
+
"main": "lib/index.js",
|
|
218
|
+
"types": "lib/types/index.d.ts",
|
|
219
|
+
"imports": {
|
|
220
|
+
"#package.json": "./package.json"
|
|
221
|
+
},
|
|
222
|
+
"dsh": {
|
|
223
|
+
"bundle": {
|
|
224
|
+
"patch": "./cordis.patch.yml"
|
|
225
|
+
},
|
|
226
|
+
"client": {
|
|
227
|
+
"external": [
|
|
228
|
+
"react"
|
|
229
|
+
],
|
|
230
|
+
"inject": [
|
|
231
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
232
|
+
"@deepseek-ai/dsh-client-ui-settings-models"
|
|
233
|
+
],
|
|
234
|
+
"platform": "web"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"scripts": {
|
|
238
|
+
"build": "pnpm clean && tsc -p tsconfig.json && tsdown",
|
|
239
|
+
"clean": "node -e \"require('node:fs').rmSync('lib', { recursive: true, force: true })\"",
|
|
240
|
+
"test": "vitest run",
|
|
241
|
+
"test:watch": "vitest",
|
|
242
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
243
|
+
"typecheck:tests": "tsc -p tsconfig.tests.json",
|
|
244
|
+
"test:scripts": "node --test \"tests/scripts/*.test.mjs\"",
|
|
245
|
+
"diagnostics:analyze": "node scripts/analyze-diagnostics.mjs",
|
|
246
|
+
"agent:describe": "node scripts/agent.mjs describe --json",
|
|
247
|
+
"agent:doctor": "node scripts/agent.mjs doctor --json",
|
|
248
|
+
"agent:plan": "node scripts/agent.mjs plan",
|
|
249
|
+
"preflight:search": "node scripts/check-search-composition.mjs",
|
|
250
|
+
"verify:agent": "node scripts/verify-agent-contract.mjs",
|
|
251
|
+
"verify:tarball": "node scripts/verify-tarball.mjs",
|
|
252
|
+
"verify:baseline": "node scripts/verify-deployment-baseline.mjs",
|
|
253
|
+
"verify:package": "node scripts/verify-package.mjs",
|
|
254
|
+
"verify:controlled-core": "node scripts/verify-controlled-core.mjs",
|
|
255
|
+
"verify:reasoning-ui": "node scripts/verify-reasoning-presentation.mjs",
|
|
256
|
+
"verify:upstream": "node scripts/verify-upstream-baseline.mjs",
|
|
257
|
+
"release:check": "node scripts/release-policy.mjs",
|
|
258
|
+
"release:select": "node scripts/select-core-release.mjs",
|
|
259
|
+
"verify": "pnpm verify:agent && pnpm typecheck && pnpm typecheck:tests && pnpm verify:baseline && pnpm build && pnpm test && pnpm test:scripts && pnpm verify:package"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { open } from 'node:fs/promises'
|
|
2
|
+
import { basename, isAbsolute, parse, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import {
|
|
5
|
+
analyzeReviewedView, analyzeSnapshot, diagnosticsUnitName, parsePersistedUnit, parseReviewedView,
|
|
6
|
+
} from '../lib/diagnostics-analysis.js'
|
|
7
|
+
import { readBoundedDiagnosticsFile } from '../lib/diagnostics-analysis-io.js'
|
|
8
|
+
|
|
9
|
+
const usage = 'Usage: node scripts/analyze-diagnostics.mjs --input <absolute-file> --mode persisted-unit --profile-name <name> --output <new-local-file>\n'
|
|
10
|
+
+ ' or: node scripts/analyze-diagnostics.mjs --input <absolute-file> --mode reviewed-view --output <new-local-file>'
|
|
11
|
+
const supportedErrors = new Set([
|
|
12
|
+
'INVALID_PROFILE', 'INVALID_UNIT', 'INVALID_SNAPSHOT', 'DUPLICATE_AGGREGATE',
|
|
13
|
+
'INVALID_OPTIONS', 'INVALID_VIEW', 'INVALID_ARGUMENTS', 'INPUT_LIMIT', 'INVALID_JSON', 'INVALID_PATH',
|
|
14
|
+
'SYMLINK_REJECTED', 'NOT_REGULAR_FILE', 'FILE_CHANGED', 'FILE_READ_FAILED', 'INVALID_UTF8',
|
|
15
|
+
'INVALID_REPORT', 'OUTPUT_UNAVAILABLE',
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
function parseArguments(args) {
|
|
19
|
+
const values = new Map()
|
|
20
|
+
for (let index = 0; index < args.length; index += 2) {
|
|
21
|
+
const key = args[index]
|
|
22
|
+
const value = args[index + 1]
|
|
23
|
+
if (!['--input', '--mode', '--profile-name', '--output'].includes(key)
|
|
24
|
+
|| !value || value.startsWith('--') || values.has(key)) {
|
|
25
|
+
throw new Error('COPILOT_DIAGNOSTICS_ANALYSIS_INVALID_ARGUMENTS')
|
|
26
|
+
}
|
|
27
|
+
values.set(key, value)
|
|
28
|
+
}
|
|
29
|
+
const mode = values.get('--mode')
|
|
30
|
+
if (!values.has('--input') || !values.has('--output')
|
|
31
|
+
|| !['persisted-unit', 'reviewed-view'].includes(mode)
|
|
32
|
+
|| (mode === 'persisted-unit') !== values.has('--profile-name')) {
|
|
33
|
+
throw new Error('COPILOT_DIAGNOSTICS_ANALYSIS_INVALID_ARGUMENTS')
|
|
34
|
+
}
|
|
35
|
+
const input = values.get('--input')
|
|
36
|
+
const output = values.get('--output')
|
|
37
|
+
if (!isAbsolute(input) || !isAbsolute(output))
|
|
38
|
+
throw new Error('COPILOT_DIAGNOSTICS_ANALYSIS_INVALID_PATH')
|
|
39
|
+
const inputPath = resolve(input)
|
|
40
|
+
const outputPath = resolve(output)
|
|
41
|
+
const comparable = value => process.platform === 'win32' ? value.toLowerCase() : value
|
|
42
|
+
if (comparable(inputPath) === comparable(outputPath)
|
|
43
|
+
|| (process.platform === 'win32' && parse(outputPath).root.startsWith('\\\\'))) {
|
|
44
|
+
throw new Error('COPILOT_DIAGNOSTICS_ANALYSIS_INVALID_PATH')
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
inputPath, outputPath, mode,
|
|
48
|
+
profileName: values.get('--profile-name'),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function errorCode(error) {
|
|
53
|
+
const prefix = 'COPILOT_DIAGNOSTICS_ANALYSIS_'
|
|
54
|
+
if (error instanceof Error && error.message.startsWith(prefix)) {
|
|
55
|
+
const candidate = error.message.slice(prefix.length)
|
|
56
|
+
if (supportedErrors.has(candidate)) return candidate
|
|
57
|
+
}
|
|
58
|
+
return 'ANALYSIS_FAILED'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function main(args) {
|
|
62
|
+
if (args.length === 1 && args[0] === '--help') {
|
|
63
|
+
process.stdout.write(`${usage}\n`)
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
const options = parseArguments(args)
|
|
67
|
+
const text = await readBoundedDiagnosticsFile(options.inputPath)
|
|
68
|
+
const observedAt = Date.now()
|
|
69
|
+
let report
|
|
70
|
+
if (options.mode === 'persisted-unit') {
|
|
71
|
+
const unitName = diagnosticsUnitName(options.profileName)
|
|
72
|
+
if (basename(options.inputPath) !== `${unitName}.json`)
|
|
73
|
+
throw new Error('COPILOT_DIAGNOSTICS_ANALYSIS_INVALID_UNIT')
|
|
74
|
+
const snapshot = parsePersistedUnit(text, unitName)
|
|
75
|
+
report = analyzeSnapshot(snapshot, { source: 'persisted-snapshot', observedAt })
|
|
76
|
+
} else {
|
|
77
|
+
report = analyzeReviewedView(parseReviewedView(text), observedAt)
|
|
78
|
+
}
|
|
79
|
+
let handle
|
|
80
|
+
try { handle = await open(options.outputPath, 'wx') } catch {
|
|
81
|
+
throw new Error('COPILOT_DIAGNOSTICS_ANALYSIS_OUTPUT_UNAVAILABLE')
|
|
82
|
+
}
|
|
83
|
+
try { await handle.writeFile(`${JSON.stringify(report, null, 2)}\n`, 'utf8') } finally { await handle.close() }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (process.argv[1] !== undefined && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
87
|
+
main(process.argv.slice(2)).catch(error => {
|
|
88
|
+
process.stderr.write(`COPILOT_DIAGNOSTICS_ANALYSIS_${errorCode(error)}\n`)
|
|
89
|
+
process.exitCode = 1
|
|
90
|
+
})
|
|
91
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'
|
|
2
|
+
import { isDeepStrictEqual } from 'node:util'
|
|
3
|
+
import { readFile } from 'node:fs/promises'
|
|
4
|
+
import { resolve, join, isAbsolute } from 'node:path'
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
6
|
+
|
|
7
|
+
const realm = 'github-copilot-original-web'
|
|
8
|
+
const reserved = new Set(['github-copilot-web-delegate', 'github-copilot-routed-web'])
|
|
9
|
+
|
|
10
|
+
/** Structural pre-install validation only; never imports/boots configured plugins. */
|
|
11
|
+
export function checkSearchComposition(entries) {
|
|
12
|
+
const reasons = new Set()
|
|
13
|
+
const matches = []
|
|
14
|
+
function walk(rows, depth) {
|
|
15
|
+
if (!Array.isArray(rows)) { reasons.add('INVALID_ENTRY_LIST'); return }
|
|
16
|
+
for (const entry of rows) {
|
|
17
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) { reasons.add('INVALID_ENTRY'); continue }
|
|
18
|
+
if (entry.id === 'web') matches.push({ entry, depth })
|
|
19
|
+
if (entry.name === '@deepseek-ai/dsh-web' && entry.id !== 'web') reasons.add('ADDITIONAL_OFFICIAL_WEB_SERVICE')
|
|
20
|
+
if (reserved.has(entry.id) || ['dsh-github-copilot/web-delegate', 'dsh-github-copilot/routed-web'].includes(entry.name)) reasons.add('ROUTING_ENTRY_CONFLICT')
|
|
21
|
+
if (entry.isolate !== undefined) {
|
|
22
|
+
if (!entry.isolate || typeof entry.isolate !== 'object' || Array.isArray(entry.isolate)) reasons.add('UNKNOWN_ISOLATION')
|
|
23
|
+
else {
|
|
24
|
+
if (Object.values(entry.isolate).some(value => value === realm)) reasons.add('ROUTING_REALM_CONFLICT')
|
|
25
|
+
if (Object.values(entry.isolate).some(value => typeof value !== 'boolean' && typeof value !== 'string')) reasons.add('UNKNOWN_ISOLATION')
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (entry.group === true) walk(entry.config, depth + 1)
|
|
29
|
+
else if (entry.group !== undefined && entry.group !== false) reasons.add('UNKNOWN_GROUP')
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
walk(entries, 0)
|
|
33
|
+
if (matches.length !== 1) reasons.add(matches.length === 0 ? 'WEB_ROW_MISSING' : 'MULTIPLE_WEB_ROWS')
|
|
34
|
+
for (const { entry, depth } of matches) {
|
|
35
|
+
if (depth !== 0) reasons.add('WEB_NOT_TOP_LEVEL')
|
|
36
|
+
if (entry.name !== '@deepseek-ai/dsh-web') reasons.add('CUSTOM_WEB_SERVICE')
|
|
37
|
+
if (entry.group === true || Object.keys(entry).some(key => !['id', 'name', 'config', 'disabled', 'group', 'isolate'].includes(key))) reasons.add('WEB_ENTRY_REQUIRES_REVIEW')
|
|
38
|
+
if (entry.disabled !== undefined && entry.disabled !== false) reasons.add('WEB_DISABLED_OR_DYNAMIC')
|
|
39
|
+
if (entry.config !== undefined && (!entry.config || typeof entry.config !== 'object' || Array.isArray(entry.config)
|
|
40
|
+
|| Object.entries(entry.config).some(([key, value]) => !['searchProvider', 'fetchProvider'].includes(key) || typeof value !== 'string'))) reasons.add('WEB_CONFIG_REQUIRES_REVIEW')
|
|
41
|
+
if (entry.isolate !== undefined && (!entry.isolate || typeof entry.isolate !== 'object' || Array.isArray(entry.isolate) || Object.keys(entry.isolate).length > 0)) reasons.add('PREEXISTING_WEB_ISOLATION')
|
|
42
|
+
}
|
|
43
|
+
return { schemaVersion: 1, supported: reasons.size === 0, reasons: [...reasons].sort(), scope: 'pre-install-structural-only; no boot, credentials, network or writes' }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function reportCandidate(reasons) {
|
|
47
|
+
return { schemaVersion: 1, supported: reasons.size === 0, reasons: [...reasons].sort(), scope: 'candidate-structural-only; no boot, credentials, network or writes' }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isRecord(value) {
|
|
51
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function hasExpression(value) {
|
|
55
|
+
if (!value || typeof value !== 'object') return false
|
|
56
|
+
return Object.entries(value).some(([key, child]) => key === '__jsExpr' || key === '__js' || hasExpression(child))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function accountRows(entries) {
|
|
60
|
+
const matches = []
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
if (!isRecord(entry)) continue
|
|
63
|
+
if (entry.id === 'github-copilot' || entry.name === 'dsh-github-copilot') matches.push(entry)
|
|
64
|
+
if (entry.group === true && Array.isArray(entry.config)) matches.push(...accountRows(entry.config))
|
|
65
|
+
}
|
|
66
|
+
return matches
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Only the bundle's reviewed, static service wiring is automatically supported. */
|
|
70
|
+
function routingRowValid(entry, name, isolated, account = false) {
|
|
71
|
+
if (!entry || entry.name !== name) return false
|
|
72
|
+
const keys = ['id', 'name', 'disabled', 'group', 'isolate', ...(account ? ['config'] : [])]
|
|
73
|
+
if (Object.keys(entry).some(key => !keys.includes(key))) return false
|
|
74
|
+
if (entry.disabled !== undefined && entry.disabled !== false) return false
|
|
75
|
+
if (entry.group !== undefined && entry.group !== false) return false
|
|
76
|
+
if (isolated) {
|
|
77
|
+
if (!isDeepStrictEqual(entry.isolate, { web: realm })) return false
|
|
78
|
+
} else if (entry.isolate !== undefined && (!isRecord(entry.isolate) || Object.keys(entry.isolate).length !== 0)) return false
|
|
79
|
+
return entry.config === undefined || (account && isRecord(entry.config) && !hasExpression(entry.config))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function candidateViable(entries, baseline) {
|
|
83
|
+
const original = baseline.find(entry => entry.id === 'web')
|
|
84
|
+
const web = entries.find(entry => entry.id === 'web')
|
|
85
|
+
if (!original || !web || !isDeepStrictEqual(web.isolate, { web: realm })) return false
|
|
86
|
+
for (const [id, name, isolated, account] of [
|
|
87
|
+
['github-copilot-web-delegate', 'dsh-github-copilot/web-delegate', true, false],
|
|
88
|
+
['github-copilot-routed-web', 'dsh-github-copilot/routed-web', false, false],
|
|
89
|
+
['github-copilot', 'dsh-github-copilot', false, true],
|
|
90
|
+
]) {
|
|
91
|
+
const matches = entries.filter(entry => entry.id === id)
|
|
92
|
+
if (matches.length !== 1 || !routingRowValid(matches[0], name, isolated, account)) return false
|
|
93
|
+
}
|
|
94
|
+
// Apart from the two new service rows and the original web's realm, the
|
|
95
|
+
// candidate must preserve the entire routing-free tree, including user config.
|
|
96
|
+
// These are parsed, owned config objects, never live Loader/Service objects.
|
|
97
|
+
const restored = entries.filter(entry => !reserved.has(entry.id)).map(entry => {
|
|
98
|
+
if (entry.id !== 'web') return entry
|
|
99
|
+
const copy = { ...entry }
|
|
100
|
+
if (Object.hasOwn(original, 'isolate')) copy.isolate = original.isolate
|
|
101
|
+
else delete copy.isolate
|
|
102
|
+
return copy
|
|
103
|
+
})
|
|
104
|
+
return isDeepStrictEqual(restored, baseline)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Read and compose the proposed normal launch without loadProfile's initialization/normalization writes. */
|
|
108
|
+
export async function inspectProfileSearchComposition({ profileDir, home, installAnchor, patches = [] }, suppliedBoot) {
|
|
109
|
+
const native = suppliedBoot ?? await import(pathToFileURL(createRequire(installAnchor).resolve('@deepseek-ai/dsh-app-boot')).href)
|
|
110
|
+
const { readProfileManifest, resolveBundleDir, bundlePatchPaths, loadOverlayPatches, loadOptionalPatches, composeEntries } = native
|
|
111
|
+
const bin = 'copilot-search-preflight'
|
|
112
|
+
const manifest = readProfileManifest(bin, profileDir)
|
|
113
|
+
const reasons = new Set()
|
|
114
|
+
// Official profile composition overwrites cordis.yml with [] on normal launch,
|
|
115
|
+
// including the resolved Desktop path. Never certify rows from that file.
|
|
116
|
+
const root = loadOptionalPatches(bin, join(profileDir, 'cordis.yml'))
|
|
117
|
+
if (root?.length) return reportCandidate(new Set(['NONEMPTY_DISPOSABLE_PROFILE_ROOT']))
|
|
118
|
+
const candidate = loadOverlayPatches(bin, fileURLToPath(new URL('../cordis.patch.yml', import.meta.url)))
|
|
119
|
+
const layers = []
|
|
120
|
+
const baselineLayers = []
|
|
121
|
+
let copilotLayers = 0
|
|
122
|
+
let candidateIndex
|
|
123
|
+
function addCandidate() {
|
|
124
|
+
candidateIndex ??= layers.length
|
|
125
|
+
layers.push(candidate)
|
|
126
|
+
// The routing-free comparison retains the account row and its user config.
|
|
127
|
+
baselineLayers.push([{ insert: [{ id: 'github-copilot', name: 'dsh-github-copilot' }] }])
|
|
128
|
+
}
|
|
129
|
+
for (const name of manifest.dsh?.profile?.bundles ?? []) {
|
|
130
|
+
const directory = resolveBundleDir(bin, name, installAnchor, profileDir)
|
|
131
|
+
const bundle = readProfileManifest(bin, directory)
|
|
132
|
+
if (bundle.name === 'dsh-github-copilot') {
|
|
133
|
+
copilotLayers++
|
|
134
|
+
// Updating replaces our existing slot, not its position in bundle order.
|
|
135
|
+
addCandidate()
|
|
136
|
+
continue
|
|
137
|
+
}
|
|
138
|
+
const layer = bundlePatchPaths(directory, bundle.dsh?.bundle)
|
|
139
|
+
.flatMap(file => loadOverlayPatches(bin, file))
|
|
140
|
+
layers.push(layer)
|
|
141
|
+
baselineLayers.push(layer)
|
|
142
|
+
}
|
|
143
|
+
if (copilotLayers === 0) addCandidate()
|
|
144
|
+
const late = [
|
|
145
|
+
loadOptionalPatches(bin, join(profileDir, 'cordis.patch.yml')) ?? [],
|
|
146
|
+
loadOptionalPatches(bin, join(home, 'cordis.patch.yml')) ?? [],
|
|
147
|
+
...patches.map(file => loadOverlayPatches(bin, file)),
|
|
148
|
+
]
|
|
149
|
+
const warn = () => reasons.add('UNAPPLIED_PATCH_REQUIRES_REVIEW')
|
|
150
|
+
// Public composeEntries flattens each complete stack in one pass. Repeatedly
|
|
151
|
+
// patching a previously composed tree would change the include's id index.
|
|
152
|
+
const beforeGuard = composeEntries(layers.slice(0, candidateIndex), warn)
|
|
153
|
+
const baseline = composeEntries([...baselineLayers, ...late], warn)
|
|
154
|
+
for (const entries of [beforeGuard, baseline]) {
|
|
155
|
+
for (const reason of checkSearchComposition(entries).reasons) reasons.add(reason)
|
|
156
|
+
}
|
|
157
|
+
const entries = composeEntries([...layers, ...late], warn)
|
|
158
|
+
if (copilotLayers > 1 || accountRows(entries).length !== 1) reasons.add('DUPLICATE_COPILOT_ACCOUNT_ENTRY')
|
|
159
|
+
if (!candidateViable(entries, baseline)) reasons.add('CANDIDATE_ROUTING_NOT_VIABLE')
|
|
160
|
+
return reportCandidate(reasons)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function parse(args) {
|
|
164
|
+
const result = { patches: [] }
|
|
165
|
+
for (let index = 0; index < args.length; index += 2) {
|
|
166
|
+
const value = args[index + 1]
|
|
167
|
+
if (!value || !isAbsolute(value)) throw new Error('INVALID_ARGUMENTS')
|
|
168
|
+
const names = { '--profile-dir': 'profileDir', '--home': 'home', '--install-anchor': 'installAnchor' }
|
|
169
|
+
const key = Object.hasOwn(names, args[index]) ? names[args[index]] : undefined
|
|
170
|
+
if (args[index] === '--patch') result.patches.push(value)
|
|
171
|
+
else if (!key || result[key]) throw new Error('INVALID_ARGUMENTS')
|
|
172
|
+
else result[key] = value
|
|
173
|
+
}
|
|
174
|
+
if (!result.profileDir || !result.home || !result.installAnchor) throw new Error('INVALID_ARGUMENTS')
|
|
175
|
+
return result
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
179
|
+
try {
|
|
180
|
+
const options = parse(process.argv.slice(2))
|
|
181
|
+
// Refuse missing profiles before any public reader could initialize one.
|
|
182
|
+
await readFile(join(options.profileDir, 'package.json'), 'utf8')
|
|
183
|
+
const result = await inspectProfileSearchComposition(options)
|
|
184
|
+
console.log(JSON.stringify(result))
|
|
185
|
+
if (!result.supported) process.exitCode = 1
|
|
186
|
+
} catch {
|
|
187
|
+
// Parse/provider-config errors can contain credentials. Never echo them.
|
|
188
|
+
console.log(JSON.stringify({ schemaVersion: 1, supported: false, reasons: ['PREFLIGHT_INPUT_OR_PUBLIC_API_FAILED'], scope: 'read-only; no boot/install attempted' }))
|
|
189
|
+
process.exitCode = 2
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { open } from 'node:fs/promises'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
5
|
+
export function validateIterationReview(value) {
|
|
6
|
+
const require = (condition, message) => { if (!condition) throw new Error(`Iteration review: ${message}`) }
|
|
7
|
+
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
8
|
+
const keys = (value, allowed) => require(object(value) && Object.keys(value).every(key => allowed.includes(key)), 'unknown or invalid fields')
|
|
9
|
+
const text = value => typeof value === 'string' && value.trim().length > 0 && value.length <= 2000
|
|
10
|
+
keys(value, ['schemaVersion', 'feature', 'status', 'policyVersion', 'observation', 'previousReview', 'findings', 'decision', 'validation', 'followUp'])
|
|
11
|
+
require(value.schemaVersion === 1 && value.feature === 'autorouting', 'unsupported version or feature')
|
|
12
|
+
require(['observed', 'not-collected', 'insufficient-sample', 'unavailable'].includes(value.status), 'explicit evidence status required')
|
|
13
|
+
require(text(value.policyVersion), 'policy version required')
|
|
14
|
+
keys(value.observation, ['start', 'end', 'sampleCount', 'limitations'])
|
|
15
|
+
const { start, end, sampleCount, limitations } = value.observation
|
|
16
|
+
require(Number.isSafeInteger(sampleCount) && sampleCount >= 0, 'invalid sample count')
|
|
17
|
+
require(text(limitations), 'observation limitations required')
|
|
18
|
+
if (value.status === 'observed' || value.status === 'insufficient-sample') {
|
|
19
|
+
require(typeof start === 'string' && typeof end === 'string'
|
|
20
|
+
&& Number.isFinite(Date.parse(start)) && Number.isFinite(Date.parse(end))
|
|
21
|
+
&& Date.parse(start) <= Date.parse(end), 'valid observation window required')
|
|
22
|
+
require(sampleCount > 0, 'observed evidence needs samples')
|
|
23
|
+
} else require(start === null && end === null && sampleCount === 0, 'missing evidence cannot claim a window')
|
|
24
|
+
require(value.previousReview === null || text(value.previousReview), 'invalid prior review reference')
|
|
25
|
+
for (const field of ['findings', 'decision', 'validation']) require(text(value[field]), `${field} required`)
|
|
26
|
+
keys(value.followUp, ['owner', 'trigger', 'metric', 'action'])
|
|
27
|
+
for (const field of ['owner', 'trigger', 'metric', 'action']) require(text(value.followUp[field]), `follow-up ${field} required`)
|
|
28
|
+
return { schemaVersion: 1, ok: true, feature: value.feature, evidenceStatus: value.status,
|
|
29
|
+
sampleCount, reviewDocumentOnly: true, evidenceTruthVerified: false }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function main(args = process.argv.slice(2)) {
|
|
33
|
+
try {
|
|
34
|
+
if (args.length !== 2 || args[0] !== '--report') throw new Error('Invalid arguments')
|
|
35
|
+
const handle = await open(resolve(args[1]), 'r')
|
|
36
|
+
let value
|
|
37
|
+
try {
|
|
38
|
+
const info = await handle.stat()
|
|
39
|
+
if (!info.isFile() || info.size > 32768) throw new Error('Invalid report file')
|
|
40
|
+
const bytes = Buffer.alloc(32769)
|
|
41
|
+
const { bytesRead } = await handle.read(bytes, 0, bytes.length, 0)
|
|
42
|
+
if (bytesRead > 32768) throw new Error('Report exceeds 32 KiB')
|
|
43
|
+
value = JSON.parse(bytes.subarray(0, bytesRead).toString('utf8'))
|
|
44
|
+
} finally { await handle.close() }
|
|
45
|
+
const review = validateIterationReview(value)
|
|
46
|
+
console.log(JSON.stringify({ ...review, report: value }))
|
|
47
|
+
return 0
|
|
48
|
+
} catch {
|
|
49
|
+
console.error('ITERATION_REVIEW_INVALID: provide a bounded report matching docs/evidence-driven-iteration.md')
|
|
50
|
+
return 1
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) process.exitCode = await main()
|