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

Function createSnapshotRuntime

src/daemon/snapshot-runtime.ts:178–217  ·  view source on GitHub ↗
(params: {
  req: DaemonRequest;
  sessionName: string;
  logPath: string;
  sessionStore: SessionStore;
  session: SessionState | undefined;
  device: SessionState['device'];
  snapshotScope: string | undefined;
})

Source from the content-addressed store, hash-verified

176}
177
178function createSnapshotRuntime(params: {
179 req: DaemonRequest;
180 sessionName: string;
181 logPath: string;
182 sessionStore: SessionStore;
183 session: SessionState | undefined;
184 device: SessionState['device'];
185 snapshotScope: string | undefined;
186}) {
187 const { req, sessionName, logPath, sessionStore, session, device, snapshotScope } = params;
188 return createAgentDevice({
189 backend: createDaemonSnapshotBackend({
190 req,
191 logPath,
192 session,
193 device,
194 snapshotScope,
195 }),
196 ...createDaemonRuntimePolicy('snapshot'),
197 sessions: createDaemonRuntimeSessionStore({
198 sessionName,
199 getSession: () => sessionStore.get(sessionName),
200 recordOptions: { includeSnapshot: true },
201 setRecord: (record) => {
202 const snapshotRecord = assertSnapshotSessionRecord(record);
203 const current = sessionStore.get(sessionName);
204 sessionStore.set(
205 sessionName,
206 buildNextSnapshotSession({
207 current,
208 sessionName,
209 device,
210 record: snapshotRecord,
211 refScopedSnapshot: isRefScopedSnapshot(req),
212 }),
213 );
214 },
215 }),
216 });
217}
218
219function buildNextSnapshotSession(params: {
220 current: SessionState | undefined;

Callers 1

Calls 9

createAgentDeviceFunction · 0.90
buildNextSnapshotSessionFunction · 0.85
isRefScopedSnapshotFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected