Skip to content

Commit 1e21ad1

Browse files
authored
Merge pull request #101 from pr/dw-8-result-errors
refactor(workflow): model operational failures with better-result
2 parents 4cb4007 + 1a6764d commit 1e21ad1

82 files changed

Lines changed: 7314 additions & 1562 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/chatgpt-coding-workflow.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,17 @@ DevSpace discovers standard Agent Skills from:
8585
- project `.agents/skills`
8686
- `~/.devspace/skills`
8787

88-
It also keeps compatibility with:
88+
It also includes:
8989

90-
- the bundled `subagent-delegation` skill when `DEVSPACE_SUBAGENTS=1`, unless `~/.devspace/skills/subagent-delegation/SKILL.md` exists
90+
- the package-managed `subagents` skill when the Subagents capability is enabled
91+
- the package-managed `dynamic-workflows` skill when the Dynamic Workflows capability is enabled
9192
- `DEVSPACE_AGENT_DIR/skills`, defaulting to `~/.codex/skills`
9293
- additional paths from `DEVSPACE_SKILL_PATHS`
9394

9495
When Subagents are enabled, DevSpace discovers agent profiles
9596
from `~/.devspace/agents/*.md` and project `.devspace/agents/*.md`.
9697
`open_workspace` exposes a compact catalog with profile names, descriptions,
97-
providers, and optional models/thinking levels so the model can choose a configured agent
98+
providers, and optional models/effort levels so the model can choose a configured agent
9899
without seeing provider-specific launch details.
99100

100101
Example profiles are packaged under `examples/agents/` for users who want
@@ -113,10 +114,15 @@ Skill paths may be outside the workspace. DevSpace only permits reading:
113114

114115
Set `DEVSPACE_SKILLS=0` to hide skills from workspace output. Set
115116
`DEVSPACE_SUBAGENTS=1` to expose the experimental subagent catalog and
116-
`subagent-delegation` skill. That skill teaches the minimal
117-
`devspace agents ls`, `devspace agents run`, and `devspace agents show`
118-
workflow. The catalog comes from `open_workspace`; `devspace agents ls` lists
119-
existing subagent sessions for that workspace.
117+
`subagents` skill. That skill can use target information already supplied by the
118+
host or discover it with `devspace agents targets`. `devspace agents ls` lists
119+
existing subagent sessions for the current workspace.
120+
121+
Set `DEVSPACE_WORKFLOWS=1` to enable Dynamic Workflows independently. When the
122+
variable is omitted, Dynamic Workflows follows the effective Subagents setting,
123+
including persisted config and any environment override. Disabled features are
124+
omitted from the `open_workspace` schema and response rather than returned as
125+
empty capability arrays.
120126

121127
## Tool Names
122128

@@ -148,12 +154,22 @@ registered. `exec_command` returns a process session ID when a command is still
148154
running after its yield window. Use `write_stdin` to poll it, send input, resize
149155
a PTY, or send Ctrl-C. Set `tty: true` only for commands that need a terminal.
150156

151-
## Show Changes
157+
## Widget UI and Show Changes
152158

153159
By default, `DEVSPACE_WIDGETS=full`.
154160

155-
In that mode, DevSpace attaches widget UI to the exposed workspace, file, edit,
156-
and shell tools. The aggregate `show_changes` tool is not exposed by default.
161+
In that mode, DevSpace attaches widget UI to the exposed workspace, workflow,
162+
file, edit, and shell tools. The `open_workspace` dropdown presents the opened
163+
root, loaded skills and instructions, available agent providers/profiles, and
164+
currently active workflows for that workspace.
165+
166+
Dynamic Workflow views are read-only. They refresh through app-only MCP tools
167+
and show observed phases, agent calls, replay state, worktree isolation, errors,
168+
and recent activity. When the host supports MCP Apps fullscreen display mode,
169+
the card offers an **Open dashboard** presentation control. It does not add
170+
cancel, resume, apply, or cleanup actions.
171+
172+
The aggregate `show_changes` tool is not exposed by default.
157173

158174
Use `DEVSPACE_WIDGETS=off` to disable widget UI, or `DEVSPACE_WIDGETS=changes`
159175
to expose the aggregate show-changes flow.

docs/configuration.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ sessions.
8383

8484
| Value | Behavior |
8585
| --- | --- |
86-
| `full` | Default. Widget UI is attached to exposed workspace, file, edit, and shell tools. |
86+
| `full` | Default. Widget UI is attached to exposed workspace, workflow, file, edit, and shell tools, including read-only live workflow dashboards. |
8787
| `changes` | Enables the aggregate `show_changes` tool and attaches widget UI to `open_workspace` and `show_changes`. |
8888
| `off` | Disables widget UI. |
8989

@@ -93,6 +93,7 @@ sessions.
9393
| --- | --- |
9494
| `DEVSPACE_SKILLS` | Set to `0` to hide skills. Enabled by default. |
9595
| `DEVSPACE_SUBAGENTS` | Set to `1` to expose configured agent profiles as Subagents. Experimental and disabled by default. |
96+
| `DEVSPACE_WORKFLOWS` | Experimental Dynamic Workflows gate. When unset, it follows the effective Subagents setting, including persisted config and any environment override. |
9697
| `DEVSPACE_AGENT_DIR` | Defaults to `~/.codex`; its `skills` child is loaded for compatibility. |
9798
| `DEVSPACE_SKILL_PATHS` | Optional comma-separated additional skill directories. |
9899

@@ -102,25 +103,35 @@ DevSpace discovers standard Agent Skills from:
102103
- project `.agents/skills`
103104
- `~/.devspace/skills`
104105

105-
It also keeps compatibility with:
106+
It also includes:
106107

107-
- the bundled `subagent-delegation` skill when `DEVSPACE_SUBAGENTS=1`, unless `~/.devspace/skills/subagent-delegation/SKILL.md` exists
108+
- the package-managed `subagents` skill when the Subagents capability is enabled
109+
- the package-managed `dynamic-workflows` skill when the Dynamic Workflows capability is enabled
108110
- `DEVSPACE_AGENT_DIR/skills`, defaulting to `~/.codex/skills`
109111
- additional paths from `DEVSPACE_SKILL_PATHS`
110112

113+
User and project skills with the same name take precedence over bundled skills.
114+
DevSpace does not copy bundled skills into `~/.devspace/skills` during setup.
115+
111116
When Subagents are enabled, DevSpace discovers agent profiles
112117
from:
113118

114119
- `~/.devspace/agents/*.md`
115120
- project `.devspace/agents/*.md`
116121

117122
`open_workspace` returns a compact catalog containing profile names,
118-
descriptions, providers, and optional models/thinking levels so the host model can choose an
123+
descriptions, providers, and optional models/effort levels so the host model can choose an
119124
agent without reading provider-specific launch details. `devspace agents ls`
120125
lists existing subagent sessions for the current workspace, scoped by the
121-
workspace environment injected into shell commands. The `subagent-delegation`
122-
skill teaches the model to use only the minimal `devspace agents ls`,
123-
`devspace agents run`, and `devspace agents show` workflow.
126+
workspace environment injected into shell commands. The `subagents`
127+
skill teaches the model to discover targets with `devspace agents targets`,
128+
then use the minimal `devspace agents run`, `devspace agents show`, and
129+
`devspace agents ls` workflow.
130+
131+
Provider availability is detected at runtime. DevSpace does not persist probe
132+
timestamps, availability snapshots, or an experimental provider enable-list in
133+
`config.json`. Final provider policy and onboarding are deferred until the
134+
Subagents and Dynamic Workflows features are finalized.
124135

125136
Starter profile templates are available under `examples/agents/`. Copy or adapt
126137
them into one of the active profile directories before use.

docs/dynamic-workflow/devspace/plan.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Subagents stay **CLI-only**. Workflows get **CLI + MCP** over shared primitives.
1919
| `budget` stub v1 | `{ total: null, spent: () => 0, remaining: () => Infinity }`. |
2020
| Dual surface | `devspace workflow *` **and** MCP `run_workflow` / `workflow_status` / `workflow_cancel`. |
2121
| All 6 providers v1 | codex/claude/opencode/pi/cursor/copilot via existing adapters. |
22-
| `agentProviders.enabled` | Ordered config from onboarding; default provider = first enabled ∩ live. |
22+
| Provider policy | Runtime uses currently available providers in stable product order. Durable provider policy and onboarding are deferred. |
2323
| Resume-by-replay right after engine core | Same milestone order as locked plan. |
2424

2525
---
@@ -119,28 +119,28 @@ runProvider({ provider, prompt, workspace, model, effort, providerSessionId? })
119119
- If product later wants unified list, add a flag — not v1.
120120
- `workspace` is either shared `workspaceRoot` or a managed worktree path when `opts.isolation === 'worktree'`.
121121

122-
### 4.3 Provider resolution + config
122+
### 4.3 Provider resolution now; policy later
123123

124-
Config add (see primitives-spec §3):
124+
Current experimental runtime:
125125

