MCPcopy Index your code
hub / github.com/ByBrawe/opencode-loop / compactSession

Function compactSession

src/index.js:404–425  ·  view source on GitHub ↗
(client, sessionID)

Source from the content-addressed store, hash-verified

402
403function sdkError(result) {
404 if (!result || typeof result !== "object") return undefined
405 return result.error || result.error === null ? result.error : undefined
406}
407
408function sdkData(result) {
409 if (!result || typeof result !== "object") return result
410 return Object.prototype.hasOwnProperty.call(result, "data") ? result.data : result
411}
412
413function sdkErrorMessage(error) {
414 if (!error) return "unknown SDK error"
415 if (error instanceof Error) return error.message
416 if (typeof error === "string") return error
417 if (typeof error === "object") {
418 if (typeof error.message === "string") return error.message
419 if (typeof error.name === "string") return error.name
420 try { return JSON.stringify(error).slice(0, 400) } catch {}
421 }
422 return String(error)
423}
424
425async function sdkCall(method, ...argsList) {
426 let firstError
427 for (const args of argsList) {
428 if (args === undefined) continue

Callers 2

maybeCompactFunction · 0.85
fireActionFunction · 0.85

Calls 5

executeTuiCommandFunction · 0.85
logFunction · 0.85
sdkErrorMessageFunction · 0.85
sdkCallFunction · 0.85
toastFunction · 0.85

Tested by

no test coverage detected