@uxnan/shared 0.0.13-alpha.20260804 → 0.0.15-alpha.20260813
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 +2 -2
- package/dist/src/agents/agent-adapter.d.ts +2 -2
- package/dist/src/agents/agent-capabilities.d.ts +2 -4
- package/dist/src/jsonrpc/method-registry.d.ts +1 -1
- package/dist/src/jsonrpc/method-registry.js +1 -0
- package/dist/src/jsonrpc/method-registry.js.map +1 -1
- package/dist/src/jsonrpc/methods.d.ts +27 -4
- package/dist/src/models/git.d.ts +24 -0
- package/dist/src/models/session.d.ts +13 -0
- package/dist/src/models/usage.d.ts +1 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|

|
|
6
|
-

|
|
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 — **
|
|
16
|
+
> **Status:** implemented and stable — **70 JSON-RPC methods** + **12 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
|
|
@@ -163,7 +163,7 @@ export interface IAgentAdapter {
|
|
|
163
163
|
* reachable headless plus user-defined prompt-template commands scanned from
|
|
164
164
|
* disk (optional; adapters with none simply don't implement it). `cwd` is the
|
|
165
165
|
* thread/project directory so project-scoped custom commands (`<cwd>/.claude/
|
|
166
|
-
* commands`, `<cwd>/.
|
|
166
|
+
* commands`, `<cwd>/.opencode/command`, …) are discovered alongside user-level
|
|
167
167
|
* ones. Discovery only; invocation flows through {@link sendTurn} with {@link
|
|
168
168
|
* SendTurnOptions.command}.
|
|
169
169
|
*/
|
|
@@ -172,7 +172,7 @@ export interface IAgentAdapter {
|
|
|
172
172
|
* Resolve a custom prompt-template command to the final prompt text (reads the
|
|
173
173
|
* template file from `cwd`/user config, substitutes arguments). Implemented
|
|
174
174
|
* only by adapters whose commands are prompt templates the bridge expands
|
|
175
|
-
* itself (Codex/
|
|
175
|
+
* itself (Codex/OpenCode); adapters whose commands run natively (Claude
|
|
176
176
|
* Code, ACP agents) leave it unset and receive the composed `/name args` form
|
|
177
177
|
* as {@link SendTurnOptions.text}. Throw if `name` is not a known custom command.
|
|
178
178
|
*/
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* Source: architecture/02a-system-architecture.md §5.8.2 (adapters).
|
|
5
5
|
*/
|
|
6
6
|
export type AgentId = 'codex' | 'opencode' | 'claude-code'
|
|
7
|
-
/**
|
|
8
|
-
| 'gemini-cli'
|
|
9
|
-
/** Antigravity — Google's `agy` CLI, the successor to the deprecated Gemini CLI. */
|
|
7
|
+
/** Antigravity — Google's supported `agy` CLI. */
|
|
10
8
|
| 'antigravity-cli' | 'pi-agent'
|
|
11
9
|
/** Zero — open-source Go coding agent, driven over the Agent Client Protocol. */
|
|
12
10
|
| 'zero'
|
|
@@ -168,7 +166,7 @@ export interface AgentModel {
|
|
|
168
166
|
* (Claude Code's `/compact` sent as the prompt with `--resume`; the commands
|
|
169
167
|
* ACP agents advertise via `available_commands_update`), and
|
|
170
168
|
* - **custom** user-defined prompt-template commands (`.claude/commands`,
|
|
171
|
-
* `~/.codex/prompts`, `.
|
|
169
|
+
* `~/.codex/prompts`, `.opencode/command`) that the bridge
|
|
172
170
|
* expands itself before running a normal turn.
|
|
173
171
|
*
|
|
174
172
|
* The phone is a generic renderer: it lists the advertised commands in its `/`
|
|
@@ -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/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", "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"];
|
|
7
7
|
export declare function isKnownMethod(method: string): method is JsonRpcMethodName;
|
|
@@ -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,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,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"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* uxnandesktop/architecture/02e-bridge-integration.md §4.4.
|
|
7
7
|
*/
|
|
8
8
|
import type { AccessMode, QueuePausedReason, Thread, ThreadList, Turn, TurnList } from '../models/thread.js';
|
|
9
|
-
import type { GitBranchList, GitBranchResult, GitCommitDetails, GitCommitResult, GitCommitShowParams, GitDiff, GitLogParams, GitLogResult, GitPrResult, GitPullResult, GitPushResult, GitRepoStatus, GitWorktreeResult } from '../models/git.js';
|
|
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
11
|
import type { AuthStatus, Project } from '../models/project.js';
|
|
12
12
|
import type { ApprovalResponse } from '../models/approval.js';
|
|
@@ -99,7 +99,7 @@ export interface TurnSendParams {
|
|
|
99
99
|
* wants to handle the busy case itself).
|
|
100
100
|
* - absent — **queue it anyway**. Queueing is the safe default because the
|
|
101
101
|
* bridge can only drive ONE turn per thread: half the agents run one-shot
|
|
102
|
-
* per turn (`claude -p --resume`,
|
|
102
|
+
* per turn (`claude -p --resume`, pi, antigravity) and a second
|
|
103
103
|
* concurrent turn would put two CLI processes on the same session.
|
|
104
104
|
*
|
|
105
105
|
* Ignored when no turn is in flight — the turn simply starts.
|
|
@@ -223,7 +223,23 @@ export interface GitBranchParams {
|
|
|
223
223
|
export interface GitWorktreeParams {
|
|
224
224
|
cwd: string;
|
|
225
225
|
branch: string;
|
|
226
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Absolute directory for the new worktree. **Optional**: omit it (with
|
|
228
|
+
* {@link managed}) and the bridge resolves the location itself, from its
|
|
229
|
+
* `worktrees` config — by default the managed root
|
|
230
|
+
* `<home>/uxnan/worktrees/<repo>/<branch>`, the same layout the desktop uses,
|
|
231
|
+
* so both apps group one repository's checkouts in one place.
|
|
232
|
+
*
|
|
233
|
+
* A bridge that does not advertise `features.managedWorktrees` still
|
|
234
|
+
* **requires** this, so a client that wants to work against an older bridge
|
|
235
|
+
* has to keep deriving a path as its fallback.
|
|
236
|
+
*/
|
|
237
|
+
path?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Let the bridge own the location (the default when {@link path} is absent).
|
|
240
|
+
* A managed worktree is recorded in the bridge's registry, so the ones uxnan
|
|
241
|
+
* created can be told from the ones that were already there.
|
|
242
|
+
*/
|
|
227
243
|
managed?: boolean;
|
|
228
244
|
}
|
|
229
245
|
export interface GitRevertParams {
|
|
@@ -284,7 +300,7 @@ export interface AgentCommandsParams {
|
|
|
284
300
|
agentId: AgentId;
|
|
285
301
|
/**
|
|
286
302
|
* Thread/project directory, so project-scoped custom commands (e.g.
|
|
287
|
-
* `<cwd>/.claude/commands`, `<cwd>/.
|
|
303
|
+
* `<cwd>/.claude/commands`, `<cwd>/.opencode/command`) are discovered alongside
|
|
288
304
|
* the user-level ones. Omitted → only user-level commands are returned.
|
|
289
305
|
*/
|
|
290
306
|
cwd?: string;
|
|
@@ -485,6 +501,13 @@ export interface JsonRpcMethodRegistry {
|
|
|
485
501
|
params: GitRemoveWorktreeParams;
|
|
486
502
|
result: void;
|
|
487
503
|
};
|
|
504
|
+
/** Which directories are worktrees of the repository at `cwd`. */
|
|
505
|
+
'git/worktrees': {
|
|
506
|
+
params: {
|
|
507
|
+
cwd: string;
|
|
508
|
+
};
|
|
509
|
+
result: GitWorktreeList;
|
|
510
|
+
};
|
|
488
511
|
'git/log': {
|
|
489
512
|
params: GitLogParams;
|
|
490
513
|
result: GitLogResult;
|
package/dist/src/models/git.d.ts
CHANGED
|
@@ -53,6 +53,30 @@ export interface GitWorktreeResult {
|
|
|
53
53
|
path: string;
|
|
54
54
|
branch: string;
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* One entry of `git worktree list --porcelain`.
|
|
58
|
+
*
|
|
59
|
+
* A worktree can live anywhere: beside its repository (`../repo-feature`),
|
|
60
|
+
* grouped under the folder uxnan manages (`~/uxnan/worktrees/<repo>/<branch>`),
|
|
61
|
+
* or wherever the user put it. None of those spellings is a child of the main
|
|
62
|
+
* worktree, and the grouped one shares a prefix with worktrees of OTHER
|
|
63
|
+
* repositories — which is precisely why a client cannot infer the hierarchy
|
|
64
|
+
* from paths and has to be told.
|
|
65
|
+
*/
|
|
66
|
+
export interface GitWorktreeEntry {
|
|
67
|
+
/** Absolute path of the worktree. */
|
|
68
|
+
path: string;
|
|
69
|
+
/** Checked-out branch; absent when the worktree is in a detached HEAD. */
|
|
70
|
+
branch?: string;
|
|
71
|
+
/** Whether this is the repository's main worktree. */
|
|
72
|
+
isMain: boolean;
|
|
73
|
+
/** Whether `git worktree lock` has been applied to it. */
|
|
74
|
+
isLocked?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface GitWorktreeList {
|
|
77
|
+
/** The main worktree first, then the linked ones in git's own order. */
|
|
78
|
+
worktrees: GitWorktreeEntry[];
|
|
79
|
+
}
|
|
56
80
|
export interface GitBranchList {
|
|
57
81
|
/** The currently checked-out branch (`HEAD` when detached). */
|
|
58
82
|
current: string;
|
|
@@ -72,4 +72,17 @@ export interface BridgeFeatures {
|
|
|
72
72
|
* whether it waits there or goes straight through.
|
|
73
73
|
*/
|
|
74
74
|
midTurnDelivery?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The bridge resolves where a worktree goes on its own, so `git/createWorktree`
|
|
77
|
+
* accepts `managed: true` **without** a `path` and places it under the managed
|
|
78
|
+
* root (`<home>/uxnan/worktrees/<repo>/<branch>` by default) — the same layout
|
|
79
|
+
* the desktop uses, so one repository's checkouts stay grouped no matter which
|
|
80
|
+
* app created them.
|
|
81
|
+
*
|
|
82
|
+
* Absent/false → the bridge still **requires** `path`, and a client must keep
|
|
83
|
+
* deriving one itself. That fallback is worth keeping aligned with the
|
|
84
|
+
* desktop's spelling: the two derivations had already drifted into different
|
|
85
|
+
* folder names for the same repository and branch.
|
|
86
|
+
*/
|
|
87
|
+
managedWorktrees?: boolean;
|
|
75
88
|
}
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
* user-pasted API keys.
|
|
16
16
|
*/
|
|
17
17
|
/** A coding CLI whose usage we read from its own stored token. */
|
|
18
|
-
export type UsageProvider = 'codex' | 'claude' | 'copilot'
|
|
19
|
-
/** @deprecated Legacy read-only usage source for retired Gemini CLI installs. */
|
|
20
|
-
| 'gemini' | 'grok';
|
|
18
|
+
export type UsageProvider = 'codex' | 'claude' | 'copilot' | 'grok';
|
|
21
19
|
/** Outcome of reading one provider's usage. */
|
|
22
20
|
export type UsageStatus =
|
|
23
21
|
/** Fresh quota/credit data was read. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxnan/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15-alpha.20260813",
|
|
4
4
|
"description": "Shared JSON-RPC and E2EE contracts for the Uxnan ecosystem (bridge, relay, mobile).",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "Luis Donaldo Gamas Vazquez",
|