@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,5 +1,5 @@
1
1
  import { CostBudget } from '@agentproto/auth';
2
- import { C as ContextContinuityPolicy } from './context-continuity-BfNVbX5W.js';
2
+ import { C as ContextContinuityPolicy } from './spawn-defaults-Cp9SGZex.js';
3
3
 
4
4
  /**
5
5
  * SessionConfig — the unified per-session config surface, decomposed into
@@ -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';
@@ -57,11 +57,13 @@ var __copyProps = (to, from, except, desc) => {
57
57
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
58
58
 
59
59
  // src/worktree-isolation.ts
60
- var WORKTREE_ISOLATION_ENV, DEFAULT_WORKTREE_ISOLATION;
60
+ var WORKTREE_ISOLATION_ENV, WORKTREE_PROVISION_CONCURRENCY_ENV, DEFAULT_WORKTREE_PROVISION_CONCURRENCY, DEFAULT_WORKTREE_ISOLATION;
61
61
  var init_worktree_isolation = __esm({
62
62
  "src/worktree-isolation.ts"() {
63
63
  init_config();
64
64
  WORKTREE_ISOLATION_ENV = "AGENTPROTO_WORKTREES_ISOLATION";
65
+ WORKTREE_PROVISION_CONCURRENCY_ENV = "AGENTPROTO_WORKTREES_PROVISION_CONCURRENCY";
66
+ DEFAULT_WORKTREE_PROVISION_CONCURRENCY = 2;
65
67
  DEFAULT_WORKTREE_ISOLATION = "on-request";
66
68
  }
67
69
  });
@@ -309,9 +311,9 @@ async function exportClaudeCodeSession(adapterSessionId, cwd, configDir) {
309
311
  let stream;
310
312
  try {
311
313
  stream = createReadStream(filePath, { encoding: "utf8" });
312
- await new Promise((resolve16, reject) => {
314
+ await new Promise((resolve17, reject) => {
313
315
  stream.once("error", reject);
314
- stream.once("open", resolve16);
316
+ stream.once("open", resolve17);
315
317
  });
316
318
  } catch (err) {
317
319
  const code = err.code;
@@ -585,7 +587,7 @@ async function discoverHermesSessions(cwd, since, expectedId) {
585
587
  }
586
588
  async function defaultHermesRunner(adapterSessionId) {
587
589
  const { spawn: spawn5 } = await import('child_process');
588
- return new Promise((resolve16, reject) => {
590
+ return new Promise((resolve17, reject) => {
589
591
  const chunks = [];
590
592
  const errChunks = [];
591
593
  const proc = spawn5(
@@ -604,7 +606,7 @@ async function defaultHermesRunner(adapterSessionId) {
604
606
  )
605
607
  );
606
608
  } else {
607
- resolve16(Buffer.concat(chunks).toString("utf8"));
609
+ resolve17(Buffer.concat(chunks).toString("utf8"));
608
610
  }
609
611
  });
610
612
  });
@@ -641,9 +643,9 @@ async function exportDaemonEventsSession(sessionId, desc) {
641
643
  let stream;
642
644
  try {
643
645
  stream = createReadStream(filePath, { encoding: "utf8" });
644
- await new Promise((resolve16, reject) => {
646
+ await new Promise((resolve17, reject) => {
645
647
  stream.once("error", reject);
646
- stream.once("open", resolve16);
648
+ stream.once("open", resolve17);
647
649
  });
648
650
  } catch (err) {
649
651
  const code = err.code;
@@ -1914,6 +1916,10 @@ var init_pr_provenance_stamp = __esm({
1914
1916
  init_pr_provenance();
1915
1917
  }
1916
1918
  });
1919
+ var init_app_boundary = __esm({
1920
+ "src/app-boundary.ts"() {
1921
+ }
1922
+ });
1917
1923
  var init_command_allowlist = __esm({
1918
1924
  "src/command-allowlist.ts"() {
1919
1925
  }
@@ -1922,10 +1928,16 @@ var init_command_tools = __esm({
1922
1928
  "src/command-tools.ts"() {
1923
1929
  init_sessions();
1924
1930
  init_pr_provenance_stamp();
1931
+ init_app_boundary();
1925
1932
  init_command_allowlist();
1926
1933
  init_command_allowlist();
1927
1934
  }
1928
1935
  });
1936
+ var init_process_stats = __esm({
1937
+ "src/process-stats.ts"() {
1938
+ z.preprocess((v) => v === "true" ? true : v === "false" ? false : v, z.union([z.boolean(), z.literal("full")])).optional();
1939
+ }
1940
+ });
1929
1941
  var init_workspaces_config = __esm({
1930
1942
  "src/workspaces-config.ts"() {
1931
1943
  }
@@ -1948,7 +1960,7 @@ var init_bundles = __esm({
1948
1960
  id: bundleIdSchema,
1949
1961
  label: z.string().min(1),
1950
1962
  description: z.string().min(1).optional(),
1951
- mcpImports: z.array(z.string().min(1)),
1963
+ mcpImports: z.union([z.array(z.string().min(1)), z.literal("*")]),
1952
1964
  includeDaemon: z.boolean().optional(),
1953
1965
  skills: z.array(z.string().min(1))
1954
1966
  });
@@ -1977,6 +1989,12 @@ var init_launch_config = __esm({
1977
1989
  }
1978
1990
  });
1979
1991
 
1992
+ // src/adapter-slug-hint.ts
1993
+ var init_adapter_slug_hint = __esm({
1994
+ "src/adapter-slug-hint.ts"() {
1995
+ }
1996
+ });
1997
+
1980
1998
  // src/context-continuity.ts
1981
1999
  var init_context_continuity = __esm({
1982
2000
  "src/context-continuity.ts"() {
@@ -2199,6 +2217,7 @@ var init_sandbox_adapters = __esm({
2199
2217
  });
2200
2218
  var init_session_spawn = __esm({
2201
2219
  "src/session-spawn.ts"() {
2220
+ init_process_stats();
2202
2221
  init_sessions();
2203
2222
  init_transcript_writer();
2204
2223
  init_workspaces_config();
@@ -2211,6 +2230,7 @@ var init_session_spawn = __esm({
2211
2230
  init_claude_code_oauth_source();
2212
2231
  init_providers_store();
2213
2232
  init_catalog_models();
2233
+ init_adapter_slug_hint();
2214
2234
  init_context_continuity();
2215
2235
  init_canonical_posture();
2216
2236
  init_user_presets();
@@ -2222,6 +2242,7 @@ var init_session_spawn = __esm({
2222
2242
  init_agents_md();
2223
2243
  init_workspace_rules();
2224
2244
  init_session_title();
2245
+ init_app_boundary();
2225
2246
  init_inference_binding();
2226
2247
  init_mcp_credential_deps();
2227
2248
  init_sandbox_agent_session_proxy();
@@ -2573,6 +2594,7 @@ var init_agent_tools = __esm({
2573
2594
  "src/agent-tools.ts"() {
2574
2595
  init_transcript_export();
2575
2596
  init_agent_start_schema();
2597
+ init_process_stats();
2576
2598
  init_spawn_field_schemas();
2577
2599
  init_session_spawn();
2578
2600
  init_canonical_posture();
@@ -2663,6 +2685,7 @@ var init_context_checkpoint = __esm({
2663
2685
  // src/session-continue-fresh.ts
2664
2686
  var init_session_continue_fresh = __esm({
2665
2687
  "src/session-continue-fresh.ts"() {
2688
+ init_app_boundary();
2666
2689
  init_context_checkpoint();
2667
2690
  init_context_continuity();
2668
2691
  init_session_spawn();
@@ -2723,6 +2746,21 @@ var init_gh_provenance_shim = __esm({
2723
2746
  DEFAULT_WRAP_GH = false;
2724
2747
  }
2725
2748
  });
2749
+ var DEFAULT_MODEL_ROLES;
2750
+ var init_model_roles = __esm({
2751
+ "src/model-roles.ts"() {
2752
+ DEFAULT_MODEL_ROLES = {
2753
+ /** Reviewer for a small residual (repo-maintenance `review` step). */
2754
+ "review.small": "claude-sonnet-5-5",
2755
+ /** Reviewer for a large residual + the retry reviewer. */
2756
+ "review.large": "claude-opus-5-5",
2757
+ /** CI pull-request reviewer (mirrors `.github/agentic-review.json`'s `reviewerModel`). */
2758
+ "review.pr": "openrouter/z-ai/glm-5.3-flash",
2759
+ /** The session-steward's agent judge. */
2760
+ "judge.session": "claude-sonnet-5-5"
2761
+ };
2762
+ }
2763
+ });
2726
2764
  function validateConfig(raw) {
2727
2765
  const result = agentprotoConfigSchema.safeParse(raw);
2728
2766
  if (result.success) return { ok: true, issues: [] };
@@ -2732,7 +2770,7 @@ function validateConfig(raw) {
2732
2770
  });
