@slayzone/cli 0.42.0 → 0.43.0

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.
Files changed (2) hide show
  1. package/dist/slay.js +62 -6
  2. package/package.json +1 -1
package/dist/slay.js CHANGED
@@ -49901,6 +49901,12 @@ async function waitForSession(sessionId, timeoutMs) {
49901
49901
  // src/commands/chat.ts
49902
49902
  var import_node_crypto5 = require("node:crypto");
49903
49903
  var EXIT_PROMPT = 3;
49904
+ function deliverOption(prefix = "") {
49905
+ return new Option(
49906
+ "--deliver <how>",
49907
+ `${prefix}queue = after the running turn, steer = into it now (required mid-turn)`
49908
+ ).choices(["queue", "steer"]);
49909
+ }
49904
49910
  var enc = encodeURIComponent;
49905
49911
  function withTargetOptions(cmd) {
49906
49912
  return cmd.option("-t, --task <id>", "Task id or prefix (default: $SLAYZONE_TASK_ID)").option("--tab <id>", "Another chat tab of the task (default: the task's main tab)");
@@ -50004,7 +50010,9 @@ function chatCommand() {
50004
50010
  }
50005
50011
  for (const [k, v] of Object.entries(data)) if (v !== null) console.log(`${k.padEnd(16)} ${v}`);
50006
50012
  });
