MCPcopy Create free account
hub / github.com/apache/maka / readSqliteShellRun

Function readSqliteShellRun

packages/storage/src/shell-run-store.ts:114–129  ·  view source on GitHub ↗
(
  db: import('node:sqlite').DatabaseSync,
  sessionId: string,
  shellRunId: string,
)

Source from the content-addressed store, hash-verified

112}
113
114function readSqliteShellRun(
115 db: import('node:sqlite').DatabaseSync,
116 sessionId: string,
117 shellRunId: string,
118): ShellRunRecord {
119 const row = db
120 .prepare(`
121 SELECT record_json
122 FROM core_shell_runs
123 WHERE session_id = ? AND shell_run_id = ?
124 `)
125 .get(sessionId, shellRunId) as { record_json?: unknown } | undefined;
126 if (!row) throw shellRunNotFoundError(shellRunId);
127 if (typeof row.record_json !== 'string') throw new Error('Invalid SQLite ShellRun row');
128 return normalizeShellRunRecord(JSON.parse(row.record_json), sessionId, shellRunId);
129}
130
131function sanitizeJson(_key: string, value: unknown): unknown {
132 return value === undefined ? undefined : value;

Callers 2

updateShellRunMethod · 0.85
readShellRunMethod · 0.85

Calls 4

shellRunNotFoundErrorFunction · 0.90
normalizeShellRunRecordFunction · 0.90
getMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected