nestjs-apcore 0.3.2 → 0.5.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 (51) hide show
  1. package/README.md +98 -7
  2. package/dist/a2a/apcore-a2a.module.d.ts +19 -0
  3. package/dist/a2a/apcore-a2a.module.d.ts.map +1 -0
  4. package/dist/a2a/apcore-a2a.module.js +68 -0
  5. package/dist/a2a/apcore-a2a.module.js.map +1 -0
  6. package/dist/a2a/apcore-a2a.service.d.ts +58 -0
  7. package/dist/a2a/apcore-a2a.service.d.ts.map +1 -0
  8. package/dist/a2a/apcore-a2a.service.js +145 -0
  9. package/dist/a2a/apcore-a2a.service.js.map +1 -0
  10. package/dist/bridge/binding-loader.d.ts +1 -1
  11. package/dist/bridge/binding-loader.d.ts.map +1 -1
  12. package/dist/bridge/binding-loader.js +11 -4
  13. package/dist/bridge/binding-loader.js.map +1 -1
  14. package/dist/cli/apcore-cli.module.d.ts +18 -0
  15. package/dist/cli/apcore-cli.module.d.ts.map +1 -0
  16. package/dist/cli/apcore-cli.module.js +62 -0
  17. package/dist/cli/apcore-cli.module.js.map +1 -0
  18. package/dist/cli/apcore-cli.service.d.ts +55 -0
  19. package/dist/cli/apcore-cli.service.d.ts.map +1 -0
  20. package/dist/cli/apcore-cli.service.js +106 -0
  21. package/dist/cli/apcore-cli.service.js.map +1 -0
  22. package/dist/constants.d.ts +2 -0
  23. package/dist/constants.d.ts.map +1 -1
  24. package/dist/constants.js +2 -0
  25. package/dist/constants.js.map +1 -1
  26. package/dist/context/nest-context.factory.d.ts +36 -0
  27. package/dist/context/nest-context.factory.d.ts.map +1 -0
  28. package/dist/context/nest-context.factory.js +82 -0
  29. package/dist/context/nest-context.factory.js.map +1 -0
  30. package/dist/core/apcore-executor.service.d.ts +1 -1
  31. package/dist/core/apcore-executor.service.d.ts.map +1 -1
  32. package/dist/core/apcore-registry.service.d.ts +3 -3
  33. package/dist/core/apcore-registry.service.d.ts.map +1 -1
  34. package/dist/core/apcore-registry.service.js +14 -7
  35. package/dist/core/apcore-registry.service.js.map +1 -1
  36. package/dist/core/apcore.module.d.ts.map +1 -1
  37. package/dist/core/apcore.module.js +14 -0
  38. package/dist/core/apcore.module.js.map +1 -1
  39. package/dist/decorators/ap-tool-scanner.service.d.ts +1 -1
  40. package/dist/decorators/ap-tool-scanner.service.d.ts.map +1 -1
  41. package/dist/decorators/ap-tool-scanner.service.js +13 -6
  42. package/dist/decorators/ap-tool-scanner.service.js.map +1 -1
  43. package/dist/index.d.ts +18 -6
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +38 -3
  46. package/dist/index.js.map +1 -1
  47. package/dist/mcp/apcore-mcp.service.d.ts.map +1 -1
  48. package/dist/mcp/apcore-mcp.service.js.map +1 -1
  49. package/dist/types.d.ts +100 -5
  50. package/dist/types.d.ts.map +1 -1
  51. package/package.json +20 -10
package/README.md CHANGED
@@ -33,7 +33,7 @@ npm install class-validator class-transformer # DtoAdapter
33
33
  npm install @sinclair/typebox # TypeBoxAdapter (recommended)
