Skip to content

refactor(core): inline gateway model factory into AgentSessionDO#8

Merged
mikea merged 2 commits into
masterfrom
codex/inline-gateway.ts-function
Mar 29, 2026
Merged

refactor(core): inline gateway model factory into AgentSessionDO#8
mikea merged 2 commits into
masterfrom
codex/inline-gateway.ts-function

Conversation

@mikea
Copy link
Copy Markdown
Owner

@mikea mikea commented Mar 29, 2026

Motivation

  • Reduce indirection by placing the AI Gateway model construction next to the DO that uses it and keep the spec and implementation in sync.
  • Make the AgentSessionDO initialization and model-switch paths self-contained so tests can reliably override the model via _setModelForTest() inside the Durable Object.

Description

  • Added an internal createModel(env, modelId) helper and ai-gateway-provider imports directly in packages/core/src/agent-session-do.ts and used it for initialization and model-switching.
  • Removed the now-redundant packages/core/src/gateway.ts file.
  • Updated packages/core/test/do/mock-model.ts comments to reference the inlined helper location.
  • Updated specs/core.md and specs/implementation_plan.md to point at the new createModel() location so spec and code remain aligned.

Testing

  • Ran TypeScript type-check via pnpm -r exec tsc --noEmit, which completed successfully.

Codex Task

@mikea mikea merged commit 7175543 into master Mar 29, 2026
1 check passed
@mikea mikea deleted the codex/inline-gateway.ts-function branch March 29, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant