From 2f650c7cf872ef93fc35783a208c2aad83984ced Mon Sep 17 00:00:00 2001 From: Maksymilian Majer <1215868+maksymilian-majer@users.noreply.github.com> Date: Tue, 10 Jun 2025 16:26:30 +0200 Subject: [PATCH 1/3] 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 --- packages/agents-core/src/guardrail.ts | 34 +++++++-------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/packages/agents-core/src/guardrail.ts b/packages/agents-core/src/guardrail.ts index 1e5c20f0..30d3bd3e 100644 --- a/packages/agents-core/src/guardrail.ts +++ b/packages/agents-core/src/guardrail.ts @@ -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 @@ -91,11 +91,8 @@ export type InputGuardrailFunction = ( args: InputGuardrailFunctionArgs, ) => Promise; -// internal definition - /** - * Internal metadata for an input guardrail. - * @internal + * Metadata for an input guardrail. */ export interface InputGuardrailMetadata { type: 'input'; @@ -103,9 +100,7 @@ export interface InputGuardrailMetadata { } /** - * 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; @@ -113,8 +108,7 @@ export interface InputGuardrailDefinition extends InputGuardrailMetadata { } /** - * 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; @@ -122,8 +116,7 @@ export interface DefineInputGuardrailArgs { } /** - * Defines an internal input guardrail definition. - * SDK users usually do not need to use this. + * Defines an input guardrail definition. */ export function defineInputGuardrail({ name, @@ -210,11 +203,8 @@ export interface OutputGuardrail { execute: OutputGuardrailFunction; } -// internal definition - /** - * Internal metadata for an output guardrail. - * @internal + * Metadata for an output guardrail. */ export interface OutputGuardrailMetadata { type: 'output'; @@ -222,9 +212,7 @@ export interface OutputGuardrailMetadata { } /** - * 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, @@ -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, @@ -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, From 68b44be9e612cccd34b48797b8389ad9c89765ee Mon Sep 17 00:00:00 2001 From: Maksymilian Majer <1215868+maksymilian-majer@users.noreply.github.com> Date: Wed, 11 Jun 2025 14:36:16 +0200 Subject: [PATCH 2/3] fix: SyntaxError in eslint.config.js --- AGENTS.md | 6 +++--- eslint.config.js => eslint.config.mjs | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename eslint.config.js => eslint.config.mjs (100%) diff --git a/AGENTS.md b/AGENTS.md index 346a39c7..64d8c308 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 @@ -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 @@ -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. diff --git a/eslint.config.js b/eslint.config.mjs similarity index 100% rename from eslint.config.js rename to eslint.config.mjs From a2330e9c9fbe57911b21aef29039ba02e2fe34db Mon Sep 17 00:00:00 2001 From: Maksymilian Majer <1215868+maksymilian-majer@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:43:11 +0200 Subject: [PATCH 3/3] chore: add changeset --- .changeset/tired-experts-care.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tired-experts-care.md diff --git a/.changeset/tired-experts-care.md b/.changeset/tired-experts-care.md new file mode 100644 index 00000000..e8c69066 --- /dev/null +++ b/.changeset/tired-experts-care.md @@ -0,0 +1,5 @@ +--- +'@openai/agents-core': patch +--- + +Publishes types that were marked as internal but caused build errors when not exported in typings.