@arnilo/prism 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +44 -5
  2. package/README.md +10 -10
  3. package/dist/agent-definitions.js +1 -0
  4. package/dist/agent-run-lifecycle.js +11 -0
  5. package/dist/agent-run-state.d.ts +6 -0
  6. package/dist/agent-run-state.js +29 -9
  7. package/dist/agent-session/session/assemble.js +33 -2
  8. package/dist/agent-session/session/persist.js +6 -2
  9. package/dist/agent-session/session/tool-round.js +1 -0
  10. package/dist/agent-session/session/types.d.ts +10 -0
  11. package/dist/agent-session/session.d.ts +14 -0
  12. package/dist/agent-session/session.js +40 -3
  13. package/dist/artifacts.d.ts +39 -1
  14. package/dist/artifacts.js +73 -0
  15. package/dist/attention-compiler.d.ts +121 -0
  16. package/dist/attention-compiler.js +479 -0
  17. package/dist/cli-init.js +20 -6
  18. package/dist/context-budget.d.ts +20 -1
  19. package/dist/context-budget.js +10 -1
  20. package/dist/contracts-core/agent.d.ts +7 -0
  21. package/dist/contracts-core/attention.d.ts +66 -0
  22. package/dist/contracts-core/attention.js +2 -0
  23. package/dist/contracts-core/compaction.d.ts +59 -0
  24. package/dist/contracts-core/compaction.js +77 -1
  25. package/dist/contracts-core/provider.d.ts +4 -0
  26. package/dist/contracts-core.d.ts +1 -0
  27. package/dist/contracts-core.js +1 -0
  28. package/dist/contracts-protocol.d.ts +29 -0
  29. package/dist/contracts-run-state.d.ts +6 -0
  30. package/dist/host-composition.d.ts +78 -0
  31. package/dist/host-composition.js +248 -0
  32. package/dist/index.d.ts +9 -6
  33. package/dist/index.js +5 -4
  34. package/dist/input.d.ts +13 -1
  35. package/dist/input.js +40 -1
  36. package/dist/secure-agent.d.ts +2 -0
  37. package/dist/secure-agent.js +6 -1
  38. package/dist/tool-result-fold.d.ts +12 -0
  39. package/dist/tool-result-fold.js +13 -6
  40. package/dist/tools.d.ts +10 -0
  41. package/dist/tools.js +41 -0
  42. package/docs/acp-agent.md +42 -11
  43. package/docs/acp.md +2 -1
  44. package/docs/ag-ui.md +5 -3
  45. package/docs/agent-definitions.md +9 -1
  46. package/docs/agent-events.md +4 -1
  47. package/docs/agent-session-runtime.md +6 -6
  48. package/docs/attention-compiler.md +272 -0
  49. package/docs/cli-rpc.md +4 -2
  50. package/docs/coding-agent-tools.md +1 -1
  51. package/docs/coding-security.md +5 -3
  52. package/docs/coding-tools.md +1 -1
  53. package/docs/coding-workspaces.md +22 -0
  54. package/docs/compaction-and-retry.md +36 -4
  55. package/docs/compaction-observational-memory.md +62 -9
  56. package/docs/context-and-skills.md +4 -2
  57. package/docs/conversations.md +1 -1
  58. package/docs/dev-inspector.md +4 -0
  59. package/docs/device-adapters.md +1 -0
  60. package/docs/document-reader.md +11 -3
  61. package/docs/documents.md +10 -2
  62. package/docs/enterprise-postgres-state.md +2 -2
  63. package/docs/evaluations.md +168 -4
  64. package/docs/execution-timeline.md +180 -0
  65. package/docs/history/0.7.0-primitive-review.md +254 -0
  66. package/docs/history/migration-0.0.md +2 -2
  67. package/docs/history/release-handoffs.md +37 -1
  68. package/docs/host-compositions.md +147 -0
  69. package/docs/hosted-sandboxes.md +94 -0
  70. package/docs/index.md +58 -39
  71. package/docs/input-and-prompt-assembly.md +1 -0
  72. package/docs/knowledge-sync.md +84 -0
  73. package/docs/language-intelligence.md +1 -1
  74. package/docs/live-testing.md +4 -1
  75. package/docs/mcp-tools.md +2 -1
  76. package/docs/memory-fabric.md +416 -0
  77. package/docs/migrate-to-0.5.md +1 -1
  78. package/docs/migrate-to-0.6.md +1 -0
  79. package/docs/migrate-to-0.7.md +345 -0
  80. package/docs/migration.md +13 -1
  81. package/docs/model-routing.md +79 -4
  82. package/docs/multi-agent-patterns.md +20 -6
  83. package/docs/observability.md +52 -1
  84. package/docs/operations.md +13 -1
  85. package/docs/options-index.md +13 -1
  86. package/docs/peer-dependencies.md +6 -4
  87. package/docs/process-sessions.md +3 -1
  88. package/docs/prompt-registry.md +1 -1
  89. package/docs/provider-caching.md +4 -2
  90. package/docs/provider-conformance.md +1 -1
  91. package/docs/provider-packages.md +22 -22
  92. package/docs/providers/bedrock.md +71 -7
  93. package/docs/providers/openai.md +1 -1
  94. package/docs/rag.md +24 -8
  95. package/docs/realtime-voice.md +87 -0
  96. package/docs/release-and-install.md +36 -34
  97. package/docs/runs-and-usage.md +3 -2
  98. package/docs/server.md +5 -3
  99. package/docs/speech.md +2 -0
  100. package/docs/supervisors.md +33 -5
  101. package/docs/testing.md +1 -1
  102. package/docs/thinking-and-reasoning.md +3 -1
  103. package/docs/tools.md +6 -5
  104. package/docs/web-tools.md +2 -1
  105. package/docs/work-artifacts-and-review.md +14 -4
  106. package/docs/work-connectors.md +3 -1
  107. package/docs/work-tools.md +14 -4
  108. package/docs/workflows.md +69 -1
  109. package/docs/working-and-semantic-memory.md +25 -14
  110. package/package.json +1 -1
  111. package/templates/README.md +2 -0
  112. package/templates/business-worker/README.md.tmpl +19 -0
  113. package/templates/business-worker/env.example.tmpl +1 -0
  114. package/templates/business-worker/gitignore.tmpl +11 -0
  115. package/templates/business-worker/manifest.json +11 -0
  116. package/templates/business-worker/package.json.tmpl +23 -0
  117. package/templates/business-worker/src/agent.ts.tmpl +92 -0
  118. package/templates/business-worker/src/index.ts.tmpl +13 -0
  119. package/templates/business-worker/src/tests/agent.test.ts.tmpl +77 -0
  120. package/templates/business-worker/tsconfig.json.tmpl +15 -0
  121. package/templates/personal-assistant/README.md.tmpl +18 -0
  122. package/templates/personal-assistant/env.example.tmpl +1 -0
  123. package/templates/personal-assistant/gitignore.tmpl +11 -0
  124. package/templates/personal-assistant/manifest.json +11 -0
  125. package/templates/personal-assistant/package.json.tmpl +23 -0
  126. package/templates/personal-assistant/src/agent.ts.tmpl +65 -0
  127. package/templates/personal-assistant/src/index.ts.tmpl +13 -0
  128. package/templates/personal-assistant/src/tests/agent.test.ts.tmpl +28 -0
  129. package/templates/personal-assistant/tsconfig.json.tmpl +15 -0
