antcolony
All repositories: gitoria
6.1 KB
// scheduler.hl — antcolony-scheduler v0 (ticket antcolony#1, mission 015): the architect's manual loop// as a program, run by hand (docs/scheduler-agent.md build order 2) + agent v0 `work` (ticket// antcolony#2, mission 016: one headless Claude Code worker per call, build order 3; no daemon yet).//// bin/hybriel scheduler.hl next [--post]// bin/hybriel scheduler.hl brief <project> <n> [--out FILE] [--ports A-B] [--session ID]// bin/hybriel scheduler.hl report <file> [--post]// bin/hybriel scheduler.hl work <project> <n> [--post] [--dry-run] [--model M] [--max-turns N] [...] (via ./colony: needs COLONY_HOME)// bin/hybriel scheduler.hl check <runs/session> [--post] [--again] (mission 019: the controller on a finished run)// bin/hybriel scheduler.hl cycle [--post] [--dry-run] [work options] (mission 019: next → work → controller → post, once)// ./colony run [--once] [--interval S] [--parallel K] [--reserve P] [--week-limit P] [--port-pool A-B] [--ports-per-session N] [--live] [work options]// (mission 020: the loop — leases with expiry, quota reserve, parking + resume, a port range per session;// only through ./colony, which turns SIGTERM/SIGINT into the stop file)// bin/hybriel scheduler.hl salvage <runs/session> [--post] [--finalize-max-turns N] [--finalize-timeout S] [--ports A-B]// (mission 025: a finished run whose worker ran out of steps / time → resume it once to write the report)// ./colony run --serve PORT [--serve-host H] [--agent-ttl S] ... (mission 035: the scheduler for agents; starts no worker itself)// ./colony agent --scheduler URL [--poll S] [--parallel K] ... (mission 035: the agent of THIS host — runs the workers the scheduler sends)// bin/hybriel scheduler.hl leases [--expire] [--live] (mission 020: the lease of every in-progress ticket)// bin/hybriel scheduler.hl ready (mission 027: tickets built on a project with a live site, waiting for the deploy)// bin/hybriel scheduler.hl deployed <project> <n> (mission 027: after the deploy — the readable comment + awaiting creator)// ./colony librarian [--post-files] [--since D] [--max N] | --post-files --seed FILE | --render// (mission 029: the creator's decisions from tickets + chat → DECISIONS.md per project, templates/decisions-global.md)//// ./colony status [--write] | digest [--post] (antcolony#19: the status and the daily summary, built from tickets; `run` files the summary once a day)// ./colony keywords [--post] (antcolony#17: the creator's /confirm /reject /prio /hold in comments; `run` does it every iteration)//// State lives in tickets.worldapi.org only (COLONY_TICKETS_URL); the scheduler stores nothing but the// briefs it writes. See README.md.import { args } from 'hl:proc'import { runNext, pickFor } from './lib/next.hl'import { runBrief } from './lib/brief.hl'import { runReport } from './lib/report.hl'import { runWork, runBox, runCheck, runCycle, runSalvage } from './lib/work.hl'import { runRun, runLeases } from './lib/daemon.hl'import { runAgent } from './lib/agent.hl'import { runReady, runDeployed } from './lib/deploy.hl'import { runLibrarian, librarianFirst } from './lib/librarian.hl'import { runKeywords } from './lib/keywords.hl'import { runStatus, runDigest } from './lib/status.hl'static USAGE = 'usage: bin/hybriel scheduler.hl next [--post] | brief <project> <n> [--out FILE] [--ports A-B] [--session ID] | report <file> [--post] | work <project> <n> [--post] [--dry-run] [--model M] [--max-turns N] [--permission-mode MODE] [--timeout S] [--max-budget-usd X] [--ports A-B] [--session ID] [--controller-model M] [--controller-max-turns N] [--controller-timeout S] [--max-fails N] [--finalize-max-turns N] [--finalize-timeout S] | check <runs/session> [--post] [--again] | salvage <runs/session> [--post] [--finalize-max-turns N] [--finalize-timeout S] [--ports A-B] | cycle [--post] [--dry-run] [work options] | run [--once] [--interval S] [--parallel K] [--reserve P] [--week-limit P] [--port-pool A-B] [--ports-per-session N] [--lease-ttl S] [--heartbeat S] [--quota-claude BIN] [--live] [work options] | run --serve PORT [--capabilities LIST] [--serve-host H] [--agent-ttl S] [--account-settle S] [--librarian on|off] [--live] (the scheduler for agents, starts no worker itself) | agent --scheduler URL [--account NAME] [--capabilities LIST] [--poll S] [--parallel K] [--reserve P] [--week-limit P] [--port-pool A-B] [--ports-per-session N] [--quota-every S] [work options] | leases [--expire] [--live] | box <project> [--deploy] [--folder F] | ready | deployed <project> <n> | librarian [--post-files] [--since DATE|ms] [--max N] [--model M] [--retry-refused] | librarian --post-files --seed FILE [--seed-source TEXT] | librarian --render | keywords [--post] | status [--write] | digest [--post]'// a plugin failure (e.g. tickets not answering: connection refused) must not abort a long `run` (mission 020):// it is printed, the failing call yields null and the caller sees status 0on Error(e) {console.log('colony: ERROR — ' + e.message)return null}let argv = args()let cmd = argv.length > 0 ? argv[0] : ''if (cmd == 'next') { runNext(argv) }// mission 029: brief / work / cycle await one librarian pass first (the newest decisions in DECISIONS.md before the brief)else if (cmd == 'brief') { librarianFirst(argv, 'brief', () => { runBrief(argv) }) }else if (cmd == 'report') { runReport(argv) }else if (cmd == 'work') { librarianFirst(argv, 'work', () => { runWork(argv, null) }) }else if (cmd == 'check') { runCheck(argv, null) }else if (cmd == 'salvage') { runSalvage(argv, null) }else if (cmd == 'cycle') { librarianFirst(argv, 'cycle', () => { runCycle(argv, pickFor) }) }else if (cmd == 'run') { runRun(argv) }else if (cmd == 'agent') { runAgent(argv) }else if (cmd == 'leases') { runLeases(argv) }else if (cmd == 'box') { runBox(argv) }else if (cmd == 'ready') { runReady(argv) }else if (cmd == 'deployed') { runDeployed(argv) }else if (cmd == 'librarian') { runLibrarian(argv) }else if (cmd == 'keywords') { runKeywords(argv) }else if (cmd == 'status') { runStatus(argv) }else if (cmd == 'digest') { runDigest(argv) }else { console.log(USAGE) }
Branches
- mainmain branch