dsh-github-copilot 0.4.0-alpha.100
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 +312 -0
- package/CHANGELOG.md +479 -0
- package/CONTRIBUTING.md +46 -0
- package/LICENSE +21 -0
- package/README.md +203 -0
- package/README.zh.md +202 -0
- package/SECURITY.md +29 -0
- package/cordis.patch.yml +16 -0
- package/deployment-baseline.json +1299 -0
- package/docs/agent-readiness.md +110 -0
- package/docs/auto-task-routing.md +234 -0
- package/docs/automatic-model-routing.md +205 -0
- package/docs/copilot-accounts.md +236 -0
- package/docs/copilot-compaction.md +120 -0
- package/docs/copilot-usage.md +125 -0
- package/docs/dual-model.md +66 -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-model-preferences.png +0 -0
- package/docs/images/copilot-search-routing.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 +64 -0
- package/docs/model-compatibility-acceptance.md +164 -0
- package/docs/npm-distribution.md +149 -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 +16 -0
- package/docs/session-search-routing.md +133 -0
- package/docs/single-route-migration.md +130 -0
- package/docs/web-lifecycle-rc2.md +55 -0
- package/lib/client.js +10822 -0
- package/lib/client.js.map +1 -0
- package/lib/copilot-identity-DRZY_d2X.js +15 -0
- package/lib/index.js +11689 -0
- package/lib/manual-compaction-recovery.js +315 -0
- package/lib/remote.js +734 -0
- package/lib/request-budget-DLY_aRq0.js +87 -0
- package/lib/routed-web.js +120 -0
- package/lib/search-routing-CqysPLve.js +792 -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-controller.d.ts +119 -0
- package/lib/types/auto-assessment-evidence.d.ts +46 -0
- package/lib/types/auto-model-host.d.ts +27 -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 +59 -0
- package/lib/types/auto-selection-explanation.d.ts +9 -0
- package/lib/types/auto-task-assessment.d.ts +47 -0
- package/lib/types/auto-task-classifier.d.ts +9 -0
- package/lib/types/background-compaction.d.ts +30 -0
- package/lib/types/client.d.ts +115 -0
- package/lib/types/compact-account.d.ts +42 -0
- package/lib/types/compaction-pressure.d.ts +23 -0
- package/lib/types/compatibility.d.ts +17 -0
- package/lib/types/config.d.ts +89 -0
- package/lib/types/content-file.d.ts +10 -0
- package/lib/types/context-evidence-ui.d.ts +11 -0
- package/lib/types/context-evidence.d.ts +108 -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 +30 -0
- package/lib/types/copilot-accounts-host.d.ts +75 -0
- package/lib/types/copilot-accounts-remote.d.ts +77 -0
- package/lib/types/copilot-accounts-types.d.ts +42 -0
- package/lib/types/copilot-auth.d.ts +25 -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 +30 -0
- package/lib/types/copilot-usage-host.d.ts +58 -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/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 +52 -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/parent-model-follow-card.d.ts +41 -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 +66 -0
- package/lib/types/preview-route.d.ts +74 -0
- package/lib/types/probe.d.ts +39 -0
- package/lib/types/reasoning-presentation.d.ts +55 -0
- package/lib/types/remote-codec.d.ts +10 -0
- package/lib/types/remote.d.ts +199 -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 +26 -0
- package/lib/types/replay-recovery.d.ts +17 -0
- package/lib/types/request-body-evidence.d.ts +34 -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-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 +30 -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/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-selection-card.d.ts +10 -0
- package/lib/types/turn-selection-host.d.ts +11 -0
- package/lib/types/turn-selection-remote.d.ts +13 -0
- package/lib/types/turn-selection.d.ts +119 -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 +236 -0
- package/scripts/check-search-composition.mjs +191 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>DSH Auto model - interaction mockup</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root { color-scheme: dark; font-family: "Segoe UI", system-ui, sans-serif; background: #0b0e14; color: #e9edf6; }
|
|
9
|
+
* { box-sizing: border-box; }
|
|
10
|
+
body { margin: 0; }
|
|
11
|
+
button { font: inherit; cursor: pointer; }
|
|
12
|
+
.frame { min-height: 100vh; display: grid; grid-template-columns: 258px minmax(0, 1fr); }
|
|
13
|
+
aside { background: #10141c; border-right: 1px solid #252b39; padding: 28px 18px; }
|
|
14
|
+
.brand { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 720; padding: 0 10px 32px; }
|
|
15
|
+
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: white; background: linear-gradient(145deg, #566cff, #8c61fc); }
|
|
16
|
+
.section-label { color: #7f899c; font-size: 11px; letter-spacing: .13em; font-weight: 700; padding: 0 12px 12px; }
|
|
17
|
+
.nav { display: block; color: #a7b0c1; border-radius: 10px; padding: 12px; margin-bottom: 5px; font-size: 14px; }
|
|
18
|
+
.nav.active { color: #f5f7fd; background: #222b42; }
|
|
19
|
+
.sidebar-foot { margin-top: 52px; padding: 14px 12px; border-top: 1px solid #242b38; color: #8e9aab; font-size: 12px; line-height: 1.6; }
|
|
20
|
+
main { min-width: 0; padding: 26px clamp(20px, 5vw, 80px) 32px; }
|
|
21
|
+
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #9ca7b9; font-size: 13px; }
|
|
22
|
+
.tag { color: #9fb3ff; border: 1px solid #353e60; background: #202945; border-radius: 99px; padding: 6px 10px; font-size: 11px; }
|
|
23
|
+
.content { max-width: 860px; margin: 46px auto 0; }
|
|
24
|
+
.eyebrow { color: #9da7bb; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
|
|
25
|
+
h1 { font-size: clamp(24px, 3vw, 34px); line-height: 1.2; letter-spacing: -.03em; margin: 10px 0 11px; }
|
|
26
|
+
.intro { color: #a3aec1; font-size: 14px; line-height: 1.7; margin: 0 0 27px; }
|
|
27
|
+
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid #293144; gap: 25px; margin-bottom: 25px; }
|
|
28
|
+
.tabs button { color: #8d9aaf; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 12px 3px; font-size: 14px; }
|
|
29
|
+
.tabs button.active { color: #d8e3ff; border-color: #758cff; }
|
|
30
|
+
.timeline { display: grid; gap: 16px; min-height: 275px; }
|
|
31
|
+
.bubble { border: 1px solid #2b3342; background: #171c27; border-radius: 15px; padding: 17px 20px; }
|
|
32
|
+
.bubble.user { margin-left: 12%; background: #20283a; border-color: #34415f; }
|
|
33
|
+
.bubble h2 { font-size: 12px; font-weight: 650; margin: 0 0 9px; color: #a5b2c8; }
|
|
34
|
+
.bubble p { font-size: 14px; line-height: 1.6; margin: 0; }
|
|
35
|
+
.answer-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 18px; color: #8995a8; font-size: 12px; }
|
|
36
|
+
.footer-actions, .footer-meta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 12px; }
|
|
37
|
+
.footer-meta { position: relative; }
|
|
38
|
+
.footer-actions { font-size: 16px; letter-spacing: .06em; }
|
|
39
|
+
.route { color: #aebbd0; }
|
|
40
|
+
.explain { font-size: 12px; }
|
|
41
|
+
.explain summary { display: inline-grid; place-items: center; width: 17px; height: 17px; border: 1px solid #66748a; border-radius: 50%; cursor: pointer; list-style: none; font-size: 11px; line-height: 1; }
|
|
42
|
+
.explain summary::-webkit-details-marker { display: none; }
|
|
43
|
+
.explain span { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 2; width: min(320px, 80vw); padding: 10px 12px; border: 1px solid #3e4b65; border-radius: 9px; background: #222b3b; color: #d5deef; line-height: 1.5; box-shadow: 0 8px 24px #0008; }
|
|
44
|
+
.child-card { border: 1px solid #465477; background: #1b2434; border-radius: 15px; padding: 18px 20px; }
|
|
45
|
+
.child-card[hidden], .child-override[hidden] { display: none; }
|
|
46
|
+
.child-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
|
|
47
|
+
.child-heading strong { font-size: 13px; }
|
|
48
|
+
.child-heading span { font-size: 11px; color: #97a7c1; }
|
|
49
|
+
.child-card p { font-size: 13px; color: #b7c5d9; line-height: 1.5; margin: 0 0 13px; }
|
|
50
|
+
.child-override { background: transparent; border: 1px solid #43526e; color: #bcccdf; border-radius: 8px; padding: 6px 9px; font-size: 11px; margin-bottom: 12px; }
|
|
51
|
+
.composer { margin-top: 26px; border: 1px solid #596fbb; background: #171c29; border-radius: 16px; box-shadow: 0 0 0 4px #28376130; padding: 18px; position: relative; }
|
|
52
|
+
.input-placeholder { color: #8996ad; font-size: 14px; min-height: 65px; }
|
|
53
|
+
.toolbar { display: flex; align-items: center; gap: 9px; }
|
|
54
|
+
.tool { background: #252d3e; color: #c9d5e9; border: 1px solid #394357; border-radius: 9px; padding: 8px 11px; font-size: 12px; }
|
|
55
|
+
.tool:hover, .option:hover { background: #303b56; }
|
|
56
|
+
.picker-trigger { background: #263457; border-color: #5367a5; color: #dfe7ff; }
|
|
57
|
+
.send { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 10px; background: #6887ff; color: white; }
|
|
58
|
+
.menu { display: none; position: absolute; bottom: 59px; left: 18px; width: min(395px, calc(100% - 36px)); max-height: min(540px, 70vh); overflow-y: auto; background: #202634; border: 1px solid #3c465b; border-radius: 16px; box-shadow: 0 20px 55px #000a; padding: 8px; z-index: 5; }
|
|
59
|
+
.menu.open { display: block; }
|
|
60
|
+
.menu-title { display: flex; justify-content: space-between; color: #a4b0c5; font-size: 12px; padding: 10px 12px 8px; }
|
|
61
|
+
.menu-title span:last-child { color: #8f9aad; }
|
|
62
|
+
.provider-header { display: flex; justify-content: space-between; align-items: center; color: #d5deef; font-size: 12px; font-weight: 700; padding: 13px 12px 5px; }
|
|
63
|
+
.provider-header span { font-size: 10px; font-weight: 500; color: #93a1b8; }
|
|
64
|
+
.option { display: flex; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 10px; color: #e9edf6; padding: 12px; gap: 12px; }
|
|
65
|
+
.option.active { background: #2a3556; }
|
|
66
|
+
.option .icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; background: #394e91; color: #f2f4ff; }
|
|
67
|
+
.option .model-icon { background: #39404f; }
|
|
68
|
+
.option .option-text { display: grid; gap: 4px; flex: 1; }
|
|
69
|
+
.option small { color: #9ba8bd; font-size: 11px; line-height: 1.4; }
|
|
70
|
+
.check { color: #91a7ff; font-weight: 700; }
|
|
71
|
+
.divider { border-top: 1px solid #374152; margin: 7px 7px; }
|
|
72
|
+
.footnote { color: #8290a5; font-size: 12px; line-height: 1.6; margin: 16px 3px 0; }
|
|
73
|
+
.goal-steps { display: grid; gap: 10px; margin-top: 4px; }
|
|
74
|
+
.goal-step { border: 1px solid #334057; border-radius: 10px; padding: 10px 12px; color: #b4c0d2; font-size: 12px; }
|
|
75
|
+
.goal-step.current { border-color: #5b73c0; background: #242e4c; color: #e6eaff; }
|
|
76
|
+
@media (max-width: 740px) { .frame { grid-template-columns: 1fr; } aside { display: none; } main { padding: 20px; } .content { margin-top: 32px; } .bubble.user { margin-left: 0; } .child-heading { flex-wrap: wrap; } }
|
|
77
|
+
</style>
|
|
78
|
+
</head>
|
|
79
|
+
<body>
|
|
80
|
+
<div class="frame">
|
|
81
|
+
<aside>
|
|
82
|
+
<div class="brand"><span class="mark">✦</span> DeepSeek Harness</div>
|
|
83
|
+
<div class="section-label">WORKSPACE</div>
|
|
84
|
+
<div class="nav active">◈ Auto model design</div>
|
|
85
|
+
<div class="nav">◻ Sessions</div>
|
|
86
|
+
<div class="nav">◎ Goals</div>
|
|
87
|
+
<div class="sidebar-foot">Interaction concept only.<br>Not connected to a model or account.</div>
|
|
88
|
+
</aside>
|
|
89
|
+
<main>
|
|
90
|
+
<header class="top"><span>Sessions / Auto model design</span><span class="tag">INTERACTIVE MOCKUP</span></header>
|
|
91
|
+
<div class="content">
|
|
92
|
+
<div class="eyebrow">Model routing · MVP concept</div>
|
|
93
|
+
<h1>Auto within GitHub Copilot. Manual models everywhere else.</h1>
|
|
94
|
+
<p class="intro">Pick Auto under GitHub Copilot to route between eligible Copilot models. Other providers remain available for manual selection; Auto never crosses provider boundaries. The actual model appears beside the timestamp at the end of each completed answer.</p>
|
|
95
|
+
<div class="tabs" role="tablist" aria-label="Example scenario">
|
|
96
|
+
<button id="chatTab" role="tab" aria-selected="true" class="active">Chat turn</button>
|
|
97
|
+
<button id="goalTab" role="tab" aria-selected="false">Goal rounds</button>
|
|
98
|
+
<button id="childTab" role="tab" aria-selected="false">Subagent</button>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="timeline" aria-live="polite">
|
|
101
|
+
<div class="bubble user"><h2 id="userLabel">You · new turn</h2><p id="userText">Explain why this function returns an empty result.</p></div>
|
|
102
|
+
<div class="bubble">
|
|
103
|
+
<p id="assistantText">I’ll inspect the function and its call site, then explain the condition that produces the empty result.</p>
|
|
104
|
+
<div id="scenarioSteps" class="goal-steps" hidden></div>
|
|
105
|
+
<div class="answer-footer">
|
|
106
|
+
<span class="footer-actions" aria-label="Answer actions">▢ ♡ ⋯</span>
|
|
107
|
+
<span class="footer-meta"><span>▤ Usage 12.4k tok</span><span>◷ Ran for 18s</span><time datetime="2026-09-30T22:12:00+08:00">22:12</time><span id="realModel" class="route">Auto · Copilot model A</span><details class="explain"><summary aria-label="Why this model" title="Why this model">?</summary><span id="reason">Routing reason: bounded explanation · The model stays fixed through tools and follow-up steps in this turn.</span></details></span>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="child-card" id="childCard" hidden>
|
|
111
|
+
<div class="child-heading"><strong>↳ Subagent · regression investigator</strong><span>Separate session · own turn</span></div>
|
|
112
|
+
<button class="child-override" id="childOverride" type="button">Preview explicit child override</button>
|
|
113
|
+
<p>I’ll trace the failing test and check the affected API contract.</p>
|
|
114
|
+
<div class="answer-footer">
|
|
115
|
+
<span class="footer-actions" aria-label="Subagent answer actions">▢ ♡ ⋯</span>
|
|
116
|
+
<span class="footer-meta"><span>▤ Usage 8.2k tok</span><span>◷ Ran for 12s</span><time datetime="2026-09-30T22:13:00+08:00">22:13</time><span id="childModel" class="route">Inherited · Copilot model A</span><details class="explain"><summary aria-label="Why this model" title="Why this model">?</summary><span id="childReason">Native MVP behavior: the child inherits the parent’s resolved concrete model.</span></details></span>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="composer">
|
|
121
|
+
<div class="menu" id="picker" aria-label="Model picker">
|
|
122
|
+
<div class="menu-title"><span>Choose a model</span><span>Across providers</span></div>
|
|
123
|
+
<div class="provider-header">GitHub Copilot <span>Account models</span></div>
|
|
124
|
+
<button class="option active" data-model="auto"><span class="icon">✦</span><span class="option-text"><strong>Auto</strong><small>Choose one eligible Copilot model per turn. Copilot only.</small></span><span class="check">✓</span></button>
|
|
125
|
+
<button class="option" data-model="copilot-a"><span class="icon model-icon">A</span><span class="option-text"><strong>Copilot model A</strong><small>Use this specific Copilot model.</small></span><span class="check"></span></button>
|
|
126
|
+
<button class="option" data-model="copilot-b"><span class="icon model-icon">B</span><span class="option-text"><strong>Copilot model B</strong><small>Use this specific Copilot model.</small></span><span class="check"></span></button>
|
|
127
|
+
<div class="divider"></div>
|
|
128
|
+
<div class="provider-header">DeepSeek <span>Manual selection only</span></div>
|
|
129
|
+
<button class="option" data-model="deepseek-chat"><span class="icon model-icon">D</span><span class="option-text"><strong>DeepSeek Chat</strong><small>Different provider · no Copilot Auto routing.</small></span><span class="check"></span></button>
|
|
130
|
+
</div>
|
|
131
|
+
<div class="input-placeholder">Ask a follow-up or continue this goal…</div>
|
|
132
|
+
<div class="toolbar"><button class="tool" aria-label="Add attachment">+</button><button class="tool picker-trigger" id="trigger" aria-expanded="false" aria-controls="picker">GitHub Copilot · Auto ⌄</button><button class="send" aria-label="Send" title="Illustration only">↑</button></div>
|
|
133
|
+
</div>
|
|
134
|
+
<p class="footnote">Concept only: the answer-footer model label is a proposed addition, not current DSH UI; current DSH shows the route inside the end-of-turn usage details in detailed mode. Copilot model A/B are placeholders, not account models or benchmark rankings. In the plugin-only MVP, native children inherit the parent’s resolved concrete model; independent child Auto is deferred because unchanged Core does not preserve enough Auto intent and override evidence. Selecting through the current native picker also updates the future global default.</p>
|
|
135
|
+
</div>
|
|
136
|
+
</main>
|
|
137
|
+
</div>
|
|
138
|
+
<script>
|
|
139
|
+
const picker = document.querySelector('#picker');
|
|
140
|
+
const trigger = document.querySelector('#trigger');
|
|
141
|
+
const options = [...document.querySelectorAll('[data-model]')];
|
|
142
|
+
const models = {
|
|
143
|
+
'copilot-a': { provider: 'GitHub Copilot', name: 'Copilot model A' },
|
|
144
|
+
'copilot-b': { provider: 'GitHub Copilot', name: 'Copilot model B' },
|
|
145
|
+
'deepseek-chat': { provider: 'DeepSeek', name: 'DeepSeek Chat' }
|
|
146
|
+
};
|
|
147
|
+
let selected = 'auto';
|
|
148
|
+
let scenario = 'chat';
|
|
149
|
+
let childOverridden = false;
|
|
150
|
+
function render() {
|
|
151
|
+
for (const tab of ['chat', 'goal', 'child']) {
|
|
152
|
+
const element = document.querySelector(`#${tab}Tab`);
|
|
153
|
+
element.classList.toggle('active', scenario === tab);
|
|
154
|
+
element.setAttribute('aria-selected', String(scenario === tab));
|
|
155
|
+
}
|
|
156
|
+
const auto = selected === 'auto';
|
|
157
|
+
const parentModel = auto ? models['copilot-a'] : models[selected];
|
|
158
|
+
const real = auto && scenario === 'goal' ? models['copilot-b'] : parentModel;
|
|
159
|
+
const childModel = auto ? (childOverridden ? models['copilot-b'] : real) : parentModel;
|
|
160
|
+
trigger.textContent = `${parentModel.provider} · ${auto ? 'Auto' : parentModel.name} ⌄`;
|
|
161
|
+
document.querySelector('#realModel').textContent = `${auto ? 'Auto' : real.provider} · ${real.name}`;
|
|
162
|
+
document.querySelector('#userLabel').textContent = scenario === 'goal' ? 'Goal · continuation round 2' : scenario === 'child' ? 'Parent · delegate a task' : 'You · new turn';
|
|
163
|
+
document.querySelector('#userText').textContent = scenario === 'goal' ? 'Continue the goal: investigate the failing integration test and update the implementation.' : scenario === 'child' ? 'Investigate the regression in a separate subagent while I review the API change.' : 'Explain why this function returns an empty result.';
|
|
164
|
+
document.querySelector('#assistantText').textContent = scenario === 'goal' ? 'This is a new Goal round. I’ll investigate the failure, make a focused fix and run the relevant test.' : scenario === 'child' ? 'I’ll review the API change while the subagent investigates the regression.' : 'I’ll inspect the function and its call site, then explain the condition that produces the empty result.';
|
|
165
|
+
document.querySelector('#reason').textContent = auto ? (scenario === 'goal' ? 'Routing reason: broader debugging work · The model stays fixed for every step in round 2.' : scenario === 'child' ? 'Parent selected Auto · the native child inherits this turn’s resolved concrete model.' : 'Routing reason: bounded explanation · The model stays fixed through tools and follow-up steps in this turn.') : `Manual selection · Auto is off for ${parentModel.provider}.`;
|
|
166
|
+
const steps = document.querySelector('#scenarioSteps');
|
|
167
|
+
steps.hidden = scenario !== 'goal';
|
|
168
|
+
steps.innerHTML = scenario === 'goal'
|
|
169
|
+
? '<div class="goal-step">Round 1 · inspect the issue</div><div class="goal-step current">Round 2 · debug, fix and run tests (one model throughout)</div>'
|
|
170
|
+
: '';
|
|
171
|
+
document.querySelector('#childCard').hidden = scenario !== 'child';
|
|
172
|
+
document.querySelector('#childModel').textContent = `${auto && !childOverridden ? 'Inherited' : childModel.provider} · ${childModel.name}`;
|
|
173
|
+
document.querySelector('#childReason').textContent = auto ? childOverridden
|
|
174
|
+
? 'Explicit child model overrides Auto. The parent remains on Auto.'
|
|
175
|
+
: 'Native MVP behavior: the child inherits the parent’s resolved concrete model; independent child Auto is deferred.'
|
|
176
|
+
: `The child inherits ${parentModel.provider} / ${parentModel.name}; no Auto routing.`;
|
|
177
|
+
const override = document.querySelector('#childOverride');
|
|
178
|
+
override.hidden = !auto;
|
|
179
|
+
override.textContent = childOverridden ? 'Remove child override' : 'Preview explicit child override';
|
|
180
|
+
for (const option of options) {
|
|
181
|
+
const active = option.dataset.model === selected;
|
|
182
|
+
option.classList.toggle('active', active);
|
|
183
|
+
option.querySelector('.check').textContent = active ? '✓' : '';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
trigger.addEventListener('click', () => {
|
|
187
|
+
const open = picker.classList.toggle('open');
|
|
188
|
+
trigger.setAttribute('aria-expanded', String(open));
|
|
189
|
+
});
|
|
190
|
+
for (const option of options) option.addEventListener('click', () => {
|
|
191
|
+
selected = option.dataset.model;
|
|
192
|
+
childOverridden = false;
|
|
193
|
+
picker.classList.remove('open');
|
|
194
|
+
trigger.setAttribute('aria-expanded', 'false');
|
|
195
|
+
render();
|
|
196
|
+
});
|
|
197
|
+
document.querySelector('#chatTab').addEventListener('click', () => { scenario = 'chat'; render(); });
|
|
198
|
+
document.querySelector('#goalTab').addEventListener('click', () => { scenario = 'goal'; render(); });
|
|
199
|
+
document.querySelector('#childTab').addEventListener('click', () => { scenario = 'child'; render(); });
|
|
200
|
+
document.querySelector('#childOverride').addEventListener('click', () => { childOverridden = !childOverridden; render(); });
|
|
201
|
+
document.addEventListener('keydown', event => {
|
|
202
|
+
if (event.key === 'Escape') { picker.classList.remove('open'); trigger.setAttribute('aria-expanded', 'false'); }
|
|
203
|
+
});
|
|
204
|
+
render();
|
|
205
|
+
</script>
|
|
206
|
+
</body>
|
|
207
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
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.4.0-alpha.100",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public",
|
|
7
|
+
"registry": "https://registry.npmjs.org/",
|
|
8
|
+
"tag": "alpha"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/cloga/dsh-github-copilot.git"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./lib/types/index.d.ts",
|
|
18
|
+
"default": "./lib/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./client": {
|
|
21
|
+
"types": "./lib/types/client.d.ts",
|
|
22
|
+
"default": "./lib/client.js"
|
|
23
|
+
},
|
|
24
|
+
"./remote": {
|
|
25
|
+
"types": "./lib/types/remote.d.ts",
|
|
26
|
+
"default": "./lib/remote.js"
|
|
27
|
+
},
|
|
28
|
+
"./web-delegate": {
|
|
29
|
+
"types": "./lib/types/web-delegate.d.ts",
|
|
30
|
+
"default": "./lib/web-delegate.js"
|
|
31
|
+
},
|
|
32
|
+
"./routed-web": {
|
|
33
|
+
"types": "./lib/types/routed-web.d.ts",
|
|
34
|
+
"default": "./lib/routed-web.js"
|
|
35
|
+
},
|
|
36
|
+
"./manual-compaction-recovery": {
|
|
37
|
+
"types": "./lib/types/manual-compaction-recovery.d.ts",
|
|
38
|
+
"default": "./lib/manual-compaction-recovery.js"
|
|
39
|
+
},
|
|
40
|
+
"./deployment-baseline.json": "./deployment-baseline.json",
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"cordis.patch.yml",
|
|
45
|
+
"deployment-baseline.json",
|
|
46
|
+
"lib/*.js",
|
|
47
|
+
"lib/*.js.map",
|
|
48
|
+
"lib/types/**/*.d.ts",
|
|
49
|
+
"README.md",
|
|
50
|
+
"README.zh.md",
|
|
51
|
+
"CHANGELOG.md",
|
|
52
|
+
"CONTRIBUTING.md",
|
|
53
|
+
"SECURITY.md",
|
|
54
|
+
"AGENTS.md",
|
|
55
|
+
"docs/agent-readiness.md",
|
|
56
|
+
"docs/model-compatibility-acceptance.md",
|
|
57
|
+
"docs/single-route-migration.md",
|
|
58
|
+
"docs/session-search-routing.md",
|
|
59
|
+
"docs/npm-distribution.md",
|
|
60
|
+
"docs/dual-model.md",
|
|
61
|
+
"docs/official-first-016-alpha2.md",
|
|
62
|
+
"docs/official-first-020-rc1.md",
|
|
63
|
+
"docs/official-first-020-rc2.md",
|
|
64
|
+
"docs/web-lifecycle-rc2.md",
|
|
65
|
+
"docs/copilot-compaction.md",
|
|
66
|
+
"docs/manual-compaction-recovery.md",
|
|
67
|
+
"docs/copilot-usage.md",
|
|
68
|
+
"docs/copilot-accounts.md",
|
|
69
|
+
"docs/automatic-model-routing.md",
|
|
70
|
+
"docs/auto-task-routing.md",
|
|
71
|
+
"docs/image-input-compatibility.md",
|
|
72
|
+
"output/auto-model-mockup/index.html",
|
|
73
|
+
"docs/images/dual-model-provenance.json",
|
|
74
|
+
"scripts/check-search-composition.mjs",
|
|
75
|
+
"docs/images/"
|
|
76
|
+
],
|
|
77
|
+
"keywords": [
|
|
78
|
+
"dsh",
|
|
79
|
+
"deepseek-harness",
|
|
80
|
+
"plugin",
|
|
81
|
+
"cordis",
|
|
82
|
+
"github-copilot",
|
|
83
|
+
"oauth",
|
|
84
|
+
"model-provider",
|
|
85
|
+
"hosted-search",
|
|
86
|
+
"web-search",
|
|
87
|
+
"openai-responses",
|
|
88
|
+
"typescript"
|
|
89
|
+
],
|
|
90
|
+
"license": "MIT",
|
|
91
|
+
"engines": {
|
|
92
|
+
"node": ">=22.19.0",
|
|
93
|
+
"dsh": "0.2.0-rc.2"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
97
|
+
"@deepseek-ai/dsh-agent": "0.2.0-rc.2",
|
|
98
|
+
"@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.2",
|
|
99
|
+
"@deepseek-ai/dsh-commands": "0.2.0-rc.2",
|
|
100
|
+
"@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
|
|
101
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
|
|
103
|
+
"@deepseek-ai/dsh-authorization": "0.2.0-rc.2",
|
|
104
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
|
|
105
|
+
"@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.2",
|
|
106
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
|
|
107
|
+
"@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
|
|
108
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
|
|
109
|
+
"@deepseek-ai/dsh-llm": "0.2.0-rc.2",
|
|
110
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
|
|
111
|
+
"@deepseek-ai/dsh-session": "0.2.0-rc.2",
|
|
112
|
+
"@deepseek-ai/dsh-scope": "0.2.0-rc.2",
|
|
113
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.2",
|
|
114
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
|
|
115
|
+
"@deepseek-ai/dsh-web": "0.2.0-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-web-search-deepseek": "0.2.0-rc.2",
|
|
117
|
+
"@deepseek-ai/schemastery": "^3.18.4"
|
|
118
|
+
},
|
|
119
|
+
"peerDependenciesMeta": {
|
|
120
|
+
"@deepseek-ai/dsh-web-search-deepseek": {
|
|
121
|
+
"optional": true
|
|
122
|
+
},
|
|
123
|
+
"@deepseek-ai/dsh-launch-environment": {
|
|
124
|
+
"optional": true
|
|
125
|
+
},
|
|
126
|
+
"@deepseek-ai/dsh-api-remotes": {
|
|
127
|
+
"optional": true
|
|
128
|
+
},
|
|
129
|
+
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"@deepseek-ai/dsh-client-ui-settings-models": {
|
|
133
|
+
"optional": true
|
|
134
|
+
},
|
|
135
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
136
|
+
"optional": true
|
|
137
|
+
},
|
|
138
|
+
"@deepseek-ai/dsh-typert-protocol": {
|
|
139
|
+
"optional": true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"dependencies": {
|
|
143
|
+
"@earendil-works/pi-ai": "0.87.1",
|
|
144
|
+
"undici": "6.28.1",
|
|
145
|
+
"zod": "^4.4.3"
|
|
146
|
+
},
|
|
147
|
+
"devDependencies": {
|
|
148
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
149
|
+
"@deepseek-ai/dsh-agent": "0.2.0-rc.2",
|
|
150
|
+
"@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.2",
|
|
151
|
+
"@deepseek-ai/dsh-commands": "0.2.0-rc.2",
|
|
152
|
+
"@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
|
|
153
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
154
|
+
"@deepseek-ai/dsh-jobs": "0.2.0-rc.2",
|
|
155
|
+
"@deepseek-ai/dsh-api-gateway": "0.2.0-rc.2",
|
|
156
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
|
|
157
|
+
"@deepseek-ai/dsh-app-boot": "0.2.0-rc.2",
|
|
158
|
+
"@deepseek-ai/dsh-config-editor": "0.2.0-rc.2",
|
|
159
|
+
"@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
|
|
160
|
+
"@deepseek-ai/dsh-authorization": "0.2.0-rc.2",
|
|
161
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
|
|
162
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
|
|
163
|
+
"@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.2",
|
|
164
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
|
|
165
|
+
"@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
|
|
166
|
+
"@deepseek-ai/dsh-fs": "0.2.0-rc.2",
|
|
167
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
|
|
168
|
+
"@deepseek-ai/dsh-llm": "0.2.0-rc.2",
|
|
169
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
|
|
170
|
+
"@deepseek-ai/dsh-scope": "0.2.0-rc.2",
|
|
171
|
+
"@deepseek-ai/dsh-session": "0.2.0-rc.2",
|
|
172
|
+
"@deepseek-ai/dsh-session-format-catalog": "0.2.0-rc.2",
|
|
173
|
+
"@deepseek-ai/dsh-session-projection": "0.2.0-rc.2",
|
|
174
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.2",
|
|
175
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
|
|
176
|
+
"@deepseek-ai/dsh-tool-web": "0.2.0-rc.2",
|
|
177
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.2",
|
|
178
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
|
|
179
|
+
"@deepseek-ai/dsh-typert-registry": "0.2.0-rc.2",
|
|
180
|
+
"@deepseek-ai/dsh-web": "0.2.0-rc.2",
|
|
181
|
+
"@deepseek-ai/dsh-web-search-deepseek": "0.2.0-rc.2",
|
|
182
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
183
|
+
"@types/node": "^22.0.0",
|
|
184
|
+
"@types/react": "~18.3.1",
|
|
185
|
+
"@types/react-dom": "18.3.7",
|
|
186
|
+
"jsdom": "^26.1.0",
|
|
187
|
+
"react": "^18.2.0",
|
|
188
|
+
"react-dom": "18.3.1",
|
|
189
|
+
"tsdown": "^0.22.2",
|
|
190
|
+
"typescript": "^5.9.0",
|
|
191
|
+
"unrun": "^0.3.1",
|
|
192
|
+
"vitest": "^3.2.0"
|
|
193
|
+
},
|
|
194
|
+
"main": "lib/index.js",
|
|
195
|
+
"types": "lib/types/index.d.ts",
|
|
196
|
+
"imports": {
|
|
197
|
+
"#package.json": "./package.json"
|
|
198
|
+
},
|
|
199
|
+
"dsh": {
|
|
200
|
+
"bundle": {
|
|
201
|
+
"patch": "./cordis.patch.yml"
|
|
202
|
+
},
|
|
203
|
+
"client": {
|
|
204
|
+
"external": [
|
|
205
|
+
"react"
|
|
206
|
+
],
|
|
207
|
+
"inject": [
|
|
208
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
209
|
+
"@deepseek-ai/dsh-client-ui-settings-models"
|
|
210
|
+
],
|
|
211
|
+
"platform": "web"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"scripts": {
|
|
215
|
+
"build": "pnpm clean && tsc -p tsconfig.json && tsdown",
|
|
216
|
+
"clean": "node -e \"require('node:fs').rmSync('lib', { recursive: true, force: true })\"",
|
|
217
|
+
"test": "vitest run",
|
|
218
|
+
"test:watch": "vitest",
|
|
219
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
220
|
+
"typecheck:tests": "tsc -p tsconfig.tests.json",
|
|
221
|
+
"test:scripts": "node --test \"tests/scripts/*.test.mjs\"",
|
|
222
|
+
"agent:describe": "node scripts/agent.mjs describe --json",
|
|
223
|
+
"agent:doctor": "node scripts/agent.mjs doctor --json",
|
|
224
|
+
"agent:plan": "node scripts/agent.mjs plan",
|
|
225
|
+
"preflight:search": "node scripts/check-search-composition.mjs",
|
|
226
|
+
"verify:agent": "node scripts/verify-agent-contract.mjs",
|
|
227
|
+
"verify:tarball": "node scripts/verify-tarball.mjs",
|
|
228
|
+
"verify:baseline": "node scripts/verify-deployment-baseline.mjs",
|
|
229
|
+
"verify:package": "node scripts/verify-package.mjs",
|
|
230
|
+
"verify:controlled-core": "node scripts/verify-controlled-core.mjs",
|
|
231
|
+
"verify:reasoning-ui": "node scripts/verify-reasoning-presentation.mjs",
|
|
232
|
+
"verify:upstream": "node scripts/verify-upstream-baseline.mjs",
|
|
233
|
+
"release:check": "node scripts/release-policy.mjs",
|
|
234
|
+
"verify": "pnpm verify:agent && pnpm typecheck && pnpm typecheck:tests && pnpm verify:baseline && pnpm build && pnpm test && pnpm test:scripts && pnpm verify:package"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -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
|
+
}
|