@darkbear9494/dsh-model-manager 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +399 -55
- package/client.js +259 -5
- package/cordis.patch.yml +23 -2
- package/lib/index.js +1047 -30
- package/package.json +6 -4
package/client.js
CHANGED
|
@@ -56,6 +56,22 @@ window.__ModuleLoader__.load({
|
|
|
56
56
|
const USAGE_PROJECTION_KEY = 'modelManagerUsage';
|
|
57
57
|
const ROLES = ['main', 'planning', 'execution', 'vision'];
|
|
58
58
|
const MODES = ['hybrid', 'managed', 'advisory'];
|
|
59
|
+
const DELEGATION_LEVELS = ['off', 'balanced', 'eager'];
|
|
60
|
+
/**
|
|
61
|
+
* This package's version, pinned for the browser half. The host reads the
|
|
62
|
+
* real manifest; the client cannot (no fs), so this constant is the
|
|
63
|
+
* fallback AND the primary source for the update banner —
|
|
64
|
+
* test/packaging.test.mjs pins it equal to package.json, so a release that
|
|
65
|
+
* forgets to bump both fails the suite instead of shipping a wrong banner.
|
|
66
|
+
*/
|
|
67
|
+
const VERSION = '0.5.0';
|
|
68
|
+
/**
|
|
69
|
+
* Registry path of this package. The scoped name is percent-encoded the
|
|
70
|
+
* way npm serves scoped packuments.
|
|
71
|
+
*/
|
|
72
|
+
const UPDATE_PACKAGE_PATH = '@darkbear9494%2fdsh-model-manager';
|
|
73
|
+
const UPDATE_REGISTRY_DEFAULT = 'https://registry.npmjs.org';
|
|
74
|
+
const UPDATE_FETCH_TIMEOUT_MS = 10_000;
|
|
59
75
|
/**
|
|
60
76
|
* How long to wait for the session-scoped catalog before relying on the
|
|
61
77
|
* global `remote.llm` directory alone. It is a bonus source (it carries
|
|
@@ -69,9 +85,9 @@ window.__ModuleLoader__.load({
|
|
|
69
85
|
summary: 'Model roles',
|
|
70
86
|
help: 'Each role names the model used for that kind of work. Changes apply immediately.',
|
|
71
87
|
roleMain: 'Main model',
|
|
72
|
-
roleMainHint: 'Top-level agent outside plan mode. Unset keeps the composer in charge. When set, it takes over only sessions that never had a manual pick — a model you chose in the composer keeps running, unless the mode is managed.',
|
|
88
|
+
roleMainHint: 'Top-level agent outside plan mode and planning skills. Unset keeps the composer in charge. When set, it takes over only sessions that never had a manual pick — a model you chose in the composer keeps running, unless the mode is managed.',
|
|
73
89
|
rolePlanning: 'Planning and reasoning',
|
|
74
|
-
rolePlanningHint: 'Used in plan mode and for delegations labelled as planning work.',
|
|
90
|
+
rolePlanningHint: 'Used in plan mode, while a planning skill such as grilling is active, and for delegations labelled as planning work.',
|
|
75
91
|
roleExecution: 'Execution',
|
|
76
92
|
roleExecutionHint: 'The default tier for delegated implementation work.',
|
|
77
93
|
roleVision: 'Image recognition',
|
|
@@ -101,6 +117,20 @@ window.__ModuleLoader__.load({
|
|
|
101
117
|
pickFirst: 'first — use the top model, fall back down the list',
|
|
102
118
|
pickRoundRobin: 'round-robin — rotate across the list',
|
|
103
119
|
pickHint: 'One strategy for every role. "first" keeps each list as a failover chain; "round-robin" rotates across it.',
|
|
120
|
+
delegation: 'Auto delegation',
|
|
121
|
+
delegationOff: 'off — no delegation policy is added',
|
|
122
|
+
delegationBalanced: 'balanced — delegate multi-step and independent work',
|
|
123
|
+
delegationEager: 'eager — orchestrate: delegate nearly all substantive work',
|
|
124
|
+
delegationHint: 'Adds a system-prompt policy telling the top-level agent to plan and dispatch subagents instead of doing everything itself. Delegated children are never encouraged to delegate further; the policy only renders when the agent actually has the delegation tools.',
|
|
125
|
+
updateTitle: 'Update available',
|
|
126
|
+
updateBanner: 'Update available: {latest} (installed {current}).',
|
|
127
|
+
updateCommand: 'Upgrade: dsh plugin --profile <profile> add @darkbear9494/dsh-model-manager@latest, then restart the harness.',
|
|
128
|
+
updateChip: 'Update: {latest}',
|
|
129
|
+
updateChipHint: 'A newer @darkbear9494/dsh-model-manager is published. Click for the upgrade command.',
|
|
130
|
+
updateRecheck: 'Re-check',
|
|
131
|
+
updateChecking: 'Checking for updates…',
|
|
132
|
+
updateUpToDate: 'Up to date ({version}).',
|
|
133
|
+
updateFailed: 'Update check failed: {reason}',
|
|
104
134
|
orderHint: 'Order is the fallback order: the top model is tried first.',
|
|
105
135
|
usageTitle: 'Model usage',
|
|
106
136
|
usageModel: 'Provider / model',
|
|
@@ -119,9 +149,9 @@ window.__ModuleLoader__.load({
|
|
|
119
149
|
summary: '模型角色',
|
|
120
150
|
help: '每个角色指定该类工作使用的模型。更改会立即生效。',
|
|
121
151
|
roleMain: '主模型',
|
|
122
|
-
roleMainHint: '
|
|
152
|
+
roleMainHint: '非计划模式且没有规划类技能生效时顶层 Agent 使用的模型。留空则完全跟随输入框选择。设置后只接管从未手动选过模型的会话;你在输入框点选过的模型会继续使用,除非分发模式为 managed。',
|
|
123
153
|
rolePlanning: '规划与推理',
|
|
124
|
-
rolePlanningHint: '
|
|
154
|
+
rolePlanningHint: '计划模式下使用,规划类技能(如 grilling)生效时也使用,也用于标记为规划类工作的委派。',
|
|
125
155
|
roleExecution: '执行',
|
|
126
156
|
roleExecutionHint: '委派实现的默认档位。',
|
|
127
157
|
roleVision: '图像识别',
|
|
@@ -151,6 +181,20 @@ window.__ModuleLoader__.load({
|
|
|
151
181
|
pickFirst: 'first — 优先用第一个,失败时按顺序向下回退',
|
|
152
182
|
pickRoundRobin: 'round-robin — 在列表内轮流使用',
|
|
153
183
|
pickHint: '所有角色共用这一个选择方式。"first" 把每个角色的列表当作回退链;"round-robin" 在列表内轮流使用。',
|
|
184
|
+
delegation: '自动委派',
|
|
185
|
+
delegationOff: 'off — 不注入任何委派策略',
|
|
186
|
+
delegationBalanced: 'balanced — 多步骤与可并行的任务交给子智能体',
|
|
187
|
+
delegationEager: 'eager — 全程编排:几乎所有实质工作都委派出去',
|
|
188
|
+
delegationHint: '向顶层智能体的系统提示注入委派策略,让它先规划再派发子智能体,而不是事事亲力亲为。被委派的子智能体不会被鼓励继续往下委派;策略只在智能体确实持有委派工具时生效。',
|
|
189
|
+
updateTitle: '有可用更新',
|
|
190
|
+
updateBanner: '有可用更新:{latest}(当前 {current})。',
|
|
191
|
+
updateCommand: '升级命令:dsh plugin --profile <profile> add @darkbear9494/dsh-model-manager@latest,执行后重启。',
|
|
192
|
+
updateChip: '更新:{latest}',
|
|
193
|
+
updateChipHint: '已发布更新的 @darkbear9494/dsh-model-manager。点击查看升级命令。',
|
|
194
|
+
updateRecheck: '重新检查',
|
|
195
|
+
updateChecking: '正在检查更新…',
|
|
196
|
+
updateUpToDate: '已是最新({version})。',
|
|
197
|
+
updateFailed: '更新检查失败:{reason}',
|
|
154
198
|
orderHint: '列表顺序即回退顺序:排在最前的模型优先使用。',
|
|
155
199
|
usageTitle: '模型用量',
|
|
156
200
|
usageModel: '提供方 / 模型',
|
|
@@ -307,6 +351,31 @@ window.__ModuleLoader__.load({
|
|
|
307
351
|
error: { fontSize: '0.76rem', color: 'var(--dsw-alias-state-error-primary)' },
|
|
308
352
|
ok: { fontSize: '0.76rem', color: 'var(--dsw-alias-state-success-primary)' },
|
|
309
353
|
summary: { fontSize: '0.8rem', color: 'var(--dsw-alias-label-secondary)' },
|
|
354
|
+
// The update banner: a warn-toned block with the upgrade command and a
|
|
355
|
+
// re-check action, so an available release is actionable, not just stated.
|
|
356
|
+
updateBanner: {
|
|
357
|
+
display: 'flex',
|
|
358
|
+
flexDirection: 'column',
|
|
359
|
+
gap: '0.3rem',
|
|
360
|
+
padding: '0.5rem 0.6rem',
|
|
361
|
+
borderRadius: 8,
|
|
362
|
+
border: '1px solid var(--dsw-alias-state-warn-primary)',
|
|
363
|
+
background: 'var(--dsw-alias-bg-layer-2)',
|
|
364
|
+
color: 'var(--dsw-alias-state-warn-primary)',
|
|
365
|
+
fontSize: '0.78rem',
|
|
366
|
+
},
|
|
367
|
+
updateBannerHead: { display: 'flex', alignItems: 'baseline', gap: '0.5rem', fontWeight: 600 },
|
|
368
|
+
updateBannerText: { color: 'var(--dsw-alias-label-primary)', fontFamily: 'ui-monospace, monospace', overflowWrap: 'anywhere' },
|
|
369
|
+
updateRecheck: {
|
|
370
|
+
alignSelf: 'flex-start',
|
|
371
|
+
padding: '0.15rem 0.5rem',
|
|
372
|
+
borderRadius: 6,
|
|
373
|
+
border: '1px solid var(--dsw-alias-border-l1)',
|
|
374
|
+
background: 'var(--dsw-alias-bg-layer-1)',
|
|
375
|
+
color: 'var(--dsw-alias-label-secondary)',
|
|
376
|
+
fontSize: '0.74rem',
|
|
377
|
+
cursor: 'pointer',
|
|
378
|
+
},
|
|
310
379
|
};
|
|
311
380
|
|
|
312
381
|
const routeKey = (provider, model) => `${provider}\u0000${model}`;
|
|
@@ -502,6 +571,107 @@ window.__ModuleLoader__.load({
|
|
|
502
571
|
safely('adapter updates', () => use(() => ctx.remote.$on('llm/adapters-updated', () => void loadCatalog()), 'model-manager: adapter updates'));
|
|
503
572
|
safely('settings updates', () => use(() => ctx.remote.$on('settings/document-updated', () => void loadCatalog()), 'model-manager: settings updates'));
|
|
504
573
|
|
|
574
|
+
// -- update check --------------------------------------------------------
|
|
575
|
+
// The host half checks on its own schedule (log line + model_manager tool
|
|
576
|
+
// action "update"); the browser cannot read that state, so this half runs
|
|
577
|
+
// the same comparison itself: one packument fetch per page load, plus one
|
|
578
|
+
// per settings save (the registry URL is row config) and per manual
|
|
579
|
+
// re-check. Offline or CORS-blocked deployments simply see no banner —
|
|
580
|
+
// the host log and the tool action still report the update.
|
|
581
|
+
const updateListeners = new Set();
|
|
582
|
+
const updateStore = { status: 'idle' };
|
|
583
|
+
const publishUpdate = (patch) => {
|
|
584
|
+
Object.assign(updateStore, patch, { at: Date.now() });
|
|
585
|
+
for (const listener of [...updateListeners]) {
|
|
586
|
+
try {
|
|
587
|
+
listener();
|
|
588
|
+
} catch {
|
|
589
|
+
/* a broken subscriber must not break the others */
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const subscribeUpdate = (listener) => {
|
|
594
|
+
updateListeners.add(listener);
|
|
595
|
+
return () => updateListeners.delete(listener);
|
|
596
|
+
};
|
|
597
|
+
const getUpdateSnapshot = () => updateStore;
|
|
598
|
+
|
|
599
|
+
/** The registry URL from the row config, when the form is bound. */
|
|
600
|
+
const registryFromForm = () => {
|
|
601
|
+
try {
|
|
602
|
+
const snapshot = settingsGetSnapshot();
|
|
603
|
+
const registry = snapshot?.value?.update?.registry;
|
|
604
|
+
return typeof registry === 'string' && registry.trim() !== ''
|
|
605
|
+
? registry.trim().replace(/\/+$/, '') : undefined;
|
|
606
|
+
} catch {
|
|
607
|
+
return undefined;
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
/** Semver-shaped comparison, mirroring the host half's rules. */
|
|
612
|
+
const compareClientVersions = (a, b) => {
|
|
613
|
+
const parse = (input) => {
|
|
614
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(String(input ?? '').trim());
|
|
615
|
+
return match === null ? undefined : [Number(match[1]), Number(match[2]), Number(match[3]), match[4] ?? ''];
|
|
616
|
+
};
|
|
617
|
+
const left = parse(a);
|
|
618
|
+
const right = parse(b);
|
|
619
|
+
if (left === undefined || right === undefined) return undefined;
|
|
620
|
+
for (let index = 0; index < 3; index += 1) {
|
|
621
|
+
if (left[index] !== right[index]) return left[index] < right[index] ? -1 : 1;
|
|
622
|
+
}
|
|
623
|
+
// A release sorts above any prerelease; prerelease identifiers compare
|
|
624
|
+
// numerically when both are numeric, else in ASCII order.
|
|
625
|
+
const lp = left[3] === '' ? [] : left[3].split('.');
|
|
626
|
+
const rp = right[3] === '' ? [] : right[3].split('.');
|
|
627
|
+
if (lp.length === 0 && rp.length === 0) return 0;
|
|
628
|
+
if (lp.length === 0) return 1;
|
|
629
|
+
if (rp.length === 0) return -1;
|
|
630
|
+
for (let index = 0; index < lp.length || index < rp.length; index += 1) {
|
|
631
|
+
const x = lp[index];
|
|
632
|
+
const y = rp[index];
|
|
633
|
+
if (x === undefined) return -1;
|
|
634
|
+
if (y === undefined) return 1;
|
|
635
|
+
const xn = /^\d+$/.test(x);
|
|
636
|
+
const yn = /^\d+$/.test(y);
|
|
637
|
+
if (xn && yn) {
|
|
638
|
+
if (Number(x) !== Number(y)) return Number(x) < Number(y) ? -1 : 1;
|
|
639
|
+
} else if (xn) return -1;
|
|
640
|
+
else if (yn) return 1;
|
|
641
|
+
else if (x !== y) return x < y ? -1 : 1;
|
|
642
|
+
}
|
|
643
|
+
return 0;
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
const checkUpdates = async () => {
|
|
647
|
+
// Browser-only on purpose: a module test (or any non-page host) has no
|
|
648
|
+
// window.location, and firing a real registry fetch from a test would
|
|
649
|
+
// make the suite depend on the network.
|
|
650
|
+
if (typeof window === 'undefined' || window.location === undefined) return;
|
|
651
|
+
if (typeof fetch !== 'function') return;
|
|
652
|
+
publishUpdate({ status: 'checking' });
|
|
653
|
+
try {
|
|
654
|
+
const registry = registryFromForm() ?? UPDATE_REGISTRY_DEFAULT;
|
|
655
|
+
const signal = typeof AbortSignal?.timeout === 'function'
|
|
656
|
+
? AbortSignal.timeout(UPDATE_FETCH_TIMEOUT_MS) : undefined;
|
|
657
|
+
const response = await fetch(`${registry}/${UPDATE_PACKAGE_PATH}`, {
|
|
658
|
+
headers: { accept: 'application/vnd.npm.install-v1+json' },
|
|
659
|
+
...(signal === undefined ? {} : { signal }),
|
|
660
|
+
});
|
|
661
|
+
if (response?.ok !== true) throw new Error(`HTTP ${response?.status ?? '(no status)'}`);
|
|
662
|
+
const packument = await response.json();
|
|
663
|
+
const latest = packument?.['dist-tags']?.latest;
|
|
664
|
+
if (typeof latest !== 'string' || latest === '') throw new Error('no dist-tags.latest');
|
|
665
|
+
const order = compareClientVersions(latest, VERSION);
|
|
666
|
+
if (order === undefined) throw new Error(`unparseable version pair "${latest}" / "${VERSION}"`);
|
|
667
|
+
if (order > 0) publishUpdate({ status: 'available', latest, current: VERSION, registry });
|
|
668
|
+
else publishUpdate({ status: 'ok', latest, current: VERSION, registry });
|
|
669
|
+
} catch (error) {
|
|
670
|
+
publishUpdate({ status: 'error', reason: error?.message ?? String(error) });
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
safely('settings updates (update re-check)', () => use(() => ctx.remote.$on('settings/document-updated', () => void checkUpdates()), 'model-manager: settings update re-check'));
|
|
674
|
+
|
|
505
675
|
// -- lookups ------------------------------------------------------------
|
|
506
676
|
const modelIn = (provider, model) => {
|
|
507
677
|
for (const group of catalog.groups) {
|
|
@@ -535,6 +705,7 @@ window.__ModuleLoader__.load({
|
|
|
535
705
|
function Card(props) {
|
|
536
706
|
const state = React.useSyncExternalStore(subscribe, getSnapshot);
|
|
537
707
|
const shared = React.useSyncExternalStore(settingsSubscribe, settingsGetSnapshot);
|
|
708
|
+
const update = React.useSyncExternalStore(subscribeUpdate, getUpdateSnapshot, getUpdateSnapshot);
|
|
538
709
|
const [status, setStatus] = React.useState(null);
|
|
539
710
|
const view = props?.view;
|
|
540
711
|
const form = props?.form ?? settingsForm;
|
|
@@ -543,6 +714,8 @@ window.__ModuleLoader__.load({
|
|
|
543
714
|
const roles = isObject(value.roles) ? value.roles : {};
|
|
544
715
|
const mode = isObject(value.strategy) && typeof value.strategy.mode === 'string' ? value.strategy.mode : 'hybrid';
|
|
545
716
|
const pick = value.pick === 'round-robin' ? 'round-robin' : 'first';
|
|
717
|
+
const autoDelegate = isObject(value.strategy) && DELEGATION_LEVELS.includes(value.strategy.autoDelegate)
|
|
718
|
+
? value.strategy.autoDelegate : 'balanced';
|
|
546
719
|
|
|
547
720
|
const summary = () => {
|
|
548
721
|
const parts = ROLES
|
|
@@ -747,6 +920,46 @@ window.__ModuleLoader__.load({
|
|
|
747
920
|
h('option', { key: 'rr', value: 'round-robin' }, t('pickRoundRobin')))),
|
|
748
921
|
h('span', { style: S.hint }, t('pickHint')));
|
|
749
922
|
|
|
923
|
+
// Auto-delegation level: the system-prompt policy that tells the
|
|
924
|
+
// top-level agent to plan and dispatch subagents. Written the same way
|
|
925
|
+
// as pick/mode, so a save applies live through the volatile namespace.
|
|
926
|
+
const delegationControl = h('div', { style: S.row },
|
|
927
|
+
h('label', { style: S.label }, t('delegation')),
|
|
928
|
+
h('div', { style: S.controls },
|
|
929
|
+
h('select', {
|
|
930
|
+
style: S.select,
|
|
931
|
+
value: DELEGATION_LEVELS.includes(autoDelegate) ? autoDelegate : 'balanced',
|
|
932
|
+
disabled: !ready,
|
|
933
|
+
'aria-label': t('delegation'),
|
|
934
|
+
onChange: (event) => write([{ op: 'set', path: ['strategy', 'autoDelegate'], value: event.target.value }]),
|
|
935
|
+
},
|
|
936
|
+
h('option', { key: 'off', value: 'off' }, t('delegationOff')),
|
|
937
|
+
h('option', { key: 'balanced', value: 'balanced' }, t('delegationBalanced')),
|
|
938
|
+
h('option', { key: 'eager', value: 'eager' }, t('delegationEager')))),
|
|
939
|
+
h('span', { style: S.hint }, t('delegationHint')));
|
|
940
|
+
|
|
941
|
+
// The update banner renders from the client-side update store (one
|
|
942
|
+
// packument fetch per page load), not from the form: the host runs its
|
|
943
|
+
// own check, and the two agree because both compare against the same
|
|
944
|
+
// registry packument.
|
|
945
|
+
let updateBanner = null;
|
|
946
|
+
if (update.status === 'available') {
|
|
947
|
+
updateBanner = h('div', { key: 'update', style: S.updateBanner },
|
|
948
|
+
h('div', { style: S.updateBannerHead }, t('updateTitle')),
|
|
949
|
+
h('div', { style: S.updateBannerText }, t('updateBanner', { latest: update.latest, current: update.current })),
|
|
950
|
+
h('div', { style: S.updateBannerText }, t('updateCommand')),
|
|
951
|
+
h('button', {
|
|
952
|
+
type: 'button',
|
|
953
|
+
style: S.updateRecheck,
|
|
954
|
+
onClick: () => void checkUpdates(),
|
|
955
|
+
}, t('updateRecheck')));
|
|
956
|
+
} else if (update.status === 'checking') {
|
|
957
|
+
updateBanner = h('div', { key: 'update-checking', style: S.notice }, t('updateChecking'));
|
|
958
|
+
} else if (update.status === 'error' && update.reason !== undefined) {
|
|
959
|
+
updateBanner = h('div', { key: 'update-error', style: S.notice },
|
|
960
|
+
t('updateFailed', { reason: update.reason }));
|
|
961
|
+
}
|
|
962
|
+
|
|
750
963
|
const notices = [];
|
|
751
964
|
if (!ready && snapshot.status === 'ready') notices.push(h('div', { key: 'ro', style: S.notice }, t('readOnly')));
|
|
752
965
|
if (state.status === 'loading') notices.push(h('div', { key: 'load', style: S.notice }, t('loading')));
|
|
@@ -783,10 +996,12 @@ window.__ModuleLoader__.load({
|
|
|
783
996
|
h('span', { style: S.hint }, t('enableHint')));
|
|
784
997
|
|
|
785
998
|
return h('div', { style: S.root },
|
|
999
|
+
updateBanner,
|
|
786
1000
|
h('p', { style: S.help }, t('help')),
|
|
787
1001
|
enableToggle,
|
|
788
1002
|
...ROLES.map((role) => row(role)),
|
|
789
1003
|
pickControl,
|
|
1004
|
+
delegationControl,
|
|
790
1005
|
modeControl,
|
|
791
1006
|
...notices);
|
|
792
1007
|
}
|
|
@@ -880,6 +1095,40 @@ window.__ModuleLoader__.load({
|
|
|
880
1095
|
}, UsageView));
|
|
881
1096
|
}));
|
|
882
1097
|
|
|
1098
|
+
// -- update-available chip, rendered in the session header ----------------
|
|
1099
|
+
// A persistent, visible prompt while an update is outstanding: the chip
|
|
1100
|
+
// sits next to the usage button and disappears the moment the banner's
|
|
1101
|
+
// store says "up to date". It reads the same client-side update store as
|
|
1102
|
+
// the settings banner, so the two never disagree.
|
|
1103
|
+
function UpdateChip() {
|
|
1104
|
+
const update = React.useSyncExternalStore(subscribeUpdate, getUpdateSnapshot, getUpdateSnapshot);
|
|
1105
|
+
const [open, setOpen] = React.useState(false);
|
|
1106
|
+
if (update?.status !== 'available') return null;
|
|
1107
|
+
return h('span', { style: S.usage }, [
|
|
1108
|
+
h('button', {
|
|
1109
|
+
type: 'button',
|
|
1110
|
+
style: S.usageButton,
|
|
1111
|
+
'aria-haspopup': 'dialog',
|
|
1112
|
+
'aria-expanded': open,
|
|
1113
|
+
title: t('updateChipHint'),
|
|
1114
|
+
onClick: () => setOpen((current) => !current),
|
|
1115
|
+
}, t('updateChip', { latest: update.latest })),
|
|
1116
|
+
...(open ? [h('div', { style: S.usagePanel, role: 'dialog', 'aria-label': t('updateTitle') }, [
|
|
1117
|
+
h('div', { style: S.usageHead }, [h('span', null, t('updateTitle'))]),
|
|
1118
|
+
h('div', { key: 'line', style: S.usageEmpty },
|
|
1119
|
+
t('updateBanner', { latest: update.latest, current: update.current })),
|
|
1120
|
+
h('div', { key: 'cmd', style: S.usageEmpty }, t('updateCommand')),
|
|
1121
|
+
])] : []),
|
|
1122
|
+
]);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
safely('session update surface', () => ctx.slots.inject('conversation.session.header.utilities', () => ctx.slots.register({
|
|
1126
|
+
name: 'conversation.session.header.utilities',
|
|
1127
|
+
id: 'model-manager-update',
|
|
1128
|
+
order: 70,
|
|
1129
|
+
locale: LOCALE_NS,
|
|
1130
|
+
}, UpdateChip)));
|
|
1131
|
+
|
|
883
1132
|
safely('settings page', () => use(() => ctx.slots.inject('settings.section', () => {
|
|
884
1133
|
const disposer = ctx.slots.register({
|
|
885
1134
|
name: 'settings.section',
|
|
@@ -909,11 +1158,16 @@ window.__ModuleLoader__.load({
|
|
|
909
1158
|
}
|
|
910
1159
|
}));
|
|
911
1160
|
|
|
1161
|
+
// The initial update check runs after the form binds, so a custom
|
|
1162
|
+
// `update.registry` in the row config is honoured on the very first fetch.
|
|
1163
|
+
safely('initial update check', () => void checkUpdates());
|
|
1164
|
+
|
|
912
1165
|
// One success line, so the browser console distinguishes "never applied"
|
|
913
1166
|
// from "applied but a step failed" (each failed step logs its own
|
|
914
1167
|
// `[model-manager] <step>: <error>` warning immediately above this).
|
|
915
1168
|
try {
|
|
916
|
-
console.log('[model-manager] client half applied; locale registered,
|
|
1169
|
+
console.log('[model-manager] client half applied; locale registered, 3 registrations across 2 '
|
|
1170
|
+
+ 'surfaces (settings section; session header utilities: usage + update chip)');
|
|
917
1171
|
} catch {
|
|
918
1172
|
/* logging is best-effort */
|
|
919
1173
|
}
|
package/cordis.patch.yml
CHANGED
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
# `round-robin` rotates across each role's list.
|
|
21
21
|
pick: first
|
|
22
22
|
roles:
|
|
23
|
-
# Main agent outside plan mode
|
|
23
|
+
# Main agent outside plan mode and outside an active planning skill.
|
|
24
|
+
# Empty = leave the composer choice alone.
|
|
24
25
|
main:
|
|
25
26
|
models: []
|
|
26
|
-
# Plan mode
|
|
27
|
+
# Plan mode, a session that invoked a listed planning skill (0.5.0),
|
|
28
|
+
# and delegations labelled as planning/reasoning work.
|
|
27
29
|
planning:
|
|
28
30
|
models:
|
|
29
31
|
- provider: pku-corpus
|
|
@@ -38,3 +40,22 @@
|
|
|
38
40
|
models: []
|
|
39
41
|
strategy:
|
|
40
42
|
mode: hybrid
|
|
43
|
+
# Planning skills (0.5.0): skills that move the TOP-LEVEL session onto
|
|
44
|
+
# the planning role for the rest of the session, the way plan mode does.
|
|
45
|
+
# Omitting the key uses the built-in ['grill-me', 'grilling']; an
|
|
46
|
+
# explicit [] disables the trigger. Names must be lowercase kebab-case;
|
|
47
|
+
# anything else is dropped, so a typo cannot match a session by accident.
|
|
48
|
+
# planningSkills:
|
|
49
|
+
# - grill-me
|
|
50
|
+
# - grilling
|
|
51
|
+
# Auto-delegation policy (0.3.0): off | balanced | eager.
|
|
52
|
+
# Adds a system-prompt section telling the top-level agent to plan
|
|
53
|
+
# and dispatch subagents instead of doing everything itself.
|
|
54
|
+
autoDelegate: balanced
|
|
55
|
+
# Automatic update check (0.3.0): boot + every intervalHours against
|
|
56
|
+
# the registry; a newer release is logged and surfaced by the
|
|
57
|
+
# model_manager tool and the Web card. intervalHours: 0 = boot only.
|
|
58
|
+
update:
|
|
59
|
+
enabled: true
|
|
60
|
+
registry: https://registry.npmjs.org
|
|
61
|
+
intervalHours: 24
|