48 Commits

Author SHA1 Message Date
wishforge
aa4915b214 🔧 Offer gateway model names without the [1m] suffix in the project model catalog 2026-11-09 01:23:38 -08:00
wishforge
6c054bcab0 ✨ Optimize every Copilot draft, honor a project budget, and record Wiki gaps 2026-11-08 23:35:21 -08:00
wishforge
0157b2a5ec ⏱️ Fit Copilot model attempts inside one 270 s budget and keep the Wish key stable 2026-11-08 23:27:24 -08:00
wishforge
34e221d880 🔒 Require verbatim Wiki citations and keep code paths out of customer answers 2026-11-08 23:00:20 -08:00
wishforge
4118e30872 ✨ Add the Copilot sidebar, Wiki source page, and browser acceptance script 2026-11-08 22:36:27 -08:00
wishforge
bf721b84a7 🎨 Format source files and ignore local acceptance artifacts 2026-11-08 22:23:01 -08:00
eust-w
ee340d6a8b ✨ Raise default run token limit to 100M and max cap to 500M
Claude Code runs with cache reads count toward token budget and easily
exceeded the former 1M default and 10M cap. The default is now 100M
tokens and the maximum allowed cap is 500M.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-03 14:30:23 +08:00
eust-w
59243ac85a 🐛 Give wish optimization more time, and a fallback model
Flash gets 180 s to finish the structured JSON. If it times out or the
JSON does not parse, the same request is tried again with deepseek-pro.
The console proxy waits long enough for both attempts.

Co-Authored-By: Claude Haiku 4.5 (1M context) <noreply@anthropic.com>
2026-11-02 15:30:20 +08:00
eust-w
b672d16277 ✨ Let project settings fetch the gateway's models
The available-models checklist has a "get models" button. The control
plane asks the gateway's /v1/models with its own key and returns names
only, to owners and admins.

Co-Authored-By: Claude Haiku 4.5 (1M context) <noreply@anthropic.com>
2026-11-02 14:28:16 +08:00
eust-w
97ee4467a3 🐛 Let the console import the model catalog without the contracts entry
The settings checklist pulled values from the contracts barrel, which
Turbopack cannot follow. The catalog now lives in its own entry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-02 12:21:26 +08:00
eust-w
b1f94302d7 ✨ Offer project models as a checklist, and default wishes to flash
Owners pick from deepseek-flash and deepseek-pro instead of typing names.
A wish uses flash when the project offers it, even if pro was listed first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-02 12:10:38 +08:00
eust-w
4cffd71be8 ✨ Learn project skills from runs, and export a wish's report
- Skills: per-project know-how the platform proposes from each succeeded
  run (in the background, or on request from a run), people confirm,
  edit, disable, delete or write; active ones enter later prompts
- Export one skill as SKILL.md, or all as a zip with a directory per
  skill, as .claude/skills/ expects
- A wish's report: every run, its stage timeline, the agent's plan,
  replies, commands, changed files and model usage, the change, the
  checks, failures, reviews and releases, and the full event log, as
  Markdown, or laid out for printing to PDF

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:57:24 +08:00
eust-w
6d615c0ffd ⚖️ Count cache reads a tenth toward budgets, and allow runs up to 10M tokens
- countedTokens: input, output and cache creation in full, cache reads a
  tenth, as they cost; the worker meters Claude CLI usage with it and the
  usage event says how much counted
- A run's token budget may be raised to 10,000,000

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:26:27 +08:00
eust-w
72085cf752 ✨ Let a project offer models and a wish choose one
- Projects list the models their wishes may run with, the first by
  default; owners and admins set them in the project settings
- A wish may choose one of its project's models; the choice is checked
  and pinned to the run, which shows it, and the executor starts the
  agent with it (--model), else with the agent configuration's
- Model names may be spelled as the model gateway does
  (deepseek-pro@latest[1m]), in projects and agent configurations alike

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:08:35 +08:00
eust-w
aa151d16f9 ✨ Deliver to Fanyu's cluster from the dev branch beside the POC
- Profiles pin each environment: POC (branch poc) and Fanyu (branch dev,
  180.76.138.88, droboticflow-fanyu), with their Deployments by UID
