@moldea.ai/adapter-openai-agents-sdk 1.0.6 → 2.0.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/README.md CHANGED
@@ -8,10 +8,10 @@ The package implements the official `openai-agents-sdk` runtime adapter for `@mo
8
8
 
9
9
  ## Supported target
10
10
 
11
- Version `1.0.6` supports:
11
+ Version `2.0.0` supports:
12
12
 
13
13
  - Repository Format version `1`
14
- - `@moldea.ai/core ^2.0.0`
14
+ - `@moldea.ai/core >=3.0.0 <4.0.0`
15
15
  - TypeScript ESM source
16
16
  - npm `@openai/agents >=0.16.1 <0.17.0`
17
17
  - directly exported `const` agents constructed through `new Agent({ ... })` or `Agent.create({ ... })`
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import { posix } from "node:path";
2
2
  import { intersects, subset, validRange } from "semver";
3
3
  import ts from "typescript";
4
4
  import { parseRepositoryPath } from "@moldea.ai/repository";
5
+ import { readRuntimeAdapterFile } from "@moldea.ai/core/adapter";
5
6
  //#region src/constants/index.ts
6
7
  var OPENAI_AGENTS_SDK_ADAPTER_ID = "openai-agents-sdk";
7
8
  var OPENAI_AGENTS_SDK_PACKAGE_NAME = "@openai/agents";
@@ -1606,9 +1607,9 @@ var resolveTarget = async (session, sourceAnalysis, expression) => {
1606
1607
  }
1607
1608
  return resolvedTargets.length === 1 ? resolvedTargets[0] : null;
1608
1609
  };
1609
- var getMappedAgents = (context, target) => context.project.agents.filter(({ declaration }) => {
1610
- const runtimeAgent = declaration.bindings?.runtimeAgent;
1611
- return runtimeAgent?.path === target.path && runtimeAgent.symbol === target.symbol;
1610
+ var resolveMappedAgent = (context, target) => context.resolveAgent({
1611
+ path: target.path,
1612
+ symbol: target.symbol
1612
1613
  });
1613
1614
  var getSafeDetails = (registration, routingDescriptionSource, target, targetAgentId) => ({
1614
1615
  registrationKind: registration.kind,
@@ -1660,17 +1661,17 @@ var inspectOpenAiAgentsSdkHandoffs = async (context, session, agent, analysis, d
1660
1661
  if (registration === null) continue;
1661
1662
  const target = await resolveTarget(session, analysis, registration.target);
1662
1663
  if (target === null) continue;
1663
- const mappedAgents = getMappedAgents(context, target);
1664
+ const resolution = resolveMappedAgent(context, target);
1665
+ const mappedAgent = resolution.kind === "matched" ? resolution.agent : void 0;
1664
1666
  const runtimeName = await getRuntimeName(session, analysis, registration);
1665
1667
  let routingDescriptionSource = "unresolved";
1666
- if (mappedAgents.length > 1) addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS", analysis.path, agent.id, locateOpenAiAgentsSdkNode(analysis, registration.target), void 0, getAmbiguousTargetDetails(registration, target));
1667
- else if (mappedAgents.length === 1) routingDescriptionSource = await inspectRoutingDescription(session, agent, analysis, registration, target, mappedAgents[0], diagnostics);
1668
- const targetAgent = mappedAgents.length === 1 ? mappedAgents[0] : void 0;
1668
+ if (resolution.kind === "ambiguous") addOpenAiAgentsSdkDiagnostic(diagnostics, "OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS", analysis.path, agent.id, locateOpenAiAgentsSdkNode(analysis, registration.target), void 0, getAmbiguousTargetDetails(registration, target));
1669
+ else if (mappedAgent !== void 0) routingDescriptionSource = await inspectRoutingDescription(session, agent, analysis, registration, target, mappedAgent, diagnostics);
1669
1670
  evidence.push(createOpenAiAgentsSdkEvidence({
1670
1671
  agentId: agent.id,
1671
1672
  capabilityId: null,
1672
1673
  capabilityKind: null,
1673
- details: getSafeDetails(registration, routingDescriptionSource, target, targetAgent?.id),
1674
+ details: getSafeDetails(registration, routingDescriptionSource, target, mappedAgent?.id),
1674
1675
  kind: "handoff-registration",
1675
1676
  references: [{ path: analysis.path }, {
1676
1677
  path: target.path,
@@ -1921,7 +1922,7 @@ var discoverOpenAiAgentsSdkPackage = async (repository, sourcePath, signal) => {
1921
1922
  packageName: OPENAI_AGENTS_SDK_PACKAGE_NAME,
1922
1923
  reader: {
1923
1924
  getEntry: (path) => repository.getEntry(parseRepositoryPath(path), repositoryOptions),
1924
- readFile: (path) => repository.readFile(parseRepositoryPath(path), repositoryOptions)
1925
+ readFile: (path) => readRuntimeAdapterFile(repository, parseRepositoryPath(path), repositoryOptions)
1925
1926
  },
1926
1927
  ...signal === void 0 ? {} : { signal },
1927
1928
  sourcePath,
@@ -1947,7 +1948,7 @@ var createOpenAiAgentsSdkInspectionSession = (context) => createInspectionSessio
1947
1948
  analyzeSource: analyzeOpenAiAgentsSdkSource,
1948
1949
  discoverPackage: (path, signal) => discoverOpenAiAgentsSdkPackage(context.repository, path, signal),
1949
1950
  getEntry: (path, signal) => context.repository.getEntry(path, signal === void 0 ? void 0 : { signal }),
1950
- readFile: (path, signal) => context.repository.readFile(path, signal === void 0 ? void 0 : { signal }),
1951
+ readFile: (path, signal) => readRuntimeAdapterFile(context.repository, path, signal === void 0 ? void 0 : { signal }),
1951
1952
  ...context.signal === void 0 ? {} : { signal: context.signal }
1952
1953
  });
1953
1954
  //#endregion
@@ -2017,7 +2018,7 @@ var inspectOpenAiAgentsSdk = async (context) => {
2017
2018
  const session = createOpenAiAgentsSdkInspectionSession(context);
2018
2019
  const evidence = [];
2019
2020
  const diagnostics = [];
2020
- const agents = [...context.agents].sort((left, right) => compareOpenAiAgentsSdkStrings(left.id, right.id));
2021
+ const agents = [context.agent];
2021
2022
  for (const agent of agents) {
2022
2023
  context.signal?.throwIfAborted();
2023
2024
  await inspectAgent(context, session, agent, evidence, diagnostics);
@@ -1,4 +1,4 @@
1
- import type { IIndexedAgent, IRuntimeAdapterEvidence } from '@moldea.ai/core';
1
+ import type { IIndexedAgent, IRuntimeAdapterEvidence } from '@moldea.ai/core/adapter';
2
2
  import type { IAdapterDiagnostic, IRuntimeAdapterContext } from '@moldea.ai/core/adapter';
3
3
  import type { IOpenAiAgentsSdkAgentDefinition, IOpenAiAgentsSdkInspectionSession, IOpenAiAgentsSdkSourceAnalysis } from '../contracts/index.js';
4
4
  /** Inspects runtime-native handoff registrations and routing-description wiring. */
@@ -1 +1 @@
1
- {"version":3,"file":"handoffs.d.ts","sourceRoot":"","sources":["../../src/inspection/handoffs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAI1F,OAAO,KAAK,EACV,+BAA+B,EAE/B,iCAAiC,EAEjC,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAoP/B,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,GACzC,SAAS,sBAAsB,EAC/B,SAAS,iCAAiC,EAC1C,OAAO,aAAa,EACpB,UAAU,8BAA8B,EACxC,YAAY,+BAA+B,EAC3C,UAAU,uBAAuB,EAAE,EACnC,aAAa,kBAAkB,EAAE,KAChC,OAAO,CAAC,IAAI,CAiFd,CAAC"}
1
+ {"version":3,"file":"handoffs.d.ts","sourceRoot":"","sources":["../../src/inspection/handoffs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EACV,+BAA+B,EAE/B,iCAAiC,EAEjC,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAiP/B,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,GACzC,SAAS,sBAAsB,EAC/B,SAAS,iCAAiC,EAC1C,OAAO,aAAa,EACpB,UAAU,8BAA8B,EACxC,YAAY,+BAA+B,EAC3C,UAAU,uBAAuB,EAAE,EACnC,aAAa,kBAAkB,EAAE,KAChC,OAAO,CAAC,IAAI,CAgFd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../../src/inspection/inspection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAsIjC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,sBAAsB,KAC9B,OAAO,CAAC,qBAAqB,CAmB/B,CAAC"}
1
+ {"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../../src/inspection/inspection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAqIjC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,sBAAsB,KAC9B,OAAO,CAAC,qBAAqB,CAiB/B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { IIndexedAgent, IRuntimeAdapterEvidence } from '@moldea.ai/core';
1
+ import type { IIndexedAgent, IRuntimeAdapterEvidence } from '@moldea.ai/core/adapter';
2
2
  import type { IAdapterDiagnostic } from '@moldea.ai/core/adapter';
3
3
  import type { IOpenAiAgentsSdkAgentDefinition, IOpenAiAgentsSdkInspectionSession, IOpenAiAgentsSdkSourceAnalysis } from '../contracts/index.js';
4
4
  /** Inspects instruction, agent-schema, function-tool, and tool-schema relationships. */
@@ -1 +1 @@
1
- {"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/inspection/relationships.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAOlE,OAAO,KAAK,EACV,+BAA+B,EAE/B,iCAAiC,EAEjC,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAikB/B,wFAAwF;AACxF,eAAO,MAAM,mCAAmC,GAC9C,SAAS,iCAAiC,EAC1C,OAAO,aAAa,EACpB,UAAU,8BAA8B,EACxC,YAAY,+BAA+B,EAC3C,UAAU,uBAAuB,EAAE,EACnC,aAAa,kBAAkB,EAAE,KAChC,OAAO,CAAC,IAAI,CAId,CAAC"}
1
+ {"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/inspection/relationships.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAOlE,OAAO,KAAK,EACV,+BAA+B,EAE/B,iCAAiC,EAEjC,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAikB/B,wFAAwF;AACxF,eAAO,MAAM,mCAAmC,GAC9C,SAAS,iCAAiC,EAC1C,OAAO,aAAa,EACpB,UAAU,8BAA8B,EACxC,YAAY,+BAA+B,EAC3C,UAAU,uBAAuB,EAAE,EACnC,aAAa,kBAAkB,EAAE,KAChC,OAAO,CAAC,IAAI,CAId,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { IRuntimeAdapterContext } from '@moldea.ai/core/adapter';
1
+ import { type IRuntimeAdapterContext } from '@moldea.ai/core/adapter';
2
2
  import type { IOpenAiAgentsSdkInspectionSession } from '../contracts/index.js';
3
3
  /** Creates one operation-local OpenAI Agents SDK inspection session. */
4
4
  export declare const createOpenAiAgentsSdkInspectionSession: (context: IRuntimeAdapterContext) => IOpenAiAgentsSdkInspectionSession;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/inspection/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAI/E,wEAAwE;AACxE,eAAO,MAAM,sCAAsC,GACjD,SAAS,sBAAsB,KAC9B,iCAUC,CAAC"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/inspection/session.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAI/E,wEAAwE;AACxE,eAAO,MAAM,sCAAsC,GACjD,SAAS,sBAAsB,KAC9B,iCAcC,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { IRepositoryPath, IRepositoryReader } from '@moldea.ai/repository';
1
+ import { type IRuntimeAdapterRepository } from '@moldea.ai/core/adapter';
2
+ import type { IRepositoryPath } from '@moldea.ai/repository';
2
3
  import type { IOpenAiAgentsSdkPackageDiscoveryResult } from '../contracts/index.js';
3
4
  /**
4
5
  * Creates nearest-to-root package-manifest candidates for one source path.
@@ -23,5 +24,5 @@ export declare const createPackageManifestCandidatePaths: (sourcePath: IReposito
23
24
  * - RESOURCE_LIMIT_EXCEEDED: A repository reading resource limit was exceeded.
24
25
  * - ABORTED: The repository operation was aborted.
25
26
  */
26
- export declare const discoverOpenAiAgentsSdkPackage: (repository: IRepositoryReader, sourcePath: IRepositoryPath, signal?: AbortSignal) => Promise<IOpenAiAgentsSdkPackageDiscoveryResult>;
27
+ export declare const discoverOpenAiAgentsSdkPackage: (repository: IRuntimeAdapterRepository, sourcePath: IRepositoryPath, signal?: AbortSignal) => Promise<IOpenAiAgentsSdkPackageDiscoveryResult>;
27
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package-discovery/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAOhF,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,GAC9C,YAAY,eAAe,KAC1B,SAAS,eAAe,EACgD,CAAC;AAE5E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,8BAA8B,GACzC,YAAY,iBAAiB,EAC7B,YAAY,eAAe,EAC3B,SAAS,WAAW,KACnB,OAAO,CAAC,sCAAsC,CA4BhD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package-discovery/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAO7D,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,GAC9C,YAAY,eAAe,KAC1B,SAAS,eAAe,EACgD,CAAC;AAE5E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,8BAA8B,GACzC,YAAY,yBAAyB,EACrC,YAAY,eAAe,EAC3B,SAAS,WAAW,KACnB,OAAO,CAAC,sCAAsC,CA6BhD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moldea.ai/adapter-openai-agents-sdk",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "description": "Deterministic runtime evidence and diagnostics for direct OpenAI Agents SDK integrations.",
5
5
  "homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-openai-agents-sdk#readme",
6
6
  "bugs": {
@@ -33,8 +33,8 @@
33
33
  "node": ">=22.11.0"
34
34
  },
35
35
  "dependencies": {
36
- "@moldea.ai/core": "^2.0.0",
37
- "@moldea.ai/repository": ">=1.1.1",
36
+ "@moldea.ai/core": "3.0.0",
37
+ "@moldea.ai/repository": "2.0.0",
38
38
  "semver": "7.8.5",
39
39
  "typescript": "6.0.3"
40
40
  },