@dsmm/dsmm 0.3.13 → 0.3.15
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 +77 -36
- package/docs/agent-presets.md +1 -1
- package/docs/compatibility.md +2 -2
- package/docs/deferred-native-approval-risk.md +4 -4
- package/docs/design.md +1 -1
- package/docs/lsp.md +1 -1
- package/docs/model-routing.md +1 -1
- package/docs/native-permissions.md +12 -2
- package/docs/profiles.md +14 -5
- package/docs/roadmap.md +67 -30
- package/docs/runtime-recovery.md +1 -1
- package/docs/safety-guards.md +1 -1
- package/docs/settings-status.md +1 -1
- package/lib/client/DeploymentFields.js +3 -1
- package/lib/client/DeploymentPage.js +34 -2
- package/lib/client/EditableChoice.js +5 -2
- package/lib/client/PermissionsPanel.js +1 -1
- package/lib/client/ProfileModelsDialog.d.ts +4 -2
- package/lib/client/ProfileModelsDialog.js +46 -7
- package/lib/client/ProfilesSection.js +47 -17
- package/lib/client/RoleToolView-locales.d.ts +1 -1
- package/lib/client/RoleToolView-locales.js +2 -2
- package/lib/client/SessionProfiles.js +24 -6
- package/lib/client/children-locales.d.ts +1 -1
- package/lib/client/controller.d.ts +23 -1
- package/lib/client/controller.js +289 -8
- package/lib/client/deployment-locales.d.ts +2 -0
- package/lib/client/deployment-locales.js +3 -1
- package/lib/client/index.js +10 -2
- package/lib/client/locales.d.ts +8 -0
- package/lib/client/locales.js +16 -6
- package/lib/client/profile-blank.d.ts +43 -0
- package/lib/client/profile-blank.js +19 -0
- package/lib/client/session-labels.d.ts +1 -0
- package/lib/client/session-labels.js +3 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +27 -12
- package/lib/client.js +714 -234
- package/lib/command-approval.d.ts +2 -0
- package/lib/command-approval.js +4 -1
- package/lib/index.js +2 -1
- package/lib/native-admission.d.ts +10 -3
- package/lib/native-admission.js +129 -28
- package/lib/profile-runtime.js +3 -5
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -3552,6 +3552,10 @@ var ProfilesController = class {
|
|
|
3552
3552
|
sessionUnconfirmed: false,
|
|
3553
3553
|
session: null,
|
|
3554
3554
|
sessionChoice: null,
|
|
3555
|
+
sessionWorkspaces: [],
|
|
3556
|
+
sessionWorkspaceId: null,
|
|
3557
|
+
sessionPreparationAvailable: false,
|
|
3558
|
+
sessionPreparationPending: false,
|
|
3555
3559
|
sessionBusy: null,
|
|
3556
3560
|
sessionIssue: null,
|
|
3557
3561
|
sessionNotice: null,
|
|
@@ -3564,6 +3568,9 @@ var ProfilesController = class {
|
|
|
3564
3568
|
generation = 0;
|
|
3565
3569
|
disposed = false;
|
|
3566
3570
|
sessionGeneration = 0;
|
|
3571
|
+
blankNative = null;
|
|
3572
|
+
stopWorkspaces = null;
|
|
3573
|
+
preparation = null;
|
|
3567
3574
|
pendingSessionSelections = /* @__PURE__ */ new Set();
|
|
3568
3575
|
connection = null;
|
|
3569
3576
|
connectionBaseline;
|
|
@@ -3586,6 +3593,9 @@ var ProfilesController = class {
|
|
|
3586
3593
|
modelEventsWatermark = -1;
|
|
3587
3594
|
modeEventsWatermark = -1;
|
|
3588
3595
|
modeRefreshPending = false;
|
|
3596
|
+
sessionSource = null;
|
|
3597
|
+
sessionSourceId = null;
|
|
3598
|
+
stopSessionSource = null;
|
|
3589
3599
|
stopModelEvents = null;
|
|
3590
3600
|
modelInteraction = null;
|
|
3591
3601
|
modelInteractionSessionId = null;
|
|
@@ -3622,6 +3632,7 @@ var ProfilesController = class {
|
|
|
3622
3632
|
chooseSessionProfile: (id2) => {
|
|
3623
3633
|
if (!this.disposed && this.connectionCurrent() && !this.current.sessionUnconfirmed && this.current.sessionBusy === null && this.current.busy === null && !this.current.dirty && this.current.pendingEditor === null && this.current.invalidFields.length === 0) this.publish({ sessionChoice: id2, sessionNotice: null });
|
|
3624
3634
|
},
|
|
3635
|
+
chooseSessionWorkspace: (id2) => this.chooseSessionWorkspace(id2),
|
|
3625
3636
|
applySession: (options) => this.selectSession(false, options),
|
|
3626
3637
|
resetSession: () => this.selectSession(true),
|
|
3627
3638
|
setDeepwork: (active) => this.setDeepwork(active),
|
|
@@ -3644,9 +3655,13 @@ var ProfilesController = class {
|
|
|
3644
3655
|
};
|
|
3645
3656
|
numberDrafts = /* @__PURE__ */ new Map();
|
|
3646
3657
|
dispose() {
|
|
3658
|
+
this.releasePreparation();
|
|
3659
|
+
this.stopWorkspaces?.();
|
|
3647
3660
|
this.releaseComposerBlock();
|
|
3648
3661
|
this.numberDrafts.clear();
|
|
3649
3662
|
this.stopConnection?.();
|
|
3663
|
+
this.stopSessionSource?.();
|
|
3664
|
+
this.sessionSource = null;
|
|
3650
3665
|
this.disposed = true;
|
|
3651
3666
|
this.generation += 1;
|
|
3652
3667
|
this.sessionGeneration += 1;
|
|
@@ -3674,9 +3689,11 @@ var ProfilesController = class {
|
|
|
3674
3689
|
this.connectionBound = true;
|
|
3675
3690
|
this.connectionBaseline = source?.getSnapshot();
|
|
3676
3691
|
const invalidate = () => {
|
|
3692
|
+
this.releasePreparation();
|
|
3677
3693
|
this.connectionBaseline = source?.getSnapshot();
|
|
3678
3694
|
this.generation += 1;
|
|
3679
3695
|
this.sessionGeneration += 1;
|
|
3696
|
+
this.modeRefreshPending = false;
|
|
3680
3697
|
this.modelSelectorGeneration += 1;
|
|
3681
3698
|
this.publish({
|
|
3682
3699
|
session: null,
|
|
@@ -3684,6 +3701,8 @@ var ProfilesController = class {
|
|
|
3684
3701
|
sessionNotice: null,
|
|
3685
3702
|
sessionUnconfirmed: false,
|
|
3686
3703
|
sessionViewEpoch: this.current.sessionViewEpoch + 1,
|
|
3704
|
+
sessionWorkspaceId: null,
|
|
3705
|
+
sessionPreparationPending: false,
|
|
3687
3706
|
busy: null,
|
|
3688
3707
|
issue: { kind: "transport", code: "unavailable" }
|
|
3689
3708
|
});
|
|
@@ -3700,12 +3719,188 @@ var ProfilesController = class {
|
|
|
3700
3719
|
connectionCurrent() {
|
|
3701
3720
|
return !this.connectionBound || this.connectionBaseline !== void 0 && this.connection?.getSnapshot() === this.connectionBaseline;
|
|
3702
3721
|
}
|
|
3722
|
+
attachBlankNative(native) {
|
|
3723
|
+
if (this.disposed) return;
|
|
3724
|
+
this.cancelPreparation();
|
|
3725
|
+
this.stopWorkspaces?.();
|
|
3726
|
+
this.blankNative = native;
|
|
3727
|
+
const update = () => {
|
|
3728
|
+
const sessionWorkspaces = native?.workspaces.getSnapshot() ?? [];
|
|
3729
|
+
const sessionWorkspaceId = sessionWorkspaces.some((item) => item.id === this.current.sessionWorkspaceId) ? this.current.sessionWorkspaceId : null;
|
|
3730
|
+
if (this.preparation !== null && sessionWorkspaceId !== this.preparation.workspaceId) this.cancelPreparation();
|
|
3731
|
+
this.publish({ sessionWorkspaces, sessionWorkspaceId, sessionPreparationAvailable: native !== null && this.composerBlocks !== null });
|
|
3732
|
+
};
|
|
3733
|
+
this.stopWorkspaces = native?.workspaces.subscribe(update) ?? null;
|
|
3734
|
+
update();
|
|
3735
|
+
}
|
|
3736
|
+
releasePreparation() {
|
|
3737
|
+
const task = this.preparation;
|
|
3738
|
+
this.preparation = null;
|
|
3739
|
+
if (task === null) return;
|
|
3740
|
+
task.stop();
|
|
3741
|
+
const held = task.held;
|
|
3742
|
+
if (held !== null && task.id !== null && held.blocks.storeFor(task.id) === held.store && held.store.getSnapshot() === held.block) held.blocks.set(task.id, void 0);
|
|
3743
|
+
task.reference?.release();
|
|
3744
|
+
}
|
|
3745
|
+
cancelPreparation() {
|
|
3746
|
+
if (this.preparation === null) return;
|
|
3747
|
+
this.releasePreparation();
|
|
3748
|
+
this.sessionGeneration += 1;
|
|
3749
|
+
this.publish({ sessionBusy: null, sessionUnconfirmed: false, sessionPreparationPending: false, sessionNotice: null });
|
|
3750
|
+
}
|
|
3751
|
+
async chooseSessionWorkspace(id2) {
|
|
3752
|
+
if (this.disposed || !this.connectionCurrent() || this.current.currentSessionId !== null || !this.current.sessionWorkspaces.some((item) => item.id === id2) || this.current.dirty || this.current.invalidFields.length > 0 || this.current.pendingEditor !== null || this.current.busy !== null) return;
|
|
3753
|
+
const pending = this.current.sessionPreparationPending;
|
|
3754
|
+
if (id2 !== this.current.sessionWorkspaceId) this.cancelPreparation();
|
|
3755
|
+
this.publish({ sessionWorkspaceId: id2, sessionIssue: null });
|
|
3756
|
+
if (pending) await this.prepareSession();
|
|
3757
|
+
}
|
|
3758
|
+
preparationOwned(task) {
|
|
3759
|
+
return !this.disposed && this.connectionCurrent() && this.preparation === task && this.current.currentSessionId === null && this.current.sessionWorkspaceId === task.workspaceId;
|
|
3760
|
+
}
|
|
3761
|
+
preparationCurrent(task) {
|
|
3762
|
+
return this.preparationOwned(task) && !task.navigation.aborted;
|
|
3763
|
+
}
|
|
3764
|
+
preparationConfirmed(task, session) {
|
|
3765
|
+
const selection = session.admittedSelection;
|
|
3766
|
+
return selection !== void 0 && !selection.refreshRequired && session.sessionId === task.id && !session.refreshRequired && !session.selection.refreshRequired && writableSelectionVersion(session.selection.selectionRevision) && selection.selectedId === task.selectedId && selection.appliedRevision === task.revision && session.selection.selectedId === task.selectedId && session.selection.appliedRevision === task.revision;
|
|
3767
|
+
}
|
|
3768
|
+
openPrepared(task, explicit = false) {
|
|
3769
|
+
if (!this.preparationOwned(task) || !explicit && task.navigation.aborted || task.id === null || this.current.busy !== null || this.current.dirty || this.current.invalidFields.length > 0 || this.current.pendingEditor !== null) return;
|
|
3770
|
+
task.opening = true;
|
|
3771
|
+
try {
|
|
3772
|
+
this.publish({ sessionUnconfirmed: true });
|
|
3773
|
+
if (this.preparationOwned(task)) task.native.openSession(task.id);
|
|
3774
|
+
} finally {
|
|
3775
|
+
task.opening = false;
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
async prepareSession(refreshOnly = false) {
|
|
3779
|
+
const { sessionWorkspaceId: workspaceId, sessionChoice: selectedId, snapshot: snapshot4 } = this.current;
|
|
3780
|
+
const native = this.blankNative;
|
|
3781
|
+
if (this.disposed || !this.connectionCurrent() || native === null || this.composerBlocks === null || this.composerReason === null || this.current.currentSessionId !== null || this.current.sessionBusy !== null || this.current.busy !== null || this.current.dirty || this.current.invalidFields.length > 0 || this.current.pendingEditor !== null || snapshot4 === null) return;
|
|
3782
|
+
if (workspaceId === null) {
|
|
3783
|
+
if (!refreshOnly) this.publish({ sessionPreparationPending: true });
|
|
3784
|
+
return;
|
|
3785
|
+
}
|
|
3786
|
+
if (this.current.sessionUnconfirmed && !refreshOnly) return;
|
|
3787
|
+
const profile = snapshot4.profiles.find((item) => item.id === selectedId), revision2 = selectedId === null ? null : profile?.revision;
|
|
3788
|
+
if (!refreshOnly && selectedId !== null && (!isConfigRevision(revision2) || profile?.error !== void 0)) return;
|
|
3789
|
+
let task = this.preparation;
|
|
3790
|
+
const openOnly = !refreshOnly && task?.confirmed === true && task.selectedId === selectedId && task.revision === (revision2 ?? null);
|
|
3791
|
+
if (task === null) {
|
|
3792
|
+
if (refreshOnly) return;
|
|
3793
|
+
const navigation = native.beginNavigation();
|
|
3794
|
+
task = { native, navigation, workspaceId, selectedId, revision: revision2 ?? null, id: null, reference: null, held: null, confirmed: false, opening: false, stop: () => {
|
|
3795
|
+
} };
|
|
3796
|
+
this.preparation = task;
|
|
3797
|
+
} else if (!refreshOnly && !openOnly) {
|
|
3798
|
+
task.selectedId = selectedId;
|
|
3799
|
+
task.revision = revision2 ?? null;
|
|
3800
|
+
task.confirmed = false;
|
|
3801
|
+
}
|
|
3802
|
+
if (!refreshOnly && !openOnly) {
|
|
3803
|
+
task.stop();
|
|
3804
|
+
if (task.navigation.aborted) task.navigation = native.beginNavigation();
|
|
3805
|
+
const navigation = task.navigation;
|
|
3806
|
+
const owned2 = task;
|
|
3807
|
+
const abort = () => {
|
|
3808
|
+
if (this.preparation === owned2 && !owned2.opening) this.cancelPreparation();
|
|
3809
|
+
};
|
|
3810
|
+
navigation.addEventListener("abort", abort, { once: true });
|
|
3811
|
+
task.stop = () => navigation.removeEventListener("abort", abort);
|
|
3812
|
+
}
|
|
3813
|
+
const owned = task;
|
|
3814
|
+
const live = () => refreshOnly ? this.preparationOwned(owned) : this.preparationCurrent(owned);
|
|
3815
|
+
this.publish({ sessionBusy: refreshOnly ? "read" : "apply", sessionPreparationPending: false, sessionIssue: null, sessionNotice: null });
|
|
3816
|
+
try {
|
|
3817
|
+
if (openOnly) {
|
|
3818
|
+
this.openPrepared(task, true);
|
|
3819
|
+
return;
|
|
3820
|
+
}
|
|
3821
|
+
if (!live()) return;
|
|
3822
|
+
if (task.id === null) {
|
|
3823
|
+
if (refreshOnly) throw { kind: "transport", code: "unavailable" };
|
|
3824
|
+
const id3 = await native.connectWorkspace(workspaceId);
|
|
3825
|
+
if (!live()) return;
|
|
3826
|
+
task.id = id3;
|
|
3827
|
+
}
|
|
3828
|
+
const id2 = task.id;
|
|
3829
|
+
if (task.reference === null) {
|
|
3830
|
+
task.reference = native.retain(id2);
|
|
3831
|
+
if (!live()) {
|
|
3832
|
+
task.reference.release();
|
|
3833
|
+
return;
|
|
3834
|
+
}
|
|
3835
|
+
if (task.reference.sessionId !== id2) throw { kind: "assembly", code: "unavailable" };
|
|
3836
|
+
}
|
|
3837
|
+
if (task.held === null) {
|
|
3838
|
+
const blocks = this.composerBlocks, store = blocks.storeFor(id2);
|
|
3839
|
+
if (store.getSnapshot() !== void 0) throw { kind: "domain", code: "busy" };
|
|
3840
|
+
const block = { reason: this.composerReason() };
|
|
3841
|
+
task.held = { blocks, store, block };
|
|
3842
|
+
blocks.set(id2, block);
|
|
3843
|
+
}
|
|
3844
|
+
const binding = await task.reference.ready;
|
|
3845
|
+
if (!live()) return;
|
|
3846
|
+
if (binding.sessionId !== id2) throw { kind: "assembly", code: "unavailable" };
|
|
3847
|
+
const session = await this.unwrap(this.remote.describeSession(id2));
|
|
3848
|
+
if (!live()) return;
|
|
3849
|
+
if (session.sessionId !== id2) throw { kind: "assembly", code: "unavailable" };
|
|
3850
|
+
if (refreshOnly) {
|
|
3851
|
+
task.confirmed = this.preparationConfirmed(task, session);
|
|
3852
|
+
if (task.confirmed) {
|
|
3853
|
+
this.publish({ sessionUnconfirmed: false });
|
|
3854
|
+
this.openPrepared(task);
|
|
3855
|
+
return;
|
|
3856
|
+
}
|
|
3857
|
+
const uncertain = session.refreshRequired === true || session.selection.refreshRequired === true;
|
|
3858
|
+
this.publish({ sessionUnconfirmed: uncertain, sessionIssue: { kind: "domain", code: uncertain ? "unavailable" : "conflict" } });
|
|
3859
|
+
return;
|
|
3860
|
+
}
|
|
3861
|
+
if (session.refreshRequired || session.selection.refreshRequired || !writableSelectionVersion(session.selection.selectionRevision)) throw { kind: "domain", code: "conflict" };
|
|
3862
|
+
if (session.canApplyOverlay !== true || session.applyOverlayUnavailableReason === "new-session-required") throw { kind: "domain", code: session.applyOverlayUnavailableReason ?? "unavailable" };
|
|
3863
|
+
const held = task.held;
|
|
3864
|
+
if (held === null || held.blocks.storeFor(id2) !== held.store || held.store.getSnapshot() !== held.block) throw { kind: "domain", code: "busy" };
|
|
3865
|
+
if (this.current.dirty || this.current.invalidFields.length > 0 || this.current.pendingEditor !== null) throw { kind: "domain", code: "conflict" };
|
|
3866
|
+
this.pendingSessionSelections.add(id2);
|
|
3867
|
+
const accepted = await this.unwrap(this.remote.selectSession(id2, {
|
|
3868
|
+
sessionId: id2,
|
|
3869
|
+
id: task.selectedId,
|
|
3870
|
+
...task.selectedId === null ? {} : { expectedRevision: task.revision },
|
|
3871
|
+
expectedSelectionRevision: session.selection.selectionRevision,
|
|
3872
|
+
expectedAdmissionEpoch: session.admissionEpoch
|
|
3873
|
+
}));
|
|
3874
|
+
if (!live()) return;
|
|
3875
|
+
if (!this.preparationConfirmed(task, accepted)) {
|
|
3876
|
+
this.publish({ sessionUnconfirmed: true });
|
|
3877
|
+
return;
|
|
3878
|
+
}
|
|
3879
|
+
task.confirmed = true;
|
|
3880
|
+
this.openPrepared(task);
|
|
3881
|
+
} catch (error) {
|
|
3882
|
+
if (this.preparationOwned(task)) {
|
|
3883
|
+
const issue = this.issue(error), uncertain = task.confirmed || issue.kind !== "domain" || issue.code === "cancelled";
|
|
3884
|
+
this.publish({ sessionIssue: task.id === null && uncertain ? { kind: "assembly", code: "blank-identity-unconfirmed" } : issue, sessionUnconfirmed: uncertain });
|
|
3885
|
+
if (!uncertain) this.releasePreparation();
|
|
3886
|
+
}
|
|
3887
|
+
} finally {
|
|
3888
|
+
if (task.id !== null) this.pendingSessionSelections.delete(task.id);
|
|
3889
|
+
if (this.preparationOwned(task)) this.publish({ sessionBusy: null });
|
|
3890
|
+
else if (!this.disposed && this.current.currentSessionId === null && this.preparation === null) this.publish({ sessionBusy: null });
|
|
3891
|
+
else if (!this.disposed && this.connectionCurrent() && task.id === this.current.currentSessionId) {
|
|
3892
|
+
this.modeRefreshPending = true;
|
|
3893
|
+
this.refreshObservedMode();
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3703
3897
|
attachComposerBlocks(blocks, reason) {
|
|
3704
3898
|
if (this.disposed) return;
|
|
3899
|
+
if (blocks !== this.composerBlocks && this.preparation !== null) this.cancelPreparation();
|
|
3705
3900
|
this.releaseComposerBlock();
|
|
3706
3901
|
this.composerBlocks = blocks;
|
|
3707
3902
|
this.composerReason = reason ?? null;
|
|
3708
|
-
this.
|
|
3903
|
+
this.publish({ sessionPreparationAvailable: this.blankNative !== null && blocks !== null });
|
|
3709
3904
|
}
|
|
3710
3905
|
releaseComposerBlock() {
|
|
3711
3906
|
const held = this.composerBlock;
|
|
@@ -3738,6 +3933,34 @@ var ProfilesController = class {
|
|
|
3738
3933
|
this.modelSelectionGeneration += 1;
|
|
3739
3934
|
}) ?? null;
|
|
3740
3935
|
}
|
|
3936
|
+
attachSessionSource(sessionId2, source) {
|
|
3937
|
+
if (this.disposed || sessionId2 === this.sessionSourceId && source === this.sessionSource) return;
|
|
3938
|
+
this.stopSessionSource?.();
|
|
3939
|
+
this.sessionSourceId = sessionId2;
|
|
3940
|
+
this.sessionSource = source;
|
|
3941
|
+
let running = source?.getSnapshot().running;
|
|
3942
|
+
const current = () => !this.disposed && sessionId2 !== null && sessionId2 === this.current.currentSessionId && source === this.sessionSource;
|
|
3943
|
+
this.stopSessionSource = source?.subscribe(() => {
|
|
3944
|
+
if (!current()) return;
|
|
3945
|
+
const next = source.getSnapshot().running;
|
|
3946
|
+
if (next === running) return;
|
|
3947
|
+
running = next;
|
|
3948
|
+
this.modeRefreshPending = true;
|
|
3949
|
+
this.refreshObservedMode();
|
|
3950
|
+
}) ?? null;
|
|
3951
|
+
if (current()) {
|
|
3952
|
+
this.sessionGeneration += 1;
|
|
3953
|
+
this.modeRefreshPending = source !== null;
|
|
3954
|
+
this.publish({
|
|
3955
|
+
session: null,
|
|
3956
|
+
sessionBusy: null,
|
|
3957
|
+
sessionNotice: null,
|
|
3958
|
+
sessionViewEpoch: this.current.sessionViewEpoch + 1,
|
|
3959
|
+
sessionUnconfirmed: this.pendingSessionSelections.has(sessionId2)
|
|
3960
|
+
});
|
|
3961
|
+
this.refreshObservedMode();
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3741
3964
|
attachModelEventSource(sessionId2, source) {
|
|
3742
3965
|
if (this.disposed || sessionId2 === this.modelEventsSessionId && source === this.modelEvents) return;
|
|
3743
3966
|
this.modelEventsGeneration += 1;
|
|
@@ -3785,12 +4008,20 @@ var ProfilesController = class {
|
|
|
3785
4008
|
}
|
|
3786
4009
|
setSession(id2) {
|
|
3787
4010
|
if (this.disposed || id2 === this.current.currentSessionId) return;
|
|
4011
|
+
const task = this.preparation;
|
|
4012
|
+
const preparationUnconfirmed = task?.id === id2 && this.current.sessionUnconfirmed;
|
|
4013
|
+
if (task?.id === id2 && task.held !== null && id2 !== null) {
|
|
4014
|
+
this.composerBlock = { id: id2, store: task.held.store, block: task.held.block };
|
|
4015
|
+
task.held = null;
|
|
4016
|
+
}
|
|
4017
|
+
this.releasePreparation();
|
|
3788
4018
|
this.sessionGeneration += 1;
|
|
3789
4019
|
this.modeRefreshPending = false;
|
|
4020
|
+
if (id2 !== this.sessionSourceId) this.attachSessionSource(null, null);
|
|
3790
4021
|
if (id2 !== this.modelSelectionSessionId) this.attachModelSelectionSource(null, null);
|
|
3791
4022
|
if (id2 !== this.modelEventsSessionId) this.attachModelEventSource(null, null);
|
|
3792
4023
|
if (id2 !== this.modelInteractionSessionId) this.attachModelInteractionSource(null, null);
|
|
3793
|
-
this.publish({ currentSessionId: id2, sessionViewEpoch: this.current.sessionViewEpoch + 1, sessionUnconfirmed: id2 !== null && this.pendingSessionSelections.has(id2), session: null, sessionChoice: null, sessionBusy: null, sessionIssue: null, sessionNotice: null });
|
|
4024
|
+
this.publish({ currentSessionId: id2, sessionViewEpoch: this.current.sessionViewEpoch + 1, sessionPreparationPending: false, sessionUnconfirmed: id2 !== null && (preparationUnconfirmed || this.pendingSessionSelections.has(id2)), session: null, sessionChoice: null, sessionBusy: null, sessionIssue: null, sessionNotice: null });
|
|
3794
4025
|
if (id2 !== null) void this.refreshSession();
|
|
3795
4026
|
}
|
|
3796
4027
|
async refreshCatalog() {
|
|
@@ -3811,7 +4042,11 @@ var ProfilesController = class {
|
|
|
3811
4042
|
}
|
|
3812
4043
|
async refreshSession(preserveFeedback = false) {
|
|
3813
4044
|
const id2 = this.current.currentSessionId;
|
|
3814
|
-
if (
|
|
4045
|
+
if (id2 === null && this.preparation !== null) {
|
|
4046
|
+
await this.prepareSession(true);
|
|
4047
|
+
return;
|
|
4048
|
+
}
|
|
4049
|
+
if (this.disposed || !this.connectionCurrent() || id2 === null || this.current.sessionBusy !== null || this.sessionSourceId === id2 && this.sessionSource === null) return;
|
|
3815
4050
|
this.modeRefreshPending = false;
|
|
3816
4051
|
const generation = ++this.sessionGeneration;
|
|
3817
4052
|
const live = () => !this.disposed && this.connectionCurrent() && generation === this.sessionGeneration && id2 === this.current.currentSessionId;
|
|
@@ -3846,16 +4081,27 @@ var ProfilesController = class {
|
|
|
3846
4081
|
if (accepted.sessionId !== id2 || accepted.deepwork?.active !== active || !accepted.deepwork.explicit) throw { kind: "assembly", code: "unavailable" };
|
|
3847
4082
|
if (live()) this.publish({ session: accepted, sessionNotice: active ? "mode-on" : "mode-off" });
|
|
3848
4083
|
} catch (error) {
|
|
3849
|
-
if (live())
|
|
4084
|
+
if (live()) {
|
|
4085
|
+
const issue = this.issue(error);
|
|
4086
|
+
if (["busy", "maintenance", "conflict"].includes(issue.code)) this.modeRefreshPending = true;
|
|
4087
|
+
this.publish({ sessionIssue: issue });
|
|
4088
|
+
}
|
|
3850
4089
|
} finally {
|
|
3851
4090
|
if (live()) {
|
|
3852
4091
|
this.publish({ sessionBusy: null });
|
|
3853
4092
|
this.refreshObservedMode();
|
|
4093
|
+
} else if (!this.disposed && this.connectionCurrent() && id2 === this.current.currentSessionId) {
|
|
4094
|
+
this.modeRefreshPending = true;
|
|
4095
|
+
this.refreshObservedMode();
|
|
3854
4096
|
}
|
|
3855
4097
|
}
|
|
3856
4098
|
}
|
|
3857
4099
|
async selectSession(reset, options, modelOnly = false) {
|
|
3858
4100
|
const { currentSessionId: id2, session, sessionChoice, snapshot: snapshot4 } = this.current;
|
|
4101
|
+
if (id2 === null && !reset && !modelOnly && options?.useProfileModel !== true) {
|
|
4102
|
+
await this.prepareSession();
|
|
4103
|
+
return;
|
|
4104
|
+
}
|
|
3859
4105
|
if (this.disposed || !this.connectionCurrent() || this.current.sessionUnconfirmed || id2 === null || session === null || session.refreshRequired || session.selection.refreshRequired || !writableSelectionVersion(session.selection.selectionRevision) || (modelOnly ? session.canSelectModel !== true : session.canApplyOverlay !== true || session.applyOverlayUnavailableReason === "new-session-required") || this.current.sessionBusy !== null || this.current.busy !== null || this.current.dirty || this.current.invalidFields.length > 0 || this.current.pendingEditor !== null) return;
|
|
3860
4106
|
const selectedId = reset ? null : sessionChoice;
|
|
3861
4107
|
const profile = snapshot4?.profiles.find((profile2) => profile2.id === selectedId), revision2 = profile?.revision;
|
|
@@ -3935,6 +4181,7 @@ var ProfilesController = class {
|
|
|
3935
4181
|
} catch (error) {
|
|
3936
4182
|
if (live()) {
|
|
3937
4183
|
const issue = this.issue(error);
|
|
4184
|
+
if (["busy", "maintenance", "conflict"].includes(issue.code)) this.modeRefreshPending = true;
|
|
3938
4185
|
this.publish({ sessionIssue: issue, sessionUnconfirmed: !modelOnly && (issue.kind !== "domain" || issue.code === "cancelled") });
|
|
3939
4186
|
}
|
|
3940
4187
|
} finally {
|
|
@@ -4142,7 +4389,15 @@ var ProfilesController = class {
|
|
|
4142
4389
|
// src/client/locales.ts
|
|
4143
4390
|
var NS = "settings.dsmm-profiles";
|
|
4144
4391
|
var en = {
|
|
4145
|
-
sessionChooseWorkspace: "Choose a workspace
|
|
4392
|
+
sessionChooseWorkspace: "Choose a workspace and profile here. A blank session is prepared only when you confirm a profile choice.",
|
|
4393
|
+
sessionWorkspace: "Workspace",
|
|
4394
|
+
sessionWorkspacePlaceholder: "Choose a workspace…",
|
|
4395
|
+
sessionPrepare: "Open with this profile",
|
|
4396
|
+
sessionPrepareHint: "Choose a profile to prepare and open a blank session. The native model stays unchanged.",
|
|
4397
|
+
sessionPendingProfile: "Choose a workspace for: {profile}",
|
|
4398
|
+
sessionNoWorkspaces: "No workspaces available. Add or reconnect a workspace using native workspace navigation, then refresh.",
|
|
4399
|
+
sessionPreparationUnavailable: "Native workspace preparation is unavailable. Open a workspace using native navigation, then choose this session's profile.",
|
|
4400
|
+
sessionPreparationUnknown: "The Host did not return a session ID. Inspect the workspace using native navigation; this action will not automatically create or select again.",
|
|
4146
4401
|
sessionSelectionBlock: "Finish choosing this session's configuration to continue typing.",
|
|
4147
4402
|
sessionCommittedRefresh: "Saved. Refresh to confirm it.",
|
|
4148
4403
|
sessionUnconfirmedRefresh: "The result is unknown. Refresh before choosing or sending again.",
|
|
@@ -4237,14 +4492,14 @@ var en = {
|
|
|
4237
4492
|
viewConfiguration: "View JSONC source",
|
|
4238
4493
|
advancedSettings: "Advanced settings",
|
|
4239
4494
|
gitWriteGuard: "Git write protection",
|
|
4240
|
-
gitWriteScope: "
|
|
4495
|
+
gitWriteScope: "Git write protection scope",
|
|
4241
4496
|
gitWriteScopeDisabledHint: "Protection is off; inspection scope is inactive",
|
|
4242
4497
|
gitWriteGuardHint: "Inspection scope adjusts automatic Git protection only; explicit ask/deny still applies. Turning off does not authorize operations.",
|
|
4243
4498
|
gitWriteAsk: "Ask",
|
|
4244
4499
|
gitWriteDeny: "Deny",
|
|
4245
4500
|
gitWriteOff: "Off",
|
|
4246
|
-
gitWriteAllWrites: "All
|
|
4247
|
-
gitWriteHighRisk: "High-risk
|
|
4501
|
+
gitWriteAllWrites: "All write operations",
|
|
4502
|
+
gitWriteHighRisk: "High-risk write operations only",
|
|
4248
4503
|
topologyPerRole: "One tool per role",
|
|
4249
4504
|
topologyParameterized: "Select role in tool arguments",
|
|
4250
4505
|
roleModels: "Role models and availability",
|
|
@@ -4441,7 +4696,15 @@ var en = {
|
|
|
4441
4696
|
inheritRouteDesc: "Inherit defaults"
|
|
4442
4697
|
};
|
|
4443
4698
|
var zh = {
|
|
4444
|
-
sessionChooseWorkspace: "
|
|
4699
|
+
sessionChooseWorkspace: "在此选择工作区与方案;仅明确确认方案选择时才会准备空白会话。",
|
|
4700
|
+
sessionWorkspace: "工作区",
|
|
4701
|
+
sessionWorkspacePlaceholder: "请选择工作区…",
|
|
4702
|
+
sessionPrepare: "使用此方案打开",
|
|
4703
|
+
sessionPrepareHint: "选择方案后将准备并打开空白会话,保留原生模型。",
|
|
4704
|
+
sessionPendingProfile: "请为「{profile}」选择工作区",
|
|
4705
|
+
sessionNoWorkspaces: "暂无可用工作区。请通过原生工作区导航添加或重新连接工作区,然后刷新。",
|
|
4706
|
+
sessionPreparationUnavailable: "当前无法准备原生空白会话。请通过原生导航打开工作区,再选择本次会话方案。",
|
|
4707
|
+
sessionPreparationUnknown: "Host 未返回会话 ID。请通过原生导航检查工作区;本入口不会自动重复创建或提交选择。",
|
|
4445
4708
|
sessionSelectionBlock: "请先完成本次会话的配置选择,然后即可继续输入。",
|
|
4446
4709
|
sessionCommittedRefresh: "已保存,请刷新确认。",
|
|
4447
4710
|
sessionUnconfirmedRefresh: "结果未知,请刷新后再选择或发送。",
|
|
@@ -4536,14 +4799,14 @@ var zh = {
|
|
|
4536
4799
|
viewConfiguration: "查看配置内容",
|
|
4537
4800
|
advancedSettings: "高级设置",
|
|
4538
4801
|
gitWriteGuard: "Git 写入保护",
|
|
4539
|
-
gitWriteScope: "
|
|
4802
|
+
gitWriteScope: "Git 写操作保护范围",
|
|
4540
4803
|
gitWriteScopeDisabledHint: "保护已关闭,检查范围暂不生效",
|
|
4541
4804
|
gitWriteGuardHint: "检查范围只调整自动 Git 保护,显式 ask/deny 仍生效;关闭不代表授权。",
|
|
4542
4805
|
gitWriteAsk: "询问",
|
|
4543
4806
|
gitWriteDeny: "禁止",
|
|
4544
4807
|
gitWriteOff: "关闭",
|
|
4545
|
-
gitWriteAllWrites: "
|
|
4546
|
-
gitWriteHighRisk: "
|
|
4808
|
+
gitWriteAllWrites: "所有写操作",
|
|
4809
|
+
gitWriteHighRisk: "仅高风险写操作",
|
|
4547
4810
|
topologyPerRole: "每个角色独立入口",
|
|
4548
4811
|
topologyParameterized: "统一入口中选择角色",
|
|
4549
4812
|
roleModels: "角色模型与可用性",
|
|
@@ -4806,6 +5069,12 @@ function EditableChoice({ id: id2, label, value, options, disabled, placeholder,
|
|
|
4806
5069
|
placeholder,
|
|
4807
5070
|
autoComplete: "off",
|
|
4808
5071
|
onBlur: close,
|
|
5072
|
+
onClick: () => {
|
|
5073
|
+
if (!disabled && choices.length > 0 && !visible) {
|
|
5074
|
+
setOpen(true);
|
|
5075
|
+
setActiveId(null);
|
|
5076
|
+
}
|
|
5077
|
+
},
|
|
4809
5078
|
onChange: (event) => {
|
|
4810
5079
|
onChange(event.currentTarget.value);
|
|
4811
5080
|
setOpen(true);
|
|
@@ -4833,7 +5102,7 @@ function EditableChoice({ id: id2, label, value, options, disabled, placeholder,
|
|
|
4833
5102
|
{
|
|
4834
5103
|
type: "button",
|
|
4835
5104
|
size: "sm",
|
|
4836
|
-
variant: "
|
|
5105
|
+
variant: "ghost",
|
|
4837
5106
|
tabIndex: -1,
|
|
4838
5107
|
className: "dsmm-choice-toggle",
|
|
4839
5108
|
"aria-label": label,
|
|
@@ -5128,6 +5397,22 @@ function RoleAvailability({ value, t }) {
|
|
|
5128
5397
|
] });
|
|
5129
5398
|
}
|
|
5130
5399
|
|
|
5400
|
+
// src/client/session-labels.ts
|
|
5401
|
+
function displayRoleLabel(label) {
|
|
5402
|
+
return label.replace(/^DW\s+/u, "");
|
|
5403
|
+
}
|
|
5404
|
+
function sessionProfileLabels(session, t) {
|
|
5405
|
+
const admitted = session.admittedSelection;
|
|
5406
|
+
const profile = admitted === void 0 ? t("sessionGlobalCaptured") : admitted.selectedId === null ? t("sessionBaseline") : t("sessionAdmittedProfile", { id: admitted.selectedId, revision: t(configurationVersionState(admitted.sourceRevision)) });
|
|
5407
|
+
const future = session.globalDefault;
|
|
5408
|
+
return {
|
|
5409
|
+
admitted: t("sessionState", { profile, scope: session.scope }),
|
|
5410
|
+
futureDefault: t("sessionFutureDefault", {
|
|
5411
|
+
profile: !future || future.selectedId === null ? t("sessionBaseline") : t("sessionAdmittedProfile", { id: future.selectedId, revision: t(configurationVersionState(future.sourceRevision)) })
|
|
5412
|
+
})
|
|
5413
|
+
};
|
|
5414
|
+
}
|
|
5415
|
+
|
|
5131
5416
|
// src/client/ProfileModelsDialog.tsx
|
|
5132
5417
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
5133
5418
|
function locateFieldInsideRole(roleCard, field) {
|
|
@@ -5202,12 +5487,14 @@ function ProfileModelsDialog({
|
|
|
5202
5487
|
targetField,
|
|
5203
5488
|
onTargetLocated,
|
|
5204
5489
|
onJumpToJsonc,
|
|
5490
|
+
canSave: canSaveProp,
|
|
5205
5491
|
t
|
|
5206
5492
|
}) {
|
|
5207
5493
|
const prefix = (0, import_react3.useId)();
|
|
5208
5494
|
const [searchQuery, setSearchQuery] = (0, import_react3.useState)("");
|
|
5209
5495
|
const [filterExplicitOnly, setFilterExplicitOnly] = (0, import_react3.useState)(false);
|
|
5210
5496
|
const pendingFallbackFocusRef = (0, import_react3.useRef)(null);
|
|
5497
|
+
const dialogTopBarRef = (0, import_react3.useRef)(null);
|
|
5211
5498
|
const wasOpenRef = (0, import_react3.useRef)(open);
|
|
5212
5499
|
(0, import_react3.useEffect)(() => {
|
|
5213
5500
|
if (wasOpenRef.current && !open) {
|
|
@@ -5330,11 +5617,14 @@ function ProfileModelsDialog({
|
|
|
5330
5617
|
const roles2 = state.snapshot?.roles ?? [];
|
|
5331
5618
|
const effectiveDisabled = disabled || isInvalidProjection || doc === null;
|
|
5332
5619
|
const baseline = state.snapshot?.editorDefaults;
|
|
5620
|
+
const canSave = canSaveProp ?? (!disabled && !isInvalidProjection && doc !== null && state.dirty && state.snapshot !== null && state.invalidFields.length === 0);
|
|
5621
|
+
const isSaveLocked = (state.dirty || state.invalidFields.length > 0) && !disabled && doc !== null && state.snapshot !== null && (state.invalidFields.length > 0 || Boolean(isInvalidProjection));
|
|
5333
5622
|
const filteredRoles = roles2.filter((role3) => {
|
|
5334
5623
|
if (searchQuery.trim()) {
|
|
5335
5624
|
const q = searchQuery.trim().toLowerCase();
|
|
5336
5625
|
const matchesId = role3.id.toLowerCase().includes(q);
|
|
5337
|
-
const
|
|
5626
|
+
const displayLabel = displayRoleLabel(role3.label);
|
|
5627
|
+
const matchesLabel = role3.label.toLowerCase().includes(q) || displayLabel.toLowerCase().includes(q);
|
|
5338
5628
|
if (!matchesId && !matchesLabel) return false;
|
|
5339
5629
|
}
|
|
5340
5630
|
if (filterExplicitOnly) {
|
|
@@ -5342,6 +5632,34 @@ function ProfileModelsDialog({
|
|
|
5342
5632
|
}
|
|
5343
5633
|
return true;
|
|
5344
5634
|
});
|
|
5635
|
+
(0, import_react3.useEffect)(() => {
|
|
5636
|
+
if (!open) return;
|
|
5637
|
+
const el = dialogTopBarRef.current;
|
|
5638
|
+
if (!el) return;
|
|
5639
|
+
const parent = el.closest(".dsmm-profile-models-dialog-content");
|
|
5640
|
+
const update = () => {
|
|
5641
|
+
const height = el.offsetHeight;
|
|
5642
|
+
if (parent) {
|
|
5643
|
+
parent.style.setProperty("--dsmm-dialog-bar-offset", `${height}px`);
|
|
5644
|
+
}
|
|
5645
|
+
};
|
|
5646
|
+
update();
|
|
5647
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
5648
|
+
const ro = new ResizeObserver(update);
|
|
5649
|
+
ro.observe(el);
|
|
5650
|
+
return () => {
|
|
5651
|
+
ro.disconnect();
|
|
5652
|
+
if (parent) {
|
|
5653
|
+
parent.style.removeProperty("--dsmm-dialog-bar-offset");
|
|
5654
|
+
}
|
|
5655
|
+
};
|
|
5656
|
+
}
|
|
5657
|
+
return () => {
|
|
5658
|
+
if (parent) {
|
|
5659
|
+
parent.style.removeProperty("--dsmm-dialog-bar-offset");
|
|
5660
|
+
}
|
|
5661
|
+
};
|
|
5662
|
+
}, [open, state.dirty, isSaveLocked, state.busy]);
|
|
5345
5663
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5346
5664
|
import_dsh_client_ui_primitives3.Modal,
|
|
5347
5665
|
{
|
|
@@ -5354,6 +5672,33 @@ function ProfileModelsDialog({
|
|
|
5354
5672
|
contentClassName: "dsmm-profile-models-dialog-content",
|
|
5355
5673
|
onKeyDownCapture: handleKeyDownCapture,
|
|
5356
5674
|
children: [
|
|
5675
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ref: dialogTopBarRef, className: "dsmm-dialog-top-bar", children: [
|
|
5676
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-actions", children: [
|
|
5677
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5678
|
+
import_dsh_client_ui_primitives3.Button,
|
|
5679
|
+
{
|
|
5680
|
+
type: "button",
|
|
5681
|
+
variant: "primary",
|
|
5682
|
+
disabled: !canSave,
|
|
5683
|
+
onClick: () => {
|
|
5684
|
+
void actions3.save();
|
|
5685
|
+
},
|
|
5686
|
+
children: t(state.busy === "save" ? "saving" : "save")
|
|
5687
|
+
}
|
|
5688
|
+
),
|
|
5689
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5690
|
+
import_dsh_client_ui_primitives3.Button,
|
|
5691
|
+
{
|
|
5692
|
+
type: "button",
|
|
5693
|
+
variant: "outline",
|
|
5694
|
+
onClick: onClose,
|
|
5695
|
+
children: t("cancel")
|
|
5696
|
+
}
|
|
5697
|
+
)
|
|
5698
|
+
] }),
|
|
5699
|
+
state.busy === "save" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: t("saving") }) : state.dirty ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: t("dirty") }) : null,
|
|
5700
|
+
isSaveLocked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsmm-save-lock-reason", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsmm-save-lock-text", children: isInvalidProjection ? t("rawInvalid") : t("saveLockedReason", { count: state.invalidFields.length }) }) })
|
|
5701
|
+
] }),
|
|
5357
5702
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-models-filter-bar dsmm-dialog-filter-bar", children: [
|
|
5358
5703
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsmm-field dsmm-filter-search", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5359
5704
|
import_dsh_client_ui_primitives3.Input,
|
|
@@ -5413,6 +5758,7 @@ function ProfileModelsDialog({
|
|
|
5413
5758
|
doc !== null && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-roles-list dsmm-dialog-roles-list", children: [
|
|
5414
5759
|
filteredRoles.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "dsmm-hint dsmm-no-roles", children: t("noMatchingRoles") }),
|
|
5415
5760
|
filteredRoles.map((role3) => {
|
|
5761
|
+
const roleName = displayRoleLabel(role3.label);
|
|
5416
5762
|
const policy = doc.roleRouting[role3.id] ?? {};
|
|
5417
5763
|
const rolePath = ["settings", "roleRouting", role3.id];
|
|
5418
5764
|
const isOrchestrator = role3.id === "dsmm-orchestrator";
|
|
@@ -5449,13 +5795,13 @@ function ProfileModelsDialog({
|
|
|
5449
5795
|
children: [
|
|
5450
5796
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-role-main-row", children: [
|
|
5451
5797
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsmm-dialog-role-header", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-role-title-group", children: [
|
|
5452
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsmm-role-title", children:
|
|
5798
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsmm-role-title", children: roleName }),
|
|
5453
5799
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { className: "dsmm-role-id-badge", children: role3.id }),
|
|
5454
5800
|
explicitOverride && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsmm-override-badge", children: t("roleSettingsOverridden") })
|
|
5455
5801
|
] }) }),
|
|
5456
5802
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-role-primary-route", children: [
|
|
5457
5803
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-field dsmm-primary-mode-field", children: [
|
|
5458
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: `${prefix}-${role3.id}-primary-mode`, children: t("primaryMode", { name:
|
|
5804
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: `${prefix}-${role3.id}-primary-mode`, children: t("primaryMode", { name: roleName }) }),
|
|
5459
5805
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5460
5806
|
"select",
|
|
5461
5807
|
{
|
|
@@ -5479,7 +5825,7 @@ function ProfileModelsDialog({
|
|
|
5479
5825
|
t,
|
|
5480
5826
|
value: policy.primary,
|
|
5481
5827
|
path: [...rolePath, "primary"],
|
|
5482
|
-
name: t("primaryName", { name:
|
|
5828
|
+
name: t("primaryName", { name: roleName }),
|
|
5483
5829
|
catalog: state.catalog,
|
|
5484
5830
|
disabled: effectiveDisabled,
|
|
5485
5831
|
edit: actions3.editPath,
|
|
@@ -5526,7 +5872,7 @@ function ProfileModelsDialog({
|
|
|
5526
5872
|
] }),
|
|
5527
5873
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-details-content", children: [
|
|
5528
5874
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-field", children: [
|
|
5529
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: `${prefix}-${role3.id}-fallback-mode`, children: t("fallbackMode", { name:
|
|
5875
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: `${prefix}-${role3.id}-fallback-mode`, children: t("fallbackMode", { name: roleName }) }),
|
|
5530
5876
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5531
5877
|
"select",
|
|
5532
5878
|
{
|
|
@@ -5546,7 +5892,7 @@ function ProfileModelsDialog({
|
|
|
5546
5892
|
] }),
|
|
5547
5893
|
policy.fallbackRoutes?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "dsmm-hint", children: t("emptyChain") }),
|
|
5548
5894
|
policy.fallbackRoutes?.map((candidate, index) => {
|
|
5549
|
-
const name2 = t("fallbackName", { name:
|
|
5895
|
+
const name2 = t("fallbackName", { name: roleName, index: index + 1 });
|
|
5550
5896
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5551
5897
|
"fieldset",
|
|
5552
5898
|
{
|
|
@@ -5637,7 +5983,7 @@ function ProfileModelsDialog({
|
|
|
5637
5983
|
actions3.editPath([...rolePath, "fallbackRoutes", policy.fallbackRoutes.length], { provider: "", model: "" });
|
|
5638
5984
|
}
|
|
5639
5985
|
},
|
|
5640
|
-
children: t("addFallback", { name:
|
|
5986
|
+
children: t("addFallback", { name: roleName })
|
|
5641
5987
|
}
|
|
5642
5988
|
)
|
|
5643
5989
|
] })
|
|
@@ -5653,7 +5999,7 @@ function ProfileModelsDialog({
|
|
|
5653
5999
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-details-content", children: [
|
|
5654
6000
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RoleAvailability, { value: role3.availability, t }),
|
|
5655
6001
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsmm-field", children: [
|
|
5656
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: `${prefix}-${role3.id}-role-enabled`, children: t("namedRole", { name:
|
|
6002
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: `${prefix}-${role3.id}-role-enabled`, children: t("namedRole", { name: roleName }) }),
|
|
5657
6003
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5658
6004
|
"select",
|
|
5659
6005
|
{
|
|
@@ -5688,7 +6034,7 @@ function ProfileModelsDialog({
|
|
|
5688
6034
|
value: policy,
|
|
5689
6035
|
inherited,
|
|
5690
6036
|
path: rolePath,
|
|
5691
|
-
name:
|
|
6037
|
+
name: roleName,
|
|
5692
6038
|
disabled: effectiveDisabled,
|
|
5693
6039
|
actions: actions3
|
|
5694
6040
|
}
|
|
@@ -5710,21 +6056,6 @@ function ProfileModelsDialog({
|
|
|
5710
6056
|
// src/client/SessionProfiles.tsx
|
|
5711
6057
|
var import_react4 = require("react");
|
|
5712
6058
|
var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
5713
|
-
|
|
5714
|
-
// src/client/session-labels.ts
|
|
5715
|
-
function sessionProfileLabels(session, t) {
|
|
5716
|
-
const admitted = session.admittedSelection;
|
|
5717
|
-
const profile = admitted === void 0 ? t("sessionGlobalCaptured") : admitted.selectedId === null ? t("sessionBaseline") : t("sessionAdmittedProfile", { id: admitted.selectedId, revision: t(configurationVersionState(admitted.sourceRevision)) });
|
|
5718
|
-
const future = session.globalDefault;
|
|
5719
|
-
return {
|
|
5720
|
-
admitted: t("sessionState", { profile, scope: session.scope }),
|
|
5721
|
-
futureDefault: t("sessionFutureDefault", {
|
|
5722
|
-
profile: !future || future.selectedId === null ? t("sessionBaseline") : t("sessionAdmittedProfile", { id: future.selectedId, revision: t(configurationVersionState(future.sourceRevision)) })
|
|
5723
|
-
})
|
|
5724
|
-
};
|
|
5725
|
-
}
|
|
5726
|
-
|
|
5727
|
-
// src/client/SessionProfiles.tsx
|
|
5728
6059
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5729
6060
|
var MENU_ISSUE_CODES = /* @__PURE__ */ new Set(["validation", "conflict", "not-found", "lock-timeout", "unsafe-path", "io", "activation", "corrupt-selection", "limit", "busy", "maintenance", "disposed", "not-owned", "unavailable", "cancelled", "module-off", "runtime-unavailable", "new-session-required", "model-unconfigured", "model-choice-changed", "model-service-unavailable", "model-observation-unavailable", "model-selection-failed"]);
|
|
5730
6061
|
function capabilityReason(reason, t) {
|
|
@@ -5762,7 +6093,7 @@ function SessionScopeFeedback({ state, t }) {
|
|
|
5762
6093
|
] }) : null,
|
|
5763
6094
|
state.dirty && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dsmm-hint", children: t("sessionDirty") }),
|
|
5764
6095
|
(session?.refreshRequired || session?.selection.refreshRequired) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: t("sessionCommittedRefresh") }),
|
|
5765
|
-
state.sessionUnconfirmed && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: t("sessionUnconfirmedRefresh") }),
|
|
6096
|
+
state.sessionUnconfirmed && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: t(state.sessionIssue?.code === "blank-identity-unconfirmed" ? "sessionPreparationUnknown" : "sessionUnconfirmedRefresh") }),
|
|
5766
6097
|
state.sessionIssue !== null && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
5767
6098
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "alert", children: state.sessionIssue.source === "profile-model" ? t(state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed") : state.sessionIssue.code === "conflict" ? t("sessionConflict") : ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code }) : t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }),
|
|
5768
6099
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IssueDetails, { issue: state.sessionIssue, t })
|
|
@@ -5791,7 +6122,36 @@ function SessionScope({ state, actions: actions3, t, compact = false, showFeedba
|
|
|
5791
6122
|
}
|
|
5792
6123
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dsmm-session-scope", "aria-busy": state.sessionBusy !== null, "data-dsmm-session-scope": true, children: [
|
|
5793
6124
|
!compact && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: t("sessionScope") }),
|
|
5794
|
-
state.currentSessionId === null ? /* @__PURE__ */ (0, import_jsx_runtime6.
|
|
6125
|
+
state.currentSessionId === null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
6126
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dsmm-hint", children: t(state.sessionPreparationAvailable ? "sessionChooseWorkspace" : "sessionPreparationUnavailable") }),
|
|
6127
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dsmm-field", children: [
|
|
6128
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: `${prefix}-workspace`, children: t("sessionWorkspace") }),
|
|
6129
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { id: `${prefix}-workspace`, value: state.sessionWorkspaceId ?? "", disabled: !state.sessionPreparationAvailable || disabled, onChange: (event) => {
|
|
6130
|
+
if (current()) void actions3.chooseSessionWorkspace(event.currentTarget.value);
|
|
6131
|
+
}, children: [
|
|
6132
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: t("sessionWorkspacePlaceholder") }),
|
|
6133
|
+
state.sessionWorkspaces.map((workspace) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: workspace.id, children: workspace.label }, workspace.id))
|
|
6134
|
+
] })
|
|
6135
|
+
] }),
|
|
6136
|
+
state.sessionWorkspaces.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dsmm-hint", children: t("sessionNoWorkspaces") }),
|
|
6137
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dsmm-field", children: [
|
|
6138
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: `${prefix}-choice`, children: t("sessionSelect") }),
|
|
6139
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { id: `${prefix}-choice`, value: state.sessionChoice ?? "", disabled: !state.sessionPreparationAvailable || disabled || state.sessionUnconfirmed, onChange: (event) => {
|
|
6140
|
+
if (current()) actions3.chooseSessionProfile(event.currentTarget.value || null);
|
|
6141
|
+
}, children: [
|
|
6142
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: t("sessionBaseline") }),
|
|
6143
|
+
state.snapshot?.profiles.map((profile) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: profile.id, disabled: !isConfigRevision(profile.revision) || profile.error !== void 0, children: profile.label?.trim() || profile.id }, profile.id))
|
|
6144
|
+
] })
|
|
6145
|
+
] }),
|
|
6146
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dsmm-actions", children: [
|
|
6147
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives4.Button, { type: "button", variant: "outline", disabled: !state.sessionPreparationAvailable || disabled || state.sessionUnconfirmed || state.snapshot === null, onClick: () => {
|
|
6148
|
+
if (current()) void actions3.applySession();
|
|
6149
|
+
}, children: t("sessionPrepare") }),
|
|
6150
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives4.Button, { type: "button", variant: "outline", disabled: state.sessionBusy !== null || state.busy !== null || state.pendingEditor !== null, onClick: () => {
|
|
6151
|
+
if (current()) void actions3.refreshSession();
|
|
6152
|
+
}, children: t("sessionRefresh") })
|
|
6153
|
+
] })
|
|
6154
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
5795
6155
|
labels !== null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { "data-dsmm-session-state": true, children: labels.admitted }),
|
|
5796
6156
|
labels !== null && !compact && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dsmm-hint", "data-dsmm-session-future-default": true, children: labels.futureDefault }),
|
|
5797
6157
|
session === null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dsmm-hint", id: `${prefix}-overlay-reason`, children: t("sessionUnavailable") }),
|
|
@@ -5865,14 +6225,15 @@ function SessionProfiles(props) {
|
|
|
5865
6225
|
const committing = state.sessionBusy !== null;
|
|
5866
6226
|
const unavailable = id2 === null || committing || state.busy !== null || state.sessionUnconfirmed || session === null || session.refreshRequired === true || session.selection.refreshRequired === true;
|
|
5867
6227
|
const profileDisabled = unavailable || state.pendingEditor !== null || state.dirty || state.invalidFields.length > 0 || session === null || !writableSelectionVersion(session.selection.selectionRevision);
|
|
5868
|
-
const
|
|
6228
|
+
const sessionlessDisabled = !state.sessionPreparationAvailable || committing || state.busy !== null || state.sessionUnconfirmed || state.pendingEditor !== null || state.dirty || state.invalidFields.length > 0 || state.snapshot === null;
|
|
6229
|
+
const disabled = id2 === null ? sessionlessDisabled : profileDisabled || session?.canApplyOverlay !== true || session?.applyOverlayUnavailableReason === "new-session-required" || state.snapshot === null;
|
|
5869
6230
|
let feedback = "";
|
|
5870
|
-
if (state.sessionUnconfirmed) feedback = t("sessionUnconfirmedRefresh");
|
|
6231
|
+
if (state.sessionUnconfirmed) feedback = t(state.sessionIssue?.code === "blank-identity-unconfirmed" ? "sessionPreparationUnknown" : "sessionUnconfirmedRefresh");
|
|
5871
6232
|
else if (session?.refreshRequired || session?.selection.refreshRequired) feedback = t("sessionCommittedRefresh");
|
|
5872
6233
|
else if (state.sessionIssue !== null) feedback = t(state.sessionIssue.source === "profile-model" ? state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed" : state.sessionIssue.code === "conflict" ? "headerConflict" : state.sessionIssue.code === "activation" ? "headerActivationRefused" : state.sessionIssue.code === "maintenance" ? "headerMaintenanceRefused" : state.sessionIssue.code === "busy" ? "headerBusyRefused" : state.sessionIssue.code === "cancelled" ? "headerCancelledRefused" : state.sessionIssue.code === "unavailable" || state.sessionIssue.kind === "assembly" ? "headerUnavailableRefused" : "headerSelectionRefused");
|
|
5873
6234
|
else if (committing || state.busy !== null) feedback = t(state.sessionBusy === "apply" || state.sessionBusy === "reset" ? "headerApplying" : "headerLoading");
|
|
5874
6235
|
else if (state.dirty || state.invalidFields.length > 0 || state.pendingEditor !== null) feedback = t("headerDraft");
|
|
5875
|
-
else if (id2 === null) feedback = t("sessionChooseWorkspace");
|
|
6236
|
+
else if (id2 === null) feedback = t(!state.sessionPreparationAvailable ? "sessionPreparationUnavailable" : state.sessionWorkspaceId === null ? "sessionChooseWorkspace" : "sessionPrepareHint");
|
|
5876
6237
|
else if (session === null || state.snapshot === null) feedback = t("headerUnavailable");
|
|
5877
6238
|
else if (state.sessionNotice !== null) feedback = t(state.sessionNotice === "mode-on" ? "headerModeOn" : state.sessionNotice === "mode-off" ? "headerModeOff" : state.sessionNotice === "applied-with-model" ? "headerAppliedWithModel" : "headerApplied");
|
|
5878
6239
|
const profileName = unknownCaptured ? t("headerCaptured") : admission !== void 0 && sourceRelationship(admission, currentSaved?.revision) === "current" && currentSaved?.label?.trim() ? currentSaved.label : admission?.selectedId ?? t("sessionBaseline");
|
|
@@ -5894,6 +6255,11 @@ function SessionProfiles(props) {
|
|
|
5894
6255
|
if (diagnostic2 !== null) entries.push({ type: "label", id: "@diagnostic", text: diagnosticText }, { type: "label", id: "@retry", text: retryHint });
|
|
5895
6256
|
if (admission?.selectedId != null && currentSaved === void 0) entries.push({ id: admission.selectedId, label: `${admission.selectedId} — ${t("headerSavedUnavailable")}`, disabled: true });
|
|
5896
6257
|
if (unknownCaptured) entries.push({ id: "__dsmm_captured_default__", label: t("headerCaptured"), disabled: true });
|
|
6258
|
+
if (id2 === null) {
|
|
6259
|
+
entries.push({ type: "separator", id: "@workspace-separator" }, { type: "label", id: "@workspace-heading", text: state.sessionPreparationPending ? t("sessionPendingProfile", { profile: profiles.find((profile) => profile.id === state.sessionChoice)?.label?.trim() || state.sessionChoice || t("sessionBaseline") }) : t("sessionWorkspace") });
|
|
6260
|
+
for (const workspace of state.sessionWorkspaces) entries.push({ id: `@workspace:${workspace.id}`, label: `${workspace.id === state.sessionWorkspaceId ? "✓ " : ""}${workspace.label}`, disabled: !state.sessionPreparationAvailable || state.dirty || state.invalidFields.length > 0 || state.pendingEditor !== null || state.busy !== null });
|
|
6261
|
+
if (state.sessionWorkspaces.length === 0) entries.push({ type: "label", id: "@no-workspaces", text: t("sessionNoWorkspaces") });
|
|
6262
|
+
}
|
|
5897
6263
|
entries.push({ type: "separator", id: "@keep-separator" }, { type: "label", id: "@keep-heading", text: t("headerCompactProfiles") }, { id: "", label: t("sessionBaseline"), disabled });
|
|
5898
6264
|
if (session !== null && (session.canApplyOverlay !== true || session.applyOverlayUnavailableReason === "new-session-required")) entries.push({ type: "label", id: "@overlay-reason", text: capabilityReason(session.applyOverlayUnavailableReason, t) });
|
|
5899
6265
|
for (const profile of profiles) entries.push({ id: profile.id, label: (profile.label?.trim() ? profile.label : profile.id) + (profile.error === void 0 && isConfigRevision(profile.revision) ? "" : ` — ${t("headerSavedUnavailable")}`) + (profileWarnings(profile.warnings).length ? ` — ${t("warningProfile")}` : ""), disabled: disabled || !isConfigRevision(profile.revision) || profile.error !== void 0 });
|
|
@@ -5922,17 +6288,22 @@ function SessionProfiles(props) {
|
|
|
5922
6288
|
if (committing || state.busy !== null) return;
|
|
5923
6289
|
void (async () => {
|
|
5924
6290
|
await props.refresh();
|
|
5925
|
-
if (
|
|
6291
|
+
if (props.readProfileView().currentSessionId === id2 && props.readProfileView().sessionViewEpoch === state.sessionViewEpoch) await props.refreshSession();
|
|
5926
6292
|
})();
|
|
5927
6293
|
} else {
|
|
5928
6294
|
const row = entries.find((entry) => entry.id === value && !("type" in entry));
|
|
5929
6295
|
if (row === void 0 || !("disabled" in row) || row.disabled) return;
|
|
6296
|
+
if (value.startsWith("@workspace:")) {
|
|
6297
|
+
void props.chooseSessionWorkspace(value.slice("@workspace:".length));
|
|
6298
|
+
return;
|
|
6299
|
+
}
|
|
5930
6300
|
if (value === "@mode") {
|
|
5931
6301
|
if (mode !== void 0) void props.setDeepwork(!mode.active);
|
|
5932
6302
|
} else if (value === "@use-model") void props.useSessionProfileModel();
|
|
5933
6303
|
else {
|
|
5934
6304
|
props.chooseSessionProfile(value || null);
|
|
5935
6305
|
void props.applySession();
|
|
6306
|
+
if (id2 === null && state.sessionWorkspaceId === null) return;
|
|
5936
6307
|
}
|
|
5937
6308
|
}
|
|
5938
6309
|
setOpenFor(void 0);
|
|
@@ -5976,6 +6347,7 @@ function ProfilesSection(props) {
|
|
|
5976
6347
|
const hadConfirmation = (0, import_react5.useRef)(false);
|
|
5977
6348
|
const initiatorRef = (0, import_react5.useRef)(null);
|
|
5978
6349
|
const dialogInitiatorRef = (0, import_react5.useRef)(null);
|
|
6350
|
+
const saveBarRef = (0, import_react5.useRef)(null);
|
|
5979
6351
|
const orchestratorRef = (0, import_react5.useRef)(null);
|
|
5980
6352
|
const sessionScopeRef = (0, import_react5.useRef)(null);
|
|
5981
6353
|
const [modelsDialogOpen, setModelsDialogOpen] = (0, import_react5.useState)(false);
|
|
@@ -6002,6 +6374,7 @@ function ProfilesSection(props) {
|
|
|
6002
6374
|
}
|
|
6003
6375
|
const basicDoc = structuredDoc ?? (lastValidBasicDocRef.current !== null && lastValidBasicDocRef.current.id === editor?.id && lastValidBasicDocRef.current.epoch === state.editorEpoch ? lastValidBasicDocRef.current.doc : null);
|
|
6004
6376
|
const rawInvalid = editor !== null && structuredDoc === null;
|
|
6377
|
+
const canSave = !editorDisabled && state.dirty && snapshot4 !== null && state.invalidFields.length === 0 && !rawInvalid;
|
|
6005
6378
|
function focusJsonc(location) {
|
|
6006
6379
|
if (advancedRef.current !== null) {
|
|
6007
6380
|
advancedRef.current.open = true;
|
|
@@ -6100,6 +6473,33 @@ function ProfilesSection(props) {
|
|
|
6100
6473
|
if (snapshot4?.selectionError !== void 0 && !selectionConflict) selection = t("appliedInvalid");
|
|
6101
6474
|
else if (snapshot4?.selectedId !== null && snapshot4?.selectedId !== void 0) selection = t("appliedProfile", { id: snapshot4.selectedId, revision: t(configurationVersionState(snapshot4.sourceRevision)) });
|
|
6102
6475
|
const notice = state.notice === null ? "" : t(state.notice.key === "reset" ? "resetDone" : state.notice.key, { id: state.notice.id });
|
|
6476
|
+
(0, import_react5.useEffect)(() => {
|
|
6477
|
+
const el = saveBarRef.current;
|
|
6478
|
+
if (!el) return;
|
|
6479
|
+
const parent = el.closest(".dsmm-editor");
|
|
6480
|
+
const update = () => {
|
|
6481
|
+
const height = el.offsetHeight;
|
|
6482
|
+
if (parent) {
|
|
6483
|
+
parent.style.setProperty("--dsmm-save-bar-offset", `${height}px`);
|
|
6484
|
+
}
|
|
6485
|
+
};
|
|
6486
|
+
update();
|
|
6487
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
6488
|
+
const ro = new ResizeObserver(update);
|
|
6489
|
+
ro.observe(el);
|
|
6490
|
+
return () => {
|
|
6491
|
+
ro.disconnect();
|
|
6492
|
+
if (parent) {
|
|
6493
|
+
parent.style.removeProperty("--dsmm-save-bar-offset");
|
|
6494
|
+
}
|
|
6495
|
+
};
|
|
6496
|
+
}
|
|
6497
|
+
return () => {
|
|
6498
|
+
if (parent) {
|
|
6499
|
+
parent.style.removeProperty("--dsmm-save-bar-offset");
|
|
6500
|
+
}
|
|
6501
|
+
};
|
|
6502
|
+
}, [editor?.id, state.dirty, state.invalidFields.length, rawInvalid, invalid2]);
|
|
6103
6503
|
const warnings2 = editor === null ? [] : draftWarnings(editor.content);
|
|
6104
6504
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "dsmm-profiles dsmm-named-profiles", "aria-label": t("title"), "aria-busy": state.busy !== null, children: [
|
|
6105
6505
|
readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "status", className: "dsmm-hint", children: t("readOnlyOrigin") }),
|
|
@@ -6205,6 +6605,157 @@ function ProfilesSection(props) {
|
|
|
6205
6605
|
] }),
|
|
6206
6606
|
editor === null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-hint", children: t("noEditor") }),
|
|
6207
6607
|
editor !== null && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-editor", children: [
|
|
6608
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: saveBarRef, className: "dsmm-save-bar", children: [
|
|
6609
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-actions", children: [
|
|
6610
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "primary", disabled: !canSave, onClick: () => {
|
|
6611
|
+
void props.save();
|
|
6612
|
+
}, children: t(state.busy === "save" ? "saving" : "save") }),
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled: editorDisabled || !state.dirty && state.invalidFields.length === 0, onClick: (event) => {
|
|
6614
|
+
initiatorRef.current = event.currentTarget;
|
|
6615
|
+
props.discard();
|
|
6616
|
+
}, children: t("discard") }),
|
|
6617
|
+
editor.revision !== null && !state.dirty && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled, onClick: (event) => {
|
|
6618
|
+
initiatorRef.current = event.currentTarget;
|
|
6619
|
+
void props.reload();
|
|
6620
|
+
}, children: t("reload") }),
|
|
6621
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot4 === null ? t("loading") : state.busy === "read" ? t("reading") : notice })
|
|
6622
|
+
] }),
|
|
6623
|
+
(() => {
|
|
6624
|
+
const isSaveLocked = (state.dirty || state.invalidFields.length > 0) && !editorDisabled && snapshot4 !== null && (state.invalidFields.length > 0 || rawInvalid || invalid2);
|
|
6625
|
+
if (!isSaveLocked) return null;
|
|
6626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-save-lock-reason", role: "status", children: [
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dsmm-save-lock-text", children: rawInvalid ? t("rawInvalid") : state.invalidFields.length > 0 ? t("saveLockedReason", { count: state.invalidFields.length }) : t("validation") }),
|
|
6628
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-save-lock-action", children: [
|
|
6629
|
+
rawInvalid && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6630
|
+
import_dsh_client_ui_primitives5.Button,
|
|
6631
|
+
{
|
|
6632
|
+
type: "button",
|
|
6633
|
+
variant: "outline",
|
|
6634
|
+
size: "sm",
|
|
6635
|
+
onClick: () => {
|
|
6636
|
+
if (advancedRef.current !== null) {
|
|
6637
|
+
advancedRef.current.open = true;
|
|
6638
|
+
jsoncOpenRef.current = true;
|
|
6639
|
+
}
|
|
6640
|
+
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6641
|
+
editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
6642
|
+
editorRef.current?.focus();
|
|
6643
|
+
},
|
|
6644
|
+
children: t("jumpToJsonc")
|
|
6645
|
+
}
|
|
6646
|
+
),
|
|
6647
|
+
!rawInvalid && state.invalidFields.length > 0 && (() => {
|
|
6648
|
+
const firstInvalid = state.invalidFields[0];
|
|
6649
|
+
const roleMatch = /^(?:settings\.)?(?:roleRouting|roles)\.([a-zA-Z0-9_-]+)(?:\.|$)/.exec(firstInvalid);
|
|
6650
|
+
const roleId2 = roleMatch?.[1];
|
|
6651
|
+
if (roleId2) {
|
|
6652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6653
|
+
import_dsh_client_ui_primitives5.Button,
|
|
6654
|
+
{
|
|
6655
|
+
type: "button",
|
|
6656
|
+
variant: "outline",
|
|
6657
|
+
size: "sm",
|
|
6658
|
+
onClick: (e) => {
|
|
6659
|
+
dialogInitiatorRef.current = e.currentTarget;
|
|
6660
|
+
setTargetRole(roleId2);
|
|
6661
|
+
setTargetRoleField(firstInvalid);
|
|
6662
|
+
setModelsDialogOpen(true);
|
|
6663
|
+
},
|
|
6664
|
+
children: [
|
|
6665
|
+
t("jumpToField"),
|
|
6666
|
+
": ",
|
|
6667
|
+
firstInvalid
|
|
6668
|
+
]
|
|
6669
|
+
}
|
|
6670
|
+
);
|
|
6671
|
+
}
|
|
6672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6673
|
+
import_dsh_client_ui_primitives5.Button,
|
|
6674
|
+
{
|
|
6675
|
+
type: "button",
|
|
6676
|
+
variant: "outline",
|
|
6677
|
+
size: "sm",
|
|
6678
|
+
onClick: () => {
|
|
6679
|
+
if (!focusGlobalField(firstInvalid)) focusJsonc(state.issue?.location);
|
|
6680
|
+
},
|
|
6681
|
+
children: [
|
|
6682
|
+
t("jumpToField"),
|
|
6683
|
+
": ",
|
|
6684
|
+
firstInvalid
|
|
6685
|
+
]
|
|
6686
|
+
}
|
|
6687
|
+
);
|
|
6688
|
+
})(),
|
|
6689
|
+
!rawInvalid && state.invalidFields.length === 0 && invalid2 && (() => {
|
|
6690
|
+
if (state.issue?.field === "id" || state.issue?.field === "newId") {
|
|
6691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6692
|
+
import_dsh_client_ui_primitives5.Button,
|
|
6693
|
+
{
|
|
6694
|
+
type: "button",
|
|
6695
|
+
variant: "outline",
|
|
6696
|
+
size: "sm",
|
|
6697
|
+
onClick: () => {
|
|
6698
|
+
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6699
|
+
inputRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
6700
|
+
inputRef.current?.focus();
|
|
6701
|
+
},
|
|
6702
|
+
children: [
|
|
6703
|
+
t("jumpToField"),
|
|
6704
|
+
": ID"
|
|
6705
|
+
]
|
|
6706
|
+
}
|
|
6707
|
+
);
|
|
6708
|
+
}
|
|
6709
|
+
const roleMatch = /^(?:settings\.)?(?:roleRouting|roles)\.([a-zA-Z0-9_-]+)(?:\.|$)/.exec(state.issue?.field ?? "");
|
|
6710
|
+
const roleId2 = roleMatch?.[1];
|
|
6711
|
+
if (roleId2 && snapshot4?.roles?.some((r) => r.id === roleId2)) {
|
|
6712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6713
|
+
import_dsh_client_ui_primitives5.Button,
|
|
6714
|
+
{
|
|
6715
|
+
type: "button",
|
|
6716
|
+
variant: "outline",
|
|
6717
|
+
size: "sm",
|
|
6718
|
+
onClick: (e) => {
|
|
6719
|
+
dialogInitiatorRef.current = e.currentTarget;
|
|
6720
|
+
setTargetRole(roleId2);
|
|
6721
|
+
setTargetRoleField(state.issue?.field ?? null);
|
|
6722
|
+
setModelsDialogOpen(true);
|
|
6723
|
+
},
|
|
6724
|
+
children: [
|
|
6725
|
+
t("jumpToRole"),
|
|
6726
|
+
": ",
|
|
6727
|
+
roleId2
|
|
6728
|
+
]
|
|
6729
|
+
}
|
|
6730
|
+
);
|
|
6731
|
+
}
|
|
6732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6733
|
+
import_dsh_client_ui_primitives5.Button,
|
|
6734
|
+
{
|
|
6735
|
+
type: "button",
|
|
6736
|
+
variant: "outline",
|
|
6737
|
+
size: "sm",
|
|
6738
|
+
onClick: () => {
|
|
6739
|
+
if (advancedRef.current !== null) {
|
|
6740
|
+
advancedRef.current.open = true;
|
|
6741
|
+
jsoncOpenRef.current = true;
|
|
6742
|
+
}
|
|
6743
|
+
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6744
|
+
editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
6745
|
+
editorRef.current?.focus();
|
|
6746
|
+
const location = state.issue?.location;
|
|
6747
|
+
if (location !== void 0 && editorRef.current && location.offset + location.length <= editorRef.current.value.length) {
|
|
6748
|
+
editorRef.current.setSelectionRange(location.offset, location.offset + location.length);
|
|
6749
|
+
}
|
|
6750
|
+
},
|
|
6751
|
+
children: t("jumpToJsonc")
|
|
6752
|
+
}
|
|
6753
|
+
);
|
|
6754
|
+
})()
|
|
6755
|
+
] })
|
|
6756
|
+
] });
|
|
6757
|
+
})()
|
|
6758
|
+
] }),
|
|
6208
6759
|
warnings2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
6209
6760
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: t("draftWarnings") }),
|
|
6210
6761
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ProfileWarnings, { warnings: warnings2, t })
|
|
@@ -6439,165 +6990,16 @@ function ProfilesSection(props) {
|
|
|
6439
6990
|
setTargetRoleField(null);
|
|
6440
6991
|
},
|
|
6441
6992
|
onJumpToJsonc: () => closeModelsDialog("jsonc"),
|
|
6993
|
+
canSave,
|
|
6442
6994
|
t
|
|
6443
6995
|
}
|
|
6444
|
-
)
|
|
6445
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-save-bar", children: [
|
|
6446
|
-
(() => {
|
|
6447
|
-
const isSaveLocked = (state.dirty || state.invalidFields.length > 0) && !editorDisabled && snapshot4 !== null && (state.invalidFields.length > 0 || rawInvalid || invalid2);
|
|
6448
|
-
if (!isSaveLocked) return null;
|
|
6449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-save-lock-reason", role: "status", children: [
|
|
6450
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dsmm-save-lock-text", children: rawInvalid ? t("rawInvalid") : state.invalidFields.length > 0 ? t("saveLockedReason", { count: state.invalidFields.length }) : t("validation") }),
|
|
6451
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-save-lock-action", children: [
|
|
6452
|
-
rawInvalid && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6453
|
-
import_dsh_client_ui_primitives5.Button,
|
|
6454
|
-
{
|
|
6455
|
-
type: "button",
|
|
6456
|
-
variant: "outline",
|
|
6457
|
-
size: "sm",
|
|
6458
|
-
onClick: () => {
|
|
6459
|
-
if (advancedRef.current !== null) {
|
|
6460
|
-
advancedRef.current.open = true;
|
|
6461
|
-
jsoncOpenRef.current = true;
|
|
6462
|
-
}
|
|
6463
|
-
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6464
|
-
editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
6465
|
-
editorRef.current?.focus();
|
|
6466
|
-
},
|
|
6467
|
-
children: t("jumpToJsonc")
|
|
6468
|
-
}
|
|
6469
|
-
),
|
|
6470
|
-
!rawInvalid && state.invalidFields.length > 0 && (() => {
|
|
6471
|
-
const firstInvalid = state.invalidFields[0];
|
|
6472
|
-
const roleMatch = /^(?:settings\.)?(?:roleRouting|roles)\.([a-zA-Z0-9_-]+)(?:\.|$)/.exec(firstInvalid);
|
|
6473
|
-
const roleId2 = roleMatch?.[1];
|
|
6474
|
-
if (roleId2) {
|
|
6475
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6476
|
-
import_dsh_client_ui_primitives5.Button,
|
|
6477
|
-
{
|
|
6478
|
-
type: "button",
|
|
6479
|
-
variant: "outline",
|
|
6480
|
-
size: "sm",
|
|
6481
|
-
onClick: (e) => {
|
|
6482
|
-
dialogInitiatorRef.current = e.currentTarget;
|
|
6483
|
-
setTargetRole(roleId2);
|
|
6484
|
-
setTargetRoleField(firstInvalid);
|
|
6485
|
-
setModelsDialogOpen(true);
|
|
6486
|
-
},
|
|
6487
|
-
children: [
|
|
6488
|
-
t("jumpToField"),
|
|
6489
|
-
": ",
|
|
6490
|
-
firstInvalid
|
|
6491
|
-
]
|
|
6492
|
-
}
|
|
6493
|
-
);
|
|
6494
|
-
}
|
|
6495
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6496
|
-
import_dsh_client_ui_primitives5.Button,
|
|
6497
|
-
{
|
|
6498
|
-
type: "button",
|
|
6499
|
-
variant: "outline",
|
|
6500
|
-
size: "sm",
|
|
6501
|
-
onClick: () => {
|
|
6502
|
-
if (!focusGlobalField(firstInvalid)) focusJsonc(state.issue?.location);
|
|
6503
|
-
},
|
|
6504
|
-
children: [
|
|
6505
|
-
t("jumpToField"),
|
|
6506
|
-
": ",
|
|
6507
|
-
firstInvalid
|
|
6508
|
-
]
|
|
6509
|
-
}
|
|
6510
|
-
);
|
|
6511
|
-
})(),
|
|
6512
|
-
!rawInvalid && state.invalidFields.length === 0 && invalid2 && (() => {
|
|
6513
|
-
if (state.issue?.field === "id" || state.issue?.field === "newId") {
|
|
6514
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6515
|
-
import_dsh_client_ui_primitives5.Button,
|
|
6516
|
-
{
|
|
6517
|
-
type: "button",
|
|
6518
|
-
variant: "outline",
|
|
6519
|
-
size: "sm",
|
|
6520
|
-
onClick: () => {
|
|
6521
|
-
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6522
|
-
inputRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
6523
|
-
inputRef.current?.focus();
|
|
6524
|
-
},
|
|
6525
|
-
children: [
|
|
6526
|
-
t("jumpToField"),
|
|
6527
|
-
": ID"
|
|
6528
|
-
]
|
|
6529
|
-
}
|
|
6530
|
-
);
|
|
6531
|
-
}
|
|
6532
|
-
const roleMatch = /^(?:settings\.)?(?:roleRouting|roles)\.([a-zA-Z0-9_-]+)(?:\.|$)/.exec(state.issue?.field ?? "");
|
|
6533
|
-
const roleId2 = roleMatch?.[1];
|
|
6534
|
-
if (roleId2 && snapshot4?.roles?.some((r) => r.id === roleId2)) {
|
|
6535
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
6536
|
-
import_dsh_client_ui_primitives5.Button,
|
|
6537
|
-
{
|
|
6538
|
-
type: "button",
|
|
6539
|
-
variant: "outline",
|
|
6540
|
-
size: "sm",
|
|
6541
|
-
onClick: (e) => {
|
|
6542
|
-
dialogInitiatorRef.current = e.currentTarget;
|
|
6543
|
-
setTargetRole(roleId2);
|
|
6544
|
-
setTargetRoleField(state.issue?.field ?? null);
|
|
6545
|
-
setModelsDialogOpen(true);
|
|
6546
|
-
},
|
|
6547
|
-
children: [
|
|
6548
|
-
t("jumpToRole"),
|
|
6549
|
-
": ",
|
|
6550
|
-
roleId2
|
|
6551
|
-
]
|
|
6552
|
-
}
|
|
6553
|
-
);
|
|
6554
|
-
}
|
|
6555
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6556
|
-
import_dsh_client_ui_primitives5.Button,
|
|
6557
|
-
{
|
|
6558
|
-
type: "button",
|
|
6559
|
-
variant: "outline",
|
|
6560
|
-
size: "sm",
|
|
6561
|
-
onClick: () => {
|
|
6562
|
-
if (advancedRef.current !== null) {
|
|
6563
|
-
advancedRef.current.open = true;
|
|
6564
|
-
jsoncOpenRef.current = true;
|
|
6565
|
-
}
|
|
6566
|
-
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6567
|
-
editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
6568
|
-
editorRef.current?.focus();
|
|
6569
|
-
const location = state.issue?.location;
|
|
6570
|
-
if (location !== void 0 && editorRef.current && location.offset + location.length <= editorRef.current.value.length) {
|
|
6571
|
-
editorRef.current.setSelectionRange(location.offset, location.offset + location.length);
|
|
6572
|
-
}
|
|
6573
|
-
},
|
|
6574
|
-
children: t("jumpToJsonc")
|
|
6575
|
-
}
|
|
6576
|
-
);
|
|
6577
|
-
})()
|
|
6578
|
-
] })
|
|
6579
|
-
] });
|
|
6580
|
-
})(),
|
|
6581
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-actions", children: [
|
|
6582
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "primary", disabled: editorDisabled || !state.dirty || snapshot4 === null || state.invalidFields.length > 0 || rawInvalid, onClick: () => {
|
|
6583
|
-
void props.save();
|
|
6584
|
-
}, children: t(state.busy === "save" ? "saving" : "save") }),
|
|
6585
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled: editorDisabled || !state.dirty && state.invalidFields.length === 0, onClick: (event) => {
|
|
6586
|
-
initiatorRef.current = event.currentTarget;
|
|
6587
|
-
props.discard();
|
|
6588
|
-
}, children: t("discard") }),
|
|
6589
|
-
editor.revision !== null && !state.dirty && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled, onClick: (event) => {
|
|
6590
|
-
initiatorRef.current = event.currentTarget;
|
|
6591
|
-
void props.reload();
|
|
6592
|
-
}, children: t("reload") })
|
|
6593
|
-
] })
|
|
6594
|
-
] })
|
|
6996
|
+
)
|
|
6595
6997
|
] }),
|
|
6596
6998
|
state.issue !== null && !modelsDialogOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-issue", id: `${prefix}-issue`, role: "alert", children: [
|
|
6597
6999
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: t(issueKey(state.issue)) }),
|
|
6598
7000
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IssueDetails, { issue: state.issue, t })
|
|
6599
7001
|
] }),
|
|
6600
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot4 === null ? t("loading") : state.busy === "read" ? t("reading") : notice })
|
|
7002
|
+
editor === null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot4 === null ? t("loading") : state.busy === "read" ? t("reading") : notice })
|
|
6601
7003
|
] });
|
|
6602
7004
|
}
|
|
6603
7005
|
|
|
@@ -6632,7 +7034,10 @@ var PROFILE_STYLES = `
|
|
|
6632
7034
|
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-input input{width:100%;min-width:0;font:inherit;color:inherit}
|
|
6633
7035
|
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice{position:relative;min-width:0}
|
|
6634
7036
|
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice .dsmm-input input{padding-right:32px}
|
|
6635
|
-
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice .dsmm-choice-toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:
|
|
7037
|
+
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice .dsmm-choice-toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:24px;height:24px;min-height:24px;padding:0;border:none;border-radius:var(--dsw-radius-xs,4px);background:transparent;color:var(--dsw-alias-label-secondary)}
|
|
7038
|
+
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice .dsmm-choice-toggle:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
7039
|
+
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice .dsmm-choice-toggle:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}
|
|
7040
|
+
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice .dsmm-choice-toggle:disabled{background:transparent;color:var(--dsw-alias-label-tertiary);opacity:0.4;cursor:not-allowed}
|
|
6636
7041
|
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice-list{position:absolute;z-index:1;top:100%;left:0;right:0;max-height:240px;overflow-y:auto;list-style:none;margin:4px 0 0;padding:4px;border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}
|
|
6637
7042
|
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice-list [role=option]{padding:8px 10px;min-width:0;overflow-wrap:anywhere;cursor:pointer}
|
|
6638
7043
|
:is(.dsmm-profiles, .dsmm-profile-models-dialog) .dsmm-choice-list [role=option]:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
@@ -6651,6 +7056,7 @@ var PROFILE_STYLES = `
|
|
|
6651
7056
|
.dsmm-profiles .dsmm-issue{padding:12px;border-left:4px solid var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
|
|
6652
7057
|
.dsmm-profiles .dsmm-issue p+p{margin-top:8px}
|
|
6653
7058
|
.dsmm-profiles .dsmm-status{min-height:22px}
|
|
7059
|
+
.dsmm-profiles .dsmm-status:empty{min-height:0;display:none}
|
|
6654
7060
|
.dsmm-profiles .dsmm-zone{min-width:0;display:flex;flex-direction:column;gap:12px;padding-top:16px;border-top:1px solid var(--dsw-alias-border-l4)}
|
|
6655
7061
|
.dsmm-profiles .dsmm-profile-list{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:12px;min-width:0}
|
|
6656
7062
|
.dsmm-profiles .dsmm-profile-list li{min-width:0;display:flex;flex-direction:column;gap:4px}
|
|
@@ -6665,7 +7071,8 @@ var PROFILE_STYLES = `
|
|
|
6665
7071
|
.dsmm-panel-heading{display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between;align-items:center;min-width:0}
|
|
6666
7072
|
.dsmm-panel-heading h2:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
|
|
6667
7073
|
.dsmm-rules-transaction{padding-top:16px}
|
|
6668
|
-
.dsmm-scope-save{display:flex;flex-direction:column;gap:8px;padding
|
|
7074
|
+
.dsmm-scope-save{position:sticky;top:0;z-index:4;display:flex;flex-direction:column;gap:8px;padding:8px 0;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1));border-bottom:1px solid var(--dsw-alias-border-l4);margin-bottom:8px}
|
|
7075
|
+
.dsmm-rules-save-bar{position:sticky;top:var(--dsmm-scope-save-offset,0px);z-index:3;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px 0;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1));border-bottom:1px solid var(--dsw-alias-border-l4);margin-bottom:8px}
|
|
6669
7076
|
.dsmm-deployment .dsmm-deployment-group{border-top:1px solid var(--dsw-alias-border-l4);padding-top:8px;min-width:0}
|
|
6670
7077
|
.dsmm-deployment .dsmm-deployment-group>div{display:flex;flex-direction:column;gap:8px;padding-top:8px}
|
|
6671
7078
|
.dsmm-deployment .dsmm-deployment-group>summary.dsmm-group-summary-row{display:flex;align-items:center;gap:8px;list-style:none}
|
|
@@ -6711,7 +7118,11 @@ var PROFILE_STYLES = `
|
|
|
6711
7118
|
.dsmm-named-profiles .dsmm-advanced-settings[open]{padding-bottom:12px}
|
|
6712
7119
|
.dsmm-named-profiles .dsmm-advanced-settings>summary{font-weight:500}
|
|
6713
7120
|
.dsmm-named-profiles .dsmm-advanced-settings>div{margin-top:12px;display:flex;flex-direction:column;gap:12px}
|
|
6714
|
-
.dsmm-named-profiles .dsmm-save-bar{display:flex;flex-direction:column;gap:8px;padding
|
|
7121
|
+
.dsmm-named-profiles .dsmm-save-bar{position:sticky;top:0;z-index:5;display:flex;flex-direction:column;gap:8px;padding:8px 0 12px;background:var(--dsw-alias-bg-module-platform);border-bottom:1px solid var(--dsw-alias-border-l4);margin-bottom:4px}
|
|
7122
|
+
.dsmm-dialog-top-bar{position:sticky;top:0;z-index:10;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px 0;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1));border-bottom:1px solid var(--dsw-alias-border-l4);flex-shrink:0}
|
|
7123
|
+
.dsmm-profiles :is(.dsmm-field, fieldset, details, .dsmm-zone, input, select, textarea){scroll-margin-top:calc(var(--dsmm-save-bar-offset, 48px) + 12px)}
|
|
7124
|
+
.dsmm-profile-models-dialog :is(.dsmm-field, .dsmm-dialog-role-card, fieldset, details, .dsmm-zone, input, select, textarea){scroll-margin-top:calc(var(--dsmm-dialog-bar-offset, 48px) + 12px)}
|
|
7125
|
+
.dsmm-deployment :is(.dsmm-field, fieldset, details, .dsmm-zone, input, select, textarea){scroll-margin-top:calc(var(--dsmm-scope-save-offset, 48px) + 12px)}
|
|
6715
7126
|
.dsmm-named-profiles .dsmm-save-lock-reason{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;border:1px solid var(--dsw-alias-state-warn-primary);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform)}
|
|
6716
7127
|
.dsmm-named-profiles .dsmm-save-lock-text{font-weight:500;color:var(--dsw-alias-state-warn-primary)}
|
|
6717
7128
|
.dsmm-named-profiles .dsmm-save-lock-action{display:flex;align-items:center;gap:8px}
|
|
@@ -6723,35 +7134,40 @@ var PROFILE_STYLES = `
|
|
|
6723
7134
|
.dsmm-profile-models-dialog{width:min(1040px, calc(100vw - 32px))!important;max-width:1040px!important;max-height:calc(100vh - 48px)!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;box-sizing:border-box;font-family:var(--dsw-font-family);font-size:14px;line-height:22px;color:var(--dsw-alias-label-primary)}
|
|
6724
7135
|
.dsmm-profile-models-dialog-content,
|
|
6725
7136
|
.dsmm-models-dialog-content,
|
|
6726
|
-
.dsmm-profile-models-dialog .dsmm-profile-models-dialog-content{overflow-y:auto!important;overflow-x:hidden;display:flex;flex-direction:column;gap:
|
|
7137
|
+
.dsmm-profile-models-dialog .dsmm-profile-models-dialog-content{overflow-y:auto!important;overflow-x:hidden;display:flex;flex-direction:column;gap:8px;padding:0 0 16px;min-height:0;flex:1 1 auto}
|
|
7138
|
+
.dsmm-profile-models-dialog-content > :last-child{margin-top:0}
|
|
6727
7139
|
.dsmm-models-filter-bar,
|
|
6728
7140
|
.dsmm-dialog-filter-bar,
|
|
6729
|
-
.dsmm-profile-models-dialog .dsmm-filter-bar{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding
|
|
7141
|
+
.dsmm-profile-models-dialog .dsmm-filter-bar{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:4px 0 8px;border-bottom:1px solid var(--dsw-alias-border-l4);flex-shrink:0}
|
|
6730
7142
|
.dsmm-models-filter-bar .dsmm-search-input,
|
|
6731
7143
|
.dsmm-filter-search{flex:1 1 240px;min-width:0}
|
|
7144
|
+
.dsmm-filter-search .dsmm-input{height:32px}
|
|
6732
7145
|
.dsmm-filter-label,
|
|
6733
|
-
.dsmm-filter-override-toggle{display:inline-flex;align-items:center;gap:
|
|
7146
|
+
.dsmm-filter-override-toggle{display:inline-flex;align-items:center;gap:8px;height:32px;min-height:32px;cursor:pointer;font-size:13px;line-height:22px;user-select:none;color:var(--dsw-alias-label-primary)}
|
|
7147
|
+
.dsmm-filter-override-toggle input[type=checkbox]{margin:0;width:16px;height:16px;accent-color:var(--dsw-alias-state-business-primary);flex-shrink:0}
|
|
6734
7148
|
.dsmm-dialog-issue{margin-bottom:8px;padding:8px 12px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);display:flex;flex-direction:column;gap:6px}
|
|
6735
7149
|
.dsmm-dialog-issue-title{font-weight:600;color:var(--dsw-alias-state-error-primary);margin:0}
|
|
6736
7150
|
.dsmm-dialog-issue-action{display:flex;justify-content:flex-end;margin-top:4px}
|
|
6737
7151
|
.dsmm-profile-models-dialog .dsmm-roles-list,
|
|
6738
7152
|
.dsmm-profile-models-dialog .dsmm-dialog-roles-list{display:flex;flex-direction:column;gap:8px;min-width:0}
|
|
6739
7153
|
.dsmm-profile-models-dialog .dsmm-dialog-role-card{display:flex;flex-direction:column;gap:6px;padding:8px 12px;border:1px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);min-width:0}
|
|
6740
|
-
.dsmm-profile-models-dialog .dsmm-role-main-row{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:
|
|
6741
|
-
.dsmm-profile-models-dialog .dsmm-dialog-role-header{display:flex;align-items:center;min-width:
|
|
7154
|
+
.dsmm-profile-models-dialog .dsmm-role-main-row{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:flex-start;gap:8px 16px;min-width:0}
|
|
7155
|
+
.dsmm-profile-models-dialog .dsmm-dialog-role-header{display:flex;align-items:center;min-width:180px;width:200px;flex:0 0 200px;margin-bottom:6px}
|
|
6742
7156
|
.dsmm-profile-models-dialog .dsmm-role-title-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0}
|
|
6743
7157
|
.dsmm-profile-models-dialog .dsmm-role-title{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}
|
|
6744
7158
|
.dsmm-profile-models-dialog .dsmm-role-id-badge{font-family:var(--ds-font-family-code);font-size:11px;padding:1px 4px;border-radius:var(--dsw-radius-xs,2px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);white-space:nowrap}
|
|
6745
7159
|
.dsmm-profile-models-dialog .dsmm-override-badge{font-size:11px;padding:1px 6px;border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-state-business-primary);border:1px solid var(--dsw-alias-state-business-primary);white-space:nowrap}
|
|
6746
|
-
.dsmm-profile-models-dialog .dsmm-role-primary-route{display:flex;flex-wrap:wrap;align-items:flex-end;gap:8px 12px;flex:1 1 auto;justify-content:flex-
|
|
6747
|
-
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-primary-mode-field{flex:0 0 auto;min-width:110px}
|
|
7160
|
+
.dsmm-profile-models-dialog .dsmm-role-primary-route{display:flex;flex-wrap:wrap;align-items:flex-end;gap:8px 12px;flex:1 1 auto;justify-content:flex-start;min-width:0}
|
|
7161
|
+
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-primary-mode-field{flex:0 0 auto;min-width:110px;gap:2px}
|
|
7162
|
+
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-primary-mode-field label{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);margin:0;white-space:nowrap}
|
|
6748
7163
|
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-primary-mode-field select{width:auto;min-width:110px;height:32px}
|
|
6749
7164
|
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-route-fields{display:flex;flex-wrap:nowrap;align-items:flex-end;gap:8px;flex:0 1 auto;min-width:0}
|
|
6750
7165
|
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-route-fields>.dsmm-field{flex:0 1 auto;min-width:100px;max-width:200px;gap:2px}
|
|
7166
|
+
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-route-fields>.dsmm-field label{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);margin:0;white-space:nowrap}
|
|
6751
7167
|
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-route-fields select{width:100%;height:32px}
|
|
6752
7168
|
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-route-fields .dsmm-input{height:32px}
|
|
6753
|
-
.dsmm-profile-models-dialog .dsmm-route-inherited-hint{font-size:12px;color:var(--dsw-alias-label-secondary);
|
|
6754
|
-
.dsmm-profile-models-dialog .dsmm-orchestrator-tag{font-size:12px;color:var(--dsw-alias-label-secondary);
|
|
7169
|
+
.dsmm-profile-models-dialog .dsmm-route-inherited-hint{font-size:12px;color:var(--dsw-alias-label-secondary);height:32px;display:inline-flex;align-items:center;line-height:20px}
|
|
7170
|
+
.dsmm-profile-models-dialog .dsmm-orchestrator-tag{font-size:12px;color:var(--dsw-alias-label-secondary);height:32px;display:inline-flex;align-items:center;line-height:20px}
|
|
6755
7171
|
.dsmm-profile-models-dialog .dsmm-role-details-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;min-width:0;padding-top:4px;border-top:1px dashed var(--dsw-alias-border-l4)}
|
|
6756
7172
|
.dsmm-profile-models-dialog .dsmm-compact-details{display:inline-block;min-width:0}
|
|
6757
7173
|
.dsmm-profile-models-dialog .dsmm-compact-details[open]{flex:1 1 100%;width:100%}
|
|
@@ -6767,6 +7183,7 @@ var PROFILE_STYLES = `
|
|
|
6767
7183
|
.dsmm-profile-models-dialog{width:calc(100vw - 16px)!important;max-height:calc(100vh - 16px)}
|
|
6768
7184
|
.dsmm-profile-models-dialog .dsmm-dialog-role-card{padding:10px}
|
|
6769
7185
|
.dsmm-profile-models-dialog .dsmm-role-main-row{flex-direction:column;align-items:stretch;gap:8px}
|
|
7186
|
+
.dsmm-profile-models-dialog .dsmm-dialog-role-header{width:100%;min-width:0;flex:0 0 auto;margin-bottom:0}
|
|
6770
7187
|
.dsmm-profile-models-dialog .dsmm-role-primary-route{flex-direction:column;align-items:stretch;gap:8px}
|
|
6771
7188
|
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-route-fields{flex-wrap:wrap}
|
|
6772
7189
|
.dsmm-profile-models-dialog .dsmm-role-primary-route .dsmm-route-fields>.dsmm-field{flex:1 1 100%;max-width:100%}
|
|
@@ -7343,6 +7760,8 @@ var deploymentEn = {
|
|
|
7343
7760
|
unitChars: "characters",
|
|
7344
7761
|
useDefaults: "Use defaults",
|
|
7345
7762
|
restoreInheritance: "Restore inheritance",
|
|
7763
|
+
gitWriteAllWrites: "All write operations",
|
|
7764
|
+
gitWriteHighRisk: "High-risk write operations only",
|
|
7346
7765
|
nativeRuntimeState: "Observed native runtime",
|
|
7347
7766
|
nativeRuntimeBinding: "Observed runtime composition",
|
|
7348
7767
|
nativeRuntimeFence: "Execution admission ready",
|
|
@@ -7446,6 +7865,8 @@ var deploymentZh = {
|
|
|
7446
7865
|
unitChars: "字符",
|
|
7447
7866
|
useDefaults: "使用默认值",
|
|
7448
7867
|
restoreInheritance: "恢复继承",
|
|
7868
|
+
gitWriteAllWrites: "所有写操作",
|
|
7869
|
+
gitWriteHighRisk: "仅高风险写操作",
|
|
7449
7870
|
nativeRuntimeState: "已观测原生运行时",
|
|
7450
7871
|
nativeRuntimeBinding: "已观测运行时组合",
|
|
7451
7872
|
nativeRuntimeFence: "执行准入已就绪",
|
|
@@ -7529,7 +7950,7 @@ var deploymentFieldLabels = {
|
|
|
7529
7950
|
scope: ["Guard scope", "保护范围"],
|
|
7530
7951
|
shellCommandSafety: ["Shell command safety", "Shell 命令安全"],
|
|
7531
7952
|
gitWriteGuard: ["Git write policy", "Git 写入策略"],
|
|
7532
|
-
gitWriteScope: ["
|
|
7953
|
+
gitWriteScope: ["Git write protection scope", "Git 写操作保护范围"],
|
|
7533
7954
|
toolOutputTruncation: ["Tool output truncation", "工具输出截断"],
|
|
7534
7955
|
maxInlineBytes: ["Inline byte limit", "内联字节上限"],
|
|
7535
7956
|
planFormatValidation: ["Plan format validation", "计划格式校验"],
|
|
@@ -8340,6 +8761,7 @@ function Field({ schema, path, controller, initiallyOpen = false, disclosures, t
|
|
|
8340
8761
|
};
|
|
8341
8762
|
const explicit = at(state.draft, path), inherited = controller.layer === "global" ? at(snapshot4.defaults, path) : at(mergeLayer(mergeLayer(snapshot4.defaults, snapshot4.global), snapshot4.nativeForm?.base ?? {}), path);
|
|
8342
8763
|
const choices = enumValues(schema), disabled = !controller.canEdit();
|
|
8764
|
+
const choiceLabel = (value) => name2 === "guards.gitWriteScope" && (value === "all-writes" || value === "high-risk") ? t(value === "all-writes" ? "gitWriteAllWrites" : "gitWriteHighRisk") : displayValue(value, t);
|
|
8343
8765
|
if (name2 === "permissionControl.nativeCommands.entries") return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "data-field": name2, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NativeCommandEntries, { controller, value: explicit, inherited: inherited ?? [], disabled, onChange: (value) => controller.edit(path, value), setInvalid: (key, bad) => controller.setInvalid(key, bad), t: permissionText(t) }) });
|
|
8344
8766
|
if (name2 === "permissionControl.rules") return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "data-field": name2, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PermissionRuleEntries, { controller, value: explicit, inherited: inherited ?? [], disabled, onChange: (value) => controller.edit(path, value), expanded: open, onExpandedChange: expand, t: permissionText(t) }) });
|
|
8345
8767
|
if (schema.type === "object" && schema.fields !== void 0 && path[0] !== "roleRouting") return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { className: "dsmm-deployment-group", "data-field": name2, open, onToggle: (event) => expand(event.currentTarget.open), children: [
|
|
@@ -8357,8 +8779,8 @@ function Field({ schema, path, controller, initiallyOpen = false, disclosures, t
|
|
|
8357
8779
|
schema.type === "boolean" || choices !== null ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
8358
8780
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { htmlFor: id2, children: fieldLabel(path, t) }),
|
|
8359
8781
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { id: id2, disabled, value: explicit === void 0 ? "inherit" : JSON.stringify(explicit), onChange: (event) => controller.edit(path, event.currentTarget.value === "inherit" ? void 0 : JSON.parse(event.currentTarget.value)), children: [
|
|
8360
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "inherit", children: `${unsetLabel} · ${
|
|
8361
|
-
(choices ?? [true, false]).map((choice2) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: JSON.stringify(choice2), children:
|
|
8782
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "inherit", children: `${unsetLabel} · ${choiceLabel(inherited)}` }),
|
|
8783
|
+
(choices ?? [true, false]).map((choice2) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: JSON.stringify(choice2), children: choiceLabel(choice2) }, String(choice2)))
|
|
8362
8784
|
] })
|
|
8363
8785
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScalarField, { schema, path, controller, inherited, t }),
|
|
8364
8786
|
name2 === "modelParameters.passthrough" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsmm-hint", children: t("modelParametersHint") }),
|
|
@@ -8865,6 +9287,14 @@ function PermissionRulesEditor({ controller, state, t }) {
|
|
|
8865
9287
|
const id2 = (0, import_react9.useId)(), draft2 = state.draft, disabled = !controller.canEdit(state.generation), value = observedRules(state), observedPolicy = value?.snapshot ?? null;
|
|
8866
9288
|
const writable = state.scope === "root" && state.connected;
|
|
8867
9289
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "dsmm-zone", "aria-label": t("rules"), children: [
|
|
9290
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "dsmm-rules-save-bar", children: [
|
|
9291
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "dsmm-actions", children: [
|
|
9292
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dsh_client_ui_primitives9.Button, { type: "button", variant: "primary", disabled: !controller.canSave(state.generation), onClick: () => void controller.save(state.generation), children: t("save") }),
|
|
9293
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dsh_client_ui_primitives9.Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null, onClick: () => void controller.refresh(state.generation), children: t("refresh") }),
|
|
9294
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dsh_client_ui_primitives9.Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null || !state.dirty && state.rulesIssue === null, onClick: () => void controller.refresh(state.generation, true), children: t("discard") })
|
|
9295
|
+
] }),
|
|
9296
|
+
state.dirty && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: t("dirty") })
|
|
9297
|
+
] }),
|
|
8868
9298
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { children: t("rules") }),
|
|
8869
9299
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "dsmm-hint", children: t("rulesHint") }),
|
|
8870
9300
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Issue, { value: state.rulesIssue, t }),
|
|
@@ -8944,13 +9374,7 @@ function PermissionRulesEditor({ controller, state, t }) {
|
|
|
8944
9374
|
] }, ruleId))
|
|
8945
9375
|
] })
|
|
8946
9376
|
] }),
|
|
8947
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RuleRecords, { state, controller, t })
|
|
8948
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "dsmm-actions", children: [
|
|
8949
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dsh_client_ui_primitives9.Button, { type: "button", variant: "primary", disabled: !controller.canSave(state.generation), onClick: () => void controller.save(state.generation), children: t("save") }),
|
|
8950
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dsh_client_ui_primitives9.Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null, onClick: () => void controller.refresh(state.generation), children: t("refresh") }),
|
|
8951
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dsh_client_ui_primitives9.Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null || !state.dirty && state.rulesIssue === null, onClick: () => void controller.refresh(state.generation, true), children: t("discard") })
|
|
8952
|
-
] }),
|
|
8953
|
-
state.dirty && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: t("dirty") })
|
|
9377
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RuleRecords, { state, controller, t })
|
|
8954
9378
|
] });
|
|
8955
9379
|
}
|
|
8956
9380
|
function PermissionsPanel({ controller, t, sessionId: sessionId2 }) {
|
|
@@ -8975,21 +9399,50 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
|
8975
9399
|
function ScopeSave({ controller, workspace, refreshOnly = false, t }) {
|
|
8976
9400
|
const state = (0, import_react10.useSyncExternalStore)(controller.subscribe, controller.getSnapshot);
|
|
8977
9401
|
const pending = [...new Set(controller.pendingPaths().map(moduleFor))];
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
9402
|
+
const ref = (0, import_react10.useRef)(null);
|
|
9403
|
+
(0, import_react10.useEffect)(() => {
|
|
9404
|
+
const el = ref.current;
|
|
9405
|
+
if (!el) return;
|
|
9406
|
+
const parent = el.closest(".dsmm-section-panel");
|
|
9407
|
+
const update = () => {
|
|
9408
|
+
const height = el.offsetHeight;
|
|
9409
|
+
if (parent) {
|
|
9410
|
+
parent.style.setProperty("--dsmm-scope-save-offset", `${height}px`);
|
|
9411
|
+
}
|
|
9412
|
+
};
|
|
9413
|
+
update();
|
|
9414
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
9415
|
+
const ro = new ResizeObserver(update);
|
|
9416
|
+
ro.observe(el);
|
|
9417
|
+
return () => {
|
|
9418
|
+
ro.disconnect();
|
|
9419
|
+
if (parent) {
|
|
9420
|
+
parent.style.removeProperty("--dsmm-scope-save-offset");
|
|
9421
|
+
}
|
|
9422
|
+
};
|
|
9423
|
+
}
|
|
9424
|
+
return () => {
|
|
9425
|
+
if (parent) {
|
|
9426
|
+
parent.style.removeProperty("--dsmm-scope-save-offset");
|
|
9427
|
+
}
|
|
9428
|
+
};
|
|
9429
|
+
}, []);
|
|
9430
|
+
const status = refreshOnly ? state.busy ? t("loading") : "" : state.busy ? t("saving") : state.refreshRequired ? t("savedRefreshRequired") : state.saved ? t("saved") : state.dirty ? t("dirty") : "";
|
|
9431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { ref, className: "dsmm-scope-save", "aria-label": t("saveScope"), children: [
|
|
9432
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "dsmm-actions", children: [
|
|
9433
|
+
!refreshOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dsh_client_ui_primitives10.Button, { type: "button", variant: "primary", disabled: !controller.canSave(), onClick: () => void (workspace?.save() ?? controller.save()), children: t(controller.layer === "global" ? "saveGlobal" : "saveProfile") }),
|
|
9434
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dsh_client_ui_primitives10.Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => void controller.refresh(), children: t("refresh") }),
|
|
9435
|
+
!refreshOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dsh_client_ui_primitives10.Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null && !state.refreshRequired, onClick: () => void controller.refresh(true), children: t("discard") }),
|
|
9436
|
+
status !== "" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: status })
|
|
9437
|
+
] }),
|
|
9438
|
+
!refreshOnly && pending.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "dsmm-hint", children: [
|
|
8981
9439
|
t("pendingModules"),
|
|
8982
9440
|
": ",
|
|
8983
9441
|
pending.map((module2) => t(moduleTitle(module2))).join(" · ")
|
|
8984
9442
|
] }),
|
|
8985
9443
|
state.issue !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }),
|
|
8986
9444
|
!refreshOnly && state.invalidFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }),
|
|
8987
|
-
controller.layer === "profile" && !controller.canWriteProfile() && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "dsmm-hint", children: t("unavailableForm") })
|
|
8988
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "dsmm-actions", children: [
|
|
8989
|
-
!refreshOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dsh_client_ui_primitives10.Button, { type: "button", variant: "primary", disabled: !controller.canSave(), onClick: () => void (workspace?.save() ?? controller.save()), children: t(controller.layer === "global" ? "saveGlobal" : "saveProfile") }),
|
|
8990
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dsh_client_ui_primitives10.Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => void controller.refresh(), children: t("refresh") }),
|
|
8991
|
-
!refreshOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dsh_client_ui_primitives10.Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null && !state.refreshRequired, onClick: () => void controller.refresh(true), children: t("discard") })
|
|
8992
|
-
] })
|
|
9445
|
+
controller.layer === "profile" && !controller.canWriteProfile() && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "dsmm-hint", children: t("unavailableForm") })
|
|
8993
9446
|
] });
|
|
8994
9447
|
}
|
|
8995
9448
|
function NativeRuntimeState({ value, t }) {
|
|
@@ -9182,16 +9635,13 @@ function DeploymentPage(props) {
|
|
|
9182
9635
|
)) }),
|
|
9183
9636
|
active !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { id: `${id2}-panel`, role: "tabpanel", className: "dsmm-section-panel", "aria-labelledby": `${id2}-tab-${active}`, "data-dsmm-module": active, children: [
|
|
9184
9637
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "dsmm-panel-heading", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { id: `${id2}-heading`, ref: heading, tabIndex: -1, children: t(moduleTitle(active)) }) }),
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
scopeActions
|
|
9188
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
9638
|
+
scopeActions,
|
|
9639
|
+
active === "state" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StateInspector, { controller: props.core, t }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
9189
9640
|
navigation.scope === "profile" && navigation.native === null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: t("unavailableForm") }) : state.snapshot === null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: t(state.busy ? "loading" : "unavailable") }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, className: "dsmm-structured", children: [
|
|
9190
9641
|
fields.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "dsmm-hint", children: t("noModuleFields") }),
|
|
9191
9642
|
fields.map(([key, schema]) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Field, { schema, path: [key], controller, initiallyOpen: fields.length === 1 && active !== "permissions", disclosures: disclosures.current[navigation.scope], t }, `${navigation.scope}:${key}`)),
|
|
9192
9643
|
active === "run" && controller.layer === "profile" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NativeRuntimeState, { value: state.snapshot.subagentRuntime, t })
|
|
9193
9644
|
] }),
|
|
9194
|
-
scopeActions,
|
|
9195
9645
|
active === "permissions" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("section", { className: "dsmm-zone dsmm-rules-transaction", "aria-label": t("rootRules"), children: workspace.permissions === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: t("rootRulesUnavailable") }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PermissionsPanel, { controller: workspace.permissions, t: props.permissionsT ?? ((key) => Object.hasOwn(permissionEn, key) ? permissionText(t)(key) : key) }) })
|
|
9196
9646
|
] })
|
|
9197
9647
|
] }),
|
|
@@ -9579,7 +10029,7 @@ var roleToolEn = {
|
|
|
9579
10029
|
output: "Complete result content",
|
|
9580
10030
|
failure: "Error details",
|
|
9581
10031
|
metadata: "Invocation metadata",
|
|
9582
|
-
inspect: "
|
|
10032
|
+
inspect: "View call details",
|
|
9583
10033
|
copy: "Copy",
|
|
9584
10034
|
copied: "Copied",
|
|
9585
10035
|
emptyArgs: "Arguments not available yet",
|
|
@@ -9615,7 +10065,7 @@ var roleToolZh = {
|
|
|
9615
10065
|
output: "完整结果内容",
|
|
9616
10066
|
failure: "错误详情",
|
|
9617
10067
|
metadata: "调用元数据",
|
|
9618
|
-
inspect: "
|
|
10068
|
+
inspect: "查看调用详情",
|
|
9619
10069
|
copy: "复制",
|
|
9620
10070
|
copied: "已复制",
|
|
9621
10071
|
emptyArgs: "参数尚不可用",
|
|
@@ -9799,6 +10249,28 @@ function registerRoleToolViews(ctx) {
|
|
|
9799
10249
|
});
|
|
9800
10250
|
}
|
|
9801
10251
|
|
|
10252
|
+
// src/client/profile-blank.ts
|
|
10253
|
+
function profileBlankNative(services) {
|
|
10254
|
+
const list = services.workspaces.list;
|
|
10255
|
+
return {
|
|
10256
|
+
workspaces: {
|
|
10257
|
+
getSnapshot: () => {
|
|
10258
|
+
const state = list.getSnapshot();
|
|
10259
|
+
return state.phase === "ready" ? state.items.map((item) => ({ id: item.workspaceId, label: item.title || item.path })) : [];
|
|
10260
|
+
},
|
|
10261
|
+
subscribe: (listener) => list.subscribe(listener)
|
|
10262
|
+
},
|
|
10263
|
+
beginNavigation: () => services.layout.beginNavigation(),
|
|
10264
|
+
connectWorkspace: (id2) => {
|
|
10265
|
+
const state = list.getSnapshot(), workspace = state.phase === "ready" ? state.items.find((item) => item.workspaceId === id2) : void 0;
|
|
10266
|
+
if (workspace === void 0) return Promise.reject(new Error("Workspace unavailable"));
|
|
10267
|
+
return services.uiWorkspace.connectWorkspace(workspace.workspaceId);
|
|
10268
|
+
},
|
|
10269
|
+
retain: (id2) => services.sessions.retain(id2, { source: "controllerOperation" }),
|
|
10270
|
+
openSession: (id2) => services.uiWorkspace.openSession(id2)
|
|
10271
|
+
};
|
|
10272
|
+
}
|
|
10273
|
+
|
|
9802
10274
|
// src/client/children-controller.ts
|
|
9803
10275
|
var EMPTY_CHILD_DRAFT = { text: "", delivery: "queue", images: [], imageBusy: false, uncertain: false };
|
|
9804
10276
|
var childActionKey = (childId) => `child:${childId}`;
|
|
@@ -10476,6 +10948,7 @@ async function apply(ctx) {
|
|
|
10476
10948
|
void profileCtx.inject(["connection"], (connectionCtx) => {
|
|
10477
10949
|
controller.bindConnection(connectionCtx.connection.generation);
|
|
10478
10950
|
void controller.refresh();
|
|
10951
|
+
void controller.refreshSession();
|
|
10479
10952
|
connectionCtx.effect(() => () => controller.bindConnection(null), "dsmm: profile connection withdrawal");
|
|
10480
10953
|
});
|
|
10481
10954
|
profiles = controller;
|
|
@@ -10500,6 +10973,10 @@ async function apply(ctx) {
|
|
|
10500
10973
|
controller.attachComposerBlocks(conversationCtx.conversation.blocks, () => t("sessionSelectionBlock"));
|
|
10501
10974
|
conversationCtx.effect(() => () => controller.attachComposerBlocks(null), "dsmm: profile composer block lifetime");
|
|
10502
10975
|
});
|
|
10976
|
+
void profileCtx.inject(["uiWorkspace", "workspaces", "layout", "sessions", "uiSession"], (blankCtx) => {
|
|
10977
|
+
controller.attachBlankNative(profileBlankNative(blankCtx));
|
|
10978
|
+
blankCtx.effect(() => () => controller.attachBlankNative(null), "dsmm: native blank preparation lifetime");
|
|
10979
|
+
});
|
|
10503
10980
|
profileCtx.slots.inject("settings.section", () => profileCtx.slots.register({
|
|
10504
10981
|
name: "settings.section",
|
|
10505
10982
|
id: "dsmm-profiles",
|
|
@@ -10527,9 +11004,11 @@ async function apply(ctx) {
|
|
|
10527
11004
|
const nativeSessions = sessionCtx.sessions;
|
|
10528
11005
|
const update = () => {
|
|
10529
11006
|
const binding = source.getSnapshot();
|
|
11007
|
+
const nativeBinding = binding.key === void 0 ? void 0 : nativeSessions.binding(binding.key);
|
|
11008
|
+
controller.attachSessionSource(binding.key ?? null, nativeBinding?.session ?? null);
|
|
10530
11009
|
controller.setSession(binding.key ?? null);
|
|
10531
11010
|
controller.attachModelSelectionSource(binding.key ?? null, binding.key === void 0 ? null : binding.keyedHooks.projection?.("modelSelection") ?? null);
|
|
10532
|
-
controller.attachModelEventSource(binding.key ?? null,
|
|
11011
|
+
controller.attachModelEventSource(binding.key ?? null, nativeBinding?.eventSource ?? null);
|
|
10533
11012
|
};
|
|
10534
11013
|
update();
|
|
10535
11014
|
sessionCtx.effect(() => source.subscribe(update), "dsmm: current native session");
|
|
@@ -10538,6 +11017,7 @@ async function apply(ctx) {
|
|
|
10538
11017
|
controller.attachModelEventSource(null, null);
|
|
10539
11018
|
controller.attachModelInteractionSource(null, null);
|
|
10540
11019
|
controller.setSession(null);
|
|
11020
|
+
controller.attachSessionSource(null, null);
|
|
10541
11021
|
}, "dsmm: native session withdrawal");
|
|
10542
11022
|
void sessionCtx.inject(["modelDirectories", "remote.session"], (modelCtx) => {
|
|
10543
11023
|
const updateInteraction = () => {
|