MCPcopy Index your code
hub / github.com/callstack/agent-device / createDaemonRuntimeSessionStore

Function createDaemonRuntimeSessionStore

src/daemon/runtime-session.ts:28–51  ·  view source on GitHub ↗
(params: {
  sessionName: string;
  getSession: () => SessionState | undefined;
  recordOptions?: RuntimeSessionRecordOptions;
  setRecord: (record: CommandSessionRecord) => void;
})

Source from the content-addressed store, hash-verified

26}
27
28export function createDaemonRuntimeSessionStore(params: {
29 sessionName: string;
30 getSession: () => SessionState | undefined;
31 recordOptions?: RuntimeSessionRecordOptions;
32 setRecord: (record: CommandSessionRecord) => void;
33}): CommandSessionStore {
34 return {
35 get: (name) =>
36 name === params.sessionName
37 ? toRuntimeSessionRecord(params.getSession(), params.sessionName, params.recordOptions)
38 : undefined,
39 set: (record) => {
40 if (record.name !== params.sessionName) {
41 emitDiagnostic({
42 level: 'warn',
43 phase: 'runtime_session_write_skipped',
44 data: { expected: params.sessionName, received: record.name },
45 });
46 return;
47 }
48 params.setRecord(record);
49 },
50 };
51}

Callers 5

createSnapshotRuntimeFunction · 0.90
createInteractionRuntimeFunction · 0.90

Calls 2

emitDiagnosticFunction · 0.90
toRuntimeSessionRecordFunction · 0.85

Tested by

no test coverage detected