diff --git a/.changeset/agent-runtime-config.md b/.changeset/agent-runtime-config.md new file mode 100644 index 00000000..3696b47a --- /dev/null +++ b/.changeset/agent-runtime-config.md @@ -0,0 +1,5 @@ +--- +"@jmfederico/pi-web": patch +--- + +Add configurable Pi-compatible agent command and state-directory settings for diagnostics, update checks, auth, models, sessions, and settings. diff --git a/docs/config.html b/docs/config.html index 81a64436..795ff4e2 100644 --- a/docs/config.html +++ b/docs/config.html @@ -81,7 +81,7 @@
PI WEB configuration covers the machine-local and project-local settings you usually need: bind address, trusted development-host settings, UI preferences, PI WEB plugin enablement, file-explorer path access, - manual upload defaults, upload limits, and session-daemon tools. + manual upload defaults, upload limits, agent runtime selection, and session-daemon tools.
@@ -97,6 +97,7 @@
Environment overrides include PI_WEB_HOST, PI_WEB_PORT / PORT,
- PI_WEB_ALLOWED_HOSTS, PI_WEB_MAX_UPLOAD_BYTES, PI_WEB_SPAWN_SESSIONS,
- and PI_WEB_SUBSESSIONS.
+ PI_WEB_ALLOWED_HOSTS, PI_WEB_MAX_UPLOAD_BYTES, PI_WEB_AGENT_COMMAND,
+ PI_WEB_AGENT_DIR, PI_WEB_AGENT_SESSION_DIR,
+ PI_CODING_AGENT_DIR / PI_CODING_AGENT_SESSION_DIR for the default
+ pi command, the selected non-pi command's
+ <COMMAND>_CODING_AGENT_DIR / <COMMAND>_CODING_AGENT_SESSION_DIR,
+ PI_WEB_SPAWN_SESSIONS, and PI_WEB_SUBSESSIONS.
host / port: restart the gateway web/API service or process.maxUploadBytes: restart both the web/API process and the session daemon on that machine.agent.command / agent.dir: restart the web/API process and the session daemon on that machine.spawnSessions / subsessions: restart the session daemon on that machine.pathAccess: applies on the next request; existing file views may need a browser refresh.uploads.defaultFolder: applies to newly opened Files upload dialogs and new direct drag/drop batches after config/workspace refresh.— are runtime-only environment variables, not config-file keys. Global means
machine-global. In Settings, selected-machine-safe global keys (pathAccess, uploads,
- maxUploadBytes, spawnSessions, subsessions, and plugins)
- are edited for the selected machine; gateway host/port/allowed-hosts, keyboard shortcuts, and machine
+ maxUploadBytes, agent, spawnSessions, subsessions,
+ and plugins) are edited for the selected machine; gateway host/port/allowed-hosts, keyboard shortcuts, and machine
registry/tokens stay local.
agent.commandPI_WEB_AGENT_COMMANDagent.dirPI_WEB_AGENT_DIR, PI_CODING_AGENT_DIR for pi, selected non-pi command's <COMMAND>_CODING_AGENT_DIRspawnSessionsPI_CODING_AGENT_SESSION_DIRPI_WEB_AGENT_SESSION_DIR, PI_CODING_AGENT_SESSION_DIR for pi, selected non-pi command's <COMMAND>_CODING_AGENT_SESSION_DIRPI_CODING_AGENT_DIRPI_WEB_AGENT_DIR, PI_CODING_AGENT_DIR for pi, selected non-pi command's <COMMAND>_CODING_AGENT_DIR
+ agent.command controls which Pi-compatible CLI PI WEB checks in doctor/status/update flows.
+ It defaults to pi. PI WEB's embedded session runtime still uses the bundled SDK path; changing
+ this command does not load a different session implementation.
+
+ agent.dir controls which compatible agent state directory PI WEB reads for auth providers,
+ model settings, settings, and session metadata. It defaults to ~/.pi/agent only when the
+ selected command resolves to pi. For any other command, set agent.dir,
+ PI_WEB_AGENT_DIR, or the selected command's <COMMAND>_CODING_AGENT_DIR explicitly.
+
{
+ "agent": {
+ "command": "my-pi-fork",
+ "dir": "/opt/my-pi-fork/agent"
+ }
+}
+
+ For example, an OMP setup can use "command": "omp" with
+ "dir": "~/.omp/agent" and, if needed, OMP_CODING_AGENT_DIR /
+ OMP_CODING_AGENT_SESSION_DIR environment overrides.
+
+ Environment variables take precedence over the config file. PI_WEB_AGENT_COMMAND selects the
+ command, PI_WEB_AGENT_DIR sets the state directory for any command, and command-specific
+ variables are honored for compatible runtimes.
+
+ Command-specific environment names are derived from the selected command's basename by stripping common
+ executable extensions, replacing non-alphanumeric characters with underscores, and uppercasing the result.
+ For example, my-pi-fork uses MY_PI_FORK_CODING_AGENT_DIR and
+ MY_PI_FORK_CODING_AGENT_SESSION_DIR.
+
+ Session directory overrides are environment-only. Set PI_WEB_AGENT_SESSION_DIR or the selected
+ command's session variable when you need to override session storage separately from agent.dir.
+
spawnSessionsEnter the API key for ${state.provider.name}. It will be stored by pi in auth.json.
Enter the API key for ${state.provider.name}. It will be stored in the configured agent auth.json.
${config.path}
pi commands require an explicit state directory, then a session daemon restart.
+ pi-web restart on that machine (or restart its session daemon service) after changing these settings.`,
+ content: html`run pi-web restart on that machine after changing these settings. If restarting services manually, restart both web/API and session daemon after changing the agent command or state directory.`,
});
}
return notices;
@@ -102,6 +155,11 @@ export class SettingsSessiondPanel extends LitElement {
return html` {
+async function getSessiondComponentStatus(daemon: PiWebStatusDaemon, options: PiWebStatusOptions = {}): Promise