nestjs-apcore 0.1.0 → 0.3.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.
Files changed (36) hide show
  1. package/README.md +78 -56
  2. package/dist/bridge/binding-loader.d.ts +2 -2
  3. package/dist/bridge/binding-loader.d.ts.map +1 -1
  4. package/dist/bridge/binding-loader.js +16 -30
  5. package/dist/bridge/binding-loader.js.map +1 -1
  6. package/dist/core/apcore-executor.service.d.ts +7 -3
  7. package/dist/core/apcore-executor.service.d.ts.map +1 -1
  8. package/dist/core/apcore-executor.service.js +7 -3
  9. package/dist/core/apcore-executor.service.js.map +1 -1
  10. package/dist/core/apcore-registry.service.d.ts +26 -9
  11. package/dist/core/apcore-registry.service.d.ts.map +1 -1
  12. package/dist/core/apcore-registry.service.js +71 -38
  13. package/dist/core/apcore-registry.service.js.map +1 -1
  14. package/dist/core/apcore.module.d.ts +4 -1
  15. package/dist/core/apcore.module.d.ts.map +1 -1
  16. package/dist/core/apcore.module.js +20 -2
  17. package/dist/core/apcore.module.js.map +1 -1
  18. package/dist/decorators/ap-tool-scanner.service.d.ts +46 -7
  19. package/dist/decorators/ap-tool-scanner.service.d.ts.map +1 -1
  20. package/dist/decorators/ap-tool-scanner.service.js +110 -56
  21. package/dist/decorators/ap-tool-scanner.service.js.map +1 -1
  22. package/dist/index.d.ts +8 -3
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +6 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/mcp/apcore-mcp.service.d.ts +21 -3
  27. package/dist/mcp/apcore-mcp.service.d.ts.map +1 -1
  28. package/dist/mcp/apcore-mcp.service.js +58 -41
  29. package/dist/mcp/apcore-mcp.service.js.map +1 -1
  30. package/dist/types.d.ts +23 -4
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/utils/module-factory.d.ts +29 -0
  33. package/dist/utils/module-factory.d.ts.map +1 -0
  34. package/dist/utils/module-factory.js +45 -0
  35. package/dist/utils/module-factory.js.map +1 -0
  36. package/package.json +8 -3
