@stackstackstack/dsh-agent-default-model 0.1.5
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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +25 -0
- package/README.zh.md +25 -0
- package/lib/index.js +74 -0
- package/lib/invariant.js +25 -0
- package/lib/types/index.d.ts +58 -0
- package/lib/types/invariant.d.ts +21 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/core/agent-default-model/README.md
|
|
5
|
+
README.md: 4bce6380876ec88f7a5a961da7eef7d38918727f
|
|
6
|
+
README.zh.md: 7f8681643c92130ac4358c86c32e52e457b685d6
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @stackstackstack/dsh-agent-default-model
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
The deployment default used when an entry point creates an Agent that has no session-local model selection. `AgentDefaultModelConfig` provides `ctx.agentDefaultModel`; direct entry points such as `dsh --profile headless` and Host-backed entry points such as ApiProxy read the same service instead of owning parallel provider/model defaults.
|
|
6
|
+
|
|
7
|
+
The plugin config requires `{ provider, model }`. That composition entry is the base of the `agent-default-model` Settings section; a mounted settings provider layers the user's choice over it and changes are visible on the next `currentSelection()` read. `reasoningEffort` belongs to the Settings section but deliberately not to plugin config: a complete saved selection can clear an effort when the next selected model has none, while a composition value would be inherited again.
|
|
8
|
+
|
|
9
|
+
- `ctx.agentDefaultModel.currentSelection()` returns a detached `{ provider, model, reasoningEffort? }` selection for a newly created Agent.
|
|
10
|
+
- `ctx.agentDefaultModel.saveSelection(selection)` saves the complete user selection. Without a settings provider it is a no-op and the composition entry remains current.
|
|
11
|
+
|
|
12
|
+
The service does not validate catalog membership. A provider route may serve an unadvertised model, and the consumer that actually opens a model request owns availability diagnostics.
|
|
13
|
+
|
|
14
|
+
## Model Experience
|
|
15
|
+
|
|
16
|
+
Indirectly, through the provider/model selection supplied to an entry point; request assembly and adapters own the model-visible request.
|
|
17
|
+
|
|
18
|
+
#### KV Cache effect
|
|
19
|
+
|
|
20
|
+
Changing the default affects only Agents that subsequently resolve from it. An existing session whose request log already names a selection keeps that selection, so this service does not invalidate its established prefix.
|
|
21
|
+
|
|
22
|
+
## Known Limitations and Deferred Work
|
|
23
|
+
|
|
24
|
+
- The service owns one process-wide default; per-session selection remains the entry point's responsibility.
|
|
25
|
+
- Without a settings provider, `saveSelection()` cannot retain a selection for a later Agent.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @stackstackstack/dsh-agent-default-model
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
该部署默认值供入口在创建尚无会话级模型选择的 Agent 时使用。`AgentDefaultModelConfig` 提供 `ctx.agentDefaultModel`;`dsh --profile headless` 这类直接入口与 ApiProxy 这类由 Host 支撑的入口读取同一服务,而不是分别持有平行的提供方/模型默认值。
|
|
6
|
+
|
|
7
|
+
插件配置必须提供 `{ provider, model }`。该组合配置项构成 Settings 中 `agent-default-model` 分节的基础层;挂载的设置提供方在其上叠加用户选择,更改会在下一次调用 `currentSelection()` 时可见。`reasoningEffort` 属于该 Settings 分节,但特意不属于插件配置:完整保存的选择必须能在下一个选定模型没有推理(reasoning)强度时清除旧值,而组合配置值会再次被继承。
|
|
8
|
+
|
|
9
|
+
- `ctx.agentDefaultModel.currentSelection()` 返回一份独立的 `{ provider, model, reasoningEffort? }` 选择,供新创建的 Agent 使用。
|
|
10
|
+
- `ctx.agentDefaultModel.saveSelection(selection)` 保存完整的用户选择。未挂载设置提供方时,此调用不执行任何操作,组合配置项仍为当前值。
|
|
11
|
+
|
|
12
|
+
该服务不校验目录成员关系。提供方路由可以服务未在目录中公布的模型;实际发起模型请求的消费方负责可用性诊断。
|
|
13
|
+
|
|
14
|
+
## 模型体验
|
|
15
|
+
|
|
16
|
+
通过提供给入口的提供方/模型选择间接影响;模型可见请求由请求组装与适配器负责。
|
|
17
|
+
|
|
18
|
+
#### KV Cache 影响
|
|
19
|
+
|
|
20
|
+
更改默认值只影响之后从该默认值解析选择的 Agent。请求日志已经指明选择的现有会话仍沿用该选择,因此本服务不会使其已建立的前缀失效。
|
|
21
|
+
|
|
22
|
+
## 已知限制与暂缓事项
|
|
23
|
+
|
|
24
|
+
- 该服务只拥有一项进程级默认值;每个会话的选择仍由入口负责。
|
|
25
|
+
- 未挂载设置提供方时,`saveSelection()` 无法保留选择供后续 Agent 使用。
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Service } from "@deepseek-ai/cordis";
|
|
2
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
|
+
import { ReasoningEffortId } from "@stackstackstack/dsh-llm";
|
|
4
|
+
import { installSettingsSection, settingsNamespace } from "@stackstackstack/dsh-settings";
|
|
5
|
+
//#region lib/types/index.js
|
|
6
|
+
/**
|
|
7
|
+
* Default model selection for an Agent without a session-specific selection.
|
|
8
|
+
*
|
|
9
|
+
* @module @stackstackstack/dsh-agent-default-model
|
|
10
|
+
*/
|
|
11
|
+
/** Settings namespace carrying the default model selection for future Agents. */
|
|
12
|
+
const AGENT_DEFAULT_MODEL_SETTINGS_NAMESPACE = settingsNamespace("agent-default-model");
|
|
13
|
+
/** Schema of the default Agent model settings section. */
|
|
14
|
+
const AGENT_DEFAULT_MODEL_SETTINGS_SCHEMA = z.object({
|
|
15
|
+
provider: z.string().required(),
|
|
16
|
+
model: z.string().required(),
|
|
17
|
+
reasoningEffort: z.string()
|
|
18
|
+
});
|
|
19
|
+
/** Project stored settings onto the Agent-facing selection type. */
|
|
20
|
+
function selection(settings) {
|
|
21
|
+
return {
|
|
22
|
+
provider: settings.provider,
|
|
23
|
+
model: settings.model,
|
|
24
|
+
...settings.reasoningEffort === void 0 ? {} : { reasoningEffort: ReasoningEffortId(settings.reasoningEffort) }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Owns the default model selection independently of any Host or transport.
|
|
29
|
+
* The composition entry remains usable without a settings provider; when one
|
|
30
|
+
* is mounted, its user layer is read live.
|
|
31
|
+
*/
|
|
32
|
+
var AgentDefaultModelConfig = class extends Service {
|
|
33
|
+
static Config = z.object({
|
|
34
|
+
provider: z.string().required(),
|
|
35
|
+
model: z.string().required()
|
|
36
|
+
});
|
|
37
|
+
source;
|
|
38
|
+
constructor(ctx, config) {
|
|
39
|
+
super(ctx, "agentDefaultModel");
|
|
40
|
+
const entry = {
|
|
41
|
+
provider: config.provider,
|
|
42
|
+
model: config.model
|
|
43
|
+
};
|
|
44
|
+
this.source = () => entry;
|
|
45
|
+
installSettingsSection(ctx, AGENT_DEFAULT_MODEL_SETTINGS_NAMESPACE, AGENT_DEFAULT_MODEL_SETTINGS_SCHEMA, entry, {
|
|
46
|
+
setSource: (current) => {
|
|
47
|
+
this.source = current;
|
|
48
|
+
},
|
|
49
|
+
onChange: () => {}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Read the current default model selection.
|
|
54
|
+
* @returns a detached provider, model, and optional reasoning selection.
|
|
55
|
+
*/
|
|
56
|
+
currentSelection() {
|
|
57
|
+
return selection(this.source());
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Save the complete default model selection. A deployment without a settings
|
|
61
|
+
* provider keeps its composition entry.
|
|
62
|
+
* @param next - resolved selection accepted by an entry point.
|
|
63
|
+
* @returns fulfillment after the optional settings write settles.
|
|
64
|
+
*/
|
|
65
|
+
async saveSelection(next) {
|
|
66
|
+
await this.ctx.get("settings")?.replace(AGENT_DEFAULT_MODEL_SETTINGS_NAMESPACE, {
|
|
67
|
+
provider: next.provider,
|
|
68
|
+
model: next.model,
|
|
69
|
+
...next.reasoningEffort === void 0 ? {} : { reasoningEffort: String(next.reasoningEffort) }
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { AGENT_DEFAULT_MODEL_SETTINGS_NAMESPACE, AGENT_DEFAULT_MODEL_SETTINGS_SCHEMA, AgentDefaultModelConfig, AgentDefaultModelConfig as default };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for the default Agent model selection.
|
|
4
|
+
*
|
|
5
|
+
* The service owns no independent event relationship: settings registration
|
|
6
|
+
* already validates every mutable value before `currentSelection()` can observe it.
|
|
7
|
+
* The empty installer keeps that absence explicit in composed invariant sets.
|
|
8
|
+
*
|
|
9
|
+
* @module @stackstackstack/dsh-agent-default-model/invariant
|
|
10
|
+
*/
|
|
11
|
+
const PACKAGE_NAME = "@stackstackstack/dsh-agent-default-model";
|
|
12
|
+
/** Cordis companion plugin name. */
|
|
13
|
+
const name = "agent-default-model-invariant";
|
|
14
|
+
/** Services required before the companion can register. */
|
|
15
|
+
const inject = ["invariants"];
|
|
16
|
+
/** No runtime invariant: settings validation owns the only mutable-value relationship. */
|
|
17
|
+
const install = () => {};
|
|
18
|
+
/**
|
|
19
|
+
* Register the intentionally empty invariant contribution.
|
|
20
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
21
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
22
|
+
*/
|
|
23
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
24
|
+
//#endregion
|
|
25
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default model selection for an Agent without a session-specific selection.
|
|
3
|
+
*
|
|
4
|
+
* @module @stackstackstack/dsh-agent-default-model
|
|
5
|
+
*/
|
|
6
|
+
import { Context, Service } from '@deepseek-ai/cordis';
|
|
7
|
+
import z from '@deepseek-ai/schemastery';
|
|
8
|
+
import type { ModelSelection } from '@stackstackstack/dsh-agent';
|
|
9
|
+
declare module '@deepseek-ai/cordis' {
|
|
10
|
+
interface Context {
|
|
11
|
+
/** Default model selection for Agents created without an explicit model. */
|
|
12
|
+
agentDefaultModel: AgentDefaultModelConfig;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Settings namespace carrying the default model selection for future Agents. */
|
|
16
|
+
export declare const AGENT_DEFAULT_MODEL_SETTINGS_NAMESPACE: import("@stackstackstack/dsh-settings").SettingsNamespace;
|
|
17
|
+
/** Stored and composed default model selection. */
|
|
18
|
+
export interface AgentDefaultModelSettings {
|
|
19
|
+
/** Registered provider route. */
|
|
20
|
+
provider: string;
|
|
21
|
+
/** Provider-owned model id. */
|
|
22
|
+
model: string;
|
|
23
|
+
/** Adapter-owned reasoning effort, or provider/default behavior when absent. */
|
|
24
|
+
reasoningEffort?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Schema of the default Agent model settings section. */
|
|
27
|
+
export declare const AGENT_DEFAULT_MODEL_SETTINGS_SCHEMA: z<AgentDefaultModelSettings>;
|
|
28
|
+
/** Composition entry for the default model selection. */
|
|
29
|
+
export interface Config {
|
|
30
|
+
/** Registered provider route. */
|
|
31
|
+
provider: string;
|
|
32
|
+
/** Provider-owned model id. */
|
|
33
|
+
model: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Owns the default model selection independently of any Host or transport.
|
|
37
|
+
* The composition entry remains usable without a settings provider; when one
|
|
38
|
+
* is mounted, its user layer is read live.
|
|
39
|
+
*/
|
|
40
|
+
export declare class AgentDefaultModelConfig extends Service {
|
|
41
|
+
static Config: z<Config>;
|
|
42
|
+
private source;
|
|
43
|
+
constructor(ctx: Context, config: Config);
|
|
44
|
+
/**
|
|
45
|
+
* Read the current default model selection.
|
|
46
|
+
* @returns a detached provider, model, and optional reasoning selection.
|
|
47
|
+
*/
|
|
48
|
+
currentSelection(): ModelSelection;
|
|
49
|
+
/**
|
|
50
|
+
* Save the complete default model selection. A deployment without a settings
|
|
51
|
+
* provider keeps its composition entry.
|
|
52
|
+
* @param next - resolved selection accepted by an entry point.
|
|
53
|
+
* @returns fulfillment after the optional settings write settles.
|
|
54
|
+
*/
|
|
55
|
+
saveSelection(next: ModelSelection): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export default AgentDefaultModelConfig;
|
|
58
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for the default Agent model selection.
|
|
3
|
+
*
|
|
4
|
+
* The service owns no independent event relationship: settings registration
|
|
5
|
+
* already validates every mutable value before `currentSelection()` can observe it.
|
|
6
|
+
* The empty installer keeps that absence explicit in composed invariant sets.
|
|
7
|
+
*
|
|
8
|
+
* @module @stackstackstack/dsh-agent-default-model/invariant
|
|
9
|
+
*/
|
|
10
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
+
/** Cordis companion plugin name. */
|
|
12
|
+
export declare const name = "agent-default-model-invariant";
|
|
13
|
+
/** Services required before the companion can register. */
|
|
14
|
+
export declare const inject: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Register the intentionally empty invariant contribution.
|
|
17
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
18
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
19
|
+
*/
|
|
20
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
21
|
+
//# sourceMappingURL=invariant.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stackstackstack/dsh-agent-default-model",
|
|
3
|
+
"description": "Default model selection shared by Agent entry points",
|
|
4
|
+
"version": "0.1.5",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/core/agent-default-model"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./src/*": "./src/*",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib/index.js",
|
|
30
|
+
"lib/invariant.js",
|
|
31
|
+
"lib/types/**/*.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@stackstackstack/dsh-agent": "^0.1.5",
|
|
39
|
+
"@stackstackstack/dsh-invariants": "^0.1.5",
|
|
40
|
+
"@stackstackstack/dsh-settings": "^0.1.5",
|
|
41
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
42
|
+
"@stackstackstack/dsh-llm": "^0.1.5"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@stackstackstack/dsh-agent": "^0.1.5",
|
|
46
|
+
"@stackstackstack/dsh-invariants": "^0.1.5",
|
|
47
|
+
"@stackstackstack/dsh-llm": "^0.1.5",
|
|
48
|
+
"@stackstackstack/dsh-settings": "^0.1.5",
|
|
49
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
50
|
+
}
|
|
51
|
+
}
|