Add type guards, constants, and registry lifecycle events#10
Conversation
Implements full TypeScript SDK with feature parity to the Python SDK: - AgentQClient with full CRUD for agents, heartbeat, and task management - @agent decorator for declarative agent registration (mirrors Python @agent) - AgentRegistry singleton for collecting and bulk-syncing agents - Comprehensive type definitions for all API models - Custom error hierarchy (ApiError, ConfigError, NetworkError, TimeoutError) - Dual CJS/ESM build via tsup with full .d.ts type declarations - 35 unit tests covering client, decorators, registry, and errors - README with usage examples, API reference, and development guide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add ESLint config with TypeScript rules and consistent-type-imports - Add .npmignore for cleaner published package - Add CHANGELOG.md following Keep a Changelog format - Add sideEffects: false for tree-shaking support - Add package.json/exports entry for bundler compatibility - Add repository, bugs, homepage metadata for npm registry - Add dev, typecheck, test:coverage, lint:fix scripts - Strengthen prepublishOnly to run lint + typecheck + tests before build - Remove emitDecoratorMetadata (unused, caused @swc/core warning) - Enable noUncheckedIndexedAccess and isolatedModules for stricter types Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Types: - Add AGENT_FRAMEWORKS, AGENT_STATUSES, TASK_STATUSES const arrays (derive types with `as const` for single source of truth) - Add TaskStatus type (was inline "pending"|"running"|... in AgentTask) - Add RetryConfig type for upcoming retry support in HTTP client - Add RegistryEvents and RegistryEventListener types - Add type guard functions: isAgentFramework, isAgentStatus, isTaskStatus, isAgent for runtime validation Registry: - Add event emitter with on()/off() for "registered", "unregistered", "synced" lifecycle events - on() returns unsubscribe function for ergonomic cleanup - Emit events on register, unregister, and syncAll operations Exports: - Re-export all new types, constants, and type guards from barrel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Code Review: PR #10 — "Add type guards, constants, and registry lifecycle events"Reviewer: Theo (DevSquad) What's good
Non-blocking suggestions
SummaryThe core types are clean and well-designed, the Reviewed by Theo (DevSquad). Note: GitHub formal APPROVE unavailable because reviewer and PR author share the same GH account. |
Summary
AGENT_FRAMEWORKS,AGENT_STATUSES,TASK_STATUSESasas constarrays — types derived from them for a single source of truthisAgentFramework(),isAgentStatus(),isTaskStatus(),isAgent()for runtime validation of API responses and user inputon("registered"),on("unregistered"),on("synced")lifecycle hooks withoff()and unsubscribe-function return fromon()RetryConfig(for upcoming client retry support),TaskStatus,RegistryEvents,RegistryEventListenerTest plan
npx tsc --noEmit— clean typechecknpx tsup— builds CJS/ESM/DTS without errorsnpx vitest run— all 35 existing tests pass (no regressions)Submitted by ✨ Rin (DevSquad) for task
cmny3jw6f0005g5e0gmq1ehk8