@factiii/runner 0.9.0 → 0.9.1

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 +48 -10
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -15239,6 +15239,9 @@ ${buildPrompt(prompts_default.implement)}`;
15239
15239
  }
15240
15240
  };
15241
15241
 
15242
+ // ../../shared/all/helpers/terminal-ai/terminal-mode.ts
15243
+ var import_crypto4 = require("crypto");
15244
+
15242
15245
  // ../../shared/all/helpers/board-agent-core/tmux.ts
15243
15246
  var TMUX_CONF = [
15244
15247
  // Wheel scrolls, drag selects in copy mode.
@@ -15659,6 +15662,34 @@ var TerminalModeEngine = class {
15659
15662
  const session = this.sessions.get(String(postId));
15660
15663
  if (session) delete session.buffers[path15];
15661
15664
  }
15665
+ /** Write a dropped image to the per-space drops dir (`paths.root`, OUTSIDE the
15666
+ * card worktree so it never touches the repo) and return its absolute path. */
15667
+ async terminalDropImage({
15668
+ postId,
15669
+ content,
15670
+ ext
15671
+ }) {
15672
+ const target = this.getBareTarget(postId);
15673
+ if (!/^[A-Za-z0-9+/=\n\r]*$/.test(content)) {
15674
+ throw new Error("Invalid base64 payload.");
15675
+ }
15676
+ if (content.length > 14e6) {
15677
+ throw new Error("Image too large (max ~10MB).");
15678
+ }
15679
+ const safeExt = (ext || "png").toLowerCase().replace(/[^a-z0-9]/g, "") || "png";
15680
+ const dropsDir = `${target.paths.root}/drops`;
15681
+ const abs = `${dropsDir}/${(0, import_crypto4.randomUUID)()}.${safeExt}`;
15682
+ await target.sh(
15683
+ `mkdir -p ${shEscape(dropsDir)} && printf %s ${shEscape(content)} | base64 -d > ${shEscape(abs)}`
15684
+ );
15685
+ try {
15686
+ await target.sh(
15687
+ `find ${shEscape(dropsDir)} -type f -mtime +1 -delete 2>/dev/null || true`
15688
+ );
15689
+ } catch {
15690
+ }
15691
+ return abs;
15692
+ }
15662
15693
  bareEditorState({
15663
15694
  postId: rawPostId
15664
15695
  }) {
@@ -16717,7 +16748,7 @@ var import_path11 = __toESM(require("path"));
16717
16748
 
16718
16749
  // ../../shared/all/helpers/board-agent-core/host-secrets.ts
16719
16750
  var import_child_process6 = require("child_process");
16720
- var import_crypto4 = __toESM(require("crypto"));
16751
+ var import_crypto5 = __toESM(require("crypto"));
16721
16752
  var import_promises4 = __toESM(require("fs/promises"));
16722
16753
  var import_path10 = __toESM(require("path"));
16723
16754
  var import_util6 = require("util");
@@ -16745,7 +16776,7 @@ async function assertBinaries() {
16745
16776
  }
16746
16777
  }
16747
16778
  function deriveKey(password, salt) {
16748
- return import_crypto4.default.scryptSync(password, salt, 32, {
16779
+ return import_crypto5.default.scryptSync(password, salt, 32, {
16749
16780
  N: SCRYPT_N2,
16750
16781
  maxmem: 64 * 1024 * 1024
16751
16782
  });
@@ -16774,9 +16805,9 @@ async function initSecrets(configDir, password) {
16774
16805
  if (!identity || !recipient) {
16775
16806
  throw new Error("age-keygen returned no usable keypair.");
16776
16807
  }
16777
- const salt = import_crypto4.default.randomBytes(16);
16778
- const iv = import_crypto4.default.randomBytes(12);
16779
- const cipher = import_crypto4.default.createCipheriv(
16808
+ const salt = import_crypto5.default.randomBytes(16);
16809
+ const iv = import_crypto5.default.randomBytes(12);
16810
+ const cipher = import_crypto5.default.createCipheriv(
16780
16811
  "aes-256-gcm",
16781
16812
  deriveKey(password, salt),
16782
16813
  iv
@@ -16801,7 +16832,7 @@ async function initSecrets(configDir, password) {
16801
16832
  return { success: true };
16802
16833
  }
16803
16834
  function decryptIdentity(box, password) {
16804
- const decipher = import_crypto4.default.createDecipheriv(
16835
+ const decipher = import_crypto5.default.createDecipheriv(
16805
16836
  "aes-256-gcm",
16806
16837
  deriveKey(password, Buffer.from(box.salt, "base64")),
16807
16838
  Buffer.from(box.iv, "base64")
@@ -18392,6 +18423,9 @@ var BoardAgentEngine = class _BoardAgentEngine {
18392
18423
  bareFsWrite(p) {
18393
18424
  return this.terminal.bareFsWrite(p);
18394
18425
  }
18426
+ terminalDropImage(p) {
18427
+ return this.terminal.terminalDropImage(p);
18428
+ }
18395
18429
  bareFsDelete(p) {
18396
18430
  return this.terminal.bareFsDelete(p);
18397
18431
  }
@@ -18965,6 +18999,10 @@ ${c.content.trim() || "(no description)"}`
18965
18999
  payload
