@wrongstack/core 0.5.0 → 0.5.3
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-BkjOkSkD.d.ts → agent-bridge-EiUFe3if.d.ts} +1 -1
- package/dist/{compactor-CTHjZAwf.d.ts → compactor-BP4xhKVi.d.ts} +1 -1
- package/dist/{config-DO2eCKgq.d.ts → config-BOD_HQBw.d.ts} +1 -1
- package/dist/{context-P207fTpo.d.ts → context-PH4DvBZV.d.ts} +49 -1
- package/dist/coordination/index.d.ts +9 -9
- package/dist/coordination/index.js +93 -2
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +18 -18
- package/dist/defaults/index.js +93 -2
- package/dist/defaults/index.js.map +1 -1
- package/dist/director-state-CVzkjKRZ.d.ts +539 -0
- package/dist/{events-DYAbU84e.d.ts → events-oxn-Wkub.d.ts} +18 -1
- package/dist/execution/index.d.ts +11 -11
- package/dist/extension/index.d.ts +6 -6
- package/dist/{index-BHL8QDCL.d.ts → index-CcbWbcpy.d.ts} +5 -5
- package/dist/{index-BNzUUDVR.d.ts → index-a12jc7-r.d.ts} +5 -5
- package/dist/index.d.ts +27 -25
- package/dist/index.js +266 -23
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-CLkhKdnF.d.ts → mcp-servers-uPmBxZ1B.d.ts} +3 -3
- package/dist/models/index.d.ts +2 -2
- package/dist/{multi-agent-B1Nn9eC0.d.ts → multi-agent-D6S4Z7H8.d.ts} +2 -2
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-mPccVA0l.d.ts → path-resolver-CprD5DhS.d.ts} +2 -2
- package/dist/{provider-runner-D7lHu07L.d.ts → provider-runner-DGisz_lG.d.ts} +3 -3
- package/dist/{retry-policy-CnYVKGPv.d.ts → retry-policy-DUJ8-Qc_.d.ts} +1 -1
- package/dist/sdd/index.d.ts +3 -3
- package/dist/{secret-scrubber-Buo9zLGs.d.ts → secret-scrubber-CB11A2P7.d.ts} +1 -1
- package/dist/{secret-scrubber-BSgec8CU.d.ts → secret-scrubber-EqFa0SyI.d.ts} +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/{selector-B-CGOshv.d.ts → selector-yqyxt-Ii.d.ts} +1 -1
- package/dist/{session-reader-DmOEmSkq.d.ts → session-reader-1tOyoY1s.d.ts} +1 -1
- package/dist/session-rewinder-C9HnMkhP.d.ts +23 -0
- package/dist/storage/index.d.ts +21 -534
- package/dist/storage/index.js +246 -3
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-CzY1zrbC.d.ts → system-prompt-BJlzKGO6.d.ts} +1 -1
- package/dist/{tool-executor-CYe5cp5U.d.ts → tool-executor-B6kRcWeF.d.ts} +4 -4
- package/dist/types/index.d.ts +16 -15
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BridgeTransport, l as BridgeMessage, A as AgentBridge, m as AgentBridgeConfig } from './multi-agent-
|
|
1
|
+
import { B as BridgeTransport, l as BridgeMessage, A as AgentBridge, m as AgentBridgeConfig } from './multi-agent-D6S4Z7H8.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { W as WireFamily } from './models-registry-Y2xbog0E.js';
|
|
2
|
-
import { P as Permission } from './context-
|
|
2
|
+
import { P as Permission } from './context-PH4DvBZV.js';
|
|
3
3
|
|
|
4
4
|
type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
|
|
5
5
|
type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
|
|
@@ -627,6 +627,27 @@ type SessionEvent = {
|
|
|
627
627
|
ts: string;
|
|
628
628
|
before: number;
|
|
629
629
|
after: number;
|
|
630
|
+
} | {
|
|
631
|
+
type: 'checkpoint';
|
|
632
|
+
ts: string;
|
|
633
|
+
promptIndex: number;
|
|
634
|
+
promptPreview: string;
|
|
635
|
+
} | {
|
|
636
|
+
type: 'file_snapshot';
|
|
637
|
+
ts: string;
|
|
638
|
+
promptIndex: number;
|
|
639
|
+
files: FileSnapshot[];
|
|
640
|
+
} | {
|
|
641
|
+
type: 'rewound';
|
|
642
|
+
ts: string;
|
|
643
|
+
toPromptIndex: number;
|
|
644
|
+
revertedFiles: string[];
|
|
645
|
+
};
|
|
646
|
+
type FileSnapshot = {
|
|
647
|
+
path: string;
|
|
648
|
+
action: 'created' | 'modified' | 'deleted';
|
|
649
|
+
before: string | null;
|
|
650
|
+
after: string | null;
|
|
630
651
|
};
|
|
631
652
|
interface SessionSummary {
|
|
632
653
|
id: string;
|
|
@@ -671,6 +692,33 @@ interface SessionWriter {
|
|
|
671
692
|
readonly transcriptPath?: string;
|
|
672
693
|
append(event: SessionEvent): Promise<void>;
|
|
673
694
|
close(): Promise<void>;
|
|
695
|
+
/**
|
|
696
|
+
* Register a file change for later snapshotting.
|
|
697
|
+
* Called by write/edit/delete tools to track pending changes.
|
|
698
|
+
*/
|
|
699
|
+
recordFileChange(input: {
|
|
700
|
+
path: string;
|
|
701
|
+
action: 'created' | 'modified' | 'deleted';
|
|
702
|
+
before: string | null;
|
|
703
|
+
after: string | null;
|
|
704
|
+
}): void;
|
|
705
|
+
/**
|
|
706
|
+
* Write a checkpoint marker after a user input is processed.
|
|
707
|
+
* Also flushes any pending file snapshots.
|
|
708
|
+
*/
|
|
709
|
+
writeCheckpoint(promptIndex: number, promptPreview: string): Promise<void>;
|
|
710
|
+
/**
|
|
711
|
+
* Write a file snapshot after file changes are detected.
|
|
712
|
+
* Called by the file watcher or tool interceptor.
|
|
713
|
+
*/
|
|
714
|
+
writeFileSnapshot(promptIndex: number, files: FileSnapshot[]): Promise<void>;
|
|
715
|
+
/**
|
|
716
|
+
* Truncate conversation history to a given checkpoint promptIndex.
|
|
717
|
+
* Called after rewind — removes user_input/llm_response/tool_result events
|
|
718
|
+
* that come after the target checkpoint, then writes a rewound event.
|
|
719
|
+
* Returns the number of events removed.
|
|
720
|
+
*/
|
|
721
|
+
truncateToCheckpoint(promptIndex: number): Promise<number>;
|
|
674
722
|
}
|
|
675
723
|
|
|
676
724
|
interface CacheStats {
|
|
@@ -889,4 +937,4 @@ declare class Context implements RunEnv {
|
|
|
889
937
|
usage(): Usage;
|
|
890
938
|
}
|
|
891
939
|
|
|
892
|
-
export {
|
|
940
|
+
export { isWrongStackError as $, AgentError as A, type ToolStreamEvent as B, type Capabilities as C, type ToolUseBlock as D, type ErrorCode as E, type FileSnapshot as F, asBlocks as G, asText as H, type ImageBlock as I, type JSONSchema as J, isAgentError as K, isConfigError as L, type Message as M, isImageBlock as N, isPluginError as O, type Permission as P, isSessionError as Q, type Request as R, type SessionData as S, type TextBlock as T, type Usage as U, isTextBlock as V, WrongStackError as W, isThinkingBlock as X, isToolError as Y, isToolResultBlock as Z, isToolUseBlock as _, ConfigError as a, toWrongStackError as a0, Context as a1, type TokenCounter as a2, type CacheStats as a3, type ContextInit as a4, ConversationState as a5, type ReadonlyConversationState as a6, type RunEnv as a7, type RunOptions as a8, type StateChange as a9, type StateChangeHandler as aa, type TodoItem as ab, extractRunEnv as ac, wrapAsState as ad, type ContentBlock as b, type ErrorSeverity as c, type ErrorSubsystem as d, type MessageRole as e, PluginError as f, type Provider as g, ProviderError as h, type ProviderErrorBody as i, type Response as j, type ResumedSession as k, SessionError as l, type SessionEvent as m, type SessionMetadata as n, type SessionStore as o, type SessionSummary as p, type SessionWriter as q, type StopReason as r, type StreamEvent as s, type ThinkingBlock as t, type Tool as u, type ToolCallContext as v, ToolError as w, type ToolFinalEvent as x, type ToolProgressEvent as y, type ToolResultBlock as z };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as DirectorBudgetError, j as DirectorPromptParts, k as DirectorSessionFactory, l as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FleetBus, o as FleetEvent, p as FleetHandler, q as FleetUsage, r as FleetUsageAggregator, M as MultiAgentCoordinatorOptions, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, s as SubagentPromptParts, t as SubagentUsageSnapshot, v as composeDirectorPrompt, w as composeSubagentPrompt, x as createDelegateTool, y as makeAgentSubagentRunner, z as makeDirectorSessionFactory, E as rosterSummaryFromConfigs } from '../index-
|
|
2
|
-
export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, s as BudgetThresholdDecision, t as BudgetThresholdHandler, u as BudgetThresholdSignal, q as BudgetUsage, r as SubagentBudget } from '../multi-agent-
|
|
3
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
4
|
-
import '../context-
|
|
5
|
-
import '../events-
|
|
1
|
+
export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as DirectorBudgetError, j as DirectorPromptParts, k as DirectorSessionFactory, l as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FleetBus, o as FleetEvent, p as FleetHandler, q as FleetUsage, r as FleetUsageAggregator, M as MultiAgentCoordinatorOptions, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, s as SubagentPromptParts, t as SubagentUsageSnapshot, v as composeDirectorPrompt, w as composeSubagentPrompt, x as createDelegateTool, y as makeAgentSubagentRunner, z as makeDirectorSessionFactory, E as rosterSummaryFromConfigs } from '../index-CcbWbcpy.js';
|
|
2
|
+
export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, s as BudgetThresholdDecision, t as BudgetThresholdHandler, u as BudgetThresholdSignal, q as BudgetUsage, r as SubagentBudget } from '../multi-agent-D6S4Z7H8.js';
|
|
3
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-EiUFe3if.js';
|
|
4
|
+
import '../context-PH4DvBZV.js';
|
|
5
|
+
import '../events-oxn-Wkub.js';
|
|
6
6
|
import 'node:events';
|
|
7
|
-
import '../index-
|
|
7
|
+
import '../index-a12jc7-r.js';
|
|
8
8
|
import '../logger-BMQgxvdy.js';
|
|
9
|
-
import '../system-prompt-
|
|
9
|
+
import '../system-prompt-BJlzKGO6.js';
|
|
10
10
|
import '../observability-BhnVLBLS.js';
|
|
11
|
-
import '../secret-scrubber-
|
|
12
|
-
import '../config-
|
|
11
|
+
import '../secret-scrubber-CB11A2P7.js';
|
|
12
|
+
import '../config-BOD_HQBw.js';
|
|
13
13
|
import '../models-registry-Y2xbog0E.js';
|
|
@@ -2799,7 +2799,7 @@ var DefaultSessionStore = class {
|
|
|
2799
2799
|
);
|
|
2800
2800
|
}
|
|
2801
2801
|
try {
|
|
2802
|
-
return new FileSessionWriter(id, handle, startedAt, meta, { dir: this.dir, filePath: file });
|
|
2802
|
+
return new FileSessionWriter(id, handle, startedAt, meta, this.events, { dir: this.dir, filePath: file });
|
|
2803
2803
|
} catch (err) {
|
|
2804
2804
|
await handle.close().catch(() => {
|
|
2805
2805
|
});
|
|
@@ -2827,6 +2827,7 @@ var DefaultSessionStore = class {
|
|
|
2827
2827
|
model: data.metadata.model,
|
|
2828
2828
|
provider: data.metadata.provider
|
|
2829
2829
|
},
|
|
2830
|
+
this.events,
|
|
2830
2831
|
{ resumed: true, dir: this.dir, filePath: file }
|
|
2831
2832
|
);
|
|
2832
2833
|
return { writer, data };
|
|
@@ -2990,11 +2991,12 @@ var DefaultSessionStore = class {
|
|
|
2990
2991
|
}
|
|
2991
2992
|
};
|
|
2992
2993
|
var FileSessionWriter = class {
|
|
2993
|
-
constructor(id, handle, startedAt, meta, opts = {}) {
|
|
2994
|
+
constructor(id, handle, startedAt, meta, events, opts = {}) {
|
|
2994
2995
|
this.id = id;
|
|
2995
2996
|
this.handle = handle;
|
|
2996
2997
|
this.startedAt = startedAt;
|
|
2997
2998
|
this.meta = meta;
|
|
2999
|
+
this.events = events;
|
|
2998
3000
|
this.resumed = opts.resumed ?? false;
|
|
2999
3001
|
this.manifestFile = opts.dir ? path4.join(opts.dir, `${id}.summary.json`) : "";
|
|
3000
3002
|
this.filePath = opts.filePath ?? "";
|
|
@@ -3011,6 +3013,7 @@ var FileSessionWriter = class {
|
|
|
3011
3013
|
handle;
|
|
3012
3014
|
startedAt;
|
|
3013
3015
|
meta;
|
|
3016
|
+
events;
|
|
3014
3017
|
closed = false;
|
|
3015
3018
|
closing = false;
|
|
3016
3019
|
manifestFile;
|
|
@@ -3028,6 +3031,13 @@ var FileSessionWriter = class {
|
|
|
3028
3031
|
resumed;
|
|
3029
3032
|
appendFailCount = 0;
|
|
3030
3033
|
lastAppendWarnAt = 0;
|
|
3034
|
+
// Rewind support: track pending file changes and prompt index
|
|
3035
|
+
promptIndex = 0;
|
|
3036
|
+
pendingFileSnapshots = [];
|
|
3037
|
+
// Register a pending file change. Call recordFileChange() from tools.
|
|
3038
|
+
recordFileChange(input) {
|
|
3039
|
+
this.pendingFileSnapshots.push(input);
|
|
3040
|
+
}
|
|
3031
3041
|
async writeSessionStartLazy() {
|
|
3032
3042
|
const record = `${JSON.stringify({
|
|
3033
3043
|
type: this.resumed ? "session_resumed" : "session_start",
|
|
@@ -3103,6 +3113,87 @@ var FileSessionWriter = class {
|
|
|
3103
3113
|
} catch {
|
|
3104
3114
|
}
|
|
3105
3115
|
}
|
|
3116
|
+
async writeCheckpoint(promptIndex, promptPreview) {
|
|
3117
|
+
const fileCount = this.pendingFileSnapshots.length;
|
|
3118
|
+
if (fileCount > 0) {
|
|
3119
|
+
await this.writeFileSnapshot(promptIndex, [...this.pendingFileSnapshots]);
|
|
3120
|
+
this.pendingFileSnapshots = [];
|
|
3121
|
+
}
|
|
3122
|
+
this.promptIndex = promptIndex + 1;
|
|
3123
|
+
await this.append({
|
|
3124
|
+
type: "checkpoint",
|
|
3125
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3126
|
+
promptIndex,
|
|
3127
|
+
promptPreview
|
|
3128
|
+
});
|
|
3129
|
+
this.events?.emit("checkpoint.written", {
|
|
3130
|
+
promptIndex,
|
|
3131
|
+
promptPreview,
|
|
3132
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3133
|
+
fileCount
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
async writeFileSnapshot(promptIndex, files) {
|
|
3137
|
+
await this.append({
|
|
3138
|
+
type: "file_snapshot",
|
|
3139
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3140
|
+
promptIndex,
|
|
3141
|
+
files
|
|
3142
|
+
});
|
|
3143
|
+
}
|
|
3144
|
+
async truncateToCheckpoint(targetPromptIndex) {
|
|
3145
|
+
if (!this.filePath) return 0;
|
|
3146
|
+
const raw = await fsp4.readFile(this.filePath, "utf8");
|
|
3147
|
+
const lines = raw.split("\n");
|
|
3148
|
+
const kept = [];
|
|
3149
|
+
let removedCount = 0;
|
|
3150
|
+
let targetCheckpointLine = -1;
|
|
3151
|
+
let afterTarget = false;
|
|
3152
|
+
for (let i = 0; i < lines.length; i++) {
|
|
3153
|
+
const line = lines[i];
|
|
3154
|
+
if (!line.trim()) continue;
|
|
3155
|
+
let event;
|
|
3156
|
+
try {
|
|
3157
|
+
event = JSON.parse(line);
|
|
3158
|
+
} catch {
|
|
3159
|
+
kept.push(line);
|
|
3160
|
+
continue;
|
|
3161
|
+
}
|
|
3162
|
+
if (event.type === "checkpoint") {
|
|
3163
|
+
if (event.promptIndex === targetPromptIndex) {
|
|
3164
|
+
targetCheckpointLine = kept.length;
|
|
3165
|
+
afterTarget = true;
|
|
3166
|
+
} else if (event.promptIndex > targetPromptIndex) {
|
|
3167
|
+
afterTarget = true;
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
if (event.promptIndex !== void 0 && event.promptIndex > targetPromptIndex) {
|
|
3171
|
+
removedCount++;
|
|
3172
|
+
} else if (event.promptIndex === void 0) {
|
|
3173
|
+
if (!afterTarget || targetCheckpointLine === -1) {
|
|
3174
|
+
kept.push(line);
|
|
3175
|
+
} else {
|
|
3176
|
+
removedCount++;
|
|
3177
|
+
}
|
|
3178
|
+
} else {
|
|
3179
|
+
kept.push(line);
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
const truncated = kept.join("\n");
|
|
3183
|
+
await fsp4.writeFile(this.filePath, truncated + "\n", "utf8");
|
|
3184
|
+
await this.append({
|
|
3185
|
+
type: "rewound",
|
|
3186
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3187
|
+
toPromptIndex: targetPromptIndex,
|
|
3188
|
+
revertedFiles: []
|
|
3189
|
+
});
|
|
3190
|
+
this.events?.emit("session.rewound", {
|
|
3191
|
+
toPromptIndex: targetPromptIndex,
|
|
3192
|
+
revertedFiles: [],
|
|
3193
|
+
removedEvents: removedCount
|
|
3194
|
+
});
|
|
3195
|
+
return removedCount;
|
|
3196
|
+
}
|
|
3106
3197
|
};
|
|
3107
3198
|
function userInputTitle(content) {
|
|
3108
3199
|
if (typeof content === "string") return content.slice(0, 60);
|