@spunto/design-system 0.53.0 → 0.53.1
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/package.json
CHANGED
|
@@ -37,11 +37,21 @@ import type { DraftFile, TaskPendingAction } from "./types"
|
|
|
37
37
|
* how big it is, which is all there is to say about a tarball.
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The protocols whose harness stays alive with an open stdin between turns: the CLI's interactive
|
|
42
|
+
* stream, and every agent app's runner (RFC 0048) — mirrors `isInteractive` of
|
|
43
|
+
* `@spunto/build/agent-stream`, which this package does not depend on.
|
|
44
|
+
*/
|
|
45
|
+
export const INTERACTIVE_PROTOCOLS: ReadonlySet<string> = new Set(["claude-stream", "claude-runner", "codex-runner"])
|
|
46
|
+
|
|
40
47
|
export interface TaskComposerProps {
|
|
41
48
|
state: string
|
|
42
49
|
/** Did the stream give us a session id to resume? Without one there is nothing to continue. */
|
|
43
50
|
canResume?: boolean
|
|
44
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* How the session is read (`claude-stream`, or an agent app's `claude-runner` / `codex-runner`…).
|
|
53
|
+
* An interactive one is answered while it works, and stopped (`INTERACTIVE_PROTOCOLS`).
|
|
54
|
+
*/
|
|
45
55
|
protocol: string
|
|
46
56
|
/**
|
|
47
57
|
* The turn: the words, and the files prepared in the browser (`DraftFile.data` is base64). The
|
|
@@ -95,7 +105,7 @@ export function TaskComposer({
|
|
|
95
105
|
// Interactive: the harness is alive with an open stdin, so it can be talked to *while it
|
|
96
106
|
// works*, and asked to stop. One-shot: its stdin closed with the prompt, so the only moment
|
|
97
107
|
// there is anywhere to put words is once it has handed back.
|
|
98
|
-
const interactive = protocol
|
|
108
|
+
const interactive = INTERACTIVE_PROTOCOLS.has(protocol)
|
|
99
109
|
|
|
100
110
|
const reason =
|
|
101
111
|
pendingAction === "accepting"
|
|
@@ -48,7 +48,7 @@ export type { TaskDetailsProps } from "./task-details"
|
|
|
48
48
|
// ── The conversation ────────────────────────────────────────────────────────────────────────
|
|
49
49
|
export { TaskEventStream } from "./event-stream"
|
|
50
50
|
export type { ReplyDelivery, TaskEventStreamProps } from "./event-stream"
|
|
51
|
-
export { TaskComposer } from "./composer"
|
|
51
|
+
export { INTERACTIVE_PROTOCOLS, TaskComposer } from "./composer"
|
|
52
52
|
export type { TaskComposerProps } from "./composer"
|
|
53
53
|
export { AgentMarkdown, renderInlineMarkdown } from "./agent-markdown"
|
|
54
54
|
export {
|
|
@@ -326,6 +326,19 @@ describe("TaskComposer", () => {
|
|
|
326
326
|
expect(screen.getByRole("textbox").getAttribute("placeholder")).toMatch(/reads its prompt once/)
|
|
327
327
|
})
|
|
328
328
|
|
|
329
|
+
it("lets an agent app's session be answered while it works — every runner is interactive", () => {
|
|
330
|
+
for (const protocol of ["claude-runner", "codex-runner"]) {
|
|
331
|
+
const onSubmit = vi.fn()
|
|
332
|
+
const { unmount } = render(<TaskComposer state="running" canResume protocol={protocol} onSubmit={onSubmit} />)
|
|
333
|
+
const box = screen.getByRole("textbox") as HTMLTextAreaElement
|
|
334
|
+
expect(box.disabled).toBe(false)
|
|
335
|
+
fireEvent.change(box, { target: { value: "also fix the tests" } })
|
|
336
|
+
fireEvent.keyDown(box, { key: "Enter" })
|
|
337
|
+
expect(onSubmit).toHaveBeenCalledWith("also fix the tests", [])
|
|
338
|
+
unmount()
|
|
339
|
+
}
|
|
340
|
+
})
|
|
341
|
+
|
|
329
342
|
it("sends on Enter in an interactive session, and clears the box", () => {
|
|
330
343
|
const onSubmit = vi.fn()
|
|
331
344
|
render(<TaskComposer state="running" protocol="claude-stream" canResume onSubmit={onSubmit} onInterrupt={() => {}} />)
|