@kyo-so/cli 0.10.0 → 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.
@@ -1,4 +1,4 @@
1
- export declare const CURRENT_SKILL_DIGEST = "sha256:98e715396ee3e1994c29ab49bc489197f242091c8ac0e06e182c0eccd5ab277e";
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";
@@ -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.3.1";
13
+ readonly pluginVersion: "0.4.0";
14
14
  readonly mcpCommand: "npx";
15
- readonly mcpPackagePin: "@kyo-so/cli@0.9.1";
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.3.1";
133
+ readonly pluginVersion: "0.4.0";
133
134
  readonly mcpCommand: "npx";
134
- readonly mcpPackagePin: "@kyo-so/cli@0.9.1";
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
  };
@@ -123,6 +123,13 @@ export declare const kyosoConfigSchema: z.ZodObject<{
123
123
  timeoutMs: z.ZodDefault<z.ZodNumber>;
124
124
  allowDemotion: z.ZodDefault<z.ZodBoolean>;
125
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>;
126
133
  audit: z.ZodObject<{
127
134
  enabled: z.ZodBoolean;
128
135
  format: z.ZodLiteral<"jsonl">;
@@ -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.10.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 {};
@@ -0,0 +1,2 @@
1
+ import type { ModelTokenUsage } from "./types.js";
2
+ export declare function normalizeModelTokenUsage(usage: unknown): ModelTokenUsage | undefined;
@@ -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,6 +134,8 @@ 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;
114
140
  onStarted?: (() => void) | (() => Promise<void>);
115
141
  };
@@ -125,11 +151,54 @@ export type AgentRunResult = {
125
151
  detail?: string;
126
152
  };
127
153
  warnings?: string[];
154
+ usage?: ModelTokenUsage;
155
+ outputBytes?: number;
156
+ stopReason?: string;
128
157
  startedAt: string;
129
158
  completedAt?: string;
130
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
+ };
131
197
  export type KyosoResult = {
132
198
  decision: KyosoDecision;
199
+ completion: ReviewCompletion;
200
+ executionBudget: ReviewExecutionBudget;
201
+ requestFingerprint: string;
133
202
  degraded: boolean;
134
203
  agentsUsed: AgentName[];
135
204
  reviewMode: ReviewMode;
@@ -166,6 +235,7 @@ export type KyosoResult = {
166
235
  workspaceMode: "temp_snapshot";
167
236
  configHash?: string;
168
237
  warnings?: string[];
238
+ modelCalls: ReviewModelCallAudit[];
169
239
  };
170
240
  };
171
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";