mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -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,
|
||||
|
||||
Reference in New Issue
Block a user