Skip to main content
createVirtualWorkspace(ports, limits?): ToolVirtualWorkspace
Persistent, actor-local text workspace over the existing private harness SQL port. It intentionally exposes no filesystem, process, module-loading, or dynamic-extension capability. Parameters Returns ToolVirtualWorkspace

createVirtualWorkspaceTools()

createVirtualWorkspaceTools(workspace): Readonly<{ activate_skill: Tool<{ name: string; }, ActivatedWorkspaceSkill>; edit_file: Tool<{ expectedRevision?: number | undefined; newText: string; oldText: string; path: string; }, WorkspaceToolEntry>; find_files: Tool<{ needle: string; }, Readonly<{ matches: readonly WorkspaceEntry[]; origin: "workspace"; truncated?: true; }>>; grep_files: Tool<{ needle: string; }, Readonly<{ matches: readonly { line: number; path: string; text: string; }[]; origin: "workspace"; truncated?: true; }>>; list_files: Tool<Record<string, never>, Readonly<{ entries: readonly WorkspaceEntry[]; origin: "workspace"; truncated?: true; }>>; read_file: Tool<{ path: string; }, Readonly<{ bytes: number; content: string; origin: "workspace"; path: string; revision: number; truncated?: true; } | { found: false; origin: "workspace"; path: string; }>>; write_file: Tool<{ content: string; expectedRevision?: number | undefined; path: string; }, WorkspaceToolEntry>; }>
Explicit server-side tools backed only by a VirtualWorkspace. Skill documents remain returned data; this factory never evaluates their content. Parameters Returns Readonly<{ activate_skill: Tool<{ name: string; }, ActivatedWorkspaceSkill>; edit_file: Tool<{ expectedRevision?: number | undefined; newText: string; oldText: string; path: string; }, WorkspaceToolEntry>; find_files: Tool<{ needle: string; }, Readonly<{ matches: readonly WorkspaceEntry[]; origin: "workspace"; truncated?: true; }>>; grep_files: Tool<{ needle: string; }, Readonly<{ matches: readonly { line: number; path: string; text: string; }[]; origin: "workspace"; truncated?: true; }>>; list_files: Tool<Record<string, never>, Readonly<{ entries: readonly WorkspaceEntry[]; origin: "workspace"; truncated?: true; }>>; read_file: Tool<{ path: string; }, Readonly<{ bytes: number; content: string; origin: "workspace"; path: string; revision: number; truncated?: true; } | { found: false; origin: "workspace"; path: string; }>>; write_file: Tool<{ content: string; expectedRevision?: number | undefined; path: string; }, WorkspaceToolEntry>; }> The results of the file tools carry origin: "workspace", and the result of activate_skill carries origin: "activated-skill". A path is relative, such as notes/order.md, and at most 128 bytes.

read()

read(path): Promise<WorkspaceRead | undefined>
Parameters Returns Promise<WorkspaceRead | undefined>

write()

write(path, content, options?): Promise<WorkspaceEntry>
Parameters Returns Promise<WorkspaceEntry>

edit()

edit(path, oldText, newText, options?): Promise<WorkspaceEntry>
Parameters Returns Promise<WorkspaceEntry>

list()

list(): Promise<Readonly<{ entries: readonly WorkspaceEntry[]; truncated?: true; }>>
Returns Promise<Readonly<{ entries: readonly WorkspaceEntry[]; truncated?: true; }>>

find()

find(needle): Promise<Readonly<{ matches: readonly WorkspaceEntry[]; truncated?: true; }>>
Parameters Returns Promise<Readonly<{ matches: readonly WorkspaceEntry[]; truncated?: true; }>>

grep()

grep(needle): Promise<Readonly<{ matches: readonly { line: number; path: string; text: string; }[]; truncated?: true; }>>
Parameters Returns Promise<Readonly<{ matches: readonly { line: number; path: string; text: string; }[]; truncated?: true; }>>

journal()

journal(options?): Promise<readonly WorkspaceJournalEntry[]>
Parameters Returns Promise<readonly WorkspaceJournalEntry[]>

discoverSkills()

