@intentic/sandbox-contract 1.374.0 → 1.376.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/dist/contracts/accounts.contract.d.ts +16 -0
- package/dist/contracts/accounts.contract.d.ts.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +8 -0
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/panels.contract.d.ts +15 -0
- package/dist/contracts/panels.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +123 -123
- package/dist/contracts/runs.contract.d.ts +2 -1
- package/dist/contracts/runs.contract.d.ts.map +1 -1
- package/dist/contracts/sharing.contract.d.ts +58 -0
- package/dist/contracts/sharing.contract.d.ts.map +1 -0
- package/dist/contracts/sharing.contract.js +41 -0
- package/dist/contracts/sharing.contract.js.map +1 -0
- package/dist/contracts/workspace.contract.d.ts +1 -0
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/formats/archives.d.ts.map +1 -0
- package/dist/formats/archives.js.map +1 -0
- package/dist/formats/packed-formats.d.ts.map +1 -0
- package/dist/formats/packed-formats.js.map +1 -0
- package/dist/ids/conversation-ids.d.ts +4 -0
- package/dist/ids/conversation-ids.d.ts.map +1 -1
- package/dist/ids/conversation-ids.js +1 -0
- package/dist/ids/conversation-ids.js.map +1 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/models/account-moves.d.ts +8 -0
- package/dist/models/account-moves.d.ts.map +1 -0
- package/dist/models/account-moves.js +3 -0
- package/dist/models/account-moves.js.map +1 -0
- package/dist/protocol/raw/raw-json-routes.d.ts +152 -2
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +6 -1
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +16 -0
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +4 -0
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +8 -0
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +4 -0
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/links.d.ts +29 -2
- package/dist/schemas/links.d.ts.map +1 -1
- package/dist/schemas/links.js +28 -12
- package/dist/schemas/links.js.map +1 -1
- package/dist/schemas/panels.d.ts +38 -0
- package/dist/schemas/panels.d.ts.map +1 -1
- package/dist/schemas/panels.js +21 -2
- package/dist/schemas/panels.js.map +1 -1
- package/dist/schemas/providers/account-sharing.d.ts +275 -0
- package/dist/schemas/providers/account-sharing.d.ts.map +1 -0
- package/dist/schemas/providers/account-sharing.js +68 -0
- package/dist/schemas/providers/account-sharing.js.map +1 -0
- package/dist/schemas/providers/provider-oauth.d.ts +16 -0
- package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
- package/dist/schemas/providers/provider-oauth.js +4 -0
- package/dist/schemas/providers/provider-oauth.js.map +1 -1
- package/dist/schemas/run-targets.d.ts +11 -4
- package/dist/schemas/run-targets.d.ts.map +1 -1
- package/dist/schemas/run-targets.js +8 -2
- package/dist/schemas/run-targets.js.map +1 -1
- package/dist/schemas/workspace/workspace-repos.d.ts +2 -0
- package/dist/schemas/workspace/workspace-repos.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-repos.js +2 -1
- package/dist/schemas/workspace/workspace-repos.js.map +1 -1
- package/dist/state/definition.d.ts +8 -0
- package/dist/state/definition.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/contracts/sharing.contract.ts +54 -0
- package/src/ids/conversation-ids.ts +4 -0
- package/src/index.ts +2 -0
- package/src/models/account-moves.test.ts +24 -0
- package/src/models/account-moves.ts +26 -0
- package/src/protocol/raw/raw-json-routes.ts +14 -1
- package/src/protocol/raw/raw-routes.ts +7 -0
- package/src/schemas/agents.ts +4 -2
- package/src/schemas/capabilities.ts +6 -0
- package/src/schemas/links.ts +39 -14
- package/src/schemas/panels.ts +38 -6
- package/src/schemas/providers/account-sharing.ts +123 -0
- package/src/schemas/providers/provider-oauth.ts +6 -0
- package/src/schemas/run-targets.ts +35 -7
- package/src/schemas/workspace/workspace-repos.ts +5 -3
- package/dist/text/archives.d.ts.map +0 -1
- package/dist/text/archives.js.map +0 -1
- package/dist/text/packed-formats.d.ts.map +0 -1
- package/dist/text/packed-formats.js.map +0 -1
- /package/dist/{text → formats}/archives.d.ts +0 -0
- /package/dist/{text → formats}/archives.js +0 -0
- /package/dist/{text → formats}/packed-formats.d.ts +0 -0
- /package/dist/{text → formats}/packed-formats.js +0 -0
- /package/src/{text → formats}/archives.test.ts +0 -0
- /package/src/{text → formats}/archives.ts +0 -0
- /package/src/{text → formats}/packed-formats.ts +0 -0
package/src/schemas/panels.ts
CHANGED
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
// panels: per-repository dev servers + the content facts extensions detect on
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
// Every discovered repo under /work is one row: runnable-panel status (a
|
|
4
|
-
//
|
|
5
|
-
// daemon-side so the browser never scans /work.
|
|
3
|
+
// Every discovered repo under /work is one row: runnable-panel status (what Start runs, with a port the daemon assigns,
|
|
4
|
+
// proxied at preview-<panelKey>-<sandboxId>.<zone>, and the windows it opened on the sandbox desktop) plus content facts
|
|
5
|
+
// extensions run detect() over, computed daemon-side so the browser never scans /work.
|
|
6
6
|
|
|
7
7
|
// Between click and first byte; `exited` matters most, since without it "Preparing the preview…" would never end.
|
|
8
8
|
// Absent once something serves.
|
|
9
9
|
export const PanelLaunchSchema = z.enum(["launching", "installing", "starting", "exited"]);
|
|
10
10
|
export type PanelLaunch = z.infer<typeof PanelLaunchSchema>;
|
|
11
11
|
|
|
12
|
+
// Where Start's command came from, first match winning: a root Procfile, operator/'s `dev` script, the root's `dev`,
|
|
13
|
+
// the root's `start`, a Cargo.toml with one binary to run.
|
|
14
|
+
export const PanelStartSourceSchema = z.enum(["procfile", "operator", "dev", "start", "cargo"]);
|
|
15
|
+
export type PanelStartSource = z.infer<typeof PanelStartSourceSchema>;
|
|
16
|
+
|
|
12
17
|
export const PanelSummarySchema = z.object({
|
|
13
18
|
// Root-relative dir under /work; slashes become `--` in the preview subdomain label.
|
|
14
19
|
repo: z.string().describe("Which repository."),
|
|
15
|
-
// A package.json `dev` script at operator/ or the
|
|
20
|
+
// A Procfile, a package.json `dev` script at operator/ or the root, a root `start`, or a Cargo binary.
|
|
16
21
|
hasPanel: z.boolean().describe("Whether it has anything runnable at all."),
|
|
22
|
+
// Optional on the wire: a sandbox older than this field says nothing of what it runs.
|
|
23
|
+
start: z
|
|
24
|
+
.object({
|
|
25
|
+
from: PanelStartSourceSchema.describe("Which file said how to start it."),
|
|
26
|
+
command: z.string().describe("What it runs, as a person would type it: `pnpm dev`, `cargo run`, or a Procfile's entries."),
|
|
27
|
+
})
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("What Start runs. Absent for a repository with nothing to start."),
|
|
30
|
+
// Optional on the wire, like `start`: a sandbox older than this field lists such targets with nothing.
|
|
31
|
+
sandboxTargets: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe(
|
|
35
|
+
"Whether its .intentic/run.json declares targets that run in the sandbox. Each is one of its apps, with its own preview address, Start and Stop.",
|
|
36
|
+
),
|
|
17
37
|
running: z.boolean().describe("Whether the sandbox has it running."),
|
|
18
38
|
// True for a repo with nothing runnable — nothing to install for.
|
|
19
39
|
installed: z
|
|
20
40
|
.boolean()
|
|
21
41
|
.describe("Whether its dependencies are installed, which is what decides whether a start takes seconds or an install first."),
|
|
22
42
|
launch: PanelLaunchSchema.optional().describe(
|
|
23
|
-
"Where a start the sandbox is running has got to: its shell coming up, installing, its dev command running with nothing listening yet, or exited back to a prompt. Absent when nothing is starting and once it serves.",
|
|
43
|
+
"Where a start the sandbox is running has got to: its shell coming up, installing, its dev command running with nothing listening yet, or exited back to a prompt. Absent when nothing is starting and once it serves or opens a window.",
|
|
24
44
|
),
|
|
25
45
|
healthy: z
|
|
26
46
|
.boolean()
|
|
27
47
|
.describe(
|
|
28
|
-
"Whether anything it owns is actually answering. A different question: a server still installing is running and not yet healthy, and one somebody started by hand is healthy without the sandbox running it.",
|
|
48
|
+
"Whether anything it owns is actually answering: a server, or a window open on the sandbox desktop. A different question: a server still installing is running and not yet healthy, and one somebody started by hand is healthy without the sandbox running it.",
|
|
29
49
|
),
|
|
30
50
|
port: z
|
|
31
51
|
.number()
|
|
@@ -55,6 +75,18 @@ export const PanelSummarySchema = z.object({
|
|
|
55
75
|
}),
|
|
56
76
|
)
|
|
57
77
|
.describe("Every server this repository is really serving, found by looking at what is listening. Empty when nothing answers."),
|
|
78
|
+
// Optional on the wire, like `start`; absent also while nothing of the repo's has a window open.
|
|
79
|
+
windows: z
|
|
80
|
+
.array(
|
|
81
|
+
z.object({
|
|
82
|
+
id: z.string().describe("The window's id on the sandbox desktop, which is what opening it there takes."),
|
|
83
|
+
title: z.string().describe("Its title."),
|
|
84
|
+
}),
|
|
85
|
+
)
|
|
86
|
+
.optional()
|
|
87
|
+
.describe(
|
|
88
|
+
"The windows its programs have open on the sandbox desktop: how a game or a desktop app shows it is up, since it serves no page. Absent when none is open.",
|
|
89
|
+
),
|
|
58
90
|
// `https://preview-<repo>-<sandboxId>.<zone>`; absent whenever no single hostname could stand for what's running
|
|
59
91
|
// (nothing up, still starting, several servers).
|
|
60
92
|
previewUrl: z
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EndpointConfigSchema } from "../capabilities.js";
|
|
3
|
+
import { OauthAccountSchema } from "./provider-oauth.js";
|
|
4
|
+
|
|
5
|
+
// SHARING MODEL ACCOUNTS between one owner's sandboxes, over an accounts link (schemas/links.ts, `terms.accounts`).
|
|
6
|
+
// Each account goes the one way that is safe for its credential:
|
|
7
|
+
// - copy: a static key (Cursor, Devin, a minted Z.ai or Muse key, a model endpoint's API key) is read by the target's
|
|
8
|
+
// daemon from the source's over the link and stored as the target's own; nothing ties the two afterwards.
|
|
9
|
+
// - lend: a sign-in whose refresh token rotates (a Claude subscription) stays with the source; the target asks it for
|
|
10
|
+
// an access token each turn. The refresh token never leaves the source, so the two sandboxes never race to renew one
|
|
11
|
+
// login. A subscription the translator holds (Codex, Grok, Kimi, Gemini) is listed as `no` for now: lending it would
|
|
12
|
+
// relay every request through the source's translator, which the target's runtimes do not do yet.
|
|
13
|
+
// - no: what cannot travel either way, with the reason a person reads.
|
|
14
|
+
// Values never ride the editor's wire: the browser sees these rows, and the target's daemon fetches a copy itself.
|
|
15
|
+
|
|
16
|
+
export const ShareModeSchema = z.enum(["copy", "lend", "no"]);
|
|
17
|
+
export type ShareMode = z.infer<typeof ShareModeSchema>;
|
|
18
|
+
|
|
19
|
+
// One account an accounts link names: a provider (an AgentProvider id, `endpoint/<id>` included) and, for a provider
|
|
20
|
+
// holding several of its own, which one. A translator provider is shared whole, since its translator picks among its
|
|
21
|
+
// own subscriptions and takes no account, so `account` is absent there.
|
|
22
|
+
export const SharedAccountRefSchema = z.object({
|
|
23
|
+
provider: z.string().min(1).max(120),
|
|
24
|
+
account: z.string().min(1).max(200).optional(),
|
|
25
|
+
});
|
|
26
|
+
export type SharedAccountRef = z.infer<typeof SharedAccountRefSchema>;
|
|
27
|
+
|
|
28
|
+
export const sameSharedRef = (a: SharedAccountRef, b: SharedAccountRef): boolean => a.provider === b.provider && a.account === b.account;
|
|
29
|
+
|
|
30
|
+
// GET /sharing/accounts on the source: everything it holds, and how each would reach another sandbox.
|
|
31
|
+
export const ShareableAccountSchema = SharedAccountRefSchema.extend({
|
|
32
|
+
label: z.string().describe("What the source calls it."),
|
|
33
|
+
email: z.string().optional(),
|
|
34
|
+
mode: ShareModeSchema,
|
|
35
|
+
reason: z.string().optional().describe("Why it cannot be shared, when `mode` is no."),
|
|
36
|
+
});
|
|
37
|
+
export type ShareableAccount = z.infer<typeof ShareableAccountSchema>;
|
|
38
|
+
export const ShareableAccountsSchema = z.object({
|
|
39
|
+
sandbox: z.string().describe("What the source calls itself."),
|
|
40
|
+
accounts: z.array(ShareableAccountSchema),
|
|
41
|
+
});
|
|
42
|
+
export type ShareableAccounts = z.infer<typeof ShareableAccountsSchema>;
|
|
43
|
+
|
|
44
|
+
// A copy of one static account, the fields every static store keeps. Only the target's daemon ever reads one.
|
|
45
|
+
export const StaticAccountCopySchema = z.object({
|
|
46
|
+
label: z.string().optional(),
|
|
47
|
+
email: z.string().optional(),
|
|
48
|
+
variant: z.string().optional(),
|
|
49
|
+
plan: z.string().optional(),
|
|
50
|
+
apiKey: z.string().min(1),
|
|
51
|
+
apiKeyExpiresAtMs: z.number().optional(),
|
|
52
|
+
backendUrl: z.string().optional(),
|
|
53
|
+
});
|
|
54
|
+
export type StaticAccountCopy = z.infer<typeof StaticAccountCopySchema>;
|
|
55
|
+
|
|
56
|
+
export const AccountCopySchema = z.discriminatedUnion("kind", [
|
|
57
|
+
z.object({ kind: z.literal("account"), account: StaticAccountCopySchema }),
|
|
58
|
+
z.object({ kind: z.literal("endpoint"), id: z.string().min(1), config: EndpointConfigSchema }),
|
|
59
|
+
]);
|
|
60
|
+
export type AccountCopy = z.infer<typeof AccountCopySchema>;
|
|
61
|
+
|
|
62
|
+
/* THE LINK DOORS for accounts, called by the target's daemon with the link token. */
|
|
63
|
+
|
|
64
|
+
// GET /link/accounts: what this link may use, as rows without credentials, each with the source's own usage reading,
|
|
65
|
+
// so the target shows the source's figures instead of measuring the same plan twice.
|
|
66
|
+
export const LinkAccountSchema = OauthAccountSchema.extend({
|
|
67
|
+
provider: z.string(),
|
|
68
|
+
mode: z.enum(["copy", "lend"]),
|
|
69
|
+
});
|
|
70
|
+
export type LinkAccount = z.infer<typeof LinkAccountSchema>;
|
|
71
|
+
export const LinkAccountsSchema = z.object({ accounts: z.array(LinkAccountSchema) });
|
|
72
|
+
export type LinkAccounts = z.infer<typeof LinkAccountsSchema>;
|
|
73
|
+
|
|
74
|
+
// POST /link/accounts/copy: one static account's value, for an account the link names in copy mode only.
|
|
75
|
+
export const LinkAccountCopySchema = z.object({ copy: AccountCopySchema });
|
|
76
|
+
export type LinkAccountCopy = z.infer<typeof LinkAccountCopySchema>;
|
|
77
|
+
|
|
78
|
+
/* THE TARGET'S OWN ROUTES, called by the owner's editor. */
|
|
79
|
+
|
|
80
|
+
// POST /sharing/borrow: bring the named accounts in over the accounts link saved as `card`.
|
|
81
|
+
export const AccountsBorrowSchema = z.object({
|
|
82
|
+
card: z.string().min(1).describe("The link card the editor saved for the source."),
|
|
83
|
+
items: z.array(SharedAccountRefSchema).min(1).max(64),
|
|
84
|
+
});
|
|
85
|
+
export type AccountsBorrow = z.infer<typeof AccountsBorrowSchema>;
|
|
86
|
+
|
|
87
|
+
export const BorrowOutcomeSchema = SharedAccountRefSchema.extend({
|
|
88
|
+
outcome: z.enum(["copied", "borrowed", "failed"]),
|
|
89
|
+
id: z.string().optional().describe("The account's id here, for a copy or a borrow."),
|
|
90
|
+
message: z.string().optional().describe("Why it failed, in words a person can act on."),
|
|
91
|
+
});
|
|
92
|
+
export type BorrowOutcome = z.infer<typeof BorrowOutcomeSchema>;
|
|
93
|
+
export const AccountsBorrowedSchema = z.object({ results: z.array(BorrowOutcomeSchema) });
|
|
94
|
+
export type AccountsBorrowed = z.infer<typeof AccountsBorrowedSchema>;
|
|
95
|
+
|
|
96
|
+
// Where a borrowed account comes from, as a row here says it.
|
|
97
|
+
export const BorrowedFromSchema = z.object({
|
|
98
|
+
name: z.string().describe("What the source calls itself."),
|
|
99
|
+
sandboxId: z.string().optional(),
|
|
100
|
+
});
|
|
101
|
+
export type BorrowedFrom = z.infer<typeof BorrowedFromSchema>;
|
|
102
|
+
|
|
103
|
+
// One account this sandbox borrows: no credential in it, only where to ask. Access tokens are held in memory.
|
|
104
|
+
export const BorrowedAccountSchema = z.object({
|
|
105
|
+
id: z.string().describe("Its id here: what a turn names, and what Stop borrowing takes."),
|
|
106
|
+
card: z.string().describe("The link card it is borrowed through."),
|
|
107
|
+
provider: z.string(),
|
|
108
|
+
remote: z.string().optional().describe("Its id on the source; absent for a translator provider, borrowed whole."),
|
|
109
|
+
label: z.string(),
|
|
110
|
+
email: z.string().optional(),
|
|
111
|
+
organization: z.string().optional(),
|
|
112
|
+
from: BorrowedFromSchema,
|
|
113
|
+
borrowedAt: z.number(),
|
|
114
|
+
});
|
|
115
|
+
export type BorrowedAccount = z.infer<typeof BorrowedAccountSchema>;
|
|
116
|
+
export const BorrowedAccountsSchema = z.object({ accounts: z.array(BorrowedAccountSchema) });
|
|
117
|
+
export type BorrowedAccounts = z.infer<typeof BorrowedAccountsSchema>;
|
|
118
|
+
|
|
119
|
+
export const BorrowedAccountIdSchema = z.object({ id: z.string().min(1) });
|
|
120
|
+
|
|
121
|
+
// The prefix every borrowed account's id here carries, so no store mistakes one for an account of its own.
|
|
122
|
+
export const BORROWED_ID_PREFIX = "lent-";
|
|
123
|
+
export const isBorrowedId = (id: string): boolean => id.startsWith(BORROWED_ID_PREFIX);
|
|
@@ -38,6 +38,12 @@ export const OauthAccountSchema = z.object({
|
|
|
38
38
|
usage: AccountUsageSchema.optional().describe(
|
|
39
39
|
"How full its plan limits were when last measured, so a picker can show what is left before committing work to it. Absent until a reading exists, which reads as unknown rather than as nothing left.",
|
|
40
40
|
),
|
|
41
|
+
borrowedFrom: z
|
|
42
|
+
.object({ name: z.string(), sandboxId: z.string().optional() })
|
|
43
|
+
.optional()
|
|
44
|
+
.describe(
|
|
45
|
+
"Another of the owner's sandboxes holds this sign-in and lends it here turn by turn (schemas/providers/account-sharing.ts). Absent means it is this sandbox's own.",
|
|
46
|
+
),
|
|
41
47
|
});
|
|
42
48
|
export type OauthAccount = z.infer<typeof OauthAccountSchema>;
|
|
43
49
|
export const OauthAccountListSchema = z.object({
|
|
@@ -2,9 +2,15 @@ import { STATE_DIR } from "@intentic/constants";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { ArtifactNameSchema } from "./device-artifacts.js";
|
|
4
4
|
|
|
5
|
-
// <repo>/.intentic/run.json declares
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// <repo>/.intentic/run.json declares what a repository can run, and where: in the sandbox, on the owner's own computers, or
|
|
6
|
+
// either. One file behind the editor's Run dialog (the sandbox beside every computer, one choice of where), the Browsers
|
|
7
|
+
// view's Start and `devices run <target>`.
|
|
8
|
+
// - In the sandbox: `command`, run from the repository's root as Start runs it, handed the PORT its preview address is
|
|
9
|
+
// routed to and the sandbox desktop's DISPLAY. A repository whose first such target exists runs it on Start
|
|
10
|
+
// (_sandbox/sandbox/src/panels/run-plan.ts).
|
|
11
|
+
// - On a computer: `artifact`. Each run builds in the sandbox, pushes the artifact, reaches the declared device ports and
|
|
12
|
+
// starts the program via app_start.
|
|
13
|
+
// Declaring one never starts it automatically.
|
|
8
14
|
|
|
9
15
|
export const RUN_TARGETS_FILE = `${STATE_DIR}/run.json`;
|
|
10
16
|
|
|
@@ -17,19 +23,27 @@ const BundleNameSchema = z
|
|
|
17
23
|
.string()
|
|
18
24
|
.regex(/^[A-Za-z0-9][A-Za-z0-9 ._()+-]{0,199}(\/[A-Za-z0-9][A-Za-z0-9 ._()+-]{0,199})*$/, "a relative name, folders by /");
|
|
19
25
|
|
|
26
|
+
// What an app inside a repository may be called (workspace-repos.ts AppParamSchema), kept short enough for its preview
|
|
27
|
+
// hostname.
|
|
28
|
+
const SANDBOX_TARGET_NAME = /^[a-z][a-z0-9-]{0,39}$/;
|
|
29
|
+
|
|
20
30
|
export const RunTargetSchema = z
|
|
21
31
|
.object({
|
|
22
32
|
// What `devices run <name>` and the button call it.
|
|
23
33
|
name: ArtifactNameSchema,
|
|
24
34
|
description: z.string().max(300).optional(),
|
|
35
|
+
// What runs it in the sandbox, from the repository's root: a dev server listens on $PORT, a program with a window
|
|
36
|
+
// opens it on the sandbox desktop. Absent means it runs only on a computer.
|
|
37
|
+
command: z.string().min(1).max(4000).optional(),
|
|
25
38
|
// The computer it runs on unless one is named at the run; the device's name as its tools are mounted.
|
|
26
39
|
device: z.string().min(1).max(100).optional(),
|
|
27
40
|
// A shell command run from the repository's root, in the sandbox, before every run; absent means the artifact
|
|
28
41
|
// is already there.
|
|
29
42
|
build: z.string().min(1).max(4000).optional(),
|
|
30
|
-
// What is carried: one file or one folder, or a set of files and folders gathered into one folder
|
|
31
|
-
// their own (an .exe beside the sidecars, DLLs and resource folders it looks for next to itself).
|
|
32
|
-
|
|
43
|
+
// What is carried to a computer: one file or one folder, or a set of files and folders gathered into one folder
|
|
44
|
+
// under names of their own (an .exe beside the sidecars, DLLs and resource folders it looks for next to itself).
|
|
45
|
+
// Absent means it runs only in the sandbox.
|
|
46
|
+
artifact: z.union([RepoPathSchema, z.record(BundleNameSchema, RepoPathSchema)]).optional(),
|
|
33
47
|
// Which file to start when the artifact is a folder or a set; a lone file is started as itself.
|
|
34
48
|
program: BundleNameSchema.optional(),
|
|
35
49
|
args: z.array(z.string().max(4000)).max(100).default([]),
|
|
@@ -40,9 +54,22 @@ export const RunTargetSchema = z
|
|
|
40
54
|
// opened at the same port in the sandbox.
|
|
41
55
|
reach: z.array(z.int().min(1).max(65535)).max(16).default([]),
|
|
42
56
|
})
|
|
43
|
-
.strict()
|
|
57
|
+
.strict()
|
|
58
|
+
.refine(
|
|
59
|
+
(target) => target.command !== undefined || target.artifact !== undefined,
|
|
60
|
+
`a target needs a "command" (to run in the sandbox) or an "artifact" (to run on your computers), or both`,
|
|
61
|
+
)
|
|
62
|
+
// A sandbox run is served at preview-<repo>--<name>-<sandboxId>.<zone>, so its name is a piece of a DNS label.
|
|
63
|
+
.refine(
|
|
64
|
+
(target) => target.command === undefined || SANDBOX_TARGET_NAME.test(target.name),
|
|
65
|
+
`a target that runs in the sandbox names its preview address: lowercase letters, digits and dashes, starting with a letter`,
|
|
66
|
+
);
|
|
44
67
|
export type RunTarget = z.infer<typeof RunTargetSchema>;
|
|
45
68
|
|
|
69
|
+
// Where a target can run: in the sandbox when it has a command, on a computer when it carries an artifact.
|
|
70
|
+
export const runsInSandbox = (target: Pick<RunTarget, "command">): boolean => target.command !== undefined;
|
|
71
|
+
export const runsOnComputers = (target: Pick<RunTarget, "artifact">): boolean => target.artifact !== undefined;
|
|
72
|
+
|
|
46
73
|
export const RunTargetsFileSchema = z
|
|
47
74
|
.object({
|
|
48
75
|
targets: z
|
|
@@ -60,6 +87,7 @@ export const RepoRunTargetsSchema = z.object({
|
|
|
60
87
|
targets: z.array(RunTargetSchema),
|
|
61
88
|
error: z.string().optional(),
|
|
62
89
|
});
|
|
90
|
+
export type RepoRunTargets = z.infer<typeof RepoRunTargetsSchema>;
|
|
63
91
|
|
|
64
92
|
export const RunTargetsListSchema = z.object({
|
|
65
93
|
repos: z.array(RepoRunTargetsSchema),
|
|
@@ -67,16 +67,18 @@ export const TemplatesListSchema = z.object({
|
|
|
67
67
|
templates: z.array(TemplateSummarySchema).describe("The kinds of app the configured source repository knows how to scaffold."),
|
|
68
68
|
});
|
|
69
69
|
export type TemplatesList = z.infer<typeof TemplatesListSchema>;
|
|
70
|
-
// One app
|
|
71
|
-
// https://preview-<repo>--<app>-<sandboxId>.<zone>, absent without
|
|
70
|
+
// One app inside a repository, with its own dev server and status: a target its .intentic/run.json runs in the sandbox,
|
|
71
|
+
// or an instance in a monorepo's `_apps/`. previewUrl is https://preview-<repo>--<app>-<sandboxId>.<zone>, absent without
|
|
72
|
+
// a zone or connect token.
|
|
72
73
|
export const RepoAppSchema = z.object({
|
|
73
|
-
app: z.string().describe("The app's name
|
|
74
|
+
app: z.string().describe("The app's name: its run.json target's name, or its folder under _apps/."),
|
|
74
75
|
kind: z
|
|
75
76
|
.string()
|
|
76
77
|
.optional()
|
|
77
78
|
.describe(
|
|
78
79
|
"What sort of app it is: the template it came from, or the framework worked out from its dependencies. Absent when it was found purely by having a dev script.",
|
|
79
80
|
),
|
|
81
|
+
command: z.string().optional().describe("What runs it, as the repository's .intentic/run.json says. Absent for an app found under _apps/."),
|
|
80
82
|
previewUrl: z.string().optional().describe("Where to open it. Absent when this sandbox has no outside address."),
|
|
81
83
|
running: z.boolean().describe("Whether its dev server is up."),
|
|
82
84
|
healthy: z.boolean().describe("Whether it is actually answering."),
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"archives.d.ts","sourceRoot":"","sources":["../../src/text/archives.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;AAgC7E,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,aAAa,GAAG,SAG5D,CAAC;AAGF,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAAM,GAAG,SAGnD,CAAC;AAMF,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,OAGjD,CAAC;AAGF,MAAM,WAAW,WAAW;IAExB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B;AA6BD,eAAO,MAAM,eAAe,YAAa,MAAM,iBAAiB,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,KAAG,WAAW,GAAG,SAGzG,CAAC;AAMF,eAAO,MAAM,aAAa,YAAa,MAAM,iBAAiB,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,KAAG,WAAW,GAAG,SAGvG,CAAC;AAUF,eAAO,MAAM,eAAe,aAAc,MAAM,QAAQ,MAAM,KAAG,OACS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"archives.js","sourceRoot":"","sources":["../../src/text/archives.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,GAA4C;IACrD,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK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C,CAAC;IACrC,OAAO,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;AACvE,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,aAAwC,EAA2B,EAAE;IAChH,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACnE,CAAC,CAAC;AAGF,MAAM,WAAW,GAAG,aAAa,CAAC;AAOlC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAW,EAAE,CACvE,QAAQ,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packed-formats.d.ts","sourceRoot":"","sources":["../../src/text/packed-formats.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,SAAU,MAAM,KAAG,OAI3C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packed-formats.js","sourceRoot":"","sources":["../../src/text/packed-formats.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,GAAG,IAAI,GAAG,CAClB,CACI,uIAAuI;IACvI,wGAAwG,CAC3G,CAAC,KAAK,CAAC,GAAG,CAAC,CACf,CAAC;AAGF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAW,EAAE;IAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|