mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 10:02:23 +00:00
feat(coding-agent): add PI_SHARE_VIEWER_URL env var for custom share viewer (#889)
This commit is contained in:
parent
cdca93173b
commit
0363a10c69
3 changed files with 19 additions and 2 deletions
|
|
@ -252,6 +252,7 @@ ${chalk.bold("Environment Variables:")}
|
||||||
AWS_BEARER_TOKEN_BEDROCK - Bedrock API key (bearer token)
|
AWS_BEARER_TOKEN_BEDROCK - Bedrock API key (bearer token)
|
||||||
AWS_REGION - AWS region for Amazon Bedrock (e.g., us-east-1)
|
AWS_REGION - AWS region for Amazon Bedrock (e.g., us-east-1)
|
||||||
${ENV_AGENT_DIR.padEnd(23)} - Session storage directory (default: ~/${CONFIG_DIR_NAME}/agent)
|
${ENV_AGENT_DIR.padEnd(23)} - Session storage directory (default: ~/${CONFIG_DIR_NAME}/agent)
|
||||||
|
PI_SHARE_VIEWER_URL - Base URL for /share command (default: https://buildwithpi.ai/session/)
|
||||||
|
|
||||||
${chalk.bold("Available Tools (default: read, bash, edit, write):")}
|
${chalk.bold("Available Tools (default: read, bash, edit, write):")}
|
||||||
read - Read file contents
|
read - Read file contents
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,14 @@ export const VERSION: string = pkg.version;
|
||||||
// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR
|
// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR
|
||||||
export const ENV_AGENT_DIR = `${APP_NAME.toUpperCase()}_CODING_AGENT_DIR`;
|
export const ENV_AGENT_DIR = `${APP_NAME.toUpperCase()}_CODING_AGENT_DIR`;
|
||||||
|
|
||||||
|
const DEFAULT_SHARE_VIEWER_URL = "https://buildwithpi.ai/session/";
|
||||||
|
|
||||||
|
/** Get the share viewer URL for a gist ID */
|
||||||
|
export function getShareViewerUrl(gistId: string): string {
|
||||||
|
const baseUrl = process.env.PI_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;
|
||||||
|
return `${baseUrl}#${gistId}`;
|
||||||
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// User Config Paths (~/.pi/agent/*)
|
// User Config Paths (~/.pi/agent/*)
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,15 @@ import {
|
||||||
visibleWidth,
|
visibleWidth,
|
||||||
} from "@mariozechner/pi-tui";
|
} from "@mariozechner/pi-tui";
|
||||||
import { spawn, spawnSync } from "child_process";
|
import { spawn, spawnSync } from "child_process";
|
||||||
import { APP_NAME, getAuthPath, getDebugLogPath, isBunBinary, isBunRuntime, VERSION } from "../../config.js";
|
import {
|
||||||
|
APP_NAME,
|
||||||
|
getAuthPath,
|
||||||
|
getDebugLogPath,
|
||||||
|
getShareViewerUrl,
|
||||||
|
isBunBinary,
|
||||||
|
isBunRuntime,
|
||||||
|
VERSION,
|
||||||
|
} from "../../config.js";
|
||||||
import type { AgentSession, AgentSessionEvent } from "../../core/agent-session.js";
|
import type { AgentSession, AgentSessionEvent } from "../../core/agent-session.js";
|
||||||
import type { CompactionResult } from "../../core/compaction/index.js";
|
import type { CompactionResult } from "../../core/compaction/index.js";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -3364,7 +3372,7 @@ export class InteractiveMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the preview URL
|
// Create the preview URL
|
||||||
const previewUrl = `https://buildwithpi.ai/session/#${gistId}`;
|
const previewUrl = getShareViewerUrl(gistId);
|
||||||
this.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
|
this.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
if (!loader.signal.aborted) {
|
if (!loader.signal.aborted) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue