dsh-github-copilot 0.4.0-alpha.65 → 0.4.0-alpha.66

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 CHANGED
@@ -236,6 +236,8 @@ Never say GPT-6/search works merely because settings, typecheck or a package imp
236
236
 
237
237
  ## Changing capabilities
238
238
 
239
+ Explicit parent-model following is a source candidate tracked in #229. `github-copilot.parentModelFollow` binds named native child/direct-parent Session IDs; the default is empty. `src/parent-model-follow.ts` and the Auto Host integration use public projections and per-turn scoped routing, never descriptor/history/default writes. Child-owned explicit selections win, fork seeds are not child overrides, and only enrolled native `spawn` children with supported managed parent routes participate. Preserve the native behavior of unenrolled Sessions and all historical dedicated role policies. Full native Team/runtime qualification remains pending; do not describe the candidate as released or general automatic inheritance. See `docs/automatic-model-routing.md`.
240
+
239
241
  Model preferences must survive the Client's owned-field projection before strict decoding. `excludedModelIds` is a hidden volatile Config leaf, read via `readInlineConfig`; exercise native SettingsForms CAS, fiber preservation and restart persistence, not only map-backed settings mocks. Missing preference/selection evidence leaves model rows read-only with named diagnostics and status-only Retry. Unknown exclusion state is not an empty exclusion set. Discovery diagnostics stay in a separate Manage disclosure.
240
242
 
