@agentproto/runtime 3.6.1 → 4.0.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.
@@ -1,3 +1,42 @@
1
+ import { AcpMcpServer } from '@agentproto/acp';
2
+ import { SandboxMode } from '@agentproto/command-sandbox';
3
+
4
+ /**
5
+ * `agent_start({ browser: "headless" })` — an isolated headless Chrome for
6
+ * one spawned agent, mounted as a per-session stdio MCP server
7
+ * (`chrome-devtools-mcp --headless --isolated`, see
8
+ * `@agentproto/plugin-local-browser`'s `buildHeadlessBrowserMcpEntry`).
9
+ *
10
+ * The server is a child of the adapter process, so it inherits the session's
11
+ * `commandSandbox` confinement and normally dies with the adapter (stdin EOF,
12
+ * and Chrome exits when its pipe closes). On `session:exited`,
13
+ * `sweepSessionBrowser` does two things:
14
+ * - kills anything still carrying the session's `--agentproto-session=<id>`
15
+ * Chrome marker, in case an adapter never exited or never closed its MCP
16
+ * children;
17
+ * - deletes the session's profile dir, `$TMPDIR/agentproto-browser/<id>`.
18
+ * The profile is caller-owned rather than `--isolated`, because `--isolated`
19
+ * only cleans up on a graceful `browser.close()`; observed live, a killed
20
+ * session left its puppeteer temp profile behind.
21
+ */
22
+
23
+ /** `agent_start.browser`. `false` (the default) mounts nothing. */
24
+ type SpawnBrowserMode = "headless" | false;
25
+ interface HeadlessBrowserMount {
26
+ entry: AcpMcpServer;
27
+ /** Read grants the adapter's `commandSandbox` needs for the MCP server +
28
+ * Chrome (threaded as `additionalReadPaths`). */
29
+ readPaths: string[];
30
+ }
31
+ interface ResolveHeadlessBrowserInput {
32
+ sessionId: string;
33
+ cwd: string;
34
+ /** The spawn's explicit `commandSandbox`; `undefined` falls back to the
35
+ * workspace's `adapterSpawn` config, like the driver does. */
36
+ commandSandbox?: SandboxMode;
37
+ }
38
+ type ResolveHeadlessBrowser = (input: ResolveHeadlessBrowserInput) => Promise<HeadlessBrowserMount>;
39
+
1
40
  /**
2
41
  * Canonical context-continuity policy for long-running agent sessions.
3
42
  *
@@ -62,4 +101,4 @@ interface ResolvedContextContinuityPolicy extends ContextContinuityThresholds, R
62
101
  label: string;
63
102
  }
64
103
 
65
- export type { ContextContinuityPolicy as C, ResolvedContextContinuityPolicy as R };
104
+ export type { ContextContinuityPolicy as C, ResolveHeadlessBrowser as R, SpawnBrowserMode as S, ResolvedContextContinuityPolicy as a };
@@ -47,7 +47,19 @@ interface RemoteLogEvent {
47
47
  at: string;
48
48
  line: string;
49
49
  }
50
- type RuntimeEvent = BootEvent | HeartbeatFiredEvent | HeartbeatErrorEvent | ConvTurnEvent | RemoteLogEvent;
50
+ /**
51
+ * Fired once per successful `config_set` / `PATCH /config` write to
52
+ * `~/.agentproto/config.json` (config-tools.ts). Never carries a secret
53
+ * key's value — only the dotted path(s) touched and whether the change
54
+ * takes effect immediately or needs a restart.
55
+ */
56
+ interface ConfigChangedEvent {
57
+ type: "config:changed";
58
+ at: string;
59
+ keys: string[];
60
+ applied: "hot" | "restart-required";
61
+ }
62
+ type RuntimeEvent = BootEvent | HeartbeatFiredEvent | HeartbeatErrorEvent | ConvTurnEvent | RemoteLogEvent | ConfigChangedEvent;
51
63
  interface RuntimeEvents {
52
64
  on<E extends RuntimeEvent["type"]>(type: E, handler: (ev: Extract<RuntimeEvent, {
53
65
  type: E;
@@ -1,2 +1,2 @@
1
1
  import './conversations.js';
2
- export { B as BuildHeartbeatAgent, H as HeartbeatAgent, a as HeartbeatRunner, c as HeartbeatRunnerOptions, p as parseDuration, s as startHeartbeat } from './heartbeat-COGpMrJS.js';
2
+ export { B as BuildHeartbeatAgent, H as HeartbeatAgent, a as HeartbeatRunner, c as HeartbeatRunnerOptions, p as parseDuration, s as startHeartbeat } from './heartbeat-BJtxbDb9.js';