@stigmer/runner-slim 3.12.6 → 3.12.7

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 +26 -17
  2. package/package.json +6 -6
  3. package/workflow-bundle.js +55 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/runner-slim",
3
- "version": "3.12.6",
3
+ "version": "3.12.7",
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.12.6",
20
- "@stigmer/runner-slim-darwin-x64": "3.12.6",
21
- "@stigmer/runner-slim-linux-x64": "3.12.6",
22
- "@stigmer/runner-slim-linux-arm64": "3.12.6",
23
- "@stigmer/runner-slim-win32-x64": "3.12.6"
19
+ "@stigmer/runner-slim-darwin-arm64": "3.12.7",
20
+ "@stigmer/runner-slim-darwin-x64": "3.12.7",
21
+ "@stigmer/runner-slim-linux-x64": "3.12.7",
22
+ "@stigmer/runner-slim-linux-arm64": "3.12.7",
23
+ "@stigmer/runner-slim-win32-x64": "3.12.7"
24
24
  },
25
25
  "keywords": [
26
26
  "stigmer",
@@ -27951,6 +27951,17 @@ __webpack_require__.r(__webpack_exports__);
27951
27951
  // ─────────────────────────────────────────────────────────────────────
27952
27952
  // Signal Definitions
27953
27953
  // ─────────────────────────────────────────────────────────────────────
27954
+ /**
27955
+ * Identity-only "go look" trigger (DD-012, stigmer-cloud#509): the child's
27956
+ * server signals just the gated child's execution id, and this workflow
27957
+ * derives the gate from the child's persisted record. The payload MUST stay a
27958
+ * bare string: it crosses the polyglot boundary from the Java server, whose
27959
+ * client serializes proto messages as `json/protobuf` — an encoding this
27960
+ * worker's default converter cannot decode, which poisoned the workflow task
27961
+ * in a permanent retry loop (the original cloud#509 failure). The object
27962
+ * shape is tolerated for a future Go sender's natural `{executionId}` JSON,
27963
+ * mirroring child_execution_started's both-shapes handling below.
27964
+ */
27954
27965
  const childApprovalRequired = (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.defineSignal)("child_approval_required");
27955
27966
  /** Sent by the platform immediately after the child AgentExecution starts. */
27956
27967
  const childExecutionStarted = (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.defineSignal)("child_execution_started");
@@ -27992,14 +28003,26 @@ async function orchestrateAgentCall(input) {
27992
28003
  let activityDone = false;
27993
28004
  let activityResult = {};
27994
28005
  let activityError = undefined;
27995
- let pendingNotification;
28006
+ // Child ids whose approval gates await derivation. A set (not a flag)
28007
+ // because one workflow has ONE live handler per signal name: with parallel
28008
+ // agent_call tasks, whichever orchestration registered last receives every
28009
+ // child's signal, and each gate must be derived under its OWN child id for
28010
+ // the per-child status merge to file it correctly.
28011
+ const pendingApprovalChildIds = new Set();
27996
28012
  let childExecId;
27997
28013
  let initialProgressEmitted = false;
27998
- (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.setHandler)(childApprovalRequired, (notification) => {
27999
- pendingNotification = notification;
28000
- if (!childExecId && notification.executionId) {
28001
- childExecId = notification.executionId;
28014
+ (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.setHandler)(childApprovalRequired, (payload) => {
28015
+ // Identity-only signal (see the definition above): note the child and
28016
+ // mark its gate for derivation in the main loop — approval details never
28017
+ // travel through the signal itself.
28018
+ const signaledId = typeof payload === "string" ? payload : payload?.executionId;
28019
+ if (!signaledId) {
28020
+ return;
28021
+ }
28022
+ if (!childExecId) {
28023
+ childExecId = signaledId;
28002
28024
  }
28025
+ pendingApprovalChildIds.add(signaledId);
28003
28026
  });
28004
28027
  (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.setHandler)(childExecutionStarted, (payload) => {
28005
28028
  // The Go server sends { executionId: "aex_xxx" } (struct with json tag).
@@ -28090,7 +28113,7 @@ async function orchestrateAgentCall(input) {
28090
28113
  while (!activityDone) {
28091
28114
  // Wait for a signal, activity completion, or periodic timeout for progress polling.
28092
28115
  // condition() returns false on timeout, true when the predicate became true.
28093
- const conditionMet = await (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.condition)(() => activityDone || pendingNotification !== undefined || (!!childExecId && !initialProgressEmitted), PROGRESS_POLL_INTERVAL);
28116
+ const conditionMet = await (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.condition)(() => activityDone || pendingApprovalChildIds.size > 0 || (!!childExecId && !initialProgressEmitted), PROGRESS_POLL_INTERVAL);
28094
28117
  if (activityDone)
28095
28118
  break;
28096
28119
  // Emit initial progress with childExecutionId as soon as it's known
@@ -28116,18 +28139,32 @@ async function orchestrateAgentCall(input) {
28116
28139
  }
28117
28140
  await syncFileReviews(childExecId);
28118
28141
  }
28119
- // Handle HITL approval notification
28120
- if (pendingNotification) {
28121
- const notification = pendingNotification;
28122
- pendingNotification = undefined;
28123
- try {
28124
- await statusProxy.UpdateWorkflowTaskApprovalStatus(input.workflowExecutionId, input.taskName, notification);
28125
- }
28126
- catch (statusErr) {
28127
- _temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.log.warn("Failed to update workflow approval status (non-fatal)", {
28128
- error: String(statusErr),
28129
- taskName: input.taskName,
28130
- });
28142
+ // Handle HITL approval notifications: derive each signaled child's gate
28143
+ // from its persisted record (identity-only signal, DD-012). The child's
28144
+ // server persists the gate BEFORE signaling, so an empty derivation means
28145
+ // the gate already resolved — the activity answers false and there is
28146
+ // deliberately no retry (see updateWorkflowTaskApprovalStatus).
28147
+ if (pendingApprovalChildIds.size > 0) {
28148
+ // Drain a deterministic snapshot: insertion order is replay-stable, and
28149
+ // ids signaled during the awaits below land in the set for the next pass.
28150
+ const toDerive = [...pendingApprovalChildIds];
28151
+ pendingApprovalChildIds.clear();
28152
+ for (const signaledChildId of toDerive) {
28153
+ try {
28154
+ const surfaced = await statusProxy.UpdateWorkflowTaskApprovalStatus(input.workflowExecutionId, input.taskName, signaledChildId);
28155
+ if (!surfaced) {
28156
+ _temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.log.info("Child approval gate already resolved before derivation; nothing surfaced", {
28157
+ taskName: input.taskName,
28158
+ childExecId: signaledChildId,
28159
+ });
28160
+ }
28161
+ }
28162
+ catch (statusErr) {
28163
+ _temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.log.warn("Failed to update workflow approval status (non-fatal)", {
28164
+ error: String(statusErr),
28165
+ taskName: input.taskName,
28166
+ });
28167
+ }
28131
28168
  }
28132
28169
  }
28133
28170
  }