@ours.network/fleet 1.2.0-nightly.19 → 1.2.0-nightly.20
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 +10 -1
- package/dist/agent-ours/correspondence.d.ts +10 -0
- package/dist/agent-ours/correspondence.js +1 -0
- package/dist/agent-ours/runtime.d.ts +6 -0
- package/dist/agent-ours/runtime.js +36 -0
- package/dist/agent-ours/service.js +2 -1
- package/dist/application/conversation-history.d.ts +6 -0
- package/dist/application/conversation-history.js +65 -0
- package/dist/application/fleet-query-service.d.ts +1 -1
- package/dist/application/fleet-query-service.js +2 -2
- package/dist/application/preset-provenance.d.ts +19 -0
- package/dist/application/preset-provenance.js +59 -0
- package/dist/application/room-layout-definitions.d.ts +45 -0
- package/dist/application/room-layout-definitions.js +130 -0
- package/dist/application/session-control.d.ts +8 -0
- package/dist/application/session-control.js +21 -3
- package/dist/application/task-layouts.d.ts +89 -0
- package/dist/application/task-layouts.js +248 -0
- package/dist/application/task-room-service.d.ts +82 -0
- package/dist/application/task-room-service.js +197 -9
- package/dist/build-info.json +4 -4
- package/dist/cli.js +2 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +7 -0
- package/dist/init-wizard.js +4 -2
- package/dist/rooms-tasks/add-member.d.ts +48 -0
- package/dist/rooms-tasks/add-member.js +83 -0
- package/dist/rooms-tasks/cli.js +20 -0
- package/dist/rooms-tasks/external-worker.d.ts +1 -1
- package/dist/rooms-tasks/external-worker.js +3 -3
- package/dist/rooms-tasks/layout-cli.d.ts +2 -0
- package/dist/rooms-tasks/layout-cli.js +81 -0
- package/dist/rooms-tasks/layout-config.d.ts +11 -0
- package/dist/rooms-tasks/layout-config.js +89 -0
- package/dist/rooms-tasks/layout-control.d.ts +21 -0
- package/dist/rooms-tasks/layout-control.js +52 -0
- package/dist/rooms-tasks/layout-service.d.ts +39 -0
- package/dist/rooms-tasks/layout-service.js +173 -0
- package/dist/rooms-tasks/layout.d.ts +102 -0
- package/dist/rooms-tasks/layout.js +227 -0
- package/dist/rooms-tasks/live-readiness.js +2 -1
- package/dist/rooms-tasks/provision.d.ts +3 -0
- package/dist/rooms-tasks/provision.js +44 -22
- package/dist/rooms-tasks/room-state.d.ts +1 -1
- package/dist/rooms-tasks/room-state.js +3 -1
- package/dist/rooms-tasks/task-state.d.ts +19 -0
- package/dist/rooms-tasks/task-state.js +58 -6
- package/dist/rooms-tasks/types.d.ts +14 -0
- package/dist/runner.d.ts +7 -2
- package/dist/runner.js +52 -4
- package/dist/session/acp.d.ts +3 -0
- package/dist/session/acp.js +7 -0
- package/dist/session/arbiter.d.ts +3 -0
- package/dist/session/arbiter.js +20 -2
- package/dist/session/codex-app-server.d.ts +3 -0
- package/dist/session/codex-app-server.js +25 -1
- package/dist/session/control.d.ts +10 -1
- package/dist/session/control.js +36 -2
- package/dist/session/conversation-normalizer.d.ts +2 -1
- package/dist/session/conversation-normalizer.js +1 -1
- package/dist/session/conversation-types.d.ts +5 -3
- package/dist/session/task-notice.d.ts +14 -0
- package/dist/session/task-notice.js +13 -0
- package/dist/session/types.d.ts +3 -0
- package/dist/socket-path.d.ts +2 -0
- package/dist/socket-path.js +22 -0
- package/dist/temp-idle.d.ts +17 -0
- package/dist/temp-idle.js +42 -0
- package/dist/temp-lifecycle.d.ts +1 -1
- package/dist/temp-lifecycle.js +1 -1
- package/dist/web/agent-attachments.d.ts +29 -0
- package/dist/web/agent-attachments.js +162 -0
- package/dist/web/auth.d.ts +4 -1
- package/dist/web/auth.js +23 -2
- package/dist/web/control.js +2 -1
- package/dist/web/fleet-config-service.d.ts +4 -1
- package/dist/web/fleet-config-service.js +46 -15
- package/dist/web/prefix-gateway.d.ts +20 -0
- package/dist/web/prefix-gateway.js +150 -0
- package/dist/web/runtime.d.ts +4 -0
- package/dist/web/runtime.js +19 -14
- package/dist/web/server.d.ts +5 -0
- package/dist/web/server.js +275 -24
- package/docs/room-layouts.md +92 -0
- package/examples/room-layouts/fresh.yaml +27 -0
- package/examples/room-layouts/shared.yaml +19 -0
- package/package.json +14 -13
- package/presets/fleet/room_layouts/engineering.yaml +25 -0
- package/presets/fleet/room_layouts/pair.yaml +24 -0
- package/presets/fleet/room_layouts/single.yaml +17 -0
- package/presets/fleet/room_layouts/team.yaml +30 -0
- package/dist/web-app/assets/index-59GF-gsZ.css +0 -1
- package/dist/web-app/assets/index-C0h3ALvs.js +0 -10
- package/dist/web-app/icons/ours-fleet-maskable.svg +0 -4
- package/dist/web-app/icons/ours-fleet.svg +0 -4
- package/dist/web-app/index.html +0 -17
- package/dist/web-app/manifest.webmanifest +0 -15
- package/dist/web-app/offline.html +0 -18
- package/dist/web-app/sw.js +0 -51
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/** Task ↔ Room Layout bridge.
|
|
2
|
+
* A layout task owns exactly one Room Layout run, `task-<task_id>`, snapshotted
|
|
3
|
+
* from the named source layout with task context added to every room contract.
|
|
4
|
+
* Room opening and closing reuse the #199 engine in detached workers; each
|
|
5
|
+
* operation's outcome is recorded beside the run so HTTP callers can observe it.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
8
|
+
import { existsSync, readFileSync, rmSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { canonicalJson } from '../canonical-json.js';
|
|
11
|
+
import { replaceFileAtomically, withFileLock } from '../atomic-file.js';
|
|
12
|
+
import { assertLayoutFile } from '../rooms-tasks/layout-config.js';
|
|
13
|
+
import { getTask as readTask } from '../rooms-tasks/task-state.js';
|
|
14
|
+
import { stateRoot } from '../paths.js';
|
|
15
|
+
import { launchFleetWorker } from '../rooms-tasks/external-worker.js';
|
|
16
|
+
import { layoutSupervisorId } from '../rooms-tasks/layout-control.js';
|
|
17
|
+
import { layoutRunPath, RoomLayoutService } from '../rooms-tasks/layout-service.js';
|
|
18
|
+
import { FleetError } from './errors.js';
|
|
19
|
+
/** Hash of the authorable definition only (never the source file path). */
|
|
20
|
+
export function layoutDefinitionHash(definition) {
|
|
21
|
+
const { version, description, participants, rooms } = definition;
|
|
22
|
+
return createHash('sha256').update(canonicalJson({ version, description: description ?? null, participants, rooms })).digest('hex');
|
|
23
|
+
}
|
|
24
|
+
/** Always-current brief for layout participants; rooms may open long after the run snapshot.
|
|
25
|
+
* It lives in Fleet's private layout state, never in the agent-writable task workspace. */
|
|
26
|
+
export function taskBriefPath(task) {
|
|
27
|
+
return layoutRunPath(`task-${task.task_id}`).replace(/\.json$/, '.brief.md');
|
|
28
|
+
}
|
|
29
|
+
export function writeTaskBrief(task) {
|
|
30
|
+
const path = taskBriefPath(task); // layoutRunPath verified the private directory
|
|
31
|
+
if (existsSync(path))
|
|
32
|
+
assertLayoutFile(path);
|
|
33
|
+
replaceFileAtomically(path, `# ${task.title}\n\nTask ${task.task_id}\n\n${task.brief?.trim() ?? ''}\n`, 0o600);
|
|
34
|
+
}
|
|
35
|
+
/** Task context reaches every participant through the room contract (briefing text).
|
|
36
|
+
* The contract references the brief file instead of copying the brief, so later edits reach later rooms. */
|
|
37
|
+
export function taskScopedDefinition(definition, task) {
|
|
38
|
+
const preamble = [
|
|
39
|
+
`Task ${task.task_id}: ${task.title}`,
|
|
40
|
+
...(task.workspace ? [`Task workspace: ${task.workspace.path}`] : []),
|
|
41
|
+
`Current task brief: ${taskBriefPath(task)} (kept up to date by Fleet; read it before starting work)`,
|
|
42
|
+
].join('\n');
|
|
43
|
+
for (const room of Object.values(definition.rooms))
|
|
44
|
+
room.contract = room.contract ? `${preamble}\n\nRoom contract:\n${room.contract}` : preamble;
|
|
45
|
+
return definition;
|
|
46
|
+
}
|
|
47
|
+
const ROOM_KEY = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
48
|
+
/** Opening rooms requires a started, live task; checked again by the worker before any side effect. */
|
|
49
|
+
export function assertLayoutOpenable(task) {
|
|
50
|
+
if (task.deletion?.status === 'pending')
|
|
51
|
+
throw new FleetError('conflict', 'task is being deleted; its layout rooms cannot be opened');
|
|
52
|
+
if (task.terminal_intent || ['done', 'cancelled', 'failed'].includes(task.state))
|
|
53
|
+
throw new FleetError('conflict', 'task is closing or closed; its layout rooms cannot be opened');
|
|
54
|
+
if (task.state !== 'active' && task.state !== 'review')
|
|
55
|
+
throw new FleetError('conflict', `start the task before opening rooms (state '${task.state}')`);
|
|
56
|
+
}
|
|
57
|
+
export class TaskLayouts {
|
|
58
|
+
configPath;
|
|
59
|
+
deps;
|
|
60
|
+
constructor(configPath, deps = {}) {
|
|
61
|
+
this.configPath = configPath;
|
|
62
|
+
this.deps = deps;
|
|
63
|
+
}
|
|
64
|
+
service() { return this.deps.service ?? new RoomLayoutService(this.configPath); }
|
|
65
|
+
operationPath(runId) { return join(stateRoot(), 'layouts', `${runId}.op.json`); }
|
|
66
|
+
provenancePath(runId) { return layoutRunPath(runId).replace(/\.json$/, '.provenance.json'); }
|
|
67
|
+
/** Serializes run creation, worker preconditions and deletion's removal of the run. */
|
|
68
|
+
withTaskLock(runId, fn) {
|
|
69
|
+
return withFileLock(layoutRunPath(runId).replace(/\.json$/, '.task.lock'), fn);
|
|
70
|
+
}
|
|
71
|
+
/** Resolve a layout for task creation: it must exist, parse and reference known Agent Templates. */
|
|
72
|
+
resolve(name) {
|
|
73
|
+
return { name, definition_hash: layoutDefinitionHash(this.service().definition(name)) };
|
|
74
|
+
}
|
|
75
|
+
runExists(link) { return existsSync(layoutRunPath(link.run_id)); }
|
|
76
|
+
/** Idempotent: reuse a run whose provenance matches this task, or snapshot one from the pinned source. */
|
|
77
|
+
async ensureRun(task, precondition) {
|
|
78
|
+
const link = task.layout;
|
|
79
|
+
if (!link)
|
|
80
|
+
throw Error(`task ${task.task_id} has no layout`);
|
|
81
|
+
await this.withTaskLock(link.run_id, async () => {
|
|
82
|
+
const current = readTask(task.task_id);
|
|
83
|
+
precondition?.(current);
|
|
84
|
+
writeTaskBrief(current);
|
|
85
|
+
if (this.runExists(link)) {
|
|
86
|
+
this.verifyProvenance(current);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const service = this.service();
|
|
90
|
+
const source = service.definition(link.name);
|
|
91
|
+
if (layoutDefinitionHash(source) !== link.definition_hash)
|
|
92
|
+
throw Error(`room layout ${link.name} changed before this task's layout run was created; create a new task to use the edited layout`);
|
|
93
|
+
const scoped = taskScopedDefinition(structuredClone(source), current);
|
|
94
|
+
const provenance = { task_id: current.task_id, source_hash: link.definition_hash, scoped_hash: layoutDefinitionHash(scoped) };
|
|
95
|
+
// Provenance precedes the run: a crash in between is re-derived from the same pinned source.
|
|
96
|
+
replaceFileAtomically(this.provenancePath(link.run_id), JSON.stringify(provenance), 0o600);
|
|
97
|
+
await service.create(link.name, {}, link.run_id, { source: scoped, cwd: current.workspace?.path });
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
verifyProvenance(task) {
|
|
101
|
+
const link = task.layout, path = this.provenancePath(link.run_id);
|
|
102
|
+
let provenance;
|
|
103
|
+
try {
|
|
104
|
+
assertLayoutFile(path);
|
|
105
|
+
provenance = JSON.parse(readFileSync(path, 'utf8'));
|
|
106
|
+
}
|
|
107
|
+
catch { /* missing or untrusted */ }
|
|
108
|
+
const snapshot = this.service().open(link.run_id, true).snapshot();
|
|
109
|
+
if (!provenance || provenance.task_id !== task.task_id || provenance.source_hash !== link.definition_hash
|
|
110
|
+
|| provenance.scoped_hash !== layoutDefinitionHash({ version: 1, ...snapshot.definition }))
|
|
111
|
+
throw Error(`layout run ${link.run_id} does not match this task's pinned layout; inspect it before continuing`);
|
|
112
|
+
}
|
|
113
|
+
readOperation(runId) {
|
|
114
|
+
const path = this.operationPath(runId);
|
|
115
|
+
try {
|
|
116
|
+
return existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : undefined;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** Update only the still-current operation; a superseded or forgotten one is never resurrected. */
|
|
123
|
+
updateOperation(runId, record) {
|
|
124
|
+
return withFileLock(this.operationPath(runId) + '.lock', () => {
|
|
125
|
+
if (this.readOperation(runId)?.id !== record.id)
|
|
126
|
+
return false;
|
|
127
|
+
this.writeOperation(runId, record);
|
|
128
|
+
return true;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
writeOperation(runId, record) {
|
|
132
|
+
layoutRunPath(runId); // validates the ID and creates the private layouts directory
|
|
133
|
+
replaceFileAtomically(this.operationPath(runId), JSON.stringify({ ...record, updated_at: new Date().toISOString() }), 0o600);
|
|
134
|
+
}
|
|
135
|
+
/** Sanitized read model: no Agent Template snapshots, owner fingerprints or session internals. */
|
|
136
|
+
view(task) {
|
|
137
|
+
const link = task.layout;
|
|
138
|
+
if (!link)
|
|
139
|
+
return undefined;
|
|
140
|
+
const base = { name: link.name, run_id: link.run_id, operation: this.readOperation(link.run_id) };
|
|
141
|
+
if (!this.runExists(link))
|
|
142
|
+
return { ...base, created: false, closed: false, closing: false, rooms: [], participants: [] };
|
|
143
|
+
const state = this.service().open(link.run_id, true).snapshot();
|
|
144
|
+
return {
|
|
145
|
+
...base, created: true, closed: state.closed, closing: Boolean(state.closing),
|
|
146
|
+
...(state.uncertain ? { uncertain: state.uncertain } : {}),
|
|
147
|
+
rooms: Object.entries(state.definition.rooms).map(([key, spec]) => {
|
|
148
|
+
const room = state.rooms[key];
|
|
149
|
+
return {
|
|
150
|
+
key, goal: spec.goal, members: [...spec.members], ...(spec.roles ? { roles: { ...spec.roles } } : {}),
|
|
151
|
+
state: room?.state ?? 'declared', ready: [...(room?.ready ?? [])],
|
|
152
|
+
...(room?.native ? { room_id: room.native.room_id, identity_cid: room.native.identity_cid } : {}),
|
|
153
|
+
};
|
|
154
|
+
}),
|
|
155
|
+
participants: Object.entries(state.participants).map(([key, p]) => ({
|
|
156
|
+
key, agent_template: state.definition.participants[key]?.agent_template, owned: p.owned, retired: Boolean(p.retired),
|
|
157
|
+
...(p.instance?.agent ? { agent: p.instance.agent } : {}), ...(p.instance?.cid ? { cid: p.instance.cid } : {}),
|
|
158
|
+
})),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/** Accept an operation and run it in a detached worker; the outcome is recorded for polling. */
|
|
162
|
+
async launch(task, operation, room) {
|
|
163
|
+
const link = task.layout;
|
|
164
|
+
if (!link)
|
|
165
|
+
throw Error(`task ${task.task_id} has no layout`);
|
|
166
|
+
if (operation !== 'close' && (!room || !ROOM_KEY.test(room)))
|
|
167
|
+
throw new FleetError('invalid_request', 'a valid room key is required');
|
|
168
|
+
if (room) {
|
|
169
|
+
const definition = this.runExists(link) ? this.service().open(link.run_id, true).snapshot().definition : undefined;
|
|
170
|
+
if (definition && !Object.hasOwn(definition.rooms, room))
|
|
171
|
+
throw new FleetError('resource_not_found', `unknown layout room: ${room}`);
|
|
172
|
+
}
|
|
173
|
+
const record = { id: randomUUID(), operation, ...(room ? { room } : {}), status: 'launching' };
|
|
174
|
+
await withFileLock(this.operationPath(link.run_id) + '.lock', () => {
|
|
175
|
+
const current = this.readOperation(link.run_id);
|
|
176
|
+
// Full close always proceeds: terminal cleanup must not wait behind an open; the engine lock serializes them.
|
|
177
|
+
if (operation !== 'close' && current && ['launching', 'running'].includes(current.status) && Date.now() - Date.parse(current.updated_at) < 10 * 60_000)
|
|
178
|
+
throw new FleetError('conflict', `layout operation already in progress: ${current.operation}${current.room ? ' ' + current.room : ''}`);
|
|
179
|
+
this.writeOperation(link.run_id, record);
|
|
180
|
+
});
|
|
181
|
+
const args = ['task', '_layout', task.task_id, operation, ...(room ? [room] : []), '--operation-id', record.id];
|
|
182
|
+
const launch = this.deps.launch
|
|
183
|
+
?? ((cli, name) => launchFleetWorker(cli, name, this.configPath, this.deps.binPath?.()));
|
|
184
|
+
try {
|
|
185
|
+
await launch(args, `task-layout-${task.task_id}`);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
await this.updateOperation(link.run_id, { ...record, status: 'failed', error: `worker failed to start: ${String(error.message ?? error)}` });
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
return this.readOperation(link.run_id);
|
|
192
|
+
}
|
|
193
|
+
/** Worker body. Errors are recorded and rethrown; unknown engine outcomes stay in run state for inspection. */
|
|
194
|
+
/** Without an ID (direct CLI use) the worker claims a new current operation. */
|
|
195
|
+
async run(task, operation, room, operationId) {
|
|
196
|
+
const link = task.layout;
|
|
197
|
+
if (!link)
|
|
198
|
+
throw Error(`task ${task.task_id} has no layout`);
|
|
199
|
+
const record = { id: operationId ?? randomUUID(), operation, ...(room ? { room } : {}) };
|
|
200
|
+
if (!operationId)
|
|
201
|
+
await withFileLock(this.operationPath(link.run_id) + '.lock', () => this.writeOperation(link.run_id, { ...record, status: 'running' }));
|
|
202
|
+
else
|
|
203
|
+
await this.updateOperation(link.run_id, { ...record, status: 'running' });
|
|
204
|
+
try {
|
|
205
|
+
await this.perform(task, operation, room);
|
|
206
|
+
await this.updateOperation(link.run_id, { ...record, status: 'succeeded' });
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
await this.updateOperation(link.run_id, { ...record, status: 'failed', error: error.message ?? String(error) });
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
async perform(task, operation, room) {
|
|
214
|
+
const link = task.layout;
|
|
215
|
+
if (operation === 'open') {
|
|
216
|
+
// Re-read under the task-layout lock: a deletion or terminal action accepted after HTTP admission wins.
|
|
217
|
+
await this.ensureRun(task, assertLayoutOpenable);
|
|
218
|
+
// If deletion removed the run since, fail rather than recreate it.
|
|
219
|
+
if (!this.runExists(link))
|
|
220
|
+
throw new FleetError('conflict', 'task layout run was removed');
|
|
221
|
+
await this.service().open(link.run_id).activate(layoutSupervisorId(), room);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (!this.runExists(link))
|
|
225
|
+
return; // nothing was created, nothing to close
|
|
226
|
+
const engine = this.service().open(link.run_id, true);
|
|
227
|
+
if (operation === 'close-room') {
|
|
228
|
+
if (!engine.snapshot().rooms[room]?.native)
|
|
229
|
+
return; // declared but never opened
|
|
230
|
+
await engine.closeRoom(layoutSupervisorId(), room);
|
|
231
|
+
}
|
|
232
|
+
else
|
|
233
|
+
await engine.close(layoutSupervisorId());
|
|
234
|
+
}
|
|
235
|
+
/** Deletion: close every layout resource, then remove the run and its operation record. */
|
|
236
|
+
async closeAndForget(task) {
|
|
237
|
+
const link = task.layout;
|
|
238
|
+
if (!link)
|
|
239
|
+
return;
|
|
240
|
+
if (this.runExists(link))
|
|
241
|
+
await this.service().open(link.run_id, true).close(layoutSupervisorId());
|
|
242
|
+
await this.withTaskLock(link.run_id, async () => {
|
|
243
|
+
for (const path of [layoutRunPath(link.run_id), this.provenancePath(link.run_id), taskBriefPath(task)])
|
|
244
|
+
rmSync(path, { force: true });
|
|
245
|
+
await withFileLock(this.operationPath(link.run_id) + '.lock', () => rmSync(this.operationPath(link.run_id), { force: true }));
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AddMemberRequest } from '../rooms-tasks/add-member.js';
|
|
2
|
+
import { TaskLayouts } from './task-layouts.js';
|
|
1
3
|
import { type LiveReadinessDeps, type TaskReadinessIssue } from '../rooms-tasks/live-readiness.js';
|
|
2
4
|
import { type FleetConfig } from '../config.js';
|
|
3
5
|
import { type CoworkAdapter } from '../rooms-tasks/cowork-adapter.js';
|
|
@@ -75,6 +77,8 @@ export interface CreateTaskRequest {
|
|
|
75
77
|
list?: string;
|
|
76
78
|
members?: MemberOverrides;
|
|
77
79
|
anonymous?: boolean;
|
|
80
|
+
/** Room Layout name: the task's rooms and participants come from a layout run. */
|
|
81
|
+
layout?: string;
|
|
78
82
|
}
|
|
79
83
|
export interface CreateRoomRequest {
|
|
80
84
|
actor: TaskRoomActor;
|
|
@@ -88,6 +92,7 @@ export interface CreateRoomRequest {
|
|
|
88
92
|
}
|
|
89
93
|
export declare function resolveRoomLaunchPolicy(template: TemplateSnapshot | undefined, override: boolean | undefined): RoomLaunchPolicy;
|
|
90
94
|
export interface TaskRoomServiceDeps {
|
|
95
|
+
taskLayouts?: TaskLayouts;
|
|
91
96
|
liveReadiness?: LiveReadinessDeps;
|
|
92
97
|
loadConfiguration?(path?: string): FleetConfig;
|
|
93
98
|
cowork?(config: FleetConfig, options?: {
|
|
@@ -105,6 +110,67 @@ export declare class TaskRoomApplicationService {
|
|
|
105
110
|
private readonly configurationPath?;
|
|
106
111
|
private readonly deps;
|
|
107
112
|
constructor(configurationPath?: string | undefined, deps?: TaskRoomServiceDeps);
|
|
113
|
+
addMember(taskId: string, request: AddMemberRequest): Promise<{
|
|
114
|
+
requestId: string;
|
|
115
|
+
taskId: string;
|
|
116
|
+
roleId: string;
|
|
117
|
+
state: "running" | "succeeded" | "attention" | "failed";
|
|
118
|
+
error?: string;
|
|
119
|
+
} | {
|
|
120
|
+
state: string;
|
|
121
|
+
error: string;
|
|
122
|
+
requestId: string;
|
|
123
|
+
taskId: string;
|
|
124
|
+
roleId: string;
|
|
125
|
+
}>;
|
|
126
|
+
memberAddition(taskId: string, requestId: string): Promise<{
|
|
127
|
+
requestId: string;
|
|
128
|
+
taskId: string;
|
|
129
|
+
roleId: string;
|
|
130
|
+
state: "running" | "succeeded" | "attention" | "failed";
|
|
131
|
+
error?: string;
|
|
132
|
+
} | {
|
|
133
|
+
state: string;
|
|
134
|
+
error: string;
|
|
135
|
+
requestId: string;
|
|
136
|
+
taskId: string;
|
|
137
|
+
roleId: string;
|
|
138
|
+
}>;
|
|
139
|
+
private layouts;
|
|
140
|
+
private createLayoutTask;
|
|
141
|
+
/** Layout tasks never provision the legacy single room; their run is a local snapshot. */
|
|
142
|
+
private ensureLayoutWork;
|
|
143
|
+
/** Compact room list for task listings; never fails the listing on an unreadable run. */
|
|
144
|
+
withLayoutRooms<T extends TaskRecord>(task: T): T & {
|
|
145
|
+
layout_rooms?: Array<{
|
|
146
|
+
key: string;
|
|
147
|
+
state: string;
|
|
148
|
+
room_id?: string;
|
|
149
|
+
identity_cid?: string;
|
|
150
|
+
}>;
|
|
151
|
+
};
|
|
152
|
+
/** Backlog only: choose, change or clear the task's Room Layout before it starts. */
|
|
153
|
+
setTaskLayout(input: {
|
|
154
|
+
actor: TaskRoomActor;
|
|
155
|
+
taskId: string;
|
|
156
|
+
layout: string | null;
|
|
157
|
+
expectedLayout: string | null;
|
|
158
|
+
}): Promise<TaskRecord>;
|
|
159
|
+
taskLayout(taskId: string): import("./task-layouts.js").TaskLayoutView;
|
|
160
|
+
launchTaskLayoutOperation(input: {
|
|
161
|
+
actor: TaskRoomActor;
|
|
162
|
+
taskId: string;
|
|
163
|
+
operation: 'open' | 'close-room';
|
|
164
|
+
room: string;
|
|
165
|
+
}): Promise<import("./task-layouts.js").TaskLayoutOperationRecord>;
|
|
166
|
+
/** Worker entry for detached layout operations. */
|
|
167
|
+
runTaskLayoutOperation(input: {
|
|
168
|
+
actor: TaskRoomActor;
|
|
169
|
+
taskId: string;
|
|
170
|
+
operation: 'open' | 'close-room' | 'close';
|
|
171
|
+
room?: string;
|
|
172
|
+
operationId?: string;
|
|
173
|
+
}): Promise<import("./task-layouts.js").TaskLayoutView>;
|
|
108
174
|
createTask(request: CreateTaskRequest): Promise<TaskRecord>;
|
|
109
175
|
createRoom(request: CreateRoomRequest): Promise<RoomOrchestrationRecord>;
|
|
110
176
|
startTask(input: {
|
|
@@ -151,6 +217,12 @@ export declare class TaskRoomApplicationService {
|
|
|
151
217
|
moved: number;
|
|
152
218
|
destination?: TaskListRecord;
|
|
153
219
|
}>;
|
|
220
|
+
editTaskDescription(input: {
|
|
221
|
+
actor: TaskRoomActor;
|
|
222
|
+
taskId: string;
|
|
223
|
+
brief: string;
|
|
224
|
+
expectedBrief: string;
|
|
225
|
+
}): TaskRecord;
|
|
154
226
|
getTask(taskId: string): {
|
|
155
227
|
task: TaskRecord;
|
|
156
228
|
orchestration: RoomOrchestrationRecord | undefined;
|
|
@@ -214,10 +286,20 @@ export declare class TaskRoomApplicationService {
|
|
|
214
286
|
taskId: string;
|
|
215
287
|
outcome?: TaskOutcome;
|
|
216
288
|
}): Promise<TaskSettlementPlan>;
|
|
289
|
+
/** Terminal layout tasks archive their rooms and retire only agents their run created. */
|
|
290
|
+
private withLayoutCleanup;
|
|
291
|
+
/** Retry terminal layout cleanup for known resources (e.g. after a failed close). */
|
|
292
|
+
retryTaskLayoutCleanup(input: {
|
|
293
|
+
actor: TaskRoomActor;
|
|
294
|
+
taskId: string;
|
|
295
|
+
}): Promise<import("./task-layouts.js").TaskLayoutOperationRecord>;
|
|
217
296
|
cancelTask(input: {
|
|
218
297
|
actor: TaskRoomActor;
|
|
219
298
|
taskId: string;
|
|
220
299
|
}): Promise<TaskSettlementPlan>;
|
|
300
|
+
/** Continue accepted operations outside the HTTP connection's lifetime. */
|
|
301
|
+
launchTaskSettlement(taskId: string): Promise<TaskRecord>;
|
|
302
|
+
launchTaskProvisioning(taskId: string): Promise<TaskProvisioningOutcome>;
|
|
221
303
|
settleTask(input: {
|
|
222
304
|
actor: {
|
|
223
305
|
kind: 'internal_worker';
|