@peac/adapter-managed-agents 0.12.9
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/LICENSE +190 -0
- package/README.md +52 -0
- package/dist/constants.d.ts +24 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/event-families.d.ts +20 -0
- package/dist/event-families.d.ts.map +1 -0
- package/dist/index.cjs +154 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +140 -0
- package/dist/index.mjs.map +1 -0
- package/dist/issue-event.d.ts +49 -0
- package/dist/issue-event.d.ts.map +1 -0
- package/dist/session-summary.d.ts +22 -0
- package/dist/session-summary.d.ts.map +1 -0
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025-2026 PEAC Protocol Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @peac/adapter-managed-agents
|
|
2
|
+
|
|
3
|
+
Vendor-neutral adapter for managed agent runtime event evidence. Maps 6 event families to signed PEAC Interaction Records.
|
|
4
|
+
|
|
5
|
+
## Event Families
|
|
6
|
+
|
|
7
|
+
| Family | Type URI | Kind |
|
|
8
|
+
| ----------------------- | ------------------------------------------- | -------- |
|
|
9
|
+
| Session lifecycle | `org.peacprotocol/managed-agent-session` | evidence |
|
|
10
|
+
| Task submission | `org.peacprotocol/managed-agent-task` | evidence |
|
|
11
|
+
| Tool use | `org.peacprotocol/managed-agent-tool-use` | evidence |
|
|
12
|
+
| MCP invocation | `org.peacprotocol/managed-agent-mcp-call` | evidence |
|
|
13
|
+
| Permission confirmation | `org.peacprotocol/managed-agent-permission` | evidence |
|
|
14
|
+
| Outcome evaluation | `org.peacprotocol/managed-agent-outcome` | evidence |
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { issueSessionEvent, buildSessionSummary } from '@peac/adapter-managed-agents';
|
|
20
|
+
|
|
21
|
+
const result = await issueSessionEvent({
|
|
22
|
+
privateKey, // Ed25519 32 bytes
|
|
23
|
+
kid: 'key-1',
|
|
24
|
+
issuer: 'https://your-issuer.example.com',
|
|
25
|
+
sessionId: 'sess_001',
|
|
26
|
+
agentId: 'agent-001',
|
|
27
|
+
provider: 'your-runtime', // caller-supplied, never hardcoded
|
|
28
|
+
event: 'session.created',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// result.jws is a signed Interaction Record (compact JWS)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Session Summary
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const summary = buildSessionSummary([result1.jws, result2.jws, result3.jws]);
|
|
38
|
+
// { sessionId, receipts: 3, families: ['session', 'task', ...], issuer }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`buildSessionSummary()` decodes JWS payloads to extract metadata but does **not** verify signatures. Callers must verify receipts first (e.g., via `verifyLocal()` from `@peac/protocol`). Throws on malformed JWS input.
|
|
42
|
+
|
|
43
|
+
## Design
|
|
44
|
+
|
|
45
|
+
- **Vendor-neutral:** No vendor SDK dependencies. The `provider` field is always caller-supplied.
|
|
46
|
+
- **Layer 4:** Depends on `@peac/protocol` and `@peac/crypto` only.
|
|
47
|
+
- **Evidence kind:** All event families produce `evidence` kind Interaction Records.
|
|
48
|
+
- **Extension namespace:** `org.peacprotocol/managed-agent` with `session_id`, `event`, `agent_id`, `provider` fields.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
Apache-2.0
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @peac/adapter-managed-agents constants
|
|
3
|
+
*
|
|
4
|
+
* Vendor-neutral type URIs and extension namespace for managed agent
|
|
5
|
+
* runtime event families.
|
|
6
|
+
*/
|
|
7
|
+
/** Extension namespace for managed agent event metadata. */
|
|
8
|
+
export declare const EXTENSION_NAMESPACE: "org.peacprotocol/managed-agent";
|
|
9
|
+
/** Reverse-DNS type prefix for all managed agent event families. */
|
|
10
|
+
export declare const TYPE_PREFIX: "org.peacprotocol/managed-agent-";
|
|
11
|
+
/**
|
|
12
|
+
* Canonical type URIs for the 6 managed agent event families.
|
|
13
|
+
* Each maps to a distinct Interaction Record `type` value.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EVENT_TYPES: {
|
|
16
|
+
readonly SESSION: "org.peacprotocol/managed-agent-session";
|
|
17
|
+
readonly TASK: "org.peacprotocol/managed-agent-task";
|
|
18
|
+
readonly TOOL_USE: "org.peacprotocol/managed-agent-tool-use";
|
|
19
|
+
readonly MCP_CALL: "org.peacprotocol/managed-agent-mcp-call";
|
|
20
|
+
readonly PERMISSION: "org.peacprotocol/managed-agent-permission";
|
|
21
|
+
readonly OUTCOME: "org.peacprotocol/managed-agent-outcome";
|
|
22
|
+
};
|
|
23
|
+
export type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
|
|
24
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,EAAG,gCAAyC,CAAC;AAE7E,oEAAoE;AACpE,eAAO,MAAM,WAAW,EAAG,iCAA0C,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @peac/adapter-managed-agents event family registry
|
|
3
|
+
*
|
|
4
|
+
* Maps each EventFamily to its canonical PEAC Interaction Record type
|
|
5
|
+
* and structural kind. All event families produce `evidence` kind records.
|
|
6
|
+
*/
|
|
7
|
+
import { type EventType } from './constants.js';
|
|
8
|
+
import { EventFamily } from './types.js';
|
|
9
|
+
export interface EventFamilyEntry {
|
|
10
|
+
/** PEAC Interaction Record type URI. */
|
|
11
|
+
type: EventType;
|
|
12
|
+
/** Structural kind (always 'evidence' for managed agent events). */
|
|
13
|
+
kind: 'evidence';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Registry of all 6 managed agent event families.
|
|
17
|
+
* Each entry maps a family to its canonical type URI and kind.
|
|
18
|
+
*/
|
|
19
|
+
export declare const EVENT_FAMILIES: Record<EventFamily, EventFamilyEntry>;
|
|
20
|
+
//# sourceMappingURL=event-families.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-families.d.ts","sourceRoot":"","sources":["../src/event-families.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,oEAAoE;IACpE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAOhE,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var protocol = require('@peac/protocol');
|
|
4
|
+
var crypto = require('@peac/crypto');
|
|
5
|
+
|
|
6
|
+
// src/constants.ts
|
|
7
|
+
var EXTENSION_NAMESPACE = "org.peacprotocol/managed-agent";
|
|
8
|
+
var TYPE_PREFIX = "org.peacprotocol/managed-agent-";
|
|
9
|
+
var EVENT_TYPES = {
|
|
10
|
+
SESSION: `${TYPE_PREFIX}session`,
|
|
11
|
+
TASK: `${TYPE_PREFIX}task`,
|
|
12
|
+
TOOL_USE: `${TYPE_PREFIX}tool-use`,
|
|
13
|
+
MCP_CALL: `${TYPE_PREFIX}mcp-call`,
|
|
14
|
+
PERMISSION: `${TYPE_PREFIX}permission`,
|
|
15
|
+
OUTCOME: `${TYPE_PREFIX}outcome`
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/types.ts
|
|
19
|
+
var EventFamily = /* @__PURE__ */ ((EventFamily2) => {
|
|
20
|
+
EventFamily2["Session"] = "session";
|
|
21
|
+
EventFamily2["Task"] = "task";
|
|
22
|
+
EventFamily2["ToolUse"] = "tool-use";
|
|
23
|
+
EventFamily2["McpCall"] = "mcp-call";
|
|
24
|
+
EventFamily2["Permission"] = "permission";
|
|
25
|
+
EventFamily2["Outcome"] = "outcome";
|
|
26
|
+
return EventFamily2;
|
|
27
|
+
})(EventFamily || {});
|
|
28
|
+
|
|
29
|
+
// src/event-families.ts
|
|
30
|
+
var EVENT_FAMILIES = {
|
|
31
|
+
["session" /* Session */]: { type: EVENT_TYPES.SESSION, kind: "evidence" },
|
|
32
|
+
["task" /* Task */]: { type: EVENT_TYPES.TASK, kind: "evidence" },
|
|
33
|
+
["tool-use" /* ToolUse */]: { type: EVENT_TYPES.TOOL_USE, kind: "evidence" },
|
|
34
|
+
["mcp-call" /* McpCall */]: { type: EVENT_TYPES.MCP_CALL, kind: "evidence" },
|
|
35
|
+
["permission" /* Permission */]: { type: EVENT_TYPES.PERMISSION, kind: "evidence" },
|
|
36
|
+
["outcome" /* Outcome */]: { type: EVENT_TYPES.OUTCOME, kind: "evidence" }
|
|
37
|
+
};
|
|
38
|
+
async function issueEvent(options) {
|
|
39
|
+
const { privateKey, kid, issuer, sessionId, agentId, provider, event } = options;
|
|
40
|
+
const entry = EVENT_FAMILIES[event.family];
|
|
41
|
+
const { jws } = await protocol.issue({
|
|
42
|
+
iss: issuer,
|
|
43
|
+
kind: entry.kind,
|
|
44
|
+
type: entry.type,
|
|
45
|
+
privateKey,
|
|
46
|
+
kid,
|
|
47
|
+
extensions: {
|
|
48
|
+
[EXTENSION_NAMESPACE]: {
|
|
49
|
+
session_id: sessionId,
|
|
50
|
+
event: event.event,
|
|
51
|
+
agent_id: agentId,
|
|
52
|
+
provider,
|
|
53
|
+
...event.details
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return { jws, type: entry.type, family: event.family };
|
|
58
|
+
}
|
|
59
|
+
async function issueSessionEvent(options) {
|
|
60
|
+
return issueEvent({
|
|
61
|
+
...options,
|
|
62
|
+
event: { family: "session" /* Session */, event: options.event, details: options.details }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async function issueTaskEvent(options) {
|
|
66
|
+
return issueEvent({
|
|
67
|
+
...options,
|
|
68
|
+
event: { family: "task" /* Task */, event: options.event, details: options.details }
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async function issueToolUseEvent(options) {
|
|
72
|
+
return issueEvent({
|
|
73
|
+
...options,
|
|
74
|
+
event: { family: "tool-use" /* ToolUse */, event: options.event, details: options.details }
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async function issueMcpCallEvent(options) {
|
|
78
|
+
return issueEvent({
|
|
79
|
+
...options,
|
|
80
|
+
event: { family: "mcp-call" /* McpCall */, event: options.event, details: options.details }
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async function issuePermissionEvent(options) {
|
|
84
|
+
return issueEvent({
|
|
85
|
+
...options,
|
|
86
|
+
event: { family: "permission" /* Permission */, event: options.event, details: options.details }
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async function issueOutcomeEvent(options) {
|
|
90
|
+
return issueEvent({
|
|
91
|
+
...options,
|
|
92
|
+
event: { family: "outcome" /* Outcome */, event: options.event, details: options.details }
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
var TYPE_TO_FAMILY = {
|
|
96
|
+
session: "session" /* Session */,
|
|
97
|
+
task: "task" /* Task */,
|
|
98
|
+
"tool-use": "tool-use" /* ToolUse */,
|
|
99
|
+
"mcp-call": "mcp-call" /* McpCall */,
|
|
100
|
+
permission: "permission" /* Permission */,
|
|
101
|
+
outcome: "outcome" /* Outcome */
|
|
102
|
+
};
|
|
103
|
+
function buildSessionSummary(receipts) {
|
|
104
|
+
if (receipts.length === 0) {
|
|
105
|
+
return { sessionId: "", receipts: 0, families: [], issuer: "" };
|
|
106
|
+
}
|
|
107
|
+
let sessionId = "";
|
|
108
|
+
let issuer = "";
|
|
109
|
+
const familySet = /* @__PURE__ */ new Set();
|
|
110
|
+
for (const jws of receipts) {
|
|
111
|
+
const decoded = crypto.decode(jws);
|
|
112
|
+
const claims = decoded.payload;
|
|
113
|
+
if (!issuer && typeof claims.iss === "string") {
|
|
114
|
+
issuer = claims.iss;
|
|
115
|
+
}
|
|
116
|
+
const extensions = claims.extensions;
|
|
117
|
+
const agentExt = extensions?.[EXTENSION_NAMESPACE];
|
|
118
|
+
if (agentExt) {
|
|
119
|
+
if (!sessionId && typeof agentExt.session_id === "string") {
|
|
120
|
+
sessionId = agentExt.session_id;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const type = claims.type;
|
|
124
|
+
if (type?.startsWith(TYPE_PREFIX)) {
|
|
125
|
+
const suffix = type.slice(TYPE_PREFIX.length);
|
|
126
|
+
const family = TYPE_TO_FAMILY[suffix];
|
|
127
|
+
if (family !== void 0) {
|
|
128
|
+
familySet.add(family);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
sessionId,
|
|
134
|
+
receipts: receipts.length,
|
|
135
|
+
families: [...familySet],
|
|
136
|
+
issuer
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
exports.EVENT_FAMILIES = EVENT_FAMILIES;
|
|
141
|
+
exports.EVENT_TYPES = EVENT_TYPES;
|
|
142
|
+
exports.EXTENSION_NAMESPACE = EXTENSION_NAMESPACE;
|
|
143
|
+
exports.EventFamily = EventFamily;
|
|
144
|
+
exports.TYPE_PREFIX = TYPE_PREFIX;
|
|
145
|
+
exports.buildSessionSummary = buildSessionSummary;
|
|
146
|
+
exports.issueEvent = issueEvent;
|
|
147
|
+
exports.issueMcpCallEvent = issueMcpCallEvent;
|
|
148
|
+
exports.issueOutcomeEvent = issueOutcomeEvent;
|
|
149
|
+
exports.issuePermissionEvent = issuePermissionEvent;
|
|
150
|
+
exports.issueSessionEvent = issueSessionEvent;
|
|
151
|
+
exports.issueTaskEvent = issueTaskEvent;
|
|
152
|
+
exports.issueToolUseEvent = issueToolUseEvent;
|
|
153
|
+
//# sourceMappingURL=index.cjs.map
|
|
154
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/types.ts","../src/event-families.ts","../src/issue-event.ts","../src/session-summary.ts"],"names":["EventFamily","issue","decode"],"mappings":";;;;;;AAQO,IAAM,mBAAA,GAAsB;AAG5B,IAAM,WAAA,GAAc;AAMpB,IAAM,WAAA,GAAc;AAAA,EACzB,OAAA,EAAS,GAAG,WAAW,CAAA,OAAA,CAAA;AAAA,EACvB,IAAA,EAAM,GAAG,WAAW,CAAA,IAAA,CAAA;AAAA,EACpB,QAAA,EAAU,GAAG,WAAW,CAAA,QAAA,CAAA;AAAA,EACxB,QAAA,EAAU,GAAG,WAAW,CAAA,QAAA,CAAA;AAAA,EACxB,UAAA,EAAY,GAAG,WAAW,CAAA,UAAA,CAAA;AAAA,EAC1B,OAAA,EAAS,GAAG,WAAW,CAAA,OAAA;AACzB;;;ACZO,IAAK,WAAA,qBAAAA,YAAAA,KAAL;AACL,EAAAA,aAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,aAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,aAAA,SAAA,CAAA,GAAU,UAAA;AACV,EAAAA,aAAA,SAAA,CAAA,GAAU,UAAA;AACV,EAAAA,aAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAA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vB;AAAA,IACF;AAEA,IAAA,MAAM,OAAO,MAAA,CAAO,IAAA;AACpB,IAAA,IAAI,IAAA,EAAM,UAAA,CAAW,WAAW,CAAA,EAAG;AACjC,MAAA,MAAM,MAAA,GAAS,IAAA,CAAK,KAAA,CAAM,WAAA,CAAY,MAAM,CAAA;AAC5C,MAAA,MAAM,MAAA,GAAS,eAAe,MAAM,CAAA;AACpC,MAAA,IAAI,WAAW,MAAA,EAAW;AACxB,QAAA,SAAA,CAAU,IAAI,MAAM,CAAA;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,UAAU,QAAA,CAAS,MAAA;AAAA,IACnB,QAAA,EAAU,CAAC,GAAG,SAAS,CAAA;AAAA,IACvB;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/**\n * @peac/adapter-managed-agents constants\n *\n * Vendor-neutral type URIs and extension namespace for managed agent\n * runtime event families.\n */\n\n/** Extension namespace for managed agent event metadata. */\nexport const EXTENSION_NAMESPACE = 'org.peacprotocol/managed-agent' as const;\n\n/** Reverse-DNS type prefix for all managed agent event families. */\nexport const TYPE_PREFIX = 'org.peacprotocol/managed-agent-' as const;\n\n/**\n * Canonical type URIs for the 6 managed agent event families.\n * Each maps to a distinct Interaction Record `type` value.\n */\nexport const EVENT_TYPES = {\n SESSION: `${TYPE_PREFIX}session`,\n TASK: `${TYPE_PREFIX}task`,\n TOOL_USE: `${TYPE_PREFIX}tool-use`,\n MCP_CALL: `${TYPE_PREFIX}mcp-call`,\n PERMISSION: `${TYPE_PREFIX}permission`,\n OUTCOME: `${TYPE_PREFIX}outcome`,\n} as const;\n\nexport type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];\n","/**\n * @peac/adapter-managed-agents types\n *\n * Vendor-neutral types for managed agent runtime events.\n * No runtime-specific logic; provider identity is caller-supplied.\n */\n\nimport type { EventType } from './constants.js';\n\n/**\n * Enum of the 6 managed agent event families.\n */\nexport enum EventFamily {\n Session = 'session',\n Task = 'task',\n ToolUse = 'tool-use',\n McpCall = 'mcp-call',\n Permission = 'permission',\n Outcome = 'outcome',\n}\n\n/**\n * Input event from a managed agent runtime.\n * Provider-neutral: no vendor-specific fields.\n */\nexport interface ManagedAgentEvent {\n /** Event family classification. */\n family: EventFamily;\n /** Specific event name within the family (e.g., 'session.created'). */\n event: string;\n /** Additional event-specific details. JSON-serializable. */\n details?: Record<string, unknown>;\n}\n\n/**\n * Options for issuing a managed agent event as a signed Interaction Record.\n */\nexport interface IssueEventOptions {\n /** Ed25519 private key (32 bytes). Caller-provided; never stored. */\n privateKey: Uint8Array;\n /** Key ID (max 256 chars). */\n kid: string;\n /** Canonical issuer URL (HTTPS or DID). */\n issuer: string;\n /** Session identifier for event correlation. */\n sessionId: string;\n /** Agent identifier. */\n agentId: string;\n /** Provider name. Caller-supplied; never hardcoded. */\n provider: string;\n /** The event to issue. */\n event: ManagedAgentEvent;\n}\n\n/**\n * Result of issuing a managed agent event.\n */\nexport interface IssueEventResult {\n /** Compact JWS (signed Interaction Record). */\n jws: string;\n /** PEAC event type URI used. */\n type: EventType;\n /** Event family. */\n family: EventFamily;\n}\n\n/**\n * Session evidence summary aggregated from verified receipts.\n */\nexport interface SessionSummary {\n /** Session identifier. */\n sessionId: string;\n /** Total receipts in the session. */\n receipts: number;\n /** Distinct event families represented. */\n families: EventFamily[];\n /** Issuer (from the first receipt, or empty if no receipts). */\n issuer: string;\n}\n","/**\n * @peac/adapter-managed-agents event family registry\n *\n * Maps each EventFamily to its canonical PEAC Interaction Record type\n * and structural kind. All event families produce `evidence` kind records.\n */\n\nimport { EVENT_TYPES, type EventType } from './constants.js';\nimport { EventFamily } from './types.js';\n\nexport interface EventFamilyEntry {\n /** PEAC Interaction Record type URI. */\n type: EventType;\n /** Structural kind (always 'evidence' for managed agent events). */\n kind: 'evidence';\n}\n\n/**\n * Registry of all 6 managed agent event families.\n * Each entry maps a family to its canonical type URI and kind.\n */\nexport const EVENT_FAMILIES: Record<EventFamily, EventFamilyEntry> = {\n [EventFamily.Session]: { type: EVENT_TYPES.SESSION, kind: 'evidence' },\n [EventFamily.Task]: { type: EVENT_TYPES.TASK, kind: 'evidence' },\n [EventFamily.ToolUse]: { type: EVENT_TYPES.TOOL_USE, kind: 'evidence' },\n [EventFamily.McpCall]: { type: EVENT_TYPES.MCP_CALL, kind: 'evidence' },\n [EventFamily.Permission]: { type: EVENT_TYPES.PERMISSION, kind: 'evidence' },\n [EventFamily.Outcome]: { type: EVENT_TYPES.OUTCOME, kind: 'evidence' },\n};\n","/**\n * @peac/adapter-managed-agents event issuance\n *\n * Factory functions for issuing managed agent events as signed\n * Interaction Records. Each function wraps @peac/protocol issue()\n * with the correct type URI and extension namespace.\n *\n * All functions are vendor-neutral: the `provider` field is always\n * caller-supplied and never hardcoded.\n */\n\nimport { issue } from '@peac/protocol';\nimport { EXTENSION_NAMESPACE } from './constants.js';\nimport { EVENT_FAMILIES } from './event-families.js';\nimport { EventFamily, type IssueEventOptions, type IssueEventResult } from './types.js';\n\n/**\n * Issue a signed Interaction Record for a managed agent event.\n *\n * @param options - Issuance options including key material, session, and event\n * @returns Signed JWS, type URI, and event family\n */\nexport async function issueEvent(options: IssueEventOptions): Promise<IssueEventResult> {\n const { privateKey, kid, issuer, sessionId, agentId, provider, event } = options;\n const entry = EVENT_FAMILIES[event.family];\n\n const { jws } = await issue({\n iss: issuer,\n kind: entry.kind,\n type: entry.type,\n privateKey,\n kid,\n extensions: {\n [EXTENSION_NAMESPACE]: {\n session_id: sessionId,\n event: event.event,\n agent_id: agentId,\n provider,\n ...event.details,\n },\n },\n });\n\n return { jws, type: entry.type, family: event.family };\n}\n\n/** Issue a session lifecycle event. */\nexport async function issueSessionEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Session, event: options.event, details: options.details },\n });\n}\n\n/** Issue a task submission event. */\nexport async function issueTaskEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Task, event: options.event, details: options.details },\n });\n}\n\n/** Issue a tool use event. */\nexport async function issueToolUseEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.ToolUse, event: options.event, details: options.details },\n });\n}\n\n/** Issue an MCP invocation event. */\nexport async function issueMcpCallEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.McpCall, event: options.event, details: options.details },\n });\n}\n\n/** Issue a permission confirmation event. */\nexport async function issuePermissionEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Permission, event: options.event, details: options.details },\n });\n}\n\n/** Issue an outcome evaluation event. */\nexport async function issueOutcomeEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Outcome, event: options.event, details: options.details },\n });\n}\n","/**\n * @peac/adapter-managed-agents session summary builder\n *\n * Aggregates verified receipts into a session evidence summary.\n * Decodes each JWS to extract session ID, event family, and issuer.\n */\n\nimport { decode } from '@peac/crypto';\nimport { EXTENSION_NAMESPACE, TYPE_PREFIX } from './constants.js';\nimport { EventFamily, type SessionSummary } from './types.js';\n\n/** Reverse lookup: type URI suffix -> EventFamily */\nconst TYPE_TO_FAMILY: Record<string, EventFamily> = {\n session: EventFamily.Session,\n task: EventFamily.Task,\n 'tool-use': EventFamily.ToolUse,\n 'mcp-call': EventFamily.McpCall,\n permission: EventFamily.Permission,\n outcome: EventFamily.Outcome,\n};\n\n/**\n * Build a session evidence summary from an array of signed JWS receipts.\n *\n * Decodes each JWS (does NOT verify signatures; caller should verify first).\n * Extracts session ID, event families, and issuer from claims and extensions.\n *\n * Accepts previously verified compact JWS receipts.\n * Does NOT perform signature verification; callers should verify first.\n * Throws on malformed compact JWS input (invalid base64url segments).\n *\n * @param receipts - Array of compact JWS strings (must be valid JWS format)\n * @returns Session summary with receipt count, families, and issuer\n */\nexport function buildSessionSummary(receipts: string[]): SessionSummary {\n if (receipts.length === 0) {\n return { sessionId: '', receipts: 0, families: [], issuer: '' };\n }\n\n let sessionId = '';\n let issuer = '';\n const familySet = new Set<EventFamily>();\n\n for (const jws of receipts) {\n const decoded = decode(jws);\n const claims = decoded.payload as Record<string, unknown>;\n\n if (!issuer && typeof claims.iss === 'string') {\n issuer = claims.iss;\n }\n\n const extensions = claims.extensions as Record<string, unknown> | undefined;\n const agentExt = extensions?.[EXTENSION_NAMESPACE] as Record<string, unknown> | undefined;\n\n if (agentExt) {\n if (!sessionId && typeof agentExt.session_id === 'string') {\n sessionId = agentExt.session_id;\n }\n }\n\n const type = claims.type as string | undefined;\n if (type?.startsWith(TYPE_PREFIX)) {\n const suffix = type.slice(TYPE_PREFIX.length);\n const family = TYPE_TO_FAMILY[suffix];\n if (family !== undefined) {\n familySet.add(family);\n }\n }\n }\n\n return {\n sessionId,\n receipts: receipts.length,\n families: [...familySet],\n issuer,\n };\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @peac/adapter-managed-agents
|
|
3
|
+
*
|
|
4
|
+
* Vendor-neutral adapter for managed agent runtime event evidence.
|
|
5
|
+
* Maps 6 event families (session, task, tool-use, mcp-call, permission,
|
|
6
|
+
* outcome) to signed PEAC Interaction Records.
|
|
7
|
+
*
|
|
8
|
+
* This package is provider-neutral: the `provider` field is always
|
|
9
|
+
* caller-supplied. No vendor SDK dependencies.
|
|
10
|
+
*/
|
|
11
|
+
export { EXTENSION_NAMESPACE, TYPE_PREFIX, EVENT_TYPES, type EventType } from './constants.js';
|
|
12
|
+
export { EventFamily, type ManagedAgentEvent, type IssueEventOptions, type IssueEventResult, type SessionSummary, } from './types.js';
|
|
13
|
+
export { EVENT_FAMILIES, type EventFamilyEntry } from './event-families.js';
|
|
14
|
+
export { issueEvent, issueSessionEvent, issueTaskEvent, issueToolUseEvent, issueMcpCallEvent, issuePermissionEvent, issueOutcomeEvent, } from './issue-event.js';
|
|
15
|
+
export { buildSessionSummary } from './session-summary.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK/F,OAAO,EACL,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { issue } from '@peac/protocol';
|
|
2
|
+
import { decode } from '@peac/crypto';
|
|
3
|
+
|
|
4
|
+
// src/constants.ts
|
|
5
|
+
var EXTENSION_NAMESPACE = "org.peacprotocol/managed-agent";
|
|
6
|
+
var TYPE_PREFIX = "org.peacprotocol/managed-agent-";
|
|
7
|
+
var EVENT_TYPES = {
|
|
8
|
+
SESSION: `${TYPE_PREFIX}session`,
|
|
9
|
+
TASK: `${TYPE_PREFIX}task`,
|
|
10
|
+
TOOL_USE: `${TYPE_PREFIX}tool-use`,
|
|
11
|
+
MCP_CALL: `${TYPE_PREFIX}mcp-call`,
|
|
12
|
+
PERMISSION: `${TYPE_PREFIX}permission`,
|
|
13
|
+
OUTCOME: `${TYPE_PREFIX}outcome`
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/types.ts
|
|
17
|
+
var EventFamily = /* @__PURE__ */ ((EventFamily2) => {
|
|
18
|
+
EventFamily2["Session"] = "session";
|
|
19
|
+
EventFamily2["Task"] = "task";
|
|
20
|
+
EventFamily2["ToolUse"] = "tool-use";
|
|
21
|
+
EventFamily2["McpCall"] = "mcp-call";
|
|
22
|
+
EventFamily2["Permission"] = "permission";
|
|
23
|
+
EventFamily2["Outcome"] = "outcome";
|
|
24
|
+
return EventFamily2;
|
|
25
|
+
})(EventFamily || {});
|
|
26
|
+
|
|
27
|
+
// src/event-families.ts
|
|
28
|
+
var EVENT_FAMILIES = {
|
|
29
|
+
["session" /* Session */]: { type: EVENT_TYPES.SESSION, kind: "evidence" },
|
|
30
|
+
["task" /* Task */]: { type: EVENT_TYPES.TASK, kind: "evidence" },
|
|
31
|
+
["tool-use" /* ToolUse */]: { type: EVENT_TYPES.TOOL_USE, kind: "evidence" },
|
|
32
|
+
["mcp-call" /* McpCall */]: { type: EVENT_TYPES.MCP_CALL, kind: "evidence" },
|
|
33
|
+
["permission" /* Permission */]: { type: EVENT_TYPES.PERMISSION, kind: "evidence" },
|
|
34
|
+
["outcome" /* Outcome */]: { type: EVENT_TYPES.OUTCOME, kind: "evidence" }
|
|
35
|
+
};
|
|
36
|
+
async function issueEvent(options) {
|
|
37
|
+
const { privateKey, kid, issuer, sessionId, agentId, provider, event } = options;
|
|
38
|
+
const entry = EVENT_FAMILIES[event.family];
|
|
39
|
+
const { jws } = await issue({
|
|
40
|
+
iss: issuer,
|
|
41
|
+
kind: entry.kind,
|
|
42
|
+
type: entry.type,
|
|
43
|
+
privateKey,
|
|
44
|
+
kid,
|
|
45
|
+
extensions: {
|
|
46
|
+
[EXTENSION_NAMESPACE]: {
|
|
47
|
+
session_id: sessionId,
|
|
48
|
+
event: event.event,
|
|
49
|
+
agent_id: agentId,
|
|
50
|
+
provider,
|
|
51
|
+
...event.details
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return { jws, type: entry.type, family: event.family };
|
|
56
|
+
}
|
|
57
|
+
async function issueSessionEvent(options) {
|
|
58
|
+
return issueEvent({
|
|
59
|
+
...options,
|
|
60
|
+
event: { family: "session" /* Session */, event: options.event, details: options.details }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async function issueTaskEvent(options) {
|
|
64
|
+
return issueEvent({
|
|
65
|
+
...options,
|
|
66
|
+
event: { family: "task" /* Task */, event: options.event, details: options.details }
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async function issueToolUseEvent(options) {
|
|
70
|
+
return issueEvent({
|
|
71
|
+
...options,
|
|
72
|
+
event: { family: "tool-use" /* ToolUse */, event: options.event, details: options.details }
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async function issueMcpCallEvent(options) {
|
|
76
|
+
return issueEvent({
|
|
77
|
+
...options,
|
|
78
|
+
event: { family: "mcp-call" /* McpCall */, event: options.event, details: options.details }
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async function issuePermissionEvent(options) {
|
|
82
|
+
return issueEvent({
|
|
83
|
+
...options,
|
|
84
|
+
event: { family: "permission" /* Permission */, event: options.event, details: options.details }
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async function issueOutcomeEvent(options) {
|
|
88
|
+
return issueEvent({
|
|
89
|
+
...options,
|
|
90
|
+
event: { family: "outcome" /* Outcome */, event: options.event, details: options.details }
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var TYPE_TO_FAMILY = {
|
|
94
|
+
session: "session" /* Session */,
|
|
95
|
+
task: "task" /* Task */,
|
|
96
|
+
"tool-use": "tool-use" /* ToolUse */,
|
|
97
|
+
"mcp-call": "mcp-call" /* McpCall */,
|
|
98
|
+
permission: "permission" /* Permission */,
|
|
99
|
+
outcome: "outcome" /* Outcome */
|
|
100
|
+
};
|
|
101
|
+
function buildSessionSummary(receipts) {
|
|
102
|
+
if (receipts.length === 0) {
|
|
103
|
+
return { sessionId: "", receipts: 0, families: [], issuer: "" };
|
|
104
|
+
}
|
|
105
|
+
let sessionId = "";
|
|
106
|
+
let issuer = "";
|
|
107
|
+
const familySet = /* @__PURE__ */ new Set();
|
|
108
|
+
for (const jws of receipts) {
|
|
109
|
+
const decoded = decode(jws);
|
|
110
|
+
const claims = decoded.payload;
|
|
111
|
+
if (!issuer && typeof claims.iss === "string") {
|
|
112
|
+
issuer = claims.iss;
|
|
113
|
+
}
|
|
114
|
+
const extensions = claims.extensions;
|
|
115
|
+
const agentExt = extensions?.[EXTENSION_NAMESPACE];
|
|
116
|
+
if (agentExt) {
|
|
117
|
+
if (!sessionId && typeof agentExt.session_id === "string") {
|
|
118
|
+
sessionId = agentExt.session_id;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const type = claims.type;
|
|
122
|
+
if (type?.startsWith(TYPE_PREFIX)) {
|
|
123
|
+
const suffix = type.slice(TYPE_PREFIX.length);
|
|
124
|
+
const family = TYPE_TO_FAMILY[suffix];
|
|
125
|
+
if (family !== void 0) {
|
|
126
|
+
familySet.add(family);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
sessionId,
|
|
132
|
+
receipts: receipts.length,
|
|
133
|
+
families: [...familySet],
|
|
134
|
+
issuer
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { EVENT_FAMILIES, EVENT_TYPES, EXTENSION_NAMESPACE, EventFamily, TYPE_PREFIX, buildSessionSummary, issueEvent, issueMcpCallEvent, issueOutcomeEvent, issuePermissionEvent, issueSessionEvent, issueTaskEvent, issueToolUseEvent };
|
|
139
|
+
//# sourceMappingURL=index.mjs.map
|
|
140
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/types.ts","../src/event-families.ts","../src/issue-event.ts","../src/session-summary.ts"],"names":["EventFamily"],"mappings":";;;;AAQO,IAAM,mBAAA,GAAsB;AAG5B,IAAM,WAAA,GAAc;AAMpB,IAAM,WAAA,GAAc;AAAA,EACzB,OAAA,EAAS,GAAG,WAAW,CAAA,OAAA,CAAA;AAAA,EACvB,IAAA,EAAM,GAAG,WAAW,CAAA,IAAA,CAAA;AAAA,EACpB,QAAA,EAAU,GAAG,WAAW,CAAA,QAAA,CAAA;AAAA,EACxB,QAAA,EAAU,GAAG,WAAW,CAAA,QAAA,CAAA;AAAA,EACxB,UAAA,EAAY,GAAG,WAAW,CAAA,UAAA,CAAA;AAAA,EAC1B,OAAA,EAAS,GAAG,WAAW,CAAA,OAAA;AACzB;;;ACZO,IAAK,WAAA,qBAAAA,YAAAA,KAAL;AACL,EAAAA,aAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,aAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,aAAA,SAAA,CAAA,GAAU,UAAA;AACV,EAAAA,aAAA,SAAA,CAAA,GAAU,UAAA;AACV,EAAAA,aAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,aAAA,SAAA,CAAA,GAAU,SAAA;AANA,EAAA,OAAAA,YAAAA;AAAA,CAAA,EAAA,WAAA,IAAA,EAAA;;;ACSL,IAAM,cAAA,GAAwD;AAAA,EACnE,2BAAuB,EAAE,MAAM,WAAA,CAAY,OAAA,EAAS,MAAM,UAAA,EAAW;AAAA,EACrE,qBAAoB,EAAE,MAAM,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MAAM,CAAA;AACpC,MAAA,IAAI,WAAW,MAAA,EAAW;AACxB,QAAA,SAAA,CAAU,IAAI,MAAM,CAAA;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,UAAU,QAAA,CAAS,MAAA;AAAA,IACnB,QAAA,EAAU,CAAC,GAAG,SAAS,CAAA;AAAA,IACvB;AAAA,GACF;AACF","file":"index.mjs","sourcesContent":["/**\n * @peac/adapter-managed-agents constants\n *\n * Vendor-neutral type URIs and extension namespace for managed agent\n * runtime event families.\n */\n\n/** Extension namespace for managed agent event metadata. */\nexport const EXTENSION_NAMESPACE = 'org.peacprotocol/managed-agent' as const;\n\n/** Reverse-DNS type prefix for all managed agent event families. */\nexport const TYPE_PREFIX = 'org.peacprotocol/managed-agent-' as const;\n\n/**\n * Canonical type URIs for the 6 managed agent event families.\n * Each maps to a distinct Interaction Record `type` value.\n */\nexport const EVENT_TYPES = {\n SESSION: `${TYPE_PREFIX}session`,\n TASK: `${TYPE_PREFIX}task`,\n TOOL_USE: `${TYPE_PREFIX}tool-use`,\n MCP_CALL: `${TYPE_PREFIX}mcp-call`,\n PERMISSION: `${TYPE_PREFIX}permission`,\n OUTCOME: `${TYPE_PREFIX}outcome`,\n} as const;\n\nexport type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];\n","/**\n * @peac/adapter-managed-agents types\n *\n * Vendor-neutral types for managed agent runtime events.\n * No runtime-specific logic; provider identity is caller-supplied.\n */\n\nimport type { EventType } from './constants.js';\n\n/**\n * Enum of the 6 managed agent event families.\n */\nexport enum EventFamily {\n Session = 'session',\n Task = 'task',\n ToolUse = 'tool-use',\n McpCall = 'mcp-call',\n Permission = 'permission',\n Outcome = 'outcome',\n}\n\n/**\n * Input event from a managed agent runtime.\n * Provider-neutral: no vendor-specific fields.\n */\nexport interface ManagedAgentEvent {\n /** Event family classification. */\n family: EventFamily;\n /** Specific event name within the family (e.g., 'session.created'). */\n event: string;\n /** Additional event-specific details. JSON-serializable. */\n details?: Record<string, unknown>;\n}\n\n/**\n * Options for issuing a managed agent event as a signed Interaction Record.\n */\nexport interface IssueEventOptions {\n /** Ed25519 private key (32 bytes). Caller-provided; never stored. */\n privateKey: Uint8Array;\n /** Key ID (max 256 chars). */\n kid: string;\n /** Canonical issuer URL (HTTPS or DID). */\n issuer: string;\n /** Session identifier for event correlation. */\n sessionId: string;\n /** Agent identifier. */\n agentId: string;\n /** Provider name. Caller-supplied; never hardcoded. */\n provider: string;\n /** The event to issue. */\n event: ManagedAgentEvent;\n}\n\n/**\n * Result of issuing a managed agent event.\n */\nexport interface IssueEventResult {\n /** Compact JWS (signed Interaction Record). */\n jws: string;\n /** PEAC event type URI used. */\n type: EventType;\n /** Event family. */\n family: EventFamily;\n}\n\n/**\n * Session evidence summary aggregated from verified receipts.\n */\nexport interface SessionSummary {\n /** Session identifier. */\n sessionId: string;\n /** Total receipts in the session. */\n receipts: number;\n /** Distinct event families represented. */\n families: EventFamily[];\n /** Issuer (from the first receipt, or empty if no receipts). */\n issuer: string;\n}\n","/**\n * @peac/adapter-managed-agents event family registry\n *\n * Maps each EventFamily to its canonical PEAC Interaction Record type\n * and structural kind. All event families produce `evidence` kind records.\n */\n\nimport { EVENT_TYPES, type EventType } from './constants.js';\nimport { EventFamily } from './types.js';\n\nexport interface EventFamilyEntry {\n /** PEAC Interaction Record type URI. */\n type: EventType;\n /** Structural kind (always 'evidence' for managed agent events). */\n kind: 'evidence';\n}\n\n/**\n * Registry of all 6 managed agent event families.\n * Each entry maps a family to its canonical type URI and kind.\n */\nexport const EVENT_FAMILIES: Record<EventFamily, EventFamilyEntry> = {\n [EventFamily.Session]: { type: EVENT_TYPES.SESSION, kind: 'evidence' },\n [EventFamily.Task]: { type: EVENT_TYPES.TASK, kind: 'evidence' },\n [EventFamily.ToolUse]: { type: EVENT_TYPES.TOOL_USE, kind: 'evidence' },\n [EventFamily.McpCall]: { type: EVENT_TYPES.MCP_CALL, kind: 'evidence' },\n [EventFamily.Permission]: { type: EVENT_TYPES.PERMISSION, kind: 'evidence' },\n [EventFamily.Outcome]: { type: EVENT_TYPES.OUTCOME, kind: 'evidence' },\n};\n","/**\n * @peac/adapter-managed-agents event issuance\n *\n * Factory functions for issuing managed agent events as signed\n * Interaction Records. Each function wraps @peac/protocol issue()\n * with the correct type URI and extension namespace.\n *\n * All functions are vendor-neutral: the `provider` field is always\n * caller-supplied and never hardcoded.\n */\n\nimport { issue } from '@peac/protocol';\nimport { EXTENSION_NAMESPACE } from './constants.js';\nimport { EVENT_FAMILIES } from './event-families.js';\nimport { EventFamily, type IssueEventOptions, type IssueEventResult } from './types.js';\n\n/**\n * Issue a signed Interaction Record for a managed agent event.\n *\n * @param options - Issuance options including key material, session, and event\n * @returns Signed JWS, type URI, and event family\n */\nexport async function issueEvent(options: IssueEventOptions): Promise<IssueEventResult> {\n const { privateKey, kid, issuer, sessionId, agentId, provider, event } = options;\n const entry = EVENT_FAMILIES[event.family];\n\n const { jws } = await issue({\n iss: issuer,\n kind: entry.kind,\n type: entry.type,\n privateKey,\n kid,\n extensions: {\n [EXTENSION_NAMESPACE]: {\n session_id: sessionId,\n event: event.event,\n agent_id: agentId,\n provider,\n ...event.details,\n },\n },\n });\n\n return { jws, type: entry.type, family: event.family };\n}\n\n/** Issue a session lifecycle event. */\nexport async function issueSessionEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Session, event: options.event, details: options.details },\n });\n}\n\n/** Issue a task submission event. */\nexport async function issueTaskEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Task, event: options.event, details: options.details },\n });\n}\n\n/** Issue a tool use event. */\nexport async function issueToolUseEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.ToolUse, event: options.event, details: options.details },\n });\n}\n\n/** Issue an MCP invocation event. */\nexport async function issueMcpCallEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.McpCall, event: options.event, details: options.details },\n });\n}\n\n/** Issue a permission confirmation event. */\nexport async function issuePermissionEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Permission, event: options.event, details: options.details },\n });\n}\n\n/** Issue an outcome evaluation event. */\nexport async function issueOutcomeEvent(\n options: Omit<IssueEventOptions, 'event'> & {\n event: string;\n details?: Record<string, unknown>;\n }\n): Promise<IssueEventResult> {\n return issueEvent({\n ...options,\n event: { family: EventFamily.Outcome, event: options.event, details: options.details },\n });\n}\n","/**\n * @peac/adapter-managed-agents session summary builder\n *\n * Aggregates verified receipts into a session evidence summary.\n * Decodes each JWS to extract session ID, event family, and issuer.\n */\n\nimport { decode } from '@peac/crypto';\nimport { EXTENSION_NAMESPACE, TYPE_PREFIX } from './constants.js';\nimport { EventFamily, type SessionSummary } from './types.js';\n\n/** Reverse lookup: type URI suffix -> EventFamily */\nconst TYPE_TO_FAMILY: Record<string, EventFamily> = {\n session: EventFamily.Session,\n task: EventFamily.Task,\n 'tool-use': EventFamily.ToolUse,\n 'mcp-call': EventFamily.McpCall,\n permission: EventFamily.Permission,\n outcome: EventFamily.Outcome,\n};\n\n/**\n * Build a session evidence summary from an array of signed JWS receipts.\n *\n * Decodes each JWS (does NOT verify signatures; caller should verify first).\n * Extracts session ID, event families, and issuer from claims and extensions.\n *\n * Accepts previously verified compact JWS receipts.\n * Does NOT perform signature verification; callers should verify first.\n * Throws on malformed compact JWS input (invalid base64url segments).\n *\n * @param receipts - Array of compact JWS strings (must be valid JWS format)\n * @returns Session summary with receipt count, families, and issuer\n */\nexport function buildSessionSummary(receipts: string[]): SessionSummary {\n if (receipts.length === 0) {\n return { sessionId: '', receipts: 0, families: [], issuer: '' };\n }\n\n let sessionId = '';\n let issuer = '';\n const familySet = new Set<EventFamily>();\n\n for (const jws of receipts) {\n const decoded = decode(jws);\n const claims = decoded.payload as Record<string, unknown>;\n\n if (!issuer && typeof claims.iss === 'string') {\n issuer = claims.iss;\n }\n\n const extensions = claims.extensions as Record<string, unknown> | undefined;\n const agentExt = extensions?.[EXTENSION_NAMESPACE] as Record<string, unknown> | undefined;\n\n if (agentExt) {\n if (!sessionId && typeof agentExt.session_id === 'string') {\n sessionId = agentExt.session_id;\n }\n }\n\n const type = claims.type as string | undefined;\n if (type?.startsWith(TYPE_PREFIX)) {\n const suffix = type.slice(TYPE_PREFIX.length);\n const family = TYPE_TO_FAMILY[suffix];\n if (family !== undefined) {\n familySet.add(family);\n }\n }\n }\n\n return {\n sessionId,\n receipts: receipts.length,\n families: [...familySet],\n issuer,\n };\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @peac/adapter-managed-agents event issuance
|
|
3
|
+
*
|
|
4
|
+
* Factory functions for issuing managed agent events as signed
|
|
5
|
+
* Interaction Records. Each function wraps @peac/protocol issue()
|
|
6
|
+
* with the correct type URI and extension namespace.
|
|
7
|
+
*
|
|
8
|
+
* All functions are vendor-neutral: the `provider` field is always
|
|
9
|
+
* caller-supplied and never hardcoded.
|
|
10
|
+
*/
|
|
11
|
+
import { type IssueEventOptions, type IssueEventResult } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Issue a signed Interaction Record for a managed agent event.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Issuance options including key material, session, and event
|
|
16
|
+
* @returns Signed JWS, type URI, and event family
|
|
17
|
+
*/
|
|
18
|
+
export declare function issueEvent(options: IssueEventOptions): Promise<IssueEventResult>;
|
|
19
|
+
/** Issue a session lifecycle event. */
|
|
20
|
+
export declare function issueSessionEvent(options: Omit<IssueEventOptions, 'event'> & {
|
|
21
|
+
event: string;
|
|
22
|
+
details?: Record<string, unknown>;
|
|
23
|
+
}): Promise<IssueEventResult>;
|
|
24
|
+
/** Issue a task submission event. */
|
|
25
|
+
export declare function issueTaskEvent(options: Omit<IssueEventOptions, 'event'> & {
|
|
26
|
+
event: string;
|
|
27
|
+
details?: Record<string, unknown>;
|
|
28
|
+
}): Promise<IssueEventResult>;
|
|
29
|
+
/** Issue a tool use event. */
|
|
30
|
+
export declare function issueToolUseEvent(options: Omit<IssueEventOptions, 'event'> & {
|
|
31
|
+
event: string;
|
|
32
|
+
details?: Record<string, unknown>;
|
|
33
|
+
}): Promise<IssueEventResult>;
|
|
34
|
+
/** Issue an MCP invocation event. */
|
|
35
|
+
export declare function issueMcpCallEvent(options: Omit<IssueEventOptions, 'event'> & {
|
|
36
|
+
event: string;
|
|
37
|
+
details?: Record<string, unknown>;
|
|
38
|
+
}): Promise<IssueEventResult>;
|
|
39
|
+
/** Issue a permission confirmation event. */
|
|
40
|
+
export declare function issuePermissionEvent(options: Omit<IssueEventOptions, 'event'> & {
|
|
41
|
+
event: string;
|
|
42
|
+
details?: Record<string, unknown>;
|
|
43
|
+
}): Promise<IssueEventResult>;
|
|
44
|
+
/** Issue an outcome evaluation event. */
|
|
45
|
+
export declare function issueOutcomeEvent(options: Omit<IssueEventOptions, 'event'> & {
|
|
46
|
+
event: string;
|
|
47
|
+
details?: Record<string, unknown>;
|
|
48
|
+
}): Promise<IssueEventResult>;
|
|
49
|
+
//# sourceMappingURL=issue-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-event.d.ts","sourceRoot":"","sources":["../src/issue-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAe,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,YA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AC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GACA,OAAO,CAAC,gBAAgB,CAAC,CAK3B;AAED,yCAAyC;AACzC,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GACA,OAAO,CAAC,gBAAgB,CAAC,CAK3B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @peac/adapter-managed-agents session summary builder
|
|
3
|
+
*
|
|
4
|
+
* Aggregates verified receipts into a session evidence summary.
|
|
5
|
+
* Decodes each JWS to extract session ID, event family, and issuer.
|
|
6
|
+
*/
|
|
7
|
+
import { type SessionSummary } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Build a session evidence summary from an array of signed JWS receipts.
|
|
10
|
+
*
|
|
11
|
+
* Decodes each JWS (does NOT verify signatures; caller should verify first).
|
|
12
|
+
* Extracts session ID, event families, and issuer from claims and extensions.
|
|
13
|
+
*
|
|
14
|
+
* Accepts previously verified compact JWS receipts.
|
|
15
|
+
* Does NOT perform signature verification; callers should verify first.
|
|
16
|
+
* Throws on malformed compact JWS input (invalid base64url segments).
|
|
17
|
+
*
|
|
18
|
+
* @param receipts - Array of compact JWS strings (must be valid JWS format)
|
|
19
|
+
* @returns Session summary with receipt count, families, and issuer
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildSessionSummary(receipts: string[]): SessionSummary;
|
|
22
|
+
//# sourceMappingURL=session-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-summary.d.ts","sourceRoot":"","sources":["../src/session-summary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAY9D;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,cAAc,CA0CtE"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @peac/adapter-managed-agents types
|
|
3
|
+
*
|
|
4
|
+
* Vendor-neutral types for managed agent runtime events.
|
|
5
|
+
* No runtime-specific logic; provider identity is caller-supplied.
|
|
6
|
+
*/
|
|
7
|
+
import type { EventType } from './constants.js';
|
|
8
|
+
/**
|
|
9
|
+
* Enum of the 6 managed agent event families.
|
|
10
|
+
*/
|
|
11
|
+
export declare enum EventFamily {
|
|
12
|
+
Session = "session",
|
|
13
|
+
Task = "task",
|
|
14
|
+
ToolUse = "tool-use",
|
|
15
|
+
McpCall = "mcp-call",
|
|
16
|
+
Permission = "permission",
|
|
17
|
+
Outcome = "outcome"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Input event from a managed agent runtime.
|
|
21
|
+
* Provider-neutral: no vendor-specific fields.
|
|
22
|
+
*/
|
|
23
|
+
export interface ManagedAgentEvent {
|
|
24
|
+
/** Event family classification. */
|
|
25
|
+
family: EventFamily;
|
|
26
|
+
/** Specific event name within the family (e.g., 'session.created'). */
|
|
27
|
+
event: string;
|
|
28
|
+
/** Additional event-specific details. JSON-serializable. */
|
|
29
|
+
details?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options for issuing a managed agent event as a signed Interaction Record.
|
|
33
|
+
*/
|
|
34
|
+
export interface IssueEventOptions {
|
|
35
|
+
/** Ed25519 private key (32 bytes). Caller-provided; never stored. */
|
|
36
|
+
privateKey: Uint8Array;
|
|
37
|
+
/** Key ID (max 256 chars). */
|
|
38
|
+
kid: string;
|
|
39
|
+
/** Canonical issuer URL (HTTPS or DID). */
|
|
40
|
+
issuer: string;
|
|
41
|
+
/** Session identifier for event correlation. */
|
|
42
|
+
sessionId: string;
|
|
43
|
+
/** Agent identifier. */
|
|
44
|
+
agentId: string;
|
|
45
|
+
/** Provider name. Caller-supplied; never hardcoded. */
|
|
46
|
+
provider: string;
|
|
47
|
+
/** The event to issue. */
|
|
48
|
+
event: ManagedAgentEvent;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Result of issuing a managed agent event.
|
|
52
|
+
*/
|
|
53
|
+
export interface IssueEventResult {
|
|
54
|
+
/** Compact JWS (signed Interaction Record). */
|
|
55
|
+
jws: string;
|
|
56
|
+
/** PEAC event type URI used. */
|
|
57
|
+
type: EventType;
|
|
58
|
+
/** Event family. */
|
|
59
|
+
family: EventFamily;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Session evidence summary aggregated from verified receipts.
|
|
63
|
+
*/
|
|
64
|
+
export interface SessionSummary {
|
|
65
|
+
/** Session identifier. */
|
|
66
|
+
sessionId: string;
|
|
67
|
+
/** Total receipts in the session. */
|
|
68
|
+
receipts: number;
|
|
69
|
+
/** Distinct event families represented. */
|
|
70
|
+
families: EventFamily[];
|
|
71
|
+
/** Issuer (from the first receipt, or empty if no receipts). */
|
|
72
|
+
issuer: string;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,OAAO,aAAa;IACpB,OAAO,aAAa;IACpB,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,MAAM,EAAE,WAAW,CAAC;IACpB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,UAAU,EAAE,UAAU,CAAC;IACvB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,oBAAoB;IACpB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@peac/adapter-managed-agents",
|
|
3
|
+
"version": "0.12.9",
|
|
4
|
+
"description": "Vendor-neutral managed agent runtime event adapter for PEAC interaction evidence",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"default": "./dist/index.mjs"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/peacprotocol/peac.git",
|
|
22
|
+
"directory": "packages/adapters/managed-agents"
|
|
23
|
+
},
|
|
24
|
+
"author": "PEAC Protocol Contributors",
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"homepage": "https://peacprotocol.org",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/peacprotocol/peac/issues"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public",
|
|
36
|
+
"provenance": true
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=22.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@peac/protocol": "0.12.9",
|
|
43
|
+
"@peac/crypto": "0.12.9"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^22.0.0",
|
|
47
|
+
"tsup": "^8.0.0",
|
|
48
|
+
"typescript": "^5.3.3",
|
|
49
|
+
"vitest": "^4.0.0"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"peac",
|
|
53
|
+
"peacprotocol",
|
|
54
|
+
"interaction-records",
|
|
55
|
+
"signed-records",
|
|
56
|
+
"managed-agents",
|
|
57
|
+
"agent-evidence",
|
|
58
|
+
"mcp",
|
|
59
|
+
"a2a"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"prebuild": "rm -rf dist",
|
|
63
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
|
64
|
+
"build:js": "tsup",
|
|
65
|
+
"build:types": "rm -f dist/.tsbuildinfo && tsc && rm -f dist/.tsbuildinfo",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"test:watch": "vitest",
|
|
68
|
+
"clean": "rm -rf dist"
|
|
69
|
+
}
|
|
70
|
+
}
|