replicas-engine 0.1.933 → 0.1.934
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-V5JMSPLS.js → asp-host-3MLXO4VA.js} +5 -4
- package/dist/src/{chunk-RVSMHQVH.js → chunk-3LWSEH3N.js} +676 -192
- package/dist/src/{chunk-3GJEQKPY.js → chunk-CXSJSSFY.js} +1 -1
- package/dist/src/chunk-E4MPACC3.js +19 -0
- package/dist/src/{chunk-5PTJWSW3.js → chunk-ET2HBN72.js} +8 -6
- package/dist/src/{chunk-BXHF65NV.js → chunk-F3EHVMWY.js} +5 -13
- package/dist/src/{chunk-RAZD4N5G.js → chunk-KQOMWVOJ.js} +1 -1
- package/dist/src/chunk-T3YADB2L.js +191 -0
- package/dist/src/command-protection-hook.js +5 -4
- package/dist/src/headless-agent.js +3 -2
- package/dist/src/index.js +341 -411
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/relay-mcp.js +1 -1
- package/package.json +1 -1
- package/dist/src/chunk-SY46VC2H.js +0 -75
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
publishedPullRequestUrls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KQOMWVOJ.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldRefreshPullRequests
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3LWSEH3N.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/relay-mcp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from 'node:module';
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
import {
|
|
5
|
-
monolithRequest
|
|
6
|
-
} from "./chunk-3GJEQKPY.js";
|
|
7
|
-
import {
|
|
8
|
-
extractCommandProtectionCommandText,
|
|
9
|
-
findGitCommitSignals,
|
|
10
|
-
findPrMergeSignals
|
|
11
|
-
} from "./chunk-RVSMHQVH.js";
|
|
12
|
-
|
|
13
|
-
// src/services/command-protection-service.ts
|
|
14
|
-
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
|
|
15
|
-
function asCommandProtectionResponse(value) {
|
|
16
|
-
if (typeof value !== "object" || value === null) return null;
|
|
17
|
-
const candidate = value;
|
|
18
|
-
return typeof candidate.allowed === "boolean" && typeof candidate.enabled === "boolean" ? candidate : null;
|
|
19
|
-
}
|
|
20
|
-
function failClosed(reason, matchedSignals) {
|
|
21
|
-
return {
|
|
22
|
-
allowed: false,
|
|
23
|
-
enabled: true,
|
|
24
|
-
reason,
|
|
25
|
-
matchedSignals
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
async function evaluateCommandProtection(request, signal) {
|
|
29
|
-
const matchedSignals = [...findGitCommitSignals(request), ...findPrMergeSignals(request)];
|
|
30
|
-
if (matchedSignals.length === 0) {
|
|
31
|
-
return { allowed: true, enabled: true };
|
|
32
|
-
}
|
|
33
|
-
let response;
|
|
34
|
-
try {
|
|
35
|
-
response = await monolithRequest("/v1/engine/command-protection/evaluate", {
|
|
36
|
-
body: request,
|
|
37
|
-
signal
|
|
38
|
-
});
|
|
39
|
-
} catch (error) {
|
|
40
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
41
|
-
return failClosed(`Command protection failed closed: ${detail}`, matchedSignals);
|
|
42
|
-
}
|
|
43
|
-
if (!response.ok) {
|
|
44
|
-
const detail = await response.text().catch(() => "");
|
|
45
|
-
return failClosed(`Command protection failed closed: ${response.status} ${detail}`, matchedSignals);
|
|
46
|
-
}
|
|
47
|
-
let payload;
|
|
48
|
-
try {
|
|
49
|
-
payload = await response.json();
|
|
50
|
-
} catch (error) {
|
|
51
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
52
|
-
return failClosed(`Command protection failed closed: ${detail}`, matchedSignals);
|
|
53
|
-
}
|
|
54
|
-
return asCommandProtectionResponse(payload) ?? failClosed("Command protection failed closed: invalid response from policy service", matchedSignals);
|
|
55
|
-
}
|
|
56
|
-
function extractToolCommand(input) {
|
|
57
|
-
return extractCommandProtectionCommandText({ toolInput: input }, { stringifyFallback: false });
|
|
58
|
-
}
|
|
59
|
-
function reportCommandProtectionBlock(options) {
|
|
60
|
-
const message = options.result.reason || DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE;
|
|
61
|
-
console.warn(`[${options.managerName}] blocked ${options.action} by command protection: ${message}`);
|
|
62
|
-
options.recordHistoryEvent(options.eventType, {
|
|
63
|
-
type: "error",
|
|
64
|
-
message,
|
|
65
|
-
...options.context,
|
|
66
|
-
command: options.command
|
|
67
|
-
}, options.historyFile);
|
|
68
|
-
return message;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export {
|
|
72
|
-
evaluateCommandProtection,
|
|
73
|
-
extractToolCommand,
|
|
74
|
-
reportCommandProtectionBlock
|
|
75
|
-
};
|