@volter/twin 0.1.0 → 0.1.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 (84) hide show
  1. package/README.md +16 -2
  2. package/inject.cjs +453 -59
  3. package/package.json +12 -22
  4. package/src/actions.ts +234 -49
  5. package/src/blob-store.ts +136 -0
  6. package/src/changeset.ts +807 -0
  7. package/src/cli.ts +60 -10
  8. package/src/connector.ts +30 -7
  9. package/src/control-plane.ts +17 -1
  10. package/src/emit.ts +242 -0
  11. package/src/fork.ts +19 -7
  12. package/src/index.ts +139 -6
  13. package/src/lease.ts +4 -6
  14. package/src/lifecycle.ts +8 -0
  15. package/src/packRegistry.ts +248 -2
  16. package/src/plan.ts +131 -23
  17. package/src/proxy.ts +5 -2
  18. package/src/pushLedger.ts +116 -11
  19. package/src/queueLifecycle.ts +3 -4
  20. package/src/rateBudget.ts +1115 -0
  21. package/src/refs.ts +9 -10
  22. package/src/remote-execute.ts +16 -0
  23. package/src/scenario.ts +387 -0
  24. package/src/serve.ts +397 -15
  25. package/src/shadow.ts +86 -7
  26. package/src/storage.ts +76 -147
  27. package/src/sync.ts +63 -17
  28. package/src/twin-fetch.ts +115 -0
  29. package/src/validate.ts +6 -5
  30. package/src/world-clock.ts +33 -0
  31. package/src/world-store.ts +482 -0
  32. package/src/worldConfig.ts +4 -3
  33. package/dist/src/actions.d.ts +0 -138
  34. package/dist/src/actions.js +0 -201
  35. package/dist/src/args.d.ts +0 -3
  36. package/dist/src/args.js +0 -12
  37. package/dist/src/cli.d.ts +0 -2
  38. package/dist/src/cli.js +0 -425
  39. package/dist/src/connector.d.ts +0 -106
  40. package/dist/src/connector.js +0 -129
  41. package/dist/src/control-plane.d.ts +0 -21
  42. package/dist/src/control-plane.js +0 -40
  43. package/dist/src/egress.d.ts +0 -93
  44. package/dist/src/egress.js +0 -264
  45. package/dist/src/fork.d.ts +0 -126
  46. package/dist/src/fork.js +0 -206
  47. package/dist/src/index.d.ts +0 -42
  48. package/dist/src/index.js +0 -52
  49. package/dist/src/lease.d.ts +0 -50
  50. package/dist/src/lease.js +0 -80
  51. package/dist/src/packRegistry.d.ts +0 -34
  52. package/dist/src/packRegistry.js +0 -22
  53. package/dist/src/plan.d.ts +0 -97
  54. package/dist/src/plan.js +0 -151
  55. package/dist/src/proxy.d.ts +0 -25
  56. package/dist/src/proxy.js +0 -152
  57. package/dist/src/pushLedger.d.ts +0 -81
  58. package/dist/src/pushLedger.js +0 -130
  59. package/dist/src/queueLifecycle.d.ts +0 -62
  60. package/dist/src/queueLifecycle.js +0 -95
  61. package/dist/src/reconcile.d.ts +0 -58
  62. package/dist/src/reconcile.js +0 -137
  63. package/dist/src/refs.d.ts +0 -29
  64. package/dist/src/refs.js +0 -68
  65. package/dist/src/schemas.d.ts +0 -78
  66. package/dist/src/schemas.js +0 -50
  67. package/dist/src/serve.d.ts +0 -44
  68. package/dist/src/serve.js +0 -93
  69. package/dist/src/shadow.d.ts +0 -77
  70. package/dist/src/shadow.js +0 -138
  71. package/dist/src/status.d.ts +0 -31
  72. package/dist/src/status.js +0 -42
  73. package/dist/src/storage.d.ts +0 -119
  74. package/dist/src/storage.js +0 -535
  75. package/dist/src/sync.d.ts +0 -91
  76. package/dist/src/sync.js +0 -121
  77. package/dist/src/types.d.ts +0 -40
  78. package/dist/src/types.js +0 -1
  79. package/dist/src/validate.d.ts +0 -27
  80. package/dist/src/validate.js +0 -68
  81. package/dist/src/visualizer.d.ts +0 -13
  82. package/dist/src/visualizer.js +0 -133
  83. package/dist/src/worldConfig.d.ts +0 -9
  84. package/dist/src/worldConfig.js +0 -16
package/README.md CHANGED
@@ -22,6 +22,13 @@ its own vendor's exact API on top of this. CLI: `volter-twin`.
22
22
  and append only changed fields.
23
23
  - **Connectors** (`runConnectorPoll` / `runConnectorSweep`): cursor/subject poll
24
24
  runners owning the sync invariants.
25
+ - **Pull posture** (`pullPosture` / `assertContinuousPullAllowed` / `pullOnSchedule`):
26
+ how often a vendor's REAL API may be pulled, declared once by the pack that knows its
27
+ rate limits (`pullPosture: 'continuous' | 'on-demand'`, default `'on-demand'`) and
28
+ enforced at the cadence seams. Both poll runners require `connector.vendor` and assert
29
+ the posture *before* the first vendor request, so a scheduled pull of a rate-fragile —
30
+ or undeclared — vendor is refused having made zero calls. A one-off pull someone asked
31
+ for is still allowed: pass `trigger: 'explicit'`.
25
32
  - **Control plane** (the `controlPlane` namespace): `status`, `plan`, push (+ phases),
26
33
  `lease`, refs/checkpoints, the queue lifecycle, and fork operations
27
34
  (rebase/merge/cherry-pick/revert/reset) — the one uniform surface for driving any
@@ -40,15 +47,22 @@ volter-twin events append <service> --file evt.json # append an observed event
40
47
  volter-twin events list <service> --json
41
48
  volter-twin state rebuild <service> # rebuild projected state from events
42
49
  volter-twin status <service> # queued/unpushed/drift/conflicts
43
- volter-twin plan <service> # reviewable apply plan
50
+ volter-twin plan <service> --root <project> # exact pending transaction set + latest review
51
+ volter-twin review <service> --decision rejected --actor-id <id> --reason <text> --root <project>
52
+ volter-twin review <service> --decision approved --actor-id <id> --root <project>
44
53
  volter-twin refs <service> # remote checkpoints
45
54
  volter-twin validate [--services <a,b>] # twin integrity (egress reconciliation)
46
55
  ```
47
56
 
48
57
  State lives under `<cwd>/.volter/world/` by default (directory name overridable via
49
- `VOLTER_STATE_DIR`, or pass `--root`); per-service config in `.volter/world/config.json`.
58
+ `VOLTER_STATE_DIR`; `plan` and `review` accept `--root`); per-service config in `.volter/world/config.json`.
50
59
  **Pin a `--root` / `VOLTER_STATE_DIR` in CI** so a twin doesn't write into your repo.
51
60
 
61
+ Every non-empty plan requires review. Decisions are appended to `plan-reviews.jsonl` and bind to a
62
+ hash of the exact ordered pending-action IDs. Adding or removing an action therefore invalidates an
63
+ earlier approval automatically. `applyPlan` refuses to call a provider unless that exact transaction
64
+ set has a durable approval; rejection records intent but never pushes.
65
+
52
66
  ## API
53
67
 
54
68
  `listEvents`, `appendEvent`, `createEvent`, `loadState`, `rebuildGenericState`,