okengine 0.21.1 → 0.22.0

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 (140) hide show
  1. package/AGENTS.md +4 -4
  2. package/LICENSE +202 -0
  3. package/NOTICE +2 -0
  4. package/README.md +15 -9
  5. package/manifest.v1.schema.json +10 -0
  6. package/package.json +22 -20
  7. package/site/content/docs/ai/skills.mdx +1 -1
  8. package/site/content/docs/client/calling.mdx +27 -19
  9. package/site/content/docs/client/index.mdx +1 -1
  10. package/site/content/docs/elements/channel/email.mdx +1 -1
  11. package/site/content/docs/elements/channel/index.mdx +1 -1
  12. package/site/content/docs/elements/flow/http.mdx +4 -4
  13. package/site/content/docs/elements/flow/index.mdx +3 -3
  14. package/site/content/docs/elements/flow/meta.json +1 -1
  15. package/site/content/docs/elements/gate/tenancy.mdx +1 -1
  16. package/site/content/docs/elements/vault/rotation.mdx +15 -0
  17. package/site/content/docs/plugins/otp.mdx +31 -31
  18. package/site/content/docs/recipes/mailpit.mdx +1 -1
  19. package/site/content/docs/recipes/meilisearch.mdx +1 -1
  20. package/site/content/docs/recipes/pgdog.mdx +1 -1
  21. package/site/content/docs/reference/configuration.mdx +2 -2
  22. package/site/content/docs/reference/errors.mdx +12 -2
  23. package/site/content/docs/reference/fx.mdx +28 -15
  24. package/site/content/docs/reference/idempotency.mdx +192 -0
  25. package/site/content/docs/reference/index.mdx +6 -1
  26. package/site/content/docs/reference/meta.json +2 -1
  27. package/site/content/docs/understand/meta.json +1 -1
  28. package/site/content/docs/{elements/flow → understand}/routing.mdx +11 -10
  29. package/site/content/docs/understand/the-architecture.mdx +14 -12
  30. package/site/content/docs/understand/try-it.mdx +3 -3
  31. package/src/cli/competitor-mention-removal.test.ts +3 -3
  32. package/src/cli/docker-cli.test.ts +1 -1
  33. package/src/cli/index.ts +9 -1
  34. package/src/cli/load-config.images.test.ts +10 -10
  35. package/src/cli/load-config.ts +1 -1
  36. package/src/cli/vault-cmd.test.ts +23 -0
  37. package/src/cli/vault-cmd.ts +7 -0
  38. package/src/client/create.ts +18 -1
  39. package/src/client/transport.test.ts +225 -0
  40. package/src/client/transport.ts +132 -19
  41. package/src/client/types.ts +29 -3
  42. package/src/compiler/effects-infer.ts +726 -16
  43. package/src/compiler/extract.test.ts +37 -0
  44. package/src/compiler/extract.ts +113 -12
  45. package/src/compiler/fixtures/skyport.expected.json +24 -0
  46. package/src/compiler/fx-follow.test.ts +164 -0
  47. package/src/compiler/fx-index.ts +399 -0
  48. package/src/console/server/flows-invoke.test.ts +2 -2
  49. package/src/console/ui-next/dist/assets/{access-page-Bgt9bq2r.js → access-page-Ze6ckjdd.js} +2 -2
  50. package/src/console/ui-next/dist/assets/agent-disclosure-Bkohc_8X.js +1 -0
  51. package/src/console/ui-next/dist/assets/{cache-glyph-92uM5MO7.js → cache-glyph-rL0lHxat.js} +1 -1
  52. package/src/console/ui-next/dist/assets/{call-pii-button-DtGVPtcs.js → call-pii-button-Deo4PP18.js} +1 -1
  53. package/src/console/ui-next/dist/assets/{collapsible-DN7l6zmC.js → collapsible-CoJ6amHf.js} +1 -1
  54. package/src/console/ui-next/dist/assets/{copy-inline-button-CAYD18cr.js → copy-inline-button-CWG5_ZOh.js} +1 -1
  55. package/src/console/ui-next/dist/assets/{detail-header-DVWNjWjg.js → detail-header-b_ZzIsmU.js} +1 -1
  56. package/src/console/ui-next/dist/assets/{dropdown-menu-4h2LOVXM.js → dropdown-menu-nwXEO1Ac.js} +1 -1
  57. package/src/console/ui-next/dist/assets/duration-tone-BbQ_8z50.js +9 -0
  58. package/src/console/ui-next/dist/assets/element-icons-CwyLpVXz.js +1 -0
  59. package/src/console/ui-next/dist/assets/{explorer-empty-CJs5A-wm.js → explorer-empty-C8sSCqYT.js} +1 -1
  60. package/src/console/ui-next/dist/assets/{flows-page-BMHs-IzK.js → flows-page-D2E7BtKK.js} +1 -1
  61. package/src/console/ui-next/dist/assets/{highlighted-json-BlAEVgNW.js → highlighted-json-CPYBzDh0.js} +1 -1
  62. package/src/console/ui-next/dist/assets/{http-method-BDf7OAHv.js → http-method-DTPevKmM.js} +1 -1
  63. package/src/console/ui-next/dist/assets/index-vTuwmeQz.js +58 -0
  64. package/src/console/ui-next/dist/assets/observability-page-SJTSzHFJ.js +4 -0
  65. package/src/console/ui-next/dist/assets/{replica-lag-B3GLNVfF.js → replica-lag-BM27lXld.js} +3 -3
  66. package/src/console/ui-next/dist/assets/{request-meta-DMbnAe3f.js → request-meta-BjFT7DNl.js} +1 -1
  67. package/src/console/ui-next/dist/assets/shortcut-keys-CUNegEV4.js +1 -0
  68. package/src/console/ui-next/dist/assets/store-page-Qj9ThRE-.js +41 -0
  69. package/src/console/ui-next/dist/assets/{trace-detail-sheet-Htk8Cm9t.js → trace-detail-sheet-Cmitq3da.js} +2 -2
  70. package/src/console/ui-next/dist/assets/{tree-expand-toggle-CFMPWX4f.js → tree-expand-toggle-CbDIB-7x.js} +2 -2
  71. package/src/console/ui-next/dist/assets/units-page-_PuYqFty.js +1 -0
  72. package/src/console/ui-next/dist/assets/{use-vault-list-CT4-gajj.js → use-vault-list-Cs45Czkt.js} +1 -1
  73. package/src/console/ui-next/dist/assets/{vault-page-CBYl0LW_.js → vault-page-BOMr0go9.js} +2 -2
  74. package/src/console/ui-next/dist/index.html +2 -2
  75. package/src/console/ui-next/src/features/units/detail/flow-contract-panel.tsx +9 -0
  76. package/src/docker/docker.test.ts +13 -13
  77. package/src/docker/images-config.test.ts +12 -12
  78. package/src/docker/stack-id.test.ts +1 -1
  79. package/src/drivers/journal-postgres.ts +168 -3
  80. package/src/drivers/meilisearch.ts +2 -0
  81. package/src/drivers/vault-builtin.test.ts +10 -0
  82. package/src/drivers/vault-builtin.ts +13 -1
  83. package/src/drivers/vault-remote-bag.ts +5 -1
  84. package/src/drivers/vault-types.ts +6 -1
  85. package/src/elements/store/emit-drizzle.ts +2 -2
  86. package/src/elements/store/live-default.test.ts +2 -0
  87. package/src/elements/store/live-http.test.ts +1 -0
  88. package/src/elements/store/resource-list-docs.test.ts +2 -2
  89. package/src/elements/store/resource.test.ts +3 -3
  90. package/src/elements/store/schema-decl.test.ts +1 -0
  91. package/src/elements/store/sql-condition.ts +24 -7
  92. package/src/elements/store/upsert-app.test.ts +1 -1
  93. package/src/elements/vault/audit.test.ts +137 -0
  94. package/src/elements/vault/audit.ts +106 -13
  95. package/src/elements/vault/boot-chain.ts +9 -1
  96. package/src/elements/vault/builtin-adapter.ts +33 -3
  97. package/src/i18n/catalogs/ar.ts +4 -0
  98. package/src/i18n/catalogs/en.ts +4 -0
  99. package/src/kernel/abort-scope.ts +33 -2
  100. package/src/kernel/app.ts +191 -18
  101. package/src/kernel/auto-cache.test.ts +6 -6
  102. package/src/kernel/boot-bind/vault.ts +1 -0
  103. package/src/kernel/boot.ts +19 -1
  104. package/src/kernel/builtin-errors.ts +8 -0
  105. package/src/kernel/client-descriptor.ts +1 -0
  106. package/src/kernel/concurrency.test.ts +33 -0
  107. package/src/kernel/effects-stamping.test.ts +2 -2
  108. package/src/kernel/errors-compiler.ts +20 -0
  109. package/src/kernel/external-effects.test.ts +36 -0
  110. package/src/kernel/flow.ts +24 -0
  111. package/src/kernel/fx-fetch.ts +5 -1
  112. package/src/kernel/fx.ts +5 -1
  113. package/src/kernel/idempotency-store.ts +578 -0
  114. package/src/kernel/idempotency.test.ts +556 -0
  115. package/src/kernel/idempotency.ts +304 -0
  116. package/src/kernel/index.ts +1 -0
  117. package/src/kernel/journal.ts +56 -0
  118. package/src/manifest/types.ts +8 -0
  119. package/src/plugins/auth-delivery.mailpit.integration.test.ts +1 -1
  120. package/src/plugins/otp.test.ts +65 -1
  121. package/src/plugins/otp.ts +59 -7
  122. package/src/release/absolute-regression.test.ts +63 -0
  123. package/src/release/http-graph.test.ts +25 -0
  124. package/src/release/http-graph.ts +90 -0
  125. package/src/release/index.ts +3 -0
  126. package/src/release/limits.ts +17 -2
  127. package/src/release/measure.ts +105 -14
  128. package/src/test/create-test-app.test.ts +3 -1
  129. package/src/test/create-test-app.ts +40 -0
  130. package/src/test/live-signals.test.ts +1 -0
  131. package/src/test/provisions.integration.test.ts +1 -0
  132. package/src/test/tenant-isolation.test.ts +1 -0
  133. package/src/console/ui-next/dist/assets/agent-disclosure-B43CXZZR.js +0 -1
  134. package/src/console/ui-next/dist/assets/duration-tone-BmIR9FV8.js +0 -9
  135. package/src/console/ui-next/dist/assets/element-icons-BI8cJgdh.js +0 -1
  136. package/src/console/ui-next/dist/assets/index-BKpaes3n.js +0 -63
  137. package/src/console/ui-next/dist/assets/observability-page-WnVLI-0j.js +0 -4
  138. package/src/console/ui-next/dist/assets/shortcut-keys-3ILd8oGn.js +0 -1
  139. package/src/console/ui-next/dist/assets/store-page-KvFDingJ.js +0 -41
  140. package/src/console/ui-next/dist/assets/units-page-C4NdNuxP.js +0 -1
