@oh-my-pi/pi-coding-agent 5.7.67 → 5.7.69

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 (53) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +6 -6
  3. package/package.json +8 -7
  4. package/src/migrations.ts +1 -34
  5. package/src/vendor/photon/index.js +4 -2
  6. package/src/vendor/photon/photon_rs_bg.wasm.b64.js +1 -0
  7. package/src/core/python-executor-display.test.ts +0 -42
  8. package/src/core/python-executor-lifecycle.test.ts +0 -99
  9. package/src/core/python-executor-mapping.test.ts +0 -41
  10. package/src/core/python-executor-per-call.test.ts +0 -49
  11. package/src/core/python-executor-session.test.ts +0 -103
  12. package/src/core/python-executor-streaming.test.ts +0 -77
  13. package/src/core/python-executor-timeout.test.ts +0 -35
  14. package/src/core/python-executor.lifecycle.test.ts +0 -139
  15. package/src/core/python-executor.result.test.ts +0 -49
  16. package/src/core/python-executor.test.ts +0 -180
  17. package/src/core/python-kernel-display.test.ts +0 -54
  18. package/src/core/python-kernel-env.test.ts +0 -138
  19. package/src/core/python-kernel-session.test.ts +0 -87
  20. package/src/core/python-kernel-ws.test.ts +0 -104
  21. package/src/core/python-kernel.lifecycle.test.ts +0 -249
  22. package/src/core/python-kernel.test.ts +0 -461
  23. package/src/core/python-modules.test.ts +0 -102
  24. package/src/core/python-prelude.test.ts +0 -140
  25. package/src/core/settings-manager-python.test.ts +0 -23
  26. package/src/core/streaming-output.test.ts +0 -26
  27. package/src/core/system-prompt.python.test.ts +0 -17
  28. package/src/core/tools/index.test.ts +0 -212
  29. package/src/core/tools/python-execution.test.ts +0 -68
  30. package/src/core/tools/python-fallback.test.ts +0 -72
  31. package/src/core/tools/python-renderer.test.ts +0 -36
  32. package/src/core/tools/python-tool-mode.test.ts +0 -43
  33. package/src/core/tools/python.test.ts +0 -121
  34. package/src/core/tools/schema-validation.test.ts +0 -530
  35. package/src/core/tools/web-scrapers/academic.test.ts +0 -239
  36. package/src/core/tools/web-scrapers/business.test.ts +0 -82
  37. package/src/core/tools/web-scrapers/dev-platforms.test.ts +0 -254
  38. package/src/core/tools/web-scrapers/documentation.test.ts +0 -85
  39. package/src/core/tools/web-scrapers/finance-media.test.ts +0 -144
  40. package/src/core/tools/web-scrapers/git-hosting.test.ts +0 -272
  41. package/src/core/tools/web-scrapers/media.test.ts +0 -138
  42. package/src/core/tools/web-scrapers/package-managers-2.test.ts +0 -199
  43. package/src/core/tools/web-scrapers/package-managers.test.ts +0 -171
  44. package/src/core/tools/web-scrapers/package-registries.test.ts +0 -259
  45. package/src/core/tools/web-scrapers/research.test.ts +0 -107
  46. package/src/core/tools/web-scrapers/security.test.ts +0 -103
  47. package/src/core/tools/web-scrapers/social-extended.test.ts +0 -192
  48. package/src/core/tools/web-scrapers/social.test.ts +0 -259
  49. package/src/core/tools/web-scrapers/stackexchange.test.ts +0 -120
  50. package/src/core/tools/web-scrapers/standards.test.ts +0 -122
  51. package/src/core/tools/web-scrapers/wikipedia.test.ts +0 -73
  52. package/src/core/tools/web-scrapers/youtube.test.ts +0 -198
  53. package/src/discovery/helpers.test.ts +0 -131
