@intentic/sandbox-contract 1.409.0 → 1.410.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 +0 -16
- package/dist/contracts/accounts.contract.d.ts.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +0 -12
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/hub.contract.d.ts +121 -0
- package/dist/contracts/hub.contract.d.ts.map +1 -0
- package/dist/contracts/hub.contract.js +32 -0
- package/dist/contracts/hub.contract.js.map +1 -0
- package/dist/contracts/secrets.contract.d.ts +1 -73
- package/dist/contracts/secrets.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.js +4 -20
- package/dist/contracts/secrets.contract.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/protocol/doors/runner-wake.d.ts +46 -0
- package/dist/protocol/doors/runner-wake.d.ts.map +1 -0
- package/dist/protocol/doors/runner-wake.js +21 -0
- package/dist/protocol/doors/runner-wake.js.map +1 -0
- package/dist/protocol/raw/raw-json-routes.d.ts +14 -145
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +1 -6
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +4 -16
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +1 -4
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +0 -8
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +0 -4
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/connection-hub.d.ts +347 -0
- package/dist/schemas/connection-hub.d.ts.map +1 -0
- package/dist/schemas/connection-hub.js +118 -0
- package/dist/schemas/connection-hub.js.map +1 -0
- package/dist/schemas/diagnostics.d.ts +22 -1
- package/dist/schemas/diagnostics.d.ts.map +1 -1
- package/dist/schemas/diagnostics.js +13 -1
- package/dist/schemas/diagnostics.js.map +1 -1
- package/dist/schemas/links.d.ts +0 -21
- package/dist/schemas/links.d.ts.map +1 -1
- package/dist/schemas/links.js +1 -9
- package/dist/schemas/links.js.map +1 -1
- package/dist/schemas/providers/provider-oauth.d.ts +0 -16
- package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
- package/dist/schemas/providers/provider-oauth.js +0 -4
- package/dist/schemas/providers/provider-oauth.js.map +1 -1
- package/dist/schemas/sandbox-passwords.d.ts +0 -142
- package/dist/schemas/sandbox-passwords.d.ts.map +1 -1
- package/dist/schemas/sandbox-passwords.js +1 -33
- package/dist/schemas/sandbox-passwords.js.map +1 -1
- package/dist/state/auth-state.d.ts.map +1 -1
- package/dist/state/auth-state.js +1 -0
- package/dist/state/auth-state.js.map +1 -1
- package/dist/state/definition.d.ts +0 -8
- package/dist/state/definition.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/contracts/hub.contract.ts +39 -0
- package/src/contracts/secrets.contract.ts +5 -21
- package/src/index.ts +3 -3
- package/src/protocol/doors/runner-wake.ts +36 -0
- package/src/protocol/raw/raw-json-routes.ts +0 -10
- package/src/protocol/raw/raw-routes.ts +2 -7
- package/src/schemas/capabilities.ts +0 -6
- package/src/schemas/connection-hub.test.ts +28 -0
- package/src/schemas/connection-hub.ts +191 -0
- package/src/schemas/diagnostics.ts +19 -2
- package/src/schemas/links.ts +4 -15
- package/src/schemas/providers/provider-oauth.ts +0 -6
- package/src/schemas/sandbox-passwords.ts +5 -46
- package/src/state/auth-state.ts +3 -0
- package/dist/contracts/sharing.contract.d.ts +0 -58
- package/dist/contracts/sharing.contract.d.ts.map +0 -1
- package/dist/contracts/sharing.contract.js +0 -41
- package/dist/contracts/sharing.contract.js.map +0 -1
- package/dist/schemas/providers/account-sharing.d.ts +0 -277
- package/dist/schemas/providers/account-sharing.d.ts.map +0 -1
- package/dist/schemas/providers/account-sharing.js +0 -68
- package/dist/schemas/providers/account-sharing.js.map +0 -1
- package/src/contracts/sharing.contract.ts +0 -54
- package/src/schemas/providers/account-sharing.ts +0 -123
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { KeyringOriginSchema
|
|
2
|
+
import { KeyringOriginSchema } from "./keyring.js";
|
|
3
3
|
|
|
4
4
|
// THE SANDBOX'S SIDE OF PASSWORDS (2026-10-19): an agent asking for a credential by where it is to be used (`secrets
|
|
5
|
-
// want`, `type_secret` aimed at a page or a window), and the
|
|
6
|
-
// management
|
|
5
|
+
// want`, `type_secret` aimed at a page or a window), and the wants still waiting, which the Secrets view lists. Passwords
|
|
6
|
+
// itself, the vault and its management, is on the owner's computers alone (2026-11-11): a sandbox deals in secrets, and
|
|
7
|
+
// what it learns of an entry is the pointer its keyring shared here, which the secret inventory lists like any other.
|
|
7
8
|
|
|
8
9
|
/** `secrets want`: a credential by the place it is for, asked of the owner's keyrings. */
|
|
9
10
|
export const SecretWantSchema = z
|
|
@@ -30,7 +31,7 @@ export const SecretWantResultSchema = z.discriminatedUnion("state", [
|
|
|
30
31
|
]);
|
|
31
32
|
export type SecretWantResult = z.infer<typeof SecretWantResultSchema>;
|
|
32
33
|
|
|
33
|
-
/** One need this sandbox raised, as its record and the
|
|
34
|
+
/** One need this sandbox raised, as its record keeps it and the Secrets view lists it while it waits. */
|
|
34
35
|
export const SandboxNeedSchema = z.object({
|
|
35
36
|
id: z.string(),
|
|
36
37
|
origin: KeyringOriginSchema,
|
|
@@ -44,45 +45,3 @@ export const SandboxNeedSchema = z.object({
|
|
|
44
45
|
});
|
|
45
46
|
export type SandboxNeed = z.infer<typeof SandboxNeedSchema>;
|
|
46
47
|
export const SandboxNeedsSchema = z.object({ needs: z.array(SandboxNeedSchema) });
|
|
47
|
-
|
|
48
|
-
/** One of the owner's computers as the hosted Passwords view shows its keyring. */
|
|
49
|
-
export const SandboxPasswordsKeyringSchema = z.object({
|
|
50
|
-
machine: z.string(),
|
|
51
|
-
online: z.boolean(),
|
|
52
|
-
setUp: z.boolean().describe("Answering, set up, and trusted by this sandbox: it can be asked."),
|
|
53
|
-
locked: z.boolean().optional(),
|
|
54
|
-
remember: KeyringRememberSchema.optional(),
|
|
55
|
-
});
|
|
56
|
-
export type SandboxPasswordsKeyring = z.infer<typeof SandboxPasswordsKeyringSchema>;
|
|
57
|
-
|
|
58
|
-
/** One password this sandbox may use: a pointer one of the owner's keyrings shares here. Never a value. */
|
|
59
|
-
export const SandboxPasswordSchema = z.object({
|
|
60
|
-
name: z.string(),
|
|
61
|
-
title: z.string(),
|
|
62
|
-
kind: z.enum(["password", "text"]),
|
|
63
|
-
origins: z.array(KeyringOriginSchema).describe("Where it works, from the entry's rules."),
|
|
64
|
-
anyField: z.boolean(),
|
|
65
|
-
machine: z.string().describe("The computer whose keyring keeps it."),
|
|
66
|
-
mode: KeyringShareModeSchema.describe("How this sandbox may use it."),
|
|
67
|
-
online: z.boolean(),
|
|
68
|
-
updatedAt: z.number(),
|
|
69
|
-
lastUsedAt: z.number().optional().describe("This sandbox's last use of it, from its own use ledger."),
|
|
70
|
-
});
|
|
71
|
-
export type SandboxPassword = z.infer<typeof SandboxPasswordSchema>;
|
|
72
|
-
|
|
73
|
-
export const SandboxPasswordsSchema = z.object({
|
|
74
|
-
sandbox: z.string().describe("This sandbox's own address, as the keyrings name it."),
|
|
75
|
-
items: z.array(SandboxPasswordSchema),
|
|
76
|
-
keyrings: z.array(SandboxPasswordsKeyringSchema),
|
|
77
|
-
});
|
|
78
|
-
export type SandboxPasswords = z.infer<typeof SandboxPasswordsSchema>;
|
|
79
|
-
|
|
80
|
-
/** One use of a keyring-held password by this sandbox, from its use ledger. */
|
|
81
|
-
export const SandboxPasswordUseSchema = z.object({
|
|
82
|
-
at: z.number(),
|
|
83
|
-
name: z.string(),
|
|
84
|
-
lane: z.string(),
|
|
85
|
-
detail: z.string().optional(),
|
|
86
|
-
approvedBy: z.string().optional(),
|
|
87
|
-
});
|
|
88
|
-
export const SandboxPasswordsActivitySchema = z.object({ lines: z.array(SandboxPasswordUseSchema) });
|
package/src/state/auth-state.ts
CHANGED
|
@@ -72,6 +72,9 @@ export const AUTH_STATE_FILES: readonly StateFile[] = [
|
|
|
72
72
|
{ path: "keyring-copies.json", portability: "identity" },
|
|
73
73
|
{ path: "keyring-sync-mailbox.json", portability: "identity" },
|
|
74
74
|
{ path: "keyring-needs.json", portability: "identity" },
|
|
75
|
+
// What this sandbox saved to the connections hub and what it made from hub entries shared here (hub/): entry names
|
|
76
|
+
// and the cards they became, no credential.
|
|
77
|
+
{ path: "connection-hub.json", portability: "identity" },
|
|
75
78
|
// The credential broker's signing key and the privacy gateway's token key, each minted on first use.
|
|
76
79
|
{ path: "broker-session.key", portability: "identity" },
|
|
77
80
|
{ path: "privacy-gateway.key", portability: "identity" },
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export declare const sharingContract: {
|
|
2
|
-
shareable: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodObject<{
|
|
3
|
-
sandbox: import("zod").ZodString;
|
|
4
|
-
accounts: import("zod").ZodArray<import("zod").ZodObject<{
|
|
5
|
-
provider: import("zod").ZodString;
|
|
6
|
-
account: import("zod").ZodOptional<import("zod").ZodString>;
|
|
7
|
-
label: import("zod").ZodString;
|
|
8
|
-
email: import("zod").ZodOptional<import("zod").ZodString>;
|
|
9
|
-
mode: import("zod").ZodEnum<{
|
|
10
|
-
copy: "copy";
|
|
11
|
-
lend: "lend";
|
|
12
|
-
no: "no";
|
|
13
|
-
}>;
|
|
14
|
-
reason: import("zod").ZodOptional<import("zod").ZodString>;
|
|
15
|
-
}, import("zod/v4/core").$strip>>;
|
|
16
|
-
}, import("zod/v4/core").$strip>, Record<never, never>, import("../protocol/route-meta.js").RouteMeta & Record<never, never>>;
|
|
17
|
-
borrow: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
18
|
-
card: import("zod").ZodString;
|
|
19
|
-
items: import("zod").ZodArray<import("zod").ZodObject<{
|
|
20
|
-
provider: import("zod").ZodString;
|
|
21
|
-
account: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22
|
-
}, import("zod/v4/core").$strip>>;
|
|
23
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
24
|
-
results: import("zod").ZodArray<import("zod").ZodObject<{
|
|
25
|
-
provider: import("zod").ZodString;
|
|
26
|
-
account: import("zod").ZodOptional<import("zod").ZodString>;
|
|
27
|
-
outcome: import("zod").ZodEnum<{
|
|
28
|
-
borrowed: "borrowed";
|
|
29
|
-
copied: "copied";
|
|
30
|
-
failed: "failed";
|
|
31
|
-
}>;
|
|
32
|
-
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
|
-
message: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
-
}, import("zod/v4/core").$strip>>;
|
|
35
|
-
}, import("zod/v4/core").$strip>, Record<never, never>, import("../protocol/route-meta.js").RouteMeta & Record<never, never>>;
|
|
36
|
-
borrowed: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodObject<{
|
|
37
|
-
accounts: import("zod").ZodArray<import("zod").ZodObject<{
|
|
38
|
-
id: import("zod").ZodString;
|
|
39
|
-
card: import("zod").ZodString;
|
|
40
|
-
provider: import("zod").ZodString;
|
|
41
|
-
remote: import("zod").ZodOptional<import("zod").ZodString>;
|
|
42
|
-
label: import("zod").ZodString;
|
|
43
|
-
email: import("zod").ZodOptional<import("zod").ZodString>;
|
|
44
|
-
organization: import("zod").ZodOptional<import("zod").ZodString>;
|
|
45
|
-
from: import("zod").ZodObject<{
|
|
46
|
-
name: import("zod").ZodString;
|
|
47
|
-
sandboxId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
48
|
-
}, import("zod/v4/core").$strip>;
|
|
49
|
-
borrowedAt: import("zod").ZodNumber;
|
|
50
|
-
}, import("zod/v4/core").$strip>>;
|
|
51
|
-
}, import("zod/v4/core").$strip>, Record<never, never>, import("../protocol/route-meta.js").RouteMeta & Record<never, never>>;
|
|
52
|
-
stop: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
53
|
-
id: import("zod").ZodString;
|
|
54
|
-
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
55
|
-
ok: import("zod").ZodLiteral<true>;
|
|
56
|
-
}, import("zod/v4/core").$strip>, Record<never, never>, import("../protocol/route-meta.js").RouteMeta & Record<never, never>>;
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=sharing.contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sharing.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/sharing.contract.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe;IACxB,SAAS;;;;;;;;;;;;;;;IAST,MAAM;;;;;;;;;;;;;;;;;;;IAUN,QAAQ;;;;;;;;;;;;;;;;IAQR,IAAI;;;;;CAUP,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { procedure } from "../protocol/route-meta.js";
|
|
2
|
-
import { AccountsBorrowedSchema, AccountsBorrowSchema, BorrowedAccountIdSchema, BorrowedAccountsSchema, ShareableAccountsSchema, } from "../schemas/providers/account-sharing.js";
|
|
3
|
-
import { OkSchema } from "../schemas/shared.js";
|
|
4
|
-
const sharingRoute = procedure.meta({ floor: "maintainer", control: "never", panel: false });
|
|
5
|
-
export const sharingContract = {
|
|
6
|
-
shareable: sharingRoute
|
|
7
|
-
.route({
|
|
8
|
-
method: "GET",
|
|
9
|
-
path: "/sharing/accounts",
|
|
10
|
-
summary: "What this sandbox can share with another of yours",
|
|
11
|
-
description: "Every model account held here and how it would reach another of the owner's sandboxes: copied (a key that does not rotate), lent turn by turn (a sign-in whose renewal must stay here), or not at all, with why. No credential is in the answer.",
|
|
12
|
-
})
|
|
13
|
-
.output(ShareableAccountsSchema),
|
|
14
|
-
borrow: sharingRoute
|
|
15
|
-
.route({
|
|
16
|
-
method: "POST",
|
|
17
|
-
path: "/sharing/borrow",
|
|
18
|
-
summary: "Bring accounts in from another of your sandboxes",
|
|
19
|
-
description: "Over the accounts link saved as `card`, copies each named static key into this sandbox's own stores and files each lent sign-in as borrowed. Each account answers on its own, so one that fails leaves the others in.",
|
|
20
|
-
})
|
|
21
|
-
.input(AccountsBorrowSchema)
|
|
22
|
-
.output(AccountsBorrowedSchema),
|
|
23
|
-
borrowed: sharingRoute
|
|
24
|
-
.route({
|
|
25
|
-
method: "GET",
|
|
26
|
-
path: "/sharing/borrowed",
|
|
27
|
-
summary: "Accounts this sandbox borrows",
|
|
28
|
-
description: "Each account another of the owner's sandboxes lends here, and which link it is borrowed through. No credential is in the answer.",
|
|
29
|
-
})
|
|
30
|
-
.output(BorrowedAccountsSchema),
|
|
31
|
-
stop: sharingRoute
|
|
32
|
-
.route({
|
|
33
|
-
method: "POST",
|
|
34
|
-
path: "/sharing/borrowed/stop",
|
|
35
|
-
summary: "Stop borrowing an account",
|
|
36
|
-
description: "Forgets one borrowed account here: no turn asks the source for it again. The source's own link is changed separately, by the owner's editor or on the source.",
|
|
37
|
-
})
|
|
38
|
-
.input(BorrowedAccountIdSchema)
|
|
39
|
-
.output(OkSchema),
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=sharing.contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sharing.contract.js","sourceRoot":"","sources":["../../src/contracts/sharing.contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACH,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,GAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EA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Mode = z.infer<typeof ShareModeSchema>;
|
|
8
|
-
export declare const SharedAccountRefSchema: z.ZodObject<{
|
|
9
|
-
provider: z.ZodString;
|
|
10
|
-
account: z.ZodOptional<z.ZodString>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
export type SharedAccountRef = z.infer<typeof SharedAccountRefSchema>;
|
|
13
|
-
export declare const sameSharedRef: (a: SharedAccountRef, b: SharedAccountRef) => boolean;
|
|
14
|
-
export declare const ShareableAccountSchema: z.ZodObject<{
|
|
15
|
-
provider: z.ZodString;
|
|
16
|
-
account: z.ZodOptional<z.ZodString>;
|
|
17
|
-
label: z.ZodString;
|
|
18
|
-
email: z.ZodOptional<z.ZodString>;
|
|
19
|
-
mode: z.ZodEnum<{
|
|
20
|
-
copy: "copy";
|
|
21
|
-
lend: "lend";
|
|
22
|
-
no: "no";
|
|
23
|
-
}>;
|
|
24
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
25
|
-
}, z.core.$strip>;
|
|
26
|
-
export type ShareableAccount = z.infer<typeof ShareableAccountSchema>;
|
|
27
|
-
export declare const ShareableAccountsSchema: z.ZodObject<{
|
|
28
|
-
sandbox: z.ZodString;
|
|
29
|
-
accounts: z.ZodArray<z.ZodObject<{
|
|
30
|
-
provider: z.ZodString;
|
|
31
|
-
account: z.ZodOptional<z.ZodString>;
|
|
32
|
-
label: z.ZodString;
|
|
33
|
-
email: z.ZodOptional<z.ZodString>;
|
|
34
|
-
mode: z.ZodEnum<{
|
|
35
|
-
copy: "copy";
|
|
36
|
-
lend: "lend";
|
|
37
|
-
no: "no";
|
|
38
|
-
}>;
|
|
39
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
40
|
-
}, z.core.$strip>>;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
export type ShareableAccounts = z.infer<typeof ShareableAccountsSchema>;
|
|
43
|
-
export declare const StaticAccountCopySchema: z.ZodObject<{
|
|
44
|
-
label: z.ZodOptional<z.ZodString>;
|
|
45
|
-
email: z.ZodOptional<z.ZodString>;
|
|
46
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
47
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
48
|
-
apiKey: z.ZodString;
|
|
49
|
-
apiKeyExpiresAtMs: z.ZodOptional<z.ZodNumber>;
|
|
50
|
-
backendUrl: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, z.core.$strip>;
|
|
52
|
-
export type StaticAccountCopy = z.infer<typeof StaticAccountCopySchema>;
|
|
53
|
-
export declare const AccountCopySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
54
|
-
kind: z.ZodLiteral<"account">;
|
|
55
|
-
account: z.ZodObject<{
|
|
56
|
-
label: z.ZodOptional<z.ZodString>;
|
|
57
|
-
email: z.ZodOptional<z.ZodString>;
|
|
58
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
59
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
60
|
-
apiKey: z.ZodString;
|
|
61
|
-
apiKeyExpiresAtMs: z.ZodOptional<z.ZodNumber>;
|
|
62
|
-
backendUrl: z.ZodOptional<z.ZodString>;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
-
kind: z.ZodLiteral<"endpoint">;
|
|
66
|
-
id: z.ZodString;
|
|
67
|
-
config: z.ZodObject<{
|
|
68
|
-
baseUrl: z.ZodURL;
|
|
69
|
-
protocol: z.ZodDefault<z.ZodEnum<{
|
|
70
|
-
anthropic: "anthropic";
|
|
71
|
-
openai: "openai";
|
|
72
|
-
}>>;
|
|
73
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
74
|
-
headers: z.ZodOptional<z.ZodString>;
|
|
75
|
-
}, z.core.$strip>;
|
|
76
|
-
}, z.core.$strip>], "kind">;
|
|
77
|
-
export type AccountCopy = z.infer<typeof AccountCopySchema>;
|
|
78
|
-
export declare const LinkAccountSchema: z.ZodObject<{
|
|
79
|
-
id: z.ZodString;
|
|
80
|
-
label: z.ZodString;
|
|
81
|
-
email: z.ZodOptional<z.ZodString>;
|
|
82
|
-
organization: z.ZodOptional<z.ZodString>;
|
|
83
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
84
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
85
|
-
connectedAt: z.ZodNumber;
|
|
86
|
-
connectedBy: z.ZodOptional<z.ZodString>;
|
|
87
|
-
needsReauth: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
-
detail: z.ZodOptional<z.ZodString>;
|
|
89
|
-
seatRefusal: z.ZodOptional<z.ZodString>;
|
|
90
|
-
usage: z.ZodOptional<z.ZodObject<{
|
|
91
|
-
windows: z.ZodArray<z.ZodObject<{
|
|
92
|
-
kind: z.ZodString;
|
|
93
|
-
label: z.ZodOptional<z.ZodString>;
|
|
94
|
-
utilization: z.ZodNumber;
|
|
95
|
-
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
96
|
-
gates: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodLiteral<"none">, z.ZodObject<{
|
|
97
|
-
models: z.ZodArray<z.ZodString>;
|
|
98
|
-
}, z.core.$strip>]>;
|
|
99
|
-
rounded: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
-
lapsedAt: z.ZodOptional<z.ZodNumber>;
|
|
101
|
-
missingSince: z.ZodOptional<z.ZodNumber>;
|
|
102
|
-
}, z.core.$strip>>;
|
|
103
|
-
measuredAt: z.ZodNumber;
|
|
104
|
-
unread: z.ZodOptional<z.ZodObject<{
|
|
105
|
-
since: z.ZodNumber;
|
|
106
|
-
reason: z.ZodString;
|
|
107
|
-
}, z.core.$strip>>;
|
|
108
|
-
uncovered: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
-
contradicted: z.ZodOptional<z.ZodObject<{
|
|
110
|
-
at: z.ZodNumber;
|
|
111
|
-
model: z.ZodString;
|
|
112
|
-
}, z.core.$strip>>;
|
|
113
|
-
}, z.core.$strip>>;
|
|
114
|
-
borrowedFrom: z.ZodOptional<z.ZodObject<{
|
|
115
|
-
name: z.ZodString;
|
|
116
|
-
sandboxId: z.ZodOptional<z.ZodString>;
|
|
117
|
-
}, z.core.$strip>>;
|
|
118
|
-
provider: z.ZodString;
|
|
119
|
-
mode: z.ZodEnum<{
|
|
120
|
-
copy: "copy";
|
|
121
|
-
lend: "lend";
|
|
122
|
-
}>;
|
|
123
|
-
}, z.core.$strip>;
|
|
124
|
-
export type LinkAccount = z.infer<typeof LinkAccountSchema>;
|
|
125
|
-
export declare const LinkAccountsSchema: z.ZodObject<{
|
|
126
|
-
accounts: z.ZodArray<z.ZodObject<{
|
|
127
|
-
id: z.ZodString;
|
|
128
|
-
label: z.ZodString;
|
|
129
|
-
email: z.ZodOptional<z.ZodString>;
|
|
130
|
-
organization: z.ZodOptional<z.ZodString>;
|
|
131
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
132
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
133
|
-
connectedAt: z.ZodNumber;
|
|
134
|
-
connectedBy: z.ZodOptional<z.ZodString>;
|
|
135
|
-
needsReauth: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
-
detail: z.ZodOptional<z.ZodString>;
|
|
137
|
-
seatRefusal: z.ZodOptional<z.ZodString>;
|
|
138
|
-
usage: z.ZodOptional<z.ZodObject<{
|
|
139
|
-
windows: z.ZodArray<z.ZodObject<{
|
|
140
|
-
kind: z.ZodString;
|
|
141
|
-
label: z.ZodOptional<z.ZodString>;
|
|
142
|
-
utilization: z.ZodNumber;
|
|
143
|
-
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
144
|
-
gates: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodLiteral<"none">, z.ZodObject<{
|
|
145
|
-
models: z.ZodArray<z.ZodString>;
|
|
146
|
-
}, z.core.$strip>]>;
|
|
147
|
-
rounded: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
-
lapsedAt: z.ZodOptional<z.ZodNumber>;
|
|
149
|
-
missingSince: z.ZodOptional<z.ZodNumber>;
|
|
150
|
-
}, z.core.$strip>>;
|
|
151
|
-
measuredAt: z.ZodNumber;
|
|
152
|
-
unread: z.ZodOptional<z.ZodObject<{
|
|
153
|
-
since: z.ZodNumber;
|
|
154
|
-
reason: z.ZodString;
|
|
155
|
-
}, z.core.$strip>>;
|
|
156
|
-
uncovered: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
157
|
-
contradicted: z.ZodOptional<z.ZodObject<{
|
|
158
|
-
at: z.ZodNumber;
|
|
159
|
-
model: z.ZodString;
|
|
160
|
-
}, z.core.$strip>>;
|
|
161
|
-
}, z.core.$strip>>;
|
|
162
|
-
borrowedFrom: z.ZodOptional<z.ZodObject<{
|
|
163
|
-
name: z.ZodString;
|
|
164
|
-
sandboxId: z.ZodOptional<z.ZodString>;
|
|
165
|
-
}, z.core.$strip>>;
|
|
166
|
-
provider: z.ZodString;
|
|
167
|
-
mode: z.ZodEnum<{
|
|
168
|
-
copy: "copy";
|
|
169
|
-
lend: "lend";
|
|
170
|
-
}>;
|
|
171
|
-
}, z.core.$strip>>;
|
|
172
|
-
}, z.core.$strip>;
|
|
173
|
-
export type LinkAccounts = z.infer<typeof LinkAccountsSchema>;
|
|
174
|
-
export declare const LinkAccountCopySchema: z.ZodObject<{
|
|
175
|
-
copy: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
176
|
-
kind: z.ZodLiteral<"account">;
|
|
177
|
-
account: z.ZodObject<{
|
|
178
|
-
label: z.ZodOptional<z.ZodString>;
|
|
179
|
-
email: z.ZodOptional<z.ZodString>;
|
|
180
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
181
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
182
|
-
apiKey: z.ZodString;
|
|
183
|
-
apiKeyExpiresAtMs: z.ZodOptional<z.ZodNumber>;
|
|
184
|
-
backendUrl: z.ZodOptional<z.ZodString>;
|
|
185
|
-
}, z.core.$strip>;
|
|
186
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
-
kind: z.ZodLiteral<"endpoint">;
|
|
188
|
-
id: z.ZodString;
|
|
189
|
-
config: z.ZodObject<{
|
|
190
|
-
baseUrl: z.ZodURL;
|
|
191
|
-
protocol: z.ZodDefault<z.ZodEnum<{
|
|
192
|
-
anthropic: "anthropic";
|
|
193
|
-
openai: "openai";
|
|
194
|
-
}>>;
|
|
195
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
196
|
-
headers: z.ZodOptional<z.ZodString>;
|
|
197
|
-
}, z.core.$strip>;
|
|
198
|
-
}, z.core.$strip>], "kind">;
|
|
199
|
-
}, z.core.$strip>;
|
|
200
|
-
export type LinkAccountCopy = z.infer<typeof LinkAccountCopySchema>;
|
|
201
|
-
export declare const AccountsBorrowSchema: z.ZodObject<{
|
|
202
|
-
card: z.ZodString;
|
|
203
|
-
items: z.ZodArray<z.ZodObject<{
|
|
204
|
-
provider: z.ZodString;
|
|
205
|
-
account: z.ZodOptional<z.ZodString>;
|
|
206
|
-
}, z.core.$strip>>;
|
|
207
|
-
}, z.core.$strip>;
|
|
208
|
-
export type AccountsBorrow = z.infer<typeof AccountsBorrowSchema>;
|
|
209
|
-
export declare const BorrowOutcomeSchema: z.ZodObject<{
|
|
210
|
-
provider: z.ZodString;
|
|
211
|
-
account: z.ZodOptional<z.ZodString>;
|
|
212
|
-
outcome: z.ZodEnum<{
|
|
213
|
-
borrowed: "borrowed";
|
|
214
|
-
copied: "copied";
|
|
215
|
-
failed: "failed";
|
|
216
|
-
}>;
|
|
217
|
-
id: z.ZodOptional<z.ZodString>;
|
|
218
|
-
message: z.ZodOptional<z.ZodString>;
|
|
219
|
-
}, z.core.$strip>;
|
|
220
|
-
export type BorrowOutcome = z.infer<typeof BorrowOutcomeSchema>;
|
|
221
|
-
export declare const AccountsBorrowedSchema: z.ZodObject<{
|
|
222
|
-
results: z.ZodArray<z.ZodObject<{
|
|
223
|
-
provider: z.ZodString;
|
|
224
|
-
account: z.ZodOptional<z.ZodString>;
|
|
225
|
-
outcome: z.ZodEnum<{
|
|
226
|
-
borrowed: "borrowed";
|
|
227
|
-
copied: "copied";
|
|
228
|
-
failed: "failed";
|
|
229
|
-
}>;
|
|
230
|
-
id: z.ZodOptional<z.ZodString>;
|
|
231
|
-
message: z.ZodOptional<z.ZodString>;
|
|
232
|
-
}, z.core.$strip>>;
|
|
233
|
-
}, z.core.$strip>;
|
|
234
|
-
export type AccountsBorrowed = z.infer<typeof AccountsBorrowedSchema>;
|
|
235
|
-
export declare const BorrowedFromSchema: z.ZodObject<{
|
|
236
|
-
name: z.ZodString;
|
|
237
|
-
sandboxId: z.ZodOptional<z.ZodString>;
|
|
238
|
-
}, z.core.$strip>;
|
|
239
|
-
export type BorrowedFrom = z.infer<typeof BorrowedFromSchema>;
|
|
240
|
-
export declare const BorrowedAccountSchema: z.ZodObject<{
|
|
241
|
-
id: z.ZodString;
|
|
242
|
-
card: z.ZodString;
|
|
243
|
-
provider: z.ZodString;
|
|
244
|
-
remote: z.ZodOptional<z.ZodString>;
|
|
245
|
-
label: z.ZodString;
|
|
246
|
-
email: z.ZodOptional<z.ZodString>;
|
|
247
|
-
organization: z.ZodOptional<z.ZodString>;
|
|
248
|
-
from: z.ZodObject<{
|
|
249
|
-
name: z.ZodString;
|
|
250
|
-
sandboxId: z.ZodOptional<z.ZodString>;
|
|
251
|
-
}, z.core.$strip>;
|
|
252
|
-
borrowedAt: z.ZodNumber;
|
|
253
|
-
}, z.core.$strip>;
|
|
254
|
-
export type BorrowedAccount = z.infer<typeof BorrowedAccountSchema>;
|
|
255
|
-
export declare const BorrowedAccountsSchema: z.ZodObject<{
|
|
256
|
-
accounts: z.ZodArray<z.ZodObject<{
|
|
257
|
-
id: z.ZodString;
|
|
258
|
-
card: z.ZodString;
|
|
259
|
-
provider: z.ZodString;
|
|
260
|
-
remote: z.ZodOptional<z.ZodString>;
|
|
261
|
-
label: z.ZodString;
|
|
262
|
-
email: z.ZodOptional<z.ZodString>;
|
|
263
|
-
organization: z.ZodOptional<z.ZodString>;
|
|
264
|
-
from: z.ZodObject<{
|
|
265
|
-
name: z.ZodString;
|
|
266
|
-
sandboxId: z.ZodOptional<z.ZodString>;
|
|
267
|
-
}, z.core.$strip>;
|
|
268
|
-
borrowedAt: z.ZodNumber;
|
|
269
|
-
}, z.core.$strip>>;
|
|
270
|
-
}, z.core.$strip>;
|
|
271
|
-
export type BorrowedAccounts = z.infer<typeof BorrowedAccountsSchema>;
|
|
272
|
-
export declare const BorrowedAccountIdSchema: z.ZodObject<{
|
|
273
|
-
id: z.ZodString;
|
|
274
|
-
}, z.core.$strip>;
|
|
275
|
-
export declare const BORROWED_ID_PREFIX = "lent-";
|
|
276
|
-
export declare const isBorrowedId: (id: string) => boolean;
|
|
277
|
-
//# sourceMappingURL=account-sharing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account-sharing.d.ts","sourceRoot":"","sources":["../../../src/schemas/providers/account-sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,eAAe;;;;EAAiC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAKxD,eAAO,MAAM,sBAAsB;;;iBAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,aAAa,MAAO,gBAAgB,KAAK,gBAAgB,KAAG,OAA+D,CAAC;AAGzI,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;iBAGlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OA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;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;iBAUhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;iBAAyD,CAAC;AAC7F,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,uBAAuB;;iBAAsC,CAAC;AAG3E,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAC1C,eAAO,MAAM,YAAY,OAAQ,MAAM,KAAG,OAA4C,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { EndpointConfigSchema } from "../capabilities.js";
|
|
3
|
-
import { OauthAccountSchema } from "./provider-oauth.js";
|
|
4
|
-
export const ShareModeSchema = z.enum(["copy", "lend", "no"]);
|
|
5
|
-
export const SharedAccountRefSchema = z.object({
|
|
6
|
-
provider: z.string().min(1).max(120),
|
|
7
|
-
account: z.string().min(1).max(200).optional(),
|
|
8
|
-
});
|
|
9
|
-
export const sameSharedRef = (a, b) => a.provider === b.provider && a.account === b.account;
|
|
10
|
-
export const ShareableAccountSchema = SharedAccountRefSchema.extend({
|
|
11
|
-
label: z.string().describe("What the source calls it."),
|
|
12
|
-
email: z.string().optional(),
|
|
13
|
-
mode: ShareModeSchema,
|
|
14
|
-
reason: z.string().optional().describe("Why it cannot be shared, when `mode` is no."),
|
|
15
|
-
});
|
|
16
|
-
export const ShareableAccountsSchema = z.object({
|
|
17
|
-
sandbox: z.string().describe("What the source calls itself."),
|
|
18
|
-
accounts: z.array(ShareableAccountSchema),
|
|
19
|
-
});
|
|
20
|
-
export const StaticAccountCopySchema = z.object({
|
|
21
|
-
label: z.string().optional(),
|
|
22
|
-
email: z.string().optional(),
|
|
23
|
-
variant: z.string().optional(),
|
|
24
|
-
plan: z.string().optional(),
|
|
25
|
-
apiKey: z.string().min(1),
|
|
26
|
-
apiKeyExpiresAtMs: z.number().optional(),
|
|
27
|
-
backendUrl: z.string().optional(),
|
|
28
|
-
});
|
|
29
|
-
export const AccountCopySchema = z.discriminatedUnion("kind", [
|
|
30
|
-
z.object({ kind: z.literal("account"), account: StaticAccountCopySchema }),
|
|
31
|
-
z.object({ kind: z.literal("endpoint"), id: z.string().min(1), config: EndpointConfigSchema }),
|
|
32
|
-
]);
|
|
33
|
-
export const LinkAccountSchema = OauthAccountSchema.extend({
|
|
34
|
-
provider: z.string(),
|
|
35
|
-
mode: z.enum(["copy", "lend"]),
|
|
36
|
-
});
|
|
37
|
-
export const LinkAccountsSchema = z.object({ accounts: z.array(LinkAccountSchema) });
|
|
38
|
-
export const LinkAccountCopySchema = z.object({ copy: AccountCopySchema });
|
|
39
|
-
export const AccountsBorrowSchema = z.object({
|
|
40
|
-
card: z.string().min(1).describe("The link card the editor saved for the source."),
|
|
41
|
-
items: z.array(SharedAccountRefSchema).min(1).max(64),
|
|
42
|
-
});
|
|
43
|
-
export const BorrowOutcomeSchema = SharedAccountRefSchema.extend({
|
|
44
|
-
outcome: z.enum(["copied", "borrowed", "failed"]),
|
|
45
|
-
id: z.string().optional().describe("The account's id here, for a copy or a borrow."),
|
|
46
|
-
message: z.string().optional().describe("Why it failed, in words a person can act on."),
|
|
47
|
-
});
|
|
48
|
-
export const AccountsBorrowedSchema = z.object({ results: z.array(BorrowOutcomeSchema) });
|
|
49
|
-
export const BorrowedFromSchema = z.object({
|
|
50
|
-
name: z.string().describe("What the source calls itself."),
|
|
51
|
-
sandboxId: z.string().optional(),
|
|
52
|
-
});
|
|
53
|
-
export const BorrowedAccountSchema = z.object({
|
|
54
|
-
id: z.string().describe("Its id here: what a turn names, and what Stop borrowing takes."),
|
|
55
|
-
card: z.string().describe("The link card it is borrowed through."),
|
|
56
|
-
provider: z.string(),
|
|
57
|
-
remote: z.string().optional().describe("Its id on the source; absent for a translator provider, borrowed whole."),
|
|
58
|
-
label: z.string(),
|
|
59
|
-
email: z.string().optional(),
|
|
60
|
-
organization: z.string().optional(),
|
|
61
|
-
from: BorrowedFromSchema,
|
|
62
|
-
borrowedAt: z.number(),
|
|
63
|
-
});
|
|
64
|
-
export const BorrowedAccountsSchema = z.object({ accounts: z.array(BorrowedAccountSchema) });
|
|
65
|
-
export const BorrowedAccountIdSchema = z.object({ id: z.string().min(1) });
|
|
66
|
-
export const BORROWED_ID_PREFIX = "lent-";
|
|
67
|
-
export const isBorrowedId = (id) => id.startsWith(BORROWED_ID_PREFIX);
|
|
68
|
-
//# sourceMappingURL=account-sharing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account-sharing.js","sourceRoot":"","sources":["../../../src/schemas/providers/account-sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAazD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAM9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAmB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M,EAAE;CACzB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC;AAG7F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAG3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAC1C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAU,EAAW,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { procedure } from "../protocol/route-meta.js";
|
|
2
|
-
import {
|
|
3
|
-
AccountsBorrowedSchema,
|
|
4
|
-
AccountsBorrowSchema,
|
|
5
|
-
BorrowedAccountIdSchema,
|
|
6
|
-
BorrowedAccountsSchema,
|
|
7
|
-
ShareableAccountsSchema,
|
|
8
|
-
} from "../schemas/providers/account-sharing.js";
|
|
9
|
-
import { OkSchema } from "../schemas/shared.js";
|
|
10
|
-
|
|
11
|
-
// Model accounts shared between the owner's sandboxes (schemas/providers/account-sharing.ts). The owner's editor, signed
|
|
12
|
-
// in to both, reads what the source can share here, mints an accounts link there, and asks the target to bring the
|
|
13
|
-
// accounts in over it. Each of these puts a stored credential in motion: the operating tier's, and no token's.
|
|
14
|
-
const sharingRoute = procedure.meta({ floor: "maintainer", control: "never", panel: false });
|
|
15
|
-
|
|
16
|
-
export const sharingContract = {
|
|
17
|
-
shareable: sharingRoute
|
|
18
|
-
.route({
|
|
19
|
-
method: "GET",
|
|
20
|
-
path: "/sharing/accounts",
|
|
21
|
-
summary: "What this sandbox can share with another of yours",
|
|
22
|
-
description:
|
|
23
|
-
"Every model account held here and how it would reach another of the owner's sandboxes: copied (a key that does not rotate), lent turn by turn (a sign-in whose renewal must stay here), or not at all, with why. No credential is in the answer.",
|
|
24
|
-
})
|
|
25
|
-
.output(ShareableAccountsSchema),
|
|
26
|
-
borrow: sharingRoute
|
|
27
|
-
.route({
|
|
28
|
-
method: "POST",
|
|
29
|
-
path: "/sharing/borrow",
|
|
30
|
-
summary: "Bring accounts in from another of your sandboxes",
|
|
31
|
-
description:
|
|
32
|
-
"Over the accounts link saved as `card`, copies each named static key into this sandbox's own stores and files each lent sign-in as borrowed. Each account answers on its own, so one that fails leaves the others in.",
|
|
33
|
-
})
|
|
34
|
-
.input(AccountsBorrowSchema)
|
|
35
|
-
.output(AccountsBorrowedSchema),
|
|
36
|
-
borrowed: sharingRoute
|
|
37
|
-
.route({
|
|
38
|
-
method: "GET",
|
|
39
|
-
path: "/sharing/borrowed",
|
|
40
|
-
summary: "Accounts this sandbox borrows",
|
|
41
|
-
description: "Each account another of the owner's sandboxes lends here, and which link it is borrowed through. No credential is in the answer.",
|
|
42
|
-
})
|
|
43
|
-
.output(BorrowedAccountsSchema),
|
|
44
|
-
stop: sharingRoute
|
|
45
|
-
.route({
|
|
46
|
-
method: "POST",
|
|
47
|
-
path: "/sharing/borrowed/stop",
|
|
48
|
-
summary: "Stop borrowing an account",
|
|
49
|
-
description:
|
|
50
|
-
"Forgets one borrowed account here: no turn asks the source for it again. The source's own link is changed separately, by the owner's editor or on the source.",
|
|
51
|
-
})
|
|
52
|
-
.input(BorrowedAccountIdSchema)
|
|
53
|
-
.output(OkSchema),
|
|
54
|
-
};
|