@moldea.ai/adapter-openai-agents-sdk 3.0.1 → 4.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 +7 -2
- package/dist/contracts/index.d.ts +7 -5
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/diagnostics/index.d.ts +88 -21
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/index.js +332 -229
- package/dist/inspection/common.d.ts +4 -2
- package/dist/inspection/common.d.ts.map +1 -1
- package/dist/inspection/handoffs.d.ts.map +1 -1
- package/docs/binding-example.md +218 -0
- package/docs/evidence-and-diagnostics.md +3 -0
- package/docs/index.md +2 -0
- package/docs/limitations.md +2 -0
- package/package.json +2 -2
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 `
|
|
11
|
+
Version `4.0.0` supports:
|
|
12
12
|
|
|
13
13
|
- Repository Format version `1`
|
|
14
|
-
- `@moldea.ai/core ^
|
|
14
|
+
- `@moldea.ai/core ^5.0.0`
|
|
15
15
|
- TypeScript ESM source
|
|
16
16
|
- npm `@openai/agents >=0.16.1`
|
|
17
17
|
- directly exported `const` agents constructed through `new Agent({ ... })` or `Agent.create({ ... })`
|
|
@@ -50,6 +50,8 @@ Agent-definition evidence uses a supported static Agent name only when it satisf
|
|
|
50
50
|
|
|
51
51
|
## Diagnostics
|
|
52
52
|
|
|
53
|
+
`OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED` has severity `warning` only when the adapter identifies a declared relationship affected by a recognized but unresolved source candidate. Its safe details identify the relationship and reason; known version-behavior boundaries additionally carry normalized dependency context. Missing local evidence or a newer eligible dependency version alone does not produce this warning. Confirmed diagnostic codes remain errors.
|
|
54
|
+
|
|
53
55
|
| Code | Stable message |
|
|
54
56
|
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
55
57
|
| `OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID` | The owning package manifest is invalid for OpenAI Agents SDK dependency detection. |
|
|
@@ -73,6 +75,7 @@ Agent-definition evidence uses a supported static Agent name only when it satisf
|
|
|
73
75
|
| `OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS` | The detected OpenAI Agents SDK handoff target matches more than one registered moldea agent. |
|
|
74
76
|
| `OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING` | The detected OpenAI Agents SDK handoff registration is missing its effective routing description. |
|
|
75
77
|
| `OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED` | The detected OpenAI Agents SDK handoff registration does not use the target agent's effective routing description. |
|
|
78
|
+
| `OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED` | The declared runtime relationship could not be verified. |
|
|
76
79
|
|
|
77
80
|
Missing local runtime evidence is not a diagnostic. Dynamic or unsupported forms produce partial or no evidence rather than guessed failures.
|
|
78
81
|
|
|
@@ -91,6 +94,8 @@ Unit and integration tests are colocated with their implementation modules. Adap
|
|
|
91
94
|
|
|
92
95
|
## Documentation
|
|
93
96
|
|
|
97
|
+
- [Complete binding example](docs/binding-example.md): manifest, canonical instructions, runtime source, and supported schema or routing relationships.
|
|
98
|
+
|
|
94
99
|
These guides are included in the installed package. Open only the page relevant to your task.
|
|
95
100
|
|
|
96
101
|
- [Package overview](docs/index.md)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
2
|
import type { ISourceRange } from '@moldea.ai/core';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IAdapterErrorDiagnostic, IAdapterWarningDiagnostic } from '@moldea.ai/core/adapter';
|
|
4
4
|
import type { IRepositoryEntry, IRepositoryPath } from '@moldea.ai/repository';
|
|
5
|
-
export type IOpenAiAgentsSdkAdapterDiagnosticCode = 'OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID' | 'OPENAI_AGENTS_SDK_VERSION_UNSUPPORTED' | 'OPENAI_AGENTS_SDK_SOURCE_TEXT_INVALID' | 'OPENAI_AGENTS_SDK_SOURCE_SYNTAX_INVALID' | 'OPENAI_AGENTS_SDK_RUNTIME_AGENT_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_REGISTRATION_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_NOT_WIRED' | 'OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_REGISTRATION_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_NAME_MISMATCH' | 'OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_NOT_WIRED' | 'OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS' | 'OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING' | 'OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED';
|
|
5
|
+
export type IOpenAiAgentsSdkAdapterDiagnosticCode = 'OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID' | 'OPENAI_AGENTS_SDK_VERSION_UNSUPPORTED' | 'OPENAI_AGENTS_SDK_SOURCE_TEXT_INVALID' | 'OPENAI_AGENTS_SDK_SOURCE_SYNTAX_INVALID' | 'OPENAI_AGENTS_SDK_RUNTIME_AGENT_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_REGISTRATION_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND' | 'OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_NOT_WIRED' | 'OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_REGISTRATION_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_NAME_MISMATCH' | 'OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_NOT_WIRED' | 'OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_NOT_WIRED' | 'OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS' | 'OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING' | 'OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED' | 'OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED';
|
|
6
6
|
export type IOpenAiAgentsSdkPackageCompatibility = 'ambiguous' | 'supported' | 'unsupported';
|
|
7
7
|
export type IOpenAiAgentsSdkPackageDependencyKind = 'dependencies' | 'optionalDependencies' | 'peerDependencies' | 'devDependencies';
|
|
8
8
|
export interface IOpenAiAgentsSdkPackageDeclaration {
|
|
@@ -154,9 +154,11 @@ export interface IOpenAiAgentsSdkInspectionSession {
|
|
|
154
154
|
discoverPackage(path: IRepositoryPath): Promise<IOpenAiAgentsSdkPackageDiscoveryResult>;
|
|
155
155
|
getEntry(path: IRepositoryPath): Promise<IRepositoryEntry | null>;
|
|
156
156
|
}
|
|
157
|
-
export type IOpenAiAgentsSdkDiagnosticInput = Omit<
|
|
158
|
-
readonly code: IOpenAiAgentsSdkAdapterDiagnosticCode
|
|
159
|
-
}
|
|
157
|
+
export type IOpenAiAgentsSdkDiagnosticInput = (Omit<IAdapterErrorDiagnostic, 'message' | 'source' | 'severity' | 'code'> & {
|
|
158
|
+
readonly code: Exclude<IOpenAiAgentsSdkAdapterDiagnosticCode, 'OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED'>;
|
|
159
|
+
}) | (Omit<IAdapterWarningDiagnostic, 'message' | 'source' | 'severity' | 'code'> & {
|
|
160
|
+
readonly code: 'OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED';
|
|
161
|
+
});
|
|
160
162
|
export interface IOpenAiAgentsSdkLocatedExpression {
|
|
161
163
|
readonly expression: ts.Expression;
|
|
162
164
|
readonly range: ISourceRange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,M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I,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;IACpF,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACxF,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CACnE;AAGD,MAAM,MAAM,+BAA+B,GACvC,CAAC,IAAI,CAAC,uBAAuB,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,GAAG;IAC3E,QAAQ,CAAC,IAAI,EAAE,OAAO,CACpB,qCAAqC,EACrC,mDAAmD,CACpD,CAAC;CACH,CAAC,GACF,CAAC,IAAI,CAAC,yBAAyB,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,GAAG;IAC7E,QAAQ,CAAC,IAAI,EAAE,mDAAmD,CAAC;CACpE,CAAC,CAAC;AAGP,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC9B"}
|
|
@@ -1,27 +1,94 @@
|
|
|
1
1
|
import type { IAdapterDiagnostic } from '@moldea.ai/core/adapter';
|
|
2
2
|
import type { IOpenAiAgentsSdkDiagnosticInput } from '../contracts/index.js';
|
|
3
3
|
export declare const OPENAI_AGENTS_SDK_ADAPTER_DIAGNOSTICS: Readonly<{
|
|
4
|
-
readonly OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
readonly
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly
|
|
4
|
+
readonly OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED: {
|
|
5
|
+
readonly message: "The declared agent output schema is not wired to the detected OpenAI Agents SDK agent output type.";
|
|
6
|
+
readonly severity: "error";
|
|
7
|
+
};
|
|
8
|
+
readonly OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND: {
|
|
9
|
+
readonly message: "The declared agent output-schema symbol was not found.";
|
|
10
|
+
readonly severity: "error";
|
|
11
|
+
};
|
|
12
|
+
readonly OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING: {
|
|
13
|
+
readonly message: "The detected OpenAI Agents SDK handoff registration is missing its effective routing description.";
|
|
14
|
+
readonly severity: "error";
|
|
15
|
+
};
|
|
16
|
+
readonly OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED: {
|
|
17
|
+
readonly message: "The detected OpenAI Agents SDK handoff registration does not use the target agent's effective routing description.";
|
|
18
|
+
readonly severity: "error";
|
|
19
|
+
};
|
|
20
|
+
readonly OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS: {
|
|
21
|
+
readonly message: "The detected OpenAI Agents SDK handoff target matches more than one registered moldea agent.";
|
|
22
|
+
readonly severity: "error";
|
|
23
|
+
};
|
|
24
|
+
readonly OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_NOT_WIRED: {
|
|
25
|
+
readonly message: "The declared instruction loader is not wired to the detected OpenAI Agents SDK agent.";
|
|
26
|
+
readonly severity: "error";
|
|
27
|
+
};
|
|
28
|
+
readonly OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_SYMBOL_NOT_FOUND: {
|
|
29
|
+
readonly message: "The declared instruction-loader symbol was not found.";
|
|
30
|
+
readonly severity: "error";
|
|
31
|
+
};
|
|
32
|
+
readonly OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID: {
|
|
33
|
+
readonly message: "The owning package manifest is invalid for OpenAI Agents SDK dependency detection.";
|
|
34
|
+
readonly severity: "error";
|
|
35
|
+
};
|
|
36
|
+
readonly OPENAI_AGENTS_SDK_RUNTIME_AGENT_SYMBOL_NOT_FOUND: {
|
|
37
|
+
readonly message: "The declared runtime-agent symbol was not found.";
|
|
38
|
+
readonly severity: "error";
|
|
39
|
+
};
|
|
40
|
+
readonly OPENAI_AGENTS_SDK_SOURCE_SYNTAX_INVALID: {
|
|
41
|
+
readonly message: "The referenced OpenAI Agents SDK source file contains invalid TypeScript syntax.";
|
|
42
|
+
readonly severity: "error";
|
|
43
|
+
};
|
|
44
|
+
readonly OPENAI_AGENTS_SDK_SOURCE_TEXT_INVALID: {
|
|
45
|
+
readonly message: "The referenced OpenAI Agents SDK source file is not valid normalized text.";
|
|
46
|
+
readonly severity: "error";
|
|
47
|
+
};
|
|
48
|
+
readonly OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_NOT_WIRED: {
|
|
49
|
+
readonly message: "The declared tool implementation is not wired to the detected OpenAI Agents SDK function tool.";
|
|
50
|
+
readonly severity: "error";
|
|
51
|
+
};
|
|
52
|
+
readonly OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_SYMBOL_NOT_FOUND: {
|
|
53
|
+
readonly message: "The declared tool-implementation symbol was not found.";
|
|
54
|
+
readonly severity: "error";
|
|
55
|
+
};
|
|
56
|
+
readonly OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_NOT_WIRED: {
|
|
57
|
+
readonly message: "The declared tool input schema is not wired to the detected OpenAI Agents SDK function tool.";
|
|
58
|
+
readonly severity: "error";
|
|
59
|
+
};
|
|
60
|
+
readonly OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_SYMBOL_NOT_FOUND: {
|
|
61
|
+
readonly message: "The declared tool input-schema symbol was not found.";
|
|
62
|
+
readonly severity: "error";
|
|
63
|
+
};
|
|
64
|
+
readonly OPENAI_AGENTS_SDK_TOOL_NAME_MISMATCH: {
|
|
65
|
+
readonly message: "The declared tool name does not match the detected OpenAI Agents SDK function-tool name.";
|
|
66
|
+
readonly severity: "error";
|
|
67
|
+
};
|
|
68
|
+
readonly OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_NOT_WIRED: {
|
|
69
|
+
readonly message: "The declared tool output schema is not wired to the detected OpenAI Agents SDK function tool.";
|
|
70
|
+
readonly severity: "error";
|
|
71
|
+
};
|
|
72
|
+
readonly OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND: {
|
|
73
|
+
readonly message: "The declared tool output-schema symbol was not found.";
|
|
74
|
+
readonly severity: "error";
|
|
75
|
+
};
|
|
76
|
+
readonly OPENAI_AGENTS_SDK_TOOL_REGISTRATION_NOT_WIRED: {
|
|
77
|
+
readonly message: "The declared tool registration is not wired to the detected OpenAI Agents SDK agent.";
|
|
78
|
+
readonly severity: "error";
|
|
79
|
+
};
|
|
80
|
+
readonly OPENAI_AGENTS_SDK_TOOL_REGISTRATION_SYMBOL_NOT_FOUND: {
|
|
81
|
+
readonly message: "The declared tool-registration symbol was not found.";
|
|
82
|
+
readonly severity: "error";
|
|
83
|
+
};
|
|
84
|
+
readonly OPENAI_AGENTS_SDK_VERSION_UNSUPPORTED: {
|
|
85
|
+
readonly message: "The observed OpenAI Agents SDK dependency range is disjoint from the supported range.";
|
|
86
|
+
readonly severity: "error";
|
|
87
|
+
};
|
|
88
|
+
readonly OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED: {
|
|
89
|
+
readonly message: "The declared runtime relationship could not be verified.";
|
|
90
|
+
readonly severity: "warning";
|
|
91
|
+
};
|
|
25
92
|
}>;
|
|
26
93
|
/**
|
|
27
94
|
* Creates one frozen, safely namespaced OpenAI Agents SDK adapter diagnostic.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diagnostics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,qCAAqC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diagnostics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwGhD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,GAC1C,OAAO,+BAA+B,KACrC,kBA4BF,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
1
2
|
import { posix } from "node:path";
|
|
2
3
|
import { intersects, subset, validRange } from "semver";
|
|
3
|
-
import ts from "typescript";
|
|
4
4
|
import { parseRepositoryPath } from "@moldea.ai/repository";
|
|
5
5
|
import { readRuntimeAdapterFile } from "@moldea.ai/core/adapter";
|
|
6
6
|
//#region src/constants/index.ts
|
|
@@ -59,204 +59,6 @@ var createInspectionSession = (options) => {
|
|
|
59
59
|
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
|
-
var decoder = new TextDecoder("utf-8", {
|
|
63
|
-
fatal: true,
|
|
64
|
-
ignoreBOM: true
|
|
65
|
-
});
|
|
66
|
-
var findLineIndex = (lineStarts, offset) => {
|
|
67
|
-
let lower = 0;
|
|
68
|
-
let upper = lineStarts.length - 1;
|
|
69
|
-
while (lower < upper) {
|
|
70
|
-
const middle = Math.ceil((lower + upper) / 2);
|
|
71
|
-
if ((lineStarts[middle] ?? 0) <= offset) lower = middle;
|
|
72
|
-
else upper = middle - 1;
|
|
73
|
-
}
|
|
74
|
-
return lower;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Creates a TypeScript UTF-16-offset to Unicode-scalar source locator.
|
|
78
|
-
* @param value The normalized valid Unicode-scalar text.
|
|
79
|
-
* @returns The scalar-aware source locator.
|
|
80
|
-
*/
|
|
81
|
-
var createSourceLocator = (value) => {
|
|
82
|
-
const scalarOffsets = new Uint32Array(value.length + 1);
|
|
83
|
-
const lineStarts = [0];
|
|
84
|
-
let scalarOffset = 0;
|
|
85
|
-
for (let codeUnitOffset = 0; codeUnitOffset < value.length;) {
|
|
86
|
-
const codePoint = value.codePointAt(codeUnitOffset);
|
|
87
|
-
const width = codePoint !== void 0 && codePoint > 65535 ? 2 : 1;
|
|
88
|
-
scalarOffsets[codeUnitOffset] = scalarOffset;
|
|
89
|
-
for (let interiorOffset = 1; interiorOffset < width; interiorOffset += 1) scalarOffsets[codeUnitOffset + interiorOffset] = scalarOffset;
|
|
90
|
-
codeUnitOffset += width;
|
|
91
|
-
scalarOffset += 1;
|
|
92
|
-
scalarOffsets[codeUnitOffset] = scalarOffset;
|
|
93
|
-
if (codePoint === 10) lineStarts.push(codeUnitOffset);
|
|
94
|
-
}
|
|
95
|
-
const locatePosition = (candidateOffset) => {
|
|
96
|
-
const codeUnitOffset = Math.max(0, Math.min(value.length, candidateOffset));
|
|
97
|
-
const lineIndex = findLineIndex(lineStarts, codeUnitOffset);
|
|
98
|
-
const lineStart = lineStarts[lineIndex] ?? 0;
|
|
99
|
-
const positionScalarOffset = scalarOffsets[codeUnitOffset] ?? 0;
|
|
100
|
-
return {
|
|
101
|
-
column: positionScalarOffset - (scalarOffsets[lineStart] ?? 0) + 1,
|
|
102
|
-
line: lineIndex + 1,
|
|
103
|
-
offset: positionScalarOffset
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
return Object.freeze({ locateRange: (startOffset, endOffset) => ({
|
|
107
|
-
end: locatePosition(endOffset),
|
|
108
|
-
start: locatePosition(startOffset)
|
|
109
|
-
}) });
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Decodes and normalizes source bytes through the runtime-adapter text contract.
|
|
113
|
-
* @param bytes The exact reader-owned source bytes.
|
|
114
|
-
* @returns The normalized text and locator or an invalid-text result.
|
|
115
|
-
*/
|
|
116
|
-
var normalizeText = (bytes) => {
|
|
117
|
-
let decoded;
|
|
118
|
-
try {
|
|
119
|
-
decoded = decoder.decode(bytes);
|
|
120
|
-
} catch {
|
|
121
|
-
return Object.freeze({ valid: false });
|
|
122
|
-
}
|
|
123
|
-
const value = (decoded.startsWith("") ? decoded.slice(1) : decoded).replace(/\r\n?/gu, "\n");
|
|
124
|
-
if (value.includes("\0")) return Object.freeze({ valid: false });
|
|
125
|
-
return Object.freeze({
|
|
126
|
-
locator: createSourceLocator(value),
|
|
127
|
-
valid: true,
|
|
128
|
-
value
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
var PACKAGE_DEPENDENCY_FIELDS = Object.freeze([
|
|
132
|
-
"dependencies",
|
|
133
|
-
"optionalDependencies",
|
|
134
|
-
"peerDependencies",
|
|
135
|
-
"devDependencies"
|
|
136
|
-
]);
|
|
137
|
-
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
138
|
-
/**
|
|
139
|
-
* Creates nearest-to-root package-manifest candidates for one source path.
|
|
140
|
-
* @param sourcePath The normalized source path.
|
|
141
|
-
* @returns Deterministically ordered manifest paths.
|
|
142
|
-
*/
|
|
143
|
-
var createPackageManifestCandidatePaths = (sourcePath) => {
|
|
144
|
-
const candidates = [];
|
|
145
|
-
let directory = posix.dirname(sourcePath);
|
|
146
|
-
while (true) {
|
|
147
|
-
candidates.push(posix.join(directory, "package.json"));
|
|
148
|
-
if (directory === "/") break;
|
|
149
|
-
directory = posix.dirname(directory);
|
|
150
|
-
}
|
|
151
|
-
return Object.freeze(candidates);
|
|
152
|
-
};
|
|
153
|
-
var extractPackageDeclarations = (manifest, packageName) => {
|
|
154
|
-
const declarations = [];
|
|
155
|
-
for (const field of PACKAGE_DEPENDENCY_FIELDS) {
|
|
156
|
-
const dependencies = manifest[field];
|
|
157
|
-
if (dependencies === void 0) continue;
|
|
158
|
-
if (!isRecord(dependencies)) return null;
|
|
159
|
-
const declaration = dependencies[packageName];
|
|
160
|
-
if (declaration === void 0) continue;
|
|
161
|
-
if (typeof declaration !== "string" || declaration.trim().length === 0) return null;
|
|
162
|
-
declarations.push(Object.freeze({
|
|
163
|
-
declaredRange: declaration,
|
|
164
|
-
dependencyKind: field
|
|
165
|
-
}));
|
|
166
|
-
}
|
|
167
|
-
return declarations;
|
|
168
|
-
};
|
|
169
|
-
var classifyPackageDeclarations = (declarations, supportedRange) => {
|
|
170
|
-
const classifications = declarations.map(({ declaredRange }) => {
|
|
171
|
-
const normalizedRange = validRange(declaredRange, {
|
|
172
|
-
loose: false,
|
|
173
|
-
includePrerelease: false
|
|
174
|
-
});
|
|
175
|
-
if (normalizedRange === null) return "ambiguous";
|
|
176
|
-
if (subset(normalizedRange, supportedRange, {
|
|
177
|
-
loose: false,
|
|
178
|
-
includePrerelease: false
|
|
179
|
-
})) return "supported";
|
|
180
|
-
if (!intersects(normalizedRange, supportedRange, {
|
|
181
|
-
loose: false,
|
|
182
|
-
includePrerelease: false
|
|
183
|
-
})) return "unsupported";
|
|
184
|
-
return "ambiguous";
|
|
185
|
-
});
|
|
186
|
-
if (classifications.every((classification) => classification === "supported")) return "supported";
|
|
187
|
-
if (classifications.every((classification) => classification === "unsupported")) return "unsupported";
|
|
188
|
-
return "ambiguous";
|
|
189
|
-
};
|
|
190
|
-
var readOwningManifest = async (options) => {
|
|
191
|
-
const { reader, signal, sourcePath } = options;
|
|
192
|
-
for (const manifestPath of createPackageManifestCandidatePaths(sourcePath)) {
|
|
193
|
-
signal?.throwIfAborted();
|
|
194
|
-
const entry = await reader.getEntry(manifestPath);
|
|
195
|
-
signal?.throwIfAborted();
|
|
196
|
-
if (entry === null) continue;
|
|
197
|
-
if (entry.type !== "file") return Object.freeze({
|
|
198
|
-
kind: "invalid",
|
|
199
|
-
path: manifestPath
|
|
200
|
-
});
|
|
201
|
-
const bytes = await reader.readFile(manifestPath);
|
|
202
|
-
signal?.throwIfAborted();
|
|
203
|
-
const text = normalizeText(bytes);
|
|
204
|
-
signal?.throwIfAborted();
|
|
205
|
-
if (!text.valid) return Object.freeze({
|
|
206
|
-
kind: "invalid",
|
|
207
|
-
path: manifestPath
|
|
208
|
-
});
|
|
209
|
-
let parsed;
|
|
210
|
-
try {
|
|
211
|
-
parsed = JSON.parse(text.value);
|
|
212
|
-
} catch {
|
|
213
|
-
return Object.freeze({
|
|
214
|
-
kind: "invalid",
|
|
215
|
-
path: manifestPath
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
signal?.throwIfAborted();
|
|
219
|
-
return isRecord(parsed) ? Object.freeze({
|
|
220
|
-
kind: "present",
|
|
221
|
-
manifest: parsed,
|
|
222
|
-
path: manifestPath
|
|
223
|
-
}) : Object.freeze({
|
|
224
|
-
kind: "invalid",
|
|
225
|
-
path: manifestPath
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
return Object.freeze({ kind: "absent" });
|
|
229
|
-
};
|
|
230
|
-
/**
|
|
231
|
-
* Discovers the nearest package declaration without repository enumeration.
|
|
232
|
-
* @param options The package target, repository callbacks, path, range, and signal.
|
|
233
|
-
* @returns The first observed declaration, invalid manifest, or absence result.
|
|
234
|
-
* @throws If repository reading or the active inspection is aborted.
|
|
235
|
-
*/
|
|
236
|
-
var discoverPackage = async (options) => {
|
|
237
|
-
const { includeManifestPackageName, packageName, reader, signal, sourcePath, supportedRange } = options;
|
|
238
|
-
const owningManifest = await readOwningManifest({
|
|
239
|
-
reader,
|
|
240
|
-
...signal === void 0 ? {} : { signal },
|
|
241
|
-
sourcePath
|
|
242
|
-
});
|
|
243
|
-
if (owningManifest.kind !== "present") return owningManifest;
|
|
244
|
-
const declarations = extractPackageDeclarations(owningManifest.manifest, packageName);
|
|
245
|
-
if (declarations === null) return Object.freeze({
|
|
246
|
-
kind: "invalid",
|
|
247
|
-
path: owningManifest.path
|
|
248
|
-
});
|
|
249
|
-
if (declarations.length === 0) return Object.freeze({ kind: "absent" });
|
|
250
|
-
return Object.freeze({
|
|
251
|
-
kind: "observed",
|
|
252
|
-
observation: Object.freeze({
|
|
253
|
-
compatibility: classifyPackageDeclarations(declarations, supportedRange),
|
|
254
|
-
declarations: Object.freeze(declarations),
|
|
255
|
-
...includeManifestPackageName === true ? { manifestPackageName: typeof owningManifest.manifest["name"] === "string" ? owningManifest.manifest["name"] : null } : {},
|
|
256
|
-
path: owningManifest.path
|
|
257
|
-
})
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
62
|
/**
|
|
261
63
|
* Removes the transparent expression wrappers supported by runtime adapters.
|
|
262
64
|
* @param expression The expression to normalize.
|
|
@@ -309,7 +111,7 @@ var indexImports = (sourceFile, config) => {
|
|
|
309
111
|
const importedName = element.propertyName?.text ?? element.name.text;
|
|
310
112
|
if (!element.isTypeOnly && supportedNamedImports.has(importedName)) constructorNames.add(element.name.text);
|
|
311
113
|
}
|
|
312
|
-
if (!moduleSpecifier.startsWith(".") || importClause?.namedBindings === void 0 || !ts.isNamedImports(importClause.namedBindings)) continue;
|
|
114
|
+
if (!moduleSpecifier.startsWith(".") && !config.namedHelperModuleSpecifiers?.includes(moduleSpecifier) || importClause?.namedBindings === void 0 || !ts.isNamedImports(importClause.namedBindings)) continue;
|
|
313
115
|
for (const element of importClause.namedBindings.elements) {
|
|
314
116
|
if (element.isTypeOnly) continue;
|
|
315
117
|
namedImports.set(element.name.text, Object.freeze({
|
|
@@ -720,6 +522,75 @@ var analyzeModuleValueMutations = (analysis, declaration, allowedReferences, saf
|
|
|
720
522
|
mutatedMembers: new Set(mutatedMembers)
|
|
721
523
|
});
|
|
722
524
|
};
|
|
525
|
+
var decoder = new TextDecoder("utf-8", {
|
|
526
|
+
fatal: true,
|
|
527
|
+
ignoreBOM: true
|
|
528
|
+
});
|
|
529
|
+
var findLineIndex = (lineStarts, offset) => {
|
|
530
|
+
let lower = 0;
|
|
531
|
+
let upper = lineStarts.length - 1;
|
|
532
|
+
while (lower < upper) {
|
|
533
|
+
const middle = Math.ceil((lower + upper) / 2);
|
|
534
|
+
if ((lineStarts[middle] ?? 0) <= offset) lower = middle;
|
|
535
|
+
else upper = middle - 1;
|
|
536
|
+
}
|
|
537
|
+
return lower;
|
|
538
|
+
};
|
|
539
|
+
/**
|
|
540
|
+
* Creates a TypeScript UTF-16-offset to Unicode-scalar source locator.
|
|
541
|
+
* @param value The normalized valid Unicode-scalar text.
|
|
542
|
+
* @returns The scalar-aware source locator.
|
|
543
|
+
*/
|
|
544
|
+
var createSourceLocator = (value) => {
|
|
545
|
+
const scalarOffsets = new Uint32Array(value.length + 1);
|
|
546
|
+
const lineStarts = [0];
|
|
547
|
+
let scalarOffset = 0;
|
|
548
|
+
for (let codeUnitOffset = 0; codeUnitOffset < value.length;) {
|
|
549
|
+
const codePoint = value.codePointAt(codeUnitOffset);
|
|
550
|
+
const width = codePoint !== void 0 && codePoint > 65535 ? 2 : 1;
|
|
551
|
+
scalarOffsets[codeUnitOffset] = scalarOffset;
|
|
552
|
+
for (let interiorOffset = 1; interiorOffset < width; interiorOffset += 1) scalarOffsets[codeUnitOffset + interiorOffset] = scalarOffset;
|
|
553
|
+
codeUnitOffset += width;
|
|
554
|
+
scalarOffset += 1;
|
|
555
|
+
scalarOffsets[codeUnitOffset] = scalarOffset;
|
|
556
|
+
if (codePoint === 10) lineStarts.push(codeUnitOffset);
|
|
557
|
+
}
|
|
558
|
+
const locatePosition = (candidateOffset) => {
|
|
559
|
+
const codeUnitOffset = Math.max(0, Math.min(value.length, candidateOffset));
|
|
560
|
+
const lineIndex = findLineIndex(lineStarts, codeUnitOffset);
|
|
561
|
+
const lineStart = lineStarts[lineIndex] ?? 0;
|
|
562
|
+
const positionScalarOffset = scalarOffsets[codeUnitOffset] ?? 0;
|
|
563
|
+
return {
|
|
564
|
+
column: positionScalarOffset - (scalarOffsets[lineStart] ?? 0) + 1,
|
|
565
|
+
line: lineIndex + 1,
|
|
566
|
+
offset: positionScalarOffset
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
return Object.freeze({ locateRange: (startOffset, endOffset) => ({
|
|
570
|
+
end: locatePosition(endOffset),
|
|
571
|
+
start: locatePosition(startOffset)
|
|
572
|
+
}) });
|
|
573
|
+
};
|
|
574
|
+
/**
|
|
575
|
+
* Decodes and normalizes source bytes through the runtime-adapter text contract.
|
|
576
|
+
* @param bytes The exact reader-owned source bytes.
|
|
577
|
+
* @returns The normalized text and locator or an invalid-text result.
|
|
578
|
+
*/
|
|
579
|
+
var normalizeText = (bytes) => {
|
|
580
|
+
let decoded;
|
|
581
|
+
try {
|
|
582
|
+
decoded = decoder.decode(bytes);
|
|
583
|
+
} catch {
|
|
584
|
+
return Object.freeze({ valid: false });
|
|
585
|
+
}
|
|
586
|
+
const value = (decoded.startsWith("") ? decoded.slice(1) : decoded).replace(/\r\n?/gu, "\n");
|
|
587
|
+
if (value.includes("\0")) return Object.freeze({ valid: false });
|
|
588
|
+
return Object.freeze({
|
|
589
|
+
locator: createSourceLocator(value),
|
|
590
|
+
valid: true,
|
|
591
|
+
value
|
|
592
|
+
});
|
|
593
|
+
};
|
|
723
594
|
var TYPESCRIPT_DECLARATION_EXTENSIONS = [
|
|
724
595
|
".d.ts",
|
|
725
596
|
".d.tsx",
|
|
@@ -930,6 +801,135 @@ var resolveStaticStringExpression = async (options, analysis, expression, visite
|
|
|
930
801
|
* @returns The exact compiler-parsed string or an unsupported state.
|
|
931
802
|
*/
|
|
932
803
|
var resolveStaticString = (options) => resolveStaticStringExpression(options, options.analysis, options.expression, /* @__PURE__ */ new Set());
|
|
804
|
+
var PACKAGE_DEPENDENCY_FIELDS = Object.freeze([
|
|
805
|
+
"dependencies",
|
|
806
|
+
"optionalDependencies",
|
|
807
|
+
"peerDependencies",
|
|
808
|
+
"devDependencies"
|
|
809
|
+
]);
|
|
810
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
811
|
+
/**
|
|
812
|
+
* Creates nearest-to-root package-manifest candidates for one source path.
|
|
813
|
+
* @param sourcePath The normalized source path.
|
|
814
|
+
* @returns Deterministically ordered manifest paths.
|
|
815
|
+
*/
|
|
816
|
+
var createPackageManifestCandidatePaths = (sourcePath) => {
|
|
817
|
+
const candidates = [];
|
|
818
|
+
let directory = posix.dirname(sourcePath);
|
|
819
|
+
while (true) {
|
|
820
|
+
candidates.push(posix.join(directory, "package.json"));
|
|
821
|
+
if (directory === "/") break;
|
|
822
|
+
directory = posix.dirname(directory);
|
|
823
|
+
}
|
|
824
|
+
return Object.freeze(candidates);
|
|
825
|
+
};
|
|
826
|
+
var extractPackageDeclarations = (manifest, packageName) => {
|
|
827
|
+
const declarations = [];
|
|
828
|
+
for (const field of PACKAGE_DEPENDENCY_FIELDS) {
|
|
829
|
+
const dependencies = manifest[field];
|
|
830
|
+
if (dependencies === void 0) continue;
|
|
831
|
+
if (!isRecord(dependencies)) return null;
|
|
832
|
+
const declaration = dependencies[packageName];
|
|
833
|
+
if (declaration === void 0) continue;
|
|
834
|
+
if (typeof declaration !== "string" || declaration.trim().length === 0) return null;
|
|
835
|
+
declarations.push(Object.freeze({
|
|
836
|
+
declaredRange: declaration,
|
|
837
|
+
dependencyKind: field
|
|
838
|
+
}));
|
|
839
|
+
}
|
|
840
|
+
return declarations;
|
|
841
|
+
};
|
|
842
|
+
var classifyPackageDeclarations = (declarations, supportedRange) => {
|
|
843
|
+
const classifications = declarations.map(({ declaredRange }) => {
|
|
844
|
+
const normalizedRange = validRange(declaredRange, {
|
|
845
|
+
loose: false,
|
|
846
|
+
includePrerelease: false
|
|
847
|
+
});
|
|
848
|
+
if (normalizedRange === null) return "ambiguous";
|
|
849
|
+
if (subset(normalizedRange, supportedRange, {
|
|
850
|
+
loose: false,
|
|
851
|
+
includePrerelease: false
|
|
852
|
+
})) return "supported";
|
|
853
|
+
if (!intersects(normalizedRange, supportedRange, {
|
|
854
|
+
loose: false,
|
|
855
|
+
includePrerelease: false
|
|
856
|
+
})) return "unsupported";
|
|
857
|
+
return "ambiguous";
|
|
858
|
+
});
|
|
859
|
+
if (classifications.every((classification) => classification === "supported")) return "supported";
|
|
860
|
+
if (classifications.every((classification) => classification === "unsupported")) return "unsupported";
|
|
861
|
+
return "ambiguous";
|
|
862
|
+
};
|
|
863
|
+
var readOwningManifest = async (options) => {
|
|
864
|
+
const { reader, signal, sourcePath } = options;
|
|
865
|
+
for (const manifestPath of createPackageManifestCandidatePaths(sourcePath)) {
|
|
866
|
+
signal?.throwIfAborted();
|
|
867
|
+
const entry = await reader.getEntry(manifestPath);
|
|
868
|
+
signal?.throwIfAborted();
|
|
869
|
+
if (entry === null) continue;
|
|
870
|
+
if (entry.type !== "file") return Object.freeze({
|
|
871
|
+
kind: "invalid",
|
|
872
|
+
path: manifestPath
|
|
873
|
+
});
|
|
874
|
+
const bytes = await reader.readFile(manifestPath);
|
|
875
|
+
signal?.throwIfAborted();
|
|
876
|
+
const text = normalizeText(bytes);
|
|
877
|
+
signal?.throwIfAborted();
|
|
878
|
+
if (!text.valid) return Object.freeze({
|
|
879
|
+
kind: "invalid",
|
|
880
|
+
path: manifestPath
|
|
881
|
+
});
|
|
882
|
+
let parsed;
|
|
883
|
+
try {
|
|
884
|
+
parsed = JSON.parse(text.value);
|
|
885
|
+
} catch {
|
|
886
|
+
return Object.freeze({
|
|
887
|
+
kind: "invalid",
|
|
888
|
+
path: manifestPath
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
signal?.throwIfAborted();
|
|
892
|
+
return isRecord(parsed) ? Object.freeze({
|
|
893
|
+
kind: "present",
|
|
894
|
+
manifest: parsed,
|
|
895
|
+
path: manifestPath
|
|
896
|
+
}) : Object.freeze({
|
|
897
|
+
kind: "invalid",
|
|
898
|
+
path: manifestPath
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
return Object.freeze({ kind: "absent" });
|
|
902
|
+
};
|
|
903
|
+
/**
|
|
904
|
+
* Discovers the nearest package declaration without repository enumeration.
|
|
905
|
+
* @param options The package target, repository callbacks, path, range, and signal.
|
|
906
|
+
* @returns The first observed declaration, invalid manifest, or absence result.
|
|
907
|
+
* @throws If repository reading or the active inspection is aborted.
|
|
908
|
+
*/
|
|
909
|
+
var discoverPackage = async (options) => {
|
|
910
|
+
const { includeManifestPackageName, packageName, reader, signal, sourcePath, supportedRange } = options;
|
|
911
|
+
const owningManifest = await readOwningManifest({
|
|
912
|
+
reader,
|
|
913
|
+
...signal === void 0 ? {} : { signal },
|
|
914
|
+
sourcePath
|
|
915
|
+
});
|
|
916
|
+
if (owningManifest.kind !== "present") return owningManifest;
|
|
917
|
+
const declarations = extractPackageDeclarations(owningManifest.manifest, packageName);
|
|
918
|
+
if (declarations === null) return Object.freeze({
|
|
919
|
+
kind: "invalid",
|
|
920
|
+
path: owningManifest.path
|
|
921
|
+
});
|
|
922
|
+
if (declarations.length === 0) return Object.freeze({ kind: "absent" });
|
|
923
|
+
return Object.freeze({
|
|
924
|
+
kind: "observed",
|
|
925
|
+
observation: Object.freeze({
|
|
926
|
+
compatibility: classifyPackageDeclarations(declarations, supportedRange),
|
|
927
|
+
declarations: Object.freeze(declarations),
|
|
928
|
+
...includeManifestPackageName === true ? { manifestPackageName: typeof owningManifest.manifest["name"] === "string" ? owningManifest.manifest["name"] : null } : {},
|
|
929
|
+
path: owningManifest.path
|
|
930
|
+
})
|
|
931
|
+
});
|
|
932
|
+
};
|
|
933
933
|
//#endregion
|
|
934
934
|
//#region src/source-analysis/mutations.ts
|
|
935
935
|
/**
|
|
@@ -1465,40 +1465,126 @@ var getOpenAiAgentsSdkToolElements = (relationship, analysis, allowedCollectionR
|
|
|
1465
1465
|
//#endregion
|
|
1466
1466
|
//#region src/diagnostics/index.ts
|
|
1467
1467
|
var OPENAI_AGENTS_SDK_ADAPTER_DIAGNOSTICS = Object.freeze({
|
|
1468
|
-
OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED:
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1468
|
+
OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_NOT_WIRED: {
|
|
1469
|
+
message: "The declared agent output schema is not wired to the detected OpenAI Agents SDK agent output type.",
|
|
1470
|
+
severity: "error"
|
|
1471
|
+
},
|
|
1472
|
+
OPENAI_AGENTS_SDK_AGENT_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND: {
|
|
1473
|
+
message: "The declared agent output-schema symbol was not found.",
|
|
1474
|
+
severity: "error"
|
|
1475
|
+
},
|
|
1476
|
+
OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING: {
|
|
1477
|
+
message: "The detected OpenAI Agents SDK handoff registration is missing its effective routing description.",
|
|
1478
|
+
severity: "error"
|
|
1479
|
+
},
|
|
1480
|
+
OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED: {
|
|
1481
|
+
message: "The detected OpenAI Agents SDK handoff registration does not use the target agent's effective routing description.",
|
|
1482
|
+
severity: "error"
|
|
1483
|
+
},
|
|
1484
|
+
OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS: {
|
|
1485
|
+
message: "The detected OpenAI Agents SDK handoff target matches more than one registered moldea agent.",
|
|
1486
|
+
severity: "error"
|
|
1487
|
+
},
|
|
1488
|
+
OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_NOT_WIRED: {
|
|
1489
|
+
message: "The declared instruction loader is not wired to the detected OpenAI Agents SDK agent.",
|
|
1490
|
+
severity: "error"
|
|
1491
|
+
},
|
|
1492
|
+
OPENAI_AGENTS_SDK_INSTRUCTION_LOADER_SYMBOL_NOT_FOUND: {
|
|
1493
|
+
message: "The declared instruction-loader symbol was not found.",
|
|
1494
|
+
severity: "error"
|
|
1495
|
+
},
|
|
1496
|
+
OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID: {
|
|
1497
|
+
message: "The owning package manifest is invalid for OpenAI Agents SDK dependency detection.",
|
|
1498
|
+
severity: "error"
|
|
1499
|
+
},
|
|
1500
|
+
OPENAI_AGENTS_SDK_RUNTIME_AGENT_SYMBOL_NOT_FOUND: {
|
|
1501
|
+
message: "The declared runtime-agent symbol was not found.",
|
|
1502
|
+
severity: "error"
|
|
1503
|
+
},
|
|
1504
|
+
OPENAI_AGENTS_SDK_SOURCE_SYNTAX_INVALID: {
|
|
1505
|
+
message: "The referenced OpenAI Agents SDK source file contains invalid TypeScript syntax.",
|
|
1506
|
+
severity: "error"
|
|
1507
|
+
},
|
|
1508
|
+
OPENAI_AGENTS_SDK_SOURCE_TEXT_INVALID: {
|
|
1509
|
+
message: "The referenced OpenAI Agents SDK source file is not valid normalized text.",
|
|
1510
|
+
severity: "error"
|
|
1511
|
+
},
|
|
1512
|
+
OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_NOT_WIRED: {
|
|
1513
|
+
message: "The declared tool implementation is not wired to the detected OpenAI Agents SDK function tool.",
|
|
1514
|
+
severity: "error"
|
|
1515
|
+
},
|
|
1516
|
+
OPENAI_AGENTS_SDK_TOOL_IMPLEMENTATION_SYMBOL_NOT_FOUND: {
|
|
1517
|
+
message: "The declared tool-implementation symbol was not found.",
|
|
1518
|
+
severity: "error"
|
|
1519
|
+
},
|
|
1520
|
+
OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_NOT_WIRED: {
|
|
1521
|
+
message: "The declared tool input schema is not wired to the detected OpenAI Agents SDK function tool.",
|
|
1522
|
+
severity: "error"
|
|
1523
|
+
},
|
|
1524
|
+
OPENAI_AGENTS_SDK_TOOL_INPUT_SCHEMA_SYMBOL_NOT_FOUND: {
|
|
1525
|
+
message: "The declared tool input-schema symbol was not found.",
|
|
1526
|
+
severity: "error"
|
|
1527
|
+
},
|
|
1528
|
+
OPENAI_AGENTS_SDK_TOOL_NAME_MISMATCH: {
|
|
1529
|
+
message: "The declared tool name does not match the detected OpenAI Agents SDK function-tool name.",
|
|
1530
|
+
severity: "error"
|
|
1531
|
+
},
|
|
1532
|
+
OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_NOT_WIRED: {
|
|
1533
|
+
message: "The declared tool output schema is not wired to the detected OpenAI Agents SDK function tool.",
|
|
1534
|
+
severity: "error"
|
|
1535
|
+
},
|
|
1536
|
+
OPENAI_AGENTS_SDK_TOOL_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND: {
|
|
1537
|
+
message: "The declared tool output-schema symbol was not found.",
|
|
1538
|
+
severity: "error"
|
|
1539
|
+
},
|
|
1540
|
+
OPENAI_AGENTS_SDK_TOOL_REGISTRATION_NOT_WIRED: {
|
|
1541
|
+
message: "The declared tool registration is not wired to the detected OpenAI Agents SDK agent.",
|
|
1542
|
+
severity: "error"
|
|
1543
|
+
},
|
|
1544
|
+
OPENAI_AGENTS_SDK_TOOL_REGISTRATION_SYMBOL_NOT_FOUND: {
|
|
1545
|
+
message: "The declared tool-registration symbol was not found.",
|
|
1546
|
+
severity: "error"
|
|
1547
|
+
},
|
|
1548
|
+
OPENAI_AGENTS_SDK_VERSION_UNSUPPORTED: {
|
|
1549
|
+
message: "The observed OpenAI Agents SDK dependency range is disjoint from the supported range.",
|
|
1550
|
+
severity: "error"
|
|
1551
|
+
},
|
|
1552
|
+
OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED: {
|
|
1553
|
+
message: "The declared runtime relationship could not be verified.",
|
|
1554
|
+
severity: "warning"
|
|
1555
|
+
}
|
|
1489
1556
|
});
|
|
1490
1557
|
/**
|
|
1491
1558
|
* Creates one frozen, safely namespaced OpenAI Agents SDK adapter diagnostic.
|
|
1492
1559
|
* @param input The complete code, location, entity, and safe scalar details.
|
|
1493
1560
|
* @returns The immutable adapter diagnostic.
|
|
1494
1561
|
*/
|
|
1495
|
-
var createOpenAiAgentsSdkDiagnostic = (input) =>
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1562
|
+
var createOpenAiAgentsSdkDiagnostic = (input) => {
|
|
1563
|
+
if (input.code === "OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED") {
|
|
1564
|
+
const definition = OPENAI_AGENTS_SDK_ADAPTER_DIAGNOSTICS[input.code];
|
|
1565
|
+
const details = Object.freeze({ ...input.details });
|
|
1566
|
+
const entity = input.entity === null ? null : Object.freeze({ ...input.entity });
|
|
1567
|
+
return Object.freeze({
|
|
1568
|
+
...input,
|
|
1569
|
+
details,
|
|
1570
|
+
entity,
|
|
1571
|
+
message: definition.message,
|
|
1572
|
+
severity: definition.severity,
|
|
1573
|
+
source: OPENAI_AGENTS_SDK_ADAPTER_ID
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
const definition = OPENAI_AGENTS_SDK_ADAPTER_DIAGNOSTICS[input.code];
|
|
1577
|
+
const details = Object.freeze({ ...input.details });
|
|
1578
|
+
const entity = input.entity === null ? null : Object.freeze({ ...input.entity });
|
|
1579
|
+
return Object.freeze({
|
|
1580
|
+
...input,
|
|
1581
|
+
details,
|
|
1582
|
+
entity,
|
|
1583
|
+
message: definition.message,
|
|
1584
|
+
severity: definition.severity,
|
|
1585
|
+
source: OPENAI_AGENTS_SDK_ADAPTER_ID
|
|
1586
|
+
});
|
|
1587
|
+
};
|
|
1502
1588
|
//#endregion
|
|
1503
1589
|
//#region src/inspection/common.ts
|
|
1504
1590
|
var LINE_BREAK_CODE_POINTS = /* @__PURE__ */ new Set([
|
|
@@ -1554,6 +1640,20 @@ var addOpenAiAgentsSdkDiagnostic = (diagnostics, code, path, agentId, range = nu
|
|
|
1554
1640
|
range
|
|
1555
1641
|
}));
|
|
1556
1642
|
};
|
|
1643
|
+
/** Reports one declared relationship obscured by a recognized source candidate. */
|
|
1644
|
+
var addOpenAiAgentsSdkUnverifiedRelationship = (diagnostics, relationship, path, range, agentId) => {
|
|
1645
|
+
diagnostics.push(createOpenAiAgentsSdkDiagnostic({
|
|
1646
|
+
code: "OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED",
|
|
1647
|
+
details: {
|
|
1648
|
+
reason: "dynamic-source-pattern",
|
|
1649
|
+
relationship
|
|
1650
|
+
},
|
|
1651
|
+
entity: createEntity(agentId),
|
|
1652
|
+
path,
|
|
1653
|
+
pointer: null,
|
|
1654
|
+
range
|
|
1655
|
+
}));
|
|
1656
|
+
};
|
|
1557
1657
|
/** Returns the Core scalar range for one node in its analyzed source. */
|
|
1558
1658
|
var locateOpenAiAgentsSdkNode = (analysis, node) => analysis.text.locator.locateRange(node.getStart(analysis.sourceFile), node.getEnd());
|
|
1559
1659
|
/**
|
|
@@ -1666,7 +1766,10 @@ var inspectOpenAiAgentsSdkHandoffs = async (context, session, agent, analysis, d
|
|
|
1666
1766
|
const runtimeName = await getRuntimeName(session, analysis, registration);
|
|
1667
1767
|
let routingDescriptionSource = "unresolved";
|
|
1668
1768
|
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)
|
|
1769
|
+
else if (mappedAgent !== void 0) {
|
|
1770
|
+
routingDescriptionSource = await inspectRoutingDescription(session, agent, analysis, registration, target, mappedAgent, diagnostics);
|
|
1771
|
+
if (routingDescriptionSource === "unresolved") addOpenAiAgentsSdkUnverifiedRelationship(diagnostics, "routing-description", analysis.path, locateOpenAiAgentsSdkNode(analysis, registration.target), mappedAgent.id);
|
|
1772
|
+
}
|
|
1670
1773
|
evidence.push(createOpenAiAgentsSdkEvidence({
|
|
1671
1774
|
agentId: agent.id,
|
|
1672
1775
|
capabilityId: null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
import type { IRuntimeAdapterEvidence, ISourceRange } from '@moldea.ai/core';
|
|
2
|
+
import type { IRuntimeAdapterEvidence, ISourceRange, IUnverifiedRelationship } from '@moldea.ai/core';
|
|
3
3
|
import type { IAdapterDiagnostic } from '@moldea.ai/core/adapter';
|
|
4
4
|
import type { IRepositoryReference } from '@moldea.ai/core/format';
|
|
5
5
|
import type { IRepositoryPath } from '@moldea.ai/repository';
|
|
@@ -20,7 +20,9 @@ export declare const createOpenAiAgentsSdkEvidence: (evidence: IRuntimeAdapterEv
|
|
|
20
20
|
* @param capabilityId The optional owning tool capability.
|
|
21
21
|
* @param details Safe scalar diagnostic details.
|
|
22
22
|
*/
|
|
23
|
-
export declare const addOpenAiAgentsSdkDiagnostic: (diagnostics: IAdapterDiagnostic[], code: IOpenAiAgentsSdkAdapterDiagnosticCode, path: IRepositoryPath | null, agentId: string, range?: ISourceRange | null, capabilityId?: string, details?: IAdapterDiagnostic["details"]) => void;
|
|
23
|
+
export declare const addOpenAiAgentsSdkDiagnostic: (diagnostics: IAdapterDiagnostic[], code: Exclude<IOpenAiAgentsSdkAdapterDiagnosticCode, "OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED">, path: IRepositoryPath | null, agentId: string, range?: ISourceRange | null, capabilityId?: string, details?: IAdapterDiagnostic["details"]) => void;
|
|
24
|
+
/** Reports one declared relationship obscured by a recognized source candidate. */
|
|
25
|
+
export declare const addOpenAiAgentsSdkUnverifiedRelationship: (diagnostics: IAdapterDiagnostic[], relationship: IUnverifiedRelationship, path: IRepositoryPath, range: ISourceRange, agentId: string) => void;
|
|
24
26
|
/** Returns the Core scalar range for one node in its analyzed source. */
|
|
25
27
|
export declare const locateOpenAiAgentsSdkNode: (analysis: IOpenAiAgentsSdkSourceAnalysis, node: ts.Node) => ISourceRange;
|
|
26
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/inspection/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/inspection/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,KAAK,EACV,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EACV,qCAAqC,EACrC,iCAAiC,EACjC,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAiB/B,gEAAgE;AAChE,eAAO,MAAM,6BAA6B,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAClC,CAAC;AAE3C,2FAA2F;AAC3F,eAAO,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
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;AAkP/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,CAyFd,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Binding example
|
|
3
|
+
description: Complete manifest and source files for inspecting openai-agents-sdk bindings locally.
|
|
4
|
+
order: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Binding example
|
|
8
|
+
|
|
9
|
+
Read this example before searching adapter implementation for binding syntax. It is a complete **static inspection** file set, not a deployment starter or a live provider test. The files are checked together through this adapter and Core without installing or executing the target SDK. Keep application setup, credentials, provider model access, tool execution, and deployment configuration separate.
|
|
10
|
+
|
|
11
|
+
## How the bindings connect
|
|
12
|
+
|
|
13
|
+
Bind each exported `Agent` instance. `instructions` calls its canonical loader and `outputType` names the agent output schema. Tool implementation, registration, input, and output are separate bindings. A handoff links the registered target agent; its static routing description must match that target's `handoff-description.md`. Do not put a handoff into the manifest's ordinary `tools` map.
|
|
14
|
+
|
|
15
|
+
Paths below are repository-root-relative logical paths. Keep the canonical instructions as the policy source. General manifest semantics belong to the [Repository Format specification](https://packages.moldea.ai/repository-format/). Use the other local guides for the full supported boundary and limitations; this example does not expand them.
|
|
16
|
+
|
|
17
|
+
## Files
|
|
18
|
+
|
|
19
|
+
<!-- example:start -->
|
|
20
|
+
|
|
21
|
+
### /moldea/moldea.yaml
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
version: 1
|
|
25
|
+
agents:
|
|
26
|
+
billing:
|
|
27
|
+
runtime:
|
|
28
|
+
id: 'openai-agents-sdk'
|
|
29
|
+
bindings:
|
|
30
|
+
runtimeAgent:
|
|
31
|
+
path: '/src/agents.ts'
|
|
32
|
+
symbol: 'billingAgent'
|
|
33
|
+
instructionLoader:
|
|
34
|
+
path: '/src/instructions.ts'
|
|
35
|
+
symbol: 'loadBillingInstruction'
|
|
36
|
+
triage:
|
|
37
|
+
runtime:
|
|
38
|
+
id: 'openai-agents-sdk'
|
|
39
|
+
bindings:
|
|
40
|
+
runtimeAgent:
|
|
41
|
+
path: '/src/agents.ts'
|
|
42
|
+
symbol: 'triageAgent'
|
|
43
|
+
instructionLoader:
|
|
44
|
+
path: '/src/instructions.ts'
|
|
45
|
+
symbol: 'loadTriageInstruction'
|
|
46
|
+
outputSchema:
|
|
47
|
+
path: '/src/contracts.ts'
|
|
48
|
+
symbol: 'TriageOutputSchema'
|
|
49
|
+
tools:
|
|
50
|
+
find-order:
|
|
51
|
+
name: 'find_order'
|
|
52
|
+
description: 'Retrieves one order by its identifier.'
|
|
53
|
+
implementation:
|
|
54
|
+
path: '/src/find-order.ts'
|
|
55
|
+
symbol: 'findOrder'
|
|
56
|
+
registration:
|
|
57
|
+
path: '/src/tools.ts'
|
|
58
|
+
symbol: 'findOrderTool'
|
|
59
|
+
inputSchema:
|
|
60
|
+
path: '/src/contracts.ts'
|
|
61
|
+
symbol: 'FindOrderInputSchema'
|
|
62
|
+
outputSchema:
|
|
63
|
+
path: '/src/contracts.ts'
|
|
64
|
+
symbol: 'FindOrderOutputSchema'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### /moldea/project.md
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# OpenAI Agents SDK adapter fixture
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### /moldea/agents/billing/description.md
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
Handles customer billing requests.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### /moldea/agents/billing/handoff-description.md
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
Route billing questions and payment issues here.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### /moldea/agents/billing/instruction.md
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
You are the `billing` agent.
|
|
89
|
+
|
|
90
|
+
Resolve billing requests from the supplied facts. Ask when essential details are missing.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### /moldea/agents/triage/description.md
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
Routes customer support requests.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### /moldea/agents/triage/instruction.md
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
You are the `triage` agent.
|
|
103
|
+
|
|
104
|
+
Route billing requests to billing. Do not invent account facts.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### /package.json
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"dependencies": {
|
|
112
|
+
"@openai/agents": "^0.16.1",
|
|
113
|
+
"zod": "4.6.4"
|
|
114
|
+
},
|
|
115
|
+
"name": "binding-example",
|
|
116
|
+
"private": true,
|
|
117
|
+
"type": "module"
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### /src/agents.ts
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { Agent, handoff } from '@openai/agents';
|
|
125
|
+
|
|
126
|
+
import { TriageOutputSchema } from './contracts.js';
|
|
127
|
+
import { loadTriageInstruction, loadBillingInstruction } from './instructions.js';
|
|
128
|
+
import { billingRoutingDescription } from './metadata.js';
|
|
129
|
+
import { findOrderTool } from './tools.js';
|
|
130
|
+
|
|
131
|
+
export const billingAgent = new Agent({
|
|
132
|
+
name: 'billing',
|
|
133
|
+
instructions: loadBillingInstruction(),
|
|
134
|
+
handoffDescription: billingRoutingDescription,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const configuredBillingHandoff = handoff(billingAgent, {
|
|
138
|
+
toolNameOverride: 'route_billing',
|
|
139
|
+
toolDescriptionOverride: billingRoutingDescription,
|
|
140
|
+
});
|
|
141
|
+
const triageTools = [findOrderTool];
|
|
142
|
+
const triageHandoffs = [billingAgent, configuredBillingHandoff];
|
|
143
|
+
|
|
144
|
+
export const triageAgent = Agent.create({
|
|
145
|
+
name: 'triage',
|
|
146
|
+
instructions: loadTriageInstruction(),
|
|
147
|
+
outputType: TriageOutputSchema,
|
|
148
|
+
tools: triageTools,
|
|
149
|
+
handoffs: triageHandoffs,
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### /src/contracts.ts
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { z } from 'zod';
|
|
157
|
+
|
|
158
|
+
// response and tool contracts
|
|
159
|
+
export const TriageOutputSchema = z.object({ summary: z.string() });
|
|
160
|
+
export const FindOrderInputSchema = z.object({ orderId: z.string() });
|
|
161
|
+
export const FindOrderOutputSchema = z.object({
|
|
162
|
+
orderId: z.string(),
|
|
163
|
+
status: z.enum(['shipped', 'not_found']),
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### /src/find-order.ts
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
/** Looks up an order in the example's fixed catalog. */
|
|
171
|
+
export const findOrder = async ({ orderId }: { orderId: string }) => ({
|
|
172
|
+
orderId,
|
|
173
|
+
status: orderId === 'order-1042' ? ('shipped' as const) : ('not_found' as const),
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### /src/instructions.ts
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { readFileSync } from 'node:fs';
|
|
181
|
+
|
|
182
|
+
/** Reads the canonical triage instruction. */
|
|
183
|
+
export const loadTriageInstruction = (): string =>
|
|
184
|
+
readFileSync(new URL('../moldea/agents/triage/instruction.md', import.meta.url), 'utf8');
|
|
185
|
+
|
|
186
|
+
/** Reads the canonical billing instruction. */
|
|
187
|
+
export const loadBillingInstruction = (): string =>
|
|
188
|
+
readFileSync(new URL('../moldea/agents/billing/instruction.md', import.meta.url), 'utf8');
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### /src/metadata.ts
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
export const billingRoutingDescription = 'Route billing questions and payment issues here.';
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### /src/tools.ts
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { tool } from '@openai/agents';
|
|
201
|
+
|
|
202
|
+
import { FindOrderInputSchema, FindOrderOutputSchema } from './contracts.js';
|
|
203
|
+
import { findOrder } from './find-order.js';
|
|
204
|
+
|
|
205
|
+
export const findOrderTool = tool({
|
|
206
|
+
name: 'find_order',
|
|
207
|
+
description: 'Retrieves one order by its identifier.',
|
|
208
|
+
parameters: FindOrderInputSchema,
|
|
209
|
+
outputSchema: FindOrderOutputSchema,
|
|
210
|
+
execute: findOrder,
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
<!-- example:end -->
|
|
215
|
+
|
|
216
|
+
## What the check establishes
|
|
217
|
+
|
|
218
|
+
The integration check reads these exact file blocks, requires positive adapter evidence for the documented relationships, and rejects a broken runtime binding. It does not prove that instructions are followed, that every SDK version accepts these forms, or that the application is ready for production. Continue using the installed adapter diagnostics for your actual source.
|
|
@@ -41,9 +41,12 @@ Evidence contains no repository content, instructions, descriptions, credentials
|
|
|
41
41
|
| `OPENAI_AGENTS_SDK_HANDOFF_TARGET_AMBIGUOUS` | A target runtime binding maps to multiple registered agents. |
|
|
42
42
|
| `OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_MISSING` | A proved handoff registration has no effective canonical routing description. |
|
|
43
43
|
| `OPENAI_AGENTS_SDK_HANDOFF_ROUTING_DESCRIPTION_NOT_WIRED` | A proved handoff uses routing text that differs from its target's effective description. |
|
|
44
|
+
| `OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED` | The declared runtime relationship could not be verified. |
|
|
44
45
|
|
|
45
46
|
Diagnostics use Core's shared adapter shape, preserve logical source locations, and remain deterministically ordered. Dynamic or indirect patterns yield partial or no evidence rather than guessed failures. Core validates adapter output and applies all-or-nothing inspection semantics.
|
|
46
47
|
|
|
47
48
|
## Package detection
|
|
48
49
|
|
|
49
50
|
Detection stops at the nearest existing `package.json` owning each runtime-agent source. Supported dependency fields are considered collectively. A collectively disjoint range produces the unsupported-version diagnostic without package evidence; an ambiguous range remains evidence rather than being promoted to verified support. Invalid UTF-8 or NUL in the owning manifest produces only `OPENAI_AGENTS_SDK_PACKAGE_MANIFEST_INVALID`; source text failures remain source diagnostics.
|
|
51
|
+
|
|
52
|
+
`OPENAI_AGENTS_SDK_RUNTIME_RELATIONSHIP_UNVERIFIED` has severity `warning` only when the adapter identifies a declared relationship affected by a recognized but unresolved source candidate. Its safe details identify the relationship and reason; known version-behavior boundaries additionally carry normalized dependency context. Missing local evidence or a newer eligible dependency version alone does not produce this warning. Confirmed diagnostic codes remain errors.
|
package/docs/index.md
CHANGED
|
@@ -27,3 +27,5 @@ The adapter never imports or calls the SDK, requires no API key, executes no rep
|
|
|
27
27
|
## Public surface
|
|
28
28
|
|
|
29
29
|
The package exports only `openAiAgentsSdkAdapter`. It has no default export, configuration factory, SDK facade, parser export, public diagnostic registry, or mutable runtime state. The generated [API reference](https://packages.moldea.ai/adapters/openai-agents-sdk/api/) derives that surface from the package export.
|
|
30
|
+
|
|
31
|
+
Start with the [complete binding example](https://packages.moldea.ai/adapters/openai-agents-sdk/binding-example/) when connecting runtime source to canonical instructions, schemas, tools, or routing metadata. The same example ships locally as `docs/binding-example.md` in the installed package.
|
package/docs/limitations.md
CHANGED
|
@@ -20,6 +20,8 @@ The current verified target does not claim support for:
|
|
|
20
20
|
|
|
21
21
|
Package detection uses nearest manifests, not lockfiles or installed `node_modules`. Static dependency ranges are observations; the adapter does not prove which package build executes at runtime.
|
|
22
22
|
|
|
23
|
+
A dynamic handoff routing description for a registered target produces a scoped warning. The registration remains observable, but the adapter does not claim that its routing description matches the canonical target description.
|
|
24
|
+
|
|
23
25
|
Each invocation sees one declared agent, exact same-runtime binding resolution, and only the bounded operations Core supplies through `IRuntimeAdapterRepository`. It receives no complete agent collection, project body index, host path, OpenAI credential, environment variable, network client, or runtime process. It does not execute TypeScript, dynamically import source, load the inspected SDK, or follow source symlinks. These constraints preserve deterministic, source-grounded behavior while deliberately leaving dynamic runtime semantics unresolved.
|
|
24
26
|
|
|
25
27
|
The [Runtime Compatibility Matrix](https://packages.moldea.ai/compatibility/) remains authoritative. A focused specification or future design does not broaden this page until the canonical matrix and released implementation do.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moldea.ai/adapter-openai-agents-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.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": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"node": ">=22.11.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@moldea.ai/core": "^
|
|
37
|
+
"@moldea.ai/core": "^5.0.0",
|
|
38
38
|
"@moldea.ai/repository": "^2.0.0",
|
|
39
39
|
"semver": "7.8.5",
|
|
40
40
|
"typescript": "6.0.3"
|