@wrongstack/core 0.291.0 → 0.291.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/boot.d.ts.map +1 -1
- package/dist/chronicle/index.js +20 -1
- package/dist/chronicle/index.js.map +2 -2
- package/dist/chronicle/tool-adapter.d.ts.map +1 -1
- package/dist/coordination/director.d.ts +18 -0
- package/dist/coordination/director.d.ts.map +1 -1
- package/dist/coordination/fleet-spawn.d.ts.map +1 -1
- package/dist/coordination/index.js +37 -15
- package/dist/coordination/index.js.map +2 -2
- package/dist/core/agent-response.d.ts.map +1 -1
- package/dist/defaults/index.js +660 -391
- package/dist/defaults/index.js.map +4 -4
- package/dist/execution/index.js +61 -12
- package/dist/execution/index.js.map +3 -3
- package/dist/execution/tool-executor.d.ts.map +1 -1
- package/dist/hq/index.js +17 -0
- package/dist/hq/index.js.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1304 -882
- package/dist/index.js.map +4 -4
- package/dist/infrastructure/index.js +15 -10
- package/dist/infrastructure/index.js.map +2 -2
- package/dist/kernel/events/tool-events.d.ts +24 -0
- package/dist/kernel/events/tool-events.d.ts.map +1 -1
- package/dist/plugins/auto-review-plugin.d.ts +10 -0
- package/dist/plugins/auto-review-plugin.d.ts.map +1 -1
- package/dist/security/index.js +148 -0
- package/dist/security/index.js.map +3 -3
- package/dist/security/permission-policy.d.ts +8 -1
- package/dist/security/permission-policy.d.ts.map +1 -1
- package/dist/storage/config-loader.d.ts +8 -0
- package/dist/storage/config-loader.d.ts.map +1 -1
- package/dist/storage/index.js +457 -379
- package/dist/storage/index.js.map +4 -4
- package/dist/storage/provider-config-watcher.d.ts +6 -0
- package/dist/storage/provider-config-watcher.d.ts.map +1 -1
- package/dist/types/permission.d.ts +38 -0
- package/dist/types/permission.d.ts.map +1 -1
- package/dist/utils/config-backup.d.ts +20 -0
- package/dist/utils/config-backup.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +172 -106
- package/dist/utils/index.js.map +4 -4
- package/dist/utils/message-invariants.d.ts +12 -9
- package/dist/utils/message-invariants.d.ts.map +1 -1
- package/dist/utils/term.d.ts +6 -0
- package/dist/utils/term.d.ts.map +1 -1
- package/dist/utils/wstack-paths.d.ts +10 -0
- package/dist/utils/wstack-paths.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/execution/index.js
CHANGED
|
@@ -359,16 +359,6 @@ function deepEqual(a, b) {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
// src/utils/message-invariants.ts
|
|
362
|
-
function hasMeaningfulContent(content) {
|
|
363
|
-
if (typeof content === "string") return content.trim().length > 0;
|
|
364
|
-
return content.some((block) => {
|
|
365
|
-
if (block.type === "text") return block.text.trim().length > 0;
|
|
366
|
-
if (block.type === "thinking") {
|
|
367
|
-
return block.thinking.trim().length > 0 || Boolean(block.signature);
|
|
368
|
-
}
|
|
369
|
-
return true;
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
362
|
function repairToolUseAdjacency(messages) {
|
|
373
363
|
const removedToolUses = [];
|
|
374
364
|
const removedToolResults = [];
|
|
@@ -455,6 +445,21 @@ function mapContent(msg, fn) {
|
|
|
455
445
|
}
|
|
456
446
|
return { ...msg, content: next };
|
|
457
447
|
}
|
|
448
|
+
function hasMeaningfulContent(content) {
|
|
449
|
+
if (typeof content === "string") return content.trim().length > 0;
|
|
450
|
+
for (const block of content) {
|
|
451
|
+
if (block.type === "text") {
|
|
452
|
+
if (block.text.trim().length > 0) return true;
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
if (block.type === "thinking") {
|
|
456
|
+
if (block.thinking.trim().length > 0 || block.signature) return true;
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
458
463
|
function isEmptyMessage(msg) {
|
|
459
464
|
return !hasMeaningfulContent(msg.content);
|
|
460
465
|
}
|
|
@@ -1605,6 +1610,22 @@ function resolveWstackPaths(opts) {
|
|
|
1605
1610
|
const safe = name.replace(/[/\\:]/g, "_").replace(/\.\./g, "_");
|
|
1606
1611
|
return path2.join(globalRoot, "profiles", safe || "default", "config.json");
|
|
1607
1612
|
},
|
|
1613
|
+
profileStatuslineConfig: (name) => {
|
|
1614
|
+
const safe = name.replace(/[/\\:]/g, "_").replace(/\.\./g, "_");
|
|
1615
|
+
return path2.join(globalRoot, "profiles", safe || "default", "statusline.json");
|
|
1616
|
+
},
|
|
1617
|
+
profileModeConfig: (name) => {
|
|
1618
|
+
const safe = name.replace(/[/\\:]/g, "_").replace(/\.\./g, "_");
|
|
1619
|
+
return path2.join(globalRoot, "profiles", safe || "default", "mode.json");
|
|
1620
|
+
},
|
|
1621
|
+
profileProviderStatus: (name) => {
|
|
1622
|
+
const safe = name.replace(/[/\\:]/g, "_").replace(/\.\./g, "_");
|
|
1623
|
+
return path2.join(globalRoot, "profiles", safe || "default", "provider-status.json");
|
|
1624
|
+
},
|
|
1625
|
+
profileUpdateCache: (name) => {
|
|
1626
|
+
const safe = name.replace(/[/\\:]/g, "_").replace(/\.\./g, "_");
|
|
1627
|
+
return path2.join(globalRoot, "profiles", safe || "default", "update-cache.json");
|
|
1628
|
+
},
|
|
1608
1629
|
secretsKey: path2.join(globalRoot, ".key"),
|
|
1609
1630
|
globalMemory: path2.join(globalRoot, "memory.md"),
|
|
1610
1631
|
globalSkills: path2.join(globalRoot, "skills"),
|
|
@@ -1644,6 +1665,7 @@ function resolveWstackPaths(opts) {
|
|
|
1644
1665
|
projectAutophase: path2.join(projectDir, "autophase"),
|
|
1645
1666
|
projectSddBoards: path2.join(projectDir, "sdd-boards"),
|
|
1646
1667
|
syncConfig: path2.join(globalRoot, "sync.json"),
|
|
1668
|
+
configHistoryDir: path2.join(globalRoot, "config-history"),
|
|
1647
1669
|
projectStatus: (projectHash2) => path2.join(globalRoot, "projects", projectHash2, "status.json")
|
|
1648
1670
|
};
|
|
1649
1671
|
}
|
|
@@ -13293,7 +13315,7 @@ function readPolicy(ctx) {
|
|
|
13293
13315
|
}
|
|
13294
13316
|
|
|
13295
13317
|
// src/execution/tool-executor.ts
|
|
13296
|
-
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
13318
|
+
import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypto";
|
|
13297
13319
|
|
|
13298
13320
|
// src/observability/process-telemetry.ts
|
|
13299
13321
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -13708,12 +13730,30 @@ ${errorDetails}`,
|
|
|
13708
13730
|
const policy = this.opts.permissionPolicy;
|
|
13709
13731
|
const yolo = policy.getYolo?.() === true;
|
|
13710
13732
|
const authoritativeAuto = decision.source === "yolo";
|
|
13711
|
-
|
|
13733
|
+
const capabilityDowngraded = toolDangerousCaps.length > 0 && effectivePermission === "auto" && !yolo && !authoritativeAuto;
|
|
13734
|
+
if (capabilityDowngraded) {
|
|
13712
13735
|
effectivePermission = "confirm";
|
|
13713
13736
|
}
|
|
13714
13737
|
if (boundary.decision === "confirm" && effectivePermission !== "deny") {
|
|
13715
13738
|
effectivePermission = "confirm";
|
|
13716
13739
|
}
|
|
13740
|
+
this.opts.events?.emit("permission.evaluated", {
|
|
13741
|
+
sessionId: ctx.session.id,
|
|
13742
|
+
...ctx.traceId ? { traceId: ctx.traceId } : {},
|
|
13743
|
+
...ctx.agentId ? { agentId: ctx.agentId } : {},
|
|
13744
|
+
name: tool.name,
|
|
13745
|
+
id: use.id,
|
|
13746
|
+
inputHash: hashPermissionInput(use.input, this.opts.secretScrubber),
|
|
13747
|
+
policyDecision: decision.permission,
|
|
13748
|
+
effectiveDecision: effectivePermission,
|
|
13749
|
+
decisionSource: decision.source,
|
|
13750
|
+
...decision.reason ? { reason: decision.reason } : {},
|
|
13751
|
+
...decision.riskTier ?? tool.riskTier ? { riskTier: decision.riskTier ?? tool.riskTier } : {},
|
|
13752
|
+
yoloEnabled: yolo,
|
|
13753
|
+
boundaryDecision: boundary.decision,
|
|
13754
|
+
...boundary.reason ? { boundaryReason: boundary.reason } : {},
|
|
13755
|
+
capabilityDowngraded
|
|
13756
|
+
});
|
|
13717
13757
|
if (effectivePermission === "deny") {
|
|
13718
13758
|
const result = this.deniedResult(use, decision.reason);
|
|
13719
13759
|
budget = this.budgetForString(result.content, budget);
|
|
@@ -14395,6 +14435,15 @@ ${head}${TOOL_OUTPUT_ARTIFACT_OMISSION}${tail}`;
|
|
|
14395
14435
|
return content;
|
|
14396
14436
|
}
|
|
14397
14437
|
}
|
|
14438
|
+
function hashPermissionInput(input, scrubber) {
|
|
14439
|
+
let serialized;
|
|
14440
|
+
try {
|
|
14441
|
+
serialized = JSON.stringify(input) ?? "";
|
|
14442
|
+
} catch {
|
|
14443
|
+
serialized = String(input);
|
|
14444
|
+
}
|
|
14445
|
+
return createHash2("sha256").update(scrubber.scrub(serialized), "utf8").digest("hex");
|
|
14446
|
+
}
|
|
14398
14447
|
function sliceUtf8Prefix(text, maxBytes) {
|
|
14399
14448
|
if (maxBytes <= 0) return "";
|
|
14400
14449
|
if (Buffer.byteLength(text, "utf8") <= maxBytes) return text;
|