@ouro.bot/cli 0.1.0-alpha.1390 → 0.1.0-alpha.1393
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.json +12 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/a2a/refusals.js +2 -0
- package/dist/a2a/server.js +268 -38
- package/dist/repertoire/guardrails.js +2 -0
- package/dist/senses/a2a-entry.js +6 -2
- package/dist/senses/inbound-journal.js +182 -0
- package/dist/senses/shared-turn.js +3 -1
- package/node_modules/@ouro.bot/friends/README.md +17 -4
- package/node_modules/@ouro.bot/friends/actions/generated/mcp.json +1105 -0
- package/node_modules/@ouro.bot/friends/changelog.json +72 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.d.ts +1 -1
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.d.ts +2 -2
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.js +12 -8
- package/node_modules/@ouro.bot/friends/dist/channel.d.ts +5 -0
- package/node_modules/@ouro.bot/friends/dist/channel.js +12 -1
- package/node_modules/@ouro.bot/friends/dist/connect.js +8 -8
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.d.ts +3 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.js +30 -9
- package/node_modules/@ouro.bot/friends/dist/grants.d.ts +5 -1
- package/node_modules/@ouro.bot/friends/dist/grants.js +22 -6
- package/node_modules/@ouro.bot/friends/dist/index.d.ts +3 -3
- package/node_modules/@ouro.bot/friends/dist/index.js +5 -2
- package/node_modules/@ouro.bot/friends/dist/link-identity.js +9 -9
- package/node_modules/@ouro.bot/friends/dist/mcp/bin.js +2 -1
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.js +211 -16
- package/node_modules/@ouro.bot/friends/dist/mcp/run-main.js +24 -13
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.js +9 -431
- package/node_modules/@ouro.bot/friends/dist/mcp/server.js +2 -1
- package/node_modules/@ouro.bot/friends/dist/message.d.ts +19 -1
- package/node_modules/@ouro.bot/friends/dist/message.js +31 -1
- package/node_modules/@ouro.bot/friends/dist/mission-result.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.js +14 -7
- package/node_modules/@ouro.bot/friends/dist/mission-store-file.js +8 -0
- package/node_modules/@ouro.bot/friends/dist/missions.js +6 -5
- package/node_modules/@ouro.bot/friends/dist/notes.js +4 -4
- package/node_modules/@ouro.bot/friends/dist/outcomes.js +1 -1
- package/node_modules/@ouro.bot/friends/dist/share.d.ts +6 -1
- package/node_modules/@ouro.bot/friends/dist/share.js +40 -4
- package/node_modules/@ouro.bot/friends/dist/store-file.js +28 -13
- package/node_modules/@ouro.bot/friends/dist/tokens.d.ts +3 -1
- package/node_modules/@ouro.bot/friends/dist/tokens.js +5 -2
- package/node_modules/@ouro.bot/friends/dist/trust-mutation.js +2 -2
- package/node_modules/@ouro.bot/friends/dist/types.d.ts +12 -0
- package/node_modules/@ouro.bot/friends/dist/util/safe-id.d.ts +1 -0
- package/node_modules/@ouro.bot/friends/dist/util/safe-id.js +10 -0
- package/node_modules/@ouro.bot/friends/package.json +2 -1
- package/npm-shrinkwrap.json +6 -6
- package/package.json +2 -2
|
@@ -3,23 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getToolSchemas = getToolSchemas;
|
|
4
4
|
// MCP tool schemas for the friends server.
|
|
5
5
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// explain_standing — read-only, advisory; never write trust, never on the wire),
|
|
12
|
-
// the brick-5 coordination verbs (coordinate, import_coordination,
|
|
13
|
-
// get_coordination — negotiate WHO does a mission; advisory assignment metadata),
|
|
14
|
-
// and the p11-inc2 own-fleet delegation surface (connect_to — the management-sense
|
|
15
|
-
// control plane that links two own agents + audits action:"connect"; send_result,
|
|
16
|
-
// import_result — the result-return / delegation deliverable channel that carries
|
|
17
|
-
// B's produced artifact back to A, attributed + correlated + quarantined on import).
|
|
18
|
-
// Each schema follows JSON Schema for
|
|
19
|
-
// `inputSchema` as required by MCP. The shape mirrors the harness's McpToolSchema
|
|
20
|
-
// so the same client tooling consumes both.
|
|
6
|
+
// The tool list is generated. `actions/friends.actions.mts` declares each tool once (its name, description and input),
|
|
7
|
+
// and `ouro-actions generate` writes `actions/generated/mcp.json`, the one MCP door this server serves. CI's
|
|
8
|
+
// `compare-mcp` fails when the served list drifts from the declarations.
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
21
11
|
const observability_1 = require("../observability");
|
|
22
|
-
|
|
12
|
+
// Beside dist/ in the published package (`files` in package.json), and beside src/ in the repository.
|
|
13
|
+
const MCP_DOOR = (0, node_path_1.join)(__dirname, "..", "..", "actions", "generated", "mcp.json");
|
|
23
14
|
function getToolSchemas() {
|
|
24
15
|
(0, observability_1.emitNervesEvent)({
|
|
25
16
|
component: "clients",
|
|
@@ -27,419 +18,6 @@ function getToolSchemas() {
|
|
|
27
18
|
message: "listed friends mcp tool schemas",
|
|
28
19
|
meta: {},
|
|
29
20
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
name: "resolve_party",
|
|
33
|
-
description: "Resolve an external identity (provider + externalId on a channel) into a friend record, creating one on first contact. Returns { friend, channel, created }.",
|
|
34
|
-
inputSchema: {
|
|
35
|
-
type: "object",
|
|
36
|
-
properties: {
|
|
37
|
-
provider: { type: "string", description: "identity provider, e.g. aad, local, teams-conversation, imessage-handle, email-address, a2a-agent" },
|
|
38
|
-
externalId: { type: "string", description: "the external identity within the provider" },
|
|
39
|
-
displayName: { type: "string", description: "display name for the party (use 'Unknown' if not known)" },
|
|
40
|
-
channel: { type: "string", description: "the channel/sense the session belongs to, e.g. cli, teams, mcp" },
|
|
41
|
-
tenantId: { type: "string", description: "optional tenant id" },
|
|
42
|
-
},
|
|
43
|
-
required: ["provider", "externalId"],
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "describe_trust",
|
|
48
|
-
description: "Explain the trust context for a friend: level, basis (direct/shared_group/unknown), what it permits and constrains.",
|
|
49
|
-
inputSchema: {
|
|
50
|
-
type: "object",
|
|
51
|
-
properties: {
|
|
52
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
53
|
-
channel: { type: "string", description: "the channel/sense for the explanation" },
|
|
54
|
-
isGroupChat: { type: "string", description: "set to 'true' when the conversation is a group chat" },
|
|
55
|
-
},
|
|
56
|
-
required: ["friendId", "channel"],
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: "assess_standing",
|
|
61
|
-
description: "Assess a peer's earned standing from your FIRST-PARTY outcomes with them: a tier (proven/reliable/mixed/untested/troubled), the basis count, and the tally. Advisory only — never changes trust, never shared. Returns a Standing, or { ok:false, status:'not_found' } when the friend is missing.",
|
|
62
|
-
inputSchema: {
|
|
63
|
-
type: "object",
|
|
64
|
-
properties: {
|
|
65
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
66
|
-
},
|
|
67
|
-
required: ["friendId"],
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: "explain_standing",
|
|
72
|
-
description: "Explain a peer's earned standing in words: the tier with a human summary, why, and advisory notes that frame it as input to a MANUAL trust decision (never an instruction to change trust). Returns a StandingExplanation, or { ok:false, status:'not_found' } when the friend is missing.",
|
|
73
|
-
inputSchema: {
|
|
74
|
-
type: "object",
|
|
75
|
-
properties: {
|
|
76
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
77
|
-
},
|
|
78
|
-
required: ["friendId"],
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "get_friend",
|
|
83
|
-
description: "Fetch a single friend record by uuid or by name.",
|
|
84
|
-
inputSchema: {
|
|
85
|
-
type: "object",
|
|
86
|
-
properties: {
|
|
87
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
88
|
-
},
|
|
89
|
-
required: ["friendId"],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "list_friends",
|
|
94
|
-
description: "List friend records, optionally filtered by trust level and kind, optionally limited.",
|
|
95
|
-
inputSchema: {
|
|
96
|
-
type: "object",
|
|
97
|
-
properties: {
|
|
98
|
-
trust: { type: "string", description: "filter by trust level: family/friend/acquaintance/stranger" },
|
|
99
|
-
kind: { type: "string", description: "filter by kind: human/agent" },
|
|
100
|
-
limit: { type: "string", description: "max number of records to return" },
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: "save_note",
|
|
106
|
-
description: "Save a friend's name, a tool preference, or a general note. Use override='true' to overwrite an existing value.",
|
|
107
|
-
inputSchema: {
|
|
108
|
-
type: "object",
|
|
109
|
-
properties: {
|
|
110
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
111
|
-
type: { type: "string", enum: ["name", "tool_preference", "note"], description: "what to save" },
|
|
112
|
-
key: { type: "string", description: "key for tool_preference or note" },
|
|
113
|
-
content: { type: "string", description: "the value to save" },
|
|
114
|
-
override: { type: "string", enum: ["true", "false"], description: "set to 'true' to overwrite an existing value" },
|
|
115
|
-
provenance: { type: "object", description: "optional attribution { assertedBy: { agentId, agentName } }" },
|
|
116
|
-
},
|
|
117
|
-
required: ["friendId", "type", "content"],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: "record_interaction",
|
|
122
|
-
description: "Record a turn with a friend: accumulate token usage and/or append a shared-mission outcome (bumping familiarity).",
|
|
123
|
-
inputSchema: {
|
|
124
|
-
type: "object",
|
|
125
|
-
properties: {
|
|
126
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
127
|
-
usage: { type: "object", description: "token usage; only output_tokens is counted" },
|
|
128
|
-
outcome: { type: "object", description: "shared-mission outcome { missionId, result, note? }" },
|
|
129
|
-
familiarityDelta: { type: "string", description: "how much to bump familiarity (default 1)" },
|
|
130
|
-
provenance: { type: "object", description: "optional attribution for the outcome" },
|
|
131
|
-
},
|
|
132
|
-
required: ["friendId"],
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "upsert_group",
|
|
137
|
-
description: "Upsert shared-group participant context: link each participant to the group, promoting strangers to acquaintances.",
|
|
138
|
-
inputSchema: {
|
|
139
|
-
type: "object",
|
|
140
|
-
properties: {
|
|
141
|
-
groupExternalId: { type: "string", description: "the group's external id" },
|
|
142
|
-
participants: { type: "array", description: "participants [{ provider, externalId, displayName? }]" },
|
|
143
|
-
},
|
|
144
|
-
required: ["groupExternalId", "participants"],
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "set_trust",
|
|
149
|
-
description: "Set a friend's trust level (also mirrors it onto the record's role).",
|
|
150
|
-
inputSchema: {
|
|
151
|
-
type: "object",
|
|
152
|
-
properties: {
|
|
153
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
154
|
-
trustLevel: { type: "string", enum: ["family", "friend", "acquaintance", "stranger"], description: "the trust level to set" },
|
|
155
|
-
},
|
|
156
|
-
required: ["friendId", "trustLevel"],
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: "link_identity",
|
|
161
|
-
description: "Link an external identity to a friend, merging any orphan record that already holds it (cross-channel unification).",
|
|
162
|
-
inputSchema: {
|
|
163
|
-
type: "object",
|
|
164
|
-
properties: {
|
|
165
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
166
|
-
provider: STRING,
|
|
167
|
-
externalId: STRING,
|
|
168
|
-
tenantId: { type: "string", description: "optional tenant id" },
|
|
169
|
-
},
|
|
170
|
-
required: ["friendId", "provider", "externalId"],
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
name: "unlink_identity",
|
|
175
|
-
description: "Remove an external identity from a friend.",
|
|
176
|
-
inputSchema: {
|
|
177
|
-
type: "object",
|
|
178
|
-
properties: {
|
|
179
|
-
friendId: { type: "string", description: "friend uuid or name" },
|
|
180
|
-
provider: STRING,
|
|
181
|
-
externalId: STRING,
|
|
182
|
-
},
|
|
183
|
-
required: ["friendId", "provider", "externalId"],
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
name: "onboard_agent",
|
|
188
|
-
description: "Upsert an agent-peer friend record from already-resolved coordinates (no HTTP card fetch).",
|
|
189
|
-
inputSchema: {
|
|
190
|
-
type: "object",
|
|
191
|
-
properties: {
|
|
192
|
-
name: { type: "string", description: "the peer agent's name" },
|
|
193
|
-
agentId: { type: "string", description: "the a2a agent id" },
|
|
194
|
-
trustLevel: { type: "string", description: "trust level (default stranger (cold contact))" },
|
|
195
|
-
a2a: { type: "object", description: "a2a coordinates { cardUrl?, endpointUrl?, protocolVersion? }" },
|
|
196
|
-
mailbox: { type: "object", description: "optional A2A git-mailbox coords { repo, selfOutboxAgentId }" },
|
|
197
|
-
bundleName: { type: "string", description: "optional bundle name" },
|
|
198
|
-
},
|
|
199
|
-
required: ["name", "agentId"],
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: "connect_to",
|
|
204
|
-
description: "Management-sense control plane (brick 8): the owner links one of their OWN agents into this agent's fleet — introduce a peer by agentId/did/name at a trust level (default family for own-fleet). Authority-gated: commits inline ONLY from a local (owner-only stdio) or roster-verified same-account closed sense; an open sense never commits inline (it downgrades to a confirm-prompt); a bare name with no resolvable handle/DID and no record hit returns needs_handle_or_introduction (never fabricates a target). Writes one control-plane audit record (action:'connect') through the wired sink. Returns { ok:true, status:'connected', record } or { ok:false, status:'downgraded'|'needs_handle_or_introduction', downgrade? }.",
|
|
205
|
-
inputSchema: {
|
|
206
|
-
type: "object",
|
|
207
|
-
properties: {
|
|
208
|
-
agentId: { type: "string", description: "the peer agent's join-key agentId (an owner-supplied handle)" },
|
|
209
|
-
did: { type: "string", description: "the peer's DID (an alternative handle; must resolve to an existing record)" },
|
|
210
|
-
name: { type: "string", description: "the peer's colloquial name (resolves ONLY by matching an existing record — never fabricated)" },
|
|
211
|
-
trustLevel: { type: "string", enum: ["family", "friend", "acquaintance", "stranger"], description: "the trust to link at (default family for own-fleet linked agents)" },
|
|
212
|
-
proof: { type: "string", description: "optional opaque proof slot (reserved; the TOFU path ignores it)" },
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: "whoami",
|
|
218
|
-
description: "Resolve who the machine owner is and which friend record represents the self.",
|
|
219
|
-
inputSchema: {
|
|
220
|
-
type: "object",
|
|
221
|
-
properties: {},
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "channel_caps",
|
|
226
|
-
description: "Return the capabilities of a channel (integrations, markdown, streaming, rich cards, max length).",
|
|
227
|
-
inputSchema: {
|
|
228
|
-
type: "object",
|
|
229
|
-
properties: {
|
|
230
|
-
channel: { type: "string", description: "the channel to look up" },
|
|
231
|
-
},
|
|
232
|
-
required: ["channel"],
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: "resolve_room",
|
|
237
|
-
description: "Resolve a room (a group's external id) into its members, each with their trust context and how they're known (direct/group_only). Pure read.",
|
|
238
|
-
inputSchema: {
|
|
239
|
-
type: "object",
|
|
240
|
-
properties: {
|
|
241
|
-
groupExternalId: { type: "string", description: "the group's external id (e.g. group:project;+;g1)" },
|
|
242
|
-
channel: { type: "string", description: "channel lens for the trust explanation (default mcp)" },
|
|
243
|
-
},
|
|
244
|
-
required: ["groupExternalId"],
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: "share_profile",
|
|
249
|
-
description: "Producer: prepare a consent-gated, scope-filtered, provenance-preserving profile-share envelope for another agent (names the party by join key, never the local uuid). Self identity comes from whoami. Returns { ok, envelope } or { ok:false, status }.",
|
|
250
|
-
inputSchema: {
|
|
251
|
-
type: "object",
|
|
252
|
-
properties: {
|
|
253
|
-
friendId: { type: "string", description: "the local friend to share (uuid or name)" },
|
|
254
|
-
toAgentId: { type: "string", description: "the recipient agent's join-key agentId" },
|
|
255
|
-
scope: { type: "string", enum: ["name", "identity", "notes:safe", "notes:all", "outcomes"], description: "what to share: identity scopes carry only the join key; notes:* / outcomes require an explicit grant under the default tiered policy" },
|
|
256
|
-
proof: { type: "string", description: "optional opaque proof to stamp on the envelope (for a non-TOFU recipient verifier)" },
|
|
257
|
-
},
|
|
258
|
-
required: ["friendId", "toAgentId", "scope"],
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
name: "import_profile",
|
|
263
|
-
description: "Consumer (non-clobbering merge): import a profile-share envelope. Resolves the party by join key; lands facts in the imported namespace WITHOUT touching first-party notes; source trust caps acceptance; never changes the party's trust. Returns { ok, status, record }.",
|
|
264
|
-
inputSchema: {
|
|
265
|
-
type: "object",
|
|
266
|
-
properties: {
|
|
267
|
-
envelope: { type: "object", description: "the ProfileShareEnvelope to import" },
|
|
268
|
-
fromAgentId: { type: "string", description: "the agent the envelope arrived from (join-key agentId)" },
|
|
269
|
-
trustOfSource: { type: "string", enum: ["family", "friend", "acquaintance", "stranger"], description: "this agent's resolved trust in the source agent — the acceptance cap" },
|
|
270
|
-
},
|
|
271
|
-
required: ["envelope", "fromAgentId", "trustOfSource"],
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
name: "grant_share",
|
|
276
|
-
description: "Mint an explicit, revocable consent grant: an agent may receive a scope of a subject (a friend's profile, keyed by friend uuid; or a mission, keyed by its missionKey). The consent half of the moat.",
|
|
277
|
-
inputSchema: {
|
|
278
|
-
type: "object",
|
|
279
|
-
properties: {
|
|
280
|
-
subjectKey: { type: "string", description: "whose data may be shared — a local friend uuid for a profile, or a missionKey for a mission (the legacy arg name subjectFriendId is still accepted)" },
|
|
281
|
-
recipientAgentId: { type: "string", description: "the agent that may receive it (join-key agentId)" },
|
|
282
|
-
scope: { type: "string", enum: ["name", "identity", "notes:safe", "notes:all", "outcomes", "mission"], description: "the scope consented to" },
|
|
283
|
-
expiresAt: { type: "string", description: "optional ISO expiry; absent ⇒ never expires" },
|
|
284
|
-
},
|
|
285
|
-
required: ["subjectKey", "recipientAgentId", "scope"],
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
name: "revoke_share",
|
|
290
|
-
description: "Revoke a consent grant by id (tombstones it; the audit trail survives). The right-to-be-forgotten lever.",
|
|
291
|
-
inputSchema: {
|
|
292
|
-
type: "object",
|
|
293
|
-
properties: {
|
|
294
|
-
grantId: { type: "string", description: "the grant id to revoke" },
|
|
295
|
-
},
|
|
296
|
-
required: ["grantId"],
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
name: "list_shares",
|
|
301
|
-
description: "List consent grants with their effective state, optionally filtered by subject / recipient / effectiveness. The audit + revoke surface.",
|
|
302
|
-
inputSchema: {
|
|
303
|
-
type: "object",
|
|
304
|
-
properties: {
|
|
305
|
-
subjectKey: { type: "string", description: "filter to one subject — a friend uuid or a missionKey (the legacy arg name subjectFriendId is still accepted)" },
|
|
306
|
-
recipientAgentId: { type: "string", description: "filter to one recipient agent" },
|
|
307
|
-
effectiveOnly: { type: "string", enum: ["true", "false"], description: "set to 'true' to return only grants that currently consent" },
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
name: "record_mission",
|
|
313
|
-
description: "Upsert a shared mission (brick 3) by its cross-agent missionKey: create one when the key is unknown, else merge into the existing record. Appends first-party learnings / participants / outcomes and sets status. The mission analogue of record_interaction's outcome writer.",
|
|
314
|
-
inputSchema: {
|
|
315
|
-
type: "object",
|
|
316
|
-
properties: {
|
|
317
|
-
missionKey: { type: "string", description: "the cross-agent join key for the mission (a ticket id / repo+PR / slugged name)" },
|
|
318
|
-
title: { type: "string", description: "human title; used only when CREATING (ignored on upsert)" },
|
|
319
|
-
status: { type: "string", enum: ["active", "succeeded", "partial", "failed", "abandoned"], description: "the mission status (first-party)" },
|
|
320
|
-
participants: { type: "array", description: "agent attributions [{ agentId?, agentName? }], merged deduped by agentId" },
|
|
321
|
-
learnings: { type: "array", description: "first-party learnings [{ key, value, shareable? }] appended to the mission" },
|
|
322
|
-
outcomes: { type: "array", description: "first-party outcomes [{ missionId, result, note? }] appended to the mission" },
|
|
323
|
-
},
|
|
324
|
-
required: ["missionKey"],
|
|
325
|
-
},
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
name: "get_mission",
|
|
329
|
-
description: "Fetch a single mission record by its local uuid id.",
|
|
330
|
-
inputSchema: {
|
|
331
|
-
type: "object",
|
|
332
|
-
properties: {
|
|
333
|
-
missionId: { type: "string", description: "the mission's local uuid id" },
|
|
334
|
-
},
|
|
335
|
-
required: ["missionId"],
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
name: "list_missions",
|
|
340
|
-
description: "List mission records, optionally limited.",
|
|
341
|
-
inputSchema: {
|
|
342
|
-
type: "object",
|
|
343
|
-
properties: {
|
|
344
|
-
limit: { type: "string", description: "max number of records to return" },
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: "share_mission",
|
|
350
|
-
description: "Producer: prepare a consent-gated, scope-filtered, provenance-preserving mission-share envelope for another agent (names the mission by its missionKey, never the local uuid). Self identity comes from whoami. 'mission' carries the shareable learnings; 'outcomes' carries the mission's outcomes. Returns { ok, envelope } or { ok:false, status }.",
|
|
351
|
-
inputSchema: {
|
|
352
|
-
type: "object",
|
|
353
|
-
properties: {
|
|
354
|
-
missionId: { type: "string", description: "the local mission to share (its local uuid id)" },
|
|
355
|
-
toAgentId: { type: "string", description: "the recipient agent's join-key agentId" },
|
|
356
|
-
scope: { type: "string", enum: ["mission", "outcomes"], description: "what to share: 'mission' (title/status + shareable learnings) or 'outcomes' (the result rows); both require an explicit grant under the tiered policy" },
|
|
357
|
-
proof: { type: "string", description: "optional opaque proof to stamp on the envelope (for a non-TOFU recipient verifier)" },
|
|
358
|
-
},
|
|
359
|
-
required: ["missionId", "toAgentId", "scope"],
|
|
360
|
-
},
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
name: "import_mission",
|
|
364
|
-
description: "Consumer (non-clobbering merge): import a mission-share envelope. Resolves the mission by missionKey; lands learnings in the imported namespace WITHOUT touching first-party learnings; append-merges + dedupes outcomes; source trust caps acceptance; never recomputes status/participants. Returns { ok, status, record }.",
|
|
365
|
-
inputSchema: {
|
|
366
|
-
type: "object",
|
|
367
|
-
properties: {
|
|
368
|
-
envelope: { type: "object", description: "the MissionShareEnvelope to import" },
|
|
369
|
-
fromAgentId: { type: "string", description: "the agent the envelope arrived from (join-key agentId)" },
|
|
370
|
-
trustOfSource: { type: "string", enum: ["family", "friend", "acquaintance", "stranger"], description: "this agent's resolved trust in the source agent — the acceptance cap" },
|
|
371
|
-
},
|
|
372
|
-
required: ["envelope", "fromAgentId", "trustOfSource"],
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
name: "coordinate",
|
|
377
|
-
description: "Producer (brick 5): prepare a coordination message that negotiates WHO does a mission — one of request/offer/accept/decline/handoff, named by the mission's missionKey (never the local uuid). Consent-gated via the identity-tier 'coordinate' scope (trust ≥ friend suffices). 'accept' claims the assignment for self; 'handoff' (you must hold the assignment) proposes a new assignee whose own accept confirms it (non-transitive). Self identity comes from whoami. Returns { ok, envelope } or { ok:false, status: not_found|no_consent|not_assignee }.",
|
|
378
|
-
inputSchema: {
|
|
379
|
-
type: "object",
|
|
380
|
-
properties: {
|
|
381
|
-
missionId: { type: "string", description: "the local mission to coordinate (its local uuid id)" },
|
|
382
|
-
toAgentId: { type: "string", description: "the recipient agent's join-key agentId" },
|
|
383
|
-
intent: { type: "string", enum: ["request", "offer", "accept", "decline", "handoff"], description: "the coordination verb: request (will you take this?) / offer (I'll take this) / accept (yes, I'm on it — sets assignee=self) / decline (no) / handoff (it's yours now — you must hold the assignment; proposes a new assignee)" },
|
|
384
|
-
note: { type: "string", description: "optional free text carried on the message + logged" },
|
|
385
|
-
proposedAssignee: { type: "object", description: "the proposed new assignee { agentId?, agentName? } — meaningful ONLY on intent=handoff" },
|
|
386
|
-
task: { type: "object", description: "optional delegation task-spec { summary, details?, inputs? } — meaningful ONLY on intent=request (gap-2); the producer mints a requestId, stamps it on the envelope, and records the delegation first-party for the result-return to correlate against" },
|
|
387
|
-
proof: { type: "string", description: "optional opaque proof to stamp on the envelope (for a non-TOFU recipient verifier)" },
|
|
388
|
-
},
|
|
389
|
-
required: ["missionId", "toAgentId", "intent"],
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
name: "import_coordination",
|
|
394
|
-
description: "Consumer (brick 5, non-clobbering merge): import a coordination message. Resolves the mission by missionKey; appends the intent to coordination.log stamped origin:imported WITHOUT touching first-party learnings/notes/status; only an 'accept' sets the assignee (last-writer-wins by issuedAt); a 'handoff' never forces an assignee onto you (only your own accept does); never recomputes status/trust/standing; source trust caps acceptance; a friend/family peer may seed an unknown mission. Returns { ok, status: logged|assigned|seeded, record } or { ok:false, status }.",
|
|
395
|
-
inputSchema: {
|
|
396
|
-
type: "object",
|
|
397
|
-
properties: {
|
|
398
|
-
envelope: { type: "object", description: "the CoordinationEnvelope to import" },
|
|
399
|
-
fromAgentId: { type: "string", description: "the agent the envelope arrived from (join-key agentId)" },
|
|
400
|
-
trustOfSource: { type: "string", enum: ["family", "friend", "acquaintance", "stranger"], description: "this agent's resolved trust in the source agent — the acceptance cap" },
|
|
401
|
-
},
|
|
402
|
-
required: ["envelope", "fromAgentId", "trustOfSource"],
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
name: "get_coordination",
|
|
407
|
-
description: "Read lens (brick 5): return a mission's coordination state — its current assignee (who holds it; absent ⇒ unclaimed) + the append-only log of every request/offer/accept/decline/handoff that flowed. Returns { assignee, assignedAt?, log } (the empty default { assignee: undefined, log: [] } when never coordinated), or { ok:false, status:'not_found' } when the mission is missing.",
|
|
408
|
-
inputSchema: {
|
|
409
|
-
type: "object",
|
|
410
|
-
properties: {
|
|
411
|
-
missionId: { type: "string", description: "the mission's local uuid id" },
|
|
412
|
-
},
|
|
413
|
-
required: ["missionId"],
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
name: "send_result",
|
|
418
|
-
description: "Producer (gap-2 — the result-return): B returns its DELIVERABLE for a delegation, attributed to B (from whoami) + correlated to A's task-spec by requestId, named by the mission's missionKey (never the local uuid). Consent-gated via the identity-tier 'coordinate' scope (a result is B answering A's own delegation — trust ≥ friend suffices; NO new scope). Records the result first-party on B's own mission. Returns { ok, envelope } or { ok:false, status: not_found|no_consent }.",
|
|
419
|
-
inputSchema: {
|
|
420
|
-
type: "object",
|
|
421
|
-
properties: {
|
|
422
|
-
missionId: { type: "string", description: "the local mission B is returning a result for (its local uuid id)" },
|
|
423
|
-
toAgentId: { type: "string", description: "the recipient agent's join-key agentId — A, the delegator" },
|
|
424
|
-
requestId: { type: "string", description: "the delegation correlation key (the task-spec's requestId)" },
|
|
425
|
-
result: { type: "object", description: "B's deliverable { summary, artifact?, outputs? }" },
|
|
426
|
-
proof: { type: "string", description: "optional opaque proof to stamp on the envelope (for a non-TOFU recipient verifier)" },
|
|
427
|
-
},
|
|
428
|
-
required: ["missionId", "toAgentId", "requestId", "result"],
|
|
429
|
-
},
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
name: "import_result",
|
|
433
|
-
description: "Consumer (gap-2, non-clobbering merge): A imports B's result-return. Resolves the mission by missionKey; lands B's deliverable QUARANTINED + attributed under importedResults WITHOUT touching first-party; source trust caps acceptance (checked before correlation); a result whose requestId matches no prior first-party delegation is REJECTED (no_delegation — A only accepts results for work it delegated); an unknown mission is no_mission (a result never seeds a mission); never recomputes status/participants. Returns { ok, status, record } or { ok:false, status: untrusted_source|no_mission|no_delegation|invalid }.",
|
|
434
|
-
inputSchema: {
|
|
435
|
-
type: "object",
|
|
436
|
-
properties: {
|
|
437
|
-
envelope: { type: "object", description: "the MissionResultEnvelope to import" },
|
|
438
|
-
fromAgentId: { type: "string", description: "the agent the envelope arrived from (join-key agentId) — B" },
|
|
439
|
-
trustOfSource: { type: "string", enum: ["family", "friend", "acquaintance", "stranger"], description: "this agent's resolved trust in the source agent — the acceptance cap" },
|
|
440
|
-
},
|
|
441
|
-
required: ["envelope", "fromAgentId", "trustOfSource"],
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
];
|
|
21
|
+
const door = JSON.parse((0, node_fs_1.readFileSync)(MCP_DOOR, "utf8"));
|
|
22
|
+
return door.tools;
|
|
445
23
|
}
|
|
@@ -158,7 +158,8 @@ function createFriendsMcpServer(options) {
|
|
|
158
158
|
writeResponse({
|
|
159
159
|
jsonrpc: "2.0",
|
|
160
160
|
id: request.id,
|
|
161
|
-
|
|
161
|
+
// A throw (the store couldn't read or write, say) is the tool_failed status, apart from a tool's own outcomes.
|
|
162
|
+
result: { content: [{ type: "text", text: JSON.stringify({ ok: false, status: "tool_failed", message }) }], isError: true },
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
165
|
}
|
|
@@ -4,6 +4,18 @@ import type { AgentVerifier } from "./verifier";
|
|
|
4
4
|
export declare const MAX_MESSAGE_TEXT_CHARS = 16000;
|
|
5
5
|
/** A sender-chosen thread id (e.g. an A2A contextId) is an opaque short token. */
|
|
6
6
|
export declare const MAX_CONVERSATION_ID_CHARS = 256;
|
|
7
|
+
/** A sender's signed answer to an approval its peer routed to it (see `ApprovalAnswer`). Deny only in this
|
|
8
|
+
* version: a receiver refuses any other decision as malformed, so allowing approve takes a new release. */
|
|
9
|
+
export type ApprovalDecision = "deny";
|
|
10
|
+
/** Signed with the text, so a relay can neither add, strip nor change it. It claims nothing
|
|
11
|
+
* on its own: the recipient matches `relayToken` against an approval it routed to this
|
|
12
|
+
* sender, and decides whether it honours `decision` at all. Never set from model input. */
|
|
13
|
+
export interface ApprovalAnswer {
|
|
14
|
+
relayToken: string;
|
|
15
|
+
decision: ApprovalDecision;
|
|
16
|
+
}
|
|
17
|
+
/** True only for exactly `{ relayToken, decision }` with a well-formed token and a known decision. */
|
|
18
|
+
export declare function isApprovalAnswer(value: unknown): value is ApprovalAnswer;
|
|
7
19
|
/** The cross-agent message envelope. Names the sender by its join-key agentId (DID). */
|
|
8
20
|
export interface MessageEnvelope {
|
|
9
21
|
/** The agent that wrote this message (its join-key agentId / DID). */
|
|
@@ -17,6 +29,8 @@ export interface MessageEnvelope {
|
|
|
17
29
|
* It claims nothing on its own: the recipient honours it only for a sender its own
|
|
18
30
|
* friend record explicitly grants delegation to. */
|
|
19
31
|
onBehalfOf?: "principal";
|
|
32
|
+
/** A signed answer to an approval the recipient routed to this sender. Never set with `onBehalfOf`. */
|
|
33
|
+
approvalAnswer?: ApprovalAnswer;
|
|
20
34
|
/** Opaque, verifier-specific proof slot (stamped by `sealEnvelope`). */
|
|
21
35
|
proof?: string;
|
|
22
36
|
issuedAt: string;
|
|
@@ -28,6 +42,8 @@ export interface ReceivedMessage {
|
|
|
28
42
|
conversationId?: string;
|
|
29
43
|
/** Present only when the signed envelope carried the delegation marker. */
|
|
30
44
|
onBehalfOf?: "principal";
|
|
45
|
+
/** Present only when the signed envelope carried an approval answer. */
|
|
46
|
+
approvalAnswer?: ApprovalAnswer;
|
|
31
47
|
issuedAt: string;
|
|
32
48
|
}
|
|
33
49
|
export interface PrepareMessageInput {
|
|
@@ -37,6 +53,8 @@ export interface PrepareMessageInput {
|
|
|
37
53
|
conversationId?: string;
|
|
38
54
|
/** Mark the message as a command relayed from this agent's principal. */
|
|
39
55
|
onBehalfOf?: "principal";
|
|
56
|
+
/** Answer an approval the recipient routed to this agent. Set only by harness code, never from model input. */
|
|
57
|
+
approvalAnswer?: ApprovalAnswer;
|
|
40
58
|
now?: () => string;
|
|
41
59
|
}
|
|
42
60
|
export type PrepareMessageResult = {
|
|
@@ -44,7 +62,7 @@ export type PrepareMessageResult = {
|
|
|
44
62
|
envelope: MessageEnvelope;
|
|
45
63
|
} | {
|
|
46
64
|
ok: false;
|
|
47
|
-
status: "empty_text" | "text_too_long" | "invalid_conversation_id" | "invalid_sender" | "invalid_delegation";
|
|
65
|
+
status: "empty_text" | "text_too_long" | "invalid_conversation_id" | "invalid_sender" | "invalid_delegation" | "invalid_approval_answer";
|
|
48
66
|
};
|
|
49
67
|
/** Producer half: build an unsigned message envelope (sealing signs it). */
|
|
50
68
|
export declare function prepareMessage(input: PrepareMessageInput): PrepareMessageResult;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MAX_CONVERSATION_ID_CHARS = exports.MAX_MESSAGE_TEXT_CHARS = void 0;
|
|
4
|
+
exports.isApprovalAnswer = isApprovalAnswer;
|
|
4
5
|
exports.prepareMessage = prepareMessage;
|
|
5
6
|
exports.receiveMessage = receiveMessage;
|
|
6
7
|
/**
|
|
@@ -24,6 +25,17 @@ const verifier_1 = require("./verifier");
|
|
|
24
25
|
exports.MAX_MESSAGE_TEXT_CHARS = 16_000;
|
|
25
26
|
/** A sender-chosen thread id (e.g. an A2A contextId) is an opaque short token. */
|
|
26
27
|
exports.MAX_CONVERSATION_ID_CHARS = 256;
|
|
28
|
+
/** The relay token is a base64url MAC the approving agent computed; 16 to 128 characters. */
|
|
29
|
+
const RELAY_TOKEN = /^[A-Za-z0-9_-]{16,128}$/;
|
|
30
|
+
/** True only for exactly `{ relayToken, decision }` with a well-formed token and a known decision. */
|
|
31
|
+
function isApprovalAnswer(value) {
|
|
32
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
33
|
+
return false;
|
|
34
|
+
const v = value;
|
|
35
|
+
return Object.keys(v).sort().join(",") === "decision,relayToken"
|
|
36
|
+
&& typeof v.relayToken === "string" && RELAY_TOKEN.test(v.relayToken)
|
|
37
|
+
&& v.decision === "deny";
|
|
38
|
+
}
|
|
27
39
|
const TRUST_RANK = { family: 4, friend: 3, acquaintance: 2, stranger: 1 };
|
|
28
40
|
/** Producer half: build an unsigned message envelope (sealing signs it). */
|
|
29
41
|
function prepareMessage(input) {
|
|
@@ -38,11 +50,15 @@ function prepareMessage(input) {
|
|
|
38
50
|
}
|
|
39
51
|
if (input.onBehalfOf !== undefined && input.onBehalfOf !== "principal")
|
|
40
52
|
return { ok: false, status: "invalid_delegation" };
|
|
53
|
+
if (input.approvalAnswer !== undefined && (!isApprovalAnswer(input.approvalAnswer) || input.onBehalfOf !== undefined)) {
|
|
54
|
+
return { ok: false, status: "invalid_approval_answer" };
|
|
55
|
+
}
|
|
41
56
|
const envelope = {
|
|
42
57
|
fromAgentId: input.fromAgentId,
|
|
43
58
|
text: input.text,
|
|
44
59
|
...(input.conversationId !== undefined ? { conversationId: input.conversationId } : {}),
|
|
45
60
|
...(input.onBehalfOf !== undefined ? { onBehalfOf: input.onBehalfOf } : {}),
|
|
61
|
+
...(input.approvalAnswer !== undefined ? { approvalAnswer: { relayToken: input.approvalAnswer.relayToken, decision: input.approvalAnswer.decision } } : {}),
|
|
46
62
|
issuedAt: (input.now ?? (() => new Date().toISOString()))(),
|
|
47
63
|
};
|
|
48
64
|
return { ok: true, envelope };
|
|
@@ -55,11 +71,24 @@ function receiveMessage(input, options = {}) {
|
|
|
55
71
|
const conversationId = envelope.conversationId;
|
|
56
72
|
const issuedAt = envelope.issuedAt;
|
|
57
73
|
const onBehalfOf = envelope.onBehalfOf;
|
|
74
|
+
const approvalAnswer = envelope.approvalAnswer;
|
|
75
|
+
// The default verifier trusts on first use and checks nothing, so an approval answer needs a real one,
|
|
76
|
+
// whether the TOFU verifier is defaulted or passed in.
|
|
77
|
+
if (approvalAnswer !== undefined && (options.verifier === undefined || options.verifier === verifier_1.tofuVerifier)) {
|
|
78
|
+
(0, observability_1.emitNervesEvent)({
|
|
79
|
+
component: "friends",
|
|
80
|
+
event: "friends.message_refused",
|
|
81
|
+
message: "refused an approval answer received without a signature verifier",
|
|
82
|
+
meta: { fromAgentId: input.fromAgentId, trustOfSource: input.trustOfSource, authenticated: false },
|
|
83
|
+
});
|
|
84
|
+
return { ok: false, status: "untrusted_source" };
|
|
85
|
+
}
|
|
58
86
|
if (envelope.fromAgentId !== input.fromAgentId
|
|
59
87
|
|| typeof text !== "string" || text.trim() === "" || text.length > exports.MAX_MESSAGE_TEXT_CHARS
|
|
60
88
|
|| typeof issuedAt !== "string" || Number.isNaN(Date.parse(issuedAt))
|
|
61
89
|
|| (conversationId !== undefined && !validConversationId(conversationId))
|
|
62
|
-
|| (onBehalfOf !== undefined && onBehalfOf !== "principal")
|
|
90
|
+
|| (onBehalfOf !== undefined && onBehalfOf !== "principal")
|
|
91
|
+
|| (approvalAnswer !== undefined && (!isApprovalAnswer(approvalAnswer) || onBehalfOf !== undefined))) {
|
|
63
92
|
return { ok: false, status: "malformed_message" };
|
|
64
93
|
}
|
|
65
94
|
const verifier = options.verifier ?? verifier_1.DEFAULT_AGENT_VERIFIER;
|
|
@@ -90,6 +119,7 @@ function receiveMessage(input, options = {}) {
|
|
|
90
119
|
text,
|
|
91
120
|
...(conversationId !== undefined ? { conversationId: conversationId } : {}),
|
|
92
121
|
...(onBehalfOf !== undefined ? { onBehalfOf } : {}),
|
|
122
|
+
...(approvalAnswer !== undefined ? { approvalAnswer: { relayToken: approvalAnswer.relayToken, decision: approvalAnswer.decision } } : {}),
|
|
93
123
|
issuedAt,
|
|
94
124
|
},
|
|
95
125
|
};
|
|
@@ -51,6 +51,13 @@ export type ImportMissionResultResult = {
|
|
|
51
51
|
ok: true;
|
|
52
52
|
status: "imported";
|
|
53
53
|
record: MissionRecord;
|
|
54
|
+
}
|
|
55
|
+
/** A result for this request from this agent was already imported: the first one is kept, nothing is written. */
|
|
56
|
+
| {
|
|
57
|
+
ok: true;
|
|
58
|
+
status: "noop";
|
|
59
|
+
record: MissionRecord;
|
|
60
|
+
message: string;
|
|
54
61
|
} | {
|
|
55
62
|
ok: false;
|
|
56
63
|
status: "no_mission" | "no_delegation" | "assignee_mismatch" | "untrusted_source";
|