@strayl/agent 0.1.13 → 0.1.15

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/agent.js CHANGED
@@ -13549,8 +13549,6 @@ async function runAgent(config) {
13549
13549
  const maxIterations = config.maxIterations ?? 200;
13550
13550
  let consecutiveLLMErrors = 0;
13551
13551
  const MAX_CONSECUTIVE_LLM_ERRORS = 5;
13552
- let consecutiveNoToolCalls = 0;
13553
- const MAX_NO_TOOL_RETRIES = 3;
13554
13552
  if (config.restoreCheckpoint) {
13555
13553
  const cp = config.restoreCheckpoint;
13556
13554
  context.restoreMessages(cp.messages);
@@ -13695,7 +13693,9 @@ ${IMPLEMENTATION_MODE_PROMPT2}`);
13695
13693
  emitter.emit({ type: "error", message: `LLM failed ${consecutiveLLMErrors} times in a row: ${msg}`, recoverable: false });
13696
13694
  break;
13697
13695
  }
13698
- emitter.emit({ type: "error", message: `LLM error (${consecutiveLLMErrors}/${MAX_CONSECUTIVE_LLM_ERRORS}): ${msg}`, recoverable: true });
13696
+ const backoffMs = Math.min(2e3 * Math.pow(2, consecutiveLLMErrors - 1), 16e3);
13697
+ emitter.emit({ type: "error", message: `LLM error (${consecutiveLLMErrors}/${MAX_CONSECUTIVE_LLM_ERRORS}): ${msg} \u2014 retrying in ${backoffMs / 1e3}s`, recoverable: true });
13698
+ await new Promise((r) => setTimeout(r, backoffMs));
13699
13699
  context.addAssistant(`[Error communicating with model: ${msg}]`);
13700
13700
  continue;
13701
13701
  }
@@ -13723,15 +13723,7 @@ ${IMPLEMENTATION_MODE_PROMPT2}`);
13723
13723
  context_left_percent: leftPercent
13724
13724
  });
13725
13725
  }
13726
- if (completedToolCalls.length === 0) {
13727
- consecutiveNoToolCalls++;
13728
- if (consecutiveNoToolCalls >= MAX_NO_TOOL_RETRIES) break;
13729
- context.addUser(
13730
- "[System] You output text without calling any tools. Do not think out loud \u2014 use your tools to take action. If you need to communicate with the user, call the askUser tool. If you need to create a plan, call the writePlan tool. Continue working on the task."
13731
- );
13732
- continue;
13733
- }
13734
- consecutiveNoToolCalls = 0;
13726
+ if (completedToolCalls.length === 0) break;
13735
13727
  for (const tc of completedToolCalls) {
13736
13728
  if (stdin.isCancelled()) {
13737
13729
  context.addToolResult(tc.id, tc.function.name, JSON.stringify({ error: "Cancelled by user." }));
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
- {
2
- "name": "@strayl/agent",
3
- "version": "0.1.13",
4
- "type": "module",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "main": "dist/index.js",
9
- "files": [
10
- "dist",
11
- "skills"
12
- ],
13
- "scripts": {
14
- "build": "esbuild src/index.ts --bundle --platform=node --target=node20 --format=esm --outfile=dist/agent.js --external:fsevents",
15
- "dev": "tsx watch src/index.ts"
16
- },
17
- "dependencies": {
18
- "openai": "^5.8.0",
19
- "zod": "^3.25.67"
20
- },
21
- "devDependencies": {
22
- "esbuild": "^0.25.5",
23
- "tsx": "^4.19.4",
24
- "typescript": "^5.8.3",
25
- "@types/node": "^22.15.31"
26
- }
27
- }
1
+ {
2
+ "name": "@strayl/agent",
3
+ "version": "0.1.15",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "dist/index.js",
9
+ "files": [
10
+ "dist",
11
+ "skills"
12
+ ],
13
+ "scripts": {
14
+ "build": "esbuild src/index.ts --bundle --platform=node --target=node20 --format=esm --outfile=dist/agent.js --external:fsevents",
15
+ "dev": "tsx watch src/index.ts"
16
+ },
17
+ "dependencies": {
18
+ "openai": "^5.8.0",
19
+ "zod": "^3.25.67"
20
+ },
21
+ "devDependencies": {
22
+ "esbuild": "^0.25.5",
23
+ "tsx": "^4.19.4",
24
+ "typescript": "^5.8.3",
25
+ "@types/node": "^22.15.31"
26
+ }
27
+ }