@ryanfw/prompt-orchestration-pipeline 0.12.0 → 0.13.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 (60) hide show
  1. package/package.json +10 -1
  2. package/src/cli/analyze-task.js +51 -0
  3. package/src/cli/index.js +8 -0
  4. package/src/components/AddPipelineSidebar.jsx +144 -0
  5. package/src/components/AnalysisProgressTray.jsx +87 -0
  6. package/src/components/JobTable.jsx +4 -3
  7. package/src/components/Layout.jsx +142 -139
  8. package/src/components/MarkdownRenderer.jsx +149 -0
  9. package/src/components/PipelineDAGGrid.jsx +404 -0
  10. package/src/components/PipelineTypeTaskSidebar.jsx +96 -0
  11. package/src/components/SchemaPreviewPanel.jsx +97 -0
  12. package/src/components/StageTimeline.jsx +36 -0
  13. package/src/components/TaskAnalysisDisplay.jsx +227 -0
  14. package/src/components/TaskCreationSidebar.jsx +447 -0
  15. package/src/components/TaskDetailSidebar.jsx +119 -117
  16. package/src/components/TaskFilePane.jsx +94 -39
  17. package/src/components/ui/button.jsx +59 -27
  18. package/src/components/ui/sidebar.jsx +118 -0
  19. package/src/config/models.js +99 -67
  20. package/src/core/config.js +4 -1
  21. package/src/llm/index.js +129 -9
  22. package/src/pages/PipelineDetail.jsx +6 -6
  23. package/src/pages/PipelineList.jsx +214 -0
  24. package/src/pages/PipelineTypeDetail.jsx +234 -0
  25. package/src/providers/deepseek.js +76 -16
  26. package/src/providers/openai.js +61 -34
  27. package/src/task-analysis/enrichers/analysis-writer.js +62 -0
  28. package/src/task-analysis/enrichers/schema-deducer.js +145 -0
  29. package/src/task-analysis/enrichers/schema-writer.js +74 -0
  30. package/src/task-analysis/extractors/artifacts.js +137 -0
  31. package/src/task-analysis/extractors/llm-calls.js +176 -0
  32. package/src/task-analysis/extractors/stages.js +51 -0
  33. package/src/task-analysis/index.js +103 -0
  34. package/src/task-analysis/parser.js +28 -0
  35. package/src/task-analysis/utils/ast.js +43 -0
  36. package/src/ui/client/hooks/useAnalysisProgress.js +145 -0
  37. package/src/ui/client/index.css +64 -0
  38. package/src/ui/client/main.jsx +4 -0
  39. package/src/ui/client/sse-fetch.js +120 -0
  40. package/src/ui/dist/assets/index-cjHV9mYW.js +82578 -0
  41. package/src/ui/dist/assets/index-cjHV9mYW.js.map +1 -0
  42. package/src/ui/dist/assets/style-CoM9SoQF.css +180 -0
  43. package/src/ui/dist/index.html +2 -2
  44. package/src/ui/endpoints/create-pipeline-endpoint.js +194 -0
  45. package/src/ui/endpoints/pipeline-analysis-endpoint.js +246 -0
  46. package/src/ui/endpoints/pipeline-type-detail-endpoint.js +181 -0
  47. package/src/ui/endpoints/pipelines-endpoint.js +133 -0
  48. package/src/ui/endpoints/schema-file-endpoint.js +105 -0
  49. package/src/ui/endpoints/task-analysis-endpoint.js +104 -0
  50. package/src/ui/endpoints/task-creation-endpoint.js +114 -0
  51. package/src/ui/endpoints/task-save-endpoint.js +101 -0
  52. package/src/ui/express-app.js +45 -0
  53. package/src/ui/lib/analysis-lock.js +67 -0
  54. package/src/ui/lib/sse.js +30 -0
  55. package/src/ui/server.js +4 -0
  56. package/src/ui/utils/slug.js +31 -0
  57. package/src/ui/watcher.js +28 -2
  58. package/src/ui/dist/assets/index-B320avRx.js +0 -26613
  59. package/src/ui/dist/assets/index-B320avRx.js.map +0 -1
  60. package/src/ui/dist/assets/style-BYCoLBnK.css +0 -62
@@ -0,0 +1,30 @@
1
+ export function streamSSE(res) {
2
+ console.log("[sse] Creating new SSE stream");
3
+
4
+ res.setHeader("Content-Type", "text/event-stream");
5
+ res.setHeader("Cache-Control", "no-cache");
6
+ res.setHeader("Connection", "keep-alive");
7
+ res.flushHeaders();
8
+
9
+ console.log("[sse] SSE headers set and flushed");
10
+
11
+ return {
12
+ send(event, data) {
13
+ console.log("[sse] Sending event:", {
14
+ eventType: event,
15
+ hasData: !!data,
16
+ dataKeys: data ? Object.keys(data) : [],
17
+ });
18
+
19
+ const eventData = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
20
+ res.write(eventData);
21
+
22
+ console.log("[sse] Event sent successfully");
23
+ },
24
+ end() {
25
+ console.log("[sse] Ending SSE stream");
26
+ res.end();
27
+ console.log("[sse] SSE stream ended");
28
+ },
29
+ };
30
+ }
package/src/ui/server.js CHANGED
@@ -6,6 +6,7 @@
6
6
  import http from "http";
7
7
  import path from "path";
8
8
  import { fileURLToPath } from "url";
9
+ import { loadEnvironment } from "../core/environment.js";
9
10
  import { start as startWatcher, stop as stopWatcher } from "./watcher.js";
10
11
  import * as state from "./state.js";
11
12
  import { sseRegistry } from "./sse.js";
@@ -135,6 +136,9 @@ function initializeWatcher() {
135
136
  */
136
137
  async function startServer({ dataDir, port: customPort }) {
137
138
  try {
139
+ // Load environment variables from .env file for API keys and other config
140
+ await loadEnvironment();
141
+
138
142
  // Initialize config-bridge paths early to ensure consistent path resolution
139
143
  // This prevents path caching issues when dataDir changes between tests
140
144
  const { initPATHS } = await import("./config-bridge.node.js");
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Slug utility functions for pipeline type creation
3
+ */
4
+
5
+ /**
6
+ * Generate a URL-friendly slug from a pipeline name
7
+ * @param {string} name - The pipeline name
8
+ * @returns {string} A URL-friendly slug (max 47 chars)
9
+ */
10
+ export function generateSlug(name) {
11
+ return name
12
+ .toLowerCase()
13
+ .replace(/[^a-z0-9]+/g, "-")
14
+ .replace(/^-|-$/g, "")
15
+ .substring(0, 47);
16
+ }
17
+
18
+ /**
19
+ * Ensure slug uniqueness by appending numeric suffixes
20
+ * @param {string} baseSlug - The base slug to make unique
21
+ * @param {Set<string>} existingSlugs - Set of existing slugs
22
+ * @returns {string} A unique slug
23
+ */
24
+ export function ensureUniqueSlug(baseSlug, existingSlugs) {
25
+ if (!existingSlugs.has(baseSlug)) return baseSlug;
26
+ let suffix = 1;
27
+ while (existingSlugs.has(`${baseSlug}-${suffix}`)) {
28
+ suffix++;
29
+ }
30
+ return `${baseSlug}-${suffix}`;
31
+ }
package/src/ui/watcher.js CHANGED
@@ -63,13 +63,26 @@ export function start(paths, onChange, options = {}) {
63
63
  };
64
64
 
65
65
  // Handle file events
66
- watcher.on("add", (rawPath) => {
66
+ watcher.on("add", async (rawPath) => {
67
67
  // Compute relative path from baseDir and normalize
68
68
  const rel = normalizePath(path.relative(baseDir, rawPath));
69
69
  // Always use relative path for consistency with tests
70
70
  const normalizedPath = rel;
71
71
 
72
72
  console.debug("[Watcher] File added:", normalizedPath);
73
+
74
+ // Detect registry.json changes and reload config
75
+ if (normalizedPath === "pipeline-config/registry.json") {
76
+ console.log("[Watcher] registry.json added, reloading config...");
77
+ try {
78
+ const { resetConfig } = await import("../core/config.js");
79
+ resetConfig();
80
+ console.log("[Watcher] Config cache invalidated successfully");
81
+ } catch (error) {
82
+ console.error("[Watcher] Failed to reload config:", error);
83
+ }
84
+ }
85
+
73
86
  pendingChanges.push({ path: normalizedPath, type: "created" });
74
87
  scheduleFlush();
75
88
 
@@ -81,13 +94,26 @@ export function start(paths, onChange, options = {}) {
81
94
  }
82
95
  });
83
96
 
84
- watcher.on("change", (rawPath) => {
97
+ watcher.on("change", async (rawPath) => {
85
98
  // Compute relative path from baseDir and normalize
86
99
  const rel = normalizePath(path.relative(baseDir, rawPath));
87
100
  // Always use relative path for consistency with tests
88
101
  const normalizedPath = rel;
89
102
 
90
103
  console.debug("[Watcher] File changed:", normalizedPath);
104
+
105
+ // Detect registry.json changes and reload config
106
+ if (normalizedPath === "pipeline-config/registry.json") {
107
+ console.log("[Watcher] registry.json modified, reloading config...");
108
+ try {
109
+ const { resetConfig } = await import("../core/config.js");
110
+ resetConfig();
111
+ console.log("[Watcher] Config cache invalidated successfully");
112
+ } catch (error) {
113
+ console.error("[Watcher] Failed to reload config:", error);
114
+ }
115
+ }
116
+
91
117
  pendingChanges.push({ path: normalizedPath, type: "modified" });
92
118
  scheduleFlush();
93
119