Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tired-experts-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openai/agents-core': patch
---

Publishes types that were marked as internal but caused build errors when not exported in typings.
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The OpenAI Agents JS repository is a pnpm-managed monorepo that provides:
- `pnpm-workspace.yaml`: Defines workspace packages.
- `tsconfig.json`, `tsc-multi.json`: TypeScript configuration.
- `vitest.config.ts`: Test runner configuration.
- `eslint.config.js`: ESLint configuration.
- `eslint.config.mjs`: ESLint configuration.
- `package.json` (root): Common scripts (`build`, `test`, `lint`, `dev`, `docs:dev`, `examples:*`).

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

### Type Checking
Expand Down Expand Up @@ -128,7 +128,7 @@ Before submitting changes, ensure all checks pass:

## Style, Linting & Type Checking

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

Expand Down
File renamed without changes.
34 changes: 9 additions & 25 deletions packages/agents-core/src/guardrail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RunContext } from './runContext';
import { ResolvedAgentOutput, TextOutput, UnknownContext } from './types';

/**
* Internal definition of input/output guardrails; SDK users usually do not need to create this.
* Definition of input/output guardrails; SDK users usually do not need to create this.
*/
export type GuardrailDefinition =
| InputGuardrailDefinition
Expand Down Expand Up @@ -91,39 +91,32 @@ export type InputGuardrailFunction = (
args: InputGuardrailFunctionArgs,
) => Promise<GuardrailFunctionOutput>;

// internal definition

/**
* Internal metadata for an input guardrail.
* @internal
* Metadata for an input guardrail.
*/
export interface InputGuardrailMetadata {
type: 'input';
name: string;
}

/**
* Internal definition of an input guardrail. SDK users usually do not need to create this.
*
* @internal
* Definition of an input guardrail. SDK users usually do not need to create this.
*/
export interface InputGuardrailDefinition extends InputGuardrailMetadata {
guardrailFunction: InputGuardrailFunction;
run(args: InputGuardrailFunctionArgs): Promise<InputGuardrailResult>;
}

/**
* Arguments for defining an internal input guardrail definition.
* SDK users usually do not need to use this.
* Arguments for defining an input guardrail definition.
*/
export interface DefineInputGuardrailArgs {
name: string;
execute: InputGuardrailFunction;
}

/**
* Defines an internal input guardrail definition.
* SDK users usually do not need to use this.
* Defines an input guardrail definition.
*/
export function defineInputGuardrail({
name,
Expand Down Expand Up @@ -210,21 +203,16 @@ export interface OutputGuardrail<TOutput extends AgentOutputType = TextOutput> {
execute: OutputGuardrailFunction<TOutput>;
}

// internal definition

/**
* Internal metadata for an output guardrail.
* @internal
* Metadata for an output guardrail.
*/
export interface OutputGuardrailMetadata {
type: 'output';
name: string;
}

/**
* Internal definition of an output guardrail.
* SDK users usually do not need to use this.
* @internal
* Definition of an output guardrail.
*/
export interface OutputGuardrailDefinition<
TMeta = OutputGuardrailMetadata,
Expand All @@ -237,9 +225,7 @@ export interface OutputGuardrailDefinition<
}

/**
* Arguments for defining an internal output guardrail definition.
* SDK users usually do not need to use this.
* @internal
* Arguments for defining an output guardrail definition.
*/
export interface DefineOutputGuardrailArgs<
TOutput extends AgentOutputType = TextOutput,
Expand All @@ -249,9 +235,7 @@ export interface DefineOutputGuardrailArgs<
}

/**
* Creates an internal output guardrail definition.
* SDK users usually do not need to use this.
* @internal
* Creates an output guardrail definition.
*/
export function defineOutputGuardrail<
TOutput extends AgentOutputType = TextOutput,
Expand Down