@wrongstack/core 0.73.1 → 0.77.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.
Files changed (41) hide show
  1. package/dist/{agent-bridge-C0Ze7Ldm.d.ts → agent-bridge-EWdqs8v6.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-BmITbs1Q.d.ts → agent-subagent-runner-D8qW8OSC.d.ts} +2 -2
  3. package/dist/coordination/index.d.ts +7 -7
  4. package/dist/coordination/index.js +64 -6
  5. package/dist/coordination/index.js.map +1 -1
  6. package/dist/defaults/index.d.ts +11 -11
  7. package/dist/defaults/index.js +107 -45
  8. package/dist/defaults/index.js.map +1 -1
  9. package/dist/{events-BBAlxBuw.d.ts → events-CYaoLN5_.d.ts} +37 -0
  10. package/dist/execution/index.d.ts +6 -6
  11. package/dist/extension/index.d.ts +2 -2
  12. package/dist/{index-yQbZ2NQx.d.ts → index-DIxjTOga.d.ts} +2 -2
  13. package/dist/{index-BN6i2Nfg.d.ts → index-Dsda0uCn.d.ts} +1 -1
  14. package/dist/index.d.ts +96 -23
  15. package/dist/index.js +234 -25
  16. package/dist/index.js.map +1 -1
  17. package/dist/infrastructure/index.d.ts +3 -3
  18. package/dist/infrastructure/index.js +16 -2
  19. package/dist/infrastructure/index.js.map +1 -1
  20. package/dist/kernel/index.d.ts +3 -3
  21. package/dist/kernel/index.js.map +1 -1
  22. package/dist/{logger-bOzkF5LL.d.ts → logger-BppKxDqZ.d.ts} +9 -0
  23. package/dist/{multi-agent-coordinator-BSBbZt0e.d.ts → multi-agent-coordinator-DpbG3wiy.d.ts} +1 -1
  24. package/dist/{null-fleet-bus-BCIRT_nV.d.ts → null-fleet-bus-u5ys3lW_.d.ts} +13 -4
  25. package/dist/observability/index.d.ts +1 -1
  26. package/dist/{parallel-eternal-engine-CjAYGaCw.d.ts → parallel-eternal-engine-Dn0P8Pbj.d.ts} +3 -3
  27. package/dist/{path-resolver-BnqXa9Ze.d.ts → path-resolver-B32v2JIq.d.ts} +1 -1
  28. package/dist/{plan-templates-DBgrTGPu.d.ts → plan-templates-BcUwLlMQ.d.ts} +7 -2
  29. package/dist/{provider-runner-n3KkHT_w.d.ts → provider-runner-CSi_7l0h.d.ts} +1 -1
  30. package/dist/sdd/index.d.ts +3 -3
  31. package/dist/storage/index.d.ts +3 -3
  32. package/dist/storage/index.js +22 -6
  33. package/dist/storage/index.js.map +1 -1
  34. package/dist/types/index.d.ts +10 -10
  35. package/dist/types/index.js +16 -2
  36. package/dist/types/index.js.map +1 -1
  37. package/dist/utils/index.d.ts +1 -1
  38. package/dist/utils/index.js +12 -2
  39. package/dist/utils/index.js.map +1 -1
  40. package/dist/{wstack-paths-eMXnY1_X.d.ts → wstack-paths-D7evAFWM.d.ts} +8 -1
  41. package/package.json +1 -1
@@ -167,6 +167,16 @@ function isEmptyMessage(msg) {
167
167
  }
168
168
 
169
169
  // src/storage/session-store.ts
170
+ function sanitizeModel(model) {
171
+ return model.replace(/[^a-zA-Z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
172
+ }
173
+ function generateSessionId(startedAt, model) {
174
+ const date = startedAt.slice(0, 10);
175
+ const time = startedAt.slice(11, 19).replace(/:/g, "-");
176
+ const suffix = randomBytes(2).toString("hex");
177
+ const modelPart = model ? `_${sanitizeModel(model)}` : "";
178
+ return `${date}/${time}Z${modelPart}_${suffix}`;
179
+ }
170
180
  var DefaultSessionStore = class {
171
181
  dir;
172
182
  events;
@@ -180,15 +190,21 @@ var DefaultSessionStore = class {
180
190
  sessionPath(id, ext) {
181
191
  return path14.join(this.dir, `${id}${ext}`);
182
192
  }
183
- async ensureShardDir(_id) {
184
- await ensureDir(this.dir);
185
- return this.dir;
193
+ /**
194
+ * Ensure the directory implied by the session ID exists. When the ID
195
+ * contains a date prefix like `2026-06-06/...`, this creates the date
196
+ * subdirectory so sessions group naturally by day.
197
+ */
198
+ async ensureShardDir(id) {
199
+ const dirPath = path14.dirname(path14.join(this.dir, id));
200
+ await ensureDir(dirPath);
201
+ return dirPath;
186
202
  }
187
203
  async create(meta) {
188
204
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
189
- const id = meta.id ?? `${startedAt.replace(/[:.]/g, "-")}-${randomBytes(2).toString("hex")}`;
205
+ const id = meta.id && meta.id.length > 0 ? meta.id : generateSessionId(startedAt, meta.model ?? meta.provider);
190
206
  const shardDir = await this.ensureShardDir(id);
191
- const file = path14.join(shardDir, `${id}.jsonl`);
207
+ const file = path14.join(shardDir, `${path14.basename(id)}.jsonl`);
192
208
  let handle;
193
209
  try {
194
210
  handle = await fsp.open(file, "a", 384);
@@ -2968,7 +2984,7 @@ async function loadTodosCheckpoint(filePath) {
2968
2984
  const parsed = JSON.parse(raw);
2969
2985
  if (parsed?.version !== 1 || !Array.isArray(parsed.todos)) return null;
2970
2986
  return parsed.todos.filter(
2971
- (t) => !!t && typeof t.id === "string" && typeof t.content === "string" && typeof t.status === "string"
2987
+ (t) => !!t && typeof t.id === "string" && typeof t.content === "string" && typeof t.status === "string" && (t.activeForm === void 0 || typeof t.activeForm === "string")
2972
2988
  );
2973
2989
  } catch {
2974
2990
  return null;