agent-relay-runner 0.118.5 → 0.119.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-relay-runner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.119.0",
|
|
4
4
|
"description": "Unified provider lifecycle runner for Agent Relay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"agent-relay-providers": "0.104.1",
|
|
24
|
-
"agent-relay-sdk": "0.2.
|
|
24
|
+
"agent-relay-sdk": "0.2.102",
|
|
25
25
|
"callmux": "0.23.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -848,6 +848,61 @@ import { promisify } from "util";
|
|
|
848
848
|
var execFileAsync = promisify(execFile);
|
|
849
849
|
// sdk/src/teams-config.ts
|
|
850
850
|
var TEAM_IDLE_THRESHOLD_MINUTES_MAX = 24 * 60;
|
|
851
|
+
// sdk/src/admission/semaphore.ts
|
|
852
|
+
class Semaphore {
|
|
853
|
+
#limit;
|
|
854
|
+
#inFlight = 0;
|
|
855
|
+
#waiters = [];
|
|
856
|
+
constructor(limit) {
|
|
857
|
+
if (!Number.isInteger(limit) || limit < 1) {
|
|
858
|
+
throw new RangeError(`Semaphore limit must be an integer >= 1, got ${limit}`);
|
|
859
|
+
}
|
|
860
|
+
this.#limit = limit;
|
|
861
|
+
}
|
|
862
|
+
get limit() {
|
|
863
|
+
return this.#limit;
|
|
864
|
+
}
|
|
865
|
+
get inFlight() {
|
|
866
|
+
return this.#inFlight;
|
|
867
|
+
}
|
|
868
|
+
get waiting() {
|
|
869
|
+
return this.#waiters.length;
|
|
870
|
+
}
|
|
871
|
+
get available() {
|
|
872
|
+
return this.#limit - this.#inFlight;
|
|
873
|
+
}
|
|
874
|
+
tryAcquire() {
|
|
875
|
+
if (this.#inFlight < this.#limit) {
|
|
876
|
+
this.#inFlight++;
|
|
877
|
+
return true;
|
|
878
|
+
}
|
|
879
|
+
return false;
|
|
880
|
+
}
|
|
881
|
+
acquire() {
|
|
882
|
+
if (this.tryAcquire())
|
|
883
|
+
return Promise.resolve();
|
|
884
|
+
return new Promise((resolve) => {
|
|
885
|
+
this.#waiters.push(resolve);
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
release() {
|
|
889
|
+
const next = this.#waiters.shift();
|
|
890
|
+
if (next) {
|
|
891
|
+
next();
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
if (this.#inFlight > 0)
|
|
895
|
+
this.#inFlight--;
|
|
896
|
+
}
|
|
897
|
+
async run(fn) {
|
|
898
|
+
await this.acquire();
|
|
899
|
+
try {
|
|
900
|
+
return await fn();
|
|
901
|
+
} finally {
|
|
902
|
+
this.release();
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
851
906
|
// runner/src/config.ts
|
|
852
907
|
function messageBodyMaxCharsFromEnv() {
|
|
853
908
|
return process.env.AGENT_RELAY_MESSAGE_BODY_MAX_CHARS;
|