@tt-a1i/openpi 0.2.0 → 0.3.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.
@@ -33,7 +33,6 @@ import { randomBytes } from "node:crypto";
33
33
  import * as fs from "node:fs";
34
34
  import * as path from "node:path";
35
35
  import {
36
- CustomEditor,
37
36
  getAgentDir,
38
37
  getMarkdownTheme,
39
38
  keyHint,
@@ -45,6 +44,10 @@ import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
45
44
  import { Type, type Static } from "typebox";
46
45
  import { formatActivityStatus } from "../shared/activity-status.ts";
47
46
  import { waitBounded } from "../shared/child-session.ts";
47
+ import {
48
+ registerEditorLayer,
49
+ removeEditorLayer,
50
+ } from "../shared/editor-layers.ts";
48
51
  import { loadSetupConfig } from "../shared/setup-config.ts";
49
52
  import {
50
53
  OPENPI_TOOL_SURFACE,
@@ -445,6 +448,7 @@ export default function workflows(pi: ExtensionAPI) {
445
448
  let failedRuns = 0;
446
449
  let widgetVisible = false;
447
450
  let requestWidgetRender: (() => void) | undefined;
451
+ let navigationLayerRegistered = false;
448
452
  let dashboardOpen = false;
449
453
  /**
450
454
  * Start of the current request. The dashboard reports the work belonging to
@@ -566,26 +570,26 @@ export default function workflows(pi: ExtensionAPI) {
566
570
 
567
571
  const installWorkflowNavigation = (ctx: ExtensionContext) => {
568
572
  if (ctx.mode !== "tui") return;
569
- const previous = ctx.ui.getEditorComponent();
570
- ctx.ui.setEditorComponent((tui, theme, keybindings) => {
571
- const base =
572
- previous?.(tui, theme, keybindings) ??
573
- new CustomEditor(tui, theme, keybindings);
574
- return new WorkflowNavigationEditor(
575
- base,
576
- keybindings,
577
- stripState,
578
- () => Boolean(stripEntry()),
579
- () => {
580
- const entry = stripEntry();
581
- if (entry) void openDashboard(ctx, entry.runId);
582
- },
583
- () => {
584
- requestWidgetRender?.();
585
- tui.requestRender();
586
- },
587
- );
573
+ registerEditorLayer(pi, ctx, {
574
+ id: "workflows",
575
+ order: 300,
576
+ wrap: (base, tui, _theme, keybindings) =>
577
+ new WorkflowNavigationEditor(
578
+ base,
579
+ keybindings,
580
+ stripState,
581
+ () => Boolean(stripEntry()),
582
+ () => {
583
+ const entry = stripEntry();
584
+ if (entry) void openDashboard(ctx, entry.runId);
585
+ },
586
+ () => {
587
+ requestWidgetRender?.();
588
+ tui.requestRender();
589
+ },
590
+ ),
588
591
  });
592
+ navigationLayerRegistered = true;
589
593
  };
590
594
 
591
595
  pi.on("session_start", (_event, ctx) => {
@@ -612,6 +616,10 @@ export default function workflows(pi: ExtensionAPI) {
612
616
  });
613
617
 
614
618
  pi.on("session_shutdown", async () => {
619
+ if (navigationLayerRegistered) {
620
+ removeEditorLayer(pi, "workflows");
621
+ navigationLayerRegistered = false;
622
+ }
615
623
  await shutdownActiveWorkflowRuns([...activeRuns.values()]);
616
624
  try {
617
625
  lastContext?.ui.setStatus("workflows", undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tt-a1i/openpi",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "OpenPI — a Pi-native multi-agent workbench with background execution, isolated subagents, replay-safe workflows, goals, tasks, and observable TUI",
5
5
  "license": "MIT",
6
6
  "author": "tt-a1i",
@@ -12,7 +12,7 @@ The tool definitions are canonical for parameters, limits, model syntax, isolati
12
12
  - Inherit the parent model and thinking level by default. Override them only for an explicit user request or concrete task requirement.
13
13
  - Prefer a matching agent type when one exists; its tool restriction is enforced. An explicit spawn model or reasoning effort wins, otherwise use the type default then inherit the parent. Types live in `~/.pi/agent/agents/*.md` and, for trusted projects, `.pi/agents/*.md`; see `extensions/subagents/docs/agent-types.md`.
14
14
  - Isolate concurrent writers in worktrees according to the `subagent_spawn` schema so they cannot overwrite one checkout or git index. While Plan Mode is active, use only read-only exploration types (or no type); worktree isolation and types narrowed by Plan Mode are rejected.
15
- - After spawning, continue useful parent work. Let automatic result delivery drive the next turn; block only when the immediate next step truly depends on that result.
15
+ - After spawning, continue useful parent work. In an interactive session, if none remains, tell the user the child is still running and end the turn; automatic result delivery will re-invoke the parent when it settles. Do not block merely because the next step depends on the result or because there is nothing else to do. Use `subagent_wait` only when the user explicitly asks to keep the current response open for the result, or when non-interactive automation must return it in the same invocation.
16
16
 
17
17
  ## Worktree isolation
18
18