@ours.network/fleet 2.4.4 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -32
- package/dist/agent-ours/mcp-endpoint.d.ts +3 -0
- package/dist/agent-ours/mcp-endpoint.js +3 -0
- package/dist/agent-ours/service.d.ts +3 -0
- package/dist/agent-ours/service.js +19 -2
- package/dist/application/conversation-history.js +2 -2
- package/dist/application/fleet-query-service.js +4 -1
- package/dist/application/role-creation-service.js +0 -3
- package/dist/application/session-control.d.ts +3 -0
- package/dist/application/session-control.js +5 -0
- package/dist/application/types.d.ts +5 -0
- package/dist/build-info.json +4 -4
- package/dist/cli.js +2 -3
- package/dist/config.d.ts +9 -2
- package/dist/config.js +15 -4
- package/dist/docs.d.ts +5 -7
- package/dist/docs.js +38 -46
- package/dist/doctor.js +4 -6
- package/dist/file-delivery/store.d.ts +12 -0
- package/dist/file-delivery/store.js +24 -2
- package/dist/fleet-command-audit.js +3 -2
- package/dist/fleet-proxy.js +0 -1
- package/dist/harness/hermes-permissions.js +1 -1
- package/dist/harness/hermes-session.js +0 -1
- package/dist/init-wizard.js +2 -2
- package/dist/lifecycle-summary.d.ts +3 -2
- package/dist/lifecycle-summary.js +2 -3
- package/dist/notifications/status-producer.d.ts +37 -0
- package/dist/notifications/status-producer.js +146 -0
- package/dist/permissions.d.ts +2 -3
- package/dist/permissions.js +3 -3
- package/dist/preset-migration.js +12 -0
- package/dist/rooms-tasks/cli.js +2 -6
- package/dist/rooms-tasks/deletion.js +3 -0
- package/dist/rooms-tasks/member-overrides.d.ts +2 -1
- package/dist/rooms-tasks/member-overrides.js +1 -4
- package/dist/rooms-tasks/task-contributions.d.ts +15 -0
- package/dist/rooms-tasks/task-contributions.js +13 -2
- package/dist/runner.js +24 -8
- package/dist/session/acp.d.ts +9 -29
- package/dist/session/acp.js +31 -308
- package/dist/session/codex-app-server.d.ts +9 -6
- package/dist/session/codex-app-server.js +19 -58
- package/dist/session/control.d.ts +5 -0
- package/dist/session/control.js +19 -3
- package/dist/session/conversation-types.d.ts +3 -2
- package/dist/session/status-notice.d.ts +24 -0
- package/dist/session/status-notice.js +38 -0
- package/dist/session/types.d.ts +2 -0
- package/dist/spawn.d.ts +1 -2
- package/dist/spawn.js +2 -6
- package/dist/statuses/permission-projection.d.ts +53 -0
- package/dist/statuses/permission-projection.js +317 -0
- package/dist/statuses/status-answers.d.ts +31 -0
- package/dist/statuses/status-answers.js +85 -0
- package/dist/statuses/status-feed.d.ts +85 -0
- package/dist/statuses/status-feed.js +122 -0
- package/dist/statuses/status-kinds.d.ts +15 -0
- package/dist/statuses/status-kinds.js +12 -0
- package/dist/statuses/status-ledger.d.ts +21 -0
- package/dist/statuses/status-ledger.js +80 -0
- package/dist/statuses/status-routes.d.ts +43 -0
- package/dist/statuses/status-routes.js +140 -0
- package/dist/statuses/status-store.d.ts +257 -0
- package/dist/statuses/status-store.js +605 -0
- package/dist/statuses/status-tools.d.ts +21 -0
- package/dist/statuses/status-tools.js +126 -0
- package/dist/supervisor/manager.js +11 -0
- package/dist/web/resource-views.d.ts +3 -1
- package/dist/web/resource-views.js +6 -2
- package/dist/web/server.js +15 -0
- package/docs/acp-files.md +9 -7
- package/docs/validation/managed-cli-permissions.md +1 -1
- package/examples/fleet/agents/Alice.yaml +1 -1
- package/examples/fleet/agents/FleetCoordinator.yaml +1 -1
- package/examples/fleet.yaml +0 -1
- package/package.json +3 -3
- package/presets/fleet/agent_templates/Critic.yaml +1 -1
- package/presets/fleet/agent_templates/Developer.yaml +1 -1
- package/presets/fleet/agent_templates/Engineer.yaml +1 -1
- package/presets/fleet/agent_templates/LocalCoordinator.yaml +1 -1
- package/presets/fleet/agents/FleetCoordinator.yaml +1 -1
- package/presets/fleet.yaml +1 -1
- package/presets/manifest.json +1 -1
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical store of Fleet agents' native statuses (update, question, alert).
|
|
3
|
+
*
|
|
4
|
+
* One file per status under `statuses/<authorCid>/<statusId>.json`, each replaced atomically under the author's
|
|
5
|
+
* lock, so an author's mutations (including a supersede that closes an older question) are serialized across the
|
|
6
|
+
* manager and supervisor processes. The author and mission are never taken from the request: callers pass the
|
|
7
|
+
* authenticated binding. Retention: statuses are kept until the author's data or the mission is deleted; there is
|
|
8
|
+
* no automatic pruning or expiry.
|
|
9
|
+
*/
|
|
10
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
11
|
+
import { existsSync, readdirSync, readFileSync, rmSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { replaceFileAtomically, withSynchronousFileLock } from '../atomic-file.js';
|
|
14
|
+
import { canonicalJson } from '../canonical-json.js';
|
|
15
|
+
import { stateRoot } from '../paths.js';
|
|
16
|
+
import { PUBLISHABLE_STATUS_KINDS, statusKind } from './status-kinds.js';
|
|
17
|
+
export const STATUS_TITLE_MAX = 120;
|
|
18
|
+
export const STATUS_BODY_MAX_BYTES = 64 * 1024;
|
|
19
|
+
export const STATUS_ATTACHMENTS_MAX = 10;
|
|
20
|
+
export const STATUS_OPTIONS_MIN = 2;
|
|
21
|
+
export const STATUS_OPTIONS_MAX = 12;
|
|
22
|
+
export const STATUS_CLOSE_REASON_MAX = 500;
|
|
23
|
+
export class StatusError extends Error {
|
|
24
|
+
code;
|
|
25
|
+
constructor(code, message) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.code = code;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export const STATUS_ANSWER_TEXT_MAX = 8_000;
|
|
31
|
+
/** The existing session admission refuses prompts over 32 KiB (RoleSessionControlAdapter.submitPromptV2). */
|
|
32
|
+
export const ANSWER_PROMPT_MAX_BYTES = 32 * 1024;
|
|
33
|
+
const SUBMISSION_ID = /^[A-Za-z0-9_-]{8,128}$/;
|
|
34
|
+
export class AlreadyAnsweredError extends StatusError {
|
|
35
|
+
status;
|
|
36
|
+
constructor(status) {
|
|
37
|
+
super('conflict', 'already_answered: this question already has an accepted answer');
|
|
38
|
+
this.status = status;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const sendEvent = (status) => ({ op: 'send', eventId: `status:${status.status_id}:${status.revision}`, delivery: status.kind === 'question' ? 'until-resolved' : 'inbox' });
|
|
42
|
+
/** Ending an unanswered open question resolves its pending notification. */
|
|
43
|
+
const resolveEvents = (status) => status.kind === 'question' && status.state === 'active' && !status.answer ? [{ op: 'resolve', eventId: `status:${status.status_id}:${status.revision}` }] : [];
|
|
44
|
+
const withEvents = (status, events) => events.length ? { ...status, notification_events: [...(status.notification_events ?? []), ...events] } : status;
|
|
45
|
+
const CID = /^[A-F0-9]{64}$/;
|
|
46
|
+
const STATUS_ID = /^st_[a-z0-9]{8,64}$/;
|
|
47
|
+
/** A harness permission request: `permission:<authorCid>:<sessionGeneration>:<permissionId>`, the native identity. */
|
|
48
|
+
export const PERMISSION_STATUS_ID = /^permission:([A-F0-9]{64}):([A-Za-z0-9-]{1,64}):([A-Za-z0-9_.-]{1,256})$/;
|
|
49
|
+
const PERMISSION_FILE = /^pm_[a-f0-9]{40}$/;
|
|
50
|
+
const knownStatusId = (id) => typeof id === 'string' && (STATUS_ID.test(id) || PERMISSION_STATUS_ID.test(id));
|
|
51
|
+
const REQUEST_KEY = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
52
|
+
const OPTION_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
53
|
+
const TASK_ID = /^[A-Za-z0-9_-]{1,120}$/;
|
|
54
|
+
const PUBLISH_FIELDS = ['kind', 'title', 'body', 'attachments', 'interaction', 'supersedes', 'request_key'];
|
|
55
|
+
export const statusesDir = () => join(stateRoot(), 'statuses');
|
|
56
|
+
const authorDir = (cid) => join(statusesDir(), cid);
|
|
57
|
+
/** A permission identity holds ':' and may be long; its file name is a digest of it. */
|
|
58
|
+
const statusFile = (id) => PERMISSION_STATUS_ID.test(id) ? `pm_${createHash('sha256').update(id).digest('hex').slice(0, 40)}` : id;
|
|
59
|
+
const statusPath = (cid, id) => join(authorDir(cid), `${statusFile(id)}.json`);
|
|
60
|
+
const authorLock = (cid) => join(statusesDir(), '.locks', cid);
|
|
61
|
+
const codePoints = (value) => [...value].length;
|
|
62
|
+
const invalid = (message) => { throw new StatusError('invalid_request', message); };
|
|
63
|
+
const plain = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
64
|
+
function closedObject(value, allowed, what) {
|
|
65
|
+
if (!plain(value))
|
|
66
|
+
invalid(`${what} must be an object`);
|
|
67
|
+
const extra = Object.keys(value).filter(key => !allowed.includes(key));
|
|
68
|
+
if (extra.length)
|
|
69
|
+
invalid(`${what} has unsupported field ${extra[0]}`);
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
function line(value, what, max) {
|
|
73
|
+
if (typeof value !== 'string' || !value.trim())
|
|
74
|
+
invalid(`${what} must be non-empty text`);
|
|
75
|
+
const text = value;
|
|
76
|
+
if (/[\x00-\x1f\x7f]/.test(text))
|
|
77
|
+
invalid(`${what} must be one line without control characters`);
|
|
78
|
+
if (codePoints(text) > max)
|
|
79
|
+
throw new StatusError('limit_exceeded', `${what} exceeds the ${max}-character limit`);
|
|
80
|
+
return text;
|
|
81
|
+
}
|
|
82
|
+
export function canonicalCid(value) {
|
|
83
|
+
const cid = value.toUpperCase();
|
|
84
|
+
if (!CID.test(cid))
|
|
85
|
+
throw new StatusError('forbidden', 'a status author needs a verified identity CID');
|
|
86
|
+
return cid;
|
|
87
|
+
}
|
|
88
|
+
function validInteraction(value) {
|
|
89
|
+
const item = closedObject(value, ['mode', 'options', 'allowOther', 'placeholder'], 'interaction');
|
|
90
|
+
if (item.mode !== 'text' && item.mode !== 'single' && item.mode !== 'multi')
|
|
91
|
+
invalid('interaction.mode must be text, single or multi');
|
|
92
|
+
const result = { mode: item.mode };
|
|
93
|
+
if (item.placeholder !== undefined)
|
|
94
|
+
result.placeholder = line(item.placeholder, 'interaction.placeholder', 200);
|
|
95
|
+
if (item.mode === 'text') {
|
|
96
|
+
if (item.options !== undefined || item.allowOther !== undefined)
|
|
97
|
+
invalid('a text question has no options');
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
if (!Array.isArray(item.options) || item.options.length < STATUS_OPTIONS_MIN || item.options.length > STATUS_OPTIONS_MAX)
|
|
101
|
+
invalid(`a choice question needs ${STATUS_OPTIONS_MIN}-${STATUS_OPTIONS_MAX} options`);
|
|
102
|
+
const ids = new Set();
|
|
103
|
+
result.options = item.options.map((raw, index) => {
|
|
104
|
+
const option = closedObject(raw, ['id', 'label', 'description', 'recommended'], `interaction.options[${index}]`);
|
|
105
|
+
if (typeof option.id !== 'string' || !OPTION_ID.test(option.id))
|
|
106
|
+
invalid('option id must be 1-64 letters, digits, "_" or "-"');
|
|
107
|
+
if (ids.has(option.id))
|
|
108
|
+
invalid(`option id ${option.id} is not unique`);
|
|
109
|
+
ids.add(option.id);
|
|
110
|
+
if (option.recommended !== undefined && typeof option.recommended !== 'boolean')
|
|
111
|
+
invalid('option recommended must be a boolean');
|
|
112
|
+
return { id: option.id, label: line(option.label, 'option label', 200),
|
|
113
|
+
...(option.description === undefined ? {} : { description: line(option.description, 'option description', 500) }),
|
|
114
|
+
...(option.recommended === undefined ? {} : { recommended: option.recommended }) };
|
|
115
|
+
});
|
|
116
|
+
if (item.allowOther !== undefined) {
|
|
117
|
+
if (typeof item.allowOther !== 'boolean')
|
|
118
|
+
invalid('interaction.allowOther must be a boolean');
|
|
119
|
+
result.allowOther = item.allowOther;
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
function validAttachments(value) {
|
|
124
|
+
if (value === undefined)
|
|
125
|
+
return [];
|
|
126
|
+
if (!Array.isArray(value))
|
|
127
|
+
return invalid('attachments must be a list');
|
|
128
|
+
if (value.length > STATUS_ATTACHMENTS_MAX)
|
|
129
|
+
throw new StatusError('limit_exceeded', `a status can have at most ${STATUS_ATTACHMENTS_MAX} attachments`);
|
|
130
|
+
return value.map((raw, index) => {
|
|
131
|
+
const item = closedObject(raw, ['id', 'name', 'media_type', 'size', 'sha256'], `attachments[${index}]`);
|
|
132
|
+
if (typeof item.id !== 'string' || !/^[a-f0-9-]{36}$/.test(item.id))
|
|
133
|
+
invalid('attachment id must be a delivered file ID');
|
|
134
|
+
const name = line(item.name, 'attachment name', 240);
|
|
135
|
+
if (/[\\/]/.test(name) || name === '.' || name === '..')
|
|
136
|
+
invalid('attachment name must not contain slashes');
|
|
137
|
+
const mediaType = line(item.media_type, 'attachment media_type', 255);
|
|
138
|
+
if (!Number.isSafeInteger(item.size) || item.size < 0)
|
|
139
|
+
invalid('attachment size must be a non-negative integer');
|
|
140
|
+
if (typeof item.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(item.sha256))
|
|
141
|
+
invalid('attachment sha256 must be 64 lowercase hex characters');
|
|
142
|
+
return { id: item.id, name, media_type: mediaType, size: item.size, sha256: item.sha256 };
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** Validates a publish request in full before anything is stored. Author and mission are refused as inputs. */
|
|
146
|
+
export function validatePublish(raw) {
|
|
147
|
+
if (!plain(raw))
|
|
148
|
+
return invalid('publish input must be an object');
|
|
149
|
+
for (const key of ['author', 'author_cid', 'authorCid', 'task_id', 'taskId', 'mission', 'source'])
|
|
150
|
+
if (key in raw)
|
|
151
|
+
invalid(`${key} cannot be set: the author and mission come from the agent's authenticated binding`);
|
|
152
|
+
const input = closedObject(raw, PUBLISH_FIELDS, 'publish input');
|
|
153
|
+
if (typeof input.kind !== 'string' || !statusKind(input.kind) || !statusKind(input.kind).publishable)
|
|
154
|
+
invalid(`kind must be one of ${PUBLISHABLE_STATUS_KINDS.join(', ')}`);
|
|
155
|
+
const kind = input.kind;
|
|
156
|
+
const title = line(input.title, 'title', STATUS_TITLE_MAX);
|
|
157
|
+
if (typeof input.body !== 'string')
|
|
158
|
+
invalid('body must be Markdown text');
|
|
159
|
+
if (Buffer.byteLength(input.body, 'utf8') > STATUS_BODY_MAX_BYTES)
|
|
160
|
+
throw new StatusError('limit_exceeded', `body exceeds the 64 KiB Markdown limit`);
|
|
161
|
+
const attachments = validAttachments(input.attachments);
|
|
162
|
+
const answerable = statusKind(kind).answerable;
|
|
163
|
+
if (answerable && input.interaction === undefined)
|
|
164
|
+
invalid(`a ${kind} needs an interaction`);
|
|
165
|
+
if (!answerable && input.interaction !== undefined)
|
|
166
|
+
invalid(`a ${kind} cannot have an interaction`);
|
|
167
|
+
if (input.supersedes !== undefined && (kind !== 'question' || typeof input.supersedes !== 'string' || !STATUS_ID.test(input.supersedes)))
|
|
168
|
+
invalid('only a question can supersede, and supersedes must be a status ID');
|
|
169
|
+
if (input.request_key !== undefined && (typeof input.request_key !== 'string' || !REQUEST_KEY.test(input.request_key)))
|
|
170
|
+
invalid('request_key must be 1-128 letters, digits, ".", "_", ":" or "-"');
|
|
171
|
+
return { kind, title, body: input.body, attachments,
|
|
172
|
+
...(input.interaction === undefined ? {} : { interaction: validInteraction(input.interaction) }),
|
|
173
|
+
...(input.supersedes === undefined ? {} : { supersedes: input.supersedes }),
|
|
174
|
+
...(input.request_key === undefined ? {} : { request_key: input.request_key }) };
|
|
175
|
+
}
|
|
176
|
+
function validBinding(binding) {
|
|
177
|
+
const identityCid = canonicalCid(binding.identityCid ?? '');
|
|
178
|
+
if (typeof binding.role !== 'string' || !binding.role)
|
|
179
|
+
throw new StatusError('forbidden', 'a status author needs a role');
|
|
180
|
+
if (binding.taskId !== undefined && !TASK_ID.test(binding.taskId))
|
|
181
|
+
throw new StatusError('invalid_request', 'invalid task binding');
|
|
182
|
+
return { ...binding, identityCid };
|
|
183
|
+
}
|
|
184
|
+
function readStatus(path) {
|
|
185
|
+
const record = JSON.parse(readFileSync(path, 'utf8'));
|
|
186
|
+
if (record?.version !== 1 || typeof record.status_id !== 'string')
|
|
187
|
+
throw new Error(`unsupported status record ${path}`);
|
|
188
|
+
return record;
|
|
189
|
+
}
|
|
190
|
+
function writeStatus(record) {
|
|
191
|
+
replaceFileAtomically(statusPath(record.author.identity_cid, record.status_id), JSON.stringify(record, null, 2) + '\n', 0o600, {}, { durable: true });
|
|
192
|
+
}
|
|
193
|
+
/** The author's status files: published statuses and permission requests. */
|
|
194
|
+
function authorStatusFiles(cid) {
|
|
195
|
+
try {
|
|
196
|
+
return readdirSync(authorDir(cid)).filter(name => name.endsWith('.json') && (STATUS_ID.test(name.slice(0, -5)) || PERMISSION_FILE.test(name.slice(0, -5))))
|
|
197
|
+
.map(name => join(authorDir(cid), name));
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
if (error.code === 'ENOENT')
|
|
201
|
+
return [];
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function authors() {
|
|
206
|
+
try {
|
|
207
|
+
return readdirSync(statusesDir()).filter(name => CID.test(name));
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
if (error.code === 'ENOENT')
|
|
211
|
+
return [];
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function newStatusId(cid, requestKey) {
|
|
216
|
+
// A request key maps to one ID per author, so a retried publish finds its first result.
|
|
217
|
+
if (requestKey)
|
|
218
|
+
return `st_k${createHash('sha256').update(`${cid}\0${requestKey}`).digest('hex').slice(0, 32)}`;
|
|
219
|
+
return `st_${Date.now().toString(36)}${randomBytes(10).toString('hex')}`;
|
|
220
|
+
}
|
|
221
|
+
const content = (record) => canonicalJson([record.kind, record.title, record.body, record.attachments, record.interaction ?? null, record.supersedes ?? null, record.task_id ?? null]);
|
|
222
|
+
/** Publish a native status for the authenticated author; a question may supersede (close) the author's older question. */
|
|
223
|
+
export function publishStatus(bindingInput, raw, now = new Date()) {
|
|
224
|
+
const input = validatePublish(raw);
|
|
225
|
+
const binding = validBinding(bindingInput);
|
|
226
|
+
const cid = binding.identityCid;
|
|
227
|
+
return withSynchronousFileLock(authorLock(cid), () => {
|
|
228
|
+
const id = newStatusId(cid, input.request_key);
|
|
229
|
+
const at = now.toISOString();
|
|
230
|
+
const record = {
|
|
231
|
+
version: 1, status_id: id, source: 'fleet', kind: input.kind,
|
|
232
|
+
author: { identity_cid: cid, role: binding.role, ...(binding.displayName ? { display_name: binding.displayName } : {}) },
|
|
233
|
+
...(binding.taskId ? { task_id: binding.taskId } : {}),
|
|
234
|
+
revision: 1, title: input.title, body: input.body, attachments: input.attachments,
|
|
235
|
+
...(input.interaction ? { interaction: input.interaction } : {}),
|
|
236
|
+
state: 'active',
|
|
237
|
+
...(input.supersedes ? { supersedes: input.supersedes } : {}),
|
|
238
|
+
...(input.request_key ? { request_key: input.request_key } : {}),
|
|
239
|
+
created_at: at, updated_at: at,
|
|
240
|
+
};
|
|
241
|
+
const stores = Object.fromEntries(input.attachments.flatMap(a => binding.attachmentStores?.[a.id] ? [[a.id, binding.attachmentStores[a.id]]] : []));
|
|
242
|
+
if (Object.keys(stores).length)
|
|
243
|
+
record.attachment_stores = stores;
|
|
244
|
+
record.notification_events = [sendEvent(record)];
|
|
245
|
+
/** The still-open question this publication closes, or none when it was already closed. */
|
|
246
|
+
const supersede = (replacement) => {
|
|
247
|
+
if (!input.supersedes)
|
|
248
|
+
return undefined;
|
|
249
|
+
const path = statusPath(cid, input.supersedes);
|
|
250
|
+
if (!existsSync(path)) {
|
|
251
|
+
if (findStatus(input.supersedes))
|
|
252
|
+
throw new StatusError('forbidden', 'an agent can supersede only its own question');
|
|
253
|
+
throw new StatusError('not_found', `status ${input.supersedes} not found`);
|
|
254
|
+
}
|
|
255
|
+
const old = readStatus(path);
|
|
256
|
+
if (old.kind !== 'question')
|
|
257
|
+
throw new StatusError('conflict', 'only a question can be superseded');
|
|
258
|
+
// An answered question keeps its answer; only a still-open question is closed by its replacement.
|
|
259
|
+
return old.state === 'active' && !old.answer
|
|
260
|
+
? withEvents({ ...old, state: 'closed', closed: { reason: 'superseded', at, superseded_by: replacement }, updated_at: at }, resolveEvents(old)) : undefined;
|
|
261
|
+
};
|
|
262
|
+
if (existsSync(statusPath(cid, id))) {
|
|
263
|
+
const existing = readStatus(statusPath(cid, id));
|
|
264
|
+
if (content(existing) !== content(record))
|
|
265
|
+
throw new StatusError('idempotency_conflict', 'request_key was already used for a different status');
|
|
266
|
+
// A crash between the two writes left the older question open: the retried publish completes the supersede,
|
|
267
|
+
// once. Later replays find it closed and report no new close.
|
|
268
|
+
const completed = supersede(existing.status_id);
|
|
269
|
+
if (completed)
|
|
270
|
+
writeStatus(completed);
|
|
271
|
+
return { status: existing, replayed: true, ...(completed ? { superseded: completed } : {}) };
|
|
272
|
+
}
|
|
273
|
+
const superseded = supersede(id);
|
|
274
|
+
// The new question is stored first: a crash between the two writes leaves both open, never a closed question
|
|
275
|
+
// whose replacement does not exist. A retried publish (same request_key) then completes the supersede.
|
|
276
|
+
writeStatus(record);
|
|
277
|
+
if (superseded)
|
|
278
|
+
writeStatus(superseded);
|
|
279
|
+
return { status: record, replayed: false, ...(superseded ? { superseded } : {}) };
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
/** Close the author's own status with a reason. Closing another agent's status is refused and changes nothing. */
|
|
283
|
+
export function closeStatus(bindingInput, statusId, reasonInput, now = new Date()) {
|
|
284
|
+
const binding = validBinding(bindingInput);
|
|
285
|
+
const reason = line(reasonInput, 'reason', STATUS_CLOSE_REASON_MAX);
|
|
286
|
+
if (typeof statusId !== 'string' || !STATUS_ID.test(statusId))
|
|
287
|
+
invalid('status_id must be a status ID');
|
|
288
|
+
const cid = binding.identityCid;
|
|
289
|
+
return withSynchronousFileLock(authorLock(cid), () => {
|
|
290
|
+
const path = statusPath(cid, statusId);
|
|
291
|
+
if (!existsSync(path)) {
|
|
292
|
+
if (findStatus(statusId))
|
|
293
|
+
throw new StatusError('forbidden', 'an agent can close only its own status');
|
|
294
|
+
throw new StatusError('not_found', `status ${statusId} not found`);
|
|
295
|
+
}
|
|
296
|
+
const current = readStatus(path);
|
|
297
|
+
if (current.state === 'closed')
|
|
298
|
+
return { status: current, changed: false };
|
|
299
|
+
if (current.answer)
|
|
300
|
+
throw new StatusError('conflict', 'this question was already answered and cannot be closed');
|
|
301
|
+
const at = now.toISOString();
|
|
302
|
+
const closed = withEvents({ ...current, state: 'closed', closed: { reason, at }, updated_at: at }, resolveEvents(current));
|
|
303
|
+
writeStatus(closed);
|
|
304
|
+
return { status: closed, changed: true };
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/** The fixed prompt the originating agent receives. */
|
|
308
|
+
export function answerPrompt(status, answer) {
|
|
309
|
+
const labels = (answer.selection ?? []).map(id => status.interaction?.options?.find(option => option.id === id)?.label ?? id);
|
|
310
|
+
const parts = [...labels, ...(answer.text === undefined ? [] : [labels.length ? `Other: ${answer.text}` : answer.text])];
|
|
311
|
+
return `Owner answered your question ${status.status_id} "${status.title}": ${parts.join('; ')}`;
|
|
312
|
+
}
|
|
313
|
+
/** The command ID that delivers one answer; a repeated delivery is deduplicated by the session's admission receipt. */
|
|
314
|
+
export function answerCommandId(statusId, submissionId) {
|
|
315
|
+
return `status-answer-${createHash('sha256').update(`${statusId}\0${submissionId}`).digest('hex').slice(0, 40)}`;
|
|
316
|
+
}
|
|
317
|
+
function validAnswer(status, input) {
|
|
318
|
+
const interaction = status.interaction;
|
|
319
|
+
const text = input.text === undefined ? undefined : (() => {
|
|
320
|
+
if (typeof input.text !== 'string' || !input.text.trim())
|
|
321
|
+
invalid('answer text must be non-empty');
|
|
322
|
+
if (codePoints(input.text) > STATUS_ANSWER_TEXT_MAX)
|
|
323
|
+
throw new StatusError('limit_exceeded', `answer text exceeds ${STATUS_ANSWER_TEXT_MAX} characters`);
|
|
324
|
+
return input.text;
|
|
325
|
+
})();
|
|
326
|
+
if (interaction.mode === 'text') {
|
|
327
|
+
if (input.selection !== undefined)
|
|
328
|
+
invalid('a text question takes text, not a selection');
|
|
329
|
+
if (text === undefined)
|
|
330
|
+
invalid('answer text is required');
|
|
331
|
+
return { text };
|
|
332
|
+
}
|
|
333
|
+
const selection = input.selection ?? [];
|
|
334
|
+
if (!Array.isArray(selection) || selection.some(id => typeof id !== 'string'))
|
|
335
|
+
return invalid('selection must be a list of option IDs');
|
|
336
|
+
const offered = new Set(interaction.options.map(option => option.id));
|
|
337
|
+
if (new Set(selection).size !== selection.length || selection.some(id => !offered.has(id)))
|
|
338
|
+
invalid('selection must name distinct offered options');
|
|
339
|
+
if (text !== undefined && !interaction.allowOther)
|
|
340
|
+
invalid('this question does not accept another answer');
|
|
341
|
+
const chosen = selection.length + (text === undefined ? 0 : 1);
|
|
342
|
+
if (interaction.mode === 'single' ? chosen !== 1 : chosen < 1)
|
|
343
|
+
invalid(interaction.mode === 'single' ? 'choose exactly one option' : 'choose at least one option');
|
|
344
|
+
return { ...(selection.length ? { selection } : {}), ...(text === undefined ? {} : { text }) };
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Accept the Owner's answer: the first accepted answer wins. The answer and `delivery=pending` are committed in one
|
|
348
|
+
* atomic write, so the question is Answered on every surface from then on. The same submission replayed returns the
|
|
349
|
+
* stored answer; a different answer after acceptance fails with the accepted one.
|
|
350
|
+
*/
|
|
351
|
+
export function recordAnswer(statusId, input, now = new Date()) {
|
|
352
|
+
if (typeof input?.submissionId !== 'string' || !SUBMISSION_ID.test(input.submissionId))
|
|
353
|
+
invalid('submissionId must be 8-128 letters, digits, "_" or "-"');
|
|
354
|
+
if (!Number.isSafeInteger(input.expectedRevision))
|
|
355
|
+
invalid('expectedRevision is required');
|
|
356
|
+
const found = findStatus(statusId);
|
|
357
|
+
if (!found)
|
|
358
|
+
throw new StatusError('not_found', `status ${statusId} not found`);
|
|
359
|
+
const cid = found.author.identity_cid;
|
|
360
|
+
return withSynchronousFileLock(authorLock(cid), () => {
|
|
361
|
+
const path = statusPath(cid, statusId);
|
|
362
|
+
if (!existsSync(path))
|
|
363
|
+
throw new StatusError('not_found', `status ${statusId} not found`);
|
|
364
|
+
const current = readStatus(path);
|
|
365
|
+
if (current.kind !== 'question' || !current.interaction)
|
|
366
|
+
throw new StatusError('invalid_request', 'only a question can be answered');
|
|
367
|
+
if (current.answer) {
|
|
368
|
+
if (current.answer.submission_id === input.submissionId)
|
|
369
|
+
return { status: current, replayed: true };
|
|
370
|
+
throw new AlreadyAnsweredError(current);
|
|
371
|
+
}
|
|
372
|
+
if (current.state === 'closed')
|
|
373
|
+
throw new StatusError('conflict', `closed: the question was closed (${current.closed?.reason ?? 'no reason'}) and can no longer be answered`);
|
|
374
|
+
if (current.revision !== input.expectedRevision)
|
|
375
|
+
throw new StatusError('conflict', 'stale_revision: the question changed; reload it');
|
|
376
|
+
const at = now.toISOString();
|
|
377
|
+
const chosen = validAnswer(current, input);
|
|
378
|
+
// An answer is accepted only if it can be delivered: refused while the question stays open, never truncated.
|
|
379
|
+
const bytes = Buffer.byteLength(answerPrompt(current, chosen), 'utf8');
|
|
380
|
+
if (bytes > ANSWER_PROMPT_MAX_BYTES)
|
|
381
|
+
throw new StatusError('limit_exceeded', `answer_too_long: this answer is ${bytes} bytes as delivered to the agent; the limit is ${ANSWER_PROMPT_MAX_BYTES}. Shorten the text and send it again.`);
|
|
382
|
+
const answered = { ...withEvents(current, resolveEvents(current)), updated_at: at, answer: {
|
|
383
|
+
submission_id: input.submissionId, ...chosen, answered_at: at, surface: input.surface ?? 'feed',
|
|
384
|
+
delivery: { state: 'pending', command_id: answerCommandId(statusId, input.submissionId), at },
|
|
385
|
+
} };
|
|
386
|
+
writeStatus(answered);
|
|
387
|
+
return { status: answered, replayed: false };
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
/** Record the outcome of one delivery attempt of the accepted answer. */
|
|
391
|
+
export function setAnswerDelivery(statusId, submissionId, delivery) {
|
|
392
|
+
const found = findStatus(statusId);
|
|
393
|
+
if (!found)
|
|
394
|
+
throw new StatusError('not_found', `status ${statusId} not found`);
|
|
395
|
+
const cid = found.author.identity_cid;
|
|
396
|
+
return withSynchronousFileLock(authorLock(cid), () => {
|
|
397
|
+
const current = readStatus(statusPath(cid, statusId));
|
|
398
|
+
if (current.answer?.submission_id !== submissionId)
|
|
399
|
+
throw new StatusError('conflict', 'the answer changed');
|
|
400
|
+
// Delivered is terminal: a stale outcome of an overlapping attempt never replaces the recorded receipt.
|
|
401
|
+
if (current.answer.delivery.state === 'delivered')
|
|
402
|
+
return current;
|
|
403
|
+
// A delivery outcome is a visible change on every surface.
|
|
404
|
+
const updated = { ...current, answer: { ...current.answer, delivery },
|
|
405
|
+
updated_at: delivery.at > current.updated_at ? delivery.at : new Date(Math.max(Date.now(), Date.parse(current.updated_at) + 1)).toISOString() };
|
|
406
|
+
writeStatus(updated);
|
|
407
|
+
return updated;
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Seen state (Owner requirement 12): an informational status is seen once its current revision was displayed. An
|
|
412
|
+
* open question is seen only when the Owner has answered it; displaying it never counts. A question that ended
|
|
413
|
+
* without the Owner's answer (closed or superseded) is informational from then on.
|
|
414
|
+
*/
|
|
415
|
+
export function statusSeen(status) {
|
|
416
|
+
if (status.kind === 'question' && status.state === 'active')
|
|
417
|
+
return !!status.answer;
|
|
418
|
+
// A permission is pending until the harness resolves it; the Owner's own decision is seeing it.
|
|
419
|
+
if (status.kind === 'permission' && status.state === 'active')
|
|
420
|
+
return false;
|
|
421
|
+
if (status.kind === 'permission' && status.permission?.resolution?.decision_source === 'manual')
|
|
422
|
+
return true;
|
|
423
|
+
if (status.kind === 'question' && status.answer)
|
|
424
|
+
return true;
|
|
425
|
+
return (status.seen_revision ?? 0) >= status.revision;
|
|
426
|
+
}
|
|
427
|
+
/** Waiting for the Owner: an open, unanswered question or a pending permission request. */
|
|
428
|
+
export const statusAwaitsOwner = (status) => (status.kind === 'question' && status.state === 'active' && !status.answer) || (status.kind === 'permission' && status.state === 'active');
|
|
429
|
+
/**
|
|
430
|
+
* Record that the Owner displayed `revision` of a status. An open question is not marked (it stays unseen until
|
|
431
|
+
* answered); a stale or future revision changes nothing. Returns the resulting seen state.
|
|
432
|
+
*/
|
|
433
|
+
export function markStatusSeen(statusId, revision) {
|
|
434
|
+
if (!Number.isSafeInteger(revision) || revision < 1)
|
|
435
|
+
invalid('revision must be a positive integer');
|
|
436
|
+
const found = findStatus(statusId);
|
|
437
|
+
if (!found)
|
|
438
|
+
throw new StatusError('not_found', `status ${statusId} not found`);
|
|
439
|
+
const cid = found.author.identity_cid;
|
|
440
|
+
return withSynchronousFileLock(authorLock(cid), () => {
|
|
441
|
+
const current = readStatus(statusPath(cid, statusId));
|
|
442
|
+
if (statusAwaitsOwner(current) || revision !== current.revision || (current.seen_revision ?? 0) >= revision)
|
|
443
|
+
return { status: current, seen: statusSeen(current), changed: false };
|
|
444
|
+
const updated = { ...current, seen_revision: revision };
|
|
445
|
+
writeStatus(updated);
|
|
446
|
+
return { status: updated, seen: statusSeen(updated), changed: true };
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
/** Statuses with push work still pending, oldest first. */
|
|
450
|
+
export function pendingStatusNotifications() {
|
|
451
|
+
return listAllStatuses().filter(status => status.notification_events?.length);
|
|
452
|
+
}
|
|
453
|
+
/** The service accepted this event: remove it (and only it) from the status. Idempotent. */
|
|
454
|
+
export function acknowledgeStatusNotification(statusId, eventId, op) {
|
|
455
|
+
const found = findStatus(statusId);
|
|
456
|
+
if (!found)
|
|
457
|
+
return;
|
|
458
|
+
const cid = found.author.identity_cid;
|
|
459
|
+
withSynchronousFileLock(authorLock(cid), () => {
|
|
460
|
+
const path = statusPath(cid, statusId);
|
|
461
|
+
if (!existsSync(path))
|
|
462
|
+
return;
|
|
463
|
+
const current = readStatus(path);
|
|
464
|
+
const events = current.notification_events ?? [];
|
|
465
|
+
const index = events.findIndex(event => event.eventId === eventId && event.op === op);
|
|
466
|
+
if (index < 0)
|
|
467
|
+
return;
|
|
468
|
+
const rest = events.filter((_, i) => i !== index);
|
|
469
|
+
const { notification_events: _events, ...base } = current;
|
|
470
|
+
writeStatus(rest.length ? { ...base, notification_events: rest } : base);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
/** Any status by ID, from any author; `undefined` when absent. */
|
|
474
|
+
export function findStatus(statusId) {
|
|
475
|
+
if (!knownStatusId(statusId))
|
|
476
|
+
return undefined;
|
|
477
|
+
const permission = PERMISSION_STATUS_ID.exec(statusId);
|
|
478
|
+
for (const cid of permission ? [permission[1]] : authors()) {
|
|
479
|
+
const path = statusPath(cid, statusId);
|
|
480
|
+
if (existsSync(path))
|
|
481
|
+
return readStatus(path);
|
|
482
|
+
}
|
|
483
|
+
return undefined;
|
|
484
|
+
}
|
|
485
|
+
/** Every retained status of one author, oldest first. */
|
|
486
|
+
export function listAuthorStatuses(identityCid) {
|
|
487
|
+
const cid = canonicalCid(identityCid);
|
|
488
|
+
return authorStatusFiles(cid).flatMap(path => {
|
|
489
|
+
try {
|
|
490
|
+
return [readStatus(path)];
|
|
491
|
+
}
|
|
492
|
+
catch (error) {
|
|
493
|
+
if (error.code === 'ENOENT')
|
|
494
|
+
return [];
|
|
495
|
+
throw error;
|
|
496
|
+
}
|
|
497
|
+
}).sort((a, b) => a.created_at.localeCompare(b.created_at) || a.status_id.localeCompare(b.status_id));
|
|
498
|
+
}
|
|
499
|
+
/** Every retained status, oldest first. */
|
|
500
|
+
export function listAllStatuses() {
|
|
501
|
+
return authors().flatMap(listAuthorStatuses)
|
|
502
|
+
.sort((a, b) => a.created_at.localeCompare(b.created_at) || a.status_id.localeCompare(b.status_id));
|
|
503
|
+
}
|
|
504
|
+
/** Mission deletion removes only the statuses associated with that mission; the authors' other statuses stay. */
|
|
505
|
+
export function deleteTaskStatuses(taskId) {
|
|
506
|
+
let removed = 0;
|
|
507
|
+
for (const cid of authors()) {
|
|
508
|
+
withSynchronousFileLock(authorLock(cid), () => {
|
|
509
|
+
for (const path of authorStatusFiles(cid)) {
|
|
510
|
+
let record;
|
|
511
|
+
try {
|
|
512
|
+
record = readStatus(path);
|
|
513
|
+
}
|
|
514
|
+
catch (error) {
|
|
515
|
+
if (error.code === 'ENOENT')
|
|
516
|
+
continue;
|
|
517
|
+
throw error;
|
|
518
|
+
}
|
|
519
|
+
if (record.task_id === taskId) {
|
|
520
|
+
rmSync(path, { force: true });
|
|
521
|
+
removed++;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
return removed;
|
|
527
|
+
}
|
|
528
|
+
/** The Owner deleting an agent's data removes all of its statuses. */
|
|
529
|
+
export function deleteAuthorStatuses(identityCid) {
|
|
530
|
+
const cid = canonicalCid(identityCid);
|
|
531
|
+
withSynchronousFileLock(authorLock(cid), () => rmSync(authorDir(cid), { recursive: true, force: true }));
|
|
532
|
+
}
|
|
533
|
+
// ── Harness permission requests ─────────────────────────────────────────────
|
|
534
|
+
// Written only by the requesting role's runner, from its own conversation's permission records. The status mirrors the
|
|
535
|
+
// native request (identity, title, options) and its native resolution; it never decides anything itself.
|
|
536
|
+
export const permissionStatusId = (cid, generation, permissionId) => `permission:${cid}:${generation}:${permissionId}`;
|
|
537
|
+
/** A request became pending: one status and one push (until resolved). Idempotent; the first record wins. */
|
|
538
|
+
export function recordPermissionRequest(binding, input) {
|
|
539
|
+
const cid = canonicalCid(binding.identityCid);
|
|
540
|
+
const id = permissionStatusId(cid, input.sessionGeneration, input.permissionId);
|
|
541
|
+
if (!PERMISSION_STATUS_ID.test(id))
|
|
542
|
+
invalid('invalid permission identity');
|
|
543
|
+
return withSynchronousFileLock(authorLock(cid), () => {
|
|
544
|
+
const path = statusPath(cid, id);
|
|
545
|
+
if (existsSync(path))
|
|
546
|
+
return readStatus(path);
|
|
547
|
+
// The harness's own title, exactly as supplied (a Codex title can be the whole command); only push previews clip.
|
|
548
|
+
const title = input.title?.trim() ? input.title : 'Permission request';
|
|
549
|
+
const record = {
|
|
550
|
+
version: 1, status_id: id, source: 'fleet', kind: 'permission',
|
|
551
|
+
author: { identity_cid: cid, role: binding.role, ...(binding.displayName ? { display_name: binding.displayName } : {}) },
|
|
552
|
+
...(binding.taskId ? { task_id: binding.taskId } : {}),
|
|
553
|
+
revision: 1, title, body: '', attachments: [], state: 'active',
|
|
554
|
+
permission: {
|
|
555
|
+
session_generation: input.sessionGeneration, permission_id: input.permissionId,
|
|
556
|
+
...(input.toolCallId ? { tool_call_id: input.toolCallId } : {}),
|
|
557
|
+
options: input.options.map(option => ({ option_id: option.optionId, name: option.name, kind: option.kind })),
|
|
558
|
+
requested_at: input.requestedAt,
|
|
559
|
+
},
|
|
560
|
+
notification_events: [{ op: 'send', eventId: id, delivery: 'until-resolved' }],
|
|
561
|
+
created_at: input.requestedAt, updated_at: input.requestedAt,
|
|
562
|
+
};
|
|
563
|
+
writeStatus(record);
|
|
564
|
+
return record;
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
/** The harness resolved the request: the status ends with that outcome and its notification is resolved. Idempotent. */
|
|
568
|
+
/** The reason recorded when a request's session generation ended without any native resolution being found. */
|
|
569
|
+
export const SESSION_ENDED_REASON = 'the session ended while this request was pending';
|
|
570
|
+
const syntheticEnding = (status) => status.permission?.resolution?.decision_source === 'automatic'
|
|
571
|
+
&& status.permission.resolution.reason === SESSION_ENDED_REASON;
|
|
572
|
+
/**
|
|
573
|
+
* Record the request's end. The first native resolution wins; a native resolution found later also replaces a
|
|
574
|
+
* synthetic "session ended" (the history it came from was incomplete), without another push or resolve.
|
|
575
|
+
*/
|
|
576
|
+
export function recordPermissionResolution(identityCid, input) {
|
|
577
|
+
const cid = canonicalCid(identityCid);
|
|
578
|
+
const id = permissionStatusId(cid, input.sessionGeneration, input.permissionId);
|
|
579
|
+
if (!PERMISSION_STATUS_ID.test(id))
|
|
580
|
+
return undefined;
|
|
581
|
+
return withSynchronousFileLock(authorLock(cid), () => {
|
|
582
|
+
const path = statusPath(cid, id);
|
|
583
|
+
if (!existsSync(path))
|
|
584
|
+
return undefined;
|
|
585
|
+
const current = readStatus(path);
|
|
586
|
+
const resolution = { decision: input.decision, decision_source: input.decisionSource,
|
|
587
|
+
...(input.optionId ? { option_id: input.optionId } : {}), ...(input.reason ? { reason: input.reason } : {}), at: input.at };
|
|
588
|
+
if (current.state === 'closed') {
|
|
589
|
+
const native = !(input.decisionSource === 'automatic' && input.reason === SESSION_ENDED_REASON);
|
|
590
|
+
if (!native || !syntheticEnding(current))
|
|
591
|
+
return current;
|
|
592
|
+
const corrected = { ...current, closed: { reason: input.reason ?? input.decision, at: input.at },
|
|
593
|
+
updated_at: new Date().toISOString(), permission: { ...current.permission, resolution } };
|
|
594
|
+
writeStatus(corrected);
|
|
595
|
+
return corrected;
|
|
596
|
+
}
|
|
597
|
+
const closed = {
|
|
598
|
+
...current, state: 'closed', closed: { reason: input.reason ?? input.decision, at: input.at }, updated_at: input.at,
|
|
599
|
+
permission: { ...current.permission, resolution },
|
|
600
|
+
notification_events: [...(current.notification_events ?? []), { op: 'resolve', eventId: id }],
|
|
601
|
+
};
|
|
602
|
+
writeStatus(closed);
|
|
603
|
+
return closed;
|
|
604
|
+
});
|
|
605
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { type TaskToolBinding } from '../rooms-tasks/task-tools.js';
|
|
3
|
+
import { type StatusAttachment } from './status-store.js';
|
|
4
|
+
/** The calling agent, from its supervisor and runtime; never from tool arguments. */
|
|
5
|
+
export interface StatusToolBinding {
|
|
6
|
+
role: string;
|
|
7
|
+
identityCid?: string;
|
|
8
|
+
displayName?: string;
|
|
9
|
+
/** Present only when the supervisor launched this agent for a task. */
|
|
10
|
+
task?: TaskToolBinding;
|
|
11
|
+
/** Resolves a file this agent delivered through its conversation-file store. */
|
|
12
|
+
attachment: (id: string) => Promise<StatusAttachment & {
|
|
13
|
+
store?: string;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare const STATUS_TOOL_NAMES: readonly ["fleet_status_publish", "fleet_status_close", "fleet_status_get"];
|
|
17
|
+
/**
|
|
18
|
+
* Status tools on the agent's own managed MCP endpoint. Every agent can publish, with or without a mission; the
|
|
19
|
+
* author is the agent's identity and the mission comes only from its supervisor's task binding.
|
|
20
|
+
*/
|
|
21
|
+
export declare function registerStatusTools(server: McpServer, binding: () => StatusToolBinding | undefined, admit: () => Promise<() => void>): void;
|