@@ -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
+ }
@@ -0,0 +1,18 @@
1
+ # __PROJECT_NAME__
2
+
3
+ Personal workstation assistant built with Prism. Features single-user ownership, local tools, credential references, and loopback dev inspection.
4
+
5
+ ## Quickstart
6
+
7
+ ```bash
8
+ npm install
9
+ npm test
10
+ npm run dev # Boots loopback dev inspector at http://127.0.0.1:4311
11
+ ```
12
+
13
+ ## Security Posture
14
+
15
+ - **Single-User Ownership**: Bounded to the local workstation operator (`userId: process.env.USER`).
16
+ - **Secret Redaction**: Environment secrets are redacted before persistence or logs.
17
+ - **Durable Verification**: Uses memory/local storage; in-memory storage is recognized as non-durable.
18
+ - **Containment**: Tool actions are contained to local workspace roots.
@@ -0,0 +1 @@
1
+ OPENAI_API_KEY=
@@ -0,0 +1,11 @@
1
+ node_modules/
2
+ dist/
3
+ .env
4
+ .env.local
5
+ *.db
6
+ *.sqlite
7
+ *.sqlite3
8
+ .prism/
9
+ coverage/
10
+ .DS_Store
11
+ *.log
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "personal-assistant",
3
+ "description": "Personal workstation assistant: local single-user agent with file tools, credential references, and loopback dev inspection",
4
+ "version": "0.1.0",
5
+ "tags": ["personal", "workstation", "assistant", "local", "secure"],
6
+ "packages": [
7
+ "@arnilo/prism",
8
+ "@arnilo/prism-core",
9
+ "@arnilo/prism-providers"
10
+ ]
11
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "__PROJECT_NAME__",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "tsc -p tsconfig.json",
8
+ "typecheck": "tsc -p tsconfig.json --noEmit",
9
+ "test": "npm run build && node --test dist/__tests__/agent.test.js",
10
+ "start": "npm run build && node dist/index.js",
11
+ "dev": "prism dev"
12
+ },
13
+ "dependencies": {
14
+ __DEPENDENCIES__
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^22.0.0",
18
+ "typescript": "^5.7.0"
19
+ },
20
+ "engines": {
21
+ "node": ">=20"
22
+ }
23
+ }
@@ -0,0 +1,65 @@
1
+ import {
2
+ type Agent,
3
+ createMemoryCheckpointStore,
4
+ createMockProvider,
5
+ createSecretRedactor,
6
+ createSecureAgent,
7
+ createStaticPermissionPolicy,
8
+ createStaticTrustPolicy,
9
+ providerDone,
10
+ providerTextDelta,
11
+ } from "@arnilo/prism";
12
+ import { createJsonSchemaArgumentValidator } from "@arnilo/prism-core/validation/json-schema";
13
+
14
+ export interface CreatePersonalAgentOptions {
15
+ readonly userId?: string;
16
+ readonly provider?: import("@arnilo/prism").AIProvider;
17
+ readonly model?: { readonly provider: string; readonly model: string };
18
+ readonly workspaceRoot?: string;
19
+ }
20
+
21
+ export function createAppAgent(options: CreatePersonalAgentOptions = {}): Agent {
22
+ const userId = options.userId ?? process.env.USER ?? "local-user";
23
+ const redactor = createSecretRedactor(
24
+ [process.env.OPENAI_API_KEY].filter((v): v is string => typeof v === "string" && v.length > 0),
25
+ );
26
+
27
+ const provider =
28
+ options.provider ??
29
+ createMockProvider([
30
+ providerTextDelta("Personal Assistant ready. How can I help you today?"),
31
+ providerDone(),
32
+ ]);
33
+
34
+ return createSecureAgent({
35
+ id: "personal-assistant",
36
+ definitionRevision: "1",
37
+ ownership: { userId },
38
+ redactor,
39
+ permission: createStaticPermissionPolicy(true),
40
+ trust: createStaticTrustPolicy(true),
41
+ toolArgumentValidator: createJsonSchemaArgumentValidator(),
42
+ limits: { maxToolRounds: 10 },
43
+ runState: { checkpoints: createMemoryCheckpointStore() },
44
+ tools: [
45
+ {
46
+ name: "workspace_status",
47
+ description: "Reports the local workspace status and configuration",
48
+ parameters: {
49
+ type: "object",
50
+ properties: {
51
+ details: { type: "boolean", description: "Include detailed status" },
52
+ },
53
+ additionalProperties: false,
54
+ },
55
+ execute: async (_args, ctx) => ({
56
+ toolCallId: ctx.toolCallId,
57
+ name: "workspace_status",
58
+ value: { ok: true, user: userId, status: "active" },
59
+ }),
60
+ },
61
+ ],
62
+ provider,
63
+ model: options.model ?? { provider: "mock", model: "personal-default" },
64
+ });
65
+ }
@@ -0,0 +1,13 @@
1
+ import { createAppAgent } from "./agent.js";
2
+
3
+ async function main() {
4
+ const agent = createAppAgent();
5
+ const session = agent.createSession({ id: "personal-session-1" });
6
+ const result = await session.run("Check workspace status");
7
+ console.log(result.text);
8
+ }
9
+
10
+ main().catch((error) => {
11
+ console.error("Personal assistant failed:", error);
12
+ process.exit(1);
13
+ });
@@ -0,0 +1,28 @@
1
+ import assert from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { assertHostCompositionReadiness, inspectHostComposition } from "@arnilo/prism";
4
+ import { createAppAgent } from "../agent.js";
5
+
6
+ describe("personal assistant template", () => {
7
+ it("creates agent and runs an offline turn", async () => {
8
+ const agent = createAppAgent({ userId: "test-user" });
9
+ const session = agent.createSession({ id: "test-session" });
10
+ const result = await session.run("Hello");
11
+ assert.ok(result.text.includes("Personal Assistant ready"));
12
+ });
13
+
14
+ it("passes personal host composition readiness inspection", () => {
15
+ const agent = createAppAgent({ userId: "test-user" });
16
+ const report = inspectHostComposition({
17
+ profile: "personal",
18
+ agent,
19
+ credentialRefs: ["OPENAI_API_KEY"],
20
+ });
21
+
22
+ assert.equal(report.profile, "personal");
23
+ assert.equal(report.ownership.userId, "test-user");
24
+ assert.equal(report.readiness.ok, true);
25
+ assert.equal(report.storage.durable, false, "in-memory store is non-durable");
26
+ assert.doesNotThrow(() => assertHostCompositionReadiness({ profile: "personal", agent }));
27
+ });
28
+ });
@@ -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
+ }