@wrongstack/core 0.87.0 → 0.89.3
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-C9P_HPez.d.ts → agent-bridge-DbVe1dHT.d.ts} +1 -1
- package/dist/{agent-subagent-runner-2Aq0jOSj.d.ts → agent-subagent-runner-C6eqID1t.d.ts} +477 -476
- package/dist/{events-DnRqXaZ3.d.ts → brain-s9DyD_Vf.d.ts} +185 -92
- package/dist/{compactor-CJq7LQev.d.ts → compactor-DXLxLcmU.d.ts} +2 -2
- package/dist/{config-_DZ7dN-T.d.ts → config-84VaZpH6.d.ts} +45 -38
- package/dist/{context-ToHAp4-U.d.ts → context-CNRYfhUv.d.ts} +1 -1
- package/dist/coordination/index.d.ts +16 -17
- package/dist/coordination/index.js +208 -93
- package/dist/coordination/index.js.map +1 -1
- package/dist/{default-config-DEXI4jsl.d.ts → default-config-CXsDvOmP.d.ts} +3 -1
- package/dist/defaults/index.d.ts +32 -34
- package/dist/defaults/index.js +744 -274
- package/dist/defaults/index.js.map +1 -1
- package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
- package/dist/execution/index.d.ts +18 -19
- package/dist/execution/index.js +79 -64
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +9 -10
- package/dist/extension/index.js +8 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/{index-BNOLadHw.d.ts → index-CqrroYcU.d.ts} +13 -15
- package/dist/{index-N0_c4bHQ.d.ts → index-D3Nax3YU.d.ts} +11 -10
- package/dist/index.d.ts +191 -178
- package/dist/index.js +1419 -526
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +9 -9
- package/dist/infrastructure/index.js +16 -5
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +14 -16
- package/dist/kernel/index.js +17 -0
- package/dist/kernel/index.js.map +1 -1
- package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
- package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
- package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-D3E5ixAR.d.ts} +3 -3
- package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +8 -6
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
- package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-DllpCVkF.d.ts → multi-agent-coordinator-DHNrjPaA.d.ts} +2 -2
- package/dist/{null-fleet-bus-BY0AN-sr.d.ts → null-fleet-bus-BzzciAc4.d.ts} +39 -32
- package/dist/observability/index.d.ts +3 -3
- package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
- package/dist/{parallel-eternal-engine-D402RASp.d.ts → parallel-eternal-engine-CTpcrb9O.d.ts} +34 -33
- package/dist/{path-resolver-UPFTsDyD.d.ts → path-resolver-B7hgMAVe.d.ts} +3 -3
- package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
- package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
- package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-C1Ad9OjI.d.ts} +73 -73
- package/dist/{plan-templates-DRvPgkfZ.d.ts → plan-templates-CNphsz0n.d.ts} +79 -11
- package/dist/{provider-runner-COAJM8tC.d.ts → provider-runner-cqvlB_oS.d.ts} +5 -5
- package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
- package/dist/sdd/index.d.ts +12 -33
- package/dist/sdd/index.js +110 -50
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
- package/dist/security/index.d.ts +4 -5
- package/dist/security/index.js +22 -4
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
- package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-IVzs2GpE.d.ts} +1 -1
- package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
- package/dist/{skill-BJeF2DwY.d.ts → skill-BJxzIyyN.d.ts} +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +3 -9
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +134 -14
- package/dist/storage/index.js +982 -248
- package/dist/storage/index.js.map +1 -1
- package/dist/{task-graph-CikNdRTG.d.ts → task-graph-DJBqO0EY.d.ts} +1 -1
- package/dist/types/index.d.ts +26 -28
- package/dist/types/index.js +62 -37
- package/dist/types/index.js.map +1 -1
- package/dist/utils/expect-defined.d.ts +7 -0
- package/dist/utils/expect-defined.js +11 -0
- package/dist/utils/expect-defined.js.map +1 -0
- package/dist/utils/index.d.ts +11 -20
- package/dist/utils/index.js +61 -43
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/memory-CEXuo7sz.d.ts +0 -16
- package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
|
@@ -158,4 +158,4 @@ declare function computeTaskProgress(graph: TaskGraph): TaskProgress;
|
|
|
158
158
|
declare function findCriticalPath(graph: TaskGraph): CriticalPathResult;
|
|
159
159
|
declare function topologicalSort(graph: TaskGraph): string[];
|
|
160
160
|
|
|
161
|
-
export { type CriticalPathResult as C, DEFAULT_SPEC_TEMPLATE as D, type SpecAnalysis as S, type
|
|
161
|
+
export { type CriticalPathResult as C, DEFAULT_SPEC_TEMPLATE as D, type SpecAnalysis as S, type TaskGraph as T, type TaskType as a, type TaskPriority as b, type TaskNode as c, type SpecApiEndpoint as d, type SpecRequirement as e, type SpecSection as f, type SpecSectionType as g, type SpecStatus as h, type SpecTemplate as i, type SpecValidationResult as j, type Specification as k, type TaskAssignment as l, type TaskDependency as m, type TaskEdge as n, type TaskFilter as o, type TaskProgress as p, type TaskSort as q, type TaskStatus as r, computeTaskProgress as s, findCriticalPath as t, topologicalSort as u };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
export { A as AgentError,
|
|
2
|
-
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-
|
|
3
|
-
export { A as AutonomyConfig,
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { A as AgentError, k as Capabilities, u as ConfigError, g as ContentBlock, E as ERROR_CODES, w as ErrorCode, x as ErrorSeverity, y as ErrorSubsystem, F as FileSnapshot, z as FsError, I as ImageBlock, J as JSONSchema, M as Message, B as MessageRole, f as Permission, D as PluginError, P as Provider, e as ProviderError, G as ProviderErrorBody, R as Request, b as Response, p as ResumedSession, K as RiskTier, q as SessionData, N as SessionError, S as SessionEvent, h as SessionMetadata, i as SessionStore, r as SessionSummary, a as SessionWriter, V as StopReason, W as StreamEvent, l as TextBlock, X as ThinkingBlock, T as Tool, Y as ToolCallContext, Z as ToolError, _ as ToolFinalEvent, j as ToolProgressEvent, n as ToolResultBlock, $ as ToolStreamEvent, m as ToolUseBlock, U 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-CNRYfhUv.js';
|
|
2
|
+
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-cqvlB_oS.js';
|
|
3
|
+
export { A as AutonomyConfig, i as CONTEXT_WINDOW_MODES, C as Config, d as ConfigLoader, c as ConfigStore, j as ContextConfig, k as ContextWindowAggressiveOn, l as ContextWindowConfigLike, m as ContextWindowMode, n as ContextWindowModeId, o as ContextWindowPolicy, p as ContextWindowThresholds, q as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, b as HookEntry, H as HookEvent, g as HookInput, a as HookMatcher, h as HookOutcome, I as InProcessHook, r as IndexingConfig, L as LaunchConfig, s as LogConfig, M as MCPServerConfig, f as ModelMatrixEntry, P as PluginConfig, t as ProviderApiKey, u as ProviderConfig, v as SessionLoggingConfig, S as ShellHook, w as SyncCategory, e as SyncConfig, T as ToolsConfig, x as formatContextWindowModeList, y as getContextWindowMode, z as isContextWindowModeId, B as listContextWindowModes, E as resolveContextWindowPolicy } from '../config-84VaZpH6.js';
|
|
4
|
+
export { a as CompactReport, C as Compactor } from '../compactor-DXLxLcmU.js';
|
|
5
|
+
export { a as PermissionDecision, P as PermissionPolicy, T as TrustPolicy } from '../permission-BDv7z0mk.js';
|
|
6
6
|
export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from '../session-rewinder-C9HnMkhP.js';
|
|
7
|
-
export {
|
|
8
|
-
export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_SESSION_LOGGING_CONFIG, c as DEFAULT_TOOLS_CONFIG } from '../default-config-
|
|
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-
|
|
10
|
-
export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-
|
|
11
|
-
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-
|
|
12
|
-
export {
|
|
13
|
-
import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-
|
|
14
|
-
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
7
|
+
export { a as AddAttachmentInput, c as Attachment, d as AttachmentKind, e as AttachmentMeta, b as AttachmentRef, A as AttachmentStore, D as DefaultSessionReader } from '../session-reader-DDz1Ek4V.js';
|
|
8
|
+
export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_SESSION_LOGGING_CONFIG, c as DEFAULT_SESSION_PRUNE_DAYS, d as DEFAULT_TOOLS_CONFIG } from '../default-config-CXsDvOmP.js';
|
|
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-vault-DrOhc2i5.js';
|
|
10
|
+
export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-B9J5puGM.js';
|
|
11
|
+
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-B7hgMAVe.js';
|
|
12
|
+
export { p as MEMORY_TYPE_LABELS, q as MemoryClearedPayload, r as MemoryConsolidatedPayload, k as MemoryEntry, s as MemoryForgottenPayload, t as MemoryPriority, m as MemoryRelevanceContext, u as MemoryRememberedPayload, M as MemoryScope, l as MemoryStore, v as MemoryType, S as ScoredEntry } from '../brain-s9DyD_Vf.js';
|
|
13
|
+
import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-CTpcrb9O.js';
|
|
14
|
+
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-CTpcrb9O.js';
|
|
15
|
+
export { a as SkillEntry, S as SkillLoader, b as SkillManifest } from '../skill-BJxzIyyN.js';
|
|
16
|
+
export { B as BuildContext, M as ModelCapabilities, a as Renderer, S as SystemPromptBuilder } from '../pipeline-C1Ad9OjI.js';
|
|
17
17
|
export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
|
|
18
|
-
export {
|
|
19
|
-
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-
|
|
20
|
-
export { D as DEFAULT_MODES,
|
|
21
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
22
|
-
export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis,
|
|
23
|
-
export { A as AggregateHealth,
|
|
24
|
-
export { S as SystemPromptContributor } from '../index-
|
|
25
|
-
import '../
|
|
26
|
-
import '../
|
|
27
|
-
import '../
|
|
28
|
-
import '../models-registry-Be3osGt5.js';
|
|
18
|
+
export { N as CoordinatorEvents, C as CoordinatorStatus, O as DoneCondition, H as MCPRegistryView, K as MetricsSinkView, c as MultiAgentConfig, M as MultiAgentCoordinator, L as Plugin, P as PluginAPI, Q as PluginCapabilities, R as PluginDependency, D as PluginPipelines, _ as ProviderFactory, G as ProviderRegistryView, J as SessionWriterView, z as SlashCommand, I as SlashCommandRegistryView, e as SpawnResult, S as SubagentConfig, U as SubagentContext, V as SubagentError, W as SubagentErrorKind, X as SubagentRunContext, Y as SubagentRunOutcome, d as SubagentRunner, Z as TaskDelegation, f as TaskResult, T as TaskSpec, E as ToolRegistryView } from '../agent-subagent-runner-C6eqID1t.js';
|
|
19
|
+
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DU64QxQa.js';
|
|
20
|
+
export { D as DEFAULT_MODES, a as Mode, b as ModeConfig, c as ModeManifest, M as ModeStore } from '../mode-ARA3HrkY.js';
|
|
21
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DbVe1dHT.js';
|
|
22
|
+
export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, d as SpecApiEndpoint, e as SpecRequirement, f as SpecSection, g as SpecSectionType, h as SpecStatus, i as SpecTemplate, j as SpecValidationResult, k as Specification, l as TaskAssignment, m as TaskDependency, n as TaskEdge, o as TaskFilter, T as TaskGraph, c as TaskNode, b as TaskPriority, p as TaskProgress, q as TaskSort, r as TaskStatus, a as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from '../task-graph-DJBqO0EY.js';
|
|
23
|
+
export { A as AggregateHealth, a as HealthCheck, b as HealthCheckResult, H as HealthRegistry, c as HealthStatus, d as MetricLabels, e as MetricSeries, M as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from '../observability-D-HZN_mF.js';
|
|
24
|
+
export { S as SystemPromptContributor } from '../index-D3Nax3YU.js';
|
|
25
|
+
import '../logger-B63L5bTg.js';
|
|
26
|
+
import '../retry-policy-BcmuT_V0.js';
|
|
27
|
+
import '../models-registry-B6_KfS65.js';
|
|
29
28
|
import '../secret-vault-DoISxaKO.js';
|
|
30
|
-
import '../secret-scrubber-3MHDDAtm.js';
|
|
31
29
|
import '../path-resolver-CPRj4bFY.js';
|
|
32
30
|
import '../goal-store-DvWLNu52.js';
|
|
33
|
-
import '../multi-agent-coordinator-
|
|
31
|
+
import '../multi-agent-coordinator-DHNrjPaA.js';
|
|
34
32
|
import 'node:events';
|
|
35
33
|
|
|
36
34
|
/** Union of serial and parallel autonomy engine stage types (from EternalAutonomyEngine / ParallelEternalEngine). */
|
package/dist/types/index.js
CHANGED
|
@@ -326,6 +326,7 @@ var DEFAULT_SESSION_LOGGING_CONFIG = Object.freeze({
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
|
+
var DEFAULT_SESSION_PRUNE_DAYS = 30;
|
|
329
330
|
|
|
330
331
|
// src/types/secret-vault.ts
|
|
331
332
|
var ENCRYPTED_PREFIX = "enc:v1:";
|
|
@@ -547,9 +548,18 @@ async function restrictFilePermissions(filePath, opts) {
|
|
|
547
548
|
const { execFile } = await import('child_process');
|
|
548
549
|
const { promisify } = await import('util');
|
|
549
550
|
const execFileAsync = promisify(execFile);
|
|
550
|
-
|
|
551
|
+
const user = windowsAccountName();
|
|
552
|
+
if (!user) {
|
|
553
|
+
warn(
|
|
554
|
+
`[secret-vault] Could not determine the current Windows user for ${filePath}; skipping icacls hardening.`
|
|
555
|
+
);
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
await execFileAsync("icacls", [filePath, "/inheritance:r", "/grant:r", `${user}:(F)`]);
|
|
551
559
|
} catch {
|
|
552
|
-
warn(
|
|
560
|
+
warn(
|
|
561
|
+
`[secret-vault] Could not restrict permissions on ${filePath} \u2014 config file may be readable by other users on this system.`
|
|
562
|
+
);
|
|
553
563
|
}
|
|
554
564
|
} else {
|
|
555
565
|
try {
|
|
@@ -558,6 +568,13 @@ async function restrictFilePermissions(filePath, opts) {
|
|
|
558
568
|
}
|
|
559
569
|
}
|
|
560
570
|
}
|
|
571
|
+
function windowsAccountName() {
|
|
572
|
+
const username = process.env.USERNAME || process.env.USER;
|
|
573
|
+
if (!username || username.includes("\0")) return void 0;
|
|
574
|
+
const domain = process.env.USERDOMAIN;
|
|
575
|
+
if (domain && !domain.includes("\0")) return `${domain}\\${username}`;
|
|
576
|
+
return username;
|
|
577
|
+
}
|
|
561
578
|
function walkCount(node, vault, counter) {
|
|
562
579
|
if (node === null || node === void 0) return node;
|
|
563
580
|
if (typeof node !== "object") return node;
|
|
@@ -618,10 +635,15 @@ function writeErr(s, stream = process.stderr) {
|
|
|
618
635
|
|
|
619
636
|
// src/utils/color.ts
|
|
620
637
|
var isColorTty = () => {
|
|
621
|
-
if (process.env.NO_COLOR) return false;
|
|
622
|
-
if (process.env.FORCE_COLOR) return true;
|
|
638
|
+
if (envFlag(process.env.NO_COLOR)) return false;
|
|
639
|
+
if (envFlag(process.env.FORCE_COLOR)) return true;
|
|
623
640
|
return isStdoutTTY();
|
|
624
641
|
};
|
|
642
|
+
function envFlag(value) {
|
|
643
|
+
if (value === void 0) return false;
|
|
644
|
+
if (value.trim() === "") return false;
|
|
645
|
+
return !/^(0|false|no|off)$/i.test(value.trim());
|
|
646
|
+
}
|
|
625
647
|
var COLOR = isColorTty();
|
|
626
648
|
var wrap = (open2, close) => (s) => COLOR ? `\x1B[${open2}m${s}\x1B[${close}m` : s;
|
|
627
649
|
var color = {
|
|
@@ -658,6 +680,7 @@ var COLORS = {
|
|
|
658
680
|
debug: color.gray,
|
|
659
681
|
trace: color.dim
|
|
660
682
|
};
|
|
683
|
+
var LOG_LEVELS = /* @__PURE__ */ new Set(["error", "warn", "info", "debug", "trace"]);
|
|
661
684
|
var DefaultLogger = class _DefaultLogger {
|
|
662
685
|
level;
|
|
663
686
|
file;
|
|
@@ -665,7 +688,7 @@ var DefaultLogger = class _DefaultLogger {
|
|
|
665
688
|
pretty;
|
|
666
689
|
stderr;
|
|
667
690
|
constructor(opts = {}) {
|
|
668
|
-
this.level = opts.level ?? process.env.WRONGSTACK_LOG_LEVEL
|
|
691
|
+
this.level = opts.level ?? parseLogLevel(process.env.WRONGSTACK_LOG_LEVEL);
|
|
669
692
|
this.file = opts.file;
|
|
670
693
|
this.bindings = opts.bindings ?? {};
|
|
671
694
|
this.pretty = opts.pretty ?? true;
|
|
@@ -730,6 +753,9 @@ var DefaultLogger = class _DefaultLogger {
|
|
|
730
753
|
}
|
|
731
754
|
}
|
|
732
755
|
};
|
|
756
|
+
function parseLogLevel(raw) {
|
|
757
|
+
return raw && LOG_LEVELS.has(raw) ? raw : "info";
|
|
758
|
+
}
|
|
733
759
|
function formatCtx(ctx) {
|
|
734
760
|
if (ctx instanceof Error) return color.dim(ctx.message);
|
|
735
761
|
if (typeof ctx === "string") return color.dim(ctx);
|
|
@@ -866,13 +892,25 @@ function round4(n) {
|
|
|
866
892
|
return Math.round(n * 1e4) / 1e4;
|
|
867
893
|
}
|
|
868
894
|
|
|
869
|
-
// src/
|
|
870
|
-
|
|
895
|
+
// src/types/memory.ts
|
|
896
|
+
var MEMORY_TYPE_LABELS = {
|
|
897
|
+
fact: "Fact",
|
|
898
|
+
decision: "Decision",
|
|
899
|
+
convention: "Convention",
|
|
900
|
+
preference: "Preference",
|
|
901
|
+
reference: "Reference",
|
|
902
|
+
anti_pattern: "Anti-pattern"
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
// src/utils/expect-defined.ts
|
|
906
|
+
function expectDefined(value, label) {
|
|
871
907
|
if (value === null || value === void 0) {
|
|
872
908
|
throw new Error("Expected value to be defined");
|
|
873
909
|
}
|
|
874
910
|
return value;
|
|
875
911
|
}
|
|
912
|
+
|
|
913
|
+
// src/utils/token-estimate.ts
|
|
876
914
|
var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
|
|
877
915
|
var ESTIMATE_CACHE = /* @__PURE__ */ new Map();
|
|
878
916
|
var ESTIMATE_CACHE_MAX_SIZE = 1e4;
|
|
@@ -956,12 +994,6 @@ function estimateRequestTokens(messages, systemPrompt, tools) {
|
|
|
956
994
|
}
|
|
957
995
|
|
|
958
996
|
// src/utils/message-invariants.ts
|
|
959
|
-
function expectDefined2(value) {
|
|
960
|
-
if (value === null || value === void 0) {
|
|
961
|
-
throw new Error("Expected value to be defined");
|
|
962
|
-
}
|
|
963
|
-
return value;
|
|
964
|
-
}
|
|
965
997
|
function repairToolUseAdjacency(messages) {
|
|
966
998
|
const removedToolUses = [];
|
|
967
999
|
const removedToolResults = [];
|
|
@@ -969,7 +1001,7 @@ function repairToolUseAdjacency(messages) {
|
|
|
969
1001
|
let changed = false;
|
|
970
1002
|
const out = [];
|
|
971
1003
|
for (let i = 0; i < messages.length; i++) {
|
|
972
|
-
const original =
|
|
1004
|
+
const original = expectDefined(messages[i]);
|
|
973
1005
|
let msg = original;
|
|
974
1006
|
if (hasToolUse(msg)) {
|
|
975
1007
|
const nextIds = toolResultIds(messages[i + 1]);
|
|
@@ -2124,12 +2156,6 @@ Remember: your job is to make the user a better developer, not just to complete
|
|
|
2124
2156
|
];
|
|
2125
2157
|
|
|
2126
2158
|
// src/types/context-window.ts
|
|
2127
|
-
function expectDefined3(value) {
|
|
2128
|
-
if (value === null || value === void 0) {
|
|
2129
|
-
throw new Error("Expected value to be defined");
|
|
2130
|
-
}
|
|
2131
|
-
return value;
|
|
2132
|
-
}
|
|
2133
2159
|
var DEFAULT_CONTEXT_WINDOW_MODE_ID = "balanced";
|
|
2134
2160
|
var CONTEXT_WINDOW_MODES = Object.freeze([
|
|
2135
2161
|
{
|
|
@@ -2186,7 +2212,7 @@ function isContextWindowModeId(id) {
|
|
|
2186
2212
|
}
|
|
2187
2213
|
function resolveContextWindowPolicy(config = {}, overrideMode) {
|
|
2188
2214
|
const requested = overrideMode ?? config.mode ?? DEFAULT_CONTEXT_WINDOW_MODE_ID;
|
|
2189
|
-
const mode = getContextWindowMode(requested) ??
|
|
2215
|
+
const mode = getContextWindowMode(requested) ?? expectDefined(getContextWindowMode(DEFAULT_CONTEXT_WINDOW_MODE_ID));
|
|
2190
2216
|
if (mode.id !== DEFAULT_CONTEXT_WINDOW_MODE_ID) {
|
|
2191
2217
|
return mode;
|
|
2192
2218
|
}
|
|
@@ -2643,17 +2669,12 @@ function createToolOutputSerializer(opts = {}) {
|
|
|
2643
2669
|
}
|
|
2644
2670
|
|
|
2645
2671
|
// src/execution/tool-executor.ts
|
|
2646
|
-
function expectDefined4(value) {
|
|
2647
|
-
if (value === null || value === void 0) {
|
|
2648
|
-
throw new Error("Expected value to be defined");
|
|
2649
|
-
}
|
|
2650
|
-
return value;
|
|
2651
|
-
}
|
|
2652
2672
|
var ToolExecutor = class {
|
|
2653
2673
|
constructor(registry, opts) {
|
|
2654
2674
|
this.registry = registry;
|
|
2655
2675
|
this.opts = opts;
|
|
2656
2676
|
this.iterationTimeoutMs = opts.iterationTimeoutMs ?? 3e5;
|
|
2677
|
+
this.maxToolTimeoutMs = opts.maxToolTimeoutMs ?? 3e5;
|
|
2657
2678
|
this.serializer = createToolOutputSerializer({
|
|
2658
2679
|
perIterationOutputCapBytes: opts.perIterationOutputCapBytes ?? 1e5
|
|
2659
2680
|
});
|
|
@@ -2662,6 +2683,7 @@ var ToolExecutor = class {
|
|
|
2662
2683
|
opts;
|
|
2663
2684
|
serializer;
|
|
2664
2685
|
iterationTimeoutMs;
|
|
2686
|
+
maxToolTimeoutMs;
|
|
2665
2687
|
/**
|
|
2666
2688
|
* Clear the interactive confirm awaiter so the executor returns
|
|
2667
2689
|
* `ToolConfirmPendingResult` instead of blocking on stdin. Used by
|
|
@@ -2899,7 +2921,10 @@ ${post.additionalContext}` };
|
|
|
2899
2921
|
if (parentSignal.reason instanceof Error) throw parentSignal.reason;
|
|
2900
2922
|
throw new Error(typeof parentSignal.reason === "string" ? parentSignal.reason : "aborted");
|
|
2901
2923
|
}
|
|
2902
|
-
const timeoutMs =
|
|
2924
|
+
const timeoutMs = clampTimeoutMs(
|
|
2925
|
+
tool.timeoutMs ?? this.iterationTimeoutMs,
|
|
2926
|
+
this.maxToolTimeoutMs
|
|
2927
|
+
);
|
|
2903
2928
|
const ctrl = new AbortController();
|
|
2904
2929
|
const timer = setTimeout(() => ctrl.abort(new Error("tool timeout")), timeoutMs);
|
|
2905
2930
|
const combined = AbortSignal.any([parentSignal, ctrl.signal]);
|
|
@@ -3034,6 +3059,12 @@ ${excerpt}`;
|
|
|
3034
3059
|
return void 0;
|
|
3035
3060
|
}
|
|
3036
3061
|
};
|
|
3062
|
+
function clampTimeoutMs(timeoutMs, maxTimeoutMs) {
|
|
3063
|
+
const fallback = 3e5;
|
|
3064
|
+
const finiteTimeout = Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : fallback;
|
|
3065
|
+
const finiteMax = Number.isFinite(maxTimeoutMs) && maxTimeoutMs > 0 ? maxTimeoutMs : fallback;
|
|
3066
|
+
return Math.max(1, Math.min(finiteTimeout, finiteMax));
|
|
3067
|
+
}
|
|
3037
3068
|
var MALFORMED_ARG_MARKERS = ["__raw", "__raw_arguments", "_raw"];
|
|
3038
3069
|
function hasMalformedArguments(input) {
|
|
3039
3070
|
if (!input || typeof input !== "object" || Array.isArray(input)) return false;
|
|
@@ -3044,7 +3075,7 @@ function hasMalformedArguments(input) {
|
|
|
3044
3075
|
function extractMalformedRaw(input) {
|
|
3045
3076
|
if (!hasMalformedArguments(input)) return void 0;
|
|
3046
3077
|
const obj = input;
|
|
3047
|
-
const value = obj[
|
|
3078
|
+
const value = obj[expectDefined(Object.keys(obj)[0])];
|
|
3048
3079
|
if (value === void 0 || value === null) return void 0;
|
|
3049
3080
|
if (typeof value === "string") return value;
|
|
3050
3081
|
try {
|
|
@@ -3091,12 +3122,6 @@ function compileUserRegex(pattern, flags) {
|
|
|
3091
3122
|
}
|
|
3092
3123
|
|
|
3093
3124
|
// src/storage/session-reader.ts
|
|
3094
|
-
function expectDefined5(value) {
|
|
3095
|
-
if (value === null || value === void 0) {
|
|
3096
|
-
throw new Error("Expected value to be defined");
|
|
3097
|
-
}
|
|
3098
|
-
return value;
|
|
3099
|
-
}
|
|
3100
3125
|
var DefaultSessionReader = class {
|
|
3101
3126
|
store;
|
|
3102
3127
|
constructor(opts) {
|
|
@@ -3158,7 +3183,7 @@ var DefaultSessionReader = class {
|
|
|
3158
3183
|
continue;
|
|
3159
3184
|
}
|
|
3160
3185
|
for (let i = 0; i < data.events.length; i++) {
|
|
3161
|
-
const ev =
|
|
3186
|
+
const ev = expectDefined(data.events[i]);
|
|
3162
3187
|
if (allowedTypes && !allowedTypes.has(ev.type)) continue;
|
|
3163
3188
|
const text = eventText(ev);
|
|
3164
3189
|
if (text === null) continue;
|
|
@@ -3372,6 +3397,6 @@ function renderPlainText(meta, events) {
|
|
|
3372
3397
|
return lines.join("\n");
|
|
3373
3398
|
}
|
|
3374
3399
|
|
|
3375
|
-
export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SPEC_TEMPLATE, DEFAULT_TOOLS_CONFIG, DefaultErrorHandler, DefaultLogger, DefaultModelsRegistry, DefaultPathResolver, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultTokenCounter, ERROR_CODES, FsError, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, PluginError, ProviderError, SessionError, ToolError, ToolExecutor, WrongStackError, asBlocks, asText, buildRecoveryStrategies, classifyFamily, computeTaskProgress, createMessage, decryptConfigSecrets, encryptConfigSecrets, findCriticalPath, formatContextWindowModeList, getContextWindowMode, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, migratePlaintextSecrets, resolveContextWindowPolicy, rewriteConfigEncrypted, toWrongStackError, topologicalSort };
|
|
3400
|
+
export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SESSION_PRUNE_DAYS, DEFAULT_SPEC_TEMPLATE, DEFAULT_TOOLS_CONFIG, DefaultErrorHandler, DefaultLogger, DefaultModelsRegistry, DefaultPathResolver, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultTokenCounter, ERROR_CODES, FsError, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, MEMORY_TYPE_LABELS, PluginError, ProviderError, SessionError, ToolError, ToolExecutor, WrongStackError, asBlocks, asText, buildRecoveryStrategies, classifyFamily, computeTaskProgress, createMessage, decryptConfigSecrets, encryptConfigSecrets, findCriticalPath, formatContextWindowModeList, getContextWindowMode, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, migratePlaintextSecrets, resolveContextWindowPolicy, rewriteConfigEncrypted, toWrongStackError, topologicalSort };
|
|
3376
3401
|
//# sourceMappingURL=index.js.map
|
|
3377
3402
|
//# sourceMappingURL=index.js.map
|