@arnilo/prism 0.4.0 → 0.5.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 (171) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +23 -20
  3. package/dist/agent-run-state.d.ts +1 -2
  4. package/dist/agent-run-state.js +0 -3
  5. package/dist/agent-session/session/assemble.d.ts +6 -0
  6. package/dist/agent-session/session/assemble.js +391 -0
  7. package/dist/agent-session/session/persist.d.ts +28 -0
  8. package/dist/agent-session/session/persist.js +166 -0
  9. package/dist/agent-session/session/provider-round.d.ts +6 -0
  10. package/dist/agent-session/session/provider-round.js +231 -0
  11. package/dist/agent-session/session/tool-round.d.ts +31 -0
  12. package/dist/agent-session/session/tool-round.js +473 -0
  13. package/dist/agent-session/session/types.d.ts +115 -0
  14. package/dist/agent-session/session/types.js +5 -0
  15. package/dist/agent-session/session.d.ts +49 -43
  16. package/dist/agent-session/session.js +11 -1177
  17. package/dist/capture.d.ts +63 -0
  18. package/dist/capture.js +67 -0
  19. package/dist/cli-init.d.ts +18 -2
  20. package/dist/cli-init.js +2 -7
  21. package/dist/cli-runner.d.ts +2 -2
  22. package/dist/cli-runner.js +45 -9
  23. package/dist/content.d.ts +3 -3
  24. package/dist/content.js +3 -1
  25. package/dist/contracts-core/agent.d.ts +2 -0
  26. package/dist/contracts-core/batch.d.ts +97 -0
  27. package/dist/contracts-core/batch.js +65 -0
  28. package/dist/contracts-core/content.d.ts +72 -1
  29. package/dist/contracts-core/embeddings.d.ts +30 -0
  30. package/dist/contracts-core/embeddings.js +17 -0
  31. package/dist/contracts-core/images.d.ts +60 -0
  32. package/dist/contracts-core/images.js +17 -0
  33. package/dist/contracts-core/moderation.d.ts +46 -0
  34. package/dist/contracts-core/moderation.js +34 -0
  35. package/dist/contracts-core/speech.d.ts +39 -0
  36. package/dist/contracts-core/speech.js +17 -0
  37. package/dist/contracts-core/transcription.d.ts +48 -0
  38. package/dist/contracts-core/transcription.js +17 -0
  39. package/dist/contracts-core/video.d.ts +61 -0
  40. package/dist/contracts-core/video.js +17 -0
  41. package/dist/contracts-core.d.ts +7 -0
  42. package/dist/contracts-core.js +7 -0
  43. package/dist/index.d.ts +5 -3
  44. package/dist/index.js +4 -3
  45. package/dist/node/agent-definitions.d.ts +1 -8
  46. package/dist/node/agent-definitions.js +0 -34
  47. package/dist/node/settings.d.ts +0 -1
  48. package/dist/node/settings.js +0 -5
  49. package/dist/pinned-fetch.js +29 -3
  50. package/dist/provider-events.js +3 -4
  51. package/dist/providers/media.d.ts +1 -2
  52. package/dist/providers/media.js +1 -4
  53. package/dist/rpc.d.ts +1 -1
  54. package/dist/rpc.js +4 -4
  55. package/dist/testing/provider-conformance.d.ts +114 -5
  56. package/dist/testing/provider-conformance.js +342 -0
  57. package/dist/testing/tool-effect-store-conformance.d.ts +0 -1
  58. package/dist/testing/tool-effect-store-conformance.js +0 -3
  59. package/dist/thinking.d.ts +48 -9
  60. package/dist/thinking.js +134 -8
  61. package/docs/0.1.0-readiness.md +3 -3
  62. package/docs/a2a.md +2 -2
  63. package/docs/acp.md +3 -3
  64. package/docs/ag-ui-adoption.md +1 -1
  65. package/docs/ag-ui.md +1 -2
  66. package/docs/agent-definitions.md +1 -1
  67. package/docs/agent-events.md +5 -5
  68. package/docs/agent-identity.md +13 -2
  69. package/docs/audit-export.md +3 -3
  70. package/docs/batch-jobs.md +120 -0
  71. package/docs/cli-rpc.md +20 -9
  72. package/docs/coding-agent-tools.md +19 -19
  73. package/docs/coding-review-and-diagnostics.md +2 -2
  74. package/docs/coding-security.md +4 -4
  75. package/docs/coding-workspaces.md +2 -2
  76. package/docs/computer-use-linux.md +13 -2
  77. package/docs/context-and-skills.md +1 -1
  78. package/docs/conversations.md +4 -4
  79. package/docs/credential-storage.md +11 -7
  80. package/docs/credentials-and-redaction.md +1 -1
  81. package/docs/data-classification.md +1 -1
  82. package/docs/database-persistence.md +4 -4
  83. package/docs/dev-inspector.md +6 -6
  84. package/docs/device-adapters.md +2 -2
  85. package/docs/diagrams.md +1 -1
  86. package/docs/document-reader.md +6 -6
  87. package/docs/documents.md +5 -4
  88. package/docs/embeddings.md +112 -0
  89. package/docs/enterprise-postgres-state.md +7 -7
  90. package/docs/evaluations.md +8 -8
  91. package/docs/extensions.md +3 -3
  92. package/docs/forge-integration.md +3 -3
  93. package/docs/graft.md +2 -2
  94. package/docs/guardrails.md +1 -1
  95. package/docs/host-security.md +15 -15
  96. package/docs/image-generation.md +129 -0
  97. package/docs/impeccable.md +5 -3
  98. package/docs/index.md +60 -33
  99. package/docs/indexed-code-search.md +2 -2
  100. package/docs/language-intelligence.md +4 -4
  101. package/docs/live-testing.md +126 -0
  102. package/docs/mcp-tools.md +43 -12
  103. package/docs/middleware-hooks.md +1 -1
  104. package/docs/migrate-to-0.4.md +3 -3
  105. package/docs/migrate-to-0.5.md +122 -0
  106. package/docs/migration.md +29 -1
  107. package/docs/model-registry.md +38 -0
  108. package/docs/model-routing.md +5 -5
  109. package/docs/moderation.md +117 -0
  110. package/docs/multi-agent-patterns.md +4 -4
  111. package/docs/multimodal-content.md +26 -2
  112. package/docs/obscura.md +2 -2
  113. package/docs/observability.md +32 -7
  114. package/docs/openapi-tools.md +13 -3
  115. package/docs/operations.md +11 -0
  116. package/docs/performance.md +7 -7
  117. package/docs/persistence-credentials-multimodality-primitives.md +6 -6
  118. package/docs/policy-and-audit.md +17 -7
  119. package/docs/ponytail.md +1 -1
  120. package/docs/postgres-persistence.md +5 -5
  121. package/docs/process-sessions.md +2 -2
  122. package/docs/prompt-registry.md +7 -7
  123. package/docs/provider-caching.md +4 -0
  124. package/docs/provider-conformance.md +23 -1
  125. package/docs/provider-packages.md +39 -3
  126. package/docs/provider-primitives.md +1 -1
  127. package/docs/provider-request-policies.md +1 -1
  128. package/docs/providers/ai-sdk.md +15 -3
  129. package/docs/providers/alibaba.md +5 -1
  130. package/docs/providers/anthropic.md +4 -0
  131. package/docs/providers/azure.md +17 -1
  132. package/docs/providers/bedrock.md +15 -0
  133. package/docs/providers/clinepass.md +4 -0
  134. package/docs/providers/commandcode.md +253 -0
  135. package/docs/providers/deepseek.md +4 -0
  136. package/docs/providers/google.md +4 -0
  137. package/docs/providers/hyper.md +284 -0
  138. package/docs/providers/kimi.md +4 -0
  139. package/docs/providers/neuralwatt.md +4 -0
  140. package/docs/providers/ollama.md +15 -0
  141. package/docs/providers/openai-compatible.md +4 -0
  142. package/docs/providers/openai.md +4 -0
  143. package/docs/providers/opencode-go.md +4 -0
  144. package/docs/providers/openrouter.md +5 -1
  145. package/docs/providers/vertex.md +16 -0
  146. package/docs/providers/xai.md +4 -0
  147. package/docs/providers/zai.md +4 -0
  148. package/docs/rag.md +26 -4
  149. package/docs/release-and-install.md +103 -46
  150. package/docs/resource-loading.md +1 -1
  151. package/docs/runs-and-usage.md +14 -2
  152. package/docs/server.md +5 -5
  153. package/docs/settings-auth-trust-security.md +7 -5
  154. package/docs/sheets.md +2 -2
  155. package/docs/speech.md +126 -0
  156. package/docs/sqlite-persistence.md +4 -4
  157. package/docs/supervisors.md +3 -3
  158. package/docs/thinking-and-reasoning.md +93 -60
  159. package/docs/tool-conformance.md +1 -1
  160. package/docs/tool-execution-primitives.md +8 -8
  161. package/docs/tools.md +4 -4
  162. package/docs/web-tools.md +1 -1
  163. package/docs/wiki.md +1 -1
  164. package/docs/work-artifacts-and-review.md +17 -6
  165. package/docs/work-connectors.md +4 -4
  166. package/docs/work-tools.md +5 -5
  167. package/docs/workflow-orchestration-primitives.md +11 -11
  168. package/docs/workflows.md +5 -5
  169. package/package.json +11 -8
  170. package/templates/init/providers.json +24 -8
  171. package/docs/antigravity-agent.md +0 -207
