pi-agent-flow 2.0.0 → 2.0.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.
Files changed (144) hide show
  1. package/agents/audit.md +3 -0
  2. package/agents/build.md +3 -0
  3. package/agents/craft.md +3 -0
  4. package/agents/debug.md +3 -0
  5. package/agents/ideas.md +3 -0
  6. package/agents/scout.md +5 -0
  7. package/dist/batch/batch-bash.d.ts.map +1 -1
  8. package/dist/batch/batch-bash.js +27 -4
  9. package/dist/batch/batch-bash.js.map +1 -1
  10. package/dist/batch/constants.d.ts +12 -0
  11. package/dist/batch/constants.d.ts.map +1 -1
  12. package/dist/batch/constants.js +46 -0
  13. package/dist/batch/constants.js.map +1 -1
  14. package/dist/batch/execute.d.ts.map +1 -1
  15. package/dist/batch/execute.js +117 -4
  16. package/dist/batch/execute.js.map +1 -1
  17. package/dist/batch/shell-compress.d.ts +25 -0
  18. package/dist/batch/shell-compress.d.ts.map +1 -0
  19. package/dist/batch/shell-compress.js +602 -0
  20. package/dist/batch/shell-compress.js.map +1 -0
  21. package/dist/batch/symbols.d.ts.map +1 -1
  22. package/dist/batch/symbols.js +12 -7
  23. package/dist/batch/symbols.js.map +1 -1
  24. package/dist/config/config.d.ts +5 -0
  25. package/dist/config/config.d.ts.map +1 -1
  26. package/dist/config/config.js +63 -0
  27. package/dist/config/config.js.map +1 -1
  28. package/dist/config/models.d.ts +2 -0
  29. package/dist/config/models.d.ts.map +1 -0
  30. package/dist/config/models.js +49 -0
  31. package/dist/config/models.js.map +1 -0
  32. package/dist/config/settings-resolver.js +2 -2
  33. package/dist/config/settings-resolver.js.map +1 -1
  34. package/dist/core/agents.js +2 -2
  35. package/dist/core/agents.js.map +1 -1
  36. package/dist/core/delegation.d.ts +1 -1
  37. package/dist/core/delegation.d.ts.map +1 -1
  38. package/dist/core/delegation.js +6 -13
  39. package/dist/core/delegation.js.map +1 -1
  40. package/dist/core/executor.d.ts +7 -0
  41. package/dist/core/executor.d.ts.map +1 -1
  42. package/dist/core/executor.js +5 -1
  43. package/dist/core/executor.js.map +1 -1
  44. package/dist/core/flow.d.ts +9 -0
  45. package/dist/core/flow.d.ts.map +1 -1
  46. package/dist/core/flow.js +24 -28
  47. package/dist/core/flow.js.map +1 -1
  48. package/dist/core/session-mode.d.ts +1 -1
  49. package/dist/core/session-mode.d.ts.map +1 -1
  50. package/dist/core/session-mode.js +2 -1
  51. package/dist/core/session-mode.js.map +1 -1
  52. package/dist/flow/auto-warp.d.ts +12 -0
  53. package/dist/flow/auto-warp.d.ts.map +1 -0
  54. package/dist/flow/auto-warp.js +29 -0
  55. package/dist/flow/auto-warp.js.map +1 -0
  56. package/dist/flow/command.d.ts.map +1 -1
  57. package/dist/flow/command.js +7 -2
  58. package/dist/flow/command.js.map +1 -1
  59. package/dist/flow/continuation.d.ts.map +1 -1
  60. package/dist/flow/continuation.js +50 -13
  61. package/dist/flow/continuation.js.map +1 -1
  62. package/dist/flow/index.d.ts +4 -1
  63. package/dist/flow/index.d.ts.map +1 -1
  64. package/dist/flow/index.js +4 -1
  65. package/dist/flow/index.js.map +1 -1
  66. package/dist/flow/loop-command.d.ts +8 -0
  67. package/dist/flow/loop-command.d.ts.map +1 -0
  68. package/dist/flow/loop-command.js +99 -0
  69. package/dist/flow/loop-command.js.map +1 -0
  70. package/dist/flow/loop-templates.d.ts +7 -0
  71. package/dist/flow/loop-templates.d.ts.map +1 -0
  72. package/dist/flow/loop-templates.js +38 -0
  73. package/dist/flow/loop-templates.js.map +1 -0
  74. package/dist/flow/loop.d.ts +19 -0
  75. package/dist/flow/loop.d.ts.map +1 -0
  76. package/dist/flow/loop.js +95 -0
  77. package/dist/flow/loop.js.map +1 -0
  78. package/dist/flow/perform-warp.d.ts +28 -0
  79. package/dist/flow/perform-warp.d.ts.map +1 -0
  80. package/dist/flow/perform-warp.js +127 -0
  81. package/dist/flow/perform-warp.js.map +1 -0
  82. package/dist/flow/settings-command.d.ts.map +1 -1
  83. package/dist/flow/settings-command.js +89 -3
  84. package/dist/flow/settings-command.js.map +1 -1
  85. package/dist/flow/store.d.ts +3 -3
  86. package/dist/flow/store.d.ts.map +1 -1
  87. package/dist/flow/store.js +24 -16
  88. package/dist/flow/store.js.map +1 -1
  89. package/dist/flow/template-shared.d.ts +9 -0
  90. package/dist/flow/template-shared.d.ts.map +1 -0
  91. package/dist/flow/template-shared.js +13 -0
  92. package/dist/flow/template-shared.js.map +1 -0
  93. package/dist/flow/template-strings.d.ts.map +1 -1
  94. package/dist/flow/template-strings.js +2 -5
  95. package/dist/flow/template-strings.js.map +1 -1
  96. package/dist/flow/types.d.ts +15 -9
  97. package/dist/flow/types.d.ts.map +1 -1
  98. package/dist/flow/warp-command.d.ts +0 -1
  99. package/dist/flow/warp-command.d.ts.map +1 -1
  100. package/dist/flow/warp-command.js +21 -282
  101. package/dist/flow/warp-command.js.map +1 -1
  102. package/dist/flow/warp-utils.d.ts +11 -0
  103. package/dist/flow/warp-utils.d.ts.map +1 -0
  104. package/dist/flow/warp-utils.js +187 -0
  105. package/dist/flow/warp-utils.js.map +1 -0
  106. package/dist/index.d.ts +3 -2
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +17 -7
  109. package/dist/index.js.map +1 -1
  110. package/dist/snapshot/cli-args.d.ts +1 -0
  111. package/dist/snapshot/cli-args.d.ts.map +1 -1
  112. package/dist/snapshot/cli-args.js +12 -0
  113. package/dist/snapshot/cli-args.js.map +1 -1
  114. package/dist/snapshot/snapshot.d.ts +22 -19
  115. package/dist/snapshot/snapshot.d.ts.map +1 -1
  116. package/dist/snapshot/snapshot.js +1012 -149
  117. package/dist/snapshot/snapshot.js.map +1 -1
  118. package/dist/steering/sliding-prompt.d.ts.map +1 -1
  119. package/dist/steering/sliding-prompt.js +3 -0
  120. package/dist/steering/sliding-prompt.js.map +1 -1
  121. package/dist/tools/timed-bash.d.ts.map +1 -1
  122. package/dist/tools/timed-bash.js +9 -0
  123. package/dist/tools/timed-bash.js.map +1 -1
  124. package/dist/tui/render-utils.d.ts +5 -1
  125. package/dist/tui/render-utils.d.ts.map +1 -1
  126. package/dist/tui/render-utils.js +38 -10
  127. package/dist/tui/render-utils.js.map +1 -1
  128. package/dist/tui/render.d.ts.map +1 -1
  129. package/dist/tui/render.js +55 -82
  130. package/dist/tui/render.js.map +1 -1
  131. package/dist/tui/scramble/constants.d.ts +8 -8
  132. package/dist/tui/scramble/constants.d.ts.map +1 -1
  133. package/dist/tui/scramble/constants.js +7 -7
  134. package/dist/tui/scramble/constants.js.map +1 -1
  135. package/dist/tui/scramble/manager.d.ts +0 -4
  136. package/dist/tui/scramble/manager.d.ts.map +1 -1
  137. package/dist/tui/scramble/manager.js +2 -62
  138. package/dist/tui/scramble/manager.js.map +1 -1
  139. package/dist/types/flow.d.ts +2 -0
  140. package/dist/types/flow.d.ts.map +1 -1
  141. package/dist/types/flow.js.map +1 -1
  142. package/dist/types/output.d.ts +6 -0
  143. package/dist/types/output.d.ts.map +1 -1
  144. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-shared.js","sourceRoot":"","sources":["../../src/flow/template-shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;0DAIsB,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,sFAAsF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"template-strings.d.ts","sourceRoot":"","sources":["../../src/flow/template-strings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,mBAAmB,2QAOjB,CAAC;AAEhB,eAAO,MAAM,kBAAkB,gpBAchB,CAAC;AAEhB,eAAO,MAAM,0BAA0B,sbAUlB,CAAC"}
