
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@drew-foxall/a2a-js-taskstore-core
Advanced tools
Core types and utilities for A2A task store adapters
Core types and utilities for A2A task store adapters. Uses types from the official @a2a-js/sdk with Zod schemas for runtime validation.
pnpm add @drew-foxall/a2a-js-taskstore-core @a2a-js/sdk@0.3.5
This package requires an exact version of @a2a-js/sdk as a peer dependency:
| Core Version | SDK Version |
|---|---|
| 0.1.x | 0.3.5 |
The Zod schemas use TypeScript's satisfies keyword to ensure compile-time verification that they match the SDK types exactly. If the SDK types change, the build will fail until the schemas are updated.
@a2a-js/sdk@0.3.5 for compatibilitysatisfies to match SDK types exactlyThis package provides the shared foundation for all A2A task store adapters:
Task, TaskStore, PushNotificationConfig, etc.)ExtendedTaskStore with additional query methodsTypes are re-exported from the official @a2a-js/sdk:
import type {
// Task types (from @a2a-js/sdk)
Task,
TaskState,
TaskStatus,
Artifact,
Message,
Part,
// Store interfaces (from @a2a-js/sdk)
TaskStore,
PushNotificationStore,
PushNotificationConfig,
// Extended interfaces (from this package)
ExtendedTaskStore,
BaseStoreOptions,
TtlOptions,
ListTasksOptions,
// Utility types
ParseResult,
SafeParseResult,
} from '@drew-foxall/a2a-js-taskstore-core';
Zod schemas are provided for runtime validation. These schemas match the SDK types:
import {
TaskSchema,
TaskStateSchema,
TaskStatusSchema,
PushNotificationConfigSchema,
z,
} from '@drew-foxall/a2a-js-taskstore-core';
// Validate unknown data from storage
const result = TaskSchema.safeParse(unknownData);
if (result.success) {
const task: Task = result.data;
} else {
console.error('Validation failed:', result.error.issues);
}
// Parse and throw on invalid
const task = TaskSchema.parse(unknownData);
import {
// Task schemas
TaskSchema,
TaskStateSchema,
TaskStatusSchema,
ArtifactSchema,
// Message schemas
MessageSchema,
MessageRoleSchema,
PartSchema,
TextPartSchema,
FilePartSchema,
DataPartSchema,
FileContentSchema,
// Push notification schemas
PushNotificationConfigSchema,
PushNotificationConfigArraySchema,
PushAuthenticationSchema,
// Options schemas
BaseStoreOptionsSchema,
TtlOptionsSchema,
ListTasksOptionsSchema,
} from '@drew-foxall/a2a-js-taskstore-core';
Type-safe JSON serialization with Zod validation:
import {
serializeTask,
parseTask,
safeParseTask,
parseTaskResult,
} from '@drew-foxall/a2a-js-taskstore-core';
// Serialize a task to JSON
const json = serializeTask(task);
// Parse JSON with validation (throws on invalid)
const task = parseTask(json);
// Safe parsing (returns undefined on failure)
const maybeTask = safeParseTask(json);
// Result-based parsing (returns success/error object)
const result = parseTaskResult(json);
if (result.success) {
console.log(result.data);
} else {
console.error(result.error.issues);
}
import {
serializePushConfigs,
parsePushConfigs,
safeParsePushConfigs,
parsePushConfig,
safeParsePushConfig,
} from '@drew-foxall/a2a-js-taskstore-core';
// Serialize configs to JSON
const json = serializePushConfigs(configs);
// Parse with validation
const configs = parsePushConfigs(json);
// Safe parsing (returns empty array on failure)
const configs = safeParsePushConfigs(json);
Validation utilities with detailed error messages:
import {
validateTask,
validateTaskId,
validatePushConfig,
validatePrefix,
validateTtl,
ValidationError,
} from '@drew-foxall/a2a-js-taskstore-core';
try {
validateTask(unknownData);
} catch (error) {
if (error instanceof ValidationError) {
console.error('Validation failed:', error.message);
console.error('Issues:', error.issues);
console.error('Path:', error.path);
}
}
// Individual field validation
validateTaskId(id); // throws if invalid
validatePrefix(prefix); // throws if invalid
validateTtl(seconds); // throws if invalid
import {
isValidTask,
isValidPushConfig,
isValidTaskState,
} from '@drew-foxall/a2a-js-taskstore-core';
if (isValidTask(data)) {
// data is typed as Task
}
if (isValidTaskState(state)) {
// state is typed as TaskState
}
Create custom validators from any Zod schema:
import {
createValidator,
createSafeValidator,
createParser,
createSafeParser,
z,
} from '@drew-foxall/a2a-js-taskstore-core';
const MySchema = z.object({ name: z.string() });
// Create an assertion function
const validate = createValidator(MySchema);
validate(data); // throws if invalid
// Create a type guard
const isValid = createSafeValidator(MySchema);
if (isValid(data)) { /* data is typed */ }
// Create a parser (throws)
const parse = createParser(MySchema);
const result = parse(data);
// Create a safe parser (returns undefined)
const safeParse = createSafeParser(MySchema);
const maybeResult = safeParse(data);
interface TaskStore {
save(task: Task): Promise<void>;
load(taskId: string): Promise<Task | undefined>;
}
interface PushNotificationStore {
save(taskId: string, config: PushNotificationConfig): Promise<void>;
load(taskId: string): Promise<PushNotificationConfig[]>;
delete(taskId: string, configId?: string): Promise<void>;
}
Extended interface with additional query capabilities:
interface ExtendedTaskStore extends TaskStore {
loadByContextId?(contextId: string): Promise<Task[]>;
loadByStatus?(status: TaskState, limit?: number): Promise<Task[]>;
delete?(taskId: string): Promise<void>;
list?(options?: ListTasksOptions): Promise<Task[]>;
countByStatus?(status: TaskState): Promise<number>;
}
This package is designed to work with the official A2A JavaScript SDK and addresses Issue #114 for persistent task storage.
All store implementations in this monorepo implement the official TaskStore and PushNotificationStore interfaces from @a2a-js/sdk.
MIT
FAQs
Core types and utilities for A2A task store adapters
We found that @drew-foxall/a2a-js-taskstore-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.