jeopi-cli 16.4.1 → 16.4.3

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 (125) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/cli.js +3179 -3140
  3. package/dist/types/advisor/config.d.ts +4 -3
  4. package/dist/types/cli/args.d.ts +2 -0
  5. package/dist/types/cli/update-cli.d.ts +4 -1
  6. package/dist/types/cli/usage-error.d.ts +4 -0
  7. package/dist/types/commit/agentic/agent.d.ts +1 -0
  8. package/dist/types/config/model-resolver.d.ts +7 -1
  9. package/dist/types/config/settings-schema.d.ts +3 -3
  10. package/dist/types/eval/py/tool-bridge.d.ts +1 -0
  11. package/dist/types/extensibility/custom-tools/types.d.ts +3 -0
  12. package/dist/types/extensibility/extensions/runner.d.ts +3 -1
  13. package/dist/types/extensibility/extensions/types.d.ts +3 -0
  14. package/dist/types/internal-urls/memory-protocol.d.ts +6 -6
  15. package/dist/types/internal-urls/types.d.ts +7 -0
  16. package/dist/types/irc/bus.d.ts +4 -0
  17. package/dist/types/lsp/deferred-diagnostics.d.ts +11 -0
  18. package/dist/types/modes/components/move-overlay.d.ts +1 -1
  19. package/dist/types/modes/components/plan-review-overlay.d.ts +2 -0
  20. package/dist/types/modes/components/welcome.d.ts +4 -0
  21. package/dist/types/modes/magic-keyword-boundary.d.ts +9 -0
  22. package/dist/types/modes/orchestrate.d.ts +1 -1
  23. package/dist/types/modes/ultrathink.d.ts +1 -1
  24. package/dist/types/modes/workflow.d.ts +1 -1
  25. package/dist/types/session/agent-session.d.ts +5 -0
  26. package/dist/types/session/auth-broker-config.d.ts +2 -2
  27. package/dist/types/tools/bash-skill-urls.d.ts +3 -2
  28. package/dist/types/tools/browser/cmux/cmux-tab.d.ts +3 -1
  29. package/dist/types/tools/browser/cmux/rpc.d.ts +20 -0
  30. package/dist/types/tools/browser/launch.d.ts +1 -0
  31. package/dist/types/tools/browser/run-cancellation.d.ts +17 -2
  32. package/dist/types/tools/browser/run-output.d.ts +25 -0
  33. package/dist/types/tools/browser/tab-worker.d.ts +22 -0
  34. package/dist/types/utils/changelog.d.ts +35 -1
  35. package/package.json +12 -12
  36. package/src/advisor/__tests__/advisor.test.ts +13 -0
  37. package/src/advisor/__tests__/config.test.ts +36 -0
  38. package/src/advisor/config.ts +11 -8
  39. package/src/autolearn/controller.ts +14 -2
  40. package/src/cli/args.ts +12 -0
  41. package/src/cli/flag-tables.ts +21 -7
  42. package/src/cli/update-cli.ts +63 -13
  43. package/src/cli/usage-error.ts +7 -0
  44. package/src/commands/acp.ts +11 -2
  45. package/src/commands/launch.ts +12 -3
  46. package/src/commit/agentic/agent.ts +4 -0
  47. package/src/commit/agentic/index.ts +46 -21
  48. package/src/config/model-resolver.ts +24 -6
  49. package/src/config/settings-schema.ts +3 -3
  50. package/src/edit/index.ts +10 -76
  51. package/src/edit/renderer.ts +13 -10
  52. package/src/eval/__tests__/agent-bridge.test.ts +19 -14
  53. package/src/eval/__tests__/bridge-timeout.test.ts +60 -0
  54. package/src/eval/executor-base.ts +84 -7
  55. package/src/eval/js/shared/rewrite-imports.ts +31 -13
  56. package/src/eval/py/tool-bridge.ts +13 -14
  57. package/src/exec/non-interactive-env.ts +0 -1
  58. package/src/export/ttsr.ts +0 -3
  59. package/src/extensibility/custom-tools/loader.ts +70 -37
  60. package/src/extensibility/custom-tools/types.ts +3 -0
  61. package/src/extensibility/extensions/runner.ts +3 -0
  62. package/src/extensibility/extensions/types.ts +3 -0
  63. package/src/extensibility/plugins/manager.ts +21 -0
  64. package/src/internal-urls/docs-index.generated.txt +1 -1
  65. package/src/internal-urls/memory-protocol.ts +13 -8
  66. package/src/internal-urls/skill-protocol.ts +1 -1
  67. package/src/internal-urls/types.ts +7 -0
  68. package/src/irc/bus.ts +48 -18
  69. package/src/lsp/client.ts +7 -1
  70. package/src/lsp/deferred-diagnostics.ts +66 -0
  71. package/src/main.ts +13 -13
  72. package/src/mcp/tool-bridge.ts +57 -6
  73. package/src/mcp/transports/stdio.test.ts +45 -1
  74. package/src/mcp/transports/stdio.ts +6 -3
  75. package/src/modes/acp/acp-agent.ts +73 -2
  76. package/src/modes/acp/acp-event-mapper.ts +5 -0
  77. package/src/modes/acp/acp-mode.ts +11 -0
  78. package/src/modes/components/__tests__/move-overlay.test.ts +16 -1
  79. package/src/modes/components/advisor-config.ts +15 -7
  80. package/src/modes/components/move-overlay.ts +2 -3
  81. package/src/modes/components/plan-review-overlay.ts +7 -0
  82. package/src/modes/components/tips.txt +1 -1
  83. package/src/modes/components/welcome.ts +13 -14
  84. package/src/modes/controllers/command-controller.ts +8 -10
  85. package/src/modes/controllers/event-controller.ts +17 -30
  86. package/src/modes/controllers/input-controller.ts +9 -6
  87. package/src/modes/controllers/selector-controller.ts +3 -2
  88. package/src/modes/controllers/tan-command-controller.ts +40 -1
  89. package/src/modes/interactive-mode.ts +13 -0
  90. package/src/modes/magic-keyword-boundary.ts +23 -0
  91. package/src/modes/orchestrate.ts +6 -5
  92. package/src/modes/print-mode.ts +9 -0
  93. package/src/modes/ultrathink.ts +6 -5
  94. package/src/modes/workflow.ts +5 -4
  95. package/src/prompts/system/eager-task.md +2 -2
  96. package/src/prompts/system/tan-context-switch.md +17 -0
  97. package/src/prompts/tools/browser.md +5 -5
  98. package/src/sdk.ts +3 -0
  99. package/src/session/agent-session.ts +237 -50
  100. package/src/session/auth-broker-config.ts +4 -4
  101. package/src/session/snapcompact-inline.ts +3 -19
  102. package/src/session/streaming-output.ts +40 -12
  103. package/src/slash-commands/builtin-registry.ts +8 -8
  104. package/src/task/executor.ts +8 -0
  105. package/src/tools/bash-skill-urls.ts +7 -4
  106. package/src/tools/bash.ts +30 -22
  107. package/src/tools/browser/cmux/cmux-tab.ts +49 -50
  108. package/src/tools/browser/cmux/rpc.ts +50 -0
  109. package/src/tools/browser/launch.ts +8 -4
  110. package/src/tools/browser/run-cancellation.ts +44 -5
  111. package/src/tools/browser/run-output.ts +76 -0
  112. package/src/tools/browser/tab-worker.ts +280 -133
  113. package/src/tools/eval-render.ts +16 -14
  114. package/src/tools/glob.ts +20 -6
  115. package/src/tools/grep.ts +1 -0
  116. package/src/tools/image-gen.ts +3 -4
  117. package/src/tools/irc.ts +27 -13
  118. package/src/tools/read.ts +14 -7
  119. package/src/tools/write.ts +22 -5
  120. package/src/tools/yield.ts +29 -1
  121. package/src/utils/changelog.ts +106 -9
  122. package/src/utils/git.ts +0 -1
  123. package/src/utils/title-generator.ts +68 -7
  124. package/src/web/search/index.ts +14 -6
  125. package/src/web/search/providers/perplexity.ts +18 -2
