@bastani/atomic 0.9.11-alpha.6 → 0.9.11-alpha.7

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.
Files changed (140) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/package.json +1 -1
  5. package/dist/builtin/web-access/package.json +1 -1
  6. package/dist/builtin/workflows/package.json +1 -1
  7. package/dist/builtin/workflows/skills/impeccable/SKILL.md +33 -129
  8. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +11 -3
  9. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +26 -0
  10. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +35 -0
  11. package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
  12. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +72 -189
  13. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +10 -9
  14. package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +2 -2
  15. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +19 -108
  16. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +59 -253
  17. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +51 -222
  18. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +45 -0
  19. package/dist/builtin/workflows/skills/impeccable/reference/craft.md +3 -121
  20. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +28 -20
  21. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +97 -0
  22. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +23 -0
  23. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +32 -0
  24. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
  25. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +47 -279
  26. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  27. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +53 -0
  28. package/dist/builtin/workflows/skills/impeccable/reference/document.md +60 -73
  29. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -12
  30. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +17 -4
  31. package/dist/builtin/workflows/skills/impeccable/reference/init.md +64 -163
  32. package/dist/builtin/workflows/skills/impeccable/reference/ios.md +1 -1
  33. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +52 -153
  34. package/dist/builtin/workflows/skills/impeccable/reference/live.md +44 -32
  35. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +105 -0
  36. package/dist/builtin/workflows/skills/impeccable/reference/{product.md → operate.md} +6 -5
  37. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +4 -4
  38. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -4
  39. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +68 -212
  40. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +3 -3
  41. package/dist/builtin/workflows/skills/impeccable/reference/routing.md +18 -0
  42. package/dist/builtin/workflows/skills/impeccable/reference/shape.md +38 -144
  43. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +48 -269
  44. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +38 -0
  45. package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +1 -1
  46. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +584 -0
  47. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +117 -9
  48. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +486 -59
  49. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +16 -45
  50. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +96 -10
  51. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +143 -26
  52. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +181 -12
  53. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +3187 -182
  54. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +102 -7
  55. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +282 -70
  56. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +183 -15
  57. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +22 -7
  58. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +7 -1
  59. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +16 -2
  60. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +155 -42
  61. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2988 -155
  62. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +11 -0
  63. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +336 -0
  64. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +232 -0
  65. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +90 -10
  66. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +410 -78
  67. package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +25 -8
  68. package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +93 -0
  69. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +165 -0
  70. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +329 -0
  71. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +20 -5
  72. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +16 -8
  73. package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +1 -0
  74. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +455 -0
  75. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +169 -0
  76. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +457 -0
  77. package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +151 -0
  78. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +33 -0
  79. package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +146 -0
  80. package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +10 -1
  81. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +15 -0
  82. package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +149 -0
  83. package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +14 -0
  84. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +109 -32
  85. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +105 -0
  86. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +105 -0
  87. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +8 -6
  88. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +280 -0
  89. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +208 -68
  90. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +563 -112
  91. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +3 -0
  92. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +198 -13
  93. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +24 -6
  94. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +6 -1
  95. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +44 -14
  96. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +398 -33
  97. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +9 -5
  98. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +81 -67
  99. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +7 -2
  100. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +76 -81
  101. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +2 -2
  102. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +890 -0
  103. package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +74 -0
  104. package/dist/builtin/workflows/src/extension/index.bundle.mjs +201 -22
  105. package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +23 -9
  106. package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +1 -0
  107. package/dist/builtin/workflows/src/runs/foreground/postmortem-stage-chat.ts +20 -5
  108. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +10 -0
  109. package/dist/builtin/workflows/src/runs/foreground/stage-delivery-activity.ts +86 -0
  110. package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +6 -2
  111. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +19 -13
  112. package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +8 -0
  113. package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +16 -0
  114. package/dist/builtin/workflows/src/tui/stage-chat-view-delivery-activity.ts +121 -0
  115. package/dist/builtin/workflows/src/tui/stage-chat-view-live-events.ts +42 -0
  116. package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +16 -0
  117. package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +4 -0
  118. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  119. package/dist/modes/interactive/components/chat-session-host-actions.js +2 -14
  120. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
  121. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  122. package/dist/modes/interactive/components/chat-session-host-events.js +9 -0
  123. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  124. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +25 -0
  125. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  126. package/dist/modes/interactive/components/chat-session-host-runtime.js +53 -0
  127. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  128. package/dist/modes/interactive/components/chat-session-host.d.ts +13 -0
  129. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  130. package/dist/modes/interactive/components/chat-session-host.js +22 -1
  131. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  132. package/dist/modes/interactive/interactive-agent-events.js +9 -3
  133. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  134. package/docs/tui.md +7 -2
  135. package/docs/workflows.md +1 -1
  136. package/npm-shrinkwrap.json +23 -23
  137. package/package.json +2 -2
  138. package/dist/builtin/workflows/skills/impeccable/reference/brand.md +0 -108
  139. package/dist/builtin/workflows/skills/impeccable/reference/codex.md +0 -105
  140. package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +0 -189
