@tsplc/agent 0.2.17 → 0.2.19
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/dist/client.js
CHANGED
|
@@ -5,10 +5,11 @@ import { z as z2 } from "zod";
|
|
|
5
5
|
|
|
6
6
|
// packages/agent/src/protocol.ts
|
|
7
7
|
import { tsplcConfigSchema } from "@tsplc/config";
|
|
8
|
+
import { tcpPort } from "@tsplc/config/build";
|
|
8
9
|
import { z } from "zod";
|
|
9
10
|
var targetSchema = z.strictObject({
|
|
10
11
|
host: z.string().nonempty(),
|
|
11
|
-
port:
|
|
12
|
+
port: tcpPort
|
|
12
13
|
});
|
|
13
14
|
var networkInterfaceSchema = z.strictObject({
|
|
14
15
|
name: z.string(),
|
|
@@ -20,24 +21,29 @@ var controllerSchema = z.strictObject({
|
|
|
20
21
|
port: z.number().int(),
|
|
21
22
|
hostname: z.string().nullable()
|
|
22
23
|
});
|
|
24
|
+
var discoverSchema = z.strictObject({ name: z.string() });
|
|
23
25
|
var credentialsSchema = z.strictObject({
|
|
24
26
|
username: z.string().nonempty(),
|
|
25
27
|
password: z.string().nonempty()
|
|
26
28
|
});
|
|
27
|
-
var variableSchema = z.strictObject({
|
|
29
|
+
var variableSchema = z.strictObject({
|
|
30
|
+
path: z.string(),
|
|
31
|
+
type: z.string()
|
|
32
|
+
});
|
|
28
33
|
var releaseManifestSchema = z.strictObject({
|
|
29
34
|
config: z.record(z.string(), z.unknown()),
|
|
30
35
|
variables: z.array(variableSchema),
|
|
31
36
|
server: z.string().nonempty().optional(),
|
|
32
37
|
debug: tsplcConfigSchema.shape.debug,
|
|
33
|
-
serverTokenEnv: z.string().nonempty().optional()
|
|
38
|
+
serverTokenEnv: z.string().nonempty().optional(),
|
|
39
|
+
secrets: tsplcConfigSchema.shape.secrets
|
|
34
40
|
});
|
|
35
41
|
var uploadEncoding = "gzip";
|
|
36
42
|
var deployOptionsSchema = z.strictObject({
|
|
37
|
-
credentials: credentialsSchema,
|
|
43
|
+
credentials: credentialsSchema.nullable(),
|
|
38
44
|
download: z.boolean(),
|
|
39
45
|
initializeUser: z.boolean()
|
|
40
|
-
});
|
|
46
|
+
}).refine((options) => options.credentials || !options.initializeUser, "Initializing the controller's user needs the user's credentials.");
|
|
41
47
|
var eventSchema = z.discriminatedUnion("kind", [
|
|
42
48
|
z.strictObject({ kind: z.literal("progress"), message: z.string() }),
|
|
43
49
|
z.strictObject({ kind: z.literal("done"), result: z.unknown() }),
|
|
@@ -47,10 +53,12 @@ var eventSchema = z.discriminatedUnion("kind", [
|
|
|
47
53
|
downloadRequired: z.boolean()
|
|
48
54
|
})
|
|
49
55
|
]);
|
|
56
|
+
var errorSchema = z.object({ error: z.string() });
|
|
57
|
+
var deployOperationSchema = z.enum(["download", "online-change"]);
|
|
50
58
|
var releaseSchema = z.strictObject({
|
|
51
59
|
id: z.string(),
|
|
52
60
|
deployedAt: z.iso.datetime(),
|
|
53
|
-
operation:
|
|
61
|
+
operation: deployOperationSchema,
|
|
54
62
|
controllerIds: z.strictObject({ codeId: z.string(), dataId: z.string() }),
|
|
55
63
|
server: z.string().optional()
|
|
56
64
|
});
|
|
@@ -61,15 +69,20 @@ var statusSchema = z.strictObject({
|
|
|
61
69
|
login: z.union([
|
|
62
70
|
z.strictObject({ state: z.string(), forced: z.array(z.string()) }),
|
|
63
71
|
z.strictObject({ error: z.string() })
|
|
64
|
-
]).nullable()
|
|
72
|
+
]).nullable(),
|
|
73
|
+
credentialsStored: z.boolean()
|
|
65
74
|
});
|
|
66
75
|
var logoutSchema = z.strictObject({ failure: z.string().optional() });
|
|
67
|
-
var clientHeaders = {
|
|
76
|
+
var clientHeaders = {
|
|
77
|
+
user: "x-tsplc-user",
|
|
78
|
+
host: "x-tsplc-host"
|
|
79
|
+
};
|
|
68
80
|
var deploymentSchema = z.strictObject({
|
|
69
81
|
at: z.iso.datetime(),
|
|
70
82
|
release: z.string(),
|
|
71
83
|
build: z.string().optional(),
|
|
72
|
-
operation:
|
|
84
|
+
operation: deployOperationSchema,
|
|
85
|
+
credentials: z.enum(["provided", "stored"]).optional(),
|
|
73
86
|
user: z.string().optional(),
|
|
74
87
|
host: z.string().optional()
|
|
75
88
|
});
|
|
@@ -93,17 +106,26 @@ class AgentOperationError extends Error {
|
|
|
93
106
|
}
|
|
94
107
|
}
|
|
95
108
|
var createAgentClient = (options) => {
|
|
96
|
-
const identity = {
|
|
109
|
+
const identity = {
|
|
110
|
+
[clientHeaders.user]: userInfo().username,
|
|
111
|
+
[clientHeaders.host]: hostname()
|
|
112
|
+
};
|
|
97
113
|
const call = async (path, init = {}) => {
|
|
98
114
|
const response = await fetch(new URL(path, options.url), {
|
|
99
115
|
...init,
|
|
100
|
-
headers: {
|
|
116
|
+
headers: {
|
|
117
|
+
...init.headers,
|
|
118
|
+
...identity,
|
|
119
|
+
Authorization: `Bearer ${options.token}`
|
|
120
|
+
}
|
|
101
121
|
}).catch((cause) => {
|
|
102
|
-
throw new Error(`Cannot reach the plant agent at ${options.url}`, {
|
|
122
|
+
throw new Error(`Cannot reach the plant agent at ${options.url}`, {
|
|
123
|
+
cause
|
|
124
|
+
});
|
|
103
125
|
});
|
|
104
126
|
if (!response.ok) {
|
|
105
127
|
const body = await response.json().catch(() => ({}));
|
|
106
|
-
throw new AgentOperationError(
|
|
128
|
+
throw new AgentOperationError(errorSchema.safeParse(body).data?.error ?? `The agent answered ${response.status}`);
|
|
107
129
|
}
|
|
108
130
|
return response;
|
|
109
131
|
};
|
|
@@ -115,25 +137,28 @@ var createAgentClient = (options) => {
|
|
|
115
137
|
})).json());
|
|
116
138
|
const operation = async (response, onProgress) => {
|
|
117
139
|
const reader = response.body?.pipeThrough(new TextDecoderStream).getReader();
|
|
118
|
-
if (!reader)
|
|
140
|
+
if (!reader) {
|
|
119
141
|
throw new Error("The agent returned no operation stream");
|
|
142
|
+
}
|
|
120
143
|
let buffered = "";
|
|
121
144
|
while (true) {
|
|
122
145
|
const { done, value } = await reader.read();
|
|
123
|
-
if (done)
|
|
146
|
+
if (done) {
|
|
124
147
|
throw new Error("The agent closed the operation without a result");
|
|
148
|
+
}
|
|
125
149
|
buffered += value;
|
|
126
150
|
const lines = buffered.split(`
|
|
127
151
|
`);
|
|
128
152
|
buffered = lines.pop() ?? "";
|
|
129
153
|
for (const line of lines.filter(Boolean)) {
|
|
130
154
|
const event = eventSchema.parse(JSON.parse(line));
|
|
131
|
-
if (event.kind === "progress")
|
|
155
|
+
if (event.kind === "progress") {
|
|
132
156
|
onProgress(event.message);
|
|
133
|
-
else if (event.kind === "done")
|
|
157
|
+
} else if (event.kind === "done") {
|
|
134
158
|
return event.result;
|
|
135
|
-
else
|
|
159
|
+
} else {
|
|
136
160
|
throw new AgentOperationError(event.message, event.downloadRequired);
|
|
161
|
+
}
|
|
137
162
|
}
|
|
138
163
|
}
|
|
139
164
|
};
|
|
@@ -148,8 +173,9 @@ var createAgentClient = (options) => {
|
|
|
148
173
|
form.set("manifest", JSON.stringify(release.manifest));
|
|
149
174
|
form.set("options", JSON.stringify(settings));
|
|
150
175
|
form.set("encoding", uploadEncoding);
|
|
151
|
-
for (const file of release.files)
|
|
176
|
+
for (const file of release.files) {
|
|
152
177
|
form.set(`files/${file.path}`, new Blob([Bun.gzipSync(await file.content.bytes())]), file.path);
|
|
178
|
+
}
|
|
153
179
|
return releaseSchema.parse(await operation(await call("/deploy", { method: "POST", body: form }), onProgress));
|
|
154
180
|
},
|
|
155
181
|
login: async (credentials, onProgress) => loginResultSchema.parse(await operation(await call("/login", {
|
|
@@ -166,5 +192,5 @@ export {
|
|
|
166
192
|
createAgentClient
|
|
167
193
|
};
|
|
168
194
|
|
|
169
|
-
//# debugId=
|
|
195
|
+
//# debugId=11DCE7C9C8CEE3FB64756E2164756E21
|
|
170
196
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/client.ts", "../src/protocol.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { hostname, userInfo } from \"node:os\";\nimport { type LoginCommand, loginResultSchema } from \"@tsplc/build\";\nimport { z } from \"zod\";\nimport {\n
|
|
6
|
-
"import { tsplcConfigSchema } from \"@tsplc/config\";\nimport { z } from \"zod\";\n\n/** The controller the agent deploys to, as its runtime's TCP block driver address. */\nexport const targetSchema = z.strictObject({\n
|
|
5
|
+
"import { hostname, userInfo } from \"node:os\";\nimport { type LoginCommand, loginResultSchema } from \"@tsplc/build\";\nimport { z } from \"zod\";\nimport {\n\tclientHeaders,\n\tcontrollerSchema,\n\ttype Credentials,\n\ttype DeployOptions,\n\terrorSchema,\n\teventSchema,\n\tlogoutSchema,\n\tnetworkInterfaceSchema,\n\ttype ReleaseManifest,\n\treleaseSchema,\n\tstatusSchema,\n\tuploadEncoding,\n\ttype Target,\n\ttargetSchema,\n\tvariableSchema,\n} from \"./protocol\";\n\n/** A failed agent operation; `downloadRequired` means only a full download can deploy. */\nexport class AgentOperationError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly downloadRequired = false,\n\t) {\n\t\tsuper(message);\n\t}\n}\n\n/** A file to upload, at its path in the release. */\nexport interface ReleaseFile {\n\tpath: string;\n\tcontent: Blob;\n}\n\n/** Talks to a plant agent at `url`, such as its Tailscale name and port. */\nexport const createAgentClient = (options: { url: string; token: string }) => {\n\t// The agent records who deployed and who changed the controller.\n\tconst identity = {\n\t\t[clientHeaders.user]: userInfo().username,\n\t\t[clientHeaders.host]: hostname(),\n\t};\n\tconst call = async (path: string, init: RequestInit = {}) => {\n\t\tconst response = await fetch(new URL(path, options.url), {\n\t\t\t...init,\n\t\t\theaders: {\n\t\t\t\t...init.headers,\n\t\t\t\t...identity,\n\t\t\t\tAuthorization: `Bearer ${options.token}`,\n\t\t\t},\n\t\t}).catch((cause: unknown) => {\n\t\t\tthrow new Error(`Cannot reach the plant agent at ${options.url}`, {\n\t\t\t\tcause,\n\t\t\t});\n\t\t});\n\t\tif (!response.ok) {\n\t\t\tconst body = await response.json().catch(() => ({}));\n\t\t\tthrow new AgentOperationError(\n\t\t\t\terrorSchema.safeParse(body).data?.error ??\n\t\t\t\t\t`The agent answered ${response.status}`,\n\t\t\t);\n\t\t}\n\t\treturn response;\n\t};\n\tconst get = async <T>(path: string, schema: z.ZodType<T>) =>\n\t\tschema.parse(await (await call(path)).json());\n\tconst send = async <T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\tbody: unknown,\n\t\tschema: z.ZodType<T>,\n\t) =>\n\t\tschema.parse(\n\t\t\tawait (\n\t\t\t\tawait call(path, {\n\t\t\t\t\tmethod,\n\t\t\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\t\t\tbody: JSON.stringify(body),\n\t\t\t\t})\n\t\t\t).json(),\n\t\t);\n\n\t/** Reads a streamed operation, reporting progress, until its result or failure. */\n\tconst operation = async (\n\t\tresponse: Response,\n\t\tonProgress: (message: string) => void,\n\t) => {\n\t\tconst reader = response.body\n\t\t\t?.pipeThrough(new TextDecoderStream())\n\t\t\t.getReader();\n\t\tif (!reader) {\n\t\t\tthrow new Error(\"The agent returned no operation stream\");\n\t\t}\n\t\tlet buffered = \"\";\n\t\twhile (true) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) {\n\t\t\t\tthrow new Error(\"The agent closed the operation without a result\");\n\t\t\t}\n\t\t\tbuffered += value;\n\t\t\tconst lines = buffered.split(\"\\n\");\n\t\t\tbuffered = lines.pop() ?? \"\";\n\t\t\tfor (const line of lines.filter(Boolean)) {\n\t\t\t\tconst event = eventSchema.parse(JSON.parse(line));\n\t\t\t\tif (event.kind === \"progress\") {\n\t\t\t\t\tonProgress(event.message);\n\t\t\t\t} else if (event.kind === \"done\") {\n\t\t\t\t\treturn event.result;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new AgentOperationError(event.message, event.downloadRequired);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\treturn {\n\t\tstatus: () => get(\"/status\", statusSchema),\n\t\tinterfaces: () => get(\"/interfaces\", z.array(networkInterfaceSchema)),\n\t\tdiscover: (name: string) =>\n\t\t\tsend(\"POST\", \"/discover\", { name }, z.array(controllerSchema)),\n\t\tsetTarget: (target: Target) => send(\"PUT\", \"/target\", target, targetSchema),\n\t\tvariables: () => get(\"/variables\", z.array(variableSchema)),\n\t\tdeploy: async (\n\t\t\trelease: { manifest: ReleaseManifest; files: ReleaseFile[] },\n\t\t\tsettings: DeployOptions,\n\t\t\tonProgress: (message: string) => void,\n\t\t) => {\n\t\t\tconst form = new FormData();\n\t\t\tform.set(\"manifest\", JSON.stringify(release.manifest));\n\t\t\tform.set(\"options\", JSON.stringify(settings));\n\t\t\t// Plants are often reached through a slow relay, and ST and scripts compress several times over.\n\t\t\tform.set(\"encoding\", uploadEncoding);\n\t\t\tfor (const file of release.files) {\n\t\t\t\tform.set(\n\t\t\t\t\t`files/${file.path}`,\n\t\t\t\t\tnew Blob([Bun.gzipSync(await file.content.bytes())]),\n\t\t\t\t\tfile.path,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn releaseSchema.parse(\n\t\t\t\tawait operation(\n\t\t\t\t\tawait call(\"/deploy\", { method: \"POST\", body: form }),\n\t\t\t\t\tonProgress,\n\t\t\t\t),\n\t\t\t);\n\t\t},\n\t\tlogin: async (\n\t\t\tcredentials: Credentials | null,\n\t\t\tonProgress: (message: string) => void,\n\t\t) =>\n\t\t\tloginResultSchema.parse(\n\t\t\t\tawait operation(\n\t\t\t\t\tawait call(\"/login\", {\n\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\t\t\t\tbody: JSON.stringify(credentials),\n\t\t\t\t\t}),\n\t\t\t\t\tonProgress,\n\t\t\t\t),\n\t\t\t),\n\t\tcommand: (command: LoginCommand) =>\n\t\t\tsend(\"POST\", \"/login/command\", command, loginResultSchema),\n\t\tlogout: () => send(\"DELETE\", \"/login\", undefined, logoutSchema),\n\t};\n};\nexport type AgentClient = ReturnType<typeof createAgentClient>;\n",
|
|
6
|
+
"import { tsplcConfigSchema } from \"@tsplc/config\";\nimport { tcpPort } from \"@tsplc/config/build\";\nimport { z } from \"zod\";\n\n/** The controller the agent deploys to, as its runtime's TCP block driver address. */\nexport const targetSchema = z.strictObject({\n\thost: z.string().nonempty(),\n\tport: tcpPort,\n});\nexport type Target = z.infer<typeof targetSchema>;\n\nexport const networkInterfaceSchema = z.strictObject({\n\tname: z.string(),\n\taddress: z.ipv4(),\n\tprefixLength: z.number().int().min(0).max(32),\n});\nexport type NetworkInterface = z.infer<typeof networkInterfaceSchema>;\n\n/** A host on the scanned subnet that accepts connections on the CODESYS runtime port. */\nexport const controllerSchema = z.strictObject({\n\taddress: z.ipv4(),\n\tport: z.number().int(),\n\thostname: z.string().nullable(),\n});\nexport type DiscoveredController = z.infer<typeof controllerSchema>;\n\n/** `POST /discover`: the network interface to scan for controllers. */\nexport const discoverSchema = z.strictObject({ name: z.string() });\n\n/**\n * The controller's user, which the agent passes to CODESYS for one operation. A request sends\n * null instead to use the one stored on the agent's PC.\n */\nexport const credentialsSchema = z.strictObject({\n\tusername: z.string().nonempty(),\n\tpassword: z.string().nonempty(),\n});\nexport type Credentials = z.infer<typeof credentialsSchema>;\n\n/** A published leaf of the deployed program, as CODESYS expressions name it. */\nexport const variableSchema = z.strictObject({\n\tpath: z.string(),\n\ttype: z.string(),\n});\nexport type Variable = z.infer<typeof variableSchema>;\n\n/**\n * What `tsplc deploy` uploads beside its files. `config` is the build config with paths\n * relative to the release: `st/`, `template.project` and `libraries/`.\n */\nexport const releaseManifestSchema = z.strictObject({\n\tconfig: z.record(z.string(), z.unknown()),\n\tvariables: z.array(variableSchema),\n\t/** The server executable's path in the release, when the project builds one. */\n\tserver: z.string().nonempty().optional(),\n\t/** The project's `debug` section; the program's debug manifest is the release's `debug.json`. */\n\tdebug: tsplcConfigSchema.shape.debug,\n\t/** The variable in the agent's environment holding the server's bearer token, for its telemetry and request trace. */\n\tserverTokenEnv: z.string().nonempty().optional(),\n\t/** The project's `secrets`, whose placeholders in the ST the agent fills in from Bun.secrets. */\n\tsecrets: tsplcConfigSchema.shape.secrets,\n});\nexport type ReleaseManifest = z.infer<typeof releaseManifestSchema>;\n\n/** How `tsplc deploy` compresses each uploaded file. */\nexport const uploadEncoding = \"gzip\";\n\nexport const deployOptionsSchema = z\n\t.strictObject({\n\t\tcredentials: credentialsSchema.nullable(),\n\t\t/** A full download stops the application; without it only an online change is applied. */\n\t\tdownload: z.boolean(),\n\t\tinitializeUser: z.boolean(),\n\t})\n\t.refine(\n\t\t(options) => options.credentials || !options.initializeUser,\n\t\t\"Initializing the controller's user needs the user's credentials.\",\n\t);\nexport type DeployOptions = z.infer<typeof deployOptionsSchema>;\n\n/** Long operations stream one of these per line. */\nexport const eventSchema = z.discriminatedUnion(\"kind\", [\n\tz.strictObject({ kind: z.literal(\"progress\"), message: z.string() }),\n\tz.strictObject({ kind: z.literal(\"done\"), result: z.unknown() }),\n\tz.strictObject({\n\t\tkind: z.literal(\"error\"),\n\t\tmessage: z.string(),\n\t\t/** The controller has no application from this agent yet, so only a full download can deploy. */\n\t\tdownloadRequired: z.boolean(),\n\t}),\n]);\nexport type AgentEvent = z.infer<typeof eventSchema>;\n\n/** A failed request's body. */\nexport const errorSchema = z.object({ error: z.string() });\n\nconst deployOperationSchema = z.enum([\"download\", \"online-change\"]);\n\nexport const releaseSchema = z.strictObject({\n\tid: z.string(),\n\tdeployedAt: z.iso.datetime(),\n\toperation: deployOperationSchema,\n\tcontrollerIds: z.strictObject({ codeId: z.string(), dataId: z.string() }),\n\t/** The running server executable, relative to the releases directory. */\n\tserver: z.string().optional(),\n});\nexport type Release = z.infer<typeof releaseSchema>;\n\nexport const statusSchema = z.strictObject({\n\ttarget: targetSchema.nullable(),\n\trelease: releaseSchema.nullable(),\n\tserver: z\n\t\t.strictObject({ executable: z.string(), running: z.boolean() })\n\t\t.nullable(),\n\t/** The open login's application state and forced expressions, or why it can't report them. */\n\tlogin: z\n\t\t.union([\n\t\t\tz.strictObject({ state: z.string(), forced: z.array(z.string()) }),\n\t\t\tz.strictObject({ error: z.string() }),\n\t\t])\n\t\t.nullable(),\n\t/** A controller user is stored on the agent's PC, so requests may leave theirs out. */\n\tcredentialsStored: z.boolean(),\n});\nexport type AgentStatus = z.infer<typeof statusSchema>;\n\n/** A logout's result: why the login couldn't log out, when its container had to be removed instead. */\nexport const logoutSchema = z.strictObject({ failure: z.string().optional() });\n\n/** Who ran a command, as the client reports it in these headers. */\nexport const clientHeaders = {\n\tuser: \"x-tsplc-user\",\n\thost: \"x-tsplc-host\",\n} as const;\n\n/** Who sent a request, as the client reports it. */\nexport const clientIdentity = (request: Request) => {\n\tconst header = (name: string) =>\n\t\trequest.headers.get(name)?.slice(0, 200) || undefined;\n\treturn { user: header(clientHeaders.user), host: header(clientHeaders.host) };\n};\nexport type ClientIdentity = ReturnType<typeof clientIdentity>;\n\n/** A line of the agent's `deployments.jsonl`. */\nexport const deploymentSchema = z.strictObject({\n\tat: z.iso.datetime(),\n\trelease: z.string(),\n\t/** The debug manifest's build id, when the release has one. */\n\tbuild: z.string().optional(),\n\toperation: deployOperationSchema,\n\t/** Whether the request sent the controller user or the agent used its stored one; lines from before 0.2.18 lack it. */\n\tcredentials: z.enum([\"provided\", \"stored\"]).optional(),\n\tuser: z.string().optional(),\n\thost: z.string().optional(),\n});\nexport type Deployment = z.infer<typeof deploymentSchema>;\n\n/** A line of the agent's `audit.jsonl`: a login command that changed the controller. */\nexport const auditSchema = z.strictObject({\n\tat: z.iso.datetime(),\n\t/** As typed after `tsplc`, such as `force` or `reset cold`. */\n\tcommand: z.string(),\n\t/** Expressions written or forced, with their values; unforced expressions map to \"\". */\n\tvalues: z.record(z.string(), z.string()),\n\t/** The values read just before the command, when the read succeeded. */\n\tprevious: z.record(z.string(), z.string()).optional(),\n\tuser: z.string().optional(),\n\thost: z.string().optional(),\n\trelease: z.string().optional(),\n\terror: z.string().optional(),\n});\nexport type Audit = z.infer<typeof auditSchema>;\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";AAAA;AACA;AACA,cAAS;;;ACFT;AACA;AAGO,IAAM,eAAe,EAAE,aAAa;AAAA,
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";AAAA;AACA;AACA,cAAS;;;ACFT;AACA;AACA;AAGO,IAAM,eAAe,EAAE,aAAa;AAAA,EAC1C,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,MAAM;AACP,CAAC;AAGM,IAAM,yBAAyB,EAAE,aAAa;AAAA,EACpD,MAAM,EAAE,OAAO;AAAA,EACf,SAAS,EAAE,KAAK;AAAA,EAChB,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAC7C,CAAC;AAIM,IAAM,mBAAmB,EAAE,aAAa;AAAA,EAC9C,SAAS,EAAE,KAAK;AAAA,EAChB,MAAM,EAAE,OAAO,EAAE,IAAI;AAAA,EACrB,UAAU,EAAE,OAAO,EAAE,SAAS;AAC/B,CAAC;AAIM,IAAM,iBAAiB,EAAE,aAAa,EAAE,MAAM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