@famonfa/mono 0.0.0-stage → 0.3.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.
Files changed (64) hide show
  1. package/bin/mono.mjs +211 -0
  2. package/node_modules/@anthropic-ai/claude-agent-sdk/LICENSE.md +1 -0
  3. package/node_modules/@anthropic-ai/claude-agent-sdk/README.md +69 -0
  4. package/node_modules/@anthropic-ai/claude-agent-sdk/agentSdkTypes.d.ts +1 -0
  5. package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.d.ts +396 -0
  6. package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +142 -0
  7. package/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.d.ts +208 -0
  8. package/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +145 -0
  9. package/node_modules/@anthropic-ai/claude-agent-sdk/core-36zyfan5.mjs +52 -0
  10. package/node_modules/@anthropic-ai/claude-agent-sdk/core-5682eevd.mjs +27 -0
  11. package/node_modules/@anthropic-ai/claude-agent-sdk/core-nne0e2ds.mjs +40 -0
  12. package/node_modules/@anthropic-ai/claude-agent-sdk/core-xpxe8nzb.mjs +26 -0
  13. package/node_modules/@anthropic-ai/claude-agent-sdk/core.d.ts +22 -0
  14. package/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +34 -0
  15. package/node_modules/@anthropic-ai/claude-agent-sdk/extractFromBunfs.d.ts +1 -0
  16. package/node_modules/@anthropic-ai/claude-agent-sdk/extractFromBunfs.js +156 -0
  17. package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +82 -0
  18. package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +90 -0
  19. package/node_modules/@anthropic-ai/claude-agent-sdk/package.json +94 -0
  20. package/node_modules/@anthropic-ai/claude-agent-sdk/sdk-tools.d.ts +4222 -0
  21. package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts +10277 -0
  22. package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +169 -0
  23. package/node_modules/ws/LICENSE +20 -0
  24. package/node_modules/ws/README.md +548 -0
  25. package/node_modules/ws/browser.js +8 -0
  26. package/node_modules/ws/index.js +22 -0
  27. package/node_modules/ws/lib/buffer-util.js +131 -0
  28. package/node_modules/ws/lib/constants.js +19 -0
  29. package/node_modules/ws/lib/event-target.js +292 -0
  30. package/node_modules/ws/lib/extension.js +203 -0
  31. package/node_modules/ws/lib/limiter.js +55 -0
  32. package/node_modules/ws/lib/permessage-deflate.js +530 -0
  33. package/node_modules/ws/lib/receiver.js +743 -0
  34. package/node_modules/ws/lib/sender.js +607 -0
  35. package/node_modules/ws/lib/stream.js +161 -0
  36. package/node_modules/ws/lib/subprotocol.js +62 -0
  37. package/node_modules/ws/lib/validation.js +152 -0
  38. package/node_modules/ws/lib/websocket-server.js +562 -0
  39. package/node_modules/ws/lib/websocket.js +1421 -0
  40. package/node_modules/ws/package.json +74 -0
  41. package/node_modules/ws/wrapper.mjs +21 -0
  42. package/package.json +126 -3
  43. package/skills/workspace/SKILL.md +108 -0
  44. package/src/api.mjs +298 -0
  45. package/src/chats.mjs +446 -0
  46. package/src/commands.mjs +100 -0
  47. package/src/groups.mjs +84 -0
  48. package/src/launcher.mjs +276 -0
  49. package/src/main.mjs +42 -0
  50. package/src/paths.mjs +44 -0
  51. package/src/projects.mjs +199 -0
  52. package/src/refresh.mjs +124 -0
  53. package/src/remote.mjs +137 -0
  54. package/src/sessions.mjs +422 -0
  55. package/src/store.mjs +253 -0
  56. package/web/apple-touch-icon.png +0 -0
  57. package/web/assets/index-DGdmgZ2P.css +1 -0
  58. package/web/assets/index-TOP7citk.js +55 -0
  59. package/web/icon-192.png +0 -0
  60. package/web/icon-512.png +0 -0
  61. package/web/icon.svg +1 -0
  62. package/web/index.html +19 -0
  63. package/web/manifest.webmanifest +13 -0
  64. package/README.md +0 -3
