aglio-worker 0.111.2 → 0.113.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent.js +436 -34
- package/package.json +1 -1
package/agent.js
CHANGED
|
@@ -45098,8 +45098,8 @@ var require_resolve = __commonJS({
|
|
|
45098
45098
|
}
|
|
45099
45099
|
return count2;
|
|
45100
45100
|
}
|
|
45101
|
-
function getFullPath(resolver, id = "",
|
|
45102
|
-
if (
|
|
45101
|
+
function getFullPath(resolver, id = "", normalize3) {
|
|
45102
|
+
if (normalize3 !== false)
|
|
45103
45103
|
id = normalizeId(id);
|
|
45104
45104
|
const p2 = resolver.parse(id);
|
|
45105
45105
|
return _getFullPath(resolver, p2);
|
|
@@ -46694,7 +46694,7 @@ var require_fast_uri = __commonJS({
|
|
|
46694
46694
|
}
|
|
46695
46695
|
return decodedScheme;
|
|
46696
46696
|
}
|
|
46697
|
-
function
|
|
46697
|
+
function normalize3(uri, options) {
|
|
46698
46698
|
if (typeof uri === "string") {
|
|
46699
46699
|
uri = /** @type {T} */
|
|
46700
46700
|
normalizeString(uri, options);
|
|
@@ -47072,7 +47072,7 @@ var require_fast_uri = __commonJS({
|
|
|
47072
47072
|
}
|
|
47073
47073
|
var fastUri = {
|
|
47074
47074
|
SCHEMES,
|
|
47075
|
-
normalize:
|
|
47075
|
+
normalize: normalize3,
|
|
47076
47076
|
resolve: resolve7,
|
|
47077
47077
|
resolveComponent,
|
|
47078
47078
|
equal,
|
|
@@ -50218,7 +50218,8 @@ var RUN_TRIGGERS = [
|
|
|
50218
50218
|
"auto_mode",
|
|
50219
50219
|
"followup",
|
|
50220
50220
|
"workspace_chat",
|
|
50221
|
-
"schedule"
|
|
50221
|
+
"schedule",
|
|
50222
|
+
"dependency"
|
|
50222
50223
|
];
|
|
50223
50224
|
var NOTIFICATION_TYPES = [
|
|
50224
50225
|
"question",
|
|
@@ -70522,6 +70523,12 @@ function poolWorkerLabels(size) {
|
|
|
70522
70523
|
...allRunnerVariantLabels()
|
|
70523
70524
|
];
|
|
70524
70525
|
}
|
|
70526
|
+
var CLOUD_SIZE_MEDIAN_LIMIT_MINUTES = {
|
|
70527
|
+
small: 8,
|
|
70528
|
+
medium: 20,
|
|
70529
|
+
large: 45,
|
|
70530
|
+
xlarge: Number.POSITIVE_INFINITY
|
|
70531
|
+
};
|
|
70525
70532
|
var POOL_HOST_RESERVE_BYTES = 1024 ** 3;
|
|
70526
70533
|
var MEMORY_UNITS = {
|
|
70527
70534
|
b: 1,
|
|
@@ -71221,6 +71228,14 @@ var JOB_TEMPLATE_BY_ID = new Map(JOB_TEMPLATES.map((template) => [template.id, t
|
|
|
71221
71228
|
// ../../packages/shared/src/workers.ts
|
|
71222
71229
|
import { createHash, randomBytes } from "node:crypto";
|
|
71223
71230
|
|
|
71231
|
+
// ../../packages/shared/src/release.ts
|
|
71232
|
+
var RELEASE_RE = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
71233
|
+
function normalizeReleaseVersion(value) {
|
|
71234
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
71235
|
+
if (!raw || !RELEASE_RE.test(raw)) return null;
|
|
71236
|
+
return raw.replace(/^v/i, "");
|
|
71237
|
+
}
|
|
71238
|
+
|
|
71224
71239
|
// ../../packages/shared/src/job-contract.ts
|
|
71225
71240
|
var WORKER_JOB_LOG_BATCH_BYTES = 64 * 1024;
|
|
71226
71241
|
var WORKER_JOB_LOG_BATCH_MS = 1500;
|
|
@@ -71263,8 +71278,7 @@ var REMOTE_CONSULT_READ_TOOLS = [
|
|
|
71263
71278
|
"repo_list",
|
|
71264
71279
|
"pr_get"
|
|
71265
71280
|
];
|
|
71266
|
-
var
|
|
71267
|
-
...REMOTE_CONSULT_READ_TOOLS,
|
|
71281
|
+
var REMOTE_CONSULT_WRITE_TOOLS = [
|
|
71268
71282
|
"card_create",
|
|
71269
71283
|
"card_bulk_create",
|
|
71270
71284
|
"card_update",
|
|
@@ -71285,6 +71299,22 @@ var REMOTE_CONSULT_TOOLS = [
|
|
|
71285
71299
|
"card_delete",
|
|
71286
71300
|
"job_run"
|
|
71287
71301
|
];
|
|
71302
|
+
var REMOTE_CONSULT_TOOLS = [
|
|
71303
|
+
...REMOTE_CONSULT_READ_TOOLS,
|
|
71304
|
+
...REMOTE_CONSULT_WRITE_TOOLS
|
|
71305
|
+
];
|
|
71306
|
+
var REMOTE_CONSULT_REFUSED_TOOLS = [
|
|
71307
|
+
{
|
|
71308
|
+
name: "pr_open",
|
|
71309
|
+
label: "open pull request",
|
|
71310
|
+
reason: "Workspace consultant runs cannot push code or open pull requests. Use run_start."
|
|
71311
|
+
},
|
|
71312
|
+
{
|
|
71313
|
+
name: "pr_merge",
|
|
71314
|
+
label: "merge pull request",
|
|
71315
|
+
reason: "Workspace consultant runs cannot merge pull requests."
|
|
71316
|
+
}
|
|
71317
|
+
];
|
|
71288
71318
|
|
|
71289
71319
|
// ../../packages/shared/src/workers.ts
|
|
71290
71320
|
var WORKER_HEARTBEAT_SECONDS = 15;
|
|
@@ -71292,7 +71322,7 @@ var WORKER_OFFLINE_AFTER_MISSES = 3;
|
|
|
71292
71322
|
var WORKER_OFFLINE_AFTER_SECONDS = WORKER_HEARTBEAT_SECONDS * WORKER_OFFLINE_AFTER_MISSES;
|
|
71293
71323
|
var WORKER_CLAIM_LONG_POLL_SECONDS = 25;
|
|
71294
71324
|
var WORKER_MIN_VERSION = "0.1.0";
|
|
71295
|
-
var WORKER_LATEST_VERSION =
|
|
71325
|
+
var WORKER_LATEST_VERSION = normalizeReleaseVersion(process.env.AGLIO_VERSION) ?? WORKER_MIN_VERSION;
|
|
71296
71326
|
var WORKER_VERSION_HEADER = "x-aglio-worker-version";
|
|
71297
71327
|
var WORKER_MODES = ["docker", "host"];
|
|
71298
71328
|
var WORKER_OSES = ["linux", "macos"];
|
|
@@ -71338,21 +71368,6 @@ function parseWorkerLabels(input2) {
|
|
|
71338
71368
|
throw new Error(message.replace(/^Invalid routing label/, "Invalid worker label"));
|
|
71339
71369
|
}
|
|
71340
71370
|
}
|
|
71341
|
-
function parseVersion(value) {
|
|
71342
|
-
const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(
|
|
71343
|
-
value.trim()
|
|
71344
|
-
);
|
|
71345
|
-
if (!match) return null;
|
|
71346
|
-
return {
|
|
71347
|
-
parts: [Number(match[1]), Number(match[2]), Number(match[3])],
|
|
71348
|
-
prerelease: match[4] ?? null
|
|
71349
|
-
};
|
|
71350
|
-
}
|
|
71351
|
-
function releaseVersion(value) {
|
|
71352
|
-
const raw = typeof value === "string" ? value.trim() : "";
|
|
71353
|
-
if (!raw || !parseVersion(raw)) return null;
|
|
71354
|
-
return raw.replace(/^v/i, "");
|
|
71355
|
-
}
|
|
71356
71371
|
|
|
71357
71372
|
// ../../packages/shared/src/agent-presets.ts
|
|
71358
71373
|
var AGENT_PRESETS = ["yolo", "quick", "balanced", "careful"];
|
|
@@ -71986,6 +72001,7 @@ Rules:
|
|
|
71986
72001
|
- Mark a question required only when you cannot continue. Optional questions never block the resume.
|
|
71987
72002
|
- Do not ask for permission, for facts you can check yourself, or for a decision the card already makes.
|
|
71988
72003
|
- Read the repo before editing. Follow existing patterns and style.
|
|
72004
|
+
- Aglio product docs are available through the aglio_docs tool. Call it without a topic for the index, or with a topic id for workers and custom runner images, prompts, jobs, auto mode and releases.
|
|
71989
72005
|
- Attach screenshots, recordings, logs and files as evidence.
|
|
71990
72006
|
- When done, verified and pushed, open the pull request. That moves the card to review.
|
|
71991
72007
|
- If the card says no code change or no pull request, skip verification and stop after the work log. Do not run installs, tests or builds.
|
|
@@ -72031,12 +72047,14 @@ var AGENT_RULES_DEFAULT = `You are a general-purpose agent with this card as con
|
|
|
72031
72047
|
|
|
72032
72048
|
- Answer the human's latest message first. A greeting, thanks or short question gets a short answer with no tools and no card work.
|
|
72033
72049
|
- Never resume, continue or finish the card's work on your own initiative. Do not move cards, propose specs or start runs.
|
|
72034
|
-
- Use board and repository tools only when they help answer what the human asked, and keep it to a few targeted calls before you reply.
|
|
72050
|
+
- Use board and repository tools only when they help answer what the human asked, and keep it to a few targeted calls before you reply. For questions about Aglio itself, call aglio_docs with the matching topic id first.
|
|
72035
72051
|
- If the human asks for a change, do it and report the result. Do not commit, push or open a pull request unless they ask for it.
|
|
72036
72052
|
- If the request is ambiguous, ask one short clarifying question instead of guessing.`;
|
|
72037
72053
|
var PLANNING_RULES_DEFAULT = `You are planning a card. You are NOT building it. Do not edit code, commit or push. You may read the repositories and pull requests.
|
|
72038
72054
|
|
|
72039
|
-
Your job: turn the card into a clear, testable spec. Ask the human short, specific questions only when the answer changes the plan. Keep answers grilling style: numbered, concrete, with one recommended option marked. Do not ask what the card or repo already answers
|
|
72055
|
+
Your job: turn the card into a clear, testable spec. Ask the human short, specific questions only when the answer changes the plan. Keep answers grilling style: numbered, concrete, with one recommended option marked. Do not ask what the card or repo already answers.
|
|
72056
|
+
|
|
72057
|
+
Aglio product context: call the aglio_docs tool when the plan touches workers, custom runner images, prompts, jobs or releases. No topic returns the index.`;
|
|
72040
72058
|
var PLANNING_LIMITS_DEFAULT = `Planning limits:
|
|
72041
72059
|
- Use at most 8 tool calls before you answer.
|
|
72042
72060
|
- Read the smallest useful set of files. Use read and rg. Do not install packages, run the app, run tests, start servers, or run long commands.
|
|
@@ -72101,6 +72119,7 @@ Your job:
|
|
|
72101
72119
|
- Propose a spec for any card with spec_propose. A human still approves it.
|
|
72102
72120
|
- Start work with run_start: build for code changes, consult for a card discussion, review for a pull request. Pick the agent from agent_list, or let it default to the card assignee, the consultant agent, or the first active agent.
|
|
72103
72121
|
- Read recurring job cards with job_list and trigger one with job_run on request. Job runs open no pull request; the result is kept on the job card.
|
|
72122
|
+
- Answer Aglio product questions from the aglio_docs tool. No topic returns the index; a topic id returns setup notes for workers, custom runner images, prompts, jobs, auto mode and releases. Prefer it over guessing how the product works.
|
|
72104
72123
|
- Keep answers short and concrete. Use card numbers and project keys.
|
|
72105
72124
|
|
|
72106
72125
|
Limits:
|
|
@@ -72354,14 +72373,12 @@ var MARKDOWN_COLOR_MODES = ["mono", "multi"];
|
|
|
72354
72373
|
var DEFAULT_THEME_PREFERENCES = {
|
|
72355
72374
|
themeAccent: "default",
|
|
72356
72375
|
themeScale: "default",
|
|
72357
|
-
markdownColorMode: "mono"
|
|
72358
|
-
markdownMonospace: false
|
|
72376
|
+
markdownColorMode: "mono"
|
|
72359
72377
|
};
|
|
72360
72378
|
var themePreferencesSchema = external_exports.object({
|
|
72361
72379
|
themeAccent: external_exports.enum(THEME_ACCENT_IDS).catch(DEFAULT_THEME_PREFERENCES.themeAccent),
|
|
72362
72380
|
themeScale: external_exports.enum(THEME_SCALES).catch(DEFAULT_THEME_PREFERENCES.themeScale),
|
|
72363
|
-
markdownColorMode: external_exports.enum(MARKDOWN_COLOR_MODES).catch(DEFAULT_THEME_PREFERENCES.markdownColorMode)
|
|
72364
|
-
markdownMonospace: external_exports.boolean().catch(DEFAULT_THEME_PREFERENCES.markdownMonospace)
|
|
72381
|
+
markdownColorMode: external_exports.enum(MARKDOWN_COLOR_MODES).catch(DEFAULT_THEME_PREFERENCES.markdownColorMode)
|
|
72365
72382
|
});
|
|
72366
72383
|
|
|
72367
72384
|
// ../../packages/shared/src/ai.ts
|
|
@@ -100393,6 +100410,378 @@ var StreamableHTTPServerTransport = class {
|
|
|
100393
100410
|
}
|
|
100394
100411
|
};
|
|
100395
100412
|
|
|
100413
|
+
// ../../packages/shared/src/agent-docs.ts
|
|
100414
|
+
var AGLIO_AGENT_DOCS = [
|
|
100415
|
+
{
|
|
100416
|
+
id: "overview",
|
|
100417
|
+
title: "How Aglio works",
|
|
100418
|
+
summary: "Product model, components, run lifecycle and repository map.",
|
|
100419
|
+
tags: ["architecture", "board", "runs", "repo", "meta"],
|
|
100420
|
+
body: `# How Aglio works
|
|
100421
|
+
|
|
100422
|
+
Aglio is an AI-first project board. A card is the contract: humans plan and
|
|
100423
|
+
review, agents build in isolated containers, and a linked pull request moves the
|
|
100424
|
+
card to review. One workspace per deployment, many projects, one board per
|
|
100425
|
+
project.
|
|
100426
|
+
|
|
100427
|
+
## Components
|
|
100428
|
+
|
|
100429
|
+
- apps/web: Next.js UI, API routes and the control-plane MCP endpoint.
|
|
100430
|
+
- apps/worker: the machine agent. It claims jobs, starts runner containers,
|
|
100431
|
+
hosts the per-run MCP server, polls GitHub and uploads artifacts.
|
|
100432
|
+
- runner/Dockerfile: the agent container image (pi, Claude Code, Codex, Cursor,
|
|
100433
|
+
OpenCode, Antigravity, Hermes, Node, Python, Playwright).
|
|
100434
|
+
- packages/core: domain rules (claims, transitions, runs, specs, jobs).
|
|
100435
|
+
- packages/db: Drizzle schema and migrations.
|
|
100436
|
+
- packages/agents: driver interface, prompts and context builder.
|
|
100437
|
+
- packages/mcp: board MCP tools served by the control plane.
|
|
100438
|
+
- packages/shared: Zod schemas, shared types, prompt chunks and this registry.
|
|
100439
|
+
- packages/cli: the aglio terminal client.
|
|
100440
|
+
- docs/: canonical operator documentation.
|
|
100441
|
+
|
|
100442
|
+
## Card lifecycle
|
|
100443
|
+
|
|
100444
|
+
backlog -> todo -> doing -> review -> done
|
|
100445
|
+
|
|
100446
|
+
- backlog: human only, never claimed.
|
|
100447
|
+
- todo: unassigned cards are the agent queue.
|
|
100448
|
+
- doing: a run is queued or active.
|
|
100449
|
+
- review: at least one pull request is open.
|
|
100450
|
+
- done: every linked pull request is merged.
|
|
100451
|
+
|
|
100452
|
+
Blocked and waiting states are flags (awaiting_input, run_failed,
|
|
100453
|
+
checks_failing), not columns. Subtickets live under a parent card and are not
|
|
100454
|
+
claimed independently.
|
|
100455
|
+
|
|
100456
|
+
## Run lifecycle
|
|
100457
|
+
|
|
100458
|
+
1. The control plane creates a run, snapshots build speed, prompt set and
|
|
100459
|
+
routing labels, and queues a job.
|
|
100460
|
+
2. An enrolled worker claims the job and fetches the run context over the lease.
|
|
100461
|
+
3. The worker prepares the branch, starts the runner container and the agent CLI.
|
|
100462
|
+
4. The agent reads and writes the board only through MCP tools. Files and
|
|
100463
|
+
commits go through the workspace and the git remote.
|
|
100464
|
+
5. Verification evidence is recorded, then pr_open pushes the branch and opens
|
|
100465
|
+
one pull request. Job runs never open a pull request.
|
|
100466
|
+
6. A human merges. GitHub webhooks or polling update checks, feedback and the
|
|
100467
|
+
card column.
|
|
100468
|
+
|
|
100469
|
+
## Working in the Aglio repository
|
|
100470
|
+
|
|
100471
|
+
- Follow AGENTS.md. There is no test suite; do not add one.
|
|
100472
|
+
- Verify with pnpm typecheck, pnpm --filter @aglio/web build, or a manual run.
|
|
100473
|
+
- Read PLAN.md for locked decisions before changing architecture.
|
|
100474
|
+
- Keep docs/ current when a user-visible flow changes.
|
|
100475
|
+
- A worker image or npm package publish is a separate release step. Say in the
|
|
100476
|
+
PR body when a merged change needs pnpm "Publish NPM package" or the runner /
|
|
100477
|
+
worker image workflow to run.
|
|
100478
|
+
|
|
100479
|
+
Canonical detail: README.md and PLAN.md at the repository root.`
|
|
100480
|
+
},
|
|
100481
|
+
{
|
|
100482
|
+
id: "workers",
|
|
100483
|
+
title: "Workers, runner images and custom runners",
|
|
100484
|
+
summary: "Enroll a machine, route jobs by labels, serve stock or custom images.",
|
|
100485
|
+
tags: ["worker", "byow", "runner", "docker", "labels", "custom", "macos"],
|
|
100486
|
+
body: `# Workers, runner images and custom runners
|
|
100487
|
+
|
|
100488
|
+
A worker is an enrolled machine that claims jobs. The web app never starts
|
|
100489
|
+
containers itself. Settings -> Workers -> Add worker creates the enrollment
|
|
100490
|
+
token and the command once; Run again rotates the token and rebuilds it.
|
|
100491
|
+
|
|
100492
|
+
## Modes
|
|
100493
|
+
|
|
100494
|
+
- Docker mode: one runner container per job. The agent container holds the
|
|
100495
|
+
Docker socket; the runner gets only the job workspace bind and no socket.
|
|
100496
|
+
On Linux the runner joins the agent network namespace and reaches the MCP
|
|
100497
|
+
server at http://127.0.0.1:4310, so no host port is published.
|
|
100498
|
+
- Host mode: job steps run directly as the enrolled user. Use it for macOS and
|
|
100499
|
+
iOS jobs that need Xcode, simulators, Keychain and provisioning profiles.
|
|
100500
|
+
|
|
100501
|
+
The agent never connects to Postgres and never holds DATABASE_URL or
|
|
100502
|
+
AGLIO_SECRET_KEY. It talks to the control plane over outbound HTTPS.
|
|
100503
|
+
|
|
100504
|
+
## Labels, capacity and priority
|
|
100505
|
+
|
|
100506
|
+
- Labels are exact-match key:value pairs such as runner:node or size:medium.
|
|
100507
|
+
There are no wildcards or hierarchies; size:large does not satisfy size:medium.
|
|
100508
|
+
- os:linux and mode:docker are added from the mode unless declared.
|
|
100509
|
+
- A project sets requiredWorkerLabels. A card can override the project set:
|
|
100510
|
+
empty means any worker, non-empty is the exact requirement.
|
|
100511
|
+
- Capacity is how many tasks a machine runs at once. Priority is a workspace
|
|
100512
|
+
order: priority 1 takes matching work first while it is online with a free
|
|
100513
|
+
slot; lower priorities take over when it is busy, offline or paused.
|
|
100514
|
+
- Planning can use a separate label set so builds wait for a special machine
|
|
100515
|
+
while planning still runs anywhere.
|
|
100516
|
+
|
|
100517
|
+
## Stock runner images
|
|
100518
|
+
|
|
100519
|
+
The runner Dockerfile builds one general image and the node, python, rust and go
|
|
100520
|
+
variants. A worker advertises one runner:<type> label per image it serves. The
|
|
100521
|
+
agent pulls the configured image automatically; the default is
|
|
100522
|
+
ghcr.io/h4kbas/aglio-runner:latest. A local build is pnpm runner:build.
|
|
100523
|
+
|
|
100524
|
+
## Custom runner image
|
|
100525
|
+
|
|
100526
|
+
Extend the official image, do not fork the agent contract:
|
|
100527
|
+
|
|
100528
|
+
1. In the target repository add docker/runner/Dockerfile starting from
|
|
100529
|
+
ARG BASE_IMAGE=ghcr.io/h4kbas/aglio-runner:latest, keep USER root,
|
|
100530
|
+
WORKDIR /workspace and CMD ["sleep", "infinity"].
|
|
100531
|
+
2. Install only tools the stock image lacks, pin versions where possible, and
|
|
100532
|
+
never bake registry tokens or API keys into the image.
|
|
100533
|
+
3. Publish to a registry the worker can pull from, with an immutable tag such as
|
|
100534
|
+
a date or commit SHA.
|
|
100535
|
+
4. On the worker set AGLIO_WORKER_RUNNER_IMAGE (or RUNNER_IMAGE) to that image
|
|
100536
|
+
and restart the agent. A single-image worker is required for a custom image.
|
|
100537
|
+
5. Keep the advertised runner:<type> label aligned with the image that actually
|
|
100538
|
+
runs. Run again resets the image to the stock one, so replace it afterwards.
|
|
100539
|
+
|
|
100540
|
+
Private registries need docker login on the worker host for the user that runs
|
|
100541
|
+
the agent. The agent reads the host Docker config through the socket.
|
|
100542
|
+
|
|
100543
|
+
## Troubleshooting
|
|
100544
|
+
|
|
100545
|
+
- Runner image not found and could not be pulled: docker pull on the worker host,
|
|
100546
|
+
check registry login and the tag.
|
|
100547
|
+
- A project never reaches a worker: compare required labels with worker labels.
|
|
100548
|
+
- Job reaches 4310 connection errors: check the startup line for
|
|
100549
|
+
network=container:<agent-id> mcp=http://127.0.0.1:4310. An old
|
|
100550
|
+
AGLIO_WORKER_MCP_URL or AGLIO_WORKER_RUNNER_NETWORK can force bridge.
|
|
100551
|
+
- A tool is missing: docker run --rm <image> command -v <tool>.
|
|
100552
|
+
- Old job workspaces, stale aglio-remote-* containers and docker residue are
|
|
100553
|
+
cleaned hourly; see docs/disk-cleanup.md.
|
|
100554
|
+
|
|
100555
|
+
Canonical detail: docs/byow-worker.md, docs/byow-custom-runner.md,
|
|
100556
|
+
docs/byow-macos.md, docs/runner-pool.md and docs/disk-cleanup.md.
|
|
100557
|
+
|
|
100558
|
+
An agent can write the Dockerfile, workflow and project docs, but a human still
|
|
100559
|
+
has to enroll the machine, set the image on it and confirm the first job.`
|
|
100560
|
+
},
|
|
100561
|
+
{
|
|
100562
|
+
id: "prompts",
|
|
100563
|
+
title: "Agent prompts, presets and build speed",
|
|
100564
|
+
summary: "Prompt sets, placeholders, presets, build speed and evidence gates.",
|
|
100565
|
+
tags: ["prompt", "preset", "build speed", "thinking", "verbosity", "verification"],
|
|
100566
|
+
body: `# Agent prompts, presets and build speed
|
|
100567
|
+
|
|
100568
|
+
## Prompt composition
|
|
100569
|
+
|
|
100570
|
+
A run prompt is a static template plus dynamic card, project, run and workspace
|
|
100571
|
+
values. Templates live in packages/shared/src/prompt-chunks.ts. Projects own
|
|
100572
|
+
prompt sets, one per kind: Build, Planning, Review, Consult, Agent chat, Jobs and
|
|
100573
|
+
Auto mode. Each project has an undeletable Default set; named variants copy it
|
|
100574
|
+
and later edits to the default do not rewrite them.
|
|
100575
|
+
|
|
100576
|
+
Dynamic values use placeholders such as {{cardTitle}}, {{projectName}},
|
|
100577
|
+
{{repositoriesSection}}, {{workspaceName}}, {{conversationHistory}} and
|
|
100578
|
+
{{instruction}}. The editor lists every supported placeholder and MCP tool, and
|
|
100579
|
+
unknown tokens stay visible so a typo is obvious.
|
|
100580
|
+
|
|
100581
|
+
The card history digest is deliberately bounded: 20 newest comments and review
|
|
100582
|
+
rows at 2,000 chars, 15 work log summaries, 8 attempts, and a capped attachment
|
|
100583
|
+
list. card_get returns the wider view. Prompt set chunks are stored in
|
|
100584
|
+
project_prompt_sets.chunks; an empty value or the current bundled default is not
|
|
100585
|
+
stored, so a reset follows upgrades.
|
|
100586
|
+
|
|
100587
|
+
## Presets and dials
|
|
100588
|
+
|
|
100589
|
+
Build and planning each pick a preset independently:
|
|
100590
|
+
|
|
100591
|
+
- Yolo: yolo speed, thinking off, caveman replies.
|
|
100592
|
+
- Quick: fast speed, low thinking, concise replies.
|
|
100593
|
+
- Balanced (default): standard speed, medium thinking, standard replies.
|
|
100594
|
+
- Careful: detailed speed, high thinking, verbose replies.
|
|
100595
|
+
|
|
100596
|
+
Custom is not a preset; it exposes that role's individual dials. Presets write
|
|
100597
|
+
build speed plus the roles map into project settings. The workspace consultant
|
|
100598
|
+
dial lives on Settings -> Agents because it is workspace-wide.
|
|
100599
|
+
|
|
100600
|
+
## Build speed
|
|
100601
|
+
|
|
100602
|
+
One project setting with an optional card override, resolved when the run is
|
|
100603
|
+
claimed and stored on runs.build_speed:
|
|
100604
|
+
|
|
100605
|
+
| Tier | Tests | Typecheck / build | Evidence |
|
|
100606
|
+
| --- | --- | --- | --- |
|
|
100607
|
+
| yolo | none | never | optional, state checks skipped |
|
|
100608
|
+
| ultra fast | none | only if types or build are at risk | optional |
|
|
100609
|
+
| fast | one scoped pass on touched files | one pass before PR | optional |
|
|
100610
|
+
| standard | two scoped passes, then one full suite | one pass before PR | required |
|
|
100611
|
+
| detailed | full suite after meaningful changes | one pass | required, artifact for non-N/A |
|
|
100612
|
+
|
|
100613
|
+
pr_open is hard-blocked without verification only on detailed. Standard and
|
|
100614
|
+
detailed require an artifact for test, screenshot or recording evidence. A
|
|
100615
|
+
project can require screenshots at every speed; then pr_open needs screenshot
|
|
100616
|
+
evidence or not_applicable with a reason.
|
|
100617
|
+
|
|
100618
|
+
Build speed reaches build, fix, review, card consult and job runs. Planning keeps
|
|
100619
|
+
its own card dial; the workspace consultant has no build speed.
|
|
100620
|
+
|
|
100621
|
+
Canonical detail: docs/prompt-context.md, docs/build-speed-dial.md,
|
|
100622
|
+
docs/agent-presets.md and docs/thinking-levels.md.`
|
|
100623
|
+
},
|
|
100624
|
+
{
|
|
100625
|
+
id: "jobs",
|
|
100626
|
+
title: "Recurring jobs, setup and auto mode",
|
|
100627
|
+
summary: "Job cards, templates, the one-time setup run and the auto-mode overseer.",
|
|
100628
|
+
tags: ["job", "cron", "template", "auto mode", "overseer", "setup", "proposal"],
|
|
100629
|
+
body: `# Recurring jobs, setup and auto mode
|
|
100630
|
+
|
|
100631
|
+
## Job cards
|
|
100632
|
+
|
|
100633
|
+
A recurring job is a card with kind=job on a project board. A run works on the
|
|
100634
|
+
checked-out base branch, never creates a branch, never pushes and never opens a
|
|
100635
|
+
pull request. Its result stays on the job card. Humans and the auto-mode
|
|
100636
|
+
overseer can trigger a job with job_run. Use list schedules as a 5-field cron
|
|
100637
|
+
expression with a timezone; a paused job keeps its schedule.
|
|
100638
|
+
|
|
100639
|
+
## Template catalogue
|
|
100640
|
+
|
|
100641
|
+
packages/shared/src/job-templates.ts owns the catalogue: security audit,
|
|
100642
|
+
outdated dependencies, typecheck, test health, lint and format, build check and
|
|
100643
|
+
release readiness. Each template carries a stable id, body, default cron,
|
|
100644
|
+
category and stack tags. The catalogue is a menu, not a required baseline; a
|
|
100645
|
+
project may get no job when nothing fits.
|
|
100646
|
+
|
|
100647
|
+
The setup tools job_templates_list, job_create_from_template and
|
|
100648
|
+
project_ai_initialize exist only on the one-time project setup run. The control
|
|
100649
|
+
plane adds them to allowedTools while projects.settings.projectAi.initializedAt
|
|
100650
|
+
is empty. After the agent assesses the repository and calls
|
|
100651
|
+
project_ai_initialize, later runs see the normal board tools only. Empty and
|
|
100652
|
+
docs-only repositories must not be initialized, so a later run can try again.
|
|
100653
|
+
|
|
100654
|
+
An uncertain check is proposed with job_propose for human approval instead of
|
|
100655
|
+
being enforced. A proposal is not a job and never runs until a human approves it.
|
|
100656
|
+
|
|
100657
|
+
## Suggested work
|
|
100658
|
+
|
|
100659
|
+
Build and overseer runs also get short sections asking for missing cards
|
|
100660
|
+
(card_propose) and missing recurring checks (job_propose). Suggestions go to
|
|
100661
|
+
the Todo or Jobs proposal tiles, never onto the source card. Proposals never
|
|
100662
|
+
block the current card and must not be executed in the same run. Re-proposing an
|
|
100663
|
+
earlier title, including a rejected one, is refused. Project settings -> AI
|
|
100664
|
+
features -> Suggested work turns either section off.
|
|
100665
|
+
|
|
100666
|
+
## Auto mode
|
|
100667
|
+
|
|
100668
|
+
Auto mode runs a goal epic through one overseer agent. The overseer plans 3 to 8
|
|
100669
|
+
tickets with spec_propose, chains dependencies with blockedBy split refs, and
|
|
100670
|
+
then decides on every delivery state change: merge a green matching PR, retry a
|
|
100671
|
+
failed run, plan the next batch, ask one blocking question or close the goal.
|
|
100672
|
+
Completion is refused while a ticket is not done or a linked PR is open.
|
|
100673
|
+
|
|
100674
|
+
The overseer runs with the build role dials and build routing. It never pushes
|
|
100675
|
+
code itself and never opens a PR; ticket builds own branches and PRs. It wakes
|
|
100676
|
+
on card, PR, check, run and answer events, and at least every 15 minutes.
|
|
100677
|
+
|
|
100678
|
+
Canonical detail: docs/job-templates.md, docs/auto-mode-overseer.md and
|
|
100679
|
+
docs/build-speed-dial.md.`
|
|
100680
|
+
},
|
|
100681
|
+
{
|
|
100682
|
+
id: "release",
|
|
100683
|
+
title: "Releases, images, packages and self-hosting",
|
|
100684
|
+
summary: "Version tags, published images and npm packages, migrations and self-host notes.",
|
|
100685
|
+
tags: ["release", "version", "docker", "npm", "self-host", "migration", "changelog"],
|
|
100686
|
+
body: `# Releases, images, packages and self-hosting
|
|
100687
|
+
|
|
100688
|
+
## Version and changelog
|
|
100689
|
+
|
|
100690
|
+
CHANGELOG.md at the repository root is canonical. The web app serves a copy at
|
|
100691
|
+
apps/web/public/changelog.md and apps/web/public/CHANGELOG.md. Run
|
|
100692
|
+
pnpm changelog:sync after a changelog edit; pnpm changelog:check fails on drift.
|
|
100693
|
+
Release tags match vX.Y.Z on master.
|
|
100694
|
+
|
|
100695
|
+
## Published images
|
|
100696
|
+
|
|
100697
|
+
CI builds and publishes these to GHCR for every v* tag:
|
|
100698
|
+
|
|
100699
|
+
- ghcr.io/h4kbas/aglio-web
|
|
100700
|
+
- ghcr.io/h4kbas/aglio-migrate
|
|
100701
|
+
- ghcr.io/h4kbas/aglio-worker
|
|
100702
|
+
- ghcr.io/h4kbas/aglio-runner
|
|
100703
|
+
- ghcr.io/h4kbas/aglio-runner-node
|
|
100704
|
+
- ghcr.io/h4kbas/aglio-runner-python
|
|
100705
|
+
- ghcr.io/h4kbas/aglio-runner-rust
|
|
100706
|
+
- ghcr.io/h4kbas/aglio-runner-go
|
|
100707
|
+
|
|
100708
|
+
Self-hosters pin vX.Y.Z or an immutable digest. Do not document the internal
|
|
100709
|
+
master, sha-, latest or input-hash tags for outside use. scripts/docker-image-hash.mjs
|
|
100710
|
+
hashes each image's inputs, so unchanged images are retagged instead of rebuilt.
|
|
100711
|
+
Every web and worker image carries AGLIO_VERSION from the release tag.
|
|
100712
|
+
|
|
100713
|
+
## Worker and npm publishes
|
|
100714
|
+
|
|
100715
|
+
A merged PR does not publish anything by itself. If a change touches the worker
|
|
100716
|
+
agent, the runner image or an npm package, say so in the PR body and comment on
|
|
100717
|
+
the card: the project's Publish NPM package and runner release jobs have to run
|
|
100718
|
+
after the merge. Otherwise self-hosters and BYOW machines keep the old build.
|
|
100719
|
+
|
|
100720
|
+
## Database
|
|
100721
|
+
|
|
100722
|
+
packages/db owns the Drizzle schema and migrations. Generate with pnpm db:generate
|
|
100723
|
+
and apply with pnpm db:migrate. A fresh database migration must reproduce the
|
|
100724
|
+
schema; enum values added in one transaction need their own migration step.
|
|
100725
|
+
Never edit an applied migration.
|
|
100726
|
+
|
|
100727
|
+
## Self-host
|
|
100728
|
+
|
|
100729
|
+
The self-host bundle installs the web, migrate and Postgres images plus a compose
|
|
100730
|
+
file. BETTER_AUTH_URL and NEXT_PUBLIC_APP_URL must match the public origin;
|
|
100731
|
+
NEXT_PUBLIC_APP_URL is also a web build arg because it is baked into canonical
|
|
100732
|
+
links, sitemap.xml, robots.txt and Open Graph URLs. Postgres is not published.
|
|
100733
|
+
Artifacts use local disk unless AGLIO_STORAGE_DRIVER=s3 is set.
|
|
100734
|
+
|
|
100735
|
+
Canonical detail: README.md, docs/self-host.md and docs/deploy-digitalocean.md.`
|
|
100736
|
+
}
|
|
100737
|
+
];
|
|
100738
|
+
function normalize2(value) {
|
|
100739
|
+
return value.trim().toLowerCase();
|
|
100740
|
+
}
|
|
100741
|
+
function renderIndex() {
|
|
100742
|
+
const topics = AGLIO_AGENT_DOCS.map(
|
|
100743
|
+
(doc) => `- ${doc.id}: ${doc.title} \u2014 ${doc.summary}`
|
|
100744
|
+
).join("\n");
|
|
100745
|
+
return `# Aglio docs for agents
|
|
100746
|
+
|
|
100747
|
+
These are Aglio's own operator notes, embedded in the worker because a runner
|
|
100748
|
+
has no Aglio checkout. Use them to answer product questions and to plan changes
|
|
100749
|
+
to Aglio itself, for example a custom worker, a prompt set or a recurring job.
|
|
100750
|
+
|
|
100751
|
+
Call aglio_docs with a topic id to read the full note.
|
|
100752
|
+
|
|
100753
|
+
${topics}
|
|
100754
|
+
|
|
100755
|
+
Canonical long-form docs live in the Aglio repository under docs/ and are
|
|
100756
|
+
linked from each topic. Commands and paths in these notes describe the Aglio
|
|
100757
|
+
repository, not the repository the current card belongs to.`;
|
|
100758
|
+
}
|
|
100759
|
+
function agentDocsResponse(topic) {
|
|
100760
|
+
const query = topic ? normalize2(topic) : "";
|
|
100761
|
+
if (!query || query === "index" || query === "list" || query === "all") {
|
|
100762
|
+
return renderIndex();
|
|
100763
|
+
}
|
|
100764
|
+
const exact = AGLIO_AGENT_DOCS.find((doc) => doc.id === query);
|
|
100765
|
+
const fuzzy = exact ?? AGLIO_AGENT_DOCS.find(
|
|
100766
|
+
(doc) => normalize2(doc.title) === query || doc.tags.some((tag) => normalize2(tag) === query)
|
|
100767
|
+
) ?? AGLIO_AGENT_DOCS.find(
|
|
100768
|
+
(doc) => normalize2(doc.title).includes(query) || doc.tags.some((tag) => normalize2(tag).includes(query)) || normalize2(doc.summary).includes(query)
|
|
100769
|
+
);
|
|
100770
|
+
if (!fuzzy) {
|
|
100771
|
+
return `Unknown topic "${topic}".
|
|
100772
|
+
|
|
100773
|
+
${renderIndex()}`;
|
|
100774
|
+
}
|
|
100775
|
+
const body = fuzzy.body.trim();
|
|
100776
|
+
const heading = body.startsWith("# ") ? "" : `# ${fuzzy.title}
|
|
100777
|
+
|
|
100778
|
+
`;
|
|
100779
|
+
return `${heading}${body}
|
|
100780
|
+
|
|
100781
|
+
---
|
|
100782
|
+
Topic id: ${fuzzy.id}. Call aglio_docs with another id or no topic for the index.`;
|
|
100783
|
+
}
|
|
100784
|
+
|
|
100396
100785
|
// src/remote-mcp.ts
|
|
100397
100786
|
function toolText(value) {
|
|
100398
100787
|
return {
|
|
@@ -100407,6 +100796,16 @@ function toolText(value) {
|
|
|
100407
100796
|
function fail(message) {
|
|
100408
100797
|
return { isError: true, content: [{ type: "text", text: message }] };
|
|
100409
100798
|
}
|
|
100799
|
+
function registerAgentDocsTool(server) {
|
|
100800
|
+
server.registerTool(
|
|
100801
|
+
"aglio_docs",
|
|
100802
|
+
{
|
|
100803
|
+
description: "Read Aglio operator docs embedded for agents: workers and custom runner images, prompts, jobs, auto mode and releases. Call without a topic for the index.",
|
|
100804
|
+
inputSchema: { topic: external_exports.string().min(1).max(100).optional() }
|
|
100805
|
+
},
|
|
100806
|
+
async ({ topic }) => toolText(agentDocsResponse(topic))
|
|
100807
|
+
);
|
|
100808
|
+
}
|
|
100410
100809
|
function workspaceHostPath(workspace, input2) {
|
|
100411
100810
|
const root = resolve6(workspace);
|
|
100412
100811
|
const trimmed = input2.trim();
|
|
@@ -100424,6 +100823,7 @@ function artifactKind(mime) {
|
|
|
100424
100823
|
}
|
|
100425
100824
|
function createConsultServer(run) {
|
|
100426
100825
|
const server = new McpServer({ name: "aglio-workspace-consultant", version: "1.0.0" });
|
|
100826
|
+
registerAgentDocsTool(server);
|
|
100427
100827
|
const forward = async (tool, input2) => {
|
|
100428
100828
|
try {
|
|
100429
100829
|
return toolText(await run.callTool({ tool, input: input2 }));
|
|
@@ -100822,17 +101222,19 @@ function createConsultServer(run) {
|
|
|
100822
101222
|
},
|
|
100823
101223
|
async (input2) => forward("job_run", input2)
|
|
100824
101224
|
);
|
|
100825
|
-
for (const
|
|
100826
|
-
|
|
100827
|
-
|
|
100828
|
-
|
|
100829
|
-
|
|
101225
|
+
for (const refused of REMOTE_CONSULT_REFUSED_TOOLS) {
|
|
101226
|
+
server.registerTool(
|
|
101227
|
+
refused.name,
|
|
101228
|
+
{ description: refused.reason, inputSchema: {} },
|
|
101229
|
+
async () => fail(refused.reason)
|
|
101230
|
+
);
|
|
100830
101231
|
}
|
|
100831
101232
|
return server;
|
|
100832
101233
|
}
|
|
100833
101234
|
function createServerForRun(run) {
|
|
100834
101235
|
if (run.kind === "workspace_consult") return createConsultServer(run);
|
|
100835
101236
|
const server = new McpServer({ name: "aglio-board", version: "1.0.0" });
|
|
101237
|
+
registerAgentDocsTool(server);
|
|
100836
101238
|
const forward = async (tool, input2) => {
|
|
100837
101239
|
try {
|
|
100838
101240
|
const result = await run.callTool({ tool, input: input2 });
|