@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
@@ -0,0 +1,164 @@
1
+ import { z } from "zod";
2
+
3
+ // What a browser window does besides showing pages, which a desktop browser draws in its own chrome and the picture of
4
+ // one never shows: its downloads, the file a page asks for, the permission a site asks for, and the tools around a page
5
+ // (print, its source, DevTools). The daemon holds each (browser/downloads, uploads, permissions, devtools); the window's
6
+ // state carries what is pending, and the routes in contracts/browser.contract.ts answer it.
7
+
8
+ export const BrowserDownloadSchema = z.object({
9
+ id: z.string().describe("Stable for the life of the download: what the routes below take."),
10
+ name: z.string().describe("The file's name, as the site suggested it."),
11
+ url: z.string().describe("Where it came from. A printed page is the page's own address."),
12
+ state: z
13
+ .enum(["progress", "done", "canceled", "failed"])
14
+ .describe("Still arriving, finished, stopped by you, or broken off by the browser or the site."),
15
+ receivedBytes: z.number().describe("How much has arrived so far."),
16
+ totalBytes: z.number().optional().describe("How big it is, when the site said. Absent for a size nobody announced."),
17
+ startedAt: z.number().describe("When it started, in milliseconds."),
18
+ finishedAt: z.number().optional().describe("When it finished, failed or was stopped, in milliseconds."),
19
+ });
20
+ export type BrowserDownload = z.infer<typeof BrowserDownloadSchema>;
21
+
22
+ // A page's <input type=file> asking for files. Chromium's own dialog would open on the sandbox's disk, so the daemon
23
+ // holds the ask instead, and the person's own file picker answers it.
24
+ export const BrowserFileChooserSchema = z.object({
25
+ id: z.string().describe("Which ask this is: what the answer names."),
26
+ pageId: z.string().describe("Which page asked."),
27
+ multiple: z.boolean().describe("The page takes several files at once."),
28
+ accept: z
29
+ .array(z.string())
30
+ .optional()
31
+ .describe("What the page says it takes: extensions (.pdf) and media types (image/*), as its accept attribute lists them."),
32
+ });
33
+ export type BrowserFileChooser = z.infer<typeof BrowserFileChooserSchema>;
34
+
35
+ // The permissions a site can ask a person for, the ones this browser answers.
36
+ export const BrowserPermissionSchema = z.enum(["notifications", "geolocation", "camera", "microphone", "clipboard-read"]);
37
+ export type BrowserPermission = z.infer<typeof BrowserPermissionSchema>;
38
+ export const BROWSER_PERMISSIONS = BrowserPermissionSchema.options;
39
+
40
+ // A site's standing answer for one permission: allowed, blocked, or asked each time (nothing decided).
41
+ export const PermissionSettingSchema = z.enum(["allow", "block", "ask"]);
42
+ export type PermissionSetting = z.infer<typeof PermissionSettingSchema>;
43
+
44
+ export const BrowserPermissionAskSchema = z.object({
45
+ id: z.string().describe("Which ask this is: what the answer names."),
46
+ pageId: z.string().describe("Which page asked."),
47
+ origin: z.string().describe("The site asking, as scheme://host[:port]: what a decision is remembered for."),
48
+ permission: BrowserPermissionSchema.describe("What it asks for."),
49
+ // Camera and microphone: there is no device in the sandbox, so the page was told so at once and this only says it.
50
+ unavailable: z
51
+ .literal(true)
52
+ .optional()
53
+ .describe("The sandbox has nothing to give: no camera or microphone. The page was already told no; this says it happened."),
54
+ });
55
+ export type BrowserPermissionAsk = z.infer<typeof BrowserPermissionAskSchema>;
56
+
57
+ const WindowParams = { name: z.string().describe("Which browser window.") };
58
+
59
+ export const DownloadIdParamSchema = z.object({ id: z.string().describe("Which download.") });
60
+
61
+ export const DownloadTicketSchema = z.object({
62
+ ticket: z.string().describe("Opens the download's file once, for a few minutes, at the browser downloads file route."),
63
+ expiresAt: z.number().describe("When the ticket stops working, in milliseconds."),
64
+ });
65
+
66
+ export const SaveDownloadInputSchema = z.object({
67
+ id: z.string().describe("Which download."),
68
+ folder: z
69
+ .string()
70
+ .optional()
71
+ .describe("The workspace folder to save it in, relative to the workspace root. Absent saves into `downloads/`, made if missing."),
72
+ });
73
+ export const SaveDownloadResultSchema = z.object({
74
+ path: z.string().describe("Where it was saved, relative to the workspace root. A name already taken gets a number added."),
75
+ });
76
+
77
+ export const AnswerFileChooserInputSchema = z.object({
78
+ ...WindowParams,
79
+ chooser: z.string().describe("Which ask: the file chooser's id from the window's state."),
80
+ uploads: z
81
+ .array(z.string())
82
+ .optional()
83
+ .describe("The uploads to hand the page, by the ids they were uploaded under. Absent or empty cancels, as closing the picker does."),
84
+ });
85
+
86
+ export const DropFilesInputSchema = z.object({
87
+ ...WindowParams,
88
+ pageId: z.string().describe("The page they were dropped on."),
89
+ x: z.number().describe("Where, in the page's own CSS pixels from its top-left corner."),
90
+ y: z.number().describe("Where, in the page's own CSS pixels from its top-left corner."),
91
+ uploads: z.array(z.string()).min(1).describe("The uploads dropped, by the ids they were uploaded under."),
92
+ });
93
+
94
+ export const GeolocationSchema = z.object({
95
+ latitude: z.number().min(-90).max(90),
96
+ longitude: z.number().min(-180).max(180),
97
+ accuracy: z.number().min(0).describe("How sure, in metres."),
98
+ });
99
+ export type Geolocation = z.infer<typeof GeolocationSchema>;
100
+
101
+ export const AnswerPermissionInputSchema = z.object({
102
+ ...WindowParams,
103
+ ask: z.string().describe("Which ask: its id from the window's state."),
104
+ setting: z.enum(["allow", "block"]).describe("The answer, remembered for the site."),
105
+ location: GeolocationSchema.optional().describe("Your own location, for a site allowed to know it: what the page is then told it is."),
106
+ });
107
+
108
+ export const SiteQuerySchema = z.object({
109
+ ...WindowParams,
110
+ origin: z.string().describe("The site, as scheme://host[:port]."),
111
+ });
112
+
113
+ export const SitePermissionsSchema = z.object({
114
+ origin: z.string().describe("The site."),
115
+ permissions: z
116
+ .array(z.object({ permission: BrowserPermissionSchema, setting: PermissionSettingSchema }))
117
+ .describe("Every permission this browser answers, with the site's standing answer for each."),
118
+ location: z.boolean().describe("Your location is shared with this window, for the sites allowed it."),
119
+ });
120
+ export type SitePermissions = z.infer<typeof SitePermissionsSchema>;
121
+
122
+ export const SetSitePermissionInputSchema = z.object({
123
+ ...WindowParams,
124
+ origin: z.string().describe("The site, as scheme://host[:port]."),
125
+ permission: BrowserPermissionSchema,
126
+ setting: PermissionSettingSchema.describe("Allow, block, or ask again next time."),
127
+ location: GeolocationSchema.optional().describe("Your own location, when allowing a site to know it."),
128
+ });
129
+
130
+ export const BrowserPageToolInputSchema = z.object({
131
+ ...WindowParams,
132
+ pageId: z.string().describe("Which tab."),
133
+ });
134
+
135
+ export const ViewSourceResultSchema = z.object({
136
+ pageId: z.string().optional().describe("The tab the source opened in, once the window lists it."),
137
+ });
138
+
139
+ export const DevToolsResultSchema = z.object({
140
+ path: z
141
+ .string()
142
+ .describe(
143
+ "Where Chromium's own DevTools for the page are served, relative to the sandbox's address: a frame opens it as is. Carries its own ticket, so it works without a header.",
144
+ ),
145
+ socket: z
146
+ .string()
147
+ .describe("The page's DevTools socket, relative to the sandbox's address: what the frontend is told to connect to (its `ws=` or `wss=`)."),
148
+ expiresAt: z.number().describe("When the ticket stops working, in milliseconds."),
149
+ });
150
+
151
+ // A recording of a window's picture under way (browser/media/recordings.ts in the daemon): castd's own H.264 stream
152
+ // rewrapped as an MP4, nothing encoded again, listed with the window's downloads once it stops.
153
+ export const BrowserRecordingSchema = z.object({
154
+ startedAt: z.number().describe("When it started, in milliseconds."),
155
+ maxSeconds: z.number().describe("The longest it runs: it stops by itself then, and is listed with the downloads all the same."),
156
+ });
157
+ export type BrowserRecording = z.infer<typeof BrowserRecordingSchema>;
158
+
159
+ export const BrowserWindowInputSchema = z.object(WindowParams);
160
+
161
+ export const BrowserUploadQuerySchema = z.object({
162
+ id: z.string().regex(/^[A-Za-z0-9_-]{8,64}$/u).describe("An id the uploader picks, the same for every part of one file."),
163
+ name: z.string().min(1).max(255).describe("The file's own name, which the page sees."),
164
+ });
@@ -0,0 +1,129 @@
1
+ // browsing: what the sandbox's browsers remember of where they went (an index per browser profile), and the search
2
+ // engine's suggestions for what is being typed into the address bar. The address bar itself is drawn and ranked in the
3
+ // editor; these are the two things it cannot know on its own.
4
+ import { z } from "zod";
5
+
6
+ // The search engines the address bar can send a query to. Brave is the default: an index of its own, no account.
7
+ export const SEARCH_ENGINES = ["brave", "google", "duckduckgo", "bing", "kagi"] as const;
8
+ export const SearchEngineSchema = z.enum(SEARCH_ENGINES);
9
+ export type SearchEngine = z.infer<typeof SearchEngineSchema>;
10
+ export const DEFAULT_SEARCH_ENGINE: SearchEngine = "brave";
11
+
12
+ // Where each engine takes a query, and how a results page names it: the editor builds the address from `search`, and the
13
+ // sandbox reads a visited results page back into a search term with `host` and `param`.
14
+ export interface SearchEngineInfo {
15
+ readonly name: string;
16
+ // The query, URL-encoded, goes on the end.
17
+ readonly search: string;
18
+ readonly host: string;
19
+ // The query parameter a results page carries the search in.
20
+ readonly param: string;
21
+ }
22
+
23
+ export const SEARCH_ENGINE_INFO = {
24
+ brave: { name: "Brave", search: "https://search.brave.com/search?q=", host: "search.brave.com", param: "q" },
25
+ google: { name: "Google", search: "https://www.google.com/search?q=", host: "www.google.com", param: "q" },
26
+ duckduckgo: { name: "DuckDuckGo", search: "https://duckduckgo.com/?q=", host: "duckduckgo.com", param: "q" },
27
+ bing: { name: "Bing", search: "https://www.bing.com/search?q=", host: "www.bing.com", param: "q" },
28
+ kagi: { name: "Kagi", search: "https://kagi.com/search?q=", host: "kagi.com", param: "q" },
29
+ } as const satisfies Readonly<Record<SearchEngine, SearchEngineInfo>>;
30
+
31
+ // A browser profile's key: `_own` for the person's own window, `web` for the agents' credential-free browser, or a
32
+ // signed-in account's id. One index per profile; the person's own history is `_own`'s alone.
33
+ export const OWN_BROWSING_PROFILE = "_own";
34
+ export const BrowsingProfileSchema = z
35
+ .string()
36
+ .regex(/^[\w.-]{1,80}$/)
37
+ .describe("Which browser's history: `_own` for your own window, `web` for the agents' browser, or a signed-in account's id.");
38
+
39
+ export const BrowsingEntrySchema = z.object({
40
+ url: z.string().describe("The page's address, as the browser committed it."),
41
+ title: z.string().optional().describe("The page's title when last seen. Absent for a page that never gave one."),
42
+ visits: z.number().int().nonnegative().describe("How many times it was visited."),
43
+ typed: z.number().int().nonnegative().describe("How many of those visits were typed into the address bar rather than reached by a link."),
44
+ last: z.number().describe("When it was last visited, in milliseconds."),
45
+ frecency: z
46
+ .number()
47
+ .nonnegative()
48
+ .describe("How much it is worth suggesting: how often and how recently it was visited, typed visits counting more. Only comparable within one answer."),
49
+ });
50
+ export type BrowsingEntry = z.infer<typeof BrowsingEntrySchema>;
51
+
52
+ export const BrowsingTermSchema = z.object({
53
+ term: z.string().describe("What was searched for."),
54
+ count: z.number().int().positive().describe("How many times."),
55
+ last: z.number().describe("When it was last searched for, in milliseconds."),
56
+ });
57
+ export type BrowsingTerm = z.infer<typeof BrowsingTermSchema>;
58
+
59
+ export const BrowsingHistoryQuerySchema = z.object({
60
+ profile: BrowsingProfileSchema,
61
+ since: z
62
+ .string()
63
+ .max(200)
64
+ .optional()
65
+ .describe("The cursor a previous answer gave, to be told only what changed after it. Absent, or one the sandbox no longer recognises, answers the whole index."),
66
+ });
67
+ export type BrowsingHistoryQuery = z.infer<typeof BrowsingHistoryQuerySchema>;
68
+
69
+ export const BrowsingHistorySchema = z.object({
70
+ profile: z.string().describe("Whose history this is."),
71
+ cursor: z.string().describe("Hand this back as `since` to be told only what changes after this answer."),
72
+ full: z.boolean().describe("True when this is the whole index, which replaces whatever the caller held; false when it is only what changed since the cursor given."),
73
+ entries: z
74
+ .array(BrowsingEntrySchema)
75
+ .describe("The pages: on a full answer the most worth suggesting, best first and at most a few thousand; otherwise each page added or changed since the cursor."),
76
+ removed: z.array(z.string()).describe("Addresses forgotten since the cursor. Always empty on a full answer."),
77
+ terms: z.array(BrowsingTermSchema).describe("Searches made, most recent first: every one on a full answer, otherwise those added or changed since the cursor."),
78
+ profiles: z.array(z.string()).describe("Every profile the sandbox holds a history for, so a history page can offer the others."),
79
+ });
80
+ export type BrowsingHistory = z.infer<typeof BrowsingHistorySchema>;
81
+
82
+ // What to forget: some addresses, everything visited in a stretch of time, or all of it. Spelled out rather than inferred
83
+ // from which fields are present, so a call that forgot its arguments cannot clear everything by accident.
84
+ export const BrowsingForgetSchema = z.discriminatedUnion("kind", [
85
+ z.object({
86
+ kind: z.literal("urls"),
87
+ urls: z.array(z.string()).min(1).max(1000).describe("The addresses to forget, exactly as the history lists them."),
88
+ }),
89
+ z.object({
90
+ kind: z.literal("range"),
91
+ from: z.number().describe("The start of the stretch, in milliseconds, included."),
92
+ to: z.number().describe("Its end, in milliseconds, excluded."),
93
+ }),
94
+ z.object({ kind: z.literal("all") }),
95
+ ]);
96
+ export type BrowsingForget = z.infer<typeof BrowsingForgetSchema>;
97
+
98
+ export const BrowsingForgetInputSchema = z.object({
99
+ profile: BrowsingProfileSchema,
100
+ forget: BrowsingForgetSchema.describe("What to forget."),
101
+ });
102
+ export type BrowsingForgetInput = z.infer<typeof BrowsingForgetInputSchema>;
103
+
104
+ export const BrowsingForgetResultSchema = z.object({
105
+ removed: z.number().int().nonnegative().describe("How many addresses left the history entirely."),
106
+ });
107
+ export type BrowsingForgetResult = z.infer<typeof BrowsingForgetResultSchema>;
108
+
109
+ export const SearchSuggestQuerySchema = z.object({
110
+ q: z.string().min(1).max(200).describe("What has been typed so far."),
111
+ engine: SearchEngineSchema.describe("Whose suggestions: the search engine the address bar sends queries to."),
112
+ });
113
+ export type SearchSuggestQuery = z.infer<typeof SearchSuggestQuerySchema>;
114
+
115
+ export const SearchSuggestionsSchema = z.object({
116
+ q: z.string().describe("The text these suggestions are for, so a late answer can be told from a current one."),
117
+ suggestions: z.array(z.string()).describe("What the engine suggests searching for, best first. Empty when it had nothing, or did not answer in time."),
118
+ });
119
+ export type SearchSuggestions = z.infer<typeof SearchSuggestionsSchema>;
120
+
121
+ // Whether an agent's turn is recorded as it drives a browser window, kept with the conversation's artifacts (the
122
+ // daemon's browser/media/recordings.ts, read at the turn's browser calls). Off by default: every turn's browsing kept as
123
+ // video is disk nobody asked for.
124
+ export const RecordAgentBrowsingSchema = z
125
+ .boolean()
126
+ .default(false)
127
+ .describe(
128
+ "Record the browser window as an agent's turn drives it, and keep the video with that conversation's artifacts. Only windows the sandbox streams the new way are recorded, and without sound.",
129
+ );
@@ -183,6 +183,15 @@ export const DeviceScopesSchema = z.object({
183
183
  // agent's supervision (app_start). Narrower than `shell` in what it reaches and wider in what it trusts: the program
184
184
  // is the sandbox's, not one already on the machine.
185
185
  programs: hostScope.default("off"),
186
+ // (2026-11-20) PEOPLE'S remote access, from the editor, served by intentic-remoted on the machine
187
+ // (schemas/device-remote.ts). Three switches of their own, independent of the agents' `screen`, `control` and
188
+ // `shell`: what an agent may do and what a person at another screen may do are different grants. All default off.
189
+ // Let people see the screen: a live view of this computer's desktop.
190
+ remoteView: hostScope.default("off"),
191
+ // Let people use the mouse and keyboard: input from that view. The person at the computer can pause it.
192
+ remoteControl: hostScope.default("off"),
193
+ // Let people open terminals: a shell on this computer, in any of its environments.
194
+ remoteTerminal: hostScope.default("off"),
186
195
  // One directory per line. Empty ⇒ the machine's home directory, which is what the agent reports at connect.
187
196
  roots: z.string().optional(),
188
197
  });
