opencode-swarm 7.115.0 → 7.116.1
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/.opencode/skills/commit-pr/SKILL.md +60 -579
- package/README.md +3 -1
- package/dist/cli/{curator-drift-c0by7063.js → curator-drift-7p2ky1th.js} +2 -2
- package/dist/cli/{curator-llm-factory-6n9sgaj8.js → curator-llm-factory-9qn52fnv.js} +17 -16
- package/dist/cli/{curator-hpc4tsjv.js → curator-yxmtp8py.js} +17 -16
- package/dist/cli/{dispatch-mczsxy5s.js → dispatch-07jgc3hn.js} +1 -1
- package/dist/cli/{evidence-summary-service-fehwj116.js → evidence-summary-service-bwt6drb3.js} +7 -7
- package/dist/cli/{gate-evidence-vkpqt300.js → gate-evidence-j2m4cd85.js} +5 -4
- package/dist/cli/{guardrail-explain-hecpd738.js → guardrail-explain-xvyz2eag.js} +18 -17
- package/dist/cli/{hive-promoter-0kfb4vjk.js → hive-promoter-ykqc60w1.js} +17 -16
- package/dist/cli/{index-0p660a87.js → index-0pfqcjp6.js} +5 -1
- package/dist/cli/{index-g40r5d08.js → index-34g1mv3c.js} +1 -1
- package/dist/cli/{index-4sckv7y6.js → index-42cx6g2h.js} +9 -4
- package/dist/cli/index-4905hd2m.js +19 -0
- package/dist/cli/{index-80jkseqw.js → index-5bcrp3bc.js} +2 -2
- package/dist/cli/{index-rk6qhyng.js → index-5h7d37nf.js} +7 -7
- package/dist/cli/{index-m766gvdt.js → index-7kcpkm4y.js} +7016 -1994
- package/dist/cli/{index-4h2ea8h5.js → index-abjjn4yh.js} +2 -2
- package/dist/cli/{index-m0rce3x6.js → index-efdyjgeh.js} +2 -2
- package/dist/cli/{index-jtqkh8jf.js → index-fsrp8wp3.js} +10 -1
- package/dist/cli/{index-8f2270hc.js → index-g4p13g8t.js} +3 -3
- package/dist/cli/{index-wh8949ef.js → index-kzj3fp7c.js} +3 -3
- package/dist/cli/{index-ga4ta3cr.js → index-nprawcc0.js} +7 -1
- package/dist/cli/{index-2etc05tv.js → index-p9jf8gt8.js} +28 -20
- package/dist/cli/{index-pa6t33pt.js → index-q2rrv0cy.js} +11 -0
- package/dist/cli/{index-n18yy0z1.js → index-t5f01hnz.js} +3 -3
- package/dist/cli/{index-6f6y2rbp.js → index-wegc6xwr.js} +3 -3
- package/dist/cli/{index-x12hvfpf.js → index-wxkf3089.js} +3 -3
- package/dist/cli/{index-yrrqs4b0.js → index-xdsd2hma.js} +1164 -51
- package/dist/cli/index.js +17 -16
- package/dist/cli/{knowledge-escalator-5gwp1ar8.js → knowledge-escalator-tthw6c9q.js} +8 -8
- package/dist/cli/{knowledge-events-m304swh6.js → knowledge-events-hrbmwxxj.js} +6 -5
- package/dist/cli/{knowledge-store-9babt8rd.js → knowledge-store-5cns5sns.js} +6 -6
- package/dist/cli/{knowledge-validator-t9sym59g.js → knowledge-validator-xre0s774.js} +7 -7
- package/dist/cli/{pending-delegations-ddbkbgxy.js → pending-delegations-9cn17983.js} +4 -4
- package/dist/cli/{pr-subscriptions-vwv7zm2p.js → pr-subscriptions-8a6jwek2.js} +5 -5
- package/dist/cli/runtime-ykafcwc6.js +3397 -0
- package/dist/cli/{skill-generator-tav44xpm.js → skill-generator-22nk6c6a.js} +9 -9
- package/dist/cli/{telemetry-jny76r83.js → telemetry-qh78ymq4.js} +1 -1
- package/dist/commands/archive.d.ts +4 -4
- package/dist/commands/close.d.ts +12 -0
- package/dist/commands/command-dispatch.d.ts +2 -0
- package/dist/commands/gate-audit.d.ts +28 -0
- package/dist/commands/gate-stats.d.ts +1 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/registry.d.ts +25 -8
- package/dist/commands/reset-backup.d.ts +32 -0
- package/dist/commands/reset-session.d.ts +2 -0
- package/dist/commands/reset.d.ts +9 -0
- package/dist/config/plan-schema.d.ts +7 -7
- package/dist/evaluation/contracts.d.ts +545 -0
- package/dist/evaluation/disposable-worktree.d.ts +38 -0
- package/dist/evaluation/fixtures.d.ts +8 -0
- package/dist/evaluation/gate-audit.d.ts +32 -0
- package/dist/evaluation/gate-ground-truth.d.ts +43 -0
- package/dist/evaluation/gate-stats.d.ts +47 -0
- package/dist/evaluation/hashing.d.ts +34 -0
- package/dist/evaluation/index.d.ts +17 -0
- package/dist/evaluation/model-dispatcher.d.ts +30 -0
- package/dist/evaluation/public-api.d.ts +87 -0
- package/dist/evaluation/retention.d.ts +56 -0
- package/dist/evaluation/runner.d.ts +48 -0
- package/dist/evaluation/statistics.d.ts +9 -0
- package/dist/evaluation/store.d.ts +26 -0
- package/dist/evidence/manager.d.ts +18 -0
- package/dist/evidence/task-file.d.ts +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +468 -451
- package/dist/mutation/engine.d.ts +29 -5
- package/dist/telemetry.d.ts +11 -1
- package/dist/tools/plugin-registration.d.ts +2 -1
- package/dist/tools/sast-scan.d.ts +9 -0
- package/dist/tools/swarm-command.d.ts +2 -1
- package/dist/tools/update-task-status.d.ts +16 -4
- package/dist/utils/external-tool-runner.d.ts +2 -1
- package/dist/utils/swarm-artifact-cache.d.ts +13 -0
- package/evaluation-fixtures/tier1/boundary-error/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/boundary-error/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/boundary-error/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/boundary-error/instruction.md +1 -0
- package/evaluation-fixtures/tier1/boundary-error/manifest.json +1 -0
- package/evaluation-fixtures/tier1/branch-swap/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/branch-swap/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/branch-swap/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/branch-swap/instruction.md +1 -0
- package/evaluation-fixtures/tier1/branch-swap/manifest.json +1 -0
- package/evaluation-fixtures/tier1/curated-off-by-one/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/curated-off-by-one/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/curated-off-by-one/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/curated-off-by-one/instruction.md +1 -0
- package/evaluation-fixtures/tier1/curated-off-by-one/manifest.json +1 -0
- package/evaluation-fixtures/tier1/guard-removal/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/guard-removal/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/guard-removal/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/guard-removal/instruction.md +1 -0
- package/evaluation-fixtures/tier1/guard-removal/manifest.json +1 -0
- package/evaluation-fixtures/tier1/injection-prone-string/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/injection-prone-string/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/injection-prone-string/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/injection-prone-string/instruction.md +1 -0
- package/evaluation-fixtures/tier1/injection-prone-string/manifest.json +1 -0
- package/evaluation-fixtures/tier1/missing-auth-check/environment/baseline.ts +4 -0
- package/evaluation-fixtures/tier1/missing-auth-check/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/missing-auth-check/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/missing-auth-check/instruction.md +1 -0
- package/evaluation-fixtures/tier1/missing-auth-check/manifest.json +1 -0
- package/evaluation-fixtures/tier1/missing-await/environment/baseline.ts +7 -0
- package/evaluation-fixtures/tier1/missing-await/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/missing-await/environment/defect.ts +4 -0
- package/evaluation-fixtures/tier1/missing-await/instruction.md +1 -0
- package/evaluation-fixtures/tier1/missing-await/manifest.json +1 -0
- package/evaluation-fixtures/tier1/mutation-off-by-one/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/mutation-off-by-one/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/mutation-off-by-one/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/mutation-off-by-one/instruction.md +1 -0
- package/evaluation-fixtures/tier1/mutation-off-by-one/manifest.json +1 -0
- package/evaluation-fixtures/tier1/null-substitution/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/null-substitution/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/null-substitution/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/null-substitution/instruction.md +1 -0
- package/evaluation-fixtures/tier1/null-substitution/manifest.json +1 -0
- package/evaluation-fixtures/tier1/operator-swap/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/operator-swap/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/operator-swap/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/operator-swap/instruction.md +1 -0
- package/evaluation-fixtures/tier1/operator-swap/manifest.json +1 -0
- package/evaluation-fixtures/tier1/side-effect-deletion/environment/baseline.ts +4 -0
- package/evaluation-fixtures/tier1/side-effect-deletion/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/side-effect-deletion/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/side-effect-deletion/instruction.md +1 -0
- package/evaluation-fixtures/tier1/side-effect-deletion/manifest.json +1 -0
- package/evaluation-fixtures/tier1/swallowed-error/environment/baseline.ts +3 -0
- package/evaluation-fixtures/tier1/swallowed-error/environment/defect.test.ts +3 -0
- package/evaluation-fixtures/tier1/swallowed-error/environment/defect.ts +3 -0
- package/evaluation-fixtures/tier1/swallowed-error/instruction.md +1 -0
- package/evaluation-fixtures/tier1/swallowed-error/manifest.json +1 -0
- package/package.json +2 -1
|
@@ -33,17 +33,17 @@ import {
|
|
|
33
33
|
sanitizeSlug,
|
|
34
34
|
selectCandidateEntries,
|
|
35
35
|
writeEvalStub
|
|
36
|
-
} from "./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
39
|
-
import"./index-
|
|
36
|
+
} from "./index-wxkf3089.js";
|
|
37
|
+
import"./index-t5f01hnz.js";
|
|
38
|
+
import"./index-g4p13g8t.js";
|
|
39
|
+
import"./index-5h7d37nf.js";
|
|
40
40
|
import"./index-bfwt3abw.js";
|
|
41
|
-
import"./index-
|
|
42
|
-
import"./index-jtqkh8jf.js";
|
|
41
|
+
import"./index-34g1mv3c.js";
|
|
43
42
|
import"./index-zgwm4ryv.js";
|
|
44
|
-
import"./index-
|
|
45
|
-
import"./index-
|
|
46
|
-
import"./index-
|
|
43
|
+
import"./index-0pfqcjp6.js";
|
|
44
|
+
import"./index-42cx6g2h.js";
|
|
45
|
+
import"./index-fsrp8wp3.js";
|
|
46
|
+
import"./index-q2rrv0cy.js";
|
|
47
47
|
import"./index-vvk2g744.js";
|
|
48
48
|
import"./index-qe3v54nb.js";
|
|
49
49
|
import"./index-a76rekgs.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
1
|
+
export declare const _internals: {
|
|
2
|
+
now: () => Date;
|
|
3
|
+
};
|
|
4
|
+
/** Handles `/swarm archive` with a truthful preview/execution report. */
|
|
5
5
|
export declare function handleArchiveCommand(directory: string, args: string[]): Promise<string>;
|
package/dist/commands/close.d.ts
CHANGED
|
@@ -156,6 +156,17 @@ export declare function runCleanStage(ctx: CloseStageContext): Promise<CleanStag
|
|
|
156
156
|
* the close summary. All warnings are pushed into ctx.warnings.
|
|
157
157
|
*/
|
|
158
158
|
export declare function runAlignStage(ctx: CloseStageContext): Promise<GitAlignResult>;
|
|
159
|
+
/**
|
|
160
|
+
* Builds the `/swarm finalize --dry-run` report. Purely READ-ONLY: inspects the
|
|
161
|
+
* plan and the filesystem and describes what a real finalize WOULD do, without
|
|
162
|
+
* acquiring the finalize lock, creating an archive bundle, deleting any file,
|
|
163
|
+
* running git, or tearing down session state. (#1692)
|
|
164
|
+
*
|
|
165
|
+
* The archive-first guard means the clean stage only removes files it first
|
|
166
|
+
* archived successfully; this report approximates that by listing existing
|
|
167
|
+
* clean-set members as "would remove" and notes the approximation.
|
|
168
|
+
*/
|
|
169
|
+
export declare function runFinalizeDryRun(directory: string, swarmDir: string, planData: PlanData, planExists: boolean): Promise<string>;
|
|
159
170
|
/**
|
|
160
171
|
* Handles /swarm close command - performs full terminal session finalization:
|
|
161
172
|
* 0. Guarantee: mark all incomplete phases/tasks as closed
|
|
@@ -198,6 +209,7 @@ export declare const _internals: {
|
|
|
198
209
|
runArchiveEvidenceRetention: typeof runArchiveEvidenceRetention;
|
|
199
210
|
runCleanStage: typeof runCleanStage;
|
|
200
211
|
runAlignStage: typeof runAlignStage;
|
|
212
|
+
runFinalizeDryRun: typeof runFinalizeDryRun;
|
|
201
213
|
archiveEvidence: typeof archiveEvidence;
|
|
202
214
|
closePlanTerminalState: typeof closePlanTerminalState;
|
|
203
215
|
endAgentSession: typeof endAgentSession;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentDefinition } from '../agents/index.js';
|
|
2
|
+
import type { EvaluationModelDispatcher } from '../evaluation/model-dispatcher.js';
|
|
2
3
|
import { type CommandEntry, resolveCommand } from './registry.js';
|
|
3
4
|
export type ResolvedSwarmCommand = NonNullable<ReturnType<typeof resolveCommand>>;
|
|
4
5
|
export type SwarmCommandPolicyResult = {
|
|
@@ -27,5 +28,6 @@ export declare function executeSwarmCommand(args: {
|
|
|
27
28
|
packageRoot?: string;
|
|
28
29
|
buildHelpText?: () => string;
|
|
29
30
|
policy?: SwarmCommandPolicy;
|
|
31
|
+
evaluationModelDispatcher?: EvaluationModelDispatcher;
|
|
30
32
|
}): Promise<SwarmCommandExecutionResult>;
|
|
31
33
|
export type { CommandEntry };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GateName } from '../evaluation/contracts.js';
|
|
2
|
+
import type { EvaluationModelDispatcher } from '../evaluation/model-dispatcher.js';
|
|
3
|
+
type ParsedGateAuditArgs = {
|
|
4
|
+
runId?: string;
|
|
5
|
+
models: string[];
|
|
6
|
+
preferredSwarm?: string;
|
|
7
|
+
gates: GateName[];
|
|
8
|
+
tasks: string[];
|
|
9
|
+
repetitions: number;
|
|
10
|
+
seed: string;
|
|
11
|
+
maxConcurrency: number;
|
|
12
|
+
maxRetries: number;
|
|
13
|
+
maxTimeMs: number;
|
|
14
|
+
maxCostUsd?: number;
|
|
15
|
+
json: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare function resolvePackageRoot(modulePath: string): string;
|
|
18
|
+
declare function parseArgs(args: string[]): ParsedGateAuditArgs;
|
|
19
|
+
export declare function handleGateAuditCommand(directory: string, args: string[], runtime?: {
|
|
20
|
+
packageRoot?: string;
|
|
21
|
+
dispatcher?: EvaluationModelDispatcher;
|
|
22
|
+
parentSessionId?: string;
|
|
23
|
+
}): Promise<string>;
|
|
24
|
+
export declare const _internals: {
|
|
25
|
+
parseArgs: typeof parseArgs;
|
|
26
|
+
resolvePackageRoot: typeof resolvePackageRoot;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleGateStatsCommand(directory: string, args: string[]): Promise<string>;
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentDefinition } from '../agents/index.js';
|
|
2
|
+
import type { EvaluationModelDispatcher } from '../evaluation/model-dispatcher.js';
|
|
2
3
|
export { handleAcknowledgeSpecDriftCommand } from './acknowledge-spec-drift';
|
|
3
4
|
export { handleAgentsCommand } from './agents';
|
|
4
5
|
export { handleAnalyzeCommand } from './analyze';
|
|
@@ -28,6 +29,8 @@ export { handleDoctorCommand } from './doctor';
|
|
|
28
29
|
export { handleEvidenceCommand, handleEvidenceSummaryCommand, } from './evidence';
|
|
29
30
|
export { handleExportCommand } from './export';
|
|
30
31
|
export { handleFullAutoCommand } from './full-auto';
|
|
32
|
+
export { handleGateAuditCommand } from './gate-audit';
|
|
33
|
+
export { handleGateStatsCommand } from './gate-stats';
|
|
31
34
|
export { handleGuardrailExplain } from './guardrail-explain';
|
|
32
35
|
export { handleGuardrailLog } from './guardrail-log';
|
|
33
36
|
export { handleHandoffCommand } from './handoff';
|
|
@@ -67,6 +70,7 @@ export declare function createSwarmCommandHandler(directory: string, agents: Rec
|
|
|
67
70
|
registeredAgents?: Record<string, {
|
|
68
71
|
tools?: Record<string, boolean>;
|
|
69
72
|
}>;
|
|
73
|
+
evaluationModelDispatcher?: EvaluationModelDispatcher;
|
|
70
74
|
}): (input: {
|
|
71
75
|
command: string;
|
|
72
76
|
sessionID: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentDefinition } from '../agents/index.js';
|
|
2
|
+
import type { EvaluationModelDispatcher } from '../evaluation/model-dispatcher.js';
|
|
2
3
|
declare function levenshteinDistance(a: string, b: string): number;
|
|
3
4
|
declare function findSimilarCommands(query: string): string[];
|
|
4
5
|
declare function emitValidationWarnings(prefix: string, warnings: readonly string[]): void;
|
|
@@ -18,6 +19,7 @@ export type CommandContext = {
|
|
|
18
19
|
* with existing callers.
|
|
19
20
|
*/
|
|
20
21
|
source?: 'cli' | 'chat';
|
|
22
|
+
evaluationModelDispatcher?: EvaluationModelDispatcher;
|
|
21
23
|
};
|
|
22
24
|
export type CommandResult = Promise<string>;
|
|
23
25
|
export type CommandCategory = 'core' | 'agent' | 'config' | 'diagnostics' | 'utility';
|
|
@@ -214,8 +216,23 @@ export declare const COMMAND_REGISTRY: {
|
|
|
214
216
|
};
|
|
215
217
|
readonly benchmark: {
|
|
216
218
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
217
|
-
readonly description: "Show performance metrics [--cumulative] [--ci-gate] [--max-cost-usd <n>]";
|
|
218
|
-
readonly args: "--cumulative, --ci-gate, --max-cost-usd <n>";
|
|
219
|
+
readonly description: "Show performance metrics [--cumulative] [--ci-gate] [--max-cost-usd <n>] [--gate-audit-run <id>]";
|
|
220
|
+
readonly args: "--cumulative, --ci-gate, --max-cost-usd <n>, --gate-audit-run <id>";
|
|
221
|
+
readonly category: "diagnostics";
|
|
222
|
+
readonly toolPolicy: "agent";
|
|
223
|
+
};
|
|
224
|
+
readonly 'gate-audit': {
|
|
225
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
226
|
+
readonly description: "Run the bounded Tier-1 reviewer/test/SAST/mutation/quality gate matrix";
|
|
227
|
+
readonly args: "--model <id>, --swarm <id>, --gates <csv>, --tasks <csv>, --runs <n>, --max-concurrency <n>, --max-retries <n>, --max-time-ms <n>, --max-cost-usd <n>, --seed <value>, --run-id <id>, --json";
|
|
228
|
+
readonly details: "Runs immutable curated defects only in disposable copies, records unavailable data honestly, and writes versioned results below .swarm/evidence/gate-audit/. Container tasks are unsupported until a safe array-form runner exists.";
|
|
229
|
+
readonly category: "diagnostics";
|
|
230
|
+
readonly toolPolicy: "agent";
|
|
231
|
+
};
|
|
232
|
+
readonly 'gate-stats': {
|
|
233
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
234
|
+
readonly description: "Show offline per-model gate catch, false-reject, retry, cost, and reviewer fallback statistics";
|
|
235
|
+
readonly args: "--json, --min-samples <n>";
|
|
219
236
|
readonly category: "diagnostics";
|
|
220
237
|
readonly toolPolicy: "agent";
|
|
221
238
|
};
|
|
@@ -364,16 +381,16 @@ export declare const COMMAND_REGISTRY: {
|
|
|
364
381
|
readonly finalize: {
|
|
365
382
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
366
383
|
readonly description: "Use /swarm finalize to finalize the swarm project and archive evidence";
|
|
367
|
-
readonly details: "Idempotent 4-stage terminal finalization: (1) finalize writes retrospectives for in-progress phases, (2) archive creates timestamped bundle of swarm artifacts and evidence, (3) clean removes active-state files for a clean slate, (4) align performs aggressive git reset --hard to the default remote branch, discarding uncommitted changes and gitignored build artifacts (user-created untracked files are preserved); falls back to a cautious reset that preserves uncommitted changes when the aggressive path cannot proceed. WARNING: alignment discards local changes and gitignored files. Resets agent sessions and delegation chains. Reads .swarm/close-lessons.md for explicit lessons and runs curation. Use --skill-review to run the quota-bounded skill_improver in proposal mode.";
|
|
368
|
-
readonly args: "--prune-branches, --skill-review";
|
|
384
|
+
readonly details: "Idempotent 4-stage terminal finalization: (1) finalize writes retrospectives for in-progress phases, (2) archive creates timestamped bundle of swarm artifacts and evidence, (3) clean removes active-state files for a clean slate, (4) align performs aggressive git reset --hard to the default remote branch, discarding uncommitted changes and gitignored build artifacts (user-created untracked files are preserved); falls back to a cautious reset that preserves uncommitted changes when the aggressive path cannot proceed. WARNING: alignment discards local changes and gitignored files. Resets agent sessions and delegation chains. Reads .swarm/close-lessons.md for explicit lessons and runs curation. Use --skill-review to run the quota-bounded skill_improver in proposal mode. Use --dry-run to preview what finalize would archive, clean, and align without taking the lock or changing anything.";
|
|
385
|
+
readonly args: "--prune-branches, --skill-review, --dry-run";
|
|
369
386
|
readonly category: "core";
|
|
370
387
|
readonly toolPolicy: "none";
|
|
371
388
|
};
|
|
372
389
|
readonly close: {
|
|
373
390
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
374
391
|
readonly description: "Use /swarm close (deprecated alias) to finalize and archive swarm state";
|
|
375
|
-
readonly details: "Deprecated alias for /swarm finalize. Preserved for backward compatibility.";
|
|
376
|
-
readonly args: "--prune-branches, --skill-review";
|
|
392
|
+
readonly details: "Deprecated alias for /swarm finalize. Preserved for backward compatibility. Supports the same flags, including --dry-run.";
|
|
393
|
+
readonly args: "--prune-branches, --skill-review, --dry-run";
|
|
377
394
|
readonly category: "core";
|
|
378
395
|
readonly aliasOf: "finalize";
|
|
379
396
|
readonly deprecated: true;
|
|
@@ -681,7 +698,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
681
698
|
readonly reset: {
|
|
682
699
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
683
700
|
readonly description: "Clear swarm state files [--confirm]";
|
|
684
|
-
readonly details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag — without it, displays a warning and tips to export first.";
|
|
701
|
+
readonly details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag — without it, displays a warning and tips to export first. Before deleting, auto-backs up the state it removes to .swarm/reset-backups/<timestamp>/ (newest 5 kept) so it can be restored by copying the files back.";
|
|
685
702
|
readonly args: "--confirm (required)";
|
|
686
703
|
readonly category: "utility";
|
|
687
704
|
readonly clashesWithNativeCcCommand: "/reset";
|
|
@@ -690,7 +707,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
690
707
|
readonly 'reset-session': {
|
|
691
708
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
692
709
|
readonly description: "Clear session state while preserving plan, evidence, and knowledge";
|
|
693
|
-
readonly details: "Deletes only .swarm/session/state.json and any other session files. Clears in-memory agent sessions and delegation chains. Preserves plan, evidence, and knowledge for cross-session continuity.";
|
|
710
|
+
readonly details: "Deletes only .swarm/session/state.json and any other session files. Clears in-memory agent sessions and delegation chains. Preserves plan, evidence, and knowledge for cross-session continuity. Before deleting, auto-backs up the session files it removes to .swarm/reset-backups/<timestamp>/ (newest 5 kept).";
|
|
694
711
|
readonly args: "";
|
|
695
712
|
readonly category: "utility";
|
|
696
713
|
readonly toolPolicy: "restricted";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of an auto-backup taken before a destructive /swarm reset or
|
|
3
|
+
* /swarm reset-session. Fail-open by contract: any per-entry failure is
|
|
4
|
+
* recorded as a warning and never thrown.
|
|
5
|
+
*/
|
|
6
|
+
export interface ResetBackupResult {
|
|
7
|
+
/** Absolute path of the backup directory, or null if nothing was backed up. */
|
|
8
|
+
backupDir: string | null;
|
|
9
|
+
/** Relative names actually copied into the backup. */
|
|
10
|
+
copied: string[];
|
|
11
|
+
/** Non-fatal warnings (source unreadable, prune failure, etc.). */
|
|
12
|
+
warnings: string[];
|
|
13
|
+
}
|
|
14
|
+
/** How many backup directories to retain under .swarm/reset-backups/. */
|
|
15
|
+
export declare const RESET_BACKUP_RETENTION = 5;
|
|
16
|
+
/**
|
|
17
|
+
* Copy the swarm-state entries a reset is about to delete into a durable,
|
|
18
|
+
* timestamped directory under `.swarm/reset-backups/` BEFORE deletion, so the
|
|
19
|
+
* user can recover by copying the files back. The backup directory is not part
|
|
20
|
+
* of any reset deletion set, so it survives the reset.
|
|
21
|
+
*
|
|
22
|
+
* This deliberately does NOT use the git checkpoint tool: that tool excludes
|
|
23
|
+
* `.swarm/` (`git add ... :!.swarm/`) — i.e. it excludes exactly the state a
|
|
24
|
+
* reset destroys — and would commit unrelated working-tree changes to the
|
|
25
|
+
* user's branch. A direct file copy of the deleted state is the faithful,
|
|
26
|
+
* non-surprising backup. (#1692)
|
|
27
|
+
*
|
|
28
|
+
* @param directory project root (contains `.swarm/`)
|
|
29
|
+
* @param kind backup label prefix ('reset' | 'reset-session')
|
|
30
|
+
* @param relEntries entries relative to `.swarm/` to back up (files or dirs)
|
|
31
|
+
*/
|
|
32
|
+
export declare function backupSwarmStateBeforeReset(directory: string, kind: 'reset' | 'reset-session', relEntries: string[]): ResetBackupResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OrphanCleanupResult } from '../worktree/merge';
|
|
2
|
+
import { type ResetBackupResult } from './reset-backup';
|
|
2
3
|
/**
|
|
3
4
|
* _internals DI seam for testing reset-session without spawning real git processes.
|
|
4
5
|
* Production code calls `_internals.cleanupOrphanedBranches(...)` so tests can
|
|
@@ -7,6 +8,7 @@ import { type OrphanCleanupResult } from '../worktree/merge';
|
|
|
7
8
|
*/
|
|
8
9
|
export declare const _internals: {
|
|
9
10
|
cleanupOrphanedBranches: (directory: string, activeSessionIds: string[]) => Promise<OrphanCleanupResult>;
|
|
11
|
+
backupSwarmStateBeforeReset: (directory: string, kind: 'reset' | 'reset-session', relEntries: string[]) => ResetBackupResult;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* Handles the /swarm reset-session command.
|
package/dist/commands/reset.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { type ResetBackupResult } from './reset-backup';
|
|
2
|
+
/**
|
|
3
|
+
* _internals DI seam so tests can stub the pre-deletion backup without touching
|
|
4
|
+
* the real filesystem-copy helper. Mutations are file-scoped and restorable in
|
|
5
|
+
* afterEach.
|
|
6
|
+
*/
|
|
7
|
+
export declare const _internals: {
|
|
8
|
+
backupSwarmStateBeforeReset: (directory: string, kind: 'reset' | 'reset-session', relEntries: string[]) => ResetBackupResult;
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* Handles the /swarm reset command.
|
|
3
12
|
* Clears all swarm state files from .swarm/ and project root.
|
|
@@ -8,10 +8,10 @@ export declare const ExecutionProfileSchema: z.ZodObject<{
|
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
export type ExecutionProfile = z.infer<typeof ExecutionProfileSchema>;
|
|
10
10
|
export declare const TaskStatusSchema: z.ZodEnum<{
|
|
11
|
+
blocked: "blocked";
|
|
11
12
|
pending: "pending";
|
|
12
13
|
in_progress: "in_progress";
|
|
13
14
|
completed: "completed";
|
|
14
|
-
blocked: "blocked";
|
|
15
15
|
closed: "closed";
|
|
16
16
|
}>;
|
|
17
17
|
export type TaskStatus = z.infer<typeof TaskStatusSchema>;
|
|
@@ -22,10 +22,10 @@ export declare const TaskSizeSchema: z.ZodEnum<{
|
|
|
22
22
|
}>;
|
|
23
23
|
export type TaskSize = z.infer<typeof TaskSizeSchema>;
|
|
24
24
|
export declare const PhaseStatusSchema: z.ZodEnum<{
|
|
25
|
+
blocked: "blocked";
|
|
25
26
|
pending: "pending";
|
|
26
27
|
in_progress: "in_progress";
|
|
27
28
|
completed: "completed";
|
|
28
|
-
blocked: "blocked";
|
|
29
29
|
closed: "closed";
|
|
30
30
|
complete: "complete";
|
|
31
31
|
}>;
|
|
@@ -52,10 +52,10 @@ export declare const TaskSchema: z.ZodObject<{
|
|
|
52
52
|
id: z.ZodString;
|
|
53
53
|
phase: z.ZodNumber;
|
|
54
54
|
status: z.ZodDefault<z.ZodEnum<{
|
|
55
|
+
blocked: "blocked";
|
|
55
56
|
pending: "pending";
|
|
56
57
|
in_progress: "in_progress";
|
|
57
58
|
completed: "completed";
|
|
58
|
-
blocked: "blocked";
|
|
59
59
|
closed: "closed";
|
|
60
60
|
}>>;
|
|
61
61
|
size: z.ZodDefault<z.ZodEnum<{
|
|
@@ -75,10 +75,10 @@ export declare const PhaseSchema: z.ZodObject<{
|
|
|
75
75
|
id: z.ZodNumber;
|
|
76
76
|
name: z.ZodString;
|
|
77
77
|
status: z.ZodDefault<z.ZodEnum<{
|
|
78
|
+
blocked: "blocked";
|
|
78
79
|
pending: "pending";
|
|
79
80
|
in_progress: "in_progress";
|
|
80
81
|
completed: "completed";
|
|
81
|
-
blocked: "blocked";
|
|
82
82
|
closed: "closed";
|
|
83
83
|
complete: "complete";
|
|
84
84
|
}>>;
|
|
@@ -86,10 +86,10 @@ export declare const PhaseSchema: z.ZodObject<{
|
|
|
86
86
|
id: z.ZodString;
|
|
87
87
|
phase: z.ZodNumber;
|
|
88
88
|
status: z.ZodDefault<z.ZodEnum<{
|
|
89
|
+
blocked: "blocked";
|
|
89
90
|
pending: "pending";
|
|
90
91
|
in_progress: "in_progress";
|
|
91
92
|
completed: "completed";
|
|
92
|
-
blocked: "blocked";
|
|
93
93
|
closed: "closed";
|
|
94
94
|
}>>;
|
|
95
95
|
size: z.ZodDefault<z.ZodEnum<{
|
|
@@ -120,10 +120,10 @@ export declare const PlanSchema: z.ZodObject<{
|
|
|
120
120
|
id: z.ZodNumber;
|
|
121
121
|
name: z.ZodString;
|
|
122
122
|
status: z.ZodDefault<z.ZodEnum<{
|
|
123
|
+
blocked: "blocked";
|
|
123
124
|
pending: "pending";
|
|
124
125
|
in_progress: "in_progress";
|
|
125
126
|
completed: "completed";
|
|
126
|
-
blocked: "blocked";
|
|
127
127
|
closed: "closed";
|
|
128
128
|
complete: "complete";
|
|
129
129
|
}>>;
|
|
@@ -131,10 +131,10 @@ export declare const PlanSchema: z.ZodObject<{
|
|
|
131
131
|
id: z.ZodString;
|
|
132
132
|
phase: z.ZodNumber;
|
|
133
133
|
status: z.ZodDefault<z.ZodEnum<{
|
|
134
|
+
blocked: "blocked";
|
|
134
135
|
pending: "pending";
|
|
135
136
|
in_progress: "in_progress";
|
|
136
137
|
completed: "completed";
|
|
137
|
-
blocked: "blocked";
|
|
138
138
|
closed: "closed";
|
|
139
139
|
}>>;
|
|
140
140
|
size: z.ZodDefault<z.ZodEnum<{
|