@agen-ai/agent-runtime 0.2.5 → 0.3.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.
package/README.md CHANGED
@@ -3,20 +3,22 @@
3
3
  `@agen-ai/agent-runtime` is the process-local service-provider interface for coding-agent
4
4
  implementations. It preserves a small ownership chain: a driver parses host configuration and
5
5
  materializes an instance; the instance owns one opaque ID, technical capabilities, an adapter,
6
- an account-quota observation port, readiness, and disposal; the adapter opens provider-native
6
+ account-quota and environment discovery ports, readiness, and disposal; the adapter opens provider-native
7
7
  sessions; each returned session owns its binding and conversation-local operations.
8
8
 
9
9
  The runtime depends only on `@agen-ai/agent-protocol`. It has no concept of tenants, SaaS
10
10
  workspaces, assigned users, database rows, persistence sequence, visibility, billing, host boots,
11
11
  leases, or storage policy. A host must authorize and select an instance before calling this SPI.
12
- This source package implements Agent Protocol V8. Agent Protocol V8, private host V18/catalog V11, and Workspaces event V11/member response V12.
13
- This is intentionally one coordinated tuple rather than a deployable mixed-version graph.
12
+ This source package implements Agent Protocol V9 as part of the coordinated SDK `0.3.0` contract.
13
+ The SDK contract version is independent of private transport and product persistence versions. This
14
+ is intentionally one coordinated tuple rather than a deployable mixed-version graph.
14
15
 
15
16
  ## Entrypoints
16
17
 
17
18
  - `@agen-ai/agent-runtime` exports the public driver, instance, adapter, session, output,
18
19
  readiness, account-quota port validation, bounded-evidence, artifact-candidate,
19
20
  capability-bound interaction validation, and registry APIs.
21
+ - `@agen-ai/agent-runtime/environment` exports the instance discovery and session observation ports.
20
22
  - `@agen-ai/agent-runtime/testing` exports the deterministic fake provider and reusable
21
23
  conformance runner.
22
24
 
@@ -41,9 +43,9 @@ exactly once before returning the matching session. Capability-dependent operati
41
43
  `supported`/`unsupported` discriminants, and the runtime rejects handlers that disagree with the
42
44
  instance capability declaration.
43
45
 
44
- V8 replaces interaction-extension booleans with cohesive capability-matched session ports:
46
+ Sessions expose cohesive capability-matched ports:
45
47
  configuration inventory and selection, typed operation inventory and invocation, managed-content
46
- inventory, integration observation, collaboration spawn/control, and generated-resource access.
48
+ inventory, environment observation, collaboration spawn/control, and generated-resource access.
47
49
  An unsupported declaration exposes exactly `{ kind: "unsupported" }`; a supported declaration must
48
50
  expose exactly its typed handlers. Catalogs and results are parsed again at the runtime boundary,
49
51
  bounded by the declaration, and correlated to the offered revision and caller-owned identity.
@@ -170,6 +172,26 @@ The runtime distinguishes programmer/contract failures from provider failures:
170
172
  Provider-native exceptions should be normalized or safely wrapped at the provider boundary. Do
171
173
  not attach credentials, raw prompts, product identities, or unbounded output to public errors.
172
174
 
175
+ ## Scoped environment observation
176
+
177
+ `MaterializedAgentProviderInstance.environment` discovers a caller-selected workspace and
178
+ configuration. `AgentProviderSession.environment` observes the already bound session. Both ports
179
+ use exact `unsupported`, `read`, or `read_and_watch` variants and declare their observed domains.
180
+ Unsupported domains cannot expose methods or be returned as available observations.
181
+
182
+ Every read and watch receives an `AbortSignal` and a caller-supplied `environmentId`; snapshots and
183
+ invalidations must echo that identity. Discovery also requires a canonical absolute working directory
184
+ and validated session configuration. The runtime preserves method receivers and provider exceptions,
185
+ combines caller cancellation with instance/session lifetime, rejects operations after disposal, and
186
+ closes watch iterators with bounded cleanup. It does not accept late yields or concurrent pulls.
187
+ The optional read execution observer runs after prechecks immediately before native delegation.
188
+ An environment metadata error alone does not invalidate an otherwise healthy turn session.
189
+
190
+ Inventory observation never authorizes invocation. The host owns account/workspace scope, freshness,
191
+ visibility, immutable content admission, and durable mutation authority. Providers should obtain
192
+ registered facts from their native harness and report gaps explicitly; a successful empty inventory
193
+ must not stand in for a failed read. No provider is required to start a model turn for discovery.
194
+
173
195
  ## Conformance and release
174
196
 
175
197
  Every external driver should run `runAgentProviderConformance` from
@@ -179,15 +201,12 @@ turn/request ordering, request resolution, steering, interruption, configuration
179
201
  close, and idempotent disposal. Unsupported operations must remain explicit discriminants and
180
202
  must not expose handlers.
181
203
 
182
- The package is at `0.2.5` while the public SPI is being proven with external adapters. Pre-1.0
183
- releases may include breaking changes during this beta period, and those changes are called out in
184
- the release notes. Requiring `accountQuota` on every materialized instance is a source-level
185
- implementer change in the coordinated `0.2.5` release. Upgrade all three SDK packages together;
186
- there is no compatibility shim or optional-field fallback.
187
-
188
- The public runtime implements Agent Protocol V8. Its package version remains independent of private
189
- host, catalog, persistence, and member-projection versions. V8 directly replaces V7; there is no
190
- runtime shim or dual-protocol session surface.
204
+ The coordinated SDK version for this source is `0.3.0`, and the source implements Agent Protocol
205
+ V9. The earlier public `0.2.5` release is historical. Upgrade all three SDK packages together. Every materialized instance requires `environment` and
206
+ `accountQuota`; every session requires `environment`. The former standalone `integrations`
207
+ observation port is removed. The public runtime implements Agent Protocol V9 with one current
208
+ adapter/session surface. Package versions remain independent of private transport and product
209
+ persistence versions.
191
210
 
