anyclaude-sdk 0.10.0 → 0.10.2
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 +9 -3
- package/dist/team/broadcast-mailbox.d.ts +14 -0
- package/dist/team/broadcast-mailbox.js +17 -0
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.js +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -214,9 +214,15 @@ query({ prompt, workspace, llm, team: true, mailbox })
|
|
|
214
214
|
// messages sent by one worker land in the addressed agent's inbox in another.
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
Uses the global `BroadcastChannel` by default
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
Uses the global `BroadcastChannel` by default. For durable cross-tab delivery
|
|
218
|
+
(IndexedDB/localStorage fallbacks, older browsers, Node) use the one-call helper
|
|
219
|
+
— it's backed by the bundled [`broadcast-channel`](https://www.npmjs.com/package/broadcast-channel)
|
|
220
|
+
package, lazy-imported so it stays out of bundles that don't use it:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
const mailbox = await BroadcastChannelMailbox.crossTab({ channelName: 'team', origin: 'planner' })
|
|
224
|
+
query({ prompt, workspace, llm, team: true, mailbox })
|
|
225
|
+
```
|
|
220
226
|
|
|
221
227
|
## Pluggable backends
|
|
222
228
|
|
|
@@ -27,6 +27,20 @@ export declare class BroadcastChannelMailbox extends Mailbox {
|
|
|
27
27
|
private readonly origin;
|
|
28
28
|
private closed;
|
|
29
29
|
constructor(opts?: BroadcastChannelMailboxOptions);
|
|
30
|
+
/**
|
|
31
|
+
* Cross-tab/cross-context mailbox in one call, backed by the bundled
|
|
32
|
+
* `broadcast-channel` package (durable across tabs via IndexedDB/localStorage
|
|
33
|
+
* fallbacks, and works in older browsers + Node). Async because the package
|
|
34
|
+
* is lazy-imported so it stays out of bundles that don't use it.
|
|
35
|
+
*
|
|
36
|
+
* const mb = await BroadcastChannelMailbox.crossTab({ channelName: 'team', origin: 'planner' })
|
|
37
|
+
* query({ prompt, workspace, llm, team: true, mailbox: mb })
|
|
38
|
+
*/
|
|
39
|
+
static crossTab(opts?: {
|
|
40
|
+
channelName?: string;
|
|
41
|
+
origin?: string;
|
|
42
|
+
channelOptions?: unknown;
|
|
43
|
+
}): Promise<BroadcastChannelMailbox>;
|
|
30
44
|
/** Send a message: append to the local replica and broadcast to peers. */
|
|
31
45
|
send(from: string, to: string, text: string): string;
|
|
32
46
|
/** Stop listening and release the channel. Safe to call more than once. */
|
|
@@ -63,6 +63,23 @@ export class BroadcastChannelMailbox extends Mailbox {
|
|
|
63
63
|
this.channel.onmessage = (ev) => handle(ev);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Cross-tab/cross-context mailbox in one call, backed by the bundled
|
|
68
|
+
* `broadcast-channel` package (durable across tabs via IndexedDB/localStorage
|
|
69
|
+
* fallbacks, and works in older browsers + Node). Async because the package
|
|
70
|
+
* is lazy-imported so it stays out of bundles that don't use it.
|
|
71
|
+
*
|
|
72
|
+
* const mb = await BroadcastChannelMailbox.crossTab({ channelName: 'team', origin: 'planner' })
|
|
73
|
+
* query({ prompt, workspace, llm, team: true, mailbox: mb })
|
|
74
|
+
*/
|
|
75
|
+
static async crossTab(opts = {}) {
|
|
76
|
+
const mod = (await import('broadcast-channel'));
|
|
77
|
+
const BC = mod.BroadcastChannel ?? mod.default?.BroadcastChannel;
|
|
78
|
+
if (!BC)
|
|
79
|
+
throw new Error('broadcast-channel package did not export BroadcastChannel');
|
|
80
|
+
const channel = new BC(opts.channelName ?? 'anyclaude-team', opts.channelOptions);
|
|
81
|
+
return new BroadcastChannelMailbox({ channel, origin: opts.origin });
|
|
82
|
+
}
|
|
66
83
|
/** Send a message: append to the local replica and broadcast to peers. */
|
|
67
84
|
send(from, to, text) {
|
|
68
85
|
// Globally-unique id: origin-scoped so two workers never collide.
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Bump on release so adoption can be bucketed by version. */
|
|
2
|
-
export declare const TELEMETRY_SDK_VERSION = "0.10.
|
|
2
|
+
export declare const TELEMETRY_SDK_VERSION = "0.10.2";
|
|
3
3
|
export interface TelemetryOptions {
|
|
4
4
|
/** Force-disable for this call (highest precedence besides the global opt-outs). */
|
|
5
5
|
disabled?: boolean;
|
package/dist/telemetry.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// See TELEMETRY.md for the full disclosure.
|
|
17
17
|
import { uuid } from './util/ids.js';
|
|
18
18
|
/** Bump on release so adoption can be bucketed by version. */
|
|
19
|
-
export const TELEMETRY_SDK_VERSION = '0.10.
|
|
19
|
+
export const TELEMETRY_SDK_VERSION = '0.10.2';
|
|
20
20
|
// Aggregate-only collector (Puter Worker; see examples/telemetry-collector).
|
|
21
21
|
// Override with `ANYCLAUDE_TELEMETRY_URL` / `telemetry: { url }`, or disable
|
|
22
22
|
// entirely with the opt-outs above. Set to '' to make telemetry a no-op.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anyclaude-sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Standalone, browser-compatible SDK providing Claude Code agent capabilities (tools, tool loop, multi-turn, MCP, sub-agents, sessions) against any OpenAI/Anthropic-compatible LLM endpoint. Runs in the browser (WebContainer), Node, and Bun — no backend required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -114,6 +114,10 @@
|
|
|
114
114
|
"bugs": {
|
|
115
115
|
"url": "https://github.com/pipilot-dev/anyclaude-sdk/issues"
|
|
116
116
|
},
|
|
117
|
+
"dependencies": {
|
|
118
|
+
"broadcast-channel": "^7.0.0",
|
|
119
|
+
"comlink": "^4.4.2"
|
|
120
|
+
},
|
|
117
121
|
"peerDependencies": {
|
|
118
122
|
"@cloudflare/sandbox": "*",
|
|
119
123
|
"@daytonaio/sdk": "*",
|
|
@@ -144,7 +148,6 @@
|
|
|
144
148
|
},
|
|
145
149
|
"devDependencies": {
|
|
146
150
|
"@types/node": "^26.0.0",
|
|
147
|
-
"comlink": "^4.4.2",
|
|
148
151
|
"dexie": "^4.4.4",
|
|
149
152
|
"typescript": "^5.4.0"
|
|
150
153
|
}
|