@kodax-ai/kodax 0.7.71 → 0.7.72
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 +602 -487
- package/README.md +46 -27
- package/README_CN.md +30 -13
- package/dist/chunks/agent-YKGU4USA.js +2 -0
- package/dist/chunks/argument-completer-QZETLNAB.js +2 -0
- package/dist/chunks/{chunk-SX2WFHIS.js → chunk-2RI252RN.js} +1 -1
- package/dist/chunks/chunk-CLFP6UGU.js +71 -0
- package/dist/chunks/chunk-E27LHEIP.js +37 -0
- package/dist/chunks/chunk-EDZ5KJFT.js +5 -0
- package/dist/chunks/chunk-GIK4SGAT.js +364 -0
- package/dist/chunks/chunk-GVWPHE23.js +310 -0
- package/dist/chunks/{chunk-A2TFSV5M.js → chunk-IR5KIK7E.js} +1 -1
- package/dist/chunks/chunk-JSDLBXME.js +755 -0
- package/dist/chunks/chunk-MVARIMQV.js +22 -0
- package/dist/chunks/chunk-PKQOEDHJ.js +628 -0
- package/dist/chunks/{chunk-64NQBOSN.js → chunk-SQODXBLX.js} +1 -1
- package/dist/chunks/chunk-VDGCGOQH.js +328 -0
- package/dist/chunks/chunk-VVE3UM4F.js +410 -0
- package/dist/chunks/chunk-WIBLZK4G.js +151 -0
- package/dist/chunks/{compaction-config-5KKKXYFT.js → compaction-config-TWCDFLX6.js} +1 -1
- package/dist/chunks/{construction-bootstrap-OXDDDW6O.js → construction-bootstrap-ZJPXUPXQ.js} +1 -1
- package/dist/chunks/dist-JT4ATXVM.js +2 -0
- package/dist/chunks/host-SVEDZUC5.js +2 -0
- package/dist/chunks/{run-manager-Z3W6MDO7.js → run-manager-RX42UNEM.js} +1 -1
- package/dist/chunks/{utils-CFOXDCB5.js → utils-OTT5CG5J.js} +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +4 -4
- package/dist/kodax_bootstrap.js +28 -0
- package/dist/kodax_cli.js +1325 -1333
- package/dist/kodax_resume.js +44 -0
- package/dist/provider-capabilities.json +50 -48
- package/dist/runtime-worker.js +1322 -1330
- package/dist/sdk-a2a.d.ts +10 -9
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +382 -206
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +80 -128
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +3 -0
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +71 -23
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +143 -31
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-session.d.ts +6 -5
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.d.ts +5 -5
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +14 -14
- package/dist/types-chunks/{bash-prefix-extractor.d-YoiZl5yt.d.ts → bash-prefix-extractor.d-CHJO5y94.d.ts} +107 -248
- package/dist/types-chunks/{capsule.d-CK5Pfz1k.d.ts → capsule.d-DxtdE-GD.d.ts} +24 -95
- package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +91 -0
- package/dist/types-chunks/{commands.d-D6g2jq8V.d.ts → commands.d-DZxHzH5-.d.ts} +6 -4
- package/dist/types-chunks/{guardrail.d-DilYC1dh.d.ts → guardrail.d-DlpMnd-Y.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-DdeDWnVu.d.ts → guardrail.d-auV61_h5.d.ts} +83 -10
- package/dist/types-chunks/public-api.d--IDNJsu1.d.ts +1342 -0
- package/dist/types-chunks/{run-manager.d-DxU3SSGR.d.ts → run-manager.d-Bh50OdVl.d.ts} +1 -1
- package/dist/types-chunks/sdk-session-Cfw6NFu-.d.ts +82 -0
- package/dist/types-chunks/{types.d-CEZZSY9s.d.ts → types.d-CNZgY52F.d.ts} +2 -2
- package/dist/types-chunks/{types.d-vJExiRje.d.ts → types.d-DCQVBqVn.d.ts} +10 -5
- package/dist/types-chunks/{types.d-CRCaLt_s.d.ts → types.d-DH1mvdcl.d.ts} +284 -164
- package/dist/types-chunks/{types.d-CzsLFqmf.d.ts → types.d-EqQmHztg.d.ts} +9 -10
- package/dist/types-chunks/{utils.d-Cb6vdvFM.d.ts → utils.d-gmn3c5U4.d.ts} +9 -12
- package/docs/SDK_EMBEDDER_GUIDE.md +171 -26
- package/package.json +4 -4
- package/scripts/kodax-bin.cjs +4 -2
- package/scripts/production-env.cjs +9 -0
- package/dist/chunks/agent-X2EWQADL.js +0 -2
- package/dist/chunks/argument-completer-BLNXDO2F.js +0 -2
- package/dist/chunks/chunk-4DY756KL.js +0 -70
- package/dist/chunks/chunk-52JSZ77P.js +0 -37
- package/dist/chunks/chunk-A574DBTV.js +0 -422
- package/dist/chunks/chunk-F7KGYHJ3.js +0 -624
- package/dist/chunks/chunk-GVTM4Z6O.js +0 -151
- package/dist/chunks/chunk-PHH4TRGF.js +0 -22
- package/dist/chunks/chunk-PVUXONQB.js +0 -366
- package/dist/chunks/chunk-T7LYK53M.js +0 -329
- package/dist/chunks/chunk-VRSVNU2Y.js +0 -7
- package/dist/chunks/chunk-Y5XKAN7C.js +0 -755
- package/dist/chunks/chunk-Z535BARK.js +0 -306
- package/dist/chunks/dist-IXJRJ27U.js +0 -2
- package/dist/chunks/host-VRKDAN26.js +0 -2
- package/dist/types-chunks/public-api.d-BvCp5VkW.d.ts +0 -601
- package/dist/types-chunks/sdk-session-wGpa7X_U.d.ts +0 -796
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { k as KodaXMessage } from './types.d-Cqaw71Ax.js';
|
|
2
|
-
import {
|
|
3
|
-
import { M as AgentMessage, cH as SessionEntry, cF as Session, cJ as SessionExtension, bb as KodaXSessionLineage, aZ as KodaXJsonValue, af as CompactionDetails, aM as KodaXCompactMemorySeed, b7 as KodaXSessionEntry, bl as KodaXSessionTreeNode, ba as KodaXSessionLabelEntry, b9 as KodaXSessionGoalEntry, b4 as KodaXSessionClientNoticeEntry, bh as KodaXSessionRewindMarkerEntry, bc as KodaXSessionMemoryOutcomeDigestEntry, bd as KodaXSessionMemoryReviewReceiptEntry, bg as KodaXSessionNavigationOptions, b2 as KodaXSessionArtifactLedgerEntry, aA as FileOperations, dm as WorkflowMeta, dn as WorkflowModelHint, dp as WorkflowModule } from './types.d-CRCaLt_s.js';
|
|
2
|
+
import { a8 as AgentMessage, dd as SessionEntry, db as Session, df as SessionExtension, bL as KodaXSessionLineage, bx as KodaXJsonValue, aP as CompactionDetails, bk as KodaXCompactMemorySeed, bH as KodaXSessionEntry, bV as KodaXSessionTreeNode, bK as KodaXSessionLabelEntry, bJ as KodaXSessionGoalEntry, bE as KodaXSessionClientNoticeEntry, bR as KodaXSessionRewindMarkerEntry, bM as KodaXSessionMemoryOutcomeDigestEntry, bN as KodaXSessionMemoryReviewReceiptEntry, bQ as KodaXSessionNavigationOptions, bC as KodaXSessionArtifactLedgerEntry, b8 as FileOperations, dU as WorkflowMeta, dV as WorkflowModelHint, dW as WorkflowModule } from './types.d-DH1mvdcl.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* @kodax-ai/agent Constants
|
|
@@ -250,6 +249,14 @@ declare function getAgentConfigHome(): string;
|
|
|
250
249
|
* 30 callsites of `getAgentConfigPath(x, y)`).
|
|
251
250
|
*/
|
|
252
251
|
declare function getAgentConfigPath(...segments: string[]): string;
|
|
252
|
+
/**
|
|
253
|
+
* Lexical path containment with the host filesystem's comparison semantics.
|
|
254
|
+
* Windows paths are case-insensitive; segment boundaries prevent sibling
|
|
255
|
+
* prefixes such as `.kodax-backup` from being treated as descendants.
|
|
256
|
+
*/
|
|
257
|
+
declare function isPathInsideDirectory(targetPath: string, directoryPath: string): boolean;
|
|
258
|
+
/** Resolve a tool path from the directory where the tool actually executes. */
|
|
259
|
+
declare function resolveExecutionPath(targetPath: string, executionCwd: string): string;
|
|
253
260
|
/**
|
|
254
261
|
* v0.7.42 — Namespaced data directory for third-party apps embedding the
|
|
255
262
|
* KodaX SDK (e.g. `KodaX Space` desktop client, IDE extensions).
|
|
@@ -271,97 +278,19 @@ declare function getAgentConfigPath(...segments: string[]): string;
|
|
|
271
278
|
*/
|
|
272
279
|
declare function getAppDataDir(appId: string): string;
|
|
273
280
|
|
|
274
|
-
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
* TodoStore semantics).
|
|
288
|
-
*
|
|
289
|
-
* The queue is process-global by default (`getMessageQueue()`); the class is
|
|
290
|
-
* also exported for tests / isolated downstream use.
|
|
291
|
-
*/
|
|
292
|
-
|
|
293
|
-
declare class MessageQueue {
|
|
294
|
-
private messages;
|
|
295
|
-
private nextSeq;
|
|
296
|
-
/**
|
|
297
|
-
* FEATURE_159 (v0.7.40) — observable subscription set. Same pattern as
|
|
298
|
-
* Claude Code's `messageQueueManager.ts` `createSignal()` substrate,
|
|
299
|
-
* but the listener carries a structured `QueueEvent` so SDK
|
|
300
|
-
* observability consumers (logger, tracer, metrics) can react per-
|
|
301
|
-
* event without re-diffing snapshots. `useSyncExternalStore` consumers
|
|
302
|
-
* still work — they ignore the event argument.
|
|
303
|
-
*
|
|
304
|
-
* Cached `snapshotRef` keeps reference identity stable across reads
|
|
305
|
-
* when nothing changed — required by React 18's `useSyncExternalStore`
|
|
306
|
-
* to avoid render loops.
|
|
307
|
-
*/
|
|
308
|
-
private listeners;
|
|
309
|
-
private snapshotRef;
|
|
310
|
-
private notify;
|
|
311
|
-
/**
|
|
312
|
-
* Subscribe to queue mutations. Compatible with React 18's
|
|
313
|
-
* `useSyncExternalStore(subscribe, getSnapshot)` — the hook passes a
|
|
314
|
-
* `() => void` callback, which is structurally assignable to the
|
|
315
|
-
* `QueueEventListener` parameter because TypeScript treats
|
|
316
|
-
* callback parameter discards as compatible. SDK consumers that
|
|
317
|
-
* declare a typed `(event: QueueEvent) => void` listener see the
|
|
318
|
-
* structured event.
|
|
319
|
-
*
|
|
320
|
-
* Listener is called synchronously after every mutation; returns an
|
|
321
|
-
* unsubscribe function.
|
|
322
|
-
*/
|
|
323
|
-
subscribe: (listener: QueueEventListener) => (() => void);
|
|
324
|
-
/**
|
|
325
|
-
* Returns the current frozen queue snapshot. Reference identity is
|
|
326
|
-
* stable across reads when the queue has not mutated, which is the
|
|
327
|
-
* contract React's `useSyncExternalStore` relies on.
|
|
328
|
-
*/
|
|
329
|
-
getSnapshot: () => readonly QueuedMessage[];
|
|
330
|
-
/** Returns the assigned id of the enqueued message. */
|
|
331
|
-
enqueue(input: EnqueueInput): string;
|
|
332
|
-
/**
|
|
333
|
-
* Drain matching messages, ordered by priority (user > background) then
|
|
334
|
-
* FIFO within each priority. Removes drained messages from the queue.
|
|
335
|
-
*/
|
|
336
|
-
dequeue(filter: DequeueFilter): QueuedMessage[];
|
|
337
|
-
/**
|
|
338
|
-
* Peek at matching messages without removing them. Returns messages in
|
|
339
|
-
* the same priority + FIFO order that `dequeue(filter)` would return,
|
|
340
|
-
* so callers can inspect what the next drain would yield.
|
|
341
|
-
*/
|
|
342
|
-
peek(filter: DequeueFilter): QueuedMessage[];
|
|
343
|
-
/** Total queue size across all priorities / agents. */
|
|
344
|
-
size(): number;
|
|
345
|
-
/** Count of messages matching the filter. */
|
|
346
|
-
count(filter: DequeueFilter): number;
|
|
347
|
-
/** True iff at least one message matches the filter. */
|
|
348
|
-
has(filter: DequeueFilter): boolean;
|
|
349
|
-
/** Remove all queued messages — used in tests / process abort scenarios. */
|
|
350
|
-
clear(): void;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Returns the process-global MessageQueue singleton, creating it lazily on
|
|
354
|
-
* first call. Use this for production wiring; instantiate `MessageQueue`
|
|
355
|
-
* directly in tests / isolated subsystems where a shared instance would
|
|
356
|
-
* cause cross-test pollution.
|
|
357
|
-
*/
|
|
358
|
-
declare function getMessageQueue(): MessageQueue;
|
|
359
|
-
/**
|
|
360
|
-
* Test-only reset hook. Production code MUST NOT call this. Underscored
|
|
361
|
-
* prefix follows the same convention as `_resetInvariantRegistry` /
|
|
362
|
-
* `_resetAdmittedAgentBindings` / `_resetAdmissionMetrics`.
|
|
363
|
-
*/
|
|
364
|
-
declare function _resetMessageQueueForTests(): void;
|
|
281
|
+
/** Canonical MessageQueue routing key for an Actor within a runtime session. */
|
|
282
|
+
declare function actorQueueId(sessionId: string, actorPath: string): string;
|
|
283
|
+
declare function actorQueueId(sessionId: string | undefined, actorPath: string): string | undefined;
|
|
284
|
+
/**
|
|
285
|
+
* Advertise a live Actor root queue to compatibility helpers. Repeated
|
|
286
|
+
* registration is reference-counted because nested execution layers can own
|
|
287
|
+
* the same route.
|
|
288
|
+
*/
|
|
289
|
+
declare function registerActiveRootQueueRoute(agentId: string): () => void;
|
|
290
|
+
/** Resolve the sole live Actor root, failing closed when routing is ambiguous. */
|
|
291
|
+
declare function resolveActiveRootQueueRoute(): string | undefined;
|
|
292
|
+
/** Test-only process-global reset. */
|
|
293
|
+
declare function _resetActiveRootQueueRoutesForTests(): void;
|
|
365
294
|
|
|
366
295
|
/**
|
|
367
296
|
* History cleanup middleware — CAP-002
|
|
@@ -831,5 +760,5 @@ declare function buildWorkflowCapsuleIntent(manifest: {
|
|
|
831
760
|
readonly originalRequest?: string;
|
|
832
761
|
}): WorkflowCapsuleIntent;
|
|
833
762
|
|
|
834
|
-
export { createSessionLineage as $, DefaultSummaryCompaction as D, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L,
|
|
835
|
-
export type { WorkflowCapsuleInputs as A, WorkflowCapsuleIntent as B, CompactionContext as C, WorkflowCapsuleProvenance as E, WorkflowCapsuleRequirements as F, WorkflowPatternId as G, WorkflowQualityLintFinding as H, WorkflowQualityLintOptions as I, WorkflowQualityLintSeverity as J, WorkflowScriptManifest as
|
|
763
|
+
export { createSessionLineage as $, DefaultSummaryCompaction as D, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, actorQueueId as N, appendSessionLineageLabel as O, PROMISE_PATTERN as P, applyLineageTruncation as Q, applySessionCompaction as R, archiveOldIslands as S, assertRestrictedWorkflowQuality as T, buildSessionTree as U, buildWorkflowCapsuleIntent as V, WORKFLOW_CAPSULE_API_VERSION as W, cleanupIncompleteToolCalls as X, countActiveLineageMessages as Y, countTokens as Z, _resetActiveRootQueueRoutesForTests as _, createWorkflowCapsule as a0, createWorkflowModuleFromCapsule as a1, estimateTokens as a2, extractArtifactLedger as a3, extractFileOps as a4, extractTitleFromMessages as a5, findPreviousUserEntryId as a6, forkSessionLineage as a7, generateSessionId as a8, getAgentConfigHome as a9, getAgentConfigPath as aa, getAppDataDir as ab, getSessionLineagePath as ac, getSessionMessagesFromLineage as ad, isPathInsideDirectory as ae, lintRestrictedWorkflowSource as af, mergeArtifactLedger as ag, mergeFileOps as ah, registerActiveRootQueueRoute as ai, resolveActiveRootQueueRoute as aj, resolveExecutionPath as ak, resolveSessionLineageTarget as al, rewindSessionLineage as am, setAgentConfigHome as an, setSessionLineageActiveEntry as ao, validateAndFixToolHistory as ap, validateWorkflowCapsule as aq, validateWorkflowScriptManifest as ar, KODAX_DEFAULT_TIMEOUT as f, KODAX_HARD_TIMEOUT as g, KODAX_MAX_INCOMPLETE_RETRIES as h, KODAX_MAX_MAXTOKENS_RETRIES as i, KODAX_MAX_RETRIES as j, KODAX_MAX_TOKENS as k, KODAX_RETRY_BASE_DELAY as l, KODAX_STAGGER_DELAY as m, LineageCompaction as o, LineageExtension as r, WORKFLOW_CAPSULE_FORMAT as v, WORKFLOW_CAPSULE_VERSION as w, WORKFLOW_PATTERN_IDS as x };
|
|
764
|
+
export type { WorkflowCapsuleInputs as A, WorkflowCapsuleIntent as B, CompactionContext as C, WorkflowCapsuleProvenance as E, WorkflowCapsuleRequirements as F, WorkflowPatternId as G, WorkflowQualityLintFinding as H, WorkflowQualityLintOptions as I, WorkflowQualityLintSeverity as J, WorkflowScriptManifest as M, CompactionEntry as a, CompactionEntryPayload as b, CompactionPolicy as c, CreateWorkflowCapsuleInput as d, DefaultSummaryCompactionOptions as e, LineageArtifactLedgerPayload as n, LineageCompactionDelegates as p, LineageEntryType as q, LineageLabelPayload as s, LineageTreeNode as t, PolicyCompactionResult as u, WorkflowCapsule as y, WorkflowCapsuleEnvironmentRequirement as z };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
type LearnedCapabilityCarrier = 'skill' | 'extension' | 'workflow_handoff';
|
|
2
|
+
type LearnedCapabilityLifecycle = 'opportunity' | 'drafting' | 'ready' | 'testing' | 'active_learned' | 'promoted_user' | 'quarantined' | 'archived' | 'rejected';
|
|
3
|
+
type LearningEventKind = 'opportunity' | 'drafting' | 'ready' | 'testing' | 'activated' | 'promoted' | 'attention' | 'archived' | 'rejected';
|
|
4
|
+
type LearningAction = 'review' | 'trust' | 'reject' | 'disable' | 'rollback' | 'archive' | 'restore' | 'promote';
|
|
5
|
+
interface LearnedCapabilitySource {
|
|
6
|
+
readonly kind: 'learning_controller' | 'f224_proposal';
|
|
7
|
+
readonly proposalId?: string;
|
|
8
|
+
}
|
|
9
|
+
interface LearnedCapabilityRecord {
|
|
10
|
+
readonly schemaVersion: 1;
|
|
11
|
+
readonly capabilityId: string;
|
|
12
|
+
readonly displayName: string;
|
|
13
|
+
readonly slug: string;
|
|
14
|
+
readonly carrier: LearnedCapabilityCarrier;
|
|
15
|
+
readonly lifecycle: LearnedCapabilityLifecycle;
|
|
16
|
+
readonly revision: number;
|
|
17
|
+
readonly createdAt: string;
|
|
18
|
+
readonly updatedAt: string;
|
|
19
|
+
readonly source: LearnedCapabilitySource;
|
|
20
|
+
/** The control action that produced this revision, when it is not implied by lifecycle. */
|
|
21
|
+
readonly lastAction?: LearningAction;
|
|
22
|
+
readonly artifactPath?: string;
|
|
23
|
+
readonly previousGoodRevision?: number;
|
|
24
|
+
readonly previousLifecycle?: LearnedCapabilityLifecycle;
|
|
25
|
+
readonly diagnostics?: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
interface LearningEvent {
|
|
28
|
+
readonly schemaVersion: 1;
|
|
29
|
+
readonly sequence: number;
|
|
30
|
+
readonly eventId: string;
|
|
31
|
+
readonly capabilityId: string;
|
|
32
|
+
readonly capabilityRevision: number;
|
|
33
|
+
readonly kind: LearningEventKind;
|
|
34
|
+
readonly lifecycle: LearnedCapabilityLifecycle;
|
|
35
|
+
readonly displayName: string;
|
|
36
|
+
readonly slug: string;
|
|
37
|
+
readonly carrier: LearnedCapabilityCarrier;
|
|
38
|
+
readonly createdAt: string;
|
|
39
|
+
}
|
|
40
|
+
type LearningNotificationState = 'unread' | 'seen' | 'acknowledged' | 'snoozed';
|
|
41
|
+
interface LearningClientEventState {
|
|
42
|
+
readonly state: LearningNotificationState;
|
|
43
|
+
readonly capabilityRevision: number;
|
|
44
|
+
readonly updatedAt: string;
|
|
45
|
+
readonly snoozedUntil?: string;
|
|
46
|
+
}
|
|
47
|
+
interface LearningClientRecord {
|
|
48
|
+
readonly schemaVersion: 1;
|
|
49
|
+
readonly clientIdentity: string;
|
|
50
|
+
readonly events: Readonly<Record<string, LearningClientEventState>>;
|
|
51
|
+
}
|
|
52
|
+
interface LearningSurfaceSnapshot {
|
|
53
|
+
readonly ready: number;
|
|
54
|
+
readonly newlyActive: number;
|
|
55
|
+
readonly attention: number;
|
|
56
|
+
readonly active: number;
|
|
57
|
+
readonly revision: number;
|
|
58
|
+
}
|
|
59
|
+
interface LearningQuery {
|
|
60
|
+
readonly search?: string;
|
|
61
|
+
readonly carrier?: LearnedCapabilityCarrier;
|
|
62
|
+
readonly lifecycle?: LearnedCapabilityLifecycle;
|
|
63
|
+
readonly limit?: number;
|
|
64
|
+
readonly cursor?: string;
|
|
65
|
+
}
|
|
66
|
+
interface LearningPage {
|
|
67
|
+
readonly items: readonly LearnedCapabilityRecord[];
|
|
68
|
+
readonly nextCursor?: string;
|
|
69
|
+
readonly revision: number;
|
|
70
|
+
}
|
|
71
|
+
interface LearningSubscribeOptions {
|
|
72
|
+
readonly afterRevision?: number;
|
|
73
|
+
}
|
|
74
|
+
interface LearningActionDriver {
|
|
75
|
+
readonly carrier: LearnedCapabilityCarrier;
|
|
76
|
+
readonly actions: readonly LearningAction[];
|
|
77
|
+
execute(action: LearningAction, capability: LearnedCapabilityRecord): Promise<LearnedCapabilityRecord>;
|
|
78
|
+
}
|
|
79
|
+
type LearningCapabilityErrorCode = 'ambiguous_name' | 'action_failed' | 'capability_not_found' | 'invalid_record' | 'invalid_transition' | 'store_integrity_error' | 'unsupported_action';
|
|
80
|
+
declare class LearningCapabilityError extends Error {
|
|
81
|
+
readonly code: LearningCapabilityErrorCode;
|
|
82
|
+
constructor(code: LearningCapabilityErrorCode, message: string);
|
|
83
|
+
}
|
|
84
|
+
declare function canTransitionLearnedCapability(from: LearnedCapabilityLifecycle, to: LearnedCapabilityLifecycle): boolean;
|
|
85
|
+
declare function assertLearnedCapabilityTransition(from: LearnedCapabilityLifecycle, to: LearnedCapabilityLifecycle): void;
|
|
86
|
+
declare function slugifyLearnedCapabilityName(displayName: string): string;
|
|
87
|
+
declare function learningEventKindForLifecycle(lifecycle: LearnedCapabilityLifecycle): LearningEventKind;
|
|
88
|
+
declare function learningEventIdFor(record: LearnedCapabilityRecord): string;
|
|
89
|
+
|
|
90
|
+
export { LearningCapabilityError as f, assertLearnedCapabilityTransition as q, canTransitionLearnedCapability as r, learningEventIdFor as s, learningEventKindForLifecycle as t, slugifyLearnedCapabilityName as u };
|
|
91
|
+
export type { LearnedCapabilityCarrier as L, LearnedCapabilityLifecycle as a, LearnedCapabilityRecord as b, LearnedCapabilitySource as c, LearningAction as d, LearningActionDriver as e, LearningCapabilityErrorCode as g, LearningClientEventState as h, LearningClientRecord as i, LearningEvent as j, LearningEventKind as k, LearningNotificationState as l, LearningPage as m, LearningQuery as n, LearningSubscribeOptions as o, LearningSurfaceSnapshot as p };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as RuntimeSurfaceStatus, b as CommandDefinition, e as CommandSource, c as CommandInfo, C as Command$1, I as InteractiveContext, a as CommandCallbacks, g as CurrentConfig, d as CommandInvocationRequest, f as CommandWorkflowInvocationRequest } from './utils.d-
|
|
4
|
-
import {
|
|
1
|
+
import { X as SessionStorage$1, R as PermissionMode, L as LearningBinding } from './public-api.d--IDNJsu1.js';
|
|
2
|
+
import { $ as KodaXOptions, a9 as KodaXResult } from './bash-prefix-extractor.d-CHJO5y94.js';
|
|
3
|
+
import { n as RuntimeSurfaceStatus, b as CommandDefinition, e as CommandSource, c as CommandInfo, C as Command$1, I as InteractiveContext, a as CommandCallbacks, g as CurrentConfig, d as CommandInvocationRequest, f as CommandWorkflowInvocationRequest } from './utils.d-gmn3c5U4.js';
|
|
4
|
+
import { bU as KodaXSessionStorage, bG as KodaXSessionData } from './types.d-DH1mvdcl.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* InkREPL - Ink-based REPL Adapter
|
|
@@ -28,6 +28,7 @@ interface InkREPLOptions extends KodaXOptions {
|
|
|
28
28
|
hardExitOnClose?: boolean;
|
|
29
29
|
runtimeRunner?: InkRuntimeRunner;
|
|
30
30
|
getRuntimeStatus?: InkRuntimeStatusProvider;
|
|
31
|
+
learning?: LearningBinding;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Run Ink-based interactive mode
|
|
@@ -55,6 +56,7 @@ interface RepLOptions extends KodaXOptions {
|
|
|
55
56
|
storage?: SessionStorage;
|
|
56
57
|
runtimeRunner?: ReplRuntimeRunner;
|
|
57
58
|
getRuntimeStatus?: ReplRuntimeStatusProvider;
|
|
59
|
+
learning?: LearningBinding;
|
|
58
60
|
}
|
|
59
61
|
declare function runInteractiveMode(options: RepLOptions): Promise<void>;
|
|
60
62
|
declare function processSpecialSyntax(input: string): Promise<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ba as Guardrail, d5 as RunnerToolCall, f as Agent, a8 as AgentMessage, d8 as RunnerToolResult, dj as Span } from './types.d-DH1mvdcl.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Guardrail Runtime — FEATURE_085 (v0.7.26).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { b as McpServersConfig, M as McpConnectMode, a as McpServerConfig, c as McpTransportKind } from './config.d-CJy1WENT.js';
|
|
2
2
|
import { K as KodaXBaseProvider } from './base.d-Cz_rwpOi.js';
|
|
3
3
|
import { a as CostTracker } from './cost-tracker.d-BeaenODW.js';
|
|
4
|
-
import {
|
|
5
|
-
import { d as ToolGuardrail } from './guardrail.d-
|
|
4
|
+
import { d5 as RunnerToolCall } from './types.d-DH1mvdcl.js';
|
|
5
|
+
import { d as ToolGuardrail } from './guardrail.d-DlpMnd-Y.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* FEATURE_200 Phase F (v0.7.45) — MCP domain types extracted from types.ts.
|
|
@@ -138,7 +138,7 @@ declare function loadAutoRules(opts: LoadAutoRulesOptions): Promise<RulesLoadRes
|
|
|
138
138
|
*
|
|
139
139
|
* Two invariants the producers must hold:
|
|
140
140
|
*
|
|
141
|
-
* 1. **Pure**: same `call` +
|
|
141
|
+
* 1. **Pure**: same `call` + path context ⇒ same signals. No I/O, no
|
|
142
142
|
* timestamps, no env reads inside collectors. Collectors run on every
|
|
143
143
|
* non-Tier-1 tool call, so they must be cheap and deterministic.
|
|
144
144
|
*
|
|
@@ -222,10 +222,11 @@ interface SignalCollector {
|
|
|
222
222
|
* Inspect the call and produce zero or more signals.
|
|
223
223
|
*
|
|
224
224
|
* Must be pure: no I/O, no timing, no global state reads. The
|
|
225
|
-
* `projectRoot`
|
|
226
|
-
*
|
|
225
|
+
* `projectRoot` is the authorization boundary. `executionCwd` is the
|
|
226
|
+
* directory relative paths resolve from and defaults to `projectRoot` for
|
|
227
|
+
* backward compatibility.
|
|
227
228
|
*/
|
|
228
|
-
collect(call: RunnerToolCall, projectRoot: string): readonly ToolCallSignal[];
|
|
229
|
+
collect(call: RunnerToolCall, projectRoot: string, executionCwd?: string): readonly ToolCallSignal[];
|
|
229
230
|
}
|
|
230
231
|
/**
|
|
231
232
|
* Run every applicable collector on `call` and return the merged signal
|
|
@@ -238,7 +239,7 @@ interface SignalCollector {
|
|
|
238
239
|
* from an argv token in the same command). The classifier prompt
|
|
239
240
|
* tolerates duplicates; dedup would risk dropping load-bearing context.
|
|
240
241
|
*/
|
|
241
|
-
declare function collectAllSignals(call: RunnerToolCall, projectRoot: string, collectors: readonly SignalCollector[]): readonly ToolCallSignal[];
|
|
242
|
+
declare function collectAllSignals(call: RunnerToolCall, projectRoot: string, collectors: readonly SignalCollector[], executionCwd?: string): readonly ToolCallSignal[];
|
|
242
243
|
|
|
243
244
|
/**
|
|
244
245
|
* Denial Tracker — FEATURE_092 Phase 2b.4 (v0.7.33).
|
|
@@ -286,6 +287,74 @@ declare function createCircuitBreaker(): CircuitBreaker;
|
|
|
286
287
|
declare function recordError(b: CircuitBreaker, now: number): CircuitBreaker;
|
|
287
288
|
declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
|
|
288
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Tier 0 — Absolute Denylist — FEATURE_158 Step 4 (v0.7.39).
|
|
292
|
+
*
|
|
293
|
+
* The narrowest possible set of catastrophic patterns that must NEVER reach
|
|
294
|
+
* the LLM classifier (which is fallible / can be prompt-injected). Per
|
|
295
|
+
* ADR-025: every entry here must satisfy BOTH gates:
|
|
296
|
+
*
|
|
297
|
+
* (a) "is there any legitimate context in which this should be allowed?"
|
|
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.
|
|
305
|
+
*
|
|
306
|
+
* Patterns:
|
|
307
|
+
*
|
|
308
|
+
* 1. rm_rf_root — `rm -rf /`, `rm -rf ~`, `rm -rf $HOME` (and quoted
|
|
309
|
+
* / -fr variants). Excludes `rm -rf /tmp/foo` (which
|
|
310
|
+
* is a `dangerous_pattern` signal but reaches LLM).
|
|
311
|
+
* 2. mkfs_or_format — `mkfs.* /dev/sd*`, `fdisk /dev/sd*`, `format C:`.
|
|
312
|
+
* Block formatting any disk device.
|
|
313
|
+
* 3. dd_disk_write — `dd of=/dev/sd*` (raw-disk write). Excludes
|
|
314
|
+
* `dd of=test.bin` (file write — reaches LLM as
|
|
315
|
+
* dangerous_pattern signal).
|
|
316
|
+
* 4. fork_bomb — `:(){ :|:& };:` — denial of service.
|
|
317
|
+
* 5. user_kodax_write — write/edit to any path under `~/.kodax/`
|
|
318
|
+
* (credentials zone — internal kodax config writes
|
|
319
|
+
* use the TypeScript API, not bash/tools, so the
|
|
320
|
+
* only path here is LLM-emitted shell which is
|
|
321
|
+
* always wrong).
|
|
322
|
+
*
|
|
323
|
+
* Layer note: bash-level `~/.kodax/` writes (e.g. `echo x > ~/.kodax/y`)
|
|
324
|
+
* require AST path-extraction which lives in `@kodax/repl`. The REPL-side
|
|
325
|
+
* collector wired through `extraCollectors` (Step 7) escalates those to
|
|
326
|
+
* Tier 0 by emitting a synthetic `user_kodax_write` denial via the same
|
|
327
|
+
* `AbsoluteDenyResult` shape. This module handles the file-tool path
|
|
328
|
+
* directly (the most common attack vector) and the four command-string
|
|
329
|
+
* patterns that don't need path extraction.
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
type TierZeroPatternId = 'rm_rf_root' | 'mkfs_or_format' | 'dd_disk_write' | 'fork_bomb' | 'user_kodax_write';
|
|
333
|
+
interface AbsoluteDenyMatch {
|
|
334
|
+
readonly denied: true;
|
|
335
|
+
readonly patternId: TierZeroPatternId;
|
|
336
|
+
readonly reason: string;
|
|
337
|
+
}
|
|
338
|
+
interface AbsoluteDenyMiss {
|
|
339
|
+
readonly denied: false;
|
|
340
|
+
}
|
|
341
|
+
type AbsoluteDenyResult = AbsoluteDenyMatch | AbsoluteDenyMiss;
|
|
342
|
+
type AbsoluteDenyCheck = (call: RunnerToolCall, projectRoot: string, executionCwd: string) => AbsoluteDenyResult;
|
|
343
|
+
/**
|
|
344
|
+
* Check a tool call against the Tier 0 absolute denylist. Returns the
|
|
345
|
+
* first matching pattern, or `{ denied: false }` if no pattern fires.
|
|
346
|
+
*
|
|
347
|
+
* Order is deterministic — patterns checked in the order defined above.
|
|
348
|
+
* Multiple matches would be possible (e.g. `rm -rf / ; :(){...};:`) but
|
|
349
|
+
* we return the first hit since the guardrail acts on `denied: true`
|
|
350
|
+
* regardless and the reason string is one-shot.
|
|
351
|
+
*
|
|
352
|
+
* **Pure**: deterministic given (call, projectRoot, stable env).
|
|
353
|
+
* **Fast**: ~5 regex tests + 1-2 string ops; safe to run on every
|
|
354
|
+
* non-Tier-1 call without measurable overhead.
|
|
355
|
+
*/
|
|
356
|
+
declare function checkAbsoluteDeny(call: RunnerToolCall, projectRoot: string, executionCwd?: string): AbsoluteDenyResult;
|
|
357
|
+
|
|
289
358
|
/**
|
|
290
359
|
* AutoModeToolGuardrail — FEATURE_092 Phase 2b.6 (v0.7.33).
|
|
291
360
|
*
|
|
@@ -443,7 +512,7 @@ interface AutoModeGuardrailConfig {
|
|
|
443
512
|
readonly initialEngine?: AutoModeEngine;
|
|
444
513
|
/**
|
|
445
514
|
* FEATURE_092 phase 2b.7b slice C: classifier sideQuery timeout in ms.
|
|
446
|
-
* Defaults to
|
|
515
|
+
* Defaults to 20_000. Resolved by the REPL from `~/.kodax/config.json`
|
|
447
516
|
* `autoMode.timeoutMs`.
|
|
448
517
|
*/
|
|
449
518
|
readonly timeoutMs?: number;
|
|
@@ -460,6 +529,8 @@ interface AutoModeGuardrailConfig {
|
|
|
460
529
|
* and supply no `extraCollectors`.
|
|
461
530
|
*/
|
|
462
531
|
readonly projectRoot?: string;
|
|
532
|
+
/** Directory used to resolve relative tool paths. Defaults to projectRoot. */
|
|
533
|
+
readonly executionCwd?: string;
|
|
463
534
|
/**
|
|
464
535
|
* Override the default signal-collector set. When unset, defaults to
|
|
465
536
|
* `[bashSignalCollector, fileSignalCollector]` — coding-side
|
|
@@ -482,6 +553,8 @@ interface AutoModeGuardrailConfig {
|
|
|
482
553
|
* signal order).
|
|
483
554
|
*/
|
|
484
555
|
readonly extraCollectors?: readonly SignalCollector[];
|
|
556
|
+
/** Layer-owned Tier-0 checks that run after the coding-side frozen list. */
|
|
557
|
+
readonly extraAbsoluteDenyChecks?: readonly AbsoluteDenyCheck[];
|
|
485
558
|
/**
|
|
486
559
|
* Speculative-classify quiet window (ms). When a classifier promise
|
|
487
560
|
* settles within this window, the guardrail uses the verdict directly
|
|
@@ -536,5 +609,5 @@ interface AutoModeToolGuardrail extends ToolGuardrail {
|
|
|
536
609
|
}
|
|
537
610
|
declare function createAutoModeToolGuardrail(config: AutoModeGuardrailConfig): AutoModeToolGuardrail;
|
|
538
611
|
|
|
539
|
-
export {
|
|
540
|
-
export type {
|
|
612
|
+
export { createCircuitBreaker as B, CONSECUTIVE_THRESHOLD as C, ERROR_THRESHOLD as E, createDenialTracker as F, formatAgentsForPrompt as G, getKodaxGlobalDir as H, loadAgentsFiles as I, loadAutoRules as J, parseAutoRules as M, readTrustState as N, recordAllow as O, recordBlock as P, recordError as Q, shouldFallback$1 as U, shouldFallback as V, WINDOW_MS as W, trustProjectRules as X, CUMULATIVE_THRESHOLD as m, checkAbsoluteDeny as w, collectAllSignals as x, computeRulesFingerprint as y, createAutoModeToolGuardrail as z };
|
|
613
|
+
export type { AbsoluteDenyCheck as A, DenialTracker as D, KodaXMcpConnectMode as K, LoadAgentsOptions as L, RulesLoadError as R, SignalCollector as S, TierZeroPatternId as T, AbsoluteDenyMatch as a, AbsoluteDenyMiss as b, AbsoluteDenyResult as c, AgentsFile as d, AutoModeAskUser as e, AutoModeAskUserVerdict as f, AutoModeEngine as g, AutoModeGuardrailConfig as h, AutoModeSharedState as i, AutoModeStats as j, AutoModeToolGuardrail as k, AutoRules as l, CircuitBreaker as n, KodaXMcpServerConfig as o, KodaXMcpServersConfig as p, KodaXMcpTransport as q, LoadedRulesSource as r, RulesLoadResult as s, SkippedRulesSource as t, ToolCallSignal as u, TrustState as v };
|