@agentproto/runtime 4.1.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SpawnDefaultsConfig } from './spawn-defaults-CZj39Znq.js';
2
- import './context-continuity-Bn99UtVC.js';
1
+ import { S as SpawnDefaultsConfig } from './spawn-defaults-CHvz85DD.js';
2
+ import './context-continuity-BfNVbX5W.js';
3
3
  import '@agentproto/acp';
4
4
  import '@agentproto/command-sandbox';
5
5
  import '@agentproto/model-catalog';
@@ -183,6 +183,25 @@ interface FeaturesConfig {
183
183
  * an opt-in feature; when off, the `llm-endpoint` custom route is not
184
184
  * registered and the `llm_endpoint_*` MCP tools are not exposed. */
185
185
  llmEndpoint?: boolean;
186
+ /** Expose this daemon's local inference endpoint(s) (the `llmEndpoint`
187
+ * sidecar above) to paired controllers over a HOST-scoped pairing —
188
+ * `GET /device-inference/v1/models` + `POST
189
+ * /device-inference/v1/chat/completions` in http-server.ts. Default
190
+ * false: even with `llmEndpoint` on, a plain remote-control pairing (or
191
+ * `serve --connect`) never gets these routes regardless of this flag —
192
+ * it also requires the pairing itself to be host-scoped (`pair offer
193
+ * --host` + `devices add`). Toggle via `agentproto devices
194
+ * share-inference on|off`. */
195
+ deviceInferenceShare?: boolean;
196
+ /** Opt this daemon in to being usable as an `agent_start({ sandbox:
197
+ * "device:<name>" })` target (DEVICES-PLAN PR-D) — exposes
198
+ * `/device-spawn/*` in http-server.ts, a self-proxy onto this daemon's
199
+ * own `/mcp` + `/sessions/:id/events/stream`. Default false: even with
200
+ * this on, only a HOST-scoped pairing (`pair offer --host` + `devices
201
+ * add`) can reach the routes — a plain remote-control pairing never can,
202
+ * whatever this is set to. Toggle via `agentproto devices allow-spawn
203
+ * on|off`. */
204
+ deviceSpawnAllow?: boolean;
186
205
  }
187
206
  /**
188
207
  * Policy for `agentproto worktree new` (PLAN.md §1.4 — config carries
@@ -310,6 +329,30 @@ interface ProvenanceConfig {
310
329
  /** Enable the opt-in `gh` provenance PATH shim for spawned sessions. */
311
330
  wrapGh?: boolean;
312
331
  }
332
+ /**
333
+ * Sentinel auto-link policy (AIP-60 §6, step 4) — whether a PR an executor
334
+ * session opens gets a sentinel created for it automatically.
335
+ */
336
+ interface SentinelConfig {
337
+ /** Auto-watch a PR when a session opens one (`recordOpenedPr`, fed by
338
+ * `command_execute`'s stamper and both `pr-provenance-reconciler.ts`
339
+ * lanes). When unset, the daemon defaults to `true` only when the
340
+ * `local-gh` provider is available (i.e. `gh auth status` succeeds) —
341
+ * otherwise `false`, logged once. Explicitly setting this always wins
342
+ * over that probe. Per-spawn opt-out: `agent_start.sentinel: false`. */
343
+ autoWatchPrs?: boolean;
344
+ }
345
+ /**
346
+ * Review-primitive host policy (`@agentproto/review` + `review-runner.ts`).
347
+ */
348
+ interface ReviewConfig {
349
+ /** The owner identity attestation signatures claim (`attestor.signature.
350
+ * principal`) — see `review-signing.ts`'s `resolvePrincipal`. When unset,
351
+ * the daemon falls back to `git config user.email` of the reviewed repo,
352
+ * then a host-derived value; this never blocks signing, it only lets an
353
+ * operator pin one identity across every repo the daemon reviews. */
354
+ principal?: string;
355
+ }
313
356
  /**
314
357
  * Session-presence policy — how the dashboard triages a session into its
315
358
  * `running` / `tending` / `attention` / `quiet` presence state (see
@@ -492,6 +535,10 @@ interface AgentprotoConfig {
492
535
  sessions?: SessionsConfig;
493
536
  /** Provenance policy — the opt-in `gh` PATH shim. See {@link ProvenanceConfig}. */
