@agentplat/runtime 0.3.0-beta.2 → 0.3.0-beta.3

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 (42) hide show
  1. package/README.md +63 -0
  2. package/dist/adapter-bridge.d.ts +14 -0
  3. package/dist/adapter-bridge.d.ts.map +1 -0
  4. package/dist/adapter-bridge.js +267 -0
  5. package/dist/adapter-bridge.js.map +1 -0
  6. package/dist/adapter-contracts.d.ts +351 -0
  7. package/dist/adapter-contracts.d.ts.map +1 -0
  8. package/dist/adapter-contracts.js +2 -0
  9. package/dist/adapter-contracts.js.map +1 -0
  10. package/dist/adapter-errors.d.ts +6 -0
  11. package/dist/adapter-errors.d.ts.map +1 -0
  12. package/dist/adapter-errors.js +9 -0
  13. package/dist/adapter-errors.js.map +1 -0
  14. package/dist/adapter-registry.d.ts +25 -0
  15. package/dist/adapter-registry.d.ts.map +1 -0
  16. package/dist/adapter-registry.js +116 -0
  17. package/dist/adapter-registry.js.map +1 -0
  18. package/dist/adapter-runtime.d.ts +41 -0
  19. package/dist/adapter-runtime.d.ts.map +1 -0
  20. package/dist/adapter-runtime.js +591 -0
  21. package/dist/adapter-runtime.js.map +1 -0
  22. package/dist/adapter-store.d.ts +9 -0
  23. package/dist/adapter-store.d.ts.map +1 -0
  24. package/dist/adapter-store.js +26 -0
  25. package/dist/adapter-store.js.map +1 -0
  26. package/dist/adapter-validation.d.ts +39 -0
  27. package/dist/adapter-validation.d.ts.map +1 -0
  28. package/dist/adapter-validation.js +853 -0
  29. package/dist/adapter-validation.js.map +1 -0
  30. package/dist/adapter.d.ts +9 -0
  31. package/dist/adapter.d.ts.map +1 -0
  32. package/dist/adapter.js +9 -0
  33. package/dist/adapter.js.map +1 -0
  34. package/dist/cognitive-adapter.d.ts +259 -0
  35. package/dist/cognitive-adapter.d.ts.map +1 -0
  36. package/dist/cognitive-adapter.js +813 -0
  37. package/dist/cognitive-adapter.js.map +1 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -0
  41. package/dist/index.js.map +1 -1
  42. package/package.json +13 -5
package/README.md CHANGED
@@ -29,3 +29,66 @@ the call can be retried: reject those operations when `runId` is absent and
29
29
  reuse the same value across every retry. Forward it to providers that support
30
30
  idempotency keys, or use it in the adapter's deduplication mechanism, so one
31
31
  logical run cannot apply the same effect twice.