@@ -1,7 +1,7 @@
1
1
  import { contextTrimLine } from "./context-trim.js";
2
2
 
3
3
  // The one thing a reader ever sees of this mechanism. It has to answer three questions in one line: why the turn ran
4
- // thin, what it lost, and whether the reader's own instructions were among the losses.
4
+ // thin, what it lost, and whether the reader's own instructions were among the losses (they never are).
5
5
 
6
6
  test("the window comes first, then what went, then what stayed", () => {
7
7
  const line = contextTrimLine({ window: 16_384, omitted: ["Map of this project", "Working in this sandbox"], base: true });
@@ -9,7 +9,7 @@ test("the window comes first, then what went, then what stayed", () => {
9
9
  expect(line).toContain("16k window");
10
10
  expect(line).toContain("Map of this project, Working in this sandbox");
11
11
  // Without this clause the line reads as "your AGENTS.md may not have arrived", which is the one thing it is not.
12
- expect(line).toContain("Your workspace rules");
12
+ expect(line).toContain("workspace rules kept");
13
13
  });
14
14
 
15
15
  // A swapped base is a bigger change than any note and is stated as its own fact, not folded into the list.
@@ -17,8 +17,8 @@ test("a swapped base says so, and a kept one does not", () => {
17
17
  const swapped = contextTrimLine({ window: 16_384, omitted: [], base: true });
18
18
  const kept = contextTrimLine({ window: 32_768, omitted: ["Map of this project"], base: false });
19
19
 
20
- expect(swapped).toContain("base instructions were swapped");
21
- expect(kept).not.toContain("base instructions");
20
+ expect(swapped).toContain("base prompt shortened");
21
+ expect(kept).not.toContain("base prompt");
22
22
  });
23
23
 
24
24
  // Nothing to list happens for real: a turn whose optional notes were all off already, on a window small enough to swap
@@ -26,8 +26,8 @@ test("a swapped base says so, and a kept one does not", () => {
26
26
  test("an empty list leaves no dangling clause", () => {
27
27
  const line = contextTrimLine({ window: 16_384, omitted: [], base: true });
28
28
 
29
- expect(line).toContain("16k window.");
30
- expect(line).not.toContain("left out");
29
+ expect(line).toBe("Sent thin for the 16k window; base prompt shortened; workspace rules kept.");
30
+ expect(line).not.toContain("without");
31
31
  });
32
32
 
33
33
  // A user's own server can be started with any number at all, and rounding it to "24k" would misquote the thing the
@@ -28,7 +28,7 @@ export const contextTrimNotice = ({ window, omitted, base }: ContextTrim): Extra
28
28
  // The closing clause is load-bearing: without it the row reads as "my AGENTS.md may not have arrived".
29
29
  export const contextTrimLine = (trim: ContextTrim): string => {
30
30
  const { window, omitted, base } = contextTrimNotice(trim).params;
31
- const swapped = base ? ` The agent's own base instructions were swapped for a short paragraph, too.` : ``;
32
- const left = omitted === undefined ? `` : ` — left out: ${omitted}`;
33
- return `Sent thin for this model's ${window} window${left}.${swapped}` + ` Your workspace rules, this turn's role and where its files live still rode.`;
31
+ const swapped = base ? `; base prompt shortened` : ``;
32
+ const left = omitted === undefined ? `` : `, without ${omitted}`;
33
+ return `Sent thin for the ${window} window${left}${swapped}; workspace rules kept.`;
34
34
  };
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ import { OkSchema } from "./shared.js";
3
+
4
+ /* PEOPLE'S REMOTE DESKTOP AND TERMINALS ON A CONNECTED COMPUTER (2026-11-20). A person in the editor (never an agent) sees
5
+ the screen, drives the mouse and keyboard, or opens a terminal on one of the owner's computers. One daemon per
6
+ environment there, intentic-remoted, serves them: it dials this sandbox's `/system/device-uplink` and carries the
7
+ terminals and the view over that uplink. The machine agent starts it only while it is wanted, through the two device
8
+ procedures below, which the daemon alone calls (never a tool), and only on an agent advertising `remote`. What a person
9
+ may do is the computer's own three switches (`remoteView`, `remoteControl`, `remoteTerminal` in DeviceScopesSchema),
10
+ read on the machine from the link's grant, and the person at the computer can pause input or end every session. */
11
+
12
+ // What `remoteStart` hands the machine: the device's name on this sandbox, the token remoted presents when it dials the
13
+ // uplink, and the key the view's frames are sealed with (base64url of 32 bytes, unpadded). Both secrets are the daemon's
14
+ // to mint and rotate; the machine only passes them to remoted and never logs them.
15
+ // `iceServers` (2026-11-20) are the `remoteIceServers` setting's URLs (`stun:host:port`), which remoted asks for its
16
+ // server-reflexive address so a screen's peer connection can find a direct path from outside the computer's network.
17
+ // Sent only to an agent advertising `remote-ice` (this schema is strict, so an older agent would refuse the call);
18
+ // absent, remoted offers its host candidates alone.
19
+ export const RemoteStartInputSchema = z
20
+ .object({
21
+ device: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "a device name: letters, digits, `_` and `-`, at most 64"),
22
+ uplinkToken: z.string().min(1),
23
+ mediaKey: z.string().regex(/^[A-Za-z0-9_-]{43}$/, "base64url of 32 bytes, unpadded"),
24
+ iceServers: z.array(z.string().min(1).max(512)).max(32).optional(),
25
+ })
26
+ .strict();
27
+ export type RemoteStartInput = z.infer<typeof RemoteStartInputSchema>;
28
+
29
+ // One monitor of the computer as remoted reports it: its place on the desktop in pixels, and its scale factor.
30
+ export const RemoteMonitorSchema = z
31
+ .object({
32
+ id: z.string(),
33
+ name: z.string(),
34
+ x: z.int(),
35
+ y: z.int(),
36
+ width: z.int(),
37
+ height: z.int(),
38
+ scale: z.number(),
39
+ primary: z.boolean(),
40
+ })
41
+ .strict();
42
+ export type RemoteMonitor = z.infer<typeof RemoteMonitorSchema>;
43
+
44
+ // What people may do over this link's uplink, read from the link's three switches.
45
+ export const RemoteAllowSchema = z
46
+ .object({
47
+ view: z.boolean(),
48
+ control: z.boolean(),
49
+ terminal: z.boolean(),
50
+ })
51
+ .strict();
52
+ export type RemoteAllow = z.infer<typeof RemoteAllowSchema>;
53
+
54
+ // The answer once remoted's uplink to this sandbox is up: remoted's version, what is allowed, the monitors a view can
55
+ // show, and the environments a terminal can open in (`native`, `wsl:<distro>`).
56
+ export const RemoteStartResultSchema = z
57
+ .object({
58
+ version: z.string(),
59
+ allow: RemoteAllowSchema,
60
+ monitors: z.array(RemoteMonitorSchema),
61
+ environments: z.array(z.string()),
62
+ })
63
+ .strict();
64
+ export type RemoteStartResult = z.infer<typeof RemoteStartResultSchema>;
65
+
66
+ // `remoteStop` takes nothing and answers the plain acknowledgement: this link's uplink is gone.
67
+ export const RemoteStopResultSchema = OkSchema;
68
+ export type RemoteStopResult = z.infer<typeof RemoteStopResultSchema>;
69
+
70
+ /* THE LOCK SCREEN AND ADMINISTRATOR PROMPTS, ON WINDOWS (2026-11-20). A process in the person's session cannot see or
71
+ drive the secure desktop (the sign-in and lock screen, Ctrl+Alt+Del, UAC prompts). intentic-remoted can install a
72
+ Windows service of its own that can, and installing it needs an administrator's yes on that computer, once.
73
+ `remoteService` is how the owner asks for it from the editor: `status` reads it unelevated; `install` (also an update:
74
+ it replaces what is there) and `uninstall` show the person at the computer one UAC prompt, then read the status
75
+ again. Only the daemon calls it, never a tool, and only on an agent advertising `remote-service` (Windows alone);
76
+ an agent anywhere else answers `supported: false` without running anything. */
77
+ export const RemoteServiceActionSchema = z.enum(["install", "uninstall", "status"]);
78
+ export type RemoteServiceAction = z.infer<typeof RemoteServiceActionSchema>;
79
+
80
+ export const RemoteServiceInputSchema = z.object({ action: RemoteServiceActionSchema }).strict();
81
+ export type RemoteServiceInput = z.infer<typeof RemoteServiceInputSchema>;
82
+
83
+ // The service's helper in the person's session: which Windows session it runs in, and which desktop it is on now
84
+ // (`Default`, `Winlogon`, `Screen-saver`; null when it cannot tell).
85
+ export const RemoteServiceHelperSchema = z.object({ session: z.int(), desktop: z.string().nullable() });
86
+
87
+ // Not strict, unlike the inputs: a newer agent saying more of its service is still read by an older daemon.
88
+ export const RemoteServiceResultSchema = z.object({
89
+ // Whether this computer can have the service at all (Windows); `reason` says why not.
90
+ supported: z.boolean(),
91
+ reason: z.string().optional(),
92
+ installed: z.boolean(),
93
+ // The Windows service's state as remoted names it: `running`, `stopped`, `starting`, `stopping`.
94
+ state: z.string().optional(),
95
+ // The installed service's version, and the agent's own remoted's, which an install would put there.
96
+ version: z.string().optional(),
97
+ agentVersion: z.string().optional(),
98
+ // Installed, and at another version than the agent's remoted: an install updates it.
99
+ outOfDate: z.boolean(),
100
+ helper: RemoteServiceHelperSchema.nullable().optional(),
101
+ // The administrator's yes was not given, so nothing changed.
102
+ declined: z.boolean().optional(),
103
+ // What went wrong with an install or uninstall, in a sentence for the person; the fields above are read after it.
104
+ error: z.string().optional(),
105
+ });
106
+ export type RemoteServiceResult = z.infer<typeof RemoteServiceResultSchema>;
@@ -200,6 +200,16 @@ export const DeviceFeatureSchema = z.enum([
200
200
  // (2026-11-19) `list_stacks`, `stack_action`, `stack_logs` and `deploy_stack`: Docker compose stacks on the machine,
201
201
  // read, driven and deployed to from the Deployments board (schemas/device-stacks.ts).
202
202
  "stacks",
203
+ // (2026-11-20) `remoteStart` and `remoteStop`: people's remote desktop and terminals on this computer, served by
204
+ // intentic-remoted, which the agent starts and keeps (schemas/device-remote.ts). Advertised only where a remoted can
205
+ // exist here: a release built for this platform, or one already beside the agent.
206
+ "remote",
207
+ // (2026-11-20) `remoteStart` takes `iceServers`, which the agent writes into each uplink of remoted.json for remoted's
208
+ // own STUN gathering. Without it the daemon leaves them out: the input schema is strict.
209
+ "remote-ice",
210
+ // (2026-11-20) `remoteService`: remoted's Windows service for the lock screen and administrator prompts, read,
211
+ // installed and removed (schemas/device-remote.ts). Advertised by a Windows agent that advertises `remote`.
212
+ "remote-service",
203
213
  ]);
204
214
  export type DeviceFeature = z.infer<typeof DeviceFeatureSchema>;
205
215
  export const DEVICE_FEATURE_RESHAPE_LATER: DeviceFeature = "reshape-later";
@@ -217,6 +227,9 @@ export const DEVICE_FEATURE_REACH_NETWORK: DeviceFeature = "reach-network";
217
227
  export const DEVICE_FEATURE_SANDBOX_MOVE: DeviceFeature = "sandbox-move";
218
228
  export const DEVICE_FEATURE_FILE_COPY: DeviceFeature = "file-copy";
219
229
  export const DEVICE_FEATURE_STACKS: DeviceFeature = "stacks";
230
+ export const DEVICE_FEATURE_REMOTE: DeviceFeature = "remote";
231
+ export const DEVICE_FEATURE_REMOTE_ICE: DeviceFeature = "remote-ice";
232
+ export const DEVICE_FEATURE_REMOTE_SERVICE: DeviceFeature = "remote-service";
220
233
  // What `ic features --json` answers (_sandbox/ic/src/features.rs, golden/ic-features.json): the optional ops that ic
221
234
  // implements, as strings, since a newer ic's word means nothing to an older agent.
222
235
  export const IcFeaturesAnswerSchema = z.object({ features: z.array(z.string()) });
@@ -44,7 +44,7 @@ describe("keep-warm economics", () => {
44
44
  describe("the receipt a kept conversation's turn leaves", () => {
45
45
  test("says it picked up warm, and for how long it was kept", () => {
46
46
  expect(keptWarmLine({ readTokens: 251_000, writtenTokens: 3_000, kept: { forMs: 3 * HOUR + 12 * MINUTE, refreshes: 4 } })).toBe(
47
- "Picked up warm: 251k tokens read from the cache, kept warm for 3h 12m with 4 refreshes.",
47
+ "Picked up warm: 251k tokens from cache, kept 3h 12m (4 refreshes).",
48
48
  );
49
49
  });
50
50
 
@@ -115,10 +115,9 @@ export const keptWarmLine = (opening: PromptCacheOpening): string | undefined =>
115
115
  return undefined;
116
116
  }
117
117
  const { tokens, span, refreshes } = notice.params;
118
- const held = `kept warm for ${span} with ${refreshes} ${refreshes === 1 ? "refresh" : "refreshes"}`;
119
118
  return notice.code === "keptWarm"
120
- ? `Picked up warm: ${tokens} tokens read from the cache, ${held}.`
121
- : `Picked up cold despite being ${held}: ${tokens} tokens sent again, because this turn's prompt no longer matched the cache.`;
119
+ ? `Picked up warm: ${tokens} tokens from cache, kept ${span} (${refreshes} ${refreshes === 1 ? "refresh" : "refreshes"}).`
120
+ : `Picked up cold after ${span} kept warm: ${tokens} tokens resent, the prompt changed.`;
122
121
  };
123
122
 
124
123
  // A turn's prefix, part by part, so two turns that should share a cache can say which part stopped matching.
@@ -27,16 +27,16 @@ describe("suggestHandoff", () => {
27
27
  describe("handedOffLine", () => {
28
28
  it("names what the continuing session started from beside what carrying would have re-read", () => {
29
29
  expect(handedOffLine({ mode: "trim", tokens: 112_400, from: 431_000, cleared: 180 })).toBe(
30
- "Continued in a trimmed copy of the session (about 112k tokens instead of 431k): 180 older tool outputs cleared, every message and tool call kept.",
30
+ "Continued trimmed to ~112k tokens from 431k: 180 old tool outputs cleared.",
31
31
  );
32
32
  expect(handedOffLine({ mode: "summary", model: "claude-haiku-5-5", from: 431_000 })).toBe(
33
- "Continued in a fresh session opened with a summary of the conversation written by claude-haiku-5-5.",
33
+ "Continued in a fresh session from a summary by claude-haiku-5-5.",
34
34
  );
35
- expect(handedOffLine({ mode: "carry", tokens: 431_000 })).toBe("Continued in the same session, re-reading all of it (about 431k tokens).");
35
+ expect(handedOffLine({ mode: "carry", tokens: 431_000 })).toBe("Continued in the same session, re-reading ~431k tokens.");
36
36
  });
37
37
 
38
38
  it("says plainly when the way picked could not be built", () => {
39
- expect(handedOffLine({ mode: "trim", fellBack: true })).toBe("Could not trim the session for the hand-off, so it was carried whole.");
39
+ expect(handedOffLine({ mode: "trim", fellBack: true })).toBe("Couldn't trim the session, so it was carried whole.");
40
40
  expect(handedOffNotice({ mode: "summary", fellBack: true })).toStrictEqual({ code: "handedOff", params: { mode: "summary", fellBack: true } });
41
41
  });
42
42
  });
@@ -44,12 +44,10 @@ describe("handedOffLine", () => {
44
44
  describe("a home's fresh start", () => {
45
45
  it("says why the chat started over and what the fresh session opened with", () => {
46
46
  expect(freshStartLine({ why: "cold", from: 90_000, summarized: false })).toBe(
47
- "This chat had been idle long enough that re-reading it at about 90k tokens would cost more than starting over, so it went on in a fresh session, opened with its latest messages and the work in hand.",
47
+ "Idle too long to re-read at ~90k tokens: fresh session, from its recent messages.",
48
48
  );
49
- expect(freshStartLine({ why: "asked", summarized: true })).toBe(
50
- "Started fresh, as you asked, opened with a summary of the conversation and its latest messages.",
51
- );
52
- expect(freshStartLine({ why: "cleared", summarized: false })).toBe("History cleared: started fresh, opened with its latest messages and the work in hand.");
49
+ expect(freshStartLine({ why: "asked", summarized: true })).toBe("Started fresh, as you asked, from a summary.");
50
+ expect(freshStartLine({ why: "cleared", summarized: false })).toBe("History cleared: started fresh, from its recent messages.");
53
51
  });
54
52
 
55
53
  it("carries only the facts it has", () => {
@@ -67,5 +65,5 @@ describe("a home's fresh start", () => {
67
65
  test("a failed summary carries its reason into both the notice and readable line", () => {
68
66
  const event = { mode: "summary", fellBack: true, reason: "Every summary model is out of allowance" } as const;
69
67
  expect(handedOffNotice(event)).toEqual({ code: "handedOff", params: event });
70
- expect(handedOffLine(event)).toBe("Could not write a summary for the hand-off, so the fresh session opened with the recent conversation and where the work stands instead. Reason: Every summary model is out of allowance");
68
+ expect(handedOffLine(event)).toBe("Couldn't write a summary; started fresh from recent messages. Reason: Every summary model is out of allowance");
71
69
  });
@@ -111,22 +111,21 @@ export const handedOffNotice = (event: HandedOff): Extract<SandboxNotice, { code
111
111
  export const handedOffLine = (event: HandedOff): string => {
112
112
  if (event.fellBack === true) {
113
113
  const line = event.mode === "trim"
114
- ? "Could not trim the session for the hand-off, so it was carried whole."
115
- : "Could not write a summary for the hand-off, so the fresh session opened with the recent conversation and where the work stands instead.";
114
+ ? "Couldn't trim the session, so it was carried whole."
115
+ : "Couldn't write a summary; started fresh from recent messages.";
116
116
  return event.reason === undefined ? line : `${line} Reason: ${event.reason}`;
117
117
  }
118
118
  const tokens = event.tokens === undefined ? undefined : tokensLabel(event.tokens);
119
119
  switch (event.mode) {
120
120
  case "carry":
121
- return `Continued in the same session, re-reading all of it${tokens === undefined ? "" : ` (about ${tokens} tokens)`}.`;
121
+ return tokens === undefined ? "Continued in the same session, re-reading all of it." : `Continued in the same session, re-reading ~${tokens} tokens.`;
122
122
  case "trim": {
123
123
  const cleared = event.cleared ?? 0;
124
- const size =
125
- tokens === undefined ? "" : event.from === undefined ? ` (about ${tokens} tokens)` : ` (about ${tokens} tokens instead of ${tokensLabel(event.from)})`;
126
- return `Continued in a trimmed copy of the session${size}: ${cleared} older tool output${cleared === 1 ? "" : "s"} cleared, every message and tool call kept.`;
124
+ const size = tokens === undefined ? "" : ` to ~${tokens} tokens${event.from === undefined ? "" : ` from ${tokensLabel(event.from)}`}`;
125
+ return `Continued trimmed${size}: ${cleared} old tool output${cleared === 1 ? "" : "s"} cleared.`;
127
126
  }
128
127
  case "summary":
129
- return `Continued in a fresh session opened with a summary of the conversation${event.model === undefined ? "" : ` written by ${event.model}`}.`;
128
+ return `Continued in a fresh session from a summary${event.model === undefined ? "" : ` by ${event.model}`}.`;
130
129
  }
131
130
  };
132
131
 
@@ -164,17 +163,17 @@ export const freshStartNotice = (event: FreshStart): Extract<SandboxNotice, { co
164
163
 
165
164
  /** The transcript's line for a fresh session, in the English the record keeps. */
166
165
  export const freshStartLine = (event: FreshStart): string => {
167
- const from = event.from === undefined ? "" : ` at about ${tokensLabel(event.from)} tokens`;
166
+ const from = event.from === undefined ? "" : ` at ~${tokensLabel(event.from)} tokens`;
168
167
  const why =
169
168
  event.why === "budget"
170
- ? `This chat's memory was full${from}, so it went on in a fresh session`
169
+ ? `Memory full${from}: fresh session`
171
170
  : event.why === "cold"
172
- ? `This chat had been idle long enough that re-reading it${from} would cost more than starting over, so it went on in a fresh session`
171
+ ? `Idle too long to re-read${from}: fresh session`
173
172
  : event.why === "asked"
174
173
  ? "Started fresh, as you asked"
175
174
  : "History cleared: started fresh";
176
175
  const carried = event.summarized
177
- ? `, opened with a summary of the conversation${event.model === undefined ? "" : ` written by ${event.model}`} and its latest messages.`
178
- : ", opened with its latest messages and the work in hand.";
176
+ ? `, from a summary${event.model === undefined ? "" : ` by ${event.model}`}.`
177
+ : ", from its recent messages.";
179
178
  return `${why}${carried}`;
180
179
  };