@zq-silk/yui 0.8.9 → 0.9.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 (35) hide show
  1. package/ARCHITECTURE.md +48 -46
  2. package/README.md +33 -31
  3. package/dist/cli/commandCatalog.js +7 -7
  4. package/dist/cli.js +1 -31
  5. package/dist/commands/executionAuditCommands.js +2 -2
  6. package/dist/commands/taskCommands.js +110 -307
  7. package/dist/commands/taskCompletionGate.js +15 -12
  8. package/dist/commands/taskContextCommand.js +18 -11
  9. package/dist/commands/taskNextActionCommand.js +4 -5
  10. package/dist/commands/taskWorkspaceCommands.js +2 -2
  11. package/dist/execution/executionGroup.js +0 -3
  12. package/dist/executor/agentExecutor.js +4 -2
  13. package/dist/executor/effectiveLaunch.js +33 -3
  14. package/dist/integration/gitIntegrationService.js +1 -1
  15. package/dist/lifecycle/exactRunTerminalization.js +12 -8
  16. package/dist/observability/orchestrationMetrics.js +5 -19
  17. package/dist/profile/agentProfile.js +1 -1
  18. package/dist/repository/taskWorkspaceCoordinator.js +2 -0
  19. package/dist/repository/taskWorkspacePreparer.js +173 -26
  20. package/dist/review/reviewRound.js +41 -24
  21. package/dist/storage/migration/productionRegistry.js +138 -0
  22. package/dist/storage/sqliteStore.js +1 -1
  23. package/dist/storage/taskStore.js +26 -27
  24. package/dist/task/completionReadiness.js +24 -22
  25. package/dist/task/nextAction.js +47 -61
  26. package/dist/task/task.js +12 -19
  27. package/dist/web/assets/client/components.js +3 -1
  28. package/dist/web/assets/client/i18n.js +6 -0
  29. package/dist/web/webSnapshot.js +0 -3
  30. package/i18n/README.zh-CN.md +18 -19
  31. package/package.json +1 -1
  32. package/skills/yui-leader/SKILL.md +47 -43
  33. package/skills/yui-operator/SKILL.md +24 -33
  34. package/skills/yui-reviewer/SKILL.md +18 -12
  35. package/skills/yui-worker/SKILL.md +5 -3
package/ARCHITECTURE.md CHANGED
@@ -5,31 +5,32 @@ runtimes. The user talks to one Operator. The Operator routes each request to
5
5
  the right Project and Task; that Task's Leader owns decomposition, execution
6
6
  choice, review, integration, and completion.
7
7
 
8
- ## One outcome model, two delivery paths
9
-
10
- `Task` is the bounded user outcome. Its delivery path is derived from existing
11
- fields rather than stored as another state machine: no Project bindings means
12
- `no-project`; a Project-backed Task without `requireIntegration` is `direct`;
13
- and `requireIntegration=true` is `integrated`.
14
-
15
- Direct delivery lets the Leader implement and verify a low-risk result in the
16
- managed Task main without creating a WorkItem. Integrated delivery uses
17
- `WorkItem` as its only bounded execution unit; it holds the objective,
18
- acceptance criteria, dependencies, assigned Task Role when applicable,
19
- lifecycle, and compact reviewed result.
20
-
21
- For each integrated WorkItem, a Leader chooses one of three execution paths:
22
-
23
- 1. **Direct**: the Leader executes a roleless WorkItem.
24
- 2. **Native subagent**: the Leader creates a child through its current Agent
25
- conversation. The child inherits the Leader Agent and is not a Yui entity.
26
- 3. **Task Role AgentRun**: Yui dispatches a Role-bound WorkItem to a
27
- Task-managed native Agent Session.
28
-
29
- There is no Yui subagent launcher or child-session record. A native child on
30
- direct delivery remains inside the Leader Session and Task-main boundary; a
31
- native child implementing integrated work uses the WorkItem lifecycle. Managed
32
- independent execution additionally records an AgentRun.
8
+ ## One outcome, Leader-chosen execution topology
9
+
10
+ `Task` is the bounded user outcome. Its optional `type` describes intent, not
11
+ execution topology; software Projects normally use `feature` or `bugfix`, while
12
+ other Projects may define their own types. Yui does not store a direct versus
13
+ integrated delivery mode.
14
+
15
+ A software bugfix is Leader-owned: the Leader implements and verifies it in the
16
+ managed Task main without manufacturing a WorkItem. If the scope proves to need
17
+ independent delivery owners, reclassify it as a feature before creating those
18
+ units. For a feature, the Leader judges whether the whole result is small
19
+ enough to own in the same way or large enough to need independently owned
20
+ delivery units.
21
+
22
+ `WorkItem` means one substantial, independently acceptable requirement with a
23
+ clear owner. Create multiple WorkItems only when multiple Workers can own and
24
+ advance those requirements independently, normally in parallel. Internal
25
+ implementation steps, test runs, review findings, and local fixes remain Run,
26
+ Event, report, or commit evidence under the existing Task or WorkItem; they are
27
+ not new WorkItems.
28
+
29
+ Each WorkItem may use a native subagent inside the Leader conversation or a
30
+ Task Role AgentRun backed by a durable Worker Session. There is no Yui
31
+ subagent launcher or child-session record. AgentRun is an execution attempt,
32
+ not a requirement, and repeated Runs may continue the same compatible Role
33
+ Session.
33
34
 
