@arnilo/prism 0.2.7 → 0.2.8
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 +6 -1
- package/README.md +2 -2
- package/dist/agent-loops.js +4 -0
- package/dist/agent-run-lifecycle.js +2 -2
- package/dist/agent-session/helpers.d.ts +1 -1
- package/dist/agent-session/helpers.js +2 -1
- package/dist/agent-session/session.d.ts +1 -1
- package/dist/agent-session/session.js +28 -20
- package/dist/agent-session.d.ts +1 -1
- package/dist/agent-session.js +1 -1
- package/dist/agents.d.ts +1 -1
- package/dist/agents.js +1 -1
- package/dist/contracts-core/agent.d.ts +5 -5
- package/dist/contracts-core/agent.js +2 -0
- package/dist/contracts-core/extensions.d.ts +3 -3
- package/dist/contracts-core/extensions.js +2 -0
- package/dist/contracts-core/loop.d.ts +6 -1
- package/dist/contracts-core/session.d.ts +1 -1
- package/dist/contracts-core.d.ts +6 -6
- package/dist/contracts-core.js +6 -6
- package/dist/contracts-protocol.d.ts +8 -2
- package/dist/contracts.d.ts +1 -1
- package/dist/contracts.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +5 -5
- package/dist/input.js +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1 -1
- package/docs/0.1.0-readiness.md +7 -7
- package/docs/acp-agent.md +78 -0
- package/docs/acp.md +21 -10
- package/docs/ag-ui.md +1 -1
- package/docs/agent-definitions.md +1 -1
- package/docs/agent-events.md +2 -2
- package/docs/agent-loops.md +2 -2
- package/docs/coding-agent-tools.md +3 -1
- package/docs/coding-security.md +6 -0
- package/docs/index.md +3 -2
- package/docs/migration.md +14 -0
- package/docs/release-and-install.md +29 -8
- package/docs/structured-output.md +10 -10
- package/package.json +3 -2
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
Structured output in Prism is the `Artifact*` contract seam: a host-defined type `T` threaded through host-supplied `parser` → `validator` → `repairer` callbacks inside the `generateValidateReviseLoop` agent loop. Prism never instantiates `T`. The only way to get typed output from a loop is `ArtifactParser<T>`; Prism has no `WorkflowStep`/`NodeSchema
|
|
5
|
+
Structured output in Prism is the `Artifact*` contract seam: a host-defined type `T` threaded through host-supplied `parser` → `validator` → `repairer` callbacks inside the `generateValidateReviseLoop` agent loop. Prism never instantiates `T`. The only way to get typed output from a loop is `ArtifactParser<T>`; Prism has no `WorkflowStep`/`NodeSchema`/host-domain types and no domain control-flow vocabulary — the seam is generic over an opaque host `T`.
|
|
6
6
|
|
|
7
7
|
An artifact loop generates provider text, parses it to `T`, validates `T` against a host schema, and on validation failure runs a repairer to build a follow-up input that asks the model to fix the artifact — repeating up to `maxRevisions` times. The result of every validation and the terminal `artifact_finished`/`artifact_failed` outcomes are observable through `AgentEvent` artifact variants.
|
|
8
8
|
|
|
9
9
|
## When to use it
|
|
10
10
|
|
|
11
|
-
Use `generateValidateReviseLoop` (with host `parser`/`validator`/`repairer`) when a run should produce an artifact that must satisfy a host-owned schema before it is considered complete: structured JSON output, a generated file passing lint, a typed response conforming to a
|
|
11
|
+
Use `generateValidateReviseLoop` (with host `parser`/`validator`/`repairer`) when a run should produce an artifact that must satisfy a host-owned schema before it is considered complete: structured JSON output, a generated file passing lint, a typed response conforming to a host-defined model. Wrap your existing schema/validation library behind the `Artifact*` callbacks.
|
|
12
12
|
|
|
13
13
|
When the model declares `capabilities.structuredOutput` and the host opts into native mode, pass `structuredOutput` on `RunOptions.providerOptions` or on the `generate-validate-revise` loop options so capable providers map the schema to their wire format (`response_format` / Responses `text.format`) and valid output can finish in one turn without repair revisions.
|
|
14
14
|
|
|
15
|
-
Do not use it to re-implement provider calls, retry, abort, store, or event emission — those stay runtime-owned and are exposed to the loop only through `LoopContext`. Do not use it for runs that need tool calls during revision turns — use `singleShotLoop` or a custom `AgentLoopStrategy` instead. Do not put
|
|
15
|
+
Do not use it to re-implement provider calls, retry, abort, store, or event emission — those stay runtime-owned and are exposed to the loop only through `LoopContext`. Do not use it for runs that need tool calls during revision turns — use `singleShotLoop` or a custom `AgentLoopStrategy` instead. Do not put host domain types into Prism; map them to `ArtifactValidation` in your callbacks.
|
|
16
16
|
|
|
17
17
|
## Inputs / request
|
|
18
18
|
|
|
@@ -90,7 +90,7 @@ See [Agent events § Artifact event ordering](agent-events.md#artifact-event-ord
|
|
|
90
90
|
|
|
91
91
|
## Implementation example
|
|
92
92
|
|
|
93
|
-
A
|
|
93
|
+
A host maps its own schema to `ArtifactValidation` via the callbacks — no host type is imported by Prism:
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
96
|
import {
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
type ArtifactRepairer,
|
|
105
105
|
} from "@arnilo/prism";
|
|
106
106
|
|
|
107
|
-
// Host owns this schema (
|
|
107
|
+
// Host owns this schema (the host's own type). Prism never imports it.
|
|
108
108
|
interface ReleaseNote { readonly title: string; readonly body: string }
|
|
109
109
|
|
|
110
110
|
const parser: ArtifactParser<ReleaseNote> = (text) => {
|
|
@@ -143,7 +143,7 @@ await agent.createSession().run("Produce the JSON release note.", {
|
|
|
143
143
|
|
|
144
144
|
## End-to-end third-party integration
|
|
145
145
|
|
|
146
|
-
A third-party host
|
|
146
|
+
A third-party host can mix first-party and own providers, register tools, select skills, load `AGENTS.md`/`SYSTEM.md`, and opt a run into the artifact loop — all without importing any host-domain types into Prism and without any `workflow`/`node`/`step` vocabulary in the core contracts.
|
|
147
147
|
|
|
148
148
|
```ts
|
|
149
149
|
import {
|
|
@@ -160,7 +160,7 @@ import {
|
|
|
160
160
|
} from "@arnilo/prism";
|
|
161
161
|
import { loadSystemPromptFiles } from "@arnilo/prism/node/system-prompts";
|
|
162
162
|
|
|
163
|
-
// Host-owned schema (
|
|
163
|
+
// Host-owned schema (the host's own type). Prism never imports it.
|
|
164
164
|
interface ReleaseNote { readonly title: string; readonly body: string }
|
|
165
165
|
|
|
166
166
|
// Map the host schema to ArtifactValidation. The callbacks are generic at the
|
|
@@ -229,7 +229,7 @@ Key cross-seam points:
|
|
|
229
229
|
- `systemPrompt` is loaded from `AGENTS.md`/`SYSTEM.md` via the Node loader; the runtime itself is file-name agnostic. See [System prompts](system-prompts.md).
|
|
230
230
|
- The `validator`/`parser`/`repairer` callbacks are typed as `Artifact*<unknown>` at the loop boundary; the host's `ReleaseNote` type is cast inside the callback body. Prism threads an opaque value and never instantiates it.
|
|
231
231
|
- Every `artifact_*` event payload is redacted through the active `SecretRedactor`, so secrets echoed in `errors[].message` or `metadata` are scrubbed before subscribers see them. See [Credentials and redaction](credentials-and-redaction.md).
|
|
232
|
-
- For a runnable, network-free version that also demonstrates tool dispatch and redaction, see [`examples/
|
|
232
|
+
- For a runnable, network-free version that also demonstrates tool dispatch and redaction, see [`examples/host-artifact-loop.ts`](../examples/host-artifact-loop.ts).
|
|
233
233
|
|
|
234
234
|
## Extension and configuration notes
|
|
235
235
|
|
|
@@ -244,8 +244,8 @@ Key cross-seam points:
|
|
|
244
244
|
|
|
245
245
|
## Security and performance notes
|
|
246
246
|
|
|
247
|
-
- Prism never instantiates `T`; it only threads the host-supplied value through parser→validator→repairer. No
|
|
248
|
-
- Boundary lock: `src/` imports no
|
|
247
|
+
- Prism never instantiates `T`; it only threads the host-supplied value through parser→validator→repairer. No host type is imported by `src/`.
|
|
248
|
+
- Boundary lock: `src/` imports no host-domain package, and the `Artifact*` / `AgentLoop*` / `LoopContext` contract field names contain no `workflow`/`node`/`step` domain vocabulary. Hosts map their own schema names to `ArtifactValidation.errors[].path`.
|
|
249
249
|
- `ArtifactValidation.errors[].message` and `metadata` may echo model text; every `artifact_*` event payload is redacted through `redactAgentEvent` / the active `SecretRedactor`. The generic walker handles nested objects/arrays and replaces cyclic references with `"[Circular]"` without throwing.
|
|
250
250
|
- A run makes at most `maxRevisions + 1` provider turns; it cannot loop forever on an always-failing validator. Each revision costs one provider turn plus one store append.
|
|
251
251
|
- No new dependency is required to use structured output — host callbacks wrap whatever schema/validation library the host already uses.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arnilo/prism",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Agent harness for AI providers, agents, sessions, and tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -138,6 +138,7 @@
|
|
|
138
138
|
"packages/enterprise-postgres",
|
|
139
139
|
"packages/browser",
|
|
140
140
|
"packages/ag-ui",
|
|
141
|
+
"packages/acp-agent",
|
|
141
142
|
"packages/document-reader",
|
|
142
143
|
"packages/prism-*"
|
|
143
144
|
],
|
|
@@ -160,7 +161,7 @@
|
|
|
160
161
|
"release:publish": "node scripts/release.mjs publish",
|
|
161
162
|
"release:evidence": "node scripts/release-skip-manifest.mjs",
|
|
162
163
|
"sdk:ready": "npm run typecheck && npm run lint && npm run format:check && npm test && npm run test:coverage && npm run pack:dry-run && npm run release:gate",
|
|
163
|
-
"release:gate": "node scripts/release-skip-manifest.mjs && node scripts/release.mjs gate",
|
|
164
|
+
"release:gate": "node scripts/release-skip-manifest.mjs && node scripts/check-client-neutrality.mjs && node scripts/release.mjs gate",
|
|
164
165
|
"security:threat-suites": "node --test scripts/phase8-conformance.test.mjs scripts/phase9-conformance.test.mjs scripts/phase10-conformance.test.mjs scripts/phase11-conformance.test.mjs scripts/phase20-security.test.mjs scripts/phase21-security.test.mjs scripts/phase22-security.test.mjs scripts/phase23-security.test.mjs"
|
|
165
166
|
},
|
|
166
167
|
"devDependencies": {
|