cyberlegion 1.10.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
- import { Exec, Exec as Exec$1, MuxAdapter, MuxPlacement, MuxProbe, NudgeOptions, probeMultiplexer } from "cyber-mux";
1
+ import { Exec, Exec as Exec$2, MuxAdapter, MuxPlacement, MuxProbe, NudgeOptions, probeMultiplexer } from "cyber-mux";
2
2
  import { assertDistinctFromPrimary, gitWorktreeAdapter, resolvePrimaryRoot } from "cyber-mux/worktree";
3
3
  import { ReleaseResult } from "cyber-agentkit/worktrees";
4
- //#region src/store/store.d.ts
5
4
  interface Message {
6
5
  id: string;
7
6
  from: string;
@@ -51,10 +50,14 @@ interface AgentRecord {
51
50
  owner?: string;
52
51
  };
53
52
  /** Where this session lives, tagged with its multiplexer so `prune` runs the right liveness check.
54
- * `null` for a session in no pane and for a standing record. `window`/`session` are tmux-only. */
53
+ * `null` for a session in no pane and for a standing record. `window`/`session` are tmux-only.
54
+ * `terminal` is herdr-only: the pane's herdr terminal id, which survives a `herdr pane move` that
55
+ * gives the pane a new id (#272), so prune and touch follow a moved pane by it. Absent on records
56
+ * written before it existed, which are judged by `id` alone. */
55
57
  pane?: {
56
58
  mux: 'tmux' | 'herdr';
57
59
  id: string;
60
+ terminal?: string;
58
61
  window?: string;
59
62
  session?: string;
60
63
  } | null;
@@ -228,13 +231,11 @@ interface Store extends MailboxStore {
228
231
  /** `withLock` held across an async `fn` until its promise settles (`store/lock.ts`). */
229
232
  withLockAsync<T>(name: string, fn: () => Promise<T>): Promise<T>;
230
233
  }
231
- //#endregion
232
- //#region src/identity.d.ts
233
- export declare const realExec: Exec$1;
234
+ export declare const realExec: Exec$2;
234
235
  interface IdContext {
235
236
  store: Store;
236
237
  env?: NodeJS.ProcessEnv;
237
- exec?: Exec$1;
238
+ exec?: Exec$2;
238
239
  now?: () => number;
239
240
  /** The argv that re-invokes this very CLI — node, its loader flags, and the entry script
240
241
  * (`selfInvocation`). `unit spawn` puts a `cyberlegion` shim over it on the new session's PATH,
@@ -269,15 +270,25 @@ export declare function resolveRecipient(store: Store, to: string): string;
269
270
  */
270
271
  export declare function resolveAgent(store: Store, ref: string): AgentRecord;
271
272
  export declare function bumpLastSeen(ctx: IdContext, id: string): void;
272
- /** Refresh this session's own last-seen if it is registered — best-effort, never throws. */
273
+ /**
274
+ * Refresh this session's own last-seen if it is registered — best-effort, never throws. In a herdr
275
+ * pane whose calling pane herdr reported, it also heals the record's pane to the id and terminal
276
+ * herdr gave, so a unit whose pane moved fixes its own record on its next turn (#272).
277
+ */
273
278
  export declare function touch(ctx: IdContext): void;
274
- /** Mark agents whose session is gone as exited. Reconcile-culls against the current mux's live set
275
- * first, then judges each remaining record (covers the other mux and sessions outside any
276
- * multiplexer pane): a pane-bound record by its pane alone — a live or unprobeable pane keeps it
277
- * whatever its last-seen — and a pane-less record by the staleness timer, its only signal. */
278
- export declare function prune(ctx: IdContext): AgentRecord[];
279
- //#endregion
280
- //#region src/agentdef/resolve.d.ts
279
+ /** A record `prune` changed: `exited` when it was marked and kept, `deleted` when it was removed. */
280
+ type PrunedRecord = AgentRecord & {
281
+ pruned: 'exited' | 'deleted';
282
+ };
283
+ /**
284
+ * Mark agents whose session is gone as exited, then delete every exited unit with nothing left to
285
+ * work from. Reconcile-culls against the current mux's live set first, then judges each remaining
286
+ * record (covers the other mux and sessions outside any multiplexer pane): a pane-bound record by its
287
+ * pane alone — a live or unprobeable pane keeps it whatever its last-seen — and a pane-less record by
288
+ * the staleness timer, its only signal. An exited unit whose worktree is still on disk is kept, since
289
+ * `unit close` owns removing that worktree; every other exited unit is deleted with `deleteExited`.
290
+ */
291
+ export declare function prune(ctx: IdContext): PrunedRecord[];
281
292
  interface AgentDef {
282
293
  name: string;
283
294
  description?: string;
@@ -308,8 +319,6 @@ export declare function listAgentDefs(input?: {
308
319
  cwd?: string;
309
320
  searchRoots?: string[];
310
321
  }): AgentDef[];
311
- //#endregion
312
- //#region src/agentdef/realize.d.ts
313
322
  interface RealizeLaunchOptions {
314
323
  /** Overrides def.model when present. */
315
324
  model?: string;
@@ -340,8 +349,6 @@ interface RealizedLaunch {
340
349
  * def's own tags, which win over the harness default. The def's effort and instructions each go
341
350
  * through the harness's own control (see `cursorModel`, `modelAndEffortArgs`, `instructionArgs`). */
342
351
  export declare function realizeLaunch(def: AgentDef, opts?: RealizeLaunchOptions): RealizedLaunch;
343
- //#endregion
344
- //#region src/decommission.d.ts
345
352
  interface DecommissionInput {
346
353
  id: string;
347
354
  /** Discard uncommitted changes in the worktree. Refused for a unit on the primary checkout, which close never alters. */
@@ -393,8 +400,6 @@ interface DecommissionResult {
393
400
  * is not reported as retained: it is no pool path a next unit could be spawned into.
394
401
  */
395
402
  export declare function decommission(ctx: IdContext, input: DecommissionInput): Promise<DecommissionResult>;
396
- //#endregion
397
- //#region src/runtime/inject-inbox.d.ts
398
403
  type HookEvent = 'SessionStart';
399
404
  interface InjectPayload {
400
405
  hookSpecificOutput: {
@@ -412,8 +417,6 @@ interface InjectPayload {
412
417
  * firing in the child (`unit/lifecycle`, superseding ADR-0027).
413
418
  */
414
419
  export declare function injectInbox(ctx: IdContext, event: string): InjectPayload | null;
415
- //#endregion
416
- //#region src/install.d.ts
417
420
  type RetiredEvent = 'PostToolUse';
418
421
  type InstallStatus = 'registered' | 'already present' | 'provided by plugin' | 'removed project hook';
419
422
  interface InstallResult {
@@ -428,8 +431,6 @@ interface InstallResult {
428
431
  * plugin ships it (removing an earlier project copy), otherwise register the PATH-first project hook.
429
432
  */
430
433
  export declare function install(harness: Harness, projectDir?: string, pin?: string): InstallResult[];
431
- //#endregion
432
- //#region src/message.d.ts
433
434
  interface MsgContext {
434
435
  store: Store;
435
436
  now?: () => number;
@@ -464,8 +465,6 @@ export declare function peek(ctx: MsgContext, meId: string, msgId: string): Mess
464
465
  export declare function ack(ctx: MsgContext, meId: string, msgId: string): Message;
465
466
  /** Permanently remove a message (unread or already-acked) from the caller's inbox. */
466
467
  export declare function deleteMessage(ctx: MsgContext, meId: string, msgId: string): void;
467
- //#endregion
468
- //#region src/mux-select.d.ts
469
468
  /**
470
469
  * Backend selection via cyber-mux's two-mode mux probe, normalized through the transitional
471
470
  * `$CYBERLEGION_MUX*` → `$CYBER_MUX*` env seam (`mux-env.ts`) — tmux/herdr map to their existing
@@ -479,8 +478,6 @@ export declare function deleteMessage(ctx: MsgContext, meId: string, msgId: stri
479
478
  * `screen`) falls through to the plain "no backend" refusal, unchanged from before the migration.
480
479
  */
481
480
  export declare function selectSessionAdapter(env: NodeJS.ProcessEnv, exec?: Exec): MuxAdapter;
482
- //#endregion
483
- //#region src/output.d.ts
484
481
  type Format = 'toon' | 'json';
485
482
  /** One TOON-encoded object: `key: value` lines, blank/undefined fields dropped. */
486
483
  export declare function toonObject(fields: Record<string, unknown>): string;
@@ -502,18 +499,16 @@ export declare function emit(format: Format, payload: EmitPayload): void;
502
499
  export declare function nextStep(msg: string): void;
503
500
  /** A structured, fail-loud error: stderr + exit 1. Never prompts, never partially writes. */
504
501
  export declare function fail(msg: string): never;
505
- //#endregion
506
- //#region src/paths.d.ts
507
502
  /** Walk up from `cwd` to the nearest git repo root; fall back to `cwd`. */
508
503
  export declare function projectRoot(cwd?: string): string;
509
504
  /** Runs a command synchronously in `cwd`; returns trimmed stdout, or null on any failure. */
510
- type Exec$2 = (cmd: string, args: string[]) => string | null;
505
+ type Exec$1 = (cmd: string, args: string[]) => string | null;
511
506
  interface RootOptions {
512
507
  root?: string;
513
508
  space?: string;
514
509
  cwd?: string;
515
510
  env?: NodeJS.ProcessEnv;
516
- exec?: Exec$2;
511
+ exec?: Exec$1;
517
512
  }
518
513
  /**
519
514
  * Resolve the cyberlegion hub root. Precedence: explicit --root/--space, then `$CYBERLEGION_ROOT`,
@@ -555,8 +550,6 @@ export declare const paths: {
555
550
  messageFile: (root: string, toId: string, msgId: string) => string;
556
551
  messageReadFile: (root: string, toId: string, msgId: string) => string;
557
552
  };
558
- //#endregion
559
- //#region src/project.d.ts
560
553
  interface ProjectContext {
561
554
  store: Store;
562
555
  exec?: Exec;
@@ -578,8 +571,6 @@ export declare function listProjects(store: Store): ProjectRecord[];
578
571
  * and an ambiguous name names its candidates rather than picking one.
579
572
  */
580
573
  export declare function resolveProject(ctx: ProjectContext, ref: string): ProjectRecord;
581
- //#endregion
582
- //#region src/service.d.ts
583
574
  interface ServiceContext extends IdContext {
584
575
  /** Whether a unit's session is still there. Defaults to asking its multiplexer (`sessionLive`). */
585
576
  isLive?: (unit: AgentRecord) => boolean;
@@ -717,8 +708,6 @@ type StartResult<T> = {
717
708
  export declare function startService<T extends {
718
709
  unit: string;
719
710
  }>(ctx: ServiceContext, projectRef: string, name: string, input: StartInput<T>): Promise<StartResult<T>>;
720
- //#endregion
721
- //#region src/console/trust.d.ts
722
711
  interface TrustOptions {
723
712
  /** Time between screen reads. */
724
713
  pollMs?: number;
@@ -758,8 +747,6 @@ type TrustOutcome =
758
747
  state: 'stuck';
759
748
  message: string;
760
749
  };
761
- //#endregion
762
- //#region src/session.d.ts
763
750
  interface SpawnInput {
764
751
  harness?: string;
765
752
  task?: string;
@@ -866,8 +853,6 @@ interface FirstTurn {
866
853
  trust: TrustOutcome['state'];
867
854
  trustBlocked?: string;
868
855
  }
869
- //#endregion
870
- //#region src/store/file-store.d.ts
871
856
  /** The on-disk `Store` implementation — current per-writer sharded `.json` layout (ADR-0020):
872
857
  * one file per message/agent, collision-free filenames, ack = atomic rename into `read/`. */
873
858
  export declare class FileStore implements Store {
@@ -901,8 +886,6 @@ export declare class FileStore implements Store {
901
886
  withLock<T>(name: string, fn: () => T): T;
902
887
  withLockAsync<T>(name: string, fn: () => Promise<T>): Promise<T>;
903
888
  }
904
- //#endregion
905
- //#region src/wake/await.d.ts
906
889
  interface AwaitInput {
907
890
  meId: string;
908
891
  thread: string;
@@ -935,8 +918,6 @@ type AwaitOutcome = {
935
918
  * elapsed across re-arms with no match. The caller should exit non-zero.
936
919
  */
937
920
  export declare function awaitReply(ctx: MsgContext, input: AwaitInput): Promise<AwaitOutcome>;
938
- //#endregion
939
- //#region src/wake/watch.d.ts
940
921
  interface WatchInput {
941
922
  meId: string;
942
923
  thread?: string;
@@ -953,5 +934,4 @@ interface WatchOptions {
953
934
  * `watch` prints stays unread and still surfaces later in `mail inbox`/`mail await`.
954
935
  */
955
936
  export declare function watchMail(ctx: MsgContext, input: WatchInput, onMessage: (msg: InboxItem) => void, opts?: WatchOptions): Promise<void>;
956
- //#endregion
957
937
  export { type AcquireInput, type AcquireResult, type AgentDef, type AgentRecord, type AwaitInput, type AwaitOutcome, type DecommissionInput, type DecommissionResult, type Exec, type Format, type Harness, type HookEvent, type IdContext, type InboxItem, type InboxQuery, type InboxSnapshot, type Message, type MuxProbe, type OwnershipErrorCode, type ProjectContext, type ProjectRecord, type RegisterInput, type RootOptions, type SendInput, type ServiceContext, type ServiceHealth, type ServiceLease, type ServiceView, type SpawnInput, type SpawnResult, type StartInput, type StartResult, type Store, assertDistinctFromPrimary, gitWorktreeAdapter, probeMultiplexer, resolvePrimaryRoot };