@zgeoff/imp-client 0.5.0 → 0.6.0
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/index.js +15 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { RPCLink } from "@orpc/client/fetch";
|
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/check-server.ts
|
|
6
|
-
const CLIENT_VERSION = "0.
|
|
6
|
+
const CLIENT_VERSION = "0.6.0";
|
|
7
7
|
async function checkServer(rpc) {
|
|
8
8
|
const info = await rpc.system.info();
|
|
9
9
|
return {
|
|
@@ -65,10 +65,14 @@ const ExecStartMessageSchema = z.object({
|
|
|
65
65
|
tty: z.boolean(),
|
|
66
66
|
cols: DimensionSchema.optional(),
|
|
67
67
|
rows: DimensionSchema.optional(),
|
|
68
|
-
session: SessionNameSchema.optional()
|
|
68
|
+
session: SessionNameSchema.optional(),
|
|
69
|
+
tool: z.enum(["tar"]).optional()
|
|
69
70
|
}).refine((start) => start.session === void 0 || start.tty, {
|
|
70
71
|
message: "a session needs a tty",
|
|
71
72
|
path: ["tty"]
|
|
73
|
+
}).refine((start) => start.tool === void 0 || !start.tty && start.session === void 0 && start.env === void 0 && start.cwd === void 0, {
|
|
74
|
+
message: "a tool takes no tty, session, env or cwd",
|
|
75
|
+
path: ["tool"]
|
|
72
76
|
});
|
|
73
77
|
const ExecAttachMessageSchema = z.object({
|
|
74
78
|
type: z.literal("attach"),
|
|
@@ -89,6 +93,10 @@ z.discriminatedUnion("type", [
|
|
|
89
93
|
z.object({
|
|
90
94
|
type: z.literal("signal"),
|
|
91
95
|
signal: z.string().regex(/^SIG[A-Z0-9]+$/)
|
|
96
|
+
}),
|
|
97
|
+
z.object({
|
|
98
|
+
type: z.literal("stdout_ack"),
|
|
99
|
+
bytes: z.int().positive()
|
|
92
100
|
})
|
|
93
101
|
]);
|
|
94
102
|
const ExecServerMessageSchema = z.discriminatedUnion("type", [
|
|
@@ -111,6 +119,10 @@ const ExecServerMessageSchema = z.discriminatedUnion("type", [
|
|
|
111
119
|
"lost"
|
|
112
120
|
])
|
|
113
121
|
}),
|
|
122
|
+
z.object({
|
|
123
|
+
type: z.literal("stdin_ack"),
|
|
124
|
+
bytes: z.int().positive()
|
|
125
|
+
}),
|
|
114
126
|
z.object({
|
|
115
127
|
type: z.literal("error"),
|
|
116
128
|
message: z.string(),
|
|
@@ -270,7 +282,7 @@ function openExecSession(options) {
|
|
|
270
282
|
kind: "detached",
|
|
271
283
|
reason: message.reason
|
|
272
284
|
});
|
|
273
|
-
else resolveOutcome({
|
|
285
|
+
else if (message.type === "stdin_ack") {} else resolveOutcome({
|
|
274
286
|
kind: "failed",
|
|
275
287
|
code: message.code ?? null,
|
|
276
288
|
message: message.message,
|