Files
loki/scripts/hermes-dispatch.ts
T
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00

64 lines
2.3 KiB
TypeScript

#!/usr/bin/env -S npx tsx
/**
* hermes-dispatch — send a coding task to the hosted Hermes runner ON PURPOSE.
*
* inject-core only routes to Hermes as an automatic fallback (a WORK dispatch
* queued while the local Fleet Runner is offline). This is the intentional path:
* queue a task for a project and let the hosted runner do it laptop-off.
*
* The task is enqueued as a `hosted_dispatch` command; the
* loki-hosted-runner.timer drains it (~≤1 min): clone → Hermes in its
* sandbox → commit on a branch → open a PR. Nothing auto-merges — you review it.
* Progress is visible in Activity (source="hosted-runner", adapter="hermes").
*
* Resolution + enqueue + Activity attribution are shared with the API route via
* dispatchToHostedRunner — this script only supplies the owner userId (the box
* has no session) and prints the result.
*
* Usage:
* DATABASE_URL=… npx tsx scripts/hermes-dispatch.ts <projectKey> "<task>" [model]
* Example:
* … scripts/hermes-dispatch.ts loki "Add a CONTRIBUTING.md with build + test steps"
*/
import { getSelfImprovementTarget } from "@/db/queries/frontier";
import { dispatchToHostedRunner } from "@/lib/hosted-runner/dispatch";
async function main() {
const [projectKey, task, model] = process.argv.slice(2);
if (!projectKey || !task) {
console.error('Usage: npx tsx scripts/hermes-dispatch.ts <projectKey> "<task>" [model]');
process.exit(1);
}
const target = await getSelfImprovementTarget();
if (!target) {
console.error("No Loki owner resolved — nothing to dispatch for.");
process.exit(1);
}
const res = await dispatchToHostedRunner({
userId: target.userId,
projectKey,
task,
...(model ? { model } : {}),
});
if (!res.ok) {
console.error(`✗ ${res.error}`);
if (res.knownProjects?.length)
console.error(` Known projects: ${res.knownProjects.join(", ")}`);
process.exit(1);
}
console.log(`✓ queued hosted Hermes dispatch ${res.hostedDispatchId}`);
console.log(` project: ${res.projectName} repo: ${res.gitUrl}`);
console.log(` task: ${task}`);
console.log(
` Drained by loki-hosted-runner.timer (~≤1 min) → clone → Hermes → PR (never auto-merged).`,
);
console.log(
` Watch: journalctl -u loki-hosted-runner -f | Activity (source=hosted-runner)`,
);
process.exit(0);
}
main();