1
+ {"version":3,"file":"template-strings.d.ts","sourceRoot":"","sources":["../../src/flow/template-strings.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,eAAO,MAAM,mBAAmB,2QAOjB,CAAC;AAEhB,eAAO,MAAM,kBAAkB,gpBAUhB,CAAC;AAEhB,eAAO,MAAM,0BAA0B,sbAUlB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { sharedWakeupGuidance } from "./template-shared.js";
1
2
  /**
2
3
  * Runtime template strings for flow prompts.
3
4
  * Kept in sync with the .md sources in templates/.
@@ -17,11 +18,7 @@ Objective: {{objective}}
17
18
  {{acceptanceClause}}
18
19
  Progress: {{flowCount}}/{{maxFlows}} flows, {{totalTokens}} tokens.
19
20
 
20
- Guidance:
21
- - Focus on safe, incremental improvements — do not refactor large areas or make risky changes.
22
- - Prefer verification, testing, and documentation over new features.
23
- - If you find potential issues, investigate with scout or audit before making changes.
24
- - You cannot end this goal. Only the user can end a goal.
21
+ ${sharedWakeupGuidance}
25
22
 
26
23
  Call the flow tool with the appropriate flow type to continue.
27
24
  </flow-wakeup>`;
@@ -1 +1 @@
1
- {"version":3,"file":"template-strings.js","sourceRoot":"","sources":["../../src/flow/template-strings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;eAOpB,CAAC;AAEhB,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;eAcnB,CAAC;AAEhB,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;qBAUrB,CAAC"}
1
+ {"version":3,"file":"template-strings.js","sourceRoot":"","sources":["../../src/flow/template-strings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;GAGG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;eAOpB,CAAC;AAEhB,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;EAOhC,oBAAoB;;;eAGP,CAAC;AAEhB,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;qBAUrB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Flow goal types — autonomous continuation state for multi-step goals.
3
3
  */
4
- export type GoalStatus = "active" | "paused" | "budget_limited" | "completed" | "abandoned";
4
+ export type GoalStatus = "active" | "paused" | "budget_limited" | "completed" | "abandoned" | "warped";
5
5
  export interface GoalEntry {
6
6
  /** Unique goal identifier (timestamp-based). */
7
7
  id: string;
@@ -31,20 +31,26 @@ export interface GoalEntry {
31
31
  /** Session ID that owns this goal. */
32
32
  sessionId?: string;
33
33
  }
34
- export interface WarpEntry {
35
- id: string;
36
- parentSession: string;
37
- goal: string;
38
- createdAt: string;
39
- depth: number;
34
+ export type LoopStatus = "active" | "paused" | "terminated";
35
+ export type LoopTerminationReason = "goal_completed" | "user_disabled" | "budget_exhausted";
36
+ export interface LoopState {
37
+ objective: string;
38
+ status: LoopStatus;
39
+ sessionCount: number;
40
+ totalTokensAcrossSessions: number;
41
+ totalFlowsAcrossSessions: number;
42
+ terminatedAt?: string;
43
+ terminationReason?: LoopTerminationReason;
44
+ /** When an auto-warp is in progress, the session ID we expect to resume in. */
45
+ pendingWarpSessionId?: string;
40
46
  }
41
47
  export interface GoalState {
42
48
  /** Currently active goal, if any. */
43
49
  current?: GoalEntry;
44
50
  /** Previously completed or abandoned goals. */
45
51
  history: GoalEntry[];
46
- /** Recorded session warps. */
47
- warps?: WarpEntry[];
52
+ /** Endless loop state, if any. */
53
+ loop?: LoopState;
48
54
  }
49
55
  export interface GoalContext {
50
56
  objective?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/flow/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAC;AAE5F,MAAM,WAAW,SAAS;IACxB,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,UAAU,CAAC,EAAE,M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AAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,kCAAkC;IAClC,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -4,6 +4,5 @@
4
4
  * Distills conversation context and spawns a new session with the warped prompt.
5
5
  */
6
6
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
7
- export declare function extractGoalFromPrompt(prompt: string): string;
8
7
  export declare function setupWarpCommand(pi: ExtensionAPI): void;
9
8
  //# sourceMappingURL=warp-command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"warp-command.d.ts","sourceRoot":"","sources":["../../src/flow/warp-command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,+BAA+B,CAAC;AAqK3F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAyC5D;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAkPvD"}
1
+ {"version":3,"file":"warp-command.d.ts","sourceRoot":"","sources":["../../src/flow/warp-command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,+BAA+B,CAAC;AAO3F,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAmJvD"}
@@ -3,194 +3,10 @@
3
3
  *
4
4
  * Distills conversation context and spawns a new session with the warped prompt.
5
5
  */
6
- import { complete } from "@mariozechner/pi-ai";
7
- import { convertToLlm, serializeConversation } from "@mariozechner/pi-coding-agent";
8
6
  import { DynamicScrambleText, scrambleManager } from "../tui/scramble/index.js";
9
- import { getGoalForSession, getWarpCount, recordWarp } from "./store.js";
10
- import { stripReasoningFromAssistantMessage } from "../snapshot/reasoning-strip.js";
11
- import { stripSteeringHintFromContent, isJsonEqual, contentContainsSteeringHintTag, } from "../steering/sliding-prompt.js";
12
- import { stripStrategicHintsFromContent } from "../steering/tool-utils.js";
13
- import { logError } from "../config/log.js";
14
- function sanitizeBranchForWarp(messages) {
15
- const passesApplied = new Set();
16
- const sanitized = [];
17
- for (const message of messages) {
18
- if (!message)
19
- continue;
20
- // Drop messages with role: 'custom' (hidden orchestrator messages that convertToLlm would promote to user)
21
- if (message.role === "custom") {
22
- passesApplied.add("dropCustomMessages");
23
- continue;
24
- }
25
- // Drop messages with role: 'system' that contain steering hint tags
26
- if (message.role === "system" && contentContainsSteeringHintTag(message.content)) {
27
- passesApplied.add("dropSlidingSystemPrompts");
28
- continue;
29
- }
30
- let changed = false;
31
- let sanitizedMessage = message;
32
- // Strip reasoning/thinking from assistant messages
33
- if (message.role === "assistant" || message.role === "system" || message.role === "tool") {
34
- const stripped = stripReasoningFromAssistantMessage(message);
35
- if (stripped.changed) {
36
- sanitizedMessage = stripped.message;
37
- changed = true;
38
- passesApplied.add("stripReasoning");
39
- }
40
- }
41
- // Strip timestamp from message objects
42
- if ("timestamp" in sanitizedMessage) {
43
- const { timestamp, ...rest } = sanitizedMessage;
44
- sanitizedMessage = rest;
45
- changed = true;
46
- passesApplied.add("stripTimestamps");
47
- }
48
- // Strip API metadata from assistant messages (keep usage but strip cost)
49
- if (sanitizedMessage.role === "assistant") {
50
- const { api, provider, model, stopReason, responseId, responseModel, usage, ...rest } = sanitizedMessage;
51
- let stripped = false;
52
- if (api !== undefined || provider !== undefined || model !== undefined ||
53
- stopReason !== undefined || responseId !== undefined || responseModel !== undefined) {
54
- stripped = true;
55
- }
56
- let cleanedUsage = usage;
57
- if (usage && typeof usage === "object" && "cost" in usage) {
58
- const { cost, ...usageWithoutCost } = usage;
59
- cleanedUsage = usageWithoutCost;
60
- stripped = true;
61
- }
62
- if (stripped) {
63
- sanitizedMessage = { ...rest, ...(cleanedUsage !== undefined ? { usage: cleanedUsage } : {}) };
64
- changed = true;
65
- passesApplied.add("stripApiMetadata");
66
- }
67
- }
68
- // Strip 'details' from tool/toolResult messages
69
- if (sanitizedMessage.role === "tool" || sanitizedMessage.role === "toolResult") {
70
- if ("details" in sanitizedMessage) {
71
- const { details, ...rest } = sanitizedMessage;
72
- sanitizedMessage = rest;
73
- changed = true;
74
- passesApplied.add("stripDetails");
75
- }
76
- }
77
- if ("content" in sanitizedMessage) {
78
- let modifiedContent = sanitizedMessage.content;
79
- // Strip steering hints from message content
80
- const afterSliding = stripSteeringHintFromContent(modifiedContent);
81
- if (!isJsonEqual(afterSliding, modifiedContent)) {
82
- modifiedContent = afterSliding;
83
- changed = true;
84
- passesApplied.add("stripSteeringHints");
85
- }
86
- // Strip strategic hints from tool result content
87
- if (sanitizedMessage.role === "tool" || sanitizedMessage.role === "toolResult") {
88
- const afterHints = stripStrategicHintsFromContent(modifiedContent);
89
- if (!isJsonEqual(afterHints, modifiedContent)) {
90
- modifiedContent = afterHints;
91
- changed = true;
92
- passesApplied.add("stripStrategicHints");
93
- }
94
- }
95
- if (changed) {
96
- sanitizedMessage = { ...sanitizedMessage, content: modifiedContent };
97
- }
98
- }
99
- sanitized.push(sanitizedMessage);
100
- }
101
- return { messages: sanitized, passesApplied: Array.from(passesApplied) };
102
- }
103
- const SYSTEM_PROMPT = `You are a context transfer and execution planning assistant. Given a conversation history and the user's goal, generate a structured warp prompt that serves as a ready-to-execute project brief for a new session.
104
-
105
- Your output MUST use this exact format:
106
-
107
- FRONTMATTER (YAML between --- delimiters):
108
- context — 1-2 sentence orientation summary
109
- end_goal — The finish line, not the next step
110
- decisions — Key choices already made (list)
111
- files — Files touched with what changed (list)
112
- open_items — Unresolved work or questions (list)
113
- watch_out — Edge cases, gotchas, fragile assumptions (list)
114
- uncertain_areas — Areas of the codebase or design that need re-assessment before proceeding (list)
115
- context_gathering:
116
- aim — What the initial scout/discovery should accomplish
117
- scope — Specific things to explore or map (list)
118
- execution_plan:
119
- - phase — Phase name
120
- parallel — true/false, can this run alongside other phases?
121
- group — If parallel, which execution group (A, B, C...)
122
- flow — Which flow type to use (scout, build, audit, craft...)
123
- flows — OR multiple flows if parallel within the phase
124
- task — Clear, actionable task for this phase
125
- depends_on — Phase(s) that must complete first
126
- produces — What "done" means for this phase
127
- success_criteria — How to know the overall work is complete (list)
128
-
129
- BODY (after the closing ---):
130
- A concise Task section restating the immediate next action.
131
-
132
- RULES:
133
- 1. Always start with a context_gathering phase — the new session has no context yet, so discovery comes first.
134
- 2. Mark phases parallel:true when they have no data dependencies on each other. Use group labels (A, B, C) to cluster parallel work.
135
- 3. Each phase should produce a concrete artifact, evidence of completion before moving on to the next.
136
- 4. Respect the given plan scaffold.
137
- 5. Use flow types from: scout, build, audit, craft, debug, ideas.
138
- 6. Success criteria should be the final state, i.e. integration test pass, code coverage with verified output, etc.
139
- 7. If an active goal from the prior session exists, include it in the frontmatter context.
140
- 8. Preserve unresolved blockers, open questions, or "not done" items from prior flow results in open_items.
141
- 9. Flag any uncertain areas — parts of the codebase, design decisions, or assumptions that may have shifted since the conversation and need re-assessment via a scout or audit flow before committing to a plan.
142
- 10. No tool calls, all attemps that you need to discover, note it to the watch_out list or uncertain_areas list.
143
- 11. Your entire response must be the warp prompt starting with '---' (YAML frontmatter opening). No preamble, no explanations, no tool calls.
144
-
145
- Format your response as a prompt the user can send to start the new thread. Be concise but include all necessary context. Do not include any preamble like "Here is the prompt" — just output the prompt itself.
146
-
147
- IMPORTANT: You are a text generation assistant, not an agent. Do NOT attempt tool calls, file operations, code execution, or any actions. Output ONLY the structured prompt text.`;
148
- const MAX_CONVERSATION_CHARS = 15000;
149
- export function extractGoalFromPrompt(prompt) {
150
- const MAX_GOAL_LEN = 200;
151
- // Helper: find first meaningful line and strip bullet/numbered prefixes
152
- const pickFirstLine = (text) => {
153
- const lines = text.split('\n');
154
- for (const raw of lines) {
155
- const trimmed = raw.trim();
156
- if (!trimmed || trimmed.startsWith('#'))
157
- continue;
158
- const cleaned = trimmed.replace(/^[-*•]\s+|^\d+\.\s+/, '');
159
- if (cleaned)
160
- return cleaned.length > MAX_GOAL_LEN ? cleaned.slice(0, MAX_GOAL_LEN).trimEnd() : cleaned;
161
- }
162
- return undefined;
163
- };
164
- // Strategy 1: Parse end_goal from YAML frontmatter
165
- const endGoalMatch = prompt.match(/^end_goal:\s*["']?(.+?)["']?\s*$/m);
166
- if (endGoalMatch?.[1]) {
167
- const endGoal = endGoalMatch[1].trim();
168
- const contextMatch = prompt.match(/^context:\s*["']?(.+?)["']?\s*$/m);
169
- if (contextMatch?.[1]) {
170
- const context = contextMatch[1].trim();
171
- const combined = `${endGoal}. Context: ${context}`;
172
- if (combined.length <= MAX_GOAL_LEN)
173
- return combined;
174
- }
175
- return endGoal.length > MAX_GOAL_LEN ? endGoal.slice(0, MAX_GOAL_LEN).trimEnd() : endGoal;
176
- }
177
- // Try to find ## Task section
178
- const taskMatch = prompt.match(/##\s*Task\s*\n([\s\S]*?)(?=\n##|$)/i);
179
- if (taskMatch?.[1]) {
180
- const picked = pickFirstLine(taskMatch[1]);
181
- if (picked)
182
- return picked;
183
- }
184
- // Fallback: first non-empty, non-header, non-bullet line after ---
185
- const bodyStart = prompt.indexOf('---', 3);
186
- if (bodyStart !== -1) {
187
- const body = prompt.slice(bodyStart + 3);
188
- const picked = pickFirstLine(body);
189
- if (picked)
190
- return picked;
191
- }
192
- return 'Continue the work from the warped context';
193
- }
7
+ import { getGoalForSession } from "./store.js";
8
+ import { getLoop } from "./loop.js";
9
+ import { distillForWarp, performWarp } from "./perform-warp.js";
194
10
  export function setupWarpCommand(pi) {
195
11
  pi.registerCommand("flow:warp", {
196
12
  description: "Warp to a new session with distilled context. Usage: /flow:warp [goal]",
@@ -210,38 +26,8 @@ export function setupWarpCommand(pi) {
210
26
  ctx.ui.notify?.("Empty conversation — nothing to warp.", "error");
211
27
  return;
212
28
  }
213
- // Convert and serialize
214
- // getBranch() returns wrapped session entries; convertToLlm expects AgentMessage objects.
215
- const agentMessages = branch
216
- .map((entry) => (entry.type === "message" ? entry.message : undefined))
217
- .filter((m) => m != null);
218
- const { messages: sanitizedMessages, passesApplied } = sanitizeBranchForWarp(agentMessages);
219
- if (process.env.PI_FLOW_DUMP_SNAPSHOT) {
220
- logError(`[warp-sanitize] passes applied: ${passesApplied.join(", ")}`);
221
- }
222
- const messages = convertToLlm(sanitizedMessages);
223
- let conversation = serializeConversation(messages);
224
- // Truncate if too large (middle truncation: keep first 20% + last 80% of max)
225
- if (conversation.length > MAX_CONVERSATION_CHARS) {
226
- const headChars = Math.floor(MAX_CONVERSATION_CHARS * 0.2);
227
- const tailChars = Math.floor(MAX_CONVERSATION_CHARS * 0.8);
228
- conversation =
229
- conversation.slice(0, headChars) +
230
- "\n\n[... warp context truncated from the middle ...]\n\n" +
231
- conversation.slice(conversation.length - tailChars);
232
- }
233
- // Inject active goal context (session-guarded)
234
29
  const activeGoal = getGoalForSession(cwd, ctx.sessionManager.getSessionId());
235
- let preWarpContext = "";
236
- if (activeGoal) {
237
- preWarpContext = `\nPre-warp active goal: ${activeGoal.objective}${activeGoal.acceptance ? ` (Acceptance: ${activeGoal.acceptance})` : ""}\n`;
238
- }
239
- // Generate distilled prompt
240
- const auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);
241
- if (!auth.ok || !auth.apiKey) {
242
- ctx.ui.notify?.(auth.ok ? `No API key for ${model.provider}` : (auth.error ?? "Auth error"), "error");
243
- return;
244
- }
30
+ const loop = getLoop(cwd);
245
31
  let warpError;
246
32
  const distilledPrompt = await ctx.ui.custom((tui, _theme, _kb, done) => {
247
33
  const abortController = new AbortController();
@@ -311,31 +97,7 @@ export function setupWarpCommand(pi) {
311
97
  }
312
98
  }
313
99
  const component = new WarpingComponent();
314
- const doGenerate = async () => {
315
- const response = await complete(model, {
316
- systemPrompt: SYSTEM_PROMPT,
317
- messages: [
318
- {
319
- role: "user",
320
- content: args.trim()
321
- ? `Conversation history:\n${conversation}\n${preWarpContext}\nUser's goal for new thread: ${goal}`
322
- : `Conversation history:\n${conversation}\n${preWarpContext}`,
323
- },
324
- ],
325
- }, { apiKey: auth.apiKey, headers: auth.headers, signal: abortController.signal });
326
- if (response.stopReason === "aborted") {
327
- return null;
328
- }
329
- if (response.stopReason === "error" || response.errorMessage) {
330
- throw new Error(response.errorMessage || "Unknown error");
331
- }
332
- return response.content
333
- .filter((c) => c.type === "text")
334
- .map((c) => c.text)
335
- .join("\n")
336
- .trim();
337
- };
338
- doGenerate()
100
+ distillForWarp(ctx, activeGoal, loop, { signal: abortController.signal, userGoalOverride: args.trim() || undefined })
339
101
  .then((result) => {
340
102
  completed = true;
341
103
  component.cleanup();
@@ -343,8 +105,8 @@ export function setupWarpCommand(pi) {
343
105
  })
344
106
  .catch((err) => {
345
107
  completed = true;
108
+ warpError = err instanceof Error ? err.message : "Unknown error";
346
109
  component.cleanup();
347
- warpError = err.message || "Unknown error";
348
110
  done(null);
349
111
  });
350
112
  return component;
@@ -358,46 +120,23 @@ export function setupWarpCommand(pi) {
358
120
  }
359
121
  return;
360
122
  }
361
- // Present for review
362
- const reviewedPrompt = await ctx.ui.editor("Edit warp prompt", distilledPrompt);
363
- if (reviewedPrompt === undefined) {
364
- ctx.ui.notify?.("Warp cancelled by user.", "info");
365
- return;
366
- }
367
- const warpedPrompt = (reviewedPrompt ?? distilledPrompt).trim();
368
- // Warn on deep warp chains
369
- const warpCount = getWarpCount(cwd);
370
- if (warpCount >= 3) {
371
- ctx.ui.notify?.(`Warning: Deep warp chain (depth ${warpCount + 1}). Proceed with caution.`, "warning");
123
+ let reviewedPrompt;
124
+ if (loop?.status !== "active") {
125
+ // Present for review
126
+ reviewedPrompt = await ctx.ui.editor("Edit warp prompt", distilledPrompt);
127
+ if (reviewedPrompt === undefined) {
128
+ ctx.ui.notify?.("Warp cancelled by user.", "info");
129
+ return;
130
+ }
131
+ reviewedPrompt = (reviewedPrompt ?? distilledPrompt).trim();
372
132
  }
373
- // Spawn new session
374
- const currentSessionFile = ctx.sessionManager.getSessionFile();
375
- const { cancelled } = await ctx.newSession({
376
- parentSession: currentSessionFile,
377
- withSession: async (newCtx) => {
378
- const effectiveGoal = args.trim() ? goal : extractGoalFromPrompt(warpedPrompt);
379
- // Log warp (cwd captured in closure, no ctx needed)
380
- recordWarp(cwd, {
381
- id: `warp-${Date.now()}`,
382
- parentSession: currentSessionFile,
383
- goal,
384
- createdAt: new Date().toISOString(),
385
- depth: warpCount + 1,
386
- });
387
- newCtx.ui.notify?.("Warped to new session.", "info");
388
- // Execute /flow:goal set as a real user message in the new session.
389
- // This triggers the command handler which calls setGoal() with
390
- // ctx.sessionManager.getSessionId() — guaranteed to be the new
391
- // session's ID. The handler then triggers the LLM to start working.
392
- // sendUserMessage is called last because it may trigger a turn.
393
- await newCtx.sendUserMessage(warpedPrompt);
394
- newCtx.sendUserMessage(`/flow:goal set ${effectiveGoal}`);
395
- },
133
+ const warpedPrompt = reviewedPrompt ?? distilledPrompt.trim();
134
+ const result = await performWarp(ctx, { type: "warp", intent: "Manual warp", aim: "Warp to fresh session" }, {
135
+ reviewedPrompt: warpedPrompt,
136
+ goalOverride: args.trim() ? goal : undefined,
396
137
  });
397
- if (cancelled) {
398
- // Can't use ctx.ui.notify here ctx is stale after newSession.
399
- // The cancelled case means withSession never ran, so we return silently.
400
- return;
138
+ if (!result.success) {
139
+ ctx.ui.notify?.(`Warp failed: ${result.error}`, "error");
401
140
  }
402
141
  },
403
142
  });
@@ -1 +1 @@
1
- {"version":3,"file":"warp-command.js","sourceRoot":"","sources":["../../src/flow/warp-command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAoB,M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,IAAI,CAAC,CAAC,CAAC,SAAS;aAC7C,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,gBAAgB,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Shared warp utilities — sanitization, system prompt, and goal extraction.
3
+ */
4
+ export declare const MAX_CONVERSATION_CHARS = 15000;
5
+ export declare function sanitizeBranchForWarp(messages: any[]): {
6
+ messages: any[];
7
+ passesApplied: string[];
8
+ };
9
+ export declare const SYSTEM_PROMPT = "You are a context transfer and execution planning assistant. Given a conversation history and the user's goal, generate a structured warp prompt that serves as a ready-to-execute project brief for a new session.\n\nYour output MUST use this exact format:\n\nFRONTMATTER (YAML between --- delimiters):\n context \u2014 1-2 sentence orientation summary\n end_goal \u2014 The finish line, not the next step\n decisions \u2014 Key choices already made (list)\n files \u2014 Files touched with what changed (list)\n open_items \u2014 Unresolved work or questions (list)\n watch_out \u2014 Edge cases, gotchas, fragile assumptions (list)\n uncertain_areas \u2014 Areas of the codebase or design that need re-assessment before proceeding (list)\n context_gathering:\n aim \u2014 What the initial scout/discovery should accomplish\n scope \u2014 Specific things to explore or map (list)\n execution_plan:\n - phase \u2014 Phase name\n parallel \u2014 true/false, can this run alongside other phases?\n group \u2014 If parallel, which execution group (A, B, C...)\n flow \u2014 Which flow type to use (scout, build, audit, craft...)\n flows \u2014 OR multiple flows if parallel within the phase\n task \u2014 Clear, actionable task for this phase\n depends_on \u2014 Phase(s) that must complete first\n produces \u2014 What \"done\" means for this phase\n success_criteria \u2014 How to know the overall work is complete (list)\n\nBODY (after the closing ---):\n A concise Task section restating the immediate next action.\n\nRULES:\n1. Always start with a context_gathering phase \u2014 the new session has no context yet, so discovery comes first.\n2. Mark phases parallel:true when they have no data dependencies on each other. Use group labels (A, B, C) to cluster parallel work.\n3. Each phase should produce a concrete artifact, evidence of completion before moving on to the next.\n4. Respect the given plan scaffold.\n5. Use flow types from: scout, build, audit, craft, debug, ideas.\n6. Success criteria should be the final state, i.e. integration test pass, code coverage with verified output, etc.\n7. If an active goal from the prior session exists, include it in the frontmatter context.\n8. Preserve unresolved blockers, open questions, or \"not done\" items from prior flow results in open_items.\n9. Flag any uncertain areas \u2014 parts of the codebase, design decisions, or assumptions that may have shifted since the conversation and need re-assessment via a scout or audit flow before committing to a plan.\n10. No tool calls, all attemps that you need to discover, note it to the watch_out list or uncertain_areas list.\n11. Your entire response must be the warp prompt starting with '---' (YAML frontmatter opening). No preamble, no explanations, no tool calls.\n\nFormat your response as a prompt the user can send to start the new thread. Be concise but include all necessary context. Do not include any preamble like \"Here is the prompt\" \u2014 just output the prompt itself.\n\nIMPORTANT: You are a text generation assistant, not an agent. Do NOT attempt tool calls, file operations, code execution, or any actions. Output ONLY the structured prompt text.";
10
+ export declare function extractGoalFromPrompt(prompt: string): string;
11
+ //# sourceMappingURL=warp-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warp-utils.d.ts","sourceRoot":"","sources":["../../src/flow/warp-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAE5C,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAqGnG;AAED,eAAO,MAAM,aAAa,suGA4CwJ,CAAC;AAEnL,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAyC5D"}