@arnilo/prism 0.4.0 → 0.5.1
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 +41 -1
- package/README.md +23 -20
- package/dist/agent-run-state.d.ts +1 -2
- package/dist/agent-run-state.js +0 -3
- package/dist/agent-session/session/assemble.d.ts +6 -0
- package/dist/agent-session/session/assemble.js +391 -0
- package/dist/agent-session/session/persist.d.ts +28 -0
- package/dist/agent-session/session/persist.js +166 -0
- package/dist/agent-session/session/provider-round.d.ts +6 -0
- package/dist/agent-session/session/provider-round.js +231 -0
- package/dist/agent-session/session/tool-round.d.ts +31 -0
- package/dist/agent-session/session/tool-round.js +473 -0
- package/dist/agent-session/session/types.d.ts +115 -0
- package/dist/agent-session/session/types.js +5 -0
- package/dist/agent-session/session.d.ts +49 -43
- package/dist/agent-session/session.js +24 -1180
- package/dist/capture.d.ts +63 -0
- package/dist/capture.js +67 -0
- package/dist/cli-init.d.ts +18 -2
- package/dist/cli-init.js +2 -7
- package/dist/cli-runner.d.ts +2 -2
- package/dist/cli-runner.js +45 -9
- package/dist/content.d.ts +3 -3
- package/dist/content.js +3 -1
- package/dist/contracts-core/agent.d.ts +4 -0
- package/dist/contracts-core/batch.d.ts +97 -0
- package/dist/contracts-core/batch.js +65 -0
- package/dist/contracts-core/content.d.ts +72 -1
- package/dist/contracts-core/embeddings.d.ts +30 -0
- package/dist/contracts-core/embeddings.js +17 -0
- package/dist/contracts-core/images.d.ts +60 -0
- package/dist/contracts-core/images.js +17 -0
- package/dist/contracts-core/moderation.d.ts +46 -0
- package/dist/contracts-core/moderation.js +34 -0
- package/dist/contracts-core/speech.d.ts +39 -0
- package/dist/contracts-core/speech.js +17 -0
- package/dist/contracts-core/transcription.d.ts +48 -0
- package/dist/contracts-core/transcription.js +17 -0
- package/dist/contracts-core/video.d.ts +61 -0
- package/dist/contracts-core/video.js +17 -0
- package/dist/contracts-core.d.ts +7 -0
- package/dist/contracts-core.js +7 -0
- package/dist/contracts-protocol.d.ts +2 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5 -4
- package/dist/input.js +3 -2
- package/dist/node/agent-definitions.d.ts +1 -8
- package/dist/node/agent-definitions.js +0 -34
- package/dist/node/settings.d.ts +0 -1
- package/dist/node/settings.js +0 -5
- package/dist/pinned-fetch.js +29 -3
- package/dist/provider-events.js +3 -4
- package/dist/provider-request-policy.d.ts +15 -0
- package/dist/provider-request-policy.js +52 -0
- package/dist/providers/media.d.ts +1 -2
- package/dist/providers/media.js +1 -4
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.js +4 -4
- package/dist/testing/provider-conformance.d.ts +114 -5
- package/dist/testing/provider-conformance.js +342 -0
- package/dist/testing/tool-effect-store-conformance.d.ts +0 -1
- package/dist/testing/tool-effect-store-conformance.js +0 -3
- package/dist/thinking.d.ts +48 -9
- package/dist/thinking.js +134 -8
- package/docs/0.1.0-readiness.md +3 -3
- package/docs/a2a.md +2 -2
- package/docs/acp.md +3 -3
- package/docs/ag-ui-adoption.md +1 -1
- package/docs/ag-ui.md +1 -2
- package/docs/agent-definitions.md +1 -1
- package/docs/agent-events.md +5 -5
- package/docs/agent-identity.md +13 -2
- package/docs/agent-session-runtime.md +2 -1
- package/docs/audit-export.md +3 -3
- package/docs/batch-jobs.md +120 -0
- package/docs/cli-rpc.md +20 -9
- package/docs/coding-agent-tools.md +19 -19
- package/docs/coding-review-and-diagnostics.md +2 -2
- package/docs/coding-security.md +4 -4
- package/docs/coding-workspaces.md +2 -2
- package/docs/compaction-llm.md +2 -0
- package/docs/compaction-observational-memory.md +3 -0
- package/docs/computer-use-linux.md +13 -2
- package/docs/context-and-skills.md +1 -1
- package/docs/conversations.md +4 -4
- package/docs/credential-storage.md +11 -7
- package/docs/credentials-and-redaction.md +1 -1
- package/docs/data-classification.md +1 -1
- package/docs/database-persistence.md +4 -4
- package/docs/dev-inspector.md +6 -6
- package/docs/device-adapters.md +2 -2
- package/docs/diagrams.md +1 -1
- package/docs/document-reader.md +6 -6
- package/docs/documents.md +5 -4
- package/docs/embeddings.md +112 -0
- package/docs/enterprise-postgres-state.md +7 -7
- package/docs/evaluations.md +8 -8
- package/docs/extensions.md +3 -3
- package/docs/forge-integration.md +3 -3
- package/docs/graft.md +2 -2
- package/docs/guardrails.md +1 -1
- package/docs/host-security.md +15 -15
- package/docs/image-generation.md +129 -0
- package/docs/impeccable.md +5 -3
- package/docs/index.md +64 -36
- package/docs/indexed-code-search.md +2 -2
- package/docs/input-and-prompt-assembly.md +1 -1
- package/docs/language-intelligence.md +4 -4
- package/docs/live-testing.md +126 -0
- package/docs/mcp-tools.md +43 -12
- package/docs/middleware-hooks.md +1 -1
- package/docs/migrate-to-0.4.md +3 -3
- package/docs/migrate-to-0.5.md +144 -0
- package/docs/migration.md +33 -1
- package/docs/model-registry.md +38 -0
- package/docs/model-routing.md +5 -5
- package/docs/moderation.md +117 -0
- package/docs/multi-agent-patterns.md +4 -4
- package/docs/multimodal-content.md +26 -2
- package/docs/obscura.md +2 -2
- package/docs/observability.md +32 -7
- package/docs/openapi-tools.md +13 -3
- package/docs/operations.md +11 -0
- package/docs/performance.md +7 -7
- package/docs/persistence-credentials-multimodality-primitives.md +6 -6
- package/docs/policy-and-audit.md +17 -7
- package/docs/ponytail.md +1 -1
- package/docs/postgres-persistence.md +5 -5
- package/docs/process-sessions.md +2 -2
- package/docs/prompt-registry.md +7 -7
- package/docs/provider-caching.md +8 -2
- package/docs/provider-conformance.md +23 -1
- package/docs/provider-packages.md +49 -17
- package/docs/provider-primitives.md +1 -1
- package/docs/provider-request-policies.md +19 -6
- package/docs/providers/ai-sdk.md +27 -3
- package/docs/providers/alibaba.md +17 -1
- package/docs/providers/anthropic.md +16 -0
- package/docs/providers/azure.md +29 -1
- package/docs/providers/bedrock.md +27 -0
- package/docs/providers/clinepass.md +16 -0
- package/docs/providers/commandcode.md +265 -0
- package/docs/providers/deepseek.md +16 -0
- package/docs/providers/google.md +16 -0
- package/docs/providers/hyper.md +296 -0
- package/docs/providers/kimi.md +16 -0
- package/docs/providers/neuralwatt.md +16 -0
- package/docs/providers/ollama.md +27 -0
- package/docs/providers/openai-compatible.md +16 -0
- package/docs/providers/openai.md +16 -0
- package/docs/providers/opencode-go.md +16 -0
- package/docs/providers/openrouter.md +17 -1
- package/docs/providers/vertex.md +28 -0
- package/docs/providers/xai.md +16 -0
- package/docs/providers/zai.md +16 -0
- package/docs/public-contracts.md +1 -1
- package/docs/rag.md +26 -4
- package/docs/release-and-install.md +103 -46
- package/docs/resource-loading.md +1 -1
- package/docs/runs-and-usage.md +14 -2
- package/docs/server.md +5 -5
- package/docs/settings-auth-trust-security.md +7 -5
- package/docs/sheets.md +2 -2
- package/docs/speech.md +126 -0
- package/docs/sqlite-persistence.md +4 -4
- package/docs/supervisors.md +3 -3
- package/docs/thinking-and-reasoning.md +99 -61
- package/docs/tool-conformance.md +1 -1
- package/docs/tool-execution-primitives.md +8 -8
- package/docs/tools.md +4 -4
- package/docs/use-case-model-selection.md +1 -1
- package/docs/web-tools.md +1 -1
- package/docs/wiki.md +1 -1
- package/docs/work-artifacts-and-review.md +17 -6
- package/docs/work-connectors.md +4 -4
- package/docs/work-tools.md +5 -5
- package/docs/workflow-orchestration-primitives.md +11 -11
- package/docs/workflows.md +5 -5
- package/package.json +11 -8
- package/templates/init/providers.json +24 -8
- package/docs/antigravity-agent.md +0 -207
package/docs/work-connectors.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Work connectors
|
|
2
2
|
|
|
3
|
-
Least-privilege Microsoft 365 and Google Workspace connectors live in `@arnilo/prism-work
|
|
3
|
+
Least-privilege Microsoft 365 and Google Workspace connectors live in `@arnilo/prism-core/integrations/work`.
|
|
4
4
|
|
|
5
5
|
## Principles
|
|
6
6
|
|
|
@@ -13,19 +13,19 @@ Least-privilege Microsoft 365 and Google Workspace connectors live in `@arnilo/p
|
|
|
13
13
|
|
|
14
14
|
## Microsoft 365
|
|
15
15
|
|
|
16
|
-
See [Work tools](work-tools.md). Adapter: `createMicrosoft365CliAdapter` / subpath `@arnilo/prism-work
|
|
16
|
+
See [Work tools](work-tools.md). Adapter: `createMicrosoft365CliAdapter` / subpath `@arnilo/prism-core/integrations/work/microsoft365`.
|
|
17
17
|
|
|
18
18
|
Uses [@pnp/cli-microsoft365](https://pnp.github.io/cli-microsoft365/) commands such as `outlook message list|get`, `outlook mail send`, `outlook event list|add`, `file list|add`, `spo file sharinglink add`. To Do / Planner / Teams remain capability-gated.
|
|
19
19
|
|
|
20
20
|
## Google Workspace
|
|
21
21
|
|
|
22
|
-
See [Work tools](work-tools.md). Adapter: `createGoogleWorkspaceCliAdapter` / subpath `@arnilo/prism-work
|
|
22
|
+
See [Work tools](work-tools.md). Adapter: `createGoogleWorkspaceCliAdapter` / subpath `@arnilo/prism-core/integrations/work/google-workspace`.
|
|
23
23
|
|
|
24
24
|
Uses [`@googleworkspace/cli` (`gws`)](https://github.com/googleworkspace/cli): `gmail users messages list|get`, `gmail +send`, `calendar events list|insert`, `drive files list|create`, `drive permissions create`, `tasks tasks *`. Docs/Sheets/Slides create remain capability-gated. Discovery `schema` and `auth`/`login`/`setup` are forbidden from Prism argv.
|
|
25
25
|
|
|
26
26
|
## Scoped OAuth establishment (0.0.14)
|
|
27
27
|
|
|
28
|
-
Hosts establish, refresh, and revoke scoped OAuth credentials for these workloads through the existing `OAuthProvider` / credential-store seams (`@arnilo/prism-credentials
|
|
28
|
+
Hosts establish, refresh, and revoke scoped OAuth credentials for these workloads through the existing `OAuthProvider` / credential-store seams (`@arnilo/prism-core/credentials/node`): `createMicrosoft365OAuthProvider` / `createGoogleWorkspaceOAuthProvider` (PKCE + device code), least-privilege scope bundles per capability (`resolveMicrosoft365Scopes` / `resolveGoogleWorkspaceScopes`, read vs mutation). Connectors consume a per-identity token via a late-bound `tokenProvider` injected as an env var — never argv, never model context; revocation fails closed. See [Credential storage](credential-storage.md) and [Work tools](work-tools.md).
|
|
29
29
|
|
|
30
30
|
## Out of scope
|
|
31
31
|
|
package/docs/work-tools.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Work tools
|
|
2
2
|
|
|
3
|
-
Optional `@arnilo/prism-work
|
|
3
|
+
Optional `@arnilo/prism-core/integrations/work` package: identity-scoped Microsoft 365 and Google Workspace connectors. Host-pinned CLI binaries only; hard-coded `execFile` argv templates; draft-then-approve mutations; side-effect idempotency; shared mail/calendar/file/task result shapes.
|
|
4
4
|
|
|
5
5
|
## When to use
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Use when agents must read or mutate tenant mail/calendar/files/tasks through the
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install @arnilo/prism-work
|
|
12
|
+
npm install @arnilo/prism-core/integrations/work
|
|
13
13
|
# host separately:
|
|
14
14
|
# npm i -g @pnp/cli-microsoft365
|
|
15
15
|
# npm i -g @googleworkspace/cli
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
createMicrosoft365CliAdapter,
|
|
24
24
|
createGoogleWorkspaceCliAdapter,
|
|
25
25
|
createMemoryIdempotencyStore,
|
|
26
|
-
} from "@arnilo/prism-work
|
|
27
|
-
// or: import { createGoogleWorkspaceCliAdapter } from "@arnilo/prism-work
|
|
26
|
+
} from "@arnilo/prism-core/integrations/work";
|
|
27
|
+
// or: import { createGoogleWorkspaceCliAdapter } from "@arnilo/prism-core/integrations/work/google-workspace";
|
|
28
28
|
|
|
29
29
|
const microsoft365 = createMicrosoft365CliAdapter({
|
|
30
30
|
binary: process.env.M365_BIN!,
|
|
@@ -145,7 +145,7 @@ Approved mutations require core-derived `context.idempotencyKey` and a configure
|
|
|
145
145
|
## Security
|
|
146
146
|
|
|
147
147
|
- Require host-verified `AgentIdentity`; no cross-identity configDir reuse.
|
|
148
|
-
- Connector tokens (0.0.14): an optional `tokenProvider` resolves a per-identity access token into an env var per call — never argv, never model context. A missing/expired/revoked/cross-identity/wrong-tenant token fails the call closed before any exec. Refresh is late-bound and single-flighted per account (no refresh storm under reconnect). Build one with `createOAuthWorkTokenProvider()` from `@arnilo/prism-credentials
|
|
148
|
+
- Connector tokens (0.0.14): an optional `tokenProvider` resolves a per-identity access token into an env var per call — never argv, never model context. A missing/expired/revoked/cross-identity/wrong-tenant token fails the call closed before any exec. Refresh is late-bound and single-flighted per account (no refresh storm under reconnect). Build one with `createOAuthWorkTokenProvider()` from `@arnilo/prism-core/credentials/node`.
|
|
149
149
|
- External mail recipients fail closed unless `externalRecipients.allow` returns true.
|
|
150
150
|
- Anonymous / `anyone` sharing denied.
|
|
151
151
|
- CLI stdout/stderr capped (linear chunk capture, killed/rejected before bytes beyond the cap are retained); NDJSON page streams strictly parsed and page-capped; process killed on timeout/abort/overflow.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
This page freezes the Plan 057 Task 0 inventory and Task 1 adapter-contract lock for workflow orchestration. It maps existing `@arnilo/prism` orchestration, CLI/RPC, event, approval, and persistence seams; records capability gap **C-009** (workflow/graph orchestration); pins performance and security limits for Tasks 2–7; and documents the final public design for `@arnilo/prism-workflows`.
|
|
5
|
+
This page freezes the Plan 057 Task 0 inventory and Task 1 adapter-contract lock for workflow orchestration. It maps existing `@arnilo/prism` orchestration, CLI/RPC, event, approval, and persistence seams; records capability gap **C-009** (workflow/graph orchestration); pins performance and security limits for Tasks 2–7; and documents the final public design for `@arnilo/prism-core/runtime/workflows`.
|
|
6
6
|
|
|
7
7
|
Interactive TUI (**C-012**) is **out of scope** for Plan 057 and deferred. Workflow start/status/cancel/resume is delivered through public package APIs and optional RPC/`CommandDefinition` bindings.
|
|
8
8
|
|
|
@@ -41,7 +41,7 @@ Static review of `src/agents.ts`, `src/agent-loops.ts`, `src/rpc.ts`, `src/cli-r
|
|
|
41
41
|
| Middleware | `src/middleware.ts` | Ordered hooks at provider/input/tool/compaction/retry/session boundaries | Workflow does not need new hooks for v1 |
|
|
42
42
|
| Compaction / retry | `src/compaction.ts`, `src/retry.ts` | Per-session/run policies | Workflow nodes inherit agent/session config; graph-level retry is package-owned |
|
|
43
43
|
|
|
44
|
-
**Frozen boundary:** Core owns single-session run lifecycle, provider turns, tool dispatch, store append, redaction, and `AgentEvent` emission. Multi-node dependency scheduling, typed node I/O mapping, fan-out/join, workflow checkpoints, and workflow run control belong in `@arnilo/prism-workflows`.
|
|
44
|
+
**Frozen boundary:** Core owns single-session run lifecycle, provider turns, tool dispatch, store append, redaction, and `AgentEvent` emission. Multi-node dependency scheduling, typed node I/O mapping, fan-out/join, workflow checkpoints, and workflow run control belong in `@arnilo/prism-core/runtime/workflows`.
|
|
45
45
|
|
|
46
46
|
### CLI/RPC host seam (shipped)
|
|
47
47
|
|
|
@@ -67,9 +67,9 @@ Static review of `src/agents.ts`, `src/agent-loops.ts`, `src/rpc.ts`, `src/cli-r
|
|
|
67
67
|
| `redactAgentEvent` | `src/redaction.ts` | All subscriber/ledger events redacted when redactor active | Workflow persists only redacted node outputs/checkpoints |
|
|
68
68
|
| `RunLedger` | `src/contracts.ts` | Durable `appendRun`, `appendEvent`, `appendToolCall`, `appendUsage` | Workflow run record + per-node run ids; serialized `ledgerChain` (R-004) |
|
|
69
69
|
| Provider/tool metadata | `docs/observability.md` | `provider_turn_*`, `ToolExecutionMetadata` | Workflow progress / node diagnostics |
|
|
70
|
-
| OpenTelemetry adapter | `@arnilo/prism-observability
|
|
70
|
+
| OpenTelemetry adapter | `@arnilo/prism-core/governance/observability` | Optional span/metric mapping | Workflow examples may attach |
|
|
71
71
|
|
|
72
|
-
**Final architecture (Task 6):** Core exports generic `createEventMultiplexer<T>()`. `@arnilo/prism-workflows` keeps its domain `WorkflowEvent` union but delegates bounded queues, source fan-in, overflow, abort, and close behavior to the core primitive.
|
|
72
|
+
**Final architecture (Task 6):** Core exports generic `createEventMultiplexer<T>()`. `@arnilo/prism-core/runtime/workflows` keeps its domain `WorkflowEvent` union but delegates bounded queues, source fan-in, overflow, abort, and close behavior to the core primitive.
|
|
73
73
|
|
|
74
74
|
### Approval and execution policy (shipped)
|
|
75
75
|
|
|
@@ -102,7 +102,7 @@ Static review of `src/agents.ts`, `src/agent-loops.ts`, `src/rpc.ts`, `src/cli-r
|
|
|
102
102
|
|
|
103
103
|
| ID | Capability | Review rank | Status after Task 0 rework | Owner |
|
|
104
104
|
| --- | --- | ---: | --- | --- |
|
|
105
|
-
| C-009 | Workflow/graph orchestration | 9 | Task 7 shipped durable multi-process coordination (enqueue/claim/renew/takeover/fencing/cancel) | `@arnilo/prism-workflows` |
|
|
105
|
+
| C-009 | Workflow/graph orchestration | 9 | Task 7 shipped durable multi-process coordination (enqueue/claim/renew/takeover/fencing/cancel) | `@arnilo/prism-core/runtime/workflows` |
|
|
106
106
|
| C-012 | Interactive TUI | 12 | **Deferred / out of scope for Plan 057** | Future optional plan/package only |
|
|
107
107
|
|
|
108
108
|
## Rejected options
|
|
@@ -132,7 +132,7 @@ Static review of `src/agents.ts`, `src/agent-loops.ts`, `src/rpc.ts`, `src/cli-r
|
|
|
132
132
|
|
|
133
133
|
## Locked package adapter contracts (Task 1)
|
|
134
134
|
|
|
135
|
-
These TypeScript shapes are the frozen public contracts for Tasks 2–3. Implementations live in `@arnilo/prism-workflows` only.
|
|
135
|
+
These TypeScript shapes are the frozen public contracts for Tasks 2–3. Implementations live in `@arnilo/prism-core/runtime/workflows` only.
|
|
136
136
|
|
|
137
137
|
### Checkpoint adapter
|
|
138
138
|
|
|
@@ -398,9 +398,9 @@ import {
|
|
|
398
398
|
createWorkflowCommands,
|
|
399
399
|
agentNode,
|
|
400
400
|
functionNode,
|
|
401
|
-
} from "@arnilo/prism-workflows";
|
|
401
|
+
} from "@arnilo/prism-core/runtime/workflows";
|
|
402
402
|
import { runRpcServer } from "@arnilo/prism";
|
|
403
|
-
import { createSqlitePersistence } from "@arnilo/prism-
|
|
403
|
+
import { createSqlitePersistence } from "@arnilo/prism-core/sessions/sqlite";
|
|
404
404
|
|
|
405
405
|
const persistence = createSqlitePersistence({ filename: "prism.db" });
|
|
406
406
|
const checkpoints = createWorkflowCheckpoints({ store: persistence.checkpoints });
|
|
@@ -502,7 +502,7 @@ runRpcServer({
|
|
|
502
502
|
| Core event multiplexer | **Yes (Task 6)** | `createEventMultiplexer<T>()`; `WorkflowEventBus` delegates fan-in/overflow/abort/close | Removes duplicate queue logic and remains domain-neutral. |
|
|
503
503
|
| Generic `LeaseStore` | **Yes (Task 7)** | Core contract/memory reference; optional `ProductionPersistenceStore.leases`; SQLite/PostgreSQL implementations | Reusable atomic ownership, expiry, opaque claims, and monotonic fencing for coordinators. |
|
|
504
504
|
| Core `ApprovalHandler` | **No** | Host `ExecutionPolicy` / `CodingApprovalFn` with `workflowId`/`nodeId` metadata | Coding-security already owns interactive/async approve callbacks; workflow must not invent a parallel UI type. |
|
|
505
|
-
| Core workflow types | **No** | Stay in `@arnilo/prism-workflows` | Prevents graph vocabulary leaking into non-workflow hosts. |
|
|
505
|
+
| Core workflow types | **No** | Stay in `@arnilo/prism-core/runtime/workflows` | Prevents graph vocabulary leaking into non-workflow hosts. |
|
|
506
506
|
| Interactive TUI package | **No (Plan 057)** | Deferred (C-012); APIs + optional RPC commands | CLI/RPC `CommandDefinition` already is the host control seam. |
|
|
507
507
|
|
|
508
508
|
Task 1's original no-core choice was superseded by Task 6 after review. DAG, approval, and TUI decisions are unchanged.
|
|
@@ -584,11 +584,11 @@ await session.run("Hi", { signal: AbortSignal.timeout(60_000) });
|
|
|
584
584
|
|
|
585
585
|
## Extension and configuration notes
|
|
586
586
|
|
|
587
|
-
- `@arnilo/prism-workflows` is an optional workspace member; core `package.json` does not depend on it.
|
|
587
|
+
- `@arnilo/prism-core/runtime/workflows` is an optional workspace member; core `package.json` does not depend on it.
|
|
588
588
|
- Workflow agent nodes call public `AgentSession` APIs only; no imports from `src/agents.ts` internals.
|
|
589
589
|
- Workflow checkpoints adapt `ProductionPersistenceStore.checkpoints` (or any `CheckpointStore`); no raw database handles enter the workflow package.
|
|
590
590
|
- Multimodal and credential packages from Plan 056 compose unchanged in workflow examples (Task 4).
|
|
591
|
-
- `@arnilo/prism-workflows` is available directly and through `prism-sdk`/`prism-all`; installation does not start a worker or workflow.
|
|
591
|
+
- `@arnilo/prism-core/runtime/workflows` is available directly and through `prism-sdk`/`prism-all`; installation does not start a worker or workflow.
|
|
592
592
|
- C-012 interactive TUI remains a future optional package if needed; it is not required for workflow feature completeness.
|
|
593
593
|
|
|
594
594
|
## Related APIs
|
package/docs/workflows.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
`@arnilo/prism-workflows` is an optional package for typed, bounded DAG orchestration over Prism sessions, tools, events, and persistence seams. Hosts define acyclic workflows with agent/function/tool/conditional/fan-out/join/nested-workflow/loop nodes; the package runs a Kahn-style scheduler with a bounded worker pool, emits package-local `WorkflowEvent`s, checkpoints progress, can coordinate queued runs across multiple host processes using durable leases and fencing, and can run bounded linear sagas with durable compensation.
|
|
5
|
+
`@arnilo/prism-core/runtime/workflows` is an optional package for typed, bounded DAG orchestration over Prism sessions, tools, events, and persistence seams. Hosts define acyclic workflows with agent/function/tool/conditional/fan-out/join/nested-workflow/loop nodes; the package runs a Kahn-style scheduler with a bounded worker pool, emits package-local `WorkflowEvent`s, checkpoints progress, can coordinate queued runs across multiple host processes using durable leases and fencing, and can run bounded linear sagas with durable compensation.
|
|
6
6
|
|
|
7
7
|
Primary exports:
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ Primary exports:
|
|
|
21
21
|
| `createWorkflowSchedules` | Explicit ownership-scoped one-time/interval/host-calculated schedules over existing checkpoint/lease stores |
|
|
22
22
|
| `createProactiveScheduleCapabilities` | Scoped, expiring, revocable capability tokens that enable proactive schedules; revocation stops firing fail-closed |
|
|
23
23
|
|
|
24
|
-
Included through `@arnilo/prism
|
|
24
|
+
Included through the `@arnilo/prism` / `@arnilo/prism-core` family packages; installing them does not start workflows. Interactive TUI is out of scope (C-012 deferred).
|
|
25
25
|
|
|
26
26
|
## When to use it
|
|
27
27
|
|
|
@@ -114,7 +114,7 @@ Saga statuses are `running → completed`, `running → compensating → compens
|
|
|
114
114
|
|
|
115
115
|
`createWorkflowSchedules({ store, leases, checkpoints, workflows, ownership, ownerId, calculators? })` is inert until its host calls `pollOnce()` or `run({ signal })`). Ownership requires `tenantId` plus `accountId` or `userId`. Methods are `create`, `get`, `list`, `pause`, `resume`, `trigger`, `delete`, `pollOnce`, and `run`. A record has one required `nextRunAt`, optional fixed `intervalMs` or registered `calculatorId` (never both), bounded input/metadata, status, version, and last-fire attribution. Manual trigger requires an idempotency key. Scheduled run IDs derive from schedule ID plus fire timestamp, so retry after enqueue-before-advance finds the same queued checkpoint instead of duplicating it. Defaults: page 100/hard 500, due claims 16/hard 256, input 256 KiB/hard 1 MiB, poll 1s, fire lease 30s.
|
|
116
116
|
|
|
117
|
-
`createProactiveScheduleCapabilities({ schedules, store, ownership, ownerId, defaultTtlMs?, maxTtlMs?, onCapability? })` wraps a `WorkflowSchedules` facade in explicit user enablement. `enable({ workflowId, scope, actor, nextRunAt, intervalMs?|calculatorId?, input?, ttlMs? })` creates the schedule plus a scoped, expiring `ScheduleCapabilityToken` (default TTL 24h / hard 31d, record ≤ 16 KiB) stamped with redacted actor refs. `revoke(tokenId, actor)` marks the token revoked and pauses the underlying schedule so `pollOnce()` never fires it (fail-closed). `assertActive(tokenId)` is a fail-closed guard for manual trigger paths — it throws on missing/revoked/expired tokens. `onCapability` emits `capability_enabled` / `capability_revoked` / `capability_denied` events (redacted refs only) that hosts bridge to `@arnilo/prism-policy` for an auditable ledger. Tokens are ownership-scoped checkpoint records; no cron expression or secret is persisted.
|
|
117
|
+
`createProactiveScheduleCapabilities({ schedules, store, ownership, ownerId, defaultTtlMs?, maxTtlMs?, onCapability? })` wraps a `WorkflowSchedules` facade in explicit user enablement. `enable({ workflowId, scope, actor, nextRunAt, intervalMs?|calculatorId?, input?, ttlMs? })` creates the schedule plus a scoped, expiring `ScheduleCapabilityToken` (default TTL 24h / hard 31d, record ≤ 16 KiB) stamped with redacted actor refs. `revoke(tokenId, actor)` marks the token revoked and pauses the underlying schedule so `pollOnce()` never fires it (fail-closed). `assertActive(tokenId)` is a fail-closed guard for manual trigger paths — it throws on missing/revoked/expired tokens. `onCapability` emits `capability_enabled` / `capability_revoked` / `capability_denied` events (redacted refs only) that hosts bridge to `@arnilo/prism-core/governance/policy` for an auditable ledger. Tokens are ownership-scoped checkpoint records; no cron expression or secret is persisted.
|
|
118
118
|
|
|
119
119
|
## Outputs / response / events
|
|
120
120
|
|
|
@@ -192,9 +192,9 @@ import {
|
|
|
192
192
|
runSaga,
|
|
193
193
|
workflowNode,
|
|
194
194
|
suspend,
|
|
195
|
-
} from "@arnilo/prism-workflows";
|
|
195
|
+
} from "@arnilo/prism-core/runtime/workflows";
|
|
196
196
|
import { runRpcServer } from "@arnilo/prism";
|
|
197
|
-
import { createSqlitePersistence } from "@arnilo/prism-
|
|
197
|
+
import { createSqlitePersistence } from "@arnilo/prism-core/sessions/sqlite";
|
|
198
198
|
|
|
199
199
|
const research = agentNode({
|
|
200
200
|
agent: "researcher",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arnilo/prism",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Agent harness for AI providers, agents, sessions, and tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -122,14 +122,15 @@
|
|
|
122
122
|
"CHANGELOG.md"
|
|
123
123
|
],
|
|
124
124
|
"workspaces": [
|
|
125
|
-
"packages/acp-agent",
|
|
126
|
-
"packages/ag-ui",
|
|
127
|
-
"packages/antigravity-agent",
|
|
128
125
|
"packages/mcp",
|
|
126
|
+
"packages/prism-providers",
|
|
129
127
|
"packages/memory",
|
|
128
|
+
"packages/prism-core",
|
|
129
|
+
"packages/prism-coding-tools",
|
|
130
130
|
"packages/office",
|
|
131
|
-
"packages/
|
|
132
|
-
"packages/web-tools"
|
|
131
|
+
"packages/ag-ui",
|
|
132
|
+
"packages/web-tools",
|
|
133
|
+
"packages/acp-agent"
|
|
133
134
|
],
|
|
134
135
|
"scripts": {
|
|
135
136
|
"build:core": "node scripts/with-build-lock.mjs tsc",
|
|
@@ -137,7 +138,8 @@
|
|
|
137
138
|
"build": "npm run build:core && npm run build --workspaces --if-present",
|
|
138
139
|
"typecheck": "npm run build && npm run typecheck --workspaces --if-present && tsc -p examples --noEmit",
|
|
139
140
|
"sweep:unused": "node scripts/sweep-unused.mjs --json",
|
|
140
|
-
"test": "
|
|
141
|
+
"test:live": "node scripts/live-matrix.mjs",
|
|
142
|
+
"test": "npm run build && node scripts/with-build-lock.mjs node --test dist/__tests__/*.test.js && node scripts/with-build-lock.mjs node --test scripts/release-gate.test.mjs scripts/tooling-gate.test.mjs scripts/budget-gate.test.mjs scripts/phase8-conformance.test.mjs scripts/phase9-conformance.test.mjs scripts/phase10-conformance.test.mjs scripts/phase11-conformance.test.mjs scripts/benchmark-0.1.0.test.mjs scripts/benchmark-multi-agent.test.mjs scripts/benchmark-tool-search.test.mjs scripts/benchmark-workflow-loop.test.mjs scripts/sweep-unused.test.mjs scripts/dead-export-verify.test.mjs scripts/e2e-enterprise-journey.test.mjs scripts/e2e-coding-journey.test.mjs scripts/e2e-full-surface.test.mjs scripts/phase23-quality-gates.test.mjs scripts/phase24-truth.test.mjs scripts/phase25-bounded-accumulation.test.mjs scripts/phase27-ha.test.mjs scripts/phase27-erp-journey.test.mjs scripts/phase37-provider-matrix.test.mjs scripts/phase26-index-benchmark.test.mjs scripts/obscura-host-conformance.test.mjs scripts/phase54-package-map.test.mjs scripts/phase54-legacy-registry.test.mjs scripts/truth-current.test.mjs scripts/packaging-current.test.mjs scripts/import-hygiene.test.mjs scripts/live-matrix.test.mjs scripts/e2e-coverage.test.mjs scripts/live-doc-check.test.mjs && node --test scripts/phase23-build-race.test.mjs && npm run test --workspaces --if-present",
|
|
141
143
|
"test:coverage": "node scripts/with-build-lock.mjs node --test --experimental-test-coverage --test-coverage-lines=60 --test-coverage-functions=70 --test-coverage-branches=75 --test-coverage-exclude='**/__tests__/**' --test-coverage-exclude='**/node_modules/**' --test-coverage-exclude='**/scripts/**' --test-coverage-exclude='**/packages/**' --test-coverage-exclude='**/examples/**' dist/__tests__/*.test.js && node scripts/with-build-lock.mjs node scripts/coverage-summary.mjs && node --test scripts/phase23-coverage.test.mjs && node --test scripts/phase23-skip-manifest.test.mjs",
|
|
142
144
|
"coverage:summary": "node scripts/with-build-lock.mjs node scripts/coverage-summary.mjs",
|
|
143
145
|
"lint": "biome lint . --reporter=sarif --reporter-file=scripts/lint-report.sarif",
|
|
@@ -145,6 +147,7 @@
|
|
|
145
147
|
"format:check": "biome format .",
|
|
146
148
|
"pack:dry-run": "npm pack --dry-run && npm run pack:dry-run --workspaces --if-present",
|
|
147
149
|
"test:postgres": "node scripts/require-postgres-url.mjs && npm run test:postgres --workspace @arnilo/prism-core --if-present && npm run test:postgres --workspace @arnilo/prism-memory && node --test scripts/phase7-conformance.test.mjs scripts/phase12-restart-recovery.test.mjs scripts/phase22-conformance.test.mjs",
|
|
150
|
+
"test:nats": "node scripts/require-nats-url.mjs && npm run test:nats --workspace @arnilo/prism-core --if-present",
|
|
148
151
|
"release:dry-run": "npm run sdk:ready",
|
|
149
152
|
"release:check": "node scripts/release.mjs check",
|
|
150
153
|
"release:publish": "node scripts/release.mjs publish",
|
|
@@ -154,7 +157,7 @@
|
|
|
154
157
|
"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 scripts/phase38-codeql-regression.test.mjs scripts/phase40-security.test.mjs scripts/phase46-webhooks-security.test.mjs dist/__tests__/pinned-fetch.test.js packages/prism-core/dist/runtime/server/__tests__/webhooks.test.js"
|
|
155
158
|
},
|
|
156
159
|
"devDependencies": {
|
|
157
|
-
"@biomejs/biome": "^2.5.
|
|
160
|
+
"@biomejs/biome": "^2.5.11",
|
|
158
161
|
"@types/node": "^26.1.1",
|
|
159
162
|
"typescript": "^7.0.2"
|
|
160
163
|
},
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"modelName": "gpt-5.1",
|
|
17
17
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createOpenAIResponsesProvider } from \"@arnilo/prism-providers/openai\";",
|
|
18
18
|
"providerExpression": "createOpenAIResponsesProvider({\n apiKey: () => process.env.OPENAI_API_KEY,\n })",
|
|
19
|
-
"modelExpression": "{ provider: \"openai\", model: \"gpt-5.1\" }"
|
|
19
|
+
"modelExpression": "{ provider: \"openai\", model: \"gpt-5.1\" }",
|
|
20
|
+
"factoryModule": "@arnilo/prism-providers/openai",
|
|
21
|
+
"factoryExport": "createOpenAIResponsesProvider"
|
|
20
22
|
},
|
|
21
23
|
"openrouter": {
|
|
22
24
|
"id": "openrouter",
|
|
@@ -27,7 +29,9 @@
|
|
|
27
29
|
"modelName": "anthropic/claude-sonnet-4",
|
|
28
30
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport {\n createOpenRouterProvider,\n defineOpenRouterModel,\n} from \"@arnilo/prism-providers/openrouter\";",
|
|
29
31
|
"providerExpression": "createOpenRouterProvider({\n apiKey: () => process.env.OPENROUTER_API_KEY,\n })",
|
|
30
|
-
"modelExpression": "defineOpenRouterModel({ model: \"anthropic/claude-sonnet-4\" })"
|
|
32
|
+
"modelExpression": "defineOpenRouterModel({ model: \"anthropic/claude-sonnet-4\" })",
|
|
33
|
+
"factoryModule": "@arnilo/prism-providers/openrouter",
|
|
34
|
+
"factoryExport": "createOpenRouterProvider"
|
|
31
35
|
},
|
|
32
36
|
"kimi": {
|
|
33
37
|
"id": "kimi",
|
|
@@ -38,7 +42,9 @@
|
|
|
38
42
|
"modelName": "kimi-k2.7-code",
|
|
39
43
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createKimiCodingProvider } from \"@arnilo/prism-providers/kimi\";",
|
|
40
44
|
"providerExpression": "createKimiCodingProvider({\n apiKey: () => process.env.KIMI_API_KEY,\n })",
|
|
41
|
-
"modelExpression": "{ provider: \"kimi-coding\", model: \"kimi-k2.7-code\" }"
|
|
45
|
+
"modelExpression": "{ provider: \"kimi-coding\", model: \"kimi-k2.7-code\" }",
|
|
46
|
+
"factoryModule": "@arnilo/prism-providers/kimi",
|
|
47
|
+
"factoryExport": "createKimiCodingProvider"
|
|
42
48
|
},
|
|
43
49
|
"zai": {
|
|
44
50
|
"id": "zai",
|
|
@@ -49,7 +55,9 @@
|
|
|
49
55
|
"modelName": "glm-4.7",
|
|
50
56
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createZaiProvider } from \"@arnilo/prism-providers/zai\";",
|
|
51
57
|
"providerExpression": "createZaiProvider({\n apiKey: () => process.env.ZAI_API_KEY,\n })",
|
|
52
|
-
"modelExpression": "{ provider: \"zai\", model: \"glm-4.7\" }"
|
|
58
|
+
"modelExpression": "{ provider: \"zai\", model: \"glm-4.7\" }",
|
|
59
|
+
"factoryModule": "@arnilo/prism-providers/zai",
|
|
60
|
+
"factoryExport": "createZaiProvider"
|
|
53
61
|
},
|
|
54
62
|
"opencode-go": {
|
|
55
63
|
"id": "opencode-go",
|
|
@@ -60,7 +68,9 @@
|
|
|
60
68
|
"modelName": "gpt-5.1-go",
|
|
61
69
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport { createOpenCodeGoProvider } from \"@arnilo/prism-providers/opencode-go\";",
|
|
62
70
|
"providerExpression": "createOpenCodeGoProvider({\n apiKey: () => process.env.OPENCODE_API_KEY,\n })",
|
|
63
|
-
"modelExpression": "{ provider: \"opencode-go\", model: \"gpt-5.1-go\", compat: { route: \"openai\" } }"
|
|
71
|
+
"modelExpression": "{ provider: \"opencode-go\", model: \"gpt-5.1-go\", compat: { route: \"openai\" } }",
|
|
72
|
+
"factoryModule": "@arnilo/prism-providers/opencode-go",
|
|
73
|
+
"factoryExport": "createOpenCodeGoProvider"
|
|
64
74
|
},
|
|
65
75
|
"neuralwatt": {
|
|
66
76
|
"id": "neuralwatt",
|
|
@@ -71,7 +81,9 @@
|
|
|
71
81
|
"modelName": "glm-5.2",
|
|
72
82
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport {\n createNeuralWattProvider,\n defineNeuralWattModel,\n} from \"@arnilo/prism-providers/neuralwatt\";",
|
|
73
83
|
"providerExpression": "createNeuralWattProvider({\n apiKey: () => process.env.NEURALWATT_API_KEY,\n })",
|
|
74
|
-
"modelExpression": "defineNeuralWattModel({\n model: \"glm-5.2\",\n cache: { kind: \"implicit\" },\n })"
|
|
84
|
+
"modelExpression": "defineNeuralWattModel({\n model: \"glm-5.2\",\n cache: { kind: \"implicit\" },\n })",
|
|
85
|
+
"factoryModule": "@arnilo/prism-providers/neuralwatt",
|
|
86
|
+
"factoryExport": "createNeuralWattProvider"
|
|
75
87
|
},
|
|
76
88
|
"alibaba": {
|
|
77
89
|
"id": "alibaba",
|
|
@@ -82,7 +94,9 @@
|
|
|
82
94
|
"modelName": "qwen-plus",
|
|
83
95
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport {\n createAlibabaProvider,\n defineAlibabaModel,\n} from \"@arnilo/prism-providers/alibaba\";",
|
|
84
96
|
"providerExpression": "createAlibabaProvider({\n apiKey: () => process.env.DASHSCOPE_API_KEY,\n })",
|
|
85
|
-
"modelExpression": "defineAlibabaModel({ model: \"qwen-plus\" })"
|
|
97
|
+
"modelExpression": "defineAlibabaModel({ model: \"qwen-plus\" })",
|
|
98
|
+
"factoryModule": "@arnilo/prism-providers/alibaba",
|
|
99
|
+
"factoryExport": "createAlibabaProvider"
|
|
86
100
|
},
|
|
87
101
|
"ollama": {
|
|
88
102
|
"id": "ollama",
|
|
@@ -93,6 +107,8 @@
|
|
|
93
107
|
"modelName": "gpt-oss:20b",
|
|
94
108
|
"imports": "import { createAgent } from \"@arnilo/prism\";\nimport {\n createOllamaProvider,\n defineOllamaModel,\n} from \"@arnilo/prism-providers/ollama\";",
|
|
95
109
|
"providerExpression": "createOllamaProvider({\n apiKey: () => process.env.OLLAMA_API_KEY,\n })",
|
|
96
|
-
"modelExpression": "defineOllamaModel({ model: \"gpt-oss:20b\" })"
|
|
110
|
+
"modelExpression": "defineOllamaModel({ model: \"gpt-oss:20b\" })",
|
|
111
|
+
"factoryModule": "@arnilo/prism-providers/ollama",
|
|
112
|
+
"factoryExport": "createOllamaProvider"
|
|
97
113
|
}
|
|
98
114
|
}
|
|
@@ -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.
|