package/AGENTS.md CHANGED
@@ -71,13 +71,13 @@ Mnemonic: O·K·E = 6·5·3.
71
71
  | Budget | Limit |
72
72
  | --------------------- | ------- |
73
73
  | Kernel (edge profile) | < 17 kB |
74
- | Client runtime | < 5 kB |
74
+ | Client runtime | < 6 kB |
75
75
  | Cold start on Bun | < 75 ms |
76
76
  | p99 routing overhead | < 1 ms |
77
77
 
78
- A regression fails the build. Claims we cannot measure, we do not make.
78
+ A regression fails the build. An absolute sample that can still double and stay under its cap (cold start today) also fails at 2× the last committed value. Claims we cannot measure, we do not make.
79
79
 
80
- After changing `src/kernel/`, `src/client/`, `src/compiler/`, `src/validation/`, or `src/release/limits.ts` / `measure.ts`, run `bun run budgets:core` (kernel edge + client gzip) before claiming done. Do not raise the published 17 kB / 5 kB caps without a measured before/after and an Unreleased changelog note; prefer lazy-loading off the edge graph.
80
+ After changing `src/kernel/`, `src/client/`, `src/compiler/`, `src/validation/`, or `src/release/limits.ts` / `measure.ts`, run `bun run budgets:core` (kernel edge + client gzip) before claiming done. Do not raise the published 17 kB / 6 kB caps without a measured before/after and an Unreleased changelog note; prefer lazy-loading off the edge graph.
81
81
 
