@phren/cli 0.3.72 → 0.3.74

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 (81) hide show
  1. package/dist/bridge/agent-hooks.js +11 -1
  2. package/dist/bridge/browser-env.d.ts +1 -1
  3. package/dist/bridge/browser-env.js +34 -10
  4. package/dist/bridge/browser-watch.d.ts +12 -0
  5. package/dist/bridge/browser-watch.js +83 -0
  6. package/dist/bridge/claude-account-setup.js +3 -1
  7. package/dist/bridge/claude-accounts.d.ts +5 -1
  8. package/dist/bridge/claude-accounts.js +36 -6
  9. package/dist/bridge/claude-question-dialog.d.ts +2 -3
  10. package/dist/bridge/claude-question-dialog.js +129 -46
  11. package/dist/bridge/codex-servers.d.ts +2 -0
  12. package/dist/bridge/codex-servers.js +1 -1
  13. package/dist/bridge/command.js +24 -5
  14. package/dist/bridge/conductor-sets.d.ts +2 -1
  15. package/dist/bridge/conductor-sets.js +3 -2
  16. package/dist/bridge/dialog-observation.d.ts +4 -0
  17. package/dist/bridge/dialog-observation.js +24 -0
  18. package/dist/bridge/dispatch-clone.d.ts +33 -0
  19. package/dist/bridge/dispatch-clone.js +176 -0
  20. package/dist/bridge/dispatch-command.d.ts +14 -0
  21. package/dist/bridge/dispatch-command.js +98 -13
  22. package/dist/bridge/dispatch-idempotency.d.ts +85 -0
  23. package/dist/bridge/dispatch-idempotency.js +235 -0
  24. package/dist/bridge/dispatch-returns.d.ts +6 -0
  25. package/dist/bridge/dispatch-returns.js +131 -1
  26. package/dist/bridge/dispatch-wait.d.ts +32 -0
  27. package/dist/bridge/dispatch-wait.js +177 -0
  28. package/dist/bridge/dispatch.d.ts +68 -2
  29. package/dist/bridge/dispatch.js +839 -25
  30. package/dist/bridge/fanouts.js +20 -3
  31. package/dist/bridge/files.d.ts +1 -1
  32. package/dist/bridge/git-credential.d.ts +44 -0
  33. package/dist/bridge/git-credential.js +113 -0
  34. package/dist/bridge/git-host-auth.d.ts +9 -1
  35. package/dist/bridge/git-host-auth.js +18 -5
  36. package/dist/bridge/git-host-gitboy.js +8 -1
  37. package/dist/bridge/git-hosts.d.ts +12 -1
  38. package/dist/bridge/git-publish.js +3 -2
  39. package/dist/bridge/herdr.d.ts +4 -0
  40. package/dist/bridge/herdr.js +29 -3
  41. package/dist/bridge/install.d.ts +1 -1
  42. package/dist/bridge/install.js +8 -4
  43. package/dist/bridge/launch-worktree.d.ts +2 -0
  44. package/dist/bridge/launch-worktree.js +5 -1
  45. package/dist/bridge/pane-status.js +2 -19
  46. package/dist/bridge/protocol.d.ts +7 -0
  47. package/dist/bridge/schedule-watch.js +13 -2
  48. package/dist/bridge/server-launch.d.ts +2 -0
  49. package/dist/bridge/server-launch.js +251 -145
  50. package/dist/bridge/server-pane-routes.d.ts +1 -1
  51. package/dist/bridge/server-pane-routes.js +12 -9
  52. package/dist/bridge/server-routes.js +26 -8
  53. package/dist/bridge/server.js +12 -1
  54. package/dist/bridge/status-line-fast.d.ts +9 -0
  55. package/dist/bridge/status-line-fast.js +56 -0
  56. package/dist/bridge/terminal-herdr.d.ts +5 -1
  57. package/dist/bridge/terminal-herdr.js +65 -1
  58. package/dist/bridge/terminal-tmux.d.ts +6 -0
  59. package/dist/bridge/terminal-tmux.js +38 -11
  60. package/dist/bridge/terminal.d.ts +5 -1
  61. package/dist/bridge/transcript-claude.d.ts +7 -0
  62. package/dist/bridge/transcript-claude.js +227 -112
  63. package/dist/bridge/transcript-preview.d.ts +2 -1
  64. package/dist/bridge/transcript-preview.js +85 -3
  65. package/dist/bridge/transcripts.js +17 -11
  66. package/dist/bridge/turn-records.js +16 -4
  67. package/dist/bridge/usage.d.ts +7 -1
  68. package/dist/bridge/usage.js +47 -31
  69. package/dist/bridge/worker-close.d.ts +15 -0
  70. package/dist/bridge/worker-close.js +304 -3
  71. package/dist/bridge/worker-identity.d.ts +51 -0
  72. package/dist/bridge/worker-identity.js +289 -0
  73. package/dist/bridge-hook.mjs +22097 -19129
  74. package/dist/cli/browser-hint.d.ts +2 -0
  75. package/dist/cli/browser-hint.js +21 -0
  76. package/dist/cli/hooks-context.d.ts +2 -2
  77. package/dist/cli/hooks-context.js +3 -3
  78. package/dist/cli/hooks.js +20 -11
  79. package/dist/cli-registry.js +5 -3
  80. package/dist/modules/registry.js +1 -1
  81. package/package.json +3 -3
