@opengeni/worker-bundle 0.7.2 → 0.7.4
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/dist/index.d.ts +5 -4
- package/dist/index.js +65 -69
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/activities/agent-turn.ts +63 -84
- package/src/activities/common.ts +8 -2
- package/src/activities/goals.ts +1 -1
- package/src/activities/parent-wake.ts +5 -18
- package/src/activities/scheduled-tasks.ts +2 -2
- package/src/activities/session-state.ts +11 -13
- package/src/activities/types.ts +6 -6
- package/src/activities.ts +1 -1
- package/src/index.ts +4 -4
- package/src/workflows/activities.ts +8 -2
- package/src/workflows/session.ts +78 -97
- package/src/workflows/workflow-wake.ts +2 -1
- package/src/workflow-wake-contract.ts +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type WakeSessionWorkflowSignal = (input: {
|
|
|
15
15
|
sessionId: string;
|
|
16
16
|
workflowId: string;
|
|
17
17
|
wakeRevision: number;
|
|
18
|
-
|
|
18
|
+
interruptionRequested?: boolean;
|
|
19
19
|
}) => Promise<void>;
|
|
20
20
|
type SignalCodexCapacityWorkflow = (input: {
|
|
21
21
|
accountId: string;
|
|
@@ -70,6 +70,7 @@ type RunAgentTurnInput = {
|
|
|
70
70
|
workspaceId: string;
|
|
71
71
|
sessionId: string;
|
|
72
72
|
workflowId: string;
|
|
73
|
+
workflowRunId: string;
|
|
73
74
|
attemptId: string;
|
|
74
75
|
trigger: {
|
|
75
76
|
kind: "next";
|
|
@@ -78,11 +79,11 @@ type RunAgentTurnInput = {
|
|
|
78
79
|
triggerEventId: string;
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
|
-
type
|
|
82
|
+
type SettleSessionInterruptionsInput = {
|
|
82
83
|
accountId: string;
|
|
83
84
|
workspaceId: string;
|
|
84
85
|
sessionId: string;
|
|
85
|
-
|
|
86
|
+
attemptId: string;
|
|
86
87
|
workflowId: string;
|
|
87
88
|
};
|
|
88
89
|
type FailSessionAttemptInput = {
|
|
@@ -252,7 +253,7 @@ declare function createControlActivities(dependencies?: ActivityDependencies): {
|
|
|
252
253
|
maybeContinueGoal: (input: MaybeContinueGoalInput) => Promise<MaybeContinueGoalResult>;
|
|
253
254
|
dispatchScheduledTaskRun: (input: DispatchScheduledTaskRunInput) => Promise<DispatchScheduledTaskRunResult>;
|
|
254
255
|
failSessionAttempt: (input: FailSessionAttemptInput) => Promise<void>;
|
|
255
|
-
|
|
256
|
+
settleSessionInterruptions: (input: SettleSessionInterruptionsInput) => Promise<{
|
|
256
257
|
action: "paused" | "continue" | "stale";
|
|
257
258
|
}>;
|
|
258
259
|
recoverDispatch: (input: RecoverDispatchInput) => Promise<RecoverDispatchResult>;
|
package/dist/index.js
CHANGED
|
@@ -807,6 +807,7 @@ function assertReusableSessionRevivable(status) {
|
|
|
807
807
|
}
|
|
808
808
|
function scheduledUserMessagePayload(prompt, resources, tools, taskId, runId) {
|
|
809
809
|
return {
|
|
810
|
+
type: "scheduled_occurrence",
|
|
810
811
|
text: prompt,
|
|
811
812
|
scheduledTaskId: taskId,
|
|
812
813
|
scheduledTaskRunId: runId,
|
|
@@ -1462,7 +1463,7 @@ function createGoalActivities(services) {
|
|
|
1462
1463
|
accountId: input.accountId,
|
|
1463
1464
|
workspaceId: input.workspaceId,
|
|
1464
1465
|
sessionId: input.sessionId,
|
|
1465
|
-
kind: "
|
|
1466
|
+
kind: "goal_continuation",
|
|
1466
1467
|
classification: "info",
|
|
1467
1468
|
sourceId: decision.goal.id,
|
|
1468
1469
|
dedupeKey: `goal-continuation:${decision.goal.id}:${decision.goal.version}:${decision.autoContinuation}`,
|
|
@@ -1662,9 +1663,6 @@ import {
|
|
|
1662
1663
|
markSessionSystemUpdateOutboxFailed
|
|
1663
1664
|
} from "@opengeni/db";
|
|
1664
1665
|
async function notifyParentOfChildTerminal(svc, workspaceId, childSessionId, terminalStatus, episodeKey) {
|
|
1665
|
-
if (!svc.settings.childCompletionParentWakeEnabled) {
|
|
1666
|
-
return;
|
|
1667
|
-
}
|
|
1668
1666
|
try {
|
|
1669
1667
|
const child = await getSession(svc.db, workspaceId, childSessionId);
|
|
1670
1668
|
if (!child || !child.parentSessionId) {
|
|
@@ -1678,7 +1676,7 @@ async function notifyParentOfChildTerminal(svc, workspaceId, childSessionId, ter
|
|
|
1678
1676
|
workspaceId,
|
|
1679
1677
|
sourceSessionId: child.id,
|
|
1680
1678
|
targetSessionId: child.parentSessionId,
|
|
1681
|
-
kind: "
|
|
1679
|
+
kind: "child_terminal_result",
|
|
1682
1680
|
classification: terminalStatus === "failed" ? "failure" : goal?.status === "paused" ? "action_required" : "success",
|
|
1683
1681
|
sourceId: child.id,
|
|
1684
1682
|
dedupeKey: clientEventId,
|
|
@@ -1751,9 +1749,6 @@ async function deliverParentSystemUpdateOutbox(svc, outbox) {
|
|
|
1751
1749
|
}
|
|
1752
1750
|
async function reconcilePendingParentSystemUpdates(svc, limit = 100, overrides = {}) {
|
|
1753
1751
|
const claimPendingSessionSystemUpdateOutboxFn = overrides.claimPendingSessionSystemUpdateOutbox ?? claimPendingSessionSystemUpdateOutbox;
|
|
1754
|
-
if (!svc.settings.childCompletionParentWakeEnabled) {
|
|
1755
|
-
return { claimed: 0, delivered: 0, failed: 0 };
|
|
1756
|
-
}
|
|
1757
1752
|
const rows = await claimPendingSessionSystemUpdateOutboxFn(svc.db, limit);
|
|
1758
1753
|
let delivered = 0;
|
|
1759
1754
|
let failed = 0;
|
|
@@ -1787,7 +1782,7 @@ async function reconcilePendingSessionWorkflowWakes(svc, limit = 1e3, overrides
|
|
|
1787
1782
|
sessionId: repair.sessionId,
|
|
1788
1783
|
workflowId: repair.temporalWorkflowId,
|
|
1789
1784
|
wakeRevision: repair.wakeRevision,
|
|
1790
|
-
...repair.
|
|
1785
|
+
...repair.interruptionRequested ? { interruptionRequested: true } : {}
|
|
1791
1786
|
});
|
|
1792
1787
|
delivered += 1;
|
|
1793
1788
|
} catch (error) {
|
|
@@ -1805,6 +1800,7 @@ async function reconcilePendingSessionWorkflowWakes(svc, limit = 1e3, overrides
|
|
|
1805
1800
|
}
|
|
1806
1801
|
function childCompletionPayload(child, goal, terminalStatus) {
|
|
1807
1802
|
return {
|
|
1803
|
+
type: "child_terminal_result",
|
|
1808
1804
|
childSessionId: child.id,
|
|
1809
1805
|
status: terminalStatus,
|
|
1810
1806
|
...goal ? {
|
|
@@ -4268,11 +4264,11 @@ import {
|
|
|
4268
4264
|
} from "@opengeni/contracts";
|
|
4269
4265
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
4270
4266
|
var PROVIDER_BACKPRESSURE_DELAY_MS = 6e4;
|
|
4271
|
-
function
|
|
4272
|
-
return
|
|
4273
|
-
|
|
4267
|
+
function providerRecoveryResult() {
|
|
4268
|
+
return {
|
|
4269
|
+
status: "recovering",
|
|
4274
4270
|
continueDelayMs: PROVIDER_BACKPRESSURE_DELAY_MS
|
|
4275
|
-
}
|
|
4271
|
+
};
|
|
4276
4272
|
}
|
|
4277
4273
|
function filterUnmaterializedSandboxFileDownloads(downloads, materializedFileIds) {
|
|
4278
4274
|
if (downloads.length === 0 || materializedFileIds.size === 0) {
|
|
@@ -4683,7 +4679,11 @@ function createRunAgentTurnActivity(services) {
|
|
|
4683
4679
|
let triggerEventId;
|
|
4684
4680
|
const claimedResult = (result) => {
|
|
4685
4681
|
if (!turnId) throw new Error("Claimed activity result produced before turn admission");
|
|
4686
|
-
return {
|
|
4682
|
+
return {
|
|
4683
|
+
...result,
|
|
4684
|
+
turnId,
|
|
4685
|
+
attemptId: input.attemptId
|
|
4686
|
+
};
|
|
4687
4687
|
};
|
|
4688
4688
|
const machineOpObserver = makeMachineOpObserver(
|
|
4689
4689
|
runtimeMetricsHooksForObservability(observability)
|
|
@@ -5082,6 +5082,7 @@ function createRunAgentTurnActivity(services) {
|
|
|
5082
5082
|
const claim = await claimSessionWorkForAttempt(db, input.workspaceId, {
|
|
5083
5083
|
sessionId: input.sessionId,
|
|
5084
5084
|
workflowId: input.workflowId,
|
|
5085
|
+
workflowRunId: input.workflowRunId,
|
|
5085
5086
|
attemptId: input.attemptId,
|
|
5086
5087
|
dispatchId,
|
|
5087
5088
|
trigger: input.trigger
|
|
@@ -5205,7 +5206,6 @@ function createRunAgentTurnActivity(services) {
|
|
|
5205
5206
|
turnId,
|
|
5206
5207
|
triggerEventId,
|
|
5207
5208
|
attemptId: input.attemptId,
|
|
5208
|
-
childCompletionParentWakeEnabled: settings.childCompletionParentWakeEnabled,
|
|
5209
5209
|
turnStatus: inputSettlement.turnStatus,
|
|
5210
5210
|
sessionStatus: inputSettlement.sessionStatus,
|
|
5211
5211
|
activeTurnId: inputSettlement.activeTurnId,
|
|
@@ -5876,8 +5876,7 @@ function createRunAgentTurnActivity(services) {
|
|
|
5876
5876
|
});
|
|
5877
5877
|
if (turn.source === "compaction") {
|
|
5878
5878
|
const persistentSessionSettings = {
|
|
5879
|
-
titleIsSet: Boolean(session.title?.trim())
|
|
5880
|
-
childNotificationsMode: typeof session.metadata === "object" && session.metadata !== null && session.metadata.childNotificationsMode === "passive" ? "passive" : "digest"
|
|
5879
|
+
titleIsSet: Boolean(session.title?.trim())
|
|
5881
5880
|
};
|
|
5882
5881
|
const compactionInstructions = appendPersistentSessionSettings(
|
|
5883
5882
|
appendSessionInstructions(
|
|
@@ -6248,6 +6247,8 @@ function createRunAgentTurnActivity(services) {
|
|
|
6248
6247
|
// the caller by its own identity (sacred-pause guard), not the racy
|
|
6249
6248
|
// live active pointer.
|
|
6250
6249
|
...turnId ? { turnId } : {},
|
|
6250
|
+
attemptId: input.attemptId,
|
|
6251
|
+
executionGeneration,
|
|
6251
6252
|
subjectId: "worker:first-party-mcp",
|
|
6252
6253
|
subjectLabel: "OpenGeni worker",
|
|
6253
6254
|
resolveCredential,
|
|
@@ -6271,8 +6272,7 @@ function createRunAgentTurnActivity(services) {
|
|
|
6271
6272
|
reasoningEffort: turn.reasoningEffort,
|
|
6272
6273
|
genesisTitleHint: isGenesisTurn,
|
|
6273
6274
|
persistentSessionSettings: {
|
|
6274
|
-
titleIsSet: Boolean(session.title?.trim())
|
|
6275
|
-
childNotificationsMode: typeof session.metadata === "object" && session.metadata !== null && session.metadata.childNotificationsMode === "passive" ? "passive" : "digest"
|
|
6275
|
+
titleIsSet: Boolean(session.title?.trim())
|
|
6276
6276
|
},
|
|
6277
6277
|
sandboxEnvironment,
|
|
6278
6278
|
// TOKEN-BROKER (B1): forward the per-turn git token OFF-MANIFEST as the clone
|
|
@@ -6680,6 +6680,7 @@ function createRunAgentTurnActivity(services) {
|
|
|
6680
6680
|
throwIfWorkerShuttingDown();
|
|
6681
6681
|
const ownedEstablished = resolvedSandbox?.established ?? lazyOwnedSandbox;
|
|
6682
6682
|
const runStreamOnce = () => runtime.runStream(agent, runInput, modelRunSettings, {
|
|
6683
|
+
...activityContext ? { signal: activityContext.cancellationSignal } : {},
|
|
6683
6684
|
sandboxEnvironment,
|
|
6684
6685
|
onRuntimeEvent: async (event) => {
|
|
6685
6686
|
await renewCodexLease("runtime_event");
|
|
@@ -6882,7 +6883,7 @@ function createRunAgentTurnActivity(services) {
|
|
|
6882
6883
|
}
|
|
6883
6884
|
} finally {
|
|
6884
6885
|
if (!streamDone) {
|
|
6885
|
-
|
|
6886
|
+
void iterator.return?.().catch(() => void 0);
|
|
6886
6887
|
}
|
|
6887
6888
|
}
|
|
6888
6889
|
await batcher.flush();
|
|
@@ -7181,7 +7182,7 @@ function createRunAgentTurnActivity(services) {
|
|
|
7181
7182
|
activityError = error;
|
|
7182
7183
|
await flushRuntimeBatcher();
|
|
7183
7184
|
turnMetricOutcome = "cancelled";
|
|
7184
|
-
|
|
7185
|
+
throw new CancelledFailure("TURN_ATTEMPT_FENCED", [], error);
|
|
7185
7186
|
}
|
|
7186
7187
|
if (error instanceof CancelledFailure) {
|
|
7187
7188
|
activityStatus = "cancelled";
|
|
@@ -7729,35 +7730,30 @@ function createRunAgentTurnActivity(services) {
|
|
|
7729
7730
|
}
|
|
7730
7731
|
const failure = agentRunFailurePayload(error);
|
|
7731
7732
|
if (failure.retryable && publish && turnId && turnStartedPublished) {
|
|
7732
|
-
const
|
|
7733
|
-
const goalActive = Boolean(goal && goal.status === "active");
|
|
7734
|
-
const recoveryRouting = providerRetryRecovery(goalActive);
|
|
7733
|
+
const recoveryResult = providerRecoveryResult();
|
|
7735
7734
|
await flushRuntimeBatcher();
|
|
7736
|
-
await reconcileConversationTruth();
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
})) {
|
|
7735
|
+
await reconcileConversationTruth({ requireDurable: true });
|
|
7736
|
+
const recovery = await requestSessionTurnRecovery(db, input.workspaceId, {
|
|
7737
|
+
sessionId: input.sessionId,
|
|
7738
|
+
turnId,
|
|
7739
|
+
triggerEventId,
|
|
7740
|
+
attemptId: input.attemptId,
|
|
7741
|
+
reason: failure.code ?? "provider_unavailable",
|
|
7742
|
+
detail: {
|
|
7743
|
+
...failure,
|
|
7744
|
+
continueDelayMs: recoveryResult.continueDelayMs
|
|
7745
|
+
}
|
|
7746
|
+
});
|
|
7747
|
+
if (recovery.action === "stale") {
|
|
7748
|
+
activityStatus = "cancelled";
|
|
7749
|
+
turnMetricOutcome = "cancelled";
|
|
7752
7750
|
return claimedResult({ status: "cancelled" });
|
|
7753
7751
|
}
|
|
7754
|
-
|
|
7755
|
-
|
|
7752
|
+
await publishDurableSessionEvents(bus, input.workspaceId, input.sessionId, recovery.events);
|
|
7753
|
+
turnMetricOutcome = "recovering";
|
|
7754
|
+
activityStatus = "recovering";
|
|
7756
7755
|
activityError = error;
|
|
7757
|
-
return claimedResult(
|
|
7758
|
-
status: "idle",
|
|
7759
|
-
...recoveryRouting.continueDelayMs !== void 0 ? { continueDelayMs: recoveryRouting.continueDelayMs } : {}
|
|
7760
|
-
});
|
|
7756
|
+
return claimedResult(recoveryResult);
|
|
7761
7757
|
}
|
|
7762
7758
|
activityStatus = "failed";
|
|
7763
7759
|
activityError = error;
|
|
@@ -9085,7 +9081,7 @@ function createScheduledTaskActivities(services) {
|
|
|
9085
9081
|
accountId: task.accountId,
|
|
9086
9082
|
workspaceId: task.workspaceId,
|
|
9087
9083
|
sessionId: session.id,
|
|
9088
|
-
kind: "
|
|
9084
|
+
kind: "scheduled_occurrence",
|
|
9089
9085
|
classification: "info",
|
|
9090
9086
|
sourceId: run.id,
|
|
9091
9087
|
dedupeKey: `scheduled-wake:${run.id}`,
|
|
@@ -9179,7 +9175,7 @@ function createScheduledTaskActivities(services) {
|
|
|
9179
9175
|
accountId: task.accountId,
|
|
9180
9176
|
workspaceId: task.workspaceId,
|
|
9181
9177
|
sessionId: session.id,
|
|
9182
|
-
kind: "
|
|
9178
|
+
kind: "scheduled_occurrence",
|
|
9183
9179
|
classification: "info",
|
|
9184
9180
|
sourceId: run.id,
|
|
9185
9181
|
dedupeKey: `scheduled-wake:${run.id}`,
|
|
@@ -9294,7 +9290,7 @@ function startOfUtcMonth4() {
|
|
|
9294
9290
|
|
|
9295
9291
|
// src/activities/session-state.ts
|
|
9296
9292
|
import {
|
|
9297
|
-
|
|
9293
|
+
settleSessionAttemptInterruptions,
|
|
9298
9294
|
applySessionTurnSettlement as applySessionTurnSettlement2,
|
|
9299
9295
|
recoverSessionDispatch,
|
|
9300
9296
|
peekSessionWork as peekSessionWorkDb,
|
|
@@ -9307,7 +9303,7 @@ import {
|
|
|
9307
9303
|
import { publishDurableSessionEvents as publishDurableSessionEvents3 } from "@opengeni/events";
|
|
9308
9304
|
var WORKER_DEATH_MAX_REDISPATCHES = 3;
|
|
9309
9305
|
function createSessionStateActivities(services, overrides = {}) {
|
|
9310
|
-
const
|
|
9306
|
+
const settleSessionAttemptInterruptionsFn = overrides.settleSessionAttemptInterruptions ?? settleSessionAttemptInterruptions;
|
|
9311
9307
|
const applySessionTurnSettlementFn = overrides.applySessionTurnSettlement ?? applySessionTurnSettlement2;
|
|
9312
9308
|
const recoverSessionDispatchFn = overrides.recoverSessionDispatch ?? recoverSessionDispatch;
|
|
9313
9309
|
const peekSessionWorkFn = overrides.peekSessionWork ?? peekSessionWorkDb;
|
|
@@ -9338,7 +9334,6 @@ function createSessionStateActivities(services, overrides = {}) {
|
|
|
9338
9334
|
turnId: turn.id,
|
|
9339
9335
|
triggerEventId: turn.triggerEventId,
|
|
9340
9336
|
attemptId: input.attemptId,
|
|
9341
|
-
childCompletionParentWakeEnabled: settings.childCompletionParentWakeEnabled,
|
|
9342
9337
|
turnStatus: "failed",
|
|
9343
9338
|
sessionStatus: "failed",
|
|
9344
9339
|
activeTurnId: null,
|
|
@@ -9362,16 +9357,17 @@ function createSessionStateActivities(services, overrides = {}) {
|
|
|
9362
9357
|
{ db, bus, settings, observability, wakeSessionWorkflow },
|
|
9363
9358
|
input.workspaceId,
|
|
9364
9359
|
input.sessionId,
|
|
9365
|
-
"failed"
|
|
9360
|
+
"failed",
|
|
9361
|
+
`turn:${turn.id}`
|
|
9366
9362
|
);
|
|
9367
9363
|
}
|
|
9368
|
-
async function
|
|
9364
|
+
async function settleSessionInterruptions2(input) {
|
|
9369
9365
|
const { db, bus, observability } = await services();
|
|
9370
|
-
const applied = await
|
|
9366
|
+
const applied = await settleSessionAttemptInterruptionsFn(
|
|
9371
9367
|
db,
|
|
9372
9368
|
input.workspaceId,
|
|
9373
9369
|
input.sessionId,
|
|
9374
|
-
input.
|
|
9370
|
+
input.attemptId
|
|
9375
9371
|
);
|
|
9376
9372
|
if (applied.events.length > 0) {
|
|
9377
9373
|
await publishDurableSessionEventsFn(bus, input.workspaceId, input.sessionId, applied.events);
|
|
@@ -9385,8 +9381,7 @@ function createSessionStateActivities(services, overrides = {}) {
|
|
|
9385
9381
|
sessionId: input.sessionId,
|
|
9386
9382
|
attemptId: input.attemptId,
|
|
9387
9383
|
timeoutType: input.timeoutType,
|
|
9388
|
-
maxRedispatches: WORKER_DEATH_MAX_REDISPATCHES
|
|
9389
|
-
childCompletionParentWakeEnabled: settings.childCompletionParentWakeEnabled
|
|
9384
|
+
maxRedispatches: WORKER_DEATH_MAX_REDISPATCHES
|
|
9390
9385
|
});
|
|
9391
9386
|
if (result.action === "stale" || result.action === "unclaimed") {
|
|
9392
9387
|
return { action: result.action };
|
|
@@ -9424,8 +9419,7 @@ function createSessionStateActivities(services, overrides = {}) {
|
|
|
9424
9419
|
const settled = await settleSessionIdleWithParentOutboxFn(
|
|
9425
9420
|
db,
|
|
9426
9421
|
input.workspaceId,
|
|
9427
|
-
input.sessionId
|
|
9428
|
-
settings.childCompletionParentWakeEnabled
|
|
9422
|
+
input.sessionId
|
|
9429
9423
|
);
|
|
9430
9424
|
if (settled.events.length > 0) {
|
|
9431
9425
|
await publishDurableSessionEventsFn(bus, input.workspaceId, input.sessionId, settled.events);
|
|
@@ -9444,7 +9438,7 @@ function createSessionStateActivities(services, overrides = {}) {
|
|
|
9444
9438
|
}
|
|
9445
9439
|
return {
|
|
9446
9440
|
failSessionAttempt: failSessionAttempt2,
|
|
9447
|
-
|
|
9441
|
+
settleSessionInterruptions: settleSessionInterruptions2,
|
|
9448
9442
|
recoverDispatch: recoverDispatch2,
|
|
9449
9443
|
peekSessionWork: peekSessionWork2,
|
|
9450
9444
|
markSessionIdle: markSessionIdle2
|
|
@@ -9936,7 +9930,7 @@ var defaultTurnActivities = createTurnActivities();
|
|
|
9936
9930
|
var runAgentTurn = defaultTurnActivities.runAgentTurn;
|
|
9937
9931
|
var indexDocument = defaultControlActivities.indexDocument;
|
|
9938
9932
|
var failSessionAttempt = defaultControlActivities.failSessionAttempt;
|
|
9939
|
-
var
|
|
9933
|
+
var settleSessionInterruptions = defaultControlActivities.settleSessionInterruptions;
|
|
9940
9934
|
var recoverDispatch = defaultControlActivities.recoverDispatch;
|
|
9941
9935
|
var peekSessionWork = defaultControlActivities.peekSessionWork;
|
|
9942
9936
|
var markSessionIdle = defaultControlActivities.markSessionIdle;
|
|
@@ -9952,7 +9946,7 @@ var verifyRigChange = defaultControlActivities.verifyRigChange;
|
|
|
9952
9946
|
var verifyRigVersion = defaultControlActivities.verifyRigVersion;
|
|
9953
9947
|
|
|
9954
9948
|
// src/workflows/activities.ts
|
|
9955
|
-
import { proxyActivities } from "@temporalio/workflow";
|
|
9949
|
+
import { ActivityCancellationType, proxyActivities } from "@temporalio/workflow";
|
|
9956
9950
|
var activity = proxyActivities({
|
|
9957
9951
|
startToCloseTimeout: "2 minutes",
|
|
9958
9952
|
retry: {
|
|
@@ -10066,10 +10060,12 @@ async function withTimeout(promise, timeoutMs) {
|
|
|
10066
10060
|
}
|
|
10067
10061
|
}
|
|
10068
10062
|
|
|
10069
|
-
// src/
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10063
|
+
// src/index.ts
|
|
10064
|
+
import {
|
|
10065
|
+
SESSION_WORKFLOW_WAKE_DISPATCHER_PERIOD_MS,
|
|
10066
|
+
SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID,
|
|
10067
|
+
SESSION_WORKFLOW_WAKE_DISPATCHER_WORKFLOW_TYPE
|
|
10068
|
+
} from "@opengeni/core";
|
|
10073
10069
|
|
|
10074
10070
|
// src/concurrency.ts
|
|
10075
10071
|
var TURN_WORKER_MAX_CONCURRENT_TURNS = 16;
|
|
@@ -10140,16 +10136,16 @@ async function createWorkerWorkflowSignaler(settings, db) {
|
|
|
10140
10136
|
sessionId,
|
|
10141
10137
|
workflowId,
|
|
10142
10138
|
wakeRevision,
|
|
10143
|
-
|
|
10139
|
+
interruptionRequested
|
|
10144
10140
|
}) => {
|
|
10145
|
-
if (
|
|
10141
|
+
if (interruptionRequested) {
|
|
10146
10142
|
await temporal.workflow.signalWithStart("sessionWorkflow", {
|
|
10147
10143
|
taskQueue: settings.temporalTaskQueue,
|
|
10148
10144
|
workflowId,
|
|
10149
10145
|
workflowIdReusePolicy: "ALLOW_DUPLICATE",
|
|
10150
10146
|
args: [{ accountId, workspaceId, sessionId }],
|
|
10151
10147
|
signal: "sessionControl",
|
|
10152
|
-
signalArgs: [
|
|
10148
|
+
signalArgs: []
|
|
10153
10149
|
});
|
|
10154
10150
|
} else {
|
|
10155
10151
|
await temporal.workflow.signalWithStart("sessionWorkflow", {
|