apcore-mcp 0.14.0 → 0.16.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 +82 -1
- package/dist/adapters/approval.d.ts +21 -0
- package/dist/adapters/approval.d.ts.map +1 -1
- package/dist/adapters/approval.js +49 -0
- package/dist/adapters/approval.js.map +1 -1
- package/dist/adapters/errors.d.ts +20 -0
- package/dist/adapters/errors.d.ts.map +1 -1
- package/dist/adapters/errors.js +61 -41
- package/dist/adapters/errors.js.map +1 -1
- package/dist/adapters/id-normalizer.d.ts +6 -5
- package/dist/adapters/id-normalizer.d.ts.map +1 -1
- package/dist/adapters/id-normalizer.js +9 -12
- package/dist/adapters/id-normalizer.js.map +1 -1
- package/dist/adapters/schema.d.ts +11 -0
- package/dist/adapters/schema.d.ts.map +1 -1
- package/dist/adapters/schema.js +43 -1
- package/dist/adapters/schema.js.map +1 -1
- package/dist/apcore-mcp.d.ts +17 -1
- package/dist/apcore-mcp.d.ts.map +1 -1
- package/dist/apcore-mcp.js +42 -4
- package/dist/apcore-mcp.js.map +1 -1
- package/dist/approval-store.d.ts +64 -0
- package/dist/approval-store.d.ts.map +1 -0
- package/dist/approval-store.js +139 -0
- package/dist/approval-store.js.map +1 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +7 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/jwt.d.ts.map +1 -1
- package/dist/auth/jwt.js +4 -1
- package/dist/auth/jwt.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/constants.d.ts +37 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +43 -0
- package/dist/constants.js.map +1 -0
- package/dist/converters/openai.d.ts +12 -0
- package/dist/converters/openai.d.ts.map +1 -1
- package/dist/converters/openai.js +28 -3
- package/dist/converters/openai.js.map +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +54 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +125 -0
- package/dist/markdown.js.map +1 -0
- package/dist/server/approval-bridge.d.ts +27 -0
- package/dist/server/approval-bridge.d.ts.map +1 -0
- package/dist/server/approval-bridge.js +77 -0
- package/dist/server/approval-bridge.js.map +1 -0
- package/dist/server/async-task-bridge.d.ts +39 -1
- package/dist/server/async-task-bridge.d.ts.map +1 -1
- package/dist/server/async-task-bridge.js +195 -9
- package/dist/server/async-task-bridge.js.map +1 -1
- package/dist/server/context.d.ts +8 -0
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/context.js +15 -0
- package/dist/server/context.js.map +1 -1
- package/dist/server/factory.d.ts +34 -1
- package/dist/server/factory.d.ts.map +1 -1
- package/dist/server/factory.js +69 -3
- package/dist/server/factory.js.map +1 -1
- package/dist/server/router.d.ts +29 -6
- package/dist/server/router.d.ts.map +1 -1
- package/dist/server/router.js +75 -25
- package/dist/server/router.js.map +1 -1
- package/dist/server/transport.d.ts +8 -1
- package/dist/server/transport.d.ts.map +1 -1
- package/dist/server/transport.js +15 -2
- package/dist/server/transport.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -1
- package/package.json +5 -8
- package/dist/explorer/index.d.ts +0 -2
- package/dist/explorer/index.d.ts.map +0 -1
- package/dist/explorer/index.js +0 -2
- package/dist/explorer/index.js.map +0 -1
- package/dist/inspector/index.d.ts +0 -2
- package/dist/inspector/index.d.ts.map +0 -1
- package/dist/inspector/index.js +0 -2
- package/dist/inspector/index.js.map +0 -1
- package/dist/server/index.d.ts +0 -11
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -8
- package/dist/server/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ Converts apcore module registries into [Model Context Protocol (MCP)](https://mo
|
|
|
12
12
|
|
|
13
13
|
- **MCP Server** — Expose apcore modules as MCP tools over stdio, Streamable HTTP, or SSE
|
|
14
14
|
- **OpenAI Tools** — Convert modules to OpenAI function calling format with strict mode support
|
|
15
|
+
- **Markdown tool descriptions** (`richDescription: true`, v0.15+) — render `Tool.description` and OpenAI `function.description` as canonical apcore-toolkit Markdown so LLMs get more decision-relevant signal per token. Requires `apcore-toolkit` (declared as `optionalDependencies`) and `await MCPServerFactory.prepare()` at startup.
|
|
16
|
+
- **Module preview meta-tool** (`__apcore_module_preview`, v0.15+) — drives `executor.validate()` to predict state changes WITHOUT executing the module (apcore PROTOCOL_SPEC §5.6). Returns `{valid, requires_approval, predicted_changes, checks}` so AI orchestrators can ask "what would change?" before invoking.
|
|
15
17
|
- **Schema Conversion** — Inline `$defs`/`$ref` from Pydantic-generated JSON Schema
|
|
16
18
|
- **Annotation Mapping** — Map module annotations to MCP hints and OpenAI description suffixes
|
|
17
19
|
- **Approval Mechanism** — Built-in elicitation-based approval flow for sensitive tool executions
|
|
@@ -30,7 +32,8 @@ For full documentation, including Quick Start guides for both Python and TypeScr
|
|
|
30
32
|
## Requirements
|
|
31
33
|
|
|
32
34
|
- Node.js >= 18.0.0
|
|
33
|
-
- `apcore-js >= 0.
|
|
35
|
+
- `apcore-js >= 0.21.1`
|
|
36
|
+
- Optional: `apcore-toolkit >= 0.6.1` for Markdown-rendered tool descriptions (declared under `optionalDependencies`).
|
|
34
37
|
|
|
35
38
|
## Installation
|
|
36
39
|
|
|
@@ -99,6 +102,7 @@ npx apcore-mcp --extensions-dir ./extensions --transport sse --port 8000
|
|
|
99
102
|
| `--jwt-require-auth` | `true` | Require auth (use `--jwt-permissive` to override and allow unauthenticated requests) |
|
|
100
103
|
| `--jwt-permissive` | `false` | Permissive mode: allow unauthenticated requests (overrides `--jwt-require-auth`) |
|
|
101
104
|
| `--exempt-paths` | `/health,/metrics,/usage` | Comma-separated paths exempt from auth |
|
|
105
|
+
| `--output-format` | `json` | Built-in output format: `json`, `csv`, or `jsonl` |
|
|
102
106
|
|
|
103
107
|
JWT key resolution priority: `--jwt-key-file` > `--jwt-secret` > `APCORE_JWT_SECRET` environment variable.
|
|
104
108
|
|
|
@@ -373,6 +377,22 @@ await close();
|
|
|
373
377
|
|
|
374
378
|
Accepts the same options as `serve()` except `transport`, `host`, `port`, `onStartup`, and `onShutdown`.
|
|
375
379
|
|
|
380
|
+
### Output Formatting
|
|
381
|
+
|
|
382
|
+
By default, tool execution results are serialized as JSON (`JSON.stringify`). You can customize this by passing an `outputFormat` name or a custom `outputFormatter` function.
|
|
383
|
+
|
|
384
|
+
**Built-in formats** (requires `apcore-toolkit` 0.7.0+):
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
// Via CLI
|
|
388
|
+
// npx apcore-mcp --extensions-dir ./extensions --output-format csv
|
|
389
|
+
|
|
390
|
+
// Via API
|
|
391
|
+
const mcp = new APCoreMCP("./extensions", { outputFormat: "csv" });
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Supports `json`, `csv`, and `jsonl`. Non-tabular data gracefully falls back to JSON.
|
|
395
|
+
|
|
376
396
|
### Tool Explorer
|
|
377
397
|
|
|
378
398
|
When `explorer: true` is passed to `serve()`, a browser-based Tool Explorer UI is mounted on HTTP transports. It provides an interactive page for browsing tool schemas and testing tool execution.
|
|
@@ -463,6 +483,67 @@ curl -X POST http://localhost:8000/mcp \
|
|
|
463
483
|
curl http://localhost:8000/health
|
|
464
484
|
```
|
|
465
485
|
|
|
486
|
+
#### Per-request identity helpers
|
|
487
|
+
|
|
488
|
+
When auth is enabled, each request runs inside an `AsyncLocalStorage`
|
|
489
|
+
context whose value is the verified `Identity`. Modules and middleware
|
|
490
|
+
read it with `getCurrentIdentity()` — no need to thread it through every
|
|
491
|
+
function.
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
import { getCurrentIdentity, identityStorage } from "apcore-mcp";
|
|
495
|
+
import type { Identity } from "apcore-mcp";
|
|
496
|
+
|
|
497
|
+
// Inside a module / middleware called from a tool invocation:
|
|
498
|
+
const id: Identity | null = getCurrentIdentity();
|
|
499
|
+
if (id) {
|
|
500
|
+
// id.id (user id), id.type ("user" | "service" | ...), id.roles, id.attrs
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Lower-level access (e.g. for running custom code inside a known identity):
|
|
504
|
+
identityStorage.run(myIdentity, async () => {
|
|
505
|
+
/* code that calls getCurrentIdentity() */
|
|
506
|
+
});
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Python parity: `apcore_mcp.get_current_identity()` / `auth_identity_var`.
|
|
510
|
+
Rust parity: `apcore_mcp::AUTH_IDENTITY` task-local.
|
|
511
|
+
|
|
512
|
+
#### Mounting the Explorer behind your own server
|
|
513
|
+
|
|
514
|
+
If you embed the bridge via `asyncServe(...)` instead of `serve(...)`,
|
|
515
|
+
gate the explorer routes behind an auth hook with
|
|
516
|
+
`buildExplorerAuthHook(authenticator)`:
|
|
517
|
+
|
|
518
|
+
```typescript
|
|
519
|
+
import { buildExplorerAuthHook } from "apcore-mcp";
|
|
520
|
+
import { JWTAuthenticator } from "apcore-mcp";
|
|
521
|
+
|
|
522
|
+
const auth = new JWTAuthenticator({ key: process.env.JWT_SECRET! });
|
|
523
|
+
const guard = buildExplorerAuthHook(auth);
|
|
524
|
+
|
|
525
|
+
// `guard` is a `(req, next) => Promise<Response>` hook accepted by
|
|
526
|
+
// mcp-embedded-ui's Hono router. Returns a 401 response when the
|
|
527
|
+
// Authorization header is missing or invalid; otherwise runs `next()`
|
|
528
|
+
// inside `identityStorage.run(identity, ...)` so the explorer's
|
|
529
|
+
// downstream handlers see the authenticated identity.
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
#### Custom observability stack (advanced)
|
|
533
|
+
|
|
534
|
+
For callers who don't want the `serve(... observability: true)` shorthand,
|
|
535
|
+
`installObservability` wires the metrics + usage middleware onto an
|
|
536
|
+
existing `Executor` directly. It is what `serve()` calls internally.
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
import { installObservability } from "apcore-mcp";
|
|
540
|
+
import type { ObservabilityFlag } from "apcore-mcp";
|
|
541
|
+
|
|
542
|
+
const stack = await installObservability(executor, /* metricsCollector */ null, true satisfies ObservabilityFlag);
|
|
543
|
+
// stack.metricsCollector / stack.usageCollector are then exposed on
|
|
544
|
+
// the `/metrics` and `/usage` endpoints by your own HTTP wiring.
|
|
545
|
+
```
|
|
546
|
+
|
|
466
547
|
### `toOpenaiTools(registryOrExecutor, options?)`
|
|
467
548
|
|
|
468
549
|
Export apcore modules as OpenAI-compatible tool definitions.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Uses the MCP elicit callback (injected into Context.data) to present
|
|
5
5
|
* approval requests to the human user via the MCP client.
|
|
6
6
|
*/
|
|
7
|
+
import type { ApprovalStore } from "../approval-store.js";
|
|
7
8
|
export interface ApprovalRequest {
|
|
8
9
|
moduleId: string;
|
|
9
10
|
description?: string | null;
|
|
@@ -32,4 +33,24 @@ export declare class ElicitationApprovalHandler {
|
|
|
32
33
|
*/
|
|
33
34
|
checkApproval(_approvalId: string): Promise<ApprovalResult>;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Phase B approval handler backed by a pluggable ApprovalStore.
|
|
38
|
+
*
|
|
39
|
+
* requestApproval() saves a pending record and returns a pending ApprovalResult
|
|
40
|
+
* causing apcore to raise ApprovalPendingError → APPROVAL_PENDING in MCP envelope.
|
|
41
|
+
* checkApproval() reads the store; called by apcore when client retries with
|
|
42
|
+
* _meta.approvalId set.
|
|
43
|
+
*
|
|
44
|
+
* notifyCallback lets callers fan out to Slack/email/webhooks.
|
|
45
|
+
* Signature: (approvalId: string, moduleId: string, arguments: Record<string, unknown>) => Promise<void>
|
|
46
|
+
*/
|
|
47
|
+
export declare class StorageBackedApprovalHandler {
|
|
48
|
+
private readonly store;
|
|
49
|
+
private readonly notifyCallback?;
|
|
50
|
+
constructor(store: ApprovalStore, options?: {
|
|
51
|
+
notifyCallback?: (approvalId: string, moduleId: string, args: Record<string, unknown>) => Promise<void>;
|
|
52
|
+
});
|
|
53
|
+
requestApproval(request: ApprovalRequest): Promise<ApprovalResult>;
|
|
54
|
+
checkApproval(approvalId: string): Promise<ApprovalResult>;
|
|
55
|
+
}
|
|
35
56
|
//# sourceMappingURL=approval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/adapters/approval.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACxD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,qBAAa,0BAA0B;IACrC;;;;;OAKG;IACG,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAsCxE;;;;;OAKG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAGlE"}
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/adapters/approval.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACxD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,qBAAa,0BAA0B;IACrC;;;;;OAKG;IACG,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAsCxE;;;;;OAKG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAGlE;AAED;;;;;;;;;;GAUG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAyF;gBAGvH,KAAK,EAAE,aAAa,EACpB,OAAO,GAAE;QACP,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACpG;IAMF,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAmBlE,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAajE"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Uses the MCP elicit callback (injected into Context.data) to present
|
|
5
5
|
* approval requests to the human user via the MCP client.
|
|
6
6
|
*/
|
|
7
|
+
import { randomUUID } from "crypto";
|
|
7
8
|
import { MCP_ELICIT_KEY } from "../helpers.js";
|
|
8
9
|
export class ElicitationApprovalHandler {
|
|
9
10
|
/**
|
|
@@ -50,4 +51,52 @@ export class ElicitationApprovalHandler {
|
|
|
50
51
|
return { status: "rejected", reason: "Phase B not supported via MCP elicitation" };
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Phase B approval handler backed by a pluggable ApprovalStore.
|
|
56
|
+
*
|
|
57
|
+
* requestApproval() saves a pending record and returns a pending ApprovalResult
|
|
58
|
+
* causing apcore to raise ApprovalPendingError → APPROVAL_PENDING in MCP envelope.
|
|
59
|
+
* checkApproval() reads the store; called by apcore when client retries with
|
|
60
|
+
* _meta.approvalId set.
|
|
61
|
+
*
|
|
62
|
+
* notifyCallback lets callers fan out to Slack/email/webhooks.
|
|
63
|
+
* Signature: (approvalId: string, moduleId: string, arguments: Record<string, unknown>) => Promise<void>
|
|
64
|
+
*/
|
|
65
|
+
export class StorageBackedApprovalHandler {
|
|
66
|
+
store;
|
|
67
|
+
notifyCallback;
|
|
68
|
+
constructor(store, options = {}) {
|
|
69
|
+
this.store = store;
|
|
70
|
+
this.notifyCallback = options.notifyCallback;
|
|
71
|
+
}
|
|
72
|
+
async requestApproval(request) {
|
|
73
|
+
const approvalId = randomUUID();
|
|
74
|
+
const moduleId = request.moduleId ?? "unknown";
|
|
75
|
+
const args = request.arguments ?? {};
|
|
76
|
+
await this.store.savePending(approvalId, moduleId, args);
|
|
77
|
+
if (this.notifyCallback) {
|
|
78
|
+
try {
|
|
79
|
+
await this.notifyCallback(approvalId, moduleId, args);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
// log but don't fail the approval request
|
|
83
|
+
console.warn(`[apcore-mcp] notifyCallback raised for approval ${approvalId}:`, err);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return { status: "pending", reason: approvalId };
|
|
87
|
+
}
|
|
88
|
+
async checkApproval(approvalId) {
|
|
89
|
+
const record = await this.store.getResult(approvalId);
|
|
90
|
+
if (!record) {
|
|
91
|
+
return { status: "rejected", reason: "approval_id not found" };
|
|
92
|
+
}
|
|
93
|
+
if (record.status === "approved") {
|
|
94
|
+
return { status: "approved" };
|
|
95
|
+
}
|
|
96
|
+
if (record.status === "rejected") {
|
|
97
|
+
return { status: "rejected", reason: record.reason ?? undefined };
|
|
98
|
+
}
|
|
99
|
+
return { status: "pending" };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
53
102
|
//# sourceMappingURL=approval.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.js","sourceRoot":"","sources":["../../src/adapters/approval.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"approval.js","sourceRoot":"","sources":["../../src/adapters/approval.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAe/C,MAAM,OAAO,0BAA0B;IACrC;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,OAAwB;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC;QAC3C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,sCAAsC,EAAE,CAAC;QAChF,CAAC;QAED,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAE7B,CAAC;QAEd,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,mCAAmC,EAAE,CAAC;QAC7E,CAAC;QAED,MAAM,OAAO,GACX,+BAA+B,OAAO,CAAC,QAAQ,MAAM;YACrD,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,MAAM;Y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_INTERNAL_ERROR envelope for non-ModuleError fallback.
|
|
18
|
+
*
|
|
19
|
+
* All three SDKs (Python, TypeScript, Rust) emit byte-identical envelopes so
|
|
20
|
+
* MCP clients can branch on `errorType === "GENERAL_INTERNAL_ERROR"` portably.
|
|
21
|
+
* See `apcore-mcp/docs/features/error-mapper.md` (EM-6).
|
|
22
|
+
*/
|
|
23
|
+
export declare function internalErrorResponse(): McpErrorResponse;
|
|
16
24
|
export declare class ErrorMapper {
|
|
17
25
|
/**
|
|
18
26
|
* Convert an error to an MCP error response.
|
|
@@ -21,6 +29,18 @@ export declare class ErrorMapper {
|
|
|
21
29
|
* Applies sanitization and formatting rules based on the error code.
|
|
22
30
|
*/
|
|
23
31
|
toMcpError(error: unknown): McpErrorResponse;
|
|
32
|
+
/**
|
|
33
|
+
* Generic-error fallback for arbitrary inputs.
|
|
34
|
+
*
|
|
35
|
+
* Ports Rust's `to_mcp_error_any` downcast pattern: if the input is a
|
|
36
|
+
* `ModuleError` subclass, delegate to {@link toMcpError} so structured
|
|
37
|
+
* fields (code, details, AI guidance) survive. Otherwise — plain `Error`,
|
|
38
|
+
* unrelated subclass, or non-error object — return the canonical
|
|
39
|
+
* GENERAL_INTERNAL_ERROR envelope. The original class, message, stack,
|
|
40
|
+
* and details are deliberately discarded in that branch (security: avoid
|
|
41
|
+
* leaking server-side state). [D9-004]
|
|
42
|
+
*/
|
|
43
|
+
toMcpErrorAny(error: unknown): McpErrorResponse;
|
|
24
44
|
/**
|
|
25
45
|
* Preferred `instanceof` dispatch for concrete apcore-js error classes.
|
|
26
46
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/adapters/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/adapters/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAOxD;AA0DD,qBAAa,WAAW;IACtB;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB;IA4M5C;;;;;;;;;;OAUG;IACH,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB;IAQ/C;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAsDjC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAQ7B;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAetB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;CA4B/B"}
|
package/dist/adapters/errors.js
CHANGED
|
@@ -13,10 +13,30 @@
|
|
|
13
13
|
* `ModuleError`.
|
|
14
14
|
*/
|
|
15
15
|
import { ErrorCodes } from "../types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Canonical GENERAL_INTERNAL_ERROR envelope for non-ModuleError fallback.
|
|
18
|
+
*
|
|
19
|
+
* All three SDKs (Python, TypeScript, Rust) emit byte-identical envelopes so
|
|
20
|
+
* MCP clients can branch on `errorType === "GENERAL_INTERNAL_ERROR"` portably.
|
|
21
|
+
* See `apcore-mcp/docs/features/error-mapper.md` (EM-6).
|
|
22
|
+
*/
|
|
23
|
+
export function internalErrorResponse() {
|
|
24
|
+
return {
|
|
25
|
+
isError: true,
|
|
26
|
+
errorType: ErrorCodes.GENERAL_INTERNAL_ERROR,
|
|
27
|
+
message: "Internal error occurred",
|
|
28
|
+
details: null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
16
31
|
/**
|
|
17
32
|
* Lazy snapshot of apcore-js error classes used for `instanceof` dispatch.
|
|
18
33
|
* Populated on first use; falls back to duck-typing when apcore-js is
|
|
19
34
|
* unavailable. Cached across calls for perf.
|
|
35
|
+
*
|
|
36
|
+
* `ModuleError` is the documented base class for all structured apcore errors.
|
|
37
|
+
* `toMcpErrorAny` uses it as a downcast pivot, mirroring Rust's
|
|
38
|
+
* `to_mcp_error_any` which checks `err.downcast_ref::<ModuleError>()` before
|
|
39
|
+
* collapsing to the canonical envelope.
|
|
20
40
|
*/
|
|
21
41
|
let _apcoreErrorClasses = null;
|
|
22
42
|
async function _loadApcoreErrorClasses() {
|
|
@@ -26,6 +46,7 @@ async function _loadApcoreErrorClasses() {
|
|
|
26
46
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
47
|
const apcore = (await import("apcore-js"));
|
|
28
48
|
_apcoreErrorClasses = {
|
|
49
|
+
ModuleError: apcore.ModuleError,
|
|
29
50
|
TaskLimitExceededError: apcore.TaskLimitExceededError,
|
|
30
51
|
VersionConstraintError: apcore.VersionConstraintError,
|
|
31
52
|
DependencyNotFoundError: apcore.DependencyNotFoundError,
|
|
@@ -112,18 +133,15 @@ export class ErrorMapper {
|
|
|
112
133
|
this._attachAiGuidance(error, result);
|
|
113
134
|
return result;
|
|
114
135
|
}
|
|
115
|
-
// Approval pending -> narrow details to approvalId only
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
136
|
+
// Approval pending -> narrow details to approvalId only.
|
|
137
|
+
// [D10-003] Cross-language parity: upstream apcore SDKs emit
|
|
138
|
+
// snake_case (`approval_id`) exclusively, so the previous dual-key
|
|
139
|
+
// branch for camelCase `approvalId` was dormant and diverged from
|
|
140
|
+
// Python/Rust contracts (which accept snake_case only). Drop the
|
|
141
|
+
// camelCase source key; the output stays camelCase per MCP convention.
|
|
119
142
|
if (code === ErrorCodes.APPROVAL_PENDING) {
|
|
120
|
-
const
|
|
121
|
-
?
|
|
122
|
-
: details && "approval_id" in details
|
|
123
|
-
? "approval_id"
|
|
124
|
-
: null;
|
|
125
|
-
const narrowed = idKey
|
|
126
|
-
? { approvalId: details[idKey] }
|
|
143
|
+
const narrowed = details && "approval_id" in details
|
|
144
|
+
? { approvalId: details["approval_id"] }
|
|
127
145
|
: null;
|
|
128
146
|
const result = {
|
|
129
147
|
isError: true,
|
|
@@ -204,19 +222,6 @@ export class ErrorMapper {
|
|
|
204
222
|
this._attachAiGuidance(error, result);
|
|
205
223
|
return result;
|
|
206
224
|
}
|
|
207
|
-
// Dependency resolution errors (apcore 0.19) -> pass through with user-fixable hint
|
|
208
|
-
if (code === ErrorCodes.DEPENDENCY_NOT_FOUND ||
|
|
209
|
-
code === ErrorCodes.DEPENDENCY_VERSION_MISMATCH) {
|
|
210
|
-
const result = {
|
|
211
|
-
isError: true,
|
|
212
|
-
errorType: code,
|
|
213
|
-
message: error.message,
|
|
214
|
-
details,
|
|
215
|
-
userFixable: true,
|
|
216
|
-
};
|
|
217
|
-
this._attachAiGuidance(error, result);
|
|
218
|
-
return result;
|
|
219
|
-
}
|
|
220
225
|
// Task limit exceeded -> retryable
|
|
221
226
|
if (code === ErrorCodes.TASK_LIMIT_EXCEEDED) {
|
|
222
227
|
const result = {
|
|
@@ -229,20 +234,24 @@ export class ErrorMapper {
|
|
|
229
234
|
this._attachAiGuidance(error, result);
|
|
230
235
|
return result;
|
|
231
236
|
}
|
|
232
|
-
//
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
code === ErrorCodes.BINDING_STRICT_SCHEMA_INCOMPATIBLE ||
|
|
237
|
-
code === ErrorCodes.BINDING_POLICY_VIOLATION) {
|
|
237
|
+
// apcore 0.20.0 sync alignment A-001: CircuitBreakerOpenError ->
|
|
238
|
+
// retryable=true with the per-module recovery hint already attached
|
|
239
|
+
// by apcore-js's error class (mirrored via _attachAiGuidance).
|
|
240
|
+
if (code === ErrorCodes.CIRCUIT_BREAKER_OPEN) {
|
|
238
241
|
const result = {
|
|
239
242
|
isError: true,
|
|
240
243
|
errorType: code,
|
|
241
244
|
message: error.message,
|
|
242
245
|
details,
|
|
243
|
-
|
|
246
|
+
retryable: true,
|
|
244
247
|
};
|
|
245
248
|
this._attachAiGuidance(error, result);
|
|
249
|
+
if (!result.aiGuidance) {
|
|
250
|
+
result.aiGuidance =
|
|
251
|
+
"Module's circuit breaker is OPEN — repeated failures have tripped " +
|
|
252
|
+
"the breaker. Wait until the recovery window elapses, then retry; " +
|
|
253
|
+
"the breaker will move to HALF_OPEN and accept a trial call.";
|
|
254
|
+
}
|
|
246
255
|
return result;
|
|
247
256
|
}
|
|
248
257
|
// Other known ModuleError codes -> pass through
|
|
@@ -255,13 +264,27 @@ export class ErrorMapper {
|
|
|
255
264
|
this._attachAiGuidance(error, result);
|
|
256
265
|
return result;
|
|
257
266
|
}
|
|
258
|
-
// Unknown/unexpected exceptions ->
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
267
|
+
// Unknown/unexpected exceptions -> canonical GENERAL_INTERNAL_ERROR envelope (EM-6).
|
|
268
|
+
// Mirrors Python `internal_error_response()` and Rust `to_mcp_error_any()`.
|
|
269
|
+
return internalErrorResponse();
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Generic-error fallback for arbitrary inputs.
|
|
273
|
+
*
|
|
274
|
+
* Ports Rust's `to_mcp_error_any` downcast pattern: if the input is a
|
|
275
|
+
* `ModuleError` subclass, delegate to {@link toMcpError} so structured
|
|
276
|
+
* fields (code, details, AI guidance) survive. Otherwise — plain `Error`,
|
|
277
|
+
* unrelated subclass, or non-error object — return the canonical
|
|
278
|
+
* GENERAL_INTERNAL_ERROR envelope. The original class, message, stack,
|
|
279
|
+
* and details are deliberately discarded in that branch (security: avoid
|
|
280
|
+
* leaking server-side state). [D9-004]
|
|
281
|
+
*/
|
|
282
|
+
toMcpErrorAny(error) {
|
|
283
|
+
const ModuleError = _apcoreErrorClasses?.ModuleError;
|
|
284
|
+
if (ModuleError && error instanceof ModuleError) {
|
|
285
|
+
return this.toMcpError(error);
|
|
286
|
+
}
|
|
287
|
+
return internalErrorResponse();
|
|
265
288
|
}
|
|
266
289
|
/**
|
|
267
290
|
* Preferred `instanceof` dispatch for concrete apcore-js error classes.
|
|
@@ -294,7 +317,6 @@ export class ErrorMapper {
|
|
|
294
317
|
errorType: ErrorCodes.DEPENDENCY_NOT_FOUND,
|
|
295
318
|
message: error.message,
|
|
296
319
|
details: asModErr.details ?? null,
|
|
297
|
-
userFixable: true,
|
|
298
320
|
};
|
|
299
321
|
this._attachAiGuidance(error, result);
|
|
300
322
|
return result;
|
|
@@ -305,7 +327,6 @@ export class ErrorMapper {
|
|
|
305
327
|
errorType: ErrorCodes.DEPENDENCY_VERSION_MISMATCH,
|
|
306
328
|
message: error.message,
|
|
307
329
|
details: asModErr.details ?? null,
|
|
308
|
-
userFixable: true,
|
|
309
330
|
};
|
|
310
331
|
this._attachAiGuidance(error, result);
|
|
311
332
|
return result;
|
|
@@ -316,7 +337,6 @@ export class ErrorMapper {
|
|
|
316
337
|
errorType: ErrorCodes.VERSION_CONSTRAINT_INVALID,
|
|
317
338
|
message: error.message,
|
|
318
339
|
details: asModErr.details ?? null,
|
|
319
|
-
userFixable: true,
|
|
320
340
|
};
|
|
321
341
|
this._attachAiGuidance(error, result);
|
|
322
342
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/adapters/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/adapters/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,UAAU,CAAC,sBAAsB;QAC5C,OAAO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,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,MAAM,WAAW,GAAG,MAAM;aACvB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC5C,MAAM,KAAK,GAAG,GAA8B,CAAC;gBAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC;gBAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC;gBACvD,OAAO,KAAK,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAClD,CAAC;YACD,OAAO,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,OAAO,GAAG,WAAW,MAAM,WAAW,EAAE,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -28,12 +28,13 @@ export declare class ModuleIDNormalizer {
|
|
|
28
28
|
* Bijection-guarded variant of denormalize. [MID-5]
|
|
29
29
|
*
|
|
30
30
|
* Returns the denormalized module ID if `toolName` is a valid pre-image of
|
|
31
|
-
* `normalize()` (i.e.
|
|
32
|
-
* Returns `null` for inputs that could not have been
|
|
31
|
+
* `normalize()` (i.e. the dash→dot replacement yields a string matching
|
|
32
|
+
* MODULE_ID_PATTERN). Returns `null` for inputs that could not have been
|
|
33
|
+
* produced by `normalize()`.
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* -
|
|
35
|
+
* Cross-language parity [D11-3]: validates the denormalized result against
|
|
36
|
+
* the shared MODULE_ID_PATTERN so underscores within segments (e.g.
|
|
37
|
+
* `"my_mod-v2"` → `"my_mod.v2"`) round-trip identically to Python/Rust.
|
|
37
38
|
*/
|
|
38
39
|
tryDenormalize(toolName: string): string | null;
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-normalizer.d.ts","sourceRoot":"","sources":["../../src/adapters/id-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,qBAAa,kBAAkB;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IASnC;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIrC
|
|
1
|
+
{"version":3,"file":"id-normalizer.d.ts","sourceRoot":"","sources":["../../src/adapters/id-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,qBAAa,kBAAkB;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IASnC;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIrC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAMhD"}
|
|
@@ -36,24 +36,21 @@ export class ModuleIDNormalizer {
|
|
|
36
36
|
* Bijection-guarded variant of denormalize. [MID-5]
|
|
37
37
|
*
|
|
38
38
|
* Returns the denormalized module ID if `toolName` is a valid pre-image of
|
|
39
|
-
* `normalize()` (i.e.
|
|
40
|
-
* Returns `null` for inputs that could not have been
|
|
39
|
+
* `normalize()` (i.e. the dash→dot replacement yields a string matching
|
|
40
|
+
* MODULE_ID_PATTERN). Returns `null` for inputs that could not have been
|
|
41
|
+
* produced by `normalize()`.
|
|
41
42
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* -
|
|
43
|
+
* Cross-language parity [D11-3]: validates the denormalized result against
|
|
44
|
+
* the shared MODULE_ID_PATTERN so underscores within segments (e.g.
|
|
45
|
+
* `"my_mod-v2"` → `"my_mod.v2"`) round-trip identically to Python/Rust.
|
|
45
46
|
*/
|
|
46
47
|
tryDenormalize(toolName) {
|
|
47
|
-
// Must be non-empty, all-lowercase, no consecutive/leading/trailing hyphens,
|
|
48
|
-
// only [a-z0-9-] characters.
|
|
49
48
|
if (!toolName || toolName.length === 0)
|
|
50
49
|
return null;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const NORMALIZED_PATTERN = /^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$/;
|
|
54
|
-
if (!NORMALIZED_PATTERN.test(toolName))
|
|
50
|
+
const denormalized = this.denormalize(toolName);
|
|
51
|
+
if (!MODULE_ID_PATTERN.test(denormalized))
|
|
55
52
|
return null;
|
|
56
|
-
return
|
|
53
|
+
return denormalized;
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
//# sourceMappingURL=id-normalizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-normalizer.js","sourceRoot":"","sources":["../../src/adapters/id-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,OAAO,kBAAkB;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,QAAgB;QACxB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,sBAAsB,QAAQ,yBAAyB,iBAAiB,EAAE,CAC3E,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,QAAgB;QAC1B,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"id-normalizer.js","sourceRoot":"","sources":["../../src/adapters/id-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,OAAO,kBAAkB;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,QAAgB;QACxB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,sBAAsB,QAAQ,yBAAyB,iBAAiB,EAAE,CAC3E,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,QAAgB;QAC1B,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,QAAgB;QAC7B,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACpD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC;YAAE,OAAO,IAAI,CAAC;QACvD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -47,6 +47,15 @@ export declare class SchemaConverter {
|
|
|
47
47
|
*
|
|
48
48
|
* Returns a deep copy of the resolved definition to avoid mutation.
|
|
49
49
|
* Throws Error if the ref format is invalid or the definition is not found.
|
|
50
|
+
*
|
|
51
|
+
* JS-specific hardening (mirrors apcore-toolkit's `PROTO_DENY_LIST` in
|
|
52
|
+
* `binding-parser.ts`): reject ref segments that resolve to dangerous
|
|
53
|
+
* prototype-chain keys (`__proto__`, `constructor`, `prototype`). Without
|
|
54
|
+
* this guard, `defs[name]` would return values from `Object.prototype`
|
|
55
|
+
* even when the user supplied no matching definition, enabling prototype
|
|
56
|
+
* pollution / unexpected schema resolution. This deny-list has no Python
|
|
57
|
+
* counterpart because Python's attribute lookups are not affected by this
|
|
58
|
+
* vulnerability class.
|
|
50
59
|
*/
|
|
51
60
|
_resolveRef(refPath: string, defs: Record<string, JsonSchema>): JsonSchema;
|
|
52
61
|
/**
|
|
@@ -54,6 +63,8 @@ export declare class SchemaConverter {
|
|
|
54
63
|
*
|
|
55
64
|
* - Empty schema -> `{ type: "object", properties: {} }`
|
|
56
65
|
* - Schema without `type` -> adds `type: "object"`
|
|
66
|
+
* - Schema with non-object `type` but defining `properties` -> forces
|
|
67
|
+
* `type: "object"` to keep cross-language parity with Python/Rust [D11-4].
|
|
57
68
|
*/
|
|
58
69
|
_ensureObjectType(schema: JsonSchema): JsonSchema;
|
|
59
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/adapters/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/adapters/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAuBD,qBAAa,eAAe;IAC1B;;OAEG;IACH,kBAAkB,CAChB,UAAU,EAAE,gBAAgB,EAC5B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,UAAU;IAIb;;OAEG;IACH,mBAAmB,CACjB,UAAU,EAAE,gBAAgB,EAC5B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,UAAU;IAIb;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,UAAU;IAyB9E;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAkGpC;;;;;OAKG;IACH,WAAW,CACT,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAChC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,KAAK,GAAE,MAAU,GAChB,OAAO;IAsDV;;;;;;;;;;;;;;OAcG;IACH,WAAW,CACT,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAC/B,UAAU;IA+Bb;;;;;;;OAOG;IACH,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU;CA0BlD"}
|