126-
```ts
127-
agentProviders?: {
128-
enabled: AgentProviderId[] // order = preference; [0] = default
129-
detectedAt?: string
130-
lastProbe?: Array<{ id, available, detail? }>
131-
}
132-
```
126+
- Probe provider availability at execution time.
127+
- Resolve `opts.provider``meta.defaultProvider` → first available provider
128+
in stable product order.
129+
- Keep probe timestamps and unavailable reasons in diagnostics only; do not
130+
persist them in user configuration.
131+
- Unknown or unavailable explicit providers fail that `agent()` call.
133132

134-
Algorithm: `opts.provider``meta.defaultProvider` → first of `enabled ∩ liveAvailable`.
135-
Missing `agentProviders` → compat all-available in code order.
136-
Onboarding (`init`/`doctor`) probes PATH and writes `enabled`.
137-
Unknown/unavailable: fail that `agent()` (throw → parallel null).
133+
The final onboarding release may add an ordered array of provider policy
134+
objects with `id`, `enabled`, `defaultModel`, and `defaultEffort`. That contract
135+
is deliberately deferred so the workflow stack does not publish an unfinished
136+
configuration shape.
138137

139138
### 4.4 Skills gating fix (required, not optional)
140139

141-
Today `effectiveSkillPaths` drops **entire** bundled dir if user has seeded `subagent-delegation` — hides any new bundled skill.
142-
143-
v1: include bundled **per-skill** (user copy wins on name collision). Seed `dynamic-workflows` in `user-config` next to subagent skill.
140+
Bundled `subagents` and `dynamic-workflows` skills remain package-managed.
141+
User/project copies win on name collision. Setup does not copy bundled skills
142+
into `~/.devspace/skills`, which prevents generated copies from shadowing later
143+
package updates. The legacy `subagent-delegation` name is suppressed.
144144

145145
### 4.5 MCP vs CLI symmetry
146146

@@ -240,9 +240,9 @@ Provider-native strings pass through unchanged.
240240
| **3 Engine** | `isolation` path with fake/temp git repos in tests |
241241
| **4 Worker+CLI** | real worktree create/cleanup; journal fields |
242242
| **5 Resume** | cache key includes isolation |
243-
| **8 Teach** | skill isolation + effort; seed `agentProviders` docs |
243+
| **8 Teach** | skill isolation + effort; document deferred provider policy |
244244
| Cross-cutting | rename `thinking``effort` in profile/CLI/store/adapters (can land with M3–4) |
245-
| Config | `agentProviders` on user-config + init probe (with M4 or M8) |
245+
| Config | Keep provider availability runtime-only until final onboarding. |
246246

247247
---
248248

@@ -305,8 +305,8 @@ E2E: `npm test` + `npm run typecheck`; live fan-out 2 providers CLI; same MCP; c
305305
| `cli.ts` `spawnAgentWorker` / `agents __worker` | copy for `workflow __worker` |
306306
| `process-platform.terminateProcessTree` | hard cancel |
307307
| `db/client` WAL + busy_timeout 5000 | multi-process journal |
308-
| `server.ts` `registerAppTool` + `config.subagents` gate | tools only if subagents on |
309-
| `skills.ts` / `user-config.ts` | gate fix + seed |
308+
| `server.ts` `registerAppTool` + workflow capability gate | tools only if workflows are enabled |
309+
| `skills.ts` | independent package-managed skill gates |
310310
| `process-sessions` yield bounds | MCP status yield caps |
311311

312312
---
@@ -356,7 +356,7 @@ Do not open MCP before CLI smoke — debug path must work headless without a hos
356356

357357
## Resolved questions (see also [primitives-spec.md](./primitives-spec.md))
358358

359-
1. **Default provider:** `opts.provider``meta.defaultProvider` → first of **onboarding-configured** `agentProviders.enabled` ∩ live available. Full config schema in primitives-spec §3.
359+
1. **Default provider:** `opts.provider``meta.defaultProvider` → first live provider in stable product order. Final provider defaults and enablement are deferred to onboarding finalization.
360360
2. **writeMode:** **not in v1 API**; skill teaches prompt-based RO/write.
361361
3. **Isolation:** **`isolation?: 'worktree'` is v1 must-have** on `agent()`; default shared; no auto-merge.
362362
4. **Effort rename:** `thinking`**`effort`** across profiles, CLI, store, adapters, `agent()` opts, cache keys.
@@ -366,4 +366,4 @@ Do not open MCP before CLI smoke — debug path must work headless without a hos
366366
8. **Cancel:** cooperative flag → then group-kill.
367367

368368
**File-change tracking:** out of scope.
369-
**Schema:** `opts.schema` + Ajv + retries — in scope.
369+
**Schema:** `opts.schema` + Ajv + retries — in scope.

0 commit comments

Comments
 (0)