@arnilo/prism-supervisor 0.0.12 → 0.0.14
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 +13 -0
- package/dist/a2a-server.js +19 -2
- package/dist/a2a-types.d.ts +3 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/a2a-server.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertIdentityActive, assertIdentityMatchesOwnership } from "@arnilo/prism";
|
|
1
2
|
import { createA2AAgentCard } from "./a2a-card.js";
|
|
2
3
|
import { bounded, optionalCursor, parseA2AMessage, record, requireId, resolveA2ALimits, validateA2ATask } from "./a2a-parts.js";
|
|
3
4
|
import { A2AError } from "./errors.js";
|
|
@@ -39,6 +40,15 @@ export function createA2AHandler(options) {
|
|
|
39
40
|
const authorization = await abortable(Promise.resolve(options.authorize({ request, method: rpc.method, signal: owned.signal })), owned.signal);
|
|
40
41
|
if (!authorization)
|
|
41
42
|
return errorResponse(403, "Forbidden", rpc.id);
|
|
43
|
+
if (authorization.identity) {
|
|
44
|
+
try {
|
|
45
|
+
assertIdentityActive(authorization.identity);
|
|
46
|
+
assertIdentityMatchesOwnership(authorization.identity, authorization.ownership);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return errorResponse(403, "Forbidden", rpc.id);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
42
52
|
if (rpc.method === "GetExtendedAgentCard")
|
|
43
53
|
return card.capabilities.extendedAgentCard ? json(rpc.id, card, limits, options) : rpcError(rpc.id, -32004, "Extended Agent Card unavailable");
|
|
44
54
|
if (rpc.method === "SendMessage" || rpc.method === "SendStreamingMessage") {
|
|
@@ -57,10 +67,17 @@ export function createA2AHandler(options) {
|
|
|
57
67
|
const input = message.parts.map((part) => part.text).join("\n");
|
|
58
68
|
const session = await abortable(Promise.resolve(options.exposure.sessionFactory(authorization)), owned.signal);
|
|
59
69
|
const taskId = `task-${crypto.randomUUID()}`, contextId = message.contextId ?? `context-${crypto.randomUUID()}`;
|
|
70
|
+
const runOptions = {
|
|
71
|
+
ownership: authorization.ownership,
|
|
72
|
+
identity: authorization.identity,
|
|
73
|
+
metadata: authorization.metadata,
|
|
74
|
+
signal: owned.signal,
|
|
75
|
+
redactor: options.redactor,
|
|
76
|
+
};
|
|
60
77
|
if (rpc.method === "SendMessage")
|
|
61
|
-
return json(rpc.id, { task: toTask(taskId, contextId, await abortable(session.run(input,
|
|
78
|
+
return json(rpc.id, { task: toTask(taskId, contextId, await abortable(session.run(input, runOptions), owned.signal), options) }, limits, options);
|
|
62
79
|
transferred = true;
|
|
63
|
-
const events = runEvents(taskId, contextId, () => session.run(input,
|
|
80
|
+
const events = runEvents(taskId, contextId, () => session.run(input, runOptions), options);
|
|
64
81
|
return streamResponse(rpc.id, events, owned, limits, options, () => { active -= 1; });
|
|
65
82
|
}
|
|
66
83
|
if (["GetTask", "ListTasks", "CancelTask", "SubscribeToTask"].includes(rpc.method)) {
|
package/dist/a2a-types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentRunResult, AgentSession, OwnershipScope, SecretRedactor } from "@arnilo/prism";
|
|
1
|
+
import type { AgentIdentity, AgentRunResult, AgentSession, OwnershipScope, SecretRedactor } from "@arnilo/prism";
|
|
2
2
|
export declare const A2A_PROTOCOL_VERSION = "1.0";
|
|
3
3
|
export interface A2AAgentInterface {
|
|
4
4
|
readonly url: string;
|
|
@@ -132,6 +132,8 @@ export interface A2AJsonRpcResponse {
|
|
|
132
132
|
}
|
|
133
133
|
export interface A2AAuthorization {
|
|
134
134
|
readonly ownership: OwnershipScope;
|
|
135
|
+
/** Host-verified identity; when set must project onto ownership without widening. */
|
|
136
|
+
readonly identity?: AgentIdentity;
|
|
135
137
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
136
138
|
}
|
|
137
139
|
export type A2AAuthorizer = (input: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arnilo/prism-supervisor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Bounded supervisor delegation and A2A 1.0 durable task, rich-part, reconnect, and push interoperability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"pack:dry-run": "npm pack --dry-run"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@arnilo/prism": "0.0.
|
|
28
|
+
"@arnilo/prism": "0.0.14"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@arnilo/prism": "file:../.."
|