@spunto/design-system 0.53.0 → 0.53.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/design-system",
3
- "version": "0.53.0",
3
+ "version": "0.53.2",
4
4
  "description": "Spunto's shared design system — green tokens (conservatory + sprout), color constants, and UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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
- /** The project's `taskAgentProtocol`. `claude-stream` is interactive: answer while it works, and Stop. */
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 === "claude-stream"
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 {
@@ -236,19 +236,19 @@ export function TaskMachine({ task, worker, node = null, stats = null, ports = [
236
236
  // ── The boot panel, centre column ────────────────────────────────────────────────────────────
237
237
 
238
238
  export type TaskBootStep = {
239
- /** `machine` | `container` | `setup` | `branch` | `reset` | `session`. */
239
+ /** `machine` | `container` | `setup` | `branch` | `session`. */
240
240
  key: string
241
241
  label: string
242
242
  state: StepState
243
243
  detail?: string
244
- /** The platform's commands behind the step (Branch, Reset) — what its log is drawn from. */
244
+ /** The platform's commands behind the step (Branch) — what its log is drawn from. */
245
245
  commands?: TaskCommand[]
246
246
  }
247
247
 
248
248
  /**
249
249
  * A log per boot step, keyed by `TaskBootStep.key`, shown in a sheet when its row is clicked.
250
250
  *
251
- * Branch and Reset need nothing here: their output is already in `commands`, so `TaskBoot` draws
251
+ * Branch needs nothing here: its output is already in `commands`, so `TaskBoot` draws
252
252
  * it itself (`TaskCommandTerminal`). The others live where the package cannot reach — the image
253
253
  * build's log, the container's stdout (where every setup phase prints) — so the app passes them
254
254
  * in, typically its own socket-backed panels. An element is only a description: nothing is
@@ -349,22 +349,8 @@ export function bootSteps({
349
349
  commands: branchCommands.length > 0 ? branchCommands : undefined,
350
350
  }
351
351
 
352
- // Only a recycled machine runs the project's reset command, so the step exists if and only if
353
- // that command has a row — the same rule as everything else here: nothing ran, nothing to show.
354
- const resetCommand = commands.find((c) => (c.label ?? "") === "Reset")
355
- const reset: TaskBootStep | null = resetCommand
356
- ? {
357
- key: "reset",
358
- label: "Reset",
359
- state:
360
- resetCommand.status === "running" ? "running" : resetCommand.status === "succeeded" ? "done" : "error",
361
- detail: "putting the reused machine back in shape",
362
- commands: [resetCommand],
363
- }
364
- : null
365
-
366
352
  const queued = task.state === "queued"
367
- const ready = branchState === "done" && (!reset || reset.state === "done")
353
+ const ready = branchState === "done"
368
354
  const session: TaskBootStep = {
369
355
  key: "session",
370
356
  label: "Agent session",
@@ -372,9 +358,7 @@ export function bootSteps({
372
358
  detail: task.startedAt
373
359
  ? "started"
374
360
  : queued
375
- ? reset && reset.state !== "done"
376
- ? "starts once the machine is back in shape"
377
- : "starts as soon as the branch is ready"
361
+ ? "starts as soon as the branch is ready"
378
362
  : "never started",
379
363
  }
380
364
 
@@ -382,7 +366,7 @@ export function bootSteps({
382
366
  // machine's state *now* — and a task that is over no longer owns its machine, so those two rows
383
367
  // would describe someone else's boot. What is left is recorded: which worker it got, whether
384
368
  // its branch commands ran, whether a session ever started.
385
- const rest = reset ? [branch, reset, session] : [branch, session]
369
+ const rest = [branch, session]
386
370
  return queued ? [machine, container, setupStep, ...rest] : [machine, ...rest]
387
371
  }
388
372
 
@@ -112,12 +112,11 @@ describe("boot steps", () => {
112
112
  expect(steps.find((s) => s.key === "session")?.state).toBe("running")
113
113
  })
114
114
 
115
- it("hangs its own commands on the branch and reset steps — their log", () => {
116
- const reset: TaskCommand = { ...branchSetup("running"), id: "c2", label: "Reset" }
117
- const steps = bootSteps({ task: task({ state: "queued" }), worker: null, commands: [branchSetup("succeeded"), reset] })
115
+ it("hangs its own commands on the branch step — its log", () => {
116
+ const steps = bootSteps({ task: task({ state: "queued" }), worker: null, commands: [branchSetup("succeeded")] })
118
117
  expect(steps.find((s) => s.key === "branch")?.commands?.map((c) => c.id)).toEqual(["c1"])
119
- expect(steps.find((s) => s.key === "reset")?.commands?.map((c) => c.id)).toEqual(["c2"])
120
118
  expect(steps.find((s) => s.key === "machine")?.commands).toBeUndefined()
119
+ expect(steps.map((s) => s.key)).not.toContain("reset")
121
120
  })
122
121
  })
123
122
 
@@ -326,6 +325,19 @@ describe("TaskComposer", () => {
326
325
  expect(screen.getByRole("textbox").getAttribute("placeholder")).toMatch(/reads its prompt once/)
327
326
  })
328
327
 
328
+ it("lets an agent app's session be answered while it works — every runner is interactive", () => {
329
+ for (const protocol of ["claude-runner", "codex-runner"]) {
330
+ const onSubmit = vi.fn()
331
+ const { unmount } = render(<TaskComposer state="running" canResume protocol={protocol} onSubmit={onSubmit} />)
332
+ const box = screen.getByRole("textbox") as HTMLTextAreaElement
333
+ expect(box.disabled).toBe(false)
334
+ fireEvent.change(box, { target: { value: "also fix the tests" } })
335
+ fireEvent.keyDown(box, { key: "Enter" })
336
+ expect(onSubmit).toHaveBeenCalledWith("also fix the tests", [])
337
+ unmount()
338
+ }
339
+ })
340
+
329
341
  it("sends on Enter in an interactive session, and clears the box", () => {
330
342
  const onSubmit = vi.fn()
331
343
  render(<TaskComposer state="running" protocol="claude-stream" canResume onSubmit={onSubmit} onInterrupt={() => {}} />)