zcode-acp-server 0.46.7 → 0.47.1

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 (55) hide show
  1. package/README.md +1 -1
  2. package/dist/code-fingerprint.json +2 -2
  3. package/dist/remote/endpoint.d.ts.map +1 -1
  4. package/dist/remote/endpoint.js +23 -0
  5. package/dist/remote/endpoint.js.map +1 -1
  6. package/dist/remote/hub-server.d.ts.map +1 -1
  7. package/dist/remote/hub-server.js +115 -2
  8. package/dist/remote/hub-server.js.map +1 -1
  9. package/dist/remote/settings-endpoint.d.ts +47 -0
  10. package/dist/remote/settings-endpoint.d.ts.map +1 -0
  11. package/dist/remote/settings-endpoint.js +1046 -0
  12. package/dist/remote/settings-endpoint.js.map +1 -0
  13. package/dist/settings/agents-config.d.ts +158 -0
  14. package/dist/settings/agents-config.d.ts.map +1 -0
  15. package/dist/settings/agents-config.js +598 -0
  16. package/dist/settings/agents-config.js.map +1 -0
  17. package/dist/settings/app-update.d.ts +193 -0
  18. package/dist/settings/app-update.d.ts.map +1 -0
  19. package/dist/settings/app-update.js +659 -0
  20. package/dist/settings/app-update.js.map +1 -0
  21. package/dist/settings/atomic-write.d.ts +106 -0
  22. package/dist/settings/atomic-write.d.ts.map +1 -0
  23. package/dist/settings/atomic-write.js +228 -0
  24. package/dist/settings/atomic-write.js.map +1 -0
  25. package/dist/settings/cli-config.d.ts +162 -0
  26. package/dist/settings/cli-config.d.ts.map +1 -0
  27. package/dist/settings/cli-config.js +369 -0
  28. package/dist/settings/cli-config.js.map +1 -0
  29. package/dist/settings/coding-plan.d.ts +106 -0
  30. package/dist/settings/coding-plan.d.ts.map +1 -0
  31. package/dist/settings/coding-plan.js +299 -0
  32. package/dist/settings/coding-plan.js.map +1 -0
  33. package/dist/settings/file-lock.d.ts +39 -0
  34. package/dist/settings/file-lock.d.ts.map +1 -0
  35. package/dist/settings/file-lock.js +282 -0
  36. package/dist/settings/file-lock.js.map +1 -0
  37. package/dist/settings/provider-config.d.ts +123 -0
  38. package/dist/settings/provider-config.d.ts.map +1 -0
  39. package/dist/settings/provider-config.js +311 -0
  40. package/dist/settings/provider-config.js.map +1 -0
  41. package/dist/settings/skills.d.ts +72 -0
  42. package/dist/settings/skills.d.ts.map +1 -0
  43. package/dist/settings/skills.js +245 -0
  44. package/dist/settings/skills.js.map +1 -0
  45. package/dist/settings/usage-stats.d.ts +74 -0
  46. package/dist/settings/usage-stats.d.ts.map +1 -0
  47. package/dist/settings/usage-stats.js +235 -0
  48. package/dist/settings/usage-stats.js.map +1 -0
  49. package/dist/utils.d.ts +14 -0
  50. package/dist/utils.d.ts.map +1 -1
  51. package/dist/utils.js +22 -0
  52. package/dist/utils.js.map +1 -1
  53. package/docs/ARCHITECTURE.md +65 -0
  54. package/docs/REMOTE-CLIENTS.md +285 -0
  55. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Settings API routes (ADR-0025), served on the bridge's loopback server and
3
+ * re-served by the hub behind the token.
4
+ *
5
+ * The handler is a single factory mounted in both places, so the two routes
6
+ * cannot drift. Everything here is a thin translation layer over
7
+ * `src/settings/*`: parse the request, call the module, map the outcome to a
8
+ * status code and an **effect class** the client can act on.
9
+ *
10
+ * Effect classes are the contract's most important field. A write answers
11
+ * `immediate` when the running backend picks it up by itself (the provider
12
+ * table is polled every ~1s; skills enablement is read live) and
13
+ * `needs-restart` when the agent read it once at startup (MCP servers, hooks,
14
+ * subagent markdown). A client that ignores this shows the user a toggle that
15
+ * appears to do nothing.
16
+ *
17
+ * Error mapping is deliberately coarse — the module's messages are already
18
+ * actionable, so they are passed through as `error` rather than re-coded.
19
+ * Only the validation failures that indicate a malformed request get a 400;
20
+ * an unreachable or failing upstream gets 502/504 (the request may still have
21
+ * been carried out, so the client retries with the same idempotency key);
22
+ * everything else is a 500, because it means the environment is wrong.
23
+ */
24
+ import type { IncomingMessage, ServerResponse } from "node:http";
25
+ import type { ZcodeAcpServer } from "../server.js";
26
+ /**
27
+ * Build the settings router.
28
+ *
29
+ * `server` is the bridge to operate on. It is only needed by
30
+ * `/settings/backend/restart`, which has a backend to restart; the hub's
31
+ * machine-level mount passes none and answers 501 on that route. Passing it
32
+ * through the closure (rather than a module singleton) keeps two bridges in one
33
+ * process — a test, or a future multi-workspace mode — from disturbing each
34
+ * other's backend.
35
+ *
36
+ * Routes are matched on `url.pathname` after an optional `/api` prefix is
37
+ * stripped, so one factory serves `/settings/…` on the loopback server and
38
+ * `/api/settings/…` on the hub.
39
+ */
40
+ export declare function createSettingsHandler(server?: ZcodeAcpServer): (req: IncomingMessage, res: ServerResponse) => void;
41
+ /** Test seam: drop the counter so a suite starts from a known state. */
42
+ export declare function resetPendingRestartForTest(): void;
43
+ /** Record the nonce a status read just issued. */
44
+ export declare function rememberResetNonce(providerId: string, nonce: string): void;
45
+ /** Test seam: drop the install state so a suite starts from a known one. */
46
+ export declare function resetAppUpdateStateForTest(): void;
47
+ //# sourceMappingURL=settings-endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-endpoint.d.ts","sourceRoot":"","sources":["../../src/remote/settings-endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAyLnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,CAAC,EAAE,cAAc,GACtB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,IAAI,CAiBrD;AA+JD,wEAAwE;AACxE,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AA6mBD,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE1E;AAqKD,4EAA4E;AAC5E,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}