@slayzone/computer 0.38.1 → 0.38.2

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/dist/bin.cjs CHANGED
@@ -36092,10 +36092,10 @@ var init_agent_hooks = __esm({
36092
36092
  }
36093
36093
  });
36094
36094
 
36095
- // raw-import:/tmp/slz-publish-wt.iLV7LJ/packages/shared/hooks/src/notify.sh
36095
+ // raw-import:/tmp/slz-publish-wt.iZhrEW/packages/shared/hooks/src/notify.sh
36096
36096
  var notify_default;
36097
36097
  var init_notify = __esm({
36098
- "raw-import:/tmp/slz-publish-wt.iLV7LJ/packages/shared/hooks/src/notify.sh"() {
36098
+ "raw-import:/tmp/slz-publish-wt.iZhrEW/packages/shared/hooks/src/notify.sh"() {
36099
36099
  notify_default = `#!/bin/sh
36100
36100
  # SlayZone agent lifecycle hook \u2014 BENIGN DUMB FORWARDER.
36101
36101
  #
@@ -36257,10 +36257,10 @@ exit 0
36257
36257
  }
36258
36258
  });
36259
36259
 
36260
- // raw-import:/tmp/slz-publish-wt.iLV7LJ/packages/shared/hooks/src/opencode-plugin.js
36260
+ // raw-import:/tmp/slz-publish-wt.iZhrEW/packages/shared/hooks/src/opencode-plugin.js
36261
36261
  var opencode_plugin_default;
36262
36262
  var init_opencode_plugin = __esm({
36263
- "raw-import:/tmp/slz-publish-wt.iLV7LJ/packages/shared/hooks/src/opencode-plugin.js"() {
36263
+ "raw-import:/tmp/slz-publish-wt.iZhrEW/packages/shared/hooks/src/opencode-plugin.js"() {
36264
36264
  opencode_plugin_default = "// SlayZone opencode plugin v1\n//\n// Forwards OpenCode SDK session lifecycle events to the SlayZone agent-hook\n// notify script over a local shell exec. Plugin is loaded by OpenCode from\n// ${XDG_CONFIG_HOME:-~/.config}/opencode/plugin/slayzone-notify.js\n//\n// The {{NOTIFY_PATH}} placeholder is substituted by the SlayZone installer\n// (packages/apps/app/src/main/agent-hooks/opencode-plugin-installer.ts) at\n// install time with the absolute path to `~/.slayzone/hooks/notify.sh`.\n//\n// Behavior:\n// - No-op when SLAYZONE_TASK_ID is unset (plugin only fires inside SlayZone PTYs).\n// - Subagent (child session) events are suppressed \u2014 oh-my-opencode + similar\n// tools spawn many child sessions and would otherwise flap Start/Stop.\n// - On client.session.list() error, sessions are assumed CHILD (safer to\n// suppress than emit a false-positive Start/Stop).\n// - Handles both modern (session.status w/ nested type) and legacy\n// (session.busy / session.idle) event shapes for forward compat.\n// - Singleton guard prevents double-load if OpenCode re-imports the plugin.\n\nexport const SlayzoneNotifyPlugin = async ({ $, client }) => {\n if (globalThis.__slayzoneOpencodePluginV1) return {}\n globalThis.__slayzoneOpencodePluginV1 = true\n if (!process?.env?.SLAYZONE_TASK_ID) return {}\n\n const notifyPath = '{{NOTIFY_PATH}}'\n let currentState = 'idle' // 'idle' | 'busy'\n let rootSessionID = null // first non-child session we see\n let stopSent = false // dedup Stop emits\n const childSessionCache = new Map() // sessionID -> isChild bool\n\n const notify = async (eventName) => {\n const payload = JSON.stringify({ hook_event_name: eventName })\n try {\n await $`bash ${notifyPath} ${payload}`\n } catch {\n // Hook failures must never bubble into the OpenCode TUI.\n }\n }\n\n const isChildSession = async (sessionID) => {\n if (!sessionID) return true\n if (!client?.session?.list) return true\n if (childSessionCache.has(sessionID)) return childSessionCache.get(sessionID)\n try {\n const sessions = await client.session.list()\n const session = sessions.data?.find((s) => s.id === sessionID)\n const isChild = !!session?.parentID\n childSessionCache.set(sessionID, isChild)\n return isChild\n } catch {\n // On error, assume CHILD \u2014 safer than emitting a false-positive Start/Stop.\n return true\n }\n }\n\n const handleBusy = async (sessionID) => {\n if (!rootSessionID) rootSessionID = sessionID\n if (sessionID !== rootSessionID) return\n if (currentState === 'idle') {\n currentState = 'busy'\n stopSent = false\n await notify('Start')\n }\n }\n\n const handleStop = async (sessionID) => {\n if (rootSessionID && sessionID !== rootSessionID) return\n if (currentState === 'busy' && !stopSent) {\n currentState = 'idle'\n stopSent = true\n await notify('Stop')\n rootSessionID = null // reset for next session\n }\n }\n\n return {\n event: async ({ event }) => {\n const sessionID = event.properties?.sessionID ?? event.properties?.info?.id ?? null\n\n if (event.type === 'session.created') {\n const isChild = Boolean(event.properties?.info?.parentID)\n if (sessionID) childSessionCache.set(sessionID, isChild)\n if (!isChild) await notify('SessionStart')\n return\n }\n\n if (event.type === 'session.deleted') {\n const cached = sessionID ? childSessionCache.get(sessionID) : undefined\n const isChild = cached !== undefined ? cached : await isChildSession(sessionID)\n if (!isChild) await notify('SessionEnd')\n if (sessionID) childSessionCache.delete(sessionID)\n return\n }\n\n if (await isChildSession(sessionID)) return\n\n if (event.type === 'session.status') {\n const status = event.properties?.status\n if (status?.type === 'busy') await handleBusy(sessionID)\n else if (status?.type === 'idle') await handleStop(sessionID)\n }\n // Backwards-compat: some OpenCode versions emit busy/idle as top-level events.\n if (event.type === 'session.busy') await handleBusy(sessionID)\n if (event.type === 'session.idle') await handleStop(sessionID)\n if (event.type === 'session.error') await handleStop(sessionID)\n },\n 'permission.ask': async (_permission, output) => {\n if (output.status === 'ask') await notify('PermissionRequest')\n }\n }\n}\n";
36265
36265
  }
36266
36266
  });
@@ -78566,7 +78566,7 @@ async function createProjectPathStore(hubHost, options = {}) {
78566
78566
  }
78567
78567
 
78568
78568
  // src/main.ts
78569
- var COMPUTER_VERSION = true ? "0.38.1" : "0.0.0";
78569
+ var COMPUTER_VERSION = true ? "0.38.2" : "0.0.0";
78570
78570
  function watchPrimaryHubExitCode(primary, setExitCode) {
78571
78571
  primary.events.on("error", ({ fatal, reason }) => {
78572
78572
  if (reason === "needs-re-enrollment") {
@@ -79525,7 +79525,7 @@ var import_node_os16 = require("node:os");
79525
79525
  init_client();
79526
79526
 
79527
79527
  // src/build-identity.ts
79528
- var COMPUTER_BUILD_ID = true ? "131bdaf9-9a7e-42ca-a263-bc46e3c224a8" : void 0;
79528
+ var COMPUTER_BUILD_ID = true ? "a9eb3ed6-a88b-4df4-a698-ec5ab13145d2" : void 0;
79529
79529
 
79530
79530
  // src/session-host.ts
79531
79531
  function runtimeDir(root) {