@opengeni/runtime 2.4.3 → 2.5.1-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.
Files changed (36) hide show
  1. package/dist/{agent-UA75SUZ7.js → agent-Q2VNH5FV.js} +2 -2
  2. package/dist/{chunk-ORKCCH5X.js → chunk-25B3EQRW.js} +3 -398
  3. package/dist/{chunk-ORKCCH5X.js.map → chunk-25B3EQRW.js.map} +1 -1
  4. package/dist/{chunk-BV2DSPZK.js → chunk-26GUTY32.js} +267 -181
  5. package/dist/chunk-26GUTY32.js.map +1 -0
  6. package/dist/{chunk-YRKIQK25.js → chunk-CD22I76N.js} +2 -2
  7. package/dist/{chunk-7K6WOXFS.js → chunk-GB763TSV.js} +17 -1
  8. package/dist/chunk-GB763TSV.js.map +1 -0
  9. package/dist/{chunk-WATBACLT.js → chunk-LGLJ5PVD.js} +5 -88
  10. package/dist/chunk-LGLJ5PVD.js.map +1 -0
  11. package/dist/index.d.ts +12 -5
  12. package/dist/index.js +11 -5
  13. package/dist/{localSources-GDQRRHT3.js → localSources-Z5IJIIRV.js} +3 -3
  14. package/dist/model-input.d.ts +2 -1
  15. package/dist/runtime-skills.d.ts +28 -5
  16. package/dist/sandbox/index.js +3 -3
  17. package/dist/skill-files.d.ts +4 -0
  18. package/dist/skill-library.d.ts +1 -1
  19. package/dist/skill-library.js +3 -1
  20. package/dist/workspace-tool-gateway.js +5 -5
  21. package/package.json +11 -11
  22. package/src/bundled_management_skills/opengeni-skills/SKILL.md +3 -1
  23. package/src/index.ts +184 -33
  24. package/src/lazy-tool-transport.ts +0 -3
  25. package/src/model-input.ts +1 -1
  26. package/src/run-events.ts +23 -0
  27. package/src/runtime-skills.ts +122 -161
  28. package/src/sandbox/routing/routing-session.ts +1 -1
  29. package/src/skill-files.ts +20 -0
  30. package/src/skill-library.ts +1 -0
  31. package/dist/chunk-7K6WOXFS.js.map +0 -1
  32. package/dist/chunk-BV2DSPZK.js.map +0 -1
  33. package/dist/chunk-WATBACLT.js.map +0 -1
  34. /package/dist/{agent-UA75SUZ7.js.map → agent-Q2VNH5FV.js.map} +0 -0
  35. /package/dist/{chunk-YRKIQK25.js.map → chunk-CD22I76N.js.map} +0 -0
  36. /package/dist/{localSources-GDQRRHT3.js.map → localSources-Z5IJIIRV.js.map} +0 -0
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  SandboxAgent
3
- } from "./chunk-ORKCCH5X.js";
3
+ } from "./chunk-25B3EQRW.js";
4
4
  import "./chunk-PZ5AY32C.js";
5
5
  export {
6
6
  SandboxAgent
7
7
  };
8
- //# sourceMappingURL=agent-UA75SUZ7.js.map
8
+ //# sourceMappingURL=agent-Q2VNH5FV.js.map
@@ -27539,12 +27539,6 @@ function file2(args) {
27539
27539
  ...args
27540
27540
  };
27541
27541
  }
