meshy-node 0.10.8 → 0.10.9

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Meshy Dashboard</title>
7
7
  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>&#x1F578;</text></svg>" />
8
- <script type="module" crossorigin src="/assets/index-BvnWYZW6.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-D260dUEm.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-By1kKB26.css">
10
10
  </head>
11
11
  <body>
package/main.cjs CHANGED
@@ -138761,11 +138761,12 @@ var DEFAULT_CONFIG = {
138761
138761
  dispatchTimeout: 1e4
138762
138762
  };
138763
138763
  var TaskDispatcher = class {
138764
- constructor(taskEngine, nodeRegistry, election, eventBus, config2, logger33, nodeMessageClient) {
138764
+ constructor(taskEngine, nodeRegistry, election, eventBus, config2, logger33, nodeMessageClient, localNodeMessageHandler) {
138765
138765
  this.taskEngine = taskEngine;
138766
138766
  this.nodeRegistry = nodeRegistry;
138767
138767
  this.election = election;
138768
138768
  this.eventBus = eventBus;
138769
+ this.localNodeMessageHandler = localNodeMessageHandler;
138769
138770
  this.config = { ...DEFAULT_CONFIG, ...config2 };
138770
138771
  this.log = logger33?.child("task-dispatcher") ?? { debug() {
138771
138772
  }, info() {
@@ -138775,10 +138776,7 @@ var TaskDispatcher = class {
138775
138776
  return this;
138776
138777
  } };
138777
138778
  this.messageClient = nodeMessageClient ?? new NodeMessageClient({ timeoutMs: this.config.dispatchTimeout, logger: logger33 });
138778
- this.onTaskAssigned = (data) => {
138779
- void this.dispatchTask(data.taskId, data.nodeId).catch(() => {
138780
- });
138781
- };
138779
+ this.onTaskAssigned = (data) => this.scheduleDispatch(data.taskId, data.nodeId);
138782
138780
  this.onElectionComplete = (data) => {
138783
138781
  const self2 = this.nodeRegistry.getSelf();
138784
138782
  if (data.leaderId === self2.id) {
@@ -138792,10 +138790,12 @@ var TaskDispatcher = class {
138792
138790
  nodeRegistry;
138793
138791
  election;
138794
138792
  eventBus;
138793
+ localNodeMessageHandler;
138795
138794
  config;
138796
138795
  log;
138797
138796
  messageClient;
138798
138797
  autoAssignTimer = null;
138798
+ pendingDispatchTimers = /* @__PURE__ */ new Set();
138799
138799
  running = false;
138800
138800
  onTaskAssigned;
138801
138801
  onElectionComplete;
@@ -138813,6 +138813,7 @@ var TaskDispatcher = class {
138813
138813
  this.eventBus.off("task.assigned", this.onTaskAssigned);
138814
138814
  this.eventBus.off("election.complete", this.onElectionComplete);
138815
138815
  this.stopAutoAssignLoop();
138816
+ this.clearPendingDispatchTimers();
138816
138817
  }
138817
138818
  // ── Dispatch ────────────────────────────────────────────────────────
138818
138819
  async dispatchTask(taskId, nodeId) {
@@ -138836,7 +138837,13 @@ var TaskDispatcher = class {
138836
138837
  endpoint: node2.endpoint,
138837
138838
  devtunnelEndpoint: node2.devtunnelEndpoint
138838
138839
  });
138839
- await this.messageClient.send(node2, createNodeMessage("task.execute", { task }));
138840
+ const message = createNodeMessage("task.execute", { task });
138841
+ if (node2.id === this.nodeRegistry.getSelf().id && this.localNodeMessageHandler) {
138842
+ await this.localNodeMessageHandler(message);
138843
+ this.log.info("task dispatch request accepted", { taskId, nodeId, local: true });
138844
+ return;
138845
+ }
138846
+ await this.messageClient.send(node2, message);
138840
138847
  this.log.info("task dispatch request accepted", { taskId, nodeId });
138841
138848
  } catch (err) {
138842
138849
  const message = err instanceof Error ? err.message : String(err);
@@ -138862,6 +138869,20 @@ var TaskDispatcher = class {
138862
138869
  this.autoAssignTimer = null;
138863
138870
  }
138864
138871
  }
138872
+ scheduleDispatch(taskId, nodeId) {
138873
+ const timer = setTimeout(() => {
138874
+ this.pendingDispatchTimers.delete(timer);
138875
+ void this.dispatchTask(taskId, nodeId).catch(() => {
138876
+ });
138877
+ }, 0);
138878
+ this.pendingDispatchTimers.add(timer);
138879
+ }
138880
+ clearPendingDispatchTimers() {
138881
+ for (const timer of this.pendingDispatchTimers) {
138882
+ clearTimeout(timer);
138883
+ }
138884
+ this.pendingDispatchTimers.clear();
138885
+ }
138865
138886
  };
138866
138887
 
138867
138888
  // ../../packages/core/src/cluster/heartbeat.ts
@@ -144630,14 +144651,15 @@ var MeshyNode = class {
144630
144651
  };
144631
144652
  this.nodeRegistry.setSelf(this.selfInfo);
144632
144653
  this.nodeRegistry.upsertNode(this.selfInfo);
144633
- this.heartbeat.setNodeMessageHandler((message) => handleLocalNodeMessage({
144654
+ const localNodeMessageHandler = (message) => handleLocalNodeMessage({
144634
144655
  taskEngine: this.taskEngine,
144635
144656
  engineRegistry: this.engineRegistry,
144636
144657
  nodeRegistry: this.nodeRegistry,
144637
144658
  eventBus: this.eventBus,
144638
144659
  logger: this.logger,
144639
144660
  getWorkDir: () => this.getWorkDir()
144640
- }, message));
144661
+ }, message);
144662
+ this.heartbeat.setNodeMessageHandler(localNodeMessageHandler);
144641
144663
  this.nodeMessageClient = new NodeMessageClient({ heartbeat: this.heartbeat, logger: this.logger });
144642
144664
  this.taskDispatcher = new TaskDispatcher(
144643
144665
  this.taskEngine,
@@ -144646,7 +144668,8 @@ var MeshyNode = class {
144646
144668
  this.eventBus,
144647
144669
  { autoAssignInterval: 5e3, dispatchTimeout: 1e4 },
144648
144670
  this.logger,
144649
- this.nodeMessageClient
144671
+ this.nodeMessageClient,
144672
+ localNodeMessageHandler
144650
144673
  );
144651
144674
  this.dataRouter = new DataRouter(this.nodeRegistry, this.election);
144652
144675
  const seeds = this.config.cluster.seeds;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meshy-node",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "private": false,
5
5
  "description": "Standalone Meshy node package with bundled runtime and dashboard assets.",
6
6
  "type": "commonjs",
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "packageName": "meshy-node",
3
- "packageVersion": "0.10.8",
3
+ "packageVersion": "0.10.9",
4
4
  "packages": {
5
5
  "workspace": {
6
6
  "name": "meshy",
7
- "version": "0.10.8"
7
+ "version": "0.10.9"
8
8
  },
9
9
  "node": {
10
10
  "name": "meshy-node",
11
- "version": "0.10.8"
11
+ "version": "0.10.9"
12
12
  },
13
13
  "core": {
14
14
  "name": "@meshy/core",
@@ -26,6 +26,6 @@
26
26
  "repository": {
27
27
  "url": "https://github.com/gim-home/meshy",
28
28
  "branch": "main",
29
- "commit": "38beb3c"
29
+ "commit": "95066c1"
30
30
  }
31
31
  }
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-91w4HaID.js","assets/index-BvnWYZW6.js","assets/index-By1kKB26.css","assets/MarkdownPreviewFrame-C56qjNyn.js","assets/DashboardShared-BfK1KyJO.js","assets/file-DQcCuz7j.js","assets/PreviewTab-DQ4yhJji.js"])))=>i.map(i=>d[i]);
2
- import{bk as S,r,j as e,L as T,R as C,bJ as P,a0 as M,a2 as E,ah as O,bK as I,bL as F,bM as y,bN as _,bO as L,ac as N,bP as q}from"./index-BvnWYZW6.js";import{E as A,F as R,z,y as D,m as B,C as G,o as w,w as U}from"./DashboardShared-BfK1KyJO.js";const V=r.lazy(async()=>({default:(await N(()=>import("./FilesTab-91w4HaID.js"),__vite__mapDeps([0,1,2,3,4,5]))).FilesTab})),W=r.lazy(async()=>({default:(await N(()=>import("./PreviewTab-DQ4yhJji.js").then(a=>a.c),__vite__mapDeps([6,1,2]))).PreviewTab})),H={getOutput:y,getOutputTree:F,getOutputContent:I},J={getOutput:y,createPreviewSession:(t,a)=>q(t,typeof a=="string"?a:a?.path)};function X(){const{shareId:t}=S(),[a,d]=r.useState(null),[c,s]=r.useState([]),[u,m]=r.useState(!0),[b,l]=r.useState(null),x=r.useRef(null);return r.useEffect(()=>{if(!t){d(null),s([]),l("Shared conversation not found"),m(!1);return}let i=!1;x.current=t,m(!0),l(null);const h=async o=>{try{const[p,f]=await Promise.all([_(t),L(t)]);if(i||x.current!==t)return;d(p),s(n=>o?f.logs:U(n,f.logs)),l(null)}catch(p){if(i||x.current!==t)return;o&&(d(null),s([]),l(p instanceof Error?p.message:"Failed to load shared conversation"))}finally{!i&&x.current===t&&o&&m(!1)}};h(!0);const g=window.setInterval(()=>{h(!1)},2500);return()=>{i=!0,window.clearInterval(g)}},[t]),e.jsx(K,{conversation:a,logs:c,loading:u,error:b})}function K({conversation:t,logs:a,loading:d,error:c}){const[s,u]=r.useState("transcript"),[m,b]=r.useState(null),[l,x]=r.useState(!1),i=r.useMemo(()=>{if(!t)return null;const n=A(t.payload.initialMessage);return n.length>0&&R(a,n)?null:n.length>0?z(n,new Date(t.createdAt).toISOString()):null},[t,a]),h=r.useMemo(()=>D([...i?[i]:[],...a]),[i,a]),g=r.useMemo(()=>B(h),[h]),o=t?.scope==="filesPreview",p=r.useCallback(n=>{o&&(b(v=>({path:n,requestId:(v?.requestId??0)+1})),u("files"))},[o]);r.useEffect(()=>{b(null)},[t?.shareId]);const f=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 bg-gradient-to-b from-background/15 via-transparent to-background/35 px-4 py-4 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-4 pb-16",children:[d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-border/60 bg-background/60 px-3 py-2 text-[11px] text-muted-foreground",children:[e.jsx(T,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!d&&c&&e.jsxs("div",{className:"rounded-sm border border-destructive/20 bg-destructive/10 px-3 py-4 text-center text-destructive",children:[e.jsx("div",{className:"text-[12px] font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-1 text-[11px]",children:c})]}),!d&&!c&&h.length===0&&e.jsxs("div",{className:"rounded-sm border border-dashed border-border/70 bg-background/35 px-3 py-4 text-center",children:[e.jsx(C,{className:"mx-auto h-5 w-5 text-muted-foreground"}),e.jsx("div",{className:"mt-2 text-[12px] font-medium text-foreground",children:"No transcript output yet"})]}),!d&&!c&&g.map(({event:n,subItems:v},k)=>e.jsx(G,{event:n,agent:t?.agent,subItems:v,onOpenFilePath:p,questionResponseDisabled:!0},`shared-${k}`))]})});return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[e.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),e.jsxs("div",{className:"relative z-10 flex h-full min-h-0 gap-2 px-2 py-2 sm:px-3",children:[e.jsxs("aside",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle hidden w-64 shrink-0 flex-col overflow-hidden rounded-sm px-3 py-3 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm border border-border/70 bg-foreground text-[11px] font-semibold tracking-[0.24em] text-background shadow-none",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared view"})]})]}),e.jsx("div",{className:"mt-4 text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-2 space-y-2.5",children:[e.jsx("h1",{className:"max-h-24 overflow-hidden break-words text-[13px] font-semibold leading-5 text-foreground [overflow-wrap:anywhere]",title:t.title,children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(P,{status:t.status}),e.jsx(M,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[e.jsxs("div",{children:["updated ",E(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]}),e.jsxs("div",{className:"mt-auto space-y-2 pt-6",children:[l&&e.jsx("div",{className:"rounded-sm border border-border/70 bg-background/80 p-2.5 font-mono text-[11px] text-foreground shadow-none",children:"npx -y meshy-node@latest start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:"https://github.com/gim-home/meshy",target:"_blank",rel:"noreferrer","aria-label":"Open Meshy on GitHub",className:"inline-flex h-8 w-8 items-center justify-center rounded-sm border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(Z,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>x(n=>!n),"aria-expanded":l,className:"inline-flex h-8 items-center gap-1.5 rounded-sm border border-border/70 bg-background/70 px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(O,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"dashboard-panel animate-panel-settle flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-sm",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/55 bg-card/28 px-3 py-2 sm:px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm border border-border/70 bg-foreground text-[11px] font-semibold tracking-[0.24em] text-background lg:hidden",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:t?.title??"Shared conversation"})]})]}),o&&e.jsxs("div",{className:"mt-3 inline-flex h-7 rounded-sm border border-border/55 bg-background/35 p-0.5 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>u("transcript"),"aria-current":s==="transcript"?"page":void 0,className:j(s==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>u("files"),"aria-current":s==="files"?"page":void 0,className:j(s==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>u("preview"),"aria-current":s==="preview"?"page":void 0,className:j(s==="preview"),children:"Preview"})]})]}),o&&t?e.jsxs(e.Fragment,{children:[s==="transcript"&&f,s==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading files..."}),children:e.jsx(V,{taskId:t.shareId,api:H,requestedFilePath:m?.path??null,requestedFileRequestId:m?.requestId??0})})}),s==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading preview..."}),children:e.jsx(W,{taskId:t.shareId,api:J,allowPortPreview:!1})})})]}):f]})]})]})}function j(t){return t?"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-primary/30 bg-primary/10 px-2.5 text-[11px] font-medium text-primary shadow-none":"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-transparent px-2.5 text-[11px] font-medium transition-colors hover:bg-muted/35 hover:text-foreground"}function Z({className:t}){return e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.23c0 4.51 2.87 8.34 6.84 9.7.5.1.68-.22.68-.49 0-.24-.01-.88-.01-1.73-2.78.62-3.37-1.37-3.37-1.37-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.55-1.14-4.55-5.05 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.31.1-2.71 0 0 .84-.27 2.75 1.05A9.3 9.3 0 0 1 12 6.96c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.4.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.92-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.37-.01 2.47-.01 2.81 0 .27.18.59.69.49A10.05 10.05 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z"})})}export{X as SharedConversationPage,K as SharedConversationView};