0agent 1.0.86 → 1.0.88

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/daemon.mjs +54 -19
  2. package/package.json +1 -1
package/dist/daemon.mjs CHANGED
@@ -6441,16 +6441,46 @@ content = element.text if element else page.get_all_text()` : `content = page.ge
6441
6441
  if (isCodingTask) {
6442
6442
  lines.push(
6443
6443
  ``,
6444
- `\u2550\u2550\u2550 CODING DISCIPLINE \u2550\u2550\u2550`,
6445
- `Read before write. Always read a file before modifying it. Never write code in a vacuum.`,
6446
- `Incremental loop: make one logical change \u2192 run relevant tests \u2192 fix failures \u2192 repeat.`,
6447
- `Do not write 500 lines and then test. Write 50 lines, test, fix, continue.`,
6448
- `Keep functions under 40 lines. If a function grows past that, extract a helper.`,
6449
- `No TODO comments in committed code. Either implement it now or leave it out entirely.`,
6450
- `Match the codebase exactly: naming, indentation, import style, error handling patterns.`,
6451
- `Test alongside code. Non-trivial logic gets a test. Tests verify behavior, not implementation.`,
6452
- `After completing any coding task: write a concise HTML summary of what was built/changed,`,
6453
- `then call surge_publish to get a live shareable link. Include that link in your response.`
6444
+ `\u2550\u2550\u2550 CODING DISCIPLINE (Claude Code level) \u2550\u2550\u2550`,
6445
+ `You are an expert software engineer. Write production-quality code. Follow these rules precisely:`,
6446
+ ``,
6447
+ `EXPLORATION:`,
6448
+ ` 1. Read before write. ALWAYS read a file before modifying it. Understand the codebase first.`,
6449
+ ` 2. Search broadly: use shell_exec with rg/grep to find related files, imports, callers, tests.`,
6450
+ ` 3. Read the test file for any module you're changing. Understand expected behavior.`,
6451
+ ` 4. Read package.json/tsconfig/config files to understand the project setup.`,
6452
+ ``,
6453
+ `EDITING:`,
6454
+ ` 5. Use file_op(op:"edit") for surgical changes. Never rewrite entire files.`,
6455
+ ` 6. Each edit must be a minimal, precise find-and-replace. Include enough context to be unique.`,
6456
+ ` 7. When creating new files, follow existing patterns EXACTLY: naming, exports, imports, structure.`,
6457
+ ` 8. Match the codebase: tabs vs spaces, semicolons, quote style, import order, error handling.`,
6458
+ ``,
6459
+ `IMPLEMENTATION:`,
6460
+ ` 9. Incremental loop: one logical change \u2192 run tests \u2192 fix failures \u2192 commit \u2192 next change.`,
6461
+ ` 10. Keep functions under 40 lines. Extract helpers when complexity grows.`,
6462
+ ` 11. No TODO comments in committed code. Implement it or leave it out.`,
6463
+ ` 12. Handle errors properly. No empty catch {}. No swallowed promises. Propagate with context.`,
6464
+ ` 13. Validate at system boundaries (user input, API responses). Trust internal code.`,
6465
+ ` 14. Don't add features beyond what was asked. A bug fix doesn't need surrounding cleanup.`,
6466
+ ``,
6467
+ `TESTING:`,
6468
+ ` 15. Run the FULL test suite before declaring done, not just your new tests.`,
6469
+ ` 16. Write tests for non-trivial logic. Tests verify behavior, not implementation.`,
6470
+ ` 17. If tests fail, READ the error. Diagnose. Don't blindly retry or change random things.`,
6471
+ ``,
6472
+ `GIT:`,
6473
+ ` 18. Each commit = one logical change. Clear message explaining WHY, not just WHAT.`,
6474
+ ` 19. Never amend unless asked. Never force-push. Never skip hooks.`,
6475
+ ` 20. Stage specific files, not git add -A (avoid committing .env, credentials, binaries).`,
6476
+ ``,
6477
+ `SECURITY:`,
6478
+ ` 21. No command injection, XSS, SQL injection, path traversal, or OWASP top 10.`,
6479
+ ` 22. Sanitize user input at boundaries. Use parameterized queries. Escape shell args.`,
6480
+ ` 23. Never log passwords, tokens, or secrets. Never commit them to git.`,
6481
+ ``,
6482
+ `OUTPUT: After completing, publish an HTML summary via surge_publish if the user would benefit`,
6483
+ `from a shareable artifact. Include the live link in your response.`
6454
6484
  );
6455
6485
  }
