@ours.network/fleet 1.0.3 → 1.0.5
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 +13 -9
- package/dist/application/errors.d.ts +1 -1
- package/dist/application/role-command-service.d.ts +29 -1
- package/dist/application/role-command-service.js +41 -2
- package/dist/application/role-creation-service.d.ts +32 -1
- package/dist/application/role-creation-service.js +56 -10
- package/dist/application/role-removal-service.d.ts +19 -0
- package/dist/application/role-removal-service.js +13 -3
- package/dist/application/session-mutations.d.ts +7 -0
- package/dist/application/session-mutations.js +8 -0
- package/dist/application/task-room-service.d.ts +262 -0
- package/dist/application/task-room-service.js +571 -0
- package/dist/atomic-file.d.ts +5 -3
- package/dist/atomic-file.js +32 -8
- package/dist/build-info.json +4 -4
- package/dist/cli.js +39 -15
- package/dist/config.d.ts +6 -3
- package/dist/config.js +0 -17
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +26 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/owner-channel/attachments.d.ts +2 -4
- package/dist/owner-channel/attachments.js +6 -39
- package/dist/owner-channel/channel.d.ts +5 -0
- package/dist/owner-channel/channel.js +159 -21
- package/dist/owner-channel/commands.d.ts +43 -1
- package/dist/owner-channel/commands.js +137 -130
- package/dist/rooms-tasks/cli.js +301 -463
- package/dist/rooms-tasks/task-lists.d.ts +19 -0
- package/dist/rooms-tasks/task-lists.js +96 -0
- package/dist/rooms-tasks/task-state.d.ts +3 -0
- package/dist/rooms-tasks/task-state.js +281 -175
- package/dist/rooms-tasks/types.d.ts +11 -1
- package/dist/runner.js +10 -33
- package/dist/session/control.d.ts +10 -1
- package/dist/session/control.js +22 -21
- package/dist/watchdog/query.d.ts +2 -0
- package/dist/watchdog/query.js +7 -3
- package/dist/web/runtime.js +2 -0
- package/dist/web/server.d.ts +2 -0
- package/dist/web/server.js +88 -3
- package/package.json +1 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { type FleetConfig } from '../config.js';
|
|
2
|
+
import { type CoworkAdapter } from '../rooms-tasks/cowork-adapter.js';
|
|
3
|
+
import { provisionMembers } from '../rooms-tasks/provision.js';
|
|
4
|
+
import { moveTaskToList } from '../rooms-tasks/task-state.js';
|
|
5
|
+
import type { RoomOrchestrationRecord, TaskListRecord, TaskOrigin, TaskOutcome, TaskRecord, TaskState } from '../rooms-tasks/types.js';
|
|
6
|
+
export type TaskRoomActor = {
|
|
7
|
+
kind: 'local_control';
|
|
8
|
+
surface: 'cli' | 'web';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'authenticated_owner';
|
|
11
|
+
surface: 'messenger';
|
|
12
|
+
cid: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'internal_worker';
|
|
15
|
+
surface: 'cli';
|
|
16
|
+
};
|
|
17
|
+
export interface TaskSettlementPlan {
|
|
18
|
+
task: TaskRecord;
|
|
19
|
+
settlementRequired: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type TaskRecoveryIssue = {
|
|
22
|
+
code: 'terminal_pending' | 'waiting_cowork' | 'waiting_owner_invite' | 'owner_cid_mismatch' | 'waiting_seats' | 'provisioning_resumed';
|
|
23
|
+
} | {
|
|
24
|
+
code: 'member_failed';
|
|
25
|
+
stepIndex: number;
|
|
26
|
+
} | {
|
|
27
|
+
code: 'resume_failed';
|
|
28
|
+
error: string;
|
|
29
|
+
};
|
|
30
|
+
export interface TaskRecoveryResult {
|
|
31
|
+
kind: 'provisioning_resumed' | 'provisioning_resume_failed' | 'provisioning_non_resumable' | 'terminal' | 'no_op';
|
|
32
|
+
task: TaskRecord;
|
|
33
|
+
room: RoomOrchestrationRecord | undefined;
|
|
34
|
+
issues: TaskRecoveryIssue[];
|
|
35
|
+
reason?: 'missing_room' | 'missing_durable_template' | 'non_resumable_phase';
|
|
36
|
+
}
|
|
37
|
+
export type TaskRecoveryBegin = {
|
|
38
|
+
kind: 'terminal_worker_required';
|
|
39
|
+
taskId: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'final';
|
|
42
|
+
result: TaskRecoveryResult;
|
|
43
|
+
};
|
|
44
|
+
export declare class TaskRoomApplicationError extends Error {
|
|
45
|
+
readonly code: 'template_not_found' | 'task_template_drift' | 'template_mismatch' | 'task_terminal' | 'task_terminal_already' | 'task_non_resumable' | 'room_not_found' | 'room_record_not_found';
|
|
46
|
+
readonly fields: Readonly<Record<string, string>>;
|
|
47
|
+
constructor(code: 'template_not_found' | 'task_template_drift' | 'template_mismatch' | 'task_terminal' | 'task_terminal_already' | 'task_non_resumable' | 'room_not_found' | 'room_record_not_found', message: string, fields?: Readonly<Record<string, string>>);
|
|
48
|
+
}
|
|
49
|
+
export interface CreateTaskRequest {
|
|
50
|
+
actor: TaskRoomActor;
|
|
51
|
+
title: string;
|
|
52
|
+
brief?: string;
|
|
53
|
+
briefFile?: string;
|
|
54
|
+
template?: string;
|
|
55
|
+
backlog?: boolean;
|
|
56
|
+
noRoom?: boolean;
|
|
57
|
+
idempotencyKey?: string;
|
|
58
|
+
origin: TaskOrigin;
|
|
59
|
+
list?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface CreateRoomRequest {
|
|
62
|
+
actor: TaskRoomActor;
|
|
63
|
+
name: string;
|
|
64
|
+
template?: string;
|
|
65
|
+
goal?: string;
|
|
66
|
+
brief?: string;
|
|
67
|
+
briefFile?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface TaskRoomServiceDeps {
|
|
70
|
+
loadConfiguration?(path?: string): FleetConfig;
|
|
71
|
+
cowork?(config: FleetConfig): CoworkAdapter;
|
|
72
|
+
binPath?(): string;
|
|
73
|
+
provisionMembers?: typeof provisionMembers;
|
|
74
|
+
moveTaskToList?: typeof moveTaskToList;
|
|
75
|
+
}
|
|
76
|
+
/** Exact extraction of the previously CLI-owned task create/start behavior. */
|
|
77
|
+
export declare class TaskRoomApplicationService {
|
|
78
|
+
private readonly configurationPath?;
|
|
79
|
+
private readonly deps;
|
|
80
|
+
private recovery?;
|
|
81
|
+
constructor(configurationPath?: string | undefined, deps?: TaskRoomServiceDeps);
|
|
82
|
+
createTask(request: CreateTaskRequest): Promise<TaskRecord>;
|
|
83
|
+
createRoom(request: CreateRoomRequest): Promise<RoomOrchestrationRecord>;
|
|
84
|
+
startTask(input: {
|
|
85
|
+
actor: TaskRoomActor;
|
|
86
|
+
taskId: string;
|
|
87
|
+
}): Promise<TaskRecord>;
|
|
88
|
+
listTasks(filter?: {
|
|
89
|
+
state?: TaskState | TaskState[];
|
|
90
|
+
list?: string;
|
|
91
|
+
}): TaskRecord[];
|
|
92
|
+
listTaskLists(): TaskListRecord[];
|
|
93
|
+
groupedTasks(filter?: {
|
|
94
|
+
state?: TaskState | TaskState[];
|
|
95
|
+
list?: string;
|
|
96
|
+
}): Array<{
|
|
97
|
+
list: TaskListRecord;
|
|
98
|
+
tasks: TaskRecord[];
|
|
99
|
+
}>;
|
|
100
|
+
createTaskList(input: {
|
|
101
|
+
actor: TaskRoomActor;
|
|
102
|
+
name: string;
|
|
103
|
+
}): Promise<TaskListRecord>;
|
|
104
|
+
renameTaskList(input: {
|
|
105
|
+
actor: TaskRoomActor;
|
|
106
|
+
name: string;
|
|
107
|
+
newName: string;
|
|
108
|
+
}): Promise<TaskListRecord>;
|
|
109
|
+
moveTask(input: {
|
|
110
|
+
actor: TaskRoomActor;
|
|
111
|
+
taskId: string;
|
|
112
|
+
list: string;
|
|
113
|
+
}): Promise<TaskRecord>;
|
|
114
|
+
deleteTaskList(input: {
|
|
115
|
+
actor: TaskRoomActor;
|
|
116
|
+
name: string;
|
|
117
|
+
destination?: string;
|
|
118
|
+
}): Promise<{
|
|
119
|
+
deleted: TaskListRecord;
|
|
120
|
+
moved: number;
|
|
121
|
+
destination?: TaskListRecord;
|
|
122
|
+
}>;
|
|
123
|
+
getTask(taskId: string): {
|
|
124
|
+
task: TaskRecord;
|
|
125
|
+
orchestration: RoomOrchestrationRecord | undefined;
|
|
126
|
+
};
|
|
127
|
+
blockTask(input: {
|
|
128
|
+
actor: TaskRoomActor;
|
|
129
|
+
taskId: string;
|
|
130
|
+
reason: string;
|
|
131
|
+
}): TaskRecord;
|
|
132
|
+
unblockTask(input: {
|
|
133
|
+
actor: TaskRoomActor;
|
|
134
|
+
taskId: string;
|
|
135
|
+
}): TaskRecord;
|
|
136
|
+
reviewTask(input: {
|
|
137
|
+
actor: TaskRoomActor;
|
|
138
|
+
taskId: string;
|
|
139
|
+
}): TaskRecord;
|
|
140
|
+
deleteTask(input: {
|
|
141
|
+
actor: TaskRoomActor;
|
|
142
|
+
taskId: string;
|
|
143
|
+
}): boolean;
|
|
144
|
+
completeTask(input: {
|
|
145
|
+
actor: TaskRoomActor;
|
|
146
|
+
taskId: string;
|
|
147
|
+
outcome?: TaskOutcome;
|
|
148
|
+
}): Promise<TaskSettlementPlan>;
|
|
149
|
+
cancelTask(input: {
|
|
150
|
+
actor: TaskRoomActor;
|
|
151
|
+
taskId: string;
|
|
152
|
+
}): Promise<TaskSettlementPlan>;
|
|
153
|
+
settleTask(input: {
|
|
154
|
+
actor: {
|
|
155
|
+
kind: 'internal_worker';
|
|
156
|
+
surface: 'cli';
|
|
157
|
+
};
|
|
158
|
+
taskId: string;
|
|
159
|
+
}): Promise<TaskRecord>;
|
|
160
|
+
recordSettlementError(input: {
|
|
161
|
+
actor: TaskRoomActor;
|
|
162
|
+
taskId: string;
|
|
163
|
+
error: string;
|
|
164
|
+
recoveryHint: string;
|
|
165
|
+
}): Promise<TaskRecord>;
|
|
166
|
+
beginTaskRecovery(input: {
|
|
167
|
+
actor: TaskRoomActor;
|
|
168
|
+
taskId: string;
|
|
169
|
+
}): Promise<TaskRecoveryBegin>;
|
|
170
|
+
continueTaskRecovery(input: {
|
|
171
|
+
actor: TaskRoomActor;
|
|
172
|
+
taskId: string;
|
|
173
|
+
terminalTimedOut: boolean;
|
|
174
|
+
}): Promise<TaskRecoveryResult>;
|
|
175
|
+
private acceptTerminal;
|
|
176
|
+
listTemplates(): import("../rooms-tasks/types.js").TemplateDefinition[];
|
|
177
|
+
getTemplate(name: string): {
|
|
178
|
+
content_hash: string;
|
|
179
|
+
name: string;
|
|
180
|
+
version: number;
|
|
181
|
+
description: string;
|
|
182
|
+
builtin?: boolean;
|
|
183
|
+
room?: import("../rooms-tasks/types.js").TemplateRoomConfig;
|
|
184
|
+
contract?: string;
|
|
185
|
+
members: import("../rooms-tasks/types.js").TemplateMemberSlot[];
|
|
186
|
+
};
|
|
187
|
+
validateTemplates(): {
|
|
188
|
+
template: string;
|
|
189
|
+
issues: string[];
|
|
190
|
+
}[];
|
|
191
|
+
listRooms(filter?: {
|
|
192
|
+
state?: 'active' | 'provisioning';
|
|
193
|
+
}): Promise<{
|
|
194
|
+
orchestration: RoomOrchestrationRecord | null;
|
|
195
|
+
room_id: string;
|
|
196
|
+
identity_name: string;
|
|
197
|
+
identity_cid: string;
|
|
198
|
+
room_name: string;
|
|
199
|
+
state: "provisioning" | "active" | "closing" | "closed";
|
|
200
|
+
seats: import("../rooms-tasks/cowork-adapter.js").CoworkSeatInfo[];
|
|
201
|
+
goal?: string;
|
|
202
|
+
briefing?: string;
|
|
203
|
+
role_briefings: Record<string, import("../rooms-tasks/cowork-adapter.js").CoworkRoleBriefingInfo>;
|
|
204
|
+
}[]>;
|
|
205
|
+
getRoomDetail(id: string): Promise<{
|
|
206
|
+
room: import("../rooms-tasks/cowork-adapter.js").CoworkRoomInfo;
|
|
207
|
+
orchestration: RoomOrchestrationRecord | undefined;
|
|
208
|
+
}>;
|
|
209
|
+
getRoomMembers(id: string): Promise<{
|
|
210
|
+
room: import("../rooms-tasks/cowork-adapter.js").CoworkRoomInfo;
|
|
211
|
+
orchestration: RoomOrchestrationRecord | undefined;
|
|
212
|
+
members: import("../rooms-tasks/cowork-adapter.js").CoworkSeatInfo[];
|
|
213
|
+
}>;
|
|
214
|
+
requestRoomDeletion(input: {
|
|
215
|
+
actor: TaskRoomActor;
|
|
216
|
+
roomId: string;
|
|
217
|
+
}): Promise<{
|
|
218
|
+
room: RoomOrchestrationRecord;
|
|
219
|
+
settlementRequired: true;
|
|
220
|
+
}>;
|
|
221
|
+
settleRoomDeletion(input: {
|
|
222
|
+
actor: {
|
|
223
|
+
kind: 'internal_worker';
|
|
224
|
+
surface: 'cli';
|
|
225
|
+
};
|
|
226
|
+
roomId: string;
|
|
227
|
+
}): Promise<import("../rooms-tasks/close.js").ManagedRoomDeleteResult>;
|
|
228
|
+
recordRoomSettlementError(input: {
|
|
229
|
+
actor: TaskRoomActor;
|
|
230
|
+
roomId: string;
|
|
231
|
+
error: string;
|
|
232
|
+
recoveryHint: string;
|
|
233
|
+
}): Promise<RoomOrchestrationRecord>;
|
|
234
|
+
recoverRoom(input: {
|
|
235
|
+
actor: TaskRoomActor;
|
|
236
|
+
roomId: string;
|
|
237
|
+
}): Promise<{
|
|
238
|
+
kind: 'deletion_worker_required';
|
|
239
|
+
roomId: string;
|
|
240
|
+
} | {
|
|
241
|
+
kind: 'recovered' | 'provisioning_resumed' | 'provisioning_resume_failed';
|
|
242
|
+
room: Awaited<ReturnType<CoworkAdapter['recoverRoom']>>;
|
|
243
|
+
orchestration: RoomOrchestrationRecord | undefined;
|
|
244
|
+
issues: string[];
|
|
245
|
+
}>;
|
|
246
|
+
finishTask(input: {
|
|
247
|
+
actor: TaskRoomActor;
|
|
248
|
+
taskId: string;
|
|
249
|
+
outcome?: TaskOutcome;
|
|
250
|
+
}): Promise<TaskSettlementPlan>;
|
|
251
|
+
ensureTaskWork(input: {
|
|
252
|
+
actor: TaskRoomActor;
|
|
253
|
+
taskId: string;
|
|
254
|
+
template?: string;
|
|
255
|
+
}): Promise<{
|
|
256
|
+
task: TaskRecord;
|
|
257
|
+
status: 'ready' | 'already_active';
|
|
258
|
+
}>;
|
|
259
|
+
private createTemplate;
|
|
260
|
+
private existingTemplate;
|
|
261
|
+
private provisionRoom;
|
|
262
|
+
}
|