@parall/parall 1.55.1 → 1.55.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.
@@ -55900,6 +55900,56 @@ async function consumeMessageWorkItem(host, item) {
55900
55900
  }
55901
55901
  }
55902
55902
 
55903
+ // ../agent-core/dist/dispatch-inactivity-deadline.js
55904
+ var DispatchInactivityDeadline = class {
55905
+ timeoutMs;
55906
+ onExpire;
55907
+ onDispose;
55908
+ timer = null;
55909
+ expired = false;
55910
+ disposed = false;
55911
+ constructor(timeoutMs, onExpire, onDispose) {
55912
+ this.timeoutMs = timeoutMs;
55913
+ this.onExpire = onExpire;
55914
+ this.onDispose = onDispose;
55915
+ }
55916
+ touch = () => {
55917
+ if (this.timeoutMs <= 0 || this.expired || this.disposed)
55918
+ return;
55919
+ if (this.timer)
55920
+ clearTimeout(this.timer);
55921
+ this.timer = setTimeout(() => {
55922
+ this.timer = null;
55923
+ this.expired = true;
55924
+ this.onExpire();
55925
+ }, this.timeoutMs);
55926
+ };
55927
+ dispose() {
55928
+ if (this.disposed)
55929
+ return;
55930
+ this.disposed = true;
55931
+ if (this.timer)
55932
+ clearTimeout(this.timer);
55933
+ this.timer = null;
55934
+ this.onDispose();
55935
+ }
55936
+ };
55937
+ var DispatchInactivityDeadlines = class {
55938
+ active = /* @__PURE__ */ new Map();
55939
+ start(sessionKey, timeoutMs, onExpire) {
55940
+ const deadline = new DispatchInactivityDeadline(timeoutMs, onExpire, () => {
55941
+ if (this.active.get(sessionKey) === deadline)
55942
+ this.active.delete(sessionKey);
55943
+ });
55944
+ this.active.set(sessionKey, deadline);
55945
+ deadline.touch();
55946
+ return deadline;
55947
+ }
55948
+ touch(sessionKey) {
55949
+ this.active.get(sessionKey)?.touch();
55950
+ }
55951
+ };
55952
+
55903
55953
  // ../agent-core/dist/routing.js
55904
55954
  var MAX_CONCURRENT_FORKS = 20;
55905
55955
  var defaultRoutingStrategy = (event, state) => {
@@ -57461,6 +57511,7 @@ var ParallAgentGateway = class {
57461
57511
  * an unrelated stalled fork's lane leased forever).
57462
57512
  */
57463
57513
  sessionActiveLanes = /* @__PURE__ */ new Map();
57514
+ dispatchInactivityDeadlines = new DispatchInactivityDeadlines();
57464
57515
  noteSessionLane(sessionKey, laneKey) {
57465
57516
  if (laneKey == null)
57466
57517
  this.sessionActiveLanes.delete(sessionKey);
@@ -57470,11 +57521,12 @@ var ParallAgentGateway = class {
57470
57521
  /**
57471
57522
  * External runtime-activity signal for adapters whose tool activity does
57472
57523
  * not flow through the RuntimeEvent stream (openclaw hooks call this from
57473
- * the tool-call lifecycle): renews the session's OWN active ledger lane so
57474
- * a long tool call cannot outlive the lease and get dethroned mid-turn.
57475
- * No-op without an active ledger lane for the session.
57524
+ * the tool-call lifecycle): refreshes the dispatch inactivity deadline and
57525
+ * renews the session's OWN active ledger lane, when present, so a long tool
57526
+ * call cannot time out or get dethroned mid-turn.
57476
57527
  */
57477
57528
  touchRuntimeActivity(sessionKey) {
57529
+ this.dispatchInactivityDeadlines.touch(sessionKey);
57478
57530
  if (this.ledgerDisabled)
57479
57531
  return;
57480
57532
  const laneKey = this.sessionActiveLanes.get(sessionKey);
@@ -57950,14 +58002,14 @@ var ParallAgentGateway = class {
57950
58002
  this.writeContextFile(laneContextFilePath2, contextBody);
57951
58003
  }
57952
58004
  this.inFlightDispatches++;
57953
- const deadlineTimer = this.DISPATCH_DEADLINE_MS > 0 ? setTimeout(() => {
57954
- this.opts.log?.warn(`dispatch deadline exceeded (${this.DISPATCH_DEADLINE_MS}ms) for ${event.messageId} on ${sessionKey}; aborting`);
58005
+ const dispatchDeadline = this.dispatchInactivityDeadlines.start(sessionKey, this.DISPATCH_DEADLINE_MS, () => {
58006
+ this.opts.log?.warn(`dispatch inactivity deadline exceeded (${this.DISPATCH_DEADLINE_MS}ms) for ${event.messageId} on ${sessionKey}; aborting`);
57955
58007
  try {
57956
58008
  this.opts.dispatchAdapter.abortDispatch?.(sessionKey);
57957
58009
  } catch (err) {
57958
58010
  this.opts.log?.warn(`abortDispatch threw for ${sessionKey}: ${String(err)}`);
57959
58011
  }
57960
- }, this.DISPATCH_DEADLINE_MS) : null;
58012
+ });
57961
58013
  let binding = this.sessionBindings.get(sessionKey);
57962
58014
  let inputStepsCreated = false;
57963
58015
  let turnHandle;
@@ -57978,8 +58030,10 @@ var ParallAgentGateway = class {
57978
58030
  bodyForAgent,
57979
58031
  sessionKey,
57980
58032
  context: dispatchContext,
57981
- inputLifecycle
58033
+ inputLifecycle,
58034
+ noteActivity: dispatchDeadline.touch
57982
58035
  })) {
58036
+ dispatchDeadline.touch();
57983
58037
  if (runtimeEvent.type === "runtime_session") {
57984
58038
  const priorAgentSessionId = binding?.agentSessionId;
57985
58039
  binding = await this.bindRuntimeSession(sessionKey, runtimeEvent, contextFilePath, laneContextFilePath2);
@@ -58116,8 +58170,7 @@ var ParallAgentGateway = class {
58116
58170
  }
58117
58171
  throw err;
58118
58172
  } finally {
58119
- if (deadlineTimer)
58120
- clearTimeout(deadlineTimer);
58173
+ dispatchDeadline.dispose();
58121
58174
  const metricsSnapshot = getDispatchMetrics(sessionKey);
58122
58175
  const durationMs = metricsSnapshot ? Date.now() - metricsSnapshot.started_at : 0;
58123
58176
  const effectiveOutcome = turnOutcomeEvent?.outcome ?? (dispatchError || sawErrorEvent ? "runtime_crash" : "ok");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/parall",
3
- "version": "1.55.1",
3
+ "version": "1.55.2",
4
4
  "description": "OpenClaw channel plugin for Parall IM",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,8 +16,8 @@
16
16
  "openclaw.plugin.json"
17
17
  ],
18
18
  "dependencies": {
19
- "@parall/agent-core": "1.55.1",
20
- "@parall/sdk": "1.55.1"
19
+ "@parall/agent-core": "1.55.2",
20
+ "@parall/sdk": "1.55.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.0.0",