dsh-github-copilot 0.4.0-alpha.133 → 0.4.0-alpha.134

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
@@ -141,7 +141,7 @@ Alpha.25 admits native `subagent/descriptor` v3, already v3 in the retained rc.1
141
141
 
142
142
  - Do not implement a second general wire adapter or independently maintained static Copilot model catalog. The account-scoped route composes the published adapter and SDK with validated supplier metadata.
143
143
  - Protocol and capability corrections must follow authenticated, current account metadata; new model IDs must not need new implementation tables. Native pi metadata may be reused only where it agrees with advertised endpoints and capabilities. Matching IDs alone do not prove correctness or authorize migration back into another Core catalog. Preserve old bounded ownership journals solely for verified restoration of legacy writes, never for new global protocol overrides.
144
- - Native Auto review compatibility must preserve Core's frozen request and strict fail-closed verdict ownership. `github-copilot.responsesOmitTemperature` defaults off; when explicitly enabled, omit temperature from every plugin-owned managed Responses options object, independently of model metadata. This is a compatibility override, not a capability claim. Never match reviewer prompts, model names or errors, intercept the canonical Core route, retry/resend, auto-enable/migrate the setting, rewrite a verdict or change permission policy.
144
+ - Native Auto review compatibility must preserve Core's frozen request and strict fail-closed verdict ownership. Automatic reviewer-only omission uses the documented public `internal/get` service-read waterfall, exact Loader root ownership and independently imported official rc.2 `apply` callback equality through same-profile `PluginPackages.packageOf` facts. Clone before native `stream` delegation only for account-proven managed Responses. Recheck identity after await and revoke on disposal; aliases, descendants, impostors and unknown package identity remain native with bounded diagnostics. Never activate a second reviewer or use private caches/registries. Missing optional reviewer packages do not block plugin startup. Ordinary concurrent Chat stays unchanged. The separate legacy `github-copilot.responsesOmitTemperature` override defaults off and affects all managed Responses only when explicitly enabled; it is not the automatic reviewer policy or a capability claim. Never infer support from thinking metadata, match reviewer prompts/models/errors, intercept canonical routes, retry/resend, migrate settings, rewrite verdicts or change permissions. See `docs/auto-review-sampling.md`.
145
145
  - Solve protocol gaps inside the plugin using existing published extension points. Do not require a new Core capability/service or patch Core to keep a single route. The managed account-model route reuses the published adapter with one shared OAuth grant; label multiple routes honestly. Keep canonical Core models/configuration under their existing owner instead of rewriting them from the companion's pi catalog.
146
146
  - Preserve public Responses summaries and the effective selected-model reasoning effort. Never synthesize raw reasoning replay from summaries or read/decrypt opaque replay data; assistant reasoning/replay histories delegate to Core before probing.
147
147
  - Do not require or silently support `copilot2api`, an external gateway, a pasted GitHub token, a placeholder key, or `dsh-web-search-provider`.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0-alpha.134 (prepared)
4
+
5
+ - Automatically omit temperature only for the authenticated official rc.2 Auto reviewer root calling an account-proven managed Responses route. Ordinary concurrent Chat and other tool listeners retain their sampling; no opt-in or settings migration is required.
6
+ - Qualify the public service-read facade with profile package ownership and independent exported callback equality, before cloning and delegating through the native LLM pipeline. Missing/unknown reviewer identity, aliases, descendants, other protocols and canonical routes remain native. Dispose the plugin-owned listener and revoke delayed reviewer dispatch.
7
+ - Execute native reviewer fixtures explicitly on unchanged source and published artifacts with exact-count/no-skip receipts. Preserve strict verdicts and fail-closed tool denial. Earlier excluded published-fixture selector claims remain retracted; synthetic qualification is not live endpoint evidence.
8
+ - Keep the separate all-managed-Responses override default false and preserve immutable alpha.132/alpha.133 releases. No live settings, installation or restart is included.
9
+
3
10
  ## 0.4.0-alpha.133 (prepared)
4
11
 
5
12
  - Correct the #374 temperature-compatibility claim: `supports.thinking` does not establish temperature support. Replace inferred omission with the explicit, default-off `github-copilot.responsesOmitTemperature` override.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  GitHub Copilot account discovery, contextual Auto routing and hosted search for DSH. The plugin reuses DSH's published native adapter, retaining a profile-wide account default with independent Session next-turn choices; it does not patch Core or maintain a second model catalog.
10
10
 
11
- **Current release: [`0.4.0-alpha.133`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.0-alpha.133). Supported host: official DSH / Windows Desktop `0.2.0-rc.2`.** This is still an alpha release, not a stable-channel promotion. Earlier DSH pins are historical evidence, not supported installation targets. Published, installed in a profile and loaded by a running Host are separate states.
11
+ **Current release: [`0.4.0-alpha.134`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.0-alpha.134). Supported host: official DSH / Windows Desktop `0.2.0-rc.2`.** This is still an alpha release, not a stable-channel promotion. Earlier DSH pins are historical evidence, not supported installation targets. Published, installed in a profile and loaded by a running Host are separate states.
12
12
 
13
13
  ## What you can do
14
14
 
@@ -85,10 +85,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
85
85
  For a **standalone named profile**:
86
86
 
87
87
  ```sh
88
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.133/dsh-github-copilot-0.4.0-alpha.133.tgz
88
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.134/dsh-github-copilot-0.4.0-alpha.134.tgz
89
89
  ```
90
90
 
91
- For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.133` after publication. Official rc.2's **Desktop-bundled CLI** also supports reserved-profile plugin management; a global/generic `dsh` shim is not equivalent. Qualify the installed entry before use. See [Desktop CLI qualification](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2) and the distinct [standalone offline procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles). Neither path authorizes registry-policy bypass, peer patches or configuration deletion.
91
+ For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.134` after publication. Official rc.2's **Desktop-bundled CLI** also supports reserved-profile plugin management; a global/generic `dsh` shim is not equivalent. Qualify the installed entry before use. See [Desktop CLI qualification](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2) and the distinct [standalone offline procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles). Neither path authorizes registry-policy bypass, peer patches or configuration deletion.
92
92
 
93
93
  After an approved reload/restart:
94
94
 
@@ -179,7 +179,7 @@ The same failure can include request-scoped native local body-write/header miles
179
179
 
180
180
  HTTP/SSE liveness separates five-minute byte idle from bounded ten-minute assistant-output silence by default. Consumer work is excluded; WebSocket/explicit `auto` stays native-only. This does not cure supplier HTTP 408s. Images are admitted against actual native-projected MIME evidence; the plugin does not own conversion or infer format support from filenames. [Image compatibility](./docs/image-input-compatibility.md).
181
181
 
182
- Native rc.2 Auto authorization review asks its selected route with `temperature: 0`. No verified supplier contract establishes that `capabilities.supports.thinking` determines temperature support; that metadata is not used for this decision. The explicit compatibility override `github-copilot.responsesOmitTemperature` defaults to `false`. Set it to `true` only when you choose to omit temperature from **all** account-discovered managed OpenAI Responses requests, regardless of native transport; it may address the reported reviewer 400 but also changes temperature semantics for ordinary chat and other requests on that managed protocol. It has no effect on Chat Completions, Anthropic Messages or the canonical Core-owned Copilot route. The plugin does not enable or migrate this setting automatically. The frozen reviewer request, strict verdict parser, cancellation and fail-closed tool denial remain unchanged; errors are not retried. See [model compatibility acceptance](./docs/model-compatibility-acceptance.md).
182
+ Native rc.2 Auto authorization review requests `temperature: 0`. The plugin now automatically omits it **only for the authenticated official Auto reviewer root on account-discovered managed OpenAI Responses**; no switch is needed. Concurrent ordinary Chat, even on the same Session/model, retains its temperature. Public Loader callback identity and same-profile package ownership authenticate the caller; unknown identity, aliases, descendants, other protocols/providers and canonical Core-owned Copilot remain native, with bounded diagnostics for unqualified reviewer scope. No capability is inferred from `supports.thinking`. Frozen inputs, native account/cancellation guards, strict verdicts and fail-closed tool denial remain intact; no retries, permission changes or settings migration occur. The independent legacy `github-copilot.responsesOmitTemperature` override remains default `false`; explicit `true` still omits temperature from **all** managed Responses requests, not just review. See [public scope and qualification limits](./docs/auto-review-sampling.md).
183
183
 
184
184
  ## Settings and troubleshooting
185
185
 
@@ -262,14 +262,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
262
262
  GitHub Releases and npm distribute the same original verified tarball. Pin a version; verify Release SHA-256 or npm `dist.integrity`. Never repack an immutable release or move/reuse its tag.
263
263
 
264
264
  ```sh
265
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.133/dsh-github-copilot-0.4.0-alpha.133.tgz
266
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.133/SHA256SUMS
265
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.134/dsh-github-copilot-0.4.0-alpha.134.tgz
266
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.134/SHA256SUMS
267
267
  sha256sum --check SHA256SUMS
268
268
  ```
269
269
 
270
270
  ```powershell
271
271
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
272
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.133.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
272
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.134.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
273
273
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
274
274
  ```
275
275
 
package/README.zh.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  为 DSH 提供 GitHub Copilot 账号模型发现、上下文 Auto 选模和 hosted search。插件复用 DSH 公开的原生适配器,保留 profile 全局默认账号,并支持 Session 后续 turn 指定独立账号;不修改 Core,也不维护第二套模型目录。
10
10
 
11
- **当前发布:[`0.4.0-alpha.133`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.0-alpha.133)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 仍为 alpha 版本,未升级为稳定发布通道。较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。
11
+ **当前发布:[`0.4.0-alpha.134`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.0-alpha.134)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 仍为 alpha 版本,未升级为稳定发布通道。较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。
12
12
 
13
13
  ## 你可以做什么
14
14
 
@@ -76,10 +76,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
76
76
  **独立具名 profile**:
77
77
 
78
78
  ```sh
79
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.133/dsh-github-copilot-0.4.0-alpha.133.tgz
79
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.134/dsh-github-copilot-0.4.0-alpha.134.tgz
80
80
  ```
81
81
 
