@1presence/bridge 0.3.0 → 0.5.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 CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setVerbose = setVerbose;
3
4
  exports.spawnClaude = spawnClaude;
4
5
  exports.killAll = killAll;
5
6
  const child_process_1 = require("child_process");
@@ -12,7 +13,7 @@ const sessions_1 = require("./sessions");
12
13
  // Claude Code always loads CLAUDE.md files from cwd upward plus the global
13
14
  // ~/.claude/CLAUDE.md. If the bridge is launched from within a development
14
15
  // repo (e.g. PresenceAI), it would pick up project CLAUDE.md instructions that
15
- // direct it to write to local vault paths and call MemPalace — both wrong in
16
+ // direct it to write to local vault paths and call mempalace — both wrong in
16
17
  // bridge/Local Mode. We run Claude in a dedicated temp dir with a LOCAL MODE
17
18
  // CLAUDE.md that explicitly overrides those behaviors.
18
19
  const BRIDGE_CWD = (0, path_1.join)((0, os_1.tmpdir)(), '1presence-bridge');
@@ -33,11 +34,20 @@ You have NO permission to write files to this machine.
33
34
  All vault reads and writes go through the \`mcp__1presence__*\` MCP tools.
34
35
  Use those tools instead of any local file paths.
35
36
 
36
- ## MemPalace / memory
37
+ ## Memory (memory map / knowledge graph / agent diary)
37
38
 
38
- MemPalace is hosted in the cloud, not locally. If mempalace tools are available
39
- via MCP, use them. If a mempalace call fails with "not initialised", skip it
40
- silently — do NOT attempt to write memory files locally as a fallback.
39
+ The user's memory is hosted in the cloud, not locally. If \`mempalace_*\` tools
40
+ are available via MCP, use them. If a call fails with "not initialised", skip
41
+ it silently — do NOT write memory files locally as a fallback.
42
+
43
+ **User-facing language.** Never say "MemPalace", "memory palace", "memory
44
+ graph", "ChromaDB", "vector database", "embeddings", or "drawer" to the user
45
+ in any context, even casually, even in progress/status updates. The internal
46
+ tool prefix is \`mempalace_\` but the product name does not exist to the user.
47
+ Use "memory map" (wings/rooms view), "knowledge graph" (facts view), "agent
48
+ diary" (session log), or "your memory" (general). Correct: "Indexed in your
49
+ memory map for semantic search." Wrong: "Indexed in MemPalace for semantic
50
+ search."
41
51
 
42
52
  ## Session notes / chat history
43
53
 
@@ -97,6 +107,17 @@ const config_1 = require("./config");
97
107
  // Track whether we've already announced the model this process — printing it
98
108
  // per-spawn is noisy; once on startup is what the user actually wants to see.
99
109
  let modelAnnounced = false;
110
+ // Verbose flag — when set via --verbose, log full tool inputs and outputs.
111
+ let verbose = false;
112
+ function setVerbose(v) { verbose = v; }
113
+ function formatPayload(value) {
114
+ try {
115
+ return JSON.stringify(value, null, 2);
116
+ }
117
+ catch {
118
+ return String(value);
119
+ }
120
+ }
100
121
  // ─── Active processes ─────────────────────────────────────────────────────────
101
122
  const active = new Map();
102
123
  // ─── Spawn ────────────────────────────────────────────────────────────────────
@@ -232,6 +253,10 @@ function spawnClaude(params) {
232
253
  const toolName = block['name'];
233
254
  const prefix = toolName.startsWith('mcp__') ? '[mcp]' : '[tool]';
234
255
  process.stderr.write(`[bridge] ${prefix} ${toolName}\n`);
256
+ if (verbose) {
257
+ const input = block['input'];
258
+ process.stderr.write(`[bridge:verbose] ─── input ${toolName} ───\n${formatPayload(input)}\n[bridge:verbose] ─── end input ───\n`);
259
+ }
235
260
  // Defense-in-depth: CLI flags (--tools "", --allowedTools, --strict-mcp-config,
236
261
  // --setting-sources "") are supposed to make this unreachable. If we see a
237
262
  // non-1Presence tool here anyway, something has bypassed those guards — kill
@@ -258,6 +283,20 @@ function spawnClaude(params) {
258
283
  process.stderr.write('\n');
259
284
  }
260
285
  }
286
+ // Tool results stream back as `user` events with tool_result blocks.
287
+ if (verbose && type === 'user') {
288
+ const msg = event['message'];
289
+ const content = msg?.['content'];
290
+ if (Array.isArray(content)) {
291
+ for (const block of content) {
292
+ if (block['type'] === 'tool_result') {
293
+ const id = block['tool_use_id'] ?? '';
294
+ const out = block['content'];
295
+ process.stderr.write(`[bridge:verbose] ─── output ${id} ───\n${formatPayload(out)}\n[bridge:verbose] ─── end output ───\n`);
296
+ }
297
+ }
298
+ }
299
+ }
261
300
  // Extract cost from the final result event
262
301
  if (type === 'result') {
263
302
  const c = event['cost_usd'] ?? event['total_cost_usd'];
package/dist/index.js CHANGED
@@ -13,6 +13,8 @@ const claude_1 = require("./claude");
13
13
  const config_1 = require("./config");
14
14
  const update_1 = require("./update");
15
15
  const package_json_1 = require("../package.json");
16
+ // ─── CLI args ─────────────────────────────────────────────────────────────────
17
+ const VERBOSE = process.argv.includes('--verbose') || process.argv.includes('-v');
16
18
  // ─── Config ───────────────────────────────────────────────────────────────────
17
19
  const GATEWAY_URL = process.env.BRIDGE_GATEWAY_URL ?? 'https://api.1presence.com';
18
20
  const GATEWAY_WS = GATEWAY_URL.replace(/^https?:/, 'wss:').replace(/\/$/, '') + '/bridge';
@@ -71,6 +73,11 @@ async function writeSetupFiles(auth) {
71
73
  ?? (await fetchVaultFile('CLAUDE.md', token))
72
74
  ?? '';
73
75
  (0, fs_1.writeFileSync)(tmpFile(`agent-${uid}.md`), systemPrompt, 'utf-8');
76
+ if (VERBOSE) {
77
+ console.log('\n[bridge:verbose] ─── system prompt ───────────────────────');
78
+ console.log(systemPrompt);
79
+ console.log('[bridge:verbose] ─── end system prompt ───────────────────\n');
80
+ }
74
81
  // MCP config pointing at gateway's /mcp endpoint (proxied to agent-api)
75
82
  const mcpConfig = {
76
83
  mcpServers: {
@@ -265,6 +272,10 @@ function connect(auth, retryDelay = 1000) {
265
272
  // ─── Main ─────────────────────────────────────────────────────────────────────
266
273
  async function main() {
267
274
  console.log(`1Presence Bridge v${package_json_1.version}\n`);
275
+ if (VERBOSE) {
276
+ (0, claude_1.setVerbose)(true);
277
+ console.log('[bridge:verbose] verbose logging enabled — system prompts, tool inputs, and tool outputs will be printed.\n');
278
+ }
268
279
  if (await (0, update_1.checkAndUpdate)())
269
280
  return;
270
281
  // Auth
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1presence/bridge",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Run 1Presence on your Mac and use your Claude.ai Pro subscription from any device",
5
5
  "bin": {
6
6
  "1presence-bridge": "dist/index.js"