@wrongstack/core 0.9.19 → 0.9.20
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/{agent-bridge-DMVOX0cF.d.ts → agent-bridge-Dti3KXGk.d.ts} +1 -1
- package/dist/{agent-subagent-runner-C4qt9e5Y.d.ts → agent-subagent-runner-U-rs7kk7.d.ts} +3 -4
- package/dist/compactor-D7X96RLZ.d.ts +41 -0
- package/dist/{config-CWva0qoL.d.ts → config-CLXMDOSs.d.ts} +1 -1
- package/dist/{context-BRNbHmRM.d.ts → context-zkZeILpr.d.ts} +46 -0
- package/dist/coordination/index.d.ts +13 -13
- package/dist/coordination/index.js +660 -146
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +20 -20
- package/dist/defaults/index.js +918 -350
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-CiG9qUM_.d.ts → events-DH-9r-_C.d.ts} +42 -1
- package/dist/execution/index.d.ts +41 -30
- package/dist/execution/index.js +358 -112
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/{index-aizK8olO.d.ts → index-BIHJ4uII.d.ts} +11 -8
- package/dist/{index-p95HQ22A.d.ts → index-CFO9QmJo.d.ts} +8 -8
- package/dist/index.d.ts +311 -35
- package/dist/index.js +1933 -512
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +36 -0
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-BkVEqkRe.d.ts → mcp-servers-DkESgh0G.d.ts} +25 -3
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +1 -1
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-3ZnTB1aT.d.ts → multi-agent-DNp6lAzg.d.ts} +35 -23
- package/dist/{multi-agent-coordinator-bRaI_aD1.d.ts → multi-agent-coordinator-CAhsegPz.d.ts} +20 -2
- package/dist/{null-fleet-bus-DKM3Iy9d.d.ts → null-fleet-bus-Dnl19vmf.d.ts} +411 -110
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-TcJfc29Y.d.ts → path-resolver-CHiBL0DD.d.ts} +2 -2
- package/dist/{permission-bPuzAy4x.d.ts → permission-H35s9Evv.d.ts} +1 -1
- package/dist/{permission-policy-BUQSutpl.d.ts → permission-policy-CT-nRmTn.d.ts} +2 -2
- package/dist/{plan-templates-fkQTyz3U.d.ts → plan-templates-Bs8iRwi6.d.ts} +4 -4
- package/dist/{provider-runner-BEpikbbN.d.ts → provider-runner-BZdDrWrS.d.ts} +3 -3
- package/dist/{retry-policy-BYkq0ugs.d.ts → retry-policy-J9N_PM40.d.ts} +1 -1
- package/dist/sdd/index.d.ts +9 -10
- package/dist/sdd/index.js +224 -68
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/{selector-pox8abg0.d.ts → selector-CFTh3Z6p.d.ts} +1 -1
- package/dist/{session-reader-CSWcb5Ga.d.ts → session-reader-C7JJlxOw.d.ts} +2 -2
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +390 -6
- package/dist/storage/index.js +672 -35
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-Bs-Wliab.d.ts → system-prompt-CneIxVip.d.ts} +1 -1
- package/dist/{tool-executor-Boo3dekH.d.ts → tool-executor-flTuxsqO.d.ts} +9 -4
- package/dist/types/index.d.ts +14 -14
- package/dist/types/index.js +60 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +18 -6
- package/dist/utils/index.js +61 -56
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/compactor-DVTKL7XD.d.ts +0 -23
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as Context, n as ProviderError, Q as Tool, _ as ToolUseBlock, Y as ToolResultBlock } from './context-
|
|
2
|
-
import { a as Compactor, C as CompactReport } from './compactor-
|
|
3
|
-
import { R as RecoveryDecision, E as ErrorHandler, a as RetryPolicy } from './retry-policy-
|
|
1
|
+
import { d as Context, n as ProviderError, Q as Tool, _ as ToolUseBlock, Y as ToolResultBlock } from './context-zkZeILpr.js';
|
|
2
|
+
import { a as Compactor, C as CompactReport } from './compactor-D7X96RLZ.js';
|
|
3
|
+
import { R as RecoveryDecision, E as ErrorHandler, a as RetryPolicy } from './retry-policy-J9N_PM40.js';
|
|
4
4
|
import { b as ModelsRegistry } from './models-registry-BcYJDKLm.js';
|
|
5
|
-
import {
|
|
5
|
+
import { y as ToolExecutorOptions, z as ToolExecutorStrategy, T as ToolBatchResult } from './index-BIHJ4uII.js';
|
|
6
6
|
|
|
7
7
|
interface CompactorOptions {
|
|
8
8
|
preserveK?: number;
|
|
@@ -18,6 +18,11 @@ declare class HybridCompactor implements Compactor {
|
|
|
18
18
|
compact(ctx: Context, opts?: {
|
|
19
19
|
aggressive?: boolean;
|
|
20
20
|
}): Promise<CompactReport>;
|
|
21
|
+
/**
|
|
22
|
+
* Estimate the full API request token count: messages + systemPrompt + toolDefs.
|
|
23
|
+
* This is the accurate figure for context-window pressure monitoring.
|
|
24
|
+
*/
|
|
25
|
+
private estimateFullRequest;
|
|
21
26
|
private eliseOldToolResults;
|
|
22
27
|
private collapseAncientTurns;
|
|
23
28
|
private estimateMessages;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
export { A as AgentError, a as Capabilities, b as ConfigError, c as ContentBlock, E as ERROR_CODES, g as ErrorCode, h as ErrorSeverity, i as ErrorSubsystem, F as FileSnapshot, j as FsError, I as ImageBlock, J as JSONSchema, M as Message, k as MessageRole, P as Permission, l as PluginError, m as Provider, n as ProviderError, o as ProviderErrorBody, p as Request, q as Response, r as ResumedSession, s as RiskTier, S as SessionData, v as SessionError, w as SessionEvent, x as SessionMetadata, y as SessionStore, z as SessionSummary, B as SessionWriter, H as StopReason, K as StreamEvent, T as TextBlock, L as ThinkingBlock, Q as Tool, U as ToolCallContext, V as ToolError, W as ToolFinalEvent, X as ToolProgressEvent, Y as ToolResultBlock, Z as ToolStreamEvent, _ as ToolUseBlock, $ as Usage, a0 as WrongStackError, a1 as asBlocks, a2 as asText, a4 as isAgentError, a5 as isConfigError, a6 as isFsError, a7 as isImageBlock, a8 as isPluginError, a9 as isSessionError, aa as isTextBlock, ab as isThinkingBlock, ac as isToolError, ad as isToolResultBlock, ae as isToolUseBlock, af as isWrongStackError, ag as toWrongStackError } from '../context-
|
|
2
|
-
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-
|
|
3
|
-
export { A as AutonomyConfig, C as CONTEXT_WINDOW_MODES, a as Config, b as ConfigLoader, c as ConfigStore, d as ContextConfig, e as ContextWindowAggressiveOn, f as ContextWindowConfigLike, g as ContextWindowMode, h as ContextWindowModeId, i as ContextWindowPolicy, j as ContextWindowThresholds, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, L as LogConfig, M as MCPServerConfig, P as PluginConfig, k as ProviderApiKey, l as ProviderConfig, S as SyncCategory, m as SyncConfig, T as ToolsConfig, n as formatContextWindowModeList, o as getContextWindowMode, p as isContextWindowModeId, q as listContextWindowModes, r as resolveContextWindowPolicy } from '../config-
|
|
4
|
-
export { C as CompactReport, a as Compactor } from '../compactor-
|
|
5
|
-
export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../permission-
|
|
1
|
+
export { A as AgentError, a as Capabilities, b as ConfigError, c as ContentBlock, E as ERROR_CODES, g as ErrorCode, h as ErrorSeverity, i as ErrorSubsystem, F as FileSnapshot, j as FsError, I as ImageBlock, J as JSONSchema, M as Message, k as MessageRole, P as Permission, l as PluginError, m as Provider, n as ProviderError, o as ProviderErrorBody, p as Request, q as Response, r as ResumedSession, s as RiskTier, S as SessionData, v as SessionError, w as SessionEvent, x as SessionMetadata, y as SessionStore, z as SessionSummary, B as SessionWriter, H as StopReason, K as StreamEvent, T as TextBlock, L as ThinkingBlock, Q as Tool, U as ToolCallContext, V as ToolError, W as ToolFinalEvent, X as ToolProgressEvent, Y as ToolResultBlock, Z as ToolStreamEvent, _ as ToolUseBlock, $ as Usage, a0 as WrongStackError, a1 as asBlocks, a2 as asText, a4 as isAgentError, a5 as isConfigError, a6 as isFsError, a7 as isImageBlock, a8 as isPluginError, a9 as isSessionError, aa as isTextBlock, ab as isThinkingBlock, ac as isToolError, ad as isToolResultBlock, ae as isToolUseBlock, af as isWrongStackError, ag as toWrongStackError } from '../context-zkZeILpr.js';
|
|
2
|
+
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BZdDrWrS.js';
|
|
3
|
+
export { A as AutonomyConfig, C as CONTEXT_WINDOW_MODES, a as Config, b as ConfigLoader, c as ConfigStore, d as ContextConfig, e as ContextWindowAggressiveOn, f as ContextWindowConfigLike, g as ContextWindowMode, h as ContextWindowModeId, i as ContextWindowPolicy, j as ContextWindowThresholds, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, L as LogConfig, M as MCPServerConfig, P as PluginConfig, k as ProviderApiKey, l as ProviderConfig, S as SyncCategory, m as SyncConfig, T as ToolsConfig, n as formatContextWindowModeList, o as getContextWindowMode, p as isContextWindowModeId, q as listContextWindowModes, r as resolveContextWindowPolicy } from '../config-CLXMDOSs.js';
|
|
4
|
+
export { C as CompactReport, a as Compactor } from '../compactor-D7X96RLZ.js';
|
|
5
|
+
export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../permission-H35s9Evv.js';
|
|
6
6
|
export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from '../session-rewinder-C9HnMkhP.js';
|
|
7
|
-
export { A as AddAttachmentInput, a as Attachment, b as AttachmentKind, c as AttachmentMeta, d as AttachmentRef, e as AttachmentStore, D as DefaultSessionReader } from '../session-reader-
|
|
7
|
+
export { A as AddAttachmentInput, a as Attachment, b as AttachmentKind, c as AttachmentMeta, d as AttachmentRef, e as AttachmentStore, D as DefaultSessionReader } from '../session-reader-C7JJlxOw.js';
|
|
8
8
|
export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_TOOLS_CONFIG } from '../default-config-Uzla85H-.js';
|
|
9
9
|
export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-7rSC_emZ.js';
|
|
10
10
|
export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-bOzkF5LL.js';
|
|
11
|
-
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-
|
|
11
|
+
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-CHiBL0DD.js';
|
|
12
12
|
export { M as MemoryEntry, a as MemoryScope, b as MemoryStore } from '../memory-CEXuo7sz.js';
|
|
13
|
-
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from '../tool-executor-
|
|
13
|
+
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from '../tool-executor-flTuxsqO.js';
|
|
14
14
|
export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-CxuWrsKK.js';
|
|
15
|
-
export { a as BuildContext, c as ModelCapabilities, e as Renderer, S as SystemPromptBuilder } from '../system-prompt-
|
|
15
|
+
export { a as BuildContext, c as ModelCapabilities, e as Renderer, S as SystemPromptBuilder } from '../system-prompt-CneIxVip.js';
|
|
16
16
|
export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
|
|
17
|
-
export { M as MCPRegistryView, j as MetricsSinkView, P as Plugin, k as PluginAPI, l as PluginCapabilities, m as PluginDependency, n as PluginPipelines, o as ProviderFactory, r as ProviderRegistryView, S as SessionWriterView, u as SlashCommand, v as SlashCommandRegistryView, w as SystemPromptContributor,
|
|
17
|
+
export { M as MCPRegistryView, j as MetricsSinkView, P as Plugin, k as PluginAPI, l as PluginCapabilities, m as PluginDependency, n as PluginPipelines, o as ProviderFactory, r as ProviderRegistryView, S as SessionWriterView, u as SlashCommand, v as SlashCommandRegistryView, w as SystemPromptContributor, F as ToolRegistryView } from '../index-BIHJ4uII.js';
|
|
18
18
|
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-OG_30xqZ.js';
|
|
19
19
|
export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-CV077NjV.js';
|
|
20
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
21
|
-
export { C as CoordinatorEvents, k as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, l as MultiAgentCoordinator, S as SpawnResult, n as SubagentConfig, o as SubagentContext, p as SubagentError, q as SubagentErrorKind, r as SubagentRunContext, s as SubagentRunOutcome, t as SubagentRunner, T as TaskDelegation, u as TaskResult, v as TaskSpec } from '../multi-agent-
|
|
20
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-Dti3KXGk.js';
|
|
21
|
+
export { C as CoordinatorEvents, k as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, l as MultiAgentCoordinator, S as SpawnResult, n as SubagentConfig, o as SubagentContext, p as SubagentError, q as SubagentErrorKind, r as SubagentRunContext, s as SubagentRunOutcome, t as SubagentRunner, T as TaskDelegation, u as TaskResult, v as TaskSpec } from '../multi-agent-DNp6lAzg.js';
|
|
22
22
|
export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification, T as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, l as TaskGraph, m as TaskNode, n as TaskPriority, o as TaskProgress, p as TaskSort, q as TaskStatus, r as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from '../task-graph-D1YQbpxF.js';
|
|
23
23
|
export { A as AggregateHealth, H as HealthCheck, a as HealthCheckResult, b as HealthRegistry, c as HealthStatus, M as MetricLabels, d as MetricSeries, e as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from '../observability-BhnVLBLS.js';
|
|
24
|
-
import '../events-
|
|
24
|
+
import '../events-DH-9r-_C.js';
|
|
25
25
|
import '../logger-DDd5C--Z.js';
|
|
26
|
-
import '../retry-policy-
|
|
26
|
+
import '../retry-policy-J9N_PM40.js';
|
|
27
27
|
import '../models-registry-BcYJDKLm.js';
|
|
28
28
|
import '../secret-vault-DoISxaKO.js';
|
|
29
29
|
import '../secret-scrubber-3MHDDAtm.js';
|
package/dist/types/index.js
CHANGED
|
@@ -867,6 +867,54 @@ function estimateToolResultTokens(content) {
|
|
|
867
867
|
function estimateTextTokens(text) {
|
|
868
868
|
return RoughTokenEstimate(text);
|
|
869
869
|
}
|
|
870
|
+
function estimateToolDefTokens(tool) {
|
|
871
|
+
return RoughTokenEstimate(tool.name) + RoughTokenEstimate(tool.description ?? "") + RoughTokenEstimate(JSON.stringify(tool.inputSchema));
|
|
872
|
+
}
|
|
873
|
+
function estimateRequestTokens(messages, systemPrompt, tools) {
|
|
874
|
+
let messagesTokens = 0;
|
|
875
|
+
if (typeof messages === "string") {
|
|
876
|
+
messagesTokens = RoughTokenEstimate(messages);
|
|
877
|
+
} else if (Array.isArray(messages)) {
|
|
878
|
+
for (const m of messages) {
|
|
879
|
+
if (typeof m === "object" && m !== null && "content" in m) {
|
|
880
|
+
const content = m.content;
|
|
881
|
+
if (typeof content === "string") {
|
|
882
|
+
messagesTokens += RoughTokenEstimate(content);
|
|
883
|
+
} else if (Array.isArray(content)) {
|
|
884
|
+
for (const b of content) {
|
|
885
|
+
if (typeof b === "object" && b !== null) {
|
|
886
|
+
if (b.type === "text") {
|
|
887
|
+
messagesTokens += RoughTokenEstimate(b.text);
|
|
888
|
+
} else {
|
|
889
|
+
messagesTokens += RoughTokenEstimate(JSON.stringify(b));
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
let systemTokens = 0;
|
|
898
|
+
if (typeof systemPrompt === "string") {
|
|
899
|
+
systemTokens = RoughTokenEstimate(systemPrompt);
|
|
900
|
+
} else if (Array.isArray(systemPrompt)) {
|
|
901
|
+
for (const b of systemPrompt) {
|
|
902
|
+
if (typeof b === "object" && b !== null && b.type === "text") {
|
|
903
|
+
systemTokens += RoughTokenEstimate(b.text);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
let toolsTokens = 0;
|
|
908
|
+
for (const t of tools) {
|
|
909
|
+
toolsTokens += estimateToolDefTokens(t);
|
|
910
|
+
}
|
|
911
|
+
return {
|
|
912
|
+
messages: messagesTokens,
|
|
913
|
+
systemPrompt: systemTokens,
|
|
914
|
+
tools: toolsTokens,
|
|
915
|
+
total: messagesTokens + systemTokens + toolsTokens
|
|
916
|
+
};
|
|
917
|
+
}
|
|
870
918
|
|
|
871
919
|
// src/utils/message-invariants.ts
|
|
872
920
|
function repairToolUseAdjacency(messages) {
|
|
@@ -972,6 +1020,7 @@ var HybridCompactor = class {
|
|
|
972
1020
|
}
|
|
973
1021
|
async compact(ctx, opts = {}) {
|
|
974
1022
|
const beforeTokens = this.estimateMessages(ctx.messages);
|
|
1023
|
+
const beforeFull = this.estimateFullRequest(ctx);
|
|
975
1024
|
const reductions = [];
|
|
976
1025
|
const policy = readContextWindowPolicy(ctx);
|
|
977
1026
|
const preserveK = policy?.preserveK ?? this.preserveK;
|
|
@@ -987,9 +1036,12 @@ var HybridCompactor = class {
|
|
|
987
1036
|
ctx.state.replaceMessages(repaired.messages);
|
|
988
1037
|
}
|
|
989
1038
|
const afterTokens = this.estimateMessages(ctx.messages);
|
|
1039
|
+
const afterFull = this.estimateFullRequest(ctx);
|
|
990
1040
|
return {
|
|
991
1041
|
before: beforeTokens,
|
|
992
1042
|
after: afterTokens,
|
|
1043
|
+
fullRequestTokensBefore: beforeFull,
|
|
1044
|
+
fullRequestTokensAfter: afterFull,
|
|
993
1045
|
reductions,
|
|
994
1046
|
repaired: repaired.report.changed ? {
|
|
995
1047
|
removedToolUses: repaired.report.removedToolUses,
|
|
@@ -998,6 +1050,14 @@ var HybridCompactor = class {
|
|
|
998
1050
|
} : void 0
|
|
999
1051
|
};
|
|
1000
1052
|
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Estimate the full API request token count: messages + systemPrompt + toolDefs.
|
|
1055
|
+
* This is the accurate figure for context-window pressure monitoring.
|
|
1056
|
+
*/
|
|
1057
|
+
estimateFullRequest(ctx) {
|
|
1058
|
+
const breakdown = estimateRequestTokens(ctx.messages, ctx.systemPrompt, ctx.tools ?? []);
|
|
1059
|
+
return breakdown.total;
|
|
1060
|
+
}
|
|
1001
1061
|
eliseOldToolResults(ctx, preserveK = this.preserveK, eliseThreshold = this.eliseThreshold) {
|
|
1002
1062
|
const messages = ctx.messages;
|
|
1003
1063
|
let pairCount = 0;
|