soulnet-dsh 0.1.0 → 0.1.1
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 +3 -1
- package/lib/index.js +9 -3
- package/lib/index.js.map +1 -1
- package/lib/types/network/soulnet.d.ts +7 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,8 +10,10 @@ wants to send. Friend threads are read-only; you only ever talk to your alter.
|
|
|
10
10
|
The network itself is the open-source [soulnet](https://github.com/startupworld-ai/soulnet)
|
|
11
11
|
light peer (Go). Its binary ships as a platform package
|
|
12
12
|
(`soulnet-peer-<os>-<arch>`, an optional dependency of this package)
|
|
13
|
-
and is picked automatically for
|
|
13
|
+
and is picked automatically for windows-x64, darwin-arm64, darwin-x64, linux-x64,
|
|
14
14
|
linux-arm64 — nothing to compile, no Go toolchain.
|
|
15
|
+
(The Windows package is named `soulnet-peer-windows-x64`, not `-win32-x64`:
|
|
16
|
+
npm's spam filter rejects that suffix for new packages.)
|
|
15
17
|
|
|
16
18
|
## Install (one line)
|
|
17
19
|
|
package/lib/index.js
CHANGED
|
@@ -999,10 +999,9 @@ function isExecutable(path) {
|
|
|
999
999
|
return false;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
/** npm scope of the platform packages that ship the binary. */
|
|
1003
1002
|
/** Prefix of the per-platform binary packages on npm (`soulnet-peer-<os>-<arch>`). */
|
|
1004
1003
|
const PLATFORM_PACKAGE_PREFIX = "soulnet-peer-";
|
|
1005
|
-
/** The `<
|
|
1004
|
+
/** The `<process.platform>-<process.arch>` pairs a platform package exists for (must match dsh/packages/soulnet-*). */
|
|
1006
1005
|
const PLATFORM_PACKAGE_TARGETS = [
|
|
1007
1006
|
"win32-x64",
|
|
1008
1007
|
"darwin-arm64",
|
|
@@ -1010,10 +1009,17 @@ const PLATFORM_PACKAGE_TARGETS = [
|
|
|
1010
1009
|
"linux-x64",
|
|
1011
1010
|
"linux-arm64"
|
|
1012
1011
|
];
|
|
1012
|
+
/**
|
|
1013
|
+
* How the `<os>` part of the package name is spelled when it differs from `process.platform`.
|
|
1014
|
+
* npm's spam filter rejects new unscoped names ending in `-win32-x64`, so the Windows
|
|
1015
|
+
* package is published as `soulnet-peer-windows-x64` (the workspace directory keeps `win32`).
|
|
1016
|
+
*/
|
|
1017
|
+
const PLATFORM_PACKAGE_OS_NAMES = { win32: "windows" };
|
|
1013
1018
|
/** `soulnet-peer-<os>-<arch>` for a supported pair, else `undefined`. */
|
|
1014
1019
|
function platformPackageName(platform = process.platform, arch = process.arch) {
|
|
1015
1020
|
const target = `${platform}-${arch}`;
|
|
1016
|
-
|
|
1021
|
+
if (!PLATFORM_PACKAGE_TARGETS.includes(target)) return void 0;
|
|
1022
|
+
return `${PLATFORM_PACKAGE_PREFIX}${PLATFORM_PACKAGE_OS_NAMES[platform] ?? platform}-${arch}`;
|
|
1017
1023
|
}
|
|
1018
1024
|
/**
|
|
1019
1025
|
* Resolve an installed package's directory from this plugin's location: first
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fp","mid","valueMap","z"],"sources":["../src/api/index.ts","../src/network/fake.ts","../src/network/jsonrpc.ts","../src/network/soulnet.ts","../../../node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.2/node_modules/@deepseek-ai/cosmokit/lib/index.js","../../../node_modules/.pnpm/@deepseek-ai+schemastery@3.18.1/node_modules/@deepseek-ai/schemastery/lib/index.mjs","../src/settings.ts","../src/index.ts"],"sourcesContent":["/**\n * Browser-facing HTTP API of the host half, mounted on dsh's web server\n * (`ctx.webServer.register`, prefix `/soulmirror/api/`). The client bundle\n * uses it for everything the SoulMirror page / settings / onboarding need\n * that is not a session event: identity, card, friends, pending requests,\n * read cursors, the conversation archive, presence, the debug direct send,\n * the owner → alter channel (P4: `alter.instruct {text}`, `session.latest`,\n * `session.history`), pending drafts (`drafts.list`, `drafts.decide`),\n * per-friend settings (`friends.set` with tier / protocol override), the\n * global diplomacy protocol (`protocol.get` / `protocol.set`), and a\n * Server-Sent-Events stream of live events (inbound mail, outbound archive,\n * typing, friend requests, presence, backend status, `alter` = the alter's\n * state changed, `draft` = a draft was stored / decided).\n *\n * Why not dsh's Typert remotes: those are generated build artifacts selected\n * by the web app at build time; an out-of-repo plugin cannot add one (see\n * dsh-api-remotes README \"capability set is fixed by explicit build-time\n * value imports\"). Why not `ctx.sessionProjections` for typing: projections\n * are pure folds over COMMITTED session events and typing must not be logged\n * (SPIKE.md §1), so there is no event to fold. This route is the plugin's own\n * channel; it is served by the same loopback web server as `/api`.\n */\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-host-webserver'\nimport type { Fingerprint } from '../events.ts'\nimport { ProtocolFile } from '../friend-settings.ts'\nimport { sendAndArchive } from '../network/send.ts'\nimport { NetworkError, type ConversationEntry, type NetworkClient, type NetworkEvent } from '../network/types.ts'\nimport { isReplyTier } from '../policy.ts'\nimport type { AlterSessions, SessionsEvent } from '../sessions/index.ts'\nimport type { SoulmirrorSettings } from '../settings.ts'\n\nexport const API_PREFIX = '/soulmirror/api/'\n\n/**\n * What the SSE stream carries: every NetworkEvent of the backend plus the\n * sessions plugin's own frames (`outbound`, `alter`, `draft`).\n */\nexport type ApiFrame = NetworkEvent | SessionsEvent\n\nexport interface ApiOptions {\n readonly client: NetworkClient\n readonly home: string\n readonly settingsNamespace: string\n /** Resolved lazily: the sessions plugin may mount after the network plugin. */\n readonly sessions: () => AlterSessions | undefined\n /** Live settings (the alter fields apply without restart). */\n readonly settings: () => SoulmirrorSettings\n readonly log: (level: 'info' | 'warn' | 'error', message: string) => void\n}\n\ntype Json = Record<string, unknown>\n\nfunction readJson(req: IncomingMessage, limit = 256 * 1024): Promise<Json> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = []\n let size = 0\n req.on('data', (chunk: Buffer) => {\n size += chunk.length\n if (size > limit) {\n reject(new Error('request body too large'))\n req.destroy()\n return\n }\n chunks.push(chunk)\n })\n req.on('end', () => {\n if (chunks.length === 0) {\n resolve({})\n return\n }\n try {\n const parsed: unknown = JSON.parse(Buffer.concat(chunks).toString('utf8'))\n resolve(typeof parsed === 'object' && parsed !== null ? parsed as Json : {})\n } catch (error: unknown) {\n reject(error instanceof Error ? error : new Error(String(error)))\n }\n })\n req.on('error', reject)\n })\n}\n\nfunction send(res: ServerResponse, status: number, body: unknown): void {\n const payload = JSON.stringify(body)\n res.writeHead(status, {\n 'content-type': 'application/json; charset=utf-8',\n 'cache-control': 'no-store',\n 'content-length': Buffer.byteLength(payload),\n })\n res.end(payload)\n}\n\nfunction errorBody(error: unknown): Json {\n if (error instanceof NetworkError) return { error: { code: error.code, message: error.message } }\n return { error: { code: -32603, message: error instanceof Error ? error.message : String(error) } }\n}\n\nconst bad = (message: string): { status: number; body: unknown } => ({ status: 400, body: { error: { code: -32602, message } } })\nconst text = (value: unknown): string | undefined => typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined\nconst num = (value: unknown): number | undefined => {\n if (typeof value === 'number' && Number.isFinite(value)) return value\n if (typeof value === 'string' && value.trim() !== '' && Number.isFinite(Number(value))) return Number(value)\n return undefined\n}\n/** `fps` as a JSON array (POST) or a comma-separated query value (GET). */\nconst fpList = (value: unknown): string[] => {\n if (Array.isArray(value)) return value.filter((v): v is string => typeof v === 'string' && v !== '')\n if (typeof value === 'string') return value.split(',').map(v => v.trim()).filter(v => v !== '')\n return []\n}\n\n/** GET routes whose query string stands in for the JSON body (`?fp=…&since=…&limit=…`, `?fps=a,b`). */\nconst QUERY_ROUTES = new Set(['state', 'conversation.get', 'presence', 'session.latest', 'session.history', 'protocol.get', 'drafts.list'])\n\nexport interface ApiHandler {\n (req: IncomingMessage, res: ServerResponse): Promise<void>\n /** Push one frame to every SSE client (the sessions plugin's events are forwarded through this). */\n broadcast(frame: ApiFrame): void\n dispose(): void\n}\n\nexport function createApiHandler(options: ApiOptions): ApiHandler {\n const { client } = options\n const sseClients = new Set<ServerResponse>()\n const protocol = ProtocolFile.at(join(options.home, 'a2a'))\n\n const broadcast = (event: ApiFrame): void => {\n if (sseClients.size === 0) return\n const frame = `event: ${event.kind}\\ndata: ${JSON.stringify(event)}\\n\\n`\n for (const res of sseClients) {\n try {\n res.write(frame)\n } catch {\n sseClients.delete(res)\n }\n }\n }\n const unsubscribe = client.subscribe(broadcast)\n\n /** Direct send through the peer (the settings' debug \"send as myself\"), broadcast as `outbound` to every SSE client. */\n const sendDirect = async (fp: Fingerprint, body: string): Promise<{ entry: ConversationEntry; receipt: { id: string; seq?: number; status: string } }> => {\n const result = await sendAndArchive(client, fp, body)\n broadcast({ kind: 'outbound', fp, entry: result.entry })\n return result\n }\n\n /** The friend row as the browser sees it: the peer's record + the plugin's tier + pending draft count. */\n const friendRow = (friend: Record<string, unknown>, sessions: AlterSessions | undefined): Record<string, unknown> => {\n const fp = friend['fp'] as Fingerprint\n const tier = sessions?.tierOf(fp) ?? options.settings().defaultTier\n const explicit = sessions?.tierStored(fp) !== undefined\n const drafts = sessions?.drafts.count(fp) ?? 0\n return { ...friend, tier, ...(explicit ? { tierExplicit: true } : {}), ...(drafts > 0 ? { drafts } : {}) }\n }\n\n const state = async (): Promise<Json> => {\n const status = client.status()\n let identity: Json | null = null\n let friends: unknown[] = []\n let pending: unknown[] = []\n let error: string | undefined\n const sessions = options.sessions()\n try {\n const id = await client.identity()\n if (id !== undefined) {\n identity = { fp: id.fp, name: id.name, cardUri: id.cardUri, ...(id.createdAt === undefined ? {} : { createdAt: id.createdAt }) }\n const [f, p] = await Promise.all([client.friends.list(), client.friends.pending()])\n pending = [...p]\n // `friends.list` carries no presence; ask the peer (cached 10 s there) so\n // every row has `online` and the page header / dots are authoritative.\n let online: Record<string, boolean> = {}\n if (f.length > 0) {\n try {\n online = await client.presence(f.map(x => x.fp))\n } catch {\n // best effort: rows keep whatever the client folded from SSE\n }\n }\n friends = f.map(x => friendRow((online[x.fp] === undefined ? x : { ...x, online: online[x.fp] }) as unknown as Record<string, unknown>, sessions))\n }\n } catch (e: unknown) {\n error = e instanceof Error ? e.message : String(e)\n }\n const settings = options.settings()\n const alterState = sessions?.latest()\n return {\n backend: client.backend,\n status,\n home: options.home,\n settingsNamespace: options.settingsNamespace,\n identity,\n friends,\n pending,\n drafts: sessions?.drafts.list() ?? [],\n alter: {\n sessionId: sessions?.sessionId() ?? null,\n status: alterState?.status ?? 'idle',\n defaultTier: settings.defaultTier,\n autoReplyPerHour: settings.autoReplyPerHour,\n directSend: settings.directSend,\n protocolPath: protocol.path,\n protocolExists: protocol.exists(),\n legacyFriendSessions: sessions?.legacyFriendSessions() ?? {},\n },\n ...(error === undefined ? {} : { error }),\n }\n }\n\n const handle = async (route: string, method: string, body: Json): Promise<{ status: number; body: unknown }> => {\n switch (route) {\n case 'state':\n return { status: 200, body: await state() }\n case 'identity.create': {\n const name = text(body['name'])\n if (name === undefined) return bad('name must not be empty')\n const id = await client.createIdentity(name)\n return { status: 200, body: { identity: id } }\n }\n case 'card.parse': {\n const uri = text(body['uri'])\n if (uri === undefined) return bad('uri must not be empty')\n return { status: 200, body: await client.parseCard(uri) }\n }\n case 'friends.add': {\n const cardUri = text(body['card_uri'])\n if (cardUri === undefined) return bad('card_uri must not be empty')\n const friend = await client.friends.add(cardUri, text(body['note']))\n options.log('info', `friend request sent to ${friend.name} (${friend.fp}) via settings/command`)\n return { status: 200, body: { friend } }\n }\n case 'friends.accept': {\n const id = text(body['id'])\n if (id === undefined) return bad('id must not be empty')\n const friend = await client.friends.accept(id, text(body['note']))\n options.sessions()?.noteFriend(friend)\n return { status: 200, body: { friend: friendRow(friend as unknown as Record<string, unknown>, options.sessions()) } }\n }\n case 'friends.reject': {\n const id = text(body['id'])\n if (id === undefined) return bad('id must not be empty')\n await client.friends.reject(id)\n return { status: 200, body: { ok: true } }\n }\n case 'friends.set': {\n // Note / protocol override live in the peer (friends.yaml); the tier in the plugin's dsh-friends.json.\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n const note = text(body['note'])\n const protocolOverride = typeof body['protocol'] === 'string' ? body['protocol'] : undefined\n const tierValue = body['tier']\n if (tierValue !== undefined && tierValue !== null && tierValue !== '' && !isReplyTier(tierValue)) {\n return bad('tier must be notify | draft | auto (empty = default)')\n }\n const sessions = options.sessions()\n let friend = (await client.friends.list()).find(f => f.fp === fp)\n if (friend === undefined) return { status: 404, body: { error: { code: -32002, message: 'not a friend' } } }\n if (note !== undefined || protocolOverride !== undefined) {\n friend = await client.friends.set(fp as Fingerprint, { ...(note === undefined ? {} : { remark: note }), ...(protocolOverride === undefined ? {} : { protocol: protocolOverride }) })\n sessions?.noteFriend(friend)\n }\n if (tierValue !== undefined && sessions !== undefined) {\n await sessions.setTier(fp as Fingerprint, isReplyTier(tierValue) ? tierValue : undefined)\n }\n options.log('info', `friends.set ${fp}: ${[note !== undefined ? 'note' : '', protocolOverride !== undefined ? 'protocol' : '', tierValue !== undefined ? `tier=${String(tierValue)}` : ''].filter(s => s !== '').join(' ')}`)\n return { status: 200, body: { friend: friendRow(friend as unknown as Record<string, unknown>, sessions) } }\n }\n case 'friends.card': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n return { status: 200, body: await client.friends.card(fp as Fingerprint) }\n }\n case 'conversation.markRead': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp required')\n await client.markRead(fp as Fingerprint, typeof body['seq'] === 'number' ? body['seq'] : 0)\n await options.sessions()?.markRead(fp as Fingerprint)\n return { status: 200, body: { ok: true } }\n }\n case 'conversation.get': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n const since = num(body['since'])\n const limit = num(body['limit'])\n return { status: 200, body: await client.conversation(fp as Fingerprint, { ...(since === undefined ? {} : { since }), ...(limit === undefined ? {} : { limit }) }) }\n }\n case 'message.send': {\n // Debug only (\"send as myself\" in Settings): bypasses the alter.\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n const msg = typeof body['body'] === 'string' ? body['body'].replace(/\\s+$/, '') : ''\n if (msg === '') return bad('body must not be empty')\n const result = await sendDirect(fp as Fingerprint, msg)\n options.log('info', `direct send to ${fp} (debug): ${result.receipt.id} (${result.receipt.status}, seq ${result.receipt.seq ?? '?'})`)\n return { status: 200, body: result }\n }\n case 'message.typing': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n await client.typing(fp as Fingerprint, body['on'] !== false && body['on'] !== 'false' && body['on'] !== 0)\n return { status: 200, body: { ok: true } }\n }\n case 'presence': {\n const fps = fpList(body['fps'])\n const online = await client.presence(fps as Fingerprint[])\n return { status: 200, body: { online } }\n }\n case 'alter.instruct': {\n // The owner instructs their alter: an owner user/message + a woken turn in the alter session.\n const instruction = typeof body['text'] === 'string' ? body['text'].replace(/\\s+$/, '') : ''\n if (instruction === '') return bad('text must not be empty')\n const sessions = options.sessions()\n if (sessions === undefined) return { status: 503, body: { error: { code: -32603, message: 'sessions plugin not mounted' } } }\n const result = await sessions.instruct(instruction)\n options.log('info', `owner → alter: session ${result.sessionId}, message ${result.messageId}`)\n return { status: 200, body: { ...result, state: sessions.latest() ?? null } }\n }\n case 'session.latest':\n return { status: 200, body: { state: options.sessions()?.latest() ?? null } }\n case 'session.history': {\n const sessions = options.sessions()\n const limit = num(body['limit'])\n if (sessions === undefined) return { status: 200, body: { sessionId: null, status: 'idle', chat: { items: [], running: false, seq: 0 } } }\n const h = sessions.history(limit)\n return { status: 200, body: { sessionId: h.sessionId ?? null, status: h.status, chat: h.chat } }\n }\n case 'drafts.list': {\n const fp = text(body['fp'])\n const sessions = options.sessions()\n return { status: 200, body: { drafts: sessions?.drafts.list(fp) ?? [] } }\n }\n case 'drafts.decide': {\n const id = text(body['id'])\n if (id === undefined) return bad('id must not be empty')\n const action = text(body['action'])\n const sessions = options.sessions()\n if (sessions === undefined) return { status: 503, body: { error: { code: -32603, message: 'sessions plugin not mounted' } } }\n if (action === 'approve') {\n const edited = typeof body['body'] === 'string' ? body['body'] : undefined\n const result = await sessions.decideDraft(id, { action: 'approve', ...(edited === undefined ? {} : { body: edited }) })\n return { status: 200, body: { ok: true, ...result } }\n }\n if (action === 'reject') return { status: 200, body: { ok: true, ...(await sessions.decideDraft(id, { action: 'reject' })) } }\n if (action === 'revise') {\n const feedback = text(body['feedback'])\n if (feedback === undefined) return bad('feedback must not be empty')\n return { status: 200, body: { ok: true, ...(await sessions.decideDraft(id, { action: 'revise', feedback })) } }\n }\n return bad('action must be approve | reject | revise')\n }\n case 'protocol.get':\n return { status: 200, body: { text: protocol.read(), path: protocol.path, exists: protocol.exists() } }\n case 'protocol.set': {\n if (typeof body['text'] !== 'string') return bad('text must be a string')\n protocol.write(body['text'])\n options.log('info', `diplomacy protocol saved (${body['text'].length} chars) → ${protocol.path}`)\n return { status: 200, body: { ok: true, text: protocol.read(), path: protocol.path } }\n }\n default:\n return { status: 404, body: { error: { code: -32601, message: `unknown route ${method} ${route}` } } }\n }\n }\n\n const handler = (async (req: IncomingMessage, res: ServerResponse): Promise<void> => {\n const url = new URL(req.url ?? '/', 'http://localhost')\n const route = url.pathname.startsWith(API_PREFIX) ? url.pathname.slice(API_PREFIX.length) : ''\n if (route === 'events' && req.method === 'GET') {\n res.writeHead(200, {\n 'content-type': 'text/event-stream',\n 'cache-control': 'no-store',\n connection: 'keep-alive',\n })\n res.write(`event: status\\ndata: ${JSON.stringify({ kind: 'status', status: client.status() })}\\n\\n`)\n sseClients.add(res)\n const keepAlive = setInterval(() => {\n try {\n res.write(': keep-alive\\n\\n')\n } catch {\n clearInterval(keepAlive)\n }\n }, 25_000)\n keepAlive.unref?.()\n req.on('close', () => {\n clearInterval(keepAlive)\n sseClients.delete(res)\n })\n return\n }\n if (req.method !== 'POST' && !(req.method === 'GET' && QUERY_ROUTES.has(route))) {\n send(res, 405, { error: { code: -32600, message: 'use POST with application/json (GET only for state / conversation.get / presence / session.latest / session.history / drafts.list / protocol.get / events)' } })\n return\n }\n try {\n const body: Json = req.method === 'POST' ? await readJson(req) : Object.fromEntries(url.searchParams.entries())\n const result = await handle(route, req.method ?? 'GET', body)\n send(res, result.status, result.body)\n } catch (error: unknown) {\n options.log('warn', `api ${route} failed: ${String(error)}`)\n send(res, error instanceof NetworkError ? 400 : 500, errorBody(error))\n }\n }) as ApiHandler\n handler.broadcast = broadcast\n handler.dispose = () => {\n unsubscribe()\n for (const res of sseClients) {\n try {\n res.end()\n } catch {\n // ignore\n }\n }\n sseClients.clear()\n }\n return handler\n}\n\n/** Mount the API on `ctx.webServer` when (and for as long as) that service exists. */\nexport function mountApi(ctx: Context, options: ApiOptions): void {\n ctx.inject(['webServer'], (wctx) => {\n const handler = createApiHandler(options)\n // The web server matches a prefix route as `/path` or `/path/...`, so register it without the trailing slash.\n const dispose = wctx.webServer.register({ kind: 'prefix', path: API_PREFIX.slice(0, -1), handler })\n options.log('info', `browser API mounted at ${API_PREFIX} (port ${wctx.webServer.port})`)\n // The sessions plugin's live events (alter state, the alter's own sends,\n // drafts) → SSE frames, for as long as both services exist.\n wctx.inject(['soulmirrorSessions'], (sctx) => {\n const off = sctx.soulmirrorSessions.on((event: SessionsEvent) => { handler.broadcast(event) })\n sctx.effect(() => off, 'soulmirror: alter events → SSE')\n })\n wctx.effect(() => () => {\n dispose()\n handler.dispose()\n }, 'soulmirror: browser API')\n })\n}\n","/**\n * In-memory fake NetworkClient (config `backend: fake`): two friends, one\n * pending request, one canned inbound message shortly after the first\n * subscribe, an auto-reply echo for every send, no I/O. Selectable for tests\n * and UI work; the default backend is the `soulnet` light peer (./soulnet.ts).\n */\nimport type { A2AMessageId, Fingerprint } from '../events.ts'\nimport {\n NetworkError,\n NetworkErrorCode,\n type BackendStatus,\n type ConversationEntry,\n type Friend,\n type Identity,\n type NetworkClient,\n type NetworkEvent,\n type PendingRequest,\n type SendReceipt,\n} from './types.ts'\n\nconst fp = (s: string): Fingerprint => s as Fingerprint\nconst mid = (): A2AMessageId => `a2a-${crypto.randomUUID()}` as A2AMessageId\n\nexport const FAKE_FRIENDS: readonly Friend[] = [\n { fp: fp('fp-alice-1f2e3d4c5b6a7988'), name: 'college friend', cardName: 'Alice', remark: 'college friend', online: true, unread: 0, count: 0 },\n { fp: fp('fp-bob-9a8b7c6d5e4f3021'), name: 'Bob', cardName: 'Bob', online: false, unread: 0, count: 0 },\n]\n\nexport const FAKE_PENDING: readonly PendingRequest[] = [\n { id: 'req-carol-1', fp: fp('fp-carol-5566778899aabbcc'), name: 'Carol', greeting: 'Hi, Alice gave me your card.' },\n]\n\nexport interface FakeOptions {\n /** Delay before the canned inbound message fires after the first subscribe (ms); negative = never. */\n readonly firstInboundDelayMs?: number\n /** Start without an identity (first-run onboarding path). Default: identity present. */\n readonly noIdentity?: boolean\n}\n\nexport function createFakeNetworkClient(options: FakeOptions = {}): NetworkClient {\n const listeners = new Set<(event: NetworkEvent) => void>()\n const friends = new Map<string, Friend>(FAKE_FRIENDS.map(f => [f.fp, f]))\n const pending = new Map<string, PendingRequest>(FAKE_PENDING.map(p => [p.id, p]))\n const conversations = new Map<string, ConversationEntry[]>()\n let identity: Identity | undefined = options.noIdentity === true\n ? undefined\n : { fp: fp('fp-me-0000aaaabbbbcccc'), name: 'dsh tester', cardUri: 'soulmirror://card?v=1&pk=FAKE&xpk=FAKE&name=dsh%20tester' }\n let firstInboundFired = false\n let disposed = false\n const status: BackendStatus = { backend: 'fake', state: 'ready', restarts: 0 }\n\n const emit = (event: NetworkEvent): void => {\n for (const l of listeners) {\n try {\n l(event)\n } catch {\n // listener errors never kill the fake\n }\n }\n }\n const archive = (peer: string, entry: Omit<ConversationEntry, 'seq'>): ConversationEntry => {\n const list = conversations.get(peer) ?? []\n const full: ConversationEntry = { seq: list.length + 1, ...entry }\n list.push(full)\n conversations.set(peer, list)\n const friend = friends.get(peer)\n if (friend !== undefined) {\n friends.set(peer, {\n ...friend,\n count: list.length,\n unread: entry.dir === 'in' ? friend.unread + 1 : friend.unread,\n lastTs: entry.ts,\n lastBody: entry.body,\n })\n }\n return full\n }\n const deliver = (from: Fingerprint, body: string, auto?: true): void => {\n if (disposed) return\n const friend = friends.get(from)\n const id = mid()\n const ts = Date.now()\n const entry = archive(from, { dir: 'in', id, body, ts, ...(auto ? { auto } : {}) })\n emit({\n kind: 'message',\n message: { id, from, name: friend?.name ?? from, body, ts, seq: entry.seq, ...(auto ? { auto } : {}) },\n })\n }\n const requireIdentity = (): Identity => {\n if (identity === undefined) throw new NetworkError('no identity yet (identity.create first)', NetworkErrorCode.noIdentity)\n return identity\n }\n const friendFromCard = (uri: string, remark?: string): Friend => ({\n fp: fp(`fp-${uri.slice(-8).replace(/[^a-z0-9]/gi, '') || 'card'}`),\n name: remark ?? `card ${uri.slice(-4)}`,\n cardName: `card ${uri.slice(-4)}`,\n ...(remark === undefined ? {} : { remark }),\n unread: 0,\n count: 0,\n })\n\n return {\n backend: 'fake',\n status: () => status,\n identity: () => Promise.resolve(identity),\n createIdentity: (name) => {\n if (identity !== undefined) return Promise.reject(new NetworkError('identity already exists', NetworkErrorCode.identityExists))\n identity = { fp: fp('fp-me-0000aaaabbbbcccc'), name, cardUri: `soulmirror://card?v=1&pk=FAKE&xpk=FAKE&name=${encodeURIComponent(name)}` }\n return Promise.resolve(identity)\n },\n card: () => Promise.resolve(requireIdentity().cardUri),\n parseCard: (uri) => {\n if (!uri.startsWith('soulmirror://card')) return Promise.reject(new NetworkError('invalid card link', NetworkErrorCode.badCard))\n const f = friendFromCard(uri)\n return Promise.resolve({ fp: f.fp, name: f.cardName ?? f.name, uri })\n },\n friends: {\n list: () => Promise.resolve([...friends.values()]),\n pending: () => Promise.resolve([...pending.values()]),\n add: (uri, remark) => {\n requireIdentity()\n if (!uri.startsWith('soulmirror://card')) return Promise.reject(new NetworkError('invalid card link', NetworkErrorCode.badCard))\n const f = friendFromCard(uri, remark)\n friends.set(f.fp, f)\n // The peer \"accepts\" shortly after.\n setTimeout(() => { if (!disposed) emit({ kind: 'friend_accept', friend: f }) }, 300)\n return Promise.resolve(f)\n },\n accept: (requestId, note) => {\n const req = pending.get(requestId)\n if (req === undefined) return Promise.reject(new NetworkError('no such pending request', NetworkErrorCode.notFound))\n pending.delete(requestId)\n const f: Friend = { fp: req.fp, name: note ?? req.name, cardName: req.name, ...(note === undefined ? {} : { remark: note }), unread: 0, count: 0 }\n friends.set(f.fp, f)\n return Promise.resolve(f)\n },\n reject: (requestId) => {\n if (!pending.delete(requestId)) return Promise.reject(new NetworkError('no such pending request', NetworkErrorCode.notFound))\n return Promise.resolve()\n },\n set: (id, patch) => {\n const cur = friends.get(id)\n if (cur === undefined) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n const { protocol: _old, ...rest } = cur\n const protocol = patch.protocol === undefined ? cur.protocol : patch.protocol.trim() === '' ? undefined : patch.protocol\n const next: Friend = {\n ...rest,\n ...(patch.remark === undefined ? {} : { remark: patch.remark, name: patch.remark }),\n ...(protocol === undefined ? {} : { protocol }),\n }\n friends.set(id, next)\n return Promise.resolve(next)\n },\n remove: (id) => {\n if (!friends.delete(id)) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n return Promise.resolve()\n },\n card: (id) => {\n const cur = friends.get(id)\n if (cur === undefined) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n return Promise.resolve({ fp: cur.fp, name: cur.cardName ?? cur.name, uri: `soulmirror://card?v=1&pk=FAKE-${cur.fp}&xpk=FAKE&name=${encodeURIComponent(cur.cardName ?? cur.name)}` })\n },\n },\n send: (to, body, options): Promise<SendReceipt> => {\n requireIdentity()\n if (!friends.has(to)) return Promise.reject(new NetworkError('not a friend (friends.add first)', NetworkErrorCode.notFriend))\n const id = mid()\n const entry = archive(to, { dir: 'out', id, body, ts: Date.now(), status: 'sent', ...(options?.auto === true ? { auto: true as const } : {}) })\n // Peer auto-reply 600 ms later, marked `auto` (loop-guard demo).\n setTimeout(() => { deliver(to, `(auto-reply) got it: \"${body.slice(0, 40)}\"`, true) }, 600)\n return Promise.resolve({ id, seq: entry.seq, status: 'sent' })\n },\n typing: (to, on) => {\n if (!friends.has(to)) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n void on\n return Promise.resolve()\n },\n conversation: (target, opts = {}) => {\n let entries = conversations.get(target) ?? []\n if (opts.since !== undefined) entries = entries.filter(e => e.seq > (opts.since as number))\n if (opts.limit !== undefined && opts.limit > 0 && entries.length > opts.limit) entries = entries.slice(-opts.limit)\n return Promise.resolve({ entries, typing: false })\n },\n markRead: (target) => {\n const cur = friends.get(target)\n if (cur === undefined) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n friends.set(target, { ...cur, unread: 0 })\n return Promise.resolve()\n },\n presence: (fps) => Promise.resolve(Object.fromEntries(fps.map(f => [f, friends.get(f)?.online ?? false]))),\n subscribe: (listener) => {\n listeners.add(listener)\n if (!firstInboundFired) {\n firstInboundFired = true\n const delay = options.firstInboundDelayMs ?? 1500\n if (delay >= 0) {\n const alice = FAKE_FRIENDS[0]!\n setTimeout(() => { deliver(alice.fp, 'Hey, are you around? Hiking this weekend - bring your alter ego too!') }, delay)\n }\n }\n return () => { listeners.delete(listener) }\n },\n dispose: () => {\n disposed = true\n listeners.clear()\n return Promise.resolve()\n },\n debug: { inject: (from, body) => { deliver(from, body) } },\n }\n}\n","/**\n * Minimal line-delimited JSON-RPC 2.0 endpoint over a pair of Node streams.\n *\n * Used by the `soulnet` backend (stdin/stdout of the peer process) and by the\n * unit tests (PassThrough streams standing in for a peer). One JSON object per\n * line; requests carry an incrementing numeric id; frames without an id are\n * notifications and are handed to `onNotification`.\n */\nimport { createInterface, type Interface } from 'node:readline'\nimport type { Readable, Writable } from 'node:stream'\n\nexport interface JsonRpcErrorShape {\n readonly code: number\n readonly message: string\n readonly data?: unknown\n}\n\n/** A JSON-RPC error response, or a transport failure (code -32099 family). */\nexport class JsonRpcError extends Error {\n override readonly name = 'JsonRpcError'\n constructor(message: string, readonly code: number, readonly data?: unknown) {\n super(message)\n }\n}\n\n/** Transport-level code: the endpoint closed before the response arrived. */\nexport const JSONRPC_CLOSED = -32099\n/** Transport-level code: no response within the request timeout. */\nexport const JSONRPC_TIMEOUT = -32098\n\nexport interface JsonRpcNotification {\n readonly method: string\n readonly params: unknown\n}\n\nexport interface JsonRpcEndpointOptions {\n /** Default per-request timeout in ms (0 = none). */\n readonly timeoutMs?: number\n readonly onNotification?: (notification: JsonRpcNotification) => void\n /** Unparseable or malformed inbound lines (never thrown). */\n readonly onProtocolError?: (error: Error, line: string) => void\n /** The read side ended (EOF/error); every pending request is rejected first. */\n readonly onClose?: (error?: Error) => void\n}\n\ninterface Pending {\n readonly resolve: (value: unknown) => void\n readonly reject: (error: Error) => void\n readonly timer: NodeJS.Timeout | undefined\n readonly method: string\n}\n\nexport class JsonRpcEndpoint {\n private readonly pending = new Map<number, Pending>()\n private readonly reader: Interface\n private nextId = 1\n private closed = false\n\n constructor(private readonly input: Readable, private readonly output: Writable, private readonly options: JsonRpcEndpointOptions = {}) {\n this.reader = createInterface({ input, crlfDelay: Infinity })\n this.reader.on('line', line => { this.handleLine(line) })\n this.reader.on('close', () => { this.close() })\n input.on('error', (error: Error) => { this.close(error) })\n output.on('error', (error: Error) => { this.close(error) })\n }\n\n get isClosed(): boolean {\n return this.closed\n }\n\n /** Send a request and await its result; rejects with {@link JsonRpcError}. */\n request(method: string, params?: unknown, options: { timeoutMs?: number; signal?: AbortSignal } = {}): Promise<unknown> {\n if (this.closed) return Promise.reject(new JsonRpcError(`${method}: endpoint is closed`, JSONRPC_CLOSED))\n const id = this.nextId++\n return new Promise<unknown>((resolve, reject) => {\n const timeoutMs = options.timeoutMs ?? this.options.timeoutMs ?? 0\n const timer = timeoutMs > 0\n ? setTimeout(() => {\n this.pending.delete(id)\n reject(new JsonRpcError(`${method}: no response within ${timeoutMs} ms`, JSONRPC_TIMEOUT))\n }, timeoutMs)\n : undefined\n timer?.unref?.()\n const settle = (fn: () => void): void => {\n if (timer !== undefined) clearTimeout(timer)\n this.pending.delete(id)\n fn()\n }\n this.pending.set(id, {\n method,\n timer,\n resolve: value => { settle(() => { resolve(value) }) },\n reject: error => { settle(() => { reject(error) }) },\n })\n if (options.signal !== undefined) {\n const onAbort = (): void => {\n const entry = this.pending.get(id)\n entry?.reject(new JsonRpcError(`${method}: aborted`, JSONRPC_CLOSED))\n }\n if (options.signal.aborted) onAbort()\n else options.signal.addEventListener('abort', onAbort, { once: true })\n }\n if (!this.write({ jsonrpc: '2.0', id, method, ...(params === undefined ? {} : { params }) })) {\n this.pending.get(id)?.reject(new JsonRpcError(`${method}: endpoint is closed`, JSONRPC_CLOSED))\n }\n })\n }\n\n /** Fire-and-forget request without an id (no response expected). */\n notify(method: string, params?: unknown): void {\n this.write({ jsonrpc: '2.0', method, ...(params === undefined ? {} : { params }) })\n }\n\n /** Reject every pending request and stop reading. Idempotent. */\n close(error?: Error): void {\n if (this.closed) return\n this.closed = true\n this.reader.close()\n const reason = new JsonRpcError(error === undefined ? 'endpoint closed' : `endpoint closed: ${error.message}`, JSONRPC_CLOSED)\n for (const entry of [...this.pending.values()]) entry.reject(reason)\n this.pending.clear()\n this.options.onClose?.(error)\n }\n\n private write(frame: object): boolean {\n if (this.closed) return false\n try {\n this.output.write(`${JSON.stringify(frame)}\\n`)\n return true\n } catch (error: unknown) {\n this.close(error instanceof Error ? error : new Error(String(error)))\n return false\n }\n }\n\n private handleLine(line: string): void {\n const trimmed = line.trim()\n if (trimmed === '') return\n let frame: unknown\n try {\n frame = JSON.parse(trimmed)\n } catch (error: unknown) {\n this.options.onProtocolError?.(error instanceof Error ? error : new Error(String(error)), line)\n return\n }\n if (typeof frame !== 'object' || frame === null) {\n this.options.onProtocolError?.(new Error('frame is not an object'), line)\n return\n }\n const f = frame as { id?: unknown; method?: unknown; params?: unknown; result?: unknown; error?: unknown }\n if (typeof f.method === 'string' && (f.id === undefined || f.id === null)) {\n this.options.onNotification?.({ method: f.method, params: f.params })\n return\n }\n if (typeof f.id !== 'number') {\n this.options.onProtocolError?.(new Error('response without a numeric id'), line)\n return\n }\n const entry = this.pending.get(f.id)\n if (entry === undefined) {\n this.options.onProtocolError?.(new Error(`response for unknown request id ${f.id}`), line)\n return\n }\n if (f.error !== undefined && f.error !== null) {\n const e = f.error as Partial<JsonRpcErrorShape>\n entry.reject(new JsonRpcError(\n typeof e.message === 'string' ? e.message : `${entry.method} failed`,\n typeof e.code === 'number' ? e.code : -32603,\n e.data,\n ))\n return\n }\n entry.resolve(f.result)\n }\n}\n","/**\n * `soulnet` backend: spawns the soulnet light peer (Go, ../cmd/soulnet) and\n * drives it over line-delimited JSON-RPC 2.0 on stdio (protocol: cmd/soulnet/\n * README.md, `initialize.protocol === \"soulnet/1\"`).\n *\n * - request/response by id, notifications → `subscribe` listeners;\n * - the process is restarted with exponential backoff when it dies;\n * - `dispose()` sends `shutdown`, then kills the process if it lingers;\n * - calls issued while the peer is (re)starting wait for it up to the request\n * timeout instead of failing immediately.\n *\n * Binary lookup (`resolveSoulnetBinary` / `locateSoulnetBinary`), in order:\n * 1. the explicit `peerBinary` setting (absolute path, or a bare name looked up on PATH);\n * 2. the platform package `soulnet-peer-<os>-<arch>` installed next to\n * this plugin as an optional dependency (`require.resolve('<pkg>/package.json')`\n * from this file and from its realpath, so pnpm's symlinked virtual store and\n * the hoisted layout both work) -> `<pkg>/bin/soulnet[.exe]`;\n * 3. `soulnet` on PATH;\n * 4. `<plugin dir>/bin/soulnet[.exe]` (a hand-dropped binary for development).\n * The winner and its source are reported in `BackendStatus.binary` / `binarySource`.\n */\nimport { spawn, type ChildProcess } from 'node:child_process'\nimport { accessSync, chmodSync, constants, realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { homedir } from 'node:os'\nimport { delimiter, dirname, isAbsolute, join } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport type { A2AMessageId, Fingerprint } from '../events.ts'\nimport { JsonRpcEndpoint, JsonRpcError, JSONRPC_CLOSED, JSONRPC_TIMEOUT } from './jsonrpc.ts'\nimport {\n NetworkError,\n NetworkErrorCode,\n type BackendStatus,\n type ConversationEntry,\n type Friend,\n type Identity,\n type NetworkClient,\n type NetworkEvent,\n type PendingRequest,\n type SendReceipt,\n} from './types.ts'\n\nexport const DEFAULT_RELAY = 'https://relay.startupworld.cn'\nexport const SOULNET_PROTOCOL = 'soulnet/1'\n\nexport type SoulnetLogger = (level: 'info' | 'warn' | 'error', message: string) => void\n\nexport interface SoulnetSpawnRequest {\n readonly binary: string\n readonly args: readonly string[]\n}\n\nexport interface SoulnetClientOptions {\n /** Data directory passed as `--home` (`a2a/` lives underneath). */\n readonly home: string\n /** Relay URL passed as `--relay` (only used when the identity is created). */\n readonly relay?: string\n /** Create the identity with this name on first start (`initialize {name}`); empty = wait for the host. */\n readonly displayName?: string\n /** Explicit binary path; when absent {@link resolveSoulnetBinary} runs. */\n readonly peerBinary?: string\n /** Per-request timeout (default 30 s; `message.send` with the relay down can take a while). */\n readonly requestTimeoutMs?: number\n /** Restart backoff (ms). Defaults: 500 → ×2 → max 30 000. */\n readonly backoff?: { readonly initialMs?: number; readonly maxMs?: number; readonly factor?: number }\n /** Test seam: replace `child_process.spawn`. */\n readonly spawn?: (request: SoulnetSpawnRequest) => ChildProcess\n readonly logger?: SoulnetLogger\n /** Extra env for the child (merged over process.env). */\n readonly env?: Record<string, string>\n}\n\n/** Default home: `$SOULNET_HOME`, else `~/.soulnet` (same rule as the binary itself). */\nexport function defaultSoulnetHome(env: NodeJS.ProcessEnv = process.env): string {\n const fromEnv = env['SOULNET_HOME']\n if (fromEnv !== undefined && fromEnv !== '') return fromEnv\n return join(homedir(), '.soulnet')\n}\n\nfunction isExecutable(path: string): boolean {\n try {\n accessSync(path, constants.F_OK)\n return true\n } catch {\n return false\n }\n}\n\n/** Where the binary came from (reported in `BackendStatus.binarySource`). */\nexport type SoulnetBinarySource = 'setting' | 'platform-package' | 'path' | 'plugin-bin'\n\nexport interface SoulnetBinaryLocation {\n readonly path: string\n readonly source: SoulnetBinarySource\n}\n\n/** npm scope of the platform packages that ship the binary. */\n/** Prefix of the per-platform binary packages on npm (`soulnet-peer-<os>-<arch>`). */\nexport const PLATFORM_PACKAGE_PREFIX = 'soulnet-peer-'\n/** The `<os>-<arch>` pairs a platform package exists for (must match dsh/packages/soulnet-*). */\nexport const PLATFORM_PACKAGE_TARGETS: readonly string[] = ['win32-x64', 'darwin-arm64', 'darwin-x64', 'linux-x64', 'linux-arm64']\n\n/** `soulnet-peer-<os>-<arch>` for a supported pair, else `undefined`. */\nexport function platformPackageName(platform: NodeJS.Platform = process.platform, arch: string = process.arch): string | undefined {\n const target = `${platform}-${arch}`\n return PLATFORM_PACKAGE_TARGETS.includes(target) ? `${PLATFORM_PACKAGE_PREFIX}${target}` : undefined\n}\n\n/**\n * Resolve an installed package's directory from this plugin's location: first\n * from this file's URL (dsh loads lib/index.js from the profile's node_modules,\n * hoisted or symlinked), then from its realpath (pnpm's isolated virtual store\n * keeps the optional dependency next to the REAL plugin directory).\n */\nfunction defaultResolvePackageDir(name: string): string | undefined {\n const bases: string[] = [import.meta.url]\n try {\n const real = realpathSync(fileURLToPath(import.meta.url))\n const realUrl = pathToFileURL(real).href\n if (realUrl !== import.meta.url) bases.push(realUrl)\n } catch {\n // not a file URL (bundled in memory) or unreadable; the first base still works\n }\n for (const base of bases) {\n try {\n return dirname(createRequire(base).resolve(`${name}/package.json`))\n } catch {\n // not installed from this base\n }\n }\n return undefined\n}\n\nfunction ensureExecutable(path: string, platform: NodeJS.Platform): void {\n if (platform === 'win32') return\n try {\n accessSync(path, constants.X_OK)\n } catch {\n try {\n chmodSync(path, 0o755) // tarballs packed on Windows lose the mode bit\n } catch {\n // read-only install: spawn will report the real error\n }\n }\n}\n\nexport interface ResolveSoulnetBinaryOptions {\n /** `process.arch` by default. */\n readonly arch?: string\n /** Test seam: package name -> installed package directory (default: `require.resolve` next to this file). */\n readonly resolvePackageDir?: (name: string) => string | undefined\n}\n\n/**\n * Find the `soulnet` binary (order documented at the top of this file) and say\n * where it came from. `undefined` when nothing was found (the caller reports a\n * clear error).\n */\nexport function locateSoulnetBinary(\n explicit: string | undefined,\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n options: ResolveSoulnetBinaryOptions = {},\n): SoulnetBinaryLocation | undefined {\n const names = platform === 'win32' ? ['soulnet.exe', 'soulnet'] : ['soulnet']\n if (explicit !== undefined && explicit.trim() !== '') {\n const candidate = explicit.trim()\n // A bare name (no separator) is looked up on PATH like the default.\n if (isAbsolute(candidate) || candidate.includes('/') || candidate.includes('\\\\')) return { path: candidate, source: 'setting' }\n for (const dir of (env['PATH'] ?? '').split(delimiter)) {\n if (dir === '') continue\n const full = join(dir, candidate)\n if (isExecutable(full)) return { path: full, source: 'setting' }\n if (platform === 'win32' && !candidate.toLowerCase().endsWith('.exe') && isExecutable(`${full}.exe`)) return { path: `${full}.exe`, source: 'setting' }\n }\n return { path: candidate, source: 'setting' }\n }\n // 2. the platform package installed as an optional dependency of this plugin\n const pkgName = platformPackageName(platform, options.arch ?? process.arch)\n if (pkgName !== undefined) {\n const dir = (options.resolvePackageDir ?? defaultResolvePackageDir)(pkgName)\n if (dir !== undefined) {\n for (const name of names) {\n const full = join(dir, 'bin', name)\n if (isExecutable(full)) {\n ensureExecutable(full, platform)\n return { path: full, source: 'platform-package' }\n }\n }\n }\n }\n // 3. PATH\n for (const dir of (env['PATH'] ?? '').split(delimiter)) {\n if (dir === '') continue\n for (const name of names) {\n const full = join(dir, name)\n if (isExecutable(full)) return { path: full, source: 'path' }\n }\n }\n // 4. lib/index.js -> ../bin ; src/network/soulnet.ts -> ../../bin\n const here = dirname(fileURLToPath(import.meta.url))\n for (const root of [join(here, '..'), join(here, '..', '..')]) {\n for (const name of names) {\n const full = join(root, 'bin', name)\n if (isExecutable(full)) return { path: full, source: 'plugin-bin' }\n }\n }\n return undefined\n}\n\n/** Path-only form of {@link locateSoulnetBinary}. */\nexport function resolveSoulnetBinary(\n explicit: string | undefined,\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n options: ResolveSoulnetBinaryOptions = {},\n): string | undefined {\n return locateSoulnetBinary(explicit, env, platform, options)?.path\n}\n\nconst fp = (s: string): Fingerprint => s as Fingerprint\nconst mid = (s: string): A2AMessageId => s as A2AMessageId\n\nfunction toMs(value: unknown): number {\n if (typeof value === 'number') return value\n if (typeof value === 'string') {\n const parsed = Date.parse(value)\n if (!Number.isNaN(parsed)) return parsed\n }\n return Date.now()\n}\n\nfunction str(value: unknown, fallback = ''): string {\n return typeof value === 'string' ? value : fallback\n}\n\nfunction shortFp(value: string): string {\n return value.length > 12 ? `${value.slice(0, 12)}…` : value\n}\n\n// ——— wire shapes (subset of what soulnet returns; see cmd/soulnet/rpc.go) ———\n\ninterface WireIdentity { name?: string; fingerprint?: string; created_at?: string }\ninterface WireCard { name?: string }\ninterface WireMessage {\n id?: string; from?: string; to?: string; ts?: string; type?: string; body?: string; auto?: boolean\n artifact_name?: string; card?: WireCard\n}\ninterface WireFriend {\n fingerprint?: string; note?: string; protocol?: string; card?: WireCard; added_at?: string\n count?: number; unread?: number; last?: WireMessage; typing?: boolean\n}\ninterface WirePending { id?: string; peer?: string; incoming?: WireMessage; created_at?: string }\ninterface WireEntry extends WireMessage { seq?: number; dir?: string; status?: string }\n\nexport function friendFromWire(w: WireFriend): Friend {\n const fingerprint = str(w.fingerprint)\n const note = str(w.note)\n const cardName = str(w.card?.name)\n const name = note !== '' ? note : cardName !== '' ? cardName : shortFp(fingerprint)\n return {\n fp: fp(fingerprint),\n name,\n ...(note === '' ? {} : { remark: note }),\n ...(cardName === '' ? {} : { cardName }),\n ...(str(w.protocol) === '' ? {} : { protocol: str(w.protocol) }),\n unread: typeof w.unread === 'number' ? w.unread : 0,\n count: typeof w.count === 'number' ? w.count : 0,\n ...(w.last?.ts === undefined ? {} : { lastTs: toMs(w.last.ts) }),\n ...(w.last?.body === undefined ? {} : { lastBody: w.last.body }),\n ...(w.typing === true ? { typing: true } : {}),\n ...(w.added_at === undefined ? {} : { addedAt: w.added_at }),\n }\n}\n\nexport function pendingFromWire(w: WirePending): PendingRequest {\n const peer = str(w.peer)\n const cardName = str(w.incoming?.card?.name)\n return {\n id: str(w.id),\n fp: fp(peer),\n name: cardName !== '' ? cardName : shortFp(peer),\n greeting: str(w.incoming?.body),\n ...(w.created_at === undefined ? {} : { createdAt: w.created_at }),\n }\n}\n\nfunction entryFromWire(w: WireEntry): ConversationEntry {\n return {\n seq: typeof w.seq === 'number' ? w.seq : 0,\n dir: w.dir === 'out' ? 'out' : 'in',\n id: mid(str(w.id)),\n body: str(w.body),\n ts: toMs(w.ts),\n ...(w.type === undefined || w.type === '' ? {} : { type: w.type }),\n ...(w.auto === true ? { auto: true as const } : {}),\n ...(w.status === undefined || w.status === '' ? {} : { status: w.status }),\n ...(w.artifact_name === undefined || w.artifact_name === '' ? {} : { artifactName: w.artifact_name }),\n }\n}\n\nfunction toNetworkError(error: unknown, method: string): NetworkError {\n if (error instanceof NetworkError) return error\n if (error instanceof JsonRpcError) {\n const code = error.code === JSONRPC_CLOSED || error.code === JSONRPC_TIMEOUT ? NetworkErrorCode.peerUnavailable : error.code\n return new NetworkError(error.message, code, error.data)\n }\n return new NetworkError(`${method}: ${String(error)}`, -32603)\n}\n\n/**\n * Create the soulnet-backed NetworkClient. The process is spawned lazily on\n * the first call or on `start()`; `dispose()` stops it.\n */\nexport function createSoulnetNetworkClient(options: SoulnetClientOptions): NetworkClient & { start(): void } {\n const log: SoulnetLogger = options.logger ?? (() => {})\n const relay = options.relay !== undefined && options.relay.trim() !== '' ? options.relay.trim() : DEFAULT_RELAY\n const requestTimeoutMs = options.requestTimeoutMs ?? 30_000\n const backoffInitial = options.backoff?.initialMs ?? 500\n const backoffMax = options.backoff?.maxMs ?? 30_000\n const backoffFactor = options.backoff?.factor ?? 2\n\n const listeners = new Set<(event: NetworkEvent) => void>()\n let child: ChildProcess | undefined\n let endpoint: JsonRpcEndpoint | undefined\n let disposed = false\n let started = false\n let restarts = 0\n let backoffMs = backoffInitial\n let restartTimer: NodeJS.Timeout | undefined\n let status: BackendStatus = { backend: 'soulnet', state: 'stopped', restarts: 0, relay, home: options.home }\n let cachedCardUri: string | undefined\n const friendNames = new Map<string, string>()\n\n // Waiters for \"endpoint is up\" (calls made while (re)starting).\n let readyWaiters: { resolve: (endpoint: JsonRpcEndpoint) => void; reject: (error: Error) => void }[] = []\n\n const emit = (event: NetworkEvent): void => {\n for (const listener of listeners) {\n try {\n listener(event)\n } catch (error: unknown) {\n log('warn', `network listener failed: ${String(error)}`)\n }\n }\n }\n const setStatus = (patch: Partial<BackendStatus>): void => {\n status = { ...status, ...patch }\n emit({ kind: 'status', status })\n }\n const clearError = (): void => {\n const { lastError: _dropped, ...rest } = status\n status = rest\n }\n\n const handleNotification = (method: string, params: unknown): void => {\n const p = (typeof params === 'object' && params !== null ? params : {}) as {\n peer?: string; seq?: number; message?: WireMessage; artifact_path?: string; artifact_name?: string\n pending_id?: string; friend?: WireFriend; on?: boolean\n }\n const peer = str(p.peer)\n switch (method) {\n case 'message.received': {\n const m = p.message ?? {}\n const type = str(m.type, 'text')\n const name = friendNames.get(peer) ?? shortFp(peer)\n const body = str(m.body) !== '' ? str(m.body) : type === 'app_share' ? '[app share]' : ''\n emit({\n kind: 'message',\n message: {\n id: mid(str(m.id)),\n from: fp(peer),\n name,\n body,\n ts: toMs(m.ts),\n ...(typeof p.seq === 'number' ? { seq: p.seq } : {}),\n ...(m.auto === true ? { auto: true as const } : {}),\n ...(type === 'text' ? {} : { type }),\n ...(p.artifact_path === undefined || p.artifact_path === '' ? {} : { artifactPath: p.artifact_path }),\n ...(m.artifact_name === undefined || m.artifact_name === '' ? {} : { artifactName: m.artifact_name }),\n },\n })\n return\n }\n case 'friend.request': {\n const m = p.message ?? {}\n const cardName = str(m.card?.name)\n emit({\n kind: 'friend_request',\n request: { id: str(p.pending_id), fp: fp(peer), name: cardName !== '' ? cardName : shortFp(peer), greeting: str(m.body) },\n })\n return\n }\n case 'friend.accepted': {\n const friend = friendFromWire(p.friend ?? { fingerprint: peer })\n friendNames.set(friend.fp, friend.name)\n emit({ kind: 'friend_accept', friend })\n return\n }\n case 'typing':\n emit({ kind: 'typing', fp: fp(peer), on: p.on === true })\n return\n case 'presence.changed':\n emit({ kind: 'presence', fp: fp(peer), online: p.on === true })\n return\n case 'mission.update':\n case 'artifact.ready':\n log('info', `soulnet notification ${method} from ${shortFp(peer)} (not handled in M1)`)\n return\n default:\n log('warn', `unknown soulnet notification ${method}`)\n }\n }\n\n const failWaiters = (error: Error): void => {\n const waiters = readyWaiters\n readyWaiters = []\n for (const w of waiters) w.reject(error)\n }\n\n const scheduleRestart = (reason: string): void => {\n if (disposed) return\n restarts += 1\n const delay = backoffMs\n backoffMs = Math.min(backoffMax, Math.round(backoffMs * backoffFactor))\n setStatus({ state: 'restarting', restarts, lastError: reason })\n log('warn', `soulnet peer died (${reason}); restart #${restarts} in ${delay} ms`)\n restartTimer = setTimeout(() => {\n restartTimer = undefined\n spawnPeer()\n }, delay)\n restartTimer.unref?.()\n }\n\n const spawnPeer = (): void => {\n if (disposed) return\n const location = locateSoulnetBinary(options.peerBinary)\n if (location === undefined) {\n const pkg = platformPackageName() ?? `${PLATFORM_PACKAGE_PREFIX}<os>-<arch> (none published for ${process.platform}-${process.arch})`\n const message = `soulnet binary not found: the platform package ${pkg} is not installed next to the plugin (reinstall with optional dependencies enabled), or set \\`peerBinary\\` in the SoulMirror network settings, put \\`soulnet\\` on PATH, or place it in the plugin's bin/ directory`\n setStatus({ state: 'error', lastError: message })\n log('error', message)\n failWaiters(new NetworkError(message, NetworkErrorCode.peerUnavailable))\n return\n }\n const binary = location.path\n const args = ['--home', options.home, '--relay', relay]\n clearError()\n setStatus({ state: 'starting', binary, binarySource: location.source })\n log('info', `soulnet binary: ${binary} (${location.source})`)\n let proc: ChildProcess\n try {\n proc = options.spawn !== undefined\n ? options.spawn({ binary, args })\n : spawn(binary, args, { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true, env: { ...process.env, ...(options.env ?? {}) } })\n } catch (error: unknown) {\n scheduleRestart(`spawn failed: ${String(error)}`)\n return\n }\n child = proc\n if (proc.stdout === null || proc.stdin === null) {\n proc.kill()\n scheduleRestart('spawned process has no stdio pipes')\n return\n }\n proc.stderr?.setEncoding('utf8')\n proc.stderr?.on('data', (chunk: string) => {\n for (const line of chunk.split(/\\r?\\n/)) if (line.trim() !== '') log('info', `[soulnet] ${line.trim()}`)\n })\n const ep = new JsonRpcEndpoint(proc.stdout, proc.stdin, {\n timeoutMs: requestTimeoutMs,\n onNotification: n => { handleNotification(n.method, n.params) },\n onProtocolError: (error, line) => { log('warn', `soulnet protocol: ${error.message}: ${line.slice(0, 200)}`) },\n })\n endpoint = ep\n let exited = false\n proc.on('error', (error: Error) => {\n if (exited) return\n exited = true\n if (endpoint === ep) endpoint = undefined\n ep.close(error)\n scheduleRestart(`process error: ${error.message}`)\n })\n proc.on('exit', (code, signal) => {\n if (exited) return\n exited = true\n if (endpoint === ep) endpoint = undefined\n if (child === proc) child = undefined\n ep.close()\n if (disposed) {\n setStatus({ state: 'stopped' })\n return\n }\n scheduleRestart(`exit code=${code ?? 'null'} signal=${signal ?? 'none'}`)\n })\n // Handshake: initialize (creates the identity when a display name is configured and none exists).\n const name = options.displayName?.trim() ?? ''\n void ep.request('initialize', name === '' ? {} : { name }, { timeoutMs: 15_000 }).then((result) => {\n const r = (typeof result === 'object' && result !== null ? result : {}) as { protocol?: string; version?: string; identity?: WireIdentity | null; home?: string; relay?: string }\n if (r.protocol !== SOULNET_PROTOCOL) log('warn', `soulnet speaks ${String(r.protocol)}; this plugin was written for ${SOULNET_PROTOCOL}`)\n backoffMs = backoffInitial\n cachedCardUri = undefined\n setStatus({\n state: 'ready',\n ...(proc.pid === undefined ? {} : { pid: proc.pid }),\n ...(r.protocol === undefined ? {} : { protocol: r.protocol }),\n ...(r.version === undefined ? {} : { version: r.version }),\n ...(r.home === undefined ? {} : { home: r.home }),\n ...(r.relay === undefined ? {} : { relay: r.relay }),\n })\n log('info', `soulnet peer ready pid=${proc.pid ?? '?'} protocol=${String(r.protocol)} identity=${r.identity?.fingerprint ?? 'none'}`)\n const waiters = readyWaiters\n readyWaiters = []\n for (const w of waiters) w.resolve(ep)\n }).catch((error: unknown) => {\n if (exited || disposed) return\n log('error', `soulnet initialize failed: ${String(error)}`)\n proc.kill()\n })\n }\n\n const ready = (timeoutMs: number): Promise<JsonRpcEndpoint> => {\n if (disposed) return Promise.reject(new NetworkError('soulnet backend is disposed', NetworkErrorCode.peerUnavailable))\n if (endpoint !== undefined && !endpoint.isClosed && status.state === 'ready') return Promise.resolve(endpoint)\n if (!started) start()\n if (status.state === 'error') return Promise.reject(new NetworkError(status.lastError ?? 'soulnet backend unavailable', NetworkErrorCode.peerUnavailable))\n return new Promise<JsonRpcEndpoint>((resolve, reject) => {\n const timer = setTimeout(() => {\n readyWaiters = readyWaiters.filter(w => w.resolve !== resolve)\n reject(new NetworkError(`soulnet peer not ready within ${timeoutMs} ms (state=${status.state})`, NetworkErrorCode.peerUnavailable))\n }, timeoutMs)\n timer.unref?.()\n readyWaiters.push({\n resolve: ep => { clearTimeout(timer); resolve(ep) },\n reject: error => { clearTimeout(timer); reject(error) },\n })\n })\n }\n\n const call = async <T>(method: string, params?: unknown, timeoutMs = requestTimeoutMs): Promise<T> => {\n const ep = await ready(timeoutMs)\n try {\n return (await ep.request(method, params, { timeoutMs })) as T\n } catch (error: unknown) {\n throw toNetworkError(error, method)\n }\n }\n\n const start = (): void => {\n if (started || disposed) return\n started = true\n spawnPeer()\n }\n\n const identity = async (): Promise<Identity | undefined> => {\n const r = await call<{ identity?: WireIdentity | null }>('identity.get')\n if (r.identity === undefined || r.identity === null) return undefined\n const cardUri = await card()\n return {\n fp: fp(str(r.identity.fingerprint)),\n name: str(r.identity.name),\n cardUri,\n ...(r.identity.created_at === undefined ? {} : { createdAt: r.identity.created_at }),\n }\n }\n\n const card = async (): Promise<string> => {\n if (cachedCardUri !== undefined) return cachedCardUri\n const r = await call<{ uri?: string }>('card.get')\n cachedCardUri = str(r.uri)\n return cachedCardUri\n }\n\n const rememberNames = (friends: readonly Friend[]): void => {\n for (const f of friends) friendNames.set(f.fp, f.name)\n }\n\n const client: NetworkClient & { start(): void } = {\n backend: 'soulnet',\n start,\n status: () => status,\n identity,\n createIdentity: async (name) => {\n const r = await call<{ identity?: WireIdentity }>('identity.create', { name })\n cachedCardUri = undefined\n const cardUri = await card()\n return { fp: fp(str(r.identity?.fingerprint)), name: str(r.identity?.name, name), cardUri }\n },\n card,\n parseCard: async (uri) => {\n const r = await call<{ uri?: string; fingerprint?: string; card?: WireCard }>('card.parse', { uri })\n return { fp: fp(str(r.fingerprint)), name: str(r.card?.name), uri: str(r.uri, uri) }\n },\n friends: {\n list: async () => {\n const r = await call<{ friends?: WireFriend[] }>('friends.list')\n const friends = (r.friends ?? []).map(friendFromWire)\n rememberNames(friends)\n return friends\n },\n pending: async () => {\n const r = await call<{ pending?: WirePending[] }>('friends.pending')\n return (r.pending ?? []).map(pendingFromWire)\n },\n add: async (cardUri, note) => {\n const r = await call<{ friend?: WireFriend }>('friends.add', { card_uri: cardUri, ...(note === undefined ? {} : { note }) })\n const friend = friendFromWire(r.friend ?? {})\n friendNames.set(friend.fp, friend.name)\n return friend\n },\n accept: async (requestId, note) => {\n const r = await call<{ friend?: WireFriend }>('friends.accept', { id: requestId, ...(note === undefined ? {} : { note }) })\n const friend = friendFromWire(r.friend ?? {})\n friendNames.set(friend.fp, friend.name)\n return friend\n },\n reject: async (requestId) => {\n await call('friends.reject', { id: requestId })\n },\n set: async (target, patch) => {\n const r = await call<{ friend?: WireFriend }>('friends.set', {\n fp: target,\n ...(patch.remark === undefined ? {} : { note: patch.remark }),\n ...(patch.protocol === undefined ? {} : { protocol: patch.protocol }),\n })\n const friend = friendFromWire(r.friend ?? {})\n friendNames.set(friend.fp, friend.name)\n return friend\n },\n remove: async (target) => {\n await call('friends.remove', { fp: target })\n friendNames.delete(target)\n },\n card: async (target) => {\n const r = await call<{ uri?: string; fingerprint?: string; card?: WireCard }>('friends.card', { fp: target })\n return { fp: fp(str(r.fingerprint, target)), name: str(r.card?.name), uri: str(r.uri) }\n },\n },\n send: async (to, body, options) => {\n const r = await call<{ id?: string; seq?: number; status?: string }>('message.send', {\n to,\n body,\n ...(options?.file === undefined ? {} : { file: options.file }),\n ...(options?.auto === true ? { auto: true } : {}),\n })\n const receipt: SendReceipt = { id: mid(str(r.id)), status: str(r.status, 'sent'), ...(typeof r.seq === 'number' ? { seq: r.seq } : {}) }\n return receipt\n },\n typing: async (to, on) => {\n await call('message.typing', { to, on }, 10_000)\n },\n conversation: async (target, opts = {}) => {\n const r = await call<{ entries?: WireEntry[]; typing?: boolean }>('conversation.get', {\n fp: target,\n ...(opts.since === undefined ? {} : { since: opts.since }),\n ...(opts.limit === undefined ? {} : { limit: opts.limit }),\n })\n return { entries: (r.entries ?? []).map(entryFromWire), typing: r.typing === true }\n },\n markRead: async (target, seq) => {\n await call('conversation.markRead', { fp: target, seq })\n },\n presence: async (fps) => {\n const r = await call<{ online?: Record<string, boolean> }>('presence', { fps: [...fps] }, 15_000)\n return r.online ?? {}\n },\n subscribe: (listener) => {\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n },\n dispose: async () => {\n if (disposed) return\n disposed = true\n if (restartTimer !== undefined) {\n clearTimeout(restartTimer)\n restartTimer = undefined\n }\n failWaiters(new NetworkError('soulnet backend is disposed', NetworkErrorCode.peerUnavailable))\n const proc = child\n const ep = endpoint\n if (proc === undefined) {\n setStatus({ state: 'stopped' })\n return\n }\n const exited = new Promise<void>((resolve) => {\n if (proc.exitCode !== null || proc.signalCode !== null) {\n resolve()\n return\n }\n proc.once('exit', () => { resolve() })\n })\n if (ep !== undefined && !ep.isClosed) {\n try {\n await ep.request('shutdown', undefined, { timeoutMs: 2_000 })\n } catch {\n // fall through to kill\n }\n }\n const killTimer = setTimeout(() => { proc.kill() }, 2_000)\n killTimer.unref?.()\n await exited\n clearTimeout(killTimer)\n ep?.close()\n setStatus({ state: 'stopped' })\n log('info', 'soulnet peer stopped')\n },\n }\n return client\n}\n","//#region lib/types/misc.js\n/** No-op callback returning `undefined` at runtime and `any` at type level. */\nfunction noop() {}\n/** Return true when a value is `null` or `undefined`. */\nfunction isNullable(value) {\n\treturn value === null || value === void 0;\n}\n/** Return true when a value is neither `null` nor `undefined`. */\nfunction isNonNullable(value) {\n\treturn !isNullable(value);\n}\n/** Return true for non-array object values. */\nfunction isPlainObject(data) {\n\treturn data && typeof data === \"object\" && !Array.isArray(data);\n}\n/** Filter object entries and return a new object. */\nfunction filterKeys(object, filter) {\n\treturn Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));\n}\n/** Map object values while preserving the original key set. */\nfunction mapValues(object, transform) {\n\treturn Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));\n}\n/** Pick selected keys from an object, optionally including `undefined` values. */\nfunction pick(source, keys, forced) {\n\tif (!keys) return { ...source };\n\tconst result = {};\n\tfor (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];\n\treturn result;\n}\n/** Omit selected keys from a shallow object copy. */\nfunction omit(source, keys) {\n\tif (!keys) return { ...source };\n\tconst result = { ...source };\n\tfor (const key of keys) Reflect.deleteProperty(result, key);\n\treturn result;\n}\n/** Define a non-enumerable writable property and return the object. */\nfunction defineProperty(object, key, value) {\n\treturn Object.defineProperty(object, key, {\n\t\twritable: true,\n\t\tvalue,\n\t\tenumerable: false\n\t});\n}\n//#endregion\n//#region lib/types/array.js\n/** Return true when every item in `array2` is present in `array1`. */\nfunction contain(array1, array2) {\n\treturn array2.every((item) => array1.includes(item));\n}\n/** Return items that appear in both arrays. */\nfunction intersection(array1, array2) {\n\treturn array1.filter((item) => array2.includes(item));\n}\n/** Return items from `array1` that do not appear in `array2`. */\nfunction difference(array1, array2) {\n\treturn array1.filter((item) => !array2.includes(item));\n}\n/** Return the set-union of two arrays while preserving first occurrence order. */\nfunction union(array1, array2) {\n\treturn Array.from(new Set([...array1, ...array2]));\n}\n/** Remove duplicate values while preserving first occurrence order. */\nfunction deduplicate(array) {\n\treturn [...new Set(array)];\n}\n/** Remove one item from an array and report whether it was found. */\nfunction remove(list, item) {\n\tconst index = list?.indexOf(item);\n\tif (index >= 0) {\n\t\tlist.splice(index, 1);\n\t\treturn true;\n\t} else return false;\n}\n/** Normalize nullish, scalar, or array input to an array. */\nfunction makeArray(source) {\n\treturn Array.isArray(source) ? source : isNullable(source) ? [] : [source];\n}\n//#endregion\n//#region lib/types/types.js\n/** Test values using `instanceof` with a `toStringTag` fallback. */\nfunction is(type, value) {\n\tif (arguments.length === 1) return (value) => is(type, value);\n\treturn type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;\n}\nfunction isArrayBufferLike(value) {\n\treturn is(\"ArrayBuffer\", value) || is(\"SharedArrayBuffer\", value);\n}\nfunction isArrayBufferSource(value) {\n\treturn isArrayBufferLike(value) || ArrayBuffer.isView(value);\n}\n/** Binary source detection and base64/hex conversion helpers. */\nvar Binary;\n(function(Binary) {\n\tBinary.is = isArrayBufferLike;\n\tBinary.isSource = isArrayBufferSource;\n\tfunction fromSource(source) {\n\t\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\t\telse return source;\n\t}\n\tBinary.fromSource = fromSource;\n\tfunction toBase64(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"base64\");\n\t\tlet binary = \"\";\n\t\tconst bytes = new Uint8Array(source);\n\t\tfor (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);\n\t\treturn btoa(binary);\n\t}\n\tBinary.toBase64 = toBase64;\n\tfunction fromBase64(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"base64\"));\n\t\treturn Uint8Array.from(atob(source), (c) => c.charCodeAt(0));\n\t}\n\tBinary.fromBase64 = fromBase64;\n\tfunction toHex(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"hex\");\n\t\treturn Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\t}\n\tBinary.toHex = toHex;\n\tfunction fromHex(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"hex\"));\n\t\tconst hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);\n\t\tconst buffer = [];\n\t\tfor (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));\n\t\treturn Uint8Array.from(buffer).buffer;\n\t}\n\tBinary.fromHex = fromHex;\n})(Binary || (Binary = {}));\n/** Decode a base64 string into binary data. */\nconst base64ToArrayBuffer = Binary.fromBase64;\n/** Encode binary data as base64. */\nconst arrayBufferToBase64 = Binary.toBase64;\n/** Decode a hex string into binary data. */\nconst hexToArrayBuffer = Binary.fromHex;\n/** Encode binary data as hex. */\nconst arrayBufferToHex = Binary.toHex;\n/** Deep-clone common JavaScript values while preserving prototypes and cycles. */\nfunction clone(source, refs = /* @__PURE__ */ new Map()) {\n\tif (!source || typeof source !== \"object\") return source;\n\tif (is(\"Date\", source)) return new Date(source.valueOf());\n\tif (is(\"RegExp\", source)) return new RegExp(source.source, source.flags);\n\tif (isArrayBufferLike(source)) return source.slice(0);\n\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\tconst cached = refs.get(source);\n\tif (cached) return cached;\n\tif (Array.isArray(source)) {\n\t\tconst result = [];\n\t\trefs.set(source, result);\n\t\tsource.forEach((value, index) => {\n\t\t\tresult[index] = Reflect.apply(clone, null, [value, refs]);\n\t\t});\n\t\treturn result;\n\t}\n\tconst result = Object.create(Object.getPrototypeOf(source));\n\trefs.set(source, result);\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tconst descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };\n\t\tif (\"value\" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);\n\t\tReflect.defineProperty(result, key, descriptor);\n\t}\n\treturn result;\n}\n/** Deeply compare arrays, dates, regexps, buffers, and plain object fields. */\nfunction deepEqual(a, b, strict) {\n\tif (a === b) return true;\n\tif (!strict && isNullable(a) && isNullable(b)) return true;\n\tif (typeof a !== typeof b) return false;\n\tif (typeof a !== \"object\") return false;\n\tif (!a || !b) return false;\n\tfunction check(test, then) {\n\t\treturn test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;\n\t}\n\treturn check(Array.isArray, (a, b) => a.length === b.length && a.every((item, index) => deepEqual(item, b[index]))) ?? check(is(\"Date\"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is(\"RegExp\"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {\n\t\tif (a.byteLength !== b.byteLength) return false;\n\t\tconst viewA = new Uint8Array(a);\n\t\tconst viewB = new Uint8Array(b);\n\t\tfor (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;\n\t\treturn true;\n\t}) ?? Object.keys({\n\t\t...a,\n\t\t...b\n\t}).every((key) => deepEqual(a[key], b[key], strict));\n}\n//#endregion\n//#region lib/types/string.js\n/** Uppercase the first character of a string. */\nfunction capitalize(source) {\n\treturn source.charAt(0).toUpperCase() + source.slice(1);\n}\n/** Lowercase the first character of a string. */\nfunction uncapitalize(source) {\n\treturn source.charAt(0).toLowerCase() + source.slice(1);\n}\n/** Convert dash or underscore delimited text to camelCase. */\nfunction camelCase(source) {\n\treturn source.replace(/[_-][a-z]/g, (str) => str.slice(1).toUpperCase());\n}\nfunction tokenize(source, delimiters, delimiter) {\n\tconst output = [];\n\tlet state = 0;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tconst code = source.charCodeAt(i);\n\t\tif (code >= 65 && code <= 90) {\n\t\t\tif (state === 1) {\n\t\t\t\tconst next = source.charCodeAt(i + 1);\n\t\t\t\tif (next >= 97 && next <= 122) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t} else {\n\t\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t}\n\t\t\tstate = 1;\n\t\t} else if (code >= 97 && code <= 122) {\n\t\t\toutput.push(code);\n\t\t\tstate = 2;\n\t\t} else if (delimiters.includes(code)) {\n\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\tstate = 0;\n\t\t} else output.push(code);\n\t}\n\treturn String.fromCharCode(...output);\n}\n/** Convert text to dash-delimited parameter case. */\nfunction paramCase(source) {\n\treturn tokenize(source, [45, 95], 45);\n}\n/** Convert text to underscore-delimited snake case. */\nfunction snakeCase(source) {\n\treturn tokenize(source, [45, 95], 95);\n}\n/** Runtime alias for `camelCase`. */\nconst camelize = camelCase;\n/** Runtime alias for `paramCase`. */\nconst hyphenate = paramCase;\n/** Format a property key as a JavaScript member access suffix. */\nfunction formatProperty(key) {\n\tif (typeof key !== \"string\") return `[${key.toString()}]`;\n\treturn /^[a-z_$][\\w$]*$/i.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n}\n/** Remove one trailing slash from a path string. */\nfunction trimSlash(source) {\n\treturn source.replace(/\\/$/, \"\");\n}\n/** Ensure a path starts with `/` and has no trailing slash. */\nfunction sanitize(source) {\n\tif (!source.startsWith(\"/\")) source = \"/\" + source;\n\treturn trimSlash(source);\n}\n//#endregion\n//#region lib/types/time.js\n/** Time constants plus parsing and formatting helpers. */\nvar Time;\n(function(Time) {\n\tTime.millisecond = 1;\n\tTime.second = 1e3;\n\tTime.minute = Time.second * 60;\n\tTime.hour = Time.minute * 60;\n\tTime.day = Time.hour * 24;\n\tTime.week = Time.day * 7;\n\tlet timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();\n\tfunction setTimezoneOffset(offset) {\n\t\ttimezoneOffset = offset;\n\t}\n\tTime.setTimezoneOffset = setTimezoneOffset;\n\tfunction getTimezoneOffset() {\n\t\treturn timezoneOffset;\n\t}\n\tTime.getTimezoneOffset = getTimezoneOffset;\n\tfunction getDateNumber(date = /* @__PURE__ */ new Date(), offset) {\n\t\tif (typeof date === \"number\") date = new Date(date);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn Math.floor((date.valueOf() / Time.minute - offset) / 1440);\n\t}\n\tTime.getDateNumber = getDateNumber;\n\tfunction fromDateNumber(value, offset) {\n\t\tconst date = new Date(value * Time.day);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn new Date(+date + offset * Time.minute);\n\t}\n\tTime.fromDateNumber = fromDateNumber;\n\tconst numeric = /\\d+(?:\\.\\d+)?/.source;\n\tconst timeRegExp = new RegExp(`^${[\n\t\t\"w(?:eek(?:s)?)?\",\n\t\t\"d(?:ay(?:s)?)?\",\n\t\t\"h(?:our(?:s)?)?\",\n\t\t\"m(?:in(?:ute)?(?:s)?)?\",\n\t\t\"s(?:ec(?:ond)?(?:s)?)?\"\n\t].map((unit) => `(${numeric}${unit})?`).join(\"\")}$`);\n\tfunction parseTime(source) {\n\t\tconst capture = timeRegExp.exec(source);\n\t\tif (!capture) return 0;\n\t\treturn (parseFloat(capture[1]) * Time.week || 0) + (parseFloat(capture[2]) * Time.day || 0) + (parseFloat(capture[3]) * Time.hour || 0) + (parseFloat(capture[4]) * Time.minute || 0) + (parseFloat(capture[5]) * Time.second || 0);\n\t}\n\tTime.parseTime = parseTime;\n\tfunction parseDate(date) {\n\t\tconst parsed = parseTime(date);\n\t\tif (parsed) date = Date.now() + parsed;\n\t\telse if (/^\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;\n\t\telse if (/^\\d{1,2}-\\d{1,2}-\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;\n\t\treturn date ? new Date(date) : /* @__PURE__ */ new Date();\n\t}\n\tTime.parseDate = parseDate;\n\tfunction format(ms) {\n\t\tconst abs = Math.abs(ms);\n\t\tif (abs >= Time.day - Time.hour / 2) return Math.round(ms / Time.day) + \"d\";\n\t\telse if (abs >= Time.hour - Time.minute / 2) return Math.round(ms / Time.hour) + \"h\";\n\t\telse if (abs >= Time.minute - Time.second / 2) return Math.round(ms / Time.minute) + \"m\";\n\t\telse if (abs >= Time.second) return Math.round(ms / Time.second) + \"s\";\n\t\treturn ms + \"ms\";\n\t}\n\tTime.format = format;\n\tfunction toDigits(source, length = 2) {\n\t\treturn source.toString().padStart(length, \"0\");\n\t}\n\tTime.toDigits = toDigits;\n\tfunction template(template, time = /* @__PURE__ */ new Date()) {\n\t\treturn template.replace(\"yyyy\", time.getFullYear().toString()).replace(\"yy\", time.getFullYear().toString().slice(2)).replace(\"MM\", toDigits(time.getMonth() + 1)).replace(\"dd\", toDigits(time.getDate())).replace(\"hh\", toDigits(time.getHours())).replace(\"mm\", toDigits(time.getMinutes())).replace(\"ss\", toDigits(time.getSeconds())).replace(\"SSS\", toDigits(time.getMilliseconds(), 3));\n\t}\n\tTime.template = template;\n})(Time || (Time = {}));\n//#endregion\nexport { Binary, Time, arrayBufferToBase64, arrayBufferToHex, base64ToArrayBuffer, camelCase, camelize, capitalize, clone, contain, deduplicate, deepEqual, defineProperty, difference, filterKeys, formatProperty, hexToArrayBuffer, hyphenate, intersection, is, isNonNullable, isNullable, isPlainObject, makeArray, mapValues, mapValues as valueMap, noop, omit, paramCase, pick, remove, sanitize, snakeCase, trimSlash, uncapitalize, union };\n","import { Binary, clone, deepEqual, filterKeys, isNullable, isPlainObject, pick, valueMap } from \"@deepseek-ai/cosmokit\";\n//#region lib/types/index.js\nconst kSchema = Symbol.for(\"schemastery\");\nconst kValidationError = Symbol.for(\"ValidationError\");\nglobalThis.__schemastery_index__ ??= 0;\nglobalThis.__schemastery_refs__ = void 0;\nvar ValidationError = class extends TypeError {\n\toptions;\n\tname = \"ValidationError\";\n\tconstructor(message, options) {\n\t\tlet prefix = \"$\";\n\t\tfor (const segment of options.path || []) if (typeof segment === \"string\") prefix += \".\" + segment;\n\t\telse if (typeof segment === \"number\") prefix += \"[\" + segment + \"]\";\n\t\telse if (typeof segment === \"symbol\") prefix += `[Symbol(${segment.toString()})]`;\n\t\tif (prefix.startsWith(\".\")) prefix = prefix.slice(1);\n\t\tsuper((prefix === \"$\" ? \"\" : `${prefix} `) + message);\n\t\tthis.options = options;\n\t}\n\tstatic is(error) {\n\t\treturn !!error?.[kValidationError];\n\t}\n};\nObject.defineProperty(ValidationError.prototype, kValidationError, { value: true });\nconst Schema = function(options) {\n\tconst schema = function(data, options = {}) {\n\t\treturn Schema.resolve(data, schema, options)[0];\n\t};\n\tif (options.refs) {\n\t\tconst refs = valueMap(options.refs, (options) => new Schema(options));\n\t\tconst getRef = (uid) => refs[uid];\n\t\tfor (const key in refs) {\n\t\t\tconst options = refs[key];\n\t\t\toptions.sKey = getRef(options.sKey);\n\t\t\toptions.inner = getRef(options.inner);\n\t\t\toptions.list = options.list && options.list.map(getRef);\n\t\t\toptions.dict = options.dict && valueMap(options.dict, getRef);\n\t\t}\n\t\treturn refs[options.uid];\n\t}\n\tObject.assign(schema, options);\n\tif (typeof schema.callback === \"string\") try {\n\t\tschema.callback = new Function(\"return \" + schema.callback)();\n\t} catch {}\n\tObject.defineProperty(schema, \"uid\", { value: globalThis.__schemastery_index__++ });\n\tObject.setPrototypeOf(schema, Schema.prototype);\n\tschema.meta ||= {};\n\tschema.toString = schema.toString.bind(schema);\n\treturn schema;\n};\nSchema.prototype = Object.create(Function.prototype);\nSchema.prototype[kSchema] = true;\nObject.defineProperty(Schema.prototype, \"~standard\", { get() {\n\treturn {\n\t\tversion: 1,\n\t\tvendor: \"schemastery\",\n\t\tvalidate: (value) => {\n\t\t\ttry {\n\t\t\t\treturn { value: Schema.resolve(value, this, {})[0] };\n\t\t\t} catch (error) {\n\t\t\t\tif (ValidationError.is(error)) return { issues: [{\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tpath: error.options.path\n\t\t\t\t}] };\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t};\n} });\nSchema.ValidationError = ValidationError;\nSchema.prototype.toJSON = function toJSON() {\n\tif (globalThis.__schemastery_refs__) {\n\t\tglobalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));\n\t\treturn this.uid;\n\t}\n\tglobalThis.__schemastery_refs__ = { [this.uid]: { ...this } };\n\tglobalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));\n\tconst result = {\n\t\tuid: this.uid,\n\t\trefs: globalThis.__schemastery_refs__\n\t};\n\tglobalThis.__schemastery_refs__ = void 0;\n\treturn result;\n};\nSchema.prototype.set = function set(key, value) {\n\tthis.dict[key] = value;\n\treturn this;\n};\nSchema.prototype.push = function push(value) {\n\tthis.list.push(value);\n\treturn this;\n};\nfunction mergeDesc(original, messages) {\n\tconst result = typeof original === \"string\" ? { \"\": original } : { ...original };\n\tfor (const locale in messages) {\n\t\tconst value = messages[locale];\n\t\tif (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;\n\t\telse if (typeof value === \"string\") result[locale] = value;\n\t}\n\treturn result;\n}\nfunction getInner(value) {\n\treturn value?.$value ?? value?.$inner;\n}\nfunction extractKeys(data) {\n\treturn filterKeys(data ?? {}, (key) => !key.startsWith(\"$\"));\n}\nSchema.prototype.i18n = function i18n(messages) {\n\tconst schema = Schema(this);\n\tconst desc = mergeDesc(schema.meta.description, messages);\n\tif (Object.keys(desc).length) schema.meta.description = desc;\n\tif (schema.dict) schema.dict = valueMap(schema.dict, (inner, key) => {\n\t\treturn inner.i18n(valueMap(messages, (data) => getInner(data)?.[key] ?? data?.[key]));\n\t});\n\tif (schema.list) schema.list = schema.list.map((inner, index) => {\n\t\treturn inner.i18n(valueMap(messages, (data = {}) => {\n\t\t\tif (Array.isArray(getInner(data))) return getInner(data)[index];\n\t\t\tif (Array.isArray(data)) return data[index];\n\t\t\treturn extractKeys(data);\n\t\t}));\n\t});\n\tif (schema.inner) schema.inner = schema.inner.i18n(valueMap(messages, (data) => {\n\t\tif (getInner(data)) return getInner(data);\n\t\treturn extractKeys(data);\n\t}));\n\tif (schema.sKey) schema.sKey = schema.sKey.i18n(valueMap(messages, (data) => data?.$key));\n\treturn schema;\n};\nSchema.prototype.extra = function extra(key, value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"required\",\n\t\"disabled\",\n\t\"collapse\",\n\t\"hidden\",\n\t\"loose\"\n]) Object.assign(Schema.prototype, { [key](value = true) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.deprecated = function deprecated() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"deprecated\",\n\t\ttype: \"danger\"\n\t});\n\treturn schema;\n};\nSchema.prototype.experimental = function experimental() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"experimental\",\n\t\ttype: \"warning\"\n\t});\n\treturn schema;\n};\nSchema.prototype.pattern = function pattern(regexp) {\n\tconst schema = Schema(this);\n\tconst pattern = pick(regexp, [\"source\", \"flags\"]);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\tpattern\n\t};\n\treturn schema;\n};\nSchema.prototype.simplify = function simplify(value) {\n\tif (deepEqual(value, this.meta.default, this.type === \"dict\")) return null;\n\tif (isNullable(value)) return value;\n\tif (this.type === \"object\" || this.type === \"dict\") {\n\t\tconst result = {};\n\t\tfor (const key in value) {\n\t\t\tconst item = (this.type === \"object\" ? this.dict[key] : this.inner)?.simplify(value[key]);\n\t\t\tif (this.type === \"dict\" || !isNullable(item)) result[key] = item;\n\t\t}\n\t\tif (deepEqual(result, this.meta.default, this.type === \"dict\")) return null;\n\t\treturn result;\n\t} else if (this.type === \"array\" || this.type === \"tuple\") {\n\t\tconst result = [];\n\t\tvalue.forEach((value, index) => {\n\t\t\tconst schema = this.type === \"array\" ? this.inner : this.list[index];\n\t\t\tconst item = schema ? schema.simplify(value) : value;\n\t\t\tresult.push(item);\n\t\t});\n\t\treturn result;\n\t} else if (this.type === \"intersect\") {\n\t\tconst result = {};\n\t\tfor (const item of this.list) Object.assign(result, item.simplify(value));\n\t\treturn result;\n\t} else if (this.type === \"union\") for (const schema of this.list) try {\n\t\tSchema.resolve(value, schema, {});\n\t\treturn schema.simplify(value);\n\t} catch {}\n\treturn value;\n};\nSchema.prototype.toString = function toString(inline) {\n\treturn formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;\n};\nSchema.prototype.role = function role(role, extra) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\trole,\n\t\textra\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"default\",\n\t\"link\",\n\t\"comment\",\n\t\"description\",\n\t\"max\",\n\t\"min\",\n\t\"step\"\n]) Object.assign(Schema.prototype, { [key](value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nconst resolvers = {};\nSchema.extend = function extend(type, resolve) {\n\tresolvers[type] = resolve;\n};\nSchema.resolve = function resolve(data, schema, options = {}, strict = false) {\n\tif (!schema) return [data];\n\tif (options.ignore?.(data, schema)) return [data];\n\tif (isNullable(data) && schema.type !== \"lazy\") {\n\t\tif (schema.meta.required) throw new ValidationError(`missing required value`, options);\n\t\tlet current = schema;\n\t\tlet fallback = schema.meta.default;\n\t\twhile (current?.type === \"intersect\" && isNullable(fallback)) {\n\t\t\tcurrent = current.list[0];\n\t\t\tfallback = current?.meta.default;\n\t\t}\n\t\tif (isNullable(fallback)) return [data];\n\t\tdata = clone(fallback);\n\t}\n\tconst callback = resolvers[schema.type];\n\tif (!callback) throw new ValidationError(`unsupported type \"${schema.type}\"`, options);\n\ttry {\n\t\treturn callback(data, schema, options, strict);\n\t} catch (error) {\n\t\tif (!schema.meta.loose) throw error;\n\t\treturn [schema.meta.default];\n\t}\n};\nSchema.from = function from(source) {\n\tif (isNullable(source)) return Schema.any();\n\telse if ([\n\t\t\"string\",\n\t\t\"number\",\n\t\t\"boolean\"\n\t].includes(typeof source)) return Schema.const(source).required();\n\telse if (source[kSchema]) return source;\n\telse if (typeof source === \"function\") switch (source) {\n\t\tcase String: return Schema.string().required();\n\t\tcase Number: return Schema.number().required();\n\t\tcase Boolean: return Schema.boolean().required();\n\t\tcase Function: return Schema.function().required();\n\t\tdefault: return Schema.is(source).required();\n\t}\n\telse throw new TypeError(`cannot infer schema from ${source}`);\n};\nSchema.lazy = function lazy(builder) {\n\tconst toJSON = () => {\n\t\tif (!schema.inner[kSchema]) {\n\t\t\tschema.inner = schema.builder();\n\t\t\tschema.inner.meta = {\n\t\t\t\t...schema.meta,\n\t\t\t\t...schema.inner.meta\n\t\t\t};\n\t\t}\n\t\treturn schema.inner.toJSON();\n\t};\n\tconst schema = new Schema({\n\t\ttype: \"lazy\",\n\t\tbuilder,\n\t\tinner: { toJSON }\n\t});\n\treturn schema;\n};\nSchema.natural = function natural() {\n\treturn Schema.number().step(1).min(0);\n};\nSchema.percent = function percent() {\n\treturn Schema.number().step(.01).min(0).max(1).role(\"slider\");\n};\nSchema.date = function date() {\n\treturn Schema.union([Schema.is(Date), Schema.transform(Schema.string().role(\"datetime\"), (value, options) => {\n\t\tconst date = new Date(value);\n\t\tif (isNaN(+date)) throw new ValidationError(`invalid date \"${value}\"`, options);\n\t\treturn date;\n\t}, true)]);\n};\nSchema.regExp = function regExp(flag = \"\") {\n\treturn Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role(\"regexp\", { flag }), (value, options) => {\n\t\ttry {\n\t\t\treturn new RegExp(value, flag);\n\t\t} catch (e) {\n\t\t\tthrow new ValidationError(e.message, options);\n\t\t}\n\t}, true)]);\n};\nSchema.arrayBuffer = function arrayBuffer(encoding) {\n\treturn Schema.union([\n\t\tSchema.is(ArrayBuffer),\n\t\tSchema.is(SharedArrayBuffer),\n\t\tSchema.transform(Schema.any(), (value, options) => {\n\t\t\tif (Binary.isSource(value)) return Binary.fromSource(value);\n\t\t\tthrow new ValidationError(`expected ArrayBufferSource but got ${value}`, options);\n\t\t}, true),\n\t\t...encoding ? [Schema.transform(Schema.string(), (value, options) => {\n\t\t\ttry {\n\t\t\t\treturn encoding === \"base64\" ? Binary.fromBase64(value) : Binary.fromHex(value);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ValidationError(e.message, options);\n\t\t\t}\n\t\t}, true)] : []\n\t]);\n};\nSchema.extend(\"lazy\", (data, schema, options, strict) => {\n\tif (!schema.inner[kSchema]) {\n\t\tschema.inner = schema.builder();\n\t\tschema.inner.meta = {\n\t\t\t...schema.meta,\n\t\t\t...schema.inner.meta\n\t\t};\n\t}\n\treturn Schema.resolve(data, schema.inner, options, strict);\n});\nSchema.extend(\"any\", (data) => {\n\treturn [data];\n});\nSchema.extend(\"never\", (data, _, options) => {\n\tthrow new ValidationError(`expected nullable but got ${data}`, options);\n});\nSchema.extend(\"const\", (data, { value }, options) => {\n\tif (deepEqual(data, value)) return [value];\n\tthrow new ValidationError(`expected ${value} but got ${data}`, options);\n});\nfunction checkWithinRange(data, meta, description, options, skipMin = false) {\n\tconst { max = Infinity, min = -Infinity } = meta;\n\tif (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);\n\tif (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);\n}\nSchema.extend(\"string\", (data, { meta }, options) => {\n\tif (typeof data !== \"string\") throw new ValidationError(`expected string but got ${data}`, options);\n\tif (meta.pattern) {\n\t\tconst regexp = new RegExp(meta.pattern.source, meta.pattern.flags);\n\t\tif (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);\n\t}\n\tcheckWithinRange(data.length, meta, \"string length\", options);\n\treturn [data];\n});\nfunction decimalShift(data, digits) {\n\tconst str = data.toString();\n\tif (str.includes(\"e\")) return data * Math.pow(10, digits);\n\tconst index = str.indexOf(\".\");\n\tif (index === -1) return data * Math.pow(10, digits);\n\tconst frac = str.slice(index + 1);\n\tconst integer = str.slice(0, index);\n\tif (frac.length <= digits) return +(integer + frac.padEnd(digits, \"0\"));\n\treturn +(integer + frac.slice(0, digits) + \".\" + frac.slice(digits));\n}\nfunction isMultipleOf(data, min, step) {\n\tstep = Math.abs(step);\n\tif (!/^\\d+\\.\\d+$/.test(step.toString())) return (data - min) % step === 0;\n\tconst index = step.toString().indexOf(\".\");\n\tconst digits = step.toString().slice(index + 1).length;\n\treturn Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;\n}\nSchema.extend(\"number\", (data, { meta }, options) => {\n\tif (typeof data !== \"number\") throw new ValidationError(`expected number but got ${data}`, options);\n\tcheckWithinRange(data, meta, \"number\", options);\n\tconst { step } = meta;\n\tif (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);\n\treturn [data];\n});\nSchema.extend(\"boolean\", (data, _, options) => {\n\tif (typeof data === \"boolean\") return [data];\n\tthrow new ValidationError(`expected boolean but got ${data}`, options);\n});\nSchema.extend(\"bitset\", (data, { bits, meta }, options) => {\n\tlet value = 0, keys = [];\n\tif (typeof data === \"number\") {\n\t\tvalue = data;\n\t\tfor (const key in bits) if (data & bits[key]) keys.push(key);\n\t} else if (Array.isArray(data)) {\n\t\tkeys = data;\n\t\tfor (const key of keys) {\n\t\t\tif (typeof key !== \"string\") throw new ValidationError(`expected string but got ${key}`, options);\n\t\t\tif (key in bits) value |= bits[key];\n\t\t}\n\t} else throw new ValidationError(`expected number or array but got ${data}`, options);\n\tif (value === meta.default) return [value];\n\treturn [value, keys];\n});\nSchema.extend(\"function\", (data, _, options) => {\n\tif (typeof data === \"function\") return [data];\n\tthrow new ValidationError(`expected function but got ${data}`, options);\n});\nSchema.extend(\"is\", (data, { constructor }, options) => {\n\tif (typeof constructor === \"function\") {\n\t\tif (data instanceof constructor) return [data];\n\t\tthrow new ValidationError(`expected ${constructor.name} but got ${data}`, options);\n\t} else {\n\t\tif (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t\tlet prototype = Object.getPrototypeOf(data);\n\t\twhile (prototype) {\n\t\t\tif (prototype.constructor?.name === constructor) return [data];\n\t\t\tprototype = Object.getPrototypeOf(prototype);\n\t\t}\n\t\tthrow new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t}\n});\nfunction property(data, key, schema, options) {\n\ttry {\n\t\tconst [value, adapted] = Schema.resolve(data[key], schema, {\n\t\t\t...options,\n\t\t\tpath: [...options.path || [], key]\n\t\t});\n\t\tif (adapted !== void 0) data[key] = adapted;\n\t\treturn value;\n\t} catch (e) {\n\t\tif (!options?.autofix) throw e;\n\t\tdelete data[key];\n\t\treturn schema.meta.default;\n\t}\n}\nSchema.extend(\"array\", (data, { inner, meta }, options) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tcheckWithinRange(data.length, meta, \"array length\", options, !isNullable(inner.meta.default));\n\treturn [data.map((_, index) => property(data, index, inner, options))];\n});\nSchema.extend(\"dict\", (data, { inner, sKey }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in data) {\n\t\tlet rKey;\n\t\ttry {\n\t\t\trKey = Schema.resolve(key, sKey, options)[0];\n\t\t} catch (error) {\n\t\t\tif (strict) continue;\n\t\t\tthrow error;\n\t\t}\n\t\tresult[rKey] = property(data, key, inner, options);\n\t\tdata[rKey] = data[key];\n\t\tif (key !== rKey) delete data[key];\n\t}\n\treturn [result];\n});\nSchema.extend(\"tuple\", (data, { list }, options, strict) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tconst result = list.map((inner, index) => property(data, index, inner, options));\n\tif (strict) return [result];\n\tresult.push(...data.slice(list.length));\n\treturn [result];\n});\nfunction merge(result, data) {\n\tfor (const key in data) {\n\t\tif (key in result) continue;\n\t\tresult[key] = data[key];\n\t}\n}\nSchema.extend(\"object\", (data, { dict }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in dict) {\n\t\tconst value = property(data, key, dict[key], options);\n\t\tif (!isNullable(value) || key in data) result[key] = value;\n\t}\n\tif (!strict) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"union\", (data, { list, toString }, options, strict) => {\n\tconst messages = [];\n\tfor (const inner of list) try {\n\t\treturn Schema.resolve(data, inner, options, strict);\n\t} catch (error) {\n\t\tmessages.push(error);\n\t}\n\tthrow new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n});\nSchema.extend(\"intersect\", (data, { list, toString }, options, strict) => {\n\tif (!list.length) return [data];\n\tlet result;\n\tfor (const inner of list) {\n\t\tconst value = Schema.resolve(data, inner, options, true)[0];\n\t\tif (isNullable(value)) continue;\n\t\tif (isNullable(result)) result = value;\n\t\telse if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t\telse if (typeof value === \"object\") merge(result ??= {}, value);\n\t\telse if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t}\n\tif (!strict && isPlainObject(data)) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"transform\", (data, { inner, callback, preserve }, options) => {\n\tconst [result, adapted = data] = Schema.resolve(data, inner, options, true);\n\tif (preserve) return [callback(result)];\n\telse return [callback(result), callback(adapted)];\n});\nconst formatters = {};\nfunction defineMethod(name, keys, format) {\n\tformatters[name] = format;\n\tObject.assign(Schema, { [name](...args) {\n\t\tconst schema = new Schema({ type: name });\n\t\tkeys.forEach((key, index) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"sKey\":\n\t\t\t\t\tschema.sKey = args[index] ?? Schema.string();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inner\":\n\t\t\t\t\tschema.inner = Schema.from(args[index]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"list\":\n\t\t\t\t\tschema.list = args[index].map(Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dict\":\n\t\t\t\t\tschema.dict = valueMap(args[index], Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bits\":\n\t\t\t\t\tschema.bits = {};\n\t\t\t\t\tfor (const key in args[index]) {\n\t\t\t\t\t\tif (typeof args[index][key] !== \"number\") continue;\n\t\t\t\t\t\tschema.bits[key] = args[index][key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"callback\": {\n\t\t\t\t\tconst callback = schema.callback = args[index];\n\t\t\t\t\tcallback[\"toJSON\"] ||= () => callback.toString();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"constructor\": {\n\t\t\t\t\tconst constructor = schema.constructor = args[index];\n\t\t\t\t\tif (typeof constructor === \"function\") constructor[\"toJSON\"] ||= () => constructor[\"name\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: schema[key] = args[index];\n\t\t\t}\n\t\t});\n\t\tif (name === \"object\" || name === \"dict\") schema.meta.default = {};\n\t\telse if (name === \"array\" || name === \"tuple\") schema.meta.default = [];\n\t\telse if (name === \"bitset\") schema.meta.default = 0;\n\t\treturn schema;\n\t} });\n}\ndefineMethod(\"is\", [\"constructor\"], ({ constructor }) => {\n\tif (typeof constructor === \"function\") return constructor.name;\n\telse return constructor;\n});\ndefineMethod(\"any\", [], () => \"any\");\ndefineMethod(\"never\", [], () => \"never\");\ndefineMethod(\"const\", [\"value\"], ({ value }) => typeof value === \"string\" ? JSON.stringify(value) : value);\ndefineMethod(\"string\", [], () => \"string\");\ndefineMethod(\"number\", [], () => \"number\");\ndefineMethod(\"boolean\", [], () => \"boolean\");\ndefineMethod(\"bitset\", [\"bits\"], () => \"bitset\");\ndefineMethod(\"function\", [], () => \"function\");\ndefineMethod(\"array\", [\"inner\"], ({ inner }) => `${inner.toString(true)}[]`);\ndefineMethod(\"dict\", [\"inner\", \"sKey\"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);\ndefineMethod(\"tuple\", [\"list\"], ({ list }) => `[${list.map((inner) => inner.toString()).join(\", \")}]`);\ndefineMethod(\"object\", [\"dict\"], ({ dict }) => {\n\tif (Object.keys(dict).length === 0) return \"{}\";\n\treturn `{ ${Object.entries(dict).map(([key, inner]) => {\n\t\treturn `${key}${inner.meta.required ? \"\" : \"?\"}: ${inner.toString()}`;\n\t}).join(\", \")} }`;\n});\ndefineMethod(\"union\", [\"list\"], ({ list }, inline) => {\n\tconst result = list.map(({ toString: format }) => format()).join(\" | \");\n\treturn inline ? `(${result})` : result;\n});\ndefineMethod(\"intersect\", [\"list\"], ({ list }) => {\n\treturn `${list.map((inner) => inner.toString(true)).join(\" & \")}`;\n});\ndefineMethod(\"transform\", [\n\t\"inner\",\n\t\"callback\",\n\t\"preserve\"\n], ({ inner }, isInner) => inner.toString(isInner));\n//#endregion\nexport { Schema as default };\n","/**\n * The `soulmirror` user-settings namespace (dsh `ctx.settings`): what the\n * browser settings section \"SoulMirror network\" edits and what the network\n * plugin reads when it spawns the backend. The connection fields apply on\n * the next plugin (re)load — the peer process is spawned with them\n * (`applies: 'restart'`); the alter fields (`defaultTier`, `autoReplyPerHour`,\n * `directSend`) are read live through `ctx.soulmirrorConfig.current()`. The\n * tiers decide how the alter handles a friend's mail (P4: `draft` = the\n * alter's reply waits as a pending draft on the SoulMirror page).\n *\n * `@deepseek-ai/schemastery` is a VALUE import here on purpose: the settings\n * seam needs a real schemastery schema (callable validator + `toJSON()` for\n * the browser form). It is a vendored, dependency-free library and gets\n * inlined into lib/index.js by tsdown, so the host half still has zero\n * `@deepseek-ai/*` runtime edges into the harness instance (see ../README.md).\n */\nimport z from '@deepseek-ai/schemastery'\nimport { DEFAULT_RELAY } from './network/soulnet.ts'\nimport type { BackendKind } from './network/types.ts'\nimport { DEFAULT_AUTO_REPLY_PER_HOUR, DEFAULT_REPLY_TIER, normalizeTier, type ReplyTier } from './policy.ts'\n\nexport const SETTINGS_NAMESPACE = 'soulmirror'\n\nexport interface SoulmirrorSettings {\n /** Relay (mail office) URL; baked into identity.json when the identity is created. */\n relay: string\n /** Display name used when the identity is created on first start; empty = onboarding asks. */\n displayName: string\n backend: BackendKind\n /** Path of the `soulnet` binary; empty = PATH, then <plugin dir>/bin/. */\n peerBinary: string\n /** Data directory (`--home`); empty = $SOULNET_HOME, then ~/.soulnet. */\n home: string\n /** Reply tier for friends without their own setting. */\n defaultTier: ReplyTier\n /** Cap on automatic replies per friend per hour in the `auto` tier. */\n autoReplyPerHour: number\n /** Debug: offer \"Send as myself\" in the friend pane (bypasses the alter). */\n directSend: boolean\n}\n\nexport const SOULMIRROR_SETTINGS_SCHEMA = z.object({\n relay: z.string().default(DEFAULT_RELAY).description('Relay URL (used when the identity is created).'),\n displayName: z.string().default('').description('Display name for a new identity (first start only).'),\n backend: z.union([z.const('soulnet'), z.const('fake')]).default('soulnet').description('soulnet = the light peer binary; fake = in-memory test backend.'),\n peerBinary: z.string().default('').description('Path of the soulnet binary; empty = PATH, then the plugin bin/ directory.'),\n home: z.string().default('').description('Data directory; empty = $SOULNET_HOME, then ~/.soulnet.'),\n defaultTier: z.union([z.const('notify'), z.const('draft'), z.const('auto')]).default(DEFAULT_REPLY_TIER).description('Default reply tier for friends: notify = mail is only shown; draft = the alter drafts a reply you review on the SoulMirror page; auto = the alter replies by itself (rate-limited).'),\n autoReplyPerHour: z.number().default(DEFAULT_AUTO_REPLY_PER_HOUR).description('Maximum automatic replies per friend per hour in the auto tier (0 disables).'),\n directSend: z.boolean().default(false).description('Debug: offer \"Send as myself\" in a friend thread (bypasses the alter); off by default.'),\n})\n\n/** Fill in defaults for a partial section (plugin config or a stored user section). */\nexport function resolveSettings(partial: Partial<SoulmirrorSettings> | undefined): SoulmirrorSettings {\n const perHour = typeof partial?.autoReplyPerHour === 'number' && Number.isFinite(partial.autoReplyPerHour)\n ? Math.max(0, Math.floor(partial.autoReplyPerHour))\n : DEFAULT_AUTO_REPLY_PER_HOUR\n return {\n relay: partial?.relay !== undefined && partial.relay.trim() !== '' ? partial.relay.trim() : DEFAULT_RELAY,\n displayName: partial?.displayName ?? '',\n backend: partial?.backend === 'fake' ? 'fake' : 'soulnet',\n peerBinary: partial?.peerBinary ?? '',\n home: partial?.home ?? '',\n defaultTier: normalizeTier(partial?.defaultTier),\n autoReplyPerHour: perHour,\n directSend: partial?.directSend === true,\n }\n}\n","/**\n * soulnet-dsh — host root entry = the `soulmirror-network` plugin.\n *\n * Provides `ctx.soulmirror` (NetworkClient: the `soulnet` light peer by\n * default, the in-memory fake on request) and `ctx.soulmirrorHome`, registers\n * the `soulmirror` user-settings namespace and mounts the browser-facing HTTP\n * API (./api). The bare package name is also what dsh's client-module scan keys\n * on, so this entry carries the browser bundle declaration (package.json\n * `dsh.client` + the `./client` export).\n *\n * Host side rule: NO @deepseek-ai VALUE imports into the harness instance\n * (types only; the one vendored library we do import, schemastery, is inlined).\n * A linked (`dsh plugin add ./packages/dsh`) package resolves bare specifiers\n * from its own real path, where the harness packages are not installed; and a\n * second copy of cordis/dsh-tools would be a different runtime instance anyway.\n */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { SettingsNamespace } from '@deepseek-ai/dsh-settings'\nimport { mountApi } from './api/index.ts'\nimport { createFakeNetworkClient } from './network/fake.ts'\nimport { createSoulnetNetworkClient, defaultSoulnetHome } from './network/soulnet.ts'\nimport type { NetworkClient } from './network/types.ts'\nimport { resolveSettings, SETTINGS_NAMESPACE, SOULMIRROR_SETTINGS_SCHEMA, type SoulmirrorSettings } from './settings.ts'\n\nexport type * from './network/types.ts'\nexport type * from './events.ts'\nexport { SOULMIRROR_PLUGIN, RELAY_FORM } from './events.ts'\nexport { SETTINGS_NAMESPACE } from './settings.ts'\nexport type { SoulmirrorSettings } from './settings.ts'\n\n/** Live view of the `soulmirror` settings (the alter fields apply without a restart). */\nexport interface SoulmirrorConfig {\n current(): SoulmirrorSettings\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /** SoulMirror network client (identity / card / friends / send / subscribe). */\n soulmirror: NetworkClient\n /** Backend data directory (`a2a/` underneath: identity.json, friends.yaml, conversations/ …; same layout as ~/.soulmirror/a2a). */\n soulmirrorHome: string\n /** Live settings: `defaultTier` / `autoReplyPerHour` / `directSend` are read per use; connection fields apply on reload. */\n soulmirrorConfig: SoulmirrorConfig\n }\n}\n\n/** Composition entry config; every field is also a user setting (namespace `soulmirror`). */\nexport type Config = Partial<SoulmirrorSettings>\n\nexport const name = 'soulmirror-network'\nexport const inject: string[] = []\n\nexport function apply(ctx: Context, config: Config = {}): void {\n const log = (level: 'info' | 'warn' | 'error', message: string): void => {\n ctx.logger[level](`soulmirror-network: ${message}`)\n }\n\n // Settings: schema defaults < composition entry (`config`) < user document.\n // When the settings service is already composed we read the resolved value\n // now; otherwise we run on the entry config and register late for the UI.\n const entry = resolveSettings(config)\n let effective: SoulmirrorSettings = entry\n // `live` follows the user document: the connection fields still apply on\n // reload (the peer is already running), the alter fields are read per use.\n let live: SoulmirrorSettings = entry\n const settingsNow = ctx.get('settings')\n if (settingsNow !== undefined) {\n const scope = settingsNow.register(SETTINGS_NAMESPACE as SettingsNamespace, SOULMIRROR_SETTINGS_SCHEMA, { base: config, applies: 'restart' })\n effective = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n live = effective\n scope.watch(() => {\n live = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n log('info', `settings changed (tier=${live.defaultTier}, autoReplyPerHour=${live.autoReplyPerHour}, directSend=${String(live.directSend)} apply now; connection fields apply when the plugin reloads)`)\n })\n } else {\n ctx.inject(['settings'], (sctx) => {\n const scope = sctx.settings.register(SETTINGS_NAMESPACE as SettingsNamespace, SOULMIRROR_SETTINGS_SCHEMA, { base: config, applies: 'restart' })\n live = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n scope.watch(() => {\n live = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n log('info', 'settings changed; alter fields apply now, connection fields when the plugin reloads')\n })\n })\n }\n const liveConfig: SoulmirrorConfig = { current: () => live }\n ctx.provide('soulmirrorConfig', liveConfig)\n\n const home = effective.home !== '' ? effective.home : defaultSoulnetHome()\n let client: NetworkClient\n if (effective.backend === 'fake') {\n client = createFakeNetworkClient()\n } else {\n const peer = createSoulnetNetworkClient({\n home,\n relay: effective.relay,\n displayName: effective.displayName,\n ...(effective.peerBinary === '' ? {} : { peerBinary: effective.peerBinary }),\n logger: log,\n })\n peer.start()\n client = peer\n }\n\n ctx.provide('soulmirrorHome', home)\n ctx.provide('soulmirror', client)\n ctx.effect(() => () => {\n void client.dispose().catch((error: unknown) => { log('warn', `dispose failed: ${String(error)}`) })\n }, 'soulmirror-network: backend process')\n\n mountApi(ctx, {\n client,\n home,\n settingsNamespace: SETTINGS_NAMESPACE,\n sessions: () => ctx.get('soulmirrorSessions'),\n settings: () => live,\n log,\n })\n log('info', `backend=${client.backend} home=${home} relay=${effective.relay}`)\n}\n"],"x_google_ignoreList":[4,5],"mappings":";;;;;;;;;;;AAkCA,MAAa,aAAa;AAqB1B,SAAS,SAAS,KAAsB,QAAQ,QAA2B;CACzE,OAAO,IAAI,SAAS,SAAS,WAAW;EACtC,MAAM,SAAmB,CAAC;EAC1B,IAAI,OAAO;EACX,IAAI,GAAG,SAAS,UAAkB;GAChC,QAAQ,MAAM;GACd,IAAI,OAAO,OAAO;IAChB,uBAAO,IAAI,MAAM,wBAAwB,CAAC;IAC1C,IAAI,QAAQ;IACZ;GACF;GACA,OAAO,KAAK,KAAK;E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GACjE,IAAI,QAAQ,qFAAqF;EACnG,CAAC;CACH,CAAC;CAGH,IAAI,QAAQ,oBAAoB,EADO,eAAe,KACb,CAAC;CAE1C,MAAM,OAAO,UAAU,SAAS,KAAK,UAAU,OAAO,mBAAmB;CACzE,IAAI;CACJ,IAAI,UAAU,YAAY,QACxB,SAAS,wBAAwB;MAC5B;EACL,MAAM,OAAO,2BAA2B;GACtC;GACA,OAAO,UAAU;GACjB,aAAa,UAAU;GACvB,GAAI,UAAU,eAAe,KAAK,CAAC,IAAI,EAAE,YAAY,UAAU,WAAW;GAC1E,QAAQ;EACV,CAAC;EACD,KAAK,MAAM;EACX,SAAS;CACX;CAEA,IAAI,QAAQ,kBAAkB,IAAI;CAClC,IAAI,QAAQ,cAAc,MAAM;CAChC,IAAI,mBAAmB;EACrB,OAAY,QAAQ,CAAC,CAAC,OAAO,UAAmB;GAAE,IAAI,QAAQ,mBAAmB,OAAO,KAAK,GAAG;EAAE,CAAC;CACrG,GAAG,qCAAqC;CAExC,SAAS,KAAK;EACZ;EACA;EACA,mBAAmB;EACnB,gBAAgB,IAAI,IAAI,oBAAoB;EAC5C,gBAAgB;EAChB;CACF,CAAC;CACD,IAAI,QAAQ,WAAW,OAAO,QAAQ,QAAQ,KAAK,SAAS,UAAU,OAAO;AAC/E"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["fp","mid","valueMap","z"],"sources":["../src/api/index.ts","../src/network/fake.ts","../src/network/jsonrpc.ts","../src/network/soulnet.ts","../../../node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.2/node_modules/@deepseek-ai/cosmokit/lib/index.js","../../../node_modules/.pnpm/@deepseek-ai+schemastery@3.18.1/node_modules/@deepseek-ai/schemastery/lib/index.mjs","../src/settings.ts","../src/index.ts"],"sourcesContent":["/**\n * Browser-facing HTTP API of the host half, mounted on dsh's web server\n * (`ctx.webServer.register`, prefix `/soulmirror/api/`). The client bundle\n * uses it for everything the SoulMirror page / settings / onboarding need\n * that is not a session event: identity, card, friends, pending requests,\n * read cursors, the conversation archive, presence, the debug direct send,\n * the owner → alter channel (P4: `alter.instruct {text}`, `session.latest`,\n * `session.history`), pending drafts (`drafts.list`, `drafts.decide`),\n * per-friend settings (`friends.set` with tier / protocol override), the\n * global diplomacy protocol (`protocol.get` / `protocol.set`), and a\n * Server-Sent-Events stream of live events (inbound mail, outbound archive,\n * typing, friend requests, presence, backend status, `alter` = the alter's\n * state changed, `draft` = a draft was stored / decided).\n *\n * Why not dsh's Typert remotes: those are generated build artifacts selected\n * by the web app at build time; an out-of-repo plugin cannot add one (see\n * dsh-api-remotes README \"capability set is fixed by explicit build-time\n * value imports\"). Why not `ctx.sessionProjections` for typing: projections\n * are pure folds over COMMITTED session events and typing must not be logged\n * (SPIKE.md §1), so there is no event to fold. This route is the plugin's own\n * channel; it is served by the same loopback web server as `/api`.\n */\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-host-webserver'\nimport type { Fingerprint } from '../events.ts'\nimport { ProtocolFile } from '../friend-settings.ts'\nimport { sendAndArchive } from '../network/send.ts'\nimport { NetworkError, type ConversationEntry, type NetworkClient, type NetworkEvent } from '../network/types.ts'\nimport { isReplyTier } from '../policy.ts'\nimport type { AlterSessions, SessionsEvent } from '../sessions/index.ts'\nimport type { SoulmirrorSettings } from '../settings.ts'\n\nexport const API_PREFIX = '/soulmirror/api/'\n\n/**\n * What the SSE stream carries: every NetworkEvent of the backend plus the\n * sessions plugin's own frames (`outbound`, `alter`, `draft`).\n */\nexport type ApiFrame = NetworkEvent | SessionsEvent\n\nexport interface ApiOptions {\n readonly client: NetworkClient\n readonly home: string\n readonly settingsNamespace: string\n /** Resolved lazily: the sessions plugin may mount after the network plugin. */\n readonly sessions: () => AlterSessions | undefined\n /** Live settings (the alter fields apply without restart). */\n readonly settings: () => SoulmirrorSettings\n readonly log: (level: 'info' | 'warn' | 'error', message: string) => void\n}\n\ntype Json = Record<string, unknown>\n\nfunction readJson(req: IncomingMessage, limit = 256 * 1024): Promise<Json> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = []\n let size = 0\n req.on('data', (chunk: Buffer) => {\n size += chunk.length\n if (size > limit) {\n reject(new Error('request body too large'))\n req.destroy()\n return\n }\n chunks.push(chunk)\n })\n req.on('end', () => {\n if (chunks.length === 0) {\n resolve({})\n return\n }\n try {\n const parsed: unknown = JSON.parse(Buffer.concat(chunks).toString('utf8'))\n resolve(typeof parsed === 'object' && parsed !== null ? parsed as Json : {})\n } catch (error: unknown) {\n reject(error instanceof Error ? error : new Error(String(error)))\n }\n })\n req.on('error', reject)\n })\n}\n\nfunction send(res: ServerResponse, status: number, body: unknown): void {\n const payload = JSON.stringify(body)\n res.writeHead(status, {\n 'content-type': 'application/json; charset=utf-8',\n 'cache-control': 'no-store',\n 'content-length': Buffer.byteLength(payload),\n })\n res.end(payload)\n}\n\nfunction errorBody(error: unknown): Json {\n if (error instanceof NetworkError) return { error: { code: error.code, message: error.message } }\n return { error: { code: -32603, message: error instanceof Error ? error.message : String(error) } }\n}\n\nconst bad = (message: string): { status: number; body: unknown } => ({ status: 400, body: { error: { code: -32602, message } } })\nconst text = (value: unknown): string | undefined => typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined\nconst num = (value: unknown): number | undefined => {\n if (typeof value === 'number' && Number.isFinite(value)) return value\n if (typeof value === 'string' && value.trim() !== '' && Number.isFinite(Number(value))) return Number(value)\n return undefined\n}\n/** `fps` as a JSON array (POST) or a comma-separated query value (GET). */\nconst fpList = (value: unknown): string[] => {\n if (Array.isArray(value)) return value.filter((v): v is string => typeof v === 'string' && v !== '')\n if (typeof value === 'string') return value.split(',').map(v => v.trim()).filter(v => v !== '')\n return []\n}\n\n/** GET routes whose query string stands in for the JSON body (`?fp=…&since=…&limit=…`, `?fps=a,b`). */\nconst QUERY_ROUTES = new Set(['state', 'conversation.get', 'presence', 'session.latest', 'session.history', 'protocol.get', 'drafts.list'])\n\nexport interface ApiHandler {\n (req: IncomingMessage, res: ServerResponse): Promise<void>\n /** Push one frame to every SSE client (the sessions plugin's events are forwarded through this). */\n broadcast(frame: ApiFrame): void\n dispose(): void\n}\n\nexport function createApiHandler(options: ApiOptions): ApiHandler {\n const { client } = options\n const sseClients = new Set<ServerResponse>()\n const protocol = ProtocolFile.at(join(options.home, 'a2a'))\n\n const broadcast = (event: ApiFrame): void => {\n if (sseClients.size === 0) return\n const frame = `event: ${event.kind}\\ndata: ${JSON.stringify(event)}\\n\\n`\n for (const res of sseClients) {\n try {\n res.write(frame)\n } catch {\n sseClients.delete(res)\n }\n }\n }\n const unsubscribe = client.subscribe(broadcast)\n\n /** Direct send through the peer (the settings' debug \"send as myself\"), broadcast as `outbound` to every SSE client. */\n const sendDirect = async (fp: Fingerprint, body: string): Promise<{ entry: ConversationEntry; receipt: { id: string; seq?: number; status: string } }> => {\n const result = await sendAndArchive(client, fp, body)\n broadcast({ kind: 'outbound', fp, entry: result.entry })\n return result\n }\n\n /** The friend row as the browser sees it: the peer's record + the plugin's tier + pending draft count. */\n const friendRow = (friend: Record<string, unknown>, sessions: AlterSessions | undefined): Record<string, unknown> => {\n const fp = friend['fp'] as Fingerprint\n const tier = sessions?.tierOf(fp) ?? options.settings().defaultTier\n const explicit = sessions?.tierStored(fp) !== undefined\n const drafts = sessions?.drafts.count(fp) ?? 0\n return { ...friend, tier, ...(explicit ? { tierExplicit: true } : {}), ...(drafts > 0 ? { drafts } : {}) }\n }\n\n const state = async (): Promise<Json> => {\n const status = client.status()\n let identity: Json | null = null\n let friends: unknown[] = []\n let pending: unknown[] = []\n let error: string | undefined\n const sessions = options.sessions()\n try {\n const id = await client.identity()\n if (id !== undefined) {\n identity = { fp: id.fp, name: id.name, cardUri: id.cardUri, ...(id.createdAt === undefined ? {} : { createdAt: id.createdAt }) }\n const [f, p] = await Promise.all([client.friends.list(), client.friends.pending()])\n pending = [...p]\n // `friends.list` carries no presence; ask the peer (cached 10 s there) so\n // every row has `online` and the page header / dots are authoritative.\n let online: Record<string, boolean> = {}\n if (f.length > 0) {\n try {\n online = await client.presence(f.map(x => x.fp))\n } catch {\n // best effort: rows keep whatever the client folded from SSE\n }\n }\n friends = f.map(x => friendRow((online[x.fp] === undefined ? x : { ...x, online: online[x.fp] }) as unknown as Record<string, unknown>, sessions))\n }\n } catch (e: unknown) {\n error = e instanceof Error ? e.message : String(e)\n }\n const settings = options.settings()\n const alterState = sessions?.latest()\n return {\n backend: client.backend,\n status,\n home: options.home,\n settingsNamespace: options.settingsNamespace,\n identity,\n friends,\n pending,\n drafts: sessions?.drafts.list() ?? [],\n alter: {\n sessionId: sessions?.sessionId() ?? null,\n status: alterState?.status ?? 'idle',\n defaultTier: settings.defaultTier,\n autoReplyPerHour: settings.autoReplyPerHour,\n directSend: settings.directSend,\n protocolPath: protocol.path,\n protocolExists: protocol.exists(),\n legacyFriendSessions: sessions?.legacyFriendSessions() ?? {},\n },\n ...(error === undefined ? {} : { error }),\n }\n }\n\n const handle = async (route: string, method: string, body: Json): Promise<{ status: number; body: unknown }> => {\n switch (route) {\n case 'state':\n return { status: 200, body: await state() }\n case 'identity.create': {\n const name = text(body['name'])\n if (name === undefined) return bad('name must not be empty')\n const id = await client.createIdentity(name)\n return { status: 200, body: { identity: id } }\n }\n case 'card.parse': {\n const uri = text(body['uri'])\n if (uri === undefined) return bad('uri must not be empty')\n return { status: 200, body: await client.parseCard(uri) }\n }\n case 'friends.add': {\n const cardUri = text(body['card_uri'])\n if (cardUri === undefined) return bad('card_uri must not be empty')\n const friend = await client.friends.add(cardUri, text(body['note']))\n options.log('info', `friend request sent to ${friend.name} (${friend.fp}) via settings/command`)\n return { status: 200, body: { friend } }\n }\n case 'friends.accept': {\n const id = text(body['id'])\n if (id === undefined) return bad('id must not be empty')\n const friend = await client.friends.accept(id, text(body['note']))\n options.sessions()?.noteFriend(friend)\n return { status: 200, body: { friend: friendRow(friend as unknown as Record<string, unknown>, options.sessions()) } }\n }\n case 'friends.reject': {\n const id = text(body['id'])\n if (id === undefined) return bad('id must not be empty')\n await client.friends.reject(id)\n return { status: 200, body: { ok: true } }\n }\n case 'friends.set': {\n // Note / protocol override live in the peer (friends.yaml); the tier in the plugin's dsh-friends.json.\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n const note = text(body['note'])\n const protocolOverride = typeof body['protocol'] === 'string' ? body['protocol'] : undefined\n const tierValue = body['tier']\n if (tierValue !== undefined && tierValue !== null && tierValue !== '' && !isReplyTier(tierValue)) {\n return bad('tier must be notify | draft | auto (empty = default)')\n }\n const sessions = options.sessions()\n let friend = (await client.friends.list()).find(f => f.fp === fp)\n if (friend === undefined) return { status: 404, body: { error: { code: -32002, message: 'not a friend' } } }\n if (note !== undefined || protocolOverride !== undefined) {\n friend = await client.friends.set(fp as Fingerprint, { ...(note === undefined ? {} : { remark: note }), ...(protocolOverride === undefined ? {} : { protocol: protocolOverride }) })\n sessions?.noteFriend(friend)\n }\n if (tierValue !== undefined && sessions !== undefined) {\n await sessions.setTier(fp as Fingerprint, isReplyTier(tierValue) ? tierValue : undefined)\n }\n options.log('info', `friends.set ${fp}: ${[note !== undefined ? 'note' : '', protocolOverride !== undefined ? 'protocol' : '', tierValue !== undefined ? `tier=${String(tierValue)}` : ''].filter(s => s !== '').join(' ')}`)\n return { status: 200, body: { friend: friendRow(friend as unknown as Record<string, unknown>, sessions) } }\n }\n case 'friends.card': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n return { status: 200, body: await client.friends.card(fp as Fingerprint) }\n }\n case 'conversation.markRead': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp required')\n await client.markRead(fp as Fingerprint, typeof body['seq'] === 'number' ? body['seq'] : 0)\n await options.sessions()?.markRead(fp as Fingerprint)\n return { status: 200, body: { ok: true } }\n }\n case 'conversation.get': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n const since = num(body['since'])\n const limit = num(body['limit'])\n return { status: 200, body: await client.conversation(fp as Fingerprint, { ...(since === undefined ? {} : { since }), ...(limit === undefined ? {} : { limit }) }) }\n }\n case 'message.send': {\n // Debug only (\"send as myself\" in Settings): bypasses the alter.\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n const msg = typeof body['body'] === 'string' ? body['body'].replace(/\\s+$/, '') : ''\n if (msg === '') return bad('body must not be empty')\n const result = await sendDirect(fp as Fingerprint, msg)\n options.log('info', `direct send to ${fp} (debug): ${result.receipt.id} (${result.receipt.status}, seq ${result.receipt.seq ?? '?'})`)\n return { status: 200, body: result }\n }\n case 'message.typing': {\n const fp = text(body['fp'])\n if (fp === undefined) return bad('fp must not be empty')\n await client.typing(fp as Fingerprint, body['on'] !== false && body['on'] !== 'false' && body['on'] !== 0)\n return { status: 200, body: { ok: true } }\n }\n case 'presence': {\n const fps = fpList(body['fps'])\n const online = await client.presence(fps as Fingerprint[])\n return { status: 200, body: { online } }\n }\n case 'alter.instruct': {\n // The owner instructs their alter: an owner user/message + a woken turn in the alter session.\n const instruction = typeof body['text'] === 'string' ? body['text'].replace(/\\s+$/, '') : ''\n if (instruction === '') return bad('text must not be empty')\n const sessions = options.sessions()\n if (sessions === undefined) return { status: 503, body: { error: { code: -32603, message: 'sessions plugin not mounted' } } }\n const result = await sessions.instruct(instruction)\n options.log('info', `owner → alter: session ${result.sessionId}, message ${result.messageId}`)\n return { status: 200, body: { ...result, state: sessions.latest() ?? null } }\n }\n case 'session.latest':\n return { status: 200, body: { state: options.sessions()?.latest() ?? null } }\n case 'session.history': {\n const sessions = options.sessions()\n const limit = num(body['limit'])\n if (sessions === undefined) return { status: 200, body: { sessionId: null, status: 'idle', chat: { items: [], running: false, seq: 0 } } }\n const h = sessions.history(limit)\n return { status: 200, body: { sessionId: h.sessionId ?? null, status: h.status, chat: h.chat } }\n }\n case 'drafts.list': {\n const fp = text(body['fp'])\n const sessions = options.sessions()\n return { status: 200, body: { drafts: sessions?.drafts.list(fp) ?? [] } }\n }\n case 'drafts.decide': {\n const id = text(body['id'])\n if (id === undefined) return bad('id must not be empty')\n const action = text(body['action'])\n const sessions = options.sessions()\n if (sessions === undefined) return { status: 503, body: { error: { code: -32603, message: 'sessions plugin not mounted' } } }\n if (action === 'approve') {\n const edited = typeof body['body'] === 'string' ? body['body'] : undefined\n const result = await sessions.decideDraft(id, { action: 'approve', ...(edited === undefined ? {} : { body: edited }) })\n return { status: 200, body: { ok: true, ...result } }\n }\n if (action === 'reject') return { status: 200, body: { ok: true, ...(await sessions.decideDraft(id, { action: 'reject' })) } }\n if (action === 'revise') {\n const feedback = text(body['feedback'])\n if (feedback === undefined) return bad('feedback must not be empty')\n return { status: 200, body: { ok: true, ...(await sessions.decideDraft(id, { action: 'revise', feedback })) } }\n }\n return bad('action must be approve | reject | revise')\n }\n case 'protocol.get':\n return { status: 200, body: { text: protocol.read(), path: protocol.path, exists: protocol.exists() } }\n case 'protocol.set': {\n if (typeof body['text'] !== 'string') return bad('text must be a string')\n protocol.write(body['text'])\n options.log('info', `diplomacy protocol saved (${body['text'].length} chars) → ${protocol.path}`)\n return { status: 200, body: { ok: true, text: protocol.read(), path: protocol.path } }\n }\n default:\n return { status: 404, body: { error: { code: -32601, message: `unknown route ${method} ${route}` } } }\n }\n }\n\n const handler = (async (req: IncomingMessage, res: ServerResponse): Promise<void> => {\n const url = new URL(req.url ?? '/', 'http://localhost')\n const route = url.pathname.startsWith(API_PREFIX) ? url.pathname.slice(API_PREFIX.length) : ''\n if (route === 'events' && req.method === 'GET') {\n res.writeHead(200, {\n 'content-type': 'text/event-stream',\n 'cache-control': 'no-store',\n connection: 'keep-alive',\n })\n res.write(`event: status\\ndata: ${JSON.stringify({ kind: 'status', status: client.status() })}\\n\\n`)\n sseClients.add(res)\n const keepAlive = setInterval(() => {\n try {\n res.write(': keep-alive\\n\\n')\n } catch {\n clearInterval(keepAlive)\n }\n }, 25_000)\n keepAlive.unref?.()\n req.on('close', () => {\n clearInterval(keepAlive)\n sseClients.delete(res)\n })\n return\n }\n if (req.method !== 'POST' && !(req.method === 'GET' && QUERY_ROUTES.has(route))) {\n send(res, 405, { error: { code: -32600, message: 'use POST with application/json (GET only for state / conversation.get / presence / session.latest / session.history / drafts.list / protocol.get / events)' } })\n return\n }\n try {\n const body: Json = req.method === 'POST' ? await readJson(req) : Object.fromEntries(url.searchParams.entries())\n const result = await handle(route, req.method ?? 'GET', body)\n send(res, result.status, result.body)\n } catch (error: unknown) {\n options.log('warn', `api ${route} failed: ${String(error)}`)\n send(res, error instanceof NetworkError ? 400 : 500, errorBody(error))\n }\n }) as ApiHandler\n handler.broadcast = broadcast\n handler.dispose = () => {\n unsubscribe()\n for (const res of sseClients) {\n try {\n res.end()\n } catch {\n // ignore\n }\n }\n sseClients.clear()\n }\n return handler\n}\n\n/** Mount the API on `ctx.webServer` when (and for as long as) that service exists. */\nexport function mountApi(ctx: Context, options: ApiOptions): void {\n ctx.inject(['webServer'], (wctx) => {\n const handler = createApiHandler(options)\n // The web server matches a prefix route as `/path` or `/path/...`, so register it without the trailing slash.\n const dispose = wctx.webServer.register({ kind: 'prefix', path: API_PREFIX.slice(0, -1), handler })\n options.log('info', `browser API mounted at ${API_PREFIX} (port ${wctx.webServer.port})`)\n // The sessions plugin's live events (alter state, the alter's own sends,\n // drafts) → SSE frames, for as long as both services exist.\n wctx.inject(['soulmirrorSessions'], (sctx) => {\n const off = sctx.soulmirrorSessions.on((event: SessionsEvent) => { handler.broadcast(event) })\n sctx.effect(() => off, 'soulmirror: alter events → SSE')\n })\n wctx.effect(() => () => {\n dispose()\n handler.dispose()\n }, 'soulmirror: browser API')\n })\n}\n","/**\n * In-memory fake NetworkClient (config `backend: fake`): two friends, one\n * pending request, one canned inbound message shortly after the first\n * subscribe, an auto-reply echo for every send, no I/O. Selectable for tests\n * and UI work; the default backend is the `soulnet` light peer (./soulnet.ts).\n */\nimport type { A2AMessageId, Fingerprint } from '../events.ts'\nimport {\n NetworkError,\n NetworkErrorCode,\n type BackendStatus,\n type ConversationEntry,\n type Friend,\n type Identity,\n type NetworkClient,\n type NetworkEvent,\n type PendingRequest,\n type SendReceipt,\n} from './types.ts'\n\nconst fp = (s: string): Fingerprint => s as Fingerprint\nconst mid = (): A2AMessageId => `a2a-${crypto.randomUUID()}` as A2AMessageId\n\nexport const FAKE_FRIENDS: readonly Friend[] = [\n { fp: fp('fp-alice-1f2e3d4c5b6a7988'), name: 'college friend', cardName: 'Alice', remark: 'college friend', online: true, unread: 0, count: 0 },\n { fp: fp('fp-bob-9a8b7c6d5e4f3021'), name: 'Bob', cardName: 'Bob', online: false, unread: 0, count: 0 },\n]\n\nexport const FAKE_PENDING: readonly PendingRequest[] = [\n { id: 'req-carol-1', fp: fp('fp-carol-5566778899aabbcc'), name: 'Carol', greeting: 'Hi, Alice gave me your card.' },\n]\n\nexport interface FakeOptions {\n /** Delay before the canned inbound message fires after the first subscribe (ms); negative = never. */\n readonly firstInboundDelayMs?: number\n /** Start without an identity (first-run onboarding path). Default: identity present. */\n readonly noIdentity?: boolean\n}\n\nexport function createFakeNetworkClient(options: FakeOptions = {}): NetworkClient {\n const listeners = new Set<(event: NetworkEvent) => void>()\n const friends = new Map<string, Friend>(FAKE_FRIENDS.map(f => [f.fp, f]))\n const pending = new Map<string, PendingRequest>(FAKE_PENDING.map(p => [p.id, p]))\n const conversations = new Map<string, ConversationEntry[]>()\n let identity: Identity | undefined = options.noIdentity === true\n ? undefined\n : { fp: fp('fp-me-0000aaaabbbbcccc'), name: 'dsh tester', cardUri: 'soulmirror://card?v=1&pk=FAKE&xpk=FAKE&name=dsh%20tester' }\n let firstInboundFired = false\n let disposed = false\n const status: BackendStatus = { backend: 'fake', state: 'ready', restarts: 0 }\n\n const emit = (event: NetworkEvent): void => {\n for (const l of listeners) {\n try {\n l(event)\n } catch {\n // listener errors never kill the fake\n }\n }\n }\n const archive = (peer: string, entry: Omit<ConversationEntry, 'seq'>): ConversationEntry => {\n const list = conversations.get(peer) ?? []\n const full: ConversationEntry = { seq: list.length + 1, ...entry }\n list.push(full)\n conversations.set(peer, list)\n const friend = friends.get(peer)\n if (friend !== undefined) {\n friends.set(peer, {\n ...friend,\n count: list.length,\n unread: entry.dir === 'in' ? friend.unread + 1 : friend.unread,\n lastTs: entry.ts,\n lastBody: entry.body,\n })\n }\n return full\n }\n const deliver = (from: Fingerprint, body: string, auto?: true): void => {\n if (disposed) return\n const friend = friends.get(from)\n const id = mid()\n const ts = Date.now()\n const entry = archive(from, { dir: 'in', id, body, ts, ...(auto ? { auto } : {}) })\n emit({\n kind: 'message',\n message: { id, from, name: friend?.name ?? from, body, ts, seq: entry.seq, ...(auto ? { auto } : {}) },\n })\n }\n const requireIdentity = (): Identity => {\n if (identity === undefined) throw new NetworkError('no identity yet (identity.create first)', NetworkErrorCode.noIdentity)\n return identity\n }\n const friendFromCard = (uri: string, remark?: string): Friend => ({\n fp: fp(`fp-${uri.slice(-8).replace(/[^a-z0-9]/gi, '') || 'card'}`),\n name: remark ?? `card ${uri.slice(-4)}`,\n cardName: `card ${uri.slice(-4)}`,\n ...(remark === undefined ? {} : { remark }),\n unread: 0,\n count: 0,\n })\n\n return {\n backend: 'fake',\n status: () => status,\n identity: () => Promise.resolve(identity),\n createIdentity: (name) => {\n if (identity !== undefined) return Promise.reject(new NetworkError('identity already exists', NetworkErrorCode.identityExists))\n identity = { fp: fp('fp-me-0000aaaabbbbcccc'), name, cardUri: `soulmirror://card?v=1&pk=FAKE&xpk=FAKE&name=${encodeURIComponent(name)}` }\n return Promise.resolve(identity)\n },\n card: () => Promise.resolve(requireIdentity().cardUri),\n parseCard: (uri) => {\n if (!uri.startsWith('soulmirror://card')) return Promise.reject(new NetworkError('invalid card link', NetworkErrorCode.badCard))\n const f = friendFromCard(uri)\n return Promise.resolve({ fp: f.fp, name: f.cardName ?? f.name, uri })\n },\n friends: {\n list: () => Promise.resolve([...friends.values()]),\n pending: () => Promise.resolve([...pending.values()]),\n add: (uri, remark) => {\n requireIdentity()\n if (!uri.startsWith('soulmirror://card')) return Promise.reject(new NetworkError('invalid card link', NetworkErrorCode.badCard))\n const f = friendFromCard(uri, remark)\n friends.set(f.fp, f)\n // The peer \"accepts\" shortly after.\n setTimeout(() => { if (!disposed) emit({ kind: 'friend_accept', friend: f }) }, 300)\n return Promise.resolve(f)\n },\n accept: (requestId, note) => {\n const req = pending.get(requestId)\n if (req === undefined) return Promise.reject(new NetworkError('no such pending request', NetworkErrorCode.notFound))\n pending.delete(requestId)\n const f: Friend = { fp: req.fp, name: note ?? req.name, cardName: req.name, ...(note === undefined ? {} : { remark: note }), unread: 0, count: 0 }\n friends.set(f.fp, f)\n return Promise.resolve(f)\n },\n reject: (requestId) => {\n if (!pending.delete(requestId)) return Promise.reject(new NetworkError('no such pending request', NetworkErrorCode.notFound))\n return Promise.resolve()\n },\n set: (id, patch) => {\n const cur = friends.get(id)\n if (cur === undefined) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n const { protocol: _old, ...rest } = cur\n const protocol = patch.protocol === undefined ? cur.protocol : patch.protocol.trim() === '' ? undefined : patch.protocol\n const next: Friend = {\n ...rest,\n ...(patch.remark === undefined ? {} : { remark: patch.remark, name: patch.remark }),\n ...(protocol === undefined ? {} : { protocol }),\n }\n friends.set(id, next)\n return Promise.resolve(next)\n },\n remove: (id) => {\n if (!friends.delete(id)) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n return Promise.resolve()\n },\n card: (id) => {\n const cur = friends.get(id)\n if (cur === undefined) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n return Promise.resolve({ fp: cur.fp, name: cur.cardName ?? cur.name, uri: `soulmirror://card?v=1&pk=FAKE-${cur.fp}&xpk=FAKE&name=${encodeURIComponent(cur.cardName ?? cur.name)}` })\n },\n },\n send: (to, body, options): Promise<SendReceipt> => {\n requireIdentity()\n if (!friends.has(to)) return Promise.reject(new NetworkError('not a friend (friends.add first)', NetworkErrorCode.notFriend))\n const id = mid()\n const entry = archive(to, { dir: 'out', id, body, ts: Date.now(), status: 'sent', ...(options?.auto === true ? { auto: true as const } : {}) })\n // Peer auto-reply 600 ms later, marked `auto` (loop-guard demo).\n setTimeout(() => { deliver(to, `(auto-reply) got it: \"${body.slice(0, 40)}\"`, true) }, 600)\n return Promise.resolve({ id, seq: entry.seq, status: 'sent' })\n },\n typing: (to, on) => {\n if (!friends.has(to)) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n void on\n return Promise.resolve()\n },\n conversation: (target, opts = {}) => {\n let entries = conversations.get(target) ?? []\n if (opts.since !== undefined) entries = entries.filter(e => e.seq > (opts.since as number))\n if (opts.limit !== undefined && opts.limit > 0 && entries.length > opts.limit) entries = entries.slice(-opts.limit)\n return Promise.resolve({ entries, typing: false })\n },\n markRead: (target) => {\n const cur = friends.get(target)\n if (cur === undefined) return Promise.reject(new NetworkError('not a friend', NetworkErrorCode.notFriend))\n friends.set(target, { ...cur, unread: 0 })\n return Promise.resolve()\n },\n presence: (fps) => Promise.resolve(Object.fromEntries(fps.map(f => [f, friends.get(f)?.online ?? false]))),\n subscribe: (listener) => {\n listeners.add(listener)\n if (!firstInboundFired) {\n firstInboundFired = true\n const delay = options.firstInboundDelayMs ?? 1500\n if (delay >= 0) {\n const alice = FAKE_FRIENDS[0]!\n setTimeout(() => { deliver(alice.fp, 'Hey, are you around? Hiking this weekend - bring your alter ego too!') }, delay)\n }\n }\n return () => { listeners.delete(listener) }\n },\n dispose: () => {\n disposed = true\n listeners.clear()\n return Promise.resolve()\n },\n debug: { inject: (from, body) => { deliver(from, body) } },\n }\n}\n","/**\n * Minimal line-delimited JSON-RPC 2.0 endpoint over a pair of Node streams.\n *\n * Used by the `soulnet` backend (stdin/stdout of the peer process) and by the\n * unit tests (PassThrough streams standing in for a peer). One JSON object per\n * line; requests carry an incrementing numeric id; frames without an id are\n * notifications and are handed to `onNotification`.\n */\nimport { createInterface, type Interface } from 'node:readline'\nimport type { Readable, Writable } from 'node:stream'\n\nexport interface JsonRpcErrorShape {\n readonly code: number\n readonly message: string\n readonly data?: unknown\n}\n\n/** A JSON-RPC error response, or a transport failure (code -32099 family). */\nexport class JsonRpcError extends Error {\n override readonly name = 'JsonRpcError'\n constructor(message: string, readonly code: number, readonly data?: unknown) {\n super(message)\n }\n}\n\n/** Transport-level code: the endpoint closed before the response arrived. */\nexport const JSONRPC_CLOSED = -32099\n/** Transport-level code: no response within the request timeout. */\nexport const JSONRPC_TIMEOUT = -32098\n\nexport interface JsonRpcNotification {\n readonly method: string\n readonly params: unknown\n}\n\nexport interface JsonRpcEndpointOptions {\n /** Default per-request timeout in ms (0 = none). */\n readonly timeoutMs?: number\n readonly onNotification?: (notification: JsonRpcNotification) => void\n /** Unparseable or malformed inbound lines (never thrown). */\n readonly onProtocolError?: (error: Error, line: string) => void\n /** The read side ended (EOF/error); every pending request is rejected first. */\n readonly onClose?: (error?: Error) => void\n}\n\ninterface Pending {\n readonly resolve: (value: unknown) => void\n readonly reject: (error: Error) => void\n readonly timer: NodeJS.Timeout | undefined\n readonly method: string\n}\n\nexport class JsonRpcEndpoint {\n private readonly pending = new Map<number, Pending>()\n private readonly reader: Interface\n private nextId = 1\n private closed = false\n\n constructor(private readonly input: Readable, private readonly output: Writable, private readonly options: JsonRpcEndpointOptions = {}) {\n this.reader = createInterface({ input, crlfDelay: Infinity })\n this.reader.on('line', line => { this.handleLine(line) })\n this.reader.on('close', () => { this.close() })\n input.on('error', (error: Error) => { this.close(error) })\n output.on('error', (error: Error) => { this.close(error) })\n }\n\n get isClosed(): boolean {\n return this.closed\n }\n\n /** Send a request and await its result; rejects with {@link JsonRpcError}. */\n request(method: string, params?: unknown, options: { timeoutMs?: number; signal?: AbortSignal } = {}): Promise<unknown> {\n if (this.closed) return Promise.reject(new JsonRpcError(`${method}: endpoint is closed`, JSONRPC_CLOSED))\n const id = this.nextId++\n return new Promise<unknown>((resolve, reject) => {\n const timeoutMs = options.timeoutMs ?? this.options.timeoutMs ?? 0\n const timer = timeoutMs > 0\n ? setTimeout(() => {\n this.pending.delete(id)\n reject(new JsonRpcError(`${method}: no response within ${timeoutMs} ms`, JSONRPC_TIMEOUT))\n }, timeoutMs)\n : undefined\n timer?.unref?.()\n const settle = (fn: () => void): void => {\n if (timer !== undefined) clearTimeout(timer)\n this.pending.delete(id)\n fn()\n }\n this.pending.set(id, {\n method,\n timer,\n resolve: value => { settle(() => { resolve(value) }) },\n reject: error => { settle(() => { reject(error) }) },\n })\n if (options.signal !== undefined) {\n const onAbort = (): void => {\n const entry = this.pending.get(id)\n entry?.reject(new JsonRpcError(`${method}: aborted`, JSONRPC_CLOSED))\n }\n if (options.signal.aborted) onAbort()\n else options.signal.addEventListener('abort', onAbort, { once: true })\n }\n if (!this.write({ jsonrpc: '2.0', id, method, ...(params === undefined ? {} : { params }) })) {\n this.pending.get(id)?.reject(new JsonRpcError(`${method}: endpoint is closed`, JSONRPC_CLOSED))\n }\n })\n }\n\n /** Fire-and-forget request without an id (no response expected). */\n notify(method: string, params?: unknown): void {\n this.write({ jsonrpc: '2.0', method, ...(params === undefined ? {} : { params }) })\n }\n\n /** Reject every pending request and stop reading. Idempotent. */\n close(error?: Error): void {\n if (this.closed) return\n this.closed = true\n this.reader.close()\n const reason = new JsonRpcError(error === undefined ? 'endpoint closed' : `endpoint closed: ${error.message}`, JSONRPC_CLOSED)\n for (const entry of [...this.pending.values()]) entry.reject(reason)\n this.pending.clear()\n this.options.onClose?.(error)\n }\n\n private write(frame: object): boolean {\n if (this.closed) return false\n try {\n this.output.write(`${JSON.stringify(frame)}\\n`)\n return true\n } catch (error: unknown) {\n this.close(error instanceof Error ? error : new Error(String(error)))\n return false\n }\n }\n\n private handleLine(line: string): void {\n const trimmed = line.trim()\n if (trimmed === '') return\n let frame: unknown\n try {\n frame = JSON.parse(trimmed)\n } catch (error: unknown) {\n this.options.onProtocolError?.(error instanceof Error ? error : new Error(String(error)), line)\n return\n }\n if (typeof frame !== 'object' || frame === null) {\n this.options.onProtocolError?.(new Error('frame is not an object'), line)\n return\n }\n const f = frame as { id?: unknown; method?: unknown; params?: unknown; result?: unknown; error?: unknown }\n if (typeof f.method === 'string' && (f.id === undefined || f.id === null)) {\n this.options.onNotification?.({ method: f.method, params: f.params })\n return\n }\n if (typeof f.id !== 'number') {\n this.options.onProtocolError?.(new Error('response without a numeric id'), line)\n return\n }\n const entry = this.pending.get(f.id)\n if (entry === undefined) {\n this.options.onProtocolError?.(new Error(`response for unknown request id ${f.id}`), line)\n return\n }\n if (f.error !== undefined && f.error !== null) {\n const e = f.error as Partial<JsonRpcErrorShape>\n entry.reject(new JsonRpcError(\n typeof e.message === 'string' ? e.message : `${entry.method} failed`,\n typeof e.code === 'number' ? e.code : -32603,\n e.data,\n ))\n return\n }\n entry.resolve(f.result)\n }\n}\n","/**\n * `soulnet` backend: spawns the soulnet light peer (Go, ../cmd/soulnet) and\n * drives it over line-delimited JSON-RPC 2.0 on stdio (protocol: cmd/soulnet/\n * README.md, `initialize.protocol === \"soulnet/1\"`).\n *\n * - request/response by id, notifications → `subscribe` listeners;\n * - the process is restarted with exponential backoff when it dies;\n * - `dispose()` sends `shutdown`, then kills the process if it lingers;\n * - calls issued while the peer is (re)starting wait for it up to the request\n * timeout instead of failing immediately.\n *\n * Binary lookup (`resolveSoulnetBinary` / `locateSoulnetBinary`), in order:\n * 1. the explicit `peerBinary` setting (absolute path, or a bare name looked up on PATH);\n * 2. the platform package `soulnet-peer-<os>-<arch>` installed next to\n * this plugin as an optional dependency (`require.resolve('<pkg>/package.json')`\n * from this file and from its realpath, so pnpm's symlinked virtual store and\n * the hoisted layout both work) -> `<pkg>/bin/soulnet[.exe]`;\n * 3. `soulnet` on PATH;\n * 4. `<plugin dir>/bin/soulnet[.exe]` (a hand-dropped binary for development).\n * The winner and its source are reported in `BackendStatus.binary` / `binarySource`.\n */\nimport { spawn, type ChildProcess } from 'node:child_process'\nimport { accessSync, chmodSync, constants, realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { homedir } from 'node:os'\nimport { delimiter, dirname, isAbsolute, join } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport type { A2AMessageId, Fingerprint } from '../events.ts'\nimport { JsonRpcEndpoint, JsonRpcError, JSONRPC_CLOSED, JSONRPC_TIMEOUT } from './jsonrpc.ts'\nimport {\n NetworkError,\n NetworkErrorCode,\n type BackendStatus,\n type ConversationEntry,\n type Friend,\n type Identity,\n type NetworkClient,\n type NetworkEvent,\n type PendingRequest,\n type SendReceipt,\n} from './types.ts'\n\nexport const DEFAULT_RELAY = 'https://relay.startupworld.cn'\nexport const SOULNET_PROTOCOL = 'soulnet/1'\n\nexport type SoulnetLogger = (level: 'info' | 'warn' | 'error', message: string) => void\n\nexport interface SoulnetSpawnRequest {\n readonly binary: string\n readonly args: readonly string[]\n}\n\nexport interface SoulnetClientOptions {\n /** Data directory passed as `--home` (`a2a/` lives underneath). */\n readonly home: string\n /** Relay URL passed as `--relay` (only used when the identity is created). */\n readonly relay?: string\n /** Create the identity with this name on first start (`initialize {name}`); empty = wait for the host. */\n readonly displayName?: string\n /** Explicit binary path; when absent {@link resolveSoulnetBinary} runs. */\n readonly peerBinary?: string\n /** Per-request timeout (default 30 s; `message.send` with the relay down can take a while). */\n readonly requestTimeoutMs?: number\n /** Restart backoff (ms). Defaults: 500 → ×2 → max 30 000. */\n readonly backoff?: { readonly initialMs?: number; readonly maxMs?: number; readonly factor?: number }\n /** Test seam: replace `child_process.spawn`. */\n readonly spawn?: (request: SoulnetSpawnRequest) => ChildProcess\n readonly logger?: SoulnetLogger\n /** Extra env for the child (merged over process.env). */\n readonly env?: Record<string, string>\n}\n\n/** Default home: `$SOULNET_HOME`, else `~/.soulnet` (same rule as the binary itself). */\nexport function defaultSoulnetHome(env: NodeJS.ProcessEnv = process.env): string {\n const fromEnv = env['SOULNET_HOME']\n if (fromEnv !== undefined && fromEnv !== '') return fromEnv\n return join(homedir(), '.soulnet')\n}\n\nfunction isExecutable(path: string): boolean {\n try {\n accessSync(path, constants.F_OK)\n return true\n } catch {\n return false\n }\n}\n\n/** Where the binary came from (reported in `BackendStatus.binarySource`). */\nexport type SoulnetBinarySource = 'setting' | 'platform-package' | 'path' | 'plugin-bin'\n\nexport interface SoulnetBinaryLocation {\n readonly path: string\n readonly source: SoulnetBinarySource\n}\n\n/** Prefix of the per-platform binary packages on npm (`soulnet-peer-<os>-<arch>`). */\nexport const PLATFORM_PACKAGE_PREFIX = 'soulnet-peer-'\n/** The `<process.platform>-<process.arch>` pairs a platform package exists for (must match dsh/packages/soulnet-*). */\nexport const PLATFORM_PACKAGE_TARGETS: readonly string[] = ['win32-x64', 'darwin-arm64', 'darwin-x64', 'linux-x64', 'linux-arm64']\n/**\n * How the `<os>` part of the package name is spelled when it differs from `process.platform`.\n * npm's spam filter rejects new unscoped names ending in `-win32-x64`, so the Windows\n * package is published as `soulnet-peer-windows-x64` (the workspace directory keeps `win32`).\n */\nexport const PLATFORM_PACKAGE_OS_NAMES: Readonly<Record<string, string>> = { win32: 'windows' }\n\n/** `soulnet-peer-<os>-<arch>` for a supported pair, else `undefined`. */\nexport function platformPackageName(platform: NodeJS.Platform = process.platform, arch: string = process.arch): string | undefined {\n const target = `${platform}-${arch}`\n if (!PLATFORM_PACKAGE_TARGETS.includes(target)) return undefined\n return `${PLATFORM_PACKAGE_PREFIX}${PLATFORM_PACKAGE_OS_NAMES[platform] ?? platform}-${arch}`\n}\n\n/**\n * Resolve an installed package's directory from this plugin's location: first\n * from this file's URL (dsh loads lib/index.js from the profile's node_modules,\n * hoisted or symlinked), then from its realpath (pnpm's isolated virtual store\n * keeps the optional dependency next to the REAL plugin directory).\n */\nfunction defaultResolvePackageDir(name: string): string | undefined {\n const bases: string[] = [import.meta.url]\n try {\n const real = realpathSync(fileURLToPath(import.meta.url))\n const realUrl = pathToFileURL(real).href\n if (realUrl !== import.meta.url) bases.push(realUrl)\n } catch {\n // not a file URL (bundled in memory) or unreadable; the first base still works\n }\n for (const base of bases) {\n try {\n return dirname(createRequire(base).resolve(`${name}/package.json`))\n } catch {\n // not installed from this base\n }\n }\n return undefined\n}\n\nfunction ensureExecutable(path: string, platform: NodeJS.Platform): void {\n if (platform === 'win32') return\n try {\n accessSync(path, constants.X_OK)\n } catch {\n try {\n chmodSync(path, 0o755) // tarballs packed on Windows lose the mode bit\n } catch {\n // read-only install: spawn will report the real error\n }\n }\n}\n\nexport interface ResolveSoulnetBinaryOptions {\n /** `process.arch` by default. */\n readonly arch?: string\n /** Test seam: package name -> installed package directory (default: `require.resolve` next to this file). */\n readonly resolvePackageDir?: (name: string) => string | undefined\n}\n\n/**\n * Find the `soulnet` binary (order documented at the top of this file) and say\n * where it came from. `undefined` when nothing was found (the caller reports a\n * clear error).\n */\nexport function locateSoulnetBinary(\n explicit: string | undefined,\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n options: ResolveSoulnetBinaryOptions = {},\n): SoulnetBinaryLocation | undefined {\n const names = platform === 'win32' ? ['soulnet.exe', 'soulnet'] : ['soulnet']\n if (explicit !== undefined && explicit.trim() !== '') {\n const candidate = explicit.trim()\n // A bare name (no separator) is looked up on PATH like the default.\n if (isAbsolute(candidate) || candidate.includes('/') || candidate.includes('\\\\')) return { path: candidate, source: 'setting' }\n for (const dir of (env['PATH'] ?? '').split(delimiter)) {\n if (dir === '') continue\n const full = join(dir, candidate)\n if (isExecutable(full)) return { path: full, source: 'setting' }\n if (platform === 'win32' && !candidate.toLowerCase().endsWith('.exe') && isExecutable(`${full}.exe`)) return { path: `${full}.exe`, source: 'setting' }\n }\n return { path: candidate, source: 'setting' }\n }\n // 2. the platform package installed as an optional dependency of this plugin\n const pkgName = platformPackageName(platform, options.arch ?? process.arch)\n if (pkgName !== undefined) {\n const dir = (options.resolvePackageDir ?? defaultResolvePackageDir)(pkgName)\n if (dir !== undefined) {\n for (const name of names) {\n const full = join(dir, 'bin', name)\n if (isExecutable(full)) {\n ensureExecutable(full, platform)\n return { path: full, source: 'platform-package' }\n }\n }\n }\n }\n // 3. PATH\n for (const dir of (env['PATH'] ?? '').split(delimiter)) {\n if (dir === '') continue\n for (const name of names) {\n const full = join(dir, name)\n if (isExecutable(full)) return { path: full, source: 'path' }\n }\n }\n // 4. lib/index.js -> ../bin ; src/network/soulnet.ts -> ../../bin\n const here = dirname(fileURLToPath(import.meta.url))\n for (const root of [join(here, '..'), join(here, '..', '..')]) {\n for (const name of names) {\n const full = join(root, 'bin', name)\n if (isExecutable(full)) return { path: full, source: 'plugin-bin' }\n }\n }\n return undefined\n}\n\n/** Path-only form of {@link locateSoulnetBinary}. */\nexport function resolveSoulnetBinary(\n explicit: string | undefined,\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n options: ResolveSoulnetBinaryOptions = {},\n): string | undefined {\n return locateSoulnetBinary(explicit, env, platform, options)?.path\n}\n\nconst fp = (s: string): Fingerprint => s as Fingerprint\nconst mid = (s: string): A2AMessageId => s as A2AMessageId\n\nfunction toMs(value: unknown): number {\n if (typeof value === 'number') return value\n if (typeof value === 'string') {\n const parsed = Date.parse(value)\n if (!Number.isNaN(parsed)) return parsed\n }\n return Date.now()\n}\n\nfunction str(value: unknown, fallback = ''): string {\n return typeof value === 'string' ? value : fallback\n}\n\nfunction shortFp(value: string): string {\n return value.length > 12 ? `${value.slice(0, 12)}…` : value\n}\n\n// ——— wire shapes (subset of what soulnet returns; see cmd/soulnet/rpc.go) ———\n\ninterface WireIdentity { name?: string; fingerprint?: string; created_at?: string }\ninterface WireCard { name?: string }\ninterface WireMessage {\n id?: string; from?: string; to?: string; ts?: string; type?: string; body?: string; auto?: boolean\n artifact_name?: string; card?: WireCard\n}\ninterface WireFriend {\n fingerprint?: string; note?: string; protocol?: string; card?: WireCard; added_at?: string\n count?: number; unread?: number; last?: WireMessage; typing?: boolean\n}\ninterface WirePending { id?: string; peer?: string; incoming?: WireMessage; created_at?: string }\ninterface WireEntry extends WireMessage { seq?: number; dir?: string; status?: string }\n\nexport function friendFromWire(w: WireFriend): Friend {\n const fingerprint = str(w.fingerprint)\n const note = str(w.note)\n const cardName = str(w.card?.name)\n const name = note !== '' ? note : cardName !== '' ? cardName : shortFp(fingerprint)\n return {\n fp: fp(fingerprint),\n name,\n ...(note === '' ? {} : { remark: note }),\n ...(cardName === '' ? {} : { cardName }),\n ...(str(w.protocol) === '' ? {} : { protocol: str(w.protocol) }),\n unread: typeof w.unread === 'number' ? w.unread : 0,\n count: typeof w.count === 'number' ? w.count : 0,\n ...(w.last?.ts === undefined ? {} : { lastTs: toMs(w.last.ts) }),\n ...(w.last?.body === undefined ? {} : { lastBody: w.last.body }),\n ...(w.typing === true ? { typing: true } : {}),\n ...(w.added_at === undefined ? {} : { addedAt: w.added_at }),\n }\n}\n\nexport function pendingFromWire(w: WirePending): PendingRequest {\n const peer = str(w.peer)\n const cardName = str(w.incoming?.card?.name)\n return {\n id: str(w.id),\n fp: fp(peer),\n name: cardName !== '' ? cardName : shortFp(peer),\n greeting: str(w.incoming?.body),\n ...(w.created_at === undefined ? {} : { createdAt: w.created_at }),\n }\n}\n\nfunction entryFromWire(w: WireEntry): ConversationEntry {\n return {\n seq: typeof w.seq === 'number' ? w.seq : 0,\n dir: w.dir === 'out' ? 'out' : 'in',\n id: mid(str(w.id)),\n body: str(w.body),\n ts: toMs(w.ts),\n ...(w.type === undefined || w.type === '' ? {} : { type: w.type }),\n ...(w.auto === true ? { auto: true as const } : {}),\n ...(w.status === undefined || w.status === '' ? {} : { status: w.status }),\n ...(w.artifact_name === undefined || w.artifact_name === '' ? {} : { artifactName: w.artifact_name }),\n }\n}\n\nfunction toNetworkError(error: unknown, method: string): NetworkError {\n if (error instanceof NetworkError) return error\n if (error instanceof JsonRpcError) {\n const code = error.code === JSONRPC_CLOSED || error.code === JSONRPC_TIMEOUT ? NetworkErrorCode.peerUnavailable : error.code\n return new NetworkError(error.message, code, error.data)\n }\n return new NetworkError(`${method}: ${String(error)}`, -32603)\n}\n\n/**\n * Create the soulnet-backed NetworkClient. The process is spawned lazily on\n * the first call or on `start()`; `dispose()` stops it.\n */\nexport function createSoulnetNetworkClient(options: SoulnetClientOptions): NetworkClient & { start(): void } {\n const log: SoulnetLogger = options.logger ?? (() => {})\n const relay = options.relay !== undefined && options.relay.trim() !== '' ? options.relay.trim() : DEFAULT_RELAY\n const requestTimeoutMs = options.requestTimeoutMs ?? 30_000\n const backoffInitial = options.backoff?.initialMs ?? 500\n const backoffMax = options.backoff?.maxMs ?? 30_000\n const backoffFactor = options.backoff?.factor ?? 2\n\n const listeners = new Set<(event: NetworkEvent) => void>()\n let child: ChildProcess | undefined\n let endpoint: JsonRpcEndpoint | undefined\n let disposed = false\n let started = false\n let restarts = 0\n let backoffMs = backoffInitial\n let restartTimer: NodeJS.Timeout | undefined\n let status: BackendStatus = { backend: 'soulnet', state: 'stopped', restarts: 0, relay, home: options.home }\n let cachedCardUri: string | undefined\n const friendNames = new Map<string, string>()\n\n // Waiters for \"endpoint is up\" (calls made while (re)starting).\n let readyWaiters: { resolve: (endpoint: JsonRpcEndpoint) => void; reject: (error: Error) => void }[] = []\n\n const emit = (event: NetworkEvent): void => {\n for (const listener of listeners) {\n try {\n listener(event)\n } catch (error: unknown) {\n log('warn', `network listener failed: ${String(error)}`)\n }\n }\n }\n const setStatus = (patch: Partial<BackendStatus>): void => {\n status = { ...status, ...patch }\n emit({ kind: 'status', status })\n }\n const clearError = (): void => {\n const { lastError: _dropped, ...rest } = status\n status = rest\n }\n\n const handleNotification = (method: string, params: unknown): void => {\n const p = (typeof params === 'object' && params !== null ? params : {}) as {\n peer?: string; seq?: number; message?: WireMessage; artifact_path?: string; artifact_name?: string\n pending_id?: string; friend?: WireFriend; on?: boolean\n }\n const peer = str(p.peer)\n switch (method) {\n case 'message.received': {\n const m = p.message ?? {}\n const type = str(m.type, 'text')\n const name = friendNames.get(peer) ?? shortFp(peer)\n const body = str(m.body) !== '' ? str(m.body) : type === 'app_share' ? '[app share]' : ''\n emit({\n kind: 'message',\n message: {\n id: mid(str(m.id)),\n from: fp(peer),\n name,\n body,\n ts: toMs(m.ts),\n ...(typeof p.seq === 'number' ? { seq: p.seq } : {}),\n ...(m.auto === true ? { auto: true as const } : {}),\n ...(type === 'text' ? {} : { type }),\n ...(p.artifact_path === undefined || p.artifact_path === '' ? {} : { artifactPath: p.artifact_path }),\n ...(m.artifact_name === undefined || m.artifact_name === '' ? {} : { artifactName: m.artifact_name }),\n },\n })\n return\n }\n case 'friend.request': {\n const m = p.message ?? {}\n const cardName = str(m.card?.name)\n emit({\n kind: 'friend_request',\n request: { id: str(p.pending_id), fp: fp(peer), name: cardName !== '' ? cardName : shortFp(peer), greeting: str(m.body) },\n })\n return\n }\n case 'friend.accepted': {\n const friend = friendFromWire(p.friend ?? { fingerprint: peer })\n friendNames.set(friend.fp, friend.name)\n emit({ kind: 'friend_accept', friend })\n return\n }\n case 'typing':\n emit({ kind: 'typing', fp: fp(peer), on: p.on === true })\n return\n case 'presence.changed':\n emit({ kind: 'presence', fp: fp(peer), online: p.on === true })\n return\n case 'mission.update':\n case 'artifact.ready':\n log('info', `soulnet notification ${method} from ${shortFp(peer)} (not handled in M1)`)\n return\n default:\n log('warn', `unknown soulnet notification ${method}`)\n }\n }\n\n const failWaiters = (error: Error): void => {\n const waiters = readyWaiters\n readyWaiters = []\n for (const w of waiters) w.reject(error)\n }\n\n const scheduleRestart = (reason: string): void => {\n if (disposed) return\n restarts += 1\n const delay = backoffMs\n backoffMs = Math.min(backoffMax, Math.round(backoffMs * backoffFactor))\n setStatus({ state: 'restarting', restarts, lastError: reason })\n log('warn', `soulnet peer died (${reason}); restart #${restarts} in ${delay} ms`)\n restartTimer = setTimeout(() => {\n restartTimer = undefined\n spawnPeer()\n }, delay)\n restartTimer.unref?.()\n }\n\n const spawnPeer = (): void => {\n if (disposed) return\n const location = locateSoulnetBinary(options.peerBinary)\n if (location === undefined) {\n const pkg = platformPackageName() ?? `${PLATFORM_PACKAGE_PREFIX}<os>-<arch> (none published for ${process.platform}-${process.arch})`\n const message = `soulnet binary not found: the platform package ${pkg} is not installed next to the plugin (reinstall with optional dependencies enabled), or set \\`peerBinary\\` in the SoulMirror network settings, put \\`soulnet\\` on PATH, or place it in the plugin's bin/ directory`\n setStatus({ state: 'error', lastError: message })\n log('error', message)\n failWaiters(new NetworkError(message, NetworkErrorCode.peerUnavailable))\n return\n }\n const binary = location.path\n const args = ['--home', options.home, '--relay', relay]\n clearError()\n setStatus({ state: 'starting', binary, binarySource: location.source })\n log('info', `soulnet binary: ${binary} (${location.source})`)\n let proc: ChildProcess\n try {\n proc = options.spawn !== undefined\n ? options.spawn({ binary, args })\n : spawn(binary, args, { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true, env: { ...process.env, ...(options.env ?? {}) } })\n } catch (error: unknown) {\n scheduleRestart(`spawn failed: ${String(error)}`)\n return\n }\n child = proc\n if (proc.stdout === null || proc.stdin === null) {\n proc.kill()\n scheduleRestart('spawned process has no stdio pipes')\n return\n }\n proc.stderr?.setEncoding('utf8')\n proc.stderr?.on('data', (chunk: string) => {\n for (const line of chunk.split(/\\r?\\n/)) if (line.trim() !== '') log('info', `[soulnet] ${line.trim()}`)\n })\n const ep = new JsonRpcEndpoint(proc.stdout, proc.stdin, {\n timeoutMs: requestTimeoutMs,\n onNotification: n => { handleNotification(n.method, n.params) },\n onProtocolError: (error, line) => { log('warn', `soulnet protocol: ${error.message}: ${line.slice(0, 200)}`) },\n })\n endpoint = ep\n let exited = false\n proc.on('error', (error: Error) => {\n if (exited) return\n exited = true\n if (endpoint === ep) endpoint = undefined\n ep.close(error)\n scheduleRestart(`process error: ${error.message}`)\n })\n proc.on('exit', (code, signal) => {\n if (exited) return\n exited = true\n if (endpoint === ep) endpoint = undefined\n if (child === proc) child = undefined\n ep.close()\n if (disposed) {\n setStatus({ state: 'stopped' })\n return\n }\n scheduleRestart(`exit code=${code ?? 'null'} signal=${signal ?? 'none'}`)\n })\n // Handshake: initialize (creates the identity when a display name is configured and none exists).\n const name = options.displayName?.trim() ?? ''\n void ep.request('initialize', name === '' ? {} : { name }, { timeoutMs: 15_000 }).then((result) => {\n const r = (typeof result === 'object' && result !== null ? result : {}) as { protocol?: string; version?: string; identity?: WireIdentity | null; home?: string; relay?: string }\n if (r.protocol !== SOULNET_PROTOCOL) log('warn', `soulnet speaks ${String(r.protocol)}; this plugin was written for ${SOULNET_PROTOCOL}`)\n backoffMs = backoffInitial\n cachedCardUri = undefined\n setStatus({\n state: 'ready',\n ...(proc.pid === undefined ? {} : { pid: proc.pid }),\n ...(r.protocol === undefined ? {} : { protocol: r.protocol }),\n ...(r.version === undefined ? {} : { version: r.version }),\n ...(r.home === undefined ? {} : { home: r.home }),\n ...(r.relay === undefined ? {} : { relay: r.relay }),\n })\n log('info', `soulnet peer ready pid=${proc.pid ?? '?'} protocol=${String(r.protocol)} identity=${r.identity?.fingerprint ?? 'none'}`)\n const waiters = readyWaiters\n readyWaiters = []\n for (const w of waiters) w.resolve(ep)\n }).catch((error: unknown) => {\n if (exited || disposed) return\n log('error', `soulnet initialize failed: ${String(error)}`)\n proc.kill()\n })\n }\n\n const ready = (timeoutMs: number): Promise<JsonRpcEndpoint> => {\n if (disposed) return Promise.reject(new NetworkError('soulnet backend is disposed', NetworkErrorCode.peerUnavailable))\n if (endpoint !== undefined && !endpoint.isClosed && status.state === 'ready') return Promise.resolve(endpoint)\n if (!started) start()\n if (status.state === 'error') return Promise.reject(new NetworkError(status.lastError ?? 'soulnet backend unavailable', NetworkErrorCode.peerUnavailable))\n return new Promise<JsonRpcEndpoint>((resolve, reject) => {\n const timer = setTimeout(() => {\n readyWaiters = readyWaiters.filter(w => w.resolve !== resolve)\n reject(new NetworkError(`soulnet peer not ready within ${timeoutMs} ms (state=${status.state})`, NetworkErrorCode.peerUnavailable))\n }, timeoutMs)\n timer.unref?.()\n readyWaiters.push({\n resolve: ep => { clearTimeout(timer); resolve(ep) },\n reject: error => { clearTimeout(timer); reject(error) },\n })\n })\n }\n\n const call = async <T>(method: string, params?: unknown, timeoutMs = requestTimeoutMs): Promise<T> => {\n const ep = await ready(timeoutMs)\n try {\n return (await ep.request(method, params, { timeoutMs })) as T\n } catch (error: unknown) {\n throw toNetworkError(error, method)\n }\n }\n\n const start = (): void => {\n if (started || disposed) return\n started = true\n spawnPeer()\n }\n\n const identity = async (): Promise<Identity | undefined> => {\n const r = await call<{ identity?: WireIdentity | null }>('identity.get')\n if (r.identity === undefined || r.identity === null) return undefined\n const cardUri = await card()\n return {\n fp: fp(str(r.identity.fingerprint)),\n name: str(r.identity.name),\n cardUri,\n ...(r.identity.created_at === undefined ? {} : { createdAt: r.identity.created_at }),\n }\n }\n\n const card = async (): Promise<string> => {\n if (cachedCardUri !== undefined) return cachedCardUri\n const r = await call<{ uri?: string }>('card.get')\n cachedCardUri = str(r.uri)\n return cachedCardUri\n }\n\n const rememberNames = (friends: readonly Friend[]): void => {\n for (const f of friends) friendNames.set(f.fp, f.name)\n }\n\n const client: NetworkClient & { start(): void } = {\n backend: 'soulnet',\n start,\n status: () => status,\n identity,\n createIdentity: async (name) => {\n const r = await call<{ identity?: WireIdentity }>('identity.create', { name })\n cachedCardUri = undefined\n const cardUri = await card()\n return { fp: fp(str(r.identity?.fingerprint)), name: str(r.identity?.name, name), cardUri }\n },\n card,\n parseCard: async (uri) => {\n const r = await call<{ uri?: string; fingerprint?: string; card?: WireCard }>('card.parse', { uri })\n return { fp: fp(str(r.fingerprint)), name: str(r.card?.name), uri: str(r.uri, uri) }\n },\n friends: {\n list: async () => {\n const r = await call<{ friends?: WireFriend[] }>('friends.list')\n const friends = (r.friends ?? []).map(friendFromWire)\n rememberNames(friends)\n return friends\n },\n pending: async () => {\n const r = await call<{ pending?: WirePending[] }>('friends.pending')\n return (r.pending ?? []).map(pendingFromWire)\n },\n add: async (cardUri, note) => {\n const r = await call<{ friend?: WireFriend }>('friends.add', { card_uri: cardUri, ...(note === undefined ? {} : { note }) })\n const friend = friendFromWire(r.friend ?? {})\n friendNames.set(friend.fp, friend.name)\n return friend\n },\n accept: async (requestId, note) => {\n const r = await call<{ friend?: WireFriend }>('friends.accept', { id: requestId, ...(note === undefined ? {} : { note }) })\n const friend = friendFromWire(r.friend ?? {})\n friendNames.set(friend.fp, friend.name)\n return friend\n },\n reject: async (requestId) => {\n await call('friends.reject', { id: requestId })\n },\n set: async (target, patch) => {\n const r = await call<{ friend?: WireFriend }>('friends.set', {\n fp: target,\n ...(patch.remark === undefined ? {} : { note: patch.remark }),\n ...(patch.protocol === undefined ? {} : { protocol: patch.protocol }),\n })\n const friend = friendFromWire(r.friend ?? {})\n friendNames.set(friend.fp, friend.name)\n return friend\n },\n remove: async (target) => {\n await call('friends.remove', { fp: target })\n friendNames.delete(target)\n },\n card: async (target) => {\n const r = await call<{ uri?: string; fingerprint?: string; card?: WireCard }>('friends.card', { fp: target })\n return { fp: fp(str(r.fingerprint, target)), name: str(r.card?.name), uri: str(r.uri) }\n },\n },\n send: async (to, body, options) => {\n const r = await call<{ id?: string; seq?: number; status?: string }>('message.send', {\n to,\n body,\n ...(options?.file === undefined ? {} : { file: options.file }),\n ...(options?.auto === true ? { auto: true } : {}),\n })\n const receipt: SendReceipt = { id: mid(str(r.id)), status: str(r.status, 'sent'), ...(typeof r.seq === 'number' ? { seq: r.seq } : {}) }\n return receipt\n },\n typing: async (to, on) => {\n await call('message.typing', { to, on }, 10_000)\n },\n conversation: async (target, opts = {}) => {\n const r = await call<{ entries?: WireEntry[]; typing?: boolean }>('conversation.get', {\n fp: target,\n ...(opts.since === undefined ? {} : { since: opts.since }),\n ...(opts.limit === undefined ? {} : { limit: opts.limit }),\n })\n return { entries: (r.entries ?? []).map(entryFromWire), typing: r.typing === true }\n },\n markRead: async (target, seq) => {\n await call('conversation.markRead', { fp: target, seq })\n },\n presence: async (fps) => {\n const r = await call<{ online?: Record<string, boolean> }>('presence', { fps: [...fps] }, 15_000)\n return r.online ?? {}\n },\n subscribe: (listener) => {\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n },\n dispose: async () => {\n if (disposed) return\n disposed = true\n if (restartTimer !== undefined) {\n clearTimeout(restartTimer)\n restartTimer = undefined\n }\n failWaiters(new NetworkError('soulnet backend is disposed', NetworkErrorCode.peerUnavailable))\n const proc = child\n const ep = endpoint\n if (proc === undefined) {\n setStatus({ state: 'stopped' })\n return\n }\n const exited = new Promise<void>((resolve) => {\n if (proc.exitCode !== null || proc.signalCode !== null) {\n resolve()\n return\n }\n proc.once('exit', () => { resolve() })\n })\n if (ep !== undefined && !ep.isClosed) {\n try {\n await ep.request('shutdown', undefined, { timeoutMs: 2_000 })\n } catch {\n // fall through to kill\n }\n }\n const killTimer = setTimeout(() => { proc.kill() }, 2_000)\n killTimer.unref?.()\n await exited\n clearTimeout(killTimer)\n ep?.close()\n setStatus({ state: 'stopped' })\n log('info', 'soulnet peer stopped')\n },\n }\n return client\n}\n","//#region lib/types/misc.js\n/** No-op callback returning `undefined` at runtime and `any` at type level. */\nfunction noop() {}\n/** Return true when a value is `null` or `undefined`. */\nfunction isNullable(value) {\n\treturn value === null || value === void 0;\n}\n/** Return true when a value is neither `null` nor `undefined`. */\nfunction isNonNullable(value) {\n\treturn !isNullable(value);\n}\n/** Return true for non-array object values. */\nfunction isPlainObject(data) {\n\treturn data && typeof data === \"object\" && !Array.isArray(data);\n}\n/** Filter object entries and return a new object. */\nfunction filterKeys(object, filter) {\n\treturn Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));\n}\n/** Map object values while preserving the original key set. */\nfunction mapValues(object, transform) {\n\treturn Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));\n}\n/** Pick selected keys from an object, optionally including `undefined` values. */\nfunction pick(source, keys, forced) {\n\tif (!keys) return { ...source };\n\tconst result = {};\n\tfor (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];\n\treturn result;\n}\n/** Omit selected keys from a shallow object copy. */\nfunction omit(source, keys) {\n\tif (!keys) return { ...source };\n\tconst result = { ...source };\n\tfor (const key of keys) Reflect.deleteProperty(result, key);\n\treturn result;\n}\n/** Define a non-enumerable writable property and return the object. */\nfunction defineProperty(object, key, value) {\n\treturn Object.defineProperty(object, key, {\n\t\twritable: true,\n\t\tvalue,\n\t\tenumerable: false\n\t});\n}\n//#endregion\n//#region lib/types/array.js\n/** Return true when every item in `array2` is present in `array1`. */\nfunction contain(array1, array2) {\n\treturn array2.every((item) => array1.includes(item));\n}\n/** Return items that appear in both arrays. */\nfunction intersection(array1, array2) {\n\treturn array1.filter((item) => array2.includes(item));\n}\n/** Return items from `array1` that do not appear in `array2`. */\nfunction difference(array1, array2) {\n\treturn array1.filter((item) => !array2.includes(item));\n}\n/** Return the set-union of two arrays while preserving first occurrence order. */\nfunction union(array1, array2) {\n\treturn Array.from(new Set([...array1, ...array2]));\n}\n/** Remove duplicate values while preserving first occurrence order. */\nfunction deduplicate(array) {\n\treturn [...new Set(array)];\n}\n/** Remove one item from an array and report whether it was found. */\nfunction remove(list, item) {\n\tconst index = list?.indexOf(item);\n\tif (index >= 0) {\n\t\tlist.splice(index, 1);\n\t\treturn true;\n\t} else return false;\n}\n/** Normalize nullish, scalar, or array input to an array. */\nfunction makeArray(source) {\n\treturn Array.isArray(source) ? source : isNullable(source) ? [] : [source];\n}\n//#endregion\n//#region lib/types/types.js\n/** Test values using `instanceof` with a `toStringTag` fallback. */\nfunction is(type, value) {\n\tif (arguments.length === 1) return (value) => is(type, value);\n\treturn type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;\n}\nfunction isArrayBufferLike(value) {\n\treturn is(\"ArrayBuffer\", value) || is(\"SharedArrayBuffer\", value);\n}\nfunction isArrayBufferSource(value) {\n\treturn isArrayBufferLike(value) || ArrayBuffer.isView(value);\n}\n/** Binary source detection and base64/hex conversion helpers. */\nvar Binary;\n(function(Binary) {\n\tBinary.is = isArrayBufferLike;\n\tBinary.isSource = isArrayBufferSource;\n\tfunction fromSource(source) {\n\t\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\t\telse return source;\n\t}\n\tBinary.fromSource = fromSource;\n\tfunction toBase64(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"base64\");\n\t\tlet binary = \"\";\n\t\tconst bytes = new Uint8Array(source);\n\t\tfor (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);\n\t\treturn btoa(binary);\n\t}\n\tBinary.toBase64 = toBase64;\n\tfunction fromBase64(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"base64\"));\n\t\treturn Uint8Array.from(atob(source), (c) => c.charCodeAt(0));\n\t}\n\tBinary.fromBase64 = fromBase64;\n\tfunction toHex(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"hex\");\n\t\treturn Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\t}\n\tBinary.toHex = toHex;\n\tfunction fromHex(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"hex\"));\n\t\tconst hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);\n\t\tconst buffer = [];\n\t\tfor (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));\n\t\treturn Uint8Array.from(buffer).buffer;\n\t}\n\tBinary.fromHex = fromHex;\n})(Binary || (Binary = {}));\n/** Decode a base64 string into binary data. */\nconst base64ToArrayBuffer = Binary.fromBase64;\n/** Encode binary data as base64. */\nconst arrayBufferToBase64 = Binary.toBase64;\n/** Decode a hex string into binary data. */\nconst hexToArrayBuffer = Binary.fromHex;\n/** Encode binary data as hex. */\nconst arrayBufferToHex = Binary.toHex;\n/** Deep-clone common JavaScript values while preserving prototypes and cycles. */\nfunction clone(source, refs = /* @__PURE__ */ new Map()) {\n\tif (!source || typeof source !== \"object\") return source;\n\tif (is(\"Date\", source)) return new Date(source.valueOf());\n\tif (is(\"RegExp\", source)) return new RegExp(source.source, source.flags);\n\tif (isArrayBufferLike(source)) return source.slice(0);\n\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\tconst cached = refs.get(source);\n\tif (cached) return cached;\n\tif (Array.isArray(source)) {\n\t\tconst result = [];\n\t\trefs.set(source, result);\n\t\tsource.forEach((value, index) => {\n\t\t\tresult[index] = Reflect.apply(clone, null, [value, refs]);\n\t\t});\n\t\treturn result;\n\t}\n\tconst result = Object.create(Object.getPrototypeOf(source));\n\trefs.set(source, result);\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tconst descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };\n\t\tif (\"value\" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);\n\t\tReflect.defineProperty(result, key, descriptor);\n\t}\n\treturn result;\n}\n/** Deeply compare arrays, dates, regexps, buffers, and plain object fields. */\nfunction deepEqual(a, b, strict) {\n\tif (a === b) return true;\n\tif (!strict && isNullable(a) && isNullable(b)) return true;\n\tif (typeof a !== typeof b) return false;\n\tif (typeof a !== \"object\") return false;\n\tif (!a || !b) return false;\n\tfunction check(test, then) {\n\t\treturn test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;\n\t}\n\treturn check(Array.isArray, (a, b) => a.length === b.length && a.every((item, index) => deepEqual(item, b[index]))) ?? check(is(\"Date\"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is(\"RegExp\"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {\n\t\tif (a.byteLength !== b.byteLength) return false;\n\t\tconst viewA = new Uint8Array(a);\n\t\tconst viewB = new Uint8Array(b);\n\t\tfor (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;\n\t\treturn true;\n\t}) ?? Object.keys({\n\t\t...a,\n\t\t...b\n\t}).every((key) => deepEqual(a[key], b[key], strict));\n}\n//#endregion\n//#region lib/types/string.js\n/** Uppercase the first character of a string. */\nfunction capitalize(source) {\n\treturn source.charAt(0).toUpperCase() + source.slice(1);\n}\n/** Lowercase the first character of a string. */\nfunction uncapitalize(source) {\n\treturn source.charAt(0).toLowerCase() + source.slice(1);\n}\n/** Convert dash or underscore delimited text to camelCase. */\nfunction camelCase(source) {\n\treturn source.replace(/[_-][a-z]/g, (str) => str.slice(1).toUpperCase());\n}\nfunction tokenize(source, delimiters, delimiter) {\n\tconst output = [];\n\tlet state = 0;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tconst code = source.charCodeAt(i);\n\t\tif (code >= 65 && code <= 90) {\n\t\t\tif (state === 1) {\n\t\t\t\tconst next = source.charCodeAt(i + 1);\n\t\t\t\tif (next >= 97 && next <= 122) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t} else {\n\t\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t}\n\t\t\tstate = 1;\n\t\t} else if (code >= 97 && code <= 122) {\n\t\t\toutput.push(code);\n\t\t\tstate = 2;\n\t\t} else if (delimiters.includes(code)) {\n\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\tstate = 0;\n\t\t} else output.push(code);\n\t}\n\treturn String.fromCharCode(...output);\n}\n/** Convert text to dash-delimited parameter case. */\nfunction paramCase(source) {\n\treturn tokenize(source, [45, 95], 45);\n}\n/** Convert text to underscore-delimited snake case. */\nfunction snakeCase(source) {\n\treturn tokenize(source, [45, 95], 95);\n}\n/** Runtime alias for `camelCase`. */\nconst camelize = camelCase;\n/** Runtime alias for `paramCase`. */\nconst hyphenate = paramCase;\n/** Format a property key as a JavaScript member access suffix. */\nfunction formatProperty(key) {\n\tif (typeof key !== \"string\") return `[${key.toString()}]`;\n\treturn /^[a-z_$][\\w$]*$/i.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n}\n/** Remove one trailing slash from a path string. */\nfunction trimSlash(source) {\n\treturn source.replace(/\\/$/, \"\");\n}\n/** Ensure a path starts with `/` and has no trailing slash. */\nfunction sanitize(source) {\n\tif (!source.startsWith(\"/\")) source = \"/\" + source;\n\treturn trimSlash(source);\n}\n//#endregion\n//#region lib/types/time.js\n/** Time constants plus parsing and formatting helpers. */\nvar Time;\n(function(Time) {\n\tTime.millisecond = 1;\n\tTime.second = 1e3;\n\tTime.minute = Time.second * 60;\n\tTime.hour = Time.minute * 60;\n\tTime.day = Time.hour * 24;\n\tTime.week = Time.day * 7;\n\tlet timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();\n\tfunction setTimezoneOffset(offset) {\n\t\ttimezoneOffset = offset;\n\t}\n\tTime.setTimezoneOffset = setTimezoneOffset;\n\tfunction getTimezoneOffset() {\n\t\treturn timezoneOffset;\n\t}\n\tTime.getTimezoneOffset = getTimezoneOffset;\n\tfunction getDateNumber(date = /* @__PURE__ */ new Date(), offset) {\n\t\tif (typeof date === \"number\") date = new Date(date);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn Math.floor((date.valueOf() / Time.minute - offset) / 1440);\n\t}\n\tTime.getDateNumber = getDateNumber;\n\tfunction fromDateNumber(value, offset) {\n\t\tconst date = new Date(value * Time.day);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn new Date(+date + offset * Time.minute);\n\t}\n\tTime.fromDateNumber = fromDateNumber;\n\tconst numeric = /\\d+(?:\\.\\d+)?/.source;\n\tconst timeRegExp = new RegExp(`^${[\n\t\t\"w(?:eek(?:s)?)?\",\n\t\t\"d(?:ay(?:s)?)?\",\n\t\t\"h(?:our(?:s)?)?\",\n\t\t\"m(?:in(?:ute)?(?:s)?)?\",\n\t\t\"s(?:ec(?:ond)?(?:s)?)?\"\n\t].map((unit) => `(${numeric}${unit})?`).join(\"\")}$`);\n\tfunction parseTime(source) {\n\t\tconst capture = timeRegExp.exec(source);\n\t\tif (!capture) return 0;\n\t\treturn (parseFloat(capture[1]) * Time.week || 0) + (parseFloat(capture[2]) * Time.day || 0) + (parseFloat(capture[3]) * Time.hour || 0) + (parseFloat(capture[4]) * Time.minute || 0) + (parseFloat(capture[5]) * Time.second || 0);\n\t}\n\tTime.parseTime = parseTime;\n\tfunction parseDate(date) {\n\t\tconst parsed = parseTime(date);\n\t\tif (parsed) date = Date.now() + parsed;\n\t\telse if (/^\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;\n\t\telse if (/^\\d{1,2}-\\d{1,2}-\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;\n\t\treturn date ? new Date(date) : /* @__PURE__ */ new Date();\n\t}\n\tTime.parseDate = parseDate;\n\tfunction format(ms) {\n\t\tconst abs = Math.abs(ms);\n\t\tif (abs >= Time.day - Time.hour / 2) return Math.round(ms / Time.day) + \"d\";\n\t\telse if (abs >= Time.hour - Time.minute / 2) return Math.round(ms / Time.hour) + \"h\";\n\t\telse if (abs >= Time.minute - Time.second / 2) return Math.round(ms / Time.minute) + \"m\";\n\t\telse if (abs >= Time.second) return Math.round(ms / Time.second) + \"s\";\n\t\treturn ms + \"ms\";\n\t}\n\tTime.format = format;\n\tfunction toDigits(source, length = 2) {\n\t\treturn source.toString().padStart(length, \"0\");\n\t}\n\tTime.toDigits = toDigits;\n\tfunction template(template, time = /* @__PURE__ */ new Date()) {\n\t\treturn template.replace(\"yyyy\", time.getFullYear().toString()).replace(\"yy\", time.getFullYear().toString().slice(2)).replace(\"MM\", toDigits(time.getMonth() + 1)).replace(\"dd\", toDigits(time.getDate())).replace(\"hh\", toDigits(time.getHours())).replace(\"mm\", toDigits(time.getMinutes())).replace(\"ss\", toDigits(time.getSeconds())).replace(\"SSS\", toDigits(time.getMilliseconds(), 3));\n\t}\n\tTime.template = template;\n})(Time || (Time = {}));\n//#endregion\nexport { Binary, Time, arrayBufferToBase64, arrayBufferToHex, base64ToArrayBuffer, camelCase, camelize, capitalize, clone, contain, deduplicate, deepEqual, defineProperty, difference, filterKeys, formatProperty, hexToArrayBuffer, hyphenate, intersection, is, isNonNullable, isNullable, isPlainObject, makeArray, mapValues, mapValues as valueMap, noop, omit, paramCase, pick, remove, sanitize, snakeCase, trimSlash, uncapitalize, union };\n","import { Binary, clone, deepEqual, filterKeys, isNullable, isPlainObject, pick, valueMap } from \"@deepseek-ai/cosmokit\";\n//#region lib/types/index.js\nconst kSchema = Symbol.for(\"schemastery\");\nconst kValidationError = Symbol.for(\"ValidationError\");\nglobalThis.__schemastery_index__ ??= 0;\nglobalThis.__schemastery_refs__ = void 0;\nvar ValidationError = class extends TypeError {\n\toptions;\n\tname = \"ValidationError\";\n\tconstructor(message, options) {\n\t\tlet prefix = \"$\";\n\t\tfor (const segment of options.path || []) if (typeof segment === \"string\") prefix += \".\" + segment;\n\t\telse if (typeof segment === \"number\") prefix += \"[\" + segment + \"]\";\n\t\telse if (typeof segment === \"symbol\") prefix += `[Symbol(${segment.toString()})]`;\n\t\tif (prefix.startsWith(\".\")) prefix = prefix.slice(1);\n\t\tsuper((prefix === \"$\" ? \"\" : `${prefix} `) + message);\n\t\tthis.options = options;\n\t}\n\tstatic is(error) {\n\t\treturn !!error?.[kValidationError];\n\t}\n};\nObject.defineProperty(ValidationError.prototype, kValidationError, { value: true });\nconst Schema = function(options) {\n\tconst schema = function(data, options = {}) {\n\t\treturn Schema.resolve(data, schema, options)[0];\n\t};\n\tif (options.refs) {\n\t\tconst refs = valueMap(options.refs, (options) => new Schema(options));\n\t\tconst getRef = (uid) => refs[uid];\n\t\tfor (const key in refs) {\n\t\t\tconst options = refs[key];\n\t\t\toptions.sKey = getRef(options.sKey);\n\t\t\toptions.inner = getRef(options.inner);\n\t\t\toptions.list = options.list && options.list.map(getRef);\n\t\t\toptions.dict = options.dict && valueMap(options.dict, getRef);\n\t\t}\n\t\treturn refs[options.uid];\n\t}\n\tObject.assign(schema, options);\n\tif (typeof schema.callback === \"string\") try {\n\t\tschema.callback = new Function(\"return \" + schema.callback)();\n\t} catch {}\n\tObject.defineProperty(schema, \"uid\", { value: globalThis.__schemastery_index__++ });\n\tObject.setPrototypeOf(schema, Schema.prototype);\n\tschema.meta ||= {};\n\tschema.toString = schema.toString.bind(schema);\n\treturn schema;\n};\nSchema.prototype = Object.create(Function.prototype);\nSchema.prototype[kSchema] = true;\nObject.defineProperty(Schema.prototype, \"~standard\", { get() {\n\treturn {\n\t\tversion: 1,\n\t\tvendor: \"schemastery\",\n\t\tvalidate: (value) => {\n\t\t\ttry {\n\t\t\t\treturn { value: Schema.resolve(value, this, {})[0] };\n\t\t\t} catch (error) {\n\t\t\t\tif (ValidationError.is(error)) return { issues: [{\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tpath: error.options.path\n\t\t\t\t}] };\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t};\n} });\nSchema.ValidationError = ValidationError;\nSchema.prototype.toJSON = function toJSON() {\n\tif (globalThis.__schemastery_refs__) {\n\t\tglobalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));\n\t\treturn this.uid;\n\t}\n\tglobalThis.__schemastery_refs__ = { [this.uid]: { ...this } };\n\tglobalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));\n\tconst result = {\n\t\tuid: this.uid,\n\t\trefs: globalThis.__schemastery_refs__\n\t};\n\tglobalThis.__schemastery_refs__ = void 0;\n\treturn result;\n};\nSchema.prototype.set = function set(key, value) {\n\tthis.dict[key] = value;\n\treturn this;\n};\nSchema.prototype.push = function push(value) {\n\tthis.list.push(value);\n\treturn this;\n};\nfunction mergeDesc(original, messages) {\n\tconst result = typeof original === \"string\" ? { \"\": original } : { ...original };\n\tfor (const locale in messages) {\n\t\tconst value = messages[locale];\n\t\tif (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;\n\t\telse if (typeof value === \"string\") result[locale] = value;\n\t}\n\treturn result;\n}\nfunction getInner(value) {\n\treturn value?.$value ?? value?.$inner;\n}\nfunction extractKeys(data) {\n\treturn filterKeys(data ?? {}, (key) => !key.startsWith(\"$\"));\n}\nSchema.prototype.i18n = function i18n(messages) {\n\tconst schema = Schema(this);\n\tconst desc = mergeDesc(schema.meta.description, messages);\n\tif (Object.keys(desc).length) schema.meta.description = desc;\n\tif (schema.dict) schema.dict = valueMap(schema.dict, (inner, key) => {\n\t\treturn inner.i18n(valueMap(messages, (data) => getInner(data)?.[key] ?? data?.[key]));\n\t});\n\tif (schema.list) schema.list = schema.list.map((inner, index) => {\n\t\treturn inner.i18n(valueMap(messages, (data = {}) => {\n\t\t\tif (Array.isArray(getInner(data))) return getInner(data)[index];\n\t\t\tif (Array.isArray(data)) return data[index];\n\t\t\treturn extractKeys(data);\n\t\t}));\n\t});\n\tif (schema.inner) schema.inner = schema.inner.i18n(valueMap(messages, (data) => {\n\t\tif (getInner(data)) return getInner(data);\n\t\treturn extractKeys(data);\n\t}));\n\tif (schema.sKey) schema.sKey = schema.sKey.i18n(valueMap(messages, (data) => data?.$key));\n\treturn schema;\n};\nSchema.prototype.extra = function extra(key, value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"required\",\n\t\"disabled\",\n\t\"collapse\",\n\t\"hidden\",\n\t\"loose\"\n]) Object.assign(Schema.prototype, { [key](value = true) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.deprecated = function deprecated() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"deprecated\",\n\t\ttype: \"danger\"\n\t});\n\treturn schema;\n};\nSchema.prototype.experimental = function experimental() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"experimental\",\n\t\ttype: \"warning\"\n\t});\n\treturn schema;\n};\nSchema.prototype.pattern = function pattern(regexp) {\n\tconst schema = Schema(this);\n\tconst pattern = pick(regexp, [\"source\", \"flags\"]);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\tpattern\n\t};\n\treturn schema;\n};\nSchema.prototype.simplify = function simplify(value) {\n\tif (deepEqual(value, this.meta.default, this.type === \"dict\")) return null;\n\tif (isNullable(value)) return value;\n\tif (this.type === \"object\" || this.type === \"dict\") {\n\t\tconst result = {};\n\t\tfor (const key in value) {\n\t\t\tconst item = (this.type === \"object\" ? this.dict[key] : this.inner)?.simplify(value[key]);\n\t\t\tif (this.type === \"dict\" || !isNullable(item)) result[key] = item;\n\t\t}\n\t\tif (deepEqual(result, this.meta.default, this.type === \"dict\")) return null;\n\t\treturn result;\n\t} else if (this.type === \"array\" || this.type === \"tuple\") {\n\t\tconst result = [];\n\t\tvalue.forEach((value, index) => {\n\t\t\tconst schema = this.type === \"array\" ? this.inner : this.list[index];\n\t\t\tconst item = schema ? schema.simplify(value) : value;\n\t\t\tresult.push(item);\n\t\t});\n\t\treturn result;\n\t} else if (this.type === \"intersect\") {\n\t\tconst result = {};\n\t\tfor (const item of this.list) Object.assign(result, item.simplify(value));\n\t\treturn result;\n\t} else if (this.type === \"union\") for (const schema of this.list) try {\n\t\tSchema.resolve(value, schema, {});\n\t\treturn schema.simplify(value);\n\t} catch {}\n\treturn value;\n};\nSchema.prototype.toString = function toString(inline) {\n\treturn formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;\n};\nSchema.prototype.role = function role(role, extra) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\trole,\n\t\textra\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"default\",\n\t\"link\",\n\t\"comment\",\n\t\"description\",\n\t\"max\",\n\t\"min\",\n\t\"step\"\n]) Object.assign(Schema.prototype, { [key](value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nconst resolvers = {};\nSchema.extend = function extend(type, resolve) {\n\tresolvers[type] = resolve;\n};\nSchema.resolve = function resolve(data, schema, options = {}, strict = false) {\n\tif (!schema) return [data];\n\tif (options.ignore?.(data, schema)) return [data];\n\tif (isNullable(data) && schema.type !== \"lazy\") {\n\t\tif (schema.meta.required) throw new ValidationError(`missing required value`, options);\n\t\tlet current = schema;\n\t\tlet fallback = schema.meta.default;\n\t\twhile (current?.type === \"intersect\" && isNullable(fallback)) {\n\t\t\tcurrent = current.list[0];\n\t\t\tfallback = current?.meta.default;\n\t\t}\n\t\tif (isNullable(fallback)) return [data];\n\t\tdata = clone(fallback);\n\t}\n\tconst callback = resolvers[schema.type];\n\tif (!callback) throw new ValidationError(`unsupported type \"${schema.type}\"`, options);\n\ttry {\n\t\treturn callback(data, schema, options, strict);\n\t} catch (error) {\n\t\tif (!schema.meta.loose) throw error;\n\t\treturn [schema.meta.default];\n\t}\n};\nSchema.from = function from(source) {\n\tif (isNullable(source)) return Schema.any();\n\telse if ([\n\t\t\"string\",\n\t\t\"number\",\n\t\t\"boolean\"\n\t].includes(typeof source)) return Schema.const(source).required();\n\telse if (source[kSchema]) return source;\n\telse if (typeof source === \"function\") switch (source) {\n\t\tcase String: return Schema.string().required();\n\t\tcase Number: return Schema.number().required();\n\t\tcase Boolean: return Schema.boolean().required();\n\t\tcase Function: return Schema.function().required();\n\t\tdefault: return Schema.is(source).required();\n\t}\n\telse throw new TypeError(`cannot infer schema from ${source}`);\n};\nSchema.lazy = function lazy(builder) {\n\tconst toJSON = () => {\n\t\tif (!schema.inner[kSchema]) {\n\t\t\tschema.inner = schema.builder();\n\t\t\tschema.inner.meta = {\n\t\t\t\t...schema.meta,\n\t\t\t\t...schema.inner.meta\n\t\t\t};\n\t\t}\n\t\treturn schema.inner.toJSON();\n\t};\n\tconst schema = new Schema({\n\t\ttype: \"lazy\",\n\t\tbuilder,\n\t\tinner: { toJSON }\n\t});\n\treturn schema;\n};\nSchema.natural = function natural() {\n\treturn Schema.number().step(1).min(0);\n};\nSchema.percent = function percent() {\n\treturn Schema.number().step(.01).min(0).max(1).role(\"slider\");\n};\nSchema.date = function date() {\n\treturn Schema.union([Schema.is(Date), Schema.transform(Schema.string().role(\"datetime\"), (value, options) => {\n\t\tconst date = new Date(value);\n\t\tif (isNaN(+date)) throw new ValidationError(`invalid date \"${value}\"`, options);\n\t\treturn date;\n\t}, true)]);\n};\nSchema.regExp = function regExp(flag = \"\") {\n\treturn Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role(\"regexp\", { flag }), (value, options) => {\n\t\ttry {\n\t\t\treturn new RegExp(value, flag);\n\t\t} catch (e) {\n\t\t\tthrow new ValidationError(e.message, options);\n\t\t}\n\t}, true)]);\n};\nSchema.arrayBuffer = function arrayBuffer(encoding) {\n\treturn Schema.union([\n\t\tSchema.is(ArrayBuffer),\n\t\tSchema.is(SharedArrayBuffer),\n\t\tSchema.transform(Schema.any(), (value, options) => {\n\t\t\tif (Binary.isSource(value)) return Binary.fromSource(value);\n\t\t\tthrow new ValidationError(`expected ArrayBufferSource but got ${value}`, options);\n\t\t}, true),\n\t\t...encoding ? [Schema.transform(Schema.string(), (value, options) => {\n\t\t\ttry {\n\t\t\t\treturn encoding === \"base64\" ? Binary.fromBase64(value) : Binary.fromHex(value);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ValidationError(e.message, options);\n\t\t\t}\n\t\t}, true)] : []\n\t]);\n};\nSchema.extend(\"lazy\", (data, schema, options, strict) => {\n\tif (!schema.inner[kSchema]) {\n\t\tschema.inner = schema.builder();\n\t\tschema.inner.meta = {\n\t\t\t...schema.meta,\n\t\t\t...schema.inner.meta\n\t\t};\n\t}\n\treturn Schema.resolve(data, schema.inner, options, strict);\n});\nSchema.extend(\"any\", (data) => {\n\treturn [data];\n});\nSchema.extend(\"never\", (data, _, options) => {\n\tthrow new ValidationError(`expected nullable but got ${data}`, options);\n});\nSchema.extend(\"const\", (data, { value }, options) => {\n\tif (deepEqual(data, value)) return [value];\n\tthrow new ValidationError(`expected ${value} but got ${data}`, options);\n});\nfunction checkWithinRange(data, meta, description, options, skipMin = false) {\n\tconst { max = Infinity, min = -Infinity } = meta;\n\tif (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);\n\tif (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);\n}\nSchema.extend(\"string\", (data, { meta }, options) => {\n\tif (typeof data !== \"string\") throw new ValidationError(`expected string but got ${data}`, options);\n\tif (meta.pattern) {\n\t\tconst regexp = new RegExp(meta.pattern.source, meta.pattern.flags);\n\t\tif (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);\n\t}\n\tcheckWithinRange(data.length, meta, \"string length\", options);\n\treturn [data];\n});\nfunction decimalShift(data, digits) {\n\tconst str = data.toString();\n\tif (str.includes(\"e\")) return data * Math.pow(10, digits);\n\tconst index = str.indexOf(\".\");\n\tif (index === -1) return data * Math.pow(10, digits);\n\tconst frac = str.slice(index + 1);\n\tconst integer = str.slice(0, index);\n\tif (frac.length <= digits) return +(integer + frac.padEnd(digits, \"0\"));\n\treturn +(integer + frac.slice(0, digits) + \".\" + frac.slice(digits));\n}\nfunction isMultipleOf(data, min, step) {\n\tstep = Math.abs(step);\n\tif (!/^\\d+\\.\\d+$/.test(step.toString())) return (data - min) % step === 0;\n\tconst index = step.toString().indexOf(\".\");\n\tconst digits = step.toString().slice(index + 1).length;\n\treturn Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;\n}\nSchema.extend(\"number\", (data, { meta }, options) => {\n\tif (typeof data !== \"number\") throw new ValidationError(`expected number but got ${data}`, options);\n\tcheckWithinRange(data, meta, \"number\", options);\n\tconst { step } = meta;\n\tif (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);\n\treturn [data];\n});\nSchema.extend(\"boolean\", (data, _, options) => {\n\tif (typeof data === \"boolean\") return [data];\n\tthrow new ValidationError(`expected boolean but got ${data}`, options);\n});\nSchema.extend(\"bitset\", (data, { bits, meta }, options) => {\n\tlet value = 0, keys = [];\n\tif (typeof data === \"number\") {\n\t\tvalue = data;\n\t\tfor (const key in bits) if (data & bits[key]) keys.push(key);\n\t} else if (Array.isArray(data)) {\n\t\tkeys = data;\n\t\tfor (const key of keys) {\n\t\t\tif (typeof key !== \"string\") throw new ValidationError(`expected string but got ${key}`, options);\n\t\t\tif (key in bits) value |= bits[key];\n\t\t}\n\t} else throw new ValidationError(`expected number or array but got ${data}`, options);\n\tif (value === meta.default) return [value];\n\treturn [value, keys];\n});\nSchema.extend(\"function\", (data, _, options) => {\n\tif (typeof data === \"function\") return [data];\n\tthrow new ValidationError(`expected function but got ${data}`, options);\n});\nSchema.extend(\"is\", (data, { constructor }, options) => {\n\tif (typeof constructor === \"function\") {\n\t\tif (data instanceof constructor) return [data];\n\t\tthrow new ValidationError(`expected ${constructor.name} but got ${data}`, options);\n\t} else {\n\t\tif (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t\tlet prototype = Object.getPrototypeOf(data);\n\t\twhile (prototype) {\n\t\t\tif (prototype.constructor?.name === constructor) return [data];\n\t\t\tprototype = Object.getPrototypeOf(prototype);\n\t\t}\n\t\tthrow new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t}\n});\nfunction property(data, key, schema, options) {\n\ttry {\n\t\tconst [value, adapted] = Schema.resolve(data[key], schema, {\n\t\t\t...options,\n\t\t\tpath: [...options.path || [], key]\n\t\t});\n\t\tif (adapted !== void 0) data[key] = adapted;\n\t\treturn value;\n\t} catch (e) {\n\t\tif (!options?.autofix) throw e;\n\t\tdelete data[key];\n\t\treturn schema.meta.default;\n\t}\n}\nSchema.extend(\"array\", (data, { inner, meta }, options) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tcheckWithinRange(data.length, meta, \"array length\", options, !isNullable(inner.meta.default));\n\treturn [data.map((_, index) => property(data, index, inner, options))];\n});\nSchema.extend(\"dict\", (data, { inner, sKey }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in data) {\n\t\tlet rKey;\n\t\ttry {\n\t\t\trKey = Schema.resolve(key, sKey, options)[0];\n\t\t} catch (error) {\n\t\t\tif (strict) continue;\n\t\t\tthrow error;\n\t\t}\n\t\tresult[rKey] = property(data, key, inner, options);\n\t\tdata[rKey] = data[key];\n\t\tif (key !== rKey) delete data[key];\n\t}\n\treturn [result];\n});\nSchema.extend(\"tuple\", (data, { list }, options, strict) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tconst result = list.map((inner, index) => property(data, index, inner, options));\n\tif (strict) return [result];\n\tresult.push(...data.slice(list.length));\n\treturn [result];\n});\nfunction merge(result, data) {\n\tfor (const key in data) {\n\t\tif (key in result) continue;\n\t\tresult[key] = data[key];\n\t}\n}\nSchema.extend(\"object\", (data, { dict }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in dict) {\n\t\tconst value = property(data, key, dict[key], options);\n\t\tif (!isNullable(value) || key in data) result[key] = value;\n\t}\n\tif (!strict) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"union\", (data, { list, toString }, options, strict) => {\n\tconst messages = [];\n\tfor (const inner of list) try {\n\t\treturn Schema.resolve(data, inner, options, strict);\n\t} catch (error) {\n\t\tmessages.push(error);\n\t}\n\tthrow new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n});\nSchema.extend(\"intersect\", (data, { list, toString }, options, strict) => {\n\tif (!list.length) return [data];\n\tlet result;\n\tfor (const inner of list) {\n\t\tconst value = Schema.resolve(data, inner, options, true)[0];\n\t\tif (isNullable(value)) continue;\n\t\tif (isNullable(result)) result = value;\n\t\telse if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t\telse if (typeof value === \"object\") merge(result ??= {}, value);\n\t\telse if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t}\n\tif (!strict && isPlainObject(data)) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"transform\", (data, { inner, callback, preserve }, options) => {\n\tconst [result, adapted = data] = Schema.resolve(data, inner, options, true);\n\tif (preserve) return [callback(result)];\n\telse return [callback(result), callback(adapted)];\n});\nconst formatters = {};\nfunction defineMethod(name, keys, format) {\n\tformatters[name] = format;\n\tObject.assign(Schema, { [name](...args) {\n\t\tconst schema = new Schema({ type: name });\n\t\tkeys.forEach((key, index) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"sKey\":\n\t\t\t\t\tschema.sKey = args[index] ?? Schema.string();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inner\":\n\t\t\t\t\tschema.inner = Schema.from(args[index]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"list\":\n\t\t\t\t\tschema.list = args[index].map(Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dict\":\n\t\t\t\t\tschema.dict = valueMap(args[index], Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bits\":\n\t\t\t\t\tschema.bits = {};\n\t\t\t\t\tfor (const key in args[index]) {\n\t\t\t\t\t\tif (typeof args[index][key] !== \"number\") continue;\n\t\t\t\t\t\tschema.bits[key] = args[index][key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"callback\": {\n\t\t\t\t\tconst callback = schema.callback = args[index];\n\t\t\t\t\tcallback[\"toJSON\"] ||= () => callback.toString();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"constructor\": {\n\t\t\t\t\tconst constructor = schema.constructor = args[index];\n\t\t\t\t\tif (typeof constructor === \"function\") constructor[\"toJSON\"] ||= () => constructor[\"name\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: schema[key] = args[index];\n\t\t\t}\n\t\t});\n\t\tif (name === \"object\" || name === \"dict\") schema.meta.default = {};\n\t\telse if (name === \"array\" || name === \"tuple\") schema.meta.default = [];\n\t\telse if (name === \"bitset\") schema.meta.default = 0;\n\t\treturn schema;\n\t} });\n}\ndefineMethod(\"is\", [\"constructor\"], ({ constructor }) => {\n\tif (typeof constructor === \"function\") return constructor.name;\n\telse return constructor;\n});\ndefineMethod(\"any\", [], () => \"any\");\ndefineMethod(\"never\", [], () => \"never\");\ndefineMethod(\"const\", [\"value\"], ({ value }) => typeof value === \"string\" ? JSON.stringify(value) : value);\ndefineMethod(\"string\", [], () => \"string\");\ndefineMethod(\"number\", [], () => \"number\");\ndefineMethod(\"boolean\", [], () => \"boolean\");\ndefineMethod(\"bitset\", [\"bits\"], () => \"bitset\");\ndefineMethod(\"function\", [], () => \"function\");\ndefineMethod(\"array\", [\"inner\"], ({ inner }) => `${inner.toString(true)}[]`);\ndefineMethod(\"dict\", [\"inner\", \"sKey\"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);\ndefineMethod(\"tuple\", [\"list\"], ({ list }) => `[${list.map((inner) => inner.toString()).join(\", \")}]`);\ndefineMethod(\"object\", [\"dict\"], ({ dict }) => {\n\tif (Object.keys(dict).length === 0) return \"{}\";\n\treturn `{ ${Object.entries(dict).map(([key, inner]) => {\n\t\treturn `${key}${inner.meta.required ? \"\" : \"?\"}: ${inner.toString()}`;\n\t}).join(\", \")} }`;\n});\ndefineMethod(\"union\", [\"list\"], ({ list }, inline) => {\n\tconst result = list.map(({ toString: format }) => format()).join(\" | \");\n\treturn inline ? `(${result})` : result;\n});\ndefineMethod(\"intersect\", [\"list\"], ({ list }) => {\n\treturn `${list.map((inner) => inner.toString(true)).join(\" & \")}`;\n});\ndefineMethod(\"transform\", [\n\t\"inner\",\n\t\"callback\",\n\t\"preserve\"\n], ({ inner }, isInner) => inner.toString(isInner));\n//#endregion\nexport { Schema as default };\n","/**\n * The `soulmirror` user-settings namespace (dsh `ctx.settings`): what the\n * browser settings section \"SoulMirror network\" edits and what the network\n * plugin reads when it spawns the backend. The connection fields apply on\n * the next plugin (re)load — the peer process is spawned with them\n * (`applies: 'restart'`); the alter fields (`defaultTier`, `autoReplyPerHour`,\n * `directSend`) are read live through `ctx.soulmirrorConfig.current()`. The\n * tiers decide how the alter handles a friend's mail (P4: `draft` = the\n * alter's reply waits as a pending draft on the SoulMirror page).\n *\n * `@deepseek-ai/schemastery` is a VALUE import here on purpose: the settings\n * seam needs a real schemastery schema (callable validator + `toJSON()` for\n * the browser form). It is a vendored, dependency-free library and gets\n * inlined into lib/index.js by tsdown, so the host half still has zero\n * `@deepseek-ai/*` runtime edges into the harness instance (see ../README.md).\n */\nimport z from '@deepseek-ai/schemastery'\nimport { DEFAULT_RELAY } from './network/soulnet.ts'\nimport type { BackendKind } from './network/types.ts'\nimport { DEFAULT_AUTO_REPLY_PER_HOUR, DEFAULT_REPLY_TIER, normalizeTier, type ReplyTier } from './policy.ts'\n\nexport const SETTINGS_NAMESPACE = 'soulmirror'\n\nexport interface SoulmirrorSettings {\n /** Relay (mail office) URL; baked into identity.json when the identity is created. */\n relay: string\n /** Display name used when the identity is created on first start; empty = onboarding asks. */\n displayName: string\n backend: BackendKind\n /** Path of the `soulnet` binary; empty = PATH, then <plugin dir>/bin/. */\n peerBinary: string\n /** Data directory (`--home`); empty = $SOULNET_HOME, then ~/.soulnet. */\n home: string\n /** Reply tier for friends without their own setting. */\n defaultTier: ReplyTier\n /** Cap on automatic replies per friend per hour in the `auto` tier. */\n autoReplyPerHour: number\n /** Debug: offer \"Send as myself\" in the friend pane (bypasses the alter). */\n directSend: boolean\n}\n\nexport const SOULMIRROR_SETTINGS_SCHEMA = z.object({\n relay: z.string().default(DEFAULT_RELAY).description('Relay URL (used when the identity is created).'),\n displayName: z.string().default('').description('Display name for a new identity (first start only).'),\n backend: z.union([z.const('soulnet'), z.const('fake')]).default('soulnet').description('soulnet = the light peer binary; fake = in-memory test backend.'),\n peerBinary: z.string().default('').description('Path of the soulnet binary; empty = PATH, then the plugin bin/ directory.'),\n home: z.string().default('').description('Data directory; empty = $SOULNET_HOME, then ~/.soulnet.'),\n defaultTier: z.union([z.const('notify'), z.const('draft'), z.const('auto')]).default(DEFAULT_REPLY_TIER).description('Default reply tier for friends: notify = mail is only shown; draft = the alter drafts a reply you review on the SoulMirror page; auto = the alter replies by itself (rate-limited).'),\n autoReplyPerHour: z.number().default(DEFAULT_AUTO_REPLY_PER_HOUR).description('Maximum automatic replies per friend per hour in the auto tier (0 disables).'),\n directSend: z.boolean().default(false).description('Debug: offer \"Send as myself\" in a friend thread (bypasses the alter); off by default.'),\n})\n\n/** Fill in defaults for a partial section (plugin config or a stored user section). */\nexport function resolveSettings(partial: Partial<SoulmirrorSettings> | undefined): SoulmirrorSettings {\n const perHour = typeof partial?.autoReplyPerHour === 'number' && Number.isFinite(partial.autoReplyPerHour)\n ? Math.max(0, Math.floor(partial.autoReplyPerHour))\n : DEFAULT_AUTO_REPLY_PER_HOUR\n return {\n relay: partial?.relay !== undefined && partial.relay.trim() !== '' ? partial.relay.trim() : DEFAULT_RELAY,\n displayName: partial?.displayName ?? '',\n backend: partial?.backend === 'fake' ? 'fake' : 'soulnet',\n peerBinary: partial?.peerBinary ?? '',\n home: partial?.home ?? '',\n defaultTier: normalizeTier(partial?.defaultTier),\n autoReplyPerHour: perHour,\n directSend: partial?.directSend === true,\n }\n}\n","/**\n * soulnet-dsh — host root entry = the `soulmirror-network` plugin.\n *\n * Provides `ctx.soulmirror` (NetworkClient: the `soulnet` light peer by\n * default, the in-memory fake on request) and `ctx.soulmirrorHome`, registers\n * the `soulmirror` user-settings namespace and mounts the browser-facing HTTP\n * API (./api). The bare package name is also what dsh's client-module scan keys\n * on, so this entry carries the browser bundle declaration (package.json\n * `dsh.client` + the `./client` export).\n *\n * Host side rule: NO @deepseek-ai VALUE imports into the harness instance\n * (types only; the one vendored library we do import, schemastery, is inlined).\n * A linked (`dsh plugin add ./packages/dsh`) package resolves bare specifiers\n * from its own real path, where the harness packages are not installed; and a\n * second copy of cordis/dsh-tools would be a different runtime instance anyway.\n */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { SettingsNamespace } from '@deepseek-ai/dsh-settings'\nimport { mountApi } from './api/index.ts'\nimport { createFakeNetworkClient } from './network/fake.ts'\nimport { createSoulnetNetworkClient, defaultSoulnetHome } from './network/soulnet.ts'\nimport type { NetworkClient } from './network/types.ts'\nimport { resolveSettings, SETTINGS_NAMESPACE, SOULMIRROR_SETTINGS_SCHEMA, type SoulmirrorSettings } from './settings.ts'\n\nexport type * from './network/types.ts'\nexport type * from './events.ts'\nexport { SOULMIRROR_PLUGIN, RELAY_FORM } from './events.ts'\nexport { SETTINGS_NAMESPACE } from './settings.ts'\nexport type { SoulmirrorSettings } from './settings.ts'\n\n/** Live view of the `soulmirror` settings (the alter fields apply without a restart). */\nexport interface SoulmirrorConfig {\n current(): SoulmirrorSettings\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /** SoulMirror network client (identity / card / friends / send / subscribe). */\n soulmirror: NetworkClient\n /** Backend data directory (`a2a/` underneath: identity.json, friends.yaml, conversations/ …; same layout as ~/.soulmirror/a2a). */\n soulmirrorHome: string\n /** Live settings: `defaultTier` / `autoReplyPerHour` / `directSend` are read per use; connection fields apply on reload. */\n soulmirrorConfig: SoulmirrorConfig\n }\n}\n\n/** Composition entry config; every field is also a user setting (namespace `soulmirror`). */\nexport type Config = Partial<SoulmirrorSettings>\n\nexport const name = 'soulmirror-network'\nexport const inject: string[] = []\n\nexport function apply(ctx: Context, config: Config = {}): void {\n const log = (level: 'info' | 'warn' | 'error', message: string): void => {\n ctx.logger[level](`soulmirror-network: ${message}`)\n }\n\n // Settings: schema defaults < composition entry (`config`) < user document.\n // When the settings service is already composed we read the resolved value\n // now; otherwise we run on the entry config and register late for the UI.\n const entry = resolveSettings(config)\n let effective: SoulmirrorSettings = entry\n // `live` follows the user document: the connection fields still apply on\n // reload (the peer is already running), the alter fields are read per use.\n let live: SoulmirrorSettings = entry\n const settingsNow = ctx.get('settings')\n if (settingsNow !== undefined) {\n const scope = settingsNow.register(SETTINGS_NAMESPACE as SettingsNamespace, SOULMIRROR_SETTINGS_SCHEMA, { base: config, applies: 'restart' })\n effective = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n live = effective\n scope.watch(() => {\n live = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n log('info', `settings changed (tier=${live.defaultTier}, autoReplyPerHour=${live.autoReplyPerHour}, directSend=${String(live.directSend)} apply now; connection fields apply when the plugin reloads)`)\n })\n } else {\n ctx.inject(['settings'], (sctx) => {\n const scope = sctx.settings.register(SETTINGS_NAMESPACE as SettingsNamespace, SOULMIRROR_SETTINGS_SCHEMA, { base: config, applies: 'restart' })\n live = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n scope.watch(() => {\n live = resolveSettings(scope.get() as Partial<SoulmirrorSettings>)\n log('info', 'settings changed; alter fields apply now, connection fields when the plugin reloads')\n })\n })\n }\n const liveConfig: SoulmirrorConfig = { current: () => live }\n ctx.provide('soulmirrorConfig', liveConfig)\n\n const home = effective.home !== '' ? effective.home : defaultSoulnetHome()\n let client: NetworkClient\n if (effective.backend === 'fake') {\n client = createFakeNetworkClient()\n } else {\n const peer = createSoulnetNetworkClient({\n home,\n relay: effective.relay,\n displayName: effective.displayName,\n ...(effective.peerBinary === '' ? {} : { peerBinary: effective.peerBinary }),\n logger: log,\n })\n peer.start()\n client = peer\n }\n\n ctx.provide('soulmirrorHome', home)\n ctx.provide('soulmirror', client)\n ctx.effect(() => () => {\n void client.dispose().catch((error: unknown) => { log('warn', `dispose failed: ${String(error)}`) })\n }, 'soulmirror-network: backend process')\n\n mountApi(ctx, {\n client,\n home,\n settingsNamespace: SETTINGS_NAMESPACE,\n sessions: () => ctx.get('soulmirrorSessions'),\n settings: () => live,\n log,\n })\n log('info', `backend=${client.backend} home=${home} relay=${effective.relay}`)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AAU,OAAO;AAC/E"}
|
|
@@ -59,11 +59,16 @@ export interface SoulnetBinaryLocation {
|
|
|
59
59
|
readonly path: string;
|
|
60
60
|
readonly source: SoulnetBinarySource;
|
|
61
61
|
}
|
|
62
|
-
/** npm scope of the platform packages that ship the binary. */
|
|
63
62
|
/** Prefix of the per-platform binary packages on npm (`soulnet-peer-<os>-<arch>`). */
|
|
64
63
|
export declare const PLATFORM_PACKAGE_PREFIX = "soulnet-peer-";
|
|
65
|
-
/** The `<
|
|
64
|
+
/** The `<process.platform>-<process.arch>` pairs a platform package exists for (must match dsh/packages/soulnet-*). */
|
|
66
65
|
export declare const PLATFORM_PACKAGE_TARGETS: readonly string[];
|
|
66
|
+
/**
|
|
67
|
+
* How the `<os>` part of the package name is spelled when it differs from `process.platform`.
|
|
68
|
+
* npm's spam filter rejects new unscoped names ending in `-win32-x64`, so the Windows
|
|
69
|
+
* package is published as `soulnet-peer-windows-x64` (the workspace directory keeps `win32`).
|
|
70
|
+
*/
|
|
71
|
+
export declare const PLATFORM_PACKAGE_OS_NAMES: Readonly<Record<string, string>>;
|
|
67
72
|
/** `soulnet-peer-<os>-<arch>` for a supported pair, else `undefined`. */
|
|
68
73
|
export declare function platformPackageName(platform?: NodeJS.Platform, arch?: string): string | undefined;
|
|
69
74
|
export interface ResolveSoulnetBinaryOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soulnet-dsh",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SoulMirror network for DeepSeek Harness: A2A identity, friends and end-to-end encrypted chat as dsh sessions -- host plugins + browser UI bundle, backed by the soulnet light peer (shipped as a platform package)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh-plugin",
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
"react": "^18.2.0"
|
|
82
82
|
},
|
|
83
83
|
"optionalDependencies": {
|
|
84
|
-
"soulnet-peer-darwin-arm64": "0.1.0",
|
|
85
84
|
"soulnet-peer-linux-arm64": "0.1.0",
|
|
85
|
+
"soulnet-peer-windows-x64": "0.1.0",
|
|
86
|
+
"soulnet-peer-darwin-arm64": "0.1.0",
|
|
86
87
|
"soulnet-peer-linux-x64": "0.1.0",
|
|
87
|
-
"soulnet-peer-win32-x64": "0.1.0",
|
|
88
88
|
"soulnet-peer-darwin-x64": "0.1.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|