@intentic/sandbox-contract 1.429.0 → 1.430.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 (192) hide show
  1. package/dist/contracts/accounts.contract.d.ts +7 -0
  2. package/dist/contracts/accounts.contract.d.ts.map +1 -1
  3. package/dist/contracts/agent.contract.d.ts +24 -0
  4. package/dist/contracts/agent.contract.d.ts.map +1 -1
  5. package/dist/contracts/agents.contract.d.ts +84 -0
  6. package/dist/contracts/agents.contract.d.ts.map +1 -1
  7. package/dist/contracts/bookmarks.contract.d.ts +101 -0
  8. package/dist/contracts/bookmarks.contract.d.ts.map +1 -0
  9. package/dist/contracts/bookmarks.contract.js +51 -0
  10. package/dist/contracts/bookmarks.contract.js.map +1 -0
  11. package/dist/contracts/browser.contract.d.ts +176 -0
  12. package/dist/contracts/browser.contract.d.ts.map +1 -0
  13. package/dist/contracts/browser.contract.js +150 -0
  14. package/dist/contracts/browser.contract.js.map +1 -0
  15. package/dist/contracts/capabilities.contract.d.ts +36 -0
  16. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  17. package/dist/contracts/device.contract.d.ts +60 -0
  18. package/dist/contracts/device.contract.d.ts.map +1 -1
  19. package/dist/contracts/device.contract.js +4 -0
  20. package/dist/contracts/device.contract.js.map +1 -1
  21. package/dist/contracts/remote.contract.d.ts +120 -0
  22. package/dist/contracts/remote.contract.d.ts.map +1 -0
  23. package/dist/contracts/remote.contract.js +80 -0
  24. package/dist/contracts/remote.contract.js.map +1 -0
  25. package/dist/contracts/runner.contract.d.ts +14 -14
  26. package/dist/contracts/seal.contract.d.ts +20 -0
  27. package/dist/contracts/seal.contract.d.ts.map +1 -1
  28. package/dist/contracts/settings.contract.d.ts +26 -0
  29. package/dist/contracts/settings.contract.d.ts.map +1 -1
  30. package/dist/contracts/system.contract.d.ts +150 -0
  31. package/dist/contracts/system.contract.d.ts.map +1 -1
  32. package/dist/contracts/system.contract.js +57 -1
  33. package/dist/contracts/system.contract.js.map +1 -1
  34. package/dist/contracts/translator.contract.d.ts +7 -0
  35. package/dist/contracts/translator.contract.d.ts.map +1 -1
  36. package/dist/events/failure-rows.d.ts +2 -2
  37. package/dist/events/failure-rows.d.ts.map +1 -1
  38. package/dist/events/failure-rows.js +13 -13
  39. package/dist/events/failure-rows.js.map +1 -1
  40. package/dist/events/resume.d.ts.map +1 -1
  41. package/dist/events/resume.js +12 -12
  42. package/dist/events/resume.js.map +1 -1
  43. package/dist/events/sandbox-notice.d.ts.map +1 -1
  44. package/dist/events/sandbox-notice.js.map +1 -1
  45. package/dist/events/system-events.d.ts +16 -0
  46. package/dist/events/system-events.d.ts.map +1 -1
  47. package/dist/index.d.ts +10 -4
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +10 -4
  50. package/dist/index.js.map +1 -1
  51. package/dist/netd/browser-wire.d.ts +50 -1
  52. package/dist/netd/browser-wire.d.ts.map +1 -1
  53. package/dist/netd/browser-wire.js +22 -0
  54. package/dist/netd/browser-wire.js.map +1 -1
  55. package/dist/netd/generated/browser-wire.d.ts +135 -0
  56. package/dist/netd/generated/browser-wire.d.ts.map +1 -1
  57. package/dist/netd/generated/wire.d.ts +14 -0
  58. package/dist/netd/generated/wire.d.ts.map +1 -1
  59. package/dist/protocol/raw/raw-json-routes.d.ts +6 -0
  60. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  61. package/dist/protocol/raw/raw-json-routes.js +1 -0
  62. package/dist/protocol/raw/raw-json-routes.js.map +1 -1
  63. package/dist/protocol/raw/raw-routes.d.ts +18 -0
  64. package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
  65. package/dist/protocol/raw/raw-routes.js +4 -0
  66. package/dist/protocol/raw/raw-routes.js.map +1 -1
  67. package/dist/schemas/agent.d.ts +16 -0
  68. package/dist/schemas/agent.d.ts.map +1 -1
  69. package/dist/schemas/agent.js +3 -4
  70. package/dist/schemas/agent.js.map +1 -1
  71. package/dist/schemas/agents-list.d.ts +8 -0
  72. package/dist/schemas/agents-list.d.ts.map +1 -1
  73. package/dist/schemas/agents.d.ts +12 -0
  74. package/dist/schemas/agents.d.ts.map +1 -1
  75. package/dist/schemas/bookmarks.d.ts +85 -0
  76. package/dist/schemas/bookmarks.d.ts.map +1 -0
  77. package/dist/schemas/bookmarks.js +56 -0
  78. package/dist/schemas/bookmarks.js.map +1 -0
  79. package/dist/schemas/browser-tools.d.ts +167 -0
  80. package/dist/schemas/browser-tools.d.ts.map +1 -0
  81. package/dist/schemas/browser-tools.js +121 -0
  82. package/dist/schemas/browser-tools.js.map +1 -0
  83. package/dist/schemas/browsing.d.ts +139 -0
  84. package/dist/schemas/browsing.d.ts.map +1 -0
  85. package/dist/schemas/browsing.js +83 -0
  86. package/dist/schemas/browsing.js.map +1 -0
  87. package/dist/schemas/capabilities.d.ts +36 -0
  88. package/dist/schemas/capabilities.d.ts.map +1 -1
  89. package/dist/schemas/capabilities.js +3 -0
  90. package/dist/schemas/capabilities.js.map +1 -1
  91. package/dist/schemas/context-trim.js +3 -3
  92. package/dist/schemas/context-trim.js.map +1 -1
  93. package/dist/schemas/device-remote.d.ts +84 -0
  94. package/dist/schemas/device-remote.d.ts.map +1 -0
  95. package/dist/schemas/device-remote.js +54 -0
  96. package/dist/schemas/device-remote.js.map +1 -0
  97. package/dist/schemas/hosts.d.ts +6 -0
  98. package/dist/schemas/hosts.d.ts.map +1 -1
  99. package/dist/schemas/hosts.js +6 -0
  100. package/dist/schemas/hosts.js.map +1 -1
  101. package/dist/schemas/keep-warm.d.ts.map +1 -1
  102. package/dist/schemas/keep-warm.js +2 -3
  103. package/dist/schemas/keep-warm.js.map +1 -1
  104. package/dist/schemas/providers/handoff.d.ts.map +1 -1
  105. package/dist/schemas/providers/handoff.js +11 -11
  106. package/dist/schemas/providers/handoff.js.map +1 -1
  107. package/dist/schemas/providers/provider-oauth.d.ts +14 -0
  108. package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
  109. package/dist/schemas/providers/provider-oauth.js +6 -2
  110. package/dist/schemas/providers/provider-oauth.js.map +1 -1
  111. package/dist/schemas/providers/switched.js +1 -1
  112. package/dist/schemas/providers/switched.js.map +1 -1
  113. package/dist/schemas/queued-trial-retry.d.ts +7 -0
  114. package/dist/schemas/queued-trial-retry.d.ts.map +1 -0
  115. package/dist/schemas/queued-trial-retry.js +8 -0
  116. package/dist/schemas/queued-trial-retry.js.map +1 -0
  117. package/dist/schemas/remote-access.d.ts +137 -0
  118. package/dist/schemas/remote-access.d.ts.map +1 -0
  119. package/dist/schemas/remote-access.js +71 -0
  120. package/dist/schemas/remote-access.js.map +1 -0
  121. package/dist/schemas/seal.d.ts +1 -1
  122. package/dist/schemas/seal.d.ts.map +1 -1
  123. package/dist/schemas/seal.js +1 -1
  124. package/dist/schemas/seal.js.map +1 -1
  125. package/dist/schemas/settings.d.ts +26 -0
  126. package/dist/schemas/settings.d.ts.map +1 -1
  127. package/dist/schemas/settings.js +5 -0
  128. package/dist/schemas/settings.js.map +1 -1
  129. package/dist/schemas/terminal.d.ts +136 -0
  130. package/dist/schemas/terminal.d.ts.map +1 -1
  131. package/dist/schemas/terminal.js +41 -1
  132. package/dist/schemas/terminal.js.map +1 -1
  133. package/dist/state/auth-state.d.ts.map +1 -1
  134. package/dist/state/auth-state.js +1 -0
  135. package/dist/state/auth-state.js.map +1 -1
  136. package/dist/state/definition.d.ts +52 -0
  137. package/dist/state/definition.d.ts.map +1 -1
  138. package/dist/state/runtime-state.d.ts +3 -0
  139. package/dist/state/runtime-state.d.ts.map +1 -1
  140. package/dist/state/runtime-state.js +1 -0
  141. package/dist/state/runtime-state.js.map +1 -1
  142. package/dist/text/land-rows.d.ts.map +1 -1
  143. package/dist/text/land-rows.js +13 -17
  144. package/dist/text/land-rows.js.map +1 -1
  145. package/dist/text/notice-rows.js +6 -6
  146. package/dist/text/notice-rows.js.map +1 -1
  147. package/package.json +5 -5
  148. package/src/contracts/bookmarks.contract.ts +66 -0
  149. package/src/contracts/browser.contract.ts +181 -0
  150. package/src/contracts/device.contract.ts +15 -0
  151. package/src/contracts/remote.contract.ts +104 -0
  152. package/src/contracts/system.contract.ts +78 -0
  153. package/src/events/failure-rows.ts +13 -14
  154. package/src/events/resume.test.ts +3 -3
  155. package/src/events/resume.ts +12 -18
  156. package/src/events/sandbox-notice.ts +2 -0
  157. package/src/index.ts +15 -6
  158. package/src/netd/browser-wire.ts +84 -0
  159. package/src/netd/generated/browser-wire.json +894 -0
  160. package/src/netd/generated/browser-wire.ts +62 -3
  161. package/src/netd/generated/netd-wire.json +75 -0
  162. package/src/netd/generated/wire.ts +11 -2
  163. package/src/netd/wire-manifests.test.ts +76 -1
  164. package/src/protocol/ingress-contract.fixture.json +4 -0
  165. package/src/protocol/raw/raw-json-routes.ts +3 -0
  166. package/src/protocol/raw/raw-routes.ts +11 -0
  167. package/src/schemas/agent.ts +3 -4
  168. package/src/schemas/bookmarks.ts +79 -0
  169. package/src/schemas/browser-tools.ts +164 -0
  170. package/src/schemas/browsing.ts +129 -0
  171. package/src/schemas/capabilities.ts +9 -0
  172. package/src/schemas/context-trim.test.ts +6 -6
  173. package/src/schemas/context-trim.ts +3 -3
  174. package/src/schemas/device-remote.ts +106 -0
  175. package/src/schemas/hosts.ts +13 -0
  176. package/src/schemas/keep-warm.test.ts +1 -1
  177. package/src/schemas/keep-warm.ts +2 -3
  178. package/src/schemas/providers/handoff.test.ts +8 -10
  179. package/src/schemas/providers/handoff.ts +11 -12
  180. package/src/schemas/providers/provider-oauth.ts +10 -2
  181. package/src/schemas/providers/switched.test.ts +6 -6
  182. package/src/schemas/providers/switched.ts +1 -1
  183. package/src/schemas/queued-trial-retry.ts +14 -0
  184. package/src/schemas/remote-access.ts +140 -0
  185. package/src/schemas/seal.ts +2 -1
  186. package/src/schemas/settings.ts +9 -0
  187. package/src/schemas/terminal.ts +59 -1
  188. package/src/state/auth-state.ts +3 -0
  189. package/src/state/runtime-state.ts +4 -0
  190. package/src/text/land-rows.ts +13 -18
  191. package/src/text/notice-rows.ts +6 -6
  192. package/src/text/transcript-fold.test.ts +37 -37