50007
- withTargetOptions(cmd.command("send [text]")).description("Send a message (queued like the composer: it waits for the running turn)").option("--steer", "Take it into the running turn now instead of queueing").option("--wait", "Wait until the agent answered it (or stops on a prompt)").option("--timeout <ms>", "Timeout for --wait in milliseconds", "600000").option("--json", "Output as JSON").action(
50013
+ withTargetOptions(cmd.command("send [text]")).description(
50014
+ "Send a message. Mid-turn, --deliver is required: queue (after this turn) or steer (into it now)"
50015
+ ).addOption(deliverOption()).option("--wait", "Wait until the agent answered it (or stops on a prompt)").option("--timeout <ms>", "Timeout for --wait in milliseconds", "600000").option("--json", "Output as JSON").action(
50008
50016
  async (text, opts) => {
50009
50017
  if (!text) text = await readStdin();
50010
50018
  if (!text.trim()) {
@@ -50017,7 +50025,7 @@ function chatCommand() {
50017
50025
  const { data } = await apiPost(await chatPath(opts, "send", {}, { tabInQuery: false }), {
50018
50026
  text,
50019
50027
  messageId,
50020
- ...opts.steer ? { steer: true } : {},
50028
+ ...opts.deliver ? { deliver: opts.deliver } : {},
50021
50029
  ...bodyTab(opts)
50022
50030
  });
50023
50031
  if (data.steered === false && !opts.json)
@@ -50332,7 +50340,9 @@ function agentCommand() {
50332
50340
  if (opts.json) console.log(JSON.stringify(data, null, 2));
50333
50341
  else console.log(data.started ? "started" : "already running");
50334
50342
  });
50335
- withTask(cmd.command("send [text]")).description("Send a message (chat: queued; terminal: submitted), starting the agent if needed").option("--steer", "Chat: take it into the running turn now").option("--wait", "Then wait until the agent settles").option("--timeout <ms>", "Timeout for --wait in milliseconds", "600000").option("--json", "Output as JSON").action(
50343
+ withTask(cmd.command("send [text]")).description(
50344
+ "Send a message (chat: --deliver queue|steer, required mid-turn; terminal: submitted), starting the agent if needed"
50345
+ ).addOption(deliverOption("Chat: ")).option("--wait", "Then wait until the agent settles").option("--timeout <ms>", "Timeout for --wait in milliseconds", "600000").option("--json", "Output as JSON").action(
50336
50346
  async (text, opts) => {
50337
50347
  if (!text) text = await readStdin2();
50338
50348
  if (!text.trim()) {
@@ -50342,7 +50352,7 @@ function agentCommand() {
50342
50352
  if (opts.wait) refuseSelfWait(await resolveId(opts.task), void 0);
50343
50353
  const { data } = await apiPost(
50344
50354
  await agentPath(opts, "send"),
50345
- { text, ...opts.steer ? { steer: true } : {} }
50355
+ { text, ...opts.deliver ? { deliver: opts.deliver } : {} }
50346
50356
  );
50347
50357
  if (!opts.wait) {
50348
50358
  if (opts.json) console.log(JSON.stringify(data, null, 2));
@@ -50995,6 +51005,34 @@ var HUB_CONFIG_SWITCH_KEYS = [
50995
51005
  "enableIntegrations",
50996
51006
  "enableTelemetry"
50997
51007
  ];
51008
+ function readComputerAgentResources(value) {
51009
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
51010
+ const raw = value;
51011
+ const policy = {};
51012
+ const integer2 = (key, min, max) => {
51013
+ const value2 = raw[key];
51014
+ return typeof value2 === "number" && Number.isSafeInteger(value2) && value2 >= min && value2 <= max ? value2 : void 0;
51015
+ };
51016
+ const maxLiveAgents = raw.maxLiveAgents === "auto" ? "auto" : integer2("maxLiveAgents", 1, 1e4);
51017
+ const minAvailableMemoryPercent = integer2("minAvailableMemoryPercent", 1, 95);
51018
+ const idleBeforeHibernateMs = integer2("idleBeforeHibernateMs", 0, Number.MAX_SAFE_INTEGER);
51019
+ const warmPoolSize = integer2("warmPoolSize", 0, 1e4);
51020
+ const startConcurrency = integer2("startConcurrency", 1, 128);
51021
+ if (maxLiveAgents !== void 0) policy.maxLiveAgents = maxLiveAgents;
51022
+ if (typeof raw.hibernate === "boolean") policy.hibernate = raw.hibernate;
51023
+ if (minAvailableMemoryPercent !== void 0)
51024
+ policy.minAvailableMemoryPercent = minAvailableMemoryPercent;
51025
+ if (idleBeforeHibernateMs !== void 0) policy.idleBeforeHibernateMs = idleBeforeHibernateMs;
51026
+ if (warmPoolSize !== void 0) policy.warmPoolSize = warmPoolSize;
51027
+ if (startConcurrency !== void 0) policy.startConcurrency = startConcurrency;
51028
+ if (Array.isArray(raw.pinnedTaskIds))
51029
+ policy.pinnedTaskIds = [
51030
+ ...new Set(
51031
+ raw.pinnedTaskIds.filter((id) => typeof id === "string" && id.length > 0)
51032
+ )
51033
+ ];
51034
+ return policy;
51035
+ }
50998
51036
  function getHubConfigFilePath() {
50999
51037
  return (0, import_node_path13.join)(getSlayzoneHomeDir(), "hub.config.json");
51000
51038
  }
@@ -51041,6 +51079,8 @@ function coerceComputerConfig(raw) {
51041
51079
  }
51042
51080
  if (typeof raw.directListenAddress === "string") cfg.directListenAddress = raw.directListenAddress;
51043
51081
  if (typeof raw.directPublicAddress === "string") cfg.directPublicAddress = raw.directPublicAddress;
51082
+ const agentResources = readComputerAgentResources(raw.agentResources);
51083
+ if (agentResources) cfg.agentResources = agentResources;
51044
51084
  return cfg;
51045
51085
  }
51046
51086
  function readJsonObject2(path17) {
@@ -51310,6 +51350,7 @@ function renderSystemdUnit(spec) {
51310
51350
  const kind = KINDS[spec.kind];
51311
51351
  const exec = [spec.command, ...spec.args].join(" ");
51312
51352
  const envLines = unitEnv(spec).map(([k, v]) => `Environment=${k}=${v}`).join("\n");
51353
+ const agentIsolation = spec.kind === "hub" ? "" : "\nDelegate=memory\nDelegateSubgroup=supervisor\nOOMPolicy=continue";
51313
51354
  return `[Unit]
51314
51355
  Description=${kind.description} (${spec.name})
51315
51356
  Documentation=https://github.com/debuglebowski/slayzone
@@ -51322,6 +51363,7 @@ ${envLines}
51322
51363
  ExecStart=${exec}
51323
51364
  Restart=on-failure
51324
51365
  RestartSec=2
51366
+ OOMScoreAdjust=-750${agentIsolation}
51325
51367
  # stdout/stderr go to journald; read them with \`${kind.logsCommand} ${spec.name}\`.
51326
51368
  StandardOutput=journal
51327
51369
  StandardError=journal
@@ -51505,7 +51547,7 @@ var import_node_child_process4 = require("node:child_process");
51505
51547
  var import_node_fs17 = require("node:fs");
51506
51548
  var import_node_module = require("node:module");
51507
51549
  var import_node_path16 = require("node:path");
51508
- var CLI_VERSION = true ? "0.42.0" : "";
51550
+ var CLI_VERSION = true ? "0.43.0" : "";
51509
51551
  function fail(message) {
51510
51552
  console.error(message);
51511
51553
  process.exit(1);
@@ -53929,6 +53971,20 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
53929
53971
  const logDir = ensureLogDir("computer", root);
53930
53972
  if (opts.upgrade) {
53931
53973
  const bin = resolveServiceBin("computer", root, true);
53974
+ if ((0, import_node_fs20.existsSync)(unitPath("computer-host", name, backend))) {
53975
+ writeUnit(
53976
+ {
53977
+ kind: "computer-host",
53978
+ name,
53979
+ root,
53980
+ command: bin.command,
53981
+ args: [...bin.args, "--session-host"],
53982
+ logDir,
53983
+ ...bin.env ? { env: bin.env } : {}
53984
+ },
53985
+ backend
53986
+ );
53987
+ }
53932
53988
  writeUnit(
53933
53989
  {
53934
53990
  kind: "computer",
@@ -54195,7 +54251,7 @@ function updateCommand() {
54195
54251
  }
54196
54252
 
54197
54253
  // src/index.ts
54198
- var program2 = new Command().enablePositionalOptions().name("slay").description("SlayZone CLI").version("0.42.0").option("--dev", "Use development database (slayzone.dev.data.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
54254
+ var program2 = new Command().enablePositionalOptions().name("slay").description("SlayZone CLI").version("0.43.0").option("--dev", "Use development database (slayzone.dev.data.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
54199
54255
  const root = thisCommand.parent ?? thisCommand;
54200
54256
  const opts = root.opts();
54201
54257
  if (opts.dev) process.env.SLAYZONE_DEV = "1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slayzone/cli",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "SlayZone CLI — run, list and target SlayZone hubs; drive tasks, ptys and projects",
5
5
  "license": "GPL-3.0-only",
6
6
  "private": false,