nexus-ai-pro 1.25.0 → 2.0.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/API_STABILITY.md +44 -4
- package/CHANGELOG.md +120 -1
- package/MIGRATING.md +200 -66
- package/README.md +26 -9
- package/dist/agent/create-agent.d.ts +6 -0
- package/dist/agent/create-agent.js +3 -2
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/loop.js +2 -2
- package/dist/agent/tool.d.ts +14 -1
- package/dist/agent/tool.js +17 -0
- package/dist/batch/manager.d.ts +7 -0
- package/dist/batch/manager.js +13 -2
- package/dist/capabilities/negotiate.js +9 -2
- package/dist/cli/migrate.js +101 -1
- package/dist/cli/root-moves.d.ts +6 -2
- package/dist/cli/root-moves.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/context/window.js +2 -0
- package/dist/core/lifecycle.d.ts +106 -0
- package/dist/core/lifecycle.js +257 -0
- package/dist/core/nexus.d.ts +60 -17
- package/dist/core/nexus.js +268 -272
- package/dist/core/response-format.d.ts +6 -1
- package/dist/core/response-format.js +44 -18
- package/dist/core/secure-stream.js +0 -1
- package/dist/core/usage.d.ts +3 -3
- package/dist/core/usage.js +2 -6
- package/dist/embeddings/auto-providers.d.ts +6 -0
- package/dist/embeddings/auto-providers.js +14 -0
- package/dist/embeddings/engine.d.ts +52 -0
- package/dist/embeddings/engine.js +560 -0
- package/dist/embeddings/manager.d.ts +20 -34
- package/dist/embeddings/manager.js +17 -536
- package/dist/embeddings/register.js +12 -29
- package/dist/graph/checkpoint-migration.d.ts +21 -17
- package/dist/graph/checkpoint-migration.js +8 -4
- package/dist/graph/checkpointer.d.ts +6 -3
- package/dist/graph/checkpointer.js +7 -3
- package/dist/graph/functional.d.ts +6 -0
- package/dist/graph/functional.js +12 -8
- package/dist/graph/graph.d.ts +9 -1
- package/dist/graph/graph.js +69 -39
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +1 -1
- package/dist/images/dimensions.d.ts +5 -0
- package/dist/images/dimensions.js +9 -0
- package/dist/images/index.d.ts +1 -1
- package/dist/images/manager.d.ts +0 -11
- package/dist/images/manager.js +11 -379
- package/dist/images/operation.d.ts +17 -0
- package/dist/images/operation.js +367 -0
- package/dist/index.d.ts +17 -1089
- package/dist/index.js +8 -80
- package/dist/jobs/queue.d.ts +6 -0
- package/dist/jobs/queue.js +2 -1
- package/dist/lifecycle/budget.d.ts +55 -0
- package/dist/lifecycle/budget.js +70 -0
- package/dist/lifecycle/index.d.ts +8 -0
- package/dist/lifecycle/index.js +2 -0
- package/dist/lifecycle/run.d.ts +10 -0
- package/dist/lifecycle/run.js +14 -0
- package/dist/models/registry.d.ts +4 -5
- package/dist/models/registry.js +16 -7
- package/dist/ops/audit-logger.d.ts +2 -0
- package/dist/ops/audit-logger.js +3 -0
- package/dist/ops/family-telemetry.d.ts +32 -21
- package/dist/ops/family-telemetry.js +24 -52
- package/dist/ops/health.d.ts +0 -6
- package/dist/ops/health.js +0 -2
- package/dist/ops/metrics.d.ts +4 -6
- package/dist/ops/metrics.js +9 -3
- package/dist/optimizer/index.js +0 -2
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/pipeline.d.ts +17 -11
- package/dist/pipeline/pipeline.js +15 -7
- package/dist/pipeline/types.d.ts +36 -18
- package/dist/providers/anthropic.d.ts +4 -2
- package/dist/providers/anthropic.js +168 -42
- package/dist/providers/base.d.ts +8 -4
- package/dist/providers/base.js +0 -1
- package/dist/providers/cohere.d.ts +0 -1
- package/dist/providers/cohere.js +11 -25
- package/dist/providers/content.d.ts +29 -0
- package/dist/providers/content.js +79 -0
- package/dist/providers/google.d.ts +2 -0
- package/dist/providers/google.js +61 -18
- package/dist/providers/groq.d.ts +8 -3
- package/dist/providers/groq.js +17 -21
- package/dist/providers/lazy.d.ts +32 -0
- package/dist/providers/lazy.js +154 -0
- package/dist/providers/mistral.d.ts +8 -3
- package/dist/providers/mistral.js +17 -21
- package/dist/providers/ollama.js +0 -2
- package/dist/providers/openai.d.ts +15 -2
- package/dist/providers/openai.js +137 -44
- package/dist/providers/openrouter.d.ts +3 -2
- package/dist/providers/openrouter.js +4 -4
- package/dist/realtime/session.d.ts +5 -0
- package/dist/realtime/session.js +32 -0
- package/dist/realtime/types.d.ts +6 -0
- package/dist/router/auto-router.js +10 -20
- package/dist/router/failover.d.ts +6 -0
- package/dist/router/failover.js +14 -10
- package/dist/security/index.js +0 -5
- package/dist/security/schema-validator.d.ts +6 -230
- package/dist/security/schema-validator.js +142 -56
- package/dist/security/upload-scanner.d.ts +2 -2
- package/dist/security/upload-scanner.js +1 -1
- package/dist/server/tenancy.d.ts +2 -4
- package/dist/server/tenancy.js +1 -30
- package/dist/telephony/manager.d.ts +5 -2
- package/dist/telephony/manager.js +24 -49
- package/dist/testing/provider-conformance.js +4 -4
- package/dist/types/batch.d.ts +7 -8
- package/dist/types/config.d.ts +30 -22
- package/dist/types/embeddings.d.ts +6 -12
- package/dist/types/graph.d.ts +47 -17
- package/dist/types/images.d.ts +6 -14
- package/dist/types/lifecycle.d.ts +163 -0
- package/dist/types/lifecycle.js +1 -0
- package/dist/types/messages.d.ts +41 -2
- package/dist/types/optimizer.d.ts +0 -6
- package/dist/types/providers.d.ts +11 -20
- package/dist/types/providers.js +326 -203
- package/dist/types/response.d.ts +12 -5
- package/dist/types/security.d.ts +0 -12
- package/dist/types/telephony.d.ts +7 -6
- package/dist/types/voice.d.ts +5 -4
- package/dist/utils/deprecation.d.ts +0 -2
- package/dist/utils/deprecation.js +0 -4
- package/dist/utils/periods.d.ts +7 -0
- package/dist/utils/periods.js +30 -0
- package/dist/utils/tokenizer.js +2 -0
- package/dist/voice/manager.js +6 -6
- package/dist-cjs/agent/create-agent.d.ts +6 -0
- package/dist-cjs/agent/create-agent.js +2 -1
- package/dist-cjs/agent/index.d.ts +1 -1
- package/dist-cjs/agent/index.js +4 -1
- package/dist-cjs/agent/loop.js +1 -1
- package/dist-cjs/agent/tool.d.ts +14 -1
- package/dist-cjs/agent/tool.js +20 -0
- package/dist-cjs/batch/manager.d.ts +7 -0
- package/dist-cjs/batch/manager.js +13 -2
- package/dist-cjs/capabilities/negotiate.js +9 -2
- package/dist-cjs/cli/migrate.js +101 -1
- package/dist-cjs/cli/root-moves.d.ts +6 -2
- package/dist-cjs/cli/root-moves.js +1 -1
- package/dist-cjs/context/window.js +2 -0
- package/dist-cjs/core/lifecycle.d.ts +106 -0
- package/dist-cjs/core/lifecycle.js +263 -0
- package/dist-cjs/core/nexus.d.ts +60 -17
- package/dist-cjs/core/nexus.js +312 -283
- package/dist-cjs/core/response-format.d.ts +6 -1
- package/dist-cjs/core/response-format.js +77 -21
- package/dist-cjs/core/secure-stream.js +0 -1
- package/dist-cjs/core/usage.d.ts +3 -3
- package/dist-cjs/core/usage.js +1 -5
- package/dist-cjs/embeddings/auto-providers.d.ts +6 -0
- package/dist-cjs/embeddings/auto-providers.js +17 -0
- package/dist-cjs/embeddings/engine.d.ts +52 -0
- package/dist-cjs/embeddings/engine.js +564 -0
- package/dist-cjs/embeddings/manager.d.ts +20 -34
- package/dist-cjs/embeddings/manager.js +53 -539
- package/dist-cjs/embeddings/register.js +12 -29
- package/dist-cjs/graph/checkpoint-migration.d.ts +21 -17
- package/dist-cjs/graph/checkpoint-migration.js +9 -4
- package/dist-cjs/graph/checkpointer.d.ts +6 -3
- package/dist-cjs/graph/checkpointer.js +7 -3
- package/dist-cjs/graph/functional.d.ts +6 -0
- package/dist-cjs/graph/functional.js +12 -8
- package/dist-cjs/graph/graph.d.ts +9 -1
- package/dist-cjs/graph/graph.js +69 -39
- package/dist-cjs/graph/index.d.ts +2 -2
- package/dist-cjs/graph/index.js +2 -1
- package/dist-cjs/images/dimensions.d.ts +5 -0
- package/dist-cjs/images/dimensions.js +12 -0
- package/dist-cjs/images/index.d.ts +1 -1
- package/dist-cjs/images/manager.d.ts +0 -11
- package/dist-cjs/images/manager.js +44 -379
- package/dist-cjs/images/operation.d.ts +17 -0
- package/dist-cjs/images/operation.js +370 -0
- package/dist-cjs/index.d.ts +17 -1089
- package/dist-cjs/index.js +11 -299
- package/dist-cjs/jobs/queue.d.ts +6 -0
- package/dist-cjs/jobs/queue.js +2 -1
- package/dist-cjs/lifecycle/budget.d.ts +55 -0
- package/dist-cjs/lifecycle/budget.js +75 -0
- package/dist-cjs/lifecycle/index.d.ts +8 -0
- package/dist-cjs/lifecycle/index.js +11 -0
- package/dist-cjs/lifecycle/run.d.ts +10 -0
- package/dist-cjs/lifecycle/run.js +17 -0
- package/dist-cjs/models/registry.d.ts +4 -5
- package/dist-cjs/models/registry.js +16 -7
- package/dist-cjs/ops/audit-logger.d.ts +2 -0
- package/dist-cjs/ops/audit-logger.js +3 -0
- package/dist-cjs/ops/family-telemetry.d.ts +32 -21
- package/dist-cjs/ops/family-telemetry.js +24 -52
- package/dist-cjs/ops/health.d.ts +0 -6
- package/dist-cjs/ops/health.js +0 -2
- package/dist-cjs/ops/metrics.d.ts +4 -6
- package/dist-cjs/ops/metrics.js +9 -3
- package/dist-cjs/optimizer/index.js +0 -2
- package/dist-cjs/pipeline/index.d.ts +1 -1
- package/dist-cjs/pipeline/pipeline.d.ts +17 -11
- package/dist-cjs/pipeline/pipeline.js +15 -7
- package/dist-cjs/pipeline/types.d.ts +36 -18
- package/dist-cjs/providers/anthropic.d.ts +4 -2
- package/dist-cjs/providers/anthropic.js +168 -42
- package/dist-cjs/providers/base.d.ts +8 -4
- package/dist-cjs/providers/base.js +0 -1
- package/dist-cjs/providers/cohere.d.ts +0 -1
- package/dist-cjs/providers/cohere.js +11 -25
- package/dist-cjs/providers/content.d.ts +29 -0
- package/dist-cjs/providers/content.js +88 -0
- package/dist-cjs/providers/google.d.ts +2 -0
- package/dist-cjs/providers/google.js +61 -18
- package/dist-cjs/providers/groq.d.ts +8 -3
- package/dist-cjs/providers/groq.js +17 -21
- package/dist-cjs/providers/lazy.d.ts +32 -0
- package/dist-cjs/providers/lazy.js +192 -0
- package/dist-cjs/providers/mistral.d.ts +8 -3
- package/dist-cjs/providers/mistral.js +17 -21
- package/dist-cjs/providers/ollama.js +0 -2
- package/dist-cjs/providers/openai.d.ts +15 -2
- package/dist-cjs/providers/openai.js +137 -44
- package/dist-cjs/providers/openrouter.d.ts +3 -2
- package/dist-cjs/providers/openrouter.js +4 -4
- package/dist-cjs/realtime/session.d.ts +5 -0
- package/dist-cjs/realtime/session.js +32 -0
- package/dist-cjs/realtime/types.d.ts +6 -0
- package/dist-cjs/router/auto-router.js +9 -19
- package/dist-cjs/router/failover.d.ts +6 -0
- package/dist-cjs/router/failover.js +14 -10
- package/dist-cjs/security/index.js +0 -5
- package/dist-cjs/security/schema-validator.d.ts +6 -230
- package/dist-cjs/security/schema-validator.js +143 -57
- package/dist-cjs/security/upload-scanner.d.ts +2 -2
- package/dist-cjs/security/upload-scanner.js +1 -1
- package/dist-cjs/server/tenancy.d.ts +2 -4
- package/dist-cjs/server/tenancy.js +5 -34
- package/dist-cjs/telephony/manager.d.ts +5 -2
- package/dist-cjs/telephony/manager.js +24 -49
- package/dist-cjs/testing/provider-conformance.js +4 -4
- package/dist-cjs/types/batch.d.ts +7 -8
- package/dist-cjs/types/config.d.ts +30 -22
- package/dist-cjs/types/embeddings.d.ts +6 -12
- package/dist-cjs/types/graph.d.ts +47 -17
- package/dist-cjs/types/images.d.ts +6 -14
- package/dist-cjs/types/lifecycle.d.ts +163 -0
- package/dist-cjs/types/lifecycle.js +2 -0
- package/dist-cjs/types/messages.d.ts +41 -2
- package/dist-cjs/types/optimizer.d.ts +0 -6
- package/dist-cjs/types/providers.d.ts +11 -20
- package/dist-cjs/types/providers.js +326 -203
- package/dist-cjs/types/response.d.ts +12 -5
- package/dist-cjs/types/security.d.ts +0 -12
- package/dist-cjs/types/telephony.d.ts +7 -6
- package/dist-cjs/types/voice.d.ts +5 -4
- package/dist-cjs/utils/deprecation.d.ts +0 -2
- package/dist-cjs/utils/deprecation.js +0 -5
- package/dist-cjs/utils/periods.d.ts +7 -0
- package/dist-cjs/utils/periods.js +35 -0
- package/dist-cjs/utils/tokenizer.js +2 -0
- package/dist-cjs/voice/manager.js +6 -6
- package/llms.txt +61 -0
- package/package.json +43 -13
package/API_STABILITY.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# API Stability Policy
|
|
2
2
|
|
|
3
|
-
This policy describes compatibility guarantees for `nexus-ai-pro`. The
|
|
4
|
-
|
|
3
|
+
This policy describes compatibility guarantees for `nexus-ai-pro`. The 2.x guarantees apply beginning
|
|
4
|
+
with version 2.0.0, as the 1.x guarantees applied from 1.0.0. The sections for the 1.x stages below
|
|
5
|
+
still describe each surface; where they say "the 1.x rules", read the rules of the current major line.
|
|
5
6
|
|
|
6
7
|
## Release stages
|
|
7
8
|
|
|
8
|
-
The package follows semantic versioning. Within
|
|
9
|
-
APIs require
|
|
9
|
+
The package follows semantic versioning. Within a major line, incompatible changes to stable public
|
|
10
|
+
APIs require the next major release. Minor releases may add backward-compatible features, and patch releases
|
|
10
11
|
are intended to remain backward compatible.
|
|
11
12
|
|
|
12
13
|
The following surfaces are public and covered by this policy:
|
|
@@ -40,6 +41,45 @@ Both are covered by this policy:
|
|
|
40
41
|
Deep imports into `dist`, `dist-cjs`, or `src` are not supported. Import only from `nexus-ai-pro` or
|
|
41
42
|
one of its explicit subpaths.
|
|
42
43
|
|
|
44
|
+
## 2.0 stage (2.0.0)
|
|
45
|
+
|
|
46
|
+
2.0 removes what 1.x deprecated and promotes the surfaces that have settled.
|
|
47
|
+
|
|
48
|
+
**Promoted to stable.** These follow the 2.x rules without an experimental label:
|
|
49
|
+
|
|
50
|
+
- graphs, with their advanced APIs: `Send`, `Command`, breakpoints, `updateState()`, `fork()`, node
|
|
51
|
+
caching, and functional workflows (`nexus-ai-pro/graph`, `/graph/functional`, `/graph/visualize`);
|
|
52
|
+
- the store (`nexus-ai-pro/store`, `/store/redis`), agents (`nexus-ai-pro/agent`), and tracing
|
|
53
|
+
(`nexus-ai-pro/tracing`);
|
|
54
|
+
- evaluation (`nexus-ai-pro/evaluate`) and prompts (`nexus-ai-pro/prompts` and `/postgres/prompts`);
|
|
55
|
+
- the agent server (`nexus-ai-pro/server`): its routes, `RunRecord`, `ThreadRecord`, `RunEvent`, and
|
|
56
|
+
recovery.
|
|
57
|
+
|
|
58
|
+
**New in 2.0, and stable from the start:**
|
|
59
|
+
|
|
60
|
+
- the operation lifecycle: the stage order, `LifecycleConfig`, `LifecycleHooks`, the
|
|
61
|
+
`OperationDescriptor`, `OperationOutcome`, and `OperationTicket` shapes, the `BudgetLedger`
|
|
62
|
+
contract, and `ProviderCallContext`. New families and stages may be added in a minor release;
|
|
63
|
+
existing ones keep their names;
|
|
64
|
+
- mixed content: `AssetContent`, `ToolOutput`, and `response.assets`;
|
|
65
|
+
- checkpoint schema version 2. Both checkpointers read version 1 throughout 2.x.
|
|
66
|
+
|
|
67
|
+
**Still experimental in production readiness**, each following the 2.x rules all the same:
|
|
68
|
+
|
|
69
|
+
- images, until recorded live conformance passes on all three backends;
|
|
70
|
+
- the studio package;
|
|
71
|
+
- deployments, tenant limits, and the server's worker queue (1.24);
|
|
72
|
+
- the context hub, insights, and the studio's accounts (1.23);
|
|
73
|
+
- the loaders, the vector stores added in 1.20 and 1.22, the retrievers, and the MCP registry;
|
|
74
|
+
- the SQLite adapters (1.21).
|
|
75
|
+
|
|
76
|
+
**Root import.** The root exports the core client, its config builders, its types, the errors it
|
|
77
|
+
throws, the lifecycle, and `tool()` and `toolOutput()`. Adding anything else to the root waits for a
|
|
78
|
+
major release, and a check in CI fails when the root grows.
|
|
79
|
+
|
|
80
|
+
**Dependencies.** The package has no required dependency. `zod`, `ajv`, `ajv-formats`, and
|
|
81
|
+
`@types/node` are optional peers; making any of them required again would need a major release.
|
|
82
|
+
|
|
43
83
|
## Capability negotiation stage
|
|
44
84
|
|
|
45
85
|
`negotiateCompletionRequest()`, `NexusCapabilityError`, `CapabilityPolicy`, `CapabilityWarning`, and
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,124 @@ Notable changes to this project are recorded here. The format follows [Keep a Ch
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [2.0.0] - 2026-10-02
|
|
8
|
+
|
|
9
|
+
Consolidation. One lifecycle runs every call of every family, the root import holds the core client
|
|
10
|
+
and nothing else, and the package installs with no required dependency. Everything removed here was
|
|
11
|
+
deprecated in 1.x; [MIGRATING.md](./MIGRATING.md) covers each change with before-and-after code, and
|
|
12
|
+
`nexus migrate` rewrites the imports.
|
|
13
|
+
|
|
14
|
+
### Breaking
|
|
15
|
+
|
|
16
|
+
- **The root import keeps only the core**: the client, its config builders, its types, the errors it
|
|
17
|
+
throws, the lifecycle, and the tool helpers. The 498 other names it re-exported are on their
|
|
18
|
+
subpaths; `nexus migrate` moves 1.x imports there. Importing the root costs 323 KB, down from 572 KB.
|
|
19
|
+
- **`zod`, `ajv`, `ajv-formats`, and `@types/node` are optional peer dependencies.** A zod shape is
|
|
20
|
+
checked through its own `safeParse`; a JSON Schema response format loads ajv on its first check, and
|
|
21
|
+
says what to install when it is missing. A production install is 5.3 MB, the package alone, down
|
|
22
|
+
from 12.3 MB.
|
|
23
|
+
- **A response's `estimatedCost` string is removed**, for the numeric `cost`. A plan's
|
|
24
|
+
`estimatedCost` object stays.
|
|
25
|
+
- **Modalities say which way they flow.** `ModelCapabilities.inputModalities` and `outputModalities`
|
|
26
|
+
are required on every entry, bundled or registered; `modalities`, the `Modality` type, and the
|
|
27
|
+
`modalities` routing requirement are removed.
|
|
28
|
+
- **Checkpoint schema version 2.** A checkpoint has its `version`, an `id`, its `tasks` always, and its
|
|
29
|
+
questions only in `interrupts`; `interrupt` is gone. Both checkpointers read version 1 for the whole
|
|
30
|
+
2.x line, so threads 1.x left waiting resume. A checkpointer's `get()` and `history()` return a
|
|
31
|
+
`StoredGraphCheckpoint` of either version.
|
|
32
|
+
- **Options that were never read are removed**: `GoogleProviderConfig.projectId`,
|
|
33
|
+
`OllamaProviderConfig.timeout`, `MetricsConfig.prometheus`, `DensificationConfig.preserveMarkdown`,
|
|
34
|
+
`HealthConfig.latencyHalfLife`, `InjectionDetectionConfig.sensitivity`, and
|
|
35
|
+
`ToolPolicyConfig.requiresApproval`.
|
|
36
|
+
- **`ImageManagerConfig` is removed**, for `ImageConfig`.
|
|
37
|
+
- **`PipelineStepName` is a closed list.** A custom step is recorded as `customStep`, with its own name
|
|
38
|
+
in `PipelineTraceStep.custom`. The `auditLog` step is replaced by the lifecycle's `audit`.
|
|
39
|
+
- **`ai.stream()` opens on its first read**, so authorization, rate-limit, guardrail, and budget errors
|
|
40
|
+
come out of the loop rather than from the call.
|
|
41
|
+
- **What the lifecycle records changed**: metrics carry `family` and `operation` for every family, the
|
|
42
|
+
image family is labelled `image`, audit events carry `family` and `operation` and add an `error`
|
|
43
|
+
event, and `response.meta.requestId` is the operation's id.
|
|
44
|
+
- **The model registry is current as of 2026-10-02.** Models their providers shut down are removed:
|
|
45
|
+
Claude 3.x and 4.0 to 4.1, `gpt-4.5-preview`, `o1-mini`, `gpt-5-codex`, Gemini 1.5 and 2.0 and the
|
|
46
|
+
shut-down 3.x previews, Groq Compound, Llama 4 Scout, and Qwen3 32B, Mistral's 2024 models, Devstral,
|
|
47
|
+
and Magistral, and DeepSeek's `deepseek-chat`, `deepseek-reasoner`, V3, and R1. Four names no
|
|
48
|
+
provider served are gone too: `claude-sonnet-5-0`, `claude-haiku-5-0`, `claude-fable-5-0`, and
|
|
49
|
+
`gemini-3.5-pro`. Cohere's `command-r` and `command-r-plus` are filed under their dated names, and
|
|
50
|
+
`mistral-medium-3-5` under `mistral-medium-2604`. Every intent alias points at a current model.
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- **One lifecycle for every operation.** Completions, streams, embeddings, voice, telephony, images,
|
|
55
|
+
realtime sessions, graphs, agents, queued jobs, and provider batches pass through the same stages:
|
|
56
|
+
validate, authorize, input policy, resolve assets, route, reserve budget, execute, output policy,
|
|
57
|
+
persist, reconcile cost, and audit. `lifecycle` on the client configures what they share: an
|
|
58
|
+
`authorize` callback that can refuse any call, a `budget` every family draws on, and `hooks` that see
|
|
59
|
+
each call start and finish, cache hits included. `ai.lifecycle` makes graphs, agents, workflows,
|
|
60
|
+
realtime sessions, job queues, and batches operations of the client too.
|
|
61
|
+
- **A shared spend budget**: `budgetLedger()` on the new `nexus-ai-pro/lifecycle` holds each call's
|
|
62
|
+
estimate before it runs and charges what it cost after, per tenant and per period, so concurrent calls
|
|
63
|
+
cannot overshoot together. It keeps totals in memory or in any tenant usage store, Redis included.
|
|
64
|
+
- **`ProviderCallContext`**, handed to every provider call of every family: the request id, the abort
|
|
65
|
+
signal, the deadline, trace headers, and the idempotency key. The OpenAI and Anthropic adapters send
|
|
66
|
+
the key and the headers on. Requests take `requestId`, `tenantId`, and `idempotencyKey`.
|
|
67
|
+
- **Mixed text-and-asset content.** `toolOutput()` lets a tool return text, images, and asset
|
|
68
|
+
references, sent as the tool message itself instead of base64 JSON. An `asset` content part names an
|
|
69
|
+
asset by reference, an image part can carry an asset, and a model that produces images returns them
|
|
70
|
+
on `response.assets`.
|
|
71
|
+
- **Typed pipelines**: `PipelineContext` and the runner are generic over the request and response, with
|
|
72
|
+
`PipelineShapes` for another family's types.
|
|
73
|
+
- **New models**: OpenAI GPT-6 Astra, GPT-6.1 Sol, GPT-6 Sol, GPT-6 Luna, GPT-5 Pro, o3-pro, and
|
|
74
|
+
GPT-5.3 Codex; Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Fable 5, Opus 5, Sonnet 5, and Sonnet 4.5;
|
|
75
|
+
Gemini 3.8, 3.7, and 3.6 Flash, 3.5 Flash-Lite, 3.1 Flash-Lite, 3 Pro Image, and 3.1 Flash Image;
|
|
76
|
+
Groq's Qwen3.8 27B and MiniMax M2.7; Mistral Medium 3.5 and Ministral 3 14B, 8B, and 3B; DeepSeek
|
|
77
|
+
Flash and V4 Pro; and Cohere Command A Plus, North Mini Code, North Small Translate, and three Tiny
|
|
78
|
+
Aya models.
|
|
79
|
+
- `ModelCapabilities.sampling`, false for a model that accepts only its default temperature and top-p.
|
|
80
|
+
Negotiation drops a non-default value for it.
|
|
81
|
+
- `nexus migrate` lists each model name the 2.0 registry dropped, with what to use instead.
|
|
82
|
+
- Anthropic responses report thinking tokens in `usage.reasoningTokens`.
|
|
83
|
+
- **`llms.txt` and `llms-full.txt`** for AI assistants and coding agents: an index of every guide with
|
|
84
|
+
the facts an assistant needs to recommend the package correctly, and the guides in one file.
|
|
85
|
+
`llms.txt` ships in the package. Both are generated from the README and the guides, and CI fails
|
|
86
|
+
when they fall behind.
|
|
87
|
+
- `toCheckpoint()` and `CheckpointDraft` for building a version 2 checkpoint by hand.
|
|
88
|
+
- A `cache_hits` metric, and `routingDecision.provider` and `.model` on a response.
|
|
89
|
+
|
|
90
|
+
### Changed
|
|
91
|
+
|
|
92
|
+
- Provider adapters, and the agent, verification, evaluation, workflow, semantic-cache, image, and
|
|
93
|
+
embedding engines, load on first use, so importing the client never loads them.
|
|
94
|
+
- A context-window summary is an operation of its own, authorized, budgeted, and audited.
|
|
95
|
+
- `getCall()`, `listPhoneNumbers()`, and `updatePhoneNumber()` run through the lifecycle, so they are
|
|
96
|
+
rate-limited and audited like `createCall()`.
|
|
97
|
+
- `nexus migrate` lists the options and model entries 2.0 removed, and keeps a single moved name on
|
|
98
|
+
one line.
|
|
99
|
+
- **Prices and limits follow the providers.** GPT-5.6, GPT-5.2 Pro, Mistral Large 3, and Mistral
|
|
100
|
+
Small 4 cost less. Gemini 3.5 Flash costs $1.50 and $9 per million tokens, not $0.10 and $0.40.
|
|
101
|
+
Claude Opus 4.5 has a 200K context and 64K output, not 1M and 128K, and Codestral a 128K context.
|
|
102
|
+
Models with an announced shutdown are `deprecated`, with the date and the replacement in their
|
|
103
|
+
notes, and an alias that resolves to one is deprecated too.
|
|
104
|
+
- `toolChoice: false` now means a call cannot be forced: negotiation drops `required` or a named tool
|
|
105
|
+
and lets `auto` and `none` through.
|
|
106
|
+
|
|
107
|
+
### Fixed
|
|
108
|
+
|
|
109
|
+
- **Claude 4.6 onward get adaptive thinking.** The Anthropic adapter sent every model a thinking
|
|
110
|
+
budget, which Claude rejects after 4.6, so a request with `reasoning` failed on current models. It
|
|
111
|
+
now sends adaptive thinking and `output_config.effort` from 4.6 on, and turns thinking off the way
|
|
112
|
+
each model allows. It drops sampling values that Claude 4.7 and later reject, and leaves room for
|
|
113
|
+
thinking when no output limit is set.
|
|
114
|
+
- **Tool calls reach providers whole.** The OpenAI chat and Responses, Anthropic, and Google adapters
|
|
115
|
+
dropped a conversation's tool calls and the ids that link results to them, so a real tool loop could
|
|
116
|
+
fail on its second turn. Each now sends both the way its API expects, images in results included.
|
|
117
|
+
- **Responses are priced on the model they were routed to.** A provider that echoed a dated snapshot
|
|
118
|
+
name priced the call at nothing; Groq, Mistral, and Cohere models filed under a prefix did too.
|
|
119
|
+
- `resolveModel('google/gemini-2.5-flash')` found no capabilities for a provider-prefixed name. It now
|
|
120
|
+
finds the entry filed without the prefix, when that entry belongs to the same provider.
|
|
121
|
+
- Streams honour the circuit breaker, the cost budget, audit, and metrics, as completions always did.
|
|
122
|
+
- A cache hit is audited and counted.
|
|
123
|
+
- The upload scanner's types no longer need Node's: `content` takes text or any `Uint8Array`.
|
|
124
|
+
|
|
7
125
|
## [1.25.0] - 2026-10-01
|
|
8
126
|
|
|
9
127
|
The bridge to 2.0. Everything 2.0 removes is deprecated now, every capability has a subpath of its
|
|
@@ -1255,7 +1373,8 @@ shared policy vocabulary is in place for a future release that revisits this.
|
|
|
1255
1373
|
- URL fetching rejects unsafe private-network targets and limits response reads.
|
|
1256
1374
|
- CLI and audit findings no longer disclose detected secret values.
|
|
1257
1375
|
|
|
1258
|
-
[Unreleased]: https://github.com/mkhitar-abrahamyan/nexus-ai/compare/
|
|
1376
|
+
[Unreleased]: https://github.com/mkhitar-abrahamyan/nexus-ai/compare/v2.0.0...HEAD
|
|
1377
|
+
[2.0.0]: https://github.com/mkhitar-abrahamyan/nexus-ai/compare/v1.25.0...v2.0.0
|
|
1259
1378
|
[1.25.0]: https://github.com/mkhitar-abrahamyan/nexus-ai/compare/v1.24.0...v1.25.0
|
|
1260
1379
|
[1.24.0]: https://github.com/mkhitar-abrahamyan/nexus-ai/compare/v1.23.0...v1.24.0
|
|
1261
1380
|
[1.23.0]: https://github.com/mkhitar-abrahamyan/nexus-ai/compare/v1.22.0...v1.23.0
|
package/MIGRATING.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Migrating to 2.0
|
|
2
2
|
|
|
3
|
-
2.0.0 removes what the 1.x line deprecated
|
|
4
|
-
|
|
3
|
+
2.0.0 removes what the 1.x line deprecated, and runs every call of every family through one
|
|
4
|
+
lifecycle. Most applications change only their imports, and a codemod does that.
|
|
5
5
|
|
|
6
6
|
Start with the codemod. It rewrites what it can safely, and lists the rest:
|
|
7
7
|
|
|
@@ -11,32 +11,38 @@ npx nexus migrate src --write # rewrites the files
|
|
|
11
11
|
npx nexus migrate src --check # exits 1 while anything is left, for CI
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Run it while you are still on 1.25, where every name it moves already works on its subpath. Then
|
|
15
|
+
upgrade, and work through the table.
|
|
16
16
|
|
|
17
17
|
| Change | The codemod | By hand |
|
|
18
18
|
| --- | --- | --- |
|
|
19
19
|
| [The root import keeps only the core](#the-root-import-keeps-only-the-core) | Rewrites the imports | Namespace and dynamic imports of the root |
|
|
20
|
+
| [Validators and Node types are optional](#validators-and-node-types-are-optional) | — | Install what you use |
|
|
20
21
|
| [`estimatedCost` is removed](#a-responses-estimatedcost-is-removed) | Lists each read | Read `cost.amount` |
|
|
22
|
+
| [Modalities say which way they flow](#modalities-say-which-way-they-flow) | Lists entries that name `vision` or `pdf` | Write the two fields |
|
|
23
|
+
| [Checkpoints are version 2](#checkpoints-are-version-2) | — | Read `interrupts`; build checkpoints with `toCheckpoint()` |
|
|
24
|
+
| [Options that were never read are removed](#options-that-were-never-read-are-removed) | Lists each one | Delete them |
|
|
21
25
|
| [`ImageManagerConfig` is removed](#imagemanagerconfig-is-removed) | Renames it | — |
|
|
22
|
-
| [
|
|
23
|
-
| [
|
|
24
|
-
| [
|
|
25
|
-
| [
|
|
26
|
-
| [
|
|
26
|
+
| [Pipeline step names are a closed list](#pipeline-step-names-are-a-closed-list) | — | Read a custom step's name from `custom` |
|
|
27
|
+
| [Streams open on their first read](#streams-open-on-their-first-read) | — | Catch errors around the loop |
|
|
28
|
+
| [Every call runs through the lifecycle](#every-call-runs-through-the-lifecycle) | — | Check dashboards, audit sinks, and rate limits |
|
|
29
|
+
| [Responses are priced on the routed model](#responses-are-priced-on-the-routed-model) | — | Expect costs that were 0 to be priced |
|
|
30
|
+
| [The model registry is current](#the-model-registry-is-current) | Lists each dropped model name, with its replacement | Choose the replacement; check what your aliases resolve to |
|
|
31
|
+
| [Claude 4.6 onward think adaptively](#claude-46-onward-think-adaptively) | — | Nothing |
|
|
32
|
+
| [Tool calls reach providers whole](#tool-calls-reach-providers-whole) | — | Nothing |
|
|
27
33
|
|
|
28
34
|
## The root import keeps only the core
|
|
29
35
|
|
|
30
|
-
In 2.0, `nexus-ai-pro` exports the core client and nothing else
|
|
36
|
+
In 2.0, `nexus-ai-pro` exports the core client and nothing else:
|
|
31
37
|
|
|
32
38
|
- `NexusAI`, `createNexus`, and the config builders;
|
|
33
|
-
- `tool()`, the streaming helpers, and the usage and pricing helpers
|
|
39
|
+
- `tool()`, `toolOutput()`, the streaming helpers, and the usage and pricing helpers;
|
|
40
|
+
- the lifecycle: `OperationLifecycle`, its errors, and its types;
|
|
34
41
|
- the types of the client's configuration, requests, and responses;
|
|
35
42
|
- the errors the client throws: `NexusProviderError`, `NexusSecurityError`, `NexusRateLimitError`,
|
|
36
43
|
`NexusCapabilityError`, `TokenBudgetError`, `CostBudgetError`, and `ResponseFormatError`.
|
|
37
44
|
|
|
38
|
-
Every other export is on its own subpath
|
|
39
|
-
editor strikes it through with the subpath to use.
|
|
45
|
+
Every other export is on its own subpath.
|
|
40
46
|
|
|
41
47
|
```ts
|
|
42
48
|
// Before
|
|
@@ -60,15 +66,31 @@ import type { AgentLoopModelClient as AgentModelClient } from 'nexus-ai-pro/agen
|
|
|
60
66
|
```
|
|
61
67
|
|
|
62
68
|
It cannot split a namespace import (`import * as nexus from 'nexus-ai-pro'`) or a dynamic `import()`,
|
|
63
|
-
so it lists them. Import each name you use from its subpath instead. Every subpath and what it costs
|
|
64
|
-
|
|
69
|
+
so it lists them. Import each name you use from its subpath instead. Every subpath, and what it costs,
|
|
70
|
+
is in the [packaging guide](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/packaging.md).
|
|
65
71
|
|
|
66
|
-
The
|
|
67
|
-
|
|
72
|
+
The root import now costs about 323 KB, down from 572 KB.
|
|
73
|
+
|
|
74
|
+
## Validators and Node types are optional
|
|
75
|
+
|
|
76
|
+
`zod`, `ajv`, `ajv-formats`, and `@types/node` are optional peer dependencies. A production install
|
|
77
|
+
is the package alone, about 5.3 MB instead of 12.3 MB.
|
|
78
|
+
|
|
79
|
+
| You | Install |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| Compile TypeScript for Node | `npm install --save-dev @types/node` |
|
|
82
|
+
| Write schemas with zod | Nothing more: the package uses the zod your schema came from |
|
|
83
|
+
| Check output against a JSON Schema object | `npm install ajv ajv-formats` |
|
|
84
|
+
|
|
85
|
+
A JSON Schema response format without ajv fails with a `ResponseFormatError` that says what to
|
|
86
|
+
install. A zod shape is checked through each field's own `safeParse`.
|
|
87
|
+
|
|
88
|
+
The request check in the guardrails, `SchemaValidator`, no longer uses zod. It reports the same
|
|
89
|
+
fields by the same paths; the wording of its findings changed.
|
|
68
90
|
|
|
69
91
|
## A response's `estimatedCost` is removed
|
|
70
92
|
|
|
71
|
-
The formatted string on a response's metadata
|
|
93
|
+
The formatted string on a response's metadata is gone. Read the numeric cost, and format it yourself:
|
|
72
94
|
|
|
73
95
|
```ts
|
|
74
96
|
// Before
|
|
@@ -79,15 +101,61 @@ const cost = response.meta.cost;
|
|
|
79
101
|
if (cost) console.log(new Intl.NumberFormat('en-US', { style: 'currency', currency: cost.currency }).format(cost.amount));
|
|
80
102
|
```
|
|
81
103
|
|
|
82
|
-
A plan's `estimatedCost`, from `ai.plan()`, is an object and stays.
|
|
104
|
+
A plan's `estimatedCost`, from `ai.plan()`, is an object and stays. A custom provider that set the
|
|
105
|
+
string should drop it; `buildMeta()` fills `usage` and `cost`.
|
|
83
106
|
|
|
84
|
-
##
|
|
107
|
+
## Modalities say which way they flow
|
|
85
108
|
|
|
86
|
-
|
|
109
|
+
A model's `modalities` list mixed inputs and outputs: `vision` meant an image in, and `image` meant an
|
|
110
|
+
image out. 2.0 removes it, and the `Modality` type with it. Every entry declares `inputModalities` and
|
|
111
|
+
`outputModalities`, and both are required.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
// Before
|
|
115
|
+
models: { registry: { 'my-model': { modalities: ['text', 'vision'], /* … */ } } }
|
|
116
|
+
|
|
117
|
+
// After
|
|
118
|
+
models: { registry: { 'my-model': { inputModalities: ['text', 'image'], outputModalities: ['text'], /* … */ } } }
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
| 1.x value | 2.0 |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `text` | `text` in both lists |
|
|
124
|
+
| `vision` | `image` in `inputModalities` |
|
|
125
|
+
| `image` | `image` in `outputModalities` |
|
|
126
|
+
| `audio`, `video`, `pdf` | the same name in `inputModalities` |
|
|
127
|
+
|
|
128
|
+
In routing requirements, replace `modalities` with `inputModalities` or `outputModalities`.
|
|
129
|
+
`modalitiesOf()` still reads both lists, and now requires both.
|
|
130
|
+
|
|
131
|
+
## Checkpoints are version 2
|
|
132
|
+
|
|
133
|
+
A checkpoint 2.x writes has a `version` of 2, an `id`, its `tasks` always spelled out, and every
|
|
134
|
+
pending question in `interrupts`. The single `interrupt` field is gone.
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// Before
|
|
138
|
+
const question = checkpoint.interrupt;
|
|
139
|
+
|
|
140
|
+
// After
|
|
141
|
+
const [question] = checkpoint.interrupts;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Threads stored by 1.x keep working. Both bundled checkpointers read version 1 for the whole 2.x line,
|
|
145
|
+
so a thread left waiting resumes after the upgrade.
|
|
146
|
+
|
|
147
|
+
| You | What to do |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| Read checkpoints through a graph | Nothing: `state()` and `history()` return version 2 |
|
|
150
|
+
| Wrote your own `GraphCheckpointer` | Its `get()` and `history()` may return either version, typed `StoredGraphCheckpoint`; the graph reads both |
|
|
151
|
+
| Read a store directly | Pass what you read to `migrateCheckpoint()` |
|
|
152
|
+
| Build a checkpoint by hand | Use `toCheckpoint()`, which fills in the version, id, tasks, and questions |
|
|
153
|
+
| Named `GraphCheckpointV2` | It still compiles; it is now another name for `GraphCheckpoint` |
|
|
87
154
|
|
|
88
155
|
## Options that were never read are removed
|
|
89
156
|
|
|
90
|
-
These were accepted and ignored
|
|
157
|
+
These were accepted and ignored, and warned once per process since they were deprecated. The codemod
|
|
158
|
+
lists each one it finds.
|
|
91
159
|
|
|
92
160
|
| Option | Deprecated in |
|
|
93
161
|
| --- | --- |
|
|
@@ -99,71 +167,137 @@ These were accepted and ignored. Each one already warns once per process when it
|
|
|
99
167
|
| `InjectionDetectionConfig.sensitivity` | 1.19.0 |
|
|
100
168
|
| `ToolPolicyConfig.requiresApproval` | 1.19.0 |
|
|
101
169
|
|
|
102
|
-
Delete them. Nothing changes, because nothing read them.
|
|
170
|
+
Delete them. Nothing changes, because nothing read them. Approval before a tool runs is
|
|
171
|
+
`interruptOn` on `createAgent()`.
|
|
103
172
|
|
|
104
|
-
##
|
|
173
|
+
## `ImageManagerConfig` is removed
|
|
105
174
|
|
|
106
|
-
|
|
107
|
-
|
|
175
|
+
It was another name for `ImageConfig`. The codemod renames the import and keeps your local name.
|
|
176
|
+
|
|
177
|
+
## Pipeline step names are a closed list
|
|
178
|
+
|
|
179
|
+
`PipelineStepName` lists the built-in stages only, so a `switch` over it can be exhaustive. A step you
|
|
180
|
+
add with `use()` is recorded as `customStep`, with its own name in `custom`.
|
|
108
181
|
|
|
109
182
|
```ts
|
|
110
|
-
//
|
|
111
|
-
|
|
183
|
+
// Before
|
|
184
|
+
const mine = response.meta.pipeline?.steps.find((step) => step.name === 'enrich');
|
|
112
185
|
|
|
113
|
-
// After
|
|
114
|
-
|
|
115
|
-
registry: {
|
|
116
|
-
'my-model': { modalities: ['text', 'vision'], inputModalities: ['text', 'image'], outputModalities: ['text'], /* … */ },
|
|
117
|
-
},
|
|
118
|
-
}
|
|
186
|
+
// After
|
|
187
|
+
const mine = response.meta.pipeline?.steps.find((step) => step.custom === 'enrich');
|
|
119
188
|
```
|
|
120
189
|
|
|
121
|
-
|
|
122
|
-
`
|
|
190
|
+
The trace's `auditLog` step is gone: auditing is the lifecycle's `audit` stage. `authorize` and
|
|
191
|
+
`audit` appear when a lifecycle has work to do, and `reconcileCost` appears on every response.
|
|
192
|
+
Metrics for a custom step keep its own name as their `step` label.
|
|
123
193
|
|
|
124
|
-
|
|
194
|
+
`PipelineContext`, `PipelineMiddleware`, `PipelineStep`, `PipelineHooksConfig`, `PipelineConfig`, and
|
|
195
|
+
`PipelineRunner` are generic over the request and the response. Both default to a completion's, so
|
|
196
|
+
existing code compiles unchanged.
|
|
125
197
|
|
|
126
|
-
|
|
127
|
-
in `interrupts`. Both checkpointers keep reading 1.x checkpoints throughout 2.x, so stored threads
|
|
128
|
-
resume.
|
|
198
|
+
## Streams open on their first read
|
|
129
199
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const question = checkpoint.interrupt;
|
|
200
|
+
`ai.stream()` returns at once. Authorization, the rate limit, guardrails, routing, and the budget run
|
|
201
|
+
when the stream is first read, so their errors come out of the loop:
|
|
133
202
|
|
|
134
|
-
|
|
135
|
-
|
|
203
|
+
```ts
|
|
204
|
+
// Before: a blocked request threw here
|
|
205
|
+
const stream = ai.stream(request);
|
|
206
|
+
|
|
207
|
+
// After: it throws from the loop
|
|
208
|
+
try {
|
|
209
|
+
for await (const chunk of ai.stream(request)) render(chunk);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
// NexusSecurityError, NexusRateLimitError, OperationDeniedError, BudgetExceededError, …
|
|
212
|
+
}
|
|
136
213
|
```
|
|
137
214
|
|
|
138
|
-
|
|
139
|
-
`
|
|
215
|
+
Streams now get what completions always had. They are audited and counted, the cost budget and the
|
|
216
|
+
circuit breaker apply, and the `done` chunk carries the request id and a cost priced on the routed
|
|
217
|
+
model.
|
|
140
218
|
|
|
141
|
-
##
|
|
219
|
+
## Every call runs through the lifecycle
|
|
142
220
|
|
|
143
|
-
|
|
144
|
-
|
|
221
|
+
Completions, streams, embeddings, voice, telephony, images, realtime sessions, graphs, agents, jobs,
|
|
222
|
+
and batches share one [lifecycle](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/lifecycle.md).
|
|
223
|
+
Nothing has to change in your code, but what the lifecycle records looks different:
|
|
145
224
|
|
|
146
|
-
|
|
225
|
+
| What | 1.x | 2.0 |
|
|
226
|
+
| --- | --- | --- |
|
|
227
|
+
| Metric labels | `model`, or `provider` and `model`, per family | `family`, `operation`, `provider`, and `model` for every family |
|
|
228
|
+
| The image family's label | `family=images` | `family=image` |
|
|
229
|
+
| Audit event family | in `metadata.family` | `family` and `operation` on the event |
|
|
230
|
+
| A call that fails after it starts | No event after `request` | An `error` event |
|
|
231
|
+
| A blocked request | `blocked`, with `metadata.findings` | `blocked`, with `metadata.error` and `metadata.findings` |
|
|
232
|
+
| `response.meta.requestId` | An id the adapter made up | The operation's id, the same on its audit events |
|
|
233
|
+
| A cache hit | Not audited or counted | Audited, counted, and seen by `onFinish` |
|
|
234
|
+
| A context-window summary | An unrecorded model call | Its own `summarize` operation |
|
|
235
|
+
| `getCall()`, `listPhoneNumbers()`, `updatePhoneNumber()` | Called directly | Rate-limited and audited like `createCall()` |
|
|
147
236
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
237
|
+
So check three things:
|
|
238
|
+
|
|
239
|
+
- dashboards and alerts that match an exact label set;
|
|
240
|
+
- audit sinks that read `metadata.family`, or that expect no event after a failed `request`;
|
|
241
|
+
- rate limits, which now also count streams and the telephony reads above.
|
|
242
|
+
|
|
243
|
+
To use the lifecycle, set `lifecycle` on the client: an `authorize` callback, a shared `budget`, and
|
|
244
|
+
`hooks`. Pass `ai.lifecycle` to graphs, agents, workflows, realtime sessions, queues, and batches to
|
|
245
|
+
make their runs operations of the client too.
|
|
246
|
+
|
|
247
|
+
## Responses are priced on the routed model
|
|
248
|
+
|
|
249
|
+
The client now prices each response on the model the request was routed to, as the registry names
|
|
250
|
+
it. Providers often answer with a dated snapshot name the registry does not file. In 1.x, pricing on
|
|
251
|
+
that echo cost the call nothing, so OpenAI responses could show a cost of 0, and so could Groq, Mistral,
|
|
252
|
+
DeepSeek, and Cohere models filed under a prefix. Expect those costs to be priced in 2.0, and budgets
|
|
253
|
+
to count them. A charge the provider reports, with `basis: 'reported'`, is kept as it is.
|
|
254
|
+
|
|
255
|
+
## The model registry is current
|
|
256
|
+
|
|
257
|
+
The bundled registry was checked against each provider's documentation on 2026-10-02.
|
|
258
|
+
|
|
259
|
+
- **Shut-down models are gone.** So are four names 1.x invented that no provider served:
|
|
260
|
+
`claude-sonnet-5-0`, `claude-haiku-5-0`, `claude-fable-5-0`, and `gemini-3.5-pro`. The codemod lists
|
|
261
|
+
each one it finds, with what to use instead.
|
|
262
|
+
- **Models with an announced shutdown stay,** marked `deprecated`. Their notes give the date and the
|
|
263
|
+
replacement, and an alias that resolves to one is deprecated too.
|
|
264
|
+
- **Intent aliases point at current models.** For example, `anthropic/best` is `claude-fable-5-1`,
|
|
265
|
+
`openai/fast` is `gpt-6-luna`, and `deepseek/best` is `deepseek/deepseek-v4-pro`. Pin the resolved
|
|
266
|
+
model when a run must be reproducible.
|
|
267
|
+
- **Prices moved both ways.** GPT-5.6 and Mistral Large 3 cost less. Gemini 3.5 Flash costs more than
|
|
268
|
+
1.x said, and the Gemini 3.6 to 3.8 Flash prices double on 2027-01-01.
|
|
269
|
+
|
|
270
|
+
`describeModel()` shows what a name resolves to and when its entry was verified.
|
|
271
|
+
|
|
272
|
+
## Claude 4.6 onward think adaptively
|
|
273
|
+
|
|
274
|
+
From the 4.6 generation on, Claude takes adaptive thinking and an effort level, not a thinking budget.
|
|
275
|
+
After 4.6 a budget is rejected, so 1.x requests with `reasoning` failed on those models. 2.0 sends what
|
|
276
|
+
each model accepts, and the [core guide](docs/core.md#reasoning) has the details. Nothing changes in
|
|
277
|
+
your code. From 4.7 on, Claude also rejects a non-default `temperature` or `topP`, so the client
|
|
278
|
+
drops one and records a capability warning.
|
|
279
|
+
|
|
280
|
+
## Tool calls reach providers whole
|
|
281
|
+
|
|
282
|
+
In 1.x the OpenAI, Anthropic, and Google adapters dropped a conversation's tool calls and the ids that
|
|
283
|
+
link results to them. A real tool loop could fail on its second turn. 2.0 sends both the way each API
|
|
284
|
+
expects. Nothing changes in your code.
|
|
285
|
+
|
|
286
|
+
Two things are new beside it. A tool can return `toolOutput()`, whose text, images, and asset
|
|
287
|
+
references go back as the tool message itself. And a model that produces images returns them on
|
|
288
|
+
`response.assets`.
|
|
152
289
|
|
|
153
|
-
|
|
290
|
+
## For provider authors
|
|
154
291
|
|
|
155
|
-
|
|
292
|
+
The provider contracts only grew:
|
|
156
293
|
|
|
157
|
-
|
|
294
|
+
- `BaseProvider.complete()` and `stream()` take a second, optional `ProviderCallContext`;
|
|
295
|
+
- voice and telephony provider methods take it too;
|
|
296
|
+
- `ImageProviderCallContext`, `EmbeddingProviderCallContext`, and `BatchProviderCallContext` extend it;
|
|
297
|
+
- `FamilyTelemetry.run()` hands its function the context, and takes an optional settle function.
|
|
158
298
|
|
|
159
|
-
|
|
160
|
-
and agents share authorization, budgets, hooks, audit, metrics, and tracing. Custom providers receive
|
|
161
|
-
a `ProviderCallContext` with the abort signal, deadline, request id, trace context, and idempotency key.
|
|
162
|
-
- **Typed pipeline contexts.** `PipelineContext` becomes generic over its request and response, and
|
|
163
|
-
`PipelineStepName` lists only the built-in steps.
|
|
164
|
-
- **Mixed outputs.** A tool result can carry asset references instead of base64 JSON.
|
|
299
|
+
A provider written for 1.x compiles unchanged.
|
|
165
300
|
|
|
166
301
|
## Runtime
|
|
167
302
|
|
|
168
|
-
2.0 runs on Node 22 and newer.
|
|
169
|
-
Node 24.
|
|
303
|
+
2.0 runs on Node 22 and newer.
|
package/README.md
CHANGED
|
@@ -5,14 +5,16 @@ workflows that run branches in parallel and survive a restart, retrieval over an
|
|
|
5
5
|
durable background operations, guardrails, cost control, images, voice, and evals — with a studio a
|
|
6
6
|
team can share.
|
|
7
7
|
|
|
8
|
-
Import
|
|
9
|
-
CI enforces
|
|
10
|
-
|
|
8
|
+
Import only what you use. The root import is the client and nothing else, and every other capability
|
|
9
|
+
has its own entry point with a size budget CI enforces; [the packaging guide](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/packaging.md)
|
|
10
|
+
publishes what each one costs. The package has no required dependencies: a graph-only application
|
|
11
|
+
loads 51 KB, and installs nothing but this package.
|
|
11
12
|
|
|
12
13
|
- NPM: https://www.npmjs.com/package/nexus-ai-pro
|
|
13
14
|
- GitHub: https://github.com/mkhitar-abrahamyan/nexus-ai
|
|
14
15
|
- Contributing, testing, and release procedure: [CONTRIBUTING.md](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/CONTRIBUTING.md)
|
|
15
16
|
- Delivered work and what is planned next: [ROADMAP.md](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/ROADMAP.md)
|
|
17
|
+
- For AI assistants: [llms.txt](https://raw.githubusercontent.com/mkhitar-abrahamyan/nexus-ai/main/llms.txt) indexes every guide, and [llms-full.txt](https://raw.githubusercontent.com/mkhitar-abrahamyan/nexus-ai/main/llms-full.txt) holds them all in one file
|
|
16
18
|
|
|
17
19
|
## Install
|
|
18
20
|
|
|
@@ -32,6 +34,14 @@ Install only the provider SDKs your app uses. The OpenAI SDK also powers OpenAI-
|
|
|
32
34
|
npm install openai @anthropic-ai/sdk ollama
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
Everything else is optional too. Add what your code needs:
|
|
38
|
+
|
|
39
|
+
| Package | When |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `@types/node` | A TypeScript project on Node. The client, graphs, and the lifecycle compile without it. |
|
|
42
|
+
| `zod` | You write schemas with zod. The package uses the zod your schema came from. |
|
|
43
|
+
| `ajv`, `ajv-formats` | A response format checks output against a JSON Schema object. |
|
|
44
|
+
|
|
35
45
|
The Google Gemini provider uses Node.js `fetch`, so it does not need an extra SDK.
|
|
36
46
|
Realtime transports use injected or platform WebRTC, WebSocket, and `fetch` interfaces and do not
|
|
37
47
|
require the OpenAI SDK.
|
|
@@ -105,6 +115,9 @@ You can still pass a plain `NexusAIConfig` to `new NexusAI(...)` when you want f
|
|
|
105
115
|
- reach the providers' half-price asynchronous batch tier behind one operation handle
|
|
106
116
|
- persist generated media to disk or S3 with tenant isolation, retention, and checksums
|
|
107
117
|
- build persistent realtime voice agents with interruption, live tools, and normalized conversation state
|
|
118
|
+
- authorize, budget, audit, and observe every call of every family in one place, with hooks that see
|
|
119
|
+
each one finish
|
|
120
|
+
- pass images a tool made back to the model by reference, never as base64 text
|
|
108
121
|
- keep TypeScript types around every request and response
|
|
109
122
|
|
|
110
123
|
## Guides
|
|
@@ -115,6 +128,7 @@ from the doc comments. The guides live in the repository, so these links go to G
|
|
|
115
128
|
| Guide | Covers |
|
|
116
129
|
| --- | --- |
|
|
117
130
|
| [The client](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/core.md) | Requests, context windows, token optimization, cost checks, reasoning, prompt caching, streaming |
|
|
131
|
+
| [The lifecycle](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/lifecycle.md) | Authorization, a shared budget, hooks, audit, and metrics for every call of every family |
|
|
118
132
|
| [Providers and routing](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/providers.md) | The twelve completion providers, routing and failover, the model registry |
|
|
119
133
|
| [Guardrails](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/security.md) | Injection, PII, secrets, schema validation, output redaction |
|
|
120
134
|
| [Graphs](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/docs/graphs.md) | Parallel branches, interrupts, checkpoints, time travel, subgraphs, caching, diagrams |
|
|
@@ -226,12 +240,15 @@ Shipped so far:
|
|
|
226
240
|
- self-managed deployment at scale: revisions and canaries with automatic rollback, a worker queue
|
|
227
241
|
that autoscales on Kubernetes, and per-tenant limits;
|
|
228
242
|
- the bridge to 2.0: every capability on a subpath of its own, everything 2.0 removes deprecated, and
|
|
229
|
-
a codemod that moves your imports
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
243
|
+
a codemod that moves your imports;
|
|
244
|
+
- 2.0 consolidation: one lifecycle for every call of every family, a shared spend budget, a root
|
|
245
|
+
import that holds only the client, no required dependencies, and a model registry checked against
|
|
246
|
+
every provider.
|
|
247
|
+
|
|
248
|
+
Upgrading from 1.x: `npx nexus migrate src --write` moves your imports, and
|
|
249
|
+
[MIGRATING.md](https://github.com/mkhitar-abrahamyan/nexus-ai/blob/main/MIGRATING.md) covers the rest.
|
|
250
|
+
Next, the image family leaves experimental once recorded live conformance passes on all three
|
|
251
|
+
backends.
|
|
235
252
|
|
|
236
253
|
## Before Production
|
|
237
254
|
|