package/README.md CHANGED
@@ -5,7 +5,8 @@ NestJS adapter for the [apcore](https://github.com/aipartnerup/apcore-js) AI-Per
5
5
  ## Features
6
6
 
7
7
  - **Decorator-driven** — Mark methods with `@ApTool` and classes with `@ApModule` to expose them as AI tools
8
- - **Auto-discovery** — `ApToolScannerService` scans all providers at startup and registers decorated methods automatically
8
+ - **Auto-discovery** — tools are scanned and registered at startup automatically
9
+ - **One-stop setup** — `ApcoreModule.forRoot()` handles Registry, Executor, Scanner, and optional MCP server in a single call
9
10
  - **Multi-schema support** — TypeBox, Zod, class-validator DTOs, and plain JSON Schema, auto-detected via a priority chain
10
11
  - **MCP server built-in** — Serve tools over stdio, Streamable HTTP, or SSE transports with optional Tool Explorer UI
11
12
  - **OpenAI-compatible** — Convert registered tools to OpenAI function-calling format with `toOpenaiTools()`
@@ -36,26 +37,26 @@ npm install @sinclair/typebox # TypeBoxAdapter (recommended)
36
37
 
37
38
  ## Quick Start
38
39
 
39
- ### 1. Wire up modules
40
+ ### 1. Wire up the module
40
41
 
41
42
  ```typescript
42
43
  // app.module.ts
43
44
  import { Module } from '@nestjs/common';
44
- import { ApcoreModule, ApcoreMcpModule, ApToolScannerService } from 'nestjs-apcore';
45
+ import { ApcoreModule } from 'nestjs-apcore';
45
46
 
46
47
  @Module({
47
48
  imports: [
48
- ApcoreModule.forRoot({}),
49
- ApcoreMcpModule.forRoot({
50
- transport: 'streamable-http',
51
- port: 8000,
52
- name: 'my-app',
53
- version: '1.0.0',
54
- explorer: true,
49
+ ApcoreModule.forRoot({
50
+ mcp: {
51
+ transport: 'streamable-http',
52
+ port: 8000,
53
+ name: 'my-app',
54
+ explorer: true,
55
+ allowExecute: true,
56
+ },
55
57
  }),
56
58
  TodoModule,
57
59
  ],
58
- providers: [ApToolScannerService],
59
60
  })
60
61
  export class AppModule {}
61
62
  ```
@@ -127,47 +128,64 @@ Your service is now available as:
127
128
 
128
129
  ## API Reference
129
130
 
130
- ### Modules
131
+ ### ApcoreModule
131
132
 
132
- #### `ApcoreModule`
133
-
134
- Provides the core `Registry` and `Executor` as NestJS singletons.
133
+ The single entry point. Provides the core `Registry`, `Executor`, and `ApToolScannerService` as global NestJS singletons. Optionally integrates the MCP server.
135
134
 
136
135
  ```typescript
137
- // Sync
138
- ApcoreModule.forRoot({ extensionsDir?, acl?, middleware?, bindings? })
136
+ // Sync — with MCP server
137
+ ApcoreModule.forRoot({
138
+ extensionsDir?: string | null,
139
+ acl?: unknown,
140
+ middleware?: unknown[],
141
+ mcp?: ApcoreMcpModuleOptions, // if provided, MCP server starts automatically
142
+ })
143
+
144
+ // Sync — without MCP (Registry + Executor only)
145
+ ApcoreModule.forRoot()
139
146
 
140
147
  // Async (e.g. inject ConfigService)
141
- ApcoreModule.forRootAsync({ imports, useFactory, inject })
148
+ ApcoreModule.forRootAsync({
149
+ imports: [ConfigModule],
150
+ useFactory: (config: ConfigService) => ({
151
+ extensionsDir: config.get('EXTENSIONS_DIR'),
152
+ }),
153
+ inject: [ConfigService],
154
+ mcp: { transport: 'streamable-http', port: 8000 }, // static, evaluated at definition time
155
+ })
142
156
  ```
143
157
 
144
- #### `ApcoreMcpModule`
158
+ #### MCP Options
145
159
 
146
- Configures and starts the MCP server.
147
-
148
- The MCP server runs **standalone on its own port** (e.g. 8000), separate from NestJS's REST server (e.g. 3000). Both share the same Registry and Executor instances.
160
+ | Field | Type | Description |
161
+ |---|---|---|
162
+ | `transport` | `'stdio' \| 'streamable-http' \| 'sse'` | Transport protocol |
163
+ | `host` | `string` | Bind host |
164
+ | `port` | `number` | Bind port |
165
+ | `name` | `string` | Server name |
166
+ | `version` | `string` | Server version |
167
+ | `explorer` | `boolean` | Enable Tool Explorer web UI |
168
+ | `allowExecute` | `boolean` | Allow tool execution from Explorer |
169
+ | `authenticator` | `Authenticator` | JWT or custom auth strategy |
170
+ | `tags` | `string[]` | Only expose tools with these tags |
171
+ | `prefix` | `string` | Only expose tools with this ID prefix |
172
+ | `logLevel` | `string` | `'DEBUG' \| 'INFO' \| 'WARNING' \| 'ERROR' \| 'CRITICAL'` |
173
+ | `metricsCollector` | `MetricsExporter` | Enables `/metrics` Prometheus endpoint |
174
+ | `onStartup` | `() => void` | Callback after server starts |
175
+ | `onShutdown` | `() => void` | Callback before server stops |
176
+
177
+ #### Standalone MCP Module
178
+
179
+ If you prefer to configure the MCP server separately (e.g. different lifecycle), you can import `ApcoreMcpModule` directly:
149
180
 
150
181
  ```typescript
151
- ApcoreMcpModule.forRoot({
152
- transport: 'stdio' | 'streamable-http' | 'sse',
153
- host?: string,
154
- port?: number,
155
- name?: string,
156
- version?: string,
157
- tags?: string[], // only expose tools matching these tags
158
- prefix?: string, // only expose tools with this ID prefix
159
- explorer?: boolean, // enable Tool Explorer web UI
160
- explorerPrefix?: string, // URL prefix for the Explorer
161
- allowExecute?: boolean, // allow execution from Explorer
162
- dynamic?: boolean, // enable dynamic tool list updates
163
- validateInputs?: boolean,
164
- logLevel?: 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR' | 'CRITICAL',
165
- authenticator?: Authenticator, // JWT or custom auth
166
- exemptPaths?: string[], // paths that bypass auth (default: ['/health', '/metrics'])
167
- metricsCollector?: { exportPrometheus(): string },
168
- onStartup?: () => void | Promise<void>,
169
- onShutdown?: () => void | Promise<void>,
182
+ @Module({
183
+ imports: [
184
+ ApcoreModule.forRoot(),
185
+ ApcoreMcpModule.forRoot({ transport: 'streamable-http', port: 8000 }),
186
+ ],
170
187
  })
188
+ export class AppModule {}
171
189
  ```
172
190
 
173
191
  ### Decorators
@@ -242,17 +260,20 @@ bindings:
242
260
 
243
261
  ### JWT Authentication
244
262
 
245
- Enable JWT auth by passing a `JWTAuthenticator` to `ApcoreMcpModule`. The Explorer UI and `/health` endpoint are always exempt.
263
+ Enable JWT auth by passing a `JWTAuthenticator` in the `mcp` config. The Explorer UI and `/health` endpoint are always exempt.
246
264
 
247
265
  ```typescript
248
- import { JWTAuthenticator, getCurrentIdentity } from 'nestjs-apcore';
266
+ import { ApcoreModule, JWTAuthenticator, getCurrentIdentity } from 'nestjs-apcore';
249
267
 
250
268
  // In app.module.ts
251
- const jwtSecret = process.env.JWT_SECRET;
252
- ApcoreMcpModule.forRoot({
253
- transport: 'streamable-http',
254
- port: 8000,
255
- authenticator: jwtSecret ? new JWTAuthenticator({ secret: jwtSecret }) : undefined,
269
+ ApcoreModule.forRoot({
270
+ mcp: {
271
+ transport: 'streamable-http',
272
+ port: 8000,
273
+ authenticator: process.env.JWT_SECRET
274
+ ? new JWTAuthenticator({ secret: process.env.JWT_SECRET })
275
+ : undefined,
276
+ },
256
277
  })
257
278
 
258
279
  // Inside any @ApTool method
@@ -262,8 +283,6 @@ list(inputs: Record<string, unknown>) {
262
283
  }
263
284
  ```
264
285
 
265
- `JWTAuthenticator` options: `secret`, `algorithms` (default `['HS256']`), `audience`, `issuer`, `claimMapping`, `requireClaims`, `requireAuth` (default `true`).
266
-
267
286
  ### Re-exported Utilities
268
287
 
269
288
  From `apcore-mcp`:
@@ -272,7 +291,7 @@ From `apcore-mcp`:
272
291
 
273
292
  ## Examples
274
293
 
275
- The `demo/` directory contains a full working app with Todo and Weather services:
294
+ The [`demo/`](./demo) directory contains a full working app with Todo and Weather services:
276
295
 
277
296
  ```bash
278
297
  cd demo
@@ -280,12 +299,15 @@ npm install
280
299
  npx tsx src/main.ts
281
300
  ```
282
301
 
283
- Or with Docker:
302
+ ## Detailed Documentation
284
303
 
285
- ```bash
286
- cd demo
287
- docker compose up --build
288
- ```
304
+ For in-depth documentation on each subsystem, see [`docs/features/`](./docs/features/):
305
+
306
+ - [Feature Overview](./docs/features/overview.md) — architecture and dependency graph
307
+ - [MCP Server Integration](./docs/features/mcp-server-integration.md) — module configuration, services API, dual-server architecture
308
+ - [@ApTool Decorator + Scanner](./docs/features/aptool-decorator-scanner.md) — decorators, ID generation, scan process
309
+ - [Schema Extraction](./docs/features/schema-extraction.md) — adapter chain, supported types, custom adapters
310
+ - [NestJS DI Bridge](./docs/features/di-bridge.md) — `registerMethod()`, `registerService()`, YAML bindings
289
311
 
290
312
  ## Scripts
291
313
 
@@ -7,8 +7,8 @@ export type InstanceProvider = (className: string) => object | undefined;
7
7
  * NestJS injectable service that loads YAML binding files and registers
8
8
  * modules with the ApcoreRegistryService.
9
9
  *
10
- * Each binding maps a module_id to a "ClassName.methodName" target,
11
- * optionally providing schema, annotations, tags, and documentation.
10
+ * Uses apcore-toolkit's {@link createScannedModule} to produce standardised
11
+ * intermediates, then converts to FunctionModule via the shared factory.
12
12
  */
13
13
  export declare class ApBindingLoader {
14
14
  private readonly registry;
@@ -1 +1 @@
1
- {"version":3,"file":"binding-loader.d.ts","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAuB3E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AAmBzE;;;;;;GAMG;AACH,qBACa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAGzB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAHjB,QAAQ,EAAE,qBAAqB,EAG/B,gBAAgB,CAAC,EAAE,gBAAgB,YAAA;IAGtD;;;;;;OAMG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAkDzC;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAIxD"}
1
+ {"version":3,"file":"binding-loader.d.ts","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AA2B3E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AAEzE;;;;;;GAMG;AACH,qBACa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAGzB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAHjB,QAAQ,EAAE,qBAAqB,EAG/B,gBAAgB,CAAC,EAAE,gBAAgB,YAAA;IAGtD;;;;;;OAMG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAmDzC;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAIxD"}
@@ -13,31 +13,16 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  import { Injectable, Inject, Optional } from '@nestjs/common';
14
14
  import * as yaml from 'js-yaml';
15
15
  import { readFile } from 'node:fs/promises';
16
- import { Type as t } from '@sinclair/typebox';
17
- import { FunctionModule } from 'apcore-js';
16
+ import { normalizeResult } from 'apcore-js';
17
+ import { createScannedModule } from 'apcore-toolkit';
18
18
  import { ApcoreRegistryService } from '../core/apcore-registry.service.js';
19
- /**
20
- * Normalize a method return value to a Record<string, unknown>.
21
- *
22
- * - null / undefined -> {}
23
- * - non-object (string, number, boolean) or array -> { result: value }
24
- * - object -> returned as-is
25
- */
26
- function normalizeReturnValue(value) {
27
- if (value == null) {
28
- return {};
29
- }
30
- if (typeof value !== 'object' || Array.isArray(value)) {
31
- return { result: value };
32
- }
33
- return value;
34
- }
19
+ import { scannedModuleToFunctionModule, toModuleAnnotations, } from '../utils/module-factory.js';
35
20
  /**
36
21
  * NestJS injectable service that loads YAML binding files and registers
37
22
  * modules with the ApcoreRegistryService.
38
23
  *
39
- * Each binding maps a module_id to a "ClassName.methodName" target,
40
- * optionally providing schema, annotations, tags, and documentation.
24
+ * Uses apcore-toolkit's {@link createScannedModule} to produce standardised
25
+ * intermediates, then converts to FunctionModule via the shared factory.
41
26
  */
42
27
  let ApBindingLoader = class ApBindingLoader {
43
28
  registry;
@@ -65,12 +50,12 @@ let ApBindingLoader = class ApBindingLoader {
65
50
  if (this.instanceProvider) {
66
51
  instance = this.instanceProvider(className);
67
52
  }
68
- // Build the execute function
53
+ // Build the bound execute function
69
54
  let execute;
70
55
  if (instance && methodName in instance) {
71
56
  execute = async (inputs) => {
72
57
  const raw = await instance[methodName](inputs);
73
- return normalizeReturnValue(raw);
58
+ return normalizeResult(raw);
74
59
  };
75
60
  }
76
61
  else {
@@ -80,18 +65,19 @@ let ApBindingLoader = class ApBindingLoader {
80
65
  };
81
66
  };
82
67
  }
83
- const funcModule = new FunctionModule({
68
+ // Build ScannedModule intermediate via toolkit
69
+ const scanned = createScannedModule({
84
70
  moduleId,
85
71
  description: binding.description,
86
- inputSchema: binding.input_schema ?? t.Object({}),
87
- outputSchema: binding.output_schema ?? t.Object({}),
88
- tags: binding.tags ?? null,
89
- annotations: binding.annotations ?? null,
72
+ inputSchema: binding.input_schema ?? { type: 'object', properties: {} },
73
+ outputSchema: binding.output_schema ?? { type: 'object', properties: {} },
74
+ tags: binding.tags ?? [],
75
+ target: binding.target,
76
+ annotations: toModuleAnnotations(binding.annotations),
90
77
  documentation: binding.documentation ?? null,
91
- examples: null,
92
- execute,
93
78
  });
94
- this.registry.register(moduleId, funcModule);
79
+ const fm = scannedModuleToFunctionModule(scanned, execute);
80
+ this.registry.register(moduleId, fm);
95
81
  ids.push(moduleId);
96
82
  }
97
83
  return ids;
@@ -1 +1 @@
1
- {"version":3,"file":"binding-loader.js","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAA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,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACrC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,QAAgB;QACjC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACF,CAAA;AA7EY,eAAe;IAD3B,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAE7B,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,MAAM,CAAC,0BAA0B,CAAC,CAAA;qCAFR,qBAAqB;GAHvC,eAAe,CA6E3B"}
@@ -1,5 +1,5 @@
1
1
  import type { Executor } from 'apcore-js';
2
- import type { Context, ValidationResult } from 'apcore-js';
2
+ import type { Context, PreflightResult } from 'apcore-js';
3
3
  /**
4
4
  * NestJS-injectable wrapper around the upstream apcore-js {@link Executor}.
5
5
  *
@@ -34,9 +34,13 @@ export declare class ApcoreExecutorService {
34
34
  /**
35
35
  * Validate inputs against a module's input schema without executing it.
36
36
  *
37
+ * Returns a PreflightResult containing per-check results, approval
38
+ * requirements, and overall validity.
39
+ *
37
40
  * @param moduleId Fully-qualified module identifier.
38
- * @param inputs Key/value inputs to validate.
41
+ * @param inputs Key/value inputs to validate (defaults to `{}`).
42
+ * @param context Optional execution context for call-chain checks.
39
43
  */
40
- validate(moduleId: string, inputs: Record<string, unknown>): ValidationResult;
44
+ validate(moduleId: string, inputs?: Record<string, unknown>, context?: Context | null): PreflightResult;
41
45
  }
42
46
  //# sourceMappingURL=apcore-executor.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apcore-executor.service.d.ts","sourceRoot":"","sources":["../../src/core/apcore-executor.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;GAKG;AACH,qBACa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAM/C,yDAAyD;IACzD,IAAI,GAAG,IAAI,QAAQ,CAElB;IAED;;;;;;;OAOG;IACG,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAInC;;;;;;;;;OASG;IACI,MAAM,CACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACvB,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI1C;;;;;OAKG;IACH,QAAQ,CACN,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,gBAAgB;CAGpB"}
1
+ {"version":3,"file":"apcore-executor.service.d.ts","sourceRoot":"","sources":["../../src/core/apcore-executor.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE1D;;;;;GAKG;AACH,qBACa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAM/C,yDAAyD;IACzD,IAAI,GAAG,IAAI,QAAQ,CAElB;IAED;;;;;;;OAOG;IACG,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAInC;;;;;;;;;OASG;IACI,MAAM,CACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACvB,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI1C;;;;;;;;;OASG;IACH,QAAQ,CACN,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACvB,eAAe;CAGnB"}
@@ -53,11 +53,15 @@ let ApcoreExecutorService = class ApcoreExecutorService {
53
53
  /**
54
54
  * Validate inputs against a module's input schema without executing it.
55
55
  *
56
+ * Returns a PreflightResult containing per-check results, approval
57
+ * requirements, and overall validity.
58
+ *
56
59
  * @param moduleId Fully-qualified module identifier.
57
- * @param inputs Key/value inputs to validate.
60
+ * @param inputs Key/value inputs to validate (defaults to `{}`).
61
+ * @param context Optional execution context for call-chain checks.
58
62
  */
59
- validate(moduleId, inputs) {
60
- return this.executor.validate(moduleId, inputs);
63
+ validate(moduleId, inputs, context) {
64
+ return this.executor.validate(moduleId, inputs ?? {}, context);
61
65
  }
62
66
  };
63
67
  ApcoreExecutorService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"apcore-executor.service.js","sourceRoot":"","sources":["../../src/core/apcore-executor.service.ts"],"names":[],"mappings":";;;;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E;IAC1E,aAAa;IACb,0EAA0E;IAE1E,yDAAyD;IACzD,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CACR,QAAgB,EAChB,MAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,CAAC,MAAM,CACX,QAAgB,EAChB,MAAuC,EACvC,OAAwB;QAExB,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CACN,QAAgB,EAChB,MAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;CACF,CAAA;AA/DY,qBAAqB;IADjC,UAAU,EAAE;;GACA,qBAAqB,CA+DjC"}
@@ -1,10 +1,12 @@
1
1
  import type { Registry } from 'apcore-js';
2
2
  import type { ModuleDescriptor } from 'apcore-js';
3
+ import type { ScannedModule } from 'apcore-toolkit';
3
4
  import type { RegisterMethodOptions, RegisterServiceOptions } from '../types.js';
4
5
  /**
5
6
  * NestJS-injectable service that wraps an upstream apcore-js Registry,
6
7
  * delegating core operations and adding convenience methods for
7
- * registering NestJS service methods as FunctionModules.
8
+ * registering NestJS service methods via apcore-toolkit's ScannedModule
9
+ * intermediate representation.
8
10
  */
9
11
  export declare class ApcoreRegistryService {
10
12
  private readonly registry;
@@ -24,16 +26,31 @@ export declare class ApcoreRegistryService {
24
26
  discover(): Promise<number>;
25
27
  get count(): number;
26
28
  /**
27
- * Register a single method from a service instance as a FunctionModule.
29
+ * Convert a registered module's descriptor to a toolkit ScannedModule.
30
+ *
31
+ * Returns `null` if the module is not found.
32
+ */
33
+ toScannedModule(moduleId: string): ScannedModule | null;
34
+ /**
35
+ * Serialise a registered module to a plain snake_case dictionary
36
+ * via apcore-toolkit's `moduleToDict()`.
28
37
  *
29
- * Generates a module ID from the class name + method name when no
30
- * explicit id is provided (e.g. EmailService.sendEmail -> email.send_email).
38
+ * Returns `null` if the module is not found.
39
+ */
40
+ toDict(moduleId: string): Record<string, unknown> | null;
41
+ /**
42
+ * Serialise all registered modules (optionally filtered by tags/prefix)
43
+ * to an array of snake_case dictionaries via apcore-toolkit.
44
+ */
45
+ toDicts(options?: {
46
+ tags?: string[];
47
+ prefix?: string;
48
+ }): Record<string, unknown>[];
49
+ /**
50
+ * Register a single method from a service instance as a FunctionModule.
31
51
  *
32
- * The execute function calls the method on the bound instance and
33
- * normalizes the return value:
34
- * - null / undefined -> {}
35
- * - non-object -> { result: value }
36
- * - object -> returned as-is
52
+ * Produces a toolkit {@link ScannedModule} intermediate, then converts it
53
+ * to a FunctionModule with the method bound to the service instance.
37
54
  *
38
55
  * @returns The module ID under which the method was registered.
39
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"apcore-registry.service.d.ts","sourceRoot":"","sources":["../../src/core/apcore-registry.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AA+CjF;;;;GAIG;AACH,qBACa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAI/C,yDAAyD;IACzD,IAAI,GAAG,IAAI,QAAQ,CAElB;IAID,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE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metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { Injectable } from '@nestjs/common';
11
- import { Type as t } from '@sinclair/typebox';
12
- import { FunctionModule } from 'apcore-js';
11
+ import { normalizeResult } from 'apcore-js';
12
+ import { createScannedModule, moduleToDict, modulesToDicts } from 'apcore-toolkit';
13
13
  import { normalizeClassName, normalizeMethodName, generateModuleId, } from '../utils/id-generator.js';
14
- /**
15
- * Normalize a method return value to a Record<string, unknown>.
16
- *
17
- * - null / undefined -> {}
18
- * - non-object (string, number, boolean) -> { result: value }
19
- * - object -> returned as-is
20
- */
21
- function normalizeReturnValue(value) {
22
- if (value == null) {
23
- return {};
24
- }
25
- if (typeof value !== 'object' || Array.isArray(value)) {
26
- return { result: value };
27
- }
28
- return value;
29
- }
14
+ import { scannedModuleToFunctionModule, toModuleAnnotations, } from '../utils/module-factory.js';
30
15
  /**
31
16
  * Collect all own method names from a prototype chain up to (but not
32
17
  * including) Object.prototype. Excludes 'constructor'.
@@ -48,7 +33,8 @@ function getAllMethodNames(instance) {
48
33
  /**
49
34
  * NestJS-injectable service that wraps an upstream apcore-js Registry,
50
35
  * delegating core operations and adding convenience methods for
51
- * registering NestJS service methods as FunctionModules.
36
+ * registering NestJS service methods via apcore-toolkit's ScannedModule
37
+ * intermediate representation.
52
38
  */
53
39
  let ApcoreRegistryService = class ApcoreRegistryService {
54
40
  registry;
@@ -88,18 +74,61 @@ let ApcoreRegistryService = class ApcoreRegistryService {
88
74
  get count() {
89
75
  return this.registry.count;
90
76
  }
77
+ // ---- serialisation helpers (via apcore-toolkit) ----
78
+ /**
79
+ * Convert a registered module's descriptor to a toolkit ScannedModule.
80
+ *
81
+ * Returns `null` if the module is not found.
82
+ */
83
+ toScannedModule(moduleId) {
84
+ const def = this.registry.getDefinition(moduleId);
85
+ if (!def)
86
+ return null;
87
+ return createScannedModule({
88
+ moduleId: def.moduleId,
89
+ description: def.description,
90
+ inputSchema: def.inputSchema,
91
+ outputSchema: def.outputSchema,
92
+ tags: def.tags ?? [],
93
+ target: moduleId,
94
+ annotations: def.annotations ?? null,
95
+ documentation: def.documentation ?? null,
96
+ examples: (def.examples ?? []),
97
+ metadata: def.metadata ?? {},
98
+ });
99
+ }
100
+ /**
101
+ * Serialise a registered module to a plain snake_case dictionary
102
+ * via apcore-toolkit's `moduleToDict()`.
103
+ *
104
+ * Returns `null` if the module is not found.
105
+ */
106
+ toDict(moduleId) {
107
+ const scanned = this.toScannedModule(moduleId);
108
+ if (!scanned)
109
+ return null;
110
+ return moduleToDict(scanned);
111
+ }
112
+ /**
113
+ * Serialise all registered modules (optionally filtered by tags/prefix)
114
+ * to an array of snake_case dictionaries via apcore-toolkit.
115
+ */
116
+ toDicts(options) {
117
+ const ids = this.registry.list(options);
118
+ const scanned = [];
119
+ for (const id of ids) {
120
+ const s = this.toScannedModule(id);
121
+ if (s)
122
+ scanned.push(s);
123
+ }
124
+ return modulesToDicts(scanned);
125
+ }
91
126
  // ---- NestJS convenience methods ----
92
127
  /**
93
128
  * Register a single method from a service instance as a FunctionModule.
94
129
  *
95
- * Generates a module ID from the class name + method name when no
96
- * explicit id is provided (e.g. EmailService.sendEmail -> email.send_email).
97
- *
98
- * The execute function calls the method on the bound instance and
99
- * normalizes the return value:
100
- * - null / undefined -> {}
101
- * - non-object -> { result: value }
102
- * - object -> returned as-is
130
+ * Produces a toolkit {@link ScannedModule} intermediate, then converts it
131
+ * to a FunctionModule with the method bound to the service instance.
103
132
  *
104
133
  * @returns The module ID under which the method was registered.
105
134
  */
@@ -112,21 +141,25 @@ let ApcoreRegistryService = class ApcoreRegistryService {
112
141
  }
113
142
  const className = instance.constructor.name;
114
143
  const moduleId = generateModuleId(className, method, true, id);
115
- const funcModule = new FunctionModule({
144
+ // Build ScannedModule intermediate via toolkit
145
+ const scanned = createScannedModule({
116
146
  moduleId,
117
147
  description,
118
- inputSchema: inputSchema ?? t.Object({}),
119
- outputSchema: outputSchema ?? t.Object({}),
120
- tags: tags ?? null,
121
- annotations: annotations,
148
+ inputSchema: inputSchema ?? { type: 'object', properties: {} },
149
+ outputSchema: outputSchema ?? { type: 'object', properties: {} },
150
+ tags: tags ?? [],
151
+ target: `${className}.${method}`,
152
+ annotations: toModuleAnnotations(annotations),
122
153
  documentation: documentation ?? null,
123
- examples: examples ?? null,
124
- execute: async (inputs) => {
125
- const raw = await fn.call(instance, inputs);
126
- return normalizeReturnValue(raw);
127
- },
154
+ examples: examples ?? [],
128
155
  });
129
- this.registry.register(moduleId, funcModule);
156
+ // Bound execute function using normalizeResult from apcore-js
157
+ const execute = async (inputs) => {
158
+ const raw = await fn.call(instance, inputs);
159
+ return normalizeResult(raw);
160
+ };
161
+ const fm = scannedModuleToFunctionModule(scanned, execute);
162
+ this.registry.register(moduleId, fm);
130
163
  return moduleId;
131
164
  }
132
165
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"apcore-registry.service.js","sourceRoot":"","sources":["../../src/core/apcore-registry.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAI3C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,KAAc;IAC1C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED;;;GAGG;AAC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C,QAAQ,EAAE,aAAa,CAAC,QAAQ;aACjC,CAAC,CAAC;YAEH,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAA;AAlOY,qBAAqB;IADjC,UAAU,EAAE;;GACA,qBAAqB,CAkOjC"}
@@ -6,6 +6,9 @@ import type { ApcoreModuleOptions, ApcoreModuleAsyncOptions } from '../types.js'
6
6
  * Marked `@Global()` so that {@link ApcoreRegistryService} and
7
7
  * {@link ApcoreExecutorService} are available application-wide without
8
8
  * importing this module into every feature module.
9
+ *
10
+ * Now also handles automatic tool discovery via {@link ApToolScannerService}
11
+ * and optional MCP server integration.
9
12
  */
10
13
  export declare class ApcoreModule {
11
14
  /**
@@ -15,7 +18,7 @@ export declare class ApcoreModule {
15
18
  * wraps them in NestJS-injectable services, and exports them together with
16
19
  * the raw options token.
17
20
  */
18
- static forRoot(options: ApcoreModuleOptions): DynamicModule;
21
+ static forRoot(options?: ApcoreModuleOptions): DynamicModule;
19
22
  /**
20
23
  * Asynchronous configuration using the `useFactory` / `inject` pattern.
21
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"apcore.module.d.ts","sourceRoot":"","sources":["../../src/core/apcore.module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAMpE,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,qBAEa,YAAY;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa;IA6B3D;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;CA2CtE"}
1
+ {"version":3,"file":"apcore.module.d.ts","sourceRoot":"","sources":["../../src/core/apcore.module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAQpE,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;GASG;AACH,qBAEa,YAAY;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,mBAAwB,GAAG,aAAa;IAqChE;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;CAkDtE"}