@kodax-ai/kodax 0.7.77 → 0.7.79
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/CHANGELOG.md +3651 -3201
- package/README.md +317 -110
- package/README_CN.md +255 -91
- package/config-templates/config.example.jsonc +124 -32
- package/config-templates/integrations/a2a.example.jsonc +23 -7
- package/dist/builtin/skill-creator/scripts/aggregate-benchmark.js +2 -1
- package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/analyze-benchmark.js +4 -3
- package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/compare-runs.js +4 -3
- package/dist/builtin/skill-creator/scripts/generate-review.js +2 -1
- package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/grade-evals.js +4 -3
- package/dist/builtin/skill-creator/scripts/improve-description.js +2 -1
- package/dist/builtin/skill-creator/scripts/init-skill.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/init-skill.js +4 -3
- package/dist/builtin/skill-creator/scripts/install-skill.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/install-skill.js +4 -3
- package/dist/builtin/skill-creator/scripts/package-skill.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/package-skill.js +4 -3
- package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/quick-validate.js +4 -3
- package/dist/builtin/skill-creator/scripts/run-eval.d.ts +1 -0
- package/dist/builtin/skill-creator/scripts/run-eval.js +4 -3
- package/dist/builtin/skill-creator/scripts/run-loop.js +2 -1
- package/dist/builtin/skill-creator/scripts/run-trigger-eval.js +2 -1
- package/dist/builtin/skill-creator/scripts/utils.d.ts +3 -0
- package/dist/builtin/skill-creator/scripts/utils.js +5 -1
- package/dist/chunks/agent-V4AC5JZD.js +2 -0
- package/dist/chunks/argument-completer-ZPC2MLES.js +2 -0
- package/dist/chunks/chunk-5BNQXXGY.js +1 -0
- package/dist/chunks/{chunk-EH7AOMJ7.js → chunk-67THZRM6.js} +1 -1
- package/dist/chunks/chunk-6GVQDQTQ.js +292 -0
- package/dist/chunks/chunk-B6UY3VHV.js +348 -0
- package/dist/chunks/{chunk-HORNWBYR.js → chunk-BBOVVDQJ.js} +1 -1
- package/dist/chunks/chunk-CR2IF7VF.js +30 -0
- package/dist/chunks/{chunk-FNW2XUL5.js → chunk-CXHEZY5G.js} +1 -1
- package/dist/chunks/chunk-EDZ4QILG.js +266 -0
- package/dist/chunks/chunk-GEECPO2H.js +218 -0
- package/dist/chunks/chunk-H5LLM7DB.js +89 -0
- package/dist/chunks/chunk-KLWP7POA.js +467 -0
- package/dist/chunks/{chunk-XSA37BVM.js → chunk-M4N2JZTZ.js} +2 -2
- package/dist/chunks/chunk-OWQT3FTE.js +5 -0
- package/dist/chunks/chunk-Q4M7DJOD.js +319 -0
- package/dist/chunks/{chunk-3DD4QEBH.js → chunk-QCZLCLFL.js} +10 -10
- package/dist/chunks/chunk-RQPMGRTR.js +810 -0
- package/dist/chunks/chunk-SG6P4SZS.js +123 -0
- package/dist/chunks/chunk-TSTVAU5E.js +386 -0
- package/dist/chunks/chunk-ZCZZUE5E.js +662 -0
- package/dist/chunks/compaction-config-AEUGVROL.js +2 -0
- package/dist/chunks/{construction-bootstrap-RPRL3L7R.js → construction-bootstrap-K3ZGEN5N.js} +1 -1
- package/dist/chunks/dist-GFJFRPAV.js +2 -0
- package/dist/chunks/{dist-FDSOIR35.js → dist-JMO47GJV.js} +1 -1
- package/dist/chunks/host-23K2Q6RZ.js +2 -0
- package/dist/chunks/run-manager-PGIR6ITA.js +2 -0
- package/dist/chunks/utils-6LEKJPQN.js +2 -0
- package/dist/index.d.ts +22 -21
- package/dist/index.js +6 -6
- package/dist/kodax_bootstrap.js +2 -1
- package/dist/kodax_cli.js +2225 -1468
- package/dist/kodax_resume.js +570 -34
- package/dist/provider-capabilities.json +85 -50
- package/dist/runtime-worker.js +2076 -1343
- package/dist/sandbox-workspace-session.js +829 -0
- package/dist/sdk-a2a.d.ts +24 -18
- package/dist/sdk-a2a.js +8 -8
- package/dist/sdk-agent.d.ts +315 -168
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +42 -205
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +3 -3
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +7 -6
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +77 -36
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +406 -163
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.d.ts +93 -0
- package/dist/sdk-sandbox.js +2 -0
- package/dist/sdk-session.d.ts +8 -9
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.d.ts +2 -2
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +283 -18
- package/dist/types-chunks/{base.d-4e74xDdy.d.ts → base.d-DxG0m09Z.d.ts} +1 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-pZdu6qt7.d.ts → bash-prefix-extractor.d-CNSidpmv.d.ts} +149 -10
- package/dist/types-chunks/{capability-learning.d-CVsdHw4j.d.ts → capability-learning.d-iPSiAmc_.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-CxCm1KZz.d.ts → capsule.d-B3q98pLQ.d.ts} +9 -7
- package/dist/types-chunks/{types.d-RdWRfUEs.d.ts → controller.d-RGV7Pjv9.d.ts} +785 -8
- package/dist/types-chunks/{guardrail.d-B0PwAZVR.d.ts → guardrail.d-1NLSFTyN.d.ts} +310 -70
- package/dist/types-chunks/{history-retrieval.d-B__aEN62.d.ts → history-retrieval.d-BAegI14A.d.ts} +16 -3
- package/dist/types-chunks/{integration-config.d-ojG4swOP.d.ts → integration-config.d-BNowXE8k.d.ts} +23 -8
- package/dist/types-chunks/{oauth-login.d-Bgb4rdLN.d.ts → oauth-login.d-6i-vidxv.d.ts} +6 -2
- package/dist/types-chunks/{public-api.d--fF88JrC.d.ts → public-api.d-BpJhHoa7.d.ts} +366 -28
- package/dist/types-chunks/{commands.d-BccESAMV.d.ts → repl.d-CZ12Ow3X.d.ts} +89 -78
- package/dist/types-chunks/{side-query.d-5JvXhuOZ.d.ts → resolver.d-C9IW4fmU.d.ts} +7 -67
- package/dist/types-chunks/{run-manager.d-B47hIqnI.d.ts → run-manager.d-CX3AUocA.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-CLWf8Adb.d.ts → sdk-session-B3cfJKqF.d.ts} +3 -3
- package/dist/types-chunks/side-query.d-CP1LiRiH.d.ts +83 -0
- package/dist/types-chunks/{types-LanCEDj8.d.ts → types-Bf3Y3mW-.d.ts} +42 -3
- package/dist/types-chunks/{types.d-CODuyyqy.d.ts → types.d-BZ9oXvTV.d.ts} +2 -2
- package/dist/types-chunks/{types.d-DCQVBqVn.d.ts → types.d-BbtGlKZu.d.ts} +25 -3
- package/dist/types-chunks/{types.d-DCsKM8aT.d.ts → types.d-C0_rn--1.d.ts} +4 -4
- package/dist/types-chunks/{types.d-DIpZJKUl.d.ts → types.d-CgrXrFrq.d.ts} +16 -2
- package/dist/types-chunks/{utils.d-CDduqbFw.d.ts → utils.d-CGpHavsU.d.ts} +32 -8
- package/docs/SDK_EMBEDDER_GUIDE.md +1117 -227
- package/package.json +11 -1
- package/dist/chunks/agent-NGSWFE73.js +0 -2
- package/dist/chunks/argument-completer-WGGZPEEO.js +0 -2
- package/dist/chunks/chunk-27QLRH3D.js +0 -5
- package/dist/chunks/chunk-2MQPVY6P.js +0 -770
- package/dist/chunks/chunk-6WAPVAGQ.js +0 -74
- package/dist/chunks/chunk-AOENDSVN.js +0 -448
- package/dist/chunks/chunk-FSXI4MAV.js +0 -78
- package/dist/chunks/chunk-HV2GMZUZ.js +0 -343
- package/dist/chunks/chunk-IQT4RPCE.js +0 -46
- package/dist/chunks/chunk-JS2BHGJP.js +0 -158
- package/dist/chunks/chunk-OAMKECRG.js +0 -381
- package/dist/chunks/chunk-ON2WG2LG.js +0 -622
- package/dist/chunks/chunk-RUGAAHTF.js +0 -321
- package/dist/chunks/chunk-TGCG7U2W.js +0 -37
- package/dist/chunks/compaction-config-BE7VYWH6.js +0 -2
- package/dist/chunks/dist-ZZBNVTKU.js +0 -2
- package/dist/chunks/host-QAKQVC4A.js +0 -2
- package/dist/chunks/run-manager-N4UFWA2D.js +0 -2
- package/dist/chunks/utils-AUHCI4D5.js +0 -2
- package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +0 -91
- package/dist/types-chunks/guardrail.d-CJx9RRd3.d.ts +0 -156
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { b as McpServersConfig, M as McpConnectMode, a as McpServerConfig, c as McpTransportKind } from './config.d-CJy1WENT.js';
|
|
2
|
-
import { K as KodaXBaseProvider } from './base.d-
|
|
2
|
+
import { K as KodaXBaseProvider } from './base.d-DxG0m09Z.js';
|
|
3
3
|
import { a as CostTracker } from './cost-tracker.d-BeaenODW.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { e1 as RunnerToolCall, ey as ToolGuardrail } from './controller.d-RGV7Pjv9.js';
|
|
5
|
+
import { k as KodaXMessage } from './types.d-CgrXrFrq.js';
|
|
6
|
+
import { S as SideQueryDiagnostics } from './side-query.d-CP1LiRiH.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* FEATURE_200 Phase F (v0.7.45) — MCP domain types extracted from types.ts.
|
|
@@ -52,6 +53,50 @@ declare function loadAgentsFiles(options?: LoadAgentsOptions): AgentsFile[];
|
|
|
52
53
|
*/
|
|
53
54
|
declare function formatAgentsForPrompt(files: AgentsFile[]): string;
|
|
54
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Parse the auto-mode classifier's output — FEATURE_092 Phase 2b.3 (v0.7.33).
|
|
58
|
+
*
|
|
59
|
+
* Preferred format:
|
|
60
|
+
* <decision>allow|ask</decision><hazard>...</hazard><reason>...</reason>
|
|
61
|
+
* Legacy `<block>` output remains parseable during the protocol rollout so a
|
|
62
|
+
* valid decision from an older prompt/provider cache is not misreported as an
|
|
63
|
+
* infrastructure failure.
|
|
64
|
+
*
|
|
65
|
+
* Robustness:
|
|
66
|
+
* - case-insensitive yes/no
|
|
67
|
+
* - whitespace inside / around tags tolerated
|
|
68
|
+
* - one valid decision is authoritative; hazard/reason defects are retained
|
|
69
|
+
* as warnings and never become a second decision mechanism
|
|
70
|
+
* - reasons longer than 500 chars are truncated (defense against
|
|
71
|
+
* pathological model outputs)
|
|
72
|
+
* - missing, invalid, duplicate, or mixed decisions remain contract errors;
|
|
73
|
+
* surrounding prose and malformed auxiliary fields are diagnostic only
|
|
74
|
+
*/
|
|
75
|
+
type ClassifierDecision = {
|
|
76
|
+
readonly kind: 'block';
|
|
77
|
+
readonly reason: string;
|
|
78
|
+
readonly hazard?: ClassifierHazard;
|
|
79
|
+
readonly protocol: ClassifierProtocol;
|
|
80
|
+
readonly warnings?: readonly ClassifierOutputWarningCode[];
|
|
81
|
+
} | {
|
|
82
|
+
readonly kind: 'allow';
|
|
83
|
+
readonly reason: string;
|
|
84
|
+
readonly hazard?: 'none';
|
|
85
|
+
readonly protocol: ClassifierProtocol;
|
|
86
|
+
readonly warnings?: readonly ClassifierOutputWarningCode[];
|
|
87
|
+
} | {
|
|
88
|
+
readonly kind: 'unparseable';
|
|
89
|
+
readonly raw: string;
|
|
90
|
+
readonly failureCode: ClassifierParseFailureCode;
|
|
91
|
+
readonly observedProtocol: ClassifierObservedProtocol;
|
|
92
|
+
};
|
|
93
|
+
type ClassifierProtocol = 'structured_v2' | 'legacy_v1';
|
|
94
|
+
type ClassifierObservedProtocol = ClassifierProtocol | 'unknown';
|
|
95
|
+
type ClassifierParseFailureCode = 'missing_decision' | 'invalid_decision' | 'ambiguous_decision' | 'missing_hazard' | 'invalid_hazard' | 'decision_hazard_conflict' | 'decision_reason_conflict' | 'missing_reason' | 'structured_format_violation' | 'legacy_format_violation';
|
|
96
|
+
type ClassifierOutputWarningCode = Exclude<ClassifierParseFailureCode, 'missing_decision' | 'invalid_decision' | 'ambiguous_decision'>;
|
|
97
|
+
type ClassifierHazard = 'none' | 'protected_read' | 'outside_write' | 'destructive_loss' | 'credential_exposure' | 'network_exfiltration' | 'remote_code_execution' | 'dependency_poisoning' | 'production_change' | 'privilege_change' | 'intent_conflict';
|
|
98
|
+
declare function parseClassifierOutput(raw: string): ClassifierDecision;
|
|
99
|
+
|
|
55
100
|
/**
|
|
56
101
|
* Auto-Mode Rules Loader — FEATURE_092 Phase 2b.2 (v0.7.33).
|
|
57
102
|
*
|
|
@@ -70,11 +115,15 @@ declare function formatAgentsForPrompt(files: AgentsFile[]): string;
|
|
|
70
115
|
*
|
|
71
116
|
* Schema (each field optional, defaults to []):
|
|
72
117
|
* {
|
|
73
|
-
* "allow": string[], //
|
|
74
|
-
* "soft_deny": string[], //
|
|
118
|
+
* "allow": string[], // contextual examples supporting an allow
|
|
119
|
+
* "soft_deny": string[], // contextual cautions for the classifier to inspect
|
|
75
120
|
* "environment": string[] // background context the classifier sees verbatim
|
|
76
121
|
* }
|
|
77
122
|
*
|
|
123
|
+
* These strings are classifier context, never independent verdicts. In
|
|
124
|
+
* Auto[LLM], even `soft_deny` cannot create an approval class beyond the two
|
|
125
|
+
* evidence-based ask classes defined by the classifier contract.
|
|
126
|
+
*
|
|
78
127
|
* Merge: layers concatenated in order (user → project → local). Identical
|
|
79
128
|
* strings deduplicated by stable insertion (later layers win position only
|
|
80
129
|
* when the string is unique per layer).
|
|
@@ -134,7 +183,7 @@ declare function loadAutoRules(opts: LoadAutoRulesOptions): Promise<RulesLoadRes
|
|
|
134
183
|
*
|
|
135
184
|
* Mechanical pattern matches over a tool call. Signals are NOT verdicts;
|
|
136
185
|
* the classifier consumes them as informational input alongside transcript
|
|
137
|
-
* + user rules and produces the final decision (allow /
|
|
186
|
+
* + user rules and produces the final Auto[LLM] decision (allow / ask).
|
|
138
187
|
*
|
|
139
188
|
* Two invariants the producers must hold:
|
|
140
189
|
*
|
|
@@ -148,10 +197,9 @@ declare function loadAutoRules(opts: LoadAutoRulesOptions): Promise<RulesLoadRes
|
|
|
148
197
|
* so the classifier can weight signals, but the verdict is not encoded
|
|
149
198
|
* here.
|
|
150
199
|
*
|
|
151
|
-
* Tier 0
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* describe a wider surface for the classifier to reason about.
|
|
200
|
+
* The historical Tier 0 detector is a separate module, but its matches are
|
|
201
|
+
* also pre-verdict facts in Auto[LLM]. Only explicit Auto[Rules] treats that
|
|
202
|
+
* detector as a legacy approval gate.
|
|
155
203
|
*
|
|
156
204
|
* Design ref: ADR-025, FEATURE_158 (docs/features/v0.7.39.md).
|
|
157
205
|
*/
|
|
@@ -241,11 +289,174 @@ interface SignalCollector {
|
|
|
241
289
|
*/
|
|
242
290
|
declare function collectAllSignals(call: RunnerToolCall, projectRoot: string, collectors: readonly SignalCollector[], executionCwd?: string): readonly ToolCallSignal[];
|
|
243
291
|
|
|
292
|
+
interface PermissionIntentEvidence {
|
|
293
|
+
readonly status: 'complete' | 'targeted' | 'missing';
|
|
294
|
+
/** Latest genuine user request, kept separate as the authoritative intent. */
|
|
295
|
+
readonly currentUserContent?: string;
|
|
296
|
+
readonly currentUserContentTruncated?: boolean;
|
|
297
|
+
/** Runtime-delegated task context; informative, never a replacement for root authority. */
|
|
298
|
+
readonly delegatedObjective?: string;
|
|
299
|
+
readonly delegatedObjectiveTruncated?: boolean;
|
|
300
|
+
readonly bindingConstraints?: readonly string[];
|
|
301
|
+
readonly scopeHint?: string;
|
|
302
|
+
readonly readOnly?: boolean;
|
|
303
|
+
readonly content: string;
|
|
304
|
+
readonly sourceBytes: number;
|
|
305
|
+
readonly includedBytes: number;
|
|
306
|
+
readonly omittedBytes: number;
|
|
307
|
+
readonly sha256: string;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Classifier Projection Helpers — FEATURE_092 (v0.7.33)
|
|
312
|
+
*
|
|
313
|
+
* Typed tools implement `toClassifierInput(input): string` to project their
|
|
314
|
+
* input into a compact action the auto-mode classifier evaluates. Runtime
|
|
315
|
+
* registration supplies a fail-closed semantic fallback for legacy JavaScript,
|
|
316
|
+
* extension, and constructed tools that lack a trusted projector.
|
|
317
|
+
*
|
|
318
|
+
* ============== EXAMPLES BY CATEGORY ==============
|
|
319
|
+
*
|
|
320
|
+
* --- FILE OPERATIONS (path + size, never raw contents) ---
|
|
321
|
+
* write.ts: (i) => `Write ${i.path} (${i.content.length} bytes)`
|
|
322
|
+
* edit.ts: (i) => `Edit ${i.path} [${describeEdit(i)}]`
|
|
323
|
+
* multi-edit: (i) => `MultiEdit ${i.path}: ${i.edits.length} edits`
|
|
324
|
+
*
|
|
325
|
+
* --- SHELL / EXEC (command verbatim, ignore noise fields) ---
|
|
326
|
+
* bash.ts: (i) => `Bash: ${i.command}`
|
|
327
|
+
*
|
|
328
|
+
* --- NETWORK (URL is THE risk surface) ---
|
|
329
|
+
* web_fetch: (i) => `WebFetch ${i.url}`
|
|
330
|
+
*
|
|
331
|
+
* --- CHILD AGENT SPAWN (routing + execution controls) ---
|
|
332
|
+
* spawn_agent: objective size + scope/read_only/isolation/provider/model
|
|
333
|
+
*
|
|
334
|
+
* --- MCP CALLS (semantic fields + shape-only unknowns) ---
|
|
335
|
+
* mcp_call: (i) => mcpToClassifierInput(i.server, i.tool, i.input)
|
|
336
|
+
*
|
|
337
|
+
* --- READ-ONLY (Tier 1 — fully skipped) ---
|
|
338
|
+
* read.ts: () => ''
|
|
339
|
+
* grep.ts: () => ''
|
|
340
|
+
* glob.ts: () => ''
|
|
341
|
+
*
|
|
342
|
+
* --- UNKNOWN / CONSTRUCTED (semantic fail-closed fallback) ---
|
|
343
|
+
* extension: (i) => safeFallbackToClassifierInput(name, i)
|
|
344
|
+
*
|
|
345
|
+
* ============== ANTI-PATTERNS ==============
|
|
346
|
+
*
|
|
347
|
+
* ❌ JSON.stringify(input) as default
|
|
348
|
+
* → leaks raw content; hard for LLM to scan
|
|
349
|
+
*
|
|
350
|
+
* ❌ Returning input.description / input.rationale verbatim
|
|
351
|
+
* → these are LLM-emitted, manipulable; classifier should see facts
|
|
352
|
+
*
|
|
353
|
+
* ❌ Including raw file contents in Write/Edit projections
|
|
354
|
+
* → privacy + token cost; use bytes/line count as proxy
|
|
355
|
+
*
|
|
356
|
+
* ❌ Returning '' for a high-risk tool to "skip the classifier"
|
|
357
|
+
* → defeats Tier 1's "safe-only" semantics
|
|
358
|
+
*
|
|
359
|
+
* ❌ Truncating without indicating it ('foo' instead of 'foo…')
|
|
360
|
+
* → classifier may make decisions on false-complete information
|
|
361
|
+
*/
|
|
362
|
+
type ClassifierToolProjectionResolver = (toolName: string) => ((input: unknown) => string) | undefined;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Auto-Mode Classifier Orchestrator — FEATURE_092 Phase 2b.3 (v0.7.33).
|
|
366
|
+
*
|
|
367
|
+
* Wires the classifier prompt + sideQuery + output parser into a single
|
|
368
|
+
* `classify(...)` call. Caller supplies the rules, transcript, and the
|
|
369
|
+
* tool-call action being classified; gets back a `ClassifyDecision`.
|
|
370
|
+
*
|
|
371
|
+
* Failure → decision mapping:
|
|
372
|
+
*
|
|
373
|
+
* sideQuery.stopReason parsedOutput → ClassifyDecision
|
|
374
|
+
* ───────────────────────────────────────────────────────
|
|
375
|
+
* end_turn / max_tokens block → confirm (with reason)
|
|
376
|
+
* end_turn / max_tokens allow → allow
|
|
377
|
+
* end_turn / max_tokens unparseable → retry, then failure
|
|
378
|
+
* end_turn / max_tokens + tool_use → retry, then failure
|
|
379
|
+
* (sideQuery returns stopReason='error' here)
|
|
380
|
+
* timeout — → retry, then failure
|
|
381
|
+
* aborted — → throw AbortError to caller
|
|
382
|
+
* error — → retry, then failure
|
|
383
|
+
*
|
|
384
|
+
* Every non-abort failure receives one immediate retry. The caller applies
|
|
385
|
+
* its configured safety fallback after the second failure; a valid model
|
|
386
|
+
* concern always means "ask the user", never a direct hard block.
|
|
387
|
+
*/
|
|
388
|
+
|
|
389
|
+
interface ClassifyOptions {
|
|
390
|
+
readonly provider: KodaXBaseProvider;
|
|
391
|
+
readonly model: string;
|
|
392
|
+
readonly rules: AutoRules;
|
|
393
|
+
readonly claudeMd?: string;
|
|
394
|
+
readonly transcript: readonly KodaXMessage[];
|
|
395
|
+
readonly action: string;
|
|
396
|
+
readonly intentEvidence?: PermissionIntentEvidence;
|
|
397
|
+
/** Resolve canonical per-tool projections for safe historical context. */
|
|
398
|
+
readonly getToolProjection?: ClassifierToolProjectionResolver;
|
|
399
|
+
/**
|
|
400
|
+
* FEATURE_158 (v0.7.39): static-analysis signals forwarded to the
|
|
401
|
+
* classifier prompt. Empty / undefined preserves the FEATURE_092 prompt
|
|
402
|
+
* shape (no `<signals>` block emitted). When supplied, the classifier
|
|
403
|
+
* sees signals between `<transcript>` and `<action>` as informational
|
|
404
|
+
* input — not verdicts.
|
|
405
|
+
*/
|
|
406
|
+
readonly signals?: readonly ToolCallSignal[];
|
|
407
|
+
readonly timeoutMs?: number;
|
|
408
|
+
readonly abortSignal?: AbortSignal;
|
|
409
|
+
readonly costTracker?: CostTracker;
|
|
410
|
+
/**
|
|
411
|
+
* Optional setter — invoked once after `sideQuery` returns when the
|
|
412
|
+
* classifier successfully recorded its token usage. The CostTracker is
|
|
413
|
+
* immutable, so `sideQuery` produces a fresh tracker copy with the new
|
|
414
|
+
* record; without this setter the recorded call is silently dropped.
|
|
415
|
+
* Wired by the AutoModeToolGuardrail so the agent's tracker accumulates
|
|
416
|
+
* classifier calls under role='auto_mode'.
|
|
417
|
+
*/
|
|
418
|
+
readonly setCostTracker?: (next: CostTracker) => void;
|
|
419
|
+
}
|
|
420
|
+
type ClassifierFailureKind = 'timeout' | 'provider_error' | 'contract_error' | 'input_budget';
|
|
421
|
+
type ClassifierAttemptOutcome = 'allow' | 'confirm' | ClassifierFailureKind;
|
|
422
|
+
interface ClassifierAttemptDiagnostics {
|
|
423
|
+
readonly attempt: number;
|
|
424
|
+
readonly outcome: ClassifierAttemptOutcome;
|
|
425
|
+
readonly diagnostics?: SideQueryDiagnostics;
|
|
426
|
+
readonly observedProtocol?: ClassifierObservedProtocol;
|
|
427
|
+
readonly parseFailureCode?: ClassifierParseFailureCode | 'tool_use';
|
|
428
|
+
readonly outputWarnings?: readonly ClassifierOutputWarningCode[];
|
|
429
|
+
}
|
|
430
|
+
interface ClassifyDecisionDetails {
|
|
431
|
+
readonly reason: string;
|
|
432
|
+
/** Structured request metadata only; never includes prompt or response text. */
|
|
433
|
+
readonly diagnostics?: SideQueryDiagnostics;
|
|
434
|
+
readonly attempts: readonly ClassifierAttemptDiagnostics[];
|
|
435
|
+
}
|
|
436
|
+
type ClassifyDecision = ({
|
|
437
|
+
readonly kind: 'allow';
|
|
438
|
+
} & ClassifyDecisionDetails) | ({
|
|
439
|
+
readonly kind: 'confirm';
|
|
440
|
+
} & ClassifyDecisionDetails) | ({
|
|
441
|
+
readonly kind: 'failure';
|
|
442
|
+
readonly failureKind: ClassifierFailureKind;
|
|
443
|
+
} & ClassifyDecisionDetails);
|
|
444
|
+
/**
|
|
445
|
+
* The deadline includes connection setup, provider-side queueing, inference,
|
|
446
|
+
* and any Retry-After/backoff handled by the provider adapter. Keep it bounded
|
|
447
|
+
* so infrastructure failure reaches the configured Accept-edits fallback.
|
|
448
|
+
*/
|
|
449
|
+
declare const DEFAULT_CLASSIFIER_TIMEOUT_MS = 30000;
|
|
450
|
+
/** The classifier returns three short XML tags; a coding-turn-sized budget is wasteful. */
|
|
451
|
+
declare const CLASSIFIER_MAX_OUTPUT_TOKENS = 256;
|
|
452
|
+
declare function classify(opts: ClassifyOptions): Promise<ClassifyDecision>;
|
|
453
|
+
|
|
244
454
|
/**
|
|
245
455
|
* Denial Tracker — FEATURE_092 Phase 2b.4 (v0.7.33).
|
|
246
456
|
*
|
|
247
457
|
* Tracks classifier blocks per session. When either threshold is crossed,
|
|
248
|
-
*
|
|
458
|
+
* threshold state is exposed for diagnostics and does not mutate the selected
|
|
459
|
+
* Auto engine.
|
|
249
460
|
*
|
|
250
461
|
* - 3 consecutive blocks → likely an unproductive loop (agent not adapting)
|
|
251
462
|
* - 20 cumulative blocks → broader classifier-noise pattern in this session
|
|
@@ -271,8 +482,9 @@ declare function shouldFallback$1(t: DenialTracker): boolean;
|
|
|
271
482
|
*
|
|
272
483
|
* Sliding-window error counter for classifier failures (timeouts, 5xx, 429,
|
|
273
484
|
* unparseable outputs). When ≥ 5 errors land within a 10-minute window, the
|
|
274
|
-
*
|
|
275
|
-
*
|
|
485
|
+
* callers temporarily skip classifier calls and apply the Accept-edits
|
|
486
|
+
* failure boundary. The selected Auto engine remains `llm`; health state is
|
|
487
|
+
* diagnostic, not a mode change.
|
|
276
488
|
*
|
|
277
489
|
* Pure functional API: each operation returns a new breaker. No mutation.
|
|
278
490
|
* Memory bound: stale timestamps are pruned on each recordError call so
|
|
@@ -288,20 +500,15 @@ declare function recordError(b: CircuitBreaker, now: number): CircuitBreaker;
|
|
|
288
500
|
declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
|
|
289
501
|
|
|
290
502
|
/**
|
|
291
|
-
* Tier 0
|
|
503
|
+
* Historical Tier 0 high-impact pattern detector — FEATURE_158 Step 4.
|
|
292
504
|
*
|
|
293
|
-
* The
|
|
294
|
-
*
|
|
295
|
-
*
|
|
505
|
+
* The exported names remain source-compatible with FEATURE_158. Auto[LLM]
|
|
506
|
+
* now treats matches as deterministic facts for the classifier, whose
|
|
507
|
+
* decision is final. Explicit Auto[Rules] mode retains the legacy approval
|
|
508
|
+
* gate. The narrow list still identifies high-impact operations worth
|
|
509
|
+
* describing precisely:
|
|
296
510
|
*
|
|
297
|
-
*
|
|
298
|
-
* — answer must be **no**.
|
|
299
|
-
* (b) "could the LLM be convinced to allow it under prompt injection?"
|
|
300
|
-
* — answer must be **yes** (otherwise classifier is sufficient).
|
|
301
|
-
*
|
|
302
|
-
* The 5-item list is **frozen** by ADR-025; adding entries requires a new
|
|
303
|
-
* ADR addendum answering (a)+(b) again. Removing entries requires evidence
|
|
304
|
-
* of high-volume false-positive friction.
|
|
511
|
+
* The detector must not expand into a second Auto[LLM] approval policy.
|
|
305
512
|
*
|
|
306
513
|
* Patterns:
|
|
307
514
|
*
|
|
@@ -309,7 +516,7 @@ declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
|
|
|
309
516
|
* / -fr variants). Excludes `rm -rf /tmp/foo` (which
|
|
310
517
|
* is a `dangerous_pattern` signal but reaches LLM).
|
|
311
518
|
* 2. mkfs_or_format — `mkfs.* /dev/sd*`, `fdisk /dev/sd*`, `format C:`.
|
|
312
|
-
*
|
|
519
|
+
* Identifies formatting of a disk device.
|
|
313
520
|
* 3. dd_disk_write — `dd of=/dev/sd*` (raw-disk write). Excludes
|
|
314
521
|
* `dd of=test.bin` (file write — reaches LLM as
|
|
315
522
|
* dangerous_pattern signal).
|
|
@@ -317,13 +524,12 @@ declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
|
|
|
317
524
|
* 5. user_kodax_write — write/edit to any path under `~/.kodax/`
|
|
318
525
|
* (credentials zone — internal kodax config writes
|
|
319
526
|
* use the TypeScript API, not bash/tools, so the
|
|
320
|
-
* only path here is LLM-emitted shell
|
|
321
|
-
* always wrong).
|
|
527
|
+
* only path here is normally an LLM-emitted shell).
|
|
322
528
|
*
|
|
323
529
|
* Layer note: bash-level `~/.kodax/` writes (e.g. `echo x > ~/.kodax/y`)
|
|
324
530
|
* require AST path-extraction which lives in `@kodax/repl`. The REPL-side
|
|
325
|
-
* collector wired through `extraCollectors` (Step 7)
|
|
326
|
-
* Tier 0 by emitting a synthetic `user_kodax_write`
|
|
531
|
+
* collector wired through `extraCollectors` (Step 7) identifies those as
|
|
532
|
+
* Tier 0 by emitting a synthetic `user_kodax_write` match via the same
|
|
327
533
|
* `AbsoluteDenyResult` shape. This module handles the file-tool path
|
|
328
534
|
* directly (the most common attack vector) and the four command-string
|
|
329
535
|
* patterns that don't need path extraction.
|
|
@@ -341,13 +547,15 @@ interface AbsoluteDenyMiss {
|
|
|
341
547
|
type AbsoluteDenyResult = AbsoluteDenyMatch | AbsoluteDenyMiss;
|
|
342
548
|
type AbsoluteDenyCheck = (call: RunnerToolCall, projectRoot: string, executionCwd: string) => AbsoluteDenyResult;
|
|
343
549
|
/**
|
|
344
|
-
* Check a tool call against the Tier 0
|
|
345
|
-
* first matching pattern, or `{ denied: false }` if no pattern fires.
|
|
550
|
+
* Check a tool call against the historical Tier 0 pattern list. Returns the
|
|
551
|
+
* first matching pattern, or `{ denied: false }` if no pattern fires. A match
|
|
552
|
+
* is classifier evidence in Auto[LLM] and a legacy approval gate only in
|
|
553
|
+
* explicit Auto[Rules].
|
|
346
554
|
*
|
|
347
555
|
* Order is deterministic — patterns checked in the order defined above.
|
|
348
556
|
* Multiple matches would be possible (e.g. `rm -rf / ; :(){...};:`) but
|
|
349
|
-
* we return the first hit
|
|
350
|
-
*
|
|
557
|
+
* we return the first hit because one precise fact is sufficient for the
|
|
558
|
+
* classifier and the reason string is one-shot.
|
|
351
559
|
*
|
|
352
560
|
* **Pure**: deterministic given (call, projectRoot, stable env).
|
|
353
561
|
* **Fast**: ~5 regex tests + 1-2 string ops; safe to run on every
|
|
@@ -365,18 +573,21 @@ declare function checkAbsoluteDeny(call: RunnerToolCall, projectRoot: string, ex
|
|
|
365
573
|
*
|
|
366
574
|
* Decision flow (per design doc "三层权限金字塔"):
|
|
367
575
|
*
|
|
368
|
-
* 1.
|
|
369
|
-
* 2.
|
|
370
|
-
* 3.
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
576
|
+
* 1. exact safe read/workspace-temp effect → allow (zero token cost)
|
|
577
|
+
* 2. Explicitly exempt empty projection → allow
|
|
578
|
+
* 3. Static/high-impact pattern match → classifier facts in LLM;
|
|
579
|
+
* legacy gate in explicit Rules
|
|
580
|
+
* 4. Recoverable projection/analyzer fault → safe facts to classifier
|
|
581
|
+
* 5. Engine is rules → deterministic Tier 2, otherwise user confirms
|
|
582
|
+
* 6. degraded classifier infrastructure → Accept-edits fallback
|
|
583
|
+
* 7. classify(...) sideQuery (sole Auto[LLM] decision owner)
|
|
584
|
+
* allow → allow (record allow → reset consecutive)
|
|
585
|
+
* confirm → user confirmation (record concern)
|
|
586
|
+
* failure → Accept-edits fallback (record error)
|
|
587
|
+
* AbortError thrown → re-throw (propagate user cancel)
|
|
377
588
|
*
|
|
378
589
|
* State (mutable, session-scoped):
|
|
379
|
-
* - engine: 'llm' | 'rules' (
|
|
590
|
+
* - engine: 'llm' | 'rules' (user-selected; classifier health never changes it)
|
|
380
591
|
* - denialTracker (immutable type, swapped on each event)
|
|
381
592
|
* - circuitBreaker (immutable type, swapped on each event)
|
|
382
593
|
*
|
|
@@ -401,16 +612,22 @@ interface AutoModeSharedState {
|
|
|
401
612
|
/**
|
|
402
613
|
* User answer for an escalated tool-call. The guardrail translates this into
|
|
403
614
|
* the actual `GuardrailVerdict` returned to the Runner. `'block'` preserves
|
|
404
|
-
*
|
|
405
|
-
*
|
|
615
|
+
* a clear call-local user-declined result while retaining the review reason.
|
|
616
|
+
* It does not create a persistent denial: a safer follow-up is reviewed as a
|
|
617
|
+
* new call. `'timeout'` reports that the action was not executed and gives the
|
|
618
|
+
* main model a bounded recovery instruction.
|
|
406
619
|
*/
|
|
407
|
-
type AutoModeAskUserVerdict = 'allow' | 'block';
|
|
620
|
+
type AutoModeAskUserVerdict = 'allow' | 'block' | 'timeout';
|
|
621
|
+
interface AutoModeDecisionDiagnostics {
|
|
622
|
+
readonly source: 'classifier_confirm' | 'classifier_failure' | 'classifier_circuit_breaker' | 'configuration';
|
|
623
|
+
readonly classifierFailureKind?: ClassifierFailureKind;
|
|
624
|
+
readonly classifierAttempts?: readonly ClassifierAttemptDiagnostics[];
|
|
625
|
+
}
|
|
408
626
|
/**
|
|
409
|
-
* Optional REPL-supplied prompt callback for
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
* translates the user's answer into `'allow'` or `'block'`. When NOT
|
|
627
|
+
* Optional REPL-supplied prompt callback for calls that require a human
|
|
628
|
+
* decision (rules escalation, classifier concern/failure, or configuration
|
|
629
|
+
* failure). When supplied, the guardrail calls this and
|
|
630
|
+
* translates the user's answer into allow/block/timeout semantics. When NOT
|
|
414
631
|
* supplied, the guardrail returns `'escalate'` as before — the Runner will
|
|
415
632
|
* then throw `GuardrailEscalateError` (preserves backward compat with
|
|
416
633
|
* SDK-side guardrail consumers that have no askUser surface).
|
|
@@ -425,11 +642,18 @@ type AutoModeAskUser = (call: RunnerToolCall, reason: string,
|
|
|
425
642
|
* keep working. REPL uses these to render Scope/Risk labels on the
|
|
426
643
|
* confirm dialog (replacing the input-marker path from FEATURE_066).
|
|
427
644
|
*/
|
|
428
|
-
signals?: readonly ToolCallSignal[]) => Promise<AutoModeAskUserVerdict>;
|
|
645
|
+
signals?: readonly ToolCallSignal[], diagnostics?: AutoModeDecisionDiagnostics) => Promise<AutoModeAskUserVerdict>;
|
|
429
646
|
interface AutoModeRulesContext {
|
|
430
647
|
readonly projectRoot: string;
|
|
431
648
|
readonly executionCwd: string;
|
|
432
649
|
readonly signals: readonly ToolCallSignal[];
|
|
650
|
+
/**
|
|
651
|
+
* Whether shell environment aliases such as `%TEMP%` and `$env:TEMP`
|
|
652
|
+
* are known to resolve from this Node process. Runtime shell profiles can
|
|
653
|
+
* rewrite them before execution, so embedders must set this to false when
|
|
654
|
+
* that equivalence cannot be proven.
|
|
655
|
+
*/
|
|
656
|
+
readonly trustProcessEnvironmentPathExpansion?: boolean;
|
|
433
657
|
}
|
|
434
658
|
type AutoModePermissionBoundary = 'workspace' | 'system-temp' | 'outside-workspace' | 'protected' | 'unresolved';
|
|
435
659
|
interface AutoModePermissionTarget {
|
|
@@ -498,6 +722,15 @@ interface AutoModeGuardrailConfig {
|
|
|
498
722
|
* paths. See `AutoModeAskUser` for semantics.
|
|
499
723
|
*/
|
|
500
724
|
readonly askUser?: AutoModeAskUser;
|
|
725
|
+
/**
|
|
726
|
+
* Runtime-owned Accept-edits fallback used only when classifier
|
|
727
|
+
* infrastructure or its response contract fails.
|
|
728
|
+
*/
|
|
729
|
+
readonly allowOnClassifierFailure?: (call: RunnerToolCall) => boolean | Promise<boolean>;
|
|
730
|
+
/** Whether ordinary bash calls can be enforced by an OS workspace sandbox. */
|
|
731
|
+
readonly workspaceShellSandboxAvailable?: boolean;
|
|
732
|
+
/** Mint one exact bash call for workspace-sandboxed execution. */
|
|
733
|
+
readonly admitWorkspaceSandboxCall?: (call: RunnerToolCall, review: AutoModePermissionReview) => void;
|
|
501
734
|
/**
|
|
502
735
|
* Runtime-owned deterministic Tier-2 evaluator. It is injected rather than
|
|
503
736
|
* implemented in @kodax/coding because canonical path and shell-AST helpers
|
|
@@ -507,7 +740,8 @@ interface AutoModeGuardrailConfig {
|
|
|
507
740
|
readonly evaluateRulesCall?: AutoModeRulesEvaluator;
|
|
508
741
|
/**
|
|
509
742
|
* Runtime-owned compact facts used by deterministic read admission and the
|
|
510
|
-
* LLM permission reviewer.
|
|
743
|
+
* LLM permission reviewer. When absent or faulty, direct read tools use a
|
|
744
|
+
* bounded metadata-only projection and remain LLM-reviewed.
|
|
511
745
|
*/
|
|
512
746
|
readonly analyzeCall?: AutoModeCallAnalyzer;
|
|
513
747
|
/**
|
|
@@ -544,12 +778,11 @@ interface AutoModeGuardrailConfig {
|
|
|
544
778
|
*/
|
|
545
779
|
readonly getCostTracker?: () => CostTracker | undefined;
|
|
546
780
|
readonly setCostTracker?: (t: CostTracker) => void;
|
|
547
|
-
/** Optional logger for
|
|
781
|
+
/** Optional logger for classifier-health and configuration warnings. */
|
|
548
782
|
readonly log?: (level: 'info' | 'warn', msg: string) => void;
|
|
549
783
|
/**
|
|
550
|
-
* Fired whenever the active engine changes
|
|
551
|
-
*
|
|
552
|
-
* calls. UI surfaces (status bar engine indicator, slash-command
|
|
784
|
+
* Fired whenever the active engine changes through `setEngine(...)`.
|
|
785
|
+
* UI surfaces (status bar engine indicator, slash-command
|
|
553
786
|
* confirmations) subscribe here so the displayed engine stays in sync
|
|
554
787
|
* with the guardrail's internal state without the user having to trigger
|
|
555
788
|
* another mode toggle just to refresh the bar.
|
|
@@ -558,8 +791,8 @@ interface AutoModeGuardrailConfig {
|
|
|
558
791
|
/**
|
|
559
792
|
* Optional shared state for subagent threshold-bypass defense
|
|
560
793
|
* (design doc "防绕阈值"). When supplied, the parent and child
|
|
561
|
-
* guardrails reference the SAME object — engine
|
|
562
|
-
*
|
|
794
|
+
* guardrails reference the SAME object — engine changes and tracker
|
|
795
|
+
* advances are visible across the session boundary.
|
|
563
796
|
*/
|
|
564
797
|
readonly sharedState?: AutoModeSharedState;
|
|
565
798
|
/**
|
|
@@ -572,7 +805,7 @@ interface AutoModeGuardrailConfig {
|
|
|
572
805
|
readonly initialEngine?: AutoModeEngine;
|
|
573
806
|
/**
|
|
574
807
|
* FEATURE_092 phase 2b.7b slice C: classifier sideQuery timeout in ms.
|
|
575
|
-
* Defaults to
|
|
808
|
+
* Defaults to 30_000. Resolved by the REPL from `~/.kodax/config.json`
|
|
576
809
|
* `autoMode.timeoutMs`.
|
|
577
810
|
*/
|
|
578
811
|
readonly timeoutMs?: number;
|
|
@@ -591,6 +824,11 @@ interface AutoModeGuardrailConfig {
|
|
|
591
824
|
readonly projectRoot?: string;
|
|
592
825
|
/** Directory used to resolve relative tool paths. Defaults to projectRoot. */
|
|
593
826
|
readonly executionCwd?: string;
|
|
827
|
+
/**
|
|
828
|
+
* Set to false when the shell profile or execution contract can rewrite
|
|
829
|
+
* process-derived path aliases such as `%TEMP%` or `$env:TEMP`.
|
|
830
|
+
*/
|
|
831
|
+
readonly trustProcessEnvironmentPathExpansion?: boolean;
|
|
594
832
|
/**
|
|
595
833
|
* Override the default signal-collector set. When unset, defaults to
|
|
596
834
|
* `[bashSignalCollector, fileSignalCollector]` — coding-side
|
|
@@ -613,7 +851,10 @@ interface AutoModeGuardrailConfig {
|
|
|
613
851
|
* signal order).
|
|
614
852
|
*/
|
|
615
853
|
readonly extraCollectors?: readonly SignalCollector[];
|
|
616
|
-
/**
|
|
854
|
+
/**
|
|
855
|
+
* Layer-owned high-impact pattern checks. In LLM mode they add classifier
|
|
856
|
+
* evidence; in explicitly selected Rules mode they retain the legacy gate.
|
|
857
|
+
*/
|
|
617
858
|
readonly extraAbsoluteDenyChecks?: readonly AbsoluteDenyCheck[];
|
|
618
859
|
/**
|
|
619
860
|
* Speculative-classify quiet window (ms). When a classifier promise
|
|
@@ -625,8 +866,8 @@ interface AutoModeGuardrailConfig {
|
|
|
625
866
|
* (late-verdict adoption). The window therefore only controls "fast path
|
|
626
867
|
* vs wait", never "dialog vs no dialog": an `allow` never surfaces a
|
|
627
868
|
* confirm dialog regardless of how long the classifier takes, and only an
|
|
628
|
-
*
|
|
629
|
-
*
|
|
869
|
+
* confirmation/failure verdict reaches the configured user or Accept-edits
|
|
870
|
+
* fallback path.
|
|
630
871
|
* The background classifier's cost is settled exactly once inside
|
|
631
872
|
* classify(), so awaiting it after window expiry does not double-count.
|
|
632
873
|
*
|
|
@@ -645,6 +886,7 @@ interface AutoModeGuardrailConfig {
|
|
|
645
886
|
*/
|
|
646
887
|
interface AutoModeStats {
|
|
647
888
|
readonly engine: AutoModeEngine;
|
|
889
|
+
readonly classifierHealth: 'healthy' | 'degraded';
|
|
648
890
|
readonly classifierModel?: string;
|
|
649
891
|
readonly denials: DenialTracker;
|
|
650
892
|
readonly breaker: CircuitBreaker;
|
|
@@ -656,19 +898,17 @@ interface AutoModeToolGuardrail extends ToolGuardrail {
|
|
|
656
898
|
getStats(): AutoModeStats;
|
|
657
899
|
/**
|
|
658
900
|
* Manually set the engine. Used by `/auto-engine` slash command to flip
|
|
659
|
-
*
|
|
660
|
-
* manual testing. The downgrade thresholds still operate normally — a
|
|
661
|
-
* subsequent threshold cross will downgrade again.
|
|
901
|
+
* between 'llm' and 'rules' after an explicit user or host choice.
|
|
662
902
|
*/
|
|
663
903
|
setEngine(engine: AutoModeEngine): void;
|
|
664
904
|
/** Test-only alias for getEngine(). Backward-compat for test files. */
|
|
665
905
|
getEngineForTest(): AutoModeEngine;
|
|
666
906
|
/** Test-only alias for getStats(). Backward-compat for test files. */
|
|
667
907
|
getStatsForTest(): AutoModeStats;
|
|
668
|
-
/** Test-only override: swap the provider mid-test
|
|
908
|
+
/** Test-only override: swap the provider mid-test. */
|
|
669
909
|
setProviderForTest(provider: KodaXBaseProvider): void;
|
|
670
910
|
}
|
|
671
911
|
declare function createAutoModeToolGuardrail(config: AutoModeGuardrailConfig): AutoModeToolGuardrail;
|
|
672
912
|
|
|
673
|
-
export {
|
|
674
|
-
export type { AbsoluteDenyCheck as A,
|
|
913
|
+
export { CLASSIFIER_MAX_OUTPUT_TOKENS as C, DEFAULT_CLASSIFIER_TIMEOUT_MS as M, ERROR_THRESHOLD as O, WINDOW_MS as a1, checkAbsoluteDeny as a2, classify as a3, collectAllSignals as a4, computeRulesFingerprint as a5, createAutoModeToolGuardrail as a6, createCircuitBreaker as a7, createDenialTracker as a8, formatAgentsForPrompt as a9, getKodaxGlobalDir as aa, loadAgentsFiles as ab, loadAutoRules as ac, parseAutoRules as ad, parseClassifierOutput as ae, readTrustState as af, recordAllow as ag, recordBlock as ah, recordError as ai, shouldFallback$1 as aj, shouldFallback as ak, trustProjectRules as al, CONSECUTIVE_THRESHOLD as v, CUMULATIVE_THRESHOLD as w };
|
|
914
|
+
export type { ToolCallSignal as $, AbsoluteDenyCheck as A, ClassifierDecision as B, ClassifierFailureKind as D, ClassifierHazard as E, ClassifierObservedProtocol as F, ClassifierOutputWarningCode as G, ClassifierParseFailureCode as H, ClassifierProtocol as I, ClassifierToolProjectionResolver as J, ClassifyDecision as K, ClassifyOptions as L, DenialTracker as N, KodaXMcpConnectMode as P, KodaXMcpServerConfig as Q, KodaXMcpServersConfig as R, KodaXMcpTransport as S, LoadAgentsOptions as T, LoadedRulesSource as U, PermissionIntentEvidence as V, RulesLoadError as W, RulesLoadResult as X, SignalCollector as Y, SkippedRulesSource as Z, TierZeroPatternId as _, AbsoluteDenyMatch as a, TrustState as a0, AbsoluteDenyMiss as b, AbsoluteDenyResult as c, AgentsFile as d, AutoModeAskUser as e, AutoModeAskUserVerdict as f, AutoModeCallAnalyzer as g, AutoModeDecisionDiagnostics as h, AutoModeEngine as i, AutoModeGuardrailConfig as j, AutoModePermissionBoundary as k, AutoModePermissionOperation as l, AutoModePermissionReview as m, AutoModePermissionTarget as n, AutoModeRulesContext as o, AutoModeRulesDecision as p, AutoModeRulesEvaluator as q, AutoModeSharedState as r, AutoModeStats as s, AutoModeToolGuardrail as t, AutoRules as u, CircuitBreaker as x, ClassifierAttemptDiagnostics as y, ClassifierAttemptOutcome as z };
|
package/dist/types-chunks/{history-retrieval.d-B__aEN62.d.ts → history-retrieval.d-BAegI14A.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as KodaXMessage } from './types.d-
|
|
2
|
-
import {
|
|
1
|
+
import { k as KodaXMessage } from './types.d-CgrXrFrq.js';
|
|
2
|
+
import { c1 as KodaXSessionLineage } from './controller.d-RGV7Pjv9.js';
|
|
3
3
|
|
|
4
4
|
type KodaXSessionHistoryScope = 'compacted' | 'all';
|
|
5
5
|
type KodaXSessionHistorySource = 'user' | 'assistant' | 'system' | 'tool' | 'child_task';
|
|
@@ -25,6 +25,12 @@ interface KodaXSessionHistorySearchResult {
|
|
|
25
25
|
revision: string;
|
|
26
26
|
hits: KodaXSessionHistoryHit[];
|
|
27
27
|
}
|
|
28
|
+
/** @internal Cooperative control used by Runtime history reads. */
|
|
29
|
+
interface KodaXSessionHistorySearchControl {
|
|
30
|
+
readonly revision: string;
|
|
31
|
+
checkpoint(): void;
|
|
32
|
+
yieldControl(): Promise<void>;
|
|
33
|
+
}
|
|
28
34
|
interface KodaXSessionHistoryReadOptions {
|
|
29
35
|
entryId: string;
|
|
30
36
|
revision?: string;
|
|
@@ -51,7 +57,14 @@ type KodaXSessionHistoryReadResult = {
|
|
|
51
57
|
citation: string;
|
|
52
58
|
};
|
|
53
59
|
declare function searchSessionHistory(lineage: KodaXSessionLineage, options: KodaXSessionHistorySearchOptions): KodaXSessionHistorySearchResult;
|
|
60
|
+
/** @internal Runtime preflight; kept out of the public package barrels. */
|
|
61
|
+
declare function validateSessionHistorySearchQuery(query: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Runtime-facing history search that yields between bounded batches so
|
|
64
|
+
* timeout/cancel signals can be observed while indexing large transcripts.
|
|
65
|
+
*/
|
|
66
|
+
declare function searchSessionHistoryCooperatively(lineage: KodaXSessionLineage, options: KodaXSessionHistorySearchOptions, control: KodaXSessionHistorySearchControl): Promise<KodaXSessionHistorySearchResult>;
|
|
54
67
|
declare function readSessionHistoryEntry(lineage: KodaXSessionLineage, options: KodaXSessionHistoryReadOptions): KodaXSessionHistoryReadResult;
|
|
55
68
|
|
|
56
|
-
export { readSessionHistoryEntry as r, searchSessionHistory as s };
|
|
69
|
+
export { searchSessionHistoryCooperatively as g, readSessionHistoryEntry as r, searchSessionHistory as s, validateSessionHistorySearchQuery as v };
|
|
57
70
|
export type { KodaXSessionHistoryHit as K, KodaXSessionHistoryReadOptions as a, KodaXSessionHistoryReadResult as b, KodaXSessionHistoryScope as c, KodaXSessionHistorySearchOptions as d, KodaXSessionHistorySearchResult as e, KodaXSessionHistorySource as f };
|