494
537
  provenance?: ProvenanceConfig;
538
+ /** Sentinel auto-link policy. See {@link SentinelConfig}. */
539
+ sentinel?: SentinelConfig;
540
+ /** Review-primitive host policy. See {@link ReviewConfig}. */
541
+ review?: ReviewConfig;
495
542
  /** Daemon-side AGENTS.md resolution/injection policy. See {@link AgentsMdConfig}. */
496
543
  agentsMd?: AgentsMdConfig;
497
544
  /** Daemon-side session titler (`session-titler.ts`). DEFAULT OFF — when
@@ -564,4 +611,4 @@ declare function getConfigKey(cfg: AgentprotoConfig, dotted: string): unknown;
564
611
  */
565
612
  declare function setConfigKey(cfg: AgentprotoConfig, dotted: string, value: unknown): AgentprotoConfig;
566
613
 
567
- export { type AcpAgentConfigEntry, type AgentprotoConfig, type AgentsMdConfig, CONFIG_FILE_PATH, CONFIG_VERSION, type DaemonConfig, type FeaturesConfig, type PairingConfig, type ProfileConfig, type ProvenanceConfig, type SessionsConfig, type SpawnAttachMode, type SpawnConfig, type SpawnDedupeMode, type TerminalPreset, type TitlerConfig, type TunnelConfig, type WorktreeIsolationMode, type WorktreesConfig, getConfigKey, loadConfig, saveConfig, setConfigKey };
614
+ export { type AcpAgentConfigEntry, type AgentprotoConfig, type AgentsMdConfig, CONFIG_FILE_PATH, CONFIG_VERSION, type DaemonConfig, type FeaturesConfig, type PairingConfig, type ProfileConfig, type ProvenanceConfig, type ReviewConfig, type SentinelConfig, type SessionsConfig, type SpawnAttachMode, type SpawnConfig, type SpawnDedupeMode, type TerminalPreset, type TitlerConfig, type TunnelConfig, type WorktreeIsolationMode, type WorktreesConfig, getConfigKey, loadConfig, saveConfig, setConfigKey };
package/dist/config.mjs CHANGED
@@ -16,6 +16,7 @@ import '@agentproto/command-sandbox';
16
16
  import '@agentproto/plugin-local-browser';
17
17
  import '@modelcontextprotocol/sdk/types.js';
18
18
  import '@agentproto/provider-kit';
19
+ import '@agentproto/llm-endpoint';
19
20
  import '@modelcontextprotocol/sdk/client/index.js';
20
21
  import '@modelcontextprotocol/sdk/client/streamableHttp.js';
21
22
  import 'net';
@@ -1944,6 +1945,29 @@ var init_worktree_identity = __esm({
1944
1945
  z.object({ worktreeId: z.string() });
1945
1946
  }
1946
1947
  });
1948
+ var init_mcp_imports = __esm({
1949
+ "src/mcp-imports.ts"() {
1950
+ }
1951
+ });
1952
+ var bundleIdSchema, bundleSchema;
1953
+ var init_bundles = __esm({
1954
+ "src/bundles.ts"() {
1955
+ init_mcp_imports();
1956
+ bundleIdSchema = z.string().regex(/^[a-z0-9][a-z0-9-]*$/, "id must be lowercase kebab-case (letters, digits, hyphens)");
1957
+ bundleSchema = z.object({
1958
+ id: bundleIdSchema,
1959
+ label: z.string().min(1),
1960
+ description: z.string().min(1).optional(),
1961
+ mcpImports: z.array(z.string().min(1)),
1962
+ includeDaemon: z.boolean().optional(),
1963
+ skills: z.array(z.string().min(1))
1964
+ });
1965
+ z.object({
1966
+ version: z.literal(1),
1967
+ bundles: z.array(bundleSchema)
1968
+ });
1969
+ }
1970
+ });
1947
1971
  var init_catalog_models = __esm({
1948
1972
  "src/catalog-models.ts"() {
1949
1973
  init_spawn_defaults();
@@ -1996,6 +2020,41 @@ var init_canonical_posture = __esm({
1996
2020
  })();
1997
2021
  }
1998
2022
  });