18966
19000
  );
18967
19001
  return void 0;
19002
+ case "terminalDropImage":
19003
+ return await this.terminalDropImage(
19004
+ payload
19005
+ );
18968
19006
  case "bareFsDelete":
18969
19007
  await this.bareFsDelete(
18970
19008
  payload
@@ -19029,7 +19067,7 @@ ${c.content.trim() || "(no description)"}`
19029
19067
 
19030
19068
  // ../../shared/all/helpers/board-agent-core/index-service.ts
19031
19069
  var import_child_process7 = require("child_process");
19032
- var import_crypto5 = require("crypto");
19070
+ var import_crypto6 = require("crypto");
19033
19071
  var import_fs7 = require("fs");
19034
19072
  var import_promises5 = __toESM(require("fs/promises"));
19035
19073
  var import_net2 = require("net");
@@ -19047,7 +19085,7 @@ var IndexService = class {
19047
19085
  /** Per-space bearer for MCP + file, derived from the control token (the
19048
19086
  * service computes the same). */
19049
19087
  bearerToken(spaceSlug) {
19050
- return (0, import_crypto5.createHmac)("sha256", this.opts.controlToken).update(`mcp:${spaceSlug}`).digest("hex");
19088
+ return (0, import_crypto6.createHmac)("sha256", this.opts.controlToken).update(`mcp:${spaceSlug}`).digest("hex");
19051
19089
  }
19052
19090
  /** MCP bridge for a space. Null until the service is up (which it kicks
19053
19091
  * off), so a bad :0 URL is never baked in; provisionMcpLane re-runs. */
@@ -19398,7 +19436,7 @@ function makeChunkReassembler() {
19398
19436
  }
19399
19437
 
19400
19438
  // src/daemon.ts
19401
- var import_crypto6 = require("crypto");
19439
+ var import_crypto7 = require("crypto");
19402
19440
  var import_fs9 = __toESM(require("fs"));
19403
19441
  var import_node_datachannel = require("node-datachannel");
19404
19442
  var import_path15 = __toESM(require("path"));
@@ -23420,7 +23458,7 @@ async function startDaemon(config) {
23420
23458
  ];
23421
23459
  const indexDir = indexCandidates.find((p) => import_fs9.default.existsSync(p)) ?? indexCandidates[0];
23422
23460
  const odIndex = new IndexService({
23423
- controlToken: (0, import_crypto6.createHash)("sha256").update(config.authToken).digest("hex"),
23461
+ controlToken: (0, import_crypto7.createHash)("sha256").update(config.authToken).digest("hex"),
23424
23462
  embedUrl: () => config.serverUrl,
23425
23463
  indexDir,
23426
23464
  dataDir: import_path15.default.join(CONFIG_DIR, "index-data")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factiii/runner",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
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": [