{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/commands/prompt.ts"],"names":[],"mappings":"AAOA,UAAU,aAAa;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,aAAkB,iBAmEhG","sourcesContent":["import chalk from \"chalk\";\nimport { getActivePod, loadConfig } from \"../config.js\";\n\n// ────────────────────────────────────────────────────────────────────────────────\n// Types\n// ────────────────────────────────────────────────────────────────────────────────\n\ninterface PromptOptions {\n\tpod?: string;\n\tapiKey?: string;\n}\n\n// ────────────────────────────────────────────────────────────────────────────────\n// Main prompt function\n// ────────────────────────────────────────────────────────────────────────────────\n\nexport async function promptModel(modelName: string, userArgs: string[], opts: PromptOptions = {}) {\n\t// Get pod and model configuration\n\tconst activePod = opts.pod ? { name: opts.pod, pod: loadConfig().pods[opts.pod] } : getActivePod();\n\n\tif (!activePod) {\n\t\tconsole.error(chalk.red(\"No active pod. Use 'pi pods active <name>' to set one.\"));\n\t\tprocess.exit(1);\n\t}\n\n\tconst { name: podName, pod } = activePod;\n\tconst modelConfig = pod.models[modelName];\n\n\tif (!modelConfig) {\n\t\tconsole.error(chalk.red(`Model '${modelName}' not found on pod '${podName}'`));\n\t\tprocess.exit(1);\n\t}\n\n\t// Extract host from SSH string\n\tconst host =\n\t\tpod.ssh\n\t\t\t.split(\" \")\n\t\t\t.find((p) => p.includes(\"@\"))\n\t\t\t?.split(\"@\")[1] ?? \"localhost\";\n\n\t// Build the system prompt for code navigation\n\tconst systemPrompt = `You help the user understand and navigate the codebase in the current working directory.\n\nYou can read files, list directories, and execute shell commands via the respective tools.\n\nDo not output file contents you read via the read_file tool directly, unless asked to.\n\nDo not output markdown tables as part of your responses.\n\nKeep your responses concise and relevant to the user's request.\n\nFile paths you output must include line numbers where possible, e.g. \"src/index.ts:10-20\" for lines 10 to 20 in src/index.ts.\n\nCurrent working directory: ${process.cwd()}`;\n\n\t// Build arguments for agent main function\n\tconst args: string[] = [];\n\n\t// Add base configuration that we control\n\targs.push(\n\t\t\"--base-url\",\n\t\t`http://${host}:${modelConfig.port}/v1`,\n\t\t\"--model\",\n\t\tmodelConfig.model,\n\t\t\"--api-key\",\n\t\topts.apiKey || process.env.PI_API_KEY || \"dummy\",\n\t\t\"--api\",\n\t\tmodelConfig.model.toLowerCase().includes(\"gpt-oss\") ? \"responses\" : \"completions\",\n\t\t\"--system-prompt\",\n\t\tsystemPrompt,\n\t);\n\n\t// Pass through all user-provided arguments\n\t// This includes messages, --continue, --json, etc.\n\targs.push(...userArgs);\n\n\t// Call agent main function directly\n\ttry {\n\t\tthrow new Error(\"Not implemented\");\n\t} catch (err: any) {\n\t\tconsole.error(chalk.red(`Agent error: ${err.message}`));\n\t\tprocess.exit(1);\n\t}\n}\n"]}