@@ -0,0 +1,208 @@
1
+ /**
2
+ * API surface definition for @anthropic-ai/claude-agent-sdk/browser.
3
+ *
4
+ * This file is the source of truth for the browser export's public types.
5
+ * It imports ONLY from agentSdkTypes.ts so the compiled .d.ts has exactly
6
+ * one import to rewrite (./agentSdkTypes → ./sdk) for the flat package layout.
7
+ *
8
+ * Compiled by scripts/build-ant-sdk-typings.sh; see build-agent-sdk.sh for the
9
+ * path rewrite and copy into the package.
10
+ */
11
+ import type { CanUseTool, HookCallbackMatcher, HookEvent, McpServerConfig, OnElicitation, OnUserDialog, Query, SDKMessage, SDKUserMessage } from './agentSdkTypes.js';
12
+ export type { CanUseTool, ElicitationRequest, ElicitationResult, HookCallbackMatcher, HookEvent, McpSdkServerConfigWithInstance, McpServerConfig, OnElicitation, OnUserDialog, Query, SDKAssistantMessage, SDKMessage, SDKResultMessage, SDKSystemMessage, SDKUserMessage, UserDialogRequest, UserDialogResult, } from './agentSdkTypes.js';
13
+ export { createSdkMcpServer, tool } from './agentSdkTypes.js';
14
+ export type OAuthCredential = {
15
+ type: 'oauth';
16
+ token: string;
17
+ };
18
+ export type AuthMessage = {
19
+ type: 'auth';
20
+ credential: OAuthCredential;
21
+ };
22
+ export type WebSocketOptions = {
23
+ url: string;
24
+ headers?: Record<string, string>;
25
+ authMessage?: AuthMessage;
26
+ };
27
+ export type SSEOptions = {
28
+ /** SSE read endpoint, e.g. `…/v1/code/sessions/{id}/events/stream`. */
29
+ streamUrl: string;
30
+ /** POST write endpoint, e.g. `…/v1/code/sessions/{id}/events`. */
31
+ sendUrl: string;
32
+ /**
33
+ * The CCR session ID — required to build the `AddClientEventFromClient`
34
+ * request body that `sendUrl` expects.
35
+ */
36
+ sessionId: string;
37
+ /**
38
+ * Headers sent on both the SSE GET and every POST. Set `Authorization` and
39
+ * `anthropic-client-platform` here — the SDK cannot determine the host
40
+ * surface (web / iOS / Android / desktop) itself.
41
+ */
42
+ headers?: Record<string, string>;
43
+ /**
44
+ * Resume cursor for the first connect: the stream delivers only events
45
+ * whose `sequence_num` is greater. For a consumer that seeded its
46
+ * transcript from the REST event list — pass the highest `sequence_num` it
47
+ * has already applied (for a query replacing an earlier one,
48
+ * `getSseLastSequenceNum()` of that query, which only ever covers messages
49
+ * it actually yielded). Omitted or 0 starts from the beginning of the
50
+ * retained stream.
51
+ */
52
+ fromSequenceNum?: number;
53
+ /**
54
+ * Called when the server reports (`catch_up_truncated`) that it could not
55
+ * replay every event after the resume cursor — the stream continues from a
56
+ * later point, so re-fetch the gap from the REST event list and reseed.
57
+ * Each occurrence is also counted in `getSseDropCounts()` under
58
+ * `catch_up_truncated`. Exceptions thrown by the handler are contained.
59
+ */
60
+ onCatchUpTruncated?: () => void;
61
+ /**
62
+ * Called for each `delivery_update` frame: the worker's acknowledgement of
63
+ * one event this session was sent (`event_id` — matches the `event_id` of
64
+ * that event's own durable echo, see `getCcrEvent()`), with the raw server
65
+ * status string — `"DELIVERY_STATUS_RECEIVED"`, `"DELIVERY_STATUS_PROCESSING"`
66
+ * (the worker began the turn) or `"DELIVERY_STATUS_PROCESSED"` (that turn
67
+ * ended); treat unknown values as informational — and the server
68
+ * `timestamp` when present. Not durable: a reconnect does not replay
69
+ * earlier updates. Malformed frames are counted in `getSseDropCounts()`
70
+ * under `malformed_delivery_update`; handler exceptions are contained.
71
+ */
72
+ onDeliveryUpdate?: (update: {
73
+ event_id: string;
74
+ status: string;
75
+ timestamp?: string;
76
+ }) => void;
77
+ };
78
+ type BrowserQueryOptionsBase = {
79
+ prompt: AsyncIterable<SDKUserMessage>;
80
+ abortController?: AbortController;
81
+ canUseTool?: CanUseTool;
82
+ hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
83
+ mcpServers?: Record<string, McpServerConfig>;
84
+ jsonSchema?: Record<string, unknown>;
85
+ onElicitation?: OnElicitation;
86
+ onUserDialog?: OnUserDialog;
87
+ /**
88
+ * When enabled, the remote CLI emits a `prompt_suggestion` message after
89
+ * each turn's result. At most one per turn.
90
+ */
91
+ promptSuggestions?: boolean;
92
+ /**
93
+ * Dialog kinds (`request_user_dialog` `dialog_kind` values) this consumer's
94
+ * `onUserDialog` can render, declared on `initialize`. The remote CLI sends
95
+ * only kinds an attached client declared, so `onUserDialog` alone does not
96
+ * opt in. A non-empty list without `onUserDialog` throws.
97
+ */
98
+ supportedDialogKinds?: string[];
99
+ };
100
+ /**
101
+ * Exactly one of `websocket` | `sse` must be provided. `sse` is the v1alpha2
102
+ * path and is preferred for new integrations; `websocket` remains for
103
+ * existing callers during the migration.
104
+ */
105
+ export type BrowserQueryOptions = BrowserQueryOptionsBase & ({
106
+ websocket: WebSocketOptions;
107
+ sse?: never;
108
+ } | {
109
+ sse: SSEOptions;
110
+ websocket?: never;
111
+ });
112
+ /**
113
+ * Create a Claude Code query in the browser over either SSE (preferred) or
114
+ * WebSocket.
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * import { query } from '@anthropic-ai/claude-agent-sdk/browser'
119
+ *
120
+ * const messages = query({
121
+ * prompt: messageStream,
122
+ * sse: {
123
+ * streamUrl: 'https://api.example.com/v1/code/sessions/ID/events/stream',
124
+ * sendUrl: 'https://api.example.com/v1/code/sessions/ID/events',
125
+ * headers: { Authorization: `Bearer ${token}` },
126
+ * },
127
+ * })
128
+ * for await (const message of messages) {
129
+ * console.log(message)
130
+ * }
131
+ * ```
132
+ */
133
+ export declare function query(options: BrowserQueryOptions): Query;
134
+ /**
135
+ * Readiness sentinel for the peer-frame text-envelope guard
136
+ * (userFrameRequiresWorkerSource): `true` means the SSE transport enforces
137
+ * the full predicate on peer-authored `user` frames. The change enabling
138
+ * `ccr_v2_subscribe_sse_web` in a consumer repo must assert this reads
139
+ * `true` before flipping the flag.
140
+ */
141
+ export declare const G4_TEXT_ENVELOPE_ARM_PORTED: boolean;
142
+ /**
143
+ * Cumulative per-category dropped-frame counts for a query() created with
144
+ * the `sse` transport — the aggregated receipt for the
145
+ * `ccr_v2_subscribe_sse_web` enablement review (category → count only,
146
+ * never frame contents). Returns undefined for WebSocket-transport queries.
147
+ */
148
+ export declare function getSseDropCounts(query: Query): Readonly<Record<string, number>> | undefined;
149
+ /**
150
+ * Resume cursor of a query() created with the `sse` transport: the highest
151
+ * `sequence_num` of a durable message this query has yielded (or the
152
+ * `fromSequenceNum` seed before any was). It is advanced immediately before
153
+ * each message is yielded, so while the consumer handles message `m` it is
154
+ * already `>= getCcrEvent(query, m).sequence_num`, and it never covers a
155
+ * message the consumer was not handed — frames still buffered when the
156
+ * consumer stops iterating, and durable events the SDK dropped or consumed
157
+ * internally, do not advance it. So at any point — mid-stream, after a
158
+ * `break`, or once the iterator has finished — it is where a REST catch-up
159
+ * fetch or a replacement query()'s `fromSequenceNum` should resume (the
160
+ * transport's own transparent reconnects use a separate internal wire
161
+ * cursor). Per-message ordering still reads `getCcrEvent(query, message)`.
162
+ * Returns undefined for WebSocket-transport queries and before any sequence
163
+ * number is known.
164
+ */
165
+ export declare function getSseLastSequenceNum(query: Query): number | undefined;
166
+ /**
167
+ * The wire envelope of the durable CCR event (SSE `client_event` frame) that
168
+ * delivered `message` on the `sse` query `query`: `sequence_num` is the
169
+ * session-wide order the server assigned, `event_id` is unique per event,
170
+ * `created_at` (RFC 3339 store time) and `source` (server-assigned channel,
171
+ * e.g. `worker`) appear when the frame carries them. Provenance contract:
172
+ * the transport records the envelope from the delivering frame, keyed by the
173
+ * exact message object it yields, and never writes it onto the message; a
174
+ * `ccr_event` field arriving inside any payload is a sender-authored claim
175
+ * and is stripped, so this accessor is the only way to read an envelope.
176
+ * Looked up by object identity — pass the message exactly as the query
177
+ * yielded it. Returns undefined for anything that transport did not itself
178
+ * yield from a durable frame: unsequenced ephemerals (`stream_event`,
179
+ * `sources_changed`, live-only `system` status frames), messages of a
180
+ * WebSocket-transport query, copies, and caller-constructed objects,
181
+ * regardless of the fields they carry. `sequence_num` is dense over ALL of
182
+ * the session's events, including control frames the SDK consumes
183
+ * internally and frames it drops, so consecutive yielded messages need not
184
+ * carry consecutive numbers.
185
+ */
186
+ export declare function getCcrEvent(query: Query, message: SDKMessage): {
187
+ event_id: string;
188
+ sequence_num: number;
189
+ created_at?: string;
190
+ source?: string;
191
+ } | undefined;
192
+ /**
193
+ * Closes the event stream of an `sse` query without ending the query. The
194
+ * stream reopens on `resumeSseStream()` or on the query's next send, its own
195
+ * answers to earlier requests included. It then replays the durable events
196
+ * sent meanwhile (or `onCatchUpTruncated` fires). Until then, requests from
197
+ * the remote session, such as permission prompts, wait unanswered. So do the
198
+ * query's own requests in flight and sends still waiting for the first
199
+ * connection. Ephemeral frames and delivery updates sent meanwhile are lost.
200
+ * Returns false for a WebSocket, closed or suspended query.
201
+ */
202
+ export declare function suspendSseStream(query: Query): boolean;
203
+ /**
204
+ * Reopens the event stream that `suspendSseStream()` closed, resuming after
205
+ * the last event received. Returns false unless `query` is suspended and
206
+ * still open.
207
+ */
208
+ export declare function resumeSseStream(query: Query): boolean;