@@ -1,36 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import stripAnsi from "strip-ansi";
3
- import { getThemeByName } from "../../modes/interactive/theme/theme";
4
- import { pythonToolRenderer } from "./python";
5
- import { truncateTail } from "./truncate";
6
-
7
- describe("pythonToolRenderer", () => {
8
- it("renders truncated output when collapsed and full output when expanded", () => {
9
- const theme = getThemeByName("dark");
10
- expect(theme).toBeDefined();
11
- const uiTheme = theme!;
12
-
13
- const fullOutput = ["line 1", "line 2", "line 3", "line 4"].join("\n");
14
- const truncation = truncateTail(fullOutput, { maxLines: 2, maxBytes: 128 });
15
-
16
- const result = {
17
- content: [{ type: "text", text: truncation.content }],
18
- details: {
19
- truncation,
20
- fullOutput,
21
- },
22
- };
23
-
24
- const collapsed = pythonToolRenderer.renderResult(result, { expanded: false, isPartial: false }, uiTheme);
25
- const collapsedLines = stripAnsi(collapsed.render(80).join("\n"));
26
- expect(collapsedLines).toContain("line 4");
27
- expect(collapsedLines).not.toContain("line 1");
28
- expect(collapsedLines).toContain("Truncated:");
29
-
30
- const expanded = pythonToolRenderer.renderResult(result, { expanded: true, isPartial: false }, uiTheme);
31
- const expandedLines = stripAnsi(expanded.render(80).join("\n"));
32
- expect(expandedLines).toContain("line 1");
33
- expect(expandedLines).toContain("line 4");
34
- expect(expandedLines).not.toContain("Truncated:");
35
- });
36
- });
@@ -1,43 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { createTools, type ToolSession } from "./index";
3
-
4
- function createSession(overrides: Partial<ToolSession> = {}): ToolSession {
5
- return {
6
- cwd: "/tmp/test",
7
- hasUI: false,
8
- getSessionFile: () => null,
9
- getSessionSpawns: () => "*",
10
- settings: {
11
- getImageAutoResize: () => true,
12
- getLspFormatOnWrite: () => true,
13
- getLspDiagnosticsOnWrite: () => true,
14
- getLspDiagnosticsOnEdit: () => false,
15
- getEditFuzzyMatch: () => true,
16
- getGitToolEnabled: () => true,
17
- getBashInterceptorEnabled: () => true,
18
- getBashInterceptorSimpleLsEnabled: () => true,
19
- getBashInterceptorRules: () => [],
20
- getPythonToolMode: () => "bash-only",
21
- getPythonKernelMode: () => "session",
22
- },
23
- ...overrides,
24
- };
25
- }
26
-
27
- describe("createTools python fallback", () => {
28
- it("falls back to bash when python is requested but disabled", async () => {
29
- const previous = process.env.OMP_PYTHON_SKIP_CHECK;
30
- process.env.OMP_PYTHON_SKIP_CHECK = "1";
31
- const session = createSession();
32
- const tools = await createTools(session, ["python"]);
33
- const names = tools.map((tool) => tool.name);
34
-
35
- expect(names).toEqual(["bash"]);
36
-
37
- if (previous === undefined) {
38
- delete process.env.OMP_PYTHON_SKIP_CHECK;
39
- } else {
40
- process.env.OMP_PYTHON_SKIP_CHECK = previous;
41
- }
42
- });
43
- });
@@ -1,121 +0,0 @@
1
- import { afterAll, beforeAll, describe, expect, it, vi } from "bun:test";
2
- import * as pythonExecutor from "../python-executor";
3
- import { createTools, type ToolSession } from "./index";
4
- import { createPythonTool } from "./python";
5
-
6
- let previousSkipCheck: string | undefined;
7
-
8
- beforeAll(() => {
9
- previousSkipCheck = process.env.OMP_PYTHON_SKIP_CHECK;
10
- process.env.OMP_PYTHON_SKIP_CHECK = "1";
11
- });
12
-
13
- afterAll(() => {
14
- if (previousSkipCheck === undefined) {
15
- delete process.env.OMP_PYTHON_SKIP_CHECK;
16
- return;
17
- }
18
- process.env.OMP_PYTHON_SKIP_CHECK = previousSkipCheck;
19
- });
20
-
21
- function createSession(overrides: Partial<ToolSession> = {}): ToolSession {
22
- return {
23
- cwd: "/tmp/test",
24
- hasUI: false,
25
- getSessionFile: () => null,
26
- getSessionSpawns: () => "*",
27
- ...overrides,
28
- };
29
- }
30
-
31
- function createSettings(toolMode: "ipy-only" | "bash-only" | "both") {
32
- return {
33
- getImageAutoResize: () => true,
34
- getLspFormatOnWrite: () => true,
35
- getLspDiagnosticsOnWrite: () => true,
36
- getLspDiagnosticsOnEdit: () => false,
37
- getEditFuzzyMatch: () => true,
38
- getGitToolEnabled: () => true,
39
- getBashInterceptorEnabled: () => true,
40
- getBashInterceptorSimpleLsEnabled: () => true,
41
- getBashInterceptorRules: () => [],
42
- getPythonToolMode: () => toolMode,
43
- getPythonKernelMode: () => "session" as const,
44
- };
45
- }
46
-
47
- describe("python tool schema", () => {
48
- it("exposes expected parameters", () => {
49
- const tool = createPythonTool(createSession());
50
- const schema = tool.parameters as {
51
- type: string;
52
- properties: Record<string, { type: string; description?: string }>;
53
- required?: string[];
54
- };
55
-
56
- expect(schema.type).toBe("object");
57
- expect(schema.properties.code.type).toBe("string");
58
- expect(schema.properties.timeout.type).toBe("number");
59
- expect(schema.properties.workdir.type).toBe("string");
60
- expect(schema.properties.reset.type).toBe("boolean");
61
- expect(schema.required).toEqual(["code"]);
62
- });
63
- });
64
-
65
- describe("python tool docs template", () => {
66
- it("renders dynamic helper docs", () => {
67
- const docs = [
68
- {
69
- name: "read",
70
- signature: "(path)",
71
- docstring: "Read file contents.",
72
- category: "File I/O",
73
- },
74
- ];
75
- const spy = vi.spyOn(pythonExecutor, "getPreludeDocs").mockReturnValue(docs);
76
-
77
- const tool = createPythonTool(createSession());
78
-
79
- expect(tool.description).toContain("### File I/O");
80
- expect(tool.description).toContain("read(path)");
81
- expect(tool.description).toContain("Read file contents.");
82
-
83
- spy.mockRestore();
84
- });
85
-
86
- it("renders fallback when docs are unavailable", () => {
87
- const spy = vi.spyOn(pythonExecutor, "getPreludeDocs").mockReturnValue([]);
88
-
89
- const tool = createPythonTool(createSession());
90
-
91
- expect(tool.description).toContain("Documentation unavailable — Python kernel failed to start");
92
-
93
- spy.mockRestore();
94
- });
95
- });
96
-
97
- describe("python tool exposure", () => {
98
- it("includes python only in ipy-only mode", async () => {
99
- const session = createSession({ settings: createSettings("ipy-only") });
100
- const tools = await createTools(session);
101
- const names = tools.map((tool) => tool.name);
102
- expect(names).toContain("python");
103
- expect(names).not.toContain("bash");
104
- });
105
-
106
- it("includes bash only in bash-only mode", async () => {
107
- const session = createSession({ settings: createSettings("bash-only") });
108
- const tools = await createTools(session);
109
- const names = tools.map((tool) => tool.name);
110
- expect(names).toContain("bash");
111
- expect(names).not.toContain("python");
112
- });
113
-
114
- it("includes bash and python in both mode", async () => {
115
- const session = createSession({ settings: createSettings("both") });
116
- const tools = await createTools(session);
117
- const names = tools.map((tool) => tool.name);
118
- expect(names).toContain("bash");
119
- expect(names).toContain("python");
120
- });
121
- });