@slayzone/computer 0.37.1 → 0.37.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
@@ -29346,10 +29346,10 @@ var init_agent_hooks = __esm({
29346
29346
  }
29347
29347
  });
29348
29348
 
29349
- // raw-import:/tmp/slz-publish-wt.aaBnZi/packages/shared/hooks/src/notify.sh
29349
+ // raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/notify.sh
29350
29350
  var notify_default;
29351
29351
  var init_notify = __esm({
29352
- "raw-import:/tmp/slz-publish-wt.aaBnZi/packages/shared/hooks/src/notify.sh"() {
29352
+ "raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/notify.sh"() {
29353
29353
  notify_default = `#!/bin/sh
29354
29354
  # SlayZone agent lifecycle hook \u2014 BENIGN DUMB FORWARDER.
29355
29355
  #
@@ -29511,10 +29511,10 @@ exit 0
29511
29511
  }
29512
29512
  });
29513
29513
 
29514
- // raw-import:/tmp/slz-publish-wt.aaBnZi/packages/shared/hooks/src/opencode-plugin.js
29514
+ // raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/opencode-plugin.js
29515
29515
  var opencode_plugin_default;
29516
29516
  var init_opencode_plugin = __esm({
29517
- "raw-import:/tmp/slz-publish-wt.aaBnZi/packages/shared/hooks/src/opencode-plugin.js"() {
29517
+ "raw-import:/tmp/slz-publish-wt.cVSKE7/packages/shared/hooks/src/opencode-plugin.js"() {
29518
29518
  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";
29519
29519
  }
29520
29520
  });
@@ -51185,18 +51185,23 @@ var USABLE_PLACEMENT_STATUSES = ["pending", "ready"];
51185
51185
 
51186
51186
  // ../../domains/computers/src/shared/upgrade-status.ts
51187
51187
  init_zod();
51188
+
51189
+ // ../../domains/computers/src/shared/computer-labels.ts
51190
+ var COMPUTER_UPGRADE_PHASES = [
51191
+ "checking",
51192
+ "installing",
51193
+ "waiting-for-idle",
51194
+ "restarting",
51195
+ "probation",
51196
+ "connected",
51197
+ "rollback",
51198
+ "failed",
51199
+ "maintenance-required"
51200
+ ];
51201
+
51202
+ // ../../domains/computers/src/shared/upgrade-status.ts
51188
51203
  var computerUpgradeStatusSchema = external_exports.object({
51189
- phase: external_exports.enum([
51190
- "checking",
51191
- "installing",
51192
- "waiting-for-idle",
51193
- "restarting",
51194
- "probation",
51195
- "connected",
51196
- "rollback",
51197
- "failed",
51198
- "maintenance-required"
51199
- ]),
51204
+ phase: external_exports.enum(COMPUTER_UPGRADE_PHASES),
51200
51205
  currentVersion: external_exports.string().max(100),
51201
51206
  hostVersion: external_exports.string().max(100),
51202
51207
  version: external_exports.string().max(100).optional(),
@@ -61790,7 +61795,7 @@ async function createProjectPathStore(hubHost, options = {}) {
61790
61795
  }
61791
61796
 
61792
61797
  // src/main.ts
61793
- var COMPUTER_VERSION = true ? "0.37.1" : "0.0.0";
61798
+ var COMPUTER_VERSION = true ? "0.37.2" : "0.0.0";
61794
61799
  function createHubRequestHandler(deps4) {
61795
61800
  const log = deps4.log ?? (() => {
61796
61801
  });
@@ -62406,7 +62411,7 @@ var import_node_os13 = require("node:os");
62406
62411
  init_client();
62407
62412
 
62408
62413
  // src/build-identity.ts
62409
- var COMPUTER_BUILD_ID = true ? "9c677cb3-7601-4da9-bd71-4948216fa32c" : void 0;
62414
+ var COMPUTER_BUILD_ID = true ? "d5a18e93-f42f-424b-900c-06374867127b" : void 0;
62410
62415
 
62411
62416
  // src/session-host.ts
62412
62417
  function runtimeDir(root) {