@co0ontty/wand 4.89.0-beta.gde0b3cd → 4.89.0

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.
Files changed (70) hide show
  1. package/dist/agent-dispatch.d.ts +0 -5
  2. package/dist/agent-dispatch.js +0 -8
  3. package/dist/ai-team-runner.d.ts +1 -1
  4. package/dist/ai-team-runner.js +5 -13
  5. package/dist/ai-team-types.js +2 -3
  6. package/dist/build-info.json +4 -4
  7. package/dist/commit-task-archive.d.ts +0 -3
  8. package/dist/commit-task-archive.js +0 -15
  9. package/dist/config.js +0 -1
  10. package/dist/decision-expert-employee.d.ts +1 -1
  11. package/dist/decision-expert-employee.js +3 -3
  12. package/dist/decision-expert-service.d.ts +5 -6
  13. package/dist/decision-expert-service.js +49 -75
  14. package/dist/decision-types.d.ts +1 -2
  15. package/dist/git-quick-commit.d.ts +4 -13
  16. package/dist/git-quick-commit.js +33 -112
  17. package/dist/local-model-setup.d.ts +1 -7
  18. package/dist/local-model-setup.js +7 -54
  19. package/dist/local-model-types.d.ts +1 -2
  20. package/dist/process-manager.d.ts +1 -4
  21. package/dist/process-manager.js +6 -5
  22. package/dist/server-employee-routes.d.ts +0 -2
  23. package/dist/server-employee-routes.js +45 -19
  24. package/dist/server-file-routes.js +25 -61
  25. package/dist/server-local-model-routes.js +0 -12
  26. package/dist/server-session-routes.d.ts +1 -2
  27. package/dist/server-session-routes.js +10 -13
  28. package/dist/server-speech-routes.d.ts +0 -2
  29. package/dist/server-speech-routes.js +1 -7
  30. package/dist/server-task-routes.d.ts +0 -3
  31. package/dist/server-task-routes.js +10 -13
  32. package/dist/server.js +8 -20
  33. package/dist/session-ai-context.d.ts +4 -6
  34. package/dist/session-ai-context.js +9 -10
  35. package/dist/silicon-employee-dispatch.d.ts +6 -4
  36. package/dist/silicon-employee-dispatch.js +6 -9
  37. package/dist/speech-service.d.ts +1 -3
  38. package/dist/speech-service.js +3 -14
  39. package/dist/speech-types.d.ts +0 -5
  40. package/dist/storage.d.ts +0 -2
  41. package/dist/storage.js +1 -18
  42. package/dist/structured-session-manager.d.ts +2 -3
  43. package/dist/structured-session-manager.js +7 -11
  44. package/dist/system-employee.d.ts +4 -6
  45. package/dist/system-employee.js +5 -8
  46. package/dist/types.d.ts +1 -3
  47. package/dist/user-memory.d.ts +0 -2
  48. package/dist/user-memory.js +1 -1
  49. package/dist/web-ui/content/ai-teams.js +10 -10
  50. package/dist/web-ui/content/scripts.js +204 -316
  51. package/dist/web-ui/content/styles.css +1 -1
  52. package/dist/web-ui/content/tailwind.css +1 -1
  53. package/dist/web-ui/embedded-assets.d.ts +0 -1
  54. package/dist/web-ui/embedded-assets.js +3 -4
  55. package/dist/web-ui/index.js +3 -3
  56. package/dist/web-ui/provider-identity.d.ts +0 -2
  57. package/dist/web-ui/provider-identity.js +1 -7
  58. package/dist/web-ui/scripts.d.ts +0 -2
  59. package/dist/web-ui/scripts.js +0 -5
  60. package/package.json +1 -1
  61. package/dist/employee-text.d.ts +0 -28
  62. package/dist/employee-text.js +0 -124
  63. package/dist/speech-polisher-employee.d.ts +0 -6
  64. package/dist/speech-polisher-employee.js +0 -23
  65. package/dist/speech-polisher-identity.d.ts +0 -4
  66. package/dist/speech-polisher-identity.js +0 -4
  67. package/dist/speech-polisher-service.d.ts +0 -31
  68. package/dist/speech-polisher-service.js +0 -88
  69. package/dist/speech-support.d.ts +0 -6
  70. package/dist/speech-support.js +0 -26
@@ -1,5 +1,4 @@
1
- import type { EmployeeTextDeps } from "./employee-text.js";
2
- import type { ModelGroup } from "./model-groups.js";
1
+ import { type ModelGroup } from "./model-groups.js";
3
2
  import type { SiliconEmployee } from "./ai-team-types.js";
