@1presence/bridge 0.66.0 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/config.js +24 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,27 @@ On first run, a browser window will open to sign in to your 1Presence account. Y
|
|
|
22
22
|
|
|
23
23
|
Once connected, your 1Presence app on any device automatically routes to your local Claude Code session. When you stop the bridge, 1Presence falls back to platform mode.
|
|
24
24
|
|
|
25
|
+
## Admin: running the bridge as another user
|
|
26
|
+
|
|
27
|
+
If your 1Presence account is an **admin**, the sign-in screen shows a user picker
|
|
28
|
+
instead of connecting immediately. Choose which 1Presence user this bridge runs
|
|
29
|
+
as — it defaults to **you** — and click Connect. Picking another user lets you
|
|
30
|
+
drive their account (their vault, connectors, and history) through your local
|
|
31
|
+
Claude Code, which is handy for onboarding testers who don't run the bridge
|
|
32
|
+
themselves. You never need their password; the picker mints a scoped token for
|
|
33
|
+
the selected user server-side.
|
|
34
|
+
|
|
35
|
+
The target user must have **Local Claude Code access** granted in the admin panel
|
|
36
|
+
(the same permission that gates your own bridge and also lets bridge turns run
|
|
37
|
+
free on your Claude subscription). The picker flags anyone who isn't eligible yet.
|
|
38
|
+
|
|
39
|
+
### Multiple sessions at once
|
|
40
|
+
|
|
41
|
+
Because every session is keyed by the connected user, you can run several bridges
|
|
42
|
+
side by side — each in its own terminal, each impersonating a **different** user —
|
|
43
|
+
and they won't interfere. Running two bridges for the *same* user at once is not
|
|
44
|
+
supported (the second displaces the first).
|
|
45
|
+
|
|
25
46
|
## How it works
|
|
26
47
|
|
|
27
48
|
The bridge connects outbound to the 1Presence gateway as a persistent WebSocket. When you send a message from the app, the gateway relays it to the bridge, which spawns a `claude` subprocess with your personal system prompt and all 1Presence tools (vault, Gmail, Drive, Calendar, MemPalace, and more) wired in via MCP. Responses stream back in real time.
|
package/dist/config.js
CHANGED
|
@@ -75,29 +75,37 @@ function detectClaudeDefaultModel() {
|
|
|
75
75
|
}
|
|
76
76
|
// The fixed menu — keep the option count small so the timeout default is easy
|
|
77
77
|
// to glance at. Option 1's `model: null` means "let Claude Code pick" (no
|
|
78
|
-
// `--model` flag passed to the subprocess).
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
78
|
+
// `--model` flag passed to the subprocess). This is the DYNAMIC default: it
|
|
79
|
+
// tracks whatever model Claude Code actually serves for the user's plan (the
|
|
80
|
+
// probe above surfaces it as a live suffix — on most accounts today that's the
|
|
81
|
+
// 1M-context Opus) and self-heals if a pinned id is ever unservable. The
|
|
82
|
+
// remaining rows pin explicit ids for users who want a specific model.
|
|
83
|
+
// `num` must stay contiguous 1..N in array order — the jump-key handler maps a
|
|
84
|
+
// typed digit `n` to `idx = n - 1`.
|
|
85
|
+
//
|
|
86
|
+
// NB there is no way to *enumerate* the models available on subscription auth:
|
|
87
|
+
// the `/v1/models` API needs an API key (the bridge strips ANTHROPIC_API_KEY —
|
|
88
|
+
// see claude.ts) and the CLI exposes only the single default via the init event.
|
|
89
|
+
// So this list is hand-maintained — add/remove ids here as the roster changes.
|
|
90
|
+
// (We dropped the standalone `claude-opus-4-8[1m]` row: it duplicated option 1,
|
|
91
|
+
// whose Claude Code default already resolves to the 1M Opus on subscription, and
|
|
92
|
+
// pinning `[1m]` risked a hard failure where the null default degrades gracefully.
|
|
93
|
+
// An earlier every-turn `400 / "unknown"` was once blamed on `[1m]` but was
|
|
94
|
+
// actually a tool-schema bug that hit every model — see vault/Bugs.md.)
|
|
87
95
|
const MODEL_OPTIONS = [
|
|
88
96
|
{ num: 1, model: null, label: 'Use Claude Code default' },
|
|
89
97
|
{ num: 2, model: 'claude-opus-4-8', label: 'claude-opus-4-8' },
|
|
90
|
-
{ num: 3, model: 'claude-opus-4-
|
|
91
|
-
{ num: 4, model: 'claude-
|
|
98
|
+
{ num: 3, model: 'claude-opus-4-7', label: 'claude-opus-4-7' },
|
|
99
|
+
{ num: 4, model: 'claude-fable-5', label: 'claude-fable-5' },
|
|
92
100
|
{ num: 5, model: 'claude-sonnet-4-6', label: 'claude-sonnet-4-6' },
|
|
93
101
|
{ num: 6, model: 'claude-haiku-4-5', label: 'claude-haiku-4-5' },
|
|
94
102
|
];
|
|
95
103
|
const PROMPT_TIMEOUT_MS = 10_000;
|
|
96
|
-
// Default to
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
const DEFAULT_OPTION_NUM =
|
|
104
|
+
// Default to option 1 ("Use Claude Code default") — the dynamic choice that
|
|
105
|
+
// follows whatever Claude Code serves for the user's plan (currently the 1M
|
|
106
|
+
// Opus on most accounts) and degrades gracefully rather than pinning a possibly
|
|
107
|
+
// unservable id. Users can arrow to a pinned model if they want one.
|
|
108
|
+
const DEFAULT_OPTION_NUM = 1;
|
|
101
109
|
function promptForModel(defaultModel) {
|
|
102
110
|
return new Promise((resolve) => {
|
|
103
111
|
const initialIdx = Math.max(0, MODEL_OPTIONS.findIndex((o) => o.num === DEFAULT_OPTION_NUM));
|