34
35
  ## Profiles, Roles, and Agents
35
36
 
@@ -49,8 +50,10 @@ independent execution additionally records an AgentRun.
49
50
  - A `WorkItemCandidate` is the explicit result currently awaiting Leader
50
51
  acceptance. It snapshots the WorkItem revision, summary, and either a
51
52
  yielded execution Run or a Leader-managed direct source.
52
- - `ReviewRound` records review of one candidate under the same WorkItem and
53
- references that immutable candidate. It is not another WorkItem.
53
+ - `ReviewRound` records one semantic judgment. A WorkItem Review references
54
+ that WorkItem's immutable Candidate. A Task-final Review references the
55
+ frozen Task heads directly and has no synthetic WorkItem/Candidate anchor.
56
+ It is never another WorkItem.
54
57
 
55
58
  Adding another Agent requires an explicit adapter implementation. Profiles do
56
59
  not choose adapters, own Sessions, or carry credentials.
@@ -65,7 +68,7 @@ effort, round, result, and checks.
65
68
 
66
69
  ## Lifecycle and acceptance
67
70
 
68
- Integrated Leader-direct and native-subagent WorkItem execution follows:
71
+ Native-subagent WorkItem execution follows:
69
72
 
70
73
  ```text
71
74
  todo -> running -> done | failed
@@ -92,16 +95,12 @@ Every result awaiting acceptance is stored as an explicit WorkItem candidate.
92
95
  `always` dispatches a review AgentRun for every candidate, whether it comes
93
96
  from a yielded execution Run or a Leader-managed direct result; `leader`
94
97
  leaves every candidate for the Leader to accept directly or review explicitly.
95
- `final` applies automatically only to integrated delivery: it keeps WorkItem
96
- acceptance and Integration independent, then `task complete` queues one fresh
97
- Task-scoped ReviewRound over the frozen committed heads of every bound Project.
98
- A direct Task may use a bounded native review. When a managed final Review is
99
- required, it must be promoted before Task main advances; promotion fails after
100
- a commit or delivery evidence exists so earlier work cannot lose ChangeSet
101
- provenance.
102
- Any established immutable Task-final contract or Round remains an obligation.
103
- A changed integrated head queues a new round; the previous report remains
104
- evidence. This final Reviewer evaluates the whole
98
+ `final` keeps WorkItem acceptance and Integration independent and supplies the
99
+ default Reviewer Role when the Leader decides the frozen Task result warrants
100
+ an independent final Review. An immutable Task-final contract can require that
101
+ Review. Once a Task-final Round exists, it remains an obligation; a changed
102
+ Task head requires a new Round and the previous report remains evidence. This
103
+ final Reviewer evaluates the whole
105
104
  Task, so normal delivery does not pay for a complete review of every WorkItem.
106
105
  Review Runs complete only their exact ReviewRound, leave the WorkItem awaiting
107
106
  acceptance, and never trigger another review or append a Candidate. Successful
@@ -114,9 +113,12 @@ never merges it automatically.
114
113
  Roles describe Agent capability, but they do not own repository workspaces. A
115
114
  `ManagedWorkspace` is keyed by its durable owner (`Task`, `WorkItem`,
116
115
  `ReviewRound`, or `IntegrationAttempt`); an AgentRun carries only a launch
117
- snapshot. Review workspaces are fresh writable copies at the Candidate's
118
- frozen commit, so diagnostics cannot redirect Develop or become a ChangeSet
119
- source. Each ReviewRound has an independent lifecycle and explicit cleanup.
116
+ snapshot. Review workspaces are writable copies at the frozen commit, so
117
+ diagnostics cannot redirect Develop or become a ChangeSet source. Task-final
118
+ Rounds keep independent immutable records but may reassign one clean physical
119
+ workspace to the next Round for the same Reviewer Role. This lets the native
120
+ Reviewer Session continue while every Run remains bound to its exact Round and
121
+ head.
120
122
 
121
123
  Dependencies are enforced at dispatch. A Role cannot have overlapping active
122
124
  Runs, and terminal Task state fences new messages, dispatches, retries, and
@@ -147,8 +149,8 @@ Projects and Task-main context for the rest. The managed dispatch and
147
149
  writable set. Provider permission is binding configuration: every managed Role
148
150
  defaults to `bypass`, while `default` and `configured` preserve provider-native
149
151
  behavior. Provider permission and Profile access intent do not grant Project
150
- writes. A direct source write requires the exact Leader Task-main owner. An
151
- integrated source write requires an exact WorkItem write scope and matching
152
+ writes. A Leader-owned source write requires the exact Task-main owner. A
153
+ WorkItem source write requires an exact WorkItem write scope and matching
152
154
  managed workspace; a review write instead
153
155
  requires an exact ReviewRound owner and frozen Candidate base. Profiles and
154
156
  Skills constrain behavior even when provider prompts are bypassed. Provider
@@ -185,9 +187,9 @@ independently acceptable ownership.
185
187
 
186
188
  Capture at the same HEAD reuses the existing ChangeSet. A repaired HEAD creates
187
189
  a new candidate; only the latest reviewed candidate may satisfy acceptance.
188
- An isolated WorkItem cannot be accepted, or an integrated Task completed, while
189
- any writable Project's latest result is uncaptured or unintegrated. Direct
190
- completion instead requires a clean committed exact Task-main snapshot.
190
+ An isolated WorkItem cannot be accepted, or a Task with WorkItems completed,
191
+ while any writable Project's latest result is uncaptured or unintegrated.
192
+ Leader-owned completion instead requires a clean committed exact Task-main snapshot.
191
193
  Workspace roots are
192
194
  multi-Project; ChangeSets and Integration Attempts remain single-Project Git
193
195
  boundaries.
package/README.md CHANGED
@@ -250,8 +250,8 @@ yui project update app --alias app-cli
250
250
  yui project refresh app
251
251
  yui project list
252
252
 
253
- yui task create "Fix CSV escaping" --project app --delivery direct
254
- yui task create "Ship CSV export" --project app --delivery integrated
253
+ yui task create "Fix CSV escaping" --project app --type bugfix
254
+ yui task create "Ship CSV export" --project app --type feature
255
255
  yui task update <task-id> --priority high --tags release,csv --due-at 2026-08-01T00:00:00Z
256
256
  yui task update <task-id> --clear-priority --clear-tags --clear-due-at
257
257
  yui task show <task-id>
@@ -259,18 +259,16 @@ yui task context <task-id>
259
259
  yui task activate <task-id>
260
260
  ```