@@ -1,12 +1,15 @@
1
1
  import { z } from "zod";
2
2
  import { type ConductorRecord } from "./conductor-role.js";
3
3
  import { type DispatchHost } from "./dispatch-hosts.js";
4
- import { type Json, type Provider, type Target } from "./protocol.js";
4
+ import { type Json, type Provider, type StartingTarget, type Target } from "./protocol.js";
5
5
  import { type HarnessInventory } from "./harnesses.js";
6
6
  import { type AccountRoom, type WindowRoom } from "./account-choice.js";
7
7
  import { type PolicyRoom, type PoolRule } from "./account-policy.js";
8
8
  import { type BriefArrival } from "./launch-brief.js";
9
+ import { type IdempotencyRecord } from "./dispatch-idempotency.js";
9
10
  export declare const projectName: z.ZodString;
11
+ /** The longest worker brief a dispatch takes, in characters. */
12
+ export declare const DISPATCH_PROMPT_LIMIT = 32768;
10
13
  /** The harnesses a dispatch, a code note's hand-off or a schedule can start. */
11
14
  export declare const PEER_COPILOT_REASON = "Copilot cannot continue on another computer: its harness does not confirm launch-brief arrival. Continue locally or choose another harness.";
12
15
  export declare const DISPATCH_HARNESSES: readonly ["codex", "claude", "opencode", "copilot"];
@@ -49,6 +52,9 @@ export declare const dispatchSchema: z.ZodObject<{
49
52
  }>>>;
50
53
  prompt: z.ZodString;
51
54
  label: z.ZodString;
55
+ idempotencyKey: z.ZodOptional<z.ZodString>;
56
+ worktree: z.ZodOptional<z.ZodBoolean>;
57
+ branch: z.ZodOptional<z.ZodString>;
52
58
  closeOnFinish: z.ZodOptional<z.ZodBoolean>;
