@kyo-so/cli 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/kyoso-review/SKILL.md +13 -3
- package/CHANGELOG.md +63 -0
- package/README.ja.md +214 -132
- package/README.md +214 -135
- package/README.zh-CN.md +214 -132
- package/dist/acp/AcpAgentProcess.d.ts +2 -1
- package/dist/acp/FakeAgentManager.d.ts +1 -1
- package/dist/bin/kyoso.js +27044 -25063
- package/dist/cli/knownSkillDigests.d.ts +1 -1
- package/dist/cli/openRouterAcpSmoke.d.ts +25 -0
- package/dist/cli/pluginRuntimeContract.d.ts +10 -8
- package/dist/cli/setup.d.ts +3 -2
- package/dist/config/loadConfig.d.ts +19 -0
- package/dist/config/projectScope.d.ts +1 -1
- package/dist/config/schema.d.ts +16 -0
- package/dist/core/constants.d.ts +3 -1
- package/dist/core/requestFingerprint.d.ts +11 -0
- package/dist/core/reviewBudget.d.ts +68 -0
- package/dist/core/tokenUsage.d.ts +2 -0
- package/dist/core/types.d.ts +71 -0
- package/dist/core/verification.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1879 -195
- package/dist/judge/anthropic.d.ts +2 -2
- package/dist/judge/openai.d.ts +2 -2
- package/dist/judge/provider.d.ts +7 -1
- package/dist/mcp/schemas.d.ts +7 -0
- package/dist/utils/env.d.ts +13 -0
- package/examples/codex-config.toml +4 -1
- package/examples/kyoso.toml +14 -0
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CURRENT_SKILL_DIGEST = "sha256:
|
|
1
|
+
export declare const CURRENT_SKILL_DIGEST = "sha256:570f83f716734f34db00147f1b98bc8cd4e9c0016d3946b352ecef4a5d6b8734";
|
|
2
2
|
export declare const KNOWN_SKILL_DIGESTS_BY_VERSION: {
|
|
3
3
|
readonly "0.8.0": readonly [{
|
|
4
4
|
readonly digest: "sha256:b16ea3f8141a01399b96dee650365d99df2b8c5fc99184d9cb22d5d72c106fd8";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type KyosoConfig } from "../config/schema.js";
|
|
2
|
+
import type { AgentRunInput, AgentRunResult } from "../core/types.js";
|
|
3
|
+
export declare const OPENROUTER_ACP_SMOKE_OPT_IN_ENV = "KYOSO_OPENROUTER_ACP_SMOKE";
|
|
4
|
+
export declare const OPENROUTER_ACP_SMOKE_OPT_IN_VALUE = "release";
|
|
5
|
+
export declare const OPENROUTER_ACP_SMOKE_MODEL_ENV = "KYOSO_OPENROUTER_MODEL";
|
|
6
|
+
export declare const OPENROUTER_ACP_SMOKE_SUCCESS_MARKER = "KYOSO_OPENROUTER_ACP_SMOKE_OK";
|
|
7
|
+
export declare class OpenRouterCodexAcpSmokePreflightError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class OpenRouterCodexAcpSmokeRuntimeError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
export type OpenRouterCodexAcpSmokeOptions = {
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
runAgent?: (input: AgentRunInput, config: KyosoConfig, childEnv: NodeJS.ProcessEnv) => Promise<AgentRunResult>;
|
|
16
|
+
};
|
|
17
|
+
export declare function assertOpenRouterCodexAcpSmokeArguments(input: {
|
|
18
|
+
positionals: string[];
|
|
19
|
+
flags: Record<string, string | boolean | string[]>;
|
|
20
|
+
}): void;
|
|
21
|
+
export declare function validateOpenRouterCodexAcpSmoke(env: NodeJS.ProcessEnv): {
|
|
22
|
+
model: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function createOpenRouterCodexAcpSmokeConfig(model: string): KyosoConfig;
|
|
25
|
+
export declare function runOpenRouterCodexAcpSmoke(options?: OpenRouterCodexAcpSmokeOptions): Promise<string>;
|
|
@@ -10,9 +10,9 @@ export declare const PLUGIN_RUNTIME_COMPATIBILITY_SCHEMA_VERSION = 1;
|
|
|
10
10
|
export declare const MINIMUM_SUPPORTED_CODEX_VERSION = "0.144.0-alpha.4";
|
|
11
11
|
export declare const PLUGIN_RUNTIME_EXPECTED_CONTRACT: {
|
|
12
12
|
readonly distribution: {
|
|
13
|
-
readonly pluginVersion: "0.
|
|
13
|
+
readonly pluginVersion: "0.4.0";
|
|
14
14
|
readonly mcpCommand: "npx";
|
|
15
|
-
readonly mcpPackagePin: "@kyo-so/cli@0.
|
|
15
|
+
readonly mcpPackagePin: "@kyo-so/cli@0.10.0";
|
|
16
16
|
};
|
|
17
17
|
readonly marketplace: {
|
|
18
18
|
readonly name: "kyoso";
|
|
@@ -47,7 +47,7 @@ export declare const PLUGIN_RUNTIME_EXPECTED_CONTRACT: {
|
|
|
47
47
|
readonly enabled: true;
|
|
48
48
|
readonly command: "$NODE";
|
|
49
49
|
readonly args: readonly ["$PROBE_SERVER", "$OBSERVATION"];
|
|
50
|
-
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
50
|
+
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
51
51
|
readonly cwd: null;
|
|
52
52
|
readonly startupTimeoutSec: 20;
|
|
53
53
|
readonly toolTimeoutSec: 360;
|
|
@@ -56,7 +56,7 @@ export declare const PLUGIN_RUNTIME_EXPECTED_CONTRACT: {
|
|
|
56
56
|
readonly enabled: false;
|
|
57
57
|
readonly command: "$NODE";
|
|
58
58
|
readonly args: readonly ["$PROBE_SERVER", "$OBSERVATION"];
|
|
59
|
-
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
59
|
+
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
60
60
|
readonly cwd: null;
|
|
61
61
|
readonly startupTimeoutSec: 20;
|
|
62
62
|
readonly toolTimeoutSec: 360;
|
|
@@ -100,6 +100,7 @@ export declare const PLUGIN_RUNTIME_EXPECTED_CONTRACT: {
|
|
|
100
100
|
readonly OPENAI_API_KEY: true;
|
|
101
101
|
readonly CODEX_API_KEY: true;
|
|
102
102
|
readonly CODEX_ACCESS_TOKEN: true;
|
|
103
|
+
readonly OPENROUTER_API_KEY: true;
|
|
103
104
|
readonly ANTHROPIC_API_KEY: true;
|
|
104
105
|
readonly CLAUDE_CODE_OAUTH_TOKEN: true;
|
|
105
106
|
};
|
|
@@ -129,9 +130,9 @@ export declare const pluginRuntimeContract: {
|
|
|
129
130
|
readonly pluginListTopLevelKeys: readonly ["installed", "available"];
|
|
130
131
|
readonly expectedContract: {
|
|
131
132
|
readonly distribution: {
|
|
132
|
-
readonly pluginVersion: "0.
|
|
133
|
+
readonly pluginVersion: "0.4.0";
|
|
133
134
|
readonly mcpCommand: "npx";
|
|
134
|
-
readonly mcpPackagePin: "@kyo-so/cli@0.
|
|
135
|
+
readonly mcpPackagePin: "@kyo-so/cli@0.10.0";
|
|
135
136
|
};
|
|
136
137
|
readonly marketplace: {
|
|
137
138
|
readonly name: "kyoso";
|
|
@@ -166,7 +167,7 @@ export declare const pluginRuntimeContract: {
|
|
|
166
167
|
readonly enabled: true;
|
|
167
168
|
readonly command: "$NODE";
|
|
168
169
|
readonly args: readonly ["$PROBE_SERVER", "$OBSERVATION"];
|
|
169
|
-
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
170
|
+
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
170
171
|
readonly cwd: null;
|
|
171
172
|
readonly startupTimeoutSec: 20;
|
|
172
173
|
readonly toolTimeoutSec: 360;
|
|
@@ -175,7 +176,7 @@ export declare const pluginRuntimeContract: {
|
|
|
175
176
|
readonly enabled: false;
|
|
176
177
|
readonly command: "$NODE";
|
|
177
178
|
readonly args: readonly ["$PROBE_SERVER", "$OBSERVATION"];
|
|
178
|
-
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
179
|
+
readonly envVars: readonly ["OPENAI_API_KEY", "CODEX_API_KEY", "CODEX_HOME", "CODEX_ACCESS_TOKEN", "OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
179
180
|
readonly cwd: null;
|
|
180
181
|
readonly startupTimeoutSec: 20;
|
|
181
182
|
readonly toolTimeoutSec: 360;
|
|
@@ -219,6 +220,7 @@ export declare const pluginRuntimeContract: {
|
|
|
219
220
|
readonly OPENAI_API_KEY: true;
|
|
220
221
|
readonly CODEX_API_KEY: true;
|
|
221
222
|
readonly CODEX_ACCESS_TOKEN: true;
|
|
223
|
+
readonly OPENROUTER_API_KEY: true;
|
|
222
224
|
readonly ANTHROPIC_API_KEY: true;
|
|
223
225
|
readonly CLAUDE_CODE_OAUTH_TOKEN: true;
|
|
224
226
|
};
|
package/dist/cli/setup.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type SetupOptions = {
|
|
|
18
18
|
client?: string;
|
|
19
19
|
write: boolean;
|
|
20
20
|
global: boolean;
|
|
21
|
+
withOpenRouter?: boolean;
|
|
21
22
|
runner?: string;
|
|
22
23
|
command?: string;
|
|
23
24
|
skillOnly?: boolean;
|
|
@@ -30,8 +31,8 @@ type McpCommand = {
|
|
|
30
31
|
};
|
|
31
32
|
export declare function runSetup(options: SetupOptions): Promise<string>;
|
|
32
33
|
export declare function commandForRunner(runner: SetupRunner): McpCommand;
|
|
33
|
-
export declare function buildCodexMcpToml(command: McpCommand): string;
|
|
34
|
-
export declare function buildClaudeMcpEntry(command: McpCommand): Record<string, unknown>;
|
|
34
|
+
export declare function buildCodexMcpToml(command: McpCommand, withOpenRouter?: boolean): string;
|
|
35
|
+
export declare function buildClaudeMcpEntry(command: McpCommand, withOpenRouter?: boolean): Record<string, unknown>;
|
|
35
36
|
export declare function skillDestination(client: SetupClient, scope: SetupScope, cwd: string, home: string): string;
|
|
36
37
|
export declare function resolveUserHome(env?: NodeJS.ProcessEnv): string;
|
|
37
38
|
export declare function resolveCodexConfigPath(env?: NodeJS.ProcessEnv, cwd?: string): string;
|
|
@@ -26,5 +26,24 @@ export type LoadedConfig = {
|
|
|
26
26
|
sources: LoadedConfigSource[];
|
|
27
27
|
warnings: string[];
|
|
28
28
|
};
|
|
29
|
+
export type ConfigValidationContext = {
|
|
30
|
+
source?: LoadedConfigSource;
|
|
31
|
+
projectTsExecuted: boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare function getConfigValidationContext(error: unknown): ConfigValidationContext | undefined;
|
|
34
|
+
export declare class ProjectOpenRouterAuthorizationError extends Error {
|
|
35
|
+
readonly code = "PROJECT_OPENROUTER_AUTHORIZATION_REQUIRED";
|
|
36
|
+
readonly projectPath: string;
|
|
37
|
+
readonly projectDirectory: string;
|
|
38
|
+
readonly layer: "project_toml" | "project_ts";
|
|
39
|
+
readonly globalConfigPath: string;
|
|
40
|
+
constructor(input: {
|
|
41
|
+
projectPath: string;
|
|
42
|
+
projectDirectory: string;
|
|
43
|
+
layer: "project_toml" | "project_ts";
|
|
44
|
+
globalConfigPath: string;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
29
47
|
export declare function loadConfig(options?: LoadConfigOptions): Promise<LoadedConfig>;
|
|
30
48
|
export declare function resolveGlobalTomlConfigPath(env?: NodeJS.ProcessEnv): string;
|
|
49
|
+
export declare function applyProjectCodexProviderReset(baseConfig: unknown, projectConfig: unknown, mergedConfig: unknown): unknown;
|
|
@@ -6,7 +6,7 @@ type Violation = {
|
|
|
6
6
|
path: string;
|
|
7
7
|
reason?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const kyosoConfigOverridePaths: readonly ["agents.codex.enabled", "agents.codex.model", "agents.codex.effort", "agents.codex.role", "agents.codex.timeoutMs", "agents.claude.enabled", "agents.claude.model", "agents.claude.effort", "agents.claude.role", "agents.claude.timeoutMs", "verification.enabled", "verification.maxFindings", "verification.timeoutMs", "judge.mode", "judge.provider", "judge.timeoutMs"];
|
|
9
|
+
export declare const kyosoConfigOverridePaths: readonly ["agents.codex.enabled", "agents.codex.model", "agents.codex.provider", "agents.codex.effort", "agents.codex.role", "agents.codex.timeoutMs", "agents.claude.enabled", "agents.claude.model", "agents.claude.effort", "agents.claude.role", "agents.claude.timeoutMs", "verification.enabled", "verification.maxFindings", "verification.timeoutMs", "judge.mode", "judge.provider", "judge.timeoutMs"];
|
|
10
10
|
export declare function isAllowedConfigOverridePath(path: string[]): boolean;
|
|
11
11
|
export declare function mergeProjectTomlConfig(baseConfig: unknown, projectConfig: unknown, options: ProjectScopeOptions): unknown;
|
|
12
12
|
export declare function collectProjectScopeViolations(config: unknown): Violation[];
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const CODEX_OPENROUTER_PROVIDER: "openrouter";
|
|
3
|
+
export declare const CODEX_DEFAULT_PROVIDER: "default";
|
|
4
|
+
export declare const CODEX_OPENROUTER_MODEL_REQUIRED_ISSUE: "codex_openrouter_model_required";
|
|
5
|
+
export type CodexProvider = typeof CODEX_OPENROUTER_PROVIDER | typeof CODEX_DEFAULT_PROVIDER;
|
|
2
6
|
type PartialDeep<T> = {
|
|
3
7
|
[K in keyof T]?: T[K] extends Record<string, unknown> ? PartialDeep<T[K]> : T[K];
|
|
4
8
|
};
|
|
@@ -35,6 +39,11 @@ export declare const kyosoConfigSchema: z.ZodObject<{
|
|
|
35
39
|
recommendedEnv: z.ZodArray<z.ZodString>;
|
|
36
40
|
envWhitelist: z.ZodArray<z.ZodString>;
|
|
37
41
|
}, z.core.$strip>;
|
|
42
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
openrouter: "openrouter";
|
|
44
|
+
default: "default";
|
|
45
|
+
}>>;
|
|
46
|
+
allowProjectProvider: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
38
47
|
}, z.core.$strip>;
|
|
39
48
|
claude: z.ZodObject<{
|
|
40
49
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -114,6 +123,13 @@ export declare const kyosoConfigSchema: z.ZodObject<{
|
|
|
114
123
|
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
115
124
|
allowDemotion: z.ZodDefault<z.ZodBoolean>;
|
|
116
125
|
}, z.core.$strip>;
|
|
126
|
+
reviewBudget: z.ZodObject<{
|
|
127
|
+
maxModelCalls: z.ZodNumber;
|
|
128
|
+
maxTotalWallTimeMs: z.ZodNumber;
|
|
129
|
+
maxAgentOutputBytes: z.ZodNumber;
|
|
130
|
+
maxFindingsPerAgent: z.ZodNumber;
|
|
131
|
+
skipOptionalPhasesWhenTokenUsageUnknown: z.ZodBoolean;
|
|
132
|
+
}, z.core.$strip>;
|
|
117
133
|
audit: z.ZodObject<{
|
|
118
134
|
enabled: z.ZodBoolean;
|
|
119
135
|
format: z.ZodLiteral<"jsonl">;
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export declare const DEFAULT_AGENT_TIMEOUT_MS = 120000;
|
|
2
2
|
export declare const DEFAULT_MAX_CONTEXT_BYTES = 500000;
|
|
3
3
|
export declare const DEFAULT_MAX_DIFF_BYTES = 300000;
|
|
4
|
+
export declare const MAX_AGENT_OUTPUT_BYTES = 1048576;
|
|
5
|
+
export declare const JUDGE_MAX_OUTPUT_TOKENS = 4096;
|
|
4
6
|
export declare const RAW_OUTPUT_MAX_CHARS = 16384;
|
|
5
7
|
export declare const TRACE_DIR = ".kyoso/traces";
|
|
6
8
|
export declare const KYOSO_CHILD_AGENT = "KYOSO_CHILD_AGENT";
|
|
7
|
-
export declare const KYOSO_VERSION = "0.
|
|
9
|
+
export declare const KYOSO_VERSION = "0.11.0";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { KyosoConfig } from "../config/schema.js";
|
|
2
|
+
import type { AgentRole, KyosoReviewRequest, ReviewBudget, ReviewTool } from "./types.js";
|
|
3
|
+
export declare const REVIEW_CONTRACT_VERSION = "2026-07-15-v1";
|
|
4
|
+
export declare function createRequestFingerprint(input: {
|
|
5
|
+
tool: ReviewTool;
|
|
6
|
+
request: KyosoReviewRequest;
|
|
7
|
+
config: KyosoConfig;
|
|
8
|
+
roles: Partial<Record<"codex" | "claude", AgentRole>>;
|
|
9
|
+
budget: ReviewBudget;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function canonicalJson(value: unknown): string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AgentName, ModelCallKind, ModelTokenUsage, ReviewBudget, ReviewBudgetRequest, ReviewCompletion, ReviewCompletionReason, ReviewExecutionBudget, ReviewModelCallAudit } from "./types.js";
|
|
2
|
+
type ReservationStatus = "reserved" | "started" | "completed" | "skipped";
|
|
3
|
+
type Reservation = {
|
|
4
|
+
id: number;
|
|
5
|
+
kind: ModelCallKind;
|
|
6
|
+
agent?: AgentName;
|
|
7
|
+
status: ReservationStatus;
|
|
8
|
+
reason?: string;
|
|
9
|
+
outputBytes?: number;
|
|
10
|
+
usage?: ModelTokenUsage;
|
|
11
|
+
stopReason?: string;
|
|
12
|
+
};
|
|
13
|
+
export type ModelCallReservation = Pick<Reservation, "id" | "kind" | "agent">;
|
|
14
|
+
export type BudgetReservationFailure = {
|
|
15
|
+
reason: "model_call_budget" | "deadline";
|
|
16
|
+
};
|
|
17
|
+
export declare function resolveReviewBudget(ceiling: ReviewBudget, requested: ReviewBudgetRequest | undefined): ReviewBudget;
|
|
18
|
+
export declare class ReviewBudgetTracker {
|
|
19
|
+
readonly budget: ReviewBudget;
|
|
20
|
+
readonly startedAtEpochMs: number;
|
|
21
|
+
readonly deadlineAtEpochMs: number;
|
|
22
|
+
private readonly reservations;
|
|
23
|
+
private readonly skippedCalls;
|
|
24
|
+
private readonly incompleteReasons;
|
|
25
|
+
private nextReservationId;
|
|
26
|
+
constructor(budget: ReviewBudget, startedAtEpochMs?: number);
|
|
27
|
+
remainingWallTimeMs(now?: number): number;
|
|
28
|
+
hasDeadlineExpired(now?: number): boolean;
|
|
29
|
+
reserveMany(inputs: Array<{
|
|
30
|
+
kind: ModelCallKind;
|
|
31
|
+
agent?: AgentName;
|
|
32
|
+
}>): {
|
|
33
|
+
reservations: ModelCallReservation[];
|
|
34
|
+
} | {
|
|
35
|
+
failure: BudgetReservationFailure;
|
|
36
|
+
};
|
|
37
|
+
reserve(input: {
|
|
38
|
+
kind: ModelCallKind;
|
|
39
|
+
agent?: AgentName;
|
|
40
|
+
}): {
|
|
41
|
+
reservation: ModelCallReservation;
|
|
42
|
+
} | {
|
|
43
|
+
failure: BudgetReservationFailure;
|
|
44
|
+
};
|
|
45
|
+
markStarted(reservation: ModelCallReservation): void;
|
|
46
|
+
hasStarted(reservation: ModelCallReservation): boolean;
|
|
47
|
+
complete(reservation: ModelCallReservation, values?: {
|
|
48
|
+
outputBytes?: number;
|
|
49
|
+
usage?: ModelTokenUsage;
|
|
50
|
+
stopReason?: string;
|
|
51
|
+
}): void;
|
|
52
|
+
skip(reservation: ModelCallReservation, reason: string): void;
|
|
53
|
+
recordSkipped(input: {
|
|
54
|
+
kind: ModelCallKind;
|
|
55
|
+
agent?: AgentName;
|
|
56
|
+
reason: string;
|
|
57
|
+
}): void;
|
|
58
|
+
markIncomplete(reason: ReviewCompletionReason): void;
|
|
59
|
+
isTokenUsageUnknown(): boolean;
|
|
60
|
+
snapshot(now?: number): {
|
|
61
|
+
completion: ReviewCompletion;
|
|
62
|
+
executionBudget: ReviewExecutionBudget;
|
|
63
|
+
modelCalls: ReviewModelCallAudit[];
|
|
64
|
+
};
|
|
65
|
+
private usedCapacity;
|
|
66
|
+
private modelCalls;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
package/dist/core/types.d.ts
CHANGED
|
@@ -4,6 +4,29 @@ export type GateStatus = "pass" | "warn" | "fail" | "not_applicable";
|
|
|
4
4
|
export type NetworkMode = "model_only" | "unrestricted";
|
|
5
5
|
export type JudgeProvider = "auto" | "openai" | "anthropic" | "none";
|
|
6
6
|
export type Severity = "critical" | "high" | "medium" | "low" | "info";
|
|
7
|
+
export type ReviewBudget = {
|
|
8
|
+
maxModelCalls: number;
|
|
9
|
+
maxTotalWallTimeMs: number;
|
|
10
|
+
maxAgentOutputBytes: number;
|
|
11
|
+
maxFindingsPerAgent: number;
|
|
12
|
+
skipOptionalPhasesWhenTokenUsageUnknown: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type ReviewBudgetRequest = Partial<ReviewBudget>;
|
|
15
|
+
export type ReviewCompletionReason = "model_call_budget" | "deadline" | "agent_output_limit" | "token_usage_unknown" | "coverage_incomplete" | "disputed_finding";
|
|
16
|
+
export type ReviewCompletion = {
|
|
17
|
+
status: "complete" | "incomplete";
|
|
18
|
+
reasons: ReviewCompletionReason[];
|
|
19
|
+
retryable: false;
|
|
20
|
+
};
|
|
21
|
+
export type ModelCallKind = "primary" | "verifier" | "judge";
|
|
22
|
+
export type ModelTokenUsage = {
|
|
23
|
+
totalTokens?: number;
|
|
24
|
+
inputTokens?: number;
|
|
25
|
+
outputTokens?: number;
|
|
26
|
+
thoughtTokens?: number;
|
|
27
|
+
cachedReadTokens?: number;
|
|
28
|
+
cachedWriteTokens?: number;
|
|
29
|
+
};
|
|
7
30
|
export type FindingCategory = "architecture" | "authn" | "authz" | "csrf" | "xss" | "ssrf" | "injection" | "secret" | "supply_chain" | "privacy" | "data_loss" | "test" | "maintainability" | "cisa_secure_by_design" | "other";
|
|
8
31
|
export type CisaDimension = "customer_security_outcomes" | "secure_by_default" | "transparency_and_accountability" | "governance";
|
|
9
32
|
export type KyosoReviewRequest = {
|
|
@@ -30,6 +53,7 @@ export type KyosoReviewRequest = {
|
|
|
30
53
|
options?: {
|
|
31
54
|
network?: NetworkMode;
|
|
32
55
|
maxAgentTimeoutMs?: number;
|
|
56
|
+
reviewBudget?: ReviewBudgetRequest;
|
|
33
57
|
includeAgentRawOutputs?: boolean;
|
|
34
58
|
judgeProvider?: JudgeProvider;
|
|
35
59
|
allowSecretRedaction?: boolean;
|
|
@@ -110,7 +134,10 @@ export type AgentRunInput = {
|
|
|
110
134
|
prompt: string;
|
|
111
135
|
workspaceDir: string;
|
|
112
136
|
timeoutMs: number;
|
|
137
|
+
deadlineAtEpochMs?: number;
|
|
138
|
+
maxOutputBytes?: number;
|
|
113
139
|
networkMode: NetworkMode;
|
|
140
|
+
onStarted?: (() => void) | (() => Promise<void>);
|
|
114
141
|
};
|
|
115
142
|
export type AgentRunResult = {
|
|
116
143
|
agent: AgentName;
|
|
@@ -124,11 +151,54 @@ export type AgentRunResult = {
|
|
|
124
151
|
detail?: string;
|
|
125
152
|
};
|
|
126
153
|
warnings?: string[];
|
|
154
|
+
usage?: ModelTokenUsage;
|
|
155
|
+
outputBytes?: number;
|
|
156
|
+
stopReason?: string;
|
|
127
157
|
startedAt: string;
|
|
128
158
|
completedAt?: string;
|
|
129
159
|
};
|
|
160
|
+
export type ReviewExecutionBudget = {
|
|
161
|
+
maxModelCalls: number;
|
|
162
|
+
modelCalls: {
|
|
163
|
+
planned: number;
|
|
164
|
+
consumed: number;
|
|
165
|
+
skipped: number;
|
|
166
|
+
byKind: Record<ModelCallKind, {
|
|
167
|
+
planned: number;
|
|
168
|
+
consumed: number;
|
|
169
|
+
skipped: number;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
172
|
+
wallTime: {
|
|
173
|
+
limitMs: number;
|
|
174
|
+
consumedMs: number;
|
|
175
|
+
remainingMs: number;
|
|
176
|
+
};
|
|
177
|
+
maxAgentOutputBytes: number;
|
|
178
|
+
maxFindingsPerAgent: number;
|
|
179
|
+
skipOptionalPhasesWhenTokenUsageUnknown: boolean;
|
|
180
|
+
agentOutputBytes: Partial<Record<AgentName, number>>;
|
|
181
|
+
tokenUsage: {
|
|
182
|
+
status: "reported" | "partial" | "unknown";
|
|
183
|
+
reportedCalls: number;
|
|
184
|
+
unknownCalls: number;
|
|
185
|
+
totals: ModelTokenUsage;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
export type ReviewModelCallAudit = {
|
|
189
|
+
kind: ModelCallKind;
|
|
190
|
+
agent?: AgentName;
|
|
191
|
+
status: "completed" | "skipped";
|
|
192
|
+
reason?: string;
|
|
193
|
+
outputBytes?: number;
|
|
194
|
+
usage?: ModelTokenUsage;
|
|
195
|
+
stopReason?: string;
|
|
196
|
+
};
|
|
130
197
|
export type KyosoResult = {
|
|
131
198
|
decision: KyosoDecision;
|
|
199
|
+
completion: ReviewCompletion;
|
|
200
|
+
executionBudget: ReviewExecutionBudget;
|
|
201
|
+
requestFingerprint: string;
|
|
132
202
|
degraded: boolean;
|
|
133
203
|
agentsUsed: AgentName[];
|
|
134
204
|
reviewMode: ReviewMode;
|
|
@@ -165,6 +235,7 @@ export type KyosoResult = {
|
|
|
165
235
|
workspaceMode: "temp_snapshot";
|
|
166
236
|
configHash?: string;
|
|
167
237
|
warnings?: string[];
|
|
238
|
+
modelCalls: ReviewModelCallAudit[];
|
|
168
239
|
};
|
|
169
240
|
};
|
|
170
241
|
export type SecretScanResult = {
|
|
@@ -18,7 +18,7 @@ export declare function groupVerificationTargetsByVerifier(targets: Verification
|
|
|
18
18
|
verifier: AgentName;
|
|
19
19
|
findings: KyosoFinding[];
|
|
20
20
|
}>;
|
|
21
|
-
export declare function markVerificationOverflow(targets: VerificationTarget[]): void;
|
|
21
|
+
export declare function markVerificationOverflow(targets: VerificationTarget[], reason?: string): void;
|
|
22
22
|
export declare function parseVerificationVerdicts(rawText: string | undefined): VerificationVerdict[] | undefined;
|
|
23
23
|
export declare function applyVerificationVerdicts(targets: VerificationTarget[], verifier: AgentName, verdicts: VerificationVerdict[] | undefined): Record<"confirmed" | "refuted" | "uncertain", number>;
|
|
24
24
|
export declare function countVerificationStatuses(findings: KyosoFinding[]): Record<"confirmed" | "refuted" | "uncertain" | "not_verified", number>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { defineConfig } from "./config/defineConfig.js";
|
|
2
2
|
export { runReview } from "./core/runReview.js";
|
|
3
|
-
export type { CisaSecureByDesignResult, GateStatus, KyosoDecision, KyosoFinding, KyosoResult, KyosoReviewRequest, NetworkMode, ReviewTool, } from "./core/types.js";
|
|
3
|
+
export type { CisaSecureByDesignResult, GateStatus, KyosoDecision, KyosoFinding, KyosoResult, KyosoReviewRequest, ModelTokenUsage, NetworkMode, ReviewBudget, ReviewBudgetRequest, ReviewCompletion, ReviewExecutionBudget, ReviewModelCallAudit, ReviewTool, } from "./core/types.js";
|