@oh-my-pi/pi-coding-agent 12.19.3 → 13.0.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/package.json +7 -7
  3. package/src/commit/prompts/analysis-system.md +3 -3
  4. package/src/commit/prompts/analysis-user.md +14 -14
  5. package/src/commit/prompts/changelog-system.md +4 -4
  6. package/src/commit/prompts/changelog-user.md +4 -4
  7. package/src/commit/prompts/file-observer-system.md +2 -2
  8. package/src/commit/prompts/file-observer-user.md +2 -2
  9. package/src/commit/prompts/reduce-system.md +4 -4
  10. package/src/commit/prompts/reduce-user.md +6 -6
  11. package/src/commit/prompts/summary-system.md +4 -4
  12. package/src/commit/prompts/summary-user.md +6 -6
  13. package/src/discovery/helpers.ts +13 -1
  14. package/src/internal-urls/docs-index.generated.ts +2 -2
  15. package/src/internal-urls/index.ts +8 -3
  16. package/src/internal-urls/local-protocol.ts +223 -0
  17. package/src/internal-urls/{docs-protocol.ts → pi-protocol.ts} +12 -12
  18. package/src/internal-urls/router.ts +1 -1
  19. package/src/internal-urls/types.ts +1 -1
  20. package/src/ipy/executor.ts +4 -32
  21. package/src/memories/index.ts +1 -1
  22. package/src/modes/controllers/event-controller.ts +4 -4
  23. package/src/modes/interactive-mode.ts +84 -64
  24. package/src/modes/types.ts +11 -3
  25. package/src/modes/utils/ui-helpers.ts +5 -3
  26. package/src/patch/hashline.ts +42 -42
  27. package/src/patch/index.ts +24 -21
  28. package/src/patch/shared.ts +21 -43
  29. package/src/plan-mode/approved-plan.ts +55 -0
  30. package/src/prompts/agents/designer.md +6 -6
  31. package/src/prompts/agents/explore.md +4 -4
  32. package/src/prompts/agents/frontmatter.md +1 -0
  33. package/src/prompts/agents/init.md +10 -10
  34. package/src/prompts/agents/plan.md +6 -6
  35. package/src/prompts/agents/reviewer.md +4 -3
  36. package/src/prompts/agents/task.md +10 -10
  37. package/src/prompts/compaction/branch-summary.md +3 -3
  38. package/src/prompts/compaction/compaction-short-summary.md +7 -7
  39. package/src/prompts/compaction/compaction-summary-context.md +1 -1
  40. package/src/prompts/compaction/compaction-summary.md +5 -5
  41. package/src/prompts/compaction/compaction-turn-prefix.md +3 -3
  42. package/src/prompts/compaction/compaction-update-summary.md +11 -11
  43. package/src/prompts/memories/consolidation.md +5 -5
  44. package/src/prompts/memories/read-path.md +11 -0
  45. package/src/prompts/memories/stage_one_input.md +1 -1
  46. package/src/prompts/memories/stage_one_system.md +5 -5
  47. package/src/prompts/review-request.md +4 -4
  48. package/src/prompts/system/agent-creation-architect.md +17 -17
  49. package/src/prompts/system/agent-creation-user.md +2 -2
  50. package/src/prompts/system/custom-system-prompt.md +6 -6
  51. package/src/prompts/system/plan-mode-active.md +20 -20
  52. package/src/prompts/system/plan-mode-approved.md +9 -7
  53. package/src/prompts/system/plan-mode-reference.md +2 -2
  54. package/src/prompts/system/plan-mode-subagent.md +8 -8
  55. package/src/prompts/system/subagent-submit-reminder.md +5 -5
  56. package/src/prompts/system/subagent-system-prompt.md +9 -9
  57. package/src/prompts/system/subagent-user-prompt.md +3 -5
  58. package/src/prompts/system/summarization-system.md +1 -1
  59. package/src/prompts/system/system-prompt.md +109 -84
  60. package/src/prompts/system/title-system.md +2 -2
  61. package/src/prompts/system/ttsr-interrupt.md +2 -2
  62. package/src/prompts/system/web-search.md +16 -16
  63. package/src/prompts/tools/ask.md +6 -6
  64. package/src/prompts/tools/bash.md +9 -9
  65. package/src/prompts/tools/browser.md +5 -5
  66. package/src/prompts/tools/cancel-job.md +2 -2
  67. package/src/prompts/tools/exit-plan-mode.md +13 -10
  68. package/src/prompts/tools/find.md +2 -2
  69. package/src/prompts/tools/gemini-image.md +7 -7
  70. package/src/prompts/tools/grep.md +4 -3
  71. package/src/prompts/tools/hashline.md +37 -39
  72. package/src/prompts/tools/patch.md +5 -5
  73. package/src/prompts/tools/poll-jobs.md +1 -1
  74. package/src/prompts/tools/python.md +8 -10
  75. package/src/prompts/tools/read.md +2 -12
  76. package/src/prompts/tools/replace.md +6 -6
  77. package/src/prompts/tools/ssh.md +2 -7
  78. package/src/prompts/tools/task.md +34 -23
  79. package/src/prompts/tools/todo-write.md +65 -49
  80. package/src/prompts/tools/web-search.md +2 -2
  81. package/src/prompts/tools/write.md +4 -3
  82. package/src/sdk.ts +11 -9
  83. package/src/session/agent-session.ts +92 -51
  84. package/src/session/artifacts.ts +1 -1
  85. package/src/session/messages.ts +1 -0
  86. package/src/task/agents.ts +1 -0
  87. package/src/task/index.ts +2 -1
  88. package/src/task/render.ts +2 -2
  89. package/src/task/types.ts +1 -0
  90. package/src/tools/bash-interactive.ts +1 -1
  91. package/src/tools/bash-skill-urls.ts +3 -2
  92. package/src/tools/bash.ts +21 -12
  93. package/src/tools/exit-plan-mode.ts +30 -2
  94. package/src/tools/grep.ts +131 -75
  95. package/src/tools/index.ts +13 -3
  96. package/src/tools/path-utils.ts +2 -1
  97. package/src/tools/plan-mode-guard.ts +8 -8
  98. package/src/tools/python.ts +0 -2
  99. package/src/tools/read.ts +2 -2
  100. package/src/tools/todo-write.ts +276 -146
  101. package/src/internal-urls/plan-protocol.ts +0 -95
  102. package/src/modes/components/todo-display.ts +0 -114
  103. package/src/prompts/memories/read_path.md +0 -11
