@codelia/runtime 0.1.53 → 0.1.54

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/index.cjs CHANGED
@@ -6103,21 +6103,21 @@ var shellRunSchema = import_zod11.z.object({
6103
6103
  `Optional short task label used to build the returned task key. Max ${SHELL_LABEL_MAX_CHARS} chars.`
6104
6104
  ),
6105
6105
  timeout: import_zod11.z.number().int().positive().optional().describe(
6106
- `Execution timeout in seconds. Foreground default: ${DEFAULT_TIMEOUT_SECONDS}, max ${MAX_TIMEOUT_SECONDS}. Background accepts larger values up to ${MAX_EXECUTION_TIMEOUT_SECONDS}; omit to keep the managed child job running until completion, cancel, or runtime exit.`
6106
+ `Execution timeout in seconds. Foreground default: ${DEFAULT_TIMEOUT_SECONDS}, max ${MAX_TIMEOUT_SECONDS}. Detached-wait mode accepts larger values up to ${MAX_EXECUTION_TIMEOUT_SECONDS}; omit to keep the managed child job running until completion, cancel, or runtime exit.`
6107
6107
  ),
6108
- background: import_zod11.z.boolean().optional().describe(
6109
- "Detach the wait and return compact JSON with the task key immediately. The runtime still owns the child process, so this is not persistence/daemonization. Manage it with shell_status/logs/wait/result/cancel. Default: false."
6108
+ detached_wait: import_zod11.z.boolean().optional().describe(
6109
+ "Skip the attached wait and return the task key immediately. The runtime still owns the child process. Use this only for finite jobs you will later inspect, wait on, or cancel. If you need a service-style process to keep running independently, start it with an explicit OS/shell-native out-of-process method such as `nohup`, `setsid`, `disown`, a service manager, or `docker compose up -d`, and verify readiness separately. Default: false."
6110
6110
  )
6111
6111
  }).superRefine((input, ctx) => {
6112
6112
  if (input.timeout === void 0) {
6113
6113
  return;
6114
6114
  }
6115
- if (input.background ?? false) {
6115
+ if (input.detached_wait ?? false) {
6116
6116
  if (input.timeout > MAX_EXECUTION_TIMEOUT_SECONDS) {
6117
6117
  ctx.addIssue({
6118
6118
  code: import_zod11.z.ZodIssueCode.custom,
6119
6119
  path: ["timeout"],
6120
- message: `Background timeout must be ${MAX_EXECUTION_TIMEOUT_SECONDS} seconds or less. Omit timeout to run without an execution timer.`
6120
+ message: `Detached-wait timeout must be ${MAX_EXECUTION_TIMEOUT_SECONDS} seconds or less. Omit timeout to run without an execution timer.`
6121
6121
  });
6122
6122
  }
6123
6123
  return;
@@ -6165,8 +6165,8 @@ var normalizeOptionalLabel = (value) => {
6165
6165
  const label = value.trim();
6166
6166
  return label.length > 0 ? label : void 0;
6167
6167
  };
6168
- var resolveShellTimeoutSeconds = (value, background) => {
6169
- if (background) {
6168
+ var resolveShellTimeoutSeconds = (value, detachedWait) => {
6169
+ if (detachedWait) {
6170
6170
  return value === void 0 ? void 0 : Math.max(1, Math.trunc(value));
6171
6171
  }
6172
6172
  const requestedTimeout = value ?? DEFAULT_TIMEOUT_SECONDS;
@@ -6248,7 +6248,7 @@ var shellBasePayload = (task) => ({
6248
6248
  });
6249
6249
  var shellStatusPayload = (task, options = {}) => ({
6250
6250
  ...shellBasePayload(task),
6251
- ...options.background ? { background: true } : {},
6251
+ ...options.detachedWait ? { detached_wait: true } : {},
6252
6252
  ...options.stillRunning ? { still_running: true } : {},
6253
6253
  ...options.aborted ? { aborted: true } : {}
6254
6254
  });
@@ -6509,7 +6509,7 @@ var createShellTool = (sandboxKey, options = {}) => {
6509
6509
  const shared = getSharedDeps(options);
6510
6510
  return (0, import_core12.defineTool)({
6511
6511
  name: "shell",
6512
- description: "Run a shell command as a runtime-managed child process in the sandbox. By default wait for completion; with `background=true`, detach the wait and return compact JSON with the task key for follow-up tools.",
6512
+ description: "Run a shell command as a runtime-managed child process in the sandbox. By default wait for completion; with `detached_wait=true`, skip the attached wait and return compact JSON with the task key for follow-up tools.",
6513
6513
  input: shellRunSchema,
6514
6514
  execute: async (input, ctx) => {
6515
6515
  const sandbox = await getSandboxContext(ctx, sandboxKey);
@@ -6519,14 +6519,14 @@ var createShellTool = (sandboxKey, options = {}) => {
6519
6519
  throw new Error("command is required.");
6520
6520
  }
6521
6521
  const label = normalizeOptionalLabel(input.label);
6522
- const background = input.background ?? false;
6522
+ const detachedWait = input.detached_wait ?? false;
6523
6523
  const timeoutSeconds = resolveShellTimeoutSeconds(
6524
6524
  input.timeout,
6525
- background
6525
+ detachedWait
6526
6526
  );
6527
6527
  const commandSummary = summarizeCommand(command);
6528
6528
  (0, import_logger.debugLog)(
6529
- `shell.start cwd=${sandbox.workingDir} timeout_s=${formatShellTimeoutForLog(timeoutSeconds)} background=${background} command="${commandSummary}"`
6529
+ `shell.start cwd=${sandbox.workingDir} timeout_s=${formatShellTimeoutForLog(timeoutSeconds)} detached_wait=${detachedWait} command="${commandSummary}"`
6530
6530
  );
6531
6531
  try {
6532
6532
  const taskId = import_node_crypto6.default.randomUUID();
@@ -6551,8 +6551,8 @@ var createShellTool = (sandboxKey, options = {}) => {
6551
6551
  outputCache: shared.outputCacheStore
6552
6552
  })
6553
6553
  );
6554
- if (background) {
6555
- return shellStatusPayload(task, { background: true });
6554
+ if (detachedWait) {
6555
+ return shellStatusPayload(task, { detachedWait: true });
6556
6556
  }
6557
6557
  const settled = await waitForForegroundRun(
6558
6558
  shared.tasks,
package/dist/index.js CHANGED
@@ -6107,21 +6107,21 @@ var shellRunSchema = z11.object({
6107
6107
  `Optional short task label used to build the returned task key. Max ${SHELL_LABEL_MAX_CHARS} chars.`
6108
6108
  ),
6109
6109
  timeout: z11.number().int().positive().optional().describe(
6110
- `Execution timeout in seconds. Foreground default: ${DEFAULT_TIMEOUT_SECONDS}, max ${MAX_TIMEOUT_SECONDS}. Background accepts larger values up to ${MAX_EXECUTION_TIMEOUT_SECONDS}; omit to keep the managed child job running until completion, cancel, or runtime exit.`
6110
+ `Execution timeout in seconds. Foreground default: ${DEFAULT_TIMEOUT_SECONDS}, max ${MAX_TIMEOUT_SECONDS}. Detached-wait mode accepts larger values up to ${MAX_EXECUTION_TIMEOUT_SECONDS}; omit to keep the managed child job running until completion, cancel, or runtime exit.`
6111
6111
  ),
6112
- background: z11.boolean().optional().describe(
6113
- "Detach the wait and return compact JSON with the task key immediately. The runtime still owns the child process, so this is not persistence/daemonization. Manage it with shell_status/logs/wait/result/cancel. Default: false."
6112
+ detached_wait: z11.boolean().optional().describe(
6113
+ "Skip the attached wait and return the task key immediately. The runtime still owns the child process. Use this only for finite jobs you will later inspect, wait on, or cancel. If you need a service-style process to keep running independently, start it with an explicit OS/shell-native out-of-process method such as `nohup`, `setsid`, `disown`, a service manager, or `docker compose up -d`, and verify readiness separately. Default: false."
6114
6114
  )
6115
6115
  }).superRefine((input, ctx) => {
6116
6116
  if (input.timeout === void 0) {
6117
6117
  return;
6118
6118
  }
6119
- if (input.background ?? false) {
6119
+ if (input.detached_wait ?? false) {
6120
6120
  if (input.timeout > MAX_EXECUTION_TIMEOUT_SECONDS) {
6121
6121
  ctx.addIssue({
6122
6122
  code: z11.ZodIssueCode.custom,
6123
6123
  path: ["timeout"],
6124
- message: `Background timeout must be ${MAX_EXECUTION_TIMEOUT_SECONDS} seconds or less. Omit timeout to run without an execution timer.`
6124
+ message: `Detached-wait timeout must be ${MAX_EXECUTION_TIMEOUT_SECONDS} seconds or less. Omit timeout to run without an execution timer.`
6125
6125
  });
6126
6126
  }
6127
6127
  return;
@@ -6169,8 +6169,8 @@ var normalizeOptionalLabel = (value) => {
6169
6169
  const label = value.trim();
6170
6170
  return label.length > 0 ? label : void 0;
6171
6171
  };
6172
- var resolveShellTimeoutSeconds = (value, background) => {
6173
- if (background) {
6172
+ var resolveShellTimeoutSeconds = (value, detachedWait) => {
6173
+ if (detachedWait) {
6174
6174
  return value === void 0 ? void 0 : Math.max(1, Math.trunc(value));
6175
6175
  }
6176
6176
  const requestedTimeout = value ?? DEFAULT_TIMEOUT_SECONDS;
@@ -6252,7 +6252,7 @@ var shellBasePayload = (task) => ({
6252
6252
  });
6253
6253
  var shellStatusPayload = (task, options = {}) => ({
6254
6254
  ...shellBasePayload(task),
6255
- ...options.background ? { background: true } : {},
6255
+ ...options.detachedWait ? { detached_wait: true } : {},
6256
6256
  ...options.stillRunning ? { still_running: true } : {},
6257
6257
  ...options.aborted ? { aborted: true } : {}
6258
6258
  });
@@ -6513,7 +6513,7 @@ var createShellTool = (sandboxKey, options = {}) => {
6513
6513
  const shared = getSharedDeps(options);
6514
6514
  return defineTool10({
6515
6515
  name: "shell",
6516
- description: "Run a shell command as a runtime-managed child process in the sandbox. By default wait for completion; with `background=true`, detach the wait and return compact JSON with the task key for follow-up tools.",
6516
+ description: "Run a shell command as a runtime-managed child process in the sandbox. By default wait for completion; with `detached_wait=true`, skip the attached wait and return compact JSON with the task key for follow-up tools.",
6517
6517
  input: shellRunSchema,
6518
6518
  execute: async (input, ctx) => {
6519
6519
  const sandbox = await getSandboxContext(ctx, sandboxKey);
@@ -6523,14 +6523,14 @@ var createShellTool = (sandboxKey, options = {}) => {
6523
6523
  throw new Error("command is required.");
6524
6524
  }
6525
6525
  const label = normalizeOptionalLabel(input.label);
6526
- const background = input.background ?? false;
6526
+ const detachedWait = input.detached_wait ?? false;
6527
6527
  const timeoutSeconds = resolveShellTimeoutSeconds(
6528
6528
  input.timeout,
6529
- background
6529
+ detachedWait
6530
6530
  );
6531
6531
  const commandSummary = summarizeCommand(command);
6532
6532
  debugLog(
6533
- `shell.start cwd=${sandbox.workingDir} timeout_s=${formatShellTimeoutForLog(timeoutSeconds)} background=${background} command="${commandSummary}"`
6533
+ `shell.start cwd=${sandbox.workingDir} timeout_s=${formatShellTimeoutForLog(timeoutSeconds)} detached_wait=${detachedWait} command="${commandSummary}"`
6534
6534
  );
6535
6535
  try {
6536
6536
  const taskId = crypto6.randomUUID();
@@ -6555,8 +6555,8 @@ var createShellTool = (sandboxKey, options = {}) => {
6555
6555
  outputCache: shared.outputCacheStore
6556
6556
  })
6557
6557
  );
6558
- if (background) {
6559
- return shellStatusPayload(task, { background: true });
6558
+ if (detachedWait) {
6559
+ return shellStatusPayload(task, { detachedWait: true });
6560
6560
  }
6561
6561
  const settled = await waitForForegroundRun(
6562
6562
  shared.tasks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/runtime",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20 <25"
@@ -23,14 +23,14 @@
23
23
  "typecheck": "tsc --noEmit"
24
24
  },
25
25
  "dependencies": {
26
- "@codelia/config": "0.1.53",
27
- "@codelia/config-loader": "0.1.53",
28
- "@codelia/core": "0.1.53",
29
- "@codelia/logger": "0.1.53",
30
- "@codelia/model-metadata": "0.1.53",
31
- "@codelia/protocol": "0.1.53",
32
- "@codelia/shared-types": "0.1.53",
33
- "@codelia/storage": "0.1.53",
26
+ "@codelia/config": "0.1.54",
27
+ "@codelia/config-loader": "0.1.54",
28
+ "@codelia/core": "0.1.54",
29
+ "@codelia/logger": "0.1.54",
30
+ "@codelia/model-metadata": "0.1.54",
31
+ "@codelia/protocol": "0.1.54",
32
+ "@codelia/shared-types": "0.1.54",
33
+ "@codelia/storage": "0.1.54",
34
34
  "eventsource-parser": "^3.0.6",
35
35
  "oauth4webapi": "^3.8.4",
36
36
  "zod": "^4.3.5"