@@ -1 +1 @@
1
- {"version":3,"file":"chat-session-host.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,8BAA8B,EAC9B,kBAAk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F","sourcesContent":["import type { AgentSessionEvent } from \"../../../core/agent-session.ts\";\nimport { type Component, type Focusable } from \"@earendil-works/pi-tui\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.ts\";\nimport {\n abortChatSessionBash,\n abortChatSessionCompaction,\n interruptChatSession,\n restoreQueuedMessagesToEditor,\n submitChatSession,\n} from \"./chat-session-host-actions.ts\";\nimport {\n createChatSessionEditor,\n handleChatSessionInput,\n setChatSessionEditorText,\n} from \"./chat-session-host-editor.ts\";\nimport { applyChatSessionAgentEvent } from \"./chat-session-host-events.ts\";\nimport {\n renderChatSessionBody,\n renderChatSessionEditor,\n renderChatSessionEntry,\n renderChatSessionFooter,\n renderChatSessionPendingMessages,\n renderChatSessionUsage,\n renderChatSessionWorkingStatus,\n transcriptCacheKey,\n} from \"./chat-session-host-rendering.ts\";\nimport {\n clearChatSessionBusyForTerminalWorkflowStage,\n disposeChatSession,\n isChatSessionBashRunning,\n isChatSessionStreaming,\n syncChatSessionAnimationTick,\n} from \"./chat-session-host-runtime.ts\";\nimport { ChatSessionHostState } from \"./chat-session-host-state.ts\";\nimport type {\n AgentSnapshotMessage,\n ChatSessionHostEntry,\n ChatSessionHostOpts,\n} from \"./chat-session-host-types.ts\";\n\nexport type {\n ChatSessionHostBashRequest,\n ChatSessionHostCommands,\n ChatSessionHostEntry,\n ChatSessionHostOpts,\n ChatSessionHostStyle,\n} from \"./chat-session-host-types.ts\";\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never>\n implements Component, Focusable\n{\n focused = true;\n\n private readonly state: ChatSessionHostState<TExtraEntry>;\n\n constructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n this.state = new ChatSessionHostState(opts, {\n renderEntry: (state, entry) => renderChatSessionEntry(state, entry),\n transcriptCacheKey: (state, entry, index) => transcriptCacheKey(state, entry, index),\n });\n this.state.editor = createChatSessionEditor(\n this.state,\n opts.tui,\n opts.keybindings,\n opts.editorTheme,\n opts.editorFactory,\n this.editorCallbacks(),\n );\n this.syncAnimationTick();\n }\n\n appendMessages(messages: readonly AgentSnapshotMessage[]): void {\n this.state.liveChat.appendMessages(messages);\n }\n\n loadSessionFile(sessionFile: string | undefined): void {\n if (this.state.transcript.length > 0 || sessionFile === undefined) return;\n let messages: readonly AgentSnapshotMessage[];\n try {\n messages = SessionManager.open(sessionFile).buildSessionContext()\n .messages as readonly AgentSnapshotMessage[];\n } catch {\n return;\n }\n this.state.liveChat.appendMessages(messages);\n }\n\n appendExtraEntry(entry: TExtraEntry): void {\n this.state.extraEntries.push(entry);\n this.state.transcript.push(entry);\n }\n\n entries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n return this.state.transcript;\n }\n\n applyAgentEvent(event: AgentSessionEvent): boolean {\n return applyChatSessionAgentEvent(this.state, event);\n }\n\n render(width: number): string[] {\n return this.renderBody(width, 1);\n }\n\n invalidate(): void {\n this.state.transcriptComponent.invalidate();\n this.state.bodyViewport.invalidate();\n this.state.editor?.invalidate();\n }\n\n renderBody(width: number, budget: number): string[] {\n return renderChatSessionBody(this.state, width, budget);\n }\n\n renderPendingMessages(width: number): string[] {\n return renderChatSessionPendingMessages(this.state, width);\n }\n\n renderWorkingStatus(width: number): string[] {\n return renderChatSessionWorkingStatus(this.state, width);\n }\n\n renderUsage(width: number): string[] {\n return renderChatSessionUsage(this.state, width);\n }\n\n renderEditor(width: number): string[] {\n return renderChatSessionEditor(this.state, width, this.focused);\n }\n\n renderFooter(width: number): string[] {\n return renderChatSessionFooter(this.state, width);\n }\n\n handleScrollInput(data: string): boolean {\n return this.state.bodyViewport.handleInput(data);\n }\n\n handleInput(data: string): boolean {\n return handleChatSessionInput(this.state, data, this.editorCallbacks());\n }\n\n async interrupt(): Promise<void> {\n await interruptChatSession(this.state);\n }\n\n async submit(mode: \"auto\" | \"followUp\" = \"auto\", submittedText?: string): Promise<void> {\n await submitChatSession(this.state, mode, submittedText);\n }\n\n isStreaming(): boolean {\n return isChatSessionStreaming(this.state);\n }\n\n isBashRunning(): boolean {\n return isChatSessionBashRunning(this.state);\n }\n\n isEditingBashCommand(): boolean {\n return this.state.isBashMode;\n }\n\n isCompacting(): boolean {\n return this.state.compacting;\n }\n\n hasInputText(): boolean {\n return this.state.inputBuffer.length > 0;\n }\n\n hasAnimationTick(): boolean {\n return this.state.animationTimer !== undefined;\n }\n\n bodyScrollFromBottom(): number {\n return this.state.bodyViewport.getScrollFromBottom();\n }\n\n bodyMaxScroll(): number {\n return this.state.bodyViewport.getMaxScroll();\n }\n\n inputText(): string {\n return this.state.inputBuffer;\n }\n setInputText(text: string): void {\n setChatSessionEditorText(this.state, text);\n }\n\n statusText(): string {\n return this.state.statusMessage;\n }\n\n scrollToBottom(): void {\n this.state.bodyViewport.scrollToBottom();\n }\n\n syncAnimationTick(): void {\n syncChatSessionAnimationTick(this.state);\n }\n\n clearBusyForTerminalWorkflowStage(): void {\n clearChatSessionBusyForTerminalWorkflowStage(this.state);\n }\n\n dispose(): void {\n disposeChatSession(this.state);\n }\n\n restoreQueuedMessagesToEditor(): boolean {\n return restoreQueuedMessagesToEditor(this.state);\n }\n\n private editorCallbacks(): {\n submit: (mode: \"auto\" | \"followUp\", submittedText?: string) => void | Promise<void>;\n restoreQueuedMessagesToEditor: () => boolean;\n abortCompaction: () => void | Promise<void>;\n interrupt: () => void | Promise<void>;\n abortBash: () => void | Promise<void>;\n } {\n return {\n submit: (mode, submittedText) => this.submit(mode, submittedText),\n restoreQueuedMessagesToEditor: () => this.restoreQueuedMessagesToEditor(),\n abortCompaction: () => abortChatSessionCompaction(this.state),\n interrupt: () => this.interrupt(),\n abortBash: () => abortChatSessionBash(this.state),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"chat-session-host.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EACL,oBAAoB,EAC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FAAkF;IAClF,6BAA6B,CAAC,UAA8B;QAC1D,gCAAgC,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACzD,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO;QACL,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,6BAA6B;QAC3B,OAAO,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAEO,eAAe;QAOrB,OAAO;YACL,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;YACjE,6BAA6B,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE;YACzE,eAAe,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;YAC7D,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE;YACjC,SAAS,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { AgentSessionEvent } from \"../../../core/agent-session.ts\";\nimport { type Component, type Focusable } from \"@earendil-works/pi-tui\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.ts\";\nimport {\n abortChatSessionBash,\n abortChatSessionCompaction,\n interruptChatSession,\n restoreQueuedMessagesToEditor,\n submitChatSession,\n} from \"./chat-session-host-actions.ts\";\nimport {\n createChatSessionEditor,\n handleChatSessionInput,\n setChatSessionEditorText,\n} from \"./chat-session-host-editor.ts\";\nimport { applyChatSessionAgentEvent } from \"./chat-session-host-events.ts\";\nimport {\n renderChatSessionBody,\n renderChatSessionEditor,\n renderChatSessionEntry,\n renderChatSessionFooter,\n renderChatSessionPendingMessages,\n renderChatSessionUsage,\n renderChatSessionWorkingStatus,\n transcriptCacheKey,\n} from \"./chat-session-host-rendering.ts\";\nimport {\n clearChatSessionBusyForTerminalWorkflowStage,\n disposeChatSession,\n isChatSessionBashRunning,\n isChatSessionStreaming,\n reassertChatSessionExternalPromptLifecycle,\n settleChatSessionPromptLifecycle,\n startChatSessionExternalPromptLifecycle,\n syncChatSessionAnimationTick,\n} from \"./chat-session-host-runtime.ts\";\nimport { ChatSessionHostState } from \"./chat-session-host-state.ts\";\nimport type {\n AgentSnapshotMessage,\n ChatSessionHostEntry,\n ChatSessionHostOpts,\n} from \"./chat-session-host-types.ts\";\n\nexport type {\n ChatSessionHostBashRequest,\n ChatSessionHostCommands,\n ChatSessionHostEntry,\n ChatSessionHostOpts,\n ChatSessionHostStyle,\n} from \"./chat-session-host-types.ts\";\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never>\n implements Component, Focusable\n{\n focused = true;\n\n private readonly state: ChatSessionHostState<TExtraEntry>;\n\n constructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n this.state = new ChatSessionHostState(opts, {\n renderEntry: (state, entry) => renderChatSessionEntry(state, entry),\n transcriptCacheKey: (state, entry, index) => transcriptCacheKey(state, entry, index),\n });\n this.state.editor = createChatSessionEditor(\n this.state,\n opts.tui,\n opts.keybindings,\n opts.editorTheme,\n opts.editorFactory,\n this.editorCallbacks(),\n );\n this.syncAnimationTick();\n }\n\n appendMessages(messages: readonly AgentSnapshotMessage[]): void {\n this.state.liveChat.appendMessages(messages);\n }\n\n loadSessionFile(sessionFile: string | undefined): void {\n if (this.state.transcript.length > 0 || sessionFile === undefined) return;\n let messages: readonly AgentSnapshotMessage[];\n try {\n messages = SessionManager.open(sessionFile).buildSessionContext()\n .messages as readonly AgentSnapshotMessage[];\n } catch {\n return;\n }\n this.state.liveChat.appendMessages(messages);\n }\n\n appendExtraEntry(entry: TExtraEntry): void {\n this.state.extraEntries.push(entry);\n this.state.transcript.push(entry);\n }\n\n entries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n return this.state.transcript;\n }\n\n applyAgentEvent(event: AgentSessionEvent): boolean {\n return applyChatSessionAgentEvent(this.state, event);\n }\n\n render(width: number): string[] {\n return this.renderBody(width, 1);\n }\n\n invalidate(): void {\n this.state.transcriptComponent.invalidate();\n this.state.bodyViewport.invalidate();\n this.state.editor?.invalidate();\n }\n\n renderBody(width: number, budget: number): string[] {\n return renderChatSessionBody(this.state, width, budget);\n }\n\n renderPendingMessages(width: number): string[] {\n return renderChatSessionPendingMessages(this.state, width);\n }\n\n renderWorkingStatus(width: number): string[] {\n return renderChatSessionWorkingStatus(this.state, width);\n }\n\n renderUsage(width: number): string[] {\n return renderChatSessionUsage(this.state, width);\n }\n\n renderEditor(width: number): string[] {\n return renderChatSessionEditor(this.state, width, this.focused);\n }\n\n renderFooter(width: number): string[] {\n return renderChatSessionFooter(this.state, width);\n }\n\n handleScrollInput(data: string): boolean {\n return this.state.bodyViewport.handleInput(data);\n }\n\n handleInput(data: string): boolean {\n return handleChatSessionInput(this.state, data, this.editorCallbacks());\n }\n\n async interrupt(): Promise<void> {\n await interruptChatSession(this.state);\n }\n\n async submit(mode: \"auto\" | \"followUp\" = \"auto\", submittedText?: string): Promise<void> {\n await submitChatSession(this.state, mode, submittedText);\n }\n\n isStreaming(): boolean {\n return isChatSessionStreaming(this.state);\n }\n\n isBashRunning(): boolean {\n return isChatSessionBashRunning(this.state);\n }\n\n isEditingBashCommand(): boolean {\n return this.state.isBashMode;\n }\n\n isCompacting(): boolean {\n return this.state.compacting;\n }\n\n hasInputText(): boolean {\n return this.state.inputBuffer.length > 0;\n }\n\n hasAnimationTick(): boolean {\n return this.state.animationTimer !== undefined;\n }\n\n bodyScrollFromBottom(): number {\n return this.state.bodyViewport.getScrollFromBottom();\n }\n\n bodyMaxScroll(): number {\n return this.state.bodyViewport.getMaxScroll();\n }\n\n inputText(): string {\n return this.state.inputBuffer;\n }\n setInputText(text: string): void {\n setChatSessionEditorText(this.state, text);\n }\n\n statusText(): string {\n return this.state.statusMessage;\n }\n\n scrollToBottom(): void {\n this.state.bodyViewport.scrollToBottom();\n }\n\n syncAnimationTick(): void {\n syncChatSessionAnimationTick(this.state);\n }\n\n clearBusyForTerminalWorkflowStage(): void {\n clearChatSessionBusyForTerminalWorkflowStage(this.state);\n }\n\n /**\n * Start Working for an accepted prompt delivered outside this host — a\n * workflow definition auto-sending to its own retained stage. Returns the\n * lifecycle token to hand back to `settleExternalPromptLifecycle`.\n */\n beginExternalPromptLifecycle(): number | undefined {\n return startChatSessionExternalPromptLifecycle(this.state);\n }\n\n /**\n * Reopen Working for a delivery still active after a temporary overlay — a\n * pre-turn compaction — cleared it. Preserves factual status text.\n */\n reassertExternalPromptLifecycle(): number | undefined {\n return reassertChatSessionExternalPromptLifecycle(this.state);\n }\n\n /** Settle a lifecycle from `beginExternalPromptLifecycle`. Stale tokens no-op. */\n settleExternalPromptLifecycle(generation: number | undefined): void {\n settleChatSessionPromptLifecycle(this.state, generation);\n syncChatSessionAnimationTick(this.state);\n this.state.requestRender?.();\n }\n\n dispose(): void {\n disposeChatSession(this.state);\n }\n\n restoreQueuedMessagesToEditor(): boolean {\n return restoreQueuedMessagesToEditor(this.state);\n }\n\n private editorCallbacks(): {\n submit: (mode: \"auto\" | \"followUp\", submittedText?: string) => void | Promise<void>;\n restoreQueuedMessagesToEditor: () => boolean;\n abortCompaction: () => void | Promise<void>;\n interrupt: () => void | Promise<void>;\n abortBash: () => void | Promise<void>;\n } {\n return {\n submit: (mode, submittedText) => this.submit(mode, submittedText),\n restoreQueuedMessagesToEditor: () => this.restoreQueuedMessagesToEditor(),\n abortCompaction: () => abortChatSessionCompaction(this.state),\n interrupt: () => this.interrupt(),\n abortBash: () => abortChatSessionBash(this.state),\n };\n }\n}\n"]}
@@ -65,7 +65,12 @@ InteractiveModeBase.prototype.handleEvent = async function (event) {
65
65
  else
66
66
  this.loadingAnimation.setMessage(this.workingMessage);
67
67
  }