package/CHANGELOG.md CHANGED
@@ -2,6 +2,46 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [13.0.0] - 2026-02-22
6
+ ### Added
7
+
8
+ - Added `getTodoPhases()` and `setTodoPhases()` methods to ToolSession API for managing todo state programmatically
9
+ - Added `getLatestTodoPhasesFromEntries()` export to retrieve todo phases from session history
10
+ - Added `local://` protocol for session-scoped scratch space to store large intermediate artifacts, subagent handoffs, and reusable planning artifacts
11
+ - Added `title` parameter to `exit_plan_mode` tool to specify the final plan artifact name when approving a plan
12
+ - Added `LocalProtocolHandler` for resolving `local://` URLs to session-scoped file storage
13
+ - Added `renameApprovedPlanFile` function to finalize approved plans with user-specified titles
14
+
15
+ ### Changed
16
+
17
+ - Changed todo state management from file-based (`todos.json`) to in-memory session cache for improved performance and consistency
18
+ - Changed todo phases to sync from session branch history when branching or rewriting entries
19
+ - Changed `TodoWriteTool` to update session cache instead of writing to disk, with automatic persistence through session entries
20
+ - Changed XML tag from `<swarm-context>` to `<context>` in subagent prompts and task rendering
21
+ - Changed system reminder XML tags from underscore to kebab-case format (`<system-reminder>`)
22
+ - Changed plan storage from `plan://` protocol to `local://PLAN.md` for draft plans and `local://<title>.md` for finalized approved plans
23
+ - Changed plan mode to use session artifacts directory for plan storage instead of separate plans directory
24
+ - Updated system prompt to document `local://` protocol and internal URL expansion behavior
25
+ - Updated `exit_plan_mode` tool documentation to require `title` parameter and explain plan finalization workflow
26
+ - Updated `write` tool documentation to recommend `local://` for large temporary artifacts and subagent handoffs
27
+ - Updated `task` tool documentation to recommend using `local://` for large intermediate outputs in subagent context
28
+ - Replaced `docs://` protocol with `pi://` for accessing embedded documentation files
29
+ - Renamed `DocsProtocolHandler` to `PiProtocolHandler` for internal documentation URL resolution
30
+ - Removed `artifactsDir` parameter from Python executor options; artifact storage now uses `artifactPath` only
31
+ - Renamed prompt file from `read_path.md` to `read-path.md` for consistency
32
+ - Updated system prompt XML tags to use kebab-case (e.g., `system-reminder`, `system-interrupt`) for consistency
33
+ - Refactored bash tool to use `NO_PAGER_ENV` constant for environment variable management
34
+ - Updated internal URL expansion to support optional `noEscape` parameter for unescaped path resolution
35
+
36
+ ### Removed
37
+
38
+ - Removed `plan://` protocol handler and related plan directory resolution logic
39
+ - Removed `PlanProtocolHandler` and `resolvePlanUrlToPath` exports from internal URLs module
40
+
41
+ ### Fixed
42
+
43
+ - Fixed todo reminder XML tags from underscore to kebab-case format (`system-reminder`)
44
+
5
45
  ## [12.19.3] - 2026-02-22