- Releases expect every Deployment of their profile; Fanyu's api image
  also runs its annotation processor and validator, each rolled back to
  its own image
- Bindings may list several projects; each Runner has its own settings
- fanyu-access: least-privilege identity and build-Pod admission policy in
  Fanyu's cluster, its token only in the executor and Fanyu's Runner
- projects --replace: delete every project with all it holds, then create
  the POC and Fanyu projects, their environments and Runners
- Ship the Runner's public keys in the ConfigMap, not a Mac path

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 17:47:47 +08:00
eust-w
c5a6c6160d 🚀 Deploy WishForge to the POC cluster, with check Pods and daily backups
- cluster-poc.mjs: image (in-cluster Kaniko), bootstrap, secrets, apply,
  migrate --rehearsal|--final, public HTTPS entry, backup and restore
- One restricted Pod (platform, executor, Runner, PostgreSQL, Temporal,
  MinIO, Caddy, backup) listening only on loopback except Caddy
- Protected checks run in per-workspace check Pods; cancellation during
  start-up now always removes them
- Daily snapshots on the node (consistent dump with row counts, Temporal
  online backup), copied to the Mac by launchd with SHA-256 checks and a
  notification on failure; restore verified on the rehearsal copy
- Downloads and uploads survive the Mac's lossy link to the cluster
- Local public entry, evidence isolation labels, acceptance records

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 16:27:07 +08:00
eust-w
addf330b10 ✨ Add account types and enforce per-user wish permissions
- Provide six account types and custom combinations of wish, code review,
  release and management permissions, applied on each authenticated request.
- Enforce frontend-only accounts when submitting, answering, widening and
  reverting wishes; require every contributor to have full access before
  skipping backend code review.
- Gate code review and release decisions by their specific permissions.
- Rework member management to create and edit account types, permissions and
  project access, and reflect those permissions throughout the console.
- Update the manual and architecture docs with permission tests and
  end-to-end coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 12:07:08 +08:00
eust-w
17553e2f8f ✨ Let a person widen a frontend-only wish to backend code
When the agent of a frontend-only wish asks to change backend code, or keeps
changing it until the repair rounds run out, the run details offer "改为前端和
后端并继续". It answers the wish with allowBackend: the run may change backend
code from the new requirement revision on, the agent reads that the scope
changed, and the timeline records who widened it. Whether a backend change needs
a review still depends on the submitter's backend permission. Only an answer to
a frontend-only wish accepts the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:19:08 +08:00
eust-w
bf3313620e ✨ Let each wish stay frontend-only, and optimize wishes into short goals with choices
- Each wish says whether it may change backend code. A frontend-only wish is told
  which paths it must leave alone; a change to them goes back before any check runs,
  the platform puts those files back before the repair round, and the control plane
  never integrates them. A wish that may change backend code integrates directly for
  people with backend permission and waits for a code review otherwise.
- Owners and admins grant backend permission per person on the members page as well
  as per project in the project settings.
- AI optimization has its own button for the wish and for the criteria. It writes a
  wish of at most three lines (goal, scope, limits), keeps the details in checkable
  criteria, and asks only what the person must decide, as choices whose answers join
  the wish; suggested criteria are taken one by one.
- Lists, run titles, Feishu cards and pull request titles show a wish's first line;
  the run details show the rest.
- Changed paths no longer follow renames, so moving backend code into a frontend
  directory counts at both places for code review and for the frontend-only scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 20:37:30 +08:00
eust-w
a4eaefc69f ✨ Hold reviewed paths, take back runs, optimize wishes and notify in Feishu
What the pilot asked for, from its meeting:

- Code review: a project names the paths changes to which a person reviews
  before they reach the target branch (globs, with exceptions). After the
  checks pass, the verifier asks the control plane, and the run waits at
  integration until an owner or admin approves the exact commit; approving
  integrates it without repeating the checks, rejecting hands the comment to
  the agent as a new requirement. Continuing cannot get around it: the
  verifier asks again before every integration.
