Agent Runtime 執行
Agent 不需要 Runtime Module,也能執行 JavaScript 或 TypeScript。 Guidance 和使用者任務告訴 Agent 要做什麼;Agent 撰寫或選擇程式碼,再透過 pedelec-ts-runtime 在 Workspace 執行。
Guidance / 使用者任務 ↓ Agent ↓撰寫或選擇 JS/TS ↓ pedelec-ts-runtime ↓ WorkspacePedelec Desktop 管理固定版本的 Deno runtime。使用者不必自行安裝 Node.js、Bun 或 Deno。pedelec-ts-runtime 是 Agent 執行 JS/TS 的標準介面。若無法使用,Agent 應回報失敗,不應默默改用 Node.js、Bun、raw Deno 或其他 runtime。執行仍受 Workspace 安全邊界限制。
將 script 保留在 Workspace
Section titled “將 script 保留在 Workspace”pedelec-ts-runtime --thread-id <thread-id> run scripts/task.ts多步驟、值得檢查或保留的程式碼,以及既有 Workspace script,適合用檔案執行。例如掃描專案檔案建立 manifest、從範本產生檔案,或執行一次性的檔案遷移。
從 stdin 執行短程式碼
Section titled “從 stdin 執行短程式碼”pedelec-ts-runtime --thread-id <thread-id> run -將 script 傳入 stdin,適合短小的 glue code 或一次性轉換,不需建立暫存原始檔。例如正規化多個 JSON 檔、合併結構化檔案中的選定欄位,或在 Agent 繼續之前驗證資料。實際 shell 範本可能隨 Agent host 而異。
若邏輯會重複使用或包含領域規則,可將實作移入 Runtime Module,讓 Agent 只撰寫編排程式碼。
舊 CLI alias
Section titled “舊 CLI alias”pedelec-deno 是合法的 legacy alias,使用相同的驗證與 Thread mode:
pedelec-deno --thread-id <thread-id> run scripts/task.tsprintf 'console.log("stdin-ok");' | pedelec-ts-runtime --thread-id <thread-id> run -printf 'console.log("stdin-ok");' | pedelec-deno --thread-id <thread-id> run -PowerShell stdin 範例(兩個命令名稱都可使用):
'console.log("stdin-ok");' | pedelec-ts-runtime --thread-id <thread-id> run -兩個命令都不接受 eval、提高權限的 flags 或參數內的 shell 語法。檔案與 stdin 執行皆由 Thread 儲存的 mode 決定權限。