@songsid/agend 2.1.5-beta.11 → 2.1.5-beta.13

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.
@@ -153,6 +153,13 @@ export interface FleetContext {
153
153
  cancelInstallSession?(): Promise<string>;
154
154
  /** Human-readable effective model for an instance (resolves inherited defaults). */
155
155
  modelDisplayForInstance?(name: string): string;
156
+ /** How this instance's backend takes a reasoning-effort setting, if at all. */
157
+ effortStrategyFor?(name: string): "runtime" | "restart" | "unsupported";
158
+ /** Configured effort for an instance: per-instance, else fleet default, else none. */
159
+ resolveInstanceEffort?(name: string): {
160
+ effort: string | null;
161
+ source: "instance" | "fleet-default" | "unset";
162
+ };
156
163
  /**
157
164
  * Show a model-selection inline keyboard for the given instance in a TG topic.
158
165
  * Returns a fallback text message if no model list is available (caller should send it).
@@ -88,6 +88,15 @@ export interface DeliveryOptions {
88
88
  * The wait is announced before it starts, so it reads as progress, not a stall.
89
89
  */
90
90
  export declare const CLI_ENV_PROBE_DEADLINE_MS = 16000;
91
+ /**
92
+ * How many CLIs may cold-start at once, from BOTH memory and cores.
93
+ *
94
+ * Memory alone said 10 on any host with roughly 3GB free, so a three-core box
95
+ * started ten CLIs together, saturated the CPU, and healthy starts then missed
96
+ * their startup budget — which used to cost the user their conversation. Cores
97
+ * bound how many can actually make progress; memory bounds how many fit.
98
+ */
99
+ export declare function deriveSpawnConcurrency(freeMemMB: number, cores: number): number;
91
100
  export declare class FleetManager implements FleetContext, LifecycleContext, ArchiverContext, StatuslineWatcherContext, OutboundContext, AgentEndpointContext {
92
101
  dataDir: string;
93
102
  private static signalTarget;
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync, mkdirSync, writeFileSync, unlinkSync, rmSync, readdirSync, renameSync, copyFileSync, chmodSync, statSync } from "node:fs";
2
2
  import { randomBytes } from "node:crypto";
3
3
  import { spawnSync } from "node:child_process";
4
- import { freemem, totalmem } from "node:os";
4
+ import { freemem, totalmem, cpus } from "node:os";
5
5
  import { createServer } from "node:http";
6
6
  import { join, dirname, basename } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
@@ -262,6 +262,18 @@ const CLI_ENV_FRESH_MS = 60 * 60 * 1000;
262
262
  * The wait is announced before it starts, so it reads as progress, not a stall.
263
263
  */
264
264
  export const CLI_ENV_PROBE_DEADLINE_MS = 16_000;
265
+ /**
266
+ * How many CLIs may cold-start at once, from BOTH memory and cores.
267
+ *
268
+ * Memory alone said 10 on any host with roughly 3GB free, so a three-core box
269
+ * started ten CLIs together, saturated the CPU, and healthy starts then missed
270
+ * their startup budget — which used to cost the user their conversation. Cores
271
+ * bound how many can actually make progress; memory bounds how many fit.
272
+ */
273
+ export function deriveSpawnConcurrency(freeMemMB, cores) {
274
+ const byMemory = Math.floor(freeMemMB / 300);
275
+ return Math.max(2, Math.min(10, byMemory, Math.max(1, cores)));
276
+ }
265
277
  export class FleetManager {
266
278
  dataDir;
267
279
  static signalTarget = null;
@@ -452,8 +464,7 @@ export class FleetManager {
452
464
  const explicit = this.fleetConfig?.defaults?.startup?.concurrency;
453
465
  if (explicit != null)
454
466
  return Math.max(1, Math.min(20, explicit));
455
- const freeMemMB = Math.round(freemem() / (1024 * 1024));
456
- return Math.max(2, Math.min(10, Math.floor(freeMemMB / 300)));
467
+ return deriveSpawnConcurrency(Math.round(freemem() / (1024 * 1024)), cpus().length);
457
468
  }
458
469
  /** Wire the one fleet-wide storm into notification and recovery surfaces. */
459
470
  bindStormWindowEvents() {
@@ -8096,7 +8107,7 @@ You CAN write code snippets, explain code, and answer technical questions direct
8096
8107
  - **Delegate to 1 instance**: scoped to one project/repo, needs file access or execution.
8097
8108
  - **Coordinate multiple**: spans repos, outputs feed each other, or parallel helps (max 3 per task).
8098
8109
 
8099
- Instance discovery order: list_teams() → list_instances() → describe_instance() → create_instance() only if nothing fits. Prefer reuse; never duplicate a running instance.
8110
+ Instance discovery: start with list_instances(); follow the guidance in its response. Prefer reuse; never duplicate a running instance.
8100
8111
 
8101
8112
  ## Reply Contract
8102
8113