@factiii/runner 0.9.4 → 0.9.6

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.
Files changed (2) hide show
  1. package/dist/cli.js +33 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -23827,6 +23827,32 @@ var localConfigProvider = {
23827
23827
  };
23828
23828
 
23829
23829
  // src/daemon.ts
23830
+ function toRtcIceServers(servers) {
23831
+ const fallback = ["stun:stun.l.google.com:19302"];
23832
+ if (!servers?.length) return fallback;
23833
+ const out = [];
23834
+ for (const server of servers) {
23835
+ const urls = Array.isArray(server.urls) ? server.urls : [server.urls];
23836
+ for (const url2 of urls) {
23837
+ const turn = /^(turns?):([^:?]+)(?::(\d+))?(?:\?transport=(udp|tcp))?$/.exec(
23838
+ url2
23839
+ );
23840
+ if (!turn || !server.username || !server.credential) {
23841
+ out.push(url2);
23842
+ continue;
23843
+ }
23844
+ const [, scheme, hostname, port, transport] = turn;
23845
+ out.push({
23846
+ hostname,
23847
+ port: Number(port ?? (scheme === "turns" ? 5349 : 3478)),
23848
+ username: server.username,
23849
+ password: server.credential,
23850
+ relayType: scheme === "turns" ? import_node_datachannel.RelayType.TurnTls : transport === "tcp" ? import_node_datachannel.RelayType.TurnTcp : import_node_datachannel.RelayType.TurnUdp
23851
+ });
23852
+ }
23853
+ }
23854
+ return out.length > 0 ? out : fallback;
23855
+ }
23830
23856
  function toChannelScope(raw) {
23831
23857
  if (!raw || raw.role === "owner") return { role: "owner" };
23832
23858
  return { role: "member", spaceSlugs: new Set(raw.spaceSlugs) };
@@ -24107,9 +24133,13 @@ async function startDaemon(config) {
24107
24133
  console.log(`Received WebRTC offer from ${data.fromSocketId}`);
24108
24134
  const scope = toChannelScope(data.scope);
24109
24135
  try {
24110
- const peer = new import_node_datachannel.PeerConnection("runner", {
24111
- iceServers: ["stun:stun.l.google.com:19302"]
24112
- });
24136
+ const iceServers = toRtcIceServers(data.iceServers);
24137
+ console.log(
24138
+ `[webrtc] ICE servers: ${iceServers.map(
24139
+ (u) => typeof u === "string" ? u : `${u.relayType}:${u.hostname}:${u.port} user=${u.username?.slice(0, 8)}\u2026`
24140
+ ).join(", ")}`
24141
+ );
24142
+ const peer = new import_node_datachannel.PeerConnection("runner", { iceServers });
24113
24143
  const iceCandidateHandler = (msg) => {
24114
24144
  if (msg.fromSocketId === data.fromSocketId) {
24115
24145
  console.log(`[webrtc] remote ICE candidate: ${msg.candidate.candidate.slice(0, 60)}...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factiii/runner",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Factiii Runner, run Board AI agents on a machine you control. Pairs with the Factiii web/mobile clients over WebRTC.",
5
5
  "license": "ISC",
6
6
  "keywords": [