@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,140 @@
|
|
|
1
|
+
// src/security/capabilities.ts
|
|
2
|
+
var ToolCapabilities = {
|
|
3
|
+
/** Can execute arbitrary commands in the user's shell (the `bash` tool). */
|
|
4
|
+
SHELL_ARBITRARY: "shell.arbitrary",
|
|
5
|
+
/**
|
|
6
|
+
* Can execute the `exec` tool's allowlisted commands.
|
|
7
|
+
*
|
|
8
|
+
* "Restricted" describes the command NAME check, not the resulting power.
|
|
9
|
+
* Treat this as equivalent to {@link SHELL_ARBITRARY} when deciding what to
|
|
10
|
+
* grant: the allowlist includes general-purpose interpreters (`node`,
|
|
11
|
+
* `python`, `perl`, `ruby`) and, on Windows, the platform shells (`cmd`,
|
|
12
|
+
* `powershell`, `pwsh`) — deliberately, since without them `exec` cannot run
|
|
13
|
+
* `dir`/`type`/any cmdlet. `node -e …` or `cmd /c …` therefore reaches
|
|
14
|
+
* arbitrary execution, and per-argument denylisting cannot close that while
|
|
15
|
+
* the shells remain (blocking `node -e` still leaves `cmd /c node -e`).
|
|
16
|
+
*
|
|
17
|
+
* What actually bounds this is downstream, not the name check: the permission
|
|
18
|
+
* policy reconstructs the full command line and runs it through the
|
|
19
|
+
* destructive classifier, so destructive calls still require confirmation.
|
|
20
|
+
*
|
|
21
|
+
* Granting `shell.restricted` while withholding `shell.arbitrary` therefore
|
|
22
|
+
* buys no meaningful reduction in blast radius. Documented rather than
|
|
23
|
+
* silently implied, because the two read as a narrow/wide pair (WS-083).
|
|
24
|
+
*/
|
|
25
|
+
SHELL_RESTRICTED: "shell.restricted",
|
|
26
|
+
/** Can run a restricted project formatter/linter-style command. */
|
|
27
|
+
SHELL_EXEC: "shell.exec",
|
|
28
|
+
/** Can read files inside the project (and possibly outside via symlinks if not guarded). */
|
|
29
|
+
FS_READ: "fs.read",
|
|
30
|
+
/** Can write / modify / delete files inside the project. */
|
|
31
|
+
FS_WRITE: "fs.write",
|
|
32
|
+
/** Can write files outside the current project root (very high risk). */
|
|
33
|
+
FS_WRITE_OUTSIDE_PROJECT: "fs.write.outside-project",
|
|
34
|
+
/** Can perform outbound network requests. */
|
|
35
|
+
NET_OUTBOUND: "net.outbound",
|
|
36
|
+
/** Can mutate in-memory session todos only. */
|
|
37
|
+
SESSION_TODO: "session.todo",
|
|
38
|
+
/** Can park after-task `<nextsteps>` suggestions for the current turn. */
|
|
39
|
+
SESSION_NEXTSTEPS: "session.nextsteps",
|
|
40
|
+
/** Can mutate in-memory session mode only. */
|
|
41
|
+
SESSION_MODE: "session.mode",
|
|
42
|
+
/** Can inspect registered tool metadata. */
|
|
43
|
+
TOOL_META: "tool.meta",
|
|
44
|
+
/** Can invoke arbitrary registered tools through a meta-tool. */
|
|
45
|
+
TOOL_MUTATE_ANY: "tool.mutate.any",
|
|
46
|
+
/** Can read persistent memory. */
|
|
47
|
+
MEMORY_READ: "memory.read",
|
|
48
|
+
/** Can write persistent memory. */
|
|
49
|
+
MEMORY_WRITE: "memory.write",
|
|
50
|
+
/** Can delete persistent memory. */
|
|
51
|
+
MEMORY_DELETE: "memory.delete",
|
|
52
|
+
/** Proxies tools from external MCP servers (unknown capability). */
|
|
53
|
+
MCP_PROXY: "mcp.proxy",
|
|
54
|
+
/** Can spawn or manage subagents / multi-agent tasks. */
|
|
55
|
+
SUBAGENT_SPAWN: "subagent.spawn",
|
|
56
|
+
/** Can inspect fleet/subagent coordination state without mutating it. */
|
|
57
|
+
COORDINATION_FLEET_READ: "coordination.fleet.read",
|
|
58
|
+
/** Can publish attributed, schema-checked events onto the fleet bus. */
|
|
59
|
+
COORDINATION_FLEET_EMIT: "coordination.fleet.emit",
|
|
60
|
+
/** Can submit a task-local structured result to the parent Director. */
|
|
61
|
+
COORDINATION_RESULT_SUBMIT: "coordination.result.submit",
|
|
62
|
+
/** Can read or write inter-agent mailbox messages. */
|
|
63
|
+
COORDINATION_MAIL: "coordination.mail",
|
|
64
|
+
/** Can schedule, inspect, or cancel in-session cron jobs. */
|
|
65
|
+
COORDINATION_CRON: "coordination.cron",
|
|
66
|
+
/** Can mutate global or session configuration / trust state. */
|
|
67
|
+
CONFIG_MUTATE: "config.mutate",
|
|
68
|
+
/** Can install packages or run package managers with side effects. */
|
|
69
|
+
PACKAGE_INSTALL: "package.install"
|
|
70
|
+
};
|
|
71
|
+
var DANGEROUS_FOR_SUBAGENTS = [
|
|
72
|
+
ToolCapabilities.SHELL_ARBITRARY,
|
|
73
|
+
ToolCapabilities.SHELL_RESTRICTED,
|
|
74
|
+
ToolCapabilities.SHELL_EXEC,
|
|
75
|
+
ToolCapabilities.FS_WRITE,
|
|
76
|
+
ToolCapabilities.FS_WRITE_OUTSIDE_PROJECT,
|
|
77
|
+
ToolCapabilities.TOOL_MUTATE_ANY,
|
|
78
|
+
ToolCapabilities.MEMORY_WRITE,
|
|
79
|
+
ToolCapabilities.MEMORY_DELETE,
|
|
80
|
+
ToolCapabilities.MCP_PROXY,
|
|
81
|
+
ToolCapabilities.SUBAGENT_SPAWN,
|
|
82
|
+
ToolCapabilities.CONFIG_MUTATE,
|
|
83
|
+
ToolCapabilities.PACKAGE_INSTALL
|
|
84
|
+
];
|
|
85
|
+
var WIDE_SUBAGENT_CAPABILITIES = [
|
|
86
|
+
ToolCapabilities.FS_READ,
|
|
87
|
+
ToolCapabilities.FS_WRITE,
|
|
88
|
+
ToolCapabilities.NET_OUTBOUND,
|
|
89
|
+
ToolCapabilities.SESSION_TODO,
|
|
90
|
+
ToolCapabilities.TOOL_META,
|
|
91
|
+
ToolCapabilities.MEMORY_READ,
|
|
92
|
+
ToolCapabilities.SHELL_ARBITRARY,
|
|
93
|
+
ToolCapabilities.SHELL_RESTRICTED,
|
|
94
|
+
ToolCapabilities.SHELL_EXEC,
|
|
95
|
+
ToolCapabilities.PACKAGE_INSTALL,
|
|
96
|
+
// Read-only fleet visibility (fleet_status) — peer awareness has no blast
|
|
97
|
+
// radius and every fleet worker should coordinate around its peers.
|
|
98
|
+
ToolCapabilities.COORDINATION_FLEET_READ,
|
|
99
|
+
ToolCapabilities.COORDINATION_RESULT_SUBMIT
|
|
100
|
+
];
|
|
101
|
+
function clampSubagentCapabilities(requested, ceiling = WIDE_SUBAGENT_CAPABILITIES) {
|
|
102
|
+
const ceilingSet = new Set(ceiling);
|
|
103
|
+
const requestedSet = new Set(requested);
|
|
104
|
+
return {
|
|
105
|
+
granted: ceiling.filter((capability) => requestedSet.has(capability)),
|
|
106
|
+
dropped: [...requestedSet].filter((capability) => !ceilingSet.has(capability))
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function hasDangerousCapabilityForSubagents(toolOrCaps) {
|
|
110
|
+
if (!toolOrCaps) return false;
|
|
111
|
+
const input = toolOrCaps;
|
|
112
|
+
const caps = Array.isArray(toolOrCaps) ? toolOrCaps : input.capabilities ?? [];
|
|
113
|
+
return caps.some((c) => DANGEROUS_FOR_SUBAGENTS.includes(c));
|
|
114
|
+
}
|
|
115
|
+
function hasCapability(toolOrCaps, capability) {
|
|
116
|
+
if (!toolOrCaps) return false;
|
|
117
|
+
const input = toolOrCaps;
|
|
118
|
+
const caps = Array.isArray(toolOrCaps) ? toolOrCaps : input.capabilities ?? [];
|
|
119
|
+
const toCheck = Array.isArray(capability) ? capability : [capability];
|
|
120
|
+
return toCheck.some((c) => caps.includes(c));
|
|
121
|
+
}
|
|
122
|
+
function getDangerousCapabilities(toolOrCaps) {
|
|
123
|
+
if (!toolOrCaps) return [];
|
|
124
|
+
const input = toolOrCaps;
|
|
125
|
+
const caps = Array.isArray(toolOrCaps) ? toolOrCaps : input.capabilities ?? [];
|
|
126
|
+
return caps.filter(
|
|
127
|
+
(c) => DANGEROUS_FOR_SUBAGENTS.includes(c)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export {
|
|
132
|
+
ToolCapabilities,
|
|
133
|
+
DANGEROUS_FOR_SUBAGENTS,
|
|
134
|
+
WIDE_SUBAGENT_CAPABILITIES,
|
|
135
|
+
clampSubagentCapabilities,
|
|
136
|
+
hasDangerousCapabilityForSubagents,
|
|
137
|
+
hasCapability,
|
|
138
|
+
getDangerousCapabilities
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=chunk-A455ATZB.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ERROR_CODES,
|
|
3
|
+
FsError
|
|
4
|
+
} from "./chunk-WOEZV3Q4.js";
|
|
5
|
+
|
|
6
|
+
// src/utils/session-scoped-path.ts
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
function sessionScopedPath(dir, sessionId, suffix) {
|
|
9
|
+
if (!sessionId || sessionId.includes("\\") || sessionId.includes("..")) {
|
|
10
|
+
throw invalid(sessionId);
|
|
11
|
+
}
|
|
12
|
+
const resolved = path.resolve(dir, `${sessionId}${suffix}`);
|
|
13
|
+
const rel = path.relative(path.resolve(dir), resolved);
|
|
14
|
+
if (rel.startsWith("..") || path.isAbsolute(rel)) {
|
|
15
|
+
throw invalid(sessionId);
|
|
16
|
+
}
|
|
17
|
+
return resolved;
|
|
18
|
+
}
|
|
19
|
+
var SESSION_SIDECAR_JSONL_SUFFIXES = [
|
|
20
|
+
".replay.jsonl",
|
|
21
|
+
".audit.jsonl",
|
|
22
|
+
".annotations.jsonl"
|
|
23
|
+
];
|
|
24
|
+
var RESERVED_SESSION_JSONL_NAMES = /* @__PURE__ */ new Set([
|
|
25
|
+
"_index.jsonl",
|
|
26
|
+
"_mailbox.jsonl"
|
|
27
|
+
]);
|
|
28
|
+
function isSessionTranscriptFileName(name) {
|
|
29
|
+
if (!name.endsWith(".jsonl")) return false;
|
|
30
|
+
if (RESERVED_SESSION_JSONL_NAMES.has(name)) return false;
|
|
31
|
+
return !SESSION_SIDECAR_JSONL_SUFFIXES.some((suffix) => name.endsWith(suffix));
|
|
32
|
+
}
|
|
33
|
+
function invalid(sessionId) {
|
|
34
|
+
return new FsError({
|
|
35
|
+
message: `Invalid sessionId: ${sessionId}`,
|
|
36
|
+
code: ERROR_CODES.FS_DELETE_FAILED,
|
|
37
|
+
path: sessionId,
|
|
38
|
+
context: { reason: "path_traversal" }
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
sessionScopedPath,
|
|
44
|
+
isSessionTranscriptFileName
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=chunk-AD7ZFZCS.js.map
|