261
261
 
262
- Project delivery is explicit but uses the existing Task schema. `direct` means
263
- the Leader implements and verifies one low-risk result on clean committed Task
264
- main; it needs no WorkItem, IntegrationAttempt, or policy-created final
265
- ReviewRound. `integrated` requires WorkItem, ChangeSet, and committed Integration
266
- evidence and remains the path for guarded, cross-Project, migration,
267
- authorization, concurrency/recovery, destructive, and release changes. Global
268
- final-review policy applies automatically only to integrated delivery. A direct
269
- Task can use a bounded native review. If an independently managed final Review
270
- is required, promote before Task main advances; promotion fails closed after a
271
- commit or delivery evidence exists so earlier work cannot lose ChangeSet
272
- provenance. Legacy `--require-integration` is an alias for
273
- `--delivery integrated`, and integrated delivery cannot be downgraded.
262
+ Task type describes intent rather than selecting an execution protocol.
263
+ Software Projects use `bugfix` or `feature`: a bugfix is Leader-owned; if it
264
+ grows into independently owned delivery requirements, reclassify it as a
265
+ feature before creating WorkItems. The Leader decides whether a feature is
266
+ small enough to deliver on Task main or large enough for independently owned WorkItems. A WorkItem is
267
+ one substantial requirement for one Worker, not a development step, test run,
268
+ review finding, or local fix. Multiple WorkItems are useful only when distinct
269
+ Workers can advance meaningful requirements independently. Once WorkItems
270
+ produce Git results, their ChangeSets must be integrated into the Leader's
271
+ Task main before Task-final Review or completion.
274
272
 
