@buffcore/cli 0.8.47 → 0.8.48

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/commands/build/server-text.en.d.ts +5 -0
  3. package/dist/commands/build/server-text.en.js +5 -0
  4. package/dist/commands/build/server-text.js +5 -0
  5. package/dist/commands/build/server.d.ts +4 -0
  6. package/dist/commands/build/server.js +10 -1
  7. package/dist/commands/change-merge.d.ts +2 -2
  8. package/dist/commands/dev.d.ts +9 -2
  9. package/dist/commands/dev.js +24 -5
  10. package/dist/commands/hardening.d.ts +3 -0
  11. package/dist/commands/hardening.en.d.ts +3 -0
  12. package/dist/commands/hardening.en.js +3 -0
  13. package/dist/commands/hardening.es.d.ts +2 -0
  14. package/dist/commands/hardening.es.js +3 -0
  15. package/dist/commands/hardening.js +19 -0
  16. package/dist/commands/prototype/comp-record.d.ts +5 -0
  17. package/dist/commands/prototype/comp-record.js +22 -0
  18. package/dist/commands/server/build.d.ts +2 -1
  19. package/dist/commands/server/build.js +10 -2
  20. package/dist/commands/server/deploy-local.d.ts +3 -0
  21. package/dist/commands/server/deploy-local.js +9 -0
  22. package/dist/commands/server/deploy-plan.d.ts +5 -0
  23. package/dist/commands/server/deploy-plan.js +56 -0
  24. package/dist/commands/server/deploy-result.d.ts +7 -0
  25. package/dist/commands/server/deploy-result.js +1 -0
  26. package/dist/commands/server/deploy-script.d.ts +2 -0
  27. package/dist/commands/server/deploy-script.js +3 -2
  28. package/dist/commands/server/deploy.d.ts +9 -6
  29. package/dist/commands/server/deploy.js +39 -61
  30. package/dist/commands/server/files.d.ts +9 -1
  31. package/dist/commands/server/files.js +25 -5
  32. package/dist/commands/server/image.d.ts +4 -2
  33. package/dist/commands/server/image.js +6 -5
  34. package/dist/commands/server/setup.js +4 -0
  35. package/dist/commands/server/system-packages.d.ts +29 -0
  36. package/dist/commands/server/system-packages.js +103 -0
  37. package/dist/commands/services/compose.d.ts +1 -1
  38. package/dist/commands/services/compose.js +5 -3
  39. package/dist/commands/ui/agents-route.js +2 -0
  40. package/dist/commands/ui/approval-authority.en.d.ts +1 -0
  41. package/dist/commands/ui/approval-authority.en.js +1 -0
  42. package/dist/commands/ui/approval-authority.es.d.ts +1 -0
  43. package/dist/commands/ui/approval-authority.es.js +1 -0
  44. package/dist/commands/ui/approval-authority.js +7 -2
  45. package/dist/commands/ui/approve.js +2 -4
  46. package/dist/commands/ui/autopilot-records.d.ts +2 -0
  47. package/dist/commands/ui/autopilot-records.js +5 -0
  48. package/dist/commands/ui/brand-approval.js +5 -1
  49. package/dist/commands/ui/chat/permissions.js +1 -1
  50. package/dist/commands/ui/chat/routes.js +4 -0
  51. package/dist/commands/ui/comp-approval.d.ts +14 -2
  52. package/dist/commands/ui/comp-approval.js +45 -8
  53. package/dist/commands/ui/level-route.js +3 -0
  54. package/dist/commands/ui/merge-authority.d.ts +4 -1
  55. package/dist/commands/ui/merge-authority.en.d.ts +4 -0
  56. package/dist/commands/ui/merge-authority.en.js +5 -1
  57. package/dist/commands/ui/merge-authority.es.d.ts +4 -0
  58. package/dist/commands/ui/merge-authority.es.js +5 -1
  59. package/dist/commands/ui/merge-authority.js +6 -3
  60. package/dist/commands/ui/merge-claims.d.ts +7 -0
  61. package/dist/commands/ui/merge-claims.js +21 -0
  62. package/dist/commands/ui/merge-delegation.js +8 -3
  63. package/dist/commands/ui/merge-hold-name.d.ts +5 -0
  64. package/dist/commands/ui/merge-hold-name.js +5 -0
  65. package/dist/commands/ui/merge-hold.d.ts +6 -1
  66. package/dist/commands/ui/merge-hold.js +23 -5
  67. package/dist/commands/ui/merge-publish-host.d.ts +1 -0
  68. package/dist/commands/ui/merge-publish-host.js +2 -2
  69. package/dist/commands/ui/merge-record.d.ts +2 -0
  70. package/dist/commands/ui/merge-record.js +1 -1
  71. package/dist/commands/ui/merge-route.js +17 -1
  72. package/dist/commands/ui/merge-settle.d.ts +32 -0
  73. package/dist/commands/ui/merge-settle.js +133 -0
  74. package/dist/commands/ui/merge-state.d.ts +5 -0
  75. package/dist/commands/ui/merge-state.js +7 -1
  76. package/dist/commands/ui/merge-withdraw.d.ts +9 -0
  77. package/dist/commands/ui/merge-withdraw.js +29 -0
  78. package/dist/commands/ui/plan-files.js +5 -2
  79. package/dist/commands/ui/plan-structure.js +5 -7
  80. package/dist/commands/ui/prototype-comp-route.d.ts +12 -3
  81. package/dist/commands/ui/prototype-comp-route.js +35 -17
  82. package/dist/commands/ui/real-file.d.ts +11 -0
  83. package/dist/commands/ui/real-file.js +84 -0
  84. package/dist/commands/ui/save-route.js +4 -1
  85. package/dist/commands/ui/server.d.ts +1 -0
  86. package/dist/commands/ui/server.js +1 -0
  87. package/dist/commands/ui/studio-state.d.ts +1 -0
  88. package/dist/commands/ui/studio-versions.js +19 -3
  89. package/dist/ui/page.js +79 -79
  90. package/docs/PROTOTYPE.md +13 -0
  91. package/docs/WORKBENCH.md +30 -0
  92. package/package.json +11 -11
  93. package/skills/ape-deploy/SKILL.md +4 -2
package/docs/PROTOTYPE.md CHANGED
@@ -207,6 +207,19 @@ hash) records the approval, its commit and signer in `prototype/versions/comp.js
207
207
  own commit (`prototype: approve the look`) as a version approval is, and refuses an agent. Agents'
208
208
  file tools, coding commands and merged branches cannot write it, and a record not made by that
209
209
  commit does not count.
210
+ Under a host's approval authority (`createUiServer({ approval })`) **Approve the look** asks the host
211
+ once, with `action: 'approve'` and the artifact `{ kind: 'comp', version: null, commit, fingerprint }`
212
+ (the commit checked out, the comp report's hash). The host answers as for the other kinds: refuse
213
+ with a code, accept with `approval: null` (pending), or return the approval, kind `comp`, whose
214
+ signatures name that commit and fingerprint and the viewer, never an `agent` or `ai`; the studio
215
+ records it in `comp.json` by its own approval commit, so the host writes nothing else. A caller with
216
+ an agent or an AI approver is refused before the host is asked. The comp read then asks the host
217
+ (`action: 'check'`, the artifact named by the record's first signature's commit) before it says
218
+ approved; a refusal, error or 5-second timeout shows the look not approved, with the reason in
219
+ `approvalRefusal`, which the page shows where the look waits. Comp pictures are read only from an
220
+ opened regular file with one link whose real path (links and junctions followed) is inside the
221
+ product's folder (a shot: inside the comp snapshot folder; a
222
+ reference the person's own studio lists outside the folder keeps working there). On Linux the studio also checks the open file's own path (`/proc/self/fd`); on Windows and macOS it can only check the path again, so a local process that swaps a folder back and forth several times within microseconds of the read is a remaining race.
210
223
  A redrawn comp is a new look to approve. The prototype and critique skills treat the approved comp
211
224
  as the reference the scenes must match.
212
225
 
package/docs/WORKBENCH.md CHANGED
@@ -942,6 +942,36 @@ merge through Work or `ape change merge`. Hosted writers pass their final write
942
942
  the same publication lock as a local automatic merge. A held automatic queue entry is withdrawn when
943
943
  publication is refused or a person merges it. A hosted Autopilot success must come through `publish`.
944
944
 
945
+ **A queue that merges later settles through `settleHostMerge`.** `publish` lives in the hook's
946
+ call, so a queue in another process cannot reach it. An Autopilot ask carries `claim`, a random
947
+ secret for that one ask, given to the host; the studio's record keeps only its SHA-256 and compares
948
+ in constant time. When its queue has merged the change, the host's own process calls
949
+ `settleHostMerge(root, { change, head, claim, outcome: 'merged' })`, or `outcome: 'not_merged'` with
950
+ a code when it gives up; no HTTP route reaches it. `outcome: 'check'` runs the same gate under the
951
+ same lock, writes nothing and answers `{ status: 'ready' }` when a `merged` settle would pass now
952
+ (main aside), so a queue checks just before its final write. It answers
953
+ `{ status: 'merged' | 'not_merged' }`, or `{ status: 'refused', code, detail }` when the claim is
954
+ not the waiting Autopilot claim for that change and head, the branch moved, Autopilot merges are
955
+ held, the saved level is not Autopilot, `plan/agents.md` or the hold file changed since the ask
956
+ (any edit counts, and any settle refused for that, `check` and `not_merged` too, withdraws the claim so Autopilot asks again), or (for `merged`) main
957
+ does not hold that exact head; a record it cannot write answers `merge_record_failed`, and the
958
+ host may call again, as for `merge_publication_lock` when the publication lock stays busy. A merged settlement records what
959
+ `publish` records; the next read records the merge and starts the Snapshot. Main holding the head
960
+ is not enough on its own: the host writes main, so that shows a write, not one that respected a
961
+ person's hold.
962
+
963
+ A waiting Autopilot claim ends, unless main already holds its head, when a person turns the hold on
964
+ (`writeMergeHold`, under the hold's lock), changes the level away from Autopilot, presses Stop on
965
+ that change's chat (also when Stop only asks to confirm and the person cancels), or withdraws it (`POST /api/merge/withdraw { change }`, right `build`, the merge preview's Withdraw
966
+ button, shown only on an Autopilot wait, marked `automatic: true` in the read's `work.merges`). A person's own waiting merge is not withdrawn. Every wait shows how long it has waited.
967
+ After any of these, the host's settle answers `merge_settle_unknown`: the host drops that queue
968
+ entry and must not write main for it; to merge the change it waits for the studio to ask again
969
+ (Autopilot after a later turn, or the person's Merge). A queue that runs `outcome: 'check'` just
970
+ before its final write does not merge a claim already withdrawn; one withdrawn between the check
971
+ and the write is still possible. If its queue merged the change anyway, the studio shows it
972
+ as Git shows it, like a merge made at a terminal: the change reads as merged in Work, with no host
973
+ line, receipt, Autopilot record or Snapshot; a person runs `ape prototype snapshot` on main.
974
+
945
975
  **The host owns the atomic queue decision and the live rights check.** It must reject stale heads
946
976
  and bases, and must not call `mergeOne` itself: BuffCore holds its lock. `merge` may be called
947
977
  again for the same change and head: on the next merge after a refusal or after main is rewound
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buffcore/cli",
3
- "version": "0.8.47",
3
+ "version": "0.8.48",
4
4
  "description": "The `ape` command: create, dev, migrate, seed, prototype, deploy and a local MCP server for coding agents.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "BuffApe",
@@ -45,20 +45,20 @@
45
45
  "playwright-core": "1.63.0",
46
46
  "yaml": "2.9.1",
47
47
  "zod": "4.6.5",
48
- "@buffcore/i18n": "0.8.47",
49
- "@buffcore/config": "0.8.47",
50
- "@buffcore/build-agent": "0.8.47",
51
- "@buffcore/modules": "0.8.47",
52
- "@buffcore/contracts": "0.8.47",
53
- "@buffcore/db": "0.8.47",
54
- "@buffcore/server": "0.8.47",
55
- "@buffcore/tokens": "0.8.47",
56
- "@buffcore/storage": "0.8.47"
48
+ "@buffcore/config": "0.8.48",
49
+ "@buffcore/contracts": "0.8.48",
50
+ "@buffcore/build-agent": "0.8.48",
51
+ "@buffcore/modules": "0.8.48",
52
+ "@buffcore/i18n": "0.8.48",
53
+ "@buffcore/server": "0.8.48",
54
+ "@buffcore/db": "0.8.48",
55
+ "@buffcore/tokens": "0.8.48",
56
+ "@buffcore/storage": "0.8.48"
57
57
  },
58
58
  "devDependencies": {
59
59
  "marked": "18.1.3",
60
60
  "tsx": "4.23.15",
61
- "@buffcore/admin-shell": "0.8.47"
61
+ "@buffcore/admin-shell": "0.8.48"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "node ../../scripts/build-package.mjs && node scripts/bundle.mjs",
@@ -15,7 +15,9 @@ A person decides to deploy; an agent prepares and explains, and runs `ape deploy
15
15
  - **Staging or production:** `docs/ARCHITECTURE.md`, "Staging or production for a server of your own?" (`APE_ENV=staging` in its own file, `--env .env.staging`).
