@zq-silk/yui 1.1.0 → 2.0.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 (67) hide show
  1. package/ARCHITECTURE.md +2 -1
  2. package/ARCHITECTURE.zh-CN.md +2 -1
  3. package/README.md +3 -1
  4. package/dist/cli/commandCatalog.js +66 -54
  5. package/dist/cli/managedDiagnostics.js +2 -1
  6. package/dist/cli/updatePorts.js +0 -5
  7. package/dist/cli.js +113 -107
  8. package/dist/commands/controllerCommands.js +2 -1
  9. package/dist/commands/globalRoleCommands.js +84 -43
  10. package/dist/commands/grantCommands.js +48 -8
  11. package/dist/commands/taskCommands.js +146 -196
  12. package/dist/commands/taskContextCommand.js +29 -6
  13. package/dist/commands/taskFactCommands.js +10 -69
  14. package/dist/commands/taskInputCommands.js +26 -35
  15. package/dist/commands/taskPublicationCommands.js +2 -35
  16. package/dist/commands/taskPublicationVerifyCommand.js +1 -2
  17. package/dist/commands/taskUpstreamCommands.js +2 -1
  18. package/dist/context/runContextPack.js +8 -29
  19. package/dist/context/sessionBootstrapManifest.js +5 -101
  20. package/dist/context/taskContext.js +98 -39
  21. package/dist/controller/clientRuntime.js +16 -8
  22. package/dist/controller/fileSchedulerStoreAdapter.js +24 -0
  23. package/dist/controller/runtime.js +6 -0
  24. package/dist/core/controllerClient.js +46 -21
  25. package/dist/core/protocol.js +12 -7
  26. package/dist/doctor/doctor.js +6 -3
  27. package/dist/doctor/ptyProbe.js +74 -0
  28. package/dist/doctor/ptyProbeChild.js +90 -0
  29. package/dist/errors/cliError.js +4 -4
  30. package/dist/errors/cliFailure.js +213 -0
  31. package/dist/executor/fileRoleLaunchPlanner.js +1 -4
  32. package/dist/grant/capabilityGrant.js +13 -0
  33. package/dist/grant/taskAuthorization.js +127 -0
  34. package/dist/kernel/builtinCapabilities.js +60 -8
  35. package/dist/kernel/kernelPorts.js +2 -2
  36. package/dist/output/boundedRead.js +118 -0
  37. package/dist/release/releaseWorkflowEngine.js +8 -1
  38. package/dist/runtime/managedCaller.js +2 -2
  39. package/dist/runtime/runtimeCoherence.js +10 -8
  40. package/dist/storage/sqliteSchema.js +10 -0
  41. package/dist/storage/storageVersions.js +1 -1
  42. package/dist/storage/taskStore.js +3 -0
  43. package/dist/task/leaderArchive.js +111 -0
  44. package/dist/task/leaderArchiveAuthority.js +24 -0
  45. package/dist/tmux/commandExecutor.js +7 -5
  46. package/docs/architecture/README.md +1 -0
  47. package/docs/architecture/README.zh-CN.md +1 -0
  48. package/docs/cli-information-contract.md +107 -0
  49. package/docs/cli-information-contract.zh-CN.md +81 -0
  50. package/docs/managed-turn-and-session-runtime.md +9 -0
  51. package/docs/managed-turn-and-session-runtime.zh-CN.md +6 -0
  52. package/docs/plugin-sdk.md +7 -3
  53. package/docs/plugin-sdk.zh-CN.md +5 -2
  54. package/docs/release-workflow.md +19 -9
  55. package/docs/release-workflow.zh-CN.md +14 -7
  56. package/docs/storage-baseline.md +5 -0
  57. package/docs/testing/verification-levels.md +12 -2
  58. package/docs/testing/verification-levels.zh-CN.md +8 -0
  59. package/i18n/README.zh-CN.md +3 -1
  60. package/package.json +3 -3
  61. package/skills/yui-leader/SKILL.md +8 -1
  62. package/skills/yui-leader/references/authorization.md +64 -0
  63. package/skills/yui-leader/references/execution.md +18 -4
  64. package/skills/yui-leader/references/task-plugins.md +4 -2
  65. package/skills/yui-operator/SKILL.md +9 -2
  66. package/skills/yui-runtime/SKILL.md +51 -9
  67. package/skills/yui-runtime/references/publication.md +3 -1
@@ -1,7 +1,7 @@
1
1
  # Task-local capabilities
2
2
 
3
3
  Read this before creating, validating or activating a Task-local plugin.
