Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion native/cli.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const networkStore = require("./network-store.cjs");
const { parseDoCommands } = require("./do-parser.cjs");
const { executeDoSteps } = require("./do-executor.cjs");

const SOCKET_PATH = "/tmp/surf.sock";
const SOCKET_PATH = process.platform === "win32"
? "\\\\.\\pipe\\surf-sock"
: path.join(os.tmpdir(), "surf.sock");

// ============================================================================
// Workflow Resolution and Management
Expand Down
6 changes: 5 additions & 1 deletion native/do-executor.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
*/

const net = require("net");
const os = require("os");
const path = require("path");

const SOCKET_PATH = "/tmp/surf.sock";
const SOCKET_PATH = process.platform === "win32"
? "\\\\.\\pipe\\surf-sock"
: path.join(os.tmpdir(), "surf.sock");

// Maximum iterations for loops (safety cap)
const MAX_LOOP_ITERATIONS = 100;
Expand Down
8 changes: 6 additions & 2 deletions native/host.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const perplexityClient = require("./perplexity-client.cjs");
const grokClient = require("./grok-client.cjs");
const { mapToolToMessage, mapComputerAction, formatToolContent } = require("./host-helpers.cjs");

const SOCKET_PATH = "/tmp/surf.sock";
const SOCKET_PATH = process.platform === "win32"
? "\\\\.\\pipe\\surf-sock"
: path.join(os.tmpdir(), "surf.sock");

// Cross-platform image resize (macOS: sips, Linux: ImageMagick)
function resizeImage(filePath, maxSize) {
Expand Down Expand Up @@ -73,7 +75,9 @@ async function processAiQueue() {
setTimeout(processAiQueue, 2000);
}
}
const LOG_FILE = "/tmp/surf-host.log";
const LOG_FILE = process.platform === "win32"
? path.join(os.tmpdir(), "surf-host.log")
: "/tmp/surf-host.log";
const AUTH_FILE = path.join(os.homedir(), ".pi", "agent", "auth.json");

const DEFAULT_RETRY_OPTIONS = {
Expand Down
6 changes: 5 additions & 1 deletion native/mcp-server.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/usr/bin/env node
const net = require("net");
const os = require("os");
const path = require("path");
const { McpServer } = require("@modelcontextprotocol/sdk/server/mcp.js");
const { StdioServerTransport } = require("@modelcontextprotocol/sdk/server/stdio.js");
const { z } = require("zod");

const SOCKET_PATH = "/tmp/surf.sock";
const SOCKET_PATH = process.platform === "win32"
? "\\\\.\\pipe\\surf-sock"
: path.join(os.tmpdir(), "surf.sock");
const REQUEST_TIMEOUT = 30000;

const TOOL_SCHEMAS = {
Expand Down