kimaki 1.4.0 → 1.5.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/assets/fonts/Geist-Bold.ttf +0 -0
- package/assets/fonts/Geist-Regular.ttf +0 -0
- package/assets/fonts/GeistMono-Regular.ttf +0 -0
- package/assets/fonts/OFL.txt +92 -0
- package/dist/agent-ui.e2e.test.js +27 -13
- package/dist/agent-ui.e2e.test.js.map +1 -1
- package/dist/agent-ui.js +2 -1
- package/dist/agent-ui.js.map +1 -1
- package/dist/analytics.e2e.test.js +1 -1
- package/dist/analytics.e2e.test.js.map +1 -1
- package/dist/autostart.d.ts +4 -0
- package/dist/autostart.js +55 -10
- package/dist/autostart.js.map +1 -1
- package/dist/bot.d.ts +10 -1
- package/dist/bot.js +14 -6
- package/dist/bot.js.map +1 -1
- package/dist/btw.e2e.test.js +3 -3
- package/dist/builtin-skills.d.ts +1 -1
- package/dist/builtin-skills.js +1 -1
- package/dist/builtin-skills.js.map +1 -1
- package/dist/builtin-skills.test.js +3 -4
- package/dist/builtin-skills.test.js.map +1 -1
- package/dist/catalog-refresh.e2e.test.js +2 -2
- package/dist/cli/bot.js +25 -14
- package/dist/cli/bot.js.map +1 -1
- package/dist/cli/discord.js +32 -6
- package/dist/cli/discord.js.map +1 -1
- package/dist/cli/schedule.js +23 -9
- package/dist/cli/schedule.js.map +1 -1
- package/dist/cli/session.js +37 -12
- package/dist/cli/session.js.map +1 -1
- package/dist/cli/shared.d.ts +5 -3
- package/dist/cli/shared.js +45 -10
- package/dist/cli/shared.js.map +1 -1
- package/dist/cli-discord.e2e.test.js +13 -8
- package/dist/cli-discord.e2e.test.js.map +1 -1
- package/dist/cli-lock.e2e.test.js +87 -20
- package/dist/cli-lock.e2e.test.js.map +1 -1
- package/dist/cli-read.e2e.test.js +18 -9
- package/dist/cli-read.e2e.test.js.map +1 -1
- package/dist/cli-sessions.e2e.test.js +4 -3
- package/dist/cli-sessions.e2e.test.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/preference-commands.d.ts +4 -0
- package/dist/commands/preference-commands.js +38 -4
- package/dist/commands/preference-commands.js.map +1 -1
- package/dist/commands/session-commands.js +11 -8
- package/dist/commands/session-commands.js.map +1 -1
- package/dist/commands/thread-commands.js +94 -24
- package/dist/commands/thread-commands.js.map +1 -1
- package/dist/commands/worktree-commands.d.ts +5 -6
- package/dist/commands/worktree-commands.js +8 -7
- package/dist/commands/worktree-commands.js.map +1 -1
- package/dist/commands.e2e.test.js +25 -21
- package/dist/commands.e2e.test.js.map +1 -1
- package/dist/coordinator-agents.e2e.test.d.ts +1 -0
- package/dist/coordinator-agents.e2e.test.js +113 -0
- package/dist/coordinator-agents.e2e.test.js.map +1 -0
- package/dist/coordinator-idle.e2e.test.d.ts +1 -0
- package/dist/coordinator-idle.e2e.test.js +100 -0
- package/dist/coordinator-idle.e2e.test.js.map +1 -0
- package/dist/coordinator-queue.e2e.test.d.ts +1 -0
- package/dist/coordinator-queue.e2e.test.js +244 -0
- package/dist/coordinator-queue.e2e.test.js.map +1 -0
- package/dist/coordinator-warmup.e2e.test.d.ts +1 -0
- package/dist/coordinator-warmup.e2e.test.js +131 -0
- package/dist/coordinator-warmup.e2e.test.js.map +1 -0
- package/dist/coordinator.d.ts +6 -0
- package/dist/coordinator.e2e.test.d.ts +1 -0
- package/dist/coordinator.e2e.test.js +505 -0
- package/dist/coordinator.e2e.test.js.map +1 -0
- package/dist/coordinator.js +164 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/db.d.ts +78 -3
- package/dist/db.test.js +1 -0
- package/dist/db.test.js.map +1 -1
- package/dist/diagram.d.ts +11 -0
- package/dist/diagram.js +232 -0
- package/dist/diagram.js.map +1 -0
- package/dist/diagram.test.d.ts +1 -0
- package/dist/diagram.test.js +52 -0
- package/dist/diagram.test.js.map +1 -0
- package/dist/duration.js +13 -5
- package/dist/duration.js.map +1 -1
- package/dist/effects.d.ts +6 -1
- package/dist/effects.js +97 -26
- package/dist/effects.js.map +1 -1
- package/dist/event-loop.d.ts +1 -1
- package/dist/event-loop.js +73 -43
- package/dist/event-loop.js.map +1 -1
- package/dist/format-parts.d.ts +21 -4
- package/dist/format-parts.js +40 -23
- package/dist/format-parts.js.map +1 -1
- package/dist/gateway-replay.e2e.test.js +4 -4
- package/dist/harness.e2e.test.js +2 -2
- package/dist/harness.e2e.test.js.map +1 -1
- package/dist/hello-thread.e2e.test.js +56 -5
- package/dist/hello-thread.e2e.test.js.map +1 -1
- package/dist/ingress.js +47 -12
- package/dist/ingress.js.map +1 -1
- package/dist/interaction-context.d.ts +4 -4
- package/dist/interaction-context.js +9 -7
- package/dist/interaction-context.js.map +1 -1
- package/dist/interrupt.e2e.test.js +8 -5
- package/dist/interrupt.e2e.test.js.map +1 -1
- package/dist/legacy.e2e.test.js +1 -1
- package/dist/lock-routes.d.ts +83 -31
- package/dist/lock-routes.js +68 -8
- package/dist/lock-routes.js.map +1 -1
- package/dist/lock-server.d.ts +3 -2
- package/dist/lock-server.js +23 -7
- package/dist/lock-server.js.map +1 -1
- package/dist/main.d.ts +4 -2
- package/dist/main.js +13 -3
- package/dist/main.js.map +1 -1
- package/dist/mainmast-idle.e2e.test.d.ts +1 -0
- package/dist/mainmast-idle.e2e.test.js +99 -0
- package/dist/mainmast-idle.e2e.test.js.map +1 -0
- package/dist/mainmast-queue.e2e.test.d.ts +1 -0
- package/dist/mainmast-queue.e2e.test.js +244 -0
- package/dist/mainmast-queue.e2e.test.js.map +1 -0
- package/dist/mainmast-warmup.e2e.test.d.ts +1 -0
- package/dist/mainmast-warmup.e2e.test.js +130 -0
- package/dist/mainmast-warmup.e2e.test.js.map +1 -0
- package/dist/mainmast.d.ts +6 -0
- package/dist/mainmast.e2e.test.d.ts +1 -0
- package/dist/mainmast.e2e.test.js +428 -0
- package/dist/mainmast.e2e.test.js.map +1 -0
- package/dist/mainmast.js +156 -0
- package/dist/mainmast.js.map +1 -0
- package/dist/markdown/markdown.test.js +4 -4
- package/dist/markdown/render-markdown.js +6 -5
- package/dist/markdown/render-markdown.js.map +1 -1
- package/dist/onboarding-cli.e2e.test.js +7 -6
- package/dist/onboarding-cli.e2e.test.js.map +1 -1
- package/dist/onboarding.d.ts +3 -10
- package/dist/onboarding.e2e.test.js +8 -10
- package/dist/onboarding.e2e.test.js.map +1 -1
- package/dist/onboarding.js +14 -24
- package/dist/onboarding.js.map +1 -1
- package/dist/permissions.e2e.test.js +3 -3
- package/dist/plugin/coordinator.d.ts +4 -0
- package/dist/plugin/coordinator.js +389 -0
- package/dist/plugin/coordinator.js.map +1 -0
- package/dist/plugin/index.js +76 -17
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/mainmast.d.ts +4 -0
- package/dist/plugin/mainmast.js +379 -0
- package/dist/plugin/mainmast.js.map +1 -0
- package/dist/plugin.e2e.test.js +1 -1
- package/dist/preference-commands.e2e.test.js +103 -24
- package/dist/preference-commands.e2e.test.js.map +1 -1
- package/dist/project.d.ts +1 -1
- package/dist/prompt.d.ts +22 -9
- package/dist/prompt.js +64 -48
- package/dist/prompt.js.map +1 -1
- package/dist/questions.e2e.test.js +13 -13
- package/dist/queue-sources.e2e.test.d.ts +1 -0
- package/dist/queue-sources.e2e.test.js +168 -0
- package/dist/queue-sources.e2e.test.js.map +1 -0
- package/dist/queue.d.ts +9 -1
- package/dist/queue.e2e.test.js +48 -30
- package/dist/queue.e2e.test.js.map +1 -1
- package/dist/queue.js +97 -24
- package/dist/queue.js.map +1 -1
- package/dist/queue.test.d.ts +1 -0
- package/dist/queue.test.js +57 -0
- package/dist/queue.test.js.map +1 -0
- package/dist/remote-send.e2e.test.js +6 -6
- package/dist/remote-send.js +2 -1
- package/dist/remote-send.js.map +1 -1
- package/dist/renderer.e2e.test.js +7 -7
- package/dist/restart.e2e.test.js +2 -2
- package/dist/routines.e2e.test.js +2 -2
- package/dist/scheduler.d.ts +3 -3
- package/dist/scheduler.e2e.test.js +43 -20
- package/dist/scheduler.e2e.test.js.map +1 -1
- package/dist/scheduler.js +4 -2
- package/dist/scheduler.js.map +1 -1
- package/dist/schema-sql.d.ts +1 -1
- package/dist/schema-sql.js +1 -1
- package/dist/schema-sql.js.map +1 -1
- package/dist/schema.d.ts +152 -6
- package/dist/schema.js +12 -0
- package/dist/schema.js.map +1 -1
- package/dist/session-commands.e2e.test.js +36 -11
- package/dist/session-commands.e2e.test.js.map +1 -1
- package/dist/session-events.d.ts +18 -6
- package/dist/session-events.js +166 -22
- package/dist/session-events.js.map +1 -1
- package/dist/session-ops.e2e.test.js +63 -12
- package/dist/session-ops.e2e.test.js.map +1 -1
- package/dist/sessions.d.ts +44 -21
- package/dist/sessions.js +174 -63
- package/dist/sessions.js.map +1 -1
- package/dist/shell.e2e.test.js +4 -4
- package/dist/slash-commands.js +6 -4
- package/dist/slash-commands.js.map +1 -1
- package/dist/slash-commands.test.js +2 -0
- package/dist/slash-commands.test.js.map +1 -1
- package/dist/sleep.e2e.test.js +29 -14
- package/dist/sleep.e2e.test.js.map +1 -1
- package/dist/sleeps.d.ts +2 -1
- package/dist/sleeps.js +21 -3
- package/dist/sleeps.js.map +1 -1
- package/dist/store.d.ts +1 -0
- package/dist/store.js +3 -2
- package/dist/store.js.map +1 -1
- package/dist/system-prompt.d.ts +3 -1
- package/dist/system-prompt.js +138 -64
- package/dist/system-prompt.js.map +1 -1
- package/dist/test/generate-log-plugin/index.d.ts +3 -0
- package/dist/test/generate-log-plugin/index.js +15 -0
- package/dist/test/generate-log-plugin/index.js.map +1 -0
- package/dist/test/harness.d.ts +20 -1
- package/dist/test/harness.js +51 -10
- package/dist/test/harness.js.map +1 -1
- package/dist/test/replay.js +11 -7
- package/dist/test/replay.js.map +1 -1
- package/dist/thread-reducer.d.ts +29 -3
- package/dist/thread-reducer.fixtures.test.js +58 -51
- package/dist/thread-reducer.fixtures.test.js.map +1 -1
- package/dist/thread-reducer.js +112 -25
- package/dist/thread-reducer.js.map +1 -1
- package/dist/thread-reducer.test.js +197 -24
- package/dist/thread-reducer.test.js.map +1 -1
- package/dist/voice-attachments.e2e.test.js +108 -18
- package/dist/voice-attachments.e2e.test.js.map +1 -1
- package/dist/voice-call.e2e.test.js +9 -9
- package/dist/voice-call.js +6 -6
- package/dist/voice-call.js.map +1 -1
- package/dist/voice-openai.e2e.test.js +59 -23
- package/dist/voice-openai.e2e.test.js.map +1 -1
- package/dist/voice.d.ts +1 -1
- package/dist/voice.js +72 -24
- package/dist/voice.js.map +1 -1
- package/dist/working-directory.e2e.test.js +11 -11
- package/dist/working-directory.e2e.test.js.map +1 -1
- package/package.json +12 -6
- package/src/agent-ui.e2e.test.ts +27 -13
- package/src/agent-ui.ts +2 -1
- package/src/analytics.e2e.test.ts +1 -1
- package/src/autostart.ts +55 -10
- package/src/bot.ts +29 -5
- package/src/btw.e2e.test.ts +3 -3
- package/src/builtin-skills.test.ts +3 -4
- package/src/builtin-skills.ts +1 -1
- package/src/catalog-refresh.e2e.test.ts +2 -2
- package/src/cli/bot.ts +23 -14
- package/src/cli/discord.ts +30 -6
- package/src/cli/schedule.ts +23 -9
- package/src/cli/session.ts +35 -12
- package/src/cli/shared.ts +43 -8
- package/src/cli-discord.e2e.test.ts +13 -8
- package/src/cli-lock.e2e.test.ts +88 -20
- package/src/cli-read.e2e.test.ts +17 -8
- package/src/cli-sessions.e2e.test.ts +4 -3
- package/src/cli.ts +2 -0
- package/src/commands/preference-commands.ts +38 -4
- package/src/commands/session-commands.ts +12 -7
- package/src/commands/thread-commands.ts +92 -24
- package/src/commands/worktree-commands.ts +10 -9
- package/src/commands.e2e.test.ts +25 -21
- package/src/coordinator-agents.e2e.test.ts +145 -0
- package/src/coordinator-idle.e2e.test.ts +122 -0
- package/src/coordinator-queue.e2e.test.ts +279 -0
- package/src/coordinator-warmup.e2e.test.ts +158 -0
- package/src/coordinator.e2e.test.ts +545 -0
- package/src/coordinator.ts +168 -0
- package/src/db.test.ts +1 -0
- package/src/diagram.test.ts +56 -0
- package/src/diagram.ts +243 -0
- package/src/duration.ts +13 -5
- package/src/effects.ts +99 -27
- package/src/event-loop.ts +71 -42
- package/src/format-parts.ts +53 -22
- package/src/gateway-replay.e2e.test.ts +4 -4
- package/src/harness.e2e.test.ts +2 -2
- package/src/hello-thread.e2e.test.ts +59 -5
- package/src/ingress.ts +44 -11
- package/src/interaction-context.ts +12 -11
- package/src/interrupt.e2e.test.ts +8 -5
- package/src/legacy.e2e.test.ts +1 -1
- package/src/lock-routes.ts +62 -8
- package/src/lock-server.ts +23 -7
- package/src/main.ts +22 -7
- package/src/markdown/markdown.test.ts +4 -4
- package/src/markdown/render-markdown.ts +6 -5
- package/src/onboarding-cli.e2e.test.ts +7 -6
- package/src/onboarding.e2e.test.ts +8 -10
- package/src/onboarding.ts +13 -29
- package/src/permissions.e2e.test.ts +3 -3
- package/src/plugin/coordinator.ts +401 -0
- package/src/plugin/index.ts +68 -15
- package/src/plugin.e2e.test.ts +1 -1
- package/src/preference-commands.e2e.test.ts +103 -23
- package/src/prompt.ts +87 -43
- package/src/questions.e2e.test.ts +13 -13
- package/src/queue-sources.e2e.test.ts +197 -0
- package/src/queue.e2e.test.ts +48 -30
- package/src/queue.test.ts +59 -0
- package/src/queue.ts +104 -24
- package/src/remote-send.e2e.test.ts +6 -6
- package/src/remote-send.ts +2 -1
- package/src/renderer.e2e.test.ts +7 -7
- package/src/restart.e2e.test.ts +2 -2
- package/src/routines.e2e.test.ts +2 -2
- package/src/scheduler.e2e.test.ts +45 -19
- package/src/scheduler.ts +4 -2
- package/src/schema-sql.ts +1 -1
- package/src/schema.ts +13 -0
- package/src/session-commands.e2e.test.ts +38 -11
- package/src/session-events.ts +160 -21
- package/src/session-ops.e2e.test.ts +64 -11
- package/src/sessions.ts +214 -64
- package/src/shell.e2e.test.ts +4 -4
- package/src/slash-commands.test.ts +2 -0
- package/src/slash-commands.ts +6 -4
- package/src/sleep.e2e.test.ts +30 -13
- package/src/sleeps.ts +20 -3
- package/src/store.ts +5 -2
- package/src/system-prompt.ts +143 -63
- package/src/test/generate-log-plugin/index.ts +16 -0
- package/src/test/harness.ts +77 -14
- package/src/test/replay.ts +12 -6
- package/src/thread-reducer.fixtures.test.ts +58 -51
- package/src/thread-reducer.test.ts +207 -26
- package/src/thread-reducer.ts +138 -37
- package/src/voice-attachments.e2e.test.ts +110 -18
- package/src/voice-call.e2e.test.ts +9 -9
- package/src/voice-call.ts +6 -6
- package/src/voice-openai.e2e.test.ts +64 -24
- package/src/voice.ts +93 -26
- package/src/working-directory.e2e.test.ts +11 -11
|
@@ -138,14 +138,14 @@ test('single question answered from the dropdown', async () => {
|
|
|
138
138
|
await waitForFooter({ discord: twin.discord, threadId: thread.id })
|
|
139
139
|
expect(await twin.discord.thread(thread.id).text({ showInteractions: true })).toMatchInlineSnapshot(`
|
|
140
140
|
"--- from: assistant (TestBot)
|
|
141
|
-
» **CLI:** Pick a color ask-one
|
|
141
|
+
-# » **CLI:** Pick a color ask-one
|
|
142
142
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
143
143
|
**Color**
|
|
144
144
|
Which color do you prefer?
|
|
145
145
|
✓ _Blue_
|
|
146
146
|
[user selects dropdown: 1]
|
|
147
147
|
answers received ask-one
|
|
148
|
-
-# *
|
|
148
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
149
149
|
`)
|
|
150
150
|
})
|
|
151
151
|
|
|
@@ -163,7 +163,7 @@ test('two questions: the form is answered after both, multi-select keeps options
|
|
|
163
163
|
await waitForFooter({ discord: twin.discord, threadId: thread.id })
|
|
164
164
|
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
165
165
|
"--- from: assistant (TestBot)
|
|
166
|
-
» **CLI:** Two questions ask-two
|
|
166
|
+
-# » **CLI:** Two questions ask-two
|
|
167
167
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
168
168
|
**Color**
|
|
169
169
|
Which color do you prefer?
|
|
@@ -172,7 +172,7 @@ test('two questions: the form is answered after both, multi-select keeps options
|
|
|
172
172
|
Which fruits do you like?
|
|
173
173
|
✓ _Apple, Kiwi, Banana_
|
|
174
174
|
answers received ask-two
|
|
175
|
-
-# *
|
|
175
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
176
176
|
`)
|
|
177
177
|
const sessionId = bot.store.getState().roots[thread.id]!
|
|
178
178
|
const messages = await (await server.client()).message.list({ sessionID: sessionId })
|
|
@@ -189,13 +189,13 @@ test('Other opens a modal and sends the typed answer', async () => {
|
|
|
189
189
|
await waitForFooter({ discord: twin.discord, threadId: thread.id })
|
|
190
190
|
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
191
191
|
"--- from: assistant (TestBot)
|
|
192
|
-
» **CLI:** Custom color ask-other
|
|
192
|
+
-# » **CLI:** Custom color ask-other
|
|
193
193
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
194
194
|
**Color**
|
|
195
195
|
Which color do you prefer?
|
|
196
196
|
✓ _Teal_
|
|
197
197
|
answers received ask-other
|
|
198
|
-
-# *
|
|
198
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
199
199
|
`)
|
|
200
200
|
})
|
|
201
201
|
|
|
@@ -246,10 +246,10 @@ test('OpenCode forms without the question tool (web search setup, yes/no) show l
|
|
|
246
246
|
`)
|
|
247
247
|
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
248
248
|
"--- from: assistant (TestBot)
|
|
249
|
-
» **CLI:** Hello instead-marker
|
|
249
|
+
-# » **CLI:** Hello instead-marker
|
|
250
250
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
251
251
|
did the other thing
|
|
252
|
-
-# *
|
|
252
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
253
253
|
**Web Search**
|
|
254
254
|
Allow OpenCode to search the web for up-to-date information?
|
|
255
255
|
✓ _Disable web search_
|
|
@@ -266,7 +266,7 @@ test('a new message cancels the pending question and is answered', async () => {
|
|
|
266
266
|
await waitForFooter({ discord: twin.discord, threadId: thread.id })
|
|
267
267
|
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
268
268
|
"--- from: assistant (TestBot)
|
|
269
|
-
» **CLI:** Ask then change ask-cancel
|
|
269
|
+
-# » **CLI:** Ask then change ask-cancel
|
|
270
270
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
271
271
|
**Color**
|
|
272
272
|
Which color do you prefer?
|
|
@@ -275,7 +275,7 @@ test('a new message cancels the pending question and is answered', async () => {
|
|
|
275
275
|
Forget it instead-marker
|
|
276
276
|
--- from: assistant (TestBot)
|
|
277
277
|
did the other thing
|
|
278
|
-
-# *
|
|
278
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
279
279
|
`)
|
|
280
280
|
})
|
|
281
281
|
|
|
@@ -294,7 +294,7 @@ test('a restarted bot shows the pending question again and it still works', asyn
|
|
|
294
294
|
await waitForFooter({ discord: twin.discord, threadId: thread.id })
|
|
295
295
|
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
296
296
|
"--- from: assistant (TestBot)
|
|
297
|
-
» **CLI:** Survive restart ask-restart
|
|
297
|
+
-# » **CLI:** Survive restart ask-restart
|
|
298
298
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
299
299
|
**Color**
|
|
300
300
|
Which color do you prefer?
|
|
@@ -302,7 +302,7 @@ test('a restarted bot shows the pending question again and it still works', asyn
|
|
|
302
302
|
Which color do you prefer?
|
|
303
303
|
✓ _Red_
|
|
304
304
|
answers received ask-restart
|
|
305
|
-
-# *
|
|
305
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
306
306
|
`)
|
|
307
307
|
})
|
|
308
308
|
|
|
@@ -318,7 +318,7 @@ test('Kimaki sessions hide the question tool by default', async () => {
|
|
|
318
318
|
--- from: assistant (TestBot)
|
|
319
319
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
320
320
|
answers received ask-denied
|
|
321
|
-
-# *
|
|
321
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
322
322
|
`)
|
|
323
323
|
const messages = await twin.discord.thread(thread.id).getMessages()
|
|
324
324
|
expect(messages.flatMap(selectsOf)).toEqual([])
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// Queue cases in a thread that do not start from a queued Discord message:
|
|
2
|
+
// `kimaki send . queue`, a TUI prompt queued on the session, an item the TUI
|
|
3
|
+
// promotes to steer, a plain message while an item waits, and `. queue` on an
|
|
4
|
+
// idle thread. Split from queue.e2e so both files run in parallel.
|
|
5
|
+
|
|
6
|
+
import { execFile } from 'node:child_process'
|
|
7
|
+
import fs from 'node:fs'
|
|
8
|
+
import path from 'node:path'
|
|
9
|
+
import { promisify } from 'node:util'
|
|
10
|
+
import type { DeterministicMatcher } from 'opencode-deterministic-provider'
|
|
11
|
+
import { afterAll, beforeAll, expect, test } from 'vitest'
|
|
12
|
+
|
|
13
|
+
import type { BotHandle } from './main.ts'
|
|
14
|
+
import {
|
|
15
|
+
TEST_USER_ID,
|
|
16
|
+
seedProjectChannel,
|
|
17
|
+
slowTextMatcher,
|
|
18
|
+
startOpencodeTestServer,
|
|
19
|
+
startTestBot,
|
|
20
|
+
startTwin,
|
|
21
|
+
tempDataDir,
|
|
22
|
+
textParts,
|
|
23
|
+
waitForBotMessageContaining,
|
|
24
|
+
waitForFooter,
|
|
25
|
+
warmUp,
|
|
26
|
+
type OpencodeTestServer,
|
|
27
|
+
type TestTwin,
|
|
28
|
+
} from './test/harness.ts'
|
|
29
|
+
|
|
30
|
+
const exec = promisify(execFile)
|
|
31
|
+
|
|
32
|
+
function reply(marker: string, text: string): DeterministicMatcher {
|
|
33
|
+
return { id: marker, priority: 50, when: { latestUserTextIncludes: marker }, then: { parts: textParts(text) } }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const matchers: DeterministicMatcher[] = [
|
|
37
|
+
slowTextMatcher({ marker: 'slow-marker', text: 'slow-done', delayMs: 1_200 }),
|
|
38
|
+
reply('steer-marker', 'steer ok'),
|
|
39
|
+
reply('queued-one', 'queued one ok'),
|
|
40
|
+
reply('idle-marker', 'idle ok'),
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
let server: OpencodeTestServer
|
|
44
|
+
let twin: TestTwin
|
|
45
|
+
let bot: BotHandle
|
|
46
|
+
let dataDir: string
|
|
47
|
+
|
|
48
|
+
beforeAll(async () => {
|
|
49
|
+
dataDir = tempDataDir()
|
|
50
|
+
;[server, twin] = await Promise.all([startOpencodeTestServer({ matchers }), startTwin()])
|
|
51
|
+
await seedProjectChannel({ dataDir, channelId: twin.channelId, guildId: twin.discord.guildId, directory: server.projectDirectory })
|
|
52
|
+
await warmUp({ server })
|
|
53
|
+
bot = await startTestBot({ dataDir, twin, server })
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
afterAll(async () => {
|
|
57
|
+
await bot?.stop()
|
|
58
|
+
await twin?.stop()
|
|
59
|
+
await server?.stop()
|
|
60
|
+
fs.rmSync(dataDir, { recursive: true, force: true })
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
// Starts a slow turn in a new thread and waits until it runs (banner posted).
|
|
64
|
+
async function startSlowThread(content: string) {
|
|
65
|
+
const { discord, channelId } = twin
|
|
66
|
+
const before = new Set((await discord.channel(channelId).getThreads()).map((thread) => thread.id))
|
|
67
|
+
await discord.channel(channelId).user(TEST_USER_ID).sendMessage({ content: `${content} slow-marker` })
|
|
68
|
+
const thread = await discord.channel(channelId).waitForThread({ timeout: 8_000, predicate: (candidate) => !before.has(candidate.id) })
|
|
69
|
+
await waitForBotMessageContaining({ discord, threadId: thread.id, text: '*using ' })
|
|
70
|
+
return thread
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function rootOf(threadId: string): string {
|
|
74
|
+
const sessionID = bot.store.getState().roots[threadId]
|
|
75
|
+
if (!sessionID) throw new Error(`thread ${threadId} has no session`)
|
|
76
|
+
return sessionID
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
test('CLI . queue into a busy thread shows the full text, then replies to it when it runs', async () => {
|
|
80
|
+
const thread = await startSlowThread('CLI queue')
|
|
81
|
+
await exec(process.execPath, ['--import', 'tsx', path.resolve('src/cli.ts'), 'send', '--thread', thread.id, '--prompt', 'From the CLI queued-one\nsecond line. queue', '--data-dir', dataDir], {
|
|
82
|
+
env: { ...process.env, KIMAKI_LOCK_PORT: String(bot.lock.port) },
|
|
83
|
+
})
|
|
84
|
+
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'queued one ok' })
|
|
85
|
+
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 2 })
|
|
86
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
87
|
+
"--- from: user (tommy)
|
|
88
|
+
CLI queue slow-marker
|
|
89
|
+
--- from: assistant (TestBot)
|
|
90
|
+
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
91
|
+
-# » **CLI:** From the CLI queued-one
|
|
92
|
+
-# second line
|
|
93
|
+
slow-done
|
|
94
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
95
|
+
[reply to TestBot: -# » **CLI:** From the CLI queued-one -#]
|
|
96
|
+
-# Queued message sent
|
|
97
|
+
queued one ok
|
|
98
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
99
|
+
`)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
test('a prompt queued from the TUI shows its text, then a reply to it when it runs', async () => {
|
|
103
|
+
const thread = await startSlowThread('TUI queue')
|
|
104
|
+
const client = await server.client()
|
|
105
|
+
await client.session.prompt({ sessionID: rootOf(thread.id), text: 'Typed in the TUI queued-one', delivery: 'queue' })
|
|
106
|
+
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'queued one ok' })
|
|
107
|
+
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 2 })
|
|
108
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
109
|
+
"--- from: user (tommy)
|
|
110
|
+
TUI queue slow-marker
|
|
111
|
+
--- from: assistant (TestBot)
|
|
112
|
+
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
113
|
+
-# » **user:** Typed in the TUI queued-one
|
|
114
|
+
slow-done
|
|
115
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
116
|
+
[reply to TestBot: -# » **user:** Typed in the TUI queued-o]
|
|
117
|
+
-# Queued message sent
|
|
118
|
+
queued one ok
|
|
119
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
120
|
+
`)
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
test('a queued item the TUI sends now (steer) gets its reply when promoted, once', async () => {
|
|
124
|
+
const thread = await startSlowThread('Promote me')
|
|
125
|
+
const queued = await twin.discord.thread(thread.id).user(TEST_USER_ID).sendMessage({ content: 'Run me now queued-one. queue' })
|
|
126
|
+
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'position 1' })
|
|
127
|
+
const client = await server.client()
|
|
128
|
+
await client.session.inbox.update({ sessionID: rootOf(thread.id), inboxID: `msg_discord_${queued.id}`, delivery: 'steer' })
|
|
129
|
+
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'queued one ok' })
|
|
130
|
+
await waitForFooter({ discord: twin.discord, threadId: thread.id })
|
|
131
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
132
|
+
"--- from: user (tommy)
|
|
133
|
+
Promote me slow-marker
|
|
134
|
+
--- from: assistant (TestBot)
|
|
135
|
+
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
136
|
+
--- from: user (tommy)
|
|
137
|
+
Run me now queued-one. queue
|
|
138
|
+
--- from: assistant (TestBot)
|
|
139
|
+
[reply to tommy: Run me now queued-one. queue]
|
|
140
|
+
-# Queued
|
|
141
|
+
[reply to tommy: Run me now queued-one. queue]
|
|
142
|
+
-# Queued message sent
|
|
143
|
+
slow-done
|
|
144
|
+
queued one ok
|
|
145
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
146
|
+
`)
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
test('a plain message while an item waits runs first, then the queued item gets its reply', async () => {
|
|
150
|
+
const thread = await startSlowThread('Steer past the queue')
|
|
151
|
+
const user = twin.discord.thread(thread.id).user(TEST_USER_ID)
|
|
152
|
+
await user.sendMessage({ content: 'Later queued-one. queue' })
|
|
153
|
+
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'position 1' })
|
|
154
|
+
await user.sendMessage({ content: 'Now steer-marker' })
|
|
155
|
+
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'queued one ok' })
|
|
156
|
+
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 2 })
|
|
157
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
158
|
+
"--- from: user (tommy)
|
|
159
|
+
Steer past the queue slow-marker
|
|
160
|
+
--- from: assistant (TestBot)
|
|
161
|
+
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
162
|
+
--- from: user (tommy)
|
|
163
|
+
Later queued-one. queue
|
|
164
|
+
--- from: assistant (TestBot)
|
|
165
|
+
[reply to tommy: Later queued-one. queue]
|
|
166
|
+
-# Queued
|
|
167
|
+
--- from: user (tommy)
|
|
168
|
+
Now steer-marker
|
|
169
|
+
--- from: assistant (TestBot)
|
|
170
|
+
steer ok
|
|
171
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
172
|
+
[reply to tommy: Later queued-one. queue]
|
|
173
|
+
-# Queued message sent
|
|
174
|
+
queued one ok
|
|
175
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
176
|
+
`)
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
test('. queue on an idle thread runs at once, like a plain message', async () => {
|
|
180
|
+
const thread = await startSlowThread('Idle queue')
|
|
181
|
+
await waitForFooter({ discord: twin.discord, threadId: thread.id })
|
|
182
|
+
await twin.discord.thread(thread.id).user(TEST_USER_ID).sendMessage({ content: 'Nothing waits idle-marker. queue' })
|
|
183
|
+
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 2 })
|
|
184
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
185
|
+
"--- from: user (tommy)
|
|
186
|
+
Idle queue slow-marker
|
|
187
|
+
--- from: assistant (TestBot)
|
|
188
|
+
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
189
|
+
slow-done
|
|
190
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
191
|
+
--- from: user (tommy)
|
|
192
|
+
Nothing waits idle-marker. queue
|
|
193
|
+
--- from: assistant (TestBot)
|
|
194
|
+
idle ok
|
|
195
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
196
|
+
`)
|
|
197
|
+
})
|
package/src/queue.e2e.test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Phase 3: the queue on the native OpenCode inbox. `. queue` waits for the run,
|
|
2
|
-
// message delete/edit and /clear-queue change the inbox.
|
|
2
|
+
// message delete/edit and /clear-queue change the inbox. Other sources
|
|
3
|
+
// (CLI, TUI, promotion) are in queue-sources.e2e.
|
|
3
4
|
|
|
4
5
|
import fs from 'node:fs'
|
|
5
6
|
import { setTimeout as sleep } from 'node:timers/promises'
|
|
@@ -29,7 +30,7 @@ function reply(marker: string, text: string): DeterministicMatcher {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const matchers: DeterministicMatcher[] = [
|
|
32
|
-
slowTextMatcher({ marker: 'slow-marker', text: 'slow-done', delayMs:
|
|
33
|
+
slowTextMatcher({ marker: 'slow-marker', text: 'slow-done', delayMs: 1_500 }),
|
|
33
34
|
reply('steer-marker', 'steer ok'),
|
|
34
35
|
reply('queued-one', 'queued one ok'),
|
|
35
36
|
reply('queued-two', 'queued two ok'),
|
|
@@ -94,15 +95,15 @@ async function expectNever({ threadId, text }: { threadId: string; text: string
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
test('. queue waits for the run, acks with position,
|
|
98
|
+
test('. queue waits for the run, acks with position, replies to the message when it starts', async () => {
|
|
98
99
|
const thread = await startSlowThread('Queue after me')
|
|
99
100
|
const user = twin.discord.thread(thread.id).user(TEST_USER_ID)
|
|
100
|
-
await user.sendMessage({ content: 'First queued-one. queue' })
|
|
101
|
+
const first = await user.sendMessage({ content: 'First queued-one. queue' })
|
|
101
102
|
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'position 1' })
|
|
102
|
-
await user.sendMessage({ content: 'Second queued-two. queue' })
|
|
103
|
+
const second = await user.sendMessage({ content: 'Second queued-two. queue' })
|
|
103
104
|
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'queued two ok' })
|
|
104
105
|
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 3 })
|
|
105
|
-
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
106
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
106
107
|
"--- from: user (tommy)
|
|
107
108
|
Queue after me slow-marker
|
|
108
109
|
--- from: assistant (TestBot)
|
|
@@ -110,20 +111,27 @@ test('. queue waits for the run, acks with position, echoes when it starts', asy
|
|
|
110
111
|
--- from: user (tommy)
|
|
111
112
|
First queued-one. queue
|
|
112
113
|
--- from: assistant (TestBot)
|
|
113
|
-
|
|
114
|
+
[reply to tommy: First queued-one. queue]
|
|
115
|
+
-# Queued
|
|
114
116
|
--- from: user (tommy)
|
|
115
117
|
Second queued-two. queue
|
|
116
118
|
--- from: assistant (TestBot)
|
|
117
|
-
|
|
119
|
+
[reply to tommy: Second queued-two. queue]
|
|
120
|
+
-# Queued
|
|
118
121
|
slow-done
|
|
119
|
-
-# *
|
|
120
|
-
|
|
122
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
123
|
+
[reply to tommy: First queued-one. queue]
|
|
124
|
+
-# Queued message sent
|
|
121
125
|
queued one ok
|
|
122
|
-
-# *
|
|
123
|
-
|
|
126
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
127
|
+
[reply to tommy: Second queued-two. queue]
|
|
128
|
+
-# Queued message sent
|
|
124
129
|
queued two ok
|
|
125
|
-
-# *
|
|
130
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
126
131
|
`)
|
|
132
|
+
const messages = await twin.discord.thread(thread.id).getMessages()
|
|
133
|
+
const sent = messages.filter((message) => message.content === '-# Queued message sent')
|
|
134
|
+
expect(sent.map((message) => message.message_reference?.message_id)).toEqual([first.id, second.id])
|
|
127
135
|
})
|
|
128
136
|
|
|
129
137
|
test('message delete takes items out of the queue, edit re-queues', async () => {
|
|
@@ -163,24 +171,29 @@ test('message delete takes items out of the queue, edit re-queues', async () =>
|
|
|
163
171
|
|
|
164
172
|
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'edited ok' })
|
|
165
173
|
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 2 })
|
|
166
|
-
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
174
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
167
175
|
"--- from: user (tommy)
|
|
168
176
|
Queue edits slow-marker
|
|
169
177
|
--- from: assistant (TestBot)
|
|
170
178
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
179
|
+
[reply to unknown message]
|
|
171
180
|
-# Removed from queue
|
|
181
|
+
[reply to unknown message]
|
|
172
182
|
-# Removed from queue
|
|
173
183
|
--- from: user (tommy)
|
|
174
184
|
New text edited-marker. queue
|
|
175
185
|
[attachment: queued-notes.txt]
|
|
176
186
|
--- from: assistant (TestBot)
|
|
187
|
+
[reply to tommy: New text edited-marker. queue]
|
|
177
188
|
-# Removed from queue
|
|
178
|
-
|
|
189
|
+
[reply to tommy: New text edited-marker. queue]
|
|
190
|
+
-# Queued
|
|
179
191
|
slow-done
|
|
180
|
-
-# *
|
|
181
|
-
|
|
192
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
193
|
+
[reply to tommy: New text edited-marker. queue]
|
|
194
|
+
-# Queued message sent
|
|
182
195
|
edited ok
|
|
183
|
-
-# *
|
|
196
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
184
197
|
`)
|
|
185
198
|
await expectNever({ threadId: thread.id, text: 'queued one ok' })
|
|
186
199
|
await expectNever({ threadId: thread.id, text: 'queued two ok' })
|
|
@@ -204,7 +217,7 @@ test('a revoked user cannot replace a queued prompt', async () => {
|
|
|
204
217
|
await twin.discord.prisma.guildMember.update({ where: member, data: { roles: JSON.stringify([deny.id]) } })
|
|
205
218
|
await user.editMessage({ messageId: queued.id, content: 'Replacement edited-marker. queue' })
|
|
206
219
|
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 2 })
|
|
207
|
-
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
220
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
208
221
|
"--- from: user (tommy)
|
|
209
222
|
Queue before revocation slow-marker
|
|
210
223
|
--- from: assistant (TestBot)
|
|
@@ -212,12 +225,14 @@ test('a revoked user cannot replace a queued prompt', async () => {
|
|
|
212
225
|
--- from: user (tommy)
|
|
213
226
|
Replacement edited-marker. queue
|
|
214
227
|
--- from: assistant (TestBot)
|
|
215
|
-
|
|
228
|
+
[reply to tommy: Replacement edited-marker. queue]
|
|
229
|
+
-# Queued
|
|
216
230
|
slow-done
|
|
217
|
-
-# *
|
|
218
|
-
|
|
231
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
232
|
+
[reply to tommy: Replacement edited-marker. queue]
|
|
233
|
+
-# Queued message sent
|
|
219
234
|
queued one ok
|
|
220
|
-
-# *
|
|
235
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
221
236
|
`)
|
|
222
237
|
expect(await twin.discord.thread(thread.id).text()).toContain('queued one ok')
|
|
223
238
|
expect(await twin.discord.thread(thread.id).text()).not.toContain('edited ok')
|
|
@@ -233,21 +248,24 @@ test('/queue and /clear-queue', async () => {
|
|
|
233
248
|
await user.runSlashCommand({ name: 'clear-queue', options: [{ name: 'position', type: 4, value: 1 }] })
|
|
234
249
|
await waitForBotMessageContaining({ discord: twin.discord, threadId: thread.id, text: 'queued two ok' })
|
|
235
250
|
await waitForFooter({ discord: twin.discord, threadId: thread.id, count: 2 })
|
|
236
|
-
expect(await twin.discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
251
|
+
expect(await twin.discord.thread(thread.id).text({ showReplies: true })).toMatchInlineSnapshot(`
|
|
237
252
|
"--- from: user (tommy)
|
|
238
253
|
Slash queue slow-marker
|
|
239
254
|
--- from: assistant (TestBot)
|
|
240
255
|
-# *using deterministic-provider/deterministic-v2 ⋅ build*
|
|
241
|
-
» **tommy:** Slash queued-one
|
|
256
|
+
-# » **tommy:** Slash queued-one
|
|
257
|
+
[reply to TestBot: -# » **tommy:** Slash queued-one]
|
|
242
258
|
-# Removed from queue
|
|
243
|
-
» **tommy:** Slash queued-two
|
|
244
|
-
-#
|
|
259
|
+
-# » **tommy:** Slash queued-two
|
|
260
|
+
[reply to TestBot: -# » **tommy:** Slash queued-two]
|
|
261
|
+
-# Queued
|
|
245
262
|
-# Cleared 1 queued message
|
|
246
263
|
slow-done
|
|
247
|
-
-# *
|
|
248
|
-
» **tommy:** Slash queued-two
|
|
264
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
265
|
+
[reply to TestBot: -# » **tommy:** Slash queued-two]
|
|
266
|
+
-# Queued message sent
|
|
249
267
|
queued two ok
|
|
250
|
-
-# *
|
|
268
|
+
-# *main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
251
269
|
`)
|
|
252
270
|
await expectNever({ threadId: thread.id, text: 'queued one ok' })
|
|
253
271
|
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { expect, test } from 'vitest'
|
|
2
|
+
import { formatEcho } from './queue.ts'
|
|
3
|
+
import { markdownPayloads } from './markdown/components.ts'
|
|
4
|
+
|
|
5
|
+
test('echo puts block markdown on the line below the prefix', () => {
|
|
6
|
+
const texts = ['plain text', '# Title', '> quote', '- item', '1. step', '```ts\ncode\n```', '---', '| a | b |', '-# small', 'use #hashtag', '5 > 3', '**bold** start']
|
|
7
|
+
expect(texts.map((text) => formatEcho({ username: 'CLI', text }))).toMatchInlineSnapshot(`
|
|
8
|
+
[
|
|
9
|
+
"-# » **CLI:** plain text",
|
|
10
|
+
"-# » **CLI:**
|
|
11
|
+
-# **Title**",
|
|
12
|
+
"-# » **CLI:**
|
|
13
|
+
-# > quote",
|
|
14
|
+
"-# » **CLI:**
|
|
15
|
+
-# - item",
|
|
16
|
+
"-# » **CLI:**
|
|
17
|
+
-# 1. step",
|
|
18
|
+
"-# » **CLI:**
|
|
19
|
+
\`\`\`ts
|
|
20
|
+
code
|
|
21
|
+
\`\`\`",
|
|
22
|
+
"-# » **CLI:**
|
|
23
|
+
-# ---",
|
|
24
|
+
"-# » **CLI:**
|
|
25
|
+
-# | a | b |",
|
|
26
|
+
"-# » **CLI:**
|
|
27
|
+
-# small",
|
|
28
|
+
"-# » **CLI:** use #hashtag",
|
|
29
|
+
"-# » **CLI:** 5 > 3",
|
|
30
|
+
"-# » **CLI:** **bold** start",
|
|
31
|
+
]
|
|
32
|
+
`)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('echo is subtext, code blocks stay as they are', () => {
|
|
36
|
+
const text = '## Plan\n\n- read `queue.ts`\n- run tests\n\n```ts\nconst a = 1\n\nconst b = 2\n```\n-# already small\nlast line'
|
|
37
|
+
expect('\n' + formatEcho({ username: 'CLI', text })).toMatchInlineSnapshot(`
|
|
38
|
+
"
|
|
39
|
+
-# » **CLI:**
|
|
40
|
+
-# **Plan**
|
|
41
|
+
-# - read \`queue.ts\`
|
|
42
|
+
-# - run tests
|
|
43
|
+
\`\`\`ts
|
|
44
|
+
const a = 1
|
|
45
|
+
|
|
46
|
+
const b = 2
|
|
47
|
+
\`\`\`
|
|
48
|
+
-# already small
|
|
49
|
+
-# last line"
|
|
50
|
+
`)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('long subtext echo splits into messages that keep subtext on every line', () => {
|
|
54
|
+
const text = Array.from({ length: 120 }, (_, index) => `line ${index} of a long prompt sent from the CLI`).join('\n')
|
|
55
|
+
const payloads = markdownPayloads(formatEcho({ username: 'CLI', text }))
|
|
56
|
+
const lines = payloads.flatMap((payload) => String(Reflect.get(payload, 'content') ?? 'not text').split('\n'))
|
|
57
|
+
expect(payloads.length).toBeGreaterThan(1)
|
|
58
|
+
expect(lines.filter((line) => line !== '' && !line.startsWith('-# '))).toEqual([])
|
|
59
|
+
})
|