@kolisachint/hoocode-agent 0.5.46 → 0.5.48

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 (34) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/core/agent-session-retry.d.ts.map +1 -1
  3. package/dist/core/agent-session-retry.js +10 -1
  4. package/dist/core/agent-session-retry.js.map +1 -1
  5. package/dist/core/system-prompt.d.ts.map +1 -1
  6. package/dist/core/system-prompt.js +1 -0
  7. package/dist/core/system-prompt.js.map +1 -1
  8. package/dist/core/tools/edit-diff.d.ts +7 -3
  9. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  10. package/dist/core/tools/edit-diff.js +156 -65
  11. package/dist/core/tools/edit-diff.js.map +1 -1
  12. package/dist/core/tools/read.d.ts.map +1 -1
  13. package/dist/core/tools/read.js +5 -4
  14. package/dist/core/tools/read.js.map +1 -1
  15. package/dist/core/tools/webfetch.d.ts +3 -0
  16. package/dist/core/tools/webfetch.d.ts.map +1 -1
  17. package/dist/core/tools/webfetch.js +31 -7
  18. package/dist/core/tools/webfetch.js.map +1 -1
  19. package/dist/core/tools/webtools-shared.d.ts +12 -0
  20. package/dist/core/tools/webtools-shared.d.ts.map +1 -1
  21. package/dist/core/tools/webtools-shared.js.map +1 -1
  22. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  23. package/dist/modes/interactive/interactive-mode.js +7 -0
  24. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  25. package/dist/utils/sleep.d.ts +9 -0
  26. package/dist/utils/sleep.d.ts.map +1 -1
  27. package/dist/utils/sleep.js +11 -1
  28. package/dist/utils/sleep.js.map +1 -1
  29. package/docs/settings.md +20 -0
  30. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  31. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  32. package/examples/extensions/sandbox/package.json +1 -1
  33. package/examples/extensions/with-deps/package.json +1 -1
  34. package/package.json +4 -4
@@ -1,5 +1,14 @@
1
1
  /**
2
2
  * Sleep helper that respects abort signal.
3
+ *
4
+ * The delay is clamped, because `setTimeout` holds it in a signed 32-bit
5
+ * integer and anything larger is not rejected but silently replaced with 1ms.
6
+ * A caller that computed a long wait — a backoff, a server-requested
7
+ * retry-after — would get the shortest possible one instead, turning a pause
8
+ * into a hot loop at exactly the moment the pause mattered most. Waiting 24
9
+ * days instead of 28 is wrong too, but it is wrong in the direction that does
10
+ * no damage, and callers with a genuinely long wait should be declining to
11
+ * wait rather than sleeping through it.
3
12
  */
4
13
  export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
5
14
  //# sourceMappingURL=sleep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAcrE","sourcesContent":["/**\n * Sleep helper that respects abort signal.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new Error(\"Aborted\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeout = setTimeout(resolve, ms);\n\n\t\tsignal?.addEventListener(\"abort\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(new Error(\"Aborted\"));\n\t\t});\n\t});\n}\n"]}
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAcrE","sourcesContent":["import { MAX_TIMER_DELAY_MS } from \"@kolisachint/hoocode-ai\";\n\n/**\n * Sleep helper that respects abort signal.\n *\n * The delay is clamped, because `setTimeout` holds it in a signed 32-bit\n * integer and anything larger is not rejected but silently replaced with 1ms.\n * A caller that computed a long wait — a backoff, a server-requested\n * retry-after — would get the shortest possible one instead, turning a pause\n * into a hot loop at exactly the moment the pause mattered most. Waiting 24\n * days instead of 28 is wrong too, but it is wrong in the direction that does\n * no damage, and callers with a genuinely long wait should be declining to\n * wait rather than sleeping through it.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new Error(\"Aborted\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeout = setTimeout(resolve, Math.min(Math.max(0, ms), MAX_TIMER_DELAY_MS));\n\n\t\tsignal?.addEventListener(\"abort\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(new Error(\"Aborted\"));\n\t\t});\n\t});\n}\n"]}
@@ -1,5 +1,15 @@
1
+ import { MAX_TIMER_DELAY_MS } from "@kolisachint/hoocode-ai";
1
2
  /**
2
3
  * Sleep helper that respects abort signal.
4
+ *
5
+ * The delay is clamped, because `setTimeout` holds it in a signed 32-bit
6
+ * integer and anything larger is not rejected but silently replaced with 1ms.
7
+ * A caller that computed a long wait — a backoff, a server-requested
8
+ * retry-after — would get the shortest possible one instead, turning a pause
9
+ * into a hot loop at exactly the moment the pause mattered most. Waiting 24
10
+ * days instead of 28 is wrong too, but it is wrong in the direction that does
11
+ * no damage, and callers with a genuinely long wait should be declining to
12
+ * wait rather than sleeping through it.
3
13
  */
