@agen-ai/agent-runtime 0.2.5 → 0.3.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/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.1` 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,15 @@ 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
+ Authentication is adapter-owned. The public runtime does not require an API key or prefer one
47
+ credential mechanism over another: an adapter may use an existing subscription login, an
48
+ interactive account flow, an API credential, or another provider-supported mechanism. The host
49
+ owns authorization to select that adapter and must keep provider-native credentials, account
50
+ paths, and login controls outside the public SDK contracts.
51
+
52
+ Sessions expose cohesive capability-matched ports:
45
53
  configuration inventory and selection, typed operation inventory and invocation, managed-content
46
- inventory, integration observation, collaboration spawn/control, and generated-resource access.
54
+ inventory, environment observation, collaboration spawn/control, and generated-resource access.
47
55
  An unsupported declaration exposes exactly `{ kind: "unsupported" }`; a supported declaration must
48
56
  expose exactly its typed handlers. Catalogs and results are parsed again at the runtime boundary,
49
57
  bounded by the declaration, and correlated to the offered revision and caller-owned identity.
@@ -170,6 +178,26 @@ The runtime distinguishes programmer/contract failures from provider failures:
170
178
  Provider-native exceptions should be normalized or safely wrapped at the provider boundary. Do
171
179
  not attach credentials, raw prompts, product identities, or unbounded output to public errors.
172
180
 
181
+ ## Scoped environment observation
182
+
183
+ `MaterializedAgentProviderInstance.environment` discovers a caller-selected workspace and
184
+ configuration. `AgentProviderSession.environment` observes the already bound session. Both ports
185
+ use exact `unsupported`, `read`, or `read_and_watch` variants and declare their observed domains.
186
+ Unsupported domains cannot expose methods or be returned as available observations.
187
+
188
+ Every read and watch receives an `AbortSignal` and a caller-supplied `environmentId`; snapshots and
189
+ invalidations must echo that identity. Discovery also requires a canonical absolute working directory
190
+ and validated session configuration. The runtime preserves method receivers and provider exceptions,
191
+ combines caller cancellation with instance/session lifetime, rejects operations after disposal, and
192
+ closes watch iterators with bounded cleanup. It does not accept late yields or concurrent pulls.
193
+ The optional read execution observer runs after prechecks immediately before native delegation.
194
+ An environment metadata error alone does not invalidate an otherwise healthy turn session.
195
+
196
+ Inventory observation never authorizes invocation. The host owns account/workspace scope, freshness,
197
+ visibility, immutable content admission, and durable mutation authority. Providers should obtain
198
+ registered facts from their native harness and report gaps explicitly; a successful empty inventory
199
+ must not stand in for a failed read. No provider is required to start a model turn for discovery.
200
+
173
201
  ## Conformance and release
174
202
 
175
203
  Every external driver should run `runAgentProviderConformance` from
@@ -179,15 +207,13 @@ turn/request ordering, request resolution, steering, interruption, configuration
179
207
  close, and idempotent disposal. Unsupported operations must remain explicit discriminants and
180
208
  must not expose handlers.
181
209
 
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.
210
+ The coordinated SDK version for this source is `0.3.1`, and the source implements Agent Protocol
211
+ V9. The earlier public `0.3.0` release implemented the same protocol and remains historical.
212
+ Upgrade all three SDK packages together. Every materialized instance requires `environment` and
213
+ `accountQuota`; every session requires `environment`. The former standalone `integrations`
214
+ observation port is removed. The public runtime implements Agent Protocol V9 with one current
215
+ adapter/session surface. Package versions remain independent of private transport and product
216
+ persistence versions.
191
217
 
192
218
  Run the clean packed-consumer proof before any release:
193
219
 
@@ -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