@eloxiv/cli 0.0.0-stage → 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 (294) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/AgentSkills.d.ts +51 -0
  4. package/dist/AgentSkills.d.ts.map +1 -0
  5. package/dist/AgentSkills.js +264 -0
  6. package/dist/AgentSkills.js.map +1 -0
  7. package/dist/AgentWeb.d.ts +83 -0
  8. package/dist/AgentWeb.d.ts.map +1 -0
  9. package/dist/AgentWeb.js +436 -0
  10. package/dist/AgentWeb.js.map +1 -0
  11. package/dist/App.d.ts +213 -0
  12. package/dist/App.d.ts.map +1 -0
  13. package/dist/App.js +357 -0
  14. package/dist/App.js.map +1 -0
  15. package/dist/Blueprint.d.ts +47 -0
  16. package/dist/Blueprint.d.ts.map +1 -0
  17. package/dist/Blueprint.js +241 -0
  18. package/dist/Blueprint.js.map +1 -0
  19. package/dist/Brand.d.ts +42 -0
  20. package/dist/Brand.d.ts.map +1 -0
  21. package/dist/Brand.js +370 -0
  22. package/dist/Brand.js.map +1 -0
  23. package/dist/Changelog.d.ts +22 -0
  24. package/dist/Changelog.d.ts.map +1 -0
  25. package/dist/Changelog.js +117 -0
  26. package/dist/Changelog.js.map +1 -0
  27. package/dist/Cli.d.ts +17 -0
  28. package/dist/Cli.d.ts.map +1 -0
  29. package/dist/Cli.js +810 -0
  30. package/dist/Cli.js.map +1 -0
  31. package/dist/DbAdmin.d.ts +18 -0
  32. package/dist/DbAdmin.d.ts.map +1 -0
  33. package/dist/DbAdmin.js +91 -0
  34. package/dist/DbAdmin.js.map +1 -0
  35. package/dist/Dependencies.d.ts +53 -0
  36. package/dist/Dependencies.d.ts.map +1 -0
  37. package/dist/Dependencies.js +132 -0
  38. package/dist/Dependencies.js.map +1 -0
  39. package/dist/Deploy.d.ts +39 -0
  40. package/dist/Deploy.d.ts.map +1 -0
  41. package/dist/Deploy.js +458 -0
  42. package/dist/Deploy.js.map +1 -0
  43. package/dist/Docs.d.ts +71 -0
  44. package/dist/Docs.d.ts.map +1 -0
  45. package/dist/Docs.js +240 -0
  46. package/dist/Docs.js.map +1 -0
  47. package/dist/Doctor.d.ts +56 -0
  48. package/dist/Doctor.d.ts.map +1 -0
  49. package/dist/Doctor.js +368 -0
  50. package/dist/Doctor.js.map +1 -0
  51. package/dist/Dossier.d.ts +23 -0
  52. package/dist/Dossier.d.ts.map +1 -0
  53. package/dist/Dossier.js +92 -0
  54. package/dist/Dossier.js.map +1 -0
  55. package/dist/Emit.d.ts +26 -0
  56. package/dist/Emit.d.ts.map +1 -0
  57. package/dist/Emit.js +51 -0
  58. package/dist/Emit.js.map +1 -0
  59. package/dist/Errors.d.ts +26 -0
  60. package/dist/Errors.d.ts.map +1 -0
  61. package/dist/Errors.js +17 -0
  62. package/dist/Errors.js.map +1 -0
  63. package/dist/Evals.d.ts +52 -0
  64. package/dist/Evals.d.ts.map +1 -0
  65. package/dist/Evals.js +126 -0
  66. package/dist/Evals.js.map +1 -0
  67. package/dist/Files.d.ts +47 -0
  68. package/dist/Files.d.ts.map +1 -0
  69. package/dist/Files.js +145 -0
  70. package/dist/Files.js.map +1 -0
  71. package/dist/Generate.d.ts +80 -0
  72. package/dist/Generate.d.ts.map +1 -0
  73. package/dist/Generate.js +310 -0
  74. package/dist/Generate.js.map +1 -0
  75. package/dist/Guards.d.ts +45 -0
  76. package/dist/Guards.d.ts.map +1 -0
  77. package/dist/Guards.js +530 -0
  78. package/dist/Guards.js.map +1 -0
  79. package/dist/Inspect.d.ts +125 -0
  80. package/dist/Inspect.d.ts.map +1 -0
  81. package/dist/Inspect.js +270 -0
  82. package/dist/Inspect.js.map +1 -0
  83. package/dist/Keychain.d.ts +57 -0
  84. package/dist/Keychain.d.ts.map +1 -0
  85. package/dist/Keychain.js +73 -0
  86. package/dist/Keychain.js.map +1 -0
  87. package/dist/Lock.d.ts +13 -0
  88. package/dist/Lock.d.ts.map +1 -0
  89. package/dist/Lock.js +145 -0
  90. package/dist/Lock.js.map +1 -0
  91. package/dist/Mcp.d.ts +91 -0
  92. package/dist/Mcp.d.ts.map +1 -0
  93. package/dist/Mcp.js +128 -0
  94. package/dist/Mcp.js.map +1 -0
  95. package/dist/Merge.d.ts +18 -0
  96. package/dist/Merge.d.ts.map +1 -0
  97. package/dist/Merge.js +43 -0
  98. package/dist/Merge.js.map +1 -0
  99. package/dist/Migrate.d.ts +78 -0
  100. package/dist/Migrate.d.ts.map +1 -0
  101. package/dist/Migrate.js +288 -0
  102. package/dist/Migrate.js.map +1 -0
  103. package/dist/Plugins.d.ts +36 -0
  104. package/dist/Plugins.d.ts.map +1 -0
  105. package/dist/Plugins.js +304 -0
  106. package/dist/Plugins.js.map +1 -0
  107. package/dist/Postgres.d.ts +73 -0
  108. package/dist/Postgres.d.ts.map +1 -0
  109. package/dist/Postgres.js +294 -0
  110. package/dist/Postgres.js.map +1 -0
  111. package/dist/Publish.d.ts +23 -0
  112. package/dist/Publish.d.ts.map +1 -0
  113. package/dist/Publish.js +59 -0
  114. package/dist/Publish.js.map +1 -0
  115. package/dist/Registry.d.ts +539 -0
  116. package/dist/Registry.d.ts.map +1 -0
  117. package/dist/Registry.js +340 -0
  118. package/dist/Registry.js.map +1 -0
  119. package/dist/Remote.d.ts +90 -0
  120. package/dist/Remote.d.ts.map +1 -0
  121. package/dist/Remote.js +1006 -0
  122. package/dist/Remote.js.map +1 -0
  123. package/dist/Run.d.ts +120 -0
  124. package/dist/Run.d.ts.map +1 -0
  125. package/dist/Run.js +477 -0
  126. package/dist/Run.js.map +1 -0
  127. package/dist/SyncGen.d.ts +118 -0
  128. package/dist/SyncGen.d.ts.map +1 -0
  129. package/dist/SyncGen.js +392 -0
  130. package/dist/SyncGen.js.map +1 -0
  131. package/dist/Update.d.ts +301 -0
  132. package/dist/Update.d.ts.map +1 -0
  133. package/dist/Update.js +627 -0
  134. package/dist/Update.js.map +1 -0
  135. package/dist/bin.d.ts +3 -0
  136. package/dist/bin.d.ts.map +1 -0
  137. package/dist/bin.js +42 -0
  138. package/dist/bin.js.map +1 -0
  139. package/dist/docs/backlog.md +56 -0
  140. package/dist/docs/ci.md +277 -0
  141. package/dist/docs/cli.md +696 -0
  142. package/dist/docs/connectors/google.md +115 -0
  143. package/dist/docs/connectors/http-openapi.md +7 -0
  144. package/dist/docs/connectors/mcp.md +8 -0
  145. package/dist/docs/connectors/microsoft-graph.md +75 -0
  146. package/dist/docs/connectors/openai.md +25 -0
  147. package/dist/docs/connectors/slack.md +162 -0
  148. package/dist/docs/connectors/workos.md +39 -0
  149. package/dist/docs/contracts/README.md +173 -0
  150. package/dist/docs/contracts/action-consent.md +92 -0
  151. package/dist/docs/contracts/action-registry.md +85 -0
  152. package/dist/docs/contracts/actor.md +100 -0
  153. package/dist/docs/contracts/agent-resources.md +90 -0
  154. package/dist/docs/contracts/agent-runtime.md +257 -0
  155. package/dist/docs/contracts/approvals.md +126 -0
  156. package/dist/docs/contracts/audit.md +75 -0
  157. package/dist/docs/contracts/auth-provider.md +74 -0
  158. package/dist/docs/contracts/calendar-provider.md +46 -0
  159. package/dist/docs/contracts/client-sdk.md +245 -0
  160. package/dist/docs/contracts/collab-document.md +151 -0
  161. package/dist/docs/contracts/command.md +44 -0
  162. package/dist/docs/contracts/connections.md +235 -0
  163. package/dist/docs/contracts/context-accounting.md +50 -0
  164. package/dist/docs/contracts/daemon.md +243 -0
  165. package/dist/docs/contracts/db-tx.md +53 -0
  166. package/dist/docs/contracts/delegation.md +68 -0
  167. package/dist/docs/contracts/device-control.md +103 -0
  168. package/dist/docs/contracts/directory-provider.md +36 -0
  169. package/dist/docs/contracts/directory.md +161 -0
  170. package/dist/docs/contracts/document-source.md +33 -0
  171. package/dist/docs/contracts/files.md +115 -0
  172. package/dist/docs/contracts/flags.md +83 -0
  173. package/dist/docs/contracts/host.md +68 -0
  174. package/dist/docs/contracts/http-api.md +43 -0
  175. package/dist/docs/contracts/ingestion.md +130 -0
  176. package/dist/docs/contracts/ingress.md +141 -0
  177. package/dist/docs/contracts/invocation.md +260 -0
  178. package/dist/docs/contracts/local-client.md +110 -0
  179. package/dist/docs/contracts/locale.md +56 -0
  180. package/dist/docs/contracts/machine-identity.md +117 -0
  181. package/dist/docs/contracts/mail-provider.md +49 -0
  182. package/dist/docs/contracts/memory.md +53 -0
  183. package/dist/docs/contracts/messaging.md +40 -0
  184. package/dist/docs/contracts/metering.md +139 -0
  185. package/dist/docs/contracts/model-provider.md +84 -0
  186. package/dist/docs/contracts/module-manifest.md +213 -0
  187. package/dist/docs/contracts/notification-channel.md +90 -0
  188. package/dist/docs/contracts/notifications.md +123 -0
  189. package/dist/docs/contracts/outbox.md +80 -0
  190. package/dist/docs/contracts/privacy.md +110 -0
  191. package/dist/docs/contracts/progress.md +52 -0
  192. package/dist/docs/contracts/query-surface.md +108 -0
  193. package/dist/docs/contracts/readiness.md +63 -0
  194. package/dist/docs/contracts/release.md +142 -0
  195. package/dist/docs/contracts/result-rendering.md +61 -0
  196. package/dist/docs/contracts/sandbox.md +186 -0
  197. package/dist/docs/contracts/scheduler.md +148 -0
  198. package/dist/docs/contracts/screen-context.md +81 -0
  199. package/dist/docs/contracts/search.md +120 -0
  200. package/dist/docs/contracts/secrets.md +74 -0
  201. package/dist/docs/contracts/settings.md +109 -0
  202. package/dist/docs/contracts/sharing.md +77 -0
  203. package/dist/docs/contracts/slot.md +48 -0
  204. package/dist/docs/contracts/space.md +67 -0
  205. package/dist/docs/contracts/storage-adapter.md +45 -0
  206. package/dist/docs/contracts/storage-backend.md +56 -0
  207. package/dist/docs/contracts/sync.md +213 -0
  208. package/dist/docs/contracts/telemetry.md +80 -0
  209. package/dist/docs/contracts/theme-tokens.md +50 -0
  210. package/dist/docs/contracts/tool-source.md +58 -0
  211. package/dist/docs/contracts/versioning.md +99 -0
  212. package/dist/docs/contracts/view.md +65 -0
  213. package/dist/docs/contracts/work-items.md +99 -0
  214. package/dist/docs/contracts/workflow.md +82 -0
  215. package/dist/docs/decisions.md +163 -0
  216. package/dist/docs/example-app.md +192 -0
  217. package/dist/docs/getting-started.md +927 -0
  218. package/dist/docs/goal.md +54 -0
  219. package/dist/docs/parity.md +29 -0
  220. package/dist/docs/performance.md +129 -0
  221. package/dist/docs/registry/README.md +74 -0
  222. package/dist/docs/registry/app.md +38 -0
  223. package/dist/docs/registry/approvals-ui-foldkit.md +28 -0
  224. package/dist/docs/registry/calendar-ui-foldkit.md +27 -0
  225. package/dist/docs/registry/calendar.md +35 -0
  226. package/dist/docs/registry/chat-ui-foldkit.md +30 -0
  227. package/dist/docs/registry/desktop-rune.md +50 -0
  228. package/dist/docs/registry/desktop.md +32 -0
  229. package/dist/docs/registry/eloxiv-action.md +25 -0
  230. package/dist/docs/registry/eloxiv-connector.md +25 -0
  231. package/dist/docs/registry/eloxiv-module.md +25 -0
  232. package/dist/docs/registry/eloxiv-policy.md +25 -0
  233. package/dist/docs/registry/eloxiv-view.md +25 -0
  234. package/dist/docs/registry/hello-ui-foldkit.md +29 -0
  235. package/dist/docs/registry/hello.md +39 -0
  236. package/dist/docs/registry/home-ui-foldkit.md +27 -0
  237. package/dist/docs/registry/home.md +29 -0
  238. package/dist/docs/registry/inbox-ui-foldkit.md +27 -0
  239. package/dist/docs/registry/mail-ui-foldkit.md +27 -0
  240. package/dist/docs/registry/mail.md +34 -0
  241. package/dist/docs/registry/meeting-prep.md +26 -0
  242. package/dist/docs/registry/members-ui-foldkit.md +28 -0
  243. package/dist/docs/registry/mobile.md +37 -0
  244. package/dist/docs/registry/notes-ui-foldkit.md +27 -0
  245. package/dist/docs/registry/notes.md +26 -0
  246. package/dist/docs/registry/people-ui-foldkit.md +28 -0
  247. package/dist/docs/registry/people.md +38 -0
  248. package/dist/docs/registry/shell-foldkit.md +35 -0
  249. package/dist/docs/registry/theme.md +25 -0
  250. package/dist/docs/registry/ui-conformance.md +30 -0
  251. package/dist/docs/release.md +100 -0
  252. package/dist/docs/scaffold.md +826 -0
  253. package/dist/docs/security/threat-model.md +299 -0
  254. package/dist/docs/upstream/zero-cache-socket-handoff.md +105 -0
  255. package/dist/index.d.ts +8 -0
  256. package/dist/index.d.ts.map +1 -0
  257. package/dist/index.js +8 -0
  258. package/dist/index.js.map +1 -0
  259. package/package.json +48 -3
  260. package/src/AgentSkills.ts +329 -0
  261. package/src/AgentWeb.ts +507 -0
  262. package/src/App.ts +435 -0
  263. package/src/Blueprint.ts +276 -0
  264. package/src/Brand.ts +415 -0
  265. package/src/Changelog.ts +136 -0
  266. package/src/Cli.ts +1458 -0
  267. package/src/DbAdmin.ts +115 -0
  268. package/src/Dependencies.ts +170 -0
  269. package/src/Deploy.ts +563 -0
  270. package/src/Docs.ts +309 -0
  271. package/src/Doctor.ts +424 -0
  272. package/src/Dossier.ts +148 -0
  273. package/src/Emit.ts +68 -0
  274. package/src/Errors.ts +18 -0
  275. package/src/Evals.ts +153 -0
  276. package/src/Files.ts +152 -0
  277. package/src/Generate.ts +402 -0
  278. package/src/Guards.ts +541 -0
  279. package/src/Inspect.ts +358 -0
  280. package/src/Keychain.ts +107 -0
  281. package/src/Lock.ts +174 -0
  282. package/src/Mcp.ts +159 -0
  283. package/src/Merge.ts +70 -0
  284. package/src/Migrate.ts +331 -0
  285. package/src/Plugins.ts +347 -0
  286. package/src/Postgres.ts +353 -0
  287. package/src/Publish.ts +64 -0
  288. package/src/Registry.ts +405 -0
  289. package/src/Remote.ts +1158 -0
  290. package/src/Run.ts +541 -0
  291. package/src/SyncGen.ts +570 -0
  292. package/src/Update.ts +873 -0
  293. package/src/bin.ts +46 -0
  294. package/src/index.ts +7 -0
