Skip to content

Commit 1fccdca

Browse files
Fix typing errors and linting (#83)
* fix(types): expose guardrail types by removing @internal tags - Remove @internal tags from InputGuardrailDefinition, OutputGuardrailDefinition, InputGuardrailMetadata, OutputGuardrailMetadata, DefineOutputGuardrailArgs, and defineOutputGuardrail - Update JSDoc comments to be more appropriate for public APIs * fix: SyntaxError in eslint.config.js * chore: add changeset
1 parent 0580b9b commit 1fccdca

File tree

4 files changed

+17
-28
lines changed

4 files changed

+17
-28
lines changed

.changeset/tired-experts-care.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openai/agents-core': patch
3+
---
4+
5+
Publishes types that were marked as internal but caused build errors when not exported in typings.

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The OpenAI Agents JS repository is a pnpm-managed monorepo that provides:
4343
- `pnpm-workspace.yaml`: Defines workspace packages.
4444
- `tsconfig.json`, `tsc-multi.json`: TypeScript configuration.
4545
- `vitest.config.ts`: Test runner configuration.
46-
- `eslint.config.js`: ESLint configuration.
46+
- `eslint.config.mjs`: ESLint configuration.
4747
- `package.json` (root): Common scripts (`build`, `test`, `lint`, `dev`, `docs:dev`, `examples:*`).
4848

4949
## Testing & Automated Checks
@@ -81,7 +81,7 @@ Before submitting changes, ensure all checks pass:
8181
```bash
8282
pnpm lint
8383
```
84-
- Code style follows `eslint.config.js` and Prettier defaults.
84+
- Code style follows `eslint.config.mjs` and Prettier defaults.
8585
- Comments must end with a period.
8686

8787
### Type Checking
@@ -128,7 +128,7 @@ Before submitting changes, ensure all checks pass:
128128

129129
## Style, Linting & Type Checking
130130

131-
- Follow ESLint rules (`eslint.config.js`), no unused imports, adhere to Prettier.
131+
- Follow ESLint rules (`eslint.config.mjs`), no unused imports, adhere to Prettier.
132132
- Run `pnpm lint` and fix all errors locally.
133133
- Use `pnpm build` to catch type errors.
134134

File renamed without changes.

packages/agents-core/src/guardrail.ts

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RunContext } from './runContext';
44
import { ResolvedAgentOutput, TextOutput, UnknownContext } from './types';
55

66
/**
7-
* Internal definition of input/output guardrails; SDK users usually do not need to create this.
7+
* Definition of input/output guardrails; SDK users usually do not need to create this.
88
*/
99
export type GuardrailDefinition =
1010
| InputGuardrailDefinition
@@ -91,39 +91,32 @@ export type InputGuardrailFunction = (
9191
args: InputGuardrailFunctionArgs,
9292
) => Promise<GuardrailFunctionOutput>;
9393

94-
// internal definition
95-
9694
/**
97-
* Internal metadata for an input guardrail.
98-
* @internal
95+
* Metadata for an input guardrail.
9996
*/
10097
export interface InputGuardrailMetadata {
10198
type: 'input';
10299
name: string;
103100
}
104101

105102
/**
106-
* Internal definition of an input guardrail. SDK users usually do not need to create this.
107-
*
108-
* @internal
103+
* Definition of an input guardrail. SDK users usually do not need to create this.
109104
*/
110105
export interface InputGuardrailDefinition extends InputGuardrailMetadata {
111106
guardrailFunction: InputGuardrailFunction;
112107
run(args: InputGuardrailFunctionArgs): Promise<InputGuardrailResult>;
113108
}
114109

115110
/**
116-
* Arguments for defining an internal input guardrail definition.
117-
* SDK users usually do not need to use this.
111+
* Arguments for defining an input guardrail definition.
118112
*/
119113
export interface DefineInputGuardrailArgs {
120114
name: string;
121115
execute: InputGuardrailFunction;
122116
}
123117

124118
/**
125-
* Defines an internal input guardrail definition.
126-
* SDK users usually do not need to use this.
119+
* Defines an input guardrail definition.
127120
*/
128121
export function defineInputGuardrail({
129122
name,
@@ -210,21 +203,16 @@ export interface OutputGuardrail<TOutput extends AgentOutputType = TextOutput> {
210203
execute: OutputGuardrailFunction<TOutput>;
211204
}
212205

213-
// internal definition
214-
215206
/**
216-
* Internal metadata for an output guardrail.
217-
* @internal
207+
* Metadata for an output guardrail.
218208
*/
219209
export interface OutputGuardrailMetadata {
220210
type: 'output';
221211
name: string;
222212
}
223213

224214
/**
225-
* Internal definition of an output guardrail.
226-
* SDK users usually do not need to use this.
227-
* @internal
215+
* Definition of an output guardrail.
228216
*/
229217
export interface OutputGuardrailDefinition<
230218
TMeta = OutputGuardrailMetadata,
@@ -237,9 +225,7 @@ export interface OutputGuardrailDefinition<
237225
}
238226

239227
/**
240-
* Arguments for defining an internal output guardrail definition.
241-
* SDK users usually do not need to use this.
242-
* @internal
228+
* Arguments for defining an output guardrail definition.
243229
*/
244230
export interface DefineOutputGuardrailArgs<
245231
TOutput extends AgentOutputType = TextOutput,
@@ -249,9 +235,7 @@ export interface DefineOutputGuardrailArgs<
249235
}
250236

251237
/**
252-
* Creates an internal output guardrail definition.
253-
* SDK users usually do not need to use this.
254-
* @internal
238+
* Creates an output guardrail definition.
255239
*/
256240
export function defineOutputGuardrail<
257241
TOutput extends AgentOutputType = TextOutput,

0 commit comments

Comments
 (0)