@pixelbyte-software/pixcode 1.33.11 → 1.35.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.
Files changed (164) hide show
  1. package/dist/api-docs.html +162 -9
  2. package/dist/assets/index-B8w57E1r.css +32 -0
  3. package/dist/assets/index-Djuh0wHV.js +854 -0
  4. package/dist/favicon.svg +8 -8
  5. package/dist/icons/icon-128x128.svg +9 -9
  6. package/dist/icons/icon-144x144.svg +9 -9
  7. package/dist/icons/icon-152x152.svg +9 -9
  8. package/dist/icons/icon-192x192.svg +9 -9
  9. package/dist/icons/icon-384x384.svg +9 -9
  10. package/dist/icons/icon-512x512.svg +9 -9
  11. package/dist/icons/icon-72x72.svg +9 -9
  12. package/dist/icons/icon-96x96.svg +9 -9
  13. package/dist/icons/icon-template.svg +9 -9
  14. package/dist/index.html +2 -2
  15. package/dist/logo.svg +12 -12
  16. package/dist/openapi.yaml +383 -1
  17. package/dist-server/server/claude-sdk.js +38 -7
  18. package/dist-server/server/claude-sdk.js.map +1 -1
  19. package/dist-server/server/cli.js +12 -17
  20. package/dist-server/server/cli.js.map +1 -1
  21. package/dist-server/server/daemon-manager.js +98 -51
  22. package/dist-server/server/daemon-manager.js.map +1 -1
  23. package/dist-server/server/database/json-store.js +8 -5
  24. package/dist-server/server/database/json-store.js.map +1 -1
  25. package/dist-server/server/index.js +34 -9
  26. package/dist-server/server/index.js.map +1 -1
  27. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js +73 -0
  28. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js.map +1 -0
  29. package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js +17 -0
  30. package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js.map +1 -0
  31. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js +234 -0
  32. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js.map +1 -0
  33. package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js +202 -0
  34. package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js.map +1 -0
  35. package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js +205 -0
  36. package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js.map +1 -0
  37. package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js +205 -0
  38. package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js.map +1 -0
  39. package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js +205 -0
  40. package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js.map +1 -0
  41. package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js +205 -0
  42. package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js.map +1 -0
  43. package/dist-server/server/modules/orchestration/a2a/agent-card.js +50 -0
  44. package/dist-server/server/modules/orchestration/a2a/agent-card.js.map +1 -0
  45. package/dist-server/server/modules/orchestration/a2a/auth.middleware.js +25 -0
  46. package/dist-server/server/modules/orchestration/a2a/auth.middleware.js.map +1 -0
  47. package/dist-server/server/modules/orchestration/a2a/bus.js +34 -0
  48. package/dist-server/server/modules/orchestration/a2a/bus.js.map +1 -0
  49. package/dist-server/server/modules/orchestration/a2a/routes.js +497 -0
  50. package/dist-server/server/modules/orchestration/a2a/routes.js.map +1 -0
  51. package/dist-server/server/modules/orchestration/a2a/task-store.js +144 -0
  52. package/dist-server/server/modules/orchestration/a2a/task-store.js.map +1 -0
  53. package/dist-server/server/modules/orchestration/a2a/types.js +6 -0
  54. package/dist-server/server/modules/orchestration/a2a/types.js.map +1 -0
  55. package/dist-server/server/modules/orchestration/a2a/validator.js +101 -0
  56. package/dist-server/server/modules/orchestration/a2a/validator.js.map +1 -0
  57. package/dist-server/server/modules/orchestration/index.js +24 -0
  58. package/dist-server/server/modules/orchestration/index.js.map +1 -0
  59. package/dist-server/server/modules/orchestration/preview/port-watcher.js +90 -0
  60. package/dist-server/server/modules/orchestration/preview/port-watcher.js.map +1 -0
  61. package/dist-server/server/modules/orchestration/preview/preview-proxy.js +58 -0
  62. package/dist-server/server/modules/orchestration/preview/preview-proxy.js.map +1 -0
  63. package/dist-server/server/modules/orchestration/preview/types.js +2 -0
  64. package/dist-server/server/modules/orchestration/preview/types.js.map +1 -0
  65. package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js +37 -0
  66. package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js.map +1 -0
  67. package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js +68 -0
  68. package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js.map +1 -0
  69. package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js +128 -0
  70. package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js.map +1 -0
  71. package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js +2 -0
  72. package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js.map +1 -0
  73. package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js +126 -0
  74. package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js.map +1 -0
  75. package/dist-server/server/modules/orchestration/workflows/workflow-runner.js +1047 -0
  76. package/dist-server/server/modules/orchestration/workflows/workflow-runner.js.map +1 -0
  77. package/dist-server/server/modules/orchestration/workflows/workflow-store.js +76 -0
  78. package/dist-server/server/modules/orchestration/workflows/workflow-store.js.map +1 -0
  79. package/dist-server/server/modules/orchestration/workflows/workflow.routes.js +151 -0
  80. package/dist-server/server/modules/orchestration/workflows/workflow.routes.js.map +1 -0
  81. package/dist-server/server/modules/orchestration/workflows/workflow.types.js +2 -0
  82. package/dist-server/server/modules/orchestration/workflows/workflow.types.js.map +1 -0
  83. package/dist-server/server/modules/orchestration/workflows/workspace-target.js +98 -0
  84. package/dist-server/server/modules/orchestration/workflows/workspace-target.js.map +1 -0
  85. package/dist-server/server/modules/orchestration/workspace/docker-workspace.js +122 -0
  86. package/dist-server/server/modules/orchestration/workspace/docker-workspace.js.map +1 -0
  87. package/dist-server/server/modules/orchestration/workspace/path-safety.js +48 -0
  88. package/dist-server/server/modules/orchestration/workspace/path-safety.js.map +1 -0
  89. package/dist-server/server/modules/orchestration/workspace/types.js +11 -0
  90. package/dist-server/server/modules/orchestration/workspace/types.js.map +1 -0
  91. package/dist-server/server/modules/orchestration/workspace/workspace-manager.js +80 -0
  92. package/dist-server/server/modules/orchestration/workspace/workspace-manager.js.map +1 -0
  93. package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js +96 -0
  94. package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js.map +1 -0
  95. package/dist-server/server/modules/providers/index.js +3 -0
  96. package/dist-server/server/modules/providers/index.js.map +1 -0
  97. package/dist-server/server/openai-codex.js +35 -4
  98. package/dist-server/server/openai-codex.js.map +1 -1
  99. package/dist-server/server/routes/taskmaster.js +106 -89
  100. package/dist-server/server/routes/taskmaster.js.map +1 -1
  101. package/package.json +3 -1
  102. package/scripts/smoke/a2a-roundtrip.mjs +167 -0
  103. package/scripts/smoke/orchestration-api.mjs +172 -0
  104. package/scripts/smoke/orchestration-live-run.mjs +176 -0
  105. package/server/claude-sdk.js +48 -7
  106. package/server/cli.js +12 -17
  107. package/server/daemon-manager.js +90 -51
  108. package/server/database/db.js +794 -794
  109. package/server/database/json-store.js +8 -5
  110. package/server/index.js +49 -9
  111. package/server/modules/orchestration/a2a/adapter-registry.ts +108 -0
  112. package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +55 -0
  113. package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +284 -0
  114. package/server/modules/orchestration/a2a/adapters/codex.adapter.ts +244 -0
  115. package/server/modules/orchestration/a2a/adapters/cursor.adapter.ts +249 -0
  116. package/server/modules/orchestration/a2a/adapters/gemini.adapter.ts +248 -0
  117. package/server/modules/orchestration/a2a/adapters/opencode.adapter.ts +248 -0
  118. package/server/modules/orchestration/a2a/adapters/qwen.adapter.ts +248 -0
  119. package/server/modules/orchestration/a2a/agent-card.ts +55 -0
  120. package/server/modules/orchestration/a2a/auth.middleware.ts +29 -0
  121. package/server/modules/orchestration/a2a/bus.ts +46 -0
  122. package/server/modules/orchestration/a2a/routes.ts +577 -0
  123. package/server/modules/orchestration/a2a/task-store.ts +178 -0
  124. package/server/modules/orchestration/a2a/types.ts +125 -0
  125. package/server/modules/orchestration/a2a/validator.ts +113 -0
  126. package/server/modules/orchestration/index.ts +66 -0
  127. package/server/modules/orchestration/preview/port-watcher.ts +112 -0
  128. package/server/modules/orchestration/preview/preview-proxy.ts +60 -0
  129. package/server/modules/orchestration/preview/types.ts +19 -0
  130. package/server/modules/orchestration/tasks/orchestration-task-store.ts +45 -0
  131. package/server/modules/orchestration/tasks/orchestration-task.routes.ts +73 -0
  132. package/server/modules/orchestration/tasks/orchestration-task.service.ts +145 -0
  133. package/server/modules/orchestration/tasks/orchestration-task.types.ts +29 -0
  134. package/server/modules/orchestration/workflows/built-in-workflows.ts +127 -0
  135. package/server/modules/orchestration/workflows/workflow-runner.ts +1206 -0
  136. package/server/modules/orchestration/workflows/workflow-store.ts +97 -0
  137. package/server/modules/orchestration/workflows/workflow.routes.ts +169 -0
  138. package/server/modules/orchestration/workflows/workflow.types.ts +70 -0
  139. package/server/modules/orchestration/workflows/workspace-target.ts +120 -0
  140. package/server/modules/orchestration/workspace/docker-workspace.ts +135 -0
  141. package/server/modules/orchestration/workspace/path-safety.ts +55 -0
  142. package/server/modules/orchestration/workspace/types.ts +52 -0
  143. package/server/modules/orchestration/workspace/workspace-manager.ts +97 -0
  144. package/server/modules/orchestration/workspace/worktree-workspace.ts +125 -0
  145. package/server/modules/providers/index.ts +2 -0
  146. package/server/modules/providers/list/opencode/opencode-auth.provider.ts +130 -130
  147. package/server/modules/providers/list/opencode/opencode-mcp.provider.ts +126 -126
  148. package/server/modules/providers/list/opencode/opencode.provider.ts +29 -29
  149. package/server/modules/providers/list/qwen/qwen-auth.provider.ts +145 -145
  150. package/server/modules/providers/list/qwen/qwen-mcp.provider.ts +114 -114
  151. package/server/modules/providers/list/qwen/qwen.provider.ts +21 -21
  152. package/server/modules/providers/shared/provider-configs.ts +142 -142
  153. package/server/openai-codex.js +40 -4
  154. package/server/qwen-code-cli.js +395 -395
  155. package/server/qwen-response-handler.js +73 -73
  156. package/server/routes/qwen.js +27 -27
  157. package/server/routes/taskmaster.js +116 -91
  158. package/server/services/external-access.js +171 -171
  159. package/server/services/provider-models.js +381 -381
  160. package/server/services/telegram/telegram-http-client.js +130 -130
  161. package/server/services/vapid-keys.js +36 -36
  162. package/server/utils/port-access.js +209 -209
  163. package/dist/assets/index-B1ghfb4w.css +0 -32
  164. package/dist/assets/index-oLYHJ2X5.js +0 -852
