nexus-agents 4.19.0 → 4.20.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.
@@ -5461,7 +5461,23 @@ var JobResultSchema = z8.object({
5461
5461
  * Failure message when `status === 'failed'`. Cannot be paired with
5462
5462
  * `result` — the discriminator is `status`.
5463
5463
  */
5464
- error: z8.string().optional()
5464
+ error: z8.string().optional(),
5465
+ /**
5466
+ * Whether the tool's `run` callback accepts `runAsJob`'s `AbortSignal`
5467
+ * (#4972).
5468
+ *
5469
+ * `cancel_job` writes a `cancelled` record whether or not the tool can act
5470
+ * on the signal — as `cancel-job-tool.ts` says, "a tool that IGNORES the
5471
+ * signal still runs to completion… but its record stays `cancelled`". A
5472
+ * reader of that record could not tell the two apart, so `cancelled` claimed
5473
+ * more than was known.
5474
+ *
5475
+ * This is a STRUCTURAL fact — the callback's arity — not a behavioural one.
5476
+ * A tool may accept the signal and never await on it, so `true` means
5477
+ * "cancellation can reach this tool", not "the work stopped". Absent means
5478
+ * the writer did not report it, which is not the same as `false`.
5479
+ */
5480
+ signalAccepted: z8.boolean().optional()
5465
5481
  });
5466
5482
  function jobResultPath(jobId) {
5467
5483
  return nexusDataPathEnsure("jobs", `result-${jobId}.json`);
@@ -5470,7 +5486,7 @@ function persistJobRecord(path, record) {
5470
5486
  writeFileSync3(path, JSON.stringify(record, null, 2), { mode: 384 });
5471
5487
  chmodSync(path, 384);
5472
5488
  }
5473
- function writeJobPending(jobId, toolName) {
5489
+ function writeJobPending(jobId, toolName, signalAccepted) {
5474
5490
  const path = jobResultPath(jobId);
5475
5491
  if (existsSync4(path)) {
5476
5492
  logger7.debug("Job result file already exists \u2014 leaving in place", { jobId });
@@ -5481,10 +5497,11 @@ function writeJobPending(jobId, toolName) {
5481
5497
  jobId,
5482
5498
  toolName,
5483
5499
  status: "pending",
5484
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
5500
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5501
+ ...signalAccepted !== void 0 ? { signalAccepted } : {}
5485
5502
  };
5486
5503
  persistJobRecord(path, record);
5487
- logger7.debug("Wrote pending job record", { jobId, toolName });
5504
+ logger7.debug("Wrote pending job record", { jobId, toolName, signalAccepted });
5488
5505
  }
5489
5506
  function writeJobComplete(jobId, toolName, result) {
5490
5507
  const existing = readJobResult(jobId);
@@ -5936,7 +5953,7 @@ function runAsJob(params) {
5936
5953
  return env.busy(suggestRetryAfterMs(params.toolName), params.toolName);
5937
5954
  }
5938
5955
  const jobId = idempotency.jobId;
5939
- writeJobPending(jobId, params.toolName);
5956
+ writeJobPending(jobId, params.toolName, params.run.length >= 3);
5940
5957
  if (params.idempotencyKey !== void 0 && params.idempotencyKey !== "") {
5941
5958
  registerIdempotentJob({
5942
5959
  tool: params.toolName,
@@ -6712,4 +6729,4 @@ export {
6712
6729
  CONSENSUS_VOTE_TOOL_SCHEMA,
6713
6730
  registerConsensusVoteTool
6714
6731
  };
6715
- //# sourceMappingURL=chunk-XGBGZ26Y.js.map
6732
+ //# sourceMappingURL=chunk-LTS4MLEO.js.map