kimaki 0.30.1 → 1.0.0
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.
- package/dist/agent-ui.d.ts +33 -0
- package/dist/agent-ui.e2e.test.d.ts +1 -0
- package/dist/agent-ui.e2e.test.js +140 -0
- package/dist/agent-ui.e2e.test.js.map +1 -0
- package/dist/agent-ui.js +199 -0
- package/dist/agent-ui.js.map +1 -0
- package/dist/analytics.d.ts +42 -0
- package/dist/analytics.e2e.test.d.ts +1 -0
- package/dist/analytics.e2e.test.js +112 -0
- package/dist/analytics.e2e.test.js.map +1 -0
- package/dist/analytics.js +162 -221
- package/dist/analytics.js.map +1 -0
- package/dist/analytics.test.d.ts +1 -0
- package/dist/analytics.test.js +121 -157
- package/dist/analytics.test.js.map +1 -0
- package/dist/autostart.d.ts +7 -0
- package/dist/autostart.js +75 -0
- package/dist/autostart.js.map +1 -0
- package/dist/bot.d.ts +90 -0
- package/dist/bot.js +120 -0
- package/dist/bot.js.map +1 -0
- package/dist/btw.e2e.test.d.ts +1 -0
- package/dist/btw.e2e.test.js +102 -0
- package/dist/btw.e2e.test.js.map +1 -0
- package/dist/catalog-refresh.e2e.test.d.ts +1 -0
- package/dist/catalog-refresh.e2e.test.js +90 -0
- package/dist/catalog-refresh.e2e.test.js.map +1 -0
- package/dist/cli/bot.d.ts +5 -0
- package/dist/cli/bot.js +427 -0
- package/dist/cli/bot.js.map +1 -0
- package/dist/cli/discord.d.ts +3 -0
- package/dist/cli/discord.js +118 -0
- package/dist/cli/discord.js.map +1 -0
- package/dist/cli/project.d.ts +5 -0
- package/dist/cli/project.js +143 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/schedule.d.ts +3 -0
- package/dist/cli/schedule.js +156 -0
- package/dist/cli/schedule.js.map +1 -0
- package/dist/cli/session.d.ts +4 -0
- package/dist/cli/session.js +281 -0
- package/dist/cli/session.js.map +1 -0
- package/dist/cli/shared.d.ts +55 -0
- package/dist/cli/shared.js +138 -0
- package/dist/cli/shared.js.map +1 -0
- package/dist/cli-discord.e2e.test.d.ts +1 -0
- package/dist/cli-discord.e2e.test.js +64 -0
- package/dist/cli-discord.e2e.test.js.map +1 -0
- package/dist/cli-lock.e2e.test.d.ts +1 -0
- package/dist/cli-lock.e2e.test.js +520 -0
- package/dist/cli-lock.e2e.test.js.map +1 -0
- package/dist/cli-read.e2e.test.d.ts +1 -0
- package/dist/cli-read.e2e.test.js +81 -0
- package/dist/cli-read.e2e.test.js.map +1 -0
- package/dist/cli-sessions.e2e.test.d.ts +1 -0
- package/dist/cli-sessions.e2e.test.js +116 -0
- package/dist/cli-sessions.e2e.test.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +34 -263
- package/dist/cli.js.map +1 -0
- package/dist/commands/login-commands.d.ts +59 -0
- package/dist/commands/login-commands.js +341 -0
- package/dist/commands/login-commands.js.map +1 -0
- package/dist/commands/preference-commands.d.ts +44 -0
- package/dist/commands/preference-commands.js +551 -0
- package/dist/commands/preference-commands.js.map +1 -0
- package/dist/commands/session-commands.d.ts +8 -0
- package/dist/commands/session-commands.js +267 -0
- package/dist/commands/session-commands.js.map +1 -0
- package/dist/commands/thread-commands.d.ts +16 -0
- package/dist/commands/thread-commands.js +285 -0
- package/dist/commands/thread-commands.js.map +1 -0
- package/dist/commands/worktree-commands.d.ts +41 -0
- package/dist/commands/worktree-commands.js +279 -0
- package/dist/commands/worktree-commands.js.map +1 -0
- package/dist/commands.e2e.test.d.ts +1 -0
- package/dist/commands.e2e.test.js +255 -0
- package/dist/commands.e2e.test.js.map +1 -0
- package/dist/credentials.d.ts +84 -0
- package/dist/credentials.js +320 -0
- package/dist/credentials.js.map +1 -0
- package/dist/db.d.ts +1532 -0
- package/dist/db.js +57 -245
- package/dist/db.js.map +1 -0
- package/dist/db.test.d.ts +1 -0
- package/dist/db.test.js +352 -673
- package/dist/db.test.js.map +1 -0
- package/dist/duration.d.ts +2 -0
- package/dist/duration.js +18 -0
- package/dist/duration.js.map +1 -0
- package/dist/effects.d.ts +15 -0
- package/dist/effects.js +291 -0
- package/dist/effects.js.map +1 -0
- package/dist/errors.d.ts +38 -0
- package/dist/errors.js +40 -170
- package/dist/errors.js.map +1 -0
- package/dist/event-loop.d.ts +40 -0
- package/dist/event-loop.js +414 -0
- package/dist/event-loop.js.map +1 -0
- package/dist/file-edit-log.d.ts +41 -0
- package/dist/file-edit-log.js +122 -164
- package/dist/file-edit-log.js.map +1 -0
- package/dist/file-edit-log.test.d.ts +1 -0
- package/dist/file-edit-log.test.js +68 -244
- package/dist/file-edit-log.test.js.map +1 -0
- package/dist/format-parts.d.ts +137 -0
- package/dist/format-parts.js +300 -0
- package/dist/format-parts.js.map +1 -0
- package/dist/format-parts.test.d.ts +1 -0
- package/dist/format-parts.test.js +144 -0
- package/dist/format-parts.test.js.map +1 -0
- package/dist/gateway-replay.e2e.test.d.ts +1 -0
- package/dist/gateway-replay.e2e.test.js +95 -0
- package/dist/gateway-replay.e2e.test.js.map +1 -0
- package/dist/harness.e2e.test.d.ts +1 -0
- package/dist/harness.e2e.test.js +107 -0
- package/dist/harness.e2e.test.js.map +1 -0
- package/dist/hello-thread.e2e.test.d.ts +1 -0
- package/dist/hello-thread.e2e.test.js +194 -0
- package/dist/hello-thread.e2e.test.js.map +1 -0
- package/dist/ingress.d.ts +7 -0
- package/dist/ingress.js +337 -0
- package/dist/ingress.js.map +1 -0
- package/dist/interaction-context.d.ts +45 -0
- package/dist/interaction-context.js +77 -0
- package/dist/interaction-context.js.map +1 -0
- package/dist/interrupt.e2e.test.d.ts +1 -0
- package/dist/interrupt.e2e.test.js +124 -0
- package/dist/interrupt.e2e.test.js.map +1 -0
- package/dist/legacy.e2e.test.d.ts +1 -0
- package/dist/legacy.e2e.test.js +85 -0
- package/dist/legacy.e2e.test.js.map +1 -0
- package/dist/live-call.d.ts +51 -0
- package/dist/live-call.js +207 -0
- package/dist/live-call.js.map +1 -0
- package/dist/lock-routes.d.ts +812 -0
- package/dist/lock-routes.js +635 -0
- package/dist/lock-routes.js.map +1 -0
- package/dist/lock-server.d.ts +36 -0
- package/dist/lock-server.js +223 -0
- package/dist/lock-server.js.map +1 -0
- package/dist/logger.d.ts +13 -0
- package/dist/logger.js +112 -162
- package/dist/logger.js.map +1 -0
- package/dist/login.e2e.test.d.ts +1 -0
- package/dist/login.e2e.test.js +83 -0
- package/dist/login.e2e.test.js.map +1 -0
- package/dist/main.d.ts +32 -0
- package/dist/main.js +190 -0
- package/dist/main.js.map +1 -0
- package/dist/markdown/components.d.ts +10 -0
- package/dist/markdown/components.js +77 -0
- package/dist/markdown/components.js.map +1 -0
- package/dist/markdown/markdown.test.d.ts +1 -0
- package/dist/markdown/markdown.test.js +393 -0
- package/dist/markdown/markdown.test.js.map +1 -0
- package/dist/markdown/render-markdown.d.ts +30 -0
- package/dist/markdown/render-markdown.js +265 -0
- package/dist/markdown/render-markdown.js.map +1 -0
- package/dist/message-tool.e2e.test.d.ts +1 -0
- package/dist/message-tool.e2e.test.js +39 -0
- package/dist/message-tool.e2e.test.js.map +1 -0
- package/dist/migrations.d.ts +8 -0
- package/dist/migrations.js +187 -0
- package/dist/migrations.js.map +1 -0
- package/dist/onboarding-cli.e2e.test.d.ts +1 -0
- package/dist/onboarding-cli.e2e.test.js +178 -0
- package/dist/onboarding-cli.e2e.test.js.map +1 -0
- package/dist/onboarding.d.ts +36 -0
- package/dist/onboarding.e2e.test.d.ts +1 -0
- package/dist/onboarding.e2e.test.js +148 -0
- package/dist/onboarding.e2e.test.js.map +1 -0
- package/dist/onboarding.js +261 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/opencode-server.d.ts +54 -0
- package/dist/opencode-server.js +413 -0
- package/dist/opencode-server.js.map +1 -0
- package/dist/opencode-server.test.d.ts +1 -0
- package/dist/opencode-server.test.js +21 -0
- package/dist/opencode-server.test.js.map +1 -0
- package/dist/permissions.d.ts +31 -0
- package/dist/permissions.e2e.test.d.ts +1 -0
- package/dist/permissions.e2e.test.js +166 -0
- package/dist/permissions.e2e.test.js.map +1 -0
- package/dist/permissions.js +95 -0
- package/dist/permissions.js.map +1 -0
- package/dist/plugin/anthropic/index.d.ts +13 -0
- package/dist/plugin/anthropic/index.js +201 -0
- package/dist/plugin/anthropic/index.js.map +1 -0
- package/dist/plugin/anthropic/index.test.d.ts +1 -0
- package/dist/plugin/anthropic/index.test.js +39 -0
- package/dist/plugin/anthropic/index.test.js.map +1 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +106 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/session-id/index.d.ts +3 -0
- package/dist/plugin/session-id/index.js +18 -0
- package/dist/plugin/session-id/index.js.map +1 -0
- package/dist/plugin.e2e.test.d.ts +1 -0
- package/dist/plugin.e2e.test.js +87 -0
- package/dist/plugin.e2e.test.js.map +1 -0
- package/dist/preference-commands.e2e.test.d.ts +1 -0
- package/dist/preference-commands.e2e.test.js +555 -0
- package/dist/preference-commands.e2e.test.js.map +1 -0
- package/dist/probe-live.tmp.d.ts +1 -0
- package/dist/probe-live.tmp.js +82 -0
- package/dist/probe-live.tmp.js.map +1 -0
- package/dist/project.d.ts +58 -0
- package/dist/project.js +169 -0
- package/dist/project.js.map +1 -0
- package/dist/prompt.d.ts +112 -0
- package/dist/prompt.js +578 -0
- package/dist/prompt.js.map +1 -0
- package/dist/questions.d.ts +59 -0
- package/dist/questions.e2e.test.d.ts +1 -0
- package/dist/questions.e2e.test.js +290 -0
- package/dist/questions.e2e.test.js.map +1 -0
- package/dist/questions.js +231 -0
- package/dist/questions.js.map +1 -0
- package/dist/queue.d.ts +45 -0
- package/dist/queue.e2e.test.d.ts +1 -0
- package/dist/queue.e2e.test.js +220 -0
- package/dist/queue.e2e.test.js.map +1 -0
- package/dist/queue.js +132 -0
- package/dist/queue.js.map +1 -0
- package/dist/remote-send.d.ts +32 -0
- package/dist/remote-send.e2e.test.d.ts +1 -0
- package/dist/remote-send.e2e.test.js +89 -0
- package/dist/remote-send.e2e.test.js.map +1 -0
- package/dist/remote-send.js +105 -0
- package/dist/remote-send.js.map +1 -0
- package/dist/renderer.e2e.test.d.ts +1 -0
- package/dist/renderer.e2e.test.js +357 -0
- package/dist/renderer.e2e.test.js.map +1 -0
- package/dist/restart.e2e.test.d.ts +1 -0
- package/dist/restart.e2e.test.js +68 -0
- package/dist/restart.e2e.test.js.map +1 -0
- package/dist/routes.d.ts +24 -0
- package/dist/routes.js +42 -0
- package/dist/routes.js.map +1 -0
- package/dist/routes.test.d.ts +1 -0
- package/dist/routes.test.js +79 -0
- package/dist/routes.test.js.map +1 -0
- package/dist/routines.e2e.test.d.ts +1 -0
- package/dist/routines.e2e.test.js +188 -0
- package/dist/routines.e2e.test.js.map +1 -0
- package/dist/scheduler.d.ts +116 -0
- package/dist/scheduler.e2e.test.d.ts +1 -0
- package/dist/scheduler.e2e.test.js +163 -0
- package/dist/scheduler.e2e.test.js.map +1 -0
- package/dist/scheduler.js +602 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/scheduler.test.d.ts +1 -0
- package/dist/scheduler.test.js +180 -0
- package/dist/scheduler.test.js.map +1 -0
- package/dist/schema-sql.d.ts +1 -0
- package/dist/schema-sql.js +3 -0
- package/dist/schema-sql.js.map +1 -0
- package/dist/schema.d.ts +2968 -0
- package/dist/schema.js +95 -252
- package/dist/schema.js.map +1 -0
- package/dist/session-commands.e2e.test.d.ts +1 -0
- package/dist/session-commands.e2e.test.js +285 -0
- package/dist/session-commands.e2e.test.js.map +1 -0
- package/dist/session-events.d.ts +55 -0
- package/dist/session-events.js +190 -0
- package/dist/session-events.js.map +1 -0
- package/dist/session-ops.e2e.test.d.ts +1 -0
- package/dist/session-ops.e2e.test.js +114 -0
- package/dist/session-ops.e2e.test.js.map +1 -0
- package/dist/sessions.d.ts +121 -0
- package/dist/sessions.js +662 -0
- package/dist/sessions.js.map +1 -0
- package/dist/shell.e2e.test.d.ts +1 -0
- package/dist/shell.e2e.test.js +147 -0
- package/dist/shell.e2e.test.js.map +1 -0
- package/dist/slash-commands.d.ts +62 -0
- package/dist/slash-commands.js +475 -0
- package/dist/slash-commands.js.map +1 -0
- package/dist/slash-commands.test.d.ts +1 -0
- package/dist/slash-commands.test.js +87 -0
- package/dist/slash-commands.test.js.map +1 -0
- package/dist/sleep.e2e.test.d.ts +1 -0
- package/dist/sleep.e2e.test.js +115 -487
- package/dist/sleep.e2e.test.js.map +1 -0
- package/dist/sleeps.d.ts +37 -0
- package/dist/sleeps.js +220 -0
- package/dist/sleeps.js.map +1 -0
- package/dist/store.d.ts +10 -0
- package/dist/store.js +8 -28
- package/dist/store.js.map +1 -0
- package/dist/system-prompt.d.ts +65 -0
- package/dist/system-prompt.js +875 -0
- package/dist/system-prompt.js.map +1 -0
- package/dist/tasks.e2e.test.d.ts +1 -0
- package/dist/tasks.e2e.test.js +173 -0
- package/dist/tasks.e2e.test.js.map +1 -0
- package/dist/test/auth-plugin/index.d.ts +3 -0
- package/dist/test/auth-plugin/index.js +18 -0
- package/dist/test/auth-plugin/index.js.map +1 -0
- package/dist/test/fake-mcp-server.d.ts +1 -0
- package/dist/test/fake-mcp-server.js +45 -0
- package/dist/test/fake-mcp-server.js.map +1 -0
- package/dist/test/harness.d.ts +246 -0
- package/dist/test/harness.js +704 -0
- package/dist/test/harness.js.map +1 -0
- package/dist/test/replay.d.ts +14 -0
- package/dist/test/replay.js +75 -0
- package/dist/test/replay.js.map +1 -0
- package/dist/thread-reducer.d.ts +172 -0
- package/dist/thread-reducer.fixtures.test.d.ts +1 -0
- package/dist/thread-reducer.fixtures.test.js +360 -0
- package/dist/thread-reducer.fixtures.test.js.map +1 -0
- package/dist/thread-reducer.js +497 -0
- package/dist/thread-reducer.js.map +1 -0
- package/dist/thread-reducer.test.d.ts +1 -0
- package/dist/thread-reducer.test.js +369 -0
- package/dist/thread-reducer.test.js.map +1 -0
- package/dist/tts.test.d.ts +1 -0
- package/dist/tts.test.js +147 -0
- package/dist/tts.test.js.map +1 -0
- package/dist/voice-agent.d.ts +33 -0
- package/dist/voice-agent.js +159 -0
- package/dist/voice-agent.js.map +1 -0
- package/dist/voice-attachments.e2e.test.d.ts +1 -0
- package/dist/voice-attachments.e2e.test.js +253 -0
- package/dist/voice-attachments.e2e.test.js.map +1 -0
- package/dist/voice-call.d.ts +59 -0
- package/dist/voice-call.e2e.test.d.ts +1 -0
- package/dist/voice-call.e2e.test.js +259 -0
- package/dist/voice-call.e2e.test.js.map +1 -0
- package/dist/voice-call.js +760 -0
- package/dist/voice-call.js.map +1 -0
- package/dist/voice-openai.e2e.test.d.ts +1 -0
- package/dist/voice-openai.e2e.test.js +161 -0
- package/dist/voice-openai.e2e.test.js.map +1 -0
- package/dist/voice.d.ts +116 -0
- package/dist/voice.js +648 -646
- package/dist/voice.js.map +1 -0
- package/dist/working-directory.e2e.test.d.ts +1 -0
- package/dist/working-directory.e2e.test.js +231 -0
- package/dist/working-directory.e2e.test.js.map +1 -0
- package/dist/worktrees.d.ts +54 -0
- package/dist/worktrees.js +247 -709
- package/dist/worktrees.js.map +1 -0
- package/dist/worktrees.test.d.ts +1 -0
- package/dist/worktrees.test.js +97 -952
- package/dist/worktrees.test.js.map +1 -0
- package/package.json +40 -79
- package/src/agent-ui.e2e.test.ts +134 -0
- package/src/agent-ui.ts +216 -0
- package/src/analytics.e2e.test.ts +138 -0
- package/src/analytics.test.ts +122 -182
- package/src/analytics.ts +206 -256
- package/src/autostart.ts +78 -0
- package/src/bot.ts +194 -0
- package/src/btw.e2e.test.ts +130 -0
- package/src/catalog-refresh.e2e.test.ts +112 -0
- package/src/cli/bot.ts +419 -0
- package/src/cli/discord.ts +116 -0
- package/src/cli/project.ts +147 -0
- package/src/cli/schedule.ts +151 -0
- package/src/cli/session.ts +285 -0
- package/src/cli/shared.ts +139 -0
- package/src/cli-discord.e2e.test.ts +62 -0
- package/src/cli-lock.e2e.test.ts +530 -0
- package/src/cli-read.e2e.test.ts +78 -0
- package/src/cli-sessions.e2e.test.ts +122 -0
- package/src/cli.ts +35 -418
- package/src/commands/login-commands.ts +360 -0
- package/src/commands/preference-commands.ts +586 -0
- package/src/commands/session-commands.ts +289 -0
- package/src/commands/thread-commands.ts +324 -0
- package/src/commands/worktree-commands.ts +288 -0
- package/src/commands.e2e.test.ts +290 -0
- package/src/credentials.ts +425 -0
- package/src/db.test.ts +345 -748
- package/src/db.ts +66 -284
- package/src/duration.ts +18 -0
- package/src/effects.ts +303 -0
- package/src/errors.ts +39 -222
- package/src/event-loop.ts +462 -0
- package/src/file-edit-log.test.ts +68 -272
- package/src/file-edit-log.ts +108 -231
- package/src/fixtures/v1-schema.sql +241 -0
- package/src/fixtures/voice.ogg +0 -0
- package/src/format-parts.test.ts +150 -0
- package/src/format-parts.ts +405 -0
- package/src/gateway-replay.e2e.test.ts +116 -0
- package/src/harness.e2e.test.ts +124 -0
- package/src/hello-thread.e2e.test.ts +223 -0
- package/src/ingress.ts +334 -0
- package/src/interaction-context.ts +131 -0
- package/src/interrupt.e2e.test.ts +151 -0
- package/src/legacy.e2e.test.ts +105 -0
- package/src/live-call.ts +249 -0
- package/src/lock-routes.ts +625 -0
- package/src/lock-server.ts +233 -0
- package/src/logger.ts +120 -207
- package/src/login.e2e.test.ts +86 -0
- package/src/main.ts +230 -0
- package/src/markdown/components.ts +102 -0
- package/src/markdown/markdown.test.ts +414 -0
- package/src/markdown/render-markdown.ts +288 -0
- package/src/migrations.ts +198 -0
- package/src/onboarding-cli.e2e.test.ts +215 -0
- package/src/onboarding.e2e.test.ts +171 -0
- package/src/onboarding.ts +297 -0
- package/src/opencode-server.test.ts +24 -0
- package/src/opencode-server.ts +461 -0
- package/src/permissions.e2e.test.ts +191 -0
- package/src/permissions.ts +121 -0
- package/src/plugin/anthropic/index.test.ts +39 -0
- package/src/plugin/anthropic/index.ts +213 -0
- package/src/plugin/index.ts +93 -0
- package/src/plugin/session-id/index.ts +19 -0
- package/src/plugin.e2e.test.ts +112 -0
- package/src/preference-commands.e2e.test.ts +597 -0
- package/src/project.ts +216 -0
- package/src/prompt.ts +664 -0
- package/src/questions.e2e.test.ts +328 -0
- package/src/questions.ts +322 -0
- package/src/queue.e2e.test.ts +253 -0
- package/src/queue.ts +158 -0
- package/src/remote-send.e2e.test.ts +91 -0
- package/src/remote-send.ts +110 -0
- package/src/renderer.e2e.test.ts +390 -0
- package/src/restart.e2e.test.ts +90 -0
- package/src/routes.test.ts +81 -0
- package/src/routes.ts +48 -0
- package/src/routines.e2e.test.ts +210 -0
- package/src/scheduler.e2e.test.ts +182 -0
- package/src/scheduler.test.ts +183 -0
- package/src/scheduler.ts +648 -0
- package/src/schema-sql.ts +3 -0
- package/src/schema.ts +95 -271
- package/src/session-commands.e2e.test.ts +326 -0
- package/src/session-events.ts +218 -0
- package/src/session-ops.e2e.test.ts +141 -0
- package/src/sessions.ts +803 -0
- package/src/shell.e2e.test.ts +173 -0
- package/src/slash-commands.test.ts +89 -0
- package/src/slash-commands.ts +539 -0
- package/src/sleep.e2e.test.ts +135 -552
- package/src/sleeps.ts +230 -0
- package/src/store.ts +19 -217
- package/src/system-prompt.ts +944 -0
- package/src/test/auth-plugin/index.ts +17 -0
- package/src/test/fake-mcp-server.ts +49 -0
- package/src/test/harness.ts +957 -0
- package/src/test/replay.ts +90 -0
- package/src/thread-reducer.fixtures.test.ts +374 -0
- package/src/thread-reducer.test.ts +380 -0
- package/src/thread-reducer.ts +671 -0
- package/src/tts.test.ts +150 -0
- package/src/voice-agent.ts +196 -0
- package/src/voice-attachments.e2e.test.ts +298 -0
- package/src/voice-call.e2e.test.ts +293 -0
- package/src/voice-call.ts +764 -0
- package/src/voice-openai.e2e.test.ts +191 -0
- package/src/voice.ts +691 -890
- package/src/working-directory.e2e.test.ts +226 -0
- package/src/worktrees.test.ts +89 -1115
- package/src/worktrees.ts +195 -957
- package/bin.js +0 -2
- package/dist/agent-model.e2e.test.js +0 -1215
- package/dist/ai-tool-to-genai.js +0 -233
- package/dist/ai-tool-to-genai.test.js +0 -267
- package/dist/ai-tool.js +0 -6
- package/dist/anthropic-account-identity.js +0 -70
- package/dist/anthropic-account-identity.test.js +0 -38
- package/dist/anthropic-auth-plugin.js +0 -958
- package/dist/anthropic-auth-plugin.test.js +0 -115
- package/dist/anthropic-auth-state.js +0 -186
- package/dist/anthropic-auth-state.test.js +0 -203
- package/dist/bash-tool-schema-plugin.js +0 -50
- package/dist/bash-tool-schema-plugin.test.js +0 -68
- package/dist/bin.js +0 -151
- package/dist/bot-lifecycle.test.js +0 -206
- package/dist/btw-prefix-detection.js +0 -15
- package/dist/btw-prefix-detection.test.js +0 -93
- package/dist/cache-drift-plugin.js +0 -183
- package/dist/cache-rewrite.js +0 -39
- package/dist/cache-rewrite.test.js +0 -41
- package/dist/channel-management.js +0 -347
- package/dist/cli-commands/bot.js +0 -254
- package/dist/cli-commands/maintenance.js +0 -171
- package/dist/cli-commands/misc.js +0 -153
- package/dist/cli-commands/project.js +0 -510
- package/dist/cli-commands/send.js +0 -659
- package/dist/cli-commands/session.js +0 -889
- package/dist/cli-commands/task.js +0 -277
- package/dist/cli-commands/thread.js +0 -63
- package/dist/cli-commands/user.js +0 -145
- package/dist/cli-parsing.test.js +0 -226
- package/dist/cli-runner.js +0 -1579
- package/dist/cli-runner.test.js +0 -86
- package/dist/cli-send-thread.e2e.test.js +0 -470
- package/dist/cloudflare-transcription.js +0 -56
- package/dist/commands/abort.js +0 -84
- package/dist/commands/action-buttons.js +0 -248
- package/dist/commands/add-project.js +0 -111
- package/dist/commands/agent.js +0 -658
- package/dist/commands/ask-question.js +0 -371
- package/dist/commands/ask-question.test.js +0 -150
- package/dist/commands/btw.js +0 -167
- package/dist/commands/compact.js +0 -117
- package/dist/commands/context-usage.js +0 -147
- package/dist/commands/create-new-project.js +0 -138
- package/dist/commands/diff.js +0 -63
- package/dist/commands/file-upload.js +0 -280
- package/dist/commands/fork-subagent.js +0 -175
- package/dist/commands/fork.js +0 -260
- package/dist/commands/gemini-apikey.js +0 -123
- package/dist/commands/last-sessions.js +0 -129
- package/dist/commands/login.js +0 -893
- package/dist/commands/mcp.js +0 -239
- package/dist/commands/memory-snapshot.js +0 -24
- package/dist/commands/mention-mode.js +0 -42
- package/dist/commands/merge-worktree.js +0 -205
- package/dist/commands/model-variant.js +0 -390
- package/dist/commands/model.js +0 -957
- package/dist/commands/multioauth.js +0 -425
- package/dist/commands/new-worktree.js +0 -622
- package/dist/commands/paginated-select.js +0 -57
- package/dist/commands/permissions.js +0 -327
- package/dist/commands/queue.js +0 -340
- package/dist/commands/queue.test.js +0 -15
- package/dist/commands/remove-project.js +0 -111
- package/dist/commands/restart-opencode-server.js +0 -133
- package/dist/commands/resume.js +0 -148
- package/dist/commands/run-command.js +0 -79
- package/dist/commands/screenshare.js +0 -307
- package/dist/commands/screenshare.test.js +0 -20
- package/dist/commands/session-id.js +0 -78
- package/dist/commands/session.js +0 -243
- package/dist/commands/share.js +0 -80
- package/dist/commands/tasks.js +0 -296
- package/dist/commands/types.js +0 -2
- package/dist/commands/undo-redo.js +0 -313
- package/dist/commands/unset-model.js +0 -116
- package/dist/commands/upgrade.js +0 -41
- package/dist/commands/user-command.js +0 -196
- package/dist/commands/verbosity.js +0 -124
- package/dist/commands/vscode.js +0 -295
- package/dist/commands/worktrees.js +0 -548
- package/dist/condense-memory.js +0 -33
- package/dist/config.js +0 -126
- package/dist/context-awareness-plugin.js +0 -357
- package/dist/context-awareness-plugin.test.js +0 -126
- package/dist/cpu-profiler.js +0 -211
- package/dist/cpu-profiler.test.js +0 -160
- package/dist/critique-utils.js +0 -95
- package/dist/database.js +0 -1074
- package/dist/debounce-timeout.js +0 -28
- package/dist/debounced-process-flush.js +0 -77
- package/dist/default-channel-provisioning.test.js +0 -149
- package/dist/discord-bot.js +0 -1409
- package/dist/discord-command-registration.js +0 -519
- package/dist/discord-command-registration.test.js +0 -17
- package/dist/discord-urls.js +0 -81
- package/dist/discord-utils.js +0 -789
- package/dist/discord-utils.test.js +0 -400
- package/dist/escape-backticks.test.js +0 -429
- package/dist/event-stream-real-capture.e2e.test.js +0 -533
- package/dist/eventsource-parser.test.js +0 -327
- package/dist/exec-async.js +0 -38
- package/dist/external-directory-permissions.e2e.test.js +0 -86
- package/dist/external-directory-project-deny.e2e.test.js +0 -70
- package/dist/external-opencode-sync.js +0 -620
- package/dist/external-opencode-sync.test.js +0 -206
- package/dist/extract-sdk-error-message.test.js +0 -13
- package/dist/format-tables.js +0 -728
- package/dist/format-tables.test.js +0 -915
- package/dist/forum-sync/config.js +0 -79
- package/dist/forum-sync/discord-operations.js +0 -157
- package/dist/forum-sync/index.js +0 -5
- package/dist/forum-sync/markdown.js +0 -110
- package/dist/forum-sync/sync-to-discord.js +0 -417
- package/dist/forum-sync/sync-to-files.js +0 -190
- package/dist/forum-sync/types.js +0 -53
- package/dist/forum-sync/watchers.js +0 -322
- package/dist/gateway-proxy-reconnect.e2e.test.js +0 -414
- package/dist/gateway-proxy.e2e.test.js +0 -488
- package/dist/genai-worker-wrapper.js +0 -111
- package/dist/genai-worker.js +0 -309
- package/dist/genai.js +0 -232
- package/dist/git-worktree-core.js +0 -461
- package/dist/guild-categories.test.js +0 -225
- package/dist/heap-monitor.js +0 -122
- package/dist/hrana-server.js +0 -322
- package/dist/hrana-server.test.js +0 -99
- package/dist/html-actions.js +0 -123
- package/dist/html-actions.test.js +0 -70
- package/dist/html-components.js +0 -115
- package/dist/html-components.test.js +0 -34
- package/dist/image-optimizer-plugin.js +0 -153
- package/dist/image-utils.js +0 -112
- package/dist/interaction-handler.js +0 -578
- package/dist/ipc-polling.js +0 -245
- package/dist/ipc-tools-plugin.js +0 -251
- package/dist/kimaki-digital-twin.e2e.test.js +0 -161
- package/dist/kimaki-opencode-plugin-loading.e2e.test.js +0 -158
- package/dist/kimaki-opencode-plugin.js +0 -33
- package/dist/kimaki-opencode-plugin.test.js +0 -126
- package/dist/kimaki-workspace-adaptor.js +0 -118
- package/dist/limit-heading-depth.js +0 -25
- package/dist/limit-heading-depth.test.js +0 -105
- package/dist/list-channel-threads.js +0 -163
- package/dist/list-channel-threads.test.js +0 -80
- package/dist/markdown.js +0 -455
- package/dist/markdown.test.js +0 -411
- package/dist/memory-overview-plugin.js +0 -123
- package/dist/message-formatting.js +0 -763
- package/dist/message-formatting.test.js +0 -1132
- package/dist/message-preprocessing.js +0 -441
- package/dist/oauth-rotation-shared.js +0 -253
- package/dist/onboarding-tutorial.js +0 -163
- package/dist/onboarding-welcome.js +0 -37
- package/dist/openai-auth-plugin.js +0 -125
- package/dist/openai-auth-state.js +0 -237
- package/dist/openai-realtime.js +0 -224
- package/dist/opencode-command-detection.js +0 -65
- package/dist/opencode-command-detection.test.js +0 -240
- package/dist/opencode-command.js +0 -181
- package/dist/opencode-command.test.js +0 -218
- package/dist/opencode-interrupt-plugin.js +0 -253
- package/dist/opencode-interrupt-plugin.test.js +0 -293
- package/dist/opencode.js +0 -1217
- package/dist/parse-permission-rules.test.js +0 -117
- package/dist/patch-text-parser.js +0 -97
- package/dist/plugin-logger.js +0 -105
- package/dist/plugin-opencode-client.js +0 -54
- package/dist/privacy-sanitizer.js +0 -105
- package/dist/project-add.test.js +0 -62
- package/dist/question-abort-clears-dropdown.e2e.test.js +0 -89
- package/dist/question-abort-resume.e2e.test.js +0 -100
- package/dist/question-abort-retry-text-before-dropdown.e2e.test.js +0 -150
- package/dist/question-text-before-dropdown.e2e.test.js +0 -52
- package/dist/queue-advanced-abort.e2e.test.js +0 -348
- package/dist/queue-advanced-action-buttons.e2e.test.js +0 -209
- package/dist/queue-advanced-e2e-setup.js +0 -1043
- package/dist/queue-advanced-footer.e2e.test.js +0 -286
- package/dist/queue-advanced-model-switch.e2e.test.js +0 -297
- package/dist/queue-advanced-permissions-typing.e2e.test.js +0 -189
- package/dist/queue-advanced-question.e2e.test.js +0 -266
- package/dist/queue-advanced-typing-interrupt.e2e.test.js +0 -113
- package/dist/queue-advanced-typing.e2e.test.js +0 -151
- package/dist/queue-delete-message.e2e.test.js +0 -75
- package/dist/queue-drain-after-interactive-ui.e2e.test.js +0 -120
- package/dist/queue-interrupt-drain.e2e.test.js +0 -246
- package/dist/queue-question-select-drain.e2e.test.js +0 -162
- package/dist/runtime-idle-sweeper.js +0 -52
- package/dist/runtime-lifecycle.e2e.test.js +0 -570
- package/dist/sentry.js +0 -23
- package/dist/session-handler/agent-utils.js +0 -66
- package/dist/session-handler/event-stream-state.js +0 -1217
- package/dist/session-handler/event-stream-state.test.js +0 -3034
- package/dist/session-handler/global-event-listener.js +0 -212
- package/dist/session-handler/model-utils.js +0 -311
- package/dist/session-handler/model-utils.test.js +0 -445
- package/dist/session-handler/opencode-session-event-log.js +0 -121
- package/dist/session-handler/thread-ingress.test.js +0 -41
- package/dist/session-handler/thread-runtime-state.js +0 -209
- package/dist/session-handler/thread-session-runtime-summary.test.js +0 -121
- package/dist/session-handler/thread-session-runtime.js +0 -4252
- package/dist/session-handler.js +0 -9
- package/dist/session-search.js +0 -219
- package/dist/session-search.test.js +0 -287
- package/dist/session-sleep.test.js +0 -224
- package/dist/session-title-rename.test.js +0 -128
- package/dist/skill-filter.js +0 -43
- package/dist/skill-filter.test.js +0 -86
- package/dist/startup-service.js +0 -153
- package/dist/startup-time.e2e.test.js +0 -297
- package/dist/system-message.js +0 -984
- package/dist/system-message.test.js +0 -1093
- package/dist/task-id-plugin.js +0 -16
- package/dist/task-runner.js +0 -554
- package/dist/task-schedule.js +0 -298
- package/dist/task-schedule.test.js +0 -366
- package/dist/test-utils.js +0 -359
- package/dist/thinking-utils.js +0 -45
- package/dist/thinking-utils.test.js +0 -35
- package/dist/thread-message-queue.e2e.test.js +0 -1155
- package/dist/tools.js +0 -357
- package/dist/undo-redo.e2e.test.js +0 -171
- package/dist/unnest-code-blocks.js +0 -146
- package/dist/unnest-code-blocks.test.js +0 -673
- package/dist/upgrade.js +0 -114
- package/dist/utils.js +0 -148
- package/dist/voice-attachment.js +0 -56
- package/dist/voice-handler.js +0 -726
- package/dist/voice-message.e2e.test.js +0 -1263
- package/dist/voice-routing-input.e2e.test.js +0 -195
- package/dist/voice-routing-question.e2e.test.js +0 -125
- package/dist/voice.test.js +0 -352
- package/dist/wait-session.js +0 -193
- package/dist/websockify.js +0 -69
- package/dist/worker-types.js +0 -4
- package/dist/worktree-clone-isolation.e2e.test.js +0 -188
- package/dist/worktree-lifecycle.e2e.test.js +0 -735
- package/dist/worktree-utils.js +0 -3
- package/dist/xai-auth-plugin.js +0 -238
- package/dist/xai-auth-state.js +0 -234
- package/dist/xai-auth-state.test.js +0 -183
- package/dist/xml.js +0 -92
- package/dist/xml.test.js +0 -32
- package/skills/bump-holocron-consumers/SKILL.md +0 -137
- package/skills/critique/SKILL.md +0 -112
- package/skills/egaki/SKILL.md +0 -86
- package/skills/errore/SKILL.md +0 -501
- package/skills/goke/SKILL.md +0 -695
- package/skills/holocron/SKILL.md +0 -942
- package/skills/lintcn/SKILL.md +0 -873
- package/skills/new-skill/SKILL.md +0 -339
- package/skills/npm-package/SKILL.md +0 -692
- package/skills/opensrc/SKILL.md +0 -95
- package/skills/playwriter/SKILL.md +0 -35
- package/skills/profano/SKILL.md +0 -33
- package/skills/readme.md +0 -20
- package/skills/sigillo/SKILL.md +0 -370
- package/skills/spiceflow/SKILL.md +0 -80
- package/skills/strada/SKILL.md +0 -104
- package/skills/termcast/SKILL.md +0 -133
- package/skills/tuistory/SKILL.md +0 -237
- package/skills/usecomputer/SKILL.md +0 -264
- package/skills/zele/SKILL.md +0 -81
- package/src/agent-model.e2e.test.ts +0 -1548
- package/src/ai-tool-to-genai.test.ts +0 -296
- package/src/ai-tool-to-genai.ts +0 -283
- package/src/ai-tool.ts +0 -39
- package/src/anthropic-account-identity.test.ts +0 -52
- package/src/anthropic-account-identity.ts +0 -96
- package/src/anthropic-auth-plugin.test.ts +0 -135
- package/src/anthropic-auth-plugin.ts +0 -1180
- package/src/anthropic-auth-state.test.ts +0 -259
- package/src/anthropic-auth-state.ts +0 -272
- package/src/bash-tool-schema-plugin.test.ts +0 -84
- package/src/bash-tool-schema-plugin.ts +0 -77
- package/src/bin.ts +0 -173
- package/src/bot-lifecycle.test.ts +0 -252
- package/src/btw-prefix-detection.test.ts +0 -104
- package/src/btw-prefix-detection.ts +0 -19
- package/src/cache-drift-plugin.ts +0 -249
- package/src/cache-rewrite.test.ts +0 -49
- package/src/cache-rewrite.ts +0 -96
- package/src/channel-management.ts +0 -494
- package/src/cli-commands/bot.ts +0 -374
- package/src/cli-commands/maintenance.ts +0 -237
- package/src/cli-commands/misc.ts +0 -208
- package/src/cli-commands/project.ts +0 -680
- package/src/cli-commands/send.ts +0 -879
- package/src/cli-commands/session.ts +0 -1181
- package/src/cli-commands/task.ts +0 -358
- package/src/cli-commands/thread.ts +0 -86
- package/src/cli-commands/user.ts +0 -195
- package/src/cli-parsing.test.ts +0 -305
- package/src/cli-runner.test.ts +0 -129
- package/src/cli-runner.ts +0 -2141
- package/src/cli-send-thread.e2e.test.ts +0 -609
- package/src/cloudflare-transcription.ts +0 -76
- package/src/commands/abort.ts +0 -113
- package/src/commands/action-buttons.ts +0 -371
- package/src/commands/add-project.ts +0 -146
- package/src/commands/agent.ts +0 -911
- package/src/commands/ask-question.test.ts +0 -177
- package/src/commands/ask-question.ts +0 -532
- package/src/commands/btw.ts +0 -246
- package/src/commands/compact.ts +0 -154
- package/src/commands/context-usage.ts +0 -208
- package/src/commands/create-new-project.ts +0 -203
- package/src/commands/diff.ts +0 -91
- package/src/commands/file-upload.ts +0 -398
- package/src/commands/fork-subagent.ts +0 -262
- package/src/commands/fork.ts +0 -388
- package/src/commands/gemini-apikey.ts +0 -205
- package/src/commands/last-sessions.ts +0 -176
- package/src/commands/login.ts +0 -1182
- package/src/commands/mcp.ts +0 -307
- package/src/commands/memory-snapshot.ts +0 -30
- package/src/commands/mention-mode.ts +0 -66
- package/src/commands/merge-worktree.ts +0 -282
- package/src/commands/model-variant.ts +0 -522
- package/src/commands/model.ts +0 -1310
- package/src/commands/multioauth.ts +0 -508
- package/src/commands/new-worktree.ts +0 -832
- package/src/commands/paginated-select.ts +0 -81
- package/src/commands/permissions.ts +0 -458
- package/src/commands/queue.test.ts +0 -19
- package/src/commands/queue.ts +0 -455
- package/src/commands/remove-project.ts +0 -152
- package/src/commands/restart-opencode-server.ts +0 -173
- package/src/commands/resume.ts +0 -229
- package/src/commands/run-command.ts +0 -123
- package/src/commands/screenshare.test.ts +0 -30
- package/src/commands/screenshare.ts +0 -388
- package/src/commands/session-id.ts +0 -109
- package/src/commands/session.ts +0 -311
- package/src/commands/share.ts +0 -106
- package/src/commands/tasks.ts +0 -399
- package/src/commands/types.ts +0 -25
- package/src/commands/undo-redo.ts +0 -394
- package/src/commands/unset-model.ts +0 -152
- package/src/commands/upgrade.ts +0 -51
- package/src/commands/user-command.ts +0 -260
- package/src/commands/verbosity.ts +0 -172
- package/src/commands/vscode.ts +0 -378
- package/src/commands/worktrees.ts +0 -762
- package/src/condense-memory.ts +0 -36
- package/src/config.ts +0 -147
- package/src/context-awareness-plugin.test.ts +0 -144
- package/src/context-awareness-plugin.ts +0 -508
- package/src/cpu-profiler.test.ts +0 -183
- package/src/cpu-profiler.ts +0 -293
- package/src/critique-utils.ts +0 -139
- package/src/database.ts +0 -1484
- package/src/debounce-timeout.ts +0 -43
- package/src/debounced-process-flush.ts +0 -104
- package/src/default-channel-provisioning.test.ts +0 -156
- package/src/discord-bot.ts +0 -1836
- package/src/discord-command-registration.test.ts +0 -20
- package/src/discord-command-registration.ts +0 -704
- package/src/discord-urls.ts +0 -88
- package/src/discord-utils.test.ts +0 -470
- package/src/discord-utils.ts +0 -1079
- package/src/escape-backticks.test.ts +0 -469
- package/src/event-stream-real-capture.e2e.test.ts +0 -692
- package/src/eventsource-parser.test.ts +0 -351
- package/src/exec-async.ts +0 -44
- package/src/external-directory-permissions.e2e.test.ts +0 -103
- package/src/external-directory-project-deny.e2e.test.ts +0 -84
- package/src/external-opencode-sync.test.ts +0 -248
- package/src/external-opencode-sync.ts +0 -867
- package/src/extract-sdk-error-message.test.ts +0 -18
- package/src/format-tables.test.ts +0 -988
- package/src/format-tables.ts +0 -1031
- package/src/forum-sync/config.ts +0 -92
- package/src/forum-sync/discord-operations.ts +0 -245
- package/src/forum-sync/index.ts +0 -9
- package/src/forum-sync/markdown.ts +0 -172
- package/src/forum-sync/sync-to-discord.ts +0 -595
- package/src/forum-sync/sync-to-files.ts +0 -294
- package/src/forum-sync/types.ts +0 -175
- package/src/forum-sync/watchers.ts +0 -474
- package/src/gateway-proxy-reconnect.e2e.test.ts +0 -553
- package/src/gateway-proxy.e2e.test.ts +0 -648
- package/src/genai-worker-wrapper.ts +0 -164
- package/src/genai-worker.ts +0 -385
- package/src/genai.ts +0 -318
- package/src/git-worktree-core.ts +0 -616
- package/src/guild-categories.test.ts +0 -260
- package/src/heap-monitor.ts +0 -152
- package/src/hrana-server.test.ts +0 -130
- package/src/hrana-server.ts +0 -399
- package/src/html-actions.test.ts +0 -87
- package/src/html-actions.ts +0 -174
- package/src/html-components.test.ts +0 -38
- package/src/html-components.ts +0 -177
- package/src/image-optimizer-plugin.ts +0 -194
- package/src/image-utils.ts +0 -150
- package/src/interaction-handler.ts +0 -775
- package/src/ipc-polling.ts +0 -325
- package/src/ipc-tools-plugin.ts +0 -306
- package/src/kimaki-digital-twin.e2e.test.ts +0 -199
- package/src/kimaki-opencode-plugin-loading.e2e.test.ts +0 -208
- package/src/kimaki-opencode-plugin.test.ts +0 -142
- package/src/kimaki-opencode-plugin.ts +0 -34
- package/src/kimaki-workspace-adaptor.ts +0 -144
- package/src/limit-heading-depth.test.ts +0 -116
- package/src/limit-heading-depth.ts +0 -26
- package/src/list-channel-threads.test.ts +0 -90
- package/src/list-channel-threads.ts +0 -252
- package/src/markdown.test.ts +0 -498
- package/src/markdown.ts +0 -577
- package/src/memory-overview-plugin.ts +0 -159
- package/src/message-formatting.test.ts +0 -1401
- package/src/message-formatting.ts +0 -972
- package/src/message-preprocessing.ts +0 -579
- package/src/oauth-rotation-shared.ts +0 -332
- package/src/onboarding-tutorial.ts +0 -167
- package/src/onboarding-welcome.ts +0 -49
- package/src/openai-auth-plugin.ts +0 -158
- package/src/openai-auth-state.ts +0 -297
- package/src/openai-realtime.ts +0 -358
- package/src/opencode-command-detection.test.ts +0 -307
- package/src/opencode-command-detection.ts +0 -76
- package/src/opencode-command.test.ts +0 -290
- package/src/opencode-command.ts +0 -251
- package/src/opencode-interrupt-plugin.test.ts +0 -419
- package/src/opencode-interrupt-plugin.ts +0 -306
- package/src/opencode.ts +0 -1590
- package/src/parse-permission-rules.test.ts +0 -127
- package/src/patch-text-parser.ts +0 -107
- package/src/plugin-logger.ts +0 -139
- package/src/plugin-opencode-client.ts +0 -71
- package/src/privacy-sanitizer.ts +0 -142
- package/src/project-add.test.ts +0 -80
- package/src/question-abort-clears-dropdown.e2e.test.ts +0 -109
- package/src/question-abort-resume.e2e.test.ts +0 -121
- package/src/question-abort-retry-text-before-dropdown.e2e.test.ts +0 -172
- package/src/question-text-before-dropdown.e2e.test.ts +0 -67
- package/src/queue-advanced-abort.e2e.test.ts +0 -449
- package/src/queue-advanced-action-buttons.e2e.test.ts +0 -271
- package/src/queue-advanced-e2e-setup.ts +0 -1164
- package/src/queue-advanced-footer.e2e.test.ts +0 -357
- package/src/queue-advanced-model-switch.e2e.test.ts +0 -382
- package/src/queue-advanced-permissions-typing.e2e.test.ts +0 -256
- package/src/queue-advanced-question.e2e.test.ts +0 -322
- package/src/queue-advanced-typing-interrupt.e2e.test.ts +0 -147
- package/src/queue-advanced-typing.e2e.test.ts +0 -199
- package/src/queue-delete-message.e2e.test.ts +0 -102
- package/src/queue-drain-after-interactive-ui.e2e.test.ts +0 -152
- package/src/queue-interrupt-drain.e2e.test.ts +0 -288
- package/src/queue-question-select-drain.e2e.test.ts +0 -206
- package/src/runtime-idle-sweeper.ts +0 -76
- package/src/runtime-lifecycle.e2e.test.ts +0 -714
- package/src/schema.sql +0 -251
- package/src/sentry.ts +0 -26
- package/src/session-handler/agent-utils.ts +0 -99
- package/src/session-handler/event-stream-fixtures/real-session-action-buttons.jsonl +0 -45
- package/src/session-handler/event-stream-fixtures/real-session-footer-suppressed-on-pre-idle-interrupt.jsonl +0 -40
- package/src/session-handler/event-stream-fixtures/real-session-permission-external-file.jsonl +0 -23
- package/src/session-handler/event-stream-fixtures/real-session-task-normal.jsonl +0 -22
- package/src/session-handler/event-stream-fixtures/real-session-task-three-parallel-sleeps.jsonl +0 -277
- package/src/session-handler/event-stream-fixtures/real-session-task-user-interruption.jsonl +0 -46
- package/src/session-handler/event-stream-fixtures/session-abort-after-idle-race.jsonl +0 -21
- package/src/session-handler/event-stream-fixtures/session-concurrent-messages-serialized.jsonl +0 -56
- package/src/session-handler/event-stream-fixtures/session-explicit-abort.jsonl +0 -44
- package/src/session-handler/event-stream-fixtures/session-normal-completion.jsonl +0 -29
- package/src/session-handler/event-stream-fixtures/session-tool-call-noisy-stream.jsonl +0 -29
- package/src/session-handler/event-stream-fixtures/session-two-completions-same-session.jsonl +0 -50
- package/src/session-handler/event-stream-fixtures/session-user-interruption.jsonl +0 -59
- package/src/session-handler/event-stream-fixtures/session-voice-queued-followup.jsonl +0 -52
- package/src/session-handler/event-stream-state.test.ts +0 -3304
- package/src/session-handler/event-stream-state.ts +0 -1773
- package/src/session-handler/global-event-listener.ts +0 -258
- package/src/session-handler/model-utils.test.ts +0 -537
- package/src/session-handler/model-utils.ts +0 -489
- package/src/session-handler/opencode-session-event-log.ts +0 -159
- package/src/session-handler/thread-ingress.test.ts +0 -54
- package/src/session-handler/thread-runtime-state.ts +0 -351
- package/src/session-handler/thread-session-runtime-summary.test.ts +0 -169
- package/src/session-handler/thread-session-runtime.ts +0 -5608
- package/src/session-handler.ts +0 -15
- package/src/session-search.test.ts +0 -331
- package/src/session-search.ts +0 -382
- package/src/session-sleep.test.ts +0 -294
- package/src/session-title-rename.test.ts +0 -186
- package/src/skill-filter.test.ts +0 -110
- package/src/skill-filter.ts +0 -63
- package/src/startup-service.ts +0 -200
- package/src/startup-time.e2e.test.ts +0 -377
- package/src/system-message.test.ts +0 -1176
- package/src/system-message.ts +0 -1179
- package/src/task-id-plugin.ts +0 -17
- package/src/task-runner.ts +0 -768
- package/src/task-schedule.test.ts +0 -424
- package/src/task-schedule.ts +0 -470
- package/src/test-utils.ts +0 -506
- package/src/thinking-utils.test.ts +0 -46
- package/src/thinking-utils.ts +0 -82
- package/src/thread-message-queue.e2e.test.ts +0 -1395
- package/src/tools.ts +0 -430
- package/src/undici.d.ts +0 -12
- package/src/undo-redo.e2e.test.ts +0 -219
- package/src/unnest-code-blocks.test.ts +0 -713
- package/src/unnest-code-blocks.ts +0 -185
- package/src/upgrade.ts +0 -127
- package/src/utils.ts +0 -216
- package/src/voice-attachment.ts +0 -79
- package/src/voice-handler.ts +0 -999
- package/src/voice-message.e2e.test.ts +0 -1524
- package/src/voice-routing-input.e2e.test.ts +0 -203
- package/src/voice-routing-question.e2e.test.ts +0 -131
- package/src/voice.test.ts +0 -415
- package/src/wait-session.ts +0 -291
- package/src/websockify.ts +0 -101
- package/src/worker-types.ts +0 -64
- package/src/worktree-clone-isolation.e2e.test.ts +0 -213
- package/src/worktree-lifecycle.e2e.test.ts +0 -900
- package/src/worktree-utils.ts +0 -4
- package/src/xai-auth-plugin.ts +0 -303
- package/src/xai-auth-state.test.ts +0 -224
- package/src/xai-auth-state.ts +0 -294
- package/src/xml.test.ts +0 -38
- package/src/xml.ts +0 -121
|
@@ -1,1401 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
import { afterEach, describe, test, expect } from 'vitest'
|
|
4
|
-
import { asDiscordQuote, asSubtext, batchChunksForDiscord, collectSessionChunks, formatBashToolTitle, formatPart, formatTaskToolTitle, formatTodoList, getTextAttachments, planAssistantTurnFlush, quotedTextFitsOneDiscordMessage, serializeEmbeds, serializePoll, serializeMessageSnapshots, sessionPartContent, shouldLeadWithBlankLine, TEXT_ATTACHMENT_INLINE_LIMIT_BYTES } from './message-formatting.js'
|
|
5
|
-
import { getDataDir } from './config.js'
|
|
6
|
-
import type { Collection, Embed, Message, MessageSnapshot, Poll } from 'discord.js'
|
|
7
|
-
import type { Part } from '@opencode-ai/sdk/v2'
|
|
8
|
-
|
|
9
|
-
describe('formatPart', () => {
|
|
10
|
-
test('callout text is returned without a diamond prefix', () => {
|
|
11
|
-
const part: Part = {
|
|
12
|
-
id: 'test',
|
|
13
|
-
type: 'text',
|
|
14
|
-
sessionID: 'ses_test',
|
|
15
|
-
messageID: 'msg_test',
|
|
16
|
-
text: `<callout accent="#ef4444">\n## Top priority\n- **Stripe dispute** deadline\n</callout>`,
|
|
17
|
-
}
|
|
18
|
-
expect(formatPart(part)).toMatchInlineSnapshot(`
|
|
19
|
-
"<callout accent="#ef4444">
|
|
20
|
-
## Top priority
|
|
21
|
-
- **Stripe dispute** deadline
|
|
22
|
-
</callout>"
|
|
23
|
-
`)
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('regular text has no diamond prefix', () => {
|
|
27
|
-
const part: Part = {
|
|
28
|
-
id: 'test',
|
|
29
|
-
type: 'text',
|
|
30
|
-
sessionID: 'ses_test',
|
|
31
|
-
messageID: 'msg_test',
|
|
32
|
-
text: 'hello world',
|
|
33
|
-
}
|
|
34
|
-
expect(formatPart(part)).toMatchInlineSnapshot(`"hello world"`)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
test('heading text has no diamond prefix', () => {
|
|
38
|
-
const part: Part = {
|
|
39
|
-
id: 'test',
|
|
40
|
-
type: 'text',
|
|
41
|
-
sessionID: 'ses_test',
|
|
42
|
-
messageID: 'msg_test',
|
|
43
|
-
text: '## Summary\nDone.',
|
|
44
|
-
}
|
|
45
|
-
expect(formatPart(part)).toMatchInlineSnapshot(`
|
|
46
|
-
"## Summary
|
|
47
|
-
Done."
|
|
48
|
-
`)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
test('synthetic user context stays hidden', () => {
|
|
52
|
-
const part: Part = {
|
|
53
|
-
id: 'prt_branch',
|
|
54
|
-
type: 'text',
|
|
55
|
-
sessionID: 'ses_test',
|
|
56
|
-
messageID: 'msg_user',
|
|
57
|
-
text: '\n[current git branch is main]\n',
|
|
58
|
-
synthetic: true,
|
|
59
|
-
}
|
|
60
|
-
expect(formatPart(part)).toBe('')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
test('ignored plugin notices stay visible', () => {
|
|
64
|
-
const part: Part = {
|
|
65
|
-
id: 'prt_notice',
|
|
66
|
-
type: 'text',
|
|
67
|
-
sessionID: 'ses_test',
|
|
68
|
-
messageID: 'msg_notice',
|
|
69
|
-
text: 'Subrouter: Using openai/gpt-5.6-sol because xai/grok-4.6 is rate limited.',
|
|
70
|
-
ignored: true,
|
|
71
|
-
}
|
|
72
|
-
expect(formatPart(part)).toBe(
|
|
73
|
-
'Subrouter: Using openai/gpt-5.6-sol because xai/grok-4.6 is rate limited.',
|
|
74
|
-
)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
describe('asSubtext', () => {
|
|
80
|
-
test('prefixes every non-empty line', () => {
|
|
81
|
-
expect(asSubtext('hello\n\nworld')).toMatchInlineSnapshot(`
|
|
82
|
-
"-# hello
|
|
83
|
-
|
|
84
|
-
-# world"
|
|
85
|
-
`)
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
test('does not double-prefix', () => {
|
|
89
|
-
expect(asSubtext('-# already marked')).toMatchInlineSnapshot(`"-# already marked"`)
|
|
90
|
-
})
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
describe('asDiscordQuote', () => {
|
|
94
|
-
test('prefixes every line', () => {
|
|
95
|
-
expect(asDiscordQuote('hello\nworld')).toMatchInlineSnapshot(`
|
|
96
|
-
"> hello
|
|
97
|
-
> world"
|
|
98
|
-
`)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
test('does not double-quote already quoted text', () => {
|
|
102
|
-
expect(asDiscordQuote('> already quoted')).toMatchInlineSnapshot(`"> already quoted"`)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
test('prefixes blank lines and later lines, not only the first', () => {
|
|
106
|
-
expect(asDiscordQuote('I will open that file\n\nthen reply')).toMatchInlineSnapshot(`
|
|
107
|
-
"> I will open that file
|
|
108
|
-
>
|
|
109
|
-
> then reply"
|
|
110
|
-
`)
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
describe('quotedTextFitsOneDiscordMessage', () => {
|
|
115
|
-
test('accepts a short line', () => {
|
|
116
|
-
expect(quotedTextFitsOneDiscordMessage('done')).toBe(true)
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
test('rejects text whose quote would split across Discord messages', () => {
|
|
120
|
-
expect(quotedTextFitsOneDiscordMessage('x'.repeat(1999))).toBe(false)
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
describe('planAssistantTurnFlush', () => {
|
|
125
|
-
function text(id: string, body: string, ended = true) {
|
|
126
|
-
return { id, type: 'text', text: body, time: ended ? { end: 1 } : undefined }
|
|
127
|
-
}
|
|
128
|
-
function tool(id: string, name?: string) {
|
|
129
|
-
return { id, type: 'tool', tool: name }
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function plan(parts: Array<{ id: string; type: string; text?: string }>, mode: 'progress' | 'interactive' | 'final', throughPartId?: string) {
|
|
133
|
-
const result = planAssistantTurnFlush({ parts, mode, throughPartId })
|
|
134
|
-
return { send: result.send, hold: result.hold }
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
test('progress quotes completed short text immediately', () => {
|
|
138
|
-
expect(
|
|
139
|
-
plan([text('t1', 'status'), tool('tool1'), text('t2', 'answer')], 'progress'),
|
|
140
|
-
).toMatchInlineSnapshot(`
|
|
141
|
-
{
|
|
142
|
-
"hold": [],
|
|
143
|
-
"send": [
|
|
144
|
-
{
|
|
145
|
-
"id": "t1",
|
|
146
|
-
"quoteText": true,
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
"id": "tool1",
|
|
150
|
-
"quoteText": false,
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
"id": "t2",
|
|
154
|
-
"quoteText": true,
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
}
|
|
158
|
-
`)
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
test('progress quotes a lone completed short text', () => {
|
|
162
|
-
expect(plan([text('t1', 'answer')], 'progress')).toMatchInlineSnapshot(`
|
|
163
|
-
{
|
|
164
|
-
"hold": [],
|
|
165
|
-
"send": [
|
|
166
|
-
{
|
|
167
|
-
"id": "t1",
|
|
168
|
-
"quoteText": true,
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
}
|
|
172
|
-
`)
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
test('progress quotes completed short text before following tools', () => {
|
|
176
|
-
expect(
|
|
177
|
-
plan([text('t1', 'status'), tool('tool1')], 'progress'),
|
|
178
|
-
).toMatchInlineSnapshot(`
|
|
179
|
-
{
|
|
180
|
-
"hold": [],
|
|
181
|
-
"send": [
|
|
182
|
-
{
|
|
183
|
-
"id": "t1",
|
|
184
|
-
"quoteText": true,
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"id": "tool1",
|
|
188
|
-
"quoteText": false,
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
}
|
|
192
|
-
`)
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
test('progress quotes each short text that precedes a tool', () => {
|
|
196
|
-
expect(
|
|
197
|
-
plan([text('t1', 'status'), text('t2', 'next'), tool('tool1')], 'progress'),
|
|
198
|
-
).toMatchInlineSnapshot(`
|
|
199
|
-
{
|
|
200
|
-
"hold": [],
|
|
201
|
-
"send": [
|
|
202
|
-
{
|
|
203
|
-
"id": "t1",
|
|
204
|
-
"quoteText": true,
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"id": "t2",
|
|
208
|
-
"quoteText": true,
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"id": "tool1",
|
|
212
|
-
"quoteText": false,
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
}
|
|
216
|
-
`)
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
test('progress sends tools immediately while unfinished text is held', () => {
|
|
220
|
-
expect(
|
|
221
|
-
plan([text('t1', 'status', false), tool('tool1')], 'progress'),
|
|
222
|
-
).toMatchInlineSnapshot(`
|
|
223
|
-
{
|
|
224
|
-
"hold": [
|
|
225
|
-
{
|
|
226
|
-
"id": "t1",
|
|
227
|
-
"quoteText": false,
|
|
228
|
-
},
|
|
229
|
-
],
|
|
230
|
-
"send": [
|
|
231
|
-
{
|
|
232
|
-
"id": "tool1",
|
|
233
|
-
"quoteText": false,
|
|
234
|
-
},
|
|
235
|
-
],
|
|
236
|
-
}
|
|
237
|
-
`)
|
|
238
|
-
})
|
|
239
|
-
|
|
240
|
-
test('progress holds unfinished text only when nothing else is ready', () => {
|
|
241
|
-
expect(plan([text('t1', 'status', false)], 'progress')).toMatchInlineSnapshot(`
|
|
242
|
-
{
|
|
243
|
-
"hold": [
|
|
244
|
-
{
|
|
245
|
-
"id": "t1",
|
|
246
|
-
"quoteText": false,
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
"send": [],
|
|
250
|
-
}
|
|
251
|
-
`)
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
test('progress sends completed text and later tools while later text is still open', () => {
|
|
255
|
-
expect(
|
|
256
|
-
plan(
|
|
257
|
-
[text('t1', 'first'), text('t2', 'second', false), tool('tool1')],
|
|
258
|
-
'progress',
|
|
259
|
-
),
|
|
260
|
-
).toMatchInlineSnapshot(`
|
|
261
|
-
{
|
|
262
|
-
"hold": [
|
|
263
|
-
{
|
|
264
|
-
"id": "t2",
|
|
265
|
-
"quoteText": false,
|
|
266
|
-
},
|
|
267
|
-
],
|
|
268
|
-
"send": [
|
|
269
|
-
{
|
|
270
|
-
"id": "t1",
|
|
271
|
-
"quoteText": true,
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
"id": "tool1",
|
|
275
|
-
"quoteText": false,
|
|
276
|
-
},
|
|
277
|
-
],
|
|
278
|
-
}
|
|
279
|
-
`)
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
test('progress holds unfinished last text until it ends', () => {
|
|
283
|
-
expect(
|
|
284
|
-
plan([text('t1', 'first'), text('t2', 'second', false)], 'progress'),
|
|
285
|
-
).toMatchInlineSnapshot(`
|
|
286
|
-
{
|
|
287
|
-
"hold": [
|
|
288
|
-
{
|
|
289
|
-
"id": "t2",
|
|
290
|
-
"quoteText": false,
|
|
291
|
-
},
|
|
292
|
-
],
|
|
293
|
-
"send": [
|
|
294
|
-
{
|
|
295
|
-
"id": "t1",
|
|
296
|
-
"quoteText": true,
|
|
297
|
-
},
|
|
298
|
-
],
|
|
299
|
-
}
|
|
300
|
-
`)
|
|
301
|
-
})
|
|
302
|
-
|
|
303
|
-
test('final quotes earlier text and leaves the last text plain', () => {
|
|
304
|
-
expect(
|
|
305
|
-
plan([text('t1', 'status'), tool('tool1'), text('t2', 'done')], 'final'),
|
|
306
|
-
).toMatchInlineSnapshot(`
|
|
307
|
-
{
|
|
308
|
-
"hold": [],
|
|
309
|
-
"send": [
|
|
310
|
-
{
|
|
311
|
-
"id": "t1",
|
|
312
|
-
"quoteText": true,
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
"id": "tool1",
|
|
316
|
-
"quoteText": false,
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
"id": "t2",
|
|
320
|
-
"quoteText": false,
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
}
|
|
324
|
-
`)
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
test('final quotes short text before a tool', () => {
|
|
328
|
-
expect(
|
|
329
|
-
plan([text('t1', 'status'), tool('tool1')], 'final'),
|
|
330
|
-
).toMatchInlineSnapshot(`
|
|
331
|
-
{
|
|
332
|
-
"hold": [],
|
|
333
|
-
"send": [
|
|
334
|
-
{
|
|
335
|
-
"id": "t1",
|
|
336
|
-
"quoteText": true,
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
"id": "tool1",
|
|
340
|
-
"quoteText": false,
|
|
341
|
-
},
|
|
342
|
-
],
|
|
343
|
-
}
|
|
344
|
-
`)
|
|
345
|
-
})
|
|
346
|
-
|
|
347
|
-
test('interactive without throughPartId sends the last text unquoted', () => {
|
|
348
|
-
expect(
|
|
349
|
-
plan([text('t1', 'ask'), tool('question1', 'question')], 'interactive'),
|
|
350
|
-
).toMatchInlineSnapshot(`
|
|
351
|
-
{
|
|
352
|
-
"hold": [],
|
|
353
|
-
"send": [
|
|
354
|
-
{
|
|
355
|
-
"id": "t1",
|
|
356
|
-
"quoteText": false,
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
"id": "question1",
|
|
360
|
-
"quoteText": false,
|
|
361
|
-
},
|
|
362
|
-
],
|
|
363
|
-
}
|
|
364
|
-
`)
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
test('interactive leaves preceding text unquoted and flushes through the interactive tool', () => {
|
|
368
|
-
expect(
|
|
369
|
-
plan([text('t1', 'ask'), tool('question1', 'question'), text('t2', 'later')], 'interactive', 'question1'),
|
|
370
|
-
).toMatchInlineSnapshot(`
|
|
371
|
-
{
|
|
372
|
-
"hold": [
|
|
373
|
-
{
|
|
374
|
-
"id": "t2",
|
|
375
|
-
"quoteText": false,
|
|
376
|
-
},
|
|
377
|
-
],
|
|
378
|
-
"send": [
|
|
379
|
-
{
|
|
380
|
-
"id": "t1",
|
|
381
|
-
"quoteText": false,
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
"id": "question1",
|
|
385
|
-
"quoteText": false,
|
|
386
|
-
},
|
|
387
|
-
],
|
|
388
|
-
}
|
|
389
|
-
`)
|
|
390
|
-
})
|
|
391
|
-
|
|
392
|
-
test('progress does not quote earlier text longer than two lines', () => {
|
|
393
|
-
expect(
|
|
394
|
-
plan(
|
|
395
|
-
[
|
|
396
|
-
text('t1', 'line one\nline two\nline three'),
|
|
397
|
-
tool('tool1'),
|
|
398
|
-
text('t2', 'answer'),
|
|
399
|
-
],
|
|
400
|
-
'progress',
|
|
401
|
-
),
|
|
402
|
-
).toMatchInlineSnapshot(`
|
|
403
|
-
{
|
|
404
|
-
"hold": [],
|
|
405
|
-
"send": [
|
|
406
|
-
{
|
|
407
|
-
"id": "t1",
|
|
408
|
-
"quoteText": false,
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
"id": "tool1",
|
|
412
|
-
"quoteText": false,
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
"id": "t2",
|
|
416
|
-
"quoteText": true,
|
|
417
|
-
},
|
|
418
|
-
],
|
|
419
|
-
}
|
|
420
|
-
`)
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
test('progress still quotes two-line earlier text', () => {
|
|
424
|
-
expect(
|
|
425
|
-
plan(
|
|
426
|
-
[text('t1', 'line one\nline two'), tool('tool1'), text('t2', 'answer')],
|
|
427
|
-
'progress',
|
|
428
|
-
).send.find((entry) => entry.id === 't1'),
|
|
429
|
-
).toEqual({ id: 't1', quoteText: true })
|
|
430
|
-
})
|
|
431
|
-
|
|
432
|
-
test('progress keeps sleep-tool quote context after that tool is already sent', () => {
|
|
433
|
-
const parts = [text('t1', 'wait'), tool('sleep1', 'kimaki_sleep')]
|
|
434
|
-
expect(plan(parts, 'progress').send.find((entry) => entry.id === 't1')).toEqual({
|
|
435
|
-
id: 't1',
|
|
436
|
-
quoteText: false,
|
|
437
|
-
})
|
|
438
|
-
expect(plan([text('t1', 'wait')], 'progress').send.find((entry) => entry.id === 't1')).toEqual({
|
|
439
|
-
id: 't1',
|
|
440
|
-
quoteText: true,
|
|
441
|
-
})
|
|
442
|
-
})
|
|
443
|
-
|
|
444
|
-
test('progress does not quote earlier text before an interactive tool', () => {
|
|
445
|
-
expect(
|
|
446
|
-
plan(
|
|
447
|
-
[text('t1', 'ask'), tool('question1', 'question'), text('t2', 'later')],
|
|
448
|
-
'progress',
|
|
449
|
-
).send.find((entry) => entry.id === 't1'),
|
|
450
|
-
).toEqual({ id: 't1', quoteText: false })
|
|
451
|
-
expect(
|
|
452
|
-
plan(
|
|
453
|
-
[text('t1', 'wait'), tool('sleep1', 'kimaki_sleep'), text('t2', 'later')],
|
|
454
|
-
'progress',
|
|
455
|
-
).send.find((entry) => entry.id === 't1'),
|
|
456
|
-
).toEqual({ id: 't1', quoteText: false })
|
|
457
|
-
expect(
|
|
458
|
-
plan(
|
|
459
|
-
[text('t1', 'choose'), tool('buttons1', 'kimaki_action_buttons'), text('t2', 'later')],
|
|
460
|
-
'progress',
|
|
461
|
-
).send.find((entry) => entry.id === 't1'),
|
|
462
|
-
).toEqual({ id: 't1', quoteText: false })
|
|
463
|
-
})
|
|
464
|
-
})
|
|
465
|
-
|
|
466
|
-
describe('shouldLeadWithBlankLine', () => {
|
|
467
|
-
test('never leads on the first part', () => {
|
|
468
|
-
expect(
|
|
469
|
-
shouldLeadWithBlankLine({ previousKind: undefined, nextKind: 'text' }),
|
|
470
|
-
).toBe(false)
|
|
471
|
-
expect(
|
|
472
|
-
shouldLeadWithBlankLine({ previousKind: undefined, nextKind: 'tool' }),
|
|
473
|
-
).toBe(false)
|
|
474
|
-
})
|
|
475
|
-
|
|
476
|
-
test('leads on both text and tool transitions', () => {
|
|
477
|
-
expect(
|
|
478
|
-
shouldLeadWithBlankLine({ previousKind: 'text', nextKind: 'tool' }),
|
|
479
|
-
).toBe(true)
|
|
480
|
-
expect(
|
|
481
|
-
shouldLeadWithBlankLine({ previousKind: 'tool', nextKind: 'text' }),
|
|
482
|
-
).toBe(true)
|
|
483
|
-
expect(
|
|
484
|
-
shouldLeadWithBlankLine({ previousKind: 'text', nextKind: 'text' }),
|
|
485
|
-
).toBe(false)
|
|
486
|
-
expect(
|
|
487
|
-
shouldLeadWithBlankLine({ previousKind: 'tool', nextKind: 'tool' }),
|
|
488
|
-
).toBe(false)
|
|
489
|
-
})
|
|
490
|
-
})
|
|
491
|
-
|
|
492
|
-
describe('sessionPartContent', () => {
|
|
493
|
-
test('leaves the first part unchanged', () => {
|
|
494
|
-
expect(
|
|
495
|
-
sessionPartContent({ content: 'hello', leadWithBlankLine: false }),
|
|
496
|
-
).toBe('hello')
|
|
497
|
-
})
|
|
498
|
-
|
|
499
|
-
test('prepends a newline on text and tool transitions', () => {
|
|
500
|
-
expect(
|
|
501
|
-
sessionPartContent({ content: '┣ bash ls', leadWithBlankLine: true }),
|
|
502
|
-
).toMatchInlineSnapshot(`
|
|
503
|
-
"
|
|
504
|
-
┣ bash ls"
|
|
505
|
-
`)
|
|
506
|
-
expect(
|
|
507
|
-
sessionPartContent({ content: 'done', leadWithBlankLine: true }),
|
|
508
|
-
).toMatchInlineSnapshot(`
|
|
509
|
-
"
|
|
510
|
-
done"
|
|
511
|
-
`)
|
|
512
|
-
})
|
|
513
|
-
})
|
|
514
|
-
|
|
515
|
-
describe('collectSessionChunks', () => {
|
|
516
|
-
function textPart({
|
|
517
|
-
id,
|
|
518
|
-
text,
|
|
519
|
-
messageID,
|
|
520
|
-
synthetic,
|
|
521
|
-
}: {
|
|
522
|
-
id: string
|
|
523
|
-
text: string
|
|
524
|
-
messageID: string
|
|
525
|
-
synthetic?: boolean
|
|
526
|
-
}): Part {
|
|
527
|
-
return {
|
|
528
|
-
id,
|
|
529
|
-
type: 'text',
|
|
530
|
-
sessionID: 'ses_test',
|
|
531
|
-
messageID,
|
|
532
|
-
text,
|
|
533
|
-
synthetic,
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
test('skips synthetic text parts', () => {
|
|
538
|
-
const { chunks } = collectSessionChunks({
|
|
539
|
-
messages: [
|
|
540
|
-
{
|
|
541
|
-
info: { role: 'assistant', id: 'msg_1', parentID: 'msg_user' },
|
|
542
|
-
parts: [
|
|
543
|
-
textPart({
|
|
544
|
-
id: 'branch',
|
|
545
|
-
text: '\n[current git branch is main]\n',
|
|
546
|
-
messageID: 'msg_1',
|
|
547
|
-
synthetic: true,
|
|
548
|
-
}),
|
|
549
|
-
textPart({ id: 't1', text: 'working', messageID: 'msg_1' }),
|
|
550
|
-
],
|
|
551
|
-
},
|
|
552
|
-
],
|
|
553
|
-
})
|
|
554
|
-
expect(chunks.map((chunk) => chunk.content)).toEqual(['> working'])
|
|
555
|
-
})
|
|
556
|
-
|
|
557
|
-
test('quotes short text throughout a turn', () => {
|
|
558
|
-
const { chunks } = collectSessionChunks({
|
|
559
|
-
messages: [
|
|
560
|
-
{
|
|
561
|
-
info: { role: 'assistant', id: 'msg_1', parentID: 'msg_user' },
|
|
562
|
-
parts: [textPart({ id: 't1', text: 'I will read it', messageID: 'msg_1' })],
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
info: { role: 'assistant', id: 'msg_2', parentID: 'msg_user' },
|
|
566
|
-
parts: [textPart({ id: 't2', text: 'done', messageID: 'msg_2' })],
|
|
567
|
-
},
|
|
568
|
-
],
|
|
569
|
-
})
|
|
570
|
-
expect(chunks.map((chunk) => chunk.content)).toMatchInlineSnapshot(`
|
|
571
|
-
[
|
|
572
|
-
"> I will read it",
|
|
573
|
-
"> done",
|
|
574
|
-
]
|
|
575
|
-
`)
|
|
576
|
-
})
|
|
577
|
-
|
|
578
|
-
test('quotes short text before a tool', () => {
|
|
579
|
-
const { chunks } = collectSessionChunks({
|
|
580
|
-
messages: [
|
|
581
|
-
{
|
|
582
|
-
info: { role: 'assistant', id: 'msg_1', parentID: 'msg_user' },
|
|
583
|
-
parts: [
|
|
584
|
-
textPart({ id: 't1', text: 'I will read it', messageID: 'msg_1' }),
|
|
585
|
-
{
|
|
586
|
-
id: 'tool1',
|
|
587
|
-
type: 'tool',
|
|
588
|
-
sessionID: 'ses_test',
|
|
589
|
-
messageID: 'msg_1',
|
|
590
|
-
tool: 'read',
|
|
591
|
-
callID: 'call_tool1',
|
|
592
|
-
state: { status: 'completed', input: {}, output: '', title: '', metadata: {}, time: { start: 0, end: 0 } },
|
|
593
|
-
},
|
|
594
|
-
],
|
|
595
|
-
},
|
|
596
|
-
],
|
|
597
|
-
})
|
|
598
|
-
expect(chunks.map((chunk) => chunk.content)).toEqual([
|
|
599
|
-
'> I will read it',
|
|
600
|
-
'-# ┣ read',
|
|
601
|
-
])
|
|
602
|
-
})
|
|
603
|
-
|
|
604
|
-
test('does not quote earlier text longer than two lines', () => {
|
|
605
|
-
const { chunks } = collectSessionChunks({
|
|
606
|
-
messages: [
|
|
607
|
-
{
|
|
608
|
-
info: { role: 'assistant', id: 'msg_1', parentID: 'msg_user' },
|
|
609
|
-
parts: [
|
|
610
|
-
textPart({
|
|
611
|
-
id: 't1',
|
|
612
|
-
text: 'line one\nline two\nline three',
|
|
613
|
-
messageID: 'msg_1',
|
|
614
|
-
}),
|
|
615
|
-
],
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
info: { role: 'assistant', id: 'msg_2', parentID: 'msg_user' },
|
|
619
|
-
parts: [textPart({ id: 't2', text: 'done', messageID: 'msg_2' })],
|
|
620
|
-
},
|
|
621
|
-
],
|
|
622
|
-
})
|
|
623
|
-
expect(chunks.map((chunk) => chunk.content)).toEqual([
|
|
624
|
-
'line one\nline two\nline three',
|
|
625
|
-
'> done',
|
|
626
|
-
])
|
|
627
|
-
})
|
|
628
|
-
|
|
629
|
-
test('does not quote text flushed before a question tool', () => {
|
|
630
|
-
const { chunks } = collectSessionChunks({
|
|
631
|
-
messages: [
|
|
632
|
-
{
|
|
633
|
-
info: { role: 'assistant', id: 'msg_1', parentID: 'msg_user' },
|
|
634
|
-
parts: [
|
|
635
|
-
textPart({ id: 't1', text: 'Pick one', messageID: 'msg_1' }),
|
|
636
|
-
{
|
|
637
|
-
id: 'q1',
|
|
638
|
-
type: 'tool',
|
|
639
|
-
sessionID: 'ses_test',
|
|
640
|
-
messageID: 'msg_1',
|
|
641
|
-
tool: 'question',
|
|
642
|
-
callID: 'call_q1',
|
|
643
|
-
state: { status: 'completed', input: {}, output: '', title: '', metadata: {}, time: { start: 0, end: 0 } },
|
|
644
|
-
},
|
|
645
|
-
textPart({ id: 't2', text: 'thanks', messageID: 'msg_1' }),
|
|
646
|
-
],
|
|
647
|
-
},
|
|
648
|
-
],
|
|
649
|
-
})
|
|
650
|
-
expect(chunks.map((chunk) => chunk.content)).toEqual(['Pick one', '> thanks'])
|
|
651
|
-
})
|
|
652
|
-
|
|
653
|
-
test('quotes within each user turn separately', () => {
|
|
654
|
-
const { chunks } = collectSessionChunks({
|
|
655
|
-
messages: [
|
|
656
|
-
{
|
|
657
|
-
info: { role: 'assistant', id: 'msg_1', parentID: 'msg_user_1' },
|
|
658
|
-
parts: [textPart({ id: 't1', text: 'first turn', messageID: 'msg_1' })],
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
info: { role: 'user', id: 'msg_user_2' },
|
|
662
|
-
parts: [],
|
|
663
|
-
},
|
|
664
|
-
{
|
|
665
|
-
info: { role: 'assistant', id: 'msg_2', parentID: 'msg_user_2' },
|
|
666
|
-
parts: [textPart({ id: 't2', text: 'looking', messageID: 'msg_2' })],
|
|
667
|
-
},
|
|
668
|
-
{
|
|
669
|
-
info: { role: 'assistant', id: 'msg_3', parentID: 'msg_user_2' },
|
|
670
|
-
parts: [textPart({ id: 't3', text: 'second turn done', messageID: 'msg_3' })],
|
|
671
|
-
},
|
|
672
|
-
],
|
|
673
|
-
})
|
|
674
|
-
expect(chunks.map((chunk) => chunk.content)).toMatchInlineSnapshot(`
|
|
675
|
-
[
|
|
676
|
-
"> first turn",
|
|
677
|
-
"> looking",
|
|
678
|
-
"> second turn done",
|
|
679
|
-
]
|
|
680
|
-
`)
|
|
681
|
-
})
|
|
682
|
-
})
|
|
683
|
-
|
|
684
|
-
describe('batchChunksForDiscord', () => {
|
|
685
|
-
test('does not merge text chunks with tool chunks', () => {
|
|
686
|
-
expect(
|
|
687
|
-
batchChunksForDiscord([
|
|
688
|
-
{ partIds: ['t1'], content: 'hello', kind: 'text' },
|
|
689
|
-
{ partIds: ['b1'], content: '┣ bash ls', kind: 'tool' },
|
|
690
|
-
{ partIds: ['t2'], content: 'done', kind: 'text' },
|
|
691
|
-
]),
|
|
692
|
-
).toMatchInlineSnapshot(`
|
|
693
|
-
[
|
|
694
|
-
{
|
|
695
|
-
"content": "hello",
|
|
696
|
-
"kind": "text",
|
|
697
|
-
"partIds": [
|
|
698
|
-
"t1",
|
|
699
|
-
],
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
"content": "┣ bash ls",
|
|
703
|
-
"kind": "tool",
|
|
704
|
-
"partIds": [
|
|
705
|
-
"b1",
|
|
706
|
-
],
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
"content": "done",
|
|
710
|
-
"kind": "text",
|
|
711
|
-
"partIds": [
|
|
712
|
-
"t2",
|
|
713
|
-
],
|
|
714
|
-
},
|
|
715
|
-
]
|
|
716
|
-
`)
|
|
717
|
-
})
|
|
718
|
-
})
|
|
719
|
-
|
|
720
|
-
describe('formatTaskToolTitle', () => {
|
|
721
|
-
function taskPart({
|
|
722
|
-
status,
|
|
723
|
-
input = {},
|
|
724
|
-
title = '',
|
|
725
|
-
sessionId,
|
|
726
|
-
}: {
|
|
727
|
-
status: 'running' | 'completed'
|
|
728
|
-
input?: { description?: string; subagent_type?: string }
|
|
729
|
-
title?: string
|
|
730
|
-
sessionId?: string
|
|
731
|
-
}): Extract<Part, { type: 'tool' }> {
|
|
732
|
-
const base = {
|
|
733
|
-
id: 'prt_task',
|
|
734
|
-
type: 'tool' as const,
|
|
735
|
-
tool: 'task',
|
|
736
|
-
callID: 'call_task',
|
|
737
|
-
sessionID: 'ses_parent',
|
|
738
|
-
messageID: 'msg_assistant',
|
|
739
|
-
}
|
|
740
|
-
if (status === 'completed') {
|
|
741
|
-
return {
|
|
742
|
-
...base,
|
|
743
|
-
state: {
|
|
744
|
-
status,
|
|
745
|
-
input,
|
|
746
|
-
output: '',
|
|
747
|
-
title,
|
|
748
|
-
metadata: sessionId ? { sessionId } : {},
|
|
749
|
-
time: { start: 1, end: 2 },
|
|
750
|
-
},
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
return {
|
|
754
|
-
...base,
|
|
755
|
-
state: {
|
|
756
|
-
status,
|
|
757
|
-
input,
|
|
758
|
-
title,
|
|
759
|
-
metadata: sessionId ? { sessionId } : {},
|
|
760
|
-
time: { start: 1 },
|
|
761
|
-
},
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
test('uses the running task title when OpenAI omits the description', () => {
|
|
766
|
-
expect(
|
|
767
|
-
formatTaskToolTitle(
|
|
768
|
-
taskPart({
|
|
769
|
-
status: 'running',
|
|
770
|
-
input: { subagent_type: 'general' },
|
|
771
|
-
title: 'Classify pending changes',
|
|
772
|
-
sessionId: 'ses_child',
|
|
773
|
-
}),
|
|
774
|
-
),
|
|
775
|
-
).toMatchInlineSnapshot(`"-# ┣ general **Classify pending changes**"`)
|
|
776
|
-
})
|
|
777
|
-
|
|
778
|
-
test('prefers input description on running parts', () => {
|
|
779
|
-
expect(
|
|
780
|
-
formatTaskToolTitle(
|
|
781
|
-
taskPart({
|
|
782
|
-
status: 'running',
|
|
783
|
-
input: { description: 'inspect repo', subagent_type: 'explore' },
|
|
784
|
-
title: 'ignored title',
|
|
785
|
-
sessionId: 'ses_child',
|
|
786
|
-
}),
|
|
787
|
-
),
|
|
788
|
-
).toMatchInlineSnapshot(`"-# ┣ explore **inspect repo**"`)
|
|
789
|
-
})
|
|
790
|
-
|
|
791
|
-
test('does not format completed parts so Discord does not post the line at the end', () => {
|
|
792
|
-
expect(
|
|
793
|
-
formatTaskToolTitle(
|
|
794
|
-
taskPart({
|
|
795
|
-
status: 'completed',
|
|
796
|
-
input: { subagent_type: 'general' },
|
|
797
|
-
title: 'Classify pending changes',
|
|
798
|
-
sessionId: 'ses_child',
|
|
799
|
-
}),
|
|
800
|
-
),
|
|
801
|
-
).toBe('')
|
|
802
|
-
})
|
|
803
|
-
|
|
804
|
-
test('shows queued task calls before the child session exists', () => {
|
|
805
|
-
expect(
|
|
806
|
-
formatTaskToolTitle(
|
|
807
|
-
taskPart({
|
|
808
|
-
status: 'running',
|
|
809
|
-
input: {
|
|
810
|
-
description: 'audit customer pages',
|
|
811
|
-
subagent_type: 'general',
|
|
812
|
-
},
|
|
813
|
-
}),
|
|
814
|
-
),
|
|
815
|
-
).toMatchInlineSnapshot(`"-# ┣ general **audit customer pages**"`)
|
|
816
|
-
})
|
|
817
|
-
})
|
|
818
|
-
|
|
819
|
-
describe('formatBashToolTitle', () => {
|
|
820
|
-
test('short single-line command shown in full', () => {
|
|
821
|
-
expect(formatBashToolTitle({ command: 'echo hello' })).toMatchInlineSnapshot(`" _echo hello_"`)
|
|
822
|
-
})
|
|
823
|
-
|
|
824
|
-
test('multiline command without description truncates to first line', () => {
|
|
825
|
-
expect(
|
|
826
|
-
formatBashToolTitle({ command: 'echo hello\necho world\necho done' }),
|
|
827
|
-
).toMatchInlineSnapshot(`" _echo hello…_"`)
|
|
828
|
-
})
|
|
829
|
-
|
|
830
|
-
test('long single-line command is truncated with ellipsis', () => {
|
|
831
|
-
const longCommand = 'a'.repeat(150)
|
|
832
|
-
const result = formatBashToolTitle({ command: longCommand })
|
|
833
|
-
expect(result).toContain('…')
|
|
834
|
-
expect(result.length).toBeLessThan(150)
|
|
835
|
-
})
|
|
836
|
-
|
|
837
|
-
test('description is preferred over truncated command when present', () => {
|
|
838
|
-
expect(
|
|
839
|
-
formatBashToolTitle({
|
|
840
|
-
command: 'echo hello\necho world',
|
|
841
|
-
description: 'Print greeting',
|
|
842
|
-
}),
|
|
843
|
-
).toMatchInlineSnapshot(`" _Print greeting_"`)
|
|
844
|
-
})
|
|
845
|
-
|
|
846
|
-
test('50-char single-line command is shown in full', () => {
|
|
847
|
-
const command = 'a'.repeat(50)
|
|
848
|
-
expect(formatBashToolTitle({ command, description: 'Ignored' })).toBe(
|
|
849
|
-
` _${command}_`,
|
|
850
|
-
)
|
|
851
|
-
})
|
|
852
|
-
|
|
853
|
-
test('51-char single-line command uses description', () => {
|
|
854
|
-
expect(
|
|
855
|
-
formatBashToolTitle({
|
|
856
|
-
command: 'a'.repeat(51),
|
|
857
|
-
description: 'Run long command',
|
|
858
|
-
}),
|
|
859
|
-
).toMatchInlineSnapshot(`" _Run long command_"`)
|
|
860
|
-
})
|
|
861
|
-
|
|
862
|
-
test('51-char single-line command uses summary when description is missing', () => {
|
|
863
|
-
expect(
|
|
864
|
-
formatBashToolTitle({
|
|
865
|
-
command: 'a'.repeat(51),
|
|
866
|
-
summary: 'Install packages',
|
|
867
|
-
}),
|
|
868
|
-
).toMatchInlineSnapshot(`" _Install packages_"`)
|
|
869
|
-
})
|
|
870
|
-
|
|
871
|
-
test('description wins over summary for long commands', () => {
|
|
872
|
-
expect(
|
|
873
|
-
formatBashToolTitle({
|
|
874
|
-
command: 'a'.repeat(51),
|
|
875
|
-
description: 'Preferred label',
|
|
876
|
-
summary: 'Ignored label',
|
|
877
|
-
}),
|
|
878
|
-
).toMatchInlineSnapshot(`" _Preferred label_"`)
|
|
879
|
-
})
|
|
880
|
-
|
|
881
|
-
test('stateTitle used as last resort', () => {
|
|
882
|
-
expect(
|
|
883
|
-
formatBashToolTitle({ command: '', stateTitle: 'Running tests' }),
|
|
884
|
-
).toMatchInlineSnapshot(`" _Running tests_"`)
|
|
885
|
-
})
|
|
886
|
-
|
|
887
|
-
test('empty inputs return empty string', () => {
|
|
888
|
-
expect(formatBashToolTitle({ command: '' })).toBe('')
|
|
889
|
-
})
|
|
890
|
-
|
|
891
|
-
test('leading blank line skipped, uses first meaningful line', () => {
|
|
892
|
-
expect(
|
|
893
|
-
formatBashToolTitle({ command: '\npnpm test\npnpm build' }),
|
|
894
|
-
).toMatchInlineSnapshot(`" _pnpm test…_"`)
|
|
895
|
-
})
|
|
896
|
-
|
|
897
|
-
test('whitespace-only first line skipped', () => {
|
|
898
|
-
expect(
|
|
899
|
-
formatBashToolTitle({ command: ' \npnpm test' }),
|
|
900
|
-
).toMatchInlineSnapshot(`" _pnpm test…_"`)
|
|
901
|
-
})
|
|
902
|
-
|
|
903
|
-
test('no description field (new opencode) with multiline command', () => {
|
|
904
|
-
// This is the exact scenario that was broken: opencode removed `description`
|
|
905
|
-
// from the bash tool schema, so multiline commands rendered as just "┣ bash"
|
|
906
|
-
const command = 'git diff HEAD~1 --stat && git log --oneline -5'
|
|
907
|
-
expect(formatBashToolTitle({ command: command + '\n' + 'echo done' })).toMatchInlineSnapshot(
|
|
908
|
-
`" _git diff HEAD\\~1 --stat && git log --oneline -5…_"`,
|
|
909
|
-
)
|
|
910
|
-
})
|
|
911
|
-
})
|
|
912
|
-
|
|
913
|
-
describe('formatTodoList', () => {
|
|
914
|
-
test('formats active todo with number, dot, and two spaces', () => {
|
|
915
|
-
const part: Part = {
|
|
916
|
-
id: 'test',
|
|
917
|
-
type: 'tool',
|
|
918
|
-
tool: 'todowrite',
|
|
919
|
-
sessionID: 'ses_test',
|
|
920
|
-
messageID: 'msg_test',
|
|
921
|
-
callID: 'call_test',
|
|
922
|
-
state: {
|
|
923
|
-
status: 'completed',
|
|
924
|
-
input: {
|
|
925
|
-
todos: [
|
|
926
|
-
{ content: 'First task', status: 'completed' },
|
|
927
|
-
{ content: 'Second task', status: 'in_progress' },
|
|
928
|
-
{ content: 'Third task', status: 'pending' },
|
|
929
|
-
],
|
|
930
|
-
},
|
|
931
|
-
output: '',
|
|
932
|
-
title: 'todowrite',
|
|
933
|
-
metadata: {},
|
|
934
|
-
time: { start: 0, end: 0 },
|
|
935
|
-
},
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
expect(formatTodoList(part)).toMatchInlineSnapshot(`"2. **second task**"`)
|
|
939
|
-
})
|
|
940
|
-
|
|
941
|
-
test('formats double digit todo numbers', () => {
|
|
942
|
-
const todos = Array.from({ length: 12 }, (_, i) => ({
|
|
943
|
-
content: `Task ${i + 1}`,
|
|
944
|
-
status: i === 11 ? 'in_progress' : 'completed',
|
|
945
|
-
}))
|
|
946
|
-
|
|
947
|
-
const part: Part = {
|
|
948
|
-
id: 'test',
|
|
949
|
-
type: 'tool',
|
|
950
|
-
tool: 'todowrite',
|
|
951
|
-
sessionID: 'ses_test',
|
|
952
|
-
messageID: 'msg_test',
|
|
953
|
-
callID: 'call_test',
|
|
954
|
-
state: {
|
|
955
|
-
status: 'completed',
|
|
956
|
-
input: { todos },
|
|
957
|
-
output: '',
|
|
958
|
-
title: 'todowrite',
|
|
959
|
-
metadata: {},
|
|
960
|
-
time: { start: 0, end: 0 },
|
|
961
|
-
},
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
expect(formatTodoList(part)).toMatchInlineSnapshot(`"12. **task 12**"`)
|
|
965
|
-
})
|
|
966
|
-
|
|
967
|
-
test('lowercases first letter of content', () => {
|
|
968
|
-
const part: Part = {
|
|
969
|
-
id: 'test',
|
|
970
|
-
type: 'tool',
|
|
971
|
-
tool: 'todowrite',
|
|
972
|
-
sessionID: 'ses_test',
|
|
973
|
-
messageID: 'msg_test',
|
|
974
|
-
callID: 'call_test',
|
|
975
|
-
state: {
|
|
976
|
-
status: 'completed',
|
|
977
|
-
input: {
|
|
978
|
-
todos: [{ content: 'Fix the bug', status: 'in_progress' }],
|
|
979
|
-
},
|
|
980
|
-
output: '',
|
|
981
|
-
title: 'todowrite',
|
|
982
|
-
metadata: {},
|
|
983
|
-
time: { start: 0, end: 0 },
|
|
984
|
-
},
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
expect(formatTodoList(part)).toMatchInlineSnapshot(`"1. **fix the bug**"`)
|
|
988
|
-
})
|
|
989
|
-
})
|
|
990
|
-
|
|
991
|
-
describe('serializeEmbeds', () => {
|
|
992
|
-
function fakeEmbed(data: {
|
|
993
|
-
title?: string
|
|
994
|
-
description?: string
|
|
995
|
-
url?: string
|
|
996
|
-
author?: { name: string }
|
|
997
|
-
footer?: { text: string }
|
|
998
|
-
fields?: Array<{ name: string; value: string; inline?: boolean }>
|
|
999
|
-
}): Embed {
|
|
1000
|
-
return {
|
|
1001
|
-
title: data.title ?? null,
|
|
1002
|
-
description: data.description ?? null,
|
|
1003
|
-
url: data.url ?? null,
|
|
1004
|
-
author: data.author ?? null,
|
|
1005
|
-
footer: data.footer ?? null,
|
|
1006
|
-
fields: data.fields ?? [],
|
|
1007
|
-
} as unknown as Embed
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
test('serializes a full embed with all fields', () => {
|
|
1011
|
-
const embeds = [
|
|
1012
|
-
fakeEmbed({
|
|
1013
|
-
author: { name: 'GitHub' },
|
|
1014
|
-
title: 'PR #42: Fix auth timeout',
|
|
1015
|
-
url: 'https://github.com/org/repo/pull/42',
|
|
1016
|
-
description: 'Fixes the retry logic so tokens refresh before expiry.',
|
|
1017
|
-
fields: [
|
|
1018
|
-
{ name: 'Status', value: 'Open' },
|
|
1019
|
-
{ name: 'Reviewers', value: 'alice, bob' },
|
|
1020
|
-
],
|
|
1021
|
-
footer: { text: 'Last updated 2h ago' },
|
|
1022
|
-
}),
|
|
1023
|
-
]
|
|
1024
|
-
expect(serializeEmbeds(embeds)).toMatchInlineSnapshot(`
|
|
1025
|
-
"<embed>
|
|
1026
|
-
Author: GitHub
|
|
1027
|
-
Title: PR #42: Fix auth timeout
|
|
1028
|
-
URL: https://github.com/org/repo/pull/42
|
|
1029
|
-
Fixes the retry logic so tokens refresh before expiry.
|
|
1030
|
-
Status: Open
|
|
1031
|
-
Reviewers: alice, bob
|
|
1032
|
-
Footer: Last updated 2h ago
|
|
1033
|
-
</embed>"
|
|
1034
|
-
`)
|
|
1035
|
-
})
|
|
1036
|
-
|
|
1037
|
-
test('serializes description-only embed (link preview)', () => {
|
|
1038
|
-
const embeds = [
|
|
1039
|
-
fakeEmbed({
|
|
1040
|
-
title: 'Example Site',
|
|
1041
|
-
url: 'https://example.com',
|
|
1042
|
-
description: 'An example website for testing.',
|
|
1043
|
-
}),
|
|
1044
|
-
]
|
|
1045
|
-
expect(serializeEmbeds(embeds)).toMatchInlineSnapshot(`
|
|
1046
|
-
"<embed>
|
|
1047
|
-
Title: Example Site
|
|
1048
|
-
URL: https://example.com
|
|
1049
|
-
An example website for testing.
|
|
1050
|
-
</embed>"
|
|
1051
|
-
`)
|
|
1052
|
-
})
|
|
1053
|
-
|
|
1054
|
-
test('returns empty string for no embeds', () => {
|
|
1055
|
-
expect(serializeEmbeds([])).toBe('')
|
|
1056
|
-
})
|
|
1057
|
-
|
|
1058
|
-
test('skips embeds with no text content', () => {
|
|
1059
|
-
// An embed with only an image and no text fields
|
|
1060
|
-
const embeds = [fakeEmbed({})]
|
|
1061
|
-
expect(serializeEmbeds(embeds)).toBe('')
|
|
1062
|
-
})
|
|
1063
|
-
|
|
1064
|
-
test('serializes multiple embeds', () => {
|
|
1065
|
-
const embeds = [
|
|
1066
|
-
fakeEmbed({ title: 'First', description: 'one' }),
|
|
1067
|
-
fakeEmbed({ title: 'Second', description: 'two' }),
|
|
1068
|
-
]
|
|
1069
|
-
expect(serializeEmbeds(embeds)).toMatchInlineSnapshot(`
|
|
1070
|
-
"<embed>
|
|
1071
|
-
Title: First
|
|
1072
|
-
one
|
|
1073
|
-
</embed>
|
|
1074
|
-
|
|
1075
|
-
<embed>
|
|
1076
|
-
Title: Second
|
|
1077
|
-
two
|
|
1078
|
-
</embed>"
|
|
1079
|
-
`)
|
|
1080
|
-
})
|
|
1081
|
-
})
|
|
1082
|
-
|
|
1083
|
-
// Helper to create a fake Map-like Collection for tests
|
|
1084
|
-
function fakeCollection<K, V>(entries: [K, V][]): Collection<K, V> {
|
|
1085
|
-
const map = new Map(entries)
|
|
1086
|
-
return {
|
|
1087
|
-
size: map.size,
|
|
1088
|
-
[Symbol.iterator]: map[Symbol.iterator].bind(map),
|
|
1089
|
-
} as unknown as Collection<K, V>
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
describe('serializePoll', () => {
|
|
1093
|
-
function fakePoll(data: {
|
|
1094
|
-
question: string
|
|
1095
|
-
answers: Array<{ id: number; text: string | null }>
|
|
1096
|
-
}): Poll {
|
|
1097
|
-
return {
|
|
1098
|
-
question: { text: data.question },
|
|
1099
|
-
answers: fakeCollection(
|
|
1100
|
-
data.answers.map((a) => [a.id, { text: a.text }]),
|
|
1101
|
-
),
|
|
1102
|
-
} as unknown as Poll
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
test('serializes a poll with question and answers', () => {
|
|
1106
|
-
const poll = fakePoll({
|
|
1107
|
-
question: 'Which framework?',
|
|
1108
|
-
answers: [
|
|
1109
|
-
{ id: 1, text: 'React' },
|
|
1110
|
-
{ id: 2, text: 'Vue' },
|
|
1111
|
-
{ id: 3, text: 'Svelte' },
|
|
1112
|
-
],
|
|
1113
|
-
})
|
|
1114
|
-
expect(serializePoll(poll)).toMatchInlineSnapshot(`
|
|
1115
|
-
"<poll>
|
|
1116
|
-
Question: Which framework?
|
|
1117
|
-
- React
|
|
1118
|
-
- Vue
|
|
1119
|
-
- Svelte
|
|
1120
|
-
</poll>"
|
|
1121
|
-
`)
|
|
1122
|
-
})
|
|
1123
|
-
|
|
1124
|
-
test('returns empty string for null poll', () => {
|
|
1125
|
-
expect(serializePoll(null)).toBe('')
|
|
1126
|
-
})
|
|
1127
|
-
|
|
1128
|
-
test('skips answers with no text', () => {
|
|
1129
|
-
const poll = fakePoll({
|
|
1130
|
-
question: 'Pick one',
|
|
1131
|
-
answers: [
|
|
1132
|
-
{ id: 1, text: 'Option A' },
|
|
1133
|
-
{ id: 2, text: null },
|
|
1134
|
-
],
|
|
1135
|
-
})
|
|
1136
|
-
expect(serializePoll(poll)).toMatchInlineSnapshot(`
|
|
1137
|
-
"<poll>
|
|
1138
|
-
Question: Pick one
|
|
1139
|
-
- Option A
|
|
1140
|
-
</poll>"
|
|
1141
|
-
`)
|
|
1142
|
-
})
|
|
1143
|
-
})
|
|
1144
|
-
|
|
1145
|
-
describe('serializeMessageSnapshots', () => {
|
|
1146
|
-
function fakeSnapshot(data: {
|
|
1147
|
-
content?: string
|
|
1148
|
-
embeds?: Embed[]
|
|
1149
|
-
}): MessageSnapshot {
|
|
1150
|
-
return {
|
|
1151
|
-
content: data.content ?? '',
|
|
1152
|
-
embeds: data.embeds ?? [],
|
|
1153
|
-
} as unknown as MessageSnapshot
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
function fakeEmbed(data: {
|
|
1157
|
-
title?: string
|
|
1158
|
-
description?: string
|
|
1159
|
-
url?: string
|
|
1160
|
-
author?: { name: string }
|
|
1161
|
-
footer?: { text: string }
|
|
1162
|
-
fields?: Array<{ name: string; value: string }>
|
|
1163
|
-
}): Embed {
|
|
1164
|
-
return {
|
|
1165
|
-
title: data.title ?? null,
|
|
1166
|
-
description: data.description ?? null,
|
|
1167
|
-
url: data.url ?? null,
|
|
1168
|
-
author: data.author ?? null,
|
|
1169
|
-
footer: data.footer ?? null,
|
|
1170
|
-
fields: data.fields ?? [],
|
|
1171
|
-
} as unknown as Embed
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
test('serializes a forwarded message with content', () => {
|
|
1175
|
-
const snapshots = fakeCollection<string, MessageSnapshot>([
|
|
1176
|
-
['1', fakeSnapshot({ content: 'Hello from another channel' })],
|
|
1177
|
-
])
|
|
1178
|
-
expect(serializeMessageSnapshots(snapshots)).toMatchInlineSnapshot(`
|
|
1179
|
-
"<forwarded-message>
|
|
1180
|
-
Hello from another channel
|
|
1181
|
-
</forwarded-message>"
|
|
1182
|
-
`)
|
|
1183
|
-
})
|
|
1184
|
-
|
|
1185
|
-
test('serializes forwarded message with content and embeds', () => {
|
|
1186
|
-
const snapshots = fakeCollection<string, MessageSnapshot>([
|
|
1187
|
-
[
|
|
1188
|
-
'1',
|
|
1189
|
-
fakeSnapshot({
|
|
1190
|
-
content: 'Check this out',
|
|
1191
|
-
embeds: [fakeEmbed({ title: 'Link Preview', description: 'A cool site' })],
|
|
1192
|
-
}),
|
|
1193
|
-
],
|
|
1194
|
-
])
|
|
1195
|
-
expect(serializeMessageSnapshots(snapshots)).toMatchInlineSnapshot(`
|
|
1196
|
-
"<forwarded-message>
|
|
1197
|
-
Check this out
|
|
1198
|
-
|
|
1199
|
-
<embed>
|
|
1200
|
-
Title: Link Preview
|
|
1201
|
-
A cool site
|
|
1202
|
-
</embed>
|
|
1203
|
-
</forwarded-message>"
|
|
1204
|
-
`)
|
|
1205
|
-
})
|
|
1206
|
-
|
|
1207
|
-
test('returns empty string for no snapshots', () => {
|
|
1208
|
-
const empty = fakeCollection<string, MessageSnapshot>([])
|
|
1209
|
-
expect(serializeMessageSnapshots(empty)).toBe('')
|
|
1210
|
-
})
|
|
1211
|
-
|
|
1212
|
-
test('skips snapshots with no content', () => {
|
|
1213
|
-
const snapshots = fakeCollection<string, MessageSnapshot>([
|
|
1214
|
-
['1', fakeSnapshot({})],
|
|
1215
|
-
])
|
|
1216
|
-
expect(serializeMessageSnapshots(snapshots)).toBe('')
|
|
1217
|
-
})
|
|
1218
|
-
|
|
1219
|
-
test('serializes multiple forwarded messages', () => {
|
|
1220
|
-
const snapshots = fakeCollection<string, MessageSnapshot>([
|
|
1221
|
-
['1', fakeSnapshot({ content: 'First forwarded' })],
|
|
1222
|
-
['2', fakeSnapshot({ content: 'Second forwarded' })],
|
|
1223
|
-
])
|
|
1224
|
-
expect(serializeMessageSnapshots(snapshots)).toMatchInlineSnapshot(`
|
|
1225
|
-
"<forwarded-message>
|
|
1226
|
-
First forwarded
|
|
1227
|
-
</forwarded-message>
|
|
1228
|
-
|
|
1229
|
-
<forwarded-message>
|
|
1230
|
-
Second forwarded
|
|
1231
|
-
</forwarded-message>"
|
|
1232
|
-
`)
|
|
1233
|
-
})
|
|
1234
|
-
})
|
|
1235
|
-
|
|
1236
|
-
describe('getTextAttachments', () => {
|
|
1237
|
-
const originalFetch = globalThis.fetch
|
|
1238
|
-
|
|
1239
|
-
afterEach(() => {
|
|
1240
|
-
globalThis.fetch = originalFetch
|
|
1241
|
-
})
|
|
1242
|
-
|
|
1243
|
-
function stubFetch(impl: (url: string) => Promise<Response>) {
|
|
1244
|
-
const fetchFn = async (input: string | URL | Request) => impl(String(input))
|
|
1245
|
-
fetchFn.preconnect = () => {}
|
|
1246
|
-
globalThis.fetch = fetchFn
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
function messageWithAttachments(
|
|
1250
|
-
attachments: Array<{
|
|
1251
|
-
id: string
|
|
1252
|
-
name: string
|
|
1253
|
-
contentType: string
|
|
1254
|
-
url: string
|
|
1255
|
-
size: number
|
|
1256
|
-
}>,
|
|
1257
|
-
) {
|
|
1258
|
-
return {
|
|
1259
|
-
attachments: new Map(attachments.map((attachment) => {
|
|
1260
|
-
return [attachment.id, attachment]
|
|
1261
|
-
})),
|
|
1262
|
-
} as unknown as Message
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
function snapshotAttachments(result: string) {
|
|
1266
|
-
return result.replaceAll(getDataDir(), '<dataDir>')
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
test('inlines small text files and saves them locally', async () => {
|
|
1270
|
-
stubFetch(async () => {
|
|
1271
|
-
return new Response('hello from file', { status: 200 })
|
|
1272
|
-
})
|
|
1273
|
-
|
|
1274
|
-
const result = await getTextAttachments(
|
|
1275
|
-
messageWithAttachments([
|
|
1276
|
-
{
|
|
1277
|
-
id: 'att1',
|
|
1278
|
-
name: 'notes.txt',
|
|
1279
|
-
contentType: 'text/plain',
|
|
1280
|
-
url: 'https://cdn.example/notes.txt',
|
|
1281
|
-
size: 16,
|
|
1282
|
-
},
|
|
1283
|
-
]),
|
|
1284
|
-
)
|
|
1285
|
-
|
|
1286
|
-
const savedPath = path.join(getDataDir(), 'attachments', 'att1-notes.txt')
|
|
1287
|
-
expect(fs.readFileSync(savedPath, 'utf8')).toBe('hello from file')
|
|
1288
|
-
expect(result).toContain('https://cdn.example/notes.txt')
|
|
1289
|
-
expect(result).toContain(savedPath)
|
|
1290
|
-
expect(snapshotAttachments(result)).toMatchInlineSnapshot(`
|
|
1291
|
-
"<attachment filename="notes.txt" mime="text/plain" size="16" url="https://cdn.example/notes.txt" path="<dataDir>/attachments/att1-notes.txt">
|
|
1292
|
-
hello from file
|
|
1293
|
-
</attachment>"
|
|
1294
|
-
`)
|
|
1295
|
-
})
|
|
1296
|
-
|
|
1297
|
-
test('saves large text files locally without inlining contents', async () => {
|
|
1298
|
-
stubFetch(async () => {
|
|
1299
|
-
return new Response('SHOULD NOT BE INLINED', { status: 200 })
|
|
1300
|
-
})
|
|
1301
|
-
|
|
1302
|
-
const result = await getTextAttachments(
|
|
1303
|
-
messageWithAttachments([
|
|
1304
|
-
{
|
|
1305
|
-
id: 'att2',
|
|
1306
|
-
name: 'huge.log',
|
|
1307
|
-
contentType: 'text/plain',
|
|
1308
|
-
url: 'https://cdn.discordapp.com/attachments/1/2/huge.log',
|
|
1309
|
-
size: TEXT_ATTACHMENT_INLINE_LIMIT_BYTES + 1,
|
|
1310
|
-
},
|
|
1311
|
-
]),
|
|
1312
|
-
)
|
|
1313
|
-
|
|
1314
|
-
const savedPath = path.join(getDataDir(), 'attachments', 'att2-huge.log')
|
|
1315
|
-
expect(fs.readFileSync(savedPath, 'utf8')).toBe('SHOULD NOT BE INLINED')
|
|
1316
|
-
expect(result).not.toContain('SHOULD NOT BE INLINED')
|
|
1317
|
-
expect(result).toContain('https://cdn.discordapp.com/attachments/1/2/huge.log')
|
|
1318
|
-
expect(result).toContain(savedPath)
|
|
1319
|
-
expect(result).toContain('text/plain')
|
|
1320
|
-
expect(result).toContain(String(TEXT_ATTACHMENT_INLINE_LIMIT_BYTES + 1))
|
|
1321
|
-
expect(snapshotAttachments(result)).toMatchInlineSnapshot(`
|
|
1322
|
-
"<attachment filename="huge.log" mime="text/plain" size="65537" url="https://cdn.discordapp.com/attachments/1/2/huge.log" path="<dataDir>/attachments/att2-huge.log" large="true">
|
|
1323
|
-
This file is large (64 KB, text/plain). Contents were not inlined to save context. Read the local path.
|
|
1324
|
-
</attachment>"
|
|
1325
|
-
`)
|
|
1326
|
-
})
|
|
1327
|
-
|
|
1328
|
-
test('still inlines large prompt.md attachments from kimaki send', async () => {
|
|
1329
|
-
stubFetch(async () => {
|
|
1330
|
-
return new Response('the actual long prompt', { status: 200 })
|
|
1331
|
-
})
|
|
1332
|
-
|
|
1333
|
-
const result = await getTextAttachments(
|
|
1334
|
-
messageWithAttachments([
|
|
1335
|
-
{
|
|
1336
|
-
id: 'att3',
|
|
1337
|
-
name: 'prompt.md',
|
|
1338
|
-
contentType: 'text/markdown',
|
|
1339
|
-
url: 'https://cdn.example/prompt.md',
|
|
1340
|
-
size: TEXT_ATTACHMENT_INLINE_LIMIT_BYTES + 1,
|
|
1341
|
-
},
|
|
1342
|
-
]),
|
|
1343
|
-
)
|
|
1344
|
-
|
|
1345
|
-
const savedPath = path.join(getDataDir(), 'attachments', 'att3-prompt.md')
|
|
1346
|
-
expect(fs.readFileSync(savedPath, 'utf8')).toBe('the actual long prompt')
|
|
1347
|
-
expect(result).toContain('the actual long prompt')
|
|
1348
|
-
expect(result).toContain('https://cdn.example/prompt.md')
|
|
1349
|
-
expect(result).toContain(savedPath)
|
|
1350
|
-
expect(snapshotAttachments(result)).toMatchInlineSnapshot(`
|
|
1351
|
-
"<attachment filename="prompt.md" mime="text/markdown" size="65537" url="https://cdn.example/prompt.md" path="<dataDir>/attachments/att3-prompt.md">
|
|
1352
|
-
the actual long prompt
|
|
1353
|
-
</attachment>"
|
|
1354
|
-
`)
|
|
1355
|
-
})
|
|
1356
|
-
|
|
1357
|
-
test('keeps small files inlined next to large file references', async () => {
|
|
1358
|
-
stubFetch(async (url) => {
|
|
1359
|
-
if (url.includes('small.txt')) {
|
|
1360
|
-
return new Response('tiny', { status: 200 })
|
|
1361
|
-
}
|
|
1362
|
-
return new Response('SHOULD NOT BE INLINED', { status: 200 })
|
|
1363
|
-
})
|
|
1364
|
-
|
|
1365
|
-
const result = await getTextAttachments(
|
|
1366
|
-
messageWithAttachments([
|
|
1367
|
-
{
|
|
1368
|
-
id: 'att4',
|
|
1369
|
-
name: 'small.txt',
|
|
1370
|
-
contentType: 'text/plain',
|
|
1371
|
-
url: 'https://cdn.example/small.txt',
|
|
1372
|
-
size: 4,
|
|
1373
|
-
},
|
|
1374
|
-
{
|
|
1375
|
-
id: 'att5',
|
|
1376
|
-
name: 'dump.json',
|
|
1377
|
-
contentType: 'application/json',
|
|
1378
|
-
url: 'https://cdn.example/dump.json',
|
|
1379
|
-
size: TEXT_ATTACHMENT_INLINE_LIMIT_BYTES + 50,
|
|
1380
|
-
},
|
|
1381
|
-
]),
|
|
1382
|
-
)
|
|
1383
|
-
|
|
1384
|
-
expect(result).toContain('tiny')
|
|
1385
|
-
expect(result).not.toContain('SHOULD NOT BE INLINED')
|
|
1386
|
-
expect(result).toContain('https://cdn.example/small.txt')
|
|
1387
|
-
expect(result).toContain('https://cdn.example/dump.json')
|
|
1388
|
-
expect(result).toContain(path.join(getDataDir(), 'attachments', 'att4-small.txt'))
|
|
1389
|
-
expect(result).toContain(path.join(getDataDir(), 'attachments', 'att5-dump.json'))
|
|
1390
|
-
expect(result).toContain('application/json')
|
|
1391
|
-
expect(snapshotAttachments(result)).toMatchInlineSnapshot(`
|
|
1392
|
-
"<attachment filename="small.txt" mime="text/plain" size="4" url="https://cdn.example/small.txt" path="<dataDir>/attachments/att4-small.txt">
|
|
1393
|
-
tiny
|
|
1394
|
-
</attachment>
|
|
1395
|
-
|
|
1396
|
-
<attachment filename="dump.json" mime="application/json" size="65586" url="https://cdn.example/dump.json" path="<dataDir>/attachments/att5-dump.json" large="true">
|
|
1397
|
-
This file is large (64 KB, application/json). Contents were not inlined to save context. Read the local path.
|
|
1398
|
-
</attachment>"
|
|
1399
|
-
`)
|
|
1400
|
-
})
|
|
1401
|
-
})
|