@jush-agent/sdk 0.2.6252 → 0.2.6320
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 +87 -0
- package/dist/index.d.mts +2163 -130
- package/dist/index.mjs +691 -302
- package/package.json +7 -7
- package/release/commands/jush-browser/descriptor.json +13 -13
- package/release/commands/jush-fetch/descriptor.json +13 -13
- package/release/commands/jush-file/descriptor.json +13 -13
- package/release/commands/jush-mobile/descriptor.json +13 -13
- package/release/commands/jush-subscription-cli/descriptor.json +35 -0
- package/release/commands/jush-claude-code/descriptor.json +0 -35
package/dist/index.mjs
CHANGED
|
@@ -60,6 +60,10 @@ const userContentBlockSchema = z.discriminatedUnion("type", [
|
|
|
60
60
|
type: z.literal("video"),
|
|
61
61
|
source: mediaSourceSchema
|
|
62
62
|
}),
|
|
63
|
+
z.object({
|
|
64
|
+
type: z.literal("audio"),
|
|
65
|
+
source: mediaSourceSchema
|
|
66
|
+
}),
|
|
63
67
|
z.object({
|
|
64
68
|
type: z.literal("document"),
|
|
65
69
|
source: documentSourceSchema
|
|
@@ -446,7 +450,13 @@ const fileExtensionSchema = z.enum([
|
|
|
446
450
|
"mp4",
|
|
447
451
|
"mov",
|
|
448
452
|
"webm",
|
|
449
|
-
"m4v"
|
|
453
|
+
"m4v",
|
|
454
|
+
"mp3",
|
|
455
|
+
"wav",
|
|
456
|
+
"ogg",
|
|
457
|
+
"flac",
|
|
458
|
+
"aiff",
|
|
459
|
+
"m4a"
|
|
450
460
|
]);
|
|
451
461
|
/** A model with its catalog facts, as a selection records it. */
|
|
452
462
|
const modelSchema = z.object({
|
|
@@ -938,7 +948,7 @@ const reportEventSchema = z.discriminatedUnion("kind", [
|
|
|
938
948
|
})
|
|
939
949
|
]);
|
|
940
950
|
/**
|
|
941
|
-
* Where the bytes of a tool result's image or
|
|
951
|
+
* Where the bytes of a tool result's image, video or recording are: in the
|
|
942
952
|
* conversation owner's blob namespace. A tagged enum of one variant, so a
|
|
943
953
|
* stored result keeps `{ "type": "ref", ... }`.
|
|
944
954
|
*/
|
|
@@ -953,10 +963,14 @@ const toolMediaSourceSchema = z.discriminatedUnion("type", [z.object({
|
|
|
953
963
|
width: z.int().min(0).max(4294967295).optional(),
|
|
954
964
|
height: z.int().min(0).max(4294967295).optional()
|
|
955
965
|
})]);
|
|
956
|
-
/**
|
|
966
|
+
/**
|
|
967
|
+
* Whether a model reads a medium as an image, a video, a recording or a
|
|
968
|
+
* document.
|
|
969
|
+
*/
|
|
957
970
|
const modelMediaKindSchema = z.enum([
|
|
958
971
|
"image",
|
|
959
972
|
"video",
|
|
973
|
+
"audio",
|
|
960
974
|
"document"
|
|
961
975
|
]);
|
|
962
976
|
/** Why a tool result's medium is gone. */
|
|
@@ -978,6 +992,10 @@ const toolResultContentBlockSchema = z.discriminatedUnion("type", [
|
|
|
978
992
|
type: z.literal("video"),
|
|
979
993
|
source: toolMediaSourceSchema
|
|
980
994
|
}),
|
|
995
|
+
z.object({
|
|
996
|
+
type: z.literal("audio"),
|
|
997
|
+
source: toolMediaSourceSchema
|
|
998
|
+
}),
|
|
981
999
|
z.object({
|
|
982
1000
|
type: z.literal("document"),
|
|
983
1001
|
source: documentSourceSchema
|
|
@@ -1360,10 +1378,20 @@ const quotaKindSchema = z.enum([
|
|
|
1360
1378
|
"tokens",
|
|
1361
1379
|
"cap"
|
|
1362
1380
|
]);
|
|
1363
|
-
/**
|
|
1381
|
+
/**
|
|
1382
|
+
* The part of an account a window meters, such as one model or a group of
|
|
1383
|
+
* models.
|
|
1384
|
+
*/
|
|
1364
1385
|
const quotaScopeSchema = z.object({
|
|
1365
1386
|
kind: z.string(),
|
|
1366
|
-
label: z.string().nullable()
|
|
1387
|
+
label: z.string().nullable(),
|
|
1388
|
+
/**
|
|
1389
|
+
* The models a model scope counts for, by their catalog ids, when the
|
|
1390
|
+
* vendor names them, as for a group of models with a name of its own
|
|
1391
|
+
* (`Claude and GPT`); empty when the label names the model, as `Sonnet`
|
|
1392
|
+
* does.
|
|
1393
|
+
*/
|
|
1394
|
+
modelIds: z.array(z.string()).optional()
|
|
1367
1395
|
});
|
|
1368
1396
|
/**
|
|
1369
1397
|
* What names a window: the parts of a
|
|
@@ -2016,6 +2044,11 @@ const mediaRefSchema = z.discriminatedUnion("type", [
|
|
|
2016
2044
|
ref: z.string().regex(/* @__PURE__ */ new RegExp("^[0-9a-f]{64}$", "u")),
|
|
2017
2045
|
mediaType: z.string()
|
|
2018
2046
|
}),
|
|
2047
|
+
z.strictObject({
|
|
2048
|
+
type: z.literal("audio"),
|
|
2049
|
+
ref: z.string().regex(/* @__PURE__ */ new RegExp("^[0-9a-f]{64}$", "u")),
|
|
2050
|
+
mediaType: z.string()
|
|
2051
|
+
}),
|
|
2019
2052
|
z.strictObject({
|
|
2020
2053
|
type: z.literal("document"),
|
|
2021
2054
|
ref: z.string().regex(/* @__PURE__ */ new RegExp("^[0-9a-f]{64}$", "u")),
|
|
@@ -2160,6 +2193,12 @@ const followSchema = z.strictObject({
|
|
|
2160
2193
|
value: followedSchema,
|
|
2161
2194
|
holds: heldSchema
|
|
2162
2195
|
});
|
|
2196
|
+
/**
|
|
2197
|
+
* A server frame that a page understands only when its `open` says so: a
|
|
2198
|
+
* page checks every frame against its schemas and ends the connection at one
|
|
2199
|
+
* it does not know, as a page loaded before the server's upgrade does.
|
|
2200
|
+
*/
|
|
2201
|
+
const understoodSchema = z.enum(["metadata_changed"]);
|
|
2163
2202
|
/** A replacement of a user message and everything after it. */
|
|
2164
2203
|
const editRequestSchema = z.strictObject({
|
|
2165
2204
|
/** Chosen by the web app, so a repeated request is recognized. */
|
|
@@ -2202,7 +2241,12 @@ z.discriminatedUnion("type", [
|
|
|
2202
2241
|
z.strictObject({
|
|
2203
2242
|
type: z.literal("open"),
|
|
2204
2243
|
draft: z.int().min(0).nullable().optional(),
|
|
2205
|
-
follows: z.array(followSchema).optional()
|
|
2244
|
+
follows: z.array(followSchema).optional(),
|
|
2245
|
+
/**
|
|
2246
|
+
* The frames the page understands beyond those every page does,
|
|
2247
|
+
* which the server sends it only when they are named here.
|
|
2248
|
+
*/
|
|
2249
|
+
understands: z.array(understoodSchema).optional()
|
|
2206
2250
|
}),
|
|
2207
2251
|
z.strictObject({
|
|
2208
2252
|
type: z.literal("follow"),
|
|
@@ -2350,7 +2394,7 @@ const commandLocaleSchema = z.object({
|
|
|
2350
2394
|
* What a declared command knows beyond its arguments: which conversation it
|
|
2351
2395
|
* serves, who started it, and the locale and color scheme its results are
|
|
2352
2396
|
* presented in. Work that belongs to no conversation names the provider
|
|
2353
|
-
* entry it serves instead.
|
|
2397
|
+
* entry it serves instead, or the device's own scope ([`DEVICE_SCOPE`]).
|
|
2354
2398
|
*
|
|
2355
2399
|
* The backend is its only source, and nothing reads it from the environment:
|
|
2356
2400
|
* a script can change variables, and every program a job runs inherits them.
|
|
@@ -2560,6 +2604,7 @@ const costSchema = z.object({
|
|
|
2560
2604
|
const createWorkTabSchema = z.strictObject({
|
|
2561
2605
|
id: z.string().min(1),
|
|
2562
2606
|
kind: z.string().min(1),
|
|
2607
|
+
device: z.string().min(1).optional(),
|
|
2563
2608
|
data: z.record(z.string(), z.json()),
|
|
2564
2609
|
index: z.int().min(0).max(64).nullable().optional()
|
|
2565
2610
|
});
|
|
@@ -2648,6 +2693,17 @@ const deviceReadSchema = z.strictObject({
|
|
|
2648
2693
|
*/
|
|
2649
2694
|
content: z.boolean().optional()
|
|
2650
2695
|
});
|
|
2696
|
+
/** What a plugin's package on a device last reported of a conversation. */
|
|
2697
|
+
const storedReportSchema = z.object({
|
|
2698
|
+
/** The package's own count of its changes. */
|
|
2699
|
+
revision: z.int().min(0),
|
|
2700
|
+
value: z.json()
|
|
2701
|
+
});
|
|
2702
|
+
/** What a plugin's package on `device` last reported of a conversation. */
|
|
2703
|
+
const deviceReportSchema = z.object({
|
|
2704
|
+
device: z.string().min(1),
|
|
2705
|
+
report: storedReportSchema
|
|
2706
|
+
});
|
|
2651
2707
|
/** Where a directory of the set is on every device. */
|
|
2652
2708
|
const directoryPathSchema = z.object({
|
|
2653
2709
|
name: z.string(),
|
|
@@ -2737,6 +2793,8 @@ const errorCodeSchema = z.enum([
|
|
|
2737
2793
|
"device_not_found",
|
|
2738
2794
|
"device_managed",
|
|
2739
2795
|
"device_offline",
|
|
2796
|
+
"device_lost",
|
|
2797
|
+
"command_timed_out",
|
|
2740
2798
|
"not_a_paired_device",
|
|
2741
2799
|
"conversation_not_found",
|
|
2742
2800
|
"block_not_found",
|
|
@@ -2747,6 +2805,9 @@ const errorCodeSchema = z.enum([
|
|
|
2747
2805
|
"share_target_invalid",
|
|
2748
2806
|
"share_not_updatable",
|
|
2749
2807
|
"share_not_found",
|
|
2808
|
+
"debug_link_not_found",
|
|
2809
|
+
"page_not_connected",
|
|
2810
|
+
"run_timed_out",
|
|
2750
2811
|
"permission_request_not_found",
|
|
2751
2812
|
"invalid_answer",
|
|
2752
2813
|
"credential_not_found",
|
|
@@ -2897,6 +2958,16 @@ const projectDtoSchema = z.object({
|
|
|
2897
2958
|
*/
|
|
2898
2959
|
savedCount: z.int().min(0)
|
|
2899
2960
|
});
|
|
2961
|
+
/** What a script printed, read as UTF-8 with an invalid byte as U+FFFD. */
|
|
2962
|
+
const execOutputSchema = z.object({
|
|
2963
|
+
stdout: z.string(),
|
|
2964
|
+
stderr: z.string(),
|
|
2965
|
+
/**
|
|
2966
|
+
* The bytes missing from both: the middle a device leaves out past the
|
|
2967
|
+
* 16 MiB of a job's output it keeps, and what could not be read from it.
|
|
2968
|
+
*/
|
|
2969
|
+
leftOutBytes: z.int().min(0)
|
|
2970
|
+
});
|
|
2900
2971
|
/**
|
|
2901
2972
|
* A JSON error answer: `{ code, message, params?, requestId }`, and a
|
|
2902
2973
|
* plugin's own `reason` when a plugin refused the call. The page words the
|
|
@@ -2937,6 +3008,11 @@ const errorBodySchema = z.object({
|
|
|
2937
3008
|
* directory, which the page opens rather than a second one.
|
|
2938
3009
|
*/
|
|
2939
3010
|
project: projectDtoSchema.nullable().optional(),
|
|
3011
|
+
/**
|
|
3012
|
+
* With `command_timed_out`, what the script printed before it was
|
|
3013
|
+
* stopped.
|
|
3014
|
+
*/
|
|
3015
|
+
output: execOutputSchema.nullable().optional(),
|
|
2940
3016
|
/** The request the answer is of, as its `X-Request-Id` names it. */
|
|
2941
3017
|
requestId: z.string().min(1)
|
|
2942
3018
|
});
|
|
@@ -3084,6 +3160,12 @@ const rpcInvocationSchema = z.object({
|
|
|
3084
3160
|
const workTabSchema = z.object({
|
|
3085
3161
|
id: z.string().min(1),
|
|
3086
3162
|
kind: z.string().min(1),
|
|
3163
|
+
/**
|
|
3164
|
+
* The device whose thing it shows, such as a browser's tab, a simulator
|
|
3165
|
+
* or a file of an attached device; none for a tab of no one device,
|
|
3166
|
+
* which follows the conversation's primary device.
|
|
3167
|
+
*/
|
|
3168
|
+
device: z.string().min(1).optional(),
|
|
3087
3169
|
data: z.record(z.string(), z.json())
|
|
3088
3170
|
});
|
|
3089
3171
|
const requestSchema = z.discriminatedUnion("type", [
|
|
@@ -3121,7 +3203,8 @@ const requestSchema = z.discriminatedUnion("type", [
|
|
|
3121
3203
|
user: z.string().min(1),
|
|
3122
3204
|
method: z.string(),
|
|
3123
3205
|
params: z.record(z.string(), z.json()),
|
|
3124
|
-
conversation: z.string().regex(/* @__PURE__ */ new RegExp("^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", "u")).nullable().optional()
|
|
3206
|
+
conversation: z.string().regex(/* @__PURE__ */ new RegExp("^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", "u")).nullable().optional(),
|
|
3207
|
+
device: z.string().min(1).nullable().optional()
|
|
3125
3208
|
}),
|
|
3126
3209
|
z.object({
|
|
3127
3210
|
type: z.literal("tab_closed"),
|
|
@@ -3182,12 +3265,6 @@ const storedValueSchema = z.object({
|
|
|
3182
3265
|
value: z.json(),
|
|
3183
3266
|
revision: z.int().min(0)
|
|
3184
3267
|
});
|
|
3185
|
-
/** What a plugin's package on a device last reported of a conversation. */
|
|
3186
|
-
const storedReportSchema = z.object({
|
|
3187
|
-
/** The package's own count of its changes. */
|
|
3188
|
-
revision: z.int().min(0),
|
|
3189
|
-
value: z.json()
|
|
3190
|
-
});
|
|
3191
3268
|
/**
|
|
3192
3269
|
* A conversation's work as the database keeps it: the tabs in order, and
|
|
3193
3270
|
* how many changes made them. The conversation's entry in the list carries
|
|
@@ -3691,14 +3768,18 @@ const portAnswerSchema = z.discriminatedUnion("type", [
|
|
|
3691
3768
|
type: z.literal("called"),
|
|
3692
3769
|
result: z.json()
|
|
3693
3770
|
}),
|
|
3694
|
-
z.object({
|
|
3695
|
-
type: z.literal("kept"),
|
|
3696
|
-
primary: z.boolean()
|
|
3697
|
-
}),
|
|
3698
3771
|
z.object({
|
|
3699
3772
|
type: z.literal("report"),
|
|
3700
3773
|
report: storedReportSchema.nullable().optional()
|
|
3701
3774
|
}),
|
|
3775
|
+
z.object({
|
|
3776
|
+
type: z.literal("reports"),
|
|
3777
|
+
reports: z.array(deviceReportSchema)
|
|
3778
|
+
}),
|
|
3779
|
+
z.object({
|
|
3780
|
+
type: z.literal("device"),
|
|
3781
|
+
device: z.string().min(1).nullable().optional()
|
|
3782
|
+
}),
|
|
3702
3783
|
z.object({
|
|
3703
3784
|
type: z.literal("work"),
|
|
3704
3785
|
work: workSchema
|
|
@@ -3863,7 +3944,12 @@ z.discriminatedUnion("kind", [
|
|
|
3863
3944
|
z.strictObject({
|
|
3864
3945
|
kind: z.literal("user_stream"),
|
|
3865
3946
|
conversation: z.string(),
|
|
3866
|
-
stream: z.string()
|
|
3947
|
+
stream: z.string(),
|
|
3948
|
+
device: z.string().nullable().optional()
|
|
3949
|
+
}),
|
|
3950
|
+
z.strictObject({
|
|
3951
|
+
kind: z.literal("debug"),
|
|
3952
|
+
resume: z.string().nullable().optional()
|
|
3867
3953
|
}),
|
|
3868
3954
|
z.strictObject({ kind: z.literal("starter") }),
|
|
3869
3955
|
z.strictObject({
|
|
@@ -3927,7 +4013,7 @@ z.object({
|
|
|
3927
4013
|
/**
|
|
3928
4014
|
* What a login waits for (`crates/provider-claude-code/src/account.rs`): it is
|
|
3929
4015
|
* `preparing` from its start, and `waiting_for_user` once it has a link or
|
|
3930
|
-
* a code to show. A Claude sign-in waits for the
|
|
4016
|
+
* a code to show. A Claude sign-in waits for the Subscriptions machine, for
|
|
3931
4017
|
* the CLI's install and for the CLI's start in between.
|
|
3932
4018
|
*/
|
|
3933
4019
|
const loginStageSchema = z.enum([
|
|
@@ -4392,9 +4478,18 @@ const portMessageSchema = z.discriminatedUnion("type", [
|
|
|
4392
4478
|
operation: nativeOperationSchema,
|
|
4393
4479
|
args: z.record(z.string(), z.json()),
|
|
4394
4480
|
input: z.string().optional(),
|
|
4395
|
-
kind: callKindSchema
|
|
4481
|
+
kind: callKindSchema,
|
|
4482
|
+
device: z.string().min(1).nullable().optional()
|
|
4483
|
+
}),
|
|
4484
|
+
z.strictObject({
|
|
4485
|
+
type: z.literal("read_report"),
|
|
4486
|
+
device: z.string().min(1).nullable().optional()
|
|
4487
|
+
}),
|
|
4488
|
+
z.strictObject({ type: z.literal("read_reports") }),
|
|
4489
|
+
z.strictObject({
|
|
4490
|
+
type: z.literal("read_device"),
|
|
4491
|
+
device: z.string().min(1).nullable().optional()
|
|
4396
4492
|
}),
|
|
4397
|
-
z.strictObject({ type: z.literal("read_report") }),
|
|
4398
4493
|
z.strictObject({
|
|
4399
4494
|
type: z.literal("write_report"),
|
|
4400
4495
|
device: z.string(),
|
|
@@ -4431,7 +4526,8 @@ const portMessageSchema = z.discriminatedUnion("type", [
|
|
|
4431
4526
|
z.strictObject({
|
|
4432
4527
|
type: z.literal("mirror_work_tabs"),
|
|
4433
4528
|
kind: z.string(),
|
|
4434
|
-
tabs: z.array(createWorkTabSchema)
|
|
4529
|
+
tabs: z.array(createWorkTabSchema),
|
|
4530
|
+
device: z.string().min(1).nullable().optional()
|
|
4435
4531
|
}),
|
|
4436
4532
|
z.strictObject({
|
|
4437
4533
|
type: z.literal("read_secret"),
|
|
@@ -4568,11 +4664,12 @@ const serviceTierSchema = z.object({
|
|
|
4568
4664
|
fast: z.boolean()
|
|
4569
4665
|
});
|
|
4570
4666
|
/**
|
|
4571
|
-
* How a model takes a reasoning level on the Messages API
|
|
4572
|
-
*
|
|
4573
|
-
*
|
|
4574
|
-
*
|
|
4575
|
-
*
|
|
4667
|
+
* How a model takes a reasoning level on the Messages API and on Gemini's
|
|
4668
|
+
* `generateContent`: `effort`, as the level itself (Anthropic's adaptive
|
|
4669
|
+
* thinking at the level, Gemini's thinking level of its name), or
|
|
4670
|
+
* `budget`, as the level's number of tokens. The variants carry no doc
|
|
4671
|
+
* comments of their own, which would make the schema a union that
|
|
4672
|
+
* `jush providers models` cannot take as an option.
|
|
4576
4673
|
*/
|
|
4577
4674
|
const thinkingFormSchema = z.enum(["effort", "budget"]);
|
|
4578
4675
|
/** One model of a catalog, as its source describes it. */
|
|
@@ -4599,7 +4696,7 @@ const providerModelSchema = z.object({
|
|
|
4599
4696
|
supportedThinkingEfforts: z.array(z.string()).nullable(),
|
|
4600
4697
|
/**
|
|
4601
4698
|
* Whether thinking can be turned off entirely; a transport that only
|
|
4602
|
-
* levels thinking says no.
|
|
4699
|
+
* levels thinking, or a model that always thinks, says no.
|
|
4603
4700
|
*/
|
|
4604
4701
|
canDisableThinking: z.boolean().nullable(),
|
|
4605
4702
|
/**
|
|
@@ -4611,7 +4708,10 @@ const providerModelSchema = z.object({
|
|
|
4611
4708
|
defaultServiceTierId: z.string().nullable(),
|
|
4612
4709
|
/** Prices as the source reports them. */
|
|
4613
4710
|
cost: modelCostSchema.nullable(),
|
|
4614
|
-
/**
|
|
4711
|
+
/**
|
|
4712
|
+
* On the Messages API and Gemini's, how a reasoning level goes
|
|
4713
|
+
* ([`ModelWire`]).
|
|
4714
|
+
*/
|
|
4615
4715
|
thinkingForm: thinkingFormSchema.optional(),
|
|
4616
4716
|
/**
|
|
4617
4717
|
* On Chat Completions, whether the model's earlier thinking goes back
|
|
@@ -5271,6 +5371,15 @@ const accountsSchema = z.object({
|
|
|
5271
5371
|
z.strictObject({ credentialId: z.string().min(1) });
|
|
5272
5372
|
/** `{ active }`: the account the entry now infers with. */
|
|
5273
5373
|
const activeAccountSchema = z.object({ active: z.string().min(1) });
|
|
5374
|
+
/**
|
|
5375
|
+
* An agent's turn: the agent, whose node is the conversation's id for its
|
|
5376
|
+
* root, and the turn, whose id for a turn a message started is the
|
|
5377
|
+
* message's.
|
|
5378
|
+
*/
|
|
5379
|
+
const agentTurnSchema = z.object({
|
|
5380
|
+
node: z.string().min(1),
|
|
5381
|
+
turn: z.string().min(1)
|
|
5382
|
+
});
|
|
5274
5383
|
/** Whether the page follows the system's light or dark scheme or fixes one. */
|
|
5275
5384
|
const themeSchema = z.enum([
|
|
5276
5385
|
"system",
|
|
@@ -5510,6 +5619,201 @@ const conversationStatusSchema = z.enum([
|
|
|
5510
5619
|
* is green for an answer and red for an error.
|
|
5511
5620
|
*/
|
|
5512
5621
|
const unreadEndSchema = z.enum(["answered", "failed"]);
|
|
5622
|
+
/** The unit a repeat's cycle counts in. */
|
|
5623
|
+
const repeatUnitSchema = z.enum([
|
|
5624
|
+
"days",
|
|
5625
|
+
"weeks",
|
|
5626
|
+
"months",
|
|
5627
|
+
"years"
|
|
5628
|
+
]);
|
|
5629
|
+
/**
|
|
5630
|
+
* A repeating cycle, as Calendar's repeat: every `every` days, weeks,
|
|
5631
|
+
* months or years. A cycle of several units counts from the day, week,
|
|
5632
|
+
* month or year of `start`, its first cycle, and runs its tasks in each
|
|
5633
|
+
* cycle's first unit.
|
|
5634
|
+
*/
|
|
5635
|
+
const repeatSchema = z.object({
|
|
5636
|
+
every: z.int().min(1).max(4294967295),
|
|
5637
|
+
unit: repeatUnitSchema,
|
|
5638
|
+
/**
|
|
5639
|
+
* The first cycle's day, as `2026-01-01`, for a cycle of several
|
|
5640
|
+
* units; null for one unit.
|
|
5641
|
+
*/
|
|
5642
|
+
start: z.string().nullable()
|
|
5643
|
+
});
|
|
5644
|
+
/** A day of the week, as a weekly task names the days it runs on. */
|
|
5645
|
+
const weekdaySchema = z.enum([
|
|
5646
|
+
"mon",
|
|
5647
|
+
"tue",
|
|
5648
|
+
"wed",
|
|
5649
|
+
"thu",
|
|
5650
|
+
"fri",
|
|
5651
|
+
"sat",
|
|
5652
|
+
"sun"
|
|
5653
|
+
]);
|
|
5654
|
+
/** Which of a month's weekdays. */
|
|
5655
|
+
const weekOfMonthSchema = z.enum([
|
|
5656
|
+
"first",
|
|
5657
|
+
"second",
|
|
5658
|
+
"third",
|
|
5659
|
+
"fourth",
|
|
5660
|
+
"last"
|
|
5661
|
+
]);
|
|
5662
|
+
/** The first or the last. */
|
|
5663
|
+
const firstOrLastSchema = z.enum(["first", "last"]);
|
|
5664
|
+
/**
|
|
5665
|
+
* A day of a month: a date, which a month without it skips; the last day;
|
|
5666
|
+
* a weekday's first to fourth or last; or the first or last working day.
|
|
5667
|
+
*/
|
|
5668
|
+
const monthDaySchema = z.discriminatedUnion("kind", [
|
|
5669
|
+
z.object({
|
|
5670
|
+
kind: z.literal("date"),
|
|
5671
|
+
date: z.int().min(1).max(31)
|
|
5672
|
+
}),
|
|
5673
|
+
z.object({ kind: z.literal("last_day") }),
|
|
5674
|
+
z.object({
|
|
5675
|
+
kind: z.literal("weekday"),
|
|
5676
|
+
week: weekOfMonthSchema,
|
|
5677
|
+
weekday: weekdaySchema
|
|
5678
|
+
}),
|
|
5679
|
+
z.object({
|
|
5680
|
+
kind: z.literal("working_day"),
|
|
5681
|
+
which: firstOrLastSchema
|
|
5682
|
+
})
|
|
5683
|
+
]);
|
|
5684
|
+
/**
|
|
5685
|
+
* A country by its ISO 3166 code, and one of its regions whose holidays
|
|
5686
|
+
* differ, by the code the holidays' table gives it.
|
|
5687
|
+
*/
|
|
5688
|
+
const holidayPlaceSchema = z.object({
|
|
5689
|
+
country: z.string().min(2).max(3),
|
|
5690
|
+
region: z.string().nullable()
|
|
5691
|
+
});
|
|
5692
|
+
/**
|
|
5693
|
+
* A task of a repeat: a moment in its cycle and the message it sends.
|
|
5694
|
+
*
|
|
5695
|
+
* Its moment is `time` and, as the repeat's unit asks, `days` (weeks),
|
|
5696
|
+
* `day` (months), or `month` and `day` (years); the parts another unit
|
|
5697
|
+
* reads are kept, so a repeat changed back finds them as they were.
|
|
5698
|
+
*/
|
|
5699
|
+
const taskSchema = z.object({
|
|
5700
|
+
/** Unique among the repeat's tasks; the page or the command makes it. */
|
|
5701
|
+
id: z.string().min(1),
|
|
5702
|
+
/** A clock time as `09:00`. */
|
|
5703
|
+
time: z.string().regex(/* @__PURE__ */ new RegExp("^([01][0-9]|2[0-3]):[0-5][0-9]$", "u")),
|
|
5704
|
+
/** One to seven distinct days. */
|
|
5705
|
+
days: z.array(weekdaySchema).min(1).max(7),
|
|
5706
|
+
day: monthDaySchema,
|
|
5707
|
+
/** 1 to 12. */
|
|
5708
|
+
month: z.int().min(1).max(12),
|
|
5709
|
+
/**
|
|
5710
|
+
* The country, and its region, whose working week and public
|
|
5711
|
+
* holidays a first or last working day follows; null for Monday to
|
|
5712
|
+
* Friday.
|
|
5713
|
+
*/
|
|
5714
|
+
holidays: holidayPlaceSchema.nullable(),
|
|
5715
|
+
/** Empty until written; a task without a message does not run. */
|
|
5716
|
+
prompt: z.string()
|
|
5717
|
+
});
|
|
5718
|
+
/** When a time trigger fires, in the schedule's time zone. */
|
|
5719
|
+
const timingSchema = z.discriminatedUnion("kind", [
|
|
5720
|
+
z.object({
|
|
5721
|
+
kind: z.literal("once"),
|
|
5722
|
+
at: z.iso.datetime({ precision: 3 })
|
|
5723
|
+
}),
|
|
5724
|
+
z.object({
|
|
5725
|
+
kind: z.literal("repeat"),
|
|
5726
|
+
repeat: repeatSchema,
|
|
5727
|
+
tasks: z.array(taskSchema).min(1)
|
|
5728
|
+
}),
|
|
5729
|
+
z.object({
|
|
5730
|
+
kind: z.literal("every"),
|
|
5731
|
+
minutes: z.int().min(1).max(4294967295)
|
|
5732
|
+
}),
|
|
5733
|
+
z.object({
|
|
5734
|
+
kind: z.literal("cron"),
|
|
5735
|
+
expression: z.string().min(9)
|
|
5736
|
+
})
|
|
5737
|
+
]);
|
|
5738
|
+
/** What starts a schedule's runs. */
|
|
5739
|
+
const triggerSchema = z.discriminatedUnion("kind", [
|
|
5740
|
+
z.object({
|
|
5741
|
+
kind: z.literal("time"),
|
|
5742
|
+
timing: timingSchema
|
|
5743
|
+
}),
|
|
5744
|
+
z.object({
|
|
5745
|
+
kind: z.literal("change"),
|
|
5746
|
+
command: z.string().min(1),
|
|
5747
|
+
everyMinutes: z.int().min(1).max(4294967295)
|
|
5748
|
+
}),
|
|
5749
|
+
z.object({ kind: z.literal("url") }),
|
|
5750
|
+
z.object({
|
|
5751
|
+
kind: z.literal("done"),
|
|
5752
|
+
conversation: z.string().regex(/* @__PURE__ */ new RegExp("^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", "u"))
|
|
5753
|
+
})
|
|
5754
|
+
]);
|
|
5755
|
+
/** Where a run stands. */
|
|
5756
|
+
const runStateSchema = z.enum([
|
|
5757
|
+
"running",
|
|
5758
|
+
"done",
|
|
5759
|
+
"skipped",
|
|
5760
|
+
"failed",
|
|
5761
|
+
"notified"
|
|
5762
|
+
]);
|
|
5763
|
+
/** Why a run was skipped or failed, which the page words. */
|
|
5764
|
+
const runNoteSchema = z.discriminatedUnion("kind", [
|
|
5765
|
+
z.object({
|
|
5766
|
+
kind: z.literal("offline"),
|
|
5767
|
+
device: z.string()
|
|
5768
|
+
}),
|
|
5769
|
+
z.object({
|
|
5770
|
+
kind: z.literal("limit"),
|
|
5771
|
+
limit: z.int().min(0).max(4294967295),
|
|
5772
|
+
calls: z.int().min(0).max(4294967295)
|
|
5773
|
+
}),
|
|
5774
|
+
z.object({ kind: z.literal("command_timed_out") }),
|
|
5775
|
+
z.object({
|
|
5776
|
+
kind: z.literal("command_failed"),
|
|
5777
|
+
message: z.string()
|
|
5778
|
+
}),
|
|
5779
|
+
z.object({
|
|
5780
|
+
kind: z.literal("turn_failed"),
|
|
5781
|
+
message: z.string(),
|
|
5782
|
+
code: z.string().nullable()
|
|
5783
|
+
})
|
|
5784
|
+
]);
|
|
5785
|
+
/** How a schedule last woke its conversation. */
|
|
5786
|
+
const lastRunSchema = z.object({
|
|
5787
|
+
at: z.iso.datetime({ precision: 3 }),
|
|
5788
|
+
state: runStateSchema,
|
|
5789
|
+
/** Why it was skipped or failed. */
|
|
5790
|
+
note: runNoteSchema.nullable()
|
|
5791
|
+
});
|
|
5792
|
+
/**
|
|
5793
|
+
* A schedule of a conversation as its Schedules menu lists it: what wakes
|
|
5794
|
+
* the conversation, when it next will, and how it last did. The user pauses,
|
|
5795
|
+
* resumes and deletes it there; the agent and a program do the rest.
|
|
5796
|
+
*/
|
|
5797
|
+
const conversationScheduleSchema = z.object({
|
|
5798
|
+
id: z.string().min(1),
|
|
5799
|
+
name: z.string(),
|
|
5800
|
+
trigger: triggerSchema,
|
|
5801
|
+
/** The IANA time zone its times are read in. */
|
|
5802
|
+
timeZone: z.string(),
|
|
5803
|
+
/**
|
|
5804
|
+
* Whether the user or the agent paused it. A schedule of an archived
|
|
5805
|
+
* conversation wakes nothing either, which the conversation's own
|
|
5806
|
+
* archived state says.
|
|
5807
|
+
*/
|
|
5808
|
+
paused: z.boolean(),
|
|
5809
|
+
/**
|
|
5810
|
+
* When it next wakes the conversation; null while paused, while its
|
|
5811
|
+
* conversation is archived, with no time left, and for a URL.
|
|
5812
|
+
*/
|
|
5813
|
+
nextAt: z.iso.datetime({ precision: 3 }).nullable(),
|
|
5814
|
+
/** Its last run; null before it woke the conversation. */
|
|
5815
|
+
lastRun: lastRunSchema.nullable()
|
|
5816
|
+
});
|
|
5513
5817
|
/**
|
|
5514
5818
|
* A conversation as the list carries it: what the sidebar shows of it, and
|
|
5515
5819
|
* its work's tabs, which the page draws before it opens the
|
|
@@ -5567,10 +5871,11 @@ const conversationSummarySchema = z.object({
|
|
|
5567
5871
|
*/
|
|
5568
5872
|
unreadPermissionRequests: z.int().min(0),
|
|
5569
5873
|
/**
|
|
5570
|
-
*
|
|
5571
|
-
* an alarm clock
|
|
5874
|
+
* The schedules that wake the conversation, newest first: the sidebar
|
|
5875
|
+
* marks a conversation that has one with an alarm clock, and its
|
|
5876
|
+
* Schedules menu lists them.
|
|
5572
5877
|
*/
|
|
5573
|
-
|
|
5878
|
+
schedules: z.array(conversationScheduleSchema),
|
|
5574
5879
|
/**
|
|
5575
5880
|
* The conversation's work: its tabs under the revision that counts
|
|
5576
5881
|
* its changes. The page draws the work's frame and tabs from it as soon
|
|
@@ -5731,7 +6036,7 @@ const catalogModelSchema = z.object({
|
|
|
5731
6036
|
supportedThinkingEfforts: z.array(z.string()).nullable(),
|
|
5732
6037
|
/**
|
|
5733
6038
|
* Whether thinking can be turned off entirely; a transport that only
|
|
5734
|
-
* levels thinking says no.
|
|
6039
|
+
* levels thinking, or a model that always thinks, says no.
|
|
5735
6040
|
*/
|
|
5736
6041
|
canDisableThinking: z.boolean().nullable(),
|
|
5737
6042
|
/**
|
|
@@ -5743,7 +6048,10 @@ const catalogModelSchema = z.object({
|
|
|
5743
6048
|
defaultServiceTierId: z.string().nullable(),
|
|
5744
6049
|
/** Prices as the source reports them. */
|
|
5745
6050
|
cost: modelCostSchema.nullable(),
|
|
5746
|
-
/**
|
|
6051
|
+
/**
|
|
6052
|
+
* On the Messages API and Gemini's, how a reasoning level goes
|
|
6053
|
+
* ([`ModelWire`]).
|
|
6054
|
+
*/
|
|
5747
6055
|
thinkingForm: thinkingFormSchema.optional(),
|
|
5748
6056
|
/**
|
|
5749
6057
|
* On Chat Completions, whether the model's earlier thinking goes back
|
|
@@ -5776,10 +6084,10 @@ const catalogProviderSchema = z.object({
|
|
|
5776
6084
|
providerId: z.string().min(1),
|
|
5777
6085
|
displayName: z.string(),
|
|
5778
6086
|
/**
|
|
5779
|
-
* The
|
|
6087
|
+
* The name of the subscription's CLI the provider's requests run as a
|
|
5780
6088
|
* process; null when its requests are HTTP.
|
|
5781
6089
|
*/
|
|
5782
|
-
|
|
6090
|
+
cliName: z.string().nullable(),
|
|
5783
6091
|
models: z.array(catalogModelSchema),
|
|
5784
6092
|
/**
|
|
5785
6093
|
* The image models the entry offers, newest first: a vendor entry's
|
|
@@ -6266,8 +6574,8 @@ const configuredModelSchema = z.object({
|
|
|
6266
6574
|
/** The service tier the model's Fast is; null for none. */
|
|
6267
6575
|
fastTier: z.string().min(1).nullable(),
|
|
6268
6576
|
/**
|
|
6269
|
-
* On the Messages API, how a reasoning level goes; Effort
|
|
6270
|
-
* what every model stored before it was sent.
|
|
6577
|
+
* On the Messages API and Gemini's, how a reasoning level goes; Effort
|
|
6578
|
+
* when absent, what every model stored before it was sent.
|
|
6271
6579
|
*/
|
|
6272
6580
|
thinkingForm: thinkingFormSchema.optional(),
|
|
6273
6581
|
/**
|
|
@@ -6407,268 +6715,73 @@ const credentialFieldSchema = z.object({
|
|
|
6407
6715
|
label: z.string().trim().min(1),
|
|
6408
6716
|
kind: fieldKindSchema
|
|
6409
6717
|
});
|
|
6410
|
-
/**
|
|
6411
|
-
* How long a credential is kept: a time from when it is saved, or until
|
|
6412
|
-
* the user removes it.
|
|
6413
|
-
*/
|
|
6414
|
-
const keepSchema = z.enum([
|
|
6415
|
-
"1h",
|
|
6416
|
-
"1d",
|
|
6417
|
-
"30d",
|
|
6418
|
-
"always"
|
|
6419
|
-
]);
|
|
6420
|
-
/**
|
|
6421
|
-
* One undecided request of a conversation, by its `kind`: what its agent
|
|
6422
|
-
* asks of the user, the command it ran, and who ran it.
|
|
6423
|
-
*/
|
|
6424
|
-
const permissionRequestSchema = z.discriminatedUnion("kind", [
|
|
6425
|
-
z.object({
|
|
6426
|
-
kind: z.literal("permission"),
|
|
6427
|
-
id: z.string().min(1),
|
|
6428
|
-
/** The category the call lacked. */
|
|
6429
|
-
categories: z.array(permissionCategorySchema),
|
|
6430
|
-
/** The command line as the agent ran it, quoted for a POSIX shell. */
|
|
6431
|
-
command: z.string(),
|
|
6432
|
-
/** The subagent that ran it; null for the root. */
|
|
6433
|
-
agent: requestingAgentSchema.nullable(),
|
|
6434
|
-
createdAt: z.iso.datetime({ precision: 3 })
|
|
6435
|
-
}),
|
|
6436
|
-
z.object({
|
|
6437
|
-
kind: z.literal("device"),
|
|
6438
|
-
id: z.string().min(1),
|
|
6439
|
-
device: requestedDeviceSchema,
|
|
6440
|
-
/** The command line as the agent ran it, quoted for a POSIX shell. */
|
|
6441
|
-
command: z.string(),
|
|
6442
|
-
/** The subagent that ran it; null for the root. */
|
|
6443
|
-
agent: requestingAgentSchema.nullable(),
|
|
6444
|
-
createdAt: z.iso.datetime({ precision: 3 })
|
|
6445
|
-
}),
|
|
6446
|
-
z.object({
|
|
6447
|
-
kind: z.literal("credential"),
|
|
6448
|
-
id: z.string().min(1),
|
|
6449
|
-
name: z.string(),
|
|
6450
|
-
/** Why the agent asks; empty when it gave no reason. */
|
|
6451
|
-
reason: z.string(),
|
|
6452
|
-
fields: z.array(credentialFieldSchema),
|
|
6453
|
-
/**
|
|
6454
|
-
* How long the credential is kept once saved, as the agent
|
|
6455
|
-
* decided; the card says it.
|
|
6456
|
-
*/
|
|
6457
|
-
keep: keepSchema,
|
|
6458
|
-
/**
|
|
6459
|
-
* It asks new values for a saved credential of its name, whatever
|
|
6460
|
-
* the name's case.
|
|
6461
|
-
*/
|
|
6462
|
-
renewal: z.boolean(),
|
|
6463
|
-
/** The command line as the agent ran it, quoted for a POSIX shell. */
|
|
6464
|
-
command: z.string(),
|
|
6465
|
-
/** The subagent that ran it; null for the root. */
|
|
6466
|
-
agent: requestingAgentSchema.nullable(),
|
|
6467
|
-
createdAt: z.iso.datetime({ precision: 3 })
|
|
6468
|
-
})
|
|
6469
|
-
]);
|
|
6470
|
-
/**
|
|
6471
|
-
* A conversation's undecided requests, oldest first, with the revision they
|
|
6472
|
-
* were read at, as its metadata carries them.
|
|
6473
|
-
*/
|
|
6474
|
-
const conversationPermissionsSchema = z.object({
|
|
6475
|
-
revision: z.int().min(0),
|
|
6476
|
-
requests: z.array(permissionRequestSchema)
|
|
6477
|
-
});
|
|
6478
|
-
/** The unit a repeat's cycle counts in. */
|
|
6479
|
-
const repeatUnitSchema = z.enum([
|
|
6480
|
-
"days",
|
|
6481
|
-
"weeks",
|
|
6482
|
-
"months",
|
|
6483
|
-
"years"
|
|
6484
|
-
]);
|
|
6485
|
-
/**
|
|
6486
|
-
* A repeating cycle, as Calendar's repeat: every `every` days, weeks,
|
|
6487
|
-
* months or years. A cycle of several units counts from the day, week,
|
|
6488
|
-
* month or year of `start`, its first cycle, and runs its tasks in each
|
|
6489
|
-
* cycle's first unit.
|
|
6490
|
-
*/
|
|
6491
|
-
const repeatSchema = z.object({
|
|
6492
|
-
every: z.int().min(1).max(4294967295),
|
|
6493
|
-
unit: repeatUnitSchema,
|
|
6494
|
-
/**
|
|
6495
|
-
* The first cycle's day, as `2026-01-01`, for a cycle of several
|
|
6496
|
-
* units; null for one unit.
|
|
6497
|
-
*/
|
|
6498
|
-
start: z.string().nullable()
|
|
6499
|
-
});
|
|
6500
|
-
/** A day of the week, as a weekly task names the days it runs on. */
|
|
6501
|
-
const weekdaySchema = z.enum([
|
|
6502
|
-
"mon",
|
|
6503
|
-
"tue",
|
|
6504
|
-
"wed",
|
|
6505
|
-
"thu",
|
|
6506
|
-
"fri",
|
|
6507
|
-
"sat",
|
|
6508
|
-
"sun"
|
|
6509
|
-
]);
|
|
6510
|
-
/** Which of a month's weekdays. */
|
|
6511
|
-
const weekOfMonthSchema = z.enum([
|
|
6512
|
-
"first",
|
|
6513
|
-
"second",
|
|
6514
|
-
"third",
|
|
6515
|
-
"fourth",
|
|
6516
|
-
"last"
|
|
6517
|
-
]);
|
|
6518
|
-
/** The first or the last. */
|
|
6519
|
-
const firstOrLastSchema = z.enum(["first", "last"]);
|
|
6520
|
-
/**
|
|
6521
|
-
* A day of a month: a date, which a month without it skips; the last day;
|
|
6522
|
-
* a weekday's first to fourth or last; or the first or last working day.
|
|
6523
|
-
*/
|
|
6524
|
-
const monthDaySchema = z.discriminatedUnion("kind", [
|
|
6525
|
-
z.object({
|
|
6526
|
-
kind: z.literal("date"),
|
|
6527
|
-
date: z.int().min(1).max(31)
|
|
6528
|
-
}),
|
|
6529
|
-
z.object({ kind: z.literal("last_day") }),
|
|
6530
|
-
z.object({
|
|
6531
|
-
kind: z.literal("weekday"),
|
|
6532
|
-
week: weekOfMonthSchema,
|
|
6533
|
-
weekday: weekdaySchema
|
|
6534
|
-
}),
|
|
6535
|
-
z.object({
|
|
6536
|
-
kind: z.literal("working_day"),
|
|
6537
|
-
which: firstOrLastSchema
|
|
6538
|
-
})
|
|
6539
|
-
]);
|
|
6540
|
-
/**
|
|
6541
|
-
* A country by its ISO 3166 code, and one of its regions whose holidays
|
|
6542
|
-
* differ, by the code the holidays' table gives it.
|
|
6543
|
-
*/
|
|
6544
|
-
const holidayPlaceSchema = z.object({
|
|
6545
|
-
country: z.string().min(2).max(3),
|
|
6546
|
-
region: z.string().nullable()
|
|
6547
|
-
});
|
|
6548
|
-
/**
|
|
6549
|
-
* A task of a repeat: a moment in its cycle and the message it sends.
|
|
6550
|
-
*
|
|
6551
|
-
* Its moment is `time` and, as the repeat's unit asks, `days` (weeks),
|
|
6552
|
-
* `day` (months), or `month` and `day` (years); the parts another unit
|
|
6553
|
-
* reads are kept, so a repeat changed back finds them as they were.
|
|
6554
|
-
*/
|
|
6555
|
-
const taskSchema = z.object({
|
|
6556
|
-
/** Unique among the repeat's tasks; the page or the command makes it. */
|
|
6557
|
-
id: z.string().min(1),
|
|
6558
|
-
/** A clock time as `09:00`. */
|
|
6559
|
-
time: z.string().regex(/* @__PURE__ */ new RegExp("^([01][0-9]|2[0-3]):[0-5][0-9]$", "u")),
|
|
6560
|
-
/** One to seven distinct days. */
|
|
6561
|
-
days: z.array(weekdaySchema).min(1).max(7),
|
|
6562
|
-
day: monthDaySchema,
|
|
6563
|
-
/** 1 to 12. */
|
|
6564
|
-
month: z.int().min(1).max(12),
|
|
6565
|
-
/**
|
|
6566
|
-
* The country, and its region, whose working week and public
|
|
6567
|
-
* holidays a first or last working day follows; null for Monday to
|
|
6568
|
-
* Friday.
|
|
6569
|
-
*/
|
|
6570
|
-
holidays: holidayPlaceSchema.nullable(),
|
|
6571
|
-
/** Empty until written; a task without a message does not run. */
|
|
6572
|
-
prompt: z.string()
|
|
6573
|
-
});
|
|
6574
|
-
/** When a time trigger fires, in the schedule's time zone. */
|
|
6575
|
-
const timingSchema = z.discriminatedUnion("kind", [
|
|
6576
|
-
z.object({
|
|
6577
|
-
kind: z.literal("once"),
|
|
6578
|
-
at: z.iso.datetime({ precision: 3 })
|
|
6579
|
-
}),
|
|
6580
|
-
z.object({
|
|
6581
|
-
kind: z.literal("repeat"),
|
|
6582
|
-
repeat: repeatSchema,
|
|
6583
|
-
tasks: z.array(taskSchema).min(1)
|
|
6584
|
-
}),
|
|
6585
|
-
z.object({
|
|
6586
|
-
kind: z.literal("every"),
|
|
6587
|
-
minutes: z.int().min(1).max(4294967295)
|
|
6588
|
-
}),
|
|
6589
|
-
z.object({
|
|
6590
|
-
kind: z.literal("cron"),
|
|
6591
|
-
expression: z.string().min(9)
|
|
6592
|
-
})
|
|
6593
|
-
]);
|
|
6594
|
-
/** What starts a schedule's runs. */
|
|
6595
|
-
const triggerSchema = z.discriminatedUnion("kind", [
|
|
6596
|
-
z.object({
|
|
6597
|
-
kind: z.literal("time"),
|
|
6598
|
-
timing: timingSchema
|
|
6599
|
-
}),
|
|
6600
|
-
z.object({
|
|
6601
|
-
kind: z.literal("change"),
|
|
6602
|
-
command: z.string().min(1),
|
|
6603
|
-
everyMinutes: z.int().min(1).max(4294967295)
|
|
6604
|
-
}),
|
|
6605
|
-
z.object({ kind: z.literal("url") }),
|
|
6606
|
-
z.object({
|
|
6607
|
-
kind: z.literal("done"),
|
|
6608
|
-
conversation: z.string().regex(/* @__PURE__ */ new RegExp("^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", "u"))
|
|
6609
|
-
})
|
|
6610
|
-
]);
|
|
6611
|
-
/** Where a run stands. */
|
|
6612
|
-
const runStateSchema = z.enum([
|
|
6613
|
-
"running",
|
|
6614
|
-
"done",
|
|
6615
|
-
"skipped",
|
|
6616
|
-
"failed",
|
|
6617
|
-
"notified"
|
|
6718
|
+
/**
|
|
6719
|
+
* How long a credential is kept: a time from when it is saved, or until
|
|
6720
|
+
* the user removes it.
|
|
6721
|
+
*/
|
|
6722
|
+
const keepSchema = z.enum([
|
|
6723
|
+
"1h",
|
|
6724
|
+
"1d",
|
|
6725
|
+
"30d",
|
|
6726
|
+
"always"
|
|
6618
6727
|
]);
|
|
6619
|
-
/**
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
}),
|
|
6728
|
+
/**
|
|
6729
|
+
* One undecided request of a conversation, by its `kind`: what its agent
|
|
6730
|
+
* asks of the user, the command it ran, and who ran it.
|
|
6731
|
+
*/
|
|
6732
|
+
const permissionRequestSchema = z.discriminatedUnion("kind", [
|
|
6625
6733
|
z.object({
|
|
6626
|
-
kind: z.literal("
|
|
6627
|
-
|
|
6628
|
-
|
|
6734
|
+
kind: z.literal("permission"),
|
|
6735
|
+
id: z.string().min(1),
|
|
6736
|
+
/** The category the call lacked. */
|
|
6737
|
+
categories: z.array(permissionCategorySchema),
|
|
6738
|
+
/** The command line as the agent ran it, quoted for a POSIX shell. */
|
|
6739
|
+
command: z.string(),
|
|
6740
|
+
/** The subagent that ran it; null for the root. */
|
|
6741
|
+
agent: requestingAgentSchema.nullable(),
|
|
6742
|
+
createdAt: z.iso.datetime({ precision: 3 })
|
|
6629
6743
|
}),
|
|
6630
|
-
z.object({ kind: z.literal("command_timed_out") }),
|
|
6631
6744
|
z.object({
|
|
6632
|
-
kind: z.literal("
|
|
6633
|
-
|
|
6745
|
+
kind: z.literal("device"),
|
|
6746
|
+
id: z.string().min(1),
|
|
6747
|
+
device: requestedDeviceSchema,
|
|
6748
|
+
/** The command line as the agent ran it, quoted for a POSIX shell. */
|
|
6749
|
+
command: z.string(),
|
|
6750
|
+
/** The subagent that ran it; null for the root. */
|
|
6751
|
+
agent: requestingAgentSchema.nullable(),
|
|
6752
|
+
createdAt: z.iso.datetime({ precision: 3 })
|
|
6634
6753
|
}),
|
|
6635
6754
|
z.object({
|
|
6636
|
-
kind: z.literal("
|
|
6637
|
-
|
|
6638
|
-
|
|
6755
|
+
kind: z.literal("credential"),
|
|
6756
|
+
id: z.string().min(1),
|
|
6757
|
+
name: z.string(),
|
|
6758
|
+
/** Why the agent asks; empty when it gave no reason. */
|
|
6759
|
+
reason: z.string(),
|
|
6760
|
+
fields: z.array(credentialFieldSchema),
|
|
6761
|
+
/**
|
|
6762
|
+
* How long the credential is kept once saved, as the agent
|
|
6763
|
+
* decided; the card says it.
|
|
6764
|
+
*/
|
|
6765
|
+
keep: keepSchema,
|
|
6766
|
+
/**
|
|
6767
|
+
* It asks new values for a saved credential of its name, whatever
|
|
6768
|
+
* the name's case.
|
|
6769
|
+
*/
|
|
6770
|
+
renewal: z.boolean(),
|
|
6771
|
+
/** The command line as the agent ran it, quoted for a POSIX shell. */
|
|
6772
|
+
command: z.string(),
|
|
6773
|
+
/** The subagent that ran it; null for the root. */
|
|
6774
|
+
agent: requestingAgentSchema.nullable(),
|
|
6775
|
+
createdAt: z.iso.datetime({ precision: 3 })
|
|
6639
6776
|
})
|
|
6640
6777
|
]);
|
|
6641
|
-
/** How a schedule last woke its conversation. */
|
|
6642
|
-
const lastRunSchema = z.object({
|
|
6643
|
-
at: z.iso.datetime({ precision: 3 }),
|
|
6644
|
-
state: runStateSchema,
|
|
6645
|
-
/** Why it was skipped or failed. */
|
|
6646
|
-
note: runNoteSchema.nullable()
|
|
6647
|
-
});
|
|
6648
6778
|
/**
|
|
6649
|
-
* A
|
|
6650
|
-
*
|
|
6651
|
-
* resumes and deletes it there; the agent does the rest.
|
|
6779
|
+
* A conversation's undecided requests, oldest first, with the revision they
|
|
6780
|
+
* were read at, as its metadata carries them.
|
|
6652
6781
|
*/
|
|
6653
|
-
const
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
trigger: triggerSchema,
|
|
6657
|
-
/** The IANA time zone its times are read in. */
|
|
6658
|
-
timeZone: z.string(),
|
|
6659
|
-
/**
|
|
6660
|
-
* Whether the user or the agent paused it. A schedule of an archived
|
|
6661
|
-
* conversation wakes nothing either, which the conversation's own
|
|
6662
|
-
* archived state says.
|
|
6663
|
-
*/
|
|
6664
|
-
paused: z.boolean(),
|
|
6665
|
-
/**
|
|
6666
|
-
* When it next wakes the conversation; null while paused, while its
|
|
6667
|
-
* conversation is archived, with no time left, and for a URL.
|
|
6668
|
-
*/
|
|
6669
|
-
nextAt: z.iso.datetime({ precision: 3 }).nullable(),
|
|
6670
|
-
/** Its last run; null before it woke the conversation. */
|
|
6671
|
-
lastRun: lastRunSchema.nullable()
|
|
6782
|
+
const conversationPermissionsSchema = z.object({
|
|
6783
|
+
revision: z.int().min(0),
|
|
6784
|
+
requests: z.array(permissionRequestSchema)
|
|
6672
6785
|
});
|
|
6673
6786
|
/**
|
|
6674
6787
|
* A command a `shell` call left running, its call having returned while it
|
|
@@ -6799,8 +6912,6 @@ const conversationMetadataSchema = z.object({
|
|
|
6799
6912
|
* that rises with each change of them in this run of the backend.
|
|
6800
6913
|
*/
|
|
6801
6914
|
permissions: conversationPermissionsSchema,
|
|
6802
|
-
/** The conversation's schedules, which wake it, newest first. */
|
|
6803
|
-
schedules: z.array(conversationScheduleSchema),
|
|
6804
6915
|
/**
|
|
6805
6916
|
* The commands the calls on the conversation's current path left
|
|
6806
6917
|
* running that ended, its root's and those of the subagents on that
|
|
@@ -6916,6 +7027,16 @@ const conversationFilesSchema = z.object({
|
|
|
6916
7027
|
cacheBytes: z.int().min(0),
|
|
6917
7028
|
lastUsedAt: z.iso.datetime({ precision: 3 }).nullable()
|
|
6918
7029
|
});
|
|
7030
|
+
/** How one top-level field of a value changed. */
|
|
7031
|
+
const fieldChangeSchema = z.discriminatedUnion("kind", [z.object({
|
|
7032
|
+
kind: z.literal("set"),
|
|
7033
|
+
value: z.json()
|
|
7034
|
+
}), z.object({
|
|
7035
|
+
kind: z.literal("splice"),
|
|
7036
|
+
at: z.int().min(0).max(4294967295),
|
|
7037
|
+
remove: z.int().min(0).max(4294967295),
|
|
7038
|
+
insert: z.array(z.json())
|
|
7039
|
+
})]);
|
|
6919
7040
|
/**
|
|
6920
7041
|
* A message saved for later as the composer lists it. Its whole text is
|
|
6921
7042
|
* `GET /conversations/:id/saved/:messageId`, read when the message is used.
|
|
@@ -7061,6 +7182,12 @@ const conversationFrameSchema = z.discriminatedUnion("type", [
|
|
|
7061
7182
|
metadata: conversationMetadataSchema,
|
|
7062
7183
|
etag: z.string()
|
|
7063
7184
|
}),
|
|
7185
|
+
z.object({
|
|
7186
|
+
type: z.literal("metadata_changed"),
|
|
7187
|
+
base: z.string(),
|
|
7188
|
+
etag: z.string(),
|
|
7189
|
+
fields: z.record(z.string(), fieldChangeSchema)
|
|
7190
|
+
}),
|
|
7064
7191
|
z.object({
|
|
7065
7192
|
type: z.literal("draft"),
|
|
7066
7193
|
draft: conversationDraftSchema
|
|
@@ -7506,10 +7633,10 @@ const providerDetailsSchema = z.object({
|
|
|
7506
7633
|
quota: quotaSnapshotSchema.nullable(),
|
|
7507
7634
|
quotaCapability: quotaCapabilitySchema,
|
|
7508
7635
|
/**
|
|
7509
|
-
* The
|
|
7510
|
-
* process, such as `
|
|
7636
|
+
* The name of the subscription's CLI the provider's requests run as a
|
|
7637
|
+
* process, such as `Claude Code`; null when its requests are HTTP.
|
|
7511
7638
|
*/
|
|
7512
|
-
|
|
7639
|
+
cliName: z.string().nullable()
|
|
7513
7640
|
});
|
|
7514
7641
|
/** What the backend read of an entry's provider when it answered. */
|
|
7515
7642
|
const providerReadingSchema = z.discriminatedUnion("type", [providerDetailsSchema.extend({ type: z.literal("read") }), z.object({
|
|
@@ -7581,6 +7708,11 @@ const providerStateSchema = z.object({
|
|
|
7581
7708
|
*/
|
|
7582
7709
|
connectsThrough: z.boolean(),
|
|
7583
7710
|
/**
|
|
7711
|
+
* Whether its vendor's terms forbid its subscription through
|
|
7712
|
+
* third-party software, which Settings says before an account is added.
|
|
7713
|
+
*/
|
|
7714
|
+
forbidsThirdParty: z.boolean(),
|
|
7715
|
+
/**
|
|
7584
7716
|
* The headers every request of the entry carries: a compatible entry's
|
|
7585
7717
|
* in the user's order, and for a vendor entry each one its vendor
|
|
7586
7718
|
* documents, with an empty value when it sends none. Empty for a
|
|
@@ -7591,7 +7723,7 @@ const providerStateSchema = z.object({
|
|
|
7591
7723
|
details: providerReadingSchema,
|
|
7592
7724
|
/**
|
|
7593
7725
|
* The user's last install of the entry's command-line tool on the
|
|
7594
|
-
*
|
|
7726
|
+
* Subscriptions machine that no conversation asked for, since the backend
|
|
7595
7727
|
* started; null before one. The backend announces each change, so a
|
|
7596
7728
|
* page follows an install without asking.
|
|
7597
7729
|
*/
|
|
@@ -8222,6 +8354,64 @@ z.strictObject({
|
|
|
8222
8354
|
email: z.email().max(254),
|
|
8223
8355
|
password: z.string().min(1)
|
|
8224
8356
|
});
|
|
8357
|
+
/** What a run came to. */
|
|
8358
|
+
const runOutcomeSchema = z.discriminatedUnion("kind", [
|
|
8359
|
+
z.strictObject({
|
|
8360
|
+
kind: z.literal("returned"),
|
|
8361
|
+
value: z.json()
|
|
8362
|
+
}),
|
|
8363
|
+
z.strictObject({
|
|
8364
|
+
kind: z.literal("threw"),
|
|
8365
|
+
name: z.string(),
|
|
8366
|
+
message: z.string(),
|
|
8367
|
+
stack: z.string().nullable().optional()
|
|
8368
|
+
}),
|
|
8369
|
+
z.strictObject({
|
|
8370
|
+
kind: z.literal("too_large"),
|
|
8371
|
+
bytes: z.int().min(0).max(4294967295)
|
|
8372
|
+
})
|
|
8373
|
+
]);
|
|
8374
|
+
/** What a debugged page is, as it says. */
|
|
8375
|
+
const pageFactsSchema = z.strictObject({
|
|
8376
|
+
/** The page load's ID, which a reload makes anew. */
|
|
8377
|
+
id: z.string(),
|
|
8378
|
+
/** Its path, query and fragment. */
|
|
8379
|
+
url: z.string(),
|
|
8380
|
+
title: z.string(),
|
|
8381
|
+
/** The tab is the one its window shows, and the window is not minimized. */
|
|
8382
|
+
visible: z.boolean(),
|
|
8383
|
+
/** The build of the web app the page loaded. */
|
|
8384
|
+
build: z.string()
|
|
8385
|
+
});
|
|
8386
|
+
z.discriminatedUnion("type", [
|
|
8387
|
+
z.strictObject({
|
|
8388
|
+
type: z.literal("ran"),
|
|
8389
|
+
id: z.int().min(0).max(4294967295),
|
|
8390
|
+
outcome: runOutcomeSchema
|
|
8391
|
+
}),
|
|
8392
|
+
z.strictObject({
|
|
8393
|
+
type: z.literal("described"),
|
|
8394
|
+
id: z.int().min(0).max(4294967295),
|
|
8395
|
+
page: pageFactsSchema
|
|
8396
|
+
}),
|
|
8397
|
+
z.strictObject({ type: z.literal("stop") })
|
|
8398
|
+
]);
|
|
8399
|
+
z.discriminatedUnion("type", [
|
|
8400
|
+
z.object({
|
|
8401
|
+
type: z.literal("started"),
|
|
8402
|
+
token: z.string(),
|
|
8403
|
+
expiresAt: z.iso.datetime({ precision: 3 })
|
|
8404
|
+
}),
|
|
8405
|
+
z.object({
|
|
8406
|
+
type: z.literal("run"),
|
|
8407
|
+
id: z.int().min(0).max(4294967295),
|
|
8408
|
+
source: z.string()
|
|
8409
|
+
}),
|
|
8410
|
+
z.object({
|
|
8411
|
+
type: z.literal("describe"),
|
|
8412
|
+
id: z.int().min(0).max(4294967295)
|
|
8413
|
+
})
|
|
8414
|
+
]);
|
|
8225
8415
|
/** The user's answer to a request. */
|
|
8226
8416
|
const permissionDecisionSchema = z.enum(["allow", "deny"]);
|
|
8227
8417
|
/**
|
|
@@ -8245,6 +8435,31 @@ const deviceAnswerSchema = z.object({ device: deviceDtoSchema });
|
|
|
8245
8435
|
*/
|
|
8246
8436
|
const elevationOutcomeSchema = z.enum(["shown", "unavailable"]);
|
|
8247
8437
|
z.object({ outcome: elevationOutcomeSchema });
|
|
8438
|
+
z.strictObject({
|
|
8439
|
+
script: z.string(),
|
|
8440
|
+
/**
|
|
8441
|
+
* The directory it starts in; absent for the home directory the
|
|
8442
|
+
* device's runner reported.
|
|
8443
|
+
*/
|
|
8444
|
+
cwd: z.string().optional(),
|
|
8445
|
+
/** The variables it starts with, above the device's own. */
|
|
8446
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
8447
|
+
/** What it reads on its standard input, which then ends. */
|
|
8448
|
+
stdin: z.string().optional(),
|
|
8449
|
+
/**
|
|
8450
|
+
* How long it may run before it is stopped, in milliseconds; absent for
|
|
8451
|
+
* as long as it runs.
|
|
8452
|
+
*/
|
|
8453
|
+
timeoutMs: z.int().min(1).optional()
|
|
8454
|
+
});
|
|
8455
|
+
/**
|
|
8456
|
+
* `{ exitCode, output }`: the answer of `POST /devices/:id/exec`, the exit
|
|
8457
|
+
* status as the agent's shell reports one.
|
|
8458
|
+
*/
|
|
8459
|
+
const deviceExecResultSchema = z.object({
|
|
8460
|
+
exitCode: z.int().min(-2147483648).max(2147483647),
|
|
8461
|
+
output: execOutputSchema
|
|
8462
|
+
});
|
|
8248
8463
|
const deviceNumberSchema = z.int().min(0);
|
|
8249
8464
|
/** A cleanup that removed something from a device. */
|
|
8250
8465
|
const storageCleanupSchema = z.object({
|
|
@@ -8689,6 +8904,8 @@ const rootedPathSchema = z.string();
|
|
|
8689
8904
|
z.strictObject({ path: rootedPathSchema });
|
|
8690
8905
|
z.object({ url: z.string() });
|
|
8691
8906
|
z.object({ user: userDtoSchema });
|
|
8907
|
+
/** What a run's message does while its conversation is busy. */
|
|
8908
|
+
const ifBusySchema = z.enum(["queue", "steer"]);
|
|
8692
8909
|
/**
|
|
8693
8910
|
* A change of how an entry makes images: `enabled`, its Image Generation
|
|
8694
8911
|
* switch, for an entry that makes images.
|
|
@@ -8840,7 +9057,10 @@ const modelMatchSchema = z.object({
|
|
|
8840
9057
|
thinkingEfforts: z.array(z.string()),
|
|
8841
9058
|
/** The types the model reads natively: `[]` for none, null when unknown. */
|
|
8842
9059
|
acceptedExtensions: z.array(fileExtensionSchema).nullable(),
|
|
8843
|
-
/**
|
|
9060
|
+
/**
|
|
9061
|
+
* How a reasoning level goes on the Messages API and Gemini's, from the
|
|
9062
|
+
* record.
|
|
9063
|
+
*/
|
|
8844
9064
|
thinkingForm: thinkingFormSchema,
|
|
8845
9065
|
/**
|
|
8846
9066
|
* Whether its earlier thinking goes back on Chat Completions, from the
|
|
@@ -8906,6 +9126,12 @@ z.strictObject({
|
|
|
8906
9126
|
instructions: z.string().nullable(),
|
|
8907
9127
|
canSpawn: z.boolean()
|
|
8908
9128
|
});
|
|
9129
|
+
z.strictObject({
|
|
9130
|
+
/**
|
|
9131
|
+
* The repeat's task it runs, which may be left out when the repeat has
|
|
9132
|
+
* one; none for a single trigger.
|
|
9133
|
+
*/
|
|
9134
|
+
task: z.string().optional() });
|
|
8909
9135
|
const shareKeyUseSchema = z.object({
|
|
8910
9136
|
server: z.string(),
|
|
8911
9137
|
at: z.iso.datetime({ precision: 3 })
|
|
@@ -9558,6 +9784,11 @@ const providerDtoSchema = z.object({
|
|
|
9558
9784
|
*/
|
|
9559
9785
|
connectsThrough: z.boolean(),
|
|
9560
9786
|
/**
|
|
9787
|
+
* Whether its vendor's terms forbid its subscription through
|
|
9788
|
+
* third-party software, which Settings says before an account is added.
|
|
9789
|
+
*/
|
|
9790
|
+
forbidsThirdParty: z.boolean(),
|
|
9791
|
+
/**
|
|
9561
9792
|
* The headers every request of the entry carries: a compatible entry's
|
|
9562
9793
|
* in the user's order, and for a vendor entry each one its vendor
|
|
9563
9794
|
* documents, with an empty value when it sends none. Empty for a
|
|
@@ -9788,6 +10019,14 @@ const restartStepSchema = z.object({
|
|
|
9788
10019
|
});
|
|
9789
10020
|
z.object({ value: z.string() });
|
|
9790
10021
|
z.object({ removed: z.array(z.string().min(1)) });
|
|
10022
|
+
/** What fired a run. */
|
|
10023
|
+
const runCauseSchema = z.enum([
|
|
10024
|
+
"time",
|
|
10025
|
+
"change",
|
|
10026
|
+
"url",
|
|
10027
|
+
"done",
|
|
10028
|
+
"now"
|
|
10029
|
+
]);
|
|
9791
10030
|
z.strictObject({ version: z.string().min(1).max(64) });
|
|
9792
10031
|
z.object({
|
|
9793
10032
|
message: savedMessageSchema,
|
|
@@ -9818,7 +10057,81 @@ z.strictObject({
|
|
|
9818
10057
|
text: z.string(),
|
|
9819
10058
|
files: z.array(clientContentSchema)
|
|
9820
10059
|
});
|
|
9821
|
-
|
|
10060
|
+
/** One run of a schedule. */
|
|
10061
|
+
const scheduleRunDtoSchema = z.object({
|
|
10062
|
+
id: z.string().min(1),
|
|
10063
|
+
cause: runCauseSchema,
|
|
10064
|
+
/** When its trigger fired. */
|
|
10065
|
+
at: z.iso.datetime({ precision: 3 }),
|
|
10066
|
+
/** The repeat's task that started it; null for a single trigger. */
|
|
10067
|
+
taskId: z.string().nullable(),
|
|
10068
|
+
state: runStateSchema,
|
|
10069
|
+
/** Why it was skipped or failed. */
|
|
10070
|
+
note: runNoteSchema.nullable(),
|
|
10071
|
+
/** The start of its agent's last answer. */
|
|
10072
|
+
line: z.string().nullable(),
|
|
10073
|
+
/**
|
|
10074
|
+
* The turn its message started, whose id is the message's; null for a
|
|
10075
|
+
* run that started none, as one skipped while its device was offline.
|
|
10076
|
+
*/
|
|
10077
|
+
turn: z.string().min(1).nullable()
|
|
10078
|
+
});
|
|
10079
|
+
/** A schedule as `jush schedule` shows it, with its latest runs. */
|
|
10080
|
+
const scheduleDtoSchema = z.object({
|
|
10081
|
+
id: z.string().min(1),
|
|
10082
|
+
name: z.string(),
|
|
10083
|
+
trigger: triggerSchema,
|
|
10084
|
+
/** The IANA time zone its timing and its daily limit count in. */
|
|
10085
|
+
timeZone: z.string(),
|
|
10086
|
+
/** A change watch's or a URL's limit on runs a day; null for none. */
|
|
10087
|
+
maxRunsPerDay: z.int().min(0).max(4294967295).nullable(),
|
|
10088
|
+
ifBusy: ifBusySchema,
|
|
10089
|
+
/** What a single trigger's runs send; a repeat's tasks hold their own. */
|
|
10090
|
+
prompt: z.string(),
|
|
10091
|
+
paused: z.boolean(),
|
|
10092
|
+
/**
|
|
10093
|
+
* When it next fires by itself; null while paused or with no time
|
|
10094
|
+
* left, and for a URL.
|
|
10095
|
+
*/
|
|
10096
|
+
nextAt: z.iso.datetime({ precision: 3 }).nullable(),
|
|
10097
|
+
createdAt: z.iso.datetime({ precision: 3 }),
|
|
10098
|
+
/**
|
|
10099
|
+
* The agent's turn whose `jush schedule create` made it; null for one a
|
|
10100
|
+
* program made.
|
|
10101
|
+
*/
|
|
10102
|
+
createdIn: agentTurnSchema.nullable(),
|
|
10103
|
+
/**
|
|
10104
|
+
* The agent's turn whose `jush schedule edit` last changed what it
|
|
10105
|
+
* does, anything but whether it is on; null when no agent changed it
|
|
10106
|
+
* since it was made, or a program changed it last.
|
|
10107
|
+
*/
|
|
10108
|
+
editedIn: agentTurnSchema.nullable(),
|
|
10109
|
+
/** Its latest runs, newest first, [`RUNS_SHOWN`] at most. */
|
|
10110
|
+
runs: z.array(scheduleRunDtoSchema)
|
|
10111
|
+
});
|
|
10112
|
+
/**
|
|
10113
|
+
* A schedule a program made or changed, with a URL trigger's secret when
|
|
10114
|
+
* the change made one: the only time the secret is shown.
|
|
10115
|
+
*/
|
|
10116
|
+
const scheduleAnswerSchema = z.object({
|
|
10117
|
+
schedule: scheduleDtoSchema,
|
|
10118
|
+
secret: z.string().nullable()
|
|
10119
|
+
});
|
|
10120
|
+
z.strictObject({
|
|
10121
|
+
name: z.string().trim().optional(),
|
|
10122
|
+
trigger: triggerSchema.optional(),
|
|
10123
|
+
timeZone: z.string().optional(),
|
|
10124
|
+
/** Null removes the limit. */
|
|
10125
|
+
maxRunsPerDay: z.int().min(0).max(4294967295).nullable().optional(),
|
|
10126
|
+
ifBusy: ifBusySchema.optional(),
|
|
10127
|
+
prompt: z.string().optional(),
|
|
10128
|
+
paused: z.boolean().optional()
|
|
10129
|
+
});
|
|
10130
|
+
/**
|
|
10131
|
+
* `GET /conversations/:id/schedules/:schedule/runs`: a page of its runs,
|
|
10132
|
+
* newest first, [`RUNS_SHOWN`] at most.
|
|
10133
|
+
*/
|
|
10134
|
+
const scheduleRunsSchema = z.object({ runs: z.array(scheduleRunDtoSchema) });
|
|
9822
10135
|
z.discriminatedUnion("type", [z.object({
|
|
9823
10136
|
type: z.literal("file"),
|
|
9824
10137
|
/** Relative to the directory searched, with `/` between its parts. */
|
|
@@ -10163,7 +10476,12 @@ const subscriptionFamilySchema = z.object({
|
|
|
10163
10476
|
* Whether its entry may connect through one of its owner's devices,
|
|
10164
10477
|
* which Settings offers as Connect Through.
|
|
10165
10478
|
*/
|
|
10166
|
-
connectsThrough: z.boolean()
|
|
10479
|
+
connectsThrough: z.boolean(),
|
|
10480
|
+
/**
|
|
10481
|
+
* Whether its vendor's terms forbid it through third-party software,
|
|
10482
|
+
* which Settings says before an account is added.
|
|
10483
|
+
*/
|
|
10484
|
+
forbidsThirdParty: z.boolean()
|
|
10167
10485
|
});
|
|
10168
10486
|
z.strictObject({
|
|
10169
10487
|
providerType: z.string().min(1),
|
|
@@ -10500,6 +10818,7 @@ const workChangeSchema = z.discriminatedUnion("op", [
|
|
|
10500
10818
|
op: z.literal("create"),
|
|
10501
10819
|
id: z.string().min(1),
|
|
10502
10820
|
kind: z.string().min(1),
|
|
10821
|
+
device: z.string().min(1).optional(),
|
|
10503
10822
|
data: z.record(z.string(), z.json()),
|
|
10504
10823
|
index: z.int().min(0).max(64).nullable().optional()
|
|
10505
10824
|
}),
|
|
@@ -11031,6 +11350,12 @@ var ConversationClient = class {
|
|
|
11031
11350
|
reopenReads = [];
|
|
11032
11351
|
/** The revision of the draft the page holds, which the open names. */
|
|
11033
11352
|
draft;
|
|
11353
|
+
/**
|
|
11354
|
+
* The values the client follows again with no tag, until the backend sends
|
|
11355
|
+
* one whole: a change of it meanwhile is dropped, as the whole one holds it.
|
|
11356
|
+
*/
|
|
11357
|
+
refollowing = /* @__PURE__ */ new Set();
|
|
11358
|
+
understands;
|
|
11034
11359
|
/** Ends the reads when the client is disposed. */
|
|
11035
11360
|
detached = new AbortController();
|
|
11036
11361
|
reader;
|
|
@@ -11047,6 +11372,7 @@ var ConversationClient = class {
|
|
|
11047
11372
|
constructor(connect, options = {}) {
|
|
11048
11373
|
this.connect = connect;
|
|
11049
11374
|
this.conversationFrame = options.conversationFrame ?? (() => null);
|
|
11375
|
+
this.understands = options.understands ?? [];
|
|
11050
11376
|
this.reader = options.reader ?? null;
|
|
11051
11377
|
this.unapplied = options.unapplied ?? (() => {});
|
|
11052
11378
|
this.logged = options.logged ?? (() => {});
|
|
@@ -11134,7 +11460,8 @@ var ConversationClient = class {
|
|
|
11134
11460
|
const opening = {
|
|
11135
11461
|
type: "open",
|
|
11136
11462
|
...draft === void 0 ? {} : { draft },
|
|
11137
|
-
...this.followsOf()
|
|
11463
|
+
...this.followsOf(),
|
|
11464
|
+
understands: [...this.understands]
|
|
11138
11465
|
};
|
|
11139
11466
|
this.logged("lane.followed", {
|
|
11140
11467
|
values: opening.follows?.length ?? 0,
|
|
@@ -11530,6 +11857,7 @@ var ConversationClient = class {
|
|
|
11530
11857
|
this.transport = null;
|
|
11531
11858
|
this.detachTransport();
|
|
11532
11859
|
transport.close();
|
|
11860
|
+
this.refollowing.clear();
|
|
11533
11861
|
this.rejectWaiters(error);
|
|
11534
11862
|
this.emit({
|
|
11535
11863
|
type: "disconnected",
|
|
@@ -11727,7 +12055,30 @@ var ConversationClient = class {
|
|
|
11727
12055
|
if (!parsed.success) {
|
|
11728
12056
|
const take = this.conversationFrame(frame);
|
|
11729
12057
|
if (take) {
|
|
11730
|
-
if (take.
|
|
12058
|
+
if (take.refollow) {
|
|
12059
|
+
const { value, reason } = take.refollow;
|
|
12060
|
+
if (!this.refollowing.has(value)) {
|
|
12061
|
+
this.logged("read.again", {
|
|
12062
|
+
value,
|
|
12063
|
+
reason
|
|
12064
|
+
});
|
|
12065
|
+
this.tags[value] = "";
|
|
12066
|
+
this.refollowing.add(value);
|
|
12067
|
+
this.sendFrame({
|
|
12068
|
+
type: "follow",
|
|
12069
|
+
value: { kind: value },
|
|
12070
|
+
holds: {
|
|
12071
|
+
kind: "tag",
|
|
12072
|
+
tag: ""
|
|
12073
|
+
}
|
|
12074
|
+
});
|
|
12075
|
+
}
|
|
12076
|
+
return;
|
|
12077
|
+
}
|
|
12078
|
+
if (take.tagged) {
|
|
12079
|
+
this.tags[take.tagged.value] = take.tagged.tag;
|
|
12080
|
+
this.refollowing.delete(take.tagged.value);
|
|
12081
|
+
}
|
|
11731
12082
|
take.apply();
|
|
11732
12083
|
return;
|
|
11733
12084
|
}
|
|
@@ -13309,9 +13660,23 @@ var Conversation = class {
|
|
|
13309
13660
|
reopening = false;
|
|
13310
13661
|
/** Whether the lane dropped again while it was being opened again. */
|
|
13311
13662
|
droppedAgain = false;
|
|
13663
|
+
schedules;
|
|
13312
13664
|
constructor(id, routes) {
|
|
13313
13665
|
this.id = id;
|
|
13314
13666
|
this.routes = routes;
|
|
13667
|
+
const path = `/conversations/${encodeURIComponent(id)}/schedules`;
|
|
13668
|
+
const one = (schedule) => `${path}/${encodeURIComponent(schedule)}`;
|
|
13669
|
+
this.schedules = {
|
|
13670
|
+
create: (patch) => routes.json("POST", path, scheduleAnswerSchema, patch),
|
|
13671
|
+
get: (schedule) => routes.json("GET", one(schedule), scheduleDtoSchema),
|
|
13672
|
+
update: (schedule, patch) => routes.json("PATCH", one(schedule), scheduleAnswerSchema, patch),
|
|
13673
|
+
remove: (schedule) => routes.send("DELETE", one(schedule)),
|
|
13674
|
+
run: (schedule, task) => routes.json("POST", `${one(schedule)}/runs`, scheduleRunDtoSchema, task === void 0 ? {} : { task }),
|
|
13675
|
+
runs: async (schedule, before) => {
|
|
13676
|
+
const query = before === void 0 ? "" : `?before=${encodeURIComponent(before)}`;
|
|
13677
|
+
return (await routes.json("GET", `${one(schedule)}/runs${query}`, scheduleRunsSchema)).runs;
|
|
13678
|
+
}
|
|
13679
|
+
};
|
|
13315
13680
|
}
|
|
13316
13681
|
/** Opens the conversation's lane, once; each action opens it first. */
|
|
13317
13682
|
open() {
|
|
@@ -14721,6 +15086,30 @@ var Device = class {
|
|
|
14721
15086
|
return child;
|
|
14722
15087
|
}
|
|
14723
15088
|
/**
|
|
15089
|
+
* Runs `script` on the device, outside any conversation, as the agent's
|
|
15090
|
+
* shell runs a command, and resolves once it exited, whatever its status.
|
|
15091
|
+
* Rejects with a `JushError` when it has no status: `device_offline`, when
|
|
15092
|
+
* it never ran; `command_timed_out`, when it ran past `timeout` and was
|
|
15093
|
+
* stopped (`SIGTERM`, then `SIGKILL` 5 seconds later), with what it printed
|
|
15094
|
+
* in `body.output`; `device_lost`, when the device lost it or its input was
|
|
15095
|
+
* cut; `backend_closing`, when the core closed while it ran, whose device
|
|
15096
|
+
* stops it when it connects again.
|
|
15097
|
+
*/
|
|
15098
|
+
async exec(script, options = {}) {
|
|
15099
|
+
const { timeout, signal, ...where } = options;
|
|
15100
|
+
const limited = timeout !== void 0 && timeout !== 0 && Number.isFinite(timeout);
|
|
15101
|
+
const body = {
|
|
15102
|
+
script,
|
|
15103
|
+
...where,
|
|
15104
|
+
...limited ? { timeoutMs: Math.ceil(timeout) } : {}
|
|
15105
|
+
};
|
|
15106
|
+
const ran = await this.routes.json("POST", `/devices/${encodeURIComponent(this.id)}/exec`, deviceExecResultSchema, body, signal);
|
|
15107
|
+
return {
|
|
15108
|
+
exitCode: ran.exitCode,
|
|
15109
|
+
...ran.output
|
|
15110
|
+
};
|
|
15111
|
+
}
|
|
15112
|
+
/**
|
|
14724
15113
|
* Revokes the device, as the app's Revoke does: its token opens nothing
|
|
14725
15114
|
* from then on, the commands running on it are lost, and the commands of
|
|
14726
15115
|
* a conversation whose target it is fail until `update({ target })` names
|