@1presence/bridge 0.25.0 → 0.26.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/dist/claude.js +19 -15
- package/package.json +1 -1
package/dist/claude.js
CHANGED
|
@@ -70,14 +70,17 @@ function spawnClaude(params) {
|
|
|
70
70
|
existing.kill('SIGTERM');
|
|
71
71
|
active.delete(conversationId);
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
// Note: ephemeral context (vault_file_open / client_capabilities / synced_folders)
|
|
74
|
+
// is injected into the last user message by the gateway BEFORE history is
|
|
75
|
+
// sent over the WS. The bridge no longer constructs `userMessageText` —
|
|
76
|
+
// `history` is the authoritative stream and already contains the new user
|
|
77
|
+
// prompt with prefix prepended. The `text`, `vaultFileOpen`,
|
|
78
|
+
// `clientCapabilities`, `syncedFolders` SpawnParams are retained for
|
|
79
|
+
// backward-compatible logging / spool correlation only.
|
|
80
|
+
void vaultFileOpen;
|
|
81
|
+
void clientCapabilities;
|
|
82
|
+
void syncedFolders;
|
|
83
|
+
void text;
|
|
81
84
|
// Lockdown rationale:
|
|
82
85
|
// - `--tools ""` disables ALL built-in tools (Bash/Read/Write/Edit/Glob/Grep/
|
|
83
86
|
// WebFetch/etc.). MCP tools are not "built-in" so the 1Presence MCP surface
|
|
@@ -130,11 +133,14 @@ function spawnClaude(params) {
|
|
|
130
133
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
131
134
|
});
|
|
132
135
|
active.set(conversationId, proc);
|
|
133
|
-
// Feed
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
//
|
|
136
|
+
// Feed the full conversation via stdin as stream-json. The gateway's
|
|
137
|
+
// early-save committed the new user message to Firestore BEFORE building
|
|
138
|
+
// `history`, so `history` already ends with the new user prompt (with the
|
|
139
|
+
// ephemeral context prefix prepended by the gateway). The bridge no longer
|
|
140
|
+
// appends a separate `newTurn` — doing so would duplicate the user prompt.
|
|
141
|
+
// Sanitisation (orphan tool_use stripping, displayOnly filtering, consecutive
|
|
142
|
+
// same-role merging) already happened on the gateway via
|
|
143
|
+
// @presence/shared.toModelMessages — replay the history verbatim.
|
|
138
144
|
try {
|
|
139
145
|
const stdin = proc.stdin;
|
|
140
146
|
if (!stdin) {
|
|
@@ -144,8 +150,6 @@ function spawnClaude(params) {
|
|
|
144
150
|
const wrapped = { type: msg.role, message: { role: msg.role, content: msg.content } };
|
|
145
151
|
stdin.write(JSON.stringify(wrapped) + '\n');
|
|
146
152
|
}
|
|
147
|
-
const newTurn = { type: 'user', message: { role: 'user', content: userMessageText } };
|
|
148
|
-
stdin.write(JSON.stringify(newTurn) + '\n');
|
|
149
153
|
stdin.end();
|
|
150
154
|
}
|
|
151
155
|
catch (err) {
|