@mairwunnx/ctxray 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +160 -2
- package/bin/ctxray.js +2 -0
- package/index.js +1 -0
- package/package.json +41 -4
- package/types/app/globals.d.ts +3 -0
- package/types/app/public-api.d.ts +3 -0
- package/types/entities/harness/adapters.d.ts +12 -0
- package/types/entities/harness/capability.d.ts +2 -0
- package/types/entities/harness/capture/canary.d.ts +5 -0
- package/types/entities/harness/capture/copy.d.ts +3 -0
- package/types/entities/harness/capture/isolate.d.ts +16 -0
- package/types/entities/harness/capture/loadout.d.ts +19 -0
- package/types/entities/harness/capture/mcp.d.ts +15 -0
- package/types/entities/harness/capture/model.d.ts +44 -0
- package/types/entities/harness/capture/session.d.ts +54 -0
- package/types/entities/harness/capture/user-scope.d.ts +12 -0
- package/types/entities/harness/claude-code/transcript.d.ts +8 -0
- package/types/entities/harness/index.d.ts +22 -0
- package/types/entities/harness/inventory.d.ts +54 -0
- package/types/entities/harness/layers/dead-rules.d.ts +3 -0
- package/types/entities/harness/layers/files.d.ts +8 -0
- package/types/entities/harness/layers/lint-config.d.ts +9 -0
- package/types/entities/harness/layers/lint.d.ts +5 -0
- package/types/entities/harness/layers/policy.d.ts +16 -0
- package/types/entities/harness/layers/reach.d.ts +7 -0
- package/types/entities/harness/profile.d.ts +22 -0
- package/types/entities/harness/profiles.d.ts +3 -0
- package/types/entities/harness/project.d.ts +26 -0
- package/types/entities/harness/revision.d.ts +11 -0
- package/types/entities/harness/static-loadout.d.ts +42 -0
- package/types/entities/harness-cache/dirs.d.ts +7 -0
- package/types/entities/harness-cache/failure.d.ts +7 -0
- package/types/entities/harness-cache/index.d.ts +11 -0
- package/types/entities/harness-cache/install.d.ts +35 -0
- package/types/entities/harness-cache/inventory.d.ts +15 -0
- package/types/entities/harness-cache/npmrc.d.ts +9 -0
- package/types/entities/harness-cache/pack.d.ts +8 -0
- package/types/entities/harness-cache/progress-view.d.ts +5 -0
- package/types/entities/harness-cache/provisioning.d.ts +38 -0
- package/types/entities/harness-cache/recipes.d.ts +18 -0
- package/types/entities/harness-cache/registry.d.ts +20 -0
- package/types/entities/harness-cache/resolve.d.ts +4 -0
- package/types/entities/loadout/diff.d.ts +21 -0
- package/types/entities/loadout/index.d.ts +1 -0
- package/types/entities/proxy/ask.d.ts +9 -0
- package/types/entities/proxy/cassette.d.ts +20 -0
- package/types/entities/proxy/conversation.d.ts +10 -0
- package/types/entities/proxy/credentials.d.ts +4 -0
- package/types/entities/proxy/egress.d.ts +6 -0
- package/types/entities/proxy/exact/attribute.d.ts +19 -0
- package/types/entities/proxy/exact/cache.d.ts +7 -0
- package/types/entities/proxy/exact/counter.d.ts +17 -0
- package/types/entities/proxy/exact/endpoints.d.ts +14 -0
- package/types/entities/proxy/exact/index.d.ts +3 -0
- package/types/entities/proxy/forward.d.ts +16 -0
- package/types/entities/proxy/index.d.ts +15 -0
- package/types/entities/proxy/mcp-forward.d.ts +6 -0
- package/types/entities/proxy/model.d.ts +16 -0
- package/types/entities/proxy/prices.d.ts +10 -0
- package/types/entities/proxy/protocols/calls.d.ts +6 -0
- package/types/entities/proxy/protocols/index.d.ts +6 -0
- package/types/entities/proxy/protocols/kit.d.ts +7 -0
- package/types/entities/proxy/protocols/sse.d.ts +8 -0
- package/types/entities/proxy/relay.d.ts +13 -0
- package/types/entities/proxy/server.d.ts +17 -0
- package/types/entities/proxy/trace.d.ts +7 -0
- package/types/entities/proxy/usage.d.ts +10 -0
- package/types/entities/user-config/config.d.ts +32 -0
- package/types/entities/user-config/define.d.ts +2 -0
- package/types/entities/user-config/index.d.ts +8 -0
- package/types/entities/user-config/load.d.ts +15 -0
- package/types/entities/user-config/merge.d.ts +3 -0
- package/types/entities/user-config/network.d.ts +12 -0
- package/types/entities/user-config/option.d.ts +2 -0
- package/types/entities/user-config/problem.d.ts +13 -0
- package/types/entities/user-config/read.d.ts +2 -0
- package/types/features/test-run/api/baseline-command.d.ts +10 -0
- package/types/features/test-run/api/command.d.ts +15 -0
- package/types/features/test-run/baseline.action.d.ts +11 -0
- package/types/features/test-run/index.d.ts +11 -0
- package/types/features/test-run/lib/attempt.d.ts +31 -0
- package/types/features/test-run/lib/backend.d.ts +39 -0
- package/types/features/test-run/lib/base.d.ts +10 -0
- package/types/features/test-run/lib/binaries.d.ts +11 -0
- package/types/features/test-run/lib/capture.d.ts +37 -0
- package/types/features/test-run/lib/captured.d.ts +47 -0
- package/types/features/test-run/lib/cassettes.d.ts +15 -0
- package/types/features/test-run/lib/corpus.d.ts +5 -0
- package/types/features/test-run/lib/coverage.d.ts +15 -0
- package/types/features/test-run/lib/dsl.d.ts +31 -0
- package/types/features/test-run/lib/evals.d.ts +26 -0
- package/types/features/test-run/lib/expect.d.ts +43 -0
- package/types/features/test-run/lib/failure.d.ts +15 -0
- package/types/features/test-run/lib/loadout.d.ts +37 -0
- package/types/features/test-run/lib/model.d.ts +63 -0
- package/types/features/test-run/lib/rules.d.ts +32 -0
- package/types/features/test-run/lib/run.d.ts +44 -0
- package/types/features/test-run/lib/runs.d.ts +25 -0
- package/types/features/test-run/lib/scope.d.ts +39 -0
- package/types/features/test-run/lib/selection.d.ts +24 -0
- package/types/features/test-run/lib/session.d.ts +19 -0
- package/types/features/test-run/lib/snapshot.d.ts +46 -0
- package/types/features/test-run/lib/spend.d.ts +14 -0
- package/types/features/test-run/lib/workspace.d.ts +3 -0
- package/types/features/test-run/starting-loadout.action.d.ts +8 -0
- package/types/features/test-run/test-run.action.d.ts +51 -0
- package/types/shared/cli/command.d.ts +19 -0
- package/types/shared/cli/index.d.ts +2 -0
- package/types/shared/cli/parse.d.ts +14 -0
- package/types/shared/codeowners/codeowners.d.ts +5 -0
- package/types/shared/codeowners/index.d.ts +1 -0
- package/types/shared/contract/activation.d.ts +8 -0
- package/types/shared/contract/config.d.ts +373 -0
- package/types/shared/contract/exit-code.d.ts +10 -0
- package/types/shared/contract/harness.d.ts +31 -0
- package/types/shared/contract/index.d.ts +15 -0
- package/types/shared/contract/inspection.d.ts +327 -0
- package/types/shared/contract/json-schema.d.ts +1572 -0
- package/types/shared/contract/limits.d.ts +58 -0
- package/types/shared/contract/lint.d.ts +272 -0
- package/types/shared/contract/loadout.d.ts +195 -0
- package/types/shared/contract/lockfile.d.ts +48 -0
- package/types/shared/contract/report.d.ts +1635 -0
- package/types/shared/contract/result.d.ts +27 -0
- package/types/shared/contract/session.d.ts +230 -0
- package/types/shared/contract/tests.d.ts +625 -0
- package/types/shared/contract/trace.d.ts +42 -0
- package/types/shared/i18n/catalog-type.d.ts +4 -0
- package/types/shared/i18n/catalog.d.ts +7 -0
- package/types/shared/i18n/format.d.ts +7 -0
- package/types/shared/i18n/index.d.ts +5 -0
- package/types/shared/i18n/locales/en/index.d.ts +637 -0
- package/types/shared/i18n/locales/index.d.ts +3 -0
- package/types/shared/i18n/resolve-locale.d.ts +9 -0
- package/types/shared/i18n/translate.d.ts +5 -0
- package/types/shared/infra/env.d.ts +3 -0
- package/types/shared/infra/file-lock.d.ts +6 -0
- package/types/shared/infra/http.d.ts +7 -0
- package/types/shared/infra/index.d.ts +5 -0
- package/types/shared/infra/parallel.d.ts +2 -0
- package/types/shared/infra/platform.d.ts +9 -0
- package/types/shared/mcp-shim/index.d.ts +2 -0
- package/types/shared/mcp-shim/read.d.ts +18 -0
- package/types/shared/mcp-shim/shim.d.ts +15 -0
- package/types/shared/redact/index.d.ts +2 -0
- package/types/shared/redact/patterns.d.ts +14 -0
- package/types/shared/redact/redact.d.ts +6 -0
- package/types/shared/render/choose.d.ts +9 -0
- package/types/shared/render/index.d.ts +5 -0
- package/types/shared/render/layout.d.ts +7 -0
- package/types/shared/render/plain.d.ts +2 -0
- package/types/shared/render/renderer.d.ts +10 -0
- package/types/shared/render/view.d.ts +8 -0
- package/types/shared/stats/index.d.ts +1 -0
- package/types/shared/stats/wilson.d.ts +20 -0
- package/types/shared/tokens/calibration/calibration.d.ts +25 -0
- package/types/shared/tokens/calibration/classify.d.ts +3 -0
- package/types/shared/tokens/calibration/index.d.ts +9 -0
- package/types/shared/tokens/count.d.ts +10 -0
- package/types/shared/tokens/index.d.ts +2 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type LocaleSources = {
|
|
2
|
+
flag?: string | undefined;
|
|
3
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
4
|
+
config?: string | undefined;
|
|
5
|
+
windowsUiLocale?: string | undefined;
|
|
6
|
+
intlLocale?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const languageOf: (value: string | undefined) => string | undefined;
|
|
9
|
+
export declare const resolveLocale: (sources: LocaleSources, supported: readonly string[]) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Catalog, MessageKey } from "./catalog-type.js";
|
|
2
|
+
export type Params = Readonly<Record<string, string | number | readonly string[]>>;
|
|
3
|
+
export type Translate = (key: MessageKey, params?: Params) => string;
|
|
4
|
+
export type OnMissing = (key: string, lang: string) => void;
|
|
5
|
+
export declare const createTranslator: (lang: string, catalogs?: Readonly<Record<string, Catalog>>, onMissing?: OnMissing) => Translate;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { type Env, isCi, isOn } from "./env.js";
|
|
2
|
+
export { type LockOptions, withFileLock } from "./file-lock.js";
|
|
3
|
+
export { DIRECT, type Egress, fetchThrough } from "./http.js";
|
|
4
|
+
export { allInOrder, inParallel } from "./parallel.js";
|
|
5
|
+
export { currentPlatform, PLATFORMS, type Platform, parsePlatform, platformKey } from "./platform.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type Platform = {
|
|
2
|
+
readonly os: string;
|
|
3
|
+
readonly arch: string;
|
|
4
|
+
readonly libc?: "glibc" | "musl";
|
|
5
|
+
};
|
|
6
|
+
export declare const platformKey: ({ os, arch, libc }: Platform) => string;
|
|
7
|
+
export declare const parsePlatform: (key: string) => Platform | undefined;
|
|
8
|
+
export declare const PLATFORMS: readonly Platform[];
|
|
9
|
+
export declare const currentPlatform: () => Platform;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type McpToolSchema = {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
inputSchema?: unknown;
|
|
5
|
+
};
|
|
6
|
+
export type ServerRecord = {
|
|
7
|
+
info: {
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
} | undefined;
|
|
11
|
+
instructions: string | undefined;
|
|
12
|
+
tools: McpToolSchema[];
|
|
13
|
+
calls: {
|
|
14
|
+
name: string;
|
|
15
|
+
arguments: unknown;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
export declare const readShimLog: (text: string) => ServerRecord;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ShimConfig = {
|
|
2
|
+
log: string;
|
|
3
|
+
env: Record<string, string>;
|
|
4
|
+
unset: string[];
|
|
5
|
+
patterns: {
|
|
6
|
+
source: string;
|
|
7
|
+
flags: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export type ShimLine = {
|
|
11
|
+
at: number;
|
|
12
|
+
from: "client" | "server";
|
|
13
|
+
message: unknown;
|
|
14
|
+
};
|
|
15
|
+
export declare const runMcpShim: (args: readonly string[]) => Promise<number>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Found = {
|
|
2
|
+
match: string;
|
|
3
|
+
groups: readonly (string | undefined)[];
|
|
4
|
+
offset: number;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
export type Pattern = {
|
|
8
|
+
id: string;
|
|
9
|
+
regex: RegExp;
|
|
10
|
+
accept?: (match: string) => boolean;
|
|
11
|
+
keywords?: readonly string[];
|
|
12
|
+
secret?: (found: Found) => string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare const BUILTIN_PATTERNS: readonly Pattern[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Env } from "#shared/infra/index.js";
|
|
2
|
+
export type RendererKind = "ink" | "plain";
|
|
3
|
+
export type Terminal = {
|
|
4
|
+
tty: boolean;
|
|
5
|
+
ci: boolean;
|
|
6
|
+
plain: boolean;
|
|
7
|
+
env: Env;
|
|
8
|
+
};
|
|
9
|
+
export declare const chooseRenderer: ({ tty, ci, plain, env }: Terminal) => RendererKind;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { chooseRenderer, type RendererKind, type Terminal } from "./choose.js";
|
|
2
|
+
export { type ColumnsOptions, columns, widthOf } from "./layout.js";
|
|
3
|
+
export { toPlain } from "./plain.js";
|
|
4
|
+
export { createPlainRenderer, createRenderer, type Renderer } from "./renderer.js";
|
|
5
|
+
export { type Line, type Span, span, type Tone, type View } from "./view.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Span, type View } from "./view.js";
|
|
2
|
+
export declare const widthOf: (text: string) => number;
|
|
3
|
+
export type ColumnsOptions = {
|
|
4
|
+
indent?: number;
|
|
5
|
+
gap?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const columns: (rows: readonly (readonly Span[])[], { indent, gap }?: ColumnsOptions) => View;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RendererKind } from "./choose.js";
|
|
2
|
+
import type { View } from "./view.js";
|
|
3
|
+
export type Renderer = {
|
|
4
|
+
print: (view: View) => void;
|
|
5
|
+
live: (view: View | undefined) => void;
|
|
6
|
+
keys: (onKey: ((key: string) => void) | undefined) => void;
|
|
7
|
+
close: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare const createPlainRenderer: (write: (text: string) => void) => Renderer;
|
|
10
|
+
export declare const createRenderer: (kind: RendererKind, stdout: NodeJS.WriteStream) => Promise<Renderer>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Tone = "plain" | "strong" | "accent" | "success" | "failure" | "warning" | "muted";
|
|
2
|
+
export type Span = {
|
|
3
|
+
readonly text: string;
|
|
4
|
+
readonly tone: Tone;
|
|
5
|
+
};
|
|
6
|
+
export type Line = readonly Span[];
|
|
7
|
+
export type View = readonly Line[];
|
|
8
|
+
export declare const span: (text: string, tone?: Tone) => Span;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fewestToProve, type Interval, type Judgement, judge, type Threshold, type Verdict, wilson, } from "./wilson.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Interval = {
|
|
2
|
+
rate: number;
|
|
3
|
+
low: number;
|
|
4
|
+
high: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const wilson: (successes: number, samples: number) => Interval;
|
|
7
|
+
export type Threshold = {
|
|
8
|
+
min: number;
|
|
9
|
+
} | {
|
|
10
|
+
max: number;
|
|
11
|
+
};
|
|
12
|
+
export type Verdict = "passed" | "failed" | "inconclusive";
|
|
13
|
+
export type Judgement = Interval & {
|
|
14
|
+
successes: number;
|
|
15
|
+
samples: number;
|
|
16
|
+
verdict: Verdict;
|
|
17
|
+
needed?: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const judge: (successes: number, samples: number, threshold: Threshold) => Judgement;
|
|
20
|
+
export declare const fewestToProve: (threshold: Threshold) => number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TokenCounter } from "../count.js";
|
|
2
|
+
import { type ContentClass } from "./classify.js";
|
|
3
|
+
export type ClassFactor = {
|
|
4
|
+
factor: number;
|
|
5
|
+
low: number;
|
|
6
|
+
high: number;
|
|
7
|
+
pieces: number;
|
|
8
|
+
};
|
|
9
|
+
export type Calibration = {
|
|
10
|
+
status: "unmeasured";
|
|
11
|
+
} | {
|
|
12
|
+
status: "measured";
|
|
13
|
+
provider: string;
|
|
14
|
+
model: string;
|
|
15
|
+
date: string;
|
|
16
|
+
ctxray: string;
|
|
17
|
+
classes: Record<ContentClass, ClassFactor>;
|
|
18
|
+
};
|
|
19
|
+
export type Measured = {
|
|
20
|
+
class: ContentClass;
|
|
21
|
+
local: number;
|
|
22
|
+
exact: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const factorsOf: (measured: readonly Measured[]) => Record<ContentClass, ClassFactor>;
|
|
25
|
+
export declare const calibratedCounter: (base: TokenCounter, calibration: Calibration) => TokenCounter | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Calibration } from "./calibration.js";
|
|
2
|
+
import type { ContentClass } from "./classify.js";
|
|
3
|
+
export { type Calibration, type ClassFactor, calibratedCounter, factorsOf, type Measured } from "./calibration.js";
|
|
4
|
+
export { CONTENT_CLASSES, type ContentClass, classify } from "./classify.js";
|
|
5
|
+
export declare const CORPUS: {
|
|
6
|
+
class: ContentClass;
|
|
7
|
+
text: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const ANTHROPIC_CALIBRATION: Calibration;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const LOCAL_METHOD = "local:o200k_base";
|
|
2
|
+
export declare const GEMMA_METHOD = "local:gemma4";
|
|
3
|
+
export declare const countTokens: (text: string) => number;
|
|
4
|
+
export type TokenCounter = {
|
|
5
|
+
method: string;
|
|
6
|
+
count: (text: string) => number;
|
|
7
|
+
};
|
|
8
|
+
export type ModelFamily = "google" | "anthropic" | "other";
|
|
9
|
+
export declare const isCalibrated: (family: ModelFamily) => boolean;
|
|
10
|
+
export declare const counterFor: (family: ModelFamily) => TokenCounter;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ANTHROPIC_CALIBRATION, type Calibration, CONTENT_CLASSES, CORPUS, type ContentClass, classify, factorsOf, } from "./calibration/index.js";
|
|
2
|
+
export { counterFor, countTokens, GEMMA_METHOD, isCalibrated, LOCAL_METHOD, type ModelFamily, type TokenCounter, } from "./count.js";
|