replicas-engine 0.1.933 → 0.1.935

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.
@@ -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-RAZD4N5G.js";
6
+ } from "./chunk-JIWNLGNP.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-RVSMHQVH.js";
12
+ } from "./chunk-7AHZJSWR.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  relaySubagentResponseSchema,
12
12
  spawnRelaySubagentRequestSchema,
13
13
  waitRelaySubagentRequestSchema
14
- } from "./chunk-RVSMHQVH.js";
14
+ } from "./chunk-7AHZJSWR.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/relay-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.933",
3
+ "version": "0.1.935",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -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
- };