@inkandswitch/patchwork-pkg-base 0.0.70 → 0.0.71
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/module-settings-url +1 -1
- package/package.json +1 -1
- package/packages/providers/dist/assets/WorkerProvider-CG700oWK.js +2 -0
- package/packages/providers/dist/assets/WorkerProvider-CG700oWK.js.map +1 -0
- package/packages/providers/dist/index.js +1 -1
- package/packages/providers/dist/index.js.map +1 -1
- package/packages/providers/package.json +5 -1
- package/packages/theming/dist/{active-theme-CZOUYQ4S.js → active-theme-ZEJCS5RM.js} +3 -3
- package/packages/theming/dist/{chunk-6PXH63WF.js → chunk-FLDRNDLY.js} +2 -2
- package/packages/theming/dist/{chunk-RATW7VZI.js → chunk-L7WQSSFT.js} +2 -2
- package/packages/theming/dist/{gloom-JYQPEOHI.css → gloom-UKANBN2Z.css} +1 -1
- package/packages/theming/dist/main.js +4 -4
- package/packages/theming/dist/{theme-titlebar-EKXBWQZO.js → theme-titlebar-HAEXLVMW.js} +3 -3
- package/packages/theming/dist/{theme-tray-JJFCEA26.js → theme-tray-XYB4LGZ6.js} +3 -3
- package/packages/theming/dist/tool.js +2 -2
- package/plugin-registry-url +1 -1
- /package/packages/theming/dist/{active-theme-CZOUYQ4S.js.map → active-theme-ZEJCS5RM.js.map} +0 -0
- /package/packages/theming/dist/{chunk-6PXH63WF.js.map → chunk-FLDRNDLY.js.map} +0 -0
- /package/packages/theming/dist/{chunk-RATW7VZI.js.map → chunk-L7WQSSFT.js.map} +0 -0
- /package/packages/theming/dist/{theme-titlebar-EKXBWQZO.js.map → theme-titlebar-HAEXLVMW.js.map} +0 -0
- /package/packages/theming/dist/{theme-tray-JJFCEA26.js.map → theme-tray-XYB4LGZ6.js.map} +0 -0
package/module-settings-url
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
automerge:
|
|
1
|
+
automerge:33vwW9j93FsjU67jMzCqvGxerXHH
|
package/package.json
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getRegistry as R}from"@inkandswitch/patchwork-plugins";import{accept as I}from"@inkandswitch/patchwork-providers";const L="patchwork:worker-channel",N="patchwork:worker",O=5e3;let U=0;function $(){return"wk-"+ ++U+"-"+(performance.now()|0)}function q(l,w={}){let d=null,i=null;const o=new Map,r=new Map,n=new Set,a=Symbol("pending");let s=null,u=!1;const h=e=>{try{s?.enqueue(e)}catch{}},E=l.open?Promise.race([Promise.resolve(l.open(w)),new Promise(e=>setTimeout(e,O,null))]).catch(()=>null):Promise.resolve(null),k=(e,t)=>{u||S().then(b=>b.postMessage(e,t||[])).catch(()=>{})};function S(){return i||(i=Promise.resolve().then(()=>l.createWorker()).then(e=>(d=e,e.onmessage=t=>g(t.data),e.onerror=f,e.onmessageerror=f,e)),i.catch(f),i)}function g(e){if(!(!e||u)){if(e.id!=null){const t=o.get(e.id);t&&t(e)&&o.delete(e.id);return}h(e)}}async function P(e){if(!e||typeof e!="object")return;const t=e.id;if(e.op==="abort"){if(!r.has(t))return;const c=r.get(t);if(c===a){n.add(t);return}try{l.abort?.(c,k)}catch{}r.delete(t);return}r.set(t,a);const _=await E;if(u)return;const p=$();let m=!1;const M={post:k,emit:c=>h({...c,id:t}),on:c=>{m=!0,o.set(p,y=>{const v=c(y);return v&&(r.delete(t),n.delete(t)),v})},workerId:p,state:_,ctx:w};try{const c=await l.handle(e,M);if(n.has(t)){n.delete(t),r.delete(t),o.delete(p);try{l.abort?.(c,k)}catch{}return}m?r.set(t,c):r.delete(t)}catch(c){h({id:t,type:"error",message:c?.message||String(c)}),o.delete(p),r.delete(t),n.delete(t)}}function f(){if(!u){u=!0,o.clear(),r.clear(),n.clear();try{s?.close()}catch{}s=null;try{d?.terminate()}catch{}d=null}}const W=new ReadableStream({start(e){s=e},cancel(){f()}}),T=new WritableStream({write(e){P(e)},close(){f()},abort(){f()}});return{readable:W,writable:T}}const A=1e4,G=l=>{const w=R(N),d=o=>{const r=o.detail,n=r?.selector;if(!n||n.type!==L||!r.port)return;const a=n.kind;!a||!w.has(a)||I(o,s=>{i(a,s)})};async function i(o,r){try{const a=(await Promise.race([w.loadWhenReady(o),new Promise((u,h)=>setTimeout(()=>h(new Error(`timed out loading worker plugin "${o}"`)),A))]))?.module;if(!a||typeof a.handle!="function"||typeof a.createWorker!="function")throw new Error(`worker plugin "${o}" did not resolve to a WorkerSpec`);const s=q(a,{element:l});r({readable:s.readable,writable:s.writable},[s.readable,s.writable])}catch(n){console.error(`[worker-provider] failed to serve "${o}":`,n),r(null)}}return document.addEventListener("patchwork:subscribe",d),()=>{document.removeEventListener("patchwork:subscribe",d)}};export{G as WorkerProvider};
|
|
2
|
+
//# sourceMappingURL=WorkerProvider-CG700oWK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerProvider-CG700oWK.js","sources":["../../node_modules/.pnpm/@grjte+patchwork-worker@0.0.2_@automerge+automerge-repo@2.6.0-subduction.48_supports-co_f3089f3cacfd2de7804cd039328d81f0/node_modules/@grjte/patchwork-worker/connect.js","../../node_modules/.pnpm/@grjte+patchwork-worker@0.0.2_@automerge+automerge-repo@2.6.0-subduction.48_supports-co_f3089f3cacfd2de7804cd039328d81f0/node_modules/@grjte/patchwork-worker/serve.js","../../src/WorkerProvider.ts"],"sourcesContent":["/**\n * connectWorker — a generic, transferable-stream connection to a worker-backed\n * service.\n *\n * A tool asks to connect to a worker of some `kind` and, for the lifetime of\n * that connection, holds a `WritableStream` (to send request frames) and a\n * `ReadableStream` (to receive event frames). The worker itself, and any\n * privileged setup it needs (config/secrets), live on whichever side answers the\n * connection — the SAME realm when there's no isolation boundary, or the host\n * realm when the consumer runs in a sandboxed realm. Either way the consumer sees\n * an identical `{readable, writable}` pair; the streams are transferable, so they\n * cross an isolation boundary unchanged.\n *\n * This file is the CONSUMER half. `connectWorker(kind, {element})` returns\n * `{readable, writable, disconnect}`; a provider answers via the discovery event\n * (in-realm, or relayed from the host realm by whatever isolation mechanism is\n * in use). If nothing answers, it rejects. There is no local fallback.\n *\n * The SERVING half is `serveWorkerSpec` (./serve.js), driven by the host-realm\n * `patchwork-worker-provider` component (shipped by the `providers` package),\n * which resolves a WorkerSpec for the requested `kind` from the\n * `patchwork:worker` plugin registry. Consumers never import serve.js.\n *\n * This module is service-agnostic: it knows nothing about LLMs. Frame shapes are\n * the service's concern; connect.js treats them as opaque structured-cloneable\n * values, tagged with an `id` so many requests can multiplex over one connection.\n *\n * Discovery/handoff goes through patchwork-providers: this file calls\n * `subscribe()` and the host provider answers with `accept()`. The stream pair\n * rides in the value; `respond`'s transfer list moves rather than clones it, so\n * the streams stay live across the isolation boundary.\n *\n * Layering: this file stays free of the plugin registry so the sandbox-loaded\n * transport carries no more than it needs; the registry lookup lives in\n * ./client.js.\n */\n\nimport {createOpenSession} from \"./session.js\"\n\n// --- Protocol constants -----------------------------------------------------\n// Deliberately STRINGS, not Symbols. Comparisons against them are `===` on the\n// value (here, in the host worker provider, and possibly as inlined literals in\n// code that relays the subscription across a boundary), so they keep working\n// even if this module is evaluated more than once. A Symbol would silently stop\n// matching.\n\n/**\n * The selector type used to discover a worker-connection provider. A consumer\n * dispatches a `patchwork:subscribe` for `{ type: CHANNEL_SELECTOR, kind }`\n * carrying a MessagePort in `detail.port`. The answering side replies over that\n * port, in the standard providers envelope (`{type:\"change\", value}`), with\n * exactly one of:\n *\n * {readable, writable} — success; the pair is TRANSFERRED, not cloned\n * null — refused; fail fast\n *\n * Silence is also a valid outcome (nothing is mounted to answer), which the\n * consumer's bounded discovery timeout covers. Answering sides that KNOW they're\n * refusing should respond `null` rather than staying silent.\n */\nexport const CHANNEL_SELECTOR = \"patchwork:worker-channel\"\n\n/**\n * The plugin type a service package registers to offer a worker. Its `id` is\n * the worker `kind`; `load()` resolves to a WorkerSpec (see ./serve.js).\n */\nexport const WORKER_PLUGIN_TYPE = \"patchwork:worker\"\n\n/**\n * The paired plugin type a service package registers to offer a typed client\n * for its worker. Same `id` as the worker; `load()` resolves to a factory\n * `(session) => clientApi` (see ./client.js).\n */\nexport const WORKER_CLIENT_PLUGIN_TYPE = \"patchwork:worker-client\"\n\n/**\n * BACKSTOP: how long to wait for a provider to answer before giving up.\n *\n * Not control flow. A mounted provider either serves the kind (streams) or\n * refuses it (`null`), and both are immediate — so in a healthy frame this timer\n * never fires. It exists because an unclaimed `patchwork:subscribe` never\n * settles by design (a subscription may wait for a provider that mounts later).\n * Without a bound, a missing provider would hang the caller forever instead of\n * erroring.\n */\nconst DISCOVERY_TIMEOUT_MS = 8000\n\n/** @typedef {{ readable: ReadableStream, writable: WritableStream }} WorkerStreams */\n/** @typedef {WorkerStreams & { disconnect: () => void }} WorkerConnection */\n/**\n * What a `patchwork:worker` plugin's `load()` must resolve to: a WorkerSpec that\n * `serveWorkerSpec` (serve.js) drives. The transport owns the streams, ids, and\n * per-connection worker; the spec owns only its op vocabulary. `open(ctx)` gets\n * the provider's mount point, so a worker can resolve host-realm context (a\n * settings doc, say) without the provider knowing about that service.\n *\n * (Shape mirrored from serve.js's `WorkerSpec`, kept as a local typedef so this\n * sandbox-loaded file does not import the host-only serve module. Types erase,\n * so this costs nothing at runtime.)\n * @typedef {{\n * createWorker: () => Worker | Promise<Worker>,\n * open?: (ctx: {element?: HTMLElement}) => any,\n * handle: (frame: any, io: any) => any,\n * abort?: (token: any, post: (msg: any, transfer?: Transferable[]) => void) => void,\n * }} WorkerSpec\n */\n\n/**\n * The descriptor a package puts in its `plugins` array to offer a worker.\n * @typedef {{type: \"patchwork:worker\", id: string, name?: string, load: () => Promise<WorkerSpec>}} WorkerPlugin\n */\n\n/**\n * Open a connection to a worker of `kind`.\n *\n * A `patchwork:subscribe` provider for `{type: CHANNEL_SELECTOR, kind}` above\n * `element` answers, transferring streams back over the port. In the host realm\n * that's a mounted worker provider; in a sandboxed realm it's whatever relays\n * the subscription to the host and transfers the host's streams back across the\n * boundary. The consumer gets the same `{readable, writable, disconnect}` either\n * way and never learns which answered.\n *\n * There is deliberately NO fallback to a locally-constructed worker. Inside the\n * sandbox that fallback was a hole: any in-boundary tool that imported a service\n * package would register its worker as an import side-effect, and a connection\n * that should have been refused would instead run the worker in the opaque\n * origin — no shared model cache, no host config, and no signal that the\n * isolation boundary had been bypassed. Serving is the provider's job; a\n * consumer with no provider ancestor fails loudly instead.\n *\n * @param {string} kind\n * @param {{ element: HTMLElement }} opts a node inside a mounted <patchwork-view>,\n * to dispatch the discovery subscribe from\n * @returns {Promise<WorkerConnection>}\n */\nexport async function connectWorker(kind, opts) {\n\tconst el = opts?.element\n\tif (!el) {\n\t\tthrow new Error(\n\t\t\t`no worker available for kind \"${kind}\": no element to discover a provider from`\n\t\t)\n\t}\n\tconst streams = await discoverViaProvider(el, kind)\n\tif (!streams) {\n\t\tthrow new Error(`no worker available for kind \"${kind}\"`)\n\t}\n\treturn withDisconnect(streams)\n}\n\n/**\n * Wrap a {readable, writable} with a disconnect() that tears both ends down.\n * Only valid while the caller holds no reader/writer lock (a locked stream\n * rejects cancel/abort); a consumer that has taken locks releases through them.\n * @param {WorkerStreams} streams\n * @returns {WorkerConnection}\n */\nfunction withDisconnect(streams) {\n\treturn {\n\t\t...streams,\n\t\tdisconnect() {\n\t\t\tstreams.readable.cancel().catch(() => {})\n\t\t\tstreams.writable.abort().catch(() => {})\n\t\t},\n\t}\n}\n\n/**\n * Ask a `patchwork:worker-channel` provider to open a connection, via providers\n * `subscribe()`. Resolves null on an explicit refusal, or if nothing answers\n * within the discovery timeout.\n *\n * @param {HTMLElement} element\n * @param {string} kind\n * @returns {Promise<WorkerStreams | null>}\n */\nfunction discoverViaProvider(element, kind) {\n\treturn new Promise((resolve) => {\n\t\tlet settled = false\n\t\t/** @type {(() => void) | null} */\n\t\tlet unsubscribe = null\n\n\t\tconst finish = (/** @type {WorkerStreams | null} */ v) => {\n\t\t\tif (settled) return\n\t\t\tsettled = true\n\t\t\tclearTimeout(timer)\n\t\t\t// One-shot: the provider may hold the subscription open, but we only ever\n\t\t\t// want the first answer.\n\t\t\ttry {\n\t\t\t\tunsubscribe?.()\n\t\t\t} catch {}\n\t\t\tresolve(v)\n\t\t}\n\t\tconst timer = setTimeout(() => finish(null), DISCOVERY_TIMEOUT_MS)\n\n\t\t// `subscribe` is typed `T extends JSONValue`, but a transferred stream pair\n\t\t// is not JSON — the cast is that constraint biting. `accept<T = JSONValue>`\n\t\t// is deliberately unconstrained for exactly this case; the consumer half\n\t\t// was never widened to match. Worth fixing upstream.\n\t\tvoid import(\"@inkandswitch/patchwork-providers\")\n\t\t\t.then(({subscribe}) => {\n\t\t\t\tif (settled) return\n\t\t\t\tunsubscribe = /** @type {any} */ (subscribe)(\n\t\t\t\t\telement,\n\t\t\t\t\t{type: CHANNEL_SELECTOR, kind},\n\t\t\t\t\t(/** @type {WorkerStreams | null} */ value) => {\n\t\t\t\t\t\t// `null` is an explicit refusal — settle now rather than burning\n\t\t\t\t\t\t// the full discovery timeout for an answer that already exists.\n\t\t\t\t\t\tif (value && value.readable && value.writable) {\n\t\t\t\t\t\t\tfinish({readable: value.readable, writable: value.writable})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfinish(null)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t\t// A provider can answer during the dispatch above, in which case\n\t\t\t\t// `finish` ran while `unsubscribe` was still null. Tear down now.\n\t\t\t\tif (settled) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tunsubscribe?.()\n\t\t\t\t\t} catch {}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\tconsole.error(\"[patchwork-worker] failed to load patchwork-providers:\", err)\n\t\t\t\tfinish(null)\n\t\t\t})\n\t})\n}\n\n// --- Session layer ----------------------------------------------------------\n// session.js takes `connectWorker` as a parameter rather than importing it, so\n// the dependency runs one way and there's no import cycle.\nexport const openSession = createOpenSession(connectWorker)\n","/**\n * The SERVING half of a worker connection — the mirror of `openSession`.\n *\n * `openSession` (session.js) is the consumer side: it owns a `{readable,\n * writable}` pair, mints request ids, multiplexes many requests over one\n * connection, and routes event frames back to the right caller. `serveWorkerSpec`\n * is the same machinery on the OTHER end. A service supplies a small `WorkerSpec`\n * — how to construct its worker, an optional per-connection warm-up, and a\n * `handle(frame, io)` that turns one consumer request into worker traffic — and\n * this file owns everything kind-agnostic around it:\n *\n * - the `{readable, writable}` stream pair and its controller lifecycle\n * - ONE dedicated Worker per connection, terminated on teardown (no reuse, no\n * sharing — a worker belongs to the connection that opened it and dies with it)\n * - id minting and demux for requests multiplexed within the connection\n * - the reserved `op:\"abort\"` (session.js sends it, so it is part of the\n * transport protocol, not any service's vocabulary)\n * - teardown on cancel/close/abort of either stream, on worker death, and on a\n * worker that cannot be constructed\n * - a bounded `open` hook\n *\n * Frames the worker posts with NO `id` (status, progress) are emitted straight\n * onto the connection's readable; the consumer side fans them out to its\n * in-flight requests. With one worker per connection there is nothing else to\n * route them to.\n *\n * The spec knows nothing about streams, ids, or workers-as-transport; the\n * transport knows nothing about the service's op vocabulary, config, or secrets.\n */\n\n/**\n * How long `spec.open` may take before the transport gives up and serves frames\n * anyway. Bounds an upstream primitive that can hang: a settings-doc warm resolves\n * through patchwork-providers' `request()`, which never settles if no provider\n * answers. Falling through is the spec's responsibility to make safe; wedging\n * every frame forever is strictly worse.\n */\nconst OPEN_TIMEOUT_MS = 5000\n\n/**\n * @typedef {(msg: any, transfer?: Transferable[]) => void} Post\n * @typedef {(frame: any) => void} Emit\n *\n * @typedef {Object} IO what a spec's `handle` is given\n * @property {Post} post send a message to the worker (transfer supported)\n * @property {Emit} emit enqueue a frame onto THIS consumer's readable\n * @property {(fn: (msg:any)=>boolean|void) => void} on\n * register a handler for worker messages tagged with `workerId`; return a truthy\n * value from `fn` when the request is complete and the transport should clean up.\n * A request whose handle never calls `on` is fire-and-forget: nothing is\n * tracked for it and `op:\"abort\"` cannot target it.\n * @property {string} workerId the transport-minted id to tag worker payloads with\n * @property {any} state whatever `spec.open` resolved (or null)\n * @property {{element?: HTMLElement}} ctx host-realm context from the provider\n *\n * @typedef {Object} WorkerSpec\n * @property {() => Worker | Promise<Worker>} createWorker\n * @property {(ctx: {element?: HTMLElement}) => any} [open]\n * @property {(frame: any, io: IO) => any} handle\n * returns an opaque abort token (or nothing) stored per tracked request\n * @property {(token: any, post: Post) => void} [abort]\n */\n\nlet idSeq = 0\nfunction nextWorkerId() {\n\treturn \"wk-\" + ++idSeq + \"-\" + (performance.now() | 0)\n}\n\n/**\n * Serve one worker connection from a spec. Returns the `{readable, writable}` the\n * provider transfers to the consumer. One Worker is created for this connection\n * and terminated when either stream ends or the worker dies.\n *\n * @param {WorkerSpec} spec\n * @param {{element?: HTMLElement}} [ctx]\n * @returns {{readable: ReadableStream, writable: WritableStream}}\n */\nexport function serveWorkerSpec(spec, ctx = {}) {\n\t/** @type {Worker | null} */\n\tlet worker = null\n\t/** @type {Promise<Worker> | null} */\n\tlet workerReady = null\n\t// worker message id -> handler. One connection, so one flat map is enough.\n\t/** @type {Map<string, (msg:any)=>boolean|void>} */\n\tconst handlers = new Map()\n\t// caller id -> the abort token the spec returned, so `op:\"abort\"` can cancel\n\t// it. A request is entered here SYNCHRONOUSLY at `PENDING` the moment its\n\t// frame arrives, before any await — so an `op:\"abort\"` that races in while the\n\t// spec is still resolving (`await openState` / `await spec.handle`) finds the\n\t// request and is honoured once the token lands, rather than being dropped.\n\t/** @type {Map<string, any>} */\n\tconst tokens = new Map()\n\t// caller ids aborted while still `PENDING` — the abort is deferred to when the\n\t// handler stores its token.\n\t/** @type {Set<string>} */\n\tconst aborted = new Set()\n\tconst PENDING = Symbol(\"pending\")\n\n\t/** @type {ReadableStreamDefaultController | null} */\n\tlet controller = null\n\tlet closed = false\n\n\tconst emit = (/** @type {any} */ frame) => {\n\t\ttry {\n\t\t\tcontroller?.enqueue(frame)\n\t\t} catch {}\n\t}\n\n\t// The connection's one warm-up, bounded so a never-settling `open` can't wedge\n\t// every frame. Started eagerly; frames await it before dispatch.\n\tconst openState = spec.open\n\t\t? Promise.race([\n\t\t\t\tPromise.resolve(spec.open(ctx)),\n\t\t\t\tnew Promise((resolve) => setTimeout(resolve, OPEN_TIMEOUT_MS, null)),\n\t\t\t]).catch(() => null)\n\t\t: Promise.resolve(null)\n\n\t/** @type {Post} */\n\tconst post = (msg, transfer) => {\n\t\tif (closed) return\n\t\tvoid getWorker()\n\t\t\t.then((w) => w.postMessage(msg, transfer || []))\n\t\t\t.catch(() => {}) // a failed construction has already torn the connection down\n\t}\n\n\t/**\n\t * Lazily construct the worker (once) and wire its message pump. A worker that\n\t * cannot be constructed, or that later dies, ends the connection: the\n\t * consumer's in-flight requests reject when its readable closes, instead of\n\t * waiting on a worker that will never answer.\n\t */\n\tfunction getWorker() {\n\t\tif (workerReady) return workerReady\n\t\tworkerReady = Promise.resolve()\n\t\t\t.then(() => spec.createWorker())\n\t\t\t.then((w) => {\n\t\t\t\tworker = w\n\t\t\t\tw.onmessage = (/** @type {MessageEvent} */ ev) => dispatch(ev.data)\n\t\t\t\tw.onerror = teardown\n\t\t\t\tw.onmessageerror = teardown\n\t\t\t\treturn w\n\t\t\t})\n\t\tworkerReady.catch(teardown)\n\t\treturn workerReady\n\t}\n\n\t/**\n\t * Route a worker message. A message with an `id` goes to that request's\n\t * handler (which reports terminal by returning truthy). A message with no `id`\n\t * is a connection-wide broadcast and goes straight onto the readable.\n\t */\n\tfunction dispatch(/** @type {any} */ msg) {\n\t\tif (!msg || closed) return\n\t\tif (msg.id != null) {\n\t\t\tconst h = handlers.get(msg.id)\n\t\t\tif (h && h(msg)) handlers.delete(msg.id)\n\t\t\treturn\n\t\t}\n\t\temit(msg)\n\t}\n\n\tasync function handleFrame(/** @type {any} */ frame) {\n\t\tif (!frame || typeof frame !== \"object\") return\n\t\tconst id = frame.id\n\t\tconst op = frame.op\n\n\t\t// Reserved transport op. Cancel one in-flight request: let the spec send\n\t\t// whatever the worker needs, then forget it. If the request is still\n\t\t// `PENDING` (its handler hasn't returned a token yet), defer: record the id\n\t\t// and let the handler abort as soon as it stores the token.\n\t\tif (op === \"abort\") {\n\t\t\tif (!tokens.has(id)) return // unknown / already-finished request\n\t\t\tconst token = tokens.get(id)\n\t\t\tif (token === PENDING) {\n\t\t\t\taborted.add(id)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tspec.abort?.(token, post)\n\t\t\t} catch {}\n\t\t\ttokens.delete(id)\n\t\t\treturn\n\t\t}\n\n\t\t// Claim the id SYNCHRONOUSLY, before the first await, so an abort racing in\n\t\t// during `await openState` / `await spec.handle` isn't dropped.\n\t\ttokens.set(id, PENDING)\n\n\t\tconst state = await openState\n\t\tif (closed) return\n\t\tconst workerId = nextWorkerId()\n\t\tlet tracked = false\n\n\t\t/** @type {IO} */\n\t\tconst io = {\n\t\t\tpost,\n\t\t\t// Frames the spec emits carry the WORKER id; re-tag with the caller id.\n\t\t\temit: (f) => emit({...f, id}),\n\t\t\ton: (fn) => {\n\t\t\t\ttracked = true\n\t\t\t\thandlers.set(workerId, (msg) => {\n\t\t\t\t\tconst done = fn(msg)\n\t\t\t\t\tif (done) {\n\t\t\t\t\t\ttokens.delete(id)\n\t\t\t\t\t\taborted.delete(id)\n\t\t\t\t\t}\n\t\t\t\t\treturn done\n\t\t\t\t})\n\t\t\t},\n\t\t\tworkerId,\n\t\t\tstate,\n\t\t\tctx,\n\t\t}\n\n\t\ttry {\n\t\t\tconst token = await spec.handle(frame, io)\n\t\t\t// An abort arrived while this request was still PENDING — honour it now\n\t\t\t// that the token exists, and don't store it (the request is cancelled).\n\t\t\tif (aborted.has(id)) {\n\t\t\t\taborted.delete(id)\n\t\t\t\ttokens.delete(id)\n\t\t\t\thandlers.delete(workerId)\n\t\t\t\ttry {\n\t\t\t\t\tspec.abort?.(token, post)\n\t\t\t\t} catch {}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Track the request only if the spec is listening for a reply; a\n\t\t\t// fire-and-forget handle has nothing to abort and must not accumulate.\n\t\t\tif (tracked) tokens.set(id, token)\n\t\t\telse tokens.delete(id)\n\t\t} catch (e) {\n\t\t\tconst err = /** @type {any} */ (e)\n\t\t\temit({id, type: \"error\", message: err?.message || String(e)})\n\t\t\thandlers.delete(workerId)\n\t\t\ttokens.delete(id)\n\t\t\taborted.delete(id)\n\t\t}\n\t}\n\n\tfunction teardown() {\n\t\tif (closed) return\n\t\tclosed = true\n\t\thandlers.clear()\n\t\ttokens.clear()\n\t\taborted.clear()\n\t\t// Close the readable so a consumer still reading it sees end-of-stream rather\n\t\t// than hanging forever. Teardown can be driven from the WRITABLE side\n\t\t// (close/abort) or worker death, where the readable was never cancelled.\n\t\t// `close()` throws if the stream was already closed/cancelled, so guard it.\n\t\ttry {\n\t\t\tcontroller?.close()\n\t\t} catch {}\n\t\tcontroller = null\n\t\t// The worker belongs to this connection alone — kill it.\n\t\ttry {\n\t\t\tworker?.terminate()\n\t\t} catch {}\n\t\tworker = null\n\t}\n\n\tconst readable = new ReadableStream({\n\t\tstart(c) {\n\t\t\tcontroller = c\n\t\t},\n\t\tcancel() {\n\t\t\tteardown()\n\t\t},\n\t})\n\n\tconst writable = new WritableStream({\n\t\twrite(frame) {\n\t\t\tvoid handleFrame(frame)\n\t\t},\n\t\tclose() {\n\t\t\tteardown()\n\t\t},\n\t\tabort() {\n\t\t\tteardown()\n\t\t},\n\t})\n\n\treturn {readable, writable}\n}\n","/**\n * The worker provider — the SERVING half of `patchwork:worker-channel`.\n *\n * Mounted in the host realm as a `patchwork:component`, it answers worker-channel\n * subscriptions by running the requested worker HERE and transferring its\n * `{readable, writable}` stream pair back to the consumer. Under isolation the\n * consumer is inside the sandbox and only the streams cross; the worker, and any\n * config or secrets it resolves, never leave the host.\n *\n * It is KIND-AGNOSTIC. Workers are resolved from the `patchwork:worker` plugin\n * registry by the selector's `kind`, so this file imports nothing\n * service-specific — no LLM, no config, no secrets. A package that owns a worker\n * registers it declaratively:\n *\n * // in a Patchwork package's `plugins` array\n * {type: \"patchwork:worker\", id: \"llm\", name: \"LLM\",\n * async load() { return llmWorkerSpec }}\n *\n * and `load()` resolves to a `WorkerSpec` (see @grjte/patchwork-worker/serve.js):\n * `{createWorker, open?, handle, abort?}`. The provider hands the spec to\n * `serveWorkerSpec`, which owns the streams, the worker lifetime, and the id\n * demux; the spec owns only the service's op vocabulary.\n *\n * Package placement: this lives in the host-only `providers` package and imports\n * the transport's serve half from `@grjte/patchwork-worker/serve.js`. The\n * consumer half (`connect.js`, the only file a sandboxed tool loads) never\n * imports this module, so the plugin registry stays out of the sandbox.\n *\n * Three invariants make this reliable rather than racy:\n *\n * 1. DECLINE SYNCHRONOUSLY, CLAIM SYNCHRONOUSLY. `registry.has(kind)` is sync,\n * so a kind we cannot serve is left to bubble (another provider may answer)\n * by returning BEFORE `accept()`. `accept()` itself claims with\n * `stopPropagation()` before running the producer, so a kind we can serve is\n * claimed before any await — otherwise the event finishes bubbling while we\n * wait and an ancestor double-answers.\n * 2. ALWAYS SETTLE A CLAIMED REQUEST. Once claimed, the consumer is waiting on\n * this subscription, so every path must reply — the stream pair on success,\n * an explicit `null` on failure. Staying silent turns a bad config or a\n * throwing worker into a hang.\n * 3. LISTEN AT THE DOCUMENT, NOT THE MOUNT ELEMENT. `patchwork:subscribe`\n * bubbles and is `composed`, so a document-level listener catches every\n * request regardless of where this provider sits relative to the consumer.\n * Listening on the mount element instead would make correctness depend on\n * this component having mounted before any consumer dispatches — and\n * `patchwork-view` mounting is async twice over (a deferred render, then an\n * async registry load), so a host would have to gate its whole subtree on\n * this provider being ready. That gate is a bad trade: `patchwork-view`\n * emits no event when a component fails to load, so a failed load would\n * leave the gated subtree blank forever. Listening at the document keeps\n * this an optional capability that degrades to \"no worker available\"\n * instead of taking the frame down with it. (The sibling providers in this\n * package listen on their mount element; this one deliberately differs.)\n */\n\nimport { getRegistry, type PluginDescription, type PluginRegistry } from \"@inkandswitch/patchwork-plugins\";\nimport { accept, type SubscribeEvent } from \"@inkandswitch/patchwork-providers\";\nimport { CHANNEL_SELECTOR, WORKER_PLUGIN_TYPE } from \"@grjte/patchwork-worker/connect.js\";\nimport { serveWorkerSpec, type WorkerSpec } from \"@grjte/patchwork-worker/serve.js\";\n\n/**\n * How long to wait for a registered worker plugin to LOAD before refusing.\n *\n * `has(kind)` proves the plugin is registered, not that its module can be\n * fetched — an unreachable package or a `load()` that never settles would\n * otherwise leave a claimed port unanswered forever, which is exactly the hang\n * invariant 2 exists to prevent.\n */\nconst LOAD_TIMEOUT_MS = 10000;\n\n/** The value a worker-channel subscription settles with: the pair, or a refusal. */\ntype WorkerChannelValue = { readable: ReadableStream; writable: WritableStream } | null;\n\n/** The selector a consumer dispatches (see connect.js `CHANNEL_SELECTOR`). */\ntype WorkerChannelSelector = { type: string; kind?: string };\n\n/**\n * Mount the worker provider on `element`. Returns a cleanup function\n * (the `patchwork:component` render contract).\n *\n * `element` is never read for `repo` or attributes; it is only the host-realm\n * context handed to a spec's `open(ctx)`, so a worker can resolve things that\n * need a mounted view (a settings doc, say). Hence `HTMLElement`, not\n * `PatchworkViewElement`.\n */\nexport const WorkerProvider = (element: HTMLElement): (() => void) => {\n const workers: PluginRegistry<PluginDescription, WorkerSpec> = getRegistry(WORKER_PLUGIN_TYPE);\n\n const onSubscribe = (event: Event) => {\n const detail = (event as SubscribeEvent).detail;\n const selector = detail?.selector as WorkerChannelSelector | undefined;\n if (!selector || selector.type !== CHANNEL_SELECTOR) return;\n if (!detail.port) return;\n\n const kind = selector.kind;\n\n // Decline what we cannot serve, SYNCHRONOUSLY and without claiming, so the\n // event keeps bubbling and something else may answer. Must come BEFORE\n // `accept()`, which claims via stopPropagation() the moment it is called.\n if (!kind || !workers.has(kind)) return;\n\n // `accept()` claims the event and owns the port from here: its lifetime,\n // its teardown, and the `{type:\"change\", value}` envelope. We only choose\n // the value.\n accept<WorkerChannelValue>(event as SubscribeEvent, (respond) => {\n void serve(kind, respond);\n });\n };\n\n /**\n * Run the worker for `kind` and hand its streams back. Always settles: the\n * stream pair on success, `null` on any failure — a claimed subscription that\n * stays silent hangs the consumer forever.\n */\n async function serve(\n kind: string,\n respond: (value: WorkerChannelValue, transfer?: Transferable[]) => void\n ) {\n try {\n // `loadWhenReady` (not `load`) waits for the `registered` event, so a\n // worker registered-but-not-yet-loaded still resolves instead of being\n // reported missing. Bounded: a claimed subscription must always settle,\n // and `accept()` does not bound the producer for us.\n const plugin = await Promise.race([\n workers.loadWhenReady(kind),\n new Promise<never>((_, reject) =>\n setTimeout(\n () => reject(new Error(`timed out loading worker plugin \"${kind}\"`)),\n LOAD_TIMEOUT_MS\n )\n ),\n ]);\n const spec = plugin?.module as WorkerSpec | undefined;\n if (!spec || typeof spec.handle !== \"function\" || typeof spec.createWorker !== \"function\") {\n throw new Error(`worker plugin \"${kind}\" did not resolve to a WorkerSpec`);\n }\n\n // The element is what lets a worker resolve host-realm context it needs\n // (e.g. a settings doc via the patchwork:tool-storage provider) without\n // this provider knowing anything about that service. serveWorkerSpec owns\n // the streams, the per-connection worker, and the id demux; the spec owns\n // the service vocabulary.\n const streams = serveWorkerSpec(spec, { element });\n\n // The streams ride IN the value; naming them in the transfer list only\n // upgrades the structured clone to a move. Both are required — a\n // transferable named in the list but absent from the value is detached\n // here and never arrives there.\n respond({ readable: streams.readable, writable: streams.writable }, [\n streams.readable,\n streams.writable,\n ]);\n } catch (err) {\n // The reason no longer rides the wire (the envelope is `accept()`'s), so\n // log it here — this is the only place it was ever surfaced anyway.\n console.error(`[worker-provider] failed to serve \"${kind}\":`, err);\n respond(null);\n }\n }\n\n // Document-level: see invariant 3. `element` is still used as the host-realm\n // context handed to `open(ctx)`, so a worker can resolve things that need a\n // mounted view (a settings doc, say) — the provider's POSITION matters for\n // that, but not for whether it hears the request.\n document.addEventListener(\"patchwork:subscribe\", onSubscribe);\n return () => {\n document.removeEventListener(\"patchwork:subscribe\", onSubscribe);\n };\n};\n"],"names":["CHANNEL_SELECTOR","WORKER_PLUGIN_TYPE","OPEN_TIMEOUT_MS","idSeq","nextWorkerId","serveWorkerSpec","spec","ctx","worker","workerReady","handlers","tokens","aborted","PENDING","controller","closed","emit","frame","openState","resolve","post","msg","transfer","getWorker","w","ev","dispatch","teardown","h","handleFrame","id","token","state","workerId","tracked","io","f","fn","done","e","readable","c","writable","LOAD_TIMEOUT_MS","WorkerProvider","element","workers","getRegistry","onSubscribe","event","detail","selector","kind","accept","respond","serve","_","reject","streams","err"],"mappings":"yHA4DO,MAAMA,EAAmB,2BAMnBC,EAAqB,mBC7B5BC,EAAkB,IA0BxB,IAAIC,EAAQ,EACZ,SAASC,GAAe,CACvB,MAAO,OAAQ,EAAED,EAAQ,KAAO,YAAY,IAAG,EAAK,EACrD,CAWO,SAASE,EAAgBC,EAAMC,EAAM,GAAI,CAE/C,IAAIC,EAAS,KAETC,EAAc,KAGlB,MAAMC,EAAW,IAAI,IAOfC,EAAS,IAAI,IAIbC,EAAU,IAAI,IACdC,EAAU,OAAO,SAAS,EAGhC,IAAIC,EAAa,KACbC,EAAS,GAEb,MAAMC,EAA2BC,GAAU,CAC1C,GAAI,CACHH,GAAY,QAAQG,CAAK,CAC1B,MAAQ,CAAC,CACV,EAIMC,EAAYZ,EAAK,KACpB,QAAQ,KAAK,CACb,QAAQ,QAAQA,EAAK,KAAKC,CAAG,CAAC,EAC9B,IAAI,QAASY,GAAY,WAAWA,EAASjB,EAAiB,IAAI,CAAC,CACvE,CAAI,EAAE,MAAM,IAAM,IAAI,EAClB,QAAQ,QAAQ,IAAI,EAGjBkB,EAAO,CAACC,EAAKC,IAAa,CAC3BP,GACCQ,EAAS,EACZ,KAAMC,GAAMA,EAAE,YAAYH,EAAKC,GAAY,EAAE,CAAC,EAC9C,MAAM,IAAM,CAAC,CAAC,CACjB,EAQA,SAASC,GAAY,CACpB,OAAId,IACJA,EAAc,QAAQ,QAAO,EAC3B,KAAK,IAAMH,EAAK,aAAY,CAAE,EAC9B,KAAMkB,IACNhB,EAASgB,EACTA,EAAE,UAAyCC,GAAOC,EAASD,EAAG,IAAI,EAClED,EAAE,QAAUG,EACZH,EAAE,eAAiBG,EACZH,EACP,EACFf,EAAY,MAAMkB,CAAQ,EACnBlB,EACR,CAOA,SAASiB,EAA4BL,EAAK,CACzC,GAAI,GAACA,GAAON,GACZ,IAAIM,EAAI,IAAM,KAAM,CACnB,MAAMO,EAAIlB,EAAS,IAAIW,EAAI,EAAE,EACzBO,GAAKA,EAAEP,CAAG,GAAGX,EAAS,OAAOW,EAAI,EAAE,EACvC,MACD,CACAL,EAAKK,CAAG,EACT,CAEA,eAAeQ,EAA+BZ,EAAO,CACpD,GAAI,CAACA,GAAS,OAAOA,GAAU,SAAU,OACzC,MAAMa,EAAKb,EAAM,GAOjB,GANWA,EAAM,KAMN,QAAS,CACnB,GAAI,CAACN,EAAO,IAAImB,CAAE,EAAG,OACrB,MAAMC,EAAQpB,EAAO,IAAImB,CAAE,EAC3B,GAAIC,IAAUlB,EAAS,CACtBD,EAAQ,IAAIkB,CAAE,EACd,MACD,CACA,GAAI,CACHxB,EAAK,QAAQyB,EAAOX,CAAI,CACzB,MAAQ,CAAC,CACTT,EAAO,OAAOmB,CAAE,EAChB,MACD,CAIAnB,EAAO,IAAImB,EAAIjB,CAAO,EAEtB,MAAMmB,EAAQ,MAAMd,EACpB,GAAIH,EAAQ,OACZ,MAAMkB,EAAW7B,EAAY,EAC7B,IAAI8B,EAAU,GAGd,MAAMC,EAAK,CACV,KAAAf,EAEA,KAAOgB,GAAMpB,EAAK,CAAC,GAAGoB,EAAG,GAAAN,CAAE,CAAC,EAC5B,GAAKO,GAAO,CACXH,EAAU,GACVxB,EAAS,IAAIuB,EAAWZ,GAAQ,CAC/B,MAAMiB,EAAOD,EAAGhB,CAAG,EACnB,OAAIiB,IACH3B,EAAO,OAAOmB,CAAE,EAChBlB,EAAQ,OAAOkB,CAAE,GAEXQ,CACR,CAAC,CACF,EACA,SAAAL,EACA,MAAAD,EACA,IAAAzB,CACH,EAEE,GAAI,CACH,MAAMwB,EAAQ,MAAMzB,EAAK,OAAOW,EAAOkB,CAAE,EAGzC,GAAIvB,EAAQ,IAAIkB,CAAE,EAAG,CACpBlB,EAAQ,OAAOkB,CAAE,EACjBnB,EAAO,OAAOmB,CAAE,EAChBpB,EAAS,OAAOuB,CAAQ,EACxB,GAAI,CACH3B,EAAK,QAAQyB,EAAOX,CAAI,CACzB,MAAQ,CAAC,CACT,MACD,CAGIc,EAASvB,EAAO,IAAImB,EAAIC,CAAK,EAC5BpB,EAAO,OAAOmB,CAAE,CACtB,OAASS,EAAG,CAEXvB,EAAK,CAAC,GAAAc,EAAI,KAAM,QAAS,QADOS,GACO,SAAW,OAAOA,CAAC,CAAC,CAAC,EAC5D7B,EAAS,OAAOuB,CAAQ,EACxBtB,EAAO,OAAOmB,CAAE,EAChBlB,EAAQ,OAAOkB,CAAE,CAClB,CACD,CAEA,SAASH,GAAW,CACnB,GAAI,CAAAZ,EACJ,CAAAA,EAAS,GACTL,EAAS,MAAK,EACdC,EAAO,MAAK,EACZC,EAAQ,MAAK,EAKb,GAAI,CACHE,GAAY,MAAK,CAClB,MAAQ,CAAC,CACTA,EAAa,KAEb,GAAI,CACHN,GAAQ,UAAS,CAClB,MAAQ,CAAC,CACTA,EAAS,KACV,CAEA,MAAMgC,EAAW,IAAI,eAAe,CACnC,MAAMC,EAAG,CACR3B,EAAa2B,CACd,EACA,QAAS,CACRd,EAAQ,CACT,CACF,CAAE,EAEKe,EAAW,IAAI,eAAe,CACnC,MAAMzB,EAAO,CACPY,EAAYZ,CAAK,CACvB,EACA,OAAQ,CACPU,EAAQ,CACT,EACA,OAAQ,CACPA,EAAQ,CACT,CACF,CAAE,EAED,MAAO,CAAC,SAAAa,EAAU,SAAAE,CAAQ,CAC3B,CCvNA,MAAMC,EAAkB,IAiBXC,EAAkBC,GAAuC,CACpE,MAAMC,EAAyDC,EAAY9C,CAAkB,EAEvF+C,EAAeC,GAAiB,CACpC,MAAMC,EAAUD,EAAyB,OACnCE,EAAWD,GAAQ,SAEzB,GADI,CAACC,GAAYA,EAAS,OAASnD,GAC/B,CAACkD,EAAO,KAAM,OAElB,MAAME,EAAOD,EAAS,KAKlB,CAACC,GAAQ,CAACN,EAAQ,IAAIM,CAAI,GAK9BC,EAA2BJ,EAA0BK,GAAY,CAC1DC,EAAMH,EAAME,CAAO,CAC1B,CAAC,CACH,EAOA,eAAeC,EACbH,EACAE,EACA,CACA,GAAI,CAcF,MAAMhD,GATS,MAAM,QAAQ,KAAK,CAChCwC,EAAQ,cAAcM,CAAI,EAC1B,IAAI,QAAe,CAACI,EAAGC,IACrB,WACE,IAAMA,EAAO,IAAI,MAAM,oCAAoCL,CAAI,GAAG,CAAC,EACnET,CAAA,CACF,CACF,CACD,IACoB,OACrB,GAAI,CAACrC,GAAQ,OAAOA,EAAK,QAAW,YAAc,OAAOA,EAAK,cAAiB,WAC7E,MAAM,IAAI,MAAM,kBAAkB8C,CAAI,mCAAmC,EAQ3E,MAAMM,EAAUrD,EAAgBC,EAAM,CAAE,QAAAuC,EAAS,EAMjDS,EAAQ,CAAE,SAAUI,EAAQ,SAAU,SAAUA,EAAQ,UAAY,CAClEA,EAAQ,SACRA,EAAQ,QAAA,CACT,CACH,OAASC,EAAK,CAGZ,QAAQ,MAAM,sCAAsCP,CAAI,KAAMO,CAAG,EACjEL,EAAQ,IAAI,CACd,CACF,CAMA,gBAAS,iBAAiB,sBAAuBN,CAAW,EACrD,IAAM,CACX,SAAS,oBAAoB,sBAAuBA,CAAW,CACjE,CACF","x_google_ignoreList":[0,1]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const h="modulepreload",f=function(t,e){return new URL(t,e).href},_={},i=function(e,u,m){let p=Promise.resolve();if(u&&u.length>0){let P=function(r){return Promise.all(r.map(a=>Promise.resolve(a).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};const c=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),w=o?.nonce||o?.getAttribute("nonce");p=P(u.map(r=>{if(r=f(r,m),r in _)return;_[r]=!0;const a=r.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(m)for(let l=c.length-1;l>=0;l--){const d=c[l];if(d.href===r&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${r}"]${s}`))return;const n=document.createElement("link");if(n.rel=a?"stylesheet":h,a||(n.as="script"),n.crossOrigin="",n.href=r,w&&n.setAttribute("nonce",w),document.head.appendChild(n),a)return new Promise((l,d)=>{n.addEventListener("load",l),n.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${r}`)))})}))}function v(c){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=c,window.dispatchEvent(o),!o.defaultPrevented)throw c}return p.then(c=>{for(const o of c||[])o.status==="rejected"&&v(o.reason);return e().catch(v)})},y=[{type:"patchwork:component",id:"patchwork-comments-provider",name:"Comments Provider",async load(){const{CommentsProvider:t}=await i(async()=>{const{CommentsProvider:e}=await import("./assets/CommentsProvider-BYqGfL6x.js");return{CommentsProvider:e}},[],import.meta.url);return t}},{type:"patchwork:component",id:"patchwork-focus-provider",name:"Focus Provider",async load(){const{FocusProvider:t}=await i(async()=>{const{FocusProvider:e}=await import("./assets/FocusProvider-AfpGH4B_.js");return{FocusProvider:e}},[],import.meta.url);return t}},{type:"patchwork:component",id:"patchwork-account-provider",name:"Account Provider",async load(){const{AccountProvider:t}=await i(async()=>{const{AccountProvider:e}=await import("./assets/AccountProvider-BNtDCQWd.js");return{AccountProvider:e}},[],import.meta.url);return t}},{type:"patchwork:component",id:"patchwork-selected-doc-provider",name:"Selected Doc Provider",async load(){const{SelectedDocProvider:t}=await i(async()=>{const{SelectedDocProvider:e}=await import("./assets/SelectedDocProvider-CLztU54U.js");return{SelectedDocProvider:e}},[],import.meta.url);return t}},{type:"patchwork:component",id:"patchwork-tool-storage-provider",name:"Tool Storage Provider",async load(){const{ToolStorageProvider:t}=await i(async()=>{const{ToolStorageProvider:e}=await import("./assets/ToolStorageProvider-D7F0l8h7.js");return{ToolStorageProvider:e}},[],import.meta.url);return t}},{type:"patchwork:component",id:"patchwork-worker-provider",name:"Worker Provider",async load(){const{WorkerProvider:t}=await i(async()=>{const{WorkerProvider:e}=await import("./assets/WorkerProvider-CG700oWK.js");return{WorkerProvider:e}},[],import.meta.url);return t}}];export{y as plugins};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"gsCAEaA,EAAyB,CACpC,CACE,KAAM,sBACN,GAAI,8BACJ,KAAM,oBACN,MAAM,MAAO,CACX,KAAM,CAAE,iBAAAC,CAAA,EAAqB,MAAAC,EAAA,iCAAAD,CAAA,OAAM,QAAO,uCAAuB,0BAAAA,CAAA,uBACjE,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,2BACJ,KAAM,iBACN,MAAM,MAAO,CACX,KAAM,CAAE,cAAAE,CAAA,EAAkB,MAAAD,EAAA,8BAAAC,CAAA,OAAM,QAAO,oCAAoB,uBAAAA,CAAA,uBAC3D,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,6BACJ,KAAM,mBACN,MAAM,MAAO,CACX,KAAM,CAAE,gBAAAC,CAAA,EAAoB,MAAAF,EAAA,gCAAAE,CAAA,OAAM,QAAO,sCAAsB,yBAAAA,CAAA,uBAC/D,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,kCACJ,KAAM,wBACN,MAAM,MAAO,CACX,KAAM,CAAE,oBAAAC,CAAA,EAAwB,MAAAH,EAAA,oCAAAG,CAAA,OAAM,QAAO,0CAA0B,6BAAAA,CAAA,uBACvE,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,kCACJ,KAAM,wBACN,MAAM,MAAO,CACX,KAAM,CAAE,oBAAAC,CAAA,EAAwB,MAAAJ,EAAA,oCAAAI,CAAA,OAAM,QAAO,0CAA0B,6BAAAA,CAAA,uBACvE,OAAOA,CACT,EAEJ","names":["plugins","CommentsProvider","__vitePreload","FocusProvider","AccountProvider","SelectedDocProvider","ToolStorageProvider"],"ignoreList":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Plugin } from \"@inkandswitch/patchwork-plugins\";\n\nexport const plugins: Plugin<any>[] = [\n {\n type: \"patchwork:component\",\n id: \"patchwork-comments-provider\",\n name: \"Comments Provider\",\n async load() {\n const { CommentsProvider } = await import(\"./CommentsProvider.js\");\n return CommentsProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-focus-provider\",\n name: \"Focus Provider\",\n async load() {\n const { FocusProvider } = await import(\"./FocusProvider.js\");\n return FocusProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-account-provider\",\n name: \"Account Provider\",\n async load() {\n const { AccountProvider } = await import(\"./AccountProvider.js\");\n return AccountProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-selected-doc-provider\",\n name: \"Selected Doc Provider\",\n async load() {\n const { SelectedDocProvider } = await import(\"./SelectedDocProvider.js\");\n return SelectedDocProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-tool-storage-provider\",\n name: \"Tool Storage Provider\",\n async load() {\n const { ToolStorageProvider } = await import(\"./ToolStorageProvider.js\");\n return ToolStorageProvider;\n },\n },\n];\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"mappings":"gsCAEaA,EAAyB,CACpC,CACE,KAAM,sBACN,GAAI,8BACJ,KAAM,oBACN,MAAM,MAAO,CACX,KAAM,CAAE,iBAAAC,CAAA,EAAqB,MAAAC,EAAA,iCAAAD,CAAA,OAAM,QAAO,uCAAuB,0BAAAA,CAAA,uBACjE,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,2BACJ,KAAM,iBACN,MAAM,MAAO,CACX,KAAM,CAAE,cAAAE,CAAA,EAAkB,MAAAD,EAAA,8BAAAC,CAAA,OAAM,QAAO,oCAAoB,uBAAAA,CAAA,uBAC3D,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,6BACJ,KAAM,mBACN,MAAM,MAAO,CACX,KAAM,CAAE,gBAAAC,CAAA,EAAoB,MAAAF,EAAA,gCAAAE,CAAA,OAAM,QAAO,sCAAsB,yBAAAA,CAAA,uBAC/D,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,kCACJ,KAAM,wBACN,MAAM,MAAO,CACX,KAAM,CAAE,oBAAAC,CAAA,EAAwB,MAAAH,EAAA,oCAAAG,CAAA,OAAM,QAAO,0CAA0B,6BAAAA,CAAA,uBACvE,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,kCACJ,KAAM,wBACN,MAAM,MAAO,CACX,KAAM,CAAE,oBAAAC,CAAA,EAAwB,MAAAJ,EAAA,oCAAAI,CAAA,OAAM,QAAO,0CAA0B,6BAAAA,CAAA,uBACvE,OAAOA,CACT,GAEF,CACE,KAAM,sBACN,GAAI,4BACJ,KAAM,kBACN,MAAM,MAAO,CACX,KAAM,CAAE,eAAAC,CAAA,EAAmB,MAAAL,EAAA,+BAAAK,CAAA,OAAM,QAAO,qCAAqB,wBAAAA,CAAA,uBAC7D,OAAOA,CACT,EAEJ","names":["plugins","CommentsProvider","__vitePreload","FocusProvider","AccountProvider","SelectedDocProvider","ToolStorageProvider","WorkerProvider"],"ignoreList":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Plugin } from \"@inkandswitch/patchwork-plugins\";\n\nexport const plugins: Plugin<any>[] = [\n {\n type: \"patchwork:component\",\n id: \"patchwork-comments-provider\",\n name: \"Comments Provider\",\n async load() {\n const { CommentsProvider } = await import(\"./CommentsProvider.js\");\n return CommentsProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-focus-provider\",\n name: \"Focus Provider\",\n async load() {\n const { FocusProvider } = await import(\"./FocusProvider.js\");\n return FocusProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-account-provider\",\n name: \"Account Provider\",\n async load() {\n const { AccountProvider } = await import(\"./AccountProvider.js\");\n return AccountProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-selected-doc-provider\",\n name: \"Selected Doc Provider\",\n async load() {\n const { SelectedDocProvider } = await import(\"./SelectedDocProvider.js\");\n return SelectedDocProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-tool-storage-provider\",\n name: \"Tool Storage Provider\",\n async load() {\n const { ToolStorageProvider } = await import(\"./ToolStorageProvider.js\");\n return ToolStorageProvider;\n },\n },\n {\n type: \"patchwork:component\",\n id: \"patchwork-worker-provider\",\n name: \"Worker Provider\",\n async load() {\n const { WorkerProvider } = await import(\"./WorkerProvider.js\");\n return WorkerProvider;\n },\n },\n];\n"],"file":"index.js"}
|
|
@@ -10,13 +10,16 @@
|
|
|
10
10
|
"sync": "vite build && pushwork sync",
|
|
11
11
|
"register": "pw-modules add \"$MODULE_SETTINGS_DOC_URL\" \"$(pushwork url)\"",
|
|
12
12
|
"test": "vitest run",
|
|
13
|
-
"test:watch": "vitest"
|
|
13
|
+
"test:watch": "vitest",
|
|
14
|
+
"typecheck": "tsc --noEmit"
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
17
|
"@automerge/automerge": "3.3.0-fragments.1",
|
|
17
18
|
"@automerge/automerge-repo": "^2.6.0-subduction.26",
|
|
19
|
+
"@grjte/patchwork-worker": "^0.0.2",
|
|
18
20
|
"@inkandswitch/patchwork-comments": "^0.1.2",
|
|
19
21
|
"@inkandswitch/patchwork-elements": "^6.0.2",
|
|
22
|
+
"@inkandswitch/patchwork-filesystem": "^0.2.9",
|
|
20
23
|
"@inkandswitch/patchwork-plugins": "^1.2.5",
|
|
21
24
|
"@inkandswitch/patchwork-providers": "^0.5.2"
|
|
22
25
|
},
|
|
@@ -27,6 +30,7 @@
|
|
|
27
30
|
"eslint": "^9.34.0",
|
|
28
31
|
"globals": "^16.4.0",
|
|
29
32
|
"happy-dom": "^15.11.7",
|
|
33
|
+
"typescript": "^5.6.0",
|
|
30
34
|
"typescript-eslint": "^8.41.0",
|
|
31
35
|
"vite": "^7.1.9",
|
|
32
36
|
"vitest": "^3.2.4"
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
setThemeForMode,
|
|
10
10
|
startActiveTheme,
|
|
11
11
|
startActiveThemeFromProvider
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-FLDRNDLY.js";
|
|
13
|
+
import "./chunk-L7WQSSFT.js";
|
|
14
14
|
export {
|
|
15
15
|
CURRENT_THEME_SELECTOR,
|
|
16
16
|
detectColorScheme,
|
|
@@ -23,4 +23,4 @@ export {
|
|
|
23
23
|
startActiveTheme,
|
|
24
24
|
startActiveThemeFromProvider
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=active-theme-
|
|
26
|
+
//# sourceMappingURL=active-theme-ZEJCS5RM.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
gloom_default,
|
|
3
3
|
lychee_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L7WQSSFT.js";
|
|
5
5
|
|
|
6
6
|
// src/active-theme.ts
|
|
7
7
|
import { getRegistry } from "@inkandswitch/patchwork-plugins";
|
|
@@ -285,4 +285,4 @@ export {
|
|
|
285
285
|
hasThemePreferences,
|
|
286
286
|
onActiveThemeChange
|
|
287
287
|
};
|
|
288
|
-
//# sourceMappingURL=chunk-
|
|
288
|
+
//# sourceMappingURL=chunk-FLDRNDLY.js.map
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
var lychee_default = "./lychee-BMLMUNP6.css";
|
|
3
3
|
|
|
4
4
|
// src/gloom.css
|
|
5
|
-
var gloom_default = "./gloom-
|
|
5
|
+
var gloom_default = "./gloom-UKANBN2Z.css";
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
8
|
lychee_default,
|
|
9
9
|
gloom_default
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-L7WQSSFT.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
gloom_default,
|
|
3
3
|
lychee_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L7WQSSFT.js";
|
|
5
5
|
|
|
6
6
|
// src/main.ts
|
|
7
7
|
(async function() {
|
|
8
|
-
(await import("./active-theme-
|
|
8
|
+
(await import("./active-theme-ZEJCS5RM.js")).startActiveTheme();
|
|
9
9
|
})();
|
|
10
10
|
var plugins = [
|
|
11
11
|
{
|
|
@@ -57,7 +57,7 @@ var plugins = [
|
|
|
57
57
|
unlisted: true,
|
|
58
58
|
forTitleBar: true,
|
|
59
59
|
async load() {
|
|
60
|
-
const { ThemeTitlebarTool } = await import("./theme-titlebar-
|
|
60
|
+
const { ThemeTitlebarTool } = await import("./theme-titlebar-HAEXLVMW.js");
|
|
61
61
|
return ThemeTitlebarTool;
|
|
62
62
|
}
|
|
63
63
|
},
|
|
@@ -68,7 +68,7 @@ var plugins = [
|
|
|
68
68
|
icon: "Palette",
|
|
69
69
|
tags: ["system-tray"],
|
|
70
70
|
async load() {
|
|
71
|
-
const { ThemeTray } = await import("./theme-tray-
|
|
71
|
+
const { ThemeTray } = await import("./theme-tray-XYB4LGZ6.js");
|
|
72
72
|
return ThemeTray;
|
|
73
73
|
}
|
|
74
74
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
startActiveThemeFromProvider
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-FLDRNDLY.js";
|
|
4
|
+
import "./chunk-L7WQSSFT.js";
|
|
5
5
|
|
|
6
6
|
// src/theme-titlebar.ts
|
|
7
7
|
function ThemeTitlebarTool(_handle, element) {
|
|
@@ -18,4 +18,4 @@ function ThemeTitlebarTool(_handle, element) {
|
|
|
18
18
|
export {
|
|
19
19
|
ThemeTitlebarTool
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=theme-titlebar-
|
|
21
|
+
//# sourceMappingURL=theme-titlebar-HAEXLVMW.js.map
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
serveCurrentThemeProvider,
|
|
6
6
|
setThemeForCurrentMode,
|
|
7
7
|
startActiveTheme
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-FLDRNDLY.js";
|
|
9
|
+
import "./chunk-L7WQSSFT.js";
|
|
10
10
|
|
|
11
11
|
// src/theme-tray.tsx
|
|
12
12
|
import { template as _$template } from "solid-js/web";
|
|
@@ -348,4 +348,4 @@ _$delegateEvents(["click", "input"]);
|
|
|
348
348
|
export {
|
|
349
349
|
ThemeTray
|
|
350
350
|
};
|
|
351
|
-
//# sourceMappingURL=theme-tray-
|
|
351
|
+
//# sourceMappingURL=theme-tray-XYB4LGZ6.js.map
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
onActiveThemeChange,
|
|
5
5
|
setThemeForMode,
|
|
6
6
|
startActiveTheme
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-FLDRNDLY.js";
|
|
8
|
+
import "./chunk-L7WQSSFT.js";
|
|
9
9
|
|
|
10
10
|
// src/tool.tsx
|
|
11
11
|
import { template as _$template } from "solid-js/web";
|
package/plugin-registry-url
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
automerge:
|
|
1
|
+
automerge:2GqA3HMZTy1YM4rZa6krZa7BEG84
|
/package/packages/theming/dist/{active-theme-CZOUYQ4S.js.map → active-theme-ZEJCS5RM.js.map}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/packages/theming/dist/{theme-titlebar-EKXBWQZO.js.map → theme-titlebar-HAEXLVMW.js.map}
RENAMED
|
File without changes
|
|
File without changes
|