pi-ultracode 0.7.1 → 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
 
@@ -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.1",
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/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