ai-runtime-engine 3.0.0 → 3.0.1
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/CHANGELOG.md +63 -0
- package/dist/cli/cli.js +8 -1
- package/dist/cli/commands/cleanup.js +11 -3
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/run.js +6 -0
- package/dist/cli/commands/skills.js +9 -2
- package/dist/cli/interactive/repl.js +12 -2
- package/dist/cli/interactive/session.d.ts +2 -0
- package/dist/cli/interactive/session.js +6 -2
- package/dist/config/schema.js +19 -1
- package/dist/conversations/conversations.d.ts +6 -1
- package/dist/conversations/conversations.js +15 -8
- package/dist/core/fallback/fallback.d.ts +7 -0
- package/dist/core/fallback/fallback.js +15 -2
- package/dist/core/health/monitor.d.ts +6 -0
- package/dist/core/health/monitor.js +15 -2
- package/dist/core/router/confidence.js +10 -5
- package/dist/core/router/dimensions.d.ts +3 -1
- package/dist/core/router/dimensions.js +15 -5
- package/dist/core/router/filter.js +25 -6
- package/dist/core/router/normalize.js +2 -0
- package/dist/core/router/router.js +16 -2
- package/dist/core/router/scorer.d.ts +3 -0
- package/dist/core/router/scorer.js +17 -2
- package/dist/discovery/openapi.js +3 -2
- package/dist/executions/agentTasks.d.ts +4 -4
- package/dist/generation/generateAdapter.js +3 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -2
- package/dist/mcp/protocol.js +4 -1
- package/dist/memory/bm25.d.ts +7 -0
- package/dist/memory/bm25.js +17 -1
- package/dist/memory/memory.d.ts +7 -1
- package/dist/memory/memory.js +18 -4
- package/dist/plugin/ai.d.ts +6 -0
- package/dist/plugin/ai.js +17 -2
- package/dist/providers/estimate.d.ts +25 -0
- package/dist/providers/estimate.js +55 -0
- package/dist/providers/factory.d.ts +3 -0
- package/dist/providers/factory.js +26 -5
- package/dist/providers/httpClient.js +4 -0
- package/dist/providers/httpProvider.js +4 -3
- package/dist/providers/mock/mockProvider.js +4 -3
- package/dist/runtime/config.d.ts +4 -3
- package/dist/runtime/config.js +13 -22
- package/dist/runtime/events.d.ts +6 -0
- package/dist/runtime/runtime.d.ts +3 -2
- package/dist/runtime/runtime.js +17 -7
- package/dist/runtime/types.d.ts +2 -1
- package/dist/store/area.d.ts +1 -1
- package/dist/store/area.js +34 -10
- package/dist/store/crypto.d.ts +27 -13
- package/dist/store/crypto.js +101 -23
- package/dist/store/errors.d.ts +11 -0
- package/dist/store/errors.js +14 -0
- package/dist/store/store.d.ts +21 -1
- package/dist/store/store.js +74 -19
- package/dist/telemetry/sinks/file.js +4 -2
- package/dist/telemetry/sinks/otlp.d.ts +12 -2
- package/dist/telemetry/sinks/otlp.js +39 -24
- package/dist/telemetry/telemetry.d.ts +5 -0
- package/dist/telemetry/telemetry.js +4 -0
- package/dist/tools/builtins/shell.d.ts +30 -3
- package/dist/tools/builtins/shell.js +218 -7
- package/dist/tools/untrusted.d.ts +1 -1
- package/dist/tools/untrusted.js +5 -3
- package/dist/types.d.ts +14 -0
- package/dist/verification/verify.js +10 -3
- package/docs/GUIDE.md +66 -1
- package/docs/README.md +1 -1
- package/docs/architecture.md +5 -1
- package/docs/router.md +1 -1
- package/docs/security.md +26 -7
- package/package.json +4 -2
package/docs/architecture.md
CHANGED
|
@@ -27,6 +27,9 @@ its own.
|
|
|
27
27
|
| Learning | What providers/skills/plans work better? | `src/learning/**` |
|
|
28
28
|
| Comparison | How do candidates compare, by evidence? | `src/comparison/**` |
|
|
29
29
|
| Executions | How does a long run persist and resume? | `src/executions/**` |
|
|
30
|
+
| Capabilities | What can a task *do*; what does a goal require? | `src/capabilities/**` |
|
|
31
|
+
| MCP | Which external servers add tools/context? | `src/mcp/**` |
|
|
32
|
+
| Agents | What bounded sub-work can a step delegate? | `src/agents/**` |
|
|
30
33
|
|
|
31
34
|
Conversation ≠ Memory ≠ Learning ≠ Repository ≠ Execution — separate stores, separate rules.
|
|
32
35
|
|
|
@@ -75,4 +78,5 @@ backward compatible and independently usable.
|
|
|
75
78
|
Offline and deterministic: a `MockProvider` stands in for real adapters, and injected clocks make timing
|
|
76
79
|
reproducible. Every phase kept the full suite green (typecheck + tests + build), added regression coverage
|
|
77
80
|
for new behavior, and ran an adversarial security/logic review before merge. CI runs all three on every
|
|
78
|
-
push and PR
|
|
81
|
+
push and PR, across a matrix of Node 22 and 24 on Linux and Windows, plus a tarball-contents audit and a
|
|
82
|
+
test-count integrity check.
|
package/docs/router.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Router engine reference
|
|
2
2
|
|
|
3
|
-
The **router** is the engine beneath the [Runtime](../README.md#
|
|
3
|
+
The **router** is the engine beneath the [Runtime](../README.md#what-you-can-do): the vendor-agnostic
|
|
4
4
|
`AI` class that turns a task into a routed, executed, validated result. Most users only touch it through
|
|
5
5
|
the Runtime — but it is fully usable on its own (`import { AI } from 'ai-runtime-engine'`), and this document is
|
|
6
6
|
its complete reference: configuration, the `run()` API, providers, tasks/capabilities, routing internals,
|
package/docs/security.md
CHANGED
|
@@ -8,9 +8,10 @@ first-class and tested. The runtime is always authoritative — nothing it *read
|
|
|
8
8
|
|
|
9
9
|
Tool output, file contents, web pages, and MCP results enter the model context as tagged **data blocks**,
|
|
10
10
|
never in instruction position. They cannot change permissions, obtain secrets, run commands, bypass
|
|
11
|
-
approvals, or modify policy. Built-in skills fence file/web content with `wrapUntrusted`,
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
approvals, or modify policy. Built-in skills fence file/web content with `wrapUntrusted`, which neutralizes
|
|
12
|
+
ANY fence marker inside the content (not just its own label), so nested or foreign-labeled fences cannot
|
|
13
|
+
forge a boundary when several blocks share one prompt. An injection heuristic flags likely prompt-injection.
|
|
14
|
+
A request to "handle my list/emails/etc." authorizes *reading* the items, not executing whatever they contain.
|
|
14
15
|
|
|
15
16
|
## Filesystem jail
|
|
16
17
|
|
|
@@ -24,15 +25,27 @@ from outside the workspace.
|
|
|
24
25
|
## Shell
|
|
25
26
|
|
|
26
27
|
Allowlist-first: only commands in `permissions.shell.allowedCommands` run without approval; anything else
|
|
27
|
-
requires approval.
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
requires approval. Two denylists require approval **even when allowlisted**: destructive commands
|
|
29
|
+
(`rm -rf`, `git reset --hard`, force-push, `sudo`, …) and **eval-capable** commands — interpreters run
|
|
30
|
+
with inline-code/preload flags (`node -e`/`-r`, `python -c/-m`, `perl -M`, the `awk` family, …), package
|
|
31
|
+
and script runners (`npx`, `npm exec`/`run`/`init`, `deno task`, …), container `run`/`exec`, argv-indirection
|
|
32
|
+
wrappers (`env`, `xargs`, `nice`, `timeout`, `find -exec`, …), and non-default `make -f`. The allowlist
|
|
33
|
+
matches an absolute path by basename but never a relative or workspace-internal path (realpath-checked),
|
|
34
|
+
so a model cannot write an executable and run it under an allowlisted name.
|
|
35
|
+
|
|
36
|
+
This backstop is **best-effort, not exhaustive**: a denylist over interpreters/wrappers cannot cover every
|
|
37
|
+
one. Allowlisting an interpreter or a package manager INHERENTLY grants code execution — prefer allowlisting
|
|
38
|
+
specific leaf tools. Known accepted residuals: running a *script file* via an interpreter (the same case as
|
|
39
|
+
`node build.js`, deliberately allowed), dependency-install lifecycle scripts (they run by design), and a
|
|
40
|
+
few obscure exec vectors (`sed`/`rename` `e`-flag, git aliases). Execution is confined to the working
|
|
41
|
+
directory, with a filtered environment, a timeout, an `AbortSignal`, and process-tree cancellation.
|
|
30
42
|
|
|
31
43
|
## Permissions (deny-by-default)
|
|
32
44
|
|
|
33
45
|
Reads are allowed (and jailed). Writes, shell, git commit/push, and network are **off** until granted in
|
|
34
46
|
config under `permissions:`. `ExecutionPolicy` is the single authority; approvals persist across process
|
|
35
|
-
exit and are surfaced on resume.
|
|
47
|
+
exit and are surfaced on resume. Every file the runtime writes under `~/.ai-runtime/` is created
|
|
48
|
+
owner-only (`0600` files, `0700` directories) on POSIX, so state is not world-readable on a shared host.
|
|
36
49
|
|
|
37
50
|
## Credentials
|
|
38
51
|
|
|
@@ -41,6 +54,12 @@ Secret values live in `.env` (gitignored). Every CLI/telemetry line passes throu
|
|
|
41
54
|
redaction before egress — the terminal and CI logs are treated as egress sinks. Telemetry is metadata
|
|
42
55
|
only and can never store prompts.
|
|
43
56
|
|
|
57
|
+
Optional encryption at rest (`runtime.storage.encrypt`) uses AES-256-GCM with a **scrypt**-derived key
|
|
58
|
+
(the `aienc2` envelope, per-record salt); legacy `aienc1` and plaintext records are read transparently and
|
|
59
|
+
upgrade on rewrite. A decryption failure is reported honestly: an authentication failure means *wrong key
|
|
60
|
+
OR tampering OR corruption*, not a certain wrong key, and it surfaces as an error rather than a silently
|
|
61
|
+
empty store.
|
|
62
|
+
|
|
44
63
|
## Learning can never override a hard gate
|
|
45
64
|
|
|
46
65
|
Learned outcomes and user preferences feed only **soft** scoring. A dedicated test proves that no
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-runtime-engine",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "AI Runtime
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "AI Runtime — a provider-agnostic AI runtime and orchestration platform. Point it at whatever AI providers you have; it routes each task to the best available model. Ships the `ai-runtime` CLI and the `Runtime`/`AI` library API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"author": "pavan",
|
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
"build": "tsc -p tsconfig.build.json",
|
|
60
60
|
"typecheck": "tsc --noEmit",
|
|
61
61
|
"test": "node --import tsx --test --test-timeout=120000 \"tests/**/*.test.ts\"",
|
|
62
|
+
"test:ci": "node scripts/check-test-baseline.mjs",
|
|
63
|
+
"docs:check": "node scripts/check-doc-links.mjs",
|
|
62
64
|
"test:unit": "node --import tsx --test --test-timeout=120000 \"tests/unit/**/*.test.ts\"",
|
|
63
65
|
"test:integration": "node --import tsx --test --test-timeout=120000 \"tests/integration/**/*.test.ts\"",
|
|
64
66
|
"test:contract": "node --import tsx --test --test-timeout=120000 \"tests/contract/**/*.test.ts\"",
|