82
82
  ## Package shape
83
83
 
@@ -103,7 +103,7 @@ Engine: Bun `>=1.4.2`.
103
103
 
104
104
  ## After every implementation
105
105
 
106
- Before claiming work done: run [`.agents/skills/oke-ship`](.agents/skills/oke-ship/SKILL.md) — append notes to `changelog.md` under `## Unreleased` (never under a shipped `## v…` section), and update site docs via [`.agents/skills/oke-docs`](.agents/skills/oke-docs/SKILL.md) for any user-facing surface. Version bump is separate: `bun run bump` promotes Unreleased into the next `## vX.Y.Z`.
106
+ Before claiming work done: run [`.agents/skills/oke-ship`](.agents/skills/oke-ship/SKILL.md) — append notes to `changelog.md` under `## Unreleased` (never under a shipped `## v…` section), and update site docs via [`.agents/skills/oke-docs`](.agents/skills/oke-docs/SKILL.md) for any user-facing surface. Version bump is separate: `bun run bump` promotes Unreleased into the next `## vX.Y.Z`. Before that bump, run [`.agents/skills/oke-perf`](.agents/skills/oke-perf/SKILL.md).
107
107
 
108
108
  Do **NOT** run `bun run ci` automatically after finishing an implementation. Only run `bun run ci` when the user explicitly requests it.
109
109
 
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ okengine
2
+ Copyright 2026 Omq Khafi
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  <p align="center">
16
16
  <a href="https://www.npmjs.com/package/okengine"><img alt="npm" src="https://shieldcn.dev/npm/okengine.svg?size=sm&variant=outline" /></a>
17
17
  <a href="https://jsr.io/@omqkhafi/okengine"><img alt="JSR" src="https://shieldcn.dev/jsr/@omqkhafi/okengine.svg?size=sm&variant=outline" /></a>
18
- <a href="https://opensource.org/licenses/MIT"><img alt="MIT" src="https://shieldcn.dev/npm/license/okengine.svg?size=sm&variant=outline" /></a>
18
+ <a href="https://www.apache.org/licenses/LICENSE-2.0"><img alt="Apache-2.0" src="https://shieldcn.dev/npm/license/okengine.svg?size=sm&variant=outline" /></a>
19
19
  <a href="https://bun.sh"><img alt="Bun >=1.4.2" src="https://shieldcn.dev/badge/Bun-%3E%3D1.4.2.svg?logo=bun&size=sm&variant=outline" /></a>
20
20
  <a href="https://github.com/omqkhafi/okengine/actions"><img alt="CI" src="https://shieldcn.dev/github/ci/omqkhafi/okengine.svg?size=sm&variant=outline" /></a>
21
21
  <a href="https://github.com/omqkhafi/okengine/commits"><img alt="last commit" src="https://shieldcn.dev/github/last-commit/omqkhafi/okengine.svg?size=sm&variant=outline" /></a>
@@ -69,16 +69,22 @@ Mnemonic: **O·K·E = 6·5·3**.
69
69
  The starter already exports a health Flow — change it and save; App and Console update from the same Manifest:
70
70
 
71
71
  ```typescript
72
- // src/flows/main/health.ts — folders are the URL: `main/health.ts` → GET /health
73
- import { on, flow, http } from "okengine";
72
+ // src/flows/main/shapes.ts
74
73
  import { z } from "zod";
75
74
 
75
+ /** Liveness payload for `GET /health`. */
76
+ export const HealthOut = z.object({
77
+ ok: z.literal(true),
78
+ });
79
+
80
+ // src/flows/main/health.ts — folders are the URL: `main/health.ts` → GET /health
81
+ import { on, flow, http } from "okengine/http";
82
+
83
+ import { HealthOut } from "./shapes";
84
+
76
85
  export const health = on(
77
- http.get().public(),
78
- flow({
79
- out: z.object({ ok: z.literal(true) }),
80
- do: () => ({ ok: true as const }),
81
- }),
86
+ http.get({ out: HealthOut }).public(),
87
+ flow({ do: () => ({ ok: true as const }) }),
82
88
  );
83
89
  ```
84
90
 
