github-router 0.3.135 → 0.3.136
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/browser-ext/manifest.json +1 -1
- package/dist/{engine-CEaYFr0J.js → engine-BrbdG9Cp.js} +1 -1
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/{peer-mcp-personas-ClyKATAD.js → peer-mcp-personas-Dmx4S0_5.js} +223 -49
- package/dist/peer-mcp-personas-Dmx4S0_5.js.map +1 -0
- package/package.json +1 -1
- package/dist/peer-mcp-personas-ClyKATAD.js.map +0 -1
|
@@ -1717,7 +1717,7 @@ function decodeSessionId(globalId) {
|
|
|
1717
1717
|
var FleetClient = class {
|
|
1718
1718
|
baseUrl;
|
|
1719
1719
|
origin;
|
|
1720
|
-
|
|
1720
|
+
auth;
|
|
1721
1721
|
fetchFn;
|
|
1722
1722
|
getTunnelToken;
|
|
1723
1723
|
onTunnelAuthInvalidate;
|
|
@@ -1725,7 +1725,10 @@ var FleetClient = class {
|
|
|
1725
1725
|
constructor(options) {
|
|
1726
1726
|
this.baseUrl = options.url.replace(/\/+$/, "");
|
|
1727
1727
|
this.origin = new URL(this.baseUrl).origin;
|
|
1728
|
-
this.
|
|
1728
|
+
this.auth = options.auth ?? {
|
|
1729
|
+
type: "bearer",
|
|
1730
|
+
token: options.token ?? ""
|
|
1731
|
+
};
|
|
1729
1732
|
this.fetchFn = options.fetchFn ?? globalThis.fetch.bind(globalThis);
|
|
1730
1733
|
this.getTunnelToken = options.getTunnelToken;
|
|
1731
1734
|
this.onTunnelAuthInvalidate = options.onTunnelAuthInvalidate;
|
|
@@ -1819,7 +1822,7 @@ var FleetClient = class {
|
|
|
1819
1822
|
const attachTunnel = tunnelToken !== void 0 && tunnelToken !== "";
|
|
1820
1823
|
const canRetry = attachTunnel && !!this.onTunnelAuthInvalidate && attempt === 0;
|
|
1821
1824
|
const headers = {
|
|
1822
|
-
Authorization: `Bearer ${this.token}
|
|
1825
|
+
...this.auth.type === "bearer" ? { Authorization: `Bearer ${this.auth.token}` } : {},
|
|
1823
1826
|
...devtunnelHost ? { "X-Tunnel-Skip-Anti-Phishing-Page": "true" } : {},
|
|
1824
1827
|
...attachTunnel ? { "X-Tunnel-Authorization": `tunnel ${tunnelToken}` } : {},
|
|
1825
1828
|
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
@@ -1840,7 +1843,7 @@ var FleetClient = class {
|
|
|
1840
1843
|
this.onTunnelAuthInvalidate();
|
|
1841
1844
|
continue;
|
|
1842
1845
|
}
|
|
1843
|
-
throw mapNetworkError(err, devtunnelHost);
|
|
1846
|
+
throw this.auth.type === "mesh" ? mapMeshUnreachable(err) : mapNetworkError(err, devtunnelHost);
|
|
1844
1847
|
}
|
|
1845
1848
|
if (!response.ok) {
|
|
1846
1849
|
if ((response.status === 401 || response.status === 403) && canRetry) {
|
|
@@ -1972,6 +1975,20 @@ function detailToSearchString(detail) {
|
|
|
1972
1975
|
return String(detail);
|
|
1973
1976
|
}
|
|
1974
1977
|
}
|
|
1978
|
+
function mapMeshUnreachable(err) {
|
|
1979
|
+
if (isAbortLike$1(err)) return new FleetError({
|
|
1980
|
+
code: "TIMEOUT",
|
|
1981
|
+
message: "fleet mesh peer request timed out or was aborted",
|
|
1982
|
+
retryable: true,
|
|
1983
|
+
detail: err
|
|
1984
|
+
});
|
|
1985
|
+
return new FleetError({
|
|
1986
|
+
code: "TAILNET_UNREACHABLE",
|
|
1987
|
+
message: `fleet mesh peer unreachable: ${err instanceof Error ? err.message : String(err)} — the peer is a tailnet node but the request did not land. A mesh ACL drops blocked traffic SILENTLY, so the likely cause is the \`tag:aiordie\` ACL (verify the peer permits this node), not a dead instance; also confirm the peer's mesh sidecar is up and serving HTTPS on the tailnet.`,
|
|
1988
|
+
retryable: true,
|
|
1989
|
+
detail: err
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1975
1992
|
function mapNetworkError(err, devtunnelHost = false) {
|
|
1976
1993
|
if (isAbortLike$1(err)) return new FleetError({
|
|
1977
1994
|
code: "TIMEOUT",
|
|
@@ -2057,20 +2074,11 @@ var FleetRegistry = class {
|
|
|
2057
2074
|
}
|
|
2058
2075
|
}
|
|
2059
2076
|
async resolveInstance(arg) {
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
const labelMatches = instances.filter((instance) => instance.label.toLocaleLowerCase() === wanted.toLocaleLowerCase());
|
|
2066
|
-
if (labelMatches.length > 1) throw new FleetRegistryError("AMBIGUOUS_LABEL", `fleet instance label ${JSON.stringify(wanted)} matches ${labelMatches.length} instances; use an id`);
|
|
2067
|
-
if (labelMatches.length === 1) return resolvedInstance(labelMatches[0]);
|
|
2068
|
-
throw new FleetRegistryError("INSTANCE_NOT_FOUND", `fleet instance ${JSON.stringify(wanted)} was not found`);
|
|
2069
|
-
}
|
|
2070
|
-
const defaultInstance = instances.find((instance) => instance.default === true);
|
|
2071
|
-
if (defaultInstance) return resolvedInstance(defaultInstance);
|
|
2072
|
-
if (instances.length === 1) return resolvedInstance(instances[0]);
|
|
2073
|
-
throw new FleetRegistryError("INSTANCE_REQUIRED", instances.length === 0 ? "fleet instance is required; registry is empty" : "fleet instance is required; specify an instance id or label");
|
|
2077
|
+
return selectInstance((await this.instancesWithTokens()).map(resolvedInstance), arg);
|
|
2078
|
+
}
|
|
2079
|
+
/** All static instances, fully resolved (with tokens). Used to build the merged static∪discovered set. */
|
|
2080
|
+
async resolveAll() {
|
|
2081
|
+
return (await this.instancesWithTokens()).map(resolvedInstance);
|
|
2074
2082
|
}
|
|
2075
2083
|
async listInstances() {
|
|
2076
2084
|
return (await this.instancesWithTokens()).map((instance) => ({
|
|
@@ -2086,6 +2094,27 @@ var FleetRegistry = class {
|
|
|
2086
2094
|
return this.loaded;
|
|
2087
2095
|
}
|
|
2088
2096
|
};
|
|
2097
|
+
/**
|
|
2098
|
+
* Pure instance selection over an already-resolved set: id (exact) → label
|
|
2099
|
+
* (case-insensitive, ambiguity-checked) → default → single. Shared by the static
|
|
2100
|
+
* registry and the merged static∪discovered registry so both apply identical
|
|
2101
|
+
* matching + error semantics.
|
|
2102
|
+
*/
|
|
2103
|
+
function selectInstance(instances, arg) {
|
|
2104
|
+
const wanted = typeof arg === "string" ? arg.trim() : "";
|
|
2105
|
+
if (wanted) {
|
|
2106
|
+
const byId = instances.find((instance) => instance.id === wanted);
|
|
2107
|
+
if (byId) return byId;
|
|
2108
|
+
const labelMatches = instances.filter((instance) => instance.label.toLocaleLowerCase() === wanted.toLocaleLowerCase());
|
|
2109
|
+
if (labelMatches.length > 1) throw new FleetRegistryError("AMBIGUOUS_LABEL", `fleet instance label ${JSON.stringify(wanted)} matches ${labelMatches.length} instances; use an id`);
|
|
2110
|
+
if (labelMatches.length === 1) return labelMatches[0];
|
|
2111
|
+
throw new FleetRegistryError("INSTANCE_NOT_FOUND", `fleet instance ${JSON.stringify(wanted)} was not found`);
|
|
2112
|
+
}
|
|
2113
|
+
const defaultInstance = instances.find((instance) => instance.default === true);
|
|
2114
|
+
if (defaultInstance) return defaultInstance;
|
|
2115
|
+
if (instances.length === 1) return instances[0];
|
|
2116
|
+
throw new FleetRegistryError("INSTANCE_REQUIRED", instances.length === 0 ? "fleet instance is required; registry is empty" : "fleet instance is required; specify an instance id or label");
|
|
2117
|
+
}
|
|
2089
2118
|
function normalizeConfig(config) {
|
|
2090
2119
|
if (!isObject(config)) throw new FleetRegistryError("INVALID_CONFIG", "fleet registry config must be an object");
|
|
2091
2120
|
const instances = config.instances ?? [];
|
|
@@ -2207,6 +2236,11 @@ function resolvedInstance(instance) {
|
|
|
2207
2236
|
label: instance.label,
|
|
2208
2237
|
url: instance.url,
|
|
2209
2238
|
token: instance.token,
|
|
2239
|
+
auth: {
|
|
2240
|
+
type: "bearer",
|
|
2241
|
+
token: instance.token
|
|
2242
|
+
},
|
|
2243
|
+
default: instance.default,
|
|
2210
2244
|
allowExec: instance.allowExec,
|
|
2211
2245
|
tunnelId: instance.tunnelId,
|
|
2212
2246
|
tunnelToken: instance.tunnelToken,
|
|
@@ -2220,6 +2254,158 @@ function isNodeErrorCode(err, code) {
|
|
|
2220
2254
|
return isObject(err) && err.code === code;
|
|
2221
2255
|
}
|
|
2222
2256
|
|
|
2257
|
+
//#endregion
|
|
2258
|
+
//#region src/lib/fleet/discovery.ts
|
|
2259
|
+
/**
|
|
2260
|
+
* Mesh fleet discovery: read the local ai-or-die instance's `mesh/peers.json`
|
|
2261
|
+
* (written by its MeshManager from the sidecar's tailnet `Status()`) off disk and
|
|
2262
|
+
* synthesize token-less, mesh-auth fleet instances. No `AIORDIE_*` env, no HTTP,
|
|
2263
|
+
* no token — filesystem permissions are the gate. Discovered peers are driven
|
|
2264
|
+
* over the tailnet with NO Authorization header; each peer's own sidecar injects
|
|
2265
|
+
* the bearer (ACL-gated by `tag:aiordie`). See docs / the fleet plan.
|
|
2266
|
+
*/
|
|
2267
|
+
const DISCOVERY_CACHE_TTL_MS = 5e3;
|
|
2268
|
+
const PEERS_JSON_MAX_BYTES = 256 * 1024;
|
|
2269
|
+
/** The ai-or-die app data dir (NOT github-router's) — mirrors MeshManager's `base`. */
|
|
2270
|
+
function aiordieAppDir() {
|
|
2271
|
+
if (process.platform === "win32") {
|
|
2272
|
+
const localApp = process.env.LOCALAPPDATA || nodePath.join(os.homedir(), "AppData", "Local");
|
|
2273
|
+
return nodePath.join(localApp, "ai-or-die");
|
|
2274
|
+
}
|
|
2275
|
+
return nodePath.join(os.homedir(), ".ai-or-die");
|
|
2276
|
+
}
|
|
2277
|
+
function meshPeersFilePath() {
|
|
2278
|
+
const override = process.env.GH_ROUTER_FLEET_PEERS_FILE;
|
|
2279
|
+
if (override && override.trim() !== "") return override.trim();
|
|
2280
|
+
return nodePath.join(aiordieAppDir(), "mesh", "peers.json");
|
|
2281
|
+
}
|
|
2282
|
+
function meshDiscoveryDisabled() {
|
|
2283
|
+
return process.env.GH_ROUTER_FLEET_DISCOVERY === "0";
|
|
2284
|
+
}
|
|
2285
|
+
const TS_NET_DNS_RE = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+ts\.net$/;
|
|
2286
|
+
function validDnsName(raw) {
|
|
2287
|
+
if (typeof raw !== "string") return void 0;
|
|
2288
|
+
const name = raw.trim().replace(/\.$/, "").toLowerCase();
|
|
2289
|
+
if (name.length === 0 || name.length > 253) return void 0;
|
|
2290
|
+
if (!TS_NET_DNS_RE.test(name)) return void 0;
|
|
2291
|
+
return name;
|
|
2292
|
+
}
|
|
2293
|
+
function nonEmptyString(raw) {
|
|
2294
|
+
return typeof raw === "string" && raw.trim() !== "" ? raw.trim() : void 0;
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* Read + validate the discovery file into resolved mesh instances. Pure I/O +
|
|
2298
|
+
* validation; never throws — a missing/unreadable/oversized/malformed file
|
|
2299
|
+
* yields `[]` (discovery is best-effort and must never break static fleet use).
|
|
2300
|
+
*/
|
|
2301
|
+
async function readMeshPeers(readFileFn = (p) => fs.readFile(p, "utf8")) {
|
|
2302
|
+
if (meshDiscoveryDisabled()) return [];
|
|
2303
|
+
let raw;
|
|
2304
|
+
try {
|
|
2305
|
+
raw = await readFileFn(meshPeersFilePath());
|
|
2306
|
+
} catch {
|
|
2307
|
+
return [];
|
|
2308
|
+
}
|
|
2309
|
+
if (Buffer.byteLength(raw, "utf8") > PEERS_JSON_MAX_BYTES) return [];
|
|
2310
|
+
let parsed;
|
|
2311
|
+
try {
|
|
2312
|
+
parsed = JSON.parse(raw);
|
|
2313
|
+
} catch {
|
|
2314
|
+
return [];
|
|
2315
|
+
}
|
|
2316
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return [];
|
|
2317
|
+
if (!Array.isArray(parsed.peers)) return [];
|
|
2318
|
+
const selfDnsName = validDnsName(parsed.self?.dnsName);
|
|
2319
|
+
if (selfDnsName === void 0) return [];
|
|
2320
|
+
const tailnetSuffix = selfDnsName.slice(selfDnsName.indexOf(".") + 1);
|
|
2321
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2322
|
+
const out = [];
|
|
2323
|
+
for (const peer of parsed.peers) {
|
|
2324
|
+
if (typeof peer !== "object" || peer === null) continue;
|
|
2325
|
+
const record = peer;
|
|
2326
|
+
const dnsName = validDnsName(record.dnsName);
|
|
2327
|
+
if (dnsName === void 0) continue;
|
|
2328
|
+
if (dnsName === selfDnsName) continue;
|
|
2329
|
+
if (!dnsName.endsWith(`.${tailnetSuffix}`)) continue;
|
|
2330
|
+
if (seen.has(dnsName)) continue;
|
|
2331
|
+
seen.add(dnsName);
|
|
2332
|
+
const hostname = nonEmptyString(record.hostname);
|
|
2333
|
+
out.push({
|
|
2334
|
+
id: dnsName,
|
|
2335
|
+
label: hostname ?? dnsName,
|
|
2336
|
+
url: `https://${dnsName}`,
|
|
2337
|
+
token: "",
|
|
2338
|
+
auth: { type: "mesh" }
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
return out;
|
|
2342
|
+
}
|
|
2343
|
+
function toInfo(instance) {
|
|
2344
|
+
return {
|
|
2345
|
+
id: instance.id,
|
|
2346
|
+
label: instance.label,
|
|
2347
|
+
url: instance.url
|
|
2348
|
+
};
|
|
2349
|
+
}
|
|
2350
|
+
/**
|
|
2351
|
+
* Registry that merges a static `fleet.json` registry with mesh discovery. Static
|
|
2352
|
+
* ALWAYS wins on an id collision (a discovered peer sharing a static id is dropped
|
|
2353
|
+
* — never overwrites a configured instance, never merges auth across sources).
|
|
2354
|
+
* Discovery is cached briefly so a fan-out doesn't re-read the file per call, and a
|
|
2355
|
+
* failed discovery read leaves the static set untouched.
|
|
2356
|
+
*/
|
|
2357
|
+
var MergedFleetRegistry = class {
|
|
2358
|
+
staticRegistry;
|
|
2359
|
+
discover;
|
|
2360
|
+
cache;
|
|
2361
|
+
inflight;
|
|
2362
|
+
ttlMs;
|
|
2363
|
+
now;
|
|
2364
|
+
constructor(options = {}) {
|
|
2365
|
+
this.staticRegistry = options.staticRegistry ?? new FleetRegistry();
|
|
2366
|
+
this.discover = options.discover ?? (() => readMeshPeers());
|
|
2367
|
+
this.ttlMs = options.ttlMs ?? DISCOVERY_CACHE_TTL_MS;
|
|
2368
|
+
this.now = options.now ?? (() => Date.now());
|
|
2369
|
+
}
|
|
2370
|
+
async discoverCached() {
|
|
2371
|
+
const now = this.now();
|
|
2372
|
+
if (this.cache && now - this.cache.at < this.ttlMs) return this.cache.peers;
|
|
2373
|
+
if (this.inflight) return this.inflight;
|
|
2374
|
+
this.inflight = (async () => {
|
|
2375
|
+
let peers;
|
|
2376
|
+
try {
|
|
2377
|
+
peers = await this.discover();
|
|
2378
|
+
} catch {
|
|
2379
|
+
peers = [];
|
|
2380
|
+
}
|
|
2381
|
+
this.cache = {
|
|
2382
|
+
at: this.now(),
|
|
2383
|
+
peers
|
|
2384
|
+
};
|
|
2385
|
+
return peers;
|
|
2386
|
+
})().finally(() => {
|
|
2387
|
+
this.inflight = void 0;
|
|
2388
|
+
});
|
|
2389
|
+
return this.inflight;
|
|
2390
|
+
}
|
|
2391
|
+
/** Static∪discovered with static winning on id collision. */
|
|
2392
|
+
async union() {
|
|
2393
|
+
const staticResolved = await this.staticRegistry.resolveAll();
|
|
2394
|
+
const staticIds = new Set(staticResolved.map((instance) => instance.id));
|
|
2395
|
+
const discovered = (await this.discoverCached()).filter((peer) => !staticIds.has(peer.id));
|
|
2396
|
+
return [...staticResolved, ...discovered];
|
|
2397
|
+
}
|
|
2398
|
+
async resolveInstance(arg) {
|
|
2399
|
+
return selectInstance(await this.union(), arg);
|
|
2400
|
+
}
|
|
2401
|
+
async listInstances() {
|
|
2402
|
+
const staticInfos = await this.staticRegistry.listInstances();
|
|
2403
|
+
const staticIds = new Set(staticInfos.map((info) => info.id));
|
|
2404
|
+
const discovered = (await this.discoverCached()).filter((peer) => !staticIds.has(peer.id));
|
|
2405
|
+
return [...staticInfos, ...discovered.map(toInfo)];
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2223
2409
|
//#endregion
|
|
2224
2410
|
//#region src/lib/fleet/tools.ts
|
|
2225
2411
|
const FLEET_GROUP = "fleet";
|
|
@@ -2255,16 +2441,16 @@ function createFleetTools(options = {}) {
|
|
|
2255
2441
|
const awaitTurnDeadlineSlackMs = nonNegativeNumberOrDefault(options.awaitTurnDeadlineSlackMs, AWAIT_TURN_TIMEOUT_SLACK_MS);
|
|
2256
2442
|
function getRegistry() {
|
|
2257
2443
|
if (registry) return registry;
|
|
2258
|
-
defaultRegistry ??= new
|
|
2444
|
+
defaultRegistry ??= new MergedFleetRegistry();
|
|
2259
2445
|
return defaultRegistry;
|
|
2260
2446
|
}
|
|
2261
2447
|
function clientFor(instance) {
|
|
2262
|
-
const key = `${instance.id}\0${instance.url}\0${instance.token}\0${instance.tunnelId ?? ""}\0${instance.tunnelToken ?? ""}\0${instance.insecureTLS === true ? "1" : "0"}`;
|
|
2448
|
+
const key = `${instance.id}\0${instance.url}\0${instance.auth.type}\0${instance.token}\0${instance.tunnelId ?? ""}\0${instance.tunnelToken ?? ""}\0${instance.insecureTLS === true ? "1" : "0"}`;
|
|
2263
2449
|
const existing = clients.get(key);
|
|
2264
2450
|
if (existing) return existing;
|
|
2265
2451
|
const created = options.createClient ? options.createClient(instance) : new FleetClient({
|
|
2266
2452
|
url: instance.url,
|
|
2267
|
-
|
|
2453
|
+
auth: instance.auth,
|
|
2268
2454
|
fetchFn: options.fetchFn,
|
|
2269
2455
|
insecureTLS: instance.insecureTLS,
|
|
2270
2456
|
...tunnelClientOptions(instance, tunnelProvider)
|
|
@@ -2419,18 +2605,14 @@ function createFleetTools(options = {}) {
|
|
|
2419
2605
|
sessionId: stringProp("Global session id in the form instanceId:localSessionId."),
|
|
2420
2606
|
instance: stringProp("Optional instance id/label; when supplied it must agree with sessionId."),
|
|
2421
2607
|
message: stringProp("Message text to deliver to the session."),
|
|
2422
|
-
idempotencyKey: stringProp("
|
|
2608
|
+
idempotencyKey: stringProp("Optional caller idempotency key; AUTO-GENERATED when omitted, so you normally never pass it. Supply your OWN stable key only when you will retry the SAME send and need the upstream to dedupe it."),
|
|
2423
2609
|
awaitMs: numberProp("Optional best-effort confirmation wait (ms) — NOT a deadline. Prefer awaitMs:0 plus await_turn; a turn that outruns awaitMs returns confirmationPending, not an error.")
|
|
2424
|
-
}, [
|
|
2425
|
-
"sessionId",
|
|
2426
|
-
"message",
|
|
2427
|
-
"idempotencyKey"
|
|
2428
|
-
]), async (args, signal) => {
|
|
2610
|
+
}, ["sessionId", "message"]), async (args, signal) => {
|
|
2429
2611
|
const { instance, localId, globalId } = await resolveSession(args);
|
|
2430
2612
|
const awaitMs = optionalNumber(args, "awaitMs");
|
|
2431
2613
|
const response = await clientFor(instance).sendMessage(localId, {
|
|
2432
2614
|
message: requiredString(args, "message"),
|
|
2433
|
-
idempotencyKey:
|
|
2615
|
+
idempotencyKey: optionalString(args, "idempotencyKey") ?? randomUUID(),
|
|
2434
2616
|
...awaitMs === void 0 ? {} : { awaitMs }
|
|
2435
2617
|
}, signal);
|
|
2436
2618
|
const delivered = !(response.delivered === false || response.delivery?.status === "failed" || response.delivery?.status === "error");
|
|
@@ -2454,18 +2636,14 @@ function createFleetTools(options = {}) {
|
|
|
2454
2636
|
sessionId: stringProp("Global session id in the form instanceId:localSessionId."),
|
|
2455
2637
|
instance: stringProp("Optional instance id/label; when supplied it must agree with sessionId."),
|
|
2456
2638
|
keys: stringProp("Key sequence to send."),
|
|
2457
|
-
idempotencyKey: stringProp("
|
|
2639
|
+
idempotencyKey: stringProp("Optional caller idempotency key; auto-generated when omitted."),
|
|
2458
2640
|
raw: booleanProp("Pass keys through as raw input when the instance supports it.")
|
|
2459
|
-
}, [
|
|
2460
|
-
"sessionId",
|
|
2461
|
-
"keys",
|
|
2462
|
-
"idempotencyKey"
|
|
2463
|
-
]), async (args, signal) => {
|
|
2641
|
+
}, ["sessionId", "keys"]), async (args, signal) => {
|
|
2464
2642
|
const { instance, localId, globalId } = await resolveSession(args);
|
|
2465
2643
|
const raw = optionalBoolean(args, "raw");
|
|
2466
2644
|
const response = await clientFor(instance).sendKeys(localId, {
|
|
2467
2645
|
keys: requiredString(args, "keys"),
|
|
2468
|
-
idempotencyKey:
|
|
2646
|
+
idempotencyKey: optionalString(args, "idempotencyKey") ?? randomUUID(),
|
|
2469
2647
|
...raw === void 0 ? {} : { raw }
|
|
2470
2648
|
}, signal);
|
|
2471
2649
|
return ok({
|
|
@@ -2480,14 +2658,14 @@ function createFleetTools(options = {}) {
|
|
|
2480
2658
|
choice: stringProp("Named or numbered choice to select."),
|
|
2481
2659
|
optionValue: stringProp("Exact option value to select."),
|
|
2482
2660
|
keys: stringProp("Explicit key override to send instead of a mapped choice."),
|
|
2483
|
-
idempotencyKey: stringProp("
|
|
2484
|
-
}, ["sessionId"
|
|
2661
|
+
idempotencyKey: stringProp("Optional caller idempotency key; auto-generated when omitted.")
|
|
2662
|
+
}, ["sessionId"]), async (args, signal) => {
|
|
2485
2663
|
const { instance, localId, globalId } = await resolveSession(args);
|
|
2486
2664
|
const input = definedObject({
|
|
2487
2665
|
choice: optionalString(args, "choice"),
|
|
2488
2666
|
optionValue: optionalString(args, "optionValue"),
|
|
2489
2667
|
keys: optionalString(args, "keys"),
|
|
2490
|
-
idempotencyKey:
|
|
2668
|
+
idempotencyKey: optionalString(args, "idempotencyKey") ?? randomUUID()
|
|
2491
2669
|
});
|
|
2492
2670
|
const response = await clientFor(instance).respond(localId, input, signal);
|
|
2493
2671
|
return ok({
|
|
@@ -2501,19 +2679,15 @@ function createFleetTools(options = {}) {
|
|
|
2501
2679
|
agent: stringProp("Agent/runtime to create on the instance."),
|
|
2502
2680
|
name: stringProp("Optional display name for the session."),
|
|
2503
2681
|
workingDir: stringProp("Optional working directory on the remote instance."),
|
|
2504
|
-
idempotencyKey: stringProp("
|
|
2682
|
+
idempotencyKey: stringProp("Optional caller idempotency key; auto-generated when omitted."),
|
|
2505
2683
|
start: booleanProp("Whether the remote instance should start the session immediately."),
|
|
2506
2684
|
readyTimeoutMs: numberProp("F17: bounded ms to wait for the agent to become driveable before returning. The response carries ready/bound/blocker."),
|
|
2507
2685
|
permissionMode: stringProp("F10 (claude only): permission mode the launched agent starts in — one of plan | acceptEdits | default | bypassPermissions. Rejected with BAD_REQUEST if unknown or if agentArgs also sets it."),
|
|
2508
2686
|
agentArgs: arrayProp("F10 (claude only): extra launcher args appended after the github-router prefix. Must NOT include --permission-mode or --dangerously-skip-permissions (use permissionMode) — rejected with BAD_REQUEST.")
|
|
2509
|
-
}, [
|
|
2510
|
-
"instance",
|
|
2511
|
-
"agent",
|
|
2512
|
-
"idempotencyKey"
|
|
2513
|
-
]), async (args, signal) => {
|
|
2687
|
+
}, ["instance", "agent"]), async (args, signal) => {
|
|
2514
2688
|
const instance = await resolve(requiredString(args, "instance"));
|
|
2515
2689
|
const agent = requiredString(args, "agent");
|
|
2516
|
-
const idempotencyKey =
|
|
2690
|
+
const idempotencyKey = optionalString(args, "idempotencyKey") ?? randomUUID();
|
|
2517
2691
|
const permissionMode = optionalString(args, "permissionMode");
|
|
2518
2692
|
const agentArgs = optionalStringArray(args, "agentArgs");
|
|
2519
2693
|
if (permissionMode !== void 0) await assertCapability(instance, "permission_mode", "permissionMode", signal);
|
|
@@ -2538,11 +2712,11 @@ function createFleetTools(options = {}) {
|
|
|
2538
2712
|
tool$1("stop_session", "Stop a fleet session.", objectSchema({
|
|
2539
2713
|
sessionId: stringProp("Global session id in the form instanceId:localSessionId."),
|
|
2540
2714
|
instance: stringProp("Optional instance id/label; when supplied it must agree with sessionId."),
|
|
2541
|
-
idempotencyKey: stringProp("
|
|
2715
|
+
idempotencyKey: stringProp("Optional caller idempotency key; auto-generated when omitted."),
|
|
2542
2716
|
mode: stringProp("Optional stop mode understood by the remote instance.")
|
|
2543
|
-
}, ["sessionId"
|
|
2717
|
+
}, ["sessionId"]), async (args, signal) => {
|
|
2544
2718
|
const { instance, localId, globalId } = await resolveSession(args);
|
|
2545
|
-
const idempotencyKey =
|
|
2719
|
+
const idempotencyKey = optionalString(args, "idempotencyKey") ?? randomUUID();
|
|
2546
2720
|
const response = await clientFor(instance).stopSession(localId, definedObject({
|
|
2547
2721
|
mode: optionalString(args, "mode"),
|
|
2548
2722
|
idempotencyKey
|
|
@@ -22741,4 +22915,4 @@ async function runStandInToolCall(args, signal) {
|
|
|
22741
22915
|
|
|
22742
22916
|
//#endregion
|
|
22743
22917
|
export { readIteratorWithTimeout as $, state as $t, DEFAULT_MODEL as A, generateRandomPort as At, toolbeltSkipSet as B, filterBetaHeader as Bt, repoRoot as C, toolbeltPathOverride as Ct, resolveSealedGate as D, DEFAULT_PORT as Dt, trustRepo as E, DEFAULT_CODEX_MODEL_FALLBACKS as Et, runWorkerAgent as F, setupGitHubToken as Ft, ADVISOR_INTERNAL_TOOL_NAME as G, getModels as Gt, TOOLBELT_TOOLS$1 as H, resolveCodexModel as Ht, withNoOutputRetry as I, tryRefreshAndRetry as It, injectAdvisorTool as J, forwardError as Jt, ADVISOR_TOOL_INSTRUCTIONS as K, fetchWithTransientRetry as Kt, availableToolCommands as L, cacheCopilotVersion as Lt, PLAN_DEFAULT_MODEL as M, getPackageVersion as Mt, REVIEW_DEFAULT_MODEL as N, withInstallLock as Nt, liveExec as O, UPSTREAM_FETCH_TIMEOUT_MS as Ot, appendPlanReminder as P, setupCopilotToken as Pt, logStreamError as Q, githubHeaders as Qt, buildToolbeltAwareness as R, cacheModels as Rt, repoFingerprint as S, collapsePathKeys as St, stopReviewStateDir as T, DEFAULT_CODEX_MODEL as Tt, assetFor as U, resolveModel as Ut, vscodeRipgrepPath as V, isNullish as Vt, searchWeb as W, sleep as Wt, buildOpenAIErrorEvent as X, copilotBaseUrl as Xt, isAdvisorRequested as Y, GITHUB_API_BASE_URL as Yt, isControllerClosedError as Z, copilotHeaders as Zt, fileBaselineStore as _, provisionAndIndexColbert as _t, buildPeerAwarenessSnippet as a, standInToolEnabled as at, fileReviewDebounce as b, shouldUseInsecureTls as bt, buildSessionBindHookCommand as c, createMessages as ct, decideStopHook as d, createChatCompletions as dt, relayAnthropicStream as et, fileBlockBudget as f, MAX_RESPONSE_BODY_BYTES as ft, stopReviewEnabled as g, hasSupportedBrowserInstalled as gt, stopGateId as h, provisionBrowserAssets as ht, buildAgentPrompt as i, fleetToolsEnabled as it, IMPLEMENT_DEFAULT_MODEL as j, pickClaudeDefault as jt, BROWSE_DEFAULT_MODEL as k, UPSTREAM_INACTIVITY_TIMEOUT_MS as kt, buildStopHookCommand as l, getTokenCount as lt, launchBaselineKey as m, parseJsonOrDiagnose as mt, MCP_GROUPS as n, handleMcpPost as nt, personasFor as o, workerToolsEnabled as ot, injectStopHookIntoSettingsFile as p, readResponseBodyCapped as pt, buildAdvisorStream as q, HTTPError as qt, assertMcpToolSurfaceConsistent as r, browserToolsEnabled as rt, buildArtifactOpenHookCommand as s, countTokens as st, GROUP_META as t, handleMcpDelete as tt, captureLaunchBaseline as u, createResponses as ut, fileFindingsStore as v, extractTarGzMember as vt, stopGateEnabledForRepo as w, DEFAULT_CLAUDE_MODEL_FALLBACKS as wt, isSubagentContext as x, ArtifactClient as xt, fileLastPromptStore as y, extractZipMember as yt, toolbeltEnabled as z, cacheVSCodeVersion as zt };
|
|
22744
|
-
//# sourceMappingURL=peer-mcp-personas-
|
|
22918
|
+
//# sourceMappingURL=peer-mcp-personas-Dmx4S0_5.js.map
|