12 Commits

Author SHA1 Message Date
eust-w
da1cfcea13 🔥 Remove the cloud IDE
The cluster never ran Theia or the IDE gateway, so every workspace stayed
"未配置" forever. The feature is gone instead of half-present:

- API: workspace, launch and lifecycle endpoints, the gateway identity and
  its internal routes, the dispatcher's workspace provisioning and the
  lifecycle worker. Migration 003 deletes stored workspaces and settles
  their pending outbox items.
- Provisioner: workspace provisioning and lifecycle for both backends.
- Web: the 云 IDE panel, the launch route, the start-branch picker that
  listed IDE branches, and the workspace count on usage.
- apps/ide, infra/oct, dev:ide and the CI job; IDE parts of local k3s,
  network policies, RBAC, docs and the architecture diagram.

A wish can still start from a pushed branch through the API (sourceBranch).
Plan files and stored entitlements may still carry maxWorkspaces; it is
accepted and ignored.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 12:43:02 +08:00
eust-w
e0bccda4bf 🐛 Stop local services with everything they spawned, and test the scripts in CI
Stopping dev.mjs sent SIGTERM to each service and moved on, so a slow
service, or anything a service spawned (run workers, Next.js workers),
outlived it once the supervisor killed dev.mjs after 20 seconds. The
next start then found the old API answering and reused it: a rebuild
kept running old code.

- Each service runs in its own process group. Stopping signals the
  group, waits up to 10 seconds, then kills what remains.
- Under the LaunchAgent supervisor, a service already answering is
  refused instead of adopted (WF_LOCAL_REUSE_SERVICES=false).
- npm test, and so CI, now runs scripts/*.test.mjs. The POC check test
  that needs the Mac's Homebrew toolchain skips where there is none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:31:51 +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
d7d2cb705d feat: run images from built services instead of transpiling at start-up (FR-K5)
scripts/build-services.mjs compiles the API, its migration runner, the worker,
the Runner and the platform Git service into single ESM files under dist/.
Workspace packages are compiled in, everything else loads from node_modules,
and esbuild applies the transform tsx applied before, so behaviour does not
change. The Temporal workflow bundle is built at the same time and the worker
uses it when present instead of bundling at start-up.

The runtime image builds the services and runs dist/*/main.mjs; the
Kubernetes provisioner starts sandboxes with dist/worker/main.mjs, and
migrations run as node dist/api/migrate.mjs. esbuild is now a declared dev
dependency. A test builds everything and checks that each entry point loads
all its imports and reaches its own configuration checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:15:42 +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
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