fix(subagent): type the schema-resolved reportDelivery shape
Config() applies the schemastery default at runtime, but its return type keeps the input's optional field, so assert the resolved shape at the seam — keeping the dead fallback branch gone.
This commit is contained in:
@@ -69,7 +69,7 @@ function props(
|
|||||||
// The zh dictionary is the source of truth for this spec's assertions:
|
// The zh dictionary is the source of truth for this spec's assertions:
|
||||||
// the stub interpolates `{name}` params like the locale service does.
|
// the stub interpolates `{name}` params like the locale service does.
|
||||||
const t = ((key: SubagentKey, params?: Record<string, unknown>): string => {
|
const t = ((key: SubagentKey, params?: Record<string, unknown>): string => {
|
||||||
let text = zh[key]
|
let text: string = zh[key]
|
||||||
for (const [name, value] of Object.entries(params ?? {})) {
|
for (const [name, value] of Object.entries(params ?? {})) {
|
||||||
text = text.replaceAll(`{${name}}`, String(value))
|
text = text.replaceAll(`{${name}}`, String(value))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,10 @@ export function installReportTool(
|
|||||||
* @param config - deployment scheduling policy.
|
* @param config - deployment scheduling policy.
|
||||||
*/
|
*/
|
||||||
export function apply(ctx: Context, config: Config = {}): void {
|
export function apply(ctx: Context, config: Config = {}): void {
|
||||||
const { reportDelivery } = Config(config)
|
// Config() applies the schema default ('quiet') at runtime; the schemastery
|
||||||
|
// return type keeps the input's optional shape, so assert the resolved
|
||||||
|
// shape here — no runtime fallback exists or is wanted.
|
||||||
|
const { reportDelivery } = Config(config) as { reportDelivery: SubagentReportDelivery }
|
||||||
ctx.subagents.registerContinuableSetup(childCtx =>
|
ctx.subagents.registerContinuableSetup(childCtx =>
|
||||||
installReportTool(childCtx, ctx, reportDelivery))
|
installReportTool(childCtx, ctx, reportDelivery))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user