@uxnan/shared 0.0.11-alpha.20260729 → 0.0.13-alpha.20260804
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 +4 -4
- package/dist/src/agents/agent-adapter.d.ts +49 -0
- package/dist/src/agents/agent-capabilities.d.ts +27 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- 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 +29 -1
- package/dist/src/jsonrpc/notifications.d.ts +39 -1
- package/dist/src/jsonrpc/notifications.js +7 -0
- package/dist/src/jsonrpc/notifications.js.map +1 -1
- package/dist/src/models/assistant-response.d.ts +16 -0
- package/dist/src/models/assistant-response.js +2 -0
- package/dist/src/models/assistant-response.js.map +1 -0
- package/dist/src/models/compaction.d.ts +15 -0
- package/dist/src/models/compaction.js +2 -0
- package/dist/src/models/compaction.js.map +1 -0
- package/dist/src/models/session.d.ts +12 -0
- package/dist/src/models/thread.d.ts +29 -1
- package/dist/src/models/usage.d.ts +3 -1
- package/dist/src/models/workspace.d.ts +12 -0
- 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 — **69 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
|
|
@@ -52,8 +52,8 @@ flowchart TB
|
|
|
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
53
|
| Streaming | `StreamNotification` enum + param types (`TurnStartedParams`, `MessageDeltaParams`, `ThinkingDeltaParams`, `ContentBlockParams`, `TurnCompletedParams`, `TurnUsage`, `TurnErrorParams`, `TurnAbortedParams`, `ModelResolvedParams`) |
|
|
54
54
|
| E2EE | handshake messages (`clientHello` / `serverHello` / `clientAuth` / `ready`), `buildHandshakeTranscript`, `SecureEnvelope`, `PairingPayload` v2 (`relay` optional + `hosts: string[]`) with `Base64(utf8(JSON))` QR encoding |
|
|
55
|
-
| Models | thread / turn / message (with `MessageContent` polymorphic blocks), 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
|
-
| 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`), `AgentConfig` (cwd, agentId, model, plus optional `binaryPath`/`extraArgs`) |
|
|
55
|
+
| 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
|
+
| 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`) |
|
|
57
57
|
| Version | `compareVersions` / `isNewerVersion` — dependency-free SemVer precedence (used by the bridge's npm update check) |
|
|
58
58
|
| Validation | Ajv validators for requests, responses, envelopes, pairing payload, push payloads |
|
|
59
59
|
|
|
@@ -62,6 +62,15 @@ export interface SendTurnOptions {
|
|
|
62
62
|
*/
|
|
63
63
|
command?: AgentCommandInvocation;
|
|
64
64
|
}
|
|
65
|
+
/** Input for {@link IAgentAdapter.generateTitle}. */
|
|
66
|
+
export interface GenerateTitleOptions {
|
|
67
|
+
/** The user's opening message. */
|
|
68
|
+
userText: string;
|
|
69
|
+
/** The agent's reply to it, when there is one (trimmed by the caller). */
|
|
70
|
+
assistantText?: string;
|
|
71
|
+
/** Working directory to run the one-shot in (the thread's own). */
|
|
72
|
+
cwd?: string;
|
|
73
|
+
}
|
|
65
74
|
export interface IAgentAdapter {
|
|
66
75
|
readonly agentId: AgentId;
|
|
67
76
|
readonly capabilities: AgentCapabilities;
|
|
@@ -73,6 +82,46 @@ export interface IAgentAdapter {
|
|
|
73
82
|
sendTurn(options: SendTurnOptions): Promise<void>;
|
|
74
83
|
/** Cancel an in-flight turn. */
|
|
75
84
|
cancelTurn(threadId: string, turnId: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Name a conversation from its opening exchange — a handful of words, no
|
|
87
|
+
* punctuation, in the language the user wrote in.
|
|
88
|
+
*
|
|
89
|
+
* **This is a side errand, not a turn.** Implementations run a fresh one-shot
|
|
90
|
+
* with **no session id**, so nothing lands in the thread's history, no
|
|
91
|
+
* streaming event is emitted, and the agent's own context is untouched. It is
|
|
92
|
+
* also expected to use the agent's *cheapest* model rather than the one the
|
|
93
|
+
* conversation runs on: naming is a trivial task and should never spend the
|
|
94
|
+
* expensive model's quota.
|
|
95
|
+
*
|
|
96
|
+
* Optional — an adapter that cannot do it cheaply simply omits it, and the
|
|
97
|
+
* thread keeps the provisional title derived from the opening message.
|
|
98
|
+
*
|
|
99
|
+
* Returns the bare title, or `undefined` when the agent produced nothing
|
|
100
|
+
* usable. **Never throws for an ordinary failure** (no credit, CLI missing,
|
|
101
|
+
* a timeout): titling is cosmetic and must not disturb a working thread.
|
|
102
|
+
*/
|
|
103
|
+
generateTitle?(options: GenerateTitleOptions): Promise<string | undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* Hand a follow-up to the agent **inside the turn already running** — what a
|
|
106
|
+
* CLI does when you type while it works and it picks the message up at the
|
|
107
|
+
* next tool boundary. Implemented only by adapters whose CLI has an input
|
|
108
|
+
* channel mid-turn; those advertise `AgentCapabilities.steering`.
|
|
109
|
+
*
|
|
110
|
+
* `activeTurnId` is the bridge turn currently in flight on the thread, so the
|
|
111
|
+
* adapter can address the right run (and refuse if it has already moved on).
|
|
112
|
+
* `turnId` is the queued turn the text came from — it does NOT start a run of
|
|
113
|
+
* its own; it exists so the bridge can mark it `delivered`.
|
|
114
|
+
*
|
|
115
|
+
* Returns **true only when the agent actually took the message**. Return
|
|
116
|
+
* `false` (don't throw) for an ordinary "too late / not applicable" — the
|
|
117
|
+
* turn ended between the check and the call, the protocol rejected the
|
|
118
|
+
* hand-off. The bridge then leaves the turn queued and it runs normally next,
|
|
119
|
+
* so a refusal costs the user nothing but a wait. Throwing is for a broken
|
|
120
|
+
* transport, and is handled the same way.
|
|
121
|
+
*/
|
|
122
|
+
steerTurn?(options: SendTurnOptions & {
|
|
123
|
+
activeTurnId: string;
|
|
124
|
+
}): Promise<boolean>;
|
|
76
125
|
/**
|
|
77
126
|
* Reply to a pending approval the agent emitted (as an `approval` content
|
|
78
127
|
* block) for {@link threadId}. Optional: adapters that never request approval
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Source: architecture/02a-system-architecture.md §5.8.2 (adapters).
|
|
5
5
|
*/
|
|
6
|
-
export type AgentId = 'codex' | 'opencode' | 'claude-code'
|
|
6
|
+
export type AgentId = 'codex' | 'opencode' | 'claude-code'
|
|
7
|
+
/** @deprecated The standalone Gemini CLI is retired; use `antigravity-cli`. */
|
|
8
|
+
| 'gemini-cli'
|
|
7
9
|
/** Antigravity — Google's `agy` CLI, the successor to the deprecated Gemini CLI. */
|
|
8
10
|
| 'antigravity-cli' | 'pi-agent'
|
|
9
11
|
/** Zero — open-source Go coding agent, driven over the Agent Client Protocol. */
|
|
@@ -30,6 +32,12 @@ export interface AgentCapabilities {
|
|
|
30
32
|
* OpenCode) and the meter stays hidden.
|
|
31
33
|
*/
|
|
32
34
|
reportsContextUsage?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Agent emits a structured `compaction` content block when it actually
|
|
37
|
+
* compacts the conversation context. Optional for backwards compatibility;
|
|
38
|
+
* absent/false means the integration exposes no reliable compaction signal.
|
|
39
|
+
*/
|
|
40
|
+
reportsCompaction?: boolean;
|
|
33
41
|
/**
|
|
34
42
|
* Agent runs in autonomous ("YOLO") mode by default — it acts and edits
|
|
35
43
|
* without per-action approval prompts because its headless CLI exposes no
|
|
@@ -45,6 +53,19 @@ export interface AgentCapabilities {
|
|
|
45
53
|
* only its client-side `/` palette). See {@link AgentCommand}.
|
|
46
54
|
*/
|
|
47
55
|
commands?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Agent can take a follow-up **into the turn already running** instead of
|
|
58
|
+
* making it wait for the next one — what a CLI does when you type while it
|
|
59
|
+
* works and it picks the message up at the next tool boundary. The bridge
|
|
60
|
+
* hands such a turn straight to the adapter (`IAgentAdapter.steerTurn`)
|
|
61
|
+
* rather than holding it, and marks it `delivered` (see `TurnStatus`).
|
|
62
|
+
*
|
|
63
|
+
* Optional; absent/false means the agent has no input channel mid-turn (a
|
|
64
|
+
* one-shot CLI, or a protocol that serializes prompts per session), and its
|
|
65
|
+
* follow-ups keep waiting for the current turn to end. The phone reads this
|
|
66
|
+
* to tell the user which of the two is about to happen.
|
|
67
|
+
*/
|
|
68
|
+
steering?: boolean;
|
|
48
69
|
}
|
|
49
70
|
/**
|
|
50
71
|
* A registered agent the phone can pick for a thread, returned by `agent/list`.
|
|
@@ -55,6 +76,11 @@ export interface AgentDescriptor {
|
|
|
55
76
|
displayName: string;
|
|
56
77
|
/** Whether the agent's CLI/runtime is resolvable on this PC right now. */
|
|
57
78
|
available: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The adapter is retained only for legacy installations and MUST NOT be
|
|
81
|
+
* offered for new work. Deprecated agents are also reported unavailable.
|
|
82
|
+
*/
|
|
83
|
+
deprecated?: boolean;
|
|
58
84
|
capabilities: AgentCapabilities;
|
|
59
85
|
/** Default model the bridge will use when the phone does not pick one. */
|
|
60
86
|
defaultModel?: string;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export * from './models/project.js';
|
|
|
23
23
|
export * from './models/session.js';
|
|
24
24
|
export * from './models/approval.js';
|
|
25
25
|
export * from './models/question.js';
|
|
26
|
+
export * from './models/compaction.js';
|
|
27
|
+
export * from './models/assistant-response.js';
|
|
26
28
|
export * from './models/usage.js';
|
|
27
29
|
export * from './models/metrics.js';
|
|
28
30
|
export * from './validators/validate.js';
|
package/dist/src/index.js
CHANGED
|
@@ -29,6 +29,8 @@ export * from './models/project.js';
|
|
|
29
29
|
export * from './models/session.js';
|
|
30
30
|
export * from './models/approval.js';
|
|
31
31
|
export * from './models/question.js';
|
|
32
|
+
export * from './models/compaction.js';
|
|
33
|
+
export * from './models/assistant-response.js';
|
|
32
34
|
export * from './models/usage.js';
|
|
33
35
|
export * from './models/metrics.js';
|
|
34
36
|
// Validators
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,gBAAgB,CAAC;AAE/B,WAAW;AACX,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,OAAO;AACP,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAE1C,SAAS;AACT,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAE1C,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,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAEpC,aAAa;AACb,cAAc,0BAA0B,CAAC;AACzC,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,gBAAgB,CAAC;AAE/B,WAAW;AACX,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,OAAO;AACP,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAE1C,SAAS;AACT,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAE1C,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,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,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/log", "git/commitShow", "workspace/readFile", "workspace/readImage", "workspace/list", "workspace/searchFiles", "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/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,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,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"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
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, GitWorktreeResult } from '../models/git.js';
|
|
10
|
-
import type { ApplyResult, BrowseResult, Checkpoint, CheckpointDiff, FileContent, ImageContent, PatchChange, TurnAttachment, WorkspaceExistsResult, WorkspaceListing, SearchFilesParams, WorkspaceSearchResult } from '../models/workspace.js';
|
|
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';
|
|
13
13
|
import type { QuestionResponse } from '../models/question.js';
|
|
@@ -114,6 +114,16 @@ export interface ThreadRenameParams {
|
|
|
114
114
|
threadId: string;
|
|
115
115
|
/** New, non-empty title for the thread. */
|
|
116
116
|
title: string;
|
|
117
|
+
/**
|
|
118
|
+
* Who is naming it. **Absent means the user did** — the safe default, since
|
|
119
|
+
* `thread/rename` is the hand-rename call and a name the user chose is final.
|
|
120
|
+
*
|
|
121
|
+
* A client that auto-names a new thread from its opening message MUST send
|
|
122
|
+
* `'prompt'`; otherwise its throwaway title is recorded as the user's choice
|
|
123
|
+
* and the real generated title is refused later. `'agent'` is not accepted
|
|
124
|
+
* here — the bridge writes those itself when it generates one.
|
|
125
|
+
*/
|
|
126
|
+
source?: 'prompt' | 'user';
|
|
117
127
|
}
|
|
118
128
|
export interface ThreadSetAccessModeParams {
|
|
119
129
|
threadId: string;
|
|
@@ -130,6 +140,17 @@ export interface TurnSendResult {
|
|
|
130
140
|
queued?: boolean;
|
|
131
141
|
/** 1-based place in the queue when `queued` is true (1 = runs next). */
|
|
132
142
|
queuePosition?: number;
|
|
143
|
+
/**
|
|
144
|
+
* True when the agent took the message **into the turn already running**
|
|
145
|
+
* rather than making it wait (status `delivered`, see `TurnStatus`). It will
|
|
146
|
+
* never run as a turn of its own — the reply belongs to the turn it joined —
|
|
147
|
+
* so the client renders the user's message in place and stops offering to
|
|
148
|
+
* edit or cancel it. Mutually exclusive with {@link queued}.
|
|
149
|
+
*
|
|
150
|
+
* Only ever true when the agent advertises `AgentCapabilities.steering`; on
|
|
151
|
+
* every other agent a follow-up still comes back `queued`.
|
|
152
|
+
*/
|
|
153
|
+
delivered?: boolean;
|
|
133
154
|
}
|
|
134
155
|
export interface QueueStateResult {
|
|
135
156
|
/** Queued turn ids in drain order. */
|
|
@@ -496,6 +517,13 @@ export interface JsonRpcMethodRegistry {
|
|
|
496
517
|
params: SearchFilesParams;
|
|
497
518
|
result: WorkspaceSearchResult;
|
|
498
519
|
};
|
|
520
|
+
'workspace/resolveFileLink': {
|
|
521
|
+
params: {
|
|
522
|
+
cwd: string;
|
|
523
|
+
href: string;
|
|
524
|
+
};
|
|
525
|
+
result: WorkspaceFileTarget;
|
|
526
|
+
};
|
|
499
527
|
'workspace/browseDirs': {
|
|
500
528
|
params: BrowseDirsParams;
|
|
501
529
|
result: BrowseResult;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Source: architecture/02b-contracts-and-requirements.md (streaming events).
|
|
5
5
|
*/
|
|
6
|
-
import type { QueuePausedReason } from '../models/thread.js';
|
|
6
|
+
import type { QueuePausedReason, ThreadTitleSource } from '../models/thread.js';
|
|
7
7
|
export declare const StreamNotification: {
|
|
8
8
|
readonly TurnStarted: "stream/turn/started";
|
|
9
9
|
readonly MessageDelta: "stream/message/delta";
|
|
@@ -16,10 +16,17 @@ export declare const StreamNotification: {
|
|
|
16
16
|
readonly TurnAborted: "stream/turn/aborted";
|
|
17
17
|
/** A queued turn was removed before it ever ran (status → `cancelled`). */
|
|
18
18
|
readonly TurnCancelled: "stream/turn/cancelled";
|
|
19
|
+
/**
|
|
20
|
+
* A queued turn was handed to the agent **inside the turn already running**
|
|
21
|
+
* instead of waiting for it (status → `delivered`).
|
|
22
|
+
*/
|
|
23
|
+
readonly TurnDelivered: "stream/turn/delivered";
|
|
19
24
|
/** The thread's message queue changed (queued, drained, cancelled, paused). */
|
|
20
25
|
readonly QueueUpdated: "stream/queue/updated";
|
|
21
26
|
/** The agent resolved an alias (e.g. `opus`) to a concrete model id for this turn. */
|
|
22
27
|
readonly ModelResolved: "stream/model/resolved";
|
|
28
|
+
/** A thread's title changed on the bridge (a generated title, or another device's rename). */
|
|
29
|
+
readonly ThreadRenamed: "stream/thread/renamed";
|
|
23
30
|
};
|
|
24
31
|
export type StreamNotification = (typeof StreamNotification)[keyof typeof StreamNotification];
|
|
25
32
|
export interface TurnStartedParams {
|
|
@@ -103,6 +110,22 @@ export interface TurnCancelledParams {
|
|
|
103
110
|
threadId: string;
|
|
104
111
|
turnId: string;
|
|
105
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* A queued turn reached the agent **without waiting**: it was folded into the
|
|
115
|
+
* turn that was already running (its status is now `delivered`), the way a CLI
|
|
116
|
+
* picks up what you typed while it worked. It will never run as a turn of its
|
|
117
|
+
* own — the answer is part of `intoTurnId`.
|
|
118
|
+
*
|
|
119
|
+
* The client keeps the user's message where it is and stops offering to edit or
|
|
120
|
+
* cancel it: the agent already has it.
|
|
121
|
+
*/
|
|
122
|
+
export interface TurnDeliveredParams {
|
|
123
|
+
threadId: string;
|
|
124
|
+
/** The queued turn that was handed over. */
|
|
125
|
+
turnId: string;
|
|
126
|
+
/** The running turn it was folded into; its reply covers both messages. */
|
|
127
|
+
intoTurnId: string;
|
|
128
|
+
}
|
|
106
129
|
/**
|
|
107
130
|
* The thread's message queue changed. Carries the WHOLE state rather than a
|
|
108
131
|
* delta, so it is idempotent: a client that missed one (backgrounded, mid-
|
|
@@ -126,3 +149,18 @@ export interface ModelResolvedParams {
|
|
|
126
149
|
/** Concrete model id the agent resolved for this turn (e.g. `claude-opus-4-8`). */
|
|
127
150
|
model: string;
|
|
128
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* A thread's title changed **on the bridge**, so every client converges without
|
|
154
|
+
* refetching the list. Emitted when a generated title replaces the provisional
|
|
155
|
+
* one taken from the opening message, and when another device renames a thread.
|
|
156
|
+
*
|
|
157
|
+
* `titleSource` says how much to trust it: `user` is final, `agent` is the
|
|
158
|
+
* generated name, `prompt` the weak fallback. A client MUST NOT let an `agent`
|
|
159
|
+
* title overwrite a `user` one — the bridge already enforces that, and this
|
|
160
|
+
* field is what lets a client reason about it too.
|
|
161
|
+
*/
|
|
162
|
+
export interface ThreadRenamedParams {
|
|
163
|
+
threadId: string;
|
|
164
|
+
title: string;
|
|
165
|
+
titleSource: ThreadTitleSource;
|
|
166
|
+
}
|
|
@@ -10,9 +10,16 @@ export const StreamNotification = {
|
|
|
10
10
|
TurnAborted: 'stream/turn/aborted',
|
|
11
11
|
/** A queued turn was removed before it ever ran (status → `cancelled`). */
|
|
12
12
|
TurnCancelled: 'stream/turn/cancelled',
|
|
13
|
+
/**
|
|
14
|
+
* A queued turn was handed to the agent **inside the turn already running**
|
|
15
|
+
* instead of waiting for it (status → `delivered`).
|
|
16
|
+
*/
|
|
17
|
+
TurnDelivered: 'stream/turn/delivered',
|
|
13
18
|
/** The thread's message queue changed (queued, drained, cancelled, paused). */
|
|
14
19
|
QueueUpdated: 'stream/queue/updated',
|
|
15
20
|
/** The agent resolved an alias (e.g. `opus`) to a concrete model id for this turn. */
|
|
16
21
|
ModelResolved: 'stream/model/resolved',
|
|
22
|
+
/** A thread's title changed on the bridge (a generated title, or another device's rename). */
|
|
23
|
+
ThreadRenamed: 'stream/thread/renamed',
|
|
17
24
|
};
|
|
18
25
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/jsonrpc/notifications.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW,EAAE,qBAAqB;IAClC,YAAY,EAAE,sBAAsB;IACpC,kFAAkF;IAClF,aAAa,EAAE,uBAAuB;IACtC,mFAAmF;IACnF,YAAY,EAAE,sBAAsB;IACpC,aAAa,EAAE,uBAAuB;IACtC,SAAS,EAAE,mBAAmB;IAC9B,WAAW,EAAE,qBAAqB;IAClC,2EAA2E;IAC3E,aAAa,EAAE,uBAAuB;IACtC,+EAA+E;IAC/E,YAAY,EAAE,sBAAsB;IACpC,sFAAsF;IACtF,aAAa,EAAE,uBAAuB;CAC9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/jsonrpc/notifications.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW,EAAE,qBAAqB;IAClC,YAAY,EAAE,sBAAsB;IACpC,kFAAkF;IAClF,aAAa,EAAE,uBAAuB;IACtC,mFAAmF;IACnF,YAAY,EAAE,sBAAsB;IACpC,aAAa,EAAE,uBAAuB;IACtC,SAAS,EAAE,mBAAmB;IAC9B,WAAW,EAAE,qBAAqB;IAClC,2EAA2E;IAC3E,aAAa,EAAE,uBAAuB;IACtC;;;OAGG;IACH,aAAa,EAAE,uBAAuB;IACtC,+EAA+E;IAC/E,YAAY,EAAE,sBAAsB;IACpC,sFAAsF;IACtF,aAAa,EAAE,uBAAuB;IACtC,8FAA8F;IAC9F,aAAa,EAAE,uBAAuB;CAC9B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The role an assistant response item plays inside one agent turn. */
|
|
2
|
+
export type AssistantResponsePhase = 'commentary' | 'final_answer' | 'unknown';
|
|
3
|
+
/**
|
|
4
|
+
* Durable boundary between assistant response items produced during one turn.
|
|
5
|
+
*
|
|
6
|
+
* Some agent protocols (notably Codex app-server) emit multiple distinct
|
|
7
|
+
* assistant messages before the terminal answer. The prose remains ordinary
|
|
8
|
+
* `text` segments; this zero-text metadata block preserves the item boundary so
|
|
9
|
+
* clients can collapse earlier responses without deleting or flattening them.
|
|
10
|
+
*/
|
|
11
|
+
export interface AssistantResponseBoundaryBlock {
|
|
12
|
+
type: 'assistant_response_boundary';
|
|
13
|
+
phase?: AssistantResponsePhase;
|
|
14
|
+
/** Native item/message id, when the agent protocol exposes one. */
|
|
15
|
+
itemId?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-response.js","sourceRoot":"","sources":["../../../src/models/assistant-response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Why an agent compacted its conversation context, when it reports one. */
|
|
2
|
+
export type CompactionReason = 'manual' | 'threshold' | 'overflow' | 'automatic' | 'unknown';
|
|
3
|
+
/**
|
|
4
|
+
* A durable timeline marker emitted when the agent really compacted context.
|
|
5
|
+
* It travels as a `stream/content/block` and is persisted with the assistant
|
|
6
|
+
* message, so live rendering and `turn/list` reconciliation stay identical.
|
|
7
|
+
*/
|
|
8
|
+
export interface CompactionContentBlock {
|
|
9
|
+
type: 'compaction';
|
|
10
|
+
reason?: CompactionReason;
|
|
11
|
+
/** Context tokens immediately before compaction, when reported. */
|
|
12
|
+
tokensBefore?: number;
|
|
13
|
+
/** Estimated context tokens immediately after compaction, when reported. */
|
|
14
|
+
tokensAfter?: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction.js","sourceRoot":"","sources":["../../../src/models/compaction.ts"],"names":[],"mappings":""}
|
|
@@ -60,4 +60,16 @@ export interface BridgeFeatures {
|
|
|
60
60
|
* that bridge.
|
|
61
61
|
*/
|
|
62
62
|
messageQueue?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The bridge can hand a queued turn to the agent **inside the turn already
|
|
65
|
+
* running**, for agents whose CLI has an input channel mid-turn — it marks
|
|
66
|
+
* that turn `delivered` and emits `stream/turn/delivered`. Absent/false → the
|
|
67
|
+
* client must expect every follow-up to wait for the current turn to end, and
|
|
68
|
+
* must not promise otherwise in its UI.
|
|
69
|
+
*
|
|
70
|
+
* Distinct from {@link messageQueue}, which this builds on: the queue is where
|
|
71
|
+
* a follow-up lands, and per-agent `AgentCapabilities.steering` decides
|
|
72
|
+
* whether it waits there or goes straight through.
|
|
73
|
+
*/
|
|
74
|
+
midTurnDelivery?: boolean;
|
|
63
75
|
}
|
|
@@ -17,8 +17,14 @@ export type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
|
|
|
17
17
|
* thread (never deleted) so the user's message stays visible with a "cancelled"
|
|
18
18
|
* mark instead of silently vanishing; distinct from `aborted` precisely so a
|
|
19
19
|
* client can tell "never ran" from "interrupted".
|
|
20
|
+
* - `delivered` — it was QUEUED and the agent took it **into the turn already
|
|
21
|
+
* running** (see `AgentCapabilities.steering`), so it will never run as a turn
|
|
22
|
+
* of its own: the answer is part of the turn it was folded into
|
|
23
|
+
* (`deliveredIntoTurnId`). Terminal and successful — distinct from `cancelled`
|
|
24
|
+
* precisely because the message DID reach the agent; the user's bubble stays,
|
|
25
|
+
* with no assistant reply hanging off it.
|
|
20
26
|
*/
|
|
21
|
-
export type TurnStatus = 'queued' | 'pending' | 'streaming' | 'completed' | 'error' | 'aborted' | 'cancelled';
|
|
27
|
+
export type TurnStatus = 'queued' | 'pending' | 'streaming' | 'completed' | 'error' | 'aborted' | 'cancelled' | 'delivered';
|
|
22
28
|
export type ThreadStatus = 'active' | 'idle' | 'archived';
|
|
23
29
|
/**
|
|
24
30
|
* Why a thread's message queue is held instead of draining:
|
|
@@ -68,6 +74,12 @@ export interface Turn {
|
|
|
68
74
|
messages: Message[];
|
|
69
75
|
createdAt: number;
|
|
70
76
|
completedAt?: number;
|
|
77
|
+
/**
|
|
78
|
+
* For a `delivered` turn: the id of the turn its message was folded into.
|
|
79
|
+
* The reply lives there, so a client renders this turn's user message in
|
|
80
|
+
* place and expects no assistant message of its own. Absent otherwise.
|
|
81
|
+
*/
|
|
82
|
+
deliveredIntoTurnId?: string;
|
|
71
83
|
}
|
|
72
84
|
/**
|
|
73
85
|
* Per-thread access (approval) mode: how much the agent may do before it must
|
|
@@ -100,7 +112,23 @@ export interface Thread {
|
|
|
100
112
|
agentSessionId?: string;
|
|
101
113
|
/** Per-thread access (approval) mode; see {@link AccessMode}. */
|
|
102
114
|
accessMode?: AccessMode;
|
|
115
|
+
/**
|
|
116
|
+
* Where {@link title} came from, so a better title can replace a weaker one
|
|
117
|
+
* without ever overwriting a name the **user** chose.
|
|
118
|
+
*
|
|
119
|
+
* - `prompt` — provisional, derived from the opening message. Instant, and
|
|
120
|
+
* the weakest: two conversations that start with the same phrase collide.
|
|
121
|
+
* - `agent` — written by a model that read the first exchange. Replaces
|
|
122
|
+
* `prompt`, never `user`.
|
|
123
|
+
* - `user` — renamed by hand (`thread/rename`). Final; nothing overwrites it.
|
|
124
|
+
*
|
|
125
|
+
* Absent on threads stored before this existed; treat that as `prompt`, which
|
|
126
|
+
* is what they are.
|
|
127
|
+
*/
|
|
128
|
+
titleSource?: ThreadTitleSource;
|
|
103
129
|
}
|
|
130
|
+
/** Where a thread's title came from. See {@link Thread.titleSource}. */
|
|
131
|
+
export type ThreadTitleSource = 'prompt' | 'agent' | 'user';
|
|
104
132
|
export interface ThreadList {
|
|
105
133
|
threads: Thread[];
|
|
106
134
|
}
|
|
@@ -15,7 +15,9 @@
|
|
|
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'
|
|
18
|
+
export type UsageProvider = 'codex' | 'claude' | 'copilot'
|
|
19
|
+
/** @deprecated Legacy read-only usage source for retired Gemini CLI installs. */
|
|
20
|
+
| 'gemini' | 'grok';
|
|
19
21
|
/** Outcome of reading one provider's usage. */
|
|
20
22
|
export type UsageStatus =
|
|
21
23
|
/** Fresh quota/credit data was read. */
|
|
@@ -13,6 +13,18 @@ export interface ImageContent {
|
|
|
13
13
|
base64Data: string;
|
|
14
14
|
mimeType: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* A local file reference resolved by the bridge for the Mobile file viewer.
|
|
18
|
+
* `cwd + path` is directly consumable by the existing workspace read/image and
|
|
19
|
+
* git/diff methods, even when the file lives in a different worktree from the
|
|
20
|
+
* conversation that mentioned it.
|
|
21
|
+
*/
|
|
22
|
+
export interface WorkspaceFileTarget {
|
|
23
|
+
/** Absolute viewer root: the conversation cwd, containing git root, or file directory. */
|
|
24
|
+
cwd: string;
|
|
25
|
+
/** File path relative to {@link cwd}, always with POSIX separators. */
|
|
26
|
+
path: string;
|
|
27
|
+
}
|
|
16
28
|
/**
|
|
17
29
|
* An image (or other media) attached to a user turn (`turn/send { attachments }`).
|
|
18
30
|
* Tolerant by design — the phone sends inline base64 with the original
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxnan/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13-alpha.20260804",
|
|
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",
|