@excitedjs/dreamux 0.22.0-beta.150 → 0.22.0-beta.151

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.
package/README.md CHANGED
@@ -24,13 +24,15 @@ Design background:
24
24
  - Public CLI bin: `dreamux`. It owns onboarding, serving, status, doctor,
25
25
  dispatcher commands, and config commands. TeamMate and Team orchestration are
26
26
  available through Dreamux-owned MCP surfaces.
27
- - Bundled Dreamux skills injected at runtime by role (issue #209 slice 6):
27
+ - Bundled Dreamux skills injected at runtime by role (issues #209 and #313):
28
28
  core hands the Dispatcher `dispatcher-workflow` and `dreamux-maintenance`, the
29
- TeamLeader `team-workflow`, and the runtime applies them to its engine (Codex
30
- `skills/extraRoots/set`, Claude Code `--add-dir`). The package exposes
31
- role-specific skill roots so root scanning cannot cross role boundaries.
32
- `dreamux onboard` does not install bundled skills into
33
- dispatcher workspaces.
29
+ TeamLeader `team-workflow`, and both roles the shared `workflow` skill. The
30
+ runtime applies those role-specific plus shared roots to its engine (Codex
31
+ `skills/extraRoots/set`, Claude Code `--add-dir`). Role-specific roots remain
32
+ disjoint, while the shared root is deliberately composed into both roles.
33
+ For admin-created TeamLeaders, required-source normalization protects both
34
+ `team-workflow` and `workflow` from custom skill-root shadowing. `dreamux
35
+ onboard` does not install bundled skills into dispatcher workspaces.
34
36
  - Providerized dispatcher declarations, a process-local provider registry,
35
37
  server-owned state/log paths, the `builtin:feishu` Channel provider, the
36
38
  `builtin:codex` and `builtin:claude-code` Agent Runtime providers, and
@@ -107,11 +109,11 @@ logs:
107
109
 
108
110
  | Path | Purpose | Source of truth |
109
111
  |---|---|---|
110
- | `~/.dreamux/config.json` | User-editable provider config and local channel credentials, created by `dreamux onboard`; edit and restart to apply | the operator |
112
+ | `dreamux config path` (normally `~/.dreamux/config.json`) | User-editable provider config and local channel credentials, created by `dreamux onboard`; edit and restart to apply | the operator |
111
113
  | `~/.dreamux/run/admin.sock` | Admin Unix socket (+ `admin.sock.lock`); volatile run file | the server |
112
114
  | `~/.dreamux/run/restart-intent.json` | One-shot daemon restart marker; volatile run file | the server |
113
115
  | `~/.dreamux/run/sockets/` | Fallback root for ephemeral Codex app-server rendezvous sockets (preferred root: `$XDG_RUNTIME_DIR/dreamux/sockets/`); random per start, never persisted | the server |
114
- | `~/.dreamux/state/<id>/access.json` | Dispatcher-local access-gate state | the server |
116
+ | `~/.dreamux/state/<id>/access.json` | Dispatcher-local Feishu access state: schema/runtime ledger are Channel-owned; policy fields and quiesced `allow_users` maintenance are operator-authorized | mixed |
115
117
  | `~/.dreamux/state/<id>/identity.json` | Dispatcher root agent identity and runtime recovery state | the server |
116
118
  | `~/.dreamux/state/<id>/teammate/` | TeamMate task ledger, results, and delivery retry state | the server |
117
119
  | `~/.dreamux/cache/<id>/spill/` | Over-budget teammate completion spill files; rebuildable cache, only the path is inlined into a dispatcher turn | the server |
@@ -122,9 +124,9 @@ logs:
122
124
  | `~/.dreamux/logs/teammate-mcp/<id>.log` | TeamMate MCP shim diagnostics | the server |
123
125
  | `~/.codex/` | Codex global default home: auth, memory, and config | the operator / Codex |
124
126
 
125
- `rm -rf ~/.dreamux/run ~/.dreamux/cache ~/.dreamux/state ~/.dreamux/logs` is a
126
- run/cache/state/log recovery path (only while no server is running); dreamux
127
- config and global Codex auth survive.
127
+ `~/.dreamux/run/` and `~/.dreamux/cache/` are rebuildable while no server is
128
+ running. Durable `~/.dreamux/state/` is not a generic cleanup target; preserve
129
+ it unless an exact state owner and documented recovery contract say otherwise.
128
130
 
129
131
  ## Configure dispatchers
130
132
 
@@ -149,7 +151,8 @@ Dispatcher declarations live in `config.json`:
149
151
  "extra_env": {
150
152
  "EXAMPLE_FLAG": "1"
151
153
  },
152
- "initialize_timeout_ms": 10000
154
+ "initialize_timeout_ms": 10000,
155
+ "turn_timeout_ms": 600000
153
156
  }
154
157
  }
155
158
  ],
@@ -193,6 +196,8 @@ defaults, so any field can be omitted:
193
196
  - `extra_args` → `[]`
194
197
  - `extra_env` → `{}`
195
198
  - `initialize_timeout_ms` → `10000`
199
+ - `turn_timeout_ms` → `600000` (accepted and defaulted by the current config
200
+ reader, but not passed into `CodexRuntime`; it currently has no runtime effect)
196
201
 
197
202
  Most operators never touch `bin` or `initialize_timeout_ms`. The optional
198
203
  `CODEX_HOST_CODEX_BIN` environment variable is a host-level override of the
@@ -247,39 +252,65 @@ by core; sharing one bot identity across dispatchers is an operator choice.
247
252
  Dispatcher ids use a path-safe character set so they map one-to-one to state
248
253
  directories.
249
254
 
250
- Access-gate allowlists are not part of `config.json`. Configure them in
251
- `~/.dreamux/state/<id>/access.json`:
255
+ Access-gate allowlists are not part of `config.json`. The complete secure V3
256
+ default used to initialize a missing `~/.dreamux/state/<id>/access.json` is:
252
257
 
253
258
  ```json
254
259
  {
255
- "version": 2,
256
- "allow_users": ["<USER_ID>"],
260
+ "version": 3,
261
+ "dm_policy": "pairing",
257
262
  "group": {
258
263
  "policy": "follow-user",
259
- "allow_chats": ["<CHAT_ID>"],
264
+ "allow_chats": [],
260
265
  "require_mention": true
261
266
  },
267
+ "allow_users": [],
268
+ "pending": {},
262
269
  "observed_chats": [],
263
270
  "warnings": [],
264
- "last_gate": null
271
+ "last_gate": {
272
+ "at": 0
273
+ }
265
274
  }
266
275
  ```
