feat: open canvas setup dialog directly (#3587)

This commit is contained in:
Carlos Florêncio
2026-09-13 16:59:54 +01:00
committed by GitHub
parent 96b2814bfb
commit 32b21c8b22
64 changed files with 3924 additions and 358 deletions
+236
View File
@@ -0,0 +1,236 @@
---
created: 2026-09-10
status: complete
requirements:
- REQ-CANVASES-AGENT-WEB-APPS-009
system_design:
- ../../specs/canvases/system-design/guided-canvas-task-launch.md
legacy_specs: []
---
# Implementation plan: Direct canvas creation
## Overview
Open the normal task dialog directly from the empty canvas sidebar row. Show
an editable goal followed by `@create-canvas`. Keep detailed instructions in
an editable built-in saved prompt and reuse backend expansion.
Canvases owns this outcome because it owns guided canvas task launch. Extend
the existing requirement/design pair; Tasks continues to own saved-prompt
delivery. Implement the prompt before the launcher starts referencing it.
## Scope
### In scope
- Direct sidebar setup and the existing workspace settings launcher.
- Localized coordinator-view goal, with an exact saved-prompt reference.
- Built-in definition, customization preservation, and structured launch tests.
- Existing scratch/local defaults, editable task choices, error recovery,
desktop focus behavior, and phone task creation.
- Public usage documentation when implementation ships.
### Out of scope
- New canvas builders, MCP tools, permissions, promotion, or flag rollout.
- Generic task-composer autocomplete changes or terminal prompt expansion.
- A new mobile navigation entry or a new saved-prompt persistence model.
- Live-model evaluation or task creation in this planning package.
## Technical approach
Task 01 adds `apps/backend/config/prompts/create-canvas.md` and a
`builtin-create-canvas` entry in `getBuiltinPrompts`. Preserve existing
insert-on-conflict seeding. A user's same-name definition takes precedence.
Exercise the actual prompt service and orchestrator launch path; do not add
browser expansion or change shared failure and passthrough behavior.
Task 02 gives `CanvasTaskCreateLauncher` a sidebar presentation while keeping
one preset, open-state owner, and success handler. `EmptyCanvasRow` becomes a
button. Keep the settings shortcut and the current route when opening.
Mount the open dialog independently of empty-list rendering, and reset it on
workspace identity or feature availability changes. Restore focus on cancel.
Use the existing locale key for the goal and append `\n\n@create-canvas`
outside translation. The editor remains plain text. Users can replace the goal,
remove the reference, or customize its definition in Settings > Prompts.
The existing autocomplete's inline insertion remains unchanged.
The task description stores the user's text. Starting a structured session
adds hidden expansion to its canonical first message and agent prompt. A task
created without starting resolves at its later launch, using the then-current
definition. Custom workflows retain their existing task-prompt composition.
## ASCII UI preview
### UI-01: Desktop setup, empty workspace
Current: `Set up a canvas -> workspace settings -> Create canvas -> dialog`.
Proposed: `Set up a canvas -> dialog`.
```text
CANVASES [Settings] [v]
[Set up a canvas]
|
v
+-------------------------------------------------------------+
| Create a canvas Source: None |
| +---------------------------------------------------------+ |
| | Create a new Kandev canvas with a coordinator view | |
| | that lists the existing tasks. | |
| | | |
| | @create-canvas | |
| +---------------------------------------------------------+ |
| Agent [v] Model [v] Executor [Local v] |
| Workflow [v] Step [v] |
| Advanced settings [v] |
| [Cancel] [Start task v] |
+-------------------------------------------------------------+
```
The existing task dialog owns exact control geometry and optional fields.
Structure requirements: editable goal before task options, reference stays
short, one shared dialog, no settings navigation, existing submit choices.
Spacing and labels in this drawing are illustrative. Maps to criteria `.1`–`.4`,
`.6`, `.7`, `.9`, and `.11` under `AC-CANVASES-AGENT-WEB-APPS-009`.
### UI-02: Phone creation from workspace settings
```text
Workspace > Canvases
[Create canvas]
|
v
+-------------------------------+
| Create a canvas |
|-------------------------------|
| Source: None |
| Create a new Kandev canvas |
| with a coordinator view that |
| lists the existing tasks. |
| |
| @create-canvas |
| |
| Agent / Model [v] |
| Executor [Local v] |
| Workflow / Step [v] |
| Advanced settings [v] |
|-------------------------------|
| [Cancel] [Start task v] |
+-------------------------------+
```
Use the shipped full-screen `TaskCreateDialog`, with its form body scrolling
and footer reachable above the safe area. This focused form fits the editable
goal and task options. Use dynamic viewport containment, touch targets of at
least 44px, and no page horizontal overflow. Shared domain state and submit
logic remain identical to desktop. Maps to `.5`–`.7`, `.9`, and `.11`.
### UI-03: Failure and cancellation, both viewports
```text
[User's edited goal and @create-canvas remain in editor]
[Existing task-creation error]
[Cancel] [Start task v]
```
Failure uses the existing error surface and permits retry. Cancel returns to
the entry surface without navigation or task/canvas creation. While submitting,
the existing pending state prevents duplicate submission. The feature-off or
missing-workspace state has no launcher. Maps to `.11` and existing feature-off
criterion `AC-CANVASES-AGENT-WEB-APPS-001.7`.
## Tests
| Criteria | Targeted evidence |
| --- | --- |
| `.6`, `.8`, `.10` | `store/sqlite_test.go`: new `TestCreateCanvasBuiltin` cases for seed, restart, edits, collision, and required tool instructions. |
| `.9`, `.10` | `orchestrator/create_canvas_prompt_launch_test.go`: new `TestCreateCanvasPromptLaunch` cases using the real prompt service, workflow/no-step start, prepared start, changed saved content, absent reference, and exactly one expansion. |
| `.1`–`.4`, `.11` | `canvases-section.test.tsx`, `canvas-task-create-launcher.test.tsx`: direct opening, unchanged route, defaults, feature-off, missing/changing workspace, list refresh, cancel/focus, submission failure, and single success navigation. |
| `.6`, `.7` | `canvas-task-prompt.test.ts`: every localized goal plus exact assembled reference, no long instructions. |
| `.5`, `.7`, `.9`, `.11` | Desktop and phone Playwright scenarios below. |
All abbreviated criteria belong to `AC-CANVASES-AGENT-WEB-APPS-009`.
Use TDD for changed logic. Preserve existing saved-prompt tests for missing
references, untrusted browser content, idempotence, and passthrough exclusion.
## E2E tests
- In `tests/canvas/plugin-canvas.spec.ts` (`chromium`), add a
`canvas setup opens task dialog directly` case. Expand the empty section,
click setup, assert unchanged URL, defaults, cancellation/focus, and a second
launch. Keep a settings-launch case proving the same preset.
- Update its `canvas creation prompt` case: edit only the goal while retaining
`@create-canvas`, submit, verify short stored description and normal route.
Cover create-without-start and later launch in focused backend integration
tests; do not manufacture browser expansion metadata.
- Update `tests/canvas/mobile-plugin-canvas.spec.ts` (`mobile-chrome`),
`creates a scratch canvas task`: assert the short preset, editable agent and
workflow, retained reference on submission, cancellation, and retry after a
controlled creation error. Assert containment, internal scroll, footer
reachability, and actual primary touch-target size; inspect a screenshot.
- Keep deterministic lifecycle fixture coverage. Commands may be appended to
the goal for mock-agent behavior, but must not replace the saved reference
in expansion coverage. Backend launch capture proves the built-in definition
reaches the agent; browser visibility alone cannot prove this.
Managed E2E runners rebuild production assets and isolate fixture data. Run
desktop and mobile sequentially with retries disabled.
## Work orders
- [x] [Task 01: Seed the canvas saved prompt](task-01-canvas-saved-prompt.md)
- [x] [Task 02: Open the canvas task dialog directly](task-02-direct-canvas-dialog.md)
Dependency order: 01, then 02. Both are complete and sequential.
## Companion plans
The proposed [task-create chip package](../task-create-prompt-chips/plan.md)
extends reference presentation and autocomplete in the shared create-task editor.
It does not change this package's historical results or completed status.
This package supersedes the sidebar setup redirect in the completed Task 02 of
[the UX follow-up](../plugin-backed-canvases-ux-follow-up/plan.md), and the
long visible preset in completed Task 02 of
[the discovery prompt package](../mcp-discovery-canvas-prompts/plan.md).
Their recorded test results remain historical. Their unrelated work and the
UX package's outstanding external ACP evaluation remain unchanged. Run updated
shared tests through this package; do not reuse historical counts as evidence.
## Verification results
Planning validation on 2026-09-10:
- `rtk python3 scripts/lint-spec-files.test.py`: 36 tests passed.
- `rtk python3 scripts/lint-spec-files.py --all`: passed after splitting guided
launch into its own Canvases design to meet the 32 KiB design-file limit.
- `rtk git diff --check`: passed.
- Work-order status inspection: both files present, complete, and linked.
Implementation and rendered verification completed on 2026-09-10. Exact
results are recorded in Task 02. The implementation preserves the existing
saved-prompt launch authority and adds the direct desktop entry point without
changing the phone settings path.
## Risks
- A same-name custom prompt intentionally overrides the shipped instructions.
- Deleted/renamed references retain existing non-fatal fallback behavior;
unsupported passthrough sessions do not receive hidden expansion.
- A custom workflow can omit the task description. This package does not
override workflow prompt composition or promise expansion in that case.
- The default coordinator lists only authorized data. Broader workspace data
can require user promotion or permission review.
- The launcher prefers the setup trigger for focus restoration and falls back to
the always-mounted section header if a list refresh removes that trigger.
- Tests proving prompt delivery cannot guarantee external model compliance.
## Documentation impact
The docs-maintainer check found `docs/public/canvases.md` and
`docs/public/developer-tools.md`. Task 02 updates their creation how-to and
saved-prompt reference when behavior ships. This design turn changes internal
documents only. No new ADR is needed: existing saved-prompt authority and
canvas scope decisions remain in force.
@@ -0,0 +1,107 @@
---
id: "01-canvas-saved-prompt"
title: "Seed the canvas saved prompt"
status: done
wave: 1
depends_on: []
plan: "plan.md"
requirements:
- REQ-CANVASES-AGENT-WEB-APPS-009
acceptance_criteria:
- AC-CANVASES-AGENT-WEB-APPS-009.8
- AC-CANVASES-AGENT-WEB-APPS-009.9
- AC-CANVASES-AGENT-WEB-APPS-009.10
system_design:
- ../../specs/canvases/system-design/guided-canvas-task-launch.md
---
# Task 01: Seed the canvas saved prompt
## Summary
Provide an editable `create-canvas` saved prompt with the canvas authoring
instructions. Prove that structured task launch expands it through the existing
backend service while retaining the visible reference.
## In scope
- Add the embedded English definition and `builtin-create-canvas` seed entry.
- Preserve same-name user records, edits, existing seeding and deletion rules.
- Cover create/start and delayed start, workflow and no-step launch, prepared
session, current saved content, removed reference, and exactly one expansion.
- Assert the canonical recorded message and agent prompt agree; task description
stays short. Reuse current trusted-content plumbing and failure behavior.
## Out of scope
- Browser changes, new expansion services, schemas, reserved prompt names,
runtime flag changes, and terminal/passthrough expansion.
## Acceptance
1. Fresh and existing databases obtain the built-in without replacing user data.
2. The default definition includes exact tools, discovery, one core skill read,
source boundaries, authorized data, publication outcomes, and human promotion.
3. Structured launch delivers one trusted saved definition; removing the
reference removes its expansion. Delayed start uses the current definition.
## Verification
Run from the repository root, following `/tdd` and backend scoped guidance:
```bash
(cd apps/backend && rtk go test -tags fts5 ./internal/prompts/store ./internal/prompts/service)
(cd apps/backend && rtk go test -tags fts5 ./internal/orchestrator -run 'TestCreateCanvasPromptLaunch|PromptReference|PromptLaunch|WorkflowPrompt' -count=1)
rtk git diff --check
```
Name new integration tests `TestCreateCanvasPromptLaunch` with subtests so the
command includes every new case. Inspect existing saved-prompt launch tests
before adding fixtures; use the real prompt repository/service. Add a narrow
repair only if a regression test proves the existing launch path is incomplete.
## Files likely touched
- `apps/backend/config/prompts/create-canvas.md` (new)
- `apps/backend/internal/prompts/store/sqlite.go`
- `apps/backend/internal/prompts/store/sqlite_test.go`
- `apps/backend/internal/orchestrator/create_canvas_prompt_launch_test.go`
- `apps/backend/internal/orchestrator/workflow_prompt_test.go`
## Dependencies
None.
## Risks
Seeding has fixed-ID and unique-name conflicts; test both. Prompt instructions
do not grant canvas capabilities. User-customized definitions can intentionally
differ from the shipped workflow.
## Parallelism
`sequential`
## Inputs
- Canvas design: Guided canvas task launch and Agent authoring guidance.
- [Saved Prompt Delivery](../../specs/tasks/system-design/saved-prompt-delivery.md).
- [Server-owned expansion ADR](../../decisions/2026-09-01-server-owned-saved-prompt-expansion.md).
- `config/prompts/changes-walkthrough.md`, current seed and expansion tests.
## Results
- Added `apps/backend/config/prompts/create-canvas.md` and registered the
`builtin-create-canvas` seed without changing saved-prompt resolution.
- Added store coverage for the complete authoring workflow, same-name user
collisions, and user edits across repository reopen.
- Added a startup-cap regression so built-in seeding cannot make a full prompt
table exceed `maxPromptListItems`.
- Added orchestrator coverage for new-task, prepared-session, workflow-step,
current-definition, exactly-once expansion, and removed-reference launches.
- `cd apps/backend && rtk go test -tags fts5 ./internal/prompts/store
./internal/prompts/service`: 56 passed.
- `cd apps/backend && rtk go test -tags fts5 ./internal/orchestrator -run
'TestCreateCanvasPromptLaunch|PromptReference|PromptLaunch|WorkflowPrompt' -count=1`:
26 passed.
- `rtk git diff --check`: passed.
@@ -0,0 +1,174 @@
---
id: "02-direct-canvas-dialog"
title: "Open the canvas task dialog directly"
status: done
wave: 2
depends_on:
- "01-canvas-saved-prompt"
plan: "plan.md"
requirements:
- REQ-CANVASES-AGENT-WEB-APPS-009
acceptance_criteria:
- AC-CANVASES-AGENT-WEB-APPS-009.1
- AC-CANVASES-AGENT-WEB-APPS-009.2
- AC-CANVASES-AGENT-WEB-APPS-009.3
- AC-CANVASES-AGENT-WEB-APPS-009.4
- AC-CANVASES-AGENT-WEB-APPS-009.5
- AC-CANVASES-AGENT-WEB-APPS-009.6
- AC-CANVASES-AGENT-WEB-APPS-009.7
- AC-CANVASES-AGENT-WEB-APPS-009.9
- AC-CANVASES-AGENT-WEB-APPS-009.11
system_design:
- ../../specs/canvases/system-design/guided-canvas-task-launch.md
---
# Task 02: Open the canvas task dialog directly
## Summary
Reuse the canvas task launcher from the empty sidebar row. Present the short
goal plus saved reference on desktop and phone, with the existing task options.
## In scope
- Shared launcher presentation, direct semantic button, stable dialog lifetime,
workspace reset, cancel/focus, failure/retry, and success navigation.
- Localized goal plus literal reference; update actual preset contract tests.
- All tests in the plan's UI and E2E matrix; retain settings shortcut behavior.
- Generate Traditional Chinese and pseudo catalogs. Use `/mobile-parity`,
`/tdd`, and `/e2e` for implementation and rendered checks.
- Update canvas creation and saved-prompt public docs through `/docs-maintainer`.
## Out of scope
- Saved-prompt backend implementation, generic autocomplete behavior,
additional mobile navigation, and canvas permission or runtime changes.
## Acceptance
1. Sidebar setup opens the same task dialog without route change, retaining
task defaults, management navigation, cancellation, and workspace isolation.
2. All locales show a short editable goal followed by exact `@create-canvas`;
desktop and phone submit user edits and preserve them after failure.
3. Targeted component, catalog, desktop/mobile E2E, and documentation checks
pass; rendered phone geometry matches the preview.
## ASCII UI preview
Excerpts from [the full preview](plan.md#ascii-ui-preview):
```text
UI-01 Desktop, empty sidebar
[Set up a canvas] -> [Task dialog on current route]
[Editable coordinator goal]
[@create-canvas]
[Agent / Model / Executor] [Workflow / Step]
[Cancel] [Start task v]
UI-02 Phone, workspace settings
[Create canvas] -> [Full-screen task form]
[Editable goal and @create-canvas]
[Task options, scrolling body]
[Cancel] [Start task v] (reachable footer)
UI-03 Submission failure
[Edited goal and reference preserved]
[Existing error] [Cancel] [Start task v]
```
UI-01 covers `.1`–`.4`, `.6`, `.7`, `.9`, `.11`; UI-02 covers `.5`–`.7`,
`.9`, `.11`; UI-03 covers `.11`. All refer to the canvas launch requirement.
Use the existing full-screen task form and one body scroll owner, dynamic
viewport containment, safe areas, and 44px phone targets. Desktop retains its
normal density. Grouping and behavior are required; ASCII spacing is not.
## Verification
Run from the repository root. Install workspace dependencies once if missing:
```bash
(cd apps && rtk pnpm install --frozen-lockfile)
```
Then run these commands sequentially:
```bash
(cd apps/web && rtk pnpm run i18n:zh-hant)
(cd apps/web && rtk pnpm run i18n:pseudo)
(cd apps/web && rtk pnpm exec vitest run components/canvas/canvas-task-create-launcher.test.tsx components/canvas/canvas-task-prompt.test.ts components/app-sidebar/sections/canvases-section.test.tsx components/settings/workspace-canvases-page.test.tsx)
(cd apps/web && rtk pnpm run typecheck)
(cd apps/web && rtk pnpm run i18n:check)
(cd apps/web && rtk pnpm run i18n:ratchet)
(cd apps/web && rtk pnpm exec eslint components/canvas/canvas-task-create-launcher.tsx components/app-sidebar/sections/canvases-section.tsx components/app-sidebar/app-sidebar-section.tsx)
(cd apps/web && rtk pnpm e2e:run --project chromium tests/canvas/plugin-canvas.spec.ts -- --grep 'canvas setup|canvas creation prompt' --retries=0)
(cd apps/web && rtk pnpm e2e:run --project mobile-chrome tests/canvas/mobile-plugin-canvas.spec.ts -- --grep 'creates a scratch canvas task' --retries=0)
rtk node --test scripts/validate-public-docs.test.mjs
rtk node scripts/validate-public-docs.mjs
rtk python3 scripts/lint-spec-files.py --all
rtk git diff --check
```
If extracting a helper adds another test file, add that exact path to this block
before marking the task complete. Managed E2E builds production artifacts;
inspect its phone screenshot for structure as well as geometry assertions.
## Files likely touched
- `apps/web/components/canvas/canvas-task-create-launcher.tsx` and its test
- `apps/web/components/app-sidebar/app-sidebar-section.tsx`
- `apps/web/components/app-sidebar/sections/canvases-section.tsx` and its test
- `apps/web/components/canvas/canvas-task-prompt.test.ts`
- `apps/web/components/settings/workspace-canvases-page.test.tsx`
- `apps/web/src/locales/{en,pt-pt,zh-cn,zh-hk,zh-tw,pseudo}/canvases.json`
- `apps/web/e2e/tests/canvas/{plugin-canvas,mobile-plugin-canvas}.spec.ts`
- `docs/public/canvases.md`, `docs/public/developer-tools.md`
## Dependencies
Task 01 must seed the saved prompt before the UI references it.
## Risks
Empty-row unmount or workspace switching can lose or misroute a draft. Mocked
translation tests can miss catalog regressions. Browser tests that replace the
entire preset cannot prove saved-prompt delivery.
## Parallelism
`sequential`
## Inputs
- Canvas requirements `.009` and design sections for guided launch and prompts.
- Existing launcher, sidebar tests, task dialog, and mobile creation scenario.
- Existing completed prompt and UX packages linked from the plan.
## Results
- Added the shared `CanvasTaskCreateLauncher` sidebar presentation. The empty
canvas row is now a semantic button that opens the existing task dialog on
the current route; the settings shortcut retains its existing path.
- Kept the task description editable and localized as a short goal followed by
the literal `@create-canvas` reference. The dialog resets on workspace or
feature changes, restores focus on cancellation, and preserves the editor on
failed submission.
- Added regression coverage for delayed sidebar list readiness and focus
restoration that prefers the opener but survives opener unmounts.
- Updated desktop and phone canvas scenarios, including direct sidebar launch,
settings launch, edited prompt retention, cancellation, and controlled
creation failure/retry. Generated Traditional Chinese and pseudo catalogs.
- Added public guidance to `docs/public/canvases.md` and
`docs/public/developer-tools.md`.
- Focused component/catalog/settings tests: 21 passed in 4 files.
- `cd apps/web && rtk pnpm run typecheck`: passed.
- `cd apps/web && rtk pnpm run i18n:check`: passed.
- `cd apps/web && rtk pnpm run i18n:ratchet`: passed.
- `cd apps/web && rtk pnpm exec eslint components/canvas/canvas-task-create-launcher.tsx components/app-sidebar/sections/canvases-section.tsx components/app-sidebar/app-sidebar-section.tsx`: passed.
- Chromium canvas E2E after focus hardening: 2 passed.
- Mobile canvas E2E after focus hardening: 1 passed.
- Fresh desktop and Pixel 5 dialog captures passed fixture assertions, were
inspected for layout and content, and were compressed for PR publication.
- `rtk node --test scripts/validate-public-docs.test.mjs`: 62 passed.
- `rtk node scripts/validate-public-docs.mjs`: 46 published docs validated.
- `rtk python3 scripts/lint-spec-files.py --all`: passed.
- `rtk git diff --check`: passed.
@@ -14,6 +14,13 @@ legacy_specs: []
# Implementation plan: MCP discovery and canvas prompts
## Subsequent design
The [direct canvas creation package](../canvas-direct-creation/plan.md) replaces
the long visible preset from Task 02 with a short goal and saved reference.
This package's completed results remain historical; the new package owns
updated catalog, delivery, and desktop/mobile checks. Task 01 is unchanged.
## Overview
Make Kandev tool discovery explicit, reduce repeated tool descriptions, and
@@ -18,6 +18,10 @@ system_design:
# Task 02: Canvas creation preset
Subsequent design: [direct canvas creation](../canvas-direct-creation/plan.md)
moves the detailed preset into a saved prompt. This completed work order
records the earlier implementation; the new package owns replacement tests.
## Summary
Strengthen the editable Create canvas prompt with explicit MCP discovery and
@@ -17,6 +17,13 @@ legacy_specs:
# Implementation Plan: Plugin-backed canvases UX follow-up
## Subsequent design
The [direct canvas creation package](../canvas-direct-creation/plan.md) replaces
Task 02's sidebar settings redirect with direct task-dialog launch. Completed
results below remain historical. The new package owns replacement navigation
and prompt tests; Task 07's outstanding external ACP evaluation is unchanged.
## Overview
Correct the canvas discovery, creation, host, appearance, and authoring issues
@@ -22,6 +22,11 @@ system_design:
# Task 02: Add guided canvas task launch
Subsequent design: [direct canvas creation](../canvas-direct-creation/plan.md)
replaces the sidebar setup redirect with a shared dialog launcher. This
completed work order preserves earlier results; the new package owns the
updated navigation and prompt tests.
## Summary
Open the standard task creation flow from workspace Canvases settings. Apply
@@ -41,6 +41,10 @@ The work is one vertical frontend slice with no dependency on backend changes.
## Risks and exclusions
The proposed [task-create chip package](../task-create-prompt-chips/plan.md)
extends the shared renderer to task authoring. Its work orders own that change
and its verification. This package retains its existing statuses and scope.
- Prompt history currently uses a single-line text projection; the fix must not
replace that layout with a second Markdown layout or break overflow detection.
- Pinned content has no message metadata, so it reuses alias rendering but does
+214
View File
@@ -0,0 +1,214 @@
---
created: 2026-09-12
status: done
requirements:
- REQ-UI-PROMPT-ALIAS-002
system_design:
- ../../specs/ui/system-design/prompt-alias-rendering.md
legacy_specs: []
---
# Implementation plan: Task-create prompt chips
## Overview
Show saved prompt references as inline chips in the new-task editor, including
the canvas preset. First build the text-preserving editor. Then integrate it
with task creation and prove the desktop and phone workflows.
UI owns the reusable presentation contract. Tasks keeps saved-prompt delivery,
and Canvases keeps its preset and launcher. The design package is implemented
and its verification is recorded below.
## Scope
### In scope
- Recognized reference chips, preview, removal, and reference autocomplete in create mode.
- Plain-text serialization, draft restore, selection, undo, paste, and IME behavior.
- Existing attachment, enhancement, voice, plugin, and launch-preview integration.
- Desktop and phone rendered checks, including long drafts and prompt lookup failure.
### Out of scope
- Backend expansion, prompt storage, new dependencies, and canvas permissions.
- New Agent, task editing, passthrough, or general chat editor redesign.
- A rich Markdown authoring toolbar or separate prompt attachment collection.
## Technical approach
Use the [Task creation editor design](../../specs/ui/system-design/prompt-alias-rendering.md#task-creation-editor).
Add `TaskPromptReferenceEditor` and plain-text conversion/position helpers.
Use the installed Tiptap primitives without chat-specific state or capabilities.
Reuse `PromptMentionChip`, `splitMarkdownPromptMentionSegments`, and prompt store subscriptions.
Thread an explicit create-mode choice from `TaskCreateDialog` through
`DialogPromptSection` to `TaskFormInputs`. Keep `TaskFormInputsHandle` unchanged.
Adapt `useDescriptionInput` and plugin insertion to an internal editor handle.
The old textarea remains the default for other consumers.
Reference selection is opt-in for creation. Preserve `useInlineMention` inline
and context modes. Reuse `MentionMenu` positioning and query behavior.
Do not pass ProseMirror positions to plain-string splicing operations.
Retain `task-description-input` on the editable element, and update textarea-only
test helpers for create-mode contenteditable semantics without changing session assertions.
## ASCII UI preview
### UI-01: Desktop create dialog, recognized preset
Current input: plain goal followed by literal `@create-canvas`.
Proposed affected region:
```text
+-------------------------------------------------------+
| Create a coordinator view of the existing tasks. |
| |
| [@create-canvas] [x] |
| |
| [Attach] [Enhance] |
+-------------------------------------------------------+
| Agent / Model Executor |
| [Cancel] [Start task]|
+-------------------------------------------------------+
chip click / keyboard activation
-> current prompt preview
```
The chip uses the teal treatment from the transcript, not a new color system.
`[x]` is a separately named removal action for this occurrence.
The surrounding text stays editable. Chip activation never launches the task.
Maps to criteria `.1` through `.4` and `.7` under `AC-UI-PROMPT-ALIAS-002`.
### UI-02: Phone create dialog and prompt preview
```text
+-----------------------------+ +-----------------------------+
| New task | | Dimmed create dialog |
|-----------------------------| | |
| Create a coordinator view | +-----------------------------+
| of the existing tasks. | | @create-canvas |
| | |-----------------------------|
| [@create-canvas] [x] | | Current saved instructions |
| [Attach] [Enhance] | | ... scroll inside drawer ...|
| Agent / Model | | |
| Executor | +-----------------------------+
| ... scrolling form body ... | Dismiss -> same draft
|-----------------------------|
| [Cancel] [Start task] |
+-----------------------------+
```
The full-height form retains its footer and safe-area clearance.
Chip preview opens the existing touch drawer pattern, not a desktop hover card.
Chip/removal hit areas are at least 44px on touch devices. Names wrap or truncate
inside their available width, with the complete name accessible.
Long drafts scroll inside the bounded editor. Long previews scroll inside the drawer.
Maps to `.3`, `.4`, `.6`, and `.7`.
### UI-03: Unknown/loading and creation failure
```text
Prompt unavailable: Goal text ... @unknown-name
(ordinary editable text, submission available)
Creation failure: Goal text ... [@create-canvas] [x]
Existing error surface
[Cancel] [Start task]
```
Loading never erases the reference. Retry retains the draft and attachments.
Maps to `.5` and `.7`. All drawings specify structure, not pixel spacing or final copy.
New labels use localized strings. The same views apply to general task creation
and the canvas preset without a second editor implementation.
## Tests
All abbreviated criteria refer to `AC-UI-PROMPT-ALIAS-002`.
| Criteria | Planned evidence |
| --- | --- |
| `.1`, `.3`, `.5` | New `lib/prompts/task-prompt-document.test.ts`: exact text round trips, Unicode offsets, repeated names, code/link exclusions, store reconciliation. |
| `.1` to `.5` | New `components/task-prompt-reference-editor.test.tsx`: initial/typed/pasted aliases, selection, IME, removal, undo/redo, plain-text clipboard, previews, late/deleted prompts. |
| `.2`, `.7` | `hooks/use-inline-mention.test.ts`: reference opt-in and unchanged inline/context behavior. |
| `.3`, `.7` | `components/task-create-dialog-selectors.test.tsx`: synchronous handle updates, two plugin insertions then submit, enhancement, attachment lifecycle, draft/preview switching. |
| `.7` | `components/task/new-session-form-prompt.test.tsx`: unchanged full-content insertion outside create mode. |
## E2E tests
- `tests/task/task-create-prompt-autocomplete.spec.ts` and its `-qa` companion:
revise creation expectations from definitions to aliases. Cover Enter/Tab and
pointer selection, unknown names, preview, removal, undo, and captured task payload.
- New `tests/task/mobile-task-create-prompt-chips.spec.ts`: select by touch,
preview/dismiss, remove one repeated occurrence, restore, and submit.
Use the configured Pixel 5 project and `composer-visual-viewport` helpers.
Assert actual 44px preview/removal targets, drawer containment/internal scroll,
wrapped long names, long draft scrolling, footer reachability, and no document overflow.
Include reduced viewport height and 767/768px responsive checks.
- Existing `tests/canvas/plugin-canvas.spec.ts` and `mobile-plugin-canvas.spec.ts`:
retain preset, cancellation/reopen, controlled creation failure/retry, and payload checks.
Update only editor-specific selectors/assertions. Capture desktop/phone screenshots for UI-01/02.
- Run New Agent desktop/phone specs to prove create-only gating.
Browser tests prove reference serialization and editing, not server expansion.
Existing launch tests remain the authority for expansion behavior.
## Work orders
- [x] [Task 01: Build the reference editor](task-01-reference-editor.md) (done)
- [x] [Task 02: Integrate task creation](task-02-create-integration.md) (done)
Dependency order: 01, then 02. No delegation is required or authorized.
## Companion plans
The [alias rendering package](../prompt-alias-rendering/plan.md) covers read-only
surfaces. Its pending statuses remain unchanged despite existing shared code.
This package reuses that code, not its unrecorded verification results.
The completed [canvas creation package](../canvas-direct-creation/plan.md) remains
the historical record for the plain-text editor. This proposal replaces only its
editor presentation and autocomplete exclusion after implementation.
The [New Agent package](../agent-launch-prompt-composer/plan.md) remains unchanged
because reference mode is explicitly create-only.
## Verification results
Implementation checks on 2026-09-12:
- Task 01: the focused document, editor, mention, and shared chip unit command passed with 4 files and 37 tests; targeted ESLint, typecheck, specification lint, and diff checks passed.
- Task 02: the integration unit command passed with 5 files and 57 tests; full web lint passed with zero warnings; typecheck, i18n check and ratchet, backend build and plugin packaging, E2E build, desktop and phone work-order suites, migrated composer regressions, E2E sleep ratchet, public docs tests and validation, specification tests and lint, and diff checks all passed.
- Browser totals: 26 desktop work-order tests, 7 phone work-order tests, 12 desktop migrated regression tests, and 5 phone migrated regression tests passed.
Review remediation verification on 2026-09-12:
- Reconciled aliases from the full serialized draft in one transaction, restored plain-text anchor and head offsets, and kept reconciliation outside the undo history.
- Inserted plugin text as a plain-text ProseMirror fragment so HTML-like strings, entities, whitespace, and line breaks remain literal across synchronous calls.
- Added explicit textbox semantics to the create-mode contenteditable so the existing dialog locator works in browser accessibility trees.
- `cd apps/web && pnpm exec vitest run components/task-prompt-reference-editor.test.tsx components/task-create-dialog-selectors.test.tsx`: 2 files and 33 tests passed.
- `cd apps/web && pnpm exec vitest run components/task-create-dialog-selectors.test.tsx components/task-create-dialog-form-body.test.tsx components/task-create-dialog.test.tsx components/task/new-session-form-prompt.test.tsx components/canvas/canvas-task-create-launcher.test.tsx`: 5 files and 58 tests passed.
- `cd apps/web && pnpm e2e:run --host --no-build --project=chromium e2e/tests/chat/clarification.spec.ts --grep "pointer-events stuck on body" --retries=0`: 1 test passed.
- The planned desktop and phone work-order suites passed again with retries disabled: 26 Chromium tests and 7 mobile tests, followed by 12 Chromium migrated composer tests and 5 mobile migrated composer tests.
- Typecheck, full lint, Prettier, i18n check and ratchet, E2E sleep ratchet, public-doc tests and validation, specification tests and lint, and diff checks passed.
Design validation on 2026-09-12:
- `python3 scripts/lint-spec-files.test.py`: 36 tests passed.
- `python3 scripts/lint-spec-files.py --all`: passed.
- `git diff --check`: passed.
- Both pending work orders exist and reference requirement 002 and its design.
- Rendered tests were not run during the design-only validation; implementation rendered results are recorded above.
## Risks
- Text offsets differ from document positions, especially around Unicode and atoms.
- Whole-document replacement can erase undo history or move the caret.
- Shared form callers can inherit a behavior change unless create mode is explicit.
- Native textarea-only assertions exist beyond the named E2E specs. Inventory them
before integration and run every changed test through the affected work order.
- A chip previews current stored content, not a promise of later agent behavior.
## Documentation impact
The saved-prompts how-to in `docs/public/developer-tools.md` and the creation
description in `docs/public/canvases.md` now document editable references.
@@ -0,0 +1,114 @@
---
id: 01-reference-editor
title: Build the reference editor
status: done
wave: 1
depends_on: []
plan: plan.md
requirements:
- REQ-UI-PROMPT-ALIAS-002
acceptance_criteria:
- AC-UI-PROMPT-ALIAS-002.1
- AC-UI-PROMPT-ALIAS-002.2
- AC-UI-PROMPT-ALIAS-002.3
- AC-UI-PROMPT-ALIAS-002.4
- AC-UI-PROMPT-ALIAS-002.5
- AC-UI-PROMPT-ALIAS-002.6
system_design:
- ../../specs/ui/system-design/prompt-alias-rendering.md
---
# Task 01: Build the reference editor
## Summary
Build a scoped editor from installed Tiptap primitives. Its external contract
remains plain text, with recognized references as removable inline chips.
## In scope
- Text/document conversion, offset mapping, chip recognition, and store reconciliation.
- Shared chip appearance, desktop/touch preview, occurrence-specific removal, and undo.
- Prompt suggestion selection without full-definition insertion or implicit submission.
- IME-safe typing, clipboard text, external value changes, and stable selection.
## Out of scope
- Production task-form integration, backend delivery, and chat/session editor changes.
## Acceptance
- Round trips and offset tests preserve exact draft text across all mapped criteria.
- Editor tests prove selection, removal, previews, undo, and delayed prompt data.
- Existing inline/context insertion tests and shared chip tests remain green.
## ASCII UI preview
UI-01/02 excerpt from the [full preview](plan.md#ascii-ui-preview), criteria `.1` to `.6`:
```text
Editable goal text
[@create-canvas] [x]
Desktop activation -> prompt preview
Phone tap -> inset preview drawer
```
Removal is separate from preview activation. Touch controls have 44px hit areas.
The editor keeps bounded scrolling and text wrapping. UI-03 fallback remains ordinary text.
## Verification
Run from the repository root. Use TDD and record the failing regression before implementation.
New file paths below are deliverables of this work order.
```bash
(cd apps && pnpm install --frozen-lockfile)
(cd apps/web && pnpm exec vitest run lib/prompts/task-prompt-document.test.ts components/task-prompt-reference-editor.test.tsx hooks/use-inline-mention.test.ts components/task/chat/messages/prompt-mention-components.round2.test.tsx)
(cd apps/web && pnpm run typecheck)
(cd apps/web && pnpm exec eslint lib/prompts/task-prompt-document.ts components/task-prompt-reference-editor.tsx hooks/use-inline-mention.ts)
python3 scripts/lint-spec-files.py --all
git diff --check
```
## Files likely touched
- New `apps/web/lib/prompts/task-prompt-document.ts` and its test.
- New `apps/web/components/task-prompt-reference-editor.tsx` and its test.
- Extracted editor hooks/extensions and adjacent tests as needed for size limits.
- `apps/web/components/task/chat/messages/prompt-mention-components.tsx`.
- `apps/web/hooks/use-inline-mention.ts` and its test.
- `apps/web/src/locales/{en,pt-pt,zh-cn,zh-hk,zh-tw}/task.json` for new action labels.
## Dependencies
None. Reuse the shared renderer already present on this branch.
## Risks
Do not rebuild the entire editor document on each React render or store update.
Do not share session draft keys or import chat history behavior.
## Parallelism
`sequential`
## Inputs
- [Requirement](../../specs/ui/requirements/prompt-alias-rendering.md), requirement 002.
- [Design](../../specs/ui/system-design/prompt-alias-rendering.md#task-creation-editor).
- `use-tiptap-editor.ts`, `tiptap-mention-extension.tsx`, and `PromptMentionChip` as source precedents.
## Results
Implemented the plain-text-backed Tiptap editor, reference document conversion,
occurrence-specific removal, touch-sized controls, and create-mode autocomplete.
Task 02 owns the rendered desktop and phone verification.
Verification on 2026-09-12:
- `(cd apps && pnpm install --frozen-lockfile)`: passed.
- `cd apps/web && pnpm exec vitest run lib/prompts/task-prompt-document.test.ts components/task-prompt-reference-editor.test.tsx hooks/use-inline-mention.test.ts components/task/chat/messages/prompt-mention-components.round2.test.tsx`: 4 files and 37 tests passed.
- `cd apps/web && pnpm run typecheck`: passed.
- `cd apps/web && pnpm exec eslint lib/prompts/task-prompt-document.ts components/task-prompt-reference-editor.tsx hooks/use-inline-mention.ts`: passed.
- `python3 scripts/lint-spec-files.py --all`: passed.
- `git diff --check`: passed.
@@ -0,0 +1,142 @@
---
id: 02-create-integration
title: Integrate task creation
status: done
wave: 2
depends_on:
- 01-reference-editor
plan: plan.md
requirements:
- REQ-UI-PROMPT-ALIAS-002
acceptance_criteria:
- AC-UI-PROMPT-ALIAS-002.1
- AC-UI-PROMPT-ALIAS-002.2
- AC-UI-PROMPT-ALIAS-002.3
- AC-UI-PROMPT-ALIAS-002.4
- AC-UI-PROMPT-ALIAS-002.5
- AC-UI-PROMPT-ALIAS-002.6
- AC-UI-PROMPT-ALIAS-002.7
system_design:
- ../../specs/ui/system-design/prompt-alias-rendering.md
---
# Task 02: Integrate task creation
## Summary
Enable reference chips only for new tasks, including canvas presets.
Preserve shared form services and prove the complete desktop and phone interactions.
## In scope
- Explicit create-only mode through dialog/form props and the unchanged public form handle.
- Attachments, enhancement, voice/plugin insertion, drafts, launch preview, and retry.
- Desktop/phone E2E migration and public documentation for the changed creation interaction.
## Out of scope
- Changes to New Agent or task-edit insertion behavior, backend expansion, or canvas launch defaults.
## Acceptance
- General and canvas creation serialize aliases through the existing task payload.
- Desktop/phone tests prove UI-01 to UI-03, including interaction and measured geometry.
- Shared form tests and New Agent regressions pass with unchanged non-create semantics.
## ASCII UI preview
UI-01/02 excerpt from the [full preview](plan.md#ascii-ui-preview), criteria `.1` through `.7`:
```text
Desktop Phone
Goal [@prompt] [x] Goal
[Attach] [Enhance] [@prompt] [x]
Options [Attach] [Enhance]
[Cancel] [Start task] ... scrolling form ...
[Cancel] [Start task]
Tap chip -> preview drawer
```
UI-03 keeps the same draft after creation failure. Missing prompts stay ordinary text.
Measure drawer containment, internal scrolling, footer access, and touch hit areas.
Capture and inspect screenshots against the full previews.
## Verification
Run from the repository root, sequentially. The mobile chips spec is a new deliverable.
Inventory `task-description-input` consumers before edits, and add exact commands
for every additional changed test before marking this work order done.
```bash
(cd apps/web && pnpm exec vitest run components/task-create-dialog-selectors.test.tsx components/task-create-dialog-form-body.test.tsx components/task-create-dialog.test.tsx components/task/new-session-form-prompt.test.tsx components/canvas/canvas-task-create-launcher.test.tsx)
(cd apps/web && pnpm run typecheck)
(cd apps/web && pnpm run lint)
(cd apps/web && pnpm run i18n:check)
(cd apps/web && pnpm run i18n:ratchet)
make -C apps/backend build
make -C apps/backend e2e-plugin-package
(cd apps/web && pnpm run build:e2e)
(cd apps/web && pnpm e2e:raw --project=chromium --retries=0 tests/task/task-create-prompt-autocomplete.spec.ts tests/task/task-create-prompt-autocomplete-qa.spec.ts tests/canvas/plugin-canvas.spec.ts tests/session/new-session-dialog.spec.ts)
(cd apps/web && pnpm e2e:raw --project=mobile-chrome --retries=0 tests/task/mobile-task-create-prompt-chips.spec.ts tests/canvas/mobile-plugin-canvas.spec.ts tests/session/mobile-new-session-dialog.spec.ts)
node --test scripts/validate-public-docs.test.mjs
node scripts/validate-public-docs.mjs
python3 scripts/lint-spec-files.test.py
python3 scripts/lint-spec-files.py --all
git diff --check
```
## Files likely touched
- `apps/web/components/task-create-dialog.tsx`, `task-create-dialog-form-body.tsx`, and prop types/builders.
- `apps/web/components/task-create-dialog-selectors.tsx` and its tests.
- `apps/web/hooks/use-task-create-prompt-mention.ts` or the create-only replacement adapter.
- `apps/web/e2e/pages/kanban-page.ts` and the named E2E specs.
- `docs/public/developer-tools.md`, `docs/public/canvases.md`.
- This package's results and companion-plan links, without replacing historical results.
## Dependencies
Task 01. Run its tests again if integration changes its implementation.
## Risks
The editor ref must expose synchronous text during plugin insert-then-submit.
Preserve open-cycle draft identity and do not treat editor blur as dialog dismissal.
Avoid contenteditable HTML comparisons as proof of persisted description text.
## Parallelism
`sequential`
## Inputs
- [Requirement](../../specs/ui/requirements/prompt-alias-rendering.md), requirement 002.
- [Design](../../specs/ui/system-design/prompt-alias-rendering.md#task-creation-editor).
- Shared form tests, canvas E2E, and `mobile-prompt-mention-composer.spec.ts` viewport helpers.
## Results
Implemented create-only editor integration, preserved textarea behavior for
session and edit flows, migrated affected description assertions, added public
documentation, and added the phone prompt-chip workflow.
Verification on 2026-09-12:
- `cd apps/web && pnpm exec vitest run components/task-create-dialog-selectors.test.tsx components/task-create-dialog-form-body.test.tsx components/task-create-dialog.test.tsx components/task/new-session-form-prompt.test.tsx components/canvas/canvas-task-create-launcher.test.tsx`: 5 files and 57 tests passed.
- `cd apps/web && pnpm run typecheck`: passed.
- `cd apps/web && pnpm run lint`: passed with zero warnings.
- `cd apps/web && pnpm run i18n:check`: passed, with 7,994 referenced keys and all five catalogs complete.
- `cd apps/web && pnpm run i18n:ratchet`: passed; 1 added and 10 modified files clean, guard allowlist intact.
- `make -C apps/backend build`: passed.
- `make -C apps/backend e2e-plugin-package`: passed.
- `cd apps/web && pnpm run build:e2e`: passed.
- `cd apps/web && pnpm e2e:raw --project=chromium --retries=0 tests/task/task-create-prompt-autocomplete.spec.ts tests/task/task-create-prompt-autocomplete-qa.spec.ts tests/canvas/plugin-canvas.spec.ts tests/session/new-session-dialog.spec.ts`: 26 tests passed.
- `cd apps/web && pnpm e2e:raw --project=mobile-chrome --retries=0 tests/task/mobile-task-create-prompt-chips.spec.ts tests/canvas/mobile-plugin-canvas.spec.ts tests/session/mobile-new-session-dialog.spec.ts`: 7 tests passed.
- `cd apps/web && pnpm e2e:raw --project=chromium --retries=0 tests/task/enhance-prompt.spec.ts tests/plugins/composer-actions.spec.ts`: 12 tests passed.
- `cd apps/web && pnpm e2e:raw --project=mobile-chrome --retries=0 tests/task/mobile-task-create-escape.spec.ts tests/plugins/mobile-composer-actions.spec.ts`: 5 tests passed.
- `cd apps/web && pnpm run e2e:sleep-ratchet`: passed; no added sleeps.
- `node --test scripts/validate-public-docs.test.mjs`: 62 tests passed.
- `node scripts/validate-public-docs.mjs`: 46 published pages validated.
- `python3 scripts/lint-spec-files.test.py`: 36 tests passed.
- `python3 scripts/lint-spec-files.py --all`: passed.
- `git diff --check`: passed.
+21
View File
@@ -17,6 +17,27 @@ An administrator can enable `features.canvases` in **Settings > System > Feature
With the flag off, Kandev does not expose canvas tools, routes, events, background work, or navigation. Database migrations can still exist, but Kandev does not read or change canvas data.
## Start a canvas task
When canvases are enabled, open the workspace sidebar and expand **Canvases**.
If the workspace has no active canvases, select **Set up a canvas**. Kandev
opens the normal task form on the current page. It starts with an editable
coordinator-view goal followed by the `@create-canvas` saved-prompt reference.
Choose the agent, executor, workflow, and other task options, then select
**Start task**. The task uses no repository by default and prefers a local
executor. The saved-prompt reference appears as an editable chip. Select it to
preview the current instructions, or remove only that occurrence before you
submit.
On a phone, open **Settings > Workspace > Canvases** and select **Create
canvas**. The same full-screen task form and task options are available.
The `@create-canvas` reference keeps the detailed authoring instructions out
of the visible task description. Customize those instructions in **Settings >
Prompts**. The task description keeps the text you submitted, while the
reference is expanded when Kandev launches the task.
## Create a task canvas
1. Open the task that owns the canvas.
+13
View File
@@ -119,12 +119,25 @@ Open **Settings > Prompts** (`/settings/prompts`) to add, edit, or delete reusab
Type `@` in the task chat composer and select a prompt. The visible message keeps the `@name`; Kandev expands the prompt content into hidden system context for the agent. References are recognized only at the start of the text or after whitespace and must match the stored name. Prompt content can reference other saved prompts. Expansion stops at a depth of eight, skips cycles, and includes each prompt only once.
In the new task form, the same completion inserts an editable `@name` chip.
Select the chip to preview the saved prompt, or use its remove action to delete
that occurrence. Task creation submits the visible alias text, so later prompt
updates apply when the task launches. Unknown names and aliases in code spans or
link destinations remain ordinary text.
Kandev always seeds an editable built-in prompt named `create-canvas`. When
canvases are enabled, the workspace canvas setup form references it as
`@create-canvas`, so the task description stays short while the agent receives
the canvas authoring workflow at launch. Editing the prompt changes later
canvas tasks; a user prompt with the same name keeps its own content.
Initial task and Quick Chat launches also expand known references when no workflow step is configured. The stored message and the prompt sent to the agent keep the same saved-prompt context.
The Settings prompt editor also offers the same `@name` completion when you edit a saved prompt, a workflow prompt, a workflow step, an automation instruction, a quick action, or a provider watch. The prompt being edited is excluded from its own completion list, so selecting a reference cannot create a direct self-reference by accident. The same `@name` reference works in a workflow step's Prompt field and in a GitHub Review Watch's prompt; see [Saved prompt references in step prompts](workflow-tips.md#saved-prompt-references-in-step-prompts).
Kandev seeds these built-ins:
- `create-canvas`
- `code-review`
- `open-pr`
- `merge-base`
@@ -269,8 +269,10 @@ agent and review the canvas in the same task.
#### Acceptance criteria
- **AC-CANVASES-AGENT-WEB-APPS-009.1:** When canvases are enabled, the desktop
sidebar and workspace Canvases settings shall offer a Create canvas action.
- **AC-CANVASES-AGENT-WEB-APPS-009.1:** When canvases are enabled, selecting
Set up a canvas in the empty desktop sidebar shall open task creation
directly without changing the current route. Workspace Canvases settings
shall retain its Create canvas action and the sidebar its settings shortcut.
- **AC-CANVASES-AGENT-WEB-APPS-009.2:** The action shall open the standard task
creation flow with a localized canvas title and prompt, no repository, an
empty scratch path, and an eligible local executor preference.
@@ -281,15 +283,37 @@ agent and review the canvas in the same task.
and review the canvas.
- **AC-CANVASES-AGENT-WEB-APPS-009.5:** On a phone, workspace Canvases settings
shall expose the same task creation flow without a canvas-only form.
- **AC-CANVASES-AGENT-WEB-APPS-009.6:** The localized preset shall name the
canvas discovery, creation, skill-read, source-directory, and publication
steps. Tool identifiers shall remain exact in every locale.
- **AC-CANVASES-AGENT-WEB-APPS-009.6:** The localized preset shall contain a
short editable request for a coordinator view listing existing tasks,
followed by a blank line and the exact reference `@create-canvas`.
Detailed authoring instructions shall be available as that saved prompt.
- **AC-CANVASES-AGENT-WEB-APPS-009.7:** On desktop and phone, the user shall
be able to read and edit the preset before submission. The submitted task
shall retain those edits.
- **AC-CANVASES-AGENT-WEB-APPS-009.8:** The preset shall direct agents to use
authorized live Kandev data for domain views and report any required user
permission review or workspace promotion.
- **AC-CANVASES-AGENT-WEB-APPS-009.8:** The shipped saved prompt shall direct
agents through tool discovery, draft creation, one core skill read,
assigned-directory editing, and publication. It shall require authorized
live data and accurate release, permission-review, and promotion reporting.
- **AC-CANVASES-AGENT-WEB-APPS-009.9:** When a structured task starts with
`@create-canvas`, the agent shall receive the saved definition as hidden
context. The task description shall retain the user's short request and
reference. Create without starting shall defer expansion until launch.
- **AC-CANVASES-AGENT-WEB-APPS-009.10:** Users shall be able to customize
`create-canvas` through Settings > Prompts. Startup shall preserve an
existing same-name prompt and user edits. Removing the reference shall
remove its expansion from the next submitted request.
- **AC-CANVASES-AGENT-WEB-APPS-009.11:** Desktop and phone users shall be able
to edit the goal, cancel, retry a failed submission, and start the task.
Failure shall preserve edits; cancellation shall create no task or canvas.
The phone action shall remain reachable without horizontal page overflow.
Saved-prompt resolution follows
[Saved Prompt Delivery](../../tasks/requirements/saved-prompt-delivery.md),
including missing references, lookup failures, and passthrough exclusions.
## Implementation plans
- [Direct canvas creation and saved prompt](../../../plans/canvas-direct-creation/plan.md)
## Out of scope
@@ -207,29 +207,10 @@ each file.
## Guided canvas task launch
The desktop sidebar and workspace Canvases settings page use one shared canvas
task preset. The preset opens the standard `TaskCreateDialog`. It does not
create canvas metadata or add a canvas-only form.
The preset supplies:
- a localized task title and canvas-authoring prompt
- repository-free source mode with an empty scratch path
- a preference for an eligible local executor profile
- the selected workspace
The normal dialog continues to own workflow, workflow step, agent profile, and
executor compatibility. The workflow and agent profile remain editable. The
executor preference uses capability-based selection and never stores a profile
identifier in the preset.
Successful task creation follows the normal task route. The user continues the
conversation there, and the task agent uses the authoring lifecycle. The same
full-screen task dialog serves the workspace settings action on a phone. The
desktop sidebar does not exist at that viewport.
All launch surfaces remain behind `features.canvases`. A disabled client does
not request canvas counts, add a settings tab, or register the task preset.
The [guided canvas task launch design](guided-canvas-task-launch.md) owns
creation entry points, the editable preset, saved-prompt preparation, and
authoring prompt guidance. It maps the launch requirement and its desktop and
phone outcomes. The runtime authoring bundle remains below.
## Agent authoring guidance
@@ -548,11 +529,12 @@ The section contains:
- a workspace canvas count
- one row for each active workspace canvas
- a settings shortcut
- an empty setup row that opens canvas guidance
- an empty setup row that opens the guided task dialog
The sidebar does not create canvases directly. The empty setup row opens the
workspace Canvases settings page, where the guided task launch is available.
There is no package import or blank canvas action in the sidebar.
The empty setup row opens the guided task dialog on the current route.
The separate settings shortcut opens workspace canvas management. The task
agent creates the canvas after submission; opening the dialog does not create
canvas metadata. There is no package import or blank canvas builder action.
Routes are:
@@ -0,0 +1,178 @@
---
status: draft
system: canvases
created: 2026-09-10
requirements:
- REQ-CANVASES-AGENT-WEB-APPS-001
- REQ-CANVASES-AGENT-WEB-APPS-009
---
# Guided canvas task launch design
## Ownership and requirement mapping
Canvases owns guided task creation and canvas-specific authoring instructions.
This is a capability split from [the canvas lifecycle design](agent-authored-web-apps.md),
not a separate frontend contract. Tasks owns saved-prompt delivery.
| Requirement | Design sections |
| --- | --- |
| `REQ-CANVASES-AGENT-WEB-APPS-009` | Guided canvas task launch, Saved prompt preparation |
| `REQ-CANVASES-AGENT-WEB-APPS-001` | Agent authoring guidance; lifecycle remains in the linked design |
## Guided canvas task launch
The desktop sidebar and workspace Canvases settings page use one shared canvas
task preset. The preset opens the standard `TaskCreateDialog`. It does not
create canvas metadata or add a canvas-only form.
The preset supplies:
- a localized task title and short canvas goal followed by `@create-canvas`
- repository-free source mode with an empty scratch path
- a preference for an eligible local executor profile
- the selected workspace
The normal dialog continues to own workflow, workflow step, agent profile, and
executor compatibility. The workflow and agent profile remain editable. The
executor preference uses capability-based selection and never stores a profile
identifier in the preset.
Successful task creation follows the normal task route. The user continues the
conversation there, and the task agent uses the authoring lifecycle. The same
full-screen task dialog serves the workspace settings action on a phone. The
desktop sidebar does not exist at that viewport.
All launch surfaces remain behind `features.canvases`. A disabled client does
not request canvas counts, add a settings tab, or register the task preset.
`EmptyCanvasRow` in `components/app-sidebar/sections/canvases-section.tsx`
becomes a semantic button using `CanvasTaskCreateLauncher`. Give the shared
launcher a small presentation option for the sidebar row versus the existing
settings button. Keep one owner for open state, preset values, and success
navigation. Preserve `sidebar-canvases-empty` and `settings-create-canvas`
selectors. The separate `OpenCanvasSettingsShortcut` remains a management link.
Opening or cancelling creation does not push a route or create canvas records.
Bind the dialog to the active workspace at opening. Close and reset it if that
workspace changes, disappears, or the feature becomes disabled. A stale draft
must not submit into a newly selected workspace. Keep the launcher outside any
row that can disappear when a canvas-list refresh completes while it is open.
Use the existing focus-return contract for cancellation and normal success
navigation, including `meta.willNavigate`, to prevent duplicate navigation.
The phone entry remains workspace Canvases settings. The existing full-screen
`TaskCreateDialog` is the closest shipped exemplar: one focused form suits a
long editable goal with task options. Reuse its business state and submission
handler. Keep the form body as the scroll owner, with reachable footer actions,
dynamic viewport containment, safe-area clearance, and at least 44-pixel touch
targets. Retain ordinary desktop control sizes. No new mobile navigation or
canvas-only form is needed. On submission failure, preserve the goal and normal
dialog error/retry behavior. Test the rendered phone surface and focus return.
### Saved prompt preparation
Add `config/prompts/create-canvas.md` to the backend's existing prompt embed.
Register `builtin-create-canvas`, named `create-canvas`, in
`internal/prompts/store/sqlite.go:getBuiltinPrompts`. The current
`seedBuiltinPrompts` insert-on-conflict behavior seeds fresh and existing
installations without overwriting same-name prompts or user edits. No database
schema or canvas service change is required. This is normal saved-prompt data;
its presence does not expose disabled canvas routes or grant tool capabilities.
Settings > Prompts exposes the definition through existing prompt management.
Use the current name-collision behavior: a pre-existing user `create-canvas`
definition wins. Do not introduce a reserved name, silently rename user data,
or recreate a removed record during dialog opening. Startup retains the normal
built-in reseeding behavior. Prompt content is editable agent instruction data,
stored in English by default; it is not duplicated across UI locale catalogs.
The browser submits the edited description with its literal reference. Existing
`AppendReferenceExpansionsWithContext` and orchestrator launch preparation
resolve the current saved record and attach trusted hidden context. See
[Saved Prompt Delivery](../../tasks/system-design/saved-prompt-delivery.md) and
[the server-owned expansion decision](../../../decisions/2026-09-01-server-owned-saved-prompt-expansion.md).
Reuse that boundary; do not expand in the launcher or trust browser definitions.
The stored task description stays short. The canonical first user message and
dispatched structured prompt contain the expansion exactly once.
Start task resolves at launch. Create without starting saves the reference and
resolves the current definition when a session later starts. Workflow prompt
composition remains authoritative: a custom workflow that omits the task prompt
does not gain a canvas-specific injection bypass. Test the normal workflow and
no-step launch paths. Passthrough remains literal. Unknown or renamed prompts
and lookup failures use existing non-fatal resolution behavior; no hidden
fallback is fabricated. Removing `@create-canvas` removes this expansion, while
the independently capability-gated general canvas context remains unchanged.
The default literal reference needs no autocomplete change. The existing task
creation picker can still insert a chosen prompt inline; changing that generic
picker behavior is outside this package. The concise preset remains editable
as plain text and expands on submission/launch when the reference is retained.
## Agent authoring guidance
### Discovery and creation prompts
The shared task prompt uses the
[agent discovery contract](../../agents/system-design/mcp-tool-discovery-guidance.md).
When the resolved session profile includes `CapabilityCanvas`, it also includes
this compact instruction:
> For a requested Kandev canvas, discover `create_canvas_kandev`, `read_canvas_authoring_skill_kandev`, and `publish_canvas_kandev`.
> Create the draft in Kandev before writing application files.
> Read the authoring skill once and edit only inside the returned source directory.
> Publish through MCP and report the returned release status.
> If publication is unsuccessful, report the failure and do not claim that the canvas is published.
> Files or a successful local build do not create a published Kandev canvas.
The optional section is absent when the resolved profile lacks canvas tools.
This covers canvas requests inside ordinary task conversations, independently
of the guided task preset.
`CanvasTaskCreateLauncher` uses `canvases:createCanvasTaskPrompt` for the
localized goal. Append the literal `\n\n@create-canvas` in the preset builder so
translations cannot change the lookup name. The assembled English preset is:
```text
Create a new Kandev canvas with a coordinator view that lists the existing tasks.
@create-canvas
```
The definition in `config/prompts/create-canvas.md` contains this guidance:
> Create a Kandev canvas for the goal described in the user's request.
> If the application goal is missing, ask what the canvas must show or do.
> Find the Kandev canvas MCP tools before writing application files.
> If they are not callable, use native tool search for `kandev canvas` or inspect the available MCP catalog.
> Call `create_canvas_kandev` to create the draft and obtain its source directory.
> Read `read_canvas_authoring_skill_kandev` once without a path.
> Build inside the returned directory and use authorized live Kandev data for domain views.
> Call `publish_canvas_kandev` and address any validation errors.
> Report the canvas identity and whether its release is active, awaits permission review, or was unsuccessful.
> If publication is unsuccessful, report the failure and do not claim that the canvas is published.
> If workspace access requires promotion, explain the user action that is still required.
> A local build alone does not publish a canvas inside Kandev.
> If the tools remain unavailable, report the limitation instead of claiming that workspace files are a Kandev canvas.
The existing selected question capability governs any clarification. The
preset cannot grant a question tool to an autopilot session that lacks one.
An application goal already supplied by the user needs no repeated interview.
English, Portuguese, and Simplified Chinese catalogs contain the short goal.
Traditional Chinese catalogs and the pseudo-locale use repository generators.
The saved prompt preserves exact tool identifiers, independent of UI locale.
The nearest mobile exemplar is the existing full-screen `TaskCreateDialog`
opened from workspace Canvases settings. This is a content change within that
surface. Its scroll owner, touch controls, and navigation remain unchanged.
Focused desktop and mobile tests cover the concise editable prompt and its
submitted value. Backend tests cover the full definition and actual launch
expansion. Tests must retain the reference when exercising expansion; replacing
the whole description with mock-agent commands does not prove that contract.
## Implementation plan
[Direct canvas creation](../../../plans/canvas-direct-creation/plan.md).
@@ -58,9 +58,50 @@ recognize referenced prompts while reviewing any surface.
desktop and phone Prompt history surfaces, while preserving the existing
desktop-only visibility rule for the anchored last-prompt bar.
### REQ-UI-PROMPT-ALIAS-002: Editable references in task creation
**Intent:** Identify saved prompt references while users compose a new task.
This extends the reusable alias presentation contract beyond transcript views.
#### Acceptance criteria
- **AC-UI-PROMPT-ALIAS-002.1:** In task creation, recognized references shall
appear as inline chips with the transcript's color and name treatment.
This includes presets, restored drafts, pasted text, and completed typed aliases.
Unknown names shall remain editable text. Recognition shall preserve existing
name boundaries and Markdown code and link-destination exclusions.
- **AC-UI-PROMPT-ALIAS-002.2:** Selecting a saved prompt in task creation shall
insert its `@name` reference instead of its full definition.
Enter, Tab, pointer, and touch selection shall replace only the active query.
Selection shall retain editor focus and shall not submit the task.
- **AC-UI-PROMPT-ALIAS-002.3:** Users shall edit text around chips, remove an
individual reference, and undo or redo these edits without losing adjacent text.
Copy, paste, draft storage, and task submission shall retain plain-text aliases,
whitespace, and line breaks. Chip markup shall not enter the saved description.
- **AC-UI-PROMPT-ALIAS-002.4:** A chip shall expose the current saved definition
through pointer and keyboard activation on desktop and through a tap on touch devices.
Preview dismissal shall preserve the draft and return focus to the composer.
Users shall have a visible removal action that removes only the selected occurrence.
- **AC-UI-PROMPT-ALIAS-002.5:** Prompt loading or lookup failure shall not block
editing or submission. Store updates shall refresh recognition and previews without
changing draft text or selection. Deleted or renamed references shall become ordinary text.
- **AC-UI-PROMPT-ALIAS-002.6:** Phone creation shall retain its full-height form
and reachable footer. Chips shall wrap within the editor without document horizontal overflow.
Touch preview and removal controls shall have hit targets of at least 44px.
Long preview content shall scroll within its safe-area-aware drawer.
- **AC-UI-PROMPT-ALIAS-002.7:** Attachments, enhancement, voice insertion, plugin
insertion, launch preview, cancellation, and retry shall preserve their existing task-creation behavior.
New Agent, task editing, and other prompt editors shall retain their existing insertion behavior.
Backend expansion authority and passthrough exclusions shall remain unchanged.
## Out of scope
- Changing prompt alias parsing, matching, expansion depth, or agent delivery.
- Changing saved prompt persistence, prompt CRUD, or message APIs.
- Adding prompt numbers, navigation behavior, or new Markdown features.
- Rendering aliases in passthrough, comments, plans, or unrelated editors.
## Implementation plans
- [Transcript alias rendering](../../../plans/prompt-alias-rendering/plan.md)
- [Task-create reference chips](../../../plans/task-create-prompt-chips/plan.md)
@@ -3,6 +3,7 @@ status: draft
system: ui
requirements:
- REQ-UI-PROMPT-ALIAS-001
- REQ-UI-PROMPT-ALIAS-002
created: 2026-09-02
owners:
- kandev
@@ -22,6 +23,7 @@ Agent-facing prompt expansion and persistence are unchanged.
| Requirement | Design section |
| ------------------------- | -------------------------------------------------------------------------------------------------- |
| `REQ-UI-PROMPT-ALIAS-001` | [Components and responsibilities](#components-and-responsibilities), [Control flow](#control-flow) |
| `REQ-UI-PROMPT-ALIAS-002` | [Task creation editor](#task-creation-editor) |
## Components and responsibilities
@@ -96,3 +98,105 @@ No new runtime metrics or logs are required. Unit coverage will assert shared
recognized/unknown behavior and surface-specific rendering; existing anchored
bar, ChatMessage, and Prompt history E2E coverage remains the behavioral smoke
signal.
## Task creation editor
This section is a proposed extension. Transcript behavior above remains unchanged.
UI owns this extension because alias presentation and editing serve all task types,
not only canvases. Tasks retains [saved-prompt delivery](../../tasks/system-design/saved-prompt-delivery.md).
### Integration boundary
`DialogPromptSection` currently uses `TaskFormInputs`, which owns a native textarea.
`useTaskCreatePromptMention` adapts that textarea to `useInlineMention` with
`promptInsertMode: "inline"`. That mode inserts the full saved definition today.
Add an explicit create-only editor mode through `TaskCreateDialog` and
`DialogPromptSection`. Do not infer create mode from `!isSessionMode`, because
task editing shares that branch. Other callers retain the textarea path.
The proposed `TaskPromptReferenceEditor` uses the installed Tiptap document,
paragraph, text, hard-break, history, and suggestion primitives. It does not
mount `TipTapInput` or `useTipTapEditor`: those own session history, slash commands,
entity references, and chat draft persistence. No new editor dependency is required.
### Plain-text contract and editing
Keep `TaskFormInputsHandle.getValue`, `setValue`, and `getAttachments` unchanged.
The external value remains plain text. New document conversion helpers preserve
leading/trailing whitespace, empty lines, aliases, and surrounding Markdown literally.
Do not parse the draft into rich Markdown or accept clipboard HTML as executable markup.
Use `splitMarkdownPromptMentionSegments` from `prompt-mention-components.tsx`
for recognition. If extraction is needed, move it with its tests without changing
matching behavior. Each recognized occurrence becomes an inline atom with its
exact original text and lookup name. Serialization returns that text, not a prompt
ID or definition. The atom uses `PromptMentionChip` and its existing theme tokens.
Presets, paste, and external value replacement recognize complete aliases immediately.
Typing recognizes a completed alias after a boundary or editor blur. Keep an active
`@` query editable until selection or completion, so shorter names do not capture
longer names during typing. Do not transform text during IME composition.
Backspace after an atom and Delete before an atom remove that occurrence.
A visible removal action offers the same outcome by pointer, keyboard, and touch.
Undo restores both reference text and chip presentation. Clipboard serialization
uses plain text for chips and preserves the selected surrounding text.
An internal editor adapter maps plain-text offsets to document positions for
selection and insertion. Do not reuse Tiptap document positions as string offsets.
Plugin insertion must retain synchronous insert-then-submit behavior from
`useDescriptionInput`, including two insertions within one callback.
### Suggestions, preview, and recovery
Use the existing prompt source, ranking, `MentionMenu`, and viewport placement.
Create-only selection writes an alias and a usable caret position. It must not
change the `inline` and `context` modes used by other consumers.
The suggestion handler consumes Enter and Tab before dialog submission.
Normal Enter remains a newline, and IME confirmation never submits.
Reuse `PromptMentionChip` preview content and pointer-aware disclosure behavior.
An editor-local action slot can supply removal without nesting a button inside
another button. Associate removal with the document occurrence, not the prompt name.
Closing the preview restores a stable selection beside that occurrence.
`useCustomPrompts` supplies prompt data through the existing store. Recognition
updates do not emit a changed draft, reset undo history, or move the caret.
When a name disappears, replace its atom with its original text while mapping selection.
Failed prompt loading leaves text usable and supplies no client-side fallback definition.
Task creation failure retains text, references, and attachments for retry.
### Desktop and phone composition
Desktop keeps the current task dialog and toolbar. The editable goal contains
inline chips rather than a separate attachment list. The shared chip supplies a
compact preview trigger. Ordinary actions retain the standard desktop density.
Phone keeps `TaskCreateDialog` as the full-height editing surface. It is already
the nearest creation exemplar. `PromptMentionChip` supplies the nearest preview
exemplar: `useTouchDrawer`, a fixed drawer header, and a safe-area-aware scroll body.
The drawer fits this temporary inspection task without adding a navigation step.
Chips wrap, and very long names stay within editor bounds with accessible full names.
Touch preview/removal actions meet the 44px hit-area minimum without enlarging
desktop controls. Use `useResponsiveBreakpoint` for layout and `useTouchDrawer`
for disclosure, including coarse-pointer tablets.
The form body retains outer scrolling and its existing reachable footer.
The editor retains bounded internal scrolling for long drafts, with the caret visible.
The preview drawer owns its content scroll while open. Suggestions retain the
[visual viewport contract](../requirements/composer-suggestion-overlays.md).
### Compatibility and verification
There is no task schema, prompt CRUD, backend expansion, or permission change.
Task descriptions and launch preview retain literal references. Later launch uses
the then-current server definition under the existing workflow composition rules.
Passthrough sessions do not gain hidden expansion or a claim that chips guarantee delivery.
The [implementation plan](../../../plans/task-create-prompt-chips/plan.md) owns
serialization, editing, integration, and rendered desktop/phone checks for criteria `.1` through `.7`.
Tests must prove task payloads, not infer serialization from chip appearance.
Related decision: [Server-owned expansion](../../../decisions/2026-09-01-server-owned-saved-prompt-expansion.md).