2023
+ var effortSchema, postureSchema, routeSchema, userPresetSchema;
2024
+ var init_user_presets = __esm({
2025
+ "src/user-presets.ts"() {
2026
+ effortSchema = z.enum(["low", "medium", "high", "xhigh", "max", "ultracode"]);
2027
+ postureSchema = z.union([
2028
+ z.enum(["default", "plan", "accept-edits", "bypass", "read-only"]),
2029
+ z.object({ harnessModeId: z.string().min(1) })
2030
+ ]);
2031
+ routeSchema = z.object({
2032
+ gateway: z.string().min(1),
2033
+ baseUrl: z.string().url().optional()
2034
+ });
2035
+ userPresetSchema = z.object({
2036
+ id: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),
2037
+ label: z.string().min(1),
2038
+ adapter: z.string().min(1).optional(),
2039
+ harness: z.string().min(1).optional(),
2040
+ model: z.string().min(1).optional(),
2041
+ route: routeSchema.optional(),
2042
+ access: z.object({ profileRef: z.string().min(1).optional() }).optional(),
2043
+ posture: postureSchema.optional(),
2044
+ effort: effortSchema.optional(),
2045
+ contextProfile: z.string().min(1).optional(),
2046
+ cwd: z.string().min(1).optional(),
2047
+ skills: z.array(z.string().min(1)).optional(),
2048
+ bundles: z.array(z.string().min(1)).optional(),
2049
+ browser: z.union([z.literal("headless"), z.literal(false)]).optional(),
2050
+ lastUsedAt: z.string().min(1).optional()
2051
+ });
2052
+ z.object({
2053
+ version: z.literal(1),
2054
+ presets: z.array(userPresetSchema)
2055
+ });
2056
+ }
2057
+ });
1999
2058
  var harnessPresetSchema;
