Files
hapi/web/scripts/fixtures/cases/cliOutput.ts
T
weishu c1ecb4798e feat(fixtures): batch 2 — events, permissions, sidechains, flavors, catalogs (K6)
34 new golden chat fixtures generated from the web pipeline, plus a
machine-generated modes catalog:

- Claude output: away_summary/microcompact_boundary/compact_boundary system
  subtypes, <task-notification> summary extraction, multi-block assistant
  message with an array-of-parts (text+image) tool_result
- AgentEvent union completed: switch/message/error/title-changed(+dedupe)/
  limit-warning(pipe text)/api-error folding/turn-duration/compact-summary/
  abort-restore/unknown-type passthrough; thread-goal updated+cleared (silent)
- Permission lifecycle via agentState.completedRequests: approved_for_session
  (mode+allowTools), denied with reason, canceled, AskUserQuestion flat
  answers, request_user_input nested answers (all with explicit createdAt)
- Sidechain: Task tool_use with parentToolUseId-grouped subagent children
- codex family: error, context_compacted, generated-image, review JSON,
  thread-goal messages, CodexBash call/result pair, exploration tool group
- cli-output: cli-origin command block + stdout merge
- agy flavor (output envelope): agy_message, agy_tool_action run_command
  mapping; cursor ACP plan snapshot (copilot skipped: identical codex shapes)
- generator now also emits shared/fixtures/catalogs/modes.json from
  shared/src/modes.ts (per-flavor permission modes with labels/tones);
  self-conformance test covers it; README documents the catalogs contract
2026-08-17 12:04:22 +08:00

65 lines
2.6 KiB
TypeScript

import type { FixtureCase } from '../fixtureTypes'
import { T0, wireMessage } from './support'
/**
* cli-output blocks: local slash-command turns mirrored from the agent
* transcript arrive as plain user text with meta.sentFrom === 'cli' and
* <command-name>/<command-message>/<command-args>/<local-command-stdout> tags
* (web/src/chat/reducerCliOutput.ts). Tag detection requires BOTH the cli
* origin and a tag; the stdout follow-up merges into the preceding
* command-name block of the same source.
*/
export const cliOutputCases: FixtureCase[] = [
{
name: 'cli-output-user-command',
description: 'A user message with meta.sentFrom cli whose text carries command tags becomes a cli-output block with source user (not a user-text block); the tag markup is carried verbatim.',
messages: [
wireMessage({
id: 'msg-cli-701',
seq: 1,
createdAt: T0,
content: {
role: 'user',
content: {
type: 'text',
text: '<command-name>/status</command-name>\n<command-message>status</command-message>\n<command-args></command-args>'
},
meta: { sentFrom: 'cli' }
}
})
]
},
{
name: 'cli-output-command-stdout-merge',
description: 'Two consecutive cli-origin user messages — a command-name block without stdout followed by a <local-command-stdout> block — merge into ONE cli-output block (id/localId of the first, texts joined with a newline).',
messages: [
wireMessage({
id: 'msg-cli-711',
seq: 1,
createdAt: T0,
content: {
role: 'user',
content: {
type: 'text',
text: '<command-name>/context</command-name>\n<command-message>context</command-message>\n<command-args></command-args>'
},
meta: { sentFrom: 'cli' }
}
}),
wireMessage({
id: 'msg-cli-712',
seq: 2,
createdAt: T0 + 700,
content: {
role: 'user',
content: {
type: 'text',
text: '<local-command-stdout>Context usage: 84k/200k tokens (42%)</local-command-stdout>'
},
meta: { sentFrom: 'cli' }
}
})
]
}
]