@@ -0,0 +1,45 @@
1
+ import path from 'node:path';
2
+ import os from 'node:os';
3
+
4
+ import { JsonStore } from '@/database/json-store.js';
5
+ import type { OrchestrationTask } from '@/modules/orchestration/tasks/orchestration-task.types.js';
6
+
7
+ function defaultPath(): string {
8
+ return process.env.ORCHESTRATION_TASKS_PATH ??
9
+ path.join(os.homedir(), '.pixcode', 'orchestration-tasks.json');
10
+ }
11
+
12
+ export class OrchestrationTaskStore {
13
+ private store: JsonStore;
14
+
15
+ constructor(filePath = defaultPath()) {
16
+ this.store = new JsonStore(filePath, { orchestration_tasks: [] });
17
+ }
18
+
19
+ get(id: string): OrchestrationTask | undefined {
20
+ return this.store.findWhere('orchestration_tasks', (r: OrchestrationTask) => r.id === id) ?? undefined;
21
+ }
22
+
23
+ getByA2ATaskId(a2aTaskId: string): OrchestrationTask | undefined {
24
+ return this.store.findWhere('orchestration_tasks', (r: OrchestrationTask) => r.a2aTaskId === a2aTaskId) ?? undefined;
25
+ }
26
+
27
+ getByTaskMasterId(taskmasterId: string): OrchestrationTask | undefined {
28
+ return this.store.findWhere('orchestration_tasks', (r: OrchestrationTask) => r.taskmasterId === taskmasterId) ?? undefined;
29
+ }
30
+
31
+ list(projectId?: string): OrchestrationTask[] {
32
+ const tasks = this.store.filterWhere('orchestration_tasks', () => true) as OrchestrationTask[];
33
+ const sorted = tasks.sort((a, b) => b.createdAt - a.createdAt);
34
+ return projectId ? sorted.filter((task) => task.projectId === projectId) : sorted;
35
+ }
36
+
37
+ set(task: OrchestrationTask): void {
38
+ const existing = this.store.findWhere('orchestration_tasks', (r: OrchestrationTask) => r.id === task.id);
39
+ if (existing) {
40
+ this.store.updateWhere('orchestration_tasks', (r: OrchestrationTask) => r.id === task.id, task);
41
+ } else {
42
+ this.store.insert('orchestration_tasks', task, { autoId: false });
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,73 @@
1
+ import express, { type Router } from 'express';
2
+ import { orchestrationTaskService } from '@/modules/orchestration/tasks/orchestration-task.service.js';
3
+
4
+ export function createOrchestrationTaskRouter(): Router {
5
+ const router = express.Router();
6
+ router.use(express.json({ limit: '2mb' }));
7
+
8
+ router.get('/tasks', (req, res) => {
9
+ const projectId = typeof req.query.projectId === 'string' ? req.query.projectId : undefined;
10
+ res.json({ tasks: orchestrationTaskService.list(projectId) });
11
+ });
12
+
13
+ router.post('/tasks', (req, res) => {
14
+ const projectId = typeof req.body?.projectId === 'string' ? req.body.projectId : 'default';
15
+ const title = typeof req.body?.title === 'string' ? req.body.title.trim() : '';
16
+ const description = typeof req.body?.description === 'string' ? req.body.description : undefined;
17
+ const taskmasterId = typeof req.body?.taskmasterId === 'string' ? req.body.taskmasterId : undefined;
18
+
19
+ if (!title) {
20
+ res.status(400).json({ error: { code: 'TITLE_REQUIRED', message: 'title is required' } });
21
+ return;
22
+ }
23
+
24
+ const task = orchestrationTaskService.create({ projectId, title, description, taskmasterId });
25
+ res.status(201).json(task);
26
+ });
27
+
28
+ router.post('/tasks/import-taskmaster', (req, res) => {
29
+ const projectId = typeof req.body?.projectId === 'string' ? req.body.projectId : 'default';
30
+ const entries = Array.isArray(req.body?.tasks) ? req.body.tasks : [];
31
+ const imported = entries
32
+ .map((entry: unknown) => {
33
+ if (!entry || typeof entry !== 'object') return null;
34
+ const record = entry as Record<string, unknown>;
35
+ const taskmasterId = typeof record.id === 'string' ? record.id : undefined;
36
+ const title = typeof record.title === 'string' ? record.title : undefined;
37
+ const description = typeof record.description === 'string' ? record.description : undefined;
38
+ if (!taskmasterId || !title) return null;
39
+ return orchestrationTaskService.upsertFromTaskMaster({ projectId, title, description, taskmasterId });
40
+ })
41
+ .filter(Boolean);
42
+
43
+ res.json({ tasks: imported, count: imported.length });
44
+ });
45
+
46
+ router.post('/tasks/:id/dispatch', async (req, res) => {
47
+ try {
48
+ const adapterId = typeof req.body?.adapterId === 'string' ? req.body.adapterId : '';
49
+ const isolation = req.body?.isolation;
50
+ if (!adapterId) {
51
+ res.status(400).json({ error: { code: 'ADAPTER_REQUIRED', message: 'adapterId is required' } });
52
+ return;
53
+ }
54
+ const task = await orchestrationTaskService.dispatch(req.params.id, { adapterId, isolation });
55
+ res.json(task);
56
+ } catch (error) {
57
+ const message = error instanceof Error ? error.message : String(error);
58
+ const status = message === 'TASK_NOT_FOUND' ? 404 : 400;
59
+ res.status(status).json({ error: { code: 'DISPATCH_FAILED', message } });
60
+ }
61
+ });
62
+
63
+ router.post('/tasks/:id/cancel', (req, res) => {
64
+ try {
65
+ const task = orchestrationTaskService.cancel(req.params.id);
66
+ res.json(task);
67
+ } catch {
68
+ res.status(404).json({ error: { code: 'TASK_NOT_FOUND', message: req.params.id } });
69
+ }
70
+ });
71
+
72
+ return router;
73
+ }
@@ -0,0 +1,145 @@
1
+ import { OrchestrationTaskStore } from '@/modules/orchestration/tasks/orchestration-task-store.js';
2
+ import type { CreateOrchestrationTaskInput, DispatchOrchestrationTaskInput, OrchestrationTask } from '@/modules/orchestration/tasks/orchestration-task.types.js';
3
+ import { a2aBus } from '@/modules/orchestration/a2a/bus.js';
4
+ import type { TaskState } from '@/modules/orchestration/a2a/types.js';
5
+
6
+ function newId(prefix: string): string {
7
+ return `${prefix}_${Math.random().toString(36).slice(2, 10)}`;
8
+ }
9
+
10
+ const TERMINAL_A2A_STATES: TaskState[] = ['completed', 'canceled', 'failed'];
11
+
12
+ class OrchestrationTaskService {
13
+ private store: OrchestrationTaskStore;
14
+
15
+ constructor(store?: OrchestrationTaskStore) {
16
+ this.store = store ?? new OrchestrationTaskStore();
17
+ this.watchA2ATerminalStates();
18
+ }
19
+
20
+ list(projectId?: string): OrchestrationTask[] {
21
+ return this.store.list(projectId);
22
+ }
23
+
24
+ get(id: string): OrchestrationTask | undefined {
25
+ return this.store.get(id);
26
+ }
27
+
28
+ create(input: CreateOrchestrationTaskInput): OrchestrationTask {
29
+ const now = Date.now();
30
+ const task: OrchestrationTask = {
31
+ id: newId('otask'),
32
+ projectId: input.projectId,
33
+ title: input.title,
34
+ description: input.description,
35
+ taskmasterId: input.taskmasterId,
36
+ state: 'todo',
37
+ createdAt: now,
38
+ updatedAt: now,
39
+ };
40
+ this.store.set(task);
41
+ return task;
42
+ }
43
+
44
+ upsertFromTaskMaster(input: CreateOrchestrationTaskInput): OrchestrationTask {
45
+ const existing = this.store.list(input.projectId).find((task) =>
46
+ task.taskmasterId === input.taskmasterId,
47
+ );
48
+ if (existing) {
49
+ existing.title = input.title;
50
+ existing.description = input.description;
51
+ existing.updatedAt = Date.now();
52
+ this.store.set(existing);
53
+ return existing;
54
+ }
55
+ return this.create(input);
56
+ }
57
+
58
+ async dispatch(taskId: string, input: DispatchOrchestrationTaskInput): Promise<OrchestrationTask> {
59
+ const task = this.store.get(taskId);
60
+ if (!task) throw new Error('TASK_NOT_FOUND');
61
+
62
+ const a2aResponse = await fetch(`http://127.0.0.1:${process.env.SERVER_PORT ?? '3001'}/a2a/tasks`, {
63
+ method: 'POST',
64
+ headers: { 'Content-Type': 'application/json' },
65
+ body: JSON.stringify({
66
+ adapterId: input.adapterId,
67
+ message: {
68
+ messageId: newId('msg'),
69
+ role: 'user',
70
+ parts: [{ kind: 'text', text: `${task.title}\n\n${task.description ?? ''}` }],
71
+ },
72
+ metadata: {
73
+ isolation: input.isolation ?? 'worktree',
74
+ orchestrationTaskId: task.id,
75
+ taskmasterId: task.taskmasterId,
76
+ },
77
+ }),
78
+ });
79
+
80
+ const body = await a2aResponse.json().catch(() => null) as { id?: string; error?: { message?: string } } | null;
81
+ if (!a2aResponse.ok || typeof body?.id !== 'string') {
82
+ throw new Error(body?.error?.message ?? 'DISPATCH_FAILED');
83
+ }
84
+
85
+ task.a2aTaskId = body.id;
86
+ task.adapterId = input.adapterId;
87
+ task.adapterSelector = input.adapterId;
88
+ task.workspaceKind = input.isolation ?? 'worktree';
89
+ task.state = 'in_progress';
90
+ task.updatedAt = Date.now();
91
+ this.store.set(task);
92
+ return task;
93
+ }
94
+
95
+ updateState(taskId: string, state: OrchestrationTask['state']): OrchestrationTask | undefined {
96
+ const task = this.store.get(taskId);
97
+ if (!task) return undefined;
98
+ task.state = state;
99
+ task.updatedAt = Date.now();
100
+ this.store.set(task);
101
+ return task;
102
+ }
103
+
104
+ private watchA2ATerminalStates(): void {
105
+ a2aBus.subscribeAll((event) => {
106
+ if (event.kind !== 'task-state') return;
107
+ if (!TERMINAL_A2A_STATES.includes(event.state)) return;
108
+
109
+ const orchTask = this.store.getByA2ATaskId(event.taskId);
110
+ if (!orchTask) return;
111
+ if (orchTask.state === 'done' || orchTask.state === 'failed' || orchTask.state === 'canceled') return;
112
+
113
+ const mapped = event.state === 'completed' ? 'done'
114
+ : event.state === 'failed' ? 'failed'
115
+ : 'canceled';
116
+
117
+ orchTask.state = mapped;
118
+ orchTask.updatedAt = Date.now();
119
+ this.store.set(orchTask);
120
+
121
+ if (orchTask.taskmasterId && mapped === 'done') {
122
+ this.syncTaskMasterStatus(orchTask.taskmasterId, 'done');
123
+ }
124
+ });
125
+ }
126
+
127
+ private syncTaskMasterStatus(taskmasterId: string, status: string): void {
128
+ const { spawn } = require('node:child_process') as typeof import('node:child_process');
129
+ spawn('task-master', ['set-status', '--id', taskmasterId, '--status', status], {
130
+ stdio: 'ignore',
131
+ detached: true,
132
+ }).unref();
133
+ }
134
+
135
+ cancel(taskId: string): OrchestrationTask {
136
+ const task = this.store.get(taskId);
137
+ if (!task) throw new Error('TASK_NOT_FOUND');
138
+ task.state = 'canceled';
139
+ task.updatedAt = Date.now();
140
+ this.store.set(task);
141
+ return task;
142
+ }
143
+ }
144
+
145
+ export const orchestrationTaskService = new OrchestrationTaskService();
@@ -0,0 +1,29 @@
1
+ export type OrchestrationTaskState = 'todo' | 'in_progress' | 'in_review' | 'done' | 'failed' | 'canceled';
2
+
3
+ export interface OrchestrationTask {
4
+ id: string;
5
+ a2aTaskId?: string;
6
+ taskmasterId?: string;
7
+ projectId: string;
8
+ title: string;
9
+ description?: string;
10
+ state: OrchestrationTaskState;
11
+ adapterId?: string;
12
+ adapterSelector?: string;
13
+ workspaceKind?: 'host' | 'worktree' | 'docker';
14
+ workspacePath?: string;
15
+ createdAt: number;
16
+ updatedAt: number;
17
+ }
18
+
19
+ export interface CreateOrchestrationTaskInput {
20
+ projectId: string;
21
+ title: string;
22
+ description?: string;
23
+ taskmasterId?: string;
24
+ }
25
+
26
+ export interface DispatchOrchestrationTaskInput {
27
+ adapterId: string;
28
+ isolation?: 'host' | 'worktree' | 'docker';
29
+ }
@@ -0,0 +1,127 @@
1
+ import type { Workflow } from '@/modules/orchestration/workflows/workflow.types.js';
2
+
3
+ export const builtInWorkflows: Workflow[] = [
4
+ {
5
+ id: 'agent_team',
6
+ name: 'Agent team',
7
+ description: 'A coordinator reads the goal and active CLI instances, assigns work, then collects the result.',
8
+ trigger: 'manual',
9
+ isBuiltin: true,
10
+ nodes: [],
11
+ },
12
+ {
13
+ id: 'multi_model_review',
14
+ name: 'Multi-model review',
15
+ description: 'Enabled CLI agents review the same goal separately, then one enabled agent aggregates the result.',
16
+ trigger: 'manual',
17
+ isBuiltin: true,
18
+ nodes: [
19
+ {
20
+ id: 'codex_review',
21
+ adapterId: 'codex',
22
+ prompt: 'Review the requested change for edge cases, regressions, and missing validation. Respond in the same language as the user request.',
23
+ inputs: [],
24
+ output: 'both',
25
+ onFail: 'continue',
26
+ },
27
+ {
28
+ id: 'gemini_review',
29
+ adapterId: 'gemini',
30
+ prompt: 'Review the requested change for security, scale, and user-experience risks. Respond in the same language as the user request.',
31
+ inputs: [],
32
+ output: 'both',
33
+ onFail: 'continue',
34
+ },
35
+ {
36
+ id: 'claude_review',
37
+ adapterId: 'claude-code',
38
+ prompt: 'Review the requested change for architecture and maintainability. Respond in the same language as the user request.',
39
+ inputs: [],
40
+ output: 'both',
41
+ onFail: 'continue',
42
+ },
43
+ {
44
+ id: 'aggregate',
45
+ adapterId: 'claude-code',
46
+ prompt: 'Aggregate the prior reviews into a concise prioritized report. Respond in the same language as the user request.',
47
+ inputs: ['codex_review', 'gemini_review', 'claude_review'],
48
+ output: 'message',
49
+ onFail: 'abort',
50
+ },
51
+ ],
52
+ },
53
+ {
54
+ id: 'sequential_handoff',
55
+ name: 'Sequential handoff',
56
+ description: 'Agents plan, implement, and review in order. Disabled CLI steps are skipped.',
57
+ trigger: 'manual',
58
+ isBuiltin: true,
59
+ nodes: [
60
+ {
61
+ id: 'architect',
62
+ adapterId: 'claude-code',
63
+ prompt: 'Create a concise, actionable implementation plan for the requested change. Respond in the same language as the user request.',
64
+ inputs: [],
65
+ output: 'message',
66
+ onFail: 'abort',
67
+ },
68
+ {
69
+ id: 'implement',
70
+ adapterId: 'codex',
71
+ prompt: 'Implement the requested change using the plan from the previous step. Summarize progress in the same language as the user request.',
72
+ inputs: ['architect'],
73
+ output: 'both',
74
+ onFail: 'abort',
75
+ },
76
+ {
77
+ id: 'review',
78
+ adapterId: 'gemini',
79
+ prompt: 'Review the implementation and call out any remaining issues. Respond in the same language as the user request.',
80
+ inputs: ['implement'],
81
+ output: 'message',
82
+ onFail: 'continue',
83
+ },
84
+ ],
85
+ },
86
+ {
87
+ id: 'adversarial_debate',
88
+ name: 'Decision debate',
89
+ description: 'Agents propose, critique, respond, and produce a final recommendation.',
90
+ trigger: 'manual',
91
+ isBuiltin: true,
92
+ nodes: [
93
+ {
94
+ id: 'proposal',
95
+ adapterId: 'claude-code',
96
+ prompt: 'Propose the best solution for the requested change. Respond in the same language as the user request.',
97
+ inputs: [],
98
+ output: 'message',
99
+ onFail: 'abort',
100
+ },
101
+ {
102
+ id: 'critique',
103
+ adapterId: 'codex',
104
+ prompt: 'Critique the proposal and offer a concrete alternative. Respond in the same language as the user request.',
105
+ inputs: ['proposal'],
106
+ output: 'message',
107
+ onFail: 'abort',
108
+ },
109
+ {
110
+ id: 'response',
111
+ adapterId: 'claude-code',
112
+ prompt: 'Respond to the critique and revise the approach if needed. Respond in the same language as the user request.',
113
+ inputs: ['critique'],
114
+ output: 'message',
115
+ onFail: 'abort',
116
+ },
117
+ {
118
+ id: 'judge',
119
+ adapterId: 'gemini',
120
+ prompt: 'Judge the debate and produce a final recommendation. Respond in the same language as the user request.',
121
+ inputs: ['response'],
122
+ output: 'message',
123
+ onFail: 'abort',
124
+ },
125
+ ],
126
+ },
127
+ ];