82
- **Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.133`。官方 rc.2 **Desktop 随附的专属 CLI**也支持管理保留 profile;全局/普通 `dsh` shim 不等价。使用前核验实际安装入口,参见[Desktop CLI 核验](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2)及独立的[具名 profile 离线流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)。两种路径都不授权绕过包源政策、修改 peer 或删除配置。
82
+ **Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.134`。官方 rc.2 **Desktop 随附的专属 CLI**也支持管理保留 profile;全局/普通 `dsh` shim 不等价。使用前核验实际安装入口,参见[Desktop CLI 核验](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2)及独立的[具名 profile 离线流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)。两种路径都不授权绕过包源政策、修改 peer 或删除配置。
83
83
 
84
84
  经批准 reload/restart 后:
85
85
 
@@ -170,7 +170,7 @@ Copilot 搜索要求当前账号/协议证据及能力 proof。固定/fallba
170
170
 
171
171
  HTTP/SSE liveness 默认区分 5 分钟字节 idle 和有界的 10 分钟助手输出静默,排除消费者工作;WebSocket/显式 `auto`仍仅使用原生路径。这不修复供应方 HTTP 408。图片按原生实际投影 MIME 证据准入;插件不负责转换,也不按文件名猜格式支持。[图片兼容](./docs/image-input-compatibility.md)。
172
172
 
173
- 原生 rc.2 Auto 授权审查以 `temperature: 0` 请求所选路由。没有经验证的供应方契约能证明 `capabilities.supports.thinking` 决定 temperature 是否受支持;此元数据不会用于该判断。显式兼容覆盖项 `github-copilot.responsesOmitTemperature` 默认 `false`。只有在用户接受影响范围时才设为 `true`:无论原生传输方式如何,它都会从**所有**账号发现的托管 OpenAI Responses 请求中省略 temperature,可能解决已报告的 reviewer 400,但也会改变该托管协议上普通聊天及其它请求的 temperature 语义。它不影响 Chat Completions、Anthropic Messages 或 Core 所有的 canonical Copilot 路由。插件不会自动启用或迁移该设置。冻结的 reviewer 请求、严格 verdict 解析、取消和失败关闭的工具拒绝保持不变;错误不会重试。参见[模型兼容性验收](./docs/model-compatibility-acceptance.md)。
173
+ 原生 rc.2 Auto 授权审查以 `temperature: 0` 请求模型。插件现在**仅对身份已验证的官方 Auto reviewer 根上下文、账号发现的托管 OpenAI Responses 请求自动省略此参数**,无需开启开关。同一 Session/模型的并发普通 Chat 仍保留 temperature。身份由公开 Loader 回调与同 profile 包归属共同验证;未知身份、别名、子上下文、其它协议/供应方以及 Core 所有的 canonical Copilot 保持原生行为,未验证的 reviewer 范围只报告有界诊断。不会从 `supports.thinking` 推断兼容性。冻结输入、账号/取消约束、严格 verdict 和失败关闭的工具拒绝保持不变;没有重试、权限变更或设置迁移。独立的旧兼容覆盖项 `github-copilot.responsesOmitTemperature` 仍默认 `false`;显式 `true` 才影响**所有**托管 Responses 请求,不限于 review。参见[公开范围与验证限制](./docs/auto-review-sampling.md)。
174
174
 
175
175
  ## 设置与排障
176
176
 
@@ -253,14 +253,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
253
253
  GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
254
254
 
255
255
  ```sh
256
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.133/dsh-github-copilot-0.4.0-alpha.133.tgz
257
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.133/SHA256SUMS
256
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.134/dsh-github-copilot-0.4.0-alpha.134.tgz
257
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.134/SHA256SUMS
258
258
  sha256sum --check SHA256SUMS
259
259
  ```
260
260
 
261
261
  ```powershell
262
262
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
263
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.133.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
263
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.134.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
264
264
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
265
265
  ```
266
266
 
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "package": {
10
10
  "name": "dsh-github-copilot",
11
- "version": "0.4.0-alpha.133"
11
+ "version": "0.4.0-alpha.134"
12
12
  },
13
13
  "evidence": {
14
14
  "kind": "source-and-synthetic-test-inventory",
@@ -925,6 +925,9 @@
925
925
  "sourceMarkers": [
926
926
  {"file": "src/config.ts", "marker": "responsesOmitTemperature: z.boolean().default(false)"},
927
927
  {"file": "src/preview-provider.ts", "marker": "guard.responsesOmitTemperature === true"},
928
+ {"file": "src/index.ts", "marker": "ctx.effect(() => installAutoReviewSampling(ctx))"},
929
+ {"file": "src/auto-review-sampling.ts", "marker": "module.apply === fiber.runtime.callback"},
930
+ {"file": "vitest.auto-review-published.config.ts", "marker": "passWithNoTests: false"},
928
931
  {"file": "scripts/verify-tagged-core.mjs", "marker": "tests/fixtures/auto-review-copilot-core.fixture.ts"}
929
932
  ],
930
933
  "tests": [
@@ -932,7 +935,10 @@
932
935
  {"file": "tests/preview-provider.spec.ts", "name": "applies explicit Responses omission=%s independently of thinking metadata %j"},
933
936
  {"file": "tests/preview-provider.spec.ts", "name": "preserves default Responses temperature regardless of thinking metadata %j"},
934
937
  {"file": "tests/preview-route.spec.ts", "name": "reads temperature omission from dynamic config at lazy native stream dispatch"},
935
- {"file": "tests/fixtures/auto-review-copilot-core.fixture.ts", "name": "omits temperature with explicit opt-in without weakening the %s verdict boundary"}
938
+ {"file": "tests/fixtures/auto-review-copilot-core.fixture.ts", "name": "omits temperature with explicit opt-in without weakening the %s verdict boundary"},
939
+ {"file": "tests/fixtures/auto-review-copilot-core.fixture.ts", "name": "activates reviewer-only sampling through the actual plugin Host entry"},
940
+ {"file": "tests/fixtures/auto-review-copilot-core.fixture.ts", "name": "uses the native initiator and frozen Session account without a reviewer sessionId"},
941
+ {"file": "tests/loader-composition.spec.ts", "name": "starts and disposes without an optional native reviewer package or package resolver"}
936
942
  ]
937
943
  },
