@wrongstack/core 0.273.1 → 0.274.0
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-DpKIxHhE.d.ts → agent-bridge-DFo21wmY.d.ts} +1 -1
- package/dist/{agent-subagent-runner-Dx7fZ1bE.d.ts → agent-subagent-runner-BwmkIDEd.d.ts} +7 -7
- package/dist/{brain-BDcQaku-.d.ts → brain-gfZX3the.d.ts} +1 -1
- package/dist/{provider-model-resolve-Cz6OlIOp.d.ts → codex-catalog-CooZ6mOl.d.ts} +47 -4
- package/dist/{compactor-BuSdj3fq.d.ts → compactor-riTOds0f.d.ts} +1 -1
- package/dist/{config-CR2yoG8c.d.ts → config-BxcrDzri.d.ts} +7 -1
- package/dist/{context-DulAr8Zo.d.ts → context-DERiLofu.d.ts} +36 -1
- package/dist/coordination/index.d.ts +20 -16
- package/dist/coordination/index.js +1622 -1479
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +26 -26
- package/dist/defaults/index.js +1832 -1541
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +15 -15
- package/dist/execution/index.js +2 -8
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{global-mailbox-CwcubDkA.d.ts → global-mailbox-Cr8TW4t_.d.ts} +1 -1
- package/dist/{goal-preamble-Bu0a2uCG.d.ts → goal-preamble-CEhROp1e.d.ts} +9 -9
- package/dist/{goal-store-CTmFuZ8J.d.ts → goal-store-xNSVxmpV.d.ts} +1 -1
- package/dist/hq/index.d.ts +5 -5
- package/dist/{index-CTq5wU3m.d.ts → index-00KPKAlm.d.ts} +5 -5
- package/dist/{index-CxP-HBhX.d.ts → index-pDBSBE1r.d.ts} +2 -2
- package/dist/index.d.ts +49 -43
- package/dist/index.js +1973 -1444
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/kernel/index.d.ts +11 -11
- package/dist/{mcp-servers-BQaOE71z.d.ts → mcp-servers-BIwRiOxe.d.ts} +3 -3
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +40 -2
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-BEcny4kP.d.ts → models-registry-8OorW51H.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-Bx8EFkv2.d.ts → multi-agent-coordinator-CNx48Zoz.d.ts} +1 -1
- package/dist/{null-fleet-bus-BC5ZXCQw.d.ts → null-fleet-bus-B4ZUJYL6.d.ts} +6 -6
- package/dist/observability/index.d.ts +2 -2
- package/dist/{parallel-eternal-engine-C345TI3n.d.ts → parallel-eternal-engine-rsIclDqO.d.ts} +9 -9
- package/dist/{path-resolver-C-W_wzkF.d.ts → path-resolver-BqU-fwzD.d.ts} +3 -3
- package/dist/{permission-CsBGZkxp.d.ts → permission-Dgs3v-Xq.d.ts} +1 -1
- package/dist/{permission-policy-g3Sg0GdZ.d.ts → permission-policy-Dtht2k0e.d.ts} +2 -2
- package/dist/{pipeline-xnw_24Z8.d.ts → pipeline-B-dpCFYS.d.ts} +2 -2
- package/dist/{plan-templates-DGaiYEcS.d.ts → plan-templates-B7MxyY2o.d.ts} +32 -5
- package/dist/{provider-runner-7J0HqF6B.d.ts → provider-runner-DrmpBE5l.d.ts} +3 -3
- package/dist/{retry-policy-kqXJOVkX.d.ts → retry-policy-hYxsm10a.d.ts} +1 -1
- package/dist/sdd/index.d.ts +12 -10
- package/dist/sdd/index.js +7 -0
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-CMQUr-eB.d.ts → secret-vault-DnqIFhPF.d.ts} +1 -1
- package/dist/security/index.d.ts +5 -5
- package/dist/{selector-B4r34PWR.d.ts → selector-D21RjDIg.d.ts} +1 -1
- package/dist/{session-event-bridge-BD3LoyLC.d.ts → session-event-bridge-Dt54CTvq.d.ts} +1 -1
- package/dist/{session-reader-DjrKGD9c.d.ts → session-reader-CceH13Kq.d.ts} +5 -4
- package/dist/storage/index.d.ts +46 -12
- package/dist/storage/index.js +1987 -1548
- package/dist/storage/index.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/types/index.d.ts +19 -19
- package/dist/types/index.js +134 -42
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/{worktree-manager-DHdrWQ_7.d.ts → worktree-manager-DUfBbKzk.d.ts} +1 -1
- package/package.json +1 -1
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tool } from '../context-
|
|
2
|
-
import { c as MCPServerConfig, C as Config } from '../config-
|
|
1
|
+
import { T as Tool } from '../context-DERiLofu.js';
|
|
2
|
+
import { c as MCPServerConfig, C as Config } from '../config-BxcrDzri.js';
|
|
3
3
|
import '../dispatcher-types.d-BBeXBQgS.js';
|
|
4
4
|
import 'node:https';
|
|
5
5
|
import 'undici';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export { A as AgentError, p as CacheTtl, n as Capabilities, z as ConfigError, i as ContentBlock, C as Context, B as ContextEvidenceState, D as ContextFileEvidence, E as ContextInit, F as ContextIntentEvidence, G as ContextRepeatedReadEvidence, H as ERROR_CODES, I as ErrorCode, K as ErrorSeverity, L as ErrorSubsystem, N as FileSnapshot, O as FsError, Q as ImageBlock, J as JSONSchema, V as JsonSchemaSpec, M as Message, W as MessageRole, h as Permission, X as PluginError, P as Provider, g as ProviderError, Y as ProviderErrorBody, a as ReasoningConfig, o as ReasoningEffort, R as ReasoningRequest, c as Request, _ as RequestCacheControl, d as Response, $ as ResponseFormat, u as ResumedSession, a0 as RiskTier, t as RunOptions, a2 as SafetySetting, a3 as SddError, v as SessionData, a4 as SessionError, S as SessionEvent, j as SessionMetadata, k as SessionStore, w as SessionSummary, b as SessionWriter, a7 as StopReason, a8 as StreamEvent, a9 as StreamHangError, q as TextBlock, aa as ThinkingBlock, x as TodoItem, T as Tool, ab as ToolCallContext, ac as ToolError, ad as ToolErrorCategory, ae as ToolErrorInfo, af as ToolEvidenceStatus, ag as ToolFinalEvent, ah as ToolIconId, m as ToolOutputMetadata, l as ToolProgressEvent, s as ToolResultBlock, ai as ToolStreamEvent, r as ToolUseBlock, U as Usage, aj as WrongStackError, ak as asBlocks, al as asText, an as isAgentError, ao as isConfigError, ap as isFsError, aq as isImageBlock, ar as isPluginError, as as isSddError, at as isSessionError, au as isTextBlock, av as isThinkingBlock, aw as isToolError, ax as isToolResultBlock, ay as isToolUseBlock, az as isWrongStackError, aA as toWrongStackError } from '../context-
|
|
2
|
-
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-
|
|
3
|
-
export { A as AdaptiveConcurrencyConfig, o as AutonomyConfig, p as CONTEXT_WINDOW_MODES, q as CircuitBreakerRuntimeConfig, C as Config, k as ConfigLoader, j as ConfigStore, r as ContextConfig, h as ContextWindowAggressiveOn, s as ContextWindowConfigLike, t as ContextWindowMode, u as ContextWindowModeId, i as ContextWindowPolicy, v as ContextWindowThresholds, w as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, x as DEFAULT_TUI_THINKING_WORD, E as ExecToolConfig, F as FeaturesConfig, g as HookEntry, H as HookEvent, m as HookInput, f as HookMatcher, n as HookOutcome, y as HqClientConfig, I as InProcessHook, z as IndexingConfig, L as LaunchConfig, B as LogConfig, G as MAX_TUI_THINKING_WORD_LENGTH, c as MCPServerConfig, d as ModelMatrixEntry, J as ModelRuntimeCacheConfig, K as ModelRuntimeConfig, N as ModelRuntimeParametersConfig, O as ModelRuntimeReasoningConfig, e as ModelsDevModel, a as ModelsDevPayload, Q as ModelsDevProvider, M as ModelsRegistry, U as PluginConfig, V as ProviderApiKey, P as ProviderConfig, b as ResolvedModel, R as ResolvedProvider, X as SessionLoggingConfig, S as ShellHook, Y as SyncCategory, l as SyncConfig, T as TokenSavingTier, Z as ToolDescriptionMode, _ as ToolDescriptionModeConfig, $ as ToolsConfig, W as WireFamily, a0 as formatContextWindowModeList, a1 as getContextWindowMode, a2 as isContextWindowModeId, a3 as listContextWindowModes, a4 as normalizeTokenSavingTier, a5 as normalizeTuiThinkingWord, a6 as resolveContextWindowPolicy } from '../config-
|
|
4
|
-
export { a as CompactReport, C as Compactor } from '../compactor-
|
|
5
|
-
export { a as PermissionDecision, P as PermissionPolicy, T as TrustPolicy } from '../permission-
|
|
1
|
+
export { A as AgentError, p as CacheTtl, n as Capabilities, z as ConfigError, i as ContentBlock, C as Context, B as ContextEvidenceState, D as ContextFileEvidence, E as ContextInit, F as ContextIntentEvidence, G as ContextRepeatedReadEvidence, H as ERROR_CODES, I as ErrorCode, K as ErrorSeverity, L as ErrorSubsystem, N as FileSnapshot, O as FsError, Q as ImageBlock, J as JSONSchema, V as JsonSchemaSpec, M as Message, W as MessageRole, h as Permission, X as PluginError, P as Provider, g as ProviderError, Y as ProviderErrorBody, a as ReasoningConfig, o as ReasoningEffort, R as ReasoningRequest, c as Request, _ as RequestCacheControl, d as Response, $ as ResponseFormat, u as ResumedSession, a0 as RiskTier, t as RunOptions, a2 as SafetySetting, a3 as SddError, v as SessionData, a4 as SessionError, S as SessionEvent, j as SessionMetadata, k as SessionStore, w as SessionSummary, b as SessionWriter, a7 as StopReason, a8 as StreamEvent, a9 as StreamHangError, q as TextBlock, aa as ThinkingBlock, x as TodoItem, T as Tool, ab as ToolCallContext, ac as ToolError, ad as ToolErrorCategory, ae as ToolErrorInfo, af as ToolEvidenceStatus, ag as ToolFinalEvent, ah as ToolIconId, m as ToolOutputMetadata, l as ToolProgressEvent, s as ToolResultBlock, ai as ToolStreamEvent, r as ToolUseBlock, U as Usage, aj as WrongStackError, ak as asBlocks, al as asText, an as isAgentError, ao as isConfigError, ap as isFsError, aq as isImageBlock, ar as isPluginError, as as isSddError, at as isSessionError, au as isTextBlock, av as isThinkingBlock, aw as isToolError, ax as isToolResultBlock, ay as isToolUseBlock, az as isWrongStackError, aA as toWrongStackError } from '../context-DERiLofu.js';
|
|
2
|
+
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-DrmpBE5l.js';
|
|
3
|
+
export { A as AdaptiveConcurrencyConfig, o as AutonomyConfig, p as CONTEXT_WINDOW_MODES, q as CircuitBreakerRuntimeConfig, C as Config, k as ConfigLoader, j as ConfigStore, r as ContextConfig, h as ContextWindowAggressiveOn, s as ContextWindowConfigLike, t as ContextWindowMode, u as ContextWindowModeId, i as ContextWindowPolicy, v as ContextWindowThresholds, w as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, x as DEFAULT_TUI_THINKING_WORD, E as ExecToolConfig, F as FeaturesConfig, g as HookEntry, H as HookEvent, m as HookInput, f as HookMatcher, n as HookOutcome, y as HqClientConfig, I as InProcessHook, z as IndexingConfig, L as LaunchConfig, B as LogConfig, G as MAX_TUI_THINKING_WORD_LENGTH, c as MCPServerConfig, d as ModelMatrixEntry, J as ModelRuntimeCacheConfig, K as ModelRuntimeConfig, N as ModelRuntimeParametersConfig, O as ModelRuntimeReasoningConfig, e as ModelsDevModel, a as ModelsDevPayload, Q as ModelsDevProvider, M as ModelsRegistry, U as PluginConfig, V as ProviderApiKey, P as ProviderConfig, b as ResolvedModel, R as ResolvedProvider, X as SessionLoggingConfig, S as ShellHook, Y as SyncCategory, l as SyncConfig, T as TokenSavingTier, Z as ToolDescriptionMode, _ as ToolDescriptionModeConfig, $ as ToolsConfig, W as WireFamily, a0 as formatContextWindowModeList, a1 as getContextWindowMode, a2 as isContextWindowModeId, a3 as listContextWindowModes, a4 as normalizeTokenSavingTier, a5 as normalizeTuiThinkingWord, a6 as resolveContextWindowPolicy } from '../config-BxcrDzri.js';
|
|
4
|
+
export { a as CompactReport, C as Compactor } from '../compactor-riTOds0f.js';
|
|
5
|
+
export { a as PermissionDecision, P as PermissionPolicy, T as TrustPolicy } from '../permission-Dgs3v-Xq.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, c as Attachment, d as AttachmentKind, e as AttachmentMeta, b as AttachmentRef, A as AttachmentStore, D as DefaultSessionReader } from '../session-reader-
|
|
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-CceH13Kq.js';
|
|
8
8
|
export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CIRCUIT_BREAKER_CONFIG, b as DEFAULT_CONTEXT_CONFIG, c as DEFAULT_SESSION_LOGGING_CONFIG, d as DEFAULT_SESSION_PRUNE_DAYS, e as DEFAULT_TOOLS_CONFIG } from '../default-config-BbX4ojZs.js';
|
|
9
|
-
export { a as DefaultSecretScrubber, D as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted, b as rotateConfigKeys } from '../secret-vault-
|
|
9
|
+
export { a as DefaultSecretScrubber, D as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted, b as rotateConfigKeys } from '../secret-vault-DnqIFhPF.js';
|
|
10
10
|
export { D as DefaultLogger, a as DefaultLoggerOptions, L as LogFormat, n as noOpLogger } from '../logger-DmmQhf4P.js';
|
|
11
|
-
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-
|
|
12
|
-
export { o as MEMORY_TYPE_LABELS, p as MemoryClearedPayload, q as MemoryConsolidatedPayload, b as MemoryEntry, r as MemoryForgottenPayload, s as MemoryPriority, d as MemoryRelevanceContext, t as MemoryRememberedPayload, M as MemoryScope, c as MemoryStore, u as MemoryType, S as ScoredEntry } from '../brain-
|
|
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-
|
|
11
|
+
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-BqU-fwzD.js';
|
|
12
|
+
export { o as MEMORY_TYPE_LABELS, p as MemoryClearedPayload, q as MemoryConsolidatedPayload, b as MemoryEntry, r as MemoryForgottenPayload, s as MemoryPriority, d as MemoryRelevanceContext, t as MemoryRememberedPayload, M as MemoryScope, c as MemoryStore, u as MemoryType, S as ScoredEntry } from '../brain-gfZX3the.js';
|
|
13
|
+
import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-rsIclDqO.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-rsIclDqO.js';
|
|
15
15
|
export { b as SkillEntry, S as SkillLoader, a as SkillManifest } from '../skill-DGIXCtdv.js';
|
|
16
|
-
export { B as BuildContext, b as ModelCapabilities, a as Renderer, S as SystemPromptBuilder } from '../pipeline-
|
|
16
|
+
export { B as BuildContext, b as ModelCapabilities, a as Renderer, S as SystemPromptBuilder } from '../pipeline-B-dpCFYS.js';
|
|
17
17
|
export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
|
|
18
|
-
export { K as CoordinatorEvents, C as CoordinatorStatus, D as DoneCondition, o as MCPRegistryView, r as MetricsSinkView, c as MultiAgentConfig, M as MultiAgentCoordinator, u as Plugin, P as PluginAPI, s as PluginCapabilities, t as PluginDependency, l as PluginPipelines, a1 as ProviderFactory, n as ProviderRegistryView, q as SessionWriterView, k as SlashCommand, p as SlashCommandRegistryView, e as SpawnResult, S as SubagentConfig, R as SubagentContext, U as SubagentError, V as SubagentErrorKind, W as SubagentRunContext, X as SubagentRunOutcome, d as SubagentRunner, _ as TaskDelegation, f as TaskResult, T as TaskSpec, m as ToolRegistryView } from '../agent-subagent-runner-
|
|
19
|
-
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-
|
|
18
|
+
export { K as CoordinatorEvents, C as CoordinatorStatus, D as DoneCondition, o as MCPRegistryView, r as MetricsSinkView, c as MultiAgentConfig, M as MultiAgentCoordinator, u as Plugin, P as PluginAPI, s as PluginCapabilities, t as PluginDependency, l as PluginPipelines, a1 as ProviderFactory, n as ProviderRegistryView, q as SessionWriterView, k as SlashCommand, p as SlashCommandRegistryView, e as SpawnResult, S as SubagentConfig, R as SubagentContext, U as SubagentError, V as SubagentErrorKind, W as SubagentRunContext, X as SubagentRunOutcome, d as SubagentRunner, _ as TaskDelegation, f as TaskResult, T as TaskSpec, m as ToolRegistryView } from '../agent-subagent-runner-BwmkIDEd.js';
|
|
19
|
+
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-8OorW51H.js';
|
|
20
20
|
export { D as DEFAULT_MODES, b as Mode, a as ModeConfig, c as ModeManifest, M as ModeStore } from '../mode-CZlO9iU1.js';
|
|
21
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
21
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DFo21wmY.js';
|
|
22
22
|
export { 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 } from '../spec-TBi3Jr6T.js';
|
|
23
23
|
export { C as CriticalPathResult, f as TaskAssignment, g as TaskDependency, h as TaskEdge, i as TaskFilter, d as TaskGraph, e as TaskNode, a as TaskPriority, c as TaskProgress, j as TaskSort, b as TaskStatus, T as TaskType, k as computeTaskProgress, l as findCriticalPath, t as topologicalSort } from '../task-graph-u1q9Jkyk.js';
|
|
24
24
|
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';
|
|
25
|
-
export { S as SystemPromptContributor } from '../index-
|
|
25
|
+
export { S as SystemPromptContributor } from '../index-00KPKAlm.js';
|
|
26
26
|
import '../logger-B63L5bTg.js';
|
|
27
|
-
import '../retry-policy-
|
|
27
|
+
import '../retry-policy-hYxsm10a.js';
|
|
28
28
|
import '../secret-vault-BAKpgFw_.js';
|
|
29
29
|
import '../path-resolver-CPRj4bFY.js';
|
|
30
|
-
import '../goal-store-
|
|
31
|
-
import '../multi-agent-coordinator-
|
|
30
|
+
import '../goal-store-xNSVxmpV.js';
|
|
31
|
+
import '../multi-agent-coordinator-CNx48Zoz.js';
|
|
32
32
|
import 'node:events';
|
|
33
33
|
import '../mailbox-types-Ct2hJq0P.js';
|
|
34
34
|
|
package/dist/types/index.js
CHANGED
|
@@ -60,8 +60,8 @@ async function atomicWrite(targetPath, content, opts = {}) {
|
|
|
60
60
|
}
|
|
61
61
|
let mode;
|
|
62
62
|
try {
|
|
63
|
-
const
|
|
64
|
-
mode =
|
|
63
|
+
const stat3 = await fs.stat(targetPath);
|
|
64
|
+
mode = stat3.mode & 511;
|
|
65
65
|
} catch {
|
|
66
66
|
mode = opts.mode;
|
|
67
67
|
}
|
|
@@ -299,11 +299,11 @@ function validateAgainstSchema(value, schema) {
|
|
|
299
299
|
walk(value, schema, "", errors);
|
|
300
300
|
return { ok: errors.length === 0, errors };
|
|
301
301
|
}
|
|
302
|
-
function walk(value, schema,
|
|
302
|
+
function walk(value, schema, path11, errors) {
|
|
303
303
|
if (schema.enum !== void 0) {
|
|
304
304
|
if (!schema.enum.some((e) => deepEqual(e, value))) {
|
|
305
305
|
errors.push({
|
|
306
|
-
path:
|
|
306
|
+
path: path11 || "<root>",
|
|
307
307
|
message: `expected one of ${JSON.stringify(schema.enum)}, got ${JSON.stringify(value)}`
|
|
308
308
|
});
|
|
309
309
|
return;
|
|
@@ -312,7 +312,7 @@ function walk(value, schema, path10, errors) {
|
|
|
312
312
|
if (typeof schema.type === "string") {
|
|
313
313
|
if (!checkType(value, schema.type)) {
|
|
314
314
|
errors.push({
|
|
315
|
-
path:
|
|
315
|
+
path: path11 || "<root>",
|
|
316
316
|
message: `expected ${schema.type}, got ${describeType(value)}`
|
|
317
317
|
});
|
|
318
318
|
return;
|
|
@@ -322,20 +322,20 @@ function walk(value, schema, path10, errors) {
|
|
|
322
322
|
const obj = value;
|
|
323
323
|
for (const req of schema.required ?? []) {
|
|
324
324
|
if (!(req in obj)) {
|
|
325
|
-
errors.push({ path: joinPath(
|
|
325
|
+
errors.push({ path: joinPath(path11, req), message: "required property missing" });
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
if (schema.properties) {
|
|
329
329
|
for (const [key, subSchema] of Object.entries(schema.properties)) {
|
|
330
330
|
if (key in obj) {
|
|
331
|
-
walk(obj[key], subSchema, joinPath(
|
|
331
|
+
walk(obj[key], subSchema, joinPath(path11, key), errors);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
if (schema.type === "array" && Array.isArray(value) && schema.items) {
|
|
337
337
|
for (let i = 0; i < value.length; i++) {
|
|
338
|
-
walk(value[i], schema.items, `${
|
|
338
|
+
walk(value[i], schema.items, `${path11}[${i}]`, errors);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -1947,8 +1947,8 @@ function unwrapDataKey(buf, keyFile) {
|
|
|
1947
1947
|
function checkKeyFilePermissions(keyFile) {
|
|
1948
1948
|
if (process.platform === "win32") return;
|
|
1949
1949
|
try {
|
|
1950
|
-
const
|
|
1951
|
-
const actualMode =
|
|
1950
|
+
const stat3 = fs2.statSync(keyFile);
|
|
1951
|
+
const actualMode = stat3.mode & 511;
|
|
1952
1952
|
if (actualMode !== KEY_FILE_MODE) {
|
|
1953
1953
|
console.warn(JSON.stringify({
|
|
1954
1954
|
level: "warn",
|
|
@@ -4750,7 +4750,7 @@ ${errorDetails}`,
|
|
|
4750
4750
|
"tool.name": tool.name,
|
|
4751
4751
|
"tool.mutating": tool.mutating,
|
|
4752
4752
|
"tool.permission": tool.permission,
|
|
4753
|
-
"tool.capabilities": JSON.stringify(tool.capabilities ?? []),
|
|
4753
|
+
"tool.capabilities": toolCapsForAudit.length > 0 ? JSON.stringify(tool.capabilities ?? []) : "[]",
|
|
4754
4754
|
"tool.has_dangerous_capabilities": toolCapsForAudit.length > 0
|
|
4755
4755
|
});
|
|
4756
4756
|
try {
|
|
@@ -5162,6 +5162,28 @@ var ConversationState = class {
|
|
|
5162
5162
|
this.ctx.messages.splice(this.ctx.messages.length, 0, message);
|
|
5163
5163
|
this.emit({ kind: "message_appended", message });
|
|
5164
5164
|
}
|
|
5165
|
+
/**
|
|
5166
|
+
* Append a content block to the trailing user message's content array.
|
|
5167
|
+
* Mutates only that one message (a single indexed assignment) — avoids
|
|
5168
|
+
* the O(n) array copy + token-cache re-walk that `replaceMessages()`
|
|
5169
|
+
* would do for a single-message edit. Used by the agent loop to fold
|
|
5170
|
+
* btw-notes / queued-mailbox blocks into the conversation.
|
|
5171
|
+
*
|
|
5172
|
+
* The block is folded only into a *user* message (preserves
|
|
5173
|
+
* user/assistant alternation between tool batches). Returns false when
|
|
5174
|
+
* there is no trailing user message to fold into — callers should
|
|
5175
|
+
* `appendMessage({ role: 'user', content: [block] })` instead.
|
|
5176
|
+
*/
|
|
5177
|
+
appendBlockToLastUserMessage(block) {
|
|
5178
|
+
const arr = this.ctx.messages;
|
|
5179
|
+
const last = arr[arr.length - 1];
|
|
5180
|
+
if (!last || last.role !== "user") return false;
|
|
5181
|
+
const content = typeof last.content === "string" ? [{ type: "text", text: last.content }, block] : [...last.content, block];
|
|
5182
|
+
const updated = { ...last, content, _estTokens: computeMessageTokens({ ...last, content }) };
|
|
5183
|
+
arr[arr.length - 1] = updated;
|
|
5184
|
+
this.emit({ kind: "message_updated", index: arr.length - 1, message: updated });
|
|
5185
|
+
return true;
|
|
5186
|
+
}
|
|
5165
5187
|
replaceMessages(messages) {
|
|
5166
5188
|
let hasToolBlock = false;
|
|
5167
5189
|
for (const m of messages) {
|
|
@@ -5404,26 +5426,82 @@ var Context = class {
|
|
|
5404
5426
|
return this.tokenCounter.total();
|
|
5405
5427
|
}
|
|
5406
5428
|
};
|
|
5407
|
-
|
|
5408
|
-
// src/storage/session-reader.ts
|
|
5409
|
-
var DefaultSessionReader = class {
|
|
5429
|
+
var DefaultSessionReader = class _DefaultSessionReader {
|
|
5410
5430
|
store;
|
|
5431
|
+
eventCache = /* @__PURE__ */ new Map();
|
|
5432
|
+
eventCacheMtimes = /* @__PURE__ */ new Map();
|
|
5433
|
+
static EVENT_CACHE_MAX_ENTRIES = 32;
|
|
5411
5434
|
constructor(opts) {
|
|
5412
5435
|
this.store = opts.store;
|
|
5413
5436
|
}
|
|
5437
|
+
async loadCachedSessionData(sessionId) {
|
|
5438
|
+
const storeWithPath = this.store;
|
|
5439
|
+
const rootDir = storeWithPath.dir;
|
|
5440
|
+
if (!rootDir) {
|
|
5441
|
+
return await this.store.load(sessionId);
|
|
5442
|
+
}
|
|
5443
|
+
const sessionPath = path6.join(rootDir, `${sessionId}.jsonl`);
|
|
5444
|
+
let mtimeMs = null;
|
|
5445
|
+
try {
|
|
5446
|
+
const stat3 = await fs.stat(sessionPath);
|
|
5447
|
+
mtimeMs = stat3.mtimeMs;
|
|
5448
|
+
} catch {
|
|
5449
|
+
this.eventCache.delete(sessionId);
|
|
5450
|
+
this.eventCacheMtimes.delete(sessionId);
|
|
5451
|
+
return await this.store.load(sessionId);
|
|
5452
|
+
}
|
|
5453
|
+
const cachedMtime = this.eventCacheMtimes.get(sessionId);
|
|
5454
|
+
const cachedData = this.eventCache.get(sessionId);
|
|
5455
|
+
if (cachedData && cachedMtime === mtimeMs) {
|
|
5456
|
+
this.eventCache.delete(sessionId);
|
|
5457
|
+
this.eventCacheMtimes.delete(sessionId);
|
|
5458
|
+
this.eventCache.set(sessionId, cachedData);
|
|
5459
|
+
this.eventCacheMtimes.set(sessionId, mtimeMs);
|
|
5460
|
+
return cachedData;
|
|
5461
|
+
}
|
|
5462
|
+
const data = await this.store.load(sessionId);
|
|
5463
|
+
this.eventCache.delete(sessionId);
|
|
5464
|
+
this.eventCacheMtimes.delete(sessionId);
|
|
5465
|
+
this.eventCache.set(sessionId, data);
|
|
5466
|
+
this.eventCacheMtimes.set(sessionId, mtimeMs);
|
|
5467
|
+
while (this.eventCache.size > _DefaultSessionReader.EVENT_CACHE_MAX_ENTRIES) {
|
|
5468
|
+
const oldest = this.eventCache.keys().next().value;
|
|
5469
|
+
if (oldest === void 0) break;
|
|
5470
|
+
this.eventCache.delete(oldest);
|
|
5471
|
+
this.eventCacheMtimes.delete(oldest);
|
|
5472
|
+
}
|
|
5473
|
+
if (data.metadata.endedAt) {
|
|
5474
|
+
storeWithPath.clearLoadCache?.(sessionId);
|
|
5475
|
+
}
|
|
5476
|
+
return data;
|
|
5477
|
+
}
|
|
5414
5478
|
async query(q = {}) {
|
|
5415
|
-
const
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5479
|
+
const storeWithFilter = this.store;
|
|
5480
|
+
let raw;
|
|
5481
|
+
if (typeof storeWithFilter.listFiltered === "function") {
|
|
5482
|
+
raw = await storeWithFilter.listFiltered({
|
|
5483
|
+
since: q.since,
|
|
5484
|
+
until: q.until,
|
|
5485
|
+
provider: q.provider,
|
|
5486
|
+
model: q.model,
|
|
5487
|
+
minTokens: q.minTokens,
|
|
5488
|
+
titleContains: q.titleContains,
|
|
5489
|
+
limit: q.limit
|
|
5490
|
+
});
|
|
5491
|
+
} else {
|
|
5492
|
+
const fetched = await this.store.list(q.limit ? Math.max(q.limit, 100) : 1e3);
|
|
5493
|
+
const titleNeedle = q.titleContains?.toLowerCase();
|
|
5494
|
+
raw = fetched.filter((s) => {
|
|
5495
|
+
if (q.since && s.startedAt < q.since) return false;
|
|
5496
|
+
if (q.until && s.startedAt > q.until) return false;
|
|
5497
|
+
if (q.provider && s.provider !== q.provider) return false;
|
|
5498
|
+
if (q.model && s.model !== q.model) return false;
|
|
5499
|
+
if (q.minTokens !== void 0 && s.tokenTotal < q.minTokens) return false;
|
|
5500
|
+
if (titleNeedle && !s.title.toLowerCase().includes(titleNeedle)) return false;
|
|
5501
|
+
return true;
|
|
5502
|
+
});
|
|
5503
|
+
}
|
|
5504
|
+
const out = raw.map((s) => ({
|
|
5427
5505
|
id: s.id,
|
|
5428
5506
|
title: s.title,
|
|
5429
5507
|
startedAt: s.startedAt,
|
|
@@ -5434,7 +5512,7 @@ var DefaultSessionReader = class {
|
|
|
5434
5512
|
return q.limit ? out.slice(0, q.limit) : out;
|
|
5435
5513
|
}
|
|
5436
5514
|
async *replay(sessionId) {
|
|
5437
|
-
const data = await this.
|
|
5515
|
+
const data = await this.loadCachedSessionData(sessionId);
|
|
5438
5516
|
for (const e of data.events) yield e;
|
|
5439
5517
|
}
|
|
5440
5518
|
async search(q, sessionId, sessionQuery) {
|
|
@@ -5445,18 +5523,32 @@ var DefaultSessionReader = class {
|
|
|
5445
5523
|
if (sessionId) {
|
|
5446
5524
|
ids = [sessionId];
|
|
5447
5525
|
} else {
|
|
5448
|
-
const
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5526
|
+
const storeWithFilter = this.store;
|
|
5527
|
+
let sessions;
|
|
5528
|
+
if (typeof storeWithFilter.listFiltered === "function") {
|
|
5529
|
+
sessions = await storeWithFilter.listFiltered({
|
|
5530
|
+
since: sessionQuery?.since,
|
|
5531
|
+
until: sessionQuery?.until,
|
|
5532
|
+
provider: sessionQuery?.provider,
|
|
5533
|
+
model: sessionQuery?.model,
|
|
5534
|
+
minTokens: sessionQuery?.minTokens,
|
|
5535
|
+
titleContains: sessionQuery?.titleContains,
|
|
5536
|
+
limit: 1e3
|
|
5537
|
+
});
|
|
5538
|
+
} else {
|
|
5539
|
+
sessions = await this.store.list(1e3);
|
|
5540
|
+
const titleNeedle = sessionQuery?.titleContains?.toLowerCase();
|
|
5541
|
+
sessions = sessions.filter((s) => {
|
|
5542
|
+
if (sessionQuery?.since && s.startedAt < sessionQuery.since) return false;
|
|
5543
|
+
if (sessionQuery?.until && s.startedAt > sessionQuery.until) return false;
|
|
5544
|
+
if (sessionQuery?.provider && s.provider !== sessionQuery.provider) return false;
|
|
5545
|
+
if (sessionQuery?.model && s.model !== sessionQuery.model) return false;
|
|
5546
|
+
if (sessionQuery?.minTokens !== void 0 && s.tokenTotal < sessionQuery.minTokens) return false;
|
|
5547
|
+
if (titleNeedle && !s.title.toLowerCase().includes(titleNeedle)) return false;
|
|
5548
|
+
return true;
|
|
5549
|
+
});
|
|
5550
|
+
}
|
|
5551
|
+
ids = sessions.map((s) => s.id);
|
|
5460
5552
|
}
|
|
5461
5553
|
const hits = [];
|
|
5462
5554
|
const streaming = this.store.searchEvents?.bind(this.store);
|
|
@@ -5490,7 +5582,7 @@ var DefaultSessionReader = class {
|
|
|
5490
5582
|
for (const id of ids) {
|
|
5491
5583
|
let data;
|
|
5492
5584
|
try {
|
|
5493
|
-
data = await this.
|
|
5585
|
+
data = await this.loadCachedSessionData(id);
|
|
5494
5586
|
} catch {
|
|
5495
5587
|
continue;
|
|
5496
5588
|
}
|
|
@@ -5514,7 +5606,7 @@ var DefaultSessionReader = class {
|
|
|
5514
5606
|
return hits;
|
|
5515
5607
|
}
|
|
5516
5608
|
async export(sessionId, opts) {
|
|
5517
|
-
const data = await this.
|
|
5609
|
+
const data = await this.loadCachedSessionData(sessionId);
|
|
5518
5610
|
const includeTools = opts.includeTools ?? true;
|
|
5519
5611
|
const includeDiagnostics = opts.includeDiagnostics ?? true;
|
|
5520
5612
|
const filtered = data.events.filter((e) => {
|
|
@@ -5535,7 +5627,7 @@ var DefaultSessionReader = class {
|
|
|
5535
5627
|
return renderMarkdown(data.metadata, filtered);
|
|
5536
5628
|
}
|
|
5537
5629
|
async metadata(sessionId) {
|
|
5538
|
-
const data = await this.
|
|
5630
|
+
const data = await this.loadCachedSessionData(sessionId);
|
|
5539
5631
|
return data.metadata;
|
|
5540
5632
|
}
|
|
5541
5633
|
};
|