omo-ai 5.1.63 → 5.1.64
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/bin/darwin/omo-keychain +0 -0
- package/bin/lib/engine-boot.js +27 -0
- package/bin/lib/launcher.js +23 -0
- package/bin/lib/memory-sync-boot.js +19 -0
- package/bin/lib/service-auth.generated.js +1 -1
- package/package.json +1 -1
- package/plugin/CHANGELOG.md +32 -0
- package/plugin/extensions/gateway-store-worker.mjs +2 -2
- package/plugin/extensions/memory-run-supervisor.mjs +1 -1
- package/plugin/extensions/omo-claim-receipt.js +1 -1
- package/plugin/extensions/omo-computer-use.js +1 -1
- package/plugin/extensions/omo-desktop-toolkit.js +1 -1
- package/plugin/extensions/omo-device-account.js +2 -2
- package/plugin/extensions/omo-device-service.js +2 -2
- package/plugin/extensions/omo-feedback.js +2 -2
- package/plugin/extensions/omo-init-deep-advisor.js +1 -1
- package/plugin/extensions/omo-member.js +1 -1
- package/plugin/extensions/omo-memory-commands.js +3 -3
- package/plugin/extensions/omo-memory-doctor.js +3 -3
- package/plugin/extensions/omo-memory-memfs.js +3 -3
- package/plugin/extensions/omo-memory-palace.js +3 -3
- package/plugin/extensions/omo-memory-sync.js +2 -2
- package/plugin/extensions/omo-onboarding-scan.js +3 -3
- package/plugin/extensions/omo-recall-store.js +1 -1
- package/plugin/extensions/omo-session-history.js +1 -1
- package/plugin/extensions/omo-side-panel.js +1 -1
- package/plugin/extensions/omo-task.js +1 -1
- package/plugin/extensions/omo-telemetry-otlp.js +1 -1
- package/plugin/extensions/omo-telemetry-posthog.js +1 -1
- package/plugin/extensions/omo-telemetry-recovery.js +1 -1
- package/plugin/extensions/omo-thread-client.js +1 -1
- package/plugin/extensions/omo.js +3 -3
- package/plugin/package.json +1 -1
- package/plugin/runtime/agent-toolkit-sdk/sdk.js +2 -2
- package/plugin/runtime/ast-grep-mcp/manifest.json +1 -1
- package/plugin/runtime/bunshin-ts/sdk.js +2 -2
- package/plugin/runtime/rollback-migrate.js +1 -1
- package/plugin/runtime/thread-sdk/sdk.js +2 -2
- package/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// omo:
|
|
1
|
+
// omo:nWS6JVwNI9g8S14N_CjEff16pPyBr0e5vuw1_c9OOtU:qHD4fZafaB4yalXv2n106fJmoV6hsnrT8L1o_EFNETc
|
|
2
2
|
import{isAbsolute as t}from"node:path";function e(t,e,o){void 0===t.deferStartupWork?o():t.deferStartupWork(e,o)}import{readFile as o}from"node:fs/promises";function r(t){if("object"!=typeof t||null===t||Array.isArray(t))throw Error("invalid desktop toolkit response");return t}async function i(t,e,i,n){let a=AbortSignal.timeout(e),s=void 0===n?a:AbortSignal.any([a,n]),l=(await o(t.tokenFile,{encoding:"utf8",signal:s})).trim();if(0===l.length)throw Error("desktop toolkit credential unavailable");let d=new Headers({Authorization:`Bearer ${l}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"}),c=0;async function u(e,o,i=!1){let n=c++,a=await fetch(t.endpoint,{method:"POST",headers:d,redirect:"error",signal:s,body:JSON.stringify({jsonrpc:"2.0",...i?{}:{id:n},method:e,params:o})});if(!a.ok)throw await(a.body?.cancel()),Error("desktop toolkit HTTP request failed");if("initialize"===e){let t=a.headers.get("mcp-session-id");null!==t&&d.set("Mcp-Session-Id",t)}if(i)return await(a.body?.cancel()),{};let u=await async function(t,e){let o=t.headers.get("content-type")?.split(";")[0]?.trim();if("application/json"===o){let o=r(await t.json());if("2.0"!==o.jsonrpc||o.id!==e)throw Error("invalid desktop toolkit response id");return o}if("text/event-stream"!==o||null===t.body)throw Error("invalid desktop toolkit response type");let i=t.body.getReader(),n=new TextDecoder,a="",s=[];try{for(;;){let t=await i.read();if(t.done)throw Error("desktop toolkit stream ended without a response");for(a+=n.decode(t.value,{stream:!0});;){let t=a.search(/[\r\n]/);if(t<0||"\r"===a[t]&&t===a.length-1)break;let o=a.slice(0,t);if(a=a.slice(t+("\r\n"===a.slice(t,t+2)?2:1)),""===o){if(0===s.length)continue;let t=r(JSON.parse(s.join("\n")));if(s=[],"2.0"===t.jsonrpc&&t.id===e)return t}else("data"===o||o.startsWith("data:"))&&s.push(o.slice(5).replace(/^ /,""))}}}finally{await i.cancel(),i.releaseLock()}}(a,n);if("error"in u)throw Error("desktop toolkit RPC request failed");let p=r(u.result);if(JSON.stringify(p).includes(l))throw Error("desktop toolkit response contains a credential");return p}try{let t=await u("initialize",{protocolVersion:"2025-03-26",capabilities:{extensions:{"senpi/host-tools":{}}},clientInfo:{name:"omo-desktop-thread",version:"1"}});if("string"!=typeof t.protocolVersion)throw Error("missing desktop toolkit protocol version");return d.set("MCP-Protocol-Version",t.protocolVersion),await u("notifications/initialized",void 0,!0),await i(u)}finally{if(d.has("Mcp-Session-Id"))try{await((await fetch(t.endpoint,{method:"DELETE",headers:d,redirect:"error",signal:AbortSignal.timeout(2e3)})).body?.cancel())}catch{}}}function n(t){let e=r(t),{name:o,label:i,exposure:n,allowLazyActivation:a,searchKeywords:s}=r(e["senpi/host-tool"]);if("string"!=typeof o||!/^[a-zA-Z0-9_-]{1,64}$/.test(o)||"string"!=typeof i)throw Error("invalid host tool identity");if(void 0!==n&&"direct"!==n&&"search"!==n&&"eval"!==n&&"model-only"!==n&&"hidden"!==n)throw Error("invalid host tool exposure");if(void 0!==a&&"boolean"!=typeof a)throw Error("invalid host tool activation");if(!(void 0===s||Array.isArray(s)&&s.every(t=>"string"==typeof t)))throw Error("invalid host tool search keywords");return{name:o,label:i,...void 0===n?{}:{exposure:n},...void 0===a?{}:{allowLazyActivation:a},...void 0===s?{}:{searchKeywords:s}}}var a="senpi:host-tool-route";function s(){return Object.assign(Error("The host could not serve this call."),{name:"HostToolRouteUnavailable"})}async function l(t,e,o,n,a,l=!1){if(l&&a?.aborted)throw new DOMException("Desktop toolkit call aborted.","AbortError");if(void 0===t){if(l)throw s();return{isError:!0,content:[{type:"text",text:"Desktop thread toolkit is not granted to the calling session."}],details:{reason:"no_session_grant"}}}let d=AbortSignal.timeout(n),c=void 0===a?d:AbortSignal.any([d,a]);try{let a=await i(t,n,t=>t("tools/call",{name:e,arguments:o}),c);if(!Array.isArray(a.content)||void 0!==a.isError&&"boolean"!=typeof a.isError)throw Error("invalid desktop toolkit content");if(l){if(!0===a.isError)return{isError:!0,content:a.content,details:{}};let t=r(r(a._meta)["senpi/tool-result-details"]);return{content:a.content,details:t}}return{...a,details:{}}}catch{if(l&&c.aborted)throw new DOMException("Desktop toolkit call aborted.","AbortError");if(l)throw s();return{isError:!0,content:[{type:"text",text:"Desktop thread toolkit call failed."}],details:{reason:"call_failed"}}}}function d(t){if("object"!=typeof t||null===t||!("sessionManager"in t))return;let e=t.sessionManager;if("object"!=typeof e||null===e||!("getSessionId"in e)||"function"!=typeof e.getSessionId)return;let o=e.getSessionId();return"string"==typeof o&&o.length>0?o:void 0}var c=()=>import("@code-yeongyu/senpi");function u(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function p(t,e,o=c){t.rpc?.handle?.("omo.toolkit.executeHostTool",async(r,i)=>{let n=function(t){if(!u(t)||"show_html_page"!==t.name||!u(t.args))return;let{html:e,title:o,height:r}=t.args;return"string"!=typeof e||0===e.length||"string"!=typeof o||0===o.length||o.length>200||void 0!==r&&!Number.isInteger(r)?void 0:{name:"show_html_page",args:"number"==typeof r?{html:e,title:o,height:r}:{html:e,title:o}}}(r);if(void 0===n||!e.has(n.name)||void 0===t.cwd||"function"!=typeof i?.admit)return{isError:!0,content:[{type:"text",text:"The host tool is not available to this session."}],details:{}};let a=t.cwd;try{let t=await o();if("object"!=typeof t||null===t||!("writeHtmlPage"in t)||"function"!=typeof t.writeHtmlPage)throw Error("The pinned SDK does not provide writeHtmlPage.");let e=t.writeHtmlPage;return await i.admit(()=>e(n.args,a))}catch(t){if(!(t instanceof Error))throw t;return{isError:!0,content:[{type:"text",text:t.message}],details:{}}}})}var f=[1,2,4],h=["thread","host"],g={type:"object",properties:{op:{type:"string",enum:["acquire"]},toolkit:{type:"string"}},required:["op","toolkit"],additionalProperties:!1};function m(t){return{content:[{type:"text",text:JSON.stringify(t)}],details:t}}function y(t){if("object"!=typeof t||null===t)return new Set;let e=t.omo_toolkits;return"string"!=typeof e?new Set:new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))}function v(t){t.failed=!0,t.failures+=1,t.turnsSinceFailure=0,t.running=void 0}function k(t){t.turnsSinceFailure+=1;let e=f[t.failures-1];return void 0!==e&&t.turnsSinceFailure>=e}function w(o={}){let s=o.timeoutMs??15e3;return{name:"desktop-toolkit",register(c,u){if("function"!=typeof c.registerTool)return;let f=new Map,w=new Map,b=new Map,_=new Set,S="object"==typeof c.sessionContext&&null!==c.sessionContext&&"host_tool_names"in c.sessionContext&&"string"==typeof c.sessionContext.host_tool_names?new Set(c.sessionContext.host_tool_names.split(",").map(t=>t.trim()).filter(Boolean)):new Set;p(c,S,o.loadSdk);let E=function(t,e){let o=new Map;function r(r){for(let[e,i]of o)i.sessionId===r&&(o.delete(e),t.events?.emit(a,{name:e}));e.grants.delete(`host:${r}`)}return{clear:r,set(i,n,s){let c=o.get(i);void 0!==c&&c.sessionId!==s&&r(c.sessionId);let u={sessionId:s};o.set(i,u),t.events?.emit(a,{name:i,async execute(t,a,s,c,p){let f=d(p),h=void 0===f?void 0:e.grants.get(`host:${f}`);try{return await l(h,n,a,e.timeoutMs,s,!0)}catch(t){throw t instanceof Error&&"HostToolRouteUnavailable"===t.name&&o.get(i)===u&&(r(u.sessionId),e.onLost(u.sessionId)),t}}})}}}(c,{grants:b,timeoutMs:s,onLost(t){let e=w.get(`host:${t}`);void 0!==e&&v(e)}});async function x(t,e){if(e?.aborted)return{ok:!1,reason:"cancelled"};if(void 0===c.rpc||!y(c.sessionContext).has(t))return{ok:!1,reason:"unavailable"};let o=crypto.randomUUID();return new Promise(r=>{let i=setTimeout(()=>a({ok:!1,reason:"timeout"}),s),n=()=>a({ok:!1,reason:"cancelled"}),a=t=>{clearTimeout(i),f.delete(o),e?.removeEventListener("abort",n),r(t)};f.set(o,a),e?.addEventListener("abort",n,{once:!0}),c.rpc?.emit("omo.toolkit.request",{requestId:o,toolkit:t})})}async function A(t,e){if(e.controller.signal.aborted||b.has(`${e.toolkit}:${t}`))return;if(void 0!==e.running)return e.running;e.startupPending=!1;let o=async function(t,e){let o=e.controller.signal;try{let a=await x(e.toolkit,o);if(o.aborted)return;if(!a.ok)return v(e),void u.logger.info("desktop thread toolkit unavailable",{reason:"timeout"===a.reason?"timeout":"grant_refused"});let p=await function(t,e,o,a){return i(t,e,async t=>{let e,o=[];do{let i=await t("tools/list",void 0===e?void 0:{cursor:e});if(!Array.isArray(i.tools))throw Error("invalid desktop toolkit tools");for(let t of i.tools){if("object"!=typeof t||null===t||Array.isArray(t)){a?.("invalid_descriptor");continue}let e,i=r(t);try{e="object"==typeof i._meta&&null!==i._meta&&"senpi/host-tool"in i._meta?n(i._meta):void 0}catch{a?.("invalid_descriptor");continue}if("string"!=typeof i.name||0===i.name.length||!/^[a-zA-Z0-9_-]{1,64}$/.test(void 0===e?`desktop_${i.name}`:i.name)){a?.("invalid_name");continue}if("object"!=typeof i.inputSchema||null===i.inputSchema||Array.isArray(i.inputSchema)||!("type"in i.inputSchema)||"object"!==i.inputSchema.type){a?.("invalid_schema");continue}if(void 0!==i.description&&"string"!=typeof i.description){a?.("invalid_descriptor");continue}let s=r(i.inputSchema);o.push({name:i.name,inputSchema:s,...void 0===i.description?{}:{description:i.description},...void 0===e?{}:{attachment:e}})}if(void 0!==i.nextCursor&&"string"!=typeof i.nextCursor)throw Error("invalid desktop toolkit cursor");e=i.nextCursor}while(void 0!==e);return o},o)}(a.grant,s,o,t=>u.logger.info("desktop thread toolkit skipped tool",{reason:t}));if(o.aborted)return;e.failed=!1,e.failures=0,b.set(`${e.toolkit}:${t}`,a.grant);for(let o of p){let r=o.attachment;if("host"===e.toolkit){if(void 0===r||!S.has(r.name))continue;E.set(r.name,o.name,t);continue}if(void 0!==r)continue;let i=`desktop_${o.name}`;if(_.has(i))continue;let n="getAllTools"in c&&"function"==typeof c.getAllTools?c.getAllTools():[];Array.isArray(n)&&n.some(t=>"object"==typeof t&&null!==t&&"name"in t&&t.name===i)||(c.registerTool({name:i,label:i,description:o.description??"",parameters:o.inputSchema,async execute(t,e,r,i,n){let a=d(n);return l(void 0===a?void 0:b.get(`thread:${a}`),o.name,e,s,r)}}),_.add(i))}}catch{if(o.aborted)return;v(e),u.logger.info("desktop thread toolkit unavailable",{reason:"discovery_failed"})}}(t,e).finally(()=>{e.running===o&&(e.running=void 0)});return e.running=o,o}c.registerTool({name:"omo_desktop_toolkit",label:"Desktop toolkit",description:"Internal channel for skills: ask the app for a toolkit it hosts for this thread, such as its in-app browser. Not for direct use.",parameters:g,exposure:"eval",permissionParser:()=>[],executionMode:"parallel",async execute(t,e){let o="string"==typeof e.toolkit?e.toolkit:"";return"acquire"!==e.op||""===o?m({ok:!1,reason:"invalid_request"}):m(await x(o))}}),c.rpc?.handle?.("omo.toolkit.grant",e=>{let o="object"==typeof e&&null!==e?e:{},r="string"==typeof o.requestId?f.get(o.requestId):void 0;if(void 0===r)return{accepted:!1};let i=function(e){if("object"!=typeof e||null===e)return;let{endpoint:o,tokenFile:r}=e;if("string"==typeof o&&"string"==typeof r&&t(r)){try{let t=new URL(o);if("http:"!==t.protocol||"127.0.0.1"!==t.hostname||""!==t.username||""!==t.password||""!==t.search)return}catch{return}return{endpoint:o,tokenFile:r}}}(o.grant);if(void 0!==i)return r({ok:!0,grant:i}),{accepted:!0};let n=o.refusal;return r({ok:!1,reason:"object"==typeof n&&null!==n&&"string"==typeof n.reason?String(n.reason):"invalid_grant"}),{accepted:!0}}),c.on("session_start",(t,o)=>{let r=y(c.sessionContext),i=h.filter(t=>r.has(t));if(void 0===c.rpc||0===i.length)return void u.logger.debug?.("desktop thread toolkit unavailable",{reason:"not_offered"});let n=d(o);if(void 0!==n)for(let t of i){let o=`${t}:${n}`;if(w.has(o))continue;let r={toolkit:t,controller:new AbortController,startupPending:!0,failed:!1,failures:0,turnsSinceFailure:0};w.set(o,r),e(u,"desktop thread toolkit",()=>r.startupPending?A(n,r):void 0)}else u.logger.info("desktop thread toolkit unavailable",{reason:"missing_session"})}),c.on("before_agent_start",(t,e)=>{if(function(t){return"object"==typeof t&&null!==t&&"preview"in t&&!0===t.preview}(t))return;let o=d(e);if(void 0===o)return;let r=[];for(let t of h){let e=w.get(`${t}:${o}`);void 0!==e&&(e.failed?void 0===e.running&&k(e)&&A(o,e):r.push(A(o,e)))}return Promise.all(r)},{previewSafe:!0}),c.on("session_shutdown",(t,e)=>{let o=d(e);if(void 0!==o){for(let t of h){let e=`${t}:${o}`;w.get(e)?.controller.abort(),w.delete(e),b.delete(e)}E.clear(o)}})}}}export{w as createDesktopToolkitRuntime};
|