mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
more better panel stuff and promp
This commit is contained in:
@@ -11,7 +11,7 @@ Execution mode:
|
||||
- Decide what to do yourself each cycle.
|
||||
|
||||
Actions:
|
||||
- Use tool calls when actions are needed.
|
||||
- Use tool calls when actions or memory updates are needed.
|
||||
- Respect safety limits, lock policies, cooldowns, and blocked tools.
|
||||
- Do not invent tools.
|
||||
- Ask a question only if a required action parameter is missing.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
||||
<title>Multi Roomba Rover</title>
|
||||
<script type="module" crossorigin src="/assets/index-BP-0CHxN.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-D8G6mAM9.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CGvUXLso.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -49,6 +49,7 @@ const runtime = {
|
||||
generationCount: 0,
|
||||
generationTotalMs: 0,
|
||||
runHistory: [],
|
||||
liveToolCalls: [],
|
||||
memoryStore: loadMemory(),
|
||||
};
|
||||
|
||||
@@ -84,6 +85,7 @@ let status = {
|
||||
lastChatDraft: null,
|
||||
lastRequestedActions: null,
|
||||
lastActionResults: null,
|
||||
lastLiveToolCalls: null,
|
||||
lastOutcome: null,
|
||||
lastReason: null,
|
||||
lastError: null,
|
||||
@@ -108,6 +110,11 @@ function pushRun(run = {}) {
|
||||
runtime.runHistory = [...runtime.runHistory.slice(-(MAX_RUN_HISTORY - 1)), run];
|
||||
}
|
||||
|
||||
function pushLiveToolCall(entry = {}) {
|
||||
runtime.liveToolCalls = [...runtime.liveToolCalls.slice(-49), { at: Date.now(), ...entry }];
|
||||
updateStatus({ lastLiveToolCalls: runtime.liveToolCalls });
|
||||
}
|
||||
|
||||
async function readPrompt() {
|
||||
const raw = await fsp.readFile(PROMPT_PATH, 'utf8');
|
||||
const prompt = String(raw || '').replace(/<NAME>/g, name).trim();
|
||||
@@ -256,7 +263,9 @@ async function runDecision(triggerReason) {
|
||||
|
||||
if (decision === 'ACTION' || decision === 'ACTION+CHAT') {
|
||||
for (const action of requestedActions) {
|
||||
pushLiveToolCall({ phase: 'start', tool: action.tool, args: action.args });
|
||||
if (!toolState.availableIds.includes(action.tool)) {
|
||||
pushLiveToolCall({ phase: 'blocked', tool: action.tool, error: 'tool unavailable or blocked' });
|
||||
actionResults.push({ kind: 'tool', tool: action.tool, ok: false, error: 'tool unavailable or blocked' });
|
||||
continue;
|
||||
}
|
||||
@@ -274,8 +283,10 @@ async function runDecision(triggerReason) {
|
||||
if (result?.memory && typeof result.memory === 'object') {
|
||||
runtime.memoryStore = saveMemory(result.memory);
|
||||
}
|
||||
pushLiveToolCall({ phase: 'ok', tool: action.tool, result });
|
||||
actionResults.push({ kind: 'tool', tool: action.tool, ok: true, result });
|
||||
} catch (err) {
|
||||
pushLiveToolCall({ phase: 'error', tool: action.tool, error: err.message });
|
||||
actionResults.push({ kind: 'tool', tool: action.tool, ok: false, error: err.message });
|
||||
}
|
||||
}
|
||||
@@ -348,10 +359,11 @@ function emitStateToSocket(socket) {
|
||||
|
||||
function clearHistory() {
|
||||
runtime.runHistory = [];
|
||||
runtime.liveToolCalls = [];
|
||||
runtime.generationCount = 0;
|
||||
runtime.generationTotalMs = 0;
|
||||
runtime.memoryStore = saveMemory(createDefaultMemory());
|
||||
updateStatus({ lastReason: 'admin requested clear history', lastOutcome: 'cleared' });
|
||||
updateStatus({ lastReason: 'admin requested clear history', lastOutcome: 'cleared', lastLiveToolCalls: [] });
|
||||
}
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
|
||||
@@ -41,6 +41,7 @@ function buildAdminState(status, runHistory) {
|
||||
chat: status.lastChatDraft,
|
||||
actions: status.lastRequestedActions,
|
||||
actionResults: status.lastActionResults,
|
||||
liveToolCalls: status.lastLiveToolCalls || [],
|
||||
outputAt: status.lastModelOutputAt,
|
||||
outcome: status.lastOutcome,
|
||||
reason: status.lastReason,
|
||||
|
||||
@@ -17,6 +17,17 @@ export default function OverseerControlPanel({ state, onClearHistory, clearingHi
|
||||
const timings = state.timings || {};
|
||||
const input = state.input || {};
|
||||
const errors = state.errors || {};
|
||||
const renderModelMessages = () => {
|
||||
const messages = Array.isArray(input.modelMessages) ? input.modelMessages : [];
|
||||
if (!messages.length) return '<none>';
|
||||
return messages
|
||||
.map((msg, idx) => {
|
||||
const role = String(msg?.role || 'unknown').toUpperCase();
|
||||
const content = String(msg?.content || '');
|
||||
return `#${idx + 1} ${role}\n${content}`;
|
||||
})
|
||||
.join('\n\n----------------------------------------\n\n');
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-0.5">
|
||||
@@ -55,7 +66,7 @@ export default function OverseerControlPanel({ state, onClearHistory, clearingHi
|
||||
<details className="surface text-xs text-slate-200" open>
|
||||
<summary className="cursor-pointer select-none text-slate-300">Exact Model Input (messages[])</summary>
|
||||
<pre className="mt-0.5 whitespace-pre-wrap break-words text-[0.72rem] text-slate-200">
|
||||
{JSON.stringify(input.modelMessages || [], null, 2)}
|
||||
{renderModelMessages()}
|
||||
</pre>
|
||||
</details>
|
||||
|
||||
@@ -87,6 +98,13 @@ export default function OverseerControlPanel({ state, onClearHistory, clearingHi
|
||||
</pre>
|
||||
</details>
|
||||
|
||||
<details className="surface text-xs text-slate-200" open>
|
||||
<summary className="cursor-pointer select-none text-slate-300">Live Tool Calls</summary>
|
||||
<pre className="mt-0.5 whitespace-pre-wrap break-words text-[0.72rem] text-slate-200">
|
||||
{JSON.stringify(output.liveToolCalls || [], null, 2)}
|
||||
</pre>
|
||||
</details>
|
||||
|
||||
<div className="surface text-xs text-slate-200">
|
||||
<div>Normalized decision: {output.normalized || '--'}</div>
|
||||
<div>Model input at: {input.modelInputAt ? new Date(input.modelInputAt).toLocaleString() : 'n/a'}</div>
|
||||
|
||||
Reference in New Issue
Block a user