@oh-my-pi/pi-coding-agent 14.5.11 → 14.5.13

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 (89) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/package.json +18 -10
  3. package/src/cli/jupyter-cli.ts +1 -1
  4. package/src/config/model-equivalence.ts +49 -16
  5. package/src/config/model-registry.ts +100 -25
  6. package/src/config/model-resolver.ts +29 -15
  7. package/src/config/settings-schema.ts +20 -6
  8. package/src/config/settings.ts +9 -8
  9. package/src/config.ts +9 -0
  10. package/src/eval/backend.ts +43 -0
  11. package/src/eval/eval.lark +43 -0
  12. package/src/eval/index.ts +5 -0
  13. package/src/eval/js/context-manager.ts +717 -0
  14. package/src/eval/js/executor.ts +131 -0
  15. package/src/eval/js/index.ts +46 -0
  16. package/src/eval/js/prelude.ts +2 -0
  17. package/src/eval/js/prelude.txt +84 -0
  18. package/src/eval/js/tool-bridge.ts +124 -0
  19. package/src/eval/parse.ts +337 -0
  20. package/src/{ipy → eval/py}/executor.ts +2 -180
  21. package/src/{ipy → eval/py}/gateway-coordinator.ts +4 -3
  22. package/src/eval/py/index.ts +58 -0
  23. package/src/{ipy → eval/py}/kernel.ts +5 -41
  24. package/src/{ipy → eval/py}/prelude.py +39 -227
  25. package/src/eval/types.ts +48 -0
  26. package/src/export/html/template.generated.ts +1 -1
  27. package/src/export/html/template.js +23 -17
  28. package/src/extensibility/extensions/types.ts +2 -3
  29. package/src/internal-urls/docs-index.generated.ts +5 -5
  30. package/src/lsp/client.ts +9 -0
  31. package/src/lsp/index.ts +395 -0
  32. package/src/lsp/types.ts +15 -4
  33. package/src/main.ts +25 -14
  34. package/src/mcp/oauth-flow.ts +1 -1
  35. package/src/memories/index.ts +1 -1
  36. package/src/modes/acp/acp-event-mapper.ts +1 -1
  37. package/src/modes/components/{python-execution.ts → eval-execution.ts} +11 -4
  38. package/src/modes/components/login-dialog.ts +1 -1
  39. package/src/modes/components/oauth-selector.ts +2 -1
  40. package/src/modes/components/tool-execution.ts +3 -4
  41. package/src/modes/controllers/command-controller.ts +28 -8
  42. package/src/modes/controllers/input-controller.ts +4 -4
  43. package/src/modes/controllers/selector-controller.ts +2 -1
  44. package/src/modes/interactive-mode.ts +4 -5
  45. package/src/modes/types.ts +3 -3
  46. package/src/modes/utils/ui-helpers.ts +2 -2
  47. package/src/prompts/system/system-prompt.md +3 -3
  48. package/src/prompts/tools/atom.md +3 -2
  49. package/src/prompts/tools/browser.md +61 -16
  50. package/src/prompts/tools/eval.md +92 -0
  51. package/src/prompts/tools/lsp.md +7 -3
  52. package/src/sdk.ts +45 -31
  53. package/src/session/agent-session.ts +44 -54
  54. package/src/session/messages.ts +1 -1
  55. package/src/slash-commands/builtin-registry.ts +1 -1
  56. package/src/system-prompt.ts +34 -66
  57. package/src/task/executor.ts +5 -9
  58. package/src/tools/browser/attach.ts +175 -0
  59. package/src/tools/browser/launch.ts +576 -0
  60. package/src/tools/browser/readable.ts +90 -0
  61. package/src/tools/browser/registry.ts +198 -0
  62. package/src/tools/browser/render.ts +212 -0
  63. package/src/tools/browser/tab-protocol.ts +101 -0
  64. package/src/tools/browser/tab-supervisor.ts +429 -0
  65. package/src/tools/browser/tab-worker-entry.ts +21 -0
  66. package/src/tools/browser/tab-worker.ts +1006 -0
  67. package/src/tools/browser.ts +231 -1567
  68. package/src/tools/checkpoint.ts +2 -2
  69. package/src/tools/{python.ts → eval.ts} +324 -315
  70. package/src/tools/exit-plan-mode.ts +1 -1
  71. package/src/tools/index.ts +62 -100
  72. package/src/tools/plan-mode-guard.ts +27 -1
  73. package/src/tools/read.ts +0 -6
  74. package/src/tools/recipe/runners/pkg.ts +34 -32
  75. package/src/tools/renderers.ts +4 -2
  76. package/src/tools/resolve.ts +7 -2
  77. package/src/tools/todo-write.ts +0 -1
  78. package/src/tools/tool-timeouts.ts +2 -2
  79. package/src/utils/markit.ts +15 -7
  80. package/src/utils/tools-manager.ts +5 -5
  81. package/src/web/search/index.ts +5 -5
  82. package/src/web/search/provider.ts +121 -39
  83. package/src/web/search/providers/gemini.ts +2 -2
  84. package/src/web/search/render.ts +2 -2
  85. package/src/ipy/modules.ts +0 -144
  86. package/src/prompts/tools/python.md +0 -57
  87. /package/src/{ipy → eval/py}/cancellation.ts +0 -0
  88. /package/src/{ipy → eval/py}/prelude.ts +0 -0
  89. /package/src/{ipy → eval/py}/runtime.ts +0 -0
