@oh-my-pi/pi-coding-agent 5.7.68 → 5.8.0
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.
- package/CHANGELOG.md +6 -0
- package/README.md +6 -6
- package/package.json +6 -5
- package/scripts/generate-template.ts +32 -0
- package/scripts/generate-wasm-b64.ts +13 -0
- package/scripts/migrate-sessions.sh +93 -0
- package/src/vendor/photon/index.js +24 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.8.0] - 2026-01-19
|
|
6
|
+
### Changed
|
|
7
|
+
|
|
8
|
+
- Updated WASM loading to use streaming for development environments with base64 fallback
|
|
9
|
+
- Added scripts directory to published package files
|
|
10
|
+
|
|
5
11
|
## [5.7.68] - 2026-01-18
|
|
6
12
|
### Changed
|
|
7
13
|
|
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ Works on Linux, macOS, and Windows (requires bash; see [Windows Setup](#windows-
|
|
|
52
52
|
**npm (recommended):**
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
npm install -g @oh-my-pi/
|
|
55
|
+
npm install -g @oh-my-pi/pi-coding-agent
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
**Standalone binary:**
|
|
@@ -617,7 +617,7 @@ Select theme via `/settings` or set in `~/.omp/agent/settings.json`.
|
|
|
617
617
|
|
|
618
618
|
```bash
|
|
619
619
|
mkdir -p ~/.omp/agent/themes
|
|
620
|
-
cp $(npm root -g)/@oh-my-pi/
|
|
620
|
+
cp $(npm root -g)/@oh-my-pi/pi-coding-agent/dist/theme/dark.json ~/.omp/agent/themes/my-theme.json
|
|
621
621
|
```
|
|
622
622
|
|
|
623
623
|
Select with `/settings`, then edit the file. Changes apply on save.
|
|
@@ -740,7 +740,7 @@ Hooks are TypeScript modules that extend omp's behavior by subscribing to lifecy
|
|
|
740
740
|
**Quick example** (permission gate):
|
|
741
741
|
|
|
742
742
|
```typescript
|
|
743
|
-
import type { HookAPI } from "@oh-my-pi/
|
|
743
|
+
import type { HookAPI } from "@oh-my-pi/pi-coding-agent/hooks";
|
|
744
744
|
|
|
745
745
|
export default function (omp: HookAPI) {
|
|
746
746
|
omp.on("tool_call", async (event, ctx) => {
|
|
@@ -759,7 +759,7 @@ Use `omp.sendMessage(message, triggerTurn?)` to inject messages into the session
|
|
|
759
759
|
|
|
760
760
|
```typescript
|
|
761
761
|
import * as fs from "node:fs";
|
|
762
|
-
import type { HookAPI } from "@oh-my-pi/
|
|
762
|
+
import type { HookAPI } from "@oh-my-pi/pi-coding-agent/hooks";
|
|
763
763
|
|
|
764
764
|
export default function (omp: HookAPI) {
|
|
765
765
|
omp.on("session_start", async () => {
|
|
@@ -802,7 +802,7 @@ Custom tools let you extend the built-in toolset (read, write, edit, bash, ...)
|
|
|
802
802
|
|
|
803
803
|
```typescript
|
|
804
804
|
import { Type } from "@sinclair/typebox";
|
|
805
|
-
import type { CustomToolFactory } from "@oh-my-pi/
|
|
805
|
+
import type { CustomToolFactory } from "@oh-my-pi/pi-coding-agent";
|
|
806
806
|
|
|
807
807
|
const factory: CustomToolFactory = (omp) => ({
|
|
808
808
|
name: "greet",
|
|
@@ -970,7 +970,7 @@ For adding new tools, see [Custom Tools](#custom-tools) in the Configuration sec
|
|
|
970
970
|
For embedding omp in Node.js/TypeScript applications, use the SDK:
|
|
971
971
|
|
|
972
972
|
```typescript
|
|
973
|
-
import { createAgentSession, discoverAuthStorage, discoverModels, SessionManager } from "@oh-my-pi/
|
|
973
|
+
import { createAgentSession, discoverAuthStorage, discoverModels, SessionManager } from "@oh-my-pi/pi-coding-agent";
|
|
974
974
|
|
|
975
975
|
const authStorage = discoverAuthStorage();
|
|
976
976
|
const modelRegistry = discoverModels(authStorage);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"ompConfig": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
27
|
+
"scripts",
|
|
27
28
|
"docs",
|
|
28
29
|
"examples",
|
|
29
30
|
"CHANGELOG.md"
|
|
@@ -40,10 +41,10 @@
|
|
|
40
41
|
"prepublishOnly": "bun run generate-template && bun run clean && bun run build"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@oh-my-pi/pi-agent-core": "5.
|
|
44
|
-
"@oh-my-pi/pi-ai": "5.
|
|
45
|
-
"@oh-my-pi/pi-git-tool": "5.
|
|
46
|
-
"@oh-my-pi/pi-tui": "5.
|
|
44
|
+
"@oh-my-pi/pi-agent-core": "5.8.0",
|
|
45
|
+
"@oh-my-pi/pi-ai": "5.8.0",
|
|
46
|
+
"@oh-my-pi/pi-git-tool": "5.8.0",
|
|
47
|
+
"@oh-my-pi/pi-tui": "5.8.0",
|
|
47
48
|
"@openai/agents": "^0.3.7",
|
|
48
49
|
"@sinclair/typebox": "^0.34.46",
|
|
49
50
|
"ajv": "^8.17.1",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Pre-compute the HTML template at publish time.
|
|
4
|
+
* This avoids the Bun macro restriction in node_modules.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const dir = new URL("../src/core/export-html/", import.meta.url).pathname;
|
|
8
|
+
|
|
9
|
+
// Read all files
|
|
10
|
+
const html = await Bun.file(`${dir}template.html`).text();
|
|
11
|
+
const css = await Bun.file(`${dir}template.css`).text();
|
|
12
|
+
const js = await Bun.file(`${dir}template.js`).text();
|
|
13
|
+
|
|
14
|
+
// Minify CSS
|
|
15
|
+
const minifiedCss = css
|
|
16
|
+
.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
17
|
+
.replace(/\s+/g, " ")
|
|
18
|
+
.replace(/\s*([{}:;,])\s*/g, "$1")
|
|
19
|
+
.trim();
|
|
20
|
+
|
|
21
|
+
// Inline everything
|
|
22
|
+
const template = html
|
|
23
|
+
.replace("<template-css/>", `<style>${minifiedCss}</style>`)
|
|
24
|
+
.replace("<template-js/>", `<script>${js}</script>`);
|
|
25
|
+
|
|
26
|
+
// Write generated file
|
|
27
|
+
const output = `// Auto-generated by scripts/generate-template.ts - DO NOT EDIT
|
|
28
|
+
export const TEMPLATE = ${JSON.stringify(template)};
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
await Bun.write(`${dir}template.generated.ts`, output);
|
|
32
|
+
console.log("Generated template.generated.ts");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join, dirname } from "node:path";
|
|
4
|
+
|
|
5
|
+
const vendorDir = join(dirname(import.meta.dir), "src/vendor/photon");
|
|
6
|
+
const wasmPath = join(vendorDir, "photon_rs_bg.wasm");
|
|
7
|
+
const b64Path = join(vendorDir, "photon_rs_bg.wasm.b64.js");
|
|
8
|
+
|
|
9
|
+
const wasmBytes = readFileSync(wasmPath);
|
|
10
|
+
const wasmB64 = wasmBytes.toString("base64");
|
|
11
|
+
writeFileSync(b64Path, `export default "${wasmB64}";\n`);
|
|
12
|
+
|
|
13
|
+
console.log(`Generated ${b64Path} (${wasmB64.length} chars)`);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Migrate sessions from ~/.omp/agent/*.jsonl to proper session directories.
|
|
4
|
+
# This fixes sessions created by the bug in v0.30.0 where sessions were
|
|
5
|
+
# saved to ~/.omp/agent/ instead of ~/.omp/agent/sessions/<encoded-cwd>/.
|
|
6
|
+
#
|
|
7
|
+
# Usage: ./migrate-sessions.sh [--dry-run]
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
set -e
|
|
11
|
+
|
|
12
|
+
AGENT_DIR="${OMP_AGENT_DIR:-$HOME/.omp/agent}"
|
|
13
|
+
DRY_RUN=false
|
|
14
|
+
|
|
15
|
+
if [[ "$1" == "--dry-run" ]]; then
|
|
16
|
+
DRY_RUN=true
|
|
17
|
+
echo "Dry run mode - no files will be moved"
|
|
18
|
+
echo
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Find all .jsonl files directly in agent dir (not in subdirectories)
|
|
22
|
+
shopt -s nullglob
|
|
23
|
+
files=("$AGENT_DIR"/*.jsonl)
|
|
24
|
+
shopt -u nullglob
|
|
25
|
+
|
|
26
|
+
if [[ ${#files[@]} -eq 0 ]]; then
|
|
27
|
+
echo "No session files found in $AGENT_DIR"
|
|
28
|
+
exit 0
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
echo "Found ${#files[@]} session file(s) to migrate"
|
|
32
|
+
echo
|
|
33
|
+
|
|
34
|
+
migrated=0
|
|
35
|
+
failed=0
|
|
36
|
+
|
|
37
|
+
for file in "${files[@]}"; do
|
|
38
|
+
filename=$(basename "$file")
|
|
39
|
+
|
|
40
|
+
# Read first line and extract cwd using jq
|
|
41
|
+
if ! first_line=$(head -1 "$file" 2>/dev/null); then
|
|
42
|
+
echo "SKIP: $filename - cannot read file"
|
|
43
|
+
((failed++))
|
|
44
|
+
continue
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# Parse JSON and extract cwd
|
|
48
|
+
if ! cwd=$(echo "$first_line" | jq -r '.cwd // empty' 2>/dev/null); then
|
|
49
|
+
echo "SKIP: $filename - invalid JSON"
|
|
50
|
+
((failed++))
|
|
51
|
+
continue
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
if [[ -z "$cwd" ]]; then
|
|
55
|
+
echo "SKIP: $filename - no cwd in session header"
|
|
56
|
+
((failed++))
|
|
57
|
+
continue
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Encode cwd: remove leading slash, replace slashes with dashes, wrap with --
|
|
61
|
+
encoded=$(echo "$cwd" | sed 's|^/||' | sed 's|[/:\\]|-|g')
|
|
62
|
+
encoded="--${encoded}--"
|
|
63
|
+
|
|
64
|
+
target_dir="$AGENT_DIR/sessions/$encoded"
|
|
65
|
+
target_file="$target_dir/$filename"
|
|
66
|
+
|
|
67
|
+
if [[ -e "$target_file" ]]; then
|
|
68
|
+
echo "SKIP: $filename - target already exists"
|
|
69
|
+
((failed++))
|
|
70
|
+
continue
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo "MIGRATE: $filename"
|
|
74
|
+
echo " cwd: $cwd"
|
|
75
|
+
echo " to: $target_dir/"
|
|
76
|
+
|
|
77
|
+
if [[ "$DRY_RUN" == false ]]; then
|
|
78
|
+
mkdir -p "$target_dir"
|
|
79
|
+
mv "$file" "$target_file"
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
((migrated++))
|
|
83
|
+
echo
|
|
84
|
+
done
|
|
85
|
+
|
|
86
|
+
echo "---"
|
|
87
|
+
echo "Migrated: $migrated"
|
|
88
|
+
echo "Skipped: $failed"
|
|
89
|
+
|
|
90
|
+
if [[ "$DRY_RUN" == true && $migrated -gt 0 ]]; then
|
|
91
|
+
echo
|
|
92
|
+
echo "Run without --dry-run to perform the migration"
|
|
93
|
+
fi
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* @ts-self-types="./photon_rs.d.ts" */
|
|
2
|
-
import wasmBase64 from "./photon_rs_bg.wasm.b64.js";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Provides the image's height, width, and contains the image's raw pixels.
|
|
@@ -4454,8 +4453,29 @@ const cachedTextEncoder = new TextEncoder();
|
|
|
4454
4453
|
|
|
4455
4454
|
let WASM_VECTOR_LEN = 0;
|
|
4456
4455
|
|
|
4457
|
-
//
|
|
4458
|
-
|
|
4459
|
-
const
|
|
4456
|
+
// Load WASM - try each source until one instantiates successfully
|
|
4457
|
+
let wasmInstantiated;
|
|
4458
|
+
const imports = __wbg_get_imports();
|
|
4459
|
+
|
|
4460
|
+
// Try .wasm file first (dev) - streaming is most efficient
|
|
4461
|
+
let streamingError;
|
|
4462
|
+
try {
|
|
4463
|
+
const wasmPath = new URL("./photon_rs_bg.wasm", import.meta.url);
|
|
4464
|
+
wasmInstantiated = await WebAssembly.instantiateStreaming(fetch(wasmPath), imports);
|
|
4465
|
+
} catch (e) {
|
|
4466
|
+
streamingError = e;
|
|
4467
|
+
}
|
|
4468
|
+
|
|
4469
|
+
// Fall back to base64 (compiled binary/npm)
|
|
4470
|
+
if (!wasmInstantiated) {
|
|
4471
|
+
try {
|
|
4472
|
+
const { default: wasmBase64 } = await import("./photon_rs_bg.wasm.b64.js");
|
|
4473
|
+
const wasmBytes = Uint8Array.from(atob(wasmBase64), c => c.charCodeAt(0));
|
|
4474
|
+
wasmInstantiated = await WebAssembly.instantiate(wasmBytes, imports);
|
|
4475
|
+
} catch (b64Error) {
|
|
4476
|
+
throw new Error(`Failed to load photon WASM:\n streaming: ${streamingError?.message}\n base64: ${b64Error.message}`);
|
|
4477
|
+
}
|
|
4478
|
+
}
|
|
4479
|
+
|
|
4460
4480
|
const wasm = wasmInstantiated.instance.exports;
|
|
4461
4481
|
wasm.__wbindgen_start();
|