@wix/pathgrade 1.0.31 → 1.0.32
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/adapters/jest/invocation-adapter.d.ts +2 -2
- package/dist/adapters/jest/invocation-adapter.js +1 -1
- package/dist/adapters/jest/lifecycle.d.ts +3 -3
- package/dist/adapters/jest/lifecycle.js +1 -1
- package/dist/adapters/jest/metadata.d.ts +0 -1
- package/dist/adapters/jest/metadata.js +1 -1
- package/dist/adapters/jest/results.d.ts +3 -2
- package/dist/affected/format.d.ts +0 -23
- package/dist/affected/format.js +1 -1
- package/dist/affected/sidecar.d.ts +0 -1
- package/dist/affected/sidecar.js +1 -1
- package/dist/affected/types.d.ts +2 -17
- package/dist/agents/claude/ask-user-answer-store.d.ts +2 -1
- package/dist/agents/claude/tool-results.d.ts +1 -1
- package/dist/agents/claude/tool-results.js +1 -1
- package/dist/agents/claude.d.ts +2 -1
- package/dist/agents/codex-app-server/protocol/DynamicToolCallParams.d.ts +2 -1
- package/dist/agents/codex-app-server/protocol/GrantedPermissionProfile.d.ts +3 -2
- package/dist/agents/codex-app-server/protocol/McpElicitationRequestParams.d.ts +3 -2
- package/dist/agents/codex-app-server/protocol/PermissionsRequestApprovalParams.d.ts +3 -2
- package/dist/agents/codex-app-server/protocol/ThreadStartParams.d.ts +7 -6
- package/dist/agents/codex-app-server/protocol/TurnCompletedNotification.d.ts +2 -1
- package/dist/agents/codex-app-server/transport.d.ts +2 -2
- package/dist/commands/analyze.d.ts +0 -13
- package/dist/commands/report.d.ts +0 -7
- package/dist/commands/report.js +1 -1
- package/dist/core/generated-mcp-protocol.d.ts +0 -2
- package/dist/core/generated-mcp-protocol.js +2 -2
- package/dist/evals/discovery.d.ts +0 -1
- package/dist/evals/discovery.js +1 -1
- package/dist/internal/direct-mcp-v2/acp-client.d.ts +0 -8
- package/dist/internal/direct-mcp-v2/acp-direct-mcp.d.ts +2 -1
- package/dist/internal/direct-mcp-v2/claude-direct-mcp.d.ts +1 -1
- package/dist/internal/direct-mcp-v2/claude-profile.d.ts +0 -10
- package/dist/internal/direct-mcp-v2/claude-profile.js +3 -3
- package/dist/internal/direct-mcp-v2/codex-direct-mcp.d.ts +2 -1
- package/dist/internal/direct-mcp-v2/compiler.d.ts +0 -1
- package/dist/internal/direct-mcp-v2/compiler.js +1 -1
- package/dist/internal/direct-mcp-v2/json.d.ts +0 -2
- package/dist/internal/direct-mcp-v2/json.js +2 -2
- package/dist/internal/direct-mcp-v2/runtime-lock.d.ts +2 -1
- package/dist/internal/direct-mcp-v2/runtime-profile.d.ts +0 -1
- package/dist/internal/direct-mcp-v2/runtime-profile.js +1 -1
- package/dist/internal/direct-mcp-v2/types.d.ts +5 -4
- package/dist/providers/mcp-config.d.ts +0 -2
- package/dist/providers/mcp-config.js +2 -2
- package/dist/providers/mcp-runtime-mounting.d.ts +1 -9
- package/dist/providers/sandbox-lifecycle.d.ts +0 -2
- package/dist/providers/sandbox-lifecycle.js +2 -2
- package/dist/providers/scripted-mcp-mock-host.d.ts +1 -1
- package/dist/providers/workspace.d.ts +0 -1
- package/dist/reporters/github-comment.d.ts +0 -11
- package/dist/reporters/github-comment.js +1 -1
- package/dist/reporters/verbose-emitter.d.ts +7 -19
- package/dist/reporters/verbose-emitter.js +5 -5
- package/dist/reporting/types.d.ts +2 -1
- package/dist/runners/adapter-loader.d.ts +0 -3
- package/dist/runners/model-validation.d.ts +2 -1
- package/dist/runners/repeated-attempts.d.ts +0 -5
- package/dist/runners/repeated-attempts.js +1 -1
- package/dist/runners/vitest-invocation.d.ts +2 -2
- package/dist/runners/vitest-invocation.js +1 -1
- package/dist/runners/vitest-lifecycle.d.ts +0 -2
- package/dist/runners/vitest-lifecycle.js +1 -1
- package/dist/sdk/ask-bus/handler.d.ts +3 -2
- package/dist/sdk/diagnostics.d.ts +4 -3
- package/dist/sdk/judge-tool-runner.d.ts +1 -2
- package/dist/sdk/mcp-mock-approvals.d.ts +3 -2
- package/dist/sdk/reaction-loader.d.ts +1 -2
- package/dist/sdk/reaction-preview.d.ts +1 -4
- package/dist/sdk/reaction-preview.js +3 -3
- package/dist/sdk/run-scorer.d.ts +1 -4
- package/dist/sdk/run-scorer.js +3 -3
- package/dist/sdk/runtime-policy.d.ts +0 -1
- package/dist/sdk/runtime-policy.js +1 -1
- package/dist/tool-events.d.ts +0 -1
- package/dist/tool-events.js +1 -1
- package/dist/types.d.ts +8 -26
- package/dist/types.js +1 -1
- package/dist/utils/cli.d.ts +0 -15
- package/dist/utils/cli.js +4 -4
- package/dist/utils/llm-mocks.d.ts +3 -2
- package/dist/utils/llm-providers/cli.d.ts +0 -1
- package/dist/utils/llm-providers/cli.js +1 -1
- package/dist/utils/llm-types.d.ts +4 -3
- package/dist/utils/llm.d.ts +2 -2
- package/dist/utils/llm.js +1 -1
- package/package.json +2 -2
|
@@ -29,9 +29,7 @@ export type McpDeclaration = {
|
|
|
29
29
|
} | {
|
|
30
30
|
mock: MockMcpServerDescriptor | MockMcpServerDescriptor[];
|
|
31
31
|
};
|
|
32
|
-
export declare const MCP_CONFIG_FILENAME = ".pathgrade-mcp.json";
|
|
33
32
|
export declare function readStagedMcpServers(workspacePath: string, mcpConfigPath?: string): Promise<Record<string, McpConfigFileEntry> | undefined>;
|
|
34
|
-
export declare function missingMcpSecretReferences(mcpServers: Record<string, McpConfigFileEntry> | undefined, env: Record<string, string | undefined>): string[];
|
|
35
33
|
export declare function assertMcpSecretReferencesReady(opts: {
|
|
36
34
|
workspacePath: string;
|
|
37
35
|
mcpConfigPath?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
|
|
3
|
+
const MCP_CONFIG_FILENAME = '.pathgrade-mcp.json';
|
|
4
4
|
const GENERATED_MOCK_SERVER_FILENAME = '.pathgrade-mcp-mock-server.cjs';
|
|
5
5
|
function isRecord(value) {
|
|
6
6
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
@@ -76,7 +76,7 @@ export async function readStagedMcpServers(workspacePath, mcpConfigPath = MCP_CO
|
|
|
76
76
|
return undefined;
|
|
77
77
|
return readMcpServers(await fs.readJson(configPath));
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
function missingMcpSecretReferences(mcpServers, env) {
|
|
80
80
|
if (!mcpServers)
|
|
81
81
|
return [];
|
|
82
82
|
const missing = [];
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import type { McpStdioEntry } from './mcp-config.js';
|
|
2
2
|
import type { McpSafetyOptions } from '../sdk/mcp-safety.js';
|
|
3
|
-
|
|
3
|
+
type ClaudeSdkMcpServerEntry = McpStdioEntry | {
|
|
4
4
|
type: 'http';
|
|
5
5
|
url: string;
|
|
6
6
|
headers?: Record<string, string>;
|
|
7
7
|
};
|
|
8
8
|
/** Object form of MCP server entries the SDK driver passes to `Options.mcpServers`. */
|
|
9
9
|
export type McpServersObject = Record<string, ClaudeSdkMcpServerEntry>;
|
|
10
|
-
export type CodexMcpServerEntry = McpStdioEntry | {
|
|
11
|
-
url: string;
|
|
12
|
-
http_headers?: Record<string, string>;
|
|
13
|
-
env_http_headers?: Record<string, string>;
|
|
14
|
-
bearer_token_env_var?: string;
|
|
15
|
-
startup_timeout_sec?: number;
|
|
16
|
-
tool_timeout_sec?: number;
|
|
17
|
-
};
|
|
18
10
|
export interface CodexAppServerMcpConfig extends Record<string, unknown> {
|
|
19
11
|
mcp_servers: Record<string, unknown>;
|
|
20
12
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const SANDBOX_PREFIX = "pathgrade-";
|
|
2
1
|
export declare const SANDBOX_MARKER = ".pathgrade-sandbox.json";
|
|
3
|
-
export declare const STALE_SANDBOX_AGE_MS: number;
|
|
4
2
|
interface RemoveSandboxRootOptions {
|
|
5
3
|
remove?: (target: string) => Promise<void>;
|
|
6
4
|
sleep?: (ms: number) => Promise<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import * as os from 'os';
|
|
3
3
|
import * as path from 'path';
|
|
4
|
-
|
|
4
|
+
const SANDBOX_PREFIX = 'pathgrade-';
|
|
5
5
|
export const SANDBOX_MARKER = '.pathgrade-sandbox.json';
|
|
6
|
-
|
|
6
|
+
const STALE_SANDBOX_AGE_MS = 24 * 60 * 60 * 1_000;
|
|
7
7
|
let startupCleanup;
|
|
8
8
|
const SANDBOX_REMOVE_RETRY_DELAYS_MS = [
|
|
9
9
|
50,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ToolEvent } from '../tool-events.js';
|
|
2
2
|
import { type CompiledMcpMockSession } from '../sdk/mcp-mock-approvals.js';
|
|
3
|
-
|
|
3
|
+
interface ScriptedMcpDecision {
|
|
4
4
|
decision: 'approve' | 'deny';
|
|
5
5
|
outcome: 'matched' | 'unmatched' | 'protocol_error';
|
|
6
6
|
reason: 'rule_match' | 'no_matching_rule' | 'protocol_error';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type SandboxConfig } from './sandbox.js';
|
|
2
2
|
import type { CommandResult, McpConfigOrigin } from '../types.js';
|
|
3
|
-
export type { McpDeclaration } from './mcp-config.js';
|
|
4
3
|
export interface Workspace {
|
|
5
4
|
readonly path: string;
|
|
6
5
|
readonly mcpConfigPath: string | undefined;
|
|
@@ -26,17 +26,6 @@ export declare function commentMarker(commentId: string): string;
|
|
|
26
26
|
* posted as a GitHub issue comment body.
|
|
27
27
|
*/
|
|
28
28
|
export declare function formatReportMarkdown(report: PathgradeReport, opts: FormatOptions): string;
|
|
29
|
-
/**
|
|
30
|
-
* Render the `### Selection` section for the PR comment. Pure: no fs,
|
|
31
|
-
* no network, no reporter side effects. Three variants:
|
|
32
|
-
*
|
|
33
|
-
* - `global_match` set → "global trigger fired" one-liner, no collapsible.
|
|
34
|
-
* - `skipped` empty + `selected` non-empty → "every eval had a matching
|
|
35
|
-
* change" one-liner.
|
|
36
|
-
* - otherwise → "Ran **X of Y**" line + `<details>` block listing
|
|
37
|
-
* skipped eval paths as inline code.
|
|
38
|
-
*/
|
|
39
|
-
export declare function formatSelectionSection(selection: PathgradeSelectionReport): string;
|
|
40
29
|
export interface PrContext {
|
|
41
30
|
owner: string;
|
|
42
31
|
repo: string;
|
|
@@ -114,7 +114,7 @@ export function formatReportMarkdown(report, opts) {
|
|
|
114
114
|
* - otherwise → "Ran **X of Y**" line + `<details>` block listing
|
|
115
115
|
* skipped eval paths as inline code.
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
function formatSelectionSection(selection) {
|
|
118
118
|
const out = [];
|
|
119
119
|
out.push('### Selection');
|
|
120
120
|
const total = selection.selected.length + selection.skipped.length;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/** Maximum characters retained in a prompt/reply preview before truncation. */
|
|
2
|
-
export declare const PREVIEW_MAX_CHARS = 80;
|
|
3
|
-
/** Maximum characters retained in a retry error message before truncation. */
|
|
4
|
-
export declare const RETRY_ERROR_MAX_CHARS = 120;
|
|
5
|
-
/** Ellipsis appended to truncated strings. */
|
|
6
|
-
export declare const TRUNCATION_SUFFIX = "\u2026";
|
|
7
|
-
/** Newline replacement in single-line previews. */
|
|
8
|
-
export declare const NEWLINE_REPLACEMENT = "\u23CE";
|
|
9
1
|
export interface VerboseSink {
|
|
10
2
|
write(line: string): void;
|
|
11
3
|
}
|
|
@@ -19,33 +11,33 @@ export interface VerboseEmitterOptions {
|
|
|
19
11
|
*/
|
|
20
12
|
testName?: string;
|
|
21
13
|
}
|
|
22
|
-
|
|
14
|
+
interface TurnStartArgs {
|
|
23
15
|
turn: number;
|
|
24
16
|
kind: 'agent_start' | 'user_reply';
|
|
25
17
|
message: string;
|
|
26
18
|
}
|
|
27
|
-
|
|
19
|
+
interface ToolEventArgs {
|
|
28
20
|
action: string;
|
|
29
21
|
summary: string;
|
|
30
22
|
}
|
|
31
|
-
|
|
23
|
+
interface TurnEndArgs {
|
|
32
24
|
turn: number;
|
|
33
25
|
durationMs: number;
|
|
34
26
|
outputLines: number;
|
|
35
27
|
messagePreview: string;
|
|
36
28
|
}
|
|
37
|
-
|
|
29
|
+
interface RetryArgs {
|
|
38
30
|
attempt: number;
|
|
39
31
|
maxAttempts: number;
|
|
40
32
|
errorMessage: string;
|
|
41
33
|
}
|
|
42
|
-
|
|
34
|
+
interface ReactionFiredArgs {
|
|
43
35
|
turn: number;
|
|
44
36
|
reactionIndex: number;
|
|
45
37
|
pattern: string;
|
|
46
38
|
reply: string;
|
|
47
39
|
}
|
|
48
|
-
|
|
40
|
+
interface ConversationEndArgs {
|
|
49
41
|
reason: string;
|
|
50
42
|
turns: number;
|
|
51
43
|
durationMs: number;
|
|
@@ -61,9 +53,5 @@ export interface VerboseEmitter {
|
|
|
61
53
|
reactionFired(args: ReactionFiredArgs): void;
|
|
62
54
|
conversationEnd(args: ConversationEndArgs): void;
|
|
63
55
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Build a preview string: strip newlines, truncate to a max length.
|
|
66
|
-
* `null` / `undefined` becomes an empty string so formatting never throws.
|
|
67
|
-
*/
|
|
68
|
-
export declare function preview(text: string | null | undefined, max?: number): string;
|
|
69
56
|
export declare function createVerboseEmitter(opts: VerboseEmitterOptions): VerboseEmitter;
|
|
57
|
+
export {};
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { fmt } from '../utils/cli.js';
|
|
12
12
|
/** Maximum characters retained in a prompt/reply preview before truncation. */
|
|
13
|
-
|
|
13
|
+
const PREVIEW_MAX_CHARS = 80;
|
|
14
14
|
/** Maximum characters retained in a retry error message before truncation. */
|
|
15
|
-
|
|
15
|
+
const RETRY_ERROR_MAX_CHARS = 120;
|
|
16
16
|
/** Ellipsis appended to truncated strings. */
|
|
17
|
-
|
|
17
|
+
const TRUNCATION_SUFFIX = '…';
|
|
18
18
|
/** Newline replacement in single-line previews. */
|
|
19
|
-
|
|
19
|
+
const NEWLINE_REPLACEMENT = '⏎';
|
|
20
20
|
/**
|
|
21
21
|
* Build a preview string: strip newlines, truncate to a max length.
|
|
22
22
|
* `null` / `undefined` becomes an empty string so formatting never throws.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
function preview(text, max = PREVIEW_MAX_CHARS) {
|
|
25
25
|
const normalized = (text ?? '').replace(/\r?\n/g, NEWLINE_REPLACEMENT);
|
|
26
26
|
if (normalized.length <= max)
|
|
27
27
|
return normalized;
|
|
@@ -75,9 +75,10 @@ export interface ReportSummaryGroup {
|
|
|
75
75
|
trial_count: number;
|
|
76
76
|
diagnostics: ReportSummaryDiagnostics[];
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
interface ReportSummaryDiagnostics {
|
|
79
79
|
caseName: string;
|
|
80
80
|
state: ReportCaseState;
|
|
81
81
|
resultKind?: EvaluationResultKind;
|
|
82
82
|
report: DiagnosticsReport;
|
|
83
83
|
}
|
|
84
|
+
export {};
|
|
@@ -2,9 +2,6 @@ import type { ResolvedPathgradeConfig } from '../config/pathgrade.js';
|
|
|
2
2
|
import { type SpawnVitest } from './vitest-invocation.js';
|
|
3
3
|
import type { RunnerAdapter } from './adapter.js';
|
|
4
4
|
import type { RunnerInvocationAdapter } from './invocation.js';
|
|
5
|
-
export interface ExternalAdapterFactoryInput {
|
|
6
|
-
config: ResolvedPathgradeConfig;
|
|
7
|
-
}
|
|
8
5
|
export declare function loadRunnerAdapter(input: {
|
|
9
6
|
adapterName?: string;
|
|
10
7
|
cwd?: string;
|
|
@@ -3,10 +3,11 @@ export interface NormalizedRunValidationResult {
|
|
|
3
3
|
ok: boolean;
|
|
4
4
|
errors: NormalizedRunValidationError[];
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface NormalizedRunValidationError {
|
|
7
7
|
path: string;
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function validateNormalizedRunSnapshot(snapshot: NormalizedRunSnapshot, options: {
|
|
11
11
|
completeness: SnapshotCompleteness;
|
|
12
12
|
}): NormalizedRunValidationResult;
|
|
13
|
+
export {};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
import type { NormalizedRunSnapshot } from './model.js';
|
|
2
|
-
export type RepeatAggregationFailure = 'incomplete_attempts' | 'case_identity_mismatch';
|
|
3
|
-
export declare class RepeatAggregationError extends Error {
|
|
4
|
-
readonly reason: RepeatAggregationFailure;
|
|
5
|
-
constructor(reason: RepeatAggregationFailure, message: string);
|
|
6
|
-
}
|
|
7
2
|
export declare function mergeRepeatedRunSnapshots(snapshots: readonly NormalizedRunSnapshot[]): NormalizedRunSnapshot;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { validateNormalizedRunSnapshot } from './model-validation.js';
|
|
3
|
-
|
|
3
|
+
class RepeatAggregationError extends Error {
|
|
4
4
|
reason;
|
|
5
5
|
constructor(reason, message) {
|
|
6
6
|
super(message);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RunnerInvocationAdapter } from './invocation.js';
|
|
2
|
-
|
|
2
|
+
interface SpawnVitestRequest {
|
|
3
3
|
argv: string[];
|
|
4
4
|
env: NodeJS.ProcessEnv;
|
|
5
5
|
cwd: string;
|
|
@@ -8,4 +8,4 @@ export type SpawnVitest = (req: SpawnVitestRequest) => Promise<number> | number;
|
|
|
8
8
|
export declare function createVitestInvocationAdapter(input?: {
|
|
9
9
|
spawnVitest?: SpawnVitest;
|
|
10
10
|
}): RunnerInvocationAdapter;
|
|
11
|
-
export
|
|
11
|
+
export {};
|
|
@@ -47,7 +47,7 @@ async function defaultSpawnVitest(req) {
|
|
|
47
47
|
child.on('close', code => resolve(code ?? 0));
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
function resolveVitestCli(cwd) {
|
|
51
51
|
const requireFromCwd = createRequire(path.join(cwd, 'package.json'));
|
|
52
52
|
const packageJsonPath = requireFromCwd.resolve('vitest/package.json');
|
|
53
53
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Agent, PathgradeTestMeta } from '../sdk/types.js';
|
|
2
2
|
import { type ResultObserverHandle } from '../sdk/result-capture.js';
|
|
3
3
|
import { type CaseContextProviderHandle } from '../sdk/case-context.js';
|
|
4
|
-
import { type LifecycleAgentOwner } from '../sdk/lifecycle.js';
|
|
5
4
|
import type { AdapterLifecycleHooks, EvalResultEvent } from './adapter.js';
|
|
6
5
|
export type VitestAfterEachFn = (fn: (ctx: {
|
|
7
6
|
task: {
|
|
@@ -31,7 +30,6 @@ export interface VitestLifecycleInstallHandle {
|
|
|
31
30
|
}
|
|
32
31
|
export declare function createVitestLifecycleHooks(): AdapterLifecycleHooks;
|
|
33
32
|
export declare function installVitestLifecycle(input: VitestLifecycleInstallInput): VitestLifecycleInstallHandle;
|
|
34
|
-
export declare function currentVitestAgentOwner(resultCaptureActive: boolean): LifecycleAgentOwner | null;
|
|
35
33
|
export declare function trackVitestAgent(agent: Agent, resultCaptureActive: boolean): void;
|
|
36
34
|
export declare function untrackVitestAgent(agent: Agent): void;
|
|
37
35
|
export declare function releaseVitestAgent(agent: Agent): void;
|
|
@@ -43,7 +43,7 @@ export function installVitestLifecycle(input) {
|
|
|
43
43
|
fileContextHandle.restore();
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
function currentVitestAgentOwner(resultCaptureActive) {
|
|
47
47
|
const current = getCurrentCaseContext();
|
|
48
48
|
if (current.status === 'active') {
|
|
49
49
|
return current.context.scope === 'runner-case'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AskHandler } from './types.js';
|
|
2
2
|
import type { AskUserReactionPreviewEntry, Reaction } from '../types.js';
|
|
3
|
-
|
|
3
|
+
type UnmatchedAskUserDisposition = 'error' | 'first-option' | 'decline';
|
|
4
4
|
export interface AskUserHandlerContext {
|
|
5
5
|
reactions: readonly Reaction[];
|
|
6
6
|
onUnmatchedAskUser: UnmatchedAskUserDisposition;
|
|
7
7
|
firedOnce: Set<number>;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface AskUserUnmatchedSignal {
|
|
10
10
|
batchId: string;
|
|
11
11
|
turnNumber: number;
|
|
12
12
|
/**
|
|
@@ -29,3 +29,4 @@ export interface AskUserHandlerApi {
|
|
|
29
29
|
getUnmatchedError(): AskUserUnmatchedSignal | null;
|
|
30
30
|
}
|
|
31
31
|
export declare function createAskUserHandler(ctx: AskUserHandlerContext): AskUserHandlerApi;
|
|
32
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LogEntry } from '../types.js';
|
|
2
2
|
import type { ReactionFiredEntry, TurnDetail } from './types.js';
|
|
3
3
|
import { type RuntimePolicyAuditEntry } from './runtime-policy.js';
|
|
4
|
-
|
|
4
|
+
interface DiagnosticsScorer {
|
|
5
5
|
name: string;
|
|
6
6
|
type: string;
|
|
7
7
|
score: number;
|
|
@@ -9,10 +9,10 @@ export interface DiagnosticsScorer {
|
|
|
9
9
|
details?: string;
|
|
10
10
|
status?: 'ok' | 'error' | 'skipped';
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface DiagnosticsTurnDetail extends TurnDetail {
|
|
13
13
|
apiRetries: number;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
type DiagnosticsRuntimePolicyEntry = RuntimePolicyAuditEntry;
|
|
16
16
|
export interface DiagnosticsReport {
|
|
17
17
|
turns: number;
|
|
18
18
|
totalDurationMs: number;
|
|
@@ -39,3 +39,4 @@ export interface BuildDiagnosticsReportInput {
|
|
|
39
39
|
log: LogEntry[];
|
|
40
40
|
}
|
|
41
41
|
export declare function buildDiagnosticsReport(input: BuildDiagnosticsReportInput): DiagnosticsReport;
|
|
42
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ToolCapableLLMPort } from '../utils/llm-types.js';
|
|
2
2
|
import type { JudgeScorer, ScorerContext, ScorerResultEntry, TokenUsage } from './types.js';
|
|
3
|
-
import { type
|
|
4
|
-
export type { JudgeErrorCode, JudgeToolCallRecord };
|
|
3
|
+
import { type JudgeToolCallRecord, type ToolExecutor } from './judge-tool-session.js';
|
|
5
4
|
export interface RunJudgeWithToolsResult {
|
|
6
5
|
entry: ScorerResultEntry;
|
|
7
6
|
rounds: number;
|
|
@@ -9,7 +9,7 @@ export interface McpMockApprovalRule {
|
|
|
9
9
|
decision: 'approve' | 'deny';
|
|
10
10
|
label?: string;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface CompiledMcpTool {
|
|
13
13
|
name: string;
|
|
14
14
|
description?: string;
|
|
15
15
|
inputSchema: Record<string, unknown>;
|
|
@@ -19,7 +19,7 @@ export interface CompiledMcpTool {
|
|
|
19
19
|
response: McpMockJsonValue;
|
|
20
20
|
}>[];
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
interface CompiledMcpServer {
|
|
23
23
|
name: string;
|
|
24
24
|
instructions?: string;
|
|
25
25
|
tools: ReadonlyMap<string, CompiledMcpTool>;
|
|
@@ -38,3 +38,4 @@ export declare function matchesMcpApprovalArguments(actual: Record<string, McpMo
|
|
|
38
38
|
export declare function canonicalizeMcpArguments(value: McpMockJsonValue): string;
|
|
39
39
|
export declare function createMcpArgumentDigest(key: Buffer, value: McpMockJsonValue): string;
|
|
40
40
|
export declare function createMcpReceiptKey(): Buffer;
|
|
41
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Message, Reaction } from './types.js';
|
|
2
2
|
export declare function loadReactionSnapshotMessages(snapshotPath: string): Promise<Message[]>;
|
|
3
3
|
export declare function loadReactionsFromFile(filePath: string): Promise<Reaction[]>;
|
|
4
|
-
export type { AskUserOption, AskUserQuestion, AskUserReaction, TextReaction };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function isAskUserReaction(reaction: Reaction): reaction is AskUserReaction;
|
|
3
|
-
export declare function isTextReaction(reaction: Reaction): reaction is TextReaction;
|
|
1
|
+
import type { Message, Reaction, ReactionPreviewEntry, ReactionPreviewResult } from './types.js';
|
|
4
2
|
export declare function inspectReactions(agentMessage: string, reactions: Reaction[], firedOnce: Set<number>): ReactionPreviewEntry[];
|
|
5
|
-
export declare function pickReactionReply(agentMessage: string, reactions: Reaction[], firedOnce: Set<number>): string | null;
|
|
6
3
|
export declare function previewReactions(messages: Message[], reactions: Reaction[]): ReactionPreviewResult;
|
|
@@ -20,10 +20,10 @@ function testUnless(pattern, input) {
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
function isAskUserReaction(reaction) {
|
|
24
24
|
return 'whenAsked' in reaction;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
function isTextReaction(reaction) {
|
|
27
27
|
return 'when' in reaction;
|
|
28
28
|
}
|
|
29
29
|
export function inspectReactions(agentMessage, reactions, firedOnce) {
|
|
@@ -71,7 +71,7 @@ export function inspectReactions(agentMessage, reactions, firedOnce) {
|
|
|
71
71
|
};
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
function pickReactionReply(agentMessage, reactions, firedOnce) {
|
|
75
75
|
const evaluations = inspectReactions(agentMessage, reactions, firedOnce);
|
|
76
76
|
const match = evaluations.find((evaluation) => evaluation.fired && evaluation.kind === 'text');
|
|
77
77
|
return match && match.kind === 'text' ? match.reply ?? null : null;
|
package/dist/sdk/run-scorer.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { LLMPort } from '../utils/llm-types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Scorer, ScorerContext, ScorerResultEntry } from './types.js';
|
|
3
3
|
export interface RunScorerOptions {
|
|
4
4
|
/** Required for `judge` scorers; ignored for other types. */
|
|
5
5
|
llm?: LLMPort;
|
|
6
6
|
}
|
|
7
7
|
export declare function runScorer(scorer: Scorer, ctx: ScorerContext, opts?: RunScorerOptions): Promise<ScorerResultEntry>;
|
|
8
|
-
export declare function runCheckScorer(scorer: CheckScorer, ctx: ScorerContext): Promise<ScorerResultEntry>;
|
|
9
|
-
export declare function runScoreScorer(scorer: ScoreScorer, ctx: ScorerContext): Promise<ScorerResultEntry>;
|
|
10
|
-
export declare function runToolUsageScorer(scorer: ToolUsageScorer, ctx: ScorerContext): Promise<ScorerResultEntry>;
|
package/dist/sdk/run-scorer.js
CHANGED
|
@@ -43,7 +43,7 @@ function buildEntryFromOutcome(scorer, outcome) {
|
|
|
43
43
|
errorCode: outcome.code,
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
async function runCheckScorer(scorer, ctx) {
|
|
47
47
|
try {
|
|
48
48
|
const passed = await scorer.fn(ctx);
|
|
49
49
|
return {
|
|
@@ -59,7 +59,7 @@ export async function runCheckScorer(scorer, ctx) {
|
|
|
59
59
|
return makeErroredResult('check', scorer.name, scorer.weight, error);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
async function runScoreScorer(scorer, ctx) {
|
|
63
63
|
try {
|
|
64
64
|
const raw = await scorer.fn(ctx);
|
|
65
65
|
if (typeof raw === 'number') {
|
|
@@ -84,7 +84,7 @@ export async function runScoreScorer(scorer, ctx) {
|
|
|
84
84
|
return makeErroredResult('score', scorer.name, scorer.weight, error);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
async function runToolUsageScorer(scorer, ctx) {
|
|
88
88
|
try {
|
|
89
89
|
const toolEvents = ctx.toolEvents;
|
|
90
90
|
if (toolEvents.length === 0) {
|
|
@@ -15,7 +15,6 @@ export interface RuntimePolicyAuditEntry {
|
|
|
15
15
|
export declare const NONINTERACTIVE_RUNTIME_POLICY: RuntimePolicyDescriptor;
|
|
16
16
|
export declare function planRuntimePolicies(agent: AgentName, transport?: AgentTransport): RuntimePolicyDescriptor[];
|
|
17
17
|
export declare function renderRuntimePolicy(policy: RuntimePolicyDescriptor, context: RuntimePolicyRenderContext): string;
|
|
18
|
-
export declare function renderRuntimePolicies(policies: RuntimePolicyDescriptor[], context: RuntimePolicyRenderContext): string;
|
|
19
18
|
export declare function prependRuntimePolicies(instruction: string, policies: RuntimePolicyDescriptor[], context: RuntimePolicyRenderContext): string;
|
|
20
19
|
export declare function getRuntimePolicyLogMetadata(turnResult: AgentTurnResult): Record<string, unknown>;
|
|
21
20
|
export declare function extractRuntimePolicyAuditEntries(log: LogEntry[]): RuntimePolicyAuditEntry[];
|
|
@@ -32,7 +32,7 @@ export function renderRuntimePolicy(policy, context) {
|
|
|
32
32
|
'Ask only the earliest outstanding approval checkpoint.',
|
|
33
33
|
].join('\n');
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
function renderRuntimePolicies(policies, context) {
|
|
36
36
|
return policies
|
|
37
37
|
.map((policy) => renderRuntimePolicy(policy, context))
|
|
38
38
|
.filter((policy) => policy.length > 0)
|
package/dist/tool-events.d.ts
CHANGED
|
@@ -44,7 +44,6 @@ export interface ToolEventResult {
|
|
|
44
44
|
exitCode?: number;
|
|
45
45
|
truncated?: boolean;
|
|
46
46
|
}
|
|
47
|
-
export declare function summarizeToolEvents(events: ToolEvent[]): string;
|
|
48
47
|
/**
|
|
49
48
|
* Map from provider-specific tool names to normalized Pathgrade actions.
|
|
50
49
|
* Conservative: only map names we're confident about.
|
package/dist/tool-events.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ export interface CommandResult {
|
|
|
8
8
|
timedOut?: boolean;
|
|
9
9
|
killed?: boolean;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
interface TurnCommand extends CommandResult {
|
|
12
12
|
command: string;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
type ConversationReplySource = 'opener' | 'reaction' | 'persona_llm';
|
|
15
15
|
export interface ConversationTurn {
|
|
16
16
|
turn_number: number;
|
|
17
17
|
user_message: string;
|
|
@@ -24,7 +24,7 @@ export interface ConversationTurn {
|
|
|
24
24
|
step_scorer_results?: ScorerResult[];
|
|
25
25
|
tool_events?: import('./tool-events.js').ToolEvent[];
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
type ConversationCompletionReason = 'max_turns' | 'signal' | 'done_phrase' | 'done_when' | 'timeout' | 'no_replies' | 'error';
|
|
28
28
|
export interface ScorerResult {
|
|
29
29
|
scorer_type: string;
|
|
30
30
|
score: number;
|
|
@@ -32,25 +32,7 @@ export interface ScorerResult {
|
|
|
32
32
|
details: string;
|
|
33
33
|
status?: import('./sdk/types.js').ScorerStatus;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
* JSON contract for deterministic scorer stdout.
|
|
37
|
-
* The scorer script must print a JSON object matching this shape to stdout.
|
|
38
|
-
*/
|
|
39
|
-
export interface ScorerOutput {
|
|
40
|
-
/** Score between 0.0 and 1.0 (required). Clamped by pathgrade. */
|
|
41
|
-
score: number;
|
|
42
|
-
/** Human-readable summary (optional). */
|
|
43
|
-
details?: string;
|
|
44
|
-
/** Per-check breakdown, rendered as checkmarks in reports (optional). */
|
|
45
|
-
checks?: ScorerCheck[];
|
|
46
|
-
}
|
|
47
|
-
/** Individual check result within a ScorerOutput. */
|
|
48
|
-
export interface ScorerCheck {
|
|
49
|
-
name: string;
|
|
50
|
-
passed: boolean;
|
|
51
|
-
message?: string;
|
|
52
|
-
}
|
|
53
|
-
export interface JudgeToolCallLogData {
|
|
35
|
+
interface JudgeToolCallLogData {
|
|
54
36
|
/** Tool name (readFile | listDir | grep | getToolEvents). */
|
|
55
37
|
name: string;
|
|
56
38
|
/** Arguments the LLM passed to the tool. */
|
|
@@ -300,7 +282,7 @@ export interface PathgradeReport {
|
|
|
300
282
|
selection?: PathgradeSelectionReport;
|
|
301
283
|
}
|
|
302
284
|
export type PassAtKUnavailableReason = 'non_binary_reward' | 'incomplete_attempts' | 'case_identity_mismatch';
|
|
303
|
-
|
|
285
|
+
interface TrialPaths {
|
|
304
286
|
root: string;
|
|
305
287
|
workspace: string;
|
|
306
288
|
home: string;
|
|
@@ -317,11 +299,11 @@ export interface TrialRuntime {
|
|
|
317
299
|
}
|
|
318
300
|
export type EnvironmentHandle = string | TrialRuntime;
|
|
319
301
|
export type AgentCommandRunner = (cmd: string) => Promise<CommandResult>;
|
|
320
|
-
|
|
302
|
+
interface AgentTurnInput {
|
|
321
303
|
message: string;
|
|
322
304
|
continueSession?: boolean;
|
|
323
305
|
}
|
|
324
|
-
|
|
306
|
+
type VisibleAssistantMessageSource = 'assistant_message';
|
|
325
307
|
export interface AgentTurnResult {
|
|
326
308
|
rawOutput: string;
|
|
327
309
|
assistantMessage: string;
|
|
@@ -395,7 +377,6 @@ export interface AgentSession {
|
|
|
395
377
|
dispose?(): Promise<void>;
|
|
396
378
|
}
|
|
397
379
|
export declare function getWorkspacePath(handle: EnvironmentHandle): string;
|
|
398
|
-
export declare function getRuntimeHandle(handle: EnvironmentHandle): string;
|
|
399
380
|
export declare function getRuntimeEnv(handle: EnvironmentHandle): Record<string, string>;
|
|
400
381
|
export type McpConfigOrigin = 'generated_mock' | 'caller_config';
|
|
401
382
|
export interface AgentSessionOptions {
|
|
@@ -449,3 +430,4 @@ export declare abstract class BaseAgent {
|
|
|
449
430
|
run(_instruction: string, _workspacePath: string, _runCommand: AgentCommandRunner): Promise<string>;
|
|
450
431
|
}
|
|
451
432
|
export declare function createAgentSession(agent: BaseAgent, runtime: EnvironmentHandle, runCommand: AgentCommandRunner, options?: AgentSessionOptions): Promise<AgentSession>;
|
|
433
|
+
export {};
|
package/dist/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function getWorkspacePath(handle) {
|
|
2
2
|
return typeof handle === 'string' ? handle : handle.workspacePath;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
function getRuntimeHandle(handle) {
|
|
5
5
|
return typeof handle === 'string' ? handle : handle.handle;
|
|
6
6
|
}
|
|
7
7
|
export function getRuntimeEnv(handle) {
|
package/dist/utils/cli.d.ts
CHANGED
|
@@ -15,21 +15,6 @@ export declare const fmt: {
|
|
|
15
15
|
};
|
|
16
16
|
/** Print a section header with a rule line */
|
|
17
17
|
export declare function header(title: string, width?: number): void;
|
|
18
|
-
/** Print a labeled key-value pair */
|
|
19
|
-
export declare function kv(label: string, value: string, indent?: number): void;
|
|
20
|
-
/** Print a trial result row */
|
|
21
|
-
export declare function trialRow(trialId: number, total: number, reward: number, duration: string, commands: number, scorers: {
|
|
22
|
-
type: string;
|
|
23
|
-
score: number;
|
|
24
|
-
}[]): void;
|
|
25
|
-
/** Print the results summary block */
|
|
26
|
-
export declare function resultsSummary(passRate: number, passAtK: number, passPowK: number, trials: number, preset?: string): void;
|
|
27
|
-
/** Print a validation result */
|
|
28
|
-
export declare function validationResult(passed: boolean, reward: number, scorers: {
|
|
29
|
-
type: string;
|
|
30
|
-
score: number;
|
|
31
|
-
details: string;
|
|
32
|
-
}[]): void;
|
|
33
18
|
/**
|
|
34
19
|
* In-place spinner that shows current phase + elapsed time on one line.
|
|
35
20
|
*
|