dsh-github-copilot 0.4.0-alpha.88 → 0.4.0-alpha.91
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 +2 -0
- package/CHANGELOG.md +6 -0
- package/README.md +109 -408
- package/README.zh.md +109 -419
- package/deployment-baseline.json +5 -1
- package/docs/agent-readiness.md +5 -0
- package/docs/auto-task-routing.md +40 -5
- package/docs/automatic-model-routing.md +168 -379
- package/docs/copilot-compaction.md +8 -0
- package/docs/copilot-usage.md +7 -9
- package/docs/dual-model.md +60 -46
- package/docs/image-input-compatibility.md +50 -79
- package/docs/images/copilot-model-preferences.png +0 -0
- package/docs/images/copilot-search-routing.png +0 -0
- package/docs/model-compatibility-acceptance.md +41 -0
- package/docs/npm-distribution.md +129 -178
- package/docs/official-first-016-alpha2.md +4 -0
- package/docs/official-first-020-rc1.md +4 -0
- package/docs/session-search-routing.md +123 -65
- package/docs/single-route-migration.md +112 -97
- package/lib/index.js +117 -29
- package/lib/types/pre-step-pressure.d.ts +8 -0
- package/package.json +1 -1
|
@@ -4,112 +4,127 @@
|
|
|
4
4
|
|
|
5
5
|
## Result and boundaries
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
One Host-owned OAuth account supplies many account models. The stable managed
|
|
8
|
+
route ID is `github-copilot-preview`, displayed as **GitHub Copilot**.
|
|
9
|
+
Fresh installations need no native provider definition. Upgrades preserve
|
|
10
|
+
existing `llm-pi-ai.providers.github-copilot`; two real groups can remain until
|
|
11
|
+
explicit migration. This is configuration removal, not hiding a card.
|
|
12
|
+
|
|
13
|
+
Native Add/Save can recreate another group. The warning is additive, not
|
|
14
|
+
single-route enforcement; Core Edit/Delete remains. Model discovery/UI lifecycle
|
|
15
|
+
is described in the [current README](../README.md#install-and-sign-in), not a
|
|
16
|
+
prerequisite to removing a route.
|
|
17
|
+
|
|
18
|
+
Keep `llm-pi-ai` and authorization mounted and preserve the sole credential
|
|
19
|
+
record `llm-pi-ai/github-copilot`. Do not sign out, delete credentials or remove
|
|
20
|
+
authorization to hide a group. `models: []` can mean the default catalog, not
|
|
21
|
+
disabled models.
|
|
22
|
+
|
|
23
|
+
Plugin code never auto-migrates settings, selections or histories. Installation,
|
|
24
|
+
real requests, Session/default changes, configuration edits and Host interruption
|
|
25
|
+
need their own explicit approvals. Public `session.selectModel` also writes the
|
|
26
|
+
future global default: other selected/history-backed Sessions keep their context,
|
|
27
|
+
but unselected empty Sessions may inherit it.
|
|
28
|
+
|
|
29
|
+
## Read-only readiness and maintenance scope
|
|
30
|
+
|
|
31
|
+
Use no-argument `githubCopilot.migrationStatus()` for fresh live-Agent evidence,
|
|
32
|
+
not stale generic `session/list` or an unversioned inventory. It reports:
|
|
33
|
+
|
|
34
|
+
| Field | Interpretation |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `plugin.name/version`, `protocolVersion: 1`, `observedAt` | Loaded build's structural self-report, not full Desktop/Core byte attestation |
|
|
37
|
+
| `capabilities` | `agentsList`, `sessionProjections`, `settingsCas`, `providerRegistry`, `defaultSelection` |
|
|
38
|
+
| `complete.sessions/defaultSelection/routes` | Observation completeness; missing/false is unknown, not safe absence |
|
|
39
|
+
| `effectiveSelection` / `selectionSource` | Pending projection, then request-header config, then default only for genuinely empty Sessions with known projection state |
|
|
40
|
+
| `activeRequestSelection` | Latest recorded header, not proven in-flight model work; idle usually null |
|
|
41
|
+
| Native effective configuration and native/managed registration | Separate facts, never infer one from the other |
|
|
42
|
+
|
|
43
|
+
This read uses no auth/discovery, credentials or network and writes no settings
|
|
44
|
+
or Sessions. `historyScope: live-agents-only` excludes cold stored conversations.
|
|
45
|
+
Operators must acknowledge that old conversations may need explicit selection
|
|
46
|
+
when resumed. The observation is not an atomic cross-namespace transaction;
|
|
47
|
+
recheck immediately before CAS.
|
|
48
|
+
|
|
49
|
+
The planned `cloga/dsh-windows-ops` command
|
|
50
|
+
`tools/migrate-copilot-managed-route.ps1` is separate **config-only v1**
|
|
51
|
+
maintenance. This guide does not attest its publication or execution. It does
|
|
52
|
+
not select Sessions/defaults, scan cold history, install/restart DSH or certify a
|
|
53
|
+
Desktop baseline. Resolve approved selection blockers separately.
|
|
34
54
|
|
|
35
55
|
## Review before removal
|
|
36
56
|
|
|
37
|
-
1.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
1. Verify an absence-preserving published plugin is installed **and loaded**,
|
|
58
|
+
with matching Host/Client. Older code may recreate the profile. A version
|
|
59
|
+
declaration or screenshot is not loaded-runtime evidence.
|
|
60
|
+
2. Ensure discovery and accepted managed models. Use visible Retry or intentional
|
|
61
|
+
Refresh, not repeated sign-in/disabled validation. Metadata is not transport
|
|
62
|
+
proof; a real test request needs separate approval.
|
|
63
|
+
3. Deliberately select only approved Sessions/defaults. Preserve model/effort
|
|
64
|
+
only if actually supported. Review paused histories, presets/task references
|
|
65
|
+
without bulk rewrites. Confirm selections before removing their old route.
|
|
66
|
+
4. Review configuration source, effective base layers, namespace revision and
|
|
67
|
+
ownership journals. Inherited configuration, ambiguity or another writer
|
|
68
|
+
blocks removal. Never delete journals or patch Core to force it.
|
|
69
|
+
|
|
70
|
+
Keep the existing profile if any prerequisite is uncertain.
|
|
44
71
|
|
|
45
72
|
## Apply the reviewed Ops migration after release
|
|
46
73
|
|
|
47
|
-
1.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
1. Recheck readiness/capabilities/completeness and approved selections. Obtain the
|
|
75
|
+
cold-history acknowledgement. Any Host interruption needs separate approval.
|
|
76
|
+
2. Take a private settings-only backup outside Git/shared docs. Do not copy or
|
|
77
|
+
disclose OAuth credentials. Check current user-native profile/base/journal.
|
|
78
|
+
3. CAS-remove only the reviewed user-native
|
|
79
|
+
`llm-pi-ai.providers.github-copilot` path against the observed revision.
|
|
80
|
+
Preserve the mount/section, credentials, companion and all other provider
|
|
81
|
+
fields. Conflict/already-absent is not permission for blind retry.
|
|
82
|
+
4. Read persisted/effective settings and actual registry, then composer and
|
|
83
|
+
`/model`. Report one managed group only when canonical registration is truly
|
|
84
|
+
absent and no other layer supplies it. A hidden card/write success is not enough.
|
|
85
|
+
5. Separately review any nonempty search `providers` allowlist. An approved
|
|
86
|
+
replacement of the legacy entry with `github-copilot-preview` preserves other
|
|
87
|
+
entries; never clear/broaden automatically.
|
|
88
|
+
6. Verify credentials, approved selections/default and other histories separately.
|
|
89
|
+
`route: not-configured` is optional canonical absence, not login failure or
|
|
90
|
+
proof of a successful model/search call.
|
|
91
|
+
|
|
92
|
+
A stuck **Deleting…** dialog proves neither removal nor its failure. Do not
|
|
93
|
+
repeat deletion; review persisted state after an authorized stop.
|
|
55
94
|
|
|
56
95
|
## History, search and rollback
|
|
57
96
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
## 中文操作说明
|
|
64
|
-
|
|
65
|
-
### 目标与限制
|
|
66
|
-
|
|
67
|
-
**V3 目标:**一个全局 Copilot 账号、多个共享账号模型,已显式选择/有历史选择的 Session 独立。插件代码不自动迁移配置、不强制唯一注册;实际只保留托管路由是发布后获准的 Ops 步骤:操作者先单独处理批准的 Session/默认值选择,仅配置 v1 维护再按 CAS 移除审核过的 user-native profile 并回读 registry。维护命令不写 Session/默认选择。禁止批量改写历史/设置/凭据或隐藏分组。
|
|
97
|
+
Managed IDs remain stable. No transparent canonical alias/history conversion is
|
|
98
|
+
created. Resumed canonical conversations need an explicit supported selection,
|
|
99
|
+
or preservation/restoration of their original route. Search keeps its existing
|
|
100
|
+
[initiator, metadata, allowlist and proof boundaries](./session-search-routing.md);
|
|
101
|
+
removing canonical does not turn managed chat into custom inline transport.
|
|
68
102
|
|
|
69
|
-
|
|
103
|
+
For rollback, stop the relevant Host with permission and compare fresh settings
|
|
104
|
+
with the private backup. Restore only reviewed canonical fields and approved
|
|
105
|
+
selection changes, never overwrite unrelated later edits. Keep ambiguous
|
|
106
|
+
journals for review. Restart with approval and verify registration, credentials
|
|
107
|
+
and selections separately; this is not model-call proof. Older plugin rollback
|
|
108
|
+
may recreate canonical, not a second account.
|
|
70
109
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
正常发现无需手工定义模型或常规手动刷新;公开 slot 仍不能替换 Core **Edit/Delete**,原生编辑器保留。显式界面登录/切换账号成功后强制发现一次;打开 Models 会另外通过非强制 `ensureModels()` 确保缺失/idle/过期/error/loading的已登录元数据,error 重开可在共享冷却结束后重试,但无同次挂载循环;loading 加入已有 Host 请求,不增加网络请求。新鲜 ready 不拉取,真正 unavailable 且空模型不自动重试。状态/详情本身仍无网络。`github-copilot` 默认 `accountModelTtlMs: 86400000`(24 小时最大复用)、`accountModelFailureCooldownMs: 300000`(5 分钟失败冷却),Host 合并为一个在途发现,不设周期元数据轮询;另有挂载期间每 60 秒更新相对时间文字的纯显示定时器,不调用 RPC/status/discovery。后台凭据/reset 事件清状态并只读查询,不对每个 token 事件强制发现;下次打开/使用再确保元数据。
|
|
74
|
-
|
|
75
|
-
alpha.7 的上次成功时间(`snapshot.discoveredAt`)只在模型数量旁、**Manage** 外显示一次:相对文字为英文,tooltip 和可访问语义 `time` 提供完整本地日期、时间及时区。缺失/无效/无账号时隐藏,未来时间显示绝对值。等待/失败保留上次成功时间,刷新成功才更新,退出登录清除;时间消失或卸载时清理显示定时器。缓存和发现生命周期不变。
|
|
76
|
-
|
|
77
|
-
同账号旧元数据可在 TTL 刷新/loading/error 时展示,但不能授权请求。凭据/账号/权限失效或 proof 到期立即撤销证据,TTL 不延长 token。明确 `UNKNOWN_MODEL` 只触发一次有界元数据刷新,不重放消息或切换模型;普通 HTTP/网络错误不能猜成模型不存在。新模型仍需支持的账号元数据。README 截图只提供合成展示证据;Host TTL/冷却时序需单元测试,不能靠截图证明。
|
|
78
|
-
|
|
79
|
-
升级不会自动删除已有 `llm-pi-ai.providers.github-copilot`。只有用户真正移除经过审核的旧配置后,composer 与 `/model` 才都会只列出托管 Copilot 分组,不是仅隐藏第二条路由。始终保留 `llm-pi-ai` 插件、授权服务和唯一 OAuth record `llm-pi-ai/github-copilot`;不要退出登录、删除凭据或卸载授权插件来隐藏分组,也不要用 `models: []` 冒充禁用。
|
|
80
|
-
|
|
81
|
-
安装、真实测试请求、默认模型/会话选择修改、停止 Host 和离线配置修改都需要各自明确授权。本文不是自动执行这些操作的许可。
|
|
82
|
-
|
|
83
|
-
### 只读就绪检查与维护范围(alpha.9)
|
|
84
|
-
|
|
85
|
-
使用无参数 `githubCopilot.migrationStatus()` 新鲜读取所有 live Agent Session,而不是依赖可能过时的通用 `session/list` 或不含加载版本的 inventory。结果提供加载构建 `plugin.name/version`、`protocolVersion: 1`、`observedAt`、五个 `capabilities` 标记(`agentsList`、`sessionProjections`、`settingsCas`、`providerRegistry`、`defaultSelection`)及 sessions/default/routes 的 `complete` 标记。缺失能力、false 完整性或必要选择/路由证据为 null 表示未知,不能推断安全缺失;idle Agent 的 `activeRequestSelection: null` 是正常值。
|
|
86
|
-
|
|
87
|
-
`effectiveSelection` 优先 pending projection,其次 request-header config;只有 projection 已知、确实无 pending/header 的空 live Session 才取默认值,`selectionSource` 表明来源。running Agent 的 `activeRequestSelection` 另报最近记录的 header,不证明 LLM 调用正在进行。路由标记区分有效 native 配置与 native/managed 注册。方法不执行 auth status/发现、不访问凭据/网络、不修改 settings/Session,也不新增常规界面。
|
|
88
|
-
|
|
89
|
-
协议 v1 的 `historyScope: live-agents-only` 不扫描冷存储历史,操作者必须确认知悉旧对话恢复时可能需要显式重选模型。加载版本/结构能力自报告不是完整 Desktop/Core 字节核验,也不是跨 namespace 原子事务;CAS 前立即复查。
|
|
90
|
-
|
|
91
|
-
`cloga/dsh-windows-ops` 计划的 `tools/migrate-copilot-managed-route.ps1` 是插件发布后独立的**仅配置 v1 维护**:不自动写 Session/默认值、不读冷历史、不安装/重启 DSH、不验收完整 Desktop 基线。若有选择阻塞,须先另行授权、手工处理;计划路径不表示命令已发布/安装或真实迁移已经完成。
|
|
92
|
-
|
|
93
|
-
### 移除前审核
|
|
94
|
-
|
|
95
|
-
1. **先实际运行新版本。** 确认目标 `0.4.0-alpha.9` 中保留 canonical 缺失的插件已在活动 profile 加载,Host 与 Client 匹配。provider 集成界面不要求执行这项可选路由移除。使用已发布且校验通过的制品;计划版本和磁盘安装都不是已发布/已加载的证明。旧版本可能在启动、登录或认证刷新时重建被删 profile,不能先删除再期待旧进程保留缺失。
|
|
96
|
-
2. **验证发现结果。** 打开 Models 确认登录,等待按需自动 ensure 完成,检查目标模型是否在 `github-copilot-preview` 的接受列表及能力警告中。错误可点 **Retry**;有意强制更新时使用 **Manage → Refresh models**。元数据成功不等于真实调用成功;可选测试请求须明确批准,正常消耗供应方资源,结果单独报告。不要重复登录或关闭校验强行恢复模型。
|
|
97
|
-
3. **有意迁移选择。** 只为明确批准迁移的 Session 选择托管模型,再确认获准的未来默认值。Core `session.selectModel` 也会保存该默认值,不能假设未选择的空会话不受影响。只有账号明确公布且 SDK 支持时才保留同一模型 ID/思考强度;否则请用户选择,不猜测替代项。检查 preset、定时任务和暂停会话的 canonical 引用,逐项审核未来选择,不批量改写历史、回放、来源记录或 preset 文件。
|
|
98
|
-
4. **检查所有权与并发。** 若 base composition/其它配置层仍提供 canonical profile,存在 journal 冲突,或其它进程正在编辑 settings,停止并审核。不强删 marker,不覆盖继承配置,不修改 Core。旧 journal 的精确恢复流程仍需保留其安全检查。
|
|
99
|
-
|
|
100
|
-
### 发布后执行明确批准的 Ops 迁移
|
|
101
|
-
|
|
102
|
-
1. 经批准安装并实际加载已发布插件;调用 `migrationStatus()` 检查协议/版本、必要能力与完整性,未知证据阻止维护。记录当前 Session 选择及未来默认值;如有获准的选择阻塞,在仅配置 v1 之外手工处理后再次查询。取得冷历史范围确认;命令不写这些选择。若需要中断 Host,仍须另行批准并检查活动会话。
|
|
103
|
-
2. 仅将设置私密备份到用户批准、Git/共享文档之外的位置,不打印/上传,不读取或复制 OAuth 凭据。检查当前 user-native profile、namespace revision、有效 base 层及所有权 journal;有继承配置、journal 歧义或并发变更则停止。
|
|
104
|
-
3. 通过已审核的公开 settings 路径,按读取到的 revision 做 **compare-and-swap(CAS)**,只移除 user-native **`llm-pi-ai.providers.github-copilot`**。保留 `llm-pi-ai` 挂载/section、companion 设置、凭据、其它 provider 和用户字段。冲突或路径已不存在时不盲重试,不整份改写设置、不删 journal、不改 Core。
|
|
105
|
-
4. 回读持久化/有效设置及真实 provider registry,再检查 composer 与 `/model`。只有 canonical 注册确实消失、其它层也不提供时,才能报告只剩托管分组;隐藏卡片或写入成功本身不够。冷启动 `listModels()` 可直接确保共享发现,无需先打开 Settings。
|
|
106
|
-
5. 单独审核 hosted-search 非空 `providers` allowlist。经批准,Ops 可将审核过的旧 route 条目改为 `github-copilot-preview`,保留无关条目;不得隐式清空或扩大列表。插件代码不会代做迁移。
|
|
107
|
-
6. 确认凭据仍已配置、获准 Session/默认值符合审核、其它已选/历史会话及历史保持原样。公开 `session.selectModel` 同时保存未来默认值,未选择的空会话可能继承它。`route: not-configured` 仅表示可选 canonical 缺失,不证明发现/模型/搜索调用成功。
|
|
108
|
-
|
|
109
|
-
### 历史、搜索与回退
|
|
110
|
-
|
|
111
|
-
旧 `github-copilot-preview` ID 保持不变。canonical 历史不改写,也不会被自动别名映射;仍选旧路由的暂停会话恢复时须显式选择支持的托管模型。如果必须继续原路由,应暂缓移除或恢复其 profile,不能宣称旧路由仍无缝可用。
|
|
112
|
-
|
|
113
|
-
托管普通对话交给原生 adapter;`ctx.web` 托管搜索仍只支持通过账号元数据/probe/allowlist 检查的 Responses 模型,按捕获的发起 Session 有效 request-header/config 或显式 `GenerateOptions` 与独立 owner plan 处理,不用全局默认值。`Agent.options` 仅是激活 seed,不是已选模型证据;无可证明的请求上下文时传统搜索不可用,新选择尚未发起下一请求时不能拿旧 header 当当前 prompt 指引;冷启动先确保共享元数据。缺少 `agents.currentInitiator` 时传统搜索不可用,显式带标记请求仍受既有检查保护。首次发现中的 OAuth 通知可能让该次搜索在 probe/wire 前保守失败,之后用户/driver 可以重新请求,不自动重试。自定义 inline 只用于仍配置的旧 canonical 路由,删除旧路由不会把托管对话变成旧 inline 路径。
|
|
110
|
+
## 中文操作说明
|
|
114
111
|
|
|
115
|
-
|
|
112
|
+
新安装无需原生 provider;升级保留已有 canonical 配置,两组都是真实路由,
|
|
113
|
+
不是两个账号。迁移只在明确批准后移除审核过的
|
|
114
|
+
`llm-pi-ai.providers.github-copilot`;唯一凭据、`llm-pi-ai`、授权服务及其它配置保留。
|
|
115
|
+
不要退出登录、删除凭据或使用 `models: []` 来隐藏分组。
|
|
116
|
+
|
|
117
|
+
先验证发布版本已实际加载,再调用无参数 `githubCopilot.migrationStatus()`。
|
|
118
|
+
版本、能力或完整性未知就停止;它只覆盖 live Agent,不扫描冷历史,也不调用
|
|
119
|
+
凭据/发现/网络。最新 header 不等于正在推理,结构自报不等于完整字节证明。
|
|
120
|
+
拟议 Ops 命令仅做配置维护,本文不证明其已发布、已执行或迁移已完成。
|
|
121
|
+
|
|
122
|
+
单独批准 Session/未来默认值选择、真实测试请求、配置写入与停止/重启。
|
|
123
|
+
`session.selectModel` 同时修改未来默认值,未选择的空 Session 可能继承;
|
|
124
|
+
其它已选/历史 Session 不批量改写。恢复旧 canonical 会话时可能需显式选择支持的
|
|
125
|
+
托管模型,不能承诺透明续接。
|
|
126
|
+
|
|
127
|
+
检查 base 层和 journal,私密备份设置但不复制 OAuth。写入前重新查询,
|
|
128
|
+
按 revision 做窄路径 CAS;冲突不盲重试。回读持久化/有效配置、真实 registry、
|
|
129
|
+
composer 与 `/model`,才能确认单组。搜索 allowlist 修改另行审核,不隐式扩大。
|
|
130
|
+
回退仅恢复获准字段,不用整份备份覆盖后来改动;注册恢复仍不证明模型调用成功。
|
package/lib/index.js
CHANGED
|
@@ -1684,7 +1684,7 @@ const usageSchema = z$1.object({
|
|
|
1684
1684
|
totalTokens: count.optional(),
|
|
1685
1685
|
reasoningTokens: count.optional()
|
|
1686
1686
|
});
|
|
1687
|
-
function record$
|
|
1687
|
+
function record$8(value) {
|
|
1688
1688
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1689
1689
|
}
|
|
1690
1690
|
function sameRoute$1(left, right) {
|
|
@@ -1703,10 +1703,10 @@ function initialContextEvidence() {
|
|
|
1703
1703
|
}
|
|
1704
1704
|
/** Read only counts and routing leaves; never message content or opaque replay. */
|
|
1705
1705
|
function foldContextEvidence(state, event) {
|
|
1706
|
-
if (!record$
|
|
1706
|
+
if (!record$8(event) || typeof event.type !== "string" || !record$8(event.data)) return state;
|
|
1707
1707
|
if (event.type === "request/header" || event.type === "model/selection") {
|
|
1708
|
-
const raw = event.type === "request/header" ? record$
|
|
1709
|
-
if (!record$
|
|
1708
|
+
const raw = event.type === "request/header" ? record$8(event.data.header) ? event.data.header.config : void 0 : event.data;
|
|
1709
|
+
if (!record$8(raw)) return {
|
|
1710
1710
|
...state,
|
|
1711
1711
|
route: null,
|
|
1712
1712
|
sample: null,
|
|
@@ -1745,7 +1745,7 @@ function foldContextEvidence(state, event) {
|
|
|
1745
1745
|
if (!copilot(state.route)) return state;
|
|
1746
1746
|
if (event.type === "assistant/message" && event.data.source !== void 0) {
|
|
1747
1747
|
const source = event.data.source;
|
|
1748
|
-
const parsed = routeSchema.safeParse(record$
|
|
1748
|
+
const parsed = routeSchema.safeParse(record$8(source) ? {
|
|
1749
1749
|
provider: source.provider,
|
|
1750
1750
|
model: source.model
|
|
1751
1751
|
} : source);
|
|
@@ -1761,7 +1761,7 @@ function foldContextEvidence(state, event) {
|
|
|
1761
1761
|
const settledUsage = usage !== void 0;
|
|
1762
1762
|
let terminal;
|
|
1763
1763
|
for (const entry of stream) {
|
|
1764
|
-
if (!record$
|
|
1764
|
+
if (!record$8(entry) || entry.type !== "chunk" || !record$8(entry.chunk)) continue;
|
|
1765
1765
|
if (!settledUsage && entry.chunk.type === "usage") usage = entry.chunk.usage;
|
|
1766
1766
|
if (entry.chunk.type === "finish") terminal = entry.chunk.reason;
|
|
1767
1767
|
}
|
|
@@ -1775,7 +1775,7 @@ function foldContextEvidence(state, event) {
|
|
|
1775
1775
|
};
|
|
1776
1776
|
const value = parsed.data;
|
|
1777
1777
|
const zero = isZeroContextUsage(value);
|
|
1778
|
-
const successful = record$
|
|
1778
|
+
const successful = record$8(terminal) && (terminal.kind === "stop" || terminal.kind === "max-tokens" || terminal.kind === "tool-calls");
|
|
1779
1779
|
if (zero && !successful) {
|
|
1780
1780
|
const reason = state.sample !== null || state.reason === "none" ? "failed-zero" : state.reason;
|
|
1781
1781
|
return {
|
|
@@ -1817,7 +1817,7 @@ const contextEvidenceDefinition = {
|
|
|
1817
1817
|
function installContextEvidence(ctx) {
|
|
1818
1818
|
ctx.inject(["sessionProjections"], (scope) => {
|
|
1819
1819
|
const registry = scope.get("sessionProjections");
|
|
1820
|
-
if (!record$
|
|
1820
|
+
if (!record$8(registry) || typeof registry.register !== "function") {
|
|
1821
1821
|
scope.logger.warn("[github-copilot] COPILOT_CONTEXT_PROJECTION_UNAVAILABLE");
|
|
1822
1822
|
return;
|
|
1823
1823
|
}
|
|
@@ -1831,7 +1831,7 @@ function installContextEvidence(ctx) {
|
|
|
1831
1831
|
//#endregion
|
|
1832
1832
|
//#region package.json
|
|
1833
1833
|
var name$1 = "dsh-github-copilot";
|
|
1834
|
-
var version = "0.4.0-alpha.
|
|
1834
|
+
var version = "0.4.0-alpha.91";
|
|
1835
1835
|
//#endregion
|
|
1836
1836
|
//#region lib/types/probe.js
|
|
1837
1837
|
/**
|
|
@@ -2843,7 +2843,7 @@ function buildAnthropicWireBody(request, cfg, model) {
|
|
|
2843
2843
|
}
|
|
2844
2844
|
//#endregion
|
|
2845
2845
|
//#region lib/types/responses-reasoning-text.js
|
|
2846
|
-
function record$
|
|
2846
|
+
function record$7(value) {
|
|
2847
2847
|
return typeof value === "object" && value !== null;
|
|
2848
2848
|
}
|
|
2849
2849
|
function responseIndex(value) {
|
|
@@ -2901,13 +2901,13 @@ var ResponsesReasoningText = class {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
/** Only recognized public text fields are examined; no copying of the item. */
|
|
2903
2903
|
snapshot(item) {
|
|
2904
|
-
if (!record$
|
|
2904
|
+
if (!record$7(item) || item.type !== "reasoning") return "";
|
|
2905
2905
|
let delta = "";
|
|
2906
2906
|
for (const family of ["summary", "raw"]) {
|
|
2907
2907
|
const value = family === "summary" ? item.summary : item.content;
|
|
2908
2908
|
if (!Array.isArray(value)) continue;
|
|
2909
2909
|
for (const [index, part] of value.entries()) {
|
|
2910
|
-
if (!record$
|
|
2910
|
+
if (!record$7(part) || part.type !== (family === "summary" ? "summary_text" : "reasoning_text")) continue;
|
|
2911
2911
|
delta += this.update(family, index, part.text, true);
|
|
2912
2912
|
}
|
|
2913
2913
|
}
|
|
@@ -5716,16 +5716,16 @@ function requestBodyEvidence(body, protocol) {
|
|
|
5716
5716
|
//#endregion
|
|
5717
5717
|
//#region lib/types/request-body-timeout.js
|
|
5718
5718
|
const observedMessage = "Timed out reading request body. Try again, or use a smaller request size.";
|
|
5719
|
-
function record$
|
|
5719
|
+
function record$6(value) {
|
|
5720
5720
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5721
5721
|
}
|
|
5722
5722
|
/** Verified provider evidence, not guessed capabilities, token limits or network cause. */
|
|
5723
5723
|
async function requestBodyTimeoutDiagnostic(response, body, signal, dispatch) {
|
|
5724
5724
|
if (response.status !== 408 || signal?.aborted) return void 0;
|
|
5725
5725
|
const value = await readResponseErrorJson(response, signal);
|
|
5726
|
-
if (signal?.aborted || !record$
|
|
5726
|
+
if (signal?.aborted || !record$6(value)) return void 0;
|
|
5727
5727
|
const error = Object.hasOwn(value, "error") ? value.error : value;
|
|
5728
|
-
if (!record$
|
|
5728
|
+
if (!record$6(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;
|
|
5729
5729
|
const size = body === void 0 ? "Request body size unavailable." : `Request body: ${Buffer.byteLength(body, "utf8")} UTF-8 bytes (not context tokens).`;
|
|
5730
5730
|
const composition = formatRequestBodyEvidence(dispatch === void 0 ? { state: "unavailable" } : requestBodyEvidence(body, dispatch.protocol), dispatch?.responseHeadersMs);
|
|
5731
5731
|
return `${REQUEST_BODY_TIMEOUT_MARKER} ${size} ${composition} Native retry policy is unchanged. If retries exhaust, use these numbers to choose an explicit attachment/image-offload budget change or native compaction for compressible history; tool definitions and opaque replay may remain. Also check network/proxy health and GitHub service status. Composition alone does not establish a cause or supplier size limit. A larger client timeout does not change this server timeout. No history was trimmed or model switched.`;
|
|
@@ -6199,7 +6199,7 @@ var Budget = class {
|
|
|
6199
6199
|
if (this.consumed > ACCOUNT_MODEL_CATALOG_LIMITS.maxBytes) fail("CATALOG_TOO_LARGE", true);
|
|
6200
6200
|
}
|
|
6201
6201
|
};
|
|
6202
|
-
function record$
|
|
6202
|
+
function record$5(value, code) {
|
|
6203
6203
|
if (typeof value !== "object" || value === null || Array.isArray(value)) fail(code);
|
|
6204
6204
|
return value;
|
|
6205
6205
|
}
|
|
@@ -6218,13 +6218,13 @@ function text$1(value, maxLength, code, budget) {
|
|
|
6218
6218
|
budget.charge(encoder.encode(value).byteLength);
|
|
6219
6219
|
return value;
|
|
6220
6220
|
}
|
|
6221
|
-
function positive(value, code) {
|
|
6221
|
+
function positive$1(value, code) {
|
|
6222
6222
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail(code);
|
|
6223
6223
|
return value;
|
|
6224
6224
|
}
|
|
6225
6225
|
function optionalPositive(parent, key, code, budget) {
|
|
6226
6226
|
const descriptor = dataProperty(parent, key, budget);
|
|
6227
|
-
return descriptor === void 0 ? void 0 : positive(descriptor.value, code);
|
|
6227
|
+
return descriptor === void 0 ? void 0 : positive$1(descriptor.value, code);
|
|
6228
6228
|
}
|
|
6229
6229
|
function stringList(value, maxItems, maxLength, code, budget) {
|
|
6230
6230
|
if (!Array.isArray(value)) fail(code);
|
|
@@ -6252,11 +6252,11 @@ function normalizeModel(raw, id, options, budget) {
|
|
|
6252
6252
|
if (options.availableModelIds?.has(id) !== true) fail("MISSING_POLICY");
|
|
6253
6253
|
policySource = "account-available-id";
|
|
6254
6254
|
} else {
|
|
6255
|
-
if (text$1(field(record$
|
|
6255
|
+
if (text$1(field(record$5(rawPolicy, "INVALID_POLICY"), "state", budget), 64, "INVALID_POLICY", budget) !== "enabled") fail("POLICY_NOT_ENABLED");
|
|
6256
6256
|
policySource = "server-enabled";
|
|
6257
6257
|
}
|
|
6258
|
-
const capabilities = record$
|
|
6259
|
-
const supports = record$
|
|
6258
|
+
const capabilities = record$5(field(raw, "capabilities", budget), "INVALID_CAPABILITIES");
|
|
6259
|
+
const supports = record$5(field(capabilities, "supports", budget), "INVALID_SUPPORTS");
|
|
6260
6260
|
const streaming = field(supports, "streaming", budget);
|
|
6261
6261
|
if (streaming === false) fail("STREAMING_UNSUPPORTED");
|
|
6262
6262
|
if (streaming !== true) fail("INVALID_SUPPORTS");
|
|
@@ -6277,7 +6277,7 @@ function normalizeModel(raw, id, options, budget) {
|
|
|
6277
6277
|
if (selected === void 0) fail(unsupportedEndpointCount === 0 && endpoints.includes("ws:/responses") ? "WEBSOCKET_ONLY" : "UNSUPPORTED_ENDPOINTS");
|
|
6278
6278
|
const rawLimits = field(capabilities, "limits", budget);
|
|
6279
6279
|
if (rawLimits === void 0) fail("MISSING_LIMITS");
|
|
6280
|
-
const limits = record$
|
|
6280
|
+
const limits = record$5(rawLimits, "INVALID_LIMITS");
|
|
6281
6281
|
const maxContext = optionalPositive(limits, "max_context_window_tokens", "INVALID_LIMITS", budget);
|
|
6282
6282
|
const maxInputTokens = optionalPositive(limits, "max_prompt_tokens", "INVALID_LIMITS", budget);
|
|
6283
6283
|
if (maxContext === void 0 && maxInputTokens === void 0) fail("MISSING_CONTEXT_LIMIT");
|
|
@@ -6295,7 +6295,7 @@ function normalizeModel(raw, id, options, budget) {
|
|
|
6295
6295
|
if (vision === true) {
|
|
6296
6296
|
const rawVisionLimits = field(limits, "vision", budget);
|
|
6297
6297
|
if (rawVisionLimits !== void 0) {
|
|
6298
|
-
const rawMediaTypes = field(record$
|
|
6298
|
+
const rawMediaTypes = field(record$5(rawVisionLimits, "INVALID_VISION_LIMITS"), "supported_media_types", budget);
|
|
6299
6299
|
if (rawMediaTypes !== void 0) {
|
|
6300
6300
|
const mediaTypes = stringList(rawMediaTypes, ACCOUNT_MODEL_CATALOG_LIMITS.maxMediaTypes, 128, "INVALID_VISION_LIMITS", budget);
|
|
6301
6301
|
const mime = /^[a-z0-9][a-z0-9!#$%&'*+.^_`|~-]*\/[a-z0-9][a-z0-9!#$%&'*+.^_`|~-]*$/iu;
|
|
@@ -6357,7 +6357,7 @@ function normalizeAccountModelCatalog(raw, options = {}) {
|
|
|
6357
6357
|
fail("INVALID_JSON", true);
|
|
6358
6358
|
}
|
|
6359
6359
|
}
|
|
6360
|
-
const data = field(record$
|
|
6360
|
+
const data = field(record$5(raw, "INVALID_CATALOG"), "data", budget);
|
|
6361
6361
|
if (!Array.isArray(data)) fail("INVALID_CATALOG");
|
|
6362
6362
|
const count = field(data, "length", budget);
|
|
6363
6363
|
if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0) fail("INVALID_CATALOG");
|
|
@@ -6380,7 +6380,7 @@ function normalizeAccountModelCatalog(raw, options = {}) {
|
|
|
6380
6380
|
for (let index = 0; index < count; index++) {
|
|
6381
6381
|
let id;
|
|
6382
6382
|
try {
|
|
6383
|
-
const candidate = record$
|
|
6383
|
+
const candidate = record$5(field(data, String(index), budget), "INVALID_MODEL");
|
|
6384
6384
|
const candidateId = text$1(field(candidate, "id", budget), ACCOUNT_MODEL_CATALOG_LIMITS.maxIdLength, "INVALID_ID", budget);
|
|
6385
6385
|
if (!identifier.test(candidateId)) fail("INVALID_ID");
|
|
6386
6386
|
id = candidateId;
|
|
@@ -6812,7 +6812,7 @@ function createAccountModelSource(dependencies) {
|
|
|
6812
6812
|
}
|
|
6813
6813
|
//#endregion
|
|
6814
6814
|
//#region lib/types/agent-compaction.js
|
|
6815
|
-
function record$
|
|
6815
|
+
function record$4(value) {
|
|
6816
6816
|
return typeof value === "object" && value !== null;
|
|
6817
6817
|
}
|
|
6818
6818
|
/** Resolve the owning preset's service without reaching into Core's service registry. */
|
|
@@ -6820,7 +6820,7 @@ function agentCompaction(agent) {
|
|
|
6820
6820
|
if (typeof agent.ctx?.get !== "function") throw new LlmError("COPILOT_COMPACTION_AGENT_CONTEXT_UNAVAILABLE", "INVALID_REQUEST");
|
|
6821
6821
|
const presets = agent.ctx.get("agentPresets");
|
|
6822
6822
|
if (presets !== void 0) {
|
|
6823
|
-
if (!record$
|
|
6823
|
+
if (!record$4(presets) || typeof presets.composedPreset !== "function" || typeof presets.serviceFor !== "function") throw new LlmError("COPILOT_COMPACTION_PRESET_LOOKUP_UNAVAILABLE", "INVALID_REQUEST");
|
|
6824
6824
|
const preset = presets.composedPreset(agent.ctx);
|
|
6825
6825
|
if (preset !== void 0) {
|
|
6826
6826
|
if (typeof preset !== "string" || preset.trim().length === 0) throw new LlmError("COPILOT_COMPACTION_PRESET_LOOKUP_UNAVAILABLE", "INVALID_REQUEST");
|
|
@@ -6942,6 +6942,92 @@ function installCopilotCompactionPressure(ctx, callbacks) {
|
|
|
6942
6942
|
}, { prepend: true });
|
|
6943
6943
|
}
|
|
6944
6944
|
//#endregion
|
|
6945
|
+
//#region lib/types/pre-step-pressure.js
|
|
6946
|
+
function record$3(value) {
|
|
6947
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6948
|
+
}
|
|
6949
|
+
function positive(value) {
|
|
6950
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
6951
|
+
}
|
|
6952
|
+
function isEngine(value) {
|
|
6953
|
+
return record$3(value) && record$3(value.config) && typeof value.compactIfNeeded === "function";
|
|
6954
|
+
}
|
|
6955
|
+
/**
|
|
6956
|
+
* Prevent a continuing, unchanged route's known pressure from becoming an
|
|
6957
|
+
* unsampled model attempt. Final converted-request admission stays independent.
|
|
6958
|
+
*/
|
|
6959
|
+
function installCopilotPreStepPressure(ctx, callbacks) {
|
|
6960
|
+
let warned = false;
|
|
6961
|
+
const unavailable = () => {
|
|
6962
|
+
if (warned) return;
|
|
6963
|
+
warned = true;
|
|
6964
|
+
ctx.logger.warn("COPILOT_PRE_STEP_PRESSURE_UNAVAILABLE: pre-step evidence is unavailable; retaining final request admission.");
|
|
6965
|
+
};
|
|
6966
|
+
return ctx.on("agent/pre-step", async ({ agent, step, signal }, next) => {
|
|
6967
|
+
const decision = await next();
|
|
6968
|
+
if (decision.kind !== "enter" || signal.aborted || step <= 1 || decision.messages.some((message) => message.source?.kind === "model-selection")) return decision;
|
|
6969
|
+
let engine;
|
|
6970
|
+
try {
|
|
6971
|
+
const header = agent.session.requestHeader();
|
|
6972
|
+
if (header?.config.provider !== "github-copilot-preview" || !isPluginPreviewProvider(ctx, header.config.provider)) return decision;
|
|
6973
|
+
const projections = ctx.get("sessionProjections");
|
|
6974
|
+
if (!record$3(projections) || typeof projections.stateOf !== "function") {
|
|
6975
|
+
unavailable();
|
|
6976
|
+
return decision;
|
|
6977
|
+
}
|
|
6978
|
+
const selection = projections.stateOf(agent.session, "modelSelection");
|
|
6979
|
+
if (!record$3(selection) || !Object.hasOwn(selection, "pending")) {
|
|
6980
|
+
unavailable();
|
|
6981
|
+
return decision;
|
|
6982
|
+
}
|
|
6983
|
+
if (selection.pending !== null) return decision;
|
|
6984
|
+
const budget = callbacks.resolve({
|
|
6985
|
+
...header.config,
|
|
6986
|
+
messages: [],
|
|
6987
|
+
sessionId: agent.session.id
|
|
6988
|
+
});
|
|
6989
|
+
if (budget === void 0 || !positive(budget.inputBudgetTokens)) return decision;
|
|
6990
|
+
const candidate = agentCompaction(agent);
|
|
6991
|
+
if (!isEngine(candidate)) {
|
|
6992
|
+
unavailable();
|
|
6993
|
+
return decision;
|
|
6994
|
+
}
|
|
6995
|
+
const config = candidate.config;
|
|
6996
|
+
if (config.auto === false) return decision;
|
|
6997
|
+
if (config.auto !== true) {
|
|
6998
|
+
unavailable();
|
|
6999
|
+
return decision;
|
|
7000
|
+
}
|
|
7001
|
+
const policy = Array.isArray(config.modelPolicies) ? config.modelPolicies.find((value) => record$3(value) && value.provider === header.config.provider && value.model === header.config.model) : void 0;
|
|
7002
|
+
const retries = record$3(policy) ? policy.maxOverflowRetries ?? config.maxOverflowRetries : config.maxOverflowRetries;
|
|
7003
|
+
if (retries === 0) return decision;
|
|
7004
|
+
if (!positive(retries)) {
|
|
7005
|
+
unavailable();
|
|
7006
|
+
return decision;
|
|
7007
|
+
}
|
|
7008
|
+
const meter = ctx.get("tokenMeter");
|
|
7009
|
+
if (!record$3(meter) || typeof meter.measure !== "function") {
|
|
7010
|
+
unavailable();
|
|
7011
|
+
return decision;
|
|
7012
|
+
}
|
|
7013
|
+
const measured = meter.measure(agent.session);
|
|
7014
|
+
if (!record$3(measured) || typeof measured.totalTokens !== "number" || !Number.isSafeInteger(measured.totalTokens) || measured.totalTokens < 0) {
|
|
7015
|
+
unavailable();
|
|
7016
|
+
return decision;
|
|
7017
|
+
}
|
|
7018
|
+
if (measured.totalTokens <= budget.inputBudgetTokens) return decision;
|
|
7019
|
+
engine = candidate;
|
|
7020
|
+
} catch {
|
|
7021
|
+
unavailable();
|
|
7022
|
+
return decision;
|
|
7023
|
+
}
|
|
7024
|
+
signal.throwIfAborted();
|
|
7025
|
+
await engine.compactIfNeeded(agent, "context-overflow", signal);
|
|
7026
|
+
signal.throwIfAborted();
|
|
7027
|
+
return decision;
|
|
7028
|
+
}, { prepend: true });
|
|
7029
|
+
}
|
|
7030
|
+
//#endregion
|
|
6945
7031
|
//#region lib/types/auto-assessment-evidence.js
|
|
6946
7032
|
const milliseconds = z$1.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
6947
7033
|
const SemanticAssessmentEvidenceSchema = z$1.object({
|
|
@@ -8979,7 +9065,7 @@ function apply$1(ctx, config = {}) {
|
|
|
8979
9065
|
publishedDirectory = "";
|
|
8980
9066
|
registration.replace([GITHUB_COPILOT_PREVIEW_PROVIDER_ID]);
|
|
8981
9067
|
});
|
|
8982
|
-
|
|
9068
|
+
const pressureCallbacks = { resolve(request) {
|
|
8983
9069
|
const snapshot = source.readSnapshot();
|
|
8984
9070
|
if (snapshot === void 0 || proofFor(snapshot) === void 0) return void 0;
|
|
8985
9071
|
if (excludedModels().has(request.model)) return void 0;
|
|
@@ -8987,7 +9073,9 @@ function apply$1(ctx, config = {}) {
|
|
|
8987
9073
|
if (descriptor === void 0) return void 0;
|
|
8988
9074
|
const result = calculateRequestBudget(descriptor, request.maxTokens, resolveRequestBudgetPolicy(budgetSettings()));
|
|
8989
9075
|
return result.ok ? { inputBudgetTokens: result.budget.pressureInputLimit } : void 0;
|
|
8990
|
-
} }
|
|
9076
|
+
} };
|
|
9077
|
+
installCopilotPreStepPressure(ctx, pressureCallbacks);
|
|
9078
|
+
installCopilotCompactionPressure(ctx, pressureCallbacks);
|
|
8991
9079
|
notify = () => {
|
|
8992
9080
|
const view = getView();
|
|
8993
9081
|
const directory = JSON.stringify({
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { CopilotCompactionPressureCallbacks } from './compaction-pressure.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Prevent a continuing, unchanged route's known pressure from becoming an
|
|
5
|
+
* unsampled model attempt. Final converted-request admission stays independent.
|
|
6
|
+
*/
|
|
7
|
+
export declare function installCopilotPreStepPressure(ctx: Context, callbacks: CopilotCompactionPressureCallbacks): () => void;
|
|
8
|
+
//# sourceMappingURL=pre-step-pressure.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.
|
|
4
|
+
"version": "0.4.0-alpha.91",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|