@cabane/companion 0.6.123 → 0.6.124
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/cli.js +27 -6
- package/dist/runtime.js +3 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9640,8 +9640,10 @@ var init_dispatcher = __esm({
|
|
|
9640
9640
|
});
|
|
9641
9641
|
|
|
9642
9642
|
// src/runner/harness-sandbox.ts
|
|
9643
|
+
import { lookup } from "dns/promises";
|
|
9643
9644
|
import { chmodSync as chmodSync5, mkdirSync as mkdirSync9, mkdtempSync, rmSync as rmSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
9644
|
-
import {
|
|
9645
|
+
import { isIP } from "net";
|
|
9646
|
+
import { homedir as homedir3, networkInterfaces, tmpdir as tmpdir2, userInfo as userInfo2 } from "os";
|
|
9645
9647
|
import { join as join15 } from "path";
|
|
9646
9648
|
import { SandboxManager } from "@anthropic-ai/sandbox-runtime";
|
|
9647
9649
|
function accountHome() {
|
|
@@ -9654,19 +9656,36 @@ function accountHome() {
|
|
|
9654
9656
|
function shellQuote(value) {
|
|
9655
9657
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
9656
9658
|
}
|
|
9657
|
-
function
|
|
9659
|
+
function cabaneHostEntries(baseUrl, resolved, ownAddresses2) {
|
|
9658
9660
|
const url = new URL(baseUrl);
|
|
9659
|
-
const loopback = ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname);
|
|
9660
|
-
if (!loopback) return url.hostname;
|
|
9661
9661
|
const port = url.port || (url.protocol === "https:" ? "443" : "80");
|
|
9662
|
-
return `127.0.0.1:${port}
|
|
9662
|
+
if (["127.0.0.1", "localhost", "[::1]"].includes(url.hostname)) return [`127.0.0.1:${port}`];
|
|
9663
|
+
const own = new Set(ownAddresses2);
|
|
9664
|
+
const literals = resolved.filter((address) => own.has(address)).map((address) => address.includes(":") ? `[${address}]:${port}` : `${address}:${port}`);
|
|
9665
|
+
return [url.hostname, ...literals];
|
|
9666
|
+
}
|
|
9667
|
+
async function resolvedAddresses(baseUrl) {
|
|
9668
|
+
const { hostname: hostname5 } = new URL(baseUrl);
|
|
9669
|
+
if (isIP(hostname5)) return [];
|
|
9670
|
+
try {
|
|
9671
|
+
const answers = await lookup(hostname5, { all: true });
|
|
9672
|
+
return answers.map((a) => a.address);
|
|
9673
|
+
} catch {
|
|
9674
|
+
return [];
|
|
9675
|
+
}
|
|
9676
|
+
}
|
|
9677
|
+
function ownAddresses() {
|
|
9678
|
+
return Object.values(networkInterfaces()).flat().flatMap((i) => i ? [i.address] : []);
|
|
9663
9679
|
}
|
|
9664
9680
|
function harnessSandboxConfig(input) {
|
|
9665
9681
|
const claudeDir = input.claudeConfigDir ?? join15(input.home, ".claude");
|
|
9666
9682
|
const codexDir = input.codexHome ?? join15(input.home, ".codex");
|
|
9667
9683
|
return {
|
|
9668
9684
|
network: {
|
|
9669
|
-
allowedDomains: [
|
|
9685
|
+
allowedDomains: [
|
|
9686
|
+
...cabaneHostEntries(input.baseUrl, input.resolved, input.ownAddresses),
|
|
9687
|
+
...MODEL_AND_GIT_HOSTS
|
|
9688
|
+
],
|
|
9670
9689
|
deniedDomains: [],
|
|
9671
9690
|
allowLocalBinding: true
|
|
9672
9691
|
},
|
|
@@ -9719,6 +9738,8 @@ async function prepareHarnessSandbox(input) {
|
|
|
9719
9738
|
const config = harnessSandboxConfig({
|
|
9720
9739
|
cwd: input.cwd,
|
|
9721
9740
|
baseUrl: input.baseUrl,
|
|
9741
|
+
resolved: await resolvedAddresses(input.baseUrl),
|
|
9742
|
+
ownAddresses: ownAddresses(),
|
|
9722
9743
|
home: homedir3(),
|
|
9723
9744
|
accountHome: accountHome(),
|
|
9724
9745
|
tmp: tmpdir2(),
|
package/dist/runtime.js
CHANGED
|
@@ -10797,8 +10797,10 @@ var DeviceLocks = class {
|
|
|
10797
10797
|
};
|
|
10798
10798
|
|
|
10799
10799
|
// src/runner/harness-sandbox.ts
|
|
10800
|
+
import { lookup } from "dns/promises";
|
|
10800
10801
|
import { chmodSync as chmodSync5, mkdirSync as mkdirSync9, mkdtempSync, rmSync as rmSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
10801
|
-
import {
|
|
10802
|
+
import { isIP } from "net";
|
|
10803
|
+
import { homedir as homedir3, networkInterfaces, tmpdir as tmpdir2, userInfo as userInfo2 } from "os";
|
|
10802
10804
|
import { join as join15 } from "path";
|
|
10803
10805
|
import { SandboxManager } from "@anthropic-ai/sandbox-runtime";
|
|
10804
10806
|
function osSandboxUsable(log) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabane/companion",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.124",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Cabane Companion (headless): connect a coding agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
|
|
6
6
|
"license": "UNLICENSED",
|