267
276
 
268
- `access.json` is v2-only. `allow_users` is the single global allowlist of
269
- sender open_ids, shared by direct messages and the group `follow-user` policy.
270
- `group.policy` is one of `block`, `allowlist`, or `follow-user`; under
271
- `allowlist` the gate consults `allow_chats`, under `follow-user` it ignores
272
- `allow_chats` and gates on `allow_users`. dreamux 0.x does not migrate older
273
- shapes: an unsupported or missing `version` fails loud at startup. To reset,
274
- delete the file (secure default: no one authorized) and recreate it in this v2
275
- shape.
276
-
277
- The server reads `access.json` directly at runtime and preserves runtime
278
- observations and warnings in the same file.
277
+ `access.json` remains version 3. `version` is Channel/schema-owned.
278
+ `dm_policy`, `group.policy`, `group.allow_chats`, and
279
+ `group.require_mention` are operator policy. `allow_users` is shared authority:
280
+ live pairing/Owner approval may append it, and a quiesced operator may maintain
281
+ it. `pending`, `observed_chats`, `warnings`, and `last_gate` are Channel-owned
282
+ runtime ledger fields. Add real chat or sender ids only through the quiesced
283
+ field-specific maintenance workflow below; the secure default grants neither
284
+ chat nor sender authority.
285
+
286
+ For human group messages, `group.require_mention` runs first and `block` drops
287
+ all human traffic. Under `allowlist`, an unlisted chat drops and a listed chat
288
+ trusts every exactly classified human. Under `follow-user`, a listed chat has
289
+ the same trust; an unlisted chat follows the existing `dm_policy` /
290
+ `allow_users` / pairing path. Trusted chats bypass `dm_policy`, `allow_users`,
291
+ and pairing, including `dm_policy: "disabled"`, but never bypass the global
292
+ mention switch. `/introduce` stays sender-scoped and still requires
293
+ `allow_users`.
294
+
295
+ This meaning changes in place when the new server starts; V3 needs no rebuild.
296
+ Before deploying, review every non-empty `allow_chats` entry under both
297
+ `allowlist` and `follow-user`. Keep only groups whose human membership should
298
+ be trusted and whose passive known-bot observation should remain enabled.
299
+
300
+ The access path is always `~/.dreamux/state/<id>/access.json`;
301
+ `DREAMUX_CONFIG_DIR` and `dreamux config path` affect `config.json` only. For a
302
+ manual access edit, fully stop the owning Dispatcher, confirm it stopped,
303
+ re-read after stop, apply only the requested policy/shared-authority fields via
304
+ an owner-only sibling temporary file and atomic replacement at mode `0600`,
305
+ validate the complete current V3 shape without printing values, and then start
306
+ the Dispatcher. Preserve `version` and all Channel-owned ledger fields exactly.
307
+ A missing file after confirmed stop is valid current state: start from the full
308
+ secure V3 default shown above, create a missing state directory at `0700`, and
309
+ atomically create the first `0600` file. This is initialization, not a rebuild.
279
310
 
280
311
  `dreamux config show`, `dreamux status`, `dreamux doctor`, and logs redact
281
312
  secret-like config keys generically. There is no CLI raw mode for printing the
282
- unredacted local file.
313
+ unredacted local file. `dreamux doctor` is not an access-state validator.
283
314
 
284
315
  ## Codex configuration precedence
285
316
 
@@ -4,10 +4,9 @@
4
4
  *
5
5
  * Per issue #98, the 0.x upgrade policy is fail-loud + rebuild rather than
6
6
  * accumulating automatic migrations. This command is the upgrade-time
7
- * information entry point: after installing a new package, an operator (or an
8
- * LLM following the `dreamux-maintenance` skill) reads the changelog
9
- * shipped inside that new package, handles any breaking changes / rebuilds, and
10
- * only then runs `dreamux daemon restart` / `onboard`.
7
+ * information entry point: after installing a new package, an operator reads
8
+ * the changelog shipped inside that new package, handles any breaking changes /
9
+ * rebuilds, and only then runs `dreamux daemon restart` / `onboard`.
11
10
  *
12
11
  * It reads the rush-generated `CHANGELOG.md` / `CHANGELOG.json` bundled in the
13
12
  * package. It never fetches over the network and never inspects a target
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/cli/changelog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAM9B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,UAAgC,EAAE;IAElC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;QACvB,CAAC,CAAC,yBAAyB,EAAE;QAC7B,CAAC,CAAC,6BAA6B,EAAE,CAAC;IACpC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,2CAA2C;gBAClF,qGAAqG,CACxG,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/cli/changelog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAM9B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,UAAgC,EAAE;IAElC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;QACvB,CAAC,CAAC,yBAAyB,EAAE;QAC7B,CAAC,CAAC,6BAA6B,EAAE,CAAC;IACpC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,2CAA2C;gBAClF,qGAAqG,CACxG,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excitedjs/dreamux",
3
- "version": "0.22.0-beta.150",
3
+ "version": "0.22.0-beta.151",
4
4
  "description": "Dreamux core host for multi-dispatcher agent orchestration through provider interfaces.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,11 +26,11 @@
26
26
  "CHANGELOG.json"
27
27
  ],
