@tsplc/agent 0.2.16 → 0.2.18
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/README.md +2 -2
- package/dist/cli.js +936 -550
- package/dist/cli.js.map +20 -10
- package/dist/client.js +46 -20
- package/dist/client.js.map +4 -4
- package/dist/index.js +879 -538
- package/dist/index.js.map +18 -9
- package/package.json +50 -49
- package/src/agent.ts +175 -642
- package/src/cli.ts +95 -47
- package/src/client.ts +148 -112
- package/src/codesys.ts +117 -0
- package/src/debugging.ts +134 -0
- package/src/deploy.ts +193 -0
- package/src/discovery.ts +61 -53
- package/src/errors.ts +17 -0
- package/src/index.ts +30 -1
- package/src/login.ts +238 -0
- package/src/logs.ts +36 -26
- package/src/operations.ts +87 -0
- package/src/protocol.ts +108 -69
- package/src/releases.ts +89 -57
- package/src/secrets.ts +118 -0
- package/src/server-process.ts +98 -77
- package/src/state.ts +71 -0
- package/src/terminal.ts +57 -0
package/src/debugging.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
createDebugger,
|
|
5
|
+
createDebugHandler,
|
|
6
|
+
createLoginAdapter,
|
|
7
|
+
type Debugger,
|
|
8
|
+
loadManifest,
|
|
9
|
+
timelineEntries,
|
|
10
|
+
} from "@tsplc/debug";
|
|
11
|
+
import { errorMessage } from "./errors";
|
|
12
|
+
import { readJsonl } from "./logs";
|
|
13
|
+
import { type Audit, auditSchema, deploymentSchema } from "./protocol";
|
|
14
|
+
import { loadRelease } from "./releases";
|
|
15
|
+
import { releaseVariable } from "./secrets";
|
|
16
|
+
import type { AgentState } from "./state";
|
|
17
|
+
|
|
18
|
+
/** Log entries a new debugger starts its timeline with. */
|
|
19
|
+
const recentEntries = 500;
|
|
20
|
+
|
|
21
|
+
interface RunningDebugger {
|
|
22
|
+
debug: Debugger;
|
|
23
|
+
handle: ReturnType<typeof createDebugHandler>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The deployed release's debugger, when it has a debug manifest. It reads the controller
|
|
28
|
+
* through the agent's engineering login, and the server's telemetry and requests through the
|
|
29
|
+
* server's health origin.
|
|
30
|
+
*/
|
|
31
|
+
export const createDebugging = (context: {
|
|
32
|
+
state: AgentState;
|
|
33
|
+
readLogin: (expressions: string[]) => Promise<Record<string, string>>;
|
|
34
|
+
serverHealthUrl: string | undefined;
|
|
35
|
+
log: (message: string) => void;
|
|
36
|
+
}) => {
|
|
37
|
+
const { state, log } = context;
|
|
38
|
+
|
|
39
|
+
const start = async (): Promise<RunningDebugger | null> => {
|
|
40
|
+
const release = await state.release();
|
|
41
|
+
if (!release) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const { directory, manifest: releaseManifest } = await loadRelease(
|
|
45
|
+
state.paths.releases,
|
|
46
|
+
release.id,
|
|
47
|
+
);
|
|
48
|
+
const manifestFile = join(directory, "debug.json");
|
|
49
|
+
if (!existsSync(manifestFile)) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const manifest = await loadManifest(manifestFile);
|
|
53
|
+
const serverToken =
|
|
54
|
+
releaseManifest.serverTokenEnv &&
|
|
55
|
+
(await releaseVariable(releaseManifest, releaseManifest.serverTokenEnv));
|
|
56
|
+
const debug = await createDebugger({
|
|
57
|
+
manifest,
|
|
58
|
+
adapter: createLoginAdapter({
|
|
59
|
+
read: context.readLogin,
|
|
60
|
+
probe: manifest.build.target,
|
|
61
|
+
endpoint: "the agent's login",
|
|
62
|
+
}),
|
|
63
|
+
stateDirectory: state.paths.debug,
|
|
64
|
+
watch: releaseManifest.debug?.watch ?? {},
|
|
65
|
+
...(context.serverHealthUrl &&
|
|
66
|
+
serverToken && {
|
|
67
|
+
server: {
|
|
68
|
+
url: new URL(context.serverHealthUrl).origin,
|
|
69
|
+
token: serverToken,
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
release: {
|
|
73
|
+
id: release.id,
|
|
74
|
+
deployedAt: release.deployedAt,
|
|
75
|
+
operation: release.operation,
|
|
76
|
+
},
|
|
77
|
+
timeline: [
|
|
78
|
+
...(
|
|
79
|
+
await readJsonl(
|
|
80
|
+
state.paths.deployments,
|
|
81
|
+
deploymentSchema,
|
|
82
|
+
recentEntries,
|
|
83
|
+
)
|
|
84
|
+
).map(({ at, ...deployment }) =>
|
|
85
|
+
timelineEntries.deploy(at, deployment),
|
|
86
|
+
),
|
|
87
|
+
...(await readJsonl(state.paths.audit, auditSchema, recentEntries)).map(
|
|
88
|
+
({ at, ...audit }) => timelineEntries.audit(at, audit),
|
|
89
|
+
),
|
|
90
|
+
],
|
|
91
|
+
log,
|
|
92
|
+
});
|
|
93
|
+
return { debug, handle: createDebugHandler(debug, log) };
|
|
94
|
+
};
|
|
95
|
+
const startOrLog = () =>
|
|
96
|
+
start().catch((error: unknown) => {
|
|
97
|
+
log(`Starting the debugger failed: ${errorMessage(error)}`);
|
|
98
|
+
return null;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
let current = startOrLog();
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
/** Answers a request under `/debug`, at `route` within it. */
|
|
105
|
+
handle: async (request: Request, route: string) => {
|
|
106
|
+
const debugging = await current;
|
|
107
|
+
if (!debugging) {
|
|
108
|
+
return Response.json(
|
|
109
|
+
{
|
|
110
|
+
error:
|
|
111
|
+
"The deployed release has no debug manifest, or the debugger failed to start",
|
|
112
|
+
},
|
|
113
|
+
{ status: 503 },
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return debugging.handle(request, route);
|
|
117
|
+
},
|
|
118
|
+
/** Adds an audited command to the debugger's timeline. */
|
|
119
|
+
record: async ({ at, ...audit }: Audit) => {
|
|
120
|
+
(await current)?.debug.record(timelineEntries.audit(at, audit));
|
|
121
|
+
},
|
|
122
|
+
/** Replaces the debugger after the release changes. */
|
|
123
|
+
restart: () => {
|
|
124
|
+
current = current.then(async (debugging) => {
|
|
125
|
+
await debugging?.debug.close();
|
|
126
|
+
return startOrLog();
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
close: async () => {
|
|
130
|
+
await (await current)?.debug.close();
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export type Debugging = ReturnType<typeof createDebugging>;
|
package/src/deploy.ts
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
5
|
+
import {
|
|
6
|
+
findControllerLogin,
|
|
7
|
+
startWarmController,
|
|
8
|
+
updateWarmController,
|
|
9
|
+
} from "@tsplc/build";
|
|
10
|
+
import { loadManifest } from "@tsplc/debug";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import {
|
|
13
|
+
controllerConfig,
|
|
14
|
+
deployContainer,
|
|
15
|
+
ensureGateway,
|
|
16
|
+
loginContainer,
|
|
17
|
+
} from "./codesys";
|
|
18
|
+
import type { Debugging } from "./debugging";
|
|
19
|
+
import { AgentError, errorMessage } from "./errors";
|
|
20
|
+
import { appendJsonl } from "./logs";
|
|
21
|
+
import type { Operations } from "./operations";
|
|
22
|
+
import {
|
|
23
|
+
type AgentEvent,
|
|
24
|
+
type ClientIdentity,
|
|
25
|
+
type Deployment,
|
|
26
|
+
deployOptionsSchema,
|
|
27
|
+
type Release,
|
|
28
|
+
} from "./protocol";
|
|
29
|
+
import { loadRelease, readUpload, saveRelease } from "./releases";
|
|
30
|
+
import { controllerCredentials, readSecrets, withSecrets } from "./secrets";
|
|
31
|
+
import type { ServerSupervisor } from "./server-process";
|
|
32
|
+
import type { AgentState } from "./state";
|
|
33
|
+
|
|
34
|
+
/** Relays the newest controller job's progress log, which CODESYS appends to as it works. */
|
|
35
|
+
const followProgress = (
|
|
36
|
+
controller: string,
|
|
37
|
+
emit: (event: AgentEvent) => void,
|
|
38
|
+
) => {
|
|
39
|
+
const jobs = join(controller, ".codesys/controller/jobs");
|
|
40
|
+
const since = Date.now();
|
|
41
|
+
let following = true;
|
|
42
|
+
const done = (async () => {
|
|
43
|
+
let log: string | undefined;
|
|
44
|
+
let offset = 0;
|
|
45
|
+
while (following) {
|
|
46
|
+
await delay(2000);
|
|
47
|
+
if (!log && existsSync(jobs)) {
|
|
48
|
+
for (const job of await readdir(jobs)) {
|
|
49
|
+
const path = join(jobs, job, ".codesys/controller/progress.log");
|
|
50
|
+
if (existsSync(path) && (await stat(path)).mtimeMs >= since) {
|
|
51
|
+
log = path;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!log) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const text = await readFile(log, "utf8");
|
|
59
|
+
for (const line of text.slice(offset).split("\n").filter(Boolean)) {
|
|
60
|
+
emit({ kind: "progress", message: line.replace(/^\S+Z /, "") });
|
|
61
|
+
}
|
|
62
|
+
offset = text.length;
|
|
63
|
+
}
|
|
64
|
+
})();
|
|
65
|
+
return async () => {
|
|
66
|
+
following = false;
|
|
67
|
+
await done;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Deployments of uploaded releases: the release's server first, then a download or online
|
|
73
|
+
* change through the CODESYS that stays running between them.
|
|
74
|
+
*/
|
|
75
|
+
export const createDeployments = (context: {
|
|
76
|
+
state: AgentState;
|
|
77
|
+
operations: Operations;
|
|
78
|
+
server: ServerSupervisor;
|
|
79
|
+
debugging: Debugging;
|
|
80
|
+
log: (message: string) => void;
|
|
81
|
+
}) => {
|
|
82
|
+
const { state, server } = context;
|
|
83
|
+
|
|
84
|
+
/** CODESYS starts for the deployed release in the background, so the first deployment finds it running. */
|
|
85
|
+
const warming = (async () => {
|
|
86
|
+
const deployed = await state.release();
|
|
87
|
+
const target = await state.target();
|
|
88
|
+
if (!deployed || !target) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
await ensureGateway();
|
|
92
|
+
const release = await loadRelease(state.paths.releases, deployed.id);
|
|
93
|
+
await startWarmController(
|
|
94
|
+
controllerConfig(release, target, state.paths.controller),
|
|
95
|
+
deployContainer,
|
|
96
|
+
);
|
|
97
|
+
})().catch((error: unknown) => {
|
|
98
|
+
context.log(`Starting CODESYS failed: ${errorMessage(error)}`);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
deploy: async (form: FormData, client: ClientIdentity) => {
|
|
103
|
+
const settings = deployOptionsSchema.parse(
|
|
104
|
+
JSON.parse(z.string().parse(form.get("options"))),
|
|
105
|
+
);
|
|
106
|
+
const upload = await readUpload(form);
|
|
107
|
+
const target = await state.requireTarget();
|
|
108
|
+
if (await findControllerLogin(loginContainer)) {
|
|
109
|
+
throw new AgentError(
|
|
110
|
+
"A login is open; log out before deploying: tsplc logout",
|
|
111
|
+
409,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const credentials = await controllerCredentials(settings.credentials);
|
|
115
|
+
const secrets = await readSecrets(upload.manifest.secrets);
|
|
116
|
+
return context.operations.stream("a deployment", async (emit) => {
|
|
117
|
+
const release = await saveRelease(state.paths.releases, upload);
|
|
118
|
+
if (
|
|
119
|
+
!settings.download &&
|
|
120
|
+
!existsSync(
|
|
121
|
+
join(state.paths.controller, ".codesys/controller/current.json"),
|
|
122
|
+
)
|
|
123
|
+
) {
|
|
124
|
+
throw new AgentError(
|
|
125
|
+
"The controller has no application downloaded by this agent; only a full download can deploy",
|
|
126
|
+
409,
|
|
127
|
+
{ downloadRequired: true },
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
const config = await withSecrets(
|
|
131
|
+
controllerConfig(release, target, state.paths.controller),
|
|
132
|
+
secrets,
|
|
133
|
+
state.paths.sources,
|
|
134
|
+
);
|
|
135
|
+
const previous = await state.release();
|
|
136
|
+
// Server paths are relative to the releases directory.
|
|
137
|
+
const serverPath =
|
|
138
|
+
release.manifest.server && `${release.id}/${release.manifest.server}`;
|
|
139
|
+
if (serverPath) {
|
|
140
|
+
emit({ kind: "progress", message: "Starting the new server" });
|
|
141
|
+
await server.replace(join(state.paths.releases, serverPath));
|
|
142
|
+
}
|
|
143
|
+
const kind = settings.download ? "download" : "online-change";
|
|
144
|
+
emit({ kind: "progress", message: `Starting the ${kind}` });
|
|
145
|
+
await ensureGateway();
|
|
146
|
+
await warming;
|
|
147
|
+
const stopFollowing = followProgress(state.paths.controller, emit);
|
|
148
|
+
const receipt = await updateWarmController(
|
|
149
|
+
config,
|
|
150
|
+
deployContainer,
|
|
151
|
+
kind,
|
|
152
|
+
{ initializeUser: settings.initializeUser, credentials },
|
|
153
|
+
)
|
|
154
|
+
.catch(async (failure: unknown) => {
|
|
155
|
+
if (serverPath) {
|
|
156
|
+
emit({
|
|
157
|
+
kind: "progress",
|
|
158
|
+
message: "Restoring the previous server",
|
|
159
|
+
});
|
|
160
|
+
await (previous?.server
|
|
161
|
+
? server.replace(join(state.paths.releases, previous.server))
|
|
162
|
+
: server.stop());
|
|
163
|
+
}
|
|
164
|
+
throw failure;
|
|
165
|
+
})
|
|
166
|
+
.finally(stopFollowing);
|
|
167
|
+
const deployed: Release = {
|
|
168
|
+
id: release.id,
|
|
169
|
+
deployedAt: new Date().toISOString(),
|
|
170
|
+
operation: kind,
|
|
171
|
+
controllerIds: receipt.controllerIds,
|
|
172
|
+
// A release without a server leaves the previous one running.
|
|
173
|
+
server: serverPath ?? previous?.server,
|
|
174
|
+
};
|
|
175
|
+
await state.setRelease(deployed);
|
|
176
|
+
const debugManifest = join(release.directory, "debug.json");
|
|
177
|
+
const deployment: Deployment = {
|
|
178
|
+
at: deployed.deployedAt,
|
|
179
|
+
release: release.id,
|
|
180
|
+
...(existsSync(debugManifest) && {
|
|
181
|
+
build: (await loadManifest(debugManifest)).build.id,
|
|
182
|
+
}),
|
|
183
|
+
operation: kind,
|
|
184
|
+
credentials: settings.credentials ? "provided" : "stored",
|
|
185
|
+
...client,
|
|
186
|
+
};
|
|
187
|
+
await appendJsonl(state.paths.deployments, deployment);
|
|
188
|
+
context.debugging.restart();
|
|
189
|
+
return deployed;
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
};
|
package/src/discovery.ts
CHANGED
|
@@ -12,73 +12,81 @@ const probesAtOnce = 128;
|
|
|
12
12
|
|
|
13
13
|
/** The machine's IPv4 networks, which `discoverControllers` scans one at a time. */
|
|
14
14
|
export const networkInterfaces = (): NetworkInterface[] =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
Object.entries(osInterfaces()).flatMap(([name, addresses]) =>
|
|
16
|
+
(addresses ?? [])
|
|
17
|
+
.filter((address) => address.family === "IPv4" && !address.internal)
|
|
18
|
+
.map((address) => ({
|
|
19
|
+
name,
|
|
20
|
+
address: address.address,
|
|
21
|
+
prefixLength: address.netmask
|
|
22
|
+
.split(".")
|
|
23
|
+
.reduce(
|
|
24
|
+
(bits, octet) =>
|
|
25
|
+
bits + Number(octet).toString(2).replaceAll("0", "").length,
|
|
26
|
+
0,
|
|
27
|
+
),
|
|
28
|
+
})),
|
|
29
|
+
);
|
|
26
30
|
|
|
27
31
|
const toNumber = (address: string) =>
|
|
28
|
-
|
|
32
|
+
address.split(".").reduce((value, octet) => value * 256 + Number(octet), 0);
|
|
29
33
|
const toAddress = (value: number) =>
|
|
30
|
-
|
|
34
|
+
[24, 16, 8, 0].map((shift) => Math.floor(value / 2 ** shift) % 256).join(".");
|
|
31
35
|
|
|
32
36
|
/** Every host address on the interface's subnet, except the interface's own. */
|
|
33
37
|
export const subnetHosts = ({ address, prefixLength }: NetworkInterface) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
if (prefixLength < largestPrefix) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`The /${prefixLength} network is too large to scan; the limit is /${largestPrefix}.`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
const size = 2 ** (32 - prefixLength);
|
|
44
|
+
const network = toNumber(address) - (toNumber(address) % size);
|
|
45
|
+
// /31 and /32 networks have no network or broadcast address to skip.
|
|
46
|
+
const hosts =
|
|
47
|
+
size <= 2
|
|
48
|
+
? Array.from({ length: size }, (_, index) => network + index)
|
|
49
|
+
: Array.from({ length: size - 2 }, (_, index) => network + index + 1);
|
|
50
|
+
return hosts.map(toAddress).filter((host) => host !== address);
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
const accepts = (host: string, port: number) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
new Promise<boolean>((resolve) => {
|
|
55
|
+
const socket = createConnection({ host, port });
|
|
56
|
+
// A silent host leaves the connection pending for the OS's own timeout, which is minutes.
|
|
57
|
+
const timer = setTimeout(() => finish(false), probeTimeoutMs);
|
|
58
|
+
const finish = (open: boolean) => {
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
socket.destroy();
|
|
61
|
+
resolve(open);
|
|
62
|
+
};
|
|
63
|
+
socket.once("connect", () => finish(true));
|
|
64
|
+
socket.once("error", () => finish(false));
|
|
65
|
+
});
|
|
61
66
|
|
|
62
67
|
const resolver = new Resolver({ timeout: 1000, tries: 1 });
|
|
63
68
|
const hostname = (address: string) =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
resolver.reverse(address).then(
|
|
70
|
+
(names) => names[0] ?? null,
|
|
71
|
+
// Plant networks rarely have reverse DNS; the address alone identifies the controller.
|
|
72
|
+
() => null,
|
|
73
|
+
);
|
|
69
74
|
|
|
70
75
|
/** Finds the hosts on `network` that accept CODESYS runtime connections. */
|
|
71
76
|
export const discoverControllers = async (
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
network: NetworkInterface,
|
|
78
|
+
port = runtimePort,
|
|
74
79
|
): Promise<DiscoveredController[]> => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
const hosts = subnetHosts(network);
|
|
81
|
+
const found: DiscoveredController[] = [];
|
|
82
|
+
for (let start = 0; start < hosts.length; start += probesAtOnce) {
|
|
83
|
+
const batch = hosts.slice(start, start + probesAtOnce);
|
|
84
|
+
const open = await Promise.all(batch.map((host) => accepts(host, port)));
|
|
85
|
+
for (const [index, host] of batch.entries()) {
|
|
86
|
+
if (open[index]) {
|
|
87
|
+
found.push({ address: host, port, hostname: await hostname(host) });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return found;
|
|
84
92
|
};
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A request the agent refuses, answered with `status` and the message. */
|
|
2
|
+
export class AgentError extends Error {
|
|
3
|
+
/** The controller has no application from this agent yet, so only a full download can deploy. */
|
|
4
|
+
readonly downloadRequired: boolean;
|
|
5
|
+
|
|
6
|
+
constructor(
|
|
7
|
+
message: string,
|
|
8
|
+
readonly status: number,
|
|
9
|
+
{ downloadRequired = false }: { downloadRequired?: boolean } = {},
|
|
10
|
+
) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.downloadRequired = downloadRequired;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const errorMessage = (error: unknown) =>
|
|
17
|
+
error instanceof Error ? error.message : String(error);
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
1
|
export { type AgentOptions, createAgent } from "./agent.ts";
|
|
2
|
-
export
|
|
2
|
+
export { ask, askCredentials, askSecret } from "./terminal.ts";
|
|
3
|
+
export {
|
|
4
|
+
type AgentEvent,
|
|
5
|
+
type AgentStatus,
|
|
6
|
+
type Audit,
|
|
7
|
+
auditSchema,
|
|
8
|
+
clientHeaders,
|
|
9
|
+
controllerSchema,
|
|
10
|
+
type Credentials,
|
|
11
|
+
credentialsSchema,
|
|
12
|
+
type Deployment,
|
|
13
|
+
deploymentSchema,
|
|
14
|
+
type DeployOptions,
|
|
15
|
+
deployOptionsSchema,
|
|
16
|
+
type DiscoveredController,
|
|
17
|
+
eventSchema,
|
|
18
|
+
logoutSchema,
|
|
19
|
+
type NetworkInterface,
|
|
20
|
+
networkInterfaceSchema,
|
|
21
|
+
type Release,
|
|
22
|
+
type ReleaseManifest,
|
|
23
|
+
releaseManifestSchema,
|
|
24
|
+
releaseSchema,
|
|
25
|
+
statusSchema,
|
|
26
|
+
type Target,
|
|
27
|
+
targetSchema,
|
|
28
|
+
uploadEncoding,
|
|
29
|
+
type Variable,
|
|
30
|
+
variableSchema,
|
|
31
|
+
} from "./protocol.ts";
|