@oh-my-pi/pi-coding-agent 15.0.0 → 15.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 (140) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/examples/extensions/plan-mode.ts +0 -1
  3. package/package.json +9 -9
  4. package/scripts/build-binary.ts +5 -0
  5. package/src/autoresearch/helpers.ts +17 -0
  6. package/src/autoresearch/tools/log-experiment.ts +9 -17
  7. package/src/autoresearch/tools/run-experiment.ts +2 -17
  8. package/src/capability/skill.ts +7 -0
  9. package/src/cli/list-models.ts +1 -1
  10. package/src/cli/shell-cli.ts +3 -13
  11. package/src/cli/update-cli.ts +1 -1
  12. package/src/cli.ts +10 -29
  13. package/src/commit/agentic/tools/propose-changelog.ts +8 -1
  14. package/src/commit/analysis/conventional.ts +8 -66
  15. package/src/commit/map-reduce/reduce-phase.ts +6 -65
  16. package/src/commit/pipeline.ts +2 -2
  17. package/src/commit/shared-llm.ts +89 -0
  18. package/src/config/config-file.ts +210 -0
  19. package/src/config/model-equivalence.ts +8 -11
  20. package/src/config/model-registry.ts +13 -2
  21. package/src/config/model-resolver.ts +1 -4
  22. package/src/config/settings-schema.ts +71 -1
  23. package/src/config/settings.ts +1 -1
  24. package/src/config.ts +3 -219
  25. package/src/edit/renderer.ts +7 -1
  26. package/src/eval/js/executor.ts +3 -0
  27. package/src/eval/js/shared/rewrite-imports.ts +2 -2
  28. package/src/eval/py/executor.ts +5 -0
  29. package/src/exa/factory.ts +2 -2
  30. package/src/exa/mcp-client.ts +74 -1
  31. package/src/exec/bash-executor.ts +5 -1
  32. package/src/export/html/template.generated.ts +1 -1
  33. package/src/export/html/template.js +0 -11
  34. package/src/extensibility/extensions/runner.ts +1 -1
  35. package/src/extensibility/extensions/types.ts +89 -223
  36. package/src/extensibility/hooks/types.ts +89 -314
  37. package/src/extensibility/shared-events.ts +343 -0
  38. package/src/extensibility/skills.ts +9 -0
  39. package/src/goals/index.ts +3 -0
  40. package/src/goals/runtime.ts +500 -0
  41. package/src/goals/state.ts +37 -0
  42. package/src/goals/tools/goal-tool.ts +237 -0
  43. package/src/hashline/anchors.ts +2 -2
  44. package/src/hindsight/mental-models.ts +1 -1
  45. package/src/internal-urls/agent-protocol.ts +1 -20
  46. package/src/internal-urls/artifact-protocol.ts +1 -19
  47. package/src/internal-urls/docs-index.generated.ts +5 -6
  48. package/src/internal-urls/registry-helpers.ts +25 -0
  49. package/src/main.ts +11 -2
  50. package/src/mcp/oauth-flow.ts +20 -0
  51. package/src/modes/acp/acp-agent.ts +79 -45
  52. package/src/modes/components/assistant-message.ts +14 -8
  53. package/src/modes/components/bash-execution.ts +24 -63
  54. package/src/modes/components/custom-message.ts +14 -40
  55. package/src/modes/components/eval-execution.ts +27 -57
  56. package/src/modes/components/execution-shared.ts +102 -0
  57. package/src/modes/components/hook-message.ts +17 -49
  58. package/src/modes/components/mcp-add-wizard.ts +26 -5
  59. package/src/modes/components/message-frame.ts +88 -0
  60. package/src/modes/components/model-selector.ts +1 -1
  61. package/src/modes/components/session-observer-overlay.ts +6 -2
  62. package/src/modes/components/session-selector.ts +1 -1
  63. package/src/modes/components/status-line/segments.ts +55 -4
  64. package/src/modes/components/status-line/types.ts +4 -0
  65. package/src/modes/components/status-line.ts +28 -10
  66. package/src/modes/components/tool-execution.ts +7 -8
  67. package/src/modes/controllers/command-controller-shared.ts +108 -0
  68. package/src/modes/controllers/command-controller.ts +13 -4
  69. package/src/modes/controllers/event-controller.ts +36 -7
  70. package/src/modes/controllers/input-controller.ts +13 -0
  71. package/src/modes/controllers/mcp-command-controller.ts +56 -61
  72. package/src/modes/controllers/ssh-command-controller.ts +18 -57
  73. package/src/modes/interactive-mode.ts +624 -52
  74. package/src/modes/print-mode.ts +16 -86
  75. package/src/modes/rpc/rpc-mode.ts +14 -87
  76. package/src/modes/runtime-init.ts +115 -0
  77. package/src/modes/theme/defaults/dark-poimandres.json +2 -0
  78. package/src/modes/theme/defaults/light-poimandres.json +2 -0
  79. package/src/modes/theme/theme.ts +18 -6
  80. package/src/modes/types.ts +14 -3
  81. package/src/modes/utils/context-usage.ts +13 -13
  82. package/src/modes/utils/ui-helpers.ts +10 -3
  83. package/src/plan-mode/approved-plan.ts +35 -1
  84. package/src/prompts/goals/goal-budget-limit.md +16 -0
  85. package/src/prompts/goals/goal-continuation.md +28 -0
  86. package/src/prompts/goals/goal-mode-active.md +23 -0
  87. package/src/prompts/system/plan-mode-active.md +5 -5
  88. package/src/prompts/system/plan-mode-tool-decision-reminder.md +1 -1
  89. package/src/prompts/tools/bash.md +6 -0
  90. package/src/prompts/tools/goal.md +13 -0
  91. package/src/prompts/tools/hashline.md +102 -114
  92. package/src/prompts/tools/read.md +1 -0
  93. package/src/prompts/tools/resolve.md +6 -5
  94. package/src/sdk.ts +12 -5
  95. package/src/session/agent-session.ts +428 -106
  96. package/src/session/blob-store.ts +36 -3
  97. package/src/session/messages.ts +67 -2
  98. package/src/session/session-manager.ts +131 -12
  99. package/src/session/session-storage.ts +33 -15
  100. package/src/session/streaming-output.ts +309 -13
  101. package/src/slash-commands/builtin-registry.ts +18 -0
  102. package/src/ssh/ssh-executor.ts +5 -0
  103. package/src/system-prompt.ts +4 -2
  104. package/src/task/executor.ts +17 -7
  105. package/src/task/index.ts +3 -0
  106. package/src/task/render.ts +21 -15
  107. package/src/task/types.ts +4 -0
  108. package/src/tools/ast-edit.ts +21 -120
  109. package/src/tools/ast-grep.ts +21 -119
  110. package/src/tools/bash-interactive.ts +9 -1
  111. package/src/tools/bash.ts +27 -4
  112. package/src/tools/browser/attach.ts +3 -3
  113. package/src/tools/browser/launch.ts +81 -18
  114. package/src/tools/browser/registry.ts +1 -5
  115. package/src/tools/browser/tab-supervisor.ts +51 -14
  116. package/src/tools/conflict-detect.ts +15 -4
  117. package/src/tools/eval.ts +3 -1
  118. package/src/tools/find.ts +20 -38
  119. package/src/tools/gh.ts +7 -6
  120. package/src/tools/index.ts +22 -11
  121. package/src/tools/inspect-image.ts +3 -10
  122. package/src/tools/output-meta.ts +176 -37
  123. package/src/tools/path-utils.ts +125 -2
  124. package/src/tools/read.ts +516 -233
  125. package/src/tools/render-utils.ts +92 -0
  126. package/src/tools/renderers.ts +2 -0
  127. package/src/tools/resolve.ts +72 -44
  128. package/src/tools/search.ts +120 -186
  129. package/src/tools/write.ts +44 -9
  130. package/src/utils/file-mentions.ts +1 -1
  131. package/src/utils/image-loading.ts +7 -3
  132. package/src/utils/image-resize.ts +32 -43
  133. package/src/vim/parser.ts +0 -17
  134. package/src/vim/render.ts +1 -1
  135. package/src/vim/types.ts +1 -1
  136. package/src/web/search/providers/gemini.ts +35 -95
  137. package/src/prompts/tools/exit-plan-mode.md +0 -6
  138. package/src/tools/exit-plan-mode.ts +0 -97
  139. package/src/utils/fuzzy.ts +0 -108
  140. package/src/utils/image-convert.ts +0 -27
