@arnilo/prism 0.4.0 → 0.5.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 +41 -1
- package/README.md +23 -20
- package/dist/agent-run-state.d.ts +1 -2
- package/dist/agent-run-state.js +0 -3
- package/dist/agent-session/session/assemble.d.ts +6 -0
- package/dist/agent-session/session/assemble.js +391 -0
- package/dist/agent-session/session/persist.d.ts +28 -0
- package/dist/agent-session/session/persist.js +166 -0
- package/dist/agent-session/session/provider-round.d.ts +6 -0
- package/dist/agent-session/session/provider-round.js +231 -0
- package/dist/agent-session/session/tool-round.d.ts +31 -0
- package/dist/agent-session/session/tool-round.js +473 -0
- package/dist/agent-session/session/types.d.ts +115 -0
- package/dist/agent-session/session/types.js +5 -0
- package/dist/agent-session/session.d.ts +49 -43
- package/dist/agent-session/session.js +24 -1180
- package/dist/capture.d.ts +63 -0
- package/dist/capture.js +67 -0
- package/dist/cli-init.d.ts +18 -2
- package/dist/cli-init.js +2 -7
- package/dist/cli-runner.d.ts +2 -2
- package/dist/cli-runner.js +45 -9
- package/dist/content.d.ts +3 -3
- package/dist/content.js +3 -1
- package/dist/contracts-core/agent.d.ts +4 -0
- package/dist/contracts-core/batch.d.ts +97 -0
- package/dist/contracts-core/batch.js +65 -0
- package/dist/contracts-core/content.d.ts +72 -1
- package/dist/contracts-core/embeddings.d.ts +30 -0
- package/dist/contracts-core/embeddings.js +17 -0
- package/dist/contracts-core/images.d.ts +60 -0
- package/dist/contracts-core/images.js +17 -0
- package/dist/contracts-core/moderation.d.ts +46 -0
- package/dist/contracts-core/moderation.js +34 -0
- package/dist/contracts-core/speech.d.ts +39 -0
- package/dist/contracts-core/speech.js +17 -0
- package/dist/contracts-core/transcription.d.ts +48 -0
- package/dist/contracts-core/transcription.js +17 -0
- package/dist/contracts-core/video.d.ts +61 -0
- package/dist/contracts-core/video.js +17 -0
- package/dist/contracts-core.d.ts +7 -0
- package/dist/contracts-core.js +7 -0
- package/dist/contracts-protocol.d.ts +2 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5 -4
- package/dist/input.js +3 -2
- package/dist/node/agent-definitions.d.ts +1 -8
- package/dist/node/agent-definitions.js +0 -34
- package/dist/node/settings.d.ts +0 -1
- package/dist/node/settings.js +0 -5
- package/dist/pinned-fetch.js +29 -3
- package/dist/provider-events.js +3 -4
- package/dist/provider-request-policy.d.ts +15 -0
- package/dist/provider-request-policy.js +52 -0
- package/dist/providers/media.d.ts +1 -2
- package/dist/providers/media.js +1 -4
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.js +4 -4
- package/dist/testing/provider-conformance.d.ts +114 -5
- package/dist/testing/provider-conformance.js +342 -0
- package/dist/testing/tool-effect-store-conformance.d.ts +0 -1
- package/dist/testing/tool-effect-store-conformance.js +0 -3
- package/dist/thinking.d.ts +48 -9
- package/dist/thinking.js +134 -8
- package/docs/0.1.0-readiness.md +3 -3
- package/docs/a2a.md +2 -2
- package/docs/acp.md +3 -3
- package/docs/ag-ui-adoption.md +1 -1
- package/docs/ag-ui.md +1 -2
- package/docs/agent-definitions.md +1 -1
- package/docs/agent-events.md +5 -5
- package/docs/agent-identity.md +13 -2
- package/docs/agent-session-runtime.md +2 -1
- package/docs/audit-export.md +3 -3
- package/docs/batch-jobs.md +120 -0
- package/docs/cli-rpc.md +20 -9
- package/docs/coding-agent-tools.md +19 -19
- package/docs/coding-review-and-diagnostics.md +2 -2
- package/docs/coding-security.md +4 -4
- package/docs/coding-workspaces.md +2 -2
- package/docs/compaction-llm.md +2 -0
- package/docs/compaction-observational-memory.md +3 -0
- package/docs/computer-use-linux.md +13 -2
- package/docs/context-and-skills.md +1 -1
- package/docs/conversations.md +4 -4
- package/docs/credential-storage.md +11 -7
- package/docs/credentials-and-redaction.md +1 -1
- package/docs/data-classification.md +1 -1
- package/docs/database-persistence.md +4 -4
- package/docs/dev-inspector.md +6 -6
- package/docs/device-adapters.md +2 -2
- package/docs/diagrams.md +1 -1
- package/docs/document-reader.md +6 -6
- package/docs/documents.md +5 -4
- package/docs/embeddings.md +112 -0
- package/docs/enterprise-postgres-state.md +7 -7
- package/docs/evaluations.md +8 -8
- package/docs/extensions.md +3 -3
- package/docs/forge-integration.md +3 -3
- package/docs/graft.md +2 -2
- package/docs/guardrails.md +1 -1
- package/docs/host-security.md +15 -15
- package/docs/image-generation.md +129 -0
- package/docs/impeccable.md +5 -3
- package/docs/index.md +64 -36
- package/docs/indexed-code-search.md +2 -2
- package/docs/input-and-prompt-assembly.md +1 -1
- package/docs/language-intelligence.md +4 -4
- package/docs/live-testing.md +126 -0
- package/docs/mcp-tools.md +43 -12
- package/docs/middleware-hooks.md +1 -1
- package/docs/migrate-to-0.4.md +3 -3
- package/docs/migrate-to-0.5.md +144 -0
- package/docs/migration.md +33 -1
- package/docs/model-registry.md +38 -0
- package/docs/model-routing.md +5 -5
- package/docs/moderation.md +117 -0
- package/docs/multi-agent-patterns.md +4 -4
- package/docs/multimodal-content.md +26 -2
- package/docs/obscura.md +2 -2
- package/docs/observability.md +32 -7
- package/docs/openapi-tools.md +13 -3
- package/docs/operations.md +11 -0
- package/docs/performance.md +7 -7
- package/docs/persistence-credentials-multimodality-primitives.md +6 -6
- package/docs/policy-and-audit.md +17 -7
- package/docs/ponytail.md +1 -1
- package/docs/postgres-persistence.md +5 -5
- package/docs/process-sessions.md +2 -2
- package/docs/prompt-registry.md +7 -7
- package/docs/provider-caching.md +8 -2
- package/docs/provider-conformance.md +23 -1
- package/docs/provider-packages.md +49 -17
- package/docs/provider-primitives.md +1 -1
- package/docs/provider-request-policies.md +19 -6
- package/docs/providers/ai-sdk.md +27 -3
- package/docs/providers/alibaba.md +17 -1
- package/docs/providers/anthropic.md +16 -0
- package/docs/providers/azure.md +29 -1
- package/docs/providers/bedrock.md +27 -0
- package/docs/providers/clinepass.md +16 -0
- package/docs/providers/commandcode.md +265 -0
- package/docs/providers/deepseek.md +16 -0
- package/docs/providers/google.md +16 -0
- package/docs/providers/hyper.md +296 -0
- package/docs/providers/kimi.md +16 -0
- package/docs/providers/neuralwatt.md +16 -0
- package/docs/providers/ollama.md +27 -0
- package/docs/providers/openai-compatible.md +16 -0
- package/docs/providers/openai.md +16 -0
- package/docs/providers/opencode-go.md +16 -0
- package/docs/providers/openrouter.md +17 -1
- package/docs/providers/vertex.md +28 -0
- package/docs/providers/xai.md +16 -0
- package/docs/providers/zai.md +16 -0
- package/docs/public-contracts.md +1 -1
- package/docs/rag.md +26 -4
- package/docs/release-and-install.md +103 -46
- package/docs/resource-loading.md +1 -1
- package/docs/runs-and-usage.md +14 -2
- package/docs/server.md +5 -5
- package/docs/settings-auth-trust-security.md +7 -5
- package/docs/sheets.md +2 -2
- package/docs/speech.md +126 -0
- package/docs/sqlite-persistence.md +4 -4
- package/docs/supervisors.md +3 -3
- package/docs/thinking-and-reasoning.md +99 -61
- package/docs/tool-conformance.md +1 -1
- package/docs/tool-execution-primitives.md +8 -8
- package/docs/tools.md +4 -4
- package/docs/use-case-model-selection.md +1 -1
- package/docs/web-tools.md +1 -1
- package/docs/wiki.md +1 -1
- package/docs/work-artifacts-and-review.md +17 -6
- package/docs/work-connectors.md +4 -4
- package/docs/work-tools.md +5 -5
- package/docs/workflow-orchestration-primitives.md +11 -11
- package/docs/workflows.md +5 -5
- package/package.json +11 -8
- package/templates/init/providers.json +24 -8
- package/docs/antigravity-agent.md +0 -207
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# Hyper provider package
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
`@arnilo/prism-providers/hyper` provides explicit, side-effect-free setup for
|
|
6
|
+
[Charm Hyper](https://hyper.charm.land) — a pay-per-use reasoning-model gateway
|
|
7
|
+
billed in Hypercredits (1 HC = $0.05). The package routes by `ModelConfig.compat.route`:
|
|
8
|
+
|
|
9
|
+
| Route | Endpoint | Official model families |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `"openai"` (default) | `POST {baseUrl}/chat/completions` | most models (DeepSeek, Kimi, GLM, Gemma, …) |
|
|
12
|
+
| `"anthropic"` | `POST {baseUrl}/messages` | `qwen3.6-*` (Anthropic-shaped explicit-write cache pricing) |
|
|
13
|
+
| `"responses"` (explicit opt-in) | `POST {baseUrl}/responses` | OpenAI-standard pass-through; hosts bring Responses-shaped model metadata (Codex-style clients) |
|
|
14
|
+
|
|
15
|
+
Default base URL is the official API root:
|
|
16
|
+
|
|
17
|
+
```txt
|
|
18
|
+
https://hyper.charm.land/v1
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Authentication is `Authorization: Bearer <key>` on every route; the messages
|
|
22
|
+
route additionally sends provider-owned `x-api-key` + `anthropic-version:
|
|
23
|
+
2023-06-01` headers (Claude Code compatibility). API keys start with
|
|
24
|
+
`sk-hyper-`. The responses route reuses the OpenAI package's Responses
|
|
25
|
+
machinery wholesale — body serialization, stream events, usage mapping,
|
|
26
|
+
continuation cursors, and media handling — with Hyper's base URL and auth, so
|
|
27
|
+
its wire behavior matches the OpenAI-standard pass-through Charm documents.
|
|
28
|
+
Errors on that route are labeled `Hyper …` (e.g. `Hyper request failed: 429 …`).
|
|
29
|
+
|
|
30
|
+
## When to use it
|
|
31
|
+
|
|
32
|
+
Use it when a host app wants Hyper models through Prism's `AgentSession`
|
|
33
|
+
runtime with dual-route serialization, reasoning-content replay, cache-hint
|
|
34
|
+
breakpoints, and caller-gated model discovery and credit checks.
|
|
35
|
+
|
|
36
|
+
Do not use it for automatic credential discovery, setup-time catalog fetches,
|
|
37
|
+
or real-network tests (live probes are operator-gated, see below).
|
|
38
|
+
|
|
39
|
+
## Inputs / request
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import {
|
|
43
|
+
createHyperProviderPackage,
|
|
44
|
+
getHyperCredits,
|
|
45
|
+
listHyperModels,
|
|
46
|
+
} from "@arnilo/prism-providers/hyper";
|
|
47
|
+
|
|
48
|
+
createHyperProviderPackage(options: HyperProviderPackageOptions): ProviderPackage
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Field | Type | Purpose |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| `apiKey` | `CredentialValueSource` | Direct/callback/resolver API-key source. |
|
|
54
|
+
| `fetch` | `typeof fetch` | Optional fetch implementation for tests/hosts. |
|
|
55
|
+
| `baseUrl` | `string` | Overrides official `https://hyper.charm.land/v1`. |
|
|
56
|
+
| `models` | `readonly ModelConfig[]` | Overrides featured `hyperModels` defaults. |
|
|
57
|
+
|
|
58
|
+
`ProviderRequest.options.cache.breakpoints` select Anthropic-route
|
|
59
|
+
`cache_control` markers as documented below; `options.compat.reasoning_effort`
|
|
60
|
+
selects the per-request reasoning effort (clamped to the model's documented
|
|
61
|
+
`effortLevels`).
|
|
62
|
+
|
|
63
|
+
## Outputs / response / events
|
|
64
|
+
|
|
65
|
+
| Surface | Behavior |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| Provider stream | Prism text, thinking, tool-call delta/final, `usage`, `done`, redacted `error`. |
|
|
68
|
+
| Stream completion | `done` only on completion evidence — OpenAI route: `[DONE]` marker plus terminal `finish_reason`; Anthropic route: `message_stop`; Responses route: `response.completed` (or hop-cap/duplicate-cursor failure). Truncated streams end with terminal `error`; partial output never surfaces as `succeeded`. |
|
|
69
|
+
| OpenAI thinking | `delta.reasoning_content` → thinking deltas; replay via top-level `reasoning_content` when `preserveThinking` (default), never folded into text. |
|
|
70
|
+
| Anthropic thinking | `thinking_delta` → thinking deltas; replay via Anthropic thinking blocks when `preserveThinking`. |
|
|
71
|
+
| Usage | Standard tokens + cache read/write per route; `cost.usd`/`cost.hypercredits`/`remaining.hypercredits` available via `parseHyperUsageCost(wireUsage)` (NeuralWatt pattern) for hosts that surface cost telemetry. Cost/remaining fields are chat-route only; the responses route is a standard OpenAI pass-through (`input_tokens`/`output_tokens`/`total_tokens` + `input_tokens_details.cached_tokens`/`cache_write_tokens`) mapped by the shared Responses machinery. |
|
|
72
|
+
| Auth method | `api_key` for `hyper`, credential name `apiKey`. |
|
|
73
|
+
|
|
74
|
+
## Request/response example
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"Authorization": "Bearer sk-hyper-…",
|
|
79
|
+
"content-type": "application/json"
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Messages route adds provider-owned `x-api-key: <key>` and
|
|
84
|
+
`anthropic-version: 2023-06-01`; Bearer-only authentication is also accepted
|
|
85
|
+
there (Claude Code compatibility). All provider-owned headers are applied after
|
|
86
|
+
caller headers and cannot be overridden.
|
|
87
|
+
|
|
88
|
+
Chat-route body shape (thinking passthrough + preserved reasoning):
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"model": "deepseek-v4-pro",
|
|
93
|
+
"stream": true,
|
|
94
|
+
"stream_options": { "include_usage": true },
|
|
95
|
+
"reasoning_effort": "high",
|
|
96
|
+
"messages": [
|
|
97
|
+
{
|
|
98
|
+
"role": "assistant",
|
|
99
|
+
"tool_calls": [{ "id": "call_1", "type": "function", "function": { "name": "lookup", "arguments": "{}" } }],
|
|
100
|
+
"reasoning_content": "plan the lookup"
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Responses-route body (OpenAI-standard pass-through, shared Responses machinery):
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"model": "deepseek-v4-pro",
|
|
111
|
+
"input": [{ "role": "user", "content": [{ "type": "input_text", "text": "hi" }] }],
|
|
112
|
+
"tools": [{ "type": "function", "name": "lookup", "parameters": {} }],
|
|
113
|
+
"stream": true,
|
|
114
|
+
"store": false,
|
|
115
|
+
"reasoning": { "effort": "high" }
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
Cache hints (`options.cacheKey`/`sessionId`) surface as the OpenAI-standard
|
|
119
|
+
`sanitized prompt_cache_key` on this route only; `prompt_cache_retention`/`prompt_cache_options`
|
|
120
|
+
are never emitted for implicit Hyper models (no documented 24h/`explicitBreakpoints` support).
|
|
121
|
+
|
|
122
|
+
## Implementation example
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { createExtensionKernel } from "@arnilo/prism";
|
|
126
|
+
import {
|
|
127
|
+
createHyperProviderPackage,
|
|
128
|
+
getHyperCredits,
|
|
129
|
+
listHyperModels,
|
|
130
|
+
} from "@arnilo/prism-providers/hyper";
|
|
131
|
+
|
|
132
|
+
const kernel = createExtensionKernel();
|
|
133
|
+
await kernel.load([createHyperProviderPackage({ apiKey: process.env.HYPER_API_KEY })]);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Caller-gated live catalog (never runs during package setup):
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
const models = await listHyperModels({ fetch }); // public endpoint, no auth needed
|
|
140
|
+
await kernel.load([createHyperProviderPackage({ apiKey: process.env.HYPER_API_KEY, models })]);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Optional credit display (hosts poll on their own schedule; never called from
|
|
144
|
+
`generate()`):
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
const { balance } = await getHyperCredits({ apiKey: process.env.HYPER_API_KEY });
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Featured models and routes
|
|
151
|
+
|
|
152
|
+
Featured `hyperModels` mirrors the official `/v1/models` catalog (31 models,
|
|
153
|
+
2026-07 snapshot), with limits, vision capability, documented `effort_levels`,
|
|
154
|
+
and per-million-token pricing (input/output/cache-hit) captured in metadata.
|
|
155
|
+
Route selection follows the observed pricing shape: models whose live catalog
|
|
156
|
+
entry prices explicit cache writes (cache_create > 0, with hit pricing) are
|
|
157
|
+
Anthropic-route `cache_control`; models with implicit write pricing
|
|
158
|
+
(cache_create = 0, no read charge) stay chat-route `implicit` with the write
|
|
159
|
+
fee recorded in `cost.cacheWrite`.
|
|
160
|
+
|
|
161
|
+
| Model family | Route | Cache kind |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
| `deepseek-v4-pro`, `deepseek-v4-pro-0813`, `deepseek-v4-flash` | `openai` | `implicit` |
|
|
164
|
+
| `kimi-k3`, `kimi-k2.7`, `kimi-k2.5`, `glm-5.3-flash`, `glm-5.1`, `gemma-4-fast`, `gpt-oss-120b`, `llama-*`, `minimax-m2.7`, `qwen3-coder`, `qwen3-next`, `qwen3.7-*` | `openai` | `implicit` |
|
|
165
|
+
| `qwen3.6-plus`, `qwen3.6-flash` | `anthropic` | `cache_control` (max 4 breakpoints, no `ttl` — undocumented) |
|
|
166
|
+
|
|
167
|
+
## Model discovery
|
|
168
|
+
|
|
169
|
+
```txt
|
|
170
|
+
GET https://hyper.charm.land/v1/models
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Public endpoint — works without authentication and emits no auth header when no
|
|
174
|
+
key resolves. `listHyperModels({ fetch?, baseUrl?, apiKey?, signal?, headers? })`
|
|
175
|
+
maps each `{ id, context_window, max_output_tokens, capabilities.vision,
|
|
176
|
+
reasoning.effort_levels, pricing{cache_create, cache_hit} }` entry to
|
|
177
|
+
`ModelConfig` (route from pricing shape via `routeForHyperModel`). Discovery is
|
|
178
|
+
**caller-gated** — setup performs zero fetches.
|
|
179
|
+
|
|
180
|
+
## Thinking / reasoning
|
|
181
|
+
|
|
182
|
+
| Surface | Behavior |
|
|
183
|
+
| --- | --- |
|
|
184
|
+
| OpenAI route stream | `reasoning_content` → thinking deltas |
|
|
185
|
+
| OpenAI route replay | thinking blocks → top-level `reasoning_content` when `preserveThinking`; never folded into text |
|
|
186
|
+
| OpenAI route body | `reasoning_effort` from model default or `options.compat` (request wins), clamped to the model's documented `effortLevels`; invalid values are dropped |
|
|
187
|
+
| Anthropic route stream | `thinking_delta` → thinking deltas |
|
|
188
|
+
| Anthropic route replay | thinking blocks when `preserveThinking` |
|
|
189
|
+
|
|
190
|
+
Owned compat keys (`route`, `preserveThinking`, `reasoning_effort`,
|
|
191
|
+
`effortLevels`) are stripped before opaque compat spread so resolved values win.
|
|
192
|
+
|
|
193
|
+
## Extension and configuration notes
|
|
194
|
+
|
|
195
|
+
- Hosts choose base URL, model list, credential source, and `fetch` impl.
|
|
196
|
+
- Route selection is explicit via `compat.route` (`"anthropic"` or `"responses"`; default `"openai"`). The responses route is never auto-derived — hosts opt in with Responses-shaped model metadata (Codex-style clients), and featured models stay `openai`/`anthropic`.
|
|
197
|
+
- Package contributes models via the extension `api` and an `api_key` auth method.
|
|
198
|
+
|
|
199
|
+
### Cache and session behavior
|
|
200
|
+
|
|
201
|
+
- The chat route sends **no** Anthropic `cache_control` fields; it relies on
|
|
202
|
+
OpenAI-style implicit caching. Read tokens map from
|
|
203
|
+
`prompt_tokens_details.cached_tokens` / `cache_write_tokens` /
|
|
204
|
+
`prompt_cache_hit_tokens` (the shared OpenAI usage mapping covers both field
|
|
205
|
+
spellings).
|
|
206
|
+
- The Anthropic route applies `cache_control: { type: "ephemeral" }` markers
|
|
207
|
+
only to the caller-selected `cache.breakpoints` (shared `applyCacheControl()`
|
|
208
|
+
helper) on the last content block of each selected message — not to every
|
|
209
|
+
block. A `system_prompt` breakpoint serializes `system` as marked text blocks
|
|
210
|
+
(plain string otherwise). Caching is enabled unless disabled
|
|
211
|
+
(`cacheRetention: "none"` / `cache.mode: "off"`) and the model opts in via
|
|
212
|
+
`ModelConfig.cache.kind: "cache_control"`.
|
|
213
|
+
- The responses route carries OpenAI-standard `prompt_cache_key` only when the
|
|
214
|
+
caller supplies cache hints (`cacheKey`/`sessionId`, sanitized + clamped to
|
|
215
|
+
64 chars by the shared helper); no `prompt_cache_retention`/`prompt_cache_options`
|
|
216
|
+
(implicit models, no documented 24h/explicit modes).
|
|
217
|
+
- **No `ttl` is ever emitted**: Hyper does not document `cache_control` TTL
|
|
218
|
+
values; `cacheRetention: "long"` must not produce a marker Hyper may reject.
|
|
219
|
+
Re-verify against live behavior before emitting TTLs.
|
|
220
|
+
- Usage accounting per route: chat route maps
|
|
221
|
+
`prompt_tokens_details.cached_tokens`/`cache_write_tokens` (and
|
|
222
|
+
`prompt_cache_hit_tokens`); messages route maps
|
|
223
|
+
`cache_read_input_tokens`/`cache_creation_input_tokens`.
|
|
224
|
+
- Session identity is simple: no session header is emitted (unlike OpenCode Go).
|
|
225
|
+
|
|
226
|
+
### Live-verified mapping (findings ledger)
|
|
227
|
+
|
|
228
|
+
The following claims are encoded as operator-gated probes in
|
|
229
|
+
`packages/prism-providers/src/hyper/__tests__/live.test.ts`. Each probe's
|
|
230
|
+
assertion encodes the documented claim, so a probe failure **is** the finding;
|
|
231
|
+
record the outcome here and adjust the mapping. Status: **pending operator
|
|
232
|
+
run** (no key in CI):
|
|
233
|
+
|
|
234
|
+
| # | Claim (documented) | Probe | Status |
|
|
235
|
+
| --- | --- | --- | --- |
|
|
236
|
+
| 1 | Warm chat-route replay reports cached tokens (`cached_tokens`/`prompt_cache_hit_tokens` → `cacheReadTokens`) | `live_chat_route_reports_cached_tokens_on_warm_prefix_replay` | pending |
|
|
237
|
+
| 2 | `cache_control` on messages reports `cache_creation_input_tokens` on the creating call | `live_messages_route_cache_control_reports_creation_and_read_tokens` | pending |
|
|
238
|
+
| 3 | Same-prefix warm replay reads the created cache entry (TTL ≥ one request) | same probe (warm leg) | pending |
|
|
239
|
+
| 4 | `reasoning_effort` from the model's documented `effortLevels` is accepted (HTTP 200) | `live_reasoning_effort_is_accepted_on_chat_route` | pending |
|
|
240
|
+
|
|
241
|
+
Run the gate:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
PRISM_LIVE_PROVIDER_TESTS=1 HYPER_API_KEY=sk-hyper-... \
|
|
245
|
+
npm run test --workspace=@arnilo/prism-providers/hyper
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Request construction (0.5.1)
|
|
249
|
+
|
|
250
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
251
|
+
|
|
252
|
+
| | |
|
|
253
|
+
| --- | --- |
|
|
254
|
+
| P1 session wire | Responses: `prompt_cache_key`; chat/Anthropic: no session header |
|
|
255
|
+
| Mandatory | no |
|
|
256
|
+
| P2 default cache | Anthropic: `cache_control`; Responses: openai_key rules; chat: implicit |
|
|
257
|
+
|
|
258
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
259
|
+
|
|
260
|
+
## Security and performance notes
|
|
261
|
+
|
|
262
|
+
- SSE streams and HTTP error bodies use bounded `@arnilo/prism/providers/transport` helpers.
|
|
263
|
+
- No network calls during import, setup, build, or default tests.
|
|
264
|
+
- No automatic environment, file, keychain, or shell credential lookup.
|
|
265
|
+
- API keys are resolved per request from caller-supplied values or resolvers
|
|
266
|
+
and redacted from errors (including discovery and credits failures).
|
|
267
|
+
- `402` (insufficient Hypercredits) surfaces non-retryable `billing_error`;
|
|
268
|
+
`429` and `5xx` are retryable with `retry-after` surfaced as
|
|
269
|
+
`retry_after_ms`; `400/401/403/404` are non-retryable.
|
|
270
|
+
- Caller headers cannot override provider-owned headers (`content-type`,
|
|
271
|
+
`authorization`, and on the messages route `x-api-key`/`anthropic-version`).
|
|
272
|
+
- Live tests stay opt-in behind `PRISM_LIVE_PROVIDER_TESTS=1` plus
|
|
273
|
+
`HYPER_API_KEY`; default tests are network-free.
|
|
274
|
+
|
|
275
|
+
## Official evidence
|
|
276
|
+
|
|
277
|
+
- Hyper API docs: `https://hyper.charm.land/docs/api/{authentication,list-models,openai-chat-completions,openai-responses,anthropic-messages,credits}.html`
|
|
278
|
+
- Hyper model catalog: `https://hyper.charm.land/docs/models.html`, `https://hyper.charm.land/faq`
|
|
279
|
+
- Live `GET https://hyper.charm.land/v1/models` snapshot (2026-07) — pricing/limits in the static catalog
|
|
280
|
+
- Probe ledger above pending operator-gated live run
|
|
281
|
+
- Intelligent-routing re-check (2026-09): roadmap-only, no documented controls — see
|
|
282
|
+
`../_evidence/phase55-hyper-intelligent-routing.md`
|
|
283
|
+
|
|
284
|
+
## Thinking and reasoning
|
|
285
|
+
|
|
286
|
+
Hyper models derive `capabilities.thinkingLevels` from `compat.effortLevels` (the live `/v1/models` `reasoning.effort_levels` list) and stamp `reasoning_effort`. `hyperReasoningEffort` snaps to the declared set instead of dropping out-of-set values (`max`↔`xhigh` on deepseek-v4-flash); undeclared models and opaque values pass through. The Anthropic route emits resolved `output_config.effort` (snapped) instead of leaking raw `reasoning_effort`. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
287
|
+
|
|
288
|
+
## Related APIs
|
|
289
|
+
|
|
290
|
+
- [Provider packages](../provider-packages.md): `defineProviderPackage`,
|
|
291
|
+
`ModelConfig`, discovery contract, request/cache policies.
|
|
292
|
+
- [Thinking and reasoning](../thinking-and-reasoning.md): per-turn `ThinkingLevel` → compat families.
|
|
293
|
+
- [Credentials and redaction](../credentials-and-redaction.md):
|
|
294
|
+
`resolveCredentialValue`, `redactSecrets`.
|
|
295
|
+
- [Provider caching](../provider-caching.md): per-provider cache behavior matrix.
|
|
296
|
+
- [Provider conformance](../provider-conformance.md): network-free adapter tests.
|
package/docs/providers/kimi.md
CHANGED
|
@@ -185,6 +185,18 @@ await kernel.load([
|
|
|
185
185
|
- Coding usage: `cache_read_input_tokens` → `Usage.cacheReadTokens`,
|
|
186
186
|
`cache_creation_input_tokens` → `Usage.cacheWriteTokens`.
|
|
187
187
|
|
|
188
|
+
## Request construction (0.5.1)
|
|
189
|
+
|
|
190
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
191
|
+
|
|
192
|
+
| | |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| P1 session wire | none extra |
|
|
195
|
+
| Mandatory | no |
|
|
196
|
+
| P2 default cache | Anthropic/Coding: `cache_control`; Moonshot: none |
|
|
197
|
+
|
|
198
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
199
|
+
|
|
188
200
|
## Security and performance notes
|
|
189
201
|
|
|
190
202
|
- SSE streams and HTTP error bodies use bounded `@arnilo/prism/providers/transport`
|
|
@@ -199,6 +211,10 @@ await kernel.load([
|
|
|
199
211
|
- Live tests stay opt-in behind `PRISM_LIVE_PROVIDER_TESTS=1` plus provider-specific
|
|
200
212
|
env names; default tests are network-free.
|
|
201
213
|
|
|
214
|
+
## Thinking and reasoning
|
|
215
|
+
|
|
216
|
+
Kimi models are family-stamped by id: K3 (`kimiThinkingFamily`) routes through `reasoning_effort` with declared levels `low/high/max` — other portable levels snap (`medium`→`high`, `xhigh`→`max`, `none`/`minimal`→`low`); unknown effort strings pass through for forward compatibility. K2.x models route through `thinking_type` (on/off toggle; K2.7-code thinking is always on). Do not send conflicting `thinking` + `reasoning_effort`. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
217
|
+
|
|
202
218
|
## Related APIs
|
|
203
219
|
|
|
204
220
|
- [Provider packages](../provider-packages.md): `defineProviderPackage`,
|
|
@@ -360,6 +360,18 @@ const decision = classifyNeuralWattError({ status: 429, headers: { "retry-after"
|
|
|
360
360
|
// { retryable: true, code: 429, retryAfterMs: 1000, errorCode: "concurrent_budget_exceeded", strategy: undefined }
|
|
361
361
|
```
|
|
362
362
|
|
|
363
|
+
## Request construction (0.5.1)
|
|
364
|
+
|
|
365
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
366
|
+
|
|
367
|
+
| | |
|
|
368
|
+
| --- | --- |
|
|
369
|
+
| P1 session wire | none |
|
|
370
|
+
| Mandatory | no |
|
|
371
|
+
| P2 default cache | implicit, no markers |
|
|
372
|
+
|
|
373
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
374
|
+
|
|
363
375
|
## Security and performance notes
|
|
364
376
|
|
|
365
377
|
- SSE streams, HTTP error bodies, and quota/model-discovery failures use bounded `@arnilo/prism/providers/transport` helpers (`readSseEvents`, `readBoundedResponseText`). NeuralWatt `: energy` / `: cost` comment frames are surfaced via `readSseEvents` `comments` and mapped locally.
|
|
@@ -380,6 +392,10 @@ const decision = classifyNeuralWattError({ status: 429, headers: { "retry-after"
|
|
|
380
392
|
- Live tests stay opt-in behind `NEURALWATT_API_KEY` (plus `PRISM_LIVE_PROVIDER_TESTS=1`);
|
|
381
393
|
default tests are network-free.
|
|
382
394
|
|
|
395
|
+
## Thinking and reasoning
|
|
396
|
+
|
|
397
|
+
NeuralWatt reasoning models declare `low/medium/high/max` and snap `reasoning_effort` to that set; non-reasoning models (`-fast`, gemma) declare nothing. `thinking_token_budget` and `chat_template_kwargs` (`preserve_thinking`/`clear_thinking`) stay package-local. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
398
|
+
|
|
383
399
|
## Related APIs
|
|
384
400
|
|
|
385
401
|
- [Provider packages](../provider-packages.md): `defineProviderPackage`,
|
package/docs/providers/ollama.md
CHANGED
|
@@ -139,6 +139,18 @@ await kernel.load([
|
|
|
139
139
|
`Usage.cacheReadTokens` is intentionally left `undefined` (not `0`). If a future
|
|
140
140
|
Ollama release reports cached tokens, map them in `mapOllamaModel`/usage handling.
|
|
141
141
|
|
|
142
|
+
## Request construction (0.5.1)
|
|
143
|
+
|
|
144
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
145
|
+
|
|
146
|
+
| | |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| P1 session wire | none |
|
|
149
|
+
| Mandatory | no |
|
|
150
|
+
| P2 default cache | implicit, no markers |
|
|
151
|
+
|
|
152
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
153
|
+
|
|
142
154
|
## Security and performance notes
|
|
143
155
|
|
|
144
156
|
- SSE streams and HTTP error bodies use bounded `@arnilo/prism/providers/transport`
|
|
@@ -155,6 +167,21 @@ await kernel.load([
|
|
|
155
167
|
- Model discovery is caller-gated and never invoked in the provider hot path.
|
|
156
168
|
- Live tests stay opt-in; default tests are network-free.
|
|
157
169
|
|
|
170
|
+
## Live probe
|
|
171
|
+
|
|
172
|
+
The only credential-free live suite: points at a real Ollama server (local `ollama serve` or Ollama Cloud):
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
PRISM_LIVE_PROVIDER_TESTS=1 OLLAMA_BASE_URL=http://localhost:11434 \
|
|
176
|
+
node --test packages/prism-providers/dist/ollama/__tests__/live.test.js
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
A health gate lists served models and probes the first (`PRISM_LIVE_OLLAMA_MODEL` to pin one). No server or no pulled models → skip.
|
|
180
|
+
|
|
181
|
+
## Thinking and reasoning
|
|
182
|
+
|
|
183
|
+
Ollama models stamp `reasoning_effort` and snap to declared levels: `gpt-oss*` declares `low/medium/high`; other ids declare nothing and pass effort through verbatim. The native `think` field has a disjoint value set and is never emitted alongside `reasoning_effort`. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
184
|
+
|
|
158
185
|
## Related APIs
|
|
159
186
|
|
|
160
187
|
- [Provider packages](../provider-packages.md): `defineProviderPackage`,
|
|
@@ -139,6 +139,18 @@ const provider = createOpenAICompatibleProvider({
|
|
|
139
139
|
|
|
140
140
|
- Cache behavior is intentionally minimal: this Chat Completions adapter sends no `prompt_cache_key`, `prompt_cache_retention`, or `cache_control` fields. Endpoints that cache implicitly do so automatically; hosts needing OpenAI `prompt_cache_key`/`prompt_cache_retention` should use the [`@arnilo/prism-providers/openai`](openai.md) Responses package. The adapter still normalizes cache usage from `prompt_tokens_details.cached_tokens` (and `prompt_cache_hit_tokens`) into `Usage.cacheReadTokens`.
|
|
141
141
|
|
|
142
|
+
## Request construction (0.5.1)
|
|
143
|
+
|
|
144
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
145
|
+
|
|
146
|
+
| | |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| P1 session wire | none (factory sends no session/cache wire) |
|
|
149
|
+
| Mandatory | no |
|
|
150
|
+
| P2 default cache | none unless the vendor adapter maps options |
|
|
151
|
+
|
|
152
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
153
|
+
|
|
142
154
|
## Security and performance notes
|
|
143
155
|
|
|
144
156
|
- Credentials are host-owned and resolved only when `generate()` runs.
|
|
@@ -150,6 +162,10 @@ const provider = createOpenAICompatibleProvider({
|
|
|
150
162
|
- Tests should use injected `fetch` and never make real network calls.
|
|
151
163
|
- Tool-call arguments are accumulated as streamed text, parsed with `parseJsonObjectArguments` when the final tool call is emitted; empty argument text yields `{}`, malformed JSON yields an `error` event.
|
|
152
164
|
|
|
165
|
+
## Thinking and reasoning
|
|
166
|
+
|
|
167
|
+
The shared OpenAI-compatible base (`createOpenAICompatibleProvider`) does **not** spread `compat` onto request bodies — packages that want thinking forwarded wire a `buildBodyExtra`/`transformBody` hook (Azure, Vertex, and Bedrock use the shared sanitized forwarder: `reasoning_effort` + aliases or a `reasoning` object, effort snapped to declared levels). Host-owned adapters should do the same or accept the no-op. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
168
|
+
|
|
153
169
|
## Related APIs
|
|
154
170
|
|
|
155
171
|
- [Provider layer](../provider-layer.md): registries, provider events, tool-call helpers, and mock provider.
|
package/docs/providers/openai.md
CHANGED
|
@@ -207,6 +207,18 @@ Official: [Reasoning models](https://developers.openai.com/api/docs/guides/reaso
|
|
|
207
207
|
`response.output_item.added` + `response.function_call_arguments.delta`
|
|
208
208
|
(string `delta`), not Chat Completions object deltas.
|
|
209
209
|
|
|
210
|
+
## Request construction (0.5.1)
|
|
211
|
+
|
|
212
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
213
|
+
|
|
214
|
+
| | |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| P1 session wire | `prompt_cache_key` from `cacheKey??sessionId`; `x-client-request-id` from `sessionId` |
|
|
217
|
+
| Mandatory | no |
|
|
218
|
+
| P2 default cache | GPT-5.6+ `explicitBreakpoints` → `prompt_cache_breakpoint` + `cacheRetention: "short"`; older families none |
|
|
219
|
+
|
|
220
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
221
|
+
|
|
210
222
|
## Security and performance notes
|
|
211
223
|
|
|
212
224
|
- SSE streams and HTTP error bodies use bounded `@arnilo/prism/providers/transport` helpers (`readSseData`, `readBoundedResponseText`).
|
|
@@ -223,6 +235,10 @@ Official: [Reasoning models](https://developers.openai.com/api/docs/guides/reaso
|
|
|
223
235
|
- Live tests stay opt-in behind `PRISM_LIVE_PROVIDER_TESTS=1` plus fake-safe
|
|
224
236
|
provider-specific env names; default `npm test` is network-free.
|
|
225
237
|
|
|
238
|
+
## Thinking and reasoning
|
|
239
|
+
|
|
240
|
+
OpenAI models route through the `openai_reasoning` family: the adapter merges `compat.reasoning.effort` and Responses bodies carry `reasoning.effort`. Declared levels (`capabilities.thinkingLevels`): gpt-5.1 family `none/low/medium/high` (default `none`); gpt-5.2 family `none`–`xhigh` (default `medium`); gpt-5.x/o1/o3/o4 families `minimal`–`high` (default `medium`). Unknown model ids declare nothing and pass through untouched. `resolveOpenAIReasoning` snaps a merged effort to the declared set (nearest by ladder distance, ties up; below-minimum snaps up); an existing `reasoning.summary` is preserved. There is no upstream API to enumerate effort values — the tables are doc-pinned in [the evidence matrix](../_evidence/thinking-coverage-2026-09-05.md). See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
241
|
+
|
|
226
242
|
## Related APIs
|
|
227
243
|
|
|
228
244
|
- [Provider packages](../provider-packages.md): `defineProviderPackage`, auth
|
|
@@ -233,6 +233,18 @@ Owned compat keys (`route`, `thinking`, `reasoning`, `reasoning_effort`,
|
|
|
233
233
|
`Usage.cacheReadTokens`/`cacheWriteTokens`; the Anthropic route maps
|
|
234
234
|
`cache_read_input_tokens`/`cache_creation_input_tokens`.
|
|
235
235
|
|
|
236
|
+
## Request construction (0.5.1)
|
|
237
|
+
|
|
238
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
239
|
+
|
|
240
|
+
| | |
|
|
241
|
+
| --- | --- |
|
|
242
|
+
| P1 session wire | `x-opencode-session` from `cacheKey??sessionId` |
|
|
243
|
+
| Mandatory | **yes** — missing id throws `ProviderRequirementError` (`ERR_PRISM_PROVIDER_REQUIREMENT`) before fetch; message has no request body |
|
|
244
|
+
| P2 default cache | Anthropic route: `cache_control` markers; OpenAI route: none |
|
|
245
|
+
|
|
246
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
247
|
+
|
|
236
248
|
## Security and performance notes
|
|
237
249
|
|
|
238
250
|
- SSE streams and HTTP error bodies use bounded `@arnilo/prism/providers/transport` helpers (`readSseData`, `readBoundedResponseText`).
|
|
@@ -252,6 +264,10 @@ Owned compat keys (`route`, `thinking`, `reasoning`, `reasoning_effort`,
|
|
|
252
264
|
- [OpenCode Go](https://opencode.ai/docs/go/) — model list, dual endpoints, pricing/usage, `GET /zen/go/v1/models`
|
|
253
265
|
- Pi secondary (ids/limits only): `packages/ai/src/providers/opencode-go.ts`, `opencode-go.models.ts`
|
|
254
266
|
|
|
267
|
+
## Thinking and reasoning
|
|
268
|
+
|
|
269
|
+
OpenCode-Go models carry level tables: `kimi-k3`/`deepseek-v4`/`glm-5.3` → `reasoning_effort` (`low/high/max`), `glm-5.2` → `reasoning_effort` (`low`–`max`), `grok-4.6` → `low/medium/high/xhigh`, `grok-4.5` → `low/medium/high`, Kimi-K2.x/MiniMax/Qwen → `thinking_type`; mimo/unknown declare nothing and pass through. The Anthropic route uses the shared serializer with resolved thinking + `output_config.effort` hooks; the OpenAI route snaps effort to declared sets. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
270
|
+
|
|
255
271
|
## Related APIs
|
|
256
272
|
|
|
257
273
|
- [Provider packages](../provider-packages.md): `defineProviderPackage`,
|
|
@@ -174,6 +174,18 @@ for Anthropic/Qwen/Gemini families with cache pricing; otherwise `implicit` when
|
|
|
174
174
|
cache-read pricing exists), and seeds `compat.reasoning.effort` from
|
|
175
175
|
`reasoning.default_effort` when present.
|
|
176
176
|
|
|
177
|
+
## Request construction (0.5.1)
|
|
178
|
+
|
|
179
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
180
|
+
|
|
181
|
+
| | |
|
|
182
|
+
| --- | --- |
|
|
183
|
+
| P1 session wire | `x-session-id` + body `session_id` |
|
|
184
|
+
| Mandatory | no |
|
|
185
|
+
| P2 default cache | kernel defaults → per-message `cache_control` (not top-level automatic) |
|
|
186
|
+
|
|
187
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
188
|
+
|
|
177
189
|
## Security and performance notes
|
|
178
190
|
|
|
179
191
|
- SSE streams and HTTP error bodies use bounded `@arnilo/prism/providers/transport` helpers (`readSseData`, `readBoundedResponseText`).
|
|
@@ -189,7 +201,11 @@ cache-read pricing exists), and seeds `compat.reasoning.effort` from
|
|
|
189
201
|
hidden app identity.
|
|
190
202
|
- Live tests stay opt-in behind `PRISM_LIVE_PROVIDER_TESTS=1` plus fake-safe
|
|
191
203
|
provider-specific env names; default tests are network-free.
|
|
192
|
-
- Enterprise hosts that must gate `compat.openRouterRouting` should wrap selection with `@arnilo/prism-model-router` (`allowOpenRouterRouting`); the OpenRouter adapter itself still passthroughs routing when present on the request.
|
|
204
|
+
- Enterprise hosts that must gate `compat.openRouterRouting` should wrap selection with `@arnilo/prism-core/governance/model-router` (`allowOpenRouterRouting`); the OpenRouter adapter itself still passthroughs routing when present on the request.
|
|
205
|
+
|
|
206
|
+
## Thinking and reasoning
|
|
207
|
+
|
|
208
|
+
OpenRouter models route through the `openai_reasoning` family with **API-derived** levels: `mapOpenRouterModel` reads the models API `reasoning.supported_efforts` into `capabilities.thinkingLevels` (a `mandatory` model excludes `none`), and `resolveOpenRouterReasoning` snaps a merged effort to that set. Models without reasoning metadata pass effort through verbatim (OpenRouter accepts the full ladder globally). See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
193
209
|
|
|
194
210
|
## Related APIs
|
|
195
211
|
|
package/docs/providers/vertex.md
CHANGED
|
@@ -55,6 +55,18 @@ const provider = createVertexProvider({
|
|
|
55
55
|
|
|
56
56
|
`@arnilo/prism-providers/google` remains API-key Gemini (`generativelanguage.googleapis.com`) and must not register Vertex OAuth/ADC. Load this package explicitly for Vertex.
|
|
57
57
|
|
|
58
|
+
## Request construction (0.5.1)
|
|
59
|
+
|
|
60
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
61
|
+
|
|
62
|
+
| | |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| P1 session wire | none |
|
|
65
|
+
| Mandatory | no |
|
|
66
|
+
| P2 default cache | host-owned, no Prism cache fields |
|
|
67
|
+
|
|
68
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
69
|
+
|
|
58
70
|
## Security and performance notes
|
|
59
71
|
|
|
60
72
|
- No Google Cloud SDK dependency in the package.
|
|
@@ -63,6 +75,22 @@ const provider = createVertexProvider({
|
|
|
63
75
|
- Conformance-proven (Task 6): package `setup()` performs zero fetch and zero credential resolution; an already-aborted signal fails fast; a truncated SSE stream (no `data: [DONE]`) ends in an `error` event; native Vertex cached-content lifecycle is intentionally unsupported on the OpenAI-compatible route — no cache wire fields are emitted even when the request carries Prism cache hints (use `@arnilo/prism-providers/google`'s `extra.cachedContent` on that package, or manage cache resources host-side).
|
|
64
76
|
- Pair with model-router residency allow-lists on `location`.
|
|
65
77
|
|
|
78
|
+
## Live probe
|
|
79
|
+
|
|
80
|
+
Opt-in smoke against Vertex's OpenAI-compatible endpoint. The suite takes a pre-minted bearer token (host ADC/workload identity stays host-owned):
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
PRISM_LIVE_PROVIDER_TESTS=1 GOOGLE_VERTEX_PROJECT=my-project \
|
|
84
|
+
PRISM_VERTEX_ACCESS_TOKEN=$(gcloud auth print-access-token) \
|
|
85
|
+
node --test packages/prism-providers/dist/vertex/__tests__/live.test.js
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`GOOGLE_VERTEX_LOCATION` (default `us-central1`) and `PRISM_LIVE_VERTEX_MODEL` (default `gemini-2.5-flash`) are optional. Missing project or token → skip.
|
|
89
|
+
|
|
90
|
+
## Thinking and reasoning
|
|
91
|
+
|
|
92
|
+
Vertex AI OpenAI-compat chat uses the same sanitized thinking-compat forwarding as Azure: `reasoning_effort` (aliases `effort`/`reasoningEffort`) or a `reasoning` object, snapped to the model's declared levels (Gemini → `low/medium/high`). `reasoning_effort` and `extra_body.google.thinking_config` are mutually exclusive upstream — send one. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
93
|
+
|
|
66
94
|
## Related APIs
|
|
67
95
|
|
|
68
96
|
- [Google Gemini (consumer)](google.md)
|
package/docs/providers/xai.md
CHANGED
|
@@ -115,6 +115,18 @@ await kernel.load([
|
|
|
115
115
|
- Reasoning models replay `reasoning_content` and do not flatten thinking into text.
|
|
116
116
|
- Generate always hits `https://api.x.ai/v1/chat/completions` (same backend for API key and SuperGrok access).
|
|
117
117
|
|
|
118
|
+
## Request construction (0.5.1)
|
|
119
|
+
|
|
120
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
121
|
+
|
|
122
|
+
| | |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| P1 session wire | `x-grok-conv-id` from `cache.key??cacheKey??sessionId` |
|
|
125
|
+
| Mandatory | no |
|
|
126
|
+
| P2 default cache | implicit; header is the correlation |
|
|
127
|
+
|
|
128
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
129
|
+
|
|
118
130
|
## Security and performance notes
|
|
119
131
|
|
|
120
132
|
- Public client id is documented as not a secret. Device/user/access/refresh codes are redacted.
|
|
@@ -123,6 +135,10 @@ await kernel.load([
|
|
|
123
135
|
- Bounded OAuth and API error bodies. No retry loop. No refresh timer.
|
|
124
136
|
- Live API-key smoke: `PRISM_LIVE_PROVIDER_TESTS=1` + `XAI_API_KEY`. SuperGrok login is operator-only (`PRISM_LIVE_XAI_OAUTH=1`).
|
|
125
137
|
|
|
138
|
+
## Thinking and reasoning
|
|
139
|
+
|
|
140
|
+
Reasoning models now send `reasoning_effort` (task-065 change — previously dropped): grok-4.6 declares `low/medium/high/xhigh` (default `high`), grok-4.5 `low/medium/high`, grok-4.3 `none/low/medium/high`. Effort snaps to the declared set (nearest, ties up); `grok-build` declares nothing and passes `reasoning_effort` through verbatim. Reasoning models must still replay `reasoning_content` — Featured Completions flatten nothing. See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
141
|
+
|
|
126
142
|
## Related APIs
|
|
127
143
|
|
|
128
144
|
- [Provider packages](../provider-packages.md): OAuth support matrix.
|
package/docs/providers/zai.md
CHANGED
|
@@ -139,6 +139,18 @@ await session.prompt("Plan the refactor", {
|
|
|
139
139
|
and `prompt_tokens_details.cache_write_tokens` → `Usage.cacheWriteTokens` when
|
|
140
140
|
the server reports them.
|
|
141
141
|
|
|
142
|
+
## Request construction (0.5.1)
|
|
143
|
+
|
|
144
|
+
Agent sessions stamp `sessionId`/`cacheKey` without a host policy. Session/cache keys are correlation ids, never secrets.
|
|
145
|
+
|
|
146
|
+
| | |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| P1 session wire | none |
|
|
149
|
+
| Mandatory | no |
|
|
150
|
+
| P2 default cache | implicit, no markers |
|
|
151
|
+
|
|
152
|
+
See [Provider request policies](../provider-request-policies.md).
|
|
153
|
+
|
|
142
154
|
## Security and performance notes
|
|
143
155
|
|
|
144
156
|
- SSE streams and HTTP error bodies use bounded `@arnilo/prism/providers/transport`
|
|
@@ -153,6 +165,10 @@ await session.prompt("Plan the refactor", {
|
|
|
153
165
|
- Live tests stay opt-in behind `PRISM_LIVE_PROVIDER_TESTS=1` plus `ZAI_API_KEY`;
|
|
154
166
|
default tests are network-free.
|
|
155
167
|
|
|
168
|
+
## Thinking and reasoning
|
|
169
|
+
|
|
170
|
+
Z.AI models are family-stamped by id. GLM-5.3/5.3-FLASH: `reasoning_effort` restricted to `low/high/max` (declared; other levels snap, e.g. `medium`→`high`), and thinking can never be disabled — `zaiThinking` forces thinking on and never emits `thinking.type: "disabled"` (upstream rejects it; live-pinned). GLM-5.2: declared `low`–`max`; `none`/`minimal` stop thinking (no effort field), `low`/`medium` snap up to `high`. GLM-4.x and older: `thinking_type` toggle only (`clear_thinking` package-local). See [Thinking and reasoning](../thinking-and-reasoning.md).
|
|
171
|
+
|
|
156
172
|
## Related APIs
|
|
157
173
|
|
|
158
174
|
- [Provider packages](../provider-packages.md): `defineProviderPackage`,
|
package/docs/public-contracts.md
CHANGED
|
@@ -522,4 +522,4 @@ with 0.0.28 (no migration) and the `0.0.17 → 0.1.0` upgrade matrix in
|
|
|
522
522
|
- `@arnilo/prism/providers/transport`: bounded SSE/event parsing, bounded HTTP error-body reads, and JSON-object tool-argument parsing for provider packages.
|
|
523
523
|
- `@arnilo/prism/providers/openai`: OpenAI Chat Completions message/tool serialization, usage mapping, and indexed message validation helpers.
|
|
524
524
|
|
|
525
|
-
Phase 10 public helpers include `createStaticSettingsProvider`, `createChainedSettingsProvider`, `createMemoryCredentialStore`, `createChainedCredentialResolver`, `createStaticTrustPolicy`, `assertTrusted`, `createStaticPermissionPolicy`, `assertPermission`, and `createSecretRedactor`. Phase 11 auth/request/prompt helpers include `createExplicitCredentialResolver`, `createEnvCredentialResolver`, `refreshOAuthCredential`, `createProviderRequestPolicyChain`, `createSessionCachePolicy`, `mergeProviderRequestOptions`, `composeSystemPrompt`, and `mergeSystemPromptConfig`; 0.0.16 adds `resolveRedactor(redactor?, secrets?)`, which resolves the active redactor from an explicit redactor plus known secret values (the single survivor of the former per-package copies). They do not read env vars, persist OAuth tokens, create cache stores, discover prompt files, or load packages unless the host supplies that behavior. `@arnilo/prism/testing/provider-conformance` exports network-free provider assertion helpers. Node subpaths `@arnilo/prism/node/settings` and `@arnilo/prism/node/trust` are explicit filesystem/path helpers.
|
|
525
|
+
Phase 10 public helpers include `createStaticSettingsProvider`, `createChainedSettingsProvider`, `createMemoryCredentialStore`, `createChainedCredentialResolver`, `createStaticTrustPolicy`, `assertTrusted`, `createStaticPermissionPolicy`, `assertPermission`, and `createSecretRedactor`. Phase 11 auth/request/prompt helpers include `createExplicitCredentialResolver`, `createEnvCredentialResolver`, `refreshOAuthCredential`, `createProviderRequestPolicyChain`, `createSessionCachePolicy`, `applyDefaultProviderRequestOptions`, `ProviderRequirementError`, `mergeProviderRequestOptions`, `composeSystemPrompt`, and `mergeSystemPromptConfig`; 0.0.16 adds `resolveRedactor(redactor?, secrets?)`, which resolves the active redactor from an explicit redactor plus known secret values (the single survivor of the former per-package copies). They do not read env vars, persist OAuth tokens, create cache stores, discover prompt files, or load packages unless the host supplies that behavior. `@arnilo/prism/testing/provider-conformance` exports network-free provider assertion helpers. Node subpaths `@arnilo/prism/node/settings` and `@arnilo/prism/node/trust` are explicit filesystem/path helpers.
|