- Undo: "take back this change" starts a run that reverses what a run
  integrated on the current target branch, three-way, keeping later commits;
  only lines later commits changed too go to the agent. It then verifies,
  integrates and delivers like any run. Releases get a rollback button for the
  version live in their environment.
- Wish optimization: the local Claude account rewrites a draft wish and its
  acceptance criteria by built-in and project rules, with no tools at all;
  the person compares and decides, nothing is submitted for them.
- Release confirmation: an environment can make every release wait for a
  person, not only those the risk rules flag.
- Feishu notifications: a group bot is told of releases awaiting approval and
  changes awaiting review (mentioning the decision makers), runs that need a
  person, finished runs and failed releases; each once, signed when a secret
  is set, with text from runs never acting as card markup.
- Reviewers see the agent's change summary and who submitted the wish, and
  whether the checks ran in the macOS sandbox; the wish form offers only the
  executors this deployment can run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:08:27 +08:00
eust-w
e8f99f4b24 👥 Let each person sign in with an account of their own
Everyone used the one local administrator, so the system could not tell who
asked for a change, and anyone could approve anything. Owners and admins now
create accounts on a members page: a login name, a display name and a role,
with a password shown once. The control plane keeps only its scrypt hash, and
account creation is deliberately not replayable by idempotency key, so the
password is stored nowhere a replay could return it.

The console checks a password through a control plane route its proxy never
forwards from a browser, then calls the control plane with its local
credential plus the person's account and password version; those headers
count only together with that credential. Disabling an account stops it at
once, and resetting a password ends its existing sessions. A session that is
neither the administrator nor a valid account gets no credential at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:08:14 +08:00
eust-w
40a20f5dfb 🌐 Name timeline events in Chinese
The run timeline showed raw event kinds such as provider.file_change. Each
kind now has a Chinese label, with the raw kind kept in its tooltip; a kind
the console does not know is shown as it came.

The executor event kinds move to the import-free providers entry, so the
console's test can check that every kind has a label without pulling the
contracts entry into the browser bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:07:20 +08:00
eust-w
862a133f36 🌐 Name the reasons a release waits for approval in Chinese
The release page listed why a release needs approval as the control
plane wrote it, in English, while everything around it is Chinese, and
approving is the one decision there that a person has to make.

The reasons now live in the contracts package, in a module that imports
nothing, as the provider list does: the control plane gives them and the
console names each in Chinese, a protected change with its path. A
reason the console has no name for fails its type check; one it does
not know at all is shown as it came.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 11:32:08 +08:00
eust-w
b201fd04a9 ✨ Wait for people when commits pushed to the target branch broke it
When a run's change passed its checks but failed one once merged onto
a target branch that moved meanwhile, the agent got a repair round for
it, even when the failure came from commits other people had pushed:
it would change their code, and spend rounds and tokens doing so.

The verifier now runs that check, recording no evidence, on the target
branch alone. If the branch passes, combining the two caused the
failure, and the agent repairs it as before. If the branch fails too
while the commit the run started from passes, the commits pushed since
broke the branch: the run waits on the new reason target_broken, uses
no repair round, and has its own verified change as its checkpoint
again. A run that started from a commit already failing the check may
be its fix, and is repaired as before.

Continuing merges the verified change onto the repaired branch and
checks the merge. An integration that continues reuses the change's own
verification under the same policy instead of repeating the checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 18:14:19 +08:00
eust-w
d0402589f4 🔒 Close DNS rebinding into the local web console and Theia
- In development sign-in the web proxy attached the development token
  to every request, and reads carry no Origin check: a page that
  rebinds its own domain to 127.0.0.1 could read the API as the
  development user. The token now goes only to requests whose Host is
  this machine or the configured public URL.
- Without THEIA_HOSTS, Theia only checks that a WebSocket's Origin
  matches its Host, which such a page satisfies, terminals included.
  The local IDE now allows only the address the gateway uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 22:22:11 +08:00
