hono-apcore 0.2.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.
- package/README.md +34 -11
- package/dist/bridge/binding-loader.d.ts.map +1 -1
- package/dist/bridge/binding-loader.js +2 -2
- package/dist/bridge/binding-loader.js.map +1 -1
- package/dist/cli/apcore-cli.service.js +1 -1
- package/dist/cli/apcore-cli.service.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/apcore.d.ts +15 -48
- package/dist/core/apcore.d.ts.map +1 -1
- package/dist/core/apcore.js +16 -94
- package/dist/core/apcore.js.map +1 -1
- package/dist/core/apcore.node.d.ts +65 -0
- package/dist/core/apcore.node.d.ts.map +1 -0
- package/dist/core/apcore.node.js +120 -0
- package/dist/core/apcore.node.js.map +1 -0
- package/dist/core/middleware.d.ts +2 -2
- package/dist/core/middleware.d.ts.map +1 -1
- package/dist/core/middleware.js.map +1 -1
- package/dist/core/registry.d.ts +1 -1
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/registry.js +1 -1
- package/dist/core/registry.js.map +1 -1
- package/dist/edge.d.ts +25 -0
- package/dist/edge.d.ts.map +1 -0
- package/dist/edge.js +54 -0
- package/dist/edge.js.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/output/yaml-writer.d.ts +1 -1
- package/dist/output/yaml-writer.d.ts.map +1 -1
- package/dist/output/yaml-writer.js +5 -3
- package/dist/output/yaml-writer.js.map +1 -1
- package/dist/scanners/hono-route-scanner.d.ts +2 -2
- package/dist/scanners/hono-route-scanner.d.ts.map +1 -1
- package/dist/scanners/hono-route-scanner.js +1 -1
- package/dist/scanners/hono-route-scanner.js.map +1 -1
- package/dist/tools/define-tool.d.ts +1 -1
- package/dist/tools/define-tool.d.ts.map +1 -1
- package/dist/tools/define-tool.js +1 -1
- package/dist/tools/define-tool.js.map +1 -1
- package/dist/types.d.ts +16 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +29 -4
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ you already have.
|
|
|
14
14
|
- **Annotation inference** — `GET` → readonly + cacheable, `PUT` → idempotent, `DELETE` → destructive (RFC 9110 safe-method semantics)
|
|
15
15
|
- **Multi-schema** — TypeBox, Zod 3, Zod 4, and plain JSON Schema, auto-detected through a priority chain
|
|
16
16
|
- **Context, ACL, and identity** — the `apcore()` middleware builds a per-request apcore `Context` with W3C trace propagation, so ACL rules govern your routes too
|
|
17
|
-
- **Runtime-agnostic core** —
|
|
17
|
+
- **Runtime-agnostic core** — the `browser` / `worker` / `workerd` export conditions resolve to `hono-apcore/edge`, a core-only entry with no MCP, CLI, A2A, YAML file I/O, or static `node:*` imports; CI bundles it on every push
|
|
18
18
|
- **CLI** — `hono-apcore scan | serve | export` works against a plain Hono app
|
|
19
19
|
- **YAML bindings** — register modules declaratively, without touching source
|
|
20
20
|
|
|
@@ -37,7 +37,7 @@ npm install zod # Zod schemas
|
|
|
37
37
|
|
|
38
38
|
**Requirements:** Node.js >= 20, Hono >= 4 (tested with Hono 4.13).
|
|
39
39
|
SDK minimums: apcore-js 0.32.3, apcore-toolkit 0.14.1; optional peers
|
|
40
|
-
apcore-mcp 0.23.
|
|
40
|
+
apcore-mcp 0.23.4, apcore-cli 0.12.7, and apcore-a2a 0.8.5.
|
|
41
41
|
See [SDK upgrade notes](./docs/sdk-upgrade.md) for compatibility changes and new options.
|
|
42
42
|
|
|
43
43
|
## Quick start
|
|
@@ -395,13 +395,28 @@ environment and overridable via `settings`:
|
|
|
395
395
|
| `APCORE_HOST` | str | `"0.0.0.0"` | Bind address when the transport is not stdio |
|
|
396
396
|
| `APCORE_PORT` | int | `8808` | Bind port when the transport is not stdio |
|
|
397
397
|
|
|
398
|
-
###
|
|
398
|
+
### Entry points and edge builds
|
|
399
399
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
400
|
+
`hono-apcore` ships two entries:
|
|
401
|
+
|
|
402
|
+
| Entry | Contents |
|
|
403
|
+
| --- | --- |
|
|
404
|
+
| `hono-apcore` (Node default) | Core, MCP, CLI, A2A, YAML bindings loaded from disk |
|
|
405
|
+
| `hono-apcore/edge` | Core only: tools, route scanning, context, schema, ACL, config |
|
|
406
|
+
|
|
407
|
+
Bundlers honouring the `browser`, `worker`, or `workerd` condition get
|
|
408
|
+
`hono-apcore/edge` from the bare `hono-apcore` specifier automatically. If your
|
|
409
|
+
bundler does not apply those conditions (some Deno/Bun setups), import the
|
|
410
|
+
subpath explicitly:
|
|
411
|
+
|
|
412
|
+
```ts
|
|
413
|
+
import { createApcore, defineTool } from 'hono-apcore/edge';
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
The edge entry deliberately excludes the optional MCP, CLI, and A2A surfaces,
|
|
417
|
+
file-backed YAML bindings, and the Node-only `Config` / `registerSysModules`
|
|
418
|
+
re-exports. The Node entry still re-exports all of them for backward
|
|
419
|
+
compatibility. Import peer symbols from their own packages:
|
|
405
420
|
|
|
406
421
|
```ts
|
|
407
422
|
import { JWTAuthenticator, getCurrentIdentity } from 'apcore-mcp';
|
|
@@ -409,9 +424,17 @@ import { createCli } from 'apcore-cli';
|
|
|
409
424
|
import { A2AClient } from 'apcore-a2a';
|
|
410
425
|
```
|
|
411
426
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
427
|
+
Surface subpaths are also available: `hono-apcore/mcp`, `hono-apcore/cli`, and
|
|
428
|
+
`hono-apcore/a2a`.
|
|
429
|
+
|
|
430
|
+
CI bundles both `dist/edge.js` and a consumer importing `hono-apcore` with
|
|
431
|
+
browser conditions, and fails if the entry chunk or any lazy chunk reaches
|
|
432
|
+
`node:http` / `node:https` or an optional apcore peer.
|
|
433
|
+
|
|
434
|
+
The edge entry's own chunk has no `node:*` imports. `apcore-js` still emits
|
|
435
|
+
lazy chunks for its Node-only registry discovery methods (`node:fs`,
|
|
436
|
+
`node:path`); those are never loaded unless you call `Registry.discover()` or
|
|
437
|
+
set `extensionsDir`.
|
|
415
438
|
|
|
416
439
|
## Examples
|
|
417
440
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding-loader.d.ts","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binding-loader.d.ts","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAM1D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,MAAM,EAAE,MAAM,KACX,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;AAEnF;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,cAAc,CAcnF;AAED;;;;;;GAMG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;gBADd,QAAQ,EAAE,cAAc,EACxB,aAAa,CAAC,EAAE,cAAc,YAAA;IAGjD;;;;;OAKG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgCxD;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAIxD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
1
|
import * as yaml from 'js-yaml';
|
|
3
|
-
import { parseBindingDocument } from 'apcore-toolkit';
|
|
2
|
+
import { parseBindingDocument } from 'apcore-toolkit/browser';
|
|
4
3
|
import { EMPTY_OBJECT_SCHEMA, normalizeResult, } from '../utils/module-factory.js';
|
|
5
4
|
/**
|
|
6
5
|
* Builds a resolver over a map of named service objects.
|
|
@@ -76,6 +75,7 @@ export class ApBindingLoader {
|
|
|
76
75
|
* @returns The module IDs that were registered.
|
|
77
76
|
*/
|
|
78
77
|
async loadFromFile(filePath) {
|
|
78
|
+
const { readFile } = await import('node:fs/promises');
|
|
79
79
|
return this.loadFromString(await readFile(filePath, 'utf-8'));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding-loader.js","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"binding-loader.js","sourceRoot":"","sources":["../../src/bridge/binding-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EACL,mBAAmB,EACnB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAYpC;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA+B;IACjE,OAAO,CAAC,MAAc,EAAE,EAAE;QACxB,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU;YAAE,OAAO,SAAS,CAAC;QAEjD,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAEhC,MAAM,EAAE,GAAI,QAAoC,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,OAAO,SAAS,CAAC;QA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AC,CAAC;YAEP,MAAM,OAAO,GAAG;gBACd,GAAG,OAAO;gBACV,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM;oBAClD,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,mBAAmB,EAAE;gBACpD,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM;oBACpD,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,mBAAmB,EAAE;aACtD,CAAC;YAEF,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,QAAgB;QACjC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CallbackApprovalHandler, Context as ApcoreContext, createApprovalResult, Executor } from 'apcore-js';
|
|
2
|
-
import { annotationsToDict } from 'apcore-toolkit';
|
|
2
|
+
import { annotationsToDict } from 'apcore-toolkit/browser';
|
|
3
3
|
import { ApcoreExecutor } from '../core/executor.js';
|
|
4
4
|
/**
|
|
5
5
|
* Exposes `apcore-cli` for a Hono app: build a Commander program whose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apcore-cli.service.js","sourceRoot":"","sources":["../../src/cli/apcore-cli.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,OAAO,IAAI,aAAa,EAAE,oBA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;IACxD,CAAC;IAED,iFAAiF;IACjF,KAAK,CAAC,cAAc,CAAC,OAAgB;QACnC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QACtC,GAAG,CAAC,cAA6C,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,kBAAkB;QAC9B,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA4OA,6EAA6E;AAC7E,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAqDlF"}
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { writeFile } from 'node:fs/promises';
|
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { resolve as resolvePath } from 'node:path';
|
|
6
6
|
import { formatModules } from 'apcore-toolkit';
|
|
7
|
-
import { HonoApcore } from './core/apcore.js';
|
|
7
|
+
import { HonoApcore } from './core/apcore.node.js';
|
|
8
8
|
import { HonoRouteScanner } from './scanners/hono-route-scanner.js';
|
|
9
9
|
import { renderBindingsYaml, writeBindingsFile } from './output/yaml-writer.js';
|
|
10
10
|
import { ApcoreMcpService } from './mcp/apcore-mcp.service.js';
|
|
@@ -156,6 +156,9 @@ async function commandServe(entry, values) {
|
|
|
156
156
|
const settings = loadSettings();
|
|
157
157
|
await instance.init(app ?? undefined, routeOptions(values, instance));
|
|
158
158
|
if (values['bindings']) {
|
|
159
|
+
if (typeof instance.loadBindings !== 'function') {
|
|
160
|
+
throw new Error('--bindings requires an app built from the Node entry (hono-apcore), not hono-apcore/edge.');
|
|
161
|
+
}
|
|
159
162
|
await instance.loadBindings(values['bindings']);
|
|
160
163
|
}
|
|
161
164
|
// A zero-config entry (a bare Hono app) still gets an MCP surface here, so
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,UAAU,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}
|
package/dist/core/apcore.d.ts
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
import { ApcoreRegistry } from './registry.js';
|
|
2
2
|
import { ApcoreExecutor } from './executor.js';
|
|
3
|
-
import { ApcoreMcpService } from '../mcp/apcore-mcp.service.js';
|
|
4
|
-
import { ApcoreCliService } from '../cli/apcore-cli.service.js';
|
|
5
|
-
import { ApcoreA2aService } from '../a2a/apcore-a2a.service.js';
|
|
6
3
|
import { HonoContextFactory } from '../context/hono-context.factory.js';
|
|
7
4
|
import type { HonoAppLike } from '../scanners/hono-route-scanner.js';
|
|
8
|
-
import type { TargetResolver } from '../bridge/binding-loader.js';
|
|
9
|
-
import type { MountableApp } from '../mcp/mount.js';
|
|
10
|
-
import type { McpApp } from '../mcp/apcore-mcp.service.js';
|
|
11
5
|
import type { ApcoreSettings } from '../config.js';
|
|
12
|
-
import type { ApToolDefinition,
|
|
6
|
+
import type { ApToolDefinition, HonoApcoreCoreOptions, RegisterMethodOptions, RegisterObjectOptions, RouteScanOptions } from '../types.js';
|
|
13
7
|
/**
|
|
14
|
-
*
|
|
8
|
+
* Core entry point for wiring apcore into a Hono app.
|
|
15
9
|
*
|
|
16
10
|
* Owns the apcore `Registry` and `Executor`, the tool/route registration
|
|
17
|
-
* surface, and
|
|
18
|
-
*
|
|
11
|
+
* surface, and route scanning. This is the implementation behind both package
|
|
12
|
+
* entries: the Node subclass adds MCP, CLI, A2A, and YAML bindings, while the
|
|
13
|
+
* edge entry exposes this class directly.
|
|
19
14
|
*
|
|
20
15
|
* @example
|
|
21
16
|
* ```ts
|
|
22
|
-
* const ap = createApcore({
|
|
23
|
-
* tools: [listTodos, addTodo],
|
|
24
|
-
* mcp: { explorer: true, allowExecute: true },
|
|
25
|
-
* });
|
|
17
|
+
* const ap = createApcore({ tools: [listTodos, addTodo] });
|
|
26
18
|
*
|
|
27
19
|
* app.use('*', apcore(ap));
|
|
28
20
|
* await ap.init(app); // register tools, scan routes
|
|
29
|
-
* await ap.mountMcp(app); // serve MCP on the same port
|
|
30
21
|
* ```
|
|
31
22
|
*/
|
|
32
23
|
export declare class HonoApcore {
|
|
33
|
-
private readonly options;
|
|
34
24
|
/** Canonical `APCORE_*` settings, environment merged with `options.settings`. */
|
|
35
25
|
readonly settings: ApcoreSettings;
|
|
36
26
|
/** Registry wrapper — register and inspect modules. */
|
|
@@ -39,12 +29,10 @@ export declare class HonoApcore {
|
|
|
39
29
|
readonly executor: ApcoreExecutor;
|
|
40
30
|
/** Builds per-request apcore `Context` objects from Hono requests. */
|
|
41
31
|
readonly contextFactory: HonoContextFactory;
|
|
42
|
-
|
|
43
|
-
private readonly _cli;
|
|
44
|
-
private readonly _a2a;
|
|
32
|
+
protected readonly options: HonoApcoreCoreOptions;
|
|
45
33
|
private readonly scanner;
|
|
46
34
|
private initPromise;
|
|
47
|
-
constructor(options?:
|
|
35
|
+
constructor(options?: HonoApcoreCoreOptions);
|
|
48
36
|
/**
|
|
49
37
|
* The route-scan options this instance would use: the `APCORE_*` settings
|
|
50
38
|
* with the constructor's `routes` block layered on top.
|
|
@@ -53,12 +41,6 @@ export declare class HonoApcore {
|
|
|
53
41
|
* produces the same module set the app itself registers.
|
|
54
42
|
*/
|
|
55
43
|
get routeOptions(): RouteScanOptions;
|
|
56
|
-
/** The MCP service, or `null` when `options.mcp` was omitted. */
|
|
57
|
-
get mcp(): ApcoreMcpService | null;
|
|
58
|
-
/** The CLI service, or `null` when `options.cli` was omitted. */
|
|
59
|
-
get cli(): ApcoreCliService | null;
|
|
60
|
-
/** The A2A service, or `null` when `options.a2a` was omitted. */
|
|
61
|
-
get a2a(): ApcoreA2aService | null;
|
|
62
44
|
/** Register one tool definition. Returns its module ID. */
|
|
63
45
|
registerTool(tool: ApToolDefinition): Promise<string>;
|
|
64
46
|
/** Register several tool definitions. Returns their module IDs. */
|
|
@@ -78,13 +60,6 @@ export declare class HonoApcore {
|
|
|
78
60
|
* @returns The module IDs that were registered.
|
|
79
61
|
*/
|
|
80
62
|
scanRoutes(app: HonoAppLike, options?: RouteScanOptions): Promise<string[]>;
|
|
81
|
-
/**
|
|
82
|
-
* Load a YAML bindings file and register its entries.
|
|
83
|
-
*
|
|
84
|
-
* @param filePath - Path to the YAML file. Defaults to `options.bindings`.
|
|
85
|
-
* @param resolveTarget - Resolves each entry's `target` to a live handler.
|
|
86
|
-
*/
|
|
87
|
-
loadBindings(filePath?: string, resolveTarget?: TargetResolver): Promise<string[]>;
|
|
88
63
|
/**
|
|
89
64
|
* Discover extensions, register the configured tools and bindings, scan the
|
|
90
65
|
* app's routes, and start any surface configured to run standalone.
|
|
@@ -105,25 +80,17 @@ export declare class HonoApcore {
|
|
|
105
80
|
private mergeRouteOptions;
|
|
106
81
|
private runInit;
|
|
107
82
|
/**
|
|
108
|
-
*
|
|
109
|
-
* MCP. Node runtime only — see {@link mountMcp}.
|
|
83
|
+
* Register file-backed bindings before routes are scanned.
|
|
110
84
|
*
|
|
111
|
-
*
|
|
85
|
+
* The core entry leaves this empty; the Node entry loads YAML from disk.
|
|
112
86
|
*/
|
|
113
|
-
|
|
87
|
+
protected loadConfiguredBindings(): Promise<void>;
|
|
114
88
|
/**
|
|
115
|
-
*
|
|
89
|
+
* Start configured standalone surfaces after every module is registered.
|
|
116
90
|
*
|
|
117
|
-
*
|
|
91
|
+
* The core entry leaves this empty; the Node entry starts MCP, CLI, and A2A.
|
|
118
92
|
*/
|
|
119
|
-
|
|
120
|
-
embedAnnotations?: boolean;
|
|
121
|
-
strict?: boolean;
|
|
122
|
-
tags?: string[];
|
|
123
|
-
prefix?: string;
|
|
124
|
-
}): Promise<unknown[]>;
|
|
125
|
-
/** Shut down the MCP and A2A surfaces. */
|
|
126
|
-
close(): Promise<void>;
|
|
93
|
+
protected startSurfaces(): Promise<void>;
|
|
127
94
|
}
|
|
128
95
|
/**
|
|
129
96
|
* Create a {@link HonoApcore} instance.
|
|
@@ -131,5 +98,5 @@ export declare class HonoApcore {
|
|
|
131
98
|
* Sugar for `new HonoApcore(options)`, matching the `createX()` style the
|
|
132
99
|
* Hono ecosystem uses.
|
|
133
100
|
*/
|
|
134
|
-
export declare function createApcore(options?:
|
|
101
|
+
export declare function createApcore(options?: HonoApcoreCoreOptions): HonoApcore;
|
|
135
102
|
//# sourceMappingURL=apcore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apcore.d.ts","sourceRoot":"","sources":["../../src/core/apcore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"apcore.d.ts","sourceRoot":"","sources":["../../src/core/apcore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,UAAU;IACrB,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC,sEAAsE;IACtE,QAAQ,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAE5C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,WAAW,CAA8B;gBAErC,OAAO,GAAE,qBAA0B;IA0B/C;;;;;;OAMG;IACH,IAAI,YAAY,IAAI,gBAAgB,CAEnC;IAMD,2DAA2D;IAC3D,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrD,mEAAmE;IACnE,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI3D,gEAAgE;IAChE,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/D,+DAA+D;IAC/D,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIjE;;;;;;;;;OASG;IACG,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA0BrF;;;;;;;;;OASG;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvE;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,uFAAuF;IACvF,OAAO,CAAC,iBAAiB;YAUX,OAAO;IA0BrB;;;;OAIG;cACa,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvD;;;;OAIG;cACa,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,qBAA0B,GAAG,UAAU,CAE5E"}
|
package/dist/core/apcore.js
CHANGED
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
import { Executor, Registry } from 'apcore-js';
|
|
2
2
|
import { ApcoreRegistry } from './registry.js';
|
|
3
3
|
import { ApcoreExecutor } from './executor.js';
|
|
4
|
-
import { ApcoreMcpService } from '../mcp/apcore-mcp.service.js';
|
|
5
|
-
import { ApcoreCliService } from '../cli/apcore-cli.service.js';
|
|
6
|
-
import { ApcoreA2aService } from '../a2a/apcore-a2a.service.js';
|
|
7
4
|
import { HonoContextFactory } from '../context/hono-context.factory.js';
|
|
8
5
|
import { HonoRouteScanner } from '../scanners/hono-route-scanner.js';
|
|
9
|
-
import {
|
|
10
|
-
import { mountMcp as mountMcpEndpoint } from '../mcp/mount.js';
|
|
11
|
-
import { loadSettings, toMcpTransport } from '../config.js';
|
|
6
|
+
import { loadSettings } from '../config.js';
|
|
12
7
|
/**
|
|
13
|
-
*
|
|
8
|
+
* Core entry point for wiring apcore into a Hono app.
|
|
14
9
|
*
|
|
15
10
|
* Owns the apcore `Registry` and `Executor`, the tool/route registration
|
|
16
|
-
* surface, and
|
|
17
|
-
*
|
|
11
|
+
* surface, and route scanning. This is the implementation behind both package
|
|
12
|
+
* entries: the Node subclass adds MCP, CLI, A2A, and YAML bindings, while the
|
|
13
|
+
* edge entry exposes this class directly.
|
|
18
14
|
*
|
|
19
15
|
* @example
|
|
20
16
|
* ```ts
|
|
21
|
-
* const ap = createApcore({
|
|
22
|
-
* tools: [listTodos, addTodo],
|
|
23
|
-
* mcp: { explorer: true, allowExecute: true },
|
|
24
|
-
* });
|
|
17
|
+
* const ap = createApcore({ tools: [listTodos, addTodo] });
|
|
25
18
|
*
|
|
26
19
|
* app.use('*', apcore(ap));
|
|
27
20
|
* await ap.init(app); // register tools, scan routes
|
|
28
|
-
* await ap.mountMcp(app); // serve MCP on the same port
|
|
29
21
|
* ```
|
|
30
22
|
*/
|
|
31
23
|
export class HonoApcore {
|
|
32
|
-
options;
|
|
33
24
|
/** Canonical `APCORE_*` settings, environment merged with `options.settings`. */
|
|
34
25
|
settings;
|
|
35
26
|
/** Registry wrapper — register and inspect modules. */
|
|
@@ -38,9 +29,7 @@ export class HonoApcore {
|
|
|
38
29
|
executor;
|
|
39
30
|
/** Builds per-request apcore `Context` objects from Hono requests. */
|
|
40
31
|
contextFactory;
|
|
41
|
-
|
|
42
|
-
_cli;
|
|
43
|
-
_a2a;
|
|
32
|
+
options;
|
|
44
33
|
scanner = new HonoRouteScanner();
|
|
45
34
|
initPromise = null;
|
|
46
35
|
constructor(options = {}) {
|
|
@@ -61,24 +50,9 @@ export class HonoApcore {
|
|
|
61
50
|
this.registry = new ApcoreRegistry(registry);
|
|
62
51
|
this.executor = new ApcoreExecutor(executor, executorOptions);
|
|
63
52
|
this.contextFactory = new HonoContextFactory();
|
|
64
|
-
this._mcp = options.mcp
|
|
65
|
-
? new ApcoreMcpService(this.registry, this.executor, {
|
|
66
|
-
...options.mcp,
|
|
67
|
-
// The APCORE_* settings supply the defaults; explicit config wins.
|
|
68
|
-
transport: options.mcp.transport ?? toMcpTransport(this.settings.transport),
|
|
69
|
-
host: options.mcp.host ?? this.settings.host,
|
|
70
|
-
port: options.mcp.port ?? this.settings.port,
|
|
71
|
-
})
|
|
72
|
-
: null;
|
|
73
|
-
this._cli = options.cli
|
|
74
|
-
? new ApcoreCliService(this.registry, options.cli, this.executor)
|
|
75
|
-
: null;
|
|
76
|
-
this._a2a = options.a2a
|
|
77
|
-
? new ApcoreA2aService(this.registry, this.executor, options.a2a)
|
|
78
|
-
: null;
|
|
79
53
|
}
|
|
80
54
|
// -------------------------------------------------------------------------
|
|
81
|
-
//
|
|
55
|
+
// Options
|
|
82
56
|
// -------------------------------------------------------------------------
|
|
83
57
|
/**
|
|
84
58
|
* The route-scan options this instance would use: the `APCORE_*` settings
|
|
@@ -90,18 +64,6 @@ export class HonoApcore {
|
|
|
90
64
|
get routeOptions() {
|
|
91
65
|
return this.mergeRouteOptions();
|
|
92
66
|
}
|
|
93
|
-
/** The MCP service, or `null` when `options.mcp` was omitted. */
|
|
94
|
-
get mcp() {
|
|
95
|
-
return this._mcp;
|
|
96
|
-
}
|
|
97
|
-
/** The CLI service, or `null` when `options.cli` was omitted. */
|
|
98
|
-
get cli() {
|
|
99
|
-
return this._cli;
|
|
100
|
-
}
|
|
101
|
-
/** The A2A service, or `null` when `options.a2a` was omitted. */
|
|
102
|
-
get a2a() {
|
|
103
|
-
return this._a2a;
|
|
104
|
-
}
|
|
105
67
|
// -------------------------------------------------------------------------
|
|
106
68
|
// Registration
|
|
107
69
|
// -------------------------------------------------------------------------
|
|
@@ -149,18 +111,6 @@ export class HonoApcore {
|
|
|
149
111
|
}
|
|
150
112
|
return ids;
|
|
151
113
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Load a YAML bindings file and register its entries.
|
|
154
|
-
*
|
|
155
|
-
* @param filePath - Path to the YAML file. Defaults to `options.bindings`.
|
|
156
|
-
* @param resolveTarget - Resolves each entry's `target` to a live handler.
|
|
157
|
-
*/
|
|
158
|
-
async loadBindings(filePath, resolveTarget) {
|
|
159
|
-
const path = filePath ?? this.options.bindings;
|
|
160
|
-
if (!path)
|
|
161
|
-
return [];
|
|
162
|
-
return new ApBindingLoader(this.registry, resolveTarget).loadFromFile(path);
|
|
163
|
-
}
|
|
164
114
|
// -------------------------------------------------------------------------
|
|
165
115
|
// Lifecycle
|
|
166
116
|
// -------------------------------------------------------------------------
|
|
@@ -206,54 +156,26 @@ export class HonoApcore {
|
|
|
206
156
|
if (this.options.tools?.length) {
|
|
207
157
|
await this.registerTools(this.options.tools);
|
|
208
158
|
}
|
|
209
|
-
|
|
210
|
-
await this.loadBindings();
|
|
211
|
-
}
|
|
159
|
+
await this.loadConfiguredBindings();
|
|
212
160
|
if (app) {
|
|
213
161
|
await this.scanRoutes(app, routeOptions);
|
|
214
162
|
}
|
|
215
163
|
// Surfaces start last, so every module is registered before a client can
|
|
216
164
|
// list the tools.
|
|
217
|
-
|
|
218
|
-
await this._a2a.start();
|
|
219
|
-
}
|
|
220
|
-
if (this._mcp && this.options.mcp?.transport) {
|
|
221
|
-
await this._mcp.start();
|
|
222
|
-
}
|
|
165
|
+
await this.startSurfaces();
|
|
223
166
|
}
|
|
224
167
|
/**
|
|
225
|
-
*
|
|
226
|
-
* MCP. Node runtime only — see {@link mountMcp}.
|
|
168
|
+
* Register file-backed bindings before routes are scanned.
|
|
227
169
|
*
|
|
228
|
-
*
|
|
170
|
+
* The core entry leaves this empty; the Node entry loads YAML from disk.
|
|
229
171
|
*/
|
|
230
|
-
async
|
|
231
|
-
if (!this._mcp) {
|
|
232
|
-
throw new Error('mountMcp() requires the MCP surface. Pass an `mcp` block to createApcore().');
|
|
233
|
-
}
|
|
234
|
-
return mountMcpEndpoint(app, this._mcp, {
|
|
235
|
-
explorer: this.options.mcp?.explorer,
|
|
236
|
-
explorerPrefix: this.options.mcp?.explorerPrefix,
|
|
237
|
-
allowExecute: this.options.mcp?.allowExecute,
|
|
238
|
-
...options,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
172
|
+
async loadConfiguredBindings() { }
|
|
241
173
|
/**
|
|
242
|
-
*
|
|
174
|
+
* Start configured standalone surfaces after every module is registered.
|
|
243
175
|
*
|
|
244
|
-
*
|
|
176
|
+
* The core entry leaves this empty; the Node entry starts MCP, CLI, and A2A.
|
|
245
177
|
*/
|
|
246
|
-
async
|
|
247
|
-
if (!this._mcp) {
|
|
248
|
-
throw new Error('toOpenaiTools() requires the MCP surface. Pass an `mcp` block to createApcore().');
|
|
249
|
-
}
|
|
250
|
-
return this._mcp.toOpenaiTools(options);
|
|
251
|
-
}
|
|
252
|
-
/** Shut down the MCP and A2A surfaces. */
|
|
253
|
-
async close() {
|
|
254
|
-
await this._mcp?.stop();
|
|
255
|
-
this._a2a?.stop();
|
|
256
|
-
}
|
|
178
|
+
async startSurfaces() { }
|
|
257
179
|
}
|
|
258
180
|
/**
|
|
259
181
|
* Create a {@link HonoApcore} instance.
|
package/dist/core/apcore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apcore.js","sourceRoot":"","sources":["../../src/core/apcore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/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
+
import { HonoApcore as HonoApcoreCore } from './apcore.js';
|
|
2
|
+
import { ApcoreMcpService } from '../mcp/apcore-mcp.service.js';
|
|
3
|
+
import { ApcoreCliService } from '../cli/apcore-cli.service.js';
|
|
4
|
+
import { ApcoreA2aService } from '../a2a/apcore-a2a.service.js';
|
|
5
|
+
import type { TargetResolver } from '../bridge/binding-loader.js';
|
|
6
|
+
import type { MountableApp } from '../mcp/mount.js';
|
|
7
|
+
import type { McpApp } from '../mcp/apcore-mcp.service.js';
|
|
8
|
+
import type { HonoApcoreOptions, MountMcpOptions } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Node entry for {@link HonoApcore}.
|
|
11
|
+
*
|
|
12
|
+
* Adds the optional MCP, CLI, and A2A surfaces plus YAML bindings loaded from
|
|
13
|
+
* disk. The edge entry exposes the same core behaviour without these
|
|
14
|
+
* Node-only dependencies.
|
|
15
|
+
*/
|
|
16
|
+
export declare class HonoApcore extends HonoApcoreCore {
|
|
17
|
+
private readonly _mcp;
|
|
18
|
+
private readonly _cli;
|
|
19
|
+
private readonly _a2a;
|
|
20
|
+
constructor(options?: HonoApcoreOptions);
|
|
21
|
+
private get nodeOptions();
|
|
22
|
+
/** The MCP service, or `null` when `options.mcp` was omitted. */
|
|
23
|
+
get mcp(): ApcoreMcpService | null;
|
|
24
|
+
/** The CLI service, or `null` when `options.cli` was omitted. */
|
|
25
|
+
get cli(): ApcoreCliService | null;
|
|
26
|
+
/** The A2A service, or `null` when `options.a2a` was omitted. */
|
|
27
|
+
get a2a(): ApcoreA2aService | null;
|
|
28
|
+
/**
|
|
29
|
+
* Load a YAML bindings file and register its entries.
|
|
30
|
+
*
|
|
31
|
+
* @param filePath - Path to the YAML file. Defaults to `options.bindings`.
|
|
32
|
+
* @param resolveTarget - Resolves each entry's `target` to a live handler.
|
|
33
|
+
*/
|
|
34
|
+
loadBindings(filePath?: string, resolveTarget?: TargetResolver): Promise<string[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Mount the MCP endpoint into the Hono app so one port serves both HTTP and
|
|
37
|
+
* MCP. Node runtime only — see {@link mountMcpEndpoint}.
|
|
38
|
+
*
|
|
39
|
+
* @throws {Error} When the instance was created without `options.mcp`.
|
|
40
|
+
*/
|
|
41
|
+
mountMcp(app: MountableApp, options?: MountMcpOptions): Promise<McpApp>;
|
|
42
|
+
/**
|
|
43
|
+
* Convert the registered modules to OpenAI-compatible tool definitions.
|
|
44
|
+
*
|
|
45
|
+
* @throws {Error} When the instance was created without `options.mcp`.
|
|
46
|
+
*/
|
|
47
|
+
toOpenaiTools(options?: {
|
|
48
|
+
embedAnnotations?: boolean;
|
|
49
|
+
strict?: boolean;
|
|
50
|
+
tags?: string[];
|
|
51
|
+
prefix?: string;
|
|
52
|
+
}): Promise<unknown[]>;
|
|
53
|
+
/** Shut down the MCP and A2A surfaces. */
|
|
54
|
+
close(): Promise<void>;
|
|
55
|
+
protected loadConfiguredBindings(): Promise<void>;
|
|
56
|
+
protected startSurfaces(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create a Node {@link HonoApcore} instance.
|
|
60
|
+
*
|
|
61
|
+
* Sugar for `new HonoApcore(options)`, matching the `createX()` style the
|
|
62
|
+
* Hono ecosystem uses.
|
|
63
|
+
*/
|
|
64
|
+
export declare function createApcore(options?: HonoApcoreOptions): HonoApcore;
|
|
65
|
+
//# sourceMappingURL=apcore.node.d.ts.map
|