@rexvane/piweb 0.3.16 → 0.3.17
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +8 -11
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +6 -6
- package/.next/react-loadable-manifest.json +4 -16
- package/.next/required-server-files.js +1 -3
- package/.next/required-server-files.json +1 -3
- package/.next/routes-manifest.json +0 -20
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +4 -7
- package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -5
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -5
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/tree/route.js +1 -1
- package/.next/server/app/api/agent/[id]/tree/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +1 -1
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/files/route.js +1 -1
- package/.next/server/app/api/files/route.js.nft.json +1 -1
- package/.next/server/app/api/git/route.js +2 -2
- package/.next/server/app/api/git/route.js.nft.json +1 -1
- package/.next/server/app/api/growth/route.js +1 -1
- package/.next/server/app/api/growth/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models/route.js.nft.json +1 -1
- package/.next/server/app/api/pi-settings/route.js +1 -1
- package/.next/server/app/api/pi-settings/route.js.nft.json +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/plugins/route.js.nft.json +1 -1
- package/.next/server/app/api/prompts/route.js +1 -1
- package/.next/server/app/api/prompts/route.js.nft.json +1 -1
- package/.next/server/app/api/security/route.js +1 -1
- package/.next/server/app/api/security/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/import/route.js +3 -3
- package/.next/server/app/api/sessions/import/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +2 -2
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/update/route.js +2 -2
- package/.next/server/app/api/update/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/api/web-auth/route.js +1 -1
- package/.next/server/app/api/workspaces/route.js +1 -1
- package/.next/server/app/api/workspaces/route.js.nft.json +1 -1
- package/.next/server/app/icon.svg/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +6 -9
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -7
- package/.next/server/app/index.segments/_full.segment.rsc +6 -9
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/.next/server/app/login/page.js +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -8
- package/.next/server/app/login.segments/_full.segment.rsc +5 -8
- package/.next/server/app/login.segments/_tree.segment.rsc +2 -5
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +3 -6
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +8 -11
- package/.next/server/chunks/496.js +1 -1
- package/.next/server/chunks/532.js +1 -1
- package/.next/server/chunks/686.js +4 -8
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/2608.ec8ff1f5767c9056.js +1 -0
- package/.next/static/chunks/2716.93be8ad5c970c516.js +1 -0
- package/.next/static/chunks/4632.112d2e893d48d188.js +1 -0
- package/.next/static/chunks/4673.c1fb1580efc6ace7.js +1 -0
- package/.next/static/chunks/4686-f4a037d609cea3f2.js +1 -0
- package/.next/static/chunks/app/_global-error/page-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/tree/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/config/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/files/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/git/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/growth/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/health/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/models/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/pi-settings/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/prompts/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/security/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/sessions/import/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/skills/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/update/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/version/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/web-auth/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/api/workspaces/route-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/app/page-b51087831582ee37.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f77e9ede9808b18e.js +1 -0
- package/.next/static/chunks/webpack-c31263fd83d75ce6.js +1 -0
- package/.next/static/css/850c2fd130ffa2fc.css +1 -0
- package/.next/static/zsynuO_9Kx6nrXgkTUJ04/_buildManifest.js +1 -0
- package/.next/types/routes.d.ts +1 -4
- package/.next/types/validator.ts +0 -27
- package/README.md +17 -29
- package/assets/archive.jpg +0 -0
- package/assets/growth-1.jpg +0 -0
- package/assets/growth-2.jpg +0 -0
- package/assets/import.jpg +0 -0
- package/assets/main.jpg +0 -0
- package/assets/outline.jpg +0 -0
- package/assets/prompts-1.jpg +0 -0
- package/assets/prompts-2.jpg +0 -0
- package/assets/providers-1.jpg +0 -0
- package/assets/providers-2.jpg +0 -0
- package/assets/providers-3.jpg +0 -0
- package/assets/trace-1.jpg +0 -0
- package/assets/trace-2.png +0 -0
- package/assets/trace-3.png +0 -0
- package/assets/trace-4.png +0 -0
- package/assets/viewer-1.jpg +0 -0
- package/assets/viewer-2.jpg +0 -0
- package/bin/pi.js +50 -0
- package/next.config.ts +32 -7
- package/package.json +4 -9
- package/scripts/launcher.mjs +1 -1
- package/scripts/pick-folder.ps1 +2 -11
- package/scripts/release.mjs +31 -11
- package/scripts/verify-package.mjs +0 -53
- package/src/app/api/config/route.ts +1 -4
- package/src/app/api/growth/route.ts +14 -14
- package/src/app/api/models/route.ts +2 -1
- package/src/app/api/security/route.ts +3 -8
- package/src/app/api/update/route.ts +2 -8
- package/src/app/globals.css +90 -777
- package/src/app/layout.tsx +6 -13
- package/src/components/AppShell.tsx +229 -521
- package/src/components/ChatInput.tsx +26 -153
- package/src/components/ChatWindow.tsx +231 -51
- package/src/components/ContextMeter.tsx +17 -11
- package/src/components/FileViewer.tsx +11 -10
- package/src/components/GitPanel.tsx +11 -13
- package/src/components/ModelSelector.tsx +6 -19
- package/src/components/PiMark.tsx +38 -5
- package/src/components/ProjectPanel.tsx +111 -95
- package/src/components/PromptPanel.tsx +51 -132
- package/src/components/SessionImportSection.tsx +37 -53
- package/src/components/SessionSidebar.tsx +57 -159
- package/src/components/SettingsPanel.tsx +193 -330
- package/src/components/icons.tsx +0 -23
- package/src/hooks/useGrowth.ts +123 -156
- package/src/hooks/usePiWeb.ts +15 -122
- package/src/i18n.tsx +42 -98
- package/src/lib/agent-manager.ts +21 -187
- package/src/lib/command-validation.ts +1 -9
- package/src/lib/growth-service.ts +390 -166
- package/src/lib/growth-tracker.ts +64 -264
- package/src/lib/growth-turns.ts +31 -1
- package/src/lib/models/model-scope.ts +15 -0
- package/src/lib/models-service.ts +16 -0
- package/src/lib/pi-settings.ts +7 -0
- package/src/lib/pi.ts +2 -3
- package/src/lib/session-import/claude.ts +2 -13
- package/src/lib/session-import/codex.ts +8 -44
- package/src/lib/session-import/files.ts +0 -14
- package/src/lib/session-import/grok.ts +24 -54
- package/src/lib/session-import/index.ts +0 -5
- package/src/lib/session-import/types.ts +0 -12
- package/src/lib/session-import/writer.ts +3 -8
- package/src/lib/skills-service.ts +9 -16
- package/src/lib/theme.ts +1 -68
- package/src/lib/trajectory.ts +0 -1
- package/src/lib/types.ts +27 -36
- package/tsconfig.json +2 -1
- package/.next/server/app/api/swarm/[id]/route.js +0 -1
- package/.next/server/app/api/swarm/[id]/route.js.nft.json +0 -1
- package/.next/server/app/api/swarm/[id]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/swarm/route.js +0 -1
- package/.next/server/app/api/swarm/route.js.nft.json +0 -1
- package/.next/server/app/api/swarm/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/tests/route.js +0 -2
- package/.next/server/app/api/tests/route.js.nft.json +0 -1
- package/.next/server/app/api/tests/route_client-reference-manifest.js +0 -1
- package/.next/server/chunks/757.js +0 -1
- package/.next/server/chunks/775.js +0 -3
- package/.next/static/0t1jBUAuVaTFTXxRyIo3q/_buildManifest.js +0 -1
- package/.next/static/chunks/2608.43c58236c9cce8e6.js +0 -1
- package/.next/static/chunks/2716.4ec42df1d51354c9.js +0 -1
- package/.next/static/chunks/4632.62139b565b657aac.js +0 -1
- package/.next/static/chunks/4673.7796104395deb8d7.js +0 -1
- package/.next/static/chunks/4686-17f21a006739a596.js +0 -1
- package/.next/static/chunks/7577.10af9bb661652da8.js +0 -1
- package/.next/static/chunks/8866.38ec4ac4ee5a1b74.js +0 -1
- package/.next/static/chunks/app/_global-error/page-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/tree/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/config/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/files/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/git/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/growth/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/health/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/models/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/pi-settings/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/plugins/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/prompts/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/security/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/export/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/sessions/import/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/skills/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/swarm/[id]/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/swarm/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/tests/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/update/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/version/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/web-auth/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/api/workspaces/route-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/app/page-14379b8060d5cf07.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-5148173b3f55e415.js +0 -1
- package/.next/static/chunks/webpack-d1a69ad9edb38b11.js +0 -1
- package/.next/static/css/d0a0162cb481abe8.css +0 -1
- package/.next/types/app/api/swarm/[id]/route.ts +0 -353
- package/.next/types/app/api/swarm/route.ts +0 -353
- package/.next/types/app/api/tests/route.ts +0 -353
- package/assets/archive.png +0 -0
- package/assets/growth-1.png +0 -0
- package/assets/growth-2.png +0 -0
- package/assets/import.png +0 -0
- package/assets/main.png +0 -0
- package/assets/outline.png +0 -0
- package/assets/prompts-1.png +0 -0
- package/assets/prompts-2.png +0 -0
- package/assets/providers-1.png +0 -0
- package/assets/providers-2.png +0 -0
- package/assets/providers-3.png +0 -0
- package/assets/trace-1.png +0 -0
- package/assets/viewer-1.png +0 -0
- package/assets/viewer-2.png +0 -0
- package/scripts/managed-niubash-assets.mjs +0 -146
- package/scripts/prepare-niubash-packages.mjs +0 -182
- package/scripts/run-test-file.mjs +0 -34
- package/scripts/smoke-managed-niubash.mjs +0 -62
- package/scripts/verify-release-config.mjs +0 -24
- package/src/app/api/swarm/[id]/route.ts +0 -28
- package/src/app/api/swarm/route.ts +0 -24
- package/src/app/api/tests/route.ts +0 -27
- package/src/components/SwarmCoordinatorPod.tsx +0 -1021
- package/src/components/TestInspectorPod.tsx +0 -549
- package/src/lib/delegation.ts +0 -93
- package/src/lib/growth-rounds.ts +0 -84
- package/src/lib/managed-niubash.ts +0 -231
- package/src/lib/runtime-activity.ts +0 -27
- package/src/lib/session-import/lock.ts +0 -25
- package/src/lib/swarm-service.ts +0 -371
- package/src/lib/test-run-service.ts +0 -122
- package/src/lib/workflow.ts +0 -55
- /package/.next/static/{0t1jBUAuVaTFTXxRyIo3q → zsynuO_9Kx6nrXgkTUJ04}/_ssgManifest.js +0 -0
package/scripts/release.mjs
CHANGED
|
@@ -2,7 +2,8 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
|
-
import {
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
6
7
|
import { assertInstallation, assertLocalPath, readProductionBuild, resolveBuildOutput, RELEASES_DIR, RELEASE_MANIFEST } from "./build-output.mjs";
|
|
7
8
|
import { runCommand } from "./process-runner.mjs";
|
|
8
9
|
import { isMainModule } from "./entrypoint.mjs";
|
|
@@ -76,6 +77,21 @@ async function writeReleaseTypeConfig(root, buildDir) {
|
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
/** Run in a fresh process, after install/pull, so cached config/Next modules cannot lie. */
|
|
81
|
+
export async function verifyReleaseConfig(root = process.cwd(), env = process.env) {
|
|
82
|
+
const installation = assertInstallation(root);
|
|
83
|
+
const buildDir = resolveBuildOutput(installation, env.PIWEB_BUILD_DIR);
|
|
84
|
+
if (!buildDir.startsWith(`${RELEASES_DIR}/`)) throw new Error("release requires an isolated build output");
|
|
85
|
+
const require = createRequire(path.join(installation, "package.json"));
|
|
86
|
+
const module = await import(pathToFileURL(require.resolve("next/dist/server/config.js")).href);
|
|
87
|
+
const loadConfig = typeof module.default === "function" ? module.default : module.default.default;
|
|
88
|
+
const { PHASE_PRODUCTION_BUILD } = require("next/constants");
|
|
89
|
+
const config = await loadConfig(PHASE_PRODUCTION_BUILD, installation, { silent: true });
|
|
90
|
+
if (config.distDir !== buildDir || config.typescript?.tsconfigPath !== CONFIG_PATH || config.typescript?.ignoreBuildErrors) {
|
|
91
|
+
throw new Error("Next config does not honor the isolated release directory/typecheck; refusing to build over the serving output");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
79
95
|
export const PI_PACKAGE = "@earendil-works/pi-coding-agent";
|
|
80
96
|
const PI_AI_PACKAGE = "@earendil-works/pi-ai";
|
|
81
97
|
|
|
@@ -134,7 +150,7 @@ export async function prepareRelease({ root = ROOT, env = process.env, run = run
|
|
|
134
150
|
signal?.throwIfAborted();
|
|
135
151
|
assertInstallation(installation);
|
|
136
152
|
await writeReleaseTypeConfig(installation, buildDir);
|
|
137
|
-
await run(process.execPath, [path.join(installation, "scripts", "
|
|
153
|
+
await run(process.execPath, [path.join(installation, "scripts", "release.mjs"), "--verify-config"], {
|
|
138
154
|
cwd: installation, env: childEnv, timeoutMs: 60_000, signal,
|
|
139
155
|
});
|
|
140
156
|
await run("npm", ["run", "check"], { cwd: installation, env: childEnv, timeoutMs: 600_000, signal });
|
|
@@ -159,15 +175,19 @@ if (isMainModule(import.meta.url)) {
|
|
|
159
175
|
process.once("SIGINT", cancel);
|
|
160
176
|
process.once("SIGTERM", cancel);
|
|
161
177
|
try {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
178
|
+
if (process.argv.length === 3 && process.argv[2] === "--verify-config") {
|
|
179
|
+
await verifyReleaseConfig();
|
|
180
|
+
} else {
|
|
181
|
+
const updatePi = process.argv.length === 3 && process.argv[2] === "--update-pi";
|
|
182
|
+
if (process.argv.length > 2 && !updatePi) throw new Error("Usage: node scripts/release.mjs [--update-pi]");
|
|
183
|
+
console.log("[piweb] Checking and building an isolated release; the existing server is not restarted.");
|
|
184
|
+
if (updatePi) console.log("[piweb] Pi dependency update: use a maintenance window with no active sessions; node_modules is shared.");
|
|
185
|
+
const release = await prepareRelease({
|
|
186
|
+
signal: controller.signal,
|
|
187
|
+
prepare: updatePi ? async (context) => { await installPiUpdate(context); } : undefined,
|
|
188
|
+
});
|
|
189
|
+
console.log(`[piweb] Release ready: ${release.buildDir} (${release.buildId}). Restart PiWeb manually when idle to use it.`);
|
|
190
|
+
}
|
|
171
191
|
} catch (error) {
|
|
172
192
|
console.error(`[piweb] Release failed: ${error instanceof Error ? error.message : error}`);
|
|
173
193
|
process.exitCode = 1;
|
|
@@ -13,15 +13,9 @@ import fs from "node:fs";
|
|
|
13
13
|
import os from "node:os";
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
import { spawnSync } from "node:child_process";
|
|
16
|
-
import { createRequire } from "node:module";
|
|
17
16
|
import { fileURLToPath } from "node:url";
|
|
18
17
|
import { readProductionBuild } from "./build-output.mjs";
|
|
19
18
|
import { isMainModule } from "./entrypoint.mjs";
|
|
20
|
-
import {
|
|
21
|
-
MANAGED_NIUBASH_ASSETS,
|
|
22
|
-
NIUBASH_DISTRIBUTION_VERSION,
|
|
23
|
-
validateManagedNiubashPackage,
|
|
24
|
-
} from "./managed-niubash-assets.mjs";
|
|
25
19
|
|
|
26
20
|
const DEFAULT_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
27
21
|
|
|
@@ -72,56 +66,9 @@ export function verifyPackedPackage(root, { log = console.log } = {}) {
|
|
|
72
66
|
}
|
|
73
67
|
}
|
|
74
68
|
|
|
75
|
-
/** Pack and inspect one actual OS/CPU package, including every runtime hash and license. */
|
|
76
|
-
export function verifyPackedManagedNiubashPackage(packageRoot, asset, { log = console.log } = {}) {
|
|
77
|
-
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), `piweb-niubash-pack-${asset.arch}-`));
|
|
78
|
-
try {
|
|
79
|
-
const packed = JSON.parse(runNpm(["pack", "--json", "--pack-destination", tmp], { cwd: packageRoot }));
|
|
80
|
-
const entry = Array.isArray(packed) ? packed[0] : packed;
|
|
81
|
-
if (!entry?.filename) throw new Error(`npm pack produced no tarball for ${asset.packageName}`);
|
|
82
|
-
const files = (entry.files ?? []).map((file) => String(file.path).replaceAll("\\", "/").replace(/^package\//, ""));
|
|
83
|
-
for (const required of [
|
|
84
|
-
"package.json", "index.cjs", "runtime-manifest.json", "runtime/niu.exe",
|
|
85
|
-
"runtime/winuxcmd/usr/bin/winuxcmd.exe", "runtime/bundles/oh-my-niu/bundle.toml",
|
|
86
|
-
"licenses/NIUBASH.txt", "licenses/RUBASH.txt", "licenses/WINUXCMD.txt",
|
|
87
|
-
]) {
|
|
88
|
-
if (!files.includes(required)) throw new Error(`${asset.packageName} tarball is missing ${required}`);
|
|
89
|
-
}
|
|
90
|
-
const unpacked = path.join(tmp, "unpacked");
|
|
91
|
-
fs.mkdirSync(unpacked, { recursive: true });
|
|
92
|
-
run("tar", ["-xzf", entry.filename, "-C", "unpacked"], { cwd: tmp });
|
|
93
|
-
const installedRoot = path.join(unpacked, "package");
|
|
94
|
-
const checked = validateManagedNiubashPackage(installedRoot, asset, { allowExtraRuntimeFiles: false });
|
|
95
|
-
const require = createRequire(path.join(installedRoot, "package.json"));
|
|
96
|
-
const exported = require(path.join(installedRoot, "index.cjs"));
|
|
97
|
-
if (exported.packageName !== asset.packageName || exported.arch !== asset.arch
|
|
98
|
-
|| exported.shellPath !== path.join(installedRoot, "runtime", "niu.exe")) {
|
|
99
|
-
throw new Error(`${asset.packageName} has an invalid runtime export`);
|
|
100
|
-
}
|
|
101
|
-
const bytes = fs.statSync(path.join(tmp, entry.filename)).size;
|
|
102
|
-
log(`[piweb] ${entry.filename}: ${checked.files} runtime files, ${(bytes / 1024 / 1024).toFixed(1)} MB.`);
|
|
103
|
-
return { filename: entry.filename, files, bytes, runtimeFiles: checked.files };
|
|
104
|
-
} finally {
|
|
105
|
-
fs.rmSync(tmp, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function verifyManagedNiubashPackages(root, { log = console.log } = {}) {
|
|
110
|
-
const manifest = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
111
|
-
const results = [];
|
|
112
|
-
for (const asset of Object.values(MANAGED_NIUBASH_ASSETS)) {
|
|
113
|
-
if (manifest.optionalDependencies?.[asset.packageName] !== NIUBASH_DISTRIBUTION_VERSION) {
|
|
114
|
-
throw new Error(`PiWeb must use exact optional dependency ${asset.packageName}@${NIUBASH_DISTRIBUTION_VERSION}`);
|
|
115
|
-
}
|
|
116
|
-
results.push(verifyPackedManagedNiubashPackage(path.join(root, "platform-packages", asset.directory), asset, { log }));
|
|
117
|
-
}
|
|
118
|
-
return results;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
69
|
if (isMainModule(import.meta.url)) {
|
|
122
70
|
try {
|
|
123
71
|
verifyPackedPackage(DEFAULT_ROOT);
|
|
124
|
-
verifyManagedNiubashPackages(DEFAULT_ROOT);
|
|
125
72
|
} catch (error) {
|
|
126
73
|
console.error(`[piweb] ${error instanceof Error ? error.message : error}`);
|
|
127
74
|
process.exitCode = 1;
|
|
@@ -9,10 +9,7 @@ export const dynamic = "force-dynamic";
|
|
|
9
9
|
export async function GET() {
|
|
10
10
|
try {
|
|
11
11
|
const file = path.join(getAgentDir(), "settings.json");
|
|
12
|
-
const content = await fs.readFile(file, "utf8")
|
|
13
|
-
if (error.code === "ENOENT") return "{}\n";
|
|
14
|
-
throw error;
|
|
15
|
-
});
|
|
12
|
+
const content = await fs.readFile(file, "utf8");
|
|
16
13
|
return new Response(content, {
|
|
17
14
|
headers: {
|
|
18
15
|
"Content-Type": "application/json; charset=utf-8",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
|
-
import { getManaged,
|
|
3
|
-
import { GrowthError, changesBetween, fileContent, filePatch, isAvailable, listTree,
|
|
2
|
+
import { getManaged, growthRecord } from "@/lib/agent-manager";
|
|
3
|
+
import { GrowthError, changesBetween, fileContent, filePatch, isAvailable, listTree, readRounds } from "@/lib/growth-service";
|
|
4
4
|
import { BoundaryError, resolveSessionPath, resolveWorkspacePath } from "@/lib/path-security";
|
|
5
5
|
|
|
6
6
|
export const dynamic = "force-dynamic";
|
|
@@ -12,12 +12,12 @@ function status(err: unknown): number {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* ?cwd=&session=<jsonl 路径>
|
|
17
|
-
* ?cwd=&tree=<hash>&list=1
|
|
18
|
-
* ?cwd=&from=<tree>&to=<tree>&changes=1
|
|
15
|
+
* 项目生长(每轮一个 git commit)只读接口:
|
|
16
|
+
* ?cwd=&session=<jsonl 路径> 本会话的轮次(省略 session = 工作区全部 commit)
|
|
17
|
+
* ?cwd=&tree=<hash>&list=1 某一轮的文件清单
|
|
18
|
+
* ?cwd=&from=<tree>&to=<tree>&changes=1 两轮之间的变更清单
|
|
19
19
|
* ?cwd=&from=&to=&path=[&renamedFrom=] 单文件整文件上下文的 unified diff
|
|
20
|
-
* ?cwd=&tree=&path=&content=1
|
|
20
|
+
* ?cwd=&tree=&path=&content=1 某一轮里单文件全文
|
|
21
21
|
*/
|
|
22
22
|
export async function GET(req: Request) {
|
|
23
23
|
const url = new URL(req.url);
|
|
@@ -29,21 +29,21 @@ export async function GET(req: Request) {
|
|
|
29
29
|
if (q("content") === "1") return NextResponse.json({ success: true, data: await fileContent(cwd, q("tree"), q("path")) });
|
|
30
30
|
if (q("path") !== null) return NextResponse.json({ success: true, data: await filePatch(cwd, q("from"), q("to"), q("path"), q("renamedFrom") ?? undefined) });
|
|
31
31
|
const available = await isAvailable();
|
|
32
|
-
if (!available) return NextResponse.json({ success: true, data: { available: false,
|
|
33
|
-
return NextResponse.json({ success: true, data: { available: true,
|
|
32
|
+
if (!available) return NextResponse.json({ success: true, data: { available: false, rounds: [] } });
|
|
33
|
+
return NextResponse.json({ success: true, data: { available: true, rounds: await readRounds(cwd, q("session") ?? undefined) } });
|
|
34
34
|
} catch (err: any) {
|
|
35
35
|
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: status(err) });
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/** POST { action: "
|
|
39
|
+
/** POST { action: "record", session: <会话 id> }:立即记录,把当前改动提交为「你的修改」(并广播给会话订阅者) */
|
|
40
40
|
export async function POST(req: Request) {
|
|
41
41
|
try {
|
|
42
|
-
const body = (await req.json()) as { action?: string; session?: unknown
|
|
43
|
-
if (body.action !== "
|
|
42
|
+
const body = (await req.json()) as { action?: string; session?: unknown };
|
|
43
|
+
if (body.action !== "record") return NextResponse.json({ success: false, error: "unknown action" }, { status: 400 });
|
|
44
44
|
const sessionPath = await resolveSessionPath(String(body.session ?? ""), { allowPending: true });
|
|
45
|
-
const
|
|
46
|
-
return NextResponse.json({ success: true, data: {
|
|
45
|
+
const round = await growthRecord(getManaged(sessionPath));
|
|
46
|
+
return NextResponse.json({ success: true, data: { round } });
|
|
47
47
|
} catch (err: any) {
|
|
48
48
|
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: err instanceof SyntaxError ? 400 : status(err) });
|
|
49
49
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CustomProvidersValidationError,
|
|
8
8
|
discoverModels,
|
|
9
9
|
listModels,
|
|
10
|
+
listModelsForPiWeb,
|
|
10
11
|
loginState,
|
|
11
12
|
providerUsage,
|
|
12
13
|
readCustomProviders,
|
|
@@ -37,7 +38,7 @@ export async function GET(req: Request) {
|
|
|
37
38
|
const full = custom || params.get("full") === "1";
|
|
38
39
|
try {
|
|
39
40
|
const customProviders = custom ? await readCustomProviders() : null;
|
|
40
|
-
const data = await listModels();
|
|
41
|
+
const data = await (full ? listModels() : listModelsForPiWeb());
|
|
41
42
|
// 页面挂载只需要选模型用的字段(1300+ 个模型带 api/baseUrl/cost/input 有 400KB);设置页用 custom=1 拿完整版
|
|
42
43
|
const models = full
|
|
43
44
|
? data.models
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import type { ProjectTrust } from "@/lib/security-service";
|
|
3
3
|
import { getSecurity, setProjectTrust } from "@/lib/security-service";
|
|
4
|
-
import { reloadLoader,
|
|
4
|
+
import { reloadLoader, setProjectTrust as setProjectTrustDecision } from "@/lib/pi";
|
|
5
5
|
import { reloadSessionsForCwd } from "@/lib/agent-manager";
|
|
6
6
|
import { BoundaryError, resolveWorkspacePath } from "@/lib/path-security";
|
|
7
7
|
|
|
8
8
|
export const dynamic = "force-dynamic";
|
|
9
9
|
|
|
10
|
-
export async function GET(
|
|
10
|
+
export async function GET() {
|
|
11
11
|
try {
|
|
12
|
-
const params = new URL(req.url).searchParams;
|
|
13
|
-
if (params.has("cwd")) {
|
|
14
|
-
const cwd = await resolveWorkspacePath(params.get("cwd"));
|
|
15
|
-
return NextResponse.json({ success: true, data: resolveProjectTrust(cwd) });
|
|
16
|
-
}
|
|
17
12
|
return NextResponse.json({ success: true, data: await getSecurity() });
|
|
18
13
|
} catch (err: any) {
|
|
19
|
-
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status:
|
|
14
|
+
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: 500 });
|
|
20
15
|
}
|
|
21
16
|
}
|
|
22
17
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import { checkForUpdate, runUpdate, UpdateBusyError, type UpdateTarget } from "@/lib/update-service";
|
|
3
3
|
import { activeStatus } from "@/lib/agent-manager";
|
|
4
|
-
import { beginMaintenance, RuntimeBusyError } from "@/lib/runtime-activity";
|
|
5
4
|
|
|
6
5
|
export const dynamic = "force-dynamic";
|
|
7
6
|
|
|
@@ -25,15 +24,10 @@ export async function POST(req: Request) {
|
|
|
25
24
|
};
|
|
26
25
|
// Check before even taking a release lock; rechecked before each mutating step.
|
|
27
26
|
await assertIdle();
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
return NextResponse.json({ success: true, data: await runUpdate(target, { assertIdle }) });
|
|
31
|
-
} finally {
|
|
32
|
-
releaseMaintenance();
|
|
33
|
-
}
|
|
27
|
+
return NextResponse.json({ success: true, data: await runUpdate(target, { assertIdle }) });
|
|
34
28
|
} catch (error) {
|
|
35
29
|
return NextResponse.json({ success: false, error: error instanceof Error ? error.message : String(error) }, {
|
|
36
|
-
status: error instanceof UpdateBusyError
|
|
30
|
+
status: error instanceof UpdateBusyError ? 409 : 500,
|
|
37
31
|
});
|
|
38
32
|
}
|
|
39
33
|
}
|