@signalridge/pi-workflows 1.3.2 → 1.5.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.
- package/CHANGELOG.md +140 -0
- package/README.md +93 -22
- package/package.json +5 -4
- package/skills/workflow-authoring/SKILL.md +171 -18
- package/skills/workflow-authoring/examples/named-task-graph.js +34 -0
- package/skills/workflow-authoring/references/capabilities.md +4 -3
- package/skills/workflow-authoring/references/capability-details.md +28 -8
- package/skills/workflow-authoring/references/debugging.md +2 -2
- package/skills/workflow-authoring/references/focused-recipes.md +1 -0
- package/skills/workflow-authoring/references/lifecycle.md +3 -3
- package/skills/workflow-authoring/references/pattern-selection.md +1 -0
- package/skills/workflow-authoring/references/registry-ownership.md +6 -4
- package/skills/workflow-authoring/references/review.md +12 -7
- package/skills/workflow-authoring/references/runtime.md +6 -5
- package/skills/workflow-authoring/references/versions.md +1 -1
- package/skills/workflow-patterns/SKILL.md +72 -33
- package/skills/workflow-review/SKILL.md +70 -0
- package/src/builtins.ts +23 -23
- package/src/capabilities.ts +39 -7
- package/src/engine.ts +582 -142
- package/src/index.ts +413 -154
- package/src/journal.ts +447 -169
- package/src/orchestrator.ts +478 -0
- package/src/rpc-client.ts +37 -48
- package/src/runtime.ts +508 -167
- package/src/ui.ts +29 -4
package/src/ui.ts
CHANGED
|
@@ -172,12 +172,30 @@ async function selectList<T>(
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
/** Interactive `/workflows` navigator. TUI-only by design. */
|
|
175
|
-
export async function showWorkflowNavigator(
|
|
175
|
+
export async function showWorkflowNavigator(
|
|
176
|
+
ctx: ExtensionCommandContext,
|
|
177
|
+
engineSource: WorkflowEngine | (() => WorkflowEngine),
|
|
178
|
+
): Promise<void> {
|
|
176
179
|
if (ctx.mode !== "tui") {
|
|
177
180
|
ctx.ui.notify("/workflows requires TUI mode; use workflow_control for machine-readable access.", "warning");
|
|
178
181
|
return;
|
|
179
182
|
}
|
|
183
|
+
const resolveEngine = typeof engineSource === "function" ? engineSource : () => engineSource;
|
|
184
|
+
let inactiveNotified = false;
|
|
185
|
+
const currentEngine = (): WorkflowEngine | undefined => {
|
|
186
|
+
try {
|
|
187
|
+
return resolveEngine();
|
|
188
|
+
} catch (error: unknown) {
|
|
189
|
+
if (!inactiveNotified) {
|
|
190
|
+
inactiveNotified = true;
|
|
191
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "warning");
|
|
192
|
+
}
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
180
196
|
while (true) {
|
|
197
|
+
const engine = currentEngine();
|
|
198
|
+
if (!engine) return;
|
|
181
199
|
const states = engine
|
|
182
200
|
.list()
|
|
183
201
|
.map((summary) => engine.getRun(String(summary.runId)))
|
|
@@ -198,7 +216,9 @@ export async function showWorkflowNavigator(ctx: ExtensionCommandContext, engine
|
|
|
198
216
|
);
|
|
199
217
|
if (!selected) return;
|
|
200
218
|
while (true) {
|
|
201
|
-
const
|
|
219
|
+
const latest = currentEngine();
|
|
220
|
+
if (!latest) return;
|
|
221
|
+
const run = latest.getRun(selected);
|
|
202
222
|
if (!run) break;
|
|
203
223
|
const name = sanitizeDisplayText(run.meta.name, MAX_NAME_CHARS);
|
|
204
224
|
const action = await selectList<WorkflowAction>(
|
|
@@ -208,7 +228,10 @@ export async function showWorkflowNavigator(ctx: ExtensionCommandContext, engine
|
|
|
208
228
|
value: item.value,
|
|
209
229
|
label: item.label,
|
|
210
230
|
})),
|
|
211
|
-
() =>
|
|
231
|
+
() => {
|
|
232
|
+
const current = currentEngine();
|
|
233
|
+
return current ? formatWorkflowDetail(current, selected) : "Workflow surface is no longer active.";
|
|
234
|
+
},
|
|
212
235
|
);
|
|
213
236
|
if (action === undefined || action === "back") break;
|
|
214
237
|
if (action === "refresh") continue;
|
|
@@ -217,7 +240,9 @@ export async function showWorkflowNavigator(ctx: ExtensionCommandContext, engine
|
|
|
217
240
|
if (!confirmed) continue;
|
|
218
241
|
}
|
|
219
242
|
try {
|
|
220
|
-
|
|
243
|
+
const current = currentEngine();
|
|
244
|
+
if (!current) return;
|
|
245
|
+
await current.control(action, selected);
|
|
221
246
|
ctx.ui.notify(`Workflow ${action} requested.`, "info");
|
|
222
247
|
} catch (error: unknown) {
|
|
223
248
|
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|