package/src/Inspect.ts ADDED
@@ -0,0 +1,358 @@
1
+ /**
2
+ * Reading what is installed and what the registry offers, and taking back local edits:
3
+ *
4
+ * eloxiv info <item> a registry item as published, read as data (nothing of it runs)
5
+ * eloxiv list the installed items: kind, version, owner, and whether each needs attention
6
+ * eloxiv restore <item> put an item's files back as installed (its locally edited or deleted ones)
7
+ */
8
+ import type { ProvenanceEntry } from "@eloxiv/contracts"
9
+ import { Console, Effect, FileSystem, Path } from "effect"
10
+ import { CliError, CONFIG_FILE, lockPath, readConfig, readLock } from "./App.ts"
11
+ import { asText, readAppBytes, sha256Bytes, writablePath, writeAppFile } from "./Files.ts"
12
+ import { hasConflictMarkers } from "./Merge.ts"
13
+ import { contentHash, fetchItem, isUrl, resolveRegistryLocation, targetOf, type ItemKind } from "./Registry.ts"
14
+ import { fetchBase, kindOf, selectEntries } from "./Update.ts"
15
+
16
+ // ---------------------------------------------------------------------------------------------------------
17
+ // info
18
+
19
+ export interface ItemInfo {
20
+ readonly name: string
21
+ readonly kind: ItemKind
22
+ readonly version: string
23
+ readonly contentHash: string
24
+ readonly description: string | null
25
+ readonly registry: string
26
+ /** Every published version, oldest first (`null` for an https registry, which cannot be listed). */
27
+ readonly versions: ReadonlyArray<string> | null
28
+ readonly registryDependencies: ReadonlyArray<string>
29
+ readonly dependencies: ReadonlyArray<string>
30
+ readonly devDependencies: ReadonlyArray<string>
31
+ /** Connectors: the capability contracts they implement. */
32
+ readonly provides: ReadonlyArray<string>
33
+ /** Modules: the kernel-provided modules they need. */
34
+ readonly kernelModules: ReadonlyArray<string>
35
+ /** Skills: the skill's name as agents see it. */
36
+ readonly skill: string | null
37
+ /** What the composition imports from the item (modules, connectors, skills). */
38
+ readonly exports: ReadonlyArray<{ readonly role: string; readonly file: string; readonly export: string }>
39
+ readonly files: ReadonlyArray<{ readonly path: string; readonly bytes: number }>
40
+ readonly next: ReadonlyArray<string>
41
+ /** The app's copy, when `info` runs in an app that installed it. */
42
+ readonly installed: {
43
+ readonly version: string
44
+ readonly owner: "registry" | "app"
45
+ readonly conflicts: number
46
+ } | null
47
+ }
48
+
49
+ const compareVersions = (a: string, b: string) => {
50
+ const [x, y] = [a.split(/[.+-]/), b.split(/[.+-]/)]
51
+ for (let i = 0; i < Math.max(x.length, y.length); i++) {
52
+ const [p, q] = [x[i] ?? "0", y[i] ?? "0"]
53
+ const [m, n] = [Number(p), Number(q)]
54
+ if (Number.isFinite(m) && Number.isFinite(n) && m !== n) return m - n
55
+ if (p !== q) return p < q ? -1 : 1
56
+ }
57
+ return 0
58
+ }
59
+
60
+ /** The published versions of `name` in a directory registry, oldest first. */
61
+ const publishedVersions = (registry: string, name: string) =>
62
+ Effect.gen(function* () {
63
+ if (isUrl(registry)) return null
64
+ const fs = yield* FileSystem.FileSystem
65
+ const path = yield* Path.Path
66
+ const entries = yield* fs.readDirectory(path.join(registry, name)).pipe(Effect.orElseSucceed(() => []))
67
+ return entries
68
+ .filter((entry) => entry.endsWith(".json"))
69
+ .map((entry) => entry.slice(0, -".json".length))
70
+ .sort(compareVersions)
71
+ })
72
+
73
+ /**
74
+ * The registry location: `--registry`, else the app's (`eloxiv.json` in `dir`). With an app, also its lock, so the
75
+ * report says what the app installed.
76
+ */
77
+ const registryFor = (dir: string, flag: string | undefined) =>
78
+ Effect.gen(function* () {
79
+ const fs = yield* FileSystem.FileSystem
80
+ const path = yield* Path.Path
81
+ const isApp = yield* fs.exists(path.join(dir, CONFIG_FILE)).pipe(Effect.orElseSucceed(() => false))
82
+ if (flag !== undefined) {
83
+ const resolved = resolveRegistryLocation(flag, process.cwd())
84
+ if ("error" in resolved) return yield* new CliError({ message: resolved.error })
85
+ return { registry: resolved.location, app: isApp }
86
+ }
87
+ if (!isApp) {
88
+ return yield* new CliError({ message: `${dir} is not an Eloxiv app: run this in one, or pass --registry` })
89
+ }
90
+ return { registry: (yield* readConfig(dir)).registry, app: true }
91
+ })
92
+
93
+ /**
94
+ * `eloxiv info`: a registry item, the latest or `version`, read as data: what it is, what it needs, what it
95
+ * installs (each file with its size) and what the composition takes from it. Nothing of the item is executed.
96
+ */
97
+ export const info = Effect.fn("Inspect.info")(function* (
98
+ dir: string,
99
+ name: string,
100
+ options: { readonly version?: string | undefined; readonly registry?: string | undefined },
101
+ ) {
102
+ const { registry, app } = yield* registryFor(dir, options.registry)
103
+ const item = yield* fetchItem(registry, name, options.version).pipe(
104
+ Effect.mapError((e) => new CliError({ message: e.message })),
105
+ )
106
+ const meta = item.meta.eloxiv
107
+ const entry = app ? (yield* readLock(dir)).items[name] : undefined
108
+ const encoder = new TextEncoder()
109
+ return {
110
+ name: item.name,
111
+ kind: meta.kind,
112
+ version: meta.version,
113
+ contentHash: yield* contentHash(item),
114
+ description: item.description ?? null,
115
+ registry,
116
+ versions: yield* publishedVersions(registry, name),
117
+ registryDependencies: item.registryDependencies ?? [],
118
+ dependencies: item.dependencies ?? [],
119
+ devDependencies: item.devDependencies ?? [],
120
+ provides: meta.provides ?? [],
121
+ kernelModules: meta.kernelModules ?? [],
122
+ skill: meta.skill ?? null,
123
+ exports: [
124
+ ...(meta.contract === undefined ? [] : [{ role: "contract", ...meta.contract }]),
125
+ ...(meta.server === undefined ? [] : [{ role: meta.kind === "module" ? "server" : meta.kind, ...meta.server }]),
126
+ ...(meta.sync === undefined ? [] : [{ role: "sync queries", file: meta.sync.file, export: "queries" }]),
127
+ ],
128
+ files: item.files.map((file) => ({ path: targetOf(file), bytes: encoder.encode(file.content).length })),
129
+ next: meta.next ?? [],
130
+ installed:
131
+ entry === undefined
132
+ ? null
133
+ : {
134
+ version: entry.registryVersion,
135
+ owner: entry.owner ?? "registry",
136
+ conflicts: (entry.conflicts ?? []).length,
137
+ },
138
+ } satisfies ItemInfo
139
+ })
140
+
141
+ export const formatInfo = (report: ItemInfo) => {
142
+ const list = (values: ReadonlyArray<string>) => (values.length === 0 ? "none" : values.join(", "))
143
+ const out = [
144
+ `${report.name} (${report.kind}) ${report.version}, sha256 ${report.contentHash.slice(0, 12)}`,
145
+ ...(report.description === null ? [] : [report.description]),
146
+ `registry: ${report.registry}`,
147
+ ...(report.versions === null ? [] : [`published versions: ${list(report.versions)}`]),
148
+ `registry dependencies: ${list(report.registryDependencies)}`,
149
+ `npm dependencies: ${list([...report.dependencies, ...report.devDependencies.map((d) => `${d} (dev)`)])}`,
150
+ ...(report.provides.length === 0 ? [] : [`provides: ${list(report.provides)}`]),
151
+ ...(report.kernelModules.length === 0 ? [] : [`kernel modules: ${list(report.kernelModules)}`]),
152
+ ...(report.skill === null ? [] : [`skill: ${report.skill}`]),
153
+ ...report.exports.map((e) => `${e.role}: ${e.export} from ${e.file}`),
154
+ `files (${report.files.length}):`,
155
+ ...report.files.map((f) => ` ${f.path} (${f.bytes} bytes)`),
156
+ ...report.next.map((step) => `next: ${step}`),
157
+ report.installed === null
158
+ ? "not installed in this app"
159
+ : `installed: ${report.installed.version}${report.installed.owner === "app" ? ", app-owned" : ""}${report.installed.conflicts > 0 ? `, ${report.installed.conflicts} unresolved conflicts` : ""}`,
160
+ ]
161
+ return out.join("\n")
162
+ }
163
+
164
+ /**
165
+ * The item as a blueprint for a coding agent to apply: what it is, the command that installs it, what it adds to the
166
+ * app and needs, and the steps that follow. Markdown, from the item's published data alone.
167
+ */
168
+ export const formatInfoMarkdown = (report: ItemInfo) => {
169
+ const bullets = (values: ReadonlyArray<string>) => values.map((value) => `- ${value}`)
170
+ return [
171
+ `# ${report.name} (${report.kind} ${report.version})`,
172
+ "",
173
+ ...(report.description === null ? [] : [report.description, ""]),
174
+ "## Install",
175
+ "",
176
+ "```sh",
177
+ report.installed === null ? `eloxiv add ${report.name}` : `eloxiv update ${report.name}`,
178
+ "```",
179
+ "",
180
+ ...(report.installed === null
181
+ ? []
182
+ : [
183
+ `Installed here at ${report.installed.version}${report.installed.owner === "app" ? " (app-owned)" : ""}.`,
184
+ "",
185
+ ]),
186
+ "## What it adds",
187
+ "",
188
+ ...bullets(report.files.map((f) => `\`${f.path}\``)),
189
+ ...(report.exports.length === 0
190
+ ? []
191
+ : [
192
+ "",
193
+ "The composition imports:",
194
+ "",
195
+ ...bullets(report.exports.map((e) => `\`${e.export}\` from \`${e.file}\` (${e.role})`)),
196
+ ]),
197
+ "",
198
+ "## What it needs",
199
+ "",
200
+ ...bullets([
201
+ `Registry items: ${report.registryDependencies.length === 0 ? "none" : report.registryDependencies.join(", ")}`,
202
+ `npm packages: ${[...report.dependencies, ...report.devDependencies].join(", ") || "none"}`,
203
+ ...(report.kernelModules.length === 0 ? [] : [`Kernel modules: ${report.kernelModules.join(", ")}`]),
204
+ ...(report.provides.length === 0 ? [] : [`Implements: ${report.provides.join(", ")}`]),
205
+ ...(report.skill === null ? [] : [`Agent skill: ${report.skill}`]),
206
+ ]),
207
+ ...(report.next.length === 0 ? [] : ["", "## Then", "", ...report.next.map((step, i) => `${i + 1}. ${step}`)]),
208
+ "",
209
+ ].join("\n")
210
+ }
211
+
212
+ // ---------------------------------------------------------------------------------------------------------
213
+ // list
214
+
215
+ export interface ListedItem {
216
+ readonly name: string
217
+ readonly kind: ItemKind
218
+ readonly version: string
219
+ readonly owner: "registry" | "app"
220
+ /** The registry's latest version, `null` when it no longer publishes the item or cannot be reached. */
221
+ readonly latest: string | null
222
+ /** Files edited or deleted since the item was installed. */
223
+ readonly modified: number
224
+ readonly conflicts: number
225
+ readonly status: "app-owned" | "conflicts" | "update available" | "modified" | "up to date" | "unknown"
226
+ }
227
+
228
+ const modifiedFiles = (dir: string, entry: ProvenanceEntry) =>
229
+ Effect.gen(function* () {
230
+ let count = 0
231
+ let markers = false
232
+ for (const file of entry.files) {
233
+ const bytes = yield* readAppBytes(dir, lockPath(file.path))
234
+ if (bytes === undefined) {
235
+ count++
236
+ continue
237
+ }
238
+ if ((yield* sha256Bytes(bytes)) === file.sha256) continue
239
+ count++
240
+ const text = asText(bytes)
241
+ if (text !== undefined && hasConflictMarkers(text)) markers = true
242
+ }
243
+ return { count, markers }
244
+ })
245
+
246
+ /** `eloxiv list`: every installed item (or those of `kind`) with its state. */
247
+ export const list = Effect.fn("Inspect.list")(function* (dir: string, kind?: string) {
248
+ const { registry } = yield* readConfig(dir)
249
+ const lock = yield* readLock(dir)
250
+ const items: Array<ListedItem> = []
251
+ for (const entry of Object.values(lock.items).sort((a, b) => a.name.localeCompare(b.name))) {
252
+ const itemKind = kindOf(entry)
253
+ if (kind !== undefined && itemKind !== kind) continue
254
+ const owner = entry.owner ?? "registry"
255
+ const latest = yield* fetchItem(registry, entry.name).pipe(
256
+ Effect.flatMap((item) =>
257
+ Effect.map(contentHash(item), (hash) => ({ version: item.meta.eloxiv.version, hash }) as const),
258
+ ),
259
+ Effect.option,
260
+ )
261
+ const { count, markers } = yield* modifiedFiles(dir, entry)
262
+ const conflicts = (entry.conflicts ?? []).length
263
+ const status: ListedItem["status"] =
264
+ owner === "app"
265
+ ? "app-owned"
266
+ : conflicts > 0 || markers
267
+ ? "conflicts"
268
+ : latest._tag === "None"
269
+ ? "unknown"
270
+ : latest.value.hash !== entry.contentHash
271
+ ? "update available"
272
+ : count > 0
273
+ ? "modified"
274
+ : "up to date"
275
+ items.push({
276
+ name: entry.name,
277
+ kind: itemKind,
278
+ version: entry.registryVersion,
279
+ owner,
280
+ latest: latest._tag === "None" ? null : latest.value.version,
281
+ modified: count,
282
+ conflicts,
283
+ status,
284
+ })
285
+ }
286
+ return items
287
+ })
288
+
289
+ export const formatList = (items: ReadonlyArray<ListedItem>) => {
290
+ if (items.length === 0) return "no items installed"
291
+ const width = Math.max(...items.map((item) => item.name.length))
292
+ const kinds = Math.max(...items.map((item) => item.kind.length))
293
+ return items
294
+ .map((item) => {
295
+ const detail = [
296
+ item.status,
297
+ ...(item.status === "update available" && item.latest !== null ? [`to ${item.latest}`] : []),
298
+ ...(item.modified > 0 && item.owner === "registry" ? [`${item.modified} files edited`] : []),
299
+ ].join(", ")
300
+ return `${item.name.padEnd(width)} ${item.kind.padEnd(kinds)} ${item.version.padEnd(8)} ${detail}`
301
+ })
302
+ .join("\n")
303
+ }
304
+
305
+ // ---------------------------------------------------------------------------------------------------------
306
+ // restore
307
+
308
+ export interface RestoreReport {
309
+ readonly name: string
310
+ readonly version: string
311
+ readonly dryRun: boolean
312
+ /** Files written back as the installed version had them. */
313
+ readonly restored: ReadonlyArray<{ readonly path: string; readonly was: "modified" | "deleted" }>
314
+ }
315
+
316
+ /**
317
+ * `eloxiv restore`: write an item's files back as its installed version has them, those edited or deleted locally
318
+ * (all of them, or `paths`). The installed version is fetched again from the registry and checked against the
319
+ * lock's hash. Recorded conflicts stay recorded until `eloxiv update --continue`, which then finds the restored
320
+ * files without markers. With `dryRun`, nothing is written.
321
+ */
322
+ export const restore = Effect.fn("Inspect.restore")(function* (
323
+ dir: string,
324
+ name: string,
325
+ paths: ReadonlyArray<string>,
326
+ options: { readonly dryRun: boolean },
327
+ ) {
328
+ const { registry } = yield* readConfig(dir)
329
+ const lock = yield* readLock(dir)
330
+ const [entry] = yield* selectEntries(lock, [name])
331
+ const base = yield* fetchBase(registry, entry!)
332
+ if (base === undefined) {
333
+ return yield* new CliError({
334
+ message: `${name}@${entry!.registryVersion}, the version this app installed, is not published in ${registry}; cannot restore from it`,
335
+ })
336
+ }
337
+ const published = new Map(base.files.map((file) => [targetOf(file), file.content] as const))
338
+ const wanted = paths.map((path) => lockPath(path))
339
+ const unknown = wanted.filter((path) => !published.has(path))
340
+ if (unknown.length > 0) {
341
+ return yield* new CliError({ message: `Not files of ${name}: ${unknown.join(", ")}` })
342
+ }
343
+ const restored: Array<RestoreReport["restored"][number]> = []
344
+ const selected = wanted.length === 0 ? [...published.keys()] : wanted
345
+ for (const path of selected) {
346
+ const content = published.get(path)!
347
+ yield* writablePath(dir, path)
348
+ const bytes = yield* readAppBytes(dir, path)
349
+ if (bytes !== undefined && (yield* sha256Bytes(bytes)) === (yield* sha256Bytes(new TextEncoder().encode(content))))
350
+ continue
351
+ restored.push({ path, was: bytes === undefined ? "deleted" : "modified" })
352
+ if (!options.dryRun) yield* writeAppFile(dir, path, content)
353
+ }
354
+ for (const file of restored)
355
+ yield* Console.log(`${options.dryRun ? "would restore" : "restored"} ${file.path} (${file.was})`)
356
+ if (restored.length === 0) yield* Console.log(`${name}: nothing to restore`)
357
+ return { name, version: entry!.registryVersion, dryRun: options.dryRun, restored } satisfies RestoreReport
358
+ })
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Where `eloxiv login` keeps its tokens: the operating system's keychain (the macOS Keychain, Windows Credential
3
+ * Manager, the Secret Service on Linux and FreeBSD: GNOME Keyring, KWallet, KeePassXC), through `@napi-rs/keyring`
4
+ * (keyring-rs; Node-API, so the same binary under Node and Bun), or else `credentials.json` itself (0600).
5
+ *
6
+ * `ELOXIV_CREDENTIAL_STORE` chooses: `auto` (the default) takes the keychain when one answers and the file
7
+ * otherwise (headless Linux without a Secret Service, CI, a platform without a prebuilt binding), saying why;
8
+ * `keychain` requires it (a command fails when none answers); `file` never touches it. On Linux only the Secret
9
+ * Service counts: keyring-rs's other store, the kernel's keyutils, forgets everything at a reboot.
10
+ *
11
+ * The keychain holds each grant's two tokens under the service `eloxiv-cli`, the account naming the grant (the
12
+ * kernel's URL, `#mcp` for an MCP grant) and the config directory (two config directories never share a grant).
13
+ * The rest of a sign-in (the client id, expiry, scope, the default kernel) stays in `credentials.json`.
14
+ *
15
+ * Tests give the CLI a store of their own (`TokenStores`), never the person's keychain.
16
+ */
17
+ import { Context } from "effect"
18
+
19
+ /** The OS keychain as the CLI uses it: one secret per account, under the service `eloxiv-cli`. */
20
+ export interface Keychain {
21
+ /** Where the tokens are, as the person reads it ("the macOS Keychain"). */
22
+ readonly name: string
23
+ readonly get: (account: string) => Promise<string | undefined>
24
+ readonly set: (account: string, secret: string) => Promise<void>
25
+ /** Whether there was a secret to delete. */
26
+ readonly delete: (account: string) => Promise<boolean>
27
+ }
28
+
29
+ /** The store a command uses: the keychain, or the file (with why, when the keychain was wanted but none answered). */
30
+ export type TokenStore =
31
+ | { readonly kind: "keychain"; readonly keychain: Keychain }
32
+ | { readonly kind: "file"; readonly reason: string | undefined }
33
+
34
+ export const SERVICE = "eloxiv-cli"
35
+
36
+ /** The keychain's name on a platform, as messages say it. */
37
+ export const keychainName = (platform: NodeJS.Platform): string =>
38
+ platform === "darwin"
39
+ ? "the macOS Keychain"
40
+ : platform === "win32"
41
+ ? "Windows Credential Manager"
42
+ : "the Secret Service (GNOME Keyring, KWallet)"
43
+
44
+ const message = (error: unknown) => (error instanceof Error ? error.message : String(error))
45
+
46
+ interface KeyringEntry {
47
+ getPassword(): string | null | undefined
48
+ setPassword(password: string): void
49
+ deletePassword(): boolean
50
+ }
51
+ type KeyringModule = {
52
+ readonly Entry: new (service: string, account: string, options?: { linux?: { store?: string } }) => KeyringEntry
53
+ }
54
+
55
+ /**
56
+ * The OS keychain through `@napi-rs/keyring`, if one answers: the binding loads (a prebuilt binary exists for this
57
+ * platform), and on Linux the Secret Service is reachable, probed with a read of an account that holds nothing.
58
+ */
59
+ export const osKeychain = async (
60
+ platform: NodeJS.Platform = process.platform,
61
+ ): Promise<{ readonly keychain: Keychain } | { readonly unavailable: string }> => {
62
+ let keyring: KeyringModule
63
+ try {
64
+ keyring = (await import("@napi-rs/keyring")) as unknown as KeyringModule
65
+ } catch (error) {
66
+ return { unavailable: `the native keychain module could not be loaded (${message(error)})` }
67
+ }
68
+ // On Linux, the Secret Service or nothing: the keyutils store keyring-rs falls back to is lost at a reboot.
69
+ const options = platform === "linux" || platform === "freebsd" ? { linux: { store: "secret-service" } } : undefined
70
+ const entry = (account: string) => new keyring.Entry(SERVICE, account, options)
71
+ try {
72
+ entry("probe").getPassword()
73
+ } catch (error) {
74
+ return { unavailable: `${keychainName(platform)} is not available (${message(error)})` }
75
+ }
76
+ return {
77
+ keychain: {
78
+ name: keychainName(platform),
79
+ get: async (account) => entry(account).getPassword() ?? undefined,
80
+ set: async (account, secret) => entry(account).setPassword(secret),
81
+ delete: async (account) => entry(account).deletePassword(),
82
+ },
83
+ }
84
+ }
85
+
86
+ /** The store `ELOXIV_CREDENTIAL_STORE` asks for, on this machine. */
87
+ export const chooseTokenStore = async (
88
+ env: NodeJS.ProcessEnv = process.env,
89
+ probe: () => Promise<{ readonly keychain: Keychain } | { readonly unavailable: string }> = osKeychain,
90
+ ): Promise<TokenStore> => {
91
+ const asked = (env["ELOXIV_CREDENTIAL_STORE"] ?? "").trim() || "auto"
92
+ if (asked === "file") return { kind: "file", reason: undefined }
93
+ if (asked !== "auto" && asked !== "keychain")
94
+ throw new Error(`Invalid ELOXIV_CREDENTIAL_STORE value "${asked}": use auto, keychain or file`)
95
+ const found = await probe()
96
+ if ("keychain" in found) return { kind: "keychain", keychain: found.keychain }
97
+ if (asked === "keychain") throw new Error(`ELOXIV_CREDENTIAL_STORE is set to keychain, but ${found.unavailable}`)
98
+ return { kind: "file", reason: found.unavailable }
99
+ }
100
+
101
+ let chosen: Promise<TokenStore> | undefined
102
+
103
+ /** The token store commands use: the machine's (chosen once per process), or one a test provides. */
104
+ export const TokenStores = Context.Reference<{ readonly resolve: () => Promise<TokenStore> }>(
105
+ "@eloxiv/cli/TokenStores",
106
+ { defaultValue: () => ({ resolve: () => (chosen ??= chooseTokenStore()) }) },
107
+ )
package/src/Lock.ts ADDED
@@ -0,0 +1,174 @@
1
+ /**
2
+ * A lock across processes on one file: a directory beside it (`<file>.lock`), whose creation is atomic, so one
3
+ * process holds it at a time. The holder writes its owner record into it: a random token, its pid and host.
4
+ *
5
+ * - **Stale.** A lock is taken over only when its holder is gone: on this host, when its pid no longer runs (a
6
+ * process suspended for any length of time keeps its lock); when that cannot be checked (another host, or no
7
+ * owner record yet), when it is older than `staleMs`.
8
+ * - **Takeover** is done by one waiter at a time, holding a second lock (`<file>.lock.takeover`, taken and
9
+ * judged stale the same way). Holding it, the waiter checks again that the lock is the one it judged stale,
10
+ * moves it aside (rename is atomic) and removes it. While the stale lock is in place no one else can create
11
+ * the lock, and while the takeover lock is held no one else can move it, so the lock moved is always the
12
+ * stale one: a live lock is never moved, and two processes never hold the lock at once. (Should a lock that
13
+ * moved not be the one judged stale after all, it is put back, untouched.)
14
+ * - **Release** removes the lock only while it is still this holder's (its token), never one another process
15
+ * holds.
16
+ *
17
+ * One window remains, after a crash only: a takeover lock whose holder died is removed by a waiter that judged
18
+ * it stale, and two waiters removing it at once could remove a third's fresh one.
19
+ */
20
+ import { randomUUID } from "node:crypto"
21
+ import { hostname } from "node:os"
22
+ import { Effect, FileSystem, Option } from "effect"
23
+ import { CliError } from "./Errors.ts"
24
+
25
+ export interface LockOptions {
26
+ /** A lock whose holder cannot be checked is stale after this long. */
27
+ readonly staleMs?: number | undefined
28
+ /** How long to wait for another holder before giving up. */
29
+ readonly waitMs?: number | undefined
30
+ /** Tests only: runs between the last judgement that a lock is stale and moving it aside (widens that window). */
31
+ readonly beforeTakeover?: Effect.Effect<void> | undefined
32
+ }
33
+
34
+ interface Owner {
35
+ readonly token: string
36
+ readonly pid: number
37
+ readonly host: string
38
+ /** When the lock was taken (epoch ms). */
39
+ readonly at: number
40
+ }
41
+
42
+ const OWNER = "owner.json"
43
+
44
+ /** Does `pid` run on this host? (`EPERM` means it runs as another user.) */
45
+ const running = (pid: number) => {
46
+ try {
47
+ process.kill(pid, 0)
48
+ return true
49
+ } catch (error) {
50
+ return (error as { code?: string }).code === "EPERM"
51
+ }
52
+ }
53
+
54
+ /** Run `body` holding the lock `<file>.lock`. */
55
+ export const withFileLock = <A, E, R>(file: string, body: Effect.Effect<A, E, R>, options: LockOptions = {}) =>
56
+ Effect.gen(function* () {
57
+ const fs = yield* FileSystem.FileSystem
58
+ const lock = `${file}.lock`
59
+ const staleMs = options.staleMs ?? 60_000
60
+ const host = hostname()
61
+ const token = randomUUID()
62
+ const fail = (message: string) => new CliError({ message: `Cannot lock ${file}: ${message}` })
63
+
64
+ /** The owner record in a lock directory, if it has a readable one (one still being written has none yet). */
65
+ const ownerOf = (dir: string) =>
66
+ fs.readFileString(`${dir}/${OWNER}`).pipe(
67
+ Effect.flatMap((text) => Effect.try(() => JSON.parse(text) as Owner)),
68
+ Effect.option,
69
+ Effect.map(Option.getOrUndefined),
70
+ )
71
+
72
+ /** What identifies a lock as the one judged stale: its token, or for one without a record, its mtime. */
73
+ const identity = (dir: string) =>
74
+ Effect.gen(function* () {
75
+ const owner = yield* ownerOf(dir)
76
+ if (owner !== undefined) return `token:${owner.token}`
77
+ const info = yield* fs.stat(dir).pipe(Effect.option)
78
+ if (info._tag === "None") return undefined
79
+ return `mtime:${Option.getOrUndefined(info.value.mtime)?.getTime() ?? 0}`
80
+ })
81
+
82
+ const isStale = (dir: string) =>
83
+ Effect.gen(function* () {
84
+ const owner = yield* ownerOf(dir)
85
+ if (owner !== undefined && owner.host === host && Number.isInteger(owner.pid)) return !running(owner.pid)
86
+ const info = yield* fs.stat(dir).pipe(Effect.option)
87
+ if (info._tag === "None") return false
88
+ const since = owner?.at ?? Option.getOrUndefined(info.value.mtime)?.getTime()
89
+ return since !== undefined && Date.now() - since > staleMs
90
+ })
91
+
92
+ /** Move a stale lock aside and remove it, or put back what moved if it was not that lock. */
93
+ const moveAside = (judged: string) =>
94
+ Effect.gen(function* () {
95
+ // Judged again just before the move: another waiter may have taken over meanwhile.
96
+ if ((yield* identity(lock)) !== judged) return
97
+ if (options.beforeTakeover !== undefined) yield* options.beforeTakeover
98
+ const aside = `${lock}.${token}.stale`
99
+ if ((yield* fs.rename(lock, aside).pipe(Effect.result))._tag === "Failure") return
100
+ if ((yield* identity(aside)) === judged) {
101
+ yield* fs.remove(aside, { recursive: true }).pipe(Effect.ignore)
102
+ return
103
+ }
104
+ // A live lock moved: put it back.
105
+ const back = yield* fs.rename(aside, lock).pipe(Effect.result)
106
+ if (back._tag === "Failure") {
107
+ yield* Effect.logWarning(`Could not restore the lock ${lock} after moving it aside (${aside})`)
108
+ }
109
+ })
110
+
111
+ /**
112
+ * Take over a stale lock while holding the takeover lock, so no other waiter moves the lock meanwhile. False
113
+ * when another waiter is taking over (try again later).
114
+ */
115
+ const guard = `${lock}.takeover`
116
+ const takeOver = (judged: string) =>
117
+ Effect.gen(function* () {
118
+ const made = yield* fs.makeDirectory(guard, { mode: 0o700 }).pipe(Effect.result)
119
+ if (made._tag === "Failure") {
120
+ if (made.failure.reason._tag !== "AlreadyExists") return false
121
+ // A takeover in progress, or one whose process died (its lock is then removed, and taken next time).
122
+ if (yield* isStale(guard)) yield* fs.remove(guard, { recursive: true }).pipe(Effect.ignore)
123
+ return false
124
+ }
125
+ const owner: Owner = { token, pid: process.pid, host, at: Date.now() }
126
+ yield* fs
127
+ .writeFileString(`${guard}/${OWNER}`, JSON.stringify(owner))
128
+ .pipe(
129
+ Effect.ignore,
130
+ Effect.andThen(moveAside(judged)),
131
+ Effect.ensuring(fs.remove(guard, { recursive: true }).pipe(Effect.ignore)),
132
+ )
133
+ return true
134
+ })
135
+
136
+ const acquire = Effect.gen(function* () {
137
+ const deadline = Date.now() + (options.waitMs ?? 90_000)
138
+ for (;;) {
139
+ const made = yield* fs.makeDirectory(lock, { mode: 0o700 }).pipe(Effect.result)
140
+ if (made._tag === "Success") {
141
+ const owner: Owner = { token, pid: process.pid, host, at: Date.now() }
142
+ const written = yield* fs.writeFileString(`${lock}/${OWNER}`, JSON.stringify(owner)).pipe(Effect.result)
143
+ if (written._tag === "Success") return
144
+ yield* fs.remove(lock, { recursive: true }).pipe(Effect.ignore)
145
+ return yield* fail(written.failure.message)
146
+ }
147
+ if (made.failure.reason._tag !== "AlreadyExists") return yield* fail(made.failure.message)
148
+ const judged = yield* identity(lock)
149
+ if (judged !== undefined && (yield* isStale(lock)) && (yield* takeOver(judged))) continue
150
+ if (Date.now() > deadline) {
151
+ return yield* fail(`another eloxiv command holds ${lock}; if none is running, delete it`)
152
+ }
153
+ yield* Effect.sleep(20 + Math.floor(Math.random() * 40))
154
+ }
155
+ })
156
+
157
+ /** Remove the lock only while it is still ours: moved aside first, so nothing else is ever removed. */
158
+ const release = Effect.gen(function* () {
159
+ if ((yield* ownerOf(lock))?.token !== token) return
160
+ const gone = `${lock}.${token}.released`
161
+ if ((yield* fs.rename(lock, gone).pipe(Effect.result))._tag === "Failure") return
162
+ if ((yield* ownerOf(gone))?.token === token) {
163
+ yield* fs.remove(gone, { recursive: true }).pipe(Effect.ignore)
164
+ } else {
165
+ yield* fs.rename(gone, lock).pipe(Effect.ignore)
166
+ }
167
+ })
168
+
169
+ return yield* Effect.acquireUseRelease(
170
+ acquire,
171
+ () => body,
172
+ () => release,
173
+ )
174
+ })