@agentskit/harness 0.5.0 → 0.6.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
@@ -735,8 +735,121 @@ interface DocBridgeContextProviderOptions {
735
735
  readonly root: string;
736
736
  readonly indexPath?: string;
737
737
  }
738
+ interface DocBridgeIndexInspection {
739
+ readonly present: boolean;
740
+ readonly path: string;
741
+ readonly contentHash: string | null;
742
+ readonly mtimeMs: number | null;
743
+ readonly ageHours: number | null;
744
+ readonly error: string | null;
745
+ }
746
+ /** Read-only inspection for doctor freshness checks (no network, no rebuild). */
747
+ declare const inspectDocBridgeIndex: (root: string, indexPath?: string, now?: number) => DocBridgeIndexInspection;
738
748
  declare const createDocBridgeContextProvider: ({ root, indexPath }: DocBridgeContextProviderOptions) => ContextProvider;
739
749
 
750
+ interface CommandResult {
751
+ readonly code: number | null;
752
+ readonly stdout: string;
753
+ readonly stderr: string;
754
+ readonly timedOut: boolean;
755
+ readonly durationMs: number;
756
+ }
757
+ interface CommandRunOptions {
758
+ readonly timeoutMs?: number;
759
+ readonly cwd?: string;
760
+ readonly env?: NodeJS.ProcessEnv;
761
+ }
762
+ /** Shell-free command execution seam. Adapters receive it; composition supplies the real one; tests supply fakes. */
763
+ interface CommandRunner {
764
+ run(argv: readonly string[], options?: CommandRunOptions): Promise<CommandResult>;
765
+ }
766
+ /** Resolve an executable on PATH without spawning a shell. Honours PATHEXT on Windows. */
767
+ declare const findExecutable: (name: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform) => string | null;
768
+ /** Parse the `{ ok, result }` envelope every `orca … --json` command prints. Returns null when the payload is not an envelope. */
769
+ declare const parseJsonEnvelope: (stdout: string) => {
770
+ readonly ok: boolean;
771
+ readonly result: unknown;
772
+ readonly error?: string;
773
+ } | null;
774
+
775
+ interface RagQueryResult {
776
+ readonly references: readonly ContextReference[];
777
+ readonly sourceHash: string;
778
+ }
779
+ interface RagContextProviderOptions {
780
+ /** Injected query function — callers wire `@agentskit/rag` (or any store) here; this package never imports it. */
781
+ readonly query: (query: ContextQuery) => Promise<RagQueryResult>;
782
+ }
783
+ interface ArgvRagContextProviderOptions {
784
+ readonly runner: CommandRunner;
785
+ /** Argv template; `{query}` and `{scope}` (JSON array) are substituted per element. */
786
+ readonly argv: readonly string[];
787
+ readonly timeoutMs?: number;
788
+ readonly cwd?: string;
789
+ }
790
+ /** Accept either a ContextSnapshot-shaped object or `{ references, sourceHash }`. Fail closed on anything else. */
791
+ declare const parseRagQueryOutput: (value: unknown) => RagQueryResult;
792
+ /** ContextProvider over an injected RAG query function. No static dependency on `@agentskit/rag`. */
793
+ declare const createRagContextProvider: ({ query }: RagContextProviderOptions) => ContextProvider;
794
+ /** ContextProvider that runs argv and parses stdout JSON as a ContextSnapshot or `{ references, sourceHash }`. */
795
+ declare const createArgvRagContextProvider: ({ runner, argv, timeoutMs, cwd }: ArgvRagContextProviderOptions) => ContextProvider;
796
+
797
+ interface PolicyRule {
798
+ readonly id: string;
799
+ readonly effect: 'allow' | 'block' | 'approve';
800
+ readonly toolIds: readonly string[];
801
+ readonly reason: string;
802
+ }
803
+ interface PolicyRequest {
804
+ readonly actionId: string;
805
+ readonly turnId: string;
806
+ readonly toolId: string;
807
+ readonly argumentsHash: string;
808
+ }
809
+ interface PolicyDecision {
810
+ readonly decision: 'allow' | 'block' | 'approve';
811
+ readonly policyId: string;
812
+ readonly reason: string;
813
+ }
814
+ interface PolicyGate {
815
+ evaluate(request: PolicyRequest): PolicyDecision;
816
+ }
817
+ declare const createPolicyGate: ({ rules }: {
818
+ readonly rules: readonly PolicyRule[];
819
+ }) => PolicyGate;
820
+
821
+ type McpPolicy = PolicyGate | {
822
+ readonly evaluate: (request: PolicyRequest) => PolicyDecision;
823
+ };
824
+ interface McpToolBridgeOptions {
825
+ readonly policy: McpPolicy;
826
+ readonly allowTools: readonly string[];
827
+ readonly call: (toolId: string, argsHash: string, args: unknown) => Promise<unknown>;
828
+ }
829
+ type McpToolCallResult = {
830
+ readonly status: 'ok';
831
+ readonly result: unknown;
832
+ } | {
833
+ readonly status: 'blocked';
834
+ readonly reason: string;
835
+ };
836
+ interface McpToolCallInput {
837
+ readonly toolId: string;
838
+ readonly args?: unknown;
839
+ readonly argsHash?: string;
840
+ readonly actionId?: string;
841
+ readonly turnId?: string;
842
+ }
843
+ interface McpToolBridge {
844
+ readonly invoke: (input: McpToolCallInput) => Promise<McpToolCallResult>;
845
+ }
846
+ declare const hashMcpArgs: (args: unknown) => string;
847
+ /**
848
+ * Adapter-only MCP tool bridge: default-deny allowlist + policy gate before any call.
849
+ * Not wired into loop tick/deliver in 0.6.0 (see ADR-0028).
850
+ */
851
+ declare const createMcpToolBridge: ({ policy, allowTools, call }: McpToolBridgeOptions) => McpToolBridge;
852
+
740
853
  interface DiscoveryOption {
741
854
  readonly id: string;
742
855
  readonly summary: string;
@@ -1832,30 +1945,6 @@ declare const loadBenchmarkManifest: (path: string) => BenchmarkManifest;
1832
1945
  declare const recordBenchmarkObservation: (path: string, input: BenchmarkObservationInput) => BenchmarkManifest;
1833
1946
  declare const benchmarkRuns: (stateDir: string, manifest?: BenchmarkManifest) => BenchmarkReport;
1834
1947
 
1835
- interface PolicyRule {
1836
- readonly id: string;
1837
- readonly effect: 'allow' | 'block' | 'approve';
1838
- readonly toolIds: readonly string[];
1839
- readonly reason: string;
1840
- }
1841
- interface PolicyRequest {
1842
- readonly actionId: string;
1843
- readonly turnId: string;
1844
- readonly toolId: string;
1845
- readonly argumentsHash: string;
1846
- }
1847
- interface PolicyDecision {
1848
- readonly decision: 'allow' | 'block' | 'approve';
1849
- readonly policyId: string;
1850
- readonly reason: string;
1851
- }
1852
- interface PolicyGate {
1853
- evaluate(request: PolicyRequest): PolicyDecision;
1854
- }
1855
- declare const createPolicyGate: ({ rules }: {
1856
- readonly rules: readonly PolicyRule[];
1857
- }) => PolicyGate;
1858
-
1859
1948
  interface AgentAdapter {
1860
1949
  readonly id: string;
1861
1950
  readonly version: string;
@@ -2195,31 +2284,6 @@ declare const verifyEvidenceBundle: (path: string, { trustedKeys }?: {
2195
2284
  }) => EvidenceBundleVerification;
2196
2285
  declare const readEvidenceTrustStore: (path: string) => readonly TrustedEvidenceKey[];
2197
2286
 
2198
- interface CommandResult {
2199
- readonly code: number | null;
2200
- readonly stdout: string;
2201
- readonly stderr: string;
2202
- readonly timedOut: boolean;
2203
- readonly durationMs: number;
2204
- }
2205
- interface CommandRunOptions {
2206
- readonly timeoutMs?: number;
2207
- readonly cwd?: string;
2208
- readonly env?: NodeJS.ProcessEnv;
2209
- }
2210
- /** Shell-free command execution seam. Adapters receive it; composition supplies the real one; tests supply fakes. */
2211
- interface CommandRunner {
2212
- run(argv: readonly string[], options?: CommandRunOptions): Promise<CommandResult>;
2213
- }
2214
- /** Resolve an executable on PATH without spawning a shell. Honours PATHEXT on Windows. */
2215
- declare const findExecutable: (name: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform) => string | null;
2216
- /** Parse the `{ ok, result }` envelope every `orca … --json` command prints. Returns null when the payload is not an envelope. */
2217
- declare const parseJsonEnvelope: (stdout: string) => {
2218
- readonly ok: boolean;
2219
- readonly result: unknown;
2220
- readonly error?: string;
2221
- } | null;
2222
-
2223
2287
  interface OrcaCliOptions {
2224
2288
  readonly bin?: string;
2225
2289
  readonly timeoutMs?: number;
@@ -2636,6 +2700,10 @@ declare const LoopConfigSchema: z.ZodObject<{
2636
2700
  deadlineMs: z.ZodDefault<z.ZodNumber>;
2637
2701
  maxCalls: z.ZodDefault<z.ZodNumber>;
2638
2702
  post: z.ZodDefault<z.ZodBoolean>;
2703
+ doctorProbe: z.ZodDefault<z.ZodEnum<{
2704
+ none: "none";
2705
+ help: "help";
2706
+ }>>;
2639
2707
  }, z.core.$strip>>;
2640
2708
  merge: z.ZodPrefault<z.ZodObject<{
2641
2709
  auto: z.ZodDefault<z.ZodBoolean>;
@@ -2646,6 +2714,26 @@ declare const LoopConfigSchema: z.ZodObject<{
2646
2714
  }>>;
2647
2715
  requireChecks: z.ZodDefault<z.ZodBoolean>;
2648
2716
  }, z.core.$strip>>;
2717
+ smoke: z.ZodPrefault<z.ZodObject<{
2718
+ enabled: z.ZodDefault<z.ZodBoolean>;
2719
+ kind: z.ZodDefault<z.ZodEnum<{
2720
+ none: "none";
2721
+ "verify-argv": "verify-argv";
2722
+ }>>;
2723
+ argv: z.ZodDefault<z.ZodArray<z.ZodString>>;
2724
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
2725
+ }, z.core.$strip>>;
2726
+ verify: z.ZodPrefault<z.ZodObject<{
2727
+ runtime: z.ZodDefault<z.ZodEnum<{
2728
+ docker: "docker";
2729
+ process: "process";
2730
+ }>>;
2731
+ argv: z.ZodDefault<z.ZodArray<z.ZodString>>;
2732
+ docker: z.ZodPrefault<z.ZodObject<{
2733
+ image: z.ZodDefault<z.ZodString>;
2734
+ cwd: z.ZodDefault<z.ZodString>;
2735
+ }, z.core.$strip>>;
2736
+ }, z.core.$strip>>;
2649
2737
  maxFixRounds: z.ZodDefault<z.ZodNumber>;
2650
2738
  workerIdleTimeoutMin: z.ZodDefault<z.ZodNumber>;
2651
2739
  selfEditPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -2659,10 +2747,62 @@ declare const LoopConfigSchema: z.ZodObject<{
2659
2747
  timeoutMs: z.ZodDefault<z.ZodNumber>;
2660
2748
  maxContextReferences: z.ZodDefault<z.ZodNumber>;
2661
2749
  reuseHours: z.ZodDefault<z.ZodNumber>;
2750
+ docBridgeMaxAgeHours: z.ZodDefault<z.ZodNumber>;
2751
+ requireDocBridge: z.ZodDefault<z.ZodBoolean>;
2752
+ briefScopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
2753
+ maxBriefReferences: z.ZodDefault<z.ZodNumber>;
2754
+ contextProviders: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2755
+ "doc-bridge": "doc-bridge";
2756
+ rag: "rag";
2757
+ }>>>;
2758
+ }, z.core.$strip>>;
2759
+ memory: z.ZodPrefault<z.ZodObject<{
2760
+ enabled: z.ZodDefault<z.ZodBoolean>;
2761
+ backend: z.ZodDefault<z.ZodEnum<{
2762
+ none: "none";
2763
+ file: "file";
2764
+ }>>;
2765
+ storePath: z.ZodDefault<z.ZodString>;
2766
+ maxRecall: z.ZodDefault<z.ZodNumber>;
2767
+ maxSummaryChars: z.ZodDefault<z.ZodNumber>;
2768
+ maxBlockChars: z.ZodDefault<z.ZodNumber>;
2769
+ preferOverDocBridge: z.ZodDefault<z.ZodBoolean>;
2770
+ minDocBridgeWhenMemory: z.ZodDefault<z.ZodNumber>;
2771
+ scopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2772
+ project: "project";
2773
+ issue: "issue";
2774
+ global: "global";
2775
+ }>>>;
2776
+ includeStale: z.ZodDefault<z.ZodBoolean>;
2777
+ writeOnPromote: z.ZodDefault<z.ZodBoolean>;
2778
+ categories: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2779
+ adjustment: "adjustment";
2780
+ worked: "worked";
2781
+ problem: "problem";
2782
+ other: "other";
2783
+ }>>>;
2784
+ shrinkIssueCharsWhenMemory: z.ZodDefault<z.ZodBoolean>;
2785
+ issueCharsWithMemory: z.ZodDefault<z.ZodNumber>;
2786
+ }, z.core.$strip>>;
2787
+ agents: z.ZodPrefault<z.ZodObject<{
2788
+ registryPath: z.ZodDefault<z.ZodString>;
2789
+ requireRegistry: z.ZodDefault<z.ZodBoolean>;
2790
+ }, z.core.$strip>>;
2791
+ rag: z.ZodPrefault<z.ZodObject<{
2792
+ enabled: z.ZodDefault<z.ZodBoolean>;
2793
+ queryArgv: z.ZodDefault<z.ZodArray<z.ZodString>>;
2794
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
2795
+ maxReferences: z.ZodDefault<z.ZodNumber>;
2796
+ }, z.core.$strip>>;
2797
+ mcp: z.ZodPrefault<z.ZodObject<{
2798
+ enabled: z.ZodDefault<z.ZodBoolean>;
2799
+ allowTools: z.ZodDefault<z.ZodArray<z.ZodString>>;
2662
2800
  }, z.core.$strip>>;
