@stigmer/runner-slim 3.12.5 → 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.
- package/main.js +27 -18
- package/package.json +6 -6
- package/workflow-bundle.js +76 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/runner-slim",
|
|
3
|
-
"version": "3.12.
|
|
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.
|
|
20
|
-
"@stigmer/runner-slim-darwin-x64": "3.12.
|
|
21
|
-
"@stigmer/runner-slim-linux-x64": "3.12.
|
|
22
|
-
"@stigmer/runner-slim-linux-arm64": "3.12.
|
|
23
|
-
"@stigmer/runner-slim-win32-x64": "3.12.
|
|
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",
|
package/workflow-bundle.js
CHANGED
|
@@ -26909,7 +26909,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26909
26909
|
* Human input task executor — HITL approval gate.
|
|
26910
26910
|
*
|
|
26911
26911
|
* Pauses workflow execution until a human reviewer responds via signal.
|
|
26912
|
-
* Supports configurable timeout with policies (fail, auto-approve,
|
|
26912
|
+
* Supports configurable timeout with policies (fail, auto-approve,
|
|
26913
|
+
* auto-deny, escalate).
|
|
26913
26914
|
*
|
|
26914
26915
|
* The kernel validates the config and delegates to `ctx.awaitHumanInput()`
|
|
26915
26916
|
* which is wired to the Temporal workflow layer's signal/timer selector.
|
|
@@ -27017,6 +27018,12 @@ function validateConfig(config, taskName) {
|
|
|
27017
27018
|
* orchestrator's internal approve/deny words, which a reviewer of a
|
|
27018
27019
|
* custom-outcome gate was never offered. Binary gates (no custom outcomes)
|
|
27019
27020
|
* keep the plain approve/deny result.
|
|
27021
|
+
*
|
|
27022
|
+
* Escalate needs no remapping by construction (stigmer/stigmer#781): its
|
|
27023
|
+
* policy word IS the declared outcome's name — the loader (and the server
|
|
27024
|
+
* validator) only accept the escalate policy when an outcome named
|
|
27025
|
+
* "escalate" with `then` exists, so the caller's ordinary name lookup
|
|
27026
|
+
* routes the escalation branch.
|
|
27020
27027
|
*/
|
|
27021
27028
|
function applyTimeoutOutcomeContract(result, outcomes) {
|
|
27022
27029
|
if (!result.auto_resolved || result.reason !== "timeout" || !outcomes?.length) {
|
|
@@ -27944,6 +27951,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27944
27951
|
// ─────────────────────────────────────────────────────────────────────
|
|
27945
27952
|
// Signal Definitions
|
|
27946
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
|
+
*/
|
|
27947
27965
|
const childApprovalRequired = (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.defineSignal)("child_approval_required");
|
|
27948
27966
|
/** Sent by the platform immediately after the child AgentExecution starts. */
|
|
27949
27967
|
const childExecutionStarted = (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.defineSignal)("child_execution_started");
|
|
@@ -27985,14 +28003,26 @@ async function orchestrateAgentCall(input) {
|
|
|
27985
28003
|
let activityDone = false;
|
|
27986
28004
|
let activityResult = {};
|
|
27987
28005
|
let activityError = undefined;
|
|
27988
|
-
|
|
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();
|
|
27989
28012
|
let childExecId;
|
|
27990
28013
|
let initialProgressEmitted = false;
|
|
27991
|
-
(0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.setHandler)(childApprovalRequired, (
|
|
27992
|
-
|
|
27993
|
-
|
|
27994
|
-
|
|
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;
|
|
27995
28024
|
}
|
|
28025
|
+
pendingApprovalChildIds.add(signaledId);
|
|
27996
28026
|
});
|
|
27997
28027
|
(0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.setHandler)(childExecutionStarted, (payload) => {
|
|
27998
28028
|
// The Go server sends { executionId: "aex_xxx" } (struct with json tag).
|
|
@@ -28083,7 +28113,7 @@ async function orchestrateAgentCall(input) {
|
|
|
28083
28113
|
while (!activityDone) {
|
|
28084
28114
|
// Wait for a signal, activity completion, or periodic timeout for progress polling.
|
|
28085
28115
|
// condition() returns false on timeout, true when the predicate became true.
|
|
28086
|
-
const conditionMet = await (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.condition)(() => activityDone ||
|
|
28116
|
+
const conditionMet = await (0,_temporalio_workflow__WEBPACK_IMPORTED_MODULE_0__.condition)(() => activityDone || pendingApprovalChildIds.size > 0 || (!!childExecId && !initialProgressEmitted), PROGRESS_POLL_INTERVAL);
|
|
28087
28117
|
if (activityDone)
|
|
28088
28118
|
break;
|
|
28089
28119
|
// Emit initial progress with childExecutionId as soon as it's known
|
|
@@ -28109,18 +28139,32 @@ async function orchestrateAgentCall(input) {
|
|
|
28109
28139
|
}
|
|
28110
28140
|
await syncFileReviews(childExecId);
|
|
28111
28141
|
}
|
|
28112
|
-
// Handle HITL approval
|
|
28113
|
-
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
|
|
28117
|
-
|
|
28118
|
-
|
|
28119
|
-
|
|
28120
|
-
|
|
28121
|
-
|
|
28122
|
-
|
|
28123
|
-
|
|
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
|
+
}
|
|
28124
28168
|
}
|
|
28125
28169
|
}
|
|
28126
28170
|
}
|
|
@@ -28977,6 +29021,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28977
29021
|
* - "fail": throws an error
|
|
28978
29022
|
* - "approve": returns auto-approved output
|
|
28979
29023
|
* - "deny": returns auto-denied output
|
|
29024
|
+
* - "escalate": returns the "escalate" outcome — by the outcome-by-name
|
|
29025
|
+
* contract (stigmer/stigmer#781) the loader guarantees the gate declares
|
|
29026
|
+
* an outcome with that exact name and a `then` branch, so the executor's
|
|
29027
|
+
* ordinary outcome routing takes the escalation path.
|
|
28980
29028
|
*
|
|
28981
29029
|
* Signal payload shape:
|
|
28982
29030
|
* { outcome, form_data?, reviewer, reviewer_actor?, responded_at }
|
|
@@ -29022,6 +29070,15 @@ function handleTimeout(signalName, policy) {
|
|
|
29022
29070
|
auto_resolved: true,
|
|
29023
29071
|
reason: "timeout",
|
|
29024
29072
|
};
|
|
29073
|
+
case "escalate":
|
|
29074
|
+
// The outcome word IS the declared outcome's name (loader-enforced),
|
|
29075
|
+
// so no positional remapping happens downstream — the executor's name
|
|
29076
|
+
// lookup routes the escalation branch directly.
|
|
29077
|
+
return {
|
|
29078
|
+
outcome: "escalate",
|
|
29079
|
+
auto_resolved: true,
|
|
29080
|
+
reason: "timeout",
|
|
29081
|
+
};
|
|
29025
29082
|
case "fail":
|
|
29026
29083
|
default:
|
|
29027
29084
|
throw new Error(`human_input task timed out waiting for signal '${signalName}'`);
|