pi-forge 0.0.0 → 1.1.5
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/LICENSE +21 -0
- package/README.md +48 -4
- package/bin/fix-pty-perms.mjs +69 -0
- package/bin/pi-forge.mjs +37 -0
- package/dist/client/assets/CodeMirrorEditor-EHkmefTD.js +50 -0
- package/dist/client/assets/CodeMirrorEditor-EHkmefTD.js.map +1 -0
- package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/client/assets/index-5KN1PFqY.css +1 -0
- package/dist/client/assets/index-B0ffzJ0t.js +356 -0
- package/dist/client/assets/index-B0ffzJ0t.js.map +1 -0
- package/dist/client/assets/workbox-window.prod.es5-Cch4wiA5.js +3 -0
- package/dist/client/assets/workbox-window.prod.es5-Cch4wiA5.js.map +1 -0
- package/dist/client/icons/icon-192.png +0 -0
- package/dist/client/icons/icon-512.png +0 -0
- package/dist/client/icons/icon-maskable-512.png +0 -0
- package/dist/client/icons/icon.svg +9 -0
- package/dist/client/index.html +24 -0
- package/dist/client/manifest.webmanifest +1 -0
- package/dist/client/offline.html +142 -0
- package/dist/client/sw.js +3 -0
- package/dist/client/sw.js.map +1 -0
- package/dist/client/workbox-6d7155ed.js +3 -0
- package/dist/client/workbox-6d7155ed.js.map +1 -0
- package/dist/server/agent-resource-loader.js +126 -0
- package/dist/server/agent-resource-loader.js.map +1 -0
- package/dist/server/attachment-converters.js +96 -0
- package/dist/server/attachment-converters.js.map +1 -0
- package/dist/server/auth.js +209 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/compaction-history.js +106 -0
- package/dist/server/compaction-history.js.map +1 -0
- package/dist/server/concurrency.js +49 -0
- package/dist/server/concurrency.js.map +1 -0
- package/dist/server/config-export.js +220 -0
- package/dist/server/config-export.js.map +1 -0
- package/dist/server/config-manager.js +531 -0
- package/dist/server/config-manager.js.map +1 -0
- package/dist/server/config.js +326 -0
- package/dist/server/config.js.map +1 -0
- package/dist/server/conversion-worker.mjs +90 -0
- package/dist/server/diagnostics.js +137 -0
- package/dist/server/diagnostics.js.map +1 -0
- package/dist/server/extensions-discovery.js +147 -0
- package/dist/server/extensions-discovery.js.map +1 -0
- package/dist/server/file-manager.js +752 -0
- package/dist/server/file-manager.js.map +1 -0
- package/dist/server/file-references.js +310 -0
- package/dist/server/file-references.js.map +1 -0
- package/dist/server/file-searcher.js +385 -0
- package/dist/server/file-searcher.js.map +1 -0
- package/dist/server/git-runner.js +684 -0
- package/dist/server/git-runner.js.map +1 -0
- package/dist/server/index.js +468 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/mcp/config.js +133 -0
- package/dist/server/mcp/config.js.map +1 -0
- package/dist/server/mcp/manager.js +351 -0
- package/dist/server/mcp/manager.js.map +1 -0
- package/dist/server/mcp/tool-bridge.js +173 -0
- package/dist/server/mcp/tool-bridge.js.map +1 -0
- package/dist/server/project-manager.js +301 -0
- package/dist/server/project-manager.js.map +1 -0
- package/dist/server/pty-manager.js +354 -0
- package/dist/server/pty-manager.js.map +1 -0
- package/dist/server/routes/_schemas.js +73 -0
- package/dist/server/routes/_schemas.js.map +1 -0
- package/dist/server/routes/auth.js +164 -0
- package/dist/server/routes/auth.js.map +1 -0
- package/dist/server/routes/config.js +1195 -0
- package/dist/server/routes/config.js.map +1 -0
- package/dist/server/routes/control.js +464 -0
- package/dist/server/routes/control.js.map +1 -0
- package/dist/server/routes/exec.js +217 -0
- package/dist/server/routes/exec.js.map +1 -0
- package/dist/server/routes/files.js +847 -0
- package/dist/server/routes/files.js.map +1 -0
- package/dist/server/routes/git.js +837 -0
- package/dist/server/routes/git.js.map +1 -0
- package/dist/server/routes/health.js +122 -0
- package/dist/server/routes/health.js.map +1 -0
- package/dist/server/routes/mcp.js +300 -0
- package/dist/server/routes/mcp.js.map +1 -0
- package/dist/server/routes/projects.js +259 -0
- package/dist/server/routes/projects.js.map +1 -0
- package/dist/server/routes/prompt.js +496 -0
- package/dist/server/routes/prompt.js.map +1 -0
- package/dist/server/routes/sessions.js +783 -0
- package/dist/server/routes/sessions.js.map +1 -0
- package/dist/server/routes/stream.js +69 -0
- package/dist/server/routes/stream.js.map +1 -0
- package/dist/server/routes/terminal.js +335 -0
- package/dist/server/routes/terminal.js.map +1 -0
- package/dist/server/session-registry.js +1197 -0
- package/dist/server/session-registry.js.map +1 -0
- package/dist/server/skill-overrides.js +151 -0
- package/dist/server/skill-overrides.js.map +1 -0
- package/dist/server/skills-export.js +257 -0
- package/dist/server/skills-export.js.map +1 -0
- package/dist/server/sse-bridge.js +220 -0
- package/dist/server/sse-bridge.js.map +1 -0
- package/dist/server/tool-overrides.js +277 -0
- package/dist/server/tool-overrides.js.map +1 -0
- package/dist/server/turn-diff-builder.js +280 -0
- package/dist/server/turn-diff-builder.js.map +1 -0
- package/package.json +56 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Devin Marks and pi-forge contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,51 @@
|
|
|
1
1
|
# pi-forge
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Browser UI for the [pi coding agent](https://github.com/badlogic/pi-mono) —
|
|
4
|
+
an embedded HTTP server with a React workbench (chat, file browser,
|
|
5
|
+
terminal, git integration, MCP support).
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# One-shot
|
|
11
|
+
npx pi-forge
|
|
12
|
+
|
|
13
|
+
# Or install globally
|
|
14
|
+
npm i -g pi-forge
|
|
15
|
+
pi-forge
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Open <http://localhost:3000> and pick a workspace folder.
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
All knobs are environment variables. Sensible defaults — set only what
|
|
23
|
+
you need.
|
|
24
|
+
|
|
25
|
+
| Variable | Default | Purpose |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `PORT` | `3000` | HTTP listen port |
|
|
28
|
+
| `WORKSPACE_PATH` | `~/.pi-forge/workspace` | Where project code lives |
|
|
29
|
+
| `PI_CONFIG_DIR` | `~/.pi/agent` | Pi SDK config (auth, models, settings) |
|
|
30
|
+
| `FORGE_DATA_DIR` | `~/.pi-forge` | pi-forge state (project list) |
|
|
31
|
+
| `UI_PASSWORD` | (unset) | Enables browser login if set |
|
|
32
|
+
| `API_KEY` | (unset) | Enables `Authorization: Bearer` for programmatic use |
|
|
33
|
+
|
|
34
|
+
If both `UI_PASSWORD` and `API_KEY` are unset, auth is disabled. For
|
|
35
|
+
production, set at minimum `API_KEY`.
|
|
36
|
+
|
|
37
|
+
## Programmatic API
|
|
38
|
+
|
|
39
|
+
REST + Server-Sent Events under `/api/v1/`. Interactive docs at
|
|
40
|
+
`/api/docs`. See the [project README](https://github.com/Devin-Marks/pi-forge#readme)
|
|
41
|
+
for the full surface and example curl flows.
|
|
42
|
+
|
|
43
|
+
## Versioning
|
|
44
|
+
|
|
45
|
+
This package version (`1.1.5`) tracks the [GitHub release](https://github.com/Devin-Marks/pi-forge/releases)
|
|
46
|
+
of the same name. Docker images and the npm package are published in
|
|
47
|
+
lockstep on each `v*` tag.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* pi-forge postinstall: ensure node-pty's prebuilt `spawn-helper`
|
|
4
|
+
* binaries are executable.
|
|
5
|
+
*
|
|
6
|
+
* The bug: `node-pty` ships prebuilt native binaries at
|
|
7
|
+
* `node_modules/node-pty/prebuilds/<platform>/spawn-helper`
|
|
8
|
+
* The tarball's mode bits don't always survive npm's tar extract —
|
|
9
|
+
* fresh installs frequently land `spawn-helper` at `0644` with no
|
|
10
|
+
* exec bit. When pi-forge later spawns a PTY, `posix_spawnp` fails
|
|
11
|
+
* with the unhelpful "spawn EACCES" or "posix_spawnp failed."
|
|
12
|
+
*
|
|
13
|
+
* `node-pty`'s own postinstall script handles the from-source-built
|
|
14
|
+
* path (`build/Release/`) but NOT the prebuilt path (`prebuilds/`),
|
|
15
|
+
* so the bug ships on every npm-published install of pi-forge.
|
|
16
|
+
*
|
|
17
|
+
* Why this script lives in pi-forge and not upstream: the upstream
|
|
18
|
+
* fix would need to land in node-pty itself. Until then, every
|
|
19
|
+
* package that depends on node-pty needs its own postinstall to
|
|
20
|
+
* cover the gap. We pay one trivial chmod per install in exchange
|
|
21
|
+
* for the integrated terminal actually working.
|
|
22
|
+
*
|
|
23
|
+
* Idempotent: chmod +x on something already +x is a no-op.
|
|
24
|
+
* Failure-tolerant: missing node-pty (e.g. `--omit=optional`),
|
|
25
|
+
* missing prebuilds dir (unusual platform), or chmod failure
|
|
26
|
+
* (read-only mount, EPERM) all warn instead of failing the install.
|
|
27
|
+
*/
|
|
28
|
+
import { chmodSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
29
|
+
import { dirname, join } from "node:path";
|
|
30
|
+
import { createRequire } from "node:module";
|
|
31
|
+
|
|
32
|
+
const require = createRequire(import.meta.url);
|
|
33
|
+
|
|
34
|
+
let nodePtyDir;
|
|
35
|
+
try {
|
|
36
|
+
nodePtyDir = dirname(require.resolve("node-pty/package.json"));
|
|
37
|
+
} catch {
|
|
38
|
+
// node-pty not installed — no-op.
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const prebuildsDir = join(nodePtyDir, "prebuilds");
|
|
43
|
+
if (!existsSync(prebuildsDir)) process.exit(0);
|
|
44
|
+
|
|
45
|
+
let fixed = 0;
|
|
46
|
+
for (const platform of readdirSync(prebuildsDir)) {
|
|
47
|
+
const helper = join(prebuildsDir, platform, "spawn-helper");
|
|
48
|
+
if (!existsSync(helper)) continue;
|
|
49
|
+
try {
|
|
50
|
+
const mode = statSync(helper).mode;
|
|
51
|
+
// 0o111 = any-x bits. If even one is set, assume the file is
|
|
52
|
+
// already runnable.
|
|
53
|
+
if ((mode & 0o111) !== 0) continue;
|
|
54
|
+
chmodSync(helper, mode | 0o755);
|
|
55
|
+
fixed++;
|
|
56
|
+
} catch (err) {
|
|
57
|
+
console.warn(
|
|
58
|
+
`[pi-forge postinstall] could not chmod ${helper}: ${err instanceof Error ? err.message : err}`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (fixed > 0) {
|
|
64
|
+
console.log(
|
|
65
|
+
`[pi-forge postinstall] fixed exec bit on ${fixed} node-pty spawn-helper binar${
|
|
66
|
+
fixed === 1 ? "y" : "ies"
|
|
67
|
+
}`,
|
|
68
|
+
);
|
|
69
|
+
}
|
package/bin/pi-forge.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* pi-forge CLI launcher.
|
|
4
|
+
*
|
|
5
|
+
* The published npm package layout is:
|
|
6
|
+
*
|
|
7
|
+
* pi-forge/
|
|
8
|
+
* ├── bin/pi-forge.mjs (this file)
|
|
9
|
+
* ├── dist/server/ (built Fastify server — copy of packages/server/dist/)
|
|
10
|
+
* └── dist/client/ (built Vite SPA — copy of packages/client/dist/)
|
|
11
|
+
*
|
|
12
|
+
* The server's default `CLIENT_DIST_PATH` resolves relative to its own
|
|
13
|
+
* compiled file (`dist/server/config.js` → `../../client/dist`), which
|
|
14
|
+
* works for the in-repo `npm run build && node dist/index.js` flow and
|
|
15
|
+
* the Docker image (both share the `packages/server/dist/` +
|
|
16
|
+
* `packages/client/dist/` layout) but NOT for the flat published
|
|
17
|
+
* package. We override `CLIENT_DIST_PATH` here so the same server entry
|
|
18
|
+
* works in all three deployment shapes without touching server code.
|
|
19
|
+
*
|
|
20
|
+
* Everything else (workspace path, pi config dir, forge data dir, port,
|
|
21
|
+
* auth) is read from env vars and uses the server's existing defaults
|
|
22
|
+
* (`~/.pi-forge/workspace`, `~/.pi/agent`, `~/.pi-forge`, port 3000) —
|
|
23
|
+
* users who installed via `npm i -g pi-forge` get sensible per-user
|
|
24
|
+
* paths under their home directory without any setup.
|
|
25
|
+
*/
|
|
26
|
+
import { dirname, resolve } from "node:path";
|
|
27
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
28
|
+
|
|
29
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
30
|
+
const packageRoot = resolve(here, "..");
|
|
31
|
+
|
|
32
|
+
process.env.CLIENT_DIST_PATH ??= resolve(packageRoot, "dist", "client");
|
|
33
|
+
process.env.NODE_ENV ??= "production";
|
|
34
|
+
|
|
35
|
+
const serverEntry = resolve(packageRoot, "dist", "server", "index.js");
|
|
36
|
+
const { start } = await import(pathToFileURL(serverEntry).href);
|
|
37
|
+
await start();
|