@@ -1,11 +1,50 @@
1
1
  import { untilAborted } from "jeopi-utils";
2
- import { throwIfAborted } from "../tool-errors";
2
+ import { ToolError, throwIfAborted } from "../tool-errors";
3
3
 
4
- /** Sleeps inside evaluated browser code while honoring the owning run's cancellation signal. */
5
- export async function waitForBrowserRun(ms: number, signal: AbortSignal): Promise<void> {
6
- throwIfAborted(signal);
7
- await untilAborted(signal, () => Bun.sleep(ms));
4
+ /** Options for the predicate form of the run-scoped `wait()` helper. */
5
+ export interface WaitPredicateOptions {
6
+ /** Max time to poll before failing, in ms (default 30_000). */
7
+ timeout?: number;
8
+ /** Poll interval in ms (default 100, floor 10). */
9
+ interval?: number;
10
+ }
11
+
12
+ /**
13
+ * Run-scoped `wait()` helper for evaluated browser code, honoring the owning run's
14
+ * cancellation signal.
15
+ *
16
+ * - `wait(ms)` sleeps for `ms` milliseconds.
17
+ * - `wait(fn, { timeout?, interval? })` polls `fn` (sync or async) until it returns a
18
+ * truthy value and resolves with that value; throws a named `ToolError` on timeout
19
+ * instead of stalling into the whole-cell deadline. Predicate errors propagate.
20
+ */
21
+ export async function waitForBrowserRun(
22
+ msOrPredicate: number | (() => unknown),
23
+ signal: AbortSignal,
24
+ opts?: WaitPredicateOptions,
25
+ ): Promise<unknown> {
8
26
  throwIfAborted(signal);
27
+ if (typeof msOrPredicate === "number") {
28
+ await untilAborted(signal, async () => await Bun.sleep(msOrPredicate));
29
+ throwIfAborted(signal);
30
+ return undefined;
31
+ }
32
+ if (typeof msOrPredicate !== "function") {
33
+ throw new ToolError("wait(...) expects milliseconds (number) or a predicate function to poll");
34
+ }
35
+ const timeout =
36
+ opts?.timeout !== undefined && Number.isFinite(opts.timeout) && opts.timeout > 0 ? opts.timeout : 30_000;
37
+ const interval = Math.max(opts?.interval ?? 100, 10);
38
+ const deadline = Date.now() + timeout;
39
+ for (;;) {
40
+ const value = await untilAborted(signal, async () => await msOrPredicate());
41
+ throwIfAborted(signal);
42
+ if (value) return value;
43
+ if (Date.now() + interval > deadline) {
44
+ throw new ToolError(`wait(predicate) timed out after ${timeout}ms — predicate never returned truthy`);
45
+ }
46
+ await untilAborted(signal, async () => await Bun.sleep(interval));
47
+ }
9
48
  }
10
49
 
11
50
  /** Binds a long-lived browser facade to one evaluated run's abort signal. */
@@ -0,0 +1,76 @@
1
+ import type { ImageContent, TextContent } from "jeopi-ai";
2
+ import type { JsDisplayOutput } from "../../eval/js/shared/types";
3
+
4
+ /**
5
+ * Accumulates a browser run's result entries: explicit `display()` payloads,
6
+ * screenshot captions/images, and buffered stream text (`console.*`, `print`,
7
+ * `display()` of strings/primitives — `JsRuntime.displayValue` emits those via
8
+ * `onText`). Stream text is buffered and flushed as one entry before the next
9
+ * display/screenshot (and on `finish()`) so it reaches the tool result in
10
+ * order instead of vanishing into the debug log.
11
+ */
12
+ export class RunOutput {
13
+ readonly #displays: Array<TextContent | ImageContent> = [];
14
+ #textBuffer = "";
15
+
16
+ /** Buffer a stream-text chunk; it joins the entries at the next push or on finish(). */
17
+ pushText(chunk: string): void {
18
+ this.#textBuffer += chunk;
19
+ }
20
+
21
+ /** Append a `display()` payload (image/json/status), flushing buffered text first. */
22
+ pushDisplay(output: JsDisplayOutput): void {
23
+ if (output.type === "image") {
24
+ this.push({ type: "image", data: output.data, mimeType: output.mimeType });
25
+ return;
26
+ }
27
+ if (output.type === "json") {
28
+ this.push({ type: "text", text: safeJsonStringify(output.data) });
29
+ return;
30
+ }
31
+ // status — surface as compact JSON so helper side effects (read/write/env) appear in
32
+ // the cell result alongside explicit display() output.
33
+ this.push({ type: "text", text: safeJsonStringify(output.event) });
34
+ }
35
+
36
+ /** Append a pre-built entry (e.g. a screenshot caption/image), flushing buffered text first. */
37
+ push(entry: TextContent | ImageContent): void {
38
+ this.#flush();
39
+ this.#displays.push(entry);
40
+ }
41
+
42
+ /** Flush any remaining stream text and return the ordered entries. */
43
+ finish(): Array<TextContent | ImageContent> {
44
+ this.#flush();
45
+ return this.#displays;
46
+ }
47
+
48
+ #flush(): void {
49
+ if (!this.#textBuffer) return;
50
+ // Entries are newline-joined at render; drop the stream's trailing newline.
51
+ this.#displays.push({ type: "text", text: this.#textBuffer.replace(/\n$/, "") });
52
+ this.#textBuffer = "";
53
+ }
54
+ }
55
+
56
+ /** JSON.stringify that never throws (cycles/BigInt → String(value)). */
57
+ export function safeJsonStringify(value: unknown): string {
58
+ try {
59
+ return JSON.stringify(value, null, 2);
60
+ } catch {
61
+ return String(value);
62
+ }
63
+ }
64
+
65
+ /** Pass a return value across the run boundary: structured-cloneable as-is, else JSON round-trip, else String. */
66
+ export function cloneSafe(value: unknown): unknown {
67
+ if (value === undefined) return undefined;
68
+ try {
69
+ structuredClone(value);
70
+ return value;
71
+ } catch {}
72
+ try {
73
+ return JSON.parse(JSON.stringify(value)) as unknown;
74
+ } catch {}
75
+ return String(value);
76
+ }