본문으로 건너뛰기

스토리지작업공간참조

StorageWorkspaceRef저장된 Agent에 작업공간을 연결하는 데 사용되는 식별된 공용체입니다. ID로 Mastra 런타임에 등록된 작업공간을 가리키거나 작업공간 스냅샷을 인라인에 포함합니다.

BuilderAgentDefaults.workspace와 저장된 Agent 레코드에서 사용하는 유형입니다.

사용예
사용예에 대한 직접 링크

src/mastra/index.ts
import { MastraEditor } from '@mastra/editor'

// Variant 1 — reference a runtime workspace by id
new MastraEditor({
builder: {
enabled: true,
configuration: {
agent: {
workspace: { type: 'id', workspaceId: 'builder-workspace' },
},
},
},
})

// Variant 2 — inline a workspace snapshot
new MastraEditor({
builder: {
enabled: true,
configuration: {
agent: {
workspace: {
type: 'inline',
config: {
name: 'inline-builder-workspace',
filesystem: {
provider: 'local',
config: { basePath: './agent-files' },
},
},
},
},
},
},
})

변형
변형에 대한 직접 링크

{ type: 'id'; workspaceId: string }:

IdRef
new Mastra({ workspace }) 또는 mastra.addWorkspace()를 통해 Mastra 런타임에 등록된 Workspace를 참조합니다. id는 관리자 구성, 저장된 Agent 레코드 및 하이드레이션을 연결하는 조인 키입니다.
{ type: 'id'; workspaceId: string }

type:

'id'
판별자입니다. 리터럴 "id"여야 합니다.

workspaceId:

string
Mastra 런타임에 등록된 Workspace의 ID입니다. Builder가 Workspace의 스냅샷을 만들고 영구 저장한 후 나중에 하이드레이션하는 데 사용합니다.

{ type: 'inline'; config: StorageWorkspaceSnapshotType }:

InlineRef
Workspace 스냅샷을 직접 포함합니다. Builder는 inline-<sha256(config)[:12]> 형식의 결정적 ID를 도출하고 스냅샷을 영구 저장하므로, 동일한 인라인 구성은 여러 Agent에서 중복 제거됩니다.
{ type: 'inline'; config: StorageWorkspaceSnapshotType }

type:

'inline'
판별자입니다. 리터럴 "inline"이어야 합니다.

config:

StorageWorkspaceSnapshotType
직렬화된 Workspace 구성입니다(파일 시스템, Sandbox, 마운트, 검색, Skill, Tool). 필드 목록은 아래의 StorageWorkspaceSnapshotType 섹션을 참조하세요.

StorageWorkspaceSnapshotType
storageworkspacesnapshottype에 대한 직접 링크

아래에 삽입된 { type: 'inline', config } 형태입니다. @mastra/core/storage에 정의되어 있습니다.

name:

string
Workspace의 표시 이름입니다.

description?:

string
Workspace 목록에 표시되는 용도 설명입니다.

filesystem?:

StorageFilesystemConfig
기본 파일 시스템 구성입니다. providerMastraEditor.filesystems에 등록된 ID와 일치해야 합니다(기본 제공: local).

sandbox?:

StorageSandboxConfig
Sandbox 구성입니다. providerMastraEditor.sandboxes에 등록된 ID와 일치해야 합니다(기본 제공: local).

mounts?:

Record<string, StorageFilesystemConfig>
Workspace에 마운트되는 추가 파일 시스템입니다. 마운트 경로를 키로 사용합니다.

skills?:

string[]
이 Workspace에 할당된 Skill 엔터티 ID입니다.

tools?:

StorageWorkspaceToolsConfig
Workspace Tool 구성입니다(허용 목록, 기본값).

autoSync?:

boolean
= false
파일 시스템과 Sandbox 간의 자동 동기화입니다.

operationTimeout?:

number
개별 작업의 제한 시간(밀리초)입니다.

수분 공급
수분 공급에 대한 직접 링크

StorageWorkspaceReflist()가 아닌 mastra.editor.agent.getById()에서 지연 해석됩니다. Editor는 MastraEditor.filesystems / MastraEditor.sandboxes에서 파일 시스템 및 Sandbox Provider를 조회하여 런타임 Workspace를 구체화합니다. 누락된 Provider는 경고로 표시되며 Workspace는 생략됩니다.