@hearsay-tools/squawk 0.19.0-pr4592.9108 → 0.19.0-pr4592.9114

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 (94) hide show
  1. package/dist/contract/hosts.d.ts +47 -5
  2. package/dist/contract/index.js +19 -1
  3. package/dist/features/hosts/bootstrap.d.ts +120 -0
  4. package/dist/features/hosts/bootstrap.js +469 -0
  5. package/dist/features/hosts/bootstrap.js.map +1 -0
  6. package/dist/features/hosts/cli.d.ts +13 -3
  7. package/dist/features/hosts/cli.js +199 -27
  8. package/dist/features/hosts/cli.js.map +1 -1
  9. package/dist/features/hosts/host-actions.d.ts +56 -0
  10. package/dist/features/hosts/host-actions.js +367 -0
  11. package/dist/features/hosts/host-actions.js.map +1 -0
  12. package/dist/features/hosts/host-server-cli.js +21 -3
  13. package/dist/features/hosts/host-server-cli.js.map +1 -1
  14. package/dist/features/hosts/host-server.d.ts +10 -1
  15. package/dist/features/hosts/host-server.js +74 -0
  16. package/dist/features/hosts/host-server.js.map +1 -1
  17. package/dist/features/hosts/index.d.ts +4 -2
  18. package/dist/features/hosts/index.js +14 -2
  19. package/dist/features/hosts/index.js.map +1 -1
  20. package/dist/features/hosts/registry.d.ts +28 -0
  21. package/dist/features/hosts/registry.js +42 -1
  22. package/dist/features/hosts/registry.js.map +1 -1
  23. package/dist/features/hosts/routes.d.ts +5 -3
  24. package/dist/features/hosts/routes.js +14 -7
  25. package/dist/features/hosts/routes.js.map +1 -1
  26. package/dist/features/hosts/ssh.d.ts +85 -0
  27. package/dist/features/hosts/ssh.js +271 -0
  28. package/dist/features/hosts/ssh.js.map +1 -0
  29. package/dist/features/hosts/supervisor.d.ts +191 -0
  30. package/dist/features/hosts/supervisor.js +620 -0
  31. package/dist/features/hosts/supervisor.js.map +1 -0
  32. package/dist/features/hosts/tunnel.d.ts +46 -0
  33. package/dist/features/hosts/tunnel.js +244 -0
  34. package/dist/features/hosts/tunnel.js.map +1 -0
  35. package/dist/features/webhooks/routes.d.ts +13 -13
  36. package/package.json +4 -4
  37. package/web/dist/assets/{accounts-section-DnrXoamz.js → accounts-section-qBZ5-RXj.js} +1 -1
  38. package/web/dist/assets/{activity-motion-BdJPeo7o.js → activity-motion-B9_5XF5v.js} +1 -1
  39. package/web/dist/assets/{activity-route-Dw71Cr6i.js → activity-route-DDL70lAh.js} +1 -1
  40. package/web/dist/assets/{agent-config-section-BGEGi01E.js → agent-config-section-BTaLvuxh.js} +1 -1
  41. package/web/dist/assets/{agent-defaults-section-D8MWZ53A.js → agent-defaults-section-VLUss9RM.js} +1 -1
  42. package/web/dist/assets/{appearance-CYqlJYaa.js → appearance-T8z_1h0U.js} +1 -1
  43. package/web/dist/assets/{archive-on-merge-field-C5rahH1Z.js → archive-on-merge-field-B1evTz6G.js} +1 -1
  44. package/web/dist/assets/{ask-card-BIC_lQ2c.js → ask-card-Cy2wek5M.js} +1 -1
  45. package/web/dist/assets/{automations-route-DI0ydCDa.js → automations-route-CNJznv4j.js} +1 -1
  46. package/web/dist/assets/{commit-list-DbpkT1HY.js → commit-list-CXzSImbK.js} +1 -1
  47. package/web/dist/assets/{diff-CmU9b0gx.js → diff-BQKKR814.js} +2 -2
  48. package/web/dist/assets/{diff-controls-B9tZr8zG.js → diff-controls-C8_X3pGh.js} +1 -1
  49. package/web/dist/assets/{diff-view-DVyQJEAh.js → diff-view-DG1UPpcV.js} +1 -1
  50. package/web/dist/assets/{discard-changes-dialog-CJeObjTR.js → discard-changes-dialog-BwiG6PUl.js} +1 -1
  51. package/web/dist/assets/{file-preview-H4XMT0K2.js → file-preview-DXFAfzRZ.js} +1 -1
  52. package/web/dist/assets/{git-toolbar-B1ZLwR1X.js → git-toolbar-DMwDBZHQ.js} +1 -1
  53. package/web/dist/assets/{github-BdjdJxmF.js → github-tms-xpXp.js} +1 -1
  54. package/web/dist/assets/{global-activity-route-DLFGZ4lp.js → global-activity-route-BZVh2SuF.js} +1 -1
  55. package/web/dist/assets/{index-xzm3y-R3.js → index-By89A7EE.js} +4 -4
  56. package/web/dist/assets/{markdown-CmUZXU6l.js → markdown-SnVO2DaH.js} +1 -1
  57. package/web/dist/assets/{option-select-D-x28L9X.js → option-select-DsG7Q73v.js} +1 -1
  58. package/web/dist/assets/{preferences-section-BDirIE4D.js → preferences-section-Da9B4Z8D.js} +1 -1
  59. package/web/dist/assets/{preview-pane-connected-BPqdI9Uz.js → preview-pane-connected-CdgEdzP5.js} +1 -1
  60. package/web/dist/assets/{project-location-D__CMCBG.js → project-location-RZjKydrb.js} +1 -1
  61. package/web/dist/assets/{projects-section-BXJ0SqMh.js → projects-section-C_sYrdIT.js} +1 -1
  62. package/web/dist/assets/{prompt-templates-section-DHlNt-ex.js → prompt-templates-section-CjgNc9ZO.js} +1 -1
  63. package/web/dist/assets/{remote-settings-notice-CSukKRu0.js → remote-settings-notice-D9VYD4by.js} +1 -1
  64. package/web/dist/assets/{repo-git-DRQ1CWJT.js → repo-git-CD5G34tp.js} +1 -1
  65. package/web/dist/assets/{report-reader-CsgVqSb7.js → report-reader-DtEXo7Fw.js} +1 -1
  66. package/web/dist/assets/{reports-DJTC-G9C.js → reports-B9Cs-YvK.js} +1 -1
  67. package/web/dist/assets/{resources-section-CEl3KxX5.js → resources-section-CcKLIO4H.js} +1 -1
  68. package/web/dist/assets/{review-notes-drafts-QssaeMSG.js → review-notes-drafts-BI4aCHM1.js} +1 -1
  69. package/web/dist/assets/{review-panel-B-ejuchP.js → review-panel-B0Oa_Lws.js} +1 -1
  70. package/web/dist/assets/{review-strip-Bc7MrWkU.js → review-strip-D1N_qYlD.js} +1 -1
  71. package/web/dist/assets/run-header-BC8OtX85.js +2 -0
  72. package/web/dist/assets/{select-DUAaaVTa.js → select-BQDojwao.js} +1 -1
  73. package/web/dist/assets/{session-context-section-C8tOTdWo.js → session-context-section-BvdzKbKF.js} +1 -1
  74. package/web/dist/assets/{settings-agent-picker-DSKhJo__.js → settings-agent-picker-CHuJTKf-.js} +1 -1
  75. package/web/dist/assets/{settings-save-bar-BaTvdxRS.js → settings-save-bar-BA7OrIIE.js} +1 -1
  76. package/web/dist/assets/{settings-shell-GMjpBakp.js → settings-shell-CGYHUMju.js} +1 -1
  77. package/web/dist/assets/{sidebar-section-BdR9D5OG.js → sidebar-section-BTuFmolj.js} +1 -1
  78. package/web/dist/assets/{skills-CqNCaR1E.js → skills-CPIJ4Uwy.js} +1 -1
  79. package/web/dist/assets/{task-changes-BxMzc4ok.js → task-changes-oDqYSSbu.js} +1 -1
  80. package/web/dist/assets/{task-commits-DgUbSkbL.js → task-commits-C9xXuud1.js} +1 -1
  81. package/web/dist/assets/{task-file-scope-D_M2arQo.js → task-file-scope-DqKm-YPL.js} +1 -1
  82. package/web/dist/assets/{task-files-FPxczYxB.js → task-files-B-cW59Yz.js} +1 -1
  83. package/web/dist/assets/{task-github-item-dSdiB_zd.js → task-github-item-BEdp-0M2.js} +1 -1
  84. package/web/dist/assets/{task-thread-CYmUqPui.js → task-thread-BDXrjYe2.js} +1 -1
  85. package/web/dist/assets/{thread-state-CZNY9U25.js → thread-state-C0pmupBX.js} +1 -1
  86. package/web/dist/assets/{use-finish-run-DDmppPpB.js → use-finish-run-DmmQCQGl.js} +1 -1
  87. package/web/dist/assets/{use-hand-to-agent-state-DQi9SmMT.js → use-hand-to-agent-state-D-5nky1R.js} +1 -1
  88. package/web/dist/assets/use-path-bases-CyQIGumQ.js +1 -0
  89. package/web/dist/assets/{workflows-1EAfbQJC.js → workflows-BUonf3es.js} +1 -1
  90. package/web/dist/assets/{workspace-tools-B7U-dat9.js → workspace-tools-BUUqNxd8.js} +1 -1
  91. package/web/dist/assets/{worktrees-section-Dsh1wTXy.js → worktrees-section-CUsYktyM.js} +1 -1
  92. package/web/dist/index.html +1 -1
  93. package/web/dist/assets/run-header-Co0MUsWJ.js +0 -2
  94. package/web/dist/assets/use-path-bases-HbjpIpS8.js +0 -1