eust-w
87e01adb36 🔒 Space out local sign-in checks instead of locking out, and keep the dev server off the LAN
- Eight wrong passwords from anywhere on the network locked the only
  local administrator out for fifteen minutes, again and again. The
  password is 256 random bits, so the limit only has to bound the
  scrypt work: after eight failures, checks are spaced two seconds
  apart, globally, and a burst cannot run them at once.
- The launcher let the Next.js development server listen on the LAN,
  handing every visitor its source maps and hot-reload channel. Only
  the production build may now listen beyond loopback. A listener
  bound to one address is also checked for readiness there, and the
  banner shows the configured port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:33:30 +08:00
eust-w
30369c1430 ✨ Save the agent's work before a run pauses
Pausing revoked the executor at once: the agent was killed and the work
of the current attempt stayed only in the executor's local workspace,
so continuing started that attempt over.

A pause of a run whose executor holds the lease now drains it first:

- The run keeps `running` with pauseRequestedAt (the console shows
  pausing). Its agent gets no model credential and no new model
  request; continuing is refused until the pause completes; cancelling
  still stops it at once.
- The executor learns of it from its heartbeat, stops the agent, saves
  a checkpoint with its live lease and completes the pause through
  /internal/runs/:id/pause. Continuing restores that checkpoint.
- The workflow is stopped only after the pause completes; stopping it
  earlier would abort the save. A model request interrupted by the
  stop no longer expires the pausing run's lease.
- If the executor does not complete it within two minutes, or stopped,
  the heartbeat, the next lease, the coordinator's wait or the
  background sweep pause the run anyway.

Runs no executor is working on still pause at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:38:06 +08:00
eust-w
9b2c8f14a9 🐛 Repair installations the agent's manifest changes broke instead of waiting
Every failed installation waited as an infrastructure fault. When the
agent's own change broke it (a misspelled package, say), continuing
installed the same manifests before the agent ran, failed again, and
the agent never got a turn: the run could not move without a new
requirement revision.

- The verifier attributes a failed installation to the checkpoint when
  it changed dependency manifests (package.json, go.mod, lockfiles and
  the like) and the output is not a network or registry failure. The
  evidence lists those manifests, and the control plane records an
  `install` failure that the next repair round fixes.
- A repair round for an `install` failure starts the agent even when
  the installation fails again, with that output in the prompt.
- Prompts, lessons and the run page name the failed installation.

Any other failed installation still waits for the environment, without
spending a repair round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:32:16 +08:00
eust-w
24c8b8b6b8 🐛 Wait for local services to stop before rebuilding
Reproduce and fix the launchd SIGTERMed shutdown race; wait for owned processes to exit and report timeouts. Describe local task workspaces without claiming OS isolation.
2026-10-25 03:33:47 +08:00
eust-w
6fc7eaf00c ✨ Improve local WishForge reliability and LAN access
Detect actual service and Runner readiness, restore LAN access after network changes, protect production web builds with rollback, honor cancellation during executor startup, and show truthful cached-data and credential states.
2026-10-25 03:29:51 +08:00
eust-w
4e5ab1719c ✨ Enable local Claude delivery to Gitea and POC
Add authenticated LAN access, native Claude execution, checkpoint and budget recovery, and signed POC build/deploy/rollback contracts. Include local service management, regression coverage, and evidence from the completed POC delivery.
2026-10-22 16:21:33 +08:00
eust-w
ed20bf640e fix: keep IDE collaboration sign-in alive, and label branch-run diffs
- OCT holds each login poll open for 30 seconds before answering. The
  gateway gave every upstream 30 seconds of silence, so creating a
  collaboration session failed with "Workspace upstream unavailable" once
  sign-in took that long, and raced at best.
- Collaboration requests now get at least 65 seconds; other upstreams
  keep 30 (upstreamTimeoutMs).
- A run that starts from a branch shows its checkpoint relative to that
  branch, so the branch's own commits, which merge too, are not in the
  diff. The run page now says so instead of "relative to the target
  branch".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 23:24:04 +08:00
