@arnilo/prism 0.5.0 → 0.5.2

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +10 -10
  3. package/dist/agent-session/session/provider-round.js +17 -1
  4. package/dist/agent-session/session.js +13 -3
  5. package/dist/contracts-core/agent.d.ts +2 -0
  6. package/dist/contracts-protocol.d.ts +2 -0
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +2 -2
  9. package/dist/input.js +3 -2
  10. package/dist/provider-request-policy.d.ts +15 -0
  11. package/dist/provider-request-policy.js +52 -0
  12. package/dist/providers/openai-primitives.js +1 -1
  13. package/docs/0.1.0-readiness.md +2 -2
  14. package/docs/agent-session-runtime.md +2 -1
  15. package/docs/compaction-llm.md +2 -0
  16. package/docs/compaction-observational-memory.md +3 -0
  17. package/docs/index.md +21 -19
  18. package/docs/input-and-prompt-assembly.md +1 -1
  19. package/docs/migrate-to-0.5.md +25 -3
  20. package/docs/migration.md +8 -0
  21. package/docs/provider-caching.md +4 -2
  22. package/docs/provider-packages.md +30 -34
  23. package/docs/provider-request-policies.md +18 -5
  24. package/docs/providers/ai-sdk.md +12 -0
  25. package/docs/providers/alibaba.md +12 -0
  26. package/docs/providers/anthropic.md +12 -0
  27. package/docs/providers/azure.md +12 -0
  28. package/docs/providers/bedrock.md +12 -0
  29. package/docs/providers/clinepass.md +12 -0
  30. package/docs/providers/commandcode.md +12 -0
  31. package/docs/providers/deepseek.md +12 -0
  32. package/docs/providers/google.md +12 -0
  33. package/docs/providers/hyper.md +12 -0
  34. package/docs/providers/kimi.md +12 -0
  35. package/docs/providers/neuralwatt.md +12 -0
  36. package/docs/providers/ollama.md +12 -0
  37. package/docs/providers/openai-compatible.md +12 -0
  38. package/docs/providers/openai.md +12 -0
  39. package/docs/providers/opencode-go.md +12 -0
  40. package/docs/providers/openrouter.md +12 -0
  41. package/docs/providers/vertex.md +12 -0
  42. package/docs/providers/xai.md +12 -0
  43. package/docs/providers/zai.md +12 -0
  44. package/docs/public-contracts.md +1 -1
  45. package/docs/release-and-install.md +37 -37
  46. package/docs/thinking-and-reasoning.md +13 -8
  47. package/docs/use-case-model-selection.md +1 -1
  48. package/package.json +1 -1
@@ -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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## What it does
4
4
 
