@groeponline/pi-missions 0.3.10 → 0.3.12

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 CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.12] - 2026-09-05
11
+
12
+ ### Fixed
13
+ - generate session ids with crypto.randomUUID (#19)
14
+ ## [0.3.11] - 2026-09-05
15
+
16
+ ### Fixed
17
+ - persist history onto fresh mission state (#18)
18
+
19
+ ### Documentation
20
+ - disambiguate schema_version from SCHEMA_VERSION (#12)
10
21
  ## [0.3.10] - 2026-08-30
11
22
 
12
23
  ### Maintenance
package/dist/index.js CHANGED
@@ -1368,6 +1368,7 @@ function statusText(mission) {
1368
1368
  }
1369
1369
 
1370
1370
  // src/engines/metrics.ts
1371
+ import { randomUUID } from "crypto";
1371
1372
  var SessionMetricsCollector = class _SessionMetricsCollector {
1372
1373
  metrics;
1373
1374
  static instance = null;
@@ -1385,7 +1386,7 @@ var SessionMetricsCollector = class _SessionMetricsCollector {
1385
1386
  }
1386
1387
  freshMetrics() {
1387
1388
  return {
1388
- sessionId: `session-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
1389
+ sessionId: `session-${randomUUID()}`,
1389
1390
  startTime: Date.now(),
1390
1391
  toolCalls: { total: 0, byTool: {}, successful: 0, failed: 0 },
1391
1392
  tokensUsed: 0,
@@ -2158,24 +2159,25 @@ function spawnWorker(mission, config) {
2158
2159
  }
2159
2160
  try {
2160
2161
  const missionId = mission.id;
2161
- appendHistory(mission, {
2162
- event: "worker_finished",
2163
- featureId: config.featureId,
2164
- note: `Exit ${code}${signal ? ` (${signal})` : ""} in ${Math.round(durationMs / 1e3)}s`,
2165
- details: {
2166
- exitCode: code,
2167
- signal: signal ?? void 0,
2168
- durationMs,
2169
- killed,
2170
- missionId,
2171
- stdoutLen: stdout.length,
2172
- stderrLen: stderr.length,
2173
- model,
2174
- orchestraCorrelation: config.orchestraCorrelation
2175
- }
2176
- });
2177
- saveMissionSafe(mission).catch(() => {
2178
- });
2162
+ const freshMission = loadMissionFromDisk(missionId);
2163
+ if (freshMission?.id === missionId) {
2164
+ appendHistory(freshMission, {
2165
+ event: "worker_finished",
2166
+ featureId: config.featureId,
2167
+ note: `Exit ${code}${signal ? ` (${signal})` : ""} in ${Math.round(durationMs / 1e3)}s`,
2168
+ details: {
2169
+ exitCode: code,
2170
+ signal: signal ?? void 0,
2171
+ durationMs,
2172
+ killed,
2173
+ missionId,
2174
+ stdoutLen: stdout.length,
2175
+ stderrLen: stderr.length,
2176
+ model,
2177
+ orchestraCorrelation: config.orchestraCorrelation
2178
+ }
2179
+ });
2180
+ }
2179
2181
  } catch {
2180
2182
  }
2181
2183
  resolve3(result);