@wrongstack/core 0.9.20 → 0.10.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/README.md +37 -33
- package/dist/{agent-bridge-Dti3KXGk.d.ts → agent-bridge-DBBGP5O4.d.ts} +1 -1
- package/dist/{agent-subagent-runner-U-rs7kk7.d.ts → agent-subagent-runner-KwufTWwn.d.ts} +3 -3
- package/dist/{compactor-D7X96RLZ.d.ts → compactor-D1RHFRmF.d.ts} +1 -1
- package/dist/{config-CLXMDOSs.d.ts → config-CJXBka2r.d.ts} +38 -2
- package/dist/{context-zkZeILpr.d.ts → context-7u93AcGD.d.ts} +94 -0
- package/dist/coordination/index.d.ts +12 -12
- package/dist/coordination/index.js +130 -58
- package/dist/coordination/index.js.map +1 -1
- package/dist/{default-config-Uzla85H-.d.ts → default-config-DEXI4jsl.d.ts} +10 -1
- package/dist/defaults/index.d.ts +24 -24
- package/dist/defaults/index.js +611 -95
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-DH-9r-_C.d.ts → events-Bw1K5E6K.d.ts} +8 -1
- package/dist/execution/index.d.ts +18 -15
- package/dist/execution/index.js +309 -61
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/goal-store-BeRsj7YX.d.ts +188 -0
- package/dist/{index-CFO9QmJo.d.ts → index-DIt5TIaF.d.ts} +8 -8
- package/dist/{index-BIHJ4uII.d.ts → index-DgQWnZxP.d.ts} +5 -5
- package/dist/index.d.ts +56 -35
- package/dist/index.js +742 -203
- 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 +57 -8
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DkESgh0G.d.ts → mcp-servers-BgINZzuo.d.ts} +3 -3
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +163 -10
- package/dist/models/index.js.map +1 -1
- package/dist/models-registry-gwMAo6E3.d.ts +86 -0
- package/dist/{multi-agent-DNp6lAzg.d.ts → multi-agent-C1O8EFzb.d.ts} +45 -4
- package/dist/{multi-agent-coordinator-CAhsegPz.d.ts → multi-agent-coordinator-DoVSBFNx.d.ts} +2 -2
- package/dist/{null-fleet-bus-Dnl19vmf.d.ts → null-fleet-bus-T-s3JaOt.d.ts} +8 -6
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-CHiBL0DD.d.ts → path-resolver-BfyK-I7w.d.ts} +2 -2
- package/dist/{permission-H35s9Evv.d.ts → permission-B6sldrSp.d.ts} +1 -1
- package/dist/{permission-policy-CT-nRmTn.d.ts → permission-policy-CtNscWOA.d.ts} +10 -9
- package/dist/{plan-templates-Bs8iRwi6.d.ts → plan-templates-BWs6Je7j.d.ts} +8 -8
- package/dist/{provider-runner-BZdDrWrS.d.ts → provider-runner-BmPe2RuU.d.ts} +3 -3
- package/dist/{retry-policy-J9N_PM40.d.ts → retry-policy-KF18W4dg.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js +130 -58
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +65 -4
- package/dist/security/index.js +67 -19
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-CFTh3Z6p.d.ts → selector-DmXxpFyM.d.ts} +1 -1
- package/dist/{session-reader-C7JJlxOw.d.ts → session-reader-CCSBfQmd.d.ts} +1 -1
- package/dist/storage/index.d.ts +7 -7
- package/dist/storage/index.js +125 -6
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-CneIxVip.d.ts → system-prompt-CM6zOhd2.d.ts} +19 -1
- package/dist/{tool-executor-flTuxsqO.d.ts → tool-executor-D7RxLtg4.d.ts} +4 -4
- package/dist/types/index.d.ts +16 -16
- package/dist/types/index.js +344 -14
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +23 -3
- package/dist/utils/index.js +66 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BCgmTNlG.d.ts → wstack-paths-eMXnY1_X.d.ts} +8 -0
- package/package.json +1 -1
- package/dist/goal-store-C7jcumEh.d.ts +0 -96
- package/dist/models-registry-OG_30xqZ.d.ts +0 -46
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from '../plan-templates-
|
|
2
|
-
export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-
|
|
3
|
-
import { p as Request, q as Response, w as SessionEvent } from '../context-
|
|
1
|
+
export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from '../plan-templates-BWs6Je7j.js';
|
|
2
|
+
export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-CCSBfQmd.js';
|
|
3
|
+
import { p as Request, q as Response, w as SessionEvent } from '../context-7u93AcGD.js';
|
|
4
4
|
import { S as SessionRewinder, C as CheckpointInfo, a as RewindResultExtended } from '../session-rewinder-C9HnMkhP.js';
|
|
5
5
|
export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BmYi3DGA.js';
|
|
6
|
-
export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as appendJournal, e as
|
|
7
|
-
import { a as WstackPaths } from '../wstack-paths-
|
|
8
|
-
import {
|
|
9
|
-
import '../events-
|
|
6
|
+
export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, S as STANDARD_AUDIT_EVENTS, a as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as appendJournal, e as createSessionEventBridge, f as emptyGoal, g as formatGoal, h as goalFilePath, l as loadGoal, r as resolveAuditLevel, i as resolveSessionLoggingConfig, s as saveGoal, j as summarizeUsage } from '../goal-store-BeRsj7YX.js';
|
|
7
|
+
import { a as WstackPaths } from '../wstack-paths-eMXnY1_X.js';
|
|
8
|
+
import { m as SyncCategory, n as SyncConfig } from '../config-CJXBka2r.js';
|
|
9
|
+
import '../events-Bw1K5E6K.js';
|
|
10
10
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
11
11
|
import '../memory-CEXuo7sz.js';
|
|
12
12
|
import '../secret-vault-DoISxaKO.js';
|
package/dist/storage/index.js
CHANGED
|
@@ -764,7 +764,7 @@ function isPersistedQueueItem(v) {
|
|
|
764
764
|
return typeof o["displayText"] === "string" && Array.isArray(o["blocks"]);
|
|
765
765
|
}
|
|
766
766
|
var DEFAULT_SPOOL_THRESHOLD = 256 * 1024;
|
|
767
|
-
var PLACEHOLDER_RE = /\[(pasted|image|file) #(\d+)\]/g;
|
|
767
|
+
var PLACEHOLDER_RE = /\[(pasted|image|file) #(\d+)[^\]]*\]|\[file:([^\]]+)\]/g;
|
|
768
768
|
var DefaultAttachmentStore = class {
|
|
769
769
|
items = /* @__PURE__ */ new Map();
|
|
770
770
|
refs = [];
|
|
@@ -818,9 +818,15 @@ var DefaultAttachmentStore = class {
|
|
|
818
818
|
const idx = m.index ?? 0;
|
|
819
819
|
const before = text.slice(lastIndex, idx);
|
|
820
820
|
if (before) blocks.push({ type: "text", text: before });
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
821
|
+
let ref;
|
|
822
|
+
if (m[3] !== void 0) {
|
|
823
|
+
const wantPath = m[3];
|
|
824
|
+
ref = findLast(this.refs, (r) => r.kind === "file" && refPath(r) === wantPath);
|
|
825
|
+
} else {
|
|
826
|
+
const kind = prefixToKind(m[1]);
|
|
827
|
+
const seq = Number(m[2]);
|
|
828
|
+
ref = this.refs.find((r) => r.kind === kind && r.seq === seq);
|
|
829
|
+
}
|
|
824
830
|
const att = ref ? this.items.get(ref.id) : void 0;
|
|
825
831
|
if (!att) {
|
|
826
832
|
blocks.push({ type: "text", text: m[0] });
|
|
@@ -873,6 +879,15 @@ function prefixToKind(prefix) {
|
|
|
873
879
|
if (prefix === "image") return "image";
|
|
874
880
|
return "file";
|
|
875
881
|
}
|
|
882
|
+
function refPath(ref) {
|
|
883
|
+
return ref.meta.filename ?? ref.meta.label;
|
|
884
|
+
}
|
|
885
|
+
function findLast(arr, pred) {
|
|
886
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
887
|
+
if (pred(arr[i])) return arr[i];
|
|
888
|
+
}
|
|
889
|
+
return void 0;
|
|
890
|
+
}
|
|
876
891
|
function mergeAdjacentText(blocks) {
|
|
877
892
|
const out = [];
|
|
878
893
|
for (const b of blocks) {
|
|
@@ -1248,6 +1263,14 @@ var DEFAULT_CONTEXT_CONFIG = Object.freeze({
|
|
|
1248
1263
|
preserveK: 10,
|
|
1249
1264
|
eliseThreshold: 2e3
|
|
1250
1265
|
});
|
|
1266
|
+
var DEFAULT_SESSION_LOGGING_CONFIG = Object.freeze({
|
|
1267
|
+
auditLevel: "standard",
|
|
1268
|
+
sampling: {
|
|
1269
|
+
toolProgress: {
|
|
1270
|
+
sampleRate: 8
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1251
1274
|
|
|
1252
1275
|
// src/storage/config-loader.ts
|
|
1253
1276
|
var BEHAVIOR_DEFAULTS = {
|
|
@@ -1276,7 +1299,8 @@ var BEHAVIOR_DEFAULTS = {
|
|
|
1276
1299
|
memory: true,
|
|
1277
1300
|
modelsRegistry: true,
|
|
1278
1301
|
skills: true
|
|
1279
|
-
}
|
|
1302
|
+
},
|
|
1303
|
+
session: { ...DEFAULT_SESSION_LOGGING_CONFIG }
|
|
1280
1304
|
};
|
|
1281
1305
|
var ENV_MAP = {
|
|
1282
1306
|
WRONGSTACK_PROVIDER: (c, v) => {
|
|
@@ -3846,6 +3870,101 @@ function timeAgo(iso) {
|
|
|
3846
3870
|
return `${days}d ago`;
|
|
3847
3871
|
}
|
|
3848
3872
|
|
|
3849
|
-
|
|
3873
|
+
// src/storage/session-event-bridge.ts
|
|
3874
|
+
var CORE_RECONSTRUCT_EVENTS = /* @__PURE__ */ new Set([
|
|
3875
|
+
"session_start",
|
|
3876
|
+
"session_resumed",
|
|
3877
|
+
"user_input",
|
|
3878
|
+
"llm_response",
|
|
3879
|
+
"tool_result",
|
|
3880
|
+
"checkpoint",
|
|
3881
|
+
"file_snapshot",
|
|
3882
|
+
"rewound",
|
|
3883
|
+
"in_flight_start",
|
|
3884
|
+
"in_flight_end",
|
|
3885
|
+
"session_end"
|
|
3886
|
+
]);
|
|
3887
|
+
var STANDARD_AUDIT_EVENTS = /* @__PURE__ */ new Set([
|
|
3888
|
+
"llm_request",
|
|
3889
|
+
"tool_use",
|
|
3890
|
+
"tool_call_start",
|
|
3891
|
+
"tool_call_end",
|
|
3892
|
+
"compaction",
|
|
3893
|
+
"error",
|
|
3894
|
+
"message_truncated",
|
|
3895
|
+
"provider_retry",
|
|
3896
|
+
"provider_error"
|
|
3897
|
+
]);
|
|
3898
|
+
var FULL_ONLY_EVENTS = /* @__PURE__ */ new Set([
|
|
3899
|
+
"tool_progress"
|
|
3900
|
+
]);
|
|
3901
|
+
function isAllowed(type, level) {
|
|
3902
|
+
if (CORE_RECONSTRUCT_EVENTS.has(type)) return true;
|
|
3903
|
+
if (level === "minimal") return false;
|
|
3904
|
+
if (STANDARD_AUDIT_EVENTS.has(type)) return true;
|
|
3905
|
+
if (level === "standard") return false;
|
|
3906
|
+
if (FULL_ONLY_EVENTS.has(type)) {
|
|
3907
|
+
return level === "full";
|
|
3908
|
+
}
|
|
3909
|
+
return true;
|
|
3910
|
+
}
|
|
3911
|
+
function createSessionEventBridge(writer, level = "standard", options = {}) {
|
|
3912
|
+
const normalizedLevel = level ?? "standard";
|
|
3913
|
+
const progressCounters = /* @__PURE__ */ new Map();
|
|
3914
|
+
const toolProgressConfig = options.sampling?.toolProgress ?? {};
|
|
3915
|
+
const TOOL_PROGRESS_SAMPLE_RATE = toolProgressConfig.sampleRate ?? 8;
|
|
3916
|
+
function shouldSample(event) {
|
|
3917
|
+
if (event.type !== "tool_progress") return true;
|
|
3918
|
+
const progEvent = event;
|
|
3919
|
+
const innerType = progEvent.event?.type;
|
|
3920
|
+
if (innerType === "warning" || innerType === "metric" || innerType === "file_changed") {
|
|
3921
|
+
return true;
|
|
3922
|
+
}
|
|
3923
|
+
if (innerType === "log" || innerType === "partial_output") {
|
|
3924
|
+
const key = progEvent.id || progEvent.name;
|
|
3925
|
+
const count = (progressCounters.get(key) || 0) + 1;
|
|
3926
|
+
progressCounters.set(key, count);
|
|
3927
|
+
return count === 1 || count % TOOL_PROGRESS_SAMPLE_RATE === 0;
|
|
3928
|
+
}
|
|
3929
|
+
return true;
|
|
3930
|
+
}
|
|
3931
|
+
return {
|
|
3932
|
+
level: normalizedLevel,
|
|
3933
|
+
allows(type) {
|
|
3934
|
+
return isAllowed(type, normalizedLevel);
|
|
3935
|
+
},
|
|
3936
|
+
async append(event) {
|
|
3937
|
+
if (!writer) return;
|
|
3938
|
+
if (!isAllowed(event.type, normalizedLevel)) return;
|
|
3939
|
+
if (!shouldSample(event)) return;
|
|
3940
|
+
try {
|
|
3941
|
+
await writer.append(event);
|
|
3942
|
+
} catch (err) {
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
};
|
|
3946
|
+
}
|
|
3947
|
+
function resolveAuditLevel(cfg) {
|
|
3948
|
+
const raw = cfg?.session?.auditLevel;
|
|
3949
|
+
if (raw === "minimal" || raw === "standard" || raw === "full") {
|
|
3950
|
+
return raw;
|
|
3951
|
+
}
|
|
3952
|
+
return "standard";
|
|
3953
|
+
}
|
|
3954
|
+
function resolveSessionLoggingConfig(cfg) {
|
|
3955
|
+
const session = cfg?.session ?? {};
|
|
3956
|
+
const auditLevel = resolveAuditLevel(cfg);
|
|
3957
|
+
const toolProgressSampleRate = session.sampling?.toolProgress?.sampleRate ?? 8;
|
|
3958
|
+
return {
|
|
3959
|
+
auditLevel,
|
|
3960
|
+
sampling: {
|
|
3961
|
+
toolProgress: {
|
|
3962
|
+
sampleRate: Math.max(1, Math.floor(toolProgressSampleRate))
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
};
|
|
3966
|
+
}
|
|
3967
|
+
|
|
3968
|
+
export { ALL_SYNC_CATEGORIES, AnnotationsStore, CORE_RECONSTRUCT_EVENTS, CloudSync, ConfigMigrationError, DEFAULT_CONFIG_MIGRATIONS, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultMemoryStore, DefaultPromptStore, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, DirectorStateCheckpoint, MAX_JOURNAL_ENTRIES, QueueStore, RecoveryLock, ReplayLogStore, STANDARD_AUDIT_EVENTS, SessionAnalyzer, SessionRecovery, ToolAuditLog, addPlanItem, appendJournal, attachPlanCheckpoint, attachTodosCheckpoint, clearPlan, createSessionEventBridge, deriveTodosFromPlanItem, emptyGoal, emptyPlan, formatGoal, formatPlan, formatPlanTemplates, getPlanTemplate, goalFilePath, listPlanTemplates, loadDirectorState, loadGoal, loadPlan, loadTodosCheckpoint, removePlanItem, resolveAuditLevel, resolveSessionLoggingConfig, runConfigMigrations, saveGoal, savePlan, saveTodosCheckpoint, setPlanItemStatus, summarizeUsage };
|
|
3850
3969
|
//# sourceMappingURL=index.js.map
|
|
3851
3970
|
//# sourceMappingURL=index.js.map
|