6
46
  ### Added
7
47
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-coding-agent",
4
- "version": "12.19.3",
4
+ "version": "13.0.0",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -41,12 +41,12 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@mozilla/readability": "^0.6",
44
- "@oh-my-pi/omp-stats": "12.19.3",
45
- "@oh-my-pi/pi-agent-core": "12.19.3",
46
- "@oh-my-pi/pi-ai": "12.19.3",
47
- "@oh-my-pi/pi-natives": "12.19.3",
48
- "@oh-my-pi/pi-tui": "12.19.3",
49
- "@oh-my-pi/pi-utils": "12.19.3",
44
+ "@oh-my-pi/omp-stats": "13.0.0",
45
+ "@oh-my-pi/pi-agent-core": "13.0.0",
46
+ "@oh-my-pi/pi-ai": "13.0.0",
47
+ "@oh-my-pi/pi-natives": "13.0.0",
48
+ "@oh-my-pi/pi-tui": "13.0.0",
49
+ "@oh-my-pi/pi-utils": "13.0.0",
50
50
  "@sinclair/typebox": "^0.34",
51
51
  "@xterm/headless": "^6.0",
52
52
  "ajv": "^8.18",
@@ -14,7 +14,7 @@ Use null for: cross-cutting changes, project-wide refactoring.
14
14
 
15
15
  Forbidden scopes (use null): src, lib, include, tests, benches, examples, docs, project name, app, main, entire, all, misc.
16
16
 
17
- Prefer scopes from <common_scopes> over inventing new.
17
+ Prefer scopes from <common-scopes> over inventing new.
18
18
  ## 2. Generate Details (0-6 items)
19
19
 
20
20
  Each detail:
@@ -55,7 +55,7 @@ user_visible: false for: internal refactoring, performance optimizations (unless
55
55
  Omit changelog_category when user_visible false.
56
56
  </instructions>
57
57
 
58
- <output_format>
58
+ <output-format>
59
59
  Call create_conventional_analysis with:
60
60
 
61
61
  {
@@ -74,7 +74,7 @@ Call create_conventional_analysis with:
74
74
  ],
75
75
  "issue_refs": []
76
76
  }
77
- </output_format>
77
+ </output-format>
78
78
 
79
79
  <example name="feature-with-api">