@@ -27,8 +27,8 @@ const failedRow = (event: ErrorFrame): FailureRow => ({
27
27
  const undeliveredRow = (said: FailureSaid, unattended: boolean): FailureRow => ({
28
28
  role: "notice",
29
29
  text: unattended
30
- ? `${said.message} Nothing ran, and nothing is held: this run started on its own, so there is no message waiting to be sent again.`
31
- : `${said.message} Your message was not delivered: it is held for you to send again.`,
30
+ ? `${said.message} Nothing ran; this run started on its own.`
31
+ : `${said.message} Not delivered: held for you to send again.`,
32
32
  noticeCode: noticeCode({ code: "undelivered", params: { ...said, unattended: unattended || undefined } }),
33
33
  });
34
34
 
@@ -40,8 +40,8 @@ const stoppedPartwayRow = (said: FailureSaid, switchModel: boolean): FailureRow
40
40
  const row: FailureRow = {
41
41
  role: "notice",
42
42
  text: switchModel
43
- ? `${said.message} The run stopped partway. The changes it made so far are kept: continue with another model to pick up from here.`
44
- : `${said.message} The run stopped partway. The changes it made so far are kept: send a message to pick up from here.`,
43
+ ? `${said.message} Stopped partway, changes kept: continue with another model.`
44
+ : `${said.message} Stopped partway, changes kept: send a message to go on.`,
45
45
  noticeCode: noticeCode({ code: "stoppedPartway", params: { ...said, switchModel: switchModel || undefined } }),
46
46
  };
47
47
  if (switchModel) {
@@ -65,8 +65,8 @@ const heldRow = (event: ErrorFrame): FailureRow => {
65
65
  return {
66
66
  role: "notice",
67
67
  text: memory
68
- ? `${event.message} Nothing has run yet: the message above is kept here, and sending it anyway starts it.`
69
- : `${event.message} Nothing has run yet: the message above is kept here to send again once that is sorted.`,
68
+ ? `${event.message} Nothing ran; send the message above anyway to start it.`
69
+ : `${event.message} Nothing ran; the message above is kept to send again.`,
70
70
  noticeAction: memory ? memoryPress(event) : "sendAgain",
71
71
  sandboxHeld: true,
72
72
  noticeCode: noticeCode({ code: "kept", params: { ...said, memory: memory || undefined } }),
@@ -77,7 +77,7 @@ const heldRow = (event: ErrorFrame): FailureRow => {
77
77
  }
78
78
  return {
79
79
  role: "notice",
80
- text: `${event.message} Your message is held: send it again to start anyway.`,
80
+ text: `${event.message} Message held: send again to start anyway.`,
81
81
  noticeAction: memoryPress(event),
82
82
  noticeCode: noticeCode({ code: "memoryHeld", params: said }),
83
83
  };
@@ -85,9 +85,8 @@ const heldRow = (event: ErrorFrame): FailureRow => {
85
85
 
86
86
  // What an armed credential renewal promises, and what its row says instead once a later failure in the same run took
87
87
  // that promise back (TranscriptFold.withdrawRenewal).
88
- export const RENEWING = "The credential is being renewed and this turn continues automatically.";
89
- export const RENEWAL_WITHDRAWN =
90
- "The credential was being renewed, but the turn stopped before it could continue: it will not carry on by itself, so press Continue to pick it back up.";
88
+ export const RENEWING = "Renewing the credential; the turn continues by itself.";
89
+ export const RENEWAL_WITHDRAWN = "The renewal didn't resume the turn: press Continue to pick it up.";
91
90
 
92
91
  // What a laddered wall's automatic re-runs are doing, said on the failure's own row so the count stays in the record.
93
92
  const retryClause = (event: ErrorFrame): { text: string; code: NoticeCode } | undefined => {
@@ -98,13 +97,13 @@ const retryClause = (event: ErrorFrame): { text: string; code: NoticeCode } | un
98
97
  const said = failureOf(event);
99
98
  if (event.autoResume === "scheduled") {
100
99
  return {
101
- text: `Retrying by itself: attempt ${retries.made + 1} of ${retries.max}.`,
100
+ text: `Retrying: attempt ${retries.made + 1} of ${retries.max}.`,
102
101
  code: noticeCode({ code: "retrying", params: { ...said, attempt: retries.made + 1, of: retries.max } }),
103
102
  };
104
103
  }
105
104
  return retries.made >= retries.max
106
105
  ? {
107
- text: `Retried ${retries.made} of ${retries.max} times by itself; nothing more is sent automatically.`,
106
+ text: `Retried ${retries.made} of ${retries.max} times; no more retries.`,
108
107
  code: noticeCode({ code: "retried", params: { ...said, made: retries.made, of: retries.max } }),
109
108
  }
110
109
  : undefined;
@@ -121,7 +120,7 @@ export const errorRow = (event: ErrorFrame, ran: boolean): FailureRow => {
121
120
  return retry === undefined
122
121
  ? {
123
122
  role: "notice",
124
- text: `${message} Nothing is retrying it, so the turn is waiting here.`,
123
+ text: `${message} Not retrying; the turn waits here.`,
125
124
  noticeCode: noticeCode({ code: "outageWaiting", params: said }),
126
125
  }
127
126
  : { role: "notice", text: `${message} ${retry.text}`, noticeCode: retry.code };
@@ -136,7 +135,7 @@ export const errorRow = (event: ErrorFrame, ran: boolean): FailureRow => {
136
135
  }
137
136
  : {
138
137
  role: "notice",
139
- text: `${message} Reconnect the account to pick this conversation back up.`,
138
+ text: `${message} Reconnect the account to continue.`,
140
139
  noticeCode: noticeCode({ code: "reconnect", params: said }),
141
140
  };
142
141
  }
@@ -60,7 +60,7 @@ test("a prompt that is not a resume discloses nothing", () => {
60
60
  test("a re-run after the window overflowed discloses as its own notice", () => {
61
61
  expect(resumeDisclosure(withResumeNote("ship the parser", RESUME_NOTES.overflow))).toEqual({
62
62
  kind: "notice",
63
- text: "Sent again in a fresh session after the last one outgrew the model's context window.",
63
+ text: "Sent again in a fresh session: the last outgrew the context window.",
64
64
  reason: "overflow",
65
65
  });
66
66
  });
@@ -70,7 +70,7 @@ test("a re-run's notice row names its reason beside its words", () => {
70
70
  const disclosure = resumeDisclosure(withResumeNote("ship the parser", RESUME_NOTES.restart));
71
71
  expect(disclosure?.kind === "notice" ? resumeNoticeRow(disclosure) : undefined).toEqual({
72
72
  role: "notice",
73
- text: "The sandbox came back; background commands and dev servers this turn started have ended; this turn picked up where it left off.",
73
+ text: "Sandbox back; picked up where it left off. Its background jobs ended.",
74
74
  noticeCode: { code: "resumed", params: { reason: "restart" } },
75
75
  });
76
76
  });
@@ -119,7 +119,7 @@ test("a turn re-run after a memory kill is told why, what it lost, and not to re
119
119
  expect(prompt).toContain(found);
120
120
  expect(withoutResumeNote(prompt)).toBe("ship the parser");
121
121
  const disclosure = resumeDisclosure(prompt);
122
- expect(disclosure).toEqual({ kind: "notice", text: expect.stringContaining("ran out of memory"), reason: "memory" });
122
+ expect(disclosure).toEqual({ kind: "notice", text: "Sent again once memory freed up; its background jobs ended.", reason: "memory" });
123
123
  // Filed under its own reason, which this build's notice vocabulary reads back, so a reader words it as a memory kill
124
124
  // rather than as a turn that stopped short.
125
125
  const row = disclosure?.kind === "notice" ? resumeNoticeRow(disclosure) : undefined;
@@ -98,30 +98,24 @@ export type ResumeDisclosure =
98
98
  const notice = (reason: ResumeNoticeReason, text: string): ResumeDisclosure => ({ kind: "notice", text, reason });
99
99
 
100
100
  const RESUME_DISCLOSURES: Record<ResumeReason, ResumeDisclosure> = {
101
- auth: notice("auth", "Claude sign-in renewed, this turn picked up where it left off."),
102
- outage: notice("outage", "The model provider came back, this turn picked up where it left off."),
101
+ auth: notice("auth", "Sign-in renewed; picked up where it left off."),
102
+ outage: notice("outage", "The provider came back; picked up where it left off."),
103
103
  // Says what a restart costs a turn, since the turn re-runs as if nothing changed and finds its servers gone.
104
- restart: notice(
105
- "restart",
106
- "The sandbox came back; background commands and dev servers this turn started have ended; this turn picked up where it left off.",
107
- ),
108
- stopped: notice("stopped", "Sent again after the turn stopped short, picking up where it left off."),
104
+ restart: notice("restart", "Sandbox back; picked up where it left off. Its background jobs ended."),
105
+ stopped: notice("stopped", "Sent again after the turn stopped short."),
109
106
  // Said as the owner would say it, as `restart` is: what ran out, that it came back by itself once there was room, and
110
107
  // what it lost on the way, in the words a person uses for what a turn leaves running.
111
- memory: notice(
112
- "memory",
113
- "Sent again once memory freed up, after the sandbox ran out of memory and stopped this turn; background commands and dev servers it started have ended.",
114
- ),
108
+ memory: notice("memory", "Sent again once memory freed up; its background jobs ended."),
115
109
  // None of these four auto-resumed, a person pressed Continue; `switched`/`carried` name the differing account.
116
- limit: notice("limit", "Sent again after the allowance ran out mid-turn, picking up where it left off."),
117
- switched: notice("switched", "Sent again on the switched account after the allowance ran out mid-turn, in a fresh session."),
118
- carried: notice("carried", "Sent again on the switched account after the allowance ran out mid-turn, carrying the session with it."),
119
- trimmed: notice("trimmed", "Sent again after the allowance ran out, in a copy of the session with older tool output cleared."),
120
- summarized: notice("summarized", "Sent again after the allowance ran out, in a fresh session opened with a summary of the conversation."),
110
+ limit: notice("limit", "Sent again after the allowance ran out mid-turn."),
111
+ switched: notice("switched", "Sent again on the switched account, in a fresh session."),
112
+ carried: notice("carried", "Sent again on the switched account, same session."),
113
+ trimmed: notice("trimmed", "Sent again after the allowance ran out, old tool output cleared."),
114
+ summarized: notice("summarized", "Sent again after the allowance ran out, from a summary."),
121
115
  refused: notice("refused", "Sent again after the allowance refused it: nothing had run."),
122
116
  door: notice("door", "Sent again: the first attempt was turned away before anything ran."),
123
- overflow: notice("overflow", "Sent again in a fresh session after the last one outgrew the model's context window."),
124
- flagged: notice("flagged", "Sent again after the model's safeguards stopped it, without the stopped response."),
117
+ overflow: notice("overflow", "Sent again in a fresh session: the last outgrew the context window."),
118
+ flagged: notice("flagged", "Sent again without the response the safeguards stopped."),
125
119
  continued: notice("continued", "Carried on from where the last turn stopped."),
126
120
  answered: { kind: "note", note: { title: "Picked back up after a sandbox restart", text: RESUME_NOTES.answered } },
127
121
  };
@@ -10,6 +10,8 @@ export type WorktreeSyncCause = z.infer<typeof WorktreeSyncCauseSchema>;
10
10
  // The sandbox's own notice rows (a land, a hold, a renewal, a stop), as a code and the facts they were worded from. The
11
11
  // row's `text` stays the English sentence, which older apps, stored transcripts and agents reading their own history
12
12
  // go on reading; `noticeCode` beside it is what lets an app say the same thing in the reader's language and words.
13
+ // Every sentence fits one row of a half-width chat, about 80 characters with its facts filled in (2026-11-20: a
14
+ // three-line rebase notice). What it would add beyond that belongs in the agent's prompt or behind a press, not here.
13
15
 
14
16
  // On the wire a code is any string and its facts a flat record: a transcript page carrying a code newer than its reader
15
17
  // still parses, and that reader draws `text`. The codes this build writes, with their facts typed, are
package/src/index.ts CHANGED
@@ -13,6 +13,8 @@ import { areasContract } from "./contracts/areas.contract.js";
13
13
  import { auditContract } from "./contracts/audit.contract.js";
14
14
  import { automationsContract } from "./contracts/automations.contract.js";
15
15
  import { basesContract } from "./contracts/bases.contract.js";
16
+ import { bookmarksContract } from "./contracts/bookmarks.contract.js";
17
+ import { browserContract } from "./contracts/browser.contract.js";
16
18
  import { capabilitiesContract } from "./contracts/capabilities.contract.js";
17
19
  import { choresContract } from "./contracts/chores.contract.js";
18
20
  import { ciContract } from "./contracts/ci.contract.js";
@@ -33,19 +35,20 @@ import { offloadContract } from "./contracts/offload.contract.js";
33
35
  import { orgContract } from "./contracts/org.contract.js";
34
36
  import { pagesContract } from "./contracts/pages.contract.js";
35
37
  import { panelsContract } from "./contracts/panels.contract.js";
36
- import { rolesContract } from "./contracts/roles.contract.js";
37
38
  import { portsContract } from "./contracts/ports.contract.js";
38
39
  import { privacyContract } from "./contracts/privacy.contract.js";
39
40
  import { providersContract } from "./contracts/providers.contract.js";
40
41
  import { publicContract } from "./contracts/public.contract.js";
41
42
  import { pushContract } from "./contracts/push.contract.js";
43
+ import { remoteContract } from "./contracts/remote.contract.js";
44
+ import { rolesContract } from "./contracts/roles.contract.js";
42
45
  import { runsContract } from "./contracts/runs.contract.js";
43
46
  import { safetyContract } from "./contracts/safety.contract.js";
47
+ import { sealContract } from "./contracts/seal.contract.js";
44
48
  import { secretsContract } from "./contracts/secrets.contract.js";
45
49
  import { servicesContract } from "./contracts/services.contract.js";
46
50
  import { sessionsContract } from "./contracts/sessions.contract.js";
47
51
  import { settingsContract } from "./contracts/settings.contract.js";
48
- import { sealContract } from "./contracts/seal.contract.js";
49
52
  import { shareContract } from "./contracts/share.contract.js";
50
53
  import { skillsContract } from "./contracts/skills.contract.js";
51
54
  import { systemContract } from "./contracts/system.contract.js";
@@ -71,6 +74,8 @@ export const sandboxContract: {
71
74
  audit: typeof auditContract;
72
75
  automations: typeof automationsContract;
73
76
  bases: typeof basesContract;
77
+ bookmarks: typeof bookmarksContract;
78
+ browser: typeof browserContract;
74
79
  capabilities: typeof capabilitiesContract;
75
80
  chores: typeof choresContract;
76
81
  ci: typeof ciContract;
@@ -91,19 +96,20 @@ export const sandboxContract: {
91
96
  org: typeof orgContract;
92
97
  pages: typeof pagesContract;
93
98
  panels: typeof panelsContract;
94
- roles: typeof rolesContract;
95
99
  ports: typeof portsContract;
96
100
  privacy: typeof privacyContract;
97
101
  providers: typeof providersContract;
98
102
  public: typeof publicContract;
99
103
  push: typeof pushContract;
104
+ remote: typeof remoteContract;
105
+ roles: typeof rolesContract;
100
106
  runs: typeof runsContract;
101
107
  safety: typeof safetyContract;
108
+ seal: typeof sealContract;
102
109
  secrets: typeof secretsContract;
103
110
  services: typeof servicesContract;
104
111
  sessions: typeof sessionsContract;
105
112
  settings: typeof settingsContract;
106
- seal: typeof sealContract;
107
113
  share: typeof shareContract;
108
114
  skills: typeof skillsContract;
109
115
  system: typeof systemContract;
@@ -123,6 +129,8 @@ export const sandboxContract: {
123
129
  audit: auditContract,
124
130
  automations: automationsContract,
125
131
  bases: basesContract,
132
+ bookmarks: bookmarksContract,
133
+ browser: browserContract,
126
134
  capabilities: capabilitiesContract,
127
135
  chores: choresContract,
128
136
  ci: ciContract,
@@ -143,19 +151,20 @@ export const sandboxContract: {
143
151
  org: orgContract,
144
152
  pages: pagesContract,
145
153
  panels: panelsContract,
146
- roles: rolesContract,
147
154
  ports: portsContract,
148
155
  privacy: privacyContract,
149
156
  providers: providersContract,
150
157
  public: publicContract,
151
158
  push: pushContract,
159
+ remote: remoteContract,
160
+ roles: rolesContract,
152
161
  runs: runsContract,
153
162
  safety: safetyContract,
163
+ seal: sealContract,
154
164
  secrets: secretsContract,
155
165
  services: servicesContract,
156
166
  sessions: sessionsContract,
157
167
  settings: settingsContract,
158
- seal: sealContract,
159
168
  share: shareContract,
160
169
  skills: skillsContract,
161
170
  system: systemContract,
@@ -4,10 +4,16 @@
4
4
  // which contract.lock.json pins.
5
5
 
6
6
  export type {
7
+ BrowserMediaClientMessage,
8
+ BrowserMediaServerMessage,
7
9
  BrowserViewClientMessage,
8
10
  BrowserViewServerMessage,
11
+ ClipboardContent,
9
12
  EdgeVerdict,
10
13
  EmulatedDevice,
14
+ KeyAction,
15
+ MediaAudio,
16
+ MediaCursor,
11
17
  PictureKind,
12
18
  PointerAction,
13
19
  SelectMenu,
@@ -45,3 +51,81 @@ export const BROWSER_FRAME_TAGS = {
45
51
  h264KeyQuiet: 5,
46
52
  h264DeltaQuiet: 6,
47
53
  } as const;
54
+
55
+ // Where a browser media socket opens on a sandbox's address, with the browser session's name after it
56
+ // (`${BROWSER_MEDIA_PATH}/<session>`): the window's picture, sound, pointer, keys and clipboard, answered by that window's
57
+ // castd through netd rather than by Node. The browser view socket names it, with a token, in its `media` message.
58
+ export const BROWSER_MEDIA_PATH = "/system/browser-media";
59
+
60
+ // Where each window's castd listens inside the container, `<dir>/<session>.sock`: what netd relays the media socket's
61
+ // upgrade to, and where the daemon keeps the key castd checks tokens with.
62
+ export const BROWSER_MEDIA_SOCKET_DIR = "/run/intentic/cast";
63
+
64
+ // The header every binary message on a media socket starts with (browser-wire's MEDIA_HEADER_LEN): kind, flags, the
65
+ // frame's id, its capture time in ms since `hello`, the stripe's top row, index and count, then reserved bytes.
66
+ export const MEDIA_HEADER_LEN = 16;
67
+
68
+ // Byte 0 of that header: what the payload is, one H.264 access unit, one Opus packet, or `lossless`, an exact copy of a
69
+ // rectangle of the picture (the rectangle, then its pixels as B, G, R and one unused byte each, row after row), drawn
70
+ // once every video frame up to the header's id has been.
71
+ export const MEDIA_KINDS = { video: 1, audio: 2, lossless: 3 } as const;
72
+
73
+ // Bits of byte 1: `key`, an IDR a decoder can start on; `refine`, castd sharpening content that has gone still; `clip`,
74
+ // the payload starts with the rectangle the decoded picture is drawn in, the rest of the viewer's picture being exact
75
+ // already (an empty one: decode, draw nothing).
76
+ export const MEDIA_FLAGS = { key: 1, refine: 2, clip: 4 } as const;
77
+
78
+ // The rectangle a `clip`ped video message's payload and a `lossless` message's start with: x, y, width and height in
79
+ // picture pixels, u16 big-endian each.
80
+ export const MEDIA_CLIP_LEN = 8;
81
+
82
+ // The query parameter (`lossless=1`) a viewer adds to the media socket's upgrade to say it draws `clip`ped frames and
83
+ // `lossless` rectangles; castd sends either only to a viewer that asked and reaches it on this computer's loopback.
84
+ export const MEDIA_LOSSLESS_QUERY = "lossless";
85
+
86
+ // The DataChannels a viewer opens on a peer connection straight to castd (browser-wire's RTC_CHANNELS), each with the
87
+ // reliability it must be opened with: `media` (castd's JSON and video, in order, every one), `audio` (Opus packets, none
88
+ // retransmitted, in any order), `input` (everything the viewer would send on the socket, in order, every one) and
89
+ // `pointer` (where the pointer is, none retransmitted, in any order: only the newest counts). The Rust constant's
90
+ // comment holds the reasons.
91
+ export const RTC_CHANNELS = {
92
+ media: { ordered: true, maxRetransmits: null },
93
+ audio: { ordered: false, maxRetransmits: 0 },
94
+ input: { ordered: true, maxRetransmits: null },
95
+ pointer: { ordered: false, maxRetransmits: 0 },
96
+ } as const;
97
+
98
+ export type RtcChannelLabel = keyof typeof RTC_CHANNELS;
99
+
100
+ // The largest DataChannel message castd sends; a longer video message arrives as chunks of the same header with byte 14
101
+ // the chunk's index and byte 15 the count, joined in order before decoding.
102
+ export const RTC_MESSAGE_MAX = 32 * 1024;
103
+
104
+ // How long past its newest token's expiry castd keeps a media socket open, in seconds: the viewer sends each fresh token
105
+ // the browser view socket hands it on the open socket (`{type: "token"}`), which moves the bound on.
106
+ export const MEDIA_TOKEN_GRACE_SECONDS = 600;
107
+
108
+ // The codes castd closes an open media socket with, each meaning the held token is dead: ask the browser view socket
109
+ // for a fresh `media` before dialling again. `dropped`: the daemon dropped the window's viewers (access revoked, a
110
+ // desktop's control handed back), and castd refuses every token minted before it. `expired`: the socket's newest token
111
+ // expired more than MEDIA_TOKEN_GRACE_SECONDS ago.
112
+ export const MEDIA_CLOSE_CODES = { dropped: 4001, expired: 4002 } as const;
113
+
114
+ // A person's remote screen and terminals on a connected computer (2026-11-20), on the sandbox's address with the device
115
+ // and the session after the path (`${DEVICE_MEDIA_PATH}/<device>/<session>?token=…`, both `[A-Za-z0-9_-]{1,64}`). The
116
+ // media socket's and the terminal's own protocols, served by that computer's `intentic-remoted`, which netd reaches down
117
+ // the uplink remoted dials (`DEVICE_UPLINK_PATH`). The daemon's `devices.remote.*` hands out each path with its token.
118
+ export const DEVICE_MEDIA_PATH = "/system/device-media";
119
+ export const DEVICE_TERMINAL_PATH = "/system/device-terminal";
120
+ export const DEVICE_UPLINK_PATH = "/system/device-uplink";
121
+
122
+ // The device an uplink is for, on its upgrade; the token decides, and a header naming another device is refused.
123
+ export const DEVICE_HEADER = "x-intentic-device";
124
+
125
+ // Where netd serves each connected device's remoted to the daemon, `<dir>/<device>.sock`: each connection one stream
126
+ // down that device's uplink, for remoted's control routes.
127
+ export const DEVICE_SOCKET_DIR = "/run/intentic/devices";
128
+
129
+ // The codes netd closes a device's uplink with: `displaced`, a newer uplink of the same device replaced it; `withdrawn`,
130
+ // the daemon withdrew the device's registration.
131
+ export const DEVICE_UPLINK_CLOSE_CODES = { displaced: 4001, withdrawn: 4003 } as const;