@jush-agent/sdk 0.2.6320 → 0.2.6332
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 +89 -1
- package/dist/index.d.mts +368 -5
- package/dist/index.mjs +113 -43
- package/package.json +7 -7
- package/release/commands/jush-browser/descriptor.json +13 -13
- package/release/commands/jush-fetch/descriptor.json +12 -12
- package/release/commands/jush-file/descriptor.json +11 -11
- package/release/commands/jush-mobile/descriptor.json +13 -13
- package/release/commands/jush-subscription-cli/descriptor.json +12 -12
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Jush's agents in your program. The SDK starts `jush-core`, the process your
|
|
4
4
|
program's cores run in, and gives your program the cores, their
|
|
5
5
|
conversations, providers and devices, and plugins of your own whose commands
|
|
6
|
-
the agents run
|
|
6
|
+
the agents run, under `jush` or by names of their own.
|
|
7
7
|
|
|
8
8
|
A core is one Jush: its conversations, provider entries, devices and
|
|
9
9
|
settings, kept in a directory you choose. A team bot, for example, opens one
|
|
@@ -216,6 +216,25 @@ for (const listed of core.state.devices) {
|
|
|
216
216
|
}
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
+
### The language and time zone of the agents' work
|
|
220
|
+
|
|
221
|
+
Commands run in the time zone and languages of the browser that last
|
|
222
|
+
showed the core's pages, and in `en-US` and UTC before one did. A
|
|
223
|
+
conversation's browser starts in them: a site shows its text in that
|
|
224
|
+
language, and a page its times in that zone. A new schedule counts in that
|
|
225
|
+
zone too, and each turn tells the model the time in it. Set them for the
|
|
226
|
+
core's work with `commandLocale`, which no page changes:
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
await core.updatePreferences({ commandLocale: { timeZone: 'Asia/Shanghai', languages: ['zh-CN'] } })
|
|
230
|
+
// Back to what the pages' browser reports:
|
|
231
|
+
await core.updatePreferences({ commandLocale: null })
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
A conversation's browser takes them as it starts, as it takes the color
|
|
235
|
+
scheme: one already open keeps its own until it starts again, after its
|
|
236
|
+
last tab closed.
|
|
237
|
+
|
|
219
238
|
### Scripts outside a conversation
|
|
220
239
|
|
|
221
240
|
`device.exec(script, options)` runs a script on a paired device as the agent's
|
|
@@ -378,6 +397,55 @@ await conversation.run([
|
|
|
378
397
|
])
|
|
379
398
|
```
|
|
380
399
|
|
|
400
|
+
A file your program holds, such as a photo a user sent you, goes up with
|
|
401
|
+
`core.upload`. The upload answers a block, which sends the file in a
|
|
402
|
+
message, a steer or a run:
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
const photo = await core.upload({ name: 'receipt.png', bytes, mediaType: 'image/png' })
|
|
406
|
+
await conversation.run([{ type: 'text', text: 'What does this receipt total?' }, photo])
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
- A file holds from 1 byte to 25 MiB. `bytes` is a `Uint8Array`, an
|
|
410
|
+
`ArrayBuffer` or a `Blob`; a `Blob`'s own type serves when `mediaType` is
|
|
411
|
+
absent.
|
|
412
|
+
- The agent sees the file as an attachment of the conversation, such as
|
|
413
|
+
`<attachment id="a1" name="receipt.png" … />`. Nothing is written to the
|
|
414
|
+
device: the agent's commands fetch the file with `jush attachment
|
|
415
|
+
download`.
|
|
416
|
+
- The core keeps an upload while a message holds it, so the same block can
|
|
417
|
+
go in more messages. An upload no message holds may be removed once a day
|
|
418
|
+
has passed since it was made, and a message that sends it after that
|
|
419
|
+
tells the model `[attachment … is not available]`: send an upload within
|
|
420
|
+
the day, or upload the file again.
|
|
421
|
+
|
|
422
|
+
The model is shown the file itself, as an image, a PDF or another medium,
|
|
423
|
+
when the model's `acceptedExtensions` list the file's type and the
|
|
424
|
+
provider's API carries that medium. A vendor entry's types come from
|
|
425
|
+
models.dev. A compatible entry's are yours to list among its `models`:
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
const gateway = await core.providers.create({
|
|
429
|
+
source: 'compatible',
|
|
430
|
+
providerType: 'openai',
|
|
431
|
+
label: 'Team Gateway',
|
|
432
|
+
baseUrl: 'https://gateway.example.com/v1',
|
|
433
|
+
apiKey: process.env.GATEWAY_KEY,
|
|
434
|
+
models: [{
|
|
435
|
+
id: 'vision-large',
|
|
436
|
+
displayName: 'Vision Large',
|
|
437
|
+
contextWindow: 128_000,
|
|
438
|
+
outputLimit: null,
|
|
439
|
+
thinkingEfforts: [],
|
|
440
|
+
acceptedExtensions: ['png', 'jpg', 'jpeg', 'gif', 'webp'],
|
|
441
|
+
fastTier: null,
|
|
442
|
+
}],
|
|
443
|
+
})
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
`acceptedExtensions: null` means the types are unknown, and the model is
|
|
447
|
+
told only that a file came; `[]` means the model reads none.
|
|
448
|
+
|
|
381
449
|
`conversation.blocks` is what the conversation holds, oldest first.
|
|
382
450
|
`conversation.events()` yields everything that happens in it, as the app
|
|
383
451
|
shows it live; a `transcript_patch` event says the blocks changed, such as
|
|
@@ -525,6 +593,26 @@ each command's `summary`, input and `output` are its `--help`.
|
|
|
525
593
|
names the one it needs: the conversation then asks before the command
|
|
526
594
|
runs.
|
|
527
595
|
|
|
596
|
+
A group is under `jush` unless it says `placement: 'root'`, which makes it a
|
|
597
|
+
command of the shell, run by its own name: with the plugin above at the
|
|
598
|
+
root, the agent and every process its commands start run `chat send`, and
|
|
599
|
+
`chat --help` shows it, as `jush` shows its own. Name it after your program:
|
|
600
|
+
the core refuses `jush`, a name another plugin takes, and the names of shell
|
|
601
|
+
words and common tools, such as `ls`, `git` or `node`; a device leaves out a
|
|
602
|
+
command whose name its own shell answers, such as `history`, and keeps the
|
|
603
|
+
rest.
|
|
604
|
+
|
|
605
|
+
```ts
|
|
606
|
+
commands: {
|
|
607
|
+
acme: {
|
|
608
|
+
placement: 'root',
|
|
609
|
+
summary: "Acme's tickets",
|
|
610
|
+
index: 'Files and reads Acme tickets.',
|
|
611
|
+
commands: { ticket: { summary: 'Tickets', commands: { create: leaf({ /* … */ }) } } },
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
```
|
|
615
|
+
|
|
528
616
|
A plugin can also add a context block before each request (`context`),
|
|
529
617
|
search a conversation's project (`projectSearch`), and follow conversations
|
|
530
618
|
being deleted or forked.
|
package/dist/index.d.mts
CHANGED
|
@@ -4141,6 +4141,12 @@ declare const clientFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
4141
4141
|
type: z.ZodLiteral<"close">;
|
|
4142
4142
|
}, z.core.$strict>], "type">;
|
|
4143
4143
|
type ClientFrame = z.infer<typeof clientFrameSchema>;
|
|
4144
|
+
/** Where a plugin's command tree goes. */
|
|
4145
|
+
declare const placementSchema: z.ZodEnum<{
|
|
4146
|
+
root: "root";
|
|
4147
|
+
jush: "jush";
|
|
4148
|
+
}>;
|
|
4149
|
+
type Placement = z.infer<typeof placementSchema>;
|
|
4144
4150
|
/**
|
|
4145
4151
|
* An attachment of the conversation as a reply shows it
|
|
4146
4152
|
* (`crates/core-device-access/src/attachment_commands.rs`): what its card
|
|
@@ -17416,6 +17422,167 @@ declare const conversationUpdateSchema: z.ZodObject<{
|
|
|
17416
17422
|
}, z.core.$strip>], "status">>;
|
|
17417
17423
|
}, z.core.$strip>;
|
|
17418
17424
|
type ConversationUpdate = z.infer<typeof conversationUpdateSchema>;
|
|
17425
|
+
/** A user's saved preferences. */
|
|
17426
|
+
declare const preferencesSchema: z.ZodObject<{
|
|
17427
|
+
appearance: z.ZodObject<{
|
|
17428
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
17429
|
+
system: "system";
|
|
17430
|
+
light: "light";
|
|
17431
|
+
dark: "dark";
|
|
17432
|
+
}>>;
|
|
17433
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
17434
|
+
ink: "ink";
|
|
17435
|
+
warm: "warm";
|
|
17436
|
+
}>>;
|
|
17437
|
+
accent: z.ZodOptional<z.ZodEnum<{
|
|
17438
|
+
blue: "blue";
|
|
17439
|
+
purple: "purple";
|
|
17440
|
+
pink: "pink";
|
|
17441
|
+
red: "red";
|
|
17442
|
+
orange: "orange";
|
|
17443
|
+
green: "green";
|
|
17444
|
+
teal: "teal";
|
|
17445
|
+
}>>;
|
|
17446
|
+
fontSize: z.ZodOptional<z.ZodInt>;
|
|
17447
|
+
}, z.core.$strip>;
|
|
17448
|
+
shortcuts: z.ZodObject<{
|
|
17449
|
+
mac: z.ZodObject<{
|
|
17450
|
+
new: z.ZodOptional<z.ZodString>;
|
|
17451
|
+
sidebar: z.ZodOptional<z.ZodString>;
|
|
17452
|
+
settings: z.ZodOptional<z.ZodString>;
|
|
17453
|
+
search: z.ZodOptional<z.ZodString>;
|
|
17454
|
+
searchFiles: z.ZodOptional<z.ZodString>;
|
|
17455
|
+
find: z.ZodOptional<z.ZodString>;
|
|
17456
|
+
workspace1: z.ZodOptional<z.ZodString>;
|
|
17457
|
+
workspace2: z.ZodOptional<z.ZodString>;
|
|
17458
|
+
workspace3: z.ZodOptional<z.ZodString>;
|
|
17459
|
+
workspace4: z.ZodOptional<z.ZodString>;
|
|
17460
|
+
workspace5: z.ZodOptional<z.ZodString>;
|
|
17461
|
+
workspace6: z.ZodOptional<z.ZodString>;
|
|
17462
|
+
workspace7: z.ZodOptional<z.ZodString>;
|
|
17463
|
+
workspace8: z.ZodOptional<z.ZodString>;
|
|
17464
|
+
workspace9: z.ZodOptional<z.ZodString>;
|
|
17465
|
+
}, z.core.$strip>;
|
|
17466
|
+
pc: z.ZodObject<{
|
|
17467
|
+
new: z.ZodOptional<z.ZodString>;
|
|
17468
|
+
sidebar: z.ZodOptional<z.ZodString>;
|
|
17469
|
+
settings: z.ZodOptional<z.ZodString>;
|
|
17470
|
+
search: z.ZodOptional<z.ZodString>;
|
|
17471
|
+
searchFiles: z.ZodOptional<z.ZodString>;
|
|
17472
|
+
find: z.ZodOptional<z.ZodString>;
|
|
17473
|
+
workspace1: z.ZodOptional<z.ZodString>;
|
|
17474
|
+
workspace2: z.ZodOptional<z.ZodString>;
|
|
17475
|
+
workspace3: z.ZodOptional<z.ZodString>;
|
|
17476
|
+
workspace4: z.ZodOptional<z.ZodString>;
|
|
17477
|
+
workspace5: z.ZodOptional<z.ZodString>;
|
|
17478
|
+
workspace6: z.ZodOptional<z.ZodString>;
|
|
17479
|
+
workspace7: z.ZodOptional<z.ZodString>;
|
|
17480
|
+
workspace8: z.ZodOptional<z.ZodString>;
|
|
17481
|
+
workspace9: z.ZodOptional<z.ZodString>;
|
|
17482
|
+
}, z.core.$strip>;
|
|
17483
|
+
}, z.core.$strip>;
|
|
17484
|
+
lastModel: z.ZodOptional<z.ZodObject<{
|
|
17485
|
+
providerId: z.ZodString;
|
|
17486
|
+
modelId: z.ZodString;
|
|
17487
|
+
thinkingEffort: z.ZodNullable<z.ZodString>;
|
|
17488
|
+
serviceTierId: z.ZodNullable<z.ZodString>;
|
|
17489
|
+
}, z.core.$strip>>;
|
|
17490
|
+
lastWorkflow: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17491
|
+
type: z.ZodLiteral<"default">;
|
|
17492
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17493
|
+
type: z.ZodLiteral<"none">;
|
|
17494
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17495
|
+
type: z.ZodLiteral<"workflow">;
|
|
17496
|
+
id: z.ZodString;
|
|
17497
|
+
worktree: z.ZodOptional<z.ZodBoolean>;
|
|
17498
|
+
}, z.core.$strip>], "type">>;
|
|
17499
|
+
lastProjectDevice: z.ZodOptional<z.ZodObject<{
|
|
17500
|
+
kind: z.ZodEnum<{
|
|
17501
|
+
cloud: "cloud";
|
|
17502
|
+
device: "device";
|
|
17503
|
+
}>;
|
|
17504
|
+
deviceId: z.ZodOptional<z.ZodString>;
|
|
17505
|
+
}, z.core.$strip>>;
|
|
17506
|
+
language: z.ZodOptional<z.ZodEnum<{
|
|
17507
|
+
system: "system";
|
|
17508
|
+
en: "en";
|
|
17509
|
+
de: "de";
|
|
17510
|
+
"es-419": "es-419";
|
|
17511
|
+
fr: "fr";
|
|
17512
|
+
"pt-BR": "pt-BR";
|
|
17513
|
+
"zh-Hans": "zh-Hans";
|
|
17514
|
+
"zh-Hant": "zh-Hant";
|
|
17515
|
+
ja: "ja";
|
|
17516
|
+
ko: "ko";
|
|
17517
|
+
}>>;
|
|
17518
|
+
locale: z.ZodOptional<z.ZodObject<{
|
|
17519
|
+
timeZone: z.ZodString;
|
|
17520
|
+
languages: z.ZodArray<z.ZodString>;
|
|
17521
|
+
language: z.ZodOptional<z.ZodEnum<{
|
|
17522
|
+
en: "en";
|
|
17523
|
+
de: "de";
|
|
17524
|
+
"es-419": "es-419";
|
|
17525
|
+
fr: "fr";
|
|
17526
|
+
"pt-BR": "pt-BR";
|
|
17527
|
+
"zh-Hans": "zh-Hans";
|
|
17528
|
+
"zh-Hant": "zh-Hant";
|
|
17529
|
+
ja: "ja";
|
|
17530
|
+
ko: "ko";
|
|
17531
|
+
}>>;
|
|
17532
|
+
}, z.core.$strip>>;
|
|
17533
|
+
commandLocale: z.ZodOptional<z.ZodObject<{
|
|
17534
|
+
timeZone: z.ZodString;
|
|
17535
|
+
languages: z.ZodArray<z.ZodString>;
|
|
17536
|
+
}, z.core.$strip>>;
|
|
17537
|
+
colorScheme: z.ZodOptional<z.ZodEnum<{
|
|
17538
|
+
light: "light";
|
|
17539
|
+
dark: "dark";
|
|
17540
|
+
}>>;
|
|
17541
|
+
sendWhileRunning: z.ZodOptional<z.ZodEnum<{
|
|
17542
|
+
queue: "queue";
|
|
17543
|
+
steer: "steer";
|
|
17544
|
+
}>>;
|
|
17545
|
+
resumeAtRetry: z.ZodOptional<z.ZodBoolean>;
|
|
17546
|
+
resumeAfterRestart: z.ZodOptional<z.ZodBoolean>;
|
|
17547
|
+
compactIdle: z.ZodOptional<z.ZodBoolean>;
|
|
17548
|
+
idleCompactionLifetime: z.ZodOptional<z.ZodEnum<{
|
|
17549
|
+
"1h": "1h";
|
|
17550
|
+
"30m": "30m";
|
|
17551
|
+
}>>;
|
|
17552
|
+
idleCompactionContext: z.ZodOptional<z.ZodInt>;
|
|
17553
|
+
showUnexpectedErrors: z.ZodOptional<z.ZodBoolean>;
|
|
17554
|
+
multiAccountWarned: z.ZodOptional<z.ZodBoolean>;
|
|
17555
|
+
contextLimits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodInt>>>;
|
|
17556
|
+
hiddenProviders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17557
|
+
hiddenModels: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17558
|
+
providerId: z.ZodString;
|
|
17559
|
+
modelId: z.ZodString;
|
|
17560
|
+
}, z.core.$strip>>>;
|
|
17561
|
+
smallModel: z.ZodOptional<z.ZodObject<{
|
|
17562
|
+
providerId: z.ZodString;
|
|
17563
|
+
modelId: z.ZodString;
|
|
17564
|
+
thinkingEffort: z.ZodNullable<z.ZodString>;
|
|
17565
|
+
}, z.core.$strip>>;
|
|
17566
|
+
smallModelSameProvider: z.ZodOptional<z.ZodBoolean>;
|
|
17567
|
+
suggestedReplies: z.ZodOptional<z.ZodBoolean>;
|
|
17568
|
+
outputSpeed: z.ZodOptional<z.ZodBoolean>;
|
|
17569
|
+
taskbarPins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17570
|
+
fileTree: z.ZodOptional<z.ZodObject<{
|
|
17571
|
+
shown: z.ZodBoolean;
|
|
17572
|
+
width: z.ZodInt;
|
|
17573
|
+
}, z.core.$strip>>;
|
|
17574
|
+
storage: z.ZodOptional<z.ZodObject<{
|
|
17575
|
+
temporary: z.ZodObject<{
|
|
17576
|
+
unusedDays: z.ZodNullable<z.ZodInt>;
|
|
17577
|
+
maxBytes: z.ZodNullable<z.ZodInt>;
|
|
17578
|
+
}, z.core.$strip>;
|
|
17579
|
+
cache: z.ZodObject<{
|
|
17580
|
+
unusedDays: z.ZodNullable<z.ZodInt>;
|
|
17581
|
+
maxBytes: z.ZodNullable<z.ZodInt>;
|
|
17582
|
+
}, z.core.$strip>;
|
|
17583
|
+
}, z.core.$strip>>;
|
|
17584
|
+
}, z.core.$strip>;
|
|
17585
|
+
type Preferences = z.infer<typeof preferencesSchema>;
|
|
17419
17586
|
/**
|
|
17420
17587
|
* A device as the web app sees it. `platform` is the one its runner
|
|
17421
17588
|
* reported; `state` says whether its runner serves it now;
|
|
@@ -17658,6 +17825,10 @@ declare const coreStateSchema: z.ZodObject<{
|
|
|
17658
17825
|
ko: "ko";
|
|
17659
17826
|
}>>;
|
|
17660
17827
|
}, z.core.$strip>>;
|
|
17828
|
+
commandLocale: z.ZodOptional<z.ZodObject<{
|
|
17829
|
+
timeZone: z.ZodString;
|
|
17830
|
+
languages: z.ZodArray<z.ZodString>;
|
|
17831
|
+
}, z.core.$strip>>;
|
|
17661
17832
|
colorScheme: z.ZodOptional<z.ZodEnum<{
|
|
17662
17833
|
light: "light";
|
|
17663
17834
|
dark: "dark";
|
|
@@ -18920,6 +19091,164 @@ declare const requestedValuesSchema: z.ZodObject<{
|
|
|
18920
19091
|
values: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
18921
19092
|
}, z.core.$strict>;
|
|
18922
19093
|
type RequestedValues = z.infer<typeof requestedValuesSchema>;
|
|
19094
|
+
/**
|
|
19095
|
+
* `PATCH /settings/preferences`: the overrides to change; everything absent
|
|
19096
|
+
* stays as saved.
|
|
19097
|
+
*/
|
|
19098
|
+
declare const preferencesPatchSchema: z.ZodObject<{
|
|
19099
|
+
appearance: z.ZodOptional<z.ZodObject<{
|
|
19100
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
19101
|
+
system: "system";
|
|
19102
|
+
light: "light";
|
|
19103
|
+
dark: "dark";
|
|
19104
|
+
}>>;
|
|
19105
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
19106
|
+
ink: "ink";
|
|
19107
|
+
warm: "warm";
|
|
19108
|
+
}>>;
|
|
19109
|
+
accent: z.ZodOptional<z.ZodEnum<{
|
|
19110
|
+
blue: "blue";
|
|
19111
|
+
purple: "purple";
|
|
19112
|
+
pink: "pink";
|
|
19113
|
+
red: "red";
|
|
19114
|
+
orange: "orange";
|
|
19115
|
+
green: "green";
|
|
19116
|
+
teal: "teal";
|
|
19117
|
+
}>>;
|
|
19118
|
+
fontSize: z.ZodOptional<z.ZodInt>;
|
|
19119
|
+
}, z.core.$strip>>;
|
|
19120
|
+
shortcuts: z.ZodOptional<z.ZodObject<{
|
|
19121
|
+
mac: z.ZodOptional<z.ZodObject<{
|
|
19122
|
+
new: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19123
|
+
sidebar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19124
|
+
settings: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19125
|
+
search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19126
|
+
searchFiles: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19127
|
+
find: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19128
|
+
workspace1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19129
|
+
workspace2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19130
|
+
workspace3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19131
|
+
workspace4: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19132
|
+
workspace5: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19133
|
+
workspace6: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19134
|
+
workspace7: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19135
|
+
workspace8: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19136
|
+
workspace9: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19137
|
+
}, z.core.$strict>>;
|
|
19138
|
+
pc: z.ZodOptional<z.ZodObject<{
|
|
19139
|
+
new: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19140
|
+
sidebar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19141
|
+
settings: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19142
|
+
search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19143
|
+
searchFiles: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19144
|
+
find: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19145
|
+
workspace1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19146
|
+
workspace2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19147
|
+
workspace3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19148
|
+
workspace4: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19149
|
+
workspace5: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19150
|
+
workspace6: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19151
|
+
workspace7: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19152
|
+
workspace8: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19153
|
+
workspace9: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19154
|
+
}, z.core.$strict>>;
|
|
19155
|
+
}, z.core.$strict>>;
|
|
19156
|
+
lastModel: z.ZodOptional<z.ZodObject<{
|
|
19157
|
+
providerId: z.ZodString;
|
|
19158
|
+
modelId: z.ZodString;
|
|
19159
|
+
thinkingEffort: z.ZodNullable<z.ZodString>;
|
|
19160
|
+
serviceTierId: z.ZodNullable<z.ZodString>;
|
|
19161
|
+
}, z.core.$strip>>;
|
|
19162
|
+
lastWorkflow: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
19163
|
+
type: z.ZodLiteral<"default">;
|
|
19164
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19165
|
+
type: z.ZodLiteral<"none">;
|
|
19166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19167
|
+
type: z.ZodLiteral<"workflow">;
|
|
19168
|
+
id: z.ZodString;
|
|
19169
|
+
worktree: z.ZodOptional<z.ZodBoolean>;
|
|
19170
|
+
}, z.core.$strip>], "type">>;
|
|
19171
|
+
lastProjectDevice: z.ZodOptional<z.ZodObject<{
|
|
19172
|
+
kind: z.ZodEnum<{
|
|
19173
|
+
cloud: "cloud";
|
|
19174
|
+
device: "device";
|
|
19175
|
+
}>;
|
|
19176
|
+
deviceId: z.ZodOptional<z.ZodString>;
|
|
19177
|
+
}, z.core.$strip>>;
|
|
19178
|
+
language: z.ZodOptional<z.ZodEnum<{
|
|
19179
|
+
system: "system";
|
|
19180
|
+
en: "en";
|
|
19181
|
+
de: "de";
|
|
19182
|
+
"es-419": "es-419";
|
|
19183
|
+
fr: "fr";
|
|
19184
|
+
"pt-BR": "pt-BR";
|
|
19185
|
+
"zh-Hans": "zh-Hans";
|
|
19186
|
+
"zh-Hant": "zh-Hant";
|
|
19187
|
+
ja: "ja";
|
|
19188
|
+
ko: "ko";
|
|
19189
|
+
}>>;
|
|
19190
|
+
locale: z.ZodOptional<z.ZodObject<{
|
|
19191
|
+
timeZone: z.ZodString;
|
|
19192
|
+
languages: z.ZodArray<z.ZodString>;
|
|
19193
|
+
language: z.ZodOptional<z.ZodEnum<{
|
|
19194
|
+
en: "en";
|
|
19195
|
+
de: "de";
|
|
19196
|
+
"es-419": "es-419";
|
|
19197
|
+
fr: "fr";
|
|
19198
|
+
"pt-BR": "pt-BR";
|
|
19199
|
+
"zh-Hans": "zh-Hans";
|
|
19200
|
+
"zh-Hant": "zh-Hant";
|
|
19201
|
+
ja: "ja";
|
|
19202
|
+
ko: "ko";
|
|
19203
|
+
}>>;
|
|
19204
|
+
}, z.core.$strip>>;
|
|
19205
|
+
commandLocale: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
19206
|
+
timeZone: z.ZodString;
|
|
19207
|
+
languages: z.ZodArray<z.ZodString>;
|
|
19208
|
+
}, z.core.$strip>>>;
|
|
19209
|
+
colorScheme: z.ZodOptional<z.ZodEnum<{
|
|
19210
|
+
light: "light";
|
|
19211
|
+
dark: "dark";
|
|
19212
|
+
}>>;
|
|
19213
|
+
sendWhileRunning: z.ZodOptional<z.ZodEnum<{
|
|
19214
|
+
queue: "queue";
|
|
19215
|
+
steer: "steer";
|
|
19216
|
+
}>>;
|
|
19217
|
+
resumeAtRetry: z.ZodOptional<z.ZodBoolean>;
|
|
19218
|
+
resumeAfterRestart: z.ZodOptional<z.ZodBoolean>;
|
|
19219
|
+
compactIdle: z.ZodOptional<z.ZodBoolean>;
|
|
19220
|
+
idleCompactionLifetime: z.ZodOptional<z.ZodEnum<{
|
|
19221
|
+
"1h": "1h";
|
|
19222
|
+
"30m": "30m";
|
|
19223
|
+
}>>;
|
|
19224
|
+
idleCompactionContext: z.ZodOptional<z.ZodInt>;
|
|
19225
|
+
showUnexpectedErrors: z.ZodOptional<z.ZodBoolean>;
|
|
19226
|
+
multiAccountWarned: z.ZodOptional<z.ZodBoolean>;
|
|
19227
|
+
contextLimit: z.ZodOptional<z.ZodObject<{
|
|
19228
|
+
providerId: z.ZodString;
|
|
19229
|
+
modelId: z.ZodString;
|
|
19230
|
+
tokens: z.ZodNullable<z.ZodInt>;
|
|
19231
|
+
}, z.core.$strict>>;
|
|
19232
|
+
hiddenProviders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19233
|
+
hiddenModels: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19234
|
+
providerId: z.ZodString;
|
|
19235
|
+
modelId: z.ZodString;
|
|
19236
|
+
}, z.core.$strip>>>;
|
|
19237
|
+
smallModel: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
19238
|
+
providerId: z.ZodString;
|
|
19239
|
+
modelId: z.ZodString;
|
|
19240
|
+
thinkingEffort: z.ZodNullable<z.ZodString>;
|
|
19241
|
+
}, z.core.$strip>>>;
|
|
19242
|
+
smallModelSameProvider: z.ZodOptional<z.ZodBoolean>;
|
|
19243
|
+
suggestedReplies: z.ZodOptional<z.ZodBoolean>;
|
|
19244
|
+
outputSpeed: z.ZodOptional<z.ZodBoolean>;
|
|
19245
|
+
taskbarPins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19246
|
+
fileTree: z.ZodOptional<z.ZodObject<{
|
|
19247
|
+
shown: z.ZodBoolean;
|
|
19248
|
+
width: z.ZodInt;
|
|
19249
|
+
}, z.core.$strip>>;
|
|
19250
|
+
}, z.core.$strict>;
|
|
19251
|
+
type PreferencesPatch = z.infer<typeof preferencesPatchSchema>;
|
|
18923
19252
|
/**
|
|
18924
19253
|
* An entry as the web app sees it: its family, label, kind, endpoint, vendor
|
|
18925
19254
|
* and model list, never its key.
|
|
@@ -20591,7 +20920,12 @@ declare class CoreRoutes {
|
|
|
20591
20920
|
constructor(process: Process, id: string, connection: PageConnection);
|
|
20592
20921
|
/** The process's path of the core's route `path`, such as `/conversations`. */
|
|
20593
20922
|
path(path: string): string;
|
|
20594
|
-
/**
|
|
20923
|
+
/**
|
|
20924
|
+
* Calls the route `path` with `body`, a `Blob` as its bytes of its type
|
|
20925
|
+
* and anything else as JSON; throws `JushError` for an answer other than
|
|
20926
|
+
* 2xx. A `Blob`'s length is declared, so a route refuses one over its
|
|
20927
|
+
* limit before it reads a byte of it.
|
|
20928
|
+
*/
|
|
20595
20929
|
request(method: string, path: string, body?: unknown, signal?: AbortSignal): Promise<Response>;
|
|
20596
20930
|
/** The answer of the route `path`, read with `schema`. */
|
|
20597
20931
|
json<T>(method: string, path: string, schema: z.ZodType<T>, body?: unknown, signal?: AbortSignal): Promise<T>;
|
|
@@ -20753,11 +21087,11 @@ declare class Conversation {
|
|
|
20753
21087
|
}
|
|
20754
21088
|
//#endregion
|
|
20755
21089
|
//#region src/plugin.d.ts
|
|
20756
|
-
/** A command group
|
|
21090
|
+
/** A command group, as `GroupBuilder` declares one. */
|
|
20757
21091
|
interface GroupDefinition {
|
|
20758
21092
|
summary: string;
|
|
20759
21093
|
details?: string;
|
|
20760
|
-
/** Its sentence of the
|
|
21094
|
+
/** Its sentence of the capability index, such as `Posts to the chat.` */
|
|
20761
21095
|
index?: string;
|
|
20762
21096
|
/** The permission categories its leaves need. */
|
|
20763
21097
|
permissions?: Category[];
|
|
@@ -20811,9 +21145,14 @@ interface PluginDefinition {
|
|
|
20811
21145
|
name: string;
|
|
20812
21146
|
/** What it does for the user, in one sentence that names its command. */
|
|
20813
21147
|
description: string;
|
|
20814
|
-
/**
|
|
21148
|
+
/**
|
|
21149
|
+
* Its command groups, by name; each says its sentence of the capability
|
|
21150
|
+
* index, and `placement: 'root'` makes it a command of the shell, run by
|
|
21151
|
+
* its own name, where it is a group under `jush` without.
|
|
21152
|
+
*/
|
|
20815
21153
|
commands?: Record<string, GroupDefinition & {
|
|
20816
21154
|
index: string;
|
|
21155
|
+
placement?: Placement;
|
|
20817
21156
|
}>;
|
|
20818
21157
|
/** The context block it adds before each request of a node, if any. */
|
|
20819
21158
|
context?(request: Extract<Request$1, {
|
|
@@ -20881,6 +21220,17 @@ interface CommandCall extends PluginPort {
|
|
|
20881
21220
|
type Notified = StarterAnswer extends (infer Answer) ? (Answer extends {
|
|
20882
21221
|
id: number;
|
|
20883
21222
|
} ? Omit<Answer, 'id'> : never) : never;
|
|
21223
|
+
/** A file the program holds, as `core.upload` takes it. */
|
|
21224
|
+
interface FileBytes {
|
|
21225
|
+
/** The file's name, without a path, such as `receipt.png`. */
|
|
21226
|
+
name: string;
|
|
21227
|
+
bytes: Uint8Array | ArrayBuffer | Blob;
|
|
21228
|
+
/**
|
|
21229
|
+
* Its media type, else a `Blob`'s own; an image, a video, a recording or a
|
|
21230
|
+
* PDF is recorded as its bytes show it whatever this says.
|
|
21231
|
+
*/
|
|
21232
|
+
mediaType?: string;
|
|
21233
|
+
}
|
|
20884
21234
|
/** What a core is opened with. */
|
|
20885
21235
|
interface CoreOpening {
|
|
20886
21236
|
process: Process;
|
|
@@ -20919,6 +21269,19 @@ declare class Core {
|
|
|
20919
21269
|
*/
|
|
20920
21270
|
on(event: 'state', listener: (state: CoreState) => void): () => void;
|
|
20921
21271
|
on(event: 'notify', listener: (message: PushMessage) => Promise<Notified> | Notified): () => void;
|
|
21272
|
+
/**
|
|
21273
|
+
* Keeps `file` as an upload of the core's, as the web app's composer does,
|
|
21274
|
+
* and answers the block a message, a steer or a run sends it in.
|
|
21275
|
+
*/
|
|
21276
|
+
upload(file: FileBytes): Promise<Extract<ClientContent, {
|
|
21277
|
+
type: 'upload';
|
|
21278
|
+
}>>;
|
|
21279
|
+
/**
|
|
21280
|
+
* Changes what `patch` names of the core's preferences, the web app's
|
|
21281
|
+
* Settings, and answers them, such as `commandLocale`, the time zone and
|
|
21282
|
+
* languages its commands and browsers run in.
|
|
21283
|
+
*/
|
|
21284
|
+
updatePreferences(patch: PreferencesPatch): Promise<Preferences>;
|
|
20922
21285
|
/**
|
|
20923
21286
|
* Answers `request` with the core's route it names below `base`, such as
|
|
20924
21287
|
* `/jush/api/conversations` below `/jush/api`, as the program's server
|
|
@@ -21166,4 +21529,4 @@ declare class Jush {
|
|
|
21166
21529
|
private call;
|
|
21167
21530
|
}
|
|
21168
21531
|
//#endregion
|
|
21169
|
-
export { type AcceptedSocket, type CommandCall, Conversation, type ConversationEvent, type ConversationOptions, type ConversationSchedules, Conversations, Core, Device, Devices, type ExecOptions, type ExecResult, type GroupDefinition, type Input, Jush, type JushConnection, JushError, type JushOptions, type LeafDefinition, type Notified, type Permission, type Plugin, type PluginDefinition, type PluginPort, PortFailure, type ProviderAccounts, Providers, type SignIn, type Turn, definePlugin, leaf };
|
|
21532
|
+
export { type AcceptedSocket, type CommandCall, Conversation, type ConversationEvent, type ConversationOptions, type ConversationSchedules, Conversations, Core, Device, Devices, type ExecOptions, type ExecResult, type FileBytes, type GroupDefinition, type Input, Jush, type JushConnection, JushError, type JushOptions, type LeafDefinition, type Notified, type Permission, type Plugin, type PluginDefinition, type PluginPort, PortFailure, type ProviderAccounts, Providers, type SignIn, type Turn, definePlugin, leaf };
|
package/dist/index.mjs
CHANGED
|
@@ -1471,7 +1471,8 @@ const blockSchema = z.discriminatedUnion("type", [
|
|
|
1471
1471
|
request: z.string().min(1).optional(),
|
|
1472
1472
|
model: modelSelectionSchema,
|
|
1473
1473
|
/**
|
|
1474
|
-
* The source that answered:
|
|
1474
|
+
* The source that answered: [`USER_TIME_SOURCE`], `execution`,
|
|
1475
|
+
* [`INSTRUCTIONS_SOURCE`], [`PINNED_DOCUMENTS_SOURCE`],
|
|
1475
1476
|
* [`WORKING_DIRECTORY_SOURCE`], or a plugin's id.
|
|
1476
1477
|
*/
|
|
1477
1478
|
source: z.string().min(1).max(64),
|
|
@@ -5451,7 +5452,8 @@ const attachmentDtoSchema = z.object({
|
|
|
5451
5452
|
createdAt: z.iso.datetime({ precision: 3 }),
|
|
5452
5453
|
snippet: z.string().optional()
|
|
5453
5454
|
});
|
|
5454
|
-
|
|
5455
|
+
/** The answer of an upload that sent the file's bytes. */
|
|
5456
|
+
const attachmentAnswerSchema = z.object({ attachment: attachmentDtoSchema });
|
|
5455
5457
|
z.object({ attachment: attachmentDtoSchema.nullable() });
|
|
5456
5458
|
/** `AuthenticatorAttestationResponseJSON`. */
|
|
5457
5459
|
const attestationResponseJsonSchema = z.strictObject({
|
|
@@ -7421,6 +7423,12 @@ const preferencesSchema = z.object({
|
|
|
7421
7423
|
*/
|
|
7422
7424
|
locale: browserLocaleSchema.optional(),
|
|
7423
7425
|
/**
|
|
7426
|
+
* The time zone and languages commands run in, which a program sets, in
|
|
7427
|
+
* place of what the user's browser reported; none follows the
|
|
7428
|
+
* browser's. A page never writes it.
|
|
7429
|
+
*/
|
|
7430
|
+
commandLocale: commandLocaleSchema.optional(),
|
|
7431
|
+
/**
|
|
7424
7432
|
* The color scheme the user's page last reported showing, which the
|
|
7425
7433
|
* conversation browser starts with.
|
|
7426
7434
|
*/
|
|
@@ -9368,6 +9376,11 @@ z.strictObject({
|
|
|
9368
9376
|
* refused.
|
|
9369
9377
|
*/
|
|
9370
9378
|
locale: browserLocaleSchema.optional(),
|
|
9379
|
+
/**
|
|
9380
|
+
* The time zone and languages commands run in; null follows the
|
|
9381
|
+
* browser's report again. Checked as `locale` is.
|
|
9382
|
+
*/
|
|
9383
|
+
commandLocale: commandLocaleSchema.nullable().optional(),
|
|
9371
9384
|
/** The color scheme the user's page shows. */
|
|
9372
9385
|
colorScheme: colorSchemeSchema.optional(),
|
|
9373
9386
|
/** What Enter does with a message while the agent works. */
|
|
@@ -10767,7 +10780,8 @@ z.strictObject({
|
|
|
10767
10780
|
disabled: z.boolean().nullable().optional(),
|
|
10768
10781
|
cloudStorage: cloudStorageSchema.nullable().optional()
|
|
10769
10782
|
});
|
|
10770
|
-
|
|
10783
|
+
/** `{ preferences }`: the answer of `GET` and `PATCH /settings/preferences`. */
|
|
10784
|
+
const userPreferencesSchema = z.object({ preferences: preferencesSchema });
|
|
10771
10785
|
/**
|
|
10772
10786
|
* `GET /users`: every account, in the order they were created, and whether
|
|
10773
10787
|
* their Cloud Storage bounds their Clouds, which the isolation the master
|
|
@@ -13605,14 +13619,26 @@ var CoreRoutes = class {
|
|
|
13605
13619
|
path(path) {
|
|
13606
13620
|
return `/cores/${encodeURIComponent(this.id)}/api${path}`;
|
|
13607
13621
|
}
|
|
13608
|
-
/**
|
|
13622
|
+
/**
|
|
13623
|
+
* Calls the route `path` with `body`, a `Blob` as its bytes of its type
|
|
13624
|
+
* and anything else as JSON; throws `JushError` for an answer other than
|
|
13625
|
+
* 2xx. A `Blob`'s length is declared, so a route refuses one over its
|
|
13626
|
+
* limit before it reads a byte of it.
|
|
13627
|
+
*/
|
|
13609
13628
|
async request(method, path, body, signal) {
|
|
13629
|
+
const sent = body === void 0 ? {} : body instanceof Blob ? {
|
|
13630
|
+
body,
|
|
13631
|
+
headers: {
|
|
13632
|
+
"content-type": body.type || "application/octet-stream",
|
|
13633
|
+
"content-length": String(body.size)
|
|
13634
|
+
}
|
|
13635
|
+
} : {
|
|
13636
|
+
body: JSON.stringify(body),
|
|
13637
|
+
headers: { "content-type": "application/json" }
|
|
13638
|
+
};
|
|
13610
13639
|
const response = await this.process.fetch(new Request(PROCESS_ORIGIN + this.path(path), {
|
|
13611
13640
|
method,
|
|
13612
|
-
...
|
|
13613
|
-
body: JSON.stringify(body),
|
|
13614
|
-
headers: { "content-type": "application/json" }
|
|
13615
|
-
},
|
|
13641
|
+
...sent,
|
|
13616
13642
|
...signal === void 0 ? {} : { signal }
|
|
13617
13643
|
}));
|
|
13618
13644
|
if (!response.ok) throw await refusal(response, `${method} ${path}`);
|
|
@@ -14179,7 +14205,7 @@ function leaf(definition) {
|
|
|
14179
14205
|
/** The plugin `definition` defines. */
|
|
14180
14206
|
function definePlugin(definition) {
|
|
14181
14207
|
const commands = Object.entries(definition.commands ?? {}).map(([name, group]) => ({
|
|
14182
|
-
placement: "jush",
|
|
14208
|
+
placement: group.placement ?? "jush",
|
|
14183
14209
|
tree: groupNode(name, group),
|
|
14184
14210
|
calls: []
|
|
14185
14211
|
}));
|
|
@@ -14728,6 +14754,34 @@ var Core = class {
|
|
|
14728
14754
|
};
|
|
14729
14755
|
}
|
|
14730
14756
|
/**
|
|
14757
|
+
* Keeps `file` as an upload of the core's, as the web app's composer does,
|
|
14758
|
+
* and answers the block a message, a steer or a run sends it in.
|
|
14759
|
+
*/
|
|
14760
|
+
async upload(file) {
|
|
14761
|
+
const named = clientContentSchema.safeParse({
|
|
14762
|
+
type: "upload",
|
|
14763
|
+
ref: "unsent",
|
|
14764
|
+
fileName: file.name
|
|
14765
|
+
});
|
|
14766
|
+
if (!named.success) throw new Error(`${JSON.stringify(file.name)} is not a file's name: ${schemaRefusal(named.error)}`);
|
|
14767
|
+
const type = file.mediaType || (file.bytes instanceof Blob ? file.bytes.type : "");
|
|
14768
|
+
const query = new URLSearchParams({ name: file.name });
|
|
14769
|
+
const { attachment } = await this.routes.json("POST", `/attachments?${query}`, attachmentAnswerSchema, new Blob([file.bytes], { type }));
|
|
14770
|
+
return {
|
|
14771
|
+
type: "upload",
|
|
14772
|
+
ref: attachment.id,
|
|
14773
|
+
fileName: file.name
|
|
14774
|
+
};
|
|
14775
|
+
}
|
|
14776
|
+
/**
|
|
14777
|
+
* Changes what `patch` names of the core's preferences, the web app's
|
|
14778
|
+
* Settings, and answers them, such as `commandLocale`, the time zone and
|
|
14779
|
+
* languages its commands and browsers run in.
|
|
14780
|
+
*/
|
|
14781
|
+
async updatePreferences(patch) {
|
|
14782
|
+
return (await this.routes.json("PATCH", "/settings/preferences", userPreferencesSchema, patch)).preferences;
|
|
14783
|
+
}
|
|
14784
|
+
/**
|
|
14731
14785
|
* Answers `request` with the core's route it names below `base`, such as
|
|
14732
14786
|
* `/jush/api/conversations` below `/jush/api`, as the program's server
|
|
14733
14787
|
* forwards a page's request.
|
|
@@ -15231,7 +15285,10 @@ var Process = class Process {
|
|
|
15231
15285
|
readable: child.stdout,
|
|
15232
15286
|
writable: child.stdin
|
|
15233
15287
|
});
|
|
15234
|
-
const session = http2.connect("http://jush-core", {
|
|
15288
|
+
const session = http2.connect("http://jush-core", {
|
|
15289
|
+
...SESSION_OPTIONS,
|
|
15290
|
+
createConnection: () => stdio
|
|
15291
|
+
});
|
|
15235
15292
|
exited.then(() => session.destroy());
|
|
15236
15293
|
return {
|
|
15237
15294
|
session,
|
|
@@ -15248,7 +15305,7 @@ var Process = class Process {
|
|
|
15248
15305
|
static connect(address) {
|
|
15249
15306
|
const url = new URL(address.url);
|
|
15250
15307
|
const dial = () => {
|
|
15251
|
-
const session = http2.connect(url);
|
|
15308
|
+
const session = http2.connect(url, SESSION_OPTIONS);
|
|
15252
15309
|
return {
|
|
15253
15310
|
session,
|
|
15254
15311
|
settled: settled(session, new Promise(() => {}))
|
|
@@ -15314,21 +15371,12 @@ var Process = class Process {
|
|
|
15314
15371
|
const abort = () => stream.close(http2.constants.NGHTTP2_CANCEL);
|
|
15315
15372
|
if (request.signal.aborted) abort();
|
|
15316
15373
|
request.signal.addEventListener("abort", abort, { once: true });
|
|
15317
|
-
const
|
|
15374
|
+
const bodied = (status) => request.method !== "HEAD" && status !== 204 && status !== 304;
|
|
15375
|
+
const response = await answered(stream, bodied).catch((error) => {
|
|
15318
15376
|
throw request.signal.aborted ? request.signal.reason : error;
|
|
15319
15377
|
}).finally(() => request.signal.removeEventListener("abort", abort));
|
|
15320
|
-
|
|
15321
|
-
|
|
15322
|
-
for (const [name, value] of Object.entries(answer)) {
|
|
15323
|
-
if (name.startsWith(":") || value === void 0) continue;
|
|
15324
|
-
for (const each of Array.isArray(value) ? value : [value]) responseHeaders.append(name, String(each));
|
|
15325
|
-
}
|
|
15326
|
-
const empty = request.method === "HEAD" || status === 204 || status === 304;
|
|
15327
|
-
if (empty) stream.resume();
|
|
15328
|
-
return new Response(empty ? null : webBody(stream), {
|
|
15329
|
-
status,
|
|
15330
|
-
headers: responseHeaders
|
|
15331
|
-
});
|
|
15378
|
+
if (response.body === null) stream.resume();
|
|
15379
|
+
return response;
|
|
15332
15380
|
}
|
|
15333
15381
|
/**
|
|
15334
15382
|
* Opens `path` by an extended CONNECT of `protocol` (RFC 8441), such as
|
|
@@ -15346,19 +15394,8 @@ var Process = class Process {
|
|
|
15346
15394
|
":path": path
|
|
15347
15395
|
});
|
|
15348
15396
|
stream.on("error", () => {});
|
|
15349
|
-
const
|
|
15350
|
-
|
|
15351
|
-
if (Number(headers[":status"]) !== 200) stream.on("data", (chunk) => body.push(chunk));
|
|
15352
|
-
});
|
|
15353
|
-
const answer = await answered(stream);
|
|
15354
|
-
const status = Number(answer[":status"]);
|
|
15355
|
-
if (status !== 200) {
|
|
15356
|
-
if (!stream.readableEnded && !stream.closed) await new Promise((resolve) => {
|
|
15357
|
-
stream.once("end", resolve);
|
|
15358
|
-
stream.once("close", resolve);
|
|
15359
|
-
});
|
|
15360
|
-
throw await refusal(new Response(Buffer.concat(body), { status }), `CONNECT ${path}`);
|
|
15361
|
-
}
|
|
15397
|
+
const response = await answered(stream, (status) => status !== 200);
|
|
15398
|
+
if (response.status !== 200) throw await refusal(response, `CONNECT ${path}`);
|
|
15362
15399
|
this.lasting.add(stream);
|
|
15363
15400
|
stream.once("close", () => this.lasting.delete(stream));
|
|
15364
15401
|
return stream;
|
|
@@ -15387,14 +15424,44 @@ function settled(session, failed) {
|
|
|
15387
15424
|
session.on("error", () => {});
|
|
15388
15425
|
return settling;
|
|
15389
15426
|
}
|
|
15390
|
-
/**
|
|
15391
|
-
|
|
15427
|
+
/**
|
|
15428
|
+
* The options of a session to a process. Node counts the request bodies it
|
|
15429
|
+
* queued against the session's memory, 10 MB by default, and past it
|
|
15430
|
+
* refuses the streams and the answers that come: the answer to an upload of
|
|
15431
|
+
* more, when the process answers before it read it all, never comes, and a
|
|
15432
|
+
* request sent while one is queued fails. The process is the program's own,
|
|
15433
|
+
* which the cap does not guard against, so it is the largest the option's
|
|
15434
|
+
* 32 bits of megabytes hold; Bun has no such cap.
|
|
15435
|
+
*/
|
|
15436
|
+
const SESSION_OPTIONS = { maxSessionMemory: 2 ** 32 - 1 };
|
|
15437
|
+
/**
|
|
15438
|
+
* The response `stream` brings, with a body when `bodied` says its status
|
|
15439
|
+
* has one, else with none and the stream left to the caller; throws when it
|
|
15440
|
+
* closes unanswered.
|
|
15441
|
+
*
|
|
15442
|
+
* The body is made as the headers come, not once they are awaited: Bun's
|
|
15443
|
+
* streams flow before anyone reads them, and when the process answers
|
|
15444
|
+
* before it read the whole request, as a refusal of a body over its limit
|
|
15445
|
+
* does, Bun emits the body, its end and the stream's close in the same
|
|
15446
|
+
* tick as the headers, so a body made a microtask later never hears them
|
|
15447
|
+
* and its reader waits forever.
|
|
15448
|
+
*/
|
|
15449
|
+
function answered(stream, bodied) {
|
|
15392
15450
|
return new Promise((resolve, reject) => {
|
|
15393
15451
|
const closed = () => reject(/* @__PURE__ */ new Error(`The process closed the stream unanswered (${stream.rstCode ?? "no code"})`));
|
|
15394
15452
|
stream.once("close", closed);
|
|
15395
|
-
stream.once("response", (
|
|
15453
|
+
stream.once("response", (answer) => {
|
|
15396
15454
|
stream.off("close", closed);
|
|
15397
|
-
|
|
15455
|
+
const status = Number(answer[":status"]);
|
|
15456
|
+
const headers = new Headers();
|
|
15457
|
+
for (const [name, value] of Object.entries(answer)) {
|
|
15458
|
+
if (name.startsWith(":") || value === void 0) continue;
|
|
15459
|
+
for (const each of Array.isArray(value) ? value : [value]) headers.append(name, String(each));
|
|
15460
|
+
}
|
|
15461
|
+
resolve(new Response(bodied(status) ? webBody(stream) : null, {
|
|
15462
|
+
status,
|
|
15463
|
+
headers
|
|
15464
|
+
}));
|
|
15398
15465
|
});
|
|
15399
15466
|
});
|
|
15400
15467
|
}
|
|
@@ -15403,12 +15470,15 @@ function answered(stream) {
|
|
|
15403
15470
|
* cancels it once cancelled. Node's `Readable.toWeb` is not used: it throws
|
|
15404
15471
|
* from its listener when data comes after the reader cancelled, which
|
|
15405
15472
|
* crashes the program.
|
|
15473
|
+
*
|
|
15474
|
+
* The stream flows until the queue holds what the stream itself buffers:
|
|
15475
|
+
* Bun emits no end for a stream paused as it ends and reset right after,
|
|
15476
|
+
* as one answered before it read the whole request is.
|
|
15406
15477
|
*/
|
|
15407
15478
|
function webBody(stream) {
|
|
15408
15479
|
let settled = false;
|
|
15409
15480
|
return new ReadableStream({
|
|
15410
15481
|
start(controller) {
|
|
15411
|
-
stream.pause();
|
|
15412
15482
|
stream.on("data", (chunk) => {
|
|
15413
15483
|
if (settled) return;
|
|
15414
15484
|
controller.enqueue(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
|
|
@@ -15434,7 +15504,7 @@ function webBody(stream) {
|
|
|
15434
15504
|
settled = true;
|
|
15435
15505
|
stream.close(http2.constants.NGHTTP2_CANCEL);
|
|
15436
15506
|
}
|
|
15437
|
-
});
|
|
15507
|
+
}, new ByteLengthQueuingStrategy({ highWaterMark: stream.readableHighWaterMark }));
|
|
15438
15508
|
}
|
|
15439
15509
|
/** What separates the paths of a list, as `PATH` writes them. */
|
|
15440
15510
|
function pathListSeparator() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jush-agent/sdk",
|
|
3
3
|
"description": "Jush's agents in a program: its cores, conversations, providers, devices and plugins, in a process of the program's own.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.6332",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"homepage": "https://github.com/jush-ai/jush/tree/main/packages/sdk#readme",
|
|
36
36
|
"bugs": "https://github.com/jush-ai/jush/issues",
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@jush-agent/sdk-darwin-arm64": "0.2.
|
|
39
|
-
"@jush-agent/sdk-darwin-x64": "0.2.
|
|
40
|
-
"@jush-agent/sdk-linux-arm64": "0.2.
|
|
41
|
-
"@jush-agent/sdk-linux-x64": "0.2.
|
|
42
|
-
"@jush-agent/sdk-win32-arm64": "0.2.
|
|
43
|
-
"@jush-agent/sdk-win32-x64": "0.2.
|
|
38
|
+
"@jush-agent/sdk-darwin-arm64": "0.2.6332",
|
|
39
|
+
"@jush-agent/sdk-darwin-x64": "0.2.6332",
|
|
40
|
+
"@jush-agent/sdk-linux-arm64": "0.2.6332",
|
|
41
|
+
"@jush-agent/sdk-linux-x64": "0.2.6332",
|
|
42
|
+
"@jush-agent/sdk-win32-arm64": "0.2.6332",
|
|
43
|
+
"@jush-agent/sdk-win32-x64": "0.2.6332"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "jush.browser",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6332",
|
|
4
4
|
"protocolVersion": 1,
|
|
5
5
|
"operations": [
|
|
6
6
|
"browser.tab.new",
|
|
@@ -60,28 +60,28 @@
|
|
|
60
60
|
],
|
|
61
61
|
"targets": {
|
|
62
62
|
"aarch64-apple-darwin": {
|
|
63
|
-
"sha256": "
|
|
64
|
-
"size":
|
|
63
|
+
"sha256": "e66487a548b19ab1c0466340632dd4753e0f60d7994cc23da40174f594f0052a",
|
|
64
|
+
"size": 28312752
|
|
65
65
|
},
|
|
66
66
|
"aarch64-pc-windows-msvc": {
|
|
67
|
-
"sha256": "
|
|
68
|
-
"size":
|
|
67
|
+
"sha256": "e014b411bbf9947be0fae3b7b861076e32e16b8b3e868dd8e6e5dbfd45de2822",
|
|
68
|
+
"size": 25749504
|
|
69
69
|
},
|
|
70
70
|
"aarch64-unknown-linux-musl": {
|
|
71
|
-
"sha256": "
|
|
72
|
-
"size":
|
|
71
|
+
"sha256": "a60a288be592ec35e006d4f713f2335515984d3cd859080c9ed3f10f39188fcf",
|
|
72
|
+
"size": 24363248
|
|
73
73
|
},
|
|
74
74
|
"x86_64-apple-darwin": {
|
|
75
|
-
"sha256": "
|
|
76
|
-
"size":
|
|
75
|
+
"sha256": "befdf32afdcf72ec8253c91f66714a51ed7e870bb10e7f22f4db47517245f5a9",
|
|
76
|
+
"size": 28822144
|
|
77
77
|
},
|
|
78
78
|
"x86_64-pc-windows-msvc": {
|
|
79
|
-
"sha256": "
|
|
80
|
-
"size":
|
|
79
|
+
"sha256": "929c5a28b72cd9621ce75881f2cc48cd1f6a9539d795e39f321ae69eb74317f0",
|
|
80
|
+
"size": 28678656
|
|
81
81
|
},
|
|
82
82
|
"x86_64-unknown-linux-musl": {
|
|
83
|
-
"sha256": "
|
|
84
|
-
"size":
|
|
83
|
+
"sha256": "3d12ad5f21612d3dbbd6a20fecf997670a9e8a52c10b5761cc9a5baa28b3ee0d",
|
|
84
|
+
"size": 26724600
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "jush.fetch",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6332",
|
|
4
4
|
"protocolVersion": 1,
|
|
5
5
|
"operations": [
|
|
6
6
|
"fetch.get"
|
|
7
7
|
],
|
|
8
8
|
"targets": {
|
|
9
9
|
"aarch64-apple-darwin": {
|
|
10
|
-
"sha256": "
|
|
11
|
-
"size":
|
|
10
|
+
"sha256": "fff2c820b5b7dddc6a0c60bffdb247eff4fff32bf1eb52873af7dc72a5b77e21",
|
|
11
|
+
"size": 7165776
|
|
12
12
|
},
|
|
13
13
|
"aarch64-pc-windows-msvc": {
|
|
14
|
-
"sha256": "
|
|
15
|
-
"size":
|
|
14
|
+
"sha256": "64a1f71227f16bdb0f6be509800fd878b911c8b83dfc541476c96fca4ccb83d6",
|
|
15
|
+
"size": 6520320
|
|
16
16
|
},
|
|
17
17
|
"aarch64-unknown-linux-musl": {
|
|
18
|
-
"sha256": "
|
|
19
|
-
"size":
|
|
18
|
+
"sha256": "d31e149ca1bc6a6f269f3ed09becf32bbcf01cecea655b3f5a47b9e6d036e626",
|
|
19
|
+
"size": 6528432
|
|
20
20
|
},
|
|
21
21
|
"x86_64-apple-darwin": {
|
|
22
|
-
"sha256": "
|
|
23
|
-
"size":
|
|
22
|
+
"sha256": "888e15d00c5139461dc213b988f1566ef8ee7e646672bc0e71f40e486032314b",
|
|
23
|
+
"size": 7276288
|
|
24
24
|
},
|
|
25
25
|
"x86_64-pc-windows-msvc": {
|
|
26
|
-
"sha256": "
|
|
27
|
-
"size":
|
|
26
|
+
"sha256": "9d58d3eb4780ed21591f6c9004df3b9debdea698dd6d87f1e806c5fc9f2c035b",
|
|
27
|
+
"size": 6999040
|
|
28
28
|
},
|
|
29
29
|
"x86_64-unknown-linux-musl": {
|
|
30
|
-
"sha256": "
|
|
30
|
+
"sha256": "7962fcb857ec8708a341a3c0b51459ce2c44a4d53dee181563d49099d908ae63",
|
|
31
31
|
"size": 7019760
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "jush.file",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6332",
|
|
4
4
|
"protocolVersion": 1,
|
|
5
5
|
"operations": [
|
|
6
6
|
"file.view",
|
|
@@ -9,27 +9,27 @@
|
|
|
9
9
|
],
|
|
10
10
|
"targets": {
|
|
11
11
|
"aarch64-apple-darwin": {
|
|
12
|
-
"sha256": "
|
|
13
|
-
"size":
|
|
12
|
+
"sha256": "636ee5185ec8936f3f407e592a9235bcb1d333f773539a3468b9a8026f9577b7",
|
|
13
|
+
"size": 4930448
|
|
14
14
|
},
|
|
15
15
|
"aarch64-pc-windows-msvc": {
|
|
16
|
-
"sha256": "
|
|
16
|
+
"sha256": "45e7e3c1886d14ebbccb0c75dc542a8165002b681a81f24668f16736903a473e",
|
|
17
17
|
"size": 4367872
|
|
18
18
|
},
|
|
19
19
|
"aarch64-unknown-linux-musl": {
|
|
20
|
-
"sha256": "
|
|
21
|
-
"size":
|
|
20
|
+
"sha256": "cc9d3271bf5cecf20c0d5713fe2362c053af51f8fc7d8af7457e6d14c92907ac",
|
|
21
|
+
"size": 4471040
|
|
22
22
|
},
|
|
23
23
|
"x86_64-apple-darwin": {
|
|
24
|
-
"sha256": "
|
|
25
|
-
"size":
|
|
24
|
+
"sha256": "32ef5e51af88deba10b7748d85b09f79ad2e03545cc32eb982a1a867df0eac61",
|
|
25
|
+
"size": 4806728
|
|
26
26
|
},
|
|
27
27
|
"x86_64-pc-windows-msvc": {
|
|
28
|
-
"sha256": "
|
|
29
|
-
"size":
|
|
28
|
+
"sha256": "a51a5e6e7094f17325939843cf1060d84ef461048779084206802811ce4d78fa",
|
|
29
|
+
"size": 4673024
|
|
30
30
|
},
|
|
31
31
|
"x86_64-unknown-linux-musl": {
|
|
32
|
-
"sha256": "
|
|
32
|
+
"sha256": "c853bf8f79f5b59670687e6a65ec1632649265df1496608119f2e4ad5075d655",
|
|
33
33
|
"size": 4694912
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "jush.mobile",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6332",
|
|
4
4
|
"protocolVersion": 1,
|
|
5
5
|
"operations": [
|
|
6
6
|
"mobile.list",
|
|
@@ -25,28 +25,28 @@
|
|
|
25
25
|
],
|
|
26
26
|
"targets": {
|
|
27
27
|
"aarch64-apple-darwin": {
|
|
28
|
-
"sha256": "
|
|
29
|
-
"size":
|
|
28
|
+
"sha256": "b7d19db5045249ea9dca46818bc7436c6004c3928be4c8eac16ee234717b6c3a",
|
|
29
|
+
"size": 22229856
|
|
30
30
|
},
|
|
31
31
|
"aarch64-pc-windows-msvc": {
|
|
32
|
-
"sha256": "
|
|
33
|
-
"size":
|
|
32
|
+
"sha256": "5145f14d9962ba4dfa99dc87cd74ae7cb56bd820c992e7bfdcae23f018492f74",
|
|
33
|
+
"size": 17905152
|
|
34
34
|
},
|
|
35
35
|
"aarch64-unknown-linux-musl": {
|
|
36
|
-
"sha256": "
|
|
37
|
-
"size":
|
|
36
|
+
"sha256": "fdf2ab1f9f16328b7968513c9463ea813fe67a17138a4e94e092a5e95bac2a97",
|
|
37
|
+
"size": 17352624
|
|
38
38
|
},
|
|
39
39
|
"x86_64-apple-darwin": {
|
|
40
|
-
"sha256": "
|
|
41
|
-
"size":
|
|
40
|
+
"sha256": "c9c4393d95e866ce3ea21138cea3c42ee973ce8964b99b3802f919759f9c7c87",
|
|
41
|
+
"size": 21518328
|
|
42
42
|
},
|
|
43
43
|
"x86_64-pc-windows-msvc": {
|
|
44
|
-
"sha256": "
|
|
45
|
-
"size":
|
|
44
|
+
"sha256": "767fbf816e3a57124e2146edf1a3247b14477a7def164b438d0a1f0e3bc3dbd8",
|
|
45
|
+
"size": 20924416
|
|
46
46
|
},
|
|
47
47
|
"x86_64-unknown-linux-musl": {
|
|
48
|
-
"sha256": "
|
|
49
|
-
"size":
|
|
48
|
+
"sha256": "ef67cd94386953157ee811d0ba10df0d18368f286ea8f81b9877ecd8ded4c314",
|
|
49
|
+
"size": 19929216
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "jush.subscription-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6332",
|
|
4
4
|
"protocolVersion": 1,
|
|
5
5
|
"operations": [
|
|
6
6
|
"subscription-cli.ensure",
|
|
@@ -8,28 +8,28 @@
|
|
|
8
8
|
],
|
|
9
9
|
"targets": {
|
|
10
10
|
"aarch64-apple-darwin": {
|
|
11
|
-
"sha256": "
|
|
12
|
-
"size":
|
|
11
|
+
"sha256": "e028cfb3ab522242e1fb6a66fcfc1212fbd2d5503eb2fca9745c55c533b83acd",
|
|
12
|
+
"size": 2615888
|
|
13
13
|
},
|
|
14
14
|
"aarch64-pc-windows-msvc": {
|
|
15
|
-
"sha256": "
|
|
15
|
+
"sha256": "97ec6a227fe2f0eec8cd9124885eb730e65cc399998873e3171216ccf2f54542",
|
|
16
16
|
"size": 2319872
|
|
17
17
|
},
|
|
18
18
|
"aarch64-unknown-linux-musl": {
|
|
19
|
-
"sha256": "
|
|
20
|
-
"size":
|
|
19
|
+
"sha256": "27d85a1bc8309dcdd6db395bda06ea0148637e41a0b00ff0fd96eb1101c07efa",
|
|
20
|
+
"size": 2449800
|
|
21
21
|
},
|
|
22
22
|
"x86_64-apple-darwin": {
|
|
23
|
-
"sha256": "
|
|
24
|
-
"size":
|
|
23
|
+
"sha256": "5e7c948ab09d3330808f7a87e310dac60f00646473c614447e7756455b88e094",
|
|
24
|
+
"size": 2513880
|
|
25
25
|
},
|
|
26
26
|
"x86_64-pc-windows-msvc": {
|
|
27
|
-
"sha256": "
|
|
28
|
-
"size":
|
|
27
|
+
"sha256": "1447ea38bf37d93e0295336ee559ace7ed9af06c1430aa7b81152b73d3862c3b",
|
|
28
|
+
"size": 2437632
|
|
29
29
|
},
|
|
30
30
|
"x86_64-unknown-linux-musl": {
|
|
31
|
-
"sha256": "
|
|
32
|
-
"size":
|
|
31
|
+
"sha256": "6b599e033df8fed73679adc3d60cba647eaff94ba8b5c074796ccd34b816a5f6",
|
|
32
|
+
"size": 2512008
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|