16
16
  4. `pnpm ape server setup <user@server> --domain <name> --env <file>` (or `--network-only <address>` for a server only your network reaches; `-i <key>` as `ssh`). It makes the secrets the file lacks and adds them to it: keep a copy of the file offline.
17
17
 
18
- Run setup again after changing the settings file or `processes` in `buffcore.config.ts`, or after an upgrade whose notes say so: until then `ape deploy` refuses, saying what differs.
18
+ On a server the API and each declared process run with `ulimits: { core: 0 }` (no core dumps) unless `hardening.coreDumps` is on, and with `hardening.refuseDebugOptions` each refuses Node's debugging and dump options, setup refusing a settings file whose `NODE_OPTIONS` carries them (`docs/FEATURES.md`).
19
+
20
+ Run setup again after changing the settings file, `processes` or `hardening` in `buffcore.config.ts`, or after an upgrade whose notes say so: until then `ape deploy` refuses, saying what differs.
19
21
 
20
22
  ## 2. Deploy
21
23
 
@@ -38,7 +40,7 @@ The server's Caddy serves all three with HTTPS. The web app is built in the imag
38
40
  What it does, in order, stopping at the first failure:
39
41
  Before building, deploy refuses tracked changes, checks Change and Task trailers on each change branch's own commits through its named merge on main's first-parent history since the server's deployed commit (no history on a first deploy), then runs the product's `pnpm lint`; a failure refuses with exit 2, while `--local` keeps its signed approval check.
