pi-ultracode 0.7.0 → 0.8.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/README.md CHANGED
@@ -29,7 +29,7 @@ pi --ultracode
29
29
 
30
30
  > `pi-ultracode` registers a tool named `workflow`. If `pi-dynamic-workflows` is installed, remove it first with `pi remove npm:pi-dynamic-workflows`.
31
31
 
32
- Current releases are tested with Pi 0.84.
32
+ **Pi 0.86.0**
33
33
 
34
34
  ## Core features
35
35
 
package/README.zh-CN.md CHANGED
@@ -29,7 +29,7 @@ pi --ultracode
29
29
 
30
30
  > `pi-ultracode` 会注册名为 `workflow` 的工具。如果已安装 `pi-dynamic-workflows`,请先运行 `pi remove npm:pi-dynamic-workflows`。
31
31
 
32
- 当前版本已在 Pi 0.84 上验证。
32
+ 需要 Pi 0.86.0 或更高版本。模式提示词通过独立分区更新,不再替换整段系统提示词。
33
33
 
34
34
  ## 核心特性
35
35
 
@@ -66,14 +66,14 @@ Pi 会自行判断工作流是否有帮助。小任务仍可继续使用普通
66
66
  | `/ultracode deep` | 固定使用高保障深度验证 |
67
67
  | `/ultracode off` | 关闭且不改变父代理 effort |
68
68
  | `/ultracode status` | 查看配置的语义深度模式 |
69
- | `/ultracode default on` | 全局默认开启,新会话使用 `auto` |
69
+ | `/ultracode default on` | 全局默认开启,并立即开启当前会话;已开启时保留当前深度 |
70
70
  | `/ultracode default off` | 取消默认开启 |
71
71
  | `/ultracode default` | 查看全局启动默认值 |
72
72
  | `/workflows` 或 `F6` | 打开工作流浏览器 |
73
73
  | `/workflows <runId>` | 打开指定运行 |
74
74
  | `/workflows abort` | 中止活动运行 |
75
75
 
76
- `/ultracode default on|off` 只修改启动默认值,不切换当前会话的模式,也不改变 effort。设置保存在 `~/.pi/agent/ultracode.json`(遵循 `PI_CODING_AGENT_DIR`),跨项目和重启生效;未设置时默认关闭。启动时,只有当前分支没有保存 Ultracode 模式才应用默认值,已有的 `off` 或深度选择在 reload、resume、fork 后继续保留。显式 `pi --ultracode` 仍可启用 `auto`。如需立即开启当前会话,执行 `/ultracode auto`。
76
+ `/ultracode default on` 保存全局启动默认值,并立即将关闭的当前会话切换为 `auto`;当前已开启时保留所选深度。`/ultracode default off` 只取消默认开启,不关闭当前会话;关闭当前会话请用 `/ultracode off`。这些操作均不改变 effort。设置保存在 `~/.pi/agent/ultracode.json`(遵循 `PI_CODING_AGENT_DIR`),跨项目和重启生效;未设置时默认关闭。启动时,只有当前分支没有保存 Ultracode 模式才应用默认值,已有的 `off` 或深度选择在 reload、resume、fork 后继续保留。显式 `pi --ultracode` 仍可启用 `auto`。
77
77
 
78
78
  按 `Esc` 可取消正在运行的工作流。在 Pi 的 fullscreen TUI 中,请在工作流详情内使用 `Ctrl+PageUp`、`Ctrl+PageDown` 和 `Ctrl+End`。
79
79
 
@@ -111,9 +111,9 @@ export default function extension(pi: ExtensionAPI, extraDeps: UltracodeExtensio
111
111
  });
112
112
 
113
113
  pi.on("before_agent_start", async (event) => {
114
- // Reconcile tool availability and append the standing policy on every
115
- // enforcing turn, even when another active-tool writer caused drift.
114
+ // Reconcile tool availability and update our prompt section on every turn,
115
+ // including removal when the mode is off or suspended.
116
116
  mode.syncWorkflowTool(pi);
117
- return mode.beforeAgentStart(event);
117
+ mode.beforeAgentStart(event);
118
118
  });
119
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ultracode",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Adaptive semantic-depth workflow orchestration for Pi, with focused, standard, and deep modes, isolated subagents, worktree delivery, structured output, and durable resume.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -53,10 +53,10 @@
53
53
  "acorn": "^8.11.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@earendil-works/pi-agent-core": "^0.84.0",
57
- "@earendil-works/pi-ai": "^0.84.0",
58
- "@earendil-works/pi-coding-agent": "^0.84.0",
59
- "@earendil-works/pi-tui": "^0.84.0",
56
+ "@earendil-works/pi-agent-core": "^0.86.0",
57
+ "@earendil-works/pi-ai": "^0.86.0",
58
+ "@earendil-works/pi-coding-agent": "^0.86.0",
59
+ "@earendil-works/pi-tui": "^0.86.0",
60
60
  "@types/node": "^24.12.4",
