cyberlegion 1.0.0 → 1.2.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
@@ -25,9 +25,13 @@ interface AgentRecord {
25
25
  /** Absent for a standing record (a human/owner principal — no claude/cursor/codex harness). */
26
26
  harness?: Harness;
27
27
  cwd: string;
28
+ /** `primaryRoot` is the primary checkout of the repository the worktree belongs to, recorded by
29
+ * spawn — the one place to find git's registration of a worktree whose directory is gone. Absent
30
+ * on a registered session and on records from before it was recorded. */
28
31
  worktree?: {
29
32
  root: string;
30
33
  branch?: string;
34
+ primaryRoot?: string;
31
35
  } | null;
32
36
  /** Where this session lives, tagged with its multiplexer so `prune` runs the right liveness check.
33
37
  * `null` for a session in no pane and for a standing record. `window`/`session` are tmux-only. */
@@ -220,9 +224,10 @@ export declare function resolveAgent(store: Store, ref: string): AgentRecord;
220
224
  export declare function bumpLastSeen(ctx: IdContext, id: string): void;
221
225
  /** Refresh this session's own last-seen if it is registered — best-effort, never throws. */
222
226
  export declare function touch(ctx: IdContext): void;
223
- /** Mark agents whose pane is gone or whose last-seen is stale as exited. Reconcile-culls against the
224
- * current mux's live set first, then falls through to the per-record paneExists + staleness check
225
- * (covers the other mux and sessions outside any multiplexer pane). */
227
+ /** Mark agents whose session is gone as exited. Reconcile-culls against the current mux's live set
228
+ * first, then judges each remaining record (covers the other mux and sessions outside any
229
+ * multiplexer pane): a pane-bound record by its pane alone — a live or unprobeable pane keeps it
230
+ * whatever its last-seen — and a pane-less record by the staleness timer, its only signal. */
226
231
  export declare function prune(ctx: IdContext): AgentRecord[];
227
232
  //#endregion
228
233
  //#region src/agentdef/resolve.d.ts
@@ -265,6 +270,9 @@ interface RealizeLaunchOptions {
265
270
  effort?: string;
266
271
  /** Overrides def.harness when present; falls back to 'claude' when neither is set. */
267
272
  harness?: Harness;
273
+ /** The model ids `cursor-agent models` lists, for carrying a cursor effort as a flat model id.
274
+ * Called only for a cursor launch with both a model and an effort; absent, nothing is listed. */
275
+ listCursorModels?: () => readonly string[];
268
276
  }
269
277
  interface RealizedLaunch {
270
278
  harness: Harness;
@@ -273,8 +281,9 @@ interface RealizedLaunch {
273
281
  * harness default applies. */
274
282
  model?: string;
275
283
  effort?: string;
276
- /** An effort asked for that the launch cannot carry — cursor with no model — so the caller can warn
277
- * and report it rather than let it drop silently. The launch runs at the harness default instead. */
284
+ /** An effort asked for that the launch cannot carry — cursor with no model, or with no listed
285
+ * `<model>-<level>` id — so the caller can warn and report it rather than let it drop silently.
286
+ * The launch runs without the effort instead. */
278
287
  effortNotApplied?: string;
279
288
  /** The def's instructions, for a harness whose CLI cannot take them (cursor): `unit spawn` writes
280
289
  * them in front of the brief instead. Absent when the command carries them, or there are none. */
@@ -282,7 +291,7 @@ interface RealizedLaunch {
282
291
  }
283
292
  /** Build the harness launch invocation for a def — explicit `model`/`effort`/`harness` win over the
284
293
  * def's own tags, which win over the harness default. The def's effort and instructions each go
285
- * through the harness's own control (see `modelAndEffortArgs`, `instructionArgs`). */
294
+ * through the harness's own control (see `cursorModel`, `modelAndEffortArgs`, `instructionArgs`). */
286
295
  export declare function realizeLaunch(def: AgentDef, opts?: RealizeLaunchOptions): RealizedLaunch;
287
296
  //#endregion
288
297
  //#region src/decommission.d.ts
@@ -324,7 +333,7 @@ interface DecommissionResult {
324
333
  export declare function decommission(ctx: IdContext, input: DecommissionInput): DecommissionResult;
325
334
  //#endregion
326
335
  //#region src/runtime/inject-inbox.d.ts
327
- type HookEvent = 'SessionStart' | 'PostToolUse';
336
+ type HookEvent = 'SessionStart';
328
337
  interface InjectPayload {
329
338
  hookSpecificOutput: {
330
339
  hookEventName: HookEvent;
@@ -343,15 +352,19 @@ interface InjectPayload {
343
352
  export declare function injectInbox(ctx: IdContext, event: string): InjectPayload | null;
344
353
  //#endregion
345
354
  //#region src/install.d.ts
346
- type InstallStatus = 'registered' | 'already present';
355
+ type RetiredEvent = 'PostToolUse';
356
+ type InstallStatus = 'registered' | 'already present' | 'provided by plugin' | 'removed project hook';
347
357
  interface InstallResult {
348
358
  harness: Harness;
349
- event: HookEvent;
359
+ event: HookEvent | RetiredEvent;
350
360
  vendorEvent: string;
351
361
  file: string;
352
362
  status: InstallStatus;
353
363
  }
354
- /** Register the surfacing hook into one harness's config, idempotently. */
364
+ /**
365
+ * Make sure the surfacing hook fires for one harness, idempotently: leave it to the plugin where the
366
+ * plugin ships it (removing an earlier project copy), otherwise register the PATH-first project hook.
367
+ */
355
368
  export declare function install(harness: Harness, projectDir?: string, pin?: string): InstallResult[];
356
369
  //#endregion
357
370
  //#region src/message.d.ts
@@ -642,6 +655,47 @@ export declare function startService<T extends {
642
655
  unit: string;
643
656
  }>(ctx: ServiceContext, projectRef: string, name: string, input: StartInput<T>): Promise<StartResult<T>>;
644
657
  //#endregion
658
+ //#region src/console/trust.d.ts
659
+ interface TrustOptions {
660
+ /** Time between screen reads. */
661
+ pollMs?: number;
662
+ /** How long to watch for the harness to show a prompt or settle without one. */
663
+ timeoutMs?: number;
664
+ /** Equal reads in a row that count as settled. */
665
+ stableReads?: number;
666
+ /** Blank reads in a row, from the first, after which the screen is taken as unreadable. */
667
+ blankReads?: number;
668
+ /** Wait after the prompt appears before the first key: Claude Code ignores keys pressed right after
669
+ * its dialog opens. */
670
+ keyDelayMs?: number;
671
+ /** Reads allowed for each move to take effect, and for the prompt to clear at the end. */
672
+ attempts?: number;
673
+ sleep?: (ms: number) => Promise<void>;
674
+ }
675
+ type TrustOutcome =
676
+ /** The harness settled on a screen with no trust prompt. */
677
+ {
678
+ state: 'none';
679
+ } |
680
+ /** The screen never settled within the timeout; there is no evidence of a prompt either way. */
681
+ {
682
+ state: 'unsettled';
683
+ } |
684
+ /** The prompt was on screen and the accept keys cleared it. */
685
+ {
686
+ state: 'accepted';
687
+ } |
688
+ /** The prompt is on screen and spawn left it for a person. */
689
+ {
690
+ state: 'needs-human';
691
+ message: string;
692
+ } |
693
+ /** The accept keys were sent and the prompt is still on screen. */
694
+ {
695
+ state: 'stuck';
696
+ message: string;
697
+ };
698
+ //#endregion
645
699
  //#region src/session.d.ts
646
700
  interface SpawnInput {
647
701
  harness?: string;
@@ -699,13 +753,23 @@ export declare function spawn(ctx: IdContext, input: SpawnInput): SpawnResult;
699
753
  * The ring is best-effort on top of the guaranteed spawn effect (worktree + session + registry
700
754
  * record): `--no-wake` rings nothing, and a ring that never completes is reported as a warning on
701
755
  * the result rather than thrown, so it can never fail a spawn that already landed.
756
+ *
757
+ * Before the ring, the harness's folder-trust prompt is answered (`answerTrustPrompt`), with or
758
+ * without `--no-wake`: a unit stuck at that prompt never reads its brief, and the doorbell typed into
759
+ * it would answer it wrongly (Claude Code's focused option is "No, exit"). A worktree spawn made the
760
+ * folder from the caller's own repository, so its prompt is accepted. A `--cwd` folder was not made
761
+ * here, so its prompt is left for a person. A prompt left showing either way rings nothing and is
762
+ * reported as `trustBlocked`, a failure the caller must surface, not a best-effort warning.
702
763
  */
703
764
  export declare function spawnAndWake(ctx: IdContext, input: SpawnInput, options?: {
704
765
  noWake?: boolean;
705
766
  nudgeOpts?: NudgeOptions;
767
+ trustOpts?: TrustOptions;
706
768
  }): Promise<SpawnResult & {
707
769
  rung: boolean;
708
770
  warning?: string;
771
+ trust: TrustOutcome['state'];
772
+ trustBlocked?: string;
709
773
  }>;
710
774
  //#endregion
711
775
  //#region src/store/file-store.d.ts