@wrongstack/core 0.313.0 → 0.313.1
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/chronicle/index.js +84 -6391
- package/dist/chronicle/project-server.js +84 -4868
- package/dist/chunk-2BUUIMQB.js +225 -0
- package/dist/chunk-2FK4WTFF.js +207 -0
- package/dist/chunk-2FQL4PDC.js +292 -0
- package/dist/chunk-2KKODIQU.js +2256 -0
- package/dist/chunk-2YU4WVBW.js +134 -0
- package/dist/chunk-3E244UDA.js +356 -0
- package/dist/chunk-3XPVB7BA.js +135 -0
- package/dist/chunk-4LJJYBAU.js +388 -0
- package/dist/chunk-4VWO3ZXL.js +342 -0
- package/dist/chunk-4XV6IR37.js +187 -0
- package/dist/chunk-4ZHTKJHM.js +183 -0
- package/dist/chunk-52RTVH4M.js +361 -0
- package/dist/chunk-57GEWK5X.js +26 -0
- package/dist/chunk-5DSMEVA4.js +931 -0
- package/dist/chunk-5RP3QTRL.js +1223 -0
- package/dist/chunk-5S437PRC.js +50 -0
- package/dist/chunk-5XDUGTKN.js +511 -0
- package/dist/chunk-62V2AFVG.js +422 -0
- package/dist/chunk-65RDIOR2.js +2470 -0
- package/dist/chunk-6AKOTGLM.js +597 -0
- package/dist/chunk-7ZHZE5EO.js +28 -0
- package/dist/chunk-A455ATZB.js +140 -0
- package/dist/chunk-AD7ZFZCS.js +46 -0
- package/dist/chunk-AI4LLQ2U.js +856 -0
- package/dist/chunk-ASX6AW36.js +789 -0
- package/dist/chunk-AT4V4XGI.js +3522 -0
- package/dist/chunk-AWNQ6ED6.js +311 -0
- package/dist/chunk-B4AMLZPB.js +9 -0
- package/dist/chunk-BAKVJLEV.js +417 -0
- package/dist/chunk-BJHVULHO.js +55 -0
- package/dist/chunk-CB2HFKTP.js +9 -0
- package/dist/chunk-CE4ZOCOI.js +1640 -0
- package/dist/chunk-CQQL4ZOQ.js +151 -0
- package/dist/chunk-DEIQMBD2.js +65 -0
- package/dist/chunk-E6I5RXVK.js +58 -0
- package/dist/chunk-EFEHDQGY.js +1589 -0
- package/dist/chunk-EODDVJBM.js +82 -0
- package/dist/chunk-EPC3GZD4.js +308 -0
- package/dist/chunk-FAYRX2AD.js +13 -0
- package/dist/chunk-FFSX2QDQ.js +362 -0
- package/dist/chunk-FHAMQS7Q.js +5856 -0
- package/dist/chunk-FIV4IJL7.js +2263 -0
- package/dist/chunk-FNXVT7HF.js +52 -0
- package/dist/chunk-FSWCWSTS.js +395 -0
- package/dist/chunk-FW5LDDMJ.js +16464 -0
- package/dist/chunk-FXQLIX3K.js +211 -0
- package/dist/chunk-G5AAKEEZ.js +228 -0
- package/dist/chunk-G5S3S5ZN.js +38 -0
- package/dist/chunk-GAZEWQEZ.js +231 -0
- package/dist/chunk-GFJOMSHG.js +125 -0
- package/dist/chunk-GFXZTHNI.js +158 -0
- package/dist/chunk-GM54GJBU.js +960 -0
- package/dist/chunk-GPQ3NJPR.js +900 -0
- package/dist/chunk-GTCU6DZ3.js +1 -0
- package/dist/chunk-H5E77KUJ.js +15 -0
- package/dist/chunk-H72H4XDU.js +1023 -0
- package/dist/chunk-HA4ZYA6T.js +178 -0
- package/dist/chunk-I45KAW2N.js +5020 -0
- package/dist/chunk-IQ35HMQL.js +1396 -0
- package/dist/chunk-IYFBFX34.js +86 -0
- package/dist/chunk-JJPMWPB6.js +109 -0
- package/dist/chunk-JTHKOYWU.js +663 -0
- package/dist/chunk-JVGPR3TS.js +365 -0
- package/dist/chunk-JVKB2TBL.js +48 -0
- package/dist/chunk-JX7VBZDK.js +31 -0
- package/dist/chunk-K3G6JBUC.js +5232 -0
- package/dist/chunk-K4YUNKU7.js +589 -0
- package/dist/chunk-KBZGE6LN.js +710 -0
- package/dist/chunk-KDQJCT2J.js +45 -0
- package/dist/chunk-KI4L2DUL.js +560 -0
- package/dist/chunk-KJ2ZTQSL.js +47 -0
- package/dist/chunk-KSJ5UTP7.js +154 -0
- package/dist/chunk-LHOA5DWA.js +28 -0
- package/dist/chunk-LX5QWLBL.js +27 -0
- package/dist/chunk-LZDDLNCZ.js +279 -0
- package/dist/chunk-M2WF6AXG.js +115 -0
- package/dist/chunk-M7BS2K6U.js +1 -0
- package/dist/chunk-NDBIPFNY.js +102 -0
- package/dist/chunk-NEMIWEXC.js +1199 -0
- package/dist/chunk-NFAYHPRH.js +323 -0
- package/dist/chunk-O37BQ65S.js +21 -0
- package/dist/chunk-O74MJHXU.js +187 -0
- package/dist/chunk-OJZEX73F.js +112 -0
- package/dist/chunk-PAAWLLZX.js +74 -0
- package/dist/chunk-PFXFQQRT.js +339 -0
- package/dist/chunk-PFZO3C6H.js +14 -0
- package/dist/chunk-PHH7LD45.js +113 -0
- package/dist/chunk-QRTG4XTI.js +188 -0
- package/dist/chunk-QVOVMXJR.js +1351 -0
- package/dist/chunk-RCQYT2I4.js +757 -0
- package/dist/chunk-RD6DEE36.js +1178 -0
- package/dist/chunk-RJIZEJ42.js +30 -0
- package/dist/chunk-RPOA7IAE.js +150 -0
- package/dist/chunk-SN2DQRL6.js +1172 -0
- package/dist/chunk-SQJVFEBV.js +41 -0
- package/dist/chunk-SQP64RCS.js +5391 -0
- package/dist/chunk-SVT4RNTR.js +49 -0
- package/dist/chunk-SWUFN7XM.js +43 -0
- package/dist/chunk-SXMVYC5H.js +174 -0
- package/dist/chunk-SZ6AYUIZ.js +23 -0
- package/dist/chunk-T3KGZBU5.js +3171 -0
- package/dist/chunk-TBRL2RCC.js +9 -0
- package/dist/chunk-TRT2HRWZ.js +18 -0
- package/dist/chunk-TYW2GI5I.js +1077 -0
- package/dist/chunk-UIWONWVG.js +4959 -0
- package/dist/chunk-VB3H5WWB.js +151 -0
- package/dist/chunk-W4A6QA3D.js +258 -0
- package/dist/chunk-WBPVKEEE.js +227 -0
- package/dist/chunk-WEBMSQP2.js +123 -0
- package/dist/chunk-WOEZV3Q4.js +333 -0
- package/dist/chunk-WQQON3SV.js +473 -0
- package/dist/chunk-WQTOVMGV.js +119 -0
- package/dist/chunk-WZO23AWO.js +2779 -0
- package/dist/chunk-XBDP4QPW.js +7 -0
- package/dist/chunk-XEBHSJLT.js +103 -0
- package/dist/chunk-XQ2ECNK3.js +1 -0
- package/dist/chunk-XQ2XGIBF.js +2086 -0
- package/dist/chunk-Y2GE5TSI.js +355 -0
- package/dist/chunk-YBUJCZ57.js +351 -0
- package/dist/chunk-YNCVSFGF.js +149 -0
- package/dist/chunk-YUPMXOGP.js +282 -0
- package/dist/chunk-YY6APYUM.js +49 -0
- package/dist/chunk-Z2IJUO45.js +691 -0
- package/dist/chunk-ZEHUCJHY.js +129 -0
- package/dist/chunk-ZYU2YOJ6.js +1496 -0
- package/dist/chunk-ZZ4V3WIZ.js +163 -0
- package/dist/coordination/agents/index.js +145 -6260
- package/dist/coordination/index.js +365 -34324
- package/dist/coordination/mailbox-project-server.js +48 -3276
- package/dist/coordination/provider-status-tracker.d.ts +4 -0
- package/dist/core/agent.d.ts +14 -1
- package/dist/core/index.js +267 -12480
- package/dist/core/model-ref.js +5 -23
- package/dist/core/provider-runner.d.ts +36 -1
- package/dist/design/index.js +50 -1087
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.js +1599 -21888
- package/dist/execution/prompt-enhancer.js +16 -535
- package/dist/execution/retry-policy.d.ts +31 -1
- package/dist/extension/index.js +7 -311
- package/dist/goal/index.js +33 -3435
- package/dist/hooks/index.js +14 -1138
- package/dist/hq/index.js +112 -5139
- package/dist/hq/protocol.js +21 -668
- package/dist/index.js +1410 -92656
- package/dist/infrastructure/index.js +64 -4811
- package/dist/kernel/events/provider-events.d.ts +15 -0
- package/dist/kernel/index.js +14 -992
- package/dist/models/index.js +40 -1117
- package/dist/notifications/index.js +3 -108
- package/dist/observability/index.js +17 -279
- package/dist/plugin/index.js +584 -14835
- package/dist/prompts/index.js +14 -948
- package/dist/registry/index.js +9 -822
- package/dist/registry-R23UBE7H.js +14 -0
- package/dist/replay/index.js +6 -84
- package/dist/review-finding-store-DKAV3AS6.js +21 -0
- package/dist/review-report-store-OWY3EC3N.js +19 -0
- package/dist/security/index.js +114 -2202
- package/dist/session-catalog/index.js +36 -2103
- package/dist/session-catalog/project-server.js +42 -1435
- package/dist/skills/index.js +35 -1578
- package/dist/storage/index.js +182 -15600
- package/dist/tasking/index.js +10 -676
- package/dist/tools/index.js +52 -9590
- package/dist/types/config/autonomy.d.ts +5 -0
- package/dist/types/config/ui.d.ts +1 -1
- package/dist/types/errors.d.ts +18 -0
- package/dist/types/index.js +121 -1342
- package/dist/types/provider-runner.d.ts +8 -0
- package/dist/types/session-markers.js +8 -144
- package/dist/utils/error.js +3 -4
- package/dist/utils/expect-defined.js +3 -9
- package/dist/utils/heap-watchdog.js +6 -706
- package/dist/utils/index.js +269 -5685
- package/dist/utils/sage-output-block.js +5 -42
- package/dist/wiring/proxy-rewrite.d.ts +18 -0
- package/dist/wiring/proxy-rewrite.js +18 -121
- package/dist/worktree/index.js +6 -887
- package/package.json +4 -4
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ToolCapabilities
|
|
3
|
+
} from "./chunk-A455ATZB.js";
|
|
4
|
+
|
|
5
|
+
// src/security/readonly-permission-policy.ts
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
var MUTATION_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
8
|
+
ToolCapabilities.FS_WRITE,
|
|
9
|
+
ToolCapabilities.FS_WRITE_OUTSIDE_PROJECT,
|
|
10
|
+
ToolCapabilities.MEMORY_WRITE,
|
|
11
|
+
ToolCapabilities.MEMORY_DELETE,
|
|
12
|
+
ToolCapabilities.SHELL_ARBITRARY,
|
|
13
|
+
ToolCapabilities.SHELL_RESTRICTED,
|
|
14
|
+
ToolCapabilities.SHELL_EXEC,
|
|
15
|
+
ToolCapabilities.TOOL_MUTATE_ANY,
|
|
16
|
+
ToolCapabilities.CONFIG_MUTATE,
|
|
17
|
+
ToolCapabilities.PACKAGE_INSTALL,
|
|
18
|
+
ToolCapabilities.SUBAGENT_SPAWN
|
|
19
|
+
]);
|
|
20
|
+
function toolMutates(tool) {
|
|
21
|
+
if (tool.mutating === true) return true;
|
|
22
|
+
return (tool.capabilities ?? []).some((c) => MUTATION_CAPABILITIES.has(c));
|
|
23
|
+
}
|
|
24
|
+
var hasMutationCapability = toolMutates;
|
|
25
|
+
function isAllowedReportFile(input, projectRoot) {
|
|
26
|
+
if (!input || typeof input !== "object") return false;
|
|
27
|
+
const record = input;
|
|
28
|
+
const inputPath = record["path"];
|
|
29
|
+
if (typeof inputPath !== "string") return false;
|
|
30
|
+
if (!inputPath.endsWith(".md")) return false;
|
|
31
|
+
try {
|
|
32
|
+
const resolved = path.resolve(projectRoot, inputPath);
|
|
33
|
+
const tempDir = path.resolve(projectRoot, ".temp_files");
|
|
34
|
+
if (!resolved.startsWith(tempDir + path.sep) && resolved !== tempDir) return false;
|
|
35
|
+
return true;
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
var ReadOnlyPermissionPolicy = class {
|
|
41
|
+
constructor(inner, projectRoot) {
|
|
42
|
+
this.inner = inner;
|
|
43
|
+
this.projectRoot = projectRoot;
|
|
44
|
+
}
|
|
45
|
+
inner;
|
|
46
|
+
projectRoot;
|
|
47
|
+
async evaluate(tool, input, ctx) {
|
|
48
|
+
if (ctx.meta["readOnly"] !== true) {
|
|
49
|
+
return this.inner.evaluate(tool, input, ctx);
|
|
50
|
+
}
|
|
51
|
+
if (!hasMutationCapability(tool)) {
|
|
52
|
+
return this.inner.evaluate(tool, input, ctx);
|
|
53
|
+
}
|
|
54
|
+
if (isAllowedReportFile(input, this.projectRoot)) {
|
|
55
|
+
return this.inner.evaluate(tool, input, ctx);
|
|
56
|
+
}
|
|
57
|
+
const matched = (tool.capabilities ?? []).filter((c) => MUTATION_CAPABILITIES.has(c));
|
|
58
|
+
const why = matched.length > 0 ? `requires mutation capabilities (${matched.join(", ")})` : "is declared mutating";
|
|
59
|
+
return {
|
|
60
|
+
permission: "deny",
|
|
61
|
+
source: "readonly_mode",
|
|
62
|
+
reason: `Session is in read-only mode: tool "${tool.name}" ${why}, which is not allowed. Only .md report files under .temp_files/ may be written.`
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async trust(rule) {
|
|
66
|
+
return this.inner.trust(rule);
|
|
67
|
+
}
|
|
68
|
+
async deny(rule) {
|
|
69
|
+
return this.inner.deny(rule);
|
|
70
|
+
}
|
|
71
|
+
denyOnce(rule) {
|
|
72
|
+
this.inner.denyOnce(rule);
|
|
73
|
+
}
|
|
74
|
+
allowOnce(rule) {
|
|
75
|
+
this.inner.allowOnce(rule);
|
|
76
|
+
}
|
|
77
|
+
async reload() {
|
|
78
|
+
if ("reload" in this.inner && typeof this.inner.reload === "function") {
|
|
79
|
+
await this.inner.reload();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async explain(tool, input, ctx) {
|
|
83
|
+
if (ctx.meta["readOnly"] !== true) {
|
|
84
|
+
if (this.inner.explain) return this.inner.explain(tool, input, ctx);
|
|
85
|
+
const decision = await this.inner.evaluate(tool, input, ctx);
|
|
86
|
+
return {
|
|
87
|
+
toolName: tool.name,
|
|
88
|
+
subject: null,
|
|
89
|
+
steps: [{ rule: "inner", matched: true, decision: decision.permission === "deny" ? "deny" : "auto", source: decision.source, detail: decision.reason ?? "Inner policy decision" }],
|
|
90
|
+
winnerIndex: 0,
|
|
91
|
+
decision
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (!hasMutationCapability(tool) || isAllowedReportFile(input, this.projectRoot)) {
|
|
95
|
+
if (this.inner.explain) return this.inner.explain(tool, input, ctx);
|
|
96
|
+
const decision = await this.evaluate(tool, input, ctx);
|
|
97
|
+
return {
|
|
98
|
+
toolName: tool.name,
|
|
99
|
+
subject: null,
|
|
100
|
+
steps: [{ rule: "readonly_mode", matched: decision.permission === "deny", decision: decision.permission === "deny" ? "deny" : "auto", source: "readonly_mode", detail: decision.reason ?? "Read-only mode" }],
|
|
101
|
+
winnerIndex: 0,
|
|
102
|
+
decision
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
toolName: tool.name,
|
|
107
|
+
subject: null,
|
|
108
|
+
steps: [{
|
|
109
|
+
rule: "readonly_mode",
|
|
110
|
+
matched: true,
|
|
111
|
+
decision: "deny",
|
|
112
|
+
source: "readonly_mode",
|
|
113
|
+
detail: `Read-only mode blocks ${tool.name} because it carries mutation capabilities (${(tool.capabilities ?? []).filter((c) => MUTATION_CAPABILITIES.has(c)).join(", ")}). Only .md files under .temp_files/ may be written.`
|
|
114
|
+
}],
|
|
115
|
+
winnerIndex: 0,
|
|
116
|
+
decision: {
|
|
117
|
+
permission: "deny",
|
|
118
|
+
source: "readonly_mode",
|
|
119
|
+
reason: `Read-only mode: ${tool.name} requires mutation capabilities.`
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
toolMutates,
|
|
127
|
+
ReadOnlyPermissionPolicy
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=chunk-ZEHUCJHY.js.map
|