@indigoai-us/hq-cli 5.57.0 → 5.58.1
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/commands/people.d.ts +12 -8
- package/dist/commands/people.js +87 -41
- package/dist/commands/secrets.js +26 -33
- package/dist/utils/sandbox-runner-client.d.ts +4 -9
- package/dist/utils/sandbox-runner-client.js +4 -11
- package/package.json +1 -1
- package/src/commands/people.test.ts +217 -52
- package/src/commands/people.ts +114 -64
- package/src/commands/secrets.test.ts +84 -78
- package/src/commands/secrets.ts +26 -32
- package/src/utils/sandbox-runner-client.test.ts +21 -23
- package/src/utils/sandbox-runner-client.ts +6 -19
|
@@ -19,11 +19,9 @@ describe("SandboxRunnerClient", () => {
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const result = await client.startJob("jwt-token", {
|
|
22
|
-
skillId: "my-skill",
|
|
23
22
|
companyUid: "cmp_123",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
usage: { channel: "sandbox" },
|
|
23
|
+
secretNames: ["API_KEY"],
|
|
24
|
+
command: "node script.js --x",
|
|
27
25
|
});
|
|
28
26
|
|
|
29
27
|
expect(result).toEqual({ jobId: "job_1", status: "queued" });
|
|
@@ -34,11 +32,9 @@ describe("SandboxRunnerClient", () => {
|
|
|
34
32
|
"Content-Type": "application/json",
|
|
35
33
|
},
|
|
36
34
|
body: JSON.stringify({
|
|
37
|
-
skillId: "my-skill",
|
|
38
35
|
companyUid: "cmp_123",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
usage: { channel: "sandbox" },
|
|
36
|
+
secretNames: ["API_KEY"],
|
|
37
|
+
command: "node script.js --x",
|
|
42
38
|
}),
|
|
43
39
|
});
|
|
44
40
|
});
|
|
@@ -49,7 +45,13 @@ describe("SandboxRunnerClient", () => {
|
|
|
49
45
|
.mockResolvedValueOnce(jsonRes({ jobId: "job_1", status: "queued" }))
|
|
50
46
|
.mockResolvedValueOnce(jsonRes({ jobId: "job_1", status: "running" }))
|
|
51
47
|
.mockResolvedValueOnce(
|
|
52
|
-
jsonRes({
|
|
48
|
+
jsonRes({
|
|
49
|
+
jobId: "job_1",
|
|
50
|
+
status: "succeeded",
|
|
51
|
+
output: "ok\n",
|
|
52
|
+
exitCode: 0,
|
|
53
|
+
success: true,
|
|
54
|
+
}),
|
|
53
55
|
);
|
|
54
56
|
const client = new SandboxRunnerClient({
|
|
55
57
|
baseUrl: "https://runner.example",
|
|
@@ -63,11 +65,9 @@ describe("SandboxRunnerClient", () => {
|
|
|
63
65
|
expect(result).toEqual({
|
|
64
66
|
jobId: "job_1",
|
|
65
67
|
status: "succeeded",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
exitCode: undefined,
|
|
70
|
-
error: undefined,
|
|
68
|
+
output: "ok\n",
|
|
69
|
+
exitCode: 0,
|
|
70
|
+
success: true,
|
|
71
71
|
});
|
|
72
72
|
expect(fetchImpl).toHaveBeenCalledTimes(3);
|
|
73
73
|
expect(fetchImpl).toHaveBeenNthCalledWith(
|
|
@@ -82,9 +82,9 @@ describe("SandboxRunnerClient", () => {
|
|
|
82
82
|
jsonRes({
|
|
83
83
|
jobId: "job_1",
|
|
84
84
|
status: "failed",
|
|
85
|
-
|
|
85
|
+
output: "boom\n",
|
|
86
86
|
exitCode: 2,
|
|
87
|
-
|
|
87
|
+
success: false,
|
|
88
88
|
}),
|
|
89
89
|
);
|
|
90
90
|
const client = new SandboxRunnerClient({
|
|
@@ -97,15 +97,15 @@ describe("SandboxRunnerClient", () => {
|
|
|
97
97
|
).resolves.toMatchObject({
|
|
98
98
|
jobId: "job_1",
|
|
99
99
|
status: "failed",
|
|
100
|
-
|
|
100
|
+
output: "boom\n",
|
|
101
101
|
exitCode: 2,
|
|
102
|
-
|
|
102
|
+
success: false,
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
it("uses the requested job id when the live status response omits it", async () => {
|
|
107
107
|
const fetchImpl = vi.fn<typeof fetch>(async () =>
|
|
108
|
-
jsonRes({ status: "succeeded",
|
|
108
|
+
jsonRes({ status: "succeeded", output: "ok\n" }),
|
|
109
109
|
);
|
|
110
110
|
const client = new SandboxRunnerClient({
|
|
111
111
|
baseUrl: "https://runner.example",
|
|
@@ -115,11 +115,9 @@ describe("SandboxRunnerClient", () => {
|
|
|
115
115
|
await expect(client.getJob("jwt-token", "job_live")).resolves.toEqual({
|
|
116
116
|
jobId: "job_live",
|
|
117
117
|
status: "succeeded",
|
|
118
|
-
|
|
119
|
-
stderr: undefined,
|
|
120
|
-
logsTail: "ok\n",
|
|
118
|
+
output: "ok\n",
|
|
121
119
|
exitCode: undefined,
|
|
122
|
-
|
|
120
|
+
success: undefined,
|
|
123
121
|
});
|
|
124
122
|
});
|
|
125
123
|
});
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
export type SandboxRunnerState = "queued" | "running" | "succeeded" | "failed";
|
|
2
2
|
|
|
3
3
|
export interface SandboxRunnerStartRequest {
|
|
4
|
-
skillId: string;
|
|
5
4
|
companyUid: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
only?: string[];
|
|
9
|
-
usage?: unknown;
|
|
5
|
+
secretNames: string[];
|
|
6
|
+
command: string;
|
|
10
7
|
}
|
|
11
8
|
|
|
12
9
|
export interface SandboxRunnerStartResponse {
|
|
@@ -17,11 +14,9 @@ export interface SandboxRunnerStartResponse {
|
|
|
17
14
|
export interface SandboxRunnerJob {
|
|
18
15
|
jobId: string;
|
|
19
16
|
status: SandboxRunnerState;
|
|
20
|
-
|
|
21
|
-
stderr?: string;
|
|
22
|
-
logsTail?: string;
|
|
17
|
+
output?: string;
|
|
23
18
|
exitCode?: number;
|
|
24
|
-
|
|
19
|
+
success?: boolean;
|
|
25
20
|
}
|
|
26
21
|
|
|
27
22
|
export interface SandboxRunnerClientOptions {
|
|
@@ -70,23 +65,15 @@ function normalizeJob(
|
|
|
70
65
|
if (!isSandboxRunnerState(status)) {
|
|
71
66
|
throw new Error("Sandbox Runner returned an invalid job status.");
|
|
72
67
|
}
|
|
73
|
-
const output =
|
|
74
|
-
typeof body.stdout === "string"
|
|
75
|
-
? body.stdout
|
|
76
|
-
: typeof body.output === "string"
|
|
77
|
-
? body.output
|
|
78
|
-
: undefined;
|
|
79
68
|
return {
|
|
80
69
|
jobId:
|
|
81
70
|
typeof body.jobId === "string" && body.jobId.length > 0
|
|
82
71
|
? body.jobId
|
|
83
72
|
: jobIdFallback ?? requireString(body, "jobId"),
|
|
84
73
|
status,
|
|
85
|
-
|
|
86
|
-
stderr: typeof body.stderr === "string" ? body.stderr : undefined,
|
|
87
|
-
logsTail: typeof body.logsTail === "string" ? body.logsTail : undefined,
|
|
74
|
+
output: typeof body.output === "string" ? body.output : undefined,
|
|
88
75
|
exitCode: typeof body.exitCode === "number" ? body.exitCode : undefined,
|
|
89
|
-
|
|
76
|
+
success: typeof body.success === "boolean" ? body.success : undefined,
|
|
90
77
|
};
|
|
91
78
|
}
|
|
92
79
|
|