@atolis-hq/wake 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/LICENSE +201 -0
- package/README.md +140 -0
- package/dist/src/adapters/claude/claude-runner.js +388 -0
- package/dist/src/adapters/claude/prompt-templates.js +57 -0
- package/dist/src/adapters/codex/codex-runner.js +391 -0
- package/dist/src/adapters/cursor/cursor-runner.js +352 -0
- package/dist/src/adapters/docker/docker-cli.js +97 -0
- package/dist/src/adapters/fake/fake-artifact-verifier.js +14 -0
- package/dist/src/adapters/fake/fake-github-pull-request-activity-source.js +73 -0
- package/dist/src/adapters/fake/fake-resource-index.js +21 -0
- package/dist/src/adapters/fake/fake-runner.js +22 -0
- package/dist/src/adapters/fake/fake-ticketing-system.js +166 -0
- package/dist/src/adapters/fake/fake-workspace-manager.js +27 -0
- package/dist/src/adapters/fs/resource-index.js +84 -0
- package/dist/src/adapters/fs/self-update-ledger.js +17 -0
- package/dist/src/adapters/fs/state-store.js +364 -0
- package/dist/src/adapters/git/git-workspace-manager.js +168 -0
- package/dist/src/adapters/github/github-artifact-verifier.js +38 -0
- package/dist/src/adapters/github/github-auth.js +16 -0
- package/dist/src/adapters/github/github-client.js +100 -0
- package/dist/src/adapters/github/github-issues-work-source.js +410 -0
- package/dist/src/adapters/github/github-pull-request-activity-source.js +263 -0
- package/dist/src/adapters/http/ui-assets.js +302 -0
- package/dist/src/adapters/http/ui-data.js +389 -0
- package/dist/src/adapters/http/ui-server.js +151 -0
- package/dist/src/adapters/runner/cli-command.js +43 -0
- package/dist/src/adapters/runner/prompt-templates.js +76 -0
- package/dist/src/adapters/runner/runner-cli-adapter.js +112 -0
- package/dist/src/adapters/runner/runner-registry.js +141 -0
- package/dist/src/adapters/runner/stage-prompt.js +256 -0
- package/dist/src/adapters/runner/transcripts.js +25 -0
- package/dist/src/cli/correlate-command.js +62 -0
- package/dist/src/cli/init-command.js +11 -0
- package/dist/src/cli/locks-command.js +19 -0
- package/dist/src/cli/sandbox-command.js +191 -0
- package/dist/src/cli/sandbox-logging.js +30 -0
- package/dist/src/cli/sandbox-resume.js +77 -0
- package/dist/src/cli/scaffold-assets.js +173 -0
- package/dist/src/cli/self-update-command.js +158 -0
- package/dist/src/cli/startup-preflight.js +127 -0
- package/dist/src/cli/stop-command.js +42 -0
- package/dist/src/cli/ui-command.js +27 -0
- package/dist/src/config/defaults.js +11 -0
- package/dist/src/config/load-config.js +26 -0
- package/dist/src/core/contracts.js +1 -0
- package/dist/src/core/control-plane.js +127 -0
- package/dist/src/core/lifecycle-service.js +8 -0
- package/dist/src/core/policy-engine.js +200 -0
- package/dist/src/core/projection-updater.js +438 -0
- package/dist/src/core/quota-backoff.js +69 -0
- package/dist/src/core/sink-router.js +85 -0
- package/dist/src/core/tick-runner.js +1347 -0
- package/dist/src/domain/branch-naming.js +14 -0
- package/dist/src/domain/resource-uri.js +38 -0
- package/dist/src/domain/runner-routing.js +108 -0
- package/dist/src/domain/schema.js +685 -0
- package/dist/src/domain/sources.js +16 -0
- package/dist/src/domain/stages.js +39 -0
- package/dist/src/domain/types.js +1 -0
- package/dist/src/domain/workflows.js +83 -0
- package/dist/src/lib/clock.js +5 -0
- package/dist/src/lib/event-log.js +21 -0
- package/dist/src/lib/json-file.js +23 -0
- package/dist/src/lib/lock.js +118 -0
- package/dist/src/lib/paths.js +44 -0
- package/dist/src/lib/work-id.js +19 -0
- package/dist/src/main.js +523 -0
- package/dist/src/version.js +1 -0
- package/docker/Dockerfile +54 -0
- package/docker/entrypoint.sh +75 -0
- package/docker/log-command.sh +107 -0
- package/docker/setup.sh +72 -0
- package/package.json +52 -0
- package/prompts/implement.md +49 -0
- package/prompts/refine.md +44 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
label="${WAKE_SANDBOX_LABEL:-sandbox.exec}"
|
|
5
|
+
host_wake_root="${WAKE_SANDBOX_HOST_WAKE_ROOT:-/wake}"
|
|
6
|
+
container_wake_root="${WAKE_SANDBOX_CONTAINER_WAKE_ROOT:-/wake}"
|
|
7
|
+
prompts_root="${WAKE_SANDBOX_PROMPTS_ROOT:-/wake/prompts}"
|
|
8
|
+
container_home="${WAKE_SANDBOX_CONTAINER_HOME:-/home/wake}"
|
|
9
|
+
host_container_home="${WAKE_SANDBOX_HOST_CONTAINER_HOME:-}"
|
|
10
|
+
container_mount="${WAKE_SANDBOX_CONTAINER_MOUNT:-/wake}"
|
|
11
|
+
container_name="${WAKE_SANDBOX_CONTAINER_NAME:-wake-sandbox}"
|
|
12
|
+
working_dir="${WAKE_SANDBOX_CWD:-}"
|
|
13
|
+
codex_bootstrap_home="${container_home}/.codex"
|
|
14
|
+
codex_runtime_home="${container_home}/.codex-runtime"
|
|
15
|
+
|
|
16
|
+
mirror_stdout() {
|
|
17
|
+
local line="$1"
|
|
18
|
+
printf '%s\n' "${line}"
|
|
19
|
+
if [ -w /proc/1/fd/1 ]; then
|
|
20
|
+
printf '%s\n' "${line}" > /proc/1/fd/1 || true
|
|
21
|
+
fi
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
mirror_stderr() {
|
|
25
|
+
local line="$1"
|
|
26
|
+
printf '%s\n' "${line}" >&2
|
|
27
|
+
if [ -w /proc/1/fd/2 ]; then
|
|
28
|
+
printf '%s\n' "${line}" > /proc/1/fd/2 || true
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
scrub() {
|
|
33
|
+
sed -E \
|
|
34
|
+
-e 's/([A-Za-z0-9_]*(TOKEN|SECRET|PASSWORD|PASS|KEY)[A-Za-z0-9_]*=)[^[:space:]]+/\1[REDACTED]/Ig' \
|
|
35
|
+
-e 's/(gho|ghp|github_pat)_[A-Za-z0-9_]+/[REDACTED]/g'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
emit_check() {
|
|
39
|
+
local description="$1"
|
|
40
|
+
shift
|
|
41
|
+
local output
|
|
42
|
+
set +e
|
|
43
|
+
output="$("$@" 2>&1)"
|
|
44
|
+
local status=$?
|
|
45
|
+
set -e
|
|
46
|
+
if [ -n "${output}" ]; then
|
|
47
|
+
while IFS= read -r line; do
|
|
48
|
+
[ -n "${line}" ] && mirror_stdout "[${label}] ${description}: ${line}"
|
|
49
|
+
done < <(printf '%s\n' "${output}" | scrub)
|
|
50
|
+
else
|
|
51
|
+
mirror_stdout "[${label}] ${description}: (no output)"
|
|
52
|
+
fi
|
|
53
|
+
mirror_stdout "[${label}] ${description}: exit_code=${status}"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
prepare_codex_home() {
|
|
57
|
+
mkdir -p "${codex_runtime_home}"
|
|
58
|
+
|
|
59
|
+
if [ -f "${codex_bootstrap_home}/config.toml" ]; then
|
|
60
|
+
cp "${codex_bootstrap_home}/config.toml" "${codex_runtime_home}/config.toml"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if [ -f "${codex_bootstrap_home}/auth.json" ] && [ ! -f "${codex_runtime_home}/auth.json" ]; then
|
|
64
|
+
cp "${codex_bootstrap_home}/auth.json" "${codex_runtime_home}/auth.json"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
export CODEX_HOME="${codex_runtime_home}"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if [ "${1:-}" != "--" ]; then
|
|
71
|
+
mirror_stderr "[${label}] expected -- before the wrapped command"
|
|
72
|
+
exit 64
|
|
73
|
+
fi
|
|
74
|
+
shift
|
|
75
|
+
|
|
76
|
+
if [ "$#" -eq 0 ]; then
|
|
77
|
+
mirror_stderr "[${label}] no wrapped command was provided"
|
|
78
|
+
exit 64
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
if [ -n "${working_dir}" ]; then
|
|
82
|
+
cd "${working_dir}"
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
prepare_codex_home
|
|
86
|
+
|
|
87
|
+
mirror_stdout "[${label}] begin ts=$(date -u +%FT%TZ) cwd=$(pwd) command=$*"
|
|
88
|
+
mirror_stdout "[${label}] paths hostWakeRoot=${host_wake_root} containerWakeRoot=${container_wake_root} promptsRoot=${prompts_root} containerHome=${container_home} hostContainerHome=${host_container_home} containerMount=${container_mount} containerName=${container_name}"
|
|
89
|
+
|
|
90
|
+
emit_check "wake-config" test -f "${container_mount}/config.json"
|
|
91
|
+
emit_check "prompts-root" test -d "${prompts_root}"
|
|
92
|
+
emit_check "workspaces-root" test -d "${container_mount}/workspaces"
|
|
93
|
+
emit_check "repos-root" test -d "${container_mount}/repos"
|
|
94
|
+
emit_check "gh-auth-status" gh auth status
|
|
95
|
+
emit_check "claude-auth-status" claude auth status
|
|
96
|
+
emit_check "codex-auth-status" codex login status
|
|
97
|
+
emit_check "cursor-auth-status" cursor status
|
|
98
|
+
|
|
99
|
+
set +e
|
|
100
|
+
"$@" \
|
|
101
|
+
> >(while IFS= read -r line; do mirror_stdout "[${label}] stdout: ${line}"; done) \
|
|
102
|
+
2> >(while IFS= read -r line; do mirror_stderr "[${label}] stderr: ${line}"; done)
|
|
103
|
+
status=$?
|
|
104
|
+
set -e
|
|
105
|
+
|
|
106
|
+
mirror_stdout "[${label}] end exit_code=${status}"
|
|
107
|
+
exit "${status}"
|
package/docker/setup.sh
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
echo "Wake sandbox setup starting."
|
|
5
|
+
|
|
6
|
+
codex_bootstrap_home="/home/wake/.codex"
|
|
7
|
+
codex_runtime_home="/home/wake/.codex-runtime"
|
|
8
|
+
|
|
9
|
+
prompt_yes_no() {
|
|
10
|
+
local message="$1"
|
|
11
|
+
local reply
|
|
12
|
+
read -r -p "${message} [y/N] " reply
|
|
13
|
+
case "$reply" in
|
|
14
|
+
[Yy]|[Yy][Ee][Ss])
|
|
15
|
+
return 0
|
|
16
|
+
;;
|
|
17
|
+
*)
|
|
18
|
+
return 1
|
|
19
|
+
;;
|
|
20
|
+
esac
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
prepare_codex_home() {
|
|
24
|
+
mkdir -p "${codex_runtime_home}"
|
|
25
|
+
|
|
26
|
+
if [ -f "${codex_bootstrap_home}/config.toml" ]; then
|
|
27
|
+
cp "${codex_bootstrap_home}/config.toml" "${codex_runtime_home}/config.toml"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [ -f "${codex_bootstrap_home}/auth.json" ] && [ ! -f "${codex_runtime_home}/auth.json" ]; then
|
|
31
|
+
cp "${codex_bootstrap_home}/auth.json" "${codex_runtime_home}/auth.json"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
export CODEX_HOME="${codex_runtime_home}"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
prepare_codex_home
|
|
38
|
+
|
|
39
|
+
if [ ! -f /home/wake/.ssh/id_ed25519 ]; then
|
|
40
|
+
mkdir -p /home/wake/.ssh
|
|
41
|
+
chmod 700 /home/wake/.ssh
|
|
42
|
+
ssh-keygen -t ed25519 -f /home/wake/.ssh/id_ed25519 -N ""
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
if prompt_yes_no "Configure GitHub auth?"; then
|
|
46
|
+
echo "Optional best practice: sign in with a dedicated GitHub identity for Wake-managed agent work,"
|
|
47
|
+
echo "rather than your main personal account. Make sure it has only the repository access Wake needs."
|
|
48
|
+
gh auth login
|
|
49
|
+
gh auth setup-git
|
|
50
|
+
else
|
|
51
|
+
echo "Skipping GitHub auth setup."
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
cat /home/wake/.ssh/id_ed25519.pub
|
|
55
|
+
|
|
56
|
+
if prompt_yes_no "Configure Claude auth?"; then
|
|
57
|
+
claude auth login --claudeai
|
|
58
|
+
else
|
|
59
|
+
echo "Skipping Claude auth setup."
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
if prompt_yes_no "Configure Codex auth?"; then
|
|
63
|
+
codex login
|
|
64
|
+
else
|
|
65
|
+
echo "Skipping Codex auth setup."
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
if prompt_yes_no "Configure Cursor auth?"; then
|
|
69
|
+
agent login
|
|
70
|
+
else
|
|
71
|
+
echo "Skipping Cursor auth setup."
|
|
72
|
+
fi
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atolis-hq/wake",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local autonomous agent control plane for software development",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"wake": "./dist/src/main.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/src/main.js",
|
|
11
|
+
"exports": "./dist/src/main.js",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/src",
|
|
14
|
+
"docker",
|
|
15
|
+
"prompts",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p tsconfig.json && node scripts/embed-version.mjs",
|
|
27
|
+
"prepack": "npm run build",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"start": "tsx src/main.ts start",
|
|
31
|
+
"tick": "tsx src/main.ts tick",
|
|
32
|
+
"ui": "tsx src/main.ts ui",
|
|
33
|
+
"e2e:github-fake": "tsx scripts/e2e-github-fake.ts",
|
|
34
|
+
"smoke": "tsx src/main.ts smoke",
|
|
35
|
+
"smoke:claude": "tsx src/main.ts smoke claude",
|
|
36
|
+
"smoke:codex": "tsx src/main.ts smoke codex",
|
|
37
|
+
"smoke:cursor": "tsx src/main.ts smoke cursor",
|
|
38
|
+
"verify": "npm run build && npm test"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@octokit/rest": "^22.0.0",
|
|
42
|
+
"handlebars": "^4.7.9",
|
|
43
|
+
"ulid": "^3.0.2",
|
|
44
|
+
"zod": "^4.1.5"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^24.3.0",
|
|
48
|
+
"tsx": "^4.20.5",
|
|
49
|
+
"typescript": "^5.9.2",
|
|
50
|
+
"vitest": "^3.2.4"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
stage: implement
|
|
3
|
+
permissionMode: acceptEdits
|
|
4
|
+
allowedTools: Bash(git *), Bash(gh *), Bash(npm *), Bash(curl *), Bash(jq *), Edit, Write, Read, Glob, Grep, WebSearch, WebFetch
|
|
5
|
+
extraArgs:
|
|
6
|
+
maxTurns: 150
|
|
7
|
+
skipApproval: false
|
|
8
|
+
---
|
|
9
|
+
{{#if isStart}}
|
|
10
|
+
You are Wake, in the IMPLEMENT stage for {{workItemKey}}.
|
|
11
|
+
|
|
12
|
+
Your current working directory is a git checkout of {{repo}}, already on
|
|
13
|
+
branch {{branch}}, created from the latest main.
|
|
14
|
+
|
|
15
|
+
Completion requirements:
|
|
16
|
+
- Make the code changes needed to resolve the issue directly in this working
|
|
17
|
+
directory.
|
|
18
|
+
- Stage and commit all changes with `git add -A` and a clear, descriptive
|
|
19
|
+
commit message.
|
|
20
|
+
- Push the branch with `git push -u origin {{branch}}`.
|
|
21
|
+
- Open a pull request against main with `gh pr create --base main --head
|
|
22
|
+
{{branch}} --title "<summary>" --body "Closes #{{issueNumber}}
|
|
23
|
+
|
|
24
|
+
<!-- wake:work-item {{workItemKey}} -->"`. Include the
|
|
25
|
+
`<!-- wake:work-item {{workItemKey}} -->` marker verbatim in the PR body,
|
|
26
|
+
exactly as written here.
|
|
27
|
+
- Do not merge the pull request yourself; a human reviews and merges it.
|
|
28
|
+
- Include the pull request URL in your prose response.
|
|
29
|
+
- If you cannot safely complete the change, leave the workspace as-is and end
|
|
30
|
+
with BLOCKED or FAILED instead of guessing.
|
|
31
|
+
|
|
32
|
+
Wake will provide the issue data and comments below in a delimited untrusted
|
|
33
|
+
data block.
|
|
34
|
+
{{else}}
|
|
35
|
+
Resuming the IMPLEMENT stage session for {{workItemKey}}.
|
|
36
|
+
|
|
37
|
+
Your current working directory is still the git checkout of {{repo}} on
|
|
38
|
+
branch {{branch}}. Continue from where you left off rather than starting
|
|
39
|
+
over, unless the new comments below change the approach.
|
|
40
|
+
|
|
41
|
+
{{feedbackCommandNote}}
|
|
42
|
+
New comments since your last turn (excludes Wake/bot comments):
|
|
43
|
+
Wake will provide them below in a delimited untrusted data block.
|
|
44
|
+
|
|
45
|
+
Reminder of the completion requirements: commit, push {{branch}}, open a PR
|
|
46
|
+
with `gh pr create` closing #{{issueNumber}}, and never merge it yourself. The
|
|
47
|
+
PR body must include the `<!-- wake:work-item {{workItemKey}} -->` marker
|
|
48
|
+
verbatim.
|
|
49
|
+
{{/if}}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
stage: refine
|
|
3
|
+
permissionMode: default
|
|
4
|
+
allowedTools: Read, Glob, Grep, Bash(git fetch), Bash(git status), WebSearch, WebFetch
|
|
5
|
+
extraArgs:
|
|
6
|
+
maxTurns: 40
|
|
7
|
+
skipApproval: false
|
|
8
|
+
---
|
|
9
|
+
{{#if isStart}}
|
|
10
|
+
You are Wake, in the REFINE stage for {{workItemKey}}.
|
|
11
|
+
|
|
12
|
+
This is a planning-only stage.
|
|
13
|
+
{{toolCapabilityNote}}
|
|
14
|
+
|
|
15
|
+
The canonical clone has already been fetched and reset to the latest `origin/main`
|
|
16
|
+
by Wake before this session started - you do not need to run `git fetch`. You may
|
|
17
|
+
run `git status` to inspect repository state.
|
|
18
|
+
|
|
19
|
+
Your job here is only to:
|
|
20
|
+
- Read the repository (via your available tools) and decide whether the
|
|
21
|
+
issue is well-specified enough to implement as-is.
|
|
22
|
+
- If well-specified, write a short implementation plan as plain text in your
|
|
23
|
+
response (do not try to save it to a file).
|
|
24
|
+
- If underspecified, ask the smallest set of clarifying questions needed.
|
|
25
|
+
|
|
26
|
+
Wake will provide the issue data and comments below in a delimited untrusted
|
|
27
|
+
data block.
|
|
28
|
+
{{else}}
|
|
29
|
+
Resuming the REFINE stage session for {{workItemKey}}.
|
|
30
|
+
|
|
31
|
+
{{toolCapabilityNote}}
|
|
32
|
+
|
|
33
|
+
You may run `git fetch origin` to ensure the canonical clone is up-to-date,
|
|
34
|
+
and `git status` to inspect repository state. If any git operation results in
|
|
35
|
+
merge conflicts, cancel the action and return BLOCKED rather than attempting
|
|
36
|
+
to resolve conflicts.
|
|
37
|
+
|
|
38
|
+
{{feedbackCommandNote}}
|
|
39
|
+
New comments since your last turn (excludes Wake/bot comments):
|
|
40
|
+
Wake will provide them below in a delimited untrusted data block.
|
|
41
|
+
|
|
42
|
+
Re-evaluate whether the issue is now well-specified enough to implement,
|
|
43
|
+
incorporating the new context above.
|
|
44
|
+
{{/if}}
|