@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.
Files changed (82) hide show
  1. package/dist/contracts/accounts.contract.d.ts +0 -16
  2. package/dist/contracts/accounts.contract.d.ts.map +1 -1
  3. package/dist/contracts/capabilities.contract.d.ts +0 -12
  4. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  5. package/dist/contracts/hub.contract.d.ts +121 -0
  6. package/dist/contracts/hub.contract.d.ts.map +1 -0
  7. package/dist/contracts/hub.contract.js +32 -0
  8. package/dist/contracts/hub.contract.js.map +1 -0
  9. package/dist/contracts/secrets.contract.d.ts +1 -73
  10. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  11. package/dist/contracts/secrets.contract.js +4 -20
  12. package/dist/contracts/secrets.contract.js.map +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/protocol/doors/runner-wake.d.ts +46 -0
  18. package/dist/protocol/doors/runner-wake.d.ts.map +1 -0
  19. package/dist/protocol/doors/runner-wake.js +21 -0
  20. package/dist/protocol/doors/runner-wake.js.map +1 -0
  21. package/dist/protocol/raw/raw-json-routes.d.ts +14 -145
  22. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  23. package/dist/protocol/raw/raw-json-routes.js +1 -6
  24. package/dist/protocol/raw/raw-json-routes.js.map +1 -1
  25. package/dist/protocol/raw/raw-routes.d.ts +4 -16
  26. package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
  27. package/dist/protocol/raw/raw-routes.js +1 -4
  28. package/dist/protocol/raw/raw-routes.js.map +1 -1
  29. package/dist/schemas/capabilities.d.ts +0 -8
  30. package/dist/schemas/capabilities.d.ts.map +1 -1
  31. package/dist/schemas/capabilities.js +0 -4
  32. package/dist/schemas/capabilities.js.map +1 -1
  33. package/dist/schemas/connection-hub.d.ts +347 -0
  34. package/dist/schemas/connection-hub.d.ts.map +1 -0
  35. package/dist/schemas/connection-hub.js +118 -0
  36. package/dist/schemas/connection-hub.js.map +1 -0
  37. package/dist/schemas/diagnostics.d.ts +22 -1
  38. package/dist/schemas/diagnostics.d.ts.map +1 -1
  39. package/dist/schemas/diagnostics.js +13 -1
  40. package/dist/schemas/diagnostics.js.map +1 -1
  41. package/dist/schemas/links.d.ts +0 -21
  42. package/dist/schemas/links.d.ts.map +1 -1
  43. package/dist/schemas/links.js +1 -9
  44. package/dist/schemas/links.js.map +1 -1
  45. package/dist/schemas/providers/provider-oauth.d.ts +0 -16
  46. package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
  47. package/dist/schemas/providers/provider-oauth.js +0 -4
  48. package/dist/schemas/providers/provider-oauth.js.map +1 -1
  49. package/dist/schemas/sandbox-passwords.d.ts +0 -142
  50. package/dist/schemas/sandbox-passwords.d.ts.map +1 -1
  51. package/dist/schemas/sandbox-passwords.js +1 -33
  52. package/dist/schemas/sandbox-passwords.js.map +1 -1
  53. package/dist/state/auth-state.d.ts.map +1 -1
  54. package/dist/state/auth-state.js +1 -0
  55. package/dist/state/auth-state.js.map +1 -1
  56. package/dist/state/definition.d.ts +0 -8
  57. package/dist/state/definition.d.ts.map +1 -1
  58. package/package.json +5 -5
  59. package/src/contracts/hub.contract.ts +39 -0
  60. package/src/contracts/secrets.contract.ts +5 -21
  61. package/src/index.ts +3 -3
  62. package/src/protocol/doors/runner-wake.ts +36 -0
  63. package/src/protocol/raw/raw-json-routes.ts +0 -10
  64. package/src/protocol/raw/raw-routes.ts +2 -7
  65. package/src/schemas/capabilities.ts +0 -6
  66. package/src/schemas/connection-hub.test.ts +28 -0
  67. package/src/schemas/connection-hub.ts +191 -0
  68. package/src/schemas/diagnostics.ts +19 -2
  69. package/src/schemas/links.ts +4 -15
  70. package/src/schemas/providers/provider-oauth.ts +0 -6
  71. package/src/schemas/sandbox-passwords.ts +5 -46
  72. package/src/state/auth-state.ts +3 -0
  73. package/dist/contracts/sharing.contract.d.ts +0 -58
  74. package/dist/contracts/sharing.contract.d.ts.map +0 -1
  75. package/dist/contracts/sharing.contract.js +0 -41
  76. package/dist/contracts/sharing.contract.js.map +0 -1
  77. package/dist/schemas/providers/account-sharing.d.ts +0 -277
  78. package/dist/schemas/providers/account-sharing.d.ts.map +0 -1
  79. package/dist/schemas/providers/account-sharing.js +0 -68
  80. package/dist/schemas/providers/account-sharing.js.map +0 -1
  81. package/src/contracts/sharing.contract.ts +0 -54
  82. package/src/schemas/providers/account-sharing.ts +0 -123
@@ -1,123 +0,0 @@
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);