@@ -779,23 +779,21 @@
779
779
  }
780
780
 
781
781
  function renderJsLike(name, args, result, ctx) {
782
- const lang = name === 'python' ? 'python' : 'javascript';
783
- const badges = [];
784
- if (args.cwd) badges.push('cwd=' + shortenPath(String(args.cwd)));
785
- if (args.timeout) badges.push('timeout=' + args.timeout + 's');
786
- if (args.reset) badges.push('reset');
787
- let html = toolHead(name, '', badges);
788
- const cells = Array.isArray(args.cells) ? args.cells : null;
789
- if (!cells) {
790
- html += '<div class="tool-error">[missing cells]</div>';
791
- } else {
782
+ let html = toolHead(name, '');
783
+ const cells = result && result.details && Array.isArray(result.details.cells) ? result.details.cells : null;
784
+ if (cells) {
792
785
  for (const cell of cells) {
793
786
  html += '<div class="tool-cell">';
794
787
  if (cell && cell.title) html += '<div class="tool-cell-title">' + escapeHtml(String(cell.title)) + '</div>';
795
788
  const code = cell && typeof cell.code === 'string' ? cell.code : '';
789
+ const lang = cell && cell.language === 'js' ? 'javascript' : 'python';
796
790
  html += codeBlock(code, lang);
797
791
  html += '</div>';
798
792
  }
793
+ } else if (typeof args.input === 'string') {
794
+ html += codeBlock(args.input, null);
795
+ } else {
796
+ html += '<div class="tool-error">[missing input]</div>';
799
797
  }
800
798
  if (result) {
801
799
  html += ctx.renderResultImages();
@@ -1078,17 +1076,24 @@
1078
1076
  return html;
1079
1077
  }
1080
1078
 
1081
- function renderPuppeteer(name, args, result, ctx) {
1079
+ function renderBrowser(name, args, result, ctx) {
1082
1080
  const action = str(args.action) || '?';
1081
+ const tabName = str(args.name);
1083
1082
  const badges = [];
1083
+ if (tabName) badges.push('name=' + tabName);
1084
1084
  if (args.url) badges.push(String(args.url));
1085
- if (args.selector) badges.push('selector=' + args.selector);
1086
- if (args.element_id != null) badges.push('id=' + args.element_id);
1087
- let head = '<span class="tool-name">puppeteer</span> <span class="tool-badge">' + escapeHtml(action) + '</span>';
1085
+ if (args.app && typeof args.app === 'object') {
1086
+ if (args.app.path) badges.push('app=' + shortenPath(String(args.app.path)));
1087
+ else if (args.app.cdp_url) badges.push('cdp=' + String(args.app.cdp_url));
1088
+ }
1089
+ if (args.all) badges.push('all');
1090
+ if (args.kill) badges.push('kill');
1091
+ let head = '<span class="tool-name">browser</span> <span class="tool-badge">' + escapeHtml(action) + '</span>';
1088
1092
  for (const b of badges) head += ' <span class="tool-badge">' + escapeHtml(String(b)) + '</span>';
1089
1093
  let html = '<div class="tool-header">' + head + '</div>';
1090
- if (args.script) html += codeBlock(String(args.script), 'javascript');
1091
- if (args.text) html += '<div class="tool-output"><div>' + escapeHtml(String(args.text)) + '</div></div>';
1094
+ if (action === 'run' && args.code) {
1095
+ html += codeBlock(String(args.code), 'javascript');
1096
+ }
1092
1097
  if (result) {
1093
1098
  html += ctx.renderResultImages();
1094
1099
  const output = ctx.getResultText();
@@ -1277,7 +1282,8 @@
1277
1282
  web_search: renderWebSearch,
1278
1283
  fetch: renderFetch,
1279
1284
  debug: renderDebug,
1280
- puppeteer: renderPuppeteer,
1285
+ puppeteer: renderBrowser,
1286
+ browser: renderBrowser,
1281
1287
  inspect_image: renderInspectImage,
1282
1288
  generate_image: renderGenerateImage,
1283
1289
  ask: renderAsk,
@@ -15,13 +15,12 @@ import type {
15
15
  Context,
16
16
  ImageContent,
17
17
  Model,
18
- OAuthCredentials,
19
- OAuthLoginCallbacks,
20
18
  ProviderResponseMetadata,
21
19
  SimpleStreamOptions,
22
20
  TextContent,
23
21
  ToolResultMessage,
24
22
  } from "@oh-my-pi/pi-ai";
23
+ import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/utils/oauth/types";
25
24
  import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
26
25
  import type { AutocompleteItem, Component, EditorComponent, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui";
27
26
  import type { Static, TSchema } from "@sinclair/typebox";
@@ -29,9 +28,9 @@ import type { Rule } from "../../capability/rule";
29
28
  import type { KeybindingsManager } from "../../config/keybindings";
30
29
  import type { ModelRegistry } from "../../config/model-registry";
31
30
  import type { EditToolDetails } from "../../edit";
31
+ import type { PythonResult } from "../../eval/py/executor";
32
32
  import type { BashResult } from "../../exec/bash-executor";
33
33
  import type { ExecOptions, ExecResult } from "../../exec/exec";
34
- import type { PythonResult } from "../../ipy/executor";
35
34
  import type { Theme } from "../../modes/theme/theme";
36
35
  import type { CompactionPreparation, CompactionResult } from "../../session/compaction";
37
36
  import type { CustomMessage } from "../../session/messages";