2733
2771
  return { ok: false, issues };
2734
2772
  }
2735
- 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;
2773
+ 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;
2736
2774
  var init_config_schema = __esm({
2737
2775
  "src/config-schema.ts"() {
2738
2776
  init_worktree_isolation();
@@ -2742,6 +2780,7 @@ var init_config_schema = __esm({
2742
2780
  init_gh_provenance_shim();
2743
2781
  init_agents_md();
2744
2782
  init_session_titler();
2783
+ init_model_roles();
2745
2784
  init_background_task_wake();
2746
2785
  init_role();
2747
2786
  contextContinuityPolicySchema = z.object({
@@ -2827,6 +2866,9 @@ var init_config_schema = __esm({
2827
2866
  enabled: z.boolean().optional(),
2828
2867
  model: z.string().optional()
2829
2868
  }).passthrough();
2869
+ catalogConfigSchema = z.object({
2870
+ sources: z.array(z.object({ url: z.string() }).passthrough()).optional()
2871
+ }).passthrough();
2830
2872
  tunnelConfigSchema = z.object({
2831
2873
  host: z.string().optional(),
2832
2874
  token: z.string().optional(),
@@ -2841,13 +2883,17 @@ var init_config_schema = __esm({
2841
2883
  }).passthrough();
2842
2884
  worktreesConfigSchema = z.object({
2843
2885
  root: z.string().optional(),
2844
- isolation: z.enum(["always", "on-request", "never"]).optional()
2886
+ isolation: z.enum(["always", "on-request", "never"]).optional(),
2887
+ provisionConcurrency: z.number().int().min(0).optional(),
2888
+ provisionConcurrencyByRepo: z.record(z.string(), z.number().int().min(0)).optional(),
2889
+ provisionLoadFactor: z.number().min(0).optional()
2845
2890
  }).passthrough();
2846
2891
  spawnConfigSchema = z.object({
2847
2892
  attach: z.enum(["always", "on-request"]).optional(),
2848
2893
  dedupe: z.enum(["always", "on-request"]).optional()
2849
2894
  }).passthrough();
2850
2895
  provenanceConfigSchema = z.object({ wrapGh: z.boolean().optional() }).passthrough();
2896
+ approvalsConfigSchema = z.object({ webOrigins: z.array(z.string()).optional() }).passthrough();
2851
2897
  sessionsConfigSchema = z.object({
2852
2898
  attentionDelaySec: z.number().optional(),
2853
2899
  eventsDir: z.string().optional()
@@ -2865,6 +2911,14 @@ var init_config_schema = __esm({
2865
2911
  autoconnect: z.boolean().optional(),
2866
2912
  pairPage: pairPageSchema.optional()
2867
2913
  }).passthrough();
2914
+ modelRoleValueSchema = z.union([
2915
+ z.string().min(1),
2916
+ z.object({
2917
+ model: z.string().min(1),
2918
+ route: z.string().optional(),
2919
+ profile: z.string().optional()
2920
+ }).passthrough()
2921
+ ]);
2868
2922
  profileConfigSchema = z.object({
2869
2923
  daemon: daemonConfigSchema.optional(),
2870
2924
  tunnel: tunnelConfigSchema.optional(),
@@ -2903,8 +2957,11 @@ var init_config_schema = __esm({
2903
2957
  spawn: spawnConfigSchema.optional(),
2904
2958
  sessions: sessionsConfigSchema.optional(),
2905
2959
  provenance: provenanceConfigSchema.optional(),
2960
+ approvals: approvalsConfigSchema.optional(),
2906
2961
  agentsMd: agentsMdConfigSchema.optional(),
2962
+ models: z.record(z.string(), modelRoleValueSchema).optional(),
2907
2963
  titler: titlerConfigSchema.optional(),
2964
+ catalog: catalogConfigSchema.optional(),
2908
2965
  profiles: z.record(z.string(), profileConfigSchema).optional(),
2909
2966
  activeProfile: z.string().optional(),
2910
2967
  defaults: spawnDefaultsConfigSchema.optional(),
@@ -2955,6 +3012,16 @@ var init_config_schema = __esm({
2955
3012
  label: "Allowed origins",
2956
3013
  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."
2957
3014
  },
3015
+ {
3016
+ path: "approvals.webOrigins",
3017
+ schema: strArray,
3018
+ apply: "restart",
3019
+ writable: false,
3020
+ section: "daemon",
3021
+ label: "Approval web-click origins",
3022
+ 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.",
3023
+ default: []
3024
+ },
2958
3025
  {
2959
3026
  path: "daemon.strictOrigins",
2960
3027
  schema: bool,
@@ -3148,6 +3215,20 @@ var init_config_schema = __esm({
3148
3215
  default: DEFAULT_PAIR_PAGE
3149
3216
  },
3150
3217
  // ── models ──
3218
+ {
3219
+ // One row per configured role. Role names are dotted (`review.pr`), so a
3220
+ // concrete key is `models.review.pr` — `findConfigKey` maps any
3221
+ // `models.<role>` onto this entry, and `splitConfigPath` (config.ts) keeps
3222
+ // the role as ONE segment. The full role list (incl. built-in defaults and
3223
+ // where each value comes from) is the `model_roles` tool.
3224
+ path: "models.*",
3225
+ schema: modelRoleValueSchema,
3226
+ apply: "hot",
3227
+ writable: true,
3228
+ section: "models",
3229
+ label: "Model role",
3230
+ 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(", ")}.`
3231
+ },
3151
3232
  {
3152
3233
  path: "titler.model",
3153
3234
  schema: str,
@@ -3158,6 +3239,16 @@ var init_config_schema = __esm({
3158
3239
  help: "OpenRouter model id used to generate session titles. Requires OPENROUTER_API_KEY.",
3159
3240
  default: DEFAULT_TITLER_MODEL
3160
3241
  },
3242
+ // ── daemon: app catalog ──
3243
+ {
3244
+ path: "catalog.sources",
3245
+ schema: z.array(z.object({ url: str }).passthrough()),
3246
+ apply: "hot",
3247
+ writable: true,
3248
+ section: "daemon",
3249
+ label: "App catalog sources",
3250
+ 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."
3251
+ },
3161
3252
  // ── defaults: spawn ──
3162
3253
  {
3163
3254
  path: "defaults.skills",
@@ -3237,6 +3328,36 @@ var init_config_schema = __esm({
3237
3328
  help: "Whether a freshly-spawned agent_start session is isolated into its own git worktree.",
3238
3329
  default: DEFAULT_WORKTREE_ISOLATION
3239
3330
  },
3331
+ {
3332
+ path: "worktrees.provisionConcurrency",
3333
+ schema: z.number().int().min(0),
3334
+ apply: "hot",
3335
+ env: WORKTREE_PROVISION_CONCURRENCY_ENV,
3336
+ writable: true,
3337
+ section: "defaults",
3338
+ label: "Worktree provisioning concurrency",
3339
+ help: "Max worktree provisionings running their heavy phases (depsCmd, clones, setup hooks) at once; the rest queue FIFO. 0 = unlimited.",
3340
+ default: DEFAULT_WORKTREE_PROVISION_CONCURRENCY
3341
+ },
3342
+ {
3343
+ path: "worktrees.provisionConcurrencyByRepo",
3344
+ schema: z.record(str, z.number().int().min(0)),
3345
+ apply: "hot",
3346
+ writable: true,
3347
+ section: "defaults",
3348
+ label: "Per-repo provisioning concurrency",
3349
+ help: "Per-repo caps on concurrent heavy provisioning, keyed by repo path or directory name; never looser than the global cap."
3350
+ },
3351
+ {
3352
+ path: "worktrees.provisionLoadFactor",
3353
+ schema: z.number().min(0),
3354
+ apply: "hot",
3355
+ writable: true,
3356
+ section: "defaults",
3357
+ label: "Provisioning load guard factor",
3358
+ help: "Hold back a new heavy provisioning while the 1-minute load average exceeds cores x this factor. 0 or unset = off.",
3359
+ default: 0
3360
+ },
3240
3361
  {
3241
3362
  path: "spawn.attach",
3242
3363
  schema: z.enum(["always", "on-request"]),