replicas-engine 0.1.888 → 0.1.891
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/src/{asp-host-BGOXGPHG.js → asp-host-RKLHLTPR.js} +4 -4
- package/dist/src/{chunk-P7AHODJ6.js → chunk-4NFLZXZX.js} +2 -2
- package/dist/src/{chunk-N2DC3SCQ.js → chunk-DG4VIQXA.js} +1 -1
- package/dist/src/{chunk-ADX5FHF6.js → chunk-EDLDRUYW.js} +2 -2
- package/dist/src/{chunk-4DGHCMBQ.js → chunk-IB2SHITZ.js} +9 -4
- package/dist/src/{chunk-5RULOJKJ.js → chunk-OBAGPETY.js} +236 -123
- package/dist/src/{chunk-2JFHMLKJ.js → chunk-TDLEF5FU.js} +10 -5
- package/dist/src/chunk-U2T2QCYP.js +54 -0
- package/dist/src/command-protection-hook.js +3 -3
- package/dist/src/deepseek-command-protection-plugin.js +5 -4
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +605 -392
- package/dist/src/post-tool-pr-hook.js +4 -3
- package/dist/src/relay-mcp.js +1 -1
- package/package.json +1 -1
- package/scripts/opencode-command-protection-plugin.ts +10 -9
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
3
|
+
const require = __createRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
extractCommandProtectionCommandText,
|
|
6
|
+
isRecord,
|
|
7
|
+
parseCodeHostPrUrl
|
|
8
|
+
} from "./chunk-OBAGPETY.js";
|
|
9
|
+
|
|
10
|
+
// src/services/published-pull-request-urls.ts
|
|
11
|
+
function publishedPullRequestUrls(result) {
|
|
12
|
+
if (!result.success) return [];
|
|
13
|
+
const name = result.toolName.toLowerCase();
|
|
14
|
+
const publicationTool = /(?:^|[_-])(?:create[_-]?(?:pr|pull[_-]?request|mr|merge[_-]?request)|(?:pr|pull[_-]?request|mr|merge[_-]?request)[_-]?create)$/.test(name);
|
|
15
|
+
const command = extractCommandProtectionCommandText({ toolInput: result.toolInput }) ?? "";
|
|
16
|
+
const shell = command.replace(/\\\r?\n/g, " ").replace(/'[^']*'|"(?:\\.|[^"\\])*"|`[^`]*`|#[^\n]*/g, "ARG");
|
|
17
|
+
const commands = shell.split(/&&|[;\n]/).map((part) => part.trim()).filter(Boolean);
|
|
18
|
+
const isPublicationCommand = (part) => {
|
|
19
|
+
if (/^(?:[\w]+=[^\s;&|]+\s+)*(?:\S*\/)?(?:gh(?:\s+(?:-R|--repo)\s+\S+)?\s+pr\s+create|glab(?:\s+(?:-R|--repo)\s+\S+)?\s+mr\s+create|git(?:\s+-C\s+\S+)?\s+push)\b/.test(part)) return true;
|
|
20
|
+
return /^(?:gh\s+api|glab\s+api|curl)\s/.test(part) && /(?:^|\s)(?:-X\s*|--(?:method|request)[=\s]+)POST\b/i.test(part) && /\/(?:pulls|merge_requests)(?:\s|$)/.test(part);
|
|
21
|
+
};
|
|
22
|
+
const publicationCommand = !shell.includes("<<") && !/[|&(){}\\]/.test(commands.join(" ")) && commands.some(isPublicationCommand) && commands.every((part) => isPublicationCommand(part) || /^(?:cd|rm)\s/.test(part) || /^git(?:\s+-C\s+\S+)?\s+worktree\s+(?:add|remove)\b/.test(part));
|
|
23
|
+
if (!publicationTool && !publicationCommand) return [];
|
|
24
|
+
const urls = /* @__PURE__ */ new Set();
|
|
25
|
+
const visit = (value, depth = 0) => {
|
|
26
|
+
if (depth > 8) return;
|
|
27
|
+
if (typeof value === "string") {
|
|
28
|
+
const text = value.trim();
|
|
29
|
+
try {
|
|
30
|
+
const parsed = JSON.parse(text);
|
|
31
|
+
if (parsed !== value) visit(parsed, depth + 1);
|
|
32
|
+
return;
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
for (const line of text.split("\n")) {
|
|
36
|
+
const candidate = line.trim().replace(/^remote:\s*/, "");
|
|
37
|
+
if (!/^https?:\/\/[^\s<>"']+\/(?:pull|merge_requests)\/\d+\/?(?:[?#][^\s<>"']*)?$/.test(candidate)) continue;
|
|
38
|
+
if (parseCodeHostPrUrl(candidate)) urls.add(candidate);
|
|
39
|
+
}
|
|
40
|
+
} else if (Array.isArray(value)) {
|
|
41
|
+
for (const item of value) visit(item, depth + 1);
|
|
42
|
+
} else if (isRecord(value) && value.isError !== true) {
|
|
43
|
+
for (const key of ["url", "html_url", "web_url", "content", "structuredContent", "text", "output", "result", "stdout", "stderr"]) {
|
|
44
|
+
if (key in value) visit(value[key], depth + 1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
visit(result.output);
|
|
49
|
+
return [...urls];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
publishedPullRequestUrls
|
|
54
|
+
};
|
|
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-4NFLZXZX.js";
|
|
7
|
+
import "./chunk-DG4VIQXA.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-OBAGPETY.js";
|
|
12
12
|
import "./chunk-VEQXQN22.js";
|
|
13
13
|
|
|
14
14
|
// src/command-protection-hook.ts
|
|
@@ -3,13 +3,14 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4NFLZXZX.js";
|
|
7
7
|
import {
|
|
8
8
|
notifyPostToolUse
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-IB2SHITZ.js";
|
|
10
|
+
import "./chunk-U2T2QCYP.js";
|
|
11
|
+
import "./chunk-DG4VIQXA.js";
|
|
11
12
|
import "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-OBAGPETY.js";
|
|
13
14
|
import "./chunk-VEQXQN22.js";
|
|
14
15
|
|
|
15
16
|
// src/deepseek-command-protection-plugin.ts
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
AppServerProcess,
|
|
10
10
|
buildCodexAgentEnv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EDLDRUYW.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
getMemoryOutputSafetyViolation,
|
|
15
15
|
headlessAgentRequestSchema
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-OBAGPETY.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
|
|
19
19
|
// src/headless-agent.ts
|