4
- Use the stable Session CLI's capability directory and read the exact schema
4
+ Use the `yui` CLI's capability directory and read the exact schema
5
5
  before each unfamiliar operation. Prefer an existing tool, composition or
6
6
  one-off script unless a reusable named capability is useful.
7
7
 
@@ -17,7 +17,9 @@ the exact plugin id, digest, environment, trust and phase, within its remaining
17
17
  uses and validity. A source change cannot inherit an old digest's grant.
18
18
  Trusted-local subprocesses are not an OS sandbox.
19
19
 
20
- Never issue your own grants, impersonate Operator, change global configuration,
20
+ Use [source-authorized capabilities](authorization.md) when original user input
21
+ already authorizes the exact Task plugin/resource. Never invent grants,
22
+ impersonate Operator, change global configuration,
21
23
  or modify the core installation, namespace or carrying Endpoint to obtain a
22
24
  tool. Request only a genuinely missing resource or trust boundary, not authority
23
25
  already available. Plugin grants do not authorize unrelated external effects.
@@ -227,8 +227,15 @@ a dormant Role and verify the complete binding before the next launch.
227
227
 
228
228
  ## Present current progress
229
229
 
230
- Use JSON reads and their top-level `data` field. Report the facts needed to
231
- understand the outcome:
230
+ Use JSON reads and their top-level `data` field.
231
+ Use Global Context's `pending`/`recent` pages to find Messages, then
232
+ `role message show operator <id>` for the original. A successful send receipt
233
+ contains saved identity and delivery/control facts, not another copy of the
234
+ submitted body. Follow Runtime's bounded-read contract for list continuations
235
+ and long `contentPage` details; do not decode `output` as nested JSON or print
236
+ an entire Context again merely to extract one already-returned reference.
237
+
238
+ Report the facts needed to understand the outcome:
232
239
 
233
240
  - Task ID, Projects, recorded bases, and lifecycle;
234
241
  - current WorkItems, ownership, dependencies, and acceptance state;
@@ -17,8 +17,8 @@ workspace layout, native transcript, or an earlier AgentRun.
17
17
  ## Enter through the current context
18
18
 
19
19
  There are two normal Task entry points. A user may continue directly with the
20
- current, unrevoked Leader Session: read current context using the Session CLI
21
- with `task context <task-id> --json`. Do not request a self-wake, reopen a Task,
20
+ current, unrevoked Leader Session: read current context using
21
+ `yui task context <task-id> --json`. Do not request a self-wake, reopen a Task,
22
22
  or reuse an old completed AgentRun snapshot merely to obtain authority. Pending
23
23
  delivery, unknown execution evidence and missing reports do not themselves
24
24
  revoke Session authority. Task lifecycle, scope, Assignment, workspace and
@@ -27,26 +27,35 @@ authority merely because the Task becomes active.
27
27
  Use the runtime-provided `TMPDIR` for temporary context or diagnostic files,
28
28
  not fixed shared `/tmp` names or the logical multi-Project workspace container.
29
29
 
30
+ Ordinary commands use `yui` from the intended launch environment's PATH and
31
+ `YUI_HOME`. Session/native identity, Task/Assignment/workspace authority and
32
+ Controller protocol/storage checks still apply; they do not distinguish every
33
+ installation with the same protocol and storage versions. If the entry or Home
34
+ is wrong or unavailable, report that fact and use the explicitly authorized
35
+ entry/environment; do not guess another installation or clear Session identity.
36
+
30
37
  For every explicitly dispatched managed Task AgentRun:
31
38
 
32
39
  1. Read the exact AgentRun identity from the newest Bootstrap Envelope.
33
- 2. Before acting, load its authorized pack with the Session CLI named by the
34
- current Session Manifest:
40
+ 2. Before acting, load its authorized pack using the current Session Manifest's
41
+ Context command and the exact Task/Run identity:
35
42
 
36
43
  ```sh
37
- "$YUI_SESSION_CLI" task run context "$YUI_TASK_ID/<run-id>" --json
44
+ yui task run context "<task-id>/<run-id>" --json
38
45
  ```
39
46
 
40
47
  3. Verify that the returned Task, AgentRun, Role, purpose, Snapshot digest, workspace,
41
48
  and Adapter match the Envelope and Session Manifest. Stop and report a
42
49
  context-load failure if the pack is missing, stale, unauthorized, malformed,
43
50
  or mismatched. Never request an inline/full-prompt fallback.
