@hallohuman/hightea 0.1.8 → 0.1.13

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.
package/dist/bin.js CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@hallohuman/hightea",
8
- version: "0.1.8",
8
+ version: "0.1.13",
9
9
  description: "The Hightea command line: join this machine to a Hightea workspace as a host.",
10
10
  publishConfig: {
11
11
  access: "public"
@@ -25,9 +25,10 @@ var package_default = {
25
25
  prepack: "bun run build"
26
26
  },
27
27
  dependencies: {
28
- "@ahpd/sdk": "https://github.com/beorn/ahpd/releases/download/hh-38446-12d61c7b/ahpd-sdk-0.15.0-rc.4-beorn.12d61c7b.tgz",
29
- "@ahpd/server": "https://github.com/beorn/ahpd/releases/download/hh-38446-12d61c7b/ahpd-server-0.15.0-rc.4-beorn.12d61c7b.tgz",
30
- "@ahpd/services": "https://github.com/beorn/ahpd/releases/download/hh-38446-12d61c7b/ahpd-services-0.15.0-rc.4-beorn.12d61c7b.tgz",
28
+ "@ahpd/deploy": "https://github.com/beorn/ahpd/releases/download/hh-38507-cc798055/ahpd-deploy-0.15.0-beorn.cc798055.tgz",
29
+ "@ahpd/sdk": "https://github.com/beorn/ahpd/releases/download/hh-38507-cc798055/ahpd-sdk-0.15.0-beorn.cc798055.tgz",
30
+ "@ahpd/server": "https://github.com/beorn/ahpd/releases/download/hh-38507-cc798055/ahpd-server-0.15.0-beorn.cc798055.tgz",
31
+ "@ahpd/services": "https://github.com/beorn/ahpd/releases/download/hh-38507-cc798055/ahpd-services-0.15.0-beorn.cc798055.tgz",
31
32
  "@silvery/commander": "0.29.3",
32
33
  ws: "8.21.0"
33
34
  },
@@ -44,7 +45,7 @@ async function runCli(argv, options) {
44
45
  const program = new Command("hightea").description("Hightea: join this machine to a Hightea workspace as a host for your own agents.").version(options.version, "-v, --version").exitOverride();
45
46
  program.command("apply <file>").description("Apply a native process-compose file, or a TypeScript program that returns a plan, to one machine's ahpd: preview first, write only with --yes.").option("--machine <url>", "The machine's ahpd WebSocket endpoint, e.g. ws://127.0.0.1:7777").option("--token <token>", "The machine's token for this client (default: AHP_TKN)").option("--yes", "Send the previewed changes; without it nothing is sent").option("--prune", "After the preview lists them, remove entries this same source created that the plan no longer carries").option("--json", "Print one JSON document").addHelpText("after", `
46
47
  Exit status: 0 previewed or applied; 1 the machine refused the plan or could not be reached.`).exitOverride().action(async (file, flags) => {
47
- const { applyFile } = await import("./chunk-99e0mv8w.js");
48
+ const { applyFile } = await import("./chunk-1kzh6qrv.js");
48
49
  code = await applyFile(file, {
49
50
  machine: flags.machine ?? "",
50
51
  token: flags.token ?? process.env.AHP_TKN,
@@ -57,12 +58,12 @@ Exit status: 0 previewed or applied; 1 the machine refused the plan or could not
57
58
  host.command("join").description("Join this machine to a workspace with a one-use host join code from the workspace owner.").option("--origin <url>", "The deployment, e.g. https://hightea.dev").option("--workspace <slug>", "The workspace slug").option("--code <code>", "The one-use join code").option("--owner-config <file>", "Your owner configuration: agents, provider plugins and their credentials").addHelpText("after", `
58
59
  Exit status: 0 registered; 2 pending, rerun the same command; 3 not authorised for that workspace or agent;
59
60
  4 an agent is already bound to another host; 1 any other failure.`).exitOverride().action(async (flags) => {
60
- const { hostJoin } = await import("./chunk-3qbh10ga.js");
61
+ const { hostJoin } = await import("./chunk-pk0ntfzc.js");
61
62
  code = await hostJoin({ origin: flags.origin ?? "", workspace: flags.workspace ?? "", code: flags.code ?? "", ownerConfig: flags.ownerConfig ?? "" }, { directory: options.pluginDirectory, version: options.version });
62
63
  });
63
64
  host.command("list").description("List the workspace's registered hosts and which agents each runs; a workspace owner sees every host.").option("--origin <url>", "The deployment, e.g. https://hightea.dev").option("--workspace <slug>", "The workspace slug").option("--session-file <file>", "File holding your signed-in ht_session cookie (default: HIGHTEA_SESSION_FILE)").option("--json", "Print one JSON document").addHelpText("after", `
64
65
  Exit status: 0 listed; 3 your account is not a person of this workspace; 1 any other failure.`).exitOverride().action(async (flags) => {
65
- const { hostList } = await import("./chunk-c8kc1c68.js");
66
+ const { hostList } = await import("./chunk-rs0vvh3x.js");
66
67
  code = await hostList({
67
68
  origin: flags.origin ?? "",
68
69
  workspace: flags.workspace ?? "",
@@ -72,7 +73,7 @@ Exit status: 0 listed; 3 your account is not a person of this workspace; 1 any o
72
73
  });
73
74
  host.command("remove").description("Remove a registered host from a workspace, as the workspace owner; its agents need a new join code.").option("--origin <url>", "The deployment, e.g. https://hightea.dev").option("--workspace <slug>", "The workspace slug").option("--host <id>", "The registered host's id, e.g. host_01").option("--session-file <file>", "File holding your signed-in ht_session cookie (default: HIGHTEA_SESSION_FILE)").option("--json", "Print one JSON document").addHelpText("after", `
74
75
  Exit status: 0 removed or already removed; 3 your account is not this workspace's owner; 1 any other failure, including an unknown host id.`).exitOverride().action(async (flags) => {
75
- const { hostRemove } = await import("./chunk-c8kc1c68.js");
76
+ const { hostRemove } = await import("./chunk-rs0vvh3x.js");
76
77
  code = await hostRemove({
77
78
  origin: flags.origin ?? "",
78
79
  workspace: flags.workspace ?? "",
@@ -82,25 +83,32 @@ Exit status: 0 removed or already removed; 3 your account is not this workspace'
82
83
  });
83
84
  });
84
85
  host.command("status").description("Show every joined host on this machine and whether its plugin bundle is intact. Changes nothing.").option("--json", "Print one JSON document").exitOverride().action(async (flags) => {
85
- const { hostStatus } = await import("./chunk-3qbh10ga.js");
86
+ const { hostStatus } = await import("./chunk-pk0ntfzc.js");
86
87
  code = await hostStatus({ version: options.version, json: flags.json === true });
87
88
  });
89
+ host.command("update").description("Move a joined host on this machine to this CLI's plugin bundle; same host id and credentials. Restart the host after.").option("--host <id>", "The joined host's id, when this machine holds more than one").addHelpText("after", `
90
+ The old bundle is kept until the host has connected once on the new one; a later update removes it.
91
+ ` + `A bundle newer than this CLI's is refused (HOST_UPDATE_DOWNGRADE).
92
+ Exit status: 0 updated or already current; 1 any refusal, named on stderr.`).exitOverride().action(async (flags) => {
93
+ const { hostUpdate } = await import("./chunk-pk0ntfzc.js");
94
+ code = await hostUpdate({ host: flags.host }, { directory: options.pluginDirectory, version: options.version });
95
+ });
88
96
  const trust = host.command("trust").description("The browser and host keys this machine trusts to ask its agents through a room.").addHelpText("after", `
89
97
  What it protects against: an ask forged by a compromised Hightea server or database.
90
98
  ` + `What it does not: a compromised page script, since the script that signs comes from Hightea, or a process
91
99
  ` + "running as this machine's user, which can edit trusted-keys.json as it can config.json.").exitOverride();
92
100
  trust.command("add").description("Trust a browser's (or another host's) public key, under a name of your choosing.").argument("<name>", "A name for the key, e.g. the browser it came from").argument("<public-key>", "The raw Ed25519 public key, base64url, as the browser's Members page shows it").option("--host <id>", "Which of this machine's joined hosts, when it holds more than one").addHelpText("after", `
93
101
  Exit status: 0 trusted or already trusted; 1 any failure, with the file left unchanged.`).exitOverride().action(async (name, publicKey, flags) => {
94
- const { hostTrust } = await import("./chunk-py45wjd1.js");
102
+ const { hostTrust } = await import("./chunk-f5kk24rj.js");
95
103
  code = await hostTrust({ action: "add", name, publicKey, ...flags.host === undefined ? {} : { host: flags.host } });
96
104
  });
97
105
  trust.command("remove").description("Stop trusting the key with this name; asks signed with it are refused from then on.").argument("<name>", "The key's name, as `hightea host trust list` shows it").option("--host <id>", "Which of this machine's joined hosts, when it holds more than one").addHelpText("after", `
98
106
  Exit status: 0 removed; 1 any failure, including an unknown name, with the file left unchanged.`).exitOverride().action(async (name, flags) => {
99
- const { hostTrust } = await import("./chunk-py45wjd1.js");
107
+ const { hostTrust } = await import("./chunk-f5kk24rj.js");
100
108
  code = await hostTrust({ action: "remove", name, ...flags.host === undefined ? {} : { host: flags.host } });
101
109
  });
102
110
  trust.command("list").description("List the keys this machine trusts. Changes nothing.").option("--host <id>", "Which of this machine's joined hosts, when it holds more than one").option("--json", "Print one JSON document").exitOverride().action(async (flags) => {
103
- const { hostTrust } = await import("./chunk-py45wjd1.js");
111
+ const { hostTrust } = await import("./chunk-f5kk24rj.js");
104
112
  code = await hostTrust({ action: "list", json: flags.json === true, ...flags.host === undefined ? {} : { host: flags.host } });
105
113
  });
106
114
  const auth = program.command("auth").description("Sign this machine in to a Hightea deployment for the owner commands.").exitOverride();
@@ -181,7 +189,7 @@ Exit status: 0 set; 3 your account is not this workspace's owner; 1 any other fa
181
189
  Exit status: 0 done; 3 your account may not manage this host's services; 1 any other failure, named on stderr.`).exitOverride().action(async (...args) => {
182
190
  const name = options.named ? String(args[0]) : undefined;
183
191
  const flags = options.named ? args[1] : args[0];
184
- const { serviceCommand } = await import("./chunk-v59kcfmj.js");
192
+ const { serviceCommand } = await import("./chunk-n6qgzk8y.js");
185
193
  const text = (key) => typeof flags[key] === "string" ? flags[key] : undefined;
186
194
  code = await serviceCommand({
187
195
  origin: text("origin") ?? "",
@@ -204,7 +212,7 @@ Exit status: 0 done; 3 your account may not manage this host's services; 1 any o
204
212
  serviceAction("acknowledge", "Accept the process-compose files as they are now, so drift stops alerting on a hand edit.");
205
213
  service.command("backup").description("Show Hightea's backup of a host's services and their change log, labelled with how far it reaches; works while the host is offline or revoked.").requiredOption("--host <id>", "The registered host's id").option("--origin <url>", "The deployment, e.g. https://hightea.dev").option("--workspace <slug>", "The workspace slug").option("--session-file <file>", "File holding your signed-in ht_session cookie (default: HIGHTEA_SESSION_FILE)").option("--json", "Print the backup as one JSON document").addHelpText("after", `
206
214
  Exit status: 0 shown; 3 your account may not read this host's backup; 1 any other failure, named on stderr.`).exitOverride().action(async (flags) => {
207
- const { serviceBackupCommand } = await import("./chunk-v59kcfmj.js");
215
+ const { serviceBackupCommand } = await import("./chunk-n6qgzk8y.js");
208
216
  const text = (key) => typeof flags[key] === "string" ? flags[key] : undefined;
209
217
  code = await serviceBackupCommand({
210
218
  origin: text("origin") ?? "",
@@ -217,7 +225,7 @@ Exit status: 0 shown; 3 your account may not read this host's backup; 1 any othe
217
225
  });
218
226
  service.command("restore").description("Create a host's backed-up services on a new host, create-only: shows what it will create and asks first.").argument("[names...]", "Which services; every one in the backup when none is named").requiredOption("--from <id>", "The old host whose backup is read").option("--host <id>", "The new registered host's id; with --local, which of this machine's joined hosts").option("--local", "Create them on this machine, in-process, as you").option("--origin <url>", "The deployment, e.g. https://hightea.dev").option("--workspace <slug>", "The workspace slug").option("--session-file <file>", "File holding your signed-in ht_session cookie (default: HIGHTEA_SESSION_FILE)").option("--yes", "Do not ask; for scripts").option("--json", "Print each service's outcome as one JSON document").addHelpText("after", `
219
227
  Exit status: 0 every service created; 3 your account may not read the old host's backup; 1 anything else, each named.`).exitOverride().action(async (names, flags) => {
220
- const { serviceRestore } = await import("./chunk-v59kcfmj.js");
228
+ const { serviceRestore } = await import("./chunk-n6qgzk8y.js");
221
229
  const text = (key) => typeof flags[key] === "string" ? flags[key] : undefined;
222
230
  code = await serviceRestore({
223
231
  origin: text("origin") ?? "",
@@ -231,7 +239,7 @@ Exit status: 0 every service created; 3 your account may not read the old host's
231
239
  for (const [verb, enable] of [["enable", true], ["disable", false]]) {
232
240
  service.command(verb).description(enable ? "On this machine: let Hightea list, read logs of, change, start and stop this machine's services (adds the services grants)." : "On this machine: stop Hightea managing this machine's services (removes the services grants).").option("--host <id>", "Which of this machine's joined hosts, when it holds more than one").addHelpText("after", `
233
241
  Exit status: 0 changed or already so; 1 any failure, named on stderr.`).exitOverride().action(async (flags) => {
234
- const { hostServicesGrants } = await import("./chunk-3qbh10ga.js");
242
+ const { hostServicesGrants } = await import("./chunk-pk0ntfzc.js");
235
243
  code = await hostServicesGrants({ enable, ...typeof flags.host === "string" ? { host: flags.host } : {} });
236
244
  });
237
245
  }
@@ -6984,12 +6984,12 @@ async function applyPreview(shown, host) {
6984
6984
  let ifVersion = shown.ifVersion;
6985
6985
  const written = [];
6986
6986
  for (const service of shown.create) {
6987
- const answer = await host.call("x-ahpd/services/put", { service, ifVersion, mode: "add" });
6987
+ const answer = await host.call("x-ahpd/services/put", { service, ifVersion: "absent" });
6988
6988
  ifVersion = answer.ifVersion ?? ifVersion;
6989
6989
  written.push(service.name);
6990
6990
  }
6991
6991
  for (const entry of shown.change) {
6992
- const answer = await host.call("x-ahpd/services/put", { service: entry.after, ifVersion, mode: "change" });
6992
+ const answer = await host.call("x-ahpd/services/put", { service: entry.after, ifVersion });
6993
6993
  ifVersion = answer.ifVersion ?? ifVersion;
6994
6994
  written.push(entry.name);
6995
6995
  }
@@ -3,7 +3,7 @@ import {
3
3
  trustedKeyId,
4
4
  readTrustedKeys,
5
5
  localHost2
6
- } from "./chunk-k2ws7xvy.js";
6
+ } from "./chunk-hqjkbadp.js";
7
7
 
8
8
  // ../ahp-host/src/trust.ts
9
9
  import { writeJsonAtomic } from "@ahpd/sdk";