@ours.network/fleet 2.4.0-nightly.2 → 2.4.0
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/dist/application/model-catalog.d.ts +1 -1
- package/dist/application/model-catalog.js +2 -2
- package/dist/application/task-room-service.d.ts +8 -0
- package/dist/application/task-room-service.js +15 -0
- package/dist/build-info.json +5 -5
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +22 -0
- package/dist/doctor.js +2 -2
- package/dist/harness/codex-runtime.d.ts +2 -0
- package/dist/harness/codex-runtime.js +7 -1
- package/dist/harness/codex.js +2 -3
- package/dist/ops.js +6 -0
- package/dist/rooms-tasks/cli.js +24 -0
- package/dist/rooms-tasks/deletion.js +4 -0
- package/dist/rooms-tasks/task-review.js +2 -0
- package/dist/rooms-tasks/task-state.d.ts +6 -1
- package/dist/rooms-tasks/task-state.js +20 -1
- package/dist/rooms-tasks/types.d.ts +17 -0
- package/dist/rooms-tasks/workspace-removal.d.ts +85 -0
- package/dist/rooms-tasks/workspace-removal.js +633 -0
- package/dist/rooms-tasks/workspace.d.ts +9 -1
- package/dist/rooms-tasks/workspace.js +13 -1
- package/dist/spawn.js +2 -0
- package/dist/web/resource-views.d.ts +1 -1
- package/dist/web/resource-views.js +1 -7
- package/dist/web/runtime.js +0 -13
- package/dist/web/server.d.ts +0 -3
- package/dist/web/server.js +10 -24
- package/docs/task-workspaces.md +51 -1
- package/package.json +7 -7
- package/presets/brain-catalog.json +5 -2
- package/dist/channels/identity-reads.d.ts +0 -69
- package/dist/channels/identity-reads.js +0 -47
- package/dist/channels/indexer.d.ts +0 -55
- package/dist/channels/indexer.js +0 -214
- package/dist/channels/runtime.d.ts +0 -30
- package/dist/channels/runtime.js +0 -125
- package/dist/channels/service.d.ts +0 -61
- package/dist/channels/service.js +0 -88
- package/dist/channels/sources.d.ts +0 -46
- package/dist/channels/sources.js +0 -68
- package/dist/channels/store.d.ts +0 -103
- package/dist/channels/store.js +0 -204
|
@@ -3,7 +3,13 @@ import { spawnSync } from 'node:child_process';
|
|
|
3
3
|
import { accessSync, constants, existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
4
4
|
import { dirname, join, isAbsolute, resolve, delimiter } from 'node:path';
|
|
5
5
|
import { realExec } from '../exec.js';
|
|
6
|
-
export const VERIFIED_CODEX_ACP_VERSIONS = new Set(['1.1.7', '1.10.0']);
|
|
6
|
+
export const VERIFIED_CODEX_ACP_VERSIONS = new Set(['1.1.7', '1.10.0', '2.7.0']);
|
|
7
|
+
/** The inspected runtime floor of the selected ACP adapter, shared by launch and doctor. */
|
|
8
|
+
export function minimumCodexVersion(adapterVersion, model) {
|
|
9
|
+
if (adapterVersion === '2.7.0')
|
|
10
|
+
return '0.166.0';
|
|
11
|
+
return model === 'gpt-6-astra' || adapterVersion === '1.10.0' ? '0.153.3' : '0.145.0';
|
|
12
|
+
}
|
|
7
13
|
export function executableOnPath(command, env, cwd = process.cwd()) {
|
|
8
14
|
if (isAbsolute(command) || command.includes('/') || command.includes('\\'))
|
|
9
15
|
return resolve(cwd, command);
|
package/dist/harness/codex.js
CHANGED
|
@@ -6,7 +6,7 @@ import { realExec } from '../exec.js';
|
|
|
6
6
|
import { registerAdapter } from './registry.js';
|
|
7
7
|
import { harnessRuntimeDir } from '../isolation/policy.js';
|
|
8
8
|
import { resolveBundledAcpAgent, } from './acp-agent.js';
|
|
9
|
-
import { VERIFIED_CODEX_ACP_VERSIONS, probeCodexRuntime, codexVersionAtLeast, hostCodex } from './codex-runtime.js';
|
|
9
|
+
import { VERIFIED_CODEX_ACP_VERSIONS, probeCodexRuntime, codexVersionAtLeast, hostCodex, minimumCodexVersion } from './codex-runtime.js';
|
|
10
10
|
import { CodexAgentSessionAdapter } from './codex-session.js';
|
|
11
11
|
import { CODEX_REASONING_EFFORTS, isCodexReasoningEffort } from './codex-reasoning.js';
|
|
12
12
|
import { packagedModelCatalog } from '../application/model-catalog.js';
|
|
@@ -489,8 +489,7 @@ export function makeCodexAdapter(exec = realExec, transport, nativeTransport) {
|
|
|
489
489
|
catch (error) {
|
|
490
490
|
throw new Error(`Codex ACP runtime check failed: ${error.message}; check CODEX_PATH or reinstall Fleet with optional dependencies`);
|
|
491
491
|
}
|
|
492
|
-
const minimum =
|
|
493
|
-
? '0.153.3' : '0.145.0';
|
|
492
|
+
const minimum = minimumCodexVersion(resolution.version, role.model);
|
|
494
493
|
if (!codexVersionAtLeast(runtime.version, minimum))
|
|
495
494
|
throw new Error(`${role.model ?? 'Codex ACP'} requires a newer Codex (>=${minimum}): ACP selects ${runtime.executable} (${runtime.version}); upgrade Fleet or set CODEX_PATH to a supported executable in the agent/service environment`);
|
|
496
495
|
}
|
package/dist/ops.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { retireNotificationTarget } from './notifications/target-cleanup.js';
|
|
2
|
+
import { withTaskFolderUseFence } from './rooms-tasks/workspace-removal.js';
|
|
2
3
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync, rmSync, unlinkSync, } from 'node:fs';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
5
|
import { randomUUID, createHash } from 'node:crypto';
|
|
@@ -19,6 +20,11 @@ import { provesGeneratedAgentSource } from './generated-agent-source.js';
|
|
|
19
20
|
// resulting launches.
|
|
20
21
|
/** Materialize a role's state dir from config: briefing + markers. Returns the dir. */
|
|
21
22
|
export function applyRole(role, opts = {}) {
|
|
23
|
+
// Agent state that names a task folder is created under that folder's use fence,
|
|
24
|
+
// so a concurrent working-files removal either sees it or this launch refuses.
|
|
25
|
+
return withTaskFolderUseFence(role.cwd, () => applyRoleUnfenced(role, opts));
|
|
26
|
+
}
|
|
27
|
+
function applyRoleUnfenced(role, opts = {}) {
|
|
22
28
|
const adapter = getAdapter(role.harness);
|
|
23
29
|
const errs = adapter.validateOptions(role.harness_options, role);
|
|
24
30
|
if (errs.length)
|
package/dist/rooms-tasks/cli.js
CHANGED
|
@@ -1354,6 +1354,30 @@ export function registerTaskCommands(parent, cOpt) {
|
|
|
1354
1354
|
dieTaskRoom(e);
|
|
1355
1355
|
}
|
|
1356
1356
|
});
|
|
1357
|
+
cOpt(taskCmd.command('remove-files <id>'))
|
|
1358
|
+
.description("remove a Done task's working folder; the task, Progress, To review files and chat history stay")
|
|
1359
|
+
.option('--json', 'JSON output')
|
|
1360
|
+
.action(async (id, opts) => {
|
|
1361
|
+
id = cliTaskRef(id, opts.json);
|
|
1362
|
+
try {
|
|
1363
|
+
const outcome = await taskRoomService(opts.configuration).removeTaskWorkingFiles({
|
|
1364
|
+
actor: { kind: 'local_control', surface: 'cli' }, taskId: id,
|
|
1365
|
+
});
|
|
1366
|
+
if (opts.json) {
|
|
1367
|
+
console.log(JSON.stringify({ schema_version: 1, task: outcome.task, result: outcome.result, mentions: outcome.mentions }, null, 2));
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
const title = outcome.result === 'removed' ? 'Working files removed'
|
|
1371
|
+
: outcome.result === 'already_missing' ? 'Working folder was already missing' : 'Working files already removed';
|
|
1372
|
+
console.log(taskActionMarkdown(title, outcome.task, outcome.mentions.length
|
|
1373
|
+
? [{ label: 'Paths no longer resolve in', value: outcome.mentions.join(', ') }] : []));
|
|
1374
|
+
}
|
|
1375
|
+
catch (e) {
|
|
1376
|
+
if (opts.json)
|
|
1377
|
+
die(e);
|
|
1378
|
+
dieTaskRoom(e);
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1357
1381
|
cOpt(taskCmd.command('_settle <id>', { hidden: true }))
|
|
1358
1382
|
.description('internal: settle a previously accepted task terminal intent')
|
|
1359
1383
|
.option('--json', 'JSON output')
|
|
@@ -264,6 +264,10 @@ export async function settleTaskDeletion(input) {
|
|
|
264
264
|
if (task.workspace) {
|
|
265
265
|
assertWorkspaceDeletable(task.workspace, 'task', taskId);
|
|
266
266
|
beginTaskArchiveCleanup(taskId);
|
|
267
|
+
// Finish an interrupted working-files removal first: archive collection
|
|
268
|
+
// refuses to republish a folder over its pending tombstone.
|
|
269
|
+
if (task.workspace_removal)
|
|
270
|
+
deleteWorkspace(task.workspace, 'task', taskId);
|
|
267
271
|
collectWorkspaceArchives(task.workspace);
|
|
268
272
|
deleteWorkspace(task.workspace, 'task', taskId);
|
|
269
273
|
}
|
|
@@ -512,6 +512,8 @@ export function insideDirectory(root, path) {
|
|
|
512
512
|
export function taskWorkspaceRoot(task) {
|
|
513
513
|
if (!task.workspace)
|
|
514
514
|
throw new TaskReviewError('invalid_request', `task ${task.task_id} has no owned workspace`);
|
|
515
|
+
if (task.workspace_removal)
|
|
516
|
+
throw new TaskReviewError('invalid_request', `the working files of task ${task.task_id} were removed, so no file can be attached from them`);
|
|
515
517
|
assertWorkspacePresent(task.workspace, 'task', task.task_id);
|
|
516
518
|
return task.workspace.path;
|
|
517
519
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ArchivedMemberAbsence } from './types.js';
|
|
2
|
-
import type { TaskRecord, TaskState, TaskOrigin, TaskTemplateRef, TaskOutcome, TaskMemberRole, TaskTerminalIntent, TaskDeletionActor, TaskDeletionMemberPhase, TaskNotificationEvent } from './types.js';
|
|
2
|
+
import type { TaskRecord, TaskState, TaskOrigin, TaskTemplateRef, TaskOutcome, TaskMemberRole, TaskTerminalIntent, TaskDeletionActor, TaskDeletionMemberPhase, TaskNotificationEvent, TaskWorkspaceRemoval } from './types.js';
|
|
3
3
|
import { type LabelCandidate } from './member-naming.js';
|
|
4
4
|
import { type TaskNotificationManifest } from './notification-manifest.js';
|
|
5
5
|
export declare const tasksDir: () => string;
|
|
@@ -295,4 +295,9 @@ export declare function updateTaskContribution<T>(id: string, change: (task: Tas
|
|
|
295
295
|
changed: boolean;
|
|
296
296
|
}): T;
|
|
297
297
|
export declare function updateTaskBrief(id: string, brief: string, expectedBrief: string): TaskRecord;
|
|
298
|
+
/**
|
|
299
|
+
* Record a step of an explicit working-folder removal. Callers hold the task
|
|
300
|
+
* operation lock; lifecycle state is untouched.
|
|
301
|
+
*/
|
|
302
|
+
export declare function updateTaskWorkspaceRemoval(id: string, change: (removal: TaskWorkspaceRemoval | undefined) => TaskWorkspaceRemoval | undefined): TaskRecord;
|
|
298
303
|
export {};
|
|
@@ -518,7 +518,8 @@ export function createTask(input) {
|
|
|
518
518
|
const fresh = readTask(outcome.taskId);
|
|
519
519
|
if (outcome.kind === 'existing')
|
|
520
520
|
assertNoPendingDeletion(fresh);
|
|
521
|
-
|
|
521
|
+
// A replayed create never recreates a folder the Owner removed.
|
|
522
|
+
if (fresh.workspace && !fresh.workspace_removal)
|
|
522
523
|
ensureWorkspace(fresh.workspace);
|
|
523
524
|
return fresh;
|
|
524
525
|
});
|
|
@@ -1502,3 +1503,21 @@ export function updateTaskBrief(id, brief, expectedBrief) {
|
|
|
1502
1503
|
return task;
|
|
1503
1504
|
});
|
|
1504
1505
|
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Record a step of an explicit working-folder removal. Callers hold the task
|
|
1508
|
+
* operation lock; lifecycle state is untouched.
|
|
1509
|
+
*/
|
|
1510
|
+
export function updateTaskWorkspaceRemoval(id, change) {
|
|
1511
|
+
assertCanonicalTaskId(id);
|
|
1512
|
+
return withTaskLock(id, () => {
|
|
1513
|
+
const task = readTask(id);
|
|
1514
|
+
assertNoPendingDeletion(task);
|
|
1515
|
+
const next = change(task.workspace_removal);
|
|
1516
|
+
if (next)
|
|
1517
|
+
task.workspace_removal = next;
|
|
1518
|
+
else
|
|
1519
|
+
delete task.workspace_removal;
|
|
1520
|
+
writeTask(task);
|
|
1521
|
+
return task;
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
@@ -99,6 +99,21 @@ export interface TaskDeletionIntent {
|
|
|
99
99
|
first_failure?: string;
|
|
100
100
|
first_recovery_hint?: string;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Explicit removal of a Done task's owned working folder. The task record,
|
|
104
|
+
* Progress, To review files and agent archives stay; only the folder goes.
|
|
105
|
+
* `started_at` without `completed_at` means removal began and has not been
|
|
106
|
+
* confirmed: it may still be running or have been interrupted.
|
|
107
|
+
*/
|
|
108
|
+
export interface TaskWorkspaceRemoval {
|
|
109
|
+
started_at: string;
|
|
110
|
+
actor: TaskDeletionActor;
|
|
111
|
+
completed_at?: string;
|
|
112
|
+
/** The recorded folder was already absent when removal first ran. */
|
|
113
|
+
already_missing?: true;
|
|
114
|
+
error?: string;
|
|
115
|
+
error_at?: string;
|
|
116
|
+
}
|
|
102
117
|
export interface TaskLayoutLink {
|
|
103
118
|
name: string;
|
|
104
119
|
/** Deterministic `task-<task_id>` Room Layout run ID. */
|
|
@@ -173,6 +188,8 @@ export interface TaskRecord {
|
|
|
173
188
|
/** Rooms whose notifications belong to this task; only grows. */
|
|
174
189
|
notification_manifest?: import('./notification-manifest.js').TaskNotificationManifest;
|
|
175
190
|
workspace?: import('./workspace.js').OwnedWorkspace;
|
|
191
|
+
/** Set once the Owner asked to remove the working folder; the record is never recreated from it. */
|
|
192
|
+
workspace_removal?: TaskWorkspaceRemoval;
|
|
176
193
|
task_id: string;
|
|
177
194
|
/**
|
|
178
195
|
* Immutable human mission key (`MSN-1`), issued once from a durable
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { TaskDeletionActor, TaskRecord } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit Owner removal of a Done task's working folder. Only the exact
|
|
4
|
+
* recorded task-owned folder is removed, through the guarded workspace
|
|
5
|
+
* deletion (marker, Git registration, symlink and mount fences). The task
|
|
6
|
+
* record, Progress, To review files (a separate store), agent archives and
|
|
7
|
+
* rooms' history are never touched. Every precondition is re-read under the
|
|
8
|
+
* task-operation lock that serializes terminal settlement, deletion and
|
|
9
|
+
* recovery; anything that cannot be proven idle is refused, never stopped.
|
|
10
|
+
*/
|
|
11
|
+
export type WorkspaceRemovalResult = 'removed' | 'already_removed' | 'already_missing';
|
|
12
|
+
export interface WorkspaceRemovalOutcome {
|
|
13
|
+
task: TaskRecord;
|
|
14
|
+
result: WorkspaceRemovalResult;
|
|
15
|
+
/** Retained text fields that mention the removed folder; those paths no longer resolve. */
|
|
16
|
+
mentions: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface WorkspaceRemovalDeps {
|
|
19
|
+
/** Working directories of configured permanent agents; undefined when the configuration is unreadable. */
|
|
20
|
+
permanentCwds?: readonly (string | undefined)[];
|
|
21
|
+
/** Test seam: processes whose cwd, root or open files are inside `path`, or cannot be read. */
|
|
22
|
+
processesUsing?(path: string, context: ProcessCheckContext): ProcessUse;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Every process whose cwd, root or open file descriptor is inside `path`, or
|
|
26
|
+
* whose use cannot be excluded. Only Linux exposes this without extra tools;
|
|
27
|
+
* elsewhere removal is refused. When a process's entries are unreadable (for
|
|
28
|
+
* example non-dumpable, or in a container), it is excluded only by evidence:
|
|
29
|
+
* it is a zombie, its mount table cannot reach the folder's filesystem
|
|
30
|
+
* location, it is the user's service manager (attested by the system manager)
|
|
31
|
+
* whose own records name nothing in the folder, or it is that manager's PAM
|
|
32
|
+
* helper started before the folder existed; otherwise it is reported.
|
|
33
|
+
* Other users' unreadable processes are skipped when a private ancestor
|
|
34
|
+
* closes the folder to them; a superuser process is outside this check.
|
|
35
|
+
*/
|
|
36
|
+
/** A same-user process whose cwd and descriptors cannot be read. */
|
|
37
|
+
export interface UnverifiedProcess {
|
|
38
|
+
token: string;
|
|
39
|
+
description: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ProcessUse {
|
|
42
|
+
/** Processes proven to use the folder. */
|
|
43
|
+
users: string[];
|
|
44
|
+
/** Processes whose use can be neither proven nor excluded. */
|
|
45
|
+
unverified: UnverifiedProcess[];
|
|
46
|
+
}
|
|
47
|
+
export interface ProcessCheckContext {
|
|
48
|
+
/** The folder's recorded path; configuration names it, not its tombstone. */
|
|
49
|
+
original: string;
|
|
50
|
+
/** When the folder came into existence (ms since the epoch). */
|
|
51
|
+
createdAt: number;
|
|
52
|
+
}
|
|
53
|
+
export declare function processesUsing(path: string, context: ProcessCheckContext): ProcessUse;
|
|
54
|
+
declare const run: (command: string, args: string[]) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the user service manager may use the folder, from its own read-only
|
|
57
|
+
* records: its attested working directory, socket units' paths and every
|
|
58
|
+
* file descriptor store (systemd 254+). Undefined when none names the folder;
|
|
59
|
+
* otherwise the reason, including any record that cannot be read.
|
|
60
|
+
*/
|
|
61
|
+
export declare function userManagerUse(uid: number, roots: string[], exec?: typeof run): string | undefined;
|
|
62
|
+
/** True when some mount in the table exposes the filesystem location, or anything under it. */
|
|
63
|
+
export declare function reaches(mountinfo: string, target: {
|
|
64
|
+
device: string;
|
|
65
|
+
inside: string;
|
|
66
|
+
}): boolean;
|
|
67
|
+
export declare function assertTaskWorkspaceRemovable(task: TaskRecord, deps: WorkspaceRemovalDeps): void;
|
|
68
|
+
export declare function removeTaskWorkspace(taskId: string, actor: TaskDeletionActor, deps?: WorkspaceRemovalDeps): Promise<WorkspaceRemovalOutcome>;
|
|
69
|
+
export interface WorkingFilesSummary {
|
|
70
|
+
/** `removing`: removal began and is not confirmed — still running or interrupted; retry resumes it. */
|
|
71
|
+
state: 'none' | 'present' | 'removing' | 'failed' | 'removed';
|
|
72
|
+
started_at?: string;
|
|
73
|
+
removed_at?: string;
|
|
74
|
+
error?: string;
|
|
75
|
+
}
|
|
76
|
+
/** Record-only readback for task payloads; never touches the filesystem. */
|
|
77
|
+
export declare function workingFilesSummary(task: TaskRecord): WorkingFilesSummary;
|
|
78
|
+
export declare function assertCwdNotInRemovedTaskFolder(cwd: string | undefined): void;
|
|
79
|
+
/**
|
|
80
|
+
* Launch fence: an agent never starts in, and so never recreates, the folder
|
|
81
|
+
* of a task whose working files were removed. Creating its state under the
|
|
82
|
+
* folder's use lock makes it visible to a concurrent removal's scan.
|
|
83
|
+
*/
|
|
84
|
+
export declare function withTaskFolderUseFence<T>(cwd: string | undefined, work: () => T): T;
|
|
85
|
+
export {};
|