spequi 0.0.0-stage → 0.1.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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +290 -2
  3. package/bin/spequi.mjs +47 -0
  4. package/docs/agent-workflow.md +470 -0
  5. package/package.json +70 -4
  6. package/public/app.css +62 -0
  7. package/public/app.js +228 -0
  8. package/public/diff.css +217 -0
  9. package/public/fonts/README.md +22 -0
  10. package/public/fonts/dm-sans-OFL.txt +93 -0
  11. package/public/fonts/dm-sans-variable-latin-ext.woff2 +0 -0
  12. package/public/fonts/dm-sans-variable-latin.woff2 +0 -0
  13. package/public/fonts/ibm-plex-mono-400-cyrillic-ext.woff2 +0 -0
  14. package/public/fonts/ibm-plex-mono-400-cyrillic.woff2 +0 -0
  15. package/public/fonts/ibm-plex-mono-400-latin-ext.woff2 +0 -0
  16. package/public/fonts/ibm-plex-mono-400-latin.woff2 +0 -0
  17. package/public/fonts/ibm-plex-mono-400-vietnamese.woff2 +0 -0
  18. package/public/fonts/ibm-plex-mono-500-cyrillic-ext.woff2 +0 -0
  19. package/public/fonts/ibm-plex-mono-500-cyrillic.woff2 +0 -0
  20. package/public/fonts/ibm-plex-mono-500-latin-ext.woff2 +0 -0
  21. package/public/fonts/ibm-plex-mono-500-latin.woff2 +0 -0
  22. package/public/fonts/ibm-plex-mono-500-vietnamese.woff2 +0 -0
  23. package/public/fonts/ibm-plex-mono-OFL.txt +93 -0
  24. package/public/fonts.css +109 -0
  25. package/public/lifecycle.css +93 -0
  26. package/public/lifecycle.js +84 -0
  27. package/public/review.css +272 -0
  28. package/public/review.js +358 -0
  29. package/public/session.js +50 -0
  30. package/public/studio.css +161 -0
  31. package/public/studio.js +188 -0
  32. package/skills/spequi/SKILL.md +74 -0
  33. package/src/agent-session.mjs +32 -0
  34. package/src/commands.mjs +49 -0
  35. package/src/comment-controls.mjs +10 -0
  36. package/src/comment-view.mjs +51 -0
  37. package/src/creation-view.mjs +13 -0
  38. package/src/diff-comments.mjs +8 -0
  39. package/src/diff-view.mjs +70 -0
  40. package/src/diffs.mjs +88 -0
  41. package/src/direct-preview.mjs +168 -0
  42. package/src/document-view.mjs +75 -0
  43. package/src/feedback.mjs +86 -0
  44. package/src/files.mjs +50 -0
  45. package/src/highlighting.mjs +91 -0
  46. package/src/impact-view.mjs +30 -0
  47. package/src/impact.mjs +161 -0
  48. package/src/job-dialogue.mjs +41 -0
  49. package/src/jobs.mjs +174 -0
  50. package/src/lifecycle-view.mjs +58 -0
  51. package/src/lifecycle.mjs +119 -0
  52. package/src/openspec-cli.mjs +40 -0
  53. package/src/preview-view.mjs +83 -0
  54. package/src/previews.mjs +112 -0
  55. package/src/project.mjs +59 -0
  56. package/src/review-store.mjs +150 -0
  57. package/src/review-view.mjs +23 -0
  58. package/src/server.mjs +175 -0
  59. package/src/source-preview-view.mjs +14 -0
  60. package/src/spec-context-view.mjs +37 -0
  61. package/src/spec-context.mjs +147 -0
  62. package/src/spec-impact.mjs +145 -0
  63. package/src/specs.mjs +80 -0
  64. package/src/studio-documents.mjs +25 -0
  65. package/src/studio-plans.mjs +71 -0
  66. package/src/studio-view.mjs +93 -0
  67. package/src/views.mjs +101 -0
  68. package/templates/cli.mjs +38 -0
