Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/aipoch/open-science/llms.txt

Use this file to discover all available pages before exploring further.

window.api.projects manages the set of research projects persisted in the local SQLite database (accessed via Prisma). Each project has its own working directory, artifact store, and session history. Timestamps are normalized to epoch milliseconds at the repository boundary so they can be compared directly with session timestamps. The related window.api.preview namespace persists per-project preview panel state — which tabs are open, which is active, and whether the panel is collapsed — in the same SQLite database.

Methods

list()

Returns all projects in the database ordered by creation time. Returns: Promise<Project[]>

get(id)

Returns a single project by its unique cuid identifier, or null if it does not exist.
id
string
required
The cuid identifier of the project to fetch.
Returns: Promise<Project | null>

create(request)

Creates a new project and returns the persisted record.
request
CreateProjectRequest
required
Returns: Promise<Project>

update(request)

Updates one or more fields of an existing project and returns the updated record.
request
UpdateProjectRequest
required
Returns: Promise<Project>

delete(request)

Permanently deletes a project from the database. This does not automatically delete the project’s artifact files or session history on disk — use sessions.deleteProjectSessions to remove associated session data first.
request
DeleteProjectRequest
required
Returns: Promise<void>
Deleting a project does not delete its artifact files or conversation history from disk. Call window.api.sessions.deleteProjectSessions({ projectId: id }) before deleting the project if you want to remove all associated session data.

window.api.preview — Preview panel state

window.api.preview persists the preview panel’s open/collapsed state and the set of open file tabs for each project. State is stored in the same SQLite database as projects and is scoped to a projectId.

preview.load(request)

Loads the persisted preview state for a project, or returns null when no state has been saved yet.
request
LoadPreviewStateRequest
required
Returns: Promise<PersistedPreviewState | null>

preview.save(request)

Saves the current preview panel state for a project (upsert semantics).
request
SavePreviewStateRequest
required
Returns: Promise<void>

preview.delete(request)

Deletes the saved preview state for a project. Typically called when the project itself is deleted.
request
DeletePreviewStateRequest
required
Returns: Promise<void>

PersistedPreviewState type

FieldTypeDescription
version1File format version
panelState'open' | 'collapsed'Whether the preview panel is expanded or collapsed
activeItemIdstring | undefinedID of the currently active tab
itemsPersistedPreviewFileItem[]Open file preview tabs
Each PersistedPreviewFileItem carries id, sessionId, title, path, name, format, and an optional source field.
Notebook tabs are not persisted in preview state because their RPC endpoint changes on every app launch. They are re-registered via window.api.notebook.onAvailable when the kernel becomes ready.

Type reference

Project

The full project record as returned by every projects method.
FieldTypeDescription
idstringUnique cuid identifier assigned at creation
namestringProject display name
descriptionstringProject description (empty string when not set)
isExamplebooleantrue for built-in example projects shipped with the app
createdAtnumberCreation timestamp (epoch milliseconds)
updatedAtnumberLast-updated timestamp (epoch milliseconds)
isExample projects are read-only by convention — the UI prevents editing them, but the API does not enforce it. Check this flag before offering edit or delete controls.

Usage example

import type { Project } from '../../../../shared/projects'
import type { PersistedPreviewState } from '../../../../shared/preview-state'

async function projectLifecycle() {
  // List all projects
  const projects: Project[] = await window.api.projects.list()
  console.log(`Found ${projects.length} project(s)`)

  // Create a new project
  const project: Project = await window.api.projects.create({
    name: 'Climate Analysis 2024',
    description: 'Temperature trend analysis from NOAA datasets'
  })
  console.log(`Created project: ${project.id}`)

  // Fetch it by ID
  const fetched = await window.api.projects.get(project.id)
  if (fetched) {
    console.log(`Loaded: ${fetched.name}`)
  }

  // Update the description
  const updated: Project = await window.api.projects.update({
    id: project.id,
    description: 'Updated: Sea surface temperature trends 1980–2024'
  })
  console.log(`Updated at: ${new Date(updated.updatedAt).toISOString()}`)

  // Load preview state (null when never saved)
  const previewState: PersistedPreviewState | null =
    await window.api.preview.load({ projectId: project.id })
  console.log('Panel state:', previewState?.panelState ?? 'no state saved')

  // Save updated preview state
  await window.api.preview.save({
    projectId: project.id,
    state: {
      version: 1,
      panelState: 'open',
      items: []
    }
  })

  // Delete the project (remove sessions and preview state first)
  await window.api.sessions.deleteProjectSessions({ projectId: project.id })
  await window.api.preview.delete({ projectId: project.id })
  await window.api.projects.delete({ id: project.id })
  console.log('Project deleted')
}

Build docs developers (and LLMs) love