275
273
  `project refresh` is the explicit network operation for a stable Project checkout. It fetches the
276
274
  configured stable branch directly from the Project remote URL and advances only through a clean,
@@ -313,9 +311,9 @@ yui config show
313
311
  yui config workflow clear review
314
312
  ```
315
313
 
316
- For Project-backed software delivery, use `--trigger final` to keep WorkItem
317
- acceptance and Integration independent and run one fresh ReviewRound over the
318
- complete frozen integrated Task candidate before completion:
314
+ For Project-backed software delivery, use `--trigger final` to supply the
315
+ default Reviewer Role when the Leader decides the complete frozen Task result
316
+ needs an independent Review:
319
317
 
320
318
  ```sh
321
319
  yui config workflow set review --role reviewer --trigger final
@@ -330,10 +328,13 @@ or a Leader-managed direct result; `leader` leaves the candidate awaiting
330
328
  acceptance so the Leader can accept it directly or run
331
329
  `yui task work review <task-id>/<work-item-id>`. A configured review rule therefore keeps
332
330
  Leader-managed candidates awaiting a decision instead of marking them done.
333
- `final` does not create WorkItem ReviewRounds; `task complete` queues one
334
- Task-scoped ReviewRound after every bound Project has a committed Integration,
335
- and re-queues a new round only when those frozen heads change. The final
336
- Reviewer follows Project Policy/Knowledge and reports reachable, material,
331
+ `final` does not create WorkItem ReviewRounds or decide Task topology. The
332
+ Leader explicitly requests a Task-scoped Review, unless an immutable Task
333
+ contract requires one. The Round freezes Task main directly, so even a
334
+ Leader-owned Task with no WorkItem can be reviewed. A changed frozen head needs
335
+ a new semantic Round; the same compatible Reviewer Session may continue in its
336
+ stable workspace, while every Run remains bound to its exact Round and head.
337
+ The Reviewer follows Project Policy/Knowledge and reports reachable, material,
337
338
  actionable findings across the complete Task.
338
339
  A ReviewRound freezes the Candidate's exact Git commit and creates a fresh,
339
340
  ReviewRound-owned writable worktree on a unique branch. Its AgentRun may edit,
@@ -385,7 +386,7 @@ expands:
385
386
  yui task create "Update authentication" \
386
387
  --project backend --project frontend \
387
388
  --base backend=develop --base frontend=main \
388
- --delivery integrated
389
+ --type feature
389
390
  yui task project add <task-id> shared-sdk --base main
