taskmeld 0.1.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 (204) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +172 -0
  3. package/README.zh-CN.md +172 -0
  4. package/dist/src/app/app-context-env.js +51 -0
  5. package/dist/src/app/create-app-context.js +127 -0
  6. package/dist/src/app/data-dir.js +29 -0
  7. package/dist/src/app/pipeline-config.js +105 -0
  8. package/dist/src/app/pipeline-plugin-config.js +2 -0
  9. package/dist/src/app/pipeline-registry.js +502 -0
  10. package/dist/src/app/pipeline-runtime.js +202 -0
  11. package/dist/src/app/runtime-store.js +151 -0
  12. package/dist/src/app/user-config.js +37 -0
  13. package/dist/src/artifacts/artifact-cleanup.js +192 -0
  14. package/dist/src/artifacts/artifact-index.js +262 -0
  15. package/dist/src/artifacts/artifact-rebuilder.js +120 -0
  16. package/dist/src/artifacts/storage-service.js +371 -0
  17. package/dist/src/cli/bootstrap.js +226 -0
  18. package/dist/src/cli/commands/agent.js +126 -0
  19. package/dist/src/cli/commands/artifact.js +175 -0
  20. package/dist/src/cli/commands/init.js +150 -0
  21. package/dist/src/cli/commands/pipeline/errors.js +37 -0
  22. package/dist/src/cli/commands/pipeline/result.js +179 -0
  23. package/dist/src/cli/commands/pipeline/selector.js +51 -0
  24. package/dist/src/cli/commands/pipeline/types.js +2 -0
  25. package/dist/src/cli/commands/pipeline/watch.js +67 -0
  26. package/dist/src/cli/commands/pipeline.js +339 -0
  27. package/dist/src/cli/commands/scheduler.js +81 -0
  28. package/dist/src/cli/commands/server.js +70 -0
  29. package/dist/src/cli/commands/system.js +21 -0
  30. package/dist/src/cli/errors.js +71 -0
  31. package/dist/src/cli/help.js +184 -0
  32. package/dist/src/cli/index.js +65 -0
  33. package/dist/src/cli/output.js +19 -0
  34. package/dist/src/cli/renderers/engine/json.js +67 -0
  35. package/dist/src/cli/renderers/engine/markdown.js +95 -0
  36. package/dist/src/cli/renderers/engine/types.js +2 -0
  37. package/dist/src/cli/renderers/engine/utils.js +32 -0
  38. package/dist/src/cli/renderers/index.js +27 -0
  39. package/dist/src/cli/renderers/specs/agent.js +78 -0
  40. package/dist/src/cli/renderers/specs/artifact.js +32 -0
  41. package/dist/src/cli/renderers/specs/index.js +36 -0
  42. package/dist/src/cli/renderers/specs/init.js +25 -0
  43. package/dist/src/cli/renderers/specs/pipeline.js +561 -0
  44. package/dist/src/cli/renderers/specs/scheduler.js +46 -0
  45. package/dist/src/cli/renderers/specs/server.js +38 -0
  46. package/dist/src/cli/renderers/specs/system.js +36 -0
  47. package/dist/src/cli/router.js +199 -0
  48. package/dist/src/cli/server-runtime-client.js +780 -0
  49. package/dist/src/cli/types.js +2 -0
  50. package/dist/src/gateway/frame-sanitizer.js +78 -0
  51. package/dist/src/gateway/gateway-client.js +462 -0
  52. package/dist/src/gateway/index.js +18 -0
  53. package/dist/src/gateway/types.js +2 -0
  54. package/dist/src/index.js +123 -0
  55. package/dist/src/logs/run-log-reader.js +141 -0
  56. package/dist/src/logs/run-log-service.js +42 -0
  57. package/dist/src/logs/run-log-types.js +2 -0
  58. package/dist/src/pipeline/agent-activity.js +191 -0
  59. package/dist/src/pipeline/artifact-storage.js +208 -0
  60. package/dist/src/pipeline/diagnostics/dependency-diagnostic.js +105 -0
  61. package/dist/src/pipeline/diagnostics/index.js +6 -0
  62. package/dist/src/pipeline/dispatch/pipeline-inbound-queue.js +215 -0
  63. package/dist/src/pipeline/dispatch/pipeline-link-dispatcher.js +66 -0
  64. package/dist/src/pipeline/dispatch/pipeline-link-store.js +94 -0
  65. package/dist/src/pipeline/dispatch/pipeline-queue-drainer.js +71 -0
  66. package/dist/src/pipeline/execution/dependency-check.js +52 -0
  67. package/dist/src/pipeline/execution/execution-result.js +2 -0
  68. package/dist/src/pipeline/execution/group-item-executor.js +128 -0
  69. package/dist/src/pipeline/execution/index.js +5 -0
  70. package/dist/src/pipeline/execution/node-item-executor.js +58 -0
  71. package/dist/src/pipeline/execution/node-runner.js +159 -0
  72. package/dist/src/pipeline/execution/readiness-state.js +10 -0
  73. package/dist/src/pipeline/execution/reject-handler.js +94 -0
  74. package/dist/src/pipeline/execution/rejected-artifact-archiver.js +45 -0
  75. package/dist/src/pipeline/execution/route-item-manager.js +253 -0
  76. package/dist/src/pipeline/execution/run-abort-controller.js +66 -0
  77. package/dist/src/pipeline/execution/run-state-helpers.js +257 -0
  78. package/dist/src/pipeline/execution/service.js +165 -0
  79. package/dist/src/pipeline/execution/session-registry.js +96 -0
  80. package/dist/src/pipeline/execution/structured-node-runner.js +411 -0
  81. package/dist/src/pipeline/execution-status.js +96 -0
  82. package/dist/src/pipeline/execution-timeout.js +21 -0
  83. package/dist/src/pipeline/identity/index.js +32 -0
  84. package/dist/src/pipeline/identity/types.js +2 -0
  85. package/dist/src/pipeline/item-batch-controller.js +227 -0
  86. package/dist/src/pipeline/output/pipeline-output-resolver.js +91 -0
  87. package/dist/src/pipeline/output/pipeline-output-store.js +60 -0
  88. package/dist/src/pipeline/runtime-model.js +173 -0
  89. package/dist/src/pipeline/scheduler/dependency-state.js +144 -0
  90. package/dist/src/pipeline/scheduler-service.js +314 -0
  91. package/dist/src/pipeline/state/group-item-state.js +50 -0
  92. package/dist/src/pipeline/state/group-run-state.js +41 -0
  93. package/dist/src/pipeline/state/index.js +20 -0
  94. package/dist/src/pipeline/state/node-item-state.js +67 -0
  95. package/dist/src/pipeline/state/node-run-state.js +51 -0
  96. package/dist/src/pipeline/state/types.js +2 -0
  97. package/dist/src/pipeline/state-machine.js +101 -0
  98. package/dist/src/pipeline/structured-output/contract.js +133 -0
  99. package/dist/src/pipeline/structured-output/index.js +22 -0
  100. package/dist/src/pipeline/structured-output/parser.js +214 -0
  101. package/dist/src/pipeline/structured-output/prompt.js +290 -0
  102. package/dist/src/pipeline/structured-output/waiter.js +139 -0
  103. package/dist/src/pipeline/template.js +135 -0
  104. package/dist/src/pipeline/timeline-log-store.js +57 -0
  105. package/dist/src/pipeline/tool-activity.js +94 -0
  106. package/dist/src/pipeline/types/pipeline-link.js +7 -0
  107. package/dist/src/pipeline/types/pipeline-output.js +11 -0
  108. package/dist/src/pipeline/types/workflow.js +2 -0
  109. package/dist/src/pipeline/workflow/branch-rules.js +74 -0
  110. package/dist/src/pipeline/workflow/defaults.js +48 -0
  111. package/dist/src/pipeline/workflow/io.js +89 -0
  112. package/dist/src/pipeline/workflow/normalize.js +347 -0
  113. package/dist/src/pipeline/workflow/routes.js +16 -0
  114. package/dist/src/pipeline/workflow/template-mapper.js +113 -0
  115. package/dist/src/pipeline/workflow/validate.js +312 -0
  116. package/dist/src/pipeline/workflow-graph.js +165 -0
  117. package/dist/src/server/api-handler.js +163 -0
  118. package/dist/src/server/http-utils.js +34 -0
  119. package/dist/src/server/middleware.js +61 -0
  120. package/dist/src/server/router.js +105 -0
  121. package/dist/src/server/routes/agents.js +189 -0
  122. package/dist/src/server/routes/artifacts.js +163 -0
  123. package/dist/src/server/routes/gateway.js +18 -0
  124. package/dist/src/server/routes/health.js +16 -0
  125. package/dist/src/server/routes/logs.js +73 -0
  126. package/dist/src/server/routes/pipeline-batch.js +163 -0
  127. package/dist/src/server/routes/pipeline-diagnostics.js +33 -0
  128. package/dist/src/server/routes/pipeline-identity.js +24 -0
  129. package/dist/src/server/routes/pipeline-links.js +117 -0
  130. package/dist/src/server/routes/pipeline-outputs.js +27 -0
  131. package/dist/src/server/routes/pipeline-queue.js +62 -0
  132. package/dist/src/server/routes/pipeline-runtime.js +162 -0
  133. package/dist/src/server/routes/pipeline-scheduler.js +69 -0
  134. package/dist/src/server/routes/pipeline-workflow.js +180 -0
  135. package/dist/src/server/routes/pipelines.js +96 -0
  136. package/dist/src/server/routes/sessions.js +244 -0
  137. package/dist/src/server/routes/timeline.js +14 -0
  138. package/dist/src/server/serve-static.js +42 -0
  139. package/dist/src/server/types.js +2 -0
  140. package/dist/src/services/agent-service.js +79 -0
  141. package/dist/src/services/artifact-service.js +74 -0
  142. package/dist/src/services/gateway-read-helpers.js +10 -0
  143. package/dist/src/services/index.js +23 -0
  144. package/dist/src/services/pipeline-service.js +529 -0
  145. package/dist/src/services/pipeline-status.js +93 -0
  146. package/dist/src/services/read-services.js +60 -0
  147. package/dist/src/services/scheduler-service.js +37 -0
  148. package/dist/src/services/session-service.js +227 -0
  149. package/dist/src/services/system-service.js +26 -0
  150. package/dist/src/transport/ws-broker.js +48 -0
  151. package/dist/src/utils/array.js +17 -0
  152. package/dist/src/utils/guards.js +5 -0
  153. package/dist/src/utils/session.js +60 -0
  154. package/dist/src/version.js +5 -0
  155. package/package.json +61 -0
  156. package/web/dist/assets/index-CWnfhkn-.js +65 -0
  157. package/web/dist/assets/index-gZ0xOfSO.css +1 -0
  158. package/web/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  159. package/web/dist/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  160. package/web/dist/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  161. package/web/dist/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
  162. package/web/dist/assets/jetbrains-mono-cyrillic-700-normal-BWTpRfYl.woff2 +0 -0
  163. package/web/dist/assets/jetbrains-mono-cyrillic-700-normal-CEoEElIJ.woff +0 -0
  164. package/web/dist/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  165. package/web/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  166. package/web/dist/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  167. package/web/dist/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
  168. package/web/dist/assets/jetbrains-mono-greek-700-normal-C6CZE3T8.woff2 +0 -0
  169. package/web/dist/assets/jetbrains-mono-greek-700-normal-DEigVDxa.woff +0 -0
  170. package/web/dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  171. package/web/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  172. package/web/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  173. package/web/dist/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  174. package/web/dist/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
  175. package/web/dist/assets/jetbrains-mono-latin-700-normal-D3wTyLJW.woff +0 -0
  176. package/web/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  177. package/web/dist/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  178. package/web/dist/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  179. package/web/dist/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  180. package/web/dist/assets/jetbrains-mono-latin-ext-700-normal-CZipNAKV.woff2 +0 -0
  181. package/web/dist/assets/jetbrains-mono-latin-ext-700-normal-CxPITLHs.woff +0 -0
  182. package/web/dist/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  183. package/web/dist/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
  184. package/web/dist/assets/jetbrains-mono-vietnamese-700-normal-BDLVIk2r.woff +0 -0
  185. package/web/dist/assets/space-grotesk-latin-400-normal-BnQMeOim.woff +0 -0
  186. package/web/dist/assets/space-grotesk-latin-400-normal-CJ-V5oYT.woff2 +0 -0
  187. package/web/dist/assets/space-grotesk-latin-500-normal-CNSSEhBt.woff +0 -0
  188. package/web/dist/assets/space-grotesk-latin-500-normal-lFbtlQH6.woff2 +0 -0
  189. package/web/dist/assets/space-grotesk-latin-700-normal-CwsQ-cCU.woff +0 -0
  190. package/web/dist/assets/space-grotesk-latin-700-normal-RjhwGPKo.woff2 +0 -0
  191. package/web/dist/assets/space-grotesk-latin-ext-400-normal-CfP_5XZW.woff2 +0 -0
  192. package/web/dist/assets/space-grotesk-latin-ext-400-normal-DRPE3kg4.woff +0 -0
  193. package/web/dist/assets/space-grotesk-latin-ext-500-normal-3dgZTiw9.woff +0 -0
  194. package/web/dist/assets/space-grotesk-latin-ext-500-normal-DUe3BAxM.woff2 +0 -0
  195. package/web/dist/assets/space-grotesk-latin-ext-700-normal-BQnZhY3m.woff2 +0 -0
  196. package/web/dist/assets/space-grotesk-latin-ext-700-normal-HVCqSBdx.woff +0 -0
  197. package/web/dist/assets/space-grotesk-vietnamese-400-normal-B7xT_GF5.woff2 +0 -0
  198. package/web/dist/assets/space-grotesk-vietnamese-400-normal-BIWiOVfw.woff +0 -0
  199. package/web/dist/assets/space-grotesk-vietnamese-500-normal-BTqKIpxg.woff +0 -0
  200. package/web/dist/assets/space-grotesk-vietnamese-500-normal-BmEvtly_.woff2 +0 -0
  201. package/web/dist/assets/space-grotesk-vietnamese-700-normal-DMty7AZE.woff2 +0 -0
  202. package/web/dist/assets/space-grotesk-vietnamese-700-normal-Duxec5Rn.woff +0 -0
  203. package/web/dist/favicon.svg +10 -0
  204. package/web/dist/index.html +14 -0
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commandRenderSpecs = void 0;
4
+ const agent_1 = require("./agent");
5
+ const artifact_1 = require("./artifact");
6
+ const init_1 = require("./init");
7
+ const pipeline_1 = require("./pipeline");
8
+ const scheduler_1 = require("./scheduler");
9
+ const server_1 = require("./server");
10
+ const system_1 = require("./system");
11
+ // 按模块聚合输出定义,避免继续把所有结构堆回单一 renderer 文件。
12
+ const allSpecs = {
13
+ ...agent_1.agentRenderSpecs,
14
+ ...artifact_1.artifactRenderSpecs,
15
+ ...init_1.initRenderSpecs,
16
+ ...pipeline_1.pipelineRenderSpecs,
17
+ ...scheduler_1.schedulerRenderSpecs,
18
+ ...server_1.serverRenderSpecs,
19
+ ...system_1.systemRenderSpecs,
20
+ };
21
+ if (process.env.NODE_ENV !== "production") {
22
+ const keys = [
23
+ ...Object.keys(agent_1.agentRenderSpecs),
24
+ ...Object.keys(artifact_1.artifactRenderSpecs),
25
+ ...Object.keys(init_1.initRenderSpecs),
26
+ ...Object.keys(pipeline_1.pipelineRenderSpecs),
27
+ ...Object.keys(scheduler_1.schedulerRenderSpecs),
28
+ ...Object.keys(server_1.serverRenderSpecs),
29
+ ...Object.keys(system_1.systemRenderSpecs),
30
+ ];
31
+ const dupes = keys.filter((k, i) => keys.indexOf(k) !== i);
32
+ if (dupes.length > 0) {
33
+ throw new Error(`Duplicate render spec keys: ${dupes.join(", ")}`);
34
+ }
35
+ }
36
+ exports.commandRenderSpecs = allSpecs;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initRenderSpecs = void 0;
4
+ exports.initRenderSpecs = {
5
+ "init": {
6
+ kind: "text",
7
+ render: (data) => {
8
+ const d = data;
9
+ if (d.interactive)
10
+ return "";
11
+ if (d.ok) {
12
+ const lines = [
13
+ "Gateway configured successfully.",
14
+ "",
15
+ ` URL ${d.gatewayUrl ?? "(set)"}`,
16
+ ` Config ${d.configPath ?? "~/.taskmeld/config.json"}`,
17
+ "",
18
+ ' Run "taskmeld server start" to begin.',
19
+ ];
20
+ return lines.join("\n");
21
+ }
22
+ return "Setup was not completed.";
23
+ },
24
+ },
25
+ };
@@ -0,0 +1,561 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pipelineRenderSpecs = void 0;
4
+ const utils_1 = require("../engine/utils");
5
+ const isPipelineStatusIdlePayload = (value) => {
6
+ const payload = (0, utils_1.readRecord)(value);
7
+ return payload.running === false && typeof payload.message === "string";
8
+ };
9
+ const buildNodeRows = (data) => {
10
+ const detail = (0, utils_1.readRecord)(data);
11
+ const workflow = (0, utils_1.readRecord)(detail.workflow);
12
+ const nodes = (0, utils_1.asArray)(workflow.nodes);
13
+ if (nodes.length === 0)
14
+ return [];
15
+ const edges = (0, utils_1.asArray)(workflow.edges);
16
+ const downstreamByNode = new Map();
17
+ for (const edge of edges) {
18
+ const edgeRec = (0, utils_1.readRecord)(edge);
19
+ const from = (0, utils_1.pickText)(edgeRec.from);
20
+ const to = (0, utils_1.pickText)(edgeRec.to);
21
+ if (from === "-" || to === "-")
22
+ continue;
23
+ const when = (0, utils_1.pickText)(edgeRec.when);
24
+ const label = when !== "-" ? `${to}(${when})` : to;
25
+ const bucket = downstreamByNode.get(from) ?? [];
26
+ bucket.push(label);
27
+ downstreamByNode.set(from, bucket);
28
+ }
29
+ return nodes.map((node) => {
30
+ const nodeRec = (0, utils_1.readRecord)(node);
31
+ const executor = (0, utils_1.readRecord)(nodeRec.executor);
32
+ const nodeId = (0, utils_1.pickText)(nodeRec.id);
33
+ const downstream = downstreamByNode.get(nodeId) ?? [];
34
+ return {
35
+ nodeId: nodeRec.id,
36
+ title: nodeRec.name ?? nodeRec.title ?? "-",
37
+ agent: executor.agentId,
38
+ lane: nodeRec.lane ?? "-",
39
+ downstream: downstream.length > 0 ? downstream.join(", ") : "-",
40
+ };
41
+ });
42
+ };
43
+ const statusSections = (showLastCompleted) => [
44
+ {
45
+ title: "Summary",
46
+ kind: "custom",
47
+ visible: (data) => isPipelineStatusIdlePayload((0, utils_1.readRecord)(data)),
48
+ render: (data) => {
49
+ const payload = (0, utils_1.readRecord)(data);
50
+ const lines = ["No active pipeline run."];
51
+ if (typeof payload.lastBatchRunId === "string" && payload.lastBatchRunId.trim()) {
52
+ lines.push("", `Last batch run: ${payload.lastBatchRunId.trim()}`);
53
+ }
54
+ else if (typeof payload.lastRunId === "string" && payload.lastRunId.trim()) {
55
+ lines.push("", `Last run: ${payload.lastRunId.trim()}`);
56
+ }
57
+ if (showLastCompleted && typeof payload.lastCompletedAt === "string" && payload.lastCompletedAt.trim()) {
58
+ lines.push(`Last completed at: ${payload.lastCompletedAt.trim()}`);
59
+ }
60
+ return lines;
61
+ },
62
+ },
63
+ {
64
+ title: "Summary",
65
+ kind: "key-value",
66
+ visible: (data) => !isPipelineStatusIdlePayload((0, utils_1.readRecord)(data)),
67
+ rows: (data) => {
68
+ const payload = (0, utils_1.readRecord)(data);
69
+ const status = (0, utils_1.readRecord)(payload.status);
70
+ const batchRun = (0, utils_1.readRecord)(status.batchRun);
71
+ const rows = [
72
+ { field: "Pipeline ID", value: status.pipelineId },
73
+ { field: "Mode", value: status.mode },
74
+ { field: "Running", value: status.running },
75
+ { field: "Run ID", value: status.runId },
76
+ { field: "Run Status", value: status.runStatus },
77
+ ];
78
+ if (batchRun.batchRunId) {
79
+ rows.push({ field: "Batch Run ID", value: batchRun.batchRunId });
80
+ }
81
+ rows.push({ field: "Active Nodes", value: (0, utils_1.asArray)(status.activeNodeIds).map((n) => (0, utils_1.pickText)(n)).join(", ") || "-" }, { field: "Pending Nodes", value: (0, utils_1.asArray)(status.pendingNodeIds).map((n) => (0, utils_1.pickText)(n)).join(", ") || "-" }, { field: "Updated At", value: status.updatedAt }, { field: "Last Error", value: status.lastError });
82
+ return rows;
83
+ },
84
+ },
85
+ {
86
+ title: "Batch Run",
87
+ kind: "key-value",
88
+ visible: (data) => {
89
+ const payload = (0, utils_1.readRecord)(data);
90
+ if (isPipelineStatusIdlePayload(payload))
91
+ return false;
92
+ return (0, utils_1.readRecord)(payload.status).mode === "remote_batch";
93
+ },
94
+ rows: (data) => {
95
+ const payload = (0, utils_1.readRecord)(data);
96
+ const status = (0, utils_1.readRecord)(payload.status);
97
+ const batchRun = (0, utils_1.readRecord)(status.batchRun);
98
+ return [
99
+ { field: "Status", value: batchRun.status },
100
+ { field: "Batch Size", value: batchRun.batchSize },
101
+ { field: "Total Items", value: batchRun.totalItems },
102
+ { field: "Processed Items", value: batchRun.processedItems },
103
+ { field: "Processed Batches", value: batchRun.processedBatches },
104
+ { field: "Next Batch Index", value: batchRun.nextBatchIndex },
105
+ ];
106
+ },
107
+ },
108
+ {
109
+ title: "Current Batch",
110
+ kind: "key-value",
111
+ visible: (data) => {
112
+ const payload = (0, utils_1.readRecord)(data);
113
+ if (isPipelineStatusIdlePayload(payload))
114
+ return false;
115
+ return (0, utils_1.readRecord)(payload.status).mode === "remote_batch";
116
+ },
117
+ rows: (data) => {
118
+ const payload = (0, utils_1.readRecord)(data);
119
+ const status = (0, utils_1.readRecord)(payload.status);
120
+ const currentBatch = (0, utils_1.readRecord)(status.currentBatch);
121
+ return [
122
+ { field: "Index", value: currentBatch.index },
123
+ { field: "Item Key", value: currentBatch.itemKey },
124
+ { field: "Items", value: (0, utils_1.asArray)(currentBatch.items).map((item) => (0, utils_1.pickText)(item)).join(", ") || "-" },
125
+ { field: "Running Nodes", value: (0, utils_1.asArray)(currentBatch.runningNodeIds).map((item) => (0, utils_1.pickText)(item)).join(", ") || "-" },
126
+ { field: "Pending Nodes", value: (0, utils_1.asArray)(currentBatch.pendingNodeIds).map((item) => (0, utils_1.pickText)(item)).join(", ") || "-" },
127
+ { field: "Completed Nodes", value: (0, utils_1.asArray)(currentBatch.completedNodeIds).map((item) => (0, utils_1.pickText)(item)).join(", ") || "-" },
128
+ { field: "Failed Nodes", value: (0, utils_1.asArray)(currentBatch.failedNodeIds).map((item) => (0, utils_1.pickText)(item)).join(", ") || "-" },
129
+ ];
130
+ },
131
+ },
132
+ ];
133
+ exports.pipelineRenderSpecs = {
134
+ "pipeline.list": {
135
+ kind: "list",
136
+ title: "Pipeline List",
137
+ columns: [
138
+ {
139
+ title: "ID",
140
+ render: (row) => row.id ?? row.pipelineId ?? "-",
141
+ },
142
+ {
143
+ title: "Title",
144
+ render: (row) => row.title ?? row.name ?? "-",
145
+ },
146
+ ],
147
+ },
148
+ "pipeline.start": {
149
+ kind: "detail",
150
+ title: "Pipeline Started",
151
+ sections: [
152
+ {
153
+ title: "Basic",
154
+ kind: "key-value",
155
+ rows: (data) => {
156
+ const d = (0, utils_1.readRecord)(data);
157
+ if (d.ok === false)
158
+ return null;
159
+ const isBatch = d.mode === "remote_batch";
160
+ if (isBatch) {
161
+ const batchRun = (0, utils_1.readRecord)(d.batchRun);
162
+ return [
163
+ { field: "Pipeline ID", value: d.pipelineId },
164
+ { field: "Batch Run ID", value: d.batchRunId },
165
+ { field: "Run ID", value: d.runId },
166
+ { field: "Remote URL", value: d.remoteUrl },
167
+ { field: "Status", value: batchRun.status },
168
+ { field: "Total Fetched", value: d.totalFetched },
169
+ { field: "Batch Size", value: batchRun.batchSize },
170
+ { field: "Total Batches", value: batchRun.totalBatches },
171
+ ];
172
+ }
173
+ return [
174
+ { field: "Pipeline ID", value: d.pipelineId },
175
+ { field: "Run ID", value: d.runId },
176
+ { field: "Status", value: (0, utils_1.readRecord)(d.run).status },
177
+ ];
178
+ },
179
+ },
180
+ {
181
+ title: "Nodes",
182
+ kind: "table",
183
+ columns: [
184
+ { title: "Node ID", render: (r) => r.nodeId },
185
+ { title: "Title", render: (r) => r.title },
186
+ { title: "Agent", render: (r) => r.agent },
187
+ { title: "Lane", render: (r) => r.lane },
188
+ { title: "Downstream", render: (r) => r.downstream },
189
+ ],
190
+ rows: (data) => {
191
+ const d = (0, utils_1.readRecord)(data);
192
+ if (d.ok === false)
193
+ return null;
194
+ const isBatch = d.mode === "remote_batch";
195
+ const rawNodes = isBatch
196
+ ? (0, utils_1.asArray)(d.templateNodes).map((n) => (0, utils_1.readRecord)(n))
197
+ : (0, utils_1.asArray)((0, utils_1.readRecord)(d.run).nodes).map((n) => (0, utils_1.readRecord)(n));
198
+ if (rawNodes.length === 0)
199
+ return null;
200
+ const laneByNode = new Map();
201
+ const wfNodes = (0, utils_1.asArray)(d.workflowNodes);
202
+ for (const wn of wfNodes) {
203
+ const w = (0, utils_1.readRecord)(wn);
204
+ laneByNode.set((0, utils_1.pickText)(w.id), (0, utils_1.pickText)(w.lane));
205
+ }
206
+ const downstreamByNode = new Map();
207
+ const edges = isBatch
208
+ ? (0, utils_1.asArray)(d.edges)
209
+ : (0, utils_1.asArray)((0, utils_1.readRecord)((0, utils_1.readRecord)(data).workflow).edges);
210
+ for (const edge of edges) {
211
+ const edgeRec = (0, utils_1.readRecord)(edge);
212
+ const from = (0, utils_1.pickText)(edgeRec.from);
213
+ const to = (0, utils_1.pickText)(edgeRec.to);
214
+ if (from === "-" || to === "-")
215
+ continue;
216
+ const when = (0, utils_1.pickText)(edgeRec.when);
217
+ const label = when !== "-" ? `${to}(${when})` : to;
218
+ const bucket = downstreamByNode.get(from) ?? [];
219
+ bucket.push(label);
220
+ downstreamByNode.set(from, bucket);
221
+ }
222
+ if (downstreamByNode.size === 0) {
223
+ for (const n of rawNodes) {
224
+ const from = (0, utils_1.pickText)(n.id);
225
+ for (const parent of (0, utils_1.asArray)(n.dependsOn)) {
226
+ const parentId = (0, utils_1.pickText)(parent);
227
+ if (parentId === "-")
228
+ continue;
229
+ const bucket = downstreamByNode.get(parentId) ?? [];
230
+ bucket.push(from);
231
+ downstreamByNode.set(parentId, bucket);
232
+ }
233
+ }
234
+ }
235
+ return rawNodes.map((n) => {
236
+ const nodeId = (0, utils_1.pickText)(n.id);
237
+ const executor = (0, utils_1.readRecord)(n.executor);
238
+ const downstream = downstreamByNode.get(nodeId) ?? [];
239
+ return {
240
+ nodeId,
241
+ title: n.title ?? n.name ?? "-",
242
+ agent: executor.agentId ?? "-",
243
+ lane: laneByNode.get(nodeId) ?? "-",
244
+ downstream: downstream.length > 0 ? downstream.join(", ") : "-",
245
+ };
246
+ });
247
+ },
248
+ },
249
+ {
250
+ title: "Batch Items",
251
+ kind: "key-value",
252
+ rows: (data) => {
253
+ const d = (0, utils_1.readRecord)(data);
254
+ if (d.ok === false || d.mode !== "remote_batch")
255
+ return null;
256
+ const batchRun = (0, utils_1.readRecord)(d.batchRun);
257
+ const items = (0, utils_1.asArray)(batchRun.currentBatchItems);
258
+ const preview = items.slice(0, 10).map((item) => (0, utils_1.pickText)(item));
259
+ if (items.length > 10)
260
+ preview.push(`... and ${items.length - 10} more`);
261
+ return [
262
+ { field: "Batch Index", value: batchRun.currentBatchIndex },
263
+ { field: "Item Key", value: batchRun.currentBatchItemKey },
264
+ { field: "Items", value: preview.join(", ") || "-" },
265
+ ];
266
+ },
267
+ },
268
+ ],
269
+ },
270
+ "pipeline.stop": {
271
+ kind: "detail",
272
+ title: "Pipeline Stopped",
273
+ sections: [
274
+ {
275
+ title: "Basic",
276
+ kind: "key-value",
277
+ rows: (data) => {
278
+ const d = (0, utils_1.readRecord)(data);
279
+ return [
280
+ { field: "Pipeline ID", value: d.pipelineId },
281
+ { field: "Batch Run ID", value: d.batchRunId },
282
+ { field: "Run ID", value: d.runId },
283
+ { field: "Stop Status", value: (0, utils_1.readRecord)(d.stopped).ok ? "stopped" : "failed" },
284
+ ];
285
+ },
286
+ },
287
+ {
288
+ title: "Current Run",
289
+ kind: "key-value",
290
+ rows: (data) => {
291
+ const d = (0, utils_1.readRecord)(data);
292
+ const status = (0, utils_1.readRecord)(d.status);
293
+ const activeIds = (0, utils_1.asArray)(status.activeNodeIds).map((n) => (0, utils_1.pickText)(n)).filter((n) => n !== "-");
294
+ const pendingIds = (0, utils_1.asArray)(status.pendingNodeIds).map((n) => (0, utils_1.pickText)(n)).filter((n) => n !== "-");
295
+ return [
296
+ { field: "Run Status", value: status.runStatus },
297
+ { field: "Active Nodes", value: activeIds.length > 0 ? activeIds.join(", ") : "-" },
298
+ { field: "Pending Nodes", value: pendingIds.length > 0 ? pendingIds.join(", ") : "-" },
299
+ ];
300
+ },
301
+ },
302
+ ],
303
+ },
304
+ "pipeline.get": {
305
+ kind: "detail",
306
+ title: "Pipeline Detail",
307
+ sections: [
308
+ {
309
+ title: "Basic",
310
+ kind: "key-value",
311
+ rows: (data) => {
312
+ const detail = (0, utils_1.readRecord)(data);
313
+ const workflow = (0, utils_1.readRecord)(detail.workflow);
314
+ const nodes = (0, utils_1.asArray)(workflow.nodes);
315
+ return [
316
+ { field: "ID", value: detail.pipelineId ?? detail.id },
317
+ { field: "Title", value: detail.title ?? detail.name },
318
+ { field: "Total Nodes", value: nodes.length },
319
+ { field: "Mainline Nodes", value: nodes.filter((n) => (0, utils_1.readRecord)(n).lane === "main").length },
320
+ { field: "Branch Nodes", value: nodes.filter((n) => (0, utils_1.readRecord)(n).lane === "branch").length },
321
+ ];
322
+ },
323
+ },
324
+ {
325
+ title: "Nodes",
326
+ kind: "table",
327
+ columns: [
328
+ { title: "Node ID", render: (r) => r.nodeId },
329
+ { title: "Title", render: (r) => r.title },
330
+ { title: "Agent", render: (r) => r.agent },
331
+ { title: "Lane", render: (r) => r.lane },
332
+ { title: "Downstream", render: (r) => r.downstream },
333
+ ],
334
+ rows: (data) => buildNodeRows(data),
335
+ },
336
+ {
337
+ title: "Scheduler Plugin",
338
+ kind: "key-value",
339
+ rows: (data) => {
340
+ const detail = (0, utils_1.readRecord)(data);
341
+ const workflow = (0, utils_1.readRecord)(detail.workflow);
342
+ const plugins = (0, utils_1.readRecord)(workflow.plugins);
343
+ const schedulerPlugin = (0, utils_1.readRecord)(plugins.scheduler);
344
+ if (schedulerPlugin.enabled === false)
345
+ return null;
346
+ const scheduler = (0, utils_1.readRecord)(workflow.scheduler);
347
+ const loopGuard = (0, utils_1.readRecord)(scheduler.loopGuard);
348
+ return [
349
+ { field: "Mode", value: scheduler.mode },
350
+ { field: "Dispatch By", value: scheduler.dispatchBy },
351
+ { field: "Max Concurrency", value: scheduler.maxConcurrency },
352
+ { field: "Max Global Iterations", value: loopGuard.maxGlobalIterations },
353
+ { field: "Max Per Item Loop", value: loopGuard.maxPerItemLoop },
354
+ ];
355
+ },
356
+ },
357
+ {
358
+ title: "Batch Plugin",
359
+ kind: "key-value",
360
+ rows: (data) => {
361
+ const detail = (0, utils_1.readRecord)(data);
362
+ const workflow = (0, utils_1.readRecord)(detail.workflow);
363
+ const plugins = (0, utils_1.readRecord)(workflow.plugins);
364
+ const remoteBatchPlugin = (0, utils_1.readRecord)(plugins.remoteBatch);
365
+ if (remoteBatchPlugin.enabled === false)
366
+ return null;
367
+ return [
368
+ { field: "Remote URL", value: remoteBatchPlugin.url },
369
+ { field: "Source Field", value: remoteBatchPlugin.sourceField },
370
+ { field: "Batch Size", value: remoteBatchPlugin.batchSize },
371
+ { field: "Start Batch", value: remoteBatchPlugin.startBatch },
372
+ ];
373
+ },
374
+ },
375
+ ],
376
+ },
377
+ "pipeline.status": {
378
+ kind: "detail",
379
+ title: "Pipeline Status",
380
+ sections: statusSections(true),
381
+ },
382
+ "pipeline.watch": {
383
+ kind: "detail",
384
+ title: "Pipeline Watch",
385
+ sections: statusSections(false),
386
+ },
387
+ "pipeline.retry-node": {
388
+ kind: "detail",
389
+ title: "Node Retry",
390
+ sections: [
391
+ {
392
+ title: "Summary",
393
+ kind: "key-value",
394
+ rows: (data) => {
395
+ const d = (0, utils_1.readRecord)(data);
396
+ const retry = (0, utils_1.readRecord)(d.retry);
397
+ return [
398
+ { field: "Pipeline ID", value: d.pipelineId },
399
+ { field: "Retry OK", value: retry.ok ?? false },
400
+ ];
401
+ },
402
+ },
403
+ ],
404
+ },
405
+ "pipeline.result": {
406
+ kind: "detail",
407
+ title: "Pipeline Result",
408
+ sections: [
409
+ {
410
+ title: "Run Info",
411
+ kind: "key-value",
412
+ rows: (data) => {
413
+ const d = (0, utils_1.readRecord)(data);
414
+ const rows = [
415
+ { field: "Pipeline", value: `${d.title} (${d.pipelineId})` },
416
+ { field: "Run ID", value: d.runId },
417
+ { field: "Status", value: d.runStatus },
418
+ ];
419
+ if (d.batchRunId) {
420
+ rows.push({ field: "Batch Run", value: d.batchRunId });
421
+ }
422
+ return rows;
423
+ },
424
+ },
425
+ {
426
+ title: "Nodes",
427
+ kind: "table",
428
+ visible: (data) => !(0, utils_1.readRecord)(data).isBatch,
429
+ columns: [
430
+ { title: "Node", render: (r) => `${r.nodeId} (${r.status})` },
431
+ { title: "Title", render: (r) => r.title },
432
+ { title: "Error", render: (r) => r.lastError ?? "-" },
433
+ ],
434
+ rows: (data) => {
435
+ const nodes = (0, utils_1.asArray)((0, utils_1.readRecord)(data).nodes).map((n) => (0, utils_1.readRecord)(n));
436
+ return nodes.length > 0 ? nodes : null;
437
+ },
438
+ },
439
+ {
440
+ title: "Batches",
441
+ kind: "table",
442
+ visible: (data) => (0, utils_1.readRecord)(data).isBatch === true,
443
+ columns: [
444
+ { title: "Batch", render: (r) => r.itemKey },
445
+ { title: "Node", render: (r) => `${r.nodeId} (${r.status})` },
446
+ { title: "Title", render: (r) => r.title },
447
+ { title: "Error", render: (r) => r.lastError ?? "-" },
448
+ ],
449
+ rows: (data) => {
450
+ const d = (0, utils_1.readRecord)(data);
451
+ const batches = (0, utils_1.asArray)(d.batches).map((b) => (0, utils_1.readRecord)(b));
452
+ const rows = [];
453
+ for (const batch of batches) {
454
+ const nodes = (0, utils_1.asArray)(batch.nodes).map((n) => {
455
+ const r = (0, utils_1.readRecord)(n);
456
+ return { ...r, itemKey: batch.itemKey };
457
+ });
458
+ rows.push(...nodes);
459
+ }
460
+ return rows.length > 0 ? rows : null;
461
+ },
462
+ },
463
+ {
464
+ title: "Results",
465
+ kind: "custom",
466
+ render: (data) => {
467
+ const d = (0, utils_1.readRecord)(data);
468
+ const lines = [];
469
+ const showNodeContent = (node) => {
470
+ const status = (0, utils_1.pickText)(node.status);
471
+ const hasContent = (Array.isArray(node.content) && node.content.length > 0) || (typeof node.content === "string" && node.content);
472
+ if (!hasContent && !node.lastError)
473
+ return;
474
+ lines.push(`### ${(0, utils_1.pickText)(node.nodeId)} (${status})`);
475
+ if (node.lastError) {
476
+ lines.push(`Error: ${(0, utils_1.pickText)(node.lastError)}`);
477
+ }
478
+ if (hasContent) {
479
+ if (typeof node.content === "string") {
480
+ lines.push(node.content);
481
+ }
482
+ else if (Array.isArray(node.content)) {
483
+ for (const c of node.content) {
484
+ lines.push(c);
485
+ }
486
+ }
487
+ }
488
+ else {
489
+ lines.push("(no content)");
490
+ }
491
+ if (node.logs && Array.isArray(node.logs) && node.logs.length > 0) {
492
+ lines.push("", "Logs:", JSON.stringify(node.logs, null, 2));
493
+ }
494
+ lines.push("");
495
+ };
496
+ if (d.isBatch) {
497
+ const batches = (0, utils_1.asArray)(d.batches).map((b) => (0, utils_1.readRecord)(b));
498
+ if (batches.length === 0) {
499
+ lines.push("(no batch results)");
500
+ }
501
+ else {
502
+ for (const batch of batches) {
503
+ const batchNodes = (0, utils_1.asArray)(batch.nodes).map((n) => (0, utils_1.readRecord)(n));
504
+ const activeNodes = batchNodes.filter((n) => {
505
+ const hasContent = (Array.isArray(n.content) && n.content.length > 0) || (typeof n.content === "string" && n.content);
506
+ return hasContent || n.lastError;
507
+ });
508
+ if (activeNodes.length === 0)
509
+ continue;
510
+ lines.push(`## Batch ${(0, utils_1.pickText)(batch.itemKey)}`);
511
+ for (const node of activeNodes) {
512
+ showNodeContent(node);
513
+ }
514
+ }
515
+ }
516
+ }
517
+ else {
518
+ const nodes = (0, utils_1.asArray)(d.nodes).map((n) => (0, utils_1.readRecord)(n));
519
+ const activeNodes = nodes.filter((n) => {
520
+ const hasContent = (Array.isArray(n.content) && n.content.length > 0) || (typeof n.content === "string" && n.content);
521
+ return hasContent || n.lastError;
522
+ });
523
+ if (activeNodes.length === 0) {
524
+ lines.push("(no results)");
525
+ }
526
+ else {
527
+ for (const node of activeNodes) {
528
+ const status = (0, utils_1.pickText)(node.status);
529
+ const hasContent = (Array.isArray(node.content) && node.content.length > 0) || (typeof node.content === "string" && node.content);
530
+ if (!hasContent && !node.lastError)
531
+ continue;
532
+ lines.push(`## ${(0, utils_1.pickText)(node.nodeId)} (${status})`);
533
+ if (node.lastError) {
534
+ lines.push(`Error: ${(0, utils_1.pickText)(node.lastError)}`);
535
+ }
536
+ if (hasContent) {
537
+ if (typeof node.content === "string") {
538
+ lines.push(node.content);
539
+ }
540
+ else if (Array.isArray(node.content)) {
541
+ for (const c of node.content) {
542
+ lines.push(c);
543
+ }
544
+ }
545
+ }
546
+ else {
547
+ lines.push("(no content)");
548
+ }
549
+ if (node.logs && Array.isArray(node.logs) && node.logs.length > 0) {
550
+ lines.push("", "Logs:", JSON.stringify(node.logs, null, 2));
551
+ }
552
+ lines.push("");
553
+ }
554
+ }
555
+ }
556
+ return lines.length > 0 ? lines : null;
557
+ },
558
+ },
559
+ ],
560
+ },
561
+ };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schedulerRenderSpecs = void 0;
4
+ const utils_1 = require("../engine/utils");
5
+ exports.schedulerRenderSpecs = {
6
+ "scheduler.toggle": {
7
+ kind: "detail",
8
+ title: "Scheduler Toggle",
9
+ sections: [
10
+ {
11
+ title: "Summary",
12
+ kind: "key-value",
13
+ rows: (data) => {
14
+ const detail = (0, utils_1.readRecord)(data);
15
+ const scheduler = (0, utils_1.readRecord)(detail.scheduler);
16
+ return [
17
+ { field: "OK", value: detail.ok ?? detail.OK },
18
+ { field: "Pipeline ID", value: detail.pipelineId },
19
+ { field: "Enabled", value: scheduler.enabled },
20
+ { field: "Mode", value: scheduler.mode },
21
+ ];
22
+ },
23
+ },
24
+ ],
25
+ },
26
+ "scheduler.mode": {
27
+ kind: "detail",
28
+ title: "Scheduler Mode",
29
+ sections: [
30
+ {
31
+ title: "Summary",
32
+ kind: "key-value",
33
+ rows: (data) => {
34
+ const detail = (0, utils_1.readRecord)(data);
35
+ const scheduler = (0, utils_1.readRecord)(detail.scheduler);
36
+ return [
37
+ { field: "OK", value: detail.ok ?? detail.OK },
38
+ { field: "Pipeline ID", value: detail.pipelineId },
39
+ { field: "Enabled", value: scheduler.enabled },
40
+ { field: "Mode", value: scheduler.mode },
41
+ ];
42
+ },
43
+ },
44
+ ],
45
+ },
46
+ };