@geohar/un-bien 0.9.0 → 0.16.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 +100 -131
- package/dist/actions/handlers.js.map +1 -1
- package/dist/actions/registry.js.map +1 -1
- package/dist/bin/launcher.js.map +1 -1
- package/dist/client.d.ts +15 -0
- package/dist/client.js +15 -0
- package/dist/client.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 +11 -1
- package/dist/config.js.map +1 -1
- package/dist/daemon/install.d.ts +6 -5
- package/dist/daemon/install.js +15 -5
- package/dist/daemon/install.js.map +1 -1
- package/dist/enrich_tool_args.js.map +1 -1
- package/dist/extension_ui_bridge.js.map +1 -1
- package/dist/image_codec.js.map +1 -1
- package/dist/index.d.ts +32 -101
- package/dist/index.js +852 -2872
- package/dist/index.js.map +1 -1
- package/dist/launch.d.ts +14 -1
- package/dist/launch.js +55 -5
- package/dist/launch.js.map +1 -1
- package/dist/launcher/launcher.js +48 -6
- package/dist/launcher/launcher.js.map +1 -1
- 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.js.map +1 -1
- package/dist/pairing/qr.js.map +1 -1
- package/dist/pairing/storage.d.ts +7 -0
- package/dist/pairing/storage.js +22 -3
- package/dist/pairing/storage.js.map +1 -1
- package/dist/panel_bridge.js +1 -0
- 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.js +1 -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 +13 -3
- 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 +45 -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 +223 -0
- package/dist/session/relay_lifecycle.js +802 -0
- package/dist/session/relay_lifecycle.js.map +1 -0
- package/dist/session/rpc_envelope.d.ts +10 -0
- package/dist/session/rpc_envelope.js +9 -0
- 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 +41 -6
- package/dist/session/rpc_inbound.js +55 -0
- 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 +19 -0
- package/dist/subagent_rooms.js +146 -14
- package/dist/subagent_rooms.js.map +1 -1
- 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 +11 -0
- package/dist/transport/peer_channel.js +34 -11
- 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 +14 -3
- 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 +166 -176
- package/package.json +6 -2
- package/service-templates/launchd.plist.template +5 -4
- package/service-templates/systemd.service.template +3 -2
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,34 +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;
|
|
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;
|
|
144
77
|
declare const extension: ExtensionFactory;
|
|
145
78
|
export default extension;
|
|
146
|
-
/** Test-only entry point for verifying mesh-to-agent delivery semantics. */
|
|
147
|
-
export declare function _deliverMeshMessageToAgentForTest(env: MeshEnvelope): void;
|
|
148
79
|
export declare function _routeClientMessageFrom(sender: PlainPeerChannel, msg: ClientMessage, ctx: Pick<ExtensionContext, "abort">): void;
|
|
149
80
|
/**
|
|
150
81
|
* Backward-compatible shim for legacy callers + tests that didn't track
|