@khorsheed/dsh-local-agent-claude-code 0.2.0 → 0.2.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/CHANGELOG.md +8 -0
- package/README.en.md +1 -1
- package/README.i18n.yaml +2 -2
- package/README.md +1 -1
- package/lib/client.js +157 -72
- package/lib/index.js +3 -2
- package/lib/types/client/SettingsCard.js +11 -3
- package/lib/types/client/index.js +2 -2
- package/lib/types/index.js +4 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
# 变更记录
|
|
2
|
+
## 0.2.1(2026-10-27)
|
|
3
|
+
|
|
4
|
+
- **修复几个模式套件一起装时设置存不上**:卡片上的开关和设置改存在本 harness 自己的目录里,不再写进配置文件;原来配好的值照常生效。
|
|
5
|
+
- **保存失败就说保存失败**:设置被拒时显示「保存失败」,不再假装「已保存」。
|
|
6
|
+
- **常驻模式(live)默认打开**:遇到问题可以在卡片上关掉,改回每次新起一个。
|
|
7
|
+
- **端点表单跟着登录、登出刷新**:登出后不再显示「API Key 已配置」,验证端点也不再报找不到凭据。
|
|
8
|
+
- **读不到登录状态时直说**:显示「读取登录状态失败」。
|
|
9
|
+
|
|
2
10
|
## 0.2.0(2026-10-26)
|
|
3
11
|
|
|
4
12
|
rc.3 之后到正式版的变化:
|
package/README.en.md
CHANGED
|
@@ -16,7 +16,7 @@ Getting Claude Code to help used to mean opening a terminal, pasting things in,
|
|
|
16
16
|
- **Keep talking, no cold start**: have the agent follow up, or open the sub-session and message it yourself; it's the same Claude Code session.
|
|
17
17
|
- **Paste a key and go**: enter the endpoint and API key (or Auth Token) on the settings card, press "Save credential", then "Verify endpoint & fetch models" to check it connects.
|
|
18
18
|
- **Pick your models**: under "Available models", tick and drag to reorder; the top one is the default. You can also switch model and reasoning effort inside a sub-session.
|
|
19
|
-
- **Resident mode is faster**:
|
|
19
|
+
- **Resident mode is faster**: "Resident mode (live)" is on by default and the Claude Code process stays up; stopping doesn't kill it, and after a crash it resumes the same session.
|
|
20
20
|
|
|
21
21
|
## Install
|
|
22
22
|
|
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# last confirmed-consistent state. Both languages carry equal authority; after
|
|
3
3
|
# editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/local-agent-claude-code/README.en.md
|
|
5
|
-
packages/local-agent-claude-code/README.en.md:
|
|
6
|
-
packages/local-agent-claude-code/README.md:
|
|
5
|
+
packages/local-agent-claude-code/README.en.md: 37ed09d088c95c8fc6e3fcd0849de51db10ad823
|
|
6
|
+
packages/local-agent-claude-code/README.md: 720e3e5345e6b48d00f033f0a818779cfe74c563
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- **接着聊,不冷启动**:让 agent 追问,或者打开子会话直接发消息,继续的是同一个 Claude Code 会话。
|
|
17
17
|
- **填好 key 就能用**:在设置卡片里填端点地址和 API Key(或 Auth Token),点「保存凭据」,再点「验证端点并获取模型」确认能连上。
|
|
18
18
|
- **自己挑模型**:在「可用模型」里勾选、拖动排序,排第一的就是默认模型;子会话里也能临时换模型和推理强度。
|
|
19
|
-
-
|
|
19
|
+
- **常驻模式更快**:「常驻模式(live)」默认开着,Claude Code 进程常驻,停下不杀进程,崩溃后自动续上原来的会话。
|
|
20
20
|
|
|
21
21
|
## 安装
|
|
22
22
|
|
package/lib/client.js
CHANGED
|
@@ -93,6 +93,83 @@ window.__ModuleLoader__.load({
|
|
|
93
93
|
});
|
|
94
94
|
return channel;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Bind a settings card to the harness's own card-settings store (card-settings.ts
|
|
98
|
+
* on the host) layered over the row's host settings form: reads are the
|
|
99
|
+
* form's value with the stored overrides on top; writes go to the store only,
|
|
100
|
+
* never the profile patch — so they cannot be refused when several suites
|
|
101
|
+
* insert the same row. A host without the store keeps the plain row scope.
|
|
102
|
+
* @param ctx - the provider's client context.
|
|
103
|
+
* @param harness - the harness name (`dsh`, `kimi`, …).
|
|
104
|
+
* @param entryId - the plugin row id the base values come from.
|
|
105
|
+
* @returns the bound scope.
|
|
106
|
+
*/
|
|
107
|
+
function bindCardSettingsScope(ctx, harness, entryId) {
|
|
108
|
+
const row = bindSettingsScope(ctx, entryId);
|
|
109
|
+
const gateway = () => {
|
|
110
|
+
const remote = ctx.get("remote.localAgentGateway");
|
|
111
|
+
return typeof remote?.cardSettings === "function" && typeof remote.setCardSettings === "function" ? remote : void 0;
|
|
112
|
+
};
|
|
113
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
114
|
+
let stored;
|
|
115
|
+
let cached;
|
|
116
|
+
const emit = () => {
|
|
117
|
+
for (const listener of [...listeners]) listener();
|
|
118
|
+
};
|
|
119
|
+
const load = () => {
|
|
120
|
+
gateway()?.cardSettings(harness).then((result) => {
|
|
121
|
+
if (!result.ok || result.value === void 0) return;
|
|
122
|
+
stored = result.value;
|
|
123
|
+
emit();
|
|
124
|
+
}).catch(() => {});
|
|
125
|
+
};
|
|
126
|
+
const write = async (patch) => {
|
|
127
|
+
const remote = gateway();
|
|
128
|
+
if (remote === void 0) return false;
|
|
129
|
+
try {
|
|
130
|
+
const result = await remote.setCardSettings(harness, patch);
|
|
131
|
+
if (!result.ok || result.value === void 0) return false;
|
|
132
|
+
stored = result.value;
|
|
133
|
+
emit();
|
|
134
|
+
return true;
|
|
135
|
+
} catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return {
|
|
140
|
+
getSnapshot: () => {
|
|
141
|
+
const rowSnapshot = row.getSnapshot();
|
|
142
|
+
if (cached !== void 0 && cached.rowSnapshot === rowSnapshot && cached.stored === stored) return cached.snapshot;
|
|
143
|
+
const overrides = stored ?? {};
|
|
144
|
+
const snapshot = gateway() === void 0 ? rowSnapshot : {
|
|
145
|
+
...rowSnapshot,
|
|
146
|
+
value: rowSnapshot.value === void 0 && stored === void 0 ? void 0 : {
|
|
147
|
+
...rowSnapshot.value,
|
|
148
|
+
...overrides
|
|
149
|
+
},
|
|
150
|
+
writable: true,
|
|
151
|
+
status: rowSnapshot.status === "loading" && stored !== void 0 ? "ready" : rowSnapshot.status === "unavailable" && stored !== void 0 ? "ready" : rowSnapshot.status
|
|
152
|
+
};
|
|
153
|
+
cached = {
|
|
154
|
+
rowSnapshot,
|
|
155
|
+
stored,
|
|
156
|
+
snapshot
|
|
157
|
+
};
|
|
158
|
+
return snapshot;
|
|
159
|
+
},
|
|
160
|
+
subscribe: (listener) => {
|
|
161
|
+
if (listeners.size === 0) load();
|
|
162
|
+
listeners.add(listener);
|
|
163
|
+
const off = row.subscribe(listener);
|
|
164
|
+
return () => {
|
|
165
|
+
listeners.delete(listener);
|
|
166
|
+
off();
|
|
167
|
+
};
|
|
168
|
+
},
|
|
169
|
+
set: (field, value) => gateway() === void 0 ? row.set(field, value) : write({ [field]: value }),
|
|
170
|
+
unset: (field) => gateway() === void 0 ? row.unset(field) : write({ [field]: null })
|
|
171
|
+
};
|
|
172
|
+
}
|
|
96
173
|
//#endregion
|
|
97
174
|
//#region src/client/locales.ts
|
|
98
175
|
/** `local-agent-claude-code` namespace dictionaries. */
|
|
@@ -204,8 +281,13 @@ window.__ModuleLoader__.load({
|
|
|
204
281
|
* re-probes so a mid-session credential loss cannot leave a stale green dot.
|
|
205
282
|
* @module @khorsheed/dsh-local-agent/client — auth status bus
|
|
206
283
|
*/
|
|
207
|
-
const
|
|
208
|
-
const
|
|
284
|
+
const BUS_KEY = Symbol.for("dsh.local-agent.auth-status");
|
|
285
|
+
const bus = globalThis[BUS_KEY] ??= {
|
|
286
|
+
statuses: /* @__PURE__ */ new Map(),
|
|
287
|
+
listeners: /* @__PURE__ */ new Set()
|
|
288
|
+
};
|
|
289
|
+
const statuses = bus.statuses;
|
|
290
|
+
const listeners = bus.listeners;
|
|
209
291
|
/** Record one harness's latest probe result and notify subscribers. */
|
|
210
292
|
function publishAuthStatus(harnessId, status) {
|
|
211
293
|
if (statuses.get(harnessId) === status) return;
|
|
@@ -263,30 +345,30 @@ window.__ModuleLoader__.load({
|
|
|
263
345
|
document.head.appendChild(tag);
|
|
264
346
|
}
|
|
265
347
|
var ProviderAuthBlock_module_css_default = {
|
|
266
|
-
"rowCard": "On5p7W_rowCard",
|
|
267
|
-
"dotPending": "On5p7W_dotPending",
|
|
268
348
|
"loginPrompt": "On5p7W_loginPrompt",
|
|
269
|
-
"promptText": "On5p7W_promptText",
|
|
270
|
-
"dotOn": "On5p7W_dotOn",
|
|
271
|
-
"rowIdentity": "On5p7W_rowIdentity",
|
|
272
|
-
"rowPending": "On5p7W_rowPending",
|
|
273
|
-
"rows": "On5p7W_rows",
|
|
274
349
|
"title": "On5p7W_title",
|
|
275
|
-
"intro": "On5p7W_intro",
|
|
276
|
-
"rowName": "On5p7W_rowName",
|
|
277
350
|
"rowActions": "On5p7W_rowActions",
|
|
351
|
+
"rowName": "On5p7W_rowName",
|
|
278
352
|
"dotOff": "On5p7W_dotOff",
|
|
353
|
+
"codeInput": "On5p7W_codeInput",
|
|
354
|
+
"intro": "On5p7W_intro",
|
|
355
|
+
"promptText": "On5p7W_promptText",
|
|
356
|
+
"dotOn": "On5p7W_dotOn",
|
|
357
|
+
"openPage": "On5p7W_openPage",
|
|
279
358
|
"section": "On5p7W_section",
|
|
280
|
-
"
|
|
281
|
-
"logoutButton": "On5p7W_logoutButton",
|
|
359
|
+
"rows": "On5p7W_rows",
|
|
282
360
|
"rowTag": "On5p7W_rowTag",
|
|
361
|
+
"logoutButton": "On5p7W_logoutButton",
|
|
362
|
+
"retryButton": "On5p7W_retryButton",
|
|
283
363
|
"credentialDot": "On5p7W_credentialDot",
|
|
284
364
|
"status": "On5p7W_status",
|
|
365
|
+
"rowIdentity": "On5p7W_rowIdentity",
|
|
366
|
+
"rowCard": "On5p7W_rowCard",
|
|
367
|
+
"dotPending": "On5p7W_dotPending",
|
|
285
368
|
"loginButton": "On5p7W_loginButton",
|
|
286
369
|
"rosterError": "On5p7W_rosterError",
|
|
287
|
-
"
|
|
288
|
-
"
|
|
289
|
-
"openPage": "On5p7W_openPage"
|
|
370
|
+
"rowPending": "On5p7W_rowPending",
|
|
371
|
+
"rowHead": "On5p7W_rowHead"
|
|
290
372
|
};
|
|
291
373
|
//#endregion
|
|
292
374
|
//#region ../local-agent/src/client/ProviderAuthBlock.tsx
|
|
@@ -439,8 +521,8 @@ window.__ModuleLoader__.load({
|
|
|
439
521
|
const statusKind = usePublishedAuthStatus(harness.id) ?? view.status;
|
|
440
522
|
const authenticated = statusKind === "authenticated";
|
|
441
523
|
const loginPending = pendingSince !== void 0;
|
|
442
|
-
const loginable = view.loginable ??
|
|
443
|
-
const logoutable = view.logoutable ??
|
|
524
|
+
const loginable = view.loginable ?? statusKind !== "unavailable";
|
|
525
|
+
const logoutable = view.logoutable ?? statusKind !== "unavailable";
|
|
444
526
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
445
527
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
446
528
|
className: ProviderAuthBlock_module_css_default.rowHead,
|
|
@@ -473,7 +555,7 @@ window.__ModuleLoader__.load({
|
|
|
473
555
|
statusKind === "checking" && t("loading"),
|
|
474
556
|
statusKind === "authenticated" && t("settings.authenticated"),
|
|
475
557
|
statusKind === "anonymous" && t("settings.notAuthenticated"),
|
|
476
|
-
statusKind === "unavailable" && t("
|
|
558
|
+
statusKind === "unavailable" && t("settings.statusFailed")
|
|
477
559
|
]
|
|
478
560
|
}),
|
|
479
561
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -566,9 +648,9 @@ window.__ModuleLoader__.load({
|
|
|
566
648
|
}
|
|
567
649
|
var AuthStatusDot_module_css_default = {
|
|
568
650
|
"credentialDot": "OFjNUG_credentialDot",
|
|
651
|
+
"dotOn": "OFjNUG_dotOn",
|
|
569
652
|
"dotOff": "OFjNUG_dotOff",
|
|
570
|
-
"dotPending": "OFjNUG_dotPending"
|
|
571
|
-
"dotOn": "OFjNUG_dotOn"
|
|
653
|
+
"dotPending": "OFjNUG_dotPending"
|
|
572
654
|
};
|
|
573
655
|
//#endregion
|
|
574
656
|
//#region ../local-agent/src/client/AuthStatusDot.tsx
|
|
@@ -584,7 +666,7 @@ window.__ModuleLoader__.load({
|
|
|
584
666
|
}
|
|
585
667
|
//#endregion
|
|
586
668
|
//#region \0dsh-css:../local-agent/src/client/ModelListSection.module.css.mjs
|
|
587
|
-
const css$1 = "._4eeJ7W_block{flex-direction:column;gap:10px;display:flex}._4eeJ7W_blockTitle{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;margin:0;font-size:13px;font-weight:500;line-height:1.4;display:flex}._4eeJ7W_info{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:help;background:0 0;border:0;border-radius:50%;padding:0 2px;font-size:12px;line-height:1}._4eeJ7W_row{align-items:center;gap:12px;display:flex}._4eeJ7W_saved{color:var(--dsw-alias-state-success-primary);font-size:12px}._4eeJ7W_errorText{color:var(--dsw-alias-state-error-primary);font-size:12px}._4eeJ7W_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5}._4eeJ7W_modelInput{min-width:0;font:inherit;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);border-radius:8px;flex:1;padding:5px 8px;font-size:13px;line-height:1.4}._4eeJ7W_modelSave{appearance:none;font:inherit;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:8px;flex:none;padding:5px 10px;font-size:13px;line-height:1.4}._4eeJ7W_modelList{flex-direction:column;gap:8px;display:flex}._4eeJ7W_modelRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);cursor:grab;border-radius:8px;align-items:center;gap:8px;padding:6px 8px;display:flex}._4eeJ7W_modelRowDragging{opacity:.6;cursor:grabbing}._4eeJ7W_modelDrag{color:var(--dsw-alias-label-tertiary);cursor:grab;user-select:none}._4eeJ7W_modelRowValue{font-size:13px;font-family:var(--dsw-alias-font-mono,monospace);color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}._4eeJ7W_modelRowLabel{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;max-width:40%;font-size:12px;overflow:hidden}._4eeJ7W_modelDefaultChip{color:var(--dsw-alias-success,#1a9e54);background:color-mix(in srgb, var(--dsw-alias-success,#1a9e54) 12%, transparent);border-radius:999px;padding:1px 8px;font-size:11px;line-height:1.4}._4eeJ7W_modelDelete{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;padding:2px 4px;font-size:12px}._4eeJ7W_modelAdd{appearance:none;border:1px dashed var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border-radius:8px;padding:5px 12px;font-size:13px}._4eeJ7W_dialogBackdrop{z-index:100;background:#00000052;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}._4eeJ7W_dialog{background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;flex-direction:column;gap:10px;width:min(520px,100vw - 48px);max-height:min(560px,100vh - 96px);padding:16px;display:flex;box-shadow:0 12px 40px #00000059}._4eeJ7W_dialogHead{justify-content:space-between;align-items:center;display:flex}._4eeJ7W_dialogTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600}._4eeJ7W_dialogClose{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;padding:2px 4px;font-size:13px}._4eeJ7W_dialogHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}._4eeJ7W_dialogToolbar{align-items:center;gap:8px;display:flex}._4eeJ7W_dialogToolbar ._4eeJ7W_modelInput{flex:1}._4eeJ7W_dialogSelectAll{appearance:none;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:0;padding:4px 6px;font-size:13px}._4eeJ7W_dialogList{border:1px solid var(--dsw-alias-border-l2);border-radius:8px;flex-direction:column;flex:1;gap:2px;min-height:120px;max-height:320px;padding:6px;display:flex;overflow-y:auto}._4eeJ7W_dialogItem{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:8px;padding:6px 8px;font-size:13px;display:flex}._4eeJ7W_dialogItemAdded{opacity:.55;cursor:default}._4eeJ7W_dialogItemValue{font-family:var(--dsw-alias-font-mono,monospace)}._4eeJ7W_dialogItemLabel{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}._4eeJ7W_dialogActions{justify-content:flex-end;gap:8px;display:flex}._4eeJ7W_dialogConfirm{appearance:none;color:var(--dsw-alias-
|
|
669
|
+
const css$1 = "._4eeJ7W_block{flex-direction:column;gap:10px;display:flex}._4eeJ7W_blockTitle{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;margin:0;font-size:13px;font-weight:500;line-height:1.4;display:flex}._4eeJ7W_info{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:help;background:0 0;border:0;border-radius:50%;padding:0 2px;font-size:12px;line-height:1}._4eeJ7W_row{align-items:center;gap:12px;display:flex}._4eeJ7W_saved{color:var(--dsw-alias-state-success-primary);font-size:12px}._4eeJ7W_errorText{color:var(--dsw-alias-state-error-primary);font-size:12px}._4eeJ7W_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.5}._4eeJ7W_modelInput{min-width:0;font:inherit;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);border-radius:8px;flex:1;padding:5px 8px;font-size:13px;line-height:1.4}._4eeJ7W_modelSave{appearance:none;font:inherit;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:8px;flex:none;padding:5px 10px;font-size:13px;line-height:1.4}._4eeJ7W_modelList{flex-direction:column;gap:8px;display:flex}._4eeJ7W_modelRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);cursor:grab;border-radius:8px;align-items:center;gap:8px;padding:6px 8px;display:flex}._4eeJ7W_modelRowDragging{opacity:.6;cursor:grabbing}._4eeJ7W_modelDrag{color:var(--dsw-alias-label-tertiary);cursor:grab;user-select:none}._4eeJ7W_modelRowValue{font-size:13px;font-family:var(--dsw-alias-font-mono,monospace);color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}._4eeJ7W_modelRowLabel{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;max-width:40%;font-size:12px;overflow:hidden}._4eeJ7W_modelDefaultChip{color:var(--dsw-alias-success,#1a9e54);background:color-mix(in srgb, var(--dsw-alias-success,#1a9e54) 12%, transparent);border-radius:999px;padding:1px 8px;font-size:11px;line-height:1.4}._4eeJ7W_modelDelete{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;padding:2px 4px;font-size:12px}._4eeJ7W_modelAdd{appearance:none;border:1px dashed var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border-radius:8px;padding:5px 12px;font-size:13px}._4eeJ7W_dialogBackdrop{z-index:100;background:#00000052;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}._4eeJ7W_dialog{background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;flex-direction:column;gap:10px;width:min(520px,100vw - 48px);max-height:min(560px,100vh - 96px);padding:16px;display:flex;box-shadow:0 12px 40px #00000059}._4eeJ7W_dialogHead{justify-content:space-between;align-items:center;display:flex}._4eeJ7W_dialogTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600}._4eeJ7W_dialogClose{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;padding:2px 4px;font-size:13px}._4eeJ7W_dialogHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}._4eeJ7W_dialogToolbar{align-items:center;gap:8px;display:flex}._4eeJ7W_dialogToolbar ._4eeJ7W_modelInput{flex:1}._4eeJ7W_dialogSelectAll{appearance:none;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:0;padding:4px 6px;font-size:13px}._4eeJ7W_dialogList{border:1px solid var(--dsw-alias-border-l2);border-radius:8px;flex-direction:column;flex:1;gap:2px;min-height:120px;max-height:320px;padding:6px;display:flex;overflow-y:auto}._4eeJ7W_dialogItem{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:8px;padding:6px 8px;font-size:13px;display:flex}._4eeJ7W_dialogItemAdded{opacity:.55;cursor:default}._4eeJ7W_dialogItemValue{font-family:var(--dsw-alias-font-mono,monospace)}._4eeJ7W_dialogItemLabel{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}._4eeJ7W_dialogActions{justify-content:flex-end;gap:8px;display:flex}._4eeJ7W_dialogConfirm{appearance:none;color:var(--dsw-alias-label-primary-foreground,#fff);background:var(--dsw-alias-button-primary-fill,#1f2329);cursor:pointer;border:0;border-radius:8px;padding:6px 14px;font-size:13px}._4eeJ7W_dialogConfirm:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover,var(--dsw-alias-button-primary-fill,#1f2329))}._4eeJ7W_dialogConfirm:disabled{opacity:.4;cursor:default}";
|
|
588
670
|
const tagId$1 = "@khorsheed/dsh-local-agent-claude-code/ModelListSection.module.css";
|
|
589
671
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
590
672
|
const tag = document.createElement("style");
|
|
@@ -594,39 +676,39 @@ window.__ModuleLoader__.load({
|
|
|
594
676
|
document.head.appendChild(tag);
|
|
595
677
|
}
|
|
596
678
|
var ModelListSection_module_css_default = {
|
|
597
|
-
"
|
|
598
|
-
"
|
|
599
|
-
"dialogSelectAll": "_4eeJ7W_dialogSelectAll",
|
|
679
|
+
"row": "_4eeJ7W_row",
|
|
680
|
+
"hint": "_4eeJ7W_hint",
|
|
600
681
|
"modelDelete": "_4eeJ7W_modelDelete",
|
|
601
|
-
"
|
|
682
|
+
"dialogList": "_4eeJ7W_dialogList",
|
|
683
|
+
"modelList": "_4eeJ7W_modelList",
|
|
684
|
+
"modelRowDragging": "_4eeJ7W_modelRowDragging",
|
|
685
|
+
"dialogClose": "_4eeJ7W_dialogClose",
|
|
686
|
+
"modelRowLabel": "_4eeJ7W_modelRowLabel",
|
|
687
|
+
"dialogItemValue": "_4eeJ7W_dialogItemValue",
|
|
688
|
+
"modelSave": "_4eeJ7W_modelSave",
|
|
689
|
+
"dialogItemLabel": "_4eeJ7W_dialogItemLabel",
|
|
690
|
+
"info": "_4eeJ7W_info",
|
|
691
|
+
"dialogItemAdded": "_4eeJ7W_dialogItemAdded",
|
|
692
|
+
"dialogItem": "_4eeJ7W_dialogItem",
|
|
693
|
+
"blockTitle": "_4eeJ7W_blockTitle",
|
|
694
|
+
"modelAdd": "_4eeJ7W_modelAdd",
|
|
695
|
+
"dialogHead": "_4eeJ7W_dialogHead",
|
|
696
|
+
"dialogTitle": "_4eeJ7W_dialogTitle",
|
|
697
|
+
"block": "_4eeJ7W_block",
|
|
698
|
+
"dialogToolbar": "_4eeJ7W_dialogToolbar",
|
|
699
|
+
"dialog": "_4eeJ7W_dialog",
|
|
602
700
|
"modelDrag": "_4eeJ7W_modelDrag",
|
|
701
|
+
"errorText": "_4eeJ7W_errorText",
|
|
603
702
|
"dialogActions": "_4eeJ7W_dialogActions",
|
|
604
|
-
"modelInput": "_4eeJ7W_modelInput",
|
|
605
703
|
"modelRow": "_4eeJ7W_modelRow",
|
|
606
|
-
"
|
|
607
|
-
"
|
|
608
|
-
"hint": "_4eeJ7W_hint",
|
|
704
|
+
"modelDefaultChip": "_4eeJ7W_modelDefaultChip",
|
|
705
|
+
"modelInput": "_4eeJ7W_modelInput",
|
|
609
706
|
"dialogConfirm": "_4eeJ7W_dialogConfirm",
|
|
610
|
-
"dialogClose": "_4eeJ7W_dialogClose",
|
|
611
|
-
"dialogToolbar": "_4eeJ7W_dialogToolbar",
|
|
612
|
-
"errorText": "_4eeJ7W_errorText",
|
|
613
|
-
"dialogItemAdded": "_4eeJ7W_dialogItemAdded",
|
|
614
|
-
"modelSave": "_4eeJ7W_modelSave",
|
|
615
|
-
"dialogTitle": "_4eeJ7W_dialogTitle",
|
|
616
707
|
"saved": "_4eeJ7W_saved",
|
|
617
|
-
"modelDefaultChip": "_4eeJ7W_modelDefaultChip",
|
|
618
|
-
"modelRowLabel": "_4eeJ7W_modelRowLabel",
|
|
619
|
-
"info": "_4eeJ7W_info",
|
|
620
|
-
"block": "_4eeJ7W_block",
|
|
621
|
-
"modelRowValue": "_4eeJ7W_modelRowValue",
|
|
622
|
-
"modelAdd": "_4eeJ7W_modelAdd",
|
|
623
708
|
"dialogBackdrop": "_4eeJ7W_dialogBackdrop",
|
|
624
|
-
"
|
|
625
|
-
"
|
|
626
|
-
"
|
|
627
|
-
"row": "_4eeJ7W_row",
|
|
628
|
-
"blockTitle": "_4eeJ7W_blockTitle",
|
|
629
|
-
"dialogList": "_4eeJ7W_dialogList"
|
|
709
|
+
"dialogSelectAll": "_4eeJ7W_dialogSelectAll",
|
|
710
|
+
"dialogHint": "_4eeJ7W_dialogHint",
|
|
711
|
+
"modelRowValue": "_4eeJ7W_modelRowValue"
|
|
630
712
|
};
|
|
631
713
|
//#endregion
|
|
632
714
|
//#region ../local-agent/src/client/ModelListSection.tsx
|
|
@@ -998,33 +1080,33 @@ window.__ModuleLoader__.load({
|
|
|
998
1080
|
document.head.appendChild(tag);
|
|
999
1081
|
}
|
|
1000
1082
|
var SettingsCard_module_css_default = {
|
|
1001
|
-
"name": "C-VWHa_name",
|
|
1002
|
-
"hint": "C-VWHa_hint",
|
|
1003
|
-
"configuredChip": "C-VWHa_configuredChip",
|
|
1004
|
-
"endpointField": "C-VWHa_endpointField",
|
|
1005
|
-
"headText": "C-VWHa_headText",
|
|
1006
|
-
"knob": "C-VWHa_knob",
|
|
1007
|
-
"modelInput": "C-VWHa_modelInput",
|
|
1008
|
-
"blockTitle": "C-VWHa_blockTitle",
|
|
1009
1083
|
"nameRow": "C-VWHa_nameRow",
|
|
1010
|
-
"
|
|
1011
|
-
"
|
|
1012
|
-
"row": "C-VWHa_row",
|
|
1084
|
+
"endpointLabel": "C-VWHa_endpointLabel",
|
|
1085
|
+
"card": "C-VWHa_card",
|
|
1013
1086
|
"switch": "C-VWHa_switch",
|
|
1014
|
-
"
|
|
1087
|
+
"switchOn": "C-VWHa_switchOn",
|
|
1015
1088
|
"saved": "C-VWHa_saved",
|
|
1016
1089
|
"modelSave": "C-VWHa_modelSave",
|
|
1017
|
-
"errorText": "C-VWHa_errorText",
|
|
1018
|
-
"rowLabel": "C-VWHa_rowLabel",
|
|
1019
|
-
"chevronOpen": "C-VWHa_chevronOpen",
|
|
1020
1090
|
"endpointFields": "C-VWHa_endpointFields",
|
|
1021
|
-
"
|
|
1091
|
+
"cardOpen": "C-VWHa_cardOpen",
|
|
1022
1092
|
"header": "C-VWHa_header",
|
|
1023
|
-
"
|
|
1024
|
-
"
|
|
1093
|
+
"name": "C-VWHa_name",
|
|
1094
|
+
"endpointField": "C-VWHa_endpointField",
|
|
1095
|
+
"chevronOpen": "C-VWHa_chevronOpen",
|
|
1096
|
+
"rowLabel": "C-VWHa_rowLabel",
|
|
1097
|
+
"modelInput": "C-VWHa_modelInput",
|
|
1098
|
+
"errorText": "C-VWHa_errorText",
|
|
1099
|
+
"blockTitle": "C-VWHa_blockTitle",
|
|
1025
1100
|
"info": "C-VWHa_info",
|
|
1026
|
-
"
|
|
1027
|
-
"
|
|
1101
|
+
"chevron": "C-VWHa_chevron",
|
|
1102
|
+
"hint": "C-VWHa_hint",
|
|
1103
|
+
"row": "C-VWHa_row",
|
|
1104
|
+
"headText": "C-VWHa_headText",
|
|
1105
|
+
"description": "C-VWHa_description",
|
|
1106
|
+
"body": "C-VWHa_body",
|
|
1107
|
+
"block": "C-VWHa_block",
|
|
1108
|
+
"configuredChip": "C-VWHa_configuredChip",
|
|
1109
|
+
"knob": "C-VWHa_knob"
|
|
1028
1110
|
};
|
|
1029
1111
|
//#endregion
|
|
1030
1112
|
//#region src/client/SettingsCard.tsx
|
|
@@ -1059,6 +1141,7 @@ window.__ModuleLoader__.load({
|
|
|
1059
1141
|
const endpointLoading = !endpointUnavailable && endpointState === null;
|
|
1060
1142
|
const apiKeyConfigured = endpointState !== null && endpointState !== "unavailable" && endpointState.apiKeySet;
|
|
1061
1143
|
const authTokenConfigured = endpointState !== null && endpointState !== "unavailable" && endpointState.authTokenSet;
|
|
1144
|
+
const authPublished = usePublishedAuthStatus("claude-code");
|
|
1062
1145
|
(0, react.useEffect)(() => {
|
|
1063
1146
|
if (!active || endpointAuth === void 0) return;
|
|
1064
1147
|
let stale = false;
|
|
@@ -1073,13 +1156,15 @@ window.__ModuleLoader__.load({
|
|
|
1073
1156
|
}, [
|
|
1074
1157
|
active,
|
|
1075
1158
|
endpointAuth,
|
|
1076
|
-
endpointSaved
|
|
1159
|
+
endpointSaved,
|
|
1160
|
+
authPublished
|
|
1077
1161
|
]);
|
|
1078
1162
|
const write = (field, value) => {
|
|
1079
1163
|
setSaved(false);
|
|
1080
1164
|
setError(false);
|
|
1081
|
-
scope.set(field, value).then(() => {
|
|
1082
|
-
|
|
1165
|
+
scope.set(field, value).then((accepted) => {
|
|
1166
|
+
if (accepted === false) setError(true);
|
|
1167
|
+
else setSaved(true);
|
|
1083
1168
|
}, () => {
|
|
1084
1169
|
setError(true);
|
|
1085
1170
|
});
|
|
@@ -1495,7 +1580,7 @@ window.__ModuleLoader__.load({
|
|
|
1495
1580
|
en
|
|
1496
1581
|
}), "local-agent-claude-code: dictionaries");
|
|
1497
1582
|
const t = ctx.locale.bind(NS);
|
|
1498
|
-
const scope =
|
|
1583
|
+
const scope = bindCardSettingsScope(ctx, "claude-code", "local-agent-claude-code");
|
|
1499
1584
|
const authT = ctx.locale.bind("local-agent");
|
|
1500
1585
|
const gateway = () => ctx.get("remote.localAgentGateway");
|
|
1501
1586
|
const cardFace = () => ({
|
package/lib/index.js
CHANGED
|
@@ -3850,7 +3850,7 @@ const inject = [
|
|
|
3850
3850
|
* behavior byte-identical.
|
|
3851
3851
|
*/
|
|
3852
3852
|
const SETTINGS_FIELDS = {
|
|
3853
|
-
live: z.boolean().default(
|
|
3853
|
+
live: z.boolean().default(true),
|
|
3854
3854
|
liveMirrorGranularity: z.union([z.const("event"), z.const("token")]).default("token"),
|
|
3855
3855
|
model: z.string(),
|
|
3856
3856
|
recentModels: z.array(z.string()).default([])
|
|
@@ -3900,7 +3900,7 @@ function apply(ctx, config) {
|
|
|
3900
3900
|
const model = vol(config.model);
|
|
3901
3901
|
const recentModels = vol(config.recentModels);
|
|
3902
3902
|
return {
|
|
3903
|
-
live: vol(config.live) ??
|
|
3903
|
+
live: vol(config.live) ?? true,
|
|
3904
3904
|
liveMirrorGranularity: vol(config.liveMirrorGranularity) ?? "token",
|
|
3905
3905
|
...model === void 0 ? {} : { model },
|
|
3906
3906
|
...recentModels === void 0 ? {} : { recentModels }
|
|
@@ -3917,6 +3917,7 @@ function apply(ctx, config) {
|
|
|
3917
3917
|
}
|
|
3918
3918
|
const face = settingsFace(ctx, {
|
|
3919
3919
|
namespace: CLAUDE_SETTINGS_NAMESPACE,
|
|
3920
|
+
harness: "claude-code",
|
|
3920
3921
|
legacySchema: CLAUDE_SETTINGS_SCHEMA,
|
|
3921
3922
|
legacyBase,
|
|
3922
3923
|
read: readSettings
|
|
@@ -7,7 +7,7 @@ import { IconChevronDownOutlineMedium } from './icons.js';
|
|
|
7
7
|
// the block carries no runtime identity to share.
|
|
8
8
|
import { ProviderAuthBlock, } from '@khorsheed/dsh-local-agent/src/client/ProviderAuthBlock.tsx';
|
|
9
9
|
import { AuthStatusDot } from '@khorsheed/dsh-local-agent/src/client/AuthStatusDot.tsx';
|
|
10
|
-
import { publishAuthStatus, useHarnessAuthStatus } from '@khorsheed/dsh-local-agent/src/client/auth-status.ts';
|
|
10
|
+
import { publishAuthStatus, useHarnessAuthStatus, usePublishedAuthStatus } from '@khorsheed/dsh-local-agent/src/client/auth-status.ts';
|
|
11
11
|
import { ModelListSection } from '@khorsheed/dsh-local-agent/src/client/ModelListSection.tsx';
|
|
12
12
|
import css from './SettingsCard.module.css';
|
|
13
13
|
/**
|
|
@@ -47,6 +47,10 @@ function useCardState(active, useSettings, scope, endpointAuth) {
|
|
|
47
47
|
const endpointLoading = !endpointUnavailable && endpointState === null;
|
|
48
48
|
const apiKeyConfigured = endpointState !== null && endpointState !== 'unavailable' && endpointState.apiKeySet;
|
|
49
49
|
const authTokenConfigured = endpointState !== null && endpointState !== 'unavailable' && endpointState.authTokenSet;
|
|
50
|
+
// A login or logout elsewhere in the card (the auth block) changes what
|
|
51
|
+
// the store holds — logout deletes the saved key: re-read, or the form
|
|
52
|
+
// keeps saying 已配置 for a key that is gone.
|
|
53
|
+
const authPublished = usePublishedAuthStatus('claude-code');
|
|
50
54
|
useEffect(() => {
|
|
51
55
|
if (!active || endpointAuth === undefined)
|
|
52
56
|
return;
|
|
@@ -55,11 +59,15 @@ function useCardState(active, useSettings, scope, endpointAuth) {
|
|
|
55
59
|
setEndpointState(state ?? 'unavailable'); }, () => { if (!stale)
|
|
56
60
|
setEndpointState('unavailable'); });
|
|
57
61
|
return () => { stale = true; };
|
|
58
|
-
}, [active, endpointAuth, endpointSaved]);
|
|
62
|
+
}, [active, endpointAuth, endpointSaved, authPublished]);
|
|
59
63
|
const write = (field, value) => {
|
|
60
64
|
setSaved(false);
|
|
61
65
|
setError(false);
|
|
62
|
-
|
|
66
|
+
// The host answers a refused write with `false` (ConfigForm), not a rejection.
|
|
67
|
+
void scope.set(field, value).then((accepted) => { if (accepted === false)
|
|
68
|
+
setError(true);
|
|
69
|
+
else
|
|
70
|
+
setSaved(true); }, () => { setError(true); });
|
|
63
71
|
};
|
|
64
72
|
// The credential save: one `configureEndpoint` call carrying only the
|
|
65
73
|
// dirty fields (a blank draft clears its field); the answer is the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bindCardSettingsScope } from '@khorsheed/dsh-local-agent/src/client/settings-scope.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Local-agent-claude-code plugin, browser half: the claude-code settings card
|
|
4
4
|
* — a section of the family core's「本机 Agent 委派」family card on the
|
|
@@ -44,7 +44,7 @@ export const inject = ['slots', 'remote', 'remote.commands', 'locale'];
|
|
|
44
44
|
export function apply(ctx) {
|
|
45
45
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'local-agent-claude-code: dictionaries');
|
|
46
46
|
const t = ctx.locale.bind(NS);
|
|
47
|
-
const scope =
|
|
47
|
+
const scope = bindCardSettingsScope(ctx, 'claude-code', 'local-agent-claude-code');
|
|
48
48
|
// The auth block's copy lives in the family core's dictionary; binding is
|
|
49
49
|
// stable per namespace and late dictionary registration still resolves.
|
|
50
50
|
const authT = ctx.locale.bind('local-agent');
|
package/lib/types/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export const inject = ['localAgent', 'subagents', 'subprocess', 'settings'];
|
|
|
42
42
|
* behavior byte-identical.
|
|
43
43
|
*/
|
|
44
44
|
const SETTINGS_FIELDS = {
|
|
45
|
-
live: z.boolean().default(
|
|
45
|
+
live: z.boolean().default(true),
|
|
46
46
|
liveMirrorGranularity: z.union([z.const('event'), z.const('token')]).default('token'),
|
|
47
47
|
model: z.string(),
|
|
48
48
|
recentModels: z.array(z.string()).default([]),
|
|
@@ -109,7 +109,7 @@ export function apply(ctx, config) {
|
|
|
109
109
|
const model = vol(config.model);
|
|
110
110
|
const recentModels = vol(config.recentModels);
|
|
111
111
|
return {
|
|
112
|
-
live: vol(config.live) ??
|
|
112
|
+
live: vol(config.live) ?? true,
|
|
113
113
|
liveMirrorGranularity: vol(config.liveMirrorGranularity) ?? 'token',
|
|
114
114
|
...model === undefined ? {} : { model },
|
|
115
115
|
...recentModels === undefined ? {} : { recentModels },
|
|
@@ -123,6 +123,8 @@ export function apply(ctx, config) {
|
|
|
123
123
|
}
|
|
124
124
|
const face = settingsFace(ctx, {
|
|
125
125
|
namespace: CLAUDE_SETTINGS_NAMESPACE,
|
|
126
|
+
// Card writes live in the harness's own store (card-settings.ts), never the profile patch.
|
|
127
|
+
harness: 'claude-code',
|
|
126
128
|
legacySchema: CLAUDE_SETTINGS_SCHEMA,
|
|
127
129
|
legacyBase,
|
|
128
130
|
read: readSettings,
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"local-agent",
|
|
9
9
|
"claude-code"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.2.
|
|
11
|
+
"version": "0.2.1",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "lib/index.js",
|
|
14
14
|
"types": "lib/types/index.d.ts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"dsh": ">=0.1.5-rc.1 <0.3.0-0"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@khorsheed/dsh-local-agent": "^0.2.
|
|
72
|
+
"@khorsheed/dsh-local-agent": "^0.2.1"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@deepseek-ai/cordis": "^4.0.1",
|