fix(mods): type narrowings for plugin validate --strict (BLK-049)
Claude Code 2.1.323 type-checks mods in validate --strict: three TS2339 in the memory kit, the Bash hook return type, thirteen sites in the model-router kit and the agent.spawn deny arm. Type-only or behaviour-equivalent changes; kits 288/640 unchanged; guards stay fail-open (BDR-136).
This commit is contained in:
1 parent
9ee3fdad23
commit
6433e4d32a
4 files changed
+25
-11
No files matched your search
@@ -8,6 +8,12 @@ const SONNET = 'claude-sonnet-5-5'
|
||||
const HAIKU = 'claude-haiku-5-5'
|
||||
|
||||
type Rec = Record<string, unknown>
|
||||
|
||||
// the kit's type lib has neither the timers nor ES2024 strings: types only
|
||||
declare function setTimeout(fn: (...a: never[]) => void, ms: number): unknown
|
||||
declare global {
|
||||
interface String { isWellFormed(): boolean }
|
||||
}
|
||||
type Asked = { text: string; options: string[]; header: string }
|
||||
|
||||
const HOME = '/home/t'
|
||||
@@ -309,7 +315,7 @@ async function boot(
|
||||
// the probe of the model main runs on: every model answers unless a test says not
|
||||
on('model.complete', async (_$, e) => {
|
||||
world.completions.push(e.model)
|
||||
return { value: (await world.complete(e.model)) as string }
|
||||
return { value: (await world.complete(e.model)) as string } as never
|
||||
})
|
||||
installWorld(on, world)
|
||||
if (tokens !== null) usageOf(on, tokens)
|
||||
@@ -1198,6 +1204,7 @@ function recordLogs(on: On): string[] {
|
||||
} catch {
|
||||
// nothing implements ui.log below the recorder in the kit
|
||||
}
|
||||
return undefined as never
|
||||
})
|
||||
return lines
|
||||
}
|
||||
@@ -1380,7 +1387,7 @@ async function effortAfterSkill($: Engine, on: On, skill: string) {
|
||||
await $.agent.spawn(spawnOf('feater'))
|
||||
await loadSkill($, skill, 'a1')
|
||||
await runStep($, { ...highStep('a1'), model: SONNET })
|
||||
return rig.seen[rig.seen.length - 1].effort
|
||||
return rig.seen[rig.seen.length - 1]!.effort
|
||||
}
|
||||
|
||||
test('agent skill: an unrowed one leaves the loop effort', async ($, on) => {
|
||||
@@ -1595,7 +1602,7 @@ const queued = ($: Engine, kind: string, text: string) =>
|
||||
$.prompt.submit({
|
||||
text,
|
||||
wait: true,
|
||||
origin: { kind },
|
||||
origin: { kind } as never,
|
||||
turnId: 'u1',
|
||||
})
|
||||
|
||||
@@ -1614,7 +1621,7 @@ test('idle fallback: a mid-turn composer prompt promotes the allowance', async (
|
||||
await $.prompt.submit({
|
||||
text: 'hello',
|
||||
wait: false,
|
||||
origin: { kind: 'channel' },
|
||||
origin: { kind: 'channel' } as never,
|
||||
})
|
||||
await queued($, 'composer', 'hello')
|
||||
await endTurn($)
|
||||
@@ -1644,6 +1651,7 @@ function recordToasts(on: On): string[] {
|
||||
} catch {
|
||||
// nothing implements ui.toast below the recorder in the kit
|
||||
}
|
||||
return undefined as never
|
||||
})
|
||||
return lines
|
||||
}
|
||||
@@ -4595,7 +4603,7 @@ const skillWorld = (): World => newWorld({ edit: f => {
|
||||
|
||||
/** The name a line shows after `marker`, up to the closing char. */
|
||||
const nameAfter = (line: string, marker: string, end: string): string =>
|
||||
line.slice(line.indexOf(marker) + marker.length).split(end)[0]
|
||||
line.slice(line.indexOf(marker) + marker.length).split(end)[0]!
|
||||
|
||||
test('logs: a hostile skill name is cleaned in the main line', async (
|
||||
$, on) => {
|
||||
@@ -4668,6 +4676,7 @@ function recordStatus(on: On): string[] {
|
||||
} catch {
|
||||
// nothing implements ui.status below the recorder in the kit
|
||||
}
|
||||
return undefined as never
|
||||
})
|
||||
return lines
|
||||
}
|
||||
|
||||
@@ -4656,7 +4656,9 @@ function registerSpawn(on: On, st: State): void {
|
||||
const started = await next(wanted === undefined
|
||||
? e
|
||||
: { ...e, model: wanted })
|
||||
afterSpawn($, st, { e, started, route, wanted })
|
||||
if (started.deny === undefined) {
|
||||
afterSpawn($, st, { e, started, route, wanted })
|
||||
}
|
||||
return started
|
||||
} finally {
|
||||
st.spawning = Math.max(0, st.spawning - 1)
|
||||
|
||||
Reference in new issue
Block a user