@factiii/runner 0.9.4 → 0.9.5

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 +24 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -23827,6 +23827,25 @@ 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?):(.+)$/.exec(url2);
23838
+ if (!turn || !server.username || !server.credential) {
23839
+ out.push(url2);
23840
+ continue;
23841
+ }
23842
+ const user = encodeURIComponent(server.username);
23843
+ const pass = encodeURIComponent(server.credential);
23844
+ out.push(`${turn[1]}:${user}:${pass}@${turn[2]}`);
23845
+ }
23846
+ }
23847
+ return out.length > 0 ? out : fallback;
23848
+ }
23830
23849
  function toChannelScope(raw) {
23831
23850
  if (!raw || raw.role === "owner") return { role: "owner" };
23832
23851
  return { role: "member", spaceSlugs: new Set(raw.spaceSlugs) };
@@ -24107,9 +24126,11 @@ async function startDaemon(config) {
24107
24126
  console.log(`Received WebRTC offer from ${data.fromSocketId}`);
24108
24127
  const scope = toChannelScope(data.scope);
24109
24128
  try {
24110
- const peer = new import_node_datachannel.PeerConnection("runner", {
24111
- iceServers: ["stun:stun.l.google.com:19302"]
24112
- });
24129
+ const iceServers = toRtcIceServers(data.iceServers);
24130
+ console.log(
24131
+ `[webrtc] ICE servers: ${iceServers.map((u) => u.replace(/:[^:@]+@/, ":***@")).join(", ")}`
24132
+ );
24133
+ const peer = new import_node_datachannel.PeerConnection("runner", { iceServers });
24113
24134
  const iceCandidateHandler = (msg) => {
24114
24135
  if (msg.fromSocketId === data.fromSocketId) {
24115
24136
  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.5",
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": [