switchroom 0.18.14 → 0.18.15
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/dist/auth-broker/index.js +41 -39
- package/dist/cli/switchroom.js +1151 -1067
- package/dist/host-control/main.js +53 -51
- package/dist/vault/approvals/kernel-server.js +16 -12
- package/dist/vault/broker/server.js +672 -668
- package/package.json +1 -1
- package/telegram-plugin/dist/bridge/bridge.js +21 -0
- package/telegram-plugin/dist/gateway/gateway.js +150 -5
- package/telegram-plugin/dist/server.js +22 -1
- package/telegram-plugin/gateway/gateway.ts +48 -2
- package/telegram-plugin/model-unavailable.ts +214 -0
- package/telegram-plugin/runtime-metrics.ts +31 -0
- package/telegram-plugin/session-tail.ts +14 -2
- package/telegram-plugin/tests/model-unavailable.test.ts +187 -0
- package/telegram-plugin/tests/operator-events-session-tail.test.ts +55 -0
- package/telegram-plugin/tests/runtime-metrics.test.ts +24 -0
- package/telegram-plugin/tests/throttle-tier.test.ts +176 -0
- package/telegram-plugin/throttle-tier.ts +98 -1
|
@@ -18118,13 +18118,51 @@ import * as constants2 from "node:constants";
|
|
|
18118
18118
|
import { createHash as createHash2 } from "node:crypto";
|
|
18119
18119
|
import { dirname as dirname3, join as join8, resolve as resolve9 } from "node:path";
|
|
18120
18120
|
|
|
18121
|
-
// src/agents/compose.ts
|
|
18122
|
-
import { createHash } from "node:crypto";
|
|
18123
|
-
|
|
18124
18121
|
// src/agents/scaffold.ts
|
|
18125
18122
|
import { join as join4, resolve as resolve5 } from "node:path";
|
|
18126
18123
|
init_atomic();
|
|
18127
18124
|
|
|
18125
|
+
// src/agents/agent-uid.ts
|
|
18126
|
+
import { createHash } from "node:crypto";
|
|
18127
|
+
|
|
18128
|
+
// src/broker-common/peercred-path.ts
|
|
18129
|
+
function matchSocketName(socketPath, patterns, maxNameLen) {
|
|
18130
|
+
if (typeof socketPath !== "string" || socketPath.length === 0)
|
|
18131
|
+
return null;
|
|
18132
|
+
let name = null;
|
|
18133
|
+
for (const re of patterns) {
|
|
18134
|
+
const m = socketPath.match(re);
|
|
18135
|
+
if (m && typeof m[1] === "string") {
|
|
18136
|
+
name = m[1];
|
|
18137
|
+
break;
|
|
18138
|
+
}
|
|
18139
|
+
}
|
|
18140
|
+
if (name === null || name.length === 0)
|
|
18141
|
+
return null;
|
|
18142
|
+
if (maxNameLen !== undefined && name.length > maxNameLen)
|
|
18143
|
+
return null;
|
|
18144
|
+
return name;
|
|
18145
|
+
}
|
|
18146
|
+
|
|
18147
|
+
// src/vault/broker/peercred.ts
|
|
18148
|
+
var RESERVED_AGENT_NAMES = new Set(["operator", "hostd"]);
|
|
18149
|
+
function isReservedAgentName(name) {
|
|
18150
|
+
return RESERVED_AGENT_NAMES.has(name);
|
|
18151
|
+
}
|
|
18152
|
+
|
|
18153
|
+
// src/agents/agent-uid.ts
|
|
18154
|
+
var AGENT_UID_MIN = 10001;
|
|
18155
|
+
var AGENT_UID_MAX = 10999;
|
|
18156
|
+
function allocateAgentUid(name) {
|
|
18157
|
+
if (isReservedAgentName(name)) {
|
|
18158
|
+
throw new Error(`agent name '${name}' is reserved by switchroom for another identity kind ` + `(see vault/broker/peercred.ts:RESERVED_AGENT_NAMES). Pick a different name.`);
|
|
18159
|
+
}
|
|
18160
|
+
const hash = createHash("sha256").update(name).digest();
|
|
18161
|
+
const u32 = hash.readUInt32BE(0);
|
|
18162
|
+
const range = AGENT_UID_MAX - AGENT_UID_MIN + 1;
|
|
18163
|
+
return AGENT_UID_MIN + u32 % range;
|
|
18164
|
+
}
|
|
18165
|
+
|
|
18128
18166
|
// src/config/timezone.ts
|
|
18129
18167
|
var CONTAINER_DEFAULT_UTC_ZONES = new Set([
|
|
18130
18168
|
"UTC",
|
|
@@ -18268,31 +18306,6 @@ var SCRYPT_MAXMEM = 128 * 1024 * 1024;
|
|
|
18268
18306
|
import { homedir as homedir3 } from "node:os";
|
|
18269
18307
|
import { join as join3 } from "node:path";
|
|
18270
18308
|
|
|
18271
|
-
// src/broker-common/peercred-path.ts
|
|
18272
|
-
function matchSocketName(socketPath, patterns, maxNameLen) {
|
|
18273
|
-
if (typeof socketPath !== "string" || socketPath.length === 0)
|
|
18274
|
-
return null;
|
|
18275
|
-
let name = null;
|
|
18276
|
-
for (const re of patterns) {
|
|
18277
|
-
const m = socketPath.match(re);
|
|
18278
|
-
if (m && typeof m[1] === "string") {
|
|
18279
|
-
name = m[1];
|
|
18280
|
-
break;
|
|
18281
|
-
}
|
|
18282
|
-
}
|
|
18283
|
-
if (name === null || name.length === 0)
|
|
18284
|
-
return null;
|
|
18285
|
-
if (maxNameLen !== undefined && name.length > maxNameLen)
|
|
18286
|
-
return null;
|
|
18287
|
-
return name;
|
|
18288
|
-
}
|
|
18289
|
-
|
|
18290
|
-
// src/vault/broker/peercred.ts
|
|
18291
|
-
var RESERVED_AGENT_NAMES = new Set(["operator", "hostd"]);
|
|
18292
|
-
function isReservedAgentName(name) {
|
|
18293
|
-
return RESERVED_AGENT_NAMES.has(name);
|
|
18294
|
-
}
|
|
18295
|
-
|
|
18296
18309
|
// src/vault/broker/protocol.ts
|
|
18297
18310
|
var MAX_FRAME_BYTES = 64 * 1024;
|
|
18298
18311
|
var AgentNameSchema = exports_external.string().min(1).max(64, "agent name max 64 chars").regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/, "agent name must be kebab-case ASCII (alnum + _- only, first char alnum)").refine((s) => !isReservedAgentName(s), {
|
|
@@ -18634,17 +18647,6 @@ var DOCKER_TELEGRAM_PLUGIN_PATH = "/opt/switchroom/telegram-plugin";
|
|
|
18634
18647
|
var DOCKER_HOOKS_PATH = `${DOCKER_TELEGRAM_PLUGIN_PATH}/hooks`;
|
|
18635
18648
|
|
|
18636
18649
|
// src/agents/compose.ts
|
|
18637
|
-
var AGENT_UID_MIN = 10001;
|
|
18638
|
-
var AGENT_UID_MAX = 10999;
|
|
18639
|
-
function allocateAgentUid(name) {
|
|
18640
|
-
if (isReservedAgentName(name)) {
|
|
18641
|
-
throw new Error(`agent name '${name}' is reserved by switchroom for another identity kind ` + `(see vault/broker/peercred.ts:RESERVED_AGENT_NAMES). Pick a different name.`);
|
|
18642
|
-
}
|
|
18643
|
-
const hash = createHash("sha256").update(name).digest();
|
|
18644
|
-
const u32 = hash.readUInt32BE(0);
|
|
18645
|
-
const range = AGENT_UID_MAX - AGENT_UID_MIN + 1;
|
|
18646
|
-
return AGENT_UID_MIN + u32 % range;
|
|
18647
|
-
}
|
|
18648
18650
|
var BIND_MOUNT_EXACT_SOURCE_DENY = new Set(["/var/run/docker.sock"]);
|
|
18649
18651
|
|
|
18650
18652
|
// src/auth/quota.ts
|