@1presence/bridge 0.4.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");
@@ -106,6 +107,17 @@ const config_1 = require("./config");
106
107
  // Track whether we've already announced the model this process — printing it
107
108
  // per-spawn is noisy; once on startup is what the user actually wants to see.
108
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
+ }
109
121
  // ─── Active processes ─────────────────────────────────────────────────────────
110
122
  const active = new Map();
111
123
  // ─── Spawn ────────────────────────────────────────────────────────────────────
@@ -241,6 +253,10 @@ function spawnClaude(params) {
241
253
  const toolName = block['name'];
242
254
  const prefix = toolName.startsWith('mcp__') ? '[mcp]' : '[tool]';
243
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
+ }
244
260
  // Defense-in-depth: CLI flags (--tools "", --allowedTools, --strict-mcp-config,
245
261
  // --setting-sources "") are supposed to make this unreachable. If we see a
246
262
  // non-1Presence tool here anyway, something has bypassed those guards — kill
@@ -267,6 +283,20 @@ function spawnClaude(params) {
267
283
  process.stderr.write('\n');
268
284
  }
269
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
+ }
270
300
  // Extract cost from the final result event
271
301
  if (type === 'result') {
272
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.4.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"