5
- Prism's current **0.5.x** line has **10 publishable manifests**: the root `@arnilo/prism` core package plus **9 workspace packages** — **19 provider adapters** (19 provider adapter subpaths inside the `@arnilo/prism-providers` family), 3 `prism-*` family/profile packages, and 6 capability packages. (Generated by `node scripts/package-truth.mjs` → `scripts/package-truth.json` — the manifest-derived single source for counts, provider membership, umbrella closures, and profile closures.) The last lockstep cut was 0.3.0; Decision B now publishes changed packages independently inside `^0.3.0` — the plan 039 changed-package cut moved root `@arnilo/prism` and every plan-035+ changed package to **0.3.1**, and the plan 050 changed-package cut moved root plus four changed packages to **0.3.2**; the plan 041-044 changed-package cut moves root to **0.3.3** with `@arnilo/prism-memory@0.3.2` (composite recall scoring), `@arnilo/prism-evals@0.3.1` (trace-to-dataset curation), the three session-store packages at **0.3.1** (run-ledger `promptVersion` provenance), and the initial `@arnilo/prism-prompts@0.0.1` (independent opt-in, outside `prism-all`); plan 054 consolidation then folded `@arnilo/prism-browser` and `@arnilo/prism-obscura` into the `@arnilo/prism-web-tools` family as `/browser` and `/obscura` subpaths, folded `@arnilo/prism-rag`, both compaction strategies, `@arnilo/prism-graft`, and `@arnilo/prism-wiki` into the `@arnilo/prism-memory` family as `/rag`, `/compaction/llm`, `/compaction/observational-memory`, `/graft`, and `/wiki` subpaths (deleting the `@arnilo/prism-compaction` profile), and folded all 17 `@arnilo/prism-provider-*` packages into the `@arnilo/prism-providers` family as `/<adapter>` subpaths (Azure/Bedrock/Vertex stop being special all-only manifests); independent publication continues inside `^0.3.0` ranges (which satisfy 0.3.1, 0.3.2, and 0.3.3). This page describes how they are packed, what each tarball contains, how to install them, the required non-optional **caret** `@arnilo/prism@^0.5.0` peer range, the release workflow, and the offline test budget. The measurable 1.0 readiness gates (command-per-gate) live in [`0.1.0-readiness.md`](./0.1.0-readiness.md).
5
+ Prism's current **0.5.x** line has **10 publishable manifests**: the root `@arnilo/prism` core package plus **9 workspace packages** — **19 provider adapters** (19 provider adapter subpaths inside the `@arnilo/prism-providers` family), 3 `prism-*` family/profile packages, and 6 capability packages. (Generated by `node scripts/package-truth.mjs` → `scripts/package-truth.json` — the manifest-derived single source for counts, provider membership, umbrella closures, and profile closures.) The last lockstep cut was 0.3.0; Decision B now publishes changed packages independently inside `^0.3.0` — the plan 039 changed-package cut moved root `@arnilo/prism` and every plan-035+ changed package to **0.3.1**, and the plan 050 changed-package cut moved root plus four changed packages to **0.3.2**; the plan 041-044 changed-package cut moves root to **0.3.3** with `@arnilo/prism-memory@0.3.2` (composite recall scoring), `@arnilo/prism-evals@0.3.1` (trace-to-dataset curation), the three session-store packages at **0.3.1** (run-ledger `promptVersion` provenance), and the initial `@arnilo/prism-prompts@0.0.1` (independent opt-in, outside `prism-all`); plan 054 consolidation then folded `@arnilo/prism-browser` and `@arnilo/prism-obscura` into the `@arnilo/prism-web-tools` family as `/browser` and `/obscura` subpaths, folded `@arnilo/prism-rag`, both compaction strategies, `@arnilo/prism-graft`, and `@arnilo/prism-wiki` into the `@arnilo/prism-memory` family as `/rag`, `/compaction/llm`, `/compaction/observational-memory`, `/graft`, and `/wiki` subpaths (deleting the `@arnilo/prism-compaction` profile), and folded all 17 `@arnilo/prism-provider-*` packages into the `@arnilo/prism-providers` family as `/<adapter>` subpaths (Azure/Bedrock/Vertex stop being special all-only manifests); independent publication continues inside `^0.3.0` ranges (which satisfy 0.3.1, 0.3.2, and 0.3.3). This page describes how they are packed, what each tarball contains, how to install them, the required non-optional **caret** `@arnilo/prism@^0.5.2` peer range, the release workflow, and the offline test budget. The measurable 1.0 readiness gates (command-per-gate) live in [`0.1.0-readiness.md`](./0.1.0-readiness.md).
6
6
 
7
7
  Core `@arnilo/prism` ships runtime, CLI, templates, and docs. Every code package has a required `@arnilo/prism` peer inside the Decision B window — the caret current spec is `@arnilo/prism@^0.3.3` and every declared window peer satisfies it: packages republishing in the plan 050 cut carry `^0.3.2`; the plan 039 set keeps `^0.3.1`; unchanged packages keep their `^0.3.0` peer; profiles are pure manifests. The plan 050 republished set declares the required `@arnilo/prism@^0.3.2` peer; the plan 041-044 republished set keeps its existing `^0.3.0` window peer; unchanged packages keep their prior window. Installation activates no provider, listener, database, browser, credential, or tool capability.
8
8
 
@@ -11,16 +11,16 @@ Core `@arnilo/prism` ships runtime, CLI, templates, and docs. Every code package
11
11
 
12
12
  | package | version | notes |
13
13
  | --- | --- | --- |
