All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Executor schema validation —
Executor.call()now accepts raw JSON Schema (e.g. fromzodToJsonSchema) asinputSchema/outputSchema, not just TypeBoxTSchema. Previously, passing raw JSON Schema caused TypeBoxValue.Check()to throw "Unknown type". The fix auto-converts viajsonSchemaToTypeBox()on first use and caches the result on the module object to avoid repeated conversion.
- Middleware default priority changed from
0to100per PROTOCOL_SPEC §11.2. Middleware without explicit priority will now execute before priority-0 middleware.
- Middleware priority —
Middlewarebase class now acceptspriority: number(default 0). Higher priority executes first; equal priority preserves registration order.BeforeMiddlewareandAfterMiddlewareadapters also acceptpriority. - Priority range validation —
RangeErrorthrown for values outside 0-1000
- Rebrand: aipartnerup → aiperceivable
- Caching/pagination annotations —
ModuleAnnotationsgains 5 optional fields:cacheable,cacheTtl,cacheKeyFields,paginated,paginationStyle(backward compatible) paginationStyleunion — Typed as'cursor' | 'offset' | 'page'matching Python SDK and specsunsetDate— New field onModuleDescriptorandLLMExtensionsfor module deprecation lifecycleonSuspend()/onResume()lifecycle hooks — Optional methods onModuleinterface for state preservation during hot-reload; integrated into control module reload flow- MCP
_metaexport — Schema exporter includescacheable,cacheTtl,cacheKeyFields,paginated,paginationStylein_metasub-dict - Suspend/resume tests — 5 test cases in
test-control.test.tscovering happy path, null return, no hooks, error paths - README Links section — Footer with Documentation, Specification, GitHub, npm, Issues links
- Rebranded — "module development framework" → "module standard" in package.json, index.ts, README, and internal JSDoc
- README — Three-tier slogan/subtitle/definition format, annotation features in feature list
dictToAnnotations— Snake_case fallbacks for new fields (cache_ttl,cache_key_fields,pagination_style)- All sys-module annotations — Updated with new fields (9 modules across 5 files)
0.12.0 - 2026-03-11
Module.preflight()— Optional method for domain-specific pre-execution warnings (spec §5.6)Module.describe()— Optional method returningModuleDescriptionfor LLM/AI tool discovery (spec §5.6)ModuleDescriptioninterface — Typed return type forModule.describe(), exported from package index
ExecutionCancelledErrornow extendsModuleError(was bareError) with error codeEXECUTION_CANCELLED, aligning with PROTOCOL_SPEC §8.7 error hierarchyErrorCodes— AddedEXECUTION_CANCELLEDconstant
- Removed phantom CHANGELOG entry —
ModuleAnnotations.batchProcessing(v0.4.0) was never implemented
0.11.0 - 2026-03-08
- Full lifecycle integration tests (
tests/integration/test-full-lifecycle.test.ts) — 8 tests covering the complete 11-step pipeline with all gates (ACL + Approval + Middleware + Schema validation) enabled simultaneously, nested module calls, sharedcontext.data, error propagation, schema validation, and safe hot-reload lifecycle.
Built-in system.* modules that allow AI agents to query, monitor
system.health.summary/system.health.module— Health status classification with error history integration.system.manifest.module/system.manifest.full— Module introspection and full registry manifest with filtering.system.usage.summary/system.usage.module— Usage statistics with hourly trend data.system.control.update_config— Runtime config hot-patching.system.control.reload_module— Hot-reload modules from disk.system.control.toggle_feature— Enable/disable modules at runtime.registerSysModules()— Auto-registration wiring for all system modules.
ErrorHistory— Ring buffer tracking recent errors with deduplication.ErrorHistoryMiddleware— Middleware recordingModuleErrordetails.UsageCollector/UsageMiddleware— Per-module call counting, latency histograms, and hourly trends.PlatformNotifyMiddleware— Threshold-based sensor emitting events on error rate spikes.
EventEmitter— Global event bus with async subscriber dispatch.WebhookSubscriber— HTTP POST event delivery with retry.A2ASubscriber— Agent-to-Agent protocol event bridge.
APCore.on()/APCore.off()— Event subscription management via the unified client.APCore.disable()/APCore.enable()— Module toggle control via the unified client.
- Module toggle —
ToggleStatewithdisable()/enable(),ModuleDisabledErrorenforcement.
examples/directory — 7 runnable examples mirroring apcore-python: simple client, minimal module, readonly module, full-featured module with ContextLogger,module()function, and YAML binding with target function.
- Stale
VERSIONconstant in built dist (0.9.0vs0.11.0). Rebuilt dist to matchpackage.json. - README architecture tree updated to include ~20 missing source files (
client.ts,events/,sys-modules/, etc.). - README error class count corrected to 35.
0.10.0 - 2026-03-07
APCore.stream()— Stream module output chunk by chunk via the unified client.APCore.validate()— Non-destructive preflight check via the unified client.APCore.describe()— Get module description info (for AI/LLM use).APCore.useBefore()— Add before function middleware via the unified client.APCore.useAfter()— Add after function middleware via the unified client.APCore.remove()— Remove middleware by identity via the unified client.
- Optional methods added to
Moduleinterface:stream?(),validate?(),onLoad?(),onUnload?().
FeatureNotImplementedError— New error class forGENERAL_NOT_IMPLEMENTEDcode.DependencyNotFoundError— New error class forDEPENDENCY_NOT_FOUNDcode.
- APCore client now provides full feature parity with
Executor.
0.9.0 - 2026-03-06
PreflightCheckResult— New readonly interface representing a single preflight check result withcheck,passed, anderrorfields.PreflightResult— New readonly interface returned byExecutor.validate(), containing per-check results,requiresApprovalflag, and computederrorsarray. Duck-type compatible withValidationResult.createPreflightResult()— Factory function for constructingPreflightResultfrom a checks array.- Full 6-check preflight —
validate()now runs Steps 1–6 of the pipeline (module_id format, module lookup, call chain safety, ACL, approval detection, schema validation) without executing module code or middleware.
- Step renumbering — Approval Gate renumbered from Step 4.5 to Step 5; all subsequent steps shifted +1 (now 11 clean steps).
validate()return type — Changed fromValidationResulttoPreflightResult. Backward compatible:.validand.errorsstill work identically for existing consumers.validate()signature — Added optionalcontextparameter for call-chain checks;inputsnow optional (defaults to{}).
- Exported
PreflightCheckResult,PreflightResult, andcreatePreflightResultfrom top-levelindex.ts.
0.8.0 - 2026-03-05
- Dual-timeout model — Global deadline enforcement (
executor.global_timeout) alongside per-module timeout. The shorter of the two is applied, preventing nested call chains from exceeding the global budget. - Error propagation (Algorithm A11) — All execution paths wrap exceptions via
propagateError(), ensuring middleware always receivesModuleErrorinstances with trace context.
- ErrorCodeRegistry — Custom module error codes are validated against framework prefixes and other modules to prevent collisions. Raises
ErrorCodeCollisionErroron conflict. - VersionIncompatibleError — New error class for SDK/config version mismatches with
negotiateVersion()utility. - MiddlewareChainError — Now explicitly
DEFAULT_RETRYABLE = falseper PROTOCOL_SPEC §8.6. - ErrorCodes — Added
VERSION_INCOMPATIBLEandERROR_CODE_COLLISIONconstants (34 total).
guardCallChain()— Standalone Algorithm A20 implementation for call chain safety checks (depth, circular, frequency). Executor delegates to this utility instead of inline logic.propagateError()— Standalone Algorithm A11 implementation for error wrapping and trace context attachment.normalizeToCanonicalId()— Cross-language module ID normalization (Python snake_case, Go PascalCase, etc.).calculateSpecificity()— ACL pattern specificity scoring for deterministic rule ordering.
- Audit logging —
ACLconstructor accepts optionalauditLoggercallback. All access decisions emitAuditEntrywith timestamp, caller/target IDs, matched rule, identity, and trace context. - Condition-based rules — ACL rules support
conditionsfor identity type, role, and call depth filtering.
- Full validation —
Config.validate()checks schema structure, value types, and range constraints. - Hot reload —
Config.reload()re-reads the YAML source and re-validates. - Environment overrides —
APCORE_*environment variables override config values (e.g.,APCORE_EXECUTOR_DEFAULT_TIMEOUT=5000). Config.fromDefaults()— Factory method for default configuration.
- RetryMiddleware — Configurable retry with exponential/fixed backoff, jitter, and max delay. Only retries errors marked
retryable: true.
- Generic
servicestyping —Context<T>supports typed dependency injection via theservicesfield.
_checkSafety()now delegates to standaloneguardCallChain()instead of inline duplicated logic.- Global deadline set on root call only, propagated to child contexts via shared
data['_global_deadline'].
- Expanded
index.tsexports with new symbols:RetryMiddleware,RetryConfig,ErrorCodeRegistry,ErrorCodeCollisionError,VersionIncompatibleError,negotiateVersion,guardCallChain,propagateError,normalizeToCanonicalId,calculateSpecificity,AuditEntry.
- CHANGELOG cleanup — Removed duplicate entries that were incorrectly repeated in the 0.4.0 and 0.3.0 sections.
- README.md — Added documentation link section pointing to the official Getting Started guide. Updated project structure to reflect files added in recent releases (
async-task.ts,cancel.ts,extensions.ts,trace-context.ts), and corrected error class count from 20+ to 30+.
licensefield aligned — Updatedpackage.jsonlicensefield from"MIT"to"Apache-2.0"to match the license file change made in 0.7.0.
0.7.0 - 2026-03-02
- Approval system — Pluggable approval gate (Step 4.5) in the executor pipeline between ACL enforcement and input validation. Modules with
requiresApproval: trueannotation trigger an approval flow before execution proceeds.ApprovalHandlerinterface withrequestApproval()andcheckApproval()methods for synchronous and async (polling) approval flowsApprovalRequestandApprovalResulttypes carrying invocation context and decision state (approved,rejected,timeout,pending)- Three built-in handlers:
AutoApproveHandler(dev/testing),AlwaysDenyHandler(safe default),CallbackApprovalHandler(user-provided async callback) createApprovalRequest()andcreateApprovalResult()factory functionsExecutor.setApprovalHandler()method for runtime handler configuration- Approval audit events emitted to tracing spans for observability
- Approval error types —
ApprovalError(base),ApprovalDeniedError,ApprovalTimeoutError(retryable),ApprovalPendingError(carriesapprovalIdfor polling). Error codesAPPROVAL_DENIED,APPROVAL_TIMEOUT,APPROVAL_PENDINGadded toErrorCodes. approval_handlerextension point — Single-handler extension point inExtensionManagerfor wiring approval handlers via the extension system.- Approval test suites —
test-approval.test.ts,test-approval-executor.test.ts,test-approval-integration.test.ts, andtest-errors.test.tscovering handler behavior, executor pipeline integration, async polling, and error class correctness.
- License changed from MIT to Apache-2.0.
- Added
"approval"topackage.jsonkeywords.
0.6.0 - 2026-02-23
- Critical publishing bug — Previous releases (0.1.0–0.5.0) shipped without
dist/directory because.gitignoreexcludeddist/and npm fell back to it as the exclusion list (nofilesfield or.npmignoreexisted).require("apcore-js")andimport("apcore-js")would fail at runtime with "module not found". This is the first version where the package is actually usable from npm. - VERSION constant out of sync —
VERSIONexport was stuck at'0.3.0'whilepackage.jsonwas at0.5.0.
"files": ["dist", "README.md"]inpackage.jsonto restrict npm publish scope to compiled output only (previously published src/, tests/, planning/, .claude/, .github/ — 902 KB of dev files)."prepublishOnly": "pnpm run build"script to ensuretscruns before everynpm publish/pnpm publish.- Package integrity test suite (
tests/test-package-integrity.test.ts) — 10 tests that verify:filesfield configuration and exclusion of dev directoriesprepublishOnlyscript exists and invokes build- All entry points (
main,types,exports) resolve to files indist/ dist/index.jsis importable and exports all 16+ core symbolsVERSIONconstant matchespackage.jsonversion
- Version aligned with apcore-python — Bumped to 0.6.0 for cross-language version consistency.
- Package size reduced from 192.6 kB (source-only, broken) to 86.3 kB (compiled, working).
- Full browser / frontend compatibility — All
node:fsandnode:pathimports across 7 source files (acl.ts,bindings.ts,schema/loader.ts,schema/ref-resolver.ts,registry/metadata.ts,registry/scanner.ts,registry/registry.ts) converted from static top-level imports to lazy-load via ESM top-levelawait import()withtry/catch. Importing any module fromapcore-jsin a browser bundler no longer crashes at parse time. node:cryptoremoved —trace-context.tsandobservability/tracing.tsnow use a newrandomHex()utility based on the Web Crypto API (globalThis.crypto.getRandomValues()), compatible with Node 18+ and all modern browsers.process.stdout/process.stderrremoved —StdoutExporterusesconsole.info(),ContextLoggerdefault output usesconsole.error()for universal runtime compatibility.Registry.watch()signature changed fromwatch(): voidtoasync watch(): Promise<void>(backward-compatible — existing fire-and-forget calls still work).- Added
"sideEffects": falsetopackage.jsonto enable bundler tree-shaking of Node.js-only code paths.
randomHex(byteLength: number): stringutility function inutils/index.ts— generates hex strings using Web Crypto API, replacingnode:crypto.randomBytes.- Browser compatibility test suite (
tests/test-browser-compat.test.ts) — 26 tests across 4 groups:- Module import health (8 tests) — all lazy-load modules importable
- Pure-logic APIs without filesystem (10 tests) — ACL, metadata, jsonSchemaToTypeBox, RefResolver inline $ref, Registry register/get/event
- Filesystem-dependent APIs in Node.js (5 tests) — ACL.load, loadMetadata, scanExtensions, SchemaLoader, RefResolver with lazy-loaded fs/path
- Source file guard (1 test) — scans all 10 refactored files to assert zero static
node:imports
0.5.0 - 2026-02-23
- Cancellation support with
CancelTokenandExecutionCancelledError, including executor pre-execution cancellation checks. - Async task system with
AsyncTaskManager,TaskStatus, andTaskInfofor background module execution, status tracking, cancellation, and cleanup. - Extension framework via
ExtensionManagerandExtensionPoint, with built-in extension points fordiscoverer,middleware,acl,span_exporter, andmodule_validator. - W3C Trace Context support through
TraceContextandTraceParent(inject,extract,fromTraceparent) for distributed trace propagation. - OTLP tracing exporter (
OTLPExporter) for OpenTelemetry-compatible HTTP span export. - Registry extensibility hooks: custom
DiscovererandModuleValidatorinterfaces and runtime registration methods. - Registry constraints and constants:
MAX_MODULE_ID_LENGTH,RESERVED_WORDS, and stricter module ID validation rules. - Context interoperability APIs:
Context.toJSON(),Context.fromJSON(), andContextFactoryinterface.
Context.create()now accepts optionaltraceParentand can derivetraceIdfrom inbound distributed trace headers.Registry.discover()now supports async custom discovery/validation flow in addition to default filesystem discovery.TracingMiddlewarenow supports runtime exporter replacement viasetExporter()and uses Unix epoch seconds with OTLP-compatible nanosecond conversion.- Public exports were expanded in
index.tsto expose new cancellation, extension, tracing, registry, and async-task APIs. MiddlewareChainErrornow preserves the original cause when wrapping middleware exceptions.
- Improved cancellation correctness by bypassing middleware error recovery for
ExecutionCancelledError. - Improved async task concurrency behavior around queued-task cancellation to avoid counter corruption.
- Improved context serialization safety by excluding internal
datakeys prefixed with_fromtoJSON()output.
- Added comprehensive tests for cancellation, async task management, extension wiring, trace context parsing/injection, registry hot-reload/custom hooks, and OTLP export behavior.
0.4.0 - 2026-02-23
- Improved performance of
Executor.stream()with optimized buffering.
- Added new logging features for better observability in the execution pipeline.
- ExtensionManager and ExtensionPoint exports for unified extension point management (discoverer, middleware, acl, span_exporter, module_validator)
- AsyncTaskManager, TaskStatus, TaskInfo exports for async task execution with status tracking (PENDING, RUNNING, COMPLETED, FAILED, CANCELLED) and cancellation
- TraceContext and TraceParent exports for W3C Trace Context support with
inject(),extract(), andfromTraceparent()methods Context.create()accepts optionaltraceParentparameter for distributed trace propagation
- Resolved issues with error handling in
context.ts.
- Claude Opus 4.6 noreply@anthropic.com
- New Contributor newcontributor@example.com
- Error classes and constants
ModuleExecuteError— New error class for module execution failuresInternalError— New error class for general internal errorsErrorCodes— Frozen object with all 26 error code strings for consistent error code usageErrorCode— Type definition for all error codes
- Registry constants
REGISTRY_EVENTS— Frozen object with standard event names (register,unregister)MODULE_ID_PATTERN— Regex pattern enforcing lowercase/digits/underscores/dots for module IDs (no hyphens allowed to ensure bijective MCP tool name normalization)
- Executor methods
Executor.callAsync()— Alias forcall()for compatibility with MCP bridge packages
- Module ID validation — Registry now validates module IDs against
MODULE_ID_PATTERNon registration, rejecting IDs with hyphens or invalid characters - Event handling — Registry event validation now uses
REGISTRY_EVENTSconstants instead of hardcoded strings - Test updates — Updated tests to use underscore-separated module IDs instead of hyphens (e.g.,
math.add_teninstead ofmath.addTen,ctx_testinstead ofctx-test)
- String literals in Registry — Replaced hardcoded
'register'and'unregister'strings withREGISTRY_EVENTS.REGISTERandREGISTRY_EVENTS.UNREGISTERconstants in event triggers for consistency
0.3.0 - 2026-02-20
- Use shallow merge for
stream()accumulation instead of last-chunk.
- Add
Executor.stream()async generator andModuleAnnotations.streamingfor streaming support in the core execution pipeline.
- Claude Opus 4.6 noreply@anthropic.com
- Error classes and constants
ModuleExecuteError— New error class for module execution failuresInternalError— New error class for general internal errorsErrorCodes— Frozen object with all 26 error code strings for consistent error code usageErrorCode— Type definition for all error codes
- Registry constants
REGISTRY_EVENTS— Frozen object with standard event names (register,unregister)MODULE_ID_PATTERN— Regex pattern enforcing lowercase/digits/underscores/dots for module IDs (no hyphens allowed to ensure bijective MCP tool name normalization)
- Executor methods
Executor.callAsync()— Alias forcall()for compatibility with MCP bridge packages
- Module ID validation — Registry now validates module IDs against
MODULE_ID_PATTERNon registration, rejecting IDs with hyphens or invalid characters - Event handling — Registry event validation now uses
REGISTRY_EVENTSconstants instead of hardcoded strings - Test updates — Updated tests to use underscore-separated module IDs instead of hyphens (e.g.,
math.add_teninstead ofmath.addTen,ctx_testinstead ofctx-test)
- String literals in Registry — Replaced hardcoded
'register'and'unregister'strings withREGISTRY_EVENTS.REGISTERandREGISTRY_EVENTS.UNREGISTERconstants in event triggers for consistency
0.2.0 - 2026-02-20
- Error classes and constants
ModuleExecuteError— New error class for module execution failuresInternalError— New error class for general internal errorsErrorCodes— Frozen object with all 26 error code strings for consistent error code usageErrorCode— Type definition for all error codes
- Registry constants
REGISTRY_EVENTS— Frozen object with standard event names (register,unregister)MODULE_ID_PATTERN— Regex pattern enforcing lowercase/digits/underscores/dots for module IDs (no hyphens allowed to ensure bijective MCP tool name normalization)
- Executor methods
Executor.callAsync()— Alias forcall()for compatibility with MCP bridge packages
- Module ID validation — Registry now validates module IDs against
MODULE_ID_PATTERNon registration, rejecting IDs with hyphens or invalid characters - Event handling — Registry event validation now uses
REGISTRY_EVENTSconstants instead of hardcoded strings - Test updates — Updated tests to use underscore-separated module IDs instead of hyphens (e.g.,
math.add_teninstead ofmath.addTen,ctx_testinstead ofctx-test)
- String literals in Registry — Replaced hardcoded
'register'and'unregister'strings withREGISTRY_EVENTS.REGISTERandREGISTRY_EVENTS.UNREGISTERconstants in event triggers for consistency
- Timer leak in executor —
_executeWithTimeoutnow callsclearTimeoutin.finally()to prevent timer leak on normal completion - Path traversal protection —
resolveTargetin binding loader rejects module paths containing..segments before dynamicimport() - Bare catch blocks — 6 silent
catch {}blocks in registry and middleware manager now log warnings with[apcore:<subsystem>]prefix - Python-style error messages — Fixed
FuncMissingTypeHintErrorandFuncMissingReturnTypeErrorto use TypeScript syntax (: string,: Record<string, unknown>) - Console.log in production — Replaced
console.logwithconsole.infoin logging middleware andprocess.stdout.writein tracing exporter
- Long method decomposition — Broke up 4 oversized methods to meet ≤50 line guideline:
Executor.call()(108 → 6 private helpers)Registry.discover()(110 → 7 private helpers)ACL.load()(71 → extractedparseAclRule)jsonSchemaToTypeBox()(80 → 5 converter helpers)
- Deeply readonly callChain —
Context.callChaintype narrowed fromreadonly string[]toreadonly (readonly string[])preventing mutation via push/splice - Consolidated
deepCopy— Removed 4 duplicatedeepCopyimplementations; single shared version now lives insrc/utils/index.ts
- 42 new tests for previously uncovered modules:
tests/schema/test-annotations.test.ts— 16 tests formergeAnnotations,mergeExamples,mergeMetadatatests/schema/test-exporter.test.ts— 14 tests forSchemaExporteracross all 4 export profilestests/test-logging-middleware.test.ts— 12 tests forLoggingMiddlewarebefore/after/onError
- Updated logo URL in README
- Renamed package from
apcoretoapcore-js - Updated installation instructions
0.1.0 - 2026-02-16
- Core executor — 10-step async execution pipeline with timeout support via
Promise.race - Context system — Execution context with trace IDs, call chains, identity, and redacted inputs
- Config — Dot-path configuration accessor
- Registry system
- File-based module discovery (
scanExtensions,scanMultiRoot) - Dynamic entry point resolution with duck-type validation
- YAML metadata loading and merging (code values + YAML overrides)
- Dependency parsing with topological sort (Kahn's algorithm) and cycle detection
- ID map support for custom module IDs
- Schema export in JSON/YAML with strict and compact modes
- File-based module discovery (
- FunctionModule — Schema-driven module wrapper with TypeBox schemas
- Binding loader — YAML-based module registration with three schema modes (inline, external ref, permissive fallback)
- ACL (Access Control List)
- Pattern-based rules with glob matching
- Identity type and role-based conditions
- Call depth conditions
- Dynamic rule management (
addRule,removeRule,reload) - YAML configuration loading
- Middleware system
- Onion-model execution (before forward, after reverse)
- Error recovery via
onErrorhooks BeforeMiddlewareandAfterMiddlewareadaptersLoggingMiddlewarefor structured execution logging
- Observability
- Tracing — Span creation,
InMemoryExporter,StdoutExporter,TracingMiddlewarewith sampling strategies (full, off, proportional, error_first) - Metrics —
MetricsCollectorwith counters, histograms, Prometheus text format export,MetricsMiddleware - Logging —
ContextLoggerwith JSON/text formats, level filtering,_secret_field redaction,ObsLoggingMiddleware
- Tracing — Span creation,
- Schema system
- JSON Schema to TypeBox conversion
$refresolution- Schema validation
- Strict transforms (
additionalProperties: false) - LLM description injection and extension stripping
- Error hierarchy — 20+ typed error classes with error codes, details, trace IDs, and timestamps
- Pattern matching — Glob-style pattern matching for ACL rules and module targeting
- Comprehensive test suite — 385 tests across 29 test files