@opengeni/worker-bundle 0.12.10 → 0.13.5
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-turn.d.ts +778 -0
- package/dist/activities/capabilities.d.ts +18 -0
- package/dist/activities/codex-auth.d.ts +1 -0
- package/dist/activities/codex-capacity.d.ts +31 -0
- package/dist/activities/codex-fleet-shadow.d.ts +74 -0
- package/dist/activities/codex-rotation.d.ts +261 -0
- package/dist/activities/common.d.ts +17 -0
- package/dist/activities/context-compaction.d.ts +81 -0
- package/dist/activities/documents.d.ts +39 -0
- package/dist/activities/environment.d.ts +97 -0
- package/dist/activities/expiring-material-renewal.d.ts +38 -0
- package/dist/activities/file-upload-reaper.d.ts +25 -0
- package/dist/activities/git-credential-renewal.d.ts +41 -0
- package/dist/activities/goals.d.ts +16 -0
- package/dist/activities/mcp-credentials.d.ts +14 -0
- package/dist/activities/packs.d.ts +77 -0
- package/dist/activities/parent-wake.d.ts +54 -0
- package/dist/activities/recording.d.ts +90 -0
- package/dist/activities/redaction.d.ts +1 -0
- package/dist/activities/rig-verification.d.ts +131 -0
- package/dist/activities/run-credential-renewal.d.ts +28 -0
- package/dist/activities/run-credentials.d.ts +36 -0
- package/dist/activities/run-input.d.ts +106 -0
- package/dist/activities/sandbox-lease.d.ts +128 -0
- package/dist/activities/scheduled-tasks.d.ts +4 -0
- package/dist/activities/session-state.d.ts +39 -0
- package/dist/activities/streaming.d.ts +24 -0
- package/dist/activities/toolspace-token-renewal.d.ts +23 -0
- package/dist/activities/turn-attempt-fenced.d.ts +11 -0
- package/dist/activities/types.d.ts +240 -0
- package/dist/activities/workflow-wake.d.ts +15 -0
- package/dist/activities/workspace-capture.d.ts +105 -0
- package/dist/activities.d.ts +312 -0
- package/dist/concurrency.d.ts +19 -0
- package/dist/host-export-pump.d.ts +66 -0
- package/dist/host-export.d.ts +6 -67
- package/dist/http.d.ts +32 -0
- package/dist/index.d.ts +27 -388
- package/dist/index.js +2729 -1208
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +200 -0
- package/dist/op-journal.d.ts +10 -0
- package/dist/sandbox-resume.d.ts +152 -0
- package/dist/sandbox-routing.d.ts +159 -0
- package/dist/worker-service-lifecycle.d.ts +20 -0
- package/dist/workflow-bundle.js +88 -20
- package/dist/workflows/activities.d.ts +27 -0
- package/dist/workflows/document-index.d.ts +41 -0
- package/dist/workflows/file-upload-reaper.d.ts +2 -0
- package/dist/workflows/rig-verification.d.ts +3 -0
- package/dist/workflows/sandbox-reaper.d.ts +1 -0
- package/dist/workflows/scheduled-tasks.d.ts +17 -0
- package/dist/workflows/session.d.ts +58 -0
- package/dist/workflows/workflow-wake.d.ts +3 -0
- package/dist/workflows.d.ts +7 -0
- package/package.json +13 -13
- package/src/activities/agent-turn.ts +873 -131
- package/src/activities/context-compaction.ts +265 -76
- package/src/activities/environment.ts +1 -0
- package/src/activities/goals.ts +14 -0
- package/src/activities/rig-verification.ts +2 -0
- package/src/activities/run-input.ts +18 -4
- package/src/activities/sandbox-lease.ts +787 -133
- package/src/activities/session-state.ts +56 -0
- package/src/activities/types.ts +21 -0
- package/src/activities/workspace-capture.ts +95 -4
- package/src/activities.ts +3 -0
- package/src/observability-metrics.ts +94 -0
- package/src/sandbox-resume.ts +383 -90
- package/src/sandbox-routing.ts +32 -10
- package/src/workflows/activities.ts +1 -0
- package/src/workflows/session.ts +70 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as activities from "../activities";
|
|
2
|
+
type WorkflowControlActivities = Pick<typeof activities, "enqueueGoalRetryWake" | "expireSessionHumanInput" | "failSessionAttempt" | "getCodexCapacityWait" | "markSessionIdle" | "peekSessionWork" | "persistSessionAttemptQuiescence" | "reconcileSessionAttemptQuiescence" | "reconcileCodexCapacityWait" | "recoverDispatch" | "recoverEscapedMcpTimeout" | "settleSessionInterruptions">;
|
|
3
|
+
/**
|
|
4
|
+
* Session/schedule workflow control activities are bounded, idempotent database
|
|
5
|
+
* and provider-metadata operations. They must not inherit the agent turn's
|
|
6
|
+
* 30-day attempt: Temporal cannot otherwise detect that the pod which accepted
|
|
7
|
+
* a non-heartbeating control activity disappeared, leaving the workflow pinned
|
|
8
|
+
* to a dead worker for the full 30 days. A bounded attempt plus an unbounded
|
|
9
|
+
* Temporal retry keeps the durable workflow alive across rollout, node loss, or
|
|
10
|
+
* transient database/network failure; retries re-run on a healthy control pod.
|
|
11
|
+
*/
|
|
12
|
+
export declare const activity: import("@temporalio/workflow").ActivityInterfaceFor<WorkflowControlActivities>;
|
|
13
|
+
/** One schedule occurrence is bounded. Transient control-plane failures get a
|
|
14
|
+
* short retry window, but a revoked binding or other permanent task error must
|
|
15
|
+
* not leave a Temporal activity retrying forever; the next scheduled occurrence
|
|
16
|
+
* is an independent workflow and will re-evaluate current state. */
|
|
17
|
+
export declare const scheduledTaskActivity: import("@temporalio/workflow").ActivityInterfaceFor<Pick<typeof activities, "dispatchScheduledTaskRun">>;
|
|
18
|
+
/** Goal continuation evaluates a durable Postgres obligation at an idle
|
|
19
|
+
* boundary. A transient failure gets a short retry window, then records an
|
|
20
|
+
* explicit delayed outbox wake instead of relying on an unrelated mutation or
|
|
21
|
+
* keeping workflow history alive with polling. */
|
|
22
|
+
export declare const goalActivity: import("@temporalio/workflow").ActivityInterfaceFor<Pick<typeof activities, "maybeContinueGoal">>;
|
|
23
|
+
export declare function turnTaskQueue(baseTaskQueue: string): string;
|
|
24
|
+
export declare function turnActivityForTaskQueue(baseTaskQueue: string, receiptGatedCancellation?: boolean): import("@temporalio/workflow").ActivityInterfaceFor<Pick<typeof activities, "runAgentTurn">>;
|
|
25
|
+
export declare const documentActivity: import("@temporalio/workflow").ActivityInterfaceFor<Pick<typeof activities, "indexDocument">>;
|
|
26
|
+
export declare function workflowFailureMessage(error: unknown): string;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type DocumentIndexWorkflowInput = {
|
|
2
|
+
accountId: string;
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
documentId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function documentIndexWorkflow(input: DocumentIndexWorkflowInput): Promise<{
|
|
7
|
+
id: string;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
baseId: string;
|
|
10
|
+
fileId: string;
|
|
11
|
+
status: "failed" | "indexing" | "queued" | "ready";
|
|
12
|
+
title: string;
|
|
13
|
+
parser: string;
|
|
14
|
+
chunkCount: number;
|
|
15
|
+
error: string | null;
|
|
16
|
+
sourceKind: "chat" | "document" | "email" | "manual_upload" | "meeting_transcript" | "other" | "repository" | "web";
|
|
17
|
+
sourceUri: string | null;
|
|
18
|
+
sourceExternalId: string | null;
|
|
19
|
+
sourceTitle: string | null;
|
|
20
|
+
sourceAuthor: string | null;
|
|
21
|
+
sourceCreatedAt: string | null;
|
|
22
|
+
sourceUpdatedAt: string | null;
|
|
23
|
+
sourceVersion: string | null;
|
|
24
|
+
aclTags: string[];
|
|
25
|
+
visibility: "private" | "workspace";
|
|
26
|
+
createdBy: string | null;
|
|
27
|
+
agentAccess: boolean;
|
|
28
|
+
summary: string | null;
|
|
29
|
+
topics: string[];
|
|
30
|
+
curationStatus: "auto_filed" | "failed" | "none" | "pending" | "suggested";
|
|
31
|
+
curation: {
|
|
32
|
+
suggestedBaseId: string | null;
|
|
33
|
+
suggestedBaseName: string | null;
|
|
34
|
+
confidence: number;
|
|
35
|
+
reason: string | null;
|
|
36
|
+
originalTitle: string | null;
|
|
37
|
+
model: string | null;
|
|
38
|
+
} | null;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sandboxReaperWorkflow(): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TurnInitiator } from "@opengeni/contracts";
|
|
2
|
+
type ScheduledTaskFireWorkflowBase = {
|
|
3
|
+
accountId: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
taskId: string;
|
|
6
|
+
};
|
|
7
|
+
export type ScheduledTaskFireWorkflowInput = ScheduledTaskFireWorkflowBase & ({
|
|
8
|
+
triggerType: "scheduled";
|
|
9
|
+
agentRunUsageIdempotencyKey?: never;
|
|
10
|
+
initiator?: never;
|
|
11
|
+
} | {
|
|
12
|
+
triggerType: "manual";
|
|
13
|
+
agentRunUsageIdempotencyKey: string;
|
|
14
|
+
initiator: TurnInitiator;
|
|
15
|
+
});
|
|
16
|
+
export declare function scheduledTaskFireWorkflow(input: ScheduledTaskFireWorkflowInput): Promise<void>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type * as activities from "../activities";
|
|
2
|
+
import { type EscapedMcpTimeoutRecoveryDetail } from "../activities/types";
|
|
3
|
+
/**
|
|
4
|
+
* How long the continuation loop must hold before re-admitting the next turn. 0 ⇒ no
|
|
5
|
+
* hold (re-dispatch immediately — a rotation candidate is ready, or no idle delay was
|
|
6
|
+
* requested). A rotation all-capped idle (`idleUntilReset`) ALWAYS holds at least
|
|
7
|
+
* `floorMs`, so a 0/elapsed continueDelayMs can never skip the hold (invariant 4).
|
|
8
|
+
* Pure + exported so the boundedness contract is unit-testable without a workflow env.
|
|
9
|
+
*/
|
|
10
|
+
export declare function continuationHoldMs(result: {
|
|
11
|
+
status: string;
|
|
12
|
+
continueDelayMs?: number;
|
|
13
|
+
idleUntilReset?: boolean;
|
|
14
|
+
}, floorMs: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* A deferred activity result is terminal for this workflow run unless a new
|
|
17
|
+
* non-control wake committed while the activity was in flight. Keeping this
|
|
18
|
+
* predicate pure makes the compaction-convergence fence directly testable:
|
|
19
|
+
* repeated identical failures cannot synthesize more work from an unchanged
|
|
20
|
+
* durable state. Pause/Steer remain authoritative through the independent
|
|
21
|
+
* signal-version and interruption paths in `sessionWorkflow`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function deferredResultMayContinue(entryWakeups: number, currentWakeups: number): boolean;
|
|
24
|
+
/** Deterministic Temporal timer delay for a persisted structured-input deadline. */
|
|
25
|
+
export declare function humanInputDeadlineWaitMs(expiresAt: string, nowMs?: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Parse only the explicit activity wire contract emitted when a recovered
|
|
28
|
+
* turn's MCP setup timeout could not finish its DB checkpoint. Numeric -32001
|
|
29
|
+
* and generic MCP messages remain deliberately insufficient: the activity
|
|
30
|
+
* writes this non-retryable ApplicationFailure only before any model request,
|
|
31
|
+
* with immutable turn identity in payload-converted details.
|
|
32
|
+
*/
|
|
33
|
+
export declare function escapedMcpTimeoutRecoveryDetail(error: unknown): EscapedMcpTimeoutRecoveryDetail | null;
|
|
34
|
+
/**
|
|
35
|
+
* Classify only the exact turn-fence cancellation protocol used to arbitrate a
|
|
36
|
+
* database control commit that reaches the activity just before its Temporal
|
|
37
|
+
* signal reaches this workflow. This shape is never physical-quiescence proof:
|
|
38
|
+
* only the activity's durable post-tool-fence receipt can open replacement
|
|
39
|
+
* admission. @temporalio/worker 1.20 serializes the pre-request
|
|
40
|
+
* CancelledFailure as an ApplicationFailure with the stable `CancelledFailure`
|
|
41
|
+
* type, so accept that exact wire shape in addition to normal cancellation.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isTurnActivityFenceCancellation(error: unknown): boolean;
|
|
44
|
+
export declare const userMessage: import("@temporalio/client").SignalDefinition<[string], string>;
|
|
45
|
+
export declare const queueChanged: import("@temporalio/client").SignalDefinition<[], "queueChanged">;
|
|
46
|
+
export declare const approvalDecision: import("@temporalio/client").SignalDefinition<[string], string>;
|
|
47
|
+
export declare const sessionControl: import("@temporalio/client").SignalDefinition<[], "sessionControl">;
|
|
48
|
+
export declare const codexCapacityChanged: import("@temporalio/client").SignalDefinition<[number], string>;
|
|
49
|
+
export declare const sessionAttemptQuiesced: import("@temporalio/client").SignalDefinition<[activities.SessionAttemptQuiescenceProof], string>;
|
|
50
|
+
export type SessionWorkflowInput = {
|
|
51
|
+
accountId: string;
|
|
52
|
+
workspaceId: string;
|
|
53
|
+
sessionId: string;
|
|
54
|
+
initialEventId?: string;
|
|
55
|
+
maxTurnsPerRun?: number;
|
|
56
|
+
maxCapacityChecksPerRun?: number;
|
|
57
|
+
};
|
|
58
|
+
export declare function sessionWorkflow(input: SessionWorkflowInput): Promise<void>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** One bounded delivery sweep; recursive controls trigger it immediately and
|
|
2
|
+
* the global Schedule repeats it every ten seconds for repair. */
|
|
3
|
+
export declare function sessionWorkflowWakeDispatcherWorkflow(): Promise<import("../activities/workflow-wake").DispatchSessionWorkflowWakesResult>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { documentIndexWorkflow, type DocumentIndexWorkflowInput } from "./workflows/document-index";
|
|
2
|
+
export { approvalDecision, codexCapacityChanged, sessionControl, sessionAttemptQuiesced, queueChanged, sessionWorkflow, userMessage, type SessionWorkflowInput, } from "./workflows/session";
|
|
3
|
+
export { scheduledTaskFireWorkflow, type ScheduledTaskFireWorkflowInput, } from "./workflows/scheduled-tasks";
|
|
4
|
+
export { sandboxReaperWorkflow } from "./workflows/sandbox-reaper";
|
|
5
|
+
export { fileUploadReaperWorkflow } from "./workflows/file-upload-reaper";
|
|
6
|
+
export { sessionWorkflowWakeDispatcherWorkflow } from "./workflows/workflow-wake";
|
|
7
|
+
export { rigVerificationWorkflow, type RigVerificationWorkflowInput, } from "./workflows/rig-verification";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/worker-bundle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.5",
|
|
4
4
|
"description": "OpenGeni worker entry and reusable embedded lifecycle, shipped with a release-coherent pre-bundled Temporal workflow artifact.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"dev": "bun src/index.ts",
|
|
35
35
|
"dev:watch": "bun --watch src/index.ts",
|
|
36
36
|
"start": "bun src/index.ts",
|
|
37
|
-
"typecheck": "
|
|
38
|
-
"build": "
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"build": "bun ../../scripts/build-typescript-package.ts && bun scripts/build-workflow-bundle.ts",
|
|
39
39
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@opengeni/agent-proto": "^0.3.0",
|
|
43
|
-
"@opengeni/codex": "^0.2.
|
|
44
|
-
"@opengeni/config": "^0.7.
|
|
45
|
-
"@opengeni/contracts": "^0.
|
|
46
|
-
"@opengeni/core": "^0.
|
|
47
|
-
"@opengeni/db": "^0.
|
|
48
|
-
"@opengeni/documents": "^0.2.
|
|
49
|
-
"@opengeni/events": "^0.3.
|
|
50
|
-
"@opengeni/github": "^0.4.
|
|
43
|
+
"@opengeni/codex": "^0.2.9",
|
|
44
|
+
"@opengeni/config": "^0.7.22",
|
|
45
|
+
"@opengeni/contracts": "^0.26.1",
|
|
46
|
+
"@opengeni/core": "^0.14.4",
|
|
47
|
+
"@opengeni/db": "^0.16.2",
|
|
48
|
+
"@opengeni/documents": "^0.2.59",
|
|
49
|
+
"@opengeni/events": "^0.3.50",
|
|
50
|
+
"@opengeni/github": "^0.4.9",
|
|
51
51
|
"@opengeni/observability": "^0.3.0",
|
|
52
|
-
"@opengeni/runtime": "^0.14.
|
|
53
|
-
"@opengeni/storage": "^0.2.
|
|
52
|
+
"@opengeni/runtime": "^0.14.16",
|
|
53
|
+
"@opengeni/storage": "^0.2.46",
|
|
54
54
|
"@temporalio/activity": "^1.17.0",
|
|
55
55
|
"@temporalio/client": "^1.17.0",
|
|
56
56
|
"@temporalio/worker": "^1.17.0",
|