@wrongstack/core 0.8.5 → 0.9.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-DPxcUVkn.d.ts → agent-bridge-Bad3ZGQ7.d.ts} +1 -1
- package/dist/{agent-subagent-runner-Cav3yEJM.d.ts → agent-subagent-runner-Cc8sRJOF.d.ts} +3 -3
- package/dist/coordination/index.d.ts +8 -8
- package/dist/defaults/index.d.ts +11 -11
- package/dist/defaults/index.js +17 -4
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-DyhxkstG.d.ts → events-yCpJD4wa.d.ts} +49 -0
- package/dist/execution/index.d.ts +7 -7
- package/dist/extension/index.d.ts +2 -2
- package/dist/index-Dl3PaD7f.d.ts +209 -0
- package/dist/{index-oYZeWsuJ.d.ts → index-SxpnwRlJ.d.ts} +1 -1
- package/dist/index.d.ts +51 -18
- package/dist/index.js +448 -51
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +2 -2
- package/dist/kernel/index.d.ts +16 -88
- package/dist/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{multi-agent-CRMznZmf.d.ts → multi-agent-C8uY45AY.d.ts} +9 -1
- package/dist/{multi-agent-coordinator-IQKrMfXz.d.ts → multi-agent-coordinator-C7YbZUY8.d.ts} +2 -2
- package/dist/{null-fleet-bus-sKnVwEd8.d.ts → null-fleet-bus-Bb2jVLKr.d.ts} +5 -5
- package/dist/observability/index.d.ts +1 -1
- package/dist/{path-resolver-1CIYbH2Q.d.ts → path-resolver-DnC1nOjb.d.ts} +1 -1
- package/dist/{plan-templates-D8zQgZzc.d.ts → plan-templates-Cc-04Z8o.d.ts} +10 -5
- package/dist/{provider-runner-BrA0XR-l.d.ts → provider-runner-C4ouU7--.d.ts} +1 -1
- package/dist/sdd/index.d.ts +4 -4
- package/dist/storage/index.d.ts +7 -4
- package/dist/storage/index.js +32 -10
- package/dist/storage/index.js.map +1 -1
- package/dist/{tool-executor-QwfWnQZ8.d.ts → tool-executor-Ch25BDwa.d.ts} +1 -1
- package/dist/types/index.d.ts +7 -7
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +4 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-Bxik3CsK.d.ts → wstack-paths-CJYrjQU8.d.ts} +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as BridgeTransport, B as BridgeMessage, A as AgentBridge, a as AgentBridgeConfig } from './multi-agent-
|
|
1
|
+
import { b as BridgeTransport, B as BridgeMessage, A as AgentBridge, a as AgentBridgeConfig } from './multi-agent-C8uY45AY.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as Agent, f as AgentInput } from './index-
|
|
2
|
-
import { E as EventBus } from './events-
|
|
3
|
-
import { n as SubagentConfig, v as TaskSpec, t as SubagentRunner } from './multi-agent-
|
|
1
|
+
import { c as Agent, f as AgentInput } from './index-SxpnwRlJ.js';
|
|
2
|
+
import { E as EventBus } from './events-yCpJD4wa.js';
|
|
3
|
+
import { n as SubagentConfig, v as TaskSpec, t as SubagentRunner } from './multi-agent-C8uY45AY.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Single fleet-wide event with subagent attribution. Whatever a child
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { A as ACP_AGENTS, 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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, o as FLEET_ROSTER_WITHACP, p as FleetCostCapError, q as FleetManager, r as FleetManagerOptions, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from '../null-fleet-bus-
|
|
2
|
-
import { b as AgentDefinition } from '../multi-agent-coordinator-
|
|
3
|
-
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-
|
|
4
|
-
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, f as BudgetNegotiationMode, g as BudgetThresholdDecision, h as BudgetThresholdHandler, i as BudgetThresholdSignal, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-
|
|
5
|
-
export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-
|
|
6
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
1
|
+
export { A as ACP_AGENTS, 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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, o as FLEET_ROSTER_WITHACP, p as FleetCostCapError, q as FleetManager, r as FleetManagerOptions, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from '../null-fleet-bus-Bb2jVLKr.js';
|
|
2
|
+
import { b as AgentDefinition } from '../multi-agent-coordinator-C7YbZUY8.js';
|
|
3
|
+
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-C7YbZUY8.js';
|
|
4
|
+
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, f as BudgetNegotiationMode, g as BudgetThresholdDecision, h as BudgetThresholdHandler, i as BudgetThresholdSignal, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-C8uY45AY.js';
|
|
5
|
+
export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-Cc8sRJOF.js';
|
|
6
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-Bad3ZGQ7.js';
|
|
7
7
|
import '../context-z2x5gv_V.js';
|
|
8
8
|
import '../director-state-BmYi3DGA.js';
|
|
9
|
-
import '../events-
|
|
9
|
+
import '../events-yCpJD4wa.js';
|
|
10
10
|
import 'node:events';
|
|
11
|
-
import '../index-
|
|
11
|
+
import '../index-SxpnwRlJ.js';
|
|
12
12
|
import '../logger-DDd5C--Z.js';
|
|
13
13
|
import '../system-prompt-CWA6ml-d.js';
|
|
14
14
|
import '../observability-BhnVLBLS.js';
|
package/dist/defaults/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-bOzkF5LL.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, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from '../plan-templates-
|
|
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, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from '../plan-templates-Cc-04Z8o.js';
|
|
3
3
|
export { D as DefaultSessionReader } from '../session-reader-DsadjyF9.js';
|
|
4
4
|
export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BmYi3DGA.js';
|
|
5
5
|
export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-C0n1EqrC.js';
|
|
6
6
|
export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-BBa1M1xc.js';
|
|
7
|
-
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-
|
|
7
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-Ch25BDwa.js';
|
|
8
8
|
export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, ParallelEngineState, ParallelEternalEngine, ParallelEternalOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from '../execution/index.js';
|
|
9
|
-
import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-
|
|
9
|
+
import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-C4ouU7--.js';
|
|
10
10
|
import { q as Response } from '../context-z2x5gv_V.js';
|
|
11
|
-
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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from '../null-fleet-bus-
|
|
12
|
-
export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-
|
|
13
|
-
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-
|
|
14
|
-
export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-
|
|
15
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
11
|
+
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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from '../null-fleet-bus-Bb2jVLKr.js';
|
|
12
|
+
export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-C7YbZUY8.js';
|
|
13
|
+
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-C8uY45AY.js';
|
|
14
|
+
export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-Cc8sRJOF.js';
|
|
15
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-Bad3ZGQ7.js';
|
|
16
16
|
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-OG_30xqZ.js';
|
|
17
17
|
export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from '../models/index.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';
|
|
@@ -20,9 +20,9 @@ export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, Metric
|
|
|
20
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-n2L9ohMX.js';
|
|
21
21
|
export { D as DEFAULT_CONTEXT_CONFIG, a as DEFAULT_TOOLS_CONFIG } from '../default-config-DvRSTELf.js';
|
|
22
22
|
import '../logger-DDd5C--Z.js';
|
|
23
|
-
import '../events-
|
|
23
|
+
import '../events-yCpJD4wa.js';
|
|
24
24
|
import '../memory-CEXuo7sz.js';
|
|
25
|
-
import '../wstack-paths-
|
|
25
|
+
import '../wstack-paths-CJYrjQU8.js';
|
|
26
26
|
import '../config-Bi4Q0fnz.js';
|
|
27
27
|
import '../models-registry-BcYJDKLm.js';
|
|
28
28
|
import '../secret-vault-DoISxaKO.js';
|
|
@@ -30,7 +30,7 @@ import '../secret-scrubber-CyE1-EMG.js';
|
|
|
30
30
|
import '../input-reader-E-ffP2ee.js';
|
|
31
31
|
import '../compactor-Mw7-rNyb.js';
|
|
32
32
|
import '../retry-policy-OwtKNxo8.js';
|
|
33
|
-
import '../index-
|
|
33
|
+
import '../index-SxpnwRlJ.js';
|
|
34
34
|
import '../system-prompt-CWA6ml-d.js';
|
|
35
35
|
import '../observability-BhnVLBLS.js';
|
|
36
36
|
import '../selector-DkvgYVS4.js';
|
package/dist/defaults/index.js
CHANGED
|
@@ -1649,9 +1649,14 @@ var RecoveryLock = class {
|
|
|
1649
1649
|
};
|
|
1650
1650
|
}
|
|
1651
1651
|
/**
|
|
1652
|
-
* Claim the lock for the given session.
|
|
1653
|
-
*
|
|
1654
|
-
* `checkAbandoned`
|
|
1652
|
+
* Claim the lock for the given session. Uses exclusive-create (`O_EXCL`)
|
|
1653
|
+
* to detect whether another process acquired the lock between our
|
|
1654
|
+
* `checkAbandoned()` call and now. If the file already exists, it means
|
|
1655
|
+
* another process won the race and we throw instead of silently
|
|
1656
|
+
* overwriting their recovery record.
|
|
1657
|
+
*
|
|
1658
|
+
* The caller MUST have already called `checkAbandoned()` and handled its
|
|
1659
|
+
* null return before calling this.
|
|
1655
1660
|
*/
|
|
1656
1661
|
async write(sessionId) {
|
|
1657
1662
|
await ensureDir(path3.dirname(this.file));
|
|
@@ -1662,7 +1667,15 @@ var RecoveryLock = class {
|
|
|
1662
1667
|
hostname: this.hostname,
|
|
1663
1668
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1664
1669
|
};
|
|
1665
|
-
|
|
1670
|
+
try {
|
|
1671
|
+
await fsp.writeFile(this.file, JSON.stringify(lock), { flag: "wx", mode: 384 });
|
|
1672
|
+
} catch (err) {
|
|
1673
|
+
const code = err.code;
|
|
1674
|
+
if (code === "EEXIST") {
|
|
1675
|
+
throw new Error(`Recovery lock already held by another process`);
|
|
1676
|
+
}
|
|
1677
|
+
throw err;
|
|
1678
|
+
}
|
|
1666
1679
|
}
|
|
1667
1680
|
/**
|
|
1668
1681
|
* Release the lock. Idempotent — silently succeeds if the file is
|