@wrongstack/core 0.148.0 → 0.155.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.
Files changed (50) hide show
  1. package/dist/{agent-bridge-r9y6gdn4.d.ts → agent-bridge-BbZU5TPN.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-1GeQE_L0.d.ts → agent-subagent-runner-Bsueu0J2.d.ts} +2 -2
  3. package/dist/{brain-Cp_3GIS2.d.ts → brain-CS_B0vIE.d.ts} +2 -0
  4. package/dist/coordination/index.d.ts +7 -7
  5. package/dist/coordination/index.js +143 -6
  6. package/dist/coordination/index.js.map +1 -1
  7. package/dist/defaults/index.d.ts +13 -13
  8. package/dist/defaults/index.js +223 -65
  9. package/dist/defaults/index.js.map +1 -1
  10. package/dist/execution/index.d.ts +6 -6
  11. package/dist/execution/index.js +143 -6
  12. package/dist/execution/index.js.map +1 -1
  13. package/dist/extension/index.d.ts +2 -2
  14. package/dist/{goal-preamble-CYJLg0wk.d.ts → goal-preamble-CbV8pXLD.d.ts} +3 -3
  15. package/dist/{index-CPweVoFM.d.ts → index-B5wz-GXm.d.ts} +1 -1
  16. package/dist/{index-BZdezm3g.d.ts → index-CI1hRfPt.d.ts} +2 -2
  17. package/dist/index.d.ts +22 -22
  18. package/dist/index.js +233 -70
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +3 -3
  21. package/dist/infrastructure/index.js +11 -2
  22. package/dist/infrastructure/index.js.map +1 -1
  23. package/dist/kernel/index.d.ts +3 -3
  24. package/dist/kernel/index.js.map +1 -1
  25. package/dist/{mcp-servers-Bl5LTvQg.d.ts → mcp-servers-CPERR2De.d.ts} +8 -1
  26. package/dist/{multi-agent-coordinator-QWEzJDlm.d.ts → multi-agent-coordinator-BSKSFNhv.d.ts} +1 -1
  27. package/dist/{null-fleet-bus-BUyfqh23.d.ts → null-fleet-bus-CGOez8Le.d.ts} +4 -4
  28. package/dist/observability/index.d.ts +1 -1
  29. package/dist/{parallel-eternal-engine-C75QuhAI.d.ts → parallel-eternal-engine-CYoTKjsz.d.ts} +4 -4
  30. package/dist/{path-resolver-DRjQBkoO.d.ts → path-resolver-DuhlmPil.d.ts} +1 -1
  31. package/dist/{plan-templates-CkKNPU3I.d.ts → plan-templates-DbH7lg-t.d.ts} +2 -2
  32. package/dist/{provider-runner-BNpuIyOL.d.ts → provider-runner-Cocq0O9E.d.ts} +1 -1
  33. package/dist/sdd/index.d.ts +3 -3
  34. package/dist/sdd/index.js +143 -6
  35. package/dist/sdd/index.js.map +1 -1
  36. package/dist/{secret-vault-DoISxaKO.d.ts → secret-vault-BJDY28ev.d.ts} +7 -1
  37. package/dist/{secret-vault-BTcC_T5v.d.ts → secret-vault-w8MbUe2Q.d.ts} +1 -1
  38. package/dist/security/index.d.ts +2 -2
  39. package/dist/security/index.js +59 -22
  40. package/dist/security/index.js.map +1 -1
  41. package/dist/storage/index.d.ts +5 -5
  42. package/dist/storage/index.js +76 -42
  43. package/dist/storage/index.js.map +1 -1
  44. package/dist/types/index.d.ts +11 -11
  45. package/dist/types/index.js +59 -22
  46. package/dist/types/index.js.map +1 -1
  47. package/dist/utils/index.d.ts +65 -1
  48. package/dist/utils/index.js +61 -2
  49. package/dist/utils/index.js.map +1 -1
  50. package/package.json +1 -1
@@ -1,34 +1,34 @@
1
1
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-B9J5puGM.js';
2
- export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, J as removePlanItem, K as runConfigMigrations, L as savePlan, N as saveTodosCheckpoint, O as setPlanItemStatus } from '../plan-templates-CkKNPU3I.js';
2
+ export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, J as removePlanItem, K as runConfigMigrations, L as savePlan, N as saveTodosCheckpoint, O as setPlanItemStatus } from '../plan-templates-DbH7lg-t.js';
3
3
  export { D as DefaultSessionReader } from '../session-reader-BAtCxdaw.js';
4
4
  export { A as AuditLevel, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from '../session-event-bridge-DWlvglC2.js';
5
5
  export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BfeCUbmk.js';
6
- 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-BTcC_T5v.js';
6
+ 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-w8MbUe2Q.js';
7
7
  export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-8-6zBmfA.js';
8
- export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-C75QuhAI.js';
9
- export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from '../goal-preamble-CYJLg0wk.js';
10
- import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BNpuIyOL.js';
8
+ export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-CYoTKjsz.js';
9
+ export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from '../goal-preamble-CbV8pXLD.js';
10
+ import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-Cocq0O9E.js';
11
11
  import { b as Response } from '../context-C7G_MtLV.js';
12
- export { a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-BUyfqh23.js';
13
- export { b as AgentBudgetTier, c as AgentCapability, A as AgentDefinition, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-QWEzJDlm.js';
14
- export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-1GeQE_L0.js';
15
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-r9y6gdn4.js';
12
+ export { a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-CGOez8Le.js';
13
+ export { b as AgentBudgetTier, c as AgentCapability, A as AgentDefinition, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-BSKSFNhv.js';
14
+ export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-Bsueu0J2.js';
15
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-BbZU5TPN.js';
16
16
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-D90K9UnM.js';
17
17
  export { D as DefaultModeStore, L as LLMSelector, a as LLMSelectorOptions, M as ModeLoaderOptions, l as loadProjectModes, b as loadUserModes } from '../llm-selector-CP72f1lC.js';
18
18
  export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, RunResult, SPEC_TEMPLATES, SddParallelRun, SddParallelRunOptions, SddProgress, SddTaskDecomposer, SddTaskDecomposerOptions, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskBatch, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, WaveResult, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from '../sdd/index.js';
19
19
  export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from '../observability/index.js';
20
- export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, p as slackServer, z as zaiVisionServer } from '../mcp-servers-Bl5LTvQg.js';
20
+ export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, q as slackServer, z as zaiVisionServer } from '../mcp-servers-CPERR2De.js';
21
21
  export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, d as DEFAULT_TOOLS_CONFIG } from '../default-config-CXsDvOmP.js';
22
22
  import '../logger-B63L5bTg.js';
23
- import '../brain-Cp_3GIS2.js';
23
+ import '../brain-CS_B0vIE.js';
24
24
  import '../permission-B7nKnEvQ.js';
25
25
  import '../wstack-paths-DD50Omgn.js';
26
26
  import '../config-BaVThgnT.js';
27
- import '../secret-vault-DoISxaKO.js';
27
+ import '../secret-vault-BJDY28ev.js';
28
28
  import '../input-reader-E-ffP2ee.js';
29
29
  import '../retry-policy-rutAfVeR.js';
30
30
  import '../compactor-BueGt7LG.js';
31
- import '../index-CPweVoFM.js';
31
+ import '../index-B5wz-GXm.js';
32
32
  import '../pipeline-BG7UgbDc.js';
33
33
  import '../observability-D-HZN_mF.js';
34
34
  import '../goal-store-CV9Yz2X_.js';
@@ -1502,7 +1502,7 @@ var FileMemoryBackend = class {
1502
1502
  const line = `
1503
1503
  - [${entry.ts}] ${id}${meta} ${entry.text.replace(/\n/g, " ")}
1504
1504
  `;
1505
- const next = existing.trim() ? existing.replace(/\n+$/, "") + line : `# WrongStack Memory
1505
+ const next = existing.trim() ? existing.replace(/\n+$/, "") + line : `# Agent Memory
1506
1506
  ${line}`;
1507
1507
  await atomicWrite(file, next);
1508
1508
  }
@@ -1988,6 +1988,67 @@ var ENCRYPTED_PREFIX = "enc:v1:";
1988
1988
 
1989
1989
  // src/security/secret-vault.ts
1990
1990
  init_atomic_write();
1991
+
1992
+ // src/utils/deep-merge.ts
1993
+ var FORBIDDEN_PROTO_KEYS = /* @__PURE__ */ new Set([
1994
+ "__proto__",
1995
+ "constructor",
1996
+ "prototype",
1997
+ "__defineGetter__",
1998
+ "__defineSetter__",
1999
+ "__lookupGetter__",
2000
+ "__lookupSetter__"
2001
+ ]);
2002
+ function isPrimitiveArray(a) {
2003
+ return a.every((v) => v === null || typeof v !== "object" && typeof v !== "function");
2004
+ }
2005
+ function deepMerge(base, patch, options = {}) {
2006
+ const {
2007
+ conflictResolution = "prefer-patch",
2008
+ arrayMode = "replace",
2009
+ protectProto = true,
2010
+ onNonPrimitiveArrayReplace
2011
+ } = options;
2012
+ if (typeof base !== "object" || base === null) {
2013
+ return conflictResolution === "prefer-patch" ? patch : base;
2014
+ }
2015
+ if (typeof patch !== "object" || patch === null) {
2016
+ return conflictResolution === "prefer-patch" ? patch : base;
2017
+ }
2018
+ if (Array.isArray(base) && Array.isArray(patch)) {
2019
+ if (arrayMode === "concat-primitives" && isPrimitiveArray(base) && isPrimitiveArray(patch)) {
2020
+ return [.../* @__PURE__ */ new Set([...base, ...patch])];
2021
+ }
2022
+ return conflictResolution === "prefer-patch" ? patch : base;
2023
+ }
2024
+ if (Array.isArray(base) || Array.isArray(patch)) {
2025
+ return conflictResolution === "prefer-patch" ? patch : base;
2026
+ }
2027
+ const baseObj = base;
2028
+ const patchObj = patch;
2029
+ const out = { ...baseObj };
2030
+ for (const [k, v] of Object.entries(patchObj)) {
2031
+ if (protectProto && FORBIDDEN_PROTO_KEYS.has(k)) continue;
2032
+ const existing = out[k];
2033
+ if (v !== null && typeof v === "object" && !Array.isArray(v) && existing !== null && typeof existing === "object" && !Array.isArray(existing)) {
2034
+ out[k] = deepMerge(existing, v, options);
2035
+ } else if (Array.isArray(v) && Array.isArray(existing)) {
2036
+ if (onNonPrimitiveArrayReplace && !isPrimitiveArray(v)) {
2037
+ onNonPrimitiveArrayReplace(k, existing.length, v.length);
2038
+ }
2039
+ out[k] = deepMerge(existing, v, options);
2040
+ } else if (v !== void 0) {
2041
+ if (onNonPrimitiveArrayReplace && Array.isArray(v) && !isPrimitiveArray(v)) {
2042
+ const existingLen = Array.isArray(existing) ? existing.length : 0;
2043
+ onNonPrimitiveArrayReplace(k, existingLen, v.length);
2044
+ }
2045
+ out[k] = v;
2046
+ }
2047
+ }
2048
+ return out;
2049
+ }
2050
+
2051
+ // src/security/secret-vault.ts
1991
2052
  var KEY_BYTES = 32;
1992
2053
  var IV_BYTES = 12;
1993
2054
  var TAG_BYTES = 16;
@@ -2189,28 +2250,6 @@ function walkCount(node, vault, counter) {
2189
2250
  }
2190
2251
  return out;
2191
2252
  }
2192
- var FORBIDDEN_PROTO_KEYS = /* @__PURE__ */ new Set([
2193
- "__proto__",
2194
- "constructor",
2195
- "prototype",
2196
- "__defineGetter__",
2197
- "__defineSetter__",
2198
- "__lookupGetter__",
2199
- "__lookupSetter__"
2200
- ]);
2201
- function deepMerge(a, b) {
2202
- const out = { ...a };
2203
- for (const [k, v] of Object.entries(b)) {
2204
- if (FORBIDDEN_PROTO_KEYS.has(k)) continue;
2205
- const existing = out[k];
2206
- if (v !== null && typeof v === "object" && !Array.isArray(v) && existing !== null && typeof existing === "object" && !Array.isArray(existing)) {
2207
- out[k] = deepMerge(existing, v);
2208
- } else {
2209
- out[k] = v;
2210
- }
2211
- }
2212
- return out;
2213
- }
2214
2253
 
2215
2254
  // src/storage/config-loader.ts
2216
2255
  init_atomic_write();
@@ -2393,43 +2432,16 @@ var defaultIndexing = {
2393
2432
  watchExternal: true,
2394
2433
  debounceMs: 400
2395
2434
  };
2396
- function isPrimitiveArray(a) {
2397
- return a.every((v) => v === null || typeof v !== "object");
2398
- }
2399
- var FORBIDDEN_PROTO_KEYS2 = /* @__PURE__ */ new Set([
2400
- "__proto__",
2401
- "constructor",
2402
- "prototype",
2403
- "__defineGetter__",
2404
- "__defineSetter__",
2405
- "__lookupGetter__",
2406
- "__lookupSetter__"
2407
- ]);
2408
2435
  function deepMerge2(base, patch) {
2409
- if (typeof base !== "object" || base === null) return patch ?? base;
2410
- if (typeof patch !== "object" || patch === null) return base;
2411
- const out = { ...base };
2412
- for (const [k, v] of Object.entries(patch)) {
2413
- if (FORBIDDEN_PROTO_KEYS2.has(k)) continue;
2414
- const existing = out[k];
2415
- if (Array.isArray(v)) {
2416
- if (Array.isArray(existing) && isPrimitiveArray(v) && isPrimitiveArray(existing)) {
2417
- out[k] = [.../* @__PURE__ */ new Set([...existing, ...v])];
2418
- } else {
2419
- out[k] = v;
2420
- if (envBoolOptional(process.env.WRONGSTACK_DEBUG_CONFIG)) {
2421
- console.warn(
2422
- `[config] Non-primitive array for "${k}" replaced (global + local config merge). Global entries: ${existing?.length ?? 0}, local entries: ${v.length}.`
2423
- );
2424
- }
2425
- }
2426
- } else if (typeof v === "object" && v !== null && typeof existing === "object" && existing !== null) {
2427
- out[k] = deepMerge2(existing, v);
2428
- } else if (v !== void 0) {
2429
- out[k] = v;
2430
- }
2436
+ const opts = { arrayMode: "concat-primitives" };
2437
+ if (envBoolOptional(process.env.WRONGSTACK_DEBUG_CONFIG)) {
2438
+ opts.onNonPrimitiveArrayReplace = (key, existingLen, patchLen) => {
2439
+ console.warn(
2440
+ `[config] Non-primitive array for "${key}" replaced (global + local config merge). Global entries: ${existingLen}, local entries: ${patchLen}.`
2441
+ );
2442
+ };
2431
2443
  }
2432
- return out;
2444
+ return deepMerge(base, patch, opts);
2433
2445
  }
2434
2446
  var DefaultConfigLoader = class {
2435
2447
  paths;
@@ -8277,6 +8289,7 @@ var SubagentBudget = class _SubagentBudget {
8277
8289
  function makeAgentSubagentRunner(opts) {
8278
8290
  const format = opts.formatTaskInput ?? defaultFormatTaskInput;
8279
8291
  return async (task, ctx) => {
8292
+ const taskStartedAt = Date.now();
8280
8293
  const factoryResult = await opts.factory(ctx.config);
8281
8294
  const { agent, events } = factoryResult;
8282
8295
  const detachFleet = opts.fleetBus?.attach(ctx.subagentId, events, task.id);
@@ -8373,7 +8386,7 @@ function makeAgentSubagentRunner(opts) {
8373
8386
  }),
8374
8387
  events.on("provider.text_delta", (e) => {
8375
8388
  ctx.budget.markActivity();
8376
- streamingTextAcc = (streamingTextAcc + e.text).slice(-200);
8389
+ streamingTextAcc = (streamingTextAcc + e.text).slice(-2e3);
8377
8390
  })
8378
8391
  );
8379
8392
  const onParentAbort = () => aborter.abort();
@@ -8381,6 +8394,15 @@ function makeAgentSubagentRunner(opts) {
8381
8394
  let result;
8382
8395
  try {
8383
8396
  result = await agent.run(format(task, ctx.config), { signal: aborter.signal });
8397
+ events.emit("subagent.task_completed", {
8398
+ subagentId: ctx.subagentId,
8399
+ taskId: task.id,
8400
+ status: result.status === "done" ? "success" : "failed",
8401
+ iterations: result.iterations,
8402
+ toolCalls: ctx.budget.usage().toolCalls,
8403
+ durationMs: Date.now() - taskStartedAt,
8404
+ finalText: result.finalText?.trim() || void 0
8405
+ });
8384
8406
  } finally {
8385
8407
  detachFleet?.();
8386
8408
  ctx.signal.removeEventListener("abort", onParentAbort);
@@ -9290,15 +9312,44 @@ Working rules:
9290
9312
  id: "e2e",
9291
9313
  name: "E2E",
9292
9314
  role: "e2e",
9293
- tools: [...TOOLS.build, "fetch"],
9315
+ tools: [
9316
+ ...TOOLS.build,
9317
+ "fetch",
9318
+ "playwright_navigate",
9319
+ "playwright_screenshot",
9320
+ "playwright_click",
9321
+ "playwright_type",
9322
+ "playwright_evaluate",
9323
+ "playwright_select_option",
9324
+ "playwright_hover",
9325
+ "playwright_fill_form",
9326
+ "playwright_wait_for",
9327
+ "playwright_press_key",
9328
+ "playwright_drag"
9329
+ ],
9294
9330
  prompt: `You are the E2E agent. Your job is end-to-end testing: drive the whole
9295
9331
  system the way a user would and verify the full flow works across boundaries.
9296
9332
 
9297
9333
  Scope:
9298
9334
  - Author end-to-end scenarios that exercise real user journeys
9299
9335
  - Drive UI/CLI/API across process and network boundaries
9336
+ - Use Playwright browser tools (navigate, click, type, screenshot, evaluate)
9337
+ to automate web UI flows \u2014 open pages, interact with forms, capture evidence
9300
9338
  - Set up and tear down realistic test state
9301
- - Capture failures with enough detail to reproduce (screenshots, logs)
9339
+ - Capture failures with enough detail to reproduce (screenshots, logs, page HTML)
9340
+
9341
+ Playwright tools available (require the "playwright" MCP server to be enabled):
9342
+ playwright_navigate(url) \u2014 open a page at the given URL
9343
+ playwright_screenshot() \u2014 capture a full-page or viewport screenshot
9344
+ playwright_click(selector) \u2014 click on an element matching a CSS selector
9345
+ playwright_type(selector, text) \u2014 type text into a focused input element
9346
+ playwright_evaluate(script) \u2014 run arbitrary JavaScript in the page context
9347
+ playwright_select_option(selector, value) \u2014 pick a <select> dropdown option
9348
+ playwright_hover(selector) \u2014 hover the mouse over an element
9349
+ playwright_fill_form(fields) \u2014 fill multiple form fields in one call
9350
+ playwright_wait_for(selector) \u2014 block until an element appears on the page
9351
+ playwright_press_key(key) \u2014 press a keyboard key (Enter, Tab, Escape, \u2026)
9352
+ playwright_drag(from, to) \u2014 drag an element from one selector to another
9302
9353
 
9303
9354
  Input format you accept:
9304
9355
  { "task": "scenario | smoke | journey", "flow": "<user journey>", "surface": "ui | cli | api" }
@@ -9312,8 +9363,10 @@ Output: Markdown e2e report:
9312
9363
  Working rules:
9313
9364
  - Test the real flow end to end; don't stub the thing under test
9314
9365
  - Make scenarios deterministic \u2014 control time, randomness, and external state
9315
- - On failure, capture artifacts (logs/screenshots) for reproduction
9316
- - Keep scenarios independent so one failure doesn't cascade`
9366
+ - On failure, capture artifacts (screenshots, page HTML, logs) for reproduction
9367
+ - Keep scenarios independent so one failure doesn't cascade
9368
+ - For browser tests: playwright_navigate first, then interact, then playwright_screenshot as evidence
9369
+ - If playwright tools are unavailable, report it and fall back to API/CLI testing`
9317
9370
  },
9318
9371
  budget: HEAVY_BUDGET,
9319
9372
  capability: {
@@ -9326,10 +9379,106 @@ Working rules:
9326
9379
  "user journey",
9327
9380
  "smoke test",
9328
9381
  "playwright",
9382
+ "browser",
9383
+ "screenshot",
9384
+ "web ui",
9385
+ "headless",
9329
9386
  "cypress",
9330
9387
  "full flow",
9331
9388
  "browser test",
9332
- "acceptance test"
9389
+ "acceptance test",
9390
+ "navigate",
9391
+ "click",
9392
+ "form fill",
9393
+ "dom",
9394
+ "page load"
9395
+ ]
9396
+ }
9397
+ },
9398
+ {
9399
+ config: {
9400
+ id: "browser",
9401
+ name: "Browser",
9402
+ role: "browser",
9403
+ tools: [
9404
+ ...TOOLS.read,
9405
+ "fetch",
9406
+ "playwright_navigate",
9407
+ "playwright_screenshot",
9408
+ "playwright_click",
9409
+ "playwright_type",
9410
+ "playwright_evaluate",
9411
+ "playwright_select_option",
9412
+ "playwright_hover",
9413
+ "playwright_fill_form",
9414
+ "playwright_wait_for",
9415
+ "playwright_press_key",
9416
+ "playwright_drag"
9417
+ ],
9418
+ prompt: `You are the Browser agent. Your job is browser automation: open web pages,
9419
+ interact with them, extract data, capture screenshots, and return structured
9420
+ results. You are a read-focused agent \u2014 you drive the browser, not the filesystem.
9421
+
9422
+ Scope:
9423
+ - Navigate to URLs and wait for pages to load
9424
+ - Take full-page or element screenshots as evidence
9425
+ - Click buttons, fill forms, select options, type text \u2014 full user simulation
9426
+ - Extract page content: text, HTML, element attributes, data tables
9427
+ - Evaluate JavaScript in the page context to extract structured data
9428
+ - Verify visual state (element visibility, text content, attribute values)
9429
+
9430
+ Playwright tools available (require the "playwright" MCP server to be enabled):
9431
+ playwright_navigate(url) \u2014 open a page at the given URL
9432
+ playwright_screenshot() \u2014 capture a full-page or viewport screenshot
9433
+ playwright_click(selector) \u2014 click on an element matching a CSS selector
9434
+ playwright_type(selector, text) \u2014 type text into a focused input element
9435
+ playwright_evaluate(script) \u2014 run arbitrary JavaScript in the page context
9436
+ playwright_select_option(selector, value) \u2014 pick a <select> dropdown option
9437
+ playwright_hover(selector) \u2014 hover the mouse over an element
9438
+ playwright_fill_form(fields) \u2014 fill multiple form fields in one call
9439
+ playwright_wait_for(selector) \u2014 block until an element appears on the page
9440
+ playwright_press_key(key) \u2014 press a keyboard key (Enter, Tab, Escape, \u2026)
9441
+ playwright_drag(from, to) \u2014 drag an element from one selector to another
9442
+
9443
+ Input format you accept:
9444
+ { "task": "navigate | screenshot | extract | interact | verify", "url": "<url>", "steps": ["step1", "step2"] }
9445
+
9446
+ Output: Structured markdown report:
9447
+ - ## Page (URL, title, load status)
9448
+ - ## Actions Taken (step-by-step with timestamps)
9449
+ - ## Results (extracted data, element states, verification results)
9450
+ - ## Screenshots (list attached screenshot references)
9451
+ - ## Errors (any failures with stack traces)
9452
+
9453
+ Working rules:
9454
+ - Always playwright_navigate first before any interaction
9455
+ - Always playwright_wait_for after navigation to ensure the page is ready
9456
+ - playwright_screenshot is your primary evidence \u2014 use it before and after interactions
9457
+ - Use playwright_evaluate for structured data extraction (JSON, text content)
9458
+ - If a selector fails, try alternative selectors before giving up
9459
+ - Report exact CSS selectors used \u2014 they're part of the evidence
9460
+ - If playwright tools are unavailable, report the error immediately \u2014 do not guess`
9461
+ },
9462
+ budget: MEDIUM_BUDGET,
9463
+ capability: {
9464
+ phase: "verify",
9465
+ summary: "Browser automation: opens pages, clicks, types, screenshots, extracts data via Playwright headless Chromium.",
9466
+ keywords: [
9467
+ "browser",
9468
+ "screenshot",
9469
+ "navigate",
9470
+ "web page",
9471
+ "scrape",
9472
+ "crawl",
9473
+ "headless",
9474
+ "chrome",
9475
+ "open url",
9476
+ "capture",
9477
+ "page title",
9478
+ "extract data",
9479
+ "fill form",
9480
+ "click button",
9481
+ "take screenshot"
9333
9482
  ]
9334
9483
  }
9335
9484
  },
@@ -20533,6 +20682,14 @@ var zaiVisionServer = () => ({
20533
20682
  ],
20534
20683
  permission: "auto"
20535
20684
  });
20685
+ var playwrightServer = () => ({
20686
+ name: "playwright",
20687
+ description: "Browser automation \u2014 navigate, screenshot, click, type, evaluate JS (headless Chromium)",
20688
+ transport: "stdio",
20689
+ command: "npx",
20690
+ args: ["-y", "@modelcontextprotocol/server-playwright"],
20691
+ permission: "confirm"
20692
+ });
20536
20693
  var miniMaxVisionServer = () => ({
20537
20694
  name: "minimax-vision",
20538
20695
  description: "MiniMax MCP \u2014 image understanding via understand_image",
@@ -20559,7 +20716,8 @@ var allServers = () => ({
20559
20716
  "google-maps": { ...googleMapsServer(), enabled: false },
20560
20717
  sentinel: { ...sentinelServer(), enabled: false },
20561
20718
  "zai-vision": { ...zaiVisionServer(), enabled: false },
20562
- "minimax-vision": { ...miniMaxVisionServer(), enabled: false }
20719
+ "minimax-vision": { ...miniMaxVisionServer(), enabled: false },
20720
+ playwright: { ...playwrightServer(), enabled: false }
20563
20721
  });
20564
20722
 
20565
20723
  export { AGENTS_BY_PHASE, AGENT_CATALOG, AISpecBuilder, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, AutoApprovePermissionPolicy, AutoCompactionMiddleware, AutoExecutor, AutonomousRunner, BUG_HUNTER_AGENT, BudgetExceededError, ConfigMigrationError, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONFIG_MIGRATIONS, DEFAULT_CONTEXT_CONFIG, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_SUBAGENT_BASELINE, DEFAULT_TOOLS_CONFIG, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultErrorHandler, DefaultHealthRegistry, DefaultLogger, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultMultiAgentCoordinator, DefaultPermissionPolicy, DefaultProviderRunner, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultSessionStore, DefaultSkillLoader, DefaultTaskStore, Director, DirectorStateCheckpoint, DoneConditionChecker, EternalAutonomyEngine, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FleetBus, FleetSpawnBudgetError, FleetUsageAggregator, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, InMemoryMetricsSink, IntelligentCompactor, LLMSelector, NULL_FLEET_BUS, NoopMetricsSink, NoopTracer, OTelTracer, PROMETHEUS_CONTENT_TYPE, ParallelEternalEngine, QueueStore, REFACTOR_PLANNER_AGENT, RecoveryLock, SECURITY_SCANNER_AGENT, SPEC_TEMPLATES, SddParallelRun, SddTaskDecomposer, SelectiveCompactor, SessionAnalyzer, SpecDrivenDev, SpecParser, SpecStore, SpecVersioning, SubagentBudget, TaskFlow, TaskGenerator, TaskGraphStore, TaskTracker, ToolExecutor, addPlanItem, allServers, analyzeCriticalPath, applyRosterBudget, attachAutoExtend, attachPlanCheckpoint, attachTodosCheckpoint, awsServer, blockServer, braveSearchServer, buildGoalPreamble, buildOtlpMetricsRequest, buildOtlpTracesRequest, classifyFamily, clearPlan, composeDirectorPrompt, composeSubagentPrompt, context7Server, contextManagerTool, createAutoExecutor, createContextManagerTool, createDelegateTool, createMessage, createSessionEventBridge, createStrategyCompactor, decryptConfigSecrets, deriveTodosFromPlanItem, dispatchAgent, emptyPlan, encryptConfigSecrets, everArtServer, filesystemServer, formatPlan, formatPlanTemplates, getAgentDefinition, getPlanTemplate, getTemplate, githubServer, googleMapsServer, listPlanTemplates, listTemplates, loadDirectorState, loadPlan, loadProjectModes, loadTodosCheckpoint, loadUserModes, makeAgentSubagentRunner, makeAskTool, makeAssignTool, makeAutonomyPromptContributor, makeAwaitTasksTool, makeCollabDebugTool, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeRollUpTool, makeSpawnTool, makeTerminateTool, migratePlaintextSecrets, miniMaxVisionServer, removePlanItem, renderProgress, renderPrometheus, renderSpecAnalysis, renderTaskGraph, renderTaskList, resolveAuditLevel, resolveSessionLoggingConfig, rewriteConfigEncrypted, rosterSummaryFromConfigs, runConfigMigrations, savePlan, saveTodosCheckpoint, scoreAgents, sentinelServer, setPlanItemStatus, slackServer, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, templateToMarkdown, wireMetricsToEvents, zaiVisionServer };