yaml-flow 8.6.4 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/adapters/firebase-storage.js +3 -0
- package/browser/adapters/firestore-storage.js +3 -0
- package/browser/adapters/localstorage-storage.js +4 -0
- package/browser/asset-integrity.json +20 -4
- package/browser/server-runtime-controlface.js +8 -0
- package/examples/ARCHITECTURE.md +5 -32
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board/server/board-server.js +4 -2
- package/examples/board-firestore/README.md +81 -0
- package/examples/board-firestore/browser/board-runtime.js +263 -0
- package/examples/board-firestore/firestore.indexes.json +29 -0
- package/examples/board-firestore/package.json +14 -0
- package/examples/board-firestore/server/adapters/firestore-archive-factory.js +59 -0
- package/examples/board-firestore/server/adapters/firestore-blob-storage.js +82 -0
- package/examples/board-firestore/server/adapters/firestore-board-adapter.js +127 -0
- package/examples/board-firestore/server/adapters/firestore-journal-storage.js +54 -0
- package/examples/board-firestore/server/adapters/firestore-kv-storage.js +47 -0
- package/examples/board-firestore/server/adapters/firestore-lock.js +62 -0
- package/examples/board-firestore/server/adapters/firestore-queue-storage.js +186 -0
- package/examples/board-firestore/server/adapters/firestore-scratch-storage.js +50 -0
- package/examples/board-firestore/server/worker.js +146 -0
- package/lib/{artifacts-store-lib-BR-Samty.d.cts → artifacts-store-lib-D9nMkVcE.d.cts} +1 -1
- package/lib/{artifacts-store-lib-DT7XlWUL.d.ts → artifacts-store-lib-DSSMqVL2.d.ts} +1 -1
- package/lib/artifacts-store-public.d.cts +2 -2
- package/lib/artifacts-store-public.d.ts +2 -2
- package/lib/board-live-cards-mcp.cjs +1 -1
- package/lib/board-live-cards-mcp.d.cts +50 -3
- package/lib/board-live-cards-mcp.d.ts +50 -3
- package/lib/board-live-cards-mcp.js +1 -1
- package/lib/board-live-cards-node.cjs +8 -8
- package/lib/board-live-cards-node.d.cts +13 -9
- package/lib/board-live-cards-node.d.ts +13 -9
- package/lib/board-live-cards-node.js +8 -8
- package/lib/{board-live-cards-public-BMUIPOrc.d.ts → board-live-cards-public-D-DJek3X.d.ts} +1 -1
- package/lib/{board-live-cards-public-wkNmBIRC.d.cts → board-live-cards-public-DQzPe7A9.d.cts} +1 -1
- package/lib/board-live-cards-public-async-3hUuHxDx.d.ts +55 -0
- package/lib/board-live-cards-public-async-CgMCYYft.d.cts +55 -0
- package/lib/board-live-cards-public.d.cts +1 -1
- package/lib/board-live-cards-public.d.ts +1 -1
- package/lib/board-live-cards-server-runtime.cjs +1 -1
- package/lib/board-live-cards-server-runtime.d.cts +10 -6
- package/lib/board-live-cards-server-runtime.d.ts +10 -6
- package/lib/board-live-cards-server-runtime.js +1 -1
- package/lib/board-platform-adapter-async-DOfEq_HC.d.cts +129 -0
- package/lib/board-platform-adapter-async-JZPCzZnH.d.ts +129 -0
- package/lib/board-worker-adapter.cjs +3 -3
- package/lib/board-worker-adapter.js +3 -3
- package/lib/card-store-public.d.cts +1 -1
- package/lib/card-store-public.d.ts +1 -1
- package/lib/{chat-storage-lib-BIUbE-fM.d.cts → chat-storage-lib-B9Q34Dyv.d.cts} +1 -1
- package/lib/{chat-storage-lib-BlG-sobS.d.ts → chat-storage-lib-DB9iSai2.d.ts} +1 -1
- package/lib/chat-store-public.d.cts +2 -2
- package/lib/chat-store-public.d.ts +2 -2
- package/lib/chunk-272IYUKT.cjs +2 -0
- package/lib/chunk-5XHOHTLZ.cjs +2 -0
- package/lib/chunk-6APH25VI.js +2 -0
- package/lib/chunk-7FGPOGRV.cjs +2 -0
- package/lib/chunk-7ICPAABP.cjs +7 -0
- package/lib/chunk-CPAXTVBQ.cjs +2 -0
- package/lib/chunk-DDYSXP2A.cjs +3 -0
- package/lib/chunk-EGRHWZRV.js +2 -0
- package/lib/chunk-GL2OHR2E.cjs +2 -0
- package/lib/chunk-IPLSRN6P.cjs +4 -0
- package/lib/chunk-J5J6BG7B.js +2 -0
- package/lib/chunk-KAWQPLIE.cjs +2 -0
- package/lib/chunk-LPXVVMQT.cjs +2 -0
- package/lib/chunk-M3OU6IS5.cjs +2 -0
- package/lib/chunk-M6STQR5F.cjs +2 -0
- package/lib/chunk-NJJ7WEDT.cjs +2 -0
- package/lib/chunk-NKIQRCOM.cjs +2 -0
- package/lib/chunk-NM6O35RY.cjs +2 -0
- package/lib/chunk-NTICU4OK.js +2 -0
- package/lib/chunk-O7NOHKVR.js +2 -0
- package/lib/chunk-PRHQBGPT.js +2 -0
- package/lib/chunk-S44QZUDX.js +2 -0
- package/lib/chunk-SGV7PU4H.js +2 -0
- package/lib/chunk-TSN3RTXT.js +4 -0
- package/lib/chunk-VXJHBWK3.js +2 -0
- package/lib/chunk-WHDEBJLT.js +7 -0
- package/lib/chunk-XYN5D3GL.js +2 -0
- package/lib/chunk-YGALANRO.js +2 -0
- package/lib/chunk-ZJ5M5COT.js +2 -0
- package/lib/chunk-ZXQR7GHT.js +3 -0
- package/lib/cloud-storage.cjs +1 -1
- package/lib/cloud-storage.d.cts +5 -3
- package/lib/cloud-storage.d.ts +5 -3
- package/lib/cloud-storage.js +1 -1
- package/lib/firebase-storage/index.cjs +3 -0
- package/lib/firebase-storage/index.d.cts +57 -0
- package/lib/firebase-storage/index.d.ts +57 -0
- package/lib/firebase-storage/index.js +3 -0
- package/lib/firestore-storage/index.cjs +3 -0
- package/lib/firestore-storage/index.d.cts +98 -0
- package/lib/firestore-storage/index.d.ts +98 -0
- package/lib/firestore-storage/index.js +3 -0
- package/lib/localstorage-storage/index.cjs +2 -0
- package/lib/localstorage-storage/index.d.cts +39 -0
- package/lib/localstorage-storage/index.d.ts +39 -0
- package/lib/localstorage-storage/index.js +2 -0
- package/lib/mcp-tool-registries-BBObLYga.d.ts +41 -0
- package/lib/mcp-tool-registries-W3TRj6O5.d.cts +41 -0
- package/lib/queue-lane-registry-PaZuFpwp.d.cts +30 -0
- package/lib/queue-lane-registry-PaZuFpwp.d.ts +30 -0
- package/lib/server-jobs-queue-runner/index.cjs +2 -0
- package/lib/server-jobs-queue-runner/index.d.cts +22 -0
- package/lib/server-jobs-queue-runner/index.d.ts +22 -0
- package/lib/server-jobs-queue-runner/index.js +2 -0
- package/lib/server-runtime/index.cjs +1 -1
- package/lib/server-runtime/index.d.cts +11 -17
- package/lib/server-runtime/index.d.ts +11 -17
- package/lib/server-runtime/index.js +1 -1
- package/lib/server-runtime-agentface/index.cjs +2 -0
- package/lib/server-runtime-agentface/index.d.cts +53 -0
- package/lib/server-runtime-agentface/index.d.ts +53 -0
- package/lib/server-runtime-agentface/index.js +2 -0
- package/lib/server-runtime-controlface/index.cjs +2 -0
- package/lib/server-runtime-controlface/index.d.cts +80 -0
- package/lib/server-runtime-controlface/index.d.ts +80 -0
- package/lib/server-runtime-controlface/index.js +2 -0
- package/lib/server-runtime-core/index.cjs +2 -0
- package/lib/server-runtime-core/index.d.cts +376 -0
- package/lib/server-runtime-core/index.d.ts +376 -0
- package/lib/server-runtime-core/index.js +2 -0
- package/lib/server-runtime-watchers/index.cjs +2 -0
- package/lib/server-runtime-watchers/index.d.cts +127 -0
- package/lib/server-runtime-watchers/index.d.ts +127 -0
- package/lib/server-runtime-watchers/index.js +2 -0
- package/lib/server-runtime-webhooks/index.cjs +2 -0
- package/lib/server-runtime-webhooks/index.d.cts +34 -0
- package/lib/server-runtime-webhooks/index.d.ts +34 -0
- package/lib/server-runtime-webhooks/index.js +2 -0
- package/lib/storage-async-interface-BRR4eBjx.d.cts +81 -0
- package/lib/storage-async-interface-DhlOVPSp.d.ts +81 -0
- package/lib/{queue-lane-registry-BPKWWgd4.d.cts → types-BzQY45dH.d.cts} +8 -34
- package/lib/{queue-lane-registry-Be6c0ftj.d.ts → types-CF2xUcZW.d.ts} +8 -34
- package/package.json +46 -2
- package/examples/board-local/demo-shell-localstorage.html +0 -843
- package/lib/board-live-cards-public-async-DKZqbJVU.d.ts +0 -256
- package/lib/board-live-cards-public-async-dMWNbWq6.d.cts +0 -256
- package/lib/chunk-KXWT3CY6.cjs +0 -8
- package/lib/chunk-MLVTJASJ.js +0 -2
- package/lib/chunk-OJLA6NLU.js +0 -8
- package/lib/chunk-R5L5WUKN.js +0 -2
- package/lib/chunk-WOALA3V5.cjs +0 -2
- package/lib/chunk-YEB5QHGE.cjs +0 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkIPLSRN6P_cjs=require('../chunk-IPLSRN6P.cjs');require('../chunk-NKIQRCOM.cjs'),require('../chunk-5XHOHTLZ.cjs');var chunkH5HBXPOI_cjs=require('../chunk-H5HBXPOI.cjs');require('../chunk-PBCDDO4V.cjs'),require('../chunk-OEFTOO47.cjs'),require('../chunk-U2N6MCD5.cjs');var chunkSFVO2LB2_cjs=require('../chunk-SFVO2LB2.cjs');require('../chunk-G4XXRHL2.cjs'),require('../chunk-LODXIALE.cjs'),require('../chunk-IXZG74EW.cjs'),require('../chunk-NMZ6XNLB.cjs'),require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-YMEIPKLW.cjs'),require('../chunk-GNFE24S7.cjs');function P(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function N(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function _(e){let t=new TextEncoder().encode(e);return P(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function K(e){return chunkIPLSRN6P_cjs.a(e).slice(0,16)}function E(){return globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2,10)}`}function c(e){return _(String(e))}function f(){let e=String(Date.now()).padStart(13,"0"),t=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `${e}-${t}`}function O(e){try{return chunkSFVO2LB2_cjs.b(e)}catch{return null}}function T(e,t){let n=O(e);return n?.kind==="firestore"&&n.value?n.value:t}function M(e,t){return e.collection("boards").doc(t)}function d(e,t,n){return M(e,t).collection(n)}function w(e){return {kind:"firestore",value:String(e)}}function g(e){return chunkSFVO2LB2_cjs.a(w(e))}function U(e){return {baseRef:w(`boards/${e}`),cardStoreRef:g(`boards/${e}/cards`),outputsStoreRef:g(`boards/${e}/runtime-out`),scratchStoreRef:g(`boards/${e}/scratch`),archiveStoreRef:g(`boards/${e}/archive`),chatStoreRef:g(`boards/${e}/chat`),artifactsStoreRef:g(`boards/${e}/files`)}}function q(e){return {async read(t){let n=await e.doc(c(t)).get();return n.exists?n.data()?.value??null:null},async write(t,n){await e.doc(c(t)).set({k:t,value:n});},async delete(t){await e.doc(c(t)).delete();},async listKeys(t=""){return (await(t?e.where("k",">=",t).where("k","<",`${t}\uF8FF`).orderBy("k"):e.orderBy("k")).get()).docs.map(i=>i.data()?.k??i.id)}}}function Q(e){return {async append(t){let n=f();return await e.doc(n).set({id:n,createdAt:new Date().toISOString(),payload:t}),{id:n,payload:t}},async readAll(){return (await e.orderBy("id").get()).docs.map(n=>{let r=n.data()??{};return {id:String(r.id??n.id),payload:r.payload}})},async readAfter(t){let i=(await(t?e.where("id",">",t).orderBy("id"):e.orderBy("id")).get()).docs.map(a=>{let s=a.data()??{};return {id:String(s.id??a.id),payload:s.payload}});return {entries:i,newCursor:i.length>0?i[i.length-1].id:t}},async clear(){let t=await e.get();if(typeof e.firestore.batch=="function"){let n=e.firestore.batch();for(let r of t.docs)n.delete(e.doc(r.id));await n.commit();return}await Promise.all(t.docs.map(n=>e.doc(n.id).delete()));}}}function k(e){return {async read(t){let n=await e.doc(c(t)).get();return n.exists?n.data()?.content??null:null},async write(t,n){await e.doc(c(t)).set({k:t,content:n});},async exists(t){return (await e.doc(c(t)).get()).exists},async remove(t){await e.doc(c(t)).delete();},async readBytes(t){let n=await e.doc(c(t)).get();if(!n.exists)return null;let r=n.data()??{};return typeof r.bytesBase64=="string"?N(r.bytesBase64):typeof r.content=="string"?new TextEncoder().encode(r.content):null},async writeBytes(t,n){await e.doc(c(t)).set({k:t,bytesBase64:P(n)});},async listKeys(t=""){return (await(t?e.where("k",">=",t).where("k","<",`${t}\uF8FF`).orderBy("k"):e.orderBy("k")).get()).docs.map(i=>i.data()?.k??i.id)},async stat(t){let n=await e.doc(c(t)).get();if(!n.exists)return null;let r=n.data()??{},i=typeof r.bytesBase64=="string"?Math.floor(r.bytesBase64.length*3/4):typeof r.content=="string"?r.content.length:0;return {key:t,size:i,contentType:String(r.contentType??"application/octet-stream")}}}}function D(e){let t=k(e);return {...t,async getUniqueKey(n="scratch-",r=""){return `${n}${f()}${r}`},async create(n,r="scratch-",i=""){let a=`${r}${f()}${i}`;return await t.write(a,n),a},keyRef(n){return w(`${e.path}/${c(n)}`)},config:{async get(n){let r=await t.read(`__config__/${n}`);if(r==null)return null;try{return JSON.parse(r)}catch{return r}},async set(n,r){await t.write(`__config__/${n}`,JSON.stringify(r));}}}}function C(e,t){let n=M(e,t);return {stream(r){return Q(n.collection(`archive-stream-${r}`))},blob(r){return k(n.collection(`archive-blob-${r}`))},async listStreams(r=""){return typeof n.listCollections!="function"?[]:(await n.listCollections()).map(a=>a.path.split("/").at(-1)??"").filter(a=>a.startsWith(`archive-stream-${r}`)).map(a=>a.slice(15))},async listBlobs(r=""){return typeof n.listCollections!="function"?[]:(await n.listCollections()).map(a=>a.path.split("/").at(-1)??"").filter(a=>a.startsWith(`archive-blob-${r}`)).map(a=>a.slice(13))},config:{async get(r){let i=await n.collection("archive-config").doc("main").get();return i.exists?i.data()?.[r]??null:null},async set(r,i){await n.collection("archive-config").doc("main").set({[r]:i},{merge:true});}}}}function I(e,t={}){let n=t.holderId??E(),r=t.ttlMs??3e4;return {async tryAcquire(){try{await e.firestore.runTransaction(async i=>{let a=await i.get(e),s=new Date().toISOString();if(a.exists){let o=a.data()??{};if(o.held===!0&&typeof o.expiresAt=="string"&&o.expiresAt>s)throw Object.assign(new Error("locked"),{code:"locked"})}i.set(e,{held:!0,holderId:n,acquiredAt:s,expiresAt:new Date(Date.now()+r).toISOString()});});}catch(i){if(i?.code==="locked")return null;throw i}return async()=>{try{await e.firestore.runTransaction(async i=>{let a=await i.get(e);if(!a.exists)return;(a.data()??{}).holderId===n&&i.update(e,{held:!1,holderId:null});});}catch{}}}}}function m(e,t={}){let n=t.defaultVisibilityMs??3e4;return {async enqueue(r){let i=f(),a=new Date().toISOString();return await e.doc(i).set({id:i,body:r,enqueuedAt:a,attempt:0,visibleAfter:a,leaseToken:null,leaseExpiresAt:null,dead:false,deadReason:null}),{id:i,body:r,enqueuedAt:a,attempt:0}},async enqueueIfAbsent(r,i){if((await e.where("dedupKey","==",i).where("dead","==",false).limit(1).get()).docs.length>0)return null;let s=f(),o=new Date().toISOString();return await e.doc(s).set({id:s,body:r,dedupKey:i,enqueuedAt:o,attempt:0,visibleAfter:o,leaseToken:null,leaseExpiresAt:null,dead:false,deadReason:null}),{id:s,body:r,enqueuedAt:o,attempt:0}},async lease(r={}){let i=Math.max(1,Number(r.max??1)),a=Math.max(1,Number(r.visibilityMs??n)),s=new Date().toISOString(),o=await e.where("dead","==",false).where("visibleAfter","<=",s).orderBy("visibleAfter").limit(i*4).get(),l=[];for(let y of o.docs){if(l.length>=i)break;let S=e.doc(y.id);try{let p=null;await e.firestore.runTransaction(async A=>{let F=await A.get(S);if(!F.exists)throw new Error("gone");let u=F.data()??{},h=new Date().toISOString();if(u.dead===!0)throw new Error("dead");if(typeof u.visibleAfter=="string"&&u.visibleAfter>h)throw new Error("hidden");if(u.leaseToken&&typeof u.leaseExpiresAt=="string"&&u.leaseExpiresAt>h)throw new Error("leased");let b=E(),v=new Date(Date.now()+a).toISOString(),R=Number(u.attempt??0)+1;A.update(S,{leaseToken:b,leaseExpiresAt:v,attempt:R}),p={id:String(u.id??y.id),body:u.body,enqueuedAt:String(u.enqueuedAt??h),attempt:R,leaseToken:b,leaseExpiresAt:v};}),p&&l.push(p);}catch{}}return l},async ack(r,i){try{return await e.firestore.runTransaction(async a=>{let s=e.doc(r),o=await a.get(s);if(!o.exists)return;if((o.data()??{}).leaseToken!==i)throw new Error("token mismatch");a.delete(s);}),!0}catch{return false}},async nack(r,i,a={}){try{return await e.firestore.runTransaction(async s=>{let o=e.doc(r),l=await s.get(o);if(!l.exists)return;if((l.data()??{}).leaseToken!==i)throw new Error("token mismatch");a.dead===!0?s.update(o,{dead:!0,deadReason:a.reason??"nacked",leaseToken:null,leaseExpiresAt:null}):s.update(o,{leaseToken:null,leaseExpiresAt:null,visibleAfter:new Date().toISOString()});}),!0}catch{return false}},async peekActive(r=""){return (await e.where("dead","==",false).orderBy("enqueuedAt").get()).docs.map(a=>a.data()??{}).filter(a=>!r||String(a.id??"").startsWith(r)).map(a=>({id:String(a.id??""),body:a.body,enqueuedAt:String(a.enqueuedAt??""),attempt:Number(a.attempt??0)}))},async peekDeadLetter(r=""){return (await e.where("dead","==",true).orderBy("enqueuedAt").get()).docs.map(a=>a.data()??{}).filter(a=>!r||String(a.id??"").startsWith(r)).map(a=>({id:String(a.id??""),body:a.body,enqueuedAt:String(a.enqueuedAt??""),attempt:Number(a.attempt??0),reason:a.deadReason}))}}}function V(e,t,n={}){return chunkH5HBXPOI_cjs.i({boardId:t,kvStorage(r){return q(d(e,t,`kv-${r||"root"}`))},kvStorageForRef(r){return q(e.collection(T(r,`boards/${t}/kv-root`)))},blobStorage(r){return k(d(e,t,`blobs-${r||"root"}`))},scratchStorage(){return D(d(e,t,"scratch"))},scratchStorageForRef(r){return D(e.collection(T(r,`boards/${t}/scratch`)))},archiveFactory(){return C(e,t)},archiveFactoryForRef(r){let i=O(r),a=i?.kind==="firestore-board"?i.value:t;return C(e,a)},journalStorage(){return Q(d(e,t,"journal"))},queueStorage:m(d(e,t,"worker-queue")),chatAgentQueueStorage:m(d(e,t,"chat-queue")),processAccumulatedQueueStorage:m(d(e,t,"process-queue")),lock:I(d(e,t,"locks").doc("board-lock"),{holderId:n.holderId}),hashFn(r){return K(r)},genId(){return f()},requestProcessAccumulated:n.requestProcessAccumulated,publishBoardChangeNotifications:n.publishBoardChangeNotifications,onWarn:r=>console.warn(`[firestore-board-adapter:${t}] ${r}`)})}function z(e,t,n={}){return {refs:{...U(t),...n.refs??{}},boardAdapter:V(e,t,n)}}
|
|
2
|
+
exports.createFirestoreArchiveFactory=C;exports.createFirestoreBlobStorage=k;exports.createFirestoreBoardAdapter=V;exports.createFirestoreBoardRefs=U;exports.createFirestoreBoardRuntimeBundle=z;exports.createFirestoreJournalStorage=Q;exports.createFirestoreKvStorage=q;exports.createFirestoreLock=I;exports.createFirestoreQueueStorage=m;exports.createFirestoreScratchStorage=D;exports.makeFirestoreRef=w;exports.serializeFirestoreRef=g;//# sourceMappingURL=index.cjs.map
|
|
3
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { a as KindValueRef } from '../storage-interface-BFiD3kyB.cjs';
|
|
2
|
+
import { A as AsyncArchiveFactory, a as AsyncBlobStorage, b as AsyncJournalStorage, c as AsyncKVStorage, d as AsyncAtomicRelayLock, e as AsyncQueueStorage, f as AsyncScratchStorage } from '../storage-async-interface-BRR4eBjx.cjs';
|
|
3
|
+
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-DOfEq_HC.cjs';
|
|
4
|
+
import '../board-live-cards-public-DQzPe7A9.cjs';
|
|
5
|
+
import '../execution-refs.cjs';
|
|
6
|
+
import '../types-BBhqYGhE.cjs';
|
|
7
|
+
|
|
8
|
+
interface FirestoreDocumentSnapshotLike {
|
|
9
|
+
readonly exists: boolean;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
data(): Record<string, any> | undefined;
|
|
12
|
+
}
|
|
13
|
+
interface FirestoreQuerySnapshotLike {
|
|
14
|
+
readonly docs: FirestoreDocumentSnapshotLike[];
|
|
15
|
+
readonly empty?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface FirestoreTransactionLike {
|
|
18
|
+
get(ref: FirestoreDocumentLike): Promise<FirestoreDocumentSnapshotLike>;
|
|
19
|
+
set(ref: FirestoreDocumentLike, data: Record<string, any>, options?: Record<string, any>): void;
|
|
20
|
+
update(ref: FirestoreDocumentLike, data: Record<string, any>): void;
|
|
21
|
+
delete(ref: FirestoreDocumentLike): void;
|
|
22
|
+
}
|
|
23
|
+
interface FirestoreQueryLike {
|
|
24
|
+
get(): Promise<FirestoreQuerySnapshotLike>;
|
|
25
|
+
where(field: string, op: string, value: unknown): FirestoreQueryLike;
|
|
26
|
+
orderBy(field: string, direction?: 'asc' | 'desc'): FirestoreQueryLike;
|
|
27
|
+
limit(count: number): FirestoreQueryLike;
|
|
28
|
+
}
|
|
29
|
+
interface FirestoreCollectionLike extends FirestoreQueryLike {
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly firestore: FirestoreLike;
|
|
32
|
+
doc(id?: string): FirestoreDocumentLike;
|
|
33
|
+
}
|
|
34
|
+
interface FirestoreDocumentLike {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly path: string;
|
|
37
|
+
readonly firestore: FirestoreLike;
|
|
38
|
+
get(): Promise<FirestoreDocumentSnapshotLike>;
|
|
39
|
+
set(data: Record<string, any>, options?: Record<string, any>): Promise<void>;
|
|
40
|
+
update(data: Record<string, any>): Promise<void>;
|
|
41
|
+
delete(): Promise<void>;
|
|
42
|
+
collection(name: string): FirestoreCollectionLike;
|
|
43
|
+
listCollections?(): Promise<FirestoreCollectionLike[]>;
|
|
44
|
+
}
|
|
45
|
+
interface FirestoreLike {
|
|
46
|
+
collection(path: string): FirestoreCollectionLike;
|
|
47
|
+
runTransaction<T>(updateFn: (tx: FirestoreTransactionLike) => Promise<T>): Promise<T>;
|
|
48
|
+
batch?(): {
|
|
49
|
+
delete(ref: FirestoreDocumentLike): void;
|
|
50
|
+
commit(): Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface FirestoreBoardRefs {
|
|
54
|
+
baseRef: KindValueRef;
|
|
55
|
+
cardStoreRef: string;
|
|
56
|
+
outputsStoreRef: string;
|
|
57
|
+
scratchStoreRef: string;
|
|
58
|
+
archiveStoreRef: string;
|
|
59
|
+
chatStoreRef: string;
|
|
60
|
+
artifactsStoreRef: string;
|
|
61
|
+
}
|
|
62
|
+
interface FirestoreQueueStorageOptions {
|
|
63
|
+
defaultVisibilityMs?: number;
|
|
64
|
+
}
|
|
65
|
+
interface FirestoreBoardAdapterOptions {
|
|
66
|
+
refs?: Partial<FirestoreBoardRefs>;
|
|
67
|
+
holderId?: string;
|
|
68
|
+
requestProcessAccumulated?: () => void | Promise<void>;
|
|
69
|
+
publishBoardChangeNotifications?: (notifications: unknown[]) => void | Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
declare function makeFirestoreRef(path: string): KindValueRef;
|
|
72
|
+
declare function serializeFirestoreRef(path: string): string;
|
|
73
|
+
declare function createFirestoreBoardRefs(boardId: string): FirestoreBoardRefs;
|
|
74
|
+
declare function createFirestoreKvStorage(col: FirestoreCollectionLike): AsyncKVStorage;
|
|
75
|
+
declare function createFirestoreJournalStorage(col: FirestoreCollectionLike): AsyncJournalStorage;
|
|
76
|
+
declare function createFirestoreBlobStorage(col: FirestoreCollectionLike): AsyncBlobStorage;
|
|
77
|
+
declare function createFirestoreScratchStorage(col: FirestoreCollectionLike): AsyncScratchStorage;
|
|
78
|
+
declare function createFirestoreArchiveFactory(db: FirestoreLike, boardId: string): AsyncArchiveFactory;
|
|
79
|
+
declare function createFirestoreLock(lockDoc: FirestoreDocumentLike, opts?: {
|
|
80
|
+
holderId?: string;
|
|
81
|
+
ttlMs?: number;
|
|
82
|
+
}): AsyncAtomicRelayLock;
|
|
83
|
+
declare function createFirestoreQueueStorage(col: FirestoreCollectionLike, opts?: FirestoreQueueStorageOptions): AsyncQueueStorage;
|
|
84
|
+
declare function createFirestoreBoardAdapter(db: FirestoreLike, boardId: string, options?: FirestoreBoardAdapterOptions): AsyncBoardPlatformAdapter;
|
|
85
|
+
declare function createFirestoreBoardRuntimeBundle(db: FirestoreLike, boardId: string, options?: FirestoreBoardAdapterOptions): {
|
|
86
|
+
refs: {
|
|
87
|
+
baseRef: KindValueRef;
|
|
88
|
+
cardStoreRef: string;
|
|
89
|
+
outputsStoreRef: string;
|
|
90
|
+
scratchStoreRef: string;
|
|
91
|
+
archiveStoreRef: string;
|
|
92
|
+
chatStoreRef: string;
|
|
93
|
+
artifactsStoreRef: string;
|
|
94
|
+
};
|
|
95
|
+
boardAdapter: AsyncBoardPlatformAdapter;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { type FirestoreBoardAdapterOptions, type FirestoreBoardRefs, type FirestoreCollectionLike, type FirestoreDocumentLike, type FirestoreDocumentSnapshotLike, type FirestoreLike, type FirestoreQueryLike, type FirestoreQuerySnapshotLike, type FirestoreQueueStorageOptions, type FirestoreTransactionLike, createFirestoreArchiveFactory, createFirestoreBlobStorage, createFirestoreBoardAdapter, createFirestoreBoardRefs, createFirestoreBoardRuntimeBundle, createFirestoreJournalStorage, createFirestoreKvStorage, createFirestoreLock, createFirestoreQueueStorage, createFirestoreScratchStorage, makeFirestoreRef, serializeFirestoreRef };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { a as KindValueRef } from '../storage-interface-BFiD3kyB.js';
|
|
2
|
+
import { A as AsyncArchiveFactory, a as AsyncBlobStorage, b as AsyncJournalStorage, c as AsyncKVStorage, d as AsyncAtomicRelayLock, e as AsyncQueueStorage, f as AsyncScratchStorage } from '../storage-async-interface-DhlOVPSp.js';
|
|
3
|
+
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-JZPCzZnH.js';
|
|
4
|
+
import '../board-live-cards-public-D-DJek3X.js';
|
|
5
|
+
import '../execution-refs.js';
|
|
6
|
+
import '../types-BBhqYGhE.js';
|
|
7
|
+
|
|
8
|
+
interface FirestoreDocumentSnapshotLike {
|
|
9
|
+
readonly exists: boolean;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
data(): Record<string, any> | undefined;
|
|
12
|
+
}
|
|
13
|
+
interface FirestoreQuerySnapshotLike {
|
|
14
|
+
readonly docs: FirestoreDocumentSnapshotLike[];
|
|
15
|
+
readonly empty?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface FirestoreTransactionLike {
|
|
18
|
+
get(ref: FirestoreDocumentLike): Promise<FirestoreDocumentSnapshotLike>;
|
|
19
|
+
set(ref: FirestoreDocumentLike, data: Record<string, any>, options?: Record<string, any>): void;
|
|
20
|
+
update(ref: FirestoreDocumentLike, data: Record<string, any>): void;
|
|
21
|
+
delete(ref: FirestoreDocumentLike): void;
|
|
22
|
+
}
|
|
23
|
+
interface FirestoreQueryLike {
|
|
24
|
+
get(): Promise<FirestoreQuerySnapshotLike>;
|
|
25
|
+
where(field: string, op: string, value: unknown): FirestoreQueryLike;
|
|
26
|
+
orderBy(field: string, direction?: 'asc' | 'desc'): FirestoreQueryLike;
|
|
27
|
+
limit(count: number): FirestoreQueryLike;
|
|
28
|
+
}
|
|
29
|
+
interface FirestoreCollectionLike extends FirestoreQueryLike {
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly firestore: FirestoreLike;
|
|
32
|
+
doc(id?: string): FirestoreDocumentLike;
|
|
33
|
+
}
|
|
34
|
+
interface FirestoreDocumentLike {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly path: string;
|
|
37
|
+
readonly firestore: FirestoreLike;
|
|
38
|
+
get(): Promise<FirestoreDocumentSnapshotLike>;
|
|
39
|
+
set(data: Record<string, any>, options?: Record<string, any>): Promise<void>;
|
|
40
|
+
update(data: Record<string, any>): Promise<void>;
|
|
41
|
+
delete(): Promise<void>;
|
|
42
|
+
collection(name: string): FirestoreCollectionLike;
|
|
43
|
+
listCollections?(): Promise<FirestoreCollectionLike[]>;
|
|
44
|
+
}
|
|
45
|
+
interface FirestoreLike {
|
|
46
|
+
collection(path: string): FirestoreCollectionLike;
|
|
47
|
+
runTransaction<T>(updateFn: (tx: FirestoreTransactionLike) => Promise<T>): Promise<T>;
|
|
48
|
+
batch?(): {
|
|
49
|
+
delete(ref: FirestoreDocumentLike): void;
|
|
50
|
+
commit(): Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface FirestoreBoardRefs {
|
|
54
|
+
baseRef: KindValueRef;
|
|
55
|
+
cardStoreRef: string;
|
|
56
|
+
outputsStoreRef: string;
|
|
57
|
+
scratchStoreRef: string;
|
|
58
|
+
archiveStoreRef: string;
|
|
59
|
+
chatStoreRef: string;
|
|
60
|
+
artifactsStoreRef: string;
|
|
61
|
+
}
|
|
62
|
+
interface FirestoreQueueStorageOptions {
|
|
63
|
+
defaultVisibilityMs?: number;
|
|
64
|
+
}
|
|
65
|
+
interface FirestoreBoardAdapterOptions {
|
|
66
|
+
refs?: Partial<FirestoreBoardRefs>;
|
|
67
|
+
holderId?: string;
|
|
68
|
+
requestProcessAccumulated?: () => void | Promise<void>;
|
|
69
|
+
publishBoardChangeNotifications?: (notifications: unknown[]) => void | Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
declare function makeFirestoreRef(path: string): KindValueRef;
|
|
72
|
+
declare function serializeFirestoreRef(path: string): string;
|
|
73
|
+
declare function createFirestoreBoardRefs(boardId: string): FirestoreBoardRefs;
|
|
74
|
+
declare function createFirestoreKvStorage(col: FirestoreCollectionLike): AsyncKVStorage;
|
|
75
|
+
declare function createFirestoreJournalStorage(col: FirestoreCollectionLike): AsyncJournalStorage;
|
|
76
|
+
declare function createFirestoreBlobStorage(col: FirestoreCollectionLike): AsyncBlobStorage;
|
|
77
|
+
declare function createFirestoreScratchStorage(col: FirestoreCollectionLike): AsyncScratchStorage;
|
|
78
|
+
declare function createFirestoreArchiveFactory(db: FirestoreLike, boardId: string): AsyncArchiveFactory;
|
|
79
|
+
declare function createFirestoreLock(lockDoc: FirestoreDocumentLike, opts?: {
|
|
80
|
+
holderId?: string;
|
|
81
|
+
ttlMs?: number;
|
|
82
|
+
}): AsyncAtomicRelayLock;
|
|
83
|
+
declare function createFirestoreQueueStorage(col: FirestoreCollectionLike, opts?: FirestoreQueueStorageOptions): AsyncQueueStorage;
|
|
84
|
+
declare function createFirestoreBoardAdapter(db: FirestoreLike, boardId: string, options?: FirestoreBoardAdapterOptions): AsyncBoardPlatformAdapter;
|
|
85
|
+
declare function createFirestoreBoardRuntimeBundle(db: FirestoreLike, boardId: string, options?: FirestoreBoardAdapterOptions): {
|
|
86
|
+
refs: {
|
|
87
|
+
baseRef: KindValueRef;
|
|
88
|
+
cardStoreRef: string;
|
|
89
|
+
outputsStoreRef: string;
|
|
90
|
+
scratchStoreRef: string;
|
|
91
|
+
archiveStoreRef: string;
|
|
92
|
+
chatStoreRef: string;
|
|
93
|
+
artifactsStoreRef: string;
|
|
94
|
+
};
|
|
95
|
+
boardAdapter: AsyncBoardPlatformAdapter;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { type FirestoreBoardAdapterOptions, type FirestoreBoardRefs, type FirestoreCollectionLike, type FirestoreDocumentLike, type FirestoreDocumentSnapshotLike, type FirestoreLike, type FirestoreQueryLike, type FirestoreQuerySnapshotLike, type FirestoreQueueStorageOptions, type FirestoreTransactionLike, createFirestoreArchiveFactory, createFirestoreBlobStorage, createFirestoreBoardAdapter, createFirestoreBoardRefs, createFirestoreBoardRuntimeBundle, createFirestoreJournalStorage, createFirestoreKvStorage, createFirestoreLock, createFirestoreQueueStorage, createFirestoreScratchStorage, makeFirestoreRef, serializeFirestoreRef };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {a as a$1}from'../chunk-TSN3RTXT.js';import'../chunk-EGRHWZRV.js';import'../chunk-S44QZUDX.js';import {i}from'../chunk-VMW4Z6EF.js';import'../chunk-HEEDJEKM.js';import'../chunk-N6P2JW4W.js';import'../chunk-XQRNDX4Q.js';import {a,b}from'../chunk-BQS3EIEK.js';import'../chunk-VGT3TRQG.js';import'../chunk-WDPOGXTY.js';import'../chunk-JMDHDY6M.js';import'../chunk-VLBB3D6B.js';import'../chunk-MNEOJWPS.js';import'../chunk-KBELAKIY.js';import'../chunk-FW4363Y4.js';function P(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function N(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function _(e){let t=new TextEncoder().encode(e);return P(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function K(e){return a$1(e).slice(0,16)}function E(){return globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2,10)}`}function c(e){return _(String(e))}function f(){let e=String(Date.now()).padStart(13,"0"),t=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `${e}-${t}`}function O(e){try{return b(e)}catch{return null}}function T(e,t){let n=O(e);return n?.kind==="firestore"&&n.value?n.value:t}function M(e,t){return e.collection("boards").doc(t)}function d(e,t,n){return M(e,t).collection(n)}function w(e){return {kind:"firestore",value:String(e)}}function g(e){return a(w(e))}function U(e){return {baseRef:w(`boards/${e}`),cardStoreRef:g(`boards/${e}/cards`),outputsStoreRef:g(`boards/${e}/runtime-out`),scratchStoreRef:g(`boards/${e}/scratch`),archiveStoreRef:g(`boards/${e}/archive`),chatStoreRef:g(`boards/${e}/chat`),artifactsStoreRef:g(`boards/${e}/files`)}}function q(e){return {async read(t){let n=await e.doc(c(t)).get();return n.exists?n.data()?.value??null:null},async write(t,n){await e.doc(c(t)).set({k:t,value:n});},async delete(t){await e.doc(c(t)).delete();},async listKeys(t=""){return (await(t?e.where("k",">=",t).where("k","<",`${t}\uF8FF`).orderBy("k"):e.orderBy("k")).get()).docs.map(i=>i.data()?.k??i.id)}}}function Q(e){return {async append(t){let n=f();return await e.doc(n).set({id:n,createdAt:new Date().toISOString(),payload:t}),{id:n,payload:t}},async readAll(){return (await e.orderBy("id").get()).docs.map(n=>{let r=n.data()??{};return {id:String(r.id??n.id),payload:r.payload}})},async readAfter(t){let i=(await(t?e.where("id",">",t).orderBy("id"):e.orderBy("id")).get()).docs.map(a=>{let s=a.data()??{};return {id:String(s.id??a.id),payload:s.payload}});return {entries:i,newCursor:i.length>0?i[i.length-1].id:t}},async clear(){let t=await e.get();if(typeof e.firestore.batch=="function"){let n=e.firestore.batch();for(let r of t.docs)n.delete(e.doc(r.id));await n.commit();return}await Promise.all(t.docs.map(n=>e.doc(n.id).delete()));}}}function k(e){return {async read(t){let n=await e.doc(c(t)).get();return n.exists?n.data()?.content??null:null},async write(t,n){await e.doc(c(t)).set({k:t,content:n});},async exists(t){return (await e.doc(c(t)).get()).exists},async remove(t){await e.doc(c(t)).delete();},async readBytes(t){let n=await e.doc(c(t)).get();if(!n.exists)return null;let r=n.data()??{};return typeof r.bytesBase64=="string"?N(r.bytesBase64):typeof r.content=="string"?new TextEncoder().encode(r.content):null},async writeBytes(t,n){await e.doc(c(t)).set({k:t,bytesBase64:P(n)});},async listKeys(t=""){return (await(t?e.where("k",">=",t).where("k","<",`${t}\uF8FF`).orderBy("k"):e.orderBy("k")).get()).docs.map(i=>i.data()?.k??i.id)},async stat(t){let n=await e.doc(c(t)).get();if(!n.exists)return null;let r=n.data()??{},i=typeof r.bytesBase64=="string"?Math.floor(r.bytesBase64.length*3/4):typeof r.content=="string"?r.content.length:0;return {key:t,size:i,contentType:String(r.contentType??"application/octet-stream")}}}}function D(e){let t=k(e);return {...t,async getUniqueKey(n="scratch-",r=""){return `${n}${f()}${r}`},async create(n,r="scratch-",i=""){let a=`${r}${f()}${i}`;return await t.write(a,n),a},keyRef(n){return w(`${e.path}/${c(n)}`)},config:{async get(n){let r=await t.read(`__config__/${n}`);if(r==null)return null;try{return JSON.parse(r)}catch{return r}},async set(n,r){await t.write(`__config__/${n}`,JSON.stringify(r));}}}}function C(e,t){let n=M(e,t);return {stream(r){return Q(n.collection(`archive-stream-${r}`))},blob(r){return k(n.collection(`archive-blob-${r}`))},async listStreams(r=""){return typeof n.listCollections!="function"?[]:(await n.listCollections()).map(a=>a.path.split("/").at(-1)??"").filter(a=>a.startsWith(`archive-stream-${r}`)).map(a=>a.slice(15))},async listBlobs(r=""){return typeof n.listCollections!="function"?[]:(await n.listCollections()).map(a=>a.path.split("/").at(-1)??"").filter(a=>a.startsWith(`archive-blob-${r}`)).map(a=>a.slice(13))},config:{async get(r){let i=await n.collection("archive-config").doc("main").get();return i.exists?i.data()?.[r]??null:null},async set(r,i){await n.collection("archive-config").doc("main").set({[r]:i},{merge:true});}}}}function I(e,t={}){let n=t.holderId??E(),r=t.ttlMs??3e4;return {async tryAcquire(){try{await e.firestore.runTransaction(async i=>{let a=await i.get(e),s=new Date().toISOString();if(a.exists){let o=a.data()??{};if(o.held===!0&&typeof o.expiresAt=="string"&&o.expiresAt>s)throw Object.assign(new Error("locked"),{code:"locked"})}i.set(e,{held:!0,holderId:n,acquiredAt:s,expiresAt:new Date(Date.now()+r).toISOString()});});}catch(i){if(i?.code==="locked")return null;throw i}return async()=>{try{await e.firestore.runTransaction(async i=>{let a=await i.get(e);if(!a.exists)return;(a.data()??{}).holderId===n&&i.update(e,{held:!1,holderId:null});});}catch{}}}}}function m(e,t={}){let n=t.defaultVisibilityMs??3e4;return {async enqueue(r){let i=f(),a=new Date().toISOString();return await e.doc(i).set({id:i,body:r,enqueuedAt:a,attempt:0,visibleAfter:a,leaseToken:null,leaseExpiresAt:null,dead:false,deadReason:null}),{id:i,body:r,enqueuedAt:a,attempt:0}},async enqueueIfAbsent(r,i){if((await e.where("dedupKey","==",i).where("dead","==",false).limit(1).get()).docs.length>0)return null;let s=f(),o=new Date().toISOString();return await e.doc(s).set({id:s,body:r,dedupKey:i,enqueuedAt:o,attempt:0,visibleAfter:o,leaseToken:null,leaseExpiresAt:null,dead:false,deadReason:null}),{id:s,body:r,enqueuedAt:o,attempt:0}},async lease(r={}){let i=Math.max(1,Number(r.max??1)),a=Math.max(1,Number(r.visibilityMs??n)),s=new Date().toISOString(),o=await e.where("dead","==",false).where("visibleAfter","<=",s).orderBy("visibleAfter").limit(i*4).get(),l=[];for(let y of o.docs){if(l.length>=i)break;let S=e.doc(y.id);try{let p=null;await e.firestore.runTransaction(async A=>{let F=await A.get(S);if(!F.exists)throw new Error("gone");let u=F.data()??{},h=new Date().toISOString();if(u.dead===!0)throw new Error("dead");if(typeof u.visibleAfter=="string"&&u.visibleAfter>h)throw new Error("hidden");if(u.leaseToken&&typeof u.leaseExpiresAt=="string"&&u.leaseExpiresAt>h)throw new Error("leased");let b=E(),v=new Date(Date.now()+a).toISOString(),R=Number(u.attempt??0)+1;A.update(S,{leaseToken:b,leaseExpiresAt:v,attempt:R}),p={id:String(u.id??y.id),body:u.body,enqueuedAt:String(u.enqueuedAt??h),attempt:R,leaseToken:b,leaseExpiresAt:v};}),p&&l.push(p);}catch{}}return l},async ack(r,i){try{return await e.firestore.runTransaction(async a=>{let s=e.doc(r),o=await a.get(s);if(!o.exists)return;if((o.data()??{}).leaseToken!==i)throw new Error("token mismatch");a.delete(s);}),!0}catch{return false}},async nack(r,i,a={}){try{return await e.firestore.runTransaction(async s=>{let o=e.doc(r),l=await s.get(o);if(!l.exists)return;if((l.data()??{}).leaseToken!==i)throw new Error("token mismatch");a.dead===!0?s.update(o,{dead:!0,deadReason:a.reason??"nacked",leaseToken:null,leaseExpiresAt:null}):s.update(o,{leaseToken:null,leaseExpiresAt:null,visibleAfter:new Date().toISOString()});}),!0}catch{return false}},async peekActive(r=""){return (await e.where("dead","==",false).orderBy("enqueuedAt").get()).docs.map(a=>a.data()??{}).filter(a=>!r||String(a.id??"").startsWith(r)).map(a=>({id:String(a.id??""),body:a.body,enqueuedAt:String(a.enqueuedAt??""),attempt:Number(a.attempt??0)}))},async peekDeadLetter(r=""){return (await e.where("dead","==",true).orderBy("enqueuedAt").get()).docs.map(a=>a.data()??{}).filter(a=>!r||String(a.id??"").startsWith(r)).map(a=>({id:String(a.id??""),body:a.body,enqueuedAt:String(a.enqueuedAt??""),attempt:Number(a.attempt??0),reason:a.deadReason}))}}}function V(e,t,n={}){return i({boardId:t,kvStorage(r){return q(d(e,t,`kv-${r||"root"}`))},kvStorageForRef(r){return q(e.collection(T(r,`boards/${t}/kv-root`)))},blobStorage(r){return k(d(e,t,`blobs-${r||"root"}`))},scratchStorage(){return D(d(e,t,"scratch"))},scratchStorageForRef(r){return D(e.collection(T(r,`boards/${t}/scratch`)))},archiveFactory(){return C(e,t)},archiveFactoryForRef(r){let i=O(r),a=i?.kind==="firestore-board"?i.value:t;return C(e,a)},journalStorage(){return Q(d(e,t,"journal"))},queueStorage:m(d(e,t,"worker-queue")),chatAgentQueueStorage:m(d(e,t,"chat-queue")),processAccumulatedQueueStorage:m(d(e,t,"process-queue")),lock:I(d(e,t,"locks").doc("board-lock"),{holderId:n.holderId}),hashFn(r){return K(r)},genId(){return f()},requestProcessAccumulated:n.requestProcessAccumulated,publishBoardChangeNotifications:n.publishBoardChangeNotifications,onWarn:r=>console.warn(`[firestore-board-adapter:${t}] ${r}`)})}function z(e,t,n={}){return {refs:{...U(t),...n.refs??{}},boardAdapter:V(e,t,n)}}
|
|
2
|
+
export{C as createFirestoreArchiveFactory,k as createFirestoreBlobStorage,V as createFirestoreBoardAdapter,U as createFirestoreBoardRefs,z as createFirestoreBoardRuntimeBundle,Q as createFirestoreJournalStorage,q as createFirestoreKvStorage,I as createFirestoreLock,m as createFirestoreQueueStorage,D as createFirestoreScratchStorage,w as makeFirestoreRef,g as serializeFirestoreRef};//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkIPLSRN6P_cjs=require('../chunk-IPLSRN6P.cjs');require('../chunk-NKIQRCOM.cjs'),require('../chunk-5XHOHTLZ.cjs');var chunkH5HBXPOI_cjs=require('../chunk-H5HBXPOI.cjs');require('../chunk-PBCDDO4V.cjs'),require('../chunk-OEFTOO47.cjs'),require('../chunk-U2N6MCD5.cjs');var chunkSFVO2LB2_cjs=require('../chunk-SFVO2LB2.cjs');require('../chunk-G4XXRHL2.cjs'),require('../chunk-LODXIALE.cjs'),require('../chunk-IXZG74EW.cjs'),require('../chunk-NMZ6XNLB.cjs'),require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-YMEIPKLW.cjs'),require('../chunk-GNFE24S7.cjs');function E(){let n=false;return {async tryAcquire(){return n?null:(n=true,()=>{n=false;})}}}function y(){let n=new Map,r=new Map;return {async enqueue(e){let t={id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,body:e,enqueuedAt:new Date().toISOString(),attempt:0};return n.set(t.id,t),t},async enqueueIfAbsent(e,t){for(let i of n.values())if(i.dedupKey===t)return null;let a={id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,body:e,enqueuedAt:new Date().toISOString(),attempt:0,dedupKey:t};return n.set(a.id,a),a},async lease(e){let t=Math.max(1,Math.floor(e?.max??1)),a=Math.max(1,Math.floor(e?.visibilityMs??6e4)),i=Date.now();for(let o of n.values())o.leaseExpiresAt&&Date.parse(o.leaseExpiresAt)<=i&&(delete o.leaseToken,delete o.leaseExpiresAt);let s=[];for(let o of n.values()){if(s.length>=t)break;o.leaseToken||(o.attempt+=1,o.leaseToken=globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,o.leaseExpiresAt=new Date(Date.now()+a).toISOString(),s.push({id:o.id,body:o.body,enqueuedAt:o.enqueuedAt,attempt:o.attempt,leaseToken:o.leaseToken,leaseExpiresAt:o.leaseExpiresAt}));}return s},async ack(e,t){let a=n.get(e);return !a||a.leaseToken!==t?false:(n.delete(e),true)},async nack(e,t,a){let i=n.get(e);return !i||i.leaseToken!==t?false:(delete i.leaseToken,delete i.leaseExpiresAt,a?.dead&&(n.delete(e),r.set(e,{...i,reason:a.reason})),true)},async peekActive(e=""){return Array.from(n.values()).filter(t=>!t.leaseToken).filter(t=>!e||t.id.startsWith(e)).map(t=>({id:t.id,body:t.body,enqueuedAt:t.enqueuedAt,attempt:t.attempt}))},async peekDeadLetter(e=""){return Array.from(r.values()).filter(t=>!e||t.id.startsWith(e)).map(t=>({id:t.id,body:t.body,enqueuedAt:t.enqueuedAt,attempt:t.attempt,reason:t.reason}))}}}function B(n){let r=chunkIPLSRN6P_cjs.e(n);return {async read(e){return r.read(e)},async write(e,t){r.write(e,t);},async delete(e){r.delete(e);},async listKeys(e){return r.listKeys(e)}}}function L(n){let r=chunkIPLSRN6P_cjs.b(n);return {async read(e){return r.read(e)},async write(e,t){r.write(e,t);},async exists(e){return r.exists(e)},async remove(e){r.remove(e);},async readBytes(e){return r.readBytes?.(e)??null},async writeBytes(e,t){await r.writeBytes?.(e,t);},async listKeys(e){return r.listKeys(e)},async stat(e){return r.stat?.(e)??null}}}function k(n){let r=chunkIPLSRN6P_cjs.c(n);return {async read(e){return r.read(e)},async write(e,t){r.write(e,t);},async exists(e){return r.exists(e)},async remove(e){r.remove(e);},async readBytes(e){return r.readBytes?.(e)??null},async writeBytes(e,t){await r.writeBytes?.(e,t);},async listKeys(e){return r.listKeys(e)},async stat(e){return r.stat?.(e)??null},async getUniqueKey(e,t){return r.getUniqueKey(e,t)},async create(e,t,a){return r.create(e,t,a)},keyRef(e){return r.keyRef(e)},config:{async get(e){return r.config.get(e)},async set(e,t){r.config.set(e,t);}}}}function K(n){let r=chunkIPLSRN6P_cjs.f(n);function e(t){return {id:t.id,payload:t.event}}return {async append(t){let a={id:r.generateId(),event:t};return r.appendEntry(a),e(a)},async readAll(){return r.readAllEntries().map(e)},async readAfter(t){let a=r.readAllEntries().map(e);if(!t)return {entries:a,newCursor:a.length>0?a[a.length-1].id:null};let i=a.findIndex(o=>o.id===t),s=i===-1?a:a.slice(i+1);return {entries:s,newCursor:s.length>0?s[s.length-1].id:t}}}}function x(n){let r=chunkIPLSRN6P_cjs.d(n);return {stream(e){let t=r.stream(e);return {async append(a){return t.append(a)},async readAll(){return t.readAll()},async readAfter(a){return t.readAfter(a)},async clear(){t.clear?.();}}},blob(e){let t=r.blob(e);return {async read(a){return t.read(a)},async write(a,i){t.write(a,i);},async exists(a){return t.exists(a)},async remove(a){t.remove(a);},async readBytes(a){return t.readBytes?.(a)??null},async writeBytes(a,i){await t.writeBytes?.(a,i);},async listKeys(a){return t.listKeys(a)},async stat(a){return t.stat?.(a)??null}}},async listStreams(e){return r.listStreams(e)},async listBlobs(e){return r.listBlobs(e)},config:{async get(e){return r.config.get(e)},async set(e,t){r.config.set(e,t);}}}}function $(n){return String(n||"").trim()}function T(n){return {kind:"local-storage",value:$(n)}}function c(n){return chunkSFVO2LB2_cjs.a(T(n))}function q(n){let r=`boards:${n}`;return {baseRef:T(r),cardStoreRef:c(`${r}:cards`),outputsStoreRef:c(`${r}:runtime-out`),scratchStoreRef:c(`${r}:scratch`),archiveStoreRef:c(`${r}:archive`),chatStoreRef:c(`${r}:chat`),artifactsStoreRef:c(`${r}:files`)}}function g(n,r){try{let e=chunkSFVO2LB2_cjs.b(n);if(e?.kind==="local-storage"&&e.value)return $(e.value)}catch{}return r}function D(n,r={}){let e=q(n),t=y(),a=y(),i=y();return chunkH5HBXPOI_cjs.i({boardId:n,kvStorage(s){return B(`${e.baseRef.value}:${s||"root"}`)},kvStorageForRef(s){return B(g(s,`${e.baseRef.value}:root`))},blobStorage(s){return L(s?`${e.baseRef.value}:${s}`:e.baseRef.value)},scratchStorage(){return k(`${e.baseRef.value}:scratch`)},scratchStorageForRef(s){return k(g(s,`${e.baseRef.value}:scratch`))},archiveFactory(){return x(`${e.baseRef.value}:archive`)},archiveFactoryForRef(s){return x(g(s,`${e.baseRef.value}:archive`))},journalStorage(){return K(`${e.baseRef.value}:journal`)},queueStorage:t,chatAgentQueueStorage:a,processAccumulatedQueueStorage:i,lock:E(),resolveBlob:async s=>{let o=s?.kind==="local-storage"?s:null;if(!o?.value)throw new Error(`Unsupported localStorage ref: ${chunkSFVO2LB2_cjs.a(s)}`);let f=chunkIPLSRN6P_cjs.b(o.value),l=await Promise.resolve(f.read(""));if(l===null)throw new Error(`Blob not found: ${chunkSFVO2LB2_cjs.a(s)}`);try{let p=JSON.parse(l);if(p?.__kind==="bytes-b64"&&typeof p.data=="string"){let S=await Promise.resolve(f.readBytes?.(""));if(S)return new TextDecoder().decode(S)}}catch{}return l},hashFn:chunkIPLSRN6P_cjs.a,genId:()=>(globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`).replace(/-/g,""),requestProcessAccumulated:r.requestProcessAccumulated,publishBoardChangeNotifications:r.publishBoardChangeNotifications,onWarn:s=>console.warn(`[localstorage-board-adapter:${n}] ${s}`)})}function U(n,r={}){return {refs:{...q(n),...r.refs??{}},boardAdapter:D(n,r)}}exports.createLocalStorageBoardAdapter=D;exports.createLocalStorageBoardRefs=q;exports.createLocalStorageBoardRuntimeBundle=U;exports.makeLocalStorageRef=T;exports.serializeLocalStorageRef=c;//# sourceMappingURL=index.cjs.map
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { a as KindValueRef } from '../storage-interface-BFiD3kyB.cjs';
|
|
2
|
+
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-DOfEq_HC.cjs';
|
|
3
|
+
import '../board-live-cards-public-DQzPe7A9.cjs';
|
|
4
|
+
import '../execution-refs.cjs';
|
|
5
|
+
import '../types-BBhqYGhE.cjs';
|
|
6
|
+
import '../storage-async-interface-BRR4eBjx.cjs';
|
|
7
|
+
|
|
8
|
+
interface LocalStorageBoardRefs {
|
|
9
|
+
baseRef: KindValueRef;
|
|
10
|
+
cardStoreRef: string;
|
|
11
|
+
outputsStoreRef: string;
|
|
12
|
+
scratchStoreRef: string;
|
|
13
|
+
archiveStoreRef: string;
|
|
14
|
+
chatStoreRef: string;
|
|
15
|
+
artifactsStoreRef: string;
|
|
16
|
+
}
|
|
17
|
+
interface LocalStorageBoardAdapterOptions {
|
|
18
|
+
refs?: Partial<LocalStorageBoardRefs>;
|
|
19
|
+
requestProcessAccumulated?: () => void | Promise<void>;
|
|
20
|
+
publishBoardChangeNotifications?: (notifications: unknown[]) => void | Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
declare function makeLocalStorageRef(path: string): KindValueRef;
|
|
23
|
+
declare function serializeLocalStorageRef(path: string): string;
|
|
24
|
+
declare function createLocalStorageBoardRefs(boardId: string): LocalStorageBoardRefs;
|
|
25
|
+
declare function createLocalStorageBoardAdapter(boardId: string, options?: LocalStorageBoardAdapterOptions): AsyncBoardPlatformAdapter;
|
|
26
|
+
declare function createLocalStorageBoardRuntimeBundle(boardId: string, options?: LocalStorageBoardAdapterOptions): {
|
|
27
|
+
refs: {
|
|
28
|
+
baseRef: KindValueRef;
|
|
29
|
+
cardStoreRef: string;
|
|
30
|
+
outputsStoreRef: string;
|
|
31
|
+
scratchStoreRef: string;
|
|
32
|
+
archiveStoreRef: string;
|
|
33
|
+
chatStoreRef: string;
|
|
34
|
+
artifactsStoreRef: string;
|
|
35
|
+
};
|
|
36
|
+
boardAdapter: AsyncBoardPlatformAdapter;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { type LocalStorageBoardAdapterOptions, type LocalStorageBoardRefs, createLocalStorageBoardAdapter, createLocalStorageBoardRefs, createLocalStorageBoardRuntimeBundle, makeLocalStorageRef, serializeLocalStorageRef };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { a as KindValueRef } from '../storage-interface-BFiD3kyB.js';
|
|
2
|
+
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-JZPCzZnH.js';
|
|
3
|
+
import '../board-live-cards-public-D-DJek3X.js';
|
|
4
|
+
import '../execution-refs.js';
|
|
5
|
+
import '../types-BBhqYGhE.js';
|
|
6
|
+
import '../storage-async-interface-DhlOVPSp.js';
|
|
7
|
+
|
|
8
|
+
interface LocalStorageBoardRefs {
|
|
9
|
+
baseRef: KindValueRef;
|
|
10
|
+
cardStoreRef: string;
|
|
11
|
+
outputsStoreRef: string;
|
|
12
|
+
scratchStoreRef: string;
|
|
13
|
+
archiveStoreRef: string;
|
|
14
|
+
chatStoreRef: string;
|
|
15
|
+
artifactsStoreRef: string;
|
|
16
|
+
}
|
|
17
|
+
interface LocalStorageBoardAdapterOptions {
|
|
18
|
+
refs?: Partial<LocalStorageBoardRefs>;
|
|
19
|
+
requestProcessAccumulated?: () => void | Promise<void>;
|
|
20
|
+
publishBoardChangeNotifications?: (notifications: unknown[]) => void | Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
declare function makeLocalStorageRef(path: string): KindValueRef;
|
|
23
|
+
declare function serializeLocalStorageRef(path: string): string;
|
|
24
|
+
declare function createLocalStorageBoardRefs(boardId: string): LocalStorageBoardRefs;
|
|
25
|
+
declare function createLocalStorageBoardAdapter(boardId: string, options?: LocalStorageBoardAdapterOptions): AsyncBoardPlatformAdapter;
|
|
26
|
+
declare function createLocalStorageBoardRuntimeBundle(boardId: string, options?: LocalStorageBoardAdapterOptions): {
|
|
27
|
+
refs: {
|
|
28
|
+
baseRef: KindValueRef;
|
|
29
|
+
cardStoreRef: string;
|
|
30
|
+
outputsStoreRef: string;
|
|
31
|
+
scratchStoreRef: string;
|
|
32
|
+
archiveStoreRef: string;
|
|
33
|
+
chatStoreRef: string;
|
|
34
|
+
artifactsStoreRef: string;
|
|
35
|
+
};
|
|
36
|
+
boardAdapter: AsyncBoardPlatformAdapter;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { type LocalStorageBoardAdapterOptions, type LocalStorageBoardRefs, createLocalStorageBoardAdapter, createLocalStorageBoardRefs, createLocalStorageBoardRuntimeBundle, makeLocalStorageRef, serializeLocalStorageRef };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1,b,f,d,c as c$1,e}from'../chunk-TSN3RTXT.js';import'../chunk-EGRHWZRV.js';import'../chunk-S44QZUDX.js';import {i}from'../chunk-VMW4Z6EF.js';import'../chunk-HEEDJEKM.js';import'../chunk-N6P2JW4W.js';import'../chunk-XQRNDX4Q.js';import {a,b as b$1}from'../chunk-BQS3EIEK.js';import'../chunk-VGT3TRQG.js';import'../chunk-WDPOGXTY.js';import'../chunk-JMDHDY6M.js';import'../chunk-VLBB3D6B.js';import'../chunk-MNEOJWPS.js';import'../chunk-KBELAKIY.js';import'../chunk-FW4363Y4.js';function E(){let n=false;return {async tryAcquire(){return n?null:(n=true,()=>{n=false;})}}}function y(){let n=new Map,r=new Map;return {async enqueue(e){let t={id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,body:e,enqueuedAt:new Date().toISOString(),attempt:0};return n.set(t.id,t),t},async enqueueIfAbsent(e,t){for(let i of n.values())if(i.dedupKey===t)return null;let a={id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,body:e,enqueuedAt:new Date().toISOString(),attempt:0,dedupKey:t};return n.set(a.id,a),a},async lease(e){let t=Math.max(1,Math.floor(e?.max??1)),a=Math.max(1,Math.floor(e?.visibilityMs??6e4)),i=Date.now();for(let o of n.values())o.leaseExpiresAt&&Date.parse(o.leaseExpiresAt)<=i&&(delete o.leaseToken,delete o.leaseExpiresAt);let s=[];for(let o of n.values()){if(s.length>=t)break;o.leaseToken||(o.attempt+=1,o.leaseToken=globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,o.leaseExpiresAt=new Date(Date.now()+a).toISOString(),s.push({id:o.id,body:o.body,enqueuedAt:o.enqueuedAt,attempt:o.attempt,leaseToken:o.leaseToken,leaseExpiresAt:o.leaseExpiresAt}));}return s},async ack(e,t){let a=n.get(e);return !a||a.leaseToken!==t?false:(n.delete(e),true)},async nack(e,t,a){let i=n.get(e);return !i||i.leaseToken!==t?false:(delete i.leaseToken,delete i.leaseExpiresAt,a?.dead&&(n.delete(e),r.set(e,{...i,reason:a.reason})),true)},async peekActive(e=""){return Array.from(n.values()).filter(t=>!t.leaseToken).filter(t=>!e||t.id.startsWith(e)).map(t=>({id:t.id,body:t.body,enqueuedAt:t.enqueuedAt,attempt:t.attempt}))},async peekDeadLetter(e=""){return Array.from(r.values()).filter(t=>!e||t.id.startsWith(e)).map(t=>({id:t.id,body:t.body,enqueuedAt:t.enqueuedAt,attempt:t.attempt,reason:t.reason}))}}}function B(n){let r=e(n);return {async read(e){return r.read(e)},async write(e,t){r.write(e,t);},async delete(e){r.delete(e);},async listKeys(e){return r.listKeys(e)}}}function L(n){let r=b(n);return {async read(e){return r.read(e)},async write(e,t){r.write(e,t);},async exists(e){return r.exists(e)},async remove(e){r.remove(e);},async readBytes(e){return r.readBytes?.(e)??null},async writeBytes(e,t){await r.writeBytes?.(e,t);},async listKeys(e){return r.listKeys(e)},async stat(e){return r.stat?.(e)??null}}}function k(n){let r=c$1(n);return {async read(e){return r.read(e)},async write(e,t){r.write(e,t);},async exists(e){return r.exists(e)},async remove(e){r.remove(e);},async readBytes(e){return r.readBytes?.(e)??null},async writeBytes(e,t){await r.writeBytes?.(e,t);},async listKeys(e){return r.listKeys(e)},async stat(e){return r.stat?.(e)??null},async getUniqueKey(e,t){return r.getUniqueKey(e,t)},async create(e,t,a){return r.create(e,t,a)},keyRef(e){return r.keyRef(e)},config:{async get(e){return r.config.get(e)},async set(e,t){r.config.set(e,t);}}}}function K(n){let r=f(n);function e(t){return {id:t.id,payload:t.event}}return {async append(t){let a={id:r.generateId(),event:t};return r.appendEntry(a),e(a)},async readAll(){return r.readAllEntries().map(e)},async readAfter(t){let a=r.readAllEntries().map(e);if(!t)return {entries:a,newCursor:a.length>0?a[a.length-1].id:null};let i=a.findIndex(o=>o.id===t),s=i===-1?a:a.slice(i+1);return {entries:s,newCursor:s.length>0?s[s.length-1].id:t}}}}function x(n){let r=d(n);return {stream(e){let t=r.stream(e);return {async append(a){return t.append(a)},async readAll(){return t.readAll()},async readAfter(a){return t.readAfter(a)},async clear(){t.clear?.();}}},blob(e){let t=r.blob(e);return {async read(a){return t.read(a)},async write(a,i){t.write(a,i);},async exists(a){return t.exists(a)},async remove(a){t.remove(a);},async readBytes(a){return t.readBytes?.(a)??null},async writeBytes(a,i){await t.writeBytes?.(a,i);},async listKeys(a){return t.listKeys(a)},async stat(a){return t.stat?.(a)??null}}},async listStreams(e){return r.listStreams(e)},async listBlobs(e){return r.listBlobs(e)},config:{async get(e){return r.config.get(e)},async set(e,t){r.config.set(e,t);}}}}function $(n){return String(n||"").trim()}function T(n){return {kind:"local-storage",value:$(n)}}function c(n){return a(T(n))}function q(n){let r=`boards:${n}`;return {baseRef:T(r),cardStoreRef:c(`${r}:cards`),outputsStoreRef:c(`${r}:runtime-out`),scratchStoreRef:c(`${r}:scratch`),archiveStoreRef:c(`${r}:archive`),chatStoreRef:c(`${r}:chat`),artifactsStoreRef:c(`${r}:files`)}}function g(n,r){try{let e=b$1(n);if(e?.kind==="local-storage"&&e.value)return $(e.value)}catch{}return r}function D(n,r={}){let e=q(n),t=y(),a$2=y(),i$1=y();return i({boardId:n,kvStorage(s){return B(`${e.baseRef.value}:${s||"root"}`)},kvStorageForRef(s){return B(g(s,`${e.baseRef.value}:root`))},blobStorage(s){return L(s?`${e.baseRef.value}:${s}`:e.baseRef.value)},scratchStorage(){return k(`${e.baseRef.value}:scratch`)},scratchStorageForRef(s){return k(g(s,`${e.baseRef.value}:scratch`))},archiveFactory(){return x(`${e.baseRef.value}:archive`)},archiveFactoryForRef(s){return x(g(s,`${e.baseRef.value}:archive`))},journalStorage(){return K(`${e.baseRef.value}:journal`)},queueStorage:t,chatAgentQueueStorage:a$2,processAccumulatedQueueStorage:i$1,lock:E(),resolveBlob:async s=>{let o=s?.kind==="local-storage"?s:null;if(!o?.value)throw new Error(`Unsupported localStorage ref: ${a(s)}`);let f=b(o.value),l=await Promise.resolve(f.read(""));if(l===null)throw new Error(`Blob not found: ${a(s)}`);try{let p=JSON.parse(l);if(p?.__kind==="bytes-b64"&&typeof p.data=="string"){let S=await Promise.resolve(f.readBytes?.(""));if(S)return new TextDecoder().decode(S)}}catch{}return l},hashFn:a$1,genId:()=>(globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`).replace(/-/g,""),requestProcessAccumulated:r.requestProcessAccumulated,publishBoardChangeNotifications:r.publishBoardChangeNotifications,onWarn:s=>console.warn(`[localstorage-board-adapter:${n}] ${s}`)})}function U(n,r={}){return {refs:{...q(n),...r.refs??{}},boardAdapter:D(n,r)}}export{D as createLocalStorageBoardAdapter,q as createLocalStorageBoardRefs,U as createLocalStorageBoardRuntimeBundle,T as makeLocalStorageRef,c as serializeLocalStorageRef};//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BoardLiveCardsMcp } from './board-live-cards-mcp.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* server-runtime/mcp-tool-registries.ts
|
|
5
|
+
*
|
|
6
|
+
* Builds the two MCP tool dispatch tables: the per-board tool registry
|
|
7
|
+
* (wraps facade entry-points) and the controlplane registry (wraps the
|
|
8
|
+
* cross-board control handlers + admin facade calls). Pure-mechanical
|
|
9
|
+
* dispatch — argument parsing lives in ./mcp-args.ts, transport in
|
|
10
|
+
* ./mcp-invoker.ts.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type ToolHandler = (args: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
14
|
+
type ToolRegistry = Record<string, ToolHandler>;
|
|
15
|
+
/** Subset of the per-board MCP facade consumed by the tool registry. */
|
|
16
|
+
type McpFacadeForRegistry = BoardLiveCardsMcp;
|
|
17
|
+
type McpWebhookFacadeForRegistry = Pick<BoardLiveCardsMcp, 'webhookProcessAccumulated' | 'webhookSourceFetchDone' | 'webhookSourceFetchFailed'>;
|
|
18
|
+
declare function createMcpToolRegistry(mcp: McpFacadeForRegistry): ToolRegistry;
|
|
19
|
+
declare function createMcpWebhookToolRegistry(mcp: McpWebhookFacadeForRegistry): ToolRegistry;
|
|
20
|
+
/** Per-board upload entry point as exposed by createCardFileOps. */
|
|
21
|
+
type UploadCardFile = (cardId: string, fileName: string, contentType: string, bytes: Uint8Array, opts?: {
|
|
22
|
+
inChat?: boolean;
|
|
23
|
+
}) => unknown | Promise<unknown>;
|
|
24
|
+
interface McpControlplaneRegistryDeps {
|
|
25
|
+
boardId: string;
|
|
26
|
+
uploadCardFile: UploadCardFile;
|
|
27
|
+
/** Resolves the (lazy) per-board MCP facade for admin tool dispatch. */
|
|
28
|
+
getMcpFacade: () => Pick<McpFacadeForRegistry, 'listRuntimeCards' | 'adminReadCard' | 'adminUpsertCard' | 'manageAddChatAttachment' | 'manageAddChatEntryAndAnyAttachments' | 'managePatchCard' | 'manageRemoveCard' | 'manageUpsertCard'>;
|
|
29
|
+
controlplane: {
|
|
30
|
+
getChatProcessing: (args: Record<string, unknown>) => unknown;
|
|
31
|
+
setChatProcessing: (args: Record<string, unknown>, active: boolean) => unknown;
|
|
32
|
+
getCardMeta: (args: Record<string, unknown>) => unknown;
|
|
33
|
+
setCardMeta: (args: Record<string, unknown>) => unknown;
|
|
34
|
+
requireCardArgs: (args: Record<string, unknown>) => {
|
|
35
|
+
cardId: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
declare function createMcpControlplaneToolRegistry(deps: McpControlplaneRegistryDeps): ToolRegistry;
|
|
40
|
+
|
|
41
|
+
export { type McpControlplaneRegistryDeps as M, type ToolRegistry as T, type McpFacadeForRegistry as a, type McpWebhookFacadeForRegistry as b, createMcpControlplaneToolRegistry as c, createMcpToolRegistry as d, createMcpWebhookToolRegistry as e };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BoardLiveCardsMcp } from './board-live-cards-mcp.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* server-runtime/mcp-tool-registries.ts
|
|
5
|
+
*
|
|
6
|
+
* Builds the two MCP tool dispatch tables: the per-board tool registry
|
|
7
|
+
* (wraps facade entry-points) and the controlplane registry (wraps the
|
|
8
|
+
* cross-board control handlers + admin facade calls). Pure-mechanical
|
|
9
|
+
* dispatch — argument parsing lives in ./mcp-args.ts, transport in
|
|
10
|
+
* ./mcp-invoker.ts.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type ToolHandler = (args: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
14
|
+
type ToolRegistry = Record<string, ToolHandler>;
|
|
15
|
+
/** Subset of the per-board MCP facade consumed by the tool registry. */
|
|
16
|
+
type McpFacadeForRegistry = BoardLiveCardsMcp;
|
|
17
|
+
type McpWebhookFacadeForRegistry = Pick<BoardLiveCardsMcp, 'webhookProcessAccumulated' | 'webhookSourceFetchDone' | 'webhookSourceFetchFailed'>;
|
|
18
|
+
declare function createMcpToolRegistry(mcp: McpFacadeForRegistry): ToolRegistry;
|
|
19
|
+
declare function createMcpWebhookToolRegistry(mcp: McpWebhookFacadeForRegistry): ToolRegistry;
|
|
20
|
+
/** Per-board upload entry point as exposed by createCardFileOps. */
|
|
21
|
+
type UploadCardFile = (cardId: string, fileName: string, contentType: string, bytes: Uint8Array, opts?: {
|
|
22
|
+
inChat?: boolean;
|
|
23
|
+
}) => unknown | Promise<unknown>;
|
|
24
|
+
interface McpControlplaneRegistryDeps {
|
|
25
|
+
boardId: string;
|
|
26
|
+
uploadCardFile: UploadCardFile;
|
|
27
|
+
/** Resolves the (lazy) per-board MCP facade for admin tool dispatch. */
|
|
28
|
+
getMcpFacade: () => Pick<McpFacadeForRegistry, 'listRuntimeCards' | 'adminReadCard' | 'adminUpsertCard' | 'manageAddChatAttachment' | 'manageAddChatEntryAndAnyAttachments' | 'managePatchCard' | 'manageRemoveCard' | 'manageUpsertCard'>;
|
|
29
|
+
controlplane: {
|
|
30
|
+
getChatProcessing: (args: Record<string, unknown>) => unknown;
|
|
31
|
+
setChatProcessing: (args: Record<string, unknown>, active: boolean) => unknown;
|
|
32
|
+
getCardMeta: (args: Record<string, unknown>) => unknown;
|
|
33
|
+
setCardMeta: (args: Record<string, unknown>) => unknown;
|
|
34
|
+
requireCardArgs: (args: Record<string, unknown>) => {
|
|
35
|
+
cardId: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
declare function createMcpControlplaneToolRegistry(deps: McpControlplaneRegistryDeps): ToolRegistry;
|
|
40
|
+
|
|
41
|
+
export { type McpControlplaneRegistryDeps as M, type ToolRegistry as T, type McpFacadeForRegistry as a, type McpWebhookFacadeForRegistry as b, createMcpControlplaneToolRegistry as c, createMcpToolRegistry as d, createMcpWebhookToolRegistry as e };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type QueueLaneAwaitable<T> = T | Promise<T>;
|
|
2
|
+
interface QueueLaneLease<TMessage = unknown> {
|
|
3
|
+
id: string;
|
|
4
|
+
attempt: number;
|
|
5
|
+
message: TMessage;
|
|
6
|
+
ack(): QueueLaneAwaitable<boolean>;
|
|
7
|
+
nack(opts?: {
|
|
8
|
+
dead?: boolean;
|
|
9
|
+
reason?: string;
|
|
10
|
+
}): QueueLaneAwaitable<boolean>;
|
|
11
|
+
}
|
|
12
|
+
interface QueueLaneDescriptor<TMessage = unknown> {
|
|
13
|
+
id: string;
|
|
14
|
+
pollIntervalMs?: number;
|
|
15
|
+
visibilityMs?: number;
|
|
16
|
+
concurrency?: number;
|
|
17
|
+
maxAttempts?: number;
|
|
18
|
+
lease(opts?: {
|
|
19
|
+
max?: number;
|
|
20
|
+
visibilityMs?: number;
|
|
21
|
+
}): QueueLaneAwaitable<QueueLaneLease<TMessage>[]>;
|
|
22
|
+
handle(message: TMessage, lease: QueueLaneLease<TMessage>): Promise<void>;
|
|
23
|
+
onError?: (error: unknown, lease: QueueLaneLease<TMessage>) => void;
|
|
24
|
+
}
|
|
25
|
+
interface QueueLaneRegistry {
|
|
26
|
+
lanes: QueueLaneDescriptor[];
|
|
27
|
+
}
|
|
28
|
+
declare function createQueueLaneRegistry(lanes: QueueLaneDescriptor[]): QueueLaneRegistry;
|
|
29
|
+
|
|
30
|
+
export { type QueueLaneLease as Q, type QueueLaneDescriptor as a, type QueueLaneRegistry as b, createQueueLaneRegistry as c };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type QueueLaneAwaitable<T> = T | Promise<T>;
|
|
2
|
+
interface QueueLaneLease<TMessage = unknown> {
|
|
3
|
+
id: string;
|
|
4
|
+
attempt: number;
|
|
5
|
+
message: TMessage;
|
|
6
|
+
ack(): QueueLaneAwaitable<boolean>;
|
|
7
|
+
nack(opts?: {
|
|
8
|
+
dead?: boolean;
|
|
9
|
+
reason?: string;
|
|
10
|
+
}): QueueLaneAwaitable<boolean>;
|
|
11
|
+
}
|
|
12
|
+
interface QueueLaneDescriptor<TMessage = unknown> {
|
|
13
|
+
id: string;
|
|
14
|
+
pollIntervalMs?: number;
|
|
15
|
+
visibilityMs?: number;
|
|
16
|
+
concurrency?: number;
|
|
17
|
+
maxAttempts?: number;
|
|
18
|
+
lease(opts?: {
|
|
19
|
+
max?: number;
|
|
20
|
+
visibilityMs?: number;
|
|
21
|
+
}): QueueLaneAwaitable<QueueLaneLease<TMessage>[]>;
|
|
22
|
+
handle(message: TMessage, lease: QueueLaneLease<TMessage>): Promise<void>;
|
|
23
|
+
onError?: (error: unknown, lease: QueueLaneLease<TMessage>) => void;
|
|
24
|
+
}
|
|
25
|
+
interface QueueLaneRegistry {
|
|
26
|
+
lanes: QueueLaneDescriptor[];
|
|
27
|
+
}
|
|
28
|
+
declare function createQueueLaneRegistry(lanes: QueueLaneDescriptor[]): QueueLaneRegistry;
|
|
29
|
+
|
|
30
|
+
export { type QueueLaneLease as Q, type QueueLaneDescriptor as a, type QueueLaneRegistry as b, createQueueLaneRegistry as c };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkCPAXTVBQ_cjs=require('../chunk-CPAXTVBQ.cjs');require('../chunk-GL2OHR2E.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createHostedBoardQueueLaneRegistry",{enumerable:true,get:function(){return chunkCPAXTVBQ_cjs.a}});//# sourceMappingURL=index.cjs.map
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { f as BoardWorkerRequest } from '../board-live-cards-public-DQzPe7A9.cjs';
|
|
2
|
+
import { b as QueueLaneRegistry } from '../queue-lane-registry-PaZuFpwp.cjs';
|
|
3
|
+
import { S as SingleBoardRuntime, d as BoardRuntimePlatformAdapter, f as RuntimeLogger } from '../types-BzQY45dH.cjs';
|
|
4
|
+
import '../storage-interface-BFiD3kyB.cjs';
|
|
5
|
+
import '../execution-refs.cjs';
|
|
6
|
+
import '../types-BBhqYGhE.cjs';
|
|
7
|
+
import '../artifacts-store-lib-D9nMkVcE.cjs';
|
|
8
|
+
import '../board-platform-adapter-async-DOfEq_HC.cjs';
|
|
9
|
+
import '../storage-async-interface-BRR4eBjx.cjs';
|
|
10
|
+
import '../board-live-cards-public-async-CgMCYYft.cjs';
|
|
11
|
+
import '../chat-storage-lib-B9Q34Dyv.cjs';
|
|
12
|
+
|
|
13
|
+
interface HostedBoardQueueLaneRegistryOptions {
|
|
14
|
+
boardId: string;
|
|
15
|
+
runtime: Pick<SingleBoardRuntime, 'processAccumulatedLane' | 'handleChatAgentRequest' | 'queueLaneTuning'>;
|
|
16
|
+
boardAdapter: BoardRuntimePlatformAdapter;
|
|
17
|
+
logger?: RuntimeLogger;
|
|
18
|
+
executeTaskExecutorRequest?: (args: Record<string, unknown>, request: BoardWorkerRequest) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
declare function createHostedBoardQueueLaneRegistry(opts: HostedBoardQueueLaneRegistryOptions): QueueLaneRegistry;
|
|
21
|
+
|
|
22
|
+
export { type HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { f as BoardWorkerRequest } from '../board-live-cards-public-D-DJek3X.js';
|
|
2
|
+
import { b as QueueLaneRegistry } from '../queue-lane-registry-PaZuFpwp.js';
|
|
3
|
+
import { S as SingleBoardRuntime, d as BoardRuntimePlatformAdapter, f as RuntimeLogger } from '../types-CF2xUcZW.js';
|
|
4
|
+
import '../storage-interface-BFiD3kyB.js';
|
|
5
|
+
import '../execution-refs.js';
|
|
6
|
+
import '../types-BBhqYGhE.js';
|
|
7
|
+
import '../artifacts-store-lib-DSSMqVL2.js';
|
|
8
|
+
import '../board-platform-adapter-async-JZPCzZnH.js';
|
|
9
|
+
import '../storage-async-interface-DhlOVPSp.js';
|
|
10
|
+
import '../board-live-cards-public-async-3hUuHxDx.js';
|
|
11
|
+
import '../chat-storage-lib-DB9iSai2.js';
|
|
12
|
+
|
|
13
|
+
interface HostedBoardQueueLaneRegistryOptions {
|
|
14
|
+
boardId: string;
|
|
15
|
+
runtime: Pick<SingleBoardRuntime, 'processAccumulatedLane' | 'handleChatAgentRequest' | 'queueLaneTuning'>;
|
|
16
|
+
boardAdapter: BoardRuntimePlatformAdapter;
|
|
17
|
+
logger?: RuntimeLogger;
|
|
18
|
+
executeTaskExecutorRequest?: (args: Record<string, unknown>, request: BoardWorkerRequest) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
declare function createHostedBoardQueueLaneRegistry(opts: HostedBoardQueueLaneRegistryOptions): QueueLaneRegistry;
|
|
21
|
+
|
|
22
|
+
export { type HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkDDYSXP2A_cjs=require('../chunk-DDYSXP2A.cjs');require('../chunk-M3OU6IS5.cjs'),require('../chunk-7FGPOGRV.cjs'),require('../chunk-LPXVVMQT.cjs'),require('../chunk-7ICPAABP.cjs'),require('../chunk-KAWQPLIE.cjs'),require('../chunk-NM6O35RY.cjs'),require('../chunk-272IYUKT.cjs');var chunkCPAXTVBQ_cjs=require('../chunk-CPAXTVBQ.cjs');require('../chunk-NJJ7WEDT.cjs'),require('../chunk-GL2OHR2E.cjs'),require('../chunk-H5HBXPOI.cjs'),require('../chunk-PBCDDO4V.cjs'),require('../chunk-OEFTOO47.cjs'),require('../chunk-U2N6MCD5.cjs'),require('../chunk-SFVO2LB2.cjs'),require('../chunk-G4XXRHL2.cjs'),require('../chunk-LODXIALE.cjs'),require('../chunk-M6STQR5F.cjs'),require('../chunk-IXZG74EW.cjs'),require('../chunk-NMZ6XNLB.cjs'),require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-YMEIPKLW.cjs'),require('../chunk-GYQXDNNI.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createMultiBoardServerRuntime",{enumerable:true,get:function(){return chunkDDYSXP2A_cjs.c}});Object.defineProperty(exports,"createSingleBoardServerRuntime",{enumerable:true,get:function(){return chunkDDYSXP2A_cjs.b}});Object.defineProperty(exports,"createHostedBoardQueueLaneRegistry",{enumerable:true,get:function(){return chunkCPAXTVBQ_cjs.a}});//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as Awaitable,
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export { A as
|
|
1
|
+
import { b as MultiBoardRuntimeOptions, M as MultiBoardRuntime, c as SingleBoardRuntimeOptions, S as SingleBoardRuntime } from '../types-BzQY45dH.cjs';
|
|
2
|
+
export { A as Awaitable, B as BoardContextConfig, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, N as NotificationTransport, Q as QueueLaneRuntimeTuning, f as RuntimeLogger, R as RuntimeRequest, a as RuntimeResponse } from '../types-BzQY45dH.cjs';
|
|
3
|
+
export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from '../server-jobs-queue-runner/index.cjs';
|
|
4
|
+
export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-CgMCYYft.cjs';
|
|
5
|
+
export { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-DOfEq_HC.cjs';
|
|
6
6
|
export { B as BlobStorage, K as KVStorage, a as KindValueRef } from '../storage-interface-BFiD3kyB.cjs';
|
|
7
|
-
export { c as
|
|
7
|
+
export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as BoardWorkerRequest, C as CommandInput, a as CommandResult } from '../board-live-cards-public-DQzPe7A9.cjs';
|
|
8
|
+
export { C as ChatStorage } from '../chat-storage-lib-B9Q34Dyv.cjs';
|
|
8
9
|
export { ExecutionRef } from '../execution-refs.cjs';
|
|
9
|
-
import '../artifacts-store-lib-
|
|
10
|
+
import '../artifacts-store-lib-D9nMkVcE.cjs';
|
|
11
|
+
import '../queue-lane-registry-PaZuFpwp.cjs';
|
|
12
|
+
import '../storage-async-interface-BRR4eBjx.cjs';
|
|
10
13
|
import '../types-BBhqYGhE.cjs';
|
|
11
14
|
|
|
12
|
-
interface HostedBoardQueueLaneRegistryOptions {
|
|
13
|
-
boardId: string;
|
|
14
|
-
runtime: Pick<SingleBoardRuntime, 'processAccumulatedLane' | 'handleChatAgentRequest' | 'queueLaneTuning'>;
|
|
15
|
-
boardAdapter: BoardRuntimePlatformAdapter;
|
|
16
|
-
logger?: RuntimeLogger;
|
|
17
|
-
executeTaskExecutorRequest?: (args: Record<string, unknown>, request: BoardWorkerRequest) => Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
declare function createHostedBoardQueueLaneRegistry(opts: HostedBoardQueueLaneRegistryOptions): QueueLaneRegistry;
|
|
20
|
-
|
|
21
15
|
/**
|
|
22
16
|
* server-runtime/index.ts
|
|
23
17
|
*
|
|
@@ -41,4 +35,4 @@ declare function createHostedBoardQueueLaneRegistry(opts: HostedBoardQueueLaneRe
|
|
|
41
35
|
declare function createSingleBoardServerRuntime(options: SingleBoardRuntimeOptions): SingleBoardRuntime;
|
|
42
36
|
declare function createMultiBoardServerRuntime(options: MultiBoardRuntimeOptions): MultiBoardRuntime;
|
|
43
37
|
|
|
44
|
-
export {
|
|
38
|
+
export { MultiBoardRuntime, MultiBoardRuntimeOptions, SingleBoardRuntime, SingleBoardRuntimeOptions, createMultiBoardServerRuntime, createSingleBoardServerRuntime };
|