yaml-flow 8.2.5 → 8.4.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/asset-integrity.json +3 -3
- package/browser/board-livecards-client.js +1 -1
- package/browser/board-livecards-localstorage.js +6 -4
- package/browser/live-cards.js +19 -25
- package/cli/{board-live-cards-lib-Iq_XAC09.d.ts → board-live-cards-lib-tjYsPt5U.d.ts} +1 -1
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +3 -3
- package/cli/browser-api/board-live-cards-browser-adapter.js +3 -2
- package/cli/browser-api/card-store-browser-api.d.ts +1 -1
- package/cli/browser-api/card-store-browser-api.js +1 -1
- package/cli/{execution-interface-ftO1W7Po.d.ts → execution-interface-DCFBy4L8.d.ts} +151 -2
- package/cli/node/artifacts-store-cli.js +5 -5
- package/cli/node/batch-runner-cli.d.ts +3 -0
- package/cli/node/batch-runner-cli.js +2 -1
- package/cli/node/board-live-cards-cli.js +14 -8
- package/cli/node/card-store-cli.js +6 -6
- package/cli/node/chat-store-cli.d.ts +23 -0
- package/cli/node/chat-store-cli.js +8 -0
- package/cli/node/execution-adapter.d.ts +4 -2
- package/cli/node/execution-adapter.js +2 -2
- package/cli/node/fs-board-adapter.d.ts +75 -75
- package/cli/node/fs-board-adapter.js +14 -10
- package/cli/node/source-cli-task-executor.js +4 -4
- package/cli/node/step-machine-cli.js +3 -3
- package/cli/{types--rXGWbSR.d.ts → types-Dc2VRMUw.d.ts} +27 -124
- package/examples/board/demo-shell-with-server.html +3 -196
- package/examples/board/doc.html +465 -0
- package/examples/board/server/board-server.js +30 -82
- package/examples/board/server/board-worker/source_def_flows.json +2 -2
- package/examples/board/server/chat-flow/copilot-chat/assistant.js +44 -185
- package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper.bat +157 -0
- package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper_helper.ps1 +190 -0
- package/examples/board/server/chat-flow/flow-steps.json +122 -56
- package/examples/board/test/server-http-test.js +252 -220
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/{artifacts-store-lib-public-GD4H-fFp.d.ts → artifacts-store-lib-454TAuov.d.ts} +2 -32
- package/lib/{artifacts-store-lib-public-C5UL5tyG.d.cts → artifacts-store-lib-zsGFbBV8.d.cts} +2 -32
- package/lib/artifacts-store-public.d.cts +34 -3
- package/lib/artifacts-store-public.d.ts +34 -3
- package/lib/board-live-cards-node.cjs +14 -10
- package/lib/board-live-cards-node.d.cts +42 -21
- package/lib/board-live-cards-node.d.ts +42 -21
- package/lib/board-live-cards-node.js +14 -10
- package/lib/{board-live-cards-public-BLXbcBNk.d.cts → board-live-cards-public-BM6jCEIa.d.cts} +25 -5
- package/lib/{board-live-cards-public-BZaNb2mi.d.ts → board-live-cards-public-Bz07XKRK.d.ts} +25 -5
- package/lib/board-live-cards-public.cjs +2 -2
- package/lib/board-live-cards-public.d.cts +2 -2
- package/lib/board-live-cards-public.d.ts +2 -2
- package/lib/board-live-cards-public.js +2 -2
- package/lib/board-live-cards-server-runtime.cjs +4 -4
- package/lib/board-live-cards-server-runtime.d.cts +5 -3
- package/lib/board-live-cards-server-runtime.d.ts +5 -3
- package/lib/board-live-cards-server-runtime.js +4 -4
- package/lib/board-worker-adapter.cjs +2 -2
- package/lib/board-worker-adapter.js +2 -2
- package/lib/card-store-public.d.cts +2 -2
- package/lib/card-store-public.d.ts +2 -2
- package/lib/chat-storage-lib-DGaKrjVe.d.ts +53 -0
- package/lib/chat-storage-lib-OX0Q_Ttf.d.cts +53 -0
- package/lib/chat-store-public.cjs +2 -0
- package/lib/chat-store-public.d.cts +128 -0
- package/lib/chat-store-public.d.ts +128 -0
- package/lib/chat-store-public.js +2 -0
- package/lib/execution-refs.cjs +1 -1
- package/lib/execution-refs.d.cts +10 -1
- package/lib/execution-refs.d.ts +10 -1
- package/lib/execution-refs.js +1 -1
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/server-runtime/index.cjs +4 -4
- package/lib/server-runtime/index.d.cts +6 -4
- package/lib/server-runtime/index.d.ts +6 -4
- package/lib/server-runtime/index.js +4 -4
- package/lib/step-machine-public/index.cjs +3 -3
- package/lib/step-machine-public/index.d.cts +1 -1
- package/lib/step-machine-public/index.d.ts +1 -1
- package/lib/step-machine-public/index.js +3 -3
- package/lib/{storage-interface-B6ecOulj.d.ts → storage-interface-B-7pDHwD.d.cts} +36 -1
- package/lib/{storage-interface-B6ecOulj.d.cts → storage-interface-B-7pDHwD.d.ts} +36 -1
- package/lib/stores/index.d.cts +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/kv.d.cts +1 -1
- package/lib/stores/kv.d.ts +1 -1
- package/lib/{types-D-xVWPdY.d.ts → types-Cn0b8G-i.d.ts} +16 -65
- package/lib/{types-Bztd1KoK.d.cts → types-Dszjwfud.d.cts} +16 -65
- package/package.json +8 -2
- package/examples/board/.board-ws/cards/store/_index.json +0 -17
- package/examples/board/.board-ws/cards/store/card-market-prices.json +0 -80
- package/examples/board/.board-ws/cards/store/card-portfolio-value.json +0 -90
- package/examples/board/.board-ws/cards/store/card-portfolio.json +0 -78
- package/examples/board/server/chat-flow/chat-clear-processing.js +0 -41
- package/examples/board/server/chat-flow/chat-open-turn.js +0 -144
- package/examples/board/server/chat-flow/chat-write-assistant.js +0 -44
- package/examples/board/server/chat-flow/echo-probe/assistant.js +0 -28
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-05-
|
|
2
|
+
"generatedAt": "2026-05-18T03:37:27.841Z",
|
|
3
3
|
"algorithm": "sha256",
|
|
4
4
|
"files": {
|
|
5
5
|
"browser/board-livecards-localstorage.js": {
|
|
6
|
-
"sha256": "sha256-
|
|
7
|
-
"bytes":
|
|
6
|
+
"sha256": "sha256-5iZjTeTKyLwrgueWwHNcQ39VbXikIc6LJG7tHDwxaTI=",
|
|
7
|
+
"bytes": 100176
|
|
8
8
|
},
|
|
9
9
|
"browser/live-cards.schema.json": {
|
|
10
10
|
"sha256": "sha256-9CUv3YSTpgq3k0Dsi8bs7bNUlGoBA1SGWMCBSZcbzys=",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var BoardLiveCardsClient=(function(exports){'use strict';function Y(t){return t==="running"||t==="in-progress"?"loading":t==="failed"?"error":"fresh"}function ct(t,e){let n=e&&typeof e=="object"&&!Array.isArray(e)?e:{};return {schema_version:n.schema_version||"v1",card_id:typeof n.card_id=="string"?n.card_id:t,card_data:n.card_data&&typeof n.card_data=="object"&&!Array.isArray(n.card_data)?structuredClone(n.card_data):{},computed_values:n.computed_values&&typeof n.computed_values=="object"&&!Array.isArray(n.computed_values)?structuredClone(n.computed_values):{}}}function T(t,e){if(!t||typeof t!="object")throw new Error("payload must be an object");if(!e)throw new Error("cardId is required");let f=(Array.isArray(t.cardDefinitions)?t.cardDefinitions:[]).find(b=>b.id===e);if(!f)throw new Error(`cardDefinitions has no entry with id ${e}`);let r=t.statusSnapshot&&typeof t.statusSnapshot=="object"?t.statusSnapshot:{},a=t.cardRuntimeById&&typeof t.cardRuntimeById=="object"?t.cardRuntimeById:{},y=t.dataObjectsByToken&&typeof t.dataObjectsByToken=="object"?t.dataObjectsByToken:{},u=(Array.isArray(r.cards)?r.cards:[]).find(b=>b.name===e),p=structuredClone(f),o=ct(e,a[e]),s={...p.card_data&&typeof p.card_data=="object"&&!Array.isArray(p.card_data)?p.card_data:{},...o.card_data||{},status:Y(u?.status),lastRun:u?.runtime?.last_transition_at??null};u?.error?.message&&(s.error=u.error.message);let l=u?{task_status:u.status??null,card_status:Y(u.status),runtime:structuredClone(u.runtime??{}),error:u.error?structuredClone(u.error):null,blocked_by:Array.isArray(u.blocked_by)?structuredClone(u.blocked_by):[],requires_missing:Array.isArray(u.requires_missing)?structuredClone(u.requires_missing):[]}:{task_status:null,card_status:s.status??"fresh",runtime:{last_transition_at:s.lastRun??null},error:s.error?{message:s.error}:null,blocked_by:[],requires_missing:[]},k=Array.isArray(p.requires)?p.requires:[],c={};for(let[b,B]of Object.entries(y))c[b]=structuredClone(B);for(let b of k)Object.prototype.hasOwnProperty.call(c,b)||(c[b]=null);let d=(t.cardChatsByCardId&&typeof t.cardChatsByCardId=="object"?t.cardChatsByCardId:{})[e],S=d?{messages:Array.isArray(d.messages)?d.messages:[],receiving:!!d.receiving,processing:!!d.processing}:null;return {id:e,card:p,card_data:s,requires:c,computed_values:o.computed_values,runtime_state:l,card_chats:S}}function F(t){if(!t||typeof t!="object")throw new Error("payload must be an object");return (Array.isArray(t.cardDefinitions)?t.cardDefinitions:[]).map(n=>T(t,n.id))}function G(t){return JSON.parse(JSON.stringify(t))}function I(t,e){if(t===e)return t;try{if(JSON.stringify(t)===JSON.stringify(e))return t}catch{}return e}function _(t,e){if(t===e)return true;try{return JSON.stringify(t)===JSON.stringify(e)}catch{return false}}function ut(t){return t==="running"||t==="in-progress"?"loading":t==="failed"?"error":"fresh"}function q(t,e,n){let f=t,a=(f&&Array.isArray(f.cardDefinitions)?f.cardDefinitions:[]).map(u=>u.id),y=e&&e.modelsById||{},g={};for(let u of a){let p=n(t,u),o=y[u];if(!o){g[u]=p;continue}let m=p.card_chats!=null?I(o.card_chats,p.card_chats??null):o.card_chats??null,s={id:p.id,card:I(o.card,p.card),card_data:I(o.card_data,p.card_data),requires:I(o.requires,p.requires),computed_values:I(o.computed_values,p.computed_values),runtime_state:I(o.runtime_state,p.runtime_state),card_chats:m};g[u]=s.card===o.card&&s.card_data===o.card_data&&s.requires===o.requires&&s.computed_values===o.computed_values&&s.runtime_state===o.runtime_state&&s.card_chats===o.card_chats?o:s;}return {payload:t,cardIds:a,modelsById:g}}function U(t,e={}){if(!t)return t;let n=typeof e.includeCard=="function"?e.includeCard:(()=>true),f=typeof e.mapCard=="function"?e.mapCard:(u=>u),r=false,a=[],y={};for(let u of t.cardIds){let p=t.modelsById[u];if(!p){r=true;continue}if(!n(p,t)){r=true;continue}let o=f(p,t);if(!o||o.id!==u)throw new Error(`deriveBoardState: mapped card must preserve id "${u}"`);o!==p&&(r=true),a.push(u),y[u]=o;}let g=typeof e.mapPayload=="function"?e.mapPayload(t.payload,{sourceState:t,cardIds:a,modelsById:y}):t.payload;return g!==t.payload&&(r=true),!r&&a.length===t.cardIds.length?t:{payload:g,cardIds:a,modelsById:y}}function H(t,e,n,f){if(!t||!Array.isArray(e)||e.length===0)return t;let r=t.modelsById,a=t.cardIds,y=false,g=false,u={};for(let o of a){let m=r[o],s=m&&m.requires;if(s&&typeof s=="object")for(let l of Object.keys(s))(u[l]=u[l]||[]).push(o);}function p(){y||(r={...r},y=true);}for(let o of e)if(!(!o||!o.kind)){if(o.kind==="computed_values"){let m=o.cardId,s=r[m];if(!s)continue;let l=o.values||{};if(_(s.computed_values,l))continue;p(),r[m]={...s,computed_values:l},g=true;}else if(o.kind==="data_object"){let m=o.key,s=o.payload,l=u[m]||[];for(let k of l){let c=r[k];if(!c)continue;let C=c.requires||{};_(C[m],s)||(p(),r[k]={...c,requires:{...C,[m]:s}},g=true);}}else if(o.kind==="card_refreshed"){let m=o.cardId,s=null,l=r[m],k=o.card;if(l&&k&&typeof k=="object"&&!Array.isArray(k)){let c=k,C=c.card_data&&typeof c.card_data=="object"&&!Array.isArray(c.card_data)?c.card_data:l.card_data,d=c.requires&&typeof c.requires=="object"&&!Array.isArray(c.requires)?c.requires:l.requires,S=c.computed_values&&typeof c.computed_values=="object"&&!Array.isArray(c.computed_values)?c.computed_values:l.computed_values,b=c.runtime_state&&typeof c.runtime_state=="object"&&!Array.isArray(c.runtime_state)?c.runtime_state:l.runtime_state;s={...l,card:k,card_data:C,requires:d,computed_values:S,runtime_state:b};}if(!s)try{let c=f();c&&(s=n(c,m));}catch{}if(!s||l&&_(l.card,s.card)&&_(l.card_data,s.card_data)&&_(l.requires,s.requires)&&_(l.computed_values,s.computed_values)&&_(l.runtime_state,s.runtime_state))continue;p(),r[m]=s,a.includes(m)||(a=[...a,m]),g=true;}else if(o.kind==="card_chats"){let m=o.cardId,s=r[m];if(!s)continue;let l=Array.isArray(o.messages)?o.messages:s.card_chats?.messages??[],k=typeof o.receiving=="boolean"?o.receiving:s.card_chats?.receiving??false,c=typeof o.processing=="boolean"?o.processing:s.card_chats?.processing??false,C={messages:l,receiving:k,processing:c};if(_(s.card_chats,C))continue;p(),r[m]={...s,card_chats:C},g=true;}else if(o.kind==="chat_messages"){let m=o.cardId,s=r[m];if(!s)continue;let l=Array.isArray(o.messages)?o.messages:[],k=s.card_chats||{receiving:false,processing:false},c={messages:l,receiving:k.receiving,processing:!!k.processing};if(_(s.card_chats,c))continue;p(),r[m]={...s,card_chats:c},g=true;}else if(o.kind==="status"){let m=o.status?.cards??[];for(let s of m){let l=s?.name;if(!l||!r[l])continue;let k=r[l],c=ut(s.status),C={...k.card_data||{},status:c,lastRun:s.runtime?.last_transition_at??null,...s.error?.message?{error:s.error.message}:{}};s.error?.message||delete C.error;let d={task_status:s.status??null,card_status:c,runtime:s.runtime?G(s.runtime):{},error:s.error?G(s.error):null,blocked_by:Array.isArray(s.blocked_by)?G(s.blocked_by):[],requires_missing:Array.isArray(s.requires_missing)?G(s.requires_missing):[]};_(k.card_data,C)&&_(k.runtime_state,d)||(p(),r[l]={...k,card_data:C,runtime_state:d},g=true);}}}return g?{payload:t.payload,cardIds:a,modelsById:r}:t}function _e(t,e="/api/boards"){let n=e.replace(/\/$/,""),f=encodeURIComponent(t||"default"),r=`${n}/${f}`;return {initBoard:`${r}/init-board`,stream:`${r}/sse`,patchCard:a=>`${r}/cards/${encodeURIComponent(a)}`,cardAction:a=>`${r}/cards/${encodeURIComponent(a)}/actions`,cardFile:a=>`${r}/cards/${encodeURIComponent(a)}/files`,cardChats:a=>`${r}/cards/${encodeURIComponent(a)}/chats`,chatSubscribeSse:a=>`${r}/cards/${encodeURIComponent(a)}/chats/subscribe-sse`,chatUnsubscribeSse:a=>`${r}/cards/${encodeURIComponent(a)}/chats/unsubscribe-sse`}}function Re(t="/api/board"){let e=t.replace(/\/$/,"");return {initBoard:`${e}/init-board`,stream:`${e}/sse`,patchCard:n=>`${e}/cards/${encodeURIComponent(n)}`,cardAction:n=>`${e}/cards/${encodeURIComponent(n)}/actions`,cardFile:n=>`${e}/cards/${encodeURIComponent(n)}/files`,cardChats:n=>`${e}/cards/${encodeURIComponent(n)}/chats`,chatSubscribeSse:n=>`${e}/cards/${encodeURIComponent(n)}/chats/subscribe-sse`,chatUnsubscribeSse:n=>`${e}/cards/${encodeURIComponent(n)}/chats/unsubscribe-sse`}}function Ae(t){let e=t.getServerOrigin();if(!e||!t.boardId)return null;let n=t.boardPaths(t.boardId);return `${e}${n.initBoard.replace(/\/init-board$/,"")}`}async function W(t){if(!t.file)return null;let e=t.boardPaths(t.boardId),n=t.inChat?`${e.cardFile(t.cardId)}?inChat=true`:e.cardFile(t.cardId),f=typeof t.file.name=="string"?t.file.name:"upload.bin",r=t.file.type||"application/octet-stream",a=await t.fetchServer(n,{method:"POST",headers:{"content-type":r,"x-file-name":encodeURIComponent(f)},body:t.file});if(!a.ok){let g=await a.text();throw new Error(`Upload failed for ${t.cardId} (${a.status})${g?": "+g:""}`)}return (await a.json())?.file??null}async function lt(t){let{actionType:e}=t;if(e!=="chat-send"&&e!=="file-upload")return t.payload||{};let n={...t.payload||{}},f=Array.isArray(n.files)?n.files:[];if(!f.length)return n.files=[],n;let r=[];for(let a of f){let y=await W({...t,file:a,inChat:e==="chat-send"});y&&r.push(y);}return n.files=e==="chat-send"?[]:r,n}async function pt(t){let e=t.boardPaths(t.boardId),n=await t.fetchServer(e.patchCard(t.cardId),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t.patch||{})});if(!n.ok)throw new Error(`PATCH failed for ${t.cardId} (${n.status})`)}async function ft(t){let e=t.boardPaths(t.boardId),n=await lt(t),f=await t.fetchServer(e.cardAction(t.cardId),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({actionType:t.actionType,payload:n})});if(!f.ok)throw new Error(`${t.actionType==="refresh"?"Refresh":"Action"} failed for ${t.cardId} (${f.status})`);return {payload:n}}function Te(t,e=null){return q(t,e,T)}function xe(t,e,n){return H(t,e,T,n)}function Ee(t,e){let n=new Set(e.map(String)),f=t.cardIds.filter(a=>n.has(a)),r={};for(let a of f)r[a]=t.modelsById[a];return {payload:t.payload,cardIds:f,modelsById:r}}function Ie(t,e){let n=e instanceof Set?e:new Set(e.map(String)),f=t.cardIds.filter(a=>!n.has(a)),r={};for(let a of f)r[a]=t.modelsById[a];return {payload:t.payload,cardIds:f,modelsById:r}}function gt(t){let e=t?.engine;e&&typeof e.onServerSseEvent=="function"?e.onServerSseEvent():e&&typeof e.refreshOpenChatModal=="function"&&e.refreshOpenChatModal();}function ht(){let t=globalThis.LiveCard;if(!t)throw new Error("LiveCard global not loaded \u2014 include live-cards.js before this script");return t}function mt(t){if(!t||typeof t!="object")throw new Error("options are required");let{fetchServer:e,boardPaths:n,getServerOrigin:f}=t;if(typeof e!="function")throw new Error("options.fetchServer is required");if(typeof n!="function")throw new Error("options.boardPaths is required");if(typeof f!="function")throw new Error("options.getServerOrigin is required");let r={current:null},a=new Set,y=null,g=null,u=null,p={},o=globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`lc-${Date.now()}-${Math.random().toString(36).slice(2)}`;function m(){for(let i of a)i(r.current);}function s(){return r.current?r.current.payload:null}function l(i){return r.current=i,m(),r.current}function k(){let i=g;if(!i)throw new Error("Board runtime session is not bound to a board yet");let h=u??n(i);return u=h,{boardId:i,paths:h}}function c(i){let h=q(i,r.current,T);return l(h),h}function C(i,h){let w=q(i,h??r.current,T);return l(w),w}function d(i){return l(i)}function S(i){if(!r.current)return r.current;let h=H(r.current,i,T,s);return l(h),h}async function b(i,h,w){let{boardId:x}=k();return W({fetchServer:e,boardPaths:n,boardId:x,cardId:i,file:h,inChat:w?.inChat})}async function B(i,h,w){let{boardId:x}=k();return ft({fetchServer:e,boardPaths:n,boardId:x,cardId:i,actionType:h,payload:w})}async function v(i,h){let{boardId:w}=k();await pt({fetchServer:e,boardPaths:n,boardId:w,cardId:i,patch:h});}async function R(i){let{paths:h}=k();p[i]=true,S([{kind:"card_chats",cardId:i,messages:r.current?.modelsById[i]?.card_chats?.messages??[],receiving:true}]);try{await e(h.chatSubscribeSse(i),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:o})});}catch{}}async function M(i){let{paths:h}=k();delete p[i];try{await e(h.chatUnsubscribeSse(i),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:o})});}catch{}S([{kind:"card_chats",cardId:i,messages:r.current?.modelsById[i]?.card_chats?.messages??[],receiving:false}]);}function Q(i){Object.keys(p).forEach(h=>{e(i.chatSubscribeSse(h),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:o})}).catch(()=>{});});}function J(i){let h=i;h?.kind==="notification-batch"&&Array.isArray(h.notifications)?S(h.notifications):h?.cardDefinitions&&c(h);}function Z(i){return g=String(i.boardId||"default"),u=n(g),i.state!==void 0?d(i.state??null):i.payload?C(i.payload,r.current):r.current}function tt(i){return J(i),r.current}function $(){y&&(y.close(),y=null);}async function et(i={}){let h=String(i.boardId||g||"default");g=h;let w=n(h);if(u=w,i.initialState!==void 0?d(i.initialState??null):i.initialPayload!==void 0&&C(i.initialPayload,r.current),i.skipInitBoard!==true){let O=typeof i.taskExecutorPath=="string"?i.taskExecutorPath.trim():"",P=O?`${w.initBoard}?taskExecutorPath=${encodeURIComponent(O)}`:w.initBoard,A=await e(P);if(!A.ok)throw new Error(`Server init-board failed (${A.status}).`)}let x=f();if(!x)throw new Error("Server origin not resolved before SSE start");$();let E=!r.current,st=`${x}${w.stream}${w.stream.includes("?")?"&":"?"}clientId=${encodeURIComponent(o)}`,K=await new Promise((O,P)=>{let A=new EventSource(st);y=A;let D=false,j=E?setTimeout(()=>{D||P(new Error("SSE initial payload timeout (15s)"));},15e3):null;A.onopen=()=>{Q(w),E||O(r.current?.payload??null);},A.onmessage=at=>{try{let L=JSON.parse(at.data||"{}");J(L),!D&&E&&(L?.cardDefinitions||F(L))&&(D=!0,j&&clearTimeout(j),O(L));}catch{if(!E)return}},A.onerror=()=>{E&&!D&&(j&&clearTimeout(j),P(new Error("SSE connection failed during bootstrap")));};});if(E){if(!F(K))throw new Error("SSE payload missing published runtime artifacts");c(K);}return r.current}function rt(i){return a.add(i),i(r.current),()=>{a.delete(i);}}function nt(){$(),Object.keys(p).forEach(i=>delete p[i]),u=null,g=null,a.clear(),r.current=null;}return {bootstrap:et,attachProvidedState:Z,applyServerUpdate:tt,seedStateFromPayload:C,seedState:d,applyNotificationBatch:S,replacePayload:c,subscribe:rt,closeSse:$,isConnected:()=>y!=null,getState:()=>r.current,getPayload:s,getBoardId:()=>g,getClientId:()=>o,getSseClientId:()=>o,patchCardState:v,dispatchCardAction:B,uploadCardFile:b,subscribeCardChats:R,unsubscribeCardChats:M,dispose:nt}}function z(t){if(!t||typeof t!="object")throw new Error("options are required");if(!t.session)throw new Error("options.session is required");let{session:e,...n}=t,f=t.session&&"canvas"in t&&typeof t.canvas=="object"?t.canvas:{height:"72vh",overflow:"auto"},r=e.getState()?U(e.getState(),n):null,a=null,y=String(t.initialMode||"board"),g=new Set;function u(){for(let d of g)d(r);}function p(d){r=d?U(d,n):null,u(),a&&r&&(a.setState(()=>r),gt(a));}let o=e.subscribe(d=>{p(d);});function m(d){if(!r)throw new Error("Derived board runtime has no state to mount");let S=d?.rootElement;if(!S)throw new Error("mountBoard requires params.rootElement");y=String(d?.mode||y||"board");let b=ht(),B=b.init({resolve:v=>r?.modelsById[v],chartLib:globalThis.Chart??null,markdown:globalThis.marked?v=>globalThis.marked.parse(v):null,sanitize:globalThis.DOMPurify?v=>globalThis.DOMPurify.sanitize(v):null,onPatchState:(v,R)=>e.patchCardState(v,R),onRefresh:v=>e.patchCardState(v,{}),onAction:(v,R,M)=>e.dispatchCardAction(v,R,M).then(()=>{}),startReceivingChats:v=>{e.subscribeCardChats(v);},stopReceivingChats:v=>{e.unsubscribeCardChats(v);}});return S.innerHTML="",a=b.Board(B,S,{initialState:r,getNodeIds:v=>v.cardIds,selectNode:(v,R)=>v.modelsById[R],mode:y,canvas:f}),a}function s(d){return g.add(d),d(r),()=>{g.delete(d);}}function l(d){y=String(d||"board");let S=a&&a.core;S&&typeof S.setMode=="function"&&S.setMode(y);}function k(){if(!a)return;y="canvas";let d=a.core;d&&typeof d.setMode=="function"&&d.setMode("canvas"),d&&typeof d.autoLayout=="function"&&d.autoLayout();}function c(d){let S=a&&a.core;S&&typeof S.setDevMode=="function"&&S.setDevMode(!!d);}function C(){o(),g.clear(),a=null;}return {mountBoard:m,subscribe:s,getState:()=>r,getFullState:()=>e.getState(),getBoardId:()=>e.getBoardId(),getClientId:()=>e.getClientId(),getSseClientId:()=>e.getSseClientId(),patchCardState:(d,S)=>e.patchCardState(d,S),dispatchCardAction:(d,S,b)=>e.dispatchCardAction(d,S,b),uploadCardFile:(d,S,b)=>e.uploadCardFile(d,S,b),subscribeCardChats:d=>e.subscribeCardChats(d),unsubscribeCardChats:d=>e.unsubscribeCardChats(d),setMode:l,autoLayout:k,setDevMode:c,getCurrentMode:()=>y,dispose:C}}function Be(t){let e=mt(t),n=z({session:e});async function f(r){let a=String(r?.boardId||"default");return await e.bootstrap({boardId:a,taskExecutorPath:r?.taskExecutorPath}),n.mountBoard({rootElement:r.rootElement,mode:r.mode})}return {bootstrapBoard:f,dispose:()=>{n.dispose(),e.dispose();},setMode:r=>n.setMode(r),autoLayout:()=>n.autoLayout(),setDevMode:r=>n.setDevMode(r),getCurrentMode:()=>n.getCurrentMode(),getState:()=>e.getState(),getRuntimeSession:()=>e,createDerivedRuntime:(r={})=>z({session:e,...r})}}exports.applyBoardNotifications=xe;exports.applyNotification=H;exports.buildBoardState=q;exports.buildFileUrlBase=Ae;exports.createBoardRuntimeClient=Be;exports.createBoardRuntimeSession=mt;exports.createDerivedBoardRuntime=z;exports.defaultBoardPaths=_e;exports.deriveBoardState=U;exports.dispatchCardAction=ft;exports.patchCardState=pt;exports.pickBoardState=Ee;exports.prepareActionPayload=lt;exports.selectAllLiveCardModels=F;exports.selectLiveCardModel=T;exports.serverPayloadToBoardState=Te;exports.singleBoardPaths=Re;exports.subtractBoardState=Ie;exports.uploadCardFile=W;return exports;})({});//# sourceMappingURL=board-livecards-client.js.map
|
|
1
|
+
var BoardLiveCardsClient=(function(exports){'use strict';function W(t){return t==="running"||t==="in-progress"?"loading":t==="failed"?"error":"fresh"}function pt(t,e){let n=e&&typeof e=="object"&&!Array.isArray(e)?e:{};return {schema_version:n.schema_version||"v1",card_id:typeof n.card_id=="string"?n.card_id:t,card_data:n.card_data&&typeof n.card_data=="object"&&!Array.isArray(n.card_data)?structuredClone(n.card_data):{},computed_values:n.computed_values&&typeof n.computed_values=="object"&&!Array.isArray(n.computed_values)?structuredClone(n.computed_values):{}}}function x(t,e){if(!t||typeof t!="object")throw new Error("payload must be an object");if(!e)throw new Error("cardId is required");let h=(Array.isArray(t.cardDefinitions)?t.cardDefinitions:[]).find(C=>C.id===e);if(!h)throw new Error(`cardDefinitions has no entry with id ${e}`);let r=t.statusSnapshot&&typeof t.statusSnapshot=="object"?t.statusSnapshot:{},o=t.cardRuntimeById&&typeof t.cardRuntimeById=="object"?t.cardRuntimeById:{},y=t.dataObjectsByToken&&typeof t.dataObjectsByToken=="object"?t.dataObjectsByToken:{},u=(Array.isArray(r.cards)?r.cards:[]).find(C=>C.name===e),l=structuredClone(h),i=pt(e,o[e]),s={...l.card_data&&typeof l.card_data=="object"&&!Array.isArray(l.card_data)?l.card_data:{},...i.card_data||{},status:W(u?.status),lastRun:u?.runtime?.last_transition_at??null};u?.error?.message&&(s.error=u.error.message);let f=u?{task_status:u.status??null,card_status:W(u.status),runtime:structuredClone(u.runtime??{}),error:u.error?structuredClone(u.error):null,blocked_by:Array.isArray(u.blocked_by)?structuredClone(u.blocked_by):[],requires_missing:Array.isArray(u.requires_missing)?structuredClone(u.requires_missing):[]}:{task_status:null,card_status:s.status??"fresh",runtime:{last_transition_at:s.lastRun??null},error:s.error?{message:s.error}:null,blocked_by:[],requires_missing:[]},k=Array.isArray(l.requires)?l.requires:[],c={};for(let[C,E]of Object.entries(y))c[C]=structuredClone(E);for(let C of k)Object.prototype.hasOwnProperty.call(c,C)||(c[C]=null);let d=(t.cardChatsByCardId&&typeof t.cardChatsByCardId=="object"?t.cardChatsByCardId:{})[e],S=d?{messages:Array.isArray(d.messages)?d.messages:[],receiving:!!d.receiving,processing:!!d.processing}:null;return {id:e,card:l,card_data:s,requires:c,computed_values:i.computed_values,runtime_state:f,card_chats:S}}function U(t){if(!t||typeof t!="object")throw new Error("payload must be an object");return (Array.isArray(t.cardDefinitions)?t.cardDefinitions:[]).map(n=>x(t,n.id))}function G(t){return JSON.parse(JSON.stringify(t))}function B(t,e){if(t===e)return t;try{if(JSON.stringify(t)===JSON.stringify(e))return t}catch{}return e}function _(t,e){if(t===e)return true;try{return JSON.stringify(t)===JSON.stringify(e)}catch{return false}}function ft(t){return t==="running"||t==="in-progress"?"loading":t==="failed"?"error":"fresh"}function q(t,e,n){let h=t,o=(h&&Array.isArray(h.cardDefinitions)?h.cardDefinitions:[]).map(u=>u.id),y=e&&e.modelsById||{},m={};for(let u of o){let l=n(t,u),i=y[u];if(!i){m[u]=l;continue}let g=l.card_chats!=null?B(i.card_chats,l.card_chats??null):i.card_chats??null,s={id:l.id,card:B(i.card,l.card),card_data:B(i.card_data,l.card_data),requires:B(i.requires,l.requires),computed_values:B(i.computed_values,l.computed_values),runtime_state:B(i.runtime_state,l.runtime_state),card_chats:g};m[u]=s.card===i.card&&s.card_data===i.card_data&&s.requires===i.requires&&s.computed_values===i.computed_values&&s.runtime_state===i.runtime_state&&s.card_chats===i.card_chats?i:s;}return {payload:t,cardIds:o,modelsById:m}}function H(t,e={}){if(!t)return t;let n=typeof e.includeCard=="function"?e.includeCard:(()=>true),h=typeof e.mapCard=="function"?e.mapCard:(u=>u),r=false,o=[],y={};for(let u of t.cardIds){let l=t.modelsById[u];if(!l){r=true;continue}if(!n(l,t)){r=true;continue}let i=h(l,t);if(!i||i.id!==u)throw new Error(`deriveBoardState: mapped card must preserve id "${u}"`);i!==l&&(r=true),o.push(u),y[u]=i;}let m=typeof e.mapPayload=="function"?e.mapPayload(t.payload,{sourceState:t,cardIds:o,modelsById:y}):t.payload;return m!==t.payload&&(r=true),!r&&o.length===t.cardIds.length?t:{payload:m,cardIds:o,modelsById:y}}function J(t,e,n,h){if(!t||!Array.isArray(e)||e.length===0)return t;let r=t.modelsById,o=t.cardIds,y=false,m=false,u={};for(let i of o){let g=r[i],s=g&&g.requires;if(s&&typeof s=="object")for(let f of Object.keys(s))(u[f]=u[f]||[]).push(i);}function l(){y||(r={...r},y=true);}for(let i of e)if(!(!i||!i.kind)){if(i.kind==="computed_values"){let g=i.cardId,s=r[g];if(!s)continue;let f=i.values||{};if(_(s.computed_values,f))continue;l(),r[g]={...s,computed_values:f},m=true;}else if(i.kind==="data_object"){let g=i.key,s=i.payload,f=u[g]||[];for(let k of f){let c=r[k];if(!c)continue;let w=c.requires||{};_(w[g],s)||(l(),r[k]={...c,requires:{...w,[g]:s}},m=true);}}else if(i.kind==="card_refreshed"){let g=i.cardId,s=null,f=r[g],k=i.card;if(f&&k&&typeof k=="object"&&!Array.isArray(k)){let c=k,w=c.card_data&&typeof c.card_data=="object"&&!Array.isArray(c.card_data)?c.card_data:f.card_data,d=c.requires&&typeof c.requires=="object"&&!Array.isArray(c.requires)?c.requires:f.requires,S=c.computed_values&&typeof c.computed_values=="object"&&!Array.isArray(c.computed_values)?c.computed_values:f.computed_values,C=c.runtime_state&&typeof c.runtime_state=="object"&&!Array.isArray(c.runtime_state)?c.runtime_state:f.runtime_state;s={...f,card:k,card_data:w,requires:d,computed_values:S,runtime_state:C};}if(!s)try{let c=h();c&&(s=n(c,g));}catch{}if(!s||f&&_(f.card,s.card)&&_(f.card_data,s.card_data)&&_(f.requires,s.requires)&&_(f.computed_values,s.computed_values)&&_(f.runtime_state,s.runtime_state))continue;l(),r[g]=s,o.includes(g)||(o=[...o,g]),m=true;}else if(i.kind==="card_chats"){let g=i.cardId,s=r[g];if(!s)continue;let f=Array.isArray(i.messages)?i.messages:s.card_chats?.messages??[],k=typeof i.receiving=="boolean"?i.receiving:s.card_chats?.receiving??false,c=typeof i.processing=="boolean"?i.processing:s.card_chats?.processing??false,w={messages:f,receiving:k,processing:c};if(_(s.card_chats,w))continue;l(),r[g]={...s,card_chats:w},m=true;}else if(i.kind==="chat_messages"){let g=i.cardId,s=r[g];if(!s)continue;let f=Array.isArray(i.messages)?i.messages:[],k=s.card_chats||{receiving:false,processing:false},c={messages:f,receiving:k.receiving,processing:!!k.processing};if(_(s.card_chats,c))continue;l(),r[g]={...s,card_chats:c},m=true;}else if(i.kind==="status"){let g=i.status?.cards??[];for(let s of g){let f=s?.name;if(!f||!r[f])continue;let k=r[f],c=ft(s.status),w={...k.card_data||{},status:c,lastRun:s.runtime?.last_transition_at??null,...s.error?.message?{error:s.error.message}:{}};s.error?.message||delete w.error;let d={task_status:s.status??null,card_status:c,runtime:s.runtime?G(s.runtime):{},error:s.error?G(s.error):null,blocked_by:Array.isArray(s.blocked_by)?G(s.blocked_by):[],requires_missing:Array.isArray(s.requires_missing)?G(s.requires_missing):[]};_(k.card_data,w)&&_(k.runtime_state,d)||(l(),r[f]={...k,card_data:w,runtime_state:d},m=true);}}}return m?{payload:t.payload,cardIds:o,modelsById:r}:t}function xe(t,e="/api/boards"){let n=e.replace(/\/$/,""),h=encodeURIComponent(t||"default"),r=`${n}/${h}`;return {initBoard:`${r}/init-board`,stream:`${r}/sse`,patchCard:o=>`${r}/cards/${encodeURIComponent(o)}`,cardAction:o=>`${r}/cards/${encodeURIComponent(o)}/actions`,cardFile:o=>`${r}/cards/${encodeURIComponent(o)}/files`,cardChats:o=>`${r}/cards/${encodeURIComponent(o)}/chats`,chatSubscribeSse:o=>`${r}/cards/${encodeURIComponent(o)}/chats/subscribe-sse`,chatUnsubscribeSse:o=>`${r}/cards/${encodeURIComponent(o)}/chats/unsubscribe-sse`}}function Ee(t="/api/board"){let e=t.replace(/\/$/,"");return {initBoard:`${e}/init-board`,stream:`${e}/sse`,patchCard:n=>`${e}/cards/${encodeURIComponent(n)}`,cardAction:n=>`${e}/cards/${encodeURIComponent(n)}/actions`,cardFile:n=>`${e}/cards/${encodeURIComponent(n)}/files`,cardChats:n=>`${e}/cards/${encodeURIComponent(n)}/chats`,chatSubscribeSse:n=>`${e}/cards/${encodeURIComponent(n)}/chats/subscribe-sse`,chatUnsubscribeSse:n=>`${e}/cards/${encodeURIComponent(n)}/chats/unsubscribe-sse`}}function gt(t){let e=t.getServerOrigin();if(!e||!t.boardId)return null;let n=t.boardPaths(t.boardId);return `${e}${n.initBoard.replace(/\/init-board$/,"")}`}async function Z(t){if(!t.file)return null;let e=t.boardPaths(t.boardId),n=t.inChat?`${e.cardFile(t.cardId)}?inChat=true`:e.cardFile(t.cardId),h=typeof t.file.name=="string"?t.file.name:"upload.bin",r=t.file.type||"application/octet-stream",o=await t.fetchServer(n,{method:"POST",headers:{"content-type":r,"x-file-name":encodeURIComponent(h)},body:t.file});if(!o.ok){let m=await o.text();throw new Error(`Upload failed for ${t.cardId} (${o.status})${m?": "+m:""}`)}return (await o.json())?.file??null}async function ht(t){let{actionType:e}=t;if(e!=="chat-send"&&e!=="file-upload")return t.payload||{};let n={...t.payload||{}},h=Array.isArray(n.files)?n.files:[];if(!h.length)return n.files=[],n;let r=[];for(let o of h){let y=await Z({...t,file:o,inChat:e==="chat-send"});y&&r.push(y);}return n.files=e==="chat-send"?[]:r,n}async function mt(t){let e=t.boardPaths(t.boardId),n=await t.fetchServer(e.patchCard(t.cardId),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t.patch||{})});if(!n.ok)throw new Error(`PATCH failed for ${t.cardId} (${n.status})`)}async function yt(t){let e=t.boardPaths(t.boardId),n=await ht(t),h=await t.fetchServer(e.cardAction(t.cardId),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({actionType:t.actionType,payload:n})});if(!h.ok)throw new Error(`${t.actionType==="refresh"?"Refresh":"Action"} failed for ${t.cardId} (${h.status})`);return {payload:n}}function Ie(t,e=null){return q(t,e,x)}function Be(t,e,n){return J(t,e,x,n)}function Oe(t,e){let n=new Set(e.map(String)),h=t.cardIds.filter(o=>n.has(o)),r={};for(let o of h)r[o]=t.modelsById[o];return {payload:t.payload,cardIds:h,modelsById:r}}function Pe(t,e){let n=e instanceof Set?e:new Set(e.map(String)),h=t.cardIds.filter(o=>!n.has(o)),r={};for(let o of h)r[o]=t.modelsById[o];return {payload:t.payload,cardIds:h,modelsById:r}}function kt(t){let e=t?.core,n=t?.engine??e?.engine;n&&typeof n.onServerSseEvent=="function"?n.onServerSseEvent():n&&typeof n.refreshOpenChatModal=="function"&&n.refreshOpenChatModal();}function St(){let t=globalThis.LiveCard;if(!t)throw new Error("LiveCard global not loaded \u2014 include live-cards.js before this script");return t}function vt(t){if(!t||typeof t!="object")throw new Error("options are required");let{fetchServer:e,boardPaths:n,getServerOrigin:h}=t;if(typeof e!="function")throw new Error("options.fetchServer is required");if(typeof n!="function")throw new Error("options.boardPaths is required");if(typeof h!="function")throw new Error("options.getServerOrigin is required");let r={current:null},o=new Set,y=null,m=null,u=null,l={},i={},g=globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():`lc-${Date.now()}-${Math.random().toString(36).slice(2)}`;function s(){for(let a of o)a(r.current);}function f(){return r.current?r.current.payload:null}function k(a){return r.current=a,s(),r.current}function c(){let a=m;if(!a)throw new Error("Board runtime session is not bound to a board yet");let p=u??n(a);return u=p,{boardId:a,paths:p}}function w(a){let p=q(a,r.current,x);return k(p),p}function d(a,p){let b=q(a,p??r.current,x);return k(b),b}function S(a){return k(a)}function C(a){if(!r.current)return r.current;let p=J(r.current,a,x,f);return k(p),p}async function E(a,p,b){let{boardId:R}=c();return Z({fetchServer:e,boardPaths:n,boardId:R,cardId:a,file:p,inChat:b?.inChat})}async function M(a,p,b){let{boardId:R}=c();return p==="chat-send"&&await A(a),yt({fetchServer:e,boardPaths:n,boardId:R,cardId:a,actionType:p,payload:b})}function v(a,p){return i[a]=p,p.finally(()=>{i[a]===p&&delete i[a];})}async function A(a){let p=i[a];if(p){await p;return}l[a]||await K(a);}async function $(a,p){let{boardId:b}=c();await mt({fetchServer:e,boardPaths:n,boardId:b,cardId:a,patch:p});}async function K(a){let{paths:p}=c(),b=i[a];if(b){await b;return}if(l[a])return;l[a]=true;let R=(async()=>{await e(p.chatSubscribeSse(a),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:g})});})().catch(()=>{delete l[a];});await v(a,R);}async function tt(a){let{paths:p}=c(),b=i[a];if(b)try{await b;}catch{}delete l[a];try{await e(p.chatUnsubscribeSse(a),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:g})});}catch{}}function et(a){Object.keys(l).forEach(p=>{e(a.chatSubscribeSse(p),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:g})}).catch(()=>{});});}function V(a){let p=a;p?.kind==="notification-batch"&&Array.isArray(p.notifications)?C(p.notifications):p?.cardDefinitions&&w(p);}function rt(a){return m=String(a.boardId||"default"),u=n(m),a.state!==void 0?S(a.state??null):a.payload?d(a.payload,r.current):r.current}function nt(a){return V(a),r.current}function F(){y&&(y.close(),y=null);}async function st(a={}){let p=String(a.boardId||m||"default");m=p;let b=n(p);if(u=b,a.initialState!==void 0?S(a.initialState??null):a.initialPayload!==void 0&&d(a.initialPayload,r.current),a.skipInitBoard!==true){let O=typeof a.taskExecutorPath=="string"?a.taskExecutorPath.trim():"",P=O?`${b.initBoard}?taskExecutorPath=${encodeURIComponent(O)}`:b.initBoard,T=await e(P);if(!T.ok)throw new Error(`Server init-board failed (${T.status}).`)}let R=h();if(!R)throw new Error("Server origin not resolved before SSE start");F();let I=!r.current,it=`${R}${b.stream}${b.stream.includes("?")?"&":"?"}clientId=${encodeURIComponent(g)}`,X=await new Promise((O,P)=>{let T=new EventSource(it);y=T;let D=false,j=I?setTimeout(()=>{D||P(new Error("SSE initial payload timeout (15s)"));},15e3):null;T.onopen=()=>{et(b),I||O(r.current?.payload??null);},T.onmessage=dt=>{try{let L=JSON.parse(dt.data||"{}");V(L),!D&&I&&(L?.cardDefinitions||U(L))&&(D=!0,j&&clearTimeout(j),O(L));}catch{if(!I)return}},T.onerror=()=>{I&&!D&&(j&&clearTimeout(j),P(new Error("SSE connection failed during bootstrap")));};});if(I){if(!U(X))throw new Error("SSE payload missing published runtime artifacts");w(X);}return r.current}function at(a){return o.add(a),a(r.current),()=>{o.delete(a);}}function ot(){F(),Object.keys(l).forEach(a=>delete l[a]),u=null,m=null,o.clear(),r.current=null;}return {bootstrap:st,attachProvidedState:rt,applyServerUpdate:nt,seedStateFromPayload:d,seedState:S,applyNotificationBatch:C,replacePayload:w,subscribe:at,closeSse:F,isConnected:()=>y!=null,getState:()=>r.current,getPayload:f,getBoardId:()=>m,getClientId:()=>g,getSseClientId:()=>g,patchCardState:$,dispatchCardAction:M,uploadCardFile:E,subscribeCardChats:K,unsubscribeCardChats:tt,dispose:ot}}function Q(t){if(!t||typeof t!="object")throw new Error("options are required");if(!t.session)throw new Error("options.session is required");let{session:e,...n}=t,h=t.session&&"canvas"in t&&typeof t.canvas=="object"?t.canvas:{height:"72vh",overflow:"auto"},r=e.getState()?H(e.getState(),n):null,o=null,y=String(t.initialMode||"board"),m=new Set;function u(){for(let d of m)d(r);}function l(d){r=d?H(d,n):null,u(),o&&r&&(o.setState(()=>r),kt(o));}let i=e.subscribe(d=>{l(d);});function g(d){if(!r)throw new Error("Derived board runtime has no state to mount");let S=d?.rootElement;if(!S)throw new Error("mountBoard requires params.rootElement");y=String(d?.mode||y||"board");let C=n.boardPaths&&n.getServerOrigin&&e.getBoardId()?gt({boardPaths:n.boardPaths,getServerOrigin:n.getServerOrigin,boardId:e.getBoardId()}):null,E=St(),M=E.init({resolve:v=>r?.modelsById[v],chartLib:globalThis.Chart??null,markdown:globalThis.marked?v=>globalThis.marked.parse(v):null,sanitize:globalThis.DOMPurify?v=>globalThis.DOMPurify.sanitize(v):null,onPatchState:(v,A)=>e.patchCardState(v,A),onRefresh:v=>e.patchCardState(v,{}),onAction:(v,A,$)=>e.dispatchCardAction(v,A,$).then(()=>{}),startReceivingChats:v=>{e.subscribeCardChats(v);},stopReceivingChats:v=>{e.unsubscribeCardChats(v);},fileUrlBase:C||void 0});return S.innerHTML="",o=E.Board(M,S,{initialState:r,getNodeIds:v=>v.cardIds,selectNode:(v,A)=>v.modelsById[A],mode:y,canvas:h}),o}function s(d){return m.add(d),d(r),()=>{m.delete(d);}}function f(d){y=String(d||"board");let S=o&&o.core;S&&typeof S.setMode=="function"&&S.setMode(y);}function k(){if(!o)return;y="canvas";let d=o.core;d&&typeof d.setMode=="function"&&d.setMode("canvas"),d&&typeof d.autoLayout=="function"&&d.autoLayout();}function c(d){let S=o&&o.core;S&&typeof S.setDevMode=="function"&&S.setDevMode(!!d);}function w(){i(),m.clear(),o=null;}return {mountBoard:g,subscribe:s,getState:()=>r,getFullState:()=>e.getState(),getBoardId:()=>e.getBoardId(),getClientId:()=>e.getClientId(),getSseClientId:()=>e.getSseClientId(),patchCardState:(d,S)=>e.patchCardState(d,S),dispatchCardAction:(d,S,C)=>e.dispatchCardAction(d,S,C),uploadCardFile:(d,S,C)=>e.uploadCardFile(d,S,C),subscribeCardChats:d=>e.subscribeCardChats(d),unsubscribeCardChats:d=>e.unsubscribeCardChats(d),setMode:f,autoLayout:k,setDevMode:c,getCurrentMode:()=>y,dispose:w}}function De(t){let e=vt(t),n=Q({session:e,boardPaths:t.boardPaths,getServerOrigin:t.getServerOrigin});async function h(r){let o=String(r?.boardId||"default");return await e.bootstrap({boardId:o,taskExecutorPath:r?.taskExecutorPath}),n.mountBoard({rootElement:r.rootElement,mode:r.mode})}return {bootstrapBoard:h,dispose:()=>{n.dispose(),e.dispose();},setMode:r=>n.setMode(r),autoLayout:()=>n.autoLayout(),setDevMode:r=>n.setDevMode(r),getCurrentMode:()=>n.getCurrentMode(),getState:()=>e.getState(),getRuntimeSession:()=>e,createDerivedRuntime:(r={})=>Q({session:e,...r})}}exports.applyBoardNotifications=Be;exports.applyNotification=J;exports.buildBoardState=q;exports.buildFileUrlBase=gt;exports.createBoardRuntimeClient=De;exports.createBoardRuntimeSession=vt;exports.createDerivedBoardRuntime=Q;exports.defaultBoardPaths=xe;exports.deriveBoardState=H;exports.dispatchCardAction=yt;exports.patchCardState=mt;exports.pickBoardState=Oe;exports.prepareActionPayload=ht;exports.selectAllLiveCardModels=U;exports.selectLiveCardModel=x;exports.serverPayloadToBoardState=Ie;exports.singleBoardPaths=Ee;exports.subtractBoardState=Pe;exports.uploadCardFile=Z;return exports;})({});//# sourceMappingURL=board-livecards-client.js.map
|
|
2
2
|
//# sourceMappingURL=board-livecards-client.js.map
|