@eloxiv/cli 0.0.0-stage → 0.1.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 (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 +108 -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 +49 -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 +34 -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
@@ -0,0 +1,340 @@
1
+ /**
2
+ * Reading registry items in the shadcn registry-item format, from a directory
3
+ * (`.../public/r`) or an HTTP(S) base URL, plus the content hash that is
4
+ * recorded as provenance.
5
+ *
6
+ * Layout of a published registry (see `Publish.ts`):
7
+ * <name>.json the latest version of each item (what `eloxiv add` installs)
8
+ * <name>/<version>.json every version ever published, immutable (the base `eloxiv update` merges from)
9
+ *
10
+ * For `https` registries (a private GitHub repository, for example), `ELOXIV_REGISTRY_TOKEN` is sent as
11
+ * `Authorization: Bearer <token>`. It is sent over https, or over plain http to a loopback host only, and
12
+ * dropped when a redirect leaves the registry's origin.
13
+ *
14
+ * A registry may also be a package (`npm:@eloxiv/registry`): its `r/` directory, as the running CLI resolves the
15
+ * package (`resolveRegistryLocation`). The CLI installed from npm depends on `@eloxiv/registry` and records this in a
16
+ * new app's `eloxiv.json`, so the app adds, diffs and updates items with no network access, and the location stays
17
+ * the same on every machine and after the CLI's package cache is cleared.
18
+ */
19
+ import { Effect, FileSystem, Path, Schema } from "effect";
20
+ import { existsSync } from "node:fs";
21
+ import { createRequire } from "node:module";
22
+ import { dirname, isAbsolute, join, resolve } from "node:path";
23
+ import { normaliseTarget } from "./Files.js";
24
+ import { Migration } from "./Migrate.js";
25
+ export const RegistryFile = Schema.Struct({
26
+ path: Schema.String,
27
+ type: Schema.String,
28
+ target: Schema.optional(Schema.String),
29
+ content: Schema.String,
30
+ });
31
+ /**
32
+ * What an item is. Every kind is installed, diffed and updated the same way; only `module` is composed. A `space`
33
+ * is a set of kernel-provided modules an app asks for without a screen (`home`: the home space, headless).
34
+ */
35
+ export const ItemKind = Schema.Literals([
36
+ "app",
37
+ "module",
38
+ "ui",
39
+ "shell",
40
+ "desktop",
41
+ "mobile",
42
+ "connector",
43
+ "skill",
44
+ "theme",
45
+ "space",
46
+ ]);
47
+ /** The kernel-provided modules a registry module or UI item can ask the composition for. */
48
+ export const KernelModuleName = Schema.Literals([
49
+ "inbox",
50
+ "sharing",
51
+ "connections",
52
+ "search",
53
+ "agent",
54
+ "spaces",
55
+ "devices",
56
+ ]);
57
+ export const EloxivMeta = Schema.Struct({
58
+ kind: ItemKind,
59
+ version: Schema.String,
60
+ module: Schema.optional(Schema.String),
61
+ contract: Schema.optional(Schema.Struct({ file: Schema.String, export: Schema.String })),
62
+ server: Schema.optional(Schema.Struct({ file: Schema.String, export: Schema.String })),
63
+ /**
64
+ * Modules: `file` holds the named queries; `tables` (default `sync.gen.ts` beside it) the Zero tables
65
+ * `eloxiv generate` writes from the module's Drizzle tables and entities.
66
+ */
67
+ sync: Schema.optional(Schema.Struct({
68
+ file: Schema.String,
69
+ tables: Schema.optional(Schema.String),
70
+ /** The module's generated mutators (`mutators.gen.ts`) when it has its own predictions: clients alone import it. */
71
+ mutators: Schema.optional(Schema.String),
72
+ })),
73
+ /**
74
+ * Modules, UI items and spaces: the kernel-provided modules it needs installed beside it (`inbox`: work items,
75
+ * notifications, approvals and consent; `sharing`; `connections`; `search`: Search and Ingestion; `agent`: the
76
+ * agent, with the inbox its consent needs; `spaces`: Spaces; `devices`: paired devices and runners, with the inbox
77
+ * its consent-marked `devices.sendTurn` needs). The composition installs each once and adds its
78
+ * synced tables and named queries to the app's sync schema.
79
+ */
80
+ kernelModules: Schema.optional(Schema.Array(KernelModuleName)),
81
+ /** Connectors: the capability contracts the connector implements (`MailProvider`, ...). */
82
+ provides: Schema.optional(Schema.Array(Schema.String)),
83
+ /** Skills: the skill's name as agents see it. */
84
+ skill: Schema.optional(Schema.String),
85
+ /**
86
+ * pnpm patches the app needs applied to its dependencies: `name@version` to the patch file (one of the item's
87
+ * files, by target), merged into the app's `pnpm.patchedDependencies` (`Dependencies.ts`).
88
+ */
89
+ patchedDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),
90
+ next: Schema.optional(Schema.Array(Schema.String)),
91
+ /**
92
+ * What versions of the item moved (modules, exports, stylesheets), applied to the app's own files by `eloxiv update`
93
+ * and `eloxiv migrate` (Migrate.ts).
94
+ */
95
+ migrations: Schema.optional(Schema.Array(Migration)),
96
+ });
97
+ export const RegistryItem = Schema.Struct({
98
+ name: Schema.String,
99
+ type: Schema.String,
100
+ description: Schema.optional(Schema.String),
101
+ registryDependencies: Schema.optional(Schema.Array(Schema.String)),
102
+ dependencies: Schema.optional(Schema.Array(Schema.String)),
103
+ devDependencies: Schema.optional(Schema.Array(Schema.String)),
104
+ files: Schema.Array(RegistryFile),
105
+ meta: Schema.Struct({ eloxiv: EloxivMeta }),
106
+ });
107
+ export class RegistryError extends Schema.TaggedError()("RegistryError", { message: Schema.String }) {
108
+ }
109
+ export const REGISTRY_TOKEN_ENV = "ELOXIV_REGISTRY_TOKEN";
110
+ export const isUrl = (source) => /^https?:\/\//.test(source);
111
+ /** Eloxiv's registry on GitHub: the default of a CLI run from a checkout. */
112
+ export const GITHUB_REGISTRY = "https://raw.githubusercontent.com/eloxiv/eloxiv/main/registry/public/r";
113
+ /** The registry package the published CLI depends on: the default of a CLI installed from npm. */
114
+ export const PACKAGE_REGISTRY = "npm:@eloxiv/registry";
115
+ /**
116
+ * A registry location as an app or a flag names it, made one the CLI reads: an https URL or an absolute directory as
117
+ * is; `npm:<package>` the package's `r/`, resolved from `from` (this CLI, by default: its own dependency); anything
118
+ * else a directory relative to `dir`. A package that cannot be resolved, or has no `r/`, is an error saying so.
119
+ */
120
+ export const resolveRegistryLocation = (value, dir, from = import.meta.url) => {
121
+ if (isUrl(value) || isAbsolute(value))
122
+ return { location: value };
123
+ if (!value.startsWith("npm:"))
124
+ return { location: resolve(dir, value) };
125
+ const name = value.slice("npm:".length);
126
+ let manifest;
127
+ try {
128
+ manifest = createRequire(from).resolve(`${name}/package.json`);
129
+ }
130
+ catch {
131
+ return {
132
+ error: `The registry ${value} is not installed beside this eloxiv (${name} is a dependency of @eloxiv/cli): reinstall the CLI, or set "registry" in eloxiv.json to a directory or https URL`,
133
+ };
134
+ }
135
+ const location = join(dirname(manifest), "r");
136
+ if (!existsSync(join(location, "registry.json")))
137
+ return {
138
+ error: `The registry ${value} (${location}) has no registry.json: it was not built or not packed with its items`,
139
+ };
140
+ return { location };
141
+ };
142
+ /** The immutable path of one published version, relative to the registry. */
143
+ export const versionPath = (name, version) => `${name}/${version}.json`;
144
+ const NAME = /^[a-z0-9][a-z0-9._-]*$/i;
145
+ const VERSION = /^[0-9A-Za-z][0-9A-Za-z.+-]*$/;
146
+ const loopback = new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
147
+ /** A bearer token is one RFC 6750 `token68`: no spaces, newlines or other control characters. */
148
+ const TOKEN = /^[A-Za-z0-9\-._~+/]+=*$/;
149
+ const registryToken = () => {
150
+ const token = process.env[REGISTRY_TOKEN_ENV];
151
+ return token === undefined || token === "" ? undefined : token;
152
+ };
153
+ /** `text` with the registry token, if any, replaced: error messages must never carry it. */
154
+ export const redactToken = (text) => {
155
+ const token = registryToken();
156
+ return token === undefined ? text : text.split(token).join(`[${REGISTRY_TOKEN_ENV}]`);
157
+ };
158
+ /** Headers for a registry request: the token only where it cannot leak in clear or to another origin. */
159
+ export const registryHeaders = (url, origin) => {
160
+ const token = registryToken();
161
+ if (token === undefined || !TOKEN.test(token))
162
+ return {};
163
+ if (url.origin !== origin)
164
+ return {};
165
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && loopback.has(url.hostname)))
166
+ return {};
167
+ return { authorization: `Bearer ${token}` };
168
+ };
169
+ const fetchText = async (start) => {
170
+ const origin = new URL(start).origin;
171
+ let url = new URL(start);
172
+ for (let hop = 0; hop < 5; hop++) {
173
+ // Redirects are followed by hand so the token is never replayed to another origin.
174
+ const response = await fetch(url, { headers: registryHeaders(url, origin), redirect: "manual" });
175
+ const location = response.headers.get("location");
176
+ if (response.status >= 300 && response.status < 400 && location !== null) {
177
+ url = new URL(location, url);
178
+ continue;
179
+ }
180
+ if (!response.ok)
181
+ throw new Error(`HTTP ${response.status}`);
182
+ return response.text();
183
+ }
184
+ throw new Error("too many redirects");
185
+ };
186
+ /** Read `relative` (a path inside the registry) as text. */
187
+ export const readRegistryText = Effect.fn("Registry.readRegistryText")(function* (source, relative) {
188
+ const fs = yield* FileSystem.FileSystem;
189
+ const path = yield* Path.Path;
190
+ if (isUrl(source)) {
191
+ const token = registryToken();
192
+ if (token !== undefined && !TOKEN.test(token)) {
193
+ return yield* new RegistryError({
194
+ message: `${REGISTRY_TOKEN_ENV} is malformed: a bearer token is a single word of letters, digits and -._~+/ (check for spaces or a trailing newline)`,
195
+ });
196
+ }
197
+ const url = `${source.replace(/\/$/, "")}/${relative}`;
198
+ return yield* Effect.tryPromise({
199
+ try: () => fetchText(url),
200
+ catch: (e) => new RegistryError({ message: redactToken(`Cannot fetch ${relative} from ${source}: ${String(e)}`) }),
201
+ });
202
+ }
203
+ return yield* fs
204
+ .readFileString(path.join(source, relative))
205
+ .pipe(Effect.mapError(() => new RegistryError({ message: `No ${relative} in registry ${source}` })));
206
+ });
207
+ /**
208
+ * Normalise every file's target (`./src/a` is `src/a`), refusing targets that would land outside the app
209
+ * (absolute paths, `..` segments) and two files at the same target.
210
+ */
211
+ const checkTargets = (item) => Effect.gen(function* () {
212
+ const seen = new Set();
213
+ const files = [];
214
+ for (const file of item.files) {
215
+ const target = normaliseTarget(targetOf(file));
216
+ if (target === undefined)
217
+ return yield* new RegistryError({ message: `Item ${item.name} has a file outside the app: ${targetOf(file)}` });
218
+ if (seen.has(target))
219
+ return yield* new RegistryError({ message: `Item ${item.name} has ${target} twice` });
220
+ seen.add(target);
221
+ files.push({ ...file, target });
222
+ }
223
+ return { ...item, files };
224
+ });
225
+ export const decodeItem = (text, what) => Schema.decodeUnknownEffect(Schema.fromJsonString(RegistryItem))(text).pipe(Effect.mapError((e) => new RegistryError({ message: `Item ${what} is not a valid Eloxiv registry item: ${String(e)}` })), Effect.flatMap(checkTargets));
226
+ /**
227
+ * Fetch one item from `source` (a directory or base URL holding `<name>.json`): the latest version, or the
228
+ * immutable copy of `version`.
229
+ */
230
+ export const fetchItem = Effect.fn("Registry.fetchItem")(function* (source, name, version) {
231
+ if (!NAME.test(name))
232
+ return yield* new RegistryError({ message: `Invalid item name "${name}"` });
233
+ if (version !== undefined && !VERSION.test(version))
234
+ return yield* new RegistryError({ message: `Invalid version "${version}" for ${name}` });
235
+ const relative = version === undefined ? `${name}.json` : versionPath(name, version);
236
+ const text = yield* readRegistryText(source, relative).pipe(Effect.mapError((e) => version === undefined && !isUrl(source)
237
+ ? new RegistryError({ message: `No item "${name}" in registry ${source}` })
238
+ : version === undefined
239
+ ? e
240
+ : new RegistryError({
241
+ message: `Version ${version} of ${name} is not published in ${source}: ${e.message}`,
242
+ })));
243
+ const item = yield* decodeItem(text, version === undefined ? name : `${name}@${version}`);
244
+ if (item.name !== name)
245
+ return yield* new RegistryError({ message: `${relative} in ${source} holds item "${item.name}", not "${name}"` });
246
+ if (version !== undefined && item.meta.eloxiv.version !== version)
247
+ return yield* new RegistryError({
248
+ message: `${relative} in ${source} holds version ${item.meta.eloxiv.version}, not ${version}`,
249
+ });
250
+ return item;
251
+ }, Effect.mapError((e) => new RegistryError({ message: redactToken(e.message) })));
252
+ /**
253
+ * Check that `item`, the registry's latest, is exactly its immutable copy `<name>/<version>.json`: the copy
254
+ * is what a later update merges from, so the app must never install anything else.
255
+ */
256
+ export const verifyImmutable = Effect.fn("Registry.verifyImmutable")(function* (source, item) {
257
+ const version = item.meta.eloxiv.version;
258
+ const pinned = yield* fetchItem(source, item.name, version);
259
+ const [latestHash, pinnedHash] = [yield* contentHash(item), yield* contentHash(pinned)];
260
+ if (latestHash !== pinnedHash) {
261
+ return yield* new RegistryError({
262
+ message: `The registry's ${item.name}.json (sha256 ${latestHash.slice(0, 12)}) differs from its immutable copy ${versionPath(item.name, version)} (sha256 ${pinnedHash.slice(0, 12)}); refusing to install a version that cannot be fetched again`,
263
+ });
264
+ }
265
+ return item;
266
+ });
267
+ /** The registry's latest version of `name`, checked against its immutable copy. */
268
+ export const fetchLatest = (source, name) => fetchItem(source, name).pipe(Effect.flatMap((item) => verifyImmutable(source, item)));
269
+ /** An item retired at its last published version, which stays fetchable for the apps that installed it. */
270
+ export const Deprecation = Schema.Struct({
271
+ /** The last version published. */
272
+ version: Schema.String,
273
+ /** The item to use instead, if there is one. */
274
+ replacement: Schema.optional(Schema.String),
275
+ reason: Schema.String,
276
+ });
277
+ /** Where a registry lists its retired items: `{ "<name>": Deprecation }`. */
278
+ export const DEPRECATED_FILE = "deprecated.json";
279
+ /** The registry's retired items: none when it lists none (`deprecated.json` absent). */
280
+ export const fetchDeprecations = Effect.fn("Registry.fetchDeprecations")(function* (source) {
281
+ const text = yield* readRegistryText(source, DEPRECATED_FILE).pipe(Effect.option);
282
+ if (text._tag === "None")
283
+ return {};
284
+ return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Record(Schema.String, Deprecation)))(text.value).pipe(Effect.mapError((e) => new RegistryError({ message: `${DEPRECATED_FILE} in ${source} is invalid: ${String(e)}` })));
285
+ });
286
+ /** What the CLI says about a retired item. */
287
+ export const deprecationText = (name, deprecation) => `${name} is deprecated: ${deprecation.reason}${deprecation.replacement === undefined ? "" : ` Use ${deprecation.replacement} instead.`} Its last version, ${deprecation.version}, stays published for apps that installed it.`;
288
+ /** Resolve `names` and their registry dependencies, dependencies first. A retired item is refused. */
289
+ export const resolveItems = Effect.fn("Registry.resolveItems")(function* (source, names) {
290
+ const ordered = [];
291
+ const seen = new Set();
292
+ const deprecations = yield* fetchDeprecations(source);
293
+ const visit = (name) => Effect.gen(function* () {
294
+ if (seen.has(name))
295
+ return;
296
+ seen.add(name);
297
+ const deprecation = deprecations[name];
298
+ if (deprecation !== undefined)
299
+ return yield* new RegistryError({ message: deprecationText(name, deprecation) });
300
+ const item = yield* fetchLatest(source, name);
301
+ for (const dependency of item.registryDependencies ?? [])
302
+ yield* visit(dependency);
303
+ ordered.push(item);
304
+ });
305
+ for (const name of names)
306
+ yield* visit(name);
307
+ return ordered;
308
+ });
309
+ export const sha256 = async (text) => {
310
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
311
+ return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
312
+ };
313
+ /** The target path of a file inside the app. */
314
+ export const targetOf = (file) => file.target ?? file.path;
315
+ /** JSON with object keys sorted, so equal values always serialise the same. */
316
+ const canonical = (value) => Array.isArray(value)
317
+ ? value.map(canonical)
318
+ : value !== null && typeof value === "object"
319
+ ? Object.fromEntries(Object.keys(value)
320
+ .sort()
321
+ .map((key) => [key, canonical(value[key])]))
322
+ : value;
323
+ const sorted = (values) => [...(values ?? [])].sort();
324
+ /**
325
+ * Content hash of an item as published: sha256 over the canonical JSON of everything installing and
326
+ * merging it uses (its name and type, its files by target, its npm and registry dependencies and its
327
+ * `meta.eloxiv`), so a base or a latest version that changed in any of these is detected.
328
+ */
329
+ export const contentHash = (item) => Effect.promise(() => sha256(JSON.stringify(canonical({
330
+ name: item.name,
331
+ type: item.type,
332
+ files: [...item.files]
333
+ .map((file) => ({ target: targetOf(file), content: file.content }))
334
+ .sort((a, b) => (a.target < b.target ? -1 : a.target > b.target ? 1 : 0)),
335
+ dependencies: sorted(item.dependencies),
336
+ devDependencies: sorted(item.devDependencies),
337
+ registryDependencies: sorted(item.registryDependencies),
338
+ meta: item.meta.eloxiv,
339
+ }))));
340
+ //# sourceMappingURL=Registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Registry.js","sourceRoot":"","sources":["../src/Registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MA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K,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;SACnB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;SAClE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;IAC7C,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;IACvD,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;CACvB,CAAC,CACH,CACF,CACF,CAAA"}
@@ -0,0 +1,90 @@
1
+ import { Effect, FileSystem, Path } from "effect";
2
+ import { CliError, ExitStatus } from "./Errors.ts";
3
+ /**
4
+ * Where the CLI keeps its credentials, always an absolute path: it also names the lock and every keychain account, so
5
+ * two working directories must never resolve one relative setting to the same name. A relative `XDG_CONFIG_HOME` is
6
+ * ignored, as the XDG Base Directory specification asks.
7
+ */
8
+ export declare const configDir: Effect.Effect<string, CliError, Path.Path>;
9
+ /** The kernel `--url` names, else `ELOXIV_URL`, else the one `login` last signed in to. */
10
+ export declare const resolveKernelUrl: (flag: string | undefined) => Effect.Effect<string, CliError, FileSystem.FileSystem | Path.Path>;
11
+ /**
12
+ * The protected resources the CLI holds grants for: the kernel's API (`eloxiv login`) and its MCP endpoint (`eloxiv
13
+ * mcp login`, for `mcp serve`). The kernel binds each token to one resource (its audience), so each is a grant of its
14
+ * own, stored under its own key: the kernel's URL for the API, `<url>#mcp` for MCP.
15
+ */
16
+ export type Resource = "api" | "mcp";
17
+ /** `eloxiv login` (and `mcp login`): register this CLI with the kernel (once per kernel), then the device flow. */
18
+ export declare const login: (options: {
19
+ readonly url: string | undefined;
20
+ readonly scope: string | undefined;
21
+ readonly resource?: Resource;
22
+ }) => Effect.Effect<undefined, CliError, FileSystem.FileSystem | Path.Path>;
23
+ /**
24
+ * `eloxiv logout`: revoke the stored grant, then forget it. When the grant cannot be revoked (the kernel is
25
+ * unreachable, has no revocation endpoint, or does not answer 200) the credentials are kept, so `logout` can
26
+ * be run again, and the command fails: the grant may still be valid (RFC 7009 section 2.2.1).
27
+ */
28
+ export declare const logout: (options: {
29
+ readonly url: string | undefined;
30
+ readonly resource?: Resource;
31
+ }) => Effect.Effect<void, CliError, FileSystem.FileSystem | Path.Path>;
32
+ /**
33
+ * `eloxiv call`: invoke an action through the kernel's HTTP surface and print the JSON result envelope.
34
+ * An action's error is printed as JSON too, with exit status 1.
35
+ */
36
+ export declare const call: (options: {
37
+ readonly action: string;
38
+ readonly input: string;
39
+ readonly url: string | undefined;
40
+ readonly org: string | undefined;
41
+ readonly idempotencyKey: string | undefined;
42
+ }) => Effect.Effect<undefined, CliError | ExitStatus, FileSystem.FileSystem | Path.Path>;
43
+ /**
44
+ * `eloxiv actions`: the actions the kernel serves, from its OpenAPI document. Signed in (or with `ELOXIV_TOKEN`),
45
+ * the kernel lists only the actions you can reach: what the policy or the token's scope hides is left out.
46
+ */
47
+ export declare const actions: (options: {
48
+ readonly url: string | undefined;
49
+ readonly json: boolean;
50
+ }) => Effect.Effect<void, CliError, FileSystem.FileSystem | Path.Path>;
51
+ /** `eloxiv whoami`: which kernel, which credential, and the organisations (with roles) it acts for. */
52
+ export declare const whoami: (options: {
53
+ readonly url: string | undefined;
54
+ readonly json: boolean;
55
+ }) => Effect.Effect<void, CliError, FileSystem.FileSystem | Path.Path>;
56
+ /**
57
+ * `eloxiv agent <prompt>`: one turn of the signed-in person's agent (`POST /agent/messages`, the action `agent.send`,
58
+ * so policy, consent and budgets apply as on every surface), followed to its end over the run's event stream. The
59
+ * answer is printed as it streams (or whole at the end), each tool call on standard error. Exits 1 when the run does
60
+ * not succeed.
61
+ */
62
+ export declare const agent: (options: {
63
+ readonly prompt: string;
64
+ readonly url: string | undefined;
65
+ readonly conversation: string | undefined;
66
+ readonly json: boolean;
67
+ }) => Effect.Effect<undefined, CliError | ExitStatus, FileSystem.FileSystem | Path.Path>;
68
+ /**
69
+ * Every event of a finished run (`eloxiv eval promote`), as the signed-in person reads it: the run's stream from the
70
+ * start until `run-finished`. A run still going, or one the kernel will not show this person, fails.
71
+ */
72
+ export declare const fetchRunEvents: (options: {
73
+ readonly url: string | undefined;
74
+ readonly runId: string;
75
+ }) => Effect.Effect<{
76
+ readonly type: string;
77
+ readonly data: Record<string, unknown>;
78
+ }[], CliError, FileSystem.FileSystem | Path.Path>;
79
+ /**
80
+ * `eloxiv mcp serve`: the kernel's MCP server over stdio, for hosts that start local servers as processes. Each line
81
+ * on standard input is a JSON-RPC message, posted to `<kernel>/mcp` (streamable HTTP) with the stored MCP grant
82
+ * (`eloxiv mcp login`: the kernel takes for MCP only a token bound to its MCP resource, so the API sign-in of
83
+ * `eloxiv login` is never sent; or `ELOXIV_TOKEN`), refreshed once when refused; each message the kernel answers (JSON or a server-sent event
84
+ * stream) goes to standard output as one line. The session the kernel opens (`mcp-session-id`) is carried on every
85
+ * later request and ended (`DELETE`) when standard input closes. Diagnostics go to standard error only.
86
+ */
87
+ export declare const mcpServe: (options: {
88
+ readonly url: string | undefined;
89
+ }) => Effect.Effect<void, CliError, FileSystem.FileSystem | Path.Path>;
90
+ //# sourceMappingURL=Remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Remote.d.ts","sourceRoot":"","sources":["../src/Remote.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAW,MAAM,EAAE,UAAU,EAAU,IAAI,EAAU,M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