@hearsay-tools/squawk 0.19.0-dev.9102 → 0.19.0-dev.9112
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/contract/hosts.d.ts +47 -5
- package/dist/contract/index.js +19 -1
- package/dist/delegation/routes.d.ts +78 -78
- package/dist/features/hosts/bootstrap.d.ts +120 -0
- package/dist/features/hosts/bootstrap.js +469 -0
- package/dist/features/hosts/bootstrap.js.map +1 -0
- package/dist/features/hosts/cli.d.ts +13 -3
- package/dist/features/hosts/cli.js +199 -27
- package/dist/features/hosts/cli.js.map +1 -1
- package/dist/features/hosts/host-actions.d.ts +56 -0
- package/dist/features/hosts/host-actions.js +367 -0
- package/dist/features/hosts/host-actions.js.map +1 -0
- package/dist/features/hosts/host-server-cli.js +21 -3
- package/dist/features/hosts/host-server-cli.js.map +1 -1
- package/dist/features/hosts/host-server.d.ts +10 -1
- package/dist/features/hosts/host-server.js +74 -0
- package/dist/features/hosts/host-server.js.map +1 -1
- package/dist/features/hosts/index.d.ts +4 -2
- package/dist/features/hosts/index.js +14 -2
- package/dist/features/hosts/index.js.map +1 -1
- package/dist/features/hosts/registry.d.ts +28 -0
- package/dist/features/hosts/registry.js +42 -1
- package/dist/features/hosts/registry.js.map +1 -1
- package/dist/features/hosts/routes.d.ts +5 -3
- package/dist/features/hosts/routes.js +14 -7
- package/dist/features/hosts/routes.js.map +1 -1
- package/dist/features/hosts/ssh.d.ts +85 -0
- package/dist/features/hosts/ssh.js +271 -0
- package/dist/features/hosts/ssh.js.map +1 -0
- package/dist/features/hosts/supervisor.d.ts +191 -0
- package/dist/features/hosts/supervisor.js +620 -0
- package/dist/features/hosts/supervisor.js.map +1 -0
- package/dist/features/hosts/tunnel.d.ts +46 -0
- package/dist/features/hosts/tunnel.js +244 -0
- package/dist/features/hosts/tunnel.js.map +1 -0
- package/dist/features/reports/routes.d.ts +2 -2
- package/dist/features/webhooks/routes.d.ts +13 -13
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/providers-routes.d.ts +58 -58
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/workspace-live-routes.d.ts +5 -5
- package/dist/server/workspace-routes.d.ts +85 -85
- package/package.json +4 -4
package/dist/contract/hosts.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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>;
|
package/dist/contract/index.js
CHANGED
|
@@ -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 = [
|
|
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,
|
|
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
-
output: {
|
|
31
|
-
error: string;
|
|
32
|
-
code?: "invalid_input" | undefined;
|
|
33
|
-
};
|
|
34
|
-
outputFormat: "json";
|
|
35
|
-
status: 400;
|
|
36
|
-
input: {
|
|
37
|
-
query: {
|
|
38
|
-
offset?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
30
|
output: {
|
|
43
31
|
workers: {
|
|
44
32
|
workerId: string;
|
|
@@ -91,6 +79,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
91
79
|
offset?: string | undefined;
|
|
92
80
|
};
|
|
93
81
|
};
|
|
82
|
+
} | {
|
|
83
|
+
output: {
|
|
84
|
+
error: string;
|
|
85
|
+
code?: "invalid_input" | undefined;
|
|
86
|
+
};
|
|
87
|
+
outputFormat: "json";
|
|
88
|
+
status: 400;
|
|
89
|
+
input: {
|
|
90
|
+
query: {
|
|
91
|
+
offset?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
} & {
|
|
@@ -677,18 +677,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
677
677
|
} & {
|
|
678
678
|
"/:workerId": {
|
|
679
679
|
$get: {
|
|
680
|
-
output: {
|
|
681
|
-
error: string;
|
|
682
|
-
code?: "invalid_input" | undefined;
|
|
683
|
-
};
|
|
684
|
-
outputFormat: "json";
|
|
685
|
-
status: 400;
|
|
686
|
-
input: {
|
|
687
|
-
param: {
|
|
688
|
-
workerId: string;
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
} | {
|
|
692
680
|
output: {
|
|
693
681
|
workerId: string;
|
|
694
682
|
settled: boolean;
|
|
@@ -813,11 +801,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
813
801
|
workerId: string;
|
|
814
802
|
};
|
|
815
803
|
};
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
} & {
|
|
819
|
-
"/:workerId/collect": {
|
|
820
|
-
$post: {
|
|
804
|
+
} | {
|
|
821
805
|
output: {
|
|
822
806
|
error: string;
|
|
823
807
|
code?: "invalid_input" | undefined;
|
|
@@ -828,10 +812,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
828
812
|
param: {
|
|
829
813
|
workerId: string;
|
|
830
814
|
};
|
|
831
|
-
} & {
|
|
832
|
-
json: Record<string, never>;
|
|
833
815
|
};
|
|
834
|
-
}
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
} & {
|
|
819
|
+
"/:workerId/collect": {
|
|
820
|
+
$post: {
|
|
835
821
|
output: {
|
|
836
822
|
workerId: string;
|
|
837
823
|
parentRunId: string;
|
|
@@ -956,11 +942,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
956
942
|
} & {
|
|
957
943
|
json: Record<string, never>;
|
|
958
944
|
};
|
|
959
|
-
}
|
|
960
|
-
};
|
|
961
|
-
} & {
|
|
962
|
-
"/:workerId/steer": {
|
|
963
|
-
$post: {
|
|
945
|
+
} | {
|
|
964
946
|
output: {
|
|
965
947
|
error: string;
|
|
966
948
|
code?: "invalid_input" | undefined;
|
|
@@ -972,11 +954,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
972
954
|
workerId: string;
|
|
973
955
|
};
|
|
974
956
|
} & {
|
|
975
|
-
json:
|
|
976
|
-
text: string;
|
|
977
|
-
};
|
|
957
|
+
json: Record<string, never>;
|
|
978
958
|
};
|
|
979
|
-
}
|
|
959
|
+
};
|
|
960
|
+
};
|
|
961
|
+
} & {
|
|
962
|
+
"/:workerId/steer": {
|
|
963
|
+
$post: {
|
|
980
964
|
output: {
|
|
981
965
|
workerId: string;
|
|
982
966
|
state: "delivered" | "queued";
|
|
@@ -992,11 +976,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
992
976
|
text: string;
|
|
993
977
|
};
|
|
994
978
|
};
|
|
995
|
-
}
|
|
996
|
-
};
|
|
997
|
-
} & {
|
|
998
|
-
"/:workerId/stop": {
|
|
999
|
-
$post: {
|
|
979
|
+
} | {
|
|
1000
980
|
output: {
|
|
1001
981
|
error: string;
|
|
1002
982
|
code?: "invalid_input" | undefined;
|
|
@@ -1008,9 +988,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1008
988
|
workerId: string;
|
|
1009
989
|
};
|
|
1010
990
|
} & {
|
|
1011
|
-
json:
|
|
991
|
+
json: {
|
|
992
|
+
text: string;
|
|
993
|
+
};
|
|
1012
994
|
};
|
|
1013
|
-
}
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
} & {
|
|
998
|
+
"/:workerId/stop": {
|
|
999
|
+
$post: {
|
|
1014
1000
|
output: {
|
|
1015
1001
|
workerId: string;
|
|
1016
1002
|
state: "stopping" | "terminated";
|
|
@@ -1024,11 +1010,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1024
1010
|
} & {
|
|
1025
1011
|
json: Record<string, never>;
|
|
1026
1012
|
};
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
} & {
|
|
1030
|
-
"/:workerId/destroy": {
|
|
1031
|
-
$post: {
|
|
1013
|
+
} | {
|
|
1032
1014
|
output: {
|
|
1033
1015
|
error: string;
|
|
1034
1016
|
code?: "invalid_input" | undefined;
|
|
@@ -1040,11 +1022,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1040
1022
|
workerId: string;
|
|
1041
1023
|
};
|
|
1042
1024
|
} & {
|
|
1043
|
-
json:
|
|
1044
|
-
discardWork?: true | undefined;
|
|
1045
|
-
};
|
|
1025
|
+
json: Record<string, never>;
|
|
1046
1026
|
};
|
|
1047
|
-
}
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
1029
|
+
} & {
|
|
1030
|
+
"/:workerId/destroy": {
|
|
1031
|
+
$post: {
|
|
1048
1032
|
output: {
|
|
1049
1033
|
workerId: string;
|
|
1050
1034
|
state: "complete" | "incomplete";
|
|
@@ -1073,6 +1057,22 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1073
1057
|
discardWork?: true | undefined;
|
|
1074
1058
|
};
|
|
1075
1059
|
};
|
|
1060
|
+
} | {
|
|
1061
|
+
output: {
|
|
1062
|
+
error: string;
|
|
1063
|
+
code?: "invalid_input" | undefined;
|
|
1064
|
+
};
|
|
1065
|
+
outputFormat: "json";
|
|
1066
|
+
status: 400;
|
|
1067
|
+
input: {
|
|
1068
|
+
param: {
|
|
1069
|
+
workerId: string;
|
|
1070
|
+
};
|
|
1071
|
+
} & {
|
|
1072
|
+
json: {
|
|
1073
|
+
discardWork?: true | undefined;
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1076
1076
|
} | {
|
|
1077
1077
|
output: {
|
|
1078
1078
|
workerId: string;
|
|
@@ -1108,11 +1108,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1108
1108
|
"/:workerId/summary": {
|
|
1109
1109
|
$post: {
|
|
1110
1110
|
output: {
|
|
1111
|
-
|
|
1112
|
-
|
|
1111
|
+
workerId: string;
|
|
1112
|
+
revision: number;
|
|
1113
|
+
source: "assistant" | "failure";
|
|
1114
|
+
seq: number;
|
|
1115
|
+
totalLines: number;
|
|
1116
|
+
offset: number;
|
|
1117
|
+
lineCount: number;
|
|
1118
|
+
text: string;
|
|
1119
|
+
nextOffset?: number | undefined;
|
|
1113
1120
|
};
|
|
1114
1121
|
outputFormat: "json";
|
|
1115
|
-
status:
|
|
1122
|
+
status: 200;
|
|
1116
1123
|
input: {
|
|
1117
1124
|
param: {
|
|
1118
1125
|
workerId: string;
|
|
@@ -1125,18 +1132,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1125
1132
|
};
|
|
1126
1133
|
} | {
|
|
1127
1134
|
output: {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
source: "assistant" | "failure";
|
|
1131
|
-
seq: number;
|
|
1132
|
-
totalLines: number;
|
|
1133
|
-
offset: number;
|
|
1134
|
-
lineCount: number;
|
|
1135
|
-
text: string;
|
|
1136
|
-
nextOffset?: number | undefined;
|
|
1135
|
+
error: string;
|
|
1136
|
+
code?: "invalid_input" | undefined;
|
|
1137
1137
|
};
|
|
1138
1138
|
outputFormat: "json";
|
|
1139
|
-
status:
|
|
1139
|
+
status: 400;
|
|
1140
1140
|
input: {
|
|
1141
1141
|
param: {
|
|
1142
1142
|
workerId: string;
|
|
@@ -1153,11 +1153,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1153
1153
|
"/:workerId/diff": {
|
|
1154
1154
|
$get: {
|
|
1155
1155
|
output: {
|
|
1156
|
-
|
|
1157
|
-
|
|
1156
|
+
workerId: string;
|
|
1157
|
+
baselineSha: string;
|
|
1158
|
+
diff: string;
|
|
1159
|
+
truncated: boolean;
|
|
1158
1160
|
};
|
|
1159
1161
|
outputFormat: "json";
|
|
1160
|
-
status:
|
|
1162
|
+
status: 200;
|
|
1161
1163
|
input: {
|
|
1162
1164
|
param: {
|
|
1163
1165
|
workerId: string;
|
|
@@ -1165,13 +1167,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1165
1167
|
};
|
|
1166
1168
|
} | {
|
|
1167
1169
|
output: {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
diff: string;
|
|
1171
|
-
truncated: boolean;
|
|
1170
|
+
error: string;
|
|
1171
|
+
code?: "invalid_input" | undefined;
|
|
1172
1172
|
};
|
|
1173
1173
|
outputFormat: "json";
|
|
1174
|
-
status:
|
|
1174
|
+
status: 400;
|
|
1175
1175
|
input: {
|
|
1176
1176
|
param: {
|
|
1177
1177
|
workerId: string;
|
|
@@ -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 {};
|