68
- else {
68
+ else if (!this.autoCompactionLoader) {
69
+ // Post-tool compaction interposes this turn_start between
70
+ // compaction_start and compaction_end. Mounting generic Working here
71
+ // would evict the factual compaction status from the shared status
72
+ // container and leave a stale `loadingAnimation` that then blocks the
73
+ // restore at compaction_end, hiding all activity until the next run.
69
74
  this.showWorkingLoaderNow();
70
75
  }
71
76
  break;
@@ -314,8 +319,9 @@ InteractiveModeBase.prototype.handleEvent = async function (event) {
314
319
  }
315
320
  }
316
321
  // Post-tool compaction resumes the same active run, so no new
317
- // agent_start event will recreate the working loader.
318
- if (event.midTurn && event.result && !event.aborted && !event.errorMessage) {
322
+ // agent_start event will recreate the working loader. A successful
323
+ // no-op carries no `result` and still continues that stream.
324
+ if (event.midTurn && !event.aborted && !event.errorMessage) {
319
325
  this.showWorkingLoaderNow();
320
326
  }
321
327
  if (!event.midTurn)
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-agent-events.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-agent-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAwC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,cAAc,EAAE,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxN,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,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BAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACnC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAoC,OAAgB;IACnG,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IACvC,MAAM,UAAU,GACd,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;QACjC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAAsB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtE,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Message, type AgentSessionEvent, Loader, Spacer, Text, pickWhimsicalWorkingMessage, AssistantMessageComponent, CountdownTimer, keyText, ToolExecutionComponent, theme } from \"./interactive-mode-deps.ts\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.ts\";\nimport { RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { handleSummarizationRetryEvent } from \"./interactive-summarization-retry-events.ts\";\nimport { CACHE_TTL_MS, detectCacheMiss } from \"../../core/cache-stats.ts\";\nimport { mountIdleStatus } from \"./components/idle-status.ts\";\nimport { AtomicWorkingLoader } from \"./components/atomic-working-status.ts\";\n\nfunction createToolComponent(\n mode: InteractiveModeBase,\n toolName: string,\n toolCallId: string,\n args: unknown,\n): ToolExecutionComponent | RemoteToolExecutionComponent {\n const options = {\n showImages: mode.settingsManager.getShowImages(),\n imageWidthCells: mode.settingsManager.getImageWidthCells(),\n };\n return mode.runtimeHost instanceof IsolatedInteractiveRuntime\n ? new RemoteToolExecutionComponent(toolName, toolCallId, args, options, mode.runtimeHost, () => mode.ui.requestRender())\n : new ToolExecutionComponent(\n toolName, toolCallId, args, options, mode.getRegisteredToolDefinition(toolName), mode.ui, mode.sessionManager.getCwd(),\n );\n}\n\nInteractiveModeBase.prototype.subscribeToAgent = function(this: InteractiveModeBase): void {\n this.unsubscribe = this.session.subscribe(async (event) => {\n await this.handleEvent(event);\n });\n };\n\nInteractiveModeBase.prototype.handleEvent = async function(this: InteractiveModeBase, event: AgentSessionEvent): Promise<void> {\n if (!this.isInitialized) {\n await this.init();\n }\n\n this.footer.invalidate();\n\n switch (event.type) {\n case \"agent_start\":\n this.pendingTools.clear();\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(true);\n }\n // Restore main escape handler if retry handler is still active\n // (retry success event fires later, but we need main handler now)\n if (this.retryEscapeHandler) {\n this.defaultEditor.onEscape = this.retryEscapeHandler;\n this.retryEscapeHandler = undefined;\n }\n if (this.retryCountdown) {\n this.retryCountdown.dispose();\n this.retryCountdown = undefined;\n }\n if (this.retryLoader) {\n this.retryLoader.stop();\n this.retryLoader = undefined;\n }\n if (this.fallbackLoader) {\n this.fallbackLoader.stop();\n this.fallbackLoader = undefined;\n }\n this.stopWorkingLoader();\n if (this.workingVisible) {\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n }\n this.ui.requestRender();\n break;\n\n case \"turn_start\": {\n this.workingMessage = pickWhimsicalWorkingMessage();\n if (this.loadingAnimation) {\n if (\"resetForTurn\" in this.loadingAnimation) this.loadingAnimation.resetForTurn(this.workingMessage);\n else this.loadingAnimation.setMessage(this.workingMessage);\n } else {\n this.showWorkingLoaderNow();\n }\n break;\n }\n\n case \"turn_end\": {\n this.workingMessage = undefined;\n this.stopWorkingLoader();\n this.ui.requestRender();\n break;\n }\n\n case \"queue_update\":\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n break;\n\n case \"session_info_changed\":\n this.updateTerminalTitle();\n this.footer.invalidate();\n this.ui.requestRender();\n break;\n\n case \"model_changed\":\n this.refreshBuiltInHeader();\n this.updateEditorBorderColor();\n break;\n\n case \"thinking_level_changed\":\n this.footer.invalidate();\n this.refreshBuiltInHeader();\n this.updateEditorBorderColor();\n break;\n\n case \"entry_appended\":\n if (event.entry.type === \"custom\") this.addCustomEntryToChat(event.entry);\n this.ui.requestRender();\n break;\n\n case \"agent_settled\":\n await this.checkShutdownRequested();\n break;\n\n case \"message_start\":\n if (event.message.role === \"custom\") {\n appendNewChildrenBeforeAttachedChild(\n this.chatContainer,\n this.streamingComponent,\n () => this.addMessageToChat(event.message),\n );\n this.ui.requestRender();\n } else if (event.message.role === \"user\") {\n if (!this.consumeDeferredRenderedUserInput(this.getUserMessageText(event.message))) {\n this.addMessageToChat(event.message);\n }\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n } else if (event.message.role === \"assistant\") {\n this.streamingComponent = new AssistantMessageComponent(\n undefined,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n this.outputPad,\n );\n this.streamingMessage = event.message;\n this.chatContainer.addChild(this.streamingComponent);\n this.streamingComponent.updateContent(this.streamingMessage);\n this.ui.requestRender();\n }\n break;\n\n case \"message_update\":\n if (this.streamingComponent && event.message.role === \"assistant\") {\n this.streamingMessage = event.message;\n this.streamingComponent.updateContent(this.streamingMessage);\n\n for (const content of this.streamingMessage.content) {\n if (content.type === \"toolCall\") {\n if (!this.pendingTools.has(content.id)) {\n const component = createToolComponent(this, content.name, content.id, content.arguments);\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n this.pendingTools.set(content.id, component);\n } else {\n const component = this.pendingTools.get(content.id);\n if (component) {\n component.updateArgs(content.arguments);\n }\n }\n }\n }\n this.ui.requestRender();\n }\n break;\n\n case \"message_end\":\n if (event.message.role === \"user\") break;\n if (this.streamingComponent && event.message.role === \"assistant\") {\n this.streamingMessage = event.message;\n let errorMessage: string | undefined;\n if (this.streamingMessage.stopReason === \"aborted\") {\n const existingAbortMessage =\n this.streamingMessage.errorMessage && this.streamingMessage.errorMessage !== \"Request was aborted\"\n ? this.streamingMessage.errorMessage\n : undefined;\n const retryAttempt = this.session.retryAttempt;\n errorMessage = existingAbortMessage ?? (\n retryAttempt > 0\n ? `Aborted after ${retryAttempt} retry attempt${retryAttempt > 1 ? \"s\" : \"\"}`\n : \"Operation aborted\"\n );\n this.streamingMessage.errorMessage = errorMessage;\n }\n this.streamingComponent.updateContent(this.streamingMessage);\n\n if (\n this.streamingMessage.stopReason === \"aborted\" ||\n this.streamingMessage.stopReason === \"error\"\n ) {\n if (!errorMessage) {\n errorMessage = this.streamingMessage.errorMessage || \"Error\";\n }\n for (const [, component] of this.pendingTools.entries()) {\n component.updateResult({\n content: [{ type: \"text\", text: errorMessage }],\n isError: true,\n });\n }\n this.pendingTools.clear();\n } else {\n // Args are now complete - trigger diff computation for edit tools\n for (const [, component] of this.pendingTools.entries()) {\n component.setArgsComplete();\n }\n }\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.footer.invalidate();\n }\n if (event.message.role === \"assistant\" && this.settingsManager.getShowCacheMissNotices()) {\n const miss = detectCacheMiss(this.sessionManager.getEntries(), event.message, { getModel: (provider, model) => this.session.modelRegistry.find(provider, model) });\n if (miss) {\n const cause = miss.modelChanged ? \" after model switch\" : miss.idleMs >= CACHE_TTL_MS ? \" after cache TTL expiry\" : \"\";\n this.chatContainer.addChild(new Text(theme.fg(\"warning\", `Prompt cache miss${cause}: ${miss.missedTokens.toLocaleString()} tokens re-billed ($${miss.missedCost.toFixed(3)})`), 1, 0));\n }\n }\n this.ui.requestRender();\n break;\n\n case \"tool_execution_start\": {\n let component = this.pendingTools.get(event.toolCallId);\n if (!component) {\n component = createToolComponent(this, event.toolName, event.toolCallId, event.args);\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n this.pendingTools.set(event.toolCallId, component);\n }\n component.markExecutionStarted();\n this.ui.requestRender();\n break;\n }\n\n case \"tool_execution_update\": {\n const component = this.pendingTools.get(event.toolCallId);\n if (component) {\n component.updateResult(\n { ...event.partialResult, isError: false },\n true,\n );\n this.ui.requestRender();\n }\n break;\n }\n\n case \"tool_execution_end\": {\n const component = this.pendingTools.get(event.toolCallId);\n if (component) {\n component.updateResult({ ...event.result, isError: event.isError });\n this.pendingTools.delete(event.toolCallId);\n this.ui.requestRender();\n }\n break;\n }\n\n case \"agent_end\":\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(false);\n }\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n }\n if (this.streamingComponent) {\n this.chatContainer.removeChild(this.streamingComponent);\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n }\n this.pendingTools.clear();\n if (this.compactionQueuedMessages.length > 0) {\n void this.session.agent.waitForIdle().then(() => this.flushCompactionQueue({ willRetry: false }));\n }\n\n await this.checkShutdownRequested();\n\n this.ui.requestRender();\n break;\n\n case \"compaction_start\": {\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(true);\n }\n // Release any loader left behind by an earlier start before mounting a\n // new one; dropping the reference alone leaks its animation timer.\n if (this.autoCompactionLoader) {\n this.autoCompactionLoader.stop();\n this.autoCompactionLoader = undefined;\n }\n // Keep editor active; submissions are queued during compaction.\n // Never clobber an already-saved handler with our own abort closure.\n if (!this.autoCompactionEscapeHandlerSaved) {\n this.autoCompactionEscapeHandler = this.defaultEditor.onEscape;\n this.autoCompactionEscapeHandlerSaved = true;\n }\n this.defaultEditor.onEscape = () => {\n this.session.abortCompaction();\n };\n this.stopWorkingLoader();\n const cancelHint = `(${keyText(\"app.interrupt\")} Cancel)`;\n const isOverflowAutoCompaction = event.reason === \"overflow\";\n const label =\n event.reason === \"manual\"\n ? `Compacting context... ${cancelHint}`\n : `${isOverflowAutoCompaction ? \"Context overflow detected. \" : \"\"}Auto-compacting... ${cancelHint}`;\n this.autoCompactionLoader = new AtomicWorkingLoader(\n this.ui,\n undefined,\n (text) => theme.fg(isOverflowAutoCompaction ? \"warning\" : \"muted\", text),\n label,\n );\n this.statusContainer.addChild(this.autoCompactionLoader);\n this.ui.requestRender();\n break;\n }\n\n case \"compaction_end\": {\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(false);\n }\n if (this.autoCompactionEscapeHandlerSaved) {\n this.defaultEditor.onEscape = this.autoCompactionEscapeHandler;\n this.autoCompactionEscapeHandler = undefined;\n this.autoCompactionEscapeHandlerSaved = false;\n }\n if (this.autoCompactionLoader) {\n this.autoCompactionLoader.stop();\n this.autoCompactionLoader = undefined;\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n }\n if (event.aborted) {\n if (event.reason === \"manual\") {\n this.showError(\"Compaction cancelled\");\n } else {\n this.showStatus(\"Auto-compaction cancelled\");\n }\n } else if (event.result && !event.errorMessage) {\n this.chatContainer.clear();\n this.rebuildChatFromMessages({ suppressCompactionBoundary: event.result });\n this.addCompactionBoundaryToChat(event.result);\n this.footer.invalidate();\n } else if (event.errorMessage) {\n if (event.reason === \"manual\") {\n this.showError(event.errorMessage);\n } else {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(theme.fg(\"error\", event.errorMessage), 1, 0),\n );\n }\n }\n // Post-tool compaction resumes the same active run, so no new\n // agent_start event will recreate the working loader.\n if (event.midTurn && event.result && !event.aborted && !event.errorMessage) {\n this.showWorkingLoaderNow();\n }\n if (!event.midTurn) void this.flushCompactionQueue({ willRetry: event.willRetry });\n this.ui.requestRender();\n break;\n }\n\n\n\t\tcase \"summarization_retry_scheduled\":\n\t\tcase \"summarization_retry_attempt_start\":\n\t\tcase \"summarization_retry_finished\":\n\t\t\thandleSummarizationRetryEvent(this, event);\n\t\t\tbreak;\n\n case \"auto_retry_start\": {\n // Set up escape to abort retry\n this.retryEscapeHandler = this.defaultEditor.onEscape;\n this.defaultEditor.onEscape = () => {\n this.session.abortRetry();\n };\n // Show retry indicator\n this.statusContainer.clear();\n this.retryCountdown?.dispose();\n const retryMessage = (seconds: number) =>\n `Retrying (${event.attempt}/${event.maxAttempts}) in ${seconds}s... (${keyText(\"app.interrupt\")} Cancel)`;\n this.retryLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"warning\", spinner),\n (text) => theme.fg(\"muted\", text),\n retryMessage(Math.ceil(event.delayMs / 1000)),\n );\n this.retryCountdown = new CountdownTimer(\n event.delayMs,\n this.ui,\n (seconds) => {\n this.retryLoader?.setMessage(retryMessage(seconds));\n },\n () => {\n this.retryCountdown = undefined;\n },\n );\n this.statusContainer.addChild(this.retryLoader);\n this.ui.requestRender();\n break;\n }\n\n\n case \"model_fallback_start\": {\n this.statusContainer.clear();\n if (this.fallbackLoader) {\n this.fallbackLoader.stop();\n this.fallbackLoader = undefined;\n }\n this.fallbackLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"warning\", spinner),\n (text) => theme.fg(\"muted\", text),\n `Falling back from ${event.from} to ${event.to}...`,\n );\n this.statusContainer.addChild(this.fallbackLoader);\n this.ui.requestRender();\n break;\n }\n\n case \"model_fallback_end\": {\n if (this.fallbackLoader) {\n this.fallbackLoader.stop();\n this.fallbackLoader = undefined;\n }\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n this.ui.requestRender();\n break;\n }\n case \"auto_retry_end\": {\n // Restore escape handler\n if (this.retryEscapeHandler) {\n this.defaultEditor.onEscape = this.retryEscapeHandler;\n this.retryEscapeHandler = undefined;\n }\n if (this.retryCountdown) {\n this.retryCountdown.dispose();\n this.retryCountdown = undefined;\n }\n // Stop loader\n if (this.retryLoader) {\n this.retryLoader.stop();\n this.retryLoader = undefined;\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n }\n // Show error only on final failure (success shows normal response)\n if (!event.success) {\n this.showError(\n `Retry failed after ${event.attempt} attempts: ${event.finalError || \"Unknown error\"}`,\n );\n }\n this.ui.requestRender();\n break;\n }\n\n case \"agent_continue_error\": {\n this.stopWorkingLoader();\n this.showError(event.errorMessage);\n this.ui.requestRender();\n break;\n }\n }\n };\n\nInteractiveModeBase.prototype.getUserMessageText = function(this: InteractiveModeBase, message: Message): string {\n if (message.role !== \"user\") return \"\";\n const textBlocks =\n typeof message.content === \"string\"\n ? [{ type: \"text\", text: message.content }]\n : message.content.filter((c: { type: string }) => c.type === \"text\");\n return textBlocks.map((c) => (c as { text: string }).text).join(\"\");\n };\n"]}
1
+ {"version":3,"file":"interactive-agent-events.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-agent-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAwC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,cAAc,EAAE,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxN,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1E,O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AU,IAAI,eAAe,EAAE,CACvF,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM;QACR,CAAC;QAED,KAAK,sBAAsB,EAAE,CAAC;YAC5B,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACnC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAoC,OAAgB;IACnG,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IACvC,MAAM,UAAU,GACd,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;QACjC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAAsB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtE,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Message, type AgentSessionEvent, Loader, Spacer, Text, pickWhimsicalWorkingMessage, AssistantMessageComponent, CountdownTimer, keyText, ToolExecutionComponent, theme } from \"./interactive-mode-deps.ts\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.ts\";\nimport { RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { handleSummarizationRetryEvent } from \"./interactive-summarization-retry-events.ts\";\nimport { CACHE_TTL_MS, detectCacheMiss } from \"../../core/cache-stats.ts\";\nimport { mountIdleStatus } from \"./components/idle-status.ts\";\nimport { AtomicWorkingLoader } from \"./components/atomic-working-status.ts\";\n\nfunction createToolComponent(\n mode: InteractiveModeBase,\n toolName: string,\n toolCallId: string,\n args: unknown,\n): ToolExecutionComponent | RemoteToolExecutionComponent {\n const options = {\n showImages: mode.settingsManager.getShowImages(),\n imageWidthCells: mode.settingsManager.getImageWidthCells(),\n };\n return mode.runtimeHost instanceof IsolatedInteractiveRuntime\n ? new RemoteToolExecutionComponent(toolName, toolCallId, args, options, mode.runtimeHost, () => mode.ui.requestRender())\n : new ToolExecutionComponent(\n toolName, toolCallId, args, options, mode.getRegisteredToolDefinition(toolName), mode.ui, mode.sessionManager.getCwd(),\n );\n}\n\nInteractiveModeBase.prototype.subscribeToAgent = function(this: InteractiveModeBase): void {\n this.unsubscribe = this.session.subscribe(async (event) => {\n await this.handleEvent(event);\n });\n };\n\nInteractiveModeBase.prototype.handleEvent = async function(this: InteractiveModeBase, event: AgentSessionEvent): Promise<void> {\n if (!this.isInitialized) {\n await this.init();\n }\n\n this.footer.invalidate();\n\n switch (event.type) {\n case \"agent_start\":\n this.pendingTools.clear();\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(true);\n }\n // Restore main escape handler if retry handler is still active\n // (retry success event fires later, but we need main handler now)\n if (this.retryEscapeHandler) {\n this.defaultEditor.onEscape = this.retryEscapeHandler;\n this.retryEscapeHandler = undefined;\n }\n if (this.retryCountdown) {\n this.retryCountdown.dispose();\n this.retryCountdown = undefined;\n }\n if (this.retryLoader) {\n this.retryLoader.stop();\n this.retryLoader = undefined;\n }\n if (this.fallbackLoader) {\n this.fallbackLoader.stop();\n this.fallbackLoader = undefined;\n }\n this.stopWorkingLoader();\n if (this.workingVisible) {\n this.loadingAnimation = this.createWorkingLoader();\n this.statusContainer.addChild(this.loadingAnimation);\n }\n this.ui.requestRender();\n break;\n\n case \"turn_start\": {\n this.workingMessage = pickWhimsicalWorkingMessage();\n if (this.loadingAnimation) {\n if (\"resetForTurn\" in this.loadingAnimation) this.loadingAnimation.resetForTurn(this.workingMessage);\n else this.loadingAnimation.setMessage(this.workingMessage);\n } else if (!this.autoCompactionLoader) {\n // Post-tool compaction interposes this turn_start between\n // compaction_start and compaction_end. Mounting generic Working here\n // would evict the factual compaction status from the shared status\n // container and leave a stale `loadingAnimation` that then blocks the\n // restore at compaction_end, hiding all activity until the next run.\n this.showWorkingLoaderNow();\n }\n break;\n }\n\n case \"turn_end\": {\n this.workingMessage = undefined;\n this.stopWorkingLoader();\n this.ui.requestRender();\n break;\n }\n\n case \"queue_update\":\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n break;\n\n case \"session_info_changed\":\n this.updateTerminalTitle();\n this.footer.invalidate();\n this.ui.requestRender();\n break;\n\n case \"model_changed\":\n this.refreshBuiltInHeader();\n this.updateEditorBorderColor();\n break;\n\n case \"thinking_level_changed\":\n this.footer.invalidate();\n this.refreshBuiltInHeader();\n this.updateEditorBorderColor();\n break;\n\n case \"entry_appended\":\n if (event.entry.type === \"custom\") this.addCustomEntryToChat(event.entry);\n this.ui.requestRender();\n break;\n\n case \"agent_settled\":\n await this.checkShutdownRequested();\n break;\n\n case \"message_start\":\n if (event.message.role === \"custom\") {\n appendNewChildrenBeforeAttachedChild(\n this.chatContainer,\n this.streamingComponent,\n () => this.addMessageToChat(event.message),\n );\n this.ui.requestRender();\n } else if (event.message.role === \"user\") {\n if (!this.consumeDeferredRenderedUserInput(this.getUserMessageText(event.message))) {\n this.addMessageToChat(event.message);\n }\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n } else if (event.message.role === \"assistant\") {\n this.streamingComponent = new AssistantMessageComponent(\n undefined,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n this.outputPad,\n );\n this.streamingMessage = event.message;\n this.chatContainer.addChild(this.streamingComponent);\n this.streamingComponent.updateContent(this.streamingMessage);\n this.ui.requestRender();\n }\n break;\n\n case \"message_update\":\n if (this.streamingComponent && event.message.role === \"assistant\") {\n this.streamingMessage = event.message;\n this.streamingComponent.updateContent(this.streamingMessage);\n\n for (const content of this.streamingMessage.content) {\n if (content.type === \"toolCall\") {\n if (!this.pendingTools.has(content.id)) {\n const component = createToolComponent(this, content.name, content.id, content.arguments);\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n this.pendingTools.set(content.id, component);\n } else {\n const component = this.pendingTools.get(content.id);\n if (component) {\n component.updateArgs(content.arguments);\n }\n }\n }\n }\n this.ui.requestRender();\n }\n break;\n\n case \"message_end\":\n if (event.message.role === \"user\") break;\n if (this.streamingComponent && event.message.role === \"assistant\") {\n this.streamingMessage = event.message;\n let errorMessage: string | undefined;\n if (this.streamingMessage.stopReason === \"aborted\") {\n const existingAbortMessage =\n this.streamingMessage.errorMessage && this.streamingMessage.errorMessage !== \"Request was aborted\"\n ? this.streamingMessage.errorMessage\n : undefined;\n const retryAttempt = this.session.retryAttempt;\n errorMessage = existingAbortMessage ?? (\n retryAttempt > 0\n ? `Aborted after ${retryAttempt} retry attempt${retryAttempt > 1 ? \"s\" : \"\"}`\n : \"Operation aborted\"\n );\n this.streamingMessage.errorMessage = errorMessage;\n }\n this.streamingComponent.updateContent(this.streamingMessage);\n\n if (\n this.streamingMessage.stopReason === \"aborted\" ||\n this.streamingMessage.stopReason === \"error\"\n ) {\n if (!errorMessage) {\n errorMessage = this.streamingMessage.errorMessage || \"Error\";\n }\n for (const [, component] of this.pendingTools.entries()) {\n component.updateResult({\n content: [{ type: \"text\", text: errorMessage }],\n isError: true,\n });\n }\n this.pendingTools.clear();\n } else {\n // Args are now complete - trigger diff computation for edit tools\n for (const [, component] of this.pendingTools.entries()) {\n component.setArgsComplete();\n }\n }\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.footer.invalidate();\n }\n if (event.message.role === \"assistant\" && this.settingsManager.getShowCacheMissNotices()) {\n const miss = detectCacheMiss(this.sessionManager.getEntries(), event.message, { getModel: (provider, model) => this.session.modelRegistry.find(provider, model) });\n if (miss) {\n const cause = miss.modelChanged ? \" after model switch\" : miss.idleMs >= CACHE_TTL_MS ? \" after cache TTL expiry\" : \"\";\n this.chatContainer.addChild(new Text(theme.fg(\"warning\", `Prompt cache miss${cause}: ${miss.missedTokens.toLocaleString()} tokens re-billed ($${miss.missedCost.toFixed(3)})`), 1, 0));\n }\n }\n this.ui.requestRender();\n break;\n\n case \"tool_execution_start\": {\n let component = this.pendingTools.get(event.toolCallId);\n if (!component) {\n component = createToolComponent(this, event.toolName, event.toolCallId, event.args);\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n this.pendingTools.set(event.toolCallId, component);\n }\n component.markExecutionStarted();\n this.ui.requestRender();\n break;\n }\n\n case \"tool_execution_update\": {\n const component = this.pendingTools.get(event.toolCallId);\n if (component) {\n component.updateResult(\n { ...event.partialResult, isError: false },\n true,\n );\n this.ui.requestRender();\n }\n break;\n }\n\n case \"tool_execution_end\": {\n const component = this.pendingTools.get(event.toolCallId);\n if (component) {\n component.updateResult({ ...event.result, isError: event.isError });\n this.pendingTools.delete(event.toolCallId);\n this.ui.requestRender();\n }\n break;\n }\n\n case \"agent_end\":\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(false);\n }\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n }\n if (this.streamingComponent) {\n this.chatContainer.removeChild(this.streamingComponent);\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n }\n this.pendingTools.clear();\n if (this.compactionQueuedMessages.length > 0) {\n void this.session.agent.waitForIdle().then(() => this.flushCompactionQueue({ willRetry: false }));\n }\n\n await this.checkShutdownRequested();\n\n this.ui.requestRender();\n break;\n\n case \"compaction_start\": {\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(true);\n }\n // Release any loader left behind by an earlier start before mounting a\n // new one; dropping the reference alone leaks its animation timer.\n if (this.autoCompactionLoader) {\n this.autoCompactionLoader.stop();\n this.autoCompactionLoader = undefined;\n }\n // Keep editor active; submissions are queued during compaction.\n // Never clobber an already-saved handler with our own abort closure.\n if (!this.autoCompactionEscapeHandlerSaved) {\n this.autoCompactionEscapeHandler = this.defaultEditor.onEscape;\n this.autoCompactionEscapeHandlerSaved = true;\n }\n this.defaultEditor.onEscape = () => {\n this.session.abortCompaction();\n };\n this.stopWorkingLoader();\n const cancelHint = `(${keyText(\"app.interrupt\")} Cancel)`;\n const isOverflowAutoCompaction = event.reason === \"overflow\";\n const label =\n event.reason === \"manual\"\n ? `Compacting context... ${cancelHint}`\n : `${isOverflowAutoCompaction ? \"Context overflow detected. \" : \"\"}Auto-compacting... ${cancelHint}`;\n this.autoCompactionLoader = new AtomicWorkingLoader(\n this.ui,\n undefined,\n (text) => theme.fg(isOverflowAutoCompaction ? \"warning\" : \"muted\", text),\n label,\n );\n this.statusContainer.addChild(this.autoCompactionLoader);\n this.ui.requestRender();\n break;\n }\n\n case \"compaction_end\": {\n if (this.settingsManager.getShowTerminalProgress()) {\n this.ui.terminal.setProgress(false);\n }\n if (this.autoCompactionEscapeHandlerSaved) {\n this.defaultEditor.onEscape = this.autoCompactionEscapeHandler;\n this.autoCompactionEscapeHandler = undefined;\n this.autoCompactionEscapeHandlerSaved = false;\n }\n if (this.autoCompactionLoader) {\n this.autoCompactionLoader.stop();\n this.autoCompactionLoader = undefined;\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n }\n if (event.aborted) {\n if (event.reason === \"manual\") {\n this.showError(\"Compaction cancelled\");\n } else {\n this.showStatus(\"Auto-compaction cancelled\");\n }\n } else if (event.result && !event.errorMessage) {\n this.chatContainer.clear();\n this.rebuildChatFromMessages({ suppressCompactionBoundary: event.result });\n this.addCompactionBoundaryToChat(event.result);\n this.footer.invalidate();\n } else if (event.errorMessage) {\n if (event.reason === \"manual\") {\n this.showError(event.errorMessage);\n } else {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(theme.fg(\"error\", event.errorMessage), 1, 0),\n );\n }\n }\n // Post-tool compaction resumes the same active run, so no new\n // agent_start event will recreate the working loader. A successful\n // no-op carries no `result` and still continues that stream.\n if (event.midTurn && !event.aborted && !event.errorMessage) {\n this.showWorkingLoaderNow();\n }\n if (!event.midTurn) void this.flushCompactionQueue({ willRetry: event.willRetry });\n this.ui.requestRender();\n break;\n }\n\n\n\t\tcase \"summarization_retry_scheduled\":\n\t\tcase \"summarization_retry_attempt_start\":\n\t\tcase \"summarization_retry_finished\":\n\t\t\thandleSummarizationRetryEvent(this, event);\n\t\t\tbreak;\n\n case \"auto_retry_start\": {\n // Set up escape to abort retry\n this.retryEscapeHandler = this.defaultEditor.onEscape;\n this.defaultEditor.onEscape = () => {\n this.session.abortRetry();\n };\n // Show retry indicator\n this.statusContainer.clear();\n this.retryCountdown?.dispose();\n const retryMessage = (seconds: number) =>\n `Retrying (${event.attempt}/${event.maxAttempts}) in ${seconds}s... (${keyText(\"app.interrupt\")} Cancel)`;\n this.retryLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"warning\", spinner),\n (text) => theme.fg(\"muted\", text),\n retryMessage(Math.ceil(event.delayMs / 1000)),\n );\n this.retryCountdown = new CountdownTimer(\n event.delayMs,\n this.ui,\n (seconds) => {\n this.retryLoader?.setMessage(retryMessage(seconds));\n },\n () => {\n this.retryCountdown = undefined;\n },\n );\n this.statusContainer.addChild(this.retryLoader);\n this.ui.requestRender();\n break;\n }\n\n\n case \"model_fallback_start\": {\n this.statusContainer.clear();\n if (this.fallbackLoader) {\n this.fallbackLoader.stop();\n this.fallbackLoader = undefined;\n }\n this.fallbackLoader = new Loader(\n this.ui,\n (spinner) => theme.fg(\"warning\", spinner),\n (text) => theme.fg(\"muted\", text),\n `Falling back from ${event.from} to ${event.to}...`,\n );\n this.statusContainer.addChild(this.fallbackLoader);\n this.ui.requestRender();\n break;\n }\n\n case \"model_fallback_end\": {\n if (this.fallbackLoader) {\n this.fallbackLoader.stop();\n this.fallbackLoader = undefined;\n }\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n this.ui.requestRender();\n break;\n }\n case \"auto_retry_end\": {\n // Restore escape handler\n if (this.retryEscapeHandler) {\n this.defaultEditor.onEscape = this.retryEscapeHandler;\n this.retryEscapeHandler = undefined;\n }\n if (this.retryCountdown) {\n this.retryCountdown.dispose();\n this.retryCountdown = undefined;\n }\n // Stop loader\n if (this.retryLoader) {\n this.retryLoader.stop();\n this.retryLoader = undefined;\n this.statusContainer.clear();\n mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n }\n // Show error only on final failure (success shows normal response)\n if (!event.success) {\n this.showError(\n `Retry failed after ${event.attempt} attempts: ${event.finalError || \"Unknown error\"}`,\n );\n }\n this.ui.requestRender();\n break;\n }\n\n case \"agent_continue_error\": {\n this.stopWorkingLoader();\n this.showError(event.errorMessage);\n this.ui.requestRender();\n break;\n }\n }\n };\n\nInteractiveModeBase.prototype.getUserMessageText = function(this: InteractiveModeBase, message: Message): string {\n if (message.role !== \"user\") return \"\";\n const textBlocks =\n typeof message.content === \"string\"\n ? [{ type: \"text\", text: message.content }]\n : message.content.filter((c: { type: string }) => c.type === \"text\");\n return textBlocks.map((c) => (c as { text: string }).text).join(\"\");\n };\n"]}
package/docs/tui.md CHANGED
@@ -501,10 +501,13 @@ interface MyTheme {
501
501
 
502
502
  ## Debug logging
503
503
 
504
- Set `ATOMIC_TUI_WRITE_LOG` to capture the raw ANSI stream written to stdout.
504
+ Set `PI_TUI_WRITE_LOG` to capture the raw ANSI stream written to stdout. The
505
+ variable is read by the vendored `@earendil-works/pi-tui` terminal, so it keeps
506
+ its upstream name; a directory path writes one `tui-<timestamp>-<pid>.log` file
507
+ per process.
505
508
 
506
509
  ```bash
507
- ATOMIC_TUI_WRITE_LOG=/tmp/tui-ansi.log atomic
510
+ PI_TUI_WRITE_LOG=/tmp/tui-ansi.log atomic
508
511
  ```
509
512
 
510
513
  Atomic vendors TUI components through the installed `@earendil-works/pi-tui` dependency.
@@ -821,6 +824,8 @@ ctx.ui.setWorkingIndicator();
821
824
 
822
825
  This affects the normal Working indicator from accepted prompt submission through response streaming. Working appears immediately during attachment and other pre-stream startup, then continues without a visible gap when the agent turn begins. A no-turn result, prompt failure, or turn completion removes it. An accepted manual retry clears stale status from the prior prompt before showing new pre-stream activity. Factual automatic retry and fallback status takes precedence while that transition is active; ordinary Working resumes only when a later Working lifecycle actually starts. With no extension override, Atomic renders the exact one-cell `∀` immediately before one of its 453 original randomized whimsical working verbs, selected once per turn. Every agent and SDK turn starts at regular weight with a fresh lifecycle-relative 88ms cadence, then follows a ten-frame, theme-aware dark → accent → bright/bold → accent → dark luminance ramp without changing glyph or geometry. Optional theme tone overrides control any desired phases exactly, including terminal palette indices 0–255; Atomic derives omitted tones from selected-surface, `accent`, and `text` roles. Dark, light, custom, and dynamically reloaded themes therefore retain their own palette. Under `NO_COLOR`, the same cadence remains visible through regular/bold weight without foreground-color escapes. Turn completion and terminal cleanup stop the timer cleanly. Restoring Atomic's default after an extension override also restarts at the dark regular phase; custom extension frames and intervals remain unchanged and render verbatim. `ATOMIC_REDUCED_MOTION=1` shows a static regular accent `∀` without an animation timer. The icon and longest message fit standard and 64-column widths. Factual status copy takes precedence. Compaction and retry loaders keep their plain built-in styling. During successful post-tool autocompaction, Atomic temporarily replaces the Working indicator with the compaction loader and restores it before the same stream continues; no additional user input is required.
823
826
 
827
+ Post-tool autocompaction is more precisely delimited by its own event pair. Pi opens the follow-up turn while the compaction is still unmatched, so the compaction status — not a generic Working message — owns the status surface from `compaction_start` until `compaction_end`, and the interposed turn does not take it back early. The status paints as soon as the compaction starts rather than on the next animation frame, in the main chat and in an attached workflow-stage chat alike. Ordinary Working then resumes for the continuing stream on any successful mid-turn completion, including a compaction that found nothing to compact and therefore reports no result. A cancelled or failed compaction stops all activity instead. The main chat reports automatic cancellation; an attached workflow-stage chat clears the transient status because the abort event carries no error text. Failures retain their event-provided error text.
828
+
824
829
  **Examples:** [working-indicator.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/working-indicator.ts)
825
830
 
826
831
  ### Pattern 5: Widgets Above/Below Editor
package/docs/workflows.md CHANGED
@@ -2819,7 +2819,7 @@ Surface behavior:
2819
2819
  - **Wheel and trackpad** - While the workflow graph is active, vertical wheel/trackpad gestures pan it up and down, and horizontal gestures pan wide graphs left and right when the terminal exposes horizontal wheel events; these gestures remain scoped to the graph instead of leaking into the main chat or terminal scrollback. Attached stage chats capture mouse/trackpad wheel events by default so scrolling stays inside the active stage transcript or prompt instead of falling through to terminal/main-chat scrollback.
2820
2820
  - **Tool and node detail** - Attached stage chats match main chat's tool-detail expansion behavior while keeping expansion state local to the workflow UI context. Press Ctrl+O (the configurable `app.tools.expand` binding) to expand every visible workflow node and tool card, including single, parallel, and chain subagent progress, current tool activity, and artifact paths; press it again to collapse them. The toggle works for active, completed, and archived stage views, including at the supported 40-column terminal minimum. A mounted prompt, custom question, or other input-owning overlay keeps the key instead of changing expansion.
2821
2821
  - **Footer context** - An attached live stage chat carries the main chat's current-folder and Git-branch identity into its themed footer and mirrors live extension status lines such as the MCP server indicator. Branch changes trigger a repaint through the host's cached footer provider, and extension status changes are read from that same provider rather than recomputed by the workflow UI.
2822
- - **Working animation lifecycle** - Ordinary attached-stage work keeps the same exact one-cell `∀` visible while following the active workflow theme's dark → accent → bright/bold → accent → dark luminance ramp every 88ms. Every agent and SDK turn resets to the dark regular phase with a fresh lifecycle-relative cadence; turn, terminal, error, replacement, and disposal cleanup stop the active timer without stale repaint. In an eligible retained terminal-stage chat, an accepted follow-up shows Working immediately while Atomic attaches the retained conversation and starts the prompt, then hands the same visible status to the agent turn without a gap. A no-turn result, prompt error, or terminal completion removes it; an accepted manual retry clears stale status from the prior prompt before showing new pre-stream activity. `NO_COLOR` retains regular/bold activity without foreground-color escapes. Reduced motion uses a static regular accent `∀` without an animation timer; factual automatic retry, fallback, compaction, cancellation, and error copy retains precedence.
2822
+ - **Working animation lifecycle** - Ordinary attached-stage work keeps the same exact one-cell `∀` visible while following the active workflow theme's dark → accent → bright/bold → accent → dark luminance ramp every 88ms. Every agent and SDK turn resets to the dark regular phase with a fresh lifecycle-relative cadence; turn, terminal, error, replacement, and disposal cleanup stop the active timer without stale repaint. In an eligible retained-stage chat, every accepted idle follow-up — including a workflow-authored `stage.sendUserMessage(...)` after a prior turn ended — shows Working on admission or attach, including while Atomic restores a saved retained conversation, and keeps it through prompt startup, pre-turn compaction, and agent handoff. Attaching or remounting mid-delivery paints immediately rather than waiting for the turn's first event. A message queued into a live turn with `followUp`/`steer` uses that turn's existing status instead of starting a new one. A no-turn result, prompt or restore error, or terminal completion removes it; once the last accepted post-terminal delivery settles, a leftover start cannot bring it back. An accepted manual retry clears stale status from the prior prompt before showing new pre-stream activity. `NO_COLOR` retains regular/bold activity without foreground-color escapes. Reduced motion uses a static regular accent `∀` without an animation timer; factual automatic retry, fallback, compaction, cancellation, and error copy retains precedence.
2823
2823
  - **Async statusline** - If an async/background subagent is running while the fullscreen workflow graph is open, the graph statusline mirrors the async summary so the background run remains visible; hide the graph with `h`, leave it with `ctrl+x`, or reconnect later to return to the full below-editor async widget.
2824
2824
  - **Copy mode** - Press `ctrl+t` inside an attached stage chat to toggle **copy mode**: copy mode disables workflow-chat mouse reporting so normal terminal/tmux text selection can work; press `ctrl+t` again to leave copy mode and restore transcript or prompt scrolling. Archived read-only stage transcripts expose the same footer and copy-mode status, so their text can also be selected and copied; `esc` closes the transcript and `ctrl+x` returns to the graph. While copy mode is on, wheel/trackpad gestures are handled by the terminal/tmux and may scroll terminal scrollback, so leave copy mode before using the wheel again.
2825
2825
  - **Run control** - Use `interrupt`, `pause`, and `resume` for resumable live work. Pause/interrupt holds a stage's queued steering and follow-up items in place without dequeuing them or starting continuation; `resume` releases those items once in their existing per-queue order, but queue release alone does not start a model turn. `resume` on a non-paused run reopens the saved snapshot or overlay. Use `quit` to pause a live run gracefully while preserving it for `/workflow resume`.
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.11-alpha.6",
3
+ "version": "0.9.11-alpha.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bastani/atomic",
9
- "version": "0.9.11-alpha.6",
9
+ "version": "0.9.11-alpha.7",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@bastani/atomic-natives": "0.9.11-alpha.6",
12
+ "@bastani/atomic-natives": "0.9.11-alpha.7",
13
13
  "@dbos-inc/dbos-sdk": "4.23.6",
14
14
  "@earendil-works/pi-agent-core": "^0.82.1",
15
15
  "@earendil-works/pi-ai": "^0.82.1",
@@ -515,16 +515,16 @@
515
515
  }
