@wrongstack/core 0.306.2 → 0.306.4
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/coordination/index.js +184 -86
- package/dist/coordination/mail-tools.d.ts +1 -1
- package/dist/coordination/mailbox-project-server.js +38 -16
- package/dist/coordination/sqlite-mailbox.d.ts +1 -0
- package/dist/core/conversation-state.d.ts +1 -2
- package/dist/core/fallback-model.d.ts +19 -1
- package/dist/core/fallback-profile-manager.d.ts +21 -3
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +152 -46
- package/dist/defaults/index.js +347 -139
- package/dist/execution/auto-compaction-middleware.d.ts +64 -0
- package/dist/execution/compaction-core.d.ts +4 -0
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.js +234 -91
- package/dist/execution/retry-policy.d.ts +27 -0
- package/dist/hq/index.js +50 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +642 -184
- package/dist/infrastructure/index.js +21 -0
- package/dist/plugin/index.js +195 -19
- package/dist/security/index.js +52 -16
- package/dist/security/kanban-boundary.d.ts +3 -1
- package/dist/session-catalog/index.js +50 -15
- package/dist/session-catalog/project-server.js +50 -15
- package/dist/storage/cloud-config-sync/sanitize.d.ts +18 -0
- package/dist/storage/cloud-config-sync.d.ts +1 -1
- package/dist/storage/index.js +326 -71
- package/dist/storage/provider-config-watcher.d.ts +9 -0
- package/dist/storage/session-store/strict-empty-check.d.ts +7 -0
- package/dist/storage/session-store.d.ts +1 -0
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +83 -22
- package/dist/types/blocks.d.ts +9 -0
- package/dist/types/config/root.d.ts +14 -0
- package/dist/types/session.d.ts +7 -0
- package/instructions/agents/code-reviewer.md +3 -0
- package/instructions/coordination/subagent-baseline.md +10 -1
- package/instructions/system-lite.md +8 -5
- package/instructions/system-pro.md +26 -0
- package/instructions/system.md +21 -0
- package/package.json +3 -3
package/dist/hq/index.js
CHANGED
|
@@ -675,6 +675,24 @@ import * as v8 from "node:v8";
|
|
|
675
675
|
var SESSION_RECIPIENT_PREFIX = "@session:";
|
|
676
676
|
|
|
677
677
|
// src/security/secret-scrubber.ts
|
|
678
|
+
var JSON_CREDENTIAL_KEY_ANCHORS = [
|
|
679
|
+
'Key"',
|
|
680
|
+
'key"',
|
|
681
|
+
'KEY"',
|
|
682
|
+
'token"',
|
|
683
|
+
'Token"',
|
|
684
|
+
'TOKEN"',
|
|
685
|
+
'secret"',
|
|
686
|
+
'Secret"',
|
|
687
|
+
'SECRET"',
|
|
688
|
+
'password"',
|
|
689
|
+
'Password"',
|
|
690
|
+
'PASSWORD"',
|
|
691
|
+
'authorization"',
|
|
692
|
+
'Authorization"',
|
|
693
|
+
'bearer"',
|
|
694
|
+
'Bearer"'
|
|
695
|
+
];
|
|
678
696
|
var PATTERNS = [
|
|
679
697
|
// Anchored at the start where possible so partial matches inside larger
|
|
680
698
|
// strings don't trigger false positives.
|
|
@@ -777,6 +795,30 @@ var PATTERNS = [
|
|
|
777
795
|
regex: /(^|\s)([A-Z_]{4,}(?:KEY|TOKEN|SECRET|PASSWORD|PWD))\s*[:=]\s*['"]?([A-Za-z0-9_/+=-]{20,512})['"]?(?=\s|$)/g,
|
|
778
796
|
anchor: ["KEY", "TOKEN", "SECRET", "PASSWORD", "PWD"]
|
|
779
797
|
},
|
|
798
|
+
{
|
|
799
|
+
type: "json_credential_key",
|
|
800
|
+
// The JSON counterpart to `high_entropy_env`, and the pattern that the
|
|
801
|
+
// now-deleted `JSON_KEY_ANCHORS` list was written for. Without it those
|
|
802
|
+
// anchors only widened the cheap pre-scan — `hasCredentialAnchors` said
|
|
803
|
+
// "this text may hold a secret", every pattern then declined to match, and
|
|
804
|
+
// the value went out verbatim. `high_entropy_env` cannot cover these: it
|
|
805
|
+
// requires an UPPERCASE unquoted key (`API_KEY=…`), so `{"apiKey":"…"}`
|
|
806
|
+
// never matched.
|
|
807
|
+
//
|
|
808
|
+
// Tool results are routinely serialised as JSON, and a credential with no
|
|
809
|
+
// recognisable prefix (Azure, self-hosted gateways, Anthropic/Codex OAuth)
|
|
810
|
+
// has no other pattern that can catch it — this is the only thing standing
|
|
811
|
+
// between such a value and the session JSONL, chronicle, HQ broadcast and
|
|
812
|
+
// the model's own context.
|
|
813
|
+
//
|
|
814
|
+
// The key may carry a prefix (`"anthropicApiKey"`), but the credential word
|
|
815
|
+
// must END the key: `"tokenCount"` and `"maxTokens"` do not match, because
|
|
816
|
+
// the closing quote has to follow the word immediately.
|
|
817
|
+
// Value floor of 8 chars keeps enum-ish values (`"authorization":"none"`)
|
|
818
|
+
// out. Capture groups: 1=key + punctuation, 2=value, 3=closing quote.
|
|
819
|
+
regex: /("[A-Za-z0-9_]*(?:apiKey|api_key|token|secret|password|authorization|bearer|private_key|access_token|refresh_token|client_secret)"\s*:\s*")([^"\\]{8,512})(")/gi,
|
|
820
|
+
anchor: JSON_CREDENTIAL_KEY_ANCHORS
|
|
821
|
+
},
|
|
780
822
|
// ── Ported from packages/plugins credential-patterns.ts (WS-034) ─────────
|
|
781
823
|
// The plugin runtime carried 37 patterns while this scrubber — the one that
|
|
782
824
|
// guards session JSONL, chronicle, HQ broadcast, WebUI events and the auth
|
|
@@ -859,9 +901,12 @@ var PATTERNS = [
|
|
|
859
901
|
anchor: "GOCSPX-"
|
|
860
902
|
}
|
|
861
903
|
];
|
|
862
|
-
var SIMPLE_PATTERNS = PATTERNS.filter(
|
|
904
|
+
var SIMPLE_PATTERNS = PATTERNS.filter(
|
|
905
|
+
(p) => p.type !== "high_entropy_env" && p.type !== "json_credential_key"
|
|
906
|
+
);
|
|
863
907
|
var COMBINED_REGEX = new RegExp(SIMPLE_PATTERNS.map((p) => `(${p.regex.source})`).join("|"), "g");
|
|
864
908
|
var HIGH_ENTROPY_REGEX = PATTERNS.find((p) => p.type === "high_entropy_env").regex;
|
|
909
|
+
var JSON_CREDENTIAL_REGEX = PATTERNS.find((p) => p.type === "json_credential_key").regex;
|
|
865
910
|
var COMBINED_REPLACEMENTS = SIMPLE_PATTERNS.map((p) => `[REDACTED:${p.type}]`);
|
|
866
911
|
var SCRUB_CHUNK_BYTES = 64 * 1024;
|
|
867
912
|
var SCRUB_OVERLAP_BYTES = 1024;
|
|
@@ -872,20 +917,7 @@ var PATTERN_ANCHORS = [
|
|
|
872
917
|
)
|
|
873
918
|
)
|
|
874
919
|
];
|
|
875
|
-
var
|
|
876
|
-
'"apiKey"',
|
|
877
|
-
'"api_key"',
|
|
878
|
-
'"token"',
|
|
879
|
-
'"secret"',
|
|
880
|
-
'"password"',
|
|
881
|
-
'"authorization"',
|
|
882
|
-
'"bearer"',
|
|
883
|
-
'"private_key"',
|
|
884
|
-
'"access_token"',
|
|
885
|
-
'"refresh_token"',
|
|
886
|
-
'"client_secret"'
|
|
887
|
-
];
|
|
888
|
-
var ALL_ANCHORS = [...PATTERN_ANCHORS, ...JSON_KEY_ANCHORS];
|
|
920
|
+
var ALL_ANCHORS = PATTERN_ANCHORS;
|
|
889
921
|
function hasCredentialAnchors(text) {
|
|
890
922
|
for (const anchor of ALL_ANCHORS) {
|
|
891
923
|
if (text.includes(anchor)) return true;
|
|
@@ -934,6 +966,9 @@ var DefaultSecretScrubber = class {
|
|
|
934
966
|
out = out.replace(HIGH_ENTROPY_REGEX, (_match, lead, key, _value) => {
|
|
935
967
|
return `${lead}${key}=[REDACTED:high_entropy_env]`;
|
|
936
968
|
});
|
|
969
|
+
out = out.replace(JSON_CREDENTIAL_REGEX, (_match, keyPrefix, _value, closingQuote) => {
|
|
970
|
+
return `${keyPrefix}[REDACTED:json_credential_key]${closingQuote}`;
|
|
971
|
+
});
|
|
937
972
|
return out;
|
|
938
973
|
}
|
|
939
974
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export { Context, type ContextInit, type ProviderMemoryEvidence, type RunOptions
|
|
|
48
48
|
export { type ContinuationInput, type ContinuationSource, detectContinueIntent, type ResolvedContinuation, resolveContinuation, } from './core/continue-intent.js';
|
|
49
49
|
export { type ContinueDirective, makeContinueToNextIterationTool, parseContinueDirective, } from './core/continue-to-next-iteration.js';
|
|
50
50
|
export { ConversationState, type ReadonlyConversationState, type StateChange, type StateChangeHandler, wrapAsState, } from './core/conversation-state.js';
|
|
51
|
-
export { createFallbackModelExtension, effectiveFallbackChain, type FallbackModelDeps, fallbackProfileChain, formatModelRef, normalizeModelRef, parseModelRef, smartDefaultFallbackChain, } from './core/fallback-model.js';
|
|
51
|
+
export { createFallbackModelExtension, effectiveFallbackChain, type FallbackModelDeps, fallbackProfileChain, formatModelRef, normalizeModelRef, parseModelRef, runtimeFallbackChain, smartDefaultFallbackChain, } from './core/fallback-model.js';
|
|
52
52
|
export type { FallbackChain, FallbackChainEntry, ProviderHealth, } from './core/fallback-profile-manager.js';
|
|
53
53
|
export { FallbackProfileManager } from './core/fallback-profile-manager.js';
|
|
54
54
|
export { InputBuilder, type InputBuilderEvent, type InputBuilderOptions, } from './core/input-builder.js';
|