apcore-js 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -7
- package/dist/client.d.ts +130 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +187 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +30 -2
- package/dist/errors.js.map +1 -1
- package/dist/events/emitter.d.ts +30 -0
- package/dist/events/emitter.d.ts.map +1 -0
- package/dist/events/emitter.js +67 -0
- package/dist/events/emitter.js.map +1 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +3 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/subscribers.d.ts +32 -0
- package/dist/events/subscribers.d.ts.map +1 -0
- package/dist/events/subscribers.js +128 -0
- package/dist/events/subscribers.js.map +1 -0
- package/dist/executor.d.ts +3 -3
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +4 -4
- package/dist/executor.js.map +1 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/middleware/error-history.d.ts +16 -0
- package/dist/middleware/error-history.d.ts.map +1 -0
- package/dist/middleware/error-history.js +23 -0
- package/dist/middleware/error-history.js.map +1 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/platform-notify.d.ts +30 -0
- package/dist/middleware/platform-notify.d.ts.map +1 -0
- package/dist/middleware/platform-notify.js +84 -0
- package/dist/middleware/platform-notify.js.map +1 -0
- package/dist/module.d.ts +8 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/observability/error-history.d.ts +33 -0
- package/dist/observability/error-history.d.ts.map +1 -0
- package/dist/observability/error-history.js +96 -0
- package/dist/observability/error-history.js.map +1 -0
- package/dist/observability/index.d.ts +4 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +2 -0
- package/dist/observability/index.js.map +1 -1
- package/dist/observability/metrics-utils.d.ts +30 -0
- package/dist/observability/metrics-utils.d.ts.map +1 -0
- package/dist/observability/metrics-utils.js +71 -0
- package/dist/observability/metrics-utils.js.map +1 -0
- package/dist/observability/usage.d.ts +66 -0
- package/dist/observability/usage.d.ts.map +1 -0
- package/dist/observability/usage.js +216 -0
- package/dist/observability/usage.js.map +1 -0
- package/dist/registry/registry.d.ts +5 -0
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +32 -0
- package/dist/registry/registry.js.map +1 -1
- package/dist/sys-modules/control.d.ts +39 -0
- package/dist/sys-modules/control.d.ts.map +1 -0
- package/dist/sys-modules/control.js +105 -0
- package/dist/sys-modules/control.js.map +1 -0
- package/dist/sys-modules/health.d.ts +45 -0
- package/dist/sys-modules/health.d.ts.map +1 -0
- package/dist/sys-modules/health.js +115 -0
- package/dist/sys-modules/health.js.map +1 -0
- package/dist/sys-modules/index.d.ts +8 -0
- package/dist/sys-modules/index.d.ts.map +1 -0
- package/dist/sys-modules/index.js +7 -0
- package/dist/sys-modules/index.js.map +1 -0
- package/dist/sys-modules/manifest.d.ts +38 -0
- package/dist/sys-modules/manifest.d.ts.map +1 -0
- package/dist/sys-modules/manifest.js +91 -0
- package/dist/sys-modules/manifest.js.map +1 -0
- package/dist/sys-modules/registration.d.ts +35 -0
- package/dist/sys-modules/registration.d.ts.map +1 -0
- package/dist/sys-modules/registration.js +132 -0
- package/dist/sys-modules/registration.js.map +1 -0
- package/dist/sys-modules/toggle.d.ts +44 -0
- package/dist/sys-modules/toggle.d.ts.map +1 -0
- package/dist/sys-modules/toggle.js +82 -0
- package/dist/sys-modules/toggle.js.map +1 -0
- package/dist/sys-modules/usage.d.ts +35 -0
- package/dist/sys-modules/usage.d.ts.map +1 -0
- package/dist/sys-modules/usage.js +105 -0
- package/dist/sys-modules/usage.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ apcore provides a unified task orchestration framework with schema validation, a
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
13
|
- **Schema-driven modules** — Define input/output schemas with TypeBox for runtime validation
|
|
14
|
-
- **Executor pipeline** —
|
|
14
|
+
- **Executor pipeline** — 11-step execution pipeline: context → safety checks → lookup → ACL → approval gate → validation → middleware before → execute → output validation → middleware after → return
|
|
15
15
|
- **Registry system** — File-based module discovery with metadata, dependencies, and topological ordering
|
|
16
16
|
- **Binding loader** — YAML-based module registration for no-code integration
|
|
17
17
|
- **Access control (ACL)** — Pattern-based rules with identity types, roles, and call-depth conditions
|
|
@@ -22,7 +22,7 @@ apcore provides a unified task orchestration framework with schema validation, a
|
|
|
22
22
|
|
|
23
23
|
## Documentation
|
|
24
24
|
|
|
25
|
-
For full documentation, including Quick Start guides
|
|
25
|
+
For full documentation, including Quick Start guides and API reference, visit:
|
|
26
26
|
**[https://aipartnerup.github.io/apcore/getting-started.html](https://aipartnerup.github.io/apcore/getting-started.html)**
|
|
27
27
|
|
|
28
28
|
## Requirements
|
|
@@ -38,11 +38,39 @@ npm install apcore-js
|
|
|
38
38
|
|
|
39
39
|
## Quick Start
|
|
40
40
|
|
|
41
|
+
### Simplified Client (Recommended)
|
|
42
|
+
|
|
43
|
+
The `APCore` client provides a unified entry point that manages Registry and Executor for you:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { Type } from '@sinclair/typebox';
|
|
47
|
+
import { APCore } from 'apcore-js';
|
|
48
|
+
|
|
49
|
+
const client = new APCore();
|
|
50
|
+
|
|
51
|
+
// Register a module
|
|
52
|
+
client.module({
|
|
53
|
+
id: 'math.add',
|
|
54
|
+
description: 'Add two numbers',
|
|
55
|
+
inputSchema: Type.Object({ a: Type.Number(), b: Type.Number() }),
|
|
56
|
+
outputSchema: Type.Object({ sum: Type.Number() }),
|
|
57
|
+
execute: (inputs) => ({ sum: (inputs.a as number) + (inputs.b as number) }),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Call, validate, stream — all from one client
|
|
61
|
+
const result = await client.call('math.add', { a: 10, b: 5 });
|
|
62
|
+
// => { sum: 15 }
|
|
63
|
+
|
|
64
|
+
const preflight = client.validate('math.add', { a: 10, b: 5 });
|
|
65
|
+
// => { valid: true, checks: [...], requiresApproval: false, errors: [] }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Advanced: Manual Registry + Executor
|
|
69
|
+
|
|
41
70
|
```typescript
|
|
42
71
|
import { Type } from '@sinclair/typebox';
|
|
43
72
|
import { FunctionModule, Registry, Executor } from 'apcore-js';
|
|
44
73
|
|
|
45
|
-
// Define a module
|
|
46
74
|
const greet = new FunctionModule({
|
|
47
75
|
execute: (inputs) => ({ greeting: `Hello, ${inputs.name}!` }),
|
|
48
76
|
moduleId: 'example.greet',
|
|
@@ -51,7 +79,6 @@ const greet = new FunctionModule({
|
|
|
51
79
|
description: 'Greet a user',
|
|
52
80
|
});
|
|
53
81
|
|
|
54
|
-
// Register and execute
|
|
55
82
|
const registry = new Registry();
|
|
56
83
|
registry.register('example.greet', greet);
|
|
57
84
|
|
|
@@ -60,12 +87,39 @@ const result = await executor.call('example.greet', { name: 'World' });
|
|
|
60
87
|
// => { greeting: 'Hello, World!' }
|
|
61
88
|
```
|
|
62
89
|
|
|
90
|
+
## API Overview
|
|
91
|
+
|
|
92
|
+
| Class | Description |
|
|
93
|
+
|-------|-------------|
|
|
94
|
+
| `APCore` | High-level client — register modules, call, stream, validate |
|
|
95
|
+
| `Registry` | Module storage — discover, register, get, list, watch |
|
|
96
|
+
| `Executor` | Execution engine — call with middleware pipeline, ACL, approval |
|
|
97
|
+
| `Context` | Request context — trace ID, identity, call chain, cancel token |
|
|
98
|
+
| `Config` | Configuration — load from YAML, get/set values |
|
|
99
|
+
| `ACL` | Access control — rule-based caller/target authorization |
|
|
100
|
+
| `Middleware` | Pipeline hooks — before/after/onError interception |
|
|
101
|
+
| `EventEmitter` | Event system — subscribe, emit, flush |
|
|
102
|
+
|
|
103
|
+
## Examples
|
|
104
|
+
|
|
105
|
+
The `examples/` directory contains runnable examples demonstrating key features:
|
|
106
|
+
|
|
107
|
+
| Example | Description |
|
|
108
|
+
|---------|-------------|
|
|
109
|
+
| `simple-client.ts` | APCore client with module registration and calls |
|
|
110
|
+
| `modules/greet.ts` | Minimal FunctionModule |
|
|
111
|
+
| `modules/get-user.ts` | Readonly + idempotent annotations |
|
|
112
|
+
| `modules/send-email.ts` | Full-featured: annotations, examples, metadata, ContextLogger |
|
|
113
|
+
| `modules/decorated-add.ts` | `module()` function for creating modules |
|
|
114
|
+
| `bindings/format-date/` | YAML binding with target function |
|
|
115
|
+
|
|
63
116
|
## Architecture
|
|
64
117
|
|
|
65
118
|
```
|
|
66
119
|
src/
|
|
67
120
|
index.ts # Public API exports
|
|
68
|
-
|
|
121
|
+
client.ts # High-level APCore client (unified entry point)
|
|
122
|
+
executor.ts # 11-step execution pipeline
|
|
69
123
|
context.ts # Execution context and identity
|
|
70
124
|
config.ts # Dot-path configuration accessor
|
|
71
125
|
acl.ts # Access control with pattern matching
|
|
@@ -74,16 +128,27 @@ src/
|
|
|
74
128
|
cancel.ts # Cancellation token support
|
|
75
129
|
decorator.ts # FunctionModule class and helpers
|
|
76
130
|
bindings.ts # YAML binding loader
|
|
77
|
-
errors.ts # Error hierarchy (
|
|
131
|
+
errors.ts # Error hierarchy (35 typed errors)
|
|
132
|
+
error-code-registry.ts # Custom error code registration with collision detection
|
|
78
133
|
extensions.ts # Extension manager
|
|
79
134
|
module.ts # Module types and annotations
|
|
80
|
-
trace-context.ts
|
|
135
|
+
trace-context.ts # W3C trace context (inject/extract)
|
|
136
|
+
version.ts # Version negotiation (semver parsing)
|
|
137
|
+
events/
|
|
138
|
+
index.ts # Event module barrel exports
|
|
139
|
+
emitter.ts # Global event bus with fan-out delivery
|
|
140
|
+
subscribers.ts # Webhook and A2A protocol event subscribers
|
|
81
141
|
middleware/
|
|
142
|
+
index.ts # Middleware barrel exports
|
|
82
143
|
base.ts # Middleware base class
|
|
83
144
|
manager.ts # MiddlewareManager (onion model)
|
|
84
145
|
adapters.ts # BeforeMiddleware, AfterMiddleware adapters
|
|
85
146
|
logging.ts # LoggingMiddleware
|
|
147
|
+
retry.ts # RetryMiddleware for automatic retry of retryable errors
|
|
148
|
+
error-history.ts # Middleware that records errors into ErrorHistory
|
|
149
|
+
platform-notify.ts # Threshold sensor with hysteresis for error/latency alerts
|
|
86
150
|
registry/
|
|
151
|
+
index.ts # Registry barrel exports
|
|
87
152
|
registry.ts # Registry with discover() pipeline
|
|
88
153
|
scanner.ts # File-based module discovery
|
|
89
154
|
entry-point.ts # Dynamic import and entry point resolution
|
|
@@ -93,18 +158,36 @@ src/
|
|
|
93
158
|
schema-export.ts # Schema export (JSON/YAML, strict/compact)
|
|
94
159
|
types.ts # Registry type definitions
|
|
95
160
|
schema/
|
|
161
|
+
index.ts # Schema barrel exports
|
|
96
162
|
loader.ts # JSON Schema to TypeBox conversion
|
|
97
163
|
validator.ts # Schema validation
|
|
98
164
|
exporter.ts # Schema serialization
|
|
99
165
|
ref-resolver.ts # $ref resolution
|
|
100
166
|
strict.ts # Strict schema transforms
|
|
101
167
|
types.ts # Schema type definitions
|
|
168
|
+
annotations.ts # Annotation conflict resolution (YAML + code metadata)
|
|
102
169
|
observability/
|
|
170
|
+
index.ts # Observability barrel exports
|
|
103
171
|
tracing.ts # Span, SpanExporter, TracingMiddleware
|
|
104
172
|
metrics.ts # MetricsCollector, MetricsMiddleware
|
|
173
|
+
metrics-utils.ts # Shared metric extraction utilities
|
|
105
174
|
context-logger.ts # ContextLogger, ObsLoggingMiddleware
|
|
175
|
+
usage.ts # Time-windowed usage tracking with analytics
|
|
176
|
+
error-history.ts # Error history with ring-buffer eviction and dedup
|
|
177
|
+
sys-modules/
|
|
178
|
+
index.ts # System module barrel exports
|
|
179
|
+
registration.ts # Auto-registration of sys.* modules and middleware
|
|
180
|
+
control.ts # Runtime config update and hot-reload modules
|
|
181
|
+
health.ts # System and per-module health modules
|
|
182
|
+
manifest.ts # Module metadata and system manifest modules
|
|
183
|
+
toggle.ts # Module disable/enable without unloading
|
|
184
|
+
usage.ts # Usage summary and per-module usage detail modules
|
|
106
185
|
utils/
|
|
186
|
+
index.ts # Utils barrel exports
|
|
107
187
|
pattern.ts # Glob-style pattern matching
|
|
188
|
+
call-chain.ts # Call chain safety guard (depth, frequency, cycles)
|
|
189
|
+
error-propagation.ts # Standardized error wrapping
|
|
190
|
+
normalize.ts # Cross-language module ID normalization
|
|
108
191
|
```
|
|
109
192
|
|
|
110
193
|
## Development
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level client for apcore to simplify interaction.
|
|
3
|
+
*/
|
|
4
|
+
import type { TSchema } from '@sinclair/typebox';
|
|
5
|
+
import type { Config } from './config.js';
|
|
6
|
+
import type { Context } from './context.js';
|
|
7
|
+
import { FunctionModule } from './decorator.js';
|
|
8
|
+
import type { ApCoreEvent, EventSubscriber } from './events/emitter.js';
|
|
9
|
+
import { EventEmitter } from './events/emitter.js';
|
|
10
|
+
import { Executor } from './executor.js';
|
|
11
|
+
import type { Middleware } from './middleware/index.js';
|
|
12
|
+
import type { ModuleAnnotations, ModuleExample, PreflightResult } from './module.js';
|
|
13
|
+
import type { MetricsCollector } from './observability/metrics.js';
|
|
14
|
+
import { Registry } from './registry/registry.js';
|
|
15
|
+
export interface APCoreOptions {
|
|
16
|
+
registry?: Registry;
|
|
17
|
+
executor?: Executor;
|
|
18
|
+
config?: Config;
|
|
19
|
+
metricsCollector?: MetricsCollector;
|
|
20
|
+
}
|
|
21
|
+
export interface ModuleOptions {
|
|
22
|
+
id?: string;
|
|
23
|
+
inputSchema: TSchema;
|
|
24
|
+
outputSchema: TSchema;
|
|
25
|
+
description?: string;
|
|
26
|
+
documentation?: string | null;
|
|
27
|
+
annotations?: ModuleAnnotations | null;
|
|
28
|
+
tags?: string[] | null;
|
|
29
|
+
version?: string;
|
|
30
|
+
metadata?: Record<string, unknown> | null;
|
|
31
|
+
examples?: ModuleExample[] | null;
|
|
32
|
+
execute: (inputs: Record<string, unknown>, context: Context) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A high-level client that manages Registry and Executor.
|
|
36
|
+
*
|
|
37
|
+
* Provides a unified entry point for apcore, making it easier
|
|
38
|
+
* for beginners to get started without manually managing multiple objects.
|
|
39
|
+
*/
|
|
40
|
+
export declare class APCore {
|
|
41
|
+
readonly registry: Registry;
|
|
42
|
+
readonly executor: Executor;
|
|
43
|
+
readonly config: Config | null;
|
|
44
|
+
readonly metricsCollector: MetricsCollector | null;
|
|
45
|
+
private _sysModulesContext;
|
|
46
|
+
constructor(options?: APCoreOptions);
|
|
47
|
+
/**
|
|
48
|
+
* Create and register a FunctionModule.
|
|
49
|
+
*
|
|
50
|
+
* TypeScript version requires explicit schemas (no runtime type inference).
|
|
51
|
+
*/
|
|
52
|
+
module(options: ModuleOptions): FunctionModule;
|
|
53
|
+
/**
|
|
54
|
+
* Register a module object directly.
|
|
55
|
+
*/
|
|
56
|
+
register(moduleId: string, moduleObj: unknown): void;
|
|
57
|
+
/**
|
|
58
|
+
* Execute an async module call.
|
|
59
|
+
*/
|
|
60
|
+
call(moduleId: string, inputs?: Record<string, unknown> | null, context?: Context | null, versionHint?: string | null): Promise<Record<string, unknown>>;
|
|
61
|
+
/**
|
|
62
|
+
* Async module call (alias for call).
|
|
63
|
+
*/
|
|
64
|
+
callAsync(moduleId: string, inputs?: Record<string, unknown> | null, context?: Context | null, versionHint?: string | null): Promise<Record<string, unknown>>;
|
|
65
|
+
/**
|
|
66
|
+
* Stream module output chunk by chunk.
|
|
67
|
+
*/
|
|
68
|
+
stream(moduleId: string, inputs?: Record<string, unknown> | null, context?: Context | null, versionHint?: string | null): AsyncGenerator<Record<string, unknown>>;
|
|
69
|
+
/**
|
|
70
|
+
* Non-destructive preflight check without execution.
|
|
71
|
+
*/
|
|
72
|
+
validate(moduleId: string, inputs?: Record<string, unknown> | null, context?: Context | null): PreflightResult;
|
|
73
|
+
/**
|
|
74
|
+
* Get module description info (for AI/LLM use).
|
|
75
|
+
*/
|
|
76
|
+
describe(moduleId: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Add class-based middleware. Returns self for chaining.
|
|
79
|
+
*/
|
|
80
|
+
use(middleware: Middleware): APCore;
|
|
81
|
+
/**
|
|
82
|
+
* Add before function middleware. Returns self for chaining.
|
|
83
|
+
*/
|
|
84
|
+
useBefore(callback: (moduleId: string, inputs: Record<string, unknown>, context: Context) => Record<string, unknown> | null): APCore;
|
|
85
|
+
/**
|
|
86
|
+
* Add after function middleware. Returns self for chaining.
|
|
87
|
+
*/
|
|
88
|
+
useAfter(callback: (moduleId: string, inputs: Record<string, unknown>, output: Record<string, unknown>, context: Context) => Record<string, unknown> | null): APCore;
|
|
89
|
+
/**
|
|
90
|
+
* Remove middleware by identity. Returns true if found and removed.
|
|
91
|
+
*/
|
|
92
|
+
remove(middleware: Middleware): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Discover and register modules from configured extension directories.
|
|
95
|
+
*/
|
|
96
|
+
discover(): Promise<number>;
|
|
97
|
+
/**
|
|
98
|
+
* Return sorted list of registered module IDs, optionally filtered.
|
|
99
|
+
*/
|
|
100
|
+
listModules(options?: {
|
|
101
|
+
tags?: string[];
|
|
102
|
+
prefix?: string;
|
|
103
|
+
}): string[];
|
|
104
|
+
/**
|
|
105
|
+
* Access the event emitter (available when sys_modules.events is enabled).
|
|
106
|
+
*/
|
|
107
|
+
get events(): EventEmitter | null;
|
|
108
|
+
/**
|
|
109
|
+
* Subscribe to events of a specific type with a simple callback.
|
|
110
|
+
*
|
|
111
|
+
* Returns the subscriber for later unsubscription via off().
|
|
112
|
+
*/
|
|
113
|
+
on(eventType: string, handler: (event: ApCoreEvent) => void | Promise<void>): EventSubscriber;
|
|
114
|
+
/**
|
|
115
|
+
* Unsubscribe a previously registered event subscriber.
|
|
116
|
+
*/
|
|
117
|
+
off(subscriber: EventSubscriber): void;
|
|
118
|
+
/**
|
|
119
|
+
* Disable a module without unloading it.
|
|
120
|
+
* Convenience wrapper around system.control.toggle_feature.
|
|
121
|
+
*/
|
|
122
|
+
disable(moduleId: string, reason?: string): Promise<Record<string, unknown>>;
|
|
123
|
+
/**
|
|
124
|
+
* Re-enable a previously disabled module.
|
|
125
|
+
* Convenience wrapper around system.control.toggle_feature.
|
|
126
|
+
*/
|
|
127
|
+
enable(moduleId: string, reason?: string): Promise<Record<string, unknown>>;
|
|
128
|
+
private _requireSysModules;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAA0B,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE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MAAM,EAAE,MAAM,GAAE,MAAoC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAS9G,OAAO,CAAC,kBAAkB;CAO3B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level client for apcore to simplify interaction.
|
|
3
|
+
*/
|
|
4
|
+
import { module as createModule } from './decorator.js';
|
|
5
|
+
import { Executor } from './executor.js';
|
|
6
|
+
import { Registry } from './registry/registry.js';
|
|
7
|
+
import { registerSysModules } from './sys-modules/registration.js';
|
|
8
|
+
/**
|
|
9
|
+
* A high-level client that manages Registry and Executor.
|
|
10
|
+
*
|
|
11
|
+
* Provides a unified entry point for apcore, making it easier
|
|
12
|
+
* for beginners to get started without manually managing multiple objects.
|
|
13
|
+
*/
|
|
14
|
+
export class APCore {
|
|
15
|
+
registry;
|
|
16
|
+
executor;
|
|
17
|
+
config;
|
|
18
|
+
metricsCollector;
|
|
19
|
+
_sysModulesContext = {};
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.registry = options?.registry ?? new Registry();
|
|
22
|
+
this.config = options?.config ?? null;
|
|
23
|
+
this.metricsCollector = options?.metricsCollector ?? null;
|
|
24
|
+
this.executor = options?.executor ?? new Executor({
|
|
25
|
+
registry: this.registry,
|
|
26
|
+
config: this.config,
|
|
27
|
+
});
|
|
28
|
+
// Auto-register sys modules if config is provided and enabled
|
|
29
|
+
if (this.config) {
|
|
30
|
+
this._sysModulesContext = registerSysModules(this.registry, this.executor, this.config, options?.metricsCollector);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create and register a FunctionModule.
|
|
35
|
+
*
|
|
36
|
+
* TypeScript version requires explicit schemas (no runtime type inference).
|
|
37
|
+
*/
|
|
38
|
+
module(options) {
|
|
39
|
+
return createModule({
|
|
40
|
+
...options,
|
|
41
|
+
registry: this.registry,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Register a module object directly.
|
|
46
|
+
*/
|
|
47
|
+
register(moduleId, moduleObj) {
|
|
48
|
+
this.registry.register(moduleId, moduleObj);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Execute an async module call.
|
|
52
|
+
*/
|
|
53
|
+
async call(moduleId, inputs, context, versionHint) {
|
|
54
|
+
return this.executor.call(moduleId, inputs, context, versionHint);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Async module call (alias for call).
|
|
58
|
+
*/
|
|
59
|
+
async callAsync(moduleId, inputs, context, versionHint) {
|
|
60
|
+
return this.executor.call(moduleId, inputs, context, versionHint);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Stream module output chunk by chunk.
|
|
64
|
+
*/
|
|
65
|
+
async *stream(moduleId, inputs, context, versionHint) {
|
|
66
|
+
yield* this.executor.stream(moduleId, inputs, context, versionHint);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Non-destructive preflight check without execution.
|
|
70
|
+
*/
|
|
71
|
+
validate(moduleId, inputs, context) {
|
|
72
|
+
return this.executor.validate(moduleId, inputs, context);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get module description info (for AI/LLM use).
|
|
76
|
+
*/
|
|
77
|
+
describe(moduleId) {
|
|
78
|
+
return this.registry.describe(moduleId);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Add class-based middleware. Returns self for chaining.
|
|
82
|
+
*/
|
|
83
|
+
use(middleware) {
|
|
84
|
+
this.executor.use(middleware);
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Add before function middleware. Returns self for chaining.
|
|
89
|
+
*/
|
|
90
|
+
useBefore(callback) {
|
|
91
|
+
this.executor.useBefore(callback);
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Add after function middleware. Returns self for chaining.
|
|
96
|
+
*/
|
|
97
|
+
useAfter(callback) {
|
|
98
|
+
this.executor.useAfter(callback);
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Remove middleware by identity. Returns true if found and removed.
|
|
103
|
+
*/
|
|
104
|
+
remove(middleware) {
|
|
105
|
+
return this.executor.remove(middleware);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Discover and register modules from configured extension directories.
|
|
109
|
+
*/
|
|
110
|
+
async discover() {
|
|
111
|
+
return this.registry.discover();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Return sorted list of registered module IDs, optionally filtered.
|
|
115
|
+
*/
|
|
116
|
+
listModules(options) {
|
|
117
|
+
return this.registry.list(options);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Access the event emitter (available when sys_modules.events is enabled).
|
|
121
|
+
*/
|
|
122
|
+
get events() {
|
|
123
|
+
return this._sysModulesContext.eventEmitter ?? null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Subscribe to events of a specific type with a simple callback.
|
|
127
|
+
*
|
|
128
|
+
* Returns the subscriber for later unsubscription via off().
|
|
129
|
+
*/
|
|
130
|
+
on(eventType, handler) {
|
|
131
|
+
const emitter = this.events;
|
|
132
|
+
if (!emitter) {
|
|
133
|
+
throw new Error('Events are not enabled. Set sys_modules.enabled=true and '
|
|
134
|
+
+ 'sys_modules.events.enabled=true in config.');
|
|
135
|
+
}
|
|
136
|
+
const subscriber = {
|
|
137
|
+
onEvent(event) {
|
|
138
|
+
if (event.eventType === eventType) {
|
|
139
|
+
return handler(event);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
emitter.subscribe(subscriber);
|
|
144
|
+
return subscriber;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Unsubscribe a previously registered event subscriber.
|
|
148
|
+
*/
|
|
149
|
+
off(subscriber) {
|
|
150
|
+
const emitter = this.events;
|
|
151
|
+
if (!emitter) {
|
|
152
|
+
throw new Error('Events are not enabled. Set sys_modules.enabled=true and '
|
|
153
|
+
+ 'sys_modules.events.enabled=true in config.');
|
|
154
|
+
}
|
|
155
|
+
emitter.unsubscribe(subscriber);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Disable a module without unloading it.
|
|
159
|
+
* Convenience wrapper around system.control.toggle_feature.
|
|
160
|
+
*/
|
|
161
|
+
async disable(moduleId, reason = 'Disabled via APCore client') {
|
|
162
|
+
this._requireSysModules('disable');
|
|
163
|
+
return this.executor.call('system.control.toggle_feature', {
|
|
164
|
+
module_id: moduleId,
|
|
165
|
+
enabled: false,
|
|
166
|
+
reason,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Re-enable a previously disabled module.
|
|
171
|
+
* Convenience wrapper around system.control.toggle_feature.
|
|
172
|
+
*/
|
|
173
|
+
async enable(moduleId, reason = 'Enabled via APCore client') {
|
|
174
|
+
this._requireSysModules('enable');
|
|
175
|
+
return this.executor.call('system.control.toggle_feature', {
|
|
176
|
+
module_id: moduleId,
|
|
177
|
+
enabled: true,
|
|
178
|
+
reason,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
_requireSysModules(method) {
|
|
182
|
+
if (!this._sysModulesContext.eventEmitter) {
|
|
183
|
+
throw new Error(`Cannot call ${method}(): sys_modules with events must be enabled in config.`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAkB,MAAM,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB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AAgB,EAAE,SAAiB,4BAA4B;QAC3E,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,+BAA+B,EAAE;YACzD,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,KAAK;YACd,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,SAAiB,2BAA2B;QACzE,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,+BAA+B,EAAE;YACzD,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,IAAI;YACb,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAEO,kBAAkB,CAAC,MAAc;QACvC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,eAAe,MAAM,wDAAwD,CAC9E,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -46,6 +46,10 @@ export declare class ModuleNotFoundError extends ModuleError {
|
|
|
46
46
|
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
47
47
|
constructor(moduleId: string, options?: ErrorOptions);
|
|
48
48
|
}
|
|
49
|
+
export declare class ModuleDisabledError extends ModuleError {
|
|
50
|
+
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
51
|
+
constructor(moduleId: string, options?: ErrorOptions);
|
|
52
|
+
}
|
|
49
53
|
export declare class ModuleTimeoutError extends ModuleError {
|
|
50
54
|
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
51
55
|
constructor(moduleId: string, timeoutMs: number, options?: ErrorOptions);
|
|
@@ -126,10 +130,22 @@ export declare class CircularDependencyError extends ModuleError {
|
|
|
126
130
|
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
127
131
|
constructor(cyclePath: string[], options?: ErrorOptions);
|
|
128
132
|
}
|
|
133
|
+
export declare class DependencyNotFoundError extends ModuleError {
|
|
134
|
+
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
135
|
+
constructor(moduleId: string, dependencyId: string, options?: ErrorOptions);
|
|
136
|
+
}
|
|
137
|
+
export declare class FeatureNotImplementedError extends ModuleError {
|
|
138
|
+
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
139
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
140
|
+
}
|
|
129
141
|
export declare class ModuleLoadError extends ModuleError {
|
|
130
142
|
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
131
143
|
constructor(moduleId: string, reason: string, options?: ErrorOptions);
|
|
132
144
|
}
|
|
145
|
+
export declare class ReloadFailedError extends ModuleError {
|
|
146
|
+
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
147
|
+
constructor(moduleId: string, reason: string, options?: ErrorOptions);
|
|
148
|
+
}
|
|
133
149
|
export declare class ModuleExecuteError extends ModuleError {
|
|
134
150
|
static readonly DEFAULT_RETRYABLE: boolean | null;
|
|
135
151
|
constructor(moduleId: string, reason: string, options?: ErrorOptions);
|
|
@@ -172,8 +188,10 @@ export declare const ErrorCodes: Readonly<{
|
|
|
172
188
|
readonly ACL_RULE_ERROR: "ACL_RULE_ERROR";
|
|
173
189
|
readonly ACL_DENIED: "ACL_DENIED";
|
|
174
190
|
readonly MODULE_NOT_FOUND: "MODULE_NOT_FOUND";
|
|
191
|
+
readonly MODULE_DISABLED: "MODULE_DISABLED";
|
|
175
192
|
readonly MODULE_TIMEOUT: "MODULE_TIMEOUT";
|
|
176
193
|
readonly MODULE_LOAD_ERROR: "MODULE_LOAD_ERROR";
|
|
194
|
+
readonly RELOAD_FAILED: "RELOAD_FAILED";
|
|
177
195
|
readonly MODULE_EXECUTE_ERROR: "MODULE_EXECUTE_ERROR";
|
|
178
196
|
readonly SCHEMA_VALIDATION_ERROR: "SCHEMA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AyB,iBAAiB,EAAE,OAAO,GAAG,IAAI,CAAS;gBAEvD,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAW,EAAE,OAAO,CAAC,EAAE,YAAY;IAO1E,IAAI,UAAU,IAAI,MAAM,GAAG,IAAI,CAE9B;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCZ,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -99,6 +99,13 @@ export class ModuleNotFoundError extends ModuleError {
|
|
|
99
99
|
this.name = 'ModuleNotFoundError';
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
export class ModuleDisabledError extends ModuleError {
|
|
103
|
+
static DEFAULT_RETRYABLE = false;
|
|
104
|
+
constructor(moduleId, options) {
|
|
105
|
+
super('MODULE_DISABLED', `Module is disabled: ${moduleId}`, { moduleId }, options?.cause, options?.traceId, options?.retryable, options?.aiGuidance, options?.userFixable, options?.suggestion);
|
|
106
|
+
this.name = 'ModuleDisabledError';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
102
109
|
export class ModuleTimeoutError extends ModuleError {
|
|
103
110
|
static DEFAULT_RETRYABLE = true;
|
|
104
111
|
constructor(moduleId, timeoutMs, options) {
|
|
@@ -249,6 +256,20 @@ export class CircularDependencyError extends ModuleError {
|
|
|
249
256
|
this.name = 'CircularDependencyError';
|
|
250
257
|
}
|
|
251
258
|
}
|
|
259
|
+
export class DependencyNotFoundError extends ModuleError {
|
|
260
|
+
static DEFAULT_RETRYABLE = false;
|
|
261
|
+
constructor(moduleId, dependencyId, options) {
|
|
262
|
+
super('DEPENDENCY_NOT_FOUND', `Dependency '${dependencyId}' not found for module '${moduleId}'`, { moduleId, dependencyId }, options?.cause, options?.traceId, options?.retryable, options?.aiGuidance, options?.userFixable, options?.suggestion);
|
|
263
|
+
this.name = 'DependencyNotFoundError';
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
export class FeatureNotImplementedError extends ModuleError {
|
|
267
|
+
static DEFAULT_RETRYABLE = false;
|
|
268
|
+
constructor(message = 'Feature not implemented', options) {
|
|
269
|
+
super('GENERAL_NOT_IMPLEMENTED', message, {}, options?.cause, options?.traceId, options?.retryable, options?.aiGuidance, options?.userFixable, options?.suggestion);
|
|
270
|
+
this.name = 'FeatureNotImplementedError';
|
|
271
|
+
}
|
|
272
|
+
}
|
|
252
273
|
export class ModuleLoadError extends ModuleError {
|
|
253
274
|
static DEFAULT_RETRYABLE = false;
|
|
254
275
|
constructor(moduleId, reason, options) {
|
|
@@ -256,6 +277,13 @@ export class ModuleLoadError extends ModuleError {
|
|
|
256
277
|
this.name = 'ModuleLoadError';
|
|
257
278
|
}
|
|
258
279
|
}
|
|
280
|
+
export class ReloadFailedError extends ModuleError {
|
|
281
|
+
static DEFAULT_RETRYABLE = true;
|
|
282
|
+
constructor(moduleId, reason, options) {
|
|
283
|
+
super('RELOAD_FAILED', `Failed to reload module '${moduleId}': ${reason}`, { moduleId, reason }, options?.cause, options?.traceId, options?.retryable, options?.aiGuidance, options?.userFixable, options?.suggestion);
|
|
284
|
+
this.name = 'ReloadFailedError';
|
|
285
|
+
}
|
|
286
|
+
}
|
|
259
287
|
export class ModuleExecuteError extends ModuleError {
|
|
260
288
|
static DEFAULT_RETRYABLE = null;
|
|
261
289
|
constructor(moduleId, reason, options) {
|
|
@@ -331,8 +359,10 @@ export const ErrorCodes = Object.freeze({
|
|
|
331
359
|
ACL_RULE_ERROR: "ACL_RULE_ERROR",
|
|
332
360
|
ACL_DENIED: "ACL_DENIED",
|
|
333
361
|
MODULE_NOT_FOUND: "MODULE_NOT_FOUND",
|
|
362
|
+
MODULE_DISABLED: "MODULE_DISABLED",
|
|
334
363
|
MODULE_TIMEOUT: "MODULE_TIMEOUT",
|
|
335
364
|
MODULE_LOAD_ERROR: "MODULE_LOAD_ERROR",
|
|
365
|
+
RELOAD_FAILED: "RELOAD_FAILED",
|
|
336
366
|
MODULE_EXECUTE_ERROR: "MODULE_EXECUTE_ERROR",
|
|
337
367
|
SCHEMA_VALIDATION_ERROR: "SCHEMA_VALIDATION_ERROR",
|
|
338
368
|
SCHEMA_NOT_FOUND: "SCHEMA_NOT_FOUND",
|
|
@@ -358,8 +388,6 @@ export const ErrorCodes = Object.freeze({
|
|
|
358
388
|
APPROVAL_PENDING: "APPROVAL_PENDING",
|
|
359
389
|
VERSION_INCOMPATIBLE: "VERSION_INCOMPATIBLE",
|
|
360
390
|
ERROR_CODE_COLLISION: "ERROR_CODE_COLLISION",
|
|
361
|
-
// Forward declarations for Level 2 Phase 2 features.
|
|
362
|
-
// Exception classes will be added when the corresponding features are implemented.
|
|
363
391
|
GENERAL_NOT_IMPLEMENTED: "GENERAL_NOT_IMPLEMENTED",
|
|
364
392
|
DEPENDENCY_NOT_FOUND: "DEPENDENCY_NOT_FOUND",
|
|
365
393
|
});
|