@stigmer/runner-slim 3.9.0 → 3.11.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 (3) hide show
  1. package/main.js +1002 -433
  2. package/package.json +6 -6
  3. package/workflow-bundle.js +42 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/runner-slim",
3
- "version": "3.9.0",
3
+ "version": "3.11.0",
4
4
  "description": "Self-contained Stigmer runner build for embedding in desktop apps — the bundle-friendly @stigmer/runner",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
@@ -16,11 +16,11 @@
16
16
  "jq-wasm": "^1.1.0-jq-1.8.1"
17
17
  },
18
18
  "optionalDependencies": {
19
- "@stigmer/runner-slim-darwin-arm64": "3.9.0",
20
- "@stigmer/runner-slim-darwin-x64": "3.9.0",
21
- "@stigmer/runner-slim-linux-x64": "3.9.0",
22
- "@stigmer/runner-slim-linux-arm64": "3.9.0",
23
- "@stigmer/runner-slim-win32-x64": "3.9.0"
19
+ "@stigmer/runner-slim-darwin-arm64": "3.11.0",
20
+ "@stigmer/runner-slim-darwin-x64": "3.11.0",
21
+ "@stigmer/runner-slim-linux-x64": "3.11.0",
22
+ "@stigmer/runner-slim-linux-arm64": "3.11.0",
23
+ "@stigmer/runner-slim-win32-x64": "3.11.0"
24
24
  },
25
25
  "keywords": [
26
26
  "stigmer",
@@ -28071,6 +28071,7 @@ async function emitProgress(input, childExecId, progress) {
28071
28071
  type: "agent_call_progress",
28072
28072
  taskName: input.taskName,
28073
28073
  occurredAt: new Date().toISOString(),
28074
+ sequenceNumber: input.nextEventSequence?.(),
28074
28075
  childExecutionId: childExecId,
28075
28076
  agentSlug: input.config.agent ?? "",
28076
28077
  agentPhase: progress?.agentPhase ?? 0,
@@ -28125,6 +28126,13 @@ __webpack_require__.r(__webpack_exports__);
28125
28126
  * type-only imports, and pure JS/TS logic.
28126
28127
  */
28127
28128
 
28129
+ // Discovery's bounds ladder (issue #239): the activity heartbeats every 15s,
28130
+ // so heartbeatTimeout is pure LIVENESS (dead worker/pod detection) — it no
28131
+ // longer kills slow-but-alive discoveries. The activity bounds its own WORK
28132
+ // with a transport-aware init timeout (30s HTTP / 270s stdio) that fails with
28133
+ // an actionable, endpoint-naming error; startToCloseTimeout is the hard cap
28134
+ // above both. Keep the ordering: work bound < hard cap, heartbeat interval
28135
+ // (15s) < heartbeatTimeout.
28128
28136
  const discover = (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.proxyActivities)({
28129
28137
  startToCloseTimeout: "600s",
28130
28138
  heartbeatTimeout: "60s",
@@ -28452,7 +28460,21 @@ async function runWorkflowEngine(input, options) {
28452
28460
  dsl: model.document.dsl,
28453
28461
  });
28454
28462
  (0,_metrics_sink_js__WEBPACK_IMPORTED_MODULE_1__.recordExecutionStartMetric)(model.document.name);
28455
- await eventProxy.ResetEventSequence(executionId);
28463
+ // Event sequence numbers are workflow state: assigned here in the
28464
+ // deterministic sandbox (seeded from the persisted high-water mark) so
28465
+ // they are stable across activity retries, worker restarts, and
28466
+ // concurrent executions — the store can then treat re-sent sequences as
28467
+ // idempotent duplicates. Pre-patch histories recorded the activity
28468
+ // result as void and assigned sequences inside the emit activity from a
28469
+ // process-global counter; they must keep doing so on replay, hence the
28470
+ // gate. Remove the gate (and the activity's legacy counter) once
28471
+ // pre-patch executions have drained.
28472
+ const workflowAssignedSequences = (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.patched)("workflow-assigned-event-sequences");
28473
+ const eventLogHighWaterMark = await eventProxy.ResetEventSequence(executionId);
28474
+ let eventSequence = workflowAssignedSequences ? Number(eventLogHighWaterMark ?? 0) : 0;
28475
+ const nextEventSequence = workflowAssignedSequences
28476
+ ? () => ++eventSequence
28477
+ : undefined;
28456
28478
  let recoveryContext;
28457
28479
  if (options?.recoveryMode && executionId) {
28458
28480
  _temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.log.info("Recovery mode active — loading context", { executionId });
@@ -28476,10 +28498,16 @@ async function runWorkflowEngine(input, options) {
28476
28498
  const emitEvents = async (events) => {
28477
28499
  if (!executionId || events.length === 0)
28478
28500
  return;
28501
+ const stamped = nextEventSequence
28502
+ ? events.map(e => ({ ...e, sequenceNumber: nextEventSequence() }))
28503
+ : events;
28479
28504
  try {
28480
- await eventProxy.EmitWorkflowEvents(executionId, events, taskStatusAccumulator.toArray());
28505
+ await eventProxy.EmitWorkflowEvents(executionId, stamped, taskStatusAccumulator.toArray());
28481
28506
  }
28482
28507
  catch (err) {
28508
+ // Final guard after the activity's retries are exhausted: a run must
28509
+ // not die because its timeline write failed. With workflow-assigned
28510
+ // sequences the result is a gap in the log, never a poisoned log.
28483
28511
  _temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.log.warn("Failed to emit workflow events (non-fatal)", {
28484
28512
  executionId,
28485
28513
  eventCount: events.length,
@@ -28531,6 +28559,7 @@ async function runWorkflowEngine(input, options) {
28531
28559
  parentWorkflowId: agentMeta.parentWorkflowId || (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.workflowInfo)().workflowId,
28532
28560
  taskName: agentMeta.taskName,
28533
28561
  workflowExecutionId: agentMeta.workflowExecutionId || executionId,
28562
+ nextEventSequence,
28534
28563
  }),
28535
28564
  promoteTaskOutput: (taskOutput, wexId, taskName, displayName) => promoteProxy.PromoteTaskOutput(taskOutput, wexId || executionId, taskName, displayName),
28536
28565
  };
@@ -28714,7 +28743,17 @@ async function executeFromExecution(input) {
28714
28743
  envCount: Object.keys(materialized.env).length,
28715
28744
  });
28716
28745
  try {
28717
- return await (0,_engine_core_js__WEBPACK_IMPORTED_MODULE_1__.runWorkflowEngine)(materialized, {
28746
+ // The engine's output is deliberately NOT returned. Both orchestrator
28747
+ // parents discard this workflow's result (Java awaits it as Void, Go
28748
+ // passes nil to Get), and the output already reaches users through
28749
+ // PromoteTaskOutput and the event log. Returning it would (a) persist
28750
+ // the full workflow output — which may embed secrets — as a plaintext
28751
+ // payload in the cross-language parent's history, and (b) hand the Java
28752
+ // parent a payload it must decode: once the payload-encryption codec is
28753
+ // active, an encrypted result would fail Java's converter lookup
28754
+ // (fromPayloads has no Void special-case). A void return produces a
28755
+ // data-less binary/null payload that every SDK handles natively.
28756
+ await (0,_engine_core_js__WEBPACK_IMPORTED_MODULE_1__.runWorkflowEngine)(materialized, {
28718
28757
  checkPause,
28719
28758
  recoveryMode: input.recovery_mode ?? false,
28720
28759
  });