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

Function buildVfsSnapshot

apps/sim/lib/copilot/chat/workspace-context.ts:561–639  ·  view source on GitHub ↗
(data: WorkspaceMdData)

Source from the content-addressed store, hash-verified

559 * diffs by stable id, not position.
560 */
561export function buildVfsSnapshot(data: WorkspaceMdData): VfsSnapshotV1 {
562 const workflows: VfsSnapshotV1Workflow[] = data.workflows.map((wf) => ({
563 id: wf.id,
564 name: wf.name,
565 path: canonicalWorkflowVfsDir({ name: wf.name, folderPath: wf.folderPath }),
566 ...(wf.description ? { description: wf.description } : {}),
567 ...(wf.isDeployed ? { isDeployed: true } : {}),
568 ...(wf.folderPath ? { folderPath: wf.folderPath } : {}),
569 }))
570 const jobs: VfsSnapshotV1Job[] = (data.jobs ?? [])
571 .filter((j) => j.status !== 'completed')
572 .map((j) => ({
573 id: j.id,
574 ...(j.title ? { title: j.title } : {}),
575 ...(j.prompt ? { prompt: j.prompt } : {}),
576 ...(j.cronExpression ? { cronExpression: j.cronExpression } : {}),
577 ...(j.status ? { status: j.status } : {}),
578 ...(j.lifecycle ? { lifecycle: j.lifecycle } : {}),
579 ...(j.sourceTaskName ? { sourceTaskName: j.sourceTaskName } : {}),
580 }))
581 return {
582 ...(data.workspace
583 ? {
584 workspace: {
585 id: data.workspace.id,
586 name: data.workspace.name,
587 ...(data.workspace.ownerId ? { ownerId: data.workspace.ownerId } : {}),
588 },
589 }
590 : {}),
591 members: data.members.map((m) => ({
592 ...(m.name ? { name: m.name } : {}),
593 email: m.email,
594 ...(m.permissionType ? { permissionType: m.permissionType } : {}),
595 })),
596 workflows,
597 knowledgeBases: data.knowledgeBases.map((kb) => ({
598 id: kb.id,
599 name: kb.name,
600 ...(kb.description ? { description: kb.description } : {}),
601 ...(kb.connectorTypes && kb.connectorTypes.length > 0
602 ? { connectorTypes: kb.connectorTypes }
603 : {}),
604 })),
605 tables: data.tables.map((t) => ({
606 id: t.id,
607 name: t.name,
608 ...(t.description ? { description: t.description } : {}),
609 })),
610 files: data.files.map((f) => ({
611 id: f.id,
612 name: f.name,
613 path: canonicalWorkspaceFilePath({ folderPath: f.folderPath, name: f.name }),
614 ...(f.type ? { type: f.type } : {}),
615 ...(f.size ? { size: f.size } : {}),
616 ...(f.folderPath ? { folderPath: f.folderPath } : {}),
617 })),
618 integrations: data.oauthIntegrations.map((c) => ({

Callers 1

Calls 2

canonicalWorkflowVfsDirFunction · 0.90

Tested by

no test coverage detected