chore: include runtime info in system prompt
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
|||||||
import type { ThinkLevel, VerboseLevel } from "../auto-reply/thinking.js";
|
import type { ThinkLevel, VerboseLevel } from "../auto-reply/thinking.js";
|
||||||
import { formatToolAggregate } from "../auto-reply/tool-meta.js";
|
import { formatToolAggregate } from "../auto-reply/tool-meta.js";
|
||||||
import type { ClawdisConfig } from "../config/config.js";
|
import type { ClawdisConfig } from "../config/config.js";
|
||||||
|
import { getMachineDisplayName } from "../infra/machine-name.js";
|
||||||
import { splitMediaFromOutput } from "../media/parse.js";
|
import { splitMediaFromOutput } from "../media/parse.js";
|
||||||
import { enqueueCommand } from "../process/command-queue.js";
|
import { enqueueCommand } from "../process/command-queue.js";
|
||||||
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
|
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
|
||||||
@@ -323,11 +324,20 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
const contextFiles = buildBootstrapContextFiles(bootstrapFiles);
|
const contextFiles = buildBootstrapContextFiles(bootstrapFiles);
|
||||||
const promptSkills = resolvePromptSkills(skillsSnapshot, skillEntries);
|
const promptSkills = resolvePromptSkills(skillsSnapshot, skillEntries);
|
||||||
const tools = createClawdisCodingTools();
|
const tools = createClawdisCodingTools();
|
||||||
|
const machineName = await getMachineDisplayName();
|
||||||
|
const runtimeInfo = {
|
||||||
|
host: machineName,
|
||||||
|
os: `${os.type()} ${os.release()}`,
|
||||||
|
arch: os.arch(),
|
||||||
|
node: process.version,
|
||||||
|
model: `${provider}/${modelId}`,
|
||||||
|
};
|
||||||
const systemPrompt = buildSystemPrompt({
|
const systemPrompt = buildSystemPrompt({
|
||||||
appendPrompt: buildAgentSystemPromptAppend({
|
appendPrompt: buildAgentSystemPromptAppend({
|
||||||
workspaceDir: resolvedWorkspace,
|
workspaceDir: resolvedWorkspace,
|
||||||
defaultThinkLevel: params.thinkLevel,
|
defaultThinkLevel: params.thinkLevel,
|
||||||
extraSystemPrompt: params.extraSystemPrompt,
|
extraSystemPrompt: params.extraSystemPrompt,
|
||||||
|
runtimeInfo,
|
||||||
}),
|
}),
|
||||||
contextFiles,
|
contextFiles,
|
||||||
skills: promptSkills,
|
skills: promptSkills,
|
||||||
|
|||||||
@@ -4,6 +4,13 @@ export function buildAgentSystemPromptAppend(params: {
|
|||||||
workspaceDir: string;
|
workspaceDir: string;
|
||||||
defaultThinkLevel?: ThinkLevel;
|
defaultThinkLevel?: ThinkLevel;
|
||||||
extraSystemPrompt?: string;
|
extraSystemPrompt?: string;
|
||||||
|
runtimeInfo?: {
|
||||||
|
host?: string;
|
||||||
|
os?: string;
|
||||||
|
arch?: string;
|
||||||
|
node?: string;
|
||||||
|
model?: string;
|
||||||
|
};
|
||||||
}) {
|
}) {
|
||||||
const thinkHint =
|
const thinkHint =
|
||||||
params.defaultThinkLevel && params.defaultThinkLevel !== "off"
|
params.defaultThinkLevel && params.defaultThinkLevel !== "off"
|
||||||
@@ -11,6 +18,17 @@ export function buildAgentSystemPromptAppend(params: {
|
|||||||
: "Default thinking level: off.";
|
: "Default thinking level: off.";
|
||||||
|
|
||||||
const extraSystemPrompt = params.extraSystemPrompt?.trim();
|
const extraSystemPrompt = params.extraSystemPrompt?.trim();
|
||||||
|
const runtimeInfo = params.runtimeInfo;
|
||||||
|
const runtimeLines: string[] = [];
|
||||||
|
if (runtimeInfo?.host) runtimeLines.push(`Host: ${runtimeInfo.host}`);
|
||||||
|
if (runtimeInfo?.os) {
|
||||||
|
const archSuffix = runtimeInfo.arch ? ` (${runtimeInfo.arch})` : "";
|
||||||
|
runtimeLines.push(`OS: ${runtimeInfo.os}${archSuffix}`);
|
||||||
|
} else if (runtimeInfo?.arch) {
|
||||||
|
runtimeLines.push(`Arch: ${runtimeInfo.arch}`);
|
||||||
|
}
|
||||||
|
if (runtimeInfo?.node) runtimeLines.push(`Node: ${runtimeInfo.node}`);
|
||||||
|
if (runtimeInfo?.model) runtimeLines.push(`Model: ${runtimeInfo.model}`);
|
||||||
|
|
||||||
const lines = [
|
const lines = [
|
||||||
"You are Clawd, a personal assistant running inside Clawdis.",
|
"You are Clawd, a personal assistant running inside Clawdis.",
|
||||||
@@ -51,6 +69,7 @@ export function buildAgentSystemPromptAppend(params: {
|
|||||||
'If something needs attention, do NOT include "HEARTBEAT_OK"; reply with the alert text instead.',
|
'If something needs attention, do NOT include "HEARTBEAT_OK"; reply with the alert text instead.',
|
||||||
"",
|
"",
|
||||||
"## Runtime",
|
"## Runtime",
|
||||||
|
...runtimeLines,
|
||||||
thinkHint,
|
thinkHint,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user