@ouro.bot/cli 0.1.0-alpha.812 → 0.1.0-alpha.814
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.json +13 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/core.js +16 -12
- package/dist/heart/daemon/sanctuary-acceptance-adapter.js +55 -52
- package/dist/heart/session-events.js +125 -61
- package/dist/heart/session-redaction-repair.js +12 -3
- package/dist/heart/session-stats.js +3 -2
- package/dist/mailbox-ui/assets/{index-J8zDwHmE.js → index-Cyv4mw3Y.js} +1 -1
- package/dist/mailbox-ui/index.html +1 -1
- package/dist/mind/context.js +31 -1
- package/dist/senses/shared-turn.js +18 -5
- package/dist/senses/telegram-effect-adapter.js +10 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -258,6 +258,11 @@ function rawEnvelope(bytes) {
|
|
|
258
258
|
}
|
|
259
259
|
return envelope;
|
|
260
260
|
}
|
|
261
|
+
function projectedStructuredOutputs(envelope) {
|
|
262
|
+
const byId = new Map(envelope.events.map((event) => [event.id, event]));
|
|
263
|
+
const events = (0, session_events_1.projectedSessionEventIds)(envelope).map((id) => byId.get(id));
|
|
264
|
+
return (0, structured_output_1.extractStructuredOutputsFromEvents)(events, { emitTelemetry: false });
|
|
265
|
+
}
|
|
261
266
|
function compute(bytes, relative, capturedAt) {
|
|
262
267
|
const envelope = rawEnvelope(bytes);
|
|
263
268
|
const targets = selectA003LegacyRequiredCorrections(envelope.events);
|
|
@@ -275,11 +280,15 @@ function compute(bytes, relative, capturedAt) {
|
|
|
275
280
|
if (!entries.every((entry) => (0, session_events_1.isExactRawSessionRedactionMarker)(entry.marker, events)))
|
|
276
281
|
refuse("invalid computed marker block");
|
|
277
282
|
const removed = new Set(entries.flatMap((entry) => [entry.target.id, entry.marker.id]));
|
|
283
|
+
const selected = new Set((0, session_events_1.projectedSessionEventIds)(envelope).filter((id) => !removed.has(id)));
|
|
278
284
|
const postimage = {
|
|
279
285
|
...envelope, events,
|
|
280
|
-
projection: {
|
|
281
|
-
|
|
286
|
+
projection: {
|
|
287
|
+
...envelope.projection, eventIds: envelope.projection.eventIds.filter((id) => !removed.has(id)),
|
|
288
|
+
trimmed: envelope.projection.trimmed || (0, session_events_1.selectEffectiveSessionEvents)(events).some((event) => !selected.has(event.id)),
|
|
289
|
+
},
|
|
282
290
|
};
|
|
291
|
+
postimage.structuredOutputs = projectedStructuredOutputs(postimage);
|
|
283
292
|
const postBytes = JSON.stringify(postimage, null, 2);
|
|
284
293
|
if (Buffer.byteLength(postBytes) > SESSION_LIMIT)
|
|
285
294
|
refuse("postimage exceeds 32 MiB");
|
|
@@ -449,7 +458,7 @@ function alreadyApplied(envelope, manifest, currentRevision) {
|
|
|
449
458
|
const effective = (0, session_events_1.selectEffectiveSessionEvents)(envelope.events);
|
|
450
459
|
const visible = new Set(effective.map((event) => event.id));
|
|
451
460
|
return envelope.projection.eventIds.every((id) => visible.has(id))
|
|
452
|
-
&& (0, node_util_1.isDeepStrictEqual)(envelope.structuredOutputs, (
|
|
461
|
+
&& (0, node_util_1.isDeepStrictEqual)(envelope.structuredOutputs, projectedStructuredOutputs(envelope));
|
|
453
462
|
}
|
|
454
463
|
async function reconcileWrite(sessionPath, lease, value, before, after, success) {
|
|
455
464
|
try {
|
|
@@ -55,6 +55,7 @@ function eventTimeMs(event) {
|
|
|
55
55
|
}
|
|
56
56
|
function computeSessionStats(envelope, sessionPath) {
|
|
57
57
|
const byRole = emptyByRole();
|
|
58
|
+
const projectionCount = (0, session_events_1.projectedSessionEventIds)(envelope).length;
|
|
58
59
|
let toolCallTotal = 0;
|
|
59
60
|
let attachments = 0;
|
|
60
61
|
const toolNameCounts = new Map();
|
|
@@ -97,8 +98,8 @@ function computeSessionStats(envelope, sessionPath) {
|
|
|
97
98
|
durationMs: earliestMs !== null && latestMs !== null ? latestMs - earliestMs : null,
|
|
98
99
|
},
|
|
99
100
|
projection: {
|
|
100
|
-
eventCount:
|
|
101
|
-
omittedFromProjection: Math.max(0, envelope.events.length -
|
|
101
|
+
eventCount: projectionCount,
|
|
102
|
+
omittedFromProjection: Math.max(0, envelope.events.length - projectionCount),
|
|
102
103
|
inputTokens: envelope.projection.inputTokens,
|
|
103
104
|
maxTokens: envelope.projection.maxTokens,
|
|
104
105
|
trimmed: envelope.projection.trimmed,
|