516
516
  },
517
517
  "node_modules/@bastani/atomic-natives": {
518
- "version": "0.9.11-alpha.6",
519
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.11-alpha.6.tgz",
518
+ "version": "0.9.11-alpha.7",
519
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.11-alpha.7.tgz",
520
520
  "license": "MIT",
521
521
  "optionalDependencies": {
522
- "@bastani/atomic-natives-darwin-arm64": "0.9.11-alpha.6",
523
- "@bastani/atomic-natives-darwin-x64": "0.9.11-alpha.6",
524
- "@bastani/atomic-natives-linux-arm64-gnu": "0.9.11-alpha.6",
525
- "@bastani/atomic-natives-linux-x64-gnu": "0.9.11-alpha.6",
526
- "@bastani/atomic-natives-win32-arm64-msvc": "0.9.11-alpha.6",
527
- "@bastani/atomic-natives-win32-x64-msvc": "0.9.11-alpha.6"
522
+ "@bastani/atomic-natives-darwin-arm64": "0.9.11-alpha.7",
523
+ "@bastani/atomic-natives-darwin-x64": "0.9.11-alpha.7",
524
+ "@bastani/atomic-natives-linux-arm64-gnu": "0.9.11-alpha.7",
525
+ "@bastani/atomic-natives-linux-x64-gnu": "0.9.11-alpha.7",
526
+ "@bastani/atomic-natives-win32-arm64-msvc": "0.9.11-alpha.7",
527
+ "@bastani/atomic-natives-win32-x64-msvc": "0.9.11-alpha.7"
528
528
  },
529
529
  "engines": {
530
530
  "bun": ">=1.3.14",
@@ -532,8 +532,8 @@
532
532
  }
533
533
  },
