@opengeni/worker-bundle 0.22.1-canary.0 → 0.22.4-canary.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/agent-build.d.ts +1 -0
- package/dist/activities/agent-turn/sandbox-establish.d.ts +1 -0
- package/dist/activities/agent-turn/session-title.d.ts +24 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +1 -0
- package/dist/activities/agent-turn/tool-policy.d.ts +2 -1
- package/dist/activities/incident-telemetry-authority.d.ts +1 -0
- package/dist/activities/parent-wake.d.ts +25 -2
- package/dist/activities/rig-verification.d.ts +22 -7
- package/dist/activities/scheduled-tasks.d.ts +49 -3
- package/dist/{activities-control-DKG22ONJ.js → activities-control-4XVBA3Q5.js} +168 -70
- package/dist/activities-control-4XVBA3Q5.js.map +1 -0
- package/dist/activities-control.d.ts +16 -12
- package/dist/{activities-turn-4IMC3MAA.js → activities-turn-J3CR27E6.js} +164 -44
- package/dist/activities-turn-J3CR27E6.js.map +1 -0
- package/dist/activities.d.ts +16 -12
- package/dist/{chunk-CE7TPKBS.js → chunk-FA35XBBC.js} +3 -3
- package/dist/{chunk-CE7TPKBS.js.map → chunk-FA35XBBC.js.map} +1 -1
- package/dist/{chunk-CNYGVRKF.js → chunk-XWQPS6GG.js} +76 -17
- package/dist/chunk-XWQPS6GG.js.map +1 -0
- package/dist/http.d.ts +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +17 -17
- package/src/activities/agent-turn/agent-build.ts +8 -6
- package/src/activities/agent-turn/governance-model.ts +13 -15
- package/src/activities/agent-turn/run.ts +3 -0
- package/src/activities/agent-turn/sandbox-establish.ts +6 -1
- package/src/activities/agent-turn/session-title.ts +106 -0
- package/src/activities/agent-turn/tool-environment.ts +68 -19
- package/src/activities/agent-turn/tool-policy.ts +5 -2
- package/src/activities/incident-telemetry-authority.ts +7 -0
- package/src/activities/parent-wake.ts +65 -1
- package/src/activities/rig-verification.ts +156 -47
- package/src/activities/scheduled-tasks.ts +38 -35
- package/src/activities/workflow-wake.ts +30 -9
- package/src/http.ts +2 -1
- package/src/index.ts +6 -1
- package/src/observability-metrics.ts +2 -2
- package/src/pr-review-credentials.ts +42 -14
- package/dist/activities-control-DKG22ONJ.js.map +0 -1
- package/dist/activities-turn-4IMC3MAA.js.map +0 -1
- package/dist/chunk-CNYGVRKF.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
observabilityEventLogger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FA35XBBC.js";
|
|
4
4
|
|
|
5
5
|
// src/activity-services.ts
|
|
6
6
|
import { dbSearchPath, getSettings, resolveNatsControlPlaneAuth } from "@opengeni/config";
|
|
@@ -276,7 +276,7 @@ async function resolveStandaloneGitCredentials(settings, db, request) {
|
|
|
276
276
|
...request.providerHost ? { providerHost: request.providerHost } : {}
|
|
277
277
|
};
|
|
278
278
|
if (request.purpose === "identity") {
|
|
279
|
-
return authority.credentialKind === "github_app" ? {
|
|
279
|
+
return authority.credentialKind === "github_app" || authority.credentialKind === "managed_github_app" ? {
|
|
280
280
|
...echoes,
|
|
281
281
|
identity: {
|
|
282
282
|
name: "pr-review[bot]",
|
|
@@ -284,22 +284,26 @@ async function resolveStandaloneGitCredentials(settings, db, request) {
|
|
|
284
284
|
}
|
|
285
285
|
} : echoes;
|
|
286
286
|
}
|
|
287
|
-
if (authority.credentialKind === "github_app") {
|
|
287
|
+
if (authority.credentialKind === "github_app" || authority.credentialKind === "managed_github_app") {
|
|
288
288
|
assertGitHubMintMatchesRepositoryRefs(request);
|
|
289
|
-
|
|
290
|
-
if (!encryptionKey2 || !authority.appId || !authority.credentialEncrypted) {
|
|
289
|
+
if (!authority.appId) {
|
|
291
290
|
throw new Error("PR Review GitHub App credential is unavailable");
|
|
292
291
|
}
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
292
|
+
const signingSettings = authority.credentialKind === "managed_github_app" ? {
|
|
293
|
+
githubAppId: settings.prReviewGithubAppId,
|
|
294
|
+
githubAppPrivateKey: settings.prReviewGithubAppPrivateKey
|
|
295
|
+
} : manualPrReviewGitHubSigningSettings(settings, {
|
|
296
|
+
appId: authority.appId,
|
|
297
|
+
credentialEncrypted: authority.credentialEncrypted
|
|
298
|
+
});
|
|
299
|
+
if (authority.credentialKind === "managed_github_app" && settings.prReviewGithubAppId !== authority.appId) {
|
|
300
|
+
throw new Error("OpenGeni Lens App identity no longer matches this registration");
|
|
301
|
+
}
|
|
302
|
+
const minted = await createGitHubAppInstallationTokenWithSigningSettings(signingSettings, {
|
|
303
|
+
installationId: request.installationId,
|
|
304
|
+
repositoryIds: request.repositoryIds,
|
|
305
|
+
permissions: { contents: "read", pull_requests: "write" }
|
|
306
|
+
});
|
|
303
307
|
return {
|
|
304
308
|
...echoes,
|
|
305
309
|
token: minted.token,
|
|
@@ -319,6 +323,16 @@ async function resolveStandaloneGitCredentials(settings, db, request) {
|
|
|
319
323
|
...authority.expiresAt ? { expiresAt: authority.expiresAt } : {}
|
|
320
324
|
};
|
|
321
325
|
}
|
|
326
|
+
function manualPrReviewGitHubSigningSettings(settings, authority) {
|
|
327
|
+
const encryptionKey = environmentsEncryptionKeyBytes(settings);
|
|
328
|
+
if (!encryptionKey || !authority.credentialEncrypted) {
|
|
329
|
+
throw new Error("PR Review GitHub App credential is unavailable");
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
githubAppId: authority.appId,
|
|
333
|
+
githubAppPrivateKey: decryptVariableSetValue(encryptionKey, authority.credentialEncrypted)
|
|
334
|
+
};
|
|
335
|
+
}
|
|
322
336
|
function assertGitHubMintMatchesRepositoryRefs(request) {
|
|
323
337
|
const refs = request.repositoryRefs ?? [];
|
|
324
338
|
const repositoryIds = refs.map((reference) => positiveInteger(reference.repositoryId));
|
|
@@ -1426,11 +1440,15 @@ import {
|
|
|
1426
1440
|
childRequiresActionDedupeKey,
|
|
1427
1441
|
getSessionSystemUpdateOutboxByDedupeKey,
|
|
1428
1442
|
getOrCreateSessionSystemUpdateOutbox,
|
|
1443
|
+
claimAutomaticSessionTitleFanout,
|
|
1429
1444
|
markSessionWorkflowWakeFailed,
|
|
1430
1445
|
markSessionSystemUpdateOutboxDeliveredInTransaction,
|
|
1431
1446
|
markSessionSystemUpdateOutboxFailed,
|
|
1447
|
+
markAutomaticSessionTitleFanoutDelivered,
|
|
1448
|
+
markAutomaticSessionTitleFanoutFailed,
|
|
1432
1449
|
sessionSystemUpdateOutboxKindPayload
|
|
1433
1450
|
} from "@opengeni/db";
|
|
1451
|
+
import { requireSessionEventDurableFanoutCapability } from "@opengeni/events";
|
|
1434
1452
|
async function notifyParentOfChildIdle(svc, workspaceId, childSessionId, episodeKey) {
|
|
1435
1453
|
try {
|
|
1436
1454
|
const child = await getSession(svc.db, workspaceId, childSessionId);
|
|
@@ -1597,6 +1615,41 @@ async function reconcilePendingParentSystemUpdates(svc, limit = 100, overrides =
|
|
|
1597
1615
|
}
|
|
1598
1616
|
return { claimed: rows.length, delivered, failed };
|
|
1599
1617
|
}
|
|
1618
|
+
async function reconcileAutomaticSessionTitleFanout(svc, limit = 100, overrides = {}) {
|
|
1619
|
+
requireSessionEventDurableFanoutCapability(svc.bus);
|
|
1620
|
+
const claim = overrides.claimAutomaticSessionTitleFanout ?? claimAutomaticSessionTitleFanout;
|
|
1621
|
+
const markDelivered = overrides.markAutomaticSessionTitleFanoutDelivered ?? markAutomaticSessionTitleFanoutDelivered;
|
|
1622
|
+
const markFailed = overrides.markAutomaticSessionTitleFanoutFailed ?? markAutomaticSessionTitleFanoutFailed;
|
|
1623
|
+
const rows = await claim(svc.db, limit);
|
|
1624
|
+
let delivered = 0;
|
|
1625
|
+
let failed = 0;
|
|
1626
|
+
const queue = [...rows];
|
|
1627
|
+
const workers = Array.from({ length: Math.min(20, queue.length) }, async () => {
|
|
1628
|
+
for (; ; ) {
|
|
1629
|
+
const row = queue.shift();
|
|
1630
|
+
if (!row) return;
|
|
1631
|
+
try {
|
|
1632
|
+
if (svc.bus.isConnected?.() === false) {
|
|
1633
|
+
throw new Error("session event bus is disconnected");
|
|
1634
|
+
}
|
|
1635
|
+
if (svc.bus.publishConfirmed) {
|
|
1636
|
+
await svc.bus.publishConfirmed(row.event.workspaceId, row.event.sessionId, [row.event]);
|
|
1637
|
+
} else {
|
|
1638
|
+
await svc.bus.publish(row.event.workspaceId, row.event.sessionId, [row.event]);
|
|
1639
|
+
}
|
|
1640
|
+
await markDelivered(svc.db, row);
|
|
1641
|
+
delivered += 1;
|
|
1642
|
+
} catch (error) {
|
|
1643
|
+
failed += 1;
|
|
1644
|
+
await markFailed(svc.db, row, error instanceof Error ? error.message : String(error)).catch(
|
|
1645
|
+
() => void 0
|
|
1646
|
+
);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
1650
|
+
await Promise.all(workers);
|
|
1651
|
+
return { claimed: rows.length, delivered, failed };
|
|
1652
|
+
}
|
|
1600
1653
|
async function reconcilePendingSessionWorkflowWakes(svc, limit = 1e3, overrides = {}) {
|
|
1601
1654
|
const claimPendingSessionWorkflowWakesFn = overrides.claimPendingSessionWorkflowWakes ?? claimPendingSessionWorkflowWakes;
|
|
1602
1655
|
if (!svc.wakeSessionWorkflow) {
|
|
@@ -2029,6 +2082,9 @@ async function resolveIncidentTelemetryResponderMetadata(input) {
|
|
|
2029
2082
|
let rig = null;
|
|
2030
2083
|
const variableSetIds = /* @__PURE__ */ new Set();
|
|
2031
2084
|
if (input.executionPolicy ?? input.session) {
|
|
2085
|
+
for (const id of input.executionPolicy?.variableSetIds ?? input.session?.variableSetIds ?? []) {
|
|
2086
|
+
variableSetIds.add(id);
|
|
2087
|
+
}
|
|
2032
2088
|
const variableSetId = input.executionPolicy?.variableSetId ?? input.session?.variableSetId;
|
|
2033
2089
|
const rigId = input.executionPolicy?.rigId ?? input.session?.rigId ?? null;
|
|
2034
2090
|
const rigVersionId = input.executionPolicy?.rigVersionId ?? input.session?.rigVersionId ?? null;
|
|
@@ -2183,6 +2239,9 @@ async function validateIncidentTelemetrySystemUpdateAuthority(input) {
|
|
|
2183
2239
|
tools: acceptedExecution.targetSessionExecution.tools,
|
|
2184
2240
|
firstPartyMcpTools: acceptedExecution.targetSessionExecution.firstPartyMcpTools,
|
|
2185
2241
|
firstPartyMcpPermissions: acceptedExecution.targetSessionExecution.firstPartyMcpPermissions,
|
|
2242
|
+
variableSetIds: acceptedExecution.targetSessionExecution.variableSets.map(
|
|
2243
|
+
(variableSet) => variableSet.id
|
|
2244
|
+
),
|
|
2186
2245
|
variableSetId: acceptedExecution.targetSessionExecution.variableSetId,
|
|
2187
2246
|
rigId: acceptedExecution.targetSessionExecution.rigId,
|
|
2188
2247
|
rigVersionId: acceptedExecution.targetSessionExecution.rigVersionId,
|
|
@@ -4619,7 +4678,6 @@ export {
|
|
|
4619
4678
|
withFirstPartyTools,
|
|
4620
4679
|
rigProviderImageSourceImage,
|
|
4621
4680
|
settingsWithPackSandboxImage,
|
|
4622
|
-
settingsWithRigImage,
|
|
4623
4681
|
resolveWorkspacePackRuntime,
|
|
4624
4682
|
resolveWorkspaceInstalledSkillRuntime,
|
|
4625
4683
|
createRuntimeBatcher,
|
|
@@ -4630,6 +4688,7 @@ export {
|
|
|
4630
4688
|
deliverFailedChildTurnToParent,
|
|
4631
4689
|
deliverChildRequiresActionToParent,
|
|
4632
4690
|
reconcilePendingParentSystemUpdates,
|
|
4691
|
+
reconcileAutomaticSessionTitleFanout,
|
|
4633
4692
|
reconcilePendingSessionWorkflowWakes,
|
|
4634
4693
|
collectWorkspaceArchiveObjectKeys,
|
|
4635
4694
|
putVersion1TarArchiveOrInline,
|
|
@@ -4695,4 +4754,4 @@ export {
|
|
|
4695
4754
|
codexUsageLimitFailurePayload,
|
|
4696
4755
|
CODEX_USAGE_LIMIT_MAX_RESUME_MS
|
|
4697
4756
|
};
|
|
4698
|
-
//# sourceMappingURL=chunk-
|
|
4757
|
+
//# sourceMappingURL=chunk-XWQPS6GG.js.map
|