@opengeni/worker-bundle 0.28.4-canary.0 → 0.28.4-canary.2

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.
@@ -86,7 +86,7 @@ import {
86
86
  withFirstPartyTools,
87
87
  wrapLazyTurnBoxWithRouting,
88
88
  wrapTurnBoxWithRouting
89
- } from "./chunk-ZNIKZQMN.js";
89
+ } from "./chunk-OA5CSY5N.js";
90
90
  import {
91
91
  StreamTimingMetrics,
92
92
  makeMachineOpObserver,
@@ -9769,7 +9769,7 @@ import {
9769
9769
  CodexCredentialLeaseAttemptFencedError,
9770
9770
  CodexCredentialFailoverExhaustedError,
9771
9771
  CODEX_CREDENTIAL_LEASE_TTL_MS as CODEX_CREDENTIAL_LEASE_TTL_MS2,
9772
- recordSessionActiveCodexCredential,
9772
+ recordSessionCodexSelectionForTurnAttempt,
9773
9773
  setSessionCodexPinInTransaction,
9774
9774
  settleCodexCredentialFailover as settleCodexCredentialFailover2,
9775
9775
  withSessionCodexCapacityMutation
@@ -10138,8 +10138,33 @@ async function selectCodexTurnCapacity(deps) {
10138
10138
  leases.codex.confirmedUntilMs = leased.leasedUntil && leaseAcquisitionStartedAtMs !== null ? leaseAcquisitionStartedAtMs + CODEX_CREDENTIAL_LEASE_TTL_MS2 : null;
10139
10139
  leases.codex.held = providerTurn.effectiveCodexCredentialId !== null && leased.holderId !== null && leased.generation !== null && leases.codex.confirmedUntilMs !== null;
10140
10140
  if (leases.codex.held) leases.codex.startHeartbeat();
10141
+ const eligibleCount = leased.accounts.filter(
10142
+ (account) => isCodexCredentialEligible(account, /* @__PURE__ */ new Date())
10143
+ ).length;
10144
+ const selectionReceipt = providerTurn.effectiveCodexCredentialId ? await recordSessionCodexSelectionForTurnAttempt(db, {
10145
+ workspaceId: input.workspaceId,
10146
+ sessionId: input.sessionId,
10147
+ turnId,
10148
+ attemptId: input.attemptId,
10149
+ executionGeneration: attempt.executionGeneration,
10150
+ credentialId: providerTurn.effectiveCodexCredentialId,
10151
+ strategy: leased.rotationStrategy,
10152
+ reusedLease: leased.reused,
10153
+ pinnedCredentialId: sessionPin,
10154
+ pinSource: sessionPinSource,
10155
+ eligibleCount,
10156
+ connectedCount: leased.accounts.length
10157
+ }) : null;
10158
+ if (selectionReceipt)
10159
+ await publishDurableSessionEvents5(
10160
+ bus,
10161
+ input.workspaceId,
10162
+ input.sessionId,
10163
+ selectionReceipt.events
10164
+ );
10165
+ const selectionDiagnostics = selectionReceipt?.diagnostics ?? null;
10141
10166
  const actualOutcome = providerTurn.effectiveCodexCredentialId ? "selected" : rotationDecision.kind === "allCapped" || rotationDecision.kind === "allocatorDisabled" ? "waiting" : "none";
10142
- const actualReason = providerTurn.effectiveCodexCredentialId ? leased.reused ? "lease_reused" : sessionPin === providerTurn.effectiveCodexCredentialId ? "pin" : rotationDecision.kind === "active" && rotationDecision.moved ? "rotation" : "active" : rotationDecision.kind === "allCapped" ? "all_capped" : rotationDecision.kind === "allocatorDisabled" ? "allocator_disabled" : "none";
10167
+ const actualReason = selectionDiagnostics ? selectionDiagnostics.reason : rotationDecision.kind === "allCapped" ? "all_capped" : rotationDecision.kind === "allocatorDisabled" ? "allocator_disabled" : "none";
10143
10168
  const fencedInFlight = leased.reused;
10144
10169
  const shadowResult = await publishCodexFleetShadowDecisionV1({
10145
10170
  enabled: settings.codexFleetPolicyShadowEnabled,
@@ -10190,9 +10215,6 @@ async function selectCodexTurnCapacity(deps) {
10190
10215
  payloadBytes: shadowResult.payloadBytes
10191
10216
  });
10192
10217
  }
10193
- const eligibleCount = leased.accounts.filter(
10194
- (account) => isCodexCredentialEligible(account, /* @__PURE__ */ new Date())
10195
- ).length;
10196
10218
  const poolDepth = eligibleCount === 0 ? "zero" : eligibleCount === 1 ? "one" : "many";
10197
10219
  observability.incrementCounter({
10198
10220
  name: "opengeni_codex_pool_observations_total",
@@ -10464,27 +10486,7 @@ async function selectCodexTurnCapacity(deps) {
10464
10486
  return { exit: claimedResult({ status: "cancelled" }) };
10465
10487
  }
10466
10488
  if (providerTurn.effectiveCodexCredentialId) {
10467
- const priorAccountId = lockedSessionCodexState.lastCredentialId;
10468
- if (priorAccountId !== providerTurn.effectiveCodexCredentialId) {
10469
- await recordSessionActiveCodexCredential(
10470
- db,
10471
- input.workspaceId,
10472
- input.sessionId,
10473
- providerTurn.effectiveCodexCredentialId
10474
- );
10475
- const rotated = rotationDecision.kind === "active" && rotationDecision.moved;
10476
- await eventing.publish([
10477
- {
10478
- type: "codex.account.switched",
10479
- payload: {
10480
- fromAccountId: priorAccountId,
10481
- toAccountId: providerTurn.effectiveCodexCredentialId,
10482
- reason: rotated ? "rotation" : "manual"
10483
- }
10484
- }
10485
- ]);
10486
- }
10487
- const selectionReason = leased.reused ? "lease_reused" : sessionPin === providerTurn.effectiveCodexCredentialId ? "pin" : rotationDecision.kind === "active" && rotationDecision.moved ? "rotation" : "active";
10489
+ const selectionReason = selectionDiagnostics.reason;
10488
10490
  observability.incrementCounter({
10489
10491
  name: "opengeni_codex_credential_selections_total",
10490
10492
  help: "Codex credential selections by strategy and reason.",
@@ -10494,19 +10496,6 @@ async function selectCodexTurnCapacity(deps) {
10494
10496
  reason: selectionReason
10495
10497
  }
10496
10498
  });
10497
- await eventing.publish([
10498
- {
10499
- type: "codex.credential.selected",
10500
- payload: {
10501
- credentialId: providerTurn.effectiveCodexCredentialId,
10502
- strategy: leased.rotationStrategy,
10503
- reason: selectionReason,
10504
- eligibleCount,
10505
- connectedCount: leased.accounts.length,
10506
- reused: leased.reused
10507
- }
10508
- }
10509
- ]);
10510
10499
  }
10511
10500
  } catch (error51) {
10512
10501
  credentialSelectionOutcome = "failed";
@@ -12527,6 +12516,7 @@ async function establishTurnSandbox(deps) {
12527
12516
  },
12528
12517
  operationResourcePolicySupported: liveMachineEnrollment?.agentCapabilities.operationResourcePolicy === true,
12529
12518
  operationCpuQuotaSupported: liveMachineEnrollment?.agentCapabilities.operationCpuQuota === true,
12519
+ transactionalFsWriteSupported: liveMachineEnrollment?.agentCapabilities.transactionalFsWrite === true,
12530
12520
  ...activeSandboxRecord.scope === "user" && fileAuthoritySubjectId ? {
12531
12521
  personalMachineAttempt: {
12532
12522
  accountId: input.accountId,
@@ -31150,14 +31140,13 @@ function createSkillReadAttemptToolDefinition(input) {
31150
31140
 
31151
31141
  // src/activities/agent-turn/skill-search.ts
31152
31142
  import { PublicSkillSearchError } from "@opengeni/core";
31153
- import { listSkillLibraryEntries } from "@opengeni/runtime/skill-library";
31154
31143
  function createSkillSearchAttemptToolDefinition(input) {
31155
31144
  return {
31156
31145
  identity: { serverId: "opengeni", toolName: "skill_search" },
31157
31146
  modelName: "skill_search",
31158
31147
  codemodePath: ["opengeni", "skill_search"],
31159
31148
  title: "Search Skills",
31160
- description: "Find installed workspace Skills or available curated and public Skills. Returns identifiers and install sources, not file contents. Search never installs or starts a sandbox. Scope defaults to all; use installed to avoid external search.",
31149
+ description: "Find installed workspace Skills or available public Skills. Returns identifiers and install sources, not file contents. Search never installs or starts a sandbox. Scope defaults to all; use installed to avoid external search.",
31161
31150
  inputSchema: {
31162
31151
  type: "object",
31163
31152
  properties: {
@@ -31191,13 +31180,6 @@ ${entry.description}`.toLowerCase().includes(searchText);
31191
31180
  source: entry.source ?? "workspace",
31192
31181
  installed: !entry.source || entry.source === "workspace"
31193
31182
  }));
31194
- const libraryHits = scope === "installed" ? [] : listSkillLibraryEntries().filter(matches).slice(0, limit).map((entry) => ({
31195
- id: `library:${entry.id}`,
31196
- name: entry.name,
31197
- description: entry.description,
31198
- source: "library",
31199
- libraryId: entry.id
31200
- }));
31201
31183
  let publicResult = null;
31202
31184
  let publicError = null;
31203
31185
  if (scope !== "installed") {
@@ -31214,7 +31196,8 @@ ${entry.description}`.toLowerCase().includes(searchText);
31214
31196
  }
31215
31197
  const output = {
31216
31198
  workspace: workspaceHits,
31217
- library: libraryHits,
31199
+ library: [],
31200
+ // Retained response field for older clients.
31218
31201
  public: publicResult?.items.map((entry) => ({ ...entry })) ?? [],
31219
31202
  // A provider outage is not an empty search. Keep local results useful
31220
31203
  // and expose partial failure explicitly, without leaking network details.
@@ -36944,4 +36927,4 @@ export {
36944
36927
  createTurnActivities,
36945
36928
  createTurnActivitiesFromServices
36946
36929
  };
36947
- //# sourceMappingURL=activities-turn-ZJBY3W5D.js.map
36930
+ //# sourceMappingURL=activities-turn-5MZZ6HQA.js.map