27542
- function localDir(args) {
27543
- return {
27544
- type: "local_dir",
27545
- ...args
27546
- };
27547
- }
27548
27542
  function gitRepo(args) {
27549
27543
  return {
27550
27544
  type: "git_repo",
@@ -27580,9 +27574,6 @@ function isGitRepo(entry) {
27580
27574
  function isMount(entry) {
27581
27575
  return entry.type === "mount" || entry.type.endsWith("_mount");
27582
27576
  }
27583
- function isDirectoryLikeEntry(entry) {
27584
- return entry.type === "dir" || entry.type === "git_repo" || isMount(entry);
27585
- }
27586
27577
 
27587
27578
  // ../../node_modules/.bun/@openai+agents-core@0.14.3+933c5e7db4cd33c2/node_modules/@openai/agents-core/dist/sandbox/shared/posixPath.mjs
27588
27579
  function hasBackslashPathSeparator(path) {
@@ -28074,11 +28065,6 @@ var SandboxGitSubpathError = class extends SandboxGitArtifactError {
28074
28065
  super(message, "git_subpath_error", details);
28075
28066
  }
28076
28067
  };
28077
- var SandboxSkillsConfigError = class extends SandboxError {
28078
- constructor(message, details) {
28079
- super(message, "skills_config_invalid", details);
28080
- }
28081
- };
28082
28068
  function inferSandboxErrorRetryability(code, details) {
28083
28069
  const retryable = details?.retryable;
28084
28070
  if (typeof retryable === "boolean") {
@@ -32482,7 +32468,7 @@ var SandboxMemoryGenerationManager = class {
32482
32468
  if (!transcript) {
32483
32469
  throw new UserError(`Memory rollout transcript was not found: ${transcriptPath}`);
32484
32470
  }
32485
- const { SandboxAgent: SandboxAgent2 } = await import("./agent-UA75SUZ7.js");
32471
+ const { SandboxAgent: SandboxAgent2 } = await import("./agent-Q2VNH5FV.js");
32486
32472
  const phaseOneAgent = new SandboxAgent2({
32487
32473
  name: "sandbox-memory-phase-one",
32488
32474
  instructions: renderRolloutExtractionInstructions(generate.extraPrompt),
@@ -32543,7 +32529,7 @@ var SandboxMemoryGenerationManager = class {
32543
32529
  })) {
32544
32530
  return;
32545
32531
  }
32546
- const { SandboxAgent: SandboxAgent2 } = await import("./agent-UA75SUZ7.js");
32532
+ const { SandboxAgent: SandboxAgent2 } = await import("./agent-Q2VNH5FV.js");
32547
32533
  const phaseTwoAgent = new SandboxAgent2({
32548
32534
  name: "sandbox-memory-phase-two",
32549
32535
  model: generate.phaseTwoModel,
@@ -44056,151 +44042,6 @@ function createPathProbeError(options, result) {
44056
44042
  }
44057
44043
 
44058
44044
  // ../../node_modules/.bun/@openai+agents-core@0.14.3+933c5e7db4cd33c2/node_modules/@openai/agents-core/dist/sandbox/capabilities/skills.mjs
44059
- var SkillsCapability = class extends Capability {
44060
- type = "skills";
44061
- skills;
44062
- from;
44063
- lazyFrom;
44064
- index;
44065
- skillsPath;
44066
- constructor(args) {
44067
- super();
44068
- this.skills = args.skills ?? [];
44069
- this.from = args.from;
44070
- this.lazyFrom = args.lazyFrom;
44071
- this.index = args.index;
44072
- this.skillsPath = normalizeRelativePath(args.skillsPath ?? ".agents");
44073
- validateSkillsCapability(this);
44074
- }
44075
- tools() {
44076
- if (!this.lazyFrom) {
44077
- return [];
44078
- }
44079
- const session = requireBoundSession(this.type, this._session);
44080
- if (!session.pathExists || !session.materializeEntry) {
44081
- throw new SandboxSkillsConfigError("Skills sandbox sessions must provide pathExists() and materializeEntry().");
44082
- }
44083
- return [
44084
- tool({
44085
- name: "load_skill",
44086
- description: "Load a single lazily configured skill into the sandbox so its SKILL.md, scripts, references, and assets can be read from the workspace.",
44087
- parameters: external_exports.object({
44088
- skill_name: external_exports.string().min(1).describe("Name of the lazily configured skill to materialize.")
44089
- }),
44090
- execute: async ({ skill_name }) => {
44091
- const match = resolveLazySkillMatch(this, skill_name, session.state.manifest);
44092
- const relativeSkillPath = normalizeRelativePath(match.path ?? match.name);
44093
- const destinationPath = joinRelativePaths2(this.skillsPath, relativeSkillPath);
44094
- const skillMarkdownPath = joinRelativePaths2(destinationPath, "SKILL.md");
44095
- if (await session.pathExists(skillMarkdownPath, this._runAs)) {
44096
- return {
44097
- status: "already_loaded",
44098
- skill_name: match.name,
44099
- path: destinationPath
44100
- };
44101
- }
44102
- await session.materializeEntry({
44103
- path: destinationPath,
44104
- entry: resolveLazySkillEntry(this.lazyFrom.source, relativeSkillPath),
44105
- runAs: this._runAs
44106
- });
44107
- return {
44108
- status: "loaded",
44109
- skill_name: match.name,
44110
- path: destinationPath
44111
- };
44112
- }
44113
- })
44114
- ];
44115
- }
44116
- processManifest(manifest) {
44117
- const existingPaths = new Set(Object.keys(manifest.entries).map((path) => normalizeRelativePath(path)));
44118
- if (this.lazyFrom) {
44119
- const overlaps = [...existingPaths].filter((path) => pathsOverlap(path, this.skillsPath)).sort();
44120
- if (overlaps.length > 0) {
44121
- throw new SandboxSkillsConfigError(`skills lazyFrom path overlaps existing manifest entries: ${overlaps.join(", ")}`);
44122
- }
44123
- return manifest;
44124
- }
44125
- if (this.from) {
44126
- const overlap = [...existingPaths].find((path) => pathsOverlap(path, this.skillsPath));
44127
- if (overlap) {
44128
- throw new SandboxSkillsConfigError(`skills path overlaps existing manifest entries: ${overlap}`);
44129
- }
44130
- manifest.entries[this.skillsPath] = this.from;
44131
- return manifest;
44132
- }
44133
- for (const skill of this.skills) {
44134
- const skillPath = joinRelativePaths2(this.skillsPath, skill.name);
44135
- const overlap = [...existingPaths].find((path) => pathsOverlap(path, skillPath));
44136
- if (overlap) {
44137
- throw new SandboxSkillsConfigError(`skill path overlaps existing manifest entries: ${skillPath}`);
44138
- }
44139
- manifest.entries[skillPath] = renderSkillDescriptor(skill);
44140
- existingPaths.add(skillPath);
44141
- }
44142
- return manifest;
44143
- }
44144
- async instructions(manifest) {
44145
- const metadata = resolveSkillsMetadata(this, await this.resolveRuntimeMetadata(manifest), manifest);
44146
- if (metadata.length === 0 && this.from) {
44147
- return renderSkillsDiscoveryInstructions(this.skillsPath);
44148
- }
44149
- if (metadata.length === 0) {
44150
- return null;
44151
- }
44152
- return renderSkillsInstructions({
44153
- metadata,
44154
- lazy: Boolean(this.lazyFrom)
44155
- });
44156
- }
44157
- async resolveRuntimeMetadata(_manifest) {
44158
- if (!this.from || !this._session?.listDir || !this._session.readFile) {
44159
- return [];
44160
- }
44161
- let entries;
44162
- try {
44163
- entries = await this._session.listDir({
44164
- path: this.skillsPath,
44165
- runAs: this._runAs
44166
- });
44167
- } catch (error51) {
44168
- if (isSandboxPathNotFoundError(error51)) {
44169
- return [];
44170
- }
44171
- throw error51;
44172
- }
44173
- const metadata = [];
44174
- for (const entry of entries) {
44175
- if (entry.type !== "dir") {
44176
- continue;
44177
- }
44178
- let content;
44179
- try {
44180
- content = await this._session.readFile({
44181
- path: joinRelativePaths2(entry.path, "SKILL.md"),
44182
- runAs: this._runAs
44183
- });
44184
- } catch (error51) {
44185
- if (isSandboxPathNotFoundError(error51)) {
44186
- continue;
44187
- }
44188
- throw error51;
44189
- }
44190
- const markdown = typeof content === "string" ? content : new TextDecoder().decode(content);
44191
- const frontmatter = parseSkillFrontmatter(markdown);
44192
- metadata.push({
44193
- name: frontmatter.name ?? entry.name,
44194
- description: frontmatter.description ?? "No description provided.",
44195
- path: entry.name
44196
- });
44197
- }
44198
- return metadata;
44199
- }
44200
- };
44201
- function skills(args) {
44202
- return new SkillsCapability(args);
44203
- }
44204
44045
  var SKILLS_SECTION_INTRO = prompt`
44205
44046
  A skill is a set of local instructions to follow that is stored in a \`SKILL.md\` file. Below is the list of skills that can be used. Each entry includes a name, description, and file path so you can open the source for full instructions when using a specific skill.
44206
44047
  `;
@@ -44242,239 +44083,6 @@ var HOW_TO_USE_LAZY_SKILLS_SECTION = prompt`
44242
44083
  - When variants exist (frameworks, providers, domains), pick only the relevant reference file(s) and note that choice.
44243
44084
  - Safety and fallback: If a skill can't be applied cleanly (missing files, unclear instructions), state the issue, pick the next-best approach, and continue.
44244
44085
  `;
44245
- function validateSkillsCapability(capability) {
44246
- const configuredSources = [
44247
- capability.skills.length > 0,
44248
- Boolean(capability.from),
44249
- Boolean(capability.lazyFrom)
44250
- ].filter(Boolean).length;
44251
- if (configuredSources === 0) {
44252
- throw new SandboxSkillsConfigError("skills capability requires `skills`, `from`, or `lazyFrom`.");
44253
- }
44254
- if (configuredSources > 1) {
44255
- throw new SandboxSkillsConfigError("skills capability accepts only one of `skills`, `from`, or `lazyFrom`.");
44256
- }
44257
- if (capability.from && !isDirectoryLikeEntry(capability.from)) {
44258
- throw new SandboxSkillsConfigError("skills from must be a directory-like entry such as dir, git_repo, or mount.");
44259
- }
44260
- const seenSkillNames = /* @__PURE__ */ new Set();
44261
- for (const skill of capability.skills) {
44262
- const normalizedName = normalizeRelativePath(skill.name);
44263
- if (seenSkillNames.has(normalizedName)) {
44264
- throw new SandboxSkillsConfigError(`duplicate skill name: ${skill.name}`);
44265
- }
44266
- seenSkillNames.add(normalizedName);
44267
- }
44268
- }
44269
- function renderSkillDescriptor(skill) {
44270
- const children = {
44271
- "SKILL.md": normalizeSkillContent(skill.content)
44272
- };
44273
- if (skill.scripts && Object.keys(skill.scripts).length > 0) {
44274
- children.scripts = dir({
44275
- children: skill.scripts
44276
- });
44277
- }
44278
- if (skill.references && Object.keys(skill.references).length > 0) {
44279
- children.references = dir({
44280
- children: skill.references
44281
- });
44282
- }
44283
- if (skill.assets && Object.keys(skill.assets).length > 0) {
44284
- children.assets = dir({
44285
- children: skill.assets
44286
- });
44287
- }
44288
- return dir({
44289
- children
44290
- });
44291
- }
44292
- function normalizeSkillContent(content) {
44293
- if (typeof content === "string" || content instanceof Uint8Array) {
44294
- return file2({
44295
- content
44296
- });
44297
- }
44298
- return content;
44299
- }
44300
- function resolveSkillsMetadata(capability, runtimeMetadata = [], manifest) {
44301
- if (capability.skills.length > 0) {
44302
- return capability.skills.map((skill) => ({
44303
- name: skill.name,
44304
- description: skill.description,
44305
- path: joinRelativePaths2(capability.skillsPath, skill.name)
44306
- })).sort((left, right) => left.name.localeCompare(right.name));
44307
- }
44308
- const configuredIndex = resolveLazySkillIndex(capability.lazyFrom, manifest, capability.skillsPath) ?? capability.index ?? (runtimeMetadata.length > 0 ? runtimeMetadata : void 0) ?? deriveIndexFromDirEntry(capability.from);
44309
- return configuredIndex.map((skill) => ({
44310
- ...skill,
44311
- path: joinRelativePaths2(capability.skillsPath, skill.path ?? normalizeRelativePath(skill.name))
44312
- })).sort((left, right) => left.name.localeCompare(right.name));
44313
- }
44314
- function parseSkillFrontmatter(markdown) {
44315
- const lines = markdown.split(/\r?\n/);
44316
- if (lines[0]?.trim() !== "---") {
44317
- return {};
44318
- }
44319
- const endIndex = lines.findIndex((line, index) => index > 0 && line.trim() === "---");
44320
- if (endIndex === -1) {
44321
- return {};
44322
- }
44323
- const metadata = {};
44324
- for (const line of lines.slice(1, endIndex)) {
44325
- const stripped = line.trim();
44326
- const delimiterIndex = stripped.indexOf(":");
44327
- if (!stripped || stripped.startsWith("#") || delimiterIndex === -1) {
44328
- continue;
44329
- }
44330
- const key = stripped.slice(0, delimiterIndex).trim();
44331
- const rawValue = stripped.slice(delimiterIndex + 1).trim();
44332
- if (!key) {
44333
- continue;
44334
- }
44335
- metadata[key] = unquoteFrontmatterValue(rawValue);
44336
- }
44337
- return metadata;
44338
- }
44339
- function unquoteFrontmatterValue(value) {
44340
- if (value.length >= 2 && value[0] === value[value.length - 1] && (value[0] === '"' || value[0] === "'")) {
44341
- return value.slice(1, -1);
44342
- }
44343
- return value;
44344
- }
44345
- function resolveLazySkillIndex(lazySource, manifest, skillsPath = ".agents") {
44346
- if (!lazySource) {
44347
- return void 0;
44348
- }
44349
- if (lazySource.index) {
44350
- return lazySource.index;
44351
- }
44352
- if (lazySource.getIndex && manifest) {
44353
- const derivedIndex2 = lazySource.getIndex(manifest, skillsPath);
44354
- return derivedIndex2.length > 0 ? derivedIndex2 : void 0;
44355
- }
44356
- const derivedIndex = deriveIndexFromDirEntry(lazySource.source);
44357
- return derivedIndex.length > 0 ? derivedIndex : void 0;
44358
- }
44359
- function deriveIndexFromDirEntry(entry) {
44360
- if (!entry || !isDir(entry) || !entry.children) {
44361
- return [];
44362
- }
44363
- return Object.entries(entry.children).filter(([, child]) => child.type === "dir").map(([name, child]) => ({
44364
- name,
44365
- description: child.description ?? "No description provided."
44366
- }));
44367
- }
44368
- function renderSkillsDiscoveryInstructions(skillsPath) {
44369
- return prompt`
44370
- ## Skills
44371
- ${SKILLS_SECTION_INTRO}
44372
-
44373
- ### Skill source
44374
- - Skills are materialized under ${skillsPath}. Discover available skills by inspecting child directories and their SKILL.md files at runtime.
44375
-
44376
- ${HOW_TO_USE_SKILLS_SECTION}
44377
- `;
44378
- }
44379
- function renderSkillsInstructions(args) {
44380
- const availableSkills = args.metadata.map((skill) => `- ${skill.name}: ${skill.description} (file: ${skill.path ?? skill.name})`).join("\n");
44381
- const lazyLoadingInstructions = args.lazy ? prompt`
44382
- ### Lazy loading
44383
- - These skills are indexed for planning, but they are not materialized in the workspace yet.
44384
- - Call \`load_skill\` with a single skill name from the list before reading its \`SKILL.md\` or other files from the workspace.
44385
- - \`load_skill\` stages exactly one skill under the listed path. If you need more than one skill, call it multiple times.
44386
- ` : "";
44387
- const usageInstructions = args.lazy ? HOW_TO_USE_LAZY_SKILLS_SECTION : HOW_TO_USE_SKILLS_SECTION;
44388
- const lazyLoadingSection = lazyLoadingInstructions ? `${lazyLoadingInstructions}
44389
-
44390
- ` : "";
44391
- return prompt`
44392
- ## Skills
44393
- ${SKILLS_SECTION_INTRO}
44394
-
44395
- ### Available skills
44396
- ${availableSkills}
44397
-
44398
- ${lazyLoadingSection}${usageInstructions}
44399
- `;
44400
- }
44401
- function resolveLazySkillMatch(capability, skillName, manifest) {
44402
- const index = resolveLazySkillIndex(capability.lazyFrom, manifest, capability.skillsPath) ?? capability.index ?? [];
44403
- const matches = index.filter((skill) => {
44404
- const relativePath = normalizeRelativePath(skill.path ?? skill.name);
44405
- const pathBaseName = relativePath.split("/").pop() ?? relativePath;
44406
- return skill.name === skillName || relativePath === skillName || pathBaseName === skillName;
44407
- });
44408
- if (matches.length === 0) {
44409
- throw new SandboxSkillsConfigError(`lazy skill not found: ${skillName}`);
44410
- }
44411
- if (matches.length > 1) {
44412
- throw new SandboxSkillsConfigError(`lazy skill name is ambiguous: ${skillName}`);
44413
- }
44414
- return matches[0];
44415
- }
44416
- function joinRelativePaths2(left, right) {
44417
- const normalizedLeft = normalizeRelativePath(left);
44418
- const normalizedRight = normalizeRelativePath(right);
44419
- if (!normalizedLeft) {
44420
- return normalizedRight;
44421
- }
44422
- if (!normalizedRight) {
44423
- return normalizedLeft;
44424
- }
44425
- return `${normalizedLeft}/${normalizedRight}`;
44426
- }
44427
- function joinSourcePath(sourceRoot, relativePath) {
44428
- const trimmedRoot = sourceRoot.replace(/[\\/]+$/, "");
44429
- if (!trimmedRoot) {
44430
- return relativePath;
44431
- }
44432
- return `${trimmedRoot}/${relativePath}`;
44433
- }
44434
- function resolveLazySkillEntry(source, relativeSkillPath) {
44435
- if (source.type === "local_dir") {
44436
- if (!source.src) {
44437
- throw new SandboxSkillsConfigError("Lazy skill local_dir sources require a concrete src value.");
44438
- }
44439
- return {
44440
- ...source,
44441
- type: "local_dir",
44442
- src: joinSourcePath(source.src, relativeSkillPath)
44443
- };
44444
- }
44445
- if (source.type === "git_repo") {
44446
- const baseSubpath = source.subpath ? normalizeRelativePath(source.subpath) : "";
44447
- return {
44448
- ...source,
44449
- type: "git_repo",
44450
- subpath: joinRelativePaths2(baseSubpath, relativeSkillPath)
44451
- };
44452
- }
44453
- if (source.type === "dir") {
44454
- const child = readDirChild(source, relativeSkillPath);
44455
- if (!child) {
44456
- throw new SandboxSkillsConfigError(`lazy skill source path not found: ${relativeSkillPath}`);
44457
- }
44458
- return child;
44459
- }
44460
- throw new SandboxSkillsConfigError(`Lazy skill source type is not supported yet: ${source.type}`);
44461
- }
44462
- function readDirChild(source, relativeSkillPath) {
44463
- let current = source;
44464
- for (const segment of normalizeRelativePath(relativeSkillPath).split("/")) {
44465
- if (!segment) {
44466
- continue;
44467
- }
44468
- if (!current || !isDir(current) || !current.children) {
44469
- return void 0;
44470
- }
44471
- current = current.children[segment];
44472
- }
44473
- return current;
44474
- }
44475
- function pathsOverlap(left, right) {
44476
- return left === right || left.startsWith(`${right}/`) || right.startsWith(`${left}/`);
44477
- }
44478
44086
 
44479
44087
  // ../../node_modules/.bun/@openai+agents-core@0.14.3+933c5e7db4cd33c2/node_modules/@openai/agents-core/dist/sandbox/capabilities/index.mjs
44480
44088
  function defaultCapabilities() {
@@ -44588,7 +44196,6 @@ export {
44588
44196
  RunState,
44589
44197
  dir,
44590
44198
  file2 as file,
44591
- localDir,
44592
44199
  gitRepo,
44593
44200
  s3Mount,
44594
44201
  azureBlobMount,
@@ -44641,8 +44248,6 @@ export {
44641
44248
  shell,
44642
44249
  isSandboxPathNotFoundError,
44643
44250
  probeSandboxPathExists,
44644
- skills,
44645
- parseSkillFrontmatter,
44646
44251
  SandboxAgent,
44647
44252
  serializeManifest,
44648
44253
  serializeHostPathGrantRedactionMetadata,
@@ -44661,4 +44266,4 @@ export {
44661
44266
  Runner,
44662
44267
  Agent
44663
44268
  };
44664
- //# sourceMappingURL=chunk-ORKCCH5X.js.map
44269
+ //# sourceMappingURL=chunk-25B3EQRW.js.map