discoverSkills(): Promise<WorkspaceSkillCatalog>
Returns Promise<WorkspaceSkillCatalog> A skill is the document at skills/<name>/SKILL.md, written like any other file. Nothing in a skill is executed.

activateSkill()

activateSkill(name): Promise<ActivatedWorkspaceSkill>
Parameters Returns Promise<ActivatedWorkspaceSkill>

assemblePrompt()

assemblePrompt(base, skills): Promise<Readonly<{ sources: readonly PromptSource[]; text: string; }>>
Parameters Returns Promise<Readonly<{ sources: readonly PromptSource[]; text: string; }>>

VirtualWorkspaceLimits

Properties maxFileBytes?
readonly optional maxFileBytes?: number
maxOutputBytes?
readonly optional maxOutputBytes?: number
maxResults?
readonly optional maxResults?: number
maxWorkspaceBytes?
readonly optional maxWorkspaceBytes?: number

WorkspaceEntry

Properties bytes
readonly bytes: number
path
readonly path: string
revision
readonly revision: number

WorkspaceRead

Properties bytes
readonly bytes: number
content
readonly content: string
path
readonly path: string
revision
readonly revision: number
truncated?
readonly optional truncated?: true

WorkspaceWriteOptions

Properties expectedRevision?
readonly optional expectedRevision?: number

WorkspaceJournalEntry

Properties bytes
readonly bytes: number
operation
readonly operation: "write" | "edit"
path
readonly path: string
revision
readonly revision: number
sequence
readonly sequence: number

WorkspaceSkill

Properties name
readonly name: string
origin
readonly origin: "workspace"
path
readonly path: string

WorkspaceSkillCatalog

Properties skills
readonly skills: readonly WorkspaceSkill[]
truncated?
readonly optional truncated?: true

ActivatedWorkspaceSkill

Properties content
readonly content: string
name
readonly name: string
origin
readonly origin: "activated-skill"
path
readonly path: string

PromptSource

PromptSource = Readonly<{ origin: "application"; }> | Readonly<{ name: string; origin: "activated-skill"; path: string; }>

WorkspaceToolEntry

Properties bytes
readonly bytes: number
origin
readonly origin: "workspace"
path
readonly path: string
revision
readonly revision: number

ToolVirtualWorkspace

A concrete workspace that can atomically preflight tool mutation results. Properties [TOOL_WORKSPACE_CAPABILITY]
readonly [TOOL_WORKSPACE_CAPABILITY]: true
Methods activateSkill()
activateSkill(name): Promise<ActivatedWorkspaceSkill>
Parameters Returns Promise<ActivatedWorkspaceSkill> assemblePrompt()
assemblePrompt(base, skills): Promise<Readonly<{ sources: readonly PromptSource[]; text: string; }>>
Parameters Returns Promise<Readonly<{ sources: readonly PromptSource[]; text: string; }>> discoverSkills()
discoverSkills(): Promise<WorkspaceSkillCatalog>
Returns Promise<WorkspaceSkillCatalog> edit()
edit(path, oldText, newText, options?): Promise<WorkspaceEntry>
Parameters Returns Promise<WorkspaceEntry> find()
find(needle): Promise<Readonly<{ matches: readonly WorkspaceEntry[]; truncated?: true; }>>
Parameters Returns Promise<Readonly<{ matches: readonly WorkspaceEntry[]; truncated?: true; }>> grep()
grep(needle): Promise<Readonly<{ matches: readonly { line: number; path: string; text: string; }[]; truncated?: true; }>>
Parameters Returns Promise<Readonly<{ matches: readonly { line: number; path: string; text: string; }[]; truncated?: true; }>> journal()
journal(options?): Promise<readonly WorkspaceJournalEntry[]>
Parameters Returns Promise<readonly WorkspaceJournalEntry[]> list()
list(): Promise<Readonly<{ entries: readonly WorkspaceEntry[]; truncated?: true; }>>
Returns Promise<Readonly<{ entries: readonly WorkspaceEntry[]; truncated?: true; }>> read()
read(path): Promise<WorkspaceRead | undefined>
Parameters Returns Promise<WorkspaceRead | undefined> write()
write(path, content, options?): Promise<WorkspaceEntry>
Parameters Returns Promise<WorkspaceEntry>