40
42
  The trailer check follows `--no-ff` merges of change branches; fast-forward, squash and rebase merges, or a deploy straight from a change branch, aren't checked.
41
- 1. Builds one image from the commit. The image names no server: the console reads its addresses from `/console.json` when it starts, and deploy writes the server's API address into the web app's files, so the same image runs on staging and production.
43
+ 1. Builds one image from the commit. The image names no server: the console reads its addresses from `/console.json` when it starts, and deploy writes the server's API address into the web app's files, so the same image runs on staging and production. Debian packages the API's own programs need (`ssh`, `ffmpeg`) go in `server.systemPackages` in `buffcore.config.ts`: installed in the image, a bad name refused and a package that can't be installed failing the build, and their installed versions in `--json`'s `systemPackages` (`--local` reads them from the approved image; `null` when they can't be read).
42
44
  2. Asks the running image what it reads (`ape migrate reads`), and backs up.
43
45
  3. **Checks the migrations** with the new image (`ape migrate check`): a pending migration that drops or renames a table or column the running release reads, narrows its type or makes it required stops the deploy, nothing migrated (`refused`).
44
46
  4. Migrates, copies the console's and the web app's files, restarts (each old process stopped gracefully, with 30 seconds to finish), checks `/health`, then watches every process (the API, each Node process, each container) for 15 seconds: each must be running, healthy if it has a health check, and not restarting.