14
- | `@arnilo/prism` | 0.5.0 | core — runtime, CLI/RPC, templates, docs |
15
- | `@arnilo/prism-coding-tools` | 0.5.0 | family — /agent, /security, /document-reader, /openapi, /computer-use-linux, /dev, /caveman, /ponytail, /impeccable subpaths |
16
- | `@arnilo/prism-core` | 0.5.0 | family — /runtime, /sessions, /governance, /credentials, /enterprise, /work, /validation subpaths |
17
- | `@arnilo/prism-providers` | 0.5.0 | family — all provider adapters as `/<adapter>` subpaths |
18
- | `@arnilo/prism-acp-agent` | 0.5.0 | capability — ACP adapter |
19
- | `@arnilo/prism-ag-ui` | 0.5.0 | capability — AG-UI/A2A/A2UI adapter |
20
- | `@arnilo/prism-mcp` | 0.5.0 | capability — MCP client/server/OAuth interop |
21
- | `@arnilo/prism-memory` | 0.5.0 | capability — memory plus /rag, /compaction/*, /graft, /wiki subpaths |
22
- | `@arnilo/prism-office` | 0.5.0 | capability — /documents, /sheets, /diagrams subpaths |
23
- | `@arnilo/prism-web-tools` | 0.5.0 | capability — Brave/Exa/Firecrawl plus peer-gated /browser and /obscura subpaths |
14
+ | `@arnilo/prism` | 0.5.2 | core — runtime, CLI/RPC, templates, docs |
15
+ | `@arnilo/prism-coding-tools` | 0.5.2 | family — /agent, /security, /document-reader, /openapi, /computer-use-linux, /dev, /caveman, /ponytail, /impeccable subpaths |
16
+ | `@arnilo/prism-core` | 0.5.2 | family — /runtime, /sessions, /governance, /credentials, /enterprise, /work, /validation subpaths |
17
+ | `@arnilo/prism-providers` | 0.5.2 | family — all provider adapters as `/<adapter>` subpaths |
18
+ | `@arnilo/prism-acp-agent` | 0.5.2 | capability — ACP adapter |
19
+ | `@arnilo/prism-ag-ui` | 0.5.2 | capability — AG-UI/A2A/A2UI adapter |
20
+ | `@arnilo/prism-mcp` | 0.5.2 | capability — MCP client/server/OAuth interop |
21
+ | `@arnilo/prism-memory` | 0.5.2 | capability — memory plus /rag, /compaction/*, /graft, /wiki subpaths |
22
+ | `@arnilo/prism-office` | 0.5.2 | capability — /documents, /sheets, /diagrams subpaths |
23
+ | `@arnilo/prism-web-tools` | 0.5.2 | capability — Brave/Exa/Firecrawl plus peer-gated /browser and /obscura subpaths |
24
24
  <!-- generated:package-truth:inventory end -->
25
25
 
26
26
 
@@ -29,26 +29,26 @@ Core `@arnilo/prism` ships runtime, CLI, templates, and docs. Every code package
29
29
 
30
30
  | adapter package | version |
31
31
  | --- | --- |
32
- | `@arnilo/prism-providers/ai-sdk` | 0.5.0 |
33
- | `@arnilo/prism-providers/alibaba` | 0.5.0 |
34
- | `@arnilo/prism-providers/anthropic` | 0.5.0 |
35
- | `@arnilo/prism-providers/azure` | 0.5.0 |
36
- | `@arnilo/prism-providers/bedrock` | 0.5.0 |
37
- | `@arnilo/prism-providers/clinepass` | 0.5.0 |
38
- | `@arnilo/prism-providers/commandcode` | 0.5.0 |
39
- | `@arnilo/prism-providers/deepseek` | 0.5.0 |
40
- | `@arnilo/prism-providers/google` | 0.5.0 |
41
- | `@arnilo/prism-providers/hyper` | 0.5.0 |
42
- | `@arnilo/prism-providers/kimi` | 0.5.0 |
43
- | `@arnilo/prism-providers/model-discovery` | 0.5.0 |
44
- | `@arnilo/prism-providers/neuralwatt` | 0.5.0 |
45
- | `@arnilo/prism-providers/ollama` | 0.5.0 |
46
- | `@arnilo/prism-providers/openai` | 0.5.0 |
47
- | `@arnilo/prism-providers/opencode-go` | 0.5.0 |
48
- | `@arnilo/prism-providers/openrouter` | 0.5.0 |
49
- | `@arnilo/prism-providers/vertex` | 0.5.0 |
50
- | `@arnilo/prism-providers/xai` | 0.5.0 |
51
- | `@arnilo/prism-providers/zai` | 0.5.0 |
32
+ | `@arnilo/prism-providers/ai-sdk` | 0.5.2 |
33
+ | `@arnilo/prism-providers/alibaba` | 0.5.2 |
34
+ | `@arnilo/prism-providers/anthropic` | 0.5.2 |
35
+ | `@arnilo/prism-providers/azure` | 0.5.2 |
36
+ | `@arnilo/prism-providers/bedrock` | 0.5.2 |
37
+ | `@arnilo/prism-providers/clinepass` | 0.5.2 |
38
+ | `@arnilo/prism-providers/commandcode` | 0.5.2 |
39
+ | `@arnilo/prism-providers/deepseek` | 0.5.2 |
40
+ | `@arnilo/prism-providers/google` | 0.5.2 |
41
+ | `@arnilo/prism-providers/hyper` | 0.5.2 |
42
+ | `@arnilo/prism-providers/kimi` | 0.5.2 |
43
+ | `@arnilo/prism-providers/model-discovery` | 0.5.2 |
44
+ | `@arnilo/prism-providers/neuralwatt` | 0.5.2 |
45
+ | `@arnilo/prism-providers/ollama` | 0.5.2 |
46
+ | `@arnilo/prism-providers/openai` | 0.5.2 |
47
+ | `@arnilo/prism-providers/opencode-go` | 0.5.2 |
48
+ | `@arnilo/prism-providers/openrouter` | 0.5.2 |
49
+ | `@arnilo/prism-providers/vertex` | 0.5.2 |
50
+ | `@arnilo/prism-providers/xai` | 0.5.2 |
51
+ | `@arnilo/prism-providers/zai` | 0.5.2 |
52
52
  <!-- generated:package-truth:providers end -->
53
53
 
54
54
 
@@ -137,7 +137,7 @@ A packed tarball contains only public compiled output and release files:
137
137
  - Code packages ship `README.md`, `LICENSE`, and `CHANGELOG.md`; family/profile packages ship `README.md` and `CHANGELOG.md`.
138
138
  - The core tarball additionally ships the full `docs/` directory (the docs hub), `templates/init/`, and the `templates/` gallery (e.g. `deep-research`) used by `prism init`.
139
139
  - `dist/cli.js` and the `bin` link in core.
140
- - **Tarball filenames.** npm strips the `@scope/` prefix, so the core package `@arnilo/prism` produces a tarball named `arnilo-prism-0.5.0.tgz`; family packages produce `arnilo-prism-core-0.5.0.tgz`, `arnilo-prism-coding-tools-0.5.0.tgz`, `arnilo-prism-providers-0.5.0.tgz` (all 19 adapters inside), `arnilo-prism-memory-0.5.0.tgz`, `arnilo-prism-web-tools-0.5.0.tgz`, and `arnilo-prism-office-0.5.0.tgz`; capability packages like `arnilo-prism-mcp-0.5.0.tgz` carry their own package version. Independent-package tags carry their own version. The CLI bin name `prism` is unaffected by the package name (`npx prism` still works; npm allows the bin field to differ from the package name).
140
+ - **Tarball filenames.** npm strips the `@scope/` prefix, so the core package `@arnilo/prism` produces a tarball named `arnilo-prism-0.5.2.tgz`; family packages produce `arnilo-prism-core-0.5.2.tgz`, `arnilo-prism-coding-tools-0.5.2.tgz`, `arnilo-prism-providers-0.5.2.tgz` (all 19 adapters inside), `arnilo-prism-memory-0.5.2.tgz`, `arnilo-prism-web-tools-0.5.2.tgz`, and `arnilo-prism-office-0.5.2.tgz`; capability packages like `arnilo-prism-mcp-0.5.2.tgz` carry their own package version. Independent-package tags carry their own version. The CLI bin name `prism` is unaffected by the package name (`npx prism` still works; npm allows the bin field to differ from the package name).
141
141
 
142
142
  Excluded from every tarball by `files` negation:
143
143
 
@@ -157,9 +157,9 @@ Excluded from every tarball by `files` negation:
157
157
  "name": "host-app",
158
158
  "type": "module",
159
159
  "dependencies": {
160
- "@arnilo/prism": "^0.5.0",
161
- "@arnilo/prism-core": "^0.5.0",
162
- "@arnilo/prism-providers/openai": "^0.5.0"
160
+ "@arnilo/prism": "^0.5.1",
161
+ "@arnilo/prism-core": "^0.5.1",
162
+ "@arnilo/prism-providers/openai": "^0.5.1"
163
163
  }
164
164
  }
165
165
  ```
@@ -169,7 +169,7 @@ Installing the provider/compaction packages without `@arnilo/prism` present prod
169
169
  ```text
170
170
  npm error code ERESOLVE
171
171
  npm error Could not resolve dependency:
172
- npm error peer @arnilo/prism@"^0.5.0" from @arnilo/prism-providers/openai@0.5.0
172
+ npm error peer @arnilo/prism@"^0.5.1" from @arnilo/prism-providers/openai@0.5.1
173
173
  ```
174
174
 
175
175
  ## Implementation example
@@ -1042,7 +1042,7 @@ Audit fixes, dependency updates, and security patches land only for the supporte
1042
1042
 
1043
1043
  ## Security and performance notes
1044
1044
 
1045
- - **Export-count budget.** `scripts/budget-gate.test.mjs` counts each publishable package's public exports (same name classes as `scripts/dead-exports.mjs`) and fails CI when any exceed the `exportCounts` ceilings in `scripts/budgets.json` (plan 058 post-0.5.0-cut baselines); the failure names the package and the exact delta. Growth requires removing exports or rebaselining with a recorded reason.
1045
+ - **Export-count budget.** `scripts/budget-gate.test.mjs` counts each publishable package's public exports (same name classes as `scripts/dead-exports.mjs`) and fails CI when any exceed the `exportCounts` ceilings in `scripts/budgets.json` (plan 066 post-0.5.1-cut baselines); the failure names the package and the exact delta. Growth requires removing exports or rebaselining with a recorded reason.
1046
1046
  - **No secrets or fixtures in tarballs.** Tests, fixtures, `src/`, `plans/`, `.agents/`, `roadmap.md`, and `tsconfig` files are excluded. The `docs avoid real-looking secret examples` docs check and the packaging guard's deny list prevent secret-bearing fixtures from shipping.
1047
1047
  - **Live tests stay opt-in.** The default `npm test` is network-free by construction and never sets these vars. Provider/compaction live gates stay credential-gated and are not set by default or during `sdk:ready`. The PostgreSQL adapter live matrix is the exception that runs in CI via the dedicated `postgres-integration` job (still skipped in the default suite).
1048
1048
  - `PRISM_LIVE_PROVIDER_TESTS=1` — gates the eight provider packages' `src/__tests__/live.test.ts` (`@arnilo/prism-providers/anthropic`, `provider-google`, `provider-openai`, `provider-opencode-go`, `provider-openrouter`, `provider-zai`, `provider-kimi`, `provider-neuralwatt`). Each provider live test also requires its own API key env var and skips safely when it is missing:
@@ -2,12 +2,13 @@
2
2
 
3
3
  ## What it does
4
4
 
5
- Prism gives hosts one portable way to set thinking/reasoning effort per model and per turn, and guarantees the level actually reaches the wire on every provider Prism ships. The single entry point is **`applyThinkingLevelForModel`**: it resolves the model's compat family, snaps the requested level to the model's **declared levels** (`capabilities.thinkingLevels`), and merges the family's compat patch into your base options. Every first-party provider catalog stamps the family and declares the per-model level set; provider resolvers translate the patch into official wire fields. Model defaults live on `ModelConfig.compat`; per-turn overrides live on `ProviderRequestOptions.compat` and win through the existing `mergeProviderRequestOptions` merge.
5
+ Prism gives hosts one portable way to set thinking/reasoning effort per model and per turn, and guarantees the level actually reaches the wire on every provider Prism ships. **Session entry point:** `AgentConfig.thinkingLevel` / `RunOptions.thinkingLevel` (run overrides agent). The kernel passes that string through **`applyThinkingLevelForModel`**, which resolves the model's compat family, snaps the requested level to the model's **declared levels** (`capabilities.thinkingLevels`), and merges the family's compat patch into already-merged host `providerOptions`. Use `applyThinkingLevelForModel` directly only on custom `provider.generate` sites. Every first-party provider catalog stamps the family and declares the per-model level set; provider resolvers translate the patch into official wire fields. Model defaults live on `ModelConfig.compat`; per-turn overrides live on `ProviderRequestOptions.compat` and win through the existing `mergeProviderRequestOptions` merge. Omitted `thinkingLevel` invents no compat on non-reasoning / `noop` models.
6
6
 
7
7
  ## When to use it
8
8
 
9
- - Session runs: pass `providerOptions` from `applyThinkingLevelForModel` on `RunOptions` — one call, no per-provider branching.
9
+ - Session runs: `createAgent({ thinkingLevel: "low" })` or `session.run(input, { thinkingLevel: "high" })` — no per-provider branching, no hand-merged `providerOptions.compat`.
10
10
  - Use-case workers (LLM compaction, observational memory): pass `thinkingLevel`; workers call `applyThinkingLevelForModel` with the bound model.
11
+ - Custom generate sites: wrap with `applyDefaultProviderRequestOptions(request, { sessionId, thinkingLevel })` or call `applyThinkingLevelForModel` yourself.
11
12
  - Hosts building UI: read `model.capabilities.thinkingLevels` (when declared) to render a legal level picker; `isSupportedThinkingLevel` tells you whether a value is declared before sending.
12
13
  - Provider authors: read official wire fields from the compat patches below; keep unique knobs package-local.
13
14
 
@@ -32,12 +33,15 @@ Returns the merged `ProviderRequestOptions` (a new object when a patch applies;
32
33
  ## Implementation example
33
34
 
34
35
  ```ts
35
- import { applyThinkingLevelForModel } from "@arnilo/prism";
36
+ import { applyThinkingLevelForModel, createAgent } from "@arnilo/prism";
36
37
 
37
- // Per-turn override on a session run
38
- await session.run(input, {
39
- providerOptions: applyThinkingLevelForModel(base, "high", model),
40
- });
38
+ const agent = createAgent({ model, provider, thinkingLevel: "low" });
39
+ const session = agent.createSession();
40
+ await session.run(input); // low
41
+ await session.run(input, { thinkingLevel: "high" }); // high this run
42
+
43
+ // Custom generate sites still use the helper
44
+ const options = applyThinkingLevelForModel(base, "high", model);
41
45
 
42
46
  // Declared-level-aware UI
43
47
  const levels = model.capabilities?.thinkingLevels; // e.g. ["low","medium","high","xhigh","max"]
@@ -47,7 +51,8 @@ const levels = model.capabilities?.thinkingLevels; // e.g. ["low","medium","high
47
51
 
48
52
  | Layer | Surface |
49
53
  | --- | --- |
50
- | Adapter (use this) | `applyThinkingLevelForModel(base, level, model)` — family resolution + snap + merge in one call |
54
+ | Session (use this) | `AgentConfig.thinkingLevel` / `RunOptions.thinkingLevel` — kernel snaps via `applyThinkingLevelForModel` |
55
+ | Adapter (custom generate) | `applyThinkingLevelForModel(base, level, model)` — family resolution + snap + merge in one call |
51
56
  | Model default | `ModelConfig.compat` (+ `capabilities.reasoning`, `capabilities.thinkingLevels` when declared) |
52
57
  | Per-turn override | `ProviderRequestOptions.compat` (request wins over model via merge) |
53
58
  | Portable level | `ThinkingLevel`: `none` \| `minimal` \| `low` \| `medium` \| `high` \| `xhigh` \| `max` |
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## What it does
4
4
 
5
- Prism separates the **session chat model** (`AgentConfig.model` / `RunOptions.model`) from **use-case models** used by background or adjacent LLM jobs (observational memory workers, LLM compaction summarizers, declarative agents, supervisor children, evals). Hosts bind `{ model?, provider?, providerOptions?, thinkingLevel? }` per use case. When the use-case omits `model`, resolution falls back to the active session model. Workers never write `model_change` session entries for their own jobs.
5
+ Prism separates the **session chat model** (`AgentConfig.model` / `RunOptions.model`) from **use-case models** used by background or adjacent LLM jobs (observational memory workers, LLM compaction summarizers, declarative agents, supervisor children, evals). Hosts bind `{ model?, provider?, providerOptions?, thinkingLevel? }` per use case. When the use-case omits `model`, resolution falls back to the active session model. Workers never write `model_change` session entries for their own jobs. Observational-memory workers stamp derived `om:{session.id}`; LLM compaction reuses the agent `sessionId` so summarization can hit the same prompt cache.
6
6
 
7
7
  ## When to use it
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arnilo/prism",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Agent harness for AI providers, agents, sessions, and tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",