@vibesdotdev/plugins 0.0.0-stage → 1.0.0-rc.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.
- package/LICENSE +18 -0
- package/README.md +54 -2
- package/VIBES.md +165 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +3 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/plugin.impl.cloud.d.ts +4 -0
- package/dist/ai/plugin.impl.cloud.d.ts.map +1 -0
- package/dist/ai/plugin.impl.cloud.js +32 -0
- package/dist/ai/plugin.impl.cloud.js.map +1 -0
- package/dist/ai/plugin.impl.consumer.d.ts +7 -0
- package/dist/ai/plugin.impl.consumer.d.ts.map +1 -0
- package/dist/ai/plugin.impl.consumer.js +222 -0
- package/dist/ai/plugin.impl.consumer.js.map +1 -0
- package/dist/auth/consumer.plugin.d.ts +3 -0
- package/dist/auth/consumer.plugin.d.ts.map +1 -0
- package/dist/auth/consumer.plugin.js +105 -0
- package/dist/auth/consumer.plugin.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/plugin.d.ts +4 -0
- package/dist/auth/plugin.d.ts.map +1 -0
- package/dist/auth/plugin.js +33 -0
- package/dist/auth/plugin.js.map +1 -0
- package/dist/automation/consumer.plugin.d.ts +3 -0
- package/dist/automation/consumer.plugin.d.ts.map +1 -0
- package/dist/automation/consumer.plugin.js +92 -0
- package/dist/automation/consumer.plugin.js.map +1 -0
- package/dist/automation/index.d.ts +2 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +2 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/plugin.d.ts +4 -0
- package/dist/automation/plugin.d.ts.map +1 -0
- package/dist/automation/plugin.js +30 -0
- package/dist/automation/plugin.js.map +1 -0
- package/dist/bun/host.d.ts +44 -0
- package/dist/bun/host.d.ts.map +1 -0
- package/dist/bun/host.js +71 -0
- package/dist/bun/host.js.map +1 -0
- package/dist/cli/child-failure.d.ts +37 -0
- package/dist/cli/child-failure.d.ts.map +1 -0
- package/dist/cli/child-failure.js +86 -0
- package/dist/cli/child-failure.js.map +1 -0
- package/dist/cli/context.d.ts +12 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +11 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/execution.d.ts +10 -0
- package/dist/cli/execution.d.ts.map +1 -0
- package/dist/cli/execution.js +20 -0
- package/dist/cli/execution.js.map +1 -0
- package/dist/cli/failure-facts.d.ts +16 -0
- package/dist/cli/failure-facts.d.ts.map +1 -0
- package/dist/cli/failure-facts.js +39 -0
- package/dist/cli/failure-facts.js.map +1 -0
- package/dist/cli/package-manager.consumer.d.ts +106 -0
- package/dist/cli/package-manager.consumer.d.ts.map +1 -0
- package/dist/cli/package-manager.consumer.js +258 -0
- package/dist/cli/package-manager.consumer.js.map +1 -0
- package/dist/cli/plugin.d.ts +9 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +34 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/plugins.add.cli-command.descriptor.d.ts +36 -0
- package/dist/cli/plugins.add.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.add.cli-command.descriptor.js +31 -0
- package/dist/cli/plugins.add.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.d.ts +63 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.js +206 -0
- package/dist/cli/plugins.add.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/plugins.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.cli-group.descriptor.js +10 -0
- package/dist/cli/plugins.cli-group.descriptor.js.map +1 -0
- package/dist/cli/plugins.host.cli-command.descriptor.d.ts +31 -0
- package/dist/cli/plugins.host.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.host.cli-command.descriptor.js +37 -0
- package/dist/cli/plugins.host.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.d.ts +29 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.js +109 -0
- package/dist/cli/plugins.host.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.link.cli-command.descriptor.d.ts +35 -0
- package/dist/cli/plugins.link.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.link.cli-command.descriptor.js +32 -0
- package/dist/cli/plugins.link.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.d.ts +31 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.js +104 -0
- package/dist/cli/plugins.link.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.list.cli-command.descriptor.d.ts +26 -0
- package/dist/cli/plugins.list.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.list.cli-command.descriptor.js +22 -0
- package/dist/cli/plugins.list.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.d.ts +116 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.js +343 -0
- package/dist/cli/plugins.list.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.d.ts +31 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.js +26 -0
- package/dist/cli/plugins.remove.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.d.ts +30 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.js +80 -0
- package/dist/cli/plugins.remove.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.d.ts +31 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.js +21 -0
- package/dist/cli/plugins.unlink.cli-command.descriptor.js.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.d.ts +76 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.js +190 -0
- package/dist/cli/plugins.unlink.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/registry-sign-in.consumer.d.ts +80 -0
- package/dist/cli/registry-sign-in.consumer.d.ts.map +1 -0
- package/dist/cli/registry-sign-in.consumer.js +199 -0
- package/dist/cli/registry-sign-in.consumer.js.map +1 -0
- package/dist/cli/roll.d.ts +230 -0
- package/dist/cli/roll.d.ts.map +1 -0
- package/dist/cli/roll.js +569 -0
- package/dist/cli/roll.js.map +1 -0
- package/dist/cli/schemas/context.d.ts +10 -0
- package/dist/cli/schemas/context.d.ts.map +1 -0
- package/dist/cli/schemas/context.js +3 -0
- package/dist/cli/schemas/context.js.map +1 -0
- package/dist/cli/schemas/scopes.d.ts +37 -0
- package/dist/cli/schemas/scopes.d.ts.map +1 -0
- package/dist/cli/schemas/scopes.js +11 -0
- package/dist/cli/schemas/scopes.js.map +1 -0
- package/dist/cli/schemas/unlink.d.ts +18 -0
- package/dist/cli/schemas/unlink.d.ts.map +1 -0
- package/dist/cli/schemas/unlink.js +3 -0
- package/dist/cli/schemas/unlink.js.map +1 -0
- package/dist/cli/schemas/update.d.ts +77 -0
- package/dist/cli/schemas/update.d.ts.map +1 -0
- package/dist/cli/schemas/update.js +3 -0
- package/dist/cli/schemas/update.js.map +1 -0
- package/dist/cli/scopes.d.ts +50 -0
- package/dist/cli/scopes.d.ts.map +1 -0
- package/dist/cli/scopes.js +90 -0
- package/dist/cli/scopes.js.map +1 -0
- package/dist/cli/seed.d.ts +232 -0
- package/dist/cli/seed.d.ts.map +1 -0
- package/dist/cli/seed.js +590 -0
- package/dist/cli/seed.js.map +1 -0
- package/dist/cli/self-update.d.ts +120 -0
- package/dist/cli/self-update.d.ts.map +1 -0
- package/dist/cli/self-update.js +274 -0
- package/dist/cli/self-update.js.map +1 -0
- package/dist/cli/update.cli-command.descriptor.d.ts +62 -0
- package/dist/cli/update.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/update.cli-command.descriptor.js +49 -0
- package/dist/cli/update.cli-command.descriptor.js.map +1 -0
- package/dist/cli/update.cli-command.impl.consumer.d.ts +178 -0
- package/dist/cli/update.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/update.cli-command.impl.consumer.js +750 -0
- package/dist/cli/update.cli-command.impl.consumer.js.map +1 -0
- package/dist/comms/consumer.plugin.d.ts +3 -0
- package/dist/comms/consumer.plugin.d.ts.map +1 -0
- package/dist/comms/consumer.plugin.js +108 -0
- package/dist/comms/consumer.plugin.js.map +1 -0
- package/dist/comms/index.d.ts +2 -0
- package/dist/comms/index.d.ts.map +1 -0
- package/dist/comms/index.js +2 -0
- package/dist/comms/index.js.map +1 -0
- package/dist/comms/plugin.d.ts +4 -0
- package/dist/comms/plugin.d.ts.map +1 -0
- package/dist/comms/plugin.js +30 -0
- package/dist/comms/plugin.js.map +1 -0
- package/dist/consumer.d.ts +3 -0
- package/dist/consumer.d.ts.map +1 -0
- package/dist/consumer.js +3 -0
- package/dist/consumer.js.map +1 -0
- package/dist/consumer.plugin.d.ts +63 -0
- package/dist/consumer.plugin.d.ts.map +1 -0
- package/dist/consumer.plugin.js +89 -0
- package/dist/consumer.plugin.js.map +1 -0
- package/dist/core/consumer.plugin.d.ts +4 -0
- package/dist/core/consumer.plugin.d.ts.map +1 -0
- package/dist/core/consumer.plugin.js +358 -0
- package/dist/core/consumer.plugin.js.map +1 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/optional-member.d.ts +11 -0
- package/dist/core/optional-member.d.ts.map +1 -0
- package/dist/core/optional-member.js +68 -0
- package/dist/core/optional-member.js.map +1 -0
- package/dist/core/optional-plugin.d.ts +40 -0
- package/dist/core/optional-plugin.d.ts.map +1 -0
- package/dist/core/optional-plugin.js +107 -0
- package/dist/core/optional-plugin.js.map +1 -0
- package/dist/core/plugin.d.ts +10 -0
- package/dist/core/plugin.d.ts.map +1 -0
- package/dist/core/plugin.js +64 -0
- package/dist/core/plugin.js.map +1 -0
- package/dist/core/setup-requirements.descriptors.d.ts +7 -0
- package/dist/core/setup-requirements.descriptors.d.ts.map +1 -0
- package/dist/core/setup-requirements.descriptors.js +117 -0
- package/dist/core/setup-requirements.descriptors.js.map +1 -0
- package/dist/data/consumer.plugin.d.ts +3 -0
- package/dist/data/consumer.plugin.d.ts.map +1 -0
- package/dist/data/consumer.plugin.js +99 -0
- package/dist/data/consumer.plugin.js.map +1 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/plugin.d.ts +4 -0
- package/dist/data/plugin.d.ts.map +1 -0
- package/dist/data/plugin.js +37 -0
- package/dist/data/plugin.js.map +1 -0
- package/dist/devtools/consumer.plugin.d.ts +3 -0
- package/dist/devtools/consumer.plugin.d.ts.map +1 -0
- package/dist/devtools/consumer.plugin.js +323 -0
- package/dist/devtools/consumer.plugin.js.map +1 -0
- package/dist/devtools/index.d.ts +2 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +2 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/devtools/plugin.d.ts +4 -0
- package/dist/devtools/plugin.d.ts.map +1 -0
- package/dist/devtools/plugin.js +34 -0
- package/dist/devtools/plugin.js.map +1 -0
- package/dist/filesystem/index.d.ts +2 -0
- package/dist/filesystem/index.d.ts.map +1 -0
- package/dist/filesystem/index.js +2 -0
- package/dist/filesystem/index.js.map +1 -0
- package/dist/filesystem/plugin.d.ts +4 -0
- package/dist/filesystem/plugin.d.ts.map +1 -0
- package/dist/filesystem/plugin.js +21 -0
- package/dist/filesystem/plugin.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +16 -0
- package/dist/plugin.js.map +1 -0
- package/dist/schemas/ai.d.ts +119 -0
- package/dist/schemas/ai.d.ts.map +1 -0
- package/dist/schemas/ai.js +84 -0
- package/dist/schemas/ai.js.map +1 -0
- package/dist/schemas/auth.d.ts +15 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/auth.js +19 -0
- package/dist/schemas/auth.js.map +1 -0
- package/dist/schemas/automation.d.ts +66 -0
- package/dist/schemas/automation.d.ts.map +1 -0
- package/dist/schemas/automation.js +36 -0
- package/dist/schemas/automation.js.map +1 -0
- package/dist/schemas/comms.d.ts +13 -0
- package/dist/schemas/comms.d.ts.map +1 -0
- package/dist/schemas/comms.js +27 -0
- package/dist/schemas/comms.js.map +1 -0
- package/dist/schemas/core.d.ts +102 -0
- package/dist/schemas/core.d.ts.map +1 -0
- package/dist/schemas/core.js +124 -0
- package/dist/schemas/core.js.map +1 -0
- package/dist/schemas/data.d.ts +13 -0
- package/dist/schemas/data.d.ts.map +1 -0
- package/dist/schemas/data.js +25 -0
- package/dist/schemas/data.js.map +1 -0
- package/dist/schemas/devtools.d.ts +33 -0
- package/dist/schemas/devtools.d.ts.map +1 -0
- package/dist/schemas/devtools.js +56 -0
- package/dist/schemas/devtools.js.map +1 -0
- package/dist/schemas/family.d.ts +11 -0
- package/dist/schemas/family.d.ts.map +1 -0
- package/dist/schemas/family.js +21 -0
- package/dist/schemas/family.js.map +1 -0
- package/dist/schemas/filesystem.d.ts +25 -0
- package/dist/schemas/filesystem.d.ts.map +1 -0
- package/dist/schemas/filesystem.js +24 -0
- package/dist/schemas/filesystem.js.map +1 -0
- package/dist/schemas/host.d.ts +10 -0
- package/dist/schemas/host.d.ts.map +1 -0
- package/dist/schemas/host.js +2 -0
- package/dist/schemas/host.js.map +1 -0
- package/dist/schemas/optional-member.d.ts +67 -0
- package/dist/schemas/optional-member.d.ts.map +1 -0
- package/dist/schemas/optional-member.js +31 -0
- package/dist/schemas/optional-member.js.map +1 -0
- package/dist/schemas/roll.d.ts +47 -0
- package/dist/schemas/roll.d.ts.map +1 -0
- package/dist/schemas/roll.js +18 -0
- package/dist/schemas/roll.js.map +1 -0
- package/dist/schemas/tui.d.ts +33 -0
- package/dist/schemas/tui.d.ts.map +1 -0
- package/dist/schemas/tui.js +95 -0
- package/dist/schemas/tui.js.map +1 -0
- package/dist/schemas/ui.d.ts +15 -0
- package/dist/schemas/ui.d.ts.map +1 -0
- package/dist/schemas/ui.js +45 -0
- package/dist/schemas/ui.js.map +1 -0
- package/dist/tui/code-sessions-tui-plugin-shim.d.ts +7 -0
- package/dist/tui/code-sessions-tui-plugin-shim.d.ts.map +1 -0
- package/dist/tui/code-sessions-tui-plugin-shim.js +2 -0
- package/dist/tui/code-sessions-tui-plugin-shim.js.map +1 -0
- package/dist/tui/index.d.ts +8 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/plugin.d.ts +53 -0
- package/dist/tui/plugin.d.ts.map +1 -0
- package/dist/tui/plugin.js +350 -0
- package/dist/tui/plugin.js.map +1 -0
- package/dist/ui/consumer.plugin.d.ts +3 -0
- package/dist/ui/consumer.plugin.d.ts.map +1 -0
- package/dist/ui/consumer.plugin.js +75 -0
- package/dist/ui/consumer.plugin.js.map +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/plugin.d.ts +4 -0
- package/dist/ui/plugin.d.ts.map +1 -0
- package/dist/ui/plugin.js +35 -0
- package/dist/ui/plugin.js.map +1 -0
- package/host-start.mjs +39 -0
- package/host.mjs +24 -0
- package/package.json +437 -4
package/dist/cli/roll.js
ADDED
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The roll census for `vibes update` (plan §5.1).
|
|
3
|
+
*
|
|
4
|
+
* `vibes update` replaces the module graph under running bodies. A body that
|
|
5
|
+
* keeps executing the previous graph answers plausibly and is wrong — that is
|
|
6
|
+
* the stale-body failure class this whole program exists to end. So the update
|
|
7
|
+
* does not merely restart what it can reach; it ENUMERATES every body it knows
|
|
8
|
+
* how to find and prints one line per body, including the ones it could not
|
|
9
|
+
* roll and why.
|
|
10
|
+
*
|
|
11
|
+
* ### Where the census comes from, and why it is three sources, not one
|
|
12
|
+
*
|
|
13
|
+
* 1. **The OS agent directory** — `~/Library/LaunchAgents/*.plist` (darwin) or
|
|
14
|
+
* `~/.config/systemd/user/*.service` (linux). This is the ONLY source that
|
|
15
|
+
* sees the `dev.vibes.bignet.*` bodies: they invoke `vibes fleet daemon
|
|
16
|
+
* --host-id …` directly and are **not** `hq/os-service` descriptors, so a
|
|
17
|
+
* census built from the hq registry alone reports them as absent when they
|
|
18
|
+
* are in fact running the old graph.
|
|
19
|
+
* 2. **The hq service registry** — `hq/os-service` descriptors, read from THIS
|
|
20
|
+
* runtime. No manifest edge: if the host composed hq, the kind is there; if
|
|
21
|
+
* it did not, the census says so instead of pretending.
|
|
22
|
+
* 3. **PM and stdio MCP** — the PM daemon rolls through its own supervised
|
|
23
|
+
* handoff; an stdio MCP body is owned by its client (Claude Code, Cursor,
|
|
24
|
+
* …) and CANNOT be restarted from here. It is reported `NOT ROLLED` with
|
|
25
|
+
* `/mcp` as the remedy rather than silently omitted.
|
|
26
|
+
*
|
|
27
|
+
* Each body is classified by what its command line actually is, because the
|
|
28
|
+
* three shapes roll differently: an installed-binary body picks up the new
|
|
29
|
+
* graph on restart; a **source-mode** body (`bun …/vibes.ts`) already reads the
|
|
30
|
+
* files that just changed and needs a restart only for module cache; a
|
|
31
|
+
* **hostWorkspace-delegated** body resolves its graph through
|
|
32
|
+
* `$VIBES_HOME/package.json#vibes.hostWorkspace`, so it is rolled by the same
|
|
33
|
+
* restart but its graph root is not `$VIBES_HOME`.
|
|
34
|
+
*
|
|
35
|
+
* Rolling happens IN-PROCESS through the owner of each body, never by
|
|
36
|
+
* re-entering the CLI: an hq-registered OS service through hq's service
|
|
37
|
+
* registry (`restartService`, whose receipt says whether the main pid was
|
|
38
|
+
* replaced), the PM daemon through PM's own `pm.daemon.restart` command
|
|
39
|
+
* resolved from this runtime and verified by reading the daemon pid again.
|
|
40
|
+
* A body whose owner is not composed into this host is reported `NOT ROLLED`
|
|
41
|
+
* with that reason, never omitted and never counted as success.
|
|
42
|
+
*
|
|
43
|
+
* Every host fact comes from the handed runtime: files through its filesystem
|
|
44
|
+
* adapter, the platform from its host facts, process-table reads and the
|
|
45
|
+
* executable-replacement verdict from `runtime/host-identity`, and the
|
|
46
|
+
* service-manager census (`launchctl list`, `systemctl --user show`) through
|
|
47
|
+
* `runtime/execution` in argv form with a declared deadline.
|
|
48
|
+
*/
|
|
49
|
+
import { resolveFileSystemAdapter } from '@vibesdotdev/filesystem/client/resolve-adapter';
|
|
50
|
+
import { LoggedErrorSchema } from '@vibesdotdev/logging';
|
|
51
|
+
import { CapabilityError, settle, settleNow, CaughtFailureSchema, composeChildEnv, getRuntimeHostIdentity, isCapabilityError } from '@vibesdotdev/kernel';
|
|
52
|
+
import { redactedExcerpt } from '@vibesdotdev/shared/utils';
|
|
53
|
+
import { z } from 'zod/v4';
|
|
54
|
+
import { resolveRuntimeExecution } from "./execution.js";
|
|
55
|
+
import { errnoOf, isModuleAbsent } from "./failure-facts.js";
|
|
56
|
+
const VIBES_LABEL_PREFIXES = ['com.vibes.', 'dev.vibes.'];
|
|
57
|
+
/** The deadline on one service-manager census command. */
|
|
58
|
+
export const SERVICE_MANAGER_TIMEOUT_MS = 5_000;
|
|
59
|
+
function firstMatch(source, pattern) {
|
|
60
|
+
return pattern.exec(source)?.[1]?.trim() ?? null;
|
|
61
|
+
}
|
|
62
|
+
/** Classify a supervised program path into the three graph shapes. */
|
|
63
|
+
export function classifyProgram(program) {
|
|
64
|
+
if (!program)
|
|
65
|
+
return 'unknown';
|
|
66
|
+
const base = program.split('/').pop() ?? program;
|
|
67
|
+
if (base === 'bun' || base === 'bun.exe')
|
|
68
|
+
return 'source-mode';
|
|
69
|
+
if (base === 'vibes' || base === 'vibes.exe')
|
|
70
|
+
return 'installed-binary';
|
|
71
|
+
return 'unknown';
|
|
72
|
+
}
|
|
73
|
+
/** A file listed a moment ago that has since gone, or that this user may not read. */
|
|
74
|
+
function isUnreadableFile(failure) {
|
|
75
|
+
const code = errnoOf(failure);
|
|
76
|
+
return code === 'ENOENT' || code === 'EACCES' || code === 'EPERM';
|
|
77
|
+
}
|
|
78
|
+
/** A file's text through the runtime's filesystem, or the failure reading it raised. */
|
|
79
|
+
async function readText(filesystem, path) {
|
|
80
|
+
try {
|
|
81
|
+
const bytes = await filesystem.readFile(path, 'utf8');
|
|
82
|
+
return { text: bytes instanceof Uint8Array ? new TextDecoder().decode(bytes) : bytes };
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
return { failure: CaughtFailureSchema.parse(error) };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** The sorted entry names of a directory, or `[]` when it does not exist. */
|
|
89
|
+
async function listNames(filesystem, dir) {
|
|
90
|
+
if (!(await filesystem.exists(dir)))
|
|
91
|
+
return [];
|
|
92
|
+
return (await filesystem.list(dir)).map((entry) => entry.name).sort();
|
|
93
|
+
}
|
|
94
|
+
/** One OS-agent row; `program` only when the census could read it. */
|
|
95
|
+
function osServiceBody(id, source, path, program) {
|
|
96
|
+
const body = { kind: 'os-service', id, source, shape: classifyProgram(program), hqRegistered: false, path };
|
|
97
|
+
if (program)
|
|
98
|
+
body.program = program;
|
|
99
|
+
return body;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Every `com.vibes.*` / `dev.vibes.*` LaunchAgent on disk. Deliberately reads
|
|
103
|
+
* the DIRECTORY, not a registry: the `dev.vibes.bignet.*` bodies are real,
|
|
104
|
+
* running, and unknown to hq.
|
|
105
|
+
*/
|
|
106
|
+
export async function censusLaunchAgents(runtime, userHome) {
|
|
107
|
+
const filesystem = await resolveFileSystemAdapter(runtime, { binding: false });
|
|
108
|
+
const dir = filesystem.join(userHome, 'Library', 'LaunchAgents');
|
|
109
|
+
const bodies = [];
|
|
110
|
+
for (const entry of await listNames(filesystem, dir)) {
|
|
111
|
+
// `*.plist.disabled-by-vibes-pm` is deliberately excluded: it is not loaded.
|
|
112
|
+
if (!entry.endsWith('.plist'))
|
|
113
|
+
continue;
|
|
114
|
+
if (!VIBES_LABEL_PREFIXES.some((prefix) => entry.startsWith(prefix)))
|
|
115
|
+
continue;
|
|
116
|
+
const path = filesystem.join(dir, entry);
|
|
117
|
+
let program;
|
|
118
|
+
let label = entry.slice(0, -'.plist'.length);
|
|
119
|
+
const read = await readText(filesystem, path);
|
|
120
|
+
if ('text' in read) {
|
|
121
|
+
const xml = read.text;
|
|
122
|
+
label = firstMatch(xml, /<key>Label<\/key>\s*<string>([^<]*)<\/string>/) ?? label;
|
|
123
|
+
const args = firstMatch(xml, /<key>ProgramArguments<\/key>\s*<array>([\s\S]*?)<\/array>/);
|
|
124
|
+
program =
|
|
125
|
+
(args ? firstMatch(args, /<string>([^<]*)<\/string>/) : null) ??
|
|
126
|
+
firstMatch(xml, /<key>Program<\/key>\s*<string>([^<]*)<\/string>/) ??
|
|
127
|
+
undefined;
|
|
128
|
+
}
|
|
129
|
+
else if (!isUnreadableFile(read.failure)) {
|
|
130
|
+
// An unreadable plist (removed since the listing, or not ours to read) is
|
|
131
|
+
// still a body that exists: it is reported unclassified rather than dropped
|
|
132
|
+
// from the denominator. Any other failure propagates.
|
|
133
|
+
throw read.failure;
|
|
134
|
+
}
|
|
135
|
+
bodies.push(osServiceBody(label, 'launch-agents', path, program));
|
|
136
|
+
}
|
|
137
|
+
return bodies;
|
|
138
|
+
}
|
|
139
|
+
/** systemd user units named for vibes. Same contract as the launchd census. */
|
|
140
|
+
export async function censusSystemdUserUnits(runtime, userHome) {
|
|
141
|
+
const filesystem = await resolveFileSystemAdapter(runtime, { binding: false });
|
|
142
|
+
const dir = filesystem.join(userHome, '.config', 'systemd', 'user');
|
|
143
|
+
const bodies = [];
|
|
144
|
+
for (const entry of await listNames(filesystem, dir)) {
|
|
145
|
+
if (!entry.endsWith('.service') || !entry.includes('vibes'))
|
|
146
|
+
continue;
|
|
147
|
+
const path = filesystem.join(dir, entry);
|
|
148
|
+
let program;
|
|
149
|
+
const read = await readText(filesystem, path);
|
|
150
|
+
if ('text' in read)
|
|
151
|
+
program = firstMatch(read.text, /^ExecStart\s*=\s*(\S+)/m) ?? undefined;
|
|
152
|
+
// Same contract as the launchd census: an unreadable unit still counts.
|
|
153
|
+
else if (!isUnreadableFile(read.failure))
|
|
154
|
+
throw read.failure;
|
|
155
|
+
bodies.push(osServiceBody(entry.slice(0, -'.service'.length), 'systemd-user', path, program));
|
|
156
|
+
}
|
|
157
|
+
return bodies;
|
|
158
|
+
}
|
|
159
|
+
/** The fields of an `hq/os-service` descriptor the census reads, each on its own. */
|
|
160
|
+
const HqServiceDescriptorSchema = z.object({
|
|
161
|
+
id: z.string().catch(''),
|
|
162
|
+
label: z.string().optional().catch(undefined),
|
|
163
|
+
command: z.string().optional().catch(undefined)
|
|
164
|
+
});
|
|
165
|
+
/** The host's declared platform, or `undefined` when the host captured none. */
|
|
166
|
+
function declaredPlatform(runtime) {
|
|
167
|
+
return runtime.localEnvironment.getPlatform?.();
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* `hq/os-service` descriptors composed into THIS runtime. Returns `[]` when hq
|
|
171
|
+
* is not part of the host — the absence is reported by the caller as a
|
|
172
|
+
* denominator note, never as "no services".
|
|
173
|
+
*/
|
|
174
|
+
export async function censusHqServices(runtime, userHome) {
|
|
175
|
+
if (!runtime.hasKind('hq/os-service'))
|
|
176
|
+
return [];
|
|
177
|
+
const filesystem = await resolveFileSystemAdapter(runtime, { binding: false });
|
|
178
|
+
const linux = declaredPlatform(runtime) === 'linux';
|
|
179
|
+
const bodies = [];
|
|
180
|
+
for (const candidate of runtime.query('hq/os-service').descriptors()) {
|
|
181
|
+
const descriptor = HqServiceDescriptorSchema.parse(candidate);
|
|
182
|
+
const id = descriptor.id;
|
|
183
|
+
// The label the OS backend uses (`platform/fleets/service-backends/launchd`:
|
|
184
|
+
// `descriptor.label ?? com.vibes.<id>`). A catalog entry is a CAPABILITY,
|
|
185
|
+
// not a running body: `vibes-pm` is in the catalog on every machine, and
|
|
186
|
+
// restarting one that was never installed fails. So the plist/unit has to
|
|
187
|
+
// be on disk before the census claims it can be rolled.
|
|
188
|
+
const label = descriptor.label ? descriptor.label : `com.vibes.${id}`;
|
|
189
|
+
const path = linux
|
|
190
|
+
? filesystem.join(userHome, '.config', 'systemd', 'user', `${label}.service`)
|
|
191
|
+
: filesystem.join(userHome, 'Library', 'LaunchAgents', `${label}.plist`);
|
|
192
|
+
const body = {
|
|
193
|
+
kind: 'os-service',
|
|
194
|
+
id: label,
|
|
195
|
+
source: 'hq-registry',
|
|
196
|
+
shape: classifyProgram(descriptor.command),
|
|
197
|
+
hqRegistered: true,
|
|
198
|
+
serviceId: id
|
|
199
|
+
};
|
|
200
|
+
if (descriptor.command)
|
|
201
|
+
body.program = descriptor.command;
|
|
202
|
+
if (await filesystem.exists(path))
|
|
203
|
+
body.path = path;
|
|
204
|
+
else
|
|
205
|
+
body.unrollable = `in the hq catalog but not installed as an OS service (no ${path}); install it with: vibes hq service install ${id}`;
|
|
206
|
+
bodies.push(body);
|
|
207
|
+
}
|
|
208
|
+
return bodies;
|
|
209
|
+
}
|
|
210
|
+
/** stdio MCP bodies, which no command can restart — their client owns them. */
|
|
211
|
+
export async function censusStdioMcpBodies(runtime, vibesHome) {
|
|
212
|
+
const filesystem = await resolveFileSystemAdapter(runtime, { binding: false });
|
|
213
|
+
const dir = filesystem.join(vibesHome, 'mcp-host');
|
|
214
|
+
return (await listNames(filesystem, dir))
|
|
215
|
+
.filter((entry) => entry.endsWith('.json'))
|
|
216
|
+
.map((entry) => ({
|
|
217
|
+
kind: 'stdio-mcp',
|
|
218
|
+
id: entry.slice(0, -'.json'.length),
|
|
219
|
+
source: 'mcp-host',
|
|
220
|
+
shape: 'unknown',
|
|
221
|
+
hqRegistered: false,
|
|
222
|
+
path: filesystem.join(dir, entry),
|
|
223
|
+
unrollable: 'stdio bodies are owned by their MCP client; reconnect it (/mcp) to pick up the new graph'
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The whole census, deduplicated by `<kind>:<id>`. An hq-registered label seen
|
|
228
|
+
* in the agent directory keeps the hq row (it carries the restart capability)
|
|
229
|
+
* but inherits the on-disk program, so the shape is what is actually running.
|
|
230
|
+
* The OS agent source follows the platform the host declared.
|
|
231
|
+
*/
|
|
232
|
+
export async function censusBodies(input) {
|
|
233
|
+
const os = declaredPlatform(input.runtime) === 'linux'
|
|
234
|
+
? await censusSystemdUserUnits(input.runtime, input.userHome)
|
|
235
|
+
: await censusLaunchAgents(input.runtime, input.userHome);
|
|
236
|
+
const hq = await censusHqServices(input.runtime, input.userHome);
|
|
237
|
+
const byId = new Map();
|
|
238
|
+
for (const body of os)
|
|
239
|
+
byId.set(`${body.kind}:${body.id}`, body);
|
|
240
|
+
for (const body of hq) {
|
|
241
|
+
const key = `${body.kind}:${body.id}`;
|
|
242
|
+
const seen = byId.get(key);
|
|
243
|
+
byId.set(key, seen ? { ...seen, ...body, shape: seen.shape, hqRegistered: true } : body);
|
|
244
|
+
}
|
|
245
|
+
const bodies = [...byId.values()];
|
|
246
|
+
if (input.includePmDaemon) {
|
|
247
|
+
bodies.unshift({ kind: 'pm-daemon', id: 'pm.daemon', source: 'pm', shape: 'unknown', hqRegistered: false });
|
|
248
|
+
}
|
|
249
|
+
return [...bodies, ...(await censusStdioMcpBodies(input.runtime, input.vibesHome))];
|
|
250
|
+
}
|
|
251
|
+
/** The production readers: the host's own process-table and executable-identity capability. */
|
|
252
|
+
export async function bodyProcessReaders(runtime) {
|
|
253
|
+
const identity = await getRuntimeHostIdentity(runtime);
|
|
254
|
+
return {
|
|
255
|
+
readProcessExecutablePath: (pid) => identity.readProcessExecutablePath(pid),
|
|
256
|
+
readProcessStartMs: (pid) => identity.readProcessStartMs(pid),
|
|
257
|
+
executableReplacedSince: (path, startMs) => identity.executableReplacedSince(path, startMs)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The shared predicate, applied to one body.
|
|
262
|
+
*
|
|
263
|
+
* `program` (argv[0] from the plist/unit) is only a FALLBACK: the OS is asked
|
|
264
|
+
* first, because a plist may name a symlink or a `PATH`-resolved word while the
|
|
265
|
+
* kernel knows the actual file. A relative `program` is refused rather than
|
|
266
|
+
* guessed against `PATH`.
|
|
267
|
+
*/
|
|
268
|
+
export function judgeBodyExecutable(body, readers) {
|
|
269
|
+
const { pid } = body;
|
|
270
|
+
if (pid === undefined) {
|
|
271
|
+
return { replaced: null, reason: 'no running pid for this body' };
|
|
272
|
+
}
|
|
273
|
+
const process = settleNow(() => {
|
|
274
|
+
const executable = readers.readProcessExecutablePath(pid) ?? (body.program?.startsWith('/') ? body.program : null);
|
|
275
|
+
return { executable, startMs: executable ? readers.readProcessStartMs(pid) : null };
|
|
276
|
+
});
|
|
277
|
+
if (!process.ok) {
|
|
278
|
+
if (!isCapabilityError(process.cause) || process.cause.reason !== 'process-table-unavailable')
|
|
279
|
+
throw process.cause;
|
|
280
|
+
return { replaced: null, reason: `pid ${pid}: ${process.cause.message}` };
|
|
281
|
+
}
|
|
282
|
+
const { executable, startMs } = process.value;
|
|
283
|
+
if (!executable) {
|
|
284
|
+
return { replaced: null, reason: `pid ${pid}: executable path unknown` };
|
|
285
|
+
}
|
|
286
|
+
if (startMs === null) {
|
|
287
|
+
return { replaced: null, reason: `pid ${pid}: start time unknown` };
|
|
288
|
+
}
|
|
289
|
+
const verdict = readers.executableReplacedSince(executable, startMs);
|
|
290
|
+
return { replaced: verdict.replaced, reason: verdict.reason };
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* The service managers' environment: the kernel's host set plus the user
|
|
294
|
+
* session keys `systemctl --user` reaches its manager through.
|
|
295
|
+
*/
|
|
296
|
+
export function serviceManagerEnv(runtime) {
|
|
297
|
+
return composeChildEnv(runtime, { inheritEnv: ['XDG_RUNTIME_DIR', 'DBUS_SESSION_BUS_ADDRESS'] });
|
|
298
|
+
}
|
|
299
|
+
/** One census command's stdout, or `null` when its tool is absent or it failed (every pid then reads as unknown). */
|
|
300
|
+
async function serviceManagerOutput(runtime, command, args, env) {
|
|
301
|
+
const execution = await resolveRuntimeExecution(runtime, 'roll census');
|
|
302
|
+
const executed = await settle(() => execution.execute({ command, args, env, envMode: 'replace', timeout: SERVICE_MANAGER_TIMEOUT_MS }));
|
|
303
|
+
if (!executed.ok) {
|
|
304
|
+
if (isCapabilityError(executed.cause) && executed.cause.reason === 'execution-command-not-found')
|
|
305
|
+
return null;
|
|
306
|
+
throw executed.cause;
|
|
307
|
+
}
|
|
308
|
+
const result = executed.value;
|
|
309
|
+
return result.exitCode === 0 && !result.timedOut ? result.stdout : null;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Live pids for every loaded LaunchAgent, in ONE `launchctl list` call
|
|
313
|
+
* (`PID\tStatus\tLabel`). A label with `-` for a pid is loaded but not running,
|
|
314
|
+
* and is deliberately absent from the map — there is no body to be stale.
|
|
315
|
+
*/
|
|
316
|
+
export async function launchdPids(runtime, env) {
|
|
317
|
+
const pids = new Map();
|
|
318
|
+
if (declaredPlatform(runtime) !== 'darwin')
|
|
319
|
+
return pids;
|
|
320
|
+
const stdout = await serviceManagerOutput(runtime, 'launchctl', ['list'], env);
|
|
321
|
+
if (stdout === null)
|
|
322
|
+
return pids;
|
|
323
|
+
for (const line of stdout.split('\n')) {
|
|
324
|
+
const columns = line.split('\t');
|
|
325
|
+
if (columns.length < 3)
|
|
326
|
+
continue;
|
|
327
|
+
const pid = Number(columns[0]);
|
|
328
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
329
|
+
continue;
|
|
330
|
+
const label = columns[2].trim();
|
|
331
|
+
if (label)
|
|
332
|
+
pids.set(label, pid);
|
|
333
|
+
}
|
|
334
|
+
return pids;
|
|
335
|
+
}
|
|
336
|
+
/** `MainPID` of one systemd user unit; 0/absent means not running. */
|
|
337
|
+
export async function systemdMainPid(runtime, unit, env) {
|
|
338
|
+
if (declaredPlatform(runtime) !== 'linux')
|
|
339
|
+
return undefined;
|
|
340
|
+
const stdout = await serviceManagerOutput(runtime, 'systemctl', ['--user', 'show', unit, '--property=MainPID', '--value'], env);
|
|
341
|
+
if (stdout === null)
|
|
342
|
+
return undefined;
|
|
343
|
+
const pid = Number(stdout.trim());
|
|
344
|
+
return Number.isInteger(pid) && pid > 0 ? pid : undefined;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The PM daemon's pid, read from PM's own PID file for `runtime`'s admitted
|
|
348
|
+
* workspace (the runtime the caller was handed).
|
|
349
|
+
*
|
|
350
|
+
* Deliberately NOT `runtime.context('pm/client')`: resolving that context
|
|
351
|
+
* SPAWNS a daemon as a side effect (`pm.context.impl.consumer.ts` fires
|
|
352
|
+
* `ensureDaemonRunning()` on consumer hardware), and a census that starts the
|
|
353
|
+
* body it is measuring is not a census. The path itself has one owner —
|
|
354
|
+
* `@vibesdotdev/pm/daemon-pid` — imported dynamically because `pm` is an
|
|
355
|
+
* OPTIONAL peer here. `undefined` ("unanswerable", not "fresh") has exactly
|
|
356
|
+
* two causes: a host composed without PM (the module is not installed), and a
|
|
357
|
+
* workspace PM never admitted (so no PM daemon of it exists). Every other
|
|
358
|
+
* failure propagates.
|
|
359
|
+
*/
|
|
360
|
+
export async function pmDaemonPid(runtime) {
|
|
361
|
+
const loaded = await settle(() => import('@vibesdotdev/pm/daemon-pid'));
|
|
362
|
+
if (!loaded.ok) {
|
|
363
|
+
if (isModuleAbsent(loaded.cause, '@vibesdotdev/pm/daemon-pid'))
|
|
364
|
+
return undefined;
|
|
365
|
+
throw loaded.cause;
|
|
366
|
+
}
|
|
367
|
+
const daemonPid = loaded.value;
|
|
368
|
+
const admitted = await settle(() => daemonPid.getAdmittedDaemonPidPath(runtime));
|
|
369
|
+
if (!admitted.ok) {
|
|
370
|
+
if (isCapabilityError(admitted.cause) && admitted.cause.reason === 'workspace-not-admitted')
|
|
371
|
+
return undefined;
|
|
372
|
+
throw admitted.cause;
|
|
373
|
+
}
|
|
374
|
+
const pidFile = admitted.value;
|
|
375
|
+
const pid = await daemonPid.readDaemonPid(runtime, pidFile);
|
|
376
|
+
return z.number().int().positive().safeParse(pid).success ? Number(pid) : undefined;
|
|
377
|
+
}
|
|
378
|
+
/** A census body with its pid and verdict attached, built in statements. */
|
|
379
|
+
function markedBody(body, pid, verdict) {
|
|
380
|
+
const marked = { ...body, replacedExecutable: verdict.replaced, replacedReason: verdict.reason };
|
|
381
|
+
if (pid !== undefined)
|
|
382
|
+
marked.pid = pid;
|
|
383
|
+
return marked;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Attach a pid and the executable verdict to every body in a census.
|
|
387
|
+
*
|
|
388
|
+
* Pure of side effects on the bodies themselves: it starts nothing, restarts
|
|
389
|
+
* nothing, and returns new rows. stdio-MCP bodies are skipped — their client
|
|
390
|
+
* owns them, nothing here can roll them, so asking costs a `ps` for no decision.
|
|
391
|
+
*/
|
|
392
|
+
export async function markReplacedExecutables(bodies, runtime, readers) {
|
|
393
|
+
const rollable = bodies.filter((body) => body.kind !== 'stdio-mcp');
|
|
394
|
+
if (rollable.length === 0)
|
|
395
|
+
return [...bodies];
|
|
396
|
+
const read = readers ?? (await bodyProcessReaders(runtime));
|
|
397
|
+
const osServices = rollable.some((body) => body.kind === 'os-service');
|
|
398
|
+
const managerEnv = osServices ? serviceManagerEnv(runtime) : {};
|
|
399
|
+
const launchd = osServices ? await launchdPids(runtime, managerEnv) : new Map();
|
|
400
|
+
const daemonPid = rollable.some((body) => body.kind === 'pm-daemon') ? await pmDaemonPid(runtime) : undefined;
|
|
401
|
+
const marked = [];
|
|
402
|
+
for (const body of bodies) {
|
|
403
|
+
if (body.kind === 'stdio-mcp') {
|
|
404
|
+
marked.push(body);
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
const pid = body.kind === 'pm-daemon'
|
|
408
|
+
? daemonPid
|
|
409
|
+
: (launchd.get(body.id) ?? (await systemdMainPid(runtime, `${body.id}.service`, managerEnv)));
|
|
410
|
+
const judged = {};
|
|
411
|
+
if (pid !== undefined)
|
|
412
|
+
judged.pid = pid;
|
|
413
|
+
if (body.program)
|
|
414
|
+
judged.program = body.program;
|
|
415
|
+
marked.push(markedBody(body, pid, judgeBodyExecutable(judged, read)));
|
|
416
|
+
}
|
|
417
|
+
return marked;
|
|
418
|
+
}
|
|
419
|
+
/** The bodies that MUST be rolled: they execute a file that was replaced. */
|
|
420
|
+
export function bodiesRunningReplacedExecutable(bodies) {
|
|
421
|
+
return bodies.filter((body) => body.replacedExecutable === true);
|
|
422
|
+
}
|
|
423
|
+
const PID_PAIR = /\(pid\s+(\d+)\s*(?:→|->)\s*(\d+)\)/i;
|
|
424
|
+
const PID_SINGLE = /\(PID:\s*(\d+)\)/i;
|
|
425
|
+
/** Parse a restart receipt line into the pids it reported. */
|
|
426
|
+
export function parseRestartPids(output) {
|
|
427
|
+
const pair = PID_PAIR.exec(output);
|
|
428
|
+
if (pair)
|
|
429
|
+
return { previousPid: Number(pair[1]), pid: Number(pair[2]) };
|
|
430
|
+
const single = PID_SINGLE.exec(output);
|
|
431
|
+
if (single)
|
|
432
|
+
return { pid: Number(single[1]) };
|
|
433
|
+
return {};
|
|
434
|
+
}
|
|
435
|
+
/** The in-process route that rolls one body, or `null` when no owner can. */
|
|
436
|
+
export function rollRouteFor(body) {
|
|
437
|
+
if (body.kind === 'pm-daemon')
|
|
438
|
+
return { owner: 'pm', commandId: 'pm.daemon.restart' };
|
|
439
|
+
if (body.kind === 'os-service' && body.hqRegistered)
|
|
440
|
+
return { owner: 'hq', serviceId: body.serviceId ?? body.id };
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
/** The typed refusal for a body whose owner is not composed into this host. */
|
|
444
|
+
function ownerAbsent(owner, recoveryHint) {
|
|
445
|
+
return new CapabilityError(`${owner} is not composed into this host, so it cannot roll this body.`, 'UNAVAILABLE', {
|
|
446
|
+
reason: 'roll-owner-unavailable',
|
|
447
|
+
retryable: false,
|
|
448
|
+
details: { owner },
|
|
449
|
+
recoveryHint
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/** The ui a restart command writes to: its lines are kept for the receipt, never printed over the update's output. */
|
|
453
|
+
function receiptUI(lines) {
|
|
454
|
+
const keep = (message) => {
|
|
455
|
+
lines.push(message);
|
|
456
|
+
};
|
|
457
|
+
return {
|
|
458
|
+
info: keep, success: keep, warn: keep, error: keep, log: keep,
|
|
459
|
+
prompt: async () => null, password: async () => null, confirm: async () => false,
|
|
460
|
+
table: () => undefined, json: () => undefined, yaml: () => undefined, keyValue: () => undefined,
|
|
461
|
+
progress: () => ({ update: () => undefined, complete: () => undefined, fail: () => undefined }),
|
|
462
|
+
setFormat: () => undefined, render: () => undefined
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
const CliCommandSchema = z.object({
|
|
466
|
+
execute: z.custom((value) => z.function().safeParse(value).success)
|
|
467
|
+
});
|
|
468
|
+
/** The production restarters: PM's own restart command and hq's service registry, both in this process. */
|
|
469
|
+
export const defaultRestarters = {
|
|
470
|
+
async restartPmDaemon(runtime, previousPid) {
|
|
471
|
+
if (!runtime.hasKind('cli/command'))
|
|
472
|
+
throw ownerAbsent('pm', 'Compose @vibesdotdev/pm/cli/plugin, or run `vibes pm daemon restart`.');
|
|
473
|
+
const query = runtime.query('cli/command').withId('pm.daemon.restart');
|
|
474
|
+
if (!(await query.existsAsync()))
|
|
475
|
+
throw ownerAbsent('pm', 'Compose @vibesdotdev/pm/cli/plugin, or run `vibes pm daemon restart`.');
|
|
476
|
+
const resolved = await query.resolve();
|
|
477
|
+
const command = CliCommandSchema.safeParse(resolved);
|
|
478
|
+
if (!command.success)
|
|
479
|
+
throw ownerAbsent('pm', 'The composed pm.daemon.restart command is not runnable.');
|
|
480
|
+
const execute = command.data.execute;
|
|
481
|
+
const lines = [];
|
|
482
|
+
await execute.call(resolved, {}, {}, { runtime, ui: receiptUI(lines) });
|
|
483
|
+
// The receipt is the pid PM's own pid file names now, read the way the census read the old one.
|
|
484
|
+
const pid = await pmDaemonPid(runtime);
|
|
485
|
+
const receipt = { replaced: pid !== undefined && pid !== previousPid };
|
|
486
|
+
if (previousPid !== undefined)
|
|
487
|
+
receipt.previousPid = previousPid;
|
|
488
|
+
if (pid !== undefined)
|
|
489
|
+
receipt.pid = pid;
|
|
490
|
+
return receipt;
|
|
491
|
+
},
|
|
492
|
+
async restartHqService(runtime, serviceId) {
|
|
493
|
+
let services;
|
|
494
|
+
try {
|
|
495
|
+
services = await import('@vibesdotdev/hq/services');
|
|
496
|
+
}
|
|
497
|
+
catch (error) {
|
|
498
|
+
const failure = CaughtFailureSchema.parse(error);
|
|
499
|
+
if (isModuleAbsent(failure, '@vibesdotdev/hq/services'))
|
|
500
|
+
throw ownerAbsent('hq', `Compose @vibesdotdev/hq, or run \`vibes hq service manage restart ${serviceId}\`.`);
|
|
501
|
+
throw failure;
|
|
502
|
+
}
|
|
503
|
+
return services.restartService(runtime, serviceId);
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
/** A `NOT ROLLED` outcome. */
|
|
507
|
+
function notRolled(body, reason) {
|
|
508
|
+
return { body, rolled: false, reason, line: `NOT ROLLED: ${body.id} — ${reason}` };
|
|
509
|
+
}
|
|
510
|
+
/** The reason text of a failed roll: bounded and credential-free, never the raw failure. */
|
|
511
|
+
function rollFailureReason(error) {
|
|
512
|
+
return redactedExcerpt(LoggedErrorSchema.parse(error).message) || 'the restart failed';
|
|
513
|
+
}
|
|
514
|
+
/** A successful roll: the census pid stands in for a previous pid the receipt did not report. */
|
|
515
|
+
function rolledOutcome(body, receipt) {
|
|
516
|
+
const outcome = { body, rolled: true, line: `rolled ${body.id}` };
|
|
517
|
+
const previousPid = receipt.previousPid ?? body.pid;
|
|
518
|
+
if (previousPid !== undefined)
|
|
519
|
+
outcome.previousPid = previousPid;
|
|
520
|
+
if (receipt.pid !== undefined)
|
|
521
|
+
outcome.pid = receipt.pid;
|
|
522
|
+
if (outcome.previousPid !== undefined || outcome.pid !== undefined) {
|
|
523
|
+
outcome.line = `rolled ${body.id} (pid ${outcome.previousPid ?? '-'}→${outcome.pid ?? '-'})`;
|
|
524
|
+
}
|
|
525
|
+
return outcome;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Roll every body in the census, in order, and return one verified outcome per
|
|
529
|
+
* body. A body this host cannot roll produces a `NOT ROLLED` line naming the
|
|
530
|
+
* remedy; it is never omitted, and it never reads as success.
|
|
531
|
+
*/
|
|
532
|
+
export async function rollBodies(input) {
|
|
533
|
+
const restarters = input.restarters ?? defaultRestarters;
|
|
534
|
+
const outcomes = [];
|
|
535
|
+
for (const body of input.bodies) {
|
|
536
|
+
if (body.unrollable) {
|
|
537
|
+
outcomes.push({ body, rolled: false, reason: body.unrollable, line: `NOT ROLLED: ${body.kind} ${body.id} — ${body.unrollable}` });
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
const route = rollRouteFor(body);
|
|
541
|
+
if (!route) {
|
|
542
|
+
outcomes.push(notRolled(body, body.hqRegistered
|
|
543
|
+
? 'no restart action is composed into this host'
|
|
544
|
+
: `not registered with hq; restart it yourself (launchctl kickstart -k gui/$(id -u)/${body.id})`));
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
if (input.dryRun) {
|
|
548
|
+
const how = route.owner === 'pm' ? 'vibes pm daemon restart' : `vibes hq service manage restart ${route.serviceId}`;
|
|
549
|
+
outcomes.push({ body, rolled: false, line: `would roll ${body.id}: ${how}` });
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
const restarted = await settle(() => route.owner === 'pm'
|
|
553
|
+
? restarters.restartPmDaemon(input.runtime, body.pid)
|
|
554
|
+
: restarters.restartHqService(input.runtime, route.serviceId));
|
|
555
|
+
if (!restarted.ok) {
|
|
556
|
+
outcomes.push({ ...notRolled(body, rollFailureReason(restarted.cause)), cause: restarted.cause });
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
const receipt = restarted.value;
|
|
560
|
+
// A restart that did not replace the running process is not a roll.
|
|
561
|
+
if (!receipt.replaced) {
|
|
562
|
+
outcomes.push(notRolled(body, `the restart did not replace the running process (pid ${receipt.pid ?? '-'})`));
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
outcomes.push(rolledOutcome(body, receipt));
|
|
566
|
+
}
|
|
567
|
+
return outcomes;
|
|
568
|
+
}
|
|
569
|
+
//# sourceMappingURL=roll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roll.js","sourceRoot":"","sources":["../../src/cli/roll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAG1F,OAAO,EAAE,iB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AAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,IAAI,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,CAAC,CAAC;YAC9E,SAAS;QACV,CAAC;QACD,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI;YACxD,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC;YACrD,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YACnB,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;YAClG,SAAS;QACV,CAAC;QACD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC;QAChC,oEAAoE;QACpE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACvB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,wDAAwD,OAAO,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;YAC9G,SAAS;QACV,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** What the `cli/command` kind hands every plugins command, beside its descriptor. */
|
|
2
|
+
import type { UIContext } from '@vibesdotdev/cli/providers';
|
|
3
|
+
import type { VibesRuntime } from '@vibesdotdev/kernel/api/runtime';
|
|
4
|
+
/** The runtime the command acts through and the context its descriptor requires. */
|
|
5
|
+
export interface PluginsCLIContext {
|
|
6
|
+
runtime: VibesRuntime;
|
|
7
|
+
'cli/ui': UIContext;
|
|
8
|
+
'cli/output-format'?: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/context.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/cli/schemas/context.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|