@co0ontty/wand 2.8.0 → 2.9.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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "commit": "18413d7915a788ea6eb7460e0819c2df102a17d2",
3
- "builtAt": "2026-07-11T13:15:01.244Z",
4
- "version": "2.8.0",
2
+ "commit": "c465983c0a953654202c2ac3eaabe107afe887e6",
3
+ "builtAt": "2026-07-11T13:37:10.237Z",
4
+ "version": "2.9.0",
5
5
  "channel": "stable"
6
6
  }
package/dist/config.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { WandStorage } from "./storage.js";
7
7
  * 升级路径:老 JSON 里仍存有这些字段时,首次启动会被搬到 DB(见 migrateLegacyPreferencesToDb),
8
8
  * 然后下一次 saveConfig 写回 JSON 时它们会被剥离(见 stripPreferenceFields)。
9
9
  */
10
- export declare const PREFERENCE_KEYS: readonly ["defaultMode", "defaultCwd", "defaultModel", "defaultCodexModel", "commitCli", "commitModel", "defaultThinkingEffort", "structuredRunner", "language", "cardDefaults", "inheritEnv"];
10
+ export declare const PREFERENCE_KEYS: readonly ["defaultProvider", "defaultSessionKind", "defaultMode", "defaultCwd", "defaultModel", "defaultCodexModel", "commitCli", "commitModel", "defaultThinkingEffort", "structuredRunner", "language", "cardDefaults", "inheritEnv"];
11
11
  export type PreferenceKey = (typeof PREFERENCE_KEYS)[number];
12
12
  export declare function isPreferenceKey(key: string): key is PreferenceKey;
13
13
  export declare const defaultConfig: () => WandConfig;
package/dist/config.js CHANGED
@@ -21,6 +21,8 @@ const DEFAULT_CONFIG_FILE = "config.json";
21
21
  * 然后下一次 saveConfig 写回 JSON 时它们会被剥离(见 stripPreferenceFields)。
22
22
  */
23
23
  export const PREFERENCE_KEYS = [
24
+ "defaultProvider",
25
+ "defaultSessionKind",
24
26
  "defaultMode",
25
27
  "defaultCwd",
26
28
  "defaultModel",
@@ -45,6 +47,8 @@ export const defaultConfig = () => ({
45
47
  port: 8443,
46
48
  https: false,
47
49
  password: "change-me",
50
+ defaultProvider: "claude",
51
+ defaultSessionKind: "structured",
48
52
  // 非 root 启动时才有资格用 Claude 的 permission-bypass(root 会被 Claude CLI 拒绝),
49
53
  // 所以这种环境下把默认执行模式抬到「托管」——开箱即得自动确认权限的全自主体验。
50
54
  // root 启动则保守回落到「default」(托管在 root 下也只能降级成 acceptEdits)。
@@ -248,6 +252,16 @@ export function migrateLegacyPreferencesToDb(rawJsonInput, storage) {
248
252
  */
249
253
  export function applyStoragePreferences(config, storage) {
250
254
  const defaults = defaultConfig();
255
+ if (storage.hasPreference(preferenceStorageKey("defaultProvider"))) {
256
+ const v = storage.getPreference(preferenceStorageKey("defaultProvider"), defaults.defaultProvider ?? "claude");
257
+ if (v === "claude" || v === "codex")
258
+ config.defaultProvider = v;
259
+ }
260
+ if (storage.hasPreference(preferenceStorageKey("defaultSessionKind"))) {
261
+ const v = storage.getPreference(preferenceStorageKey("defaultSessionKind"), defaults.defaultSessionKind ?? "structured");
262
+ if (v === "pty" || v === "structured")
263
+ config.defaultSessionKind = v;
264
+ }
251
265
  if (storage.hasPreference(preferenceStorageKey("defaultMode"))) {
252
266
  const v = storage.getPreference(preferenceStorageKey("defaultMode"), defaults.defaultMode);
253
267
  if (isExecutionMode(v))
@@ -307,6 +321,20 @@ export function applyStoragePreferences(config, storage) {
307
321
  export function writePreferenceToStorage(config, storage, key, value) {
308
322
  const dbKey = preferenceStorageKey(key);
309
323
  switch (key) {
324
+ case "defaultProvider": {
325
+ if (value !== "claude" && value !== "codex")
326
+ throw new Error(`无效 Provider: ${value}`);
327
+ storage.setPreference(dbKey, value);
328
+ config.defaultProvider = value;
329
+ break;
330
+ }
331
+ case "defaultSessionKind": {
332
+ if (value !== "pty" && value !== "structured")
333
+ throw new Error(`无效会话类型: ${value}`);
334
+ storage.setPreference(dbKey, value);
335
+ config.defaultSessionKind = value;
336
+ break;
337
+ }
310
338
  case "defaultMode": {
311
339
  if (!isExecutionMode(value))
312
340
  throw new Error(`无效执行模式: ${value}`);
@@ -513,6 +541,8 @@ function mergeWithDefaults(input) {
513
541
  android: normalizeAndroidApkConfig(input.android) ?? defaults.android,
514
542
  macos: normalizeMacosDmgConfig(input.macos) ?? defaults.macos,
515
543
  cardDefaults: normalizeCardDefaults(input.cardDefaults),
544
+ defaultProvider: input.defaultProvider === "codex" ? "codex" : "claude",
545
+ defaultSessionKind: input.defaultSessionKind === "pty" ? "pty" : "structured",
516
546
  defaultModel: typeof input.defaultModel === "string" ? input.defaultModel.trim() : defaults.defaultModel,
517
547
  defaultCodexModel: typeof input.defaultCodexModel === "string" ? input.defaultCodexModel.trim() : defaults.defaultCodexModel,
518
548
  commitCli: input.commitCli === "codex" ? "codex" : "claude",
package/dist/server.js CHANGED
@@ -1352,6 +1352,8 @@ export async function startServer(config, configPath) {
1352
1352
  res.json({
1353
1353
  host: config.host,
1354
1354
  port: config.port,
1355
+ defaultProvider: config.defaultProvider ?? "claude",
1356
+ defaultSessionKind: config.defaultSessionKind ?? "structured",
1355
1357
  defaultMode: config.defaultMode,
1356
1358
  defaultCwd: config.defaultCwd,
1357
1359
  defaultModel: defaultModels.claude,
package/dist/types.d.ts CHANGED
@@ -83,6 +83,10 @@ export interface WandConfig {
83
83
  keyPath?: string;
84
84
  };
85
85
  password: string;
86
+ /** 新建会话时默认使用的 Provider。 */
87
+ defaultProvider?: SessionProvider;
88
+ /** 新建会话时默认使用的承载类型。 */
89
+ defaultSessionKind?: SessionKind;
86
90
  defaultMode: ExecutionMode;
87
91
  shell: string;
88
92
  defaultCwd: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@co0ontty/wand",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "A web terminal for local CLI tools like Claude.",
5
5
  "type": "module",
6
6
  "bin": {