2663
2801
  schedule: z.ZodPrefault<z.ZodObject<{
2664
2802
  tick: z.ZodDefault<z.ZodString>;
2665
2803
  deliver: z.ZodDefault<z.ZodString>;
2804
+ retro: z.ZodOptional<z.ZodString>;
2805
+ retroIssue: z.ZodOptional<z.ZodString>;
2666
2806
  precheckTimeoutSec: z.ZodDefault<z.ZodNumber>;
2667
2807
  harnessCommand: z.ZodDefault<z.ZodString>;
2668
2808
  provider: z.ZodOptional<z.ZodString>;
@@ -2708,6 +2848,42 @@ declare const renderTuiCommand: (settings: LoopProviderConfig, model: string) =>
2708
2848
  /** Substitute `{model}` / `{prompt}` inside each headless argv element; the prompt stays one argv element, never shell-joined. */
2709
2849
  declare const renderHeadlessArgv: (settings: LoopProviderConfig, model: string, prompt: string) => readonly string[] | null;
2710
2850
 
2851
+ declare const AGENT_REGISTRY_SCHEMA_VERSION: 1;
2852
+ declare const AgentRegistryEntrySchema: z.ZodObject<{
2853
+ role: z.ZodOptional<z.ZodString>;
2854
+ provider: z.ZodString;
2855
+ model: z.ZodOptional<z.ZodString>;
2856
+ tui: z.ZodOptional<z.ZodString>;
2857
+ headless: z.ZodOptional<z.ZodArray<z.ZodString>>;
2858
+ }, z.core.$strip>;
2859
+ declare const AgentRegistrySchema: z.ZodObject<{
2860
+ schemaVersion: z.ZodLiteral<1>;
2861
+ agents: z.ZodRecord<z.ZodString, z.ZodObject<{
2862
+ role: z.ZodOptional<z.ZodString>;
2863
+ provider: z.ZodString;
2864
+ model: z.ZodOptional<z.ZodString>;
2865
+ tui: z.ZodOptional<z.ZodString>;
2866
+ headless: z.ZodOptional<z.ZodArray<z.ZodString>>;
2867
+ }, z.core.$strip>>;
2868
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2869
+ }, z.core.$strip>;
2870
+ type AgentRegistryEntry = z.output<typeof AgentRegistryEntrySchema>;
2871
+ type AgentRegistry = z.output<typeof AgentRegistrySchema>;
2872
+ interface ResolvedAgent {
2873
+ readonly agentId: string;
2874
+ readonly entry: AgentRegistryEntry;
2875
+ readonly role: string;
2876
+ }
2877
+ /** Parse and validate an agents.registry.yaml document. Fail closed on schema drift. */
2878
+ declare const parseAgentRegistryText: (text: string, label?: string) => AgentRegistry;
2879
+ /** Load agents.registry.yaml from disk. Missing file fails closed. */
2880
+ declare const loadAgentRegistry: (path: string) => AgentRegistry;
2881
+ /**
2882
+ * Resolve a role to a registry agent. Prefer `roles[role]` → `agents[id]`, else the first agent
2883
+ * whose `role` field matches. Fail closed when neither mapping exists.
2884
+ */
2885
+ declare const resolveAgentForRole: (registry: AgentRegistry, role: string) => ResolvedAgent;
2886
+
2711
2887
  /** Real, shell-free command runner for the loop composition layer. Output is capped; timeouts kill the process group. */
2712
2888
  declare const createProcessRunner: (defaults?: {
2713
2889
  readonly timeoutMs?: number;
@@ -2928,6 +3104,70 @@ declare const githubCommentExists: (runner: CommandRunner, input: {
2928
3104
  readonly marker: string;
2929
3105
  }, options?: GitHubCliOptions) => Promise<boolean>;
2930
3106
 
3107
+ interface MemoryPromptSelection {
3108
+ readonly hits: readonly AgentMemoryHit[];
3109
+ readonly block: string;
3110
+ readonly approxChars: number;
3111
+ }
3112
+ interface MemoryContextPlan {
3113
+ readonly hits: readonly AgentMemoryHit[];
3114
+ readonly references: readonly ContextReference[];
3115
+ readonly memoryBlock: string;
3116
+ readonly issueCharBudget: number;
3117
+ readonly approxCharsSaved: number;
3118
+ readonly memoryDigest: string;
3119
+ readonly docBridgeBefore: number;
3120
+ readonly docBridgeAfter: number;
3121
+ }
3122
+ /** Atomic JSON file KV under `dir` (index + one file per record). */
3123
+ declare const createFileMemoryKvStore: (dir: string) => AgentMemoryKvStore;
3124
+ declare const createFileMemoryAdapter: (dir: string, options?: {
3125
+ readonly id?: string;
3126
+ readonly version?: string;
3127
+ }) => AgentMemoryAdapter;
3128
+ declare const openLoopMemory: (loaded: LoadedLoopConfig) => AgentMemoryAdapter | null;
3129
+ declare const memoryDigestOf: (hits: readonly AgentMemoryHit[]) => string;
3130
+ /** Cap, filter stale/scope, and render a bounded “Approved memory” markdown block. */
3131
+ declare const selectMemoryForPrompt: (hits: readonly AgentMemoryHit[], config: LoopConfig["memory"]) => MemoryPromptSelection;
3132
+ /** Prefer memory over Doc Bridge so adding memory reduces (not increases) prompt size. */
3133
+ declare const preferMemoryOverDocBridge: (references: readonly ContextReference[], hits: readonly AgentMemoryHit[], minKeep: number) => {
3134
+ readonly references: readonly ContextReference[];
3135
+ readonly dropped: number;
3136
+ };
3137
+ declare const planMemoryContext: (input: {
3138
+ readonly adapter: AgentMemoryAdapter | null;
3139
+ readonly config: LoopConfig;
3140
+ readonly issueId: string;
3141
+ readonly issueTitle: string;
3142
+ readonly project: string;
3143
+ readonly references: readonly ContextReference[];
3144
+ readonly sourceRevision?: string;
3145
+ }) => Promise<MemoryContextPlan>;
3146
+ declare const learningToMemoryRecord: (learning: LearningRecord, meta: {
3147
+ readonly project: string;
3148
+ readonly sourceRevision: string;
3149
+ readonly scope?: MemoryScope;
3150
+ }) => AgentMemoryRecord;
3151
+ interface LearningsLedger {
3152
+ readonly records: readonly LearningRecord[];
3153
+ }
3154
+ declare const learningsPath: (stateDir: string) => string;
3155
+ declare const readLearningsLedger: (stateDir: string) => LearningsLedger;
3156
+ declare const writeLearningsLedger: (stateDir: string, ledger: LearningsLedger) => void;
3157
+ /** Merge proposed learnings into the ledger without changing promoted/rejected rows. */
3158
+ declare const upsertProposedLearnings: (stateDir: string, proposed: readonly LearningRecord[]) => LearningsLedger;
3159
+ declare const promoteLearningsToMemory: (input: {
3160
+ readonly stateDir: string;
3161
+ readonly config: LoopConfig;
3162
+ readonly adapter: AgentMemoryAdapter | null;
3163
+ readonly ids: readonly string[];
3164
+ readonly actor: string;
3165
+ readonly sourceRevision: string;
3166
+ }) => Promise<{
3167
+ readonly ledger: LearningsLedger;
3168
+ readonly remembered: readonly string[];
3169
+ }>;
3170
+
2931
3171
  declare const CONTRACT_SCHEMA_VERSION = 1;
2932
3172
  declare const CONTRACT_OPEN = "<<<LOOP_CONTRACT";
2933
3173
  declare const CONTRACT_CLOSE = "LOOP_CONTRACT>>>";
@@ -2982,6 +3222,8 @@ interface StoredContract {
2982
3222
  readonly digest: string;
2983
3223
  readonly assessment: ContractAssessment;
2984
3224
  readonly source: 'llm' | 'manual';
3225
+ /** Digest of approved memory hits frozen with this contract (invalidates reuse when memory changes). */
3226
+ readonly memoryDigest?: string;
2985
3227
  }
2986
3228
  interface ContractAssessment {
2987
3229
  readonly dispatchable: boolean;
@@ -2992,17 +3234,19 @@ declare const assessContract: (contract: TaskContract) => ContractAssessment;
2992
3234
  declare const contractPath: (stateDir: string, identifier: string) => string;
2993
3235
  declare const readStoredContract: (stateDir: string, identifier: string) => StoredContract | null;
2994
3236
  declare const writeStoredContract: (stateDir: string, stored: StoredContract) => string;
2995
- /** A cached contract is fresh when the issue has not changed since and it is younger than `reuseHours`. */
2996
- declare const contractIsFresh: (stored: StoredContract, issue: Pick<LinearIssueDetail, "updatedAt">, reuseHours: number, now: Date) => boolean;
3237
+ /** A cached contract is fresh when the issue has not changed since, it is younger than `reuseHours`, and memory digest still matches. */
3238
+ declare const contractIsFresh: (stored: StoredContract, issue: Pick<LinearIssueDetail, "updatedAt">, reuseHours: number, now: Date, memoryDigest?: string) => boolean;
2997
3239
  /** Wrap untrusted text so the model treats it as data; the closing sentinel is unforgeable because we strip it from the payload. */
2998
3240
  declare const untrusted: (label: string, text: string) => string;
2999
3241
  declare const renderContractPrompt: (input: {
3000
3242
  readonly issue: LinearIssueDetail;
3001
3243
  readonly config: LoopConfig;
3002
3244
  readonly references: readonly ContextReference[];
3245
+ readonly memoryBlock?: string;
3246
+ readonly maxIssueChars?: number;
3003
3247
  }) => string;
3004
3248
  declare const parseContractOutput: (stdout: string) => TaskContract;
3005
- declare const resolveDocContext: (root: string, query: string, max: number) => Promise<readonly ContextReference[]>;
3249
+ declare const resolveDocContext: (root: string, query: string, max: number, scopes?: readonly string[]) => Promise<readonly ContextReference[]>;
3006
3250
  interface ProviderFailure {
3007
3251
  readonly provider: string;
3008
3252
  readonly model: string;
@@ -3019,8 +3263,12 @@ interface GenerateContractInput {
3019
3263
  readonly orchestrator?: RoutingDecision;
3020
3264
  readonly now?: () => Date;
3021
3265
  readonly references?: readonly ContextReference[];
3266
+ /** Optional approved-memory adapter (token reduction). Fail-soft when omitted. */
3267
+ readonly memory?: AgentMemoryAdapter | null;
3022
3268
  /** Called when a candidate fails for a provider-level reason (auth/quota/timeout) before the next one is tried. */
3023
3269
  readonly onProviderFailure?: (failure: ProviderFailure) => void;
3270
+ /** Observability for memory/doc-bridge char budgets. */
3271
+ readonly onMemoryPlan?: (plan: MemoryContextPlan) => void;
3024
3272
  }
3025
3273
  declare const classifyProviderFailure: (detail: string, timedOut?: boolean) => ProviderFailure["kind"];
3026
3274
  declare const generateContract: (input: GenerateContractInput) => Promise<StoredContract>;
@@ -3033,6 +3281,10 @@ interface WorkerBriefInput {
3033
3281
  readonly provider: string;
3034
3282
  readonly model: string;
3035
3283
  readonly maxIssueChars?: number;
3284
+ /** Pre-rendered approved memory block (from `selectMemoryForPrompt`). */
3285
+ readonly memoryBlock?: string;
3286
+ /** Doc Bridge playbook/for-agents refs (titles/paths only). */
3287
+ readonly guidanceRefs?: readonly ContextReference[];
3036
3288
  }
3037
3289
  /** The prompt a worker receives in its Orca terminal. Issue text is data; the contract and the rules are the instructions. */
3038
3290
  declare const renderWorkerBrief: (input: WorkerBriefInput) => string;
@@ -3275,7 +3527,7 @@ declare const precheckDeliver: (stateDir: string) => {
3275
3527
  };
3276
3528
  declare const runDeliver: (input: DeliverInput) => Promise<DeliverReport>;
3277
3529
 
3278
- type LoopStage = 'tick' | 'deliver';
3530
+ type LoopStage = 'tick' | 'deliver' | 'retro';
3279
3531
  declare const LOOP_STAGES: readonly LoopStage[];
3280
3532
  interface InstallInput {
3281
3533
  readonly configPath?: string;
@@ -3670,5 +3922,21 @@ declare const buildRetroReport: (input: RetroInput) => Promise<RetroReport>;
3670
3922
  declare const renderRetroMarkdown: (report: RetroReport) => string;
3671
3923
  /** Learnings the harness can track; a human promotes them with `promoteLearnings`. */
3672
3924
  declare const retroLearnings: (report: RetroReport, markdown: string) => readonly LearningRecord[];
3925
+ interface RetroStageReport {
3926
+ readonly status: 'ok' | 'skipped' | 'failed' | 'dry-run';
3927
+ readonly issue: string | null;
3928
+ readonly digest: string | null;
3929
+ readonly posted: boolean;
3930
+ readonly learningsProposed: number;
3931
+ readonly detail: string;
3932
+ }
3933
+ /** Build the weekly digest, upsert proposed learnings, and comment on `schedule.retroIssue` (idempotent write-id). */
3934
+ declare const runRetroStage: (input: {
3935
+ readonly configPath?: string;
3936
+ readonly loaded?: LoadedLoopConfig;
3937
+ readonly runner: CommandRunner;
3938
+ readonly since?: string;
3939
+ readonly dryRun?: boolean;
3940
+ }) => Promise<RetroStageReport>;
3673
3941
 
3674
- export { 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 AgentSessionOptions, type AgentUsage, type ApprovedAssumption, type ArtifactBinding, type ArtifactEnvelope, type ArtifactEnvelopeInput, type ArtifactType, 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 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 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 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, 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, LEARNING_STATUSES, LEGAL_TRANSITIONS, LOOP_CONFIG_FILE, LOOP_CONFIG_SCHEMA_VERSION, LOOP_LOCAL_CONFIG_FILE, LOOP_STAGES, type LearningRecord, type LearningStatus, 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 LoopState, type LoopStatusReport, MEMORY_SCOPES, MODEL_ROLES, type MachineMetrics, type MachineSample, type MachineThresholds, type MemoryScope, type MemoryUsage, type MetricStatus, type ModelBinding, type ModelPolicy, 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 PluginContribution, type PluginRegistry, type PluginSlot, type PolicyDecision, type PolicyGate, type PolicyRequest, type PolicyRule, type ProcessToolDefinition, type ProductionEvidence, type ProviderAuthStatus, type ProviderAvailability, 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 RankedModel, type RecoveryObservation, type RecoveryPolicy, type RecoveryResult, type RepositoryProfile, type RetroInput, type RetroIssueRow, type RetroReport, 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 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 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, buildDebriefReport, buildListIssuesArgv, buildRetroReport, buildReviewArgv, buildSuggestions, busyIssues, cancelRun, classifyFailure, classifyHarnessError, classifyProviderFailure, classifyWatchEvent, classifyWatchPhase, cleanTaskArtifacts, clearProviderCooldown, compareOptimization, compareVersions, composePullRequest, contractIsFresh, contractPath, cooldownPath, cooldownUntil, countRunningWorkers, createArtifactEnvelope, createCapabilityManifest, createCodingAgentAdapter, createCompatibilityManifest, createConfiguredToolRuntime, createDispatchLedger, createDocBridgeContextProvider, createDockerToolRuntime, createEvalManifest, createHarnessEventEnvelope, createInMemoryMemoryAdapter, createKvMemoryAdapter, createLinearTrackingAdapter, createLlmCache, createLlmCacheKey, createMachineMonitor, createModelPolicy, createOrcaDispatchPlan, createOrcaLifecycleProjection, createPhaseArtifact, createPhaseProfile, createPluginRegistry, createPluginSlot, createPolicyGate, createProcessRunner, createProcessToolRuntime, createPullRequestApproval, createQualityMatrix, createRichIO, createSessionRecorder, createStatusSnapshot, createToolRuntime, createTrackingAdapter, createTrackingTransition, deliveryStatePath, detectProviders, dispatchRecordPath, evaluateWatchdog, executePhaseProfile, exportEvidenceBundle, fetchLinearIssue, fetchLinearQueue, fetchTeamMembers, filterAndOrderQueue, findExecutable, formatWatchEvent, gatherLoopState, generateContract, githubComment, githubCommentArgv, githubCommentExists, githubMerge, githubMergeArgv, githubOpenPullRequests, githubPullRequest, githubPullRequestsForBranch, hasLocalConfig, hashContextSnapshot, hashContextSnapshots, inspectEventLogLock, installLoopAutomations, installPreflight, isDiscoveryCurrent, isWsl, launchWorkerTerminal, linearAttach, linearAttachArgv, linearCommentAdd, linearCommentAddArgv, linearLabelAdd, linearLabelArgv, linearLabelRemove, linearStatusSet, linearStatusSetArgv, listDispatched, loadBenchmarkManifest, loadConfig, loadLatestRun, loadLoopConfig, localConfigPath, loopStatus, markProviderExhausted, mergeLoopConfig, modelFor, normalizeReason, orcaAccountList, orcaAgentHooks, orcaAutomationCreateArgv, orcaAutomationEditArgv, orcaAutomationRemove, orcaAutomationRun, orcaAutomationRuns, orcaAutomationsList, orcaJson, orcaStatus, orcaTerminalCreate, orcaTerminalList, orcaTerminalScreen, orcaTerminalSend, orcaTerminalWait, orcaVersion, orcaWorktreeCreate, orcaWorktreeRemove, orcaWorktreeSet, orcaWorktreeSetArgv, orcaWorktrees, parseAutomationRuns, parseContractOutput, parseJsonEnvelope, parseLinearIssueDetail, parseLinearIssues, parseLoopConfigText, parseMemInfo, parseModelRef, parseOrcaAgentHooks, parseOrcaAutomations, parseOrcaSendReceipt, parseOrcaStatus, parseOrcaTerminals, parseOrcaVersion, parseOrcaWorktreeCreate, parseOrcaWorktrees, parseProviderUsage, parsePullRequest, parseRetro, parseReviewResult, parseSince, parseTeamMembers, parseUsageWindows, parseVmStat, planFilePreflight, planPhaseProfile, planRun, precheckCommand, precheckDeliver, precheckTick, promoteLearnings, promptLocalConfig, providerIdentity, providerSpecs, rankModels, readArtifactFile, readContextSnapshots, readCooldowns, readDeliveryState, readDispatchRecord, readEvidenceTrustStore, readLoopEvents, readStoredContract, reconcileRun, recordBenchmarkObservation, recoverEventLogLock, recoveryDelayMs, renderArtifactMarkdown, renderContractPrompt, renderDebriefMarkdown, renderFindingsForWorker, renderHeadlessArgv, renderLocalConfig, renderRetroMarkdown, renderTuiCommand, renderWorkerBrief, resolveDocContext, resumeStateFromArtifacts, retroLearnings, retryRun, routeAllRoles, runAdversarialReview, runAgentEval, runCodeReview, runDeliver, runEvalBattery, runGuidedInstall, runLoopDoctor, runTick, runWithRecovery, runWorkflow, sampleMachine, selectModel, selectRuntime, severityRank, shellQuote, snapshotWatchTargets, startRun, summarizeMachine, tiersFor, touchesProtectedPaths, transition, uninstallLoopAutomations, unknownTelemetry, untrusted, validateAdapterMetadata, validateArtifactEnvelope, validateBenchmarkManifest, validateBlockManifest, validateCacheableOperation, validateCapabilityManifest, validateCompatibilityManifest, validateConfig, validateContextSnapshot, validateContextSnapshots, validateEvalManifest, validateHarnessErrorClassification, validateHarnessEventEnvelope, validateLoopConfig, validateMemoryRecord, validateOptimizationObservation, validatePhaseTelemetry, validateSafeCommand, validateStatusSnapshot, verifyEvidenceBundle, verifyPullRequestApproval, verifyRun, watchDeliveries, worktreeNameFor, writeIdFor, writeLocalConfig, writeStoredContract };
3942
+ 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 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 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 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, 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, 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 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 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 PluginContribution, type PluginRegistry, type PluginSlot, type PolicyDecision, type PolicyGate, type PolicyRequest, type PolicyRule, type ProcessToolDefinition, type ProductionEvidence, type ProviderAuthStatus, type ProviderAvailability, 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 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 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, buildDebriefReport, buildListIssuesArgv, buildRetroReport, buildReviewArgv, buildSuggestions, busyIssues, cancelRun, classifyFailure, classifyHarnessError, classifyProviderFailure, classifyWatchEvent, classifyWatchPhase, cleanTaskArtifacts, 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, dispatchRecordPath, evaluateWatchdog, executePhaseProfile, exportEvidenceBundle, fetchLinearIssue, fetchLinearQueue, fetchTeamMembers, filterAndOrderQueue, findExecutable, formatWatchEvent, gatherLoopState, generateContract, githubComment, githubCommentArgv, githubCommentExists, githubMerge, githubMergeArgv, githubOpenPullRequests, githubPullRequest, githubPullRequestsForBranch, hasLocalConfig, hashContextSnapshot, hashContextSnapshots, hashMcpArgs, inspectDocBridgeIndex, inspectEventLogLock, installLoopAutomations, installPreflight, isDiscoveryCurrent, isWsl, launchWorkerTerminal, learningToMemoryRecord, learningsPath, linearAttach, linearAttachArgv, linearCommentAdd, linearCommentAddArgv, linearLabelAdd, linearLabelArgv, linearLabelRemove, linearStatusSet, linearStatusSetArgv, listDispatched, loadAgentRegistry, loadBenchmarkManifest, loadConfig, loadLatestRun, loadLoopConfig, 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, parseAutomationRuns, parseContractOutput, parseJsonEnvelope, parseLinearIssueDetail, parseLinearIssues, parseLoopConfigText, parseMemInfo, parseModelRef, parseOrcaAgentHooks, parseOrcaAutomations, parseOrcaSendReceipt, parseOrcaStatus, parseOrcaTerminals, parseOrcaVersion, parseOrcaWorktreeCreate, parseOrcaWorktrees, parseProviderUsage, parsePullRequest, parseRagQueryOutput, parseRetro, parseReviewResult, parseSince, parseTeamMembers, parseUsageWindows, parseVmStat, planFilePreflight, planMemoryContext, planPhaseProfile, planRun, precheckCommand, precheckDeliver, precheckTick, preferMemoryOverDocBridge, promoteLearnings, promoteLearningsToMemory, promptLocalConfig, providerIdentity, providerSpecs, rankModels, readArtifactFile, readContextSnapshots, readCooldowns, readDeliveryState, readDispatchRecord, readEvidenceTrustStore, readLearningsLedger, readLoopEvents, readStoredContract, reconcileRun, recordBenchmarkObservation, recoverEventLogLock, recoveryDelayMs, renderArtifactMarkdown, renderContractPrompt, renderDebriefMarkdown, renderFindingsForWorker, renderHeadlessArgv, renderLocalConfig, renderRetroMarkdown, renderTuiCommand, renderWorkerBrief, resolveAgentForRole, resolveDocContext, resumeStateFromArtifacts, retroLearnings, retryRun, routeAllRoles, runAdversarialReview, runAgentEval, runCodeReview, runDeliver, runEvalBattery, runGuidedInstall, runLoopDoctor, runRetroStage, runTick, runWithRecovery, runWorkflow, sampleMachine, selectMemoryForPrompt, selectModel, selectRuntime, severityRank, shellQuote, snapshotWatchTargets, startRun, summarizeMachine, tiersFor, touchesProtectedPaths, transition, uninstallLoopAutomations, unknownTelemetry, untrusted, upsertProposedLearnings, validateAdapterMetadata, validateArtifactEnvelope, validateBenchmarkManifest, validateBlockManifest, validateCacheableOperation, validateCapabilityManifest, validateCompatibilityManifest, validateConfig, validateContextSnapshot, validateContextSnapshots, validateEvalManifest, validateHarnessErrorClassification, validateHarnessEventEnvelope, validateLoopConfig, validateMemoryRecord, validateOptimizationObservation, validatePhaseTelemetry, validateSafeCommand, validateStatusSnapshot, verifyEvidenceBundle, verifyPullRequestApproval, verifyRun, watchDeliveries, worktreeNameFor, writeIdFor, writeLearningsLedger, writeLocalConfig, writeStoredContract };