192
211
  Run the clean packed-consumer proof before any release:
193
212
 
@@ -0,0 +1,3 @@
1
+ export * from "./types.js";
2
+ export * from "./validation.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from "./types.js";
2
+ export * from "./validation.js";
@@ -0,0 +1,59 @@
1
+ import type { AgentEnvironmentDomain, AgentEnvironmentId, AgentEnvironmentInvalidation, AgentEnvironmentSnapshot, AgentSessionConfiguration } from "@agen-ai/agent-protocol";
2
+ import type { AgentProviderExecutionStartedObserver } from "../sessions.js";
3
+ /** Input supplied when a materialized instance discovers its host-scoped environment. */
4
+ export interface AgentEnvironmentDiscoveryInput {
5
+ readonly signal: AbortSignal;
6
+ readonly environmentId: AgentEnvironmentId;
7
+ readonly workingDirectory: string;
8
+ readonly configuration: AgentSessionConfiguration;
9
+ /** Runtime receipt invoked immediately before the provider read candidate. */
10
+ readonly onProviderExecutionStarted?: AgentProviderExecutionStartedObserver;
11
+ }
12
+ /** Input supplied to a discovery watch. Watches have no provider-start receipt. */
13
+ export interface AgentEnvironmentDiscoveryWatchInput {
14
+ readonly signal: AbortSignal;
15
+ readonly environmentId: AgentEnvironmentId;
16
+ readonly workingDirectory: string;
17
+ readonly configuration: AgentSessionConfiguration;
18
+ }
19
+ /** Input supplied when an opened provider session observes its bound environment. */
20
+ export interface AgentEnvironmentObservationInput {
21
+ readonly signal: AbortSignal;
22
+ readonly environmentId: AgentEnvironmentId;
23
+ /** Runtime receipt invoked immediately before the provider read candidate. */
24
+ readonly onProviderExecutionStarted?: AgentProviderExecutionStartedObserver;
25
+ }
26
+ /** Input supplied to an observation watch. Watches have no provider-start receipt. */
27
+ export interface AgentEnvironmentObservationWatchInput {
28
+ readonly signal: AbortSignal;
29
+ readonly environmentId: AgentEnvironmentId;
30
+ }
31
+ export type AgentEnvironmentDiscovery = (input: AgentEnvironmentDiscoveryInput) => Promise<AgentEnvironmentSnapshot>;
32
+ export type AgentEnvironmentObservation = (input: AgentEnvironmentObservationInput) => Promise<AgentEnvironmentSnapshot>;
33
+ export type AgentEnvironmentDiscoveryWatch = (input: AgentEnvironmentDiscoveryWatchInput) => AsyncIterable<AgentEnvironmentInvalidation>;
34
+ export type AgentEnvironmentObservationWatch = (input: AgentEnvironmentObservationWatchInput) => AsyncIterable<AgentEnvironmentInvalidation>;
35
+ export type AgentEnvironmentDiscoveryPort = Readonly<{
36
+ kind: "unsupported";
37
+ }> | Readonly<{
38
+ kind: "read";
39
+ domains: readonly AgentEnvironmentDomain[];
40
+ readEnvironment: AgentEnvironmentDiscovery;
41
+ }> | Readonly<{
42
+ kind: "read_and_watch";
43
+ domains: readonly AgentEnvironmentDomain[];
44
+ readEnvironment: AgentEnvironmentDiscovery;
45
+ watchEnvironment: AgentEnvironmentDiscoveryWatch;
46
+ }>;
47
+ export type AgentEnvironmentObservationPort = Readonly<{
48
+ kind: "unsupported";
49
+ }> | Readonly<{
50
+ kind: "read";
51
+ domains: readonly AgentEnvironmentDomain[];
52
+ readEnvironment: AgentEnvironmentObservation;
53
+ }> | Readonly<{
54
+ kind: "read_and_watch";
55
+ domains: readonly AgentEnvironmentDomain[];
56
+ readEnvironment: AgentEnvironmentObservation;
57
+ watchEnvironment: AgentEnvironmentObservationWatch;
58
+ }>;
59
+ //# sourceMappingURL=types.d.ts.map
File without changes
@@ -0,0 +1,17 @@
1
+ import { type AgentCapabilities, type AgentProviderKey } from "@agen-ai/agent-protocol";
2
+ import type { AgentEnvironmentDiscoveryPort, AgentEnvironmentObservationPort } from "./types.js";
3
+ /** Maximum time allowed for a native watch iterator's return method to settle. */
4
+ export declare const AGENT_ENVIRONMENT_ITERATOR_CLEANUP_TIMEOUT_MS = 1000;
5
+ export declare function validateAgentEnvironmentDiscoveryPort(input: Readonly<{
6
+ readonly providerKey: AgentProviderKey;
7
+ readonly capability: AgentCapabilities["environment"]["instance"];
8
+ readonly port: unknown;
9
+ readonly signal: AbortSignal;
10
+ }>): AgentEnvironmentDiscoveryPort;
11
+ export declare function validateAgentEnvironmentObservationPort(input: Readonly<{
12
+ readonly providerKey: AgentProviderKey;
13
+ readonly capability: AgentCapabilities["environment"]["session"];
14
+ readonly port: unknown;
15
+ readonly signal: AbortSignal;
16
+ }>): AgentEnvironmentObservationPort;
17
+ //# sourceMappingURL=validation.d.ts.map