32
+
33
+ ## Durable cognitive effects
34
+
35
+ `CognitiveAgentRuntimeV2` treats `memory_mutation` and `tool` as effectful. An
36
+ adapter that advertises either operation must provide both an explicit
37
+ `CognitiveDurableOperationStoreV2` and a `CognitiveEffectSinkV2`; construction
38
+ fails closed when either boundary is absent. The runtime never dispatches these
39
+ operations through the adapter's general `execute` method.
40
+
41
+ Before dispatch, the durable store atomically reserves the tuple
42
+ `tenantId/sessionId/operationId`, binds it to the complete request digest, and
43
+ claims the expected session revision. The sink receives a stable idempotency
44
+ key and request digest. Its `apply` implementation must atomically deduplicate
45
+ that pair, while `lookup` must return the durable sink receipt/result for crash
46
+ reconciliation. The store then atomically moves the operation from `prepared`
47
+ to `applied` together with the session-state CAS. Replays return the recorded
48
+ outcome, conflicting request digests fail, and a second operation cannot spend
49
+ the same session revision. Durable operation records omit request payloads but
50
+ retain the applied result and original outcome for exact replay, so production
51
+ stores must encrypt and govern that output according to its data classification.
52
+ A `prepared` record whose sink state cannot be established remains claimed and
53
+ blocks that session revision; operators must reconcile it rather than deleting
54
+ the reservation and risking a duplicate effect.
55
+
56
+ This protocol prevents duplicate logical application only when the configured
57
+ sink honors its idempotency contract. It does not claim exactly-once delivery
58
+ to an arbitrary external system: integrations must use an idempotent downstream
59
+ API or durably reconcile their own receipt before reporting success. The
60
+ in-memory store is intended for local execution and deterministic tests; a
61
+ multi-process deployment must supply a transactional durable implementation.
62
+
63
+ ## Portable heterogeneous agents
64
+
65
+ `@agentplat/runtime/adapter` adds a stateful protocol for language, vision,
66
+ action, policy, symbolic, hybrid and custom agents. A manifest declares the
67
+ modalities, interaction modes, cancellation behavior and recovery support of
68
+ one immutable adapter implementation. Applications negotiate those capabilities
69
+ before opening a session, so incompatible peers fail before execution.
70
+
71
+ `PortableAgentSessionRuntimeV1` binds every session to an adapter implementation,
72
+ a versioned local control implementation and a revisioned role. Each step uses
73
+ compare-and-set state, a stable idempotency key and explicit source zones for
74
+ observations. Outputs and inert action proposals remain withheld until the
75
+ configured control approves the relevant pre-step, post-output and pre-action
76
+ checkpoints. Control errors fail closed.
77
+
78
+ Sessions can be paused, checkpointed, restored, assigned a successor role and
79
+ closed. Adapters may implement the paired `exportCheckpoint` and
80
+ `importCheckpoint` hooks to move portable application state between unused
81
+ sessions bound to the exact same adapter version and implementation. Imports
82
+ are digest-checked, pause before restore and are idempotent for the same
83
+ transfer. Role updates must form an unbroken revision chain for the same
84
+ objective. Ephemeral credentials are supplied only to the adapter call and are
85
+ never persisted, exported or shown to controls.
86
+
87
+ Two bridges connect this protocol to the existing runtime:
88
+
89
+ - `createAgentRuntimePortableAdapterV1` exposes an existing `AgentRuntime`
90
+ agent through the portable protocol without granting tool calls action
91
+ authority.
92
+ - `createPortableAgentProviderV1` exposes a portable session as an
93
+ `AgentProvider`, allowing workflows and collectives to use the controlled,
94
+ stateful execution path through `DefaultAgentRuntime`.
@@ -0,0 +1,14 @@
1
+ import type { AgentProvider } from "./index.js";
2
+ import type { AgentRuntimePortableAdapterOptionsV1, PortableAgentAdapterManifestV1, PortableAgentAdapterV1, PortableAgentProviderOptionsV1 } from "./adapter-contracts.js";
3
+ export interface AgentRuntimePortableAdapterV1 {
4
+ readonly manifest: PortableAgentAdapterManifestV1;
5
+ readonly adapter: PortableAgentAdapterV1;
6
+ }
7
+ /** Adapt an existing AgentRuntime agent to the stateful portable protocol. */
8
+ export declare function createAgentRuntimePortableAdapterV1(options: AgentRuntimePortableAdapterOptionsV1): AgentRuntimePortableAdapterV1;
9
+ /**
10
+ * Adapt portable sessions back into an AgentProvider. Register the result on a
11
+ * DefaultAgentRuntime to make collective and workflow callers session-aware.
12
+ */
13
+ export declare function createPortableAgentProviderV1(options: PortableAgentProviderOptionsV1): AgentProvider;
14
+ //# sourceMappingURL=adapter-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-bridge.d.ts","sourceRoot":"","sources":["../src/adapter-bridge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,aAAa,EAId,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,oCAAoC,EAEpC,8BAA8B,EAE9B,sBAAsB,EAEtB,8BAA8B,EAE/B,MAAM,wBAAwB,CAAC;AAWhC,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;CAC1C;AAED,8EAA8E;AAC9E,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,oCAAoC,GAC5C,6BAA6B,CAqH/B;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,aAAa,CAwFf"}
@@ -0,0 +1,267 @@
1
+ import { PortableAgentErrorV1 } from "./adapter-errors.js";
2
+ import { cloneAndFreeze, identifier, normalizeAdapterManifestV1, normalizeJson, normalizeJsonObject, normalizeMetadata, } from "./adapter-validation.js";
3
+ /** Adapt an existing AgentRuntime agent to the stateful portable protocol. */
4
+ export function createAgentRuntimePortableAdapterV1(options) {
5
+ if (!options || typeof options !== "object") {
6
+ throw validation("AgentRuntime adapter options are required");
7
+ }
8
+ if (!options.runtime || typeof options.runtime.run !== "function") {
9
+ throw validation("runtime.run is required");
10
+ }
11
+ if (!options.agent || typeof options.agent !== "object") {
12
+ throw validation("agent definition is required");
13
+ }
14
+ const manifest = normalizeAdapterManifestV1(options.manifest);
15
+ if (!manifest.interactionModes.includes("invoke")) {
16
+ throw validation("AgentRuntime bridge requires invoke interaction support");
17
+ }
18
+ if (manifest.supportsCheckpoint || manifest.supportsRestore) {
19
+ throw validation("AgentRuntime bridge does not implement checkpoint or restore");
20
+ }
21
+ if (manifest.outputModalities.some((modality) => modality !== "text" && modality !== "structured")) {
22
+ throw validation("AgentRuntime bridge can declare only text and structured outputs");
23
+ }
24
+ const adapter = Object.freeze({
25
+ async step(input, context) {
26
+ if (input.tenantId !== context.tenant.tenantId ||
27
+ input.agentId !== context.agentId ||
28
+ input.sessionId !== context.sessionId ||
29
+ input.request.stepId !== context.stepId) {
30
+ throw validation("portable adapter context binding is invalid");
31
+ }
32
+ if (options.agent.tenantId !== input.tenantId) {
33
+ throw validation("agent definition belongs to a different tenant");
34
+ }
35
+ const structuredInput = [
36
+ normalizeJsonObject({
37
+ portableType: "role",
38
+ roleBindingId: input.role.roleBindingId,
39
+ roleRevision: input.role.roleRevision,
40
+ objectiveId: input.role.objectiveId,
41
+ roleKey: input.role.roleKey,
42
+ instructions: input.role.instructions,
43
+ constraints: input.role.constraints,
44
+ }, "portable role input"),
45
+ ...input.request.observations.map((observation) => normalizeJsonObject({
46
+ portableType: "observation",
47
+ observationId: observation.observationId,
48
+ sourceZone: observation.sourceZone,
49
+ sourceId: observation.sourceId,
50
+ modality: observation.modality,
51
+ content: observation.content,
52
+ contentReference: observation.contentReference,
53
+ provenance: observation.provenance,
54
+ observedAtLogicalMs: observation.observedAtLogicalMs,
55
+ }, "portable observation input")),
56
+ ...(input.request.input === null
57
+ ? []
58
+ : [
59
+ normalizeJsonObject({
60
+ portableType: "step_input",
61
+ content: input.request.input,
62
+ }, "portable step input"),
63
+ ]),
64
+ ];
65
+ const result = await options.runtime.run(options.agent, {
66
+ input: structuredInput,
67
+ mode: "invoke",
68
+ metadata: normalizeMetadata({
69
+ portableSessionId: input.sessionId,
70
+ portableRoleBindingId: input.role.roleBindingId,
71
+ portableStepSequence: input.stepSequence,
72
+ }, "portable run metadata"),
73
+ }, {
74
+ tenant: context.tenant,
75
+ runId: input.request.stepId,
76
+ agentId: input.agentId,
77
+ signal: context.signal,
78
+ credentials: context.credentials === undefined
79
+ ? undefined
80
+ : { ...context.credentials },
81
+ policies: input.role.constraints,
82
+ metadata: context.metadata,
83
+ });
84
+ return mapAgentRunResult(input, result, manifest);
85
+ },
86
+ });
87
+ return Object.freeze({ manifest, adapter });
88
+ }
89
+ /**
90
+ * Adapt portable sessions back into an AgentProvider. Register the result on a
91
+ * DefaultAgentRuntime to make collective and workflow callers session-aware.
92
+ */
93
+ export function createPortableAgentProviderV1(options) {
94
+ if (!options || typeof options !== "object") {
95
+ throw validation("portable provider options are required");
96
+ }
97
+ if (!options.sessionRuntime ||
98
+ typeof options.sessionRuntime.getSession !== "function" ||
99
+ typeof options.sessionRuntime.step !== "function") {
100
+ throw validation("portable session runtime is required");
101
+ }
102
+ if (typeof options.resolveSessionId !== "function") {
103
+ throw validation("resolveSessionId is required");
104
+ }
105
+ const logicalClock = options.logicalClock ?? (() => Date.now());
106
+ return Object.freeze({
107
+ async run(agent, input, context) {
108
+ if (!context.runId) {
109
+ throw validation("RuntimeExecutionContext.runId is required for portable session idempotency");
110
+ }
111
+ const sessionId = identifier(options.resolveSessionId(agent), "sessionId");
112
+ const session = await options.sessionRuntime.getSession(sessionId);
113
+ if (!session) {
114
+ throw new PortableAgentErrorV1("NOT_FOUND", `session "${sessionId}" was not found`);
115
+ }
116
+ if (session.tenantId !== context.tenant.tenantId ||
117
+ session.agentId !== agent.id ||
118
+ context.agentId !== agent.id) {
119
+ throw validation("portable provider session binding is invalid");
120
+ }
121
+ const requestedOutputModalities = ["text", "structured"].filter((modality) => session.manifest.outputModalities.includes(modality));
122
+ if (requestedOutputModalities.length === 0) {
123
+ throw new PortableAgentErrorV1("ADAPTER_INCOMPATIBLE", "portable AgentProvider requires text or structured output support");
124
+ }
125
+ const logicalTimeMs = logicalClock();
126
+ if (!Number.isSafeInteger(logicalTimeMs) || logicalTimeMs < 0) {
127
+ throw validation("logicalClock must return a non-negative safe integer");
128
+ }
129
+ const mappedInput = options.mapInput
130
+ ? normalizeJsonObject(options.mapInput(input), "mapped agent input")
131
+ : defaultMapInput(input);
132
+ const outcome = await options.sessionRuntime.step(sessionId, {
133
+ schemaVersion: 1,
134
+ stepId: context.runId,
135
+ expectedSessionRevision: session.revision,
136
+ interactionMode: "invoke",
137
+ observations: [],
138
+ input: mappedInput,
139
+ requestedOutputModalities,
140
+ logicalTimeMs,
141
+ }, {
142
+ signal: context.signal,
143
+ tenant: context.tenant,
144
+ credentials: context.credentials,
145
+ metadata: context.metadata,
146
+ });
147
+ return mapPortableResult(context.runId, outcome.record.result);
148
+ },
149
+ });
150
+ }
151
+ function mapAgentRunResult(input, result, manifest) {
152
+ const base = {
153
+ schemaVersion: 1,
154
+ sessionId: input.sessionId,
155
+ stepId: input.request.stepId,
156
+ stepSequence: input.stepSequence,
157
+ checkpoint: null,
158
+ metadata: normalizeMetadata(result.metadata ?? {}, "agent result metadata"),
159
+ };
160
+ if (result.status !== "completed") {
161
+ return cloneAndFreeze({
162
+ ...base,
163
+ status: result.status === "canceled"
164
+ ? "paused"
165
+ : "failed",
166
+ outputs: [],
167
+ actionProposals: [],
168
+ reasonCode: result.status === "canceled"
169
+ ? "agent_run_canceled"
170
+ : "agent_run_failed",
171
+ });
172
+ }
173
+ const requested = new Set(input.request.requestedOutputModalities);
174
+ const outputs = [];
175
+ if (result.output !== undefined &&
176
+ requested.has("text") &&
177
+ manifest.outputModalities.includes("text")) {
178
+ outputs.push({
179
+ schemaVersion: 1,
180
+ outputId: `${input.request.stepId}:text`,
181
+ modality: "text",
182
+ content: result.output,
183
+ contentReference: null,
184
+ metadata: {},
185
+ });
186
+ }
187
+ if (result.result !== undefined &&
188
+ requested.has("structured") &&
189
+ manifest.outputModalities.includes("structured")) {
190
+ outputs.push({
191
+ schemaVersion: 1,
192
+ outputId: `${input.request.stepId}:structured`,
193
+ modality: "structured",
194
+ content: normalizeJsonObject(result.result, "agent structured result"),
195
+ contentReference: null,
196
+ metadata: {},
197
+ });
198
+ }
199
+ if (outputs.length === 0) {
200
+ return cloneAndFreeze({
201
+ ...base,
202
+ status: "failed",
203
+ outputs: [],
204
+ actionProposals: [],
205
+ reasonCode: "empty_agent_result",
206
+ });
207
+ }
208
+ return cloneAndFreeze({
209
+ ...base,
210
+ status: "completed",
211
+ outputs,
212
+ actionProposals: [],
213
+ reasonCode: null,
214
+ });
215
+ }
216
+ function mapPortableResult(runId, result) {
217
+ const textOutput = result.outputs.find((output) => output.modality === "text" && typeof output.content === "string");
218
+ const structuredOutput = result.outputs.find((output) => output.modality === "structured" &&
219
+ output.content !== null &&
220
+ typeof output.content === "object" &&
221
+ !Array.isArray(output.content));
222
+ const status = result.status === "completed"
223
+ ? "completed"
224
+ : result.status === "paused"
225
+ ? "canceled"
226
+ : "failed";
227
+ return cloneAndFreeze({
228
+ runId,
229
+ status,
230
+ ...(textOutput === undefined
231
+ ? {}
232
+ : { output: textOutput.content }),
233
+ ...(structuredOutput === undefined
234
+ ? {}
235
+ : { result: structuredOutput.content }),
236
+ ...(status === "completed"
237
+ ? {}
238
+ : {
239
+ errorMessage: `Portable agent step ${result.status}: ${result.reasonCode ?? "unknown"}`,
240
+ }),
241
+ metadata: normalizeMetadata({
242
+ portableSessionId: result.sessionId,
243
+ portableStepSequence: result.stepSequence,
244
+ portableStatus: result.status,
245
+ portableActionProposalCount: result.actionProposals.length,
246
+ }, "portable provider metadata"),
247
+ });
248
+ }
249
+ function defaultMapInput(input) {
250
+ const metadata = normalizeMetadata(input.metadata ?? {}, "agent input metadata");
251
+ const value = {
252
+ input: normalizeJson(input.input, "agent input"),
253
+ mode: input.mode ?? "invoke",
254
+ metadata,
255
+ };
256
+ if (input.conversationId !== undefined) {
257
+ value.conversationId = input.conversationId;
258
+ }
259
+ if (input.attachments !== undefined) {
260
+ value.attachments = normalizeJson(input.attachments, "agent attachments");
261
+ }
262
+ return normalizeJsonObject(value, "agent input envelope");
263
+ }
264
+ function validation(message) {
265
+ return new PortableAgentErrorV1("VALIDATION_ERROR", message);
266
+ }
267
+ //# sourceMappingURL=adapter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