@pencil-agent/nano-pencil 2.0.1 → 2.0.3

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 (188) hide show
  1. package/README.md +267 -267
  2. package/dist/build-meta.json +3 -3
  3. package/dist/core/export-html/AGENT.md +11 -11
  4. package/dist/core/export-html/template.css +971 -971
  5. package/dist/core/export-html/template.html +54 -54
  6. package/dist/core/model/custom-providers.js +1 -1
  7. package/dist/core/model-registry.js +5 -5
  8. package/dist/extensions/builtin/AGENT.md +115 -115
  9. package/dist/extensions/builtin/browser/AGENT.md +17 -17
  10. package/dist/extensions/builtin/browser/agent-workspace/agent_helpers.py +12 -12
  11. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/amazon/product-search.md +198 -198
  12. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/archive-org/scraping.md +341 -341
  13. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/arxiv/scraping.md +311 -311
  14. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/arxiv-bulk/scraping.md +333 -333
  15. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/atlas/overview.md +70 -70
  16. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/booking-com/scraping.md +578 -578
  17. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/capterra/scraping.md +440 -440
  18. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/centilebrain/generate-estimates.md +110 -110
  19. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/coingecko/scraping.md +325 -325
  20. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/coinmarketcap/scraping.md +463 -463
  21. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/coursera/scraping.md +360 -360
  22. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/craigslist/scraping.md +390 -390
  23. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/crossref/scraping.md +568 -568
  24. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/dev-to/scraping.md +323 -323
  25. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/duckduckgo/scraping.md +349 -349
  26. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/ebay/scraping.md +435 -435
  27. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/etsy/scraping.md +506 -506
  28. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/eventbrite/scraping.md +363 -363
  29. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/expedia/automation.md +168 -168
  30. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/facebook/groups.md +236 -236
  31. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/facebook/pages.md +295 -295
  32. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/framer/editor.md +108 -108
  33. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/fred/scraping.md +493 -493
  34. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/g2/scraping.md +580 -580
  35. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/genius/scraping.md +511 -511
  36. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/github/repo-actions.md +65 -65
  37. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/github/scraping.md +184 -184
  38. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/glassdoor/scraping.md +543 -543
  39. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/gmail/compose.md +122 -122
  40. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/goodreads/scraping.md +461 -461
  41. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/gutenberg/scraping.md +383 -383
  42. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/hackernews/scraping.md +243 -243
  43. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/howlongtobeat/scraping.md +473 -473
  44. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/imdb/scraping.md +271 -271
  45. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/itch-io/scraping.md +436 -436
  46. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/job-boards/indeed-glassdoor.md +1021 -1021
  47. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/letterboxd/scraping.md +349 -349
  48. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/linkedin/invitation-manager.md +109 -109
  49. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/loom/folder-enumeration.md +170 -170
  50. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/macrotrends/scraping.md +537 -537
  51. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/medium/article-hydration.md +120 -120
  52. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/medium/scraping.md +414 -414
  53. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/metacritic/scraping.md +477 -477
  54. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/musicbrainz/scraping.md +478 -478
  55. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/nasa/scraping.md +339 -339
  56. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/news-aggregation/multi-source.md +205 -205
  57. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/open-library/scraping.md +472 -472
  58. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/openalex/scraping.md +470 -470
  59. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/openstreetmap/scraping.md +490 -490
  60. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/package-registries/npm-pypi.md +478 -478
  61. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/polymarket/scraping.md +234 -234
  62. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/producthunt/scraping.md +307 -307
  63. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/pubmed/scraping.md +421 -421
  64. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/quora/scraping.md +364 -364
  65. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/rawg/scraping.md +352 -352
  66. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/reddit/scraping.md +124 -124
  67. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/rest-countries/scraping.md +233 -233
  68. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/sec-edgar/scraping.md +361 -361
  69. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/shopify-admin/README.md +36 -36
  70. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/shopify-admin/embedded-apps.md +72 -72
  71. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/shopify-admin/knowledge-base.md +109 -109
  72. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/shopify-admin/polaris-inputs.md +137 -137
  73. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/soundcloud/scraping.md +362 -362
  74. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/spotify/scraping.md +339 -339
  75. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/stackoverflow/scraping.md +435 -435
  76. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/steam/scraping.md +575 -575
  77. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/substack/scraping.md +338 -338
  78. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/thetechgeeks/pricing.md +52 -52
  79. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/tiktok/upload.md +107 -107
  80. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/tradingview/scraping.md +309 -309
  81. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/trello/boards-and-lists.md +88 -88
  82. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/trustpilot/scraping.md +375 -375
  83. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/walmart/scraping.md +444 -444
  84. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/wayback-machine/scraping.md +306 -306
  85. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/weather/scraping.md +398 -398
  86. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/wellfound/scraping.md +596 -596
  87. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/world-bank/scraping.md +356 -356
  88. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/xiaohongshu/scraping.md +84 -84
  89. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/youtube/scraping.md +418 -418
  90. package/dist/extensions/builtin/browser/agent-workspace/domain-skills/zillow/scraping.md +433 -433
  91. package/dist/extensions/builtin/browser/browser.md +73 -73
  92. package/dist/extensions/builtin/browser/install.md +142 -142
  93. package/dist/extensions/builtin/browser/interaction-skills/connection.md +48 -48
  94. package/dist/extensions/builtin/browser/interaction-skills/cookies.md +3 -3
  95. package/dist/extensions/builtin/browser/interaction-skills/cross-origin-iframes.md +3 -3
  96. package/dist/extensions/builtin/browser/interaction-skills/dialogs.md +64 -64
  97. package/dist/extensions/builtin/browser/interaction-skills/downloads.md +3 -3
  98. package/dist/extensions/builtin/browser/interaction-skills/drag-and-drop.md +3 -3
  99. package/dist/extensions/builtin/browser/interaction-skills/dropdowns.md +3 -3
  100. package/dist/extensions/builtin/browser/interaction-skills/iframes.md +3 -3
  101. package/dist/extensions/builtin/browser/interaction-skills/network-requests.md +3 -3
  102. package/dist/extensions/builtin/browser/interaction-skills/print-as-pdf.md +3 -3
  103. package/dist/extensions/builtin/browser/interaction-skills/profile-sync.md +90 -90
  104. package/dist/extensions/builtin/browser/interaction-skills/screenshots.md +17 -17
  105. package/dist/extensions/builtin/browser/interaction-skills/scrolling.md +3 -3
  106. package/dist/extensions/builtin/browser/interaction-skills/shadow-dom.md +3 -3
  107. package/dist/extensions/builtin/browser/interaction-skills/tabs.md +69 -69
  108. package/dist/extensions/builtin/browser/interaction-skills/uploads.md +1 -1
  109. package/dist/extensions/builtin/browser/interaction-skills/viewport.md +3 -3
  110. package/dist/extensions/builtin/browser/src/browser_harness/AGENT.md +15 -15
  111. package/dist/extensions/builtin/browser/src/browser_harness/__init__.py +8 -8
  112. package/dist/extensions/builtin/browser/src/browser_harness/_ipc.py +90 -90
  113. package/dist/extensions/builtin/browser/src/browser_harness/admin.py +722 -722
  114. package/dist/extensions/builtin/browser/src/browser_harness/daemon.py +328 -328
  115. package/dist/extensions/builtin/browser/src/browser_harness/helpers.py +396 -396
  116. package/dist/extensions/builtin/browser/src/browser_harness/run.py +103 -103
  117. package/dist/extensions/builtin/debug/index.js +9 -9
  118. package/dist/extensions/builtin/discipline/skills/brainstorming/SKILL.md +33 -33
  119. package/dist/extensions/builtin/discipline/skills/executing-plans/SKILL.md +25 -25
  120. package/dist/extensions/builtin/discipline/skills/finishing-development-branch/SKILL.md +25 -25
  121. package/dist/extensions/builtin/discipline/skills/receiving-code-review/SKILL.md +22 -22
  122. package/dist/extensions/builtin/discipline/skills/requesting-code-review/SKILL.md +31 -31
  123. package/dist/extensions/builtin/discipline/skills/systematic-debugging/SKILL.md +28 -28
  124. package/dist/extensions/builtin/discipline/skills/test-driven-development/SKILL.md +32 -32
  125. package/dist/extensions/builtin/discipline/skills/using-git-worktrees/SKILL.md +25 -25
  126. package/dist/extensions/builtin/discipline/skills/verification-before-completion/SKILL.md +27 -27
  127. package/dist/extensions/builtin/discipline/skills/writing-plans/SKILL.md +26 -26
  128. package/dist/extensions/builtin/goal/README.md +67 -67
  129. package/dist/extensions/builtin/goal/index.js +6 -6
  130. package/dist/extensions/builtin/grub/README.md +112 -112
  131. package/dist/extensions/builtin/link-world/agent-workspace/README.md +16 -16
  132. package/dist/extensions/builtin/link-world/internet-search/internet-search.md +65 -65
  133. package/dist/extensions/builtin/link-world/link-world-agent.md +82 -82
  134. package/dist/extensions/builtin/link-world/linkworld.md +313 -313
  135. package/dist/extensions/builtin/link-world/network-routing/network-routing.md +67 -67
  136. package/dist/extensions/builtin/loop/README.md +92 -92
  137. package/dist/extensions/builtin/mcp/figma-design.md +68 -68
  138. package/dist/extensions/builtin/mcp/mcp-management.md +85 -85
  139. package/dist/extensions/builtin/recap/AGENT.md +15 -15
  140. package/dist/extensions/builtin/sal/README.md +72 -72
  141. package/dist/extensions/builtin/security-audit/README.md +289 -289
  142. package/dist/extensions/builtin/team/AGENT.md +112 -112
  143. package/dist/extensions/builtin/team/TESTING.md +299 -299
  144. package/dist/extensions/builtin/token-save/README.md +56 -56
  145. package/dist/extensions/optional/AGENT.md +10 -10
  146. package/dist/modes/interactive/controllers/input-submit-controller.js +2 -2
  147. package/dist/modes/interactive/controllers/stream-render-controller.js +2 -2
  148. package/dist/modes/interactive/interactive-mode.js +19 -19
  149. package/dist/modes/interactive/theme/dark.json +85 -85
  150. package/dist/modes/interactive/theme/light.json +84 -84
  151. package/dist/modes/interactive/theme/theme-schema.json +335 -335
  152. package/dist/modes/interactive/theme/warm.json +81 -81
  153. package/dist/node_modules/@pencil-agent/ai/dist/cli.js +0 -0
  154. package/dist/node_modules/@pencil-agent/ai/dist/models.generated.js +1 -1
  155. package/docs/ACP/345/215/217/350/256/256/351/233/206/346/210/220/345/274/200/345/217/221/346/226/207/346/241/243.md +851 -0
  156. package/docs/SDK-TESTING.md +364 -0
  157. package/docs/codex-goal-command-impl.md +1055 -1055
  158. package/docs/codex-goal-vs-grub.md +500 -500
  159. package/docs/custom-provider.md +27 -27
  160. package/docs/extensions.md +27 -27
  161. package/docs/keybindings.md +27 -27
  162. package/docs/loop /351/207/215/346/236/204/345/256/214/346/210/220/346/200/273/347/273/223.md" +250 -250
  163. package/docs/loop /351/207/215/346/236/204/345/256/214/346/210/220/346/212/245/345/221/212.md" +122 -122
  164. package/docs/loop /351/207/215/346/236/204/346/226/271/346/241/210.md" +1222 -1222
  165. package/docs/loop /351/207/215/346/236/204/346/226/271/346/241/210/345/256/236/347/216/260/346/212/245/345/221/212.md" +158 -158
  166. package/docs/loop /351/207/215/346/236/204/346/226/271/346/241/210/345/257/271/346/257/224/345/210/206/346/236/220.md" +128 -128
  167. package/docs/loop /351/207/215/346/236/204/350/256/241/345/210/222.md" +320 -320
  168. package/docs/loop-usage-examples.md +214 -214
  169. package/docs/mem-core/346/212/200/346/234/257/346/226/207/346/241/243.md +593 -0
  170. package/docs/models.md +27 -27
  171. package/docs/packages.md +27 -27
  172. package/docs/pi-design-philosophy.md +457 -457
  173. package/docs/planmode.md +1987 -1987
  174. package/docs/prompt-templates.md +27 -27
  175. package/docs/providers.md +27 -27
  176. package/docs/sdk.md +27 -27
  177. package/docs/skills.md +27 -27
  178. package/docs/startup-performance-optimization.md +301 -0
  179. package/docs/themes.md +27 -27
  180. package/docs/tui.md +27 -27
  181. package/docs//350/256/244/347/237/245/345/234/260/345/233/276.md +47 -0
  182. package/package.json +190 -190
  183. package/docs/cc-agent-design.md +0 -1297
  184. package/docs/cc-tui-design.md +0 -1333
  185. package/docs/nanoPencil-/345/255/246/344/271/240/350/256/241/345/210/222.md +0 -170
  186. package/docs/scan-report.md +0 -3820
  187. package/docs//345/257/271/346/240/207Claude-Code.md +0 -1775
  188. package/docs//351/230/277/351/207/214/345/267/264/345/267/264/350/264/242/346/212/245/345/210/206/346/236/220/344/271/246.md +0 -261
