@1presence/bridge 0.1.15 → 0.1.17
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 +25 -1
- package/package.json +1 -2
package/dist/claude.js
CHANGED
|
@@ -66,7 +66,7 @@ function spawnClaude(params) {
|
|
|
66
66
|
process.stderr.write(`[bridge] model: ${model ?? 'unknown'} apiKeySource: ${keySource ?? 'none'}\n`);
|
|
67
67
|
sessionIdExtracted = true;
|
|
68
68
|
}
|
|
69
|
-
// Count complete assistant turns + accumulate token usage
|
|
69
|
+
// Count complete assistant turns + accumulate token usage + log tool calls
|
|
70
70
|
if (type === 'assistant') {
|
|
71
71
|
messageCount++;
|
|
72
72
|
const msg = event['message'];
|
|
@@ -77,6 +77,30 @@ function spawnClaude(params) {
|
|
|
77
77
|
output_tokens: (usage?.output_tokens ?? 0) + (u['output_tokens'] ?? 0),
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
+
const content = msg?.['content'];
|
|
81
|
+
if (Array.isArray(content)) {
|
|
82
|
+
let wroteText = false;
|
|
83
|
+
for (const block of content) {
|
|
84
|
+
if (block['type'] === 'tool_use') {
|
|
85
|
+
if (wroteText) {
|
|
86
|
+
process.stderr.write('\n');
|
|
87
|
+
wroteText = false;
|
|
88
|
+
}
|
|
89
|
+
const toolName = block['name'];
|
|
90
|
+
const prefix = toolName.startsWith('mcp__') ? '[mcp]' : '[tool]';
|
|
91
|
+
process.stderr.write(`[bridge] ${prefix} ${toolName}\n`);
|
|
92
|
+
}
|
|
93
|
+
else if (block['type'] === 'text') {
|
|
94
|
+
const text = block['text'];
|
|
95
|
+
if (text) {
|
|
96
|
+
process.stderr.write(text.replace(/\n+/g, ' '));
|
|
97
|
+
wroteText = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (wroteText)
|
|
102
|
+
process.stderr.write('\n');
|
|
103
|
+
}
|
|
80
104
|
}
|
|
81
105
|
// Extract cost from the final result event
|
|
82
106
|
if (type === 'result') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1presence/bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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"
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"prepublishOnly": "npm version patch --no-git-tag-version",
|
|
15
14
|
"prepack": "tsc",
|
|
16
15
|
"build": "tsc",
|
|
17
16
|
"dev": "tsx src/index.ts",
|