@@ -18,16 +18,23 @@ export declare const hostPortSchema: z.ZodNumber;
18
18
  /** Derive the default host id from an SSH alias (lowercased, non-alphanumeric runs to `-`, max 32). */
19
19
  export declare function slugHostId(sshAlias: string): string;
20
20
  /**
21
- * Host states. Named schema so S3 can widen it to the full set in spec § 6
22
- * (`connecting`, `connected`, `unreachable`, `needs-node`, `version-mismatch`, `not-hosted`,
23
- * `identity-changed`, `several-servers`, `paused`, `cannot-persist`).
21
+ * Host states (spec § 6, hearsay-tools/squawk#4539).
24
22
  */
25
- export declare const HOST_STATES: readonly ['unreachable'];
23
+ export declare const HOST_STATES: readonly ['connecting', 'connected', 'unreachable', 'needs-node', 'version-mismatch', 'not-hosted', 'identity-changed', 'several-servers', 'paused', 'cannot-persist'];
26
24
  export declare const hostStateSchema: z.ZodEnum<{
25
+ "cannot-persist": "cannot-persist";
26
+ connected: "connected";
27
+ connecting: "connecting";
28
+ "identity-changed": "identity-changed";
29
+ "needs-node": "needs-node";
30
+ "not-hosted": "not-hosted";
31
+ paused: "paused";
32
+ "several-servers": "several-servers";
27
33
  unreachable: "unreachable";
34
+ "version-mismatch": "version-mismatch";
28
35
  }>;
