@opengeni/worker-bundle 0.16.29 → 0.20.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-run-admission.d.ts +12 -0
- package/dist/activities/agent-turn.d.ts +110 -19
- package/dist/activities/api-integrations.d.ts +21 -0
- package/dist/activities/browser-state-artifact-reaper.d.ts +29 -0
- package/dist/activities/capabilities.d.ts +6 -0
- package/dist/activities/codemode-dispatcher.d.ts +35 -0
- package/dist/activities/codemode-token-renewal.d.ts +23 -0
- package/dist/activities/codex-capacity.d.ts +6 -5
- package/dist/activities/codex-image-generation.d.ts +21 -0
- package/dist/activities/context-compaction.d.ts +1 -0
- package/dist/activities/documents.d.ts +3 -2
- package/dist/activities/environment.d.ts +17 -8
- package/dist/activities/expiring-material-renewal.d.ts +1 -1
- package/dist/activities/file-upload-reaper.d.ts +7 -2
- package/dist/activities/gateway-image-generation.d.ts +39 -0
- package/dist/activities/gateway-video-generation.d.ts +53 -0
- package/dist/activities/generated-images.d.ts +112 -0
- package/dist/activities/git-credential-renewal.d.ts +1 -1
- package/dist/activities/goals.d.ts +2 -2
- package/dist/activities/google-drive-changes.d.ts +99 -0
- package/dist/activities/image-generation-operation.d.ts +74 -0
- package/dist/activities/image-generation-references.d.ts +25 -0
- package/dist/activities/knowledge-source-sync-driver.d.ts +23 -0
- package/dist/activities/knowledge-source-sync.d.ts +75 -0
- package/dist/activities/packs.d.ts +21 -36
- package/dist/activities/parent-wake.d.ts +1 -1
- package/dist/activities/retained-screenshot-reaper.d.ts +2 -2
- package/dist/activities/retained-screenshots.d.ts +36 -0
- package/dist/activities/rig-verification.d.ts +82 -5
- package/dist/activities/run-credential-renewal.d.ts +1 -1
- package/dist/activities/run-input.d.ts +3 -1
- package/dist/activities/sandbox-images.d.ts +14 -0
- package/dist/activities/sandbox-lease.d.ts +47 -9
- package/dist/activities/scheduled-tasks.d.ts +2 -2
- package/dist/activities/session-state.d.ts +7 -5
- package/dist/activities/site-auth-maintenance.d.ts +27 -0
- package/dist/activities/streaming.d.ts +1 -1
- package/dist/activities/types.d.ts +87 -5
- package/dist/activities/video-generation-admission.d.ts +43 -0
- package/dist/activities/video-generation-credential.d.ts +24 -0
- package/dist/activities/video-generation-reconciliation.d.ts +13 -0
- package/dist/activities/video-media-validation.d.ts +34 -0
- package/dist/activities/video-output-retention.d.ts +36 -0
- package/dist/activities/video-reference-staging.d.ts +55 -0
- package/dist/activities/workflow-wake.d.ts +2 -2
- package/dist/activities/workspace-capture.d.ts +10 -1
- package/dist/activities/xai-auth.d.ts +23 -0
- package/dist/activities/xai-image-generation.d.ts +26 -0
- package/dist/activities/xai-video-generation.d.ts +18 -0
- package/dist/activities-control-XURE4VKN.js +7221 -0
- package/dist/activities-control-XURE4VKN.js.map +1 -0
- package/dist/activities-control.d.ts +297 -0
- package/dist/activities-turn-6EBXGGLS.js +16036 -0
- package/dist/activities-turn-6EBXGGLS.js.map +1 -0
- package/dist/activities-turn.d.ts +17 -0
- package/dist/activities.d.ts +138 -150
- package/dist/activity-services.d.ts +10 -0
- package/dist/artifact-materializer-entry.d.ts +6 -0
- package/dist/artifact-materializer-entry.js +2662 -0
- package/dist/artifact-materializer-entry.js.map +1 -0
- package/dist/artifact-outbox-entry.d.ts +2 -0
- package/dist/artifact-outbox-entry.js +681 -0
- package/dist/artifact-outbox-entry.js.map +1 -0
- package/dist/chunk-5GRJIP5H.js +3092 -0
- package/dist/chunk-5GRJIP5H.js.map +1 -0
- package/dist/chunk-GRFQTTSQ.js +448 -0
- package/dist/chunk-GRFQTTSQ.js.map +1 -0
- package/dist/chunk-TYNPCG4U.js +906 -0
- package/dist/chunk-TYNPCG4U.js.map +1 -0
- package/dist/concurrency.d.ts +108 -5
- package/dist/editable-artifact-hint-broker.d.ts +49 -0
- package/dist/editable-artifact-materializer-launcher.d.ts +49 -0
- package/dist/editable-artifact-materializer-service.d.ts +108 -0
- package/dist/editable-artifact-materializer-storage.d.ts +12 -0
- package/dist/editable-artifact-materializer-subprocess.d.ts +50 -0
- package/dist/editable-artifact-materializer.d.ts +262 -0
- package/dist/editable-artifact-outbox-dispatcher.d.ts +44 -0
- package/dist/editable-artifact-outbox-service.d.ts +70 -0
- package/dist/host-export.d.ts +1 -1
- package/dist/index.d.ts +189 -10
- package/dist/index.js +715 -17380
- package/dist/index.js.map +1 -1
- package/dist/memory-pressure-guard.d.ts +57 -0
- package/dist/model-checkpoint-memory-collector.d.ts +23 -0
- package/dist/model-context-contributions.d.ts +40 -0
- package/dist/observability-metrics.d.ts +53 -1
- package/dist/sandbox-reaper-contract.d.ts +40 -0
- package/dist/sandbox-reaper-timeout.d.ts +14 -0
- package/dist/sandbox-resume.d.ts +34 -7
- package/dist/sandbox-routing.d.ts +6 -0
- package/dist/worker-service-lifecycle.d.ts +6 -2
- package/dist/workflow-bundle.js +1094 -370
- package/dist/workflows/activities.d.ts +8 -2
- package/dist/workflows/document-index.d.ts +1 -1
- package/dist/workflows/knowledge-source-sync.d.ts +13 -0
- package/dist/workflows/rig-verification.d.ts +1 -1
- package/dist/workflows/sandbox-reaper.d.ts +8 -0
- package/dist/workflows/scheduled-tasks.d.ts +1 -1
- package/dist/workflows/session.d.ts +2 -2
- package/dist/workflows/site-auth-maintenance.d.ts +2 -0
- package/dist/workflows/video-generation.d.ts +10 -0
- package/dist/workflows/workflow-wake.d.ts +1 -1
- package/dist/workflows.d.ts +10 -7
- package/package.json +35 -15
- package/src/activities/agent-run-admission.ts +76 -0
- package/src/activities/agent-turn.ts +2600 -340
- package/src/activities/api-integrations.ts +138 -0
- package/src/activities/browser-state-artifact-reaper.ts +120 -0
- package/src/activities/capabilities.ts +10 -0
- package/src/activities/codemode-dispatcher.ts +335 -0
- package/src/activities/codemode-token-renewal.ts +64 -0
- package/src/activities/codex-capacity.ts +54 -7
- package/src/activities/codex-image-generation.ts +56 -0
- package/src/activities/context-compaction.ts +38 -3
- package/src/activities/documents.ts +14 -4
- package/src/activities/environment.ts +54 -45
- package/src/activities/expiring-material-renewal.ts +1 -1
- package/src/activities/file-upload-reaper.ts +34 -3
- package/src/activities/gateway-image-generation.ts +146 -0
- package/src/activities/gateway-video-generation.ts +298 -0
- package/src/activities/generated-images.ts +860 -0
- package/src/activities/goals.ts +8 -3
- package/src/activities/google-drive-changes.ts +454 -0
- package/src/activities/image-generation-operation.ts +333 -0
- package/src/activities/image-generation-references.ts +118 -0
- package/src/activities/knowledge-source-sync-driver.ts +27 -0
- package/src/activities/knowledge-source-sync.ts +2840 -0
- package/src/activities/mcp-credentials.ts +1 -0
- package/src/activities/packs.ts +75 -152
- package/src/activities/parent-wake.ts +13 -1
- package/src/activities/retained-screenshot-reaper.ts +2 -2
- package/src/activities/retained-screenshots.ts +453 -28
- package/src/activities/rig-verification.ts +554 -43
- package/src/activities/run-input.ts +22 -6
- package/src/activities/sandbox-images.ts +167 -0
- package/src/activities/sandbox-lease.ts +1065 -483
- package/src/activities/scheduled-tasks.ts +104 -74
- package/src/activities/session-state.ts +22 -4
- package/src/activities/site-auth-maintenance.ts +269 -0
- package/src/activities/streaming.ts +42 -3
- package/src/activities/types.ts +104 -5
- package/src/activities/video-generation-admission.ts +303 -0
- package/src/activities/video-generation-credential.ts +112 -0
- package/src/activities/video-generation-reconciliation.ts +771 -0
- package/src/activities/video-media-validation.ts +332 -0
- package/src/activities/video-output-retention.ts +314 -0
- package/src/activities/video-reference-staging.ts +350 -0
- package/src/activities/workflow-wake.ts +2 -2
- package/src/activities/workspace-capture.ts +44 -10
- package/src/activities/xai-auth.ts +122 -0
- package/src/activities/xai-image-generation.ts +86 -0
- package/src/activities/xai-video-generation.ts +69 -0
- package/src/activities-control.ts +58 -0
- package/src/activities-turn.ts +40 -0
- package/src/activities.ts +53 -124
- package/src/activity-services.ts +62 -0
- package/src/artifact-materializer-entry.ts +35 -0
- package/src/artifact-outbox-entry.ts +29 -0
- package/src/concurrency.ts +484 -6
- package/src/editable-artifact-hint-broker.ts +235 -0
- package/src/editable-artifact-materializer-launcher.ts +515 -0
- package/src/editable-artifact-materializer-service.ts +787 -0
- package/src/editable-artifact-materializer-storage.ts +413 -0
- package/src/editable-artifact-materializer-subprocess.ts +956 -0
- package/src/editable-artifact-materializer.ts +1289 -0
- package/src/editable-artifact-outbox-dispatcher.ts +244 -0
- package/src/editable-artifact-outbox-service.ts +438 -0
- package/src/index.ts +328 -72
- package/src/memory-pressure-guard.ts +489 -0
- package/src/model-checkpoint-memory-collector.ts +123 -0
- package/src/model-context-contributions.ts +159 -0
- package/src/observability-metrics.ts +297 -13
- package/src/sandbox-reaper-contract.ts +73 -0
- package/src/sandbox-reaper-timeout.ts +79 -0
- package/src/sandbox-resume.ts +294 -153
- package/src/sandbox-routing.ts +32 -24
- package/src/worker-service-lifecycle.ts +80 -14
- package/src/workflows/activities.ts +31 -0
- package/src/workflows/file-upload-reaper.ts +9 -1
- package/src/workflows/knowledge-source-sync.ts +83 -0
- package/src/workflows/sandbox-reaper.ts +183 -21
- package/src/workflows/scheduled-tasks.ts +42 -6
- package/src/workflows/session.ts +20 -6
- package/src/workflows/site-auth-maintenance.ts +14 -0
- package/src/workflows/video-generation.ts +36 -0
- package/src/workflows.ts +18 -1
- package/dist/activities/toolspace-token-renewal.d.ts +0 -23
- package/src/activities/toolspace-token-renewal.ts +0 -64
package/src/activities/packs.ts
CHANGED
|
@@ -1,55 +1,51 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { CapabilityPack } from "@opengeni/contracts";
|
|
1
|
+
import { CapabilityPack, type PackInstallation } from "@opengeni/contracts";
|
|
3
2
|
import {
|
|
4
3
|
getWorkspace,
|
|
5
4
|
getWorkspacePack,
|
|
6
|
-
|
|
5
|
+
listInstalledPortableSkills,
|
|
7
6
|
listPackInstallations,
|
|
8
7
|
type Database,
|
|
9
8
|
} from "@opengeni/db";
|
|
10
9
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type
|
|
14
|
-
type
|
|
10
|
+
buildPortableSkillArtifact,
|
|
11
|
+
type InstalledSkillActivation,
|
|
12
|
+
type PackSkillActivation,
|
|
13
|
+
type RuntimeSkillArtifact,
|
|
15
14
|
} from "@opengeni/runtime";
|
|
15
|
+
export {
|
|
16
|
+
resolveRigProviderImageSelection,
|
|
17
|
+
rigProviderImageSourceImage,
|
|
18
|
+
settingsWithPackSandboxImage,
|
|
19
|
+
settingsWithRigImage,
|
|
20
|
+
settingsWithRigProviderImage,
|
|
21
|
+
} from "./sandbox-images";
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* sandbox skill index.
|
|
24
|
+
* Legacy pack-scoped runtime compatibility. V2 Pack installations own ordinary
|
|
25
|
+
* Skill components and select an explicit Rig; they contribute nothing here.
|
|
21
26
|
*/
|
|
22
27
|
export type WorkspacePackRuntime = {
|
|
23
28
|
sandboxImage: string | null;
|
|
24
29
|
sandboxProviderImages: CapabilityPack["sandboxProviderImages"] | null;
|
|
25
|
-
|
|
30
|
+
skillActivations: PackSkillActivation[];
|
|
26
31
|
};
|
|
27
32
|
|
|
28
33
|
const emptyPackRuntime: WorkspacePackRuntime = {
|
|
29
34
|
sandboxImage: null,
|
|
30
35
|
sandboxProviderImages: null,
|
|
31
|
-
|
|
36
|
+
skillActivations: [],
|
|
32
37
|
};
|
|
33
38
|
|
|
34
|
-
export type
|
|
35
|
-
|
|
36
|
-
skillLibrarySelections: EffectiveSkillSelection[];
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
type SkillLibraryInstallationMetadata = {
|
|
40
|
-
libraryId: string;
|
|
41
|
-
libraryVersion: string;
|
|
42
|
-
contentSha256: string;
|
|
43
|
-
sourceCommit: string;
|
|
44
|
-
provenance: string;
|
|
39
|
+
export type WorkspaceInstalledSkillRuntime = {
|
|
40
|
+
activations: InstalledSkillActivation[];
|
|
45
41
|
};
|
|
46
42
|
|
|
47
43
|
/**
|
|
48
|
-
* Resolves
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
44
|
+
* Resolves only pre-V2 active Pack installations. A frozen manifest/digest is
|
|
45
|
+
* the protocol marker for V2: inline Skills were migrated into the ordinary
|
|
46
|
+
* Skill ledger and sandboxImage was resolved to selectedRigId during install,
|
|
47
|
+
* so reading either field directly here would duplicate ownership and silently
|
|
48
|
+
* override session compute.
|
|
53
49
|
*/
|
|
54
50
|
export async function resolveWorkspacePackRuntime(
|
|
55
51
|
db: Database,
|
|
@@ -62,6 +58,9 @@ export async function resolveWorkspacePackRuntime(
|
|
|
62
58
|
}
|
|
63
59
|
const packs: CapabilityPack[] = [];
|
|
64
60
|
for (const installation of active) {
|
|
61
|
+
if (!packInstallationUsesLegacyRuntime(installation)) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
65
64
|
const registration = await getWorkspacePack(db, workspaceId, installation.packId);
|
|
66
65
|
if (!registration) {
|
|
67
66
|
continue;
|
|
@@ -74,100 +73,59 @@ export async function resolveWorkspacePackRuntime(
|
|
|
74
73
|
return workspacePackRuntimeFromPacks(packs);
|
|
75
74
|
}
|
|
76
75
|
|
|
76
|
+
export function packInstallationUsesLegacyRuntime(
|
|
77
|
+
installation: Pick<PackInstallation, "manifestSnapshot" | "manifestDigest">,
|
|
78
|
+
): boolean {
|
|
79
|
+
return installation.manifestSnapshot === null && installation.manifestDigest === null;
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
/**
|
|
78
|
-
* Resolves active immutable
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* the pinned artifact hash before any content is materialized.
|
|
83
|
+
* Resolves every active immutable Skill through the normalized Plugin/Skill-
|
|
84
|
+
* Facet ledger. The data layer has already filtered ineffective owner edges;
|
|
85
|
+
* this boundary independently verifies exact files before runtime activation.
|
|
82
86
|
*/
|
|
83
|
-
export async function
|
|
87
|
+
export async function resolveWorkspaceInstalledSkillRuntime(
|
|
84
88
|
db: Database,
|
|
85
89
|
workspaceId: string,
|
|
86
|
-
): Promise<
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
installation.status === "active" &&
|
|
92
|
-
installation.kind === "skill" &&
|
|
93
|
-
installation.capabilityId.startsWith("skill:") &&
|
|
94
|
-
isSkillLibraryEntryId(installation.capabilityId.slice("skill:".length)),
|
|
95
|
-
)
|
|
96
|
-
.sort((a, b) => a.capabilityId.localeCompare(b.capabilityId));
|
|
97
|
-
const skillLibrarySkills: PackSkill[] = [];
|
|
98
|
-
const skillLibrarySelections: EffectiveSkillSelection[] = [];
|
|
99
|
-
for (const installation of activeSkills) {
|
|
100
|
-
const metadata = parseSkillLibraryInstallationMetadata(
|
|
101
|
-
installation.metadata,
|
|
102
|
-
installation.capabilityId,
|
|
103
|
-
);
|
|
104
|
-
if (installation.capabilityId !== `skill:${metadata.libraryId}`) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
`Skill installation id does not match its library entry: ${installation.capabilityId} -> ${metadata.libraryId}`,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
const loaded = loadSkillLibrarySkill(metadata.libraryId, metadata.libraryVersion);
|
|
110
|
-
if (installation.config.version !== metadata.libraryVersion) {
|
|
111
|
-
throw new Error(
|
|
112
|
-
`Skill installation version mismatch for ${metadata.libraryId}@${metadata.libraryVersion}: config has ${String(installation.config.version)}`,
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
if (loaded.entry.contentSha256 !== metadata.contentSha256) {
|
|
116
|
-
throw new Error(
|
|
117
|
-
`Skill installation hash mismatch for ${metadata.libraryId}@${metadata.libraryVersion}: expected ${metadata.contentSha256}, catalog has ${loaded.entry.contentSha256}`,
|
|
118
|
-
);
|
|
119
|
-
}
|
|
90
|
+
): Promise<WorkspaceInstalledSkillRuntime> {
|
|
91
|
+
const installedSkills = await listInstalledPortableSkills(db, workspaceId);
|
|
92
|
+
const activations: InstalledSkillActivation[] = [];
|
|
93
|
+
for (const installed of installedSkills) {
|
|
94
|
+
const artifact = buildPortableSkillArtifact(installed.files);
|
|
120
95
|
if (
|
|
121
|
-
|
|
122
|
-
|
|
96
|
+
artifact.name !== installed.name ||
|
|
97
|
+
artifact.description !== installed.description ||
|
|
98
|
+
artifact.contentSha256 !== installed.contentSha256
|
|
123
99
|
) {
|
|
124
100
|
throw new Error(
|
|
125
|
-
`Skill
|
|
101
|
+
`Installed Skill artifact verification failed for ${installed.capabilityId}; reinstall it from the pinned source`,
|
|
126
102
|
);
|
|
127
103
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
104
|
+
activations.push({
|
|
105
|
+
source: "installation",
|
|
106
|
+
id: installed.capabilityId,
|
|
107
|
+
artifact: {
|
|
108
|
+
name: artifact.name,
|
|
109
|
+
description: artifact.description,
|
|
110
|
+
files: artifact.files.map((file) => ({ path: file.path, content: file.content })),
|
|
111
|
+
},
|
|
112
|
+
version: installed.version,
|
|
113
|
+
contentSha256: artifact.contentSha256,
|
|
114
|
+
reason:
|
|
115
|
+
installed.source === "library"
|
|
116
|
+
? "installed from the curated Skill library"
|
|
117
|
+
: installed.source === "pack"
|
|
118
|
+
? "installed as a Pack-owned Skill"
|
|
119
|
+
: `installed from ${installed.sourceUrl}`,
|
|
132
120
|
});
|
|
133
|
-
skillLibrarySelections.push({
|
|
134
|
-
id: loaded.entry.id,
|
|
135
|
-
name: loaded.entry.name,
|
|
136
|
-
source: "library",
|
|
137
|
-
version: loaded.entry.version,
|
|
138
|
-
contentSha256: loaded.entry.contentSha256,
|
|
139
|
-
reason: "enabled workspace capability installation",
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return { skillLibrarySkills, skillLibrarySelections };
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function parseSkillLibraryInstallationMetadata(
|
|
146
|
-
metadata: Record<string, unknown>,
|
|
147
|
-
capabilityId: string,
|
|
148
|
-
): SkillLibraryInstallationMetadata {
|
|
149
|
-
const libraryId = stringMetadata(metadata.libraryId);
|
|
150
|
-
const libraryVersion = stringMetadata(metadata.libraryVersion);
|
|
151
|
-
const contentSha256 = stringMetadata(metadata.contentSha256);
|
|
152
|
-
const sourceCommit = stringMetadata(metadata.sourceCommit);
|
|
153
|
-
const provenance = stringMetadata(metadata.provenance);
|
|
154
|
-
if (!libraryId || !libraryVersion || !contentSha256 || !sourceCommit || !provenance) {
|
|
155
|
-
throw new Error(
|
|
156
|
-
`Skill installation ${capabilityId} is missing immutable library metadata; re-enable the skill from the current catalog`,
|
|
157
|
-
);
|
|
158
121
|
}
|
|
159
|
-
return {
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function stringMetadata(value: unknown): string | null {
|
|
163
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
122
|
+
return { activations };
|
|
164
123
|
}
|
|
165
124
|
|
|
166
125
|
/**
|
|
167
|
-
* Pure
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* packs. Violations fail the turn with a plain error instead of guessing.
|
|
126
|
+
* Pure pre-V2 compatibility rule for enabled Pack manifests. At most one
|
|
127
|
+
* legacy Pack may declare a sandbox image, and legacy Skill names must be
|
|
128
|
+
* unique. V2 rows never reach this function through runtime resolution.
|
|
171
129
|
*/
|
|
172
130
|
export function workspacePackRuntimeFromPacks(packs: CapabilityPack[]): WorkspacePackRuntime {
|
|
173
131
|
const imagePacks = packs.filter(
|
|
@@ -182,7 +140,7 @@ export function workspacePackRuntimeFromPacks(packs: CapabilityPack[]): Workspac
|
|
|
182
140
|
`Multiple enabled packs declare a sandbox image (${ids}). Only one enabled pack per workspace may declare sandboxImage; disable the others and retry.`,
|
|
183
141
|
);
|
|
184
142
|
}
|
|
185
|
-
const
|
|
143
|
+
const skillActivations: PackSkillActivation[] = [];
|
|
186
144
|
// Keyed case-insensitively to match the per-pack uniqueness rule in the
|
|
187
145
|
// CapabilityPack contract (and case-insensitive filesystems).
|
|
188
146
|
const skillOwners = new Map<string, string>();
|
|
@@ -196,17 +154,23 @@ export function workspacePackRuntimeFromPacks(packs: CapabilityPack[]): Workspac
|
|
|
196
154
|
);
|
|
197
155
|
}
|
|
198
156
|
skillOwners.set(key, pack.id);
|
|
199
|
-
|
|
157
|
+
const artifact: RuntimeSkillArtifact = {
|
|
200
158
|
name: skill.name,
|
|
201
159
|
description: skill.description ?? null,
|
|
202
160
|
files: skill.files.map((file) => ({ path: file.path, content: file.content })),
|
|
161
|
+
};
|
|
162
|
+
skillActivations.push({
|
|
163
|
+
source: "pack",
|
|
164
|
+
id: `pack:${pack.id}:${skill.name}`,
|
|
165
|
+
artifact,
|
|
166
|
+
reason: `active legacy Pack ${pack.id}`,
|
|
203
167
|
});
|
|
204
168
|
}
|
|
205
169
|
}
|
|
206
170
|
return {
|
|
207
171
|
sandboxImage: imagePacks[0]?.sandboxImage?.trim() ?? null,
|
|
208
172
|
sandboxProviderImages: imagePacks[0]?.sandboxProviderImages ?? null,
|
|
209
|
-
|
|
173
|
+
skillActivations,
|
|
210
174
|
};
|
|
211
175
|
}
|
|
212
176
|
|
|
@@ -234,47 +198,6 @@ export async function resolveWorkspaceAgentInstructions(
|
|
|
234
198
|
* the settings pass through untouched, so deployments without packs keep the
|
|
235
199
|
* global OPENGENI_DOCKER_IMAGE / OPENGENI_MODAL_IMAGE_REF behavior exactly.
|
|
236
200
|
*/
|
|
237
|
-
export function settingsWithPackSandboxImage(
|
|
238
|
-
settings: Settings,
|
|
239
|
-
sandboxImage: string | null,
|
|
240
|
-
sandboxProviderImages: CapabilityPack["sandboxProviderImages"] | null = null,
|
|
241
|
-
): Settings {
|
|
242
|
-
if (!sandboxImage) {
|
|
243
|
-
return settings;
|
|
244
|
-
}
|
|
245
|
-
return {
|
|
246
|
-
...settings,
|
|
247
|
-
dockerImage: sandboxImage,
|
|
248
|
-
modalImageRef: sandboxImage,
|
|
249
|
-
modalImageId: sandboxProviderImages?.modal?.imageId,
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Applies the session's frozen rig-version image to run settings. Rig image is
|
|
255
|
-
* the TOP of the image precedence chain (rig > pack > deployment default): when
|
|
256
|
-
* the rig version pins an image it OVERRIDES both the deployment
|
|
257
|
-
* dockerImage/modalImageRef AND any pack-declared sandboxImage. When the rig
|
|
258
|
-
* pins no image (`null`), the settings pass through untouched so the pack /
|
|
259
|
-
* deployment chain below still resolves exactly as today. Applied AFTER
|
|
260
|
-
* settingsWithPackSandboxImage so it wins the collision; identical mechanics to
|
|
261
|
-
* the pack equivalent (write both image fields so docker and modal agree).
|
|
262
|
-
*/
|
|
263
|
-
export function settingsWithRigImage(settings: Settings, rigImage: string | null): Settings {
|
|
264
|
-
if (!rigImage) {
|
|
265
|
-
return settings;
|
|
266
|
-
}
|
|
267
|
-
return {
|
|
268
|
-
...settings,
|
|
269
|
-
dockerImage: rigImage,
|
|
270
|
-
modalImageRef: rigImage,
|
|
271
|
-
// A rig image has no provider-native identity in the current rig contract.
|
|
272
|
-
// Clear a lower-precedence pack/deployment ID so the rig cannot silently
|
|
273
|
-
// run the wrong Modal image.
|
|
274
|
-
modalImageId: undefined,
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
201
|
/**
|
|
279
202
|
* Layers the rig version's default variable sets BELOW the session's own set:
|
|
280
203
|
* the session's values WIN on any key collision (explicit precedence). Both maps
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
getSession,
|
|
5
5
|
getSessionGoal,
|
|
6
6
|
getSessionParentPersonalConnectionDelegations,
|
|
7
|
+
getSessionParentXaiProviderAccountAuthority,
|
|
7
8
|
addSessionSystemUpdateWithSourceMutation,
|
|
8
9
|
claimPendingSessionSystemUpdateOutbox,
|
|
9
10
|
claimPendingSessionWorkflowWakes,
|
|
@@ -63,6 +64,11 @@ export async function notifyParentOfChildIdle(
|
|
|
63
64
|
workspaceId,
|
|
64
65
|
childSessionId,
|
|
65
66
|
);
|
|
67
|
+
const xaiAuthority = await getSessionParentXaiProviderAccountAuthority(
|
|
68
|
+
svc.db,
|
|
69
|
+
workspaceId,
|
|
70
|
+
childSessionId,
|
|
71
|
+
);
|
|
66
72
|
const outbox = await getOrCreateSessionSystemUpdateOutbox(svc.db, {
|
|
67
73
|
accountId: child.accountId,
|
|
68
74
|
workspaceId,
|
|
@@ -74,8 +80,13 @@ export async function notifyParentOfChildIdle(
|
|
|
74
80
|
dedupeKey: clientEventId,
|
|
75
81
|
summary: childCompletionSummary(child, goal, "idle"),
|
|
76
82
|
payload,
|
|
77
|
-
lineage: {
|
|
83
|
+
lineage: {
|
|
84
|
+
childSessionId: child.id,
|
|
85
|
+
parentSessionId: child.parentSessionId,
|
|
86
|
+
...(xaiAuthority.subjectId ? { xaiAuthoritySubjectId: xaiAuthority.subjectId } : {}),
|
|
87
|
+
},
|
|
78
88
|
personalConnectionDelegations,
|
|
89
|
+
xaiProviderAccountAuthoritySnapshot: xaiAuthority.snapshot,
|
|
79
90
|
});
|
|
80
91
|
if (outbox.status === "delivered") {
|
|
81
92
|
return;
|
|
@@ -146,6 +157,7 @@ async function deliverParentSystemUpdateOutbox(
|
|
|
146
157
|
payload: outbox.payload,
|
|
147
158
|
lineage: outbox.lineage,
|
|
148
159
|
personalConnectionDelegations: outbox.personalConnectionDelegations,
|
|
160
|
+
xaiProviderAccountAuthoritySnapshot: outbox.xaiProviderAccountAuthoritySnapshot,
|
|
149
161
|
},
|
|
150
162
|
async (tx) => {
|
|
151
163
|
await markSessionSystemUpdateOutboxDeliveredInTransaction(tx, outbox);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type RetainedScreenshotMaintenanceClaim,
|
|
7
7
|
} from "@opengeni/db";
|
|
8
8
|
import type { ObjectHead, ObjectStorage } from "@opengeni/storage";
|
|
9
|
-
import type {
|
|
9
|
+
import type { ControlActivityServices } from "./types";
|
|
10
10
|
|
|
11
11
|
export const RETAINED_SCREENSHOT_PENDING_GRACE_MS = 15 * 60 * 1_000;
|
|
12
12
|
export const RETAINED_SCREENSHOT_CLAIM_TIMEOUT_MS = 10 * 60 * 1_000;
|
|
@@ -38,7 +38,7 @@ export type RetainedScreenshotMaintenanceActivityOptions = {
|
|
|
38
38
|
* object delete.
|
|
39
39
|
*/
|
|
40
40
|
export function createRetainedScreenshotMaintenanceActivities(
|
|
41
|
-
services: () => Promise<
|
|
41
|
+
services: () => Promise<ControlActivityServices>,
|
|
42
42
|
options: RetainedScreenshotMaintenanceActivityOptions = {},
|
|
43
43
|
) {
|
|
44
44
|
const pendingGraceMs = options.pendingGraceMs ?? RETAINED_SCREENSHOT_PENDING_GRACE_MS;
|