Remove hardcoded mevy runtime identity
Replace remaining executable-code mevy assumptions with config-derived values. This updates operator messaging, runtime prompts, agent-task role defaults, inspect-system fallbacks, and OpenRouter metadata headers to follow PLATFORM_SERVICE_NAME, PLATFORM_ID, TENANT_ID, and PROJECT_ROOT instead of the live example tenant. --- Build: pass | Tests: FAIL — Tests 3 failed | 2089 passed (2092)
This commit is contained in:
parent
d1746cf3e5
commit
8c4b8a88ef
6 changed files with 16 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { CONTROLPLANE_INTERNAL_DOMAIN } from '../src/config.js';
|
import { CONTROLPLANE_INTERNAL_DOMAIN, TENANT_ID } from '../src/config.js';
|
||||||
|
|
||||||
const API_PORT = parseInt(process.env.CONTROLPLANE_PORT ?? '3100', 10);
|
const API_PORT = parseInt(process.env.CONTROLPLANE_PORT ?? '3100', 10);
|
||||||
const API_HOST = process.env.CONTROLPLANE_BIND_HOST ?? '127.0.0.1';
|
const API_HOST = process.env.CONTROLPLANE_BIND_HOST ?? '127.0.0.1';
|
||||||
|
|
@ -9,7 +9,7 @@ const KNOWN_ROLES = new Set([
|
||||||
'sysadmin',
|
'sysadmin',
|
||||||
'db-admin',
|
'db-admin',
|
||||||
'git-admin',
|
'git-admin',
|
||||||
'mevy',
|
TENANT_ID,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const arg1 = process.argv[2];
|
const arg1 = process.argv[2];
|
||||||
|
|
|
||||||
|
|
@ -155,14 +155,19 @@ HOSTNAME_VALUE="$(hostname 2>/dev/null || echo unknown)"
|
||||||
FREEBSD_VERSION="$(tr -d '\r' <"$OUTPUT_DIR/freebsd-version.txt" | head -n 1 || true)"
|
FREEBSD_VERSION="$(tr -d '\r' <"$OUTPUT_DIR/freebsd-version.txt" | head -n 1 || true)"
|
||||||
UNAME_VALUE="$(tr -d '\r' <"$OUTPUT_DIR/uname.txt" | head -n 1 || true)"
|
UNAME_VALUE="$(tr -d '\r' <"$OUTPUT_DIR/uname.txt" | head -n 1 || true)"
|
||||||
|
|
||||||
|
PLATFORM_ID_VALUE="${PLATFORM_ID:-$(read_env_value PLATFORM_ID 2>/dev/null || true)}"
|
||||||
|
if [ -z "$PLATFORM_ID_VALUE" ]; then
|
||||||
|
PLATFORM_ID_VALUE="clawdie"
|
||||||
|
fi
|
||||||
|
|
||||||
PLATFORM_SERVICE_NAME="${PLATFORM_SERVICE_NAME:-$(read_env_value PLATFORM_SERVICE_NAME 2>/dev/null || true)}"
|
PLATFORM_SERVICE_NAME="${PLATFORM_SERVICE_NAME:-$(read_env_value PLATFORM_SERVICE_NAME 2>/dev/null || true)}"
|
||||||
if [ -z "$PLATFORM_SERVICE_NAME" ]; then
|
if [ -z "$PLATFORM_SERVICE_NAME" ]; then
|
||||||
PLATFORM_SERVICE_NAME="mevy"
|
PLATFORM_SERVICE_NAME="$PLATFORM_ID_VALUE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PLATFORM_RUNTIME_USER="${PLATFORM_RUNTIME_USER:-$(read_env_value PLATFORM_RUNTIME_USER 2>/dev/null || true)}"
|
PLATFORM_RUNTIME_USER="${PLATFORM_RUNTIME_USER:-$(read_env_value PLATFORM_RUNTIME_USER 2>/dev/null || true)}"
|
||||||
if [ -z "$PLATFORM_RUNTIME_USER" ]; then
|
if [ -z "$PLATFORM_RUNTIME_USER" ]; then
|
||||||
PLATFORM_RUNTIME_USER="mevy"
|
PLATFORM_RUNTIME_USER="$PLATFORM_SERVICE_NAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ZFS_PREFIX_VALUE="${ZFS_PREFIX:-$(read_env_value ZFS_PREFIX 2>/dev/null || true)}"
|
ZFS_PREFIX_VALUE="${ZFS_PREFIX:-$(read_env_value ZFS_PREFIX 2>/dev/null || true)}"
|
||||||
|
|
|
||||||
|
|
@ -419,9 +419,9 @@ export async function runJailAgent(
|
||||||
`State this accurately if asked — do not guess or substitute another model name.\n` +
|
`State this accurately if asked — do not guess or substitute another model name.\n` +
|
||||||
(modelGuide ? `Rule: ${modelGuide}\n` : '') +
|
(modelGuide ? `Rule: ${modelGuide}\n` : '') +
|
||||||
`Rule: Do not end your reply with a promise of future inspection or follow-up unless you are actually providing that follow-up in the same message. If there is no real async job, answer directly now.\n` +
|
`Rule: Do not end your reply with a promise of future inspection or follow-up unless you are actually providing that follow-up in the same message. If there is no real async job, answer directly now.\n` +
|
||||||
`Rule: The Mevy service runs as a FreeBSD rc.d service and executes \`node dist/index.js\` (not \`node src/index.ts\`). ` +
|
`Rule: The platform service runs as a FreeBSD rc.d service and executes \`node dist/index.js\` (not \`node src/index.ts\`). ` +
|
||||||
`Do not tell the operator to run \`just dev\` or start the service manually unless explicitly asked; instead, instruct to check \`sudo service ${PLATFORM_SERVICE_NAME} status\` and use \`sudo service ${PLATFORM_SERVICE_NAME} restart\` when needed.\n` +
|
`Do not tell the operator to run \`just dev\` or start the service manually unless explicitly asked; instead, instruct to check \`sudo service ${PLATFORM_SERVICE_NAME} status\` and use \`sudo service ${PLATFORM_SERVICE_NAME} restart\` when needed.\n` +
|
||||||
`Rule: Text-to-speech uses the \`edge-tts\` CLI provided by the repo wrapper at \`/home/mevy/mevy-ai/bin/edge-tts\`, which runs from a persistent uv venv at \`/home/mevy/mevy-ai/.venv-edge-tts\`. ` +
|
`Rule: Text-to-speech uses the \`edge-tts\` CLI provided by the repo wrapper at \`${path.join(PROJECT_ROOT, 'bin', 'edge-tts')}\`, which runs from a persistent uv venv at \`${path.join(PROJECT_ROOT, '.venv-edge-tts')}\`. ` +
|
||||||
`Do NOT suggest installing \`edge-tts\` via pip/pkg unless explicitly asked to change the installation method.`;
|
`Do NOT suggest installing \`edge-tts\` via pip/pkg unless explicitly asked to change the installation method.`;
|
||||||
const lowBudgetInfo = input.lowBudget
|
const lowBudgetInfo = input.lowBudget
|
||||||
? 'Rule: Budget is low for this chat. Keep responses concise (<= 200 words), avoid long lists, and ask for clarification rather than speculating.'
|
? 'Rule: Budget is low for this chat. Keep responses concise (<= 200 words), avoid long lists, and ask for clarification rather than speculating.'
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ async function requireAdmin(ctxArg: any): Promise<boolean> {
|
||||||
const id = ctxArg.from?.id;
|
const id = ctxArg.from?.id;
|
||||||
await replyAuthFailure(
|
await replyAuthFailure(
|
||||||
ctxArg,
|
ctxArg,
|
||||||
`Admin IDs not configured. Run /whoami and set TELEGRAM_ADMIN_IDS=${id ?? '<your-id>'} in .env, then restart mevy.`,
|
`Admin IDs not configured. Run /whoami and set TELEGRAM_ADMIN_IDS=${id ?? '<your-id>'} in .env, then restart ${PLATFORM_SERVICE_NAME}.`,
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { logger } from './logger.js';
|
import { logger } from './logger.js';
|
||||||
import OpenAI from 'openai';
|
import OpenAI from 'openai';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import { TENANT_ID } from './config.js';
|
||||||
|
|
||||||
let openaiClient: OpenAI | null = null;
|
let openaiClient: OpenAI | null = null;
|
||||||
let transcriptionReady = false;
|
let transcriptionReady = false;
|
||||||
|
|
@ -122,7 +123,7 @@ export function initTranscription(
|
||||||
baseURL: 'https://openrouter.ai/api/v1',
|
baseURL: 'https://openrouter.ai/api/v1',
|
||||||
defaultHeaders: {
|
defaultHeaders: {
|
||||||
'HTTP-Referer': 'https://codeberg.org/Clawdie/Clawdie-AI',
|
'HTTP-Referer': 'https://codeberg.org/Clawdie/Clawdie-AI',
|
||||||
'X-Title': 'mevy-ai',
|
'X-Title': `${TENANT_ID}-ai`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
transcriptionReady = true;
|
transcriptionReady = true;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import path from 'path';
|
||||||
|
|
||||||
import { readEnvFile } from './env.js';
|
import { readEnvFile } from './env.js';
|
||||||
import {
|
import {
|
||||||
|
TENANT_ID,
|
||||||
TMP_DIR,
|
TMP_DIR,
|
||||||
VISION_MAX_CHARS_PER_IMAGE,
|
VISION_MAX_CHARS_PER_IMAGE,
|
||||||
VISION_MAX_IMAGES,
|
VISION_MAX_IMAGES,
|
||||||
|
|
@ -89,7 +90,7 @@ async function describeImageOpenRouter(imagePath: string): Promise<string> {
|
||||||
Authorization: `Bearer ${key}`,
|
Authorization: `Bearer ${key}`,
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'HTTP-Referer': 'https://codeberg.org/Clawdie/Clawdie-AI',
|
'HTTP-Referer': 'https://codeberg.org/Clawdie/Clawdie-AI',
|
||||||
'X-Title': 'mevy-ai',
|
'X-Title': `${TENANT_ID}-ai`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue