@linxin666/dsh-liangshen 0.4.14 → 0.4.16

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.
@@ -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: string, listener: (...args: never[]) => void): unknown
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.
@@ -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 the wire from the catalog row this preset declares', () => {
279
- // Given the 0.2.1 API, where a preset selects its wire through
280
- // agent.ctx.tools.presentAs, When the operator commits a presentation, Then
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
 
@@ -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` writes the `tool-catalog` row alone, because that row's
510
- * declaration IS the wire: the plugin hands the value to
511
- * `agent.ctx.tools.presentAs` and re-assembles, so the catalog text and the
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 target = table.find(([id]) => id === (row as CompositionRow).id)
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