gitoriaLog in with ident

antcolony

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmain3a4d0324antcolony#37: a too-long report gets up to 3 fix tries, finished work is never thrown away for lengthmremain/scheduler.hl

6.1 KB

  1. // scheduler.hl — antcolony-scheduler v0 (ticket antcolony#1, mission 015): the architect's manual loop
  2. // as a program, run by hand (docs/scheduler-agent.md build order 2) + agent v0 `work` (ticket
  3. // antcolony#2, mission 016: one headless Claude Code worker per call, build order 3; no daemon yet).
  4. //
  5. // bin/hybriel scheduler.hl next [--post]
  6. // bin/hybriel scheduler.hl brief <project> <n> [--out FILE] [--ports A-B] [--session ID]
  7. // bin/hybriel scheduler.hl report <file> [--post]
  8. // bin/hybriel scheduler.hl work <project> <n> [--post] [--dry-run] [--model M] [--max-turns N] [...] (via ./colony: needs COLONY_HOME)
  9. // bin/hybriel scheduler.hl check <runs/session> [--post] [--again] (mission 019: the controller on a finished run)
  10. // bin/hybriel scheduler.hl cycle [--post] [--dry-run] [work options] (mission 019: next → work → controller → post, once)
  11. // ./colony run [--once] [--interval S] [--parallel K] [--reserve P] [--week-limit P] [--port-pool A-B] [--ports-per-session N] [--live] [work options]
  12. // (mission 020: the loop — leases with expiry, quota reserve, parking + resume, a port range per session;
  13. // only through ./colony, which turns SIGTERM/SIGINT into the stop file)
  14. // bin/hybriel scheduler.hl salvage <runs/session> [--post] [--finalize-max-turns N] [--finalize-timeout S] [--ports A-B]
  15. // (mission 025: a finished run whose worker ran out of steps / time → resume it once to write the report)
  16. // ./colony run --serve PORT [--serve-host H] [--agent-ttl S] ... (mission 035: the scheduler for agents; starts no worker itself)
  17. // ./colony agent --scheduler URL [--poll S] [--parallel K] ... (mission 035: the agent of THIS host — runs the workers the scheduler sends)
  18. // bin/hybriel scheduler.hl leases [--expire] [--live] (mission 020: the lease of every in-progress ticket)
  19. // bin/hybriel scheduler.hl ready (mission 027: tickets built on a project with a live site, waiting for the deploy)
  20. // bin/hybriel scheduler.hl deployed <project> <n> (mission 027: after the deploy — the readable comment + awaiting creator)
  21. // ./colony librarian [--post-files] [--since D] [--max N] | --post-files --seed FILE | --render
  22. // (mission 029: the creator's decisions from tickets + chat → DECISIONS.md per project, templates/decisions-global.md)
  23. //
  24. // ./colony status [--write] | digest [--post] (antcolony#19: the status and the daily summary, built from tickets; `run` files the summary once a day)
  25. // ./colony keywords [--post] (antcolony#17: the creator's /confirm /reject /prio /hold in comments; `run` does it every iteration)
  26. //
  27. // State lives in tickets.worldapi.org only (COLONY_TICKETS_URL); the scheduler stores nothing but the
  28. // briefs it writes. See README.md.
  29. import { args } from 'hl:proc'
  30. import { runNext, pickFor } from './lib/next.hl'
  31. import { runBrief } from './lib/brief.hl'
  32. import { runReport } from './lib/report.hl'
  33. import { runWork, runBox, runCheck, runCycle, runSalvage } from './lib/work.hl'
  34. import { runRun, runLeases } from './lib/daemon.hl'
  35. import { runAgent } from './lib/agent.hl'
  36. import { runReady, runDeployed } from './lib/deploy.hl'
  37. import { runLibrarian, librarianFirst } from './lib/librarian.hl'
  38. import { runKeywords } from './lib/keywords.hl'
  39. import { runStatus, runDigest } from './lib/status.hl'
  40. 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]'
  41. // a plugin failure (e.g. tickets not answering: connection refused) must not abort a long `run` (mission 020):
  42. // it is printed, the failing call yields null and the caller sees status 0
  43. on Error(e) {
  44. console.log('colony: ERROR — ' + e.message)
  45. return null
  46. }
  47. let argv = args()
  48. let cmd = argv.length > 0 ? argv[0] : ''
  49. if (cmd == 'next') { runNext(argv) }
  50. // mission 029: brief / work / cycle await one librarian pass first (the newest decisions in DECISIONS.md before the brief)
  51. else if (cmd == 'brief') { librarianFirst(argv, 'brief', () => { runBrief(argv) }) }
  52. else if (cmd == 'report') { runReport(argv) }
  53. else if (cmd == 'work') { librarianFirst(argv, 'work', () => { runWork(argv, null) }) }
  54. else if (cmd == 'check') { runCheck(argv, null) }
  55. else if (cmd == 'salvage') { runSalvage(argv, null) }
  56. else if (cmd == 'cycle') { librarianFirst(argv, 'cycle', () => { runCycle(argv, pickFor) }) }
  57. else if (cmd == 'run') { runRun(argv) }
  58. else if (cmd == 'agent') { runAgent(argv) }
  59. else if (cmd == 'leases') { runLeases(argv) }
  60. else if (cmd == 'box') { runBox(argv) }
  61. else if (cmd == 'ready') { runReady(argv) }
  62. else if (cmd == 'deployed') { runDeployed(argv) }
  63. else if (cmd == 'librarian') { runLibrarian(argv) }
  64. else if (cmd == 'keywords') { runKeywords(argv) }
  65. else if (cmd == 'status') { runStatus(argv) }
  66. else if (cmd == 'digest') { runDigest(argv) }
  67. else { console.log(USAGE) }

Branches

Latest commits

  • 3a4d0324antcolony#37: a too-long report gets up to 3 fix tries, finished work is never thrown away for lengthmre
  • a6af7883tracker: worker box sees calendar.worldapi.org (login to copy)mre
  • c613d26btemplates: bridges to external components (login.js for ident's selector) are allowed (creator 2026-09-27)mre
  • 9062978ctracker: worker box sees /media/STORAGE/projects/old-tracker read-only (tracker#2 source data)mre
  • 7f9660eeState of 2026-09-27, before the move to gitoriamre