@agimon-ai/doompi-task 0.0.1-alpha.72 → 0.0.1-alpha.75
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 +12 -3
- package/package.json +15 -14
- package/dist/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/api-contracts.cjs +0 -1
- package/dist/api-contracts.d.cts +0 -2
- package/dist/api-contracts.d.mts +0 -2
- package/dist/api-contracts.mjs +0 -1
- package/dist/commands.cjs +0 -1
- package/dist/commands.d.cts +0 -2
- package/dist/commands.d.mts +0 -2
- package/dist/commands.mjs +0 -1
- package/dist/config.cjs +0 -1
- package/dist/config.d.cts +0 -2
- package/dist/config.d.mts +0 -2
- package/dist/config.mjs +0 -1
- package/dist/constants/promptGuidelines.cjs +0 -2
- package/dist/constants/promptGuidelines.cjs.map +0 -1
- package/dist/constants/promptGuidelines.d.cts +0 -13
- package/dist/constants/promptGuidelines.d.cts.map +0 -1
- package/dist/constants/promptGuidelines.d.mts +0 -13
- package/dist/constants/promptGuidelines.d.mts.map +0 -1
- package/dist/constants/promptGuidelines.mjs +0 -2
- package/dist/constants/promptGuidelines.mjs.map +0 -1
- package/dist/constants/task.cjs +0 -2
- package/dist/constants/task.cjs.map +0 -1
- package/dist/constants/task.d.cts +0 -4
- package/dist/constants/task.d.cts.map +0 -1
- package/dist/constants/task.d.mts +0 -4
- package/dist/constants/task.d.mts.map +0 -1
- package/dist/constants/task.mjs +0 -2
- package/dist/constants/task.mjs.map +0 -1
- package/dist/controllers/tasksCommand.cjs +0 -2
- package/dist/controllers/tasksCommand.cjs.map +0 -1
- package/dist/controllers/tasksCommand.d.cts +0 -15
- package/dist/controllers/tasksCommand.d.cts.map +0 -1
- package/dist/controllers/tasksCommand.d.mts +0 -15
- package/dist/controllers/tasksCommand.d.mts.map +0 -1
- package/dist/controllers/tasksCommand.mjs +0 -2
- package/dist/controllers/tasksCommand.mjs.map +0 -1
- package/dist/controllers/webTasksChannel.cjs +0 -2
- package/dist/controllers/webTasksChannel.cjs.map +0 -1
- package/dist/controllers/webTasksChannel.mjs +0 -2
- package/dist/controllers/webTasksChannel.mjs.map +0 -1
- package/dist/delegation-manager.cjs +0 -1
- package/dist/delegation-manager.d.cts +0 -3
- package/dist/delegation-manager.d.mts +0 -3
- package/dist/delegation-manager.mjs +0 -1
- package/dist/extensions/pi.cjs +0 -3
- package/dist/extensions/pi.cjs.map +0 -1
- package/dist/extensions/pi.d.cts +0 -6
- package/dist/extensions/pi.d.cts.map +0 -1
- package/dist/extensions/pi.d.mts +0 -6
- package/dist/extensions/pi.d.mts.map +0 -1
- package/dist/extensions/pi.mjs +0 -3
- package/dist/extensions/pi.mjs.map +0 -1
- package/dist/extensions/server.cjs +0 -2
- package/dist/extensions/server.cjs.map +0 -1
- package/dist/extensions/server.d.cts +0 -5
- package/dist/extensions/server.d.cts.map +0 -1
- package/dist/extensions/server.d.mts +0 -5
- package/dist/extensions/server.d.mts.map +0 -1
- package/dist/extensions/server.mjs +0 -2
- package/dist/extensions/server.mjs.map +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -16
- package/dist/index.d.mts +0 -16
- package/dist/index.mjs +0 -1
- package/dist/logSinkTelemetry.cjs +0 -1
- package/dist/logSinkTelemetry.d.cts +0 -3
- package/dist/logSinkTelemetry.d.mts +0 -3
- package/dist/logSinkTelemetry.mjs +0 -1
- package/dist/models/task.cjs +0 -2
- package/dist/models/task.cjs.map +0 -1
- package/dist/models/task.d.cts +0 -176
- package/dist/models/task.d.cts.map +0 -1
- package/dist/models/task.d.mts +0 -176
- package/dist/models/task.d.mts.map +0 -1
- package/dist/models/task.mjs +0 -2
- package/dist/models/task.mjs.map +0 -1
- package/dist/models/taskGraph.cjs +0 -2
- package/dist/models/taskGraph.cjs.map +0 -1
- package/dist/models/taskGraph.d.cts +0 -24
- package/dist/models/taskGraph.d.cts.map +0 -1
- package/dist/models/taskGraph.d.mts +0 -24
- package/dist/models/taskGraph.d.mts.map +0 -1
- package/dist/models/taskGraph.mjs +0 -2
- package/dist/models/taskGraph.mjs.map +0 -1
- package/dist/schemas/apiContracts.cjs +0 -2
- package/dist/schemas/apiContracts.cjs.map +0 -1
- package/dist/schemas/apiContracts.d.cts +0 -53
- package/dist/schemas/apiContracts.d.cts.map +0 -1
- package/dist/schemas/apiContracts.d.mts +0 -53
- package/dist/schemas/apiContracts.d.mts.map +0 -1
- package/dist/schemas/apiContracts.mjs +0 -2
- package/dist/schemas/apiContracts.mjs.map +0 -1
- package/dist/schemas/task.cjs +0 -2
- package/dist/schemas/task.cjs.map +0 -1
- package/dist/schemas/task.d.cts +0 -103
- package/dist/schemas/task.d.cts.map +0 -1
- package/dist/schemas/task.d.mts +0 -103
- package/dist/schemas/task.d.mts.map +0 -1
- package/dist/schemas/task.mjs +0 -2
- package/dist/schemas/task.mjs.map +0 -1
- package/dist/services/config/index.cjs +0 -2
- package/dist/services/config/index.cjs.map +0 -1
- package/dist/services/config/index.d.cts +0 -42
- package/dist/services/config/index.d.cts.map +0 -1
- package/dist/services/config/index.d.mts +0 -42
- package/dist/services/config/index.d.mts.map +0 -1
- package/dist/services/config/index.mjs +0 -2
- package/dist/services/config/index.mjs.map +0 -1
- package/dist/services/contextContribution/index.cjs +0 -3
- package/dist/services/contextContribution/index.cjs.map +0 -1
- package/dist/services/contextContribution/index.mjs +0 -3
- package/dist/services/contextContribution/index.mjs.map +0 -1
- package/dist/services/delegation/index.cjs +0 -6
- package/dist/services/delegation/index.cjs.map +0 -1
- package/dist/services/delegation/index.d.cts +0 -192
- package/dist/services/delegation/index.d.cts.map +0 -1
- package/dist/services/delegation/index.d.mts +0 -192
- package/dist/services/delegation/index.d.mts.map +0 -1
- package/dist/services/delegation/index.mjs +0 -6
- package/dist/services/delegation/index.mjs.map +0 -1
- package/dist/services/delegationPlatform/index.cjs +0 -2
- package/dist/services/delegationPlatform/index.cjs.map +0 -1
- package/dist/services/delegationPlatform/index.mjs +0 -2
- package/dist/services/delegationPlatform/index.mjs.map +0 -1
- package/dist/services/invariants/index.cjs +0 -2
- package/dist/services/invariants/index.cjs.map +0 -1
- package/dist/services/invariants/index.d.cts +0 -23
- package/dist/services/invariants/index.d.cts.map +0 -1
- package/dist/services/invariants/index.d.mts +0 -23
- package/dist/services/invariants/index.d.mts.map +0 -1
- package/dist/services/invariants/index.mjs +0 -2
- package/dist/services/invariants/index.mjs.map +0 -1
- package/dist/services/logSinkTelemetry/index.cjs +0 -2
- package/dist/services/logSinkTelemetry/index.cjs.map +0 -1
- package/dist/services/logSinkTelemetry/index.d.cts +0 -23
- package/dist/services/logSinkTelemetry/index.d.cts.map +0 -1
- package/dist/services/logSinkTelemetry/index.d.mts +0 -23
- package/dist/services/logSinkTelemetry/index.d.mts.map +0 -1
- package/dist/services/logSinkTelemetry/index.mjs +0 -2
- package/dist/services/logSinkTelemetry/index.mjs.map +0 -1
- package/dist/services/paths/index.cjs +0 -2
- package/dist/services/paths/index.cjs.map +0 -1
- package/dist/services/paths/index.d.cts +0 -25
- package/dist/services/paths/index.d.cts.map +0 -1
- package/dist/services/paths/index.d.mts +0 -25
- package/dist/services/paths/index.d.mts.map +0 -1
- package/dist/services/paths/index.mjs +0 -2
- package/dist/services/paths/index.mjs.map +0 -1
- package/dist/services/processLiveness/index.cjs +0 -2
- package/dist/services/processLiveness/index.cjs.map +0 -1
- package/dist/services/processLiveness/index.d.cts +0 -11
- package/dist/services/processLiveness/index.d.cts.map +0 -1
- package/dist/services/processLiveness/index.d.mts +0 -11
- package/dist/services/processLiveness/index.d.mts.map +0 -1
- package/dist/services/processLiveness/index.mjs +0 -2
- package/dist/services/processLiveness/index.mjs.map +0 -1
- package/dist/services/reconcile/index.cjs +0 -2
- package/dist/services/reconcile/index.cjs.map +0 -1
- package/dist/services/reconcile/index.d.cts +0 -33
- package/dist/services/reconcile/index.d.cts.map +0 -1
- package/dist/services/reconcile/index.d.mts +0 -33
- package/dist/services/reconcile/index.d.mts.map +0 -1
- package/dist/services/reconcile/index.mjs +0 -2
- package/dist/services/reconcile/index.mjs.map +0 -1
- package/dist/services/reducer/index.cjs +0 -3
- package/dist/services/reducer/index.cjs.map +0 -1
- package/dist/services/reducer/index.d.cts +0 -71
- package/dist/services/reducer/index.d.cts.map +0 -1
- package/dist/services/reducer/index.d.mts +0 -71
- package/dist/services/reducer/index.d.mts.map +0 -1
- package/dist/services/reducer/index.mjs +0 -3
- package/dist/services/reducer/index.mjs.map +0 -1
- package/dist/services/taskNarration/index.cjs +0 -2
- package/dist/services/taskNarration/index.cjs.map +0 -1
- package/dist/services/taskNarration/index.mjs +0 -2
- package/dist/services/taskNarration/index.mjs.map +0 -1
- package/dist/services/taskResult/index.cjs +0 -7
- package/dist/services/taskResult/index.cjs.map +0 -1
- package/dist/services/taskResult/index.d.cts +0 -50
- package/dist/services/taskResult/index.d.cts.map +0 -1
- package/dist/services/taskResult/index.d.mts +0 -50
- package/dist/services/taskResult/index.d.mts.map +0 -1
- package/dist/services/taskResult/index.mjs +0 -7
- package/dist/services/taskResult/index.mjs.map +0 -1
- package/dist/services/taskStore/index.cjs +0 -2
- package/dist/services/taskStore/index.cjs.map +0 -1
- package/dist/services/taskStore/index.d.cts +0 -69
- package/dist/services/taskStore/index.d.cts.map +0 -1
- package/dist/services/taskStore/index.d.mts +0 -69
- package/dist/services/taskStore/index.d.mts.map +0 -1
- package/dist/services/taskStore/index.mjs +0 -2
- package/dist/services/taskStore/index.mjs.map +0 -1
- package/dist/store-invariants.cjs +0 -1
- package/dist/store-invariants.d.cts +0 -2
- package/dist/store-invariants.d.mts +0 -2
- package/dist/store-invariants.mjs +0 -1
- package/dist/store-paths.cjs +0 -1
- package/dist/store-paths.d.cts +0 -2
- package/dist/store-paths.d.mts +0 -2
- package/dist/store-paths.mjs +0 -1
- package/dist/store-process-liveness.cjs +0 -1
- package/dist/store-process-liveness.d.cts +0 -2
- package/dist/store-process-liveness.d.mts +0 -2
- package/dist/store-process-liveness.mjs +0 -1
- package/dist/store-reconcile.cjs +0 -1
- package/dist/store-reconcile.d.cts +0 -2
- package/dist/store-reconcile.d.mts +0 -2
- package/dist/store-reconcile.mjs +0 -1
- package/dist/store-reducer.cjs +0 -1
- package/dist/store-reducer.d.cts +0 -2
- package/dist/store-reducer.d.mts +0 -2
- package/dist/store-reducer.mjs +0 -1
- package/dist/store-task-graph.cjs +0 -1
- package/dist/store-task-graph.d.cts +0 -2
- package/dist/store-task-graph.d.mts +0 -2
- package/dist/store-task-graph.mjs +0 -1
- package/dist/store-task-store.cjs +0 -1
- package/dist/store-task-store.d.cts +0 -2
- package/dist/store-task-store.d.mts +0 -2
- package/dist/store-task-store.mjs +0 -1
- package/dist/store-types.cjs +0 -1
- package/dist/store-types.d.cts +0 -2
- package/dist/store-types.d.mts +0 -2
- package/dist/store-types.mjs +0 -1
- package/dist/tool-prompt-guidelines.cjs +0 -1
- package/dist/tool-prompt-guidelines.d.cts +0 -2
- package/dist/tool-prompt-guidelines.d.mts +0 -2
- package/dist/tool-prompt-guidelines.mjs +0 -1
- package/dist/tool-response-envelope.cjs +0 -1
- package/dist/tool-response-envelope.d.cts +0 -2
- package/dist/tool-response-envelope.d.mts +0 -2
- package/dist/tool-response-envelope.mjs +0 -1
- package/dist/tool-schema.cjs +0 -1
- package/dist/tool-schema.d.cts +0 -3
- package/dist/tool-schema.d.mts +0 -3
- package/dist/tool-schema.mjs +0 -1
- package/dist/tool-task-tool.cjs +0 -1
- package/dist/tool-task-tool.d.cts +0 -3
- package/dist/tool-task-tool.d.mts +0 -3
- package/dist/tool-task-tool.mjs +0 -1
- package/dist/tools/task.cjs +0 -3
- package/dist/tools/task.cjs.map +0 -1
- package/dist/tools/task.d.cts +0 -22
- package/dist/tools/task.d.cts.map +0 -1
- package/dist/tools/task.d.mts +0 -22
- package/dist/tools/task.d.mts.map +0 -1
- package/dist/tools/task.mjs +0 -3
- package/dist/tools/task.mjs.map +0 -1
- package/dist/tui/format.cjs +0 -4
- package/dist/tui/format.cjs.map +0 -1
- package/dist/tui/format.d.cts +0 -61
- package/dist/tui/format.d.cts.map +0 -1
- package/dist/tui/format.d.mts +0 -61
- package/dist/tui/format.d.mts.map +0 -1
- package/dist/tui/format.mjs +0 -4
- package/dist/tui/format.mjs.map +0 -1
- package/dist/tui/selectors.cjs +0 -2
- package/dist/tui/selectors.cjs.map +0 -1
- package/dist/tui/selectors.d.cts +0 -59
- package/dist/tui/selectors.d.cts.map +0 -1
- package/dist/tui/selectors.d.mts +0 -59
- package/dist/tui/selectors.d.mts.map +0 -1
- package/dist/tui/selectors.mjs +0 -2
- package/dist/tui/selectors.mjs.map +0 -1
- package/dist/tui/taskOverlay.cjs +0 -2
- package/dist/tui/taskOverlay.cjs.map +0 -1
- package/dist/tui/taskOverlay.d.cts +0 -37
- package/dist/tui/taskOverlay.d.cts.map +0 -1
- package/dist/tui/taskOverlay.d.mts +0 -37
- package/dist/tui/taskOverlay.d.mts.map +0 -1
- package/dist/tui/taskOverlay.mjs +0 -2
- package/dist/tui/taskOverlay.mjs.map +0 -1
- package/dist/tui/taskSpace.cjs +0 -5
- package/dist/tui/taskSpace.cjs.map +0 -1
- package/dist/tui/taskSpace.d.cts +0 -60
- package/dist/tui/taskSpace.d.cts.map +0 -1
- package/dist/tui/taskSpace.d.mts +0 -60
- package/dist/tui/taskSpace.d.mts.map +0 -1
- package/dist/tui/taskSpace.mjs +0 -5
- package/dist/tui/taskSpace.mjs.map +0 -1
- package/dist/tui-format.cjs +0 -1
- package/dist/tui-format.d.cts +0 -2
- package/dist/tui-format.d.mts +0 -2
- package/dist/tui-format.mjs +0 -1
- package/dist/tui-selectors.cjs +0 -1
- package/dist/tui-selectors.d.cts +0 -2
- package/dist/tui-selectors.d.mts +0 -2
- package/dist/tui-selectors.mjs +0 -1
- package/dist/tui-task-overlay.cjs +0 -1
- package/dist/tui-task-overlay.d.cts +0 -2
- package/dist/tui-task-overlay.d.mts +0 -2
- package/dist/tui-task-overlay.mjs +0 -1
- package/dist/tui-task-space.cjs +0 -1
- package/dist/tui-task-space.d.cts +0 -2
- package/dist/tui-task-space.d.mts +0 -2
- package/dist/tui-task-space.mjs +0 -1
- package/dist/types/delegation.cjs +0 -2
- package/dist/types/delegation.cjs.map +0 -1
- package/dist/types/delegation.d.cts +0 -5
- package/dist/types/delegation.d.cts.map +0 -1
- package/dist/types/delegation.d.mts +0 -5
- package/dist/types/delegation.d.mts.map +0 -1
- package/dist/types/delegation.mjs +0 -2
- package/dist/types/delegation.mjs.map +0 -1
- package/dist/types/telemetry.cjs +0 -2
- package/dist/types/telemetry.cjs.map +0 -1
- package/dist/types/telemetry.d.cts +0 -35
- package/dist/types/telemetry.d.cts.map +0 -1
- package/dist/types/telemetry.d.mts +0 -35
- package/dist/types/telemetry.d.mts.map +0 -1
- package/dist/types/telemetry.mjs +0 -2
- package/dist/types/telemetry.mjs.map +0 -1
- package/dist/types/webTasks.cjs +0 -2
- package/dist/types/webTasks.cjs.map +0 -1
- package/dist/types/webTasks.mjs +0 -2
- package/dist/types/webTasks.mjs.map +0 -1
- package/src/extensions/web.ts +0 -18
- package/src/web/components/TaskDetailDialog.tsx +0 -251
- package/src/web/components/TaskToolMessage.tsx +0 -120
- package/src/web/components/TasksActivitySection.tsx +0 -200
- package/src/web/lib/taskToolFormat.ts +0 -330
- package/src/web/stores/tasksStore.ts +0 -114
- package/src/web/tsconfig.json +0 -23
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure view logic for the task tool card, the browser counterpart of
|
|
3
|
-
* src/tui/format.ts (renderTaskCall, renderTaskResult). The plugin may reach
|
|
4
|
-
* only its own files and src/types, so the store shapes it reads are
|
|
5
|
-
* restated here as the wire JSON of a tool_execution frame.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'deleted';
|
|
9
|
-
export type TaskAction = 'upsert' | 'list' | 'get' | 'delete' | 'clear' | 'assign' | 'cancel';
|
|
10
|
-
|
|
11
|
-
export const STATUS_GLYPH: Record<TaskStatus, string> = {
|
|
12
|
-
pending: '○',
|
|
13
|
-
in_progress: '◐',
|
|
14
|
-
completed: '●',
|
|
15
|
-
failed: '✗',
|
|
16
|
-
deleted: '⊘',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const STATUS_LABEL: Record<TaskStatus, string> = {
|
|
20
|
-
pending: 'pending',
|
|
21
|
-
in_progress: 'in progress',
|
|
22
|
-
completed: 'completed',
|
|
23
|
-
failed: 'failed',
|
|
24
|
-
deleted: 'deleted',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const ACTION_GLYPH: Record<TaskAction, string> = {
|
|
28
|
-
upsert: '✎',
|
|
29
|
-
delete: '×',
|
|
30
|
-
get: '›',
|
|
31
|
-
list: '☰',
|
|
32
|
-
clear: '∅',
|
|
33
|
-
assign: '⇒',
|
|
34
|
-
cancel: '⊗',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* `upsert` is two operations behind one name, so a homogeneous batch narrows to
|
|
39
|
-
* the glyph the operator already reads: `+` means new work appeared, `→` means
|
|
40
|
-
* work moved. A mixed batch keeps the neutral write glyph.
|
|
41
|
-
*/
|
|
42
|
-
const UPSERT_CREATE_GLYPH = '+';
|
|
43
|
-
const UPSERT_UPDATE_GLYPH = '→';
|
|
44
|
-
/** Task rows kept in a collapsed result, before the card is expanded. */
|
|
45
|
-
const TRANSCRIPT_TASK_ROWS = 8;
|
|
46
|
-
const TASK_STATUSES: readonly TaskStatus[] = ['pending', 'in_progress', 'completed', 'failed', 'deleted'];
|
|
47
|
-
const TASK_ACTIONS: readonly TaskAction[] = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'];
|
|
48
|
-
const INLINE_WHITESPACE = /\s+/gu;
|
|
49
|
-
|
|
50
|
-
/** One task as the result details carry it (src/models/task.ts Task). */
|
|
51
|
-
export interface TaskView {
|
|
52
|
-
id: number;
|
|
53
|
-
subject: string;
|
|
54
|
-
status: TaskStatus;
|
|
55
|
-
activeForm?: string;
|
|
56
|
-
blockedBy?: number[];
|
|
57
|
-
delegation?: { agent?: string; state?: string };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** The result details (src/models/task.ts TaskDetails), narrowed to what the card reads. */
|
|
61
|
-
export interface TaskDetailsView {
|
|
62
|
-
action: TaskAction;
|
|
63
|
-
params: Record<string, unknown>;
|
|
64
|
-
tasks: TaskView[];
|
|
65
|
-
error?: string;
|
|
66
|
-
upsert?: { applied: number[]; failed: number };
|
|
67
|
-
assignment?: { assigned: number[]; failed: number };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
71
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function isStatus(value: unknown): value is TaskStatus {
|
|
75
|
-
return typeof value === 'string' && (TASK_STATUSES as readonly string[]).includes(value);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function isAction(value: unknown): value is TaskAction {
|
|
79
|
-
return typeof value === 'string' && (TASK_ACTIONS as readonly string[]).includes(value);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function taskView(value: unknown): TaskView | null {
|
|
83
|
-
if (!isRecord(value) || typeof value.id !== 'number' || typeof value.subject !== 'string') return null;
|
|
84
|
-
if (!isStatus(value.status)) return null;
|
|
85
|
-
const task: TaskView = { id: value.id, subject: value.subject, status: value.status };
|
|
86
|
-
if (typeof value.activeForm === 'string') task.activeForm = value.activeForm;
|
|
87
|
-
if (Array.isArray(value.blockedBy)) {
|
|
88
|
-
task.blockedBy = value.blockedBy.filter((id): id is number => typeof id === 'number');
|
|
89
|
-
}
|
|
90
|
-
if (isRecord(value.delegation)) {
|
|
91
|
-
task.delegation = {};
|
|
92
|
-
if (typeof value.delegation.agent === 'string') task.delegation.agent = value.delegation.agent;
|
|
93
|
-
if (typeof value.delegation.state === 'string') task.delegation.state = value.delegation.state;
|
|
94
|
-
}
|
|
95
|
-
return task;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function idList(value: unknown): number[] {
|
|
99
|
-
return Array.isArray(value) ? value.filter((id): id is number => typeof id === 'number') : [];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** Narrows the wire details; null when they are not a task result at all. */
|
|
103
|
-
export function taskDetailsView(details: unknown): TaskDetailsView | null {
|
|
104
|
-
if (!isRecord(details) || !isAction(details.action) || !Array.isArray(details.tasks)) return null;
|
|
105
|
-
const view: TaskDetailsView = {
|
|
106
|
-
action: details.action,
|
|
107
|
-
params: isRecord(details.params) ? details.params : {},
|
|
108
|
-
tasks: details.tasks.map(taskView).filter((task): task is TaskView => task !== null),
|
|
109
|
-
};
|
|
110
|
-
if (typeof details.error === 'string') view.error = details.error;
|
|
111
|
-
if (isRecord(details.upsert)) {
|
|
112
|
-
view.upsert = {
|
|
113
|
-
applied: idList(details.upsert.applied),
|
|
114
|
-
failed: typeof details.upsert.failed === 'number' ? details.upsert.failed : 0,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (isRecord(details.assignment)) {
|
|
118
|
-
view.assignment = {
|
|
119
|
-
assigned: idList(details.assignment.assigned),
|
|
120
|
-
failed: typeof details.assignment.failed === 'number' ? details.assignment.failed : 0,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
return view;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** `#id` for the wire's id, which the TUI would resolve to a subject through the store. */
|
|
127
|
-
function idLabel(value: unknown): string {
|
|
128
|
-
return typeof value === 'number' || typeof value === 'string' ? `#${value}` : '#?';
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** Keep dynamic content on one line. */
|
|
132
|
-
function inlineText(text: string): string {
|
|
133
|
-
return text.replace(INLINE_WHITESPACE, ' ').trim();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export type TaskCallTone = 'dim' | 'accent';
|
|
137
|
-
|
|
138
|
-
/** The call header: glyph, action, then the subject or a count, as renderTaskCall lays it out. */
|
|
139
|
-
export interface TaskCallView {
|
|
140
|
-
glyph: string;
|
|
141
|
-
action: string;
|
|
142
|
-
subject?: string;
|
|
143
|
-
subjectTone: TaskCallTone;
|
|
144
|
-
/** The assignee (`→ agent`) or the list filter. */
|
|
145
|
-
detail?: string;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function upsertGlyph(items: readonly Record<string, unknown>[]): string {
|
|
149
|
-
if (items.length === 0) return ACTION_GLYPH.upsert;
|
|
150
|
-
if (items.every((item) => item.id === undefined)) return UPSERT_CREATE_GLYPH;
|
|
151
|
-
if (items.every((item) => item.id !== undefined)) return UPSERT_UPDATE_GLYPH;
|
|
152
|
-
return ACTION_GLYPH.upsert;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* The TUI resolves an id to its subject through the task store; the card has
|
|
157
|
-
* no store and shows `#id` until the result names the task.
|
|
158
|
-
*/
|
|
159
|
-
export function taskCallView(args: Record<string, unknown>): TaskCallView {
|
|
160
|
-
const action = typeof args.action === 'string' ? args.action : 'task';
|
|
161
|
-
if (!isAction(action)) return { glyph: '?', action, subjectTone: 'dim' };
|
|
162
|
-
const items = action === 'upsert' && Array.isArray(args.tasks) ? args.tasks.filter(isRecord) : [];
|
|
163
|
-
const view: TaskCallView = {
|
|
164
|
-
glyph: action === 'upsert' ? upsertGlyph(items) : ACTION_GLYPH[action],
|
|
165
|
-
action,
|
|
166
|
-
subjectTone: 'dim',
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
if (action === 'upsert') {
|
|
170
|
-
// One entry reads exactly as create or update did; a batch reads as a count
|
|
171
|
-
// rather than a subject it would have to pick arbitrarily.
|
|
172
|
-
if (items.length === 1) {
|
|
173
|
-
const only = items[0] ?? {};
|
|
174
|
-
if (only.id === undefined) {
|
|
175
|
-
if (typeof only.subject === 'string') view.subject = inlineText(only.subject);
|
|
176
|
-
} else {
|
|
177
|
-
view.subject = typeof only.subject === 'string' ? inlineText(only.subject) : idLabel(only.id);
|
|
178
|
-
view.subjectTone = 'accent';
|
|
179
|
-
}
|
|
180
|
-
} else if (items.length > 1) {
|
|
181
|
-
view.subject = `${items.length} tasks`;
|
|
182
|
-
}
|
|
183
|
-
} else if (action === 'assign') {
|
|
184
|
-
const assignments = Array.isArray(args.assignments) ? args.assignments.filter(isRecord) : [];
|
|
185
|
-
if (assignments.length === 1) {
|
|
186
|
-
const only = assignments[0] ?? {};
|
|
187
|
-
view.subject = idLabel(only.id);
|
|
188
|
-
view.subjectTone = 'accent';
|
|
189
|
-
if (typeof only.agent === 'string') view.detail = `→ ${only.agent}`;
|
|
190
|
-
} else if (assignments.length > 1) {
|
|
191
|
-
view.subject = `${assignments.length} tasks`;
|
|
192
|
-
}
|
|
193
|
-
} else if ((action === 'get' || action === 'delete' || action === 'cancel') && args.id !== undefined) {
|
|
194
|
-
view.subject = idLabel(args.id);
|
|
195
|
-
view.subjectTone = 'accent';
|
|
196
|
-
} else if (action === 'list' && isStatus(args.status)) {
|
|
197
|
-
view.detail = STATUS_LABEL[args.status];
|
|
198
|
-
}
|
|
199
|
-
return view;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/** One row of the result: the task line on the left, its status flushed right. */
|
|
203
|
-
export interface TaskRow {
|
|
204
|
-
id: number;
|
|
205
|
-
glyph: string;
|
|
206
|
-
subject: string;
|
|
207
|
-
status: TaskStatus;
|
|
208
|
-
/** Struck through: the task is done with. */
|
|
209
|
-
closed: boolean;
|
|
210
|
-
agent?: string;
|
|
211
|
-
activeForm?: string;
|
|
212
|
-
blockedBy: number[];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export type TaskResultTone = 'running' | 'ok' | 'error' | 'warning';
|
|
216
|
-
|
|
217
|
-
export interface TaskResultView {
|
|
218
|
-
rows: TaskRow[];
|
|
219
|
-
/** Error text lines when the tool threw or the reducer reported an error. */
|
|
220
|
-
errorLines: string[];
|
|
221
|
-
status: { glyph: string; tone: TaskResultTone; text: string } | null;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export function taskRow(task: TaskView): TaskRow {
|
|
225
|
-
const row: TaskRow = {
|
|
226
|
-
id: task.id,
|
|
227
|
-
glyph: STATUS_GLYPH[task.status],
|
|
228
|
-
subject: inlineText(task.subject),
|
|
229
|
-
status: task.status,
|
|
230
|
-
closed: task.status === 'completed' || task.status === 'deleted',
|
|
231
|
-
blockedBy: task.blockedBy ?? [],
|
|
232
|
-
};
|
|
233
|
-
if (task.delegation?.agent) row.agent = inlineText(task.delegation.agent);
|
|
234
|
-
if (task.status === 'in_progress' && task.activeForm) row.activeForm = inlineText(task.activeForm);
|
|
235
|
-
return row;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function nonEmptyLines(text: string): string[] {
|
|
239
|
-
return text.split('\n').filter((line) => line.trim().length > 0);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* The rows `list` reported to the model: `details.tasks` is the whole
|
|
244
|
-
* document, so the call's filters apply again here or the card would disagree
|
|
245
|
-
* with the text the model was given.
|
|
246
|
-
*/
|
|
247
|
-
function listedTasks(details: TaskDetailsView): TaskView[] {
|
|
248
|
-
let view = details.tasks;
|
|
249
|
-
if (details.params.includeDeleted !== true) view = view.filter((task) => task.status !== 'deleted');
|
|
250
|
-
if (isStatus(details.params.status)) view = view.filter((task) => task.status === details.params.status);
|
|
251
|
-
return view;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function byIds(details: TaskDetailsView, ids: readonly number[]): TaskView[] {
|
|
255
|
-
return ids.flatMap((id) => details.tasks.find((task) => task.id === id) ?? []);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function batch(
|
|
259
|
-
tasks: readonly TaskView[],
|
|
260
|
-
failed: number,
|
|
261
|
-
verb: string,
|
|
262
|
-
expanded: boolean,
|
|
263
|
-
): Pick<TaskResultView, 'rows' | 'status'> {
|
|
264
|
-
// One applied task and nothing failed is the common case: keep the single
|
|
265
|
-
// row it has always had rather than dressing it as a bulk report.
|
|
266
|
-
if (tasks.length === 1 && failed === 0) return { rows: [taskRow(tasks[0] as TaskView)], status: null };
|
|
267
|
-
const shown = expanded ? tasks : tasks.slice(0, TRANSCRIPT_TASK_ROWS);
|
|
268
|
-
let summary = `${tasks.length} ${verb}`;
|
|
269
|
-
if (failed > 0) summary += ` · ${failed} failed`;
|
|
270
|
-
if (tasks.length > shown.length) summary += ` · ${tasks.length - shown.length} more`;
|
|
271
|
-
return {
|
|
272
|
-
rows: shown.map(taskRow),
|
|
273
|
-
status: { glyph: failed > 0 ? '!' : '✓', tone: failed > 0 ? 'warning' : 'ok', text: summary },
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export function taskResultView(input: {
|
|
278
|
-
details: unknown;
|
|
279
|
-
output: string;
|
|
280
|
-
expanded: boolean;
|
|
281
|
-
isPartial: boolean;
|
|
282
|
-
isError: boolean;
|
|
283
|
-
}): TaskResultView {
|
|
284
|
-
const details = taskDetailsView(input.details);
|
|
285
|
-
|
|
286
|
-
// Running. `assign` and `cancel` stream a placeholder before the run settles.
|
|
287
|
-
if (input.isPartial) {
|
|
288
|
-
const text = nonEmptyLines(input.output).at(-1) ?? 'working';
|
|
289
|
-
return { rows: [], errorLines: [], status: { glyph: '◐', tone: 'running', text } };
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// Failed. Every failure path throws, so Pi hands back error text and no
|
|
293
|
-
// details; without this the card would show a green tick on a failure.
|
|
294
|
-
if (input.isError || details?.error !== undefined) {
|
|
295
|
-
const all = nonEmptyLines(details?.error ?? input.output);
|
|
296
|
-
if (all.length <= 1) return { rows: [], errorLines: [], status: { glyph: '✗', tone: 'error', text: all[0] ?? '' } };
|
|
297
|
-
const errorLines = input.expanded ? all : all.slice(0, TRANSCRIPT_TASK_ROWS);
|
|
298
|
-
return { rows: [], errorLines, status: { glyph: '✗', tone: 'error', text: '' } };
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (details === null) return { rows: [], errorLines: [], status: { glyph: '✓', tone: 'ok', text: '' } };
|
|
302
|
-
|
|
303
|
-
if (details.action === 'list') {
|
|
304
|
-
const tasks = listedTasks(details);
|
|
305
|
-
const shown = input.expanded ? tasks : tasks.slice(0, TRANSCRIPT_TASK_ROWS);
|
|
306
|
-
let summary = tasks.length === 0 ? 'no tasks' : `${tasks.length} task${tasks.length === 1 ? '' : 's'}`;
|
|
307
|
-
if (tasks.length > shown.length) summary += ` · ${tasks.length - shown.length} more`;
|
|
308
|
-
return { rows: shown.map(taskRow), errorLines: [], status: { glyph: '✓', tone: 'ok', text: summary } };
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (details.action === 'clear') {
|
|
312
|
-
return { rows: [], errorLines: [], status: { glyph: '✓', tone: 'ok', text: 'cleared' } };
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (details.action === 'assign' && details.assignment) {
|
|
316
|
-
const assigned = byIds(details, details.assignment.assigned);
|
|
317
|
-
return { errorLines: [], ...batch(assigned, details.assignment.failed, 'assigned', input.expanded) };
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (details.action === 'upsert') {
|
|
321
|
-
const touched = byIds(details, details.upsert?.applied ?? []);
|
|
322
|
-
return { errorLines: [], ...batch(touched, details.upsert?.failed ?? 0, 'applied', input.expanded) };
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// The single task an id-bearing action acted on, so the card names it rather than a bare tick.
|
|
326
|
-
const id = details.params.id;
|
|
327
|
-
const task = typeof id === 'number' ? details.tasks.find((candidate) => candidate.id === id) : undefined;
|
|
328
|
-
if (!task) return { rows: [], errorLines: [], status: { glyph: '✓', tone: 'ok', text: '' } };
|
|
329
|
-
return { rows: [taskRow(task)], errorLines: [], status: null };
|
|
330
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { defineSessionStore, type SessionFrameSender } from '@agimon-ai/doompi-core/web';
|
|
2
|
-
|
|
3
|
-
import { TASKS_CHANNEL_TYPE, type WebTask, type WebTasksPayload } from '../../types/webTasks';
|
|
4
|
-
|
|
5
|
-
export interface TasksSession {
|
|
6
|
-
tasks: WebTask[];
|
|
7
|
-
rev: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const tasks = defineSessionStore<TasksSession>({ tasks: [], rev: 0 });
|
|
11
|
-
|
|
12
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
13
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function parseTask(value: unknown): WebTask | null {
|
|
17
|
-
if (!isRecord(value) || typeof value.id !== 'number' || typeof value.subject !== 'string') return null;
|
|
18
|
-
if (!['pending', 'in_progress', 'completed', 'failed'].includes(String(value.status))) return null;
|
|
19
|
-
const task: WebTask = {
|
|
20
|
-
id: value.id,
|
|
21
|
-
subject: value.subject,
|
|
22
|
-
status: value.status as WebTask['status'],
|
|
23
|
-
blockedBy: Array.isArray(value.blockedBy)
|
|
24
|
-
? value.blockedBy.filter((id): id is number => typeof id === 'number')
|
|
25
|
-
: [],
|
|
26
|
-
};
|
|
27
|
-
if (typeof value.description === 'string') task.description = value.description;
|
|
28
|
-
if (typeof value.activeForm === 'string') task.activeForm = value.activeForm;
|
|
29
|
-
if (typeof value.owner === 'string') task.owner = value.owner;
|
|
30
|
-
if (typeof value.updatedAt === 'string') task.updatedAt = value.updatedAt;
|
|
31
|
-
if (isRecord(value.delegation)) {
|
|
32
|
-
task.delegation = {};
|
|
33
|
-
if (typeof value.delegation.agent === 'string') task.delegation.agent = value.delegation.agent;
|
|
34
|
-
if (typeof value.delegation.state === 'string') task.delegation.state = value.delegation.state;
|
|
35
|
-
}
|
|
36
|
-
return task;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const tasksChannel = tasks.channel<WebTasksPayload>({
|
|
40
|
-
channel: TASKS_CHANNEL_TYPE,
|
|
41
|
-
parse(input) {
|
|
42
|
-
if (!isRecord(input) || !Array.isArray(input.tasks) || typeof input.rev !== 'number') return null;
|
|
43
|
-
return { tasks: input.tasks.map(parseTask).filter((task): task is WebTask => task !== null), rev: input.rev };
|
|
44
|
-
},
|
|
45
|
-
reduce: (_current, payload) => payload,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
/** The fields the cockpit lets a human change on a task. */
|
|
49
|
-
export interface TaskEditDraft {
|
|
50
|
-
subject: string;
|
|
51
|
-
description: string;
|
|
52
|
-
status: WebTask['status'];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function taskEditDraft(task: WebTask): TaskEditDraft {
|
|
56
|
-
return { subject: task.subject, description: task.description ?? '', status: task.status };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function changedFields(task: WebTask, draft: TaskEditDraft): string[] {
|
|
60
|
-
const changes: string[] = [];
|
|
61
|
-
const subject = draft.subject.trim();
|
|
62
|
-
const description = draft.description.trim();
|
|
63
|
-
if (subject && subject !== task.subject) changes.push(`set subject to "${subject}"`);
|
|
64
|
-
if (description !== (task.description ?? '').trim()) {
|
|
65
|
-
changes.push(description ? `set description to "${description}"` : 'clear the description');
|
|
66
|
-
}
|
|
67
|
-
if (draft.status !== task.status) changes.push(`set status to ${draft.status}`);
|
|
68
|
-
return changes;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The agent stays the only writer of task state, so an edit leaves the cockpit
|
|
73
|
-
* as one prompt naming exactly the fields the human changed. Nothing changed
|
|
74
|
-
* means nothing to send.
|
|
75
|
-
*/
|
|
76
|
-
export function taskEditInstruction(task: WebTask, draft: TaskEditDraft): string | null {
|
|
77
|
-
const changes = changedFields(task, draft);
|
|
78
|
-
if (changes.length === 0) return null;
|
|
79
|
-
return `Update task #${task.id}: ${changes.join('; ')}. Change nothing else and keep the dependency graph valid.`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function requestTaskEdit(
|
|
83
|
-
send: SessionFrameSender,
|
|
84
|
-
sessionId: string,
|
|
85
|
-
task: WebTask,
|
|
86
|
-
draft: TaskEditDraft,
|
|
87
|
-
): boolean {
|
|
88
|
-
const message = taskEditInstruction(task, draft);
|
|
89
|
-
if (message === null) return false;
|
|
90
|
-
send(sessionId, { type: 'prompt', message });
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** Steering for the subagent that owns a delegated task. */
|
|
95
|
-
export function taskMessageInstruction(taskId: number, agent: string, message: string): string {
|
|
96
|
-
return `Steer the ${agent} run working on task #${taskId} with this message, then update the task if its plan changed: ${message.trim()}`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function requestTaskMessage(
|
|
100
|
-
send: SessionFrameSender,
|
|
101
|
-
sessionId: string,
|
|
102
|
-
taskId: number,
|
|
103
|
-
agent: string,
|
|
104
|
-
message: string,
|
|
105
|
-
): void {
|
|
106
|
-
send(sessionId, { type: 'prompt', message: taskMessageInstruction(taskId, agent, message) });
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function requestTaskRemoval(send: SessionFrameSender, sessionId: string, taskId: number): void {
|
|
110
|
-
send(sessionId, {
|
|
111
|
-
type: 'prompt',
|
|
112
|
-
message: `Remove task #${taskId}. Also remove or repair every dependency that references it so the remaining task graph is valid.`,
|
|
113
|
-
});
|
|
114
|
-
}
|
package/src/web/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"moduleResolution": "Bundler",
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"noImplicitAny": true,
|
|
10
|
-
"noUnusedLocals": true,
|
|
11
|
-
"noUnusedParameters": true,
|
|
12
|
-
"noImplicitReturns": true,
|
|
13
|
-
"noFallthroughCasesInSwitch": true,
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"esModuleInterop": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
|
-
"allowImportingTsExtensions": true,
|
|
19
|
-
"forceConsistentCasingInFileNames": true,
|
|
20
|
-
"types": ["node"]
|
|
21
|
-
},
|
|
22
|
-
"include": [".", "../types", "../extensions/web.ts"]
|
|
23
|
-
}
|