@uxnan/shared 0.0.14-alpha.20260810 → 0.0.16-alpha.20260919

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 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/69_methods_%7C_12_notifications-blue?style=for-the-badge)
6
+ ![Contracts](https://img.shields.io/badge/70_methods_%7C_12_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
@@ -223,7 +223,23 @@ export interface GitBranchParams {
223
223
  export interface GitWorktreeParams {
224
224
  cwd: string;
225
225
  branch: string;
226
- path: string;
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 {
@@ -56,10 +56,12 @@ export interface GitWorktreeResult {
56
56
  /**
57
57
  * One entry of `git worktree list --porcelain`.
58
58
  *
59
- * A repository's worktrees are siblings on disk, not children — a checkout of
60
- * `repo` at `../repo-feature` is a peer directory with no path relationship to
61
- * its main worktree. That is precisely why a client cannot infer the hierarchy
62
- * from paths alone and has to be told.
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.
63
65
  */
64
66
  export interface GitWorktreeEntry {
65
67
  /** Absolute path of the worktree. */
@@ -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
  }
@@ -11,8 +11,11 @@
11
11
  * over `agent/usageStats`. The Dart equivalents live in uxnanmobile and are kept
12
12
  * in sync manually (see 02e-bridge-integration.md §4.2).
13
13
  *
14
- * Posture: only the CLI's own stored token is read — never browser cookies or
15
- * user-pasted API keys.
14
+ * Posture: only the token the CLI itself stored is read — from its file, or
15
+ * from the OS credential store where that is where the CLI keeps it (Claude
16
+ * Code on macOS), and then only after the user has granted the OS-level
17
+ * permission once (see `accessRequired`). Never browser cookies, never
18
+ * user-pasted API keys, never a refresh token.
16
19
  */
17
20
  /** A coding CLI whose usage we read from its own stored token. */
18
21
  export type UsageProvider = 'codex' | 'claude' | 'copilot' | 'grok';
@@ -22,6 +25,11 @@ export type UsageStatus =
22
25
  'ok'
23
26
  /** CLI is present but not signed in (no usable token). */
24
27
  | 'authRequired'
28
+ /** The CLI's token exists in the OS credential store, but the OS has not yet
29
+ * authorized the reader to open it. The user grants that once from the
30
+ * desktop's Providers panel (the OS shows its own dialog); the reader never
31
+ * prompts on its own. A phone shows "grant access on the PC". */
32
+ | 'accessRequired'
25
33
  /** CLI / its config directory is not present on this machine. */
26
34
  | 'notInstalled'
27
35
  /** Read/network/parse failure — see {@link ProviderUsage.message}. */
@@ -121,7 +129,8 @@ export interface ProviderUsage {
121
129
  resetCredits?: ResetCredits;
122
130
  /** When this snapshot was produced (epoch ms). */
123
131
  updatedAt: number;
124
- /** Error/hint message for `error` / `authRequired` / `notInstalled` states. */
132
+ /** Error/hint message for `error` / `authRequired` / `accessRequired` /
133
+ * `notInstalled` states. */
125
134
  message?: string;
126
135
  }
127
136
  /**
@@ -11,8 +11,11 @@
11
11
  * over `agent/usageStats`. The Dart equivalents live in uxnanmobile and are kept
12
12
  * in sync manually (see 02e-bridge-integration.md §4.2).
13
13
  *
14
- * Posture: only the CLI's own stored token is read — never browser cookies or
15
- * user-pasted API keys.
14
+ * Posture: only the token the CLI itself stored is read — from its file, or
15
+ * from the OS credential store where that is where the CLI keeps it (Claude
16
+ * Code on macOS), and then only after the user has granted the OS-level
17
+ * permission once (see `accessRequired`). Never browser cookies, never
18
+ * user-pasted API keys, never a refresh token.
16
19
  */
17
20
  export {};
18
21
  //# sourceMappingURL=usage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/models/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/models/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxnan/shared",
3
- "version": "0.0.14-alpha.20260810",
3
+ "version": "0.0.16-alpha.20260919",
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",