@oh-my-pi/pi-coding-agent 17.2.5 → 17.2.6

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 (55) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{CHANGELOG-q2w43aw3.md → CHANGELOG-gs76k6wc.md} +18 -0
  3. package/dist/cli.js +3378 -3333
  4. package/dist/types/cli/gc-cli.d.ts +1 -0
  5. package/dist/types/launch/client.d.ts +9 -1
  6. package/dist/types/launch/protocol.d.ts +17 -0
  7. package/dist/types/modes/components/btw-panel.d.ts +3 -0
  8. package/dist/types/modes/controllers/btw-controller.d.ts +2 -0
  9. package/dist/types/modes/controllers/command-controller.d.ts +1 -0
  10. package/dist/types/modes/interactive-mode.d.ts +4 -1
  11. package/dist/types/modes/types.d.ts +3 -1
  12. package/dist/types/security/contracts/schemas.d.ts +405 -403
  13. package/dist/types/session/agent-session-types.d.ts +5 -0
  14. package/dist/types/session/agent-session.d.ts +26 -2
  15. package/dist/types/session/launch-completion.d.ts +10 -0
  16. package/dist/types/session/session-entries.d.ts +15 -1
  17. package/dist/types/session/session-manager.d.ts +7 -0
  18. package/dist/types/session/yield-queue.d.ts +6 -1
  19. package/dist/types/tools/index.d.ts +9 -0
  20. package/package.json +12 -12
  21. package/src/cli/gc-cli.ts +641 -21
  22. package/src/config/model-discovery.ts +14 -14
  23. package/src/config/model-registry.ts +10 -8
  24. package/src/config/settings.ts +1 -1
  25. package/src/export/html/index.ts +10 -3
  26. package/src/export/share.ts +4 -0
  27. package/src/launch/broker.ts +222 -6
  28. package/src/launch/client.ts +161 -9
  29. package/src/launch/protocol.ts +52 -0
  30. package/src/main.ts +13 -6
  31. package/src/mcp/config-writer.ts +1 -1
  32. package/src/modes/components/btw-panel.ts +41 -4
  33. package/src/modes/controllers/btw-controller.ts +55 -7
  34. package/src/modes/controllers/command-controller.ts +31 -0
  35. package/src/modes/controllers/input-controller.ts +24 -7
  36. package/src/modes/interactive-mode.ts +16 -2
  37. package/src/modes/types.ts +8 -1
  38. package/src/prompts/session/launch-completion.md +1 -0
  39. package/src/sdk.ts +15 -0
  40. package/src/security/contracts/schemas.ts +205 -183
  41. package/src/security/contracts/validation.ts +5 -1
  42. package/src/security/store.ts +2 -2
  43. package/src/session/agent-session-types.ts +6 -0
  44. package/src/session/agent-session.ts +191 -14
  45. package/src/session/launch-completion.ts +37 -0
  46. package/src/session/session-context.ts +26 -0
  47. package/src/session/session-entries.ts +17 -1
  48. package/src/session/session-manager.ts +21 -0
  49. package/src/session/yield-queue.ts +121 -16
  50. package/src/slash-commands/builtin-registry.ts +10 -0
  51. package/src/tools/browser/cmux/cmux-tab.ts +92 -4
  52. package/src/tools/hub/launch.ts +122 -6
  53. package/src/tools/index.ts +9 -0
  54. package/dist/types/config/file-lock.d.ts +0 -29
  55. package/src/config/file-lock.ts +0 -164
@@ -28,6 +28,7 @@ export interface ArchiveGcResult {
28
28
  wouldArchive: number;
29
29
  archived: number;
30
30
  historyRowsDeleted: number;
31
+ statsRowsDeleted: number;
31
32
  ftsRebuilt: boolean;
32
33
  errors: string[];
33
34
  }
@@ -1,4 +1,4 @@
1
- import { type DaemonOperation, type DaemonRpcResult } from "./protocol.js";
1
+ import { type DaemonCompletionNotification, type DaemonOperation, type DaemonRpcResult } from "./protocol.js";
2
2
  /** Broker location and lifecycle overrides used by smoke tests and isolated consumers. */
3
3
  export interface DaemonBrokerClientOptions {
4
4
  /** Runtime directory override; defaults to the project-scoped config path. */
@@ -6,13 +6,21 @@ export interface DaemonBrokerClientOptions {
6
6
  /** Last-client shutdown grace override in milliseconds. */
7
7
  idleGraceMs?: number;
8
8
  }
9
+ export interface DaemonCompletionUnregisterOptions {
10
+ /** Detach this process without deleting broker-persisted pending notifications. */
11
+ preservePending?: boolean;
12
+ }
9
13
  /** Persistent per-process connection to one project or global daemon broker. */
10
14
  export interface DaemonBrokerClient {
15
+ onCompletion(owner: string, sink: (notification: DaemonCompletionNotification) => Promise<void> | void): (options?: DaemonCompletionUnregisterOptions) => void;
11
16
  /** Canonical project directory or synthetic directory identifying a global scope. */
12
17
  readonly projectDir: string;
13
18
  request(operation: DaemonOperation, signal?: AbortSignal): Promise<DaemonRpcResult>;
14
19
  close(): void;
15
20
  }
21
+ /** A request reached the broker and the broker rejected the operation. */
22
+ export declare class DaemonBrokerRejectedError extends Error {
23
+ }
16
24
  /** Create an independent socket connection to one daemon broker scope. */
17
25
  export declare function createDaemonBrokerClient(projectDir: string, options?: DaemonBrokerClientOptions): Promise<DaemonBrokerClient>;
18
26
  /** Get the process-shared daemon broker client for one canonical project directory. */
@@ -150,6 +150,13 @@ export type DaemonRpcResult = {
150
150
  export interface DaemonWireRequest {
151
151
  id: string;
152
152
  token: string;
153
+ owners?: string[];
154
+ detachedOwners?: string[];
155
+ completionEvents?: boolean;
156
+ completionAcks?: string[];
157
+ completionUnsubscribes?: string[];
158
+ completionReplays?: string[];
159
+ completionSubscriptionId?: string;
153
160
  operation: DaemonOperation;
154
161
  }
155
162
  /** Response envelope kept raw until matched with its pending operation. */
@@ -162,6 +169,14 @@ export type DaemonWireResponse = {
162
169
  ok: false;
163
170
  error: string;
164
171
  };
172
+ /** Unsolicited terminal completion sent to the socket that owns a daemon. */
173
+ export interface DaemonCompletionNotification {
174
+ event: "daemon-completed";
175
+ completionId: string;
176
+ owner: string;
177
+ daemon: DaemonSnapshot;
178
+ }
179
+ export type DaemonWireMessage = DaemonWireResponse | DaemonCompletionNotification;
165
180
  /** Decode and validate a daemon launch specification. */
166
181
  export declare function parseDaemonSpec(value: unknown): DaemonSpec;
167
182
  /** Decode and validate one daemon snapshot. */
@@ -170,5 +185,7 @@ export declare function parseDaemonSnapshot(value: unknown): DaemonSnapshot;
170
185
  export declare function parseDaemonWireRequest(value: unknown): DaemonWireRequest;
171
186
  /** Decode a socket response envelope before resolving a pending call. */
172
187
  export declare function parseDaemonWireResponse(value: unknown): DaemonWireResponse;
188
+ /** Decode one broker response or unsolicited completion notification. */
189
+ export declare function parseDaemonWireMessage(value: unknown): DaemonWireMessage;
173
190
  /** Decode a broker result using its pending operation as the discriminator. */
174
191
  export declare function parseDaemonRpcResult(operation: DaemonOperation, value: unknown): DaemonRpcResult;
@@ -2,6 +2,7 @@ import { Container, type TUI } from "@oh-my-pi/pi-tui";
2
2
  interface BtwPanelComponentOptions {
3
3
  question: string;
4
4
  tui: TUI;
5
+ canBranch?: () => boolean;
5
6
  }
6
7
  export declare class BtwPanelComponent extends Container {
7
8
  #private;
@@ -9,6 +10,8 @@ export declare class BtwPanelComponent extends Container {
9
10
  appendText(delta: string): void;
10
11
  setAnswer(text: string): void;
11
12
  markComplete(): void;
13
+ /** Shows that the completed answer is being promoted into the chat session. */
14
+ markBranching(): void;
12
15
  markAborted(): void;
13
16
  markError(message: string): void;
14
17
  isBranchable(): boolean;
@@ -5,6 +5,8 @@ export declare class BtwController {
5
5
  constructor(ctx: InteractiveModeContext);
6
6
  hasActiveRequest(): boolean;
7
7
  canBranch(): boolean;
8
+ /** Whether plain `b` is currently reserved for a completed or pending branch action. */
9
+ handlesBranchKey(): boolean;
8
10
  canCopy(): boolean;
9
11
  handleCopy(): Promise<boolean>;
10
12
  handleBranch(): Promise<boolean>;
@@ -27,6 +27,7 @@ export declare class CommandController {
27
27
  handleMemoryCommand(text: string): Promise<void>;
28
28
  handleClearCommand(): Promise<void>;
29
29
  handleFreshCommand(): Promise<void>;
30
+ handleResetContextCommand(): Promise<void>;
30
31
  handleDropCommand(): Promise<void>;
31
32
  handleForkCommand(): Promise<void>;
32
33
  /**
@@ -337,6 +337,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
337
337
  handleContextCommand(): void;
338
338
  handleClearCommand(): Promise<void>;
339
339
  handleFreshCommand(): Promise<void>;
340
+ handleResetContextCommand(): Promise<void>;
340
341
  handleDropCommand(): Promise<void>;
341
342
  handleForkCommand(): Promise<void>;
342
343
  handleMoveCommand(targetPath?: string): Promise<void>;
@@ -393,10 +394,12 @@ export declare class InteractiveMode implements InteractiveModeContext {
393
394
  hasActiveBtw(): boolean;
394
395
  handleBtwEscape(): boolean;
395
396
  canBranchBtw(): boolean;
397
+ /** Reserves plain `b` only after /btw has a completed branch action to handle. */
398
+ handlesBtwBranchKey(): boolean;
396
399
  handleBtwBranchKey(): Promise<boolean>;
397
400
  canCopyBtw(): boolean;
398
401
  handleBtwCopyKey(): Promise<boolean>;
399
- handleBtwBranch(question: string, assistantMessage: AssistantMessage): Promise<void>;
402
+ handleBtwBranch(question: string, assistantMessage: AssistantMessage, leafId: string, sessionId: string): Promise<void>;
400
403
  handleOmfgCommand(complaint: string): Promise<void>;
401
404
  hasActiveOmfg(): boolean;
402
405
  handleOmfgEscape(): boolean;
@@ -326,6 +326,7 @@ export interface InteractiveModeContext {
326
326
  handleDebugTranscriptCommand(): Promise<void>;
327
327
  handleClearCommand(): Promise<void>;
328
328
  handleFreshCommand(): Promise<void>;
329
+ handleResetContextCommand(): Promise<void>;
329
330
  handleDropCommand(): Promise<void>;
330
331
  handleForkCommand(): Promise<void>;
331
332
  handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;
@@ -388,9 +389,10 @@ export interface InteractiveModeContext {
388
389
  handleBtwEscape(): boolean;
389
390
  handleBtwBranchKey(): Promise<boolean>;
390
391
  canBranchBtw(): boolean;
392
+ handlesBtwBranchKey(): boolean;
391
393
  canCopyBtw(): boolean;
392
394
  handleBtwCopyKey(): Promise<boolean>;
393
- handleBtwBranch(question: string, assistantMessage: AssistantMessage): Promise<void>;
395
+ handleBtwBranch(question: string, assistantMessage: AssistantMessage, leafId: string, sessionId: string): Promise<void>;
394
396
  handleOmfgCommand(complaint: string): Promise<void>;
395
397
  hasActiveOmfg(): boolean;
396
398
  handleOmfgEscape(): boolean;