@agentproto/runtime 5.2.1 → 5.3.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,7 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { DaemonConfig, TunnelConfig, FeaturesConfig, PairingConfig, WorktreesConfig, SpawnConfig, SessionsConfig, ProvenanceConfig, AgentsMdConfig, TitlerConfig, ProfileConfig, AcpAgentConfigEntry, TerminalPreset } from './config.js';
3
- import { S as SpawnDefaultsConfig } from './spawn-defaults-CHvz85DD.js';
4
- import './context-continuity-BfNVbX5W.js';
2
+ import { D as DaemonConfig, T as TunnelConfig, F as FeaturesConfig, P as PairingConfig, W as WorktreesConfig, S as SpawnConfig, a as SessionsConfig, b as ProvenanceConfig, A as ApprovalsConfig, c as AgentsMdConfig, d as TitlerConfig, C as CatalogConfig, e as ProfileConfig, f as AcpAgentConfigEntry, g as TerminalPreset } from './config-DcESQDmZ.js';
3
+ import { S as SpawnDefaultsConfig } from './spawn-defaults-Cp9SGZex.js';
5
4
  import '@agentproto/acp';
6
5
  import '@agentproto/command-sandbox';
7
6
  import '@agentproto/model-catalog';
@@ -37,8 +36,15 @@ declare const agentprotoConfigSchema: z.ZodObject<{
37
36
  spawn: z.ZodOptional<z.ZodType<SpawnConfig, unknown, z.core.$ZodTypeInternals<SpawnConfig, unknown>>>;
38
37
  sessions: z.ZodOptional<z.ZodType<SessionsConfig, unknown, z.core.$ZodTypeInternals<SessionsConfig, unknown>>>;
39
38
  provenance: z.ZodOptional<z.ZodType<ProvenanceConfig, unknown, z.core.$ZodTypeInternals<ProvenanceConfig, unknown>>>;
39
+ approvals: z.ZodOptional<z.ZodType<ApprovalsConfig, unknown, z.core.$ZodTypeInternals<ApprovalsConfig, unknown>>>;
40
40
  agentsMd: z.ZodOptional<z.ZodType<AgentsMdConfig, unknown, z.core.$ZodTypeInternals<AgentsMdConfig, unknown>>>;
41
+ models: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
42
+ model: z.ZodString;
43
+ route: z.ZodOptional<z.ZodString>;
44
+ profile: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$loose>]>>>;
41
46
  titler: z.ZodOptional<z.ZodType<TitlerConfig, unknown, z.core.$ZodTypeInternals<TitlerConfig, unknown>>>;
47
+ catalog: z.ZodOptional<z.ZodType<CatalogConfig, unknown, z.core.$ZodTypeInternals<CatalogConfig, unknown>>>;
42
48
  profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<ProfileConfig, unknown, z.core.$ZodTypeInternals<ProfileConfig, unknown>>>>;
43
49
  activeProfile: z.ZodOptional<z.ZodString>;
44
50
  defaults: z.ZodOptional<z.ZodType<SpawnDefaultsConfig, unknown, z.core.$ZodTypeInternals<SpawnDefaultsConfig, unknown>>>;
@@ -11,8 +11,8 @@ import '@agentproto/provider-presets';
11
11
  import '@agentproto/secrets/provision/recipe';
12
12
  import { z } from 'zod';
13
13
  import '@agentproto/auth';
14
- import 'child_process';
15
14
  import '@agentproto/command-sandbox';
15
+ import 'child_process';
16
16
  import '@agentproto/plugin-local-browser';
17
17
  import '@modelcontextprotocol/sdk/types.js';
18
18
  import '@agentproto/provider-kit';
@@ -62,11 +62,13 @@ var init_config = __esm({
62
62
  });
63
63
 
64
64
  // src/worktree-isolation.ts
