@pixelbyte-software/pixcode 1.54.11 → 1.55.1

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 (165) hide show
  1. package/dist/assets/{index-Bcqs_1vc.js → index-B-ySsQqi.js} +147 -147
  2. package/dist/assets/index-CWO38aJI.css +32 -0
  3. package/dist/index.html +2 -2
  4. package/dist-server/server/claude-sdk.js +1 -1
  5. package/dist-server/server/claude-sdk.js.map +1 -1
  6. package/dist-server/server/index.js +6 -11
  7. package/dist-server/server/index.js.map +1 -1
  8. package/dist-server/server/modules/security/permission-policy.js.map +1 -0
  9. package/dist-server/server/services/control-room.js +9 -1
  10. package/dist-server/server/services/control-room.js.map +1 -1
  11. package/dist-server/server/services/public-api-manifest.js +5 -5
  12. package/dist-server/server/services/public-api-manifest.js.map +1 -1
  13. package/dist-server/server/services/telegram/control-center.js +10 -10
  14. package/dist-server/server/services/telegram/control-center.js.map +1 -1
  15. package/dist-server/server/services/telegram/telegram-gateway.js +2 -2
  16. package/dist-server/server/services/telegram/telegram-gateway.js.map +1 -1
  17. package/dist-server/server/services/telegram/translations.js +5 -5
  18. package/dist-server/server/services/telegram/translations.js.map +1 -1
  19. package/package.json +1 -1
  20. package/server/claude-sdk.js +1 -1
  21. package/server/index.js +6 -23
  22. package/server/services/control-room.js +10 -1
  23. package/server/services/public-api-manifest.js +5 -5
  24. package/server/services/telegram/control-center.js +10 -10
  25. package/server/services/telegram/telegram-gateway.js +2 -2
  26. package/server/services/telegram/translations.js +5 -5
  27. package/dist/assets/index-Dz1luE0u.css +0 -32
  28. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js +0 -73
  29. package/dist-server/server/modules/orchestration/a2a/adapter-registry.js.map +0 -1
  30. package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js +0 -17
  31. package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js.map +0 -1
  32. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js +0 -236
  33. package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js.map +0 -1
  34. package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js +0 -202
  35. package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js.map +0 -1
  36. package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js +0 -205
  37. package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js.map +0 -1
  38. package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js +0 -205
  39. package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js.map +0 -1
  40. package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.js +0 -84
  41. package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.js.map +0 -1
  42. package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.test.js +0 -43
  43. package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.test.js.map +0 -1
  44. package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js +0 -205
  45. package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js.map +0 -1
  46. package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js +0 -205
  47. package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js.map +0 -1
  48. package/dist-server/server/modules/orchestration/a2a/agent-card.js +0 -50
  49. package/dist-server/server/modules/orchestration/a2a/agent-card.js.map +0 -1
  50. package/dist-server/server/modules/orchestration/a2a/auth.middleware.js +0 -25
  51. package/dist-server/server/modules/orchestration/a2a/auth.middleware.js.map +0 -1
  52. package/dist-server/server/modules/orchestration/a2a/bus.js +0 -34
  53. package/dist-server/server/modules/orchestration/a2a/bus.js.map +0 -1
  54. package/dist-server/server/modules/orchestration/a2a/routes.js +0 -502
  55. package/dist-server/server/modules/orchestration/a2a/routes.js.map +0 -1
  56. package/dist-server/server/modules/orchestration/a2a/task-dispatcher.js +0 -295
  57. package/dist-server/server/modules/orchestration/a2a/task-dispatcher.js.map +0 -1
  58. package/dist-server/server/modules/orchestration/a2a/task-store.js +0 -144
  59. package/dist-server/server/modules/orchestration/a2a/task-store.js.map +0 -1
  60. package/dist-server/server/modules/orchestration/a2a/types.js +0 -6
  61. package/dist-server/server/modules/orchestration/a2a/types.js.map +0 -1
  62. package/dist-server/server/modules/orchestration/a2a/validator.js +0 -101
  63. package/dist-server/server/modules/orchestration/a2a/validator.js.map +0 -1
  64. package/dist-server/server/modules/orchestration/index.js +0 -27
  65. package/dist-server/server/modules/orchestration/index.js.map +0 -1
  66. package/dist-server/server/modules/orchestration/preview/port-watcher.js +0 -90
  67. package/dist-server/server/modules/orchestration/preview/port-watcher.js.map +0 -1
  68. package/dist-server/server/modules/orchestration/preview/preview-proxy.js +0 -58
  69. package/dist-server/server/modules/orchestration/preview/preview-proxy.js.map +0 -1
  70. package/dist-server/server/modules/orchestration/preview/types.js +0 -2
  71. package/dist-server/server/modules/orchestration/preview/types.js.map +0 -1
  72. package/dist-server/server/modules/orchestration/security/permission-policy.js.map +0 -1
  73. package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js +0 -34
  74. package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js.map +0 -1
  75. package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js +0 -70
  76. package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js.map +0 -1
  77. package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js +0 -181
  78. package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js.map +0 -1
  79. package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js +0 -2
  80. package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js.map +0 -1
  81. package/dist-server/server/modules/orchestration/tasks/task-run-graph.js +0 -100
  82. package/dist-server/server/modules/orchestration/tasks/task-run-graph.js.map +0 -1
  83. package/dist-server/server/modules/orchestration/workflows/approval-queue.js +0 -72
  84. package/dist-server/server/modules/orchestration/workflows/approval-queue.js.map +0 -1
  85. package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js +0 -126
  86. package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js.map +0 -1
  87. package/dist-server/server/modules/orchestration/workflows/context-packet.js +0 -89
  88. package/dist-server/server/modules/orchestration/workflows/context-packet.js.map +0 -1
  89. package/dist-server/server/modules/orchestration/workflows/handoff-artifact.js +0 -123
  90. package/dist-server/server/modules/orchestration/workflows/handoff-artifact.js.map +0 -1
  91. package/dist-server/server/modules/orchestration/workflows/workflow-fallback-policy.js +0 -114
  92. package/dist-server/server/modules/orchestration/workflows/workflow-fallback-policy.js.map +0 -1
  93. package/dist-server/server/modules/orchestration/workflows/workflow-replay.js +0 -177
  94. package/dist-server/server/modules/orchestration/workflows/workflow-replay.js.map +0 -1
  95. package/dist-server/server/modules/orchestration/workflows/workflow-runner.js +0 -1718
  96. package/dist-server/server/modules/orchestration/workflows/workflow-runner.js.map +0 -1
  97. package/dist-server/server/modules/orchestration/workflows/workflow-store.js +0 -76
  98. package/dist-server/server/modules/orchestration/workflows/workflow-store.js.map +0 -1
  99. package/dist-server/server/modules/orchestration/workflows/workflow-templates.js +0 -242
  100. package/dist-server/server/modules/orchestration/workflows/workflow-templates.js.map +0 -1
  101. package/dist-server/server/modules/orchestration/workflows/workflow-trace.js +0 -388
  102. package/dist-server/server/modules/orchestration/workflows/workflow-trace.js.map +0 -1
  103. package/dist-server/server/modules/orchestration/workflows/workflow.routes.js +0 -508
  104. package/dist-server/server/modules/orchestration/workflows/workflow.routes.js.map +0 -1
  105. package/dist-server/server/modules/orchestration/workflows/workflow.types.js +0 -2
  106. package/dist-server/server/modules/orchestration/workflows/workflow.types.js.map +0 -1
  107. package/dist-server/server/modules/orchestration/workflows/workspace-target.js +0 -100
  108. package/dist-server/server/modules/orchestration/workflows/workspace-target.js.map +0 -1
  109. package/dist-server/server/modules/orchestration/workspace/docker-workspace.js +0 -123
  110. package/dist-server/server/modules/orchestration/workspace/docker-workspace.js.map +0 -1
  111. package/dist-server/server/modules/orchestration/workspace/path-safety.js +0 -48
  112. package/dist-server/server/modules/orchestration/workspace/path-safety.js.map +0 -1
  113. package/dist-server/server/modules/orchestration/workspace/types.js +0 -11
  114. package/dist-server/server/modules/orchestration/workspace/types.js.map +0 -1
  115. package/dist-server/server/modules/orchestration/workspace/workspace-manager.js +0 -84
  116. package/dist-server/server/modules/orchestration/workspace/workspace-manager.js.map +0 -1
  117. package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js +0 -97
  118. package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js.map +0 -1
  119. package/server/modules/orchestration/a2a/adapter-registry.ts +0 -108
  120. package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +0 -63
  121. package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +0 -286
  122. package/server/modules/orchestration/a2a/adapters/codex.adapter.ts +0 -244
  123. package/server/modules/orchestration/a2a/adapters/cursor.adapter.ts +0 -249
  124. package/server/modules/orchestration/a2a/adapters/gemini.adapter.ts +0 -248
  125. package/server/modules/orchestration/a2a/adapters/json-event.adapter.test.ts +0 -60
  126. package/server/modules/orchestration/a2a/adapters/json-event.adapter.ts +0 -101
  127. package/server/modules/orchestration/a2a/adapters/opencode.adapter.ts +0 -248
  128. package/server/modules/orchestration/a2a/adapters/qwen.adapter.ts +0 -248
  129. package/server/modules/orchestration/a2a/agent-card.ts +0 -55
  130. package/server/modules/orchestration/a2a/auth.middleware.ts +0 -29
  131. package/server/modules/orchestration/a2a/bus.ts +0 -46
  132. package/server/modules/orchestration/a2a/routes.ts +0 -586
  133. package/server/modules/orchestration/a2a/task-dispatcher.ts +0 -345
  134. package/server/modules/orchestration/a2a/task-store.ts +0 -178
  135. package/server/modules/orchestration/a2a/types.ts +0 -126
  136. package/server/modules/orchestration/a2a/validator.ts +0 -113
  137. package/server/modules/orchestration/index.ts +0 -99
  138. package/server/modules/orchestration/preview/port-watcher.ts +0 -112
  139. package/server/modules/orchestration/preview/preview-proxy.ts +0 -60
  140. package/server/modules/orchestration/preview/types.ts +0 -19
  141. package/server/modules/orchestration/tasks/orchestration-task-store.ts +0 -41
  142. package/server/modules/orchestration/tasks/orchestration-task.routes.ts +0 -81
  143. package/server/modules/orchestration/tasks/orchestration-task.service.ts +0 -201
  144. package/server/modules/orchestration/tasks/orchestration-task.types.ts +0 -40
  145. package/server/modules/orchestration/tasks/task-run-graph.ts +0 -155
  146. package/server/modules/orchestration/workflows/approval-queue.ts +0 -106
  147. package/server/modules/orchestration/workflows/built-in-workflows.ts +0 -127
  148. package/server/modules/orchestration/workflows/context-packet.ts +0 -186
  149. package/server/modules/orchestration/workflows/handoff-artifact.ts +0 -175
  150. package/server/modules/orchestration/workflows/workflow-fallback-policy.ts +0 -161
  151. package/server/modules/orchestration/workflows/workflow-replay.ts +0 -254
  152. package/server/modules/orchestration/workflows/workflow-runner.ts +0 -2062
  153. package/server/modules/orchestration/workflows/workflow-store.ts +0 -97
  154. package/server/modules/orchestration/workflows/workflow-templates.ts +0 -272
  155. package/server/modules/orchestration/workflows/workflow-trace.ts +0 -424
  156. package/server/modules/orchestration/workflows/workflow.routes.ts +0 -586
  157. package/server/modules/orchestration/workflows/workflow.types.ts +0 -111
  158. package/server/modules/orchestration/workflows/workspace-target.ts +0 -122
  159. package/server/modules/orchestration/workspace/docker-workspace.ts +0 -136
  160. package/server/modules/orchestration/workspace/path-safety.ts +0 -55
  161. package/server/modules/orchestration/workspace/types.ts +0 -52
  162. package/server/modules/orchestration/workspace/workspace-manager.ts +0 -102
  163. package/server/modules/orchestration/workspace/worktree-workspace.ts +0 -126
  164. /package/dist-server/server/modules/{orchestration/security → security}/permission-policy.js +0 -0
  165. /package/server/modules/{orchestration/security → security}/permission-policy.ts +0 -0
@@ -1,201 +0,0 @@
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 { submitA2ATask } from '@/modules/orchestration/a2a/task-dispatcher.js';
5
- import type { TaskState } from '@/modules/orchestration/a2a/types.js';
6
- import type { WorkflowNodeRun, WorkflowRun } from '@/modules/orchestration/workflows/workflow.types.js';
7
-
8
- function newId(prefix: string): string {
9
- return `${prefix}_${Math.random().toString(36).slice(2, 10)}`;
10
- }
11
-
12
- const TERMINAL_A2A_STATES: TaskState[] = ['completed', 'canceled', 'failed'];
13
-
14
- function uniqueStrings(values: Array<string | undefined>): string[] {
15
- return [...new Set(values.filter((value): value is string => Boolean(value?.trim())))]
16
- .sort((a, b) => a.localeCompare(b));
17
- }
18
-
19
- function readRecord(value: unknown): Record<string, unknown> | undefined {
20
- return value && typeof value === 'object' ? value as Record<string, unknown> : undefined;
21
- }
22
-
23
- function readString(value: unknown): string | undefined {
24
- return typeof value === 'string' && value.trim() ? value.trim() : undefined;
25
- }
26
-
27
- function changedFilesFromNode(node: WorkflowNodeRun): string[] {
28
- const files: string[] = [];
29
- if (node.handoffArtifact?.changedFiles) {
30
- files.push(...node.handoffArtifact.changedFiles);
31
- }
32
- for (const artifact of node.artifacts ?? []) {
33
- const data = readRecord(artifact.data);
34
- const metadata = readRecord(artifact.metadata);
35
- files.push(
36
- ...[readString(data?.path), readString(data?.file), readString(metadata?.path), readString(metadata?.file)]
37
- .filter((value): value is string => Boolean(value)),
38
- );
39
- for (const key of ['files', 'changedFiles']) {
40
- const value = data?.[key] ?? metadata?.[key];
41
- if (Array.isArray(value)) {
42
- files.push(...value.map((entry) => readString(entry)).filter((entry): entry is string => Boolean(entry)));
43
- }
44
- }
45
- }
46
- return uniqueStrings(files);
47
- }
48
-
49
- function changedFilesFromWorkflowRun(run: WorkflowRun): string[] {
50
- return uniqueStrings(run.nodeRuns.flatMap((node) => changedFilesFromNode(node)));
51
- }
52
-
53
- function workflowRunState(run: WorkflowRun): OrchestrationTask['state'] {
54
- if (run.status === 'completed') return 'done';
55
- if (run.status === 'failed') return 'failed';
56
- if (run.status === 'canceled') return 'canceled';
57
- return 'in_progress';
58
- }
59
-
60
- class OrchestrationTaskService {
61
- private store: OrchestrationTaskStore;
62
-
63
- constructor(store?: OrchestrationTaskStore) {
64
- this.store = store ?? new OrchestrationTaskStore();
65
- this.watchA2ATerminalStates();
66
- }
67
-
68
- list(projectId?: string): OrchestrationTask[] {
69
- return this.store.list(projectId);
70
- }
71
-
72
- get(id: string): OrchestrationTask | undefined {
73
- return this.store.get(id);
74
- }
75
-
76
- create(input: CreateOrchestrationTaskInput): OrchestrationTask {
77
- const now = Date.now();
78
- const task: OrchestrationTask = {
79
- id: newId('otask'),
80
- projectId: input.projectId,
81
- title: input.title,
82
- description: input.description,
83
- acceptanceCriteria: input.acceptanceCriteria,
84
- changedFiles: input.changedFiles,
85
- state: 'todo',
86
- createdAt: now,
87
- updatedAt: now,
88
- };
89
- this.store.set(task);
90
- return task;
91
- }
92
-
93
- async dispatch(taskId: string, input: DispatchOrchestrationTaskInput): Promise<OrchestrationTask> {
94
- const task = this.store.get(taskId);
95
- if (!task) throw new Error('TASK_NOT_FOUND');
96
-
97
- const a2aTask = await submitA2ATask({
98
- adapterId: input.adapterId,
99
- message: {
100
- messageId: newId('msg'),
101
- role: 'user',
102
- parts: [{ kind: 'text', text: `${task.title}\n\n${task.description ?? ''}` }],
103
- },
104
- metadata: {
105
- isolation: input.isolation ?? 'worktree',
106
- model: input.model,
107
- permissionMode: input.permissionMode,
108
- workspace: {
109
- kind: input.isolation ?? 'worktree',
110
- projectPath: input.projectPath,
111
- },
112
- orchestrationTaskId: task.id,
113
- },
114
- });
115
-
116
- task.a2aTaskId = a2aTask.id;
117
- task.adapterId = input.adapterId;
118
- task.adapterSelector = input.adapterId;
119
- task.workspaceKind = input.isolation ?? 'worktree';
120
- task.workspacePath = input.projectPath;
121
- task.state = 'in_progress';
122
- task.updatedAt = Date.now();
123
- this.store.set(task);
124
- return task;
125
- }
126
-
127
- linkWorkflowRun(taskId: string, run: WorkflowRun): OrchestrationTask | undefined {
128
- const task = this.store.get(taskId);
129
- if (!task) return undefined;
130
- task.workflowRunIds = uniqueStrings([...(task.workflowRunIds ?? []), run.id]);
131
- task.state = workflowRunState(run);
132
- task.updatedAt = Date.now();
133
- this.store.set(task);
134
- return task;
135
- }
136
-
137
- updateFromWorkflowRun(run: WorkflowRun): OrchestrationTask | undefined {
138
- const metadata = run.metadata ?? {};
139
- const taskId = readString(metadata.orchestrationTaskId);
140
- const task = taskId ? this.store.get(taskId) : undefined;
141
- if (!task) return undefined;
142
-
143
- const changedFiles = changedFilesFromWorkflowRun(run);
144
- task.workflowRunIds = uniqueStrings([...(task.workflowRunIds ?? []), run.id]);
145
- task.changedFiles = uniqueStrings([...(task.changedFiles ?? []), ...changedFiles]);
146
- task.state = workflowRunState(run);
147
- task.acceptanceCriteria = [
148
- ...(task.acceptanceCriteria ?? []).filter((criterion) => criterion.id !== `run-${run.id}`),
149
- {
150
- id: `run-${run.id}`,
151
- label: `Workflow ${run.workflowId} ${run.status}`,
152
- status: run.status === 'completed' ? 'passed' : run.status === 'failed' || run.status === 'canceled' ? 'failed' : 'pending',
153
- source: 'workflow',
154
- },
155
- ];
156
- task.updatedAt = Date.now();
157
- this.store.set(task);
158
-
159
- return task;
160
- }
161
-
162
- updateState(taskId: string, state: OrchestrationTask['state']): OrchestrationTask | undefined {
163
- const task = this.store.get(taskId);
164
- if (!task) return undefined;
165
- task.state = state;
166
- task.updatedAt = Date.now();
167
- this.store.set(task);
168
- return task;
169
- }
170
-
171
- private watchA2ATerminalStates(): void {
172
- a2aBus.subscribeAll((event) => {
173
- if (event.kind !== 'task-state') return;
174
- if (!TERMINAL_A2A_STATES.includes(event.state)) return;
175
-
176
- const orchTask = this.store.getByA2ATaskId(event.taskId);
177
- if (!orchTask) return;
178
- if (orchTask.state === 'done' || orchTask.state === 'failed' || orchTask.state === 'canceled') return;
179
-
180
- const mapped = event.state === 'completed' ? 'done'
181
- : event.state === 'failed' ? 'failed'
182
- : 'canceled';
183
-
184
- orchTask.state = mapped;
185
- orchTask.updatedAt = Date.now();
186
- this.store.set(orchTask);
187
-
188
- });
189
- }
190
-
191
- cancel(taskId: string): OrchestrationTask {
192
- const task = this.store.get(taskId);
193
- if (!task) throw new Error('TASK_NOT_FOUND');
194
- task.state = 'canceled';
195
- task.updatedAt = Date.now();
196
- this.store.set(task);
197
- return task;
198
- }
199
- }
200
-
201
- export const orchestrationTaskService = new OrchestrationTaskService();
@@ -1,40 +0,0 @@
1
- export type OrchestrationTaskState = 'todo' | 'in_progress' | 'in_review' | 'done' | 'failed' | 'canceled';
2
-
3
- export interface OrchestrationTask {
4
- id: string;
5
- a2aTaskId?: string;
6
- workflowRunIds?: string[];
7
- projectId: string;
8
- title: string;
9
- description?: string;
10
- state: OrchestrationTaskState;
11
- acceptanceCriteria?: Array<{
12
- id: string;
13
- label: string;
14
- status: 'pending' | 'passed' | 'failed';
15
- source: 'workflow' | 'agent';
16
- }>;
17
- changedFiles?: string[];
18
- adapterId?: string;
19
- adapterSelector?: string;
20
- workspaceKind?: 'host' | 'worktree' | 'docker';
21
- workspacePath?: string;
22
- createdAt: number;
23
- updatedAt: number;
24
- }
25
-
26
- export interface CreateOrchestrationTaskInput {
27
- projectId: string;
28
- title: string;
29
- description?: string;
30
- acceptanceCriteria?: OrchestrationTask['acceptanceCriteria'];
31
- changedFiles?: string[];
32
- }
33
-
34
- export interface DispatchOrchestrationTaskInput {
35
- adapterId: string;
36
- isolation?: 'host' | 'worktree' | 'docker';
37
- projectPath?: string;
38
- model?: string;
39
- permissionMode?: string;
40
- }
@@ -1,155 +0,0 @@
1
- import type { WorkflowNodeRun, WorkflowRun } from '@/modules/orchestration/workflows/workflow.types.js';
2
- import { workflowStore } from '@/modules/orchestration/workflows/workflow-store.js';
3
- import { orchestrationTaskService } from '@/modules/orchestration/tasks/orchestration-task.service.js';
4
- import type { OrchestrationTask } from '@/modules/orchestration/tasks/orchestration-task.types.js';
5
-
6
- export const PIXCODE_TASK_RUN_GRAPH_PROTOCOL = 'pixcode.task-run-graph.v1';
7
-
8
- export type TaskRunGraphCriterionStatus = 'pending' | 'passed' | 'failed';
9
-
10
- export interface TaskRunGraphCriterion {
11
- id: string;
12
- label: string;
13
- status: TaskRunGraphCriterionStatus;
14
- source: 'workflow' | 'agent';
15
- }
16
-
17
- export interface TaskRunGraphRunSummary {
18
- id: string;
19
- workflowId: string;
20
- status: WorkflowRun['status'];
21
- startedAt: number;
22
- finishedAt?: number;
23
- orchestrationTaskId?: string;
24
- changedFiles: string[];
25
- }
26
-
27
- export interface TaskRunGraph {
28
- protocol: typeof PIXCODE_TASK_RUN_GRAPH_PROTOCOL;
29
- projectId: string;
30
- orchestrationTaskId?: string;
31
- workflowRuns: TaskRunGraphRunSummary[];
32
- changedFiles: string[];
33
- acceptanceCriteria: TaskRunGraphCriterion[];
34
- status: {
35
- totalRuns: number;
36
- completedRuns: number;
37
- failedRuns: number;
38
- passedCriteria: number;
39
- failedCriteria: number;
40
- };
41
- }
42
-
43
- function readString(value: unknown): string | undefined {
44
- return typeof value === 'string' && value.trim() ? value.trim() : undefined;
45
- }
46
-
47
- function readRecord(value: unknown): Record<string, unknown> | undefined {
48
- return value && typeof value === 'object' ? value as Record<string, unknown> : undefined;
49
- }
50
-
51
- function uniqueStrings(values: Array<string | undefined>): string[] {
52
- return [...new Set(values.filter((value): value is string => Boolean(value?.trim())))]
53
- .sort((a, b) => a.localeCompare(b));
54
- }
55
-
56
- function metadataOrchestrationTaskId(run: WorkflowRun): string | undefined {
57
- return readString(run.metadata?.orchestrationTaskId)
58
- ?? readString(readRecord(run.metadata?.taskGraph)?.orchestrationTaskId);
59
- }
60
-
61
- function artifactChangedFiles(node: WorkflowNodeRun): string[] {
62
- const files: string[] = [];
63
-
64
- if (node.handoffArtifact?.changedFiles) {
65
- files.push(...node.handoffArtifact.changedFiles);
66
- }
67
-
68
- for (const artifact of node.artifacts ?? []) {
69
- const data = readRecord(artifact.data);
70
- const metadata = readRecord(artifact.metadata);
71
- const candidates = [
72
- readString(metadata?.path),
73
- readString(metadata?.file),
74
- readString(data?.path),
75
- readString(data?.file),
76
- ];
77
- files.push(...candidates.filter((value): value is string => Boolean(value)));
78
-
79
- for (const key of ['files', 'changedFiles']) {
80
- const value = data?.[key] ?? metadata?.[key];
81
- if (Array.isArray(value)) {
82
- files.push(...value.map((entry) => readString(entry)).filter((entry): entry is string => Boolean(entry)));
83
- }
84
- }
85
- }
86
-
87
- return uniqueStrings(files);
88
- }
89
-
90
- export function changedFilesFromWorkflowRun(run: WorkflowRun): string[] {
91
- return uniqueStrings(run.nodeRuns.flatMap((node) => artifactChangedFiles(node)));
92
- }
93
-
94
- function workflowRunMatchesTask(run: WorkflowRun, task: OrchestrationTask | undefined): boolean {
95
- const runOrchestrationTaskId = metadataOrchestrationTaskId(run);
96
- if (task?.id && runOrchestrationTaskId === task.id) return true;
97
- if (task?.workflowRunIds?.includes(run.id)) return true;
98
- return false;
99
- }
100
-
101
- function runSummary(run: WorkflowRun): TaskRunGraphRunSummary {
102
- return {
103
- id: run.id,
104
- workflowId: run.workflowId,
105
- status: run.status,
106
- startedAt: run.startedAt,
107
- finishedAt: run.finishedAt,
108
- orchestrationTaskId: metadataOrchestrationTaskId(run),
109
- changedFiles: changedFilesFromWorkflowRun(run),
110
- };
111
- }
112
-
113
- export function buildTaskRunGraph({
114
- projectId,
115
- orchestrationTaskId,
116
- }: {
117
- projectId: string;
118
- orchestrationTaskId?: string;
119
- }): TaskRunGraph {
120
- const orchestrationTask = orchestrationTaskId ? orchestrationTaskService.get(orchestrationTaskId) : undefined;
121
- const workflowRuns = workflowStore
122
- .listRuns()
123
- .filter((run) => workflowRunMatchesTask(run, orchestrationTask))
124
- .map(runSummary);
125
- const workflowCriteria: TaskRunGraphCriterion[] = workflowRuns.map((run) => ({
126
- id: `run-${run.id}`,
127
- label: `Workflow ${run.workflowId} ${run.status}`,
128
- status: run.status === 'completed' ? 'passed' : run.status === 'failed' || run.status === 'canceled' ? 'failed' : 'pending',
129
- source: 'workflow',
130
- }));
131
- const acceptanceCriteria = [
132
- ...(orchestrationTask?.acceptanceCriteria ?? []),
133
- ...workflowCriteria,
134
- ];
135
- const changedFiles = uniqueStrings([
136
- ...(orchestrationTask?.changedFiles ?? []),
137
- ...workflowRuns.flatMap((run) => run.changedFiles),
138
- ]);
139
-
140
- return {
141
- protocol: PIXCODE_TASK_RUN_GRAPH_PROTOCOL,
142
- projectId,
143
- orchestrationTaskId: orchestrationTask?.id,
144
- workflowRuns,
145
- changedFiles,
146
- acceptanceCriteria,
147
- status: {
148
- totalRuns: workflowRuns.length,
149
- completedRuns: workflowRuns.filter((run) => run.status === 'completed').length,
150
- failedRuns: workflowRuns.filter((run) => run.status === 'failed' || run.status === 'canceled').length,
151
- passedCriteria: acceptanceCriteria.filter((criterion) => criterion.status === 'passed').length,
152
- failedCriteria: acceptanceCriteria.filter((criterion) => criterion.status === 'failed').length,
153
- },
154
- };
155
- }
@@ -1,106 +0,0 @@
1
- import type { WorkflowRun } from '@/modules/orchestration/workflows/workflow.types.js';
2
- import { workflowStore } from '@/modules/orchestration/workflows/workflow-store.js';
3
-
4
- export type ApprovalDecisionSource = 'ui' | 'telegram' | 'api';
5
-
6
- export type ApprovalQueueItem = Record<string, unknown> & {
7
- id: string;
8
- runId: string;
9
- workflowId: string;
10
- status: string;
11
- requestedAt?: number;
12
- };
13
-
14
- function readRunApprovals(run: WorkflowRun): Array<Record<string, unknown>> {
15
- const approvals = run.metadata?.pendingPermissionApprovals;
16
- return Array.isArray(approvals)
17
- ? approvals.filter((approval): approval is Record<string, unknown> => Boolean(approval && typeof approval === 'object'))
18
- : [];
19
- }
20
-
21
- function normalizeApproval(run: WorkflowRun, approval: Record<string, unknown>): ApprovalQueueItem | null {
22
- const id = typeof approval.id === 'string' && approval.id.trim() ? approval.id : null;
23
- if (!id) return null;
24
-
25
- return {
26
- ...approval,
27
- id,
28
- runId: run.id,
29
- workflowId: run.workflowId,
30
- status: typeof approval.status === 'string' ? approval.status : 'pending',
31
- requestedAt: typeof approval.requestedAt === 'number' ? approval.requestedAt : run.startedAt,
32
- };
33
- }
34
-
35
- export function listPendingApprovals(options: {
36
- projectId?: string;
37
- includeResolved?: boolean;
38
- } = {}): ApprovalQueueItem[] {
39
- const items: ApprovalQueueItem[] = [];
40
- for (const run of workflowStore.listRuns()) {
41
- if (options.projectId && run.metadata?.projectId !== options.projectId) continue;
42
- for (const approval of readRunApprovals(run)) {
43
- const item = normalizeApproval(run, approval);
44
- if (!item) continue;
45
- if (!options.includeResolved && item.status !== 'pending') continue;
46
- items.push(item);
47
- }
48
- }
49
-
50
- return items.sort((a, b) => Number(b.requestedAt ?? 0) - Number(a.requestedAt ?? 0));
51
- }
52
-
53
- export function resolvePermissionApproval({
54
- approvalId,
55
- allow,
56
- source = 'api',
57
- resolvedBy,
58
- message,
59
- }: {
60
- approvalId: string;
61
- allow: boolean;
62
- source?: ApprovalDecisionSource; // source: 'ui' | 'telegram' | 'api'
63
- resolvedBy?: string | number | null;
64
- message?: string;
65
- }): {
66
- runId: string;
67
- pendingApprovals: ApprovalQueueItem[];
68
- approvalHistory: ApprovalQueueItem[];
69
- } | null {
70
- for (const run of workflowStore.listRuns()) {
71
- const approvals = readRunApprovals(run);
72
- let changed = false;
73
- const nextApprovals = approvals.map((approval) => {
74
- if (approval.id !== approvalId) return approval;
75
- changed = true;
76
- return {
77
- ...approval,
78
- status: allow ? 'allowed' : 'denied',
79
- resolvedAt: Date.now(),
80
- resolvedBy: resolvedBy ?? null,
81
- decisionSource: source,
82
- resolutionMessage: typeof message === 'string' && message.trim() ? message.trim() : undefined,
83
- };
84
- });
85
-
86
- if (!changed) continue;
87
-
88
- run.metadata = {
89
- ...run.metadata,
90
- pendingPermissionApprovals: nextApprovals,
91
- };
92
- workflowStore.setRun(run);
93
-
94
- const queueItems = nextApprovals
95
- .map((approval) => normalizeApproval(run, approval))
96
- .filter((approval): approval is ApprovalQueueItem => Boolean(approval));
97
-
98
- return {
99
- runId: run.id,
100
- pendingApprovals: queueItems.filter((approval) => approval.status === 'pending'),
101
- approvalHistory: queueItems.filter((approval) => approval.status !== 'pending'),
102
- };
103
- }
104
-
105
- return null;
106
- }
@@ -1,127 +0,0 @@
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
- ];