@@ -1,32 +1,32 @@
1
- ---
2
- name: test-driven-development
3
- description: Use when implementing features, bug fixes, refactors, or behavior changes before writing production code.
4
- ---
5
-
6
- # Test-Driven Development
7
-
8
- Use red, green, refactor for behavior changes.
9
-
10
- ## Gate
11
-
12
- No production behavior change without first seeing a test fail for the intended reason, unless the user explicitly accepts an exception.
13
-
14
- ## Cycle
15
-
16
- 1. Write the smallest test that describes one desired behavior.
17
- 2. Run it and verify it fails for the expected reason.
18
- 3. Implement the minimum production code needed to pass.
19
- 4. Run the focused test and verify it passes.
20
- 5. Run nearby or broader tests appropriate to the blast radius.
21
- 6. Refactor only after tests are green, then re-run verification.
22
-
23
- ## Good Tests
24
-
25
- - Test observable behavior, not private implementation details.
26
- - Prefer real code paths over mocks unless isolation requires a mock.
27
- - Use names that describe the behavior being guaranteed.
28
- - Split tests when the name needs "and".
29
-
30
- ## Exceptions
31
-
32
- Acceptable exceptions include pure documentation, generated artifacts, exploratory prototypes, and configuration-only changes. State the exception before proceeding.
1
+ ---
2
+ name: test-driven-development
3
+ description: Use when implementing features, bug fixes, refactors, or behavior changes before writing production code.
4
+ ---
5
+
6
+ # Test-Driven Development
7
+
8
+ Use red, green, refactor for behavior changes.
9
+
10
+ ## Gate
11
+
12
+ No production behavior change without first seeing a test fail for the intended reason, unless the user explicitly accepts an exception.
13
+
14
+ ## Cycle
15
+
16
+ 1. Write the smallest test that describes one desired behavior.
17
+ 2. Run it and verify it fails for the expected reason.
18
+ 3. Implement the minimum production code needed to pass.
19
+ 4. Run the focused test and verify it passes.
20
+ 5. Run nearby or broader tests appropriate to the blast radius.
21
+ 6. Refactor only after tests are green, then re-run verification.
22
+
23
+ ## Good Tests
24
+
25
+ - Test observable behavior, not private implementation details.
26
+ - Prefer real code paths over mocks unless isolation requires a mock.
27
+ - Use names that describe the behavior being guaranteed.
28
+ - Split tests when the name needs "and".
29
+
30
+ ## Exceptions
31
+
32
+ Acceptable exceptions include pure documentation, generated artifacts, exploratory prototypes, and configuration-only changes. State the exception before proceeding.
@@ -1,25 +1,25 @@
1
- ---
2
- name: using-git-worktrees
3
- description: Use before feature work that should be isolated from the current branch, or before executing a multi-step implementation plan.
4
- ---
5
-
6
- # Using Git Worktrees
7
-
8
- Prefer isolated workspaces for risky or multi-step changes.
9
-
10
- ## Process
11
-
12
- 1. Detect whether the current checkout is already a linked worktree:
13
- - `git rev-parse --git-dir`
14
- - `git rev-parse --git-common-dir`
15
- - `git rev-parse --show-superproject-working-tree`
16
- 2. If already isolated and not a submodule, continue there.
17
- 3. If not isolated, ask before creating a worktree unless the user or plan already requested isolation.
18
- 4. Prefer native workspace tools when available.
19
- 5. If using `git worktree`, place project-local worktrees under `.worktrees/` when it is ignored.
20
- 6. Run project setup only when dependencies are missing or stale.
21
- 7. Establish a clean baseline with the relevant tests before changing behavior.
22
-
23
- ## Safety
24
-
25
- Do not remove harness-owned worktrees. Do not proceed from a failing baseline without telling the user what failed and getting direction or investigating the failure.
1
+ ---
2
+ name: using-git-worktrees
3
+ description: Use before feature work that should be isolated from the current branch, or before executing a multi-step implementation plan.
4
+ ---
5
+
6
+ # Using Git Worktrees
7
+
8
+ Prefer isolated workspaces for risky or multi-step changes.
9
+
10
+ ## Process
11
+
12
+ 1. Detect whether the current checkout is already a linked worktree:
13
+ - `git rev-parse --git-dir`
14
+ - `git rev-parse --git-common-dir`
15
+ - `git rev-parse --show-superproject-working-tree`
16
+ 2. If already isolated and not a submodule, continue there.
17
+ 3. If not isolated, ask before creating a worktree unless the user or plan already requested isolation.
18
+ 4. Prefer native workspace tools when available.
19
+ 5. If using `git worktree`, place project-local worktrees under `.worktrees/` when it is ignored.
20
+ 6. Run project setup only when dependencies are missing or stale.
21
+ 7. Establish a clean baseline with the relevant tests before changing behavior.
22
+
23
+ ## Safety
24
+
25
+ Do not remove harness-owned worktrees. Do not proceed from a failing baseline without telling the user what failed and getting direction or investigating the failure.
@@ -1,27 +1,27 @@
1
- ---
2
- name: verification-before-completion
3
- description: Use before saying work is complete, fixed, passing, implemented, ready, or safe to merge.
4
- ---
5
-
6
- # Verification Before Completion
7
-
8
- Evidence must precede completion claims.
9
-
10
- ## Gate
11
-
12
- Do not claim success from intent, plausibility, previous output, or another agent's report. Verify against the current state.
13
-
14
- ## Process
15
-
16
- 1. Identify each claim you are about to make.
17
- 2. Identify the command, file inspection, diff, runtime check, or rendered artifact that would prove it.
18
- 3. Run or inspect that evidence freshly.
19
- 4. Read the output, exit code, or artifact carefully.
20
- 5. Report the actual state:
21
- - If verified, name the evidence.
22
- - If not verified, say what remains unverified.
23
- - If failed, report the failure and continue work.
24
-
25
- ## Evidence Matching
26
-
27
- Use focused checks for narrow claims and broader checks for broad claims. A passing unit test does not prove a full build, and a successful build does not prove the requested behavior unless the behavior is covered.
1
+ ---
2
+ name: verification-before-completion
3
+ description: Use before saying work is complete, fixed, passing, implemented, ready, or safe to merge.
4
+ ---
5
+
6
+ # Verification Before Completion
7
+
8
+ Evidence must precede completion claims.
9
+
10
+ ## Gate
11
+
12
+ Do not claim success from intent, plausibility, previous output, or another agent's report. Verify against the current state.
13
+
14
+ ## Process
15
+
16
+ 1. Identify each claim you are about to make.
17
+ 2. Identify the command, file inspection, diff, runtime check, or rendered artifact that would prove it.
18
+ 3. Run or inspect that evidence freshly.
19
+ 4. Read the output, exit code, or artifact carefully.
20
+ 5. Report the actual state:
21
+ - If verified, name the evidence.
22
+ - If not verified, say what remains unverified.
23
+ - If failed, report the failure and continue work.
24
+
25
+ ## Evidence Matching
26
+
27
+ Use focused checks for narrow claims and broader checks for broad claims. A passing unit test does not prove a full build, and a successful build does not prove the requested behavior unless the behavior is covered.
@@ -1,26 +1,26 @@
1
- ---
2
- name: writing-plans
3
- description: Use when a task needs multiple implementation steps, multiple files, handoff to another agent, or careful verification sequencing.
4
- ---
5
-
6
- # Writing Plans
7
-
8
- Create an implementation plan that can be executed without rediscovering context.
9
-
10
- ## Required Sections
11
-
12
- - Goal: one sentence describing the user-visible outcome.
13
- - Context: what the codebase currently does and why the change is needed.
14
- - Architecture: the recommended approach and why it fits existing boundaries.
15
- - Files: exact files to create or modify and each file's responsibility.
16
- - Tasks: small ordered steps with verification after meaningful changes.
17
- - Test plan: exact commands and expected evidence.
18
- - Documentation impact: P1/P2/P3 or user docs that must change.
19
-
20
- ## Task Quality
21
-
22
- Each task should be independently understandable. Include exact paths, APIs, data shapes, and expected behavior. Avoid placeholders such as "handle edge cases" or "add tests"; state the actual edge cases and tests.
23
-
24
- ## Handoff
25
-
26
- When the plan is approved, execute it directly or use `executing-plans` for inline execution. Use subagents when tasks are independent and reviewable.
1
+ ---
2
+ name: writing-plans
3
+ description: Use when a task needs multiple implementation steps, multiple files, handoff to another agent, or careful verification sequencing.
4
+ ---
5
+
6
+ # Writing Plans
7
+
8
+ Create an implementation plan that can be executed without rediscovering context.
9
+
10
+ ## Required Sections
11
+
12
+ - Goal: one sentence describing the user-visible outcome.
13
+ - Context: what the codebase currently does and why the change is needed.
14
+ - Architecture: the recommended approach and why it fits existing boundaries.
15
+ - Files: exact files to create or modify and each file's responsibility.
16
+ - Tasks: small ordered steps with verification after meaningful changes.
17
+ - Test plan: exact commands and expected evidence.
18
+ - Documentation impact: P1/P2/P3 or user docs that must change.
19
+
20
+ ## Task Quality
21
+
22
+ Each task should be independently understandable. Include exact paths, APIs, data shapes, and expected behavior. Avoid placeholders such as "handle edge cases" or "add tests"; state the actual edge cases and tests.
23
+
24
+ ## Handoff
25
+
26
+ When the plan is approved, execute it directly or use `executing-plans` for inline execution. Use subagents when tasks are independent and reviewable.
@@ -1,67 +1,67 @@
1
- # Goal Extension
2
-
3
- Long-running task management for nanoPencil. Set a goal with `/goal <objective>` and the
4
- agent will auto-continue working on it across turns until the objective is achieved,
5
- the token budget runs out, or you pause/clear it.
6
-
7
- This extension mirrors the Codex `/goal` command semantics: a per-thread goal, persisted
8
- to disk, with idle-continuation prompts, token accounting, and budget enforcement.
9
-
10
- ## Usage
11
-
12
- ```
13
- /goal Show current goal summary menu
14
- /goal <objective> Set or replace the goal
15
- /goal clear Clear the goal
16
- /goal edit Open the editor to change the objective
17
- /goal pause Pause auto-continuation
18
- /goal resume Resume auto-continuation
19
- /goal help Show usage help
20
- ```
21
-
22
- ## LLM Tools
23
-
24
- The extension registers three LLM-facing tools:
25
-
26
- | Tool | Purpose | Who can call |
27
- |------|---------|--------------|
28
- | `get_goal` | Read the current goal | LLM |
29
- | `create_goal` | Create a new goal (only when the user explicitly asks) | LLM |
30
- | `update_goal` | Mark the goal `complete` or `blocked` | LLM |
31
-
32
- The LLM is only allowed to set the goal's status to `complete` or `blocked`. Pause /
33
- resume / budget limits are user-driven and happen exclusively through `/goal`.
34
-
35
- ## Lifecycle
36
-
37
- The extension subscribes to `turn_start`, `turn_end`, `message_end`, `tool_execution_end`,
38
- and `agent_end` to track token usage and time per turn. When a turn ends with an
39
- `active` goal, the extension injects a follow-up user message containing the
40
- continuation prompt so the agent keeps working on the objective.
41
-
42
- When a turn causes the goal to cross its token budget, the extension injects a
43
- budget-limit steering prompt and marks the goal `budget_limited`. Once budget-limited,
44
- auto-continuation stops and the goal is terminal.
45
-
46
- ## Persistence
47
-
48
- Goals are stored as JSON files under `<agentDir>/goals/<threadId>.json`. They survive
49
- session restarts and are keyed by the active session ID.
50
-
51
- ## Status
52
-
53
- `Status: active` shows in the footer while a goal is running.
54
-
55
- ## Architecture
56
-
57
- | File | Responsibility |
58
- |------|----------------|
59
- | `goal-types.ts` | `ThreadGoalStatus`, `ThreadGoal`, helper predicates |
60
- | `goal-store.ts` | Atomic JSON-file persistence (replace / insert / update / delete / account_usage) |
61
- | `goal-format.ts` | Time/token formatting, summary lines, status indicator, validators |
62
- | `goal-prompts.ts` | Continuation / budget-limit / objective-updated prompt templates |
63
- | `goal-controller.ts` | Per-thread runtime: mutex, turn accounting, idle continuation |
64
- | `goal-tools.ts` | `get_goal`, `create_goal`, `update_goal` LLM tool definitions |
65
- | `goal-parser.ts` | `/goal` slash-command argument parsing |
66
- | `goal-command.ts` | `/goal` slash-command handler (UI + controller dispatch) |
67
- | `index.ts` | Extension entry: tools, command, lifecycle hooks, status indicator |
1
+ # Goal Extension
2
+
3
+ Long-running task management for nanoPencil. Set a goal with `/goal <objective>` and the
4
+ agent will auto-continue working on it across turns until the objective is achieved,
5
+ the token budget runs out, or you pause/clear it.
6
+
7
+ This extension mirrors the Codex `/goal` command semantics: a per-thread goal, persisted
8
+ to disk, with idle-continuation prompts, token accounting, and budget enforcement.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /goal Show current goal summary menu
14
+ /goal <objective> Set or replace the goal
15
+ /goal clear Clear the goal
16
+ /goal edit Open the editor to change the objective
17
+ /goal pause Pause auto-continuation
18
+ /goal resume Resume auto-continuation
19
+ /goal help Show usage help
20
+ ```
21
+
22
+ ## LLM Tools
23
+
24
+ The extension registers three LLM-facing tools:
25
+
26
+ | Tool | Purpose | Who can call |
27
+ |------|---------|--------------|
28
+ | `get_goal` | Read the current goal | LLM |
29
+ | `create_goal` | Create a new goal (only when the user explicitly asks) | LLM |
30
+ | `update_goal` | Mark the goal `complete` or `blocked` | LLM |
31
+
32
+ The LLM is only allowed to set the goal's status to `complete` or `blocked`. Pause /
33
+ resume / budget limits are user-driven and happen exclusively through `/goal`.
34
+
35
+ ## Lifecycle
36
+
37
+ The extension subscribes to `turn_start`, `turn_end`, `message_end`, `tool_execution_end`,
38
+ and `agent_end` to track token usage and time per turn. When a turn ends with an
39
+ `active` goal, the extension injects a follow-up user message containing the
40
+ continuation prompt so the agent keeps working on the objective.
41
+
42
+ When a turn causes the goal to cross its token budget, the extension injects a
43
+ budget-limit steering prompt and marks the goal `budget_limited`. Once budget-limited,
44
+ auto-continuation stops and the goal is terminal.
45
+
46
+ ## Persistence
47
+
48
+ Goals are stored as JSON files under `<agentDir>/goals/<threadId>.json`. They survive
49
+ session restarts and are keyed by the active session ID.
50
+
51
+ ## Status
52
+
53
+ `Status: active` shows in the footer while a goal is running.
54
+
55
+ ## Architecture
56
+
57
+ | File | Responsibility |
58
+ |------|----------------|
59
+ | `goal-types.ts` | `ThreadGoalStatus`, `ThreadGoal`, helper predicates |
60
+ | `goal-store.ts` | Atomic JSON-file persistence (replace / insert / update / delete / account_usage) |
61
+ | `goal-format.ts` | Time/token formatting, summary lines, status indicator, validators |
62
+ | `goal-prompts.ts` | Continuation / budget-limit / objective-updated prompt templates |
63
+ | `goal-controller.ts` | Per-thread runtime: mutex, turn accounting, idle continuation |
64
+ | `goal-tools.ts` | `get_goal`, `create_goal`, `update_goal` LLM tool definitions |
65
+ | `goal-parser.ts` | `/goal` slash-command argument parsing |
66
+ | `goal-command.ts` | `/goal` slash-command handler (UI + controller dispatch) |
67
+ | `index.ts` | Extension entry: tools, command, lifecycle hooks, status indicator |
@@ -1,10 +1,10 @@
1
- var U=Object.defineProperty;var i=(t,r)=>U(t,"name",{value:r,configurable:!0});import*as B from"node:fs";import*as F from"node:os";import*as O from"node:path";import{Box as N,Container as j,Spacer as D,Text as K}from"@pencil-agent/tui";import{runGoalCommand as H}from"./goal-command.js";import{GoalController as J}from"./goal-controller.js";import{getGoalArgumentCompletions as Q}from"./goal-parser.js";import{buildAllGoalTools as X,setGoalToolHost as q}from"./goal-tools.js";import{goalStatusIndicator as G,goalSummaryLines as z,goalUsageSummary as W}from"./goal-format.js";import{isActiveStatus as C}from"./goal-types.js";const y="goal",Y="weak-model-compatible",V=O.join(F.homedir(),".nanopencil","agent","nanopencil-debug.log");function g(t){B.appendFileSync(V,`[${new Date().toISOString()}] [goal] ${t}
2
- `)}i(g,"dbg");function w(t,r){return t.length>r?t.slice(0,r)+"\u2026":t}i(w,"truncate");function Z(t){const r=t.content;if(typeof r=="string")return w(r,150);if(Array.isArray(r)){const c=r.filter(u=>u.type==="text"&&typeof u.text=="string").map(u=>u.text);if(c.length>0)return w(c.join(" "),150);const m=r.filter(u=>u.type==="tool_use").map(u=>`[tool_use:${u.name??"?"}]`);if(m.length>0)return m.join(" ")}return"(empty)"}i(Z,"extractContentPreview");const h=new Map;let k=null,S=null,_=null,$=null;function tt(t,r){const c=r.sessionManager.getSessionId();if(!c)return null;const m=`${r.agentDir}/${c}`;k=m;let u=h.get(m);return u||(u=new J(t,c),h.set(m,u)),S=u,u}i(tt,"resolveController");const et={getController(t,r){const c=`${t}/${r}`;return h.get(c)??null}};function nt(t){return"normal"}i(nt,"detectRunKind");function ot(t){return!!t.getSettings().plan}i(ot,"isPlanMode");function st(t){let r=0;for(const c of t){if(c.role!=="assistant")continue;const u=c.usage;u&&typeof u.totalTokens=="number"&&(r+=u.totalTokens)}return r}i(st,"getRunningTotalTokens");async function rt(t){q(et);const r=i(o=>{const s=tt(t,o);return s&&(S=s),s},"ensureController"),[c,m,u]=X();t.registerTool(c),t.registerTool(m),t.registerTool(u),t.registerMessageRenderer(y,(o,s,e)=>{const l=typeof o.content=="string"?o.content:Array.isArray(o.content)?o.content.filter(a=>a.type==="text").map(a=>a.text).join(`
3
- `):JSON.stringify(o.content??""),d=new N(1,1,a=>e.bg("customMessageBg",a));d.addChild(new K(e.fg("dim",l),0,0));const n=new j;return n.addChild(new D(1)),n.addChild(d),n}),t.registerCommand("goal",{description:"Set, show, edit, pause, resume, or clear the thread goal.",getArgumentCompletions:Q,handler:i(async(o,s)=>{g(`/goal command invoked: args="${o}"`);const e=r(s);await H(o,s,e),_=null,$=null,g("/goal command done, reportedTerminalGoalId reset")},"handler")}),t.on("session_start",(o,s)=>{g("session_start"),r(s)?.resetIdleContinuationFlag(),_=null,$=null}),t.on("session_shutdown",()=>{k&&h.delete(k),k=null,S=null});const E=i((o,s)=>{g(`turn_start index=${o.turnIndex} timestamp=${o.timestamp}`);const e=r(s);if(!e)return;const l=ot(s)?"plan":"normal";e.on_turn_start(`turn-${o.turnIndex}-${o.timestamp}`,l,0)},"onTurnStart");t.on("turn_start",E);const I=i((o,s)=>{r(s);const e=o.message;g(`message_start role=${e.role??"?"}`)},"onMessageStart");t.on("message_start",I);const A=i((o,s)=>{const e=r(s);if(!e)return;const l=o.message,d=Z(l);if(g(`message_end role=${l.role??"?"} tokens=${l.usage?.totalTokens??"?"} content=${d}`),l.role!=="assistant")return;const n=l.usage?.totalTokens;if(typeof n!="number")return;const a=e.on_token_usage(n);if(a.crossed&&a.goal){const f=e.maybe_build_budget_limit_steering();f&&t.sendMessage({customType:y,content:f,display:!0,details:{kind:"budget_limit",goal:a.goal}})}},"onMessageEnd");t.on("message_end",A);const M=i((o,s)=>{g(`tool_execution_end name=${o.toolName} isError=${o.isError} result=${w(JSON.stringify(o.result??""),200)}`);const e=r(s);e&&(o.isError||e.on_tool_finish(o.toolName))},"onToolExecutionEnd");t.on("tool_execution_end",M);const P=i(async(o,s)=>{try{const e=r(s);if(!e)return;const l=e.currentTurnSnapshot(),d=l?((Date.now()-l.turnStartedAt)/1e3).toFixed(1):"?";g(`turn_end BEGIN index=${o.turnIndex} duration=${d}s tokens=${l?.tokensNow??"?"}`);const n=await e.on_turn_end();if(g(`turn_end RESULT: reason=${n.reason} goalId=${n.goal?.goal_id} goalStatus=${n.goal?.status} reportedTerminalGoalId=${_}`),n.reason!=="not_active_status"||!n.goal)return;const a=n.goal.status;if(a==="complete"||a==="blocked"||a==="budget_limited"||a==="paused"){g(`turn_end \u2192 clearing followUp queue (goal is ${a})`);try{t.clearFollowUpQueue()}catch(R){g(`turn_end \u2192 clearFollowUpQueue FAILED: ${R}`)}}const f=n.goal.goal_id,T=n.goal.status;if(_===f&&$===T)return;const p=G(n.goal,null);(p.type==="Complete"||p.type==="BudgetLimited")&&(_=f,$=T,g(`turn_end \u2192 sending terminal message: ${p.type} for goal ${f}`),t.sendMessage({customType:y,content:`Goal ${p.type==="Complete"?"complete":"budget_limited"}.
1
+ var R=Object.defineProperty;var i=(t,r)=>R(t,"name",{value:r,configurable:!0});import*as E from"node:fs";import*as F from"node:os";import*as G from"node:path";import{Box as j,Container as D,Spacer as K,Text as H}from"@pencil-agent/tui";import{runGoalCommand as J}from"./goal-command.js";import{GoalController as Q}from"./goal-controller.js";import{getGoalArgumentCompletions as X}from"./goal-parser.js";import{buildAllGoalTools as q,setGoalToolHost as z}from"./goal-tools.js";import{goalStatusIndicator as C,goalSummaryLines as W,goalUsageSummary as Y}from"./goal-format.js";import{isActiveStatus as I}from"./goal-types.js";const y="goal",V="weak-model-compatible",Z=process.env.NANOPENCIL_DEBUG==="1",A=G.join(F.homedir(),".nanopencil","agent","nanopencil-debug.log");function g(t){if(Z)try{E.mkdirSync(G.dirname(A),{recursive:!0}),E.appendFileSync(A,`[${new Date().toISOString()}] [goal] ${t}
2
+ `)}catch{}}i(g,"dbg");function w(t,r){return t.length>r?t.slice(0,r)+"\u2026":t}i(w,"truncate");function tt(t){const r=t.content;if(typeof r=="string")return w(r,150);if(Array.isArray(r)){const c=r.filter(u=>u.type==="text"&&typeof u.text=="string").map(u=>u.text);if(c.length>0)return w(c.join(" "),150);const m=r.filter(u=>u.type==="tool_use").map(u=>`[tool_use:${u.name??"?"}]`);if(m.length>0)return m.join(" ")}return"(empty)"}i(tt,"extractContentPreview");const h=new Map;let k=null,S=null,_=null,$=null;function et(t,r){const c=r.sessionManager.getSessionId();if(!c)return null;const m=`${r.agentDir}/${c}`;k=m;let u=h.get(m);return u||(u=new Q(t,c),h.set(m,u)),S=u,u}i(et,"resolveController");const nt={getController(t,r){const c=`${t}/${r}`;return h.get(c)??null}};function ot(t){return"normal"}i(ot,"detectRunKind");function st(t){return!!t.getSettings().plan}i(st,"isPlanMode");function rt(t){let r=0;for(const c of t){if(c.role!=="assistant")continue;const u=c.usage;u&&typeof u.totalTokens=="number"&&(r+=u.totalTokens)}return r}i(rt,"getRunningTotalTokens");async function at(t){z(nt);const r=i(o=>{const s=et(t,o);return s&&(S=s),s},"ensureController"),[c,m,u]=q();t.registerTool(c),t.registerTool(m),t.registerTool(u),t.registerMessageRenderer(y,(o,s,e)=>{const l=typeof o.content=="string"?o.content:Array.isArray(o.content)?o.content.filter(a=>a.type==="text").map(a=>a.text).join(`
3
+ `):JSON.stringify(o.content??""),d=new j(1,1,a=>e.bg("customMessageBg",a));d.addChild(new H(e.fg("dim",l),0,0));const n=new D;return n.addChild(new K(1)),n.addChild(d),n}),t.registerCommand("goal",{description:"Set, show, edit, pause, resume, or clear the thread goal.",getArgumentCompletions:X,handler:i(async(o,s)=>{g(`/goal command invoked: args="${o}"`);const e=r(s);await J(o,s,e),_=null,$=null,g("/goal command done, reportedTerminalGoalId reset")},"handler")}),t.on("session_start",(o,s)=>{g("session_start"),r(s)?.resetIdleContinuationFlag(),_=null,$=null}),t.on("session_shutdown",()=>{k&&h.delete(k),k=null,S=null});const P=i((o,s)=>{g(`turn_start index=${o.turnIndex} timestamp=${o.timestamp}`);const e=r(s);if(!e)return;const l=st(s)?"plan":"normal";e.on_turn_start(`turn-${o.turnIndex}-${o.timestamp}`,l,0)},"onTurnStart");t.on("turn_start",P);const M=i((o,s)=>{r(s);const e=o.message;g(`message_start role=${e.role??"?"}`)},"onMessageStart");t.on("message_start",M);const v=i((o,s)=>{const e=r(s);if(!e)return;const l=o.message,d=tt(l);if(g(`message_end role=${l.role??"?"} tokens=${l.usage?.totalTokens??"?"} content=${d}`),l.role!=="assistant")return;const n=l.usage?.totalTokens;if(typeof n!="number")return;const a=e.on_token_usage(n);if(a.crossed&&a.goal){const f=e.maybe_build_budget_limit_steering();f&&t.sendMessage({customType:y,content:f,display:!0,details:{kind:"budget_limit",goal:a.goal}})}},"onMessageEnd");t.on("message_end",v);const L=i((o,s)=>{g(`tool_execution_end name=${o.toolName} isError=${o.isError} result=${w(JSON.stringify(o.result??""),200)}`);const e=r(s);e&&(o.isError||e.on_tool_finish(o.toolName))},"onToolExecutionEnd");t.on("tool_execution_end",L);const N=i(async(o,s)=>{try{const e=r(s);if(!e)return;const l=e.currentTurnSnapshot(),d=l?((Date.now()-l.turnStartedAt)/1e3).toFixed(1):"?";g(`turn_end BEGIN index=${o.turnIndex} duration=${d}s tokens=${l?.tokensNow??"?"}`);const n=await e.on_turn_end();if(g(`turn_end RESULT: reason=${n.reason} goalId=${n.goal?.goal_id} goalStatus=${n.goal?.status} reportedTerminalGoalId=${_}`),n.reason!=="not_active_status"||!n.goal)return;const a=n.goal.status;if(a==="complete"||a==="blocked"||a==="budget_limited"||a==="paused"){g(`turn_end \u2192 clearing followUp queue (goal is ${a})`);try{t.clearFollowUpQueue()}catch(O){g(`turn_end \u2192 clearFollowUpQueue FAILED: ${O}`)}}const f=n.goal.goal_id,T=n.goal.status;if(_===f&&$===T)return;const p=C(n.goal,null);(p.type==="Complete"||p.type==="BudgetLimited")&&(_=f,$=T,g(`turn_end \u2192 sending terminal message: ${p.type} for goal ${f}`),t.sendMessage({customType:y,content:`Goal ${p.type==="Complete"?"complete":"budget_limited"}.
4
4
  ${b(n.goal)}`,display:!0,details:{kind:p.type.toLowerCase(),goal:n.goal}},{triggerTurn:!1}))}catch(e){g(`turn_end EXCEPTION: ${e instanceof Error?e.message:String(e)}
5
- ${e instanceof Error?e.stack:""}`)}},"onTurnEnd");t.on("turn_end",P);const L=i(async(o,s)=>{try{const e=r(s);if(!e)return;const l=st(o.messages);e.on_token_usage(l);const d=e.runStopReason;if(g(`agent_end stopReason=${d??"unknown"}`),d==="aborted")return;if(d==="error"){const a=e.on_turn_error();a&&a.status==="blocked"&&(g(`agent_end \u2192 goal ${a.goal_id} blocked after run error`),t.sendMessage({customType:y,content:`Goal blocked: the run ended with an error. Use /goal resume to continue.
5
+ ${e instanceof Error?e.stack:""}`)}},"onTurnEnd");t.on("turn_end",N);const U=i(async(o,s)=>{try{const e=r(s);if(!e)return;const l=rt(o.messages);e.on_token_usage(l);const d=e.runStopReason;if(g(`agent_end stopReason=${d??"unknown"}`),d==="aborted")return;if(d==="error"){const a=e.on_turn_error();a&&a.status==="blocked"&&(g(`agent_end \u2192 goal ${a.goal_id} blocked after run error`),t.sendMessage({customType:y,content:`Goal blocked: the run ended with an error. Use /goal resume to continue.
6
6
  ${b(a)}`,display:!0,details:{kind:"blocked_on_error",goal:a}},{triggerTurn:!1}));return}const n=e.maybe_dispatch_continuation({hasPendingMessages:s.hasPendingMessages()});if(g(`agent_end DISPATCH: dispatched=${n.dispatched} reason=${n.reason} goalStatus=${n.goal?.status}`),n.dispatched)t.sendMessage({customType:y,content:`Goal continuation dispatched.
7
7
  ${b(n.goal)}`,display:!0,details:{kind:"continuation",goal:n.goal}},{triggerTurn:!1});else if(n.goal&&n.reason==="continuation_limit_reached")s.hasUI&&s.ui.setStatus("goal","Continuation limit \u2014 /goal resume to continue");else if(n.goal&&n.reason==="total_continuation_limit_reached"){if(_===n.goal.goal_id&&$==="paused")return;_=n.goal.goal_id,$="paused",t.sendMessage({customType:y,content:`Goal auto-paused after ${n.consecutiveContinuations??"?"} continuation turns. Use /goal resume to continue.
8
8
  ${b(n.goal)}`,display:!0,details:{kind:"total_continuation_limit",goal:n.goal}},{triggerTurn:!1})}}catch(e){g(`agent_end EXCEPTION: ${e instanceof Error?e.message:String(e)}
9
- ${e instanceof Error?e.stack:""}`)}},"onAgentEnd");t.on("agent_end",L);const v=i((o,s)=>{const e=r(s);if(!e)return;e.note_run_stop_reason(o.stopReason);const l=o.usage;l&&typeof l.totalTokens=="number"&&e.on_token_usage(l.totalTokens);const d=o.loopFramework;nt(d)},"onAgentResult");t.on("agent_result",v);const x=i(async(o,s)=>{const e=r(s);if(!e)return;const l=await e.get_goal();!l||!C(l.status)||(g(`agent_abort \u2192 pausing goal ${l.goal_id}`),await e.set_status("paused"),_=null,$=null,s.hasUI&&s.ui.notify("Goal paused (agent aborted).","info"))},"onAgentAbort");t.on("agent_abort",x),t.on("session_start",(o,s)=>{if(!s.hasUI)return;const l=setInterval(i(()=>{const n=S;n&&n.get_goal().then(a=>{if(!a||!C(a.status)&&a.status!=="budget_limited"&&a.status!=="complete"){s.ui.setStatus("goal",void 0);return}const f=n.currentTurnSnapshot()?.turnStartedAt??null,T=G(a,f),p=at(T);s.ui.setStatus("goal",p)}).catch(()=>{})},"tick"),200),d=i(()=>clearInterval(l),"cleanup");t.on("session_shutdown",()=>d())})}i(rt,"goalExtension");function at(t){switch(t.type){case"Active":return`Pursuing goal (${t.usage})`;case"Paused":return"Goal paused (/goal resume)";case"Blocked":return"Goal blocked (/goal resume)";case"UsageLimited":return"Goal hit usage limits (/goal resume)";case"BudgetLimited":return t.usage?`Goal unmet (${t.usage})`:"Goal abandoned";case"Complete":return`Goal achieved (${t.usage})`}}i(at,"indicatorLabel");function b(t){if(!t)return"";const r=z(t),c=W(t);return[` Status: ${t.status}`,` Objective: ${t.objective}`,` Time used: ${c.elapsed}`,` Tokens used: ${c.tokensLabel}${c.hasBudget?" tokens":""}`].join(`
10
- `)}i(b,"summarizeGoalStatus");export{rt as default};
9
+ ${e instanceof Error?e.stack:""}`)}},"onAgentEnd");t.on("agent_end",U);const x=i((o,s)=>{const e=r(s);if(!e)return;e.note_run_stop_reason(o.stopReason);const l=o.usage;l&&typeof l.totalTokens=="number"&&e.on_token_usage(l.totalTokens);const d=o.loopFramework;ot(d)},"onAgentResult");t.on("agent_result",x);const B=i(async(o,s)=>{const e=r(s);if(!e)return;const l=await e.get_goal();!l||!I(l.status)||(g(`agent_abort \u2192 pausing goal ${l.goal_id}`),await e.set_status("paused"),_=null,$=null,s.hasUI&&s.ui.notify("Goal paused (agent aborted).","info"))},"onAgentAbort");t.on("agent_abort",B),t.on("session_start",(o,s)=>{if(!s.hasUI)return;const l=setInterval(i(()=>{const n=S;n&&n.get_goal().then(a=>{if(!a||!I(a.status)&&a.status!=="budget_limited"&&a.status!=="complete"){s.ui.setStatus("goal",void 0);return}const f=n.currentTurnSnapshot()?.turnStartedAt??null,T=C(a,f),p=lt(T);s.ui.setStatus("goal",p)}).catch(()=>{})},"tick"),200),d=i(()=>clearInterval(l),"cleanup");t.on("session_shutdown",()=>d())})}i(at,"goalExtension");function lt(t){switch(t.type){case"Active":return`Pursuing goal (${t.usage})`;case"Paused":return"Goal paused (/goal resume)";case"Blocked":return"Goal blocked (/goal resume)";case"UsageLimited":return"Goal hit usage limits (/goal resume)";case"BudgetLimited":return t.usage?`Goal unmet (${t.usage})`:"Goal abandoned";case"Complete":return`Goal achieved (${t.usage})`}}i(lt,"indicatorLabel");function b(t){if(!t)return"";const r=W(t),c=Y(t);return[` Status: ${t.status}`,` Objective: ${t.objective}`,` Time used: ${c.elapsed}`,` Tokens used: ${c.tokensLabel}${c.hasBudget?" tokens":""}`].join(`
10
+ `)}i(b,"summarizeGoalStatus");export{at as default};