4
14
  export function sleep(ms, signal) {
5
15
  return new Promise((resolve, reject) => {
@@ -7,7 +17,7 @@ export function sleep(ms, signal) {
7
17
  reject(new Error("Aborted"));
8
18
  return;
9
19
  }
10
- const timeout = setTimeout(resolve, ms);
20
+ const timeout = setTimeout(resolve, Math.min(Math.max(0, ms), MAX_TIMER_DELAY_MS));
11
21
  signal?.addEventListener("abort", () => {
12
22
  clearTimeout(timeout);
13
23
  reject(new Error("Aborted"));
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB,EAAiB;IACtE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;QACvC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC7B,OAAO;QACR,CAAC;QAED,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAExC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC;YACvC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAAA,CAC7B,CAAC,CAAC;IAAA,CACH,CAAC,CAAC;AAAA,CACH","sourcesContent":["/**\n * Sleep helper that respects abort signal.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new Error(\"Aborted\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeout = setTimeout(resolve, ms);\n\n\t\tsignal?.addEventListener(\"abort\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(new Error(\"Aborted\"));\n\t\t});\n\t});\n}\n"]}
1
+ {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB,EAAiB;IACtE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;QACvC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC7B,OAAO;QACR,CAAC;QAED,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAEnF,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC;YACvC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAAA,CAC7B,CAAC,CAAC;IAAA,CACH,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { MAX_TIMER_DELAY_MS } from \"@kolisachint/hoocode-ai\";\n\n/**\n * Sleep helper that respects abort signal.\n *\n * The delay is clamped, because `setTimeout` holds it in a signed 32-bit\n * integer and anything larger is not rejected but silently replaced with 1ms.\n * A caller that computed a long wait — a backoff, a server-requested\n * retry-after — would get the shortest possible one instead, turning a pause\n * into a hot loop at exactly the moment the pause mattered most. Waiting 24\n * days instead of 28 is wrong too, but it is wrong in the direction that does\n * no damage, and callers with a genuinely long wait should be declining to\n * wait rather than sleeping through it.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new Error(\"Aborted\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeout = setTimeout(resolve, Math.min(Math.max(0, ms), MAX_TIMER_DELAY_MS));\n\n\t\tsignal?.addEventListener(\"abort\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(new Error(\"Aborted\"));\n\t\t});\n\t});\n}\n"]}
package/docs/settings.md CHANGED
@@ -371,6 +371,26 @@ Needs a `webtools` binary that supports `--outline` (v0.5.0 or newer). An older
371
371
  one rejects the flag, and hoocode reports that the binary needs updating rather
372
372
  than passing the parser message through.
373
373
 
374
+ #### Finding a mention on a long page
375
+
376
+ An outline helps when the page has headings and one names what you are after.
377
+ `webfetch(url, grep: "pattern")` covers the rest — where does this page mention
378
+ a thing, on a document whose headings do not say, or that has none:
379
+
380
+ ```
381
+ offset 512 in "Configuration" (+2 nearby) — …the rate limit defaults to sixty…
382
+ Read a match by fetching it at the offset shown.
383
+ ```
384
+
385
+ Match offsets are the offsets `offset` reads, like outline offsets, so a hit is
386
+ read by fetching at it. The pattern is a regular expression, case-insensitive
387
+ unless it carries an uppercase letter. Occurrences close together collapse into
388
+ one hit carrying a count, so a term repeated through a paragraph is one result
389
+ rather than eight near-identical ones.
390
+
391
+ `outline` and `grep` are alternatives, not a pair: asking for both is rejected
392
+ before a subprocess is spawned. Needs `webtools` v0.6.0 or newer.
393
+
374
394
  #### Reading a long page
375
395
 
376
396
  `webfetch` budgets its output in tokens (`maxTokens`, default 4000, hard cap
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.3.46",
4
+ "version": "0.3.48",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.3.46",
4
+ "version": "0.3.48",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.3.46",
4
+ "version": "0.3.48",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.3.46",
4
+ "version": "0.3.48",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "bun": ">=1.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolisachint/hoocode-agent",
3
- "version": "0.5.46",
3
+ "version": "0.5.48",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "hoocodeConfig": {
@@ -50,9 +50,9 @@
50
50
  "prepublishOnly": "npm run clean && npm run build"
51
51
  },
52
52
  "dependencies": {
53
- "@kolisachint/hoocode-agent-core": "^0.5.46",
54
- "@kolisachint/hoocode-ai": "^0.5.46",
55
- "@kolisachint/hoocode-tui": "^0.5.46",
53
+ "@kolisachint/hoocode-agent-core": "^0.5.48",
54
+ "@kolisachint/hoocode-ai": "^0.5.48",
55
+ "@kolisachint/hoocode-tui": "^0.5.48",
56
56
  "@silvia-odwyer/photon-node": "^0.3.4",
57
57
  "chalk": "^5.5.0",
58
58
  "cli-highlight": "^2.1.11",