2000
2059
  var init_harness_preset_store = __esm({
2001
2060
  "src/harness-preset-store.ts"() {
@@ -2096,6 +2155,10 @@ var init_session_title = __esm({
2096
2155
  "src/session-title.ts"() {
2097
2156
  }
2098
2157
  });
2158
+ var init_inference_binding = __esm({
2159
+ "src/inference-binding.ts"() {
2160
+ }
2161
+ });
2099
2162
 
2100
2163
  // src/mcp-credential-deps.ts
2101
2164
  var init_mcp_credential_deps = __esm({
@@ -2147,16 +2210,20 @@ var init_sandbox_adapters = __esm({
2147
2210
  var init_session_spawn = __esm({
2148
2211
  "src/session-spawn.ts"() {
2149
2212
  init_sessions();
2213
+ init_transcript_writer();
2150
2214
  init_workspaces_config();
2151
2215
  init_config();
2152
2216
  init_worktree_identity();
2153
2217
  init_spawn_defaults();
2218
+ init_bundles();
2219
+ init_mcp_imports();
2154
2220
  init_launch_config();
2155
2221
  init_claude_code_oauth_source();
2156
2222
  init_providers_store();
2157
2223
  init_catalog_models();
2158
2224
  init_context_continuity();
2159
2225
  init_canonical_posture();
2226
+ init_user_presets();
2160
2227
  init_harness_preset_store();
2161
2228
  init_browser_mount();
2162
2229
  init_role();
@@ -2165,6 +2232,7 @@ var init_session_spawn = __esm({
2165
2232
  init_agents_md();
2166
2233
  init_workspace_rules();
2167
2234
  init_session_title();
2235
+ init_inference_binding();
2168
2236
  init_mcp_credential_deps();
2169
2237
  init_sandbox_agent_session_proxy();
2170
2238
  init_sandbox_ledger();
@@ -2296,6 +2364,9 @@ var init_agent_start_schema = __esm({
2296
2364
  notifyParentOnCrash: mcpBool.optional().describe(
2297
2365
  `Notify this session's parent directly (in-band) if it later crashes. Independent of the global \`notifyUrl\` webhook, which fires either way. ${help("notifyParentOnCrash")}`
2298
2366
  ),
2367
+ sentinel: mcpBool.optional().describe(
2368
+ `Set false to opt this spawn OUT of sentinel auto-link: a PR this session opens will never get an automatic AIP-60 sentinel watching it, regardless of the daemon's \`sentinel.autoWatchPrs\` config. ${help("sentinel")}`
2369
+ ),
2299
2370
  allowSharedCwd: mcpBool.optional().describe(
2300
2371
  "Acknowledge running a nested spawn in the parent's dirty working tree, silencing the shared-dirty-cwd warning. Only relevant with no `worktree`/`sandbox`; default false = warn."
2301
2372
  ),
@@ -2310,6 +2381,12 @@ var init_agent_start_schema = __esm({
2310
2381
  skills: jsonTolerant(z.array(z.string())).optional().describe(
2311
2382
  `Normalized skill ids for this session (e.g. ['agentproto']). REPLACES (not unions) config defaults when set. Adapters with no \`skills\` option (e.g. claude-code) ignore it. ${help("skills")}`
2312
2383
  ),
2384
+ bundles: jsonTolerant(z.array(z.string())).optional().describe(
2385
+ `Capability bundle ids (\`bundle_list\`) to attach \u2014 each expands to its imported MCPs (mounted as native MCP servers, never via the mcp_imported_* indirection) + skills, and optionally the daemon's own /mcp. REPLACES (not unions) config defaults when set. ${help("bundles")}`
2386
+ ),
2387
+ daemonMount: mcpBool.optional().describe(
2388
+ `Explicitly mount the daemon's own scoped /mcp gateway for this spawn \u2014 the only way an adapter outside the default self-mount set (opencode, codex, gemini, \u2026) gets it. Default false. ${help("daemonMount")}`
2389
+ ),
2313
2390
  model: z.string().optional().describe(
2314
2391
  "Model identifier to pass to the adapter. For claude-code, applied via session/set_config_option \u2014 NOT a CLI flag."
2315
2392
  ),
@@ -2319,6 +2396,16 @@ var init_agent_start_schema = __esm({
2319
2396
  route: jsonTolerant(
2320
2397
  z.object({ gateway: z.string().min(1), baseUrl: z.string().url().optional() })
2321
2398
  ).optional().describe("Billing route/gateway. Independent of `model` and `access`."),
2399
+ inference: jsonTolerant(
2400
+ z.object({
2401
+ endpoint: z.string().min(1).optional().describe('A registered local/LAN inference endpoint id (`agentproto llm endpoints list`), or "<id>@<device>" for a paired device\'s own shared endpoint.'),
2402
+ model: z.string().min(1).optional().describe('A bare model id (paired with `endpoint`), or the shorthand "<model>@<device|endpoint>" when `endpoint` is omitted.'),
2403
+ force: mcpBool.optional().describe("Skip the fit-check refusal on a clear miss (the check still runs and still warns)."),
2404
+ headroomPct: z.number().min(0).max(95).optional().describe("Headroom percentage held back from the endpoint's loaded ctx for the fit check. Default 25.")
2405
+ })
2406
+ ).optional().describe(
2407
+ `Bind this spawn to a local/LAN inference endpoint instead of a cloud model: \`{endpoint}\`, \`{endpoint, model}\`, or the shorthand \`{model: "<model>@<device|endpoint>"}\`. Runs a fit check (the harness's known first-request size vs the endpoint's loaded ctx) BEFORE spawning and refuses with an actionable error on a clear miss (\`force\` overrides). Defaults \`adapter\`/\`harness\` to "pi" when neither is set. Mutually exclusive with \`model\`/\`route\`/\`access\` \u2014 set those directly instead of \`inference\`, never both. ${help("inference")}`
2408
+ ),
2322
2409
  access: jsonTolerant(z.object({ profileRef: z.string().min(1).optional() })).optional().describe("Named auth profile to bill at initial spawn; resolved from the local keychain."),
2323
2410
  posture: z.string().optional().describe("Canonical agent posture (plan, bypass, accept-edits, read-only) or native harness mode."),
2324
2411
  contextProfile: z.string().optional().describe("Context intake profile (for example full or lean)."),
@@ -2457,39 +2544,6 @@ var init_agent_start_schema = __esm({
2457
2544
  agentStartInputSchema.omit({ wait: true });
2458
2545
  }
2459
2546
  });
2460
- var effortSchema, postureSchema, routeSchema, userPresetSchema;
2461
- var init_user_presets = __esm({
2462
- "src/user-presets.ts"() {
2463
- effortSchema = z.enum(["low", "medium", "high", "xhigh", "max", "ultracode"]);
2464
- postureSchema = z.union([
2465
- z.enum(["default", "plan", "accept-edits", "bypass", "read-only"]),
2466
- z.object({ harnessModeId: z.string().min(1) })
2467
- ]);
2468
- routeSchema = z.object({
2469
- gateway: z.string().min(1),
2470
- baseUrl: z.string().url().optional()
2471
- });
2472
- userPresetSchema = z.object({
2473
- id: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),
2474
- label: z.string().min(1),
2475
- adapter: z.string().min(1).optional(),
2476
- harness: z.string().min(1).optional(),
2477
- model: z.string().min(1).optional(),
2478
- route: routeSchema.optional(),
2479
- access: z.object({ profileRef: z.string().min(1).optional() }).optional(),
2480
- posture: postureSchema.optional(),
2481
- effort: effortSchema.optional(),
2482
- contextProfile: z.string().min(1).optional(),
2483
- cwd: z.string().min(1).optional(),
2484
- skills: z.array(z.string().min(1)).optional(),
2485
- browser: z.union([z.literal("headless"), z.literal(false)]).optional()
2486
- });
2487
- z.object({
2488
- version: z.literal(1),
2489
- presets: z.array(userPresetSchema)
2490
- });
2491
- }
2492
- });
2493
2547
  var init_catalog_provider_models = __esm({
2494
2548
  "src/catalog-provider-models.ts"() {
2495
2549
  }
@@ -2574,6 +2628,11 @@ var init_session_observer = __esm({
2574
2628
  "src/session-observer.ts"() {
2575
2629
  }
2576
2630
  });
2631
+ var init_session_artifacts = __esm({
2632
+ "src/session-artifacts.ts"() {
2633
+ init_transcript_writer();
2634
+ }
2635
+ });
2577
2636
  var DEFAULT_TITLER_MODEL;
2578
2637
  var init_session_titler = __esm({
2579
2638
  "src/session-titler.ts"() {
@@ -2649,6 +2708,7 @@ var init_sessions = __esm({
2649
2708
  init_session_observer();
2650
2709
  init_tool_presenter();
2651
2710
  init_transcript_writer();
2711
+ init_session_artifacts();
2652
2712
  init_session_titler();
2653
2713
  init_resume_context_digest();
2654
2714
  init_conversation_index();
@@ -2732,7 +2792,9 @@ var init_config_schema = __esm({
2732
2792
  skills: z.array(z.string()).optional(),
2733
2793
  options: optionsMapSchema.optional(),
2734
2794
  auth: defaultsAdapterAuthConfigSchema.optional(),
2735
- contextContinuity: contextContinuityPolicySchema.optional()
2795
+ contextContinuity: contextContinuityPolicySchema.optional(),
2796
+ bundles: z.array(z.string()).optional(),
2797
+ daemonMount: z.boolean().optional()
2736
2798
  }).passthrough();
2737
2799
  mcpDefaultsConfigSchema = z.object({
2738
2800
  deferredTools: deferredToolsConfigSchema.optional()
@@ -2741,6 +2803,7 @@ var init_config_schema = __esm({
2741
2803
  skills: z.array(z.string()).optional(),
2742
2804
  options: optionsMapSchema.optional(),
2743
2805
  adapters: z.record(z.string(), defaultsAdapterConfigSchema).optional(),
2806
+ bundles: z.array(z.string()).optional(),
2744
2807
  contextContinuity: contextContinuityPolicySchema.optional(),
2745
2808
  defaultRoleDepthCutoff: z.number().optional(),
2746
2809
  maxGrantableDelegation: z.number().optional(),
@@ -2782,7 +2845,9 @@ var init_config_schema = __esm({
2782
2845
  }).passthrough();
2783
2846
  featuresConfigSchema = z.object({
2784
2847
  pty: z.boolean().optional(),
2785
- llmEndpoint: z.boolean().optional()
2848
+ llmEndpoint: z.boolean().optional(),
2849
+ deviceInferenceShare: z.boolean().optional(),
2850
+ deviceSpawnAllow: z.boolean().optional()
2786
2851
  }).passthrough();
2787
2852
  worktreesConfigSchema = z.object({
2788
2853
  root: z.string().optional(),
@@ -3122,6 +3187,15 @@ var init_config_schema = __esm({
3122
3187
  label: "Default options",
3123
3188
  help: "AIP-45 options auto-applied to every agent_start spawn."
3124
3189
  },
3190
+ {
3191
+ path: "defaults.bundles",
3192
+ schema: strArray,
3193
+ apply: "hot",
3194
+ writable: true,
3195
+ section: "defaults",
3196
+ label: "Default capability bundles",
3197
+ help: "Bundle ids (bundle_list) auto-attached to every agent_start spawn (unioned with per-adapter bundles)."
3198
+ },
3125
3199
  {
3126
3200
  path: "defaults.defaultRoleDepthCutoff",
3127
3201
  schema: num,
@@ -3348,6 +3422,25 @@ var init_config_schema = __esm({
3348
3422
  label: "Adapter default options",
3349
3423
  help: "AIP-45 options auto-applied to spawns of this adapter."
3350
3424
  },
3425
+ {
3426
+ path: "defaults.adapters.*.bundles",
3427
+ schema: strArray,
3428
+ apply: "hot",
3429
+ writable: true,
3430
+ section: "harnesses",
3431
+ label: "Adapter default capability bundles",
3432
+ help: "Bundle ids (bundle_list) auto-attached to spawns of this adapter (unioned with the global default)."
3433
+ },
3434
+ {
3435
+ path: "defaults.adapters.*.daemonMount",
3436
+ schema: z.boolean(),
3437
+ apply: "hot",
3438
+ writable: true,
3439
+ section: "harnesses",
3440
+ label: "Adapter daemon self-mount opt-in",
3441
+ help: "Explicitly mount the daemon's own scoped /mcp for spawns of this adapter, for harnesses outside the default self-mount allowlist (opencode, codex, gemini, \u2026).",
3442
+ default: false
3443
+ },
3351
3444
  {
3352
3445
  path: "defaults.adapters.*.contextContinuity",
3353
3446
  schema: contextContinuityPolicySchema,
@@ -3591,6 +3684,26 @@ var init_config_schema = __esm({
3591
3684
  label: "LLM Endpoint feature",
3592
3685
  help: "Enable the local LLM Endpoint proxy sidecar (route + MCP tools + child-process lifecycle).",
3593
3686
  default: false
3687
+ },
3688
+ {
3689
+ path: "features.deviceInferenceShare",
3690
+ schema: bool,
3691
+ apply: "restart",
3692
+ writable: true,
3693
+ section: "daemon",
3694
+ label: "Device inference sharing",
3695
+ help: "Expose this daemon's local inference endpoint(s) to a paired HOST-scoped controller. Toggle via `agentproto devices share-inference on|off`.",
3696
+ default: false
3697
+ },
3698
+ {
3699
+ path: "features.deviceSpawnAllow",
3700
+ schema: bool,
3701
+ apply: "restart",
3702
+ writable: true,
3703
+ section: "daemon",
3704
+ label: "Device spawn allow",
3705
+ help: 'Allow a paired HOST-scoped controller to spawn/drive agent sessions on this daemon (`agent_start({ sandbox: "device:<name>" })`). Toggle via `agentproto devices allow-spawn on|off`.',
3706
+ default: false
3594
3707
  }
3595
3708
  ];
3596
3709
  }