534
534
  "node_modules/@bastani/atomic-natives-darwin-arm64": {
535
- "version": "0.9.11-alpha.6",
536
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.11-alpha.6.tgz",
535
+ "version": "0.9.11-alpha.7",
536
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.11-alpha.7.tgz",
537
537
  "license": "MIT",
538
538
  "os": [
539
539
  "darwin"
@@ -544,8 +544,8 @@
544
544
  "optional": true
545
545
  },
546
546
  "node_modules/@bastani/atomic-natives-darwin-x64": {
547
- "version": "0.9.11-alpha.6",
548
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.11-alpha.6.tgz",
547
+ "version": "0.9.11-alpha.7",
548
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.11-alpha.7.tgz",
549
549
  "license": "MIT",
550
550
  "os": [
551
551
  "darwin"
@@ -556,8 +556,8 @@
556
556
  "optional": true
557
557
  },
558
558
  "node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
559
- "version": "0.9.11-alpha.6",
560
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.11-alpha.6.tgz",
559
+ "version": "0.9.11-alpha.7",
560
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.11-alpha.7.tgz",
561
561
  "license": "MIT",
562
562
  "os": [
563
563
  "linux"
@@ -571,8 +571,8 @@
571
571
  "optional": true
572
572
  },
573
573
  "node_modules/@bastani/atomic-natives-linux-x64-gnu": {
574
- "version": "0.9.11-alpha.6",
575
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.11-alpha.6.tgz",
574
+ "version": "0.9.11-alpha.7",
575
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.11-alpha.7.tgz",
576
576
  "license": "MIT",
577
577
  "os": [
578
578
  "linux"
@@ -586,8 +586,8 @@
586
586
  "optional": true
587
587
  },
588
588
  "node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
589
- "version": "0.9.11-alpha.6",
590
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.11-alpha.6.tgz",
589
+ "version": "0.9.11-alpha.7",
590
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.11-alpha.7.tgz",
591
591
  "license": "MIT",
592
592
  "os": [
593
593
  "win32"
@@ -598,8 +598,8 @@
598
598
  "optional": true
599
599
  },
600
600
  "node_modules/@bastani/atomic-natives-win32-x64-msvc": {
601
- "version": "0.9.11-alpha.6",
602
- "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.11-alpha.6.tgz",
601
+ "version": "0.9.11-alpha.7",
602
+ "resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.11-alpha.7.tgz",
603
603
  "license": "MIT",
604
604
  "os": [
605
605
  "win32"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.9.11-alpha.6",
3
+ "version": "0.9.11-alpha.7",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {
@@ -78,7 +78,7 @@
78
78
  "prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
79
79
  },
80
80
  "dependencies": {
81
- "@bastani/atomic-natives": "0.9.11-alpha.6",
81
+ "@bastani/atomic-natives": "0.9.11-alpha.7",
82
82
  "@dbos-inc/dbos-sdk": "4.23.6",
83
83
  "@earendil-works/pi-agent-core": "^0.82.1",
84
84
  "@earendil-works/pi-ai": "^0.82.1",
@@ -1,108 +0,0 @@
1
- # Brand register
2
-
3
- When design IS the product: brand sites, landing pages, marketing surfaces, campaign pages, portfolios, long-form content, about pages. The deliverable is the design itself; a visitor's impression is the thing being made.
4
-
5
- The register spans every genre. A tech brand (Stripe, Linear, Vercel). A luxury brand (a hotel, a fashion house). A consumer product (a restaurant, a travel site, a CPG packaging page). A creative studio, an agency portfolio, a band's album page. They all share the stance (*communicate, not transact*) and diverge wildly in aesthetic. Don't collapse them into a single look.
6
-
7
- ## The brand slop test
8
-
9
- If someone could look at this and say "AI made that" without hesitation, it's failed. The bar is distinctiveness; a visitor should ask "how was this made?", not "which AI made this?"
10
-
11
- Brand isn't a neutral register. AI-generated landing pages have flooded the internet, and average is no longer findable. Restraint without intent now reads as mediocre, not refined. Brand surfaces need a POV, a specific audience, a willingness to risk strangeness. Go big or go home.
12
-
13
- **The second slop test: aesthetic lane.** Before committing to moves, name the reference. A Klim-style specimen page is one lane; Stripe-minimal is another; Liquid-Death-acid-maximalism is another. Don't drift into editorial-magazine aesthetics on a brief that isn't editorial. A hiking brand with Cormorant italic drop caps has the wrong register within the register.
14
-
15
- Then the inverse test: in one sentence, describe what you're about to build the way a competitor would describe theirs. If that sentence fits the modal landing page in the category, restart.
16
-
17
- ## Typography
18
-
19
- ### Font selection procedure
20
-
21
- Every project. Never skip.
22
-
23
- 1. Read the brief. Write three concrete brand-voice words. Not "modern" or "elegant," but "warm and mechanical and opinionated" or "calm and clinical and careful." Physical-object words.
24
- 2. List the three fonts you'd reach for by reflex. If any appear in the reflex-reject list below, reject them; they are training-data defaults and they create monoculture.
25
- 3. Browse a real catalog (Google Fonts, Pangram Pangram, Future Fonts, Adobe Fonts, ABC Dinamo, Klim, Velvetyne) with the three words in mind. Find the font for the brand as a *physical object*: a museum caption, a 1970s terminal manual, a fabric label, a cheap-newsprint children's book, a concert poster, a receipt from a mid-century diner. Reject the first thing that "looks designy."
26
- 4. Cross-check. "Elegant" is not necessarily serif. "Technical" is not necessarily sans. "Warm" is not Fraunces. If the final pick lines up with the original reflex, start over.
27
-
28
- ### Reflex-reject list
29
-
30
- Training-data defaults. Ban list. Look further:
31
-
32
- Fraunces · Newsreader · Lora · Crimson · Crimson Pro · Crimson Text · Playfair Display · Cormorant · Cormorant Garamond · Syne · IBM Plex Mono · IBM Plex Sans · IBM Plex Serif · Space Mono · Space Grotesk · Inter · DM Sans · DM Serif Display · DM Serif Text · Outfit · Plus Jakarta Sans · Instrument Sans · Instrument Serif
33
-
34
- ### Reflex-reject aesthetic lanes
35
-
36
- Parallel to the font list. Currently saturated aesthetic families that have flooded brand surfaces. If a brief lands in one of these lanes without a register reason that *requires* it (a literal magazine, a literal terminal, a literal industrial signage system), it's the second-order training reflex: the trap one tier deeper than picking a Fraunces font. Look further.
37
-
38
- - **Editorial-typographic.** Display serif (often italic) + small mono labels + ruled separators + monochromatic restraint. Klim-influenced, magazine-cover affectation. By 2026, every Stripe-adjacent and Notion-adjacent brand has landed here. The fingerprint: three rule-separated columns, an italic Fraunces / Recoleta / Newsreader headline, lowercase track-spaced metadata, no imagery.
39
-
40
- (More entries land here on the same cadence the font list updates. Brutalist-utility and acid-maximalism may join when they saturate. Removing entries when they fall back below saturation is also fine.)
41
-
42
- The reflex-reject lists apply to **new design choices**. When the existing brand has already committed to a font or a lane as part of its identity, identity-preservation wins; variants on an existing surface don't second-guess what's already shipping. The reflex-reject lists are for greenfield decisions and for departure-mode variants in [live.md](live.md).
43
-
44
- ### Pairing and voice
45
-
46
- Distinctive + refined is the goal. The specific shape depends on the brand, not on the brand's category. A category ("restaurant", "dev tool", "magazine", "fintech") is not a recipe; treating it as one is the first-order reflex SKILL.md warns against.
47
-
48
- Two families minimum is the rule *only* when the voice needs it. A single well-chosen family with committed weight/size contrast is stronger than a timid display+body pair.
49
-
50
- ### Scale
51
-
52
- Modular scale, fluid `clamp()` for headings, ≥1.25 ratio between steps. Flat scales (1.1× apart) read as uncommitted.
53
-
54
- Light text on dark backgrounds: add 0.05–0.1 to line-height. Light type reads as lighter weight and needs more breathing room.
55
-
56
- ## Color
57
-
58
- Brand surfaces have permission for Committed, Full palette, and Drenched strategies. Use them. A single saturated color spread across a hero is not excess; it's voice. A beige-and-muted-slate landing page ignores the register.
59
-
60
- - Name a real reference before picking a strategy. "Klim Type Foundry #ff4500 orange drench", "Stripe purple-on-white restraint", "Liquid Death acid-green full palette", "Mailchimp yellow full palette", "Condé Nast Traveler muted navy restraint", "Vercel pure black monochrome". Unnamed ambition becomes beige.
61
- - Palette IS voice. A calm brand and a restless brand should not share palette mechanics.
62
- - When the strategy is Committed or Drenched, color carries the brand. Don't hedge with neutrals around the edges. Commit.
63
- - Don't converge across projects. Each brand surface differentiates from the last.
64
- - When a cultural-symbol palette is the obvious pull, reach past it. Let the cultural reading come from typography, imagery, and copy, not the palette.
65
-
66
- ## Layout
67
-
68
- - Asymmetric compositions are one option. Break the grid intentionally for emphasis.
69
- - Fluid spacing with `clamp()` that breathes on larger viewports. Vary for rhythm: generous separations, tight groupings.
70
- - For image-led briefs (hotels, restaurants, magazines, photography), full-bleed hero imagery with overlaid menu and centered headline is a canonical move; let the photograph be the design.
71
- - When cards ARE the right affordance, use `grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))` for breakpoint-free responsiveness.
72
-
73
- ## Imagery
74
-
75
- Brand surfaces lean on imagery. A restaurant, hotel, magazine, or product landing page without any imagery reads as incomplete, not as restrained. A solid-color rectangle where a hero image should go is worse than a representative stock photo.
76
-
77
- **When the brief implies imagery, you must ship imagery.** Zero images is a bug, not a design choice. "Restraint" is not an excuse. If the approved comp or brief is image-led, ship real project assets, generated raster assets, or a credible canvas/SVG/WebGL scene. Do not replace photographic, architectural, product, or place imagery with generic CSS panels, decorative diagrams, cards, bullets, or copy.
78
-
79
- - **For greenfield work without local assets, use stock imagery.** Unsplash is the default. The URL shape is `https://images.unsplash.com/photo-{id}?auto=format&fit=crop&w=1600&q=80`. **Verify the URLs before referencing them.** If you have an image-search MCP, web-fetch tool, or browser access, use it to find real photo IDs and confirm they resolve. Guessed IDs (even ones that look real) often 404 and ship as broken-image placeholders. Without a verification path, pick fewer photos you're confident exist over more that you guessed; never substitute colored `<div>` placeholders.
80
- - **Search for the brand's physical object**, not the generic category: "handmade pasta on a scratched wooden table" beats "Italian food"; "cypress trees above a limestone hotel facade at dusk" beats "luxury hotel".
81
- - **One decisive photo beats five mediocre ones.** Hero imagery should commit to a mood; padding with more stock doesn't rescue an indecisive one.
82
- - **Alt text is part of the voice.** "Coastal fettuccine, hand-cut, served on the terrace" beats "pasta dish".
83
-
84
- "Imagery" here is broader than stock photography: product screenshots, custom data visualizations, generated SVG, and canvas/WebGL scenes are all imagery. Text-only pages where typography alone carries the entire visual weight are the failure mode.
85
-
86
- ## Motion
87
-
88
- - One well-orchestrated page-load beats scattered micro-interactions, when the brand invites it. Some brands skip entrance motion entirely; the restraint is the voice.
89
-
90
- ## Brand bans (on top of the shared absolute bans)
91
-
92
- - Monospace as lazy shorthand for "technical / developer." If the brand isn't technical, mono reads as costume.
93
- - Large rounded-corner icons above every heading. Screams template.
94
- - Single-family pages that picked the family by reflex, not voice. (A single family chosen deliberately is fine.)
95
- - All-caps body copy. Reserve caps for short labels and headings.
96
- - Timid palettes and average layouts. Safe = invisible.
97
- - Zero imagery on a brief that implies imagery (restaurant, hotel, food, travel, fashion, photography, hobbyist). Colored blocks where a hero photo belongs.
98
- - Defaulting to editorial-magazine aesthetics (display serif + italic + drop caps + broadsheet grid) on briefs that aren't magazine-shaped. Editorial is ONE aesthetic lane, not the default brand aesthetic.
99
- - Repeated tiny uppercase tracked labels above every section heading. A single strong kicker can be voice; repeating it as section grammar is AI scaffolding unless it's a deliberate, named brand system.
100
-
101
- ## Brand permissions
102
-
103
- Brand can afford things product can't. Take them.
104
-
105
- - Ambitious first-load motion. Reveals and typographic choreography that earn their place; not fade-on-scroll for every section.
106
- - Single-purpose viewports. One dominant idea per fold, long scroll, deliberate pacing.
107
- - Unexpected color strategies. Palette IS voice; a calm brand and a restless brand should not share palette mechanics.
108
- - Art direction per section. Different sections can have different visual worlds if the narrative demands it. Consistency of voice beats consistency of treatment.