eust-w
1beee7e593 feat: deploy the web workbench on the local k3s cluster
The local cluster runs the workbench next to the API. It is a development
build of the web, from the image's new WEB_BUILD=development argument:
- Next.js inlines NODE_ENV into production builds.
- Development sign-in therefore exists only in development builds, and
  production images never carry it.

`node scripts/k3s-local.mjs web` forwards it to http://localhost:3000. The
web refuses changes from any origin but its WF_PUBLIC_URL, so that address
is set at deploy time (WF_K3S_WEB_PORT). `build` now also takes the images
to rebuild, for example `build web`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:20:27 +08:00
eust-w
b4ece6057c fix: let the console build, and stop runs that cannot afford the next model request
Building the web image showed that `next build` failed.
- The console imported runtime values from the contracts entry point.
- Turbopack cannot follow the NodeNext `.js` imports inside that entry,
  which also carries zod and every schema into the browser.
- Only `next dev` had ever run before, and the console used to import
  types only.

The fix:
- The executor catalog moves to an entry without imports, exported as
  @wishforge/contracts/providers. The console takes its values from
  there.
- providerBaseUrl moves to its own module.
- A test keeps value imports of the entry point out of the console.

With the console's default budget of 50,000 tokens, every Codex run
stopped after one model request:
- The proxy reserves one token per request byte, and a Codex request is
  already about 50 KB.
- The executor then reported a bare 429 as a provider failure.

The fix:
- A request the remaining budget cannot cover now puts the run into the
  `budget` wait, with what it needs and what remains.
- The console defaults to 300,000 tokens and explains the reservation.

The run page also marked the stage a successful run ended in as not yet
done; it now shows it as complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:20:27 +08:00
eust-w
1d75b03430 feat: register executors in one catalog and add Claude Code (FR-D1)
Adding an executor touched the contracts, the API's availability check, the
worker and the console separately. Now it is an adapter plus one entry in
@wishforge/contracts' providerCatalog (name, executable variable, whether the
model proxy isolates its credentials) and one in the worker's
providerRegistry; the API, the console's options and MCP's submit_wish read
the catalog, and a test checks every entry is registered with the worker.

The CodeBuddy adapter already parsed Claude-Code-style stream-json, so it is
now a StreamJsonCliAdapter with a dialect per CLI. Claude Code runs headless
with --verbose and --permission-mode bypassPermissions inside the per-run
sandbox and receives only ANTHROPIC_* credentials (WF_CLAUDE_BIN). Like
CodeBuddy it is development-only until the model proxy supports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:23:05 +08:00
eust-w
fb0f60ebe0 feat: let the agent ask clarifying questions before implementing (FR-C4)
A first implementation round may end, without changing any files, with a
QUESTIONS: section of up to five questions. The executor then puts the run in
the clarification wait with the questions in its detail, where the console and
MCP show them; answering already creates a new requirement revision that
starts again from planning. Repair rounds cannot ask: they must fix what the
verifier found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:51:16 +08:00
eust-w
0bcfbc13dd feat(ide): push IDE work to ide/ branches and merge it through a verified wish
People's changes now reach the target branch the same way the agent's do. The
IDE credential carries a ref prefix and the Git service runs a pre-receive hook
on every push that refuses updates outside it, so the IDE can push only
`ide/` branches; the platform's own integration is unaffected.

- A wish may name a source branch. The run starts from that branch's head, the
  agent builds on it, and verification, repair rounds, merging onto a moved
  target and conflict repair work as before. A missing branch makes the run
  wait (git_storage) until it is pushed.
- Release risk is now computed from the target branch before integration, not
  from where the run started: a migration committed on the source branch would
  otherwise have been missed and could have skipped approval.
