@opengeni/worker-bundle 0.16.29 → 0.20.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.
- package/dist/activities/agent-run-admission.d.ts +12 -0
- package/dist/activities/agent-turn.d.ts +110 -19
- package/dist/activities/api-integrations.d.ts +21 -0
- package/dist/activities/browser-state-artifact-reaper.d.ts +29 -0
- package/dist/activities/capabilities.d.ts +6 -0
- package/dist/activities/codemode-dispatcher.d.ts +35 -0
- package/dist/activities/codemode-token-renewal.d.ts +23 -0
- package/dist/activities/codex-capacity.d.ts +6 -5
- package/dist/activities/codex-image-generation.d.ts +21 -0
- package/dist/activities/context-compaction.d.ts +1 -0
- package/dist/activities/documents.d.ts +3 -2
- package/dist/activities/environment.d.ts +17 -8
- package/dist/activities/expiring-material-renewal.d.ts +1 -1
- package/dist/activities/file-upload-reaper.d.ts +7 -2
- package/dist/activities/gateway-image-generation.d.ts +39 -0
- package/dist/activities/gateway-video-generation.d.ts +53 -0
- package/dist/activities/generated-images.d.ts +112 -0
- package/dist/activities/git-credential-renewal.d.ts +1 -1
- package/dist/activities/goals.d.ts +2 -2
- package/dist/activities/google-drive-changes.d.ts +99 -0
- package/dist/activities/image-generation-operation.d.ts +74 -0
- package/dist/activities/image-generation-references.d.ts +25 -0
- package/dist/activities/knowledge-source-sync-driver.d.ts +23 -0
- package/dist/activities/knowledge-source-sync.d.ts +75 -0
- package/dist/activities/packs.d.ts +21 -36
- package/dist/activities/parent-wake.d.ts +1 -1
- package/dist/activities/retained-screenshot-reaper.d.ts +2 -2
- package/dist/activities/retained-screenshots.d.ts +36 -0
- package/dist/activities/rig-verification.d.ts +82 -5
- package/dist/activities/run-credential-renewal.d.ts +1 -1
- package/dist/activities/run-input.d.ts +3 -1
- package/dist/activities/sandbox-images.d.ts +14 -0
- package/dist/activities/sandbox-lease.d.ts +47 -9
- package/dist/activities/scheduled-tasks.d.ts +2 -2
- package/dist/activities/session-state.d.ts +7 -5
- package/dist/activities/site-auth-maintenance.d.ts +27 -0
- package/dist/activities/streaming.d.ts +1 -1
- package/dist/activities/types.d.ts +87 -5
- package/dist/activities/video-generation-admission.d.ts +43 -0
- package/dist/activities/video-generation-credential.d.ts +24 -0
- package/dist/activities/video-generation-reconciliation.d.ts +13 -0
- package/dist/activities/video-media-validation.d.ts +34 -0
- package/dist/activities/video-output-retention.d.ts +36 -0
- package/dist/activities/video-reference-staging.d.ts +55 -0
- package/dist/activities/workflow-wake.d.ts +2 -2
- package/dist/activities/workspace-capture.d.ts +10 -1
- package/dist/activities/xai-auth.d.ts +23 -0
- package/dist/activities/xai-image-generation.d.ts +26 -0
- package/dist/activities/xai-video-generation.d.ts +18 -0
- package/dist/activities-control-XURE4VKN.js +7221 -0
- package/dist/activities-control-XURE4VKN.js.map +1 -0
- package/dist/activities-control.d.ts +297 -0
- package/dist/activities-turn-6EBXGGLS.js +16036 -0
- package/dist/activities-turn-6EBXGGLS.js.map +1 -0
- package/dist/activities-turn.d.ts +17 -0
- package/dist/activities.d.ts +138 -150
- package/dist/activity-services.d.ts +10 -0
- package/dist/artifact-materializer-entry.d.ts +6 -0
- package/dist/artifact-materializer-entry.js +2662 -0
- package/dist/artifact-materializer-entry.js.map +1 -0
- package/dist/artifact-outbox-entry.d.ts +2 -0
- package/dist/artifact-outbox-entry.js +681 -0
- package/dist/artifact-outbox-entry.js.map +1 -0
- package/dist/chunk-5GRJIP5H.js +3092 -0
- package/dist/chunk-5GRJIP5H.js.map +1 -0
- package/dist/chunk-GRFQTTSQ.js +448 -0
- package/dist/chunk-GRFQTTSQ.js.map +1 -0
- package/dist/chunk-TYNPCG4U.js +906 -0
- package/dist/chunk-TYNPCG4U.js.map +1 -0
- package/dist/concurrency.d.ts +108 -5
- package/dist/editable-artifact-hint-broker.d.ts +49 -0
- package/dist/editable-artifact-materializer-launcher.d.ts +49 -0
- package/dist/editable-artifact-materializer-service.d.ts +108 -0
- package/dist/editable-artifact-materializer-storage.d.ts +12 -0
- package/dist/editable-artifact-materializer-subprocess.d.ts +50 -0
- package/dist/editable-artifact-materializer.d.ts +262 -0
- package/dist/editable-artifact-outbox-dispatcher.d.ts +44 -0
- package/dist/editable-artifact-outbox-service.d.ts +70 -0
- package/dist/host-export.d.ts +1 -1
- package/dist/index.d.ts +189 -10
- package/dist/index.js +715 -17380
- package/dist/index.js.map +1 -1
- package/dist/memory-pressure-guard.d.ts +57 -0
- package/dist/model-checkpoint-memory-collector.d.ts +23 -0
- package/dist/model-context-contributions.d.ts +40 -0
- package/dist/observability-metrics.d.ts +53 -1
- package/dist/sandbox-reaper-contract.d.ts +40 -0
- package/dist/sandbox-reaper-timeout.d.ts +14 -0
- package/dist/sandbox-resume.d.ts +34 -7
- package/dist/sandbox-routing.d.ts +6 -0
- package/dist/worker-service-lifecycle.d.ts +6 -2
- package/dist/workflow-bundle.js +1094 -370
- package/dist/workflows/activities.d.ts +8 -2
- package/dist/workflows/document-index.d.ts +1 -1
- package/dist/workflows/knowledge-source-sync.d.ts +13 -0
- package/dist/workflows/rig-verification.d.ts +1 -1
- package/dist/workflows/sandbox-reaper.d.ts +8 -0
- package/dist/workflows/scheduled-tasks.d.ts +1 -1
- package/dist/workflows/session.d.ts +2 -2
- package/dist/workflows/site-auth-maintenance.d.ts +2 -0
- package/dist/workflows/video-generation.d.ts +10 -0
- package/dist/workflows/workflow-wake.d.ts +1 -1
- package/dist/workflows.d.ts +10 -7
- package/package.json +35 -15
- package/src/activities/agent-run-admission.ts +76 -0
- package/src/activities/agent-turn.ts +2600 -340
- package/src/activities/api-integrations.ts +138 -0
- package/src/activities/browser-state-artifact-reaper.ts +120 -0
- package/src/activities/capabilities.ts +10 -0
- package/src/activities/codemode-dispatcher.ts +335 -0
- package/src/activities/codemode-token-renewal.ts +64 -0
- package/src/activities/codex-capacity.ts +54 -7
- package/src/activities/codex-image-generation.ts +56 -0
- package/src/activities/context-compaction.ts +38 -3
- package/src/activities/documents.ts +14 -4
- package/src/activities/environment.ts +54 -45
- package/src/activities/expiring-material-renewal.ts +1 -1
- package/src/activities/file-upload-reaper.ts +34 -3
- package/src/activities/gateway-image-generation.ts +146 -0
- package/src/activities/gateway-video-generation.ts +298 -0
- package/src/activities/generated-images.ts +860 -0
- package/src/activities/goals.ts +8 -3
- package/src/activities/google-drive-changes.ts +454 -0
- package/src/activities/image-generation-operation.ts +333 -0
- package/src/activities/image-generation-references.ts +118 -0
- package/src/activities/knowledge-source-sync-driver.ts +27 -0
- package/src/activities/knowledge-source-sync.ts +2840 -0
- package/src/activities/mcp-credentials.ts +1 -0
- package/src/activities/packs.ts +75 -152
- package/src/activities/parent-wake.ts +13 -1
- package/src/activities/retained-screenshot-reaper.ts +2 -2
- package/src/activities/retained-screenshots.ts +453 -28
- package/src/activities/rig-verification.ts +554 -43
- package/src/activities/run-input.ts +22 -6
- package/src/activities/sandbox-images.ts +167 -0
- package/src/activities/sandbox-lease.ts +1065 -483
- package/src/activities/scheduled-tasks.ts +104 -74
- package/src/activities/session-state.ts +22 -4
- package/src/activities/site-auth-maintenance.ts +269 -0
- package/src/activities/streaming.ts +42 -3
- package/src/activities/types.ts +104 -5
- package/src/activities/video-generation-admission.ts +303 -0
- package/src/activities/video-generation-credential.ts +112 -0
- package/src/activities/video-generation-reconciliation.ts +771 -0
- package/src/activities/video-media-validation.ts +332 -0
- package/src/activities/video-output-retention.ts +314 -0
- package/src/activities/video-reference-staging.ts +350 -0
- package/src/activities/workflow-wake.ts +2 -2
- package/src/activities/workspace-capture.ts +44 -10
- package/src/activities/xai-auth.ts +122 -0
- package/src/activities/xai-image-generation.ts +86 -0
- package/src/activities/xai-video-generation.ts +69 -0
- package/src/activities-control.ts +58 -0
- package/src/activities-turn.ts +40 -0
- package/src/activities.ts +53 -124
- package/src/activity-services.ts +62 -0
- package/src/artifact-materializer-entry.ts +35 -0
- package/src/artifact-outbox-entry.ts +29 -0
- package/src/concurrency.ts +484 -6
- package/src/editable-artifact-hint-broker.ts +235 -0
- package/src/editable-artifact-materializer-launcher.ts +515 -0
- package/src/editable-artifact-materializer-service.ts +787 -0
- package/src/editable-artifact-materializer-storage.ts +413 -0
- package/src/editable-artifact-materializer-subprocess.ts +956 -0
- package/src/editable-artifact-materializer.ts +1289 -0
- package/src/editable-artifact-outbox-dispatcher.ts +244 -0
- package/src/editable-artifact-outbox-service.ts +438 -0
- package/src/index.ts +328 -72
- package/src/memory-pressure-guard.ts +489 -0
- package/src/model-checkpoint-memory-collector.ts +123 -0
- package/src/model-context-contributions.ts +159 -0
- package/src/observability-metrics.ts +297 -13
- package/src/sandbox-reaper-contract.ts +73 -0
- package/src/sandbox-reaper-timeout.ts +79 -0
- package/src/sandbox-resume.ts +294 -153
- package/src/sandbox-routing.ts +32 -24
- package/src/worker-service-lifecycle.ts +80 -14
- package/src/workflows/activities.ts +31 -0
- package/src/workflows/file-upload-reaper.ts +9 -1
- package/src/workflows/knowledge-source-sync.ts +83 -0
- package/src/workflows/sandbox-reaper.ts +183 -21
- package/src/workflows/scheduled-tasks.ts +42 -6
- package/src/workflows/session.ts +20 -6
- package/src/workflows/site-auth-maintenance.ts +14 -0
- package/src/workflows/video-generation.ts +36 -0
- package/src/workflows.ts +18 -1
- package/dist/activities/toolspace-token-renewal.d.ts +0 -23
- package/src/activities/toolspace-token-renewal.ts +0 -64
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getExternalWorkflowHandle,
|
|
3
|
+
ParentClosePolicy,
|
|
4
|
+
patched,
|
|
5
|
+
startChild,
|
|
6
|
+
workflowInfo,
|
|
7
|
+
WorkflowIdReusePolicy,
|
|
8
|
+
} from "@temporalio/workflow";
|
|
2
9
|
import type { TurnInitiator } from "@opengeni/contracts";
|
|
3
10
|
import { scheduledTaskActivity } from "./activities";
|
|
11
|
+
import {
|
|
12
|
+
knowledgeSourceSyncWake,
|
|
13
|
+
knowledgeSourceSyncWorkflow,
|
|
14
|
+
knowledgeSourceSyncWorkflowId,
|
|
15
|
+
} from "./knowledge-source-sync";
|
|
4
16
|
|
|
5
17
|
type ScheduledTaskFireWorkflowBase = {
|
|
6
18
|
accountId: string;
|
|
@@ -16,7 +28,7 @@ export type ScheduledTaskFireWorkflowInput = ScheduledTaskFireWorkflowBase &
|
|
|
16
28
|
initiator?: never;
|
|
17
29
|
}
|
|
18
30
|
| {
|
|
19
|
-
triggerType: "manual";
|
|
31
|
+
triggerType: "manual" | "initial" | "provider_event" | "retry" | "repair";
|
|
20
32
|
agentRunUsageIdempotencyKey: string;
|
|
21
33
|
initiator: TurnInitiator;
|
|
22
34
|
}
|
|
@@ -30,7 +42,7 @@ export async function scheduledTaskFireWorkflow(
|
|
|
30
42
|
// the exact charging identity.
|
|
31
43
|
if (
|
|
32
44
|
patched("scheduled-task-manual-initiator-v1") &&
|
|
33
|
-
input.triggerType
|
|
45
|
+
input.triggerType !== "scheduled" &&
|
|
34
46
|
(!input.agentRunUsageIdempotencyKey || !input.initiator)
|
|
35
47
|
) {
|
|
36
48
|
return;
|
|
@@ -40,14 +52,38 @@ export async function scheduledTaskFireWorkflow(
|
|
|
40
52
|
taskId: input.taskId,
|
|
41
53
|
producerKey: workflowInfo().workflowId,
|
|
42
54
|
};
|
|
43
|
-
await scheduledTaskActivity.dispatchScheduledTaskRun(
|
|
44
|
-
input.triggerType
|
|
55
|
+
const result = await scheduledTaskActivity.dispatchScheduledTaskRun(
|
|
56
|
+
input.triggerType !== "scheduled"
|
|
45
57
|
? {
|
|
46
58
|
...base,
|
|
47
|
-
triggerType:
|
|
59
|
+
triggerType: input.triggerType,
|
|
48
60
|
agentRunUsageIdempotencyKey: input.agentRunUsageIdempotencyKey,
|
|
49
61
|
initiator: input.initiator,
|
|
50
62
|
}
|
|
51
63
|
: { ...base, triggerType: "scheduled" },
|
|
52
64
|
);
|
|
65
|
+
if (result.action !== "knowledge_source_sync") return;
|
|
66
|
+
|
|
67
|
+
const workflowId = knowledgeSourceSyncWorkflowId(result.sourceId);
|
|
68
|
+
try {
|
|
69
|
+
await startChild(knowledgeSourceSyncWorkflow, {
|
|
70
|
+
workflowId,
|
|
71
|
+
workflowIdReusePolicy: WorkflowIdReusePolicy.ALLOW_DUPLICATE,
|
|
72
|
+
parentClosePolicy: ParentClosePolicy.ABANDON,
|
|
73
|
+
args: [result],
|
|
74
|
+
});
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (!alreadyRunningWorkflow(error)) throw error;
|
|
77
|
+
await getExternalWorkflowHandle(workflowId).signal(knowledgeSourceSyncWake, result);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function alreadyRunningWorkflow(error: unknown): boolean {
|
|
82
|
+
let current: unknown = error;
|
|
83
|
+
for (let depth = 0; depth < 4 && current && typeof current === "object"; depth += 1) {
|
|
84
|
+
const record = current as { name?: unknown; cause?: unknown };
|
|
85
|
+
if (record.name === "WorkflowExecutionAlreadyStartedError") return true;
|
|
86
|
+
current = record.cause;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
53
89
|
}
|
package/src/workflows/session.ts
CHANGED
|
@@ -288,7 +288,7 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
async function
|
|
291
|
+
async function waitForProviderCapacity(
|
|
292
292
|
initial: activities.CodexCapacityWaitRef,
|
|
293
293
|
entryBaseline?: { wakeups: number; capacityWakeups: number },
|
|
294
294
|
): Promise<void> {
|
|
@@ -329,13 +329,17 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
329
329
|
? "signal"
|
|
330
330
|
: "timer";
|
|
331
331
|
}
|
|
332
|
-
const
|
|
332
|
+
const reconcileInput = {
|
|
333
333
|
accountId: input.accountId,
|
|
334
334
|
workspaceId: input.workspaceId,
|
|
335
335
|
sessionId: input.sessionId,
|
|
336
336
|
waiterId: current.waiterId,
|
|
337
337
|
generation: current.generation,
|
|
338
338
|
cause,
|
|
339
|
+
};
|
|
340
|
+
const result = await activity.reconcileCodexCapacityWait({
|
|
341
|
+
...reconcileInput,
|
|
342
|
+
...(current.provider ? { provider: current.provider } : {}),
|
|
339
343
|
});
|
|
340
344
|
if (result.action !== "waiting") {
|
|
341
345
|
return;
|
|
@@ -467,7 +471,7 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
467
471
|
return;
|
|
468
472
|
}
|
|
469
473
|
if (peek.kind === "capacity-wait") {
|
|
470
|
-
await
|
|
474
|
+
await waitForProviderCapacity(peek.ref);
|
|
471
475
|
continue;
|
|
472
476
|
}
|
|
473
477
|
if (peek.kind === "approval-wait") {
|
|
@@ -475,7 +479,7 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
475
479
|
const seenWakeups = wakeups;
|
|
476
480
|
const seenInterruptionWakeups = interruptionWakeups;
|
|
477
481
|
const timeoutMs =
|
|
478
|
-
peek.humanInputRequestId && peek.expiresAt
|
|
482
|
+
(peek.humanInputRequestId || peek.interactionInterventionId) && peek.expiresAt
|
|
479
483
|
? humanInputDeadlineWaitMs(peek.expiresAt)
|
|
480
484
|
: undefined;
|
|
481
485
|
const wakeCondition = () =>
|
|
@@ -500,6 +504,16 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
500
504
|
if (expiry.action === "stale") {
|
|
501
505
|
await condition(wakeCondition, HUMAN_INPUT_EXPIRY_STALE_RETRY_MS);
|
|
502
506
|
}
|
|
507
|
+
} else if (!woke && peek.interactionInterventionId) {
|
|
508
|
+
const expiry = await activity.expireSessionInteractionIntervention({
|
|
509
|
+
accountId: input.accountId,
|
|
510
|
+
workspaceId: input.workspaceId,
|
|
511
|
+
sessionId: input.sessionId,
|
|
512
|
+
interventionId: peek.interactionInterventionId,
|
|
513
|
+
});
|
|
514
|
+
if (expiry.action === "stale") {
|
|
515
|
+
await condition(wakeCondition, HUMAN_INPUT_EXPIRY_STALE_RETRY_MS);
|
|
516
|
+
}
|
|
503
517
|
}
|
|
504
518
|
continue;
|
|
505
519
|
}
|
|
@@ -696,7 +710,7 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
696
710
|
sessionId,
|
|
697
711
|
});
|
|
698
712
|
if (capacityWait) {
|
|
699
|
-
await
|
|
713
|
+
await waitForProviderCapacity(capacityWait, capacityWaitEntryBaseline);
|
|
700
714
|
return true;
|
|
701
715
|
}
|
|
702
716
|
}
|
|
@@ -768,7 +782,7 @@ export async function sessionWorkflow(input: SessionWorkflowInput): Promise<void
|
|
|
768
782
|
}
|
|
769
783
|
|
|
770
784
|
if (outcome.result.capacityWait) {
|
|
771
|
-
await
|
|
785
|
+
await waitForProviderCapacity(outcome.result.capacityWait, capacityWaitEntryBaseline);
|
|
772
786
|
return true;
|
|
773
787
|
}
|
|
774
788
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { proxyActivities } from "@temporalio/workflow";
|
|
2
|
+
import type * as activities from "../activities";
|
|
3
|
+
|
|
4
|
+
const maintenanceActivity = proxyActivities<Pick<typeof activities, "maintainSiteAuthConnections">>(
|
|
5
|
+
{
|
|
6
|
+
startToCloseTimeout: "5 minutes",
|
|
7
|
+
retry: { maximumAttempts: 1 },
|
|
8
|
+
},
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
/** One bounded durable claim/dispatch sweep; the Temporal Schedule owns cadence. */
|
|
12
|
+
export async function siteAuthMaintenanceWorkflow(): Promise<void> {
|
|
13
|
+
await maintenanceActivity.maintainSiteAuthConnections();
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { continueAsNew, sleep } from "@temporalio/workflow";
|
|
2
|
+
import { videoGenerationActivityForTaskQueue } from "./activities";
|
|
3
|
+
|
|
4
|
+
export type VideoGenerationWorkflowInput = {
|
|
5
|
+
accountId: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
operationId: string;
|
|
8
|
+
baseTaskQueue: string;
|
|
9
|
+
iterations?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const CONTINUE_AS_NEW_AFTER = 100;
|
|
13
|
+
|
|
14
|
+
export function videoGenerationWorkflowId(operationId: string): string {
|
|
15
|
+
return `video-generation:${operationId}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Small deterministic orchestration; all private/provider state remains in Postgres. */
|
|
19
|
+
export async function videoGenerationWorkflow(input: VideoGenerationWorkflowInput): Promise<void> {
|
|
20
|
+
const activity = videoGenerationActivityForTaskQueue(input.baseTaskQueue);
|
|
21
|
+
let iterations = input.iterations ?? 0;
|
|
22
|
+
while (iterations < CONTINUE_AS_NEW_AFTER) {
|
|
23
|
+
const result = await activity.reconcileVideoGenerationOperation({
|
|
24
|
+
accountId: input.accountId,
|
|
25
|
+
workspaceId: input.workspaceId,
|
|
26
|
+
operationId: input.operationId,
|
|
27
|
+
});
|
|
28
|
+
if (result.action === "terminal") return;
|
|
29
|
+
await sleep(result.delayMs);
|
|
30
|
+
iterations += 1;
|
|
31
|
+
}
|
|
32
|
+
await continueAsNew<typeof videoGenerationWorkflow>({
|
|
33
|
+
...input,
|
|
34
|
+
iterations: 0,
|
|
35
|
+
});
|
|
36
|
+
}
|
package/src/workflows.ts
CHANGED
|
@@ -13,8 +13,25 @@ export {
|
|
|
13
13
|
scheduledTaskFireWorkflow,
|
|
14
14
|
type ScheduledTaskFireWorkflowInput,
|
|
15
15
|
} from "./workflows/scheduled-tasks";
|
|
16
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
knowledgeSourceSyncWake,
|
|
18
|
+
knowledgeSourceSyncWorkflow,
|
|
19
|
+
knowledgeSourceSyncWorkflowId,
|
|
20
|
+
type KnowledgeSourceSyncWorkflowInput,
|
|
21
|
+
} from "./workflows/knowledge-source-sync";
|
|
22
|
+
export {
|
|
23
|
+
sandboxDrainWorkflow,
|
|
24
|
+
sandboxReaperMaintenanceWorkflow,
|
|
25
|
+
sandboxReaperWorkflow,
|
|
26
|
+
sandboxReaperWorkflowV2,
|
|
27
|
+
} from "./workflows/sandbox-reaper";
|
|
17
28
|
export { fileUploadReaperWorkflow } from "./workflows/file-upload-reaper";
|
|
29
|
+
export { siteAuthMaintenanceWorkflow } from "./workflows/site-auth-maintenance";
|
|
30
|
+
export {
|
|
31
|
+
videoGenerationWorkflow,
|
|
32
|
+
videoGenerationWorkflowId,
|
|
33
|
+
type VideoGenerationWorkflowInput,
|
|
34
|
+
} from "./workflows/video-generation";
|
|
18
35
|
export { sessionWorkflowWakeDispatcherWorkflow } from "./workflows/workflow-wake";
|
|
19
36
|
export {
|
|
20
37
|
rigVerificationWorkflow,
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type ExpiringMaterialRenewalController } from "./expiring-material-renewal";
|
|
2
|
-
import type { MintedSandboxToolspaceToken } from "./environment";
|
|
3
|
-
export declare const TOOLSPACE_TOKEN_DEFAULT_REFRESH_MS: number;
|
|
4
|
-
export declare const TOOLSPACE_TOKEN_EXPIRY_LEAD_MS: number;
|
|
5
|
-
export declare const TOOLSPACE_TOKEN_MIN_REFRESH_MS = 5000;
|
|
6
|
-
export declare const TOOLSPACE_TOKEN_MAX_RETRY_MS: number;
|
|
7
|
-
export type ToolspaceTokenRenewalController = ExpiringMaterialRenewalController;
|
|
8
|
-
export type ToolspaceTokenRenewalOptions = {
|
|
9
|
-
initialExpiresAt: Date;
|
|
10
|
-
mint: () => Promise<MintedSandboxToolspaceToken | undefined>;
|
|
11
|
-
write: (material: MintedSandboxToolspaceToken) => Promise<void>;
|
|
12
|
-
now?: () => number;
|
|
13
|
-
schedule?: (callback: () => void, delayMs: number) => unknown;
|
|
14
|
-
clearSchedule?: (timer: unknown) => void;
|
|
15
|
-
onSuccess?: (result: {
|
|
16
|
-
nextDelayMs: number;
|
|
17
|
-
}) => void;
|
|
18
|
-
onFailure?: (failure: {
|
|
19
|
-
retryDelayMs: number;
|
|
20
|
-
errorClass: "ToolspaceTokenRenewalOperationError";
|
|
21
|
-
}) => void;
|
|
22
|
-
};
|
|
23
|
-
export declare function startToolspaceTokenRenewalLoop(options: ToolspaceTokenRenewalOptions): ToolspaceTokenRenewalController;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
startExpiringMaterialRenewalLoop,
|
|
3
|
-
type ExpiringMaterialRenewalController,
|
|
4
|
-
} from "./expiring-material-renewal";
|
|
5
|
-
import type { MintedSandboxToolspaceToken } from "./environment";
|
|
6
|
-
|
|
7
|
-
export const TOOLSPACE_TOKEN_DEFAULT_REFRESH_MS = 30 * 60_000;
|
|
8
|
-
export const TOOLSPACE_TOKEN_EXPIRY_LEAD_MS = 5 * 60_000;
|
|
9
|
-
export const TOOLSPACE_TOKEN_MIN_REFRESH_MS = 5_000;
|
|
10
|
-
export const TOOLSPACE_TOKEN_MAX_RETRY_MS = 5 * 60_000;
|
|
11
|
-
|
|
12
|
-
export type ToolspaceTokenRenewalController = ExpiringMaterialRenewalController;
|
|
13
|
-
|
|
14
|
-
export type ToolspaceTokenRenewalOptions = {
|
|
15
|
-
initialExpiresAt: Date;
|
|
16
|
-
mint: () => Promise<MintedSandboxToolspaceToken | undefined>;
|
|
17
|
-
write: (material: MintedSandboxToolspaceToken) => Promise<void>;
|
|
18
|
-
now?: () => number;
|
|
19
|
-
schedule?: (callback: () => void, delayMs: number) => unknown;
|
|
20
|
-
clearSchedule?: (timer: unknown) => void;
|
|
21
|
-
onSuccess?: (result: { nextDelayMs: number }) => void;
|
|
22
|
-
onFailure?: (failure: {
|
|
23
|
-
retryDelayMs: number;
|
|
24
|
-
errorClass: "ToolspaceTokenRenewalOperationError";
|
|
25
|
-
}) => void;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
class ToolspaceTokenRenewalError extends Error {
|
|
29
|
-
override readonly name = "ToolspaceTokenRenewalError";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function startToolspaceTokenRenewalLoop(
|
|
33
|
-
options: ToolspaceTokenRenewalOptions,
|
|
34
|
-
): ToolspaceTokenRenewalController {
|
|
35
|
-
return startExpiringMaterialRenewalLoop<
|
|
36
|
-
MintedSandboxToolspaceToken,
|
|
37
|
-
"ToolspaceTokenRenewalOperationError"
|
|
38
|
-
>({
|
|
39
|
-
initialExpiresAt: options.initialExpiresAt,
|
|
40
|
-
resolve: async () => {
|
|
41
|
-
const minted = await options.mint();
|
|
42
|
-
if (!minted) {
|
|
43
|
-
throw new ToolspaceTokenRenewalError("Toolspace token mint is no longer available");
|
|
44
|
-
}
|
|
45
|
-
return minted;
|
|
46
|
-
},
|
|
47
|
-
write: options.write,
|
|
48
|
-
expiresAt: (material) => material.expiresAt,
|
|
49
|
-
publicErrorClass: "ToolspaceTokenRenewalOperationError",
|
|
50
|
-
policy: {
|
|
51
|
-
defaultRefreshMs: TOOLSPACE_TOKEN_DEFAULT_REFRESH_MS,
|
|
52
|
-
expiryLeadMs: TOOLSPACE_TOKEN_EXPIRY_LEAD_MS,
|
|
53
|
-
minRefreshMs: TOOLSPACE_TOKEN_MIN_REFRESH_MS,
|
|
54
|
-
maxRetryMs: TOOLSPACE_TOKEN_MAX_RETRY_MS,
|
|
55
|
-
},
|
|
56
|
-
...(options.now ? { now: options.now } : {}),
|
|
57
|
-
...(options.schedule ? { schedule: options.schedule } : {}),
|
|
58
|
-
...(options.clearSchedule ? { clearSchedule: options.clearSchedule } : {}),
|
|
59
|
-
...(options.onSuccess
|
|
60
|
-
? { onSuccess: ({ nextDelayMs }) => options.onSuccess?.({ nextDelayMs }) }
|
|
61
|
-
: {}),
|
|
62
|
-
...(options.onFailure ? { onFailure: options.onFailure } : {}),
|
|
63
|
-
});
|
|
64
|
-
}
|