@acepaste/ingress 0.9.1 → 0.9.21
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/LICENSE +1 -1
- package/dist/src/adapters.d.ts +9 -0
- package/dist/src/adapters.js +76 -6
- package/dist/src/agent-hooks.d.ts +112 -0
- package/dist/src/agent-hooks.js +533 -0
- package/dist/src/approvers.d.ts +16 -0
- package/dist/src/approvers.js +50 -0
- package/dist/src/audio.d.ts +70 -0
- package/dist/src/audio.js +224 -0
- package/dist/src/audit-changes.d.ts +46 -0
- package/dist/src/audit-changes.js +110 -0
- package/dist/src/audit-local.d.ts +57 -0
- package/dist/src/audit-local.js +231 -0
- package/dist/src/audit-parsers.d.ts +1 -1
- package/dist/src/audit.js +48 -0
- package/dist/src/broker.d.ts +92 -1
- package/dist/src/broker.js +222 -3
- package/dist/src/calendar.d.ts +36 -0
- package/dist/src/calendar.js +227 -0
- package/dist/src/captions.d.ts +44 -0
- package/dist/src/captions.js +209 -0
- package/dist/src/changes.d.ts +105 -0
- package/dist/src/changes.js +174 -0
- package/dist/src/character.js +19 -3
- package/dist/src/classifier-model.d.ts +53 -0
- package/dist/src/classifier-model.js +3 -0
- package/dist/src/classifier.d.ts +41 -0
- package/dist/src/classifier.js +213 -0
- package/dist/src/cli.js +501 -1
- package/dist/src/codepass.d.ts +8 -0
- package/dist/src/codepass.js +39 -1
- package/dist/src/egress.d.ts +71 -0
- package/dist/src/egress.js +242 -0
- package/dist/src/email.d.ts +42 -0
- package/dist/src/email.js +424 -0
- package/dist/src/engine.d.ts +35 -12
- package/dist/src/engine.js +172 -45
- package/dist/src/image-meta.d.ts +33 -0
- package/dist/src/image-meta.js +433 -0
- package/dist/src/image.d.ts +104 -0
- package/dist/src/image.js +347 -0
- package/dist/src/index.d.ts +50 -5
- package/dist/src/index.js +28 -3
- package/dist/src/localguard.d.ts +33 -0
- package/dist/src/localguard.js +61 -0
- package/dist/src/meaning.d.ts +2 -0
- package/dist/src/meaning.js +348 -25
- package/dist/src/messages.d.ts +79 -0
- package/dist/src/messages.js +431 -0
- package/dist/src/multilingual.d.ts +3 -0
- package/dist/src/multilingual.js +117 -5
- package/dist/src/nearby.d.ts +52 -0
- package/dist/src/nearby.js +186 -0
- package/dist/src/netpolicy.js +50 -19
- package/dist/src/normalize.d.ts +36 -1
- package/dist/src/normalize.js +186 -4
- package/dist/src/provenance.d.ts +56 -0
- package/dist/src/provenance.js +114 -0
- package/dist/src/qr.d.ts +25 -0
- package/dist/src/qr.js +113 -0
- package/dist/src/safeguards.d.ts +61 -0
- package/dist/src/safeguards.js +199 -0
- package/dist/src/served.d.ts +20 -0
- package/dist/src/served.js +53 -0
- package/dist/src/shell-commands.d.ts +39 -0
- package/dist/src/shell-commands.js +291 -0
- package/dist/src/shortcuts.d.ts +45 -0
- package/dist/src/shortcuts.js +220 -0
- package/dist/src/stream.d.ts +88 -0
- package/dist/src/stream.js +119 -0
- package/dist/src/terminal.d.ts +29 -0
- package/dist/src/terminal.js +313 -0
- package/dist/src/tooldefs.d.ts +84 -0
- package/dist/src/tooldefs.js +122 -0
- package/dist/src/types.d.ts +50 -6
- package/dist/src/types.js +15 -2
- package/dist/src/visibility.d.ts +23 -3
- package/dist/src/visibility.js +285 -78
- package/native/ingress-presence.swift +48 -0
- package/native/ingress-vision.swift +417 -0
- package/package.json +4 -2
package/dist/src/cli.js
CHANGED
|
@@ -17,6 +17,23 @@ import { loadPolicyFile } from "./policyfile.js";
|
|
|
17
17
|
import { checkInstructionFiles, approveInstructionFile, readInstructionBytes } from "./instructions.js";
|
|
18
18
|
import { macosDialogApprover } from "./approvers.js";
|
|
19
19
|
import { auditEnvironment, formatAudit } from "./audit.js";
|
|
20
|
+
import { trackAudit, confirmAuditArea, formatAuditChanges, AUDIT_NEEDS_CONFIRMATION } from "./audit-changes.js";
|
|
21
|
+
import { confirmServerTools, describeServerTools } from "./tooldefs.js";
|
|
22
|
+
import { BaselineStore } from "./changes.js";
|
|
23
|
+
import { engageStop, clearStop, stopReason } from "./safeguards.js";
|
|
24
|
+
import { postToolUse, preToolUse, userPromptSubmit, preCompact, postCompact, sessionStart, remoteGate } from "./agent-hooks.js";
|
|
25
|
+
import { Blocklist, BLOCKLIST_FEEDS } from "./egress.js";
|
|
26
|
+
import { ProvenanceLedger, describeMark, downloadOrigin } from "./provenance.js";
|
|
27
|
+
import { buildVisionHelper, buildNativeHelper, visionHelperPath, visionHelperProblem } from "./image.js";
|
|
28
|
+
import { presenceHelperPath } from "./approvers.js";
|
|
29
|
+
import { collectNearby } from "./nearby.js";
|
|
30
|
+
import { execFileSync } from "node:child_process";
|
|
31
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
32
|
+
import { tmpdir } from "node:os";
|
|
33
|
+
import { stateDir } from "./changes.js";
|
|
34
|
+
import { appendFileSync, mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
35
|
+
import { homedir } from "node:os";
|
|
36
|
+
import { join } from "node:path";
|
|
20
37
|
import { createInterface } from "node:readline/promises";
|
|
21
38
|
import { userInfo } from "node:os";
|
|
22
39
|
const args = process.argv.slice(2);
|
|
@@ -28,6 +45,155 @@ async function main() {
|
|
|
28
45
|
c.push(x); return Buffer.concat(c).toString("utf8"); };
|
|
29
46
|
if (args[0] === "instructions")
|
|
30
47
|
return instructionsCommand(args.slice(1));
|
|
48
|
+
if (args[0] === "hook")
|
|
49
|
+
return hookCommand(args[1], await chunksIn());
|
|
50
|
+
if (args[0] === "tools")
|
|
51
|
+
return toolsCommand(args.slice(1));
|
|
52
|
+
if (args[0] === "blocklist")
|
|
53
|
+
return blocklistCommand(args.slice(1));
|
|
54
|
+
if (args[0] === "provenance")
|
|
55
|
+
return provenanceCommand(args.slice(1));
|
|
56
|
+
if (args[0] === "vision")
|
|
57
|
+
return visionCommand(args.slice(1));
|
|
58
|
+
// ingress presence [build|check]: the helper that asks macOS to confirm a person is at the machine (Touch ID or password)
|
|
59
|
+
if (args[0] === "presence") {
|
|
60
|
+
if (args[1] === "build") {
|
|
61
|
+
try {
|
|
62
|
+
const b = await buildNativeHelper("ingress-presence");
|
|
63
|
+
console.log(`built ${b.path}\nsha256 ${b.sha256}\nuse it with INGRESS_APPROVER=macos-presence`);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
console.error(`not built: ${e.message}`);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
console.log(execFileSync(presenceHelperPath(), ["--check"], { encoding: "utf8", timeout: 10_000 }).trim());
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
console.error("not ready: the presence helper is not built (run: ingress presence build)");
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// ingress nearby [--json] [--seconds=3]: what devices around this Mac say about themselves, read as content (read-only)
|
|
81
|
+
if (args[0] === "nearby") {
|
|
82
|
+
const records = await collectNearby({ seconds: Number(opt("seconds") ?? 3) });
|
|
83
|
+
const engine = new IngressEngine({ sandbox: "off" }, { log: () => { } });
|
|
84
|
+
const r = await engine.scan(JSON.stringify(records), { kind: "nearby", url: "nearby:this-mac" });
|
|
85
|
+
if (flag("json")) {
|
|
86
|
+
console.log(JSON.stringify({ records, result: r }, null, 2));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const by = (t) => records.filter((x) => x.type === t).length;
|
|
90
|
+
console.log(`${records.length} records: ${by("bonjour")} Bonjour services, ${by("bluetooth")} Bluetooth devices, ${by("printer")} printers`);
|
|
91
|
+
console.log(`verdict: ${r.tier} (score ${r.score})`);
|
|
92
|
+
for (const f of r.findings.filter((x) => x.confidence * x.severity >= 0.05))
|
|
93
|
+
console.log(` [${f.kind}] ${f.message}`);
|
|
94
|
+
if (r.tier !== "clean")
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// ingress shortcut <file>: what a shortcut can do, before it is installed
|
|
99
|
+
if (args[0] === "shortcut") {
|
|
100
|
+
const file = args[1];
|
|
101
|
+
if (!file) {
|
|
102
|
+
console.error("usage: ingress shortcut <file.shortcut | file.json | file.plist> [--json]");
|
|
103
|
+
process.exit(2);
|
|
104
|
+
}
|
|
105
|
+
let text = readFileSync(file).toString("latin1");
|
|
106
|
+
// a binary property list is converted by the system's own tool; a signed shortcut cannot be read
|
|
107
|
+
if (text.startsWith("bplist00") && process.platform === "darwin") {
|
|
108
|
+
try {
|
|
109
|
+
text = execFileSync("/usr/bin/plutil", ["-convert", "json", "-o", "-", file], { encoding: "utf8", timeout: 20_000, maxBuffer: 64 * 1024 * 1024 });
|
|
110
|
+
}
|
|
111
|
+
catch { /* scanned as it is, and the result says it was not read */ }
|
|
112
|
+
}
|
|
113
|
+
else if (!text.startsWith("AEA1"))
|
|
114
|
+
text = readFileSync(file, "utf8");
|
|
115
|
+
const engine = new IngressEngine({ sandbox: "off" }, { log: () => { } });
|
|
116
|
+
const r = await engine.scan(text, { kind: "automation", url: `file:${file}` });
|
|
117
|
+
if (flag("json")) {
|
|
118
|
+
console.log(JSON.stringify(r, null, 2));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
console.log(r.envelope);
|
|
122
|
+
if (r.tier !== "clean")
|
|
123
|
+
process.exitCode = 1;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
// ingress --audio <file>: gate a recording (what is said, what is too quiet to hear, the file's tags)
|
|
127
|
+
if (flag("audio")) {
|
|
128
|
+
const file = args.find((x) => !x.startsWith("--"));
|
|
129
|
+
if (!file) {
|
|
130
|
+
console.error("usage: ingress --audio <file> [--json] (set INGRESS_AUDIO_TRANSCRIBER; see tools/audio)");
|
|
131
|
+
process.exit(2);
|
|
132
|
+
}
|
|
133
|
+
const engine = new IngressEngine({ ...(opt("policy") ? loadPolicyFile(opt("policy")) : {}), sandbox: "off" });
|
|
134
|
+
const r = await engine.scanAudio(readFileSync(file), { url: `file:${file}`, override: flag("override") });
|
|
135
|
+
if (flag("json"))
|
|
136
|
+
console.log(JSON.stringify(r, null, 2));
|
|
137
|
+
else {
|
|
138
|
+
console.log(r.envelope);
|
|
139
|
+
const c = r.coverage?.audio;
|
|
140
|
+
if (c && !c.transcribed)
|
|
141
|
+
console.error(`\nnote: the recording was not transcribed (${c.reason}). Only the file's tags were checked.`);
|
|
142
|
+
}
|
|
143
|
+
if (r.tier !== "clean")
|
|
144
|
+
process.exitCode = 1;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// ingress --image <file>: gate a picture (text in it, codes, what only a machine would read)
|
|
148
|
+
if (flag("image")) {
|
|
149
|
+
const file = args.find((x) => !x.startsWith("--"));
|
|
150
|
+
if (!file) {
|
|
151
|
+
console.error("usage: ingress --image <file> [--json] [--caption=words shown beside it]");
|
|
152
|
+
process.exit(2);
|
|
153
|
+
}
|
|
154
|
+
const engine = new IngressEngine({ ...(opt("policy") ? loadPolicyFile(opt("policy")) : {}), sandbox: "off" });
|
|
155
|
+
const r = await engine.scanImage(readFileSync(file), { url: `file:${file}`, caption: opt("caption"), override: flag("override") });
|
|
156
|
+
if (flag("json"))
|
|
157
|
+
console.log(JSON.stringify(r, null, 2));
|
|
158
|
+
else {
|
|
159
|
+
console.log(r.envelope);
|
|
160
|
+
const c = r.coverage?.image;
|
|
161
|
+
if (c && !c.pixels)
|
|
162
|
+
console.error(`\nnote: the picture itself was not read (${c.pixelsReason}). Only the file's metadata and structure were checked.`);
|
|
163
|
+
}
|
|
164
|
+
if (r.tier !== "clean")
|
|
165
|
+
process.exitCode = 1;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// ingress stop [reason]: every broker on this machine refuses every agent action until `ingress resume`.
|
|
169
|
+
// Anyone may stop, an agent included. Only a person at a terminal may resume.
|
|
170
|
+
if (args[0] === "stop") {
|
|
171
|
+
const p = engageStop(args.slice(1).join(" "));
|
|
172
|
+
console.log(`stopped: agent actions routed through AcePaste Ingress are refused until you run: ingress resume\n(${p})`);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (args[0] === "resume") {
|
|
176
|
+
const why = stopReason();
|
|
177
|
+
if (!why) {
|
|
178
|
+
console.log("not stopped");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
182
|
+
console.error("refused: resuming needs an interactive terminal, typed by a person");
|
|
183
|
+
process.exit(3);
|
|
184
|
+
}
|
|
185
|
+
console.log(`stopped: ${why}`);
|
|
186
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
187
|
+
const typed = (await rl.question('Type "resume" to let agents act again: ')).trim();
|
|
188
|
+
rl.close();
|
|
189
|
+
if (typed !== "resume") {
|
|
190
|
+
console.log("still stopped");
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
clearStop();
|
|
194
|
+
console.log("resumed");
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
31
197
|
if (args[0] === "audit") {
|
|
32
198
|
// read-only: what on this machine could change what agents receive (hosts, DNS, proxies, browsers, certificates, agent configs)
|
|
33
199
|
const gateEngine = new IngressEngine({ cloakingCheck: false, sandbox: "off" }, { log: () => { } });
|
|
@@ -42,7 +208,46 @@ async function main() {
|
|
|
42
208
|
gate: (t, src) => gateEngine.scan(t, { url: src, contentType: "text/markdown" }),
|
|
43
209
|
remote: remoteBase ? { base: remoteBase, key: process.env.INGRESS_API_KEY, localFetch: (u) => fetchEngine.fetch(u) } : undefined,
|
|
44
210
|
});
|
|
45
|
-
|
|
211
|
+
// ingress audit confirm <area>: a person says the current items of that area are expected
|
|
212
|
+
if (args[1] === "confirm") {
|
|
213
|
+
const area = args[2];
|
|
214
|
+
if (!area || !AUDIT_NEEDS_CONFIRMATION.includes(area)) {
|
|
215
|
+
console.error(`usage: ingress audit confirm <area> areas: ${AUDIT_NEEDS_CONFIRMATION.join(", ")}`);
|
|
216
|
+
process.exit(2);
|
|
217
|
+
}
|
|
218
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
219
|
+
console.error("refused: confirmation needs an interactive terminal, typed by a person");
|
|
220
|
+
process.exit(3);
|
|
221
|
+
}
|
|
222
|
+
const items = r.findings.filter((f) => f.area === area);
|
|
223
|
+
console.log(`\n${area}: ${items.length} item(s) found now\n`);
|
|
224
|
+
for (const f of items)
|
|
225
|
+
console.log(` [${f.severity}] ${f.title}\n ${f.detail}${f.where ? `\n where: ${f.where}` : ""}\n`);
|
|
226
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
227
|
+
const typed = (await rl.question(`Type "${area}" to confirm these are expected: `)).trim();
|
|
228
|
+
rl.close();
|
|
229
|
+
if (typed !== area) {
|
|
230
|
+
console.log("not confirmed");
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
const c = confirmAuditArea(r, area);
|
|
234
|
+
console.log(`confirmed ${c.items} item(s) in ${c.area}. Any addition or removal will ask for your attention again.`);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
// --no-track looks without recording a snapshot (and without comparing)
|
|
238
|
+
let changes;
|
|
239
|
+
if (!flag("no-track")) {
|
|
240
|
+
try {
|
|
241
|
+
changes = trackAudit(r);
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
console.error(`change tracking unavailable: ${e.message}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (flag("json"))
|
|
248
|
+
console.log(JSON.stringify(changes ? { ...r, changes } : r, null, 2));
|
|
249
|
+
else
|
|
250
|
+
console.log(`${changes ? formatAuditChanges(changes) + "\n\n" : ""}${formatAudit(r)}`);
|
|
46
251
|
if (r.summary.high)
|
|
47
252
|
process.exitCode = 1;
|
|
48
253
|
return;
|
|
@@ -99,6 +304,301 @@ async function main() {
|
|
|
99
304
|
console.error(`\n[timings] ${Object.entries(result.timings).map(([k, v]) => `${k}=${v.toFixed(1)}ms`).join(" ")}`);
|
|
100
305
|
}
|
|
101
306
|
main().catch((e) => { console.error(e); process.exit(1); });
|
|
307
|
+
/**
|
|
308
|
+
* ingress hook <event> reply to an agent harness hook: the event's JSON on stdin, the reply on stdout
|
|
309
|
+
* events: pre-tool-use, post-tool-use, user-prompt-submit, pre-compact, post-compact, session-start
|
|
310
|
+
* The engine runs in this process unless INGRESS_HOOK_SERVICE names a running Ingress service
|
|
311
|
+
* (http://127.0.0.1:8787), whose key is read from INGRESS_HOOK_KEY_FILE (default ~/.acepaste-ingress/local-api-key);
|
|
312
|
+
* then the service's receipts and audit trail record what the hooks gated.
|
|
313
|
+
*/
|
|
314
|
+
async function hookCommand(event, stdin) {
|
|
315
|
+
let input;
|
|
316
|
+
try {
|
|
317
|
+
input = JSON.parse(stdin || "{}");
|
|
318
|
+
}
|
|
319
|
+
catch {
|
|
320
|
+
console.error("ingress hook: the event on stdin is not JSON");
|
|
321
|
+
process.exit(1);
|
|
322
|
+
}
|
|
323
|
+
const service = process.env.INGRESS_HOOK_SERVICE;
|
|
324
|
+
let gate;
|
|
325
|
+
let ownPort;
|
|
326
|
+
if (service) {
|
|
327
|
+
const keyFile = process.env.INGRESS_HOOK_KEY_FILE ?? join(homedir(), ".acepaste-ingress", "local-api-key");
|
|
328
|
+
let key = "";
|
|
329
|
+
try {
|
|
330
|
+
key = readFileSync(keyFile, "utf8").trim();
|
|
331
|
+
}
|
|
332
|
+
catch { /* the gate reports it: a missing key fails closed in the handlers */ }
|
|
333
|
+
gate = key ? remoteGate(service, key) : { fetch: async () => { throw new Error(`cannot read the Ingress API key at ${keyFile}`); }, scan: async () => { throw new Error(`cannot read the Ingress API key at ${keyFile}`); } };
|
|
334
|
+
try {
|
|
335
|
+
const u = new URL(service);
|
|
336
|
+
if (u.port)
|
|
337
|
+
ownPort = Number(u.port);
|
|
338
|
+
}
|
|
339
|
+
catch { /* not a URL: nothing is exempt */ }
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
const cfg = { ...(process.env.INGRESS_POLICY ? loadPolicyFile(process.env.INGRESS_POLICY) : {}), ...cloakingConfigFromEnv(process.env, HONEST_USER_AGENT) };
|
|
343
|
+
const sb = process.env.INGRESS_SANDBOX;
|
|
344
|
+
cfg.sandbox = sb === "always" || sb === "escalate" ? sb : "off";
|
|
345
|
+
const pk = process.env.INGRESS_SIGNING_PRIVATE_KEY_FILE ? readFileSync(process.env.INGRESS_SIGNING_PRIVATE_KEY_FILE, "utf8") : process.env.INGRESS_SIGNING_PRIVATE_KEY;
|
|
346
|
+
if (pk)
|
|
347
|
+
cfg.signingPrivateKey = pk;
|
|
348
|
+
const logPath = process.env.INGRESS_LOG;
|
|
349
|
+
const engine = new IngressEngine(cfg, { log: (e) => { if (logPath) {
|
|
350
|
+
try {
|
|
351
|
+
appendFileSync(logPath, JSON.stringify(e) + "\n");
|
|
352
|
+
}
|
|
353
|
+
catch { /* best effort */ }
|
|
354
|
+
} } });
|
|
355
|
+
gate = { fetch: (u) => engine.fetch(u), scan: (c, o) => engine.scan(c, o), scanImage: (b, o) => engine.scanImage(b, o) };
|
|
356
|
+
}
|
|
357
|
+
// pictures are always read in this process: the helper is on this machine, and nothing about an image needs the service
|
|
358
|
+
if (!gate.scanImage) {
|
|
359
|
+
const local = new IngressEngine({ sandbox: "off" }, { log: () => { } });
|
|
360
|
+
gate.scanImage = (b, o) => local.scanImage(b, o);
|
|
361
|
+
}
|
|
362
|
+
const out = (v) => { if (v !== undefined)
|
|
363
|
+
process.stdout.write(JSON.stringify(v) + "\n"); };
|
|
364
|
+
switch (event) {
|
|
365
|
+
// the egress gate needs no engine: it judges the action with what the session has already read.
|
|
366
|
+
// INGRESS_EGRESS_ALLOW_HOSTS: comma-separated hosts data may go to without a question (".example.com" covers subdomains)
|
|
367
|
+
case "pre-tool-use": return out(preToolUse(input, { ownPort, allowHosts: (process.env.INGRESS_EGRESS_ALLOW_HOSTS ?? "").split(",").map((s) => s.trim()).filter(Boolean) }));
|
|
368
|
+
case "post-tool-use": return out(await postToolUse(input, gate, { ownPort }));
|
|
369
|
+
case "user-prompt-submit": return out(await userPromptSubmit(input, gate));
|
|
370
|
+
case "pre-compact":
|
|
371
|
+
process.stdout.write(preCompact() + "\n");
|
|
372
|
+
return;
|
|
373
|
+
case "post-compact":
|
|
374
|
+
await postCompact(input, gate);
|
|
375
|
+
return;
|
|
376
|
+
case "session-start": return out(sessionStart(input, { marker: process.env.INGRESS_SESSION_MARKER !== "0" }));
|
|
377
|
+
default:
|
|
378
|
+
console.error("usage: ingress hook pre-tool-use|post-tool-use|user-prompt-submit|pre-compact|post-compact|session-start (event JSON on stdin)");
|
|
379
|
+
process.exit(2);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* ingress vision is the helper that reads pictures built, and does it match its recorded hash?
|
|
384
|
+
* ingress vision build compile it on this machine (macOS with Xcode or its command line tools)
|
|
385
|
+
* ingress vision selftest build its test pictures and check that each hidden-text trick is caught
|
|
386
|
+
*/
|
|
387
|
+
async function visionCommand(a) {
|
|
388
|
+
if (a[0] === "build") {
|
|
389
|
+
try {
|
|
390
|
+
const b = await buildVisionHelper();
|
|
391
|
+
console.log(`built ${b.path}\nsha256 ${b.sha256}`);
|
|
392
|
+
}
|
|
393
|
+
catch (e) {
|
|
394
|
+
console.error(`not built: ${e.message}`);
|
|
395
|
+
process.exit(1);
|
|
396
|
+
}
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const problem = visionHelperProblem();
|
|
400
|
+
if (a[0] === "selftest") {
|
|
401
|
+
if (problem) {
|
|
402
|
+
console.error(problem);
|
|
403
|
+
process.exit(1);
|
|
404
|
+
}
|
|
405
|
+
const dir = mkdtempSync(join(tmpdir(), "ingress-vision-selftest-"));
|
|
406
|
+
try {
|
|
407
|
+
execFileSync(visionHelperPath(), ["--make-fixtures", dir], { timeout: 120_000 });
|
|
408
|
+
const engine = new IngressEngine({ sandbox: "off" }, { log: () => { } });
|
|
409
|
+
const expect = {
|
|
410
|
+
"plain.png": { refused: false }, "no-text.png": { refused: false }, "qr-link.png": { refused: false },
|
|
411
|
+
"faint-text.png": { refused: true, kind: "image.low_contrast_text" }, "resize-attack.png": { refused: true, kind: "image.text_only_when_resized" },
|
|
412
|
+
"under-alpha.png": { refused: true, kind: "image.transparency_text" }, "second-frame.gif": { refused: true, kind: "image.later_frame_text" },
|
|
413
|
+
"qr-wifi.png": { refused: true, kind: "image.code_action" }, "qr-text.png": { refused: true, kind: "image.code_payload" },
|
|
414
|
+
};
|
|
415
|
+
let bad = 0;
|
|
416
|
+
for (const [name, want] of Object.entries(expect)) {
|
|
417
|
+
const r = await engine.scanImage(readFileSync(join(dir, name)), { url: `selftest:${name}` });
|
|
418
|
+
const ok = (r.tier !== "clean") === want.refused && (!want.kind || r.findings.some((f) => f.kind === want.kind));
|
|
419
|
+
if (!ok)
|
|
420
|
+
bad++;
|
|
421
|
+
console.log(`${ok ? "ok " : "FAIL"} ${name.padEnd(20)} ${r.tier}${want.kind ? ` (${want.kind})` : ""}`);
|
|
422
|
+
}
|
|
423
|
+
if (bad) {
|
|
424
|
+
console.error(`${bad} of ${Object.keys(expect).length} checks failed on this machine`);
|
|
425
|
+
process.exitCode = 1;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
finally {
|
|
429
|
+
try {
|
|
430
|
+
rmSync(dir, { recursive: true, force: true });
|
|
431
|
+
}
|
|
432
|
+
catch { /* temp folder */ }
|
|
433
|
+
}
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
console.log(problem ? `not ready: ${problem}` : `ready: ${visionHelperPath()}`);
|
|
437
|
+
if (problem)
|
|
438
|
+
process.exitCode = 1;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* ingress provenance files agents wrote after reading outside content, newest first
|
|
442
|
+
* ingress provenance <path> where one file came from: an agent's mark, or a download
|
|
443
|
+
* ingress provenance clear <path> you have looked at the file: remove its mark (interactive terminal only)
|
|
444
|
+
*/
|
|
445
|
+
async function provenanceCommand(a) {
|
|
446
|
+
const ledger = new ProvenanceLedger();
|
|
447
|
+
if (a[0] === "clear") {
|
|
448
|
+
if (!a[1]) {
|
|
449
|
+
console.error("usage: ingress provenance clear <path>");
|
|
450
|
+
process.exit(2);
|
|
451
|
+
}
|
|
452
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
453
|
+
console.error("refused: clearing a mark needs an interactive terminal, typed by a person");
|
|
454
|
+
process.exit(3);
|
|
455
|
+
}
|
|
456
|
+
const found = ledger.lookup(a[1]);
|
|
457
|
+
if (!found) {
|
|
458
|
+
console.log("no mark on that file");
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
console.log(describeMark(found.mark, found.unchanged));
|
|
462
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
463
|
+
const typed = (await rl.question('Type "clear" if you have read the file and it is what you expect: ')).trim();
|
|
464
|
+
rl.close();
|
|
465
|
+
if (typed !== "clear") {
|
|
466
|
+
console.log("mark kept");
|
|
467
|
+
process.exit(1);
|
|
468
|
+
}
|
|
469
|
+
ledger.clear(a[1]);
|
|
470
|
+
console.log("mark removed");
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (a[0]) {
|
|
474
|
+
const found = ledger.lookup(a[0]);
|
|
475
|
+
const origin = downloadOrigin(a[0]);
|
|
476
|
+
if (found)
|
|
477
|
+
console.log(describeMark(found.mark, found.unchanged));
|
|
478
|
+
if (origin)
|
|
479
|
+
console.log(`downloaded${origin.agent ? ` by ${origin.agent}` : ""}${origin.from ? ` from ${origin.from}` : ""}`);
|
|
480
|
+
if (!found && !origin)
|
|
481
|
+
console.log("no mark: not written by an agent after reading outside content, and not recorded as a download");
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const marks = ledger.list();
|
|
485
|
+
if (!marks.length) {
|
|
486
|
+
console.log("no marked files");
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
for (const m of marks.slice(0, 200))
|
|
490
|
+
console.log(`${m.at.slice(0, 16).replace("T", " ")} ${m.path}`);
|
|
491
|
+
if (marks.length > 200)
|
|
492
|
+
console.log(`... and ${marks.length - 200} more`);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* ingress blocklist the lists in use and how many entries each has
|
|
496
|
+
* ingress blocklist update download the free lists of botnet and attack infrastructure (Feodo Tracker, Spamhaus DROP, Emerging Threats)
|
|
497
|
+
* ingress blocklist check <host> is this host or address on a list?
|
|
498
|
+
* Lists are plain text files in <state>/blocklists; add your own there, one host, address or IPv4 range per line.
|
|
499
|
+
* The broker and the egress hook refuse any action whose arguments name a listed destination.
|
|
500
|
+
*/
|
|
501
|
+
async function blocklistCommand(a) {
|
|
502
|
+
const dir = join(stateDir(), "blocklists");
|
|
503
|
+
if (a[0] === "update") {
|
|
504
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
505
|
+
let failed = 0;
|
|
506
|
+
for (const f of BLOCKLIST_FEEDS) {
|
|
507
|
+
try {
|
|
508
|
+
const res = await fetch(f.url, { signal: AbortSignal.timeout(30_000), redirect: "follow", headers: { "user-agent": HONEST_USER_AGENT } });
|
|
509
|
+
if (!res.ok)
|
|
510
|
+
throw new Error(`HTTP ${res.status}`);
|
|
511
|
+
const text = await res.text();
|
|
512
|
+
if (text.length > 50_000_000)
|
|
513
|
+
throw new Error("larger than 50 MB");
|
|
514
|
+
// a list is kept only if it parses as one: a block page or an error page saved as a list would silently protect nothing
|
|
515
|
+
const n = new Blocklist().add(text, f.name);
|
|
516
|
+
if (n < 5)
|
|
517
|
+
throw new Error(`only ${n} entries parsed; keeping the previous copy`);
|
|
518
|
+
const p = join(dir, `${f.name}.txt`);
|
|
519
|
+
writeFileSync(`${p}.tmp`, `# ${f.what}\n# from ${f.url} on ${new Date().toISOString()} (${f.terms})\n${text}`, { mode: 0o600 });
|
|
520
|
+
renameSync(`${p}.tmp`, p);
|
|
521
|
+
console.log(`${f.name}: ${n} entries (${f.what})`);
|
|
522
|
+
}
|
|
523
|
+
catch (e) {
|
|
524
|
+
failed++;
|
|
525
|
+
console.error(`${f.name}: not updated (${e.message ?? e})`);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (failed)
|
|
529
|
+
process.exitCode = 1;
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
const b = Blocklist.load(dir);
|
|
533
|
+
if (a[0] === "check") {
|
|
534
|
+
if (!a[1]) {
|
|
535
|
+
console.error("usage: ingress blocklist check <host or address>");
|
|
536
|
+
process.exit(2);
|
|
537
|
+
}
|
|
538
|
+
const hit = b.match(a[1]);
|
|
539
|
+
console.log(hit ? `listed (${hit})` : "not listed");
|
|
540
|
+
if (hit)
|
|
541
|
+
process.exitCode = 1;
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
if (!b.size) {
|
|
545
|
+
console.log(`no blocklists in ${dir}\nrun: ingress blocklist update`);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
console.log(`${b.size} entries in ${dir}\n${b.sources.map((s) => ` ${s}`).join("\n")}`);
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* ingress tools downstream MCP servers whose tools were recorded, and their state
|
|
552
|
+
* ingress tools confirm <server> confirm the tools that server offered when the proxy last started (interactive terminal only)
|
|
553
|
+
*/
|
|
554
|
+
async function toolsCommand(a) {
|
|
555
|
+
if (a[0] === "confirm") {
|
|
556
|
+
const server = a[1];
|
|
557
|
+
if (!server) {
|
|
558
|
+
console.error("usage: ingress tools confirm <server>");
|
|
559
|
+
process.exit(2);
|
|
560
|
+
}
|
|
561
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
562
|
+
console.error("refused: confirmation needs an interactive terminal, typed by a person");
|
|
563
|
+
process.exit(3);
|
|
564
|
+
}
|
|
565
|
+
const d = describeServerTools(server);
|
|
566
|
+
if (!d) {
|
|
567
|
+
console.error(`no reviewed tools for "${server}": start the Ingress proxy with that server once, then confirm`);
|
|
568
|
+
process.exit(2);
|
|
569
|
+
}
|
|
570
|
+
console.log(`\n${server}: ${d.pending.length} tool(s) offered when the proxy last started`);
|
|
571
|
+
if (d.state.state === "changed") {
|
|
572
|
+
console.log(`changed since ${d.state.since}:`);
|
|
573
|
+
for (const x of d.state.added)
|
|
574
|
+
console.log(` + ${x.label} (new, or its definition changed)`);
|
|
575
|
+
for (const x of d.state.removed)
|
|
576
|
+
console.log(` - ${x.replace(/ @ [0-9a-f]{16}$/, "")} (previous definition)`);
|
|
577
|
+
}
|
|
578
|
+
else
|
|
579
|
+
console.log(`state: ${d.state.state}`);
|
|
580
|
+
console.log("Read the server's current tool descriptions before confirming; Ingress checked them for hidden instructions, not for what they do.");
|
|
581
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
582
|
+
const typed = (await rl.question(`Type "${server}" to confirm this set of tools: `)).trim();
|
|
583
|
+
rl.close();
|
|
584
|
+
if (typed !== server) {
|
|
585
|
+
console.log("not confirmed");
|
|
586
|
+
process.exit(1);
|
|
587
|
+
}
|
|
588
|
+
const c = confirmServerTools(server);
|
|
589
|
+
console.log(`confirmed ${c.tools} tool(s) of ${c.server} at ${c.at}. Restart the proxy; a later change will be held again.`);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
const groups = new BaselineStore().groups().filter((g) => g.startsWith("mcp-tools:")).map((g) => g.slice("mcp-tools:".length));
|
|
593
|
+
if (!groups.length) {
|
|
594
|
+
console.log("no downstream servers recorded yet");
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
for (const s of groups) {
|
|
598
|
+
const d = describeServerTools(s);
|
|
599
|
+
console.log(`${(d?.state.state ?? "unknown").padEnd(10)} ${s}${d ? ` (${d.pending.length} tools)` : ""}`);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
102
602
|
/**
|
|
103
603
|
* ingress instructions [dir] list instruction files and their approval status
|
|
104
604
|
* ingress instructions approve <dir> <relPath> approve one file's exact bytes (interactive terminal only)
|
package/dist/src/codepass.d.ts
CHANGED
|
@@ -39,6 +39,14 @@ export declare function lex(src: string, lang: CodeLang): {
|
|
|
39
39
|
strings: string[];
|
|
40
40
|
comments: string;
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* The standard way to call an API: a well-known token, presented only as an Authorization header (or defined
|
|
44
|
+
* as a CI env entry), sent only to that token's own service. GitHub's REST docs show exactly this, and the
|
|
45
|
+
* first version refused docs.github.com as hostile for it (2026-11-18). Anything else still counts: key files,
|
|
46
|
+
* generic *_SECRET / *_TOKEN names, any other host, or the token in a request body (a token posted into a gist
|
|
47
|
+
* is a leak even though the host is github.com).
|
|
48
|
+
*/
|
|
49
|
+
export declare function usesTokenWithItsOwnService(src: string): boolean;
|
|
42
50
|
/** code units in what the model will receive: fenced blocks, <pre>/<code> text, whole files, decoded payloads */
|
|
43
51
|
export declare function extractCodeUnits(input: {
|
|
44
52
|
kind: string;
|
package/dist/src/codepass.js
CHANGED
|
@@ -164,10 +164,48 @@ function behaviors(lang, src) {
|
|
|
164
164
|
}
|
|
165
165
|
// any language: a secret read and a network send in the same unit
|
|
166
166
|
const readsSecret = SECRET_PATHS.test(src) || SECRET_ENV.test(code) || SECRET_ENV.test(src);
|
|
167
|
-
if (readsSecret && NETWORK_OUT[lang].test(code))
|
|
167
|
+
if (readsSecret && NETWORK_OUT[lang].test(code) && !usesTokenWithItsOwnService(src))
|
|
168
168
|
add("code.secret_exfiltration", "reads credentials (key files, cloud or API tokens) and sends data over the network", 1);
|
|
169
169
|
return hits;
|
|
170
170
|
}
|
|
171
|
+
/** where each well-known token is meant to go: presenting it there is using it, not leaking it */
|
|
172
|
+
const TOKEN_HOME = [
|
|
173
|
+
[/\b(GITHUB_TOKEN|GH_TOKEN)\b/, /(^|\.)(github\.com|githubusercontent\.com)$/],
|
|
174
|
+
[/\bNPM_TOKEN\b/, /(^|\.)npmjs\.(org|com)$/],
|
|
175
|
+
[/\bOPENAI_API_KEY\b/, /(^|\.)openai\.com$/],
|
|
176
|
+
[/\bANTHROPIC_API_KEY\b/, /(^|\.)anthropic\.com$/],
|
|
177
|
+
[/\bSLACK_TOKEN\b/, /(^|\.)slack\.com$/],
|
|
178
|
+
[/\bSTRIPE_SECRET_KEY\b/, /(^|\.)stripe\.com$/],
|
|
179
|
+
];
|
|
180
|
+
/**
|
|
181
|
+
* The standard way to call an API: a well-known token, presented only as an Authorization header (or defined
|
|
182
|
+
* as a CI env entry), sent only to that token's own service. GitHub's REST docs show exactly this, and the
|
|
183
|
+
* first version refused docs.github.com as hostile for it (2026-11-18). Anything else still counts: key files,
|
|
184
|
+
* generic *_SECRET / *_TOKEN names, any other host, or the token in a request body (a token posted into a gist
|
|
185
|
+
* is a leak even though the host is github.com).
|
|
186
|
+
*/
|
|
187
|
+
export function usesTokenWithItsOwnService(src) {
|
|
188
|
+
if (SECRET_PATHS.test(src))
|
|
189
|
+
return false;
|
|
190
|
+
const refs = [...src.matchAll(new RegExp(SECRET_ENV.source, "g"))];
|
|
191
|
+
if (!refs.length)
|
|
192
|
+
return false;
|
|
193
|
+
const homes = [];
|
|
194
|
+
for (const r of refs) {
|
|
195
|
+
const home = TOKEN_HOME.find(([name]) => name.test(r[0]))?.[1];
|
|
196
|
+
if (!home)
|
|
197
|
+
return false;
|
|
198
|
+
homes.push(home);
|
|
199
|
+
const before = src.slice(Math.max(0, r.index - 48), r.index);
|
|
200
|
+
const after = src.slice(r.index + r[0].length, r.index + r[0].length + 4);
|
|
201
|
+
const inAuthHeader = /(authorization\s*:\s*(bearer|token|basic)?|\bbearer|\btoken)\s*["']?$/i.test(before);
|
|
202
|
+
const isEnvEntry = /(^|\n)\s*(-\s*)?(env\s*:\s*)?$/i.test(before) && /^\s*[:=]/.test(after);
|
|
203
|
+
if (!inAuthHeader && !isEnvEntry)
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
const hosts = [...src.matchAll(/\bhttps?:\/\/([a-z0-9.-]+)/gi)].map((m) => m[1].toLowerCase());
|
|
207
|
+
return hosts.length > 0 && hosts.every((h) => homes.some((home) => home.test(h)));
|
|
208
|
+
}
|
|
171
209
|
/** code units in what the model will receive: fenced blocks, <pre>/<code> text, whole files, decoded payloads */
|
|
172
210
|
export function extractCodeUnits(input) {
|
|
173
211
|
const units = [];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Egress: what an agent sends out, judged with what it has read.
|
|
3
|
+
*
|
|
4
|
+
* A firewall sees a connection. The broker sees the action and remembers the content the run took in, so it
|
|
5
|
+
* can say why an action is happening: "this address came from the email you read two minutes ago". These are
|
|
6
|
+
* the checks on the way out. Each returns reasons in plain words; the broker turns them into a decision.
|
|
7
|
+
*
|
|
8
|
+
* one-time codes A verification code the run read (in a message, a notification, a page) is for the person.
|
|
9
|
+
* An action that carries it to a destination that came from outside content is refused;
|
|
10
|
+
* anywhere else, a person is asked and told what the action carries.
|
|
11
|
+
* credentials A recognisable credential in outbound arguments, once the run has read outside content.
|
|
12
|
+
* provenance A destination that first appeared in content the run read, not in anything the person
|
|
13
|
+
* said. Not a refusal on its own (following a link is normal); it is named in the approval
|
|
14
|
+
* request and makes data-bearing requests to it need a person.
|
|
15
|
+
* known-bad A destination on a local blocklist (malware and botnet controllers) is refused.
|
|
16
|
+
* calling home Many requests in a short time to a host the run met in outside content.
|
|
17
|
+
* peripherals Printing, copying to a removable drive, AirDrop, Bluetooth transfer: ways out of the
|
|
18
|
+
* machine that never touch the network.
|
|
19
|
+
* local tunnels A loopback port owned by a tunnel or proxy program is the internet, not this machine.
|
|
20
|
+
*
|
|
21
|
+
* Scope, stated plainly: detect, refuse, record. Nothing here contacts, probes or acts against a destination.
|
|
22
|
+
*/
|
|
23
|
+
/** Verification codes stated in a text ("Your code is 482913"). Digits only, 4 to 8 of them, or a 6-10 character code right after the words. */
|
|
24
|
+
export declare function oneTimeCodes(text: string): string[];
|
|
25
|
+
/** Does any outbound string carry one of these codes, written plainly or with separators? */
|
|
26
|
+
export declare function carriesCode(strings: readonly string[], codes: readonly string[]): string | undefined;
|
|
27
|
+
/** Kinds of credential found in outbound strings (never the values). */
|
|
28
|
+
export declare function credentialsLeaving(strings: readonly string[]): number;
|
|
29
|
+
/** Hosts a text names: in links, as bare domains with common endings, and after @ in addresses. */
|
|
30
|
+
export declare function hostsMentioned(text: string, limit?: number): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Known-bad destinations, from plain-text lists a person or `ingress blocklist update` put in
|
|
33
|
+
* <state>/blocklists/*.txt: one host, IP address, IPv4 CIDR or URL per line; `#` and `;` start comments; a
|
|
34
|
+
* hosts-file line ("0.0.0.0 bad.example") is read for its name. Nothing is fetched here.
|
|
35
|
+
*/
|
|
36
|
+
export declare class Blocklist {
|
|
37
|
+
private hosts;
|
|
38
|
+
private ips;
|
|
39
|
+
private cidrs;
|
|
40
|
+
readonly sources: string[];
|
|
41
|
+
static load(dir?: string): Blocklist;
|
|
42
|
+
add(text: string, source?: string): number;
|
|
43
|
+
get size(): number;
|
|
44
|
+
/** The entry that matches this host or address, or undefined. A listed name covers its subdomains. */
|
|
45
|
+
match(host: string): string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/** Free lists `ingress blocklist update` can download. The CLI fetches them; this module only names them. */
|
|
48
|
+
export declare const BLOCKLIST_FEEDS: ReadonlyArray<{
|
|
49
|
+
name: string;
|
|
50
|
+
url: string;
|
|
51
|
+
what: string;
|
|
52
|
+
terms: string;
|
|
53
|
+
}>;
|
|
54
|
+
export interface PeripheralEgress {
|
|
55
|
+
way: "print" | "removable-drive" | "airdrop" | "bluetooth" | "burn";
|
|
56
|
+
why: string;
|
|
57
|
+
}
|
|
58
|
+
/** Does this action move data off the machine without the network? */
|
|
59
|
+
export declare function peripheralEgress(tool: string, strings: readonly string[]): PeripheralEgress[];
|
|
60
|
+
/** Loopback ports named in the arguments ("localhost:8080", "http://127.0.0.1:1080/x", "nc 127.0.0.1 9050"). */
|
|
61
|
+
export declare function loopbackPorts(strings: readonly string[]): number[];
|
|
62
|
+
/** True when the program that owns a local port forwards traffic elsewhere. */
|
|
63
|
+
export declare function isForwarder(program: string | undefined): boolean;
|
|
64
|
+
/** Requests per host within a window, for hosts the run met in outside content. */
|
|
65
|
+
export declare class HomeCalls {
|
|
66
|
+
private at;
|
|
67
|
+
record(host: string, now: number): void;
|
|
68
|
+
count(host: string, now: number): number;
|
|
69
|
+
export(): Record<string, number[]>;
|
|
70
|
+
import(d: Record<string, number[]> | undefined): void;
|
|
71
|
+
}
|