@hearsay-tools/squawk 0.18.0-pr4063.7747 → 0.18.0-pr4064.7746
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/index.d.ts +1 -0
- package/dist/contract/index.js +34 -14
- package/dist/contract/runner-install.d.ts +41 -0
- package/dist/contract/runners.d.ts +2 -0
- package/dist/core/managed-cli-source.d.ts +7 -0
- package/dist/core/managed-cli-source.js +2 -0
- package/dist/core/managed-cli-source.js.map +1 -0
- package/dist/core/runner-definition.d.ts +3 -0
- package/dist/core/runner-definition.js.map +1 -1
- package/dist/delegation/routes.d.ts +76 -76
- package/dist/managed-install/cli-archive.d.ts +4 -0
- package/dist/managed-install/cli-archive.js +84 -0
- package/dist/managed-install/cli-archive.js.map +1 -0
- package/dist/managed-install/cli-installation.d.ts +26 -0
- package/dist/managed-install/cli-installation.js +119 -0
- package/dist/managed-install/cli-installation.js.map +1 -0
- package/dist/managed-install/cli-manifest.d.ts +11 -0
- package/dist/managed-install/cli-manifest.js +37 -0
- package/dist/managed-install/cli-manifest.js.map +1 -0
- package/dist/managed-install/cli-storage.d.ts +36 -0
- package/dist/managed-install/cli-storage.js +189 -0
- package/dist/managed-install/cli-storage.js.map +1 -0
- package/dist/runners/antigravity/cli.d.ts +6 -2
- package/dist/runners/antigravity/cli.js +5 -1
- package/dist/runners/antigravity/cli.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/runner-install-routes.d.ts +105 -0
- package/dist/server/runner-install-routes.js +52 -0
- package/dist/server/runner-install-routes.js.map +1 -0
- package/dist/server/runners-routes.d.ts +104 -1
- package/dist/server/runners-routes.js +7 -3
- package/dist/server/runners-routes.js.map +1 -1
- package/dist/server/server.d.ts +652 -553
- package/dist/server/server.js +1 -1
- package/dist/server/server.js.map +1 -1
- package/dist/server-install/steps.js +4 -0
- package/dist/server-install/steps.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/{activity-motion-CHWLFQui.js → activity-motion-BSsgWgJe.js} +1 -1
- package/web/dist/assets/{activity-route-CDZ8vEvw.js → activity-route-q9sOR4Wb.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-BiFrj_Kg.js → commit-diff-panel-Btiebm6D.js} +1 -1
- package/web/dist/assets/{diff-Bp_ZwIlK.js → diff-DNIkChMc.js} +2 -2
- package/web/dist/assets/{diff-view-BLWY32aP.js → diff-view-jhjgH27W.js} +1 -1
- package/web/dist/assets/{file-preview-BMb-p58M.js → file-preview-De5UjJTG.js} +1 -1
- package/web/dist/assets/{git-toolbar-BLOs2P23.js → git-toolbar-Ol1142ti.js} +1 -1
- package/web/dist/assets/{github-DLd49gwL.js → github-BylUlaAL.js} +1 -1
- package/web/dist/assets/{global-activity-route-C6qUGiQ-.js → global-activity-route-DI3QqvQL.js} +1 -1
- package/web/dist/assets/{index-D9Yu2XLO.js → index-Dbb0-RtK.js} +11 -11
- package/web/dist/assets/{markdown-HUI2AGRH.js → markdown-D3aDM4O5.js} +1 -1
- package/web/dist/assets/{picker-pill-Bmxuo6r5.js → picker-pill-DW8uRjlV.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Br0FHHb0.js → preview-pane-connected-C-f5rJGZ.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-Fb8KyZ2w.js → prompt-template-menu-ntY16IJm.js} +1 -1
- package/web/dist/assets/{repo-git-CXxRkRrr.js → repo-git-D-j1tyQj.js} +1 -1
- package/web/dist/assets/{report-reader-DK9rxnu_.js → report-reader-0-k8FTCM.js} +1 -1
- package/web/dist/assets/{reports-DyqYeCfW.js → reports--2BDXGSj.js} +1 -1
- package/web/dist/assets/{run-header-DI2Zp-1g.js → run-header-B69_lBSt.js} +1 -1
- package/web/dist/assets/runners-BZb4ezwE.js +1 -0
- package/web/dist/assets/{skills-BsojRHiF.js → skills-CzyYKL6l.js} +1 -1
- package/web/dist/assets/{task-changes-D0fhNQ8e.js → task-changes-D1Oi0yoX.js} +1 -1
- package/web/dist/assets/{task-commits-DfPvhSgU.js → task-commits-DV91fVHF.js} +1 -1
- package/web/dist/assets/{task-files-Do9eS-uO.js → task-files-_ap-MUjL.js} +1 -1
- package/web/dist/assets/{task-github-item-IDiDedZh.js → task-github-item-9oibIBa8.js} +1 -1
- package/web/dist/assets/{task-thread-BK0lz7hd.js → task-thread-D8IfseH4.js} +1 -1
- package/web/dist/assets/{thread-state-D2FZC_j9.js → thread-state-BLS3a1XA.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CntaNwZk.js → use-hand-to-agent-state-DaPTyzCV.js} +1 -1
- package/web/dist/assets/{workflows-BnU1T_ay.js → workflows-BAIP3wxi.js} +1 -1
- package/web/dist/index.html +4 -4
- package/web/dist/assets/runners-D8udSrRd.js +0 -1
package/dist/contract/index.d.ts
CHANGED
package/dist/contract/index.js
CHANGED
|
@@ -1257,6 +1257,8 @@ var runnerEntrySchema = z14.object({
|
|
|
1257
1257
|
terminalLogin: z14.boolean().optional(),
|
|
1258
1258
|
/** The runner can sign in through an ephemeral browser flow in the cockpit. */
|
|
1259
1259
|
browserLogin: z14.boolean().optional(),
|
|
1260
|
+
/** The cockpit can install, update and remove this runner's managed CLI. */
|
|
1261
|
+
managedInstall: z14.literal(true).optional(),
|
|
1260
1262
|
/** A generic example account folder for the add-account dialog. */
|
|
1261
1263
|
accountFolderExample: z14.string().optional(),
|
|
1262
1264
|
models: runnerModelSuggestionsSchema,
|
|
@@ -5980,25 +5982,39 @@ var runnerSkillListSchema = z52.object({
|
|
|
5980
5982
|
reason: z52.string().optional()
|
|
5981
5983
|
});
|
|
5982
5984
|
|
|
5983
|
-
// ../contract/src/
|
|
5985
|
+
// ../contract/src/runner-install.ts
|
|
5984
5986
|
import { z as z53 } from "zod";
|
|
5987
|
+
var runnerInstallParamsSchema = z53.object({ runner: runnerSchema });
|
|
5988
|
+
var runnerInstallActionSchema = z53.object({ action: z53.enum(["check", "install", "update", "remove"]) });
|
|
5989
|
+
var runnerInstallPhaseSchema = z53.enum(["idle", "checking", "downloading", "verifying", "extracting", "activating", "removing", "failed"]);
|
|
5990
|
+
var runnerInstallStatusSchema = z53.object({
|
|
5991
|
+
supported: z53.boolean(),
|
|
5992
|
+
installedVersion: z53.string().nullable(),
|
|
5993
|
+
latestVersion: z53.string().nullable(),
|
|
5994
|
+
updateAvailable: z53.boolean(),
|
|
5995
|
+
phase: runnerInstallPhaseSchema,
|
|
5996
|
+
error: z53.string().nullable()
|
|
5997
|
+
});
|
|
5998
|
+
|
|
5999
|
+
// ../contract/src/automation-tool.ts
|
|
6000
|
+
import { z as z54 } from "zod";
|
|
5985
6001
|
var repeatingAutomationInputSchema = automationCreateSchema.omit({ enabled: true, enable: true }).refine((value) => value.schedule?.type !== "once", "Use cezar_schedule_task for a one-time schedule.");
|
|
5986
|
-
var id =
|
|
5987
|
-
var automationToolRequestSchema =
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
6002
|
+
var id = z54.string().min(1).max(100);
|
|
6003
|
+
var automationToolRequestSchema = z54.discriminatedUnion("action", [
|
|
6004
|
+
z54.object({ action: z54.literal("create"), definition: repeatingAutomationInputSchema }).strict(),
|
|
6005
|
+
z54.object({ action: z54.literal("show"), id }).strict(),
|
|
6006
|
+
z54.object({ action: z54.literal("preview"), id }).strict(),
|
|
6007
|
+
z54.object({ action: z54.literal("enable"), id, explicit: z54.boolean().optional() }).strict()
|
|
5992
6008
|
]);
|
|
5993
|
-
var automationToolAnswerSchema =
|
|
5994
|
-
|
|
5995
|
-
ok:
|
|
6009
|
+
var automationToolAnswerSchema = z54.union([
|
|
6010
|
+
z54.object({
|
|
6011
|
+
ok: z54.literal(true),
|
|
5996
6012
|
automation: storedAutomationDefinitionSchema,
|
|
5997
|
-
url:
|
|
5998
|
-
next_run_at:
|
|
5999
|
-
preview:
|
|
6013
|
+
url: z54.string().optional(),
|
|
6014
|
+
next_run_at: z54.string().optional(),
|
|
6015
|
+
preview: z54.object({ matches: z54.number().int().nonnegative(), truncated: z54.boolean() }).optional()
|
|
6000
6016
|
}),
|
|
6001
|
-
|
|
6017
|
+
z54.object({ ok: z54.literal(false), code: z54.enum([...scheduledTaskRefusalCodeSchema.options, "explicit_required", "preview_required"]), message: z54.string() })
|
|
6002
6018
|
]);
|
|
6003
6019
|
export {
|
|
6004
6020
|
ACTIVITY_CHECKS_MAX,
|
|
@@ -6556,6 +6572,10 @@ export {
|
|
|
6556
6572
|
runnerAgentConfigGroupSchema,
|
|
6557
6573
|
runnerAgentConfigSchema,
|
|
6558
6574
|
runnerEntrySchema,
|
|
6575
|
+
runnerInstallActionSchema,
|
|
6576
|
+
runnerInstallParamsSchema,
|
|
6577
|
+
runnerInstallPhaseSchema,
|
|
6578
|
+
runnerInstallStatusSchema,
|
|
6559
6579
|
runnerModelCatalogResponseSchema,
|
|
6560
6580
|
runnerModelIdScopeSchema,
|
|
6561
6581
|
runnerModelOptionSchema,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const runnerInstallParamsSchema: z.ZodObject<{
|
|
3
|
+
runner: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const runnerInstallActionSchema: z.ZodObject<{
|
|
6
|
+
action: z.ZodEnum<{
|
|
7
|
+
check: "check";
|
|
8
|
+
install: "install";
|
|
9
|
+
remove: "remove";
|
|
10
|
+
update: "update";
|
|
11
|
+
}>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const runnerInstallPhaseSchema: z.ZodEnum<{
|
|
14
|
+
activating: "activating";
|
|
15
|
+
checking: "checking";
|
|
16
|
+
downloading: "downloading";
|
|
17
|
+
extracting: "extracting";
|
|
18
|
+
failed: "failed";
|
|
19
|
+
idle: "idle";
|
|
20
|
+
removing: "removing";
|
|
21
|
+
verifying: "verifying";
|
|
22
|
+
}>;
|
|
23
|
+
export declare const runnerInstallStatusSchema: z.ZodObject<{
|
|
24
|
+
supported: z.ZodBoolean;
|
|
25
|
+
installedVersion: z.ZodNullable<z.ZodString>;
|
|
26
|
+
latestVersion: z.ZodNullable<z.ZodString>;
|
|
27
|
+
updateAvailable: z.ZodBoolean;
|
|
28
|
+
phase: z.ZodEnum<{
|
|
29
|
+
activating: "activating";
|
|
30
|
+
checking: "checking";
|
|
31
|
+
downloading: "downloading";
|
|
32
|
+
extracting: "extracting";
|
|
33
|
+
failed: "failed";
|
|
34
|
+
idle: "idle";
|
|
35
|
+
removing: "removing";
|
|
36
|
+
verifying: "verifying";
|
|
37
|
+
}>;
|
|
38
|
+
error: z.ZodNullable<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export type RunnerInstallStatus = z.infer<typeof runnerInstallStatusSchema>;
|
|
41
|
+
export type RunnerInstallAction = z.infer<typeof runnerInstallActionSchema>['action'];
|
|
@@ -72,6 +72,7 @@ export declare const runnerEntrySchema: z.ZodObject<{
|
|
|
72
72
|
loginCommand: z.ZodString;
|
|
73
73
|
terminalLogin: z.ZodOptional<z.ZodBoolean>;
|
|
74
74
|
browserLogin: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
managedInstall: z.ZodOptional<z.ZodLiteral<true>>;
|
|
75
76
|
accountFolderExample: z.ZodOptional<z.ZodString>;
|
|
76
77
|
models: z.ZodObject<{
|
|
77
78
|
suggested: z.ZodArray<z.ZodObject<{
|
|
@@ -119,6 +120,7 @@ export declare const runnersResponseSchema: z.ZodObject<{
|
|
|
119
120
|
loginCommand: z.ZodString;
|
|
120
121
|
terminalLogin: z.ZodOptional<z.ZodBoolean>;
|
|
121
122
|
browserLogin: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
managedInstall: z.ZodOptional<z.ZodLiteral<true>>;
|
|
122
124
|
accountFolderExample: z.ZodOptional<z.ZodString>;
|
|
123
125
|
models: z.ZodObject<{
|
|
124
126
|
suggested: z.ZodArray<z.ZodObject<{
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A host-target manifest with a verified, single-executable release. No network work at boot. */
|
|
2
|
+
export interface ManagedCliSource {
|
|
3
|
+
readonly manifestUrl: string;
|
|
4
|
+
readonly downloadUrlPrefix: string;
|
|
5
|
+
readonly executable: string;
|
|
6
|
+
readonly windowsExecutable: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-cli-source.js","sourceRoot":"","sources":["../../src/core/managed-cli-source.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentRunner, AgentRunSpecSupport } from './agent-runner.ts';
|
|
2
|
+
import type { ManagedCliSource } from './managed-cli-source.ts';
|
|
2
3
|
import type { RunnerFacts } from './runner-facts.ts';
|
|
3
4
|
import type { BackendModelMap } from './model-identity.ts';
|
|
4
5
|
import type { AgentModelSettingsStrategy } from './runner-model-settings.ts';
|
|
@@ -243,6 +244,8 @@ export interface RunnerCli {
|
|
|
243
244
|
} | {
|
|
244
245
|
readonly site: string;
|
|
245
246
|
readonly label: string;
|
|
247
|
+
} | {
|
|
248
|
+
readonly managed: ManagedCliSource;
|
|
246
249
|
} | null;
|
|
247
250
|
/** The "Open in" menu entry (`cli:<id>`) that hands a session to this CLI: its label and its icon key. */
|
|
248
251
|
readonly openTarget: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-definition.js","sourceRoot":"","sources":["../../src/core/runner-definition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner-definition.js","sourceRoot":"","sources":["../../src/core/runner-definition.ts"],"names":[],"mappings":"AAsUA,0BAA0B;AAC1B,MAAM,UAAU,YAAY,CAAC,UAA4B;IACvD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -27,6 +27,18 @@ 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
|
+
} | {
|
|
30
42
|
output: {
|
|
31
43
|
workers: {
|
|
32
44
|
workerId: string;
|
|
@@ -73,24 +85,23 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
73
85
|
offset?: string | undefined;
|
|
74
86
|
};
|
|
75
87
|
};
|
|
76
|
-
} | {
|
|
77
|
-
output: {
|
|
78
|
-
error: string;
|
|
79
|
-
code?: "invalid_input" | undefined;
|
|
80
|
-
};
|
|
81
|
-
outputFormat: "json";
|
|
82
|
-
status: 400;
|
|
83
|
-
input: {
|
|
84
|
-
query: {
|
|
85
|
-
offset?: string | undefined;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
} & {
|
|
91
91
|
"/discover": {
|
|
92
92
|
$post: {
|
|
93
93
|
output: {
|
|
94
|
+
runner: string;
|
|
95
|
+
models: {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
description: string;
|
|
99
|
+
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
100
|
+
}[];
|
|
101
|
+
source: "cache" | "live" | "unavailable";
|
|
102
|
+
stale: boolean;
|
|
103
|
+
reason?: string | undefined;
|
|
104
|
+
} | {
|
|
94
105
|
tasks: {
|
|
95
106
|
id: string;
|
|
96
107
|
title: string;
|
|
@@ -112,17 +123,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
112
123
|
authFailureId?: string | undefined;
|
|
113
124
|
runner: string;
|
|
114
125
|
}[];
|
|
115
|
-
} | {
|
|
116
|
-
runner: string;
|
|
117
|
-
models: {
|
|
118
|
-
id: string;
|
|
119
|
-
label: string;
|
|
120
|
-
description: string;
|
|
121
|
-
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
122
|
-
}[];
|
|
123
|
-
source: "cache" | "live" | "unavailable";
|
|
124
|
-
stale: boolean;
|
|
125
|
-
reason?: string | undefined;
|
|
126
126
|
};
|
|
127
127
|
outputFormat: "json";
|
|
128
128
|
status: 200;
|
|
@@ -629,6 +629,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
629
629
|
} & {
|
|
630
630
|
"/:workerId": {
|
|
631
631
|
$get: {
|
|
632
|
+
output: {
|
|
633
|
+
error: string;
|
|
634
|
+
code?: "invalid_input" | undefined;
|
|
635
|
+
};
|
|
636
|
+
outputFormat: "json";
|
|
637
|
+
status: 400;
|
|
638
|
+
input: {
|
|
639
|
+
param: {
|
|
640
|
+
workerId: string;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
} | {
|
|
632
644
|
output: {
|
|
633
645
|
workerId: string;
|
|
634
646
|
settled: boolean;
|
|
@@ -746,7 +758,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
746
758
|
workerId: string;
|
|
747
759
|
};
|
|
748
760
|
};
|
|
749
|
-
}
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
} & {
|
|
764
|
+
"/:workerId/collect": {
|
|
765
|
+
$post: {
|
|
750
766
|
output: {
|
|
751
767
|
error: string;
|
|
752
768
|
code?: "invalid_input" | undefined;
|
|
@@ -757,12 +773,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
757
773
|
param: {
|
|
758
774
|
workerId: string;
|
|
759
775
|
};
|
|
776
|
+
} & {
|
|
777
|
+
json: Record<string, never>;
|
|
760
778
|
};
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
} & {
|
|
764
|
-
"/:workerId/collect": {
|
|
765
|
-
$post: {
|
|
779
|
+
} | {
|
|
766
780
|
output: {
|
|
767
781
|
workerId: string;
|
|
768
782
|
parentRunId: string;
|
|
@@ -885,7 +899,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
885
899
|
} & {
|
|
886
900
|
json: Record<string, never>;
|
|
887
901
|
};
|
|
888
|
-
}
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
} & {
|
|
905
|
+
"/:workerId/steer": {
|
|
906
|
+
$post: {
|
|
889
907
|
output: {
|
|
890
908
|
error: string;
|
|
891
909
|
code?: "invalid_input" | undefined;
|
|
@@ -897,13 +915,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
897
915
|
workerId: string;
|
|
898
916
|
};
|
|
899
917
|
} & {
|
|
900
|
-
json:
|
|
918
|
+
json: {
|
|
919
|
+
text: string;
|
|
920
|
+
};
|
|
901
921
|
};
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
} & {
|
|
905
|
-
"/:workerId/steer": {
|
|
906
|
-
$post: {
|
|
922
|
+
} | {
|
|
907
923
|
output: {
|
|
908
924
|
workerId: string;
|
|
909
925
|
state: "delivered" | "queued";
|
|
@@ -919,7 +935,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
919
935
|
text: string;
|
|
920
936
|
};
|
|
921
937
|
};
|
|
922
|
-
}
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
} & {
|
|
941
|
+
"/:workerId/stop": {
|
|
942
|
+
$post: {
|
|
923
943
|
output: {
|
|
924
944
|
error: string;
|
|
925
945
|
code?: "invalid_input" | undefined;
|
|
@@ -931,15 +951,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
931
951
|
workerId: string;
|
|
932
952
|
};
|
|
933
953
|
} & {
|
|
934
|
-
json:
|
|
935
|
-
text: string;
|
|
936
|
-
};
|
|
954
|
+
json: Record<string, never>;
|
|
937
955
|
};
|
|
938
|
-
}
|
|
939
|
-
};
|
|
940
|
-
} & {
|
|
941
|
-
"/:workerId/stop": {
|
|
942
|
-
$post: {
|
|
956
|
+
} | {
|
|
943
957
|
output: {
|
|
944
958
|
workerId: string;
|
|
945
959
|
state: "stopping" | "terminated";
|
|
@@ -953,7 +967,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
953
967
|
} & {
|
|
954
968
|
json: Record<string, never>;
|
|
955
969
|
};
|
|
956
|
-
}
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
} & {
|
|
973
|
+
"/:workerId/destroy": {
|
|
974
|
+
$post: {
|
|
957
975
|
output: {
|
|
958
976
|
error: string;
|
|
959
977
|
code?: "invalid_input" | undefined;
|
|
@@ -965,13 +983,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
965
983
|
workerId: string;
|
|
966
984
|
};
|
|
967
985
|
} & {
|
|
968
|
-
json:
|
|
986
|
+
json: {
|
|
987
|
+
discardWork?: true | undefined;
|
|
988
|
+
};
|
|
969
989
|
};
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
} & {
|
|
973
|
-
"/:workerId/destroy": {
|
|
974
|
-
$post: {
|
|
990
|
+
} | {
|
|
975
991
|
output: {
|
|
976
992
|
workerId: string;
|
|
977
993
|
state: "complete" | "incomplete";
|
|
@@ -1000,22 +1016,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1000
1016
|
discardWork?: true | undefined;
|
|
1001
1017
|
};
|
|
1002
1018
|
};
|
|
1003
|
-
} | {
|
|
1004
|
-
output: {
|
|
1005
|
-
error: string;
|
|
1006
|
-
code?: "invalid_input" | undefined;
|
|
1007
|
-
};
|
|
1008
|
-
outputFormat: "json";
|
|
1009
|
-
status: 400;
|
|
1010
|
-
input: {
|
|
1011
|
-
param: {
|
|
1012
|
-
workerId: string;
|
|
1013
|
-
};
|
|
1014
|
-
} & {
|
|
1015
|
-
json: {
|
|
1016
|
-
discardWork?: true | undefined;
|
|
1017
|
-
};
|
|
1018
|
-
};
|
|
1019
1019
|
} | {
|
|
1020
1020
|
output: {
|
|
1021
1021
|
workerId: string;
|
|
@@ -1051,13 +1051,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1051
1051
|
"/:workerId/diff": {
|
|
1052
1052
|
$get: {
|
|
1053
1053
|
output: {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
diff: string;
|
|
1057
|
-
truncated: boolean;
|
|
1054
|
+
error: string;
|
|
1055
|
+
code?: "invalid_input" | undefined;
|
|
1058
1056
|
};
|
|
1059
1057
|
outputFormat: "json";
|
|
1060
|
-
status:
|
|
1058
|
+
status: 400;
|
|
1061
1059
|
input: {
|
|
1062
1060
|
param: {
|
|
1063
1061
|
workerId: string;
|
|
@@ -1065,11 +1063,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1065
1063
|
};
|
|
1066
1064
|
} | {
|
|
1067
1065
|
output: {
|
|
1068
|
-
|
|
1069
|
-
|
|
1066
|
+
workerId: string;
|
|
1067
|
+
baselineSha: string;
|
|
1068
|
+
diff: string;
|
|
1069
|
+
truncated: boolean;
|
|
1070
1070
|
};
|
|
1071
1071
|
outputFormat: "json";
|
|
1072
|
-
status:
|
|
1072
|
+
status: 200;
|
|
1073
1073
|
input: {
|
|
1074
1074
|
param: {
|
|
1075
1075
|
workerId: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CliManifest } from './cli-manifest.ts';
|
|
2
|
+
/** Redirects are refused: the validated URL is the only network destination. */
|
|
3
|
+
export declare function downloadCli(manifest: CliManifest, path: string, fetcher?: typeof fetch): Promise<void>;
|
|
4
|
+
export declare function extractCliArchive(archive: string, destination: string, executable: string): Promise<void>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createHash, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { createReadStream, createWriteStream } from 'node:fs';
|
|
3
|
+
import { open } from 'node:fs/promises';
|
|
4
|
+
import { Readable, Transform } from 'node:stream';
|
|
5
|
+
import { pipeline } from 'node:stream/promises';
|
|
6
|
+
import { createGunzip } from 'node:zlib';
|
|
7
|
+
const MAX_BYTES = 512 * 1024 * 1024;
|
|
8
|
+
/** Redirects are refused: the validated URL is the only network destination. */
|
|
9
|
+
export async function downloadCli(manifest, path, fetcher = fetch) {
|
|
10
|
+
const response = await fetcher(manifest.url, { signal: AbortSignal.timeout(180_000), redirect: 'error' });
|
|
11
|
+
if (!response.ok || !response.body)
|
|
12
|
+
throw new Error(`The CLI download failed (${response.status}).`);
|
|
13
|
+
const hash = createHash('sha512');
|
|
14
|
+
let bytes = 0;
|
|
15
|
+
const verify = new Transform({ transform(chunk, _encoding, done) {
|
|
16
|
+
bytes += chunk.length;
|
|
17
|
+
if (bytes > MAX_BYTES)
|
|
18
|
+
return done(new Error('The CLI download is too large.'));
|
|
19
|
+
hash.update(chunk);
|
|
20
|
+
done(null, chunk);
|
|
21
|
+
} });
|
|
22
|
+
await pipeline(Readable.fromWeb(response.body), verify, createWriteStream(path, { flags: 'wx', mode: 0o600 }));
|
|
23
|
+
if (!timingSafeEqual(hash.digest(), Buffer.from(manifest.sha512, 'hex')))
|
|
24
|
+
throw new Error('The CLI sha512 checksum does not match.');
|
|
25
|
+
}
|
|
26
|
+
function tarString(header, start, end) {
|
|
27
|
+
return header.subarray(start, end).toString('utf8').replace(/\0.*$/s, '');
|
|
28
|
+
}
|
|
29
|
+
/** Accept exactly one regular file at the declared basename. Never extract archive paths. */
|
|
30
|
+
function executableSize(header, name) {
|
|
31
|
+
const kind = header[156];
|
|
32
|
+
const sizeText = tarString(header, 124, 136).trim();
|
|
33
|
+
const checksumText = tarString(header, 148, 156).trim();
|
|
34
|
+
let checksum = 0;
|
|
35
|
+
for (let i = 0; i < 512; i++)
|
|
36
|
+
checksum += i >= 148 && i < 156 ? 32 : header[i];
|
|
37
|
+
if (tarString(header, 0, 100) !== name || tarString(header, 345, 500) !== ''
|
|
38
|
+
|| (kind !== 0 && kind !== 48) || !/^[0-7]+$/.test(sizeText)
|
|
39
|
+
|| !/^[0-7]+$/.test(checksumText) || parseInt(checksumText, 8) !== checksum) {
|
|
40
|
+
throw new Error('The CLI archive must contain only its regular executable; links and paths are refused.');
|
|
41
|
+
}
|
|
42
|
+
const size = parseInt(sizeText, 8);
|
|
43
|
+
if (size <= 0 || size > MAX_BYTES)
|
|
44
|
+
throw new Error('The CLI executable size is invalid.');
|
|
45
|
+
return size;
|
|
46
|
+
}
|
|
47
|
+
export async function extractCliArchive(archive, destination, executable) {
|
|
48
|
+
const output = await open(destination, 'wx', 0o700);
|
|
49
|
+
const stream = createReadStream(archive).pipe(createGunzip());
|
|
50
|
+
let header = Buffer.alloc(0);
|
|
51
|
+
let remaining;
|
|
52
|
+
let total = 0;
|
|
53
|
+
try {
|
|
54
|
+
for await (const value of stream) {
|
|
55
|
+
let chunk = Buffer.from(value);
|
|
56
|
+
total += chunk.length;
|
|
57
|
+
if (total > MAX_BYTES + 1024 * 1024)
|
|
58
|
+
throw new Error('The CLI archive is too large.');
|
|
59
|
+
if (remaining === undefined) {
|
|
60
|
+
const needed = 512 - header.length;
|
|
61
|
+
header = Buffer.concat([header, chunk.subarray(0, needed)]);
|
|
62
|
+
chunk = chunk.subarray(needed);
|
|
63
|
+
if (header.length < 512)
|
|
64
|
+
continue;
|
|
65
|
+
remaining = executableSize(header, executable);
|
|
66
|
+
}
|
|
67
|
+
const length = Math.min(remaining, chunk.length);
|
|
68
|
+
if (length)
|
|
69
|
+
await output.writeFile(chunk.subarray(0, length));
|
|
70
|
+
remaining -= length;
|
|
71
|
+
// Only zero padding and end-of-archive blocks may follow the executable.
|
|
72
|
+
if (chunk.subarray(length).some(byte => byte !== 0))
|
|
73
|
+
throw new Error('The CLI archive contains extra entries.');
|
|
74
|
+
}
|
|
75
|
+
if (remaining !== 0)
|
|
76
|
+
throw new Error('The CLI archive is incomplete.');
|
|
77
|
+
await output.sync();
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
stream.destroy();
|
|
81
|
+
await output.close();
|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AAC;QACjB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RunnerInstallAction, RunnerInstallStatus } from '../contract/index.js';
|
|
2
|
+
import type { Home } from '../home/home.ts';
|
|
3
|
+
import type { ManagedCliSource } from '../core/managed-cli-source.ts';
|
|
4
|
+
/** Created at boot without I/O. Only Settings requests can fetch a manifest or install a CLI. */
|
|
5
|
+
export declare class ManagedCliInstallation {
|
|
6
|
+
private readonly home;
|
|
7
|
+
private readonly runner;
|
|
8
|
+
private readonly source;
|
|
9
|
+
private readonly fetcher;
|
|
10
|
+
private phase;
|
|
11
|
+
private error;
|
|
12
|
+
private latest;
|
|
13
|
+
private checkedAt;
|
|
14
|
+
private pending;
|
|
15
|
+
constructor(home: Home, runner: string, source: ManagedCliSource, fetcher?: typeof fetch);
|
|
16
|
+
status(): RunnerInstallStatus;
|
|
17
|
+
/** A status read checks at most hourly while the pane is open. It never waits on the network. */
|
|
18
|
+
refreshIfDue(): void;
|
|
19
|
+
start(action: RunnerInstallAction): void;
|
|
20
|
+
/** Used by verification and CLI callers; HTTP starts work and reads progress separately. */
|
|
21
|
+
settled(): Promise<void>;
|
|
22
|
+
private manifest;
|
|
23
|
+
private perform;
|
|
24
|
+
private install;
|
|
25
|
+
}
|
|
26
|
+
export { managedCliExecutable, leaseManagedCli } from './cli-storage.ts';
|