@themoltnet/agent-daemon 0.14.1 → 0.14.2

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.
Files changed (2) hide show
  1. package/dist/main.js +18 -8
  2. package/package.json +7 -7
package/dist/main.js CHANGED
@@ -27970,12 +27970,18 @@ var PollingApiTaskSource = class {
27970
27970
  }
27971
27971
  async claim() {
27972
27972
  while (!this.aborted()) {
27973
- const { candidates, hadListError } = await this.listCandidates();
27974
- const claimed = await this.tryClaimOne(candidates);
27975
- if (claimed) {
27976
- this.currentBackoffMs = this.minBackoffMs;
27977
- return claimed;
27978
- }
27973
+ let cursor;
27974
+ let hadListError = false;
27975
+ do {
27976
+ const page = await this.listCandidates(cursor);
27977
+ hadListError = hadListError || page.hadListError;
27978
+ const claimed = await this.tryClaimOne(page.candidates);
27979
+ if (claimed) {
27980
+ this.currentBackoffMs = this.minBackoffMs;
27981
+ return claimed;
27982
+ }
27983
+ cursor = page.nextCursor;
27984
+ } while (cursor && !this.aborted());
27979
27985
  if (this.opts.stopWhenEmpty && !hadListError) return null;
27980
27986
  await this.sleepWithBackoff();
27981
27987
  }
@@ -27985,10 +27991,11 @@ var PollingApiTaskSource = class {
27985
27991
  aborted() {
27986
27992
  return this.opts.signal?.aborted === true;
27987
27993
  }
27988
- async listCandidates() {
27994
+ async listCandidates(cursor) {
27989
27995
  const seen = /* @__PURE__ */ new Set();
27990
27996
  const out = [];
27991
27997
  let hadListError = false;
27998
+ let nextCursor;
27992
27999
  if (this.aborted()) return {
27993
28000
  candidates: out,
27994
28001
  hadListError
@@ -28003,8 +28010,10 @@ var PollingApiTaskSource = class {
28003
28010
  provider: this.opts.provider,
28004
28011
  model: this.opts.model
28005
28012
  } : {},
28013
+ ...cursor ? { cursor } : {},
28006
28014
  limit: this.listLimit
28007
28015
  });
28016
+ nextCursor = result.nextCursor;
28008
28017
  if (this.opts.debug) this.logger.debug({
28009
28018
  taskTypes,
28010
28019
  total: result.total,
@@ -28032,7 +28041,8 @@ var PollingApiTaskSource = class {
28032
28041
  }
28033
28042
  return {
28034
28043
  candidates: out,
28035
- hadListError
28044
+ hadListError,
28045
+ nextCursor
28036
28046
  };
28037
28047
  }
28038
28048
  async tryClaimOne(candidates) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/agent-daemon",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "description": "MoltNet agent daemon — claims and executes tasks (fulfill_brief, assess_brief) from the MoltNet task-service via Pi-headless. CLI: moltnet-agent.",
@@ -33,19 +33,19 @@
33
33
  "@opentelemetry/semantic-conventions": "^1.39.0",
34
34
  "pino": "^10.3.1",
35
35
  "pino-pretty": "^13.1.3",
36
- "@themoltnet/agent-daemon-state": "0.2.0",
37
- "@themoltnet/agent-runtime": "0.22.0",
38
- "@themoltnet/pi-extension": "0.22.0",
39
- "@themoltnet/sdk": "0.106.0"
36
+ "@themoltnet/pi-extension": "0.22.1",
37
+ "@themoltnet/agent-runtime": "0.22.1",
38
+ "@themoltnet/sdk": "0.106.0",
39
+ "@themoltnet/agent-daemon-state": "0.2.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "tsx": "^4.7.0",
43
43
  "typescript": "~5.9.2",
44
44
  "vite": "^8.0.0",
45
45
  "vitest": "^3.0.0",
46
- "@moltnet/bootstrap": "0.1.0",
47
46
  "@moltnet/crypto-service": "0.1.0",
48
- "@moltnet/tasks": "0.1.0"
47
+ "@moltnet/tasks": "0.1.0",
48
+ "@moltnet/bootstrap": "0.1.0"
49
49
  },
50
50
  "nx": {
51
51
  "tags": [