34
34
  ```
35
35
 
36
- **Requirements:** Node.js >= 18, NestJS >= 10
36
+ **Requirements:** Node.js >= 18, NestJS >= 10 (tested with NestJS 11)
37
37
 
38
38
  ## Quick Start
39
39
 
@@ -167,10 +167,22 @@ ApcoreModule.forRootAsync({
167
167
  | `explorer` | `boolean` | Enable Tool Explorer web UI |
168
168
  | `allowExecute` | `boolean` | Allow tool execution from Explorer |
169
169
  | `authenticator` | `Authenticator` | JWT or custom auth strategy |
170
+ | `requireAuth` | `boolean` | Reject unauthenticated requests (default: `true`) |
171
+ | `exemptPaths` | `string[]` | Paths exempt from auth (default: `["/health", "/metrics"]`) |
170
172
  | `tags` | `string[]` | Only expose tools with these tags |
171
173
  | `prefix` | `string` | Only expose tools with this ID prefix |
172
174
  | `logLevel` | `string` | `'DEBUG' \| 'INFO' \| 'WARNING' \| 'ERROR' \| 'CRITICAL'` |
173
- | `metricsCollector` | `MetricsExporter` | Enables `/metrics` Prometheus endpoint |
175
+ | `metricsCollector` | `MetricsExporter \| true` | Enables `/metrics` endpoint; `true` auto-instantiates |
176
+ | `observability` | `ObservabilityFlag` | Full stack: metrics + usage middleware + `/usage` endpoint |
177
+ | `outputFormat` | `'json' \| 'csv' \| 'jsonl'` | Built-in result serialisation format |
178
+ | `redactOutput` | `boolean` | Redact sensitive fields from tool output (default: `true`) |
179
+ | `trace` | `boolean` | Attach pipeline trace to tool responses (default: `false`) |
180
+ | `strategy` | `string` | Execution strategy name (e.g. `"standard"`, `"minimal"`) |
181
+ | `approvalHandler` | `unknown` | Custom approval handler for the executor |
182
+ | `approvalStore` | `unknown` | Pluggable approval store; auto-wires `StorageBackedApprovalHandler` |
183
+ | `approvalNotify` | `function` | Callback on new approval request (Slack/email fan-out) |
184
+ | `mcpMiddleware` | `unknown[]` | Extra apcore middleware to install on the executor |
185
+ | `mcpAcl` | `unknown` | apcore ACL instance for this MCP server |
174
186
  | `onStartup` | `() => void` | Callback after server starts |
175
187
  | `onShutdown` | `() => void` | Callback before server stops |
176
188
 
@@ -222,11 +234,15 @@ export class AppModule {}
222
234
 
223
235
  | Service | Description |
224
236
  |---|---|
225
- | `ApcoreRegistryService` | Register/unregister tools, query the registry |
226
- | `ApcoreExecutorService` | Execute tools: `call()`, `stream()`, `validate()` |
237
+ | `ApcoreRegistryService` | Register/unregister tools, query the registry — `register()`, `registerMethod()`, `registerService()` are async since 0.6.0 |
238
+ | `ApcoreExecutorService` | Execute tools: `call()`, `stream()`, `validate()` (async since 0.5.0) |
227
239
  | `ApcoreMcpService` | MCP server lifecycle: `start()`, `stop()`, `restart()`, `toOpenaiTools()` |
240
+ | `ApcoreCliService` | CLI lifecycle: `run()` — integrates `apcore-cli` with NestJS |
241
+ | `ApcoreA2aService` | A2A server lifecycle: `start()`, `stop()`, `asyncServe()` |
228
242
  | `ApToolScannerService` | Auto-discovers and registers `@ApTool` decorated methods at startup |
229
243
 
244
+ > **Breaking change in 0.5.0:** `ApcoreExecutorService.validate()` now returns `Promise<PreflightResult>` — add `await` at call sites.
245
+
230
246
  ### Schema Adapters
231
247
 
232
248
  Schemas are auto-detected and converted via a priority chain:
@@ -283,11 +299,86 @@ list(inputs: Record<string, unknown>) {
283
299
  }
284
300
  ```
285
301
 
302
+ ### A2A Module
303
+
304
+ Expose your tools as an [Agent-to-Agent](https://a2aprotocol.ai/) server:
305
+
306
+ ```typescript
307
+ ApcoreModule.forRoot({
308
+ a2a: {
309
+ name: 'my-agent',
310
+ port: 9000,
311
+ url: 'https://my-agent.example.com',
312
+ explorer: true,
313
+ },
314
+ })
315
+ ```
316
+
317
+ Embed into the NestJS HTTP server instead of running standalone:
318
+
319
+ ```typescript
320
+ const a2aApp = await a2aService.asyncServe();
321
+ nestApp.use('/a2a', a2aApp);
322
+ ```
323
+
324
+ The `A2AClient` is also re-exported for calling remote A2A servers:
325
+
326
+ ```typescript
327
+ import { A2AClient } from 'nestjs-apcore';
328
+ const client = new A2AClient({ baseUrl: 'https://other-agent.example.com' });
329
+ const result = await client.runTask({ skill: 'weather.forecast', input: { city: 'Tokyo' } });
330
+ ```
331
+
332
+ ### CLI Module
333
+
334
+ Integrate `apcore-cli` with NestJS for a standalone command-line interface:
335
+
336
+ ```typescript
337
+ ApcoreModule.forRoot({
338
+ cli: {
339
+ progName: 'my-cli',
340
+ docsUrl: 'https://docs.example.com',
341
+ },
342
+ })
343
+ ```
344
+
286
345
  ### Re-exported Utilities
287
346
 
288
- From `apcore-mcp`:
289
- - `reportProgress`, `elicit`, `createBridgeContext`
290
- - `JWTAuthenticator`, `getCurrentIdentity`, `identityStorage`
347
+ All utilities are importable directly from `nestjs-apcore`.
348
+
349
+ **`apcore-mcp`:**
350
+ - `reportProgress`, `elicit`, `createBridgeContext`, `toOpenaiTools`
351
+ - `JWTAuthenticator`, `getCurrentIdentity`, `identityStorage`, `buildExplorerAuthHook`
352
+ - `MCPServerFactory` (`MCPServer`), `ExecutionRouter`, `AsyncTaskBridge`, `ApprovalBridge`
353
+ - `ElicitationApprovalHandler`, `StorageBackedApprovalHandler`, `InMemoryApprovalStore`
354
+ - `OpenAIConverter`, `AnnotationMapper`, `McpSchemaConverter`, `McpErrorMapper`, `ModuleIDNormalizer`
355
+ - `installObservability`, `parseTraceparent`, `buildTraceparent`
356
+ - Constants: `MCP_NAMESPACE`, `MCP_ENV_PREFIX`, `MCP_DEFAULTS`, `MCP_PROGRESS_KEY`, `MCP_ELICIT_KEY`, `REGISTRY_EVENTS`, `APCORE_EVENTS`, `MODULE_ID_PATTERN`, `ErrorCodes`
357
+
358
+ **`apcore-a2a`:**
359
+ - `serveA2A`, `asyncServeA2A`, `A2AClient`, `AgentCardBuilder`, `SkillMapper`, `PartConverter`
360
+ - `A2AServerFactory`, `ApCoreAgentExecutor`
361
+ - `A2AJWTAuthenticator`, `createAuthMiddleware`, `authIdentityStore`, `getAuthIdentity`
362
+ - `A2ASchemaConverter`, `A2AErrorMapper`
363
+
364
+ **`apcore-cli`:**
365
+ - `createCli`, `main`, `buildModuleCommand`, `applyToolkitIntegration`
366
+ - `LazyModuleGroup`, `GroupedModuleGroup`, `LazyGroup`, `ApcliGroup`, `ExposureFilter`
367
+ - `ConfigResolver`, `DEFAULTS`, `registerConfigNamespace`
368
+ - Discovery: `registerListCommand`, `registerDescribeCommand`, `registerExecCommand`, `registerValidateCommand`
369
+ - System: `registerHealthCommand`, `registerUsageCommand`, `registerEnableCommand`, `registerDisableCommand`, `registerReloadCommand`, `registerConfigCommand`, `registerPipelineCommand`, `registerInitCommand`, `registerCompletionCommand`, `configureManHelp`
370
+ - `setLogLevel`, `getLogLevel`, `resolveRefs`, `schemaToCliOptions`
371
+ - Security: `AuditLogger`, `setAuditLogger`, `getAuditLogger`, `AuthProvider`, `ConfigEncryptor`, `Sandbox`
372
+
373
+ **`apcore-toolkit`:**
374
+ - `BaseScanner`, `filterModules`, `deduplicateIds`, `inferAnnotationsFromMethod`
375
+ - `createScannedModule`, `cloneModule`, `moduleToDict`, `modulesToDicts`, `annotationsToDict`
376
+ - Schema: `extractInputSchema`, `extractOutputSchema`, `resolveRef`, `resolveSchema`, `deepResolveRefs`, `enrichSchemaDescriptions`
377
+ - Formatting: `toMarkdown`, `formatSchema`, `formatModule`, `formatModules`, `formatCsv`, `formatJsonl`
378
+ - Writers: `YAMLWriter`, `TypeScriptWriter`, `RegistryWriter`, `HTTPProxyRegistryWriter`, `getWriter`
379
+ - Verifiers: `YAMLVerifier`, `SyntaxVerifier`, `RegistryVerifier`, `MagicBytesVerifier`, `JSONVerifier`, `runVerifierChain`
380
+ - HTTP utils: `SCANNER_VERB_MAP`, `resolveHttpVerb`, `hasPathParams`, `generateSuggestedAlias`, `extractPathParamNames`, `substitutePathParams`
381
+ - `BindingLoader`, `AIEnhancer`, `DisplayResolver`, `resolveTarget`
291
382
 
292
383
  ## Examples
293
384
 
@@ -0,0 +1,19 @@
1
+ import type { DynamicModule } from '@nestjs/common';
2
+ import type { ApcoreA2aModuleOptions, ApcoreA2aModuleAsyncOptions } from '../types.js';
3
+ /**
4
+ * NestJS dynamic module for A2A (Agent-to-Agent) server integration.
5
+ *
6
+ * Provides {@link ApcoreA2aService} for serving the registered apcore modules
7
+ * as A2A skills. Supports both a standalone HTTP server (set `port` in options)
8
+ * and an embedded Express app (via `service.asyncServe()`).
9
+ *
10
+ * Requires {@link ApcoreRegistryService} and {@link ApcoreExecutorService} in
11
+ * the injection context (typically via importing `ApcoreModule`).
12
+ */
13
+ export declare class ApcoreA2aModule {
14
+ /** Synchronous configuration. */
15
+ static forRoot(options?: ApcoreA2aModuleOptions): DynamicModule;
16
+ /** Asynchronous configuration using `useFactory` / `inject`. */
17
+ static forRootAsync(options: ApcoreA2aModuleAsyncOptions): DynamicModule;
18
+ }
19
+ //# sourceMappingURL=apcore-a2a.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apcore-a2a.module.d.ts","sourceRoot":"","sources":["../../src/a2a/apcore-a2a.module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAKpE,OAAO,KAAK,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAErB;;;;;;;;;GASG;AACH,qBACa,eAAe;IAC1B,iCAAiC;IACjC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,sBAA2B,GAAG,aAAa;IAkBnE,gEAAgE;IAChE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,2BAA2B,GAAG,aAAa;CA2BzE"}
@@ -0,0 +1,68 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var ApcoreA2aModule_1;
8
+ import { Module } from '@nestjs/common';
9
+ import { ApcoreRegistryService } from '../core/apcore-registry.service.js';
10
+ import { ApcoreExecutorService } from '../core/apcore-executor.service.js';
11
+ import { ApcoreA2aService } from './apcore-a2a.service.js';
12
+ import { APCORE_A2A_MODULE_OPTIONS } from '../constants.js';
13
+ /**
14
+ * NestJS dynamic module for A2A (Agent-to-Agent) server integration.
15
+ *
16
+ * Provides {@link ApcoreA2aService} for serving the registered apcore modules
17
+ * as A2A skills. Supports both a standalone HTTP server (set `port` in options)
18
+ * and an embedded Express app (via `service.asyncServe()`).
19
+ *
20
+ * Requires {@link ApcoreRegistryService} and {@link ApcoreExecutorService} in
21
+ * the injection context (typically via importing `ApcoreModule`).
22
+ */
23
+ let ApcoreA2aModule = ApcoreA2aModule_1 = class ApcoreA2aModule {
24
+ /** Synchronous configuration. */
25
+ static forRoot(options = {}) {
26
+ return {
27
+ module: ApcoreA2aModule_1,
28
+ providers: [
29
+ { provide: APCORE_A2A_MODULE_OPTIONS, useValue: options },
30
+ {
31
+ provide: ApcoreA2aService,
32
+ useFactory: (registry, executor) => new ApcoreA2aService(registry, executor, options),
33
+ inject: [ApcoreRegistryService, ApcoreExecutorService],
34
+ },
35
+ ],
36
+ exports: [ApcoreA2aService, APCORE_A2A_MODULE_OPTIONS],
37
+ };
38
+ }
39
+ /** Asynchronous configuration using `useFactory` / `inject`. */
40
+ static forRootAsync(options) {
41
+ return {
42
+ module: ApcoreA2aModule_1,
43
+ imports: (options.imports ?? []),
44
+ providers: [
45
+ {
46
+ provide: APCORE_A2A_MODULE_OPTIONS,
47
+ useFactory: options.useFactory,
48
+ inject: (options.inject ?? []),
49
+ },
50
+ {
51
+ provide: ApcoreA2aService,
52
+ useFactory: (opts, registry, executor) => new ApcoreA2aService(registry, executor, opts),
53
+ inject: [
54
+ APCORE_A2A_MODULE_OPTIONS,
55
+ ApcoreRegistryService,
56
+ ApcoreExecutorService,
57
+ ],
58
+ },
59
+ ],
60
+ exports: [ApcoreA2aService, APCORE_A2A_MODULE_OPTIONS],
61
+ };
62
+ }
63
+ };
64
+ ApcoreA2aModule = ApcoreA2aModule_1 = __decorate([
65
+ Module({})
66
+ ], ApcoreA2aModule);
67
+ export { ApcoreA2aModule };
68
+ //# sourceMappingURL=apcore-a2a.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apcore-a2a.module.js","sourceRoot":"","sources":["../../src/a2a/apcore-a2a.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAA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CAAC,EAAE,CAAC;GACE,eAAe,CAgD3B"}
@@ -0,0 +1,58 @@
1
+ import type { OnApplicationBootstrap, OnModuleDestroy } from '@nestjs/common';
2
+ import { ApcoreRegistryService } from '../core/apcore-registry.service.js';
3
+ import { ApcoreExecutorService } from '../core/apcore-executor.service.js';
4
+ import type { ApcoreA2aModuleOptions } from '../types.js';
5
+ /**
6
+ * NestJS service that manages the A2A (Agent-to-Agent) server lifecycle.
7
+ *
8
+ * Wraps `serve()` and `asyncServe()` from `apcore-a2a`, integrating them with
9
+ * NestJS lifecycle hooks for automatic startup/shutdown.
10
+ *
11
+ * **Standalone HTTP server** — set `port` in module options. The server starts
12
+ * automatically on `onApplicationBootstrap`.
13
+ *
14
+ * **Embedded Express app** — call `asyncServe()` to get an Express application
15
+ * and mount it in your NestJS HTTP server:
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // In a NestJS bootstrap file:
20
+ * const a2aApp = await a2aService.asyncServe();
21
+ * app.use('/a2a', a2aApp);
22
+ * ```
23
+ */
24
+ export declare class ApcoreA2aService implements OnApplicationBootstrap, OnModuleDestroy {
25
+ private readonly registry;
26
+ private readonly executor;
27
+ private readonly options;
28
+ private _isRunning;
29
+ constructor(registry: ApcoreRegistryService, executor: ApcoreExecutorService, options: ApcoreA2aModuleOptions);
30
+ /** Whether the standalone A2A HTTP server is currently running. */
31
+ get isRunning(): boolean;
32
+ /** Number of skills (modules) exposed to A2A clients. */
33
+ get skillCount(): number;
34
+ /**
35
+ * Start a standalone A2A HTTP server with the configured options.
36
+ *
37
+ * Automatically called on `onApplicationBootstrap` when `port` is set.
38
+ */
39
+ start(): void;
40
+ /**
41
+ * Build an embeddable Express application without starting a standalone server.
42
+ *
43
+ * Mount the returned app in your NestJS HTTP server or Express middleware chain.
44
+ */
45
+ asyncServe(overrides?: Partial<ApcoreA2aModuleOptions>): Promise<unknown>;
46
+ /** Stop tracking the running state (the underlying HTTP server manages its own lifecycle). */
47
+ stop(): void;
48
+ /**
49
+ * Auto-starts the standalone A2A server when `port` is configured.
50
+ *
51
+ * Uses `OnApplicationBootstrap` so all modules registered during
52
+ * `onModuleInit` are available before the server starts.
53
+ */
54
+ onApplicationBootstrap(): void;
55
+ /** Marks the service as stopped on module destruction. */
56
+ onModuleDestroy(): void;
57
+ }
58
+ //# sourceMappingURL=apcore-a2a.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apcore-a2a.service.d.ts","sourceRoot":"","sources":["../../src/a2a/apcore-a2a.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,gBAAiB,YAAW,sBAAsB,EAAE,eAAe;IAK5E,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAR1B,OAAO,CAAC,UAAU,CAAS;gBAIR,QAAQ,EAAE,qBAAqB,EAE/B,QAAQ,EAAE,qBAAqB,EAE/B,OAAO,EAAE,sBAAsB;IAOlD,mEAAmE;IACnE,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,yDAAyD;IACzD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAMD;;;;OAIG;IACH,KAAK,IAAI,IAAI;IAwBb;;;;OAIG;IACG,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB/E,8FAA8F;IAC9F,IAAI,IAAI,IAAI;IAQZ;;;;;OAKG;IACH,sBAAsB,IAAI,IAAI;IAM9B,0DAA0D;IAC1D,eAAe,IAAI,IAAI;CAKxB"}
@@ -0,0 +1,145 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Injectable, Inject } from '@nestjs/common';
14
+ import { serve, asyncServe } from 'apcore-a2a';
15
+ import { ApcoreRegistryService } from '../core/apcore-registry.service.js';
16
+ import { ApcoreExecutorService } from '../core/apcore-executor.service.js';
17
+ import { APCORE_A2A_MODULE_OPTIONS } from '../constants.js';
18
+ /**
19
+ * NestJS service that manages the A2A (Agent-to-Agent) server lifecycle.
20
+ *
21
+ * Wraps `serve()` and `asyncServe()` from `apcore-a2a`, integrating them with
22
+ * NestJS lifecycle hooks for automatic startup/shutdown.
23
+ *
24
+ * **Standalone HTTP server** — set `port` in module options. The server starts
25
+ * automatically on `onApplicationBootstrap`.
26
+ *
27
+ * **Embedded Express app** — call `asyncServe()` to get an Express application
28
+ * and mount it in your NestJS HTTP server:
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // In a NestJS bootstrap file:
33
+ * const a2aApp = await a2aService.asyncServe();
34
+ * app.use('/a2a', a2aApp);
35
+ * ```
36
+ */
37
+ let ApcoreA2aService = class ApcoreA2aService {
38
+ registry;
39
+ executor;
40
+ options;
41
+ _isRunning = false;
42
+ constructor(registry, executor, options) {
43
+ this.registry = registry;
44
+ this.executor = executor;
45
+ this.options = options;
46
+ }
47
+ // -------------------------------------------------------------------------
48
+ // Properties
49
+ // -------------------------------------------------------------------------
50
+ /** Whether the standalone A2A HTTP server is currently running. */
51
+ get isRunning() {
52
+ return this._isRunning;
53
+ }
54
+ /** Number of skills (modules) exposed to A2A clients. */
55
+ get skillCount() {
56
+ return this.registry.list().length;
57
+ }
58
+ // -------------------------------------------------------------------------
59
+ // Lifecycle
60
+ // -------------------------------------------------------------------------
61
+ /**
62
+ * Start a standalone A2A HTTP server with the configured options.
63
+ *
64
+ * Automatically called on `onApplicationBootstrap` when `port` is set.
65
+ */
66
+ start() {
67
+ this._isRunning = true;
68
+ serve(this.executor.raw, {
69
+ name: this.options.name,
70
+ description: this.options.description,
71
+ version: this.options.version,
72
+ url: this.options.url,
73
+ host: this.options.host,
74
+ port: this.options.port,
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ auth: this.options.auth,
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ taskStore: this.options.taskStore,
79
+ corsOrigins: this.options.corsOrigins,
80
+ explorer: this.options.explorer,
81
+ explorerPrefix: this.options.explorerPrefix,
82
+ executionTimeout: this.options.executionTimeout,
83
+ metrics: this.options.metrics,
84
+ logLevel: this.options.logLevel,
85
+ shutdownTimeout: this.options.shutdownTimeout,
86
+ });
87
+ }
88
+ /**
89
+ * Build an embeddable Express application without starting a standalone server.
90
+ *
91
+ * Mount the returned app in your NestJS HTTP server or Express middleware chain.
92
+ */
93
+ async asyncServe(overrides) {
94
+ const opts = { ...this.options, ...overrides };
95
+ return asyncServe(this.executor.raw, {
96
+ name: opts.name,
97
+ description: opts.description,
98
+ version: opts.version,
99
+ url: opts.url,
100
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
+ auth: opts.auth,
102
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
+ taskStore: opts.taskStore,
104
+ corsOrigins: opts.corsOrigins,
105
+ explorer: opts.explorer,
106
+ explorerPrefix: opts.explorerPrefix,
107
+ executionTimeout: opts.executionTimeout,
108
+ metrics: opts.metrics,
109
+ });
110
+ }
111
+ /** Stop tracking the running state (the underlying HTTP server manages its own lifecycle). */
112
+ stop() {
113
+ this._isRunning = false;
114
+ }
115
+ // -------------------------------------------------------------------------
116
+ // NestJS lifecycle hooks
117
+ // -------------------------------------------------------------------------
118
+ /**
119
+ * Auto-starts the standalone A2A server when `port` is configured.
120
+ *
121
+ * Uses `OnApplicationBootstrap` so all modules registered during
122
+ * `onModuleInit` are available before the server starts.
123
+ */
124
+ onApplicationBootstrap() {
125
+ if (this.options.port !== undefined) {
126
+ this.start();
127
+ }
128
+ }
129
+ /** Marks the service as stopped on module destruction. */
130
+ onModuleDestroy() {
131
+ if (this._isRunning) {
132
+ this.stop();
133
+ }
134
+ }
135
+ };
136
+ ApcoreA2aService = __decorate([
137
+ Injectable(),
138
+ __param(0, Inject(ApcoreRegistryService)),
139
+ __param(1, Inject(ApcoreExecutorService)),
140
+ __param(2, Inject(APCORE_A2A_MODULE_OPTIONS)),
141
+ __metadata("design:paramtypes", [ApcoreRegistryService,
142
+ ApcoreExecutorService, Object])
143
+ ], ApcoreA2aService);
144
+ export { ApcoreA2aService };
145
+ //# sourceMappingURL=apcore-a2a.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apcore-a2a.service.js","sourceRoot":"","sources":["../../src/a2a/apcore-a2a.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;A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b,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AA/GY,gBAAgB;IAD5B,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAE7B,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAE7B,WAAA,MAAM,CAAC,yBAAyB,CAAC,CAAA;qCAHP,qBAAqB;QAErB,qBAAqB;GAPvC,gBAAgB,CA+G5B"}
@@ -21,7 +21,7 @@ export declare class ApBindingLoader {
21
21
  * @param content - Raw YAML string
22
22
  * @returns Array of registered module IDs
23
23
  */
24
- loadFromString(content: string): string[];
24
+ loadFromString(content: string): Promise<string[]>;
25
25
  /**
26
26
  * Read a YAML file from disk and register its bindings.
27
27
  *
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"binding-loader.d.ts","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":"AAWA,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;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAmDxD;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAIxD"}
@@ -13,8 +13,15 @@ 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 { normalizeResult } from 'apcore-js';
17
16
  import { createScannedModule } from 'apcore-toolkit';
17
+ /** Normalize a raw execute result to a plain Record<string, unknown>. */
18
+ function normalizeResult(raw) {
19
+ if (raw === null || raw === undefined)
20
+ return {};
21
+ if (typeof raw === 'object' && !Array.isArray(raw))
22
+ return raw;
23
+ return { result: raw };
24
+ }
18
25
  import { ApcoreRegistryService } from '../core/apcore-registry.service.js';
19
26
  import { scannedModuleToFunctionModule, toModuleAnnotations, } from '../utils/module-factory.js';
20
27
  /**
@@ -38,7 +45,7 @@ let ApBindingLoader = class ApBindingLoader {
38
45
  * @param content - Raw YAML string
39
46
  * @returns Array of registered module IDs
40
47
  */
41
- loadFromString(content) {
48
+ async loadFromString(content) {
42
49
  const parsed = yaml.load(content);
43
50
  const bindings = parsed?.bindings ?? [];
44
51
  const ids = [];
@@ -77,7 +84,7 @@ let ApBindingLoader = class ApBindingLoader {
77
84
  documentation: binding.documentation ?? null,
78
85
  });
79
86
  const fm = scannedModuleToFunctionModule(scanned, execute);
80
- this.registry.register(moduleId, fm);
87
+ await this.registry.register(moduleId, fm);
81
88
  ids.push(moduleId);
82
89
  }
83
90
  return ids;
@@ -90,7 +97,7 @@ let ApBindingLoader = class ApBindingLoader {
90
97
  */
91
98
  async loadFromFile(filePath) {
92
99
  const content = await readFile(filePath, 'utf-8');
93
- return this.loadFromString(content);
100
+ return await this.loadFromString(content);
94
101
  }
95
102
  };
96
103
  ApBindingLoader = __decorate([
@@ -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,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AA4BpC;;;;;;GAMG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAGP;IAGA;IALnB,YAEmB,QAA+B,EAG/B,gBAAmC;QAHnC,aAAQ,GAAR,QAAQ,CAAuB;QAG/B,qBAAgB,GAAhB,gBAAgB,CAAmB;IACnD,CAAC;IAEJ;;;;;;OAMG;IACH,cAAc,CAAC,OAAe;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAiB,CAAC;QAClD,MAAM,QAAQ,GAAG,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAa,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C5C,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"}
@@ -0,0 +1,18 @@
1
+ import type { DynamicModule } from '@nestjs/common';
2
+ import type { ApcoreCliModuleOptions, ApcoreCliModuleAsyncOptions } from '../types.js';
3
+ /**
4
+ * NestJS dynamic module for apcore-cli integration.
5
+ *
6
+ * Provides {@link ApcoreCliService} for building Commander programs, generating
7
+ * man pages, and configuring `--help --man` / `--help --verbose` support.
8
+ *
9
+ * Requires {@link ApcoreRegistryService} in the injection context
10
+ * (typically via importing `ApcoreModule`).
11
+ */
12
+ export declare class ApcoreCliModule {
13
+ /** Synchronous configuration. */
14
+ static forRoot(options?: ApcoreCliModuleOptions): DynamicModule;
15
+ /** Asynchronous configuration using `useFactory` / `inject`. */
16
+ static forRootAsync(options: ApcoreCliModuleAsyncOptions): DynamicModule;
17
+ }
18
+ //# sourceMappingURL=apcore-cli.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apcore-cli.module.d.ts","sourceRoot":"","sources":["../../src/cli/apcore-cli.module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAIpE,OAAO,KAAK,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAErB;;;;;;;;GAQG;AACH,qBACa,eAAe;IAC1B,iCAAiC;IACjC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,sBAA2B,GAAG,aAAa;IAgBnE,gEAAgE;IAChE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,2BAA2B,GAAG,aAAa;CAsBzE"}
@@ -0,0 +1,62 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var ApcoreCliModule_1;
8
+ import { Module } from '@nestjs/common';
9
+ import { ApcoreRegistryService } from '../core/apcore-registry.service.js';
10
+ import { ApcoreCliService } from './apcore-cli.service.js';
11
+ import { APCORE_CLI_MODULE_OPTIONS } from '../constants.js';
12
+ /**
13
+ * NestJS dynamic module for apcore-cli integration.
14
+ *
15
+ * Provides {@link ApcoreCliService} for building Commander programs, generating
16
+ * man pages, and configuring `--help --man` / `--help --verbose` support.
17
+ *
18
+ * Requires {@link ApcoreRegistryService} in the injection context
19
+ * (typically via importing `ApcoreModule`).
20
+ */
21
+ let ApcoreCliModule = ApcoreCliModule_1 = class ApcoreCliModule {
22
+ /** Synchronous configuration. */
23
+ static forRoot(options = {}) {
24
+ return {
25
+ module: ApcoreCliModule_1,
26
+ providers: [
27
+ { provide: APCORE_CLI_MODULE_OPTIONS, useValue: options },
28
+ {
29
+ provide: ApcoreCliService,
30
+ useFactory: (registry) => new ApcoreCliService(registry, options),
31
+ inject: [ApcoreRegistryService],
32
+ },
33
+ ],
34
+ exports: [ApcoreCliService, APCORE_CLI_MODULE_OPTIONS],
35
+ };
36
+ }
37
+ /** Asynchronous configuration using `useFactory` / `inject`. */
38
+ static forRootAsync(options) {
39
+ return {
40
+ module: ApcoreCliModule_1,
41
+ imports: (options.imports ?? []),
42
+ providers: [
43
+ {
44
+ provide: APCORE_CLI_MODULE_OPTIONS,
45
+ useFactory: options.useFactory,
46
+ inject: (options.inject ?? []),
47
+ },
48
+ {
49
+ provide: ApcoreCliService,
50
+ useFactory: (opts, registry) => new ApcoreCliService(registry, opts),
51
+ inject: [APCORE_CLI_MODULE_OPTIONS, ApcoreRegistryService],
52
+ },
53
+ ],
54
+ exports: [ApcoreCliService, APCORE_CLI_MODULE_OPTIONS],
55
+ };
56
+ }
57
+ };
58
+ ApcoreCliModule = ApcoreCliModule_1 = __decorate([
59
+ Module({})
60
+ ], ApcoreCliModule);
61
+ export { ApcoreCliModule };
62
+ //# sourceMappingURL=apcore-cli.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apcore-cli.module.js","sourceRoot":"","sources":["../../src/cli/apcore-cli.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAM5D;;;;;;;;GAQG;AAEI,IAAM,eAAe,uBAArB,MAAM,eAAe;IAC1B,iCAAiC;IACjC,MAAM,CAAC,OAAO,CAAC,UAAkC,EAAE;QACjD,OAAO;YACL,MAAM,EAAE,iBAAe;YACvB,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,EAAE;gBACzD;oBACE,OAAO,EAAE,gBAAgB;oBACzB,UAAU,EAAE,CAAC,QAA+B,EAAE,EAAE,CAC9C,IAAI,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC;oBACzC,MAAM,EAAE,CAAC,qBAAqB,CAAC;iBAChC;aACF;YACD,OAAO,EAAE,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;SACvD,CAAC;IACJ,CAAC;IAED,gEAAgE;IAChE,MAAM,CAAC,YAAY,CAAC,OAAoC;QACtD,OAAO;YACL,MAAM,EAAE,iBAAe;YACvB,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI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