MCPcopy Index your code
hub / github.com/simstudioai/sim / start

Method start

apps/sim/lib/logs/execution/logging-session.ts:326–374  ·  view source on GitHub ↗
(params: SessionStartParams)

Source from the content-addressed store, hash-verified

324 }
325
326 async start(params: SessionStartParams): Promise<void> {
327 const {
328 userId,
329 workspaceId,
330 variables,
331 triggerData,
332 skipLogCreation,
333 deploymentVersionId,
334 workflowState,
335 } = params
336
337 try {
338 this.trigger = createTriggerObject(this.triggerType, triggerData)
339 this.correlation = triggerData?.correlation
340 this.environment = createEnvironmentObject(
341 this.workflowId,
342 this.executionId,
343 userId,
344 workspaceId,
345 variables
346 )
347 this.workflowState =
348 workflowState ??
349 (deploymentVersionId
350 ? await loadDeployedWorkflowStateForLogging(this.workflowId)
351 : await loadWorkflowStateForExecution(this.workflowId))
352
353 if (!skipLogCreation) {
354 await executionLogger.startWorkflowExecution({
355 workflowId: this.workflowId,
356 workspaceId,
357 executionId: this.executionId,
358 trigger: this.trigger,
359 environment: this.environment,
360 workflowState: this.workflowState,
361 deploymentVersionId,
362 })
363 } else {
364 // Resume: no cost reload needed. Billing reconciles from the usage_log
365 // ledger (pre-pause rows already exist) plus the live cost summary.
366 this.isResume = true
367 }
368 } catch (error) {
369 if (this.requestId) {
370 logger.error(`[${this.requestId}] Failed to start logging:`, error)
371 }
372 throw error
373 }
374 }
375
376 async complete(params: SessionCompleteParams = {}): Promise<void> {
377 if (this.completed || this.completing) {

Callers 1

safeStartMethod · 0.95

Calls 6

createTriggerObjectFunction · 0.90
createEnvironmentObjectFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected