@opengeni/worker-bundle 0.12.7 → 0.13.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.
Files changed (72) hide show
  1. package/dist/activities/agent-turn.d.ts +778 -0
  2. package/dist/activities/capabilities.d.ts +18 -0
  3. package/dist/activities/codex-auth.d.ts +1 -0
  4. package/dist/activities/codex-capacity.d.ts +31 -0
  5. package/dist/activities/codex-fleet-shadow.d.ts +74 -0
  6. package/dist/activities/codex-rotation.d.ts +261 -0
  7. package/dist/activities/common.d.ts +17 -0
  8. package/dist/activities/context-compaction.d.ts +81 -0
  9. package/dist/activities/documents.d.ts +39 -0
  10. package/dist/activities/environment.d.ts +97 -0
  11. package/dist/activities/expiring-material-renewal.d.ts +38 -0
  12. package/dist/activities/file-upload-reaper.d.ts +25 -0
  13. package/dist/activities/git-credential-renewal.d.ts +41 -0
  14. package/dist/activities/goals.d.ts +16 -0
  15. package/dist/activities/mcp-credentials.d.ts +14 -0
  16. package/dist/activities/packs.d.ts +77 -0
  17. package/dist/activities/parent-wake.d.ts +54 -0
  18. package/dist/activities/recording.d.ts +90 -0
  19. package/dist/activities/redaction.d.ts +1 -0
  20. package/dist/activities/rig-verification.d.ts +131 -0
  21. package/dist/activities/run-credential-renewal.d.ts +28 -0
  22. package/dist/activities/run-credentials.d.ts +36 -0
  23. package/dist/activities/run-input.d.ts +106 -0
  24. package/dist/activities/sandbox-lease.d.ts +128 -0
  25. package/dist/activities/scheduled-tasks.d.ts +4 -0
  26. package/dist/activities/session-state.d.ts +39 -0
  27. package/dist/activities/streaming.d.ts +24 -0
  28. package/dist/activities/toolspace-token-renewal.d.ts +23 -0
  29. package/dist/activities/turn-attempt-fenced.d.ts +11 -0
  30. package/dist/activities/types.d.ts +240 -0
  31. package/dist/activities/workflow-wake.d.ts +15 -0
  32. package/dist/activities/workspace-capture.d.ts +105 -0
  33. package/dist/activities.d.ts +312 -0
  34. package/dist/concurrency.d.ts +19 -0
  35. package/dist/host-export-pump.d.ts +66 -0
  36. package/dist/host-export.d.ts +6 -67
  37. package/dist/http.d.ts +32 -0
  38. package/dist/index.d.ts +27 -388
  39. package/dist/index.js +2730 -1211
  40. package/dist/index.js.map +1 -1
  41. package/dist/observability-metrics.d.ts +200 -0
  42. package/dist/op-journal.d.ts +10 -0
  43. package/dist/sandbox-resume.d.ts +152 -0
  44. package/dist/sandbox-routing.d.ts +159 -0
  45. package/dist/worker-service-lifecycle.d.ts +20 -0
  46. package/dist/workflow-bundle.js +88 -20
  47. package/dist/workflows/activities.d.ts +27 -0
  48. package/dist/workflows/document-index.d.ts +41 -0
  49. package/dist/workflows/file-upload-reaper.d.ts +2 -0
  50. package/dist/workflows/rig-verification.d.ts +3 -0
  51. package/dist/workflows/sandbox-reaper.d.ts +1 -0
  52. package/dist/workflows/scheduled-tasks.d.ts +17 -0
  53. package/dist/workflows/session.d.ts +58 -0
  54. package/dist/workflows/workflow-wake.d.ts +3 -0
  55. package/dist/workflows.d.ts +7 -0
  56. package/package.json +13 -13
  57. package/src/activities/agent-turn.ts +874 -134
  58. package/src/activities/context-compaction.ts +265 -76
  59. package/src/activities/environment.ts +1 -0
  60. package/src/activities/goals.ts +14 -0
  61. package/src/activities/rig-verification.ts +2 -0
  62. package/src/activities/run-input.ts +18 -4
  63. package/src/activities/sandbox-lease.ts +787 -133
  64. package/src/activities/session-state.ts +56 -0
  65. package/src/activities/types.ts +21 -0
  66. package/src/activities/workspace-capture.ts +95 -4
  67. package/src/activities.ts +3 -0
  68. package/src/observability-metrics.ts +94 -0
  69. package/src/sandbox-resume.ts +383 -90
  70. package/src/sandbox-routing.ts +32 -10
  71. package/src/workflows/activities.ts +1 -0
  72. 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,2 @@
1
+ /** One bounded provider/DB sweep; the Temporal Schedule owns the cadence. */
2
+ export declare function fileUploadReaperWorkflow(): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { RigVerificationWorkflowInput } from "../activities/rig-verification";
2
+ export type { RigVerificationWorkflowInput };
3
+ export declare function rigVerificationWorkflow(input: RigVerificationWorkflowInput): Promise<void>;
@@ -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.12.7",
3
+ "version": "0.13.4",
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": "tsgo --noEmit",
38
- "build": "tsup && bun scripts/build-workflow-bundle.ts",
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.7",
44
- "@opengeni/config": "^0.7.11",
45
- "@opengeni/contracts": "^0.22.0",
46
- "@opengeni/core": "^0.12.7",
47
- "@opengeni/db": "^0.14.0",
48
- "@opengeni/documents": "^0.2.42",
49
- "@opengeni/events": "^0.3.33",
50
- "@opengeni/github": "^0.3.23",
43
+ "@opengeni/codex": "^0.2.9",
44
+ "@opengeni/config": "^0.7.22",
45
+ "@opengeni/contracts": "^0.26.1",
46
+ "@opengeni/core": "^0.14.3",
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.1",
53
- "@opengeni/storage": "^0.2.35",
52
+ "@opengeni/runtime": "^0.14.15",
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",