@demicodes/agent 0.17.1 → 0.17.3

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/index.d.mts CHANGED
@@ -73,6 +73,7 @@ declare class AgentSession<State> {
73
73
  private readonly retryPolicy;
74
74
  private persistTimer;
75
75
  private persistDirty;
76
+ private persistChain;
76
77
  /**
77
78
  * Restores a session from a checkpoint. Ownership of the checkpoint (including
78
79
  * `state`) transfers to the session: the caller must not mutate it afterwards.
@@ -219,6 +220,7 @@ declare class AgentSession<State> {
219
220
  private commitTranscript;
220
221
  private schedulePersist;
221
222
  private persistCheckpoint;
223
+ private writeCheckpointIfDirty;
222
224
  private flushPersist;
223
225
  private emit;
224
226
  private resolveIdleWaiters;
package/dist/index.mjs CHANGED
@@ -1225,6 +1225,7 @@ var AgentSession = class AgentSession {
1225
1225
  retryPolicy;
1226
1226
  persistTimer = null;
1227
1227
  persistDirty = false;
1228
+ persistChain = Promise.resolve();
1228
1229
  /**
1229
1230
  * Restores a session from a checkpoint. Ownership of the checkpoint (including
1230
1231
  * `state`) transfers to the session: the caller must not mutate it afterwards.
@@ -2118,7 +2119,12 @@ var AgentSession = class AgentSession {
2118
2119
  });
2119
2120
  }, this.persistIntervalMs);
2120
2121
  }
2121
- async persistCheckpoint() {
2122
+ persistCheckpoint() {
2123
+ const run = this.persistChain.then(() => this.writeCheckpointIfDirty());
2124
+ this.persistChain = run.then(noop, noop);
2125
+ return run;
2126
+ }
2127
+ async writeCheckpointIfDirty() {
2122
2128
  if (!this.store || !this.persistDirty) return;
2123
2129
  this.persistDirty = false;
2124
2130
  await this.store.saveCheckpoint({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demicodes/agent",
3
3
  "description": "Session runtime and transport-neutral client and server protocol for Demi.",
4
- "version": "0.17.1",
4
+ "version": "0.17.3",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -19,10 +19,10 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@demicodes/core": "^0.17.1",
23
- "@demicodes/provider": "^0.17.1",
24
- "@demicodes/shell": "^0.17.1",
25
- "@demicodes/utils": "^0.17.1"
22
+ "@demicodes/core": "^0.17.3",
23
+ "@demicodes/provider": "^0.17.3",
24
+ "@demicodes/shell": "^0.17.3",
25
+ "@demicodes/utils": "^0.17.3"
26
26
  },
27
27
  "license": "Apache-2.0",
28
28
  "main": "./dist/index.mjs",