@geohar/un-bien 0.8.0 → 0.14.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/README.md +258 -320
- package/dist/actions/handlers.js.map +1 -1
- package/dist/actions/registry.js.map +1 -1
- package/dist/bin/launcher.js +38 -0
- package/dist/bin/launcher.js.map +1 -0
- package/dist/commands/deps.d.ts +156 -0
- package/dist/commands/deps.js +2 -0
- package/dist/commands/deps.js.map +1 -0
- package/dist/commands/fork_link.d.ts +4 -0
- package/dist/commands/fork_link.js +45 -0
- package/dist/commands/fork_link.js.map +1 -0
- package/dist/commands/housekeeping.d.ts +34 -0
- package/dist/commands/housekeeping.js +275 -0
- package/dist/commands/housekeeping.js.map +1 -0
- package/dist/commands/info.d.ts +43 -0
- package/dist/commands/info.js +127 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/lifecycle.d.ts +45 -0
- package/dist/commands/lifecycle.js +708 -0
- package/dist/commands/lifecycle.js.map +1 -0
- package/dist/commands/pairing.d.ts +26 -0
- package/dist/commands/pairing.js +167 -0
- package/dist/commands/pairing.js.map +1 -0
- package/dist/commands/register.d.ts +12 -0
- package/dist/commands/register.js +255 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/relay.d.ts +28 -0
- package/dist/commands/relay.js +81 -0
- package/dist/commands/relay.js.map +1 -0
- package/dist/commands/session_ops.d.ts +52 -0
- package/dist/commands/session_ops.js +75 -0
- package/dist/commands/session_ops.js.map +1 -0
- package/dist/config.d.ts +30 -2
- package/dist/config.js.map +1 -1
- package/dist/daemon/install.d.ts +36 -37
- package/dist/daemon/install.js +49 -73
- package/dist/daemon/install.js.map +1 -1
- package/dist/enrich_tool_args.d.ts +9 -0
- package/dist/enrich_tool_args.js +171 -0
- package/dist/enrich_tool_args.js.map +1 -0
- package/dist/extension_ui_bridge.js.map +1 -1
- package/dist/image_codec.d.ts +22 -0
- package/dist/image_codec.js +149 -0
- package/dist/image_codec.js.map +1 -0
- package/dist/index.d.ts +32 -127
- package/dist/index.js +957 -4042
- package/dist/index.js.map +1 -1
- package/dist/launch.d.ts +42 -0
- package/dist/launch.js +206 -0
- package/dist/launch.js.map +1 -0
- package/dist/launcher/launcher.d.ts +6 -0
- package/dist/launcher/launcher.js +207 -0
- package/dist/launcher/launcher.js.map +1 -0
- package/dist/mcp/mesh_result.js.map +1 -1
- package/dist/mcp/mesh_server.js.map +1 -1
- package/dist/mesh/canonical.js +1 -1
- package/dist/mesh/canonical.js.map +1 -1
- package/dist/mesh/client.js.map +1 -1
- package/dist/mesh/encoding.js.map +1 -1
- package/dist/mesh/self_revoke.js.map +1 -1
- package/dist/mesh/siblings.js.map +1 -1
- package/dist/mesh/verify.js +1 -1
- package/dist/mesh/verify.js.map +1 -1
- package/dist/pairing/crypto.js +0 -1
- package/dist/pairing/crypto.js.map +1 -1
- package/dist/pairing/peer_trust.d.ts +20 -0
- package/dist/pairing/peer_trust.js +82 -0
- package/dist/pairing/peer_trust.js.map +1 -0
- package/dist/pairing/qr.js.map +1 -1
- package/dist/pairing/storage.js +4 -3
- package/dist/pairing/storage.js.map +1 -1
- package/dist/panel_bridge.d.ts +3 -1
- package/dist/panel_bridge.js +11 -10
- package/dist/panel_bridge.js.map +1 -1
- package/dist/paths.d.ts +22 -8
- package/dist/paths.js +37 -10
- package/dist/paths.js.map +1 -1
- package/dist/protocol/codec.js.map +1 -1
- package/dist/rooms.d.ts +16 -0
- package/dist/rooms.js +23 -4
- package/dist/rooms.js.map +1 -1
- package/dist/session/bridge.js.map +1 -1
- package/dist/session/broker.js.map +1 -1
- package/dist/session/broker_remote.js.map +1 -1
- package/dist/session/capabilities.d.ts +11 -0
- package/dist/session/capabilities.js +35 -0
- package/dist/session/capabilities.js.map +1 -0
- package/dist/session/cwd_lock.js +3 -3
- package/dist/session/cwd_lock.js.map +1 -1
- package/dist/session/debug_log.js +15 -5
- package/dist/session/debug_log.js.map +1 -1
- package/dist/session/envelope.js.map +1 -1
- package/dist/session/global_config.d.ts +1 -1
- package/dist/session/global_config.js +1 -1
- package/dist/session/global_config.js.map +1 -1
- package/dist/session/ipc.d.ts +2 -2
- package/dist/session/ipc.js.map +1 -1
- package/dist/session/leader_election.js.map +1 -1
- package/dist/session/local_config.d.ts +37 -0
- package/dist/session/local_config.js +47 -1
- package/dist/session/local_config.js.map +1 -1
- package/dist/session/mesh_node.d.ts +1 -1
- package/dist/session/mesh_node.js +1 -1
- package/dist/session/mesh_node.js.map +1 -1
- package/dist/session/peer.js.map +1 -1
- package/dist/session/peer_inventory.js.map +1 -1
- package/dist/session/peer_limits.js.map +1 -1
- package/dist/session/received_images.d.ts +63 -0
- package/dist/session/received_images.js +273 -0
- package/dist/session/received_images.js.map +1 -0
- package/dist/session/relay_lifecycle.d.ts +219 -0
- package/dist/session/relay_lifecycle.js +764 -0
- package/dist/session/relay_lifecycle.js.map +1 -0
- package/dist/session/rpc_envelope.d.ts +28 -0
- package/dist/session/rpc_envelope.js +10 -1
- package/dist/session/rpc_envelope.js.map +1 -1
- package/dist/session/rpc_handlers.d.ts +53 -0
- package/dist/session/rpc_handlers.js +268 -0
- package/dist/session/rpc_handlers.js.map +1 -0
- package/dist/session/rpc_inbound.d.ts +42 -7
- package/dist/session/rpc_inbound.js +56 -1
- package/dist/session/rpc_inbound.js.map +1 -1
- package/dist/session/setup_wizard.js.map +1 -1
- package/dist/session/tools.js.map +1 -1
- package/dist/session/wizard.js.map +1 -1
- package/dist/state_migration.d.ts +45 -0
- package/dist/state_migration.js +104 -0
- package/dist/state_migration.js.map +1 -0
- package/dist/subagent_rooms.d.ts +68 -0
- package/dist/subagent_rooms.js +919 -0
- package/dist/subagent_rooms.js.map +1 -0
- package/dist/test_hooks.d.ts +180 -0
- package/dist/test_hooks.js +98 -0
- package/dist/test_hooks.js.map +1 -0
- package/dist/transport/peer_channel.d.ts +18 -1
- package/dist/transport/peer_channel.js +42 -12
- package/dist/transport/peer_channel.js.map +1 -1
- package/dist/transport/pi_forward_client.js.map +1 -1
- package/dist/transport/relay_client.d.ts +24 -2
- package/dist/transport/relay_client.js +6 -3
- package/dist/transport/relay_client.js.map +1 -1
- package/dist/ui/footer.js.map +1 -1
- package/docs/daemon.md +170 -179
- package/package.json +13 -11
- package/service-templates/launchd.plist.template +8 -7
- package/service-templates/systemd.service.template +5 -4
- package/service-templates/task-launcher.vbs.template +5 -5
- package/service-templates/task-scheduler.xml.template +1 -1
- package/dist/bin/supervisord.js +0 -86
- package/dist/bin/supervisord.js.map +0 -1
- package/dist/daemon/client.d.ts +0 -20
- package/dist/daemon/client.js +0 -131
- package/dist/daemon/client.js.map +0 -1
- package/dist/daemon/control_protocol.d.ts +0 -176
- package/dist/daemon/control_protocol.js +0 -63
- package/dist/daemon/control_protocol.js.map +0 -1
- package/dist/daemon/cron_log.d.ts +0 -45
- package/dist/daemon/cron_log.js +0 -71
- package/dist/daemon/cron_log.js.map +0 -1
- package/dist/daemon/cron_registry.d.ts +0 -80
- package/dist/daemon/cron_registry.js +0 -198
- package/dist/daemon/cron_registry.js.map +0 -1
- package/dist/daemon/id.d.ts +0 -24
- package/dist/daemon/id.js +0 -36
- package/dist/daemon/id.js.map +0 -1
- package/dist/daemon/registry.d.ts +0 -63
- package/dist/daemon/registry.js +0 -153
- package/dist/daemon/registry.js.map +0 -1
- package/dist/daemon/rpc_child.d.ts +0 -194
- package/dist/daemon/rpc_child.js +0 -419
- package/dist/daemon/rpc_child.js.map +0 -1
- package/dist/daemon/supervisor.d.ts +0 -93
- package/dist/daemon/supervisor.js +0 -666
- package/dist/daemon/supervisor.js.map +0 -1
- /package/dist/bin/{supervisord.d.ts → launcher.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -31,84 +31,11 @@
|
|
|
31
31
|
*/
|
|
32
32
|
import type { ExtensionContext, ExtensionFactory } from "@earendil-works/pi-coding-agent";
|
|
33
33
|
import type { ClientMessage } from "./protocol/types.js";
|
|
34
|
-
import { PlainPeerChannel } from "./transport/peer_channel.js";
|
|
34
|
+
import type { PlainPeerChannel } from "./transport/peer_channel.js";
|
|
35
|
+
import { CTRL_PREFIX, type RelayConnectivity } from "./session/relay_lifecycle.js";
|
|
36
|
+
export { CTRL_PREFIX };
|
|
37
|
+
export type { RelayConnectivity };
|
|
35
38
|
export type RemoteState = "idle" | "started";
|
|
36
|
-
/** Relay connectivity as seen by an RPC client (Cockpit). Derived from
|
|
37
|
-
* `_state` + `_relay`: "disconnected" = relay off (idle); "connected" = live
|
|
38
|
-
* WS; "reconnecting" = was on, WS dropped, retrying. Surfaced via the
|
|
39
|
-
* `un-bien:relay-state` custom message (see `_emitRelayState`). */
|
|
40
|
-
export type RelayConnectivity = "connected" | "reconnecting" | "disconnected";
|
|
41
|
-
/** Sentinel prefix for a transparent control message an RPC client sends on the
|
|
42
|
-
* `prompt` channel (stdin). The `input` hook intercepts it, runs the action,
|
|
43
|
-
* and swallows it (`action:"handled"`) so it never becomes an LLM turn or a
|
|
44
|
-
* transcript entry. Starts with NUL so it can't collide with real user input
|
|
45
|
-
* and doesn't begin with "/" (which would route to the command parser). */
|
|
46
|
-
export declare const CTRL_PREFIX = "\0un-bien-ctrl:";
|
|
47
|
-
type MeshEnvelope = {
|
|
48
|
-
id: string;
|
|
49
|
-
from: string;
|
|
50
|
-
re: string | null;
|
|
51
|
-
body: unknown;
|
|
52
|
-
};
|
|
53
|
-
/** Test-only override of the message buffer. */
|
|
54
|
-
/**
|
|
55
|
-
* Test-only: emulate what `/unbien` does on the returning-user path
|
|
56
|
-
* (join the local mesh, then start the relay) without touching the FS for
|
|
57
|
-
* a `localConfigExists()` lookup. Lets tests bring the relay up without
|
|
58
|
-
* mocking the wizard or the local config storage.
|
|
59
|
-
*
|
|
60
|
-
* Typed loosely to accept any ctx shape with `ui.notify` + `cwd` — the
|
|
61
|
-
* unit tests use minimal mocks that don't satisfy the full
|
|
62
|
-
* `ExtensionContext` interface.
|
|
63
|
-
*/
|
|
64
|
-
export declare function _connectForTest(ctx: unknown): Promise<void>;
|
|
65
|
-
/** Test-only: tear everything down (mirrors `/unbien stop`). */
|
|
66
|
-
export declare function _stopForTest(ctx: unknown): Promise<void>;
|
|
67
|
-
/** Test-only: read/reset the `_disposed` flag. Production clears it only when
|
|
68
|
-
* a host reuses this module for a replacement session; tests share one module
|
|
69
|
-
* across cases, so they also reset it to avoid cross-test pollution. */
|
|
70
|
-
export declare function _getDisposedForTest(): boolean;
|
|
71
|
-
export declare function _setDisposedForTest(v: boolean): void;
|
|
72
|
-
/** Test-only: reset the once-per-session auto-init gate so session_start re-runs it. */
|
|
73
|
-
export declare function _resetAutoInitedForTest(): void;
|
|
74
|
-
/** Test-only: clear the globalThis panel/ui bridge ownership so each fresh
|
|
75
|
-
* `extension(pi)` in a shared test process can (re)claim and rebuild bridges. */
|
|
76
|
-
export declare function _resetBridgeOwnersForTest(): void;
|
|
77
|
-
/** Test-only: reset the keyed per-session state at a TEST BOUNDARY (beforeEach).
|
|
78
|
-
* Must NOT be folded into _resetBridgeOwnersForTest — that fires mid-test on
|
|
79
|
-
* every captureEventHandler call and would wipe state a test seeds across two
|
|
80
|
-
* captures (e.g. input seeds turnId, message_update reads it). */
|
|
81
|
-
export declare function _resetSessionsForTest(): void;
|
|
82
|
-
/** Test-only: set the auto-init gate for lifecycle replacement tests. */
|
|
83
|
-
export declare function _setAutoInitedForTest(value: boolean): void;
|
|
84
|
-
/** Test-only: true when this instance holds a live local-mesh node. */
|
|
85
|
-
export declare function _hasMeshNodeForTest(): boolean;
|
|
86
|
-
/** Test-only: drive the current real SelfRevoke producer through one sweep. */
|
|
87
|
-
export declare function _checkSelfRevokeForTest(): Promise<void>;
|
|
88
|
-
/** Test-only: the effective (possibly `#N`-suffixed) name the cwd-lock reserved. */
|
|
89
|
-
export declare function _getLockedNameForTest(): string | null;
|
|
90
|
-
/** Test-only: release + clear the cwd lock (the lock normally survives stop). */
|
|
91
|
-
export declare function _resetCwdLockForTest(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Test-only: relay-only startup, no UDS mesh join. Replaces the old
|
|
94
|
-
* `unbien relay start` handler that some tests captured to bring up
|
|
95
|
-
* the relay in isolation (e.g. ping/pong tests that don't care about the
|
|
96
|
-
* agent-network broker).
|
|
97
|
-
*/
|
|
98
|
-
export declare function _startRelayForTest(ctx: unknown): Promise<void>;
|
|
99
|
-
/** Test-only: public marker for canceled-keypair cache regression checks. */
|
|
100
|
-
export declare function _getCachedPublicKeyForTest(): string | null;
|
|
101
|
-
/** Test-only override of session started timestamp. */
|
|
102
|
-
export declare function _setSessionStartedAtForTest(ts: number | null): void;
|
|
103
|
-
/** Test-only: reset the cached model name (between tests). */
|
|
104
|
-
export declare function _setCurrentModelForTest(name: string | undefined): void;
|
|
105
|
-
/** Test-only: read the active turn id used for plain `cancel` routing. */
|
|
106
|
-
export declare function _getCurrentTurnIdForTest(): string | null;
|
|
107
|
-
/** Test-only: override the bound AgentSession so a spy can capture the
|
|
108
|
-
* content handed to `sendUserMessage` (plan/30 multimodal ingest). */
|
|
109
|
-
export declare function _setPiForTest(pi: unknown): void;
|
|
110
|
-
/** Test-only: exposes pending reconnect timer state. */
|
|
111
|
-
export declare function _hasPendingReconnect(): boolean;
|
|
112
39
|
/**
|
|
113
40
|
* Public state-snapshot helper. Returns the derived UX state, not the raw
|
|
114
41
|
* `_state` enum: the W2D refactor collapsed the internal machine to
|
|
@@ -117,37 +44,38 @@ export declare function _hasPendingReconnect(): boolean;
|
|
|
117
44
|
* mental model via this getter.
|
|
118
45
|
*/
|
|
119
46
|
export declare function _getState(): "idle" | "started" | "paired";
|
|
120
|
-
/** Test-only: number of owners currently attached via PlainPeerChannel. */
|
|
121
|
-
export declare function _getActivePeerCountForTest(): number;
|
|
122
|
-
/** Test-only: true if a specific peer (base64 std) has an attached channel. */
|
|
123
|
-
export declare function _hasActivePeerForTest(appPeerIdStd: string): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Handle a transparent control command from an RPC client (Cockpit), received
|
|
126
|
-
* as a `CTRL_PREFIX`-tagged input the `input` hook swallowed. Toggles the relay
|
|
127
|
-
* WITHOUT leaving the local mesh (relay-only: `_cmdStart` up / `_goIdle` down),
|
|
128
|
-
* then emits the fresh state. `relay:status` just re-emits (no change) so the
|
|
129
|
-
* client can sync its button after (re)attaching to the RPC stream.
|
|
130
|
-
*/
|
|
131
47
|
export declare function _handleControl(cmd: string): Promise<void>;
|
|
132
|
-
/**
|
|
133
|
-
* Per-owner disconnect callback. Fires when one specific owner's channel
|
|
134
|
-
* detaches (e.g. relay told us the peer is gone). Other owners' channels
|
|
135
|
-
* keep running — relay stays "started".
|
|
136
|
-
*
|
|
137
|
-
* Exported so tests can trigger the disconnect path for a specific peer.
|
|
138
|
-
*
|
|
139
|
-
* Backward-compat: a no-arg call (legacy tests / pre-W2D callers) falls
|
|
140
|
-
* back to detaching the most recently attached peer, mirroring the old
|
|
141
|
-
* singleton semantics.
|
|
142
|
-
*/
|
|
143
48
|
export declare function _onPeerDisconnect(appPeerId?: string): void;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
export declare
|
|
49
|
+
export declare const _connectForTest: (ctx: unknown) => Promise<void>;
|
|
50
|
+
export declare const _stopForTest: (ctx: unknown) => Promise<void>;
|
|
51
|
+
export declare const _getDisposedForTest: () => boolean;
|
|
52
|
+
export declare const _setDisposedForTest: (v: boolean) => void;
|
|
53
|
+
export declare const _resetAutoInitedForTest: () => void;
|
|
54
|
+
export declare const _resetBridgeOwnersForTest: () => void;
|
|
55
|
+
export declare const _resetSessionsForTest: () => void;
|
|
56
|
+
export declare const _seedRootSessionForTest: (sid?: string) => void;
|
|
57
|
+
export declare const _setAutoInitedForTest: (value: boolean) => void;
|
|
58
|
+
export declare const _hasMeshNodeForTest: () => boolean;
|
|
59
|
+
export declare const _checkSelfRevokeForTest: () => Promise<void>;
|
|
60
|
+
export declare const _getLockedNameForTest: () => string | null;
|
|
61
|
+
export declare const _resetCwdLockForTest: () => void;
|
|
62
|
+
export declare const _startRelayForTest: (ctx: unknown) => Promise<void>;
|
|
63
|
+
export declare const _getCachedPublicKeyForTest: () => string | null;
|
|
64
|
+
export declare const _setSessionStartedAtForTest: (ts: number | null) => void;
|
|
65
|
+
export declare const _setCurrentModelForTest: (name: string | undefined) => void;
|
|
66
|
+
export declare const _getCurrentTurnIdForTest: () => string | null;
|
|
67
|
+
export declare const _setPiForTest: (pi: unknown) => void;
|
|
68
|
+
export declare const _hasPendingReconnect: () => boolean;
|
|
69
|
+
export declare const _getActivePeerCountForTest: () => number;
|
|
70
|
+
export declare const _hasActivePeerForTest: (appPeerIdStd: string) => boolean;
|
|
71
|
+
export declare const _deliverMeshMessageToAgentForTest: (env: {
|
|
72
|
+
id: string;
|
|
73
|
+
from: string;
|
|
74
|
+
re: string | null;
|
|
75
|
+
body: unknown;
|
|
76
|
+
}) => void;
|
|
147
77
|
declare const extension: ExtensionFactory;
|
|
148
78
|
export default extension;
|
|
149
|
-
/** Test-only entry point for verifying mesh-to-agent delivery semantics. */
|
|
150
|
-
export declare function _deliverMeshMessageToAgentForTest(env: MeshEnvelope): void;
|
|
151
79
|
export declare function _routeClientMessageFrom(sender: PlainPeerChannel, msg: ClientMessage, ctx: Pick<ExtensionContext, "abort">): void;
|
|
152
80
|
/**
|
|
153
81
|
* Backward-compatible shim for legacy callers + tests that didn't track
|
|
@@ -155,29 +83,6 @@ export declare function _routeClientMessageFrom(sender: PlainPeerChannel, msg: C
|
|
|
155
83
|
* mirroring the pre-W2D singleton behavior.
|
|
156
84
|
*/
|
|
157
85
|
export declare function routeClientMessage(msg: ClientMessage, ctx: Pick<ExtensionContext, "abort">): void;
|
|
158
|
-
type ToolArgs = Record<string, unknown>;
|
|
159
|
-
export declare function _enrichToolArgs(tool: string, args: unknown): ToolArgs;
|
|
160
|
-
/**
|
|
161
|
-
* `unbien restart-supervisor` — restarts the `pi-supervisord` PROCESS
|
|
162
|
-
* (not the daemons). The supervisor is a long-running Node process with no
|
|
163
|
-
* hot-reload, so after a `dist` rebuild the old code keeps running until the
|
|
164
|
-
* process is restarted. The Cockpit "Restart supervisor" button shells out to
|
|
165
|
-
* this; the OS-specific restart lives here so the app stays cross-platform.
|
|
166
|
-
*
|
|
167
|
-
* Restarting the supervisor re-spawns every daemon as a side effect. Exits 0
|
|
168
|
-
* on success, non-zero on failure (the Cockpit detects failure by exit code).
|
|
169
|
-
*/
|
|
170
|
-
/** One step of a restart sequence. `ignoreFailure` steps (e.g. `schtasks /End`
|
|
171
|
-
* when the task isn't running) don't abort the sequence. */
|
|
172
|
-
export interface RestartStep {
|
|
173
|
-
cmd: string;
|
|
174
|
-
args: string[];
|
|
175
|
-
ignoreFailure?: boolean;
|
|
176
|
-
}
|
|
177
|
-
/** Pure: the OS command sequence that restarts the supervisor service, or null
|
|
178
|
-
* when the platform isn't supported. Most platforms are 1 step; Windows is 2
|
|
179
|
-
* (`schtasks /End` then `/Run`). Exported for tests. */
|
|
180
|
-
export declare function _restartSupervisorCommand(platform: NodeJS.Platform, uid: number): RestartStep[] | null;
|
|
181
86
|
/**
|
|
182
87
|
* Read-only probe of the local UDS broker for the mesh roster, backing
|
|
183
88
|
* `unbien peers`. Opens a raw connection to `sockPath`, sends a single
|