28
28
  "dependencies": {
29
- "@excitedjs/agent-runtime-claude-code": "0.5.0-beta.150",
30
- "@excitedjs/agent-runtime-codex": "0.3.5-beta.150",
31
- "@excitedjs/dreamux-types": "0.8.0-beta.150",
32
- "@excitedjs/dreamux-utils": "0.4.0-beta.150",
33
- "@excitedjs/feishu-channel": "4.1.2-beta.150",
29
+ "@excitedjs/agent-runtime-claude-code": "0.5.0-beta.151",
30
+ "@excitedjs/agent-runtime-codex": "0.3.5-beta.151",
31
+ "@excitedjs/dreamux-types": "0.8.0-beta.151",
32
+ "@excitedjs/dreamux-utils": "0.4.0-beta.151",
33
+ "@excitedjs/feishu-channel": "5.0.0-beta.151",
34
34
  "croner": "^10.0.1",
35
35
  "smol-toml": "^1.6.1",
36
36
  "yargs": "^17.7.2",
@@ -1,59 +1,70 @@
1
1
  ---
2
2
  name: dreamux-maintenance
3
- description: "Dreamux host operation notes. Load when diagnosing or operating dreamux serve, daemon startup, doctor/status results, dispatcher health, missing replies, stuck turns, restart behavior, config/state/run/log paths, bundled-skill injection, access state, or runtime app-server readiness."
3
+ description: "Dreamux host operation notes. Load when diagnosing or operating dreamux serve, daemon startup, doctor/status results, Dispatcher health, missing replies, stuck turns, restart behavior, current config/state/run/log paths, bundled-skill injection, Feishu access policy, runtime app-server readiness, a Dreamux upgrade, or post-restart recovery."
4
4
  ---
5
5
 
6
6
  # Dreamux Maintenance
7
7
 
8
- ## Scope Boundaries
9
-
10
- - Prefer Dreamux-owned surfaces first: `dreamux doctor`, `dreamux status`,
11
- dispatcher status, config inspection, admin socket behavior, and logs under
12
- `~/.dreamux/logs/`.
13
- - Separate submit, execution, completion delivery, and visible channel delivery.
14
- A submitted TeamMate turn or inbound channel message is not proof that the
15
- final reply reached the operator.
16
- - Before changing persistent state, access policy, service units, shell startup
17
- files, PATH, environment variables, runtime auth, or Dreamux config, name the
18
- target and require explicit operator intent when the request is ambiguous.
19
- - Keep private paths, socket paths, app ids, tokens, secrets, and local incident
20
- details out of broad channel replies and public artifacts.
21
-
22
- ## Server And Service Notes
23
-
24
- - `dreamux serve` is the foreground server entry point. The public
25
- `dreamux daemon install|uninstall|start|stop|restart` command group manages
26
- the user-level service; do not invent additional daemon command shapes or
27
- treat `serve` as self-daemonizing.
28
- - Check the service manager only for service lifecycle questions. Treat launchd
29
- or systemd changes as infrastructure changes and explain before modifying
30
- units, linger, environment, or shell configuration.
31
- - Prefer fail-loud diagnosis over silent repair. If config, state, cache, run, or
32
- log paths need deletion or rebuild, name the exact path class and why it is
33
- safe or unsafe.
34
- - `dreamux changelog` reads the installed package's offline release notes. Use it
35
- before restart or onboard when an upgrade may require manual rebuild steps.
36
- - Logs are diagnostics, not durable state. Preserve them unless the operator asks
37
- for cleanup or the retention reason is clear.
38
-
39
- ## Runtime And Delivery Notes
40
-
41
- - For missing replies, distinguish channel ingress, dispatcher acceptance,
42
- runtime turn execution, TeamMate completion delivery, and channel egress.
43
- - For stuck turns, inspect the relevant runtime and Dreamux state before
44
- restarting. Restarting the server is not proof that a model turn completed or
45
- that a channel reply was sent.
46
- - Codex and Claude Code auth/config remain owned by their runtimes. Do not edit
47
- global runtime auth or config unless the operator explicitly asks for that
48
- operational action.
49
- - Bundled skills are injected at runtime by role. When skill loading is suspect,
50
- inspect the runtime skill source configuration and logs rather than copying
51
- bundled skill files into a dispatcher workspace.
52
-
53
- ## Reporting Notes
54
-
55
- - Report the exact interface checked, the target dispatcher/team/teammate or
56
- service, the error summary, what was verified, and whether retrying is safe.
57
- - When reporting to a channel, keep details useful but sanitized. Mention command
58
- names, package versions, high-level path classes, and behavioral status rather
59
- than raw private identifiers.
8
+ ## Scope And Authorization
9
+
10
+ - Use Dreamux-owned surfaces first: `dreamux doctor`, `dreamux status`,
11
+ Dispatcher status, admin socket behavior, and logs under `~/.dreamux/logs/`.
12
+ - Separate submit, execution, completion delivery, and visible Channel delivery.
13
+ A submitted turn or inbound message does not prove that a final reply reached
14
+ the operator.
15
+ - Before changing config, state, a service unit, PATH, environment, runtime
16
+ auth, or the installed package, require explicit operator intent naming the
17
+ target Dispatcher and exact operation. Load the routed owner before planning
18
+ a file or field change.
19
+ - Run the self-upgrade procedure only for explicit upgrade intent. Its
20
+ self-resuming branch has additional preconditions and private recovery
21
+ ownership; ordinary restart permission is not upgrade permission.
22
+
23
+ ## Secret Safety
24
+
25
+ - Never print or relay an unredacted config, `app_secret`, `extra_env`, token,
26
+ captured service environment, private recovery path, or complete provider
27
+ config to a broad Channel.
28
+ - Report sanitized field names and outcomes. Keep private paths, ids,
29
+ credentials, environment values, and incident details on an operator-private
30
+ surface.
31
+ - Never guess a Dispatcher id, config path, state path, provider schema, or
32
+ managed-service identity.
33
+
34
+ ## Common Diagnostic Sequence
35
+
36
+ 1. Confirm the target Dispatcher, the operator's requested outcome, and the
37
+ available reply surface.
38
+ 2. Identify the failing boundary: Channel ingress, Dispatcher acceptance,
39
+ runtime execution, TeamMate completion delivery, visible Channel egress, or
40
+ host/service lifecycle.
41
+ 3. Read the single routed reference whose `Read when` condition matches. Load
42
+ more than one only when the task genuinely crosses those owners.
43
+ 4. Inspect Dreamux-owned status, doctor output, admin behavior, and narrowly
44
+ relevant logs without exposing secrets. Treat logs as diagnostics, not
45
+ durable state.
46
+ 5. Before mutation, restate the exact authority, owner, recovery path, and
47
+ verification step. Stop when any required identity or private recovery
48
+ condition is unproven.
49
+
50
+ ## Task Routing
51
+
52
+ | Task | Read when | Reference |
53
+ |---|---|---|
54
+ | Service lifecycle and reply diagnosis | Diagnosing `dreamux serve`, daemon startup, doctor/status results, Dispatcher health, missing replies, stuck turns, restart behavior, current state/run/log paths, bundled-skill injection, or runtime app-server readiness. | [Service lifecycle](references/service-lifecycle.md) |
55
+ | Managed Dreamux self-upgrade | The operator explicitly requests a Dreamux upgrade, or an injected restart notice requires post-restart recovery and verification. | [Self-upgrade](references/self-upgrade.md) |
56
+ | Host config envelope | Inspecting or safely editing the current `config.json` envelope, path authority, Dispatcher/agent/channel wiring, or an opaque external provider config. | [Config envelope](references/config-envelope.md) |
57
+ | Built-in Codex config | Inspecting or changing the current `builtin:codex` Agent Runtime provider config. | [Built-in Codex](references/builtin-codex.md) |
58
+ | Built-in Claude Code config | Inspecting or changing the current `builtin:claude-code` Agent Runtime provider config. | [Built-in Claude Code](references/builtin-claude-code.md) |
59
+ | Built-in Feishu credentials | Inspecting or changing the current `builtin:feishu` Channel credential config. | [Built-in Feishu](references/builtin-feishu.md) |
60
+ | Feishu access V3 | Diagnosing Feishu access policy or safely editing current V3 `access.json`, including trusted chats and `/introduce`. | [Feishu access V3](references/feishu-access-v3.md) |
61
+
62
+ ## Reporting
63
+
64
+ - Report the exact interface, target Dispatcher/service, sanitized error,
65
+ verified state, changes made, and whether retrying is safe.
66
+ - Use the provider reply tool when visible Channel delivery is required.
67
+ Assistant text alone is not Channel delivery.
68
+ - Preserve logs unless the operator explicitly requests bounded cleanup.
69
+ - For an upgrade, follow the outcome-specific original-Channel and recovery
70
+ reporting contract in the self-upgrade reference.
@@ -0,0 +1,17 @@
1
+ # Current `builtin:claude-code` Config
2
+
3
+ Accepted `agents[].config` fields, defaults, and meanings:
4
+
5
+ - `bin`: non-empty string, default `"claude"`.
6
+ - `model`: string or null, default `null`; null defers to Claude Code, otherwise
7
+ maps to its model option.
8
+ - `permission_mode`: `default | acceptEdits | plan | bypassPermissions` or
9
+ null, default `null`; null defers to Claude Code, otherwise maps to its
10
+ permission-mode option.
11
+ - `remote_control`: boolean, default `false`; enables Claude Code's external
12
+ resident-session control surface.
13
+ - `extra_args`: string array, default `[]`; passed to the child process.
14
+ - `extra_env`: string-to-string map, default `{}`; merged into the child
15
+ environment.
16
+ - `turn_timeout_ms`: positive integer milliseconds, default `600000`; an
17
+ inactivity window reset by stream activity, not a total-duration cap.
@@ -0,0 +1,18 @@
1
+ # Current `builtin:codex` Config
2
+
3
+ Accepted `agents[].config` fields, defaults, and meanings:
4
+
5
+ - `bin`: non-empty string, default `"codex"`; `CODEX_HOST_CODEX_BIN` is the
6
+ higher-priority host binary override.
7
+ - `approval_policy`: `never | auto | auto-approve | on-failure`, default
8
+ `never`; configures the Codex launch.
9
+ - `sandbox_mode`: `read-only | workspace-write | danger-full-access`, default
10
+ `workspace-write`; configures the Codex launch.
11
+ - `extra_args`: string array, default `[]`; passed to the child process.
12
+ - `extra_env`: string-to-string map, default `{}`; merged into the child
13
+ environment.
14
+ - `initialize_timeout_ms`: positive integer milliseconds, default `10000`;
15
+ bounds the runtime initialize handshake.
16
+ - `turn_timeout_ms`: positive integer milliseconds, default `600000`; the
17
+ current reader accepts and defaults it, but it is not passed into
18
+ `CodexRuntime` and currently has no runtime effect.
@@ -0,0 +1,8 @@
1
+ # Current `builtin:feishu` Channel Config
2
+
3
+ Accepted `dispatchers[].channels[].config` fields:
4
+
5
+ - `app_id`: required non-empty string identifying this Channel config;
6
+ - `app_secret`: required non-empty string authenticating the Feishu app.
7
+
8
+ There are no credential defaults and no other built-in Feishu config fields.
@@ -0,0 +1,59 @@
1
+ # Current `config.json` Envelope
2
+
3
+ This reference owns the current host envelope, config path authority, provider
4
+ opacity, and safe structural editing workflow.
5
+
6
+ Use `dreamux config path` as the config path authority.
7
+ `DREAMUX_CONFIG_DIR` may relocate `config.json`. Do not use `dreamux config
8
+ show` to inspect provider config; it is not a field-targeted secret-safe view.
9
+
10
+ The complete current host envelope has independently optional `agents` and
11
+ `dispatchers` arrays. An omitted array normalizes to an empty collection.
12
+
13
+ `agents[]` entries contain:
14
+
15
+ - unique non-empty string `id`;
16
+ - non-empty provider ref `provider`;
17
+ - optional provider-owned object `config`.
18
+
19
+ `dispatchers[]` entries contain:
20
+
21
+ - unique path-safe non-empty string `id`;
22
+ - schema-optional or null `cwd`; every enabled Dispatcher must nevertheless
23
+ have an explicit non-empty usable `cwd` before server startup;
24
+ - optional boolean `enabled`, default `true`;
25
+ - optional `workspace.enabled`, default `true`;
26
+ - required non-empty `channels[]`;
27
+ - required non-empty `agentRuntime` matching an `agents[].id`.
28
+
29
+ Each `channels[]` entry contains a unique-per-Dispatcher non-empty `id`, a
30
+ non-empty Channel provider ref, optional provider-owned `config`, and optional
31
+ `collaborationSpace.defaultBinding`. One provider ref may appear only once in
32
+ one Dispatcher. `defaultBinding` accepts:
33
+
34
+ - optional boolean `enabled`, default `false`;
35
+ - optional or null `repo`; when present, `repo.cwd` is required and non-empty,
36
+ while `repo.baseRef` may be omitted, null, or any string, including empty or
37
+ whitespace;
38
+ - optional or null `identity`; a string value must be non-empty.
39
+
40
+ External `npm:` provider configs are opaque. Use the provider's schema as the
41
+ authority; do not infer fields from a built-in provider.
42
+
43
+ ## Safe Current Config Editing
44
+
45
+ 1. Confirm explicit operator intent for the target Dispatcher, config file, and
46
+ exact fields.
47
+ 2. Resolve the file with `dreamux config path` without printing its contents.
48
+ 3. Load the separate provider reference for each affected built-in provider;
49
+ for an external provider, use that provider's own schema.
50
+ 4. Apply an exact structural transform that changes only the requested fields.
51
+ Preserve unrelated Dispatchers, channels, agents, and provider fields. Write
52
+ a complete sibling temporary file at mode `0600`, then atomically replace
53
+ the target without echoing untouched values.
54
+ 5. When an `agents[]` entry is shared and the request applies only to the
55
+ current Dispatcher, clone it under a new unique id and repoint only that
56
+ Dispatcher's `agentRuntime`.
57
+ 6. Run `dreamux doctor`, report sanitized validation results, and load the
58
+ service-lifecycle route before restarting for the config change to take
59
+ effect.
@@ -0,0 +1,89 @@
1
+ # Current Built-In Feishu Access V3
2
+
3
+ This reference owns the current V3 shape, field ownership, trusted-chat and
4
+ `/introduce` meanings, and quiesced edit/`ENOENT` workflow.
5
+
6
+ The path is fixed at `~/.dreamux/state/<dispatcher-id>/access.json`.
7
+ `DREAMUX_CONFIG_DIR` affects `config.json` only. Never derive this state path
8
+ from `dreamux config path` or a relocated config directory.
9
+
10
+ The complete secure default is:
11
+
12
+ ```json
13
+ {
14
+ "version": 3,
15
+ "dm_policy": "pairing",
16
+ "group": {
17
+ "policy": "follow-user",
18
+ "allow_chats": [],
19
+ "require_mention": true
20
+ },
21
+ "allow_users": [],
22
+ "pending": {},
23
+ "observed_chats": [],
24
+ "warnings": [],
25
+ "last_gate": {
26
+ "at": 0
27
+ }
28
+ }
29
+ ```
30
+
31
+ Current field ownership has four classes:
32
+
33
+ - Channel/schema-owned: `version`.
34
+ - Operator policy: `dm_policy`, `group.policy`, `group.allow_chats`, and
35
+ `group.require_mention`.
36
+ - Shared authority: `allow_users`; live pairing/App Owner approval may append
37
+ it, while an independent quiesced operator may also maintain it.
38
+ - Channel runtime ledger: `pending`, `observed_chats`, `warnings`, and
39
+ `last_gate`; do not edit these directly.
40
+
41
+ Current meanings and types:
42
+
43
+ - `version` is exactly `3`.
44
+ - `dm_policy` is `all | allowlist | pairing | disabled`.
45
+ - `group.policy` is `block | allowlist | follow-user`;
46
+ `group.allow_chats` is a string array; `group.require_mention` is boolean.
47
+ - `allow_users` and `observed_chats` are string arrays.
48
+ - `pending` is keyed by pairing token. Each entry has `kind` (`dm | group`),
49
+ string `sender_id` and `chat_id`, numeric `created_at` and `expires_at`,
50
+ numeric `replies`, and optional string `prompt_message_id`.
51
+ - `warnings` is an array of `{ at, msg, ctx? }`; `last_gate` is an object with
52
+ numeric `at` and optional string `sender_id`, `chat_id`, `action`, `reason`.
53
+
54
+ For exactly classified human group messages, `group.require_mention` runs
55
+ first, and `group.policy: block` drops all human messages. A chat in
56
+ `group.allow_chats` is trusted under either `allowlist` or `follow-user`: after
57
+ the mention/block checks, its human members deliver without consulting
58
+ `dm_policy`, `allow_users`, or pairing. An unlisted `allowlist` chat drops. An
59
+ unlisted `follow-user` chat uses the existing `dm_policy` / `allow_users` /
60
+ pairing path. Passive known-bot observation remains scoped to
61
+ `group.allow_chats`. `/introduce` remains sender-scoped and requires exact
62
+ sender ID membership in `allow_users`; this check is not human-only, so a
63
+ manually listed bot/app sender ID may pass authorization.
64
+
65
+ ## Safe Current Access Editing
66
+
67
+ A target Dispatcher only prepares and reports the requested policy or
68
+ shared-authority patch. It must not stop and then continue to apply its own
69
+ patch. Hand the operation to an independent operator for the full ownership
70
+ window:
71
+
72
+ ```text
73
+ dispatcher stop -> confirmed stop -> post-stop re-read -> exact atomic patch
74
+ -> current-shape validation -> dispatcher start
75
+ ```
76
+
77
+ Keep the Channel owner fully quiesced for the entire read-modify-write window.
78
+ After the post-stop re-read, change only requested operator-policy or
79
+ `allow_users` fields. Preserve `version` and every Channel runtime-ledger field
80
+ exactly. Use an owner-only sibling temporary file, atomic replacement, and final
81
+ mode `0600`. Validate JSON plus the complete V3 shape locally without printing
82
+ values. Do not claim that `dreamux doctor` validates access state.
83
+
84
+ If the file is absent after confirmed stop, treat that explicit `ENOENT` as
85
+ valid current state. Use the complete secure V3 default above as the in-memory
86
+ baseline and apply only requested policy/shared-authority fields. Create a
87
+ missing state directory at mode `0700`, then atomically create the first
88
+ `access.json` through a sibling mode-`0600` temporary file. Start the Dispatcher
89
+ only after validation.
@@ -0,0 +1,363 @@
1
+ # Managed-Daemon Self-Upgrade
2
+
3
+ This is the sole transition guide in this skill. Run it only after explicit
4
+ operator intent to upgrade a managed Dreamux daemon. It reads release-specific
5
+ actions from the validated staged target; it does not carry historical schemas
6
+ or migration recipes.
7
+
8
+ ## Contents
9
+
10
+ - [Preflight](#preflight)
11
+ - [Staged inspection and classification](#staged-inspection-and-classification)
12
+ - [Execution before restart](#execution-before-restart)
13
+ - [Post-restart verification and reporting](#post-restart-verification-and-reporting)
14
+ - [Recovery and artifact disposition](#recovery-and-artifact-disposition)
15
+
16
+ A Dispatcher may take the self-resuming path only when every preflight is
17
+ proven. Otherwise prepare a sanitized plan and hand the operation to an
18
+ independent operator/controller.
19
+
20
+ ## Preflight
21
+
22
+ ### 1. Prove identity and the return Channel
23
+
24
+ Require the operator to identify or confirm the current Dispatcher id. Require
25
+ an originating Channel message and an available provider reply tool so phase
26
+ two can report to the same Channel. If either fact is unavailable, stop and
27
+ request it. Never guess an id from process state or workspace paths.
28
+
29
+ ### 2. Discover, then re-read under managed authority
30
+
31
+ Use an initial `dreamux doctor --json` only to discover the managed service.
32
+ Treat `service.execStart[0]` as its launcher authority. Require
33
+ `service.installed`, `enabled`, `loaded`, and `running` to be true, with a
34
+ non-null service PID and captured service environment. Draw no
35
+ caller-environment config or provider conclusion from this discovery result.
36
+
37
+ Run the exact launcher `doctor --json` again under the captured service
38
+ environment. Require this second result's `configFile` to be the config under
39
+ the captured `DREAMUX_CONFIG_DIR`. Only this result is authoritative for the
40
+ Dispatcher, providers, config, and later doctor calls.
41
+
42
+ ### 3. Prove the resumable managed instance
43
+
44
+ Under the same managed environment, run the exact launcher `status`. Require a
45
+ matching enabled/running Dispatcher row with a non-empty `thread_id`. Require
46
+ the authoritative doctor result to name its Agent Runtime provider as
47
+ `builtin:codex` or `builtin:claude-code`, whose owner contracts guarantee resume
48
+ support; a non-empty thread alone is not proof for an external provider.
49
+
50
+ Record the server `pid` and `uptimeSec`. Do not demand equality between the
51
+ service PID and status PID: the service PID is the public CLI parent while
52
+ `server.status` reports its server child. Resolve the status PID's parent with
53
+ the platform process table and require it to equal `doctor.service.pid`.
54
+ Otherwise fail closed because status and service have not been proven to
55
+ describe the same managed instance.
56
+
57
+ ### 4. Prove package, launcher, and prefix identity
58
+
59
+ Resolve `service.execStart[0]` and `command -v dreamux` to real paths. Compare
60
+ the launcher with the package location under the current `npm root -g` and its
61
+ `npm prefix -g`. Reject an npm-linked package root or any prefix/launcher
62
+ mismatch.
63
+
64
+ Read the matched package root's `package.json.version`, then run both
65
+ `dreamux --version` and the exact service launcher with `--version`. Require all
66
+ three values to be the same valid semver and record it as the old version. The
67
+ matched package manifest is authoritative, so an npm-linked checkout reporting
68
+ `0.0.0` cannot pass.
69
+
70
+ ### 5. Resolve an exact forward target before mutation
71
+
72
+ Resolve the npm selector to an exact version before changing disk state:
73
+
74
+ - when the operator names a version or dist-tag, resolve only
75
+ `@excitedjs/dreamux@<requested>`;
76
+ - when omitted, use `@excitedjs/dreamux@latest`, the latest stable release
77
+ rather than `beta` or `alpha`.
78
+
79
+ Use `npm view @excitedjs/dreamux@<requested-or-latest> version --json` to
80
+ resolve the exact target semver. This step never installs a package. Equal is a
81
+ no-op. A lower target is a downgrade and is always rejected by this SOP. A
82
+ downgrade requires a separate independently reviewed recovery plan; explicit
83
+ version selection does not opt into the forward-only algorithm.
84
+
85
+ ### 6. Stage and validate exact old and target artifacts
86
+
87
+ Before overwriting the live service prefix, create a private temporary staging
88
+ directory and capture the npm executable, global prefix, and an explicit
89
+ isolated cache path. In the commands below, `npm` is that captured executable.
90
+ Run these two operand-complete commands:
91
+
92
+ ```text
93
+ npm pack @excitedjs/dreamux@<oldVersion> --ignore-scripts --json --pack-destination <private-dir>/artifacts
94
+ npm pack @excitedjs/dreamux@<targetVersion> --ignore-scripts --json --pack-destination <private-dir>/artifacts
95
+ ```
96
+
97
+ Validate each tarball's package name, manifest version, integrity output,
98
+ changelog files, and bundled skill tree without executing target code. A
99
+ top-level tarball alone is not rollback proof. Do not install either package or
100
+ dependency closure until the staged target guidance is read and classified.
101
+
102
+ ## Staged Inspection And Classification
103
+
104
+ ### 7. Read the staged target and select the full version range
105
+
106
+ Extract the validated target tarball in staging. Read its `CHANGELOG.json`, its
107
+ bundled `dreamux-maintenance/SKILL.md`, and the target owner references named by
108
+ that root. The target version's current-only references are authoritative for
109
+ its schema, defaults, meaning, and ownership. Use the running old version's
110
+ references only to understand and preserve the old values.
111
+
112
+ The changelog is complete and newest-first. Select `(oldVersion,
113
+ targetVersion]` and order entries by semver from oldest to newest. Do not
114
+ inspect only the newest entry or execute storage order. The `--json` flag used
115
+ later changes only the output format and is not a range selector; range
116
+ selection belongs to the reader.
117
+
118
+ ### 8. Classify live-safe and independent-quiesced work
119
+
120
+ Classify all applicable `BREAKING:`, `Review:`, and `Rebuild:` instructions
121
+ before touching the live prefix, config, or state.
122
+
123
+ - A live-safe operator-config action may stay in this self-resuming path only
124
+ when the staged changelog and target owner references prove that the target
125
+ can start safely with the untouched old config and with every planned
126
+ intermediate config state.
127
+ - Any action that stops or quiesces the daemon or Dispatcher, modifies
128
+ server-owned or mixed-ownership state, re-registers the service, changes the
129
+ active recovery Channel/Dispatcher identity, or otherwise removes the
130
+ current execution path cannot be performed by the current Dispatcher.
131
+
132
+ For the second branch, leave the live prefix untouched and hand an independent
133
+ operator/controller this exact order:
134
+
135
+ 1. verified stage and inspection;
136
+ 2. rehearse both dependency closures exactly as specified in step 9;
137
+ 3. confirmed stop;
138
+ 4. post-stop re-read and owner-only backup;
139
+ 5. install the staged exact target with the rehearsed offline closure;
140
+ 6. apply actions oldest-to-newest using the staged target owner references;
141
+ 7. run the target doctor in the captured service environment;
142
+ 8. start and verify.
143
+
144
+ On any post-stop failure, restore the backups, reinstall the staged old
145
+ artifact with the rehearsed offline closure, run the old exact-launcher doctor,
146
+ and restart the old service only when rollback is proven. Otherwise keep the
147
+ service stopped and report the independent recovery blocker. Do not enter the
148
+ self-resuming phase.
149
+
150
+ ### 9. Rehearse both complete dependency closures
151
+
152
+ Before either path touches the live prefix, populate and prove the full old and
153
+ target dependency closures without executing lifecycle scripts. Use the
154
+ captured npm executable and the same explicit isolated cache for all four
155
+ operand-complete commands, with four distinct private prefixes:
156
+
157
+ ```text
158
+ <npm-bin> install --global --ignore-scripts --cache <cache> --prefix <private-old-online> <staged-old-tarball>
159
+ <npm-bin> install --global --ignore-scripts --cache <cache> --prefix <private-target-online> <staged-target-tarball>
160
+ <npm-bin> install --global --offline --ignore-scripts --cache <cache> --prefix <private-old-offline> <staged-old-tarball>
161
+ <npm-bin> install --global --offline --ignore-scripts --cache <cache> --prefix <private-target-offline> <staged-target-tarball>
162
+ ```
163
+
164
+ Validate both fresh offline prefixes' manifests, launchers, changelogs, and
165
+ bundled skills. These exact tarballs, the isolated cache, and the rehearsed
166
+ command shape form the target and rollback closure. Failure stops the SOP
167
+ before live-prefix mutation.
168
+
169
+ ### 10. Route target-owned preparation and transfer recovery ownership
170
+
171
+ For every live-safe config action, use the staged target root routing table to
172
+ resolve the reference whose task/read condition owns config editing and each
173
+ affected provider. Do not hard-code the current reference filenames into this
174
+ generic SOP: a future target may rename or split them while keeping its route
175
+ authoritative. This upgrade reference owns ordering and transaction boundaries,
176
+ not schema or edit facts.
177
+
178
+ This step is preparation only. Resolve authoritative paths, plan each
179
+ transformation oldest-to-newest, and create owner-only backups using the target
180
+ owner's exact structural and atomic-write contract. Do not mutate config or
181
+ state yet. Follow the staged changelog rather than embedding historical schemas
182
+ in this skill.
183
+
184
+ The current exact restart-marker path is
185
+ `<captured-managed-HOME>/.dreamux/run/restart-intent.json`, where
186
+ `<captured-managed-HOME>` is the managed `HOME` captured in step 2. Every
187
+ transfer, exact stat/read, removal, and `ENOENT` absence proof in this SOP uses
188
+ this one resolved path.
189
+
190
+ Before the first live-prefix or config mutation, transfer an exact inventory of
191
+ the staging directory, isolated cache, rehearsal prefixes, backups, launchers,
192
+ captured environment, that exact restart-marker path, and rollback commands to
193
+ an independently executing operator/controller. Use an operator-private path.
194
+ Require acknowledgement. Do not expose private paths or secrets to a broad
195
+ originating Channel. That independent controller owns the recovery material if
196
+ the current Dispatcher disappears.
197
+
198
+ If no such private handoff and acknowledgement can be established, execute the
199
+ first step 17 outcome: remove only this run's exact scoped artifacts and
200
+ backups, refuse the self-resuming upgrade, and stop. If an independent operator
201
+ is reachable only through a non-private route, provide a sanitized
202
+ independent-quiesced plan from step 8, require that operator to stage fresh
203
+ recovery materials, and clean rather than retain or expose this run's private
204
+ inventory.
205
+
206
+ ## Execution Before Restart
207
+
208
+ ### 11. Install the rehearsed target without scripts
209
+
210
+ Install the validated target tarball with the exact captured npm executable and
211
+ the rehearsed isolated cache:
212
+
213
+ ```text
214
+ <npm-bin> install --global --offline --ignore-scripts --cache <cache> --prefix <captured-prefix> <staged-target-tarball>
215
+ ```
216
+
217
+ Re-resolve both launcher paths, validate the matched manifest, and require the
218
+ exact launcher and PATH command to report the target version. Re-run the
219
+ installed `dreamux changelog --json` and require it to match the staged target
220
+ changelog before mutating config.
221
+
222
+ This creates a short, contained skew window in which the old daemon remains in
223
+ memory while the live prefix holds the target. If installation or any
224
+ identity/changelog check fails, immediately run:
225
+
226
+ ```text
227
+ <npm-bin> install --global --offline --ignore-scripts --cache <cache> --prefix <captured-prefix> <staged-old-tarball>
228
+ ```
229
+
230
+ Validate the old manifest/launchers and exact-launcher doctor, and do not
231
+ restart. The rehearsed old closure, no-config-mutation boundary, and
232
+ doctor-before-restart rule must be proven before installation. If rollback
233
+ cannot be proven, report through the original Channel and follow the final
234
+ confirmed-stop handoff from step 12.
235
+
236
+ An unexpected old-daemon exit during this skew window may reap the caller. The
237
+ live-safe proof ensures the target can start on every intermediate config
238
+ state, but the current Dispatcher then makes no success claim and an
239
+ independent operator must finish verification. This residual process-exit risk
240
+ cannot be removed without choosing the independent stopped path.
241
+
242
+ ### 12. Apply live-safe actions exactly once
243
+
244
+ Apply the classified live-safe actions exactly once, oldest-to-newest, using
245
+ the staged target owner references. On ambiguity or failure, restore every
246
+ mutation from backup, reinstall the staged old artifact with the rehearsed
247
+ offline closure, validate its manifest/launchers and exact-launcher doctor, and
248
+ leave the old daemon running.
249
+
250
+ If complete rollback cannot be proven, report the failure through the original
251
+ Channel and hand an independent operator the exact launcher, captured
252
+ environment, staged artifacts/cache, backups, and observed failure. Only that
253
+ independent operator may use the rehearsed old closure's exact launcher to
254
+ issue `dreamux daemon stop`, observe its result, and confirm quiescence before
255
+ recovery.
256
+
257
+ After confirmed stop, the independent operator removes only the transferred
258
+ exact marker path,
259
+ `<captured-managed-HOME>/.dreamux/run/restart-intent.json`, and proves that same
260
+ exact path is absent. Only explicit `ENOENT` counts as absence; any other
261
+ stat/removal error remains unresolved. No old or target service may start until
262
+ marker absence is proven; otherwise keep the service stopped. The current
263
+ Dispatcher must not claim it can confirm the stop or cleanup that reaps it.
264
+
265
+ ### 13. Run target doctor before restart
266
+
267
+ Run the target package's exact launcher `doctor --json` in the captured managed
268
+ service environment. On failure, perform the same backup/package rollback and
269
+ do not restart. If rollback cannot be proven, report through the original
270
+ Channel and follow the final confirmed-stop handoff from step 12.
271
+
272
+ ### 14. Trigger the exact restart-resume capability
273
+
274
+ Trigger the exact target service launcher under the captured managed-service
275
+ environment with:
276
+
277
+ ```text
278
+ <exact-target-service-launcher> daemon restart --notify-resumed --dispatcher <current-id>
279
+ ```
280
+
281
+ Reconstruct the invocation so captured managed `HOME`, `PATH`,
282
+ `DREAMUX_CONFIG_DIR`, and `DREAMUX_NODE_BIN` values override any caller or
283
+ provider `extra_env` values. This keeps the restart marker, launcher, config,
284
+ and service-control target in the same authority domain.
285
+
286
+ The command writes a one-shot marker before restarting. The new server consumes
287
+ it once and injects the default `Restart completed.` notice into the named
288
+ resumed Dispatcher. The caller may be reaped during restart, so it must not
289
+ depend on seeing the command return successfully or continue post-checks in the
290
+ pre-restart turn.
291
+
292
+ If the restart CLI fails synchronously while the caller survives, whether
293
+ during marker creation or later service control, enter one failure path. Only a
294
+ service-control failure after marker creation causes the CLI to attempt
295
+ best-effort removal; marker creation itself may fail before that cleanup path
296
+ and can leave partial state. In either case, verify with an exact stat/read. Only
297
+ explicit `ENOENT` proves absence. That verification must use the same
298
+ `<captured-managed-HOME>/.dreamux/run/restart-intent.json` path; permission,
299
+ I/O, or any other result remains unresolved.
300
+
301
+ Only after `ENOENT` may the failure be treated as rollback-capable. If absence
302
+ is proven, immediately restore config backups, reinstall and verify the staged
303
+ old artifact, dispose of scoped artifacts under the verified-rollback outcome,
304
+ and report failure through the original Channel. If marker absence or rollback
305
+ cannot be proven, classify the operation as unresolved recovery, retain the
306
+ scoped materials with the pre-acknowledged independent owner, and follow the
307
+ final confirmed-stop handoff from step 12. Do not close it as verified rollback
308
+ or clean the recovery material.
309
+
310
+ ## Post-Restart Verification And Reporting
311
+
312
+ The injected `Restart completed.` notice, when an upgrade was in flight in the
313
+ resumed conversation, is the explicit trigger to continue with steps 15-18.
314
+
315
+ ### 15. Re-prove installed target identity
316
+
317
+ Re-run the exact service launcher plus PATH `dreamux` with `--version` and
318
+ confirm both still resolve to the same target package and version.
319
+
320
+ ### 16. Re-prove service and Dispatcher identity
321
+
322
+ Re-run the exact-launcher `doctor --json` under the captured managed
323
+ environment. Require the new service to be installed, enabled, loaded, and
324
+ running, then run exact-launcher `status`. Confirm the current Dispatcher is
325
+ running, resolve the new status PID's parent, and require it to equal the new
326
+ service PID. Report the new `pid` and `uptimeSec` and compare them with the
327
+ pre-restart snapshot so a stale or unrelated server is not mistaken for
328
+ success.
329
+
330
+ ### 17. Dispose of artifacts by outcome
331
+
332
+ | Outcome | Required disposition |
333
+ |---|---|
334
+ | Failure or refusal before the first live mutation and before private handoff acknowledgement, including a partial step 10 backup or missing private recovery owner | Remove only this run's exact staging directory, isolated cache, rehearsal prefixes, and any backups already created, then stop. No unowned recovery material may remain. |
335
+ | Planned independent-quiesced operation with an acknowledged private operator path | Retain the material and transfer its exact private inventory before stop. |
336
+ | Verified success or fully verified rollback | Remove only the exact staging directory, isolated cache, rehearsal prefixes, and config backups created by this run. |
337
+ | No notice or unresolved recovery | Retain the material with the independent owner who acknowledged it before step 11. |
338
+
339
+ Never use a broad or unresolved cleanup path, and never delete unresolved
340
+ recovery material.
341
+
342
+ ### 18. Report through the original Channel
343
+
344
+ Reply through the same originating Channel surface. Report old and new
345
+ versions, target selection (`requested` or `latest`), applicable changelog work
346
+ and backup outcome in sanitized form, doctor result, new process status/uptime,
347
+ and overall success or remaining blocker. Assistant text is not Channel
348
+ delivery.
349
+
350
+ ## Recovery And Artifact Disposition
351
+
352
+ - A verified rollback before restart performs the verified-rollback row of
353
+ step 17 immediately, then reports failure through the original Channel.
354
+ - An unresolved recovery retains and transfers the exact scoped paths to the
355
+ pre-acknowledged independent owner. Never expose them through a broad Channel.
356
+ - If the restart notice does not arrive, the stopped or reaped Dispatcher
357
+ cannot self-diagnose. The independent operator must run `dreamux status`,
358
+ inspect daemon logs, and contact the user.
359
+ - Foreground `dreamux serve` is not silently treated as a managed daemon. It
360
+ needs an external stop/start and recovery path.
361
+ - On any rollback that cannot be proven, use the final confirmed-stop handoff
362
+ in step 12. The independent operator owns stop confirmation, exact-marker
363
+ cleanup with `ENOENT`-only absence proof, and recovery restart authority.
@@ -0,0 +1,48 @@
1
+ # Service Lifecycle And Reply Diagnosis
2
+
3
+ This reference owns current serve/daemon lifecycle, missing-reply and stuck-turn
4
+ diagnosis, bundled-skill injection, runtime app-server readiness, and
5
+ same-version restart cautions.
6
+
7
+ ## Server And Service
8
+
9
+ - `dreamux serve` is the foreground server entry point. The public
10
+ `dreamux daemon install|uninstall|start|stop|restart` command group manages
11
+ the user service; `serve` is not self-daemonizing.
12
+ - Check launchd or systemd only for service-lifecycle questions. Explain before
13
+ changing units, linger, environment, or shell startup.
14
+ - Use `dreamux doctor` to inspect configuration, provider loading, service
15
+ state, and runtime app-server readiness. Use `dreamux status` for current
16
+ Dispatcher and process facts; neither command proves Channel delivery.
17
+ - Current durable state is under `~/.dreamux/state/`, volatile runtime files are
18
+ under `~/.dreamux/run/`, and logs are under `~/.dreamux/logs/`. Use the path
19
+ authorities reported by Dreamux instead of guessing alternate roots.
20
+
21
+ ## Missing Replies And Stuck Turns
22
+
23
+ - For missing replies, distinguish Channel ingress, Dispatcher acceptance,
24
+ runtime execution, TeamMate completion delivery, and Channel egress.
25
+ - For stuck turns, inspect the relevant runtime and Dreamux state before a
26
+ restart. A restart does not prove that a turn completed or a reply was sent.
27
+ - Treat a successful submit as acceptance only. Confirm completion and then the
28
+ provider-visible reply separately.
29
+
30
+ ## Bundled-Skill Injection
31
+
32
+ Bundled skills are injected by role. Inspect the runtime skill-source config
33
+ and logs instead of copying bundled skills into a workspace. A missing skill is
34
+ an injection/source-readiness problem, not evidence that workspace installation
35
+ is required.
36
+
37
+ ## Same-Version Restart Cautions
38
+
39
+ - A managed service may use
40
+ `dreamux daemon restart --notify-resumed --dispatcher <current-id>`.
41
+ Foreground `dreamux serve` needs an operator-coordinated stop/start and an
42
+ external recovery path.
43
+ - Warn before renaming or disabling the current Dispatcher, removing its
44
+ Channel, changing its Agent Runtime provider, or changing Channel
45
+ credentials. Each can break the active recovery path.
46
+ - The caller may be reaped during a restart. Do not depend on the pre-restart
47
+ turn to observe success; continue only from the injected restart notice or an
48
+ independent operator's verification.