@oh-my-pi/pi-coding-agent 5.7.69 → 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
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/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();
|