@opengeni/worker-bundle 1.2.1-canary.37222965366001 → 1.4.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-turn/errors.d.ts +1 -13
- package/dist/activities/agent-turn/subscription-lease.d.ts +1 -0
- package/dist/activities/agent-turn/tool-policy.d.ts +10 -1
- package/dist/activities/agent-turn/web-search.d.ts +33 -0
- package/dist/activities/codemode-dispatcher.d.ts +6 -2
- package/dist/activities/open-suffix-resume.d.ts +2 -0
- package/dist/activities/programmatic-approvals.d.ts +27 -0
- package/dist/activities/run-input.d.ts +2 -0
- package/dist/{activities-control-QSDPXLLD.js → activities-control-D5KVEPHI.js} +3 -3
- package/dist/{activities-turn-BMY3CDKL.js → activities-turn-4Z3M7Z3F.js} +554 -113
- package/dist/activities-turn-4Z3M7Z3F.js.map +1 -0
- package/dist/{chunk-JKMG5ZHH.js → chunk-BMTWULF7.js} +115 -31
- package/dist/chunk-BMTWULF7.js.map +1 -0
- package/dist/{chunk-XONQEVAD.js → chunk-FF4HPY7L.js} +1 -1
- package/dist/chunk-FF4HPY7L.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/observability-metrics.d.ts +1 -1
- package/package.json +21 -21
- package/src/activities/agent-turn/agent-build.ts +6 -4
- package/src/activities/agent-turn/errors.ts +82 -3
- package/src/activities/agent-turn/governance-model.ts +8 -8
- package/src/activities/agent-turn/sandbox-runtime.ts +16 -0
- package/src/activities/agent-turn/stream-attempt.ts +100 -21
- package/src/activities/agent-turn/subscription-lease.ts +10 -1
- package/src/activities/agent-turn/tool-environment.ts +20 -0
- package/src/activities/agent-turn/tool-policy.ts +26 -5
- package/src/activities/agent-turn/web-search.ts +252 -0
- package/src/activities/codemode-dispatcher.ts +145 -7
- package/src/activities/connector-attachments.ts +3 -1
- package/src/activities/open-suffix-resume.ts +107 -86
- package/src/activities/programmatic-approvals.ts +52 -0
- package/src/activities/run-input.ts +4 -1
- package/src/activity-services.ts +8 -0
- package/src/observability-metrics.ts +1 -0
- package/src/sandbox-routing.ts +58 -24
- package/dist/activities-turn-BMY3CDKL.js.map +0 -1
- package/dist/chunk-JKMG5ZHH.js.map +0 -1
- package/dist/chunk-XONQEVAD.js.map +0 -1
- /package/dist/{activities-control-QSDPXLLD.js.map → activities-control-D5KVEPHI.js.map} +0 -0
|
@@ -131,19 +131,7 @@ export declare function modelPreparationFailureEventPayload(error: unknown, dura
|
|
|
131
131
|
failureCode?: "capture_in_progress" | "provider_recovery_in_progress" | "rotation_in_progress";
|
|
132
132
|
retryable?: boolean;
|
|
133
133
|
};
|
|
134
|
-
|
|
135
|
-
* Recognize active-route transitions that cannot finish inside their
|
|
136
|
-
* originating attempt. A Modal-home session may start on a Connected Machine
|
|
137
|
-
* without creating or leasing its managed home box. When an explicit attach
|
|
138
|
-
* clears the active pointer back to home, the pointer commit is authoritative,
|
|
139
|
-
* but this attempt has no home session to serve the next sandbox operation.
|
|
140
|
-
*
|
|
141
|
-
* The Agents SDK may retain the typed routing error directly, through `cause`,
|
|
142
|
-
* or inside an AggregateError from a parallel function-tool batch. Traverse
|
|
143
|
-
* only those structural error links with a strict bound; never classify from
|
|
144
|
-
* message text, which could originate in model or tool content.
|
|
145
|
-
*/
|
|
146
|
-
export declare function sandboxRouteTransitionCode(error: unknown): "home_unavailable_this_turn" | "workspace_root_changed_this_turn" | "native_capabilities_changed_this_attempt" | null;
|
|
134
|
+
export declare function sandboxRouteTransitionCode(error: unknown): "home_unavailable_this_turn" | "workspace_root_changed_this_turn" | "native_capabilities_changed_this_attempt" | "home_backend_recovery_pending" | null;
|
|
147
135
|
export declare function isSandboxRouteTransitionError(error: unknown): boolean;
|
|
148
136
|
/** Backward-compatible name for callers/tests that only exercised the original
|
|
149
137
|
* machine-to-home transition. */
|
|
@@ -27,6 +27,7 @@ export declare class SubscriptionTurnLease {
|
|
|
27
27
|
private heartbeatInFlight;
|
|
28
28
|
private heartbeatTimer;
|
|
29
29
|
private readonly now;
|
|
30
|
+
private readonly renewalIntervalMs;
|
|
30
31
|
constructor(leaseDeps: SubscriptionLeaseDeps);
|
|
31
32
|
private expired;
|
|
32
33
|
markLost: (reason: LeaseLossReason) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ComputerToolMode, type LazyToolTransport } from "@opengeni/runtime";
|
|
1
|
+
import { type ComputerToolMode, type LazyToolTransport, type OpenGeniRuntime } from "@opengeni/runtime";
|
|
2
|
+
import type { TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
2
3
|
import { type ModelProviderApi, type ResolvedModelProvider, type Settings } from "@opengeni/config";
|
|
3
4
|
import { type ModelAttachmentInputPolicy } from "../run-input.js";
|
|
4
5
|
export declare function shouldStartOnTurnRecording(params: {
|
|
@@ -112,6 +113,14 @@ export declare function shouldDeferNonEagerToolPreparation(args: {
|
|
|
112
113
|
triggerKind: "next" | "approval";
|
|
113
114
|
triggerType: string;
|
|
114
115
|
}): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Resolve the provider routing/gating shape for an accepted turn. The current
|
|
118
|
+
* definition is projected back onto the verified frozen policy: a turn
|
|
119
|
+
* accepted before hosted web search was enabled keeps its frozen tool set on
|
|
120
|
+
* every recovery attempt (stable tool prefix, exact accepted definition); the
|
|
121
|
+
* next accepted logical turn resolves the newly enabled tool.
|
|
122
|
+
*/
|
|
123
|
+
export declare function resolveAcceptedTurnModel(runtime: Pick<OpenGeniRuntime, "resolveTurnModel">, settings: Settings, policy: TurnExecutionPolicyV1): ReturnType<OpenGeniRuntime["resolveTurnModel"]>;
|
|
115
124
|
/**
|
|
116
125
|
* Native web search is a runtime capability, not part of the session's MCP
|
|
117
126
|
* allow-list. Attach it whenever the resolved provider advertises runnable
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
+
import { type WebSearchProviderToolName, type WebSearchSettings } from "@opengeni/config";
|
|
3
|
+
import { type WebSearchBilling, type WebSearchCallScope } from "@opengeni/core";
|
|
4
|
+
import type { Observability } from "@opengeni/observability";
|
|
5
|
+
/**
|
|
6
|
+
* Which web search one turn gets: the provider's hosted tool, Opengeni's
|
|
7
|
+
* provider tools, or neither. Tool preparation and agent construction both
|
|
8
|
+
* call this with the same accepted model and settings, so they agree.
|
|
9
|
+
*/
|
|
10
|
+
export declare function turnWebSearchPlan(resolvedModel: {
|
|
11
|
+
configured: {
|
|
12
|
+
hostedWebSearch: boolean;
|
|
13
|
+
};
|
|
14
|
+
provider: {
|
|
15
|
+
kind?: string;
|
|
16
|
+
};
|
|
17
|
+
} | null, settings: WebSearchSettings): {
|
|
18
|
+
hostedWebSearch: boolean;
|
|
19
|
+
providerTools: WebSearchProviderToolName[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The `web_search` and `web_fetch` attempt tools for one turn. The caller
|
|
23
|
+
* decides which names the turn gets ({@link webSearchToolPlan}); this only
|
|
24
|
+
* builds them. Provider keys stay in the worker and never reach a sandbox.
|
|
25
|
+
*/
|
|
26
|
+
export declare function webSearchToolDefinitions(input: {
|
|
27
|
+
settings: WebSearchSettings;
|
|
28
|
+
tools: readonly WebSearchProviderToolName[];
|
|
29
|
+
scope: WebSearchCallScope;
|
|
30
|
+
billing: WebSearchBilling;
|
|
31
|
+
observability: Pick<Observability, "warn">;
|
|
32
|
+
fetch?: typeof fetch;
|
|
33
|
+
}): AttemptToolDefinition[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AttemptToolCatalogEntry, type AttemptToolEnvironment } from "@opengeni/codemode";
|
|
2
|
-
import { type ToolDisplayMetadata, type ToolFamily } from "@opengeni/contracts";
|
|
2
|
+
import { CodemodeOperation, type ToolDisplayMetadata, type ToolFamily } from "@opengeni/contracts";
|
|
3
3
|
import { type Database } from "@opengeni/db";
|
|
4
4
|
import { type EventBus } from "@opengeni/events";
|
|
5
5
|
export type CodemodeDispatcherScope = {
|
|
@@ -29,6 +29,7 @@ export declare class CodemodeAttemptDispatcher {
|
|
|
29
29
|
private readonly toolDisplayMetadata?;
|
|
30
30
|
/** Content-free analytics family for a catalog entry; event enrichment only. */
|
|
31
31
|
private readonly toolFamily?;
|
|
32
|
+
private readonly approvalWait?;
|
|
32
33
|
private readonly stopController;
|
|
33
34
|
private readonly inFlight;
|
|
34
35
|
private pendingClaims;
|
|
@@ -38,8 +39,11 @@ export declare class CodemodeAttemptDispatcher {
|
|
|
38
39
|
private readonly claimHeartbeatMs;
|
|
39
40
|
constructor(db: Database, bus: EventBus, environment: AttemptToolEnvironment, scope: CodemodeDispatcherScope, turnSignal?: AbortSignal | undefined, maxConcurrentCalls?: number, timings?: CodemodeDispatcherTimings, toolDisplayMetadata?: ((modelName: string) => ToolDisplayMetadata | undefined) | undefined,
|
|
40
41
|
/** Content-free analytics family for a catalog entry; event enrichment only. */
|
|
41
|
-
toolFamily?: ((entry: AttemptToolCatalogEntry) => ToolFamily | null) | undefined
|
|
42
|
+
toolFamily?: ((entry: AttemptToolCatalogEntry) => ToolFamily | null) | undefined, approvalWait?: {
|
|
43
|
+
beginWait(): (accepted: boolean) => void;
|
|
44
|
+
} | undefined);
|
|
42
45
|
start(): void;
|
|
46
|
+
resumeApproved(callerSubjectId: string, decisionOperationId?: string): Promise<CodemodeOperation[]>;
|
|
43
47
|
close(reason?: string): Promise<void>;
|
|
44
48
|
private execute;
|
|
45
49
|
private executeClaimed;
|
|
@@ -54,6 +54,8 @@ export declare function resultItemForOpenSuffixMember(input: {
|
|
|
54
54
|
eventOutput: unknown;
|
|
55
55
|
}>;
|
|
56
56
|
export declare function settleOpenSuffixResumeIfNeeded(input: {
|
|
57
|
+
additionalApprovals?: unknown[];
|
|
58
|
+
programmaticApprovalAcknowledged?: boolean;
|
|
57
59
|
db: Database;
|
|
58
60
|
agent: Agent<any, any>;
|
|
59
61
|
accountId: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CodemodeOperation } from "@opengeni/contracts";
|
|
2
|
+
/** Programmatic receipts are not open SDK calls. Exact arguments stay in protected storage. */
|
|
3
|
+
export declare function programmaticApproval(operation: CodemodeOperation): {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
source: "codemode";
|
|
7
|
+
operationId: string;
|
|
8
|
+
requestId: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare function programmaticContinuationNote(operations: readonly CodemodeOperation[]): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Recover committed programmatic approval waits/results before the first model
|
|
13
|
+
* request without turning lazy MCP preparation into a first-request barrier.
|
|
14
|
+
*
|
|
15
|
+
* Only eager servers may gate the first request. Resuming a stored operation
|
|
16
|
+
* needs the prepared attempt tool environment, so this waits for full tool
|
|
17
|
+
* preparation only when there is something to resume: an approval decision
|
|
18
|
+
* trigger, or a cheap durable read showing unfinished operations for this
|
|
19
|
+
* logical turn (which covers every recovery that has stored work). Every other
|
|
20
|
+
* turn sends its first request without waiting on any lazy server.
|
|
21
|
+
*/
|
|
22
|
+
export declare function recoverProgrammaticOperationsBeforeFirstRequest(input: {
|
|
23
|
+
approvalDecisionId: string | undefined;
|
|
24
|
+
hasUnfinishedOperations: () => Promise<boolean>;
|
|
25
|
+
toolPreparationReady: Promise<void> | null;
|
|
26
|
+
resumeApproved: (decisionOperationId: string | undefined) => Promise<CodemodeOperation[]> | undefined;
|
|
27
|
+
}): Promise<CodemodeOperation[]>;
|
|
@@ -32,6 +32,8 @@ export type TurnInputOptions = {
|
|
|
32
32
|
unavailableSandboxFilesNote?: string;
|
|
33
33
|
runCredentialsNote?: string;
|
|
34
34
|
mcpAvailabilityNote?: string;
|
|
35
|
+
codemodeContinuationNote?: string;
|
|
36
|
+
programmaticApprovalAcknowledged?: boolean;
|
|
35
37
|
knowledgeSourcePreparationNote?: string;
|
|
36
38
|
providerApi: HistoryProviderApi;
|
|
37
39
|
projectCanonicalHistory?: ModelHistoryAttachmentProjector;
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
warnDrainSnapshotFailure,
|
|
35
35
|
withFirstPartyTools,
|
|
36
36
|
workflowIdForSession
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-BMTWULF7.js";
|
|
38
38
|
import {
|
|
39
39
|
inspectOpenSandboxKubernetesInventory,
|
|
40
40
|
recordActiveUserGauges,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
recordVerifiedSignupTrialSwitchGauge,
|
|
63
63
|
recordWorkerDeathRecoveryMetrics,
|
|
64
64
|
runtimeMetricsHooksForObservability
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-FF4HPY7L.js";
|
|
66
66
|
import "./chunk-PZ5AY32C.js";
|
|
67
67
|
|
|
68
68
|
// src/activities/knowledge-indexing.ts
|
|
@@ -8813,4 +8813,4 @@ export {
|
|
|
8813
8813
|
createControlActivities,
|
|
8814
8814
|
createControlActivitiesFromServices
|
|
8815
8815
|
};
|
|
8816
|
-
//# sourceMappingURL=activities-control-
|
|
8816
|
+
//# sourceMappingURL=activities-control-D5KVEPHI.js.map
|