Skip to content

feat: enforce strict FormatID typing and remove deprecated fields - #44

Merged
bokelley merged 4 commits into
mainfrom
bokelley/strict-format-id-types
Oct 15, 2025
Merged

feat: enforce strict FormatID typing and remove deprecated fields#44
bokelley merged 4 commits into
mainfrom
bokelley/strict-format-id-types

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

This PR enforces strict FormatID typing throughout the codebase and removes support for deprecated fields per AdCP spec v2.0.0.

Breaking Changes

🔒 Strict FormatID Typing

All format ID fields now use the structured FormatID type with agent_url and id properties. No more plain string format IDs.

Before:

format_id: "banner_300x250"

After:

format_id: {
  agent_url: "https://creatives.adcontextprotocol.org",
  id: "banner_300x250"
}

Affected fields:

  • format_id
  • format_ids
  • output_format_ids
  • formats_to_provide
  • format_ids_to_provide

🗑️ Deprecated Field Removal

Per AdCP PR #126:

Deprecated Field Replacement Status
promoted_offering brand_manifest ✅ Migrated
products[] (in packages) product_id ✅ Not used
video_completions completed_views ✅ Not used

Changes Made

Type System

  • ✅ Import structured FormatID from generated types
  • ✅ Update CreativeFormat to use FormatID
  • ✅ Update CreativeFilters to use FormatID | FormatID[]
  • ✅ Convert hardcoded format IDs to structured objects
  • ✅ Remove stale /src/types/adcp.ts file
  • ✅ Export FormatID from main types index

API & Server

  • ✅ Replace promoted_offering with brand_manifest in all endpoints
  • ✅ Update buildToolArgs() to send brand_manifest
  • ✅ Update API request/response types
  • ✅ Fix import paths after removing stale types

UI

  • ✅ Update HTML to use brand_manifest instead of promoted_offering
  • ✅ Rename JavaScript variables: promotedOfferingbrandManifest

Generated Types

  • ✅ Synced with AdCP spec v2.0.0
  • ✅ Clean type generation (no post-processing hacks needed)
  • ✅ All format IDs properly typed as FormatID

Verification

✅ Type Safety

npm run build
# ✅ Passes with no errors
# ✅ All format IDs strictly typed

✅ Schema Compliance

✅ No Deprecated Fields Sent

Client now sends:

  • brand_manifest (not promoted_offering)
  • product_id (not products[])
  • completed_views (not video_completions)

Migration Guide

If you're using this client library:

Format IDs

Update any code that creates format IDs:

// Before
const formatId = "banner_300x250";

// After  
const formatId: FormatID = {
  agent_url: "https://creatives.adcontextprotocol.org",
  id: "banner_300x250"
};

Test Requests

Update test request parameters:

// Before
const request: TestRequest = {
  agents: [...],
  brief: "...",
  promoted_offering: "..."  // ❌ Deprecated
};

// After
const request: TestRequest = {
  agents: [...],
  brief: "...",
  brand_manifest: "..."  // ✅ Use this
};

Related

🤖 Generated with Claude Code

bokelley and others added 4 commits October 15, 2025 10:48
## Breaking Changes

### Strict FormatID Typing
- All format ID fields now use structured `FormatID` type with `agent_url` and `id` properties
- No more plain string format IDs anywhere in the codebase
- Affects: `format_id`, `format_ids`, `output_format_ids`, `formats_to_provide`

### Deprecated Field Removal
Per AdCP spec v2.0.0 (adcontextprotocol/adcp#126):
- `promoted_offering` replaced with `brand_manifest` in all requests
- Removed support for deprecated `products` array in packages (use `product_id`)
- Removed support for `video_completions` (use `completed_views`)

## Changes

### Type System
- Updated `src/lib/types/adcp.ts`:
  - Import structured `FormatID` from generated types
  - Use `FormatID` in `CreativeFormat` and `CreativeFilters`
  - Update `TestRequest` to use `brand_manifest` instead of `promoted_offering`
- Updated `src/lib/utils/index.ts`:
  - Convert hardcoded format IDs to structured `FormatID` objects
- Removed stale `src/types/adcp.ts` file

### API & Server
- Updated `src/server/server.ts`:
  - Replace `promoted_offering` with `brand_manifest` in all endpoints
  - Update API parameter types and request handling
- Updated `src/adagents-manager.ts`:
  - Fix import path after removing stale types file

### UI
- Updated `src/public/index.html`:
  - Replace all `promoted_offering` references with `brand_manifest`
  - Update JavaScript variable names

### Generated Types
- Synced with AdCP spec v2.0.0
- All format ID fields now properly typed as `FormatID`
- No post-processing hacks needed - clean type generation

## Testing
✅ Build passes with strict TypeScript checks
✅ All format IDs properly typed as structured objects
✅ No deprecated fields in outgoing requests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolved conflicts by regenerating types from latest schemas.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Synced schemas with AdCP spec v2.0.0
- Auto-updated library version from 0.4.2 to 1.0.0 (major bump due to AdCP v2.0.0)
- Regenerated types with latest schema changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Library version now matches AdCP spec version (2.0.0).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley
bokelley merged commit af32459 into main Oct 15, 2025
8 checks passed
This was referenced Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant