@opengeni/worker-bundle 0.2.0 → 0.2.3
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 +1 -0
- package/dist/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/activities/agent-turn.ts +97 -5
- package/src/index.ts +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -187,6 +187,7 @@ type WorkerOptions = {
|
|
|
187
187
|
settings?: Settings;
|
|
188
188
|
activities?: ReturnType<typeof createActivities>;
|
|
189
189
|
activityDependencies?: ActivityDependencies;
|
|
190
|
+
workflowsPath?: string;
|
|
190
191
|
};
|
|
191
192
|
declare function createOpenGeniWorker(options?: WorkerOptions): Promise<{
|
|
192
193
|
worker: Worker;
|
package/dist/index.js
CHANGED
|
@@ -1686,6 +1686,21 @@ async function resolveActiveSandboxBackend(routingOn, loadPointer, loadSandboxKi
|
|
|
1686
1686
|
return void 0;
|
|
1687
1687
|
}
|
|
1688
1688
|
}
|
|
1689
|
+
function shouldStartOnTurnRecording(params) {
|
|
1690
|
+
return params.recordingEnabled && params.desktopEnabled && desktopCapableBackend2(params.establishedBackendId) && params.effectiveBackend !== "selfhosted";
|
|
1691
|
+
}
|
|
1692
|
+
function computerToolModeForTurn(resolvedModel) {
|
|
1693
|
+
if (!resolvedModel) {
|
|
1694
|
+
return "hosted";
|
|
1695
|
+
}
|
|
1696
|
+
if (resolvedModel.provider.kind === "codex-subscription") {
|
|
1697
|
+
return "function-image";
|
|
1698
|
+
}
|
|
1699
|
+
if (resolvedModel.provider.api === "chat") {
|
|
1700
|
+
return "function-text";
|
|
1701
|
+
}
|
|
1702
|
+
return "hosted";
|
|
1703
|
+
}
|
|
1689
1704
|
async function refreshCappedCodexUsageRows(db, settings, workspaceId, accounts) {
|
|
1690
1705
|
const nearPct = settings.codexRotationNearExhaustionPct;
|
|
1691
1706
|
const stale = accounts.filter(
|
|
@@ -2102,7 +2117,15 @@ function createRunAgentTurnActivity(services) {
|
|
|
2102
2117
|
leaseHeartbeatTimer.unref();
|
|
2103
2118
|
}
|
|
2104
2119
|
}
|
|
2105
|
-
if (resolvedSandbox &&
|
|
2120
|
+
if (resolvedSandbox && shouldStartOnTurnRecording({
|
|
2121
|
+
recordingEnabled: settings.recordingEnabled,
|
|
2122
|
+
desktopEnabled: settings.sandboxDesktopEnabled,
|
|
2123
|
+
establishedBackendId: resolvedSandbox.established.backendId,
|
|
2124
|
+
// EFFECTIVE (active) backend, not the session home: a machine-primary turn
|
|
2125
|
+
// resolves to "selfhosted" and skips; a swap back to the cloud group box
|
|
2126
|
+
// resolves to undefined and records as before.
|
|
2127
|
+
effectiveBackend: activeSandboxBackend
|
|
2128
|
+
})) {
|
|
2106
2129
|
try {
|
|
2107
2130
|
const begun = await beginRecording({
|
|
2108
2131
|
settings,
|
|
@@ -2182,8 +2205,13 @@ function createRunAgentTurnActivity(services) {
|
|
|
2182
2205
|
// (built-in OpenAI/Azure = real hosted support; registry "chat"
|
|
2183
2206
|
// providers = the SDK's own ChatCompletions detection) keeps the SDK
|
|
2184
2207
|
// default.
|
|
2185
|
-
structuredToolTransport: resolvedModel.provider.kind !== "codex-subscription"
|
|
2186
|
-
|
|
2208
|
+
structuredToolTransport: resolvedModel.provider.kind !== "codex-subscription",
|
|
2209
|
+
// EXPLICIT computer-use tool transport, derived from the resolved provider's
|
|
2210
|
+
// authoritative wire identity (codex → function-image, chat → function-text,
|
|
2211
|
+
// responses → hosted) so the runtime never string-sniffs the model instance's
|
|
2212
|
+
// constructor name. See {@link computerToolModeForTurn}.
|
|
2213
|
+
computerToolMode: computerToolModeForTurn(resolvedModel)
|
|
2214
|
+
} : { computerToolMode: computerToolModeForTurn(null) },
|
|
2187
2215
|
...packRuntime.skills.length > 0 ? { packSkills: packRuntime.skills } : {},
|
|
2188
2216
|
...workspaceAgentInstructions ? { instructionsTemplate: workspaceAgentInstructions } : {},
|
|
2189
2217
|
...workspaceEnvironment ? {
|
|
@@ -3842,7 +3870,7 @@ async function createOpenGeniWorker(options = {}) {
|
|
|
3842
3870
|
connection,
|
|
3843
3871
|
namespace: settings.temporalNamespace,
|
|
3844
3872
|
taskQueue: settings.temporalTaskQueue,
|
|
3845
|
-
workflowsPath: new URL("../src/workflows.ts", import.meta.url).pathname,
|
|
3873
|
+
workflowsPath: options.workflowsPath ?? new URL("../src/workflows.ts", import.meta.url).pathname,
|
|
3846
3874
|
activities
|
|
3847
3875
|
});
|
|
3848
3876
|
return { worker, connection };
|