Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

Use no-op debug recorder in OrkasOpen

wytd39743bc75ba
diff --git a/src/main/model/core-agent/client.ts b/src/main/model/core-agent/client.ts
index 327d6942..490b13d1 100644
--- a/src/main/model/core-agent/client.ts
+++ b/src/main/model/core-agent/client.ts
@@ -42,8 +42,14 @@ interface DebugRecorder {
finish(result: { text: string; aborted: boolean; error: string | null }): void;
}
-function createDebugRecorder(): DebugRecorder | null {
- return null;
+const NOOP_DEBUG_RECORDER: DebugRecorder = {
+ record() {},
+ setActiveCandidate() {},
+ finish() {},
+};
+
+function createDebugRecorder(): DebugRecorder {
+ return NOOP_DEBUG_RECORDER;
}
/**
@@ -244,10 +250,9 @@ export async function* streamChatWithModel(opts: ChatOptions): AsyncGenerator<St
else abortSignal.addEventListener('abort', onExternalAbort, { once: true });
}
- // Dev-only archiver — no-op in prod. Initialised after buildRunner so
- // the record can carry the resolved provider / model ids for prompt
- // triage ("did this call actually hit the model I think it did").
- let recorder: DebugRecorder | null = null;
+ // PC dev builds attach an archive recorder here. OrkasOpen keeps the same
+ // interface as a no-op object so stripped debug code cannot affect model calls.
+ const recorder = createDebugRecorder();
let finalText = '';
let errText: string | null = null;
let abortedFlag = false;
@@ -280,7 +285,7 @@ export async function* streamChatWithModel(opts: ChatOptions): AsyncGenerator<St
...(onSkillAdvertised ? { onSkillAdvertised } : {}),
...(onSkillInvoked ? { onSkillInvoked } : {}),
onNativeSearchInjected: (info) => {
- recorder?.record({
+ recorder.record({
type: 'progress',
event: { stream: 'native_search', data: { phase: 'injected', ...info } },
});
@@ -293,13 +298,11 @@ export async function* streamChatWithModel(opts: ChatOptions): AsyncGenerator<St
// when complete()/stream() actually picks a candidate, so the recorder
// is always live by then.
onCandidateChosen: (info) => {
- recorder?.setActiveCandidate(info);
+ recorder.setActiveCandidate(info);
},
});
const { runner, providerId, modelId, resolvedSystemPrompt, profileId, entryId, toolDefs, skillDisplayNameById, agentDisplayNameById } = built;
- recorder = createDebugRecorder();
-
const sandboxEnv = buildSkillSandboxEnv();
log.info(`turn start ${turnTag} user=${userId} provider=${providerId} model=${modelId}`);
@@ -329,7 +332,7 @@ export async function* streamChatWithModel(opts: ChatOptions): AsyncGenerator<St
for await (const ev of mapCoreAgentEvents(captureResult(rawEvents), { userId, skillDisplayNameById, agentDisplayNameById })) {
resetIdle();
eventCount += 1;
- recorder?.record(ev as any);
+ recorder.record(ev as any);
if (ev.type === 'final') finalText = (ev as any).text || finalText;
if (ev.type === 'error') { errText = (ev as any).text || errText; if ((ev as any).aborted) abortedFlag = true; }
// NOTE: compaction summaries are deliberately NOT mined into cross-session
@@ -392,10 +395,8 @@ export async function* streamChatWithModel(opts: ChatOptions): AsyncGenerator<St
}
releaseSlotOnce('finally');
releaseSessionOnce('finally');
- if (recorder) {
- try { recorder.finish({ text: finalText, aborted: abortedFlag, error: errText }); }
- catch (err) { log.warn('archive finish failed:', err); }
- }
+ try { recorder.finish({ text: finalText, aborted: abortedFlag, error: errText }); }
+ catch (err) { log.warn('archive finish failed:', err); }
yield { type: 'done' };
}
}