61
61
  "typebox": "1.3.7",
62
62
  "typescript": "^5.9.3"
@@ -64,7 +64,7 @@
64
64
  "peerDependencies": {
65
65
  "@earendil-works/pi-agent-core": "*",
66
66
  "@earendil-works/pi-ai": "*",
67
- "@earendil-works/pi-coding-agent": "*",
67
+ "@earendil-works/pi-coding-agent": ">=0.86.0",
68
68
  "@earendil-works/pi-tui": "*",
69
69
  "typebox": "*"
70
70
  },
package/src/commands.ts CHANGED
@@ -52,8 +52,13 @@ export function registerCommands(
52
52
  try {
53
53
  if (value !== undefined) preferences.setDefaultEnabled(value === "on");
54
54
  const enabled = preferences.getDefaultEnabled();
55
+ if (value === "on") {
56
+ if (!mode.isEnabled()) mode.enable(pi, "auto");
57
+ ctx.ui.setStatus("ultracode", mode.statusLine((label) => ctx.ui.theme.fg("accent", label)));
58
+ }
59
+ const sessionStatus = value === "on" ? `current session: ${mode.getMode()}` : "current session unchanged";
55
60
  ctx.ui.notify(
56
- `Ultracode default ${enabled ? "on (auto)" : "off"} — global startup preference; current session unchanged.`,
61
+ `Ultracode default ${enabled ? "on (auto)" : "off"} — global startup preference; ${sessionStatus}.`,
57
62
  "info",
58
63
  );
59
64
  } catch (error) {
package/src/mode.ts CHANGED
@@ -184,11 +184,14 @@ export class UltracodeMode {
184
184
  return state !== undefined;
185
185
  }
186
186
 
187
- /** Append the configured semantic-depth policy to the turn's system prompt. */
188
- beforeAgentStart(event: { systemPrompt: string }): { systemPrompt: string } | undefined {
189
- if (!this.isEnforcing() || !isActiveUltracodeMode(this.mode)) return undefined;
190
- const block = ultracodeSystemBlock(this.mode);
191
- return { systemPrompt: `${event.systemPrompt}\n\n${block}\n\n${ULTRACODE_ACTIVE_REMINDER}` };
187
+ /** Update only our prompt section so Pi can persist and diff it across turns. */
188
+ beforeAgentStart(event: { systemPromptOptions: { sections: Record<string, string> } }): void {
189
+ const { sections } = event.systemPromptOptions;
190
+ if (!this.isEnforcing() || !isActiveUltracodeMode(this.mode)) {
191
+ delete sections.ultracode;
192
+ return;
193
+ }
194
+ sections.ultracode = `${ultracodeSystemBlock(this.mode)}\n\n${ULTRACODE_ACTIVE_REMINDER}`;
192
195
  }
193
196
 
194
197
  statusLine(styleLabel: (label: string) => string = (label) => label): string {
package/src/prompts.ts CHANGED
@@ -6,13 +6,12 @@ import type { ActiveUltracodeMode } from "./depth.ts";
6
6
  export const ULTRACODE_TAGLINE = "semantic-depth workflow orchestration";
7
7
 
8
8
  /**
9
- * The standing system-prompt block injected on every turn while Ultracode is
10
- * active. The parent model performs the semantic routing itself; starting a
9
+ * The standing system-prompt section body (Pi adds the XML wrapper). Injected
10
+ * on every active turn. The parent model performs semantic routing; starting a
11
11
  * separate agent merely to classify depth would defeat the focused path.
12
12
  */
13
13
  export function ultracodeSystemBlock(mode: ActiveUltracodeMode = "deep"): string {
14
14
  return [
15
- "<ultracode>",
16
15
  `Configured mode: ${mode}.`,
17
16
  "Analysis depth is a semantic quality decision, never a wall-clock decision. Do not use elapsed time, deadlines, or duration limits to choose, lower, or stop analysis depth.",
18
17
  "Use the smallest depth that can establish a correct answer. Depth is controlled by research rounds, independent perspectives, verification strength, evidence requirements, skeptic count, and per-agent reasoning effort.",
@@ -34,7 +33,6 @@ export function ultracodeSystemBlock(mode: ActiveUltracodeMode = "deep"): string
34
33
  "- Avoid a separate synthesis agent when deterministic merging or parent synthesis is enough. Use an adjudicator only when a material conflict remains.",
35
34
  "- Select each workflow agent's effort from its task: use a per-call model suffix such as :medium for bounded discovery/synthesis, :high for substantive analysis or implementation, and :max only for deep or decisive high-risk verification. If omitted, the child session uses its normal user/model configuration.",
36
35
  "- When a workflow runs, log `analysis-depth: <level> — <reason>` before launching agents, `analysis-escalation: ...` for each semantic escalation, and `analysis-stop: ...` for the final evidence-based stop reason. Never use time as an escalation or stop reason.",
37
- "</ultracode>",
38
36
  ].join("\n");
39
37
  }
40
38