@agentchatme/agent-core 0.0.1311 → 0.0.1312

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/README.md CHANGED
@@ -93,6 +93,11 @@ import { runDaemon } from '@agentchatme/agent-core/daemon'
93
93
  await runDaemon({ home: profile.home(), adapter: new MyRuntimeAdapter(...) })
94
94
  ```
95
95
 
96
+ The daemon gives each incoming message its own runtime turn. Turns are ordered
97
+ within a conversation and may run concurrently across different conversations.
98
+ A message is acknowledged only after its turn succeeds; a failure stays pending
99
+ and retries with capped exponential backoff instead of being dropped.
100
+
96
101
  ## Development
97
102
 
98
103
  ```
@@ -25,7 +25,7 @@ var log = {
25
25
  };
26
26
 
27
27
  // src/version.ts
28
- var VERSION = "0.0.1311";
28
+ var VERSION = "0.0.1312";
29
29
 
30
30
  // src/client-identity.ts
31
31
  var CODING_AGENTS_CLIENT_IDENTITY = {
@@ -108,6 +108,23 @@ function atomicWriteFile(filePath, data, mode) {
108
108
  fs2.chmodSync(filePath, mode);
109
109
  }
110
110
  }
111
+ function atomicCopyFile(source, destination, mode = 493) {
112
+ const dir = path2.dirname(destination);
113
+ fs2.mkdirSync(dir, { recursive: true, mode: 448 });
114
+ const tmp = path2.join(dir, `.${path2.basename(destination)}.${process.pid}.tmp`);
115
+ try {
116
+ fs2.copyFileSync(source, tmp);
117
+ fs2.chmodSync(tmp, mode);
118
+ fs2.renameSync(tmp, destination);
119
+ fs2.chmodSync(destination, mode);
120
+ } catch (err) {
121
+ try {
122
+ fs2.rmSync(tmp, { force: true });
123
+ } catch {
124
+ }
125
+ throw err;
126
+ }
127
+ }
111
128
  function readJsonFile(filePath) {
112
129
  try {
113
130
  const raw = fs2.readFileSync(filePath, "utf-8");
@@ -4383,6 +4400,7 @@ function lastDeliveryId(rows) {
4383
4400
  import * as fs4 from "fs";
4384
4401
  import * as path4 from "path";
4385
4402
  var ALWAYS_ON_WANTED = "always-on.wanted";
4403
+ var ALWAYS_ON_INSTALLED_VERSION = "always-on.installed-version";
4386
4404
  var HEARTBEAT_FILE = "daemon.heartbeat";
4387
4405
  var HEARTBEAT_STALE_MS = 3 * 6e4;
4388
4406
  function markAlwaysOnWanted(home) {
@@ -4401,6 +4419,24 @@ function clearAlwaysOnWanted(home) {
4401
4419
  function alwaysOnWanted(home) {
4402
4420
  return fs4.existsSync(path4.join(home, ALWAYS_ON_WANTED));
4403
4421
  }
4422
+ function readAlwaysOnInstalledVersion(home) {
4423
+ try {
4424
+ const version = fs4.readFileSync(path4.join(home, ALWAYS_ON_INSTALLED_VERSION), "utf-8").trim();
4425
+ return version.length > 0 ? version : null;
4426
+ } catch {
4427
+ return null;
4428
+ }
4429
+ }
4430
+ function markAlwaysOnInstalledVersion(home, version) {
4431
+ atomicWriteFile(path4.join(home, ALWAYS_ON_INSTALLED_VERSION), `${version}
4432
+ `, 384);
4433
+ }
4434
+ function clearAlwaysOnInstalledVersion(home) {
4435
+ try {
4436
+ fs4.rmSync(path4.join(home, ALWAYS_ON_INSTALLED_VERSION), { force: true });
4437
+ } catch {
4438
+ }
4439
+ }
4404
4440
  var ALWAYS_ON_OPTOUT = "always-on.optout";
4405
4441
  function markAlwaysOnOptOut(home) {
4406
4442
  try {
@@ -4463,6 +4499,7 @@ export {
4463
4499
  CODING_AGENTS_CLIENT_HEADERS,
4464
4500
  acquireLeaderLock,
4465
4501
  atomicWriteFile,
4502
+ atomicCopyFile,
4466
4503
  readJsonFile,
4467
4504
  DEFAULT_API_BASE,
4468
4505
  credentialsPath,
@@ -4488,6 +4525,9 @@ export {
4488
4525
  markAlwaysOnWanted,
4489
4526
  clearAlwaysOnWanted,
4490
4527
  alwaysOnWanted,
4528
+ readAlwaysOnInstalledVersion,
4529
+ markAlwaysOnInstalledVersion,
4530
+ clearAlwaysOnInstalledVersion,
4491
4531
  markAlwaysOnOptOut,
4492
4532
  clearAlwaysOnOptOut,
4493
4533
  alwaysOnOptedOut,
@@ -4496,4 +4536,4 @@ export {
4496
4536
  alwaysOnState,
4497
4537
  alwaysOnHealth
4498
4538
  };
4499
- //# sourceMappingURL=chunk-ER4AFPH7.js.map
4539
+ //# sourceMappingURL=chunk-AGDJ4A6R.js.map