65
- var WORKTREE_ISOLATION_ENV, DEFAULT_WORKTREE_ISOLATION;
65
+ var WORKTREE_ISOLATION_ENV, WORKTREE_PROVISION_CONCURRENCY_ENV, DEFAULT_WORKTREE_PROVISION_CONCURRENCY, DEFAULT_WORKTREE_ISOLATION;
66
66
  var init_worktree_isolation = __esm({
67
67
  "src/worktree-isolation.ts"() {
68
68
  init_config();
69
69
  WORKTREE_ISOLATION_ENV = "AGENTPROTO_WORKTREES_ISOLATION";
70
+ WORKTREE_PROVISION_CONCURRENCY_ENV = "AGENTPROTO_WORKTREES_PROVISION_CONCURRENCY";
71
+ DEFAULT_WORKTREE_PROVISION_CONCURRENCY = 2;
70
72
  DEFAULT_WORKTREE_ISOLATION = "on-request";
71
73
  }
72
74
  });
@@ -324,9 +326,9 @@ async function exportClaudeCodeSession(adapterSessionId, cwd, configDir) {
324
326
  let stream;
325
327
  try {
326
328
  stream = createReadStream(filePath, { encoding: "utf8" });
327
- await new Promise((resolve16, reject) => {
329
+ await new Promise((resolve17, reject) => {
328
330
  stream.once("error", reject);
329
- stream.once("open", resolve16);
331
+ stream.once("open", resolve17);
330
332
  });
331
333
  } catch (err) {
332
334
  const code = err.code;
@@ -600,7 +602,7 @@ async function discoverHermesSessions(cwd, since, expectedId) {
600
602
  }
601
603
  async function defaultHermesRunner(adapterSessionId) {
602
604
  const { spawn: spawn5 } = await import('child_process');
603
- return new Promise((resolve16, reject) => {
605
+ return new Promise((resolve17, reject) => {
604
606
  const chunks = [];
605
607
  const errChunks = [];
606
608
  const proc = spawn5(
@@ -619,7 +621,7 @@ async function defaultHermesRunner(adapterSessionId) {
619
621
  )
620
622
  );
621
623
  } else {
622
- resolve16(Buffer.concat(chunks).toString("utf8"));
624
+ resolve17(Buffer.concat(chunks).toString("utf8"));
623
625
  }
624
626
  });
625
627
  });
@@ -656,9 +658,9 @@ async function exportDaemonEventsSession(sessionId, desc) {
656
658
  let stream;
657
659
  try {
658
660
  stream = createReadStream(filePath, { encoding: "utf8" });
659
- await new Promise((resolve16, reject) => {
661
+ await new Promise((resolve17, reject) => {
660
662
  stream.once("error", reject);
661
- stream.once("open", resolve16);
663
+ stream.once("open", resolve17);
662
664
  });
663
665
  } catch (err) {
664
666
  const code = err.code;
@@ -1929,6 +1931,10 @@ var init_pr_provenance_stamp = __esm({
1929
1931
  init_pr_provenance();
1930
1932
  }
1931
1933
  });
1934
+ var init_app_boundary = __esm({
1935
+ "src/app-boundary.ts"() {
1936
+ }
1937
+ });
1932
1938
  var init_command_allowlist = __esm({
1933
1939
  "src/command-allowlist.ts"() {
1934
1940
  }
@@ -1937,10 +1943,16 @@ var init_command_tools = __esm({
1937
1943
  "src/command-tools.ts"() {
1938
1944
  init_sessions();
1939
1945
  init_pr_provenance_stamp();
1946
+ init_app_boundary();
1940
1947
  init_command_allowlist();
1941
1948
  init_command_allowlist();
1942
1949
  }
1943
1950
  });
1951
+ var init_process_stats = __esm({
1952
+ "src/process-stats.ts"() {
1953
+ z.preprocess((v) => v === "true" ? true : v === "false" ? false : v, z.union([z.boolean(), z.literal("full")])).optional();
1954
+ }
1955
+ });
1944
1956
  var init_workspaces_config = __esm({
1945
1957
  "src/workspaces-config.ts"() {
1946
1958
  }
@@ -1963,7 +1975,7 @@ var init_bundles = __esm({
1963
1975
  id: bundleIdSchema,
1964
1976
  label: z.string().min(1),
1965
1977
  description: z.string().min(1).optional(),
1966
- mcpImports: z.array(z.string().min(1)),
1978
+ mcpImports: z.union([z.array(z.string().min(1)), z.literal("*")]),
1967
1979
  includeDaemon: z.boolean().optional(),
1968
1980
  skills: z.array(z.string().min(1))
1969
1981
  });
@@ -1992,6 +2004,12 @@ var init_launch_config = __esm({
1992
2004
  }
1993
2005
  });
1994
2006
 
2007
+ // src/adapter-slug-hint.ts
2008
+ var init_adapter_slug_hint = __esm({
2009
+ "src/adapter-slug-hint.ts"() {
2010
+ }
2011
+ });
2012
+
1995
2013
  // src/context-continuity.ts
1996
2014
  var init_context_continuity = __esm({
1997
2015
  "src/context-continuity.ts"() {
@@ -2214,6 +2232,7 @@ var init_sandbox_adapters = __esm({
2214
2232
  });
2215
2233
  var init_session_spawn = __esm({
2216
2234
  "src/session-spawn.ts"() {
2235
+ init_process_stats();
2217
2236
  init_sessions();
2218
2237
  init_transcript_writer();
2219
2238
  init_workspaces_config();
@@ -2226,6 +2245,7 @@ var init_session_spawn = __esm({
2226
2245
  init_claude_code_oauth_source();
2227
2246
  init_providers_store();
2228
2247
  init_catalog_models();
2248
+ init_adapter_slug_hint();
2229
2249
  init_context_continuity();
2230
2250
  init_canonical_posture();
2231
2251
  init_user_presets();
@@ -2237,6 +2257,7 @@ var init_session_spawn = __esm({
2237
2257
  init_agents_md();
2238
2258
  init_workspace_rules();
2239
2259
  init_session_title();
2260
+ init_app_boundary();
2240
2261
  init_inference_binding();
2241
2262
  init_mcp_credential_deps();
2242
2263
  init_sandbox_agent_session_proxy();
@@ -2588,6 +2609,7 @@ var init_agent_tools = __esm({
2588
2609
  "src/agent-tools.ts"() {
2589
2610
  init_transcript_export();
2590
2611
  init_agent_start_schema();
2612
+ init_process_stats();
2591
2613
  init_spawn_field_schemas();
2592
2614
  init_session_spawn();
2593
2615
  init_canonical_posture();
@@ -2678,6 +2700,7 @@ var init_context_checkpoint = __esm({
2678
2700
  // src/session-continue-fresh.ts
2679
2701
  var init_session_continue_fresh = __esm({
2680
2702
  "src/session-continue-fresh.ts"() {
2703
+ init_app_boundary();
2681
2704
  init_context_checkpoint();
2682
2705
  init_context_continuity();
2683
2706
  init_session_spawn();
@@ -2738,6 +2761,21 @@ var init_gh_provenance_shim = __esm({
2738
2761
  DEFAULT_WRAP_GH = false;
2739
2762
  }
2740
2763
  });
2764
+ var DEFAULT_MODEL_ROLES;
2765
+ var init_model_roles = __esm({
2766
+ "src/model-roles.ts"() {
2767
+ DEFAULT_MODEL_ROLES = {
2768
+ /** Reviewer for a small residual (repo-maintenance `review` step). */
2769
+ "review.small": "claude-sonnet-5-5",
2770
+ /** Reviewer for a large residual + the retry reviewer. */
2771
+ "review.large": "claude-opus-5-5",
2772
+ /** CI pull-request reviewer (mirrors `.github/agentic-review.json`'s `reviewerModel`). */
2773
+ "review.pr": "openrouter/z-ai/glm-5.3-flash",
2774
+ /** The session-steward's agent judge. */
2775
+ "judge.session": "claude-sonnet-5-5"
2776
+ };
2777
+ }
2778
+ });
2741
2779
  function pathSegmentsMatch(entryPath, concretePath) {
2742
2780
  const entrySegs = entryPath.split(".");
2743
2781
  const concreteSegs = concretePath.split(".");
@@ -2745,7 +2783,8 @@ function pathSegmentsMatch(entryPath, concretePath) {
2745
2783
  return entrySegs.every((seg, i) => seg === "*" || seg === concreteSegs[i]);
2746
2784
  }
2747
2785
  function findConfigKey(path) {
2748
- return CONFIG_KEYS.find((entry) => pathSegmentsMatch(entry.path, path));
2786
+ const lookup = path.startsWith("models.") && path.length > "models.".length ? "models.*" : path;
2787
+ return CONFIG_KEYS.find((entry) => pathSegmentsMatch(entry.path, lookup));
2749
2788
  }
2750
2789
  function isKnownConfigPath(path) {
2751
2790
  return CONFIG_KEYS.some((entry) => entry.path === path) || CONFIG_KEYS_NOT_EXPOSED.some((entry) => entry.path === path);
@@ -2831,7 +2870,7 @@ function redactConfigValue(path, value) {
2831
2870
  }
2832
2871
  return { set: true };
2833
2872
  }
2834
- var contextContinuityPolicySchema, deferredToolsConfigSchema, spawnBrowserModeSchema, optionsMapSchema, defaultsAdapterAuthConfigSchema, defaultsAdapterConfigSchema, mcpDefaultsConfigSchema, spawnDefaultsConfigSchema, daemonConfigSchema, titlerConfigSchema, tunnelConfigSchema, featuresConfigSchema, worktreesConfigSchema, spawnConfigSchema, provenanceConfigSchema, sessionsConfigSchema, agentsMdConfigSchema, pairPageSchema, pairingConfigSchema, profileConfigSchema, acpAgentConfigEntrySchema, terminalPresetSchema, agentprotoConfigSchema, bool, str, num, strArray, CONFIG_KEYS, CONFIG_KEYS_NOT_EXPOSED;
2873
+ var contextContinuityPolicySchema, deferredToolsConfigSchema, spawnBrowserModeSchema, optionsMapSchema, defaultsAdapterAuthConfigSchema, defaultsAdapterConfigSchema, mcpDefaultsConfigSchema, spawnDefaultsConfigSchema, daemonConfigSchema, titlerConfigSchema, catalogConfigSchema, tunnelConfigSchema, featuresConfigSchema, worktreesConfigSchema, spawnConfigSchema, provenanceConfigSchema, approvalsConfigSchema, sessionsConfigSchema, agentsMdConfigSchema, pairPageSchema, pairingConfigSchema, modelRoleValueSchema, profileConfigSchema, acpAgentConfigEntrySchema, terminalPresetSchema, agentprotoConfigSchema, bool, str, num, strArray, CONFIG_KEYS, CONFIG_KEYS_NOT_EXPOSED;
2835
2874
  var init_config_schema = __esm({
2836
2875
  "src/config-schema.ts"() {
2837
2876
  init_worktree_isolation();
@@ -2841,6 +2880,7 @@ var init_config_schema = __esm({
2841
2880
  init_gh_provenance_shim();
2842
2881
  init_agents_md();
2843
2882
  init_session_titler();
2883
+ init_model_roles();
2844
2884
  init_background_task_wake();
2845
2885
  init_role();
2846
2886
  contextContinuityPolicySchema = z.object({
@@ -2926,6 +2966,9 @@ var init_config_schema = __esm({
2926
2966
  enabled: z.boolean().optional(),
2927
2967
  model: z.string().optional()
2928
2968
  }).passthrough();
2969
+ catalogConfigSchema = z.object({
2970
+ sources: z.array(z.object({ url: z.string() }).passthrough()).optional()
2971
+ }).passthrough();
2929
2972
  tunnelConfigSchema = z.object({
2930
2973
  host: z.string().optional(),
2931
2974
  token: z.string().optional(),
@@ -2940,13 +2983,17 @@ var init_config_schema = __esm({
2940
2983
  }).passthrough();
2941
2984
  worktreesConfigSchema = z.object({
2942
2985
  root: z.string().optional(),
2943
- isolation: z.enum(["always", "on-request", "never"]).optional()
2986
+ isolation: z.enum(["always", "on-request", "never"]).optional(),
2987
+ provisionConcurrency: z.number().int().min(0).optional(),
2988
+ provisionConcurrencyByRepo: z.record(z.string(), z.number().int().min(0)).optional(),
2989
+ provisionLoadFactor: z.number().min(0).optional()
2944
2990
  }).passthrough();
2945
2991
  spawnConfigSchema = z.object({
2946
2992
  attach: z.enum(["always", "on-request"]).optional(),
2947
2993
  dedupe: z.enum(["always", "on-request"]).optional()
2948
2994
  }).passthrough();
2949
2995
  provenanceConfigSchema = z.object({ wrapGh: z.boolean().optional() }).passthrough();
2996
+ approvalsConfigSchema = z.object({ webOrigins: z.array(z.string()).optional() }).passthrough();
2950
2997
  sessionsConfigSchema = z.object({
2951
2998
  attentionDelaySec: z.number().optional(),
2952
2999
  eventsDir: z.string().optional()
@@ -2964,6 +3011,14 @@ var init_config_schema = __esm({
2964
3011
  autoconnect: z.boolean().optional(),
2965
3012
  pairPage: pairPageSchema.optional()
2966
3013
  }).passthrough();
3014
+ modelRoleValueSchema = z.union([
3015
+ z.string().min(1),
3016
+ z.object({
3017
+ model: z.string().min(1),
3018
+ route: z.string().optional(),
3019
+ profile: z.string().optional()
3020
+ }).passthrough()
3021
+ ]);
2967
3022
  profileConfigSchema = z.object({
2968
3023
  daemon: daemonConfigSchema.optional(),
2969
3024
  tunnel: tunnelConfigSchema.optional(),
@@ -3002,8 +3057,11 @@ var init_config_schema = __esm({
3002
3057
  spawn: spawnConfigSchema.optional(),
3003
3058
  sessions: sessionsConfigSchema.optional(),
3004
3059
  provenance: provenanceConfigSchema.optional(),
3060
+ approvals: approvalsConfigSchema.optional(),
3005
3061
  agentsMd: agentsMdConfigSchema.optional(),
3062
+ models: z.record(z.string(), modelRoleValueSchema).optional(),
3006
3063
  titler: titlerConfigSchema.optional(),
3064
+ catalog: catalogConfigSchema.optional(),
3007
3065
  profiles: z.record(z.string(), profileConfigSchema).optional(),
3008
3066
  activeProfile: z.string().optional(),
3009
3067
  defaults: spawnDefaultsConfigSchema.optional(),
@@ -3054,6 +3112,16 @@ var init_config_schema = __esm({
3054
3112
  label: "Allowed origins",
3055
3113
  help: "Trusted browser origins for mutating /sessions/* routes, in addition to the hardcoded localhost defaults. Lockout: a bad value can lock a browser UI out."
3056
3114
  },
3115
+ {
3116
+ path: "approvals.webOrigins",
3117
+ schema: strArray,
3118
+ apply: "restart",
3119
+ writable: false,
3120
+ section: "daemon",
3121
+ label: "Approval web-click origins",
3122
+ help: "Origins allowed to decide a pending approval via POST /approvals/:id/decision (web_click channel). Empty (default) turns the channel off entirely. A SEPARATE allowlist from daemon.allowedOrigins, which is not automatically trusted to decide approvals. Lockout: a bad value can lock the web decision UI out.",
3123
+ default: []
3124
+ },
3057
3125
  {
3058
3126
  path: "daemon.strictOrigins",
3059
3127
  schema: bool,
@@ -3247,6 +3315,20 @@ var init_config_schema = __esm({
3247
3315
  default: DEFAULT_PAIR_PAGE
3248
3316
  },
3249
3317
  // ── models ──
3318
+ {
3319
+ // One row per configured role. Role names are dotted (`review.pr`), so a
3320
+ // concrete key is `models.review.pr` — `findConfigKey` maps any
3321
+ // `models.<role>` onto this entry, and `splitConfigPath` (config.ts) keeps
3322
+ // the role as ONE segment. The full role list (incl. built-in defaults and
3323
+ // where each value comes from) is the `model_roles` tool.
3324
+ path: "models.*",
3325
+ schema: modelRoleValueSchema,
3326
+ apply: "hot",
3327
+ writable: true,
3328
+ section: "models",
3329
+ label: "Model role",
3330
+ help: `Model for a role (review.small, review.large, review.pr, judge.session, \u2026): a model id, or { model, route?, profile? }. Precedence: explicit run input > the repo's agentproto.json \`models\` > this daemon config > built-in default (\`model_roles\` lists every role and its source). Built-in defaults: ${Object.entries(DEFAULT_MODEL_ROLES).map(([r, m]) => `${r}=${m}`).join(", ")}.`
3331
+ },
3250
3332
  {
3251
3333
  path: "titler.model",
3252
3334
  schema: str,
@@ -3257,6 +3339,16 @@ var init_config_schema = __esm({
3257
3339
  help: "OpenRouter model id used to generate session titles. Requires OPENROUTER_API_KEY.",
3258
3340
  default: DEFAULT_TITLER_MODEL
3259
3341
  },
3342
+ // ── daemon: app catalog ──
3343
+ {
3344
+ path: "catalog.sources",
3345
+ schema: z.array(z.object({ url: str }).passthrough()),
3346
+ apply: "hot",
3347
+ writable: true,
3348
+ section: "daemon",
3349
+ label: "App catalog sources",
3350
+ help: "Remote catalogs merged into `app_catalog`: an array of `{ url }`, each returning `{ entries: AppCatalogEntry[] }`. Wins over `sources` in ~/.agentproto/app-catalog.json when both are set."
3351
+ },
3260
3352
  // ── defaults: spawn ──
3261
3353
  {
3262
3354
  path: "defaults.skills",
@@ -3336,6 +3428,36 @@ var init_config_schema = __esm({
3336
3428
  help: "Whether a freshly-spawned agent_start session is isolated into its own git worktree.",
3337
3429
  default: DEFAULT_WORKTREE_ISOLATION
3338
3430
  },
3431
+ {
3432
+ path: "worktrees.provisionConcurrency",
3433
+ schema: z.number().int().min(0),
3434
+ apply: "hot",
3435
+ env: WORKTREE_PROVISION_CONCURRENCY_ENV,
3436
+ writable: true,
3437
+ section: "defaults",
3438
+ label: "Worktree provisioning concurrency",
3439
+ help: "Max worktree provisionings running their heavy phases (depsCmd, clones, setup hooks) at once; the rest queue FIFO. 0 = unlimited.",
3440
+ default: DEFAULT_WORKTREE_PROVISION_CONCURRENCY
3441
+ },
3442
+ {
3443
+ path: "worktrees.provisionConcurrencyByRepo",
3444
+ schema: z.record(str, z.number().int().min(0)),
3445
+ apply: "hot",
3446
+ writable: true,
3447
+ section: "defaults",
3448
+ label: "Per-repo provisioning concurrency",
3449
+ help: "Per-repo caps on concurrent heavy provisioning, keyed by repo path or directory name; never looser than the global cap."
3450
+ },
3451
+ {
3452
+ path: "worktrees.provisionLoadFactor",
3453
+ schema: z.number().min(0),
3454
+ apply: "hot",
3455
+ writable: true,
3456
+ section: "defaults",
3457
+ label: "Provisioning load guard factor",
3458
+ help: "Hold back a new heavy provisioning while the 1-minute load average exceeds cores x this factor. 0 or unset = off.",
3459
+ default: 0
3460
+ },
3339
3461
  {
3340
3462
  path: "spawn.attach",
3341
3463
  schema: z.enum(["always", "on-request"]),