@dsh-cc/model-aliases 0.8.1-rc.1 → 0.8.2-rc.1
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/README.i18n.yaml +2 -2
- package/README.md +16 -4
- package/README.zh.md +55 -52
- package/lib/agentOptions.d.ts +8 -0
- package/lib/agentOptions.d.ts.map +1 -1
- package/lib/agentOptions.js +16 -0
- package/lib/agentOptions.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/resolver.d.ts +7 -0
- package/lib/resolver.d.ts.map +1 -1
- package/lib/resolver.js +34 -22
- package/lib/resolver.js.map +1 -1
- package/lib/schema.d.ts +28 -20
- package/lib/schema.d.ts.map +1 -1
- package/lib/schema.js +4 -1
- package/lib/schema.js.map +1 -1
- package/lib/service.d.ts +1 -1
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +22 -0
- package/lib/service.js.map +1 -1
- package/lib/systemone-guard.d.ts +73 -0
- package/lib/systemone-guard.d.ts.map +1 -0
- package/lib/systemone-guard.js +109 -0
- package/lib/systemone-guard.js.map +1 -0
- package/lib/types.d.ts +13 -0
- package/lib/types.d.ts.map +1 -1
- package/package.json +6 -7
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm check:readme --write
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 9ee73d46945ba766b28e1af5370fe65cae2f4b3d
|
|
6
|
+
README.zh.md: 0d10ba236cb55903e2206e38322f31811e5709b1
|
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ resolves to "inherit the parent route" (the same no-override behavior as before)
|
|
|
45
45
|
|
|
46
46
|
## How the cc-shell bundle wires it
|
|
47
47
|
|
|
48
|
-
- `Config.modelAliases` provides **deployment defaults** (alias name → model id
|
|
48
|
+
- The `@dsh-cc/model-aliases` row's own `Config.modelAliases` provides **deployment defaults** (alias name → model id
|
|
49
49
|
or `{provider, model}`).
|
|
50
50
|
- The `model-aliases` **settings namespace** registration now lives in the `ccModelRoutes`
|
|
51
51
|
service, layered exactly like every other settings section (user/project/local/flags).
|
|
@@ -88,7 +88,7 @@ lowercase at merge and at lookup).
|
|
|
88
88
|
| configured alias (string form) | `{ model: <target> }` |
|
|
89
89
|
| configured alias (object form) | `{ provider?: <p>, model: <m>, reasoningEffort?: <effort> }` |
|
|
90
90
|
| builtin alias unconfigured (`fable`/`opus`/`sonnet`/`haiku`) | no override — child inherits the parent route ("current model") |
|
|
91
|
-
| dsh-cc lane unconfigured (`sketch`/`draft`/`blueprint`/`masterplan`) | follows the CC peer (`haiku`/`sonnet`/`opus`/`fable`); inherit if that peer is also unconfigured |
|
|
91
|
+
| dsh-cc lane unconfigured (`sketch`/`draft`/`blueprint`/`masterplan`/`gauge`) | follows the CC peer (`haiku`/`sonnet`/`opus`/`fable`/`haiku`); inherit if that peer is also unconfigured |
|
|
92
92
|
| `architect` unconfigured | no override — inherit the parent (main-thread) route |
|
|
93
93
|
| anything else | passed through **verbatim** as a literal model id; a bare-lowercase-word form (e.g. `turbo`) logs a warning that it looks like an unconfigured alias |
|
|
94
94
|
|
|
@@ -203,8 +203,8 @@ cc-shell (and the routes service), so in CC mode the fix is always active.
|
|
|
203
203
|
`getAliases` is a thunk evaluated **per invocation** (liveness). Optional
|
|
204
204
|
`warn` replaces the default `console.warn` used for the unconfigured-custom-alias
|
|
205
205
|
warning.
|
|
206
|
-
- `BUILTIN_ALIASES` — CC family (`fable`/`opus`/`sonnet`/`haiku`) plus dsh-cc lanes (`sketch`/`draft`/`blueprint`/`masterplan`/`architect`).
|
|
207
|
-
- `LANE_PEERS` — unconfigured-lane → CC-family map (`sketch→haiku`, `draft→sonnet`, `blueprint→opus`, `masterplan→fable`; `architect` has no peer).
|
|
206
|
+
- `BUILTIN_ALIASES` — CC family (`fable`/`opus`/`sonnet`/`haiku`) plus dsh-cc lanes (`sketch`/`draft`/`blueprint`/`masterplan`/`architect`/`gauge`).
|
|
207
|
+
- `LANE_PEERS` — unconfigured-lane → CC-family map (`sketch→haiku`, `draft→sonnet`, `blueprint→opus`, `masterplan→fable`, `gauge→haiku`; `architect` has no peer).
|
|
208
208
|
- `toAgentOptions(route)` — drop `undefined` fields from a resolved route so
|
|
209
209
|
per-field inheritance survives (never set a field to `undefined` on the child
|
|
210
210
|
request); `undefined` in → `undefined` out, and an all-`undefined` route
|
|
@@ -234,6 +234,18 @@ except `architect` follows its CC peer, so a deployment that already maps
|
|
|
234
234
|
| `blueprint` | Deep reasoning | `opus` |
|
|
235
235
|
| `masterplan` | Maximum reasoning | `fable` |
|
|
236
236
|
| `architect` | Planning and orchestration | inherit (main thread) |
|
|
237
|
+
| `gauge` | Typed-decision cheap lane (System One models; not generative) | `haiku` |
|
|
238
|
+
|
|
239
|
+
`gauge` is a typed-decision lane for System One models (e.g.
|
|
240
|
+
`llmbox_systemone/laya`); **never use it as agent frontmatter `model:`** — it
|
|
241
|
+
is selected by decision consumers, not generative callers. This is enforced:
|
|
242
|
+
a System One target (`protocol: "systemone"` or an `llmbox_systemone/` model
|
|
243
|
+
id) keeps `protocol: 'systemone'` on its resolved route, the chat projections
|
|
244
|
+
(`toAgentOptions` / `toOneShotRoute`) refuse such a route, and the routes
|
|
245
|
+
service's `llm/stream` guard rejects any chat request for a System One model
|
|
246
|
+
with `SystemOneChatModelError` (code `SYSTEMONE_NOT_CHAT_MODEL`). The
|
|
247
|
+
permission-rules classifier and probe reach System One over their own
|
|
248
|
+
protocol client and are unaffected.
|
|
237
249
|
|
|
238
250
|
A configured string-form target that names another alias is followed **one
|
|
239
251
|
hop** (`sketch: haiku` shares haiku's object route, including
|
package/README.zh.md
CHANGED
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
面向 DeepSeek Harness 的 Claude Code 兼容 model alias 解析。把 CC frontmatter 的 model alias(`model: opus`、`model: sonnet`)映射为 dsh 的 `{provider, model, reasoningEffort?}` 路由。本 package
|
|
5
|
+
面向 DeepSeek Harness 的 Claude Code 兼容 model alias 解析。把 CC frontmatter 的 model alias(`model: opus`、`model: sonnet`)映射为 dsh 的 `{provider, model, reasoningEffort?}` 路由。本 package 现在以两种形态提供:
|
|
6
6
|
|
|
7
|
-
- **`ccModelRoutes`
|
|
8
|
-
- **纯 helper
|
|
7
|
+
- **`ccModelRoutes` 宿主服务**(cordis 插件入口),拥有 `model-aliases` settings 命名空间的注册,并暴露派发时的解析器;
|
|
8
|
+
- **纯 helper**(`mergeAliasMaps` / `createModelResolver`),在不挂载服务的情况下内嵌同样的解析语义。
|
|
9
9
|
|
|
10
10
|
## 为什么
|
|
11
11
|
|
|
12
|
-
Claude Code 的 agent/CLAUDE.md frontmatter 用 alias 命名模型。没有 alias
|
|
12
|
+
Claude Code 的 agent/CLAUDE.md frontmatter 用 alias 命名模型。没有 alias 层时,`model: opus` 会被原样当作 provider model id 透传,因此不认识该 id 的 adapter(如 `llm-pi-ai`)抛 `UNKNOWN_MODEL`;而 `model: inherit`——CC 中意为「用父模型」的合法哨兵——也会被当作字面 id 交给 `prepareCall` 然后报错。
|
|
13
13
|
|
|
14
|
-
本 package
|
|
14
|
+
本 package 补上这层:alias 解析为 `{provider, model, reasoningEffort?}` 路由,不可解析的情形回退为*继承父路由*(不 override),而 `deepseek-chat` 之类的字面 id 原样透传不受影响。
|
|
15
15
|
|
|
16
16
|
## `ccModelRoutes` 服务
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
插件入口(`name: 'cc-model-routes'`、`apply`)即 CC preset 通过 `cc-model-routes` 行挂载的东西。它:
|
|
19
19
|
|
|
20
|
-
- 注册 `model-aliases` **settings 命名空间**——但**仅当**存在 settings provider(`ctx.get('settings')`)
|
|
21
|
-
- 以**写时 `validate`**
|
|
22
|
-
- 并把派发时解析器以 **`ccModelRoutes`**
|
|
20
|
+
- 注册 `model-aliases` **settings 命名空间**——但**仅当**存在 settings provider(`ctx.get('settings')`)时,因此无 settings 的宿主降级为 config 默认 + builtin fallback(该命名空间注册是此名的唯一属主;重复注册 harness 会 throw,见 `dsh-settings`);
|
|
21
|
+
- 以**写时 `validate`** 注册该命名空间,拒绝半写的 `{provider, model}` 路由(dict schema 本身无法表达的非空跨字段校验);
|
|
22
|
+
- 并把派发时解析器以 **`ccModelRoutes`** 值(`ctx.provide`)提供,其 `resolve(model)` 每次调用**现读** settings scope——settings 写回即在下次派发生效,无需重新注册。
|
|
23
23
|
|
|
24
|
-
消费者在每次派发时**惰性** `ctx.get('ccModelRoutes')
|
|
24
|
+
消费者在每次派发时**惰性** `ctx.get('ccModelRoutes')`。惰性意味着挂载顺序无关:provider fiber 激活之前,`ctx.get` 返回 `undefined`,解析为「继承父路由」(与之前的 no-override 行为相同)。
|
|
25
25
|
|
|
26
|
-
## How the cc-shell bundle wires it
|
|
26
|
+
## How the cc-shell bundle wires it(如何接线)
|
|
27
27
|
|
|
28
|
-
- `Config.modelAliases`
|
|
29
|
-
- `model-aliases` **settings 命名空间**的注册现在住在 `ccModelRoutes`
|
|
30
|
-
- cc-shell 的 `AgentProvider` 通过**trampoline** 获得 `resolveModel
|
|
31
|
-
- Task
|
|
28
|
+
- `@dsh-cc/model-aliases` 行自身的 `Config.modelAliases` 提供**部署默认**(alias 名 → model id 或 `{provider, model}`)。
|
|
29
|
+
- `model-aliases` **settings 命名空间**的注册现在住在 `ccModelRoutes` 服务里,与其它 settings section 一样分层(user/project/local/flags)。
|
|
30
|
+
- cc-shell 的 `AgentProvider` 通过**trampoline** 获得 `resolveModel`:`(model) => ctx.get('ccModelRoutes')?.resolve(model)`——**每次派发惰性查询**、现读(apply 时不快照),服务未挂载时降级为继承(`undefined` 解析 = 继承父路由,与旧 no-resolver fallback 字节兼容)。cc-shell 自己不再注册该命名空间。
|
|
31
|
+
- Task 工具(`@dsh-cc/subagent-task`)是另一消费方:它在派发时以同一个 `ccModelRoutes` 解析器解析 subagent 定义 frontmatter 的 `model`。
|
|
32
32
|
|
|
33
33
|
## 配置
|
|
34
34
|
|
|
@@ -49,22 +49,22 @@ modelAliases:
|
|
|
49
49
|
|
|
50
50
|
## 解析语义
|
|
51
51
|
|
|
52
|
-
alias
|
|
52
|
+
alias 的查找顺序:**settings overlay → config 默认 → builtin fallback**。alias key 匹配**大小写不敏感**(merge 与 lookup 时 key 折叠为小写)。
|
|
53
53
|
|
|
54
54
|
| `model` frontmatter | 结果 |
|
|
55
55
|
|---|---|
|
|
56
56
|
| `undefined` / 空 | 无 override——child 继承父路由 |
|
|
57
|
-
| `inherit
|
|
58
|
-
| 已配置 alias
|
|
59
|
-
| 已配置 alias
|
|
60
|
-
| 未配置的 builtin alias(`fable`/`opus`/`sonnet`/`haiku`) | 无 override——child
|
|
61
|
-
| 未配置的 dsh-cc lane(`sketch`/`draft`/`blueprint`/`masterplan`) | 跟随 CC
|
|
62
|
-
| 未配置的 `architect` | 无 override
|
|
63
|
-
| 其它 | **原样**作为字面 model id
|
|
57
|
+
| `inherit`(任意大小写) | 无 override——child 继承父路由(**修复旧的透传 bug**) |
|
|
58
|
+
| 已配置 alias(字符串形式) | `{ model: <target> }` |
|
|
59
|
+
| 已配置 alias(对象形式) | `{ provider?: <p>, model: <m>, reasoningEffort?: <effort> }` |
|
|
60
|
+
| 未配置的 builtin alias(`fable`/`opus`/`sonnet`/`haiku`) | 无 override——child 继承父路由(「当前模型」) |
|
|
61
|
+
| 未配置的 dsh-cc lane(`sketch`/`draft`/`blueprint`/`masterplan`/`gauge`) | 跟随 CC 对标名(`haiku`/`sonnet`/`opus`/`fable`/`haiku`);对标也未配置则 inherit |
|
|
62
|
+
| 未配置的 `architect` | 无 override——继承父(主线程)路由 |
|
|
63
|
+
| 其它 | **原样**作为字面 model id 透传;裸小写单词形式(如 `turbo`)记录一条「看起来像未配置 alias」的告警 |
|
|
64
64
|
|
|
65
65
|
### 对象形式 alias 的 `reasoningEffort`
|
|
66
66
|
|
|
67
|
-
对象形式 alias 可声明可选的 `reasoningEffort
|
|
67
|
+
对象形式 alias 可声明可选的 `reasoningEffort`:一个不透明的非空字符串,其合法拼写属于**目标模型的适配器**(`max`、`xhigh`、`high`、…——此处不对任何适配器目录做校验)。存在时,spawn 侧(Task 工具与 plugin-loader 的 `AgentProvider`)把它 stamp 到 child 的 options 上,routes 服务的宿主 `agent/request` listener 会把它应用到该 child 的**每一个**请求上,覆盖任何从 fork 父 header 恢复的 effort。字符串形式 alias 无法携带 effort;`inherit` / 未配置 builtin 不 stamp 任何东西。目标模型不支持的 effort 会让请求以 `UNSUPPORTED_REASONING_EFFORT` 失败——有意 fail-loud。
|
|
68
68
|
|
|
69
69
|
```jsonc
|
|
70
70
|
// settings 命名空间 "model-aliases"
|
|
@@ -74,56 +74,56 @@ alias 的查找顺序:**settings overlay → config 默认 → builtin fallback*
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
把 opus 的目标换成 effort
|
|
77
|
+
把 opus 的目标换成 effort 词表不同的模型,只需改这一条 settings(`"reasoningEffort": "xhigh"`);agent markdown 无需改动。
|
|
78
78
|
|
|
79
79
|
### `model$level` 后缀语法
|
|
80
80
|
|
|
81
|
-
模型引用——frontmatter 的 `model:`、alias target 的 `model` id、或 auto-mode classifier 的 `route`——可以携带 `` `$<level>` ``
|
|
81
|
+
模型引用——frontmatter 的 `model:`、alias target 的 `model` id、或 auto-mode classifier 的 `route`——可以携带 `` `$<level>` `` 后缀(`opus$high`、`glm-5.3$xhigh`)。后缀在 id 离开解析器之前被剥离(定价、断路器、pin 都以裸 model id 为键);level 以 `reasoningEffort` 搭载在解析出的路由上,并**覆盖** alias target 声明的 `reasoningEffort`。未知 level 拼写既不剥离也不丢弃:原样携带到 harness 边界,由其以 `UNSUPPORTED_REASONING_EFFORT` 报错。畸形后缀(结尾 `$`、空或非法字符集的 level、provider 段中的 `$`)让引用原样透传——不含 `$` 的既有 id 解析字节级不变。
|
|
82
82
|
|
|
83
83
|
### Effort 优先级
|
|
84
84
|
|
|
85
85
|
| 层级 | 来源 | 应用点 |
|
|
86
86
|
|---|---|---|
|
|
87
|
-
| 1 | 显式 `` `$level` `` 后缀 > alias target 的 `reasoningEffort` |
|
|
88
|
-
| 2 | agent frontmatter `effort
|
|
89
|
-
| 3 | `/effort`
|
|
87
|
+
| 1 | 显式 `` `$level` `` 后缀 > alias target 的 `reasoningEffort` | 解析器内部(二者折叠为 `ResolvedRoute.reasoningEffort`) |
|
|
88
|
+
| 2 | agent frontmatter `effort`(`def.effort`) | 派发时——`resolveSpawnEffort`(Task 工具 + plugin-loader) |
|
|
89
|
+
| 3 | `/effort` 会话选择(主 agent) | TUI/会话机制;alias 印章的 effort 刻意压过 fork 父头部恢复的 effort(alias 契约) |
|
|
90
90
|
| 4 | catalog/harness 路由默认 | llm adapter |
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
高层级从不改写低层级;resume-pin 门保持比较完整解析元组,未改动。
|
|
93
93
|
|
|
94
94
|
### 空删除
|
|
95
95
|
|
|
96
|
-
只有 **settings** 层可把条目置为 `null
|
|
96
|
+
只有 **settings** 层可把条目置为 `null`;这会**整条删除同名 config-default 条目**(entry-shallow)。删除 *builtin* alias 仍落到 builtin fallback——`null` 无法让 `sonnet` 变成错误,因为 builtin fallback 是**继承父路由**。config 层永不允许 `null`(被 config schema 拒绝)。
|
|
97
97
|
|
|
98
98
|
### Merge 规则
|
|
99
99
|
|
|
100
|
-
- **config vs settings 是 entry-shallow
|
|
101
|
-
- **settings 5 级 cascade 内是递归深 merge
|
|
100
|
+
- **config vs settings 是 entry-shallow**:settings 条目整体替换 config 条目,绝不 field-merge `{provider, model}` 对象——因此 `config { provider: A, model: X }` + `settings { model: Y }` 得到 `{ model: Y }`,而不会是没有任何单层声明的混合 `{ provider: A, model: Y }`。
|
|
101
|
+
- **settings 5 级 cascade 内是递归深 merge**(既有 cascade 行为)。因此对象形式 alias 跨 settings 层必须**整写或完全不写**,否则 cascade 会像上面描述的那样 field-blend `{provider, model}`——这是本 package 不改变的 cascade 层行为。优先用字符串形式 alias,或在提及该 alias 的每一层重复完整路由。
|
|
102
102
|
|
|
103
103
|
### Builtin fallback
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
**零配置**的全新安装也能工作:`model: sonnet` / `model: opus` / `model: draft` 的 agent 解析为*继承父的当前模型*(lane 未配置时跟随已配置的 CC 对标)而非报错。builtin 名(CC 家族 + dsh-cc lane)享受该 fallback;未配置的自定义 alias(`turbo`、`gpt`、…)**没有** fallback,原样透传(带上面的告警)。
|
|
106
106
|
|
|
107
107
|
## `inherit` 修复说明
|
|
108
108
|
|
|
109
|
-
本 package
|
|
109
|
+
本 package 之前,`model: inherit` 会一路原样当作字面 model id 传给 `prepareCall` 然后失败。在 CC 模式下,派发时解析器(来自 `ccModelRoutes` 服务,经 cc-shell trampoline 与 Task 工具消费)把 `inherit` 映射为「无 override」,child 因此继承父路由,符合 CC 语义。未挂载任何解析器时(`@dsh-cc/plugin-loader` 中不设置 `resolveModel` 的非 cc 消费者),行为与之前字节一致——包括旧的 `inherit` 透传——因为无解析器 fallback 被原样保留。CC preset 无条件挂载 cc-shell(以及 routes 服务),因此 CC 模式下该修复始终生效。
|
|
110
110
|
|
|
111
111
|
## API
|
|
112
112
|
|
|
113
|
-
- `apply(ctx, config?)` / `name` — **cordis
|
|
114
|
-
- `ModelRoutes` — `ctx.get('ccModelRoutes')`
|
|
115
|
-
- `overlayStampedEffort(resolved, stamped)` / `stampedEffortOf(options)` — 服务 `agent/request` listener 使用的宿主侧 effort overlay
|
|
116
|
-
- `mergeAliasMaps(config, settings)` — 带 `null` 删除与大小写不敏感 key 折叠的 entry-shallow merge
|
|
117
|
-
- `createModelResolver(getAliases, { warn })` — 构建 `resolveModel` 闭包。`getAliases` 是**每次调用**求值的 thunk(liveness)。可选 `warn` 替换默认的 `console.warn
|
|
118
|
-
- `BUILTIN_ALIASES` — CC
|
|
119
|
-
- `LANE_PEERS` — 未配置 lane → CC
|
|
120
|
-
- `toAgentOptions(route)` — 丢弃 resolved route 中的 `undefined`
|
|
121
|
-
- `toOneShotRoute(route, parent?)` — 把 resolved alias 填成完整的 `{provider, model}`
|
|
122
|
-
- `ConfigAliasesSchema` / `SettingsAliasesSchema
|
|
113
|
+
- `apply(ctx, config?)` / `name` — **cordis 插件入口**(插件 id `cc-model-routes`,另以 `applyRoutes` / `routesPluginName` 再导出)。挂载服务;config 形状为 `{ modelAliases?: Record<string, AliasTarget> }`(部署默认)。
|
|
114
|
+
- `ModelRoutes` — `ctx.get('ccModelRoutes')` 的值类型(`resolve(model): { provider?, model?, reasoningEffort? } | undefined`)。
|
|
115
|
+
- `overlayStampedEffort(resolved, stamped)` / `stampedEffortOf(options)` — 服务 `agent/request` listener 使用的宿主侧 effort overlay;为测试与宿主内嵌而导出。
|
|
116
|
+
- `mergeAliasMaps(config, settings)` — 带 `null` 删除与大小写不敏感 key 折叠的 entry-shallow merge;返回只含已配置 alias 的有效 `ReadonlyMap`。
|
|
117
|
+
- `createModelResolver(getAliases, { warn })` — 构建 `resolveModel` 闭包。`getAliases` 是**每次调用**求值的 thunk(liveness)。可选 `warn` 替换默认的 `console.warn`(用于未配置自定义 alias 告警)。
|
|
118
|
+
- `BUILTIN_ALIASES` — CC 家族(`fable`/`opus`/`sonnet`/`haiku`)加上 dsh-cc lane(`sketch`/`draft`/`blueprint`/`masterplan`/`architect`/`gauge`)。
|
|
119
|
+
- `LANE_PEERS` — 未配置 lane → CC 家族映射(`sketch→haiku`、`draft→sonnet`、`blueprint→opus`、`masterplan→fable`、`gauge→haiku`;`architect` 无对标)。
|
|
120
|
+
- `toAgentOptions(route)` — 丢弃 resolved route 中的 `undefined` 字段以保住按字段继承(绝不把 child 请求的字段写成 `undefined`);`undefined` 进 → `undefined` 出,全 `undefined` 的 route 收敛为 `undefined`(「无 override」)。由 Task、cc-plugin-loader、hooks bridge 与 memory recall 共享。
|
|
121
|
+
- `toOneShotRoute(route, parent?)` — 把 resolved alias 填成完整的 `{provider, model}` 二元组,供独立的 one-shot `ctx.llm.stream` 调用使用:alias 字段优先,缺失字段从 `parent` 继承;补不完整(继承后仍无 model)返回 `undefined`,调用方视为「未配置」。session-title overlay 与 WebFetch summarizer 使用。
|
|
122
|
+
- `ConfigAliasesSchema` / `SettingsAliasesSchema`(及其 record 形式)— config 层(无 `null`)与 settings 层(允许 `null`)的 schemastery schema,外加 `AliasTarget` / `ResolvedRoute` 类型。
|
|
123
123
|
|
|
124
124
|
## dsh-cc lane
|
|
125
125
|
|
|
126
|
-
五个额外 builtin 名与 Claude Code
|
|
126
|
+
五个额外 builtin 名与 Claude Code 家族并列,不是第二套 settings 命名空间。未配置时,除 `architect` 外每个 lane 跟随其 CC 对标,因此已经映射了 `haiku` 的部署不必再写一份 `sketch`:
|
|
127
127
|
|
|
128
128
|
| Lane | 角色 | 未配置时的对标 |
|
|
129
129
|
|---|---|---|
|
|
@@ -131,16 +131,19 @@ alias 的查找顺序:**settings overlay → config 默认 → builtin fallback*
|
|
|
131
131
|
| `draft` | 日常均衡编码 | `sonnet` |
|
|
132
132
|
| `blueprint` | 深度推理 | `opus` |
|
|
133
133
|
| `masterplan` | 最强推理 | `fable` |
|
|
134
|
-
| `architect` | 规划与编排 | inherit
|
|
134
|
+
| `architect` | 规划与编排 | inherit(主线程) |
|
|
135
|
+
| `gauge` | 类型化决策低价 lane(System One 模型;非生成用途) | `haiku` |
|
|
135
136
|
|
|
136
|
-
|
|
137
|
+
`gauge` 是面向 System One 模型(如 `llmbox_systemone/laya`)的类型化决策 lane;**绝不要把它用作 agent frontmatter 的 `model:`**——它由决策消费者选择,而非生成式调用方。该约束是强制的:System One 目标(`protocol: "systemone"` 或 `llmbox_systemone/` 模型 id)在解析出的路由上保留 `protocol: 'systemone'`,聊天投影(`toAgentOptions` / `toOneShotRoute`)拒绝此类路由,routes 服务的 `llm/stream` 守卫以 `SystemOneChatModelError`(code `SYSTEMONE_NOT_CHAT_MODEL`)拒绝任何针对 System One 模型的聊天请求。permission-rules 分类器与探针通过自己的协议客户端访问 System One,不受影响。
|
|
137
138
|
|
|
138
|
-
|
|
139
|
+
已配置的字符串目标若指向另一个 alias,会**跟随一跳**(`sketch: haiku` 共用 haiku 的对象路由,含 `reasoningEffort`)。对象形式目标是具体路由,不作为名字再跟。第二跳不跟,因此 `sketch: draft` + `draft: haiku` 停在字面 `"haiku"`(防环)。
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
frontmatter 两套词都可以写(`model: opus` 或 `model: blueprint`)。后台分类器低价车道仍是 `resolve('haiku')` —— hooks 与 recall 不会改走 `sketch`。
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
## 低价(small-fast)车道
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
没有第二个 alias 名,也没有 `ANTHROPIC_SMALL_FAST_MODEL`。低价后台车道**就是**已配置的 `haiku` alias:需要小型独立 one-shot 分类器模型的消费者调用 `resolve('haiku')` —— 配置了 haiku 即其路由,未配置即继承父路由(builtin fallback)。当前消费者:hooks bridge(未写 `model:` 的 `prompt`/`agent` hook)、开启 `recallUseSmallFast: true` 的 memory recall、session-title overlay 与 WebFetch summarizer。
|
|
146
|
+
|
|
147
|
+
## 非目标(在 parity matrix 中跟踪)
|
|
145
148
|
|
|
146
149
|
`/model` 交互命令、`ANTHROPIC_MODEL` / `ANTHROPIC_SMALL_FAST_MODEL` 环境变量、以及给主会话默认模型加 alias 仍是 follow-up。
|
package/lib/agentOptions.d.ts
CHANGED
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
* survives; one-shots fill missing fields from a parent route and return
|
|
6
6
|
* `undefined` when the pair is still incomplete.
|
|
7
7
|
*
|
|
8
|
+
* Both are the chat projections of a resolved route, so both refuse a System
|
|
9
|
+
* One route (`protocol: 'systemone'`) with `SystemOneChatModelError` — the
|
|
10
|
+
* entry point (Task, plugin agent, prompt hook, side query, …) fails fast with
|
|
11
|
+
* an actionable message instead of spawning a child whose first model request
|
|
12
|
+
* would be rejected at the `llm/stream` boundary as an opaque child failure.
|
|
13
|
+
*
|
|
8
14
|
* @module @dsh-cc/model-aliases/agentOptions
|
|
9
15
|
*/
|
|
10
16
|
import type { ResolvedRoute } from './types.ts';
|
|
@@ -14,6 +20,7 @@ import type { ResolvedRoute } from './types.ts';
|
|
|
14
20
|
* `undefined` in → `undefined` out; an all-`undefined` route → `undefined`.
|
|
15
21
|
* @param route - the resolved route (or `undefined` for no override).
|
|
16
22
|
* @returns the `agentOptions` record, or `undefined` for no override.
|
|
23
|
+
* @throws SystemOneChatModelError when the route is a System One route.
|
|
17
24
|
*/
|
|
18
25
|
export declare function toAgentOptions(route: ResolvedRoute | undefined): Record<string, string> | undefined;
|
|
19
26
|
/**
|
|
@@ -34,6 +41,7 @@ export interface OneShotParentRoute {
|
|
|
34
41
|
* independent `ctx.llm.stream` one-shot. Alias fields win; missing fields
|
|
35
42
|
* inherit from `parent`. Returns undefined when the resulting pair is
|
|
36
43
|
* incomplete (no model after inherit) — callers treat that as "unconfigured".
|
|
44
|
+
* Throws `SystemOneChatModelError` for a System One route.
|
|
37
45
|
*/
|
|
38
46
|
export declare function toOneShotRoute(route: ResolvedRoute | undefined, parent?: OneShotParentRoute): {
|
|
39
47
|
provider: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentOptions.d.ts","sourceRoot":"","sources":["../src/agentOptions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agentOptions.d.ts","sourceRoot":"","sources":["../src/agentOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAQ/C;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CASnG;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GACrC,MAAM,GAAG,SAAS,CAIpB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,MAAM,CAAC,EAAE,kBAAkB,GAC1B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAQjD"}
|
package/lib/agentOptions.js
CHANGED
|
@@ -5,18 +5,32 @@
|
|
|
5
5
|
* survives; one-shots fill missing fields from a parent route and return
|
|
6
6
|
* `undefined` when the pair is still incomplete.
|
|
7
7
|
*
|
|
8
|
+
* Both are the chat projections of a resolved route, so both refuse a System
|
|
9
|
+
* One route (`protocol: 'systemone'`) with `SystemOneChatModelError` — the
|
|
10
|
+
* entry point (Task, plugin agent, prompt hook, side query, …) fails fast with
|
|
11
|
+
* an actionable message instead of spawning a child whose first model request
|
|
12
|
+
* would be rejected at the `llm/stream` boundary as an opaque child failure.
|
|
13
|
+
*
|
|
8
14
|
* @module @dsh-cc/model-aliases/agentOptions
|
|
9
15
|
*/
|
|
16
|
+
import { SystemOneChatModelError, isSystemOneRoute } from "./systemone-guard.js";
|
|
17
|
+
/** Refuse a System One route on a chat projection. */
|
|
18
|
+
function assertChatRoute(route) {
|
|
19
|
+
if (isSystemOneRoute(route))
|
|
20
|
+
throw new SystemOneChatModelError({ model: route.model ?? '', provider: route.provider });
|
|
21
|
+
}
|
|
10
22
|
/**
|
|
11
23
|
* Drop `undefined` fields from a resolved route so per-field inheritance
|
|
12
24
|
* survives (never set a field to `undefined` on the child request).
|
|
13
25
|
* `undefined` in → `undefined` out; an all-`undefined` route → `undefined`.
|
|
14
26
|
* @param route - the resolved route (or `undefined` for no override).
|
|
15
27
|
* @returns the `agentOptions` record, or `undefined` for no override.
|
|
28
|
+
* @throws SystemOneChatModelError when the route is a System One route.
|
|
16
29
|
*/
|
|
17
30
|
export function toAgentOptions(route) {
|
|
18
31
|
if (route === undefined)
|
|
19
32
|
return undefined;
|
|
33
|
+
assertChatRoute(route);
|
|
20
34
|
const out = {};
|
|
21
35
|
if (route.provider !== undefined)
|
|
22
36
|
out['provider'] = route.provider;
|
|
@@ -48,10 +62,12 @@ export function resolveSpawnEffort(route, defEffort) {
|
|
|
48
62
|
* independent `ctx.llm.stream` one-shot. Alias fields win; missing fields
|
|
49
63
|
* inherit from `parent`. Returns undefined when the resulting pair is
|
|
50
64
|
* incomplete (no model after inherit) — callers treat that as "unconfigured".
|
|
65
|
+
* Throws `SystemOneChatModelError` for a System One route.
|
|
51
66
|
*/
|
|
52
67
|
export function toOneShotRoute(route, parent) {
|
|
53
68
|
if (route === undefined)
|
|
54
69
|
return undefined;
|
|
70
|
+
assertChatRoute(route);
|
|
55
71
|
const provider = route.provider ?? parent?.provider;
|
|
56
72
|
const model = route.model ?? parent?.model;
|
|
57
73
|
if (provider === undefined || model === undefined)
|
package/lib/agentOptions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentOptions.js","sourceRoot":"","sources":["../src/agentOptions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agentOptions.js","sourceRoot":"","sources":["../src/agentOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEhF,sDAAsD;AACtD,SAAS,eAAe,CAAC,KAAoB;IAC3C,IAAI,gBAAgB,CAAC,KAAK,CAAC;QAAE,MA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AC,KAAK,CAAC,CAAA;IACtB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,MAAM,EAAE,QAAQ,CAAA;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,MAAM,EAAE,KAAK,CAAA;IAC1C,IAAI,QAAQ,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACnE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACjE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAC5B,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { toAgentOptions, toOneShotRoute, resolveSpawnEffort, type OneShotParentR
|
|
|
17
17
|
export { overlayStampedEffort, stampedEffortOf } from './effort.ts';
|
|
18
18
|
export { ConfigAliasSchema, ConfigAliasesSchema, SettingsAliasSchema, SettingsAliasesSchema, type ConfigAliasEntry, type SettingsAliasEntry, } from './schema.ts';
|
|
19
19
|
export type { AliasTarget, DetailedRoute, ResolvedRoute, AliasInspectKind, AliasInspectVia, AliasInspection } from './types.ts';
|
|
20
|
+
export { SystemOneChatModelError, isSystemOneTarget } from './systemone-guard.ts';
|
|
20
21
|
export { apply as applyRoutes, name as routesPluginName, MODEL_ALIASES_NAMESPACE, resolveAlias, resolveDetailedAlias, type ModelRoutes } from './service.ts';
|
|
21
22
|
export { apply, name } from './service.ts';
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,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AE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC/H,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACjF,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,IAAI,IAAI,gBAAgB,EAAE,uBAAuB,EAAE,YAAY,EAAE,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAC5J,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { BUILTIN_ALIASES, CC_ALIASES, LANE_ALIASES, LANE_PEERS, mergeAliasMaps,
|
|
|
16
16
|
export { toAgentOptions, toOneShotRoute, resolveSpawnEffort } from "./agentOptions.js";
|
|
17
17
|
export { overlayStampedEffort, stampedEffortOf } from "./effort.js";
|
|
18
18
|
export { ConfigAliasSchema, ConfigAliasesSchema, SettingsAliasSchema, SettingsAliasesSchema, } from "./schema.js";
|
|
19
|
+
export { SystemOneChatModelError, isSystemOneTarget } from "./systemone-guard.js";
|
|
19
20
|
export { apply as applyRoutes, name as routesPluginName, MODEL_ALIASES_NAMESPACE, resolveAlias, resolveDetailedAlias } from "./service.js";
|
|
20
21
|
export { apply, name } from "./service.js";
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAA;AACtL,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAA2B,MAAM,mBAAmB,CAAA;AAC/G,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GAGtB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,IAAI,IAAI,gBAAgB,EAAE,uBAAuB,EAAE,YAAY,EAAE,oBAAoB,EAAoB,MAAM,cAAc,CAAA;AAC5J,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAA;AACtL,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAA2B,MAAM,mBAAmB,CAAA;AAC/G,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GAGtB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACjF,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,IAAI,IAAI,gBAAgB,EAAE,uBAAuB,EAAE,YAAY,EAAE,oBAAoB,EAAoB,MAAM,cAAc,CAAA;AAC5J,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA"}
|
package/lib/resolver.d.ts
CHANGED
|
@@ -40,6 +40,13 @@ export declare const CC_ALIASES: readonly string[];
|
|
|
40
40
|
* | `blueprint` | deep reasoning | opus |
|
|
41
41
|
* | `masterplan` | maximum reasoning | fable |
|
|
42
42
|
* | `architect` | planning / orchestration | inherit (main thread) |
|
|
43
|
+
* | `gauge` | typed-decision cheap lane (System One models; not generative) | haiku |
|
|
44
|
+
*
|
|
45
|
+
* `gauge` must never be used as agent frontmatter `model:` — it is a
|
|
46
|
+
* typed-decision lane selected by decision consumers, not a generative alias.
|
|
47
|
+
* This is enforced, not just documented: a System One target keeps
|
|
48
|
+
* `protocol: 'systemone'` on its resolved route, and the chat path rejects it
|
|
49
|
+
* with `SystemOneChatModelError` (see `./systemone-guard.ts`).
|
|
43
50
|
*/
|
|
44
51
|
export declare const LANE_ALIASES: readonly string[];
|
|
45
52
|
/** Unconfigured lane → CC family alias it shares a route with. */
|
package/lib/resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG5F;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAyC,CAAA;AAEjF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAyE,CAAA;AAEnH,kEAAkE;AAClE,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMvD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAqC,CAAA;AA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 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @module @dsh-cc/model-aliases/resolver
|
|
22
22
|
*/
|
|
23
|
+
import { SYSTEMONE_PROTOCOL, isSystemOneModelId, isSystemOneTarget } from "./systemone-guard.js";
|
|
23
24
|
/**
|
|
24
25
|
* Claude Code family aliases. Unconfigured → inherit the parent route.
|
|
25
26
|
* Case-insensitive; a configured value still wins over this fallback.
|
|
@@ -39,14 +40,22 @@ export const CC_ALIASES = ['fable', 'opus', 'sonnet', 'haiku'];
|
|
|
39
40
|
* | `blueprint` | deep reasoning | opus |
|
|
40
41
|
* | `masterplan` | maximum reasoning | fable |
|
|
41
42
|
* | `architect` | planning / orchestration | inherit (main thread) |
|
|
43
|
+
* | `gauge` | typed-decision cheap lane (System One models; not generative) | haiku |
|
|
44
|
+
*
|
|
45
|
+
* `gauge` must never be used as agent frontmatter `model:` — it is a
|
|
46
|
+
* typed-decision lane selected by decision consumers, not a generative alias.
|
|
47
|
+
* This is enforced, not just documented: a System One target keeps
|
|
48
|
+
* `protocol: 'systemone'` on its resolved route, and the chat path rejects it
|
|
49
|
+
* with `SystemOneChatModelError` (see `./systemone-guard.ts`).
|
|
42
50
|
*/
|
|
43
|
-
export const LANE_ALIASES = ['sketch', 'draft', 'blueprint', 'masterplan', 'architect'];
|
|
51
|
+
export const LANE_ALIASES = ['sketch', 'draft', 'blueprint', 'masterplan', 'architect', 'gauge'];
|
|
44
52
|
/** Unconfigured lane → CC family alias it shares a route with. */
|
|
45
53
|
export const LANE_PEERS = {
|
|
46
54
|
sketch: 'haiku',
|
|
47
55
|
draft: 'sonnet',
|
|
48
56
|
blueprint: 'opus',
|
|
49
57
|
masterplan: 'fable',
|
|
58
|
+
gauge: 'haiku',
|
|
50
59
|
};
|
|
51
60
|
/**
|
|
52
61
|
* The builtin alias names that fall back to "inherit the parent route" when
|
|
@@ -193,21 +202,14 @@ export function createModelInspector(getAliases, options) {
|
|
|
193
202
|
return { kind: 'route', via: 'one-hop', hop: foldedTarget, route: followed.route };
|
|
194
203
|
if (followed.kind === 'inherit')
|
|
195
204
|
return { kind: 'inherit', via: 'one-hop', hop: foldedTarget };
|
|
196
|
-
return { kind: 'literal', route:
|
|
205
|
+
return { kind: 'literal', route: literalRoute(hit) };
|
|
197
206
|
}
|
|
198
207
|
// Object form: forward the route fields that are present. `provider` and
|
|
199
208
|
// `reasoningEffort` are optional (absent = inherit / no stamp); `model`
|
|
200
209
|
// is always set on a schema-valid object entry. Object targets are
|
|
201
|
-
// concrete routes — they are not followed as alias names.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
via: 'configured',
|
|
205
|
-
route: {
|
|
206
|
-
...(hit.provider === undefined ? {} : { provider: hit.provider }),
|
|
207
|
-
...(hit.model === undefined ? {} : { model: hit.model }),
|
|
208
|
-
...(hit.reasoningEffort === undefined ? {} : { reasoningEffort: hit.reasoningEffort }),
|
|
209
|
-
},
|
|
210
|
-
};
|
|
210
|
+
// concrete routes — they are not followed as alias names. The System One
|
|
211
|
+
// protocol marker is kept so the chat path can reject the route.
|
|
212
|
+
return { kind: 'route', via: 'configured', route: objectRoute(hit) };
|
|
211
213
|
}
|
|
212
214
|
// Unconfigured lane → follow its CC peer (`sketch` → `haiku`, …).
|
|
213
215
|
// `architect` has no peer and falls through to inherit. Choice: when the
|
|
@@ -230,7 +232,7 @@ export function createModelInspector(getAliases, options) {
|
|
|
230
232
|
if (/^[a-z]+$/.test(folded)) {
|
|
231
233
|
warn(`cc-model-aliases: model "${trimmed}" is not a configured alias and is not builtin; passing through verbatim as a literal model id`);
|
|
232
234
|
}
|
|
233
|
-
return { kind: 'literal', route:
|
|
235
|
+
return { kind: 'literal', route: literalRoute(trimmed) };
|
|
234
236
|
};
|
|
235
237
|
return (model) => {
|
|
236
238
|
if (model === undefined || model.trim().length === 0)
|
|
@@ -272,20 +274,30 @@ function followStringTarget(target, aliases, from) {
|
|
|
272
274
|
const next = aliases.get(folded);
|
|
273
275
|
if (next !== undefined && next !== null) {
|
|
274
276
|
if (typeof next === 'string')
|
|
275
|
-
return { kind: 'route', route:
|
|
276
|
-
return {
|
|
277
|
-
kind: 'route',
|
|
278
|
-
route: {
|
|
279
|
-
...(next.provider === undefined ? {} : { provider: next.provider }),
|
|
280
|
-
...(next.model === undefined ? {} : { model: next.model }),
|
|
281
|
-
...(next.reasoningEffort === undefined ? {} : { reasoningEffort: next.reasoningEffort }),
|
|
282
|
-
},
|
|
283
|
-
};
|
|
277
|
+
return { kind: 'route', route: literalRoute(next) };
|
|
278
|
+
return { kind: 'route', route: objectRoute(next) };
|
|
284
279
|
}
|
|
285
280
|
if (BUILTIN_SET.has(folded))
|
|
286
281
|
return { kind: 'inherit' };
|
|
287
282
|
return { kind: 'literal' };
|
|
288
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Project an object-form alias target into a route: forward the present route
|
|
286
|
+
* fields, plus `protocol: 'systemone'` when the target is a System One target
|
|
287
|
+
* (explicit protocol field or the System One model-id family).
|
|
288
|
+
*/
|
|
289
|
+
function objectRoute(target) {
|
|
290
|
+
return {
|
|
291
|
+
...(target.provider === undefined ? {} : { provider: target.provider }),
|
|
292
|
+
...(target.model === undefined ? {} : { model: target.model }),
|
|
293
|
+
...(target.reasoningEffort === undefined ? {} : { reasoningEffort: target.reasoningEffort }),
|
|
294
|
+
...(isSystemOneTarget(target) ? { protocol: SYSTEMONE_PROTOCOL } : {}),
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/** A literal model-id route, marked System One when the id is in that family. */
|
|
298
|
+
function literalRoute(model) {
|
|
299
|
+
return isSystemOneModelId(model) ? { model, protocol: SYSTEMONE_PROTOCOL } : { model };
|
|
300
|
+
}
|
|
289
301
|
/** Compact-fill a record's own string keys, folding each to lowercase. */
|
|
290
302
|
function foldKeys(record) {
|
|
291
303
|
const out = new Map();
|
package/lib/resolver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts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,CAAA;IACpC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAA;IACnC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/lib/schema.d.ts
CHANGED
|
@@ -30,11 +30,13 @@ export declare const ConfigAliasSchema: z<string | ({
|
|
|
30
30
|
provider?: string | null;
|
|
31
31
|
model?: string | null;
|
|
32
32
|
reasoningEffort?: string | null;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
protocol?: string | null;
|
|
34
|
+
} & import("@deepseek-ai/cosmokit").Dict), string | Schemastery.ObjectT<NoInfer<{
|
|
35
|
+
provider: z<string, string, "plain">;
|
|
36
|
+
model: z<string, string, "plain">;
|
|
37
|
+
reasoningEffort: z<string, string, "plain">;
|
|
38
|
+
protocol: z<string, string, "plain">;
|
|
39
|
+
}>>, "plain">;
|
|
38
40
|
/**
|
|
39
41
|
* Schema for a settings `model-aliases` value: a model id, an explicit route,
|
|
40
42
|
* `null` meaning "delete a same-named config-default entry", or a boolean —
|
|
@@ -44,11 +46,13 @@ export declare const SettingsAliasSchema: z<string | boolean | ({
|
|
|
44
46
|
provider?: string | null;
|
|
45
47
|
model?: string | null;
|
|
46
48
|
reasoningEffort?: string | null;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
protocol?: string | null;
|
|
50
|
+
} & import("@deepseek-ai/cosmokit").Dict) | null, string | boolean | Schemastery.ObjectT<NoInfer<{
|
|
51
|
+
provider: z<string, string, "plain">;
|
|
52
|
+
model: z<string, string, "plain">;
|
|
53
|
+
reasoningEffort: z<string, string, "plain">;
|
|
54
|
+
protocol: z<string, string, "plain">;
|
|
55
|
+
}>> | null, "plain">;
|
|
52
56
|
/**
|
|
53
57
|
* Schema for the whole config `modelAliases` record.
|
|
54
58
|
*/
|
|
@@ -56,11 +60,13 @@ export declare const ConfigAliasesSchema: z<import("@deepseek-ai/cosmokit").Dict
|
|
|
56
60
|
provider?: string | null;
|
|
57
61
|
model?: string | null;
|
|
58
62
|
reasoningEffort?: string | null;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
protocol?: string | null;
|
|
64
|
+
} & import("@deepseek-ai/cosmokit").Dict), string>, import("@deepseek-ai/cosmokit").Dict<string | Schemastery.ObjectT<NoInfer<{
|
|
65
|
+
provider: z<string, string, "plain">;
|
|
66
|
+
model: z<string, string, "plain">;
|
|
67
|
+
reasoningEffort: z<string, string, "plain">;
|
|
68
|
+
protocol: z<string, string, "plain">;
|
|
69
|
+
}>>, string>, "plain">;
|
|
64
70
|
/**
|
|
65
71
|
* Schema for the whole settings `model-aliases` section: a dict of alias
|
|
66
72
|
* entries plus the `warnOnInherit: boolean` control key (default true) that
|
|
@@ -71,11 +77,13 @@ export declare const SettingsAliasesSchema: z<import("@deepseek-ai/cosmokit").Di
|
|
|
71
77
|
provider?: string | null;
|
|
72
78
|
model?: string | null;
|
|
73
79
|
reasoningEffort?: string | null;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
protocol?: string | null;
|
|
81
|
+
} & import("@deepseek-ai/cosmokit").Dict) | null, string>, import("@deepseek-ai/cosmokit").Dict<string | boolean | Schemastery.ObjectT<NoInfer<{
|
|
82
|
+
provider: z<string, string, "plain">;
|
|
83
|
+
model: z<string, string, "plain">;
|
|
84
|
+
reasoningEffort: z<string, string, "plain">;
|
|
85
|
+
protocol: z<string, string, "plain">;
|
|
86
|
+
}>> | null, string>, "plain">;
|
|
79
87
|
/** The validated shape of one config entry (modelled on the schema). */
|
|
80
88
|
export type ConfigAliasEntry = Exclude<AliasTarget, null>;
|
|
81
89
|
/** The validated shape of one settings entry (may be `null` to delete). */
|
package/lib/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAoB7C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;aAAwC,CAAA;AAEtE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;oBAAoE,CAAA;AAEpG;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;sBAA4B,CAAA;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;6BAA8B,CAAA;AAEhE,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;AACzD,2EAA2E;AAC3E,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAA"}
|
package/lib/schema.js
CHANGED
|
@@ -26,12 +26,15 @@ const MODEL_ONLY = z.string().min(1);
|
|
|
26
26
|
* A target that pins an explicit route: `model` is required; `provider` is
|
|
27
27
|
* optional (inherit the parent provider) but must be non-empty when present;
|
|
28
28
|
* `reasoningEffort` is an optional opaque non-empty string whose legal
|
|
29
|
-
* spellings belong to the target model's adapter.
|
|
29
|
+
* spellings belong to the target model's adapter. `protocol` is an optional
|
|
30
|
+
* opaque protocol marker (e.g. `systemone`); it is intentionally not projected
|
|
31
|
+
* into resolved routes — the alias-map reader (route-policy layer) consumes it.
|
|
30
32
|
*/
|
|
31
33
|
const EXPLICIT_ROUTE = z.object({
|
|
32
34
|
provider: z.string().min(1),
|
|
33
35
|
model: z.string().min(1),
|
|
34
36
|
reasoningEffort: z.string().min(1),
|
|
37
|
+
protocol: z.string().min(1),
|
|
35
38
|
});
|
|
36
39
|
/**
|
|
37
40
|
* Schema for a deployment `config` alias value: a model id or an explicit
|
package/lib/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAGxC,gFAAgF;AAChF,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAEpC
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAGxC,gFAAgF;AAChF,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAEpC;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAA;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAA;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;AAEpG;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA"}
|
package/lib/service.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import z from '@deepseek-ai/schemastery';
|
|
18
18
|
import type { Context } from '@deepseek-ai/cordis';
|
|
19
|
-
import type { SettingsNamespace } from '@
|
|
19
|
+
import type { SettingsNamespace } from '@dsh-cc/settings-provider';
|
|
20
20
|
import type { AliasInspection, AliasTarget, DetailedRoute, ResolvedRoute } from './types.ts';
|
|
21
21
|
/** Plugin configuration: deployment-default alias map. */
|
|
22
22
|
export interface Config {
|
package/lib/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OA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AAa,CAY3F"}
|
package/lib/service.js
CHANGED
|
@@ -19,6 +19,7 @@ import { registerNamespaceSafe } from '@dsh-cc/settings-ns';
|
|
|
19
19
|
import { ConfigAliasesSchema, SettingsAliasesSchema } from "./schema.js";
|
|
20
20
|
import { createModelInspector, createModelResolver, mergeAliasMaps } from "./resolver.js";
|
|
21
21
|
import { overlayStampedEffort, stampedEffortOf } from "./effort.js";
|
|
22
|
+
import { assertChatModel } from "./systemone-guard.js";
|
|
22
23
|
/** Runtime config schema (config-layer aliases never hold null). */
|
|
23
24
|
export const Config = z.object({ modelAliases: ConfigAliasesSchema });
|
|
24
25
|
/** The settings namespace carrying the live `model-aliases` overlay. */
|
|
@@ -74,6 +75,27 @@ export function apply(ctx, config = {}) {
|
|
|
74
75
|
const resolved = await next();
|
|
75
76
|
return overlayStampedEffort(resolved, stampedEffortOf(agent.options));
|
|
76
77
|
});
|
|
78
|
+
// System One chat-path guard (the single boundary): every chat request —
|
|
79
|
+
// root and child agent loops, and hand-built one-shots (side queries,
|
|
80
|
+
// web-fetch, titles) — flows through the `llm/stream` waterfall, so a
|
|
81
|
+
// System One model (`gauge` configured with `protocol: 'systemone'`, or a
|
|
82
|
+
// `llmbox_systemone/` model id) is rejected here with a
|
|
83
|
+
// `SystemOneChatModelError` no matter which entry point supplied the model
|
|
84
|
+
// name. System One consumers use their own protocol client and never reach
|
|
85
|
+
// this waterfall. Global + prepend: runs ahead of every other listener and
|
|
86
|
+
// is never filtered out by the dispatching runtime's scope.
|
|
87
|
+
ctx.on('llm/stream', (options, next) => {
|
|
88
|
+
try {
|
|
89
|
+
assertChatModel(aliasSources(), options);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
// Also log it: fail-soft callers (side queries, child agent loops)
|
|
93
|
+
// collapse a thrown request into a generic failure.
|
|
94
|
+
ctx.logger.warn(`cc-model-aliases: ${error.message}`);
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
return next();
|
|
98
|
+
}, { global: true, prepend: true });
|
|
77
99
|
}
|
|
78
100
|
/**
|
|
79
101
|
* Host-plane alias read WITHOUT owning the namespace: resolve through the
|
package/lib/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAGxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAI3D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAGxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAI3D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAStD,oEAAoE;AACpE,MAAM,CAAC,MAAM,MAAM,GAAc,CAAC,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC,CAAA;AAEhF,wEAAwE;AACxE,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAoC,CAAA;AAgB3E,wBAAwB;AACxB,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAA;AA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AAC,OAAO,CAAC;QACzC,aAAa,EAAE,OAAO,EAAE,aAAa,KAAK,KAAK;KAChD,CACF,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System One chat-path guard.
|
|
3
|
+
*
|
|
4
|
+
* System One models (the `gauge` lane) answer typed-decision questions over
|
|
5
|
+
* the native `/v1/systemone` protocol; they are not generative chat models.
|
|
6
|
+
* The resolver keeps that fact on the resolved route (`protocol:
|
|
7
|
+
* 'systemone'`), and the `cc-model-routes` service installs one `llm/stream`
|
|
8
|
+
* listener — the single layer every chat request (agent loops, spawned
|
|
9
|
+
* children, and hand-built one-shots alike) passes through — that rejects a
|
|
10
|
+
* System One model with {@link SystemOneChatModelError}. Legitimate System One
|
|
11
|
+
* consumers (the permission-rules classifier and PI probe) speak the protocol
|
|
12
|
+
* over their own client and never reach `llm/stream`, so they are unaffected.
|
|
13
|
+
*
|
|
14
|
+
* @module @dsh-cc/model-aliases/systemone-guard
|
|
15
|
+
*/
|
|
16
|
+
import type { AliasTarget, ModelProtocol, ResolvedRoute } from './types.ts';
|
|
17
|
+
/** The protocol marker value carried by System One alias targets and routes. */
|
|
18
|
+
export declare const SYSTEMONE_PROTOCOL: ModelProtocol;
|
|
19
|
+
/** Stable machine-readable code carried by {@link SystemOneChatModelError}. */
|
|
20
|
+
export declare const SYSTEMONE_CHAT_MODEL_ERROR_CODE = "SYSTEMONE_NOT_CHAT_MODEL";
|
|
21
|
+
/** True when a bare model id belongs to the System One family. */
|
|
22
|
+
export declare function isSystemOneModelId(model: string | undefined): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* True when one merged alias target is a System One target: an object form
|
|
25
|
+
* carrying `protocol: 'systemone'`, or any form whose model id is in the
|
|
26
|
+
* System One family.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isSystemOneTarget(target: AliasTarget | undefined): boolean;
|
|
29
|
+
/** True when a resolved route carries the System One protocol marker. */
|
|
30
|
+
export declare function isSystemOneRoute(route: ResolvedRoute | undefined): boolean;
|
|
31
|
+
/** Details reported by {@link SystemOneChatModelError}. */
|
|
32
|
+
export interface SystemOneChatModelDetails {
|
|
33
|
+
/** The model id the chat call asked for. */
|
|
34
|
+
readonly model: string;
|
|
35
|
+
/** The provider the chat call asked for, when known. */
|
|
36
|
+
readonly provider?: string | undefined;
|
|
37
|
+
/** The configured alias that declares this model System One, when one matched. */
|
|
38
|
+
readonly alias?: string | undefined;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Thrown when a System One model reaches the chat path. The message names the
|
|
42
|
+
* model, explains why it is rejected, and points at the supported entry point.
|
|
43
|
+
*/
|
|
44
|
+
export declare class SystemOneChatModelError extends Error {
|
|
45
|
+
readonly code = "SYSTEMONE_NOT_CHAT_MODEL";
|
|
46
|
+
readonly model: string;
|
|
47
|
+
readonly provider: string | undefined;
|
|
48
|
+
readonly alias: string | undefined;
|
|
49
|
+
constructor(details: SystemOneChatModelDetails);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Find the System One declaration matching one chat request, if any: the
|
|
53
|
+
* model id is in the System One family, or a merged alias target declared
|
|
54
|
+
* System One names the same model (and the same provider when the target pins
|
|
55
|
+
* one). Returns `undefined` for an ordinary chat model.
|
|
56
|
+
* @param aliases - the effective merged alias map.
|
|
57
|
+
* @param provider - the request's provider.
|
|
58
|
+
* @param model - the request's model id.
|
|
59
|
+
*/
|
|
60
|
+
export declare function findSystemOneTarget(aliases: ReadonlyMap<string, AliasTarget>, provider: string | undefined, model: string | undefined): {
|
|
61
|
+
alias?: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Chat-path assertion: throw {@link SystemOneChatModelError} when the request
|
|
65
|
+
* targets a System One model. No-op for ordinary chat models.
|
|
66
|
+
* @param aliases - the effective merged alias map.
|
|
67
|
+
* @param request - the chat request's provider/model.
|
|
68
|
+
*/
|
|
69
|
+
export declare function assertChatModel(aliases: ReadonlyMap<string, AliasTarget>, request: {
|
|
70
|
+
readonly provider?: string | undefined;
|
|
71
|
+
readonly model?: string | undefined;
|
|
72
|
+
}): void;
|
|
73
|
+
//# sourceMappingURL=systemone-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemone-guard.d.ts","sourceRoot":"","sources":["../src/systemone-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE3E,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,EAAE,aAA2B,CAAA;AAS5D,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,6BAA6B,CAAA;AAEzE,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAErE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAI1E;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,CAE1E;AAED,2DAA2D;AAC3D,MAAM,WAAW,yBAAyB;IACxC,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,kFAAkF;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACpC;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,8BAAkC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEtB,OAAO,EAAE,yBAAyB;CAiB/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,EACzC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAYhC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,EACzC,OAAO,EAAE;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACvF,IAAI,CAIN"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System One chat-path guard.
|
|
3
|
+
*
|
|
4
|
+
* System One models (the `gauge` lane) answer typed-decision questions over
|
|
5
|
+
* the native `/v1/systemone` protocol; they are not generative chat models.
|
|
6
|
+
* The resolver keeps that fact on the resolved route (`protocol:
|
|
7
|
+
* 'systemone'`), and the `cc-model-routes` service installs one `llm/stream`
|
|
8
|
+
* listener — the single layer every chat request (agent loops, spawned
|
|
9
|
+
* children, and hand-built one-shots alike) passes through — that rejects a
|
|
10
|
+
* System One model with {@link SystemOneChatModelError}. Legitimate System One
|
|
11
|
+
* consumers (the permission-rules classifier and PI probe) speak the protocol
|
|
12
|
+
* over their own client and never reach `llm/stream`, so they are unaffected.
|
|
13
|
+
*
|
|
14
|
+
* @module @dsh-cc/model-aliases/systemone-guard
|
|
15
|
+
*/
|
|
16
|
+
/** The protocol marker value carried by System One alias targets and routes. */
|
|
17
|
+
export const SYSTEMONE_PROTOCOL = 'systemone';
|
|
18
|
+
/**
|
|
19
|
+
* Model-id family prefix that identifies a System One model even without an
|
|
20
|
+
* explicit `protocol` field (same heuristic as the permission-rules route
|
|
21
|
+
* policy's arming check).
|
|
22
|
+
*/
|
|
23
|
+
const SYSTEMONE_MODEL_FAMILY_PREFIX = 'llmbox_systemone/';
|
|
24
|
+
/** Stable machine-readable code carried by {@link SystemOneChatModelError}. */
|
|
25
|
+
export const SYSTEMONE_CHAT_MODEL_ERROR_CODE = 'SYSTEMONE_NOT_CHAT_MODEL';
|
|
26
|
+
/** True when a bare model id belongs to the System One family. */
|
|
27
|
+
export function isSystemOneModelId(model) {
|
|
28
|
+
return model !== undefined && model.includes(SYSTEMONE_MODEL_FAMILY_PREFIX);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* True when one merged alias target is a System One target: an object form
|
|
32
|
+
* carrying `protocol: 'systemone'`, or any form whose model id is in the
|
|
33
|
+
* System One family.
|
|
34
|
+
*/
|
|
35
|
+
export function isSystemOneTarget(target) {
|
|
36
|
+
if (target === undefined || target === null)
|
|
37
|
+
return false;
|
|
38
|
+
if (typeof target === 'string')
|
|
39
|
+
return isSystemOneModelId(target);
|
|
40
|
+
return target.protocol === SYSTEMONE_PROTOCOL || isSystemOneModelId(target.model);
|
|
41
|
+
}
|
|
42
|
+
/** True when a resolved route carries the System One protocol marker. */
|
|
43
|
+
export function isSystemOneRoute(route) {
|
|
44
|
+
return route?.protocol === SYSTEMONE_PROTOCOL;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Thrown when a System One model reaches the chat path. The message names the
|
|
48
|
+
* model, explains why it is rejected, and points at the supported entry point.
|
|
49
|
+
*/
|
|
50
|
+
export class SystemOneChatModelError extends Error {
|
|
51
|
+
code = SYSTEMONE_CHAT_MODEL_ERROR_CODE;
|
|
52
|
+
model;
|
|
53
|
+
provider;
|
|
54
|
+
alias;
|
|
55
|
+
constructor(details) {
|
|
56
|
+
const where = details.provider === undefined || details.provider.length === 0
|
|
57
|
+
? `"${details.model}"`
|
|
58
|
+
: `"${details.provider}/${details.model}"`;
|
|
59
|
+
const via = details.alias === undefined ? '' : ` (model alias "${details.alias}")`;
|
|
60
|
+
super(`System One model ${where}${via} cannot be used as a chat model: System One models only answer `
|
|
61
|
+
+ 'typed-decision questions over the System One protocol and cannot generate chat completions. '
|
|
62
|
+
+ 'Pick a chat model or alias (e.g. "haiku" or "sketch") for this Task/agent/hook/side query; '
|
|
63
|
+
+ 'System One models are consumed only by the permission-rules classifier and prompt-injection probe '
|
|
64
|
+
+ '(permission-rules `classifier.backend: "auto"` / `probe.backend: "auto"`, or `route: "gauge"`).');
|
|
65
|
+
this.name = 'SystemOneChatModelError';
|
|
66
|
+
this.model = details.model;
|
|
67
|
+
this.provider = details.provider;
|
|
68
|
+
this.alias = details.alias;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Find the System One declaration matching one chat request, if any: the
|
|
73
|
+
* model id is in the System One family, or a merged alias target declared
|
|
74
|
+
* System One names the same model (and the same provider when the target pins
|
|
75
|
+
* one). Returns `undefined` for an ordinary chat model.
|
|
76
|
+
* @param aliases - the effective merged alias map.
|
|
77
|
+
* @param provider - the request's provider.
|
|
78
|
+
* @param model - the request's model id.
|
|
79
|
+
*/
|
|
80
|
+
export function findSystemOneTarget(aliases, provider, model) {
|
|
81
|
+
if (model === undefined || model.length === 0)
|
|
82
|
+
return undefined;
|
|
83
|
+
const familyHit = isSystemOneModelId(model) ? {} : undefined;
|
|
84
|
+
for (const [alias, target] of aliases) {
|
|
85
|
+
if (target === null || !isSystemOneTarget(target))
|
|
86
|
+
continue;
|
|
87
|
+
const targetModel = typeof target === 'string' ? target : target.model;
|
|
88
|
+
const targetProvider = typeof target === 'string' ? undefined : target.provider;
|
|
89
|
+
if (targetModel !== model)
|
|
90
|
+
continue;
|
|
91
|
+
if (targetProvider !== undefined && provider !== undefined && targetProvider !== provider)
|
|
92
|
+
continue;
|
|
93
|
+
return { alias };
|
|
94
|
+
}
|
|
95
|
+
return familyHit;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Chat-path assertion: throw {@link SystemOneChatModelError} when the request
|
|
99
|
+
* targets a System One model. No-op for ordinary chat models.
|
|
100
|
+
* @param aliases - the effective merged alias map.
|
|
101
|
+
* @param request - the chat request's provider/model.
|
|
102
|
+
*/
|
|
103
|
+
export function assertChatModel(aliases, request) {
|
|
104
|
+
const hit = findSystemOneTarget(aliases, request.provider, request.model);
|
|
105
|
+
if (hit === undefined)
|
|
106
|
+
return;
|
|
107
|
+
throw new SystemOneChatModelError({ model: request.model ?? '', provider: request.provider, alias: hit.alias });
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=systemone-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemone-guard.js","sourceRoot":"","sources":["../src/systemone-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAkB,WAAW,CAAA;AAE5D;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,mBAAmB,CAAA;AAEzD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,+BAA+B,GAAG,0BAA0B,CAAA;AAEzE,kEAAkE;AAClE,MAAM,UAAU,kBAAkB,CAAC,KAAyB;IAC1D,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAA;AAC7E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA+B;IAC/D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IACzD,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjE,OAAO,MAAM,CAAC,QAAQ,KAAK,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACnF,CA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: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Wire protocol marker kept from the alias target. `'systemone'` marks a
|
|
39
|
+
* System One (typed-decision) model: it is NOT a chat model, and the chat
|
|
40
|
+
* path rejects it (`SystemOneChatModelError`). Absent → ordinary chat model.
|
|
41
|
+
* Never forwarded into spawn `agentOptions` or one-shot routes.
|
|
42
|
+
*/
|
|
43
|
+
readonly protocol?: ModelProtocol | undefined;
|
|
37
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Typed wire-protocol markers a resolved route can carry. Only System One is
|
|
47
|
+
* recognized today; other alias-target `protocol` strings are not projected.
|
|
48
|
+
*/
|
|
49
|
+
export type ModelProtocol = 'systemone';
|
|
38
50
|
/**
|
|
39
51
|
* What an alias lookup resolved to, for provenance reporting (`/doctor`).
|
|
40
52
|
*
|
|
@@ -95,5 +107,6 @@ export type AliasTarget = string | {
|
|
|
95
107
|
readonly provider?: string;
|
|
96
108
|
readonly model: string;
|
|
97
109
|
readonly reasoningEffort?: string;
|
|
110
|
+
readonly protocol?: string;
|
|
98
111
|
} | null;
|
|
99
112
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAE9D;;;GAGG;A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"version": "0.8.
|
|
4
|
+
"version": "0.8.2-rc.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/dsh-cc/dsh-cc.git",
|
|
@@ -33,9 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@deepseek-ai/cordis": ">=0.1.
|
|
37
|
-
"@deepseek-ai/dsh-agent": ">=0.1.
|
|
38
|
-
"@deepseek-ai/dsh-settings": ">=0.1.5-rc.1",
|
|
36
|
+
"@deepseek-ai/cordis": ">=0.1.7-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-agent": ">=0.1.7-rc.2",
|
|
39
38
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
@@ -47,18 +46,18 @@
|
|
|
47
46
|
"@deepseek-ai/dsh-session": "link:../../../../deepseek-harness/packages/core/session",
|
|
48
47
|
"@deepseek-ai/dsh-session-persistence-jsonl": "link:../../../../deepseek-harness/packages/session/session-persistence-jsonl",
|
|
49
48
|
"@deepseek-ai/dsh-session-projection": "link:../../../../deepseek-harness/packages/session/session-projection",
|
|
50
|
-
"@deepseek-ai/dsh-settings": "link:../../../../deepseek-harness/packages/settings/settings",
|
|
51
49
|
"@deepseek-ai/dsh-subagent": "link:../../../../deepseek-harness/packages/subagent/subagent",
|
|
52
50
|
"@deepseek-ai/dsh-subagent-fork-in-process": "link:../../../../deepseek-harness/packages/subagent/subagent-fork-in-process",
|
|
53
51
|
"@deepseek-ai/dsh-subagent-spawn-in-process": "link:../../../../deepseek-harness/packages/subagent/subagent-spawn-in-process",
|
|
54
52
|
"@deepseek-ai/schemastery": "link:../../../../deepseek-harness/vendor/schemastery",
|
|
55
|
-
"@dsh-cc/settings-
|
|
53
|
+
"@dsh-cc/settings-provider": "^0.8.2-rc.1",
|
|
54
|
+
"@dsh-cc/settings-ns": "^0.8.2-rc.1",
|
|
56
55
|
"@dsh-cc/agent-loop-mock": "^0.1.0"
|
|
57
56
|
},
|
|
58
57
|
"publishConfig": {
|
|
59
58
|
"access": "public"
|
|
60
59
|
},
|
|
61
60
|
"dependencies": {
|
|
62
|
-
"@dsh-cc/settings-ns": "^0.8.
|
|
61
|
+
"@dsh-cc/settings-ns": "^0.8.2-rc.1"
|
|
63
62
|
}
|
|
64
63
|
}
|