@@ -1,207 +0,0 @@
1
- # Antigravity delegated agent
2
-
3
- ## What it does
4
-
5
- `@arnilo/prism-antigravity-agent` provides a delegated agent adapter for the official [Google Antigravity CLI (`agy`)](https://github.com/google/antigravity). It enables Prism applications to delegate complex, multi-step coding tasks to an authenticated Antigravity CLI runner while exposing host-owned Prism tools, resources, and prompts over a per-run Model Context Protocol (MCP) server.
6
-
7
- The package handles the end-to-end delegated execution lifecycle:
8
- - Spawns the official headless CLI (`agy --agent <name> --workspace <dir>`) as a managed subprocess.
9
- - Starts a run-bound loopback HTTP MCP server (`http://127.0.0.1:<port>/mcp`) authorized with an ephemeral Bearer token.
10
- - Writes ephemeral workspace configuration (`.agents/mcp_config.json` and custom agent instructions) with automatic backup and fail-safe restoration.
11
- - Parses the CLI's NDJSON output stream and projects steps into standard Prism `AgentEvent`s and [AG-UI](ag-ui.md) timeline activities.
12
- - Persists and resumes multi-turn conversations via `--conversation <id>`.
13
- - Provides an optional `createAntigravityDelegationTool` for Prism [supervisors](supervisors.md) and orchestrating agents.
14
-
15
- Prism does not manage Google OAuth tokens, cookies, or credentials; the host environment owns the official `agy` binary and interactive authentication state (`agy login` / Google AI Pro subscription).
16
-
17
- ## When to use it
18
-
19
- Use `@arnilo/prism-antigravity-agent` when:
20
- - You want to delegate autonomous coding sessions to Google Antigravity while exposing host-owned Prism tools and capabilities via MCP.
21
- - You need structured event streaming, token telemetry, and [AG-UI](ag-ui.md) visual timeline integration for Antigravity executions.
22
- - You are orchestrating multi-agent workflows where a Prism supervisor or coding agent needs to delegate specialized subtasks to Antigravity.
23
- - You want conversation continuation across multiple user turns in a persistent session.
24
-
25
- Do **not** use it:
26
- - As a generic LLM model provider. For direct Gemini API or Vertex AI foundation model inference without an autonomous loop, use [`@arnilo/prism-providers/google`](providers/google.md) or [`@arnilo/prism-providers/vertex`](providers/vertex.md).
27
- - If you require step-by-step turn replacement of Antigravity's internal model loop, compaction, or planning strategy.
28
- - If you require unreleased raw internal chain-of-thought text. Antigravity reasoning effort is projected as token counts and timeline activity steps, not raw hidden thoughts.
29
-
30
- ## Inputs / request
31
-
32
- `createAntigravityCliAgent(options)` accepts agent configuration:
33
-
34
- | Field | Type | Default | Purpose |
35
- | --- | --- | --- | --- |
36
- | `command` | `string` | `"agy"` | Path to the official `agy` executable on the host. |
37
- | `args` | `readonly string[]` | `[]` | Additional command-line arguments passed to the CLI. |
38
- | `cwd` | `string` | `process.cwd()` | Working directory for the runner process. |
39
- | `env` | `Record<string, string | undefined>` | `process.env` | Process environment variables. |
40
- | `timeoutMs` | `number` | `300000` (5m) | Maximum process execution time. |
41
- | `toolPolicy` | `AntigravityToolPolicy` | `"hybrid"` | Built-in CLI tool permissions (`"hybrid"`, `"all"`, `"none"`, or custom). |
42
- | `tools` | `ToolDefinition[]` | `[]` | Prism tools exposed to the agent via loopback MCP. |
43
- | `resources` | `ResourceDefinition[]` | `[]` | Prism resources exposed via loopback MCP. |
44
- | `prompts` | `PromptDefinition[]` | `[]` | Prism prompt templates exposed via loopback MCP. |
45
- | `exposure` | `AntigravityMcpExposure` | auto-created | Custom MCP server exposure handle if sharing an external server. |
46
- | `conversationStore` | `AntigravityConversationStore` | in-memory | Store for persisting conversation IDs across turns. |
47
- | `redactor` | `SecretRedactor` | auto | Secret redactor applied to events and process output. |
48
- | `agentName` | `string` | `"prism-agent"` | Ephemeral agent definition identifier. |
49
- | `systemPrompt` | `string` | built-in instructions | Custom instructions appended to the agent definition. |
50
-
51
- `agent.run(runOptions)` executes a prompt run:
52
-
53
- | Field | Type | Default | Purpose |
54
- | --- | --- | --- | --- |
55
- | `prompt` | `string` | required | User task or instruction for Antigravity. |
56
- | `workspace` | `string` | `agent.cwd` | Target workspace directory path for file modifications. |
57
- | `sessionId` | `string` | auto-generated | Prism session identifier for conversation persistence. |
58
- | `branchId` | `string` | `"main"` | Branch identifier for conversation isolation. |
59
- | `conversationId` | `string` | auto-resolved | Existing Antigravity conversation ID to resume. |
60
- | `signal` | `AbortSignal` | omitted | Cancellation signal to abort execution and clean up. |
61
- | `eventSink` | `(event: AgentEvent) => void` | omitted | Real-time event listener for streaming UI updates. |
62
- | `toolPolicy` | `AntigravityToolPolicy` | agent default | Per-run override for built-in tool policy. |
63
-
64
- ## Outputs / response / events
65
-
66
- `agent.run()` returns a promise resolving to an `AntigravityRunResult`:
67
-
68
- | Field | Type | Purpose |
69
- | --- | --- | --- |
70
- | `text` | `string` | Final synthesized response text from the Antigravity CLI. |
71
- | `conversationId` | `string` | Antigravity conversation ID for subsequent multi-turn resumption. |
72
- | `exitCode` | `number` | Process exit status code (0 for success). |
73
- | `durationMs` | `number` | Total elapsed execution time in milliseconds. |
74
- | `events` | `readonly AgentEvent[]` | Complete sequence of projected Prism events emitted during the run. |
75
- | `usage` | `UsageReport` | Aggregated prompt, completion, total, and thinking token counts. |
76
- | `subagents` | `readonly AntigravitySubagentSummary[]` | Subagents spawned and completed during execution. |
77
-
78
- ### Streamed events
79
-
80
- The runner emits standardized Prism `AgentEvent` objects to the provided `eventSink`:
81
- - `delegated_agent_step`: High-level step progression with step name, status, and duration.
82
- - `message_delta`: Incremental response text chunks.
83
- - `tool_call_start` / `tool_call_delta` / `tool_call_result`: MCP tool invocations and results.
84
- - `agent_thought_chunk`: Thinking activity indicators with token counts.
85
- - `usage`: Token usage telemetry updates.
86
- - `subagent_spawn` / `subagent_finish`: Internal subagent hierarchy lifecycle.
87
-
88
- ## Request/response example
89
-
90
- ```json
91
- {
92
- "prompt": "Inspect the repository and add unit tests for the auth helper.",
93
- "workspace": "/home/user/project",
94
- "sessionId": "session-101",
95
- "toolPolicy": "hybrid"
96
- }
97
- ```
98
-
99
- ```json
100
- {
101
- "text": "Added 4 unit tests covering token refresh and validation in auth.test.ts.",
102
- "conversationId": "conv_9876543210",
103
- "exitCode": 0,
104
- "durationMs": 4250,
105
- "usage": {
106
- "promptTokens": 1520,
107
- "completionTokens": 380,
108
- "totalTokens": 1900,
109
- "thinkingTokens": 640
110
- },
111
- "subagents": []
112
- }
113
- ```
114
-
115
- ## Implementation example
116
-
117
- ### Direct runner
118
-
119
- ```ts
120
- import { createAntigravityCliAgent } from "@arnilo/prism-antigravity-agent";
121
- import { createReadTool, createWriteTool } from "@arnilo/prism-coding-agent";
122
-
123
- // Configure agent with host-owned Prism tools exposed over MCP
124
- const agent = createAntigravityCliAgent({
125
- command: "agy",
126
- tools: [
127
- createReadTool({ workspaceRoot: "/home/user/project" }),
128
- createWriteTool({ workspaceRoot: "/home/user/project" }),
129
- ],
130
- toolPolicy: "hybrid", // Built-in bash/editor tools enabled; Prism MCP tools added
131
- });
132
-
133
- // Run a task with real-time event streaming
134
- const result = await agent.run({
135
- prompt: "Refactor error handling in src/utils.ts to use typed AppError",
136
- workspace: "/home/user/project",
137
- sessionId: "session-42",
138
- eventSink: (event) => {
139
- if (event.type === "message_delta") {
140
- process.stdout.write(event.delta.text);
141
- }
142
- },
143
- });
144
-
145
- console.log(`\nCompleted in ${result.durationMs}ms with conversation ${result.conversationId}`);
146
- ```
147
-
148
- ### Supervisor delegation tool
149
-
150
- ```ts
151
- import { createSupervisor } from "@arnilo/prism-supervisor";
152
- import {
153
- createAntigravityCliAgent,
154
- createAntigravityDelegationTool,
155
- } from "@arnilo/prism-antigravity-agent";
156
-
157
- const antigravity = createAntigravityCliAgent({
158
- workspace: "/home/user/project",
159
- toolPolicy: "hybrid",
160
- });
161
-
162
- const supervisor = createSupervisor({
163
- tools: [
164
- createAntigravityDelegationTool({
165
- agent: antigravity,
166
- name: "delegate_to_antigravity",
167
- description: "Delegate complex coding tasks to Google Antigravity CLI",
168
- }),
169
- ],
170
- });
171
- ```
172
-
173
- ## Extension and configuration notes
174
-
175
- ### Ephemeral workspace configuration
176
-
177
- During each execution, the adapter dynamically constructs:
178
- 1. `.agents/mcp_config.json`: Configures the local loopback MCP server endpoint (`http://127.0.0.1:<port>/mcp`) and authorization header.
179
- 2. `.agents/agents/<name>/agent.md`: Configures custom instructions and tool permissions.
180
-
181
- If pre-existing configuration files exist in `.agents/`, they are backed up before the run and restored atomically upon completion, failure, or cancellation.
182
-
183
- ### Tool policies
184
-
185
- The `toolPolicy` setting controls built-in CLI capabilities:
186
- - `"hybrid"` (default): Enables built-in editor, terminal, and search tools while exposing configured Prism MCP tools.
187
- - `"all"`: Enables all built-in CLI tools and MCP tools.
188
- - `"none"`: Disables built-in tools; the agent relies exclusively on exposed Prism MCP tools.
189
- - Custom object `{ allow?: string[], deny?: string[] }`: Explicit allow/deny lists for fine-grained governance.
190
-
191
- ## Security and performance notes
192
-
193
- - **Host-owned authentication**: Prism does not read, store, or forward Google credentials. Authentication state resides in the official `agy` CLI's session store managed via `agy login`.
194
- - **Loopback isolation**: The ephemeral MCP HTTP server binds exclusively to `127.0.0.1` on a dynamically assigned port, secured with a cryptographically random Bearer token.
195
- - **Fail-safe cleanup**: Workspace configuration files and HTTP listener ports are cleaned up in `finally` blocks under all exit conditions, including `SIGINT`, timeouts, and unhandled errors.
196
- - **Secret redaction**: All stdout, stderr, event payloads, and tool arguments are processed through Prism's secret redactor before event emission.
197
- - **Terms and quota**: Antigravity CLI execution utilizes Google AI Pro subscription quotas through the authenticated official binary. Host operators should verify compliance with their organization's terms of service.
198
-
199
- ## Related APIs
200
-
201
- - [Frontend interoperability (AG-UI and ACP)](ag-ui.md): Connect Antigravity event streams to AG-UI and web interfaces.
202
- - [MCP client bridge and server exposure](mcp-tools.md): Core Model Context Protocol integration in Prism.
203
- - [Supervisor delegation](supervisors.md): Hierarchical multi-agent delegation patterns.
204
- - [Coding agent tools](coding-agent-tools.md): Native Prism file, edit, and terminal tools.
205
- - [Google Gemini provider](providers/google.md): Direct Gemini API model inference without CLI delegation.
206
- - [Google Vertex AI provider](providers/vertex.md): Enterprise cloud Vertex AI model inference.
207
- - [Public contracts](public-contracts.md): Core message, event, tool, and session types.