@allyhub/sdk 0.15.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/node_modules/@allyhub/audio/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/audio/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/audio/dist/place.d.ts +26 -0
- package/dist/node_modules/@allyhub/audio/dist/place.js +2 -0
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +15 -3
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/website.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +70 -11
- package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +15 -4
- package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +4 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/stage.js +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +15 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/page/runtimes.d.ts +9 -0
- package/dist/node_modules/@allyhub/piece/dist/page/runtimes.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +53 -10
- package/dist/node_modules/@allyhub/piece/dist/source.js +1 -1
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +10 -11
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +7 -0
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/blobs.d.ts +9 -0
- package/dist/node_modules/@allyhub/protocol/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.d.ts +77 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +39 -9
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +15 -15
- package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +441 -5
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/files.d.ts +2 -2
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +4 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +8 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +5 -5
- package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +45 -0
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/paywall.d.ts +134 -0
- package/dist/node_modules/@allyhub/protocol/dist/paywall.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/presence.d.ts +3 -3
- package/dist/node_modules/@allyhub/protocol/dist/purposes.d.ts +47 -0
- package/dist/node_modules/@allyhub/protocol/dist/purposes.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +52 -5
- package/dist/node_modules/@allyhub/protocol/dist/shares.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.d.ts +34 -0
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/sites.d.ts +1 -0
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +21 -52
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.d.ts +264 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.d.ts +18 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.d.ts +97 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +3 -2
- package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +26 -20
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/turns.d.ts +71 -0
- package/dist/node_modules/@allyhub/protocol/dist/turns.js +2 -0
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.d.ts +12 -0
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/dynamic.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/logical.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.d.ts +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +10 -0
- package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/components.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +3 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +5 -0
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/dist/free.d.ts +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/docs/batches.md +4 -4
- package/docs/contract.md +5 -5
- package/docs/defaults.md +2 -2
- package/docs/docs.md +16 -5
- package/docs/footage.md +8 -8
- package/docs/image.md +5 -5
- package/docs/layers.md +12 -10
- package/docs/linkedin.md +1 -1
- package/docs/modeling.md +3 -3
- package/docs/pictures.md +4 -4
- package/docs/project.md +11 -7
- package/docs/scenery.md +3 -3
- package/docs/sheets.md +5 -5
- package/docs/slides.md +3 -3
- package/docs/sound.md +7 -7
- package/docs/speech.md +7 -7
- package/docs/video.md +3 -3
- package/docs/websites.md +3 -3
- package/docs/x.md +2 -2
- package/package.json +1 -1
|
@@ -68,6 +68,7 @@ export declare const ItemReachSchema: z.ZodObject<{
|
|
|
68
68
|
sha256: z.ZodString;
|
|
69
69
|
size: z.ZodInt;
|
|
70
70
|
type: z.ZodString;
|
|
71
|
+
immutable: z.ZodOptional<z.ZodLiteral<true>>;
|
|
71
72
|
}, z.core.$strip>>;
|
|
72
73
|
}, z.core.$strip>;
|
|
73
74
|
export type ItemReach = z.infer<typeof ItemReachSchema>;
|
|
@@ -81,6 +82,7 @@ export declare const SnapshotReachSchema: z.ZodObject<{
|
|
|
81
82
|
sha256: z.ZodString;
|
|
82
83
|
size: z.ZodInt;
|
|
83
84
|
type: z.ZodString;
|
|
85
|
+
immutable: z.ZodOptional<z.ZodLiteral<true>>;
|
|
84
86
|
}, z.core.$strip>>;
|
|
85
87
|
}, z.core.$strip>>;
|
|
86
88
|
}, z.core.$strip>;
|
|
@@ -106,6 +108,7 @@ export declare const SnapshotManifestSchema: z.ZodObject<{
|
|
|
106
108
|
sha256: z.ZodString;
|
|
107
109
|
size: z.ZodInt;
|
|
108
110
|
type: z.ZodString;
|
|
111
|
+
immutable: z.ZodOptional<z.ZodLiteral<true>>;
|
|
109
112
|
}, z.core.$strip>>;
|
|
110
113
|
conversations: z.ZodArray<z.ZodObject<{
|
|
111
114
|
sessionId: z.ZodString;
|
|
@@ -124,6 +127,7 @@ export declare const SnapshotManifestSchema: z.ZodObject<{
|
|
|
124
127
|
sha256: z.ZodString;
|
|
125
128
|
size: z.ZodInt;
|
|
126
129
|
type: z.ZodString;
|
|
130
|
+
immutable: z.ZodOptional<z.ZodLiteral<true>>;
|
|
127
131
|
}, z.core.$strip>>;
|
|
128
132
|
}, z.core.$strip>>;
|
|
129
133
|
}, z.core.$strip>>;
|
|
@@ -140,9 +144,11 @@ export type SnapshotManifest = z.infer<typeof SnapshotManifestSchema>;
|
|
|
140
144
|
export declare function scopedManifest(m: SnapshotManifest, item: string): SnapshotManifest | undefined;
|
|
141
145
|
/**
|
|
142
146
|
* What a project's backup leaves out, as folders anywhere in it: what is
|
|
143
|
-
* made again from the rest
|
|
147
|
+
* made again from the rest, as a project's .gitignore leaves it out
|
|
148
|
+
* (formats' GITIGNORE): its packages, AllyHub's own folder (caches,
|
|
149
|
+
* exports, the agent's working files) and playwright-cli's page snapshots.
|
|
144
150
|
*/
|
|
145
|
-
export declare const SNAPSHOT_SKIPPED: readonly ["node_modules", ".allyhub
|
|
151
|
+
export declare const SNAPSHOT_SKIPPED: readonly ["node_modules", ".allyhub", ".playwright-cli"];
|
|
146
152
|
/**
|
|
147
153
|
* The tree a read view serves, by the core's top folders. Every address
|
|
148
154
|
* inside it is relative, so it is the same tree a live dev server serves
|
|
@@ -292,13 +298,7 @@ export declare function snapshotEditorUrl(origin: string, item: string, o?: {
|
|
|
292
298
|
}): string;
|
|
293
299
|
export declare const EXECUTOR_KINDS: readonly ["cloud", "computer"];
|
|
294
300
|
export type ExecutorKind = (typeof EXECUTOR_KINDS)[number];
|
|
295
|
-
/**
|
|
296
|
-
export declare const COMPUTER_HEADER = "x-allyhub-computer";
|
|
297
|
-
/** A computer's id: what it made once, kept with its Host. */
|
|
298
|
-
export declare const ComputerIdSchema: z.ZodString;
|
|
299
|
-
/** The error code a snapshot or a move answers with when another executor works on the project (409). */
|
|
300
|
-
export declare const WORKED_ELSEWHERE = "worked_elsewhere";
|
|
301
|
-
/** Which executor works on a project, and whether it is the one asking. */
|
|
301
|
+
/** Which executor works on a project, and whether it is the one asking: the cloud Studio, for clients released before moving was removed. */
|
|
302
302
|
export declare const ExecutorSchema: z.ZodObject<{
|
|
303
303
|
kind: z.ZodUnion<readonly [z.ZodEnum<{
|
|
304
304
|
cloud: "cloud";
|
|
@@ -314,15 +314,15 @@ export type Executor = z.infer<typeof ExecutorSchema>;
|
|
|
314
314
|
export declare const SNAPSHOT_BLOBS_PATH = "/api/snapshots/blobs";
|
|
315
315
|
/**
|
|
316
316
|
* `POST { project, manifest }`: a snapshot recorded, its manifest a blob
|
|
317
|
-
* put already, by
|
|
318
|
-
* the server has not seen, made now
|
|
319
|
-
*
|
|
320
|
-
* WORKED_ELSEWHERE when another executor works on the project.
|
|
317
|
+
* put already, by a cloud Studio (its own key). `project.id` absent: a
|
|
318
|
+
* project the server has not seen, made now. Answers 409 with the blobs
|
|
319
|
+
* storage does not hold.
|
|
321
320
|
*/
|
|
322
321
|
export declare const SNAPSHOTS_PATH = "/api/snapshots";
|
|
323
322
|
export declare const SnapshotCreateSchema: z.ZodObject<{
|
|
324
323
|
project: z.ZodObject<{
|
|
325
324
|
id: z.ZodOptional<z.ZodString>;
|
|
325
|
+
idMadeByMachine: z.ZodOptional<z.ZodBoolean>;
|
|
326
326
|
kind: z.ZodEnum<{
|
|
327
327
|
home: "home";
|
|
328
328
|
project: "project";
|
|
@@ -360,13 +360,13 @@ export declare const ProjectInfoSchema: z.ZodObject<{
|
|
|
360
360
|
madeAt: z.ZodISODateTime;
|
|
361
361
|
hostVersion: z.ZodString;
|
|
362
362
|
}, z.core.$strip>>;
|
|
363
|
-
executor: z.ZodObject<{
|
|
363
|
+
executor: z.ZodOptional<z.ZodObject<{
|
|
364
364
|
kind: z.ZodUnion<readonly [z.ZodEnum<{
|
|
365
365
|
cloud: "cloud";
|
|
366
366
|
computer: "computer";
|
|
367
367
|
}>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
|
|
368
368
|
here: z.ZodBoolean;
|
|
369
|
-
}, z.core.$strip
|
|
369
|
+
}, z.core.$strip>>;
|
|
370
370
|
}, z.core.$strip>;
|
|
371
371
|
export type ProjectInfo = z.infer<typeof ProjectInfoSchema>;
|
|
372
372
|
export declare const ProjectsResponseSchema: z.ZodObject<{
|
|
@@ -379,10 +379,10 @@ export declare const ProjectsResponseSchema: z.ZodObject<{
|
|
|
379
379
|
madeAt: string;
|
|
380
380
|
hostVersion: string;
|
|
381
381
|
} | null;
|
|
382
|
-
executor
|
|
383
|
-
kind: (string & z.core.$brand<"Unknown">)
|
|
382
|
+
executor?: {
|
|
383
|
+
kind: "cloud" | "computer" | (string & z.core.$brand<"Unknown">);
|
|
384
384
|
here: boolean;
|
|
385
|
-
};
|
|
385
|
+
} | undefined;
|
|
386
386
|
}[], unknown[]>>;
|
|
387
387
|
}, z.core.$strip>;
|
|
388
388
|
/** `DELETE`: a project forgotten with its snapshots. */
|
|
@@ -395,8 +395,11 @@ export declare const STORAGE_PATH = "/api/storage";
|
|
|
395
395
|
export declare const StorageSchema: z.ZodObject<{
|
|
396
396
|
keptBytes: z.ZodNumber;
|
|
397
397
|
capBytes: z.ZodNullable<z.ZodNumber>;
|
|
398
|
+
clearingBytes: z.ZodOptional<z.ZodNumber>;
|
|
398
399
|
}, z.core.$strip>;
|
|
399
400
|
export type Storage = z.infer<typeof StorageSchema>;
|
|
401
|
+
/** `DELETE`: what is no longer in use (`clearingBytes`) deleted now, not at the daily sweep; answered `{}`. */
|
|
402
|
+
export declare const STORAGE_CLEARING_PATH = "/api/storage/clearing";
|
|
400
403
|
/** How many entries a page of the person's storage holds. */
|
|
401
404
|
export declare const STORAGE_PAGE_SIZE = 10;
|
|
402
405
|
/** A page (`?page=`, from 1) of the person's storage: its entries and how many there are in all. */
|
|
@@ -450,21 +453,6 @@ export declare const StoredFilesSchema: z.ZodObject<{
|
|
|
450
453
|
total: z.ZodNumber;
|
|
451
454
|
}, z.core.$strip>;
|
|
452
455
|
export type StoredFiles = z.infer<typeof StoredFilesSchema>;
|
|
453
|
-
/**
|
|
454
|
-
* `PUT { kind }`: the project moved to another executor, answered as its
|
|
455
|
-
* `ProjectInfo`: to the person's cloud Studio from anywhere they are
|
|
456
|
-
* signed in, to a computer only by that computer (COMPUTER_HEADER). The
|
|
457
|
-
* executor it leaves is refused from then on (WORKED_ELSEWHERE). A home
|
|
458
|
-
* stays where it is.
|
|
459
|
-
*/
|
|
460
|
-
export declare const projectExecutorPath: (id: string) => string;
|
|
461
|
-
export declare const ExecutorMoveSchema: z.ZodObject<{
|
|
462
|
-
kind: z.ZodEnum<{
|
|
463
|
-
cloud: "cloud";
|
|
464
|
-
computer: "computer";
|
|
465
|
-
}>;
|
|
466
|
-
}, z.core.$strict>;
|
|
467
|
-
export type ExecutorMove = z.infer<typeof ExecutorMoveSchema>;
|
|
468
456
|
/**
|
|
469
457
|
* `POST`: a read view of a snapshot, answered `{ origin, expiresAt }`: a
|
|
470
458
|
* host of its own on the Studio domain, serving the manifest at
|
|
@@ -505,23 +493,4 @@ export declare const PAGE_CSP: string;
|
|
|
505
493
|
export declare const NEEDS_MACHINE = -32010;
|
|
506
494
|
/** Whether an error is the one for what only a running machine does (`NEEDS_MACHINE`), whichever client carried it. */
|
|
507
495
|
export declare const isNeedsMachine: (e: unknown) => boolean;
|
|
508
|
-
/**
|
|
509
|
-
* The JSON-RPC error a Host answers for a change to a project another
|
|
510
|
-
* executor works on (an editor's save, an agent's turn, an upload): one
|
|
511
|
-
* place works on a project at a time, every other reads it; the window
|
|
512
|
-
* offers the move.
|
|
513
|
-
*/
|
|
514
|
-
export declare const ELSEWHERE = -32011;
|
|
515
|
-
/**
|
|
516
|
-
* The JSON-RPC error a move answers when the folder it would replace has
|
|
517
|
-
* changes made here since its base (the snapshot it last recorded or was
|
|
518
|
-
* made from) that the latest snapshot lacks: nothing moved; the data names
|
|
519
|
-
* them (MoveChangesSchema), and the move asked again with `replace`
|
|
520
|
-
* replaces them.
|
|
521
|
-
*/
|
|
522
|
-
export declare const CHANGED_HERE = -32012;
|
|
523
|
-
export declare const MoveChangesSchema: z.ZodObject<{
|
|
524
|
-
changed: z.ZodArray<z.ZodString>;
|
|
525
|
-
}, z.core.$strip>;
|
|
526
|
-
export type MoveChanges = z.infer<typeof MoveChangesSchema>;
|
|
527
496
|
//# sourceMappingURL=snapshots.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{STAGE_LOADS as S}from"@allyhub/formats";import{z as e}from"zod";import{BlobSchema as $,Sha256Schema as
|
|
2
|
+
import{STAGE_LOADS as S}from"@allyhub/formats";import{z as e}from"zod";import{BlobSchema as $,Sha256Schema as b,TreeFileSchema as g,TreePathSchema as m}from"./blobs.js";import{placeParams as P}from"./editor.js";import{known as A,openEnum as j,readable as h}from"./open.js";export const SNAPSHOT_FORMAT=1,ConversationEntrySchema=e.object({sessionId:e.string().min(1),agent:e.string().min(1),title:e.string().optional(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime(),transcript:b}),TranscriptSchema=e.object({sessionId:e.string().min(1),messages:e.array(e.object({method:e.string().min(1),params:e.unknown()}))}),SNAPSHOT_KINDS=["project","home"],StageFolderSchema=e.string().regex(/^[a-z][a-z0-9-]*\/$/u,"one lower-case word and /").refine(t=>!Object.values(SNAPSHOT_TREE).includes(t)&&!Object.values(SNAPSHOT_VIEW).includes(t),"a folder of the core's"),StageLoadSchema=j(S),StageRoutesSchema=e.record(e.string(),e.array(e.string()));const O=e.string().refine(t=>t.endsWith("/")&&m.safeParse(t.slice(0,-1)).success,"a folder of the tree, ending in /");export const ItemReachSchema=e.object({tree:e.array(m),files:e.array(m),own:e.record(m,g)}),SnapshotReachSchema=e.object({shared:e.array(O),items:e.record(e.string(),ItemReachSchema)}),SnapshotManifestSchema=e.object({format:e.literal(SNAPSHOT_FORMAT),kind:e.enum(SNAPSHOT_KINDS),project:e.object({name:e.string().min(1).max(255)}),host:e.object({version:e.string().min(1)}),madeAt:e.iso.datetime(),files:e.record(m,$),tree:e.record(m,g),conversations:e.array(ConversationEntrySchema),reach:SnapshotReachSchema.optional(),routes:StageRoutesSchema.optional()});export function scopedManifest(t,o){const s=t.reach,r=s!==void 0&&Object.hasOwn(s.items,o)?s.items[o]:void 0;if(s===void 0||r===void 0)return;const i={};for(const[n,c]of Object.entries(t.tree))s.shared.some(p=>n.startsWith(p))&&(i[n]=c);for(const n of r.tree){const c=Object.hasOwn(t.tree,n)?t.tree[n]:void 0;c!==void 0&&(i[n]=c)}Object.assign(i,r.own);const a={};for(const n of r.files){const c=Object.hasOwn(t.files,n)?t.files[n]:void 0;c!==void 0&&(a[n]=c)}return{format:t.format,kind:t.kind,project:t.project,host:t.host,madeAt:t.madeAt,files:a,tree:i,conversations:[],...t.routes===void 0?{}:{routes:t.routes}}}export const SNAPSHOT_SKIPPED=["node_modules",".allyhub",".playwright-cli"],SNAPSHOT_TREE={editor:"editor/",runtime:"runtime/",build:"build/",media:"media/",matte:"matte/",stills:"stills/",answers:"answers/",previews:"previews/"};function l(t){return Array.isArray(t)?t.map(l):t!==null&&typeof t=="object"?Object.fromEntries(Object.keys(t).sort().map(o=>[o,l(t[o])])):t}export const snapshotAnswerPath=(t,o)=>`${SNAPSHOT_TREE.answers}${t}/${encodeURIComponent(JSON.stringify(l(o??{})))}.json`,RecordedAnswerSchema=e.object({result:e.unknown().optional(),error:e.object({code:e.number(),message:e.string(),data:e.unknown().optional()}).optional()}),recordedReadPath=(t,o)=>snapshotAnswerPath(t,Object.fromEntries(Object.entries(o??{}).filter(([s,r])=>s!=="folder"&&r!==void 0))),stillPath=t=>`${SNAPSHOT_TREE.stills}${t}.webp`,stillsIndexPath=(t,o)=>`${SNAPSHOT_TREE.stills}index/${encodeURIComponent(t)}/${encodeURIComponent(o)}.json`,StillsIndexSchema=e.object({stills:e.record(e.string(),e.string().regex(/^[0-9a-f]{64}$/u))}),stillsIndexKey=t=>JSON.stringify(l(t));const w=e.object({name:e.string(),props:e.record(e.string(),e.unknown()),width:e.number().positive(),height:e.number().positive(),t:e.number().nonnegative()});export const KindSnapshotSchema=e.object({stills:e.array(e.object({version:e.string(),components:e.array(w)})).optional(),shows:e.object({media:e.array(e.string()),data:e.array(e.string())}).optional(),routes:e.record(e.string(),e.array(e.string().min(1))).optional(),page:e.object({folder:e.string().optional(),file:e.string().optional()}).optional()}),snapshotPreviewPath=t=>`${SNAPSHOT_TREE.previews}${encodeURIComponent(t)}.json`,TREE_PAGES={stage:`${SNAPSHOT_TREE.runtime}stage.html`,viewer:`${SNAPSHOT_TREE.runtime}viewer.html`,probe:`${SNAPSHOT_TREE.runtime}probe.html`},pieceSourcePath=t=>`${SNAPSHOT_TREE.build}sources/${encodeURIComponent(t)}.json`,treeHref=t=>t.split("/").map(encodeURIComponent).join("/");export function stageCsp(t,o,s={}){const r=d=>`${t}${d}`,i=r(SNAPSHOT_TREE.runtime),a=r(SNAPSHOT_TREE.build),n=r(SNAPSHOT_TREE.media),c=r(SNAPSHOT_TREE.matte),p=d=>Object.entries(s).filter(([u,x])=>StageFolderSchema.safeParse(u).success&&x.some(f=>A(S,f)&&f===d)).map(([u])=>` ${r(u)}`).join("");return["default-src 'none'",`script-src 'unsafe-eval' 'wasm-unsafe-eval' ${i} ${a}${p("script")}`,"worker-src blob:",`style-src 'unsafe-inline' ${i} ${a}${p("style")}`,`font-src ${i} ${a} ${n}${p("font")} data:`,`img-src ${n} ${a}${p("img")} data: blob:`,`media-src ${n} ${c}${p("media")} blob:`,`connect-src ${n} ${c} ${a} ${i}${p("connect")} blob: data:`,`frame-ancestors ${o.length>0?o.join(" "):"'none'"}`].join("; ")}export function snapshotEditorUrl(t,o,s={}){const r=Object.entries({item:o,embed:s.share===!0?"share":"studio",snapshot:"1",...s.theme===void 0?{}:{theme:s.theme},...P(s.place)}).map(([i,a])=>`${i}=${encodeURIComponent(a)}`);return`${t.replace(/\/$/u,"")}/${SNAPSHOT_TREE.editor}?${r.join("&")}`}export const EXECUTOR_KINDS=["cloud","computer"],ExecutorSchema=e.object({kind:j(EXECUTOR_KINDS),here:e.boolean()}),SNAPSHOT_BLOBS_PATH="/api/snapshots/blobs",SNAPSHOTS_PATH="/api/snapshots",SnapshotCreateSchema=e.strictObject({project:e.strictObject({id:e.string().min(1).optional(),idMadeByMachine:e.boolean().optional(),kind:e.enum(SNAPSHOT_KINDS),name:e.string().min(1).max(255)}),manifest:b}),SnapshotCreatedSchema=e.object({id:e.string().min(1),projectId:e.string().min(1)}),SnapshotMissingSchema=e.object({missing:e.array(b)}),PROJECTS_PATH="/api/projects",SnapshotInfoSchema=e.object({id:e.string().min(1),madeAt:e.iso.datetime(),hostVersion:e.string()}),ProjectInfoSchema=e.object({id:e.string().min(1),kind:e.enum(SNAPSHOT_KINDS),name:e.string(),latest:SnapshotInfoSchema.nullable(),executor:ExecutorSchema.optional()}),ProjectsResponseSchema=e.object({projects:h(ProjectInfoSchema)}),projectPath=t=>`${PROJECTS_PATH}/${encodeURIComponent(t)}`,STORAGE_PATH="/api/storage",StorageSchema=e.object({keptBytes:e.number(),capBytes:e.number().nullable(),clearingBytes:e.number().optional()}),STORAGE_CLEARING_PATH=`${STORAGE_PATH}/clearing`,STORAGE_PAGE_SIZE=10,StoragePageSchema=e.strictObject({page:e.int().min(1)}),STORAGE_PROJECTS_PATH=`${STORAGE_PATH}/projects`,StoredProjectSchema=e.object({id:e.string().min(1),kind:e.enum(SNAPSHOT_KINDS),name:e.string(),bytes:e.number(),versions:e.number(),madeAt:e.iso.datetime().nullable()}),StoredProjectsSchema=e.object({items:h(StoredProjectSchema),total:e.number()}),STORAGE_FILES_PATH=`${STORAGE_PATH}/files`,StoredFileSchema=e.object({id:e.string().min(1),name:e.string(),contentType:e.string(),size:e.number(),keptUntil:e.iso.datetime()}),StoredFilesSchema=e.object({items:h(StoredFileSchema),total:e.number()}),snapshotViewPath=t=>`${SNAPSHOTS_PATH}/${encodeURIComponent(t)}/view`,SnapshotViewSchema=e.object({origin:e.url(),expiresAt:e.iso.datetime()}),SNAPSHOT_VIEW={manifest:"manifest.json",files:"files/",pages:"pages/",conversations:"conversations/"},PAGE_CSP=["sandbox allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox","default-src 'self' data: blob:","script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:","style-src 'self' 'unsafe-inline'","img-src 'self' data: blob:","font-src 'self' data:","connect-src 'self' data: blob:","media-src 'self' data: blob:"].join("; "),NEEDS_MACHINE=-32010,isNeedsMachine=t=>typeof t=="object"&&t!==null&&t.code===NEEDS_MACHINE;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Where a call is sent: `POST`, a JSON-RPC request. */
|
|
3
|
+
export declare const STUDIO_SERVER_RPC_PATH = "/rpc";
|
|
4
|
+
/** Where what is heard comes from: `GET`, server-sent events. */
|
|
5
|
+
export declare const STUDIO_SERVER_EVENTS_PATH = "/events";
|
|
6
|
+
/**
|
|
7
|
+
* A stream cut a moment ago, resumed: `GET /events?resume=<its id>&after=<the
|
|
8
|
+
* last event its caller read>`, each event's number its `id:` line, as
|
|
9
|
+
* server-sent events' `Last-Event-ID` (in the address, so what is between
|
|
10
|
+
* lets no header more through). Within its grace the Studio server gives
|
|
11
|
+
* the same stream, its hearings as they were, and tells again what came
|
|
12
|
+
* after that event. Its first event says which stream it is: another id,
|
|
13
|
+
* and the one asked for is no more.
|
|
14
|
+
*/
|
|
15
|
+
export declare const STUDIO_SERVER_EVENTS_RESUME = "resume";
|
|
16
|
+
export declare const STUDIO_SERVER_EVENTS_AFTER = "after";
|
|
17
|
+
/**
|
|
18
|
+
* Where a file a person adds to a message is sent, to be kept in a
|
|
19
|
+
* project: `POST`, the file's bytes the body, `?folder=` the project's
|
|
20
|
+
* folder on the machine and `?name=` the file's name. Answered as a call
|
|
21
|
+
* is, with `{ path }`: where the file now is.
|
|
22
|
+
*/
|
|
23
|
+
export declare const STUDIO_SERVER_FILES_PATH = "/files";
|
|
24
|
+
/**
|
|
25
|
+
* Where the extension in a person's own Chrome connects to a Studio
|
|
26
|
+
* server on a machine in the cloud, a WebSocket: `/extension/<id>`, the id
|
|
27
|
+
* one the Studio server made for the one connection and told the person's
|
|
28
|
+
* window (docs/design/cloud-studio/browser.md).
|
|
29
|
+
*/
|
|
30
|
+
export declare const STUDIO_SERVER_EXTENSION_PATH = "/extension";
|
|
31
|
+
/**
|
|
32
|
+
* The name, in the address the extension connects to, of the pass that
|
|
33
|
+
* lets it through the gateway: a WebSocket a browser opens carries no
|
|
34
|
+
* header of its opener's choosing, so the pass a window is let in by is
|
|
35
|
+
* given in the address, and the gateway takes it out.
|
|
36
|
+
*/
|
|
37
|
+
export declare const STUDIO_SERVER_EXTENSION_PASS = "pass";
|
|
38
|
+
/** What a file sent to be kept is answered with: where it now is on the machine. */
|
|
39
|
+
export declare const StudioServerFileKeptSchema: z.ZodObject<{
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
/** The Studio server's own JSON-RPC error codes, in the range JSON-RPC leaves for servers. */
|
|
43
|
+
export declare const STUDIO_SERVER_RPC_ERROR: {
|
|
44
|
+
/** What was asked was refused or failed by the Studio server: `data.name` is the error's name there, which a caller tells errors apart by. */
|
|
45
|
+
readonly thrown: -32010;
|
|
46
|
+
/** The caller's token does not let it call this method. */
|
|
47
|
+
readonly notForThisCaller: -32011;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* An event on the stream. The first says the stream's id (`stream`), which
|
|
51
|
+
* a caller gives with each hearing it begins; every other is of one
|
|
52
|
+
* hearing (`hearing`, `event`).
|
|
53
|
+
*/
|
|
54
|
+
export declare const StudioServerEventSchema: z.ZodObject<{
|
|
55
|
+
stream: z.ZodOptional<z.ZodString>;
|
|
56
|
+
hearing: z.ZodOptional<z.ZodString>;
|
|
57
|
+
event: z.ZodOptional<z.ZodUnknown>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type StudioServerEvent = z.infer<typeof StudioServerEventSchema>;
|
|
60
|
+
/** The machine as its Studio server says it is now. */
|
|
61
|
+
export declare const StudioMachineNowSchema: z.ZodObject<{
|
|
62
|
+
busy: z.ZodBoolean;
|
|
63
|
+
resting: z.ZodBoolean;
|
|
64
|
+
running: z.ZodOptional<z.ZodUnknown>;
|
|
65
|
+
lastUsedByPersonAtMs: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export type StudioMachineNow = z.infer<typeof StudioMachineNowSchema>;
|
|
68
|
+
/**
|
|
69
|
+
* The number of the Studio server's interfaces, as whoever calls one
|
|
70
|
+
* meets them. Raised only by a change a caller written before it cannot
|
|
71
|
+
* work with, or a Studio server before it must not run with: a method
|
|
72
|
+
* gone or renamed, an answer that no longer reads as it did. What is
|
|
73
|
+
* added raises nothing: both sides read as a tolerant reader reads. A
|
|
74
|
+
* release says the number of the one in it (`studioServerProtocol` in
|
|
75
|
+
* its channel's manifest); a Studio server with fewer than the newest
|
|
76
|
+
* release is replaced by it as its machine is resumed, before it takes
|
|
77
|
+
* work (docs/design/cloud-studio/upgrades.md).
|
|
78
|
+
*/
|
|
79
|
+
export declare const STUDIO_SERVER_PROTOCOL = 1;
|
|
80
|
+
/** Which Studio server this is, as it says itself: its version, and the number of its interfaces. */
|
|
81
|
+
export declare const StudioServerIdentitySchema: z.ZodObject<{
|
|
82
|
+
version: z.ZodString;
|
|
83
|
+
protocol: z.ZodNumber;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export type StudioServerIdentity = z.infer<typeof StudioServerIdentitySchema>;
|
|
86
|
+
/** How an asking for rest was answered: it rests, or it does not, with what runs. */
|
|
87
|
+
export declare const StudioRestAnswerSchema: z.ZodObject<{
|
|
88
|
+
resting: z.ZodBoolean;
|
|
89
|
+
running: z.ZodOptional<z.ZodUnknown>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export type StudioRestAnswer = z.infer<typeof StudioRestAnswerSchema>;
|
|
92
|
+
/** What an asking for every snapshot to be recorded did: each project's folder, and `home`. */
|
|
93
|
+
export declare const StudioStorageSaveOutcomeSchema: z.ZodObject<{
|
|
94
|
+
saved: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
95
|
+
unchanged: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
96
|
+
failed: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
97
|
+
what: z.ZodString;
|
|
98
|
+
why: z.ZodString;
|
|
99
|
+
}, z.core.$strip>>>;
|
|
100
|
+
notDrawn: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
101
|
+
what: z.ZodString;
|
|
102
|
+
why: z.ZodString;
|
|
103
|
+
}, z.core.$strip>>>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export type StudioStorageSaveOutcome = z.infer<typeof StudioStorageSaveOutcomeSchema>;
|
|
106
|
+
/** The Studio server's own management: what whoever runs the machine calls. */
|
|
107
|
+
export declare const STUDIO_MANAGEMENT_METHODS: {
|
|
108
|
+
readonly "StudioManagement.describeMachineNow": import("./jsonrpc.js").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
busy: z.ZodBoolean;
|
|
110
|
+
resting: z.ZodBoolean;
|
|
111
|
+
running: z.ZodOptional<z.ZodUnknown>;
|
|
112
|
+
lastUsedByPersonAtMs: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
readonly "StudioManagement.describeStudioServer": import("./jsonrpc.js").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
115
|
+
version: z.ZodString;
|
|
116
|
+
protocol: z.ZodNumber;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
readonly "StudioManagement.tryToBeginRest": import("./jsonrpc.js").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
119
|
+
resting: z.ZodBoolean;
|
|
120
|
+
running: z.ZodOptional<z.ZodUnknown>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
readonly "StudioManagement.endRest": import("./jsonrpc.js").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodNull>;
|
|
123
|
+
readonly "StudioManagement.saveAllProjectsAndStudioDataToStorage": import("./jsonrpc.js").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
saved: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
125
|
+
unchanged: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
126
|
+
failed: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
127
|
+
what: z.ZodString;
|
|
128
|
+
why: z.ZodString;
|
|
129
|
+
}, z.core.$strip>>>;
|
|
130
|
+
notDrawn: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
131
|
+
what: z.ZodString;
|
|
132
|
+
why: z.ZodString;
|
|
133
|
+
}, z.core.$strip>>>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
};
|
|
136
|
+
/** A Studio server as a caller reaches it. */
|
|
137
|
+
export interface StudioServerAddress {
|
|
138
|
+
/** Its origin, with no path. */
|
|
139
|
+
url: string;
|
|
140
|
+
/** The token that lets this caller in. */
|
|
141
|
+
token: string;
|
|
142
|
+
/** What else a request carries to get there (a sandbox's provider's own). */
|
|
143
|
+
headers?: Record<string, string>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A request did not get an answer of the Studio server's, as HTTP says of
|
|
147
|
+
* it (RFC 9110): what is between answered, or nothing did.
|
|
148
|
+
*
|
|
149
|
+
* - `certainlyNotDone`: the request never got there (it could not be
|
|
150
|
+
* sent; 503 or 429 of what is between; another 4xx of its own), so
|
|
151
|
+
* asking again does it once. False, it may have been done (it was cut,
|
|
152
|
+
* 502 or 504: it reached what answers past the gateway): only what is
|
|
153
|
+
* safe to do twice is asked again.
|
|
154
|
+
* - `temporary`: asking again may be answered (no connection, 502, 503,
|
|
155
|
+
* 504, 429). False, what is between said it will not be (404: no such
|
|
156
|
+
* machine), so it is not asked again as it is.
|
|
157
|
+
* - `retryAfterMs`: how long to wait before asking again, as Retry-After
|
|
158
|
+
* said; none where it said nothing.
|
|
159
|
+
*/
|
|
160
|
+
export declare class StudioServerNotReachable extends Error {
|
|
161
|
+
readonly certainlyNotDone: boolean;
|
|
162
|
+
readonly temporary: boolean;
|
|
163
|
+
readonly retryAfterMs: number | undefined;
|
|
164
|
+
constructor(what: string, certainlyNotDone: boolean, cause?: unknown, o?: {
|
|
165
|
+
temporary?: boolean;
|
|
166
|
+
retryAfterMs?: number;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/** The Studio server did not let the caller in: its token is not one it knows. */
|
|
170
|
+
export declare class StudioServerDidNotLetCallerIn extends Error {
|
|
171
|
+
constructor(what: string);
|
|
172
|
+
}
|
|
173
|
+
/** RFC 9110's Retry-After, seconds or a date, as ms from now; none where it says nothing readable. */
|
|
174
|
+
export declare function retryAfterMsOf(response: Response, now?: number): number | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* What an HTTP answer that is not the Studio server's own says of the
|
|
177
|
+
* request (RFC 9110, section 15), the one place a client reads it: 401,
|
|
178
|
+
* not let in, with what lets it in to be asked anew; 503 and 429, not
|
|
179
|
+
* done and to ask again, after Retry-After where it says; 403 and another
|
|
180
|
+
* 4xx, refused, not done and not to ask again; 502, 504 and anything
|
|
181
|
+
* else, maybe done.
|
|
182
|
+
*/
|
|
183
|
+
export declare function failureOfAnswerNotStudioServers(what: string, response: Response): StudioServerNotReachable | StudioServerDidNotLetCallerIn;
|
|
184
|
+
/**
|
|
185
|
+
* The Studio server answered a call with an error. Its `name` is the
|
|
186
|
+
* error's name as it was thrown there (`RefusedWhileResting`,
|
|
187
|
+
* `ConversationNotLoaded`), which is how a caller tells errors apart: an
|
|
188
|
+
* error that crossed a network is no instance of its class.
|
|
189
|
+
*/
|
|
190
|
+
export declare class StudioServerError extends Error {
|
|
191
|
+
readonly code: number;
|
|
192
|
+
readonly data: unknown;
|
|
193
|
+
/**
|
|
194
|
+
* Where the Studio server refused for a while (it rests before a pause):
|
|
195
|
+
* nothing was done, and it may be asked again after this long, ms (its
|
|
196
|
+
* error's `data.retryAfterMs`, as google.rpc.RetryInfo says it of an
|
|
197
|
+
* RPC). None for every other error, which is its answer.
|
|
198
|
+
*/
|
|
199
|
+
readonly retryAfterMs: number | undefined;
|
|
200
|
+
constructor(error: {
|
|
201
|
+
code: number;
|
|
202
|
+
message: string;
|
|
203
|
+
data?: unknown;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Whether what failed was certainly not done and may be answered if asked
|
|
208
|
+
* again: what HTTP says of a request no one answered (no connection, 503,
|
|
209
|
+
* 429), a caller not let in (with what lets it in asked anew), or a
|
|
210
|
+
* Studio server's temporary refusal. The one test every caller asks.
|
|
211
|
+
*/
|
|
212
|
+
export declare function isNotDoneAndTemporary(e: unknown): boolean;
|
|
213
|
+
/** How long to wait before asking again, ms, where whoever failed said. */
|
|
214
|
+
export declare const retryAfterMsOfFailure: (e: unknown) => number | undefined;
|
|
215
|
+
/** How long a call has to be answered where no one says, ms. */
|
|
216
|
+
export declare const STUDIO_SERVER_CALL_ANSWERS_WITHIN_MS = 120000;
|
|
217
|
+
/**
|
|
218
|
+
* One call of a Studio server: a JSON-RPC request sent once, and its
|
|
219
|
+
* result. Never sent again here: whoever knows what is safe to do twice
|
|
220
|
+
* does that. An answer of `null` is no result (`undefined`).
|
|
221
|
+
*/
|
|
222
|
+
export declare function callStudioServer(to: StudioServerAddress, methodName: string, params: unknown, o?: {
|
|
223
|
+
fetch?: typeof fetch;
|
|
224
|
+
answersWithinMs?: number;
|
|
225
|
+
}): Promise<unknown>;
|
|
226
|
+
/** The Studio server's own management, a function a method: what whoever runs the machine calls. */
|
|
227
|
+
export type StudioServerManagement = {
|
|
228
|
+
[M in keyof typeof STUDIO_MANAGEMENT_METHODS as M extends `StudioManagement.${infer F}` ? F : never]: () => Promise<z.output<(typeof STUDIO_MANAGEMENT_METHODS)[M]["result"]>>;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* The management of the Studio server at `to`, with whoever runs the
|
|
232
|
+
* machine's token: each function one call (callStudioServer), its answer
|
|
233
|
+
* read by its schema as a tolerant reader reads. No stream: the machine's
|
|
234
|
+
* management hears nothing.
|
|
235
|
+
*/
|
|
236
|
+
export declare function studioServerManagementAt(to: StudioServerAddress, o?: {
|
|
237
|
+
fetch?: typeof fetch;
|
|
238
|
+
answersWithinMs?: number;
|
|
239
|
+
}): StudioServerManagement;
|
|
240
|
+
/**
|
|
241
|
+
* The name, in the address of the window's page a Studio server serves on
|
|
242
|
+
* a person's own computer, of the token the page comes with: the page
|
|
243
|
+
* reads it once, keeps it for its tab, and takes it out of its address.
|
|
244
|
+
*/
|
|
245
|
+
export declare const STUDIO_SERVER_TOKEN_OF_PAGE = "studio-server-token";
|
|
246
|
+
/** How long a file sent to be kept has to be answered where no one says, ms: its bytes cross a network. */
|
|
247
|
+
export declare const STUDIO_SERVER_FILE_ANSWERS_WITHIN_MS: number;
|
|
248
|
+
/**
|
|
249
|
+
* A file sent to a Studio server to be kept in a project
|
|
250
|
+
* (`STUDIO_SERVER_FILES_PATH`): once, its bytes the request's body. Where
|
|
251
|
+
* the file now is. What fails is told as a call's failure is, under the
|
|
252
|
+
* name `keepFileInProject`: not reachable, not let in, or the Studio
|
|
253
|
+
* server's own error by its name. One too large for what is between is
|
|
254
|
+
* said so (`StudioServerError`, HTTP's 413).
|
|
255
|
+
*/
|
|
256
|
+
export declare function sendFileToStudioServerToKeepInProject(to: StudioServerAddress, file: {
|
|
257
|
+
folder: string;
|
|
258
|
+
name: string;
|
|
259
|
+
bytes: Blob | Uint8Array<ArrayBuffer>;
|
|
260
|
+
}, o?: {
|
|
261
|
+
fetch?: typeof fetch;
|
|
262
|
+
answersWithinMs?: number;
|
|
263
|
+
}): Promise<string>;
|
|
264
|
+
//# sourceMappingURL=studio-server.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{z as t}from"zod";import{JSONRPC as l,ResponseSchema as S,method as c}from"./jsonrpc.js";export const STUDIO_SERVER_RPC_PATH="/rpc",STUDIO_SERVER_EVENTS_PATH="/events",STUDIO_SERVER_EVENTS_RESUME="resume",STUDIO_SERVER_EVENTS_AFTER="after",STUDIO_SERVER_FILES_PATH="/files",STUDIO_SERVER_EXTENSION_PATH="/extension",STUDIO_SERVER_EXTENSION_PASS="pass",StudioServerFileKeptSchema=t.object({path:t.string()}),STUDIO_SERVER_RPC_ERROR={thrown:-32010,notForThisCaller:-32011},StudioServerEventSchema=t.object({stream:t.string().optional(),hearing:t.string().optional(),event:t.unknown().optional()}),StudioMachineNowSchema=t.object({busy:t.boolean(),resting:t.boolean(),running:t.unknown().optional(),lastUsedByPersonAtMs:t.number().optional()}),STUDIO_SERVER_PROTOCOL=1,StudioServerIdentitySchema=t.object({version:t.string(),protocol:t.number().int()}),StudioRestAnswerSchema=t.object({resting:t.boolean(),running:t.unknown().optional()}),StudioStorageSaveOutcomeSchema=t.object({saved:t.array(t.string()).default([]),unchanged:t.array(t.string()).default([]),failed:t.array(t.object({what:t.string(),why:t.string()})).default([]),notDrawn:t.array(t.object({what:t.string(),why:t.string()})).default([])});const u=t.object({});export const STUDIO_MANAGEMENT_METHODS={"StudioManagement.describeMachineNow":c(u,StudioMachineNowSchema,"The machine as it is now: whether work runs, whether it rests, when a person last used it."),"StudioManagement.describeStudioServer":c(u,StudioServerIdentitySchema,"Which Studio server this is: its version, and the number of its interfaces."),"StudioManagement.tryToBeginRest":c(u,StudioRestAnswerSchema,"Rest asked for: nothing runs, and it rests from now; something runs, and it does not, saying what."),"StudioManagement.endRest":c(u,t.null(),"Rest ended: the machine takes work again."),"StudioManagement.saveAllProjectsAndStudioDataToStorage":c(u,StudioStorageSaveOutcomeSchema,"Every project and the home recorded at AllyHub where it changed: asked before the machine is paused. What was recorded, what had not changed, what failed.")};export class StudioServerNotReachable extends Error{certainlyNotDone;temporary;retryAfterMs;constructor(n,r,a,o={}){super(`The Studio server could not be reached for ${n}${r?"":", which may have been done all the same"}.`,a===void 0?void 0:{cause:a}),this.name="StudioServerNotReachable",this.certainlyNotDone=r,this.temporary=o.temporary??!0,this.retryAfterMs=o.retryAfterMs}}export class StudioServerDidNotLetCallerIn extends Error{constructor(n){super(`The Studio server did not let the caller in for ${n}.`),this.name="StudioServerDidNotLetCallerIn"}}export function retryAfterMsOf(e,n=Date.now()){const r=e.headers.get("retry-after");if(r===null)return;if(/^\d+$/u.test(r.trim()))return Number(r.trim())*1e3;const a=Date.parse(r);return Number.isNaN(a)?void 0:Math.max(0,a-n)}export function failureOfAnswerNotStudioServers(e,n){const r=n.status;if(r===401)return new StudioServerDidNotLetCallerIn(e);const a=retryAfterMsOf(n),o=a===void 0?{}:{retryAfterMs:a};return r===503||r===429?new StudioServerNotReachable(e,!0,void 0,o):r===502||r===504?new StudioServerNotReachable(e,!1,void 0,o):r>=400&&r<500?new StudioServerNotReachable(e,!0,void 0,{temporary:!1}):new StudioServerNotReachable(e,!1,void 0,{temporary:!1})}export class StudioServerError extends Error{code;data;retryAfterMs;constructor(n){super(n.message);const r=n.data;this.name=typeof r?.name=="string"?r.name:"StudioServerError",this.code=n.code,this.data=n.data,this.retryAfterMs=typeof r?.retryAfterMs=="number"?r.retryAfterMs:void 0}}export function isNotDoneAndTemporary(e){return e instanceof StudioServerDidNotLetCallerIn?!0:e instanceof StudioServerNotReachable?e.certainlyNotDone&&e.temporary:e instanceof StudioServerError&&e.retryAfterMs!==void 0}export const retryAfterMsOfFailure=e=>e instanceof StudioServerNotReachable||e instanceof StudioServerError?e.retryAfterMs:void 0;const p=new Set(["ECONNREFUSED","ENOTFOUND","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH","UND_ERR_CONNECT_TIMEOUT"]),h=e=>{const n=e?.cause;return typeof n?.code=="string"&&p.has(n.code)};function f(e){try{return JSON.parse(e)}catch(n){if(n instanceof SyntaxError)return;throw n}}export const STUDIO_SERVER_CALL_ANSWERS_WITHIN_MS=12e4;let E=0;export async function callStudioServer(e,n,r,a={}){let o,i;try{o=await(a.fetch??fetch)(`${e.url.replace(/\/+$/u,"")}${STUDIO_SERVER_RPC_PATH}`,{method:"POST",headers:{...e.headers,"content-type":"application/json",authorization:`Bearer ${e.token}`},body:JSON.stringify({jsonrpc:l,id:++E,method:n,params:r??{}}),signal:AbortSignal.timeout(a.answersWithinMs??STUDIO_SERVER_CALL_ANSWERS_WITHIN_MS)}),i=await o.text()}catch(d){throw new StudioServerNotReachable(n,h(d),d)}if(o.status===401||o.status===403)throw failureOfAnswerNotStudioServers(n,o);const s=S.safeParse(f(i));if(!s.success)throw failureOfAnswerNotStudioServers(n,o);if("error"in s.data)throw new StudioServerError(s.data.error);return s.data.result??void 0}export function studioServerManagementAt(e,n={}){const r=a=>async()=>STUDIO_MANAGEMENT_METHODS[a].result.parse(await callStudioServer(e,a,{},n)??null);return{describeMachineNow:r("StudioManagement.describeMachineNow"),describeStudioServer:r("StudioManagement.describeStudioServer"),tryToBeginRest:r("StudioManagement.tryToBeginRest"),endRest:r("StudioManagement.endRest"),saveAllProjectsAndStudioDataToStorage:r("StudioManagement.saveAllProjectsAndStudioDataToStorage")}}export const STUDIO_SERVER_TOKEN_OF_PAGE="studio-server-token",STUDIO_SERVER_FILE_ANSWERS_WITHIN_MS=10*6e4;export async function sendFileToStudioServerToKeepInProject(e,n,r={}){const a="StudioProjects.keepFileInProject";let o,i;try{o=await(r.fetch??fetch)(`${e.url.replace(/\/+$/u,"")}${STUDIO_SERVER_FILES_PATH}?${new URLSearchParams({folder:n.folder,name:n.name}).toString()}`,{method:"POST",headers:{...e.headers,"content-type":"application/octet-stream",authorization:`Bearer ${e.token}`},body:n.bytes,signal:AbortSignal.timeout(r.answersWithinMs??STUDIO_SERVER_FILE_ANSWERS_WITHIN_MS)}),i=await o.text()}catch(d){throw new StudioServerNotReachable(a,h(d),d)}if(o.status===401||o.status===403)throw failureOfAnswerNotStudioServers(a,o);if(o.status===413)throw new StudioServerError({code:STUDIO_SERVER_RPC_ERROR.thrown,message:"The file is too large to be sent.",data:{name:"FileTooLarge"}});const s=S.safeParse(f(i));if(!s.success)throw failureOfAnswerNotStudioServers(a,o);if("error"in s.data)throw new StudioServerError(s.data.error);return StudioServerFileKeptSchema.parse(s.data.result).path}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Where, in the `_meta` of a tool call said in a conversation, a Studio tool says what it presented to the person. */
|
|
3
|
+
export declare const STUDIO_PRESENTED_META = "allyhub/presented";
|
|
4
|
+
/** One of a project's items, presented to the person by a Studio tool: what a conversation keeps a card of. */
|
|
5
|
+
export declare const StudioPresentedInConversationSchema: z.ZodObject<{
|
|
6
|
+
item: z.ZodString;
|
|
7
|
+
entry: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type StudioPresentedInConversation = z.infer<typeof StudioPresentedInConversationSchema>;
|
|
10
|
+
/**
|
|
11
|
+
* A Studio tool's own call, as it says it in a conversation: done, with
|
|
12
|
+
* what it presented to the person. `toolCallId`: the call's id in the
|
|
13
|
+
* conversation, the tool's to make, one a call. `tool`: the tool's name.
|
|
14
|
+
*/
|
|
15
|
+
export declare const toolCallSayingWhatWasPresented: (toolCallId: string, tool: string, presented: StudioPresentedInConversation) => Record<string, unknown>;
|
|
16
|
+
/** What a tool call said in a conversation says a Studio tool presented to the person; nothing for any other thing said, or one this reader cannot read. */
|
|
17
|
+
export declare function whatToolCallSaysWasPresented(said: unknown): StudioPresentedInConversation | undefined;
|
|
18
|
+
//# sourceMappingURL=studio-tool-calls.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{z as o}from"zod";export const STUDIO_PRESENTED_META="allyhub/presented",StudioPresentedInConversationSchema=o.object({item:o.string(),entry:o.string().optional()}),toolCallSayingWhatWasPresented=(e,n,t)=>({sessionUpdate:"tool_call",toolCallId:e,title:n,kind:"other",status:"completed",_meta:{[STUDIO_PRESENTED_META]:t}});export function whatToolCallSaysWasPresented(e){if(typeof e!="object"||e===null)return;const{sessionUpdate:n,_meta:t}=e;if(n!=="tool_call"&&n!=="tool_call_update"||typeof t!="object"||t===null)return;const s=StudioPresentedInConversationSchema.safeParse(t[STUDIO_PRESENTED_META]);return s.success?s.data:void 0}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* A window's answer to a request: it did what was asked, or it did not,
|
|
4
|
+
* with why in words an agent reads. A request that needs more of an
|
|
5
|
+
* answer adds its own fields to this one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StudioWindowAnswerSchema: z.ZodObject<{
|
|
8
|
+
done: z.ZodBoolean;
|
|
9
|
+
why: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type StudioWindowAnswer = z.infer<typeof StudioWindowAnswerSchema>;
|
|
12
|
+
/** One of a project's items, or a file of the project its list does not name, to show in the window as if the person had opened it. */
|
|
13
|
+
export declare const StudioWindowShowItemOrFileSchema: z.ZodObject<{
|
|
14
|
+
sessionId: z.ZodString;
|
|
15
|
+
folder: z.ZodString;
|
|
16
|
+
item: z.ZodString;
|
|
17
|
+
listed: z.ZodBoolean;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type StudioWindowShowItemOrFile = z.infer<typeof StudioWindowShowItemOrFileSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* Something AllyHub refused, to show the person in the conversation with
|
|
22
|
+
* what they can do about it (credits run out: how to add more). In the
|
|
23
|
+
* words a turn that failed for it is heard with, so a window shows the
|
|
24
|
+
* two the same way. A Studio server tells its windows of a paywall met
|
|
25
|
+
* by a hearing now (`StudioAccount.onPaywallMet`, docs/design/paywall.md),
|
|
26
|
+
* and asks this no more; a window reads it for one release, from a Studio
|
|
27
|
+
* server of the release before.
|
|
28
|
+
*/
|
|
29
|
+
export declare const StudioWindowShowAllyHubRefusalSchema: z.ZodObject<{
|
|
30
|
+
sessionId: z.ZodString;
|
|
31
|
+
refusal: z.ZodObject<{
|
|
32
|
+
kind: z.ZodString;
|
|
33
|
+
message: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type StudioWindowShowAllyHubRefusal = z.infer<typeof StudioWindowShowAllyHubRefusalSchema>;
|
|
37
|
+
/** A tab of Studio's built-in browser to show in the window, as if the person had opened it. */
|
|
38
|
+
export declare const StudioWindowShowBrowserTabSchema: z.ZodObject<{
|
|
39
|
+
sessionId: z.ZodString;
|
|
40
|
+
folder: z.ZodString;
|
|
41
|
+
tab: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type StudioWindowShowBrowserTab = z.infer<typeof StudioWindowShowBrowserTabSchema>;
|
|
44
|
+
/**
|
|
45
|
+
* Something only the person can do in a tab of Studio's built-in browser
|
|
46
|
+
* (sign in, pass a check, choose), asked of them over the page. The agent
|
|
47
|
+
* ends its turn once it asked: what the person answers is their next
|
|
48
|
+
* message, and nothing is kept of the asking.
|
|
49
|
+
*/
|
|
50
|
+
export declare const StudioWindowAskPersonToActInBrowserTabSchema: z.ZodObject<{
|
|
51
|
+
sessionId: z.ZodString;
|
|
52
|
+
folder: z.ZodString;
|
|
53
|
+
tab: z.ZodString;
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type StudioWindowAskPersonToActInBrowserTab = z.infer<typeof StudioWindowAskPersonToActInBrowserTabSchema>;
|
|
57
|
+
/** The requests a window may be asked, by method. */
|
|
58
|
+
export declare const STUDIO_WINDOW_REQUESTS: {
|
|
59
|
+
readonly "_allyhub/window/show_item_or_file": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
|
|
60
|
+
sessionId: z.ZodString;
|
|
61
|
+
folder: z.ZodString;
|
|
62
|
+
item: z.ZodString;
|
|
63
|
+
listed: z.ZodBoolean;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
done: z.ZodBoolean;
|
|
66
|
+
why: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
readonly "_allyhub/window/show_allyhub_refusal": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
|
|
69
|
+
sessionId: z.ZodString;
|
|
70
|
+
refusal: z.ZodObject<{
|
|
71
|
+
kind: z.ZodString;
|
|
72
|
+
message: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
done: z.ZodBoolean;
|
|
76
|
+
why: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
readonly "_allyhub/window/show_browser_tab": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
|
|
79
|
+
sessionId: z.ZodString;
|
|
80
|
+
folder: z.ZodString;
|
|
81
|
+
tab: z.ZodString;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
done: z.ZodBoolean;
|
|
84
|
+
why: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
readonly "_allyhub/window/ask_person_to_act_in_browser_tab": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
|
|
87
|
+
sessionId: z.ZodString;
|
|
88
|
+
folder: z.ZodString;
|
|
89
|
+
tab: z.ZodString;
|
|
90
|
+
message: z.ZodString;
|
|
91
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
92
|
+
done: z.ZodBoolean;
|
|
93
|
+
why: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
};
|
|
96
|
+
export type StudioWindowRequestMethod = keyof typeof STUDIO_WINDOW_REQUESTS;
|
|
97
|
+
//# sourceMappingURL=studio-window-requests.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{z as o}from"zod";import{method as t}from"./jsonrpc.js";export const StudioWindowAnswerSchema=o.object({done:o.boolean(),why:o.string().optional()}),StudioWindowShowItemOrFileSchema=o.object({sessionId:o.string(),folder:o.string(),item:o.string(),listed:o.boolean()}),StudioWindowShowAllyHubRefusalSchema=o.object({sessionId:o.string(),refusal:o.object({kind:o.string(),message:o.string().optional()})}),StudioWindowShowBrowserTabSchema=o.object({sessionId:o.string(),folder:o.string(),tab:o.string()}),StudioWindowAskPersonToActInBrowserTabSchema=o.object({sessionId:o.string(),folder:o.string(),tab:o.string(),message:o.string()}),STUDIO_WINDOW_REQUESTS={"_allyhub/window/show_item_or_file":t(StudioWindowShowItemOrFileSchema,StudioWindowAnswerSchema,"Shows one of the project's items, or a file its list does not name, in the window, as if the person had opened it."),"_allyhub/window/show_allyhub_refusal":t(StudioWindowShowAllyHubRefusalSchema,StudioWindowAnswerSchema,"Shows the person, in the conversation, something AllyHub refused and what they can do about it, as a turn that failed for it is shown."),"_allyhub/window/show_browser_tab":t(StudioWindowShowBrowserTabSchema,StudioWindowAnswerSchema,"Shows a tab of Studio's built-in browser in the window, as if the person had opened it."),"_allyhub/window/ask_person_to_act_in_browser_tab":t(StudioWindowAskPersonToActInBrowserTabSchema,StudioWindowAnswerSchema,"Shows a tab of Studio's built-in browser with what the agent asks the person to do in it, over the page.")};
|
|
@@ -21,6 +21,7 @@ export declare const MembersSchema: z.ZodObject<{
|
|
|
21
21
|
role: z.ZodString;
|
|
22
22
|
limit: z.ZodNullable<z.ZodNumber>;
|
|
23
23
|
used: z.ZodNumber;
|
|
24
|
+
spent: z.ZodOptional<z.ZodNumber>;
|
|
24
25
|
}, z.core.$strip>>;
|
|
25
26
|
}, z.core.$strip>;
|
|
26
27
|
export type Members = z.infer<typeof MembersSchema>;
|
|
@@ -37,8 +38,8 @@ export declare const STUDIO_STATES: readonly ["running", "paused"];
|
|
|
37
38
|
export declare const StudioSchema: z.ZodObject<{
|
|
38
39
|
studio: z.ZodNullable<z.ZodObject<{
|
|
39
40
|
state: z.ZodUnion<readonly [z.ZodEnum<{
|
|
40
|
-
running: "running";
|
|
41
41
|
paused: "paused";
|
|
42
|
+
running: "running";
|
|
42
43
|
}>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
|
|
43
44
|
organizationId: z.ZodString;
|
|
44
45
|
}, z.core.$strip>>;
|
|
@@ -51,7 +52,7 @@ export declare const StudioSchema: z.ZodObject<{
|
|
|
51
52
|
}, z.core.$strip>>;
|
|
52
53
|
update: z.ZodOptional<z.ZodObject<{
|
|
53
54
|
since: z.ZodString;
|
|
54
|
-
by: z.ZodString
|
|
55
|
+
by: z.ZodOptional<z.ZodString>;
|
|
55
56
|
}, z.core.$strip>>;
|
|
56
57
|
}, z.core.$strip>;
|
|
57
58
|
export type StudioInfo = z.infer<typeof StudioSchema>;
|