@@ -0,0 +1,470 @@
1
+ # How Spequi attaches an agent and runs skills
2
+
3
+ This document describes the current implementation: how the app hands work to an existing coding agent, how that agent follows another skill, how questions wait for an answer in the UI, and how results return to the app.
4
+
5
+ **The app does not call a model or start a coding agent.** You invoke the `spequi` skill in an existing agent session. That agent runs local CLI commands, reads workflow instructions, performs the work through its tools, and reports completion.
6
+
7
+ There is no `await invokeSkill()` implementation. A skill is an instruction document that the current agent reads and follows. Completion is an explicit job update, not a return value from another skill process.
8
+
9
+ ## 1. The components
10
+
11
+ | Component | Responsibility | Implementation |
12
+ | --- | --- | --- |
13
+ | Browser UI | Submit actions, display progress, collect answers | [public/lifecycle.js](../public/lifecycle.js), [src/studio-view.mjs](../src/studio-view.mjs) |
14
+ | Local server | Protect browser mutations, route actions and replies, notify the UI | [src/server.mjs](../src/server.mjs) |
15
+ | Lifecycle layer | Check readiness and enqueue the requested action | [src/lifecycle.mjs](../src/lifecycle.mjs) |
16
+ | Job queue | Persist requests, claim ownership, choose workflows, store results | [src/jobs.mjs](../src/jobs.mjs) |
17
+ | Agent CLI | Report a session, poll, ask, wait, log, finish or fail | [bin/spequi.mjs](../bin/spequi.mjs) |
18
+ | Session evidence | Store credential-free agent/MCP reports and evaluate freshness | [src/agent-session.mjs](../src/agent-session.mjs) |
19
+ | Question storage | Retain questions and answers on the same owned job | [src/job-dialogue.mjs](../src/job-dialogue.mjs) |
20
+ | Agent skill | Instruct the current agent to coordinate the loop | [spequi SKILL.md](../skills/spequi/SKILL.md) |
21
+
22
+ The browser talks to the server over local HTTP and receives WebSocket notifications. The agent's CLI commands communicate through project-local files. They do not send prompts over the browser's WebSocket connection.
23
+
24
+ Typical retained state looks like:
25
+
26
+ ```text
27
+ .spequi/
28
+ cli.mjs Project launcher for the initialized package
29
+ server.mjs Project server launcher
30
+ agent.json Latest agent heartbeat
31
+ agent-session.json Session ID and reported MCP metadata
32
+ jobs/
33
+ <job-id>.json Action, ownership, status, questions, logs and result
34
+ previews/
35
+ <job-id>/
36
+ baseline/ Files captured before implementation
37
+ work/ Isolated project copy assigned to the agent
38
+ proposed/ Frozen changed files after completion
39
+ manifest.json Baseline fingerprints
40
+ result.json Diff metadata and application state
41
+ ```
42
+
43
+ ## 2. Attachment starts in the coding agent
44
+
45
+ The user invokes the installed skill using the host's convention, such as `$spequi` in Codex, `/skills spequi` in Sber/GitVerse GigaCode CLI, or `/spequi` in a CLI with that wrapper. The host makes the skill instructions available to the existing agent session.
46
+
47
+ The skill tells the agent to reuse the project's initialized launcher and existing server. This avoids requiring a global installation or starting a second agent.
48
+
49
+ ### GigaCode registration
50
+
51
+ The installer registers GigaCode alongside the existing agents. Project initialization and `skill install` create:
52
+
53
+ ```text
54
+ .gigacode/
55
+ skills/spequi/SKILL.md
56
+ commands/spequi.md
57
+ ```
58
+
59
+ `skill install --global` creates the same paths under the user's home directory. The command wrappers reference the skill in the matching scope and use GigaCode's `{{args}}` parameter syntax. After discovery, invoke `/skills spequi` or `/spequi`. These paths and formats follow GigaCode's [skills](https://gitverse.ru/docs/ai/ai-assistant-gigacode/gigacode-cli/skills) and [commands](https://gitverse.ru/docs/ai/ai-assistant-gigacode/gigacode-cli/commands) documentation.
60
+
61
+ The installer registers the viewer skill; it does not install other OpenSpec workflows. Those must be discoverable separately. Registration and refresh behavior are tested locally; indefinite polling in a real GigaCode session still requires an integration test.
62
+
63
+ ### Register a session
64
+
65
+ The agent creates a small report under `.spequi`. This is an illustrative report, not a real attachment identifier:
66
+
67
+ ```json
68
+ {
69
+ "sessionId": "example-attachment",
70
+ "mcps": {
71
+ "supported": false,
72
+ "connections": []
73
+ }
74
+ }
75
+ ```
76
+
77
+ Then it runs this command from the project root:
78
+
79
+ ```bash
80
+ node .spequi/cli.mjs agent report \
81
+ --file .spequi/session-report.json \
82
+ --name Codex
83
+ ```
84
+
85
+ `reportSession()` validates the report and stores the attachment evidence. The essential writes are:
86
+
87
+ ```js
88
+ const report = {
89
+ agent,
90
+ sessionId: id,
91
+ reportedAt: Date.now(),
92
+ mcps: { supported: mcps.supported, connections }
93
+ };
94
+
95
+ await writeJSON(runtime(root, 'agent-session.json'), report);
96
+ await writeJSON(runtime(root, 'agent.json'), {
97
+ agent,
98
+ sessionId: id,
99
+ at: Date.now()
100
+ });
101
+ ```
102
+
103
+ Source: [`reportSession()`](../src/agent-session.mjs).
104
+
105
+ This session ID belongs to the viewer attachment. It is not a provider API credential or an integration with the coding tool's internal conversation ID. The agent retains it and uses it on subsequent polls.
106
+
107
+ ### Poll for work
108
+
109
+ ```bash
110
+ node .spequi/cli.mjs agent next \
111
+ --wait 20 \
112
+ --name Codex \
113
+ --session-id example-attachment
114
+ ```
115
+
116
+ The CLI checks for queued work once per second during that bounded wait. It returns immediately when it claims a job; otherwise it returns `{"job":null}` after the timeout. The agent then polls again while the skill remains active.
117
+
118
+ The following is the actual polling structure, shortened to show the relevant branch:
119
+
120
+ ```js
121
+ const wait = Math.min(60, Math.max(0, Number(option('wait', 0)) || 0));
122
+ const deadline = Date.now() + wait * 1000;
123
+ let job;
124
+
125
+ do {
126
+ job = await claimNext(
127
+ root,
128
+ option('name', 'Skill agent'),
129
+ option('session-id')
130
+ );
131
+ if (job || Date.now() >= deadline) break;
132
+ await delay(1000);
133
+ } while (true);
134
+
135
+ print({ job });
136
+ ```
137
+
138
+ Source: [`agent next` in the CLI](../bin/spequi.mjs).
139
+
140
+ ## 3. A UI action becomes a durable job
141
+
142
+ For example, a user requests an implementation preview. The browser submits the selected change to the lifecycle route:
143
+
144
+ ```js
145
+ // Simplified browser request. The selected change must already be ready.
146
+ await fetch('/api/lifecycle/actions', {
147
+ method: 'POST',
148
+ headers: {
149
+ 'Content-Type': 'application/json',
150
+ Accept: 'application/json',
151
+ 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]').content
152
+ },
153
+ body: JSON.stringify({
154
+ action: 'preview',
155
+ change: 'example-change'
156
+ })
157
+ });
158
+ ```
159
+
160
+ The server checks the local request boundary. The lifecycle layer checks whether the selected action is permitted, then creates a queued job. A simplified shape is:
161
+
162
+ ```json
163
+ {
164
+ "id": "example-job-id",
165
+ "action": "preview",
166
+ "change": "example-change",
167
+ "status": "queued",
168
+ "message": ""
169
+ }
170
+ ```
171
+
172
+ The job is written under `.spequi/jobs/`. It remains available if the browser reloads or no agent is currently polling.
173
+
174
+ Source: [`requestLifecycle()`](../src/lifecycle.mjs) and [`createJob()` / `enqueue()`](../src/jobs.mjs).
175
+
176
+ ## 4. Claiming establishes ownership and selects the skill
177
+
178
+ `claimNext()` updates the heartbeat, acquires the queue lock and selects the oldest queued request. It changes the job to `running`, assigns a random claim token and records the agent attachment identity.
179
+
180
+ The claim token is required for the agent's subsequent log, question, input and completion commands. A second agent cannot complete the same job just by knowing its ID.
181
+
182
+ The action-to-skill mapping currently includes:
183
+
184
+ ```js
185
+ const skillRoutes = {
186
+ explore: { skill: 'openspec-explore', required: false },
187
+ propose: { skill: 'openspec-propose', required: true },
188
+ preview: { skill: 'openspec-apply-change', required: true },
189
+ verify: { skill: 'openspec-verify-change', required: false },
190
+ archive: { skill: 'openspec-archive-change', required: true },
191
+ impact: { skill: null, required: false },
192
+ 'update-specs': { skill: 'openspec-update-change', required: true },
193
+ 'create-change': { skill: null, required: false },
194
+ 'start-plan': { skill: null, required: false },
195
+ 'plan-next': { skill: null, required: false },
196
+ 'revise-plan': { skill: 'openspec-update-change', required: true },
197
+ 'sync-specs': { skill: 'openspec-sync-specs', required: true }
198
+ };
199
+ ```
200
+
201
+ Full-plan `start-plan` requests use the proposal route. Next-artifact requests use the bounded CLI workflow directly; they do not require another skill.
202
+
203
+ After selecting the route, `claimNext()` constructs the workflow:
204
+
205
+ ```js
206
+ job.workingDirectory = job.action === 'preview'
207
+ ? await createPreview(root, job.id)
208
+ : root;
209
+
210
+ job.workflow = {
211
+ mode: 'same-session',
212
+ ...(job.action === 'start-plan' && job.planMode === 'full'
213
+ ? skillRoutes.propose
214
+ : skillRoutes[job.action]),
215
+ directory: job.workingDirectory,
216
+ protocolDirectory: root,
217
+ change: job.change
218
+ };
219
+
220
+ job.instructions = instructions(job);
221
+ ```
222
+
223
+ Source: [`skillRoutes`, `instructions()` and `claimNext()`](../src/jobs.mjs).
224
+
225
+ ## 5. What “invoke another skill” actually means
226
+
227
+ The CLI returns a job containing a workflow such as this abbreviated example:
228
+
229
+ ```json
230
+ {
231
+ "action": "preview",
232
+ "workflow": {
233
+ "mode": "same-session",
234
+ "skill": "openspec-apply-change",
235
+ "required": true,
236
+ "directory": "/project/.spequi/previews/example-job-id/work",
237
+ "protocolDirectory": "/project",
238
+ "change": "example-change"
239
+ }
240
+ }
241
+ ```
242
+
243
+ The returned instructions explicitly tell the agent to load and follow that installed skill in the current session. They also prohibit starting another coding-agent process, subagent or model endpoint for the handoff.
244
+
245
+ The agent locates the skill through its host's skill discovery. In this repository, reading the apply skill can look like:
246
+
247
+ ```bash
248
+ cat .agents/skills/openspec-apply-change/SKILL.md
249
+ ```
250
+
251
+ **Reading that file does not execute a skill.** It gives the agent instructions. The agent then carries out those instructions through its normal tools: resolving OpenSpec status, reading artifacts, editing the assigned files and running checks.
252
+
253
+ For example, the apply workflow includes commands such as:
254
+
255
+ ```bash
256
+ # Run from the job's workflow.directory, which is the isolated copy for previews.
257
+ openspec context --json
258
+ openspec status --change example-change --json
259
+ openspec instructions apply --change example-change --json
260
+ ```
261
+
262
+ The same agent continues the task after reading the skill. There is no separate skill process to await, no injected slash command, and no new model session whose response must be collected.
263
+
264
+ If a required skill is missing, the agent must report failure instead of claiming the workflow ran. Optional read-only workflows have their documented direct-execution fallback.
265
+
266
+ The behavior contract lives in the [same-session routing section of the skill](../skills/spequi/SKILL.md). It is an agent instruction contract, not a JavaScript skill execution engine.
267
+
268
+ ## 6. Preview work uses two different directories
269
+
270
+ For an implementation preview:
271
+
272
+ | Directory | What happens there |
273
+ | --- | --- |
274
+ | `workflow.directory` | Read the copied planning context, implement, install needed dependencies and run checks inside the isolated copy |
275
+ | `workflow.protocolDirectory` | Run `agent log`, `ask`, `input`, `finish` and `fail` against the original project's queue |
276
+
277
+ All implementation edits, including task checkboxes, stay inside the preview copy. The agent must re-resolve OpenSpec roots there and refuse paths that escape it. The snapshot is not an OS sandbox; the agent must honor that boundary.
278
+
279
+ When the agent finishes, the application freezes the resulting changed files. It does not copy them into the original project automatically. The user reviews the diff and explicitly uses **Apply reviewed preview**, which checks for baseline conflicts.
280
+
281
+ Source: [`createPreview()`, `freezePreview()` and `applyPreview()`](../src/previews.mjs).
282
+
283
+ ### Spec links in implementation previews
284
+
285
+ Before finishing, the agent writes `.spequi/spec-links.json` **inside `workingDirectory`**. The job instructions and installed `spequi` skill include this format:
286
+
287
+ ```json
288
+ {
289
+ "version": 1,
290
+ "links": [
291
+ {
292
+ "file": "src/preferences.js",
293
+ "side": "proposed",
294
+ "start": 12,
295
+ "end": 18,
296
+ "spec": "openspec/changes/email-preferences/specs/email-preferences/spec.md",
297
+ "specStart": 3,
298
+ "specEnd": 9
299
+ }
300
+ ]
301
+ }
302
+ ```
303
+
304
+ Code and spec ranges are one-based and inclusive. Use final proposed line numbers for additions or modifications, or `"side": "current"` and baseline line numbers for deletions. Cite the original copied plan, with a range that explains the changed code. Supported sources are Markdown artifacts in the selected change and main specs under `openspec/specs/**/spec.md`. Do not invent links for unexplained edits.
305
+
306
+ On completion, the viewer validates that code ranges overlap actual changes, retains at most eight links per changed file, and verifies up to 80 spec lines per quote against the baseline manifest. It stores locations and fingerprints in `result.json`; quoted text is always read from the retained baseline. Invalid links are omitted with a notice. The report is optional, limited to 64 KiB and 100 links, and excluded from proposed source and application.
307
+
308
+ Both Unified and Split diffs show **Agent linked** quotes beside the corresponding change blocks. Repeated references link to the first quote. Old previews and imported patches without recorded links can receive **Suggested · file-level** quotes based on explicit file paths, unique filenames, or backticked changed identifiers in the saved change artifacts. These are candidate context, not evidence of why a specific block changed. No match or unavailable snapshot remains explicit; the viewer does not substitute the current working plan.
309
+
310
+ Source: [spec-context.mjs](../src/spec-context.mjs), [spec-context-view.mjs](../src/spec-context-view.mjs).
311
+
312
+ ## 7. Questions wait for an answer through the same job
313
+
314
+ If the selected workflow needs clarification or confirmation, the agent runs the following from `workflow.protocolDirectory`. `JOB_ID` and `CLAIM_TOKEN` stand for values returned by the claim; they are not literal identifiers to reuse.
315
+
316
+ ```bash
317
+ node .spequi/cli.mjs agent ask JOB_ID \
318
+ --token CLAIM_TOKEN \
319
+ --message "Which authentication method should this change support?" \
320
+ --options '["OAuth","Environment variable"]'
321
+ ```
322
+
323
+ `askJob()` verifies ownership, saves the question and transitions the job:
324
+
325
+ ```js
326
+ const question = {
327
+ id: randomUUID(),
328
+ message: message.trim(),
329
+ options,
330
+ askedAt: new Date().toISOString()
331
+ };
332
+
333
+ (job.questions ||= []).push(question);
334
+ job.status = 'awaiting-input';
335
+ ```
336
+
337
+ The agent then waits with:
338
+
339
+ ```bash
340
+ node .spequi/cli.mjs agent input JOB_ID \
341
+ --token CLAIM_TOKEN --wait 20
342
+ ```
343
+
344
+ The CLI reads the job once per second until the status changes or the timeout expires. If it is still `awaiting-input`, the agent repeats the bounded wait. It does not release the job or make a second claim.
345
+
346
+ The user answers through this protected browser route:
347
+
348
+ ```text
349
+ POST /api/lifecycle/jobs/<job-id>/reply
350
+ ```
351
+
352
+ `answerJob()` checks that the submitted question is still current and unanswered, then stores the answer:
353
+
354
+ ```js
355
+ question.answer = answer.trim();
356
+ question.answeredAt = new Date().toISOString();
357
+ job.status = 'running';
358
+ ```
359
+
360
+ The next `agent input` result contains that retained answer. The current agent reads it and resumes the same workflow. If the request is cancelled instead, the agent stops that work rather than continuing or waiting indefinitely. Browser reloads do not discard the question or answer because both are stored on the job.
361
+
362
+ Source: [`askJob()`, `answerJob()` and `jobInput()`](../src/job-dialogue.mjs), plus the reply route in [src/server.mjs](../src/server.mjs).
363
+
364
+ ## 8. Progress and completion are explicit
365
+
366
+ While working, the agent reports meaningful progress:
367
+
368
+ ```bash
369
+ node .spequi/cli.mjs agent log JOB_ID \
370
+ --token CLAIM_TOKEN \
371
+ --message "Implemented the form; checking validation and keyboard behavior."
372
+ ```
373
+
374
+ On success:
375
+
376
+ ```bash
377
+ node .spequi/cli.mjs agent finish JOB_ID \
378
+ --token CLAIM_TOKEN \
379
+ --message "Implemented the requested scope; checks passed."
380
+ ```
381
+
382
+ On failure:
383
+
384
+ ```bash
385
+ node .spequi/cli.mjs agent fail JOB_ID \
386
+ --token CLAIM_TOKEN \
387
+ --message "The required workflow is unavailable; implementation did not run."
388
+ ```
389
+
390
+ `updateJob()` checks the token and current state. It performs action-specific completion checks, such as requiring actual new planning artifacts, checking full-plan readiness, validating an impact report or freezing an implementation preview. It then persists the result:
391
+
392
+ ```js
393
+ job.status = 'completed';
394
+ job.result = message || 'Completed';
395
+ ```
396
+
397
+ The app waits for this explicit completion. It does not infer completion because the agent read a skill, produced a chat response, checked some task boxes, or stopped polling. The checks also do not prove every instruction was followed or every behavior is correct; verification and code review still matter.
398
+
399
+ After finishing or failing, the agent returns to `agent next` while attached.
400
+
401
+ Source: [`updateJob()`](../src/jobs.mjs).
402
+
403
+ ## 9. Liveness, MCP evidence and recovery
404
+
405
+ The current heartbeat check is:
406
+
407
+ ```js
408
+ const connected = Boolean(state && Date.now() - state.at < 45000);
409
+ ```
410
+
411
+ A recent heartbeat means the attachment has recently communicated. It does not prove a particular model request is progressing. Likewise, a missing heartbeat does not prove the coding process crashed: a long tool call or an agent that stopped running the loop can also make the attachment appear unresponsive.
412
+
413
+ Polling and owned log/input/question calls refresh the heartbeat. The agent must keep communicating during work; the implementation does not start an independent background heartbeat daemon.
414
+
415
+ MCP status is a separate report. The host must supply authoritative connection evidence; a configured server or a tool catalog alone is insufficient. Reports contain display names and allowed connection states, not credentials or transport configuration. MCP evidence also expires after five minutes and must match the current attachment.
416
+
417
+ The header displays **MCPs** when current connection evidence is unavailable. **0 MCPs** requires a fresh supported report confirming zero connected servers.
418
+
419
+ If the agent becomes unresponsive:
420
+
421
+ 1. Resume the `spequi` skill in the existing coding session.
422
+ 2. Check the agent indicator's recovery details and last heartbeat.
423
+ 3. If an old running request is stuck, stop its agent in the coding tool first. The app permits ending that request after its owner's heartbeat expires, then a new request can be submitted.
424
+
425
+ Ending a request changes queue state; it does not terminate an agent process or undo edits. Reattaching does not automatically reclaim or restart an old running job. The app cannot wake a stopped agent session by itself.
426
+
427
+ Source: [`heartbeat()` and `agentStatus()`](../src/jobs.mjs), [session freshness](../src/agent-session.mjs), and [the header/recovery UI](../public/session.js).
428
+
429
+ ## 10. The complete sequence
430
+
431
+ ```mermaid
432
+ sequenceDiagram
433
+ actor User
434
+ participant UI as Browser UI
435
+ participant App as Local server and job files
436
+ participant Agent as Existing coding-agent session
437
+ participant Skill as Installed SKILL.md
438
+
439
+ User->>Agent: Invoke spequi
440
+ Agent->>App: agent report and agent next
441
+ User->>UI: Request a workflow
442
+ UI->>App: POST lifecycle action
443
+ App->>App: Persist queued job
444
+ Agent->>App: agent next
445
+ App-->>Agent: Owned job, skill name, directories, instructions
446
+ Agent->>Skill: Read the selected skill
447
+ Skill-->>Agent: Workflow instructions
448
+ Note over Agent: The same agent executes the workflow through its tools
449
+ opt Clarification needed
450
+ Agent->>App: agent ask
451
+ App-->>UI: Question available
452
+ par Agent waits
453
+ loop While awaiting-input
454
+ Agent->>App: agent input --wait 20
455
+ App-->>Agent: Current question and status
456
+ end
457
+ and User answers
458
+ User->>UI: Submit answer
459
+ UI->>App: POST job reply
460
+ end
461
+ Note over Agent,App: The input result contains the retained answer and running status
462
+ end
463
+ Agent->>App: agent log
464
+ Agent->>App: agent finish or agent fail
465
+ App->>App: Validate completion and persist result
466
+ App-->>UI: Updated status and result
467
+ Agent->>App: Return to agent next
468
+ ```
469
+
470
+ The queue, ownership, persistence, questions and status checks are application code. Carrying out a selected skill is the cooperating agent's work in its existing session. Keeping those responsibilities explicit explains both why the flow works across skill-capable coding tools and why it pauses when the agent stops serving the queue.
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "spequi",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "A local workspace for planning, implementation previews, and OpenSpec code review",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/rahulnjs/spequi.git"
8
+ },
9
+ "homepage": "https://github.com/rahulnjs/spequi#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/rahulnjs/spequi/issues"
12
+ },
13
+ "keywords": [
14
+ "openspec",
15
+ "code-review",
16
+ "diff",
17
+ "specifications",
18
+ "htmx",
19
+ "agents"
20
+ ],
21
+ "type": "module",
22
+ "bin": {
23
+ "spequi": "bin/spequi.mjs"
24
+ },
25
+ "exports": {
26
+ ".": "./src/server.mjs"
27
+ },
28
+ "files": [
29
+ "bin/",
30
+ "src/",
31
+ "public/app.css",
32
+ "public/app.js",
33
+ "public/fonts.css",
34
+ "public/fonts/",
35
+ "public/diff.css",
36
+ "public/review.css",
37
+ "public/review.js",
38
+ "public/lifecycle.css",
39
+ "public/lifecycle.js",
40
+ "public/studio.css",
41
+ "public/studio.js",
42
+ "skills/",
43
+ "templates/",
44
+ "README.md",
45
+ "LICENSE",
46
+ "public/session.js",
47
+ "docs/agent-workflow.md"
48
+ ],
49
+ "scripts": {
50
+ "prepublishOnly": "npm run check",
51
+ "start": "node bin/spequi.mjs start",
52
+ "check": "node --check bin/spequi.mjs && node --check src/server.mjs && node --check src/project.mjs && node --check src/openspec-cli.mjs && node --check src/spec-context.mjs && node --check src/spec-context-view.mjs && node --check templates/cli.mjs && node --check public/app.js && node --check public/review.js && node --check public/lifecycle.js && node --check public/studio.js && node --check src/studio-view.mjs && node --check src/studio-plans.mjs && node --check src/studio-documents.mjs && node --check src/creation-view.mjs && node --check src/commands.mjs && node --check src/agent-session.mjs && node --check public/session.js"
53
+ },
54
+ "engines": {
55
+ "node": ">=20"
56
+ },
57
+ "license": "MIT",
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "dependencies": {
62
+ "chokidar": "^4.0.3",
63
+ "diff": "^8.0.2",
64
+ "hast-util-from-html": "~2.0.3",
65
+ "hast-util-sanitize": "^5.0.2",
66
+ "hast-util-to-html": "^9.0.6",
67
+ "htmx.org": "2.0.11",
68
+ "marked": "^17.0.1",
69
+ "shiki": "^4.6.0",
70
+ "ws": "^8.18.3"
71
+ }
72
+ }
package/public/app.css ADDED
@@ -0,0 +1,62 @@
1
+ :root{font-family:'DM Sans',sans-serif;color-scheme:light;--bg:#f7f8fa;--surface:#fdfdfe;--rail:#eef1f6;--panel:#f7f8fb;--text:#252d3c;--muted:#626f83;--line:#dfe4ed;--accent:#3f62b5;--accent-soft:#e6edfb;--accent-text:#2d4e99;--green:#23704c;--green-bg:#e4f3eb;--red:#a13843;--red-bg:#fcebed;--code:#f3f5f9;--ui:13px;--radius:7px;--rail-width:244px;--panel-width:282px;--prose:15px;--reader-pad:42px}
2
+ *{box-sizing:border-box}body{margin:0;font-size:var(--ui);background:var(--bg);color:var(--text);height:100dvh;overflow:hidden}a{color:inherit;text-decoration:none}button,input,select,textarea{font:inherit}button,a,select,input,textarea{outline-offset:3px}button,a,select{touch-action:manipulation}:focus-visible{outline:2px solid var(--accent)}::selection{background:var(--accent-soft);color:var(--accent-text)}input,textarea{caret-color:var(--accent)}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.5}svg{flex-shrink:0}small,.muted{color:var(--muted)}code,pre,kbd{font-family:'IBM Plex Mono',monospace}code{font-size:.88em}button,.button{transition:background .15s,border-color .15s,color .15s}button:hover,.button:hover{background:var(--rail)}.topbar{height:58px;display:flex;align-items:center;justify-content:space-between;padding:0 24px;border-bottom:1px solid var(--line);background:var(--surface)}.brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:17px;letter-spacing:-.4px}.brand>svg{color:var(--accent);width:25px;height:25px}.brand-suffix{font-weight:450;color:var(--muted)}.local-pill{font-size:9px;letter-spacing:1px;color:var(--muted);padding:3px 5px;border:1px solid var(--line);border-radius:3px;margin-left:3px}.topbar-end{display:flex;align-items:center;gap:12px}select{background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:var(--radius);padding:8px 28px 8px 10px;max-width:100%}.connection{display:flex;gap:6px;align-items:center;font-size:11px;color:var(--muted)}i{display:inline-block;width:6px;height:6px;border-radius:50%;background:#a28540;flex-shrink:0}.online i{background:var(--green)}.workspace{height:calc(100dvh - 58px);display:grid;grid-template-columns:var(--rail-width) minmax(0,1fr) var(--panel-width)}.sidebar{background:var(--rail);border-right:1px solid var(--line);padding:24px 15px 16px;display:flex;flex-direction:column;min-height:0;overflow:auto}.project-select{display:flex;align-items:center;gap:11px;padding:0 8px 24px}.project-select>svg:first-child{color:var(--accent);width:21px;height:21px}.project-select>svg:last-child{width:13px;margin-left:auto;color:var(--muted)}.project-select>div{flex:1;min-width:0}.project-select strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:650}.project-select small{display:block;font-size:11px;margin-top:3px}.search{position:relative;display:flex;align-items:center;margin-bottom:27px}.search svg{position:absolute;left:10px;width:14px;color:var(--muted)}.search input{width:100%;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);color:var(--text);padding:10px 43px 10px 31px;font-size:12px;min-height:36px}.search kbd{position:absolute;right:9px;font-size:9px;color:var(--muted);padding:2px 3px;border:1px solid var(--line);border-radius:3px}.nav-heading{display:flex;justify-content:space-between;padding:0 10px 10px;color:var(--muted);font-size:11px;font-weight:600}.nav-heading>span:last-child{font-size:10px;font-variant-numeric:tabular-nums}.nav-heading.separated{margin-top:29px}.change-link,.spec-link{display:flex;align-items:center;gap:9px;padding:11px 10px;border-radius:6px;margin-bottom:4px;min-width:0}.change-link:hover,.spec-link:hover{background:color-mix(in srgb,var(--accent-soft) 60%,transparent)}.change-link.selected,.spec-link.selected{background:var(--accent-soft);color:var(--accent-text)}.nav-change{min-width:0;flex:1}.nav-change>span{display:block;overflow-wrap:anywhere;font-weight:550;font-size:12px}.nav-change small{display:block;font-size:10px;margin-top:5px}.nav-icon{display:flex;color:var(--muted);align-self:flex-start;margin-top:1px}.selected .nav-icon{color:var(--accent)}.selected-mark{height:5px;width:5px;background:var(--accent);border-radius:50%}.spec-link{font-size:12px;overflow-wrap:anywhere}.spec-link svg{width:15px;color:var(--muted)}.nav-empty{font-size:11px;line-height:1.65;color:var(--muted);padding:0 10px;margin:4px 0 0}.sidebar-foot{margin-top:auto;padding:30px 9px 2px;display:flex;gap:9px;align-items:flex-start;font-size:10px;line-height:1.8;color:var(--muted)}.sidebar-foot svg{width:16px;margin-top:1px}.sidebar-foot small{font-size:10px}.main{background:var(--surface);display:flex;flex-direction:column;min-width:0;min-height:0}.breadcrumbs{min-height:57px;display:flex;align-items:center;gap:10px;padding:0 30px;font-size:11px;color:var(--muted);border-bottom:1px solid var(--line)}.breadcrumbs>svg{width:11px;height:11px}.breadcrumbs strong{font-weight:500;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.change-header{padding:29px 30px 25px;display:flex;flex-direction:column;gap:20px}.change-title-line{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.change-title-line h1{font-size:25px;line-height:1.25;font-weight:650;letter-spacing:-.7px;margin:0;text-wrap:balance}.change-header p{font-size:11px;color:var(--muted);margin:9px 0 0}.badge{display:inline-flex;align-items:center;white-space:nowrap;font-size:10px;font-weight:550;padding:4px 7px;border-radius:4px;background:var(--rail);color:var(--muted);line-height:1.2}.badge.blue{background:var(--accent-soft);color:var(--accent-text)}.badge.success{background:var(--green-bg);color:var(--green)}.header-actions{display:flex;gap:8px}.button,button{display:inline-flex;align-items:center;justify-content:center;gap:7px;background:var(--surface);border:1px solid var(--line);color:var(--text);padding:8px 11px;border-radius:var(--radius);font-weight:550;font-size:11px;min-height:34px}.button svg{width:14px;height:14px}.button.primary{background:var(--accent);border-color:var(--accent);color:#f9fbff}.button.primary:hover{background:color-mix(in srgb,var(--accent) 85%,#202b46)}.selected-button{background:var(--accent-soft);border-color:color-mix(in srgb,var(--accent) 30%,var(--line));color:var(--accent-text)}.new-dot{width:5px;height:5px;border-radius:50%;background:var(--green)}.document-tabs{display:flex;overflow-x:auto;scrollbar-width:thin;border-bottom:1px solid var(--line);padding:0 26px;flex-shrink:0;min-height:46px;gap:10px}.document-tab{display:flex;align-items:center;gap:7px;white-space:nowrap;padding:12px 5px 14px;font-size:11px;color:var(--muted);position:relative;text-transform:capitalize}.document-tab svg{width:14px;height:14px}.document-tab.active{color:var(--accent-text);font-weight:600}.document-tab.active:after{content:'';position:absolute;bottom:0;height:2px;left:2px;right:2px;background:var(--accent)}.tab-count{background:var(--rail);border-radius:4px;padding:2px 5px;font-size:9px;color:var(--muted);font-weight:500;font-variant-numeric:tabular-nums}.reader{overflow:auto;min-height:0;flex:1}.file-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:13px 30px;background:var(--panel);border-bottom:1px solid var(--line);font-size:10px;color:var(--muted)}.file-toolbar>span{display:flex;gap:7px;align-items:center;min-width:0}.file-toolbar>span>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-toolbar svg{width:13px;height:13px}.segmented{display:flex;align-items:center;padding:2px;background:var(--rail);border:1px solid var(--line);border-radius:5px;flex-shrink:0}.segmented a{padding:4px 8px;font-size:10px;border-radius:3px;display:flex;align-items:center;color:var(--muted)}.segmented a.active{background:var(--surface);color:var(--text);box-shadow:0 1px 3px #14213b0d}.prose{font-size:var(--prose);line-height:1.8;color:var(--text);max-width:80ch;padding:24px var(--reader-pad) 50px;margin:0 auto;overflow-wrap:anywhere}.prose h1{font-size:27px;letter-spacing:-.6px;font-weight:650;line-height:1.3;margin:6px 0 28px}.prose h2{font-size:18px;font-weight:650;letter-spacing:-.25px;margin:30px 0 12px;padding-bottom:8px;border-bottom:1px solid var(--line);line-height:1.4}.prose h3{font-size:15px;font-weight:650;margin:25px 0 9px;line-height:1.45}.prose h4{font-size:13px;margin:20px 0 7px}.prose p{margin:12px 0 17px}.prose ul,.prose ol{padding-left:23px;margin:12px 0 19px}.prose li{margin:8px 0;padding-left:4px}.prose li::marker{color:var(--muted)}.prose a{text-decoration:underline;text-underline-offset:3px;color:var(--accent-text)}.prose code{background:var(--code);border:1px solid var(--line);border-radius:4px;padding:1px 4px;font-size:.78em;color:var(--accent-text)}.prose pre{background:var(--code);border:1px solid var(--line);padding:16px;border-radius:6px;overflow:auto;font-size:12px;line-height:1.75}.prose pre code{padding:0;border:0;background:none;color:var(--text);font-size:inherit}.prose blockquote{margin:20px 0;padding:1px 16px;border-left:1px solid var(--accent);background:var(--panel)}.prose table{border-collapse:collapse;width:100%;font-size:12px;display:block;overflow:auto}.prose th,.prose td{padding:9px 12px;border:1px solid var(--line);text-align:left}.prose th{background:var(--panel)}.prose input[type=checkbox]{accent-color:var(--accent);vertical-align:middle;margin:0 7px 0 -18px}.source-view{margin:0;padding:24px 30px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;line-height:1.85;color:var(--text)}.workspace-footer{min-height:35px;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 20px;font-size:9px;color:var(--muted);gap:12px}.workspace-footer>span{display:flex;align-items:center;gap:6px}.workspace-footer svg{width:12px;height:12px}.footer-divider{opacity:.5;margin:0 3px}.inspector{background:var(--panel);border-left:1px solid var(--line);display:flex;flex-direction:column;min-height:0;overflow:auto}.inspector-section{padding:24px 20px;border-bottom:1px solid var(--line)}.section-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.section-title h2{font-size:12px;margin:0;font-weight:650}.section-title>svg{width:14px;color:var(--muted)}dl{margin:0}dl>div{display:flex;align-items:center;justify-content:space-between;margin-top:15px;font-size:11px}dt{color:var(--muted)}dd{margin:0}.task-progress{margin-top:24px}.task-progress>span{display:flex;justify-content:space-between;font-size:10px;color:var(--muted)}.task-progress strong{font-size:11px;color:var(--text);font-weight:600}.progress-track{display:block!important;height:4px;background:var(--line);border-radius:8px;margin-top:10px;overflow:hidden}.progress-track>span{height:100%;display:block;background:var(--accent);border-radius:8px}.agent-state{display:flex;gap:7px;align-items:center;font-size:11px;font-weight:500}.inspector-copy{font-size:11px;line-height:1.75;color:var(--muted);margin:10px 0}.attach-details{font-size:10px;color:var(--muted);margin:12px 0 20px;line-height:1.7}.attach-details summary{cursor:pointer;color:var(--accent-text)}.attach-details code{font-size:10px;color:var(--text);overflow-wrap:anywhere}.workflow-form{display:flex;flex-direction:column;gap:8px}.workflow-form label{font-size:10px;color:var(--muted);font-weight:500;margin-top:5px}.workflow-form label>span{font-weight:400;float:right}.workflow-form select{font-size:11px;width:100%;min-height:37px}.workflow-form textarea{resize:vertical;min-height:75px;padding:10px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);color:var(--text);font-size:11px;line-height:1.6}.workflow-form textarea::placeholder{color:var(--muted)}.full-width{width:100%;margin-top:5px;justify-content:flex-start;min-height:37px}.full-width>svg:last-child{margin-left:auto}.activity-section{flex:1}.activity-empty{display:flex;gap:9px;align-items:flex-start;color:var(--muted)}.activity-empty>svg{width:14px;margin-top:2px}.activity-empty p{margin:0;font-size:10px;line-height:1.8}.activity-empty p span{font-size:10px}.activity{font-size:11px;border-bottom:1px solid var(--line);padding:12px 0}.activity summary{display:flex;align-items:flex-start;gap:8px;cursor:pointer}.activity summary strong{font-size:10px;font-weight:550;display:block}.activity small{font-size:9px;display:block;margin-top:5px;text-transform:capitalize}.activity-dot{height:6px;width:6px;margin-top:4px;border-radius:50%;background:var(--muted);flex-shrink:0}.activity-dot.running{background:var(--accent)}.activity-dot.completed{background:var(--green)}.activity-dot.failed{background:var(--red)}.activity-body{font-size:10px;line-height:1.7;padding:5px 0 0 14px;overflow-wrap:anywhere}.activity-body time{color:var(--muted);font-size:9px}.activity-body p{margin:8px 0}.text-link,.text-button{color:var(--accent-text);font-size:10px}.text-button{background:none;border:0;padding:0;min-height:28px}.inspector-bottom{padding:17px 20px;display:flex;gap:7px;font-size:9px;color:var(--muted)}.inspector-bottom svg{width:13px;height:13px}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:70px 30px;text-align:center;min-height:360px;max-width:660px;margin:auto}.empty-state>svg{width:36px;height:36px;color:var(--accent);margin-bottom:20px}.empty-state h2{font-size:23px;font-weight:550;letter-spacing:-.5px;margin:0 0 15px}.empty-state p{color:var(--muted);line-height:1.9;font-size:13px;max-width:55ch;margin:0 0 20px}.empty-state>code{padding:10px 16px;border-radius:5px;background:var(--code)}.preview-steps{display:flex;gap:0;flex-wrap:wrap;justify-content:center;margin-top:12px}.preview-steps span{padding:8px 12px;font-size:10px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);color:var(--muted)}.review-intro{padding:26px 28px;border-bottom:1px solid var(--line)}.review-intro h2{font-size:20px;font-weight:600;margin:0 0 10px;letter-spacing:-.4px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}.review-intro p{font-size:12px;line-height:1.8;color:var(--muted);margin:0;max-width:75ch}.spec-diff{margin:20px;border:1px solid var(--line);border-radius:6px;overflow:hidden}.diff-file-head{display:flex;align-items:center;gap:8px;padding:12px 15px;background:var(--panel);border-bottom:1px solid var(--line);font-size:11px;flex-wrap:wrap}.diff-file-head strong{font-family:'IBM Plex Mono',monospace;font-weight:500;overflow-wrap:anywhere}.diff-file-head>svg{width:14px}.operation-badges,.diff-file-head>.segmented{margin-left:auto}.operation-badges{display:flex;gap:4px}.comparison{display:grid;grid-template-columns:1fr 1fr}.comparison>section{min-width:0}.comparison>section+section{border-left:1px solid var(--line)}.comparison h3,.split-diff h3{margin:0;padding:10px 16px;border-bottom:1px solid var(--line);color:var(--muted);font-size:10px;font-weight:500}.prose.small{padding:10px 18px;font-size:12px}.prose.small h1{font-size:20px}.prose.small h2{font-size:15px}.prose.small h3{font-size:13px}.prose.small h4{font-size:12px}.preview-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:20px}.preview-actions>span{font-size:11px;margin-right:auto}.preview-actions form{margin:0}.diff-add{color:var(--green);margin-left:8px}.diff-remove{color:var(--red);margin-left:5px}.preview-layout{display:grid;grid-template-columns:180px minmax(0,1fr);min-height:280px}.preview-files{border-right:1px solid var(--line);padding:12px 8px;font-size:10px;background:var(--panel)}.preview-files a{display:flex;align-items:flex-start;gap:7px;padding:9px 7px;overflow-wrap:anywhere;border-radius:4px}.preview-files a.selected{background:var(--accent-soft)}.file-state{font-family:'IBM Plex Mono',monospace;font-size:9px;margin-top:1px}.file-state.added{color:var(--green)}.file-state.deleted{color:var(--red)}.file-state.modified{color:var(--accent)}.diff-panel{min-width:0}.split-diff{display:grid;grid-template-columns:1fr 1fr}.split-diff>section{min-width:0;overflow:auto}.split-diff>section+section{border-left:1px solid var(--line)}.split-diff h3 span{font-size:9px;opacity:.8}.code-diff{overflow:auto;font-size:10px;font-family:'IBM Plex Mono',monospace;line-height:1.9;padding:10px 0;min-height:100px}.diff-row{display:flex;min-width:max-content}.diff-row code{font-size:inherit;white-space:pre;padding:0 10px 0 0}.line-number{display:inline-block;color:var(--muted);width:35px;text-align:right;padding-right:10px;flex-shrink:0;user-select:none}.diff-row.addition{background:var(--green-bg);color:var(--green)}.diff-row.deletion{background:var(--red-bg);color:var(--red)}.diff-empty{font-size:11px;padding:10px 20px}.error-message,.success-message{font-size:11px;line-height:1.7;padding:10px 12px;border-radius:5px;overflow-wrap:anywhere}.error-message{color:var(--red);background:var(--red-bg)}.success-message{color:var(--green);background:var(--green-bg)}#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(12px);background:var(--text);color:var(--surface);padding:12px 18px;border-radius:7px;font-size:12px;max-width:calc(100vw - 30px);z-index:20;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s}#toast.visible{opacity:1;transform:translateX(-50%) translateY(0)}.mobile-menu,.navigation-close{display:none}.skip-link{position:fixed;top:-60px;left:10px;z-index:40;background:var(--accent);color:var(--surface);padding:10px}.skip-link:focus{top:5px}dialog{color:var(--text);background:var(--surface);border:1px solid var(--line);border-radius:12px;max-width:min(460px,calc(100vw - 32px));padding:26px;box-shadow:0 20px 70px #15203b26}dialog::backdrop{background:#101a3066}dialog h2{font-size:20px;margin:0 0 14px}dialog p{font-size:13px;line-height:1.8;color:var(--muted)}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:24px}.htmx-request button[type=submit]{opacity:.6;pointer-events:none}.htmx-request .reader{opacity:.6}*{scrollbar-width:thin;scrollbar-color:var(--line) transparent}
3
+ [data-theme=dark]{color-scheme:dark;--bg:#171c26;--surface:#1c2330;--rail:#151b27;--panel:#19202c;--text:#dce3ef;--muted:#9caac0;--line:#303b4d;--accent:#87a6ee;--accent-soft:#2b3c5b;--accent-text:#b7cdfb;--green:#9bd4b1;--green-bg:#213a32;--red:#ecadb0;--red-bg:#432a33;--code:#151c28}
4
+ @media(min-width:1600px){:root{--rail-width:260px;--panel-width:310px;--reader-pad:52px}.change-header{flex-direction:row;justify-content:space-between;align-items:center}.prose{padding-top:34px}}
5
+ @media(max-width:1150px) and (min-width:761px){:root{--rail-width:205px;--panel-width:235px;--reader-pad:26px}.inspector-section{padding:20px 15px}.change-title-line h1{font-size:22px}.change-header{padding-left:25px;padding-right:25px}.preview-layout{grid-template-columns:1fr}.preview-files{border-right:0;border-bottom:1px solid var(--line);display:flex;overflow:auto}.preview-files a{flex-shrink:0;max-width:220px}.comparison{grid-template-columns:1fr}.comparison>section+section{border-left:0;border-top:1px solid var(--line)}}
6
+ @media(max-width:900px) and (min-width:761px){:root{--rail-width:185px;--panel-width:205px;--reader-pad:20px}.sidebar{padding-left:10px;padding-right:10px}.breadcrumbs{padding-left:20px;padding-right:20px}.change-header{padding-left:20px;padding-right:20px}.change-title-line h1{font-size:21px}.file-toolbar{padding-left:18px;padding-right:18px}.file-toolbar>span{max-width:45%}.prose{font-size:13px}.inspector-section{padding:18px 12px}.topbar{padding:0 18px}}
7
+ @media(max-width:760px){body{height:auto;overflow:auto}.topbar{height:58px!important;padding:0 15px;gap:8px}.brand{font-size:15px;gap:7px}.brand>svg{width:21px}.local-pill{font-size:8px}.connection{font-size:10px}.topbar-end{gap:0}.workspace{height:auto;min-height:calc(100dvh - 58px);grid-template-columns:minmax(0,1fr)}.sidebar{display:none}.navigation-open .sidebar{display:flex;position:fixed;top:58px;bottom:0;left:0;width:min(300px,calc(100vw - 50px));z-index:10;box-shadow:8px 10px 35px #15203b25}.mobile-menu{display:inline-flex;min-height:30px;padding:5px;border:0;background:transparent}.breadcrumbs{padding:10px 15px;min-height:48px;gap:7px}.breadcrumbs>strong{font-size:10px}.breadcrumbs>span:first-of-type{display:none}.change-header{padding:22px 20px;gap:17px;align-items:flex-start;flex-direction:column}.change-title-line h1{font-size:23px}.document-tabs{padding-left:16px;padding-right:16px}.reader{overflow:visible;min-height:300px}.file-toolbar{padding:10px 15px;gap:8px}.file-toolbar>span{flex:1}.segmented a{padding:4px 6px}.prose,.prose.small{padding:21px 22px 30px;font-size:14px}.prose h1{font-size:25px}.prose h2{font-size:18px}.workspace-footer{padding:10px 15px;min-height:35px}.workspace-footer>span:last-child{font-size:8px}.inspector{border-left:0;border-top:1px solid var(--line);overflow:visible}.inspector-section{padding:23px}.inspector-section dl{display:flex;gap:25px;flex-wrap:wrap}.inspector-section dl>div{gap:12px;margin-top:0}.task-progress{max-width:100%}.inspector-copy{max-width:55ch;font-size:12px}.workflow-form{font-size:12px}.workflow-form textarea{font-size:13px}.workflow-form select{font-size:12px}.activity-empty p{font-size:12px}.inspector-bottom{padding-left:23px}.comparison,.split-diff{grid-template-columns:1fr}.comparison>section+section,.split-diff>section+section{border-left:0;border-top:1px solid var(--line)}.preview-layout{grid-template-columns:1fr}.preview-files{border-right:0;border-bottom:1px solid var(--line);display:flex;overflow:auto}.preview-files a{max-width:210px;flex-shrink:0}.review-intro{padding:23px 20px}.review-intro h2{font-size:20px}.spec-diff{margin:15px}.review-intro p{font-size:12px}.source-view{padding:20px;font-size:11px}.split-diff section{overflow:auto}.empty-state{padding:45px 22px;min-height:320px}.empty-state h2{font-size:22px}.preview-steps span{font-size:9px;padding:8px}.preview-actions .button{font-size:10px}.diff-file-head{padding:10px 12px}.operation-badges{margin-left:0}.prose table{max-width:calc(100vw - 44px)}}
8
+ @media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important}}
9
+
10
+ @media(max-width:760px){.navigation-close{display:flex;position:absolute;top:14px;right:10px;padding:5px;min-height:30px;background:var(--rail);border:0}.navigation-open .project-select{padding-right:28px}}
11
+
12
+ [data-theme=dark] .button.primary{color:#182338;background:#a5bdf3;border-color:#a5bdf3}
13
+ [data-theme=dark] .button.primary:hover{background:#bdd0fa}
14
+ .theme-toggle{width:36px;height:36px;padding:8px;border-color:transparent;background:transparent;color:var(--muted)}
15
+ .theme-toggle:hover{color:var(--text)}
16
+ .theme-toggle>span{display:flex;align-items:center;justify-content:center}
17
+ .theme-toggle .theme-icon-light,[data-theme=dark] .theme-toggle .theme-icon-dark{display:none}
18
+ [data-theme=dark] .theme-toggle .theme-icon-light{display:flex}
19
+
20
+ /* File review is the primary change workspace. */
21
+ .changed-files-nav{margin:0 -3px;max-height:40dvh;overflow:auto}
22
+ .changed-file-link{display:grid;grid-template-columns:12px minmax(0,1fr) auto;align-items:start;gap:7px;padding:9px 10px;border-radius:5px;font-size:10px;line-height:1.6;margin:2px 0}
23
+ .changed-file-link:hover{background:color-mix(in srgb,var(--accent-soft) 65%,transparent)}
24
+ .changed-file-link.selected{background:var(--accent-soft);color:var(--accent-text)}
25
+ .changed-file-name{overflow-wrap:anywhere;font-family:'IBM Plex Mono',monospace;font-size:10px}
26
+ .file-line-count{display:flex;gap:4px;font-size:9px;font-variant-numeric:tabular-nums;white-space:nowrap}
27
+ .file-line-count .diff-add,.file-line-count .diff-remove{margin:0}
28
+ .file-diff-count{font-size:10px;font-variant-numeric:tabular-nums}
29
+ .file-review-title{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap}
30
+ .file-review-title h2{margin:0 0 12px}
31
+ .diff-version-form{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 12px}
32
+ .diff-version-form label{font-size:10px;color:var(--muted)}
33
+ .diff-version-form select{font-size:10px;max-width:220px;padding:7px 24px 7px 8px}
34
+ .generate-diff-form{margin:0}
35
+ .generate-diff-form .button{white-space:nowrap}
36
+ .diff-empty-state .empty-state{max-width:720px;min-height:430px}
37
+ .diff-empty-state .empty-state>svg{width:38px;height:38px}
38
+ .diff-attach-hint{font-size:11px!important;line-height:1.8!important;max-width:50ch!important;margin-top:18px!important}
39
+ .diff-attach-hint code{font-size:10px;white-space:nowrap}
40
+ .diff-generation-status{width:100%;max-width:55ch;background:var(--panel);padding:15px;margin-top:18px;text-align:left;border-radius:6px}
41
+ .diff-generation-status p{font-size:11px;line-height:1.7;margin:8px 0 0}
42
+ .diff-pending-note{font-size:11px;margin-top:12px!important}
43
+ .split-diff-view{overflow:auto;min-width:0}
44
+ .split-diff-table{width:100%;min-width:560px;table-layout:fixed;border-collapse:collapse;font-family:'IBM Plex Mono',monospace;font-size:11px;line-height:1.85}
45
+ .split-diff-table .number-column{width:38px}
46
+ .split-diff-table th{background:var(--panel);color:var(--muted);padding:11px 14px;text-align:left;font-family:'DM Sans',sans-serif;font-size:10px;font-weight:500;border-bottom:1px solid var(--line)}
47
+ .split-diff-table th+th{border-left:1px solid var(--line)}
48
+ .split-diff-table th span{font-size:9px;margin-left:5px}
49
+ .split-diff-table td{padding:1px 0;vertical-align:top}
50
+ .split-diff-table td.line-number{display:table-cell;width:38px;padding-right:9px;text-align:right;font-size:10px}
51
+ .split-diff-table .code-cell{padding:1px 10px 1px 4px;white-space:pre-wrap;overflow-wrap:anywhere;tab-size:2}
52
+ .split-diff-table .code-cell:nth-child(2){border-right:1px solid var(--line)}
53
+ .split-diff-table .code-cell code{font:inherit}
54
+ .split-diff-table .addition{background:var(--green-bg);color:var(--green)}
55
+ .split-diff-table .deletion{background:var(--red-bg);color:var(--red)}
56
+ .split-diff-table .diff-gap{background:var(--panel)}
57
+ @media(max-width:760px){.changed-files-nav{max-height:45dvh}.file-review-intro{padding:20px 16px}.diff-version-form select{max-width:210px}.diff-empty-state .empty-state{min-height:360px;padding:35px 22px}.file-review-intro .preview-actions{gap:8px}.file-review-intro .preview-actions>span{flex-basis:100%;margin-bottom:2px}.file-review-intro .button{min-height:36px}}
58
+ /* Markdown task checkboxes stay legible even though they are read-only. */
59
+ .prose input[type=checkbox]{appearance:none;-webkit-appearance:none;display:inline-grid;place-content:center;inline-size:15px;block-size:15px;padding:0;border:1px solid var(--muted);border-radius:3px;background:var(--surface);opacity:1;vertical-align:-2px}
60
+ .prose input[type=checkbox]:checked{border-color:var(--green);background:var(--green)}
61
+ .prose input[type=checkbox]:checked::after{content:"";display:block;inline-size:12px;block-size:12px;background:var(--surface);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8.5 3.5 3.5L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8.5 3.5 3.5L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat}
62
+ @media(forced-colors:active){.prose input[type=checkbox],.prose input[type=checkbox]:checked{appearance:auto;-webkit-appearance:auto;background:Canvas;color:CanvasText;border-color:CanvasText}.prose input[type=checkbox]:checked::after{content:none}}