@felixdotgo/aidlc-kit 0.1.1 → 0.3.0
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/DEVELOPMENT.md +14 -13
- package/README.md +37 -43
- package/dist/assets/.agents/aidlc/docker/Dockerfile.claude +7 -0
- package/dist/assets/.agents/aidlc/docker/Dockerfile.codex +9 -0
- package/dist/assets/.agents/aidlc/docker/Dockerfile.opencode +8 -0
- package/dist/assets/.agents/aidlc/orchestrator.md +2 -2
- package/dist/assets/.agents/aidlc/phase-clarify.md +1 -1
- package/dist/assets/.agents/aidlc/phase-plan.md +2 -2
- package/dist/assets/.agents/aidlc/schemas/config.schema.json +2 -1
- package/dist/assets/.agents/aidlc/schemas/state.schema.json +2 -0
- package/dist/assets/.agents/aidlc/scripts/lib/assignment-store.mjs +94 -48
- package/dist/assets/.agents/aidlc/scripts/lib/context-runtime.mjs +5 -4
- package/dist/assets/.agents/aidlc/scripts/lib/loop-authority.mjs +261 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-commit-message.mjs +45 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-daemon.mjs +206 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-drivers.mjs +100 -14
- package/dist/assets/.agents/aidlc/scripts/lib/loop-env.mjs +279 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-cli.mjs +105 -32
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-remote.mjs +17 -1
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-supervisor.mjs +24 -7
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet.mjs +42 -16
- package/dist/assets/.agents/aidlc/scripts/lib/loop-git.mjs +20 -6
- package/dist/assets/.agents/aidlc/scripts/lib/loop-holder.mjs +376 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-intake.mjs +33 -7
- package/dist/assets/.agents/aidlc/scripts/lib/loop-lease.mjs +67 -61
- package/dist/assets/.agents/aidlc/scripts/lib/loop-leases.mjs +268 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-local-workers.mjs +116 -28
- package/dist/assets/.agents/aidlc/scripts/lib/loop-runtime.mjs +114 -12
- package/dist/assets/.agents/aidlc/scripts/lib/loop-stream.mjs +117 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-local.mjs +16 -56
- package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-run-local.mjs +149 -6
- package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor.mjs +9 -1
- package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-docker.mjs +44 -6
- package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-image.mjs +64 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-log.mjs +158 -0
- package/dist/assets/.agents/aidlc/scripts/lib/repo-head.mjs +22 -0
- package/dist/assets/.agents/aidlc/scripts/lib/store.mjs +68 -2
- package/dist/assets/.agents/aidlc/scripts/lib/task-runtime-migrate.mjs +75 -0
- package/dist/assets/.agents/aidlc/scripts/lib/task-runtime.mjs +97 -0
- package/dist/assets/.agents/aidlc/scripts/loop-entry.mjs +168 -73
- package/dist/assets/.agents/aidlc/scripts/loop-gate.mjs +19 -7
- package/dist/assets/.agents/aidlc/scripts/loop.cmd +101 -0
- package/dist/assets/.agents/aidlc/scripts/loop.mjs +2 -1
- package/dist/assets/.agents/aidlc/scripts/loop.sh +71 -0
- package/dist/assets/.agents/aidlc/scripts/remote-state.mjs +10 -4
- package/dist/assets/.agents/aidlc/scripts/state.mjs +16 -8
- package/dist/assets/.agents/aidlc/templates/design.md +9 -0
- package/dist/assets/.agents/aidlc/templates/intent.md +4 -0
- package/dist/assets/.agents/aidlc/templates/workplan.md +1 -1
- package/dist/assets/.agents/skills/aidlc-plan/SKILL.md +1 -1
- package/dist/assets/ui/bulma.min.css +3 -0
- package/dist/assets/ui/changes.js +83 -0
- package/dist/assets/ui/common.js +664 -0
- package/dist/assets/ui/dashboard.css +636 -0
- package/dist/assets/ui/dashboard.js +77 -0
- package/dist/assets/ui/detail.js +159 -0
- package/dist/assets/ui/live-log.js +332 -0
- package/dist/services/aidlc-coordination/Dockerfile +11 -3
- package/dist/services/aidlc-coordination/compose.yaml +12 -0
- package/dist/services/aidlc-coordination/package-lock.json +3 -1
- package/dist/services/aidlc-coordination/package.json +9 -4
- package/dist/services/aidlc-coordination/src/lifecycle-core.mjs +68 -2
- package/dist/services/aidlc-coordination/src/repository.mjs +66 -0
- package/dist/services/aidlc-coordination/src/server.mjs +9 -3
- package/dist/services/aidlc-coordination/test/fleet.test.mjs +21 -0
- package/dist/services/aidlc-coordination/test/server-health-auth.test.mjs +67 -0
- package/dist/src/adapters.d.ts +0 -3
- package/dist/src/adapters.js +3 -5
- package/dist/src/cli/argv.d.ts +12 -0
- package/dist/src/cli/argv.js +68 -0
- package/dist/src/cli/commands.d.ts +8 -0
- package/dist/src/cli/commands.js +159 -0
- package/dist/src/cli/loop-launcher.d.ts +47 -0
- package/dist/src/cli/loop-launcher.js +322 -0
- package/dist/src/cli/options.d.ts +25 -0
- package/dist/src/cli/options.js +32 -0
- package/dist/src/cli/prompt.d.ts +9 -0
- package/dist/src/cli/prompt.js +66 -0
- package/dist/src/cli.js +28 -191
- package/dist/src/gate.js +3 -2
- package/dist/src/installer.d.ts +14 -7
- package/dist/src/installer.js +42 -143
- package/dist/src/legacy.js +1 -0
- package/dist/src/managed-content.d.ts +7 -0
- package/dist/src/managed-content.js +15 -4
- package/dist/src/managed-planning.d.ts +65 -0
- package/dist/src/managed-planning.js +219 -0
- package/dist/src/mcp-setup.js +3 -1
- package/dist/src/model/config-contracts.d.ts +65 -0
- package/dist/src/model/config-contracts.js +1 -0
- package/dist/src/model/install-contracts.d.ts +29 -0
- package/dist/src/model/install-contracts.js +1 -0
- package/dist/src/model/lifecycle-enums.d.ts +13 -0
- package/dist/src/model/lifecycle-enums.js +1 -0
- package/dist/src/model/loop.d.ts +20 -0
- package/dist/src/model/loop.js +1 -0
- package/dist/src/model/manifest.d.ts +16 -0
- package/dist/src/model/manifest.js +1 -0
- package/dist/src/model/records.d.ts +142 -0
- package/dist/src/model/records.js +1 -0
- package/dist/src/model.d.ts +11 -264
- package/dist/src/model.js +1 -1
- package/dist/src/profiles.d.ts +2 -0
- package/dist/src/profiles.js +53 -9
- package/dist/src/state/archive-record.d.ts +9 -0
- package/dist/src/state/archive-record.js +26 -0
- package/dist/src/state/commands.d.ts +18 -0
- package/dist/src/state/commands.js +27 -0
- package/dist/src/state/domain.d.ts +9 -0
- package/dist/src/state/domain.js +9 -0
- package/dist/src/state/guards.d.ts +7 -0
- package/dist/src/state/guards.js +17 -0
- package/dist/src/state/io.d.ts +10 -0
- package/dist/src/state/io.js +35 -0
- package/dist/src/state/items.d.ts +3 -4
- package/dist/src/state/items.js +58 -57
- package/dist/src/state/lessons.js +14 -7
- package/dist/src/state/lifecycle.js +2 -2
- package/dist/src/state/lock.js +7 -6
- package/dist/src/state/memory.js +24 -12
- package/dist/src/state/{archive.js → migrate.js} +7 -7
- package/dist/src/state/partition.d.ts +15 -0
- package/dist/src/state/partition.js +90 -0
- package/dist/src/state/paths.d.ts +11 -0
- package/dist/src/state/paths.js +12 -0
- package/dist/src/state/render.js +9 -6
- package/dist/src/state/store.js +9 -15
- package/dist/src/state/transitions.js +9 -7
- package/dist/src/state/validate.js +55 -7
- package/dist/src/state.d.ts +16 -11
- package/dist/src/state.js +16 -11
- package/dist/src/task-ui.d.ts +33 -0
- package/dist/src/task-ui.js +33 -0
- package/dist/src/ui/assets.d.ts +14 -0
- package/dist/src/ui/assets.js +45 -0
- package/dist/src/ui/changes.d.ts +83 -0
- package/dist/src/ui/changes.js +498 -0
- package/dist/src/ui/containers.d.ts +71 -0
- package/dist/src/ui/containers.js +214 -0
- package/dist/src/ui/daemon.d.ts +75 -0
- package/dist/src/ui/daemon.js +232 -0
- package/dist/src/ui/data.d.ts +42 -0
- package/dist/src/ui/data.js +89 -0
- package/dist/src/ui/docs.d.ts +13 -0
- package/dist/src/ui/docs.js +39 -0
- package/dist/src/ui/files.d.ts +3 -0
- package/dist/src/ui/files.js +20 -0
- package/dist/src/ui/http.d.ts +14 -0
- package/dist/src/ui/http.js +80 -0
- package/dist/src/ui/live.d.ts +5 -0
- package/dist/src/ui/live.js +43 -0
- package/dist/src/ui/markdown.d.ts +2 -0
- package/dist/src/ui/markdown.js +127 -0
- package/dist/src/ui/options.d.ts +48 -0
- package/dist/src/ui/options.js +81 -0
- package/dist/src/ui/security.d.ts +34 -0
- package/dist/src/ui/security.js +38 -0
- package/dist/src/ui/server.d.ts +39 -0
- package/dist/src/ui/server.js +347 -0
- package/dist/src/ui/sse.d.ts +14 -0
- package/dist/src/ui/sse.js +281 -0
- package/dist/src/ui/views/board.d.ts +7 -0
- package/dist/src/ui/views/board.js +131 -0
- package/dist/src/ui/views/changes.d.ts +19 -0
- package/dist/src/ui/views/changes.js +154 -0
- package/dist/src/ui/views/components.d.ts +56 -0
- package/dist/src/ui/views/components.js +113 -0
- package/dist/src/ui/views/docs.d.ts +15 -0
- package/dist/src/ui/views/docs.js +64 -0
- package/dist/src/ui/views/layout.d.ts +44 -0
- package/dist/src/ui/views/layout.js +233 -0
- package/dist/src/ui/views/task.d.ts +25 -0
- package/dist/src/ui/views/task.js +320 -0
- package/dist/src/upgrade-board.js +10 -10
- package/dist/src/upgrade.d.ts +0 -1
- package/dist/src/upgrade.js +24 -85
- package/dist/src/workflow.d.ts +4 -0
- package/dist/src/workflow.js +36 -4
- package/docs/README.md +41 -22
- package/docs/architecture.md +101 -37
- package/docs/command-reference.md +289 -52
- package/docs/configuration.md +70 -30
- package/docs/coordination-service.md +91 -30
- package/docs/design-decisions.md +87 -0
- package/docs/development.md +124 -49
- package/docs/loop-local-run.md +228 -0
- package/docs/loop-runbook.md +214 -0
- package/docs/operating-workflow.md +55 -42
- package/docs/testing-and-release.md +72 -49
- package/docs/troubleshooting.md +221 -0
- package/package.json +4 -1
- package/dist/src/ledger.d.ts +0 -22
- package/dist/src/ledger.js +0 -119
- package/dist/src/state/shared.d.ts +0 -29
- package/dist/src/state/shared.js +0 -71
- package/dist/src/tracker.d.ts +0 -36
- package/dist/src/tracker.js +0 -44
- /package/dist/src/state/{archive.d.ts → migrate.d.ts} +0 -0
package/dist/src/workflow.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { readdirSync, readFileSync } from "node:fs";
|
|
3
2
|
import { join } from "node:path";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
5
4
|
import { defaultConfig } from "./profiles.js";
|
|
6
|
-
import { createLessonIndex, emptyMemoryRegistry, emptyState, lessonStateDigest } from "./state.js";
|
|
5
|
+
import { createLessonIndex, digest, emptyMemoryRegistry, emptyState, lessonStateDigest } from "./state.js";
|
|
7
6
|
const owner = "aidlc-core";
|
|
8
7
|
const assetRoot = fileURLToPath(new URL("../assets/.agents", import.meta.url));
|
|
9
8
|
const packageJson = JSON.parse(readFileSync(fileURLToPath(new URL("../../package.json", import.meta.url)), "utf8"));
|
|
10
|
-
|
|
9
|
+
// node:crypto update() hashes Uint8Array bytes unchanged; the cast only satisfies digest's narrower parameter type.
|
|
10
|
+
export const contentHash = (content) => digest(content);
|
|
11
11
|
const collect = (directory, target) => readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
12
12
|
const source = join(directory, entry.name);
|
|
13
13
|
const destination = `${target}/${entry.name}`;
|
|
@@ -17,11 +17,43 @@ export const coreWorkflowFiles = () => [
|
|
|
17
17
|
...collect(join(assetRoot, "aidlc"), ".agents/aidlc"),
|
|
18
18
|
...collect(join(assetRoot, "skills"), ".agents/skills")
|
|
19
19
|
];
|
|
20
|
+
/** Commented template for the loop daemon's env file; seeded once and never overwritten. */
|
|
21
|
+
export const LOOP_ENV_TEMPLATE = `# AI-DLC loop environment, read by \`loop.sh up\` / \`aidlc-kit loop start\` (local mode).
|
|
22
|
+
# Precedence: shell exports > this file > values detected from your tools' own config.
|
|
23
|
+
# Keep real keys here only; .agents/.gitignore excludes this file from git.
|
|
24
|
+
# See what the loop will use with: .agents/aidlc/scripts/loop.sh check
|
|
25
|
+
#
|
|
26
|
+
# --- OpenCode (lead or workers set to "opencode") ---
|
|
27
|
+
# Model as provider/model[#variant] (list them with: opencode models).
|
|
28
|
+
# When unset, "model" from opencode.json is used.
|
|
29
|
+
# AIDLC_OPENCODE_MODEL=opencode-go/<model>
|
|
30
|
+
# Worker key; when unset it is read from ~/.local/share/opencode/auth.json.
|
|
31
|
+
# The key follows the model prefix: openai/ -> OPENAI_API_KEY, anthropic/ -> ANTHROPIC_API_KEY, otherwise OPENCODE_API_KEY.
|
|
32
|
+
# OPENCODE_API_KEY=
|
|
33
|
+
#
|
|
34
|
+
# --- Codex workers ---
|
|
35
|
+
# When unset, read from ~/.codex/auth.json (after: codex login --with-api-key).
|
|
36
|
+
# OPENAI_API_KEY=
|
|
37
|
+
#
|
|
38
|
+
# --- Claude Code workers ---
|
|
39
|
+
# When unset, read from "env" in .claude/settings.local.json, .claude/settings.json, or ~/.claude/settings.json.
|
|
40
|
+
# ANTHROPIC_API_KEY=
|
|
41
|
+
#
|
|
42
|
+
# --- Optional ---
|
|
43
|
+
# Override the auto-built worker image:
|
|
44
|
+
# AIDLC_WORKER_DOCKER_IMAGE=
|
|
45
|
+
# Where worker worktrees live (default: the system temp directory):
|
|
46
|
+
# AIDLC_LOCAL_WORKTREES_ROOT=
|
|
47
|
+
`;
|
|
48
|
+
/** Installed files that must be executable (POSIX launchers). */
|
|
49
|
+
export const isExecutableAsset = (path) => path.endsWith(".sh");
|
|
20
50
|
export const initialProjectFiles = () => [
|
|
21
51
|
{ path: ".agents/config.json", owner: "aidlc-project", ownershipClass: "project", content: `${JSON.stringify(defaultConfig(), null, 2)}\n` },
|
|
22
52
|
{ path: ".agents/data/state/aidlc-state.json", owner: "aidlc-state", ownershipClass: "state", content: `${JSON.stringify(emptyState(), null, 2)}\n` },
|
|
23
53
|
{ path: ".agents/data/lessons/index.json", owner: "aidlc-state", ownershipClass: "state", content: `${JSON.stringify(createLessonIndex([], lessonStateDigest(emptyState())), null, 2)}\n` },
|
|
24
|
-
{ path: ".agents/data/memory/agentic-memory.json", owner: "aidlc-memory", ownershipClass: "project", content: `${JSON.stringify(emptyMemoryRegistry(), null, 2)}\n` }
|
|
54
|
+
{ path: ".agents/data/memory/agentic-memory.json", owner: "aidlc-memory", ownershipClass: "project", content: `${JSON.stringify(emptyMemoryRegistry(), null, 2)}\n` },
|
|
55
|
+
{ path: ".agents/loop.env", owner: "aidlc-project", ownershipClass: "project", content: LOOP_ENV_TEMPLATE },
|
|
56
|
+
{ path: ".agents/.gitignore", owner: "aidlc-project", ownershipClass: "project", content: "# Local loop credentials (aidlc-kit)\nloop.env\n# Loop daemon/process state and per-task runtime data (aidlc-kit)\ndata/loop/\ndata/tasks/*/runtime/\n" }
|
|
25
57
|
];
|
|
26
58
|
export const manifestKey = (spec) => spec.strategy === "managed-block" ? `${spec.path}#${spec.owner}` : spec.path;
|
|
27
59
|
export const manifestFor = (files, adapters) => ({
|
package/docs/README.md
CHANGED
|
@@ -1,31 +1,50 @@
|
|
|
1
1
|
# Documentation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pick a page by what you want to do. New here? Install with the [README](../README.md), then read [Operating the workflow](./operating-workflow.md).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> The loop, fleet mode, and the coordination service are pre-1.0 and experimental. See [Status and stability](./loop-runbook.md#status-and-stability).
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
2. Read [Operating the workflow](./operating-workflow.md) before asking an agent to change a project.
|
|
9
|
-
3. Use [Configuration](./configuration.md) to configure project rules, profiles, and Codex, Claude Code, and OpenCode permissions.
|
|
10
|
-
4. Keep [Command reference](./command-reference.md) nearby for safe CLI usage.
|
|
11
|
-
5. Read [AI-DLC Coordination service](./coordination-service.md) before enabling remote canonical state — the service and the loop are **experimental and unfinished**, with known bugs and possible breaking changes in every release before `1.0.0`.
|
|
8
|
+
## Get started
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
| Page | Read it when… |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| [README](../README.md) | You are installing the workflow into a project. |
|
|
13
|
+
| [Loop setup runbook](./loop-runbook.md) | You want to enable the loop, locally or across machines. |
|
|
14
|
+
| [Local loop walkthrough](./loop-local-run.md) | The loop is set up and you want to add tasks, watch them, approve gates, and use the dashboard. |
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
2. Use [Testing and release](./testing-and-release.md) for the verification and package-smoke workflow.
|
|
17
|
-
3. Read [Architecture](./architecture.md) before changing package, installed-runtime, migration, or asset behaviour.
|
|
16
|
+
## Use and operate
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
| Page | Read it when… |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| [Operating the workflow](./operating-workflow.md) | You want the lifecycle, task state, review gates, and handoffs. |
|
|
21
|
+
| [AI-DLC Coordination service](./coordination-service.md) | You are deploying remote state or fleet workers on several machines. |
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
| --- | --- | --- |
|
|
23
|
-
| [Operating the workflow](./operating-workflow.md) | Operators | Lifecycle, task state, human gates, and blocked work. |
|
|
24
|
-
| [Configuration](./configuration.md) | Operators and maintainers | Project configuration, profile precedence, rules, and Codex, Claude Code, and OpenCode permissions. |
|
|
25
|
-
| [Command reference](./command-reference.md) | Operators | Package CLI commands, flags, previews, and safety limits. |
|
|
26
|
-
| [Development](./development.md) | Contributors | Dependencies, source layout, local commands, and implementation rules. |
|
|
27
|
-
| [Testing and release](./testing-and-release.md) | Maintainers | Test strategy, evaluator, package smoke test, and release checks. |
|
|
28
|
-
| [Architecture](./architecture.md) | Contributors | Boundaries, dependency direction, and source-to-consumer flow. |
|
|
29
|
-
| [AI-DLC Coordination service](./coordination-service.md) | Operators | Opt-in service deployment, state authority, and credential safety. Experimental and unfinished: known bugs, breaking changes possible before `1.0.0`. |
|
|
23
|
+
## Reference
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
| Page | Read it when… |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| [Configuration](./configuration.md) | You are editing `.agents/config.json`: profiles, rules, agent permissions, loop settings. |
|
|
28
|
+
| [Command reference](./command-reference.md) | You need a command, flag, environment variable, or installed script. |
|
|
29
|
+
| [Troubleshooting](./troubleshooting.md) | You have an error code, a stuck or paused task, or a dashboard problem. |
|
|
30
|
+
|
|
31
|
+
## Contribute
|
|
32
|
+
|
|
33
|
+
| Page | Read it when… |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| [Development](./development.md) | You are setting up this repository, dogfooding its workflow, or changing source. |
|
|
36
|
+
| [Testing and release](./testing-and-release.md) | You are verifying a change or preparing a release. |
|
|
37
|
+
| [Architecture](./architecture.md) | You are changing a package boundary, installed runtime, migration, or asset layout. |
|
|
38
|
+
| [Design decisions](./design-decisions.md) | You need the reasoning behind a project-wide decision, or must record one. |
|
|
39
|
+
|
|
40
|
+
## Adding or changing a page
|
|
41
|
+
|
|
42
|
+
Pages are flat `docs/<slug>.md` files; the dashboard, tests, and external links depend on the names.
|
|
43
|
+
|
|
44
|
+
- **Shape:** `# Title`, a 1–2 sentence opening (purpose and audience), `##` headings by reader task, tables for lookups, `## Related` with 2–4 links.
|
|
45
|
+
- **One source of truth:** each fact lives on one page; other pages give one sentence and a link. Experimental features get only a one-line callout to [Status and stability](./loop-runbook.md#status-and-stability).
|
|
46
|
+
- **Links:** `./<slug>.md#anchor`. The dashboard keeps links to pages in `DOC_PAGES` (`src/ui/docs.ts`) in-app and opens the rest on GitHub. Don't rename a linked heading without updating the links.
|
|
47
|
+
- **Register it:** add the page to a table above; to show it in the dashboard, add it to `DOC_PAGES` and run `node --test dist/test/unit/ui-docs.test.js` after `npm run build`; if the package must always ship it, add it to the docs test in `test/unit/installer.test.ts`.
|
|
48
|
+
- **Versions:** pages with version-pinned commands go on the [version bump checklist](./testing-and-release.md#version-bump-checklist).
|
|
49
|
+
|
|
50
|
+
A public command, configuration field, or installed-layout change updates the relevant page and its test in the same change.
|
package/docs/architecture.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Architecture
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
One Node.js/TypeScript package: the CLI installs and maintains static AI-DLC workflow assets; installed projects run dependency-free scripts locally.
|
|
4
4
|
|
|
5
5
|
## Source-to-consumer flow
|
|
6
6
|
|
|
@@ -14,55 +14,117 @@ dist/assets/.agents/ + dist/src/
|
|
|
14
14
|
consumer project: .agents/aidlc/ + .agents/skills/ + project-owned .agents/data/
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **Source layout** is this repository's editable `assets/aidlc/` and `skills/` tree.
|
|
20
|
-
- **Bundle layout** is generated under `dist/assets/.agents/` for package publication.
|
|
21
|
-
- **Installed layout** is written under a consumer project's `.agents/` directory.
|
|
22
|
-
|
|
23
|
-
`dist/` is generated. Source assets and installed assets must remain behaviourally aligned through the bundle and package-smoke tests.
|
|
17
|
+
Layouts: **source** (editable `assets/aidlc/`, `skills/`), **bundle** (generated `dist/assets/.agents/`, never hand-edited), **installed** (consumer `.agents/`); bundle and package-smoke tests keep them aligned.
|
|
24
18
|
|
|
25
19
|
## Module boundaries
|
|
26
20
|
|
|
27
21
|
| Boundary | Modules | Responsibility |
|
|
28
22
|
| --- | --- | --- |
|
|
29
|
-
| CLI and installation | `src/cli.ts`, `src/installer.ts`, `src/workflow.ts`, `src/adapters.ts` | Parse commands, select adapters, plan deterministic writes, install managed assets
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
| CLI and installation | `src/cli.ts` + `src/cli/` (`argv`, `options`, `prompt`, `commands`), `src/installer.ts`, `src/workflow.ts`, `src/adapters.ts`, `src/mcp-setup.ts` | Parse commands, select adapters, plan deterministic writes, install managed assets (incl. coordination-service template), status/doctor. |
|
|
24
|
+
| Shared planning core | `src/managed-planning.ts` | Manifest reading, inventory keys, managed-file planning ladder (create/skip/update/conflict), init vs upgrade policies. |
|
|
25
|
+
| Lifecycle domain | `src/model/` (barrel `src/model.ts`), `src/state/` (barrel `src/state.ts`), `src/gate.ts`, `src/context.ts` | Validate state, compute transitions and gate readiness, classify next actions, build phase packets. |
|
|
26
|
+
| Profiles | `src/profiles.ts` | Resolve and validate config/profiles (incl. schema-only `tracker`), expand effective rules. |
|
|
27
|
+
| Migration | `src/upgrade.ts`, `src/project-migration.ts`, `src/legacy.ts`, `src/upgrade-board.ts` | Legacy-data and version-layout migration (incl. legacy `BOARD.md`) with audit backups. |
|
|
28
|
+
| Web dashboard | `src/task-ui.ts` (barrel) over `src/ui/`; browser scripts `assets/ui/*.js` | Serve `aidlc-kit ui` dependency-free; mutations only spawn installed scripts, never write state. |
|
|
29
|
+
| Shared file semantics | `src/project-path.ts`, `src/managed-content.ts` | Path containment, unsafe-symlink rejection, managed-block marker format. |
|
|
30
|
+
| Development evaluator | `dev/evaluator/` | Repository-only; never in the published CLI. |
|
|
31
|
+
|
|
32
|
+
`src/state/`: `io`, `paths`, `domain`, `guards`, `archive-record`, `items`, `commands`, `transitions`, `validate`, `store`, `memory`, `lessons`, `lifecycle`, `render`, `migrate`, `lock`.
|
|
33
|
+
|
|
34
|
+
### Web dashboard modules
|
|
35
|
+
|
|
36
|
+
- `src/ui/server`: route table (`ROUTES`) and `startUiServer`.
|
|
37
|
+
- `src/ui/security`: Host and request-shape checks (Origin, `Sec-Fetch-Site`, custom header); there is no session token.
|
|
38
|
+
- `src/ui/containers`: per-task worker container index and raw log tail (`.agents/data/tasks/<id>/runtime/workers/`), with `docker ps` enrichment.
|
|
39
|
+
- `src/ui/changes`: code changes with one source order for every mode (fleet snapshot → assignments → task range from `baseCommit`/`finalCommit` → working tree).
|
|
40
|
+
- `src/ui/options`, `src/ui/http`: option parsing, HTTP helpers.
|
|
41
|
+
- `src/ui/assets`: whitelisted static CSS/JS from `assets/ui/`.
|
|
42
|
+
- `src/ui/daemon`: daemon status, health, spawned script actions.
|
|
43
|
+
- `src/ui/data`: local and fleet reads.
|
|
44
|
+
- `src/ui/changes`: task diffs via Git.
|
|
45
|
+
- `src/ui/live`, `src/ui/sse`: `/api/live` regions and `/api/events`.
|
|
46
|
+
- `src/ui/markdown`: Markdown rendering.
|
|
47
|
+
- `src/ui/docs`: read-only packaged `docs/*.md` via the fixed `DOC_PAGES` whitelist.
|
|
48
|
+
- `src/ui/files`: byte-range file reads, optionally refusing symlinks.
|
|
49
|
+
- `src/ui/views/`: `layout`, `components`, `board`, `task`, `changes`, `docs`.
|
|
50
|
+
- `assets/ui/*.js`: plain browser scripts `common`, `dashboard`, `detail`, `live-log`, `changes`.
|
|
51
|
+
|
|
52
|
+
New page: route in `ROUTES` (`src/ui/server.ts`) + view in `src/ui/views/`.
|
|
53
|
+
|
|
54
|
+
### Dependency direction
|
|
55
|
+
|
|
56
|
+
- Inward only: CLI, installation, migration depend on planning core, lifecycle, shared helpers.
|
|
57
|
+
- Planning core depends only on `model`, `workflow`, `managed-content`, `profiles`; never on CLI, installer, or upgrade.
|
|
58
|
+
- Migration never imports installation (`upgrade.ts` uses `managed-planning.ts` directly); the only `installer.ts` → `project-migration.ts` edge is init-time legacy-layout planning.
|
|
59
|
+
- Lifecycle never depends on installation; the evaluator may provision one but is not published runtime.
|
|
60
|
+
- `src/ledger.ts` and `src/tracker.ts` were removed as dead code; `tracker` config is schema-only (`TrackerConfig`).
|
|
37
61
|
|
|
38
62
|
## Installed workflow runtime
|
|
39
63
|
|
|
40
|
-
|
|
64
|
+
Kernel: contracts, templates, schemas, profiles, dependency-free scripts in `.agents/aidlc/`, reached via thin adapter instructions. Customisation stays outside:
|
|
41
65
|
|
|
42
66
|
| Location | Ownership | Purpose |
|
|
43
67
|
| --- | --- | --- |
|
|
44
|
-
| `.agents/aidlc/` | Package managed | Lifecycle contracts, schemas,
|
|
45
|
-
| `.agents/data/` | Project owned | Canonical state, task artifacts, derived indexes, memory,
|
|
46
|
-
| `.agents/project/` | Project owned | Local profiles, rules,
|
|
68
|
+
| `.agents/aidlc/` | Package managed | Lifecycle contracts, schemas, scripts. |
|
|
69
|
+
| `.agents/data/` | Project owned | Canonical state, task artifacts, derived indexes, memory, evidence. |
|
|
70
|
+
| `.agents/project/` | Project owned | Local profiles, rules, evaluation material. |
|
|
47
71
|
|
|
48
|
-
|
|
72
|
+
State machine enforces the lifecycle; gates need human approval; evidence is append-only; no `aidlc-kit` executable or duplicate board file needed.
|
|
73
|
+
|
|
74
|
+
### Loop runtime
|
|
49
75
|
|
|
50
76
|
> [!WARNING]
|
|
51
|
-
>
|
|
77
|
+
> Experimental, pre-1.0. See [Status and stability](./loop-runbook.md#status-and-stability).
|
|
78
|
+
|
|
79
|
+
Dispatch derives from task `nextAction` and dependency-ready work; assignment records are operational metadata; phase, evidence, gates stay canonical. Selecting a mode only configures; `loop start` (or `loop up`) runs.
|
|
52
80
|
|
|
53
|
-
|
|
81
|
+
| Variant | Authority | How it runs |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| Interactive | Local `.agents/data/state/` | In the current agent conversation; native workers claim and checkpoint via assignment records in the task's `runtime/` directory. |
|
|
84
|
+
| Local | Local `.agents/data/state/` | Singleton daemon (`loop start` or `loop.sh up`): host-executed lead, Docker-isolated workers; gate approval only via trusted host terminal or dashboard. |
|
|
85
|
+
| Fleet | Coordination service | Service owns supervisor leases, gate checkpoints, reviewer approval; Docker workers hold own credentials; Git uses fenced lead/worker claims with commit handoff. SQLite single-host, PostgreSQL multi-host. |
|
|
86
|
+
|
|
87
|
+
Every variant is a wrapper around the same data: the canonical task state (including `baseCommit`/`finalCommit`, written by `state.mjs` locally and `remote-state.mjs` in fleet mode through the shared core) and the task directory `.agents/data/tasks/<id>/`. Review artifacts (`intent.md`, `design.md`, `workplan.md`) sit at its root; everything operational sits under `runtime/`, identical for the no-loop workflow, the local loop, and fleet (one helper, `lib/task-runtime.mjs`, names every path and refuses symlinked components):
|
|
88
|
+
|
|
89
|
+
| `.agents/data/tasks/<id>/runtime/` | Written by | Purpose |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| `assignments.json`, `assignments.lock` | `assignment.mjs` (interactive), local supervisor | worker claims (local only; fleet claims live in the service) |
|
|
92
|
+
| `events.jsonl` (+ `.1`) | `loop-stream.mjs` | the task's event history (dashboard live log) |
|
|
93
|
+
| `run.json` | `loop-runtime.mjs` | the loop run record (run id, agent, status, session, checkpoint) |
|
|
94
|
+
| `intake.json`, `requirement.md` | loop intake | loop ownership and the requirement text |
|
|
95
|
+
| `workers/index.json`, `workers/<assignment>.log` | local and fleet workers | container index and raw output |
|
|
54
96
|
|
|
55
|
-
|
|
97
|
+
`.agents/data/loop/` holds only daemon and process state: `daemon.lock`, `daemon.log`, `daemon.stop`, the global `ui-events.jsonl`, `ui.json`/`cli.json`, task leases (`<id>.lease`), the lead checkpoint (`<id>.supervisor.json`) and gate receipt. Both directories are operational: never committed, handed off, or clean-checked, and the installer's `.agents/.gitignore` excludes them. Files written by versions before this layout are read in place and moved by `aidlc-kit loop migrate-data` or the daemon at start ([Command reference](./command-reference.md#loop)).
|
|
98
|
+
|
|
99
|
+
**Agent support.**
|
|
100
|
+
|
|
101
|
+
- Host-executed lead turns: Codex, Claude Code, OpenCode.
|
|
102
|
+
- Container-isolated lead turns: Codex, Claude Code; OpenCode rejected with a diagnostic (file-based credentials; `lib/loop-lead-sandbox.mjs`).
|
|
103
|
+
- Docker workers (local and fleet): all three; OpenCode uses environment credentials, XDG roots redirected into the ephemeral worker HOME (`lib/loop-worker-docker.mjs`).
|
|
104
|
+
|
|
105
|
+
**Leases, locks, and claims.** One holder-file primitive (`lib/loop-holder.mjs`), three meanings:
|
|
106
|
+
|
|
107
|
+
- **Lock:** short mutex around a file write (assignment records).
|
|
108
|
+
- **Lease:** process ownership of the singleton daemon or one task's loop run (replacing separate runner and supervisor leases); its `activity` (`waiting` or `turn`) gates approval.
|
|
109
|
+
- **Claim:** a worker's ownership of an item and its paths.
|
|
110
|
+
|
|
111
|
+
One file format and liveness rule; 15 s renewal, 60 s TTL; a `<file>.guard` serializes reclaim, renewal, release. `aidlc-kit loop leases` lists them; details: [Troubleshooting](./troubleshooting.md#loop-leases-locks-and-claims).
|
|
112
|
+
|
|
113
|
+
### Installed entry points
|
|
114
|
+
|
|
115
|
+
A shared strict argv parser validates command shape before root discovery, lock acquisition, and state reads. Explicit roots must be validated project directories; implicit roots use nearest-ancestor `.agents/aidlc/` discovery, never an arbitrary cwd.
|
|
56
116
|
|
|
57
117
|
## Trust and safety boundaries
|
|
58
118
|
|
|
59
|
-
-
|
|
60
|
-
- Install/upgrade plans
|
|
61
|
-
-
|
|
62
|
-
- Codex
|
|
63
|
-
- Project commands
|
|
64
|
-
- Canonical state, terminal records, and rendered workplans reject symlink traversal
|
|
65
|
-
-
|
|
119
|
+
- Assets are local (manifest `remoteUpdates: false`); status/doctor never consult a registry.
|
|
120
|
+
- Install/upgrade plans: conflict-first, path-contained, no unsafe symlink traversal.
|
|
121
|
+
- Upgrade is human-only (interactive confirmation); agents never run or discover upgrades.
|
|
122
|
+
- Codex: project-scoped `.codex/config.toml`, `.codex/rules/aidlc.rules`. Claude Code: lifecycle-script permission via local settings and phase skills. OpenCode: owner-scoped `AGENTS.md` block only; `.opencode/` read for detection only.
|
|
123
|
+
- Project commands: executable-and-argument arrays, never shell strings.
|
|
124
|
+
- Canonical state, terminal records, and rendered workplans reject symlink traversal; writes are same-directory atomic replaces.
|
|
125
|
+
- State lock: guard-serialized; release verifies the owner token directly, so a contended guard cannot strand it; stale when its pid is gone and it is 30 s old.
|
|
126
|
+
- Loop holders (`lib/loop-holder.mjs`) re-read the token under the guard on reclaim, so a reclaimer never deletes a newer holder.
|
|
127
|
+
- The compact master catalog is archive authority; recovery replaces only a valid, unreferenced terminal orphan matching the active catalog task by `id` and `createdAt`; referenced, malformed, or identity-conflicting records fail closed.
|
|
66
128
|
|
|
67
129
|
## Change impact guide
|
|
68
130
|
|
|
@@ -70,11 +132,13 @@ Installed entry points share a strict dependency-free argv parser. Parsing and c
|
|
|
70
132
|
| --- | --- |
|
|
71
133
|
| A lifecycle/state rule | Installed scripts, schemas, gate/context rendering, runtime parity tests. |
|
|
72
134
|
| An asset or adapter | Asset builder, package inventory, installer, adapter tests, tarball smoke test. |
|
|
73
|
-
| A configuration/profile field | Validator, schema, effective-profile behaviour,
|
|
74
|
-
| Migration semantics | Upgrade plan/apply logic, path safety, transaction rollback,
|
|
75
|
-
| A public command | CLI parsing, README/setup guidance, command reference,
|
|
76
|
-
|
|
77
|
-
Use this guide with [Development](./development.md) and [Testing and release](./testing-and-release.md) before changing a cross-cutting boundary.
|
|
135
|
+
| A configuration/profile field | Validator, schema, effective-profile behaviour, docs, tests. |
|
|
136
|
+
| Migration semantics | Upgrade plan/apply logic, path safety, transaction rollback, migration tests. |
|
|
137
|
+
| A public command | CLI parsing, README/setup guidance, command reference, package tests. |
|
|
78
138
|
|
|
139
|
+
## Related
|
|
79
140
|
|
|
80
|
-
|
|
141
|
+
- [Development guide](./development.md)
|
|
142
|
+
- [Testing and release](./testing-and-release.md)
|
|
143
|
+
- [Design decisions](./design-decisions.md)
|
|
144
|
+
- [Coordination service](./coordination-service.md)
|