241
243
  Auto history compatibility (alpha.54, #204): official rc.2 `Session.append()` has no public ignorable-envelope option. Do not emit optional `github-copilot/auto-model-decision` events or borrow another event type; retain native real-model provenance and durable Auto selection without new durable decision recording. The assistant-actions selection footer reads bounded Host-lifetime decisions through native agent-scoped lookup and compatible historical events. Explicit captured fixed selection alone proves Manual; missing evidence is unknown, never reconstructed from today's picker. Do not repeat model names, add Model details, change native Usage/context metering or modify parent DOM. `scripts/repair-auto-model-history.mjs` is explicit source-checkout maintenance, not a runtime hook: strict pinned official v4 validation, check-only by default, optional detached repaired copy plus byte-exact backup. It never replaces live history. Applying a copy requires separately approved stopped writers and a fresh source-hash check. See `docs/automatic-model-routing.md`.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0-alpha.66 (prepared)
4
+
5
+ - Add explicit native child/direct-parent model-follow bindings, disabled by default. Enrolled children follow fixed selections on their next turn or independently resolve the parent's Auto preference against their own context (#229).
6
+ - Preserve in-flight turn routing, explicit child selections, native histories, defaults, credentials and permissions. Unknown lineage, unsupported children and missing parent evidence fail with named diagnostics rather than guessed models.
7
+ - Record exact-source inheritance research, configuration boundaries and validation limits. Native creation labels are not rewritten, and existing children are never automatically enrolled.
8
+
3
9
  ## 0.4.0-alpha.65 (prepared)
4
10
 
5
11
  - Fix Auto input undercount by using Core's public TokenMeter instead of passing Core messages to pi-ai's incompatible estimator and swallowing its errors (#230). Include assistant reasoning/tool history and retain native current-surface/tool-envelope measurement as a conservative floor.
package/README.md CHANGED
@@ -98,7 +98,7 @@ The Host reads GitHub's internal quota endpoint using the existing canonical OAu
98
98
 
99
99
  ## Install and sign in
100
100
 
101
- The commands below target the package version `0.4.0-alpha.65`. Versioned URLs describe the intended release artifacts, not proof that publication or local activation has completed; use them only once that Release and its checksums are available. Install into the profile you use (replace `web` when targeting another profile):
101
+ The commands below target the package version `0.4.0-alpha.66`. Versioned URLs describe the intended release artifacts, not proof that publication or local activation has completed; use them only once that Release and its checksums are available. Install into the profile you use (replace `web` when targeting another profile):
102
102
 
103
103
  Before installing/updating, unpack the **checksum-verified** archive into a temporary directory and run its read-only composition preflight (replace all paths with absolute paths for the intended profile):
104
104
 
@@ -111,10 +111,10 @@ Include any launcher patch files with repeated `--patch /absolute/file` argument
111
111
  For a standalone named profile only, the supported CLI command is:
112
112
 
113
113
  ```sh
114
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/dsh-github-copilot-0.4.0-alpha.65.tgz
114
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.66/dsh-github-copilot-0.4.0-alpha.66.tgz
115
115
  ```
116
116
 
117
- For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.65` after the same preflight and only when registry access is permitted. Desktop reserves its `desktop` profile from CLI management. If registry access is blocked or unavailable, stop; the documented [controlled offline CLI procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles) is not a Desktop workaround.
117
+ For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.66` after the same preflight and only when registry access is permitted. Desktop reserves its `desktop` profile from CLI management. If registry access is blocked or unavailable, stop; the documented [controlled offline CLI procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles) is not a Desktop workaround.
118
118
 
119
119
  Then open the Models UI listed above, find **GitHub Copilot**, select **Sign in**, and complete the GitHub device-code flow. Plugin installation changes the selected profile; activation follows that profile's normal reload/restart policy.
120
120
 
@@ -130,7 +130,9 @@ If preferences cannot be read, available account rows remain visible but read-on
130
130
 
131
131
  ### Auto model routing
132
132
 
133
- The managed GitHub Copilot group includes **Auto · Balance**, **Auto · Efficiency**, and **Auto · Intelligence** as flat virtual picker rows. They share one account-verified eligible pool after applying exact model exclusions. Before preference, routing evaluates input headroom against each candidate's hard input budget, filtering out candidates that cannot accommodate current messages. Soft preferences distribute across upper/lower/center candidate bands using deterministic in-memory seeds to avoid monopolizing a single top candidate across Sessions. If no candidate fits, Auto selects the largest input capacity model and triggers compaction pressure on compressible history; if exclusions leave no eligible model, Auto fails closed. Auto resolves once per Core turn to a real model; every tool step, retry and automatic compaction recovery in that turn stays on that model, while a later Chat or Goal turn may choose again. Image turns require a non-excluded account-verified image-capable candidate. New turns retain Core's actual model/usage details without adding unsafe plugin events. Search keeps its independent provider-owned model policy, and subagents / Team teammates continue to inherit Core's concrete route rather than being relabeled as Auto. See the [policy and mockup](./docs/automatic-model-routing.md). The nested management disclosure is plugin-owned; Core's picker remains flat.
133
+ **Source candidate, not yet released:** `github-copilot.parentModelFollow` can explicitly enroll native `spawn` children using `{ childSessionId, parentSessionId }` bindings. Enrolled members follow a fixed parent model at their next turn, or independently resolve the parent's exact Auto preference against their own context. The current turn is frozen; child-owned explicit selections win. The default is `[]`, so no existing member is automatically enrolled. See [configuration, limitations and validation status](./docs/automatic-model-routing.md#plugin-only-candidate-explicit-per-child-follow-policy). Native Team creation labels are not rewritten.
134
+
135
+ The managed GitHub Copilot group includes **Auto · Balance**, **Auto · Efficiency**, and **Auto · Intelligence** as flat virtual picker rows. They share one account-verified eligible pool after applying exact model exclusions. Before preference, routing evaluates input headroom against each candidate's hard input budget, filtering out candidates that cannot accommodate current messages. Soft preferences distribute across upper/lower/center candidate bands using deterministic in-memory seeds to avoid monopolizing a single top candidate across Sessions. If no candidate fits, Auto selects the largest input capacity model and triggers compaction pressure on compressible history; if exclusions leave no eligible model, Auto fails closed. Auto resolves once per Core turn to a real model; every tool step, retry and automatic compaction recovery in that turn stays on that model, while a later Chat or Goal turn may choose again. Image turns require a non-excluded account-verified image-capable candidate. New turns retain Core's actual model/usage details without adding unsafe plugin events. Search keeps its independent provider-owned model policy. Today, native subagents and Team teammates initialize from the parent's latest recorded request route (or creation options before its first request); this is not a live link, and a route snapshot does not prove Auto intent. The requested per-child-turn inheritance behavior and Core/plugin boundary are documented in the [policy](./docs/automatic-model-routing.md#requested-parent-to-child-selection-inheritance). The nested management disclosure is plugin-owned; Core's picker remains flat.
134
136
 
135
137
  Completed Copilot replies show **Auto (preference)** and an expandable recorded reason after native Usage/time, or **Manual** only with captured explicit fixed-selection evidence. Missing evidence shows **Selection unknown**, never a guess from today's picker. There is no repeated model name or separate Model details button: actual model display stays in native Usage, whose missing-route behavior is unchanged. New selection records are bounded and Host-local; restart, disposal or eviction loses them. Compatible historical Auto records remain readable. The public assistant-actions slot supports internal wrapping only, not changing the native fixed-height row.
136
138
 
@@ -163,7 +165,7 @@ Agents should treat the browser authorization as a human handoff, not as a token
163
165
  5. Confirm **Signed in** and inspect the automatic discovery result before asking the user to choose a model. Already-signed-in Models opening ensures missing/stale metadata automatically; fresh ready cache makes no request. Use visible **Retry** for errors or **Manage → Refresh models** for an intentional forced update, not routine setup. Status alone does not discover, and login, metadata and successful model calls remain separate evidence.
164
166
  6. Use **Sign out** only when the user explicitly asks to disconnect the account. It deletes the Copilot credential record but preserves route settings.
165
167
 
166
- GitHub Releases and npm are the default distribution channels for each new version, using the same verified tarball. Pin the version and verify the evidence for the channel used: Release `SHA256SUMS`, and npm `dist.integrity` when installing from npm. Install into Desktop profiles only through Desktop's native package manager; the reserved `desktop` profile is not managed by the DSH CLI. After npm publication is verified, the native manager accepts `dsh-github-copilot@0.4.0-alpha.65`, not a URL or file. Controlled offline CLI maintenance is documented for standalone named profiles only, never Desktop-managed profiles. Follow the mandatory search-composition preflight, backup, single-writer and post-install checks; do not bypass a corporate registry ban, disable TLS verification or restart without separate approval. See [distribution and publication requirements](./docs/npm-distribution.md).
168
+ GitHub Releases and npm are the default distribution channels for each new version, using the same verified tarball. Pin the version and verify the evidence for the channel used: Release `SHA256SUMS`, and npm `dist.integrity` when installing from npm. Install into Desktop profiles only through Desktop's native package manager; the reserved `desktop` profile is not managed by the DSH CLI. After npm publication is verified, the native manager accepts `dsh-github-copilot@0.4.0-alpha.66`, not a URL or file. Controlled offline CLI maintenance is documented for standalone named profiles only, never Desktop-managed profiles. Follow the mandatory search-composition preflight, backup, single-writer and post-install checks; do not bypass a corporate registry ban, disable TLS verification or restart without separate approval. See [distribution and publication requirements](./docs/npm-distribution.md).
167
169
 
168
170
  **Desktop package-update and Web-lifecycle boundaries:** the native manager's `restart-required` result for an in-place installed-package upgrade is authoritative and distinct from plugin-bundle removal/re-add behavior. Any disable, removal, or upgrade involving service recomposition (`cordis.patch.yml`, such as the isolated routed web search layer) may leave dependent entries pending until Desktop is fully exited and cold-restarted. If the native manager reports only entries such as `pending (waiting for service: web)` while this plugin already shows **Off**, the requested disabled state has been persisted; cold-restart Desktop instead of repeatedly toggling or reinstalling the plugin. Other errors are not covered by this guidance and must still be investigated.
169
171
 
@@ -438,8 +440,8 @@ Report the published Release URL, version, tag/commit and verified asset SHA-256
438
440
  `package.json` declares public npm distribution. A release tag must equal `v${package.json.version}`. Versions use standard SemVer prerelease labels (`alpha`, `beta`, or `rc`), each with its matching npm dist-tag; only stable versions use `latest`. The Release workflow performs the frozen install and complete verification gate, packs once (or recovers the original archive on retry), verifies `SHA256SUMS`, publishes the immutable GitHub Release and then publishes those same bytes to npm through OIDC. Either channel failing means delivery is incomplete. First package creation needs an authorized maintainer; staging requires an existing package and is not a first-package bootstrap. Historical releases are not republished.
439
441
 
440
442
  ```sh
441
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/dsh-github-copilot-0.4.0-alpha.65.tgz
442
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/SHA256SUMS
443
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.66/dsh-github-copilot-0.4.0-alpha.66.tgz
444
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.66/SHA256SUMS
443
445
  sha256sum --check SHA256SUMS
444
446
  ```
445
447
 
@@ -447,7 +449,7 @@ PowerShell can verify the same two downloaded files with:
447
449
 
448
450
  ```powershell
449
451
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
450
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.65.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
452
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.66.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
451
453
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
452
454
  ```
453
455
 
package/README.zh.md CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  截图来自当前构建 Client 的隔离浏览器 fixture,使用合成 Provider。它只证明已发布配置界面的形态,不证明真实凭据、账号权限、搜索成功或当前 Desktop 已加载。
22
22
 
23
- > 当前文档与安装命令对应版本 `0.4.0-alpha.65`。源码、发布制品、已安装版本和实际加载运行时需分别确认;本地升级和中断会话的重启仍需用户批准。
23
+ > 当前文档与安装命令对应版本 `0.4.0-alpha.66`。源码、发布制品、已安装版本和实际加载运行时需分别确认;本地升级和中断会话的重启仍需用户批准。
24
24
 
25
25
  Web search 路由现在优先显示在插件详情页;宿主不支持详情页插槽时才回退到 **设置 → 模型**或独立 Web search section。搜索子 Fiber 仍独立等待 Remote,不影响账号控件和既有搜索安全检查。
26
26
 
@@ -113,10 +113,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
113
113
  仅对独立的具名 profile,获准且网络可用时,可通过受支持的 CLI 命令安装:
114
114
 
115
115
  ```sh
116
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/dsh-github-copilot-0.4.0-alpha.65.tgz
116
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.66/dsh-github-copilot-0.4.0-alpha.66.tgz
117
117
  ```
118
118
 
119
- Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.65`。Desktop 保留 `desktop` profile,CLI 不负责管理。若 registry 被公司封禁或不可用,不要更换网络绕行或使用离线 CLI;请停止。[受控离线 CLI 流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)仅适用于独立具名 profile,不适用于 Desktop。
119
+ Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.66`。Desktop 保留 `desktop` profile,CLI 不负责管理。若 registry 被公司封禁或不可用,不要更换网络绕行或使用离线 CLI;请停止。[受控离线 CLI 流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)仅适用于独立具名 profile,不适用于 Desktop。
120
120
 
121
121
  随后打开上表对应的 Models UI,找到 **GitHub Copilot**,点击 **Sign in** 并完成 GitHub device-code 流程。安装会修改指定 profile;是否立即激活取决于该 profile 的常规 reload/restart 策略。
122
122
 
@@ -132,7 +132,9 @@ Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理
132
132
 
133
133
  ### Auto 模型路由
134
134
 
135
- 托管 GitHub Copilot 分组提供三个平铺的虚拟选择:**Auto · Balance**(均衡)、**Auto · Efficiency**(效率)和 **Auto · Intelligence**(智能)。三档先应用精确模型排除,再共用当前账号验证过的合格模型池。在应用偏好前,路由会根据候选模型的硬输入预算计算输入余量,剔除无法容纳当前消息的候选。软偏好通过确定性内存种子在候选区间(上段/下段/中段)内分布,避免单一顶配模型跨 Session 被垄断。若所有候选均超限,Auto 会选择输入容量最大的模型并对可压缩历史触发 compaction pressure;若排除后没有任何合格模型,则 Auto 关闭式失败。Auto 在每个 Core turn 只解析一次;同轮工具步骤、重试和自动 compact 恢复使用同一真实模型,新轮次可重新选择。图片轮次必须有未被排除且已验证的图片候选。新轮次保留 Core 的真实模型/用量信息,不追加不兼容的插件事件。搜索仍由独立策略管理;原生子代理与 Team 队友继承 Core 的具体模型,不被重新标为 Auto。详见[策略与 mockup](./docs/automatic-model-routing.md)。嵌套管理折叠区由插件提供;Core picker 仍保持平铺。
135
+ **源码候选功能,尚未发布:** `github-copilot.parentModelFollow` 可通过 `{ childSessionId, parentSessionId }` 配置明确授权原生 `spawn` 子成员跟随父 Agent。已授权成员在下一轮跟随父 Agent 的固定模型,或继承其准确的 Auto 偏好并按自身上下文独立选模;当前轮次不变,子成员自己的显式选择优先。默认 `[]`,不会自动接管已有成员。参见[配置、限制与验证状态](./docs/automatic-model-routing.md#plugin-only-candidate-explicit-per-child-follow-policy)。原生 Team 的创建时模型标签不会被改写。
136
+
137
+ 托管 GitHub Copilot 分组提供三个平铺的虚拟选择:**Auto · Balance**(均衡)、**Auto · Efficiency**(效率)和 **Auto · Intelligence**(智能)。三档先应用精确模型排除,再共用当前账号验证过的合格模型池。在应用偏好前,路由会根据候选模型的硬输入预算计算输入余量,剔除无法容纳当前消息的候选。软偏好通过确定性内存种子在候选区间(上段/下段/中段)内分布,避免单一顶配模型跨 Session 被垄断。若所有候选均超限,Auto 会选择输入容量最大的模型并对可压缩历史触发 compaction pressure;若排除后没有任何合格模型,则 Auto 关闭式失败。Auto 在每个 Core turn 只解析一次;同轮工具步骤、重试和自动 compact 恢复使用同一真实模型,新轮次可重新选择。图片轮次必须有未被排除且已验证的图片候选。新轮次保留 Core 的真实模型/用量信息,不追加不兼容的插件事件。搜索仍由独立策略管理。目前原生子代理与 Team 队友会以 master 最近记录的请求 route 初始化(master 尚未发出请求时回退到创建配置);这不是随 master 后续选择自动变化的动态关联,route 快照也不能证明 Auto 意图已继承。每轮跟随 master 固定模型、或让子代理按自身上下文独立执行 Auto 的目标行为及 Core/插件边界,见[设计记录](./docs/automatic-model-routing.md#requested-parent-to-child-selection-inheritance)。嵌套管理折叠区由插件提供;Core picker 仍保持平铺。
136
138
 
137
139
  已完成的 Copilot 回复在原生 Usage/时间后显示 **Auto(偏好)**,点信息按钮查看本轮记录的选择原因;只有捕获到明确固定选择才显示**手动**。缺记录显示**选择方式未知**,不借当前 picker 推断历史。不重复模型名、不另设 Model details 按钮:实际模型仍由原生 Usage 显示,其缺失归属行为未改变。新选择记录仅限当前 Host 内存且有容量上限,重启、释放 Agent 或淘汰后会丢失;兼容历史 Auto 记录仍可读取。公开 assistant-actions slot 只允许插件内部换行,不能改变原生固定高度尾栏。
138
140
 
@@ -165,7 +167,7 @@ Agent 应把浏览器授权视为需要用户完成的 handoff,而不是自行
165
167
  5. 确认 **Signed in** 并检查自动发现结果,再请用户选择模型。已登录时打开 Models 会自动确保缺失/过期元数据,新鲜 ready 缓存不发请求。错误可使用 **Retry**,有意强制更新时使用 **Manage → Refresh models**,不作为常规设置步骤。状态读取本身不发现;登录、元数据与真实调用成功是独立证据。
166
168
  6. 只有用户明确要求断开账号时才使用 **Sign out**;它会删除 Copilot credential record,但保留 route settings。
167
169
 
168
- 每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.65`,不是 URL 或本地文件。Desktop 保留 `desktop` profile,不能通过 DSH CLI 管理。受控离线 CLI 维护仅适用于独立具名 profile,不得作为 Desktop 安装绕行方案。[双渠道发布与 OIDC 要求](./docs/npm-distribution.md)保持不变。
170
+ 每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.66`,不是 URL 或本地文件。Desktop 保留 `desktop` profile,不能通过 DSH CLI 管理。受控离线 CLI 维护仅适用于独立具名 profile,不得作为 Desktop 安装绕行方案。[双渠道发布与 OIDC 要求](./docs/npm-distribution.md)保持不变。
169
171
 
170
172
  **Desktop package 更新与 Web 生命周期边界:**原生 manager 对已安装 package 原位升级返回的 `restart-required` 是权威结果,与移除/重加 plugin bundle 的行为是两个不同问题。涉及服务重编排补丁(`cordis.patch.yml`,如本插件所采用的隔离路由 Web 搜索层)的停用、移除或升级,可能让依赖条目保持 pending,直到完全退出并冷重启 Desktop。若原生 manager 只报告类似 `pending (waiting for service: web)` 的条目,同时本插件已经显示 **Off**,说明请求的停用状态已经落盘;请冷重启 Desktop,不要反复切换或重装插件。其它错误不属于此提示范围,仍需单独排查。
171
173
 
@@ -449,8 +451,8 @@ node scripts/agent.mjs attribution "DeepSeek Harness (DSH)"
449
451
  `package.json` 声明公开 npm 分发。Release tag 必须严格等于 `v${package.json.version}`。预发布使用 `alpha`、`beta` 或 `rc` 及对应 npm dist-tag,只有稳定版使用 `latest`。Release workflow 执行 frozen install 和完整门禁,只打包一次(重试恢复原始归档),验证 `SHA256SUMS`,发布不可变 GitHub Release,再通过 OIDC 将同一份字节发布到 npm。任一渠道失败都表示交付未完成。首次建包须由获准环境中的维护者完成;staging 要求包已存在,不能代替首次建包。不会批量补发历史版本。
450
452
 
451
453
  ```sh
452
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/dsh-github-copilot-0.4.0-alpha.65.tgz
453
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/SHA256SUMS
454
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.66/dsh-github-copilot-0.4.0-alpha.66.tgz
455
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.66/SHA256SUMS
454
456
  sha256sum --check SHA256SUMS
455
457
  ```
456
458
 
@@ -458,7 +460,7 @@ PowerShell 可以对已下载的同一组文件执行:
458
460
 
459
461
  ```powershell
460
462
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
461
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.65.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
463
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.66.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
462
464
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
463
465
  ```
464
466
 
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "package": {
10
10
  "name": "dsh-github-copilot",
11
- "version": "0.4.0-alpha.65"
11
+ "version": "0.4.0-alpha.66"
12
12
  },
13
13
  "evidence": {
14
14
  "kind": "source-and-synthetic-test-inventory",
@@ -998,6 +998,8 @@
998
998
  "sourceMarkers": [
999
999
  {"file": "src/preview-route.ts", "marker": "GITHUB_COPILOT_AUTO_MODEL_ID"},
1000
1000
  {"file": "src/auto-model-host.ts", "marker": "keep attribution out of the log"},
1001
+ {"file": "src/parent-model-follow.ts", "marker": "resolveParentModel"},
1002
+ {"file": "src/config.ts", "marker": "parentModelFollow"},
1001
1003
  {"file": "src/auto-model-host.ts", "marker": "COPILOT_AUTO_TOKEN_METER_UNAVAILABLE"},
1002
1004
  {"file": "src/auto-model-presentation.ts", "marker": "conversation.chat.assistant-actions"},
1003
1005
  {"file": "src/auto-model-presentation.ts", "marker": "turnModelProvenanceDefinition"},
@@ -1007,6 +1009,8 @@
1007
1009
  {"file": "docs/automatic-model-routing.md", "marker": "plugin-only"}
1008
1010
  ],
1009
1011
  "tests": [
1012
+ {"file": "tests/auto-model-host.spec.ts", "name": "follows fixed and Auto parents at turn boundaries without writing child selections"},
1013
+ {"file": "tests/scripts/parent-model-follow.test.mjs", "name": "explicit same-model and different-model child selections both win"},
1010
1014
  {"file": "tests/auto-model-routing.spec.ts", "name": "classifies only the latest user turn and selects a deterministic capacity tier"},
1011
1015
  {"file": "tests/auto-model-routing.spec.ts", "name": "does not discard a complete Core assistant message when it contains reasoning"},
1012
1016
  {"file": "tests/auto-model-routing.spec.ts", "name": "retains the native current-surface and tool-envelope measurement as an input floor"},
@@ -140,16 +140,131 @@ The compressed output keeps the header in its own first zstd frame, as required
140
140
 
141
141
  General native subagent Auto inheritance is **not** in the base MVP.
142
142
 
143
- In official DSH 0.2.0-rc.2, `TeamRoster.spawn` calls `ctx.subagents.startContinuable` without `request.agentOptions`. Core's `resolveChildAgentOptions` snapshots the parent's resolved concrete route into the teammate's options and durable descriptor. Public Core evidence cannot distinguish an inherited concrete snapshot from an explicit concrete override. The plugin must not relabel that concrete child route as Auto or write a fabricated child selection.
143
+ In official DSH 0.2.0-rc.2, `TeamRoster.spawn` calls `ctx.subagents.startContinuable` without `request.agentOptions`. Core initializes the child from the parent's latest recorded request route, falling back to the parent's creation options before it has made a request, and records the resulting child options in its descriptor. This is creation-time inheritance, not a live link to the parent's selection. A recorded concrete route alone does not establish whether it came from an inherited selection or an explicit child override, and a resolved route does not prove the parent had no pending Auto intent. The plugin must not relabel a child route as Auto or write fabricated selection history.
144
144
 
145
- The implementation preserves native behavior:
145
+ Without explicit `parentModelFollow` enrollment, the plugin preserves native child routing behavior:
146
146
 
147
147
  - a child with an explicit model override uses that model;
148
- - a child or Team teammate without an override inherits Core's resolved concrete route;
148
+ - a new child or Team mate without an override starts with Core's parent-route snapshot and fallback behavior;
149
+ - later parent changes do not retarget an existing child through the native continuation path;
149
150
  - the child UI shows the real model truthfully;
150
151
  - no plugin code claims independent child Auto classification.
151
152
 
152
- A later plugin-owned delegation entry may carry explicit Auto intent in its own public descriptor and let each child classify independently, but only after cold-resume and override precedence are proven without Core changes.
153
+ ## Requested parent-to-child selection inheritance
154
+
155
+ The desired behavior is for native subagents and Team mates to follow the master's **effective selection on each new child turn**, not only snapshot the route that was effective when the child was created:
156
+
157
+ - An explicit child model override takes precedence over inheritance.
158
+ - At child creation, an enrolled child starts from the parent's effective selection. On each later child turn, the follow-policy resolver reads its direct parent's current effective selection unless the child has an explicit override.
159
+ - If the parent is fixed to a model, the next child turn follows that provider/model. If the parent is Auto, the child retains Auto intent and independently resolves a model for its own turn; it must not be pinned to the parent's concrete model for that turn.
160
+ - A route is stable within a turn: changing the parent while a child turn is running does not hot-swap an in-flight request. The new parent selection applies when the child begins its next turn.
161
+ - The implementation must retain provenance that distinguishes inherited Auto, inherited fixed selection, and an explicit child override across child creation, message delivery, and cold resume. A concrete model ID alone cannot prove Auto intent.
162
+
163
+ ### Implementation sketch and boundary
164
+
165
+ This is a requested product direction, not current behavior. A native implementation would carry an explicit inheritance mode and parent/override provenance, then resolve the parent's current effective selection at the start of each new child turn. For Auto, the child must invoke its own per-turn Auto resolution against its own messages and capabilities. Explicit child selection remains authoritative. The resolver must use the live parent's selected/requested model state, not the global default, and must fail visibly when parent evidence is missing rather than guess from a stale concrete child route. The open [Core PR #95](https://github.com/cloga/deepseek-harness/pull/95) proposes creation-time route rules for new children; its design preserves existing children on later messages and does not establish per-turn parent-following or inherited Auto intent.
166
+
167
+ The plugin has public request-selection middleware seams. The candidate implementation below uses them for explicitly enrolled native `spawn` children, rather than claiming automatic inference of creation-time intent. General transparent enrollment is not implemented. Actual request routes remain authoritative; native Team labels are not rewritten.
168
+
169
+ ### October 2 investigation: routing is possible; automatic enrollment is ambiguous
170
+
171
+ Tracking: [#229](https://github.com/cloga/dsh-github-copilot/issues/229).
172
+ The target remains unchanged official `0.2.0-rc.2`, commit
173
+ `639ed015397290b3745d163aafe02ffee4aa3f84`, not the proposed Core branch.
174
+
175
+ | Exact source | Finding |
176
+ | --- | --- |
177
+ | [child-agent.ts](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/subagent/subagent/src/child-agent.ts) | `parentAgentOptionsForDelegation` reads the latest request header before creation options. `resolveChildAgentOptions` merges overrides and discards whether an equal route was explicit. |
178
+ | [continuation.ts](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/subagent/subagent/src/continuation.ts) | Creation snapshots resolved options; cold resume reconstructs them from the descriptor. No next-turn parent-model recapture is performed here. |
179
+ | [descriptor.ts](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/subagent/subagent/src/descriptor.ts) | Descriptor v3 stores resolved route/effort, not follow/override provenance, and rejects unknown fields. |
180
+ | [model-selection.ts](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/core/agent/src/model-selection.ts) | Public `installModelSelection` couples scoped prompt assembly and request routing, clears inherited effort, and supports disposal. Its snapshot boundary is a step, so a follow policy must additionally freeze selection for a whole child turn. |
181
+ | [subagent index.ts](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/subagent/subagent/src/index.ts) and [lifecycle.ts](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/subagent/subagent/src/lifecycle.ts) | Public start/end notifications describe published runs; they are not a before-create interceptor exposing original override intent. The activation observer is package-private. |
182
+
183
+ An isolated Node 24 experiment executed the unchanged child-option resolver,
184
+ descriptor functions, and public selection middleware from that commit. Each
185
+ downloaded file's Git blob SHA was checked against the GitHub contents response
186
+ before execution. TypeScript was stripped with Node's compiler; depth, JSON
187
+ snapshot, message constructors, and the event context were synthetic dependencies.
188
+ Six assertions passed:
189
+
190
+ 1. Omitted overrides and an explicit provider/model equal to the parent produce identical resolved options and identical durable descriptors.
191
+ 2. Changing the parent's recorded route changes a newly resolved child, not the previously captured descriptor.
192
+ 3. A concrete parent request header takes precedence over Auto creation options.
193
+ 4. Before the first parent request, Auto survives the creation-options fallback.
194
+ 5. Adding an invented `followParent` descriptor field is rejected by the official reader.
195
+ 6. Public model-selection middleware applies a fixed route, forwards virtual Auto on subsequent assembly, clears inherited effort, and removes its listeners on disposal.
196
+
197
+ These are exact-function experiments, not full Core activation, real Team turns,
198
+ cold-resume integration, or model transport evidence. In particular, forwarding
199
+ an Auto ID does not by itself prove child-specific Auto resolution.
200
+
201
+ The first result is a counterexample to automatic override detection: two
202
+ different user intentions yield the same observable child state. Comparing
203
+ parent/child model IDs, inspecting only `Agent.options`, or treating a missing
204
+ child picker event as inheritance cannot implement the stated precedence for
205
+ every existing child. Request middleware does not recover the lost information.
206
+
207
+ ### Plugin-only candidate: explicit per-child follow policy
208
+
209
+ **Opt-in plugin implementation; transparent enrollment remains unsupported.**
210
+ Do not silently enroll all existing children or treat a new setting as proof of
211
+ their original creation intent. `github-copilot.parentModelFollow` defaults to
212
+ an empty array. The standard plugin configuration accepts explicit bindings:
213
+
214
+ ```json
215
+ {
216
+ "parentModelFollow": [
217
+ { "childSessionId": "<native-child-session-id>", "parentSessionId": "<direct-parent-session-id>" }
218
+ ]
219
+ }
220
+ ```
221
+
222
+ These are native DSH Session IDs, not role names, model IDs, or Copilot App
223
+ session handles. A binding authorizes replacement of the child's captured
224
+ creation route. No binding is added by installation or discovery. Existing
225
+ child-owned `model/selection` events take precedence, even for a same-model
226
+ selection; enrollment does not clear them. Remove the binding to return to
227
+ native routing at the next turn. Settings changes during an already captured
228
+ turn do not interrupt or change its route.
229
+
230
+ - A user explicitly enrolls a child Session through the native plugin configuration and its path-level settings writes, or leaves it under native selection. Bindings live only in this plugin's configuration. Do not add descriptor fields or new Session history events.
231
+ - A pure Host-only projection folds existing child-owned selection events, turn starts, and native descriptor evidence, excluding inherited seed events. A later explicit child selection suspends following from its next turn, including a same-model reselection. Once present, a child-owned selection is not cleared by toggling enrollment.
232
+ - Read the direct parent's pending selected intent first, then its proven effective route. Preserve the exact Auto preference. Do not borrow the global default, another Session, or a stale request header when a newer pending choice exists.
233
+ - Freeze one selection before the child's first prompt assembly in a new turn. Reuse it for every subsequent step/retry/compaction attempt in that turn. Integrate it with the existing per-Agent Auto resolver so Auto evaluates the child's admitted messages and capacity requirements, not the parent's chosen model.
234
+ - Reuse normal managed adapter admission for fixed-model availability and exclusions, and the existing validated candidate pool for Auto. Clear inherited reasoning effort while retaining output caps. Missing parent/selection evidence yields a named `COPILOT_PARENT_MODEL_*` diagnostic, never a guessed model or silent fallback.
235
+ - Restore policy from plugin-owned settings on cold activation and inspect only public projections. Do not call public `session.selectModel` for propagation: it also writes the future global default. Do not convert historical provenance or alter native permissions.
236
+ - Keep scope to verified native `spawn` children and managed Copilot parent routes. Dedicated historical role policies, fork-provider descriptors and externally managed providers are rejected when enrolled. Nested enrollment follows verified direct-parent links until an explicit selection or non-following parent supplies the intent; cycles and missing parents fail visibly.
237
+ - Verify native Team model labels separately: a roster label may describe a creation snapshot rather than the next request. Do not claim accurate live UI simply because request routing changes.
238
+
239
+ Release gates combine policy, Host/configuration and unchanged-Core regressions:
240
+ fixed A to B, fixed to Auto and Auto to fixed, every Auto preference, independent
241
+ sibling inputs, turn freezing, explicit child overrides, fork seed boundaries,
242
+ strict history reading/refolding, unavailable parents, normal model exclusions,
243
+ live binding changes and disposal. The native AgentLoop fixture reconstructs a
244
+ child from its own strict-reader-validated history and verifies the next turn;
245
+ it does not exercise disk-backed resume or the native Team orchestrator.
246
+ The current native creation path has no proven automatic-enrollment mechanism
247
+ that preserves original override precedence, so this alternative needs explicit
248
+ per-child user authorization rather than a claim of transparent default inheritance.
249
+
250
+ Local full validation is blocked: `pnpm exec vitest --version` triggered pnpm's
251
+ dependency reconciliation, which failed with HTTP 404 for
252
+ `https://packagefeedproxy.microsoft.io/npm/@deepseek-ai/dsh-llm/-/dsh-llm-0.2.0-rc.2.tgz`.
253
+ No registry restriction was bypassed. The isolated experiment above does not
254
+ replace the complete repository and exact-Core compatibility gates.
255
+
256
+ Implemented files are `src/parent-model-follow.ts`, `src/auto-model-host.ts`,
257
+ `src/config.ts` and `src/preview-route.ts`. Nine dependency-free policy tests
258
+ passed with `node --test tests/scripts/parent-model-follow.test.mjs`, and the
259
+ policy module passed a focused TypeScript check. An actual-plugin-source VM
260
+ experiment passed fixed/Auto turn freezing, config removal, explicit child
261
+ override, reinstallation/refolding and no-history-write assertions with synthetic
262
+ Context/LLM/token-estimator dependencies. Focused Vitest Host/config tests and
263
+ the real Session projection/AgentLoop fixtures run in the required Windows/Linux
264
+ CI matrix; the incomplete local dependency installation cannot run those gates.
265
+ The AgentLoop fixture uses the actual TokenMeter and a synthetic public adapter,
266
+ not a live model endpoint. Native Team end-to-end behavior, disk persistence,
267
+ Desktop activation and transport remain separate, unclaimed evidence layers.
153
268
 
154
269
  ## Public API implementation
155
270
 
package/lib/index.js CHANGED
@@ -191,12 +191,12 @@ function fail$1(reason, creation) {
191
191
  function creationOf(error) {
192
192
  return ownRemoteFailure(error)?.creation ?? "uncertain";
193
193
  }
194
- function object$4(value) {
194
+ function object$5(value) {
195
195
  return typeof value === "object" && value !== null && !Array.isArray(value);
196
196
  }
197
197
  function api$1(ctx, key, methods) {
198
198
  const value = ctx.get(key);
199
- return object$4(value) && methods.every((method) => typeof value[method] === "function") ? value : void 0;
199
+ return object$5(value) && methods.every((method) => typeof value[method] === "function") ? value : void 0;
200
200
  }
201
201
  function revision(value) {
202
202
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
@@ -221,7 +221,7 @@ const ERROR_REASONS = /* @__PURE__ */ new Set([
221
221
  /** Remote errors cross bundle/realm boundaries; constructor identity is not a protocol. */
222
222
  function ownRemoteFailure(error) {
223
223
  try {
224
- if (!object$4(error) || error.isDSHRemoteError !== true || error.code !== "copilot/dual-model" || !object$4(error.details)) return void 0;
224
+ if (!object$5(error) || error.isDSHRemoteError !== true || error.code !== "copilot/dual-model" || !object$5(error.details)) return void 0;
225
225
  const reason = error.details.reason;
226
226
  if (typeof reason !== "string" || !ERROR_REASONS.has(reason)) return void 0;
227
227
  const creation = error.details.creation;
@@ -237,7 +237,7 @@ function reasonOf(error, fallback) {
237
237
  const own = ownRemoteFailure(error);
238
238
  if (own) return own.reason;
239
239
  try {
240
- if (object$4(error) && error.code === "SETTINGS_CONFLICT") return "DUAL_MODEL_REVISION_CONFLICT";
240
+ if (object$5(error) && error.code === "SETTINGS_CONFLICT") return "DUAL_MODEL_REVISION_CONFLICT";
241
241
  } catch {}
242
242
  return fallback;
243
243
  }
@@ -365,7 +365,7 @@ let GitHubCopilotDualModel = (() => {
365
365
  }, { prepend: true });
366
366
  ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
367
367
  const candidate = context.scope;
368
- if (!candidate || !object$4(candidate.session) || !object$4(candidate.session.header) || !dedicatedAddress(candidate)) return next();
368
+ if (!candidate || !object$5(candidate.session) || !object$5(candidate.session.header) || !dedicatedAddress(candidate)) return next();
369
369
  const rehydrating = !this.overlays.has(candidate);
370
370
  if (rehydrating) this.restore(candidate);
371
371
  const installed = this.overlays.get(candidate);
@@ -1646,7 +1646,7 @@ let GitHubCopilotUsageController = (() => {
1646
1646
  //#endregion
1647
1647
  //#region package.json
1648
1648
  var name$1 = "dsh-github-copilot";
1649
- var version = "0.4.0-alpha.65";
1649
+ var version = "0.4.0-alpha.66";
1650
1650
  //#endregion
1651
1651
  //#region lib/types/probe.js
1652
1652
  /**
@@ -2068,9 +2068,14 @@ const WebSearchRoutingConfigSchema = z.object({
2068
2068
  /** Keep native live references at the boundary; request code consumes plain snapshots. */
2069
2069
  function readInlineConfig(config) {
2070
2070
  const exclusions = readConfigValue(config.excludedModelIds);
2071
+ const bindings = readConfigValue(config.parentModelFollow);
2071
2072
  return {
2072
2073
  ...config,
2073
2074
  excludedModelIds: exclusions === void 0 ? void 0 : Array.from(exclusions),
2075
+ parentModelFollow: bindings === void 0 ? void 0 : Array.from(bindings, (binding) => ({
2076
+ childSessionId: binding.childSessionId,
2077
+ parentSessionId: binding.parentSessionId
2078
+ })),
2074
2079
  searchModel: readConfigValue(config.searchModel),
2075
2080
  searchRouting: readConfigValue(config.searchRouting),
2076
2081
  temporaryRouteBackup: readConfigValue(config.temporaryRouteBackup)
@@ -2090,6 +2095,10 @@ const Config = z.object({
2090
2095
  accountModelTtlMs: z.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(864e5),
2091
2096
  accountModelFailureCooldownMs: z.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(3e5),
2092
2097
  excludedModelIds: z.array(z.string()).default([]).hidden().volatile(),
2098
+ parentModelFollow: z.array(z.object({
2099
+ childSessionId: z.string().min(1),
2100
+ parentSessionId: z.string().min(1)
2101
+ })).default([]).volatile(),
2093
2102
  requestBudgetSafetyTokens: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(DEFAULT_REQUEST_BUDGET_POLICY.safetyTokens),
2094
2103
  requestBudgetPressureRatio: z.number().step(.01).min(.01).max(1).default(DEFAULT_REQUEST_BUDGET_POLICY.pressureRatio),
2095
2104
  compactionReasoning: z.union(["prefer-low", "preserve"]).default(DEFAULT_REQUEST_BUDGET_POLICY.compactionReasoning),
@@ -3914,19 +3923,19 @@ var TemporaryRouteConflictError = class extends Error {
3914
3923
  this.name = "TemporaryRouteConflictError";
3915
3924
  }
3916
3925
  };
3917
- function object$3(value) {
3926
+ function object$4(value) {
3918
3927
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
3919
3928
  }
3920
3929
  function profileAt(value) {
3921
- return object$3(object$3(object$3(value)?.providers)?.["github-copilot"]);
3930
+ return object$4(object$4(object$4(value)?.providers)?.["github-copilot"]);
3922
3931
  }
3923
3932
  /** Bounded comparison; never stringify or copy unknown model extras or headers. */
3924
3933
  function equalJson(a, b, depth = 0) {
3925
3934
  if (a === b) return true;
3926
3935
  if (depth > 12) return false;
3927
3936
  if (Array.isArray(a) || Array.isArray(b)) return Array.isArray(a) && Array.isArray(b) && a.length <= 512 && a.length === b.length && a.every((value, i) => equalJson(value, b[i], depth + 1));
3928
- const left = object$3(a);
3929
- const right = object$3(b);
3937
+ const left = object$4(a);
3938
+ const right = object$4(b);
3930
3939
  if (!left || !right) return false;
3931
3940
  const keys = Object.keys(left);
3932
3941
  return keys.length <= 512 && keys.length === Object.keys(right).length && keys.every((key) => Object.hasOwn(right, key) && equalJson(left[key], right[key], depth + 1));
@@ -3935,7 +3944,7 @@ const MAX_BACKUP = 131072;
3935
3944
  function safeModels(value) {
3936
3945
  if (!Array.isArray(value) || value.length > 512) throw new TemporaryRouteConflictError();
3937
3946
  return value.map((entry) => {
3938
- const model = object$3(entry);
3947
+ const model = object$4(entry);
3939
3948
  if (!model || typeof model.id !== "string" || !/^[a-zA-Z0-9._:/-]{1,200}$/.test(model.id)) throw new TemporaryRouteConflictError();
3940
3949
  const overlay = temporaryGitHubCopilotModel(model.id, /* @__PURE__ */ new Map());
3941
3950
  if (overlay && Object.keys(model).some((key) => key !== "id" && key !== "api")) {
@@ -3966,10 +3975,10 @@ function readBackup(value) {
3966
3975
  if (value === void 0) return void 0;
3967
3976
  if (typeof value !== "string" || value.length > MAX_BACKUP) throw new TemporaryRouteConflictError("TEMPORARY_ROUTE_INVALID_BACKUP");
3968
3977
  try {
3969
- const decoded = object$3(JSON.parse(value));
3978
+ const decoded = object$4(JSON.parse(value));
3970
3979
  if (!decoded) throw new Error();
3971
3980
  if (decoded.version === void 0 || decoded.version === 2 && decoded.sourceEpoch === void 0) throw new TemporaryRouteConflictError("TEMPORARY_ROUTE_LEGACY_CONFLICT");
3972
- if (decoded.version !== 2 || typeof decoded.providerExisted !== "boolean" || typeof decoded.sourceEpoch !== "string" || !/^[a-f0-9-]{36}$/.test(decoded.sourceEpoch) || !Number.isSafeInteger(decoded.sourceRevision) || Number(decoded.sourceRevision) < 0 || !["overlay", "restoring"].includes(String(decoded.phase)) || !object$3(decoded.preimage) || !object$3(decoded.postimage) || !object$3(decoded.ownedHeaders) || Object.keys(decoded).some((key) => ![
3981
+ if (decoded.version !== 2 || typeof decoded.providerExisted !== "boolean" || typeof decoded.sourceEpoch !== "string" || !/^[a-f0-9-]{36}$/.test(decoded.sourceEpoch) || !Number.isSafeInteger(decoded.sourceRevision) || Number(decoded.sourceRevision) < 0 || !["overlay", "restoring"].includes(String(decoded.phase)) || !object$4(decoded.preimage) || !object$4(decoded.postimage) || !object$4(decoded.ownedHeaders) || Object.keys(decoded).some((key) => ![
3973
3982
  "version",
3974
3983
  "providerExisted",
3975
3984
  "preimage",
@@ -3986,15 +3995,15 @@ function readBackup(value) {
3986
3995
  decoded.postimage,
3987
3996
  ...decoded.phase === "restoring" ? [decoded.target] : []
3988
3997
  ]) {
3989
- const record = object$3(leaf);
3998
+ const record = object$4(leaf);
3990
3999
  if (!record || !equalJson(record, leavesOf(record))) throw new Error();
3991
4000
  }
3992
- const models = object$3(decoded.postimage)?.models ?? [];
4001
+ const models = object$4(decoded.postimage)?.models ?? [];
3993
4002
  const knownHeaders = Object.assign({}, ...models.flatMap((model) => {
3994
4003
  const overlay = temporaryGitHubCopilotModelFromProfile(model);
3995
4004
  return overlay ? [overlay.headers] : [];
3996
4005
  }));
3997
- if (!Object.entries(object$3(decoded.ownedHeaders)).every(([name, header]) => knownHeaders[name] === header)) throw new Error();
4006
+ if (!Object.entries(object$4(decoded.ownedHeaders)).every(([name, header]) => knownHeaders[name] === header)) throw new Error();
3998
4007
  if (decoded.removeProfile !== void 0 && typeof decoded.removeProfile !== "boolean") throw new Error();
3999
4008
  return decoded;
4000
4009
  } catch (error) {
@@ -4020,7 +4029,7 @@ function settingsSnapshot(settings) {
4020
4029
  hasOwnedSecrets,
4021
4030
  routeRevision: route.revision,
4022
4031
  markerRevision: marker.revision,
4023
- backup: readBackup(object$3(marker.value)?.temporaryRouteBackup)
4032
+ backup: readBackup(object$4(marker.value)?.temporaryRouteBackup)
4024
4033
  };
4025
4034
  }
4026
4035
  function assertOwned(current, backup) {
@@ -4053,7 +4062,7 @@ function leafOperations(current, target) {
4053
4062
  }]);
4054
4063
  }
4055
4064
  function ownedHeaderRemoval(current, backup) {
4056
- return Object.entries(object$3(current?.headers) ?? {}).flatMap(([name, value]) => Object.entries(backup.ownedHeaders).some(([ownedName, ownedValue]) => name.toLowerCase() === ownedName.toLowerCase() && value === ownedValue) ? [{
4065
+ return Object.entries(object$4(current?.headers) ?? {}).flatMap(([name, value]) => Object.entries(backup.ownedHeaders).some(([ownedName, ownedValue]) => name.toLowerCase() === ownedName.toLowerCase() && value === ownedValue) ? [{
4057
4066
  op: "unset",
4058
4067
  path: [
4059
4068
  "providers",
@@ -4075,7 +4084,7 @@ function wholeProfileOwned(snapshot, backup) {
4075
4084
  //#endregion
4076
4085
  //#region lib/types/migration-status.js
4077
4086
  const LIMIT = 1024;
4078
- function object$2(value) {
4087
+ function object$3(value) {
4079
4088
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("Invalid evidence");
4080
4089
  return value;
4081
4090
  }
@@ -4084,7 +4093,7 @@ function text$1(value) {
4084
4093
  return value;
4085
4094
  }
4086
4095
  function selection(value, omitDefaultEffort = false) {
4087
- const item = object$2(value);
4096
+ const item = object$3(value);
4088
4097
  const provider = text$1(item.provider), model = text$1(item.model), effort = item.reasoningEffort;
4089
4098
  if (effort !== void 0) text$1(effort);
4090
4099
  return {
@@ -4099,7 +4108,7 @@ function array(value) {
4099
4108
  }
4100
4109
  function api(ctx, name, methods) {
4101
4110
  try {
4102
- const candidate = object$2(ctx.get(name));
4111
+ const candidate = object$3(ctx.get(name));
4103
4112
  return methods.every((key) => typeof candidate[key] === "function") ? candidate : void 0;
4104
4113
  } catch {
4105
4114
  return;
@@ -4169,26 +4178,26 @@ function migrationStatus(ctx) {
4169
4178
  const rows = [], ids = /* @__PURE__ */ new Set();
4170
4179
  let complete = projections !== void 0;
4171
4180
  for (const candidate of array(call(agents, "list"))) {
4172
- const agent = object$2(candidate), id = text$1(agent.id), status = agent.status;
4181
+ const agent = object$3(candidate), id = text$1(agent.id), status = agent.status;
4173
4182
  if (ids.has(id) || status !== "idle" && status !== "running") throw new Error("Invalid agent inventory");
4174
4183
  ids.add(id);
4175
- const session = object$2(agent.session);
4184
+ const session = object$3(agent.session);
4176
4185
  if (text$1(session.id) !== id) throw new Error("Invalid agent identity");
4177
4186
  const header = call(session, "requestHeader");
4178
- const request = header === void 0 ? null : selection(object$2(header).config);
4187
+ const request = header === void 0 ? null : selection(object$3(header).config);
4179
4188
  let effective = null, source = "unknown";
4180
4189
  if (projections) {
4181
4190
  const state = call(projections, "stateOf", session, "modelSelection");
4182
4191
  if (state !== void 0) {
4183
- const pending = object$2(state).pending;
4192
+ const pending = object$3(state).pending;
4184
4193
  if (pending !== null) {
4185
4194
  effective = selection(pending);
4186
4195
  source = "pending";
4187
4196
  } else if (header !== void 0) {
4188
- const defaults = object$2(header).adapterDefaults;
4189
- const defaultEffort = defaults === void 0 ? false : object$2(defaults).reasoningEffort;
4197
+ const defaults = object$3(header).adapterDefaults;
4198
+ const defaultEffort = defaults === void 0 ? false : object$3(defaults).reasoningEffort;
4190
4199
  if (defaultEffort !== void 0 && typeof defaultEffort !== "boolean") throw new Error("Invalid adapter defaults");
4191
- effective = selection(object$2(header).config, defaultEffort === true);
4200
+ effective = selection(object$3(header).config, defaultEffort === true);
4192
4201
  source = "request-header";
4193
4202
  } else if (result.complete.defaultSelection) {
4194
4203
  effective = result.defaultSelection;
@@ -4212,23 +4221,23 @@ function migrationStatus(ctx) {
4212
4221
  const descriptors = array(call(settings, "describe", { redactSecrets: true }));
4213
4222
  const found = /* @__PURE__ */ new Set();
4214
4223
  for (const value of descriptors) {
4215
- const descriptor = object$2(value);
4224
+ const descriptor = object$3(value);
4216
4225
  const ns = text$1(descriptor.ns);
4217
4226
  if (ns !== "llm-pi-ai" && ns !== "github-copilot") continue;
4218
4227
  if (found.has(ns) || !Number.isSafeInteger(descriptor.revision) || descriptor.revision < 0) throw new Error("Invalid settings evidence");
4219
4228
  found.add(ns);
4220
4229
  }
4221
4230
  if (found.size !== 2) throw new Error("Unregistered settings");
4222
- const config = object$2(call(settings, "get", "llm-pi-ai"));
4223
- const profile = (config.providers === void 0 ? void 0 : object$2(config.providers))?.[GITHUB_COPILOT_PROVIDER_ID];
4224
- if (profile !== void 0) object$2(profile);
4231
+ const config = object$3(call(settings, "get", "llm-pi-ai"));
4232
+ const profile = (config.providers === void 0 ? void 0 : object$3(config.providers))?.[GITHUB_COPILOT_PROVIDER_ID];
4233
+ if (profile !== void 0) object$3(profile);
4225
4234
  result.capabilities.settingsCas = true;
4226
4235
  result.routes.nativeConfigured = profile !== void 0;
4227
4236
  } catch {}
4228
4237
  if (llm) try {
4229
4238
  const ids = /* @__PURE__ */ new Set();
4230
4239
  for (const value of array(call(llm, "listProviders"))) {
4231
- const id = text$1(object$2(value).id);
4240
+ const id = text$1(object$3(value).id);
4232
4241
  if (ids.has(id)) throw new Error("Invalid registry evidence");
4233
4242
  ids.add(id);
4234
4243
  }
@@ -4378,7 +4387,7 @@ function accountModelsView(ctx) {
4378
4387
  }
4379
4388
  }
4380
4389
  function modelSelection(value) {
4381
- const selection = object$3(value);
4390
+ const selection = object$4(value);
4382
4391
  const provider = selection?.provider;
4383
4392
  const model = selection?.model;
4384
4393
  return typeof provider === "string" && provider.length > 0 && typeof model === "string" && model.length > 0 ? {
@@ -4407,16 +4416,16 @@ function selectedFixedModelIds(ctx) {
4407
4416
  const stateOf = Reflect.get(projections, "stateOf");
4408
4417
  if (typeof stateOf !== "function") return void 0;
4409
4418
  for (const candidate of rows) {
4410
- const session = object$3(object$3(candidate)?.session);
4419
+ const session = object$4(object$4(candidate)?.session);
4411
4420
  if (session === void 0) return void 0;
4412
- const state = object$3(Reflect.apply(stateOf, projections, [session, "modelSelection"]));
4421
+ const state = object$4(Reflect.apply(stateOf, projections, [session, "modelSelection"]));
4413
4422
  if (state === void 0 || !("pending" in state)) return void 0;
4414
4423
  const pending = state.pending;
4415
4424
  if (pending !== null && modelSelection(pending) === void 0) return void 0;
4416
4425
  let selected = pending === null ? void 0 : fixedPreviewModel(pending);
4417
4426
  if (pending === null) {
4418
4427
  const requestHeader = session.requestHeader;
4419
- const header = typeof requestHeader === "function" ? object$3(Reflect.apply(requestHeader, session, [])) : void 0;
4428
+ const header = typeof requestHeader === "function" ? object$4(Reflect.apply(requestHeader, session, [])) : void 0;
4420
4429
  if (header?.config !== void 0 && modelSelection(header.config) === void 0) return void 0;
4421
4430
  selected = fixedPreviewModel(header?.config);
4422
4431
  }
@@ -4448,7 +4457,7 @@ function modelPreferencesView(ctx, accountModels, error) {
4448
4457
  if (!Number.isSafeInteger(descriptor.revision) || descriptor.revision < 0) return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
4449
4458
  let excludedModelIds;
4450
4459
  try {
4451
- const raw = object$3(descriptor.value);
4460
+ const raw = object$4(descriptor.value);
4452
4461
  if (raw === void 0) return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
4453
4462
  excludedModelIds = normalizeExcludedModelIds(raw.excludedModelIds);
4454
4463
  } catch {
@@ -4566,7 +4575,7 @@ async function repairGitHubCopilotProviderProfile(ctx) {
4566
4575
  try {
4567
4576
  await settings.mutate(namespace, operations, revision);
4568
4577
  } catch (error) {
4569
- if (object$3(error)?.code === "SETTINGS_CONFLICT") throw new TemporaryRouteConflictError();
4578
+ if (object$4(error)?.code === "SETTINGS_CONFLICT") throw new TemporaryRouteConflictError();
4570
4579
  throw error;
4571
4580
  }
4572
4581
  };
@@ -4977,7 +4986,7 @@ let GitHubCopilotAuthorizationController = (() => {
4977
4986
  }], current.revision);
4978
4987
  this.modelPreferenceFailure = void 0;
4979
4988
  } catch (cause) {
4980
- const record = object$3(cause);
4989
+ const record = object$4(cause);
4981
4990
  this.modelPreferenceFailure = record?.code === "SETTINGS_CONFLICT" || cause instanceof Error && /conflict/i.test(cause.message) ? "COPILOT_MODEL_EXCLUSION_CONFLICT" : "COPILOT_MODEL_EXCLUSION_SAVE_FAILED";
4982
4991
  }
4983
4992
  return this.status();
@@ -5122,7 +5131,7 @@ const levels = [
5122
5131
  "xhigh",
5123
5132
  "max"
5124
5133
  ];
5125
- function object$1(value) {
5134
+ function object$2(value) {
5126
5135
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
5127
5136
  }
5128
5137
  function unavailable() {
@@ -5131,18 +5140,18 @@ function unavailable() {
5131
5140
  /** Resolve only the selected model's declared/native efforts, with the same precedence as Core. */
5132
5141
  function resolveCopilotResponsesReasoning(ctx, request, candidate) {
5133
5142
  if (request.provider !== "github-copilot" || candidate.protocol !== "openai-responses" || candidate.model !== request.model) return unavailable();
5134
- const profile = object$1(object$1(object$1(readSettingsNamespace(ctx, "llm-pi-ai"))?.providers)?.["github-copilot"]);
5143
+ const profile = object$2(object$2(object$2(readSettingsNamespace(ctx, "llm-pi-ai"))?.providers)?.["github-copilot"]);
5135
5144
  const effort = request.reasoningEffort ?? profile?.reasoning;
5136
5145
  if (effort === void 0) return void 0;
5137
5146
  const level = levels.find((value) => value === effort);
5138
5147
  if (level === void 0 || profile === void 0) return unavailable();
5139
5148
  const configured = Array.isArray(profile.models) ? profile.models : [];
5140
- const entry = configured.length > 0 ? object$1(configured.find((value) => object$1(value)?.id === request.model)) : object$1(object$1(profile.modelOverrides)?.[request.model]);
5149
+ const entry = configured.length > 0 ? object$2(configured.find((value) => object$2(value)?.id === request.model)) : object$2(object$2(profile.modelOverrides)?.[request.model]);
5141
5150
  if (configured.length > 0 && entry === void 0) return unavailable();
5142
5151
  const declared = entry?.reasoningEfforts;
5143
5152
  if (declared !== void 0) {
5144
5153
  if (declared === false) return level === "off" ? void 0 : unavailable();
5145
- const mapping = object$1(declared);
5154
+ const mapping = object$2(declared);
5146
5155
  if (mapping === void 0) return unavailable();
5147
5156
  const wire = mapping[level];
5148
5157
  if (level === "off" && (wire === null || typeof wire === "string" && wire.length > 0)) return void 0;
@@ -6343,7 +6352,7 @@ function createAccountModelSource(dependencies) {
6343
6352
  }
6344
6353
  //#endregion
6345
6354
  //#region lib/types/compaction-pressure.js
6346
- function object(value) {
6355
+ function object$1(value) {
6347
6356
  return typeof value === "object" && value !== null ? value : void 0;
6348
6357
  }
6349
6358
  /** Optional public services are not dependencies of the retained development baseline. */
@@ -6374,7 +6383,7 @@ function installCopilotCompactionPressure(ctx, callbacks) {
6374
6383
  const pressureFailure = (request) => {
6375
6384
  if (!isAgentLoopRequest(request) || request.purpose !== void 0 || request.provider !== "github-copilot-preview" || request.sessionId === void 0 || request.signal?.aborted) return void 0;
6376
6385
  if (!isPluginPreviewProvider(ctx, request.provider)) return void 0;
6377
- if (typeof object(ctx.get("agents"))?.currentInitiator !== "function") {
6386
+ if (typeof object$1(ctx.get("agents"))?.currentInitiator !== "function") {
6378
6387
  unavailable();
6379
6388
  return;
6380
6389
  }
@@ -6388,15 +6397,15 @@ function installCopilotCompactionPressure(ctx, callbacks) {
6388
6397
  if (header === void 0 || !callConfigEquals(header.config, request)) return void 0;
6389
6398
  const budget = callbacks.resolve(request);
6390
6399
  if (budget === void 0 || !positiveInteger(budget.inputBudgetTokens)) return void 0;
6391
- const compaction = object(optionalService(ctx, "compaction"));
6392
- const config = object(compaction?.config);
6400
+ const compaction = object$1(optionalService(ctx, "compaction"));
6401
+ const config = object$1(compaction?.config);
6393
6402
  if (config?.auto === false) return void 0;
6394
6403
  if (config?.auto !== true || typeof compaction?.compactIfNeeded !== "function") {
6395
6404
  unavailable();
6396
6405
  return;
6397
6406
  }
6398
- const retries = (Array.isArray(config.modelPolicies) ? object(config.modelPolicies.find((value) => {
6399
- const candidate = object(value);
6407
+ const retries = (Array.isArray(config.modelPolicies) ? object$1(config.modelPolicies.find((value) => {
6408
+ const candidate = object$1(value);
6400
6409
  return candidate?.provider === request.provider && candidate.model === request.model;
6401
6410
  })) : void 0)?.maxOverflowRetries ?? config.maxOverflowRetries;
6402
6411
  if (retries === 0) return void 0;
@@ -6404,12 +6413,12 @@ function installCopilotCompactionPressure(ctx, callbacks) {
6404
6413
  unavailable();
6405
6414
  return;
6406
6415
  }
6407
- const meter = object(optionalService(ctx, "tokenMeter"));
6416
+ const meter = object$1(optionalService(ctx, "tokenMeter"));
6408
6417
  if (typeof meter?.measure !== "function") {
6409
6418
  unavailable();
6410
6419
  return;
6411
6420
  }
6412
- const tokens = object(meter.measure(owner.session))?.totalTokens;
6421
+ const tokens = object$1(meter.measure(owner.session))?.totalTokens;
6413
6422
  if (typeof tokens !== "number" || !Number.isSafeInteger(tokens) || tokens < 0) {
6414
6423
  unavailable();
6415
6424
  return;
@@ -6726,6 +6735,113 @@ var TurnSelectionStore = class {
6726
6735
  }
6727
6736
  };
6728
6737
  //#endregion
6738
+ //#region lib/types/parent-model-follow.js
6739
+ const PARENT_MODEL_FOLLOW_PROJECTION = "githubCopilotParentModelFollow";
6740
+ function object(value) {
6741
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6742
+ }
6743
+ function followSelection(value) {
6744
+ if (!object(value) || typeof value.provider !== "string" || !value.provider || typeof value.model !== "string" || !value.model) return void 0;
6745
+ return {
6746
+ provider: value.provider,
6747
+ model: value.model
6748
+ };
6749
+ }
6750
+ function initialFollowState(inherited = 0) {
6751
+ return {
6752
+ inherited,
6753
+ turn: null,
6754
+ started: false,
6755
+ explicit: null,
6756
+ descriptor: false,
6757
+ blocked: false
6758
+ };
6759
+ }
6760
+ /** Fold only the child's own suffix; copied fork selections are not child overrides. */
6761
+ function foldFollowState(state, event) {
6762
+ if (event.seq < state.inherited) return state;
6763
+ if (event.type === "turn/start") {
6764
+ if (!object(event.data) || !Number.isSafeInteger(event.data.turn) || Number(event.data.turn) < 0) return {
6765
+ ...state,
6766
+ blocked: true
6767
+ };
6768
+ return {
6769
+ ...state,
6770
+ turn: Number(event.data.turn),
6771
+ started: false
6772
+ };
6773
+ }
6774
+ if (event.type === "step/start") return {
6775
+ ...state,
6776
+ started: true
6777
+ };
6778
+ if (event.type === "model/selection") {
6779
+ const selection = followSelection(event.data);
6780
+ return selection ? {
6781
+ ...state,
6782
+ explicit: selection
6783
+ } : {
6784
+ ...state,
6785
+ blocked: true
6786
+ };
6787
+ }
6788
+ if (event.type === "github-copilot/dual-model-policy") return {
6789
+ ...state,
6790
+ blocked: true
6791
+ };
6792
+ if (event.type === "subagent/descriptor") {
6793
+ const data = event.data;
6794
+ const valid = object(data) && data.version === 3 && data.provider === "spawn" && (data.mode === "continuable" || data.mode === "one-shot");
6795
+ return {
6796
+ ...state,
6797
+ descriptor: valid,
6798
+ blocked: state.blocked || !valid || state.descriptor
6799
+ };
6800
+ }
6801
+ return state;
6802
+ }
6803
+ var ParentModelFollowError = class extends Error {
6804
+ code;
6805
+ constructor(code) {
6806
+ super(code);
6807
+ this.code = code;
6808
+ this.name = "ParentModelFollowError";
6809
+ }
6810
+ };
6811
+ /** Resolve a new turn's intent without changing any Session, setting or descriptor. */
6812
+ function resolveParentModel(child, bindings, lookup) {
6813
+ const matches = bindings.filter((binding) => binding.childSessionId === child.id);
6814
+ if (matches.length === 0) return void 0;
6815
+ const fail = (code) => {
6816
+ throw new ParentModelFollowError(`COPILOT_PARENT_MODEL_${code}`);
6817
+ };
6818
+ if (matches.length !== 1) fail("BINDING_INVALID");
6819
+ if (child.state.blocked || !child.state.descriptor || child.origin !== "subagent") fail("CHILD_UNSUPPORTED");
6820
+ if (!child.parentId || child.parentId !== matches[0]?.parentSessionId) fail("LINEAGE_INVALID");
6821
+ if (child.state.explicit !== null) return void 0;
6822
+ const seen = /* @__PURE__ */ new Set([child.id]);
6823
+ let current = child;
6824
+ while (true) {
6825
+ const parentId = current.parentId;
6826
+ if (!parentId || seen.has(parentId)) return fail("LINEAGE_INVALID");
6827
+ seen.add(parentId);
6828
+ const parent = lookup(parentId);
6829
+ if (!parent) return fail("PARENT_UNAVAILABLE");
6830
+ if (parent.state.blocked) fail("PARENT_UNSUPPORTED");
6831
+ const parentBindings = bindings.filter((binding) => binding.childSessionId === parent.id);
6832
+ if (parentBindings.length > 1) fail("BINDING_INVALID");
6833
+ if (parentBindings.length === 1 && parent.state.explicit === null) {
6834
+ if (!parent.state.descriptor || parent.origin !== "subagent" || parent.parentId !== parentBindings[0]?.parentSessionId) fail("LINEAGE_INVALID");
6835
+ current = parent;
6836
+ continue;
6837
+ }
6838
+ const selection = parent.pending ?? parent.recorded;
6839
+ if (!selection) return fail("SELECTION_UNAVAILABLE");
6840
+ if (selection.provider !== "github-copilot-preview") fail("PROVIDER_UNSUPPORTED");
6841
+ return { ...selection };
6842
+ }
6843
+ }
6844
+ //#endregion
6729
6845
  //#region lib/types/auto-model-host.js
6730
6846
  function failure$1(code) {
6731
6847
  return new LlmError(code, "INVALID_REQUEST");
@@ -6808,10 +6924,109 @@ function installAutoModelRouting(ctx, dependencies) {
6808
6924
  const routed = /* @__PURE__ */ new WeakMap();
6809
6925
  const agentDisposers = /* @__PURE__ */ new WeakMap();
6810
6926
  const activeDisposers = /* @__PURE__ */ new Set();
6927
+ const followed = /* @__PURE__ */ new WeakMap();
6928
+ const selectionSchema = z$1.object({
6929
+ provider: z$1.string().min(1),
6930
+ model: z$1.string().min(1)
6931
+ }).strict();
6932
+ const followSchema = z$1.object({
6933
+ inherited: z$1.number().int().nonnegative(),
6934
+ turn: z$1.number().int().nonnegative().nullable(),
6935
+ started: z$1.boolean(),
6936
+ explicit: selectionSchema.nullable(),
6937
+ descriptor: z$1.boolean(),
6938
+ blocked: z$1.boolean()
6939
+ }).strict();
6940
+ let removeFollowProjection;
6941
+ const followIntent = (agent) => {
6942
+ const previous = followed.get(agent);
6943
+ if (previous) {
6944
+ const registry = ctx.get("sessionProjections");
6945
+ if (!record(registry) || typeof registry.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
6946
+ const state = followSchema.safeParse(registry.stateOf(agent.session, PARENT_MODEL_FOLLOW_PROJECTION));
6947
+ if (!state.success) throw failure$1("COPILOT_PARENT_MODEL_TURN_UNAVAILABLE");
6948
+ if (state.data.turn === previous.turn) return previous.selection;
6949
+ }
6950
+ const bindings = dependencies.parentModelBindings?.() ?? [];
6951
+ if (!bindings.some((binding) => binding.childSessionId === agent.session.id)) return void 0;
6952
+ const projections = ctx.get("sessionProjections");
6953
+ if (!record(projections) || typeof projections.register !== "function" || typeof projections.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
6954
+ const stateOf = projections.stateOf;
6955
+ if (!removeFollowProjection) {
6956
+ const remove = projections.register({
6957
+ key: PARENT_MODEL_FOLLOW_PROJECTION,
6958
+ stateVersion: 1,
6959
+ stateSchema: followSchema,
6960
+ init: (_header, inherited = 0) => initialFollowState(inherited),
6961
+ apply: foldFollowState
6962
+ });
6963
+ if (typeof remove !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
6964
+ removeFollowProjection = () => {
6965
+ remove();
6966
+ };
6967
+ }
6968
+ const readSubject = (value) => {
6969
+ if (!record(value) || !record(value.session)) return void 0;
6970
+ const session = value.session;
6971
+ if (typeof session.id !== "string" || !record(session.header) || typeof session.requestHeader !== "function") return void 0;
6972
+ const parsed = followSchema.safeParse(Reflect.apply(stateOf, projections, [session, PARENT_MODEL_FOLLOW_PROJECTION]));
6973
+ const selection = Reflect.apply(stateOf, projections, [session, "modelSelection"]);
6974
+ if (!parsed.success || !record(selection) || !Object.hasOwn(selection, "pending")) throw failure$1("COPILOT_PARENT_MODEL_SELECTION_UNAVAILABLE");
6975
+ const pending = selection.pending === null ? null : followSelection(selection.pending);
6976
+ if (pending === void 0) throw failure$1("COPILOT_PARENT_MODEL_SELECTION_UNAVAILABLE");
6977
+ const header = session.requestHeader();
6978
+ return {
6979
+ id: session.id,
6980
+ parentId: typeof session.header.parentSession === "string" ? session.header.parentSession : void 0,
6981
+ origin: typeof session.header.origin === "string" ? session.header.origin : void 0,
6982
+ state: parsed.data,
6983
+ pending,
6984
+ recorded: record(header) ? followSelection(header.config) : void 0
6985
+ };
6986
+ };
6987
+ const child = readSubject(agent);
6988
+ if (!child || child.state.turn === null) throw failure$1("COPILOT_PARENT_MODEL_TURN_UNAVAILABLE");
6989
+ if (child.state.started) {
6990
+ followed.set(agent, {
6991
+ turn: child.state.turn,
6992
+ selection: void 0
6993
+ });
6994
+ return;
6995
+ }
6996
+ const agents = ctx.get("agents");
6997
+ try {
6998
+ const selection = resolveParentModel(child, bindings, (id) => {
6999
+ if (!record(agents) || typeof agents.get !== "function") return void 0;
7000
+ return readSubject(agents.get(id));
7001
+ });
7002
+ followed.set(agent, {
7003
+ turn: child.state.turn,
7004
+ selection
7005
+ });
7006
+ return selection;
7007
+ } catch (cause) {
7008
+ if (cause instanceof ParentModelFollowError) throw failure$1(cause.code);
7009
+ throw cause;
7010
+ }
7011
+ };
7012
+ const effectiveAuto = (agent) => {
7013
+ const inherited = followIntent(agent);
7014
+ if (inherited !== void 0) return autoModelPreference(inherited.model) !== void 0 ? inherited.model : void 0;
7015
+ return pendingAuto(ctx, agent);
7016
+ };
6811
7017
  const installAgent = (agent) => {
6812
7018
  if (agentDisposers.has(agent)) return;
6813
7019
  const removeAssembly = agent.ctx.on("system-prompt/assemble", async (_assembly, _context, next) => {
7020
+ const inherited = followIntent(agent);
6814
7021
  const assembled = await next();
7022
+ if (inherited !== void 0) return {
7023
+ ...assembled,
7024
+ variables: {
7025
+ ...assembled.variables,
7026
+ provider: inherited.provider,
7027
+ model: inherited.model
7028
+ }
7029
+ };
6815
7030
  const pending = pendingAuto(ctx, agent);
6816
7031
  if (pending === void 0) return assembled;
6817
7032
  return {
@@ -6830,8 +7045,17 @@ function installAutoModelRouting(ctx, dependencies) {
6830
7045
  turn,
6831
7046
  messages: entered
6832
7047
  });
6833
- const pending = pendingAuto(ctx, agent);
7048
+ const pending = effectiveAuto(agent);
6834
7049
  const preference = pending === void 0 ? void 0 : autoModelPreference(pending);
7050
+ const inherited = followIntent(agent);
7051
+ if (result.kind === "enter" && !signal.aborted && inherited !== void 0 && preference === void 0) {
7052
+ const filtered = result.messages.filter((message) => !modelSelectionNotice(message));
7053
+ const notice = actualNotice(agent, inherited.model);
7054
+ return {
7055
+ ...result,
7056
+ messages: notice === void 0 ? filtered : [...filtered, notice]
7057
+ };
7058
+ }
6835
7059
  if (result.kind !== "enter" || signal.aborted || preference === void 0) return result;
6836
7060
  let state = routed.get(agent);
6837
7061
  if (state?.turn !== turn) {
@@ -6869,11 +7093,19 @@ function installAutoModelRouting(ctx, dependencies) {
6869
7093
  agentDisposers.delete(agent);
6870
7094
  captured.delete(agent);
6871
7095
  routed.delete(agent);
7096
+ followed.delete(agent);
6872
7097
  selections.remove(agent);
6873
7098
  });
6874
7099
  const removeRequest = ctx.on("agent/request", async ({ agent, turn, signal }, next) => {
6875
- const resolved = await next();
6876
- const pending = pendingAuto(ctx, agent);
7100
+ installAgent(agent);
7101
+ const native = await next();
7102
+ const inherited = followIntent(agent);
7103
+ const { reasoningEffort: _nativeEffort, ...withoutEffort } = native;
7104
+ const resolved = inherited === void 0 ? native : {
7105
+ ...withoutEffort,
7106
+ ...inherited
7107
+ };
7108
+ const pending = effectiveAuto(agent);
6877
7109
  const virtualPreference = resolved.provider === "github-copilot-preview" ? autoModelPreference(resolved.model) : void 0;
6878
7110
  const virtual = virtualPreference !== void 0;
6879
7111
  if (!virtual && pending === void 0) {
@@ -6904,7 +7136,7 @@ function installAutoModelRouting(ctx, dependencies) {
6904
7136
  }
6905
7137
  if (!state.recorded) {
6906
7138
  const projections = ctx.get("sessionProjections");
6907
- if (virtual && record(projections) && typeof projections.stateOf === "function") {
7139
+ if (inherited === void 0 && virtual && record(projections) && typeof projections.stateOf === "function") {
6908
7140
  const selection = projections.stateOf(agent.session, "modelSelection");
6909
7141
  if (record(selection) && selection.pending === null && agent.session.requestHeader() === void 0) Reflect.apply(agent.session.append, agent.session, ["model/selection", {
6910
7142
  provider: GITHUB_COPILOT_PREVIEW_PROVIDER_ID,
@@ -6929,6 +7161,7 @@ function installAutoModelRouting(ctx, dependencies) {
6929
7161
  removeCreated();
6930
7162
  removeDisposed();
6931
7163
  removeRequest();
7164
+ removeFollowProjection?.();
6932
7165
  for (const dispose of activeDisposers) dispose();
6933
7166
  activeDisposers.clear();
6934
7167
  selections.clear();
@@ -7646,7 +7879,8 @@ function apply$1(ctx, config = {}) {
7646
7879
  const excluded = excludedModels();
7647
7880
  return (await discoverSnapshot({ signal })).models.filter((model) => !excluded.has(model.id));
7648
7881
  },
7649
- budgetPolicy: () => budgetSettings()
7882
+ budgetPolicy: () => budgetSettings(),
7883
+ parentModelBindings: () => cacheSettings().parentModelFollow ?? []
7650
7884
  });
7651
7885
  const registration = ctx.llm.registerAdapter([GITHUB_COPILOT_PREVIEW_PROVIDER_ID], new PreviewAdapter(lifetime, optionsFor, discoverSnapshot, refreshRejected, budgetSettings, cacheSettings));
7652
7886
  let exclusionSignature = JSON.stringify([...excludedModels()]);
@@ -3,6 +3,7 @@ import type { Agent } from '@deepseek-ai/dsh-agent';
3
3
  import type { AccountModelDescriptor } from './account-model-catalog.ts';
4
4
  import type { RequestBudgetPolicy } from './request-budget.ts';
5
5
  import { TurnSelectionStore } from './turn-selection.ts';
6
+ import type { ParentModelBinding } from './parent-model-follow.ts';
6
7
  declare module '@deepseek-ai/cordis' {
7
8
  interface Context {
8
9
  githubCopilotTurnSelection: {
@@ -13,6 +14,7 @@ declare module '@deepseek-ai/cordis' {
13
14
  export interface AutoModelHostDependencies {
14
15
  loadModels(signal: AbortSignal): Promise<readonly AccountModelDescriptor[]>;
15
16
  budgetPolicy?: () => Partial<RequestBudgetPolicy>;
17
+ parentModelBindings?: () => readonly ParentModelBinding[];
16
18
  }
17
19
  /** Resolve virtual Auto once per Core turn before request/header persistence. */
18
20
  export declare function installAutoModelRouting(ctx: Context, dependencies: AutoModelHostDependencies): () => void;
@@ -8,6 +8,7 @@ import z from '@deepseek-ai/schemastery';
8
8
  import type { RequestBudgetPolicy } from './request-budget.ts';
9
9
  import type { WebSearchRoutingConfig } from './web-search-routing-config.ts';
10
10
  import type { LiveSetting } from './settings-reader.ts';
11
+ import type { ParentModelBinding } from './parent-model-follow.ts';
11
12
  /** Plugin configuration. Defaults make the current chat route decide. */
12
13
  export interface InlineConfig {
13
14
  /** Master switch; false sends every request down the normal adapter path. */
@@ -33,6 +34,8 @@ export interface InlineConfig {
33
34
  accountModelFailureCooldownMs?: number;
34
35
  /** Exact account model IDs hidden from the managed directory and every Auto candidate pool. */
35
36
  excludedModelIds?: string[];
37
+ /** Explicit native child/direct-parent enrollments; empty preserves native routing. */
38
+ parentModelFollow?: ParentModelBinding[];
36
39
  /** Estimated managed-route input headroom, separate from truthful catalog capacities. */
37
40
  requestBudgetSafetyTokens?: number;
38
41
  /** Fraction of admissible input used by eligible automatic-compaction requests. */
@@ -50,13 +53,15 @@ export interface InlineConfig {
50
53
  /** Internal JSON backup of route leaves temporarily owned by the GPT-6 overlay. */
51
54
  temporaryRouteBackup?: string;
52
55
  }
53
- export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds'> & {
56
+ export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow'> & {
57
+ parentModelFollow?: ParentModelBinding[] | LiveSetting<ArrayLike<ParentModelBinding>>;
54
58
  excludedModelIds?: string[] | LiveSetting<ArrayLike<string>>;
55
59
  searchModel?: string | LiveSetting<string | undefined>;
56
60
  searchRouting?: WebSearchRoutingConfig | LiveSetting<WebSearchRoutingConfig | undefined>;
57
61
  temporaryRouteBackup?: string | LiveSetting<string | undefined>;
58
62
  };
59
- export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds'> & {
63
+ export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow'> & {
64
+ parentModelFollow: LiveSetting<ArrayLike<ParentModelBinding>>;
60
65
  excludedModelIds: LiveSetting<ArrayLike<string>>;
61
66
  searchModel: LiveSetting<string | undefined>;
62
67
  searchRouting: LiveSetting<WebSearchRoutingConfig>;
@@ -0,0 +1,43 @@
1
+ /** Explicit enrollment, never inferred from equality of parent and child models. */
2
+ export interface ParentModelBinding {
3
+ readonly childSessionId: string;
4
+ readonly parentSessionId: string;
5
+ }
6
+ export interface FollowSelection {
7
+ readonly provider: string;
8
+ readonly model: string;
9
+ }
10
+ export interface FollowState {
11
+ readonly inherited: number;
12
+ readonly turn: number | null;
13
+ readonly started: boolean;
14
+ readonly explicit: FollowSelection | null;
15
+ readonly descriptor: boolean;
16
+ readonly blocked: boolean;
17
+ }
18
+ interface Event {
19
+ readonly seq: number;
20
+ readonly type: string;
21
+ readonly data: unknown;
22
+ }
23
+ export declare const PARENT_MODEL_FOLLOW_PROJECTION = "githubCopilotParentModelFollow";
24
+ export declare function followSelection(value: unknown): FollowSelection | undefined;
25
+ export declare function initialFollowState(inherited?: number): FollowState;
26
+ /** Fold only the child's own suffix; copied fork selections are not child overrides. */
27
+ export declare function foldFollowState(state: FollowState, event: Event): FollowState;
28
+ export declare class ParentModelFollowError extends Error {
29
+ readonly code: string;
30
+ constructor(code: string);
31
+ }
32
+ export interface FollowSubject {
33
+ readonly id: string;
34
+ readonly parentId?: string;
35
+ readonly origin?: string;
36
+ readonly state: FollowState;
37
+ readonly pending: FollowSelection | null;
38
+ readonly recorded?: FollowSelection;
39
+ }
40
+ /** Resolve a new turn's intent without changing any Session, setting or descriptor. */
41
+ export declare function resolveParentModel(child: FollowSubject, bindings: readonly ParentModelBinding[], lookup: (id: string) => FollowSubject | undefined): FollowSelection | undefined;
42
+ export {};
43
+ //# sourceMappingURL=parent-model-follow.d.ts.map
@@ -7,7 +7,7 @@ import type { InlineConfig } from './config.ts';
7
7
  import type { RequestBudgetPolicy } from './request-budget.ts';
8
8
  /** Safe request knobs; identities, model tables, endpoints and credentials are not configurable. */
9
9
  export type PreviewRouteConfig = Pick<PiAiProviderProfile, 'reasoning' | 'cacheRetention' | 'transport' | 'timeoutMs' | 'websocketConnectTimeoutMs' | 'streamIdleTimeoutMs' | 'maxRequestImageBytes' | 'requestImagePixelBudget' | 'requestImageMaxBytes' | 'retryPolicy'> & Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs'> & {
10
- readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds'>;
10
+ readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds' | 'parentModelFollow'>;
11
11
  readonly requestBudget?: Partial<RequestBudgetPolicy>;
12
12
  readonly requestBudgetSettings?: () => Partial<RequestBudgetPolicy>;
13
13
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-github-copilot",
3
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.65",
4
+ "version": "0.4.0-alpha.66",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",