@naxodev/apnea 0.1.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/CONTEXT.md +61 -0
- package/CONTRIBUTING.md +21 -0
- package/LICENSE +21 -0
- package/README.md +163 -0
- package/SECURITY.md +35 -0
- package/briefs/coder.md +40 -0
- package/briefs/orchestrator.md +49 -0
- package/briefs/planner.md +54 -0
- package/briefs/reviewer.md +40 -0
- package/dist/cli.js +39397 -0
- package/docs/adr/0001-completion-signaling.md +3 -0
- package/docs/adr/0002-orchestrator-authority.md +3 -0
- package/docs/adr/0003-verify-at-gate.md +3 -0
- package/docs/adr/0004-artifact-layout-and-naming.md +3 -0
- package/docs/adr/0005-harness-profiles.md +5 -0
- package/docs/adr/0006-config-trust-model.md +3 -0
- package/docs/adr/0007-jj-first-commits.md +3 -0
- package/docs/adr/0008-effect-v4-internals.md +3 -0
- package/docs/adr/0009-cli-driver-split.md +9 -0
- package/docs/adr/0010-package-split.md +23 -0
- package/docs/protocol/artifacts.md +68 -0
- package/docs/protocol/config.md +186 -0
- package/docs/protocol/manual-gate.md +38 -0
- package/docs/protocol/overview.md +96 -0
- package/extension/adapters/commit.ts +15 -0
- package/extension/adapters/dispatch.ts +15 -0
- package/extension/adapters/setup.ts +34 -0
- package/extension/adapters/start.ts +16 -0
- package/extension/adapters/status.ts +24 -0
- package/extension/adapters/wait.ts +20 -0
- package/extension/api.ts +16 -0
- package/extension/cli/format.ts +44 -0
- package/extension/cli/human-gate.ts +44 -0
- package/extension/cli/main.ts +218 -0
- package/extension/cli/parse.ts +48 -0
- package/extension/domain/artifact-kind.ts +26 -0
- package/extension/domain/frontmatter.ts +69 -0
- package/extension/domain/herdr.ts +109 -0
- package/extension/domain/paths.ts +139 -0
- package/extension/domain/recovery.ts +25 -0
- package/extension/domain/rounds.ts +16 -0
- package/extension/domain/setup.ts +158 -0
- package/extension/domain/slug.ts +9 -0
- package/extension/domain/state-machine.ts +132 -0
- package/extension/domain/timeouts.ts +24 -0
- package/extension/domain/types.ts +145 -0
- package/extension/domain/verify-commands.ts +128 -0
- package/extension/errors.ts +247 -0
- package/extension/host-adapter.ts +8 -0
- package/extension/registry.ts +323 -0
- package/extension/result.ts +55 -0
- package/extension/run-tool.ts +43 -0
- package/extension/schema/config.ts +315 -0
- package/extension/schema/frontmatter.ts +34 -0
- package/extension/schema/state.ts +119 -0
- package/extension/services/app-live.ts +24 -0
- package/extension/services/config.ts +103 -0
- package/extension/services/file-system.ts +178 -0
- package/extension/services/herdr.ts +860 -0
- package/extension/services/run-store.ts +99 -0
- package/extension/services/vcs.ts +246 -0
- package/extension/workflows/commit.ts +148 -0
- package/extension/workflows/dispatch.ts +693 -0
- package/extension/workflows/reset.ts +26 -0
- package/extension/workflows/setup.ts +301 -0
- package/extension/workflows/start.ts +149 -0
- package/extension/workflows/status.ts +45 -0
- package/extension/workflows/wait.ts +793 -0
- package/herdr-plugin/herdr-plugin.toml +15 -0
- package/herdr-plugin/scripts/run-task.sh +8 -0
- package/package.json +75 -0
- package/schemas/artifact-frontmatter.md +38 -0
- package/schemas/config.schema.json +50 -0
- package/schemas/state.schema.json +63 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
id = "apnea"
|
|
2
|
+
name = "Apnea"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Apnea floating-pane worker for oneshot role dispatches."
|
|
5
|
+
min_herdr_version = "0.7.4"
|
|
6
|
+
platforms = ["linux", "macos"]
|
|
7
|
+
|
|
8
|
+
[[panes]]
|
|
9
|
+
id = "worker"
|
|
10
|
+
title = "Apnea worker"
|
|
11
|
+
placement = "overlay"
|
|
12
|
+
# Absolute bash + plugin-relative script. Bare `bash` fails on stripped plugin
|
|
13
|
+
# PATH (exit 127). Do not pass a foreign --cwd to plugin pane open — relative
|
|
14
|
+
# script paths resolve against that cwd, not plugin_root.
|
|
15
|
+
command = ["/bin/bash", "scripts/run-task.sh"]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
if [[ -z "${APNEA_TASK_SCRIPT:-}" ]]; then
|
|
4
|
+
echo "apnea: APNEA_TASK_SCRIPT not set (open this pane via apnea dispatch)" >&2
|
|
5
|
+
exit 64
|
|
6
|
+
fi
|
|
7
|
+
# Absolute bash: popup PATH may not resolve bare `bash` (exit 127).
|
|
8
|
+
exec /bin/bash "$APNEA_TASK_SCRIPT"
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@naxodev/apnea",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Host-neutral multi-role workflow engine and standalone Bun CLI",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Nacho Vazquez",
|
|
7
|
+
"funding": "https://github.com/sponsors/NachoVazquez",
|
|
8
|
+
"homepage": "https://github.com/naxodev/ai/tree/main/packages/apnea#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/naxodev/ai.git",
|
|
12
|
+
"directory": "packages/apnea"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/naxodev/ai/issues"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./extension/api.ts"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"apnea": "./dist/cli.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"apnea",
|
|
26
|
+
"workflow",
|
|
27
|
+
"herdr",
|
|
28
|
+
"cli",
|
|
29
|
+
"agent"
|
|
30
|
+
],
|
|
31
|
+
"files": [
|
|
32
|
+
"CONTEXT.md",
|
|
33
|
+
"CONTRIBUTING.md",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"README.md",
|
|
36
|
+
"SECURITY.md",
|
|
37
|
+
"briefs",
|
|
38
|
+
"dist",
|
|
39
|
+
"docs/adr",
|
|
40
|
+
"docs/protocol",
|
|
41
|
+
"extension",
|
|
42
|
+
"herdr-plugin",
|
|
43
|
+
"schemas",
|
|
44
|
+
"!extension/**/*.test.ts",
|
|
45
|
+
"!extension/test"
|
|
46
|
+
],
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public",
|
|
49
|
+
"provenance": true
|
|
50
|
+
},
|
|
51
|
+
"packageManager": "bun@1.3.7",
|
|
52
|
+
"engines": {
|
|
53
|
+
"bun": ">=1.3.7"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "bun build ./extension/cli/main.ts --target=bun --outfile ./dist/cli.js",
|
|
57
|
+
"check": "bun run typecheck && bun run test && bun run format:check && bun run pack:check && bun run smoke:package",
|
|
58
|
+
"typecheck": "tsc --noEmit",
|
|
59
|
+
"test": "bun run build && bun test extension",
|
|
60
|
+
"format": "prettier --write .",
|
|
61
|
+
"format:check": "prettier --check .",
|
|
62
|
+
"pack:check": "bun run build && bun scripts/verify-pack.ts",
|
|
63
|
+
"smoke:package": "bun scripts/package-smoke.ts"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"effect": "4.0.0-beta.101",
|
|
67
|
+
"typebox": "^1.3.6"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@types/bun": "^1.3.14",
|
|
71
|
+
"@types/node": "^26.1.2",
|
|
72
|
+
"prettier": "^3.9.0",
|
|
73
|
+
"typescript": "^7.0.2"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Artifact front-matter (v1)
|
|
2
|
+
|
|
3
|
+
YAML between `---` lines at file start.
|
|
4
|
+
|
|
5
|
+
## All artifacts
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
status: done
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`status` other than `done` is invalid in v1.
|
|
12
|
+
|
|
13
|
+
## Review artifacts (plan-review, code-review)
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
status: done
|
|
17
|
+
verdict: APPROVED | CHANGES_REQUIRED
|
|
18
|
+
rework: code | phase_package # code-review CHANGES_REQUIRED only
|
|
19
|
+
nits: | # optional string; meaningful only with APPROVED
|
|
20
|
+
...
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- Missing `verdict` on a review artifact → invalid.
|
|
24
|
+
- `nits` with `CHANGES_REQUIRED` is allowed but ignored by the commit gate.
|
|
25
|
+
- A code-review `CHANGES_REQUIRED` may set `rework` to `code` or `phase_package`.
|
|
26
|
+
- Missing `rework` means `code` for compatibility with existing reviews.
|
|
27
|
+
- Omit `rework` from plan reviews and approved code reviews.
|
|
28
|
+
- Commit gate cares only: `verdict == APPROVED` and verify commands exit 0.
|
|
29
|
+
|
|
30
|
+
## Non-review artifacts
|
|
31
|
+
|
|
32
|
+
plan, phase-package, coder-result, pr-description:
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
status: done
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
No `verdict` field expected.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://naxodev.com/apnea/config.schema.json",
|
|
4
|
+
"title": "ApneaConfig",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"profiles": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"additionalProperties": false,
|
|
13
|
+
"properties": {
|
|
14
|
+
"cmd_oneshot": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": { "type": "string" },
|
|
17
|
+
"minItems": 1
|
|
18
|
+
},
|
|
19
|
+
"cmd_interactive": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": { "type": "string" },
|
|
22
|
+
"minItems": 1
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"roles": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["profile"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"profile": { "type": "string", "minLength": 1 }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"review_round_cap": { "type": "integer", "minimum": 1, "maximum": 20 },
|
|
39
|
+
"timeouts_ms": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"additionalProperties": { "type": "integer", "minimum": 1000 }
|
|
42
|
+
},
|
|
43
|
+
"pane_style": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": ["regular", "floating"],
|
|
46
|
+
"default": "regular",
|
|
47
|
+
"description": "Herdr pane style for role dispatches. \"floating\" applies to oneshot roles only and requires herdr >= 0.7.4; interactive roles always use regular panes. Default: regular."
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://naxodev.com/apnea/state.schema.json",
|
|
4
|
+
"title": "ApneaRunState",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["version", "slug", "step", "phase_index", "rounds", "vcs"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "const": 1 },
|
|
10
|
+
"slug": { "type": "string", "minLength": 1 },
|
|
11
|
+
"step": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": [
|
|
14
|
+
"planning",
|
|
15
|
+
"plan_review",
|
|
16
|
+
"phase_packaging",
|
|
17
|
+
"coding",
|
|
18
|
+
"code_review",
|
|
19
|
+
"committing",
|
|
20
|
+
"finishing",
|
|
21
|
+
"done"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"phase_index": { "type": "integer", "minimum": 0 },
|
|
25
|
+
"phase_count_hint": { "type": ["integer", "null"], "minimum": 0 },
|
|
26
|
+
"rounds": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"description": "Keys like phase-01/plan_review or phase-01/code_review",
|
|
29
|
+
"additionalProperties": { "type": "integer", "minimum": 1 }
|
|
30
|
+
},
|
|
31
|
+
"vcs": { "type": "string", "enum": ["jj", "git"] },
|
|
32
|
+
"allow_dirty": { "type": "boolean" },
|
|
33
|
+
"goal": { "type": "string" },
|
|
34
|
+
"last_error": { "type": ["string", "null"] },
|
|
35
|
+
"pending_artifact": { "type": ["string", "null"] },
|
|
36
|
+
"pending_role": { "type": ["string", "null"] },
|
|
37
|
+
"pending_pane_id": { "type": ["string", "null"] },
|
|
38
|
+
"pending_pane_label": { "type": ["string", "null"] },
|
|
39
|
+
"pending_floating_exit": { "type": ["string", "null"] },
|
|
40
|
+
"pending_started_at": { "type": ["integer", "null"] },
|
|
41
|
+
"pending_deadline_ms": { "type": ["integer", "null"] },
|
|
42
|
+
"pending_nudged_at": { "type": ["integer", "null"] },
|
|
43
|
+
"pending_final_grace": { "type": "boolean" },
|
|
44
|
+
"pending_extended": { "type": "boolean" },
|
|
45
|
+
"role_panes": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"required": ["pane_id", "label"],
|
|
50
|
+
"properties": {
|
|
51
|
+
"pane_id": { "type": "string" },
|
|
52
|
+
"label": { "type": "string" },
|
|
53
|
+
"profile_fingerprint": { "type": ["string", "null"] }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"package_root": { "type": "string" },
|
|
58
|
+
"reviewer_tree_fingerprint": { "type": ["string", "null"] },
|
|
59
|
+
"current_phase_package": { "type": ["string", "null"] },
|
|
60
|
+
"current_code_review": { "type": ["string", "null"] },
|
|
61
|
+
"phase_package_rework": { "type": "boolean" }
|
|
62
|
+
}
|
|
63
|
+
}
|