80
80
  {
@@ -1,37 +1,37 @@
1
1
  {{#if context_files}}
2
- <project_context>
2
+ <project-context>
3
3
  {{#each context_files}}
4
4
  <file path="{{ path }}">
5
5
  {{ content }}
6
6
  </file>
7
7
  {{/each}}
8
- </project_context>
8
+ </project-context>
9
9
  {{/if}}
10
10
  {{#if user_context}}
11
- <user_context>
11
+ <user-context>
12
12
  {{ user_context }}
13
- </user_context>
13
+ </user-context>
14
14
  {{/if}}
15
15
  {{#if types_description}}
16
- <commit_types>
16
+ <commit-types>
17
17
  {{ types_description }}
18
- </commit_types>
18
+ </commit-types>
19
19
  {{/if}}
20
- <diff_statistics>
20
+ <diff-statistics>
21
21
  {{ stat }}
22
- </diff_statistics>
23
- <scope_candidates>
22
+ </diff-statistics>
23
+ <scope-candidates>
24
24
  {{ scope_candidates }}
25
- </scope_candidates>
25
+ </scope-candidates>
26
26
  {{#if common_scopes}}
27
- <common_scopes>
27
+ <common-scopes>
28
28
  {{ common_scopes }}
29
- </common_scopes>
29
+ </common-scopes>
30
30
  {{/if}}
31
31
  {{#if recent_commits}}
32
- <style_patterns>
32
+ <style-patterns>
33
33
  {{ recent_commits }}
34
- </style_patterns>
34
+ </style-patterns>
35
35
  {{/if}}
36
36
  <diff>
37
37
  {{ diff }}
@@ -16,12 +16,12 @@ You're expert changelog writer analyzing git diffs to produce Keep a Changelog e
16
16
  - Breaking Changes: API-incompatible changes (use sparingly)
17
17
  </categories>
18
18
 
19
- <entry_format>
19
+ <entry-format>
20
20
  - Start with past-tense verb (Added, Fixed, Implemented, Updated)
21
21
  - Describe user-visible impact, not implementation
22
22
  - Name specific feature, option, or behavior
23
23
  - Keep 1-2 lines, no trailing periods
24
- </entry_format>
24
+ </entry-format>
25
25
 
26
26
  <examples>
27
27
  Good:
@@ -42,9 +42,9 @@ Breaking Changes:
42
42
  Internal refactoring, code style changes, test-only modifications, minor doc updates.
43
43
  </exclude>
44
44
 
45
- <output_format>
45
+ <output-format>
46
46
  Return ONLY valid JSON; no markdown fences or explanation.
47
47
 
48
48
  With entries: {"entries": {"Added": ["entry 1"], "Fixed": ["entry 2"]}}
49
49
  No changelog-worthy changes: {"entries": {}}
50
- </output_format>
50
+ </output-format>
@@ -3,15 +3,15 @@ Changelog: {{ changelog_path }}
3
3
  {{#if is_package_changelog}}Scope: Package-level changelog. Omit package name prefix from entries.{{/if}}
4
4
  </context>
5
5
  {{#if existing_entries}}
6
- <existing_entries>
6
+ <existing-entries>
7
7
  Already documented—skip these:
8
8
  {{ existing_entries }}
9
- </existing_entries>
9
+ </existing-entries>
10
10
  {{/if}}
11
11
 
12
- <diff_summary>
12
+ <diff-summary>
13
13
  {{ stat }}
14
- </diff_summary>
14
+ </diff-summary>
15
15
 
16
16
  <diff>
17
17
  {{ diff }}
@@ -14,11 +14,11 @@ Include: functions, methods, types, API changes, behavior/logic changes, error h
14
14
  Exclude: import reordering, whitespace/formatting, comment-only changes, debug statements.
15
15
  </scope>
16
16
 
17
- <output_format>
17
+ <output-format>
18
18
  Plain list, no preamble, no summary, no markdown formatting.
19
19
  - added 'parse_config()' function for TOML configuration loading
20
20
  - removed deprecated 'legacy_init()' and all callers
21
21
  - changed 'Connection::new()' to accept '&Config' instead of individual params
22
- </output_format>
22
+ </output-format>
23
23
 
24
24
  Observations only. Classification in reduce phase.
@@ -2,7 +2,7 @@
2
2
  {{ diff }}
3
3
  </file>
4
4
  {{#if context_header}}
5
- <related_files>
5
+ <related-files>
6
6
  {{ context_header }}
7
- </related_files>
7
+ </related-files>
8
8
  {{/if}}
@@ -9,13 +9,13 @@ Determine:
9
9
  3. DETAILS: 3–4 summary points (max 6)
10
10
  4. CHANGELOG: Metadata for user-visible changes
11
11
  </instructions>
12
- <scope_rules>
12
+ <scope-rules>
13
13
  - Component name if >=60% changes target it
14
14
  - null if spread across multiple components
15
15
  - scope_candidates as primary source
16
16
  - Valid: specific component names (api, parser, config, etc.)
17
- </scope_rules>
18
- <output_format>
17
+ </scope-rules>
18
+ <output-format>
19
19
  Each detail point:
20
20
  - Start with past-tense verb (added, fixed, moved, extracted)
21
21
  - Under 120 chars, ends with period
@@ -23,7 +23,7 @@ Each detail point:
23
23
  Priority: user-visible behavior > performance/security > architecture > internal implementation
24
24
  changelog_category: Added|Changed|Fixed|Deprecated|Removed|Security
25
25
  user_visible: true for features, user-facing bugs, breaking changes, security
26
- </output_format>
26
+ </output-format>
27
27
  <example>
28
28
  Input observations:
29
29
  - api/client.ts: added token refresh guard to prevent duplicate refreshes
@@ -1,17 +1,17 @@
1
1
  {{#if types_description}}
2
- <type_definitions>
2
+ <type-definitions>
3
3
  {{ types_description }}
4
- </type_definitions>
4
+ </type-definitions>
5
5
  {{/if}}
6
6
 
7
7
  <observations>
8
8
  {{ observations }}
9
9
  </observations>
10
10
 
11
- <diff_statistics>
11
+ <diff-statistics>
12
12
  {{ stat }}
13
- </diff_statistics>
13
+ </diff-statistics>
14
14
 
15
- <scope_candidates>
15
+ <scope-candidates>
16
16
  {{ scope_candidates }}
17
- </scope_candidates>
17
+ </scope-candidates>
@@ -10,7 +10,7 @@ Output: ONLY description after "{{ commit_type }}{{ scope_prefix }}:"; max {{ ch
10
10
  4. One focused concept per message
11
11
  </instructions>
12
12
 
13
- <verb_reference>
13
+ <verb-reference>
14
14
  |Type|Use|
15
15
  |---|---|
16
16
  |feat|added, introduced, implemented, enabled|
@@ -20,7 +20,7 @@ Output: ONLY description after "{{ commit_type }}{{ scope_prefix }}:"; max {{ ch
20
20
  |docs|documented, clarified, expanded|
21
21
  |build|upgraded, pinned, configured|
22
22
  |chore|cleaned, removed, renamed, organized|
23
- </verb_reference>
23
+ </verb-reference>
24
24
  <examples>
25
25
  feat | TLS encryption added to HTTP client for MITM prevention
26
26
  -> added TLS support to prevent man-in-the-middle attacks
@@ -33,6 +33,6 @@ perf | Batch processing optimized to reduce memory allocations
33
33
  build | Updated serde to fix CVE-2024-1234
34
34
  -> upgraded serde to 1.0.200 for CVE-2024-1234
35
35
  </examples>
36
- <banned_words>
36
+ <banned-words>
37
37
  comprehensive, various, several, improved, enhanced, quickly, simply, basically, this change, this commit, now
38
- </banned_words>
38
+ </banned-words>
@@ -1,13 +1,13 @@
1
1
  {{#if user_context}}
2
- <user_context>
2
+ <user-context>
3
3
  {{ user_context }}
4
- </user_context>
4
+ </user-context>
5
5
  {{/if}}
6
6
 
7
- <detail_points>
7
+ <detail-points>
8
8
  {{ details }}
9
- </detail_points>
9
+ </detail-points>
10
10
 
11
- <diff_stat>
11
+ <diff-stat>
12
12
  {{ stat }}
13
- </diff_stat>
13
+ </diff-stat>
@@ -112,6 +112,16 @@ export function parseThinkingLevel(frontmatter: Record<string, unknown>): Thinki
112
112
  return undefined;
113
113
  }
114
114
 
115
+ export function parseBoolean(value: unknown): boolean | undefined {
116
+ if (typeof value === "boolean") return value;
117
+ if (typeof value === "string") {
118
+ const normalized = value.trim().toLowerCase();
119
+ if (normalized === "true") return true;
120
+ if (normalized === "false") return false;
121
+ }
122
+ return undefined;
123
+ }
124
+
115
125
  /**
116
126
  * Parse a comma-separated string into an array of trimmed, non-empty strings.
117
127
  */
@@ -194,6 +204,7 @@ export interface ParsedAgentFields {
194
204
  model?: string[];
195
205
  output?: unknown;
196
206
  thinkingLevel?: ThinkingLevel;
207
+ blocking?: boolean;
197
208
  }
198
209
 
199
210
  /**
@@ -238,8 +249,9 @@ export function parseAgentFields(frontmatter: Record<string, unknown>): ParsedAg
238
249
  const output = frontmatter.output !== undefined ? frontmatter.output : undefined;
239
250
  const model = parseModelList(frontmatter.model);
240
251
  const thinkingLevel = parseThinkingLevel(frontmatter);
252
+ const blocking = parseBoolean(frontmatter.blocking);
241
253
 
242
- return { name, description, tools, spawns, model, output, thinkingLevel };
254
+ return { name, description, tools, spawns, model, output, thinkingLevel, blocking };
243
255
  }
244
256
 
245
257
  async function globIf(