@kodax-ai/kodax 0.7.78 → 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 +3475 -3197
- package/README.md +346 -275
- package/README_CN.md +274 -214
- package/config-templates/config.example.jsonc +11 -1
- 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-ASP4MS3X.js → agent-V4AC5JZD.js} +1 -1
- package/dist/chunks/argument-completer-ZPC2MLES.js +2 -0
- package/dist/chunks/{chunk-Z3KFRTSB.js → chunk-67THZRM6.js} +1 -1
- package/dist/chunks/chunk-6GVQDQTQ.js +292 -0
- package/dist/chunks/{chunk-TQDBTTIM.js → chunk-B6UY3VHV.js} +40 -40
- package/dist/chunks/{chunk-7OEBJGHK.js → chunk-BBOVVDQJ.js} +1 -1
- package/dist/chunks/chunk-CR2IF7VF.js +30 -0
- package/dist/chunks/{chunk-UID7BLAB.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-2CFHBKRE.js → chunk-M4N2JZTZ.js} +2 -2
- package/dist/chunks/{chunk-YAZQTC2L.js → chunk-OWQT3FTE.js} +1 -1
- package/dist/chunks/chunk-Q4M7DJOD.js +319 -0
- package/dist/chunks/{chunk-6FOJVETH.js → chunk-QCZLCLFL.js} +7 -7
- 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-VQLQGWPY.js → construction-bootstrap-K3ZGEN5N.js} +1 -1
- package/dist/chunks/dist-GFJFRPAV.js +2 -0
- package/dist/chunks/{dist-BFT5YIGU.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-SID4HW2Q.js → utils-6LEKJPQN.js} +1 -1
- package/dist/index.d.ts +20 -20
- package/dist/index.js +2 -2
- package/dist/kodax_bootstrap.js +2 -1
- package/dist/kodax_cli.js +1816 -1458
- package/dist/kodax_resume.js +570 -34
- package/dist/provider-capabilities.json +85 -50
- package/dist/runtime-worker.js +1713 -1361
- package/dist/sandbox-workspace-session.js +285 -19
- package/dist/sdk-a2a.d.ts +19 -13
- package/dist/sdk-a2a.js +8 -8
- package/dist/sdk-agent.d.ts +73 -141
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +29 -60
- 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 -7
- 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 +25 -26
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +227 -31
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +8 -8
- package/dist/sdk-session.js +1 -1
- 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-uAe2Oqda.d.ts → bash-prefix-extractor.d-CNSidpmv.d.ts} +28 -7
- package/dist/types-chunks/{capability-learning.d-CVsdHw4j.d.ts → capability-learning.d-iPSiAmc_.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-BlSv9l3V.d.ts → capsule.d-B3q98pLQ.d.ts} +9 -7
- package/dist/types-chunks/{types.d-BA-Jwpfs.d.ts → controller.d-RGV7Pjv9.d.ts} +328 -3
- package/dist/types-chunks/{guardrail.d-CXDYRgZ3.d.ts → guardrail.d-1NLSFTyN.d.ts} +126 -52
- package/dist/types-chunks/{history-retrieval.d-DtCy7x64.d.ts → history-retrieval.d-BAegI14A.d.ts} +16 -3
- 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-B3AohsxN.d.ts → public-api.d-BpJhHoa7.d.ts} +334 -25
- package/dist/types-chunks/{repl.d-Ie_ZXb_U.d.ts → repl.d-CZ12Ow3X.d.ts} +5 -5
- package/dist/types-chunks/{resolver.d-iAQ9ocLB.d.ts → resolver.d-C9IW4fmU.d.ts} +5 -2
- package/dist/types-chunks/{run-manager.d-D1twIhF9.d.ts → run-manager.d-CX3AUocA.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-DB9KksIx.d.ts → sdk-session-B3cfJKqF.d.ts} +3 -3
- package/dist/types-chunks/{side-query.d-DTuLPcC5.d.ts → side-query.d-CP1LiRiH.d.ts} +8 -2
- package/dist/types-chunks/{types-D3g6XUQr.d.ts → types-Bf3Y3mW-.d.ts} +1 -1
- package/dist/types-chunks/{types.d-BH0ZkTGf.d.ts → types.d-BZ9oXvTV.d.ts} +2 -2
- package/dist/types-chunks/{types.d-DVDTIfB_.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-CVp6bFl9.d.ts → utils.d-CGpHavsU.d.ts} +14 -6
- package/docs/SDK_EMBEDDER_GUIDE.md +1144 -598
- package/package.json +4 -1
- package/dist/chunks/argument-completer-JYQ7FX3W.js +0 -2
- package/dist/chunks/chunk-35PPHOQ2.js +0 -292
- package/dist/chunks/chunk-43QNNDHR.js +0 -29
- package/dist/chunks/chunk-5GO6FH7L.js +0 -458
- package/dist/chunks/chunk-5NDCSFOP.js +0 -78
- package/dist/chunks/chunk-6XM4B6K2.js +0 -48
- package/dist/chunks/chunk-6YZUE6NC.js +0 -240
- package/dist/chunks/chunk-KQLQYHWU.js +0 -386
- package/dist/chunks/chunk-NXO6GWSY.js +0 -46
- package/dist/chunks/chunk-T2XZTLYE.js +0 -316
- package/dist/chunks/chunk-VAT2QYXM.js +0 -765
- package/dist/chunks/chunk-YVRYHC4C.js +0 -655
- package/dist/chunks/compaction-config-BQSSIWK5.js +0 -2
- package/dist/chunks/dist-PCFE24YP.js +0 -2
- package/dist/chunks/host-UTFXCYYM.js +0 -2
- package/dist/chunks/run-manager-PJU3WIFJ.js +0 -2
- package/dist/types-chunks/guardrail.d-BRE_ErEj.d.ts +0 -156
|
@@ -1,10 +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 {
|
|
6
|
-
import {
|
|
7
|
-
import { S as SideQueryDiagnostics } from './side-query.d-DTuLPcC5.js';
|
|
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';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* FEATURE_200 Phase F (v0.7.45) — MCP domain types extracted from types.ts.
|
|
@@ -54,6 +53,50 @@ declare function loadAgentsFiles(options?: LoadAgentsOptions): AgentsFile[];
|
|
|
54
53
|
*/
|
|
55
54
|
declare function formatAgentsForPrompt(files: AgentsFile[]): string;
|
|
56
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
|
+
|
|
57
100
|
/**
|
|
58
101
|
* Auto-Mode Rules Loader — FEATURE_092 Phase 2b.2 (v0.7.33).
|
|
59
102
|
*
|
|
@@ -72,11 +115,15 @@ declare function formatAgentsForPrompt(files: AgentsFile[]): string;
|
|
|
72
115
|
*
|
|
73
116
|
* Schema (each field optional, defaults to []):
|
|
74
117
|
* {
|
|
75
|
-
* "allow": string[], //
|
|
76
|
-
* "soft_deny": string[], //
|
|
118
|
+
* "allow": string[], // contextual examples supporting an allow
|
|
119
|
+
* "soft_deny": string[], // contextual cautions for the classifier to inspect
|
|
77
120
|
* "environment": string[] // background context the classifier sees verbatim
|
|
78
121
|
* }
|
|
79
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
|
+
*
|
|
80
127
|
* Merge: layers concatenated in order (user → project → local). Identical
|
|
81
128
|
* strings deduplicated by stable insertion (later layers win position only
|
|
82
129
|
* when the string is unique per layer).
|
|
@@ -136,7 +183,7 @@ declare function loadAutoRules(opts: LoadAutoRulesOptions): Promise<RulesLoadRes
|
|
|
136
183
|
*
|
|
137
184
|
* Mechanical pattern matches over a tool call. Signals are NOT verdicts;
|
|
138
185
|
* the classifier consumes them as informational input alongside transcript
|
|
139
|
-
* + user rules and produces the final decision (allow /
|
|
186
|
+
* + user rules and produces the final Auto[LLM] decision (allow / ask).
|
|
140
187
|
*
|
|
141
188
|
* Two invariants the producers must hold:
|
|
142
189
|
*
|
|
@@ -150,10 +197,9 @@ declare function loadAutoRules(opts: LoadAutoRulesOptions): Promise<RulesLoadRes
|
|
|
150
197
|
* so the classifier can weight signals, but the verdict is not encoded
|
|
151
198
|
* here.
|
|
152
199
|
*
|
|
153
|
-
* Tier 0
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* 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.
|
|
157
203
|
*
|
|
158
204
|
* Design ref: ADR-025, FEATURE_158 (docs/features/v0.7.39.md).
|
|
159
205
|
*/
|
|
@@ -248,6 +294,12 @@ interface PermissionIntentEvidence {
|
|
|
248
294
|
/** Latest genuine user request, kept separate as the authoritative intent. */
|
|
249
295
|
readonly currentUserContent?: string;
|
|
250
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;
|
|
251
303
|
readonly content: string;
|
|
252
304
|
readonly sourceBytes: number;
|
|
253
305
|
readonly includedBytes: number;
|
|
@@ -371,6 +423,9 @@ interface ClassifierAttemptDiagnostics {
|
|
|
371
423
|
readonly attempt: number;
|
|
372
424
|
readonly outcome: ClassifierAttemptOutcome;
|
|
373
425
|
readonly diagnostics?: SideQueryDiagnostics;
|
|
426
|
+
readonly observedProtocol?: ClassifierObservedProtocol;
|
|
427
|
+
readonly parseFailureCode?: ClassifierParseFailureCode | 'tool_use';
|
|
428
|
+
readonly outputWarnings?: readonly ClassifierOutputWarningCode[];
|
|
374
429
|
}
|
|
375
430
|
interface ClassifyDecisionDetails {
|
|
376
431
|
readonly reason: string;
|
|
@@ -389,16 +444,19 @@ type ClassifyDecision = ({
|
|
|
389
444
|
/**
|
|
390
445
|
* The deadline includes connection setup, provider-side queueing, inference,
|
|
391
446
|
* and any Retry-After/backoff handled by the provider adapter. Keep it bounded
|
|
392
|
-
* so infrastructure failure
|
|
447
|
+
* so infrastructure failure reaches the configured Accept-edits fallback.
|
|
393
448
|
*/
|
|
394
|
-
declare const DEFAULT_CLASSIFIER_TIMEOUT_MS =
|
|
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;
|
|
395
452
|
declare function classify(opts: ClassifyOptions): Promise<ClassifyDecision>;
|
|
396
453
|
|
|
397
454
|
/**
|
|
398
455
|
* Denial Tracker — FEATURE_092 Phase 2b.4 (v0.7.33).
|
|
399
456
|
*
|
|
400
457
|
* Tracks classifier blocks per session. When either threshold is crossed,
|
|
401
|
-
*
|
|
458
|
+
* threshold state is exposed for diagnostics and does not mutate the selected
|
|
459
|
+
* Auto engine.
|
|
402
460
|
*
|
|
403
461
|
* - 3 consecutive blocks → likely an unproductive loop (agent not adapting)
|
|
404
462
|
* - 20 cumulative blocks → broader classifier-noise pattern in this session
|
|
@@ -424,8 +482,9 @@ declare function shouldFallback$1(t: DenialTracker): boolean;
|
|
|
424
482
|
*
|
|
425
483
|
* Sliding-window error counter for classifier failures (timeouts, 5xx, 429,
|
|
426
484
|
* unparseable outputs). When ≥ 5 errors land within a 10-minute window, the
|
|
427
|
-
*
|
|
428
|
-
*
|
|
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.
|
|
429
488
|
*
|
|
430
489
|
* Pure functional API: each operation returns a new breaker. No mutation.
|
|
431
490
|
* Memory bound: stale timestamps are pruned on each recordError call so
|
|
@@ -441,20 +500,15 @@ declare function recordError(b: CircuitBreaker, now: number): CircuitBreaker;
|
|
|
441
500
|
declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
|
|
442
501
|
|
|
443
502
|
/**
|
|
444
|
-
* Tier 0
|
|
445
|
-
*
|
|
446
|
-
* The narrowest possible set of catastrophic patterns that must NEVER reach
|
|
447
|
-
* the LLM classifier (which is fallible / can be prompt-injected). Per
|
|
448
|
-
* ADR-025: every entry here must satisfy BOTH gates:
|
|
503
|
+
* Historical Tier 0 high-impact pattern detector — FEATURE_158 Step 4.
|
|
449
504
|
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
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:
|
|
454
510
|
*
|
|
455
|
-
* The
|
|
456
|
-
* ADR addendum answering (a)+(b) again. Removing entries requires evidence
|
|
457
|
-
* of high-volume false-positive friction.
|
|
511
|
+
* The detector must not expand into a second Auto[LLM] approval policy.
|
|
458
512
|
*
|
|
459
513
|
* Patterns:
|
|
460
514
|
*
|
|
@@ -462,7 +516,7 @@ declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
|
|
|
462
516
|
* / -fr variants). Excludes `rm -rf /tmp/foo` (which
|
|
463
517
|
* is a `dangerous_pattern` signal but reaches LLM).
|
|
464
518
|
* 2. mkfs_or_format — `mkfs.* /dev/sd*`, `fdisk /dev/sd*`, `format C:`.
|
|
465
|
-
*
|
|
519
|
+
* Identifies formatting of a disk device.
|
|
466
520
|
* 3. dd_disk_write — `dd of=/dev/sd*` (raw-disk write). Excludes
|
|
467
521
|
* `dd of=test.bin` (file write — reaches LLM as
|
|
468
522
|
* dangerous_pattern signal).
|
|
@@ -470,13 +524,12 @@ declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
|
|
|
470
524
|
* 5. user_kodax_write — write/edit to any path under `~/.kodax/`
|
|
471
525
|
* (credentials zone — internal kodax config writes
|
|
472
526
|
* use the TypeScript API, not bash/tools, so the
|
|
473
|
-
* only path here is LLM-emitted shell
|
|
474
|
-
* always wrong).
|
|
527
|
+
* only path here is normally an LLM-emitted shell).
|
|
475
528
|
*
|
|
476
529
|
* Layer note: bash-level `~/.kodax/` writes (e.g. `echo x > ~/.kodax/y`)
|
|
477
530
|
* require AST path-extraction which lives in `@kodax/repl`. The REPL-side
|
|
478
|
-
* collector wired through `extraCollectors` (Step 7)
|
|
479
|
-
* 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
|
|
480
533
|
* `AbsoluteDenyResult` shape. This module handles the file-tool path
|
|
481
534
|
* directly (the most common attack vector) and the four command-string
|
|
482
535
|
* patterns that don't need path extraction.
|
|
@@ -494,13 +547,15 @@ interface AbsoluteDenyMiss {
|
|
|
494
547
|
type AbsoluteDenyResult = AbsoluteDenyMatch | AbsoluteDenyMiss;
|
|
495
548
|
type AbsoluteDenyCheck = (call: RunnerToolCall, projectRoot: string, executionCwd: string) => AbsoluteDenyResult;
|
|
496
549
|
/**
|
|
497
|
-
* Check a tool call against the Tier 0
|
|
498
|
-
* 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].
|
|
499
554
|
*
|
|
500
555
|
* Order is deterministic — patterns checked in the order defined above.
|
|
501
556
|
* Multiple matches would be possible (e.g. `rm -rf / ; :(){...};:`) but
|
|
502
|
-
* we return the first hit
|
|
503
|
-
*
|
|
557
|
+
* we return the first hit because one precise fact is sufficient for the
|
|
558
|
+
* classifier and the reason string is one-shot.
|
|
504
559
|
*
|
|
505
560
|
* **Pure**: deterministic given (call, projectRoot, stable env).
|
|
506
561
|
* **Fast**: ~5 regex tests + 1-2 string ops; safe to run on every
|
|
@@ -518,12 +573,14 @@ declare function checkAbsoluteDeny(call: RunnerToolCall, projectRoot: string, ex
|
|
|
518
573
|
*
|
|
519
574
|
* Decision flow (per design doc "三层权限金字塔"):
|
|
520
575
|
*
|
|
521
|
-
* 1.
|
|
522
|
-
* 2.
|
|
523
|
-
* 3.
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
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)
|
|
527
584
|
* allow → allow (record allow → reset consecutive)
|
|
528
585
|
* confirm → user confirmation (record concern)
|
|
529
586
|
* failure → Accept-edits fallback (record error)
|
|
@@ -555,9 +612,10 @@ interface AutoModeSharedState {
|
|
|
555
612
|
/**
|
|
556
613
|
* User answer for an escalated tool-call. The guardrail translates this into
|
|
557
614
|
* the actual `GuardrailVerdict` returned to the Runner. `'block'` preserves
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
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.
|
|
561
619
|
*/
|
|
562
620
|
type AutoModeAskUserVerdict = 'allow' | 'block' | 'timeout';
|
|
563
621
|
interface AutoModeDecisionDiagnostics {
|
|
@@ -589,6 +647,13 @@ interface AutoModeRulesContext {
|
|
|
589
647
|
readonly projectRoot: string;
|
|
590
648
|
readonly executionCwd: string;
|
|
591
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;
|
|
592
657
|
}
|
|
593
658
|
type AutoModePermissionBoundary = 'workspace' | 'system-temp' | 'outside-workspace' | 'protected' | 'unresolved';
|
|
594
659
|
interface AutoModePermissionTarget {
|
|
@@ -675,7 +740,8 @@ interface AutoModeGuardrailConfig {
|
|
|
675
740
|
readonly evaluateRulesCall?: AutoModeRulesEvaluator;
|
|
676
741
|
/**
|
|
677
742
|
* Runtime-owned compact facts used by deterministic read admission and the
|
|
678
|
-
* 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.
|
|
679
745
|
*/
|
|
680
746
|
readonly analyzeCall?: AutoModeCallAnalyzer;
|
|
681
747
|
/**
|
|
@@ -739,7 +805,7 @@ interface AutoModeGuardrailConfig {
|
|
|
739
805
|
readonly initialEngine?: AutoModeEngine;
|
|
740
806
|
/**
|
|
741
807
|
* FEATURE_092 phase 2b.7b slice C: classifier sideQuery timeout in ms.
|
|
742
|
-
* Defaults to
|
|
808
|
+
* Defaults to 30_000. Resolved by the REPL from `~/.kodax/config.json`
|
|
743
809
|
* `autoMode.timeoutMs`.
|
|
744
810
|
*/
|
|
745
811
|
readonly timeoutMs?: number;
|
|
@@ -758,6 +824,11 @@ interface AutoModeGuardrailConfig {
|
|
|
758
824
|
readonly projectRoot?: string;
|
|
759
825
|
/** Directory used to resolve relative tool paths. Defaults to projectRoot. */
|
|
760
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;
|
|
761
832
|
/**
|
|
762
833
|
* Override the default signal-collector set. When unset, defaults to
|
|
763
834
|
* `[bashSignalCollector, fileSignalCollector]` — coding-side
|
|
@@ -780,7 +851,10 @@ interface AutoModeGuardrailConfig {
|
|
|
780
851
|
* signal order).
|
|
781
852
|
*/
|
|
782
853
|
readonly extraCollectors?: readonly SignalCollector[];
|
|
783
|
-
/**
|
|
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
|
+
*/
|
|
784
858
|
readonly extraAbsoluteDenyChecks?: readonly AbsoluteDenyCheck[];
|
|
785
859
|
/**
|
|
786
860
|
* Speculative-classify quiet window (ms). When a classifier promise
|
|
@@ -836,5 +910,5 @@ interface AutoModeToolGuardrail extends ToolGuardrail {
|
|
|
836
910
|
}
|
|
837
911
|
declare function createAutoModeToolGuardrail(config: AutoModeGuardrailConfig): AutoModeToolGuardrail;
|
|
838
912
|
|
|
839
|
-
export {
|
|
840
|
-
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-DtCy7x64.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 };
|
|
@@ -30,6 +30,10 @@ declare class McpAuthRequiredError extends Error {
|
|
|
30
30
|
constructor(status: number, wwwAuthenticate?: string | undefined);
|
|
31
31
|
}
|
|
32
32
|
type StdioFraming = 'content-length' | 'ndjson';
|
|
33
|
+
declare class McpTransportCleanupIncompleteError extends Error {
|
|
34
|
+
readonly code: "mcp_cleanup_incomplete";
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
33
37
|
interface McpTransportOptions {
|
|
34
38
|
stdioFraming?: StdioFraming;
|
|
35
39
|
httpResolvedTransport?: 'streamable-http' | 'sse';
|
|
@@ -170,5 +174,5 @@ declare function performOAuthLogin(options: PerformOAuthLoginOptions): Promise<O
|
|
|
170
174
|
*/
|
|
171
175
|
declare function loadValidToken(serverId: string): Promise<OAuthToken | undefined>;
|
|
172
176
|
|
|
173
|
-
export { McpAuthRequiredError as M, McpExpiredSessionError as a, createMcpTransport as
|
|
174
|
-
export type { AuthorizationServerMetadata as A, DiscoveredOAuthEndpoints as D, OAuthClientInfo as O, PerformOAuthLoginOptions as P, WwwAuthenticateChallenge as W, McpTransport as b, McpTransportEvents as
|
|
177
|
+
export { McpAuthRequiredError as M, McpExpiredSessionError as a, McpTransportCleanupIncompleteError as c, createMcpTransport as g, discoverAuthorizationServerMetadata as h, discoverOAuthEndpoints as i, discoverProtectedResourceMetadata as j, extractInsufficientScope as k, extractResourceMetadataUrl as l, loadValidToken as m, performOAuthLogin as p, registerOAuthClient as r };
|
|
178
|
+
export type { AuthorizationServerMetadata as A, DiscoveredOAuthEndpoints as D, OAuthClientInfo as O, PerformOAuthLoginOptions as P, WwwAuthenticateChallenge as W, McpTransport as b, McpTransportEvents as d, OAuthLoginConsent as e, ProtectedResourceMetadata as f };
|