6456
6486
  if (isJustdoTask) {
@@ -7875,9 +7905,7 @@ var COMPLEX_PATTERNS = [
7875
7905
  var SIMPLE_PATTERNS = [
7876
7906
  /^(hey|hi|hello|sup|yo|hola|namaste|what'?s?\s*up|how\s+are\s+you)[!?.\s,]*$/i,
7877
7907
  /^(thanks|thank\s+you|thx|ok|okay|cool|great|nice|perfect|got\s+it|sure|yep|yeah|yes|no|nah)[!?.\s,]*$/i,
7878
- /^(bye|goodbye|see\s+ya|later|good\s*(morning|evening|afternoon|night))[!?.\s,]*$/i,
7879
- /^(what\s+is|who\s+is|when\s+was|where\s+is|how\s+do\s+you|what\s+does|can\s+you)\b.{0,80}$/i,
7880
- /^(tell\s+me\s+about|summarize|summarise|tldr|tl;dr)\b.{0,80}$/i
7908
+ /^(bye|goodbye|see\s+ya|later|good\s*(morning|evening|afternoon|night))[!?.\s,]*$/i
7881
7909
  ];
7882
7910
  function routeMessage(task) {
7883
7911
  const trimmed = task.trim();
@@ -7901,7 +7929,7 @@ function routeMessage(task) {
7901
7929
  if (sentences.length > 2) {
7902
7930
  return { decision: "primary", reason: "multi-sentence request" };
7903
7931
  }
7904
- return { decision: "fast", reason: "short message, no complex indicators" };
7932
+ return { decision: "primary", reason: "unrecognized message \u2014 using full agent" };
7905
7933
  }
7906
7934
  function getFastModelId(provider, _currentModel) {
7907
7935
  switch (provider) {
@@ -11113,10 +11141,12 @@ var TelegramAdapter = class {
11113
11141
  try {
11114
11142
  const updates = await this._getUpdates();
11115
11143
  for (const u of updates) {
11116
- await this._handleUpdate(u).catch(() => {
11144
+ await this._handleUpdate(u).catch((err) => {
11145
+ console.error("[telegram] Error handling update:", err instanceof Error ? err.message : err);
11117
11146
  });
11118
11147
  }
11119
- } catch {
11148
+ } catch (err) {
11149
+ console.error("[telegram] Poll error:", err instanceof Error ? err.message : err);
11120
11150
  }
11121
11151
  if (this.running) {
11122
11152
  this.pollTimer = setTimeout(() => this._poll(), 1e3);
@@ -11183,8 +11213,8 @@ Sessions: ${h.active_sessions} active`
11183
11213
  const sessionId = this.activeSessions.get(chatId);
11184
11214
  if (sessionId) {
11185
11215
  try {
11186
- await fetch(`${this.daemonUrl}/api/sessions/${sessionId}/cancel`, {
11187
- method: "POST",
11216
+ await fetch(`${this.daemonUrl}/api/sessions/${sessionId}`, {
11217
+ method: "DELETE",
11188
11218
  signal: AbortSignal.timeout(3e3)
11189
11219
  });
11190
11220
  await this._sendMessage(chatId, "\u{1F6D1} Task cancelled.");
@@ -11224,7 +11254,12 @@ Sessions: ${h.active_sessions} active`
11224
11254
  await this._dispatchTask(chatId, userId, userName, text, msg);
11225
11255
  }
11226
11256
  async _dispatchTask(chatId, userId, userName, text, msg) {
11227
- if (!this.messageHandler) return;
11257
+ if (!this.messageHandler) {
11258
+ console.error("[telegram] No messageHandler set \u2014 SurfaceRouter may not have registered this adapter");
11259
+ await this._sendMessage(chatId, "\u26A0\uFE0F Agent not ready. Try again in a few seconds.");
11260
+ return;
11261
+ }
11262
+ console.log(`[telegram] Dispatching: "${text.slice(0, 60)}" from ${userName} (chat ${chatId})`);
11228
11263
  const inbound = {
11229
11264
  surface: "telegram",
11230
11265
  surface_user_id: String(userId),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0agent",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "description": "A persistent, learning AI agent that runs on your machine. An agent that learns.",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",