@nowcrew/daemon 0.6.101-beta.8 → 0.6.101

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.
@@ -207,6 +207,8 @@ export const ExecutionStartSchema = z.object({
207
207
  model: z.string().optional(),
208
208
  reasoning: ReasoningSchema.optional(),
209
209
  timeoutMs: z.number().int().positive().optional(),
210
+ // Server-owned policy; 0 disables the total runtime timer. Capability-gated.
211
+ taskTimeoutMs: z.number().int().min(0).max(2_145_600_000).optional(),
210
212
  }).strict(),
211
213
  permissions: z.object({
212
214
  requested: PermissionSchema,
@@ -416,7 +416,7 @@ export async function runExecution(config, input, dependencies) {
416
416
  return { kind: "rejected", frame };
417
417
  }
418
418
  const { permission } = checked;
419
- const effectiveTimeoutMs = spec.runtime.timeoutMs ?? config.executionLimits.maxTimeoutMs;
419
+ const effectiveTimeoutMs = spec.runtime.taskTimeoutMs ?? spec.runtime.timeoutMs ?? config.executionLimits.maxTimeoutMs;
420
420
  const accepted = await dependencies.journal.accept(spec.executionId, specHash, {
421
421
  runtime: spec.runtime.name,
422
422
  ...(spec.runtime.model === undefined ? {} : { model: spec.runtime.model }),
@@ -492,6 +492,7 @@ export async function runExecution(config, input, dependencies) {
492
492
  let timeout;
493
493
  let timedOut = false;
494
494
  let firstOutputTimer;
495
+ let runtimeTimersStarted = false;
495
496
  let firstOutputTimedOut = false;
496
497
  let abandonedRuntimeRunningCompletion = null;
497
498
  let completion;
@@ -617,7 +618,8 @@ export async function runExecution(config, input, dependencies) {
617
618
  if (dependencies.cancellation?.isRequested())
618
619
  return;
619
620
  const cancel = runtimeCancel;
620
- if (cancel !== null && timeout === undefined && !dependencies.cancellation?.isRequested()) {
621
+ if (cancel !== null && !runtimeTimersStarted && !dependencies.cancellation?.isRequested()) {
622
+ runtimeTimersStarted = true;
621
623
  const firstOutputDeadline = config.executionLimits.maxFirstOutputWaitMs
622
624
  + config.executionLimits.firstOutputGraceMs;
623
625
  firstOutputTimer = setTimeout(() => {
@@ -629,15 +631,16 @@ export async function runExecution(config, input, dependencies) {
629
631
  rejectCancellationFailure(error);
630
632
  }
631
633
  }, firstOutputDeadline);
632
- timeout = setTimeout(() => {
633
- timedOut = true;
634
- try {
635
- void cancel().catch(rejectCancellationFailure);
636
- }
637
- catch (error) {
638
- rejectCancellationFailure(error);
639
- }
640
- }, effectiveTimeoutMs);
634
+ if (effectiveTimeoutMs > 0)
635
+ timeout = setTimeout(() => {
636
+ timedOut = true;
637
+ try {
638
+ void cancel().catch(rejectCancellationFailure);
639
+ }
640
+ catch (error) {
641
+ rejectCancellationFailure(error);
642
+ }
643
+ }, effectiveTimeoutMs);
641
644
  }
642
645
  dependencies.onRuntimePhase?.("running", spec.runtime.name);
643
646
  const journalStartedAt = Date.now();
@@ -42,6 +42,7 @@ export const NATIVE_PROJECT_WORKSPACE_READINESS = Object.freeze({
42
42
  });
43
43
  export const DAEMON_CAPABILITIES = Object.freeze([
44
44
  RUNTIME_TOOL_UPDATES_CAPABILITY,
45
+ "execution_task_timeout_v1",
45
46
  MARKETPLACE_CAPABILITY,
46
47
  MAINTENANCE_CAPABILITY,
47
48
  "scheduled_job_v1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowcrew/daemon",
3
- "version": "0.6.101-beta.8",
3
+ "version": "0.6.101",
4
4
  "type": "module",
5
5
  "description": "crew daemon — 运行在用户机器:拉起/管理 agent 进程,注入 crew CLI,归一化 runtime 事件",
6
6
  "license": "Apache-2.0",