938
944
  {
@@ -0,0 +1,60 @@
1
+ # Native Auto reviewer sampling compatibility
2
+
3
+ The plugin automatically omits `temperature` only from the official DSH
4
+ `0.2.0-rc.2` Auto reviewer root's account-proven managed `openai-responses`
5
+ requests. No user opt-in is required. Concurrent ordinary Chat, even on the same
6
+ Session/model, retains its requested sampling. No supplier capability is inferred
7
+ from `supports.thinking`; the policy addresses the reported unsupported-temperature
8
+ reviewer rejection, not a claim about all supplier models.
9
+
10
+ ## Public ownership proof
11
+
12
+ At official commit `639ed015397290b3745d163aafe02ffee4aa3f84`:
13
+
14
+ - `vendor/cordis/src/events.ts:344-345` documents the exported `internal/get`
15
+ service-read waterfall, including the calling Context.
16
+ - `vendor/cordis/src/fiber.ts:9-13` exports `Context.fiber`;
17
+ `vendor/cordis/src/registry.ts:135-142` documents the public runtime callback as
18
+ executable identity.
19
+ - `vendor/loader/src/index.ts:52-54` exports `Fiber.entry`;
20
+ `vendor/loader/src/config/entry.ts:46-50,221-234` exposes the entry's root fiber
21
+ and imports the configured plugin; `config/tree.ts:10,112-124` exposes its
22
+ resolution context and importer.
23
+ - `packages/boot/app-boot/src/profile-resolution/service.ts:17-35,90-105`
24
+ publishes profile-aware `PluginPackages.packageOf` package ownership.
25
+
26
+ The plugin requires exact entry-root equality, the official package/version,
27
+ matching manifest ownership in the Loader tree and plugin import contexts, and
28
+ independently imported public `apply` equality with the caller's runtime callback.
29
+ It rechecks root/liveness after asynchronous resolution. Names alone are not
30
+ identity. Importing the public module does not apply/register another reviewer.
31
+
32
+ A reversible plugin-owned facade delegates every exposed service property except
33
+ scoped `stream` unchanged. For a proven managed Responses route, it clones the
34
+ frozen caller options and omits temperature before native normalization/dispatch.
35
+ There is no source-option WeakSet, prompt/error/model-name matching, shared
36
+ prototype mutation, new wire, retry, verdict rewrite or permission change.
37
+ Native account/initiator routing and cancellation remain owners of request access.
38
+ Plugin disposal revokes its listener and in-flight scoped dispatch.
39
+
40
+ ## Scope and evidence limits
41
+
42
+ Canonical Core-owned Copilot, other providers/protocols, aliases, descendants,
43
+ impostor callbacks and unresolved identity remain native. Unqualified reviewer
44
+ identity reports bounded fixed-code Host diagnostics, not a broad omission
45
+ fallback. Missing optional reviewer packages do not prevent ordinary startup.
46
+ Future official versions need qualification; the exact rc.2 check is intentional.
47
+
48
+ The independent legacy `responsesOmitTemperature` setting remains default false.
49
+ Explicit true still changes **all** managed Responses sampling; it is not needed
50
+ for this automatic reviewer-only policy and is not silently enabled or migrated.
51
+
52
+ The fixture uses the unchanged native reviewer, LLM normalization and adapter with
53
+ synthetic credentials/metadata/HTTP responses. Published artifacts exercise the
54
+ actual native Loader importer; tagged source uses the public-export TypeScript
55
+ fixture resolver. Both runners explicitly include the reviewer fixture and reject
56
+ missing, skipped or wrong-count suites. Canonical/other-provider negatives use
57
+ test-owned native adapter stubs, not live canonical transport. No qualification
58
+ claim proves live supplier acceptance, installed/loaded state or paid inference.
59
+ The earlier published `.fixture.ts` CLI filter was excluded by the ordinary
60
+ `.spec.ts` include; its execution claims remain retracted on issues #374/#378.
@@ -14,7 +14,7 @@ Follow the [plugin-only boundary](../AGENTS.md#plugin-only-implementation-bounda
14
14
  4. **One credential lifecycle.** All plugin-owned routes share the canonical Host-only Copilot OAuth record. Model discovery, refresh and in-flight requests remain bound to the same account generation. Account switches, entitlement removal, disposal and stale callbacks must fail closed without copying credentials or changing other providers.
15
15
  5. **Thinking is included.** Preserve public summary deltas and final-only summaries without duplicate text. Validate selected effort and keep native default semantics. Empty or encrypted-only responses must not become fabricated explanations. Native replay, images and file projection retain their owning adapter's behavior; opaque replay is not displayed or rewritten into raw reasoning text.
16
16
  6. **Current pi 0.87.1 compatibility.** The original acceptance target was 0.85.1; official DSH rc.2 now depends on `^0.87.1`. Pin and test the exact published SDK version, not just a GitHub release label. Its Copilot GPT-6 catalog protocol must not override contrary provider endpoint evidence. An updated catalog entry is not sufficient grounds to retire a correction if the protocol/capabilities are still wrong.
17
- 7. **Do not infer temperature support from reasoning metadata.** No verified supplier contract in this repository establishes that `capabilities.supports.thinking` means temperature is unsupported or supported. Ignore that field for sampling compatibility. `github-copilot.responsesOmitTemperature` is an explicit, default-off plugin compatibility override: when enabled, omit temperature from all account-discovered managed Responses requests, regardless of thinking metadata or native transport. This can address the reported native Auto-review 400, but changes temperature semantics for every request on that managed protocol while enabled. Preserve Core's frozen request, caller options, other protocols/providers and the Core-owned canonical route. Never identify the reviewer by prompt, model name or error; never retry a rejection, rewrite a verdict or change permission policy.
17
+ 7. **Do not infer temperature support from reasoning metadata.** No verified supplier contract establishes that `capabilities.supports.thinking` means temperature is unsupported or supported. Automatic reviewer-only omission requires authenticated exact official rc.2 root callback identity through the public service-read/Loader/profile package seams and account-proven managed Responses metadata. Clone before native delegation, preserve concurrent ordinary Chat and reject unqualified identity without broad fallback. Test actual Host startup/disposal and the unchanged native reviewer/LLM/adapter pipeline, with explicit nonzero/no-skip fixture collection. The independent `github-copilot.responsesOmitTemperature` override remains default false; explicit true affects all managed Responses. Preserve frozen options, cancellation, other protocols/providers and canonical ownership. Never use prompt/model/error matching, retry a rejection, rewrite a verdict or change permissions. See [the exact public proof and limitations](./auto-review-sampling.md); previously excluded fixture execution claims stay retracted.
18
18
 
19
19
  ## Regression evidence
20
20
 
package/lib/client.js CHANGED
@@ -6988,7 +6988,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6988
6988
  };
6989
6989
  //#endregion
6990
6990
  //#region package.json
6991
- var version = "0.4.0-alpha.133";
6991
+ var version = "0.4.0-alpha.134";
6992
6992
  //#endregion
6993
6993
  //#region lib/types/diagnostics-client.js
6994
6994
  let owner;
package/lib/index.js CHANGED
@@ -311,7 +311,7 @@ const result$1 = strictRemoteCodec("dsh-github-copilot#DiagnosticsView", Diagnos
311
311
  var package_default = {
312
312
  name: "dsh-github-copilot",
313
313
  description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
314
- version: "0.4.0-alpha.133",
314
+ version: "0.4.0-alpha.134",
315
315
  publishConfig: {
316
316
  "access": "public",
317
317
  "registry": "https://registry.npmjs.org/",
@@ -365,6 +365,7 @@ var package_default = {
365
365
  "AGENTS.md",
366
366
  "docs/agent-readiness.md",
367
367
  "docs/model-compatibility-acceptance.md",
368
+ "docs/auto-review-sampling.md",
368
369
  "docs/single-route-migration.md",
369
370
  "docs/session-search-routing.md",
370
371
  "docs/npm-distribution.md",
@@ -2191,7 +2192,7 @@ var Budget = class {
2191
2192
  if (this.consumed > ACCOUNT_MODEL_CATALOG_LIMITS.maxBytes) fail$1("CATALOG_TOO_LARGE", true);
2192
2193
  }
2193
2194
  };
2194
- function record$14(value, code) {
2195
+ function record$15(value, code) {
2195
2196
  if (typeof value !== "object" || value === null || Array.isArray(value)) fail$1(code);
2196
2197
  return value;
2197
2198
  }
@@ -2244,11 +2245,11 @@ function normalizeModel(raw, id, options, budget) {
2244
2245
  if (options.availableModelIds?.has(id) !== true) fail$1("MISSING_POLICY");
2245
2246
  policySource = "account-available-id";
2246
2247
  } else {
2247
- if (text$2(field(record$14(rawPolicy, "INVALID_POLICY"), "state", budget), 64, "INVALID_POLICY", budget) !== "enabled") fail$1("POLICY_NOT_ENABLED");
2248
+ if (text$2(field(record$15(rawPolicy, "INVALID_POLICY"), "state", budget), 64, "INVALID_POLICY", budget) !== "enabled") fail$1("POLICY_NOT_ENABLED");
2248
2249
  policySource = "server-enabled";
2249
2250
  }
2250
- const capabilities = record$14(field(raw, "capabilities", budget), "INVALID_CAPABILITIES");
2251
- const supports = record$14(field(capabilities, "supports", budget), "INVALID_SUPPORTS");
2251
+ const capabilities = record$15(field(raw, "capabilities", budget), "INVALID_CAPABILITIES");
2252
+ const supports = record$15(field(capabilities, "supports", budget), "INVALID_SUPPORTS");
2252
2253
  const streaming = field(supports, "streaming", budget);
2253
2254
  if (streaming === false) fail$1("STREAMING_UNSUPPORTED");
2254
2255
  if (streaming !== true) fail$1("INVALID_SUPPORTS");
@@ -2269,7 +2270,7 @@ function normalizeModel(raw, id, options, budget) {
2269
2270
  if (selected === void 0) fail$1(unsupportedEndpointCount === 0 && endpoints.includes("ws:/responses") ? "WEBSOCKET_ONLY" : "UNSUPPORTED_ENDPOINTS");
2270
2271
  const rawLimits = field(capabilities, "limits", budget);
2271
2272
  if (rawLimits === void 0) fail$1("MISSING_LIMITS");
2272
- const limits = record$14(rawLimits, "INVALID_LIMITS");
2273
+ const limits = record$15(rawLimits, "INVALID_LIMITS");
2273
2274
  const maxContext = optionalPositive(limits, "max_context_window_tokens", "INVALID_LIMITS", budget);
2274
2275
  const maxInputTokens = optionalPositive(limits, "max_prompt_tokens", "INVALID_LIMITS", budget);
2275
2276
  if (maxContext === void 0 && maxInputTokens === void 0) fail$1("MISSING_CONTEXT_LIMIT");
@@ -2287,7 +2288,7 @@ function normalizeModel(raw, id, options, budget) {
2287
2288
  if (vision === true) {
2288
2289
  const rawVisionLimits = field(limits, "vision", budget);
2289
2290
  if (rawVisionLimits !== void 0) {
2290
- const rawMediaTypes = field(record$14(rawVisionLimits, "INVALID_VISION_LIMITS"), "supported_media_types", budget);
2291
+ const rawMediaTypes = field(record$15(rawVisionLimits, "INVALID_VISION_LIMITS"), "supported_media_types", budget);
2291
2292
  if (rawMediaTypes !== void 0) {
2292
2293
  const mediaTypes = stringList(rawMediaTypes, ACCOUNT_MODEL_CATALOG_LIMITS.maxMediaTypes, 128, "INVALID_VISION_LIMITS", budget);
2293
2294
  const mime = /^[a-z0-9][a-z0-9!#$%&'*+.^_`|~-]*\/[a-z0-9][a-z0-9!#$%&'*+.^_`|~-]*$/iu;
@@ -2349,7 +2350,7 @@ function normalizeAccountModelCatalog(raw, options = {}) {
2349
2350
  fail$1("INVALID_JSON", true);
2350
2351
  }
2351
2352
  }
2352
- const data = field(record$14(raw, "INVALID_CATALOG"), "data", budget);
2353
+ const data = field(record$15(raw, "INVALID_CATALOG"), "data", budget);
2353
2354
  if (!Array.isArray(data)) fail$1("INVALID_CATALOG");
2354
2355
  const count = field(data, "length", budget);
2355
2356
  if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0) fail$1("INVALID_CATALOG");
@@ -2372,7 +2373,7 @@ function normalizeAccountModelCatalog(raw, options = {}) {
2372
2373
  for (let index = 0; index < count; index++) {
2373
2374
  let id;
2374
2375
  try {
2375
- const candidate = record$14(field(data, String(index), budget), "INVALID_MODEL");
2376
+ const candidate = record$15(field(data, String(index), budget), "INVALID_MODEL");
2376
2377
  const candidateId = text$2(field(candidate, "id", budget), ACCOUNT_MODEL_CATALOG_LIMITS.maxIdLength, "INVALID_ID", budget);
2377
2378
  if (!identifier.test(candidateId)) fail$1("INVALID_ID");
2378
2379
  id = candidateId;
@@ -3395,16 +3396,16 @@ function formatRequestUploadEvidence(evidence) {
3395
3396
  //#endregion
3396
3397
  //#region lib/types/request-body-timeout.js
3397
3398
  const observedMessage = "Timed out reading request body. Try again, or use a smaller request size.";
3398
- function record$13(value) {
3399
+ function record$14(value) {
3399
3400
  return typeof value === "object" && value !== null && !Array.isArray(value);
3400
3401
  }
3401
3402
  /** Verified provider evidence, not guessed capabilities, token limits or network cause. */
3402
3403
  async function requestBodyTimeoutDiagnostic(response, body, signal, dispatch) {
3403
3404
  if (response.status !== 408 || signal?.aborted) return void 0;
3404
3405
  const value = await readResponseErrorJson(response, signal);
3405
- if (signal?.aborted || !record$13(value)) return void 0;
3406
+ if (signal?.aborted || !record$14(value)) return void 0;
3406
3407
  const error = Object.hasOwn(value, "error") ? value.error : value;
3407
- if (!record$13(error) || error.code !== "user_request_timeout" || error.message !== observedMessage || value.code !== void 0 && value.code !== error.code || value.message !== void 0 && value.message !== error.message) return void 0;
3408
+ if (!record$14(error) || error.code !== "user_request_timeout" || error.message !== observedMessage || value.code !== void 0 && value.code !== error.code || value.message !== void 0 && value.message !== error.message) return void 0;
3408
3409
  const compression = dispatch?.compression;
3409
3410
  const encoding = compression?.encoding === "gzip" ? ` Encoded body: ${compression.wireBytes} gzip bytes (prepared HTTP body, excluding transport framing; not confirmed delivered bytes). Lossless content encoding does not reduce context tokens or prove remote receipt.` : compression !== void 0 && compression.reason !== "disabled" ? ` Request compression not applied: ${compression.reason}; original request retained.` : "";
3410
3411
  const size = body === void 0 ? "Request body size unavailable." : `Request body${compression?.encoding === "gzip" ? " (original JSON)" : ""}: ${Buffer.byteLength(body, "utf8")} UTF-8 bytes (not context tokens).`;
@@ -6176,7 +6177,7 @@ const usageSchema = z.object({
6176
6177
  totalTokens: count$2.optional(),
6177
6178
  reasoningTokens: count$2.optional()
6178
6179
  });
6179
- function record$12(value) {
6180
+ function record$13(value) {
6180
6181
  return typeof value === "object" && value !== null && !Array.isArray(value);
6181
6182
  }
6182
6183
  function sameRoute$1(left, right) {
@@ -6198,7 +6199,7 @@ function initialContextEvidence() {
6198
6199
  }
6199
6200
  /** Read only counts and routing leaves; never message content or opaque replay. */
6200
6201
  function foldContextEvidence(state, event) {
6201
- if (!record$12(event) || typeof event.type !== "string" || !record$12(event.data)) return state;
6202
+ if (!record$13(event) || typeof event.type !== "string" || !record$13(event.data)) return state;
6202
6203
  if (event.type === "step/start") {
6203
6204
  const step = stepSchema.safeParse({
6204
6205
  turn: event.data.turn,
@@ -6260,7 +6261,7 @@ function foldContextEvidence(state, event) {
6260
6261
  };
6261
6262
  const operation = state.compaction;
6262
6263
  if (operation?.state === "running" && count$2.safeParse(event.seq).success && Number(event.seq) > operation.startSeq) {
6263
- if (event.type === "user/message" && record$12(event.data.source) && event.data.source.kind === "compact-checkpoint" && event.data.source.compactionId === operation.id) state = {
6264
+ if (event.type === "user/message" && record$13(event.data.source) && event.data.source.kind === "compact-checkpoint" && event.data.source.compactionId === operation.id) state = {
6264
6265
  ...state,
6265
6266
  compaction: {
6266
6267
  ...operation,
@@ -6277,7 +6278,7 @@ function foldContextEvidence(state, event) {
6277
6278
  };
6278
6279
  }
6279
6280
  if (event.type === "request/header" || event.type === "model/selection") {
6280
- const raw = event.type === "request/header" ? record$12(event.data.header) ? event.data.header.config : void 0 : event.data;
6281
+ const raw = event.type === "request/header" ? record$13(event.data.header) ? event.data.header.config : void 0 : event.data;
6281
6282
  const revoke = () => state.compaction ? {
6282
6283
  ...state.compaction,
6283
6284
  headerSeq: null,
@@ -6285,7 +6286,7 @@ function foldContextEvidence(state, event) {
6285
6286
  step: null,
6286
6287
  request: "unknown"
6287
6288
  } : state.compaction;
6288
- if (!record$12(raw)) return {
6289
+ if (!record$13(raw)) return {
6289
6290
  ...state,
6290
6291
  route: null,
6291
6292
  sample: null,
@@ -6336,7 +6337,7 @@ function foldContextEvidence(state, event) {
6336
6337
  };
6337
6338
  }
6338
6339
  if (event.type.startsWith("compaction/") || event.surfaceOp !== void 0 && event.surfaceOp !== "append") {
6339
- const checkpoint = event.type === "user/message" && record$12(event.data.source) && event.data.source.kind === "compact-checkpoint" && event.data.source.compactionId === state.compaction?.id;
6340
+ const checkpoint = event.type === "user/message" && record$13(event.data.source) && event.data.source.kind === "compact-checkpoint" && event.data.source.compactionId === state.compaction?.id;
6340
6341
  return {
6341
6342
  ...state,
6342
6343
  sample: null,
@@ -6354,9 +6355,9 @@ function foldContextEvidence(state, event) {
6354
6355
  }
6355
6356
  if (event.type !== "assistant/message" && event.type !== "assistant/attempt") return state;
6356
6357
  if (!copilot(state.route)) return state;
6357
- const source = record$12(event.data.message) ? event.data.message.source : event.data.source;
6358
+ const source = record$13(event.data.message) ? event.data.message.source : event.data.source;
6358
6359
  if (event.type === "assistant/message" && source !== void 0) {
6359
- const parsed = routeSchema.safeParse(record$12(source) ? {
6360
+ const parsed = routeSchema.safeParse(record$13(source) ? {
6360
6361
  provider: source.provider,
6361
6362
  model: source.model
6362
6363
  } : source);
@@ -6386,11 +6387,11 @@ function foldContextEvidence(state, event) {
6386
6387
  const settledUsage = usage !== void 0;
6387
6388
  let terminal;
6388
6389
  for (const entry of stream) {
6389
- if (!record$12(entry) || entry.type !== "chunk" || !record$12(entry.chunk)) continue;
6390
+ if (!record$13(entry) || entry.type !== "chunk" || !record$13(entry.chunk)) continue;
6390
6391
  if (!settledUsage && entry.chunk.type === "usage") usage = entry.chunk.usage;
6391
6392
  if (entry.chunk.type === "finish") terminal = entry.chunk.reason;
6392
6393
  }
6393
- const successful = event.data.interrupted !== true && record$12(terminal) && (terminal.kind === "stop" || terminal.kind === "max-tokens" || terminal.kind === "tool-calls");
6394
+ const successful = event.data.interrupted !== true && record$13(terminal) && (terminal.kind === "stop" || terminal.kind === "max-tokens" || terminal.kind === "tool-calls");
6394
6395
  const compact = state.compaction;
6395
6396
  if (compact?.state === "completed") {
6396
6397
  if (compact.headerSeq === null || !count$2.safeParse(event.seq).success || Number(event.seq) <= compact.headerSeq) return state;
@@ -6407,7 +6408,7 @@ function foldContextEvidence(state, event) {
6407
6408
  ...state,
6408
6409
  compaction: {
6409
6410
  ...compact,
6410
- request: event.type === "assistant/message" && successful && source !== void 0 ? "succeeded" : record$12(terminal) && terminal.kind === "aborted" ? "cancelled" : record$12(terminal) && terminal.kind === "error" ? "failed" : "unknown"
6411
+ request: event.type === "assistant/message" && successful && source !== void 0 ? "succeeded" : record$13(terminal) && terminal.kind === "aborted" ? "cancelled" : record$13(terminal) && terminal.kind === "error" ? "failed" : "unknown"
6411
6412
  }
6412
6413
  };
6413
6414
  } else if (compact?.state === "running") return state;
@@ -6474,7 +6475,7 @@ const contextEvidenceDefinition = {
6474
6475
  function installContextEvidence(ctx) {
6475
6476
  ctx.inject(["sessionProjections"], (scope) => {
6476
6477
  const registry = scope.get("sessionProjections");
6477
- if (!record$12(registry) || typeof registry.register !== "function") {
6478
+ if (!record$13(registry) || typeof registry.register !== "function") {
6478
6479
  scope.logger.warn("[github-copilot] COPILOT_CONTEXT_PROJECTION_UNAVAILABLE");
6479
6480
  return;
6480
6481
  }
@@ -7537,7 +7538,7 @@ function buildAnthropicWireBody(request, cfg, model) {
7537
7538
  }
7538
7539
  //#endregion
7539
7540
  //#region lib/types/responses-reasoning-text.js
7540
- function record$11(value) {
7541
+ function record$12(value) {
7541
7542
  return typeof value === "object" && value !== null;
7542
7543
  }
7543
7544
  function responseIndex(value) {
@@ -7595,13 +7596,13 @@ var ResponsesReasoningText = class {
7595
7596
  }
7596
7597
  /** Only recognized public text fields are examined; no copying of the item. */
7597
7598
  snapshot(item) {
7598
- if (!record$11(item) || item.type !== "reasoning") return "";
7599
+ if (!record$12(item) || item.type !== "reasoning") return "";
7599
7600
  let delta = "";
7600
7601
  for (const family of ["summary", "raw"]) {
7601
7602
  const value = family === "summary" ? item.summary : item.content;
7602
7603
  if (!Array.isArray(value)) continue;
7603
7604
  for (const [index, part] of value.entries()) {
7604
- if (!record$11(part) || part.type !== (family === "summary" ? "summary_text" : "reasoning_text")) continue;
7605
+ if (!record$12(part) || part.type !== (family === "summary" ? "summary_text" : "reasoning_text")) continue;
7605
7606
  delta += this.update(family, index, part.text, true);
7606
7607
  }
7607
7608
  }
@@ -9940,13 +9941,13 @@ function resolveCopilotResponsesReasoning(ctx, request, candidate) {
9940
9941
  }
9941
9942
  //#endregion
9942
9943
  //#region lib/types/replay-recovery.js
9943
- function record$10(value) {
9944
+ function record$11(value) {
9944
9945
  return value !== null && typeof value === "object" && !Array.isArray(value);
9945
9946
  }
9946
9947
  function parsed(body) {
9947
9948
  if (requestBodyEvidence(body, "openai-responses").state !== "complete" || body === void 0) throw new Error("COPILOT_REPLAY_RECOVERY_EVIDENCE_UNAVAILABLE");
9948
9949
  const payload = JSON.parse(body);
9949
- if (!record$10(payload) || !Array.isArray(payload.input) || !payload.input.every(record$10)) throw new Error("COPILOT_REPLAY_RECOVERY_INVALID_PAYLOAD");
9950
+ if (!record$11(payload) || !Array.isArray(payload.input) || !payload.input.every(record$11)) throw new Error("COPILOT_REPLAY_RECOVERY_INVALID_PAYLOAD");
9950
9951
  return {
9951
9952
  input: payload.input,
9952
9953
  payload
@@ -10042,7 +10043,7 @@ var ReplayRecoveryStore = class {
10042
10043
  const value = hash(item);
10043
10044
  return value === void 0 || !admitted.has(value);
10044
10045
  }).length === decoded.input.length) return payload;
10045
- if (!record$10(payload) || !Array.isArray(payload.input)) throw new Error("COPILOT_REPLAY_RECOVERY_INVALID_PAYLOAD");
10046
+ if (!record$11(payload) || !Array.isArray(payload.input)) throw new Error("COPILOT_REPLAY_RECOVERY_INVALID_PAYLOAD");
10046
10047
  const input = payload.input.filter((_, index) => {
10047
10048
  const item = decoded.input[index];
10048
10049
  const value = hash(item);
@@ -10248,7 +10249,7 @@ const SESSION_CONTINUATION_LIMITS = Object.freeze({
10248
10249
  ciphertextCodeUnits: 67108864,
10249
10250
  chunkCodeUnits: 65536
10250
10251
  });
10251
- function record$9(value) {
10252
+ function record$10(value) {
10252
10253
  return typeof value === "object" && value !== null && !Array.isArray(value);
10253
10254
  }
10254
10255
  /** One admitted turn; fingerprints never become durable history or account provenance. */
@@ -10261,7 +10262,7 @@ var SessionContinuationTurn = class {
10261
10262
  async transform(payload, assertCurrent = () => {}) {
10262
10263
  assertCurrent();
10263
10264
  if (this.processing) throw new Error("COPILOT_CONTINUATION_PROCESSING_OVERLAP");
10264
- if (!record$9(payload) || !Array.isArray(payload.input) || payload.input.length > SESSION_CONTINUATION_LIMITS.inputItems) throw new Error("COPILOT_CONTINUATION_INVALID_PAYLOAD");
10265
+ if (!record$10(payload) || !Array.isArray(payload.input) || payload.input.length > SESSION_CONTINUATION_LIMITS.inputItems) throw new Error("COPILOT_CONTINUATION_INVALID_PAYLOAD");
10265
10266
  this.processing = true;
10266
10267
  try {
10267
10268
  const hashes = /* @__PURE__ */ new Map();
@@ -10272,7 +10273,7 @@ var SessionContinuationTurn = class {
10272
10273
  assertCurrent();
10273
10274
  }
10274
10275
  const item = payload.input[index];
10275
- if (!record$9(item)) throw new Error("COPILOT_CONTINUATION_INVALID_PAYLOAD");
10276
+ if (!record$10(item)) throw new Error("COPILOT_CONTINUATION_INVALID_PAYLOAD");
10276
10277
  if (item.type !== "reasoning") continue;
10277
10278
  const ciphertext = item.encrypted_content;
10278
10279
  if (typeof ciphertext !== "string" || !ciphertext || item.status !== void 0 && item.status !== "completed") throw new Error("COPILOT_CONTINUATION_UNSUPPORTED_REASONING");
@@ -10371,7 +10372,7 @@ const compactionContinuationDefinition = {
10371
10372
  view: (state) => state
10372
10373
  }
10373
10374
  };
10374
- function record$8(value) {
10375
+ function record$9(value) {
10375
10376
  return typeof value === "object" && value !== null && !Array.isArray(value);
10376
10377
  }
10377
10378
  /** Native brackets authorize scope, never loss; the existing Session policy authorizes loss. */
@@ -10381,7 +10382,7 @@ function installCompactionContinuation(ctx, enabled) {
10381
10382
  let disposed = false;
10382
10383
  const removeProjection = ctx.inject(["sessionProjections"], (scope) => {
10383
10384
  const registry = scope.get("sessionProjections");
10384
- if (!record$8(registry) || typeof registry.register !== "function") throw new Error("COPILOT_CONTINUATION_COMPACTION_PROJECTION_UNAVAILABLE");
10385
+ if (!record$9(registry) || typeof registry.register !== "function") throw new Error("COPILOT_CONTINUATION_COMPACTION_PROJECTION_UNAVAILABLE");
10385
10386
  const remove = registry.register(compactionContinuationDefinition);
10386
10387
  if (typeof remove !== "function") throw new Error("COPILOT_CONTINUATION_COMPACTION_PROJECTION_DISPOSER_UNAVAILABLE");
10387
10388
  return () => {
@@ -10837,7 +10838,7 @@ function installCompactionReplay(ctx) {
10837
10838
  }
10838
10839
  //#endregion
10839
10840
  //#region lib/types/agent-compaction.js
10840
- function record$7(value) {
10841
+ function record$8(value) {
10841
10842
  return typeof value === "object" && value !== null;
10842
10843
  }
10843
10844
  /** Resolve the owning preset's service without reaching into Core's service registry. */
@@ -10845,7 +10846,7 @@ function agentCompaction(agent) {
10845
10846
  if (typeof agent.ctx?.get !== "function") throw new LlmError("COPILOT_COMPACTION_AGENT_CONTEXT_UNAVAILABLE", "INVALID_REQUEST");
10846
10847
  const presets = agent.ctx.get("agentPresets");
10847
10848
  if (presets !== void 0) {
10848
- if (!record$7(presets) || typeof presets.composedPreset !== "function" || typeof presets.serviceFor !== "function") throw new LlmError("COPILOT_COMPACTION_PRESET_LOOKUP_UNAVAILABLE", "INVALID_REQUEST");
10849
+ if (!record$8(presets) || typeof presets.composedPreset !== "function" || typeof presets.serviceFor !== "function") throw new LlmError("COPILOT_COMPACTION_PRESET_LOOKUP_UNAVAILABLE", "INVALID_REQUEST");
10849
10850
  const preset = presets.composedPreset(agent.ctx);
10850
10851
  if (preset !== void 0) {
10851
10852
  if (typeof preset !== "string" || preset.trim().length === 0) throw new LlmError("COPILOT_COMPACTION_PRESET_LOOKUP_UNAVAILABLE", "INVALID_REQUEST");
@@ -10968,14 +10969,14 @@ function installCopilotCompactionPressure(ctx, callbacks) {
10968
10969
  }
10969
10970
  //#endregion
10970
10971
  //#region lib/types/pre-step-pressure.js
10971
- function record$6(value) {
10972
+ function record$7(value) {
10972
10973
  return typeof value === "object" && value !== null && !Array.isArray(value);
10973
10974
  }
10974
10975
  function positive(value) {
10975
10976
  return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
10976
10977
  }
10977
10978
  function isEngine(value) {
10978
- return record$6(value) && record$6(value.config) && typeof value.compactIfNeeded === "function";
10979
+ return record$7(value) && record$7(value.config) && typeof value.compactIfNeeded === "function";
10979
10980
  }
10980
10981
  /**
10981
10982
  * Prevent a continuing, unchanged route's known pressure from becoming an
@@ -10996,12 +10997,12 @@ function installCopilotPreStepPressure(ctx, callbacks) {
10996
10997
  const header = agent.session.requestHeader();
10997
10998
  if (header?.config.provider !== "github-copilot-preview" || !isPluginPreviewProvider(ctx, header.config.provider)) return decision;
10998
10999
  const projections = ctx.get("sessionProjections");
10999
- if (!record$6(projections) || typeof projections.stateOf !== "function") {
11000
+ if (!record$7(projections) || typeof projections.stateOf !== "function") {
11000
11001
  unavailable();
11001
11002
  return decision;
11002
11003
  }
11003
11004
  const selection = projections.stateOf(agent.session, "modelSelection");
11004
- if (!record$6(selection) || !Object.hasOwn(selection, "pending")) {
11005
+ if (!record$7(selection) || !Object.hasOwn(selection, "pending")) {
11005
11006
  unavailable();
11006
11007
  return decision;
11007
11008
  }
@@ -11023,20 +11024,20 @@ function installCopilotPreStepPressure(ctx, callbacks) {
11023
11024
  unavailable();
11024
11025
  return decision;
11025
11026
  }
11026
- const policy = Array.isArray(config.modelPolicies) ? config.modelPolicies.find((value) => record$6(value) && value.provider === header.config.provider && value.model === header.config.model) : void 0;
11027
- const retries = record$6(policy) ? policy.maxOverflowRetries ?? config.maxOverflowRetries : config.maxOverflowRetries;
11027
+ const policy = Array.isArray(config.modelPolicies) ? config.modelPolicies.find((value) => record$7(value) && value.provider === header.config.provider && value.model === header.config.model) : void 0;
11028
+ const retries = record$7(policy) ? policy.maxOverflowRetries ?? config.maxOverflowRetries : config.maxOverflowRetries;
11028
11029
  if (retries === 0) return decision;
11029
11030
  if (!positive(retries)) {
11030
11031
  unavailable();
11031
11032
  return decision;
11032
11033
  }
11033
11034
  const meter = ctx.get("tokenMeter");
11034
- if (!record$6(meter) || typeof meter.measure !== "function") {
11035
+ if (!record$7(meter) || typeof meter.measure !== "function") {
11035
11036
  unavailable();
11036
11037
  return decision;
11037
11038
  }
11038
11039
  const measured = meter.measure(agent.session);
11039
- if (!record$6(measured) || typeof measured.totalTokens !== "number" || !Number.isSafeInteger(measured.totalTokens) || measured.totalTokens < 0) {
11040
+ if (!record$7(measured) || typeof measured.totalTokens !== "number" || !Number.isSafeInteger(measured.totalTokens) || measured.totalTokens < 0) {
11040
11041
  unavailable();
11041
11042
  return decision;
11042
11043
  }
@@ -11154,17 +11155,17 @@ const TaskAssessmentSchema = z.object({
11154
11155
  "insufficient-evidence"
11155
11156
  ])).max(7)
11156
11157
  }).strict();
11157
- function record$5(value) {
11158
+ function record$6(value) {
11158
11159
  return typeof value === "object" && value !== null && !Array.isArray(value);
11159
11160
  }
11160
11161
  function text(message) {
11161
- if (!record$5(message) || !Array.isArray(message.content)) return "";
11162
- return message.content.flatMap((block) => record$5(block) && block.type === "text" && typeof block.text === "string" ? [block.text] : []).join("\n");
11162
+ if (!record$6(message) || !Array.isArray(message.content)) return "";
11163
+ return message.content.flatMap((block) => record$6(block) && block.type === "text" && typeof block.text === "string" ? [block.text] : []).join("\n");
11163
11164
  }
11164
11165
  function user(message) {
11165
- if (!record$5(message)) return false;
11166
- if (record$5(message.source) && message.source.kind === "model-selection") return false;
11167
- return message.role === "user" || record$5(message.source) && message.source.kind === "user";
11166
+ if (!record$6(message)) return false;
11167
+ if (record$6(message.source) && message.source.kind === "model-selection") return false;
11168
+ return message.role === "user" || record$6(message.source) && message.source.kind === "user";
11168
11169
  }
11169
11170
  function difficult(current) {
11170
11171
  return /\b(prove|proof|theorem|debug|investigate|diagnose)\b|证明|定理|调试|排查|根因|调查/iu.test(current);
@@ -11181,8 +11182,8 @@ function assessTaskLocally(messages) {
11181
11182
  const last = messages.findLast(user);
11182
11183
  const current = text(last).trim();
11183
11184
  const history = messages.slice(0, last === void 0 ? 0 : messages.lastIndexOf(last));
11184
- const hasWork = history.some((message) => record$5(message) && (message.role === "assistant" || message.role === "tool" || user(message) || record$5(message.source) && message.source.kind === "model"));
11185
- const nonText = record$5(last) && Array.isArray(last.content) && last.content.some((block) => !record$5(block) || block.type !== "text");
11185
+ const hasWork = history.some((message) => record$6(message) && (message.role === "assistant" || message.role === "tool" || user(message) || record$6(message.source) && message.source.kind === "model"));
11186
+ const nonText = record$6(last) && Array.isArray(last.content) && last.content.some((block) => !record$6(block) || block.type !== "text");
11186
11187
  if (!hasWork && !nonText && /^(hello|hi|hey|你好|您好|嗨)[!!。.\s]*$/iu.test(current)) return {
11187
11188
  demand: "simple",
11188
11189
  source: "local",
@@ -11224,7 +11225,7 @@ function assessTaskLocally(messages) {
11224
11225
  /** Separate text-only projection for assessment; never mutates the chat request. */
11225
11226
  function assessmentInput(messages) {
11226
11227
  let omitted = false;
11227
- const context = messages.filter((message) => !record$5(message) || message.role !== "system" && message.role !== "developer" && !(record$5(message.source) && message.source.kind === "model-selection"));
11228
+ const context = messages.filter((message) => !record$6(message) || message.role !== "system" && message.role !== "developer" && !(record$6(message.source) && message.source.kind === "model-selection"));
11228
11229
  const lastUser = context.findLastIndex(user);
11229
11230
  const priorUser = context.slice(0, lastUser < 0 ? 0 : lastUser).findLastIndex(user);
11230
11231
  const priority = [.../* @__PURE__ */ new Set([
@@ -11236,13 +11237,13 @@ function assessmentInput(messages) {
11236
11237
  let length = 0;
11237
11238
  for (const index of priority) {
11238
11239
  const message = context[index];
11239
- if (!record$5(message)) {
11240
+ if (!record$6(message)) {
11240
11241
  omitted = true;
11241
11242
  continue;
11242
11243
  }
11243
11244
  if (!Array.isArray(message.content)) omitted = true;
11244
11245
  const content = text(message);
11245
- if (Array.isArray(message.content) && message.content.some((block) => !record$5(block) || block.type !== "text")) omitted = true;
11246
+ if (Array.isArray(message.content) && message.content.some((block) => !record$6(block) || block.type !== "text")) omitted = true;
11246
11247
  if (content.length > 1600) omitted = true;
11247
11248
  const role = typeof message.role === "string" && [
11248
11249
  "user",
@@ -11394,14 +11395,14 @@ var AutoModelRoutingError = class extends Error {
11394
11395
  this.name = "AutoModelRoutingError";
11395
11396
  }
11396
11397
  };
11397
- function record$4(value) {
11398
+ function record$5(value) {
11398
11399
  return typeof value === "object" && value !== null;
11399
11400
  }
11400
11401
  function userMessage(value) {
11401
- if (!record$4(value)) return false;
11402
- if (record$4(value.source) && value.source.kind === "model-selection") return false;
11402
+ if (!record$5(value)) return false;
11403
+ if (record$5(value.source) && value.source.kind === "model-selection") return false;
11403
11404
  if (value.role === "user") return true;
11404
- return record$4(value.source) && value.source.kind === "user";
11405
+ return record$5(value.source) && value.source.kind === "user";
11405
11406
  }
11406
11407
  function latestUserContent(messages) {
11407
11408
  for (let index = messages.length - 1; index >= 0; index--) {
@@ -11412,9 +11413,9 @@ function latestUserContent(messages) {
11412
11413
  }
11413
11414
  function classifyAutoModelTurn(messages) {
11414
11415
  let text = "";
11415
- const requiresImage = messages.some((message) => record$4(message) && Array.isArray(message.content) && message.content.some((block) => record$4(block) && block.type === "image" && block.offloaded !== true));
11416
+ const requiresImage = messages.some((message) => record$5(message) && Array.isArray(message.content) && message.content.some((block) => record$5(block) && block.type === "image" && block.offloaded !== true));
11416
11417
  for (const block of latestUserContent(messages)) {
11417
- if (!record$4(block)) continue;
11418
+ if (!record$5(block)) continue;
11418
11419
  if (block.type === "text" && typeof block.text === "string") text += `${block.text}\n`;
11419
11420
  }
11420
11421
  const codeFenceCount = text.match(/```/gu)?.length ?? 0;
@@ -11464,7 +11465,7 @@ function resolveSeed(messages, context) {
11464
11465
  if (typeof context?.seed === "string" && context.seed.length > 0) return fnv1a(context.seed);
11465
11466
  if (context?.sessionId !== void 0) return fnv1a(`${context.sessionId}:${context.turn ?? 1}`);
11466
11467
  let text = "";
11467
- for (const block of latestUserContent(messages)) if (record$4(block) && typeof block.text === "string") text += block.text;
11468
+ for (const block of latestUserContent(messages)) if (record$5(block) && typeof block.text === "string") text += block.text;
11468
11469
  return fnv1a(text || "default-auto-seed");
11469
11470
  }
11470
11471
  function targetCategory(assessment, preference) {
@@ -11807,7 +11808,7 @@ const TurnRequestModelsStateSchema = z.object({
11807
11808
  }).strict().nullable(),
11808
11809
  turns: z.array(row).max(128)
11809
11810
  }).strict();
11810
- function record$3(value) {
11811
+ function record$4(value) {
11811
11812
  return typeof value === "object" && value !== null && !Array.isArray(value);
11812
11813
  }
11813
11814
  const validCount = (value) => count$1.safeParse(value).success;
@@ -11822,14 +11823,14 @@ function uncertain(state) {
11822
11823
  };
11823
11824
  }
11824
11825
  function foldTurnRequestModels(state, event) {
11825
- if (!record$3(event)) return state;
11826
+ if (!record$4(event)) return state;
11826
11827
  const lifecycle = [
11827
11828
  "turn/start",
11828
11829
  "turn/end",
11829
11830
  "step/start",
11830
11831
  "step/end"
11831
11832
  ].includes(String(event.type));
11832
- if (!record$3(event.data)) return lifecycle || event.type === "request/header" ? uncertain(state) : state;
11833
+ if (!record$4(event.data)) return lifecycle || event.type === "request/header" ? uncertain(state) : state;
11833
11834
  const data = event.data;
11834
11835
  if (lifecycle && (!validCount(data.turn) || event.type !== "turn/start" && state.active !== null && data.turn !== state.active.turn || String(event.type).startsWith("step/") && !validCount(data.step) || event.type === "step/start" && state.active?.step != null || event.type === "step/end" && state.active !== null && data.step !== state.active.step)) return uncertain(state);
11835
11836
  if (event.type === "turn/start" && validCount(data.turn)) return {
@@ -11864,8 +11865,8 @@ function foldTurnRequestModels(state, event) {
11864
11865
  active: null
11865
11866
  };
11866
11867
  if (event.type !== "request/header" || active.step === null) return state;
11867
- const config = record$3(data.header) ? data.header.config : void 0;
11868
- const parsed = route.safeParse(record$3(config) && [
11868
+ const config = record$4(data.header) ? data.header.config : void 0;
11869
+ const parsed = route.safeParse(record$4(config) && [
11869
11870
  "initial",
11870
11871
  "resume",
11871
11872
  "change",
@@ -11909,7 +11910,7 @@ const turnRequestModelsDefinition = {
11909
11910
  function installTurnRequestModels(ctx) {
11910
11911
  ctx.inject(["sessionProjections"], (scope) => {
11911
11912
  const registry = scope.get("sessionProjections");
11912
- if (!record$3(registry) || typeof registry.register !== "function") {
11913
+ if (!record$4(registry) || typeof registry.register !== "function") {
11913
11914
  scope.logger.warn("[github-copilot] COPILOT_TURN_REQUEST_PROJECTION_UNAVAILABLE");
11914
11915
  return;
11915
11916
  }
@@ -11962,7 +11963,7 @@ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializ
11962
11963
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
11963
11964
  done = true;
11964
11965
  };
11965
- function record$2(value) {
11966
+ function record$3(value) {
11966
11967
  return typeof value === "object" && value !== null;
11967
11968
  }
11968
11969
  /** Public Host binding for the existing bounded, runtime-only decision store. */
@@ -12033,7 +12034,7 @@ let TurnSelectionController = (() => {
12033
12034
  requestedModels(agent, turn) {
12034
12035
  if (!Number.isSafeInteger(turn) || turn < 0) throw new Error("COPILOT_TURN_SELECTION_INVALID_TURN");
12035
12036
  const registry = this.ctx.get("sessionProjections");
12036
- if (!record$2(registry) || typeof registry.stateOf !== "function") throw new Error("COPILOT_TURN_REQUEST_PROJECTION_UNAVAILABLE");
12037
+ if (!record$3(registry) || typeof registry.stateOf !== "function") throw new Error("COPILOT_TURN_REQUEST_PROJECTION_UNAVAILABLE");
12037
12038
  const row = TurnRequestModelsStateSchema.parse(registry.stateOf(agent.session, TURN_REQUEST_MODELS)).turns.find((value) => value.turn === turn);
12038
12039
  return row ? {
12039
12040
  routes: row.routes,
@@ -12175,7 +12176,7 @@ const AutoModelIntentSchema = z.object({
12175
12176
  selection: selectionSchema.nullable(),
12176
12177
  blocked: z.boolean()
12177
12178
  }).strict();
12178
- function record$1(value) {
12179
+ function record$2(value) {
12179
12180
  return typeof value === "object" && value !== null && !Array.isArray(value);
12180
12181
  }
12181
12182
  function initialAutoModelIntent(inherited = 0) {
@@ -12187,7 +12188,7 @@ function initialAutoModelIntent(inherited = 0) {
12187
12188
  }
12188
12189
  /** Request headers describe execution, not replacement of an explicit picker intent. */
12189
12190
  function foldAutoModelIntent(state, event) {
12190
- if (!record$1(event) || event.type !== "model/selection") return state;
12191
+ if (!record$2(event) || event.type !== "model/selection") return state;
12191
12192
  if (!Number.isSafeInteger(event.seq) || Number(event.seq) < 0) return {
12192
12193
  ...state,
12193
12194
  selection: null,
@@ -12195,7 +12196,7 @@ function foldAutoModelIntent(state, event) {
12195
12196
  };
12196
12197
  if (Number(event.seq) < state.inherited) return state;
12197
12198
  const data = event.data;
12198
- const parsed = selectionSchema.safeParse(record$1(data) ? {
12199
+ const parsed = selectionSchema.safeParse(record$2(data) ? {
12199
12200
  provider: data.provider,
12200
12201
  model: data.model
12201
12202
  } : data);
@@ -12243,14 +12244,14 @@ async function decide(dependencies, signal, messages, preference, context) {
12243
12244
  throw cause;
12244
12245
  }
12245
12246
  }
12246
- function record(value) {
12247
+ function record$1(value) {
12247
12248
  return typeof value === "object" && value !== null;
12248
12249
  }
12249
12250
  function buildRoutingContext(ctx, agent, turn, messages, budgetPolicyConfig) {
12250
12251
  const meter = ctx.get("tokenMeter");
12251
- if (!record(meter) || typeof meter.estimateMessage !== "function" || typeof meter.measure !== "function") throw failure$1("COPILOT_AUTO_TOKEN_METER_UNAVAILABLE");
12252
+ if (!record$1(meter) || typeof meter.estimateMessage !== "function" || typeof meter.measure !== "function") throw failure$1("COPILOT_AUTO_TOKEN_METER_UNAVAILABLE");
12252
12253
  const measured = meter.measure(agent.session);
12253
- if (!record(measured) || typeof measured.totalTokens !== "number" || !Number.isSafeInteger(measured.totalTokens) || measured.totalTokens < 0) throw failure$1("COPILOT_AUTO_TOKEN_ESTIMATE_INVALID");
12254
+ if (!record$1(measured) || typeof measured.totalTokens !== "number" || !Number.isSafeInteger(measured.totalTokens) || measured.totalTokens < 0) throw failure$1("COPILOT_AUTO_TOKEN_ESTIMATE_INVALID");
12254
12255
  const estimate = meter.estimateMessage.bind(meter);
12255
12256
  const estimateMessage = (message) => {
12256
12257
  const value = estimate(message);
@@ -12259,9 +12260,9 @@ function buildRoutingContext(ctx, agent, turn, messages, budgetPolicyConfig) {
12259
12260
  };
12260
12261
  const sessionId = typeof agent.session?.id === "string" ? agent.session.id : void 0;
12261
12262
  const compaction = agentCompaction(agent);
12262
- const compactionConfig = record(compaction) && record(compaction.config) ? compaction.config : void 0;
12263
+ const compactionConfig = record$1(compaction) && record$1(compaction.config) ? compaction.config : void 0;
12263
12264
  const compactionAvailable = compaction !== void 0 && compactionConfig?.auto !== false && (typeof compactionConfig?.maxOverflowRetries !== "number" || compactionConfig.maxOverflowRetries > 0);
12264
- const hasCompactionSummary = messages.some((m) => record(m) && (record(m.source) && (m.source.kind === "compaction" || m.source.kind === "compact-checkpoint") || typeof m.surfaceOp === "object"));
12265
+ const hasCompactionSummary = messages.some((m) => record$1(m) && (record$1(m.source) && (m.source.kind === "compaction" || m.source.kind === "compact-checkpoint") || typeof m.surfaceOp === "object"));
12265
12266
  const requestHeader = typeof agent.session?.requestHeader === "function" ? agent.session.requestHeader() : void 0;
12266
12267
  const requestedMaxTokens = requestHeader?.config.maxTokens;
12267
12268
  const requestBudgetPolicy = budgetPolicyConfig ? resolveRequestBudgetPolicy(budgetPolicyConfig) : DEFAULT_REQUEST_BUDGET_POLICY;
@@ -12278,7 +12279,7 @@ function buildRoutingContext(ctx, agent, turn, messages, budgetPolicyConfig) {
12278
12279
  };
12279
12280
  }
12280
12281
  function modelSelectionNotice(value) {
12281
- return record(value) && record(value.source) && value.source.kind === "model-selection";
12282
+ return record$1(value) && record$1(value.source) && value.source.kind === "model-selection";
12282
12283
  }
12283
12284
  function routeLabel(provider, model, otherProvider) {
12284
12285
  return provider === otherProvider ? model : `${provider}/${model}`;
@@ -12326,12 +12327,12 @@ function installAutoModelRouting(ctx, dependencies) {
12326
12327
  };
12327
12328
  const pendingAuto = (agent) => {
12328
12329
  const registry = ctx.get("sessionProjections");
12329
- if (!record(registry) || typeof registry.stateOf !== "function") return void 0;
12330
+ if (!record$1(registry) || typeof registry.stateOf !== "function") return void 0;
12330
12331
  const native = registry.stateOf(agent.session, "modelSelection");
12331
- if (!record(native)) return void 0;
12332
+ if (!record$1(native)) return void 0;
12332
12333
  const selection = native.pending;
12333
12334
  if (selection === null && agent.session.requestHeader()?.config.provider === "github-copilot-preview") return retainedAuto(registry, agent.session);
12334
- if (!record(selection) || selection.provider !== "github-copilot-preview") return void 0;
12335
+ if (!record$1(selection) || selection.provider !== "github-copilot-preview") return void 0;
12335
12336
  return typeof selection.model === "string" && autoModelPreference(selection.model) !== void 0 ? selection.model : void 0;
12336
12337
  };
12337
12338
  const decisionFor = (agent, turn, messages, preference, signal) => {
@@ -12389,7 +12390,7 @@ function installAutoModelRouting(ctx, dependencies) {
12389
12390
  const previous = followed.get(agent);
12390
12391
  if (previous) {
12391
12392
  const registry = ctx.get("sessionProjections");
12392
- if (!record(registry) || typeof registry.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
12393
+ if (!record$1(registry) || typeof registry.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
12393
12394
  const state = followSchema.safeParse(registry.stateOf(agent.session, PARENT_MODEL_FOLLOW_PROJECTION));
12394
12395
  if (!state.success) throw failure$1("COPILOT_PARENT_MODEL_TURN_UNAVAILABLE");
12395
12396
  if (state.data.turn === previous.turn) return previous.selection;
@@ -12398,7 +12399,7 @@ function installAutoModelRouting(ctx, dependencies) {
12398
12399
  const followAll = dependencies.followParentModel?.() === true;
12399
12400
  if (!bindings.some((binding) => binding.childSessionId === agent.session.id) && (!followAll || agent.session.header.origin !== "subagent")) return void 0;
12400
12401
  const projections = ctx.get("sessionProjections");
12401
- if (!record(projections) || typeof projections.register !== "function" || typeof projections.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
12402
+ if (!record$1(projections) || typeof projections.register !== "function" || typeof projections.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
12402
12403
  const stateOf = projections.stateOf;
12403
12404
  if (!removeFollowProjection) {
12404
12405
  const remove = projections.register({
@@ -12414,16 +12415,16 @@ function installAutoModelRouting(ctx, dependencies) {
12414
12415
  };
12415
12416
  }
12416
12417
  const readSubject = (value) => {
12417
- if (!record(value) || !record(value.session)) return void 0;
12418
+ if (!record$1(value) || !record$1(value.session)) return void 0;
12418
12419
  const session = value.session;
12419
- if (typeof session.id !== "string" || !record(session.header) || typeof session.requestHeader !== "function") return void 0;
12420
+ if (typeof session.id !== "string" || !record$1(session.header) || typeof session.requestHeader !== "function") return void 0;
12420
12421
  const parsed = followSchema.safeParse(Reflect.apply(stateOf, projections, [session, PARENT_MODEL_FOLLOW_PROJECTION]));
12421
12422
  const selection = Reflect.apply(stateOf, projections, [session, "modelSelection"]);
12422
- if (!parsed.success || !record(selection) || !Object.hasOwn(selection, "pending")) throw failure$1("COPILOT_PARENT_MODEL_SELECTION_UNAVAILABLE");
12423
+ if (!parsed.success || !record$1(selection) || !Object.hasOwn(selection, "pending")) throw failure$1("COPILOT_PARENT_MODEL_SELECTION_UNAVAILABLE");
12423
12424
  const pending = selection.pending === null ? null : followSelection(selection.pending);
12424
12425
  if (pending === void 0) throw failure$1("COPILOT_PARENT_MODEL_SELECTION_UNAVAILABLE");
12425
12426
  const header = session.requestHeader();
12426
- const recorded = record(header) ? followSelection(header.config) : void 0;
12427
+ const recorded = record$1(header) ? followSelection(header.config) : void 0;
12427
12428
  const retained = pending === null && recorded?.provider === "github-copilot-preview" ? retainedAuto(projections, session) : void 0;
12428
12429
  return {
12429
12430
  id: session.id,
@@ -12449,7 +12450,7 @@ function installAutoModelRouting(ctx, dependencies) {
12449
12450
  const agents = ctx.get("agents");
12450
12451
  try {
12451
12452
  const selection = resolveParentModel(child, bindings, (id) => {
12452
- if (!record(agents) || typeof agents.get !== "function") return void 0;
12453
+ if (!record$1(agents) || typeof agents.get !== "function") return void 0;
12453
12454
  return readSubject(agents.get(id));
12454
12455
  }, followAll);
12455
12456
  followed.set(agent, {
@@ -12471,9 +12472,9 @@ function installAutoModelRouting(ctx, dependencies) {
12471
12472
  const owner = ctx.get("githubCopilotSessionAccounts");
12472
12473
  if (!owner) return;
12473
12474
  const projections = ctx.get("sessionProjections");
12474
- const state = record(projections) && typeof projections.stateOf === "function" ? projections.stateOf(agent.session, "modelSelection") : void 0;
12475
- const pending = record(state) ? state.pending : void 0;
12476
- if ((followIntent(agent)?.provider ?? (record(pending) ? pending.provider : agent.session.requestHeader()?.config.provider ?? (record(state) && pending === null ? ctx.get("agentDefaultModel")?.currentSelection()?.provider : void 0))) === "github-copilot-preview") owner.admit(agent, turn, signal);
12475
+ const state = record$1(projections) && typeof projections.stateOf === "function" ? projections.stateOf(agent.session, "modelSelection") : void 0;
12476
+ const pending = record$1(state) ? state.pending : void 0;
12477
+ if ((followIntent(agent)?.provider ?? (record$1(pending) ? pending.provider : agent.session.requestHeader()?.config.provider ?? (record$1(state) && pending === null ? ctx.get("agentDefaultModel")?.currentSelection()?.provider : void 0))) === "github-copilot-preview") owner.admit(agent, turn, signal);
12477
12478
  };
12478
12479
  const installAgent = (agent) => {
12479
12480
  if (agentDisposers.has(agent)) return;
@@ -12587,8 +12588,8 @@ function installAutoModelRouting(ctx, dependencies) {
12587
12588
  if (!virtual && pending === void 0) {
12588
12589
  routed.delete(agent);
12589
12590
  const projections = ctx.get("sessionProjections");
12590
- const selection = record(projections) && typeof projections.stateOf === "function" ? projections.stateOf(agent.session, "modelSelection") : void 0;
12591
- const fixed = record(selection) && record(selection.pending) && selection.pending.provider === resolved.provider && selection.pending.model === resolved.model;
12591
+ const selection = record$1(projections) && typeof projections.stateOf === "function" ? projections.stateOf(agent.session, "modelSelection") : void 0;
12592
+ const fixed = record$1(selection) && record$1(selection.pending) && selection.pending.provider === resolved.provider && selection.pending.model === resolved.model;
12592
12593
  if (!signal.aborted && (resolved.provider === "github-copilot-preview" || resolved.provider === "github-copilot")) {
12593
12594
  if (resolved.provider === "github-copilot-preview") dependencies.admitModel?.(agent, turn, resolved.model, signal);
12594
12595
  selections.record(agent, turn, { mode: fixed ? "manual" : "unknown" });
@@ -12609,9 +12610,9 @@ function installAutoModelRouting(ctx, dependencies) {
12609
12610
  }
12610
12611
  if (!state.recorded) {
12611
12612
  const projections = ctx.get("sessionProjections");
12612
- if (inherited === void 0 && virtual && record(projections) && typeof projections.stateOf === "function") {
12613
+ if (inherited === void 0 && virtual && record$1(projections) && typeof projections.stateOf === "function") {
12613
12614
  const selection = projections.stateOf(agent.session, "modelSelection");
12614
- if (record(selection) && selection.pending === null && agent.session.requestHeader() === void 0) Reflect.apply(agent.session.append, agent.session, ["model/selection", {
12615
+ if (record$1(selection) && selection.pending === null && agent.session.requestHeader() === void 0) Reflect.apply(agent.session.append, agent.session, ["model/selection", {
12615
12616
  provider: GITHUB_COPILOT_PREVIEW_PROVIDER_ID,
12616
12617
  model: resolved.model
12617
12618
  }]);
@@ -13853,6 +13854,104 @@ var preview_route_default = {
13853
13854
  apply: apply$1
13854
13855
  };
13855
13856
  //#endregion
13857
+ //#region lib/types/auto-review-sampling.js
13858
+ var __rewriteRelativeImportExtension = function(path, preserveJsx) {
13859
+ if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
13860
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
13861
+ });
13862
+ return path;
13863
+ };
13864
+ const REVIEWER = "@deepseek-ai/dsh-experimental-auto-review";
13865
+ const CORE_VERSION = "0.2.0-rc.2";
13866
+ function record(value) {
13867
+ return value !== null && typeof value === "object";
13868
+ }
13869
+ function streamService(value) {
13870
+ return record(value) && typeof value.stream === "function";
13871
+ }
13872
+ /** Resolve the published callback, never the configured entry's display name. */
13873
+ async function isNativeReviewerContext(caller) {
13874
+ const fiber = caller.fiber;
13875
+ const entry = fiber.entry;
13876
+ if (entry === void 0 || entry.fiber !== fiber || entry.options.name !== REVIEWER || fiber.runtime === null || fiber.uid === null) return false;
13877
+ const base = entry.parent.tree.ctx.baseUrl;
13878
+ const packages = caller.get("pluginPackages");
13879
+ if (base === void 0 || packages === void 0) return false;
13880
+ const owner = packages.packageOf(REVIEWER, base);
13881
+ if (owner?.name !== REVIEWER || owner.version !== CORE_VERSION) return false;
13882
+ if (packages.packageOf(REVIEWER, import.meta.url)?.manifestPath !== owner.manifestPath) return false;
13883
+ const module = await import(__rewriteRelativeImportExtension(REVIEWER));
13884
+ return record(module) && typeof module.apply === "function" && module.apply === fiber.runtime.callback && fiber.uid !== null && entry.fiber === fiber && entry.options.name === REVIEWER;
13885
+ }
13886
+ /** Reversible service-read delegation; neither the native service nor its context is changed. */
13887
+ function installAutoReviewSampling(ctx) {
13888
+ let active = true;
13889
+ const lifecycle = new AbortController();
13890
+ const diagnosed = /* @__PURE__ */ new Set();
13891
+ const diagnose = (code) => {
13892
+ if (diagnosed.has(code)) return;
13893
+ diagnosed.add(code);
13894
+ ctx.logger.warn(`github-copilot: Auto reviewer sampling scope unavailable (${code})`);
13895
+ };
13896
+ const dispose = ctx.on("internal/get", (caller, name, _error, next) => {
13897
+ const native = next();
13898
+ if (!active || name !== "llm" || !streamService(native)) return native;
13899
+ const entry = caller.fiber.entry;
13900
+ if (entry === void 0 || entry.fiber !== caller.fiber || entry.options.name !== REVIEWER) return native;
13901
+ const runtime = native;
13902
+ const scopedStream = (options) => (async function* () {
13903
+ if (!active || options.provider !== "github-copilot-preview") {
13904
+ yield* runtime.stream(options);
13905
+ return;
13906
+ }
13907
+ let identified;
13908
+ try {
13909
+ identified = await isNativeReviewerContext(caller);
13910
+ } catch {
13911
+ diagnose("COPILOT_AUTO_REVIEW_IDENTITY_UNAVAILABLE");
13912
+ yield* runtime.stream(options);
13913
+ return;
13914
+ }
13915
+ if (!active || !identified) {
13916
+ if (active) diagnose("COPILOT_AUTO_REVIEW_IDENTITY_UNPROVEN");
13917
+ yield* runtime.stream(options);
13918
+ return;
13919
+ }
13920
+ const preview = ctx.get("githubCopilotPreview");
13921
+ if (preview === void 0) {
13922
+ diagnose("COPILOT_AUTO_REVIEW_ROUTE_UNAVAILABLE");
13923
+ yield* runtime.stream(options);
13924
+ return;
13925
+ }
13926
+ await preview.discover({ signal: options.signal });
13927
+ const route = preview.recoveryLimits(options.model, currentSearchInitiator(ctx));
13928
+ if (!active || route?.api !== "openai-responses") {
13929
+ if (active && route === void 0) diagnose("COPILOT_AUTO_REVIEW_ROUTE_UNPROVEN");
13930
+ yield* runtime.stream(options);
13931
+ return;
13932
+ }
13933
+ route.assertCurrent();
13934
+ const signal = options.signal === void 0 ? lifecycle.signal : AbortSignal.any([options.signal, lifecycle.signal]);
13935
+ const request = {
13936
+ ...options,
13937
+ temperature: void 0,
13938
+ signal
13939
+ };
13940
+ if (Object.isFrozen(options)) Object.freeze(request);
13941
+ yield* runtime.stream(request);
13942
+ })();
13943
+ return new Proxy(runtime, { get(target, key) {
13944
+ return key === "stream" ? scopedStream : Reflect.get(target, key, target);
13945
+ } });
13946
+ });
13947
+ return () => {
13948
+ active = false;
13949
+ lifecycle.abort();
13950
+ dispose();
13951
+ diagnosed.clear();
13952
+ };
13953
+ }
13954
+ //#endregion
13856
13955
  //#region lib/types/index.js
13857
13956
  /**
13858
13957
  * The inline web-search plugin: short-circuits agent-loop model calls on
@@ -13911,6 +14010,7 @@ function observeSettingsNamespace(ctx, namespace, config, hooks) {
13911
14010
  * @param config - the composition entry config, used as the settings base layer.
13912
14011
  */
13913
14012
  function apply(ctx, config) {
14013
+ ctx.effect(() => installAutoReviewSampling(ctx));
13914
14014
  ctx.plugin({ apply(scope) {
13915
14015
  new DiagnosticsController(scope);
13916
14016
  } });
@@ -0,0 +1,6 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ /** Resolve the published callback, never the configured entry's display name. */
3
+ export declare function isNativeReviewerContext(caller: Context): Promise<boolean>;
4
+ /** Reversible service-read delegation; neither the native service nor its context is changed. */
5
+ export declare function installAutoReviewSampling(ctx: Context): () => void;
6
+ //# sourceMappingURL=auto-review-sampling.d.ts.map
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.133",
4
+ "version": "0.4.0-alpha.134",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",
@@ -54,6 +54,7 @@
54
54
  "AGENTS.md",
55
55
  "docs/agent-readiness.md",
56
56
  "docs/model-compatibility-acceptance.md",
57
+ "docs/auto-review-sampling.md",
57
58
  "docs/single-route-migration.md",
58
59
  "docs/session-search-routing.md",
59
60
  "docs/npm-distribution.md",