@arnilo/prism 0.0.3 → 0.0.5
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 +40 -0
- package/README.md +62 -26
- package/dist/agent-loops.d.ts +8 -1
- package/dist/agent-loops.js +57 -11
- package/dist/agents.js +212 -32
- package/dist/checkpoints.d.ts +11 -0
- package/dist/checkpoints.js +144 -0
- package/dist/cli-init.d.ts +41 -0
- package/dist/cli-init.js +390 -0
- package/dist/cli-runner.d.ts +7 -1
- package/dist/cli-runner.js +13 -1
- package/dist/compaction.js +9 -1
- package/dist/content.d.ts +121 -0
- package/dist/content.js +538 -0
- package/dist/contracts.d.ts +236 -11
- package/dist/contracts.js +8 -0
- package/dist/event-multiplexer.d.ts +23 -0
- package/dist/event-multiplexer.js +136 -0
- package/dist/execution-policy.d.ts +28 -0
- package/dist/execution-policy.js +24 -0
- package/dist/feedback.d.ts +48 -0
- package/dist/feedback.js +230 -0
- package/dist/index.d.ts +20 -6
- package/dist/index.js +13 -5
- package/dist/input.js +11 -1
- package/dist/leases.d.ts +8 -0
- package/dist/leases.js +111 -0
- package/dist/node/agent-definitions.js +3 -5
- package/dist/node/config.d.ts +1 -0
- package/dist/node/config.js +5 -3
- package/dist/node/contribution-discovery.js +5 -8
- package/dist/node/session-store-jsonl.js +8 -5
- package/dist/node/settings.js +2 -2
- package/dist/node/trust.js +2 -4
- package/dist/observability.d.ts +3 -0
- package/dist/observability.js +18 -0
- package/dist/providers/media.d.ts +44 -0
- package/dist/providers/media.js +126 -0
- package/dist/providers/openai-compatible.js +18 -119
- package/dist/providers/openai-primitives.d.ts +9 -0
- package/dist/providers/openai-primitives.js +129 -0
- package/dist/providers/transport.d.ts +40 -0
- package/dist/providers/transport.js +221 -0
- package/dist/redaction.js +40 -13
- package/dist/resources.d.ts +5 -0
- package/dist/resources.js +4 -0
- package/dist/structured-output.d.ts +11 -0
- package/dist/structured-output.js +59 -0
- package/dist/testing/feedback.d.ts +6 -0
- package/dist/testing/feedback.js +37 -0
- package/dist/testing/persistence-schema.d.ts +102 -0
- package/dist/testing/persistence-schema.js +487 -0
- package/dist/testing/provider-conformance.js +10 -1
- package/dist/testing/run-ledger-conformance.d.ts +33 -0
- package/dist/testing/run-ledger-conformance.js +178 -0
- package/dist/testing/session-store-conformance.d.ts +16 -0
- package/dist/testing/session-store-conformance.js +73 -0
- package/dist/tools.d.ts +17 -0
- package/dist/tools.js +29 -2
- package/docs/a2a.md +73 -0
- package/docs/agent-events.md +17 -10
- package/docs/agent-loops.md +11 -5
- package/docs/agent-session-runtime.md +15 -16
- package/docs/cli-rpc.md +36 -5
- package/docs/coding-agent-tools.md +43 -9
- package/docs/coding-security.md +88 -0
- package/docs/compaction-observational-memory.md +2 -0
- package/docs/context-and-skills.md +1 -0
- package/docs/credential-storage.md +177 -0
- package/docs/credentials-and-redaction.md +4 -3
- package/docs/database-persistence.md +52 -7
- package/docs/evaluations.md +122 -0
- package/docs/extensions.md +2 -2
- package/docs/host-security.md +33 -2
- package/docs/index.md +46 -18
- package/docs/input-and-prompt-assembly.md +6 -5
- package/docs/mcp-tools.md +184 -0
- package/docs/middleware-hooks.md +2 -0
- package/docs/migration.md +51 -28
- package/docs/model-registry.md +5 -3
- package/docs/multimodal-content.md +156 -0
- package/docs/observability.md +171 -0
- package/docs/performance.md +249 -1
- package/docs/persistence-credentials-multimodality-primitives.md +303 -0
- package/docs/postgres-persistence.md +143 -0
- package/docs/provider-conformance.md +18 -0
- package/docs/provider-layer.md +1 -1
- package/docs/provider-packages.md +2 -0
- package/docs/provider-primitives.md +281 -0
- package/docs/providers/ai-sdk.md +113 -0
- package/docs/providers/kimi.md +1 -0
- package/docs/providers/neuralwatt.md +1 -0
- package/docs/providers/openai-compatible.md +2 -1
- package/docs/providers/openai.md +8 -1
- package/docs/providers/opencode-go.md +1 -0
- package/docs/providers/openrouter.md +1 -0
- package/docs/providers/zai.md +1 -0
- package/docs/public-contracts.md +13 -5
- package/docs/rag.md +113 -0
- package/docs/release-and-install.md +237 -30
- package/docs/resource-loading.md +14 -4
- package/docs/review-coverage-2026-07-14.md +260 -0
- package/docs/review-coverage-2026-07-15.md +193 -0
- package/docs/run-ledger-conformance.md +96 -0
- package/docs/runs-and-usage.md +43 -4
- package/docs/server.md +139 -0
- package/docs/session-store-conformance.md +16 -0
- package/docs/session-stores-and-branching.md +1 -0
- package/docs/settings-auth-trust-security.md +6 -5
- package/docs/sqlite-persistence.md +123 -0
- package/docs/structured-output.md +9 -0
- package/docs/supervisors.md +71 -0
- package/docs/tool-conformance.md +1 -0
- package/docs/tool-execution-primitives.md +374 -0
- package/docs/tools.md +39 -1
- package/docs/workflow-orchestration-primitives.md +581 -0
- package/docs/workflow-tui-primitives.md +5 -0
- package/docs/workflows.md +293 -0
- package/docs/working-and-semantic-memory.md +169 -0
- package/package.json +43 -5
- package/templates/init/README.md.tmpl +28 -0
- package/templates/init/env.example.tmpl +1 -0
- package/templates/init/gitignore.tmpl +11 -0
- package/templates/init/optional/evals-example.ts.tmpl +17 -0
- package/templates/init/optional/workflows-example.ts.tmpl +27 -0
- package/templates/init/package.json.tmpl +22 -0
- package/templates/init/providers.json +76 -0
- package/templates/init/src/agent.ts.tmpl +10 -0
- package/templates/init/src/index.ts.tmpl +12 -0
- package/templates/init/src/tests/agent.test.ts.tmpl +24 -0
- package/templates/init/tsconfig.json.tmpl +15 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mock": {
|
|
3
|
+
"id": "mock",
|
|
4
|
+
"modelProvider": "mock",
|
|
5
|
+
"modelName": "demo",
|
|
6
|
+
"imports": "import {\n createAgent,\n createMockProvider,\n providerDone,\n providerTextDelta,\n} from \"@arnilo/prism\";",
|
|
7
|
+
"providerExpression": "createMockProvider([\n providerTextDelta(\"Hello from Prism\"),\n providerDone(),\n ])",
|
|
8
|
+
"modelExpression": "{ provider: \"mock\", model: \"demo\" }"
|
|
9
|
+
},
|
|
10
|
+
"openai": {
|
|
11
|
+
"id": "openai",
|
|
12
|
+
"packageName": "@arnilo/prism-provider-openai",
|
|
13
|
+
"envKey": "OPENAI_API_KEY",
|
|
14
|
+
"envPlaceholder": "sk-...",
|
|
15
|
+
"modelProvider": "openai",
|
|
16
|
+
"modelName": "gpt-5.1",
|
|
17
|
+
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createOpenAIResponsesProvider } from \"@arnilo/prism-provider-openai\";",
|
|
18
|
+
"providerExpression": "createOpenAIResponsesProvider({\n apiKey: () => process.env.OPENAI_API_KEY,\n })",
|
|
19
|
+
"modelExpression": "{ provider: \"openai\", model: \"gpt-5.1\" }"
|
|
20
|
+
},
|
|
21
|
+
"openrouter": {
|
|
22
|
+
"id": "openrouter",
|
|
23
|
+
"packageName": "@arnilo/prism-provider-openrouter",
|
|
24
|
+
"envKey": "OPENROUTER_API_KEY",
|
|
25
|
+
"envPlaceholder": "sk-or-...",
|
|
26
|
+
"modelProvider": "openrouter",
|
|
27
|
+
"modelName": "anthropic/claude-sonnet-4",
|
|
28
|
+
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport {\n createOpenRouterProvider,\n defineOpenRouterModel,\n} from \"@arnilo/prism-provider-openrouter\";",
|
|
29
|
+
"providerExpression": "createOpenRouterProvider({\n apiKey: () => process.env.OPENROUTER_API_KEY,\n })",
|
|
30
|
+
"modelExpression": "defineOpenRouterModel({ model: \"anthropic/claude-sonnet-4\" })"
|
|
31
|
+
},
|
|
32
|
+
"kimi": {
|
|
33
|
+
"id": "kimi",
|
|
34
|
+
"packageName": "@arnilo/prism-provider-kimi",
|
|
35
|
+
"envKey": "KIMI_API_KEY",
|
|
36
|
+
"envPlaceholder": "your-kimi-api-key",
|
|
37
|
+
"modelProvider": "kimi-coding",
|
|
38
|
+
"modelName": "kimi-k2.7-code",
|
|
39
|
+
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createKimiCodingProvider } from \"@arnilo/prism-provider-kimi\";",
|
|
40
|
+
"providerExpression": "createKimiCodingProvider({\n apiKey: () => process.env.KIMI_API_KEY,\n })",
|
|
41
|
+
"modelExpression": "{ provider: \"kimi-coding\", model: \"kimi-k2.7-code\" }"
|
|
42
|
+
},
|
|
43
|
+
"zai": {
|
|
44
|
+
"id": "zai",
|
|
45
|
+
"packageName": "@arnilo/prism-provider-zai",
|
|
46
|
+
"envKey": "ZAI_API_KEY",
|
|
47
|
+
"envPlaceholder": "your-zai-api-key",
|
|
48
|
+
"modelProvider": "zai",
|
|
49
|
+
"modelName": "glm-4.7",
|
|
50
|
+
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createZaiProvider } from \"@arnilo/prism-provider-zai\";",
|
|
51
|
+
"providerExpression": "createZaiProvider({\n apiKey: () => process.env.ZAI_API_KEY,\n })",
|
|
52
|
+
"modelExpression": "{ provider: \"zai\", model: \"glm-4.7\" }"
|
|
53
|
+
},
|
|
54
|
+
"opencode-go": {
|
|
55
|
+
"id": "opencode-go",
|
|
56
|
+
"packageName": "@arnilo/prism-provider-opencode-go",
|
|
57
|
+
"envKey": "OPENCODE_API_KEY",
|
|
58
|
+
"envPlaceholder": "your-opencode-api-key",
|
|
59
|
+
"modelProvider": "opencode-go",
|
|
60
|
+
"modelName": "gpt-5.1-go",
|
|
61
|
+
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createOpenCodeGoProvider } from \"@arnilo/prism-provider-opencode-go\";",
|
|
62
|
+
"providerExpression": "createOpenCodeGoProvider({\n apiKey: () => process.env.OPENCODE_API_KEY,\n })",
|
|
63
|
+
"modelExpression": "{ provider: \"opencode-go\", model: \"gpt-5.1-go\", compat: { route: \"openai\" } }"
|
|
64
|
+
},
|
|
65
|
+
"neuralwatt": {
|
|
66
|
+
"id": "neuralwatt",
|
|
67
|
+
"packageName": "@arnilo/prism-provider-neuralwatt",
|
|
68
|
+
"envKey": "NEURALWATT_API_KEY",
|
|
69
|
+
"envPlaceholder": "your-neuralwatt-api-key",
|
|
70
|
+
"modelProvider": "neuralwatt",
|
|
71
|
+
"modelName": "glm-5.2",
|
|
72
|
+
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport {\n createNeuralWattProvider,\n defineNeuralWattModel,\n} from \"@arnilo/prism-provider-neuralwatt\";",
|
|
73
|
+
"providerExpression": "createNeuralWattProvider({\n apiKey: () => process.env.NEURALWATT_API_KEY,\n })",
|
|
74
|
+
"modelExpression": "defineNeuralWattModel({\n model: \"glm-5.2\",\n cache: { kind: \"implicit\" },\n })"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
__PROVIDER_IMPORTS__
|
|
2
|
+
|
|
3
|
+
/** Create the host agent for provider `__PROVIDER_ID__`. */
|
|
4
|
+
export function createAppAgent() {
|
|
5
|
+
return createAgent({
|
|
6
|
+
model: __MODEL_EXPRESSION__,
|
|
7
|
+
provider: __PROVIDER_EXPRESSION__,
|
|
8
|
+
instructions: "You are a helpful assistant.",
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createAppAgent } from "./agent.js";
|
|
2
|
+
|
|
3
|
+
export async function main(prompt = "Say hello in one short sentence."): Promise<string> {
|
|
4
|
+
const agent = createAppAgent();
|
|
5
|
+
const session = agent.createSession({ id: "init-demo" });
|
|
6
|
+
const result = await session.run(prompt);
|
|
7
|
+
return result.text;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
11
|
+
console.log(await main(process.argv.slice(2).join(" ") || undefined));
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import {
|
|
4
|
+
createAgent,
|
|
5
|
+
createMockProvider,
|
|
6
|
+
providerDone,
|
|
7
|
+
providerTextDelta,
|
|
8
|
+
} from "@arnilo/prism";
|
|
9
|
+
|
|
10
|
+
describe("generated agent", () => {
|
|
11
|
+
it("runs offline with the mock provider", async () => {
|
|
12
|
+
const agent = createAgent({
|
|
13
|
+
model: { provider: "mock", model: "demo" },
|
|
14
|
+
provider: createMockProvider([
|
|
15
|
+
providerTextDelta("Hello from mock"),
|
|
16
|
+
providerDone(),
|
|
17
|
+
]),
|
|
18
|
+
});
|
|
19
|
+
const session = agent.createSession({ id: "init-test" });
|
|
20
|
+
const result = await session.run("Hi");
|
|
21
|
+
assert.equal(result.status, "succeeded");
|
|
22
|
+
assert.equal(result.text, "Hello from mock");
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"rootDir": "src",
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"]
|
|
15
|
+
}
|