@suifei/dsh-ai-team 0.4.151 → 0.4.153

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.
@@ -52,6 +52,17 @@ export async function ensureHostAgent(options) {
52
52
  if (agents === undefined || typeof agents.create !== 'function') {
53
53
  throw new HostAgentError('E_RUNTIME_UNAVAILABLE', 'agents service is unavailable');
54
54
  }
55
+ const selection = typeof options.agentDefaultModel?.currentSelection === 'function'
56
+ ? options.agentDefaultModel.currentSelection()
57
+ : null;
58
+ let agentOptions;
59
+ if (typeof selection?.provider === 'string' && selection.provider !== ''
60
+ && typeof selection?.model === 'string' && selection.model !== '') {
61
+ agentOptions = { provider: selection.provider, model: selection.model };
62
+ if (typeof selection.reasoningEffort === 'string' && selection.reasoningEffort !== '') {
63
+ agentOptions.reasoningEffort = selection.reasoningEffort;
64
+ }
65
+ }
55
66
  // Repair a Host Agent archived by an earlier revision: the archive gate
56
67
  // covers the host's whole subagent lineage, so every member turn would end
57
68
  // blocked before any model request. `unarchiveSession` resolves without
@@ -70,20 +81,11 @@ export async function ensureHostAgent(options) {
70
81
  // Persist the resolved route into the session log. Live AgentOptions die
71
82
  // with the process; without a recorded selection a restored session renders
72
83
  // prompts with an unresolvable {{model}} variable.
73
- const persistSelection = (sessionId, selection) => {
84
+ const persistSelection = (sessionId) => {
85
+ if (agentOptions === undefined) return;
74
86
  try {
75
87
  const session = options.sessions?.get?.(sessionId);
76
- if (session === undefined || session === null || typeof session.append !== 'function') return;
77
- if (typeof selection?.provider !== 'string' || typeof selection?.model !== 'string') return;
78
- // 推理等级一并记下,否则恢复出来的会话按模型默认档走。
79
- const effort = typeof selection.reasoningEffort === 'string' && selection.reasoningEffort !== ''
80
- ? selection.reasoningEffort
81
- : null;
82
- session.append('model/selection', {
83
- provider: selection.provider,
84
- model: selection.model,
85
- ...(effort === null ? {} : { reasoningEffort: effort }),
86
- });
88
+ session?.append?.('model/selection', agentOptions);
87
89
  } catch (error) {
88
90
  reportFail('host.model.persist.fail', {}, '[ai-team] host model selection persist failed: ' + (error?.message ?? error));
89
91
  }
@@ -94,7 +96,11 @@ export async function ensureHostAgent(options) {
94
96
  let release = async () => {};
95
97
  if (agent === undefined) {
96
98
  try {
97
- const handle = await agents.resume({ resumeSessionId: options.resumeSessionId });
99
+ // The inbox can wake before resume returns. Supply the initial route
100
+ // at construction, leaving any persisted selection to the host.
101
+ const request = { resumeSessionId: options.resumeSessionId };
102
+ if (agentOptions !== undefined) request.agentOptions = agentOptions;
103
+ const handle = await agents.resume(request);
98
104
  agent = handle?.agent;
99
105
  release = async () => { try { await handle?.dispose?.(); } catch { /* already gone */ } };
100
106
  } catch (error) {
@@ -119,21 +125,15 @@ export async function ensureHostAgent(options) {
119
125
  );
120
126
  } else {
121
127
  await unarchiveHost(options.resumeSessionId);
122
- const selection = typeof options.agentDefaultModel?.currentSelection === 'function' ? options.agentDefaultModel.currentSelection() : null;
123
- persistSelection(options.resumeSessionId, selection);
128
+ if (live !== undefined && live.model?.current?.() === undefined) persistSelection(options.resumeSessionId);
124
129
  return { agent, created: false, resumed: true, sessionId: options.resumeSessionId, dispose: release };
125
130
  }
126
131
  }
127
132
 
128
- const selection = typeof options.agentDefaultModel?.currentSelection === 'function'
129
- ? options.agentDefaultModel.currentSelection()
130
- : null;
131
- if (selection === null || typeof selection.provider !== 'string' || typeof selection.model !== 'string') {
133
+ if (agentOptions === undefined) {
132
134
  throw new HostAgentError('E_RUNTIME_UNAVAILABLE', 'no default provider/model is configured for the Team Host Agent');
133
135
  }
134
136
  const sessionId = options.newSessionId?.() ?? `session-team-host-${randomUUID()}`;
135
- const agentOptions = { provider: selection.provider, model: selection.model };
136
- if (typeof selection.reasoningEffort === 'string') agentOptions.reasoningEffort = selection.reasoningEffort;
137
137
  let handle;
138
138
  try {
139
139
  handle = await agents.create({
@@ -146,7 +146,7 @@ export async function ensureHostAgent(options) {
146
146
  cause: error?.code ?? null,
147
147
  });
148
148
  }
149
- persistSelection(sessionId, selection);
149
+ persistSelection(sessionId);
150
150
  const host = handle.agent;
151
151
  await unarchiveHost(sessionId);
152
152
  return {
package/package.json CHANGED
@@ -1,75 +1,75 @@
1
- {
2
- "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.151",
4
- "type": "module",
5
- "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
- "license": "MIT",
7
- "author": "suifei",
8
- "homepage": "https://github.com/suifei/dsh-ai-team#readme",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/suifei/dsh-ai-team.git"
12
- },
13
- "bugs": {
14
- "url": "https://github.com/suifei/dsh-ai-team/issues"
15
- },
16
- "keywords": [
17
- "deepseek-harness",
18
- "dsh",
19
- "dsh-plugin",
20
- "ai-team",
21
- "multi-agent",
22
- "agent-team",
23
- "task-ledger",
24
- "wenyuan"
25
- ],
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "icon": "./icon.svg",
30
- "exports": {
31
- ".": "./index.js",
32
- "./client": "./client.js",
33
- "./package.json": "./package.json",
34
- "./lib/*": "./lib/*",
35
- "./locale/*.json": "./locale/*.json",
36
- "./icon": "./icon.svg"
37
- },
38
- "dependencies": {
39
- "@deepseek-ai/schemastery": "~3.19.0",
40
- "yaml": "~2.9.1",
41
- "yauzl": "3.4.0"
42
- },
43
- "files": [
44
- "index.js",
45
- "client.js",
46
- "cordis.patch.yml",
47
- "icon.svg",
48
- "locale/*.json",
49
- "lib/**/*.js",
50
- "lib/vendor/skillopt/scripts/*.py",
51
- "lib/vendor/skillopt/skillopt_sleep/**/*.py",
52
- "lib/vendor/skillopt/skillopt_sleep/**/*.mjs",
53
- "lib/vendor/skillopt/requirements.txt",
54
- "lib/vendor/skillopt/LICENSE",
55
- "skills/**/*",
56
- "talents/**/*",
57
- "teams/**/*",
58
- "README.md",
59
- "CHANGELOG.md",
60
- "LICENSE"
61
- ],
62
- "scripts": {
63
- "test": "node --test"
64
- },
65
- "dsh": {
66
- "bundle": {
67
- "patch": "./cordis.patch.yml"
68
- },
69
- "client": {
70
- "platform": "web",
71
- "immediately": true,
72
- "inject": []
73
- }
74
- }
75
- }
1
+ {
2
+ "name": "@suifei/dsh-ai-team",
3
+ "version": "0.4.153",
4
+ "type": "module",
5
+ "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
+ "license": "MIT",
7
+ "author": "suifei",
8
+ "homepage": "https://github.com/suifei/dsh-ai-team#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/suifei/dsh-ai-team.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/suifei/dsh-ai-team/issues"
15
+ },
16
+ "keywords": [
17
+ "deepseek-harness",
18
+ "dsh",
19
+ "dsh-plugin",
20
+ "ai-team",
21
+ "multi-agent",
22
+ "agent-team",
23
+ "task-ledger",
24
+ "wenyuan"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "icon": "./icon.svg",
30
+ "exports": {
31
+ ".": "./index.js",
32
+ "./client": "./client.js",
33
+ "./package.json": "./package.json",
34
+ "./lib/*": "./lib/*",
35
+ "./locale/*.json": "./locale/*.json",
36
+ "./icon": "./icon.svg"
37
+ },
38
+ "dependencies": {
39
+ "@deepseek-ai/schemastery": "~3.19.0",
40
+ "yaml": "~2.9.1",
41
+ "yauzl": "3.4.0"
42
+ },
43
+ "files": [
44
+ "index.js",
45
+ "client.js",
46
+ "cordis.patch.yml",
47
+ "icon.svg",
48
+ "locale/*.json",
49
+ "lib/**/*.js",
50
+ "lib/vendor/skillopt/scripts/*.py",
51
+ "lib/vendor/skillopt/skillopt_sleep/**/*.py",
52
+ "lib/vendor/skillopt/skillopt_sleep/**/*.mjs",
53
+ "lib/vendor/skillopt/requirements.txt",
54
+ "lib/vendor/skillopt/LICENSE",
55
+ "skills/**/*",
56
+ "talents/**/*",
57
+ "teams/**/*",
58
+ "README.md",
59
+ "CHANGELOG.md",
60
+ "LICENSE"
61
+ ],
62
+ "scripts": {
63
+ "test": "node --test"
64
+ },
65
+ "dsh": {
66
+ "bundle": {
67
+ "patch": "./cordis.patch.yml"
68
+ },
69
+ "client": {
70
+ "platform": "web",
71
+ "immediately": true,
72
+ "inject": []
73
+ }
74
+ }
75
+ }