beeos-claw 0.6.97 → 0.6.98

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.
@@ -1 +1 @@
1
- import{isDeepStrictEqual}from"node:util";import{centralApprovalGate}from"./central-native-interactions.js";import{CENTRAL_NATIVE_ENGINE_ID,CentralNativeContextEngine,assertCentralNativeReceipt}from"./central-native-context-engine.js";let current;export function installCentralNativeRuntime(e){if(current)throw new Error("central native runtime already installed");const n=new Map,t=new Set,r=new Map;let i=!1;const o=new CentralNativeContextEngine({store:e.store,pending:e.pending,resolveBinding:e=>{const t=n.get(e);if(!t)throw new Error("central native session has no authorized binding");return t},compact:n=>e.host.compactNativeTranscript(n),readNativeEvents:async n=>e.host.readNativeTranscript({sessionKey:n}),onReceipt:(e,n)=>{r.get(e.operationId)?.terminal&&!n.terminal||r.set(e.operationId,n)}}),s=async(r,s,a)=>{if(i)throw new Error("central native admission is closed for drain");if(t.delete(r),a&&(0!==(await e.pending.list(s.sessionId)).length||0!==e.host.pendingNativeTurns({sessionKey:r})))throw new Error("prior native owner must drain pending writes before read-only preparation");n.set(r,structuredClone(s));let c=await o.hydrateNativeSession({sessionKey:r});if(a||0===e.host.pendingNativeTurns({sessionKey:r})||(await e.host.drainNativeTurns({sessionKey:r,engine:o.forBindings(()=>structuredClone(s))}),c=await o.hydrateNativeSession({sessionKey:r})),await e.host.replaceNativeTranscript({sessionKey:r,events:c.events}),!isDeepStrictEqual(e.host.readNativeTranscript({sessionKey:r}),c.events))throw new Error("native host did not reconstruct the exact central transcript");t.add(r)};return current={get engine(){if(i)throw new Error("central native admission is closed for drain");const e=new Map([...n].map(([e,n])=>[e,structuredClone(n)]));return o.forBindings(n=>{const t=e.get(n);if(!t)throw new Error("central native run has no pinned session authority");return t})},prepare:(e,n)=>s(e,n,!1),prepareReadOnly:(e,n)=>s(e,n,!0),readEvents(n){if(!t.has(n))throw new Error("central native session is not prepared");return e.host.readNativeTranscript({sessionKey:n,visibleOnly:!0})},receipt:e=>r.get(e),source:e=>o.source(e),bindExecutionObservation:(n,t)=>e.observe(n,t),async drain(){if(i=!0,0!==e.activeWriters())throw new Error("native writers have not quiesced");for(const t of await e.pending.list()){const r=[...n.values()].find(e=>e.sessionId===t.binding.sessionId);if(!r)throw new Error("pending native append has no current authorized session");const i=await e.store.receipt({...t,binding:{...t.binding,context:r.context}});if(!i)throw new Error("native append drain outcome is unknown");assertCentralNativeReceipt(t,i),await e.pending.complete(t,i)}const t=[];for(const[r,i]of n){if(!e.host.nativeWritersQuiescent({sessionKey:r}))throw new Error("native session writer is still admitted");if(await o.hydrateNativeSession({sessionKey:r}),await e.host.drainNativeTurns({sessionKey:r,engine:o.forBindings(()=>structuredClone(i))}),0!==e.host.pendingNativeTurns({sessionKey:r}))throw new Error("native accepted-turn outbox has pending writes");const n=await e.store.load(i);t.push({sessionId:i.sessionId,historyGeneration:i.historyGeneration,branchId:i.branchId,watermark:n.watermark})}if(0!==e.activeWriters()||0!==(await e.pending.list()).length)throw new Error("native writes appeared during drain");return{pendingWrites:0,sourceWatermarks:t}}},current}export function centralNativeRuntime(){if(!current)throw new Error("central native SDK/store startup composition is unavailable");return current}export function centralNativeChatEnabled(e=process.env){return"honcho"===e.BEEOS_CHAT_STORE}const unsupportedCentralNativeTools=new Set(["memory_search","memory_get","cron","beeos_automation_create","beeos_automation_create_webhook","beeos_automation_run","sessions_spawn","sessions_send","conversations_turn","conversations_send","subagents"]);export function centralNativeToolFence(e){if(!e||"object"!=typeof e)return;const n=e.toolName;return"string"==typeof n&&unsupportedCentralNativeTools.has(n)?{block:!0,blockReason:"Central Memory/background execution producer is unavailable for this native tool"}:void 0}export function registerCentralNativeContextEngine(e){if(centralNativeChatEnabled()){if(!e.registerContextEngine||!e.on)throw new Error("pinned central context engine/tool policy registration API unavailable");e.on("before_tool_call",centralNativeToolFence),e.on("before_tool_call",centralApprovalGate),e.registerContextEngine(CENTRAL_NATIVE_ENGINE_ID,()=>centralNativeRuntime().engine)}}
1
+ import{isDeepStrictEqual}from"node:util";import{centralApprovalGate}from"./central-native-interactions.js";import{CENTRAL_NATIVE_ENGINE_ID,CentralNativeContextEngine,assertCentralNativeReceipt}from"./central-native-context-engine.js";let current;export function installCentralNativeRuntime(e){if(current)throw new Error("central native runtime already installed");const n=new Map,t=new Set,r=new Map;let i=!1;const o=new CentralNativeContextEngine({store:e.store,pending:e.pending,resolveBinding:e=>{const t=n.get(e);if(!t)throw new Error("central native session has no authorized binding");return t},compact:n=>e.host.compactNativeTranscript(n),readNativeEvents:async n=>e.host.readNativeTranscript({sessionKey:n}),onReceipt:(e,n)=>{r.get(e.operationId)?.receipt.terminal&&!n.terminal||r.set(e.operationId,structuredClone({binding:e,receipt:n}))}}),s=async(r,s,a)=>{if(i)throw new Error("central native admission is closed for drain");if(t.delete(r),a&&(0!==(await e.pending.list(s.sessionId)).length||0!==e.host.pendingNativeTurns({sessionKey:r})))throw new Error("prior native owner must drain pending writes before read-only preparation");n.set(r,structuredClone(s));let c=await o.hydrateNativeSession({sessionKey:r});if(a||0===e.host.pendingNativeTurns({sessionKey:r})||(await e.host.drainNativeTurns({sessionKey:r,engine:o.forBindings(()=>structuredClone(s))}),c=await o.hydrateNativeSession({sessionKey:r})),await e.host.replaceNativeTranscript({sessionKey:r,events:c.events}),!isDeepStrictEqual(e.host.readNativeTranscript({sessionKey:r}),c.events))throw new Error("native host did not reconstruct the exact central transcript");t.add(r)};return current={get engine(){if(i)throw new Error("central native admission is closed for drain");const e=new Map([...n].map(([e,n])=>[e,structuredClone(n)]));return o.forBindings(n=>{const t=e.get(n);if(!t)throw new Error("central native run has no pinned session authority");return t})},prepare:(e,n)=>s(e,n,!1),prepareReadOnly:(e,n)=>s(e,n,!0),readEvents(n){if(!t.has(n))throw new Error("central native session is not prepared");return e.host.readNativeTranscript({sessionKey:n,visibleOnly:!0})},receipt:e=>{const n=r.get(e);return n?structuredClone(n.receipt):void 0},source:e=>o.source(e),bindExecutionObservation:(n,t)=>e.observe(n,t),async drain(){if(i=!0,0!==e.activeWriters())throw new Error("native writers have not quiesced");for(const t of await e.pending.list()){const r=[...n.values()].find(e=>e.sessionId===t.binding.sessionId);if(!r)throw new Error("pending native append has no current authorized session");const i=await e.store.receipt({...t,binding:{...t.binding,context:r.context}});if(!i)throw new Error("native append drain outcome is unknown");assertCentralNativeReceipt(t,i),await e.pending.complete(t,i)}const t=[];for(const[i,s]of n){if(!e.host.nativeWritersQuiescent({sessionKey:i}))throw new Error("native session writer is still admitted");const n=r.get(s.operationId);if(n?.receipt.terminal?.response_id===s.responseId&&isDeepStrictEqual(n.binding,s)&&0===e.host.pendingNativeTurns({sessionKey:i})){t.push({sessionId:s.sessionId,historyGeneration:s.historyGeneration,branchId:s.branchId,watermark:n.receipt.read_watermark});continue}if(await o.hydrateNativeSession({sessionKey:i}),await e.host.drainNativeTurns({sessionKey:i,engine:o.forBindings(()=>structuredClone(s))}),0!==e.host.pendingNativeTurns({sessionKey:i}))throw new Error("native accepted-turn outbox has pending writes");const a=await e.store.load(s);t.push({sessionId:s.sessionId,historyGeneration:s.historyGeneration,branchId:s.branchId,watermark:a.watermark})}const s=await e.pending.list();if(0!==e.activeWriters()||0!==s.length)throw new Error("native writes appeared during drain");for(const t of n.keys())if(!e.host.nativeWritersQuiescent({sessionKey:t})||0!==e.host.pendingNativeTurns({sessionKey:t}))throw new Error("native session writes appeared during drain");return{pendingWrites:0,sourceWatermarks:t}}},current}export function centralNativeRuntime(){if(!current)throw new Error("central native SDK/store startup composition is unavailable");return current}export function centralNativeChatEnabled(e=process.env){return"honcho"===e.BEEOS_CHAT_STORE}const unsupportedCentralNativeTools=new Set(["memory_search","memory_get","cron","beeos_automation_create","beeos_automation_create_webhook","beeos_automation_run","sessions_spawn","sessions_send","conversations_turn","conversations_send","subagents"]);export function centralNativeToolFence(e){if(!e||"object"!=typeof e)return;const n=e.toolName;return"string"==typeof n&&unsupportedCentralNativeTools.has(n)?{block:!0,blockReason:"Central Memory/background execution producer is unavailable for this native tool"}:void 0}export function registerCentralNativeContextEngine(e){if(centralNativeChatEnabled()){if(!e.registerContextEngine||!e.on)throw new Error("pinned central context engine/tool policy registration API unavailable");e.on("before_tool_call",centralNativeToolFence),e.on("before_tool_call",centralApprovalGate),e.registerContextEngine(CENTRAL_NATIVE_ENGINE_ID,()=>centralNativeRuntime().engine)}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beeos-claw",
3
- "version": "0.6.97",
3
+ "version": "0.6.98",
4
4
  "description": "OpenClaw plugin that bridges the BeeOS platform with the local OpenClaw Gateway, providing file transfer, ACP bridge, and observability.",
5
5
  "license": "MIT",
6
6
  "author": "BeeOS <dev@beeos.ai>",
@@ -93,5 +93,5 @@
93
93
  "zod": "4.6.7",
94
94
  "qs": "6.16.1"
95
95
  },
96
- "gitHead": "b756df64b68b385149d4a3e66d27671549900f94"
96
+ "gitHead": "9ff38e927d3d956c00cdd7db0d434e68dd4e8440"
97
97
  }