Package Exports
- @creator-studio-os/core
Readme
@creator-studio-os/core
Shared runtime for Creator Studio OS — AppleScript runners, project schema, ledger, error types, iWork shared automation
Part of the Creator Studio OS MCP control plane for Apple Creator Studio apps.
Install
npm install @creator-studio-os/coreWhat this package does
@creator-studio-os/core is the runtime foundation shared by every other @creator-studio-os/* package. It provides:
- AppleScript runners —
runAppleScript,runApp,awaitOutput,openApp,withDaemonRecovery - Project schema —
ProjectV2Zod schema, resolver, and typed path map - Error system —
CreatorStudioErrorwith structured{ code, message, hint }shape - Config —
loadConfig()readsCREATOR_STUDIO_DATA_DIRand all app bundle IDs - Ledger — structured encode/project history at
<dataDir>/.csos/ledger.jsonl - iWork shared —
openDocumentInApp,closeDocumentInApp,exportDocumentInApp,activateApp,isAppRunning
Tool (1)
| Tool | Description |
|---|---|
csos_app_status |
Check whether any Creator Studio app is running and healthy. Pass app="all" to query all 8 at once. |
Example
import {
runAppleScript,
CreatorStudioError,
loadConfig,
registerStatusTool,
} from "@creator-studio-os/core";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
const server = new McpServer({ name: "csos", version: "2.0.0" });
registerStatusTool(server);
// Escape user input before interpolation — always
const name = escapeAppleScriptString(userInput);
const result = await runAppleScript(`tell app "Keynote" to get name of document "${name}"`);Error handling
All runtime errors are CreatorStudioError:
import { CreatorStudioError } from "@creator-studio-os/core";
try {
await runAppleScript(`...`);
} catch (err) {
if (err instanceof CreatorStudioError) {
console.error(err.code); // "E_OSASCRIPT_FAILED", "E_AUTOMATION_DENIED", …
console.error(err.hint); // actionable suggestion
}
}macOS requirement
@creator-studio-os/core is macOS-only ("os": ["darwin"]). AppleScript runners invoke osascript; openApp uses open -b <bundleId>.