@linxin666/dsh-liangshen 0.4.13 → 0.4.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.i18n.yaml +2 -2
- package/README.md +5 -4
- package/README.zh.md +5 -4
- package/lib/client.js +2 -2
- package/lib/client.js.map +1 -1
- package/lib/index.js +9 -6
- package/lib/types/client/plugin-card-seat.d.ts +1 -1
- package/package.json +18 -18
- package/presets/liangshen/agent.cordis.yml +28 -17
- package/presets/liangshen/dispatch-guard.mjs +471 -0
- package/presets/liangshen/dispatcher-rules.mjs +295 -118
- package/src/client/plugin-card-seat.ts +2 -2
- package/src/composition.test.ts +5 -5
- package/src/composition.ts +8 -6
|
@@ -62,7 +62,7 @@ export interface PluginCardContext {
|
|
|
62
62
|
/** Service lookup; absent on a context double that only models the slots. */
|
|
63
63
|
get?(name: string): unknown
|
|
64
64
|
/** Event subscription seat; absent on an event-less test double. */
|
|
65
|
-
on?(event:
|
|
65
|
+
on?(event: never, listener: never): unknown
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/** Owner share of a family list-seat card (that seat supplies nothing). */
|
|
@@ -193,7 +193,7 @@ export function installPluginCard(ctx: PluginCardContext, seat: PluginCardSeat):
|
|
|
193
193
|
|
|
194
194
|
if (typeof ctx.on === 'function') {
|
|
195
195
|
try {
|
|
196
|
-
ctx.on('slots/changed', () => { reconcile() })
|
|
196
|
+
ctx.on('slots/changed' as never, (() => { reconcile() }) as never)
|
|
197
197
|
} catch {
|
|
198
198
|
// An event seat that refuses the subscription leaves the initial
|
|
199
199
|
// decision in place; the card still renders in the seat chosen below.
|
package/src/composition.test.ts
CHANGED
|
@@ -275,15 +275,15 @@ describe('applyPresetOverrides', () => {
|
|
|
275
275
|
expect(configOf(rowOf(applied, 'minimal-prompt'))['dispatcher']).toBe(false)
|
|
276
276
|
})
|
|
277
277
|
|
|
278
|
-
it('operator gets
|
|
279
|
-
// Given the
|
|
280
|
-
//
|
|
281
|
-
// the tool-catalog row carries it and nothing else is written: the
|
|
282
|
-
// declaration and the catalog text read one value.
|
|
278
|
+
it('operator gets matching wire and executor rows from the presentation setting', () => {
|
|
279
|
+
// Given the split presentation/executor contract, When the operator commits
|
|
280
|
+
// a presentation, Then the catalog and the executor select the same mode.
|
|
283
281
|
const ptc = applyPresetOverrides(rows(), { presentation: 'ptc' })
|
|
284
282
|
expect(configOf(rowOf(ptc, 'tool-catalog'))['presentation']).toBe('ptc')
|
|
283
|
+
expect(rowOf(ptc, 'tool-executor-ptc').disabled).toBe(false)
|
|
285
284
|
const native = applyPresetOverrides(rows(), { presentation: 'native' })
|
|
286
285
|
expect(configOf(rowOf(native, 'tool-catalog'))['presentation']).toBe('native')
|
|
286
|
+
expect(rowOf(native, 'tool-executor-ptc').disabled).toBe(true)
|
|
287
287
|
expect(rowOf(native, 'tool-catalog').disabled).toBeUndefined()
|
|
288
288
|
})
|
|
289
289
|
|
package/src/composition.ts
CHANGED
|
@@ -506,11 +506,9 @@ type OverrideTarget = readonly [string, Readonly<Record<string, unknown>>]
|
|
|
506
506
|
/**
|
|
507
507
|
* The overlay table: settings field to composition row and config key.
|
|
508
508
|
*
|
|
509
|
-
* `presentation`
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
* declared presentation always travel together. The composition carries no
|
|
513
|
-
* executor row to mount or unmount.
|
|
509
|
+
* `presentation` also selects the executor: the catalog declares the wire and
|
|
510
|
+
* the official PTC executor row carries it. Native mode disables that row so
|
|
511
|
+
* the assembled native roster remains the only surface.
|
|
514
512
|
*/
|
|
515
513
|
function overrideTargets(overrides: PresetOverrides): OverrideTarget[] {
|
|
516
514
|
return [
|
|
@@ -537,7 +535,11 @@ export function applyPresetOverrides(
|
|
|
537
535
|
): PresetDefinition['plugins'] {
|
|
538
536
|
const table = overrideTargets(overrides)
|
|
539
537
|
return rows.map((row) => {
|
|
540
|
-
const
|
|
538
|
+
const id = (row as CompositionRow).id
|
|
539
|
+
if (id === 'tool-executor-ptc' && overrides.presentation !== undefined) {
|
|
540
|
+
return { ...row, disabled: overrides.presentation !== 'ptc' }
|
|
541
|
+
}
|
|
542
|
+
const target = table.find(([targetId]) => targetId === id)
|
|
541
543
|
if (target === undefined) return row
|
|
542
544
|
const [, patch] = target
|
|
543
545
|
if (Object.keys(patch).length === 0) return row
|