- Clones work on `ide/work`; a plain `git push` publishes it.
- The console lists a project's IDE branches with a button to submit a wish
  that merges one, and the new-wish form has a starting-point field; MCP
  `submit_wish` accepts `sourceBranch`. The Git service lists branches under
  a prefix for this (`POST /refs`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:17:14 +08:00
eust-w
b810423990 feat: show code changes, verification output and lessons in the console
- Runs: a per-file diff of the latest checkpoint, verification evidence with each
  command's exit code, duration and output tail (and failed installs), the last
  failure that the repair round works on, and the integrated commit when a
  project without delivery completes.
- Projects: repository status with a retry for platform repositories, the
  project's lessons (list, add a convention, disable, delete) and runs filtered
  on the server; IDE texts describe the Git hand-off instead of the removed
  save barrier.
- Releases: the approval dialog shows the requirement, project, target
  environment (production flagged), verification commands and approval deadline
  from a new review endpoint; failed releases say why. Environments locked by a
  deployment with an unknown outcome can be unlocked after a confirmation.
- Errors are titled by HTTP status; secondary text and focus rings meet the
  contrast requirements; the mobile drawer leaves the tab order when closed and
  closes on Esc.
- Sessions: the web BFF refreshes access tokens with the refresh token for up to
  12 hours; IDE gateway sessions are renewed while in use (idle timeout 15 min,
  at most 12 h) and rechecked by the granted user, so revocation still applies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:01:30 +08:00
eust-w
5aea9b73a9 fix: harden the control plane's storage, identities and recovery paths
- Storage: read-only queries use a read-only transaction without the tenant
  lock, so event streams and dashboards no longer queue behind writers; lists
  filter on indexed project, run and status fields and the run list pages with
  limit/before. Dispatchers claim outbox items with SKIP LOCKED and a claim
  deadline; delivered items and old idempotency records are pruned hourly.
- Migrations are versioned files recorded with checksums in schema_migrations;
  002 adds the claim column and run index and migrates preview-stage runs and
  free-text waiting reasons. Run events and usage are append-only for the app.
- Identities: static service tokens reach only their routes (coordinator: state,
  wait, repair; deployer: lease, transition, releases); the static verifier
  identity is gone; Git credentials go only to the lease holder; internal bodies
  are validated; framework and body-parser errors use the API error envelope.
- Quotas: only queued or running runs (or ones with an unsettled model request)
  hold token reservations; continuing a run reserves its remaining budget again.
- Recovery: owners can list and reconcile model requests with an unknown outcome,
  and requests whose proxy died are marked unknown; definite deployment failures
  free the environment, admins can unlock an environment after checking the
  target, approvals expire with their release, and production approvals need a
  second person. The builder's Docker context is operator configuration.
- MCP: list_projects, absolute console links, request_release resolves the run's
  evidence and default environment, and tool changes are audited as the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 16:16:47 +08:00
eust-w
a9411f586b feat: run the whole loop locally with a local provisioner
Local development had no provisioner, so every wish stopped at "sandbox not
ready", and dev:all started neither the coordinator nor the deployer.

- The provisioner moves from apps/ide to apps/provisioner and gains a backend
  switch: `local` starts an executor and a verifier process per run generation
  on this host (WF_SANDBOX_MODE=host, own directories and run-scoped tokens,
  development mode only) and points workspaces at the local Theia; `kubernetes`
  keeps the Kata Jobs, now started with the image entrypoint instead of the npm dev
  script and allowed to reach the platform Git service.
- In development the resource grant needs no runtime image digest.
- setup:local is one idempotent script that creates or completes .env.local,
  including the deployment mode, provisioner and grant settings.
- dev:all starts Git, API, provisioner, coordinator, deployer and web; dev:ide
  starts Theia and the IDE gateway; ide:install and ide:build wrap the separate
  Theia package. npm test also runs the provisioner tests.
- Project settings accept the target branch and dependency install commands.
- Web development conveniences require WF_DEPLOYMENT_MODE=development.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:36:12 +08:00
eust-w
cce214f8fb feat: close the main loop from wish to integrated commit
Verification ran git inside the tree under test, kept no command output and
treated every infrastructure fault as a test failure; repairs went through an
executor lease the coordinator should not hold; and a project without delivery
could never succeed. This reworks the worker execution path and the control-plane
contracts it depends on.

- Verification exports the exact commit to a directory without .git, installs
  dependencies (network allowed) and runs the protected commands under
  bubblewrap in kata mode or directly in host mode; evidence records exit code,
  duration, digest, a redacted output tail and the isolation used. Production
  rejects host evidence. A failed installation waits as infrastructure.
- Waiting reasons are an enum with a redacted detail; dispatcher, GitHub and
  model-proxy states map onto it, and the console explains each one with a way out.
- Repairs are requested by the coordinator through /internal/runs/:id/repair;
  the control plane derives the failure summary from the verifier's evidence and
  enforces the repair budget. Continuing after the budget is spent grants one more
  round; a new requirement revision starts a fresh budget.
- Execution identities may only move a run within their own stages and only to
  running or waiting; success comes from integration evidence (no delivery
  configured) or deployment acceptance. The unused preview stage is gone.
- Integration fast-forwards when the target has not moved, merges and re-verifies
  otherwise, retries when a push finds the target moved, and turns merge conflicts
  into a repair round that merges the current target for the agent to resolve.
- Successful runs that needed a repair leave a project lesson; active lessons are
  injected into later prompts, and admins can list, add, disable and delete them.
- Executor progress (messages, commands, file changes, plan updates) is stored as
  normalized events; previously agent messages were recorded as the literal word
  "output". Provider failures keep the work as a checkpoint and wait as
  provider_error instead of failing the run.
- Workers declare WF_SANDBOX_MODE=host|kata (host refused in production),
  heartbeat with retries until the lease could have expired, and retry safe
  control-plane reads with backoff.
- tests/local-loop.test.ts runs the loop end to end with real Git, the in-process
  control plane behind its internal routes and a scripted agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:15:54 +08:00
eust-w
b90db2cc6f refactor: remove dead code and typecheck the test suite
- Drop the WorkBuddy Cloud executor stub: it always reported
  "unverified" and could never run. WorkBuddy remains an MCP client for
  submitting wishes. Providers are now codex and codebuddy; an unknown
  provider waits with an explicit reason instead of a fake adapter.
- Remove internal routes nobody calls (/internal/releases/:id/begin,
  /accept, /failure and /internal/workspaces/:id/provisioned) with
  their domain methods, the never-consumed release.ready and
  release.rollback outbox events, an unreachable idempotency branch,
  dead helpers in runtime/deploy.ts and an unused RunnerBroker
  dependency.
- Enable noUnusedLocals in the base and web TypeScript configs; the
  runtime package now extends the base config.
- Add tests/tsconfig.json and include it in `npm run typecheck`. This
  surfaced tests still calling the deleted begin/accept path (now
  exercised through the Runner protocol) and five latent type errors.
- Web: provider capability labels match the API's keys and the wish
  form disables unavailable providers.
- Delete the invalid example Runner Job manifest; stop tracking the
  generated apps/web/next-env.d.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:02:27 +08:00
eust-w
3931bf94f0 refactor: hand off between IDE and agents through Git only
The IDE carried a second, Theia-internal coordination system: multi-
client save barriers, a hash-chained snapshot store, IndexedDB draft
recovery, transferable debugger-control leases that intercepted
Theia's plugin RPC, Ed25519 actor assertions from the gateway, and an
API gate that blocked every agent integration while any IDE workspace
was open until a human imported a coordinated snapshot. It depended on
Theia internals, made F5 debugging require five environment variables
plus a gateway-signed header, and stalled agent runs. IDE and agents
now hand off through Git commits (docs/architecture.md ADR-7).

- Delete apps/ide/coordination, apps/ide/security, the policy
  extension's coordination/draft/DAP-guard/lifecycle-safety modules and
  the unused product.json; the policy extension keeps only the managed
  extension allow-list and scoped collaboration.
- API: workspace snapshot import/match/check routes are gone. The
  project integration lease (one integrating run per project, fenced)
  moves to domain/integration-lease.ts and is still enforced on
  integrate/build transitions and build evidence.
- Workspace lifecycle: pause/resume no longer requires a save barrier;
  automatic sleep needs 30 idle minutes and zero gateway connections,
  which the gateway now reports itself. The lifecycle/integration
  authorize relays and the gateway's assertion signing are removed;
  gateway edit roles match the contract roles.
- Worker: no snapshot matching, workspace-input gate or local lock
  file during integration; runtime workspace-snapshot is removed.
- Web: the snapshot import panel is removed from run detail.
- Provisioner workspaces no longer mount coordination state or the
  gateway public key; local setup no longer generates gateway keys.

The local Theia build under apps/ide/lib must be rebuilt to pick up the
slimmer policy extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:56:22 +08:00
eust-w
20bc7cfeb7 refactor: remove the private application gateway and its proof chain
Environments defaulted to "private" visibility, which required a
separate per-environment preview gateway, capability tokens, signed
anonymous/authorized probe proofs and API-side proof verification;
without that stack every deployment was blocked. Access control for a
deployed application is now the target environment's responsibility
(docs/requirements.md FR-G6).

- Delete apps/preview-gateway, the API preview controllers/domain
  (previews, private-access-verifier) and runtime private-access.
- Environments keep an optional application URL; production releases
  still require one plus a fresh access check reported by the Runner.
  The URL may never share an origin with the console, API or IDE.
- Release bindings, runner task payloads, deployment evidence and
  rollback compatibility no longer carry visibility or private-access
  policy digests. PATCH /v1/environments/:id/access becomes
  /v1/environments/:id/application-url.
- Web: the delivery launch route is gone; environments configure an
  application URL only (the always-rejected "Runner ID" field is
  removed); releases and run detail link the live application URL.
- Remove the preview-gateway image target and test:preview script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:48:49 +08:00
eust-w
c29f353177 refactor: drop invoices and settlement, keep usage metering and quotas
The invoice/settlement flow produced statements whose every monetary
field was null, behind a review/settle/void ceremony. Model charges are
billed by the provider directly, so the platform only needs to report
measured usage.

- apps/api/src/domain/usage.ts replaces billing.ts: per-month usage
  lines, totals, model-measurement coverage and a formula-safe CSV
  export. No invoice digest, settlement records or billing entities.
- Routes: GET /v1/usage/lines and /v1/usage/export (owner/admin),
  GET /v1/plans; platform-operator actions move to
  POST /v1/admin/members and /v1/admin/executions/:id/reconcile.
  The operator allow-list is now WF_OPERATOR_SUBJECTS.
- Contracts: UsageLine replaces BillingUsageLine/BillingInvoice; the
  billing_event and billing_period entity kinds are removed.
- Web usage page shows limits, occupancy, monthly totals and lines.
- npm script tenant:invite is renamed tenant:create (it provisions a
  tenant).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:42:15 +08:00
eust-w
ba5fe56e88 refactor: replace platform meta-evolution with versioned agent configuration
The meta-evolution machinery (failure clustering meta-tasks, signed
offline evaluation, shadow/canary stages, external release receipts,
evaluator identity and its UI) could never take effect: promotions were
written to the system tenant only, the benchmark/runner/observer it
depended on did not exist, and its statistical gates were effectively
unreachable. It is removed as agreed in docs/requirements.md section 3.

What remains is the part every run actually uses, now explicit:

- packages/evolution becomes packages/agent and keeps only the bundle
  schema, content digest and prompt assembly; consumers import it as the
  @wishforge/agent workspace package instead of by relative path.
- apps/api/src/domain/agent-bundles.ts: immutable, content-addressed
  agent configurations per tenant, with create, activate and rollback
  restricted to human owners/admins. A run pins the active version at
  submission; later activations never change it.
- /v1/agent-bundles routes replace /v1/evolution*; all /internal
  evolution routes, the evaluator service token and the rsi:rollout
  script are gone.
- Web: the experiment page becomes an "Agent 配置" page.
- Tests for the deleted modules are removed; control-plane tests cover
  version pinning, rollback and authorization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:38:53 +08:00
eust-w
0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00
eust-w
b47a07e8d2 chore: baseline snapshot of the Codex-delivered code before review
Imports the previously untracked working tree as-is so that the review
changes that follow (requirements -> design -> implementation) can be
reviewed as diffs and reverted if needed. No content changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:18:04 +08:00