@aisac/cli 0.4.0-beta.2 → 0.4.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +115 -10
  2. package/dist/assets/claude/hooks/context-compaction.ts +17 -5
  3. package/dist/assets/claude/hooks/native-host-contract-runtime.ts +1 -1
  4. package/dist/assets/claude/hooks/native-host-contract.test.ts +8 -4
  5. package/dist/assets/claude/hooks/provider-window.d.ts +83 -0
  6. package/dist/assets/codex-context-compaction.mjs +243 -5
  7. package/dist/assets/jev-paid-pilot-terminal.mjs +6 -0
  8. package/dist/claude-compatibility.mjs +26 -25
  9. package/dist/claude-observation.mjs +2 -1
  10. package/dist/cli.mjs +584 -35
  11. package/dist/codex-compatibility.mjs +48 -2
  12. package/dist/codex-engineering.mjs +165 -0
  13. package/dist/codex-hooks.mjs +411 -0
  14. package/dist/codex-permissions.mjs +67 -34
  15. package/dist/codex-protocol-fingerprint.json +11 -11
  16. package/dist/engineering-init.mjs +615 -0
  17. package/dist/engineering-pack.mjs +259 -23
  18. package/dist/engineering-scan-pins.json +42 -0
  19. package/dist/engineering-scan-report.mjs +1274 -0
  20. package/dist/engineering-scan-tools.mjs +1418 -0
  21. package/dist/engineering-scan.mjs +1265 -0
  22. package/dist/extensions-catalog.mjs +373 -0
  23. package/dist/extensions-cli.mjs +492 -0
  24. package/dist/extensions-preferences.mjs +151 -0
  25. package/dist/guardrails/continuity.mjs +239 -0
  26. package/dist/guardrails/format.mjs +111 -0
  27. package/dist/guardrails/guards.mjs +449 -0
  28. package/dist/guardrails/patch.mjs +33 -0
  29. package/dist/guardrails/run.mjs +286 -0
  30. package/dist/guardrails/shell-words.mjs +206 -0
  31. package/dist/guardrails-plugin.mjs +207 -0
  32. package/dist/launch.mjs +278 -34
  33. package/dist/managed-host.mjs +977 -0
  34. package/dist/mcp-servers.mjs +192 -0
  35. package/dist/mcp.mjs +10 -2
  36. package/dist/monitor.mjs +76 -1
  37. package/dist/package.json +1 -1
  38. package/dist/platform.mjs +78 -29
  39. package/dist/release-manifest-public-keys.json +10 -0
  40. package/dist/release-manifest.json +328 -0
  41. package/dist/release-manifest.mjs +817 -0
  42. package/dist/release-settings.mjs +210 -0
  43. package/dist/self-update.mjs +1036 -0
  44. package/dist/state.mjs +25 -1
  45. package/dist/token-guide.mjs +132 -0
  46. package/dist/update-actions.mjs +442 -0
  47. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # aisac
2
2
 
3
- The AISAC client for Claude Code and Codex on Linux/WSL with Node.js 22 or newer:
3
+ The AISAC client for Claude Code and Codex on Linux, WSL and macOS, with
4
+ Node.js 22 or newer:
4
5
  AI Brain memory, context management and, for AISAC Founding Cohort members,
5
6
  AISAC Engineering.
6
7
 
@@ -18,19 +19,98 @@ For licensed accounts, `aisac claude` downloads the AISAC Engineering pack for
18
19
  the session, verifies its Ed25519 signature against the key pinned in this
19
20
  release, and loads it as the `aisac-engineering` plugin from the session's
20
21
  private folder, which is deleted on exit. Any failure starts Claude without the
21
- pack. `aisac setup --lang pt-BR|en` picks the pack language without a network
22
- call. The pack is never part of this npm package.
22
+ pack. Once set up, `aisac setup --lang pt-BR|en` picks the pack language without a
23
+ network call; on a machine that was never set up it runs the full setup in that
24
+ language. The pack is never part of this npm package.
23
25
 