29
36
  export type HostState = z.infer<typeof hostStateSchema>;
30
- /** Default unreachable reason in S1 before SSH bootstrap (S3) exists. */
37
+ /** Default unreachable reason before the supervisor has connected to a host. */
31
38
  export declare const HOST_NOT_CONNECTED_REASON = "not connected yet";
32
39
  /** Saved host entry in `<config>/hosts.json` (spec § Architecture 1). */
33
40
  export declare const hostEntrySchema: z.ZodObject<{
@@ -63,7 +70,16 @@ export declare const hostSummarySchema: z.ZodObject<{
63
70
  id: z.ZodString;
64
71
  label: z.ZodString;
65
72
  state: z.ZodEnum<{
73
+ "cannot-persist": "cannot-persist";
74
+ connected: "connected";
75
+ connecting: "connecting";
76
+ "identity-changed": "identity-changed";
77
+ "needs-node": "needs-node";
78
+ "not-hosted": "not-hosted";
79
+ paused: "paused";
80
+ "several-servers": "several-servers";
66
81
  unreachable: "unreachable";
82
+ "version-mismatch": "version-mismatch";
67
83
  }>;
68
84
  reason: z.ZodOptional<z.ZodString>;
69
85
  kind: z.ZodOptional<z.ZodLiteral<"ssh">>;
@@ -83,7 +99,16 @@ export declare const hostsListResponseSchema: z.ZodObject<{
83
99
  id: z.ZodString;
84
100
  label: z.ZodString;
85
101
  state: z.ZodEnum<{
102
+ "cannot-persist": "cannot-persist";
103
+ connected: "connected";
104
+ connecting: "connecting";
105
+ "identity-changed": "identity-changed";
106
+ "needs-node": "needs-node";
107
+ "not-hosted": "not-hosted";
108
+ paused: "paused";
109
+ "several-servers": "several-servers";
86
110
  unreachable: "unreachable";
111
+ "version-mismatch": "version-mismatch";
87
112
  }>;
88
113
  reason: z.ZodOptional<z.ZodString>;
89
114
  kind: z.ZodOptional<z.ZodLiteral<"ssh">>;
@@ -122,7 +147,16 @@ export declare const hostResponseSchema: z.ZodObject<{
122
147
  id: z.ZodString;
123
148
  label: z.ZodString;
124
149
  state: z.ZodEnum<{
150
+ "cannot-persist": "cannot-persist";
151
+ connected: "connected";
152
+ connecting: "connecting";
153
+ "identity-changed": "identity-changed";
154
+ "needs-node": "needs-node";
155
+ "not-hosted": "not-hosted";
156
+ paused: "paused";
157
+ "several-servers": "several-servers";
125
158
  unreachable: "unreachable";
159
+ "version-mismatch": "version-mismatch";
126
160
  }>;
127
161
  reason: z.ZodOptional<z.ZodString>;
128
162
  kind: z.ZodOptional<z.ZodLiteral<"ssh">>;
@@ -300,3 +334,11 @@ export declare const hostServerInstallRuntimeResultSchema: z.ZodObject<{
300
334
  prunedVersions: z.ZodArray<z.ZodString>;
301
335
  }, z.core.$strip>;
302
336
  export type HostServerInstallRuntimeResult = z.infer<typeof hostServerInstallRuntimeResultSchema>;
337
+ /** Output contract of `hsq host-server active-tasks --port <n> --json`. */
338
+ export declare const hostServerActiveTasksResultSchema: z.ZodObject<{
339
+ ok: z.ZodLiteral<true>;
340
+ action: z.ZodLiteral<"active-tasks">;
341
+ port: z.ZodNumber;
342
+ activeCount: z.ZodNumber;
343
+ }, z.core.$strip>;
344
+ export type HostServerActiveTasksResult = z.infer<typeof hostServerActiveTasksResultSchema>;
@@ -6521,7 +6521,18 @@ var hostPortSchema = z61.number().int("port must be an integer").min(1, "port mu
6521
6521
  function slugHostId(sshAlias) {
6522
6522
  return sshAlias.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32).replace(/-+$/g, "");
6523
6523
  }
6524
- var HOST_STATES = ["unreachable"];
6524
+ var HOST_STATES = [
6525
+ "connecting",
6526
+ "connected",
6527
+ "unreachable",
6528
+ "needs-node",
6529
+ "version-mismatch",
6530
+ "not-hosted",
6531
+ "identity-changed",
6532
+ "several-servers",
6533
+ "paused",
6534
+ "cannot-persist"
6535
+ ];
6525
6536
  var hostStateSchema = z61.enum(HOST_STATES);
6526
6537
  var HOST_NOT_CONNECTED_REASON = "not connected yet";
6527
6538
  var hostEntrySchema = z61.object({
@@ -6705,6 +6716,12 @@ var hostServerInstallRuntimeResultSchema = z61.object({
6705
6716
  alreadyInstalled: z61.boolean(),
6706
6717
  prunedVersions: z61.array(z61.string())
6707
6718
  });
6719
+ var hostServerActiveTasksResultSchema = z61.object({
6720
+ ok: z61.literal(true),
6721
+ action: z61.literal("active-tasks"),
6722
+ port: hostPortSchema,
6723
+ activeCount: z61.number().int().min(0)
6724
+ });
6708
6725
  export {
6709
6726
  ACTIVITY_CHECKS_MAX,
6710
6727
  ACTIVITY_CHECK_NAME_MAX,
@@ -7067,6 +7084,7 @@ export {
7067
7084
  hostPortSchema,
7068
7085
  hostResponseSchema,
7069
7086
  hostRouteParamsSchema,
7087
+ hostServerActiveTasksResultSchema,
7070
7088
  hostServerClaimPhaseSchema,
7071
7089
  hostServerClaimSummarySchema,
7072
7090
  hostServerEnsureResultSchema,
@@ -0,0 +1,120 @@
1
+ import type { Writable } from 'node:stream';
2
+ import { z } from 'zod';
3
+ import { type HostEntry, type HostServerStatusResult, type HostState } from '../../contract/index.js';
4
+ import type { Home } from '../../home/home.ts';
5
+ import { type SshTransportDeps } from './ssh.ts';
6
+ import { type HostTunnel, type TunnelDeps } from './tunnel.ts';
7
+ declare const remoteProbeOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
+ ok: z.ZodLiteral<false>;
9
+ code: z.ZodLiteral<"missing-node">;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ ok: z.ZodLiteral<true>;
12
+ nodePath: z.ZodString;
13
+ nodeVersion: z.ZodString;
14
+ platform: z.ZodString;
15
+ dataDir: z.ZodString;
16
+ configDir: z.ZodString;
17
+ runtimeDir: z.ZodString;
18
+ runtimeEntry: z.ZodString;
19
+ runtimeInstalled: z.ZodBoolean;
20
+ installId: z.ZodNullable<z.ZodString>;
21
+ }, z.core.$strip>], "ok">;
22
+ export type RemoteHostProbe = Extract<z.infer<typeof remoteProbeOutputSchema>, {
23
+ ok: true;
24
+ }>;
25
+ export interface BootstrapStepRecord {
26
+ readonly step: 'probe' | 'install' | 'ensure' | 'tunnel' | 'verify';
27
+ readonly status: 'ok' | 'skipped' | 'failed';
28
+ readonly detail: string;
29
+ }
30
+ export interface HostBootstrapDeps extends TunnelDeps {
31
+ packageRoot?: string | undefined;
32
+ mainVersion?: string | undefined;
33
+ requiredNode?: string | undefined;
34
+ streamArchive?: ((destination: Writable, packageRoot: string) => Promise<void>) | undefined;
35
+ probeTimeoutMs?: number | undefined;
36
+ installTimeoutMs?: number | undefined;
37
+ ensureTimeoutMs?: number | undefined;
38
+ statusTimeoutMs?: number | undefined;
39
+ controlTimeoutMs?: number | undefined;
40
+ tunnelTimeoutMs?: number | undefined;
41
+ }
42
+ export interface BootstrapHostResult {
43
+ readonly state: HostState;
44
+ readonly reason?: string | undefined;
45
+ readonly steps: BootstrapStepRecord[];
46
+ readonly tunnel?: HostTunnel | undefined;
47
+ readonly remotePort?: number | undefined;
48
+ readonly remotePid?: number | undefined;
49
+ readonly ownership?: 'managed' | 'unmanaged' | undefined;
50
+ readonly managedByStarter?: boolean | undefined;
51
+ readonly remoteVersion?: string | undefined;
52
+ readonly remoteInstallId?: string | undefined;
53
+ readonly probe?: RemoteHostProbe | undefined;
54
+ }
55
+ /** Package version and `engines.node` requirement of the running main Squawk server. */
56
+ export declare function readOwnPackageMeta(packageRoot?: string): {
57
+ version: string;
58
+ requiredNode: string;
59
+ };
60
+ /** True when `actualVersion` satisfies a minimum Node requirement such as `>=24.21.0`. */
61
+ export declare function satisfiesMinNodeVersion(actualVersion: string, requiredRange: string): boolean;
62
+ /**
63
+ * Operator-facing reason for `identity-changed`: names the exact confirmation sequence
64
+ * (`hsq host remove <id>` followed by `hsq host add <sshAlias>`).
65
+ */
66
+ export declare function formatIdentityChangedReason(entry: Pick<HostEntry, 'id' | 'sshAlias'>, expectedInstallId: string, actualInstallId: string | null | undefined): string;
67
+ export declare function readMainInstallId(home: Home): string;
68
+ export declare function resolveMeta(deps: HostBootstrapDeps): {
69
+ packageRoot: string;
70
+ mainVersion: string;
71
+ requiredNode: string;
72
+ };
73
+ export declare function buildHostServerCliCommand(nodePath: string, runtimeEntry: string, args: readonly string[]): string;
74
+ /**
75
+ * Parse a remote command's JSON object stdout robustly: tolerate shell rc banners or extra lines
76
+ * before the JSON by checking the whole trimmed stdout first, then scanning from the last
77
+ * non-empty line upward for the last JSON object line, and validating it with `schema`.
78
+ */
79
+ export declare function parseJsonStdout<T>(stdout: string, schema: z.ZodType<T>, label: string): {
80
+ ok: true;
81
+ data: T;
82
+ } | {
83
+ ok: false;
84
+ reason: string;
85
+ };
86
+ /** Step 1: probe Node.js version, remote Squawk home paths, runtime presence, and install id. */
87
+ export declare function probeRemoteHost(sshAlias: string, deps?: HostBootstrapDeps, signal?: AbortSignal): Promise<{
88
+ ok: true;
89
+ probe: RemoteHostProbe;
90
+ } | {
91
+ ok: false;
92
+ state: 'unreachable' | 'needs-node';
93
+ reason: string;
94
+ }>;
95
+ /** Step 2: stream the runtime `.tar.gz` archive to a staged temp folder and activate it atomically. */
96
+ export declare function installRemoteRuntime(sshAlias: string, probe: RemoteHostProbe, deps?: HostBootstrapDeps, signal?: AbortSignal): Promise<{
97
+ ok: true;
98
+ runtimeDir: string;
99
+ alreadyInstalled: boolean;
100
+ } | {
101
+ ok: false;
102
+ reason: string;
103
+ }>;
104
+ /** Run `hsq host-server status --starter-id <id> --json` on the remote machine over SSH. */
105
+ export declare function checkRemoteHostStatus(sshAlias: string, runtime: Pick<RemoteHostProbe, 'nodePath' | 'runtimeEntry'>, mainInstallId: string, port: number | undefined, deps?: Pick<HostBootstrapDeps, keyof SshTransportDeps | 'statusTimeoutMs'>, signal?: AbortSignal): Promise<{
106
+ ok: true;
107
+ status: HostServerStatusResult;
108
+ } | {
109
+ ok: false;
110
+ reason: string;
111
+ }>;
112
+ /**
113
+ * Execute the full 5-step bootstrap (Probe -> Install -> Adopt/Start -> Tunnel -> Verify) for
114
+ * host `hostId`. On `connected`, returns an open `tunnel` whose lifecycle the caller owns.
115
+ */
116
+ export declare function bootstrapHost(home: Home, hostId: string, deps?: HostBootstrapDeps, options?: {
117
+ signal?: AbortSignal | undefined;
118
+ preProbed?: RemoteHostProbe | undefined;
119
+ }): Promise<BootstrapHostResult>;
120
+ export {};