@uxnan/shared 0.0.16-alpha.20260919 → 0.0.17-alpha.20260926

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +6 -3
  2. package/agent-locations.json +82 -0
  3. package/dist/src/agents/agent-adapter.d.ts +14 -0
  4. package/dist/src/agents/agent-capabilities.d.ts +17 -3
  5. package/dist/src/agents/agent-locations.d.ts +61 -0
  6. package/dist/src/agents/agent-locations.js +124 -0
  7. package/dist/src/agents/agent-locations.js.map +1 -0
  8. package/dist/src/index.d.ts +4 -0
  9. package/dist/src/index.js +5 -0
  10. package/dist/src/index.js.map +1 -1
  11. package/dist/src/jsonrpc/method-registry.d.ts +1 -1
  12. package/dist/src/jsonrpc/method-registry.js +13 -0
  13. package/dist/src/jsonrpc/method-registry.js.map +1 -1
  14. package/dist/src/jsonrpc/methods.d.ts +81 -12
  15. package/dist/src/jsonrpc/notifications.d.ts +136 -14
  16. package/dist/src/jsonrpc/notifications.js +30 -2
  17. package/dist/src/jsonrpc/notifications.js.map +1 -1
  18. package/dist/src/local-control/local-control.d.ts +137 -0
  19. package/dist/src/local-control/local-control.js +68 -0
  20. package/dist/src/local-control/local-control.js.map +1 -0
  21. package/dist/src/models/project.d.ts +40 -1
  22. package/dist/src/models/project.js +5 -0
  23. package/dist/src/models/project.js.map +1 -1
  24. package/dist/src/models/session.d.ts +86 -0
  25. package/dist/src/models/session.js +0 -5
  26. package/dist/src/models/session.js.map +1 -1
  27. package/dist/src/models/sync.d.ts +88 -0
  28. package/dist/src/models/sync.js +2 -0
  29. package/dist/src/models/sync.js.map +1 -0
  30. package/dist/src/models/thread.d.ts +25 -0
  31. package/dist/src/models/tool.d.ts +68 -0
  32. package/dist/src/models/tool.js +11 -0
  33. package/dist/src/models/tool.js.map +1 -0
  34. package/package.json +3 -2
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ![TypeScript](https://img.shields.io/badge/TypeScript-ESM-3178C6?style=for-the-badge&logo=typescript&logoColor=white)
4
4
  ![Node.js](https://img.shields.io/badge/Node.js-%E2%89%A518-339933?style=for-the-badge&logo=nodedotjs&logoColor=white)
5
5
  ![JSON Schema](https://img.shields.io/badge/validation-Ajv-000000?style=for-the-badge&logo=json&logoColor=white)
6
- ![Contracts](https://img.shields.io/badge/70_methods_%7C_12_notifications-blue?style=for-the-badge)
6
+ ![Contracts](https://img.shields.io/badge/72_methods_%7C_16_notifications-blue?style=for-the-badge)
7
7
 
8
8
  Shared JSON-RPC and E2EE contracts for the [Uxnan](../README.md) ecosystem — the
9
9
  single source of truth every component agrees on. Consumed as a local workspace
@@ -13,7 +13,7 @@ equivalents (see
13
13
  [`architecture/02b-contracts-and-requirements.md`](../architecture/02b-contracts-and-requirements.md)
14
14
  §1 for the canonical contract list).
15
15
 
16
- > **Status:** implemented and stable — **70 JSON-RPC methods** + **12 streaming
16
+ > **Status:** implemented and stable — **81 JSON-RPC methods** + **22 streaming
17
17
  > notifications**, kept lock-step at build time with the `METHOD_NAMES` array and
18
18
  > the `StreamNotification` enum (a compile-time assertion in
19
19
  > `src/jsonrpc/method-registry.ts` fails the build on any drift). Changes are
@@ -50,7 +50,10 @@ flowchart TB
50
50
  | Area | Exports |
51
51
  |---|---|
52
52
  | JSON-RPC | envelope types + constructors (`makeRequest`, `makeNotification`, `makeResponse`, `makeErrorResponse`), error codes (`JsonRpcErrorCode` + Uxnan-specific `-32000..-32009`), `RpcError`, typed method registry (`JsonRpcMethodRegistry` + `METHOD_NAMES`), `isKnownMethod` |
53
- | Streaming | `StreamNotification` enum + param types (`TurnStartedParams`, `MessageDeltaParams`, `ThinkingDeltaParams`, `ContentBlockParams`, `TurnCompletedParams`, `TurnUsage`, `TurnErrorParams`, `TurnAbortedParams`, `ModelResolvedParams`) |
53
+ | Streaming | `StreamNotification` enum + param types (`TurnStartedParams`, `MessageDeltaParams`, `ThinkingDeltaParams`, `ContentBlockParams`, `TurnCompletedParams`, `TurnUsage`, `TurnErrorParams`, `TurnAbortedParams`, `ModelResolvedParams`, and the multi-client set: `ThreadUpdatedParams`, `ThreadDeletedParams`, `TurnCreatedParams`, `ApprovalResolvedParams`, `QuestionResolvedParams`) |
54
+ | Local control | the loopback channel Uxnan Desktop uses on the bridge's machine: `LOCAL_CONTROL_FILE` / `LOCAL_CONTROL_PATH`, `LocalControlDiscovery`, the `LocalControlFrame` union (`hello` + `message`), `isValidLocalClientId`, `localReceiverId` (architecture/02a §5.8.15) |
55
+ | Replica sync | `sync/changes` (`SyncChanges`: revisioned threads, projects, settings, deletions, presence), `BridgeSettings { home }`, `ClientPresence`, `Project` registry fields, `Turn.seq`, `Thread.origin` (`src/models/sync.ts`, architecture/02a §5.8.17) |
56
+ | Agent locations | `agent-locations.json` (package root) + `locateAgent` / `agentLocation`: where every agent CLI installs — the one table the bridge and Uxnan Desktop resolve from |
54
57
  | E2EE | handshake messages (`clientHello` / `serverHello` / `clientAuth` / `ready`), `buildHandshakeTranscript`, `SecureEnvelope`, `PairingPayload` v2 (`relay` optional + `hosts: string[]`) with `Base64(utf8(JSON))` QR encoding |
55
58
  | Models | thread / turn / message (with `MessageContent` polymorphic blocks), durable `CompactionContentBlock` and `AssistantResponseBoundaryBlock`, git, workspace (incl. `browseDirs` + `exists`), project, auth, session/trust (`BridgeStatus` incl. `latestVersion?`/`updateAvailable?`), bridge-owned profile metrics (complete-ledger export/import), approval, question (interactive multiple-choice) |
56
59
  | Agents | `IAgentAdapter` (with `respondApproval`, `listModels`, `nativeSessionId`, `SendTurnOptions { threadId, turnId, text, service?, effort?, options?, attachments?, cwd?, accessMode? }`), `AgentModel` (incl. `version?`, `isDefault?`, `options?`, `contextWindow?`, `isLatestAlias?`), `AgentCapabilities` (incl. `images`, `approvals`, `reportsContextUsage`, `reportsCompaction`), `AgentDescriptor.deprecated`, `AgentConfig` (cwd, agentId, model, plus optional `binaryPath`/`extraArgs`) |
@@ -0,0 +1,82 @@
1
+ {
2
+ "$comment": "Where each coding-agent CLI Uxnan drives is installed — the ONE table the bridge (shared/src/agents/agent-locations.ts) and Uxnan Desktop (uxnandesktop/src-tauri/src/agentcli.rs, include_str!) both resolve from, so the phone, the desktop's chat and its terminals agree on what is installed. Tokens: '~' = the user's home, '%APPDATA%' / '%LOCALAPPDATA%' / '%PROGRAMFILES%' = those Windows folders, '$NODE_PREFIX' = the install prefix of the node running the resolver (covers nvm, fnm, volta, Homebrew and any custom npm prefix: global packages live under it). Resolution order per agent: native candidates, then the npm entry under each npm root (run as 'node <entry>'), then the command on PATH (POSIX; on Windows only a real executable counts). architecture/02a §5.8.17.",
3
+ "npmRoots": {
4
+ "posix": [
5
+ "$NODE_PREFIX/lib/node_modules",
6
+ "/usr/local/lib/node_modules",
7
+ "/opt/homebrew/lib/node_modules",
8
+ "~/.npm-global/lib/node_modules"
9
+ ],
10
+ "win32": ["$NODE_PREFIX/node_modules", "%APPDATA%/npm/node_modules"]
11
+ },
12
+ "pathDirs": {
13
+ "posix": [
14
+ "/opt/homebrew/bin",
15
+ "/opt/homebrew/sbin",
16
+ "/usr/local/bin",
17
+ "/usr/local/sbin",
18
+ "~/.local/bin",
19
+ "~/.npm-global/bin",
20
+ "~/.cargo/bin",
21
+ "~/.bun/bin",
22
+ "~/.deno/bin",
23
+ "~/.grok/bin"
24
+ ],
25
+ "win32": []
26
+ },
27
+ "agents": [
28
+ {
29
+ "bridgeId": "claude-code",
30
+ "desktopId": "claude",
31
+ "command": "claude",
32
+ "native": { "posix": ["~/.local/bin/claude"], "win32": ["~/.local/bin/claude.exe"] },
33
+ "npmEntry": "@anthropic-ai/claude-code/cli.js"
34
+ },
35
+ {
36
+ "bridgeId": "codex",
37
+ "desktopId": "codex",
38
+ "command": "codex",
39
+ "npmEntry": "@openai/codex/bin/codex.js"
40
+ },
41
+ {
42
+ "bridgeId": "opencode",
43
+ "desktopId": "opencode",
44
+ "command": "opencode",
45
+ "native": {
46
+ "posix": [],
47
+ "win32": [
48
+ "%APPDATA%/npm/node_modules/opencode-ai/bin/opencode.exe",
49
+ "%PROGRAMFILES%/opencode/opencode.exe",
50
+ "%LOCALAPPDATA%/opencode/opencode.exe"
51
+ ]
52
+ }
53
+ },
54
+ {
55
+ "bridgeId": "pi-agent",
56
+ "desktopId": "pi",
57
+ "command": "pi",
58
+ "npmEntry": "@earendil-works/pi-coding-agent/dist/cli.js"
59
+ },
60
+ {
61
+ "bridgeId": "antigravity-cli",
62
+ "desktopId": "agy",
63
+ "command": "agy",
64
+ "native": {
65
+ "posix": ["~/.local/bin/agy", "~/agy/bin/agy", "/usr/local/bin/agy", "/opt/homebrew/bin/agy"],
66
+ "win32": ["%LOCALAPPDATA%/agy/bin/agy.exe"]
67
+ }
68
+ },
69
+ {
70
+ "bridgeId": "grok",
71
+ "desktopId": "grok",
72
+ "command": "grok",
73
+ "native": { "posix": ["~/.grok/bin/grok"], "win32": ["~/.grok/bin/grok.exe"] }
74
+ },
75
+ {
76
+ "bridgeId": "zero",
77
+ "desktopId": "zero",
78
+ "command": "zero",
79
+ "npmEntry": "@gitlawb/zero/bin/zero.js"
80
+ }
81
+ ]
82
+ }
@@ -61,6 +61,20 @@ export interface SendTurnOptions {
61
61
  * per-command handling. Absent for an ordinary text turn.
62
62
  */
63
63
  command?: AgentCommandInvocation;
64
+ /**
65
+ * Uxnan Desktop's tools, when the desktop attached them (`desktop/attach`):
66
+ * its MCP endpoint and the bearer token for bridge-run agents. An adapter that
67
+ * can register an MCP server for one run does so under
68
+ * {@link DESKTOP_MCP_SERVER_NAME}, passing the token only through the
69
+ * environment and the conversation's `cwd` in {@link DESKTOP_CWD_HEADER}.
70
+ * Absent when no desktop is attached.
71
+ */
72
+ desktopTools?: DesktopTools;
73
+ }
74
+ /** What `desktop/attach` gave the bridge (see {@link SendTurnOptions.desktopTools}). */
75
+ export interface DesktopTools {
76
+ mcpUrl: string;
77
+ token: string;
64
78
  }
65
79
  /** Input for {@link IAgentAdapter.generateTitle}. */
66
80
  export interface GenerateTitleOptions {
@@ -83,6 +83,18 @@ export interface AgentDescriptor {
83
83
  /** Default model the bridge will use when the phone does not pick one. */
84
84
  defaultModel?: string;
85
85
  }
86
+ /**
87
+ * How the bridge found — or failed to find — one agent's CLI, so a client can
88
+ * say *why* an installed agent shows as unavailable instead of guessing.
89
+ */
90
+ export interface AgentDiagnosis {
91
+ agentId: AgentId;
92
+ available: boolean;
93
+ /** The command the bridge runs for it (the executable, then any fixed args). */
94
+ command?: string[];
95
+ /** Every location checked, in order (files, and `PATH:<dir>` for PATH entries). */
96
+ checked: string[];
97
+ }
86
98
  /** One selectable value of an {@link AgentModelOption} of kind `enum`. */
87
99
  export interface AgentModelOptionValue {
88
100
  /** Value sent back in `turn/send` `options` when chosen. */
@@ -185,10 +197,12 @@ export interface AgentCommand {
185
197
  argumentHint?: string;
186
198
  /**
187
199
  * Where the command comes from: `acp` (advertised by an ACP agent),
188
- * `builtin` (a CLI control command reachable headless), or `custom` (a
189
- * user-defined prompt-template file the bridge expands).
200
+ * `builtin` (one of the CLI's own commands, reachable headless), `custom` (a
201
+ * user-defined command or prompt template), or `skill` (an agent skill the
202
+ * CLI invokes by name). A client may group by it; an unknown value is to be
203
+ * shown as `custom`.
190
204
  */
191
- source: 'acp' | 'builtin' | 'custom';
205
+ source: 'acp' | 'builtin' | 'custom' | 'skill';
192
206
  /**
193
207
  * Whether the command actually runs in the agent's headless/programmatic mode.
194
208
  * Absent/true means yes; `false` marks a command that only works in the CLI's
@@ -0,0 +1,61 @@
1
+ export interface AgentLocation {
2
+ /** The bridge's `AgentId`. */
3
+ bridgeId: string;
4
+ /** Uxnan Desktop's backend id (`agentcli::SUPPORTED`). */
5
+ desktopId: string;
6
+ /** The launcher name on PATH. */
7
+ command: string;
8
+ /** Native executables, checked first, by platform family. */
9
+ native?: {
10
+ posix: string[];
11
+ win32: string[];
12
+ };
13
+ /** The npm package's JS entry, relative to an npm root (run as `node <entry>`). */
14
+ npmEntry?: string;
15
+ }
16
+ export interface AgentLocationTable {
17
+ npmRoots: {
18
+ posix: string[];
19
+ win32: string[];
20
+ };
21
+ /** Folders a login PATH normally has that a service's PATH lacks. */
22
+ pathDirs: {
23
+ posix: string[];
24
+ win32: string[];
25
+ };
26
+ agents: AgentLocation[];
27
+ }
28
+ /** The shared table (read once from `agent-locations.json`). */
29
+ export declare function agentLocationTable(): AgentLocationTable;
30
+ /** The table entry for a bridge agent id, if Uxnan knows where it installs. */
31
+ export declare function agentLocation(bridgeId: string): AgentLocation | undefined;
32
+ export interface LocateEnvironment {
33
+ platform: NodeJS.Platform;
34
+ env: NodeJS.ProcessEnv;
35
+ home: string;
36
+ /** The node executable that would run an npm entry. */
37
+ nodePath: string;
38
+ /** Replaces the table's npm roots (tests, which must not see this machine's). */
39
+ npmRoots?: string[];
40
+ }
41
+ export declare function currentLocateEnvironment(): LocateEnvironment;
42
+ /**
43
+ * Expand the table's tokens for this machine; `undefined` when a token names
44
+ * a folder this machine does not have (e.g. `%APPDATA%` off Windows).
45
+ */
46
+ export declare function expandLocation(path: string, where: LocateEnvironment): string | undefined;
47
+ export interface LocatedAgent {
48
+ /** What to spawn: the native binary, node (for an npm entry), or the launcher. */
49
+ binaryPath: string;
50
+ /** Args before the agent's own (`[entry.js]` for an npm entry). */
51
+ prependArgs: string[];
52
+ available: boolean;
53
+ /** Every location checked, in order (`PATH:<dir>` for PATH entries). */
54
+ checked: string[];
55
+ }
56
+ /**
57
+ * Find [location]'s CLI on this machine. [configured] (a user's explicit path)
58
+ * always wins. On Windows a PATH hit counts only when it is a real executable
59
+ * (`.exe`/`.com`): an npm `.cmd` shim cannot be spawned without a shell.
60
+ */
61
+ export declare function locateAgent(location: AgentLocation, configured?: string, where?: LocateEnvironment): LocatedAgent;
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Where the coding-agent CLIs are installed, and how to find one — the single
3
+ * rule the bridge and Uxnan Desktop share (architecture/02a §5.8.17).
4
+ *
5
+ * The table itself is `agent-locations.json` at this package's root: the
6
+ * desktop compiles the same file into its Rust resolver (`include_str!`), so
7
+ * the phone, the desktop's chat and the desktop's terminals can never disagree
8
+ * about which agents are installed — the disagreement the maintainer hit when
9
+ * the chat offered agents the desktop knew were missing, and missed ones it
10
+ * knew were there.
11
+ */
12
+ import { existsSync, readFileSync, statSync } from 'node:fs';
13
+ import { homedir } from 'node:os';
14
+ import { delimiter, dirname, join } from 'node:path';
15
+ let table;
16
+ /** The shared table (read once from `agent-locations.json`). */
17
+ export function agentLocationTable() {
18
+ // dist/src/agents/agent-locations.js → the package root holds the JSON.
19
+ table ??= JSON.parse(readFileSync(new URL('../../../agent-locations.json', import.meta.url), 'utf-8'));
20
+ return table;
21
+ }
22
+ /** The table entry for a bridge agent id, if Uxnan knows where it installs. */
23
+ export function agentLocation(bridgeId) {
24
+ return agentLocationTable().agents.find((a) => a.bridgeId === bridgeId);
25
+ }
26
+ export function currentLocateEnvironment() {
27
+ return {
28
+ platform: process.platform,
29
+ env: process.env,
30
+ home: homedir(),
31
+ nodePath: process.execPath,
32
+ };
33
+ }
34
+ /**
35
+ * Expand the table's tokens for this machine; `undefined` when a token names
36
+ * a folder this machine does not have (e.g. `%APPDATA%` off Windows).
37
+ */
38
+ export function expandLocation(path, where) {
39
+ let out = path;
40
+ if (out === '~' || out.startsWith('~/'))
41
+ out = join(where.home, out.slice(1));
42
+ const prefix = nodePrefix(where);
43
+ out = out.replace('$NODE_PREFIX', prefix);
44
+ const winVars = {
45
+ '%APPDATA%': where.env['APPDATA'],
46
+ '%LOCALAPPDATA%': where.env['LOCALAPPDATA'],
47
+ '%PROGRAMFILES%': where.env['ProgramFiles'],
48
+ };
49
+ for (const [token, value] of Object.entries(winVars)) {
50
+ if (!out.includes(token))
51
+ continue;
52
+ if (!value)
53
+ return undefined;
54
+ out = out.replace(token, value);
55
+ }
56
+ return join(out);
57
+ }
58
+ /**
59
+ * The prefix global npm packages of [where.nodePath] live under: `<prefix>/lib/
60
+ * node_modules` on POSIX (`<prefix>/bin/node`), `<prefix>/node_modules` on
61
+ * Windows (`<prefix>\node.exe`).
62
+ */
63
+ function nodePrefix(where) {
64
+ const bin = dirname(where.nodePath);
65
+ return where.platform === 'win32' ? bin : dirname(bin);
66
+ }
67
+ function isFile(path) {
68
+ try {
69
+ return existsSync(path) && statSync(path).isFile();
70
+ }
71
+ catch {
72
+ return false;
73
+ }
74
+ }
75
+ /**
76
+ * Find [location]'s CLI on this machine. [configured] (a user's explicit path)
77
+ * always wins. On Windows a PATH hit counts only when it is a real executable
78
+ * (`.exe`/`.com`): an npm `.cmd` shim cannot be spawned without a shell.
79
+ */
80
+ export function locateAgent(location, configured, where = currentLocateEnvironment()) {
81
+ const checked = [];
82
+ if (configured && configured.length > 0) {
83
+ checked.push(configured);
84
+ return { binaryPath: configured, prependArgs: [], available: isFile(configured), checked };
85
+ }
86
+ const family = where.platform === 'win32' ? 'win32' : 'posix';
87
+ for (const raw of location.native?.[family] ?? []) {
88
+ const path = expandLocation(raw, where);
89
+ if (!path)
90
+ continue;
91
+ checked.push(path);
92
+ if (isFile(path))
93
+ return { binaryPath: path, prependArgs: [], available: true, checked };
94
+ }
95
+ if (location.npmEntry) {
96
+ for (const raw of where.npmRoots ?? agentLocationTable().npmRoots[family]) {
97
+ const root = expandLocation(raw, where);
98
+ if (!root)
99
+ continue;
100
+ const entry = join(root, location.npmEntry);
101
+ checked.push(entry);
102
+ if (isFile(entry)) {
103
+ return { binaryPath: where.nodePath, prependArgs: [entry], available: true, checked };
104
+ }
105
+ }
106
+ }
107
+ const names = where.platform === 'win32'
108
+ ? [`${location.command}.exe`, `${location.command}.com`]
109
+ : [location.command];
110
+ const rawPath = where.env['PATH'] ?? where.env['Path'] ?? '';
111
+ for (const dir of rawPath.split(where.platform === 'win32' ? ';' : delimiter)) {
112
+ if (!dir)
113
+ continue;
114
+ checked.push(`PATH:${dir}`);
115
+ for (const name of names) {
116
+ const candidate = join(dir, name);
117
+ if (isFile(candidate)) {
118
+ return { binaryPath: candidate, prependArgs: [], available: true, checked };
119
+ }
120
+ }
121
+ }
122
+ return { binaryPath: location.command, prependArgs: [], available: false, checked };
123
+ }
124
+ //# sourceMappingURL=agent-locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-locations.js","sourceRoot":"","sources":["../../../src/agents/agent-locations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAsBrD,IAAI,KAAqC,CAAC;AAE1C,gEAAgE;AAChE,MAAM,UAAU,kBAAkB;IAChC,wEAAwE;IACxE,KAAK,KAAK,IAAI,CAAC,KAAK,CAClB,YAAY,CAAC,IAAI,GAAG,CAAC,+BAA+B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAC3D,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,OAAO,kBAAkB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAYD,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,EAAE;QACf,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAwB;IACnE,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;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AW,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACtF,CAAC"}
@@ -14,17 +14,21 @@ export * from './e2ee/pairing-payload.js';
14
14
  export * from './agents/agent-capabilities.js';
15
15
  export * from './agents/agent-config.js';
16
16
  export * from './agents/agent-adapter.js';
17
+ export * from './agents/agent-locations.js';
18
+ export * from './local-control/local-control.js';
17
19
  export * from './version/compare.js';
18
20
  export * from './notifications/push-payload.js';
19
21
  export * from './models/thread.js';
20
22
  export * from './models/git.js';
21
23
  export * from './models/workspace.js';
22
24
  export * from './models/project.js';
25
+ export * from './models/sync.js';
23
26
  export * from './models/session.js';
24
27
  export * from './models/approval.js';
25
28
  export * from './models/question.js';
26
29
  export * from './models/compaction.js';
27
30
  export * from './models/assistant-response.js';
31
+ export * from './models/tool.js';
28
32
  export * from './models/usage.js';
29
33
  export * from './models/metrics.js';
30
34
  export * from './validators/validate.js';
package/dist/src/index.js CHANGED
@@ -17,6 +17,9 @@ export * from './e2ee/pairing-payload.js';
17
17
  export * from './agents/agent-capabilities.js';
18
18
  export * from './agents/agent-config.js';
19
19
  export * from './agents/agent-adapter.js';
20
+ export * from './agents/agent-locations.js';
21
+ // Local control channel (desktop ↔ bridge on the same machine)
22
+ export * from './local-control/local-control.js';
20
23
  // Version
21
24
  export * from './version/compare.js';
22
25
  // Notifications
@@ -26,11 +29,13 @@ export * from './models/thread.js';
26
29
  export * from './models/git.js';
27
30
  export * from './models/workspace.js';
28
31
  export * from './models/project.js';
32
+ export * from './models/sync.js';
29
33
  export * from './models/session.js';
30
34
  export * from './models/approval.js';
31
35
  export * from './models/question.js';
32
36
  export * from './models/compaction.js';
33
37
  export * from './models/assistant-response.js';
38
+ export * from './models/tool.js';
34
39
  export * from './models/usage.js';
35
40
  export * from './models/metrics.js';
36
41
  // Validators
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,c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;AAC1C,cAAc,6BAA6B,CAAC;AAE5C,+DAA+D;AAC/D,cAAc,kCAAkC,CAAC;AAEjD,UAAU;AACV,cAAc,sBAAsB,CAAC;AAErC,gBAAgB;AAChB,cAAc,iCAAiC,CAAC;AAEhD,SAAS;AACT,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAEpC,aAAa;AACb,cAAc,0BAA0B,CAAC;AACzC,cAAc,qCAAqC,CAAC"}
@@ -3,5 +3,5 @@
3
3
  * compile-time {@link JsonRpcMethodRegistry} via the assertion below.
4
4
  */
5
5
  import type { JsonRpcMethodName } from './methods.js';
6
- export declare const METHOD_NAMES: readonly ["thread/list", "thread/read", "thread/start", "thread/resume", "thread/fork", "thread/setModel", "thread/rename", "thread/setAccessMode", "thread/archive", "thread/unarchive", "thread/delete", "turn/list", "turn/read", "turn/send", "turn/cancel", "queue/resume", "queue/clear", "git/status", "git/diff", "git/commit", "git/push", "git/pull", "git/checkout", "git/createBranch", "git/createWorktree", "git/stage", "git/unstage", "git/discard", "git/createPr", "git/undoCommit", "git/branches", "git/switchBranch", "git/revert", "git/deleteBranch", "git/removeWorktree", "git/worktrees", "git/log", "git/commitShow", "workspace/readFile", "workspace/readImage", "workspace/list", "workspace/searchFiles", "workspace/resolveFileLink", "workspace/browseDirs", "workspace/checkpoint", "workspace/diffCheckpoint", "workspace/applyCheckpoint", "workspace/applyPatch", "workspace/exists", "project/list", "project/resolve", "agent/list", "agent/models", "agent/commands", "agent/usageStats", "metrics/get", "metrics/export", "metrics/import", "auth/status", "auth/login", "auth/logout", "notifications/register", "notifications/update", "notifications/unregister", "bridge/status", "bridge/generatePairingQr", "bridge/connectedPhones", "bridge/disconnectPhone", "bridge/trustedDevices", "bridge/removeTrustedDevice"];
6
+ export declare const METHOD_NAMES: readonly ["thread/list", "thread/read", "thread/start", "thread/resume", "thread/fork", "thread/setModel", "thread/rename", "thread/setAccessMode", "thread/archive", "thread/unarchive", "thread/delete", "turn/list", "turn/read", "turn/send", "turn/cancel", "queue/resume", "queue/clear", "git/status", "git/diff", "git/commit", "git/push", "git/pull", "git/checkout", "git/createBranch", "git/createWorktree", "git/stage", "git/unstage", "git/discard", "git/createPr", "git/undoCommit", "git/branches", "git/switchBranch", "git/revert", "git/deleteBranch", "git/removeWorktree", "git/worktrees", "git/log", "git/commitShow", "workspace/readFile", "workspace/readImage", "workspace/list", "workspace/searchFiles", "workspace/resolveFileLink", "workspace/browseDirs", "workspace/checkpoint", "workspace/diffCheckpoint", "workspace/applyCheckpoint", "workspace/applyPatch", "workspace/exists", "project/list", "project/resolve", "project/add", "project/remove", "project/rename", "sync/changes", "settings/get", "settings/set", "device/describe", "device/rename", "agent/list", "agent/models", "agent/commands", "agent/usageStats", "agent/doctor", "metrics/get", "metrics/export", "metrics/import", "auth/status", "auth/login", "auth/logout", "notifications/register", "notifications/update", "notifications/unregister", "bridge/status", "bridge/generatePairingQr", "bridge/connectedPhones", "bridge/disconnectPhone", "bridge/trustedDevices", "bridge/removeTrustedDevice", "desktop/attach", "desktop/detach"];
7
7
  export declare function isKnownMethod(method: string): method is JsonRpcMethodName;
@@ -55,11 +55,21 @@ export const METHOD_NAMES = [
55
55
  // Projects
56
56
  'project/list',
57
57
  'project/resolve',
58
+ 'project/add',
59
+ 'project/remove',
60
+ 'project/rename',
61
+ // Replica sync and shared settings
62
+ 'sync/changes',
63
+ 'settings/get',
64
+ 'settings/set',
65
+ 'device/describe',
66
+ 'device/rename',
58
67
  // Agents
59
68
  'agent/list',
60
69
  'agent/models',
61
70
  'agent/commands',
62
71
  'agent/usageStats',
72
+ 'agent/doctor',
63
73
  // Metrics (bridge-owned, survivable profile stats + tamper-proof backup)
64
74
  'metrics/get',
65
75
  'metrics/export',
@@ -79,6 +89,9 @@ export const METHOD_NAMES = [
79
89
  'bridge/disconnectPhone',
80
90
  'bridge/trustedDevices',
81
91
  'bridge/removeTrustedDevice',
92
+ // Desktop tools for bridge-run agents (local control channel only)
93
+ 'desktop/attach',
94
+ 'desktop/detach',
82
95
  ];
83
96
  const _assertNamesAreMethods = true;
84
97
  const _assertMethodsAreNames = true;
@@ -1 +1 @@
1
- {"version":3,"file":"method-registry.js","sourceRoot":"","sources":["../../../src/jsonrpc/method-registry.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,cAAc;IACd,eAAe;IACf,aAAa;IACb,iBAAiB;IACjB,eAAe;IACf,sBAAsB;IACtB,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;IACb,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,MAAM;IACN,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,UAAU;IACV,UAAU;IACV,cAAc;IACd,kBAAkB;IAClB,oBAAoB;IACpB,WAAW;IACX,aAAa;IACb,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,kBAAkB;IAClB,oBAAoB;IACpB,eAAe;IACf,SAAS;IACT,gBAAgB;IAChB,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,sBAAsB;IACtB,sBAAsB;IACtB,0BAA0B;IAC1B,2BAA2B;IAC3B,sBAAsB;IACtB,kBAAkB;IAClB,WAAW;IACX,cAAc;IACd,iBAAiB;IACjB,SAAS;IACT,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,yEAAyE;IACzE,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,OAAO;IACP,aAAa;IACb,YAAY;IACZ,aAAa;IACb,uBAAuB;IACvB,wBAAwB;IACxB,sBAAsB;IACtB,0BAA0B;IAC1B,iBAAiB;IACjB,eAAe;IACf,0BAA0B;IAC1B,wBAAwB;IACxB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;CACpB,CAAC;AAQX,MAAM,sBAAsB,GAAqB,IAAI,CAAC;AACtD,MAAM,sBAAsB,GAAqB,IAAI,CAAC;AACtD,KAAK,sBAAsB,CAAC;AAC5B,KAAK,sBAAsB,CAAC;AAE5B,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;AAEnE,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC"}
1
+ {"version":3,"file":"method-registry.js","sourceRoot":"","sources":["../../../src/jsonrpc/method-registry.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,cAAc;IACd,eAAe;IACf,aAAa;IACb,iBAAiB;IACjB,eAAe;IACf,sBAAsB;IACtB,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;IACb,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,MAAM;IACN,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,UAAU;IACV,UAAU;IACV,cAAc;IACd,kBAAkB;IAClB,oBAAoB;IACpB,WAAW;IACX,aAAa;IACb,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,kBAAkB;IAClB,oBAAoB;IACpB,eAAe;IACf,SAAS;IACT,gBAAgB;IAChB,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,gBAAgB;IAChB,uBAAuB;IACvB,2BAA2B;IAC3B,sBAAsB;IACtB,sBAAsB;IACtB,0BAA0B;IAC1B,2BAA2B;IAC3B,sBAAsB;IACtB,kBAAkB;IAClB,WAAW;IACX,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,mCAAmC;IACnC,cAAc;IACd,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,eAAe;IACf,SAAS;IACT,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,cAAc;IACd,yEAAyE;IACzE,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,OAAO;IACP,aAAa;IACb,YAAY;IACZ,aAAa;IACb,uBAAuB;IACvB,wBAAwB;IACxB,sBAAsB;IACtB,0BAA0B;IAC1B,iBAAiB;IACjB,eAAe;IACf,0BAA0B;IAC1B,wBAAwB;IACxB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,mEAAmE;IACnE,gBAAgB;IAChB,gBAAgB;CACR,CAAC;AAQX,MAAM,sBAAsB,GAAqB,IAAI,CAAC;AACtD,MAAM,sBAAsB,GAAqB,IAAI,CAAC;AACtD,KAAK,sBAAsB,CAAC;AAC5B,KAAK,sBAAsB,CAAC;AAE5B,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;AAEnE,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC"}
@@ -8,15 +8,17 @@
8
8
  import type { AccessMode, QueuePausedReason, Thread, ThreadList, Turn, TurnList } from '../models/thread.js';
9
9
  import type { GitBranchList, GitBranchResult, GitCommitDetails, GitCommitResult, GitCommitShowParams, GitDiff, GitLogParams, GitLogResult, GitPrResult, GitPullResult, GitPushResult, GitRepoStatus, GitWorktreeList, GitWorktreeResult } from '../models/git.js';
10
10
  import type { ApplyResult, BrowseResult, Checkpoint, CheckpointDiff, FileContent, ImageContent, PatchChange, TurnAttachment, WorkspaceFileTarget, WorkspaceExistsResult, WorkspaceListing, SearchFilesParams, WorkspaceSearchResult } from '../models/workspace.js';
11
- import type { AuthStatus, Project } from '../models/project.js';
11
+ import type { AuthStatus, Project, ProjectAddParams, ProjectRemoveParams, ProjectRemoveResult, ProjectRenameParams } from '../models/project.js';
12
+ import type { BridgeSettings, SettingsSetParams, SyncChanges, SyncChangesParams } from '../models/sync.js';
12
13
  import type { ApprovalResponse } from '../models/approval.js';
13
14
  import type { QuestionResponse } from '../models/question.js';
14
- import type { BridgeStatus, ConnectedPhone, TrustedDevice } from '../models/session.js';
15
+ import type { BridgeStatus, ConnectedPhone, DeviceDescribeParams, DeviceDescription, DeviceRenameParams, TrustedDevice } from '../models/session.js';
15
16
  import type { PairingPayload } from '../e2ee/pairing-payload.js';
16
- import type { AgentCommand, AgentCommandInvocation, AgentDescriptor, AgentId, AgentModel } from '../agents/agent-capabilities.js';
17
+ import type { AgentCommand, AgentCommandInvocation, AgentDescriptor, AgentDiagnosis, AgentId, AgentModel } from '../agents/agent-capabilities.js';
17
18
  import type { UsageStatsParams, UsageStatsResult } from '../models/usage.js';
18
19
  import type { MetricsExportParams, MetricsExportResult, MetricsImportParams, MetricsImportResult, MetricsSnapshot } from '../models/metrics.js';
19
20
  import type { PushPlatform } from '../notifications/push-payload.js';
21
+ import type { DesktopAttachParams, DesktopAttachResult } from '../local-control/local-control.js';
20
22
  export interface ListThreadsParams {
21
23
  projectId?: string;
22
24
  }
@@ -105,13 +107,40 @@ export interface TurnSendParams {
105
107
  * Ignored when no turn is in flight — the turn simply starts.
106
108
  */
107
109
  queue?: boolean;
110
+ /**
111
+ * An id the sending client chose for its optimistic bubble. The bridge
112
+ * echoes it on the `stream/turn/created` it broadcasts for this turn, so the
113
+ * sender recognizes its own message — which can arrive before this call's
114
+ * reply — and every other client draws it as a new one. Opaque to the
115
+ * bridge, never persisted; at most 128 characters.
116
+ */
117
+ clientTurnId?: string;
108
118
  }
109
119
  export interface ThreadSetModelParams {
110
120
  threadId: string;
111
121
  model: string;
112
122
  }
123
+ /**
124
+ * How long ago, in milliseconds by the client's own clock, the user took an
125
+ * action the client could not send at the time (it was offline) and sends now
126
+ * (architecture/02a §5.8.17). Absent for an action sent as it happens.
127
+ *
128
+ * The bridge dates the action `now - ageMs` and applies it only if nothing
129
+ * decided the same thing later — on another client, while this one was away:
130
+ * the latest decision wins, whoever made it. An age rather than a timestamp,
131
+ * so the phone's clock never has to agree with the PC's. At most a year.
132
+ */
133
+ export type ActionAgeMs = number;
134
+ /** `thread/archive`, `thread/unarchive`, `thread/delete`. */
135
+ export interface ThreadActionParams {
136
+ threadId: string;
137
+ /** See {@link ActionAgeMs}. A superseded delete keeps the conversation. */
138
+ ageMs?: ActionAgeMs;
139
+ }
113
140
  export interface ThreadRenameParams {
114
141
  threadId: string;
142
+ /** See {@link ActionAgeMs}. */
143
+ ageMs?: ActionAgeMs;
115
144
  /** New, non-empty title for the thread. */
116
145
  title: string;
117
146
  /**
@@ -371,21 +400,15 @@ export interface JsonRpcMethodRegistry {
371
400
  result: Thread;
372
401
  };
373
402
  'thread/archive': {
374
- params: {
375
- threadId: string;
376
- };
403
+ params: ThreadActionParams;
377
404
  result: Thread;
378
405
  };
379
406
  'thread/unarchive': {
380
- params: {
381
- threadId: string;
382
- };
407
+ params: ThreadActionParams;
383
408
  result: Thread;
384
409
  };
385
410
  'thread/delete': {
386
- params: {
387
- threadId: string;
388
- };
411
+ params: ThreadActionParams;
389
412
  result: void;
390
413
  };
391
414
  'turn/list': {
@@ -585,6 +608,38 @@ export interface JsonRpcMethodRegistry {
585
608
  };
586
609
  result: Project;
587
610
  };
611
+ 'project/add': {
612
+ params: ProjectAddParams;
613
+ result: Project;
614
+ };
615
+ 'project/remove': {
616
+ params: ProjectRemoveParams;
617
+ result: ProjectRemoveResult;
618
+ };
619
+ 'project/rename': {
620
+ params: ProjectRenameParams;
621
+ result: Project;
622
+ };
623
+ 'sync/changes': {
624
+ params: SyncChangesParams;
625
+ result: SyncChanges;
626
+ };
627
+ 'settings/get': {
628
+ params: void;
629
+ result: BridgeSettings;
630
+ };
631
+ 'settings/set': {
632
+ params: SettingsSetParams;
633
+ result: BridgeSettings;
634
+ };
635
+ 'device/describe': {
636
+ params: DeviceDescribeParams;
637
+ result: DeviceDescription;
638
+ };
639
+ 'device/rename': {
640
+ params: DeviceRenameParams;
641
+ result: TrustedDevice;
642
+ };
588
643
  'agent/list': {
589
644
  params: void;
590
645
  result: AgentListResult;
@@ -601,6 +656,12 @@ export interface JsonRpcMethodRegistry {
601
656
  params: UsageStatsParams;
602
657
  result: UsageStatsResult;
603
658
  };
659
+ 'agent/doctor': {
660
+ params: void;
661
+ result: {
662
+ agents: AgentDiagnosis[];
663
+ };
664
+ };
604
665
  'metrics/get': {
605
666
  params: void;
606
667
  result: MetricsSnapshot;
@@ -669,6 +730,14 @@ export interface JsonRpcMethodRegistry {
669
730
  };
670
731
  result: void;
671
732
  };
733
+ 'desktop/attach': {
734
+ params: DesktopAttachParams;
735
+ result: DesktopAttachResult;
736
+ };
737
+ 'desktop/detach': {
738
+ params: void;
739
+ result: DesktopAttachResult;
740
+ };
672
741
  }
673
742
  export type JsonRpcMethodName = keyof JsonRpcMethodRegistry;
674
743
  export type MethodParams<M extends JsonRpcMethodName> = JsonRpcMethodRegistry[M]['params'];