@harness-kernel/core 0.2.0 → 0.2.1
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/dist/{chunk-37PIMSLG.js → chunk-QEVKKJ7N.js} +12 -5
- package/dist/{chunk-37PIMSLG.js.map → chunk-QEVKKJ7N.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{runner-BzEf0lAV.d.ts → runner-B41JEovO.d.ts} +1 -0
- package/dist/runner.d.ts +1 -1
- package/dist/runner.js +1 -1
- package/package.json +1 -1
|
@@ -3712,14 +3712,14 @@ function mergeConfig(base, overrides) {
|
|
|
3712
3712
|
storage: overrides?.storage ?? base.storage
|
|
3713
3713
|
};
|
|
3714
3714
|
}
|
|
3715
|
-
function statusToSummary(status) {
|
|
3715
|
+
function statusToSummary(status, latestRunId) {
|
|
3716
3716
|
return {
|
|
3717
3717
|
sessionId: status.sessionId,
|
|
3718
3718
|
agentKey: status.agentKey,
|
|
3719
3719
|
createdAt: status.createdAt,
|
|
3720
3720
|
lastActiveAt: status.lastActiveAt,
|
|
3721
3721
|
mode: status.mode,
|
|
3722
|
-
latestRunId
|
|
3722
|
+
latestRunId
|
|
3723
3723
|
};
|
|
3724
3724
|
}
|
|
3725
3725
|
function sortSummaries(items) {
|
|
@@ -3763,6 +3763,7 @@ var HarnessSessionStoreImpl = class {
|
|
|
3763
3763
|
config;
|
|
3764
3764
|
sessions = /* @__PURE__ */ new Map();
|
|
3765
3765
|
unsubscriptions = /* @__PURE__ */ new Map();
|
|
3766
|
+
latestRunIds = /* @__PURE__ */ new Map();
|
|
3766
3767
|
listeners = /* @__PURE__ */ new Set();
|
|
3767
3768
|
storage;
|
|
3768
3769
|
closed = false;
|
|
@@ -3778,6 +3779,8 @@ var HarnessSessionStoreImpl = class {
|
|
|
3778
3779
|
const stored = await this.storage.getSession(id);
|
|
3779
3780
|
const session = await createHarnessSession(config, { sessionId: id, restoredSession: stored });
|
|
3780
3781
|
const status = session.getStatus();
|
|
3782
|
+
if (stored?.latestRunId) this.latestRunIds.set(id, stored.latestRunId);
|
|
3783
|
+
else this.latestRunIds.delete(id);
|
|
3781
3784
|
if (!stored) {
|
|
3782
3785
|
await this.storage.createSession({
|
|
3783
3786
|
sessionId: id,
|
|
@@ -3789,6 +3792,8 @@ var HarnessSessionStoreImpl = class {
|
|
|
3789
3792
|
}
|
|
3790
3793
|
this.sessions.set(id, session);
|
|
3791
3794
|
this.unsubscriptions.set(id, session.on((event) => {
|
|
3795
|
+
if (event.type === "run.started") this.latestRunIds.set(id, event.runId);
|
|
3796
|
+
if (event.type === "run.completed") this.latestRunIds.set(id, event.result.runId);
|
|
3792
3797
|
if (event.type === "session.status") {
|
|
3793
3798
|
void this.storage.touchSession({
|
|
3794
3799
|
sessionId: id,
|
|
@@ -3806,10 +3811,10 @@ var HarnessSessionStoreImpl = class {
|
|
|
3806
3811
|
}
|
|
3807
3812
|
async list(query) {
|
|
3808
3813
|
if (query?.active) {
|
|
3809
|
-
return paginateActive([...this.sessions.values()].map((session) => statusToSummary(session.getStatus())), query);
|
|
3814
|
+
return paginateActive([...this.sessions.values()].map((session) => statusToSummary(session.getStatus(), this.latestRunIds.get(session.id))), query);
|
|
3810
3815
|
}
|
|
3811
3816
|
const result = await this.storage.listSessions(query);
|
|
3812
|
-
const active = new Map([...this.sessions.values()].map((session) => [session.id, statusToSummary(session.getStatus())]));
|
|
3817
|
+
const active = new Map([...this.sessions.values()].map((session) => [session.id, statusToSummary(session.getStatus(), this.latestRunIds.get(session.id))]));
|
|
3813
3818
|
return {
|
|
3814
3819
|
items: result.items.map((item) => active.get(item.sessionId) ?? item),
|
|
3815
3820
|
nextCursor: result.nextCursor
|
|
@@ -3826,6 +3831,7 @@ var HarnessSessionStoreImpl = class {
|
|
|
3826
3831
|
const session = this.sessions.get(sessionId);
|
|
3827
3832
|
if (!session) return false;
|
|
3828
3833
|
this.sessions.delete(sessionId);
|
|
3834
|
+
this.latestRunIds.delete(sessionId);
|
|
3829
3835
|
this.unsubscriptions.get(sessionId)?.();
|
|
3830
3836
|
this.unsubscriptions.delete(sessionId);
|
|
3831
3837
|
await session.close();
|
|
@@ -3833,6 +3839,7 @@ var HarnessSessionStoreImpl = class {
|
|
|
3833
3839
|
}
|
|
3834
3840
|
async delete(sessionId) {
|
|
3835
3841
|
await this.close(sessionId);
|
|
3842
|
+
this.latestRunIds.delete(sessionId);
|
|
3836
3843
|
const deleted = await this.storage.deleteSession(sessionId);
|
|
3837
3844
|
if (deleted) this.notify({ type: "session.deleted", sessionId });
|
|
3838
3845
|
return deleted;
|
|
@@ -3892,4 +3899,4 @@ export {
|
|
|
3892
3899
|
HarnessSessionStoreImpl,
|
|
3893
3900
|
createHarnessSessionStore
|
|
3894
3901
|
};
|
|
3895
|
-
//# sourceMappingURL=chunk-
|
|
3902
|
+
//# sourceMappingURL=chunk-QEVKKJ7N.js.map
|