@@ -1155,16 +1155,6 @@
1155
1155
  return html;
1156
1156
  }
1157
1157
 
1158
- function renderExitPlanMode(name, args, result, ctx) {
1159
- const badges = args.title ? [String(args.title)] : null;
1160
- let html = toolHead('exit_plan_mode', '', badges);
1161
- if (result) {
1162
- const output = ctx.getResultText();
1163
- if (output) html += formatExpandableOutput(output, 8);
1164
- }
1165
- return html;
1166
- }
1167
-
1168
1158
  function renderResolve(name, args, result, ctx) {
1169
1159
  const action = str(args.action) || '?';
1170
1160
  let html = toolHead('resolve', '', [action]);
@@ -1562,7 +1552,6 @@
1562
1552
  inspect_image: renderInspectImage,
1563
1553
  generate_image: renderGenerateImage,
1564
1554
  ask: renderAsk,
1565
- exit_plan_mode: renderExitPlanMode,
1566
1555
  resolve: renderResolve,
1567
1556
  github: renderGh,
1568
1557
  render_mermaid: renderMermaid,
@@ -63,7 +63,7 @@ export type ExtensionErrorListener = (error: ExtensionError) => void;
63
63
  export const EXTENSION_HANDLER_TIMEOUT_MS = 30_000;
64
64
  let extensionHandlerTimeoutMs = EXTENSION_HANDLER_TIMEOUT_MS;
65
65
 
66
- export function __test_setExtensionHandlerTimeoutMs(timeoutMs: number): void {
66
+ export function testSetExtensionHandlerTimeoutMs(timeoutMs: number): void {
67
67
  extensionHandlerTimeoutMs = timeoutMs;
68
68
  }
69
69
 
@@ -18,13 +18,11 @@ import type {
18
18
  ProviderResponseMetadata,
19
19
  SimpleStreamOptions,
20
20
  TextContent,
21
- ToolResultMessage,
22
21
  } from "@oh-my-pi/pi-ai";
23
22
  import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/utils/oauth/types";
24
23
  import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
25
24
  import type { AutocompleteItem, Component, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui";
26
25
  import type { Static, TSchema } from "@sinclair/typebox";
27
- import type { Rule } from "../../capability/rule";
28
26
  import type { KeybindingsManager } from "../../config/keybindings";
29
27
  import type { ModelRegistry } from "../../config/model-registry";
30
28
  import type { EditToolDetails } from "../../edit";
@@ -33,15 +31,9 @@ import type { BashResult } from "../../exec/bash-executor";
33
31
  import type { ExecOptions, ExecResult } from "../../exec/exec";
34
32
  import type { CustomEditor } from "../../modes/components/custom-editor";
35
33
  import type { Theme } from "../../modes/theme/theme";
36
- import type { CompactionPreparation, CompactionResult } from "../../session/compaction";
34
+ import type { CompactionResult } from "../../session/compaction";
37
35
  import type { CustomMessage } from "../../session/messages";
38
- import type {
39
- BranchSummaryEntry,
40
- CompactionEntry,
41
- ReadonlySessionManager,
42
- SessionEntry,
43
- SessionManager,
44
- } from "../../session/session-manager";
36
+ import type { ReadonlySessionManager, SessionManager } from "../../session/session-manager";
45
37
  import type {
46
38
  BashToolDetails,
47
39
  BashToolInput,
@@ -53,8 +45,40 @@ import type {
53
45
  SearchToolInput,
54
46
  WriteToolInput,
55
47
  } from "../../tools";
56
- import type { TodoItem } from "../../tools/todo-write";
57
48
  import type { EventBus } from "../../utils/event-bus";
49
+ import type {
50
+ AgentEndEvent,
51
+ AgentStartEvent,
52
+ AutoCompactionEndEvent,
53
+ AutoCompactionStartEvent,
54
+ AutoRetryEndEvent,
55
+ AutoRetryStartEvent,
56
+ ContextEvent,
57
+ GoalUpdatedEvent,
58
+ SessionBeforeBranchEvent,
59
+ SessionBeforeBranchResult,
60
+ SessionBeforeCompactEvent,
61
+ SessionBeforeCompactResult,
62
+ SessionBeforeSwitchEvent,
63
+ SessionBeforeSwitchResult,
64
+ SessionBeforeTreeEvent,
65
+ SessionBeforeTreeResult,
66
+ SessionBranchEvent,
67
+ SessionCompactEvent,
68
+ SessionCompactingEvent,
69
+ SessionCompactingResult,
70
+ SessionEvent,
71
+ SessionShutdownEvent,
72
+ SessionStartEvent,
73
+ SessionSwitchEvent,
74
+ SessionTreeEvent,
75
+ TodoReminderEvent,
76
+ ToolCallEventResult,
77
+ ToolResultEventResult,
78
+ TtsrTriggeredEvent,
79
+ TurnEndEvent,
80
+ TurnStartEvent,
81
+ } from "../shared-events";
58
82
  import type { SlashCommandInfo } from "../slash-commands";
59
83
 
60
84
  export type { AppKeybinding, KeybindingsManager } from "../../config/keybindings";
@@ -104,6 +128,11 @@ export type ExtensionWidgetContent = string[] | ExtensionUiComponentFactory | un
104
128
  * UI context for extensions to request interactive UI.
105
129
  * Each mode (interactive, RPC, print) provides its own implementation.
106
130
  */
131
+ // fallow-ignore-next-line code-duplication
132
+ // Parallel to HookUIContext: extensions expose a strictly larger UI surface
133
+ // (custom editor component, header/footer, widgets, theming, terminal input)
134
+ // and may be invoked from event handlers that have already taken the agent
135
+ // loop's lock — hooks intentionally cannot.
107
136
  export interface ExtensionUIContext {
108
137
  /** Show a selector and return the user's choice. */
109
138
  select(title: string, options: string[], dialogOptions?: ExtensionUIDialogOptions): Promise<string | undefined>;
@@ -221,6 +250,11 @@ export interface CompactOptions {
221
250
  /**
222
251
  * Context passed to extension event handlers.
223
252
  */
253
+ // fallow-ignore-next-line code-duplication
254
+ // Parallel to HookContext: extensions expose a strictly larger runtime
255
+ // surface (model registry, system prompt, shutdown, full session manager
256
+ // access). Field overlap is incidental; merging into a base would require
257
+ // hooks to widen their public contract.
224
258
  export interface ExtensionContext {
225
259
  /** UI methods for user interaction */
226
260
  ui: ExtensionUIContext;
@@ -256,6 +290,10 @@ export interface ExtensionContext {
256
290
  * Extended context for command handlers.
257
291
  * Includes session control methods only safe in user-initiated commands.
258
292
  */
293
+ // fallow-ignore-next-line code-duplication
294
+ // Parallel to HookCommandContext: same method names, different invariants —
295
+ // extension commands additionally permit `switchSession` and `reload`,
296
+ // which hooks must not call to avoid deadlocking the agent loop.
259
297
  export interface ExtensionCommandContext extends ExtensionContext {
260
298
  /** Get current context usage for the active model. */
261
299
  getContextUsage(): ContextUsage | undefined;
@@ -373,115 +411,30 @@ export interface ResourcesDiscoverResult {
373
411
  }
374
412
 
375
413
  // ============================================================================
376
- // Session Events
414
+ // Session Events (shared with hooks subsystem)
377
415
  // ============================================================================
378
416
 
379
- /** Fired on initial session load */
380
- export interface SessionStartEvent {
381
- type: "session_start";
382
- }
383
-
384
- /** Fired before switching to another session (can be cancelled) */
385
- export interface SessionBeforeSwitchEvent {
386
- type: "session_before_switch";
387
- reason: "new" | "resume" | "fork";
388
- targetSessionFile?: string;
389
- }
390
-
391
- /** Fired after switching to another session */
392
- export interface SessionSwitchEvent {
393
- type: "session_switch";
394
- reason: "new" | "resume" | "fork";
395
- previousSessionFile: string | undefined;
396
- }
397
-
398
- /** Fired before branching a session (can be cancelled) */
399
- export interface SessionBeforeBranchEvent {
400
- type: "session_before_branch";
401
- entryId: string;
402
- }
403
-
404
- /** Fired after branching a session */
405
- export interface SessionBranchEvent {
406
- type: "session_branch";
407
- previousSessionFile: string | undefined;
408
- }
409
-
410
- /** Fired before context compaction (can be cancelled or customized) */
411
- export interface SessionBeforeCompactEvent {
412
- type: "session_before_compact";
413
- preparation: CompactionPreparation;
414
- branchEntries: SessionEntry[];
415
- customInstructions?: string;
416
- signal: AbortSignal;
417
- }
418
-
419
- /** Fired before compaction summarization to customize prompts/context */
420
- export interface SessionCompactingEvent {
421
- type: "session.compacting";
422
- sessionId: string;
423
- messages: AgentMessage[];
424
- }
425
-
426
- /** Fired after context compaction */
427
- export interface SessionCompactEvent {
428
- type: "session_compact";
429
- compactionEntry: CompactionEntry;
430
- fromExtension: boolean;
431
- }
432
-
433
- /** Fired on process exit */
434
- export interface SessionShutdownEvent {
435
- type: "session_shutdown";
436
- }
437
-
438
- /** Preparation data for tree navigation */
439
- export interface TreePreparation {
440
- targetId: string;
441
- oldLeafId: string | null;
442
- commonAncestorId: string | null;
443
- entriesToSummarize: SessionEntry[];
444
- userWantsSummary: boolean;
445
- }
446
-
447
- /** Fired before navigating in the session tree (can be cancelled) */
448
- export interface SessionBeforeTreeEvent {
449
- type: "session_before_tree";
450
- preparation: TreePreparation;
451
- signal: AbortSignal;
452
- }
453
-
454
- /** Fired after navigating in the session tree */
455
- export interface SessionTreeEvent {
456
- type: "session_tree";
457
- newLeafId: string | null;
458
- oldLeafId: string | null;
459
- summaryEntry?: BranchSummaryEntry;
460
- fromExtension?: boolean;
461
- }
462
-
463
- export type SessionEvent =
464
- | SessionStartEvent
465
- | SessionBeforeSwitchEvent
466
- | SessionSwitchEvent
467
- | SessionBeforeBranchEvent
468
- | SessionBranchEvent
469
- | SessionBeforeCompactEvent
470
- | SessionCompactingEvent
471
- | SessionCompactEvent
472
- | SessionShutdownEvent
473
- | SessionBeforeTreeEvent
474
- | SessionTreeEvent;
417
+ export type {
418
+ SessionBeforeBranchEvent,
419
+ SessionBeforeCompactEvent,
420
+ SessionBeforeSwitchEvent,
421
+ SessionBeforeTreeEvent,
422
+ SessionBranchEvent,
423
+ SessionCompactEvent,
424
+ SessionCompactingEvent,
425
+ SessionEvent,
426
+ SessionShutdownEvent,
427
+ SessionStartEvent,
428
+ SessionSwitchEvent,
429
+ SessionTreeEvent,
430
+ TreePreparation,
431
+ } from "../shared-events";
475
432
 
476
433
  // ============================================================================
477
434
  // Agent Events
478
435
  // ============================================================================
479
436
 
480
- /** Fired before each LLM call. Can modify messages. */
481
- export interface ContextEvent {
482
- type: "context";
483
- messages: AgentMessage[];
484
- }
437
+ export type { ContextEvent } from "../shared-events";
485
438
 
486
439
  /** Fired before a provider request is sent. Can replace the payload. */
487
440
  export interface BeforeProviderRequestEvent {
@@ -502,31 +455,7 @@ export interface BeforeAgentStartEvent {
502
455
  systemPrompt: string[];
503
456
  }
504
457
 
505
- /** Fired when an agent loop starts */
506
- export interface AgentStartEvent {
507
- type: "agent_start";
508
- }
509
-
510
- /** Fired when an agent loop ends */
511
- export interface AgentEndEvent {
512
- type: "agent_end";
513
- messages: AgentMessage[];
514
- }
515
-
516
- /** Fired at the start of each turn */
517
- export interface TurnStartEvent {
518
- type: "turn_start";
519
- turnIndex: number;
520
- timestamp: number;
521
- }
522
-
523
- /** Fired at the end of each turn */
524
- export interface TurnEndEvent {
525
- type: "turn_end";
526
- turnIndex: number;
527
- message: AgentMessage;
528
- toolResults: ToolResultMessage[];
529
- }
458
+ export type { AgentEndEvent, AgentStartEvent, TurnEndEvent, TurnStartEvent } from "../shared-events";
530
459
 
531
460
  /** Fired when a message starts (user, assistant, or toolResult) */
532
461
  export interface MessageStartEvent {
@@ -574,55 +503,14 @@ export interface ToolExecutionEndEvent {
574
503
  isError: boolean;
575
504
  }
576
505
 
577
- /** Fired when auto-compaction starts */
578
- export interface AutoCompactionStartEvent {
579
- type: "auto_compaction_start";
580
- reason: "threshold" | "overflow" | "idle";
581
- action: "context-full" | "handoff";
582
- }
583
-
584
- /** Fired when auto-compaction ends */
585
- export interface AutoCompactionEndEvent {
586
- type: "auto_compaction_end";
587
- action: "context-full" | "handoff";
588
- result: CompactionResult | undefined;
589
- aborted: boolean;
590
- willRetry: boolean;
591
- errorMessage?: string;
592
- /** True when compaction was skipped for a benign reason (no model, no candidates, nothing to compact). */
593
- skipped?: boolean;
594
- }
595
-
596
- /** Fired when auto-retry starts */
597
- export interface AutoRetryStartEvent {
598
- type: "auto_retry_start";
599
- attempt: number;
600
- maxAttempts: number;
601
- delayMs: number;
602
- errorMessage: string;
603
- }
604
-
605
- /** Fired when auto-retry ends */
606
- export interface AutoRetryEndEvent {
607
- type: "auto_retry_end";
608
- success: boolean;
609
- attempt: number;
610
- finalError?: string;
611
- }
612
-
613
- /** Fired when TTSR rule matching interrupts generation */
614
- export interface TtsrTriggeredEvent {
615
- type: "ttsr_triggered";
616
- rules: Rule[];
617
- }
618
-
619
- /** Fired when todo reminder logic detects unfinished todos */
620
- export interface TodoReminderEvent {
621
- type: "todo_reminder";
622
- todos: TodoItem[];
623
- attempt: number;
624
- maxAttempts: number;
625
- }
506
+ export type {
507
+ AutoCompactionEndEvent,
508
+ AutoCompactionStartEvent,
509
+ AutoRetryEndEvent,
510
+ AutoRetryStartEvent,
511
+ TodoReminderEvent,
512
+ TtsrTriggeredEvent,
513
+ } from "../shared-events";
626
514
 
627
515
  /** Fired when AuthStorage automatically soft-disables a credential (e.g. OAuth `invalid_grant`). Not fired for user-initiated `remove()` or duplicate-credential dedup. */
628
516
  export interface CredentialDisabledEvent {
@@ -840,6 +728,7 @@ export type ExtensionEvent =
840
728
  | AutoRetryEndEvent
841
729
  | TtsrTriggeredEvent
842
730
  | TodoReminderEvent
731
+ | GoalUpdatedEvent
843
732
  | CredentialDisabledEvent
844
733
  | UserBashEvent
845
734
  | UserPythonEvent
@@ -857,10 +746,7 @@ export interface ContextEventResult {
857
746
 
858
747
  export type BeforeProviderRequestEventResult = unknown;
859
748
 
860
- export interface ToolCallEventResult {
861
- block?: boolean;
862
- reason?: string;
863
- }
749
+ export type { ToolCallEventResult } from "../shared-events";
864
750
 
865
751
  /** Result from input event handler */
866
752
  export interface InputEventResult {
@@ -884,11 +770,7 @@ export interface UserPythonEventResult {
884
770
  result?: PythonResult;
885
771
  }
886
772
 
887
- export interface ToolResultEventResult {
888
- content?: (TextContent | ImageContent)[];
889
- details?: unknown;
890
- isError?: boolean;
891
- }
773
+ export type { ToolResultEventResult } from "../shared-events";
892
774
 
893
775
  export interface BeforeAgentStartEventResult {
894
776
  message?: Pick<CustomMessage, "customType" | "content" | "display" | "details" | "attribution">;
@@ -896,33 +778,13 @@ export interface BeforeAgentStartEventResult {
896
778
  systemPrompt?: string[];
897
779
  }
898
780
 
899
- export interface SessionBeforeSwitchResult {
900
- cancel?: boolean;
901
- }
902
-
903
- export interface SessionBeforeBranchResult {
904
- cancel?: boolean;
905
- skipConversationRestore?: boolean;
906
- }
907
-
908
- export interface SessionBeforeCompactResult {
909
- cancel?: boolean;
910
- compaction?: CompactionResult;
911
- }
912
-
913
- export interface SessionCompactingResult {
914
- context?: string[];
915
- prompt?: string;
916
- preserveData?: Record<string, unknown>;
917
- }
918
-
919
- export interface SessionBeforeTreeResult {
920
- cancel?: boolean;
921
- summary?: {
922
- summary: string;
923
- details?: unknown;
924
- };
925
- }
781
+ export type {
782
+ SessionBeforeBranchResult,
783
+ SessionBeforeCompactResult,
784
+ SessionBeforeSwitchResult,
785
+ SessionBeforeTreeResult,
786
+ SessionCompactingResult,
787
+ } from "../shared-events";
926
788
 
927
789
  // ============================================================================
928
790
  // Message Rendering
@@ -942,6 +804,9 @@ export type MessageRenderer<T = unknown> = (
942
804
  // Command Registration
943
805
  // ============================================================================
944
806
 
807
+ // fallow-ignore-next-line code-duplication
808
+ // Parallel to HookAPI's RegisteredCommand: extensions add
809
+ // `getArgumentCompletions` and bind handlers to ExtensionCommandContext.
945
810
  export interface RegisteredCommand {
946
811
  name: string;
947
812
  description?: string;
@@ -1022,6 +887,7 @@ export interface ExtensionAPI {
1022
887
  on(event: "auto_retry_end", handler: ExtensionHandler<AutoRetryEndEvent>): void;
1023
888
  on(event: "ttsr_triggered", handler: ExtensionHandler<TtsrTriggeredEvent>): void;
1024
889
  on(event: "todo_reminder", handler: ExtensionHandler<TodoReminderEvent>): void;
890
+ on(event: "goal_updated", handler: ExtensionHandler<GoalUpdatedEvent>): void;
1025
891
  on(event: "credential_disabled", handler: ExtensionHandler<CredentialDisabledEvent>): void;
1026
892
  on(event: "input", handler: ExtensionHandler<InputEvent, InputEventResult>): void;
1027
893
  on(event: "tool_call", handler: ExtensionHandler<ToolCallEvent, ToolCallEventResult>): void;