@jmanuelcorral/openteam 0.15.1 → 0.16.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.
- package/README.es.md +1 -1
- package/README.md +1 -1
- package/dist/cli.js +11 -5
- package/dist/config/errors.d.ts.map +1 -1
- package/dist/config/schema.d.ts +22 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -19
- package/dist/local/concurrency.d.ts +74 -16
- package/dist/local/concurrency.d.ts.map +1 -1
- package/dist/orchestrator/coordinator.d.ts.map +1 -1
- package/package.json +1 -1
package/README.es.md
CHANGED
|
@@ -824,7 +824,7 @@ Consulta [docs/compatibility.md](docs/compatibility.md). Resumen verificado el `
|
|
|
824
824
|
|
|
825
825
|
| Superficie | Versión / contrato |
|
|
826
826
|
| --- | --- |
|
|
827
|
-
| openteam | `0.
|
|
827
|
+
| openteam | `0.16.0`; versión actual del paquete |
|
|
828
828
|
| `@opencode-ai/plugin` | `1.18.19` |
|
|
829
829
|
| `@opencode-ai/sdk` | `1.18.19` |
|
|
830
830
|
| Hook de routing | `chat.message`; no `chat.params` para cambiar modelo |
|
package/README.md
CHANGED
|
@@ -713,7 +713,7 @@ See [docs/compatibility.md](docs/compatibility.md). Verified summary as of `2026
|
|
|
713
713
|
|
|
714
714
|
| Surface | Version / contract |
|
|
715
715
|
| --- | --- |
|
|
716
|
-
| openteam | `0.
|
|
716
|
+
| openteam | `0.16.0`; current package version |
|
|
717
717
|
| `@opencode-ai/plugin` | `1.18.19` |
|
|
718
718
|
| `@opencode-ai/sdk` | `1.18.19` |
|
|
719
719
|
| Routing hook | `chat.message`; not `chat.params` for model changes |
|
package/dist/cli.js
CHANGED
|
@@ -448,7 +448,8 @@ var LocalRuntimeSchema = z2.object({
|
|
|
448
448
|
baseURL: z2.string().url().optional(),
|
|
449
449
|
discovery: z2.enum(["cli", "sdk", "manual"]).optional(),
|
|
450
450
|
defaultModel: ModelRefSchema,
|
|
451
|
-
maxConcurrency: z2.number().int().positive().optional()
|
|
451
|
+
maxConcurrency: z2.number().int().positive().optional(),
|
|
452
|
+
reservedInteractiveSlots: z2.number().int().nonnegative().optional()
|
|
452
453
|
}).strict().superRefine((runtime, ctx) => {
|
|
453
454
|
const resolvedKind = runtime.kind ?? runtime.id;
|
|
454
455
|
if (!LocalRuntimeKindSchema.safeParse(resolvedKind).success) {
|
|
@@ -1900,6 +1901,9 @@ function warnUnknownRole(roleID, warn, warnedRoles) {
|
|
|
1900
1901
|
function roleFor(input) {
|
|
1901
1902
|
return getRoleProfile(input.roleID, input.config.orchestrator?.roles) ?? synthesiseFallbackProfile(input.roleID);
|
|
1902
1903
|
}
|
|
1904
|
+
function priorityForRole(role) {
|
|
1905
|
+
return role.roleID === "scribe" ? "background" : "worker";
|
|
1906
|
+
}
|
|
1903
1907
|
function mandatoryLocalRuntimeMessage(roleID) {
|
|
1904
1908
|
return `openteam: role "${roleID}" requires a local runtime, but no local runtime is reachable. ` + `This role must run locally and will not fall back to a frontier provider. ` + `Start one of the supported local runtimes (Ollama, LM Studio, or Lemonade) and try again. ` + "Run `openteam doctor` to diagnose your local runtime configuration.";
|
|
1905
1909
|
}
|
|
@@ -2258,10 +2262,11 @@ async function runRoleTaskWithCorrelation(input, deps, correlation, batch) {
|
|
|
2258
2262
|
let queueObservation;
|
|
2259
2263
|
if (runtimeId !== undefined && deps.runtimeLimiter !== undefined) {
|
|
2260
2264
|
const limiter = deps.runtimeLimiter;
|
|
2261
|
-
|
|
2265
|
+
const priority = priorityForRole(role);
|
|
2266
|
+
release = limiter.tryAcquire(runtimeId, priority);
|
|
2262
2267
|
let waitedMs = 0;
|
|
2263
2268
|
if (release === undefined) {
|
|
2264
|
-
const acquisition = await limiter.acquire(runtimeId);
|
|
2269
|
+
const acquisition = await limiter.acquire(runtimeId, priority);
|
|
2265
2270
|
release = acquisition.release;
|
|
2266
2271
|
waitedMs = acquisition.waitedMs;
|
|
2267
2272
|
}
|
|
@@ -3069,7 +3074,8 @@ var KNOWN_CONFIG_KEYS_BY_PATH = new Map([
|
|
|
3069
3074
|
"baseURL",
|
|
3070
3075
|
"discovery",
|
|
3071
3076
|
"defaultModel",
|
|
3072
|
-
"maxConcurrency"
|
|
3077
|
+
"maxConcurrency",
|
|
3078
|
+
"reservedInteractiveSlots"
|
|
3073
3079
|
]
|
|
3074
3080
|
],
|
|
3075
3081
|
["local.runtimes[].defaultModel", MODEL_REF_KEYS],
|
|
@@ -15839,7 +15845,7 @@ async function buildMemoryRuntimeFromConfig(config, deps, options = {}) {
|
|
|
15839
15845
|
// package.json
|
|
15840
15846
|
var package_default = {
|
|
15841
15847
|
name: "@jmanuelcorral/openteam",
|
|
15842
|
-
version: "0.
|
|
15848
|
+
version: "0.16.0",
|
|
15843
15849
|
packageManager: "bun@1.3.14",
|
|
15844
15850
|
description: "Cost-aware, local-first routing plugin for opencode with cheapest-capable frontier fallback and multi-agent orchestration.",
|
|
15845
15851
|
license: "MIT",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/config/errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,WAAW,CAAC;AAIlC,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/config/errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,WAAW,CAAC;AAIlC,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CA6GzE,CAAC;AAgIL,KAAK,6BAA6B,GAAG;IACnC,QAAQ,CAAC,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IAClE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,6BAAkC,GAC1C,MAAM,CA0BR;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKxD"}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -145,6 +145,7 @@ export declare const LocalRuntimeSchema: z.ZodObject<{
|
|
|
145
145
|
modelID: z.ZodString;
|
|
146
146
|
}, z.core.$strict>;
|
|
147
147
|
maxConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
reservedInteractiveSlots: z.ZodOptional<z.ZodNumber>;
|
|
148
149
|
}, z.core.$strict>;
|
|
149
150
|
/**
|
|
150
151
|
* Resolves the adapter {@link LocalRuntimeKind} of a configured runtime (#214).
|
|
@@ -153,6 +154,25 @@ export declare const LocalRuntimeSchema: z.ZodObject<{
|
|
|
153
154
|
* whose effective kind is not a known adapter kind.
|
|
154
155
|
*/
|
|
155
156
|
export declare function localRuntimeKind(runtime: Pick<LocalRuntime, "id" | "kind">): LocalRuntimeKind;
|
|
157
|
+
/**
|
|
158
|
+
* Resolves the effective concurrency cap for a runtime (#144): its declared
|
|
159
|
+
* `maxConcurrency`, or {@link DEFAULT_LOCAL_MAX_CONCURRENCY} when unset. This is
|
|
160
|
+
* the value fed to the limiter's `capacityFor`.
|
|
161
|
+
*/
|
|
162
|
+
export declare function effectiveMaxConcurrency(runtime: Pick<LocalRuntime, "maxConcurrency">): number;
|
|
163
|
+
/**
|
|
164
|
+
* Resolves the number of interactive-reserved slots for a runtime (#213), fed to
|
|
165
|
+
* the limiter's `reservedInteractiveFor`.
|
|
166
|
+
*
|
|
167
|
+
* When `reservedInteractiveSlots` is declared it is honoured verbatim; otherwise
|
|
168
|
+
* the default is **1 for a runtime with >= 2 effective slots** and **0 for a
|
|
169
|
+
* single-slot runtime**. That default gives Jose's 4-slot Lemonade box a
|
|
170
|
+
* 3-worker + 1-reserved split with ZERO config changes — exactly the requested
|
|
171
|
+
* behaviour — while never reserving the only slot of a single-slot runtime. The
|
|
172
|
+
* limiter additionally clamps the value to `[0, capacity - 1]`, so an explicit
|
|
173
|
+
* over-reservation still cannot starve the worker budget.
|
|
174
|
+
*/
|
|
175
|
+
export declare function effectiveReservedInteractiveSlots(runtime: Pick<LocalRuntime, "maxConcurrency" | "reservedInteractiveSlots">): number;
|
|
156
176
|
/**
|
|
157
177
|
* Bloque de memoria semántica long-term (capa de conocimiento). Opt-in y
|
|
158
178
|
* desactivado por defecto (ADR-1..6). Privacy-first: `storeContent=false` guarda
|
|
@@ -317,6 +337,7 @@ export declare const OpenTeamConfigObjectSchema: z.ZodObject<{
|
|
|
317
337
|
modelID: z.ZodString;
|
|
318
338
|
}, z.core.$strict>;
|
|
319
339
|
maxConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
340
|
+
reservedInteractiveSlots: z.ZodOptional<z.ZodNumber>;
|
|
320
341
|
}, z.core.$strict>>>;
|
|
321
342
|
}, z.core.$strict>>;
|
|
322
343
|
budgets: z.ZodDefault<z.ZodObject<{
|
|
@@ -471,6 +492,7 @@ export declare const OpenTeamConfigSchema: z.ZodObject<{
|
|
|
471
492
|
modelID: z.ZodString;
|
|
472
493
|
}, z.core.$strict>;
|
|
473
494
|
maxConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
495
|
+
reservedInteractiveSlots: z.ZodOptional<z.ZodNumber>;
|
|
474
496
|
}, z.core.$strict>>>;
|
|
475
497
|
}, z.core.$strict>>;
|
|
476
498
|
budgets: z.ZodDefault<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAC;AAG/B,e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AA,MAAM,MAAM,EAAE,YAGb,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;eAE7B,MAAM"}
|
package/dist/index.js
CHANGED
|
@@ -416,7 +416,8 @@ var LocalRuntimeSchema = z2.object({
|
|
|
416
416
|
baseURL: z2.string().url().optional(),
|
|
417
417
|
discovery: z2.enum(["cli", "sdk", "manual"]).optional(),
|
|
418
418
|
defaultModel: ModelRefSchema,
|
|
419
|
-
maxConcurrency: z2.number().int().positive().optional()
|
|
419
|
+
maxConcurrency: z2.number().int().positive().optional(),
|
|
420
|
+
reservedInteractiveSlots: z2.number().int().nonnegative().optional()
|
|
420
421
|
}).strict().superRefine((runtime, ctx) => {
|
|
421
422
|
const resolvedKind = runtime.kind ?? runtime.id;
|
|
422
423
|
if (!LocalRuntimeKindSchema.safeParse(resolvedKind).success) {
|
|
@@ -430,6 +431,15 @@ var LocalRuntimeSchema = z2.object({
|
|
|
430
431
|
function localRuntimeKind(runtime) {
|
|
431
432
|
return runtime.kind ?? runtime.id;
|
|
432
433
|
}
|
|
434
|
+
function effectiveMaxConcurrency(runtime) {
|
|
435
|
+
return runtime.maxConcurrency ?? DEFAULT_LOCAL_MAX_CONCURRENCY;
|
|
436
|
+
}
|
|
437
|
+
function effectiveReservedInteractiveSlots(runtime) {
|
|
438
|
+
if (runtime.reservedInteractiveSlots !== undefined) {
|
|
439
|
+
return runtime.reservedInteractiveSlots;
|
|
440
|
+
}
|
|
441
|
+
return effectiveMaxConcurrency(runtime) >= 2 ? 1 : 0;
|
|
442
|
+
}
|
|
433
443
|
var MemoryScopeSchema = z2.enum(["project", "user"]);
|
|
434
444
|
var MemoryExtractionModeSchema = z2.enum([
|
|
435
445
|
"local",
|
|
@@ -2721,7 +2731,8 @@ var KNOWN_CONFIG_KEYS_BY_PATH = new Map([
|
|
|
2721
2731
|
"baseURL",
|
|
2722
2732
|
"discovery",
|
|
2723
2733
|
"defaultModel",
|
|
2724
|
-
"maxConcurrency"
|
|
2734
|
+
"maxConcurrency",
|
|
2735
|
+
"reservedInteractiveSlots"
|
|
2725
2736
|
]
|
|
2726
2737
|
],
|
|
2727
2738
|
["local.runtimes[].defaultModel", MODEL_REF_KEYS],
|
|
@@ -5061,50 +5072,106 @@ var realCacheAdapter = {
|
|
|
5061
5072
|
};
|
|
5062
5073
|
|
|
5063
5074
|
// src/local/concurrency.ts
|
|
5075
|
+
var PRIORITY_BANDS = [
|
|
5076
|
+
"interactive",
|
|
5077
|
+
"worker",
|
|
5078
|
+
"background"
|
|
5079
|
+
];
|
|
5064
5080
|
function createRuntimeConcurrencyLimiter(options) {
|
|
5065
5081
|
const states = new Map;
|
|
5066
5082
|
function stateFor(runtimeId) {
|
|
5067
5083
|
let state = states.get(runtimeId);
|
|
5068
5084
|
if (state === undefined) {
|
|
5069
|
-
state = {
|
|
5085
|
+
state = {
|
|
5086
|
+
active: 0,
|
|
5087
|
+
nonInteractiveActive: 0,
|
|
5088
|
+
queues: { interactive: [], worker: [], background: [] }
|
|
5089
|
+
};
|
|
5070
5090
|
states.set(runtimeId, state);
|
|
5071
5091
|
}
|
|
5072
5092
|
return state;
|
|
5073
5093
|
}
|
|
5074
|
-
function
|
|
5094
|
+
function reservedFor(runtimeId, capacity) {
|
|
5095
|
+
const maxReserved = Math.max(0, capacity - 1);
|
|
5096
|
+
const raw = options.reservedInteractiveFor?.(runtimeId);
|
|
5097
|
+
if (raw === undefined || Number.isNaN(raw)) {
|
|
5098
|
+
return 0;
|
|
5099
|
+
}
|
|
5100
|
+
const truncated = Math.trunc(raw);
|
|
5101
|
+
if (truncated < 0) {
|
|
5102
|
+
return 0;
|
|
5103
|
+
}
|
|
5104
|
+
return Math.min(truncated, maxReserved);
|
|
5105
|
+
}
|
|
5106
|
+
function limitsFor(runtimeId) {
|
|
5107
|
+
const capacity = options.capacityFor(runtimeId);
|
|
5108
|
+
const reserved = reservedFor(runtimeId, capacity);
|
|
5109
|
+
return { capacity, nonInteractiveBudget: capacity - reserved };
|
|
5110
|
+
}
|
|
5111
|
+
function grantNext(state, runtimeId, nonInteractiveAfterRelease) {
|
|
5112
|
+
const interactiveWaiter = state.queues.interactive.shift();
|
|
5113
|
+
if (interactiveWaiter !== undefined) {
|
|
5114
|
+
return { waiter: interactiveWaiter, nonInteractive: false };
|
|
5115
|
+
}
|
|
5116
|
+
const { nonInteractiveBudget } = limitsFor(runtimeId);
|
|
5117
|
+
if (nonInteractiveAfterRelease < nonInteractiveBudget) {
|
|
5118
|
+
const workerWaiter = state.queues.worker.shift();
|
|
5119
|
+
if (workerWaiter !== undefined) {
|
|
5120
|
+
return { waiter: workerWaiter, nonInteractive: true };
|
|
5121
|
+
}
|
|
5122
|
+
const backgroundWaiter = state.queues.background.shift();
|
|
5123
|
+
if (backgroundWaiter !== undefined) {
|
|
5124
|
+
return { waiter: backgroundWaiter, nonInteractive: true };
|
|
5125
|
+
}
|
|
5126
|
+
}
|
|
5127
|
+
return;
|
|
5128
|
+
}
|
|
5129
|
+
function makeRelease(state, runtimeId, heldNonInteractive) {
|
|
5075
5130
|
let released = false;
|
|
5076
5131
|
return () => {
|
|
5077
5132
|
if (released) {
|
|
5078
5133
|
return;
|
|
5079
5134
|
}
|
|
5080
5135
|
released = true;
|
|
5081
|
-
const
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
} else {
|
|
5136
|
+
const nonInteractiveAfterRelease = state.nonInteractiveActive - (heldNonInteractive ? 1 : 0);
|
|
5137
|
+
const next = grantNext(state, runtimeId, nonInteractiveAfterRelease);
|
|
5138
|
+
if (next === undefined) {
|
|
5085
5139
|
state.active -= 1;
|
|
5140
|
+
state.nonInteractiveActive = nonInteractiveAfterRelease;
|
|
5141
|
+
return;
|
|
5086
5142
|
}
|
|
5143
|
+
state.nonInteractiveActive = nonInteractiveAfterRelease + (next.nonInteractive ? 1 : 0);
|
|
5144
|
+
next.waiter(makeRelease(state, runtimeId, next.nonInteractive));
|
|
5087
5145
|
};
|
|
5088
5146
|
}
|
|
5089
|
-
function tryAcquire(runtimeId) {
|
|
5147
|
+
function tryAcquire(runtimeId, priority = "worker") {
|
|
5090
5148
|
const state = stateFor(runtimeId);
|
|
5091
|
-
|
|
5149
|
+
const { capacity, nonInteractiveBudget } = limitsFor(runtimeId);
|
|
5150
|
+
if (priority === "interactive") {
|
|
5151
|
+
if (state.active < capacity) {
|
|
5152
|
+
state.active += 1;
|
|
5153
|
+
return makeRelease(state, runtimeId, false);
|
|
5154
|
+
}
|
|
5155
|
+
return;
|
|
5156
|
+
}
|
|
5157
|
+
if (state.active < capacity && state.nonInteractiveActive < nonInteractiveBudget) {
|
|
5092
5158
|
state.active += 1;
|
|
5093
|
-
|
|
5159
|
+
state.nonInteractiveActive += 1;
|
|
5160
|
+
return makeRelease(state, runtimeId, true);
|
|
5094
5161
|
}
|
|
5095
5162
|
return;
|
|
5096
5163
|
}
|
|
5097
5164
|
return {
|
|
5098
5165
|
tryAcquire,
|
|
5099
|
-
acquire(runtimeId) {
|
|
5100
|
-
const immediate = tryAcquire(runtimeId);
|
|
5166
|
+
acquire(runtimeId, priority = "worker") {
|
|
5167
|
+
const immediate = tryAcquire(runtimeId, priority);
|
|
5101
5168
|
if (immediate !== undefined) {
|
|
5102
5169
|
return Promise.resolve({ release: immediate, waitedMs: 0 });
|
|
5103
5170
|
}
|
|
5104
5171
|
const state = stateFor(runtimeId);
|
|
5105
5172
|
const queuedAt = options.now();
|
|
5106
5173
|
return new Promise((resolve3) => {
|
|
5107
|
-
state.
|
|
5174
|
+
state.queues[priority].push((release) => {
|
|
5108
5175
|
resolve3({ release, waitedMs: options.now() - queuedAt });
|
|
5109
5176
|
});
|
|
5110
5177
|
});
|
|
@@ -5113,7 +5180,15 @@ function createRuntimeConcurrencyLimiter(options) {
|
|
|
5113
5180
|
return states.get(runtimeId)?.active ?? 0;
|
|
5114
5181
|
},
|
|
5115
5182
|
queuedCount(runtimeId) {
|
|
5116
|
-
|
|
5183
|
+
const state = states.get(runtimeId);
|
|
5184
|
+
if (state === undefined) {
|
|
5185
|
+
return 0;
|
|
5186
|
+
}
|
|
5187
|
+
let total = 0;
|
|
5188
|
+
for (const band of PRIORITY_BANDS) {
|
|
5189
|
+
total += state.queues[band].length;
|
|
5190
|
+
}
|
|
5191
|
+
return total;
|
|
5117
5192
|
}
|
|
5118
5193
|
};
|
|
5119
5194
|
}
|
|
@@ -6291,6 +6366,9 @@ function warnUnknownRole(roleID, warn, warnedRoles) {
|
|
|
6291
6366
|
function roleFor(input) {
|
|
6292
6367
|
return getRoleProfile(input.roleID, input.config.orchestrator?.roles) ?? synthesiseFallbackProfile(input.roleID);
|
|
6293
6368
|
}
|
|
6369
|
+
function priorityForRole(role) {
|
|
6370
|
+
return role.roleID === "scribe" ? "background" : "worker";
|
|
6371
|
+
}
|
|
6294
6372
|
function mandatoryLocalRuntimeMessage(roleID) {
|
|
6295
6373
|
return `openteam: role "${roleID}" requires a local runtime, but no local runtime is reachable. ` + `This role must run locally and will not fall back to a frontier provider. ` + `Start one of the supported local runtimes (Ollama, LM Studio, or Lemonade) and try again. ` + "Run `openteam doctor` to diagnose your local runtime configuration.";
|
|
6296
6374
|
}
|
|
@@ -6654,10 +6732,11 @@ async function runRoleTaskWithCorrelation(input, deps, correlation, batch) {
|
|
|
6654
6732
|
let queueObservation;
|
|
6655
6733
|
if (runtimeId !== undefined && deps.runtimeLimiter !== undefined) {
|
|
6656
6734
|
const limiter = deps.runtimeLimiter;
|
|
6657
|
-
|
|
6735
|
+
const priority = priorityForRole(role);
|
|
6736
|
+
release = limiter.tryAcquire(runtimeId, priority);
|
|
6658
6737
|
let waitedMs = 0;
|
|
6659
6738
|
if (release === undefined) {
|
|
6660
|
-
const acquisition = await limiter.acquire(runtimeId);
|
|
6739
|
+
const acquisition = await limiter.acquire(runtimeId, priority);
|
|
6661
6740
|
release = acquisition.release;
|
|
6662
6741
|
waitedMs = acquisition.waitedMs;
|
|
6663
6742
|
}
|
|
@@ -13308,7 +13387,7 @@ var createOtlpSpanExporter = (connection, config) => {
|
|
|
13308
13387
|
// package.json
|
|
13309
13388
|
var package_default = {
|
|
13310
13389
|
name: "@jmanuelcorral/openteam",
|
|
13311
|
-
version: "0.
|
|
13390
|
+
version: "0.16.0",
|
|
13312
13391
|
packageManager: "bun@1.3.14",
|
|
13313
13392
|
description: "Cost-aware, local-first routing plugin for opencode with cheapest-capable frontier fallback and multi-agent orchestration.",
|
|
13314
13393
|
license: "MIT",
|
|
@@ -14047,8 +14126,16 @@ var server = async (ctx, rawOptions) => {
|
|
|
14047
14126
|
const snapshots = await registry.probe(config.local.runtimes.filter((runtime) => runtime.enabled));
|
|
14048
14127
|
return reachableRuntimeIds(snapshots);
|
|
14049
14128
|
};
|
|
14129
|
+
const runtimeById = (id) => config.local.runtimes.find((runtime) => runtime.id === id);
|
|
14050
14130
|
const runtimeLimiter = createRuntimeConcurrencyLimiter({
|
|
14051
|
-
capacityFor: (id) =>
|
|
14131
|
+
capacityFor: (id) => {
|
|
14132
|
+
const runtime = runtimeById(id);
|
|
14133
|
+
return runtime === undefined ? DEFAULT_LOCAL_MAX_CONCURRENCY : effectiveMaxConcurrency(runtime);
|
|
14134
|
+
},
|
|
14135
|
+
reservedInteractiveFor: (id) => {
|
|
14136
|
+
const runtime = runtimeById(id);
|
|
14137
|
+
return runtime === undefined ? 0 : effectiveReservedInteractiveSlots(runtime);
|
|
14138
|
+
},
|
|
14052
14139
|
now
|
|
14053
14140
|
});
|
|
14054
14141
|
const orchestrateTool = createOrchestrateTool({
|
|
@@ -7,8 +7,8 @@ import type { LocalRuntimeId } from "./types";
|
|
|
7
7
|
export type RuntimeSlotRelease = () => void;
|
|
8
8
|
/**
|
|
9
9
|
* Outcome of an `acquire`: the slot release plus how long the caller waited in
|
|
10
|
-
* the
|
|
11
|
-
* free and the acquisition resolved without queuing. It is measured with the
|
|
10
|
+
* the priority queue before the slot was granted. `waitedMs` is `0` when a slot
|
|
11
|
+
* was free and the acquisition resolved without queuing. It is measured with the
|
|
12
12
|
* injected clock (`RuntimeConcurrencyLimiterOptions.now`), so tests are
|
|
13
13
|
* deterministic and the limiter never reads wall-clock time inline.
|
|
14
14
|
*/
|
|
@@ -17,7 +17,22 @@ export type RuntimeSlotAcquisition = {
|
|
|
17
17
|
readonly waitedMs: number;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Priority band a caller acquires a runtime slot under (#213), highest first:
|
|
21
|
+
*
|
|
22
|
+
* - `"interactive"` — latency-sensitive, coordinator-facing work. May use the
|
|
23
|
+
* runtime's FULL capacity.
|
|
24
|
+
* - `"worker"` — ordinary fan-out generations. The DEFAULT, so every pre-#213
|
|
25
|
+
* caller keeps its behaviour unchanged.
|
|
26
|
+
* - `"background"` — bookkeeping/telemetry work (e.g. the scribe role).
|
|
27
|
+
*
|
|
28
|
+
* Queue ordering is STRICT PRIORITY ACROSS bands and FIFO WITHIN a band: on
|
|
29
|
+
* release the freed slot is granted to the longest-waiting waiter in the highest
|
|
30
|
+
* non-empty admissible band.
|
|
31
|
+
*/
|
|
32
|
+
export type RuntimeSlotPriority = "interactive" | "worker" | "background";
|
|
33
|
+
/**
|
|
34
|
+
* Per-runtime concurrency limiter with a PRIORITY queue and RESERVED interactive
|
|
35
|
+
* capacity (#144, #213).
|
|
21
36
|
*
|
|
22
37
|
* A runtime has a fixed number of slots (its configured `maxConcurrency`). The
|
|
23
38
|
* limiter caps concurrent generations to that number and QUEUES excess work
|
|
@@ -32,21 +47,55 @@ export type RuntimeSlotAcquisition = {
|
|
|
32
47
|
* concurrent-telemetry emission order of a wave is unperturbed. Only when a
|
|
33
48
|
* runtime is saturated does `acquire` return a promise that settles when a slot
|
|
34
49
|
* frees.
|
|
50
|
+
*
|
|
51
|
+
* ## Priority bands
|
|
52
|
+
*
|
|
53
|
+
* Callers pass a {@link RuntimeSlotPriority}; when omitted it defaults to
|
|
54
|
+
* `"worker"` so existing callers are unchanged. Queuing is strict priority
|
|
55
|
+
* across bands and FIFO within a band: an interactive waiter is always served
|
|
56
|
+
* before any worker, and workers before background, but two waiters of the same
|
|
57
|
+
* band keep their arrival order (so existing ordering guarantees survive).
|
|
58
|
+
*
|
|
59
|
+
* ## Reserved interactive capacity — the core of #213
|
|
60
|
+
*
|
|
61
|
+
* `reservedInteractiveFor` withholds a slice of a runtime's capacity from the
|
|
62
|
+
* non-interactive bands: `worker`/`background` callers may occupy at most
|
|
63
|
+
* `capacity - reserved` slots, while `interactive` callers may use the FULL
|
|
64
|
+
* capacity. The reserved count is clamped to `[0, capacity - 1]` so the
|
|
65
|
+
* non-interactive budget is never driven to 0 (a single-slot runtime with
|
|
66
|
+
* `reserved = 1` would otherwise deadlock every worker forever); non-integer,
|
|
67
|
+
* negative and NaN inputs are sanitised too.
|
|
68
|
+
*
|
|
69
|
+
* The non-obvious part: openteam's own INTERACTIVE/coordinator traffic reaches
|
|
70
|
+
* the local runtime as ordinary opencode chat and never passes through this
|
|
71
|
+
* limiter. Reserving a slot still helps, because the reservation caps how many
|
|
72
|
+
* slots openteam's WORKERS occupy on the shared runtime. By refusing to let
|
|
73
|
+
* workers fill the last slot, the limiter guarantees the runtime SERVER always
|
|
74
|
+
* has free headroom for the ungoverned interactive request — turning a
|
|
75
|
+
* `maxConcurrency` that equals the server's real slot count (the reported
|
|
76
|
+
* incident: a 4-slot Lemonade box with `DEFAULT_LOCAL_MAX_CONCURRENCY === 4`)
|
|
77
|
+
* from full saturation into a 3-worker + 1-reserved split with no config change.
|
|
78
|
+
* The `interactive` band exists so an in-process interactive caller can still
|
|
79
|
+
* claim the reserved slot when one is wired up.
|
|
35
80
|
*/
|
|
36
81
|
export type RuntimeConcurrencyLimiter = {
|
|
37
82
|
/**
|
|
38
|
-
* Attempts to take a slot for `runtimeId` synchronously
|
|
39
|
-
* when a slot was free
|
|
83
|
+
* Attempts to take a slot for `runtimeId` synchronously under `priority`
|
|
84
|
+
* (default `"worker"`). Returns a release when a slot was free within the
|
|
85
|
+
* band's admissible budget, or `undefined` when the runtime is at its cap (for
|
|
86
|
+
* `interactive`) or at its reserved-adjusted budget (for `worker`/
|
|
87
|
+
* `background`).
|
|
40
88
|
*/
|
|
41
|
-
tryAcquire(runtimeId: LocalRuntimeId): RuntimeSlotRelease | undefined;
|
|
89
|
+
tryAcquire(runtimeId: LocalRuntimeId, priority?: RuntimeSlotPriority): RuntimeSlotRelease | undefined;
|
|
42
90
|
/**
|
|
43
|
-
* Takes a slot for `runtimeId
|
|
44
|
-
*
|
|
45
|
-
* available. Prefer `tryAcquire` first and
|
|
46
|
-
* returns `undefined`, so the common free path
|
|
47
|
-
* is free, resolves immediately with
|
|
91
|
+
* Takes a slot for `runtimeId` under `priority` (default `"worker"`), queuing
|
|
92
|
+
* when the runtime is saturated for that band. Resolves with a release and the
|
|
93
|
+
* measured queue wait once a slot is available. Prefer `tryAcquire` first and
|
|
94
|
+
* only `await acquire` when it returns `undefined`, so the common free path
|
|
95
|
+
* stays synchronous. When a slot is free, resolves immediately with
|
|
96
|
+
* `waitedMs === 0`.
|
|
48
97
|
*/
|
|
49
|
-
acquire(runtimeId: LocalRuntimeId): Promise<RuntimeSlotAcquisition>;
|
|
98
|
+
acquire(runtimeId: LocalRuntimeId, priority?: RuntimeSlotPriority): Promise<RuntimeSlotAcquisition>;
|
|
50
99
|
/** Current in-flight count for a runtime. Exposed for tests and diagnostics. */
|
|
51
100
|
activeCount(runtimeId: LocalRuntimeId): number;
|
|
52
101
|
/** Current queued (waiting) count for a runtime. Exposed for tests. */
|
|
@@ -59,12 +108,21 @@ export type RuntimeConcurrencyLimiterOptions = {
|
|
|
59
108
|
* runtime does not declare a cap. Must return a positive integer.
|
|
60
109
|
*/
|
|
61
110
|
capacityFor: (runtimeId: LocalRuntimeId) => number;
|
|
111
|
+
/**
|
|
112
|
+
* Resolves how many of a runtime's slots are RESERVED for interactive work
|
|
113
|
+
* (#213). Optional and injected so the limiter carries no config coupling;
|
|
114
|
+
* when absent, no capacity is reserved and behaviour matches the pre-#213
|
|
115
|
+
* FIFO limiter exactly. The returned value is clamped to `[0, capacity - 1]`
|
|
116
|
+
* and sanitised (non-integer/negative/NaN handled conservatively), so it can
|
|
117
|
+
* never starve the non-interactive budget to 0.
|
|
118
|
+
*/
|
|
119
|
+
reservedInteractiveFor?: (runtimeId: LocalRuntimeId) => number;
|
|
62
120
|
/**
|
|
63
121
|
* Injected clock in epoch milliseconds, used ONLY to measure how long a
|
|
64
|
-
* saturated `acquire` waited in the
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
122
|
+
* saturated `acquire` waited in the queue. The free `tryAcquire` path never
|
|
123
|
+
* reads it, so the happy path stays allocation-free and clock-free. Injected
|
|
124
|
+
* (never `Date.now()` inline) so queue-wait telemetry is deterministic under
|
|
125
|
+
* test.
|
|
68
126
|
*/
|
|
69
127
|
now: () => number;
|
|
70
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/local/concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/local/concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAA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AC/B,aAAa,EAAE,EAAE,CA2BnB;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,eAAe,CAAC,CAiE1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmanuelcorral/openteam",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Cost-aware, local-first routing plugin for opencode with cheapest-capable frontier fallback and multi-agent orchestration.",
|
|
6
6
|
"license": "MIT",
|