@slayzone/computer 0.41.0 → 0.41.1
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 +6 -6
- package/dist/bin.cjs.map +3 -3
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -104375,7 +104375,7 @@ var init_main = __esm({
|
|
|
104375
104375
|
init_isolation();
|
|
104376
104376
|
init_event_loop_stall();
|
|
104377
104377
|
init_stall_report();
|
|
104378
|
-
COMPUTER_VERSION = true ? "0.41.
|
|
104378
|
+
COMPUTER_VERSION = true ? "0.41.1" : "0.0.0";
|
|
104379
104379
|
relocationHosts = /* @__PURE__ */ new Set();
|
|
104380
104380
|
}
|
|
104381
104381
|
});
|
|
@@ -104818,7 +104818,7 @@ var COMPUTER_BUILD_ID;
|
|
|
104818
104818
|
var init_build_identity = __esm({
|
|
104819
104819
|
"src/build-identity.ts"() {
|
|
104820
104820
|
"use strict";
|
|
104821
|
-
COMPUTER_BUILD_ID = true ? "
|
|
104821
|
+
COMPUTER_BUILD_ID = true ? "f2e66c6b-5882-4454-b92e-7684dca4e9a4" : void 0;
|
|
104822
104822
|
}
|
|
104823
104823
|
});
|
|
104824
104824
|
|
|
@@ -106811,10 +106811,10 @@ var init_agent_hooks = __esm({
|
|
|
106811
106811
|
}
|
|
106812
106812
|
});
|
|
106813
106813
|
|
|
106814
|
-
// raw-import:/tmp/slz-publish-wt.
|
|
106814
|
+
// raw-import:/tmp/slz-publish-wt.xdxUC3/packages/shared/hooks/src/notify.sh
|
|
106815
106815
|
var notify_default;
|
|
106816
106816
|
var init_notify = __esm({
|
|
106817
|
-
"raw-import:/tmp/slz-publish-wt.
|
|
106817
|
+
"raw-import:/tmp/slz-publish-wt.xdxUC3/packages/shared/hooks/src/notify.sh"() {
|
|
106818
106818
|
notify_default = `#!/bin/sh
|
|
106819
106819
|
# SlayZone agent lifecycle hook \u2014 BENIGN DUMB FORWARDER.
|
|
106820
106820
|
#
|
|
@@ -106976,10 +106976,10 @@ exit 0
|
|
|
106976
106976
|
}
|
|
106977
106977
|
});
|
|
106978
106978
|
|
|
106979
|
-
// raw-import:/tmp/slz-publish-wt.
|
|
106979
|
+
// raw-import:/tmp/slz-publish-wt.xdxUC3/packages/shared/hooks/src/opencode-plugin.js
|
|
106980
106980
|
var opencode_plugin_default;
|
|
106981
106981
|
var init_opencode_plugin = __esm({
|
|
106982
|
-
"raw-import:/tmp/slz-publish-wt.
|
|
106982
|
+
"raw-import:/tmp/slz-publish-wt.xdxUC3/packages/shared/hooks/src/opencode-plugin.js"() {
|
|
106983
106983
|
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";
|
|
106984
106984
|
}
|
|
106985
106985
|
});
|