24
- Codex capture also requires the `flock` utility from `util-linux`, normally
25
- included in Linux/WSL. The launcher and doctor check availability before a
26
+ `aisac codex` (Codex 0.164.0 or later) loads the same verified pack for that
27
+ session only: its skills are added to the Codex app-server the launch owns
28
+ (call one with `$`, for example `$spec`) and its agents become session agent
29
+ roles. Nothing is written to `~/.codex`, `~/.agents` or the project, and the
30
+ session's folder is deleted on exit. An older Codex starts without the pack and
31
+ says `codex_outdated`.
32
+
33
+ `aisac init [dir]` (licensed accounts, client `0.4.0-beta.14` or later) writes the
34
+ AISAC skeleton into a new or existing project: `CLAUDE.md`, `AGENTS.md`,
35
+ `NOTES.example.md`, the `docs/` tree with its templates, a Claude Code rules file,
36
+ a CI workflow with pinned actions, Dependabot, `.gitignore` and the workloop
37
+ template. The templates travel inside the licensed pack, fetched and verified like
38
+ a launch; the command writes only files that are missing, never follows a symbolic
39
+ link, never touches `.git/` and prints every file it wrote or skipped. Options:
40
+ `--stack node|python|none` (otherwise detected from `package.json`, `pyproject.toml`
41
+ or `requirements.txt`), `--lang pt-BR|en`, `--dry-run`, `--json`. Exit codes: `0`
42
+ when every file exists or was written, `1` for a license, pack or write failure
43
+ (nothing is written before the pack is verified), `2` for a usage error. Until the
44
+ pack carries the templates, the command says so and writes nothing.
45
+
46
+ `aisac scan [dir]` (licensed accounts, client `0.4.0-beta.17` or later) runs four
47
+ pinned security scanners over your own project and writes one report under
48
+ `.security-reports/aisac-scan/<UTC>/`: gitleaks (secrets), Semgrep CE (static
49
+ analysis), osv-scanner (dependency advisories) and Trivy (infrastructure as code). It
50
+ calls no model and sends no finding anywhere. Each tool runs from its official image,
51
+ pinned by digest, read-only and without network where the tool allows. Without Docker
52
+ it runs a gitleaks, Semgrep or osv-scanner binary from an absolute `PATH` directory
53
+ only when its version is the pinned one, and otherwise skips the tool with a reason.
54
+ Trivy runs only from its image, so without Docker `iac` is skipped
55
+ (`tool_needs_container`). The report has `summary.md` in your language,
56
+ `summary.json` and a sanitized copy of each tool's output, with secret values
57
+ redacted and every finding mapped to OWASP ids. Scanner config files in your project
58
+ (`.gitleaks.toml`, `osv-scanner.toml`, `.semgrepignore` and the like) are ignored and
59
+ listed as `repo_scanner_config:<path>` warnings. osv-scanner sends package names and
60
+ versions to OSV.dev and contacts nothing else, and the client fetches the Semgrep
61
+ registry rules before the scan; `--skip sca` avoids the first. Options, each at most
62
+ once with its value as the next argument:
63
+ `--fail-on critical|high|medium|low|none`, `--only <kinds>` or `--skip <kinds>` (not
64
+ both; a comma list of `secrets`, `sast`, `sca`, `iac`, `container`), `--history`
65
+ (adds a git-history pass; `dir` must hold `.git`), `--no-docker`, `--lang pt-BR|en`,
66
+ `--json`, `--check-tools`, `--timeout <seconds>` (1 to 3600, default 600).
67
+ `--check-tools` shows what would run without a license, a pack or a network call, and
68
+ `aisac doctor` reports the same on its `scan` line. Exit codes: `0` below `--fail-on`
69
+ (default `high`), `1` at or above it, `2` for a usage error, `3` when the scan could
70
+ not run as asked: no scanner ran, a tool failed, `--history` found no repository, the
71
+ license is inactive, the pack could not be loaded, or another error stopped it.
72
+ Guide: [`aisac scan`](../../docs/how-to/aisac-scan.md).
73
+
74
+ Licensed `aisac claude` sessions also load guardrail hooks as the session plugin
75
+ `aisac-guardrails`.
76
+ - **Default on:** `secrets-guard` refuses secret files by name. Four more hooks
77
+ keep continuity: a repository snapshot at start and after a compaction, a
78
+ docs reminder, and the NOTES/spec/CHANGELOG pass.
79
+ - **Default off:** `git-guard`, `destructive-guard` and `format-on-edit`.
80
+ - **Changing them:** `aisac hooks` lists them, and `aisac hooks enable|disable
81
+ <id>` or `aisac hooks reset` changes the next session. The agent cannot change
82
+ them from inside a session.
83
+ - **Code:** it ships in this package and runs locally. Nothing comes from the
84
+ server.
85
+ - **Codex (0.166.0 or later):** licensed `aisac codex` sessions get the same hooks
86
+ from session flags. Codex runs them only after you approve the AISAC hooks once
87
+ in `/hooks`, and you can switch each one off there too. The launch line says how
88
+ many are on and how many wait for that review; `aisac doctor` reports the same
89
+ under `extensions.codexHooks`. A new Node path (for example after an nvm or
90
+ Homebrew upgrade) changes the hook commands, so Codex asks for the review again.
91
+
92
+ Licensed sessions of `aisac claude` and `aisac codex` can also load reviewed MCP
93
+ servers: `github` (read-only, token in `GITHUB_PERSONAL_ACCESS_TOKEN`), `supabase`
94
+ (read-only), `vercel`, `playwright` (pinned, isolated), `context7` and `creatives` (the
95
+ AISAC Creatives Studio, from client `0.4.0-beta.15`).
96
+ - **Default:** every server is off. `aisac mcp` lists them, `aisac mcp enable|disable
97
+ <id>` or `aisac mcp reset` changes the next session, and `aisac mcp info <id>` says
98
+ what a server reaches and how to log in.
99
+ - **Login:** the host does it (`/mcp` in Claude Code, `aisac mcp login <id>` for Codex)
100
+ and keeps it in its own store. No token reaches `~/.aibrain` or AISAC.
101
+
102
+ On Linux/WSL, Codex capture also requires the `flock` utility from `util-linux`,
103
+ normally included. On macOS it uses `/usr/bin/perl`, `/usr/sbin/sysctl` and
104
+ `/bin/ps` instead. The launcher and doctor check availability before a
26
105
  monitored Codex session starts. Capture coordination is released by the kernel
27
106
  after a process exits unexpectedly. An unidentifiable empty lock left by an
28
107
  older client requires a verified support migration; do not delete checkpoints,
29
108
  notes or lock files to work around a reported storage error.
30
109
 
31
110
  The reviewed native compatibility set is Claude Code 2.1.294, 2.1.295, 2.1.296,
32
- 2.1.299, 2.1.300, 2.1.301, 2.1.302 or 2.1.303, and Codex CLI 0.161.0,
33
- 0.162.0, 0.162.1, 0.163.0 or 0.164.0. A newer stable Codex 0.x release may continue only
111
+ 2.1.299, 2.1.300, 2.1.301, 2.1.302, 2.1.303, 2.1.311, 2.1.322 or 2.1.323, and Codex CLI 0.161.0,
112
+ 0.162.0, 0.162.1, 0.163.0, 0.164.0, 0.166.0 or 0.167.1 (0.165.0 and 0.167.0 were never
113
+ qualified; 0.167.0 shares the 0.167.1 contract, so the structural probe admits it). A newer stable Codex 0.x release may continue only
34
114
  after its locally generated experimental protocol schemas and transport flags
35
115
  match the bundled adapter contract; prereleases, older releases and new majors
36
116
  remain rejected. Starting with beta14, newer stable Claude 2.1 patches can
@@ -46,6 +126,29 @@ record formats. Native launch/resume qualification is separate from a new
46
126
  model/JEV compaction qualification. A later native release that changes the
47
127
  consumed contract can still require an AI Brain compatibility update.
48
128
 
129
+ `0.4.0-beta.9` refreshes the bundled contract to Codex 0.166.0. Its delta is
130
+ additive: optional item timing, an image generation id, an attach-to-source fork
131
+ flag and two error codes. See the
132
+ [Codex 0.166 qualification record](../../docs/reference/codex-166-compatibility-2026-11-04.md).
133
+
134
+ `0.4.0-beta.16` refreshes the bundled contract to Codex 0.167.1 and qualifies Claude Code
135
+ 2.1.311 and 2.1.322. The Codex delta is additive: audio inputs may reference an uploaded
136
+ file (`fileId` / `file_id`) instead of a URL, `initialize` gains the optional
137
+ `requiredHumanApproval` capability and `humanCommand` becomes an approval kind only
138
+ clients that declare it receive. See the
139
+ [Codex 0.167 qualification record](../../docs/reference/codex-167-compatibility-2026-11-11.md)
140
+ and the [Claude 2.1.322 record](../../docs/reference/claude-322-compatibility-2026-11-11.md).
141
+
142
+ `0.4.0-beta.17` adds `aisac scan`, keeps the pack's `scan/` rules out of every session
143
+ (like `init/`), and lets a command exit with `3`. The qualified Claude Code and Codex
144
+ versions are those of `0.4.0-beta.16`.
145
+
146
+ `0.4.0-beta.18` qualifies Claude Code 2.1.323. Its `claude plugin validate` type-checks the
147
+ hook modules, so the bundled plugin now type-checks under the host's tsconfig (typing only,
148
+ no behaviour change) and ships `provider-window.d.ts`; the host probe also reads an
149
+ inventory that the validator wraps across several notes. See the
150
+ [Claude 2.1.323 record](../../docs/reference/claude-323-compatibility-2026-11-12.md).
151
+
49
152
  The Codex terminal bridge permits the native session picker's separate read-only
50
153
  connection while keeping the primary conversation and monitor intact. A picker
51
154
  cannot compact, start a turn, inject history or take ownership of the primary
@@ -54,7 +157,7 @@ connection. Its failure or timeout closes only that auxiliary connection.
54
157
  ```sh
55
158
  # Install the published beta:
56
159
  npm install -g @aisac/cli@beta
57
- aisac setup --client both
160
+ aisac setup # configures the clients on PATH; --client claude|codex|both to choose
58
161
  aisac doctor --json
59
162
  aisac claude
60
163
  aisac codex
@@ -68,8 +171,10 @@ Installation does not contact AI Brain, change native client configuration, or
68
171
  enable all paid accounts. Setup requires an existing AI Brain PAT, explicit
69
172
  versioned disclosure, and successful provider-free pilot access. Claude and
70
173
  Codex continue to own their own authentication. Windows native is unsupported;
71
- run the beta inside WSL. Pricing and general customer activation are outside
72
- this beta.
174
+ run the beta inside WSL. On macOS, Codex capture locks with the system
175
+ `/usr/bin/perl` (`flock(2)`) and identifies the lock owner with `sysctl` and
176
+ `ps`, so nothing extra needs installing. Pricing and general customer
177
+ activation are outside this beta.
73
178
 
74
179
  For reviewed noninteractive automation only, use a private token file and
75
180
  explicitly acknowledge the displayed disclosure with
@@ -151,7 +151,7 @@ type Register = (
151
151
  ) => void;
152
152
 
153
153
  const MAX_RESULT_BYTES = 256 * 1024;
154
- const CLAUDE_HOOK_VERSION = '0.4.0-beta.1';
154
+ const CLAUDE_HOOK_VERSION = '0.4.0-beta.7';
155
155
  const MAX_DIAGNOSTIC_BYTE_COUNT = 128 * 1024 * 1024;
156
156
  const COOLDOWN_MS = 60_000;
157
157
  const MAX_TRUNCATED_CODE_POINTS = 300;
@@ -463,6 +463,10 @@ function v2WireOptions(options: V2Options): Record<string, unknown> {
463
463
 
464
464
  function safeErrorCategory(error: unknown): string {
465
465
  const record = isRecord(error) ? error : {};
466
+ // A coded error names its own reason; the keyword guess below would read
467
+ // "AI Brain plan does not meet the minimum estimated reduction" as invalid_plan.
468
+ if (COMPACT_ERROR_CODES.includes(record.compactErrorCode as CompactErrorCode))
469
+ return record.compactErrorCode as CompactErrorCode;
466
470
  const code = typeof record.code === 'string' ? record.code.toLowerCase() : '';
467
471
  const name = typeof record.name === 'string' ? record.name.toLowerCase() : '';
468
472
  const message = typeof record.message === 'string' ? record.message.toLowerCase() : '';
@@ -4504,11 +4508,19 @@ type ClaudeTelemetry = {
4504
4508
  disconnected(): boolean;
4505
4509
  flush(timeoutMs?: number): Promise<void>;
4506
4510
  };
4511
+ // The host tsconfig (lib es2023 only) declares no timers; the hook runtime provides them
4512
+ // on globalThis, so the handle stays opaque and the defaults are read from there.
4513
+ type ClaudeTimerHandle = unknown;
4507
4514
  type ClaudeTelemetryTimers = {
4508
- setTimeout(callback: () => void, delay: number): ReturnType<typeof setTimeout>;
4509
- clearTimeout(timer: ReturnType<typeof setTimeout>): void;
4515
+ setTimeout(callback: () => void, delay: number): ClaudeTimerHandle;
4516
+ clearTimeout(timer: ClaudeTimerHandle): void;
4510
4517
  };
4511
4518
 
4519
+ function hostTelemetryTimers(): ClaudeTelemetryTimers {
4520
+ const host = globalThis as unknown as ClaudeTelemetryTimers;
4521
+ return { setTimeout: host.setTimeout, clearTimeout: host.clearTimeout };
4522
+ }
4523
+
4512
4524
  const TELEMETRY_HELPER_MAX_STDOUT_BYTES = 8 * 1024;
4513
4525
 
4514
4526
  type TelemetryHelperConfiguration = 'none' | 'valid' | 'invalid';
@@ -4673,7 +4685,7 @@ export function createClaudeTelemetryReporter(
4673
4685
  getSessionId: () => PromiseLike<string> | string,
4674
4686
  sendReport: (payload: Record<string, unknown>) => PromiseLike<unknown> | unknown,
4675
4687
  now: () => number = () => Date.now(),
4676
- timers: ClaudeTelemetryTimers = { setTimeout, clearTimeout },
4688
+ timers: ClaudeTelemetryTimers = hostTelemetryTimers(),
4677
4689
  ): ClaudeTelemetry {
4678
4690
  const active =
4679
4691
  enabled === true &&
@@ -4748,7 +4760,7 @@ export function createClaudeTelemetryReporter(
4748
4760
  if (attempt.expired) return;
4749
4761
  if (!telemetryAckAccepted(response)) throw new Error('telemetry_report_rejected');
4750
4762
  })();
4751
- let timer: ReturnType<typeof setTimeout> | undefined;
4763
+ let timer: ClaudeTimerHandle | undefined;
4752
4764
  void (async () => {
4753
4765
  try {
4754
4766
  await Promise.race([
@@ -1,4 +1,4 @@
1
- import { register as registerContext } from './context-compaction.ts';
1
+ import { register as registerContext } from './context-compaction.js';
2
2
 
3
3
  export function register(on: Parameters<typeof registerContext>[0]): void {
4
4
  return registerContext(on, {
@@ -10,7 +10,7 @@ const contractTest: Parameters<typeof test>[2] = async ($, on) => {
10
10
  on('session.usage', () => ({
11
11
  value: (() => {
12
12
  usageCalls += 1;
13
- return { context: { percent: 90, tokens: 900, window: 1_000 } };
13
+ return { startedAt: 0, context: { percent: 90, tokens: 900, window: 1_000 }, rateLimits: [] };
14
14
  })(),
15
15
  }));
16
16
  on('ui.log', () => ({ value: undefined }));
@@ -23,17 +23,21 @@ const contractTest: Parameters<typeof test>[2] = async ($, on) => {
23
23
  };
24
24
  });
25
25
  on('turn.complete', () => ({ text: '' }));
26
- const prompt = await $.prompt.submit({ text: 'native-host-contract-input' });
26
+ const prompt = await $.prompt.submit({
27
+ text: 'native-host-contract-input',
28
+ wait: false,
29
+ origin: { kind: 'composer' },
30
+ });
27
31
  const tool = await $.tool.call({ tool: 'Read', file_path: 'native-host-contract.txt' });
28
32
  await $.turn.complete({
29
33
  turnId: 'native-contract-turn',
30
34
  answer: 'native-turn-contract-ok',
31
35
  durationMs: 1,
32
36
  isAborted: false,
33
- usage: null,
37
+ reason: 'answer',
34
38
  });
35
39
  expect(prompt.text).toBe('native-host-contract-ok');
36
- expect(tool.result.content).toBe('native-host-tool-ok');
40
+ expect((tool.result as { readonly content: unknown }).content).toBe('native-host-tool-ok');
37
41
  expect(usageCalls).toBe(1);
38
42
  expect(compactCalls).toBe(1);
39
43
  const monotonicEnd = globalThis.performance?.now?.();
@@ -0,0 +1,83 @@
1
+ import type { ProviderFitOptions, ProviderFitPreflight, ProviderFitProjection, ProviderFitProjectionMessage, ProviderFitProjectionPair } from './state-fitting.mjs';
2
+ export declare const PROVIDER_WINDOW_MAX_PAIRS = 200;
3
+ export declare const PROVIDER_WINDOW_MAX_MESSAGES = 1000;
4
+ export declare const PROVIDER_WINDOW_MAX_REFERENCES = 200;
5
+ export declare const PROVIDER_WINDOW_MAX_REQUEST_BYTES: number;
6
+ export declare const PROVIDER_WINDOW_REQUEST_HEADROOM_BYTES: number;
7
+ export declare const PROVIDER_WINDOW_MAX_SEARCH_ATTEMPTS = 12;
8
+ export declare const PROVIDER_WINDOW_MAX_STATE_TOKENS = 25000;
9
+ export declare const PROVIDER_WINDOW_MAX_REQUEST_TOKENS = 30000;
10
+ export declare const PROVIDER_WINDOW_MAX_RESERVED_TOKENS = 120000;
11
+ export declare const PROVIDER_WINDOW_OUTPUT_TOKEN_ALLOWANCE = 4000;
12
+ export type ProviderWindowMessage = ProviderFitProjectionMessage;
13
+ export interface ProviderWindowPair extends ProviderFitProjectionPair {
14
+ readonly callId: string;
15
+ readonly resultId: string;
16
+ readonly callMessage: number;
17
+ readonly resultMessage: number;
18
+ readonly resultText: string;
19
+ readonly protectedPair: boolean;
20
+ }
21
+ export interface ProviderWindowProjection {
22
+ readonly goal: string;
23
+ readonly messages: readonly ProviderWindowMessage[];
24
+ readonly pairs: readonly ProviderWindowPair[];
25
+ readonly protectedItemCount: number;
26
+ }
27
+ export interface ProviderWindowWireProjection {
28
+ readonly goal: string;
29
+ readonly messages: readonly {
30
+ readonly id: string;
31
+ readonly role: 'user' | 'assistant';
32
+ readonly text: string;
33
+ readonly call_ids: readonly string[];
34
+ readonly result_ids: readonly string[];
35
+ }[];
36
+ readonly pairs: readonly {
37
+ readonly id: string;
38
+ readonly tool: string;
39
+ readonly input_text: string;
40
+ readonly result_chars: number;
41
+ readonly result_is_error: boolean;
42
+ readonly eligibility: 'reproducible_read' | 'compatible_tool' | 'protected';
43
+ readonly pin_reasons: readonly string[];
44
+ }[];
45
+ readonly protected_item_count: number;
46
+ }
47
+ export interface ProviderWindowOptions extends ProviderFitOptions {
48
+ readonly preserveRecentMessages: number;
49
+ readonly maxPairs?: number;
50
+ readonly maxMessages?: number;
51
+ readonly maxReferencesPerMessage?: number;
52
+ readonly maxRequestBytes?: number;
53
+ readonly requestHeadroomBytes?: number;
54
+ readonly maxReservedTokens?: number;
55
+ /** Shared capacity snapshot limits. These are advisory; backend admission remains authoritative. */
56
+ readonly maxBatchesPerOperation?: number;
57
+ readonly outputTokenAllowance?: number;
58
+ }
59
+ export interface ProviderWindowPreflight extends ProviderFitPreflight {
60
+ readonly requestBytes: number;
61
+ readonly estimatedReservationTokens: number;
62
+ }
63
+ export interface ProviderWindowSuccess {
64
+ readonly ok: true;
65
+ readonly projection: ProviderWindowWireProjection;
66
+ readonly pairs: readonly ProviderWindowPair[];
67
+ readonly deferredPairs: readonly ProviderWindowPair[];
68
+ readonly preflight: ProviderWindowPreflight;
69
+ readonly attempts: number;
70
+ readonly anchorPairCount: number;
71
+ readonly selectedEligibleCount: number;
72
+ }
73
+ export type ProviderWindowFailureReason = 'anchor_overflow' | 'message_limit_exceeded' | 'no_feasible_window';
74
+ export interface ProviderWindowFailure {
75
+ readonly ok: false;
76
+ readonly reason: ProviderWindowFailureReason;
77
+ readonly attempts: number;
78
+ readonly anchorPairCount: number;
79
+ }
80
+ export type ProviderWindowResult = ProviderWindowSuccess | ProviderWindowFailure;
81
+ type ProviderFit = (projection: ProviderFitProjection, eligible: readonly ProviderFitProjectionPair[], options: ProviderFitOptions) => ProviderFitPreflight;
82
+ export declare function prepareProviderWindow(input: ProviderWindowProjection, options: ProviderWindowOptions, fit?: ProviderFit): ProviderWindowResult;
83
+ export {};