@wrongstack/core 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-bridge-DmBiCipY.d.ts +33 -0
- package/dist/compactor-DSl2FK7a.d.ts +17 -0
- package/dist/config-DXrqb41m.d.ts +193 -0
- package/dist/{provider-txgB0Oq9.d.ts → context-u0bryklF.d.ts} +540 -472
- package/dist/coordination/index.d.ts +892 -0
- package/dist/coordination/index.js +2869 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/defaults/index.d.ts +34 -2309
- package/dist/defaults/index.js +5610 -4608
- package/dist/defaults/index.js.map +1 -1
- package/dist/events-B6Q03pTu.d.ts +290 -0
- package/dist/execution/index.d.ts +260 -0
- package/dist/execution/index.js +1625 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/index.d.ts +81 -11
- package/dist/index.js +7727 -6174
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +10 -0
- package/dist/infrastructure/index.js +575 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/input-reader-E-ffP2ee.d.ts +12 -0
- package/dist/kernel/index.d.ts +15 -4
- package/dist/kernel/index.js.map +1 -1
- package/dist/logger-BH6AE0W9.d.ts +24 -0
- package/dist/logger-BMQgxvdy.d.ts +12 -0
- package/dist/mcp-servers-BA1Ofmfj.d.ts +100 -0
- package/dist/memory-CEXuo7sz.d.ts +16 -0
- package/dist/mode-CV077NjV.d.ts +27 -0
- package/dist/models/index.d.ts +60 -0
- package/dist/models/index.js +621 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models-registry-DqzwpBQy.d.ts +46 -0
- package/dist/models-registry-Y2xbog0E.d.ts +95 -0
- package/dist/multi-agent-BDfkxL5C.d.ts +351 -0
- package/dist/observability/index.d.ts +353 -0
- package/dist/observability/index.js +691 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability-BhnVLBLS.d.ts +67 -0
- package/dist/path-resolver-CPRj4bFY.d.ts +10 -0
- package/dist/path-resolver-Crkt8wTQ.d.ts +54 -0
- package/dist/plugin-CoYYZKdn.d.ts +447 -0
- package/dist/renderer-0A2ZEtca.d.ts +158 -0
- package/dist/sdd/index.d.ts +206 -0
- package/dist/sdd/index.js +864 -0
- package/dist/sdd/index.js.map +1 -0
- package/dist/secret-scrubber-3TLUkiCV.d.ts +31 -0
- package/dist/secret-scrubber-CwYliRWd.d.ts +54 -0
- package/dist/secret-vault-DoISxaKO.d.ts +19 -0
- package/dist/security/index.d.ts +46 -0
- package/dist/security/index.js +536 -0
- package/dist/security/index.js.map +1 -0
- package/dist/selector-BRqzvugb.d.ts +51 -0
- package/dist/session-reader-C3x96CDR.d.ts +150 -0
- package/dist/skill-Bx8jxznf.d.ts +72 -0
- package/dist/storage/index.d.ts +540 -0
- package/dist/storage/index.js +1802 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/{system-prompt-vAB0F54-.d.ts → system-prompt-CG9jU5-5.d.ts} +9 -1
- package/dist/task-graph-BITvWt4t.d.ts +160 -0
- package/dist/tool-executor-CYdZdtno.d.ts +97 -0
- package/dist/types/index.d.ts +26 -4
- package/dist/types/index.js +1787 -4
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +49 -2
- package/dist/utils/index.js +100 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +34 -2
- package/dist/mode-Pjt5vMS6.d.ts +0 -815
- package/dist/session-reader-9sOTgmeC.d.ts +0 -1087
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { M as Message } from './context-u0bryklF.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Result of LLM-driven message importance analysis.
|
|
5
|
+
* The selector marks each message range with an importance tier,
|
|
6
|
+
* and optionally provides a natural-language summary for collapsed ranges.
|
|
7
|
+
*/
|
|
8
|
+
interface SelectorResult {
|
|
9
|
+
/**
|
|
10
|
+
* Ordered list of kept message ranges. Each entry describes a
|
|
11
|
+
* message range that should be preserved verbatim in the context.
|
|
12
|
+
*/
|
|
13
|
+
kept: Array<{
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
importance: 'critical' | 'high' | 'medium';
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Collapsed ranges — either replaced by the compactor or omitted.
|
|
20
|
+
* Each entry may carry a summary text produced by the LLM.
|
|
21
|
+
*/
|
|
22
|
+
collapsed: Array<{
|
|
23
|
+
from: number;
|
|
24
|
+
to: number;
|
|
25
|
+
summary?: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Raw reasoning from the selector LLM (for debugging / audit).
|
|
29
|
+
*/
|
|
30
|
+
reasoning: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Message selector that uses an LLM to decide which message ranges
|
|
34
|
+
* to keep vs collapse/summarize. The selector runs as a separate API
|
|
35
|
+
* call before compaction, making it more surgical than fixed-window
|
|
36
|
+
* or rules-based approaches.
|
|
37
|
+
*/
|
|
38
|
+
interface MessageSelector {
|
|
39
|
+
/**
|
|
40
|
+
* Analyze `messages` and return a structured plan for what to keep
|
|
41
|
+
* vs collapse. May modify the messages array in-place if needed,
|
|
42
|
+
* or return a plan that the caller (Compactor) executes.
|
|
43
|
+
*
|
|
44
|
+
* @param messages Current message history (may be modified in-place)
|
|
45
|
+
* @param maxToKeep Token budget — selector should aim to keep total
|
|
46
|
+
* retained message content under this threshold
|
|
47
|
+
*/
|
|
48
|
+
select(messages: Message[], maxToKeep: number): Promise<SelectorResult>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type { MessageSelector as M, SelectorResult as S };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { b as ContentBlock, m as SessionEvent, n as SessionMetadata, o as SessionStore } from './context-u0bryklF.js';
|
|
2
|
+
|
|
3
|
+
type AttachmentKind = 'text' | 'image' | 'file';
|
|
4
|
+
interface AttachmentMeta {
|
|
5
|
+
/** Display label for the placeholder e.g. "123 lines" or "PNG 412 KB". */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Original filename if known. */
|
|
8
|
+
filename?: string;
|
|
9
|
+
/** MIME type if known. Required for images. */
|
|
10
|
+
mediaType?: string;
|
|
11
|
+
}
|
|
12
|
+
interface Attachment {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly kind: AttachmentKind;
|
|
15
|
+
readonly meta: AttachmentMeta;
|
|
16
|
+
/** In-memory payload. For images this is base64; for text/file it's the raw text. */
|
|
17
|
+
readonly data?: string;
|
|
18
|
+
/** Disk location if spooled. Mutually exclusive with `data` for large payloads. */
|
|
19
|
+
readonly path?: string;
|
|
20
|
+
readonly bytes: number;
|
|
21
|
+
readonly createdAt: string;
|
|
22
|
+
}
|
|
23
|
+
interface AttachmentRef {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly kind: AttachmentKind;
|
|
26
|
+
/** Index for display, e.g. `#1`. Stable for the lifetime of a session. */
|
|
27
|
+
readonly seq: number;
|
|
28
|
+
readonly meta: AttachmentMeta;
|
|
29
|
+
}
|
|
30
|
+
interface AddAttachmentInput {
|
|
31
|
+
kind: AttachmentKind;
|
|
32
|
+
data: string;
|
|
33
|
+
meta?: AttachmentMeta;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Session-scoped store for content that is too big to inline in display
|
|
37
|
+
* but must be sent to the model as a real ContentBlock. The input layer
|
|
38
|
+
* (CLI/TUI) puts pasted text, dropped files, and pasted images here, gets
|
|
39
|
+
* back a stable AttachmentRef, and shows a placeholder like `[pasted #1]`
|
|
40
|
+
* to the user. At submit time, `expand()` swaps placeholders for the real
|
|
41
|
+
* payload as ContentBlock[].
|
|
42
|
+
*/
|
|
43
|
+
interface AttachmentStore {
|
|
44
|
+
add(input: AddAttachmentInput): Promise<AttachmentRef>;
|
|
45
|
+
get(id: string): Promise<Attachment | undefined>;
|
|
46
|
+
list(): AttachmentRef[];
|
|
47
|
+
/**
|
|
48
|
+
* Replace all known placeholder tokens in `text` (e.g. `[pasted #1]`,
|
|
49
|
+
* `[image #2]`) with the corresponding ContentBlock(s) and return the
|
|
50
|
+
* mixed array. Unknown placeholders are left as plain text.
|
|
51
|
+
*/
|
|
52
|
+
expand(text: string): Promise<ContentBlock[]>;
|
|
53
|
+
clear(): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* L2-A: SessionReader — query, replay, search, export over a `SessionStore`.
|
|
58
|
+
*
|
|
59
|
+
* Keeps a clean read-only interface (no `append`, no `delete`) so analytics
|
|
60
|
+
* code can be wired against a store without granting it the writer surface.
|
|
61
|
+
*/
|
|
62
|
+
type SessionEventType = SessionEvent['type'];
|
|
63
|
+
interface SessionQuery {
|
|
64
|
+
/** Filter by start timestamp (ISO). Sessions started before this are excluded. */
|
|
65
|
+
since?: string;
|
|
66
|
+
/** Filter by start timestamp (ISO). Sessions started after this are excluded. */
|
|
67
|
+
until?: string;
|
|
68
|
+
/** Substring match against title (case-insensitive). */
|
|
69
|
+
titleContains?: string;
|
|
70
|
+
/** Filter by provider id. */
|
|
71
|
+
provider?: string;
|
|
72
|
+
/** Filter by model id. */
|
|
73
|
+
model?: string;
|
|
74
|
+
/** Minimum total tokens (input+output) to keep. */
|
|
75
|
+
minTokens?: number;
|
|
76
|
+
/** Limit result count. Defaults to no limit. */
|
|
77
|
+
limit?: number;
|
|
78
|
+
}
|
|
79
|
+
interface SessionSearchHit {
|
|
80
|
+
sessionId: string;
|
|
81
|
+
eventIndex: number;
|
|
82
|
+
ts: string;
|
|
83
|
+
type: SessionEventType;
|
|
84
|
+
/** Short snippet of the matched text — null for events without text content. */
|
|
85
|
+
snippet: string | null;
|
|
86
|
+
}
|
|
87
|
+
interface SessionSearchQuery {
|
|
88
|
+
/** Plain text or regex pattern. */
|
|
89
|
+
query: string;
|
|
90
|
+
/** Treat `query` as a regex. Defaults to false (literal substring). */
|
|
91
|
+
regex?: boolean;
|
|
92
|
+
/** Case-insensitive match. Defaults to true. */
|
|
93
|
+
caseInsensitive?: boolean;
|
|
94
|
+
/** Limit only to these event types. Defaults to all event types. */
|
|
95
|
+
types?: SessionEventType[];
|
|
96
|
+
/** Limit hit count. Defaults to 100. */
|
|
97
|
+
limit?: number;
|
|
98
|
+
}
|
|
99
|
+
interface SessionExportOptions {
|
|
100
|
+
/** "markdown" produces a human-readable chat log; "json" passes through raw events. */
|
|
101
|
+
format: 'markdown' | 'json' | 'text';
|
|
102
|
+
/** Include tool_use/tool_result blocks. Defaults to true. */
|
|
103
|
+
includeTools?: boolean;
|
|
104
|
+
/** Include system/diagnostic events (errors, compaction). Defaults to true. */
|
|
105
|
+
includeDiagnostics?: boolean;
|
|
106
|
+
}
|
|
107
|
+
interface SessionSummaryLite {
|
|
108
|
+
id: string;
|
|
109
|
+
title: string;
|
|
110
|
+
startedAt: string;
|
|
111
|
+
endedAt?: string;
|
|
112
|
+
provider: string;
|
|
113
|
+
model: string;
|
|
114
|
+
tokenTotal: number;
|
|
115
|
+
}
|
|
116
|
+
interface SessionReader {
|
|
117
|
+
/** List sessions matching the query. Uses the underlying store's summary cache. */
|
|
118
|
+
query(q?: SessionQuery): Promise<SessionSummaryLite[]>;
|
|
119
|
+
/** Yield events for `sessionId` in chronological order. */
|
|
120
|
+
replay(sessionId: string): AsyncIterable<SessionEvent>;
|
|
121
|
+
/** Full-text/regex search across one or all sessions. */
|
|
122
|
+
search(q: SessionSearchQuery, sessionId?: string): Promise<SessionSearchHit[]>;
|
|
123
|
+
/** Render a session for human or downstream-tool consumption. */
|
|
124
|
+
export(sessionId: string, opts: SessionExportOptions): Promise<string>;
|
|
125
|
+
/** Read the metadata header without loading the full event stream. */
|
|
126
|
+
metadata(sessionId: string): Promise<SessionMetadata>;
|
|
127
|
+
}
|
|
128
|
+
interface DefaultSessionReaderOptions {
|
|
129
|
+
store: SessionStore;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* L2-A: read-only view over a `SessionStore` with query, replay, search,
|
|
134
|
+
* and export helpers. Implemented on top of the public `SessionStore`
|
|
135
|
+
* surface so any concrete store can be inspected without re-implementation.
|
|
136
|
+
*
|
|
137
|
+
* The heavy operations re-parse the JSONL stream on every call — fine for
|
|
138
|
+
* /resume and one-off analytics. Wrap with a memoizing decorator if needed.
|
|
139
|
+
*/
|
|
140
|
+
declare class DefaultSessionReader implements SessionReader {
|
|
141
|
+
private readonly store;
|
|
142
|
+
constructor(opts: DefaultSessionReaderOptions);
|
|
143
|
+
query(q?: SessionQuery): Promise<SessionSummaryLite[]>;
|
|
144
|
+
replay(sessionId: string): AsyncIterable<SessionEvent>;
|
|
145
|
+
search(q: SessionSearchQuery, sessionId?: string): Promise<SessionSearchHit[]>;
|
|
146
|
+
export(sessionId: string, opts: SessionExportOptions): Promise<string>;
|
|
147
|
+
metadata(sessionId: string): Promise<SessionMetadata>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export { type AddAttachmentInput as A, DefaultSessionReader as D, type Attachment as a, type AttachmentKind as b, type AttachmentMeta as c, type AttachmentRef as d, type AttachmentStore as e };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { j as Response, a0 as Context, h as ProviderError } from './context-u0bryklF.js';
|
|
2
|
+
|
|
3
|
+
type RecoveryDecision = {
|
|
4
|
+
/**
|
|
5
|
+
* Recovery mutated state or waited for capacity and the agent should
|
|
6
|
+
* rebuild the provider request and try the turn again.
|
|
7
|
+
*/
|
|
8
|
+
action: 'retry';
|
|
9
|
+
reason: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
} | {
|
|
12
|
+
/**
|
|
13
|
+
* Recovery produced a substitute provider response that should be
|
|
14
|
+
* processed exactly like a normal model response.
|
|
15
|
+
*/
|
|
16
|
+
action: 'continue';
|
|
17
|
+
response: Response;
|
|
18
|
+
reason?: string;
|
|
19
|
+
} | {
|
|
20
|
+
/** Recovery inspected the error and decided the agent must fail. */
|
|
21
|
+
action: 'fail';
|
|
22
|
+
reason: string;
|
|
23
|
+
error?: unknown;
|
|
24
|
+
};
|
|
25
|
+
interface ErrorHandler {
|
|
26
|
+
/**
|
|
27
|
+
* Attempt to recover from an unretried provider/tool boundary error.
|
|
28
|
+
*
|
|
29
|
+
* `null` means "no strategy matched". Non-null decisions are explicit:
|
|
30
|
+
* retry the current turn, continue with a substitute response, or fail
|
|
31
|
+
* deliberately. Callers should not infer control flow from truthiness.
|
|
32
|
+
*/
|
|
33
|
+
recover(err: unknown, ctx: Context): Promise<RecoveryDecision | null>;
|
|
34
|
+
classify(err: unknown): {
|
|
35
|
+
kind: 'rate_limit' | 'overloaded' | 'server' | 'client' | 'network' | 'abort' | 'context_overflow' | 'unknown';
|
|
36
|
+
retryable: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface RetryPolicy {
|
|
41
|
+
shouldRetry(err: ProviderError | Error, attempt: number): boolean;
|
|
42
|
+
delayMs(attempt: number): number;
|
|
43
|
+
maxAttempts(err: ProviderError | Error): number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface SkillManifest {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
version?: string;
|
|
50
|
+
path: string;
|
|
51
|
+
source: 'project' | 'user' | 'bundled';
|
|
52
|
+
}
|
|
53
|
+
/** Parsed skill entry for structured rendering in system prompt. */
|
|
54
|
+
interface SkillEntry {
|
|
55
|
+
name: string;
|
|
56
|
+
/** "Use when..." trigger condition — one-liner */
|
|
57
|
+
trigger: string;
|
|
58
|
+
/** Comma-separated scope items */
|
|
59
|
+
scope: string[];
|
|
60
|
+
source: SkillManifest['source'];
|
|
61
|
+
path: string;
|
|
62
|
+
}
|
|
63
|
+
interface SkillLoader {
|
|
64
|
+
list(): Promise<SkillManifest[]>;
|
|
65
|
+
/** Structured entries with trigger/scope for system prompt rendering. */
|
|
66
|
+
listEntries(): Promise<SkillEntry[]>;
|
|
67
|
+
find(name: string): Promise<SkillManifest | undefined>;
|
|
68
|
+
manifestText(): Promise<string>;
|
|
69
|
+
readBody(name: string): Promise<string>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type { ErrorHandler as E, RecoveryDecision as R, SkillEntry as S, SkillLoader as a, SkillManifest as b, RetryPolicy as c };
|