(value: unknown)
| 13330 | } |
| 13331 | |
| 13332 | function parseAgentCommandSkillResult(value: unknown): AgentCommandSkillResult | null { |
| 13333 | const parsed = parseJsonObject(value); |
| 13334 | if (!parsed) { |
| 13335 | return null; |
| 13336 | } |
| 13337 | const action = normalizeAgentCommandSkillAction(parsed.action); |
| 13338 | if (!action) { |
| 13339 | return null; |
| 13340 | } |
| 13341 | const confidence = clampAssistantConfidence(Number(parsed.confidence ?? 0.8)); |
| 13342 | if (action === 'create_draft' || action === 'update_pending_draft') { |
| 13343 | const candidate = parseAgentDraftCandidate(parsed); |
| 13344 | return candidate |
| 13345 | ? { |
| 13346 | action, |
| 13347 | confidence, |
| 13348 | candidate, |
| 13349 | changes: normalizeStringArray(parsed.changes), |
| 13350 | } |
| 13351 | : null; |
| 13352 | } |
| 13353 | if (action === 'query_jobs') { |
| 13354 | return { |
| 13355 | action, |
| 13356 | confidence, |
| 13357 | filterText: normalizeNullableText(parsed.query?.filterText ?? parsed.filterText), |
| 13358 | }; |
| 13359 | } |
| 13360 | if ( |
| 13361 | action === 'show_job' |
| 13362 | || action === 'show_result' |
| 13363 | || action === 'export_result' |
| 13364 | || action === 'send_attachments' |
| 13365 | ) { |
| 13366 | const target = parseAgentOperationTarget(parsed.target ?? parsed); |
| 13367 | return target |
| 13368 | ? { |
| 13369 | action, |
| 13370 | confidence, |
| 13371 | target, |
| 13372 | } |
| 13373 | : null; |
| 13374 | } |
| 13375 | if ( |
| 13376 | action === 'propose_stop_job' |
| 13377 | || action === 'propose_retry_job' |
| 13378 | || action === 'propose_delete_job' |
| 13379 | ) { |
| 13380 | const target = parseAgentOperationTarget(parsed.target ?? parsed); |
| 13381 | return target |
| 13382 | ? { |
| 13383 | action, |
| 13384 | confidence, |
| 13385 | target, |
| 13386 | reason: normalizeNullableText(parsed.reason ?? parsed.message), |
| 13387 | } |
| 13388 | : null; |
| 13389 | } |
nothing calls this directly
no test coverage detected