44
- 4. Use pack summaries and pointers first. Expand only an authorized ref when
51
+ 4. Use the pack's `pointers` (including each pointer's summary) first. They are
52
+ the single readable-ref inventory; `deltaRefs` contains only changed identities.
53
+ Expand only an authorized ref when
45
54
  its full value is needed, selecting it by the pointer's exact `store` and
46
55
  `refId`:
47
56
 
48
57
  ```sh
49
- "$YUI_SESSION_CLI" task run context expand "$YUI_TASK_ID/<run-id>" <ref-id> --store <store> --mode full --json
58
+ yui task run context expand "<task-id>/<run-id>" <ref-id> --store <store> --mode full --json
50
59
  ```
51
60
 
52
61
  `--store` is required, even when the ref id is unique. Select both fields
@@ -119,14 +128,47 @@ TUI, with the configured Agent, permissions and workspace unchanged. A live
119
128
  unmanaged Session is not silently replaced or adopted; use an explicit Session
120
129
  lifecycle action before enabling controlled delivery.
121
130
 
122
- Context reads never consume queue entries. Read the referenced Message in full
123
- from Session Context. Native/transport acceptance is not implementation, and
131
+ Context reads never consume queue entries. Global Context returns bounded
132
+ `pending` and `recent` discovery pages, not Message bodies. Read a referenced
133
+ original with `role message show <role> <message-id> --json`. Follow a pending
134
+ page's `nextCursor` using `role message list <role> --pending --cursor <cursor>`
135
+ when it is incomplete; accepted delivery does not erase the Message from the
136
+ separate all-message list. Native/transport acceptance is not implementation, and
124
137
  `interrupt-requested` is not a stopped Turn or stopped background resources.
138
+ Saving a Task Message or Brief is not notification delivery to Operator. A
139
+ Task Role uses the existing Task InputRequest path for a genuinely missing
140
+ user decision, not global Role input controls or fabricated progress questions.
125
141
  Only an exact terminal and the original Session/writer boundary can release a
126
142
  then handoff. An accepted or unconfirmed steer must not be submitted again by
127
143
  changing its request id or composing then. A conclusive rejection permits an
128
144
  explicit new control attempt; uncertainty does not.
129
145
 
146
+ ## Read bounded information completely when required
147
+
148
+ Structured CLI results live in the top-level `data`, not a JSON-encoded
149
+ `output` string. Task current Context includes bounded current facts and
150
+ message references; it does not include event or terminal Run history.
151
+ `collections` and `attention` identify incomplete discovery. Use
152
+ `task context list <task> --store <store> [--cursor <cursor>]` to discover one
153
+ family, then `task context inspect <task> --store <store> --ref <refId>
154
+ --digest <digest>` to read its exact current value. Common Task lists use the
155
+ same `items`, `total`, `complete`, and `nextCursor` contract. Do not treat the
156
+ first page or a summary as complete requirements.
157
+
158
+ Long detail reads return `contentPage` instead of the ordinary value (under
159
+ `data.context` for Run context/expand, `data.contextDelta` for Run Context delta). Repeat the same read with
160
+ `--cursor <contentPage.nextCursor>` until `complete: true`. Concatenate `text`
161
+ in offset order and parse the combined JSON once, retaining the same source
162
+ and digest. A source-change error requires a fresh read, not mixing old and
163
+ new chunks. Never use a read cursor to repeat a mutation.
164
+
165
+ Read all pages of a relevant original requirement, result, or authorization
166
+ before acting on it. For a wake, read its complete fixed window and the
167
+ referenced original Messages; the wake itself contains pointers, not reports.
168
+ For unrelated discovery, stop once the necessary evidence is found. Task
169
+ event deltas retain their fixed upper bound and are history, not replacement
170
+ current state. No read acknowledges implementation or consumes a queue.
171
+
130
172
  ## Preserve intent and authority
131
173
 
132
174
  An analysis, diagnosis, or review request is read-only unless the user also
@@ -87,7 +87,9 @@ is not Candidate acceptance, Review, Integration or Task completion.
87
87
 
88
88
  ## Archive separately
89
89
 
90
- Completion does not authorize archive. The Operator obtains authorization for
90
+ Completion does not authorize archive. A delivery Leader with original user
91
+ authorization may use [ordinary archive](../../yui-leader/references/authorization.md);
92
+ this grants no force or abandonment authority. Otherwise the Operator obtains authorization for
91
93
  the exact Task, checks archive eligibility, then uses `--integrated` for verified
92
94
  merged delivery or `--abandon` for deliberate non-delivery. General archive
93
95
  approval never implies `--force` authority. Preserve the Task record.