390
391
  ```
391
392
 
@@ -565,15 +566,15 @@ bounded next options. Yield records immutable Run/Candidate or Review evidence
565
566
  only; it does not imply acceptance, WorkItem completion, ChangeSet capture,
566
567
  Integration, or Task completion.
567
568
 
568
- For integrated bounded work, the Leader owns one roleless WorkItem and may
569
- execute it directly or create a native subagent through the current Agent
570
- conversation. Direct delivery operates on Task main without creating this
571
- WorkItem:
569
+ For one substantial feature requirement, the Leader may create a WorkItem and
570
+ give it to a native subagent or Task Role Worker. A small Task or bugfix stays
571
+ on Task main. Do not create a WorkItem merely to record implementation steps,
572
+ tests, review, or follow-up fixes:
572
573
 
573
574
  ```sh
574
- yui task work create <task-id> "Review the implementation" \
575
- --objective "Return source-backed findings" \
576
- --accept "Every finding identifies an affected path"
575
+ yui task work create <task-id> "Implement the export API" \
576
+ --objective "Deliver the independently acceptable export API requirement" \
577
+ --accept "The API contract and focused validation are complete"
577
578
  yui task work update <task-id>/<work-item-id> running
578
579
  yui config profile show reviewer
579
580
  ```
@@ -706,8 +707,9 @@ yui task complete <task-id> --summary-file delivery.txt \
706
707
  This does not weaken normal freshness checks. Yui requires the current,
707
708
  unsuperseded Publication to be merged and verified, its local commit to equal
708
709
  the physical Task head, its remote commit to be ancestry-divergent, and both
709
- commits to resolve to the same exact tree. Integrated delivery also requires
710
- the latest completed Task-final Review; direct delivery does not invent one.
710
+ commits to resolve to the same exact tree. When a Task-final Review obligation
711
+ exists, completion also requires the latest semantic Round to attest the
712
+ accepted Task head; otherwise completion does not invent a ReviewRound.
711
713
  `--refresh-remote` fetches
712
714
  the remote object graph before resolving that Publication commit. For a Task
713
715
  governed by a durable exact final-review contract, the user/Operator command
@@ -241,9 +241,9 @@ const taskChildren = [
241
241
  {
242
242
  name: "create",
243
243
  summary: "Create a Draft Task.",
244
- usage: "yui task create <title> [--project <project> ...] [--base <project>=<ref> ...] [--delivery <direct|integrated>] [--require-integration]",
245
- options: ["--project", "--base", "--delivery", "--require-integration"],
246
- optionValues: { "--delivery": ["direct", "integrated"] }
244
+ usage: "yui task create <title> [--type <project-defined-type>] [--project <project> ...] [--base <project>=<ref> ...]",
245
+ options: ["--type", "--project", "--base"],
246
+ optionValues: { "--type": ["feature", "bugfix"] }
247
247
  },
248
248
  {
249
249
  name: "project",
@@ -266,15 +266,15 @@ const taskChildren = [
266
266
  {
267
267
  name: "update",
268
268
  summary: "Update Task metadata.",
269
- usage: "yui task update <id> [--title <text>] [--description <text>|--clear-description] [--priority <low|medium|high|urgent>|--clear-priority] [--tags <comma-separated>|--clear-tags] [--due-at <RFC3339>|--clear-due-at] [--delivery <direct|integrated>] [--require-integration]",
269
+ usage: "yui task update <id> [--title <text>] [--type <project-defined-type>|--clear-type] [--description <text>|--clear-description] [--priority <low|medium|high|urgent>|--clear-priority] [--tags <comma-separated>|--clear-tags] [--due-at <RFC3339>|--clear-due-at]",
270
270
  options: [
271
- "--title", "--description", "--priority", "--tags", "--due-at",
271
+ "--title", "--type", "--description", "--priority", "--tags", "--due-at",
272
+ "--clear-type",
272
273
  "--clear-description", "--clear-priority", "--clear-tags", "--clear-due-at",
273
- "--delivery", "--require-integration"
274
274
  ],
275
275
  optionValues: {
276
276
  "--priority": ["low", "medium", "high", "urgent"],
277
- "--delivery": ["direct", "integrated"]
277
+ "--type": ["feature", "bugfix"]
278
278
  }
279
279
  },
280
280
  { name: "activate", summary: "Activate a Draft Task.", usage: "yui task activate <id>" },
package/dist/cli.js CHANGED
@@ -1844,36 +1844,6 @@ async function prepareReviewLaneWorkspaces(taskId, reviewRoundId, store, prepare
1844
1844
  return map;
1845
1845
  }
1846
1846
  async function directTaskMainSnapshotForTaskCommand(args, store, preparer, environment, taskFinalReviewContract) {
1847
- const deliveryOption = args.indexOf("--delivery", 3);
1848
- const deliveryPromotion = args[0] === "task"
1849
- && args[1] === "update"
1850
- && args[2] !== undefined
1851
- && (args.includes("--require-integration", 3)
1852
- || (deliveryOption >= 0 && args[deliveryOption + 1] === "integrated"));
1853
- if (deliveryPromotion) {
1854
- const task = store.getTask(args[2]);
1855
- if (task === null
1856
- || (task.status !== "active" && task.status !== "draft")
1857
- || task.requireIntegration === true
1858
- || task.projectBindings.length === 0) {
1859
- return undefined;
1860
- }
1861
- const workspace = store.getTaskWorkspace(task.id);
1862
- if (task.status === "draft" && workspace === null)
1863
- return undefined;
1864
- if (workspace === null
1865
- || workspace.owner.type !== "task"
1866
- || workspace.owner.taskId !== task.id) {
1867
- throw usageError(`Task has no authoritative main workspace: ${task.id}.`);
1868
- }
1869
- try {
1870
- return await preparer.snapshotDirectTaskMain(workspace, task.projectBindings.map(({ projectId }) => projectId));
1871
- }
1872
- catch (error) {
1873
- throw usageError(`Delivery promotion Task-main verification failed for ${task.id}: `
1874
- + `${error instanceof Error ? error.message : String(error)}`);
1875
- }
1876
- }
1877
1847
  if (taskFinalReviewContract === undefined
1878
1848
  || args[0] !== "task"
1879
1849
  || args[1] !== "work"
@@ -1913,7 +1883,7 @@ async function actualTaskReviewCandidateForTaskCommand(args, store, preparer, en
1913
1883
  if (task === null || task.status !== "active" || task.projectBindings.length === 0) {
1914
1884
  return undefined;
1915
1885
  }
1916
- // Every Project-backed completion, including direct delivery, must freeze
1886
+ // Every Project-backed completion must freeze
1917
1887
  // a clean committed Task-main snapshot. Review policy only decides whether
1918
1888
  // that head also needs an independent ReviewRound.
1919
1889
  taskId = task.id;
@@ -219,7 +219,7 @@ export function renderExecutionAudit(report, width = defaultTableWidth()) {
219
219
  if (orchestration.tasks.length > 0) {
220
220
  lines.push(renderTable("Task orchestration metrics", [
221
221
  { header: "Task", minWidth: 7, maxWidth: 14 },
222
- { header: "Delivery", minWidth: 8, maxWidth: 10 },
222
+ { header: "Type", minWidth: 8, maxWidth: 12 },
223
223
  { header: "Runs", minWidth: 4, maxWidth: 6 },
224
224
  { header: "WIs", minWidth: 3, maxWidth: 5 },
225
225
  { header: "Review F/D/N", minWidth: 12, maxWidth: 16 },
@@ -229,7 +229,7 @@ export function renderExecutionAudit(report, width = defaultTableWidth()) {
229
229
  { header: "Advice", minWidth: 6, maxWidth: 8 }
230
230
  ], orchestration.tasks.map((task) => [
231
231
  task.taskId,
232
- task.deliveryPath,
232
+ task.taskType ?? "unspecified",
233
233
  String(task.runs.total),
234
234
  String(task.workItems),
235
235
  `${task.reviews.full}/${task.reviews.delta}/${task.reviews.nonSemantic}`,