@@ -148,4 +154,4 @@ Store apps sync schema with `oke db push|generate|migrate` (local `oke dev` auto
148
154
 
149
155
  ## License
150
156
 
151
- Pre-1.0. Published on [npm](https://www.npmjs.com/package/okengine) and [JSR](https://jsr.io/@omqkhafi/okengine). [MIT](https://opensource.org/licenses/MIT).
157
+ Pre-1.0. Published on [npm](https://www.npmjs.com/package/okengine) and [JSR](https://jsr.io/@omqkhafi/okengine). [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0).
@@ -308,6 +308,16 @@
308
308
  "enum": ["user", "operator"]
309
309
  },
310
310
  "durable": { "type": "boolean" },
311
+ "idempotency": {
312
+ "type": "object",
313
+ "additionalProperties": false,
314
+ "required": ["mode", "ttl"],
315
+ "properties": {
316
+ "mode": { "enum": ["off", "auto", "required"] },
317
+ "ttl": { "type": "string", "minLength": 1 }
318
+ }
319
+ },
320
+ "usesRaw": { "type": "boolean" },
311
321
  "live": {
312
322
  "type": "string",
313
323
  "description": "Live signal name when this flow streams delivery: live SSE."
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "okengine",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
4
  "description": "One law. Eight elements. One contract. The backend model stays small; operational surfaces are derived from it instead of maintained separately.",
5
- "license": "MIT",
5
+ "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/omqkhafi/okengine.git"
@@ -16,6 +16,8 @@
16
16
  "site"
17
17
  ],
18
18
  "files": [
19
+ "LICENSE",
20
+ "NOTICE",
19
21
  "src",
20
22
  "dist",
21
23
  "manifest.v1.schema.json",
@@ -140,23 +142,23 @@
140
142
  "postinstall": "bun run --cwd examples/keel prepare"
141
143
  },
142
144
  "dependencies": {
143
- "@clack/prompts": "^1.8.0",
145
+ "@clack/prompts": "^1.8.1",
144
146
  "intl-messageformat": "^11.2.14",
145
147
  "oxc-parser": "^0.149.0",
146
148
  "sently": "1.2.2"
147
149
  },
148
150
  "devDependencies": {
149
151
  "@base-ui/react": "^1.8.0",
150
- "@codemirror/commands": "^6.11.0",
152
+ "@codemirror/commands": "^6.11.1",
151
153
  "@codemirror/lang-json": "^6.0.2",
152
- "@codemirror/state": "^6.7.4",
154
+ "@codemirror/state": "^6.7.6",
153
155
  "@codemirror/theme-one-dark": "^6.1.3",
154
- "@codemirror/view": "^6.43.11",
156
+ "@codemirror/view": "^6.43.13",
155
157
  "@dagrejs/dagre": "^3.1.1",
156
- "@duckdb/node-api": "^1.5.5-r.4",
158
+ "@duckdb/node-api": "^1.5.5-r.5",
157
159
  "@electric-sql/pglite": "^0.5.8",
158
160
  "@electric-sql/pglite-pgvector": "^0.0.9",
159
- "@hugeicons/core-free-icons": "^4.3.2",
161
+ "@hugeicons/core-free-icons": "^4.3.5",
160
162
  "@hugeicons/react": "^1.1.10",
161
163
  "@number-flow/react": "^0.6.2",
162
164
  "@oxc-project/types": "^0.149.0",
@@ -165,10 +167,10 @@
165
167
  "@tailwindcss/vite": "^4.3.3",
166
168
  "@tanstack/react-form": "^1.33.5",
167
169
  "@tanstack/react-hotkeys": "^0.10.0",
168
- "@tanstack/react-query": "^5.102.8",
169
- "@tanstack/react-router": "^1.170.34",
170
+ "@tanstack/react-query": "^5.103.2",
171
+ "@tanstack/react-router": "^1.170.39",
170
172
  "@tanstack/react-table": "^9.2.4",
171
- "@tanstack/react-virtual": "^3.14.11",
173
+ "@tanstack/react-virtual": "^3.14.13",
172
174
  "@types/bun": "latest",
173
175
  "@types/d3-array": "^3.2.2",
174
176
  "@types/d3-shape": "^3.2.0",
@@ -192,30 +194,30 @@
192
194
  "d3-array": "^3.2.4",
193
195
  "d3-shape": "^3.2.0",
194
196
  "date-fns": "^4.4.0",
195
- "drizzle-kit": "1.0.0-rc.5-ab785fc",
196
- "drizzle-orm": "1.0.0-rc.5-169397b",
197
+ "drizzle-kit": "1.0.0-rc.5-5935859",
198
+ "drizzle-orm": "1.0.0-rc.5-5935859",
197
199
  "gflows": "^1.2.1",
198
- "happy-dom": "^20.14.3",
200
+ "happy-dom": "^20.14.5",
199
201
  "hast-util-to-jsx-runtime": "^2.3.6",
200
202
  "mermaid": "^11.17.2",
201
- "motion": "^13.2.0",
203
+ "motion": "^13.4.2",
202
204
  "nuqs": "^2.10.1",
203
205
  "oxfmt": "^0.67.0",
204
- "oxlint": "^1.82.0",
205
- "oxlint-tsgolint": "^7.0.2001",
206
+ "oxlint": "^1.85.0",
207
+ "oxlint-tsgolint": "^7.0.2002",
206
208
  "playwright": "^1.63.0",
207
209
  "react": "^19.3.0",
208
210
  "react-dom": "^19.3.0",
209
- "react-resizable-panels": "^4.12.4",
211
+ "react-resizable-panels": "^4.13.3",
210
212
  "shadcn": "^4.21.0",
211
213
  "shiki": "^4.4.3",
212
- "tailwind-merge": "^3.6.0",
214
+ "tailwind-merge": "^3.7.0",
213
215
  "tailwindcss": "^4.3.3",
214
216
  "tw-animate-css": "^1.4.0",
215
217
  "typescript": "^7.0.2",
216
218
  "valibot": "^1.5.0",
217
219
  "vite": "^8.3.0",
218
- "zod": "^4.6.1"
220
+ "zod": "^4.6.5"
219
221
  },
220
222
  "peerDependencies": {
221
223
  "@aws-sdk/client-kms": ">=3.0.0",
@@ -19,7 +19,7 @@ Tools alone don't make a good operator — an agent also needs to know the _voca
19
19
  | **Images skill** | `.agents/skills/oke-images/` | Updating Compose image pins | Registry probe, pin style, catalog + recipes + Keel + docs lockstep |
20
20
 
21
21
  Contributor-only skills in the same tree (not required for app authors):
22
- `oke-ci`, `oke-docs-update`, `oke-docs-visuals`, `oke-console-style`.
22
+ `oke-ci`, `oke-perf` (before a release), `oke-docs-update`, `oke-docs-visuals`, `oke-console-style`.
23
23
 
24
24
  ## AGENTS.md — the root contract
25
25
 
@@ -286,7 +286,7 @@ await api.bookings.get({ id: "bkg_7f3a" }); // GET /bookings/bkg_7f3a
286
286
  await api.bookings.manifest({ flightId: "SK481" }); // POST /_oke/bookings/manifest
287
287
  ```
288
288
 
289
- Full file-tree rules: [Routing](/docs/elements/flow/routing).
289
+ Full file-tree rules: [Routing](/docs/understand/routing).
290
290
 
291
291
  ## How input becomes a request
292
292
 
@@ -384,23 +384,32 @@ See [Store](/docs/elements/store) for the list query language. Handwritten lists
384
384
 
385
385
  ## Options
386
386
 
387
- | Option | Type | Default | Meaning |
388
- | --------------- | ---------------------------------------------- | ------------------ | -------------------------------------------------------------- |
389
- | `fetch` | `(input, init?) => Promise<Response>` | `globalThis.fetch` | Inject a fetch implementation |
390
- | `headers` | `Record<string, string>` \| pairs \| `() => …` | — | Static headers, or a getter per request |
391
- | `timeout` | `number` (ms) | — | Abort after this many milliseconds |
392
- | `retry.retries` | `number` | `0` | Extra attempts after the first (network / 5xx) |
393
- | `retry.delay` | `number` (ms) | `50` | Initial backoff delay |
394
- | `retry.backoff` | `number` | `2` | Multiplier after each retry |
395
- | `auth.getToken` | `() => string \| null \| …` | — | Bearer access token (or null) — see [Auth](/docs/client/auth) |
396
- | `auth.refresh` | `() => Promise<string \| null \| …>` | — | Runs once on HTTP 401, then the request retries |
397
- | `$routes` | `ClientRouteMap` | — | Runtime map from `app.$routes` (REST when method+path present) |
398
- | `routes` | `Record<"unit.flow", { method, path }>` | — | Flat REST table; wins over flattening `$routes` |
387
+ | Option | Type | Default | Meaning |
388
+ | ---------------- | ---------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------- |
389
+ | `fetch` | `(input, init?) => Promise<Response>` | `globalThis.fetch` | Inject a fetch implementation |
390
+ | `headers` | `Record<string, string>` \| pairs \| `() => …` | — | Static headers, or a getter per request |
391
+ | `timeout` | `number` (ms) | — | Abort after this many milliseconds |
392
+ | `retry.retries` | `number` | `0` | Extra attempts after the first. With `retry` set, a call retries when it is GET/QUERY or it carries an idempotency key. |
393
+ | `retry.delay` | `number` (ms) | `50` | Initial backoff delay |
394
+ | `retry.backoff` | `number` | `2` | Multiplier after each retry |
395
+ | `auth.getToken` | `() => string \| null \| …` | — | Bearer access token (or null) — see [Auth](/docs/client/auth) |
396
+ | `auth.refresh` | `() => Promise<string \| null \| …>` | — | Runs once on HTTP 401, then the request retries |
397
+ | `$routes` | `ClientRouteMap` | — | Runtime map from `app.$routes` (REST when method+path present) |
398
+ | `routes` | `Record<"unit.flow", { method, path }>` | — | Flat REST table; wins over flattening `$routes` |
399
+ | `idempotencyKey` | `string` \| `false` | 21-character key | `Idempotency-Key` on this call. `false` sends no header. Omitted on GET. |
400
+
401
+ With `retry` configured, a call retries when it is GET/QUERY or it carries an
402
+ idempotency key (automatic on every non-GET call). `idempotencyKey: false` runs
403
+ once unless that call passes `{ retry: true }`.
404
+
405
+ A `409` whose code is `IdempotencyInProgress` waits for `Retry-After` and retries
406
+ within those attempts. Other error envelopes are returned as-is.
399
407
 
400
408
  ## Result envelopes
401
409
 
402
410
  Success may include optional top-level `meta` (for example pagination). Declared flow errors and
403
411
  transport failures share the failure arm. Handle them with [`match`](#match--explain).
412
+ A replay sets `meta.idempotentReplayed` when the server sends `Idempotent-Replayed: true`.
404
413
 
405
414
  ```typescript
406
415
  import { isOk, isFail, isTransportError } from "okengine/client";
@@ -473,10 +482,9 @@ Restart `oke dev` after renaming exports.
473
482
  </Accordion>
474
483
 
475
484
  <Accordion title='error.code is "TransportError"'>
476
- Network failure, abort (`timeout`), non-JSON body, empty error response, or HTTP status without a
477
- `{ data, error }` envelope. Built-in and domain flow codes never use this code.
478
- Prefer `error.message` — it always equals `error.data.message`. `explain` maps HTTP 404 transport
479
- to kind `missing`.
485
+ Network failure, abort, non-JSON, or HTTP without a `{ data, error }` envelope. Flow codes never
486
+ use this code. Prefer `error.message` — it equals `error.data.message`. `explain` maps HTTP 404
487
+ transport to kind `missing`.
480
488
  </Accordion>
481
489
 
482
490
  <Accordion title="Why import from okengine/client/explain?">
@@ -513,7 +521,7 @@ Restart `oke dev` after renaming exports.
513
521
  - [Live](/docs/client/live) — `api.live` and live queries
514
522
  - [React](/docs/client/react) — hooks package
515
523
  - [Vault · Config](/docs/elements/vault/config) — `PUBLIC_API_URL`, `vault.env`
516
- - [Routing](/docs/elements/flow/routing) — `$routes` stamps
524
+ - [Routing](/docs/understand/routing) — `$routes` stamps
517
525
  - [HTTP](/docs/elements/flow/http) — verbs and envelopes on the server
518
526
  - [Errors](/docs/reference/errors) — `fx.fail` helpers, store auto-map, `match` on the client
519
527
  - [CLI](/docs/reference/cli) — `oke client add`, `oke dev`
@@ -534,6 +542,6 @@ Restart `oke dev` after renaming exports.
534
542
  <Card
535
543
  title="Routing"
536
544
  description="Folders stamp HTTP paths and client units."
537
- href="/docs/elements/flow/routing"
545
+ href="/docs/understand/routing"
538
546
  />
539
547
  </Cards>
@@ -182,7 +182,7 @@ dev so `createClient("")` stays same-origin behind your proxy.
182
182
 
183
183
  ## Learn more
184
184
 
185
- - [Routing](/docs/elements/flow/routing) — folders are the URL; `$routes` without `.adopt()`
185
+ - [Routing](/docs/understand/routing) — folders are the URL; `$routes` without `.adopt()`
186
186
  - [HTTP](/docs/elements/flow/http) — verbs, `http.resource`, live SSE
187
187
  - [The Architecture](/docs/understand/the-architecture) — generated barrel → client → test loop; same contract for Client, Console, MCP
188
188
  - [Errors](/docs/reference/errors) — framework codes vs failure values
@@ -178,7 +178,7 @@ drivers: {
178
178
  },
179
179
  },
180
180
  images: {
181
- channel: { email: "axllent/mailpit:v1.31.1" },
181
+ channel: { email: "axllent/mailpit:v1.31.2" },
182
182
  },
183
183
  ```
184
184
 
@@ -281,7 +281,7 @@ export default defineConfig({
281
281
  },
282
282
  },
283
283
  images: {
284
- channel: { email: "axllent/mailpit:v1.31.1" },
284
+ channel: { email: "axllent/mailpit:v1.31.2" },
285
285
  },
286
286
  });
287
287
  ```
@@ -58,7 +58,7 @@ Response:
58
58
  <Callout title="Omit path and name">
59
59
  Tree default: `http.get()` and `flow({ do })` — no path or name strings. The
60
60
  file stamps both. Pass either only for
61
- [control](/docs/elements/flow/routing#when-to-omit--when-to-pass).
61
+ [control](/docs/understand/routing#when-to-omit--when-to-pass).
62
62
  </Callout>
63
63
 
64
64
  ## Progressive Patterns
@@ -180,7 +180,7 @@ export const deleteAccount = on(
180
180
  ## Path Conventions
181
181
 
182
182
  **Default — omit the path.** Tree files stamp the URL from disk (`http.get()`).
183
- Pass a path only for [control](/docs/elements/flow/routing#when-to-omit--when-to-pass).
183
+ Pass a path only for [control](/docs/understand/routing#when-to-omit--when-to-pass).
184
184
 
185
185
  **Control — explicit path** — pass the URL template when the folder should not own the route:
186
186
 
@@ -197,7 +197,7 @@ import { on, flow, http } from "okengine";
197
197
  export const get = on(http.get(), flow({ do: async ({ id }) => ({ id }) }));
198
198
  ```
199
199
 
200
- Full file-tree rules: [Routing](/docs/elements/flow/routing).
200
+ Full file-tree rules: [Routing](/docs/understand/routing).
201
201
 
202
202
  ## Request Parsing
203
203
 
@@ -268,7 +268,7 @@ export const create = on(
268
268
  ## HTTP Methods
269
269
 
270
270
  Each verb binds with `on(http.<method>(), flow({…}))`. Omit the path on tree
271
- files; pass one only for [control](/docs/elements/flow/routing#when-to-omit--when-to-pass).
271
+ files; pass one only for [control](/docs/understand/routing#when-to-omit--when-to-pass).
272
272
 
273
273
  <Tabs items={["GET", "POST", "PUT", "PATCH", "DELETE", "QUERY", "HEAD", "OPTIONS"]}>
274
274
 
@@ -61,7 +61,7 @@ Response:
61
61
  <Callout title="Omit path and name">
62
62
  Tree default: `http.get()` + `flow({ do })` — no path or name strings. Pass
63
63
  either only for
64
- [control](/docs/elements/flow/routing#when-to-omit--when-to-pass).
64
+ [control](/docs/understand/routing#when-to-omit--when-to-pass).
65
65
  </Callout>
66
66
 
67
67
  <Callout title="Call-only Flows">
@@ -200,7 +200,7 @@ const { chargeId } = await fx.call(chargeCard, { amount: 50 });
200
200
  <Card
201
201
  title="Routing"
202
202
  description="File-tree stamps for HTTP paths, Flow names, and client units."
203
- href="/docs/elements/flow/routing"
203
+ href="/docs/understand/routing"
204
204
  />
205
205
  <Card
206
206
  title="Consumers"
@@ -592,7 +592,7 @@ Default is `true` once `gate.auth.tenant` is on.
592
592
 
593
593
  - [The Architecture](/docs/understand/the-architecture) — `on`, trigger, `flow`, `do`, `fx`
594
594
  - [HTTP](/docs/elements/flow/http) — verbs, envelopes, resources, live SSE
595
- - [Routing](/docs/elements/flow/routing) — file-tree stamps, barrels, OKE1030 · OKE1040–1045
595
+ - [Routing](/docs/understand/routing) — file-tree stamps, barrels, OKE1030 · OKE1040–1045
596
596
  - [Consumers](/docs/elements/flow/consumers) — Signal / Clock / CDC
597
597
  - [Workflows](/docs/elements/flow/workflows) — `durable: true` + `fx.step`
598
598
  - [fx](/docs/reference/fx) — every method inside `do`
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "title": "Flow",
3
3
  "icon": "Workflow",
4
- "pages": ["index", "http", "routing", "consumers", "workflows"]
4
+ "pages": ["index", "http", "consumers", "workflows"]
5
5
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Tenancy"
3
3
  description: "Opt into gate.auth.tenant so requests resolve fx.tenant.id from claim, header, or subdomain."
4
- icon: "Building2"
4
+ icon: "Building"
5
5
  source: "docs/spec/unified-theory.md"
6
6
  ---
7
7
 
@@ -209,10 +209,25 @@ Builtin encrypted store:
209
209
 
210
210
  `--url` overrides the SQL URL (`DATABASE_URL` / `OKE_STORE_SQL_URL`).
211
211
 
212
+ ## Audit sinks
213
+
214
+ | `vault.audit.sink` | Recorded as | `oke vault audit` |
215
+ | ------------------ | --------------------------------- | ------------------- |
216
+ | `db` (default) | SQL hash chain | list, verify, purge |
217
+ | `stdout` | One secret-free JSON line | Refused |
218
+ | `webhook` | POST of that JSON to `webhookUrl` | Refused |
219
+
220
+ `webhookUrl` must be an absolute `http:` or `https:` URL. The POST uses `redirect: "error"` and a 5 second timeout. A failed delivery does not undo the vault write. `audit.enabled: false` records nothing. The body never contains a secret value.
221
+
212
222
  ## Troubleshooting
213
223
 
214
224
  <Accordions>
215
225
 
226
+ <Accordion title="audit verify requires audit.sink db">
227
+ `stdout` and `webhook` sinks are not a local hash chain. `oke vault audit` (list, verify, purge)
228
+ throws `UNSUPPORTED`. Use `sink: "db"` when you need `verify`.
229
+ </Accordion>
230
+
216
231
  <Accordion title="oke vault: no such secret">
217
232
  Rotate/get targeted a path that was never set. `oke vault list` (or Console) for live paths;
218
233
  remember per-tenant storage uses `{tenantId}/{name}`.