4
3
  import type { AiCliCandidate, SessionProvider, SessionSnapshot, WandConfig } from "./types.js";
5
4
  export interface SessionAiContext {
@@ -9,10 +8,9 @@ export interface SessionAiContext {
9
8
  inheritEnv?: boolean;
10
9
  /** 内置「系统运维」员工的人设;作为系统提示前缀注入 Wand 自有 AI 调用。 */
11
10
  opsPersona?: string;
12
- /** 员工执行链(按顺序)。为空时只用 provider/model 这一次调用。 */
11
+ /** CLI 降级链(按顺序)。为空时只用 provider/model 这一次调用。 */
13
12
  cliCandidates?: AiCliCandidate[];
14
- employeeText?: EmployeeTextDeps;
15
- /** 系统应用必须经员工渠道;候选为空时禁止退回当前会话/默认 provider。 */
13
+ /** 系统应用必须经员工 CLI 渠道;候选为空时禁止退回当前会话/默认 provider。 */
16
14
  employeeChannelOnly?: boolean;
17
15
  modelGroups?: ModelGroup[];
18
16
  }
@@ -25,4 +23,4 @@ export declare function resolveSessionProvider(snapshot: Pick<SessionSnapshot, "
25
23
  /** Build the provider-specific settings used by session-adjacent AI actions. */
26
24
  export declare function resolveSessionAiContext(snapshot: Pick<SessionSnapshot, "provider" | "structuredState" | "runner" | "command" | "selectedModel" | "thinkingEffort">, config: Pick<WandConfig, "defaultModel" | "defaultCodexModel" | "defaultOpenCodeModel" | "defaultGrokModel" | "defaultQoderModel" | "defaultPiModel" | "defaultThinkingEffort" | "inheritEnv" | "modelGroups">): SessionAiContext;
27
25
  /** Build the source order for Wand-owned AI features such as titles. */
28
- export declare function resolveSystemAiContext(snapshot: Parameters<typeof resolveSessionAiContext>[0], config: Parameters<typeof resolveSessionAiContext>[1] & Pick<WandConfig, "systemAiCli" | "systemAiModel"> & Partial<Pick<WandConfig, "defaultCwd" | "harness">>, systemEmployee?: SiliconEmployee | null, free?: EmployeeTextDeps["free"]): SessionAiContext;
26
+ export declare function resolveSystemAiContext(snapshot: Parameters<typeof resolveSessionAiContext>[0], config: Parameters<typeof resolveSessionAiContext>[1] & Pick<WandConfig, "systemAiCli" | "systemAiModel">, systemEmployee?: SiliconEmployee | null): SessionAiContext;
@@ -1,6 +1,7 @@
1
1
  import { getDefaultModelForProvider } from "./config.js";
2
+ import { resolveModelGroupModels } from "./model-groups.js";
2
3
  import { providerCliInstalled, isSessionProvider } from "./session-provider.js";
3
- import { isSystemSiliconEmployee, systemEmployeeCandidates } from "./system-employee.js";
4
+ import { isSystemSiliconEmployee, systemEmployeeCliCandidates } from "./system-employee.js";
4
5
  import { inferProviderFromCommand, inferProviderFromRunner } from "./session-provider.js";
5
6
  /**
6
7
  * Resolve the provider from every representation used by current and legacy
@@ -34,28 +35,26 @@ export function resolveSessionAiContext(snapshot, config) {
34
35
  };
35
36
  }
36
37
  /** Build the source order for Wand-owned AI features such as titles. */
37
- export function resolveSystemAiContext(snapshot, config, systemEmployee, free) {
38
+ export function resolveSystemAiContext(snapshot, config, systemEmployee) {
38
39
  const sessionContext = resolveSessionAiContext(snapshot, config);
39
40
  // 候选里的「跟随默认模型」在这里就换成具体的 Wand 默认模型:降级到下一个 provider
40
41
  // 时不能拿上一个 provider 的模型,也不能把决定权交给 CLI 自己的默认值。
41
- // Keep the configured chain here; model groups are expanded once at execution.
42
- const chain = systemEmployeeCandidates(systemEmployee).map(candidate => ({
43
- ...candidate,
44
- model: candidate.model ?? normalizeModel(getDefaultModelForProvider(config, candidate.provider)),
45
- }));
42
+ const chain = systemEmployeeCliCandidates(systemEmployee).flatMap((candidate) => resolveModelGroupModels(config.modelGroups, candidate.provider, candidate.model ?? normalizeModel(getDefaultModelForProvider(config, candidate.provider)), {
43
+ preferDefault: !candidate.model || candidate.model === "default",
44
+ })
45
+ .map((model) => ({ ...candidate, model: normalizeModel(model) })));
46
46
  const owned = {
47
47
  ...sessionContext,
48
48
  ...(chain.length ? { cliCandidates: chain } : {}),
49
- ...(chain.some(candidate => candidate.engine === "sdk") ? { employeeText: { config, ...(free ? { free } : {}) } } : {}),
50
49
  ...(systemEmployee ? { employeeChannelOnly: true } : {}),
51
50
  ...(isSystemSiliconEmployee(systemEmployee) ? { opsPersona: systemEmployee.prompt } : {}),
52
51
  };
53
52
  // 内置员工可用时,Wand 自有调用一律按它的候选链:provider/model 取首个已安装的
54
53
  // 候选(两条路都一致),整条链留给运行期降级。
55
54
  if (chain.length) {
56
- const preferred = chain.find((candidate) => candidate.engine === "sdk" || providerCliInstalled(candidate.provider)) ?? chain[0];
55
+ const preferred = chain.find((candidate) => providerCliInstalled(candidate.provider)) ?? chain[0];
57
56
  owned.provider = preferred.provider;
58
- owned.model = preferred.model;
57
+ owned.model = preferred.model ?? normalizeModel(getDefaultModelForProvider(config, preferred.provider));
59
58
  owned.thinkingEffort = preferred.thinkingEffort ?? config.defaultThinkingEffort;
60
59
  }
61
60
  if (chain.length)
@@ -1,11 +1,13 @@
1
1
  import type { SiliconEmployee } from "./ai-team-types.js";
2
2
  import type { WandTaskAgent } from "./task-types.js";
3
+ export interface EmployeeCandidateSelectionOptions {
4
+ /** 普通任务派发只走 CLI;显式员工会话可允许已配置的 SDK。 */
5
+ skipSdk?: boolean;
6
+ }
3
7
  /** Match child-process PATH without starting a shell or trusting a client availability claim. */
4
8
  export declare function employeeCliAvailable(agent: WandTaskAgent, pathValue?: string): boolean;
5
- /** SDK runs in-process; its availability is decided by the harness, not by a CLI executable. */
6
- export declare function employeeCandidateAvailable(agent: WandTaskAgent): boolean;
7
- /** First available candidate wins; when none is available retain the preferred candidate for a recoverable failure. */
8
- export declare function selectEmployeeCandidate(employee: Pick<SiliconEmployee, "agents">, available?: (agent: WandTaskAgent) => boolean): {
9
+ /** First installed candidate wins; when none is installed retain the preferred candidate for a recoverable failure. */
10
+ export declare function selectEmployeeCandidate(employee: Pick<SiliconEmployee, "agents">, available?: (agent: WandTaskAgent) => boolean, options?: EmployeeCandidateSelectionOptions): {
9
11
  agent: WandTaskAgent;
10
12
  index: number;
11
13
  };
@@ -4,17 +4,14 @@ import { isLocalDecisionModel } from "./decision-expert-identity.js";
4
4
  export function employeeCliAvailable(agent, pathValue = process.env.PATH ?? "") {
5
5
  return providerCliInstalled(agent.provider, pathValue);
6
6
  }
7
- /** SDK runs in-process; its availability is decided by the harness, not by a CLI executable. */
8
- export function employeeCandidateAvailable(agent) {
9
- return agent.engine === "sdk" || employeeCliAvailable(agent);
10
- }
11
- /** First available candidate wins; when none is available retain the preferred candidate for a recoverable failure. */
12
- export function selectEmployeeCandidate(employee, available = employeeCandidateAvailable) {
7
+ /** First installed candidate wins; when none is installed retain the preferred candidate for a recoverable failure. */
8
+ export function selectEmployeeCandidate(employee, available = employeeCliAvailable, options = {}) {
13
9
  // LAYA is invoked only by the bounded decision evaluator; never pass its selector to a chat CLI/harness.
14
- const candidates = employee.agents.filter((agent) => !isLocalDecisionModel(agent.model));
10
+ const generative = employee.agents.filter((agent) => !isLocalDecisionModel(agent.model));
11
+ const candidates = options.skipSdk ? generative.filter((agent) => agent.engine !== "sdk") : generative;
15
12
  if (!candidates.length)
16
- throw new Error("LAYA 仅支持有界决策,员工没有可用的对话候选;请配置备用调用链。");
17
- if (candidates.some((agent) => agent.kind !== "structured")) {
13
+ throw new Error("LAYA 仅支持有界决策,或员工没有可用 CLI 候选;请配置「决策专家」备用调用链。");
14
+ if (!candidates.length || candidates.some((agent) => agent.kind !== "structured")) {
18
15
  throw new Error("硅基员工没有可用的结构化执行候选。");
19
16
  }
20
17
  const index = candidates.findIndex((agent) => available(agent));
@@ -36,15 +36,13 @@ export declare class SpeechService {
36
36
  private disposed;
37
37
  private maintenance;
38
38
  private readonly initialized;
39
- private configurationRevision;
40
39
  constructor(storage: Pick<WandStorage, "getPreference" | "setPreference">, configDir: string, options?: SpeechServiceOptions);
41
40
  settings(): SpeechSettings;
42
41
  configure(patch: unknown): SpeechSettings;
43
- settingsRevision(): number;
44
42
  acquireMaintenance(): void;
45
43
  releaseMaintenance(): void;
46
44
  /** Explicit admin health check loads the selected model using synthetic silence, without enabling it. */
47
- initializeModel(id: string, signal: AbortSignal, acceleration?: import("./speech-types.js").SpeechAcceleration): Promise<void>;
45
+ initializeModel(id: string, signal: AbortSignal): Promise<void>;
48
46
  private modelPath;
49
47
  private modelReady;
50
48
  private verifyModel;
@@ -72,7 +72,6 @@ export class SpeechService {
72
72
  disposed = false;
73
73
  maintenance = false;
74
74
  initialized = new Set();
75
- configurationRevision = 0;
76
75
  constructor(storage, configDir, options = {}) {
77
76
  this.storage = storage;
78
77
  this.options = options;
@@ -90,10 +89,8 @@ export class SpeechService {
90
89
  configure(patch) {
91
90
  const settings = parseSpeechSettings(patch, this.settings());
92
91
  this.storage.setPreference(SPEECH_SETTINGS_KEY, settings);
93
- this.configurationRevision += 1;
94
92
  return settings;
95
93
  }
96
- settingsRevision() { return this.configurationRevision; }
97
94
  acquireMaintenance() {
98
95
  if (this.disposed)
99
96
  throw new SpeechError("UNAVAILABLE", "语音服务已关闭。", 503);
@@ -103,7 +100,7 @@ export class SpeechService {
103
100
  }
104
101
  releaseMaintenance() { this.maintenance = false; }
105
102
  /** Explicit admin health check loads the selected model using synthetic silence, without enabling it. */
106
- async initializeModel(id, signal, acceleration = this.settings().acceleration) {
103
+ async initializeModel(id, signal) {
107
104
  const model = this.models.find((value) => value.id === id);
108
105
  if (!model)
109
106
  throw new SpeechError("INVALID_MODEL", "模型不存在。");
@@ -129,16 +126,8 @@ export class SpeechService {
129
126
  wav.writeUInt32LE(8000, 40);
130
127
  const input = path.join(directory, "check.wav"), output = path.join(directory, "check");
131
128
  await writeFile(input, wav, { mode: 0o600 });
132
- const args = ["-m", this.modelPath(model), "-f", input, "-of", output, "-otxt", "-nt", "-l", "en", "-t", String(this.settings().threads)];
133
- const cpu = acceleration === "cpu" || runtime.backend === "cpu";
134
- try {
135
- await this.run(runtime.executable, [...args, ...(cpu ? ["-ng"] : [])], directory, signal, this.options.timeoutMs ?? 120_000);
136
- }
137
- catch (error) {
138
- if (acceleration !== "auto" || cpu || signal.aborted || !(error instanceof SpeechError) || error.code !== "ENGINE_FAILED")
139
- throw error;
140
- await this.run(runtime.executable, [...args, "-ng"], directory, signal, this.options.timeoutMs ?? 120_000);
141
- }
129
+ await this.run(runtime.executable, ["-m", this.modelPath(model), "-f", input, "-of", output, "-otxt", "-nt", "-l", "en", "-t", String(this.settings().threads),
130
+ ...(this.settings().acceleration === "cpu" || runtime.backend === "cpu" ? ["-ng"] : [])], directory, signal, this.options.timeoutMs ?? 120_000);
142
131
  signal.throwIfAborted();
143
132
  if (this.disposed)
144
133
  throw new SpeechError("UNAVAILABLE", "语音服务已关闭。", 503);
@@ -41,11 +41,6 @@ export interface SpeechResult {
41
41
  text: string;
42
42
  model: string;
43
43
  backend: SpeechBackend;
44
- originalText?: string;
45
- optimized?: boolean;
46
- optimizationError?: string;
47
- employeeId?: string;
48
- candidate?: number;
49
44
  }
50
45
  export declare const SPEECH_SAMPLE_RATE = 16000;
51
46
  export declare const SPEECH_MAX_SECONDS = 60;
package/dist/storage.d.ts CHANGED
@@ -398,8 +398,6 @@ export declare class WandStorage {
398
398
  ensureSystemSiliconEmployee(seed?: SystemEmployeeSeed): SiliconEmployee;
399
399
  /** Stable built-in decision employee; seed once and retain the user's ordered call chain. */
400
400
  ensureDecisionExpertEmployee(): SiliconEmployee;
401
- /** Seed the SDK free group once, then preserve independent user choices. */
402
- ensureSpeechPolisherEmployee(): SiliconEmployee;
403
401
  saveSiliconEmployee(employee: SiliconEmployee): void;
404
402
  archiveSiliconEmployee(id: string, archivedAt?: string): void;
405
403
  unarchiveSiliconEmployee(id: string): void;
package/dist/storage.js CHANGED
@@ -20,8 +20,6 @@ import { isThinkingEffort } from "./structured-provider-common.js";
20
20
  import { DEFAULT_EMPLOYEE_KEY } from "./ai-team-types.js";
21
21
  import { defaultEmployeeDefinition, legacyPtyRoleIdentity } from "./default-employee.js";
22
22
  import { DECISION_EXPERT_KEY } from "./decision-expert-identity.js";
23
- import { SPEECH_POLISHER_KEY } from "./speech-polisher-identity.js";
24
- import { speechPolisherDefinition } from "./speech-polisher-employee.js";
25
23
  import { decisionExpertDefinition } from "./decision-expert-employee.js";
26
24
  import { normalizeEmployeeKnowledge } from "./employee-knowledge-content.js";
27
25
  import { EMPLOYEE_KNOWLEDGE_MAX_ENTRIES } from "./employee-knowledge-types.js";
@@ -324,11 +322,7 @@ function parseQueuedMessages(raw) {
324
322
  function parseWorktreeInfo(raw) {
325
323
  const parsed = safeJsonParse(raw);
326
324
  if (parsed && typeof parsed.branch === "string" && typeof parsed.path === "string") {
327
- return {
328
- branch: parsed.branch, path: parsed.path,
329
- ...(typeof parsed.baseRef === "string" ? { baseRef: parsed.baseRef } : {}),
330
- ...(typeof parsed.repoRoot === "string" ? { repoRoot: parsed.repoRoot } : {}),
331
- };
325
+ return { branch: parsed.branch, path: parsed.path };
332
326
  }
333
327
  return undefined;
334
328
  }
@@ -2779,17 +2773,6 @@ export class WandStorage {
2779
2773
  }
2780
2774
  return existing;
2781
2775
  }
2782
- /** Seed the SDK free group once, then preserve independent user choices. */
2783
- ensureSpeechPolisherEmployee() {
2784
- const existing = this.getSystemSiliconEmployee(SPEECH_POLISHER_KEY);
2785
- const definition = speechPolisherDefinition(new Date().toISOString(), existing);
2786
- if (!existing || existing.name !== definition.name || existing.duty !== definition.duty || existing.prompt !== definition.prompt
2787
- || existing.avatar !== definition.avatar || existing.archivedAt || !existing.agents.length) {
2788
- this.saveSiliconEmployee(definition);
2789
- return definition;
2790
- }
2791
- return existing;
2792
- }
2793
2776
  saveSiliconEmployee(employee) {
2794
2777
  const tags = isBuiltinSiliconEmployee(employee)
2795
2778
  ? siliconEmployeeTags(employee)
@@ -86,7 +86,6 @@ export declare class StructuredSessionManager {
86
86
  private readonly logger;
87
87
  private readonly execHost?;
88
88
  private readonly decisionRuntime;
89
- private readonly openRouter?;
90
89
  /** 「智能分配」专用的本地决策入口:只有真正能跑时才注入,没注入则用系统员工回退。 */
91
90
  private readonly autoAssignEvaluate;
92
91
  private readonly sessions;
@@ -141,7 +140,7 @@ export declare class StructuredSessionManager {
141
140
  private detachedRecoveryRetryTimer;
142
141
  private detachedRecoveryFailureLogged;
143
142
  private disposed;
144
- constructor(storage: WandStorage, config: WandConfig, logger?: SessionLogger | null, runners?: StructuredSessionManagerRunners, execHost?: StructuredExecHost | undefined, decisionRuntime?: () => DecisionRuntimeAccess | null, openRouter?: OpenRouterFreeModelsService | undefined,
143
+ constructor(storage: WandStorage, config: WandConfig, logger?: SessionLogger | null, runners?: StructuredSessionManagerRunners, execHost?: StructuredExecHost | undefined, decisionRuntime?: () => DecisionRuntimeAccess | null, openRouter?: OpenRouterFreeModelsService,
145
144
  /** 「智能分配」专用的本地决策入口:只有真正能跑时才注入,没注入则用系统员工回退。 */
146
145
  autoAssignEvaluate?: () => DecisionRuntimeAccess["evaluate"]);
147
146
  private archiveExpiredSessions;
@@ -174,7 +173,7 @@ export declare class StructuredSessionManager {
174
173
  get(id: string): SessionSnapshot | null;
175
174
  setSessionWorkspace(id: string, membership: Pick<SessionSnapshot, "workspaceId" | "workspaceTaskId">): void;
176
175
  setSessionTopic(id: string, title: string, description: string): SessionSnapshot;
177
- /** 归档只写标记,正在执行的回合和历史继续保留。 */
176
+ /** 归档会先停掉还在跑的回合,会话 ID 和 provider session id 都留着。 */
178
177
  setSessionArchived(id: string, archived: boolean): SessionSnapshot;
179
178
  private setSessionTopicGenerating;
180
179
  /**
@@ -10,7 +10,6 @@ import { stampNewToolUseTimes } from "./tool-use-timestamps.js";
10
10
  import { buildChildEnv } from "./env-utils.js";
11
11
  import { getErrorMessage } from "./error-utils.js";
12
12
  import { getDefaultModelForProvider } from "./config.js";
13
- import { isLocalDecisionModel } from "./decision-expert-identity.js";
14
13
  import { recordIterationPrompt } from "./iteration-log.js";
15
14
  import { startEmployeeKnowledgeRunner } from "./employee-knowledge.js";
16
15
  import { CoreRunner } from "./core-runner.js";
@@ -437,7 +436,6 @@ export class StructuredSessionManager {
437
436
  logger;
438
437
  execHost;
439
438
  decisionRuntime;
440
- openRouter;
441
439
  autoAssignEvaluate;
442
440
  sessions = new Map();
443
441
  // Both freshly started runners and adopted daemon runs own the same input gate.
@@ -502,7 +500,6 @@ export class StructuredSessionManager {
502
500
  this.logger = logger;
503
501
  this.execHost = execHost;
504
502
  this.decisionRuntime = decisionRuntime;
505
- this.openRouter = openRouter;
506
503
  this.autoAssignEvaluate = autoAssignEvaluate;
507
504
  const wrap = (runner) => withModelGroups(withDecisionAccess(runner, storage, decisionRuntime), config);
508
505
  this.claudeCliRunner = wrap(runners.claudeCli ?? new ClaudeCliRunner({ language: () => this.config.language }, this.execHost));
@@ -1241,9 +1238,11 @@ export class StructuredSessionManager {
1241
1238
  this.emitStructuredSnapshot(updated);
1242
1239
  return updated;
1243
1240
  }
1244
- /** 归档只写标记,正在执行的回合和历史继续保留。 */
1241
+ /** 归档会先停掉还在跑的回合,会话 ID 和 provider session id 都留着。 */
1245
1242
  setSessionArchived(id, archived) {
1246
- const current = this.requireSession(id);
1243
+ const current = archived && this.requireSession(id).status === "running"
1244
+ ? this.stop(id)
1245
+ : this.requireSession(id);
1247
1246
  const archivedAt = archived ? new Date().toISOString() : null;
1248
1247
  const updated = { ...current, archived, archivedAt };
1249
1248
  this.sessions.set(id, updated);
@@ -1310,7 +1309,7 @@ export class StructuredSessionManager {
1310
1309
  input,
1311
1310
  cwd: session.cwd,
1312
1311
  language: this.config.language,
1313
- ai: resolveSystemAiContext(session, this.config, this.storage.getSystemSiliconEmployee(), this.openRouter),
1312
+ ai: resolveSystemAiContext(session, this.config, this.storage.getSystemSiliconEmployee()),
1314
1313
  readNativeTitle: () => readNativeSessionTitle(resolveSessionProvider(session), session.claudeSessionId, session.cwd),
1315
1314
  hasNativeTitle,
1316
1315
  onGenerating: (generating) => {
@@ -1500,10 +1499,7 @@ export class StructuredSessionManager {
1500
1499
  return null;
1501
1500
  const candidates = original.employeeCandidates ?? [];
1502
1501
  const index = original.employeeCandidateIndex ?? 0;
1503
- let nextIndex = index + 1;
1504
- // LAYA has no chat adapter; keep original candidate indices while skipping bounded-only models.
1505
- while (nextIndex < candidates.length && isLocalDecisionModel(candidates[nextIndex].model))
1506
- nextIndex += 1;
1502
+ const nextIndex = index + 1;
1507
1503
  if (!original.employeeId || (original.messages?.length ?? 0) !== 0 || original.claudeSessionId
1508
1504
  || !error.failure.retryable || nextIndex >= candidates.length)
1509
1505
  return null;
@@ -1692,7 +1688,7 @@ export class StructuredSessionManager {
1692
1688
  prompt,
1693
1689
  groups: this.config.modelGroups,
1694
1690
  evaluate: this.autoAssignEvaluate(),
1695
- ai: resolveSystemAiContext(session, this.config, this.storage.getSystemSiliconEmployee(), this.openRouter),
1691
+ ai: resolveSystemAiContext(session, this.config, this.storage.getSystemSiliconEmployee()),
1696
1692
  cwd: session.cwd,
1697
1693
  language: this.config.language,
1698
1694
  });
@@ -6,8 +6,8 @@ export { SYSTEM_EMPLOYEE_ID, SYSTEM_EMPLOYEE_KEY, SYSTEM_EMPLOYEE_NAME, SYSTEM_E
6
6
  * 内置的「系统运维」员工。
7
7
  *
8
8
  * Wand 自己的 AI 调用(commit message / tag、提示词优化、会话与任务标题、
9
- * 员工起草)都通过这位员工的候选链执行:名字、职责与人设写死在代码里,不可编辑、不可归档、
10
- * 不可删除;只有执行候选(工具 + 引擎 + 模型 + 思考深度,按顺序降级)由用户维护。
9
+ * 员工起草)都通过这位员工的 CLI 候选链执行:名字、职责与人设写死在代码里,不可编辑、不可归档、
10
+ * 不可删除;只有执行候选(CLI 工具 + 模型 + 思考深度,按顺序降级)由用户维护。候选中的 SDK 会被系统应用跳过。
11
11
  */
12
12
  export declare const SYSTEM_EMPLOYEE_DUTY = "Wand \u7CFB\u7EDF\u8FD0\u7EF4\uFF1A\u670D\u52A1\u4E0E CLI \u7EBF\u8DEF\u3001\u66F4\u65B0\u5206\u53D1\u3001\u4ED3\u5E93\u4E0E\u4F1A\u8BDD\u64CD\u4F5C\uFF0CWand \u81EA\u6709 AI \u4EFB\u52A1\u7684\u6267\u884C\u8005\u3002";
13
13
  /**
@@ -29,8 +29,6 @@ export declare function systemEmployeeSeedAgents(seed?: SystemEmployeeSeed): Wan
29
29
  export declare function systemEmployeeDefinition(agents: WandTaskAgent[], now: string, existing?: SiliconEmployee | null): SiliconEmployee;
30
30
  export declare function isSdkEmployeeAgent(agent: Pick<WandTaskAgent, "engine">): boolean;
31
31
  /**
32
- * 系统应用沿用员工配置顺序和引擎;不按触发来源过滤工具。
32
+ * 系统应用只走员工的 CLI 渠道:员工候选里可以保存 SDK,但这里明确跳过。
33
33
  */
34
- export declare function systemEmployeeCandidates(employee: Pick<SiliconEmployee, "agents"> | null | undefined): AiCliCandidate[];
35
- /** Compatibility name for existing callers; the chain also includes Wand Agent. */
36
- export declare const systemEmployeeCliCandidates: typeof systemEmployeeCandidates;
34
+ export declare function systemEmployeeCliCandidates(employee: Pick<SiliconEmployee, "agents"> | null | undefined): AiCliCandidate[];
@@ -7,8 +7,8 @@ export { SYSTEM_EMPLOYEE_ID, SYSTEM_EMPLOYEE_KEY, SYSTEM_EMPLOYEE_NAME, SYSTEM_E
7
7
  * 内置的「系统运维」员工。
8
8
  *
9
9
  * Wand 自己的 AI 调用(commit message / tag、提示词优化、会话与任务标题、
10
- * 员工起草)都通过这位员工的候选链执行:名字、职责与人设写死在代码里,不可编辑、不可归档、
11
- * 不可删除;只有执行候选(工具 + 引擎 + 模型 + 思考深度,按顺序降级)由用户维护。
10
+ * 员工起草)都通过这位员工的 CLI 候选链执行:名字、职责与人设写死在代码里,不可编辑、不可归档、
11
+ * 不可删除;只有执行候选(CLI 工具 + 模型 + 思考深度,按顺序降级)由用户维护。候选中的 SDK 会被系统应用跳过。
12
12
  */
13
13
  export const SYSTEM_EMPLOYEE_DUTY = "Wand 系统运维:服务与 CLI 线路、更新分发、仓库与会话操作,Wand 自有 AI 任务的执行者。";
14
14
  /**
@@ -61,22 +61,19 @@ export function isSdkEmployeeAgent(agent) {
61
61
  return agent.engine === "sdk";
62
62
  }
63
63
  /**
64
- * 系统应用沿用员工配置顺序和引擎;不按触发来源过滤工具。
64
+ * 系统应用只走员工的 CLI 渠道:员工候选里可以保存 SDK,但这里明确跳过。
65
65
  */
66
- export function systemEmployeeCandidates(employee) {
66
+ export function systemEmployeeCliCandidates(employee) {
67
67
  if (!employee)
68
68
  return [];
69
69
  return employee.agents
70
- .filter((agent) => agent.kind === "structured")
70
+ .filter((agent) => agent.kind === "structured" && !isSdkEmployeeAgent(agent))
71
71
  .map((agent) => {
72
72
  const model = (agent.model ?? "").trim();
73
73
  return {
74
74
  provider: agent.provider,
75
- ...(agent.engine ? { engine: agent.engine } : {}),
76
75
  model: !model || model === "default" ? undefined : model,
77
76
  thinkingEffort: agent.thinkingEffort,
78
77
  };
79
78
  });
80
79
  }
81
- /** Compatibility name for existing callers; the chain also includes Wand Agent. */
82
- export const systemEmployeeCliCandidates = systemEmployeeCandidates;
package/dist/types.d.ts CHANGED
@@ -226,13 +226,11 @@ export interface AiTextRequest {
226
226
  prompt: string;
227
227
  }
228
228
  /**
229
- * Wand 自有 AI 调用(commit message、标题、提示词优化…)的一条执行候选。
229
+ * Wand 自有 AI 调用(commit message、标题、提示词优化…)的一条 CLI 执行候选。
230
230
  * 候选顺序即降级顺序;由内置「系统运维」员工维护。
231
231
  */
232
232
  export interface AiCliCandidate {
233
233
  provider: SessionProvider;
234
- /** 缺省为 CLI;显式 sdk 保持 Wand Agent 引擎身份。 */
235
- engine?: "cli" | "sdk";
236
234
  /** 具体模型 ID;未设置表示跟随 provider 默认模型。 */
237
235
  model?: string;
238
236
  thinkingEffort?: ThinkingEffort;
@@ -1,4 +1,3 @@
1
- import type { EmployeeTextDeps } from "./employee-text.js";
2
1
  import type { WandStorage } from "./storage.js";
3
2
  import type { WandConfig } from "./types.js";
4
3
  import { type UserMemoryEvent, type UserMemoryPreference, type UserMemoryView } from "./user-memory-types.js";
@@ -19,7 +18,6 @@ export declare class UserMemoryService {
19
18
  constructor(deps: {
20
19
  storage: WandStorage;
21
20
  config: WandConfig;
22
- free?: EmployeeTextDeps["free"];
23
21
  notifyChanged?: (id: string) => void;
24
22
  now?: () => number;
25
23
  generate?: (events: UserMemoryEvent[]) => Promise<UserMemoryPreference[]>;
@@ -160,7 +160,7 @@ export class UserMemoryService {
160
160
  }, config.defaultCwd, config.language ?? "", resolveSystemAiContext({
161
161
  provider: config.defaultProvider ?? "claude", command: config.defaultProvider ?? "claude",
162
162
  selectedModel: null, thinkingEffort: config.defaultThinkingEffort,
163
- }, config, storage.getSystemSiliconEmployee(), this.deps.free), (raw) => parseUserMemoryPreferences(raw, events));
163
+ }, config, storage.getSystemSiliconEmployee()), (raw) => parseUserMemoryPreferences(raw, events));
164
164
  // Test seam and production share the exact same validator.
165
165
  const validated = parseUserMemoryPreferences(JSON.stringify({ preferences }), events);
166
166
  const referenced = new Set(validated.flatMap((entry) => entry.evidenceIds));