@agentskit/harness 0.9.0 → 0.11.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.ts CHANGED
@@ -734,6 +734,9 @@ declare const validateCapabilityManifest: (value: unknown) => CapabilityManifest
734
734
  interface DocBridgeContextProviderOptions {
735
735
  readonly root: string;
736
736
  readonly indexPath?: string;
737
+ /** Reject indexes older than this many hours; 0 or undefined disables the age guard. */
738
+ readonly maxAgeHours?: number;
739
+ readonly now?: () => number;
737
740
  }
738
741
  interface DocBridgeIndexInspection {
739
742
  readonly present: boolean;
@@ -745,7 +748,7 @@ interface DocBridgeIndexInspection {
745
748
  }
746
749
  /** Read-only inspection for doctor freshness checks (no network, no rebuild). */
747
750
  declare const inspectDocBridgeIndex: (root: string, indexPath?: string, now?: number) => DocBridgeIndexInspection;
748
- declare const createDocBridgeContextProvider: ({ root, indexPath }: DocBridgeContextProviderOptions) => ContextProvider;
751
+ declare const createDocBridgeContextProvider: ({ root, indexPath, maxAgeHours, now }: DocBridgeContextProviderOptions) => ContextProvider;
749
752
 
750
753
  interface CommandResult {
751
754
  readonly code: number | null;
@@ -2232,6 +2235,27 @@ interface ModelPolicy {
2232
2235
  declare const createModelPolicy: (bindings: readonly ModelBinding[]) => ModelPolicy;
2233
2236
  declare const modelFor: (policy: ModelPolicy, role: ModelRole) => ModelBinding;
2234
2237
 
2238
+ /**
2239
+ * Deterministic pattern scanner for text that is about to be embedded in a prompt or echoed back into a public
2240
+ * PR/issue comment — a segment lifted from an issue description or a code-review finding can carry a secret that
2241
+ * was never meant to leave the private context it came from. Pure and kernel-safe: no adapters, no network, no
2242
+ * state. Pattern-based, not a claim of completeness — it catches the shapes that show up in practice (emails,
2243
+ * common provider API-key prefixes, phone numbers, card-number-shaped digit runs), not every possible secret.
2244
+ */
2245
+ type PiiKind = 'email' | 'api-key' | 'phone' | 'credit-card';
2246
+ interface PiiMatch {
2247
+ readonly kind: PiiKind;
2248
+ readonly index: number;
2249
+ readonly length: number;
2250
+ }
2251
+ interface PiiScanResult {
2252
+ readonly matches: readonly PiiMatch[];
2253
+ /** `text` with every match replaced by `[REDACTED:<kind>]`. Equal to `text` when `matches` is empty. */
2254
+ readonly redacted: string;
2255
+ }
2256
+ /** Scan `text` for every configured pattern kind and return both the matches (positions into the *original* text) and a redacted copy. */
2257
+ declare const scanForPii: (text: string) => PiiScanResult;
2258
+
2235
2259
  interface OrcaDispatchInput {
2236
2260
  readonly repository: string;
2237
2261
  readonly worktree: string;
@@ -2640,6 +2664,11 @@ declare const LoopConfigSchema: z.ZodObject<{
2640
2664
  teamKey: z.ZodString;
2641
2665
  person: z.ZodString;
2642
2666
  people: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2667
+ rotation: z.ZodPrefault<z.ZodObject<{
2668
+ enabled: z.ZodDefault<z.ZodBoolean>;
2669
+ owners: z.ZodDefault<z.ZodArray<z.ZodString>>;
2670
+ advanceWhenEmpty: z.ZodDefault<z.ZodBoolean>;
2671
+ }, z.core.$strip>>;
2643
2672
  states: z.ZodDefault<z.ZodArray<z.ZodString>>;
2644
2673
  excludeLabels: z.ZodDefault<z.ZodArray<z.ZodString>>;
2645
2674
  requireLabels: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -2725,6 +2754,7 @@ declare const LoopConfigSchema: z.ZodObject<{
2725
2754
  "artificial-analysis": "artificial-analysis";
2726
2755
  builtin: "builtin";
2727
2756
  }>>>;
2757
+ cliCacheHours: z.ZodDefault<z.ZodNumber>;
2728
2758
  artificialAnalysis: z.ZodPrefault<z.ZodObject<{
2729
2759
  enabled: z.ZodDefault<z.ZodBoolean>;
2730
2760
  apiKeyEnv: z.ZodDefault<z.ZodString>;
@@ -2831,6 +2861,7 @@ declare const LoopConfigSchema: z.ZodObject<{
2831
2861
  rebase: "rebase";
2832
2862
  }>>;
2833
2863
  requireChecks: z.ZodDefault<z.ZodBoolean>;
2864
+ requireHumanApproval: z.ZodDefault<z.ZodBoolean>;
2834
2865
  }, z.core.$strip>>;
2835
2866
  smoke: z.ZodPrefault<z.ZodObject<{
2836
2867
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -2854,12 +2885,14 @@ declare const LoopConfigSchema: z.ZodObject<{
2854
2885
  }, z.core.$strip>>;
2855
2886
  maxFixRounds: z.ZodDefault<z.ZodNumber>;
2856
2887
  workerIdleTimeoutMin: z.ZodDefault<z.ZodNumber>;
2888
+ maxDispatchMinutes: z.ZodOptional<z.ZodNumber>;
2857
2889
  handoff: z.ZodPrefault<z.ZodObject<{
2858
2890
  enabled: z.ZodDefault<z.ZodBoolean>;
2859
2891
  maxHandoffs: z.ZodDefault<z.ZodNumber>;
2860
2892
  onlyWhenProviderUnavailable: z.ZodDefault<z.ZodBoolean>;
2861
2893
  }, z.core.$strip>>;
2862
2894
  selfEditPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
2895
+ secretFilePatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
2863
2896
  ignoreChecks: z.ZodDefault<z.ZodArray<z.ZodString>>;
2864
2897
  requiredChecks: z.ZodDefault<z.ZodArray<z.ZodString>>;
2865
2898
  cleanupWorktree: z.ZodDefault<z.ZodBoolean>;
@@ -2921,6 +2954,9 @@ declare const LoopConfigSchema: z.ZodObject<{
2921
2954
  enabled: z.ZodDefault<z.ZodBoolean>;
2922
2955
  allowTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
2923
2956
  }, z.core.$strip>>;
2957
+ plugins: z.ZodPrefault<z.ZodObject<{
2958
+ modules: z.ZodDefault<z.ZodArray<z.ZodString>>;
2959
+ }, z.core.$strip>>;
2924
2960
  github: z.ZodPrefault<z.ZodObject<{
2925
2961
  intakeLabel: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2926
2962
  reviewOnly: z.ZodDefault<z.ZodLiteral<true>>;
@@ -2929,11 +2965,22 @@ declare const LoopConfigSchema: z.ZodObject<{
2929
2965
  maxConsecutiveFailures: z.ZodDefault<z.ZodNumber>;
2930
2966
  pausedLabel: z.ZodDefault<z.ZodString>;
2931
2967
  stagePauseAfterRuns: z.ZodDefault<z.ZodNumber>;
2968
+ maxUsageDeltaPercent: z.ZodOptional<z.ZodNumber>;
2932
2969
  }, z.core.$strip>>;
2933
2970
  brief: z.ZodPrefault<z.ZodObject<{
2934
2971
  skills: z.ZodDefault<z.ZodArray<z.ZodString>>;
2935
2972
  maxSkillChars: z.ZodDefault<z.ZodNumber>;
2936
2973
  }, z.core.$strip>>;
2974
+ security: z.ZodPrefault<z.ZodObject<{
2975
+ pii: z.ZodPrefault<z.ZodObject<{
2976
+ enabled: z.ZodDefault<z.ZodBoolean>;
2977
+ action: z.ZodDefault<z.ZodEnum<{
2978
+ block: "block";
2979
+ redact: "redact";
2980
+ warn: "warn";
2981
+ }>>;
2982
+ }, z.core.$strip>>;
2983
+ }, z.core.$strip>>;
2937
2984
  schedule: z.ZodPrefault<z.ZodObject<{
2938
2985
  tick: z.ZodDefault<z.ZodString>;
2939
2986
  deliver: z.ZodDefault<z.ZodString>;
@@ -3110,6 +3157,17 @@ declare const resolveAlias: (provider: string, modelId: string, aliases?: Readon
3110
3157
  /** Parse `grok models` human output into model ids. */
3111
3158
  declare const parseGrokModelsOutput: (stdout: string) => readonly string[];
3112
3159
  declare const listCliModels: (provider: string, bin: string, runner: CommandRunner, timeoutMs?: number) => Promise<readonly string[]>;
3160
+ declare const readCliModelsCache: (stateDir: string, provider: string) => {
3161
+ readonly fetchedAt: string;
3162
+ readonly ids: readonly string[];
3163
+ } | null;
3164
+ declare const writeCliModelsCache: (stateDir: string, provider: string, ids: readonly string[], now?: Date) => void;
3165
+ /**
3166
+ * `listCliModels`, but cached for `cacheHours` (like `readAaCache`/`writeAaCache` below): a provider's CLI model
3167
+ * list barely changes between releases, so spawning the CLI (e.g. `grok models`) on every tick/deliver run for
3168
+ * every role that needs it is wasted subprocess time — cache once, reuse until stale.
3169
+ */
3170
+ declare const listCliModelsCached: (provider: string, bin: string, runner: CommandRunner, stateDir: string, cacheHours: number, now?: () => Date) => Promise<readonly string[]>;
3113
3171
  interface ArtificialAnalysisModel {
3114
3172
  readonly slug: string;
3115
3173
  readonly name: string;
@@ -3209,7 +3267,7 @@ interface LoopDoctorInput {
3209
3267
  readonly queueTop?: number;
3210
3268
  }
3211
3269
  declare const providerSpecs: (config: LoopConfig) => readonly ProviderSpec[];
3212
- /** Count worktrees the loop treats as live workers: not archived, not the main checkout, with a live terminal or a linked Linear issue. */
3270
+ /** Count worktrees still doing implementation work. Review/completed worktrees keep their lease for delivery, but must not consume a builder slot. */
3213
3271
  declare const countRunningWorkers: (worktrees: readonly OrcaWorktree[]) => number;
3214
3272
  declare const runLoopDoctor: (input: LoopDoctorInput) => Promise<LoopDoctorReport>;
3215
3273
 
@@ -3442,9 +3500,11 @@ declare const renderContractPrompt: (input: {
3442
3500
  readonly references: readonly ContextReference[];
3443
3501
  readonly memoryBlock?: string;
3444
3502
  readonly maxIssueChars?: number;
3503
+ /** Called (once, if `security.pii.enabled`) with the matches found in the issue text, before redaction. */
3504
+ readonly onPiiDetected?: (matches: readonly PiiMatch[]) => void;
3445
3505
  }) => string;
3446
3506
  declare const parseContractOutput: (stdout: string) => TaskContract;
3447
- declare const resolveDocContext: (root: string, query: string, max: number, scopes?: readonly string[]) => Promise<readonly ContextReference[]>;
3507
+ declare const resolveDocContext: (root: string, query: string, max: number, scopes?: readonly string[], maxAgeHours?: number) => Promise<readonly ContextReference[]>;
3448
3508
  interface ProviderFailure {
3449
3509
  readonly provider: string;
3450
3510
  readonly model: string;
@@ -3467,6 +3527,8 @@ interface GenerateContractInput {
3467
3527
  readonly onProviderFailure?: (failure: ProviderFailure) => void;
3468
3528
  /** Observability for memory/doc-bridge char budgets. */
3469
3529
  readonly onMemoryPlan?: (plan: MemoryContextPlan) => void;
3530
+ /** Called (once, if `security.pii.enabled`) with the matches found in the issue text, before redaction. */
3531
+ readonly onPiiDetected?: (matches: readonly PiiMatch[]) => void;
3470
3532
  }
3471
3533
  declare const classifyProviderFailure: (detail: string, timedOut?: boolean) => ProviderFailure["kind"];
3472
3534
  /**
@@ -3516,6 +3578,8 @@ interface WorkerBriefInput {
3516
3578
  readonly guidanceRefs?: readonly ContextReference[];
3517
3579
  /** Full content of `brief.skills` files, read and digested once at dispatch time (`loadPinnedSkills`). */
3518
3580
  readonly skills?: readonly PinnedSkill[];
3581
+ /** Called (once, if `security.pii.enabled`) with the matches found in the issue text, before redaction. */
3582
+ readonly onPiiDetected?: (matches: readonly PiiMatch[]) => void;
3519
3583
  }
3520
3584
  interface HandoffBriefInput {
3521
3585
  readonly issue: string;
@@ -3538,6 +3602,71 @@ declare const renderHandoffBrief: (input: HandoffBriefInput) => string;
3538
3602
  /** The prompt a worker receives in its Orca terminal. Issue text is data; the contract and the rules are the instructions. */
3539
3603
  declare const renderWorkerBrief: (input: WorkerBriefInput) => string;
3540
3604
 
3605
+ /**
3606
+ * A local, in-process pub/sub bus over the loop's own event vocabulary (the same free-form `type` strings
3607
+ * `appendLoopEvent` writes to `<stateDir>/events.ndjson`: `contract.failed`, `worker.dispatched`, `pr.reviewed`,
3608
+ * `provider.cooldown`, `issue.paused`, etc.). It exists so a project can react to loop activity in real time
3609
+ * (tick/deliver run) instead of only reading the ndjson after the fact — the ndjson stays the durable log; this is
3610
+ * only a live fan-out on top of it, scoped to the current process.
3611
+ *
3612
+ * Deliberately not `kernel/plugins.ts`: that registry ties into `HARNESS_EVENT_TYPES` (the harness's own
3613
+ * lifecycle events) and requires plugin ids/versions/dependency ordering. The loop's event vocabulary is an open
3614
+ * set of strings owned by composition, not the kernel, so this is a plain listener map with the same "who's
3615
+ * listening" ergonomics, not a copy of the kernel's contract.
3616
+ */
3617
+ type LoopEventPayload = Readonly<Record<string, unknown>> & {
3618
+ readonly type: string;
3619
+ };
3620
+ type LoopEventListener = (event: LoopEventPayload) => void;
3621
+ /**
3622
+ * Fired around a loop-orchestration decision (not a model/tool call inside the worker's own CLI session — that
3623
+ * loop is opaque to us). A `before*` hook can return `{ block: true, reason }` to stop the action outright; any
3624
+ * other return value (including a thrown error, which is treated as `{ block: true }`) does not block.
3625
+ */
3626
+ type LoopHookName = 'beforeDispatch' | 'afterDispatch' | 'beforeReview' | 'afterReview' | 'beforeMerge' | 'afterMerge' | 'onPause' | 'onEscalate';
3627
+ type LoopHookPayload = Readonly<Record<string, unknown>>;
3628
+ type LoopHookResult = void | {
3629
+ readonly block: true;
3630
+ readonly reason: string;
3631
+ };
3632
+ type LoopHookListener = (payload: LoopHookPayload) => LoopHookResult | Promise<LoopHookResult>;
3633
+ interface LoopEventBus {
3634
+ /** Emit a loop event to every subscriber of its `type`. Never throws: a listener error is swallowed (composition must not fail because a plugin misbehaves). */
3635
+ emit(event: LoopEventPayload): void;
3636
+ /** Subscribe to one event type (or `'*'` for every event). Returns an unsubscribe function. */
3637
+ on(type: string | '*', listener: LoopEventListener): () => void;
3638
+ /** Register a lifecycle hook. Multiple listeners on the same hook all run; the first `{ block: true }` wins. */
3639
+ hook(name: LoopHookName, listener: LoopHookListener): () => void;
3640
+ /**
3641
+ * Run every listener registered for `name` in registration order and return the first block decision, or
3642
+ * `{ block: false }` when none blocked. A listener that throws is treated as a non-blocking no-op (a broken
3643
+ * plugin must not take down the loop) and its error is appended to `errors`.
3644
+ */
3645
+ runHook(name: LoopHookName, payload: LoopHookPayload): Promise<{
3646
+ readonly block: boolean;
3647
+ readonly reason?: string;
3648
+ readonly errors: readonly string[];
3649
+ }>;
3650
+ }
3651
+ declare const createLoopEventBus: () => LoopEventBus;
3652
+ /**
3653
+ * Load `plugins.modules` (local `.mjs` files, the same trust level as `agents.registry.yaml`: files the project
3654
+ * owner put in their own repo, never fetched over the network) and give each one the bus to subscribe to. A
3655
+ * module that fails to load or whose `apply` throws is reported, not fatal — one broken plugin must not stop tick
3656
+ * or deliver from running.
3657
+ */
3658
+ interface LoopPluginModule {
3659
+ readonly id: string;
3660
+ readonly apply: (bus: LoopEventBus) => void | Promise<void>;
3661
+ }
3662
+ declare const loadLoopPlugins: (root: string, modulePaths: readonly string[], bus: LoopEventBus) => Promise<{
3663
+ readonly loaded: readonly string[];
3664
+ readonly errors: readonly {
3665
+ readonly path: string;
3666
+ readonly error: string;
3667
+ }[];
3668
+ }>;
3669
+
3541
3670
  type TickOutcome = 'dispatched' | 'dry-run' | 'skipped' | 'escalated' | 'failed';
3542
3671
  interface TickCandidateResult {
3543
3672
  readonly issue: string;
@@ -3591,6 +3720,10 @@ interface DispatchRecordFile {
3591
3720
  readonly timedOut: boolean;
3592
3721
  } | null;
3593
3722
  readonly effort: EffortLevel;
3723
+ /** Builder provider's remaining Orca usage percent at dispatch time (`resilience.maxUsageDeltaPercent` cost guard); `null` when usage was unknown. */
3724
+ readonly initialRemainingPercent: number | null;
3725
+ /** Absolute path to the Orca worktree, so `loop status`/`debrief`/`watch` can best-effort read `progress.json` from it. */
3726
+ readonly worktreePath: string;
3594
3727
  }
3595
3728
  interface TickInput {
3596
3729
  readonly configPath?: string;
@@ -3635,8 +3768,9 @@ declare const dispatchRecordPath: (stateDir: string, identifier: string) => stri
3635
3768
  declare const briefPath: (stateDir: string, identifier: string) => string;
3636
3769
  declare const readDispatchRecord: (stateDir: string, identifier: string) => DispatchRecordFile | null;
3637
3770
  declare const writeDispatchRecord: (stateDir: string, record: DispatchRecordFile) => string;
3638
- declare const appendLoopEvent: (stateDir: string, event: Record<string, unknown>) => void;
3771
+ declare const appendLoopEvent: (stateDir: string, event: Record<string, unknown>, bus?: LoopEventBus, now?: () => Date) => void;
3639
3772
  interface LoopState {
3773
+ readonly person: string;
3640
3774
  readonly providers: readonly ProviderAvailability[];
3641
3775
  readonly routing: Readonly<Record<string, RoutingDecision>>;
3642
3776
  readonly worktrees: readonly OrcaWorktree[];
@@ -3645,6 +3779,8 @@ interface LoopState {
3645
3779
  readonly leases: readonly DispatchLease[];
3646
3780
  readonly busy: ReadonlySet<string>;
3647
3781
  readonly candidates: readonly LoopIssue[];
3782
+ /** Catalog-discovered candidates per role (`models.routing.mode: catalog`), already resolved for `routing` above — reused by `runTick` for `generateContract`'s candidate fallback so it isn't resolved twice per tick. */
3783
+ readonly extrasByRole: Partial<Record<ModelRole, readonly ModelReference[]>>;
3648
3784
  }
3649
3785
  declare const gatherLoopState: (input: {
3650
3786
  readonly loaded: LoadedLoopConfig;
@@ -3790,7 +3926,7 @@ interface DeliverInput {
3790
3926
  }
3791
3927
  declare const deliveryStatePath: (stateDir: string, identifier: string) => string;
3792
3928
  declare const readDeliveryState: (stateDir: string, identifier: string) => DeliveryState;
3793
- /** Every issue the loop dispatched and has not finished. */
3929
+ /** Every issue the loop ever dispatched (finished or not) — callers that only care about in-flight work must filter on `readDeliveryState(...).finishedAt` themselves. */
3794
3930
  declare const listDispatched: (stateDir: string) => readonly DispatchRecordFile[];
3795
3931
  declare const precheckDeliver: (stateDir: string) => {
3796
3932
  readonly work: boolean;
@@ -3867,6 +4003,26 @@ declare const parseAutomationRuns: (result: unknown) => readonly {
3867
4003
  }[];
3868
4004
  declare const loopStatus: (input: Pick<InstallInput, "configPath" | "loaded" | "runner">) => Promise<LoopStatusReport>;
3869
4005
 
4006
+ declare const rotationStatePath: (stateDir: string) => string;
4007
+ /**
4008
+ * A lease protects the issue identity, but delivery work must not stop the
4009
+ * queue from moving on to independent work. Only leases with no delivery
4010
+ * state yet represent an implementation worker that should hold rotation.
4011
+ * Missing or invalid state stays fail-closed and remains blocking.
4012
+ */
4013
+ declare const countRotationBlockingLeases: (loaded: LoadedLoopConfig, leases: readonly DispatchLease[]) => number;
4014
+ /** Effective owner for this machine; without rotation the versioned config remains authoritative. */
4015
+ declare const queueOwner: (loaded: LoadedLoopConfig) => string;
4016
+ /** Advance once, only after the current owner has no dispatchable work and no active implementation lease. */
4017
+ declare const advanceQueueOwner: (loaded: LoadedLoopConfig, input: {
4018
+ readonly queueEmpty: boolean;
4019
+ readonly activeLeases: number;
4020
+ readonly now?: Date;
4021
+ }) => {
4022
+ readonly owner: string;
4023
+ readonly advanced: boolean;
4024
+ };
4025
+
3870
4026
  interface GuidedInstallIO {
3871
4027
  /** Ask a yes/no question; `fallback` is used when the answer is empty. */
3872
4028
  readonly confirm: (question: string, fallback: boolean) => Promise<boolean>;
@@ -3973,6 +4129,19 @@ declare const promptLocalConfig: (runner: CommandRunner, loaded: LoadedLoopConfi
3973
4129
  readonly currentUserHint?: string;
3974
4130
  }) => Promise<LocalConfigAnswers | null>;
3975
4131
 
4132
+ /** One outcome id (from the frozen contract) mapped to how far the worker has gotten on it. */
4133
+ type OutcomeProgressStatus = 'in-progress' | 'done';
4134
+ type OutcomeProgress = Readonly<Record<string, OutcomeProgressStatus>>;
4135
+ /**
4136
+ * The worker cannot be asked "what have you done so far" — it is an opaque CLI session, and the contract's
4137
+ * outcome list (`brief.ts`) is a static plan frozen before dispatch, not a live todo list. The brief documents a
4138
+ * lightweight convention instead: the worker writes `progress.json` at its worktree root, one entry per outcome id
4139
+ * it has started or finished, and we read it back best-effort. A missing, unreadable or malformed file is not an
4140
+ * error — it just means no progress has been reported yet — because nothing enforces that a worker keeps it
4141
+ * current, and older dispatches never wrote one at all.
4142
+ */
4143
+ declare const readOutcomeProgress: (worktreePath: string | null | undefined) => OutcomeProgress | null;
4144
+
3976
4145
  interface DebriefInput {
3977
4146
  readonly configPath?: string;
3978
4147
  readonly loaded?: LoadedLoopConfig;
@@ -3998,6 +4167,8 @@ interface DebriefIssueRow {
3998
4167
  readonly heldFor: string | null;
3999
4168
  readonly finalOutcome: string | null;
4000
4169
  readonly contractIntent: string | null;
4170
+ /** Best-effort read of `progress.json` from the worktree, keyed by outcome id (see brief.ts rule 10); `null` when the worker hasn't written one. */
4171
+ readonly progress: OutcomeProgress | null;
4001
4172
  }
4002
4173
  interface DebriefReport {
4003
4174
  readonly generatedAt: string;
@@ -4028,56 +4199,6 @@ interface DebriefReport {
4028
4199
  declare const buildDebriefReport: (input: DebriefInput) => DebriefReport;
4029
4200
  declare const renderDebriefMarkdown: (report: DebriefReport) => string;
4030
4201
 
4031
- type WatchEventKind = 'DONE' | 'FAILED' | 'ACTION_REQUIRED' | 'PROGRESS';
4032
- interface WatchEvent {
4033
- readonly kind: WatchEventKind;
4034
- readonly issue: string;
4035
- readonly message: string;
4036
- readonly phase: string;
4037
- readonly pr: number | null;
4038
- readonly finalOutcome: DeliverOutcome | null;
4039
- readonly at: string;
4040
- }
4041
- interface WatchTargetSnapshot {
4042
- readonly issue: string;
4043
- readonly phase: string;
4044
- readonly signature: string;
4045
- readonly delivery: DeliveryState;
4046
- readonly dispatch: DispatchRecordFile | null;
4047
- readonly pr: PullRequestSnapshot | null;
4048
- }
4049
- interface WatchInput {
4050
- readonly configPath?: string;
4051
- readonly loaded?: LoadedLoopConfig;
4052
- readonly runner?: CommandRunner;
4053
- readonly issue?: string;
4054
- readonly intervalMs?: number;
4055
- readonly once?: boolean;
4056
- readonly timeoutMs?: number;
4057
- readonly livePr?: boolean;
4058
- readonly now?: () => Date;
4059
- readonly sleep?: (ms: number) => Promise<void>;
4060
- readonly onEvent?: (event: WatchEvent) => void;
4061
- }
4062
- declare const classifyWatchPhase: (delivery: DeliveryState, pr: PullRequestSnapshot | null) => string;
4063
- declare const classifyWatchEvent: (phase: string, delivery: DeliveryState, pr: PullRequestSnapshot | null, at: string, issue: string) => WatchEvent;
4064
- declare const snapshotWatchTargets: (input: {
4065
- readonly loaded: LoadedLoopConfig;
4066
- readonly runner?: CommandRunner;
4067
- readonly issue?: string;
4068
- readonly livePr?: boolean;
4069
- readonly now?: () => Date;
4070
- }) => Promise<readonly WatchTargetSnapshot[]>;
4071
- interface WatchReport {
4072
- readonly status: 'done' | 'failed' | 'waiting' | 'action-required';
4073
- readonly generatedAt: string;
4074
- readonly events: readonly WatchEvent[];
4075
- readonly targets: readonly WatchTargetSnapshot[];
4076
- }
4077
- /** Poll delivery state (and optionally live PRs). Emits DONE / FAILED / ACTION_REQUIRED / PROGRESS. Read-only. */
4078
- declare const watchDeliveries: (input: WatchInput) => Promise<WatchReport>;
4079
- declare const formatWatchEvent: (event: WatchEvent) => string;
4080
-
4081
4202
  interface LoopEvent {
4082
4203
  readonly at: string;
4083
4204
  readonly type: string;
@@ -4172,7 +4293,11 @@ interface RetroReport {
4172
4293
  readonly suggestions: readonly RetroSuggestion[];
4173
4294
  readonly digest: string;
4174
4295
  }
4175
- declare const readLoopEvents: (stateDir: string) => readonly LoopEvent[];
4296
+ /** `sinceMs`, when given, skips a rotated archive whose rotation time is older than the window — every event in
4297
+ * that file was written before its own rotation, so if the rotation itself predates `sinceMs` nothing inside can
4298
+ * be in range (see `appendLoopEvent` in tick.ts for the rotation side). Omit `sinceMs` to read everything, exactly
4299
+ * as before archives existed. */
4300
+ declare const readLoopEvents: (stateDir: string, sinceMs?: number) => readonly LoopEvent[];
4176
4301
  declare const parseSince: (value: string | undefined, now: Date) => Date;
4177
4302
  /** Collapse an escalation reason to its head phrase so identical shapes group together. */
4178
4303
  declare const normalizeReason: (reason: string) => string;
@@ -4211,6 +4336,164 @@ declare const runRetroStage: (input: {
4211
4336
  readonly dryRun?: boolean;
4212
4337
  }) => Promise<RetroStageReport>;
4213
4338
 
4339
+ type ObservabilitySeverity = 'warning' | 'action_required';
4340
+ interface ObservabilityAnomaly {
4341
+ readonly id: string;
4342
+ readonly severity: ObservabilitySeverity;
4343
+ readonly issue: string | null;
4344
+ readonly message: string;
4345
+ readonly evidence: Readonly<Record<string, unknown>>;
4346
+ }
4347
+ interface ObservabilityMetrics {
4348
+ readonly queueReady: number;
4349
+ readonly freeSlots: number;
4350
+ readonly runningWorkers: number;
4351
+ readonly maxAgents: number;
4352
+ readonly activeClaims: number;
4353
+ readonly inFlight: number;
4354
+ readonly held: number;
4355
+ readonly merged: number;
4356
+ readonly blocked: number;
4357
+ readonly fixRounds: number;
4358
+ readonly reviewFindings: number;
4359
+ readonly reviewIncomplete: number;
4360
+ readonly medianLeadTimeMin: number | null;
4361
+ readonly providerRemainingPercent: Readonly<Record<string, number | null>>;
4362
+ readonly machine: {
4363
+ readonly cpuCount: number;
4364
+ readonly load1PerCpuPercent: number;
4365
+ readonly memoryUsedPercent: number;
4366
+ readonly freeRamGb: number;
4367
+ };
4368
+ readonly memory: {
4369
+ readonly recalls: number;
4370
+ readonly hits: number;
4371
+ readonly approxCharsSaved: number;
4372
+ };
4373
+ readonly cache: {
4374
+ readonly cachedContracts: number;
4375
+ };
4376
+ readonly tokens: {
4377
+ readonly input: number;
4378
+ readonly output: number;
4379
+ readonly total: number;
4380
+ readonly cacheRead: number;
4381
+ readonly cacheWrite: number;
4382
+ };
4383
+ readonly events: Readonly<Record<string, number>>;
4384
+ }
4385
+ interface ObservabilityReport {
4386
+ readonly status: 'healthy' | 'action_required';
4387
+ readonly generatedAt: string;
4388
+ readonly project: string;
4389
+ readonly person: string;
4390
+ readonly windowHours: number;
4391
+ readonly anomalies: readonly ObservabilityAnomaly[];
4392
+ readonly metrics: ObservabilityMetrics;
4393
+ }
4394
+ interface ObservabilityTerminal {
4395
+ readonly handle: string;
4396
+ readonly status: string;
4397
+ readonly worktreeId: string | null;
4398
+ readonly lastOutputAt: number | null;
4399
+ readonly preview: string;
4400
+ }
4401
+ interface ObservabilitySnapshot {
4402
+ readonly generatedAt: string;
4403
+ readonly project: string;
4404
+ readonly person: string;
4405
+ readonly windowHours: number;
4406
+ readonly workerIdleTimeoutMin: number;
4407
+ readonly queueReady: number;
4408
+ readonly freeSlots: number;
4409
+ readonly runningWorkers: number;
4410
+ readonly maxAgents: number;
4411
+ readonly activeClaims: number;
4412
+ readonly missingDeliveryIssues: readonly string[];
4413
+ readonly terminals: readonly ObservabilityTerminal[];
4414
+ readonly finalizedDirtyWorktrees: readonly {
4415
+ readonly worktreeId: string;
4416
+ readonly issue: string | null;
4417
+ readonly files: number;
4418
+ }[];
4419
+ readonly issues: readonly Pick<DebriefIssueRow, 'issue' | 'phase' | 'ageMin' | 'heldFor'>[];
4420
+ readonly events: readonly LoopEvent[];
4421
+ readonly merged: number;
4422
+ readonly blocked: number;
4423
+ readonly fixRounds: number;
4424
+ readonly reviewFindings: number;
4425
+ readonly reviewIncomplete: number;
4426
+ readonly medianLeadTimeMin: number | null;
4427
+ readonly providerRemainingPercent: Readonly<Record<string, number | null>>;
4428
+ readonly machine: ObservabilityMetrics['machine'];
4429
+ readonly memory: ObservabilityMetrics['memory'];
4430
+ readonly cache: ObservabilityMetrics['cache'];
4431
+ readonly tokens: ObservabilityMetrics['tokens'];
4432
+ }
4433
+ /** Pure, deterministic anomaly assessment. No network calls or writes. */
4434
+ declare const assessObservability: (input: ObservabilitySnapshot) => ObservabilityReport;
4435
+ /** Collect current read-only state from the existing doctor, debrief and event log. */
4436
+ declare const runObservability: (input: {
4437
+ readonly configPath?: string;
4438
+ readonly loaded?: LoadedLoopConfig;
4439
+ readonly runner: CommandRunner;
4440
+ readonly env?: NodeJS.ProcessEnv;
4441
+ readonly platform?: NodeJS.Platform;
4442
+ readonly since?: string;
4443
+ readonly now?: () => Date;
4444
+ }) => Promise<ObservabilityReport>;
4445
+ declare const renderObservabilityMarkdown: (report: ObservabilityReport) => string;
4446
+
4447
+ type WatchEventKind = 'DONE' | 'FAILED' | 'ACTION_REQUIRED' | 'PROGRESS';
4448
+ interface WatchEvent {
4449
+ readonly kind: WatchEventKind;
4450
+ readonly issue: string;
4451
+ readonly message: string;
4452
+ readonly phase: string;
4453
+ readonly pr: number | null;
4454
+ readonly finalOutcome: DeliverOutcome | null;
4455
+ readonly at: string;
4456
+ }
4457
+ interface WatchTargetSnapshot {
4458
+ readonly issue: string;
4459
+ readonly phase: string;
4460
+ readonly signature: string;
4461
+ readonly delivery: DeliveryState;
4462
+ readonly dispatch: DispatchRecordFile | null;
4463
+ readonly pr: PullRequestSnapshot | null;
4464
+ }
4465
+ interface WatchInput {
4466
+ readonly configPath?: string;
4467
+ readonly loaded?: LoadedLoopConfig;
4468
+ readonly runner?: CommandRunner;
4469
+ readonly issue?: string;
4470
+ readonly intervalMs?: number;
4471
+ readonly once?: boolean;
4472
+ readonly timeoutMs?: number;
4473
+ readonly livePr?: boolean;
4474
+ readonly now?: () => Date;
4475
+ readonly sleep?: (ms: number) => Promise<void>;
4476
+ readonly onEvent?: (event: WatchEvent) => void;
4477
+ }
4478
+ declare const classifyWatchPhase: (delivery: DeliveryState, pr: PullRequestSnapshot | null) => string;
4479
+ declare const classifyWatchEvent: (phase: string, delivery: DeliveryState, pr: PullRequestSnapshot | null, at: string, issue: string) => WatchEvent;
4480
+ declare const snapshotWatchTargets: (input: {
4481
+ readonly loaded: LoadedLoopConfig;
4482
+ readonly runner?: CommandRunner;
4483
+ readonly issue?: string;
4484
+ readonly livePr?: boolean;
4485
+ readonly now?: () => Date;
4486
+ }) => Promise<readonly WatchTargetSnapshot[]>;
4487
+ interface WatchReport {
4488
+ readonly status: 'done' | 'failed' | 'waiting' | 'action-required';
4489
+ readonly generatedAt: string;
4490
+ readonly events: readonly WatchEvent[];
4491
+ readonly targets: readonly WatchTargetSnapshot[];
4492
+ }
4493
+ /** Poll delivery state (and optionally live PRs). Emits DONE / FAILED / ACTION_REQUIRED / PROGRESS. Read-only. */
4494
+ declare const watchDeliveries: (input: WatchInput) => Promise<WatchReport>;
4495
+ declare const formatWatchEvent: (event: WatchEvent) => string;
4496
+
4214
4497
  /** One recorded failure for an issue, kept for diagnostics (`loop retro`, `loop status`). */
4215
4498
  interface IssueFailureRecord {
4216
4499
  readonly kind: string;
@@ -4293,4 +4576,4 @@ declare const discoverIntake: (runner: CommandRunner, input: {
4293
4576
  readonly now: () => Date;
4294
4577
  }, options?: GitHubCliOptions) => Promise<readonly IntakeRecord[]>;
4295
4578
 
4296
- export { AGENT_REGISTRY_SCHEMA_VERSION, ARTIFACT_SCHEMA_VERSION, ARTIFACT_TYPES, ASSURANCE_LEVELS, type AdapterMetadata, type AdapterTelemetry, type AdversarialReviewResult, type AgentAdapter, type AgentEvalCase, type AgentEvalReport, type AgentEvalSuite, type AgentMemoryAdapter, type AgentMemoryHit, type AgentMemoryKvStore, type AgentMemoryRecord, type AgentRegistry, type AgentRegistryEntry, AgentRegistryEntrySchema, AgentRegistrySchema, type AgentSessionOptions, type AgentUsage, type ApprovedAssumption, type ArgvRagContextProviderOptions, type ArtifactBinding, type ArtifactEnvelope, type ArtifactEnvelopeInput, type ArtifactType, type ArtificialAnalysisModel, type AssuranceLevel, type AutomationStatus, type AutonomyMode, BENCHMARK_SCHEMA_VERSION, BLOCK_STATUSES, type BenchmarkBinding, type BenchmarkComparison, type BenchmarkImprovementDirection, type BenchmarkManifest, type BenchmarkObservation, type BenchmarkObservationEvidence, type BenchmarkObservationInput, type BenchmarkObservationStatus, type BenchmarkReport, type BenchmarkRun, type BenchmarkSummary, type BenchmarkTask, type BlockAssessment, type BlockManifest, type BlockStatus, CAPABILITY_KINDS, CAPABILITY_MANIFEST_SCHEMA_VERSION, CHECK_CATEGORIES, COMPATIBILITY_COMPONENTS, COMPATIBILITY_SCHEMA_VERSION, CONTEXT_PROVIDER_SLOT, CONTRACT_CLOSE, CONTRACT_OPEN, CONTRACT_SCHEMA_VERSION, type CacheUsage, type CapabilityDescriptor, type CapabilityKind, type CapabilityManifest, type CapabilityManifestInput, type CatalogModel, type ChangedFile, type CheckCategory, type CheckOutcome, type CheckResult, type ChecksAssessment, type ClaimResult, type CodeReviewInput, type CodeReviewOutcome, type CodingAgentAdapter, type CodingAgentHandlerResult, type CodingAgentRequest, type CodingAgentResult, type CommandResult, type CommandRunOptions, type CommandRunner, type CompatibilityComponent, type CompatibilityComponentId, type CompatibilityManifest, type CompatibilityObservation, type CompatibilityReport, type CompatibilityStatus, type ContextProvider, type ContextQuery, type ContextReference, type ContextSnapshot, type ContractAssessment, type ContractOutcome, ContractOutcomeSchema, type ContractScope, type CooldownEntry, type CooldownState, type CoordinationIdentity, type CriterionStatus, type CycleIterationMetrics, type CycleMatrixRow, type CycleStepResult, type CycleStepStatus, type DebriefInput, type DebriefIssueRow, type DebriefReport, type DecisionPacket, type DeliverInput, type DeliverOutcome, type DeliverReport, type DeliverResult, type DeliveryState, type DetectProvidersInput, type DiscoveryAmbiguity, type DiscoveryCurrentInput, type DiscoveryCurrentResult, type DiscoveryDecisionLogEntry, type DiscoveryInput, type DiscoveryOption, type DiscoveryResult, type DispatchLease, type DispatchLedger, type DispatchRecord, type DispatchRecordFile, type Disposer, type DocBridgeIndexInspection, type DockerMount, type DockerRuntimeEvidence, type DockerToolDefinition, type DoctorCheck, type DoctorCheckStatus, EVAL_COMPONENTS, EVAL_LAYERS, EVAL_MANIFEST_SCHEMA_VERSION, EVENT_LOG_GENESIS, EVIDENCE_BUNDLE_SCHEMA_VERSION, type EffortLevel, type EvalBatteryReport, type EvalCaseDefinition, type EvalCaseReport, type EvalComponent, type EvalExpectation, type EvalLayer, type EvalManifest, type EvalObservation, type EvalObservationStatus, type EventLogLock, type EventLogLockRecovery, type EventLogLockStatus, type EventLogVerification, type EventStore, type EvidenceArtifact, type EvidenceBundle, type EvidenceBundleFile, type EvidenceBundleSignature, type EvidenceBundleVerification, type EvidenceReference, type ExecutePhaseProfileOptions, type FailureClass, type FailureClassification, type FetchQueueInput, FileArtifactStore, FileEventStore, type FilePreflightPlan, type GateAssessment, type GateBinding, type GateCriterion, type GenerateContractInput, type GitHubCliOptions, type GuidedInstallIO, type GuidedInstallInput, type GuidedInstallReport, HARNESS_ERROR_CATALOG, HARNESS_ERROR_CODES, HARNESS_EVENT_ENVELOPE_SCHEMA_VERSION, HARNESS_EVENT_SCHEMA_VERSION, HARNESS_EVENT_TYPES, HARNESS_PLUGIN_API_VERSION, HARNESS_REPO_URL, type HandoffBriefInput, HarnessError, type HarnessErrorClassification, type HarnessErrorDisposition, type HarnessEvent, type HarnessEventContext, type HarnessEventEnvelope, type HarnessEventEnvelopeInput, type HarnessEventInput, type HarnessEventListener, type HarnessEventPayloads, type HarnessEventProvenance, type HarnessEventType, type HarnessPlugin, type HarnessPluginContext, IMPROVEMENT_CYCLE_STEPS, type ImprovementCycleAssessment, type ImprovementCycleInput, type ImprovementCycleIteration, type ImprovementCycleStep, type InstallAction, type InstallInput, type InstallReport, type IntakeRecord, type IssueFailureRecord, type IssueFailureState, LEARNING_STATUSES, LEGAL_TRANSITIONS, LOOP_CONFIG_FILE, LOOP_CONFIG_SCHEMA_VERSION, LOOP_LOCAL_CONFIG_FILE, LOOP_STAGES, type LearningRecord, type LearningStatus, type LearningsLedger, type LinearIssueDetail, type LinearListInput, type LinearQueueFilter, type LinearWriteOptions, type LlmCache, type LlmCacheKeyInput, type LlmCacheStats, type LoadedConfig, type LoadedLoopConfig, type LocalConfigAnswers, type LocalConfigPrompter, type LoopConfig, type LoopConfigInput, LoopConfigSchema, type LoopDoctorInput, type LoopDoctorReport, type LoopEvent, type LoopIssue, type LoopProviderConfig, type LoopStage, type LoopStageName, type LoopState, type LoopStatusReport, MEMORY_SCOPES, MODEL_ROLES, type MachineMetrics, type MachineSample, type MachineThresholds, type McpPolicy, type McpToolBridge, type McpToolBridgeOptions, type McpToolCallInput, type McpToolCallResult, type MemoryContextPlan, type MemoryPromptSelection, type MemoryScope, type MemoryUsage, type MetricStatus, type ModelBinding, type ModelPolicy, type ModelQuality, type ModelReference, type ModelRole, type NormalizedPhaseProfile, type OptimizationComparison, type OptimizationObservation, type OrcaAgentHookState, type OrcaAutomation, type OrcaAutomationSpec, type OrcaCliOptions, type OrcaCreatedWorktree, type OrcaDispatchInput, type OrcaDispatchPlan, type OrcaLeaseState, type OrcaLifecycleInput, type OrcaLifecycleProjection, type OrcaStatus as OrcaRuntimeStatus, type OrcaSendReceipt, type OrcaTerminal, type OrcaWorktree, PHASE_DECISIONS, PHASE_EFFECTS, PHASE_EFFECT_ACTIONS, PHASE_MODES, PR_FIELDS, type ParallelismUsage, type PhaseAmbiguity, type PhaseContext, type PhaseDecision, type PhaseDecisionPacket, type PhaseDefinition, type PhaseEffect, type PhaseEffectAction, type PhaseEffectPolicy, type PhaseExecution, type PhaseExecutionReport, type PhaseGateEvaluator, type PhaseGateResult, type PhaseHandler, type PhaseHandlerResult, type PhaseMachineMetrics, type PhaseMode, type PhasePreflight, type PhasePreflightResult, type PhaseProfile, type PhaseResumeState, type PhaseRetryPolicy, type PhaseRoutePlan, type PhaseTelemetry, type PhaseTokenMetrics, type PilotAssessment, type PilotEntry, type PilotManifest, type PinnedSkill, type PinnedSkillRef, type PluginContribution, type PluginRegistry, type PluginSlot, type PolicyDecision, type PolicyGate, type PolicyRequest, type PolicyRule, type ProcessToolDefinition, type ProductionEvidence, type ProviderAuthStatus, type ProviderAvailability, type ProviderCatalog, type ProviderFailure, type ProviderSpec, type ProviderUsage, type PullRequestApproval, type PullRequestCheck, type PullRequestDraft, type PullRequestSnapshot, QUALITY_DIMENSIONS, type QaTransitionAssessment, type QualityDimension, type QualityDimensionScore, type QualityMatrix, REVIEW_SEVERITIES, RUN_STATES, type RagContextProviderOptions, type RagQueryResult, type RankedModel, type RecoveryObservation, type RecoveryPolicy, type RecoveryResult, type RepositoryProfile, type ResolvedAgent, type RetroInput, type RetroIssueRow, type RetroReport, type RetroStageReport, type RetroSuggestion, type RetroTarget, type RetroWindow, type ReviewFinding, type ReviewLens, type ReviewSeverity, type ReviewVerdict, type RichIO, type RoutingDecision, type RoutingSkip, type RunOutcome, type RunReconciliation, type RunState, type RuntimeConfig, type RuntimeExperimentCandidate, type RuntimeExperimentResult, STATES, SURFACE_NAMES, type SessionRecorder, type SlotAssessment, type SlotInput, type SourceSnapshot, type StagePauseEntry, type StagePauseState, type StateTransition, type StatusBlock, type StatusSnapshot, type StoredContract, type StructuredEvidence, type SurfaceName, type SurfaceRequirement, type TaskContract, TaskContractSchema, type TeamMember, type TickCandidateResult, type TickInput, type TickOutcome, type TickReport, type TokenUsage, type ToolDefinition, type ToolExecutionRequest, type ToolExecutionResult, type ToolRuntime, type TrackingAdapter, type TrackingConfig, type TrackingTransition, type TrustedEvidenceKey, type UsageMetric, type UsageWindow, type VerificationCheck, type VerificationConfig, type VerificationRun, WIP_STATES, type WatchEvent, type WatchEventKind, type WatchInput, type WatchReport, type WatchTargetSnapshot, type WatchdogBlocker, type WatchdogBudget, type WatchdogResult, type WipAssessment, type WipAssessmentInput, type WipEntry, type WipState, type WorkerBriefInput, type WorkflowNode, type WorkflowResult, activeCooldowns, adaptiveConcurrency, appendLoopEvent, approveRun, approvedDecision, artifactDigest, artifactFilePath, artifactIsFresh, artifactMarkdownPath, assertHuman, assessAcceptance, assessAgentEval, assessBlock, assessChecks, assessCompatibility, assessContract, assessDiscovery, assessImprovementCycle, assessIntegration, assessPilot, assessPreflight, assessProduction, assessQaTransition, assessSlots, assessWip, assessWorktreeCleanup, atLeast, authStatusFor, authorizeRun, automationName, automationPrompt, automationSpecs, availableMemoryBytes, benchmarkRuns, branchFor, briefPath, buildDebriefReport, buildListIssuesArgv, buildRetroReport, buildReviewArgv, buildSuggestions, busyIssues, cancelRun, classifyFailure, classifyHarnessError, classifyProviderFailure, classifyWatchEvent, classifyWatchPhase, cleanTaskArtifacts, clearIssueFailures, clearProviderCooldown, compareOptimization, compareVersions, composePullRequest, contractIsFresh, contractPath, cooldownPath, cooldownUntil, countRunningWorkers, createArgvRagContextProvider, createArtifactEnvelope, createCapabilityManifest, createCodingAgentAdapter, createCompatibilityManifest, createConfiguredToolRuntime, createDispatchLedger, createDocBridgeContextProvider, createDockerToolRuntime, createEvalManifest, createFileMemoryAdapter, createFileMemoryKvStore, createHarnessEventEnvelope, createInMemoryMemoryAdapter, createKvMemoryAdapter, createLinearTrackingAdapter, createLlmCache, createLlmCacheKey, createMachineMonitor, createMcpToolBridge, createModelPolicy, createOrcaDispatchPlan, createOrcaLifecycleProjection, createPhaseArtifact, createPhaseProfile, createPluginRegistry, createPluginSlot, createPolicyGate, createProcessRunner, createProcessToolRuntime, createPullRequestApproval, createQualityMatrix, createRagContextProvider, createRichIO, createSessionRecorder, createStatusSnapshot, createToolRuntime, createTrackingAdapter, createTrackingTransition, deliveryStatePath, detectProviders, discoverIntake, dispatchRecordPath, evaluateWatchdog, executePhaseProfile, exportEvidenceBundle, extractResetsAt, fetchArtificialAnalysisModels, fetchLinearIssue, fetchLinearQueue, fetchTeamMembers, filterAndOrderQueue, findExecutable, formatWatchEvent, gatherLoopState, generateContract, githubComment, githubCommentArgv, githubCommentExists, githubLabelRemove, githubMerge, githubMergeArgv, githubOpenPullRequests, githubPullRequest, githubPullRequestsForBranch, hasLocalConfig, hashContextSnapshot, hashContextSnapshots, hashMcpArgs, inspectDocBridgeIndex, inspectEventLogLock, installLoopAutomations, installPreflight, intakeIssueId, intakePath, isDiscoveryCurrent, isIssuePaused, isStagePaused, isWsl, issueFailurePath, launchWorkerTerminal, learningToMemoryRecord, learningsPath, linearAttach, linearAttachArgv, linearCommentAdd, linearCommentAddArgv, linearLabelAdd, linearLabelArgv, linearLabelRemove, linearStatusSet, linearStatusSetArgv, listCliModels, listDispatched, listIntake, listPausedIssues, loadAgentRegistry, loadAliases, loadBenchmarkManifest, loadBuiltinCatalog, loadConfig, loadLatestRun, loadLoopConfig, loadPinnedSkills, localConfigPath, loopStatus, markProviderExhausted, memoryDigestOf, mergeLoopConfig, modelFor, normalizeReason, openLoopMemory, orcaAccountList, orcaAgentHooks, orcaAutomationCreateArgv, orcaAutomationEditArgv, orcaAutomationRemove, orcaAutomationRun, orcaAutomationRuns, orcaAutomationsList, orcaJson, orcaStatus, orcaTerminalCreate, orcaTerminalList, orcaTerminalScreen, orcaTerminalSend, orcaTerminalWait, orcaVersion, orcaWorktreeCreate, orcaWorktreeRemove, orcaWorktreeSet, orcaWorktreeSetArgv, orcaWorktrees, parseAgentRegistryText, parseArtificialAnalysisPayload, parseAutomationRuns, parseContractOutput, parseGrokModelsOutput, parseJsonEnvelope, parseLinearIssueDetail, parseLinearIssues, parseLoopConfigText, parseMemInfo, parseModelRef, parseOrcaAgentHooks, parseOrcaAutomations, parseOrcaSendReceipt, parseOrcaStatus, parseOrcaTerminals, parseOrcaVersion, parseOrcaWorktreeCreate, parseOrcaWorktrees, parseProviderUsage, parsePullRequest, parseRagQueryOutput, parseRetro, parseReviewResult, parseSince, parseTeamMembers, parseUsageWindows, parseVmStat, pauseIssue, planFilePreflight, planMemoryContext, planPhaseProfile, planRun, precheckCommand, precheckDeliver, precheckTick, preferMemoryOverDocBridge, promoteLearnings, promoteLearningsToMemory, promptLocalConfig, providerIdentity, providerSpecs, rankModels, readAaCache, readArtifactFile, readContextSnapshots, readCooldowns, readDeliveryState, readDispatchRecord, readEvidenceTrustStore, readIntake, readIssueFailures, readLearningsLedger, readLoopEvents, readStagePause, readStoredContract, reconcileRun, recordBenchmarkObservation, recordIssueFailure, recordStageRunResult, recoverEventLogLock, recoveryDelayMs, remainingUsagePercent, renderArtifactMarkdown, renderContractPrompt, renderDebriefMarkdown, renderFindingsForWorker, renderHandoffBrief, renderHeadlessArgv, renderLocalConfig, renderPinnedSkills, renderRetroMarkdown, renderTuiCommand, renderWorkerBrief, resolveAgentForRole, resolveAlias, resolveCatalogCandidates, resolveDocContext, resumeIssue, resumeStage, resumeStateFromArtifacts, retroLearnings, retryRun, routeAllRoles, runAdversarialReview, runAgentEval, runCodeReview, runDeliver, runEvalBattery, runGuidedInstall, runLoopDoctor, runRetroStage, runTick, runWithRecovery, runWorkflow, sampleMachine, selectMemoryForPrompt, selectModel, selectRuntime, severityRank, shellQuote, skillDigest, skillRefs, snapshotWatchTargets, stageEntry, stagePausePath, startRun, summarizeMachine, tiersFor, touchesProtectedPaths, transition, undeclaredOrcaProviders, uninstallLoopAutomations, unknownTelemetry, untrusted, upsertProposedLearnings, usageRankTuple, validateAdapterMetadata, validateArtifactEnvelope, validateBenchmarkManifest, validateBlockManifest, validateCacheableOperation, validateCapabilityManifest, validateCompatibilityManifest, validateConfig, validateContextSnapshot, validateContextSnapshots, validateEvalManifest, validateHarnessErrorClassification, validateHarnessEventEnvelope, validateLoopConfig, validateMemoryRecord, validateOptimizationObservation, validatePhaseTelemetry, validateSafeCommand, validateStatusSnapshot, verifyEvidenceBundle, verifyPullRequestApproval, verifyRun, watchDeliveries, worktreeNameFor, writeAaCache, writeDispatchRecord, writeIdFor, writeLearningsLedger, writeLocalConfig, writeStoredContract };
4579
+ export { AGENT_REGISTRY_SCHEMA_VERSION, ARTIFACT_SCHEMA_VERSION, ARTIFACT_TYPES, ASSURANCE_LEVELS, type AdapterMetadata, type AdapterTelemetry, type AdversarialReviewResult, type AgentAdapter, type AgentEvalCase, type AgentEvalReport, type AgentEvalSuite, type AgentMemoryAdapter, type AgentMemoryHit, type AgentMemoryKvStore, type AgentMemoryRecord, type AgentRegistry, type AgentRegistryEntry, AgentRegistryEntrySchema, AgentRegistrySchema, type AgentSessionOptions, type AgentUsage, type ApprovedAssumption, type ArgvRagContextProviderOptions, type ArtifactBinding, type ArtifactEnvelope, type ArtifactEnvelopeInput, type ArtifactType, type ArtificialAnalysisModel, type AssuranceLevel, type AutomationStatus, type AutonomyMode, BENCHMARK_SCHEMA_VERSION, BLOCK_STATUSES, type BenchmarkBinding, type BenchmarkComparison, type BenchmarkImprovementDirection, type BenchmarkManifest, type BenchmarkObservation, type BenchmarkObservationEvidence, type BenchmarkObservationInput, type BenchmarkObservationStatus, type BenchmarkReport, type BenchmarkRun, type BenchmarkSummary, type BenchmarkTask, type BlockAssessment, type BlockManifest, type BlockStatus, CAPABILITY_KINDS, CAPABILITY_MANIFEST_SCHEMA_VERSION, CHECK_CATEGORIES, COMPATIBILITY_COMPONENTS, COMPATIBILITY_SCHEMA_VERSION, CONTEXT_PROVIDER_SLOT, CONTRACT_CLOSE, CONTRACT_OPEN, CONTRACT_SCHEMA_VERSION, type CacheUsage, type CapabilityDescriptor, type CapabilityKind, type CapabilityManifest, type CapabilityManifestInput, type CatalogModel, type ChangedFile, type CheckCategory, type CheckOutcome, type CheckResult, type ChecksAssessment, type ClaimResult, type CodeReviewInput, type CodeReviewOutcome, type CodingAgentAdapter, type CodingAgentHandlerResult, type CodingAgentRequest, type CodingAgentResult, type CommandResult, type CommandRunOptions, type CommandRunner, type CompatibilityComponent, type CompatibilityComponentId, type CompatibilityManifest, type CompatibilityObservation, type CompatibilityReport, type CompatibilityStatus, type ContextProvider, type ContextQuery, type ContextReference, type ContextSnapshot, type ContractAssessment, type ContractOutcome, ContractOutcomeSchema, type ContractScope, type CooldownEntry, type CooldownState, type CoordinationIdentity, type CriterionStatus, type CycleIterationMetrics, type CycleMatrixRow, type CycleStepResult, type CycleStepStatus, type DebriefInput, type DebriefIssueRow, type DebriefReport, type DecisionPacket, type DeliverInput, type DeliverOutcome, type DeliverReport, type DeliverResult, type DeliveryState, type DetectProvidersInput, type DiscoveryAmbiguity, type DiscoveryCurrentInput, type DiscoveryCurrentResult, type DiscoveryDecisionLogEntry, type DiscoveryInput, type DiscoveryOption, type DiscoveryResult, type DispatchLease, type DispatchLedger, type DispatchRecord, type DispatchRecordFile, type Disposer, type DocBridgeIndexInspection, type DockerMount, type DockerRuntimeEvidence, type DockerToolDefinition, type DoctorCheck, type DoctorCheckStatus, EVAL_COMPONENTS, EVAL_LAYERS, EVAL_MANIFEST_SCHEMA_VERSION, EVENT_LOG_GENESIS, EVIDENCE_BUNDLE_SCHEMA_VERSION, type EffortLevel, type EvalBatteryReport, type EvalCaseDefinition, type EvalCaseReport, type EvalComponent, type EvalExpectation, type EvalLayer, type EvalManifest, type EvalObservation, type EvalObservationStatus, type EventLogLock, type EventLogLockRecovery, type EventLogLockStatus, type EventLogVerification, type EventStore, type EvidenceArtifact, type EvidenceBundle, type EvidenceBundleFile, type EvidenceBundleSignature, type EvidenceBundleVerification, type EvidenceReference, type ExecutePhaseProfileOptions, type FailureClass, type FailureClassification, type FetchQueueInput, FileArtifactStore, FileEventStore, type FilePreflightPlan, type GateAssessment, type GateBinding, type GateCriterion, type GenerateContractInput, type GitHubCliOptions, type GuidedInstallIO, type GuidedInstallInput, type GuidedInstallReport, HARNESS_ERROR_CATALOG, HARNESS_ERROR_CODES, HARNESS_EVENT_ENVELOPE_SCHEMA_VERSION, HARNESS_EVENT_SCHEMA_VERSION, HARNESS_EVENT_TYPES, HARNESS_PLUGIN_API_VERSION, HARNESS_REPO_URL, type HandoffBriefInput, HarnessError, type HarnessErrorClassification, type HarnessErrorDisposition, type HarnessEvent, type HarnessEventContext, type HarnessEventEnvelope, type HarnessEventEnvelopeInput, type HarnessEventInput, type HarnessEventListener, type HarnessEventPayloads, type HarnessEventProvenance, type HarnessEventType, type HarnessPlugin, type HarnessPluginContext, IMPROVEMENT_CYCLE_STEPS, type ImprovementCycleAssessment, type ImprovementCycleInput, type ImprovementCycleIteration, type ImprovementCycleStep, type InstallAction, type InstallInput, type InstallReport, type IntakeRecord, type IssueFailureRecord, type IssueFailureState, LEARNING_STATUSES, LEGAL_TRANSITIONS, LOOP_CONFIG_FILE, LOOP_CONFIG_SCHEMA_VERSION, LOOP_LOCAL_CONFIG_FILE, LOOP_STAGES, type LearningRecord, type LearningStatus, type LearningsLedger, type LinearIssueDetail, type LinearListInput, type LinearQueueFilter, type LinearWriteOptions, type LlmCache, type LlmCacheKeyInput, type LlmCacheStats, type LoadedConfig, type LoadedLoopConfig, type LocalConfigAnswers, type LocalConfigPrompter, type LoopConfig, type LoopConfigInput, LoopConfigSchema, type LoopDoctorInput, type LoopDoctorReport, type LoopEvent, type LoopEventBus, type LoopEventListener, type LoopEventPayload, type LoopHookListener, type LoopHookName, type LoopHookPayload, type LoopHookResult, type LoopIssue, type LoopPluginModule, type LoopProviderConfig, type LoopStage, type LoopStageName, type LoopState, type LoopStatusReport, MEMORY_SCOPES, MODEL_ROLES, type MachineMetrics, type MachineSample, type MachineThresholds, type McpPolicy, type McpToolBridge, type McpToolBridgeOptions, type McpToolCallInput, type McpToolCallResult, type MemoryContextPlan, type MemoryPromptSelection, type MemoryScope, type MemoryUsage, type MetricStatus, type ModelBinding, type ModelPolicy, type ModelQuality, type ModelReference, type ModelRole, type NormalizedPhaseProfile, type ObservabilityAnomaly, type ObservabilityMetrics, type ObservabilityReport, type ObservabilitySeverity, type ObservabilitySnapshot, type ObservabilityTerminal, type OptimizationComparison, type OptimizationObservation, type OrcaAgentHookState, type OrcaAutomation, type OrcaAutomationSpec, type OrcaCliOptions, type OrcaCreatedWorktree, type OrcaDispatchInput, type OrcaDispatchPlan, type OrcaLeaseState, type OrcaLifecycleInput, type OrcaLifecycleProjection, type OrcaStatus as OrcaRuntimeStatus, type OrcaSendReceipt, type OrcaTerminal, type OrcaWorktree, type OutcomeProgress, type OutcomeProgressStatus, PHASE_DECISIONS, PHASE_EFFECTS, PHASE_EFFECT_ACTIONS, PHASE_MODES, PR_FIELDS, type ParallelismUsage, type PhaseAmbiguity, type PhaseContext, type PhaseDecision, type PhaseDecisionPacket, type PhaseDefinition, type PhaseEffect, type PhaseEffectAction, type PhaseEffectPolicy, type PhaseExecution, type PhaseExecutionReport, type PhaseGateEvaluator, type PhaseGateResult, type PhaseHandler, type PhaseHandlerResult, type PhaseMachineMetrics, type PhaseMode, type PhasePreflight, type PhasePreflightResult, type PhaseProfile, type PhaseResumeState, type PhaseRetryPolicy, type PhaseRoutePlan, type PhaseTelemetry, type PhaseTokenMetrics, type PiiKind, type PiiMatch, type PiiScanResult, type PilotAssessment, type PilotEntry, type PilotManifest, type PinnedSkill, type PinnedSkillRef, type PluginContribution, type PluginRegistry, type PluginSlot, type PolicyDecision, type PolicyGate, type PolicyRequest, type PolicyRule, type ProcessToolDefinition, type ProductionEvidence, type ProviderAuthStatus, type ProviderAvailability, type ProviderCatalog, type ProviderFailure, type ProviderSpec, type ProviderUsage, type PullRequestApproval, type PullRequestCheck, type PullRequestDraft, type PullRequestSnapshot, QUALITY_DIMENSIONS, type QaTransitionAssessment, type QualityDimension, type QualityDimensionScore, type QualityMatrix, REVIEW_SEVERITIES, RUN_STATES, type RagContextProviderOptions, type RagQueryResult, type RankedModel, type RecoveryObservation, type RecoveryPolicy, type RecoveryResult, type RepositoryProfile, type ResolvedAgent, type RetroInput, type RetroIssueRow, type RetroReport, type RetroStageReport, type RetroSuggestion, type RetroTarget, type RetroWindow, type ReviewFinding, type ReviewLens, type ReviewSeverity, type ReviewVerdict, type RichIO, type RoutingDecision, type RoutingSkip, type RunOutcome, type RunReconciliation, type RunState, type RuntimeConfig, type RuntimeExperimentCandidate, type RuntimeExperimentResult, STATES, SURFACE_NAMES, type SessionRecorder, type SlotAssessment, type SlotInput, type SourceSnapshot, type StagePauseEntry, type StagePauseState, type StateTransition, type StatusBlock, type StatusSnapshot, type StoredContract, type StructuredEvidence, type SurfaceName, type SurfaceRequirement, type TaskContract, TaskContractSchema, type TeamMember, type TickCandidateResult, type TickInput, type TickOutcome, type TickReport, type TokenUsage, type ToolDefinition, type ToolExecutionRequest, type ToolExecutionResult, type ToolRuntime, type TrackingAdapter, type TrackingConfig, type TrackingTransition, type TrustedEvidenceKey, type UsageMetric, type UsageWindow, type VerificationCheck, type VerificationConfig, type VerificationRun, WIP_STATES, type WatchEvent, type WatchEventKind, type WatchInput, type WatchReport, type WatchTargetSnapshot, type WatchdogBlocker, type WatchdogBudget, type WatchdogResult, type WipAssessment, type WipAssessmentInput, type WipEntry, type WipState, type WorkerBriefInput, type WorkflowNode, type WorkflowResult, activeCooldowns, adaptiveConcurrency, advanceQueueOwner, appendLoopEvent, approveRun, approvedDecision, artifactDigest, artifactFilePath, artifactIsFresh, artifactMarkdownPath, assertHuman, assessAcceptance, assessAgentEval, assessBlock, assessChecks, assessCompatibility, assessContract, assessDiscovery, assessImprovementCycle, assessIntegration, assessObservability, assessPilot, assessPreflight, assessProduction, assessQaTransition, assessSlots, assessWip, assessWorktreeCleanup, atLeast, authStatusFor, authorizeRun, automationName, automationPrompt, automationSpecs, availableMemoryBytes, benchmarkRuns, branchFor, briefPath, buildDebriefReport, buildListIssuesArgv, buildRetroReport, buildReviewArgv, buildSuggestions, busyIssues, cancelRun, classifyFailure, classifyHarnessError, classifyProviderFailure, classifyWatchEvent, classifyWatchPhase, cleanTaskArtifacts, clearIssueFailures, clearProviderCooldown, compareOptimization, compareVersions, composePullRequest, contractIsFresh, contractPath, cooldownPath, cooldownUntil, countRotationBlockingLeases, countRunningWorkers, createArgvRagContextProvider, createArtifactEnvelope, createCapabilityManifest, createCodingAgentAdapter, createCompatibilityManifest, createConfiguredToolRuntime, createDispatchLedger, createDocBridgeContextProvider, createDockerToolRuntime, createEvalManifest, createFileMemoryAdapter, createFileMemoryKvStore, createHarnessEventEnvelope, createInMemoryMemoryAdapter, createKvMemoryAdapter, createLinearTrackingAdapter, createLlmCache, createLlmCacheKey, createLoopEventBus, createMachineMonitor, createMcpToolBridge, createModelPolicy, createOrcaDispatchPlan, createOrcaLifecycleProjection, createPhaseArtifact, createPhaseProfile, createPluginRegistry, createPluginSlot, createPolicyGate, createProcessRunner, createProcessToolRuntime, createPullRequestApproval, createQualityMatrix, createRagContextProvider, createRichIO, createSessionRecorder, createStatusSnapshot, createToolRuntime, createTrackingAdapter, createTrackingTransition, deliveryStatePath, detectProviders, discoverIntake, dispatchRecordPath, evaluateWatchdog, executePhaseProfile, exportEvidenceBundle, extractResetsAt, fetchArtificialAnalysisModels, fetchLinearIssue, fetchLinearQueue, fetchTeamMembers, filterAndOrderQueue, findExecutable, formatWatchEvent, gatherLoopState, generateContract, githubComment, githubCommentArgv, githubCommentExists, githubLabelRemove, githubMerge, githubMergeArgv, githubOpenPullRequests, githubPullRequest, githubPullRequestsForBranch, hasLocalConfig, hashContextSnapshot, hashContextSnapshots, hashMcpArgs, inspectDocBridgeIndex, inspectEventLogLock, installLoopAutomations, installPreflight, intakeIssueId, intakePath, isDiscoveryCurrent, isIssuePaused, isStagePaused, isWsl, issueFailurePath, launchWorkerTerminal, learningToMemoryRecord, learningsPath, linearAttach, linearAttachArgv, linearCommentAdd, linearCommentAddArgv, linearLabelAdd, linearLabelArgv, linearLabelRemove, linearStatusSet, linearStatusSetArgv, listCliModels, listCliModelsCached, listDispatched, listIntake, listPausedIssues, loadAgentRegistry, loadAliases, loadBenchmarkManifest, loadBuiltinCatalog, loadConfig, loadLatestRun, loadLoopConfig, loadLoopPlugins, loadPinnedSkills, localConfigPath, loopStatus, markProviderExhausted, memoryDigestOf, mergeLoopConfig, modelFor, normalizeReason, openLoopMemory, orcaAccountList, orcaAgentHooks, orcaAutomationCreateArgv, orcaAutomationEditArgv, orcaAutomationRemove, orcaAutomationRun, orcaAutomationRuns, orcaAutomationsList, orcaJson, orcaStatus, orcaTerminalCreate, orcaTerminalList, orcaTerminalScreen, orcaTerminalSend, orcaTerminalWait, orcaVersion, orcaWorktreeCreate, orcaWorktreeRemove, orcaWorktreeSet, orcaWorktreeSetArgv, orcaWorktrees, parseAgentRegistryText, parseArtificialAnalysisPayload, parseAutomationRuns, parseContractOutput, parseGrokModelsOutput, parseJsonEnvelope, parseLinearIssueDetail, parseLinearIssues, parseLoopConfigText, parseMemInfo, parseModelRef, parseOrcaAgentHooks, parseOrcaAutomations, parseOrcaSendReceipt, parseOrcaStatus, parseOrcaTerminals, parseOrcaVersion, parseOrcaWorktreeCreate, parseOrcaWorktrees, parseProviderUsage, parsePullRequest, parseRagQueryOutput, parseRetro, parseReviewResult, parseSince, parseTeamMembers, parseUsageWindows, parseVmStat, pauseIssue, planFilePreflight, planMemoryContext, planPhaseProfile, planRun, precheckCommand, precheckDeliver, precheckTick, preferMemoryOverDocBridge, promoteLearnings, promoteLearningsToMemory, promptLocalConfig, providerIdentity, providerSpecs, queueOwner, rankModels, readAaCache, readArtifactFile, readCliModelsCache, readContextSnapshots, readCooldowns, readDeliveryState, readDispatchRecord, readEvidenceTrustStore, readIntake, readIssueFailures, readLearningsLedger, readLoopEvents, readOutcomeProgress, readStagePause, readStoredContract, reconcileRun, recordBenchmarkObservation, recordIssueFailure, recordStageRunResult, recoverEventLogLock, recoveryDelayMs, remainingUsagePercent, renderArtifactMarkdown, renderContractPrompt, renderDebriefMarkdown, renderFindingsForWorker, renderHandoffBrief, renderHeadlessArgv, renderLocalConfig, renderObservabilityMarkdown, renderPinnedSkills, renderRetroMarkdown, renderTuiCommand, renderWorkerBrief, resolveAgentForRole, resolveAlias, resolveCatalogCandidates, resolveDocContext, resumeIssue, resumeStage, resumeStateFromArtifacts, retroLearnings, retryRun, rotationStatePath, routeAllRoles, runAdversarialReview, runAgentEval, runCodeReview, runDeliver, runEvalBattery, runGuidedInstall, runLoopDoctor, runObservability, runRetroStage, runTick, runWithRecovery, runWorkflow, sampleMachine, scanForPii, selectMemoryForPrompt, selectModel, selectRuntime, severityRank, shellQuote, skillDigest, skillRefs, snapshotWatchTargets, stageEntry, stagePausePath, startRun, summarizeMachine, tiersFor, touchesProtectedPaths, transition, undeclaredOrcaProviders, uninstallLoopAutomations, unknownTelemetry, untrusted, upsertProposedLearnings, usageRankTuple, validateAdapterMetadata, validateArtifactEnvelope, validateBenchmarkManifest, validateBlockManifest, validateCacheableOperation, validateCapabilityManifest, validateCompatibilityManifest, validateConfig, validateContextSnapshot, validateContextSnapshots, validateEvalManifest, validateHarnessErrorClassification, validateHarnessEventEnvelope, validateLoopConfig, validateMemoryRecord, validateOptimizationObservation, validatePhaseTelemetry, validateSafeCommand, validateStatusSnapshot, verifyEvidenceBundle, verifyPullRequestApproval, verifyRun, watchDeliveries, worktreeNameFor, writeAaCache, writeCliModelsCache, writeDispatchRecord, writeIdFor, writeLearningsLedger, writeLocalConfig, writeStoredContract };