@bom0792/herdgate 0.9.29 → 0.9.34

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 (53) hide show
  1. package/.agents/skills/herdr/SKILL.md +81 -0
  2. package/.agents/skills/herdr/herdr_pi.py +272 -0
  3. package/.agents/skills/herdr/profiles.example.toml +18 -0
  4. package/.agents/skills/herdr-advisor/SKILL.md +12 -0
  5. package/.agents/skills/herdr-committee/SKILL.md +13 -0
  6. package/.agents/skills/herdr-handoff/SKILL.md +19 -0
  7. package/.agents/skills/herdr-help/SKILL.md +14 -0
  8. package/.agents/skills/herdr-plugin/SKILL.md +21 -0
  9. package/DEPLOY.md +106 -120
  10. package/DESIGN.md +9 -4
  11. package/README.md +55 -2
  12. package/bin/herdgate.mjs +12 -2
  13. package/bin/home-tui.mjs +2 -0
  14. package/bin/pi-skills.mjs +99 -0
  15. package/dist-readme.md +9 -2
  16. package/package.json +38 -9
  17. package/plugin/server/e2e.d.mts +2 -2
  18. package/plugin/server/e2e.mjs +51 -32
  19. package/plugin/server/index.mjs +128 -32
  20. package/plugin/server/pi-receipts.d.mts +28 -0
  21. package/plugin/server/pi-receipts.mjs +77 -0
  22. package/plugin/server/pi-worker.d.mts +47 -0
  23. package/plugin/server/pi-worker.mjs +127 -0
  24. package/plugin/server/ssh.mjs +12 -4
  25. package/scripts/bench-mobile-tui.mjs +246 -0
  26. package/scripts/build-host-bundle.sh +14 -8
  27. package/scripts/build-release.sh +47 -0
  28. package/scripts/deploy-vps.sh +5 -78
  29. package/scripts/install-pi-skills.mjs +4 -0
  30. package/src/cloud/gateway.ts +163 -134
  31. package/src/cloud/main.ts +72 -15
  32. package/src/cloud/pairing.ts +7 -2
  33. package/src/cloud/push.ts +54 -0
  34. package/src/cloud/sshd.ts +76 -38
  35. package/src/cloud/util.ts +5 -5
  36. package/src/host/mobile-tui.ts +11 -1
  37. package/src/web/app.js +88 -61
  38. package/src/web/e2e.js +51 -32
  39. package/src/web/sw.js +1 -1
  40. package/templates/cloud/.dockerignore +7 -0
  41. package/templates/cloud/Caddyfile.example +3 -0
  42. package/templates/cloud/Dockerfile +10 -0
  43. package/templates/cloud/README.md +74 -0
  44. package/templates/cloud/compose.env.example +18 -0
  45. package/templates/cloud/compose.yml +41 -0
  46. package/templates/cloud/gitignore.example +4 -0
  47. package/templates/cloud/herdgate-cloud-edge.service +18 -0
  48. package/templates/cloud/herdgate-cloud.service +26 -0
  49. package/tsconfig.cloud.json +11 -0
  50. package/tsconfig.json +18 -0
  51. package/windows/install-cli.mjs +15 -5
  52. package/windows/setup-tui.mjs +1 -0
  53. package/src/web/herdgate-host.zip +0 -0
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2023",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "lib": ["ES2023"],
7
+ "types": ["node"],
8
+ "strict": true,
9
+ "noEmit": true,
10
+ "allowImportingTsExtensions": true,
11
+ "erasableSyntaxOnly": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "isolatedModules": true
16
+ },
17
+ "include": ["src/**/*.ts", "test/**/*.ts"]
18
+ }
@@ -16,7 +16,7 @@ function directory(path) {
16
16
  if (!lstatSync(path).isDirectory()) throw new Error(`expected a real directory: ${path}`);
17
17
  }
18
18
 
19
- function inputs() {
19
+ async function inputs() {
20
20
  function files(dir) {
21
21
  return readdirSync(join(source, dir), { withFileTypes: true }).flatMap((file) => {
22
22
  const name = `${dir}/${file.name}`;
@@ -26,11 +26,16 @@ function inputs() {
26
26
  const runtime = ["plugin", "windows"];
27
27
  // ZIPs built before the standalone command do not contain these npm assets.
28
28
  for (const dir of ["bin", "app-mod", "templates"]) if (stat(join(source, dir))?.isDirectory()) runtime.push(dir);
29
- return runtime.flatMap(files).sort();
29
+ const assets = runtime.flatMap(files);
30
+ if (stat(join(source, ".agents", "skills"))?.isDirectory()) {
31
+ const { piSkillFiles } = await import("../bin/pi-skills.mjs");
32
+ assets.push(...piSkillFiles.map(name => `.agents/skills/${name}`));
33
+ }
34
+ return assets.sort();
30
35
  }
31
36
 
32
- function installRelease(releases) {
33
- const files = inputs().map((name) => [name, readFileSync(join(source, name))]);
37
+ async function installRelease(releases) {
38
+ const files = (await inputs()).map((name) => [name, readFileSync(join(source, name))]);
34
39
  const hash = createHash("sha256");
35
40
  for (const [name, contents] of files) hash.update(`${name}\0${contents.length}\0`).update(contents);
36
41
  const id = `tui-${hash.digest("hex").slice(0, 16)}`;
@@ -168,7 +173,7 @@ try {
168
173
  const lock = join(root, ".installing");
169
174
  mkdirSync(lock);
170
175
  try {
171
- const id = use ?? installRelease(releases);
176
+ const id = use ?? await installRelease(releases);
172
177
  if (stage) {
173
178
  console.log(id);
174
179
  } else if (command) {
@@ -187,6 +192,11 @@ try {
187
192
  installShim(root, "herdgate-tui.cmd", "current\\windows\\cli.mjs", "@rem Herdgate TUI CLI");
188
193
  console.log(`Herdgate TUI CLI: ${id}\nShim: ${join(root, "bin", "herdgate-tui.cmd")}`);
189
194
  }
195
+ // Stage/rollback never install skills; sync only after a successful install or CLI refresh.
196
+ if (!stage && (command || !use) && stat(join(source, "bin", "pi-skills.mjs"))?.isFile()) {
197
+ const { trySyncPiSkills } = await import("../bin/pi-skills.mjs");
198
+ trySyncPiSkills();
199
+ }
190
200
  } finally {
191
201
  rmSync(lock, { force: true, recursive: true });
192
202
  }
@@ -14,6 +14,7 @@ function invoke(file, args) {
14
14
  const child = spawnSync(process.execPath, [file, ...args], { encoding: "utf8", shell: false, windowsHide: true, timeout: 30_000 });
15
15
  if (child.error) throw child.error;
16
16
  if (child.status !== 0) throw new Error(child.stderr.trim() || `${args[0]} failed (${child.status})`);
17
+ if (child.stderr) process.stderr.write(child.stderr);
17
18
  return child.stdout.trim();
18
19
  }
19
20
  function storedProfile(path) {
Binary file