@dsmm/dsmm 0.3.15 → 0.3.17
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/README.md +13 -5
- package/docs/agent-presets.md +1 -1
- package/docs/compatibility.md +5 -5
- package/docs/deferred-native-approval-risk.md +1 -1
- package/docs/design.md +1 -1
- package/docs/lsp.md +1 -1
- package/docs/maintenance.md +2 -1
- package/docs/model-routing.md +13 -6
- package/docs/native-permissions.md +1 -1
- package/docs/profiles.md +3 -1
- package/docs/releasing.md +2 -2
- package/docs/roadmap.md +3 -3
- package/docs/runtime-recovery.md +4 -4
- package/docs/safety-guards.md +1 -1
- package/docs/settings-status.md +4 -2
- package/docs/tui.md +53 -0
- package/dsh-plugin.json +41 -0
- package/lib/client/ProfilesSection.js +1 -1
- package/lib/client/SessionProfiles.js +8 -7
- package/lib/client/children-locales.d.ts +1 -1
- package/lib/client/controller.d.ts +13 -1
- package/lib/client/controller.js +114 -20
- package/lib/client/deployment-locales.js +3 -2
- package/lib/client/deployment-modules.js +1 -1
- package/lib/client/index.js +22 -4
- package/lib/client/locales.d.ts +1 -0
- package/lib/client/locales.js +2 -0
- package/lib/client.js +144 -29
- package/lib/commands.d.ts +7 -3
- package/lib/commands.js +20 -11
- package/lib/host-llm.js +6 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -6
- package/lib/model-routing.js +43 -19
- package/lib/profile-diagnostics.js +1 -0
- package/lib/profile-runtime.js +1 -1
- package/lib/request-routing.d.ts +27 -0
- package/lib/request-routing.js +69 -0
- package/lib/role-llm-runtime.js +15 -2
- package/lib/role-routing.d.ts +4 -3
- package/lib/role-routing.js +17 -10
- package/lib/runtime-recovery.js +56 -16
- package/lib/settings.d.ts +3 -0
- package/lib/settings.js +9 -0
- package/lib/state.d.ts +2 -2
- package/lib/state.js +13 -4
- package/lib/status.d.ts +5 -0
- package/lib/status.js +18 -7
- package/lib/tui-actions.d.ts +21 -0
- package/lib/tui-actions.js +301 -0
- package/lib/tui-adapter.d.ts +25 -0
- package/lib/tui-adapter.js +422 -0
- package/lib/tui-types.d.ts +98 -0
- package/lib/tui-types.js +2 -0
- package/package.json +4 -2
|
@@ -47,6 +47,7 @@ export interface ProfilesViewSnapshot {
|
|
|
47
47
|
currentSessionId: string | null;
|
|
48
48
|
sessionViewEpoch: number;
|
|
49
49
|
sessionUnconfirmed: boolean;
|
|
50
|
+
sessionReadinessPending: boolean;
|
|
50
51
|
session: SessionProfileSnapshot | null;
|
|
51
52
|
sessionChoice: string | null;
|
|
52
53
|
sessionWorkspaces: readonly ProfileWorkspace[];
|
|
@@ -140,6 +141,13 @@ export declare class ProfilesController {
|
|
|
140
141
|
private modeRefreshPending;
|
|
141
142
|
private sessionSource;
|
|
142
143
|
private sessionSourceId;
|
|
144
|
+
private sessionBinding;
|
|
145
|
+
private agentAvailable;
|
|
146
|
+
private availabilityEpoch;
|
|
147
|
+
private availabilityReadSucceeded;
|
|
148
|
+
private initialSessionRead;
|
|
149
|
+
private sessionReadIssue;
|
|
150
|
+
private readinessTimer;
|
|
143
151
|
private stopSessionSource;
|
|
144
152
|
private stopModelEvents;
|
|
145
153
|
private modelInteraction;
|
|
@@ -170,7 +178,11 @@ export declare class ProfilesController {
|
|
|
170
178
|
private syncComposerBlock;
|
|
171
179
|
attachModelSelector(remote: ProfileModelSelectorRemote | null): void;
|
|
172
180
|
attachModelSelectionSource(sessionId: string | null, source: HostObservable<unknown> | null): void;
|
|
173
|
-
attachSessionSource(sessionId: string | null, source: HostObservable<SessionSnapshot> | null): void;
|
|
181
|
+
attachSessionSource(sessionId: string | null, source: HostObservable<SessionSnapshot> | null, binding?: object | null): void;
|
|
182
|
+
private endReadiness;
|
|
183
|
+
private resetReadiness;
|
|
184
|
+
private sessionSourceFailed;
|
|
185
|
+
observeSessionAvailability(id: string, source: HostObservable<SessionSnapshot>, available: boolean): void;
|
|
174
186
|
attachModelEventSource(sessionId: string | null, source: SessionEventSource | null): void;
|
|
175
187
|
attachModelInteractionSource(sessionId: string | null, source: ModelInteractionSource | null): void;
|
|
176
188
|
attachCatalog(remote: ModelCatalogRemote | null): void;
|
package/lib/client/controller.js
CHANGED
|
@@ -28,7 +28,7 @@ export function canReconcileSelection(snapshot) {
|
|
|
28
28
|
export class ProfilesController {
|
|
29
29
|
remote;
|
|
30
30
|
current = { snapshot: null, editor: null, dirty: false, busy: null, issue: null, notice: null, pendingEditor: null,
|
|
31
|
-
catalog: null, catalogBusy: false, catalogUnavailable: true, currentSessionId: null, sessionViewEpoch: 0, sessionUnconfirmed: false, session: null, sessionChoice: null, sessionWorkspaces: [], sessionWorkspaceId: null, sessionPreparationAvailable: false, sessionPreparationPending: false, sessionBusy: null, sessionIssue: null, sessionNotice: null, invalidFields: [], editorEpoch: 0, validationEpoch: 0 };
|
|
31
|
+
catalog: null, catalogBusy: false, catalogUnavailable: true, currentSessionId: null, sessionViewEpoch: 0, sessionUnconfirmed: false, sessionReadinessPending: false, session: null, sessionChoice: null, sessionWorkspaces: [], sessionWorkspaceId: null, sessionPreparationAvailable: false, sessionPreparationPending: false, sessionBusy: null, sessionIssue: null, sessionNotice: null, invalidFields: [], editorEpoch: 0, validationEpoch: 0 };
|
|
32
32
|
accepted = null;
|
|
33
33
|
listeners = new Set();
|
|
34
34
|
generation = 0;
|
|
@@ -61,6 +61,13 @@ export class ProfilesController {
|
|
|
61
61
|
modeRefreshPending = false;
|
|
62
62
|
sessionSource = null;
|
|
63
63
|
sessionSourceId = null;
|
|
64
|
+
sessionBinding = null;
|
|
65
|
+
agentAvailable;
|
|
66
|
+
availabilityEpoch = 0;
|
|
67
|
+
availabilityReadSucceeded = false;
|
|
68
|
+
initialSessionRead = true;
|
|
69
|
+
sessionReadIssue = null;
|
|
70
|
+
readinessTimer = null;
|
|
64
71
|
stopSessionSource = null;
|
|
65
72
|
stopModelEvents = null;
|
|
66
73
|
modelInteraction = null;
|
|
@@ -114,7 +121,7 @@ export class ProfilesController {
|
|
|
114
121
|
constructor(remote) {
|
|
115
122
|
this.remote = remote;
|
|
116
123
|
}
|
|
117
|
-
dispose() { this.releasePreparation(); this.stopWorkspaces?.(); this.releaseComposerBlock(); this.numberDrafts.clear(); this.stopConnection?.(); this.stopSessionSource?.(); this.sessionSource = null; this.disposed = true; this.generation += 1; this.sessionGeneration += 1; this.catalogGeneration += 1; this.modelSelectorGeneration += 1; this.modelSelectionGeneration += 1; this.stopModelSelection?.(); this.stopModelEvents?.(); this.stopModelInteraction?.(); this.stopModelSelection = null; this.stopModelEvents = null; this.stopModelInteraction = null; this.modelSelectionSource = null; this.modelEvents = null; this.modelInteraction = null; this.catalogRemote = null; this.modelSelector = null; this.listeners.clear(); }
|
|
124
|
+
dispose() { this.endReadiness(); this.releasePreparation(); this.stopWorkspaces?.(); this.releaseComposerBlock(); this.numberDrafts.clear(); this.stopConnection?.(); this.stopSessionSource?.(); this.sessionSource = null; this.disposed = true; this.generation += 1; this.sessionGeneration += 1; this.catalogGeneration += 1; this.modelSelectorGeneration += 1; this.modelSelectionGeneration += 1; this.stopModelSelection?.(); this.stopModelEvents?.(); this.stopModelInteraction?.(); this.stopModelSelection = null; this.stopModelEvents = null; this.stopModelInteraction = null; this.modelSelectionSource = null; this.modelEvents = null; this.modelInteraction = null; this.catalogRemote = null; this.modelSelector = null; this.listeners.clear(); }
|
|
118
125
|
bindConnection(source) {
|
|
119
126
|
if (this.disposed)
|
|
120
127
|
return;
|
|
@@ -124,6 +131,7 @@ export class ProfilesController {
|
|
|
124
131
|
this.connectionBound = true;
|
|
125
132
|
this.connectionBaseline = source?.getSnapshot();
|
|
126
133
|
const invalidate = () => {
|
|
134
|
+
this.resetReadiness();
|
|
127
135
|
this.releasePreparation();
|
|
128
136
|
this.connectionBaseline = source?.getSnapshot();
|
|
129
137
|
this.generation += 1;
|
|
@@ -133,17 +141,15 @@ export class ProfilesController {
|
|
|
133
141
|
// A replaced connection only discards what it observed. It never records a
|
|
134
142
|
// durable refusal for the session: an unread configuration is read again
|
|
135
143
|
// by the next refresh, and typing stays available in the meantime.
|
|
136
|
-
this.publish({ session: null, sessionBusy: null, sessionNotice: null, sessionUnconfirmed: false,
|
|
144
|
+
this.publish({ session: null, sessionBusy: null, sessionIssue: null, sessionNotice: null, sessionUnconfirmed: false,
|
|
137
145
|
sessionViewEpoch: this.current.sessionViewEpoch + 1, sessionWorkspaceId: null, sessionPreparationPending: false, busy: null, issue: { kind: "transport", code: "unavailable" } });
|
|
138
146
|
};
|
|
139
147
|
if (replacement || source === null || this.connectionBaseline === undefined)
|
|
140
148
|
invalidate();
|
|
141
149
|
this.stopConnection = source?.subscribe(() => {
|
|
142
150
|
invalidate();
|
|
143
|
-
if (this.connectionCurrent())
|
|
151
|
+
if (this.connectionCurrent())
|
|
144
152
|
void this.refresh();
|
|
145
|
-
void this.refreshSession();
|
|
146
|
-
}
|
|
147
153
|
}) ?? null;
|
|
148
154
|
}
|
|
149
155
|
connectionCurrent() {
|
|
@@ -410,21 +416,27 @@ export class ProfilesController {
|
|
|
410
416
|
this.modelSelectionSource = source;
|
|
411
417
|
this.stopModelSelection = source?.subscribe(() => { this.modelSelectionGeneration += 1; }) ?? null;
|
|
412
418
|
}
|
|
413
|
-
attachSessionSource(sessionId, source) {
|
|
414
|
-
if (this.disposed || sessionId === this.sessionSourceId && source === this.sessionSource)
|
|
419
|
+
attachSessionSource(sessionId, source, binding = source) {
|
|
420
|
+
if (this.disposed || sessionId === this.sessionSourceId && source === this.sessionSource && binding === this.sessionBinding)
|
|
415
421
|
return;
|
|
422
|
+
this.resetReadiness();
|
|
416
423
|
this.stopSessionSource?.();
|
|
417
424
|
this.sessionSourceId = sessionId;
|
|
418
425
|
this.sessionSource = source;
|
|
426
|
+
this.sessionBinding = binding;
|
|
419
427
|
let running = source?.getSnapshot().running;
|
|
420
|
-
const current = () => !this.disposed && sessionId !== null && sessionId === this.current.currentSessionId && source === this.sessionSource;
|
|
428
|
+
const current = () => !this.disposed && sessionId !== null && sessionId === this.current.currentSessionId && source === this.sessionSource && binding === this.sessionBinding;
|
|
421
429
|
this.stopSessionSource = source?.subscribe(() => {
|
|
422
430
|
if (!current())
|
|
423
431
|
return;
|
|
432
|
+
if (this.connectionCurrent() && this.sessionSourceFailed())
|
|
433
|
+
return;
|
|
424
434
|
const next = source.getSnapshot().running;
|
|
425
435
|
if (next === running)
|
|
426
436
|
return;
|
|
427
437
|
running = next;
|
|
438
|
+
if (!this.connectionCurrent())
|
|
439
|
+
return;
|
|
428
440
|
// Running is an invalidation signal, never permission to apply an overlay.
|
|
429
441
|
this.modeRefreshPending = true;
|
|
430
442
|
this.refreshObservedMode();
|
|
@@ -432,11 +444,60 @@ export class ProfilesController {
|
|
|
432
444
|
if (current()) {
|
|
433
445
|
this.sessionGeneration += 1;
|
|
434
446
|
this.modeRefreshPending = source !== null;
|
|
435
|
-
this.publish({ session: null, sessionBusy: null, sessionNotice: null, sessionViewEpoch: this.current.sessionViewEpoch + 1,
|
|
447
|
+
this.publish({ session: null, sessionBusy: null, sessionIssue: null, sessionNotice: null, sessionViewEpoch: this.current.sessionViewEpoch + 1,
|
|
436
448
|
sessionUnconfirmed: this.pendingSessionSelections.has(sessionId) });
|
|
437
449
|
this.refreshObservedMode();
|
|
438
450
|
}
|
|
439
451
|
}
|
|
452
|
+
endReadiness() {
|
|
453
|
+
if (this.readinessTimer !== null)
|
|
454
|
+
clearTimeout(this.readinessTimer);
|
|
455
|
+
this.readinessTimer = null;
|
|
456
|
+
if (this.current.sessionReadinessPending)
|
|
457
|
+
this.publish({ sessionReadinessPending: false });
|
|
458
|
+
}
|
|
459
|
+
resetReadiness() {
|
|
460
|
+
this.endReadiness();
|
|
461
|
+
this.agentAvailable = undefined;
|
|
462
|
+
this.availabilityEpoch += 1;
|
|
463
|
+
this.availabilityReadSucceeded = false;
|
|
464
|
+
this.initialSessionRead = true;
|
|
465
|
+
this.sessionReadIssue = null;
|
|
466
|
+
}
|
|
467
|
+
sessionSourceFailed() {
|
|
468
|
+
const source = this.sessionSource?.getSnapshot();
|
|
469
|
+
if (source === undefined || !source.removed && source.openError === null)
|
|
470
|
+
return false;
|
|
471
|
+
this.endReadiness();
|
|
472
|
+
this.initialSessionRead = false;
|
|
473
|
+
this.availabilityEpoch += 1;
|
|
474
|
+
this.availabilityReadSucceeded = false;
|
|
475
|
+
this.sessionGeneration += 1;
|
|
476
|
+
this.modeRefreshPending = false;
|
|
477
|
+
const issue = source.removed ? { kind: "domain", code: "disposed", field: "sessionId" }
|
|
478
|
+
: { kind: "transport", code: source.openError.code };
|
|
479
|
+
this.sessionReadIssue = issue;
|
|
480
|
+
const { currentSessionId: id, session, sessionUnconfirmed } = this.current;
|
|
481
|
+
this.publish({ session: null, sessionBusy: null, sessionIssue: issue,
|
|
482
|
+
sessionUnconfirmed: sessionUnconfirmed || id !== null && this.pendingSessionSelections.has(id)
|
|
483
|
+
|| session?.refreshRequired === true || session?.selection.refreshRequired === true });
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
observeSessionAvailability(id, source, available) {
|
|
487
|
+
if (this.disposed || !this.connectionCurrent() || id !== this.current.currentSessionId || id !== this.sessionSourceId || source !== this.sessionSource || this.sessionSourceFailed())
|
|
488
|
+
return;
|
|
489
|
+
const changed = available !== this.agentAvailable;
|
|
490
|
+
this.agentAvailable = available;
|
|
491
|
+
if (!available) {
|
|
492
|
+
this.availabilityEpoch += 1;
|
|
493
|
+
this.availabilityReadSucceeded = false;
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
if (changed || !this.availabilityReadSucceeded) {
|
|
497
|
+
this.modeRefreshPending = true;
|
|
498
|
+
this.refreshObservedMode();
|
|
499
|
+
}
|
|
500
|
+
}
|
|
440
501
|
attachModelEventSource(sessionId, source) {
|
|
441
502
|
if (this.disposed || (sessionId === this.modelEventsSessionId && source === this.modelEvents))
|
|
442
503
|
return;
|
|
@@ -493,6 +554,7 @@ export class ProfilesController {
|
|
|
493
554
|
setSession(id) {
|
|
494
555
|
if (this.disposed || id === this.current.currentSessionId)
|
|
495
556
|
return;
|
|
557
|
+
this.resetReadiness();
|
|
496
558
|
const task = this.preparation;
|
|
497
559
|
const preparationUnconfirmed = task?.id === id && this.current.sessionUnconfirmed;
|
|
498
560
|
if (task?.id === id && task.held !== null && id !== null) {
|
|
@@ -547,20 +609,51 @@ export class ProfilesController {
|
|
|
547
609
|
}
|
|
548
610
|
if (this.disposed || !this.connectionCurrent() || id === null || this.current.sessionBusy !== null || this.sessionSourceId === id && this.sessionSource === null)
|
|
549
611
|
return;
|
|
612
|
+
if (this.sessionSourceFailed())
|
|
613
|
+
return;
|
|
614
|
+
const initial = this.initialSessionRead;
|
|
615
|
+
const availabilityEpoch = this.availabilityEpoch;
|
|
616
|
+
this.initialSessionRead = false;
|
|
550
617
|
this.modeRefreshPending = false;
|
|
551
618
|
const generation = ++this.sessionGeneration;
|
|
552
619
|
const live = () => !this.disposed && this.connectionCurrent() && generation === this.sessionGeneration && id === this.current.currentSessionId;
|
|
553
|
-
this.publish({ sessionBusy: "read"
|
|
620
|
+
this.publish({ sessionBusy: "read" });
|
|
554
621
|
try {
|
|
555
622
|
const session = await this.unwrap(this.remote.describeSession(id));
|
|
556
623
|
if (session.sessionId !== id)
|
|
557
624
|
throw { kind: "assembly", code: "unavailable" };
|
|
558
|
-
if (live())
|
|
559
|
-
|
|
625
|
+
if (live()) {
|
|
626
|
+
if (availabilityEpoch === this.availabilityEpoch && this.agentAvailable !== false)
|
|
627
|
+
this.availabilityReadSucceeded = true;
|
|
628
|
+
this.endReadiness();
|
|
629
|
+
this.publish({ session, sessionChoice: (session.admittedSelection ?? session.selection).selectedId, sessionUnconfirmed: this.pendingSessionSelections.has(id),
|
|
630
|
+
...(this.current.sessionIssue === this.sessionReadIssue ? { sessionIssue: null } : {}) });
|
|
631
|
+
this.sessionReadIssue = null;
|
|
632
|
+
}
|
|
560
633
|
}
|
|
561
634
|
catch (error) {
|
|
562
|
-
if (live())
|
|
563
|
-
|
|
635
|
+
if (live()) {
|
|
636
|
+
const issue = this.issue(error);
|
|
637
|
+
const waiting = (initial || this.current.sessionReadinessPending) && this.sessionSourceId === id && this.sessionSource !== null && this.current.session === null
|
|
638
|
+
&& this.sessionSource.getSnapshot().sessionId === id
|
|
639
|
+
&& issue.kind === "domain" && issue.code === "unavailable" && issue.field === "sessionId";
|
|
640
|
+
if (!waiting)
|
|
641
|
+
this.endReadiness();
|
|
642
|
+
if (!preserveFeedback || this.current.sessionIssue === null || this.current.sessionIssue === this.sessionReadIssue)
|
|
643
|
+
this.publish({ sessionIssue: issue });
|
|
644
|
+
this.sessionReadIssue = issue;
|
|
645
|
+
if (waiting && this.readinessTimer === null) {
|
|
646
|
+
const source = this.sessionSource, connection = this.connectionBaseline;
|
|
647
|
+
const timer = setTimeout(() => {
|
|
648
|
+
if (this.readinessTimer !== timer || this.disposed || source !== this.sessionSource || id !== this.current.currentSessionId || connection !== this.connectionBaseline)
|
|
649
|
+
return;
|
|
650
|
+
this.readinessTimer = null;
|
|
651
|
+
this.publish({ sessionReadinessPending: false });
|
|
652
|
+
}, 10_000);
|
|
653
|
+
this.readinessTimer = timer;
|
|
654
|
+
this.publish({ sessionReadinessPending: true });
|
|
655
|
+
}
|
|
656
|
+
}
|
|
564
657
|
}
|
|
565
658
|
finally {
|
|
566
659
|
if (live()) {
|
|
@@ -774,11 +867,12 @@ export class ProfilesController {
|
|
|
774
867
|
}
|
|
775
868
|
}
|
|
776
869
|
async refresh() {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
870
|
+
const session = this.refreshSession();
|
|
871
|
+
await Promise.all([session, this.perform("refresh", async (live) => {
|
|
872
|
+
const snapshot = await this.unwrap(this.remote.describe());
|
|
873
|
+
if (live())
|
|
874
|
+
this.publish({ snapshot });
|
|
875
|
+
})]);
|
|
782
876
|
}
|
|
783
877
|
async open(id) {
|
|
784
878
|
if (this.disposed || this.current.busy !== null || this.current.pendingEditor !== null)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const DEPLOYMENT_NS = "plugins.dsmm";
|
|
2
2
|
export const deploymentEn = {
|
|
3
3
|
title: "DSMM", summary: "Global config and profile overrides",
|
|
4
|
-
description: "Layers save independently;
|
|
4
|
+
description: "Layers save independently; running sessions retain their admitted settings.",
|
|
5
5
|
global: "DSMM Global config", globalHint: "Shared by this Home. Unset fields use built-in defaults.",
|
|
6
6
|
profile: "Current DSH profile overrides", profileHint: "This profile only. Unset fields use Global, then Host defaults.",
|
|
7
7
|
profileUnavailable: "Unavailable",
|
|
@@ -45,7 +45,7 @@ export const deploymentEn = {
|
|
|
45
45
|
};
|
|
46
46
|
export const deploymentZh = {
|
|
47
47
|
title: "DSMM", summary: "全局配置与当前配置覆盖",
|
|
48
|
-
description: "
|
|
48
|
+
description: "两层独立保存,运行中会话保留已准入设置。",
|
|
49
49
|
global: "DSMM 全局配置", globalHint: "同一 Home 共用;未设置字段使用内建默认值。",
|
|
50
50
|
profile: "当前 DSH 配置覆盖", profileHint: "仅影响此配置。未设置字段依次使用全局与宿主默认值。",
|
|
51
51
|
profileUnavailable: "不可用",
|
|
@@ -89,6 +89,7 @@ export const deploymentZh = {
|
|
|
89
89
|
};
|
|
90
90
|
/** Stable public field names stay visible alongside localized context. */
|
|
91
91
|
export const deploymentFieldLabels = {
|
|
92
|
+
rootModelPolicy: ["Root model policy (native: user model; configured: admitted routes, all clients)", "根模型策略(native:用户模型;configured:准入路由,所有客户端)"],
|
|
92
93
|
modelParameters: ["Model parameters", "模型参数"], passthrough: ["Model parameter passthrough", "模型参数透传"], locale: ["Agent business language", "Agent 业务语言"],
|
|
93
94
|
permissionControl: ["Permission-control module", "权限控制子模块"],
|
|
94
95
|
modules: ["Modules", "子模块"], skills: ["Skills", "技能"], roles: ["Agent roles", "Agent 角色"],
|
|
@@ -6,7 +6,7 @@ export function moduleFor(path) {
|
|
|
6
6
|
const key = path.split(".")[0];
|
|
7
7
|
if (["defaultActive", "modules", "modelParameters", "runtime"].includes(key))
|
|
8
8
|
return "run";
|
|
9
|
-
if (["roleRouting", "runtimePolicy", "runtimeRecovery"].includes(key))
|
|
9
|
+
if (["rootModelPolicy", "roleRouting", "runtimePolicy", "runtimeRecovery"].includes(key))
|
|
10
10
|
return "routes";
|
|
11
11
|
if (["workflow", "roles", "skills", "presets", "businessLocale", "locale", "promptOrder", "subagents"].includes(key))
|
|
12
12
|
return "workflow";
|
package/lib/client/index.js
CHANGED
|
@@ -82,7 +82,6 @@ export async function apply(ctx) {
|
|
|
82
82
|
void profileCtx.inject(["connection"], connectionCtx => {
|
|
83
83
|
controller.bindConnection(connectionCtx.connection.generation);
|
|
84
84
|
void controller.refresh();
|
|
85
|
-
void controller.refreshSession();
|
|
86
85
|
connectionCtx.effect(() => () => controller.bindConnection(null), "dsmm: profile connection withdrawal");
|
|
87
86
|
});
|
|
88
87
|
profiles = controller;
|
|
@@ -124,21 +123,40 @@ export async function apply(ctx) {
|
|
|
124
123
|
controller.attachModelSelector(catalogCtx.remote.session);
|
|
125
124
|
catalogCtx.effect(() => () => { controller.attachModelSelector(null); controller.attachCatalog(null); }, "dsmm: native catalog/selector lifetime");
|
|
126
125
|
});
|
|
127
|
-
void profileCtx.inject(["uiSession", "sessions"], (sessionCtx) => {
|
|
126
|
+
void profileCtx.inject(["uiSession", "sessions", "connection"], (sessionCtx) => {
|
|
128
127
|
const source = sessionCtx.uiSession.adapter.current;
|
|
129
128
|
// This adapter compiles with both Host and Client Cordis declarations;
|
|
130
129
|
// the injected browser service has the public Client Sessions face.
|
|
131
130
|
const nativeSessions = sessionCtx.sessions;
|
|
131
|
+
const connection = sessionCtx.connection.generation;
|
|
132
|
+
let attached;
|
|
133
|
+
sessionCtx.effect(() => {
|
|
134
|
+
let stopReady;
|
|
135
|
+
const subscribe = () => {
|
|
136
|
+
stopReady?.();
|
|
137
|
+
const generation = connection.getSnapshot();
|
|
138
|
+
stopReady = generation === undefined ? undefined : sessionCtx.remote.$on("api-session/added", summary => {
|
|
139
|
+
const binding = source.getSnapshot();
|
|
140
|
+
if (connection.getSnapshot() !== generation || binding.key !== summary.sessionId || attached === undefined || nativeSessions.binding(summary.sessionId) !== attached)
|
|
141
|
+
return;
|
|
142
|
+
controller.observeSessionAvailability(summary.sessionId, attached.session, summary.agentAvailable);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
subscribe();
|
|
146
|
+
const stopConnection = connection.subscribe(subscribe);
|
|
147
|
+
return () => { stopConnection(); stopReady?.(); };
|
|
148
|
+
}, "dsmm: native Agent readiness");
|
|
132
149
|
const update = () => {
|
|
133
150
|
const binding = source.getSnapshot();
|
|
134
151
|
const nativeBinding = binding.key === undefined ? undefined : nativeSessions.binding(binding.key);
|
|
135
|
-
|
|
152
|
+
attached = nativeBinding;
|
|
153
|
+
controller.attachSessionSource(binding.key ?? null, nativeBinding?.session ?? null, nativeBinding ?? null);
|
|
136
154
|
controller.setSession(binding.key ?? null);
|
|
137
155
|
controller.attachModelSelectionSource(binding.key ?? null, binding.key === undefined ? null : binding.keyedHooks.projection?.("modelSelection") ?? null);
|
|
138
156
|
controller.attachModelEventSource(binding.key ?? null, nativeBinding?.eventSource ?? null);
|
|
139
157
|
};
|
|
140
|
-
update();
|
|
141
158
|
sessionCtx.effect(() => source.subscribe(update), "dsmm: current native session");
|
|
159
|
+
update();
|
|
142
160
|
sessionCtx.effect(() => () => { controller.attachModelSelectionSource(null, null); controller.attachModelEventSource(null, null); controller.attachModelInteractionSource(null, null); controller.setSession(null); controller.attachSessionSource(null, null); }, "dsmm: native session withdrawal");
|
|
143
161
|
void sessionCtx.inject(["modelDirectories", "remote.session"], (modelCtx) => {
|
|
144
162
|
const updateInteraction = () => {
|
package/lib/client/locales.d.ts
CHANGED
package/lib/client/locales.js
CHANGED
|
@@ -9,6 +9,7 @@ export const en = {
|
|
|
9
9
|
sessionSelectionBlock: "Finish choosing this session's configuration to continue typing.",
|
|
10
10
|
sessionCommittedRefresh: "Saved. Refresh to confirm it.",
|
|
11
11
|
sessionUnconfirmedRefresh: "The result is unknown. Refresh before choosing or sending again.",
|
|
12
|
+
sessionWaitingReady: "Waiting for the session to be ready…",
|
|
12
13
|
technicalDetails: "Details",
|
|
13
14
|
diagnosticJsonc: "Fix the JSONC syntax at the marked location.", diagnosticDuplicate: "Remove the duplicate field.", diagnosticUnsafe: "Unsafe object keys are not supported; remove this field.", diagnosticUnknown: "Remove this unsupported field.", diagnosticDeprecated: "This retired field is rejected. Configure explicit role levels instead.", diagnosticType: "Use the declared field type and a value in range.", diagnosticValue: "Choose a supported value.", diagnosticRoute: "Use a complete provider/model route, or a nonempty reasoning effort.", diagnosticRequired: "This role is required by the selected workflow policy and cannot be disabled.", diagnosticCeiling: "A profile cannot enable what the deployment does not allow.",
|
|
14
15
|
browseZone: "Saved profiles", editZone: "Edit profile", savedRevision: "Version: {revision}", savedInventory: "Warnings and errors", futurePin: "Default version: {revision}", noEditor: "Choose a profile or create one to edit.",
|
|
@@ -127,6 +128,7 @@ export const zh = {
|
|
|
127
128
|
sessionSelectionBlock: "请先完成本次会话的配置选择,然后即可继续输入。",
|
|
128
129
|
sessionCommittedRefresh: "已保存,请刷新确认。",
|
|
129
130
|
sessionUnconfirmedRefresh: "结果未知,请刷新后再选择或发送。",
|
|
131
|
+
sessionWaitingReady: "正在等待会话就绪…",
|
|
130
132
|
technicalDetails: "详情",
|
|
131
133
|
diagnosticJsonc: "请修正标记位置的 JSONC 语法。", diagnosticDuplicate: "请删除重复字段。", diagnosticUnsafe: "不支持不安全的对象键,请删除该字段。", diagnosticUnknown: "请删除不支持的字段。", diagnosticDeprecated: "该字段已停用,请改用明确的角色等级。", diagnosticType: "请使用声明的字段类型和范围内的值。", diagnosticValue: "请选择支持的值。", diagnosticRoute: "请填写完整的提供商与模型,或非空的推理强度。", diagnosticRequired: "所选工作流策略要求该角色,不能禁用。", diagnosticCeiling: "配置不能启用部署未允许的能力。",
|
|
132
134
|
browseZone: "已保存配置", editZone: "编辑配置", savedRevision: "版本:{revision}", savedInventory: "警告与错误", futurePin: "默认版本:{revision}", noEditor: "选择或新建配置后进行编辑。",
|