sentinelayer-cli 0.14.0 → 0.15.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/package.json +1 -1
- package/src/commands/session.js +48 -0
package/package.json
CHANGED
package/src/commands/session.js
CHANGED
|
@@ -948,6 +948,50 @@ async function hydrateAfterCheckpointMutation(sessionId, { targetPath } = {}) {
|
|
|
948
948
|
}));
|
|
949
949
|
}
|
|
950
950
|
|
|
951
|
+
async function hydrateJoinBriefingContext(sessionId, { targetPath, limit = 100 } = {}) {
|
|
952
|
+
const normalizedLimit = Math.max(1, Math.min(200, parsePositiveInteger(limit, "limit", 100)));
|
|
953
|
+
try {
|
|
954
|
+
const remoteTail = await pollSessionEventsBefore(sessionId, {
|
|
955
|
+
targetPath,
|
|
956
|
+
limit: normalizedLimit,
|
|
957
|
+
timeoutMs: 15_000,
|
|
958
|
+
forceCircuitProbe: true,
|
|
959
|
+
});
|
|
960
|
+
if (!remoteTail?.ok) {
|
|
961
|
+
return {
|
|
962
|
+
ok: false,
|
|
963
|
+
reason: normalizeString(remoteTail?.reason) || "remote_tail_unavailable",
|
|
964
|
+
remoteEvents: 0,
|
|
965
|
+
appended: 0,
|
|
966
|
+
skipped: 0,
|
|
967
|
+
failed: 0,
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
const appended = await appendMissingRemoteEvents(sessionId, remoteTail.events, {
|
|
971
|
+
targetPath,
|
|
972
|
+
});
|
|
973
|
+
return {
|
|
974
|
+
ok: true,
|
|
975
|
+
reason: "",
|
|
976
|
+
remoteEvents: Array.isArray(remoteTail.events) ? remoteTail.events.length : 0,
|
|
977
|
+
appended: appended.appended,
|
|
978
|
+
skipped: appended.skipped,
|
|
979
|
+
failed: appended.failed,
|
|
980
|
+
cursor: remoteTail.cursor || null,
|
|
981
|
+
beforeSequence: remoteTail.beforeSequence || null,
|
|
982
|
+
};
|
|
983
|
+
} catch (error) {
|
|
984
|
+
return {
|
|
985
|
+
ok: false,
|
|
986
|
+
reason: normalizeString(error?.message) || "join_context_hydrate_failed",
|
|
987
|
+
remoteEvents: 0,
|
|
988
|
+
appended: 0,
|
|
989
|
+
skipped: 0,
|
|
990
|
+
failed: 0,
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
951
995
|
async function appendMissingRemoteEvents(sessionId, remoteEvents = [], { targetPath } = {}) {
|
|
952
996
|
const events = Array.isArray(remoteEvents) ? remoteEvents : [];
|
|
953
997
|
if (events.length === 0) {
|
|
@@ -1577,6 +1621,9 @@ export function registerSessionCommand(program) {
|
|
|
1577
1621
|
skipRemoteProbe: true,
|
|
1578
1622
|
remoteSession,
|
|
1579
1623
|
});
|
|
1624
|
+
const joinHydration = await hydrateJoinBriefingContext(normalizedSessionId, {
|
|
1625
|
+
targetPath,
|
|
1626
|
+
});
|
|
1580
1627
|
|
|
1581
1628
|
const explicitAgent = normalizeString(options.agent);
|
|
1582
1629
|
const agentSeed = explicitAgent || normalizeString(options.name);
|
|
@@ -1630,6 +1677,7 @@ export function registerSessionCommand(program) {
|
|
|
1630
1677
|
materializedLocalSession: localSession.materialized,
|
|
1631
1678
|
refreshedLocalSession: Boolean(localSession.refreshed),
|
|
1632
1679
|
verificationSource: verification.source,
|
|
1680
|
+
joinHydration,
|
|
1633
1681
|
eventCount: Number.isFinite(eventCount) ? eventCount : 0,
|
|
1634
1682
|
agentCount: Number.isFinite(agentCount) ? agentCount : 0,
|
|
1635
1683
|
lastActivityAt: lastActivityIso || null,
|