53
59
  integrator: z.ZodOptional<z.ZodObject<{
54
60
  computer: z.ZodOptional<z.ZodString>;
@@ -162,6 +168,9 @@ declare const receiptSchema: z.ZodObject<{
162
168
  publish: "publish";
163
169
  }>>>;
164
170
  label: z.ZodString;
171
+ idempotencyKey: z.ZodOptional<z.ZodString>;
172
+ worktree: z.ZodOptional<z.ZodBoolean>;
173
+ branch: z.ZodOptional<z.ZodString>;
165
174
  closeOnFinish: z.ZodOptional<z.ZodBoolean>;
166
175
  integrator: z.ZodOptional<z.ZodObject<{
167
176
  computer: z.ZodOptional<z.ZodString>;
@@ -316,10 +325,26 @@ declare const receiptSchema: z.ZodObject<{
316
325
  terminal: z.ZodString;
317
326
  }, z.core.$strict>>;
318
327
  closedAt: z.ZodOptional<z.ZodString>;
328
+ cancelRequestedAt: z.ZodOptional<z.ZodString>;
319
329
  closePending: z.ZodOptional<z.ZodObject<{
320
330
  at: z.ZodString;
321
331
  turn: z.ZodOptional<z.ZodString>;
322
332
  }, z.core.$strict>>;
333
+ agentTokenFile: z.ZodOptional<z.ZodString>;
334
+ cloneDir: z.ZodOptional<z.ZodString>;
335
+ gitConfigFile: z.ZodOptional<z.ZodString>;
336
+ workerFile: z.ZodOptional<z.ZodString>;
337
+ retainedUntil: z.ZodOptional<z.ZodString>;
338
+ endedAt: z.ZodOptional<z.ZodString>;
339
+ launchOutcome: z.ZodOptional<z.ZodEnum<{
340
+ ambiguous: "ambiguous";
341
+ "not-started": "not-started";
342
+ started: "started";
343
+ }>>;
344
+ startingToken: z.ZodOptional<z.ZodString>;
345
+ launchServer: z.ZodOptional<z.ZodString>;
346
+ scanSince: z.ZodOptional<z.ZodString>;
347
+ submittedAt: z.ZodOptional<z.ZodString>;
323
348
  worker: z.ZodOptional<z.ZodObject<{
324
349
  state: z.ZodEnum<{
325
350
  blocked: "blocked";
@@ -437,13 +462,45 @@ export declare function dispatchProjectDirectory(project: unknown, home?: string
437
462
  * when `change` returns true. Updates run one at a time in this process, and a
438
463
  * receipt still being placed (launching or sending) is never touched.
439
464
  */
440
- export declare function updateReceipt(receiptID: string, change: (receipt: Receipt) => boolean): Promise<Receipt | undefined>;
465
+ export declare function updateReceipt(receiptID: string, change: (receipt: Receipt) => boolean, options?: {
466
+ duringPlacement?: boolean;
467
+ }): Promise<Receipt | undefined>;
441
468
  /** Hand over all open worker routes using the receipt writer's own lock and
442
469
  * update path. Commit the role last; any failure restores the old origins.
443
470
  * Placing receipts are refused because placement can still overwrite them. */
444
471
  export declare function repointDispatchOrigins(from: Pick<ConductorRecord, "server" | "pane" | "terminal">, to: NonNullable<Receipt["origin"]>, commit: () => Promise<void>): Promise<void>;
445
472
  /** One bounded line for a log or a receipt: a Bridge message, an errno code, or the error's first line. */
446
473
  export declare function failureReason(error: unknown): string;
474
+ /** A fresh terminal snapshot proves the bound worker gone; a failed snapshot does not. */
475
+ export declare function boundWorkerGone(receipt: Receipt): Promise<boolean>;
476
+ /** A worker that may still run has no termination time; drop any stale retention clock. */
477
+ export declare function clearWorkerEnded(id: string): Promise<void>;
478
+ export type StartingScan = {
479
+ ok: true;
480
+ pane?: Json;
481
+ } | {
482
+ ok: false;
483
+ };
484
+ /**
485
+ * A successful terminal snapshot on the launch's server, and the pane carrying
486
+ * this launch's starting token. `ok: false` means the snapshot or an identity
487
+ * read failed, so no conclusion can be drawn.
488
+ */
489
+ export declare function scanStartingToken(receipt: Receipt): Promise<StartingScan>;
490
+ /** The exact binding for a pane that carries the launch's starting token. */
491
+ export declare function startingTargetFromPane(receipt: Receipt, pane: Json): Target | StartingTarget | undefined;
492
+ /** A key cancelled before its receipt existed: settle it as failed/cancelled without launching. */
493
+ export declare function settleCancelledReservation(record: IdempotencyRecord): Promise<Receipt>;
494
+ /**
495
+ * A reservation stuck in `reserved` or `launching` for five minutes with no
496
+ * target and no live worker is an interrupted launch. It becomes a failed
497
+ * receipt with "launch interrupted"; nothing is relaunched automatically.
498
+ */
499
+ export declare function reconcileIdempotencyRecord(record: IdempotencyRecord): Promise<void>;
500
+ /** Reconcile every live reservation; called on Hook start. */
501
+ export declare function reconcileInterruptedDispatches(): Promise<void>;
502
+ /** The durable record for a key after reconciliation, for cancel-by-key and dispatch retries. */
503
+ export declare function reconcileIdempotencyKey(key: string): Promise<IdempotencyRecord | undefined>;
447
504
  export declare function dispatchStatus(): Promise<Receipt[]>;
448
505
  /** `caller` (a conductor's name and host key) asks a peer whether it links this computer back:
449
506
  * `outside` is a peer in another set, which a conductor does not dispatch to. */
@@ -515,6 +572,15 @@ export declare class DispatchService {
515
572
  * Herdr variables name it; a pane without a running agent is left out.
516
573
  * `continues` names the dispatch whose worker hit its usage limit (account-failover.ts). */
517
574
  dispatch(input: unknown, originValue?: unknown, continues?: string): Promise<Json>;
575
+ /**
576
+ * The gitboy path: a caller that may retry after a crash names a key and
577
+ * gets the dispatch that key already started. The dispatch id is generated
578
+ * before the reservation, and the reservation is published atomically, so
579
+ * two concurrent calls start one agent; the loser returns the winner's
580
+ * receipt.
581
+ */
582
+ private dispatchKeyed;
583
+ private place;
518
584
  /** Owner continuation: use the same pinned transport and launch/arrival
519
585
  * protocol as dispatch, without turning the new chat into a worker. */
520
586
  continueChat(peer: DispatchHost, project: string, to: z.infer<typeof moveToSchema>, brief: {