opencode-swarm 7.109.2 → 7.109.4

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 (39) hide show
  1. package/.opencode/skills/ci-failure-batching/SKILL.md +39 -0
  2. package/.opencode/skills/gate-attribution/SKILL.md +31 -0
  3. package/.opencode/skills/merge-queue-readiness/SKILL.md +37 -0
  4. package/.opencode/skills/skill-edit-validation/SKILL.md +29 -0
  5. package/.opencode/skills/worktree-retry-cleanup/SKILL.md +24 -0
  6. package/dist/cli/{config-doctor-q354tb2w.js → config-doctor-9vjyj9m3.js} +2 -2
  7. package/dist/cli/{curator-llm-factory-wqbm9mwr.js → curator-llm-factory-3hf9xpnd.js} +9 -9
  8. package/dist/cli/{curator-6p9tpprq.js → curator-zn1kmwmz.js} +9 -9
  9. package/dist/cli/{guardrail-explain-ynge4ww3.js → guardrail-explain-hjz1k6w0.js} +10 -10
  10. package/dist/cli/{guardrail-log-8mqqsssq.js → guardrail-log-5240bawg.js} +3 -3
  11. package/dist/cli/{hive-promoter-qh2rh8x2.js → hive-promoter-j81yj97d.js} +9 -9
  12. package/dist/cli/{index-h4c4rrwx.js → index-18690p15.js} +23 -2
  13. package/dist/cli/{index-fz1jgbvw.js → index-41fgssqr.js} +22 -2
  14. package/dist/cli/{index-wg0665ft.js → index-8f10r7ay.js} +2 -2
  15. package/dist/cli/{index-9qxntjtx.js → index-b15qbvph.js} +190 -41
  16. package/dist/cli/{index-wj4jeavn.js → index-d3txrx5q.js} +1 -1
  17. package/dist/cli/{index-5gnp8fyw.js → index-mtzjbaaa.js} +3 -3
  18. package/dist/cli/{index-3qwaydq1.js → index-nvmy7xmj.js} +11 -11
  19. package/dist/cli/{index-vx76tcxe.js → index-p5vm9gy9.js} +1 -1
  20. package/dist/cli/{index-cqbqynzp.js → index-y3nx3ss0.js} +710 -557
  21. package/dist/cli/{index-mmny81g1.js → index-y5z2qdvk.js} +1 -1
  22. package/dist/cli/{index-8a8b5wjf.js → index-zh3qh6m7.js} +2 -2
  23. package/dist/cli/{index-fm7xz1ne.js → index-zjh648z4.js} +81 -1
  24. package/dist/cli/index.js +9 -9
  25. package/dist/cli/{knowledge-escalator-6v7sjprx.js → knowledge-escalator-9ksrgq7h.js} +3 -3
  26. package/dist/cli/{knowledge-events-6n3x3he2.js → knowledge-events-ymysgtrr.js} +1 -1
  27. package/dist/cli/{knowledge-store-exkw6yb1.js → knowledge-store-562fefjy.js} +1 -1
  28. package/dist/cli/{knowledge-validator-exymfcb9.js → knowledge-validator-b9nvmzjc.js} +4 -2
  29. package/dist/cli/{schema-x17zmd03.js → schema-5vmb5dh8.js} +3 -1
  30. package/dist/cli/{skill-generator-mx9br4ty.js → skill-generator-mjfqvnn0.js} +15 -5
  31. package/dist/config/bundled-skills.d.ts +1 -1
  32. package/dist/config/schema.d.ts +12 -4
  33. package/dist/hooks/knowledge-types.d.ts +6 -0
  34. package/dist/hooks/knowledge-validator.d.ts +5 -0
  35. package/dist/hooks/skill-invalidator.d.ts +48 -0
  36. package/dist/index.js +217 -216
  37. package/dist/services/skill-generator.d.ts +47 -2
  38. package/dist/tools/knowledge-remove.d.ts +3 -8
  39. package/package.json +6 -1
@@ -594,7 +594,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
594
594
  deltas.push({ id, delta });
595
595
  }
596
596
  if (deltas.length > 0) {
597
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-exkw6yb1.js");
597
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-562fefjy.js");
598
598
  await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
599
599
  }
600
600
  return {
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-cqbqynzp.js";
15
+ } from "./index-y3nx3ss0.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-wj4jeavn.js";
22
+ } from "./index-d3txrx5q.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
@@ -1,9 +1,11 @@
1
1
  // @bun
2
2
  import {
3
3
  ALL_AGENT_NAMES,
4
+ GATE_CONFIG_KNOWN_SECTION_KEYS,
5
+ GateConfigSchema,
4
6
  PluginConfigSchema,
5
7
  stripKnownSwarmPrefix
6
- } from "./index-h4c4rrwx.js";
8
+ } from "./index-18690p15.js";
7
9
  import {
8
10
  log
9
11
  } from "./index-zgwm4ryv.js";
@@ -13,6 +15,7 @@ import * as crypto from "crypto";
13
15
  import * as fs from "fs";
14
16
  import * as os from "os";
15
17
  import * as path from "path";
18
+ var CONFIG_DOCTOR_MAX_CONFIG_FILE_BYTES = 102400;
16
19
  var KNOWN_TOP_LEVEL_KEYS = new Set(Object.keys(PluginConfigSchema.shape));
17
20
  var DEPRECATED_FIELDS = new Map([
18
21
  [
@@ -79,6 +82,82 @@ function emitObjectTypeMismatch(key, value, findings) {
79
82
  });
80
83
  }
81
84
  }
85
+ function isPlainObject(value) {
86
+ return typeof value === "object" && value !== null && !Array.isArray(value);
87
+ }
88
+ function collectRawGatesConfigFindings(directory) {
89
+ const findings = [];
90
+ const { userConfigPath, projectConfigPath } = getConfigPaths(directory);
91
+ for (const configPath of [userConfigPath, projectConfigPath]) {
92
+ if (!fs.existsSync(configPath))
93
+ continue;
94
+ try {
95
+ const stats = fs.statSync(configPath);
96
+ if (stats.size > CONFIG_DOCTOR_MAX_CONFIG_FILE_BYTES)
97
+ continue;
98
+ const raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
99
+ if (!isPlainObject(raw) || raw.gates === undefined)
100
+ continue;
101
+ if (!isPlainObject(raw.gates)) {
102
+ findings.push({
103
+ id: "invalid-gates-config",
104
+ title: "Invalid gates config",
105
+ description: `"gates" in ${configPath} must be an object. The loader ignores that section and keeps other valid config sections active.`,
106
+ severity: "error",
107
+ path: "gates",
108
+ currentValue: raw.gates,
109
+ autoFixable: false
110
+ });
111
+ continue;
112
+ }
113
+ for (const [sectionName, sectionValue] of Object.entries(raw.gates)) {
114
+ const schema = GateConfigSchema.shape[sectionName];
115
+ if (!schema) {
116
+ findings.push({
117
+ id: "unknown-gates-section",
118
+ title: "Unknown gates config section",
119
+ description: `Unknown gates section "gates.${sectionName}" in ${configPath} is ignored by the loader.`,
120
+ severity: "warn",
121
+ path: `gates.${sectionName}`,
122
+ currentValue: sectionValue,
123
+ autoFixable: false
124
+ });
125
+ continue;
126
+ }
127
+ const knownFields = GATE_CONFIG_KNOWN_SECTION_KEYS[sectionName];
128
+ if (knownFields && isPlainObject(sectionValue)) {
129
+ const knownFieldSet = new Set(knownFields);
130
+ for (const fieldName of Object.keys(sectionValue)) {
131
+ if (!knownFieldSet.has(fieldName)) {
132
+ findings.push({
133
+ id: "unknown-gates-key",
134
+ title: "Unknown gates config key",
135
+ description: `Unknown gates key "gates.${sectionName}.${fieldName}" in ${configPath} is ignored by the loader.`,
136
+ severity: "warn",
137
+ path: `gates.${sectionName}.${fieldName}`,
138
+ currentValue: sectionValue[fieldName],
139
+ autoFixable: false
140
+ });
141
+ }
142
+ }
143
+ }
144
+ const sectionResult = schema.safeParse(sectionValue);
145
+ if (!sectionResult.success) {
146
+ findings.push({
147
+ id: "invalid-gates-section",
148
+ title: "Invalid gates config section",
149
+ description: `"gates.${sectionName}" in ${configPath} failed validation. The loader uses defaults for that gate section and keeps other valid config sections active.`,
150
+ severity: "error",
151
+ path: `gates.${sectionName}`,
152
+ currentValue: sectionValue,
153
+ autoFixable: false
154
+ });
155
+ }
156
+ }
157
+ } catch {}
158
+ }
159
+ return findings;
160
+ }
82
161
  function emitWorktreeIsolationLayeringAdvisory(config, findings) {
83
162
  const parallelization = config.parallelization;
84
163
  const worktreePolicy = config.worktree?.policy ?? "auto";
@@ -927,6 +1006,7 @@ function walkConfigAndValidate(obj, path2, findings, visited = new WeakSet) {
927
1006
  function runConfigDoctor(config, directory) {
928
1007
  const findings = [];
929
1008
  walkConfigAndValidate(config, "", findings);
1009
+ findings.push(...collectRawGatesConfigFindings(directory));
930
1010
  emitWorktreeIsolationLayeringAdvisory(config, findings);
931
1011
  const summary = {
932
1012
  info: findings.filter((f) => f.severity === "info").length,
package/dist/cli/index.js CHANGED
@@ -7,11 +7,11 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-cqbqynzp.js";
11
- import"./index-wj4jeavn.js";
12
- import"./index-5gnp8fyw.js";
10
+ } from "./index-y3nx3ss0.js";
11
+ import"./index-d3txrx5q.js";
12
+ import"./index-mtzjbaaa.js";
13
13
  import"./index-c8s9a3zh.js";
14
- import"./index-fm7xz1ne.js";
14
+ import"./index-zjh648z4.js";
15
15
  import"./index-j2v3w1ds.js";
16
16
  import"./index-scww5b77.js";
17
17
  import"./index-yw8qpf51.js";
@@ -19,11 +19,11 @@ import"./index-85bacexr.js";
19
19
  import"./index-09xpycan.js";
20
20
  import {
21
21
  DEFAULT_AGENT_CONFIGS
22
- } from "./index-h4c4rrwx.js";
23
- import"./index-9qxntjtx.js";
24
- import"./index-mmny81g1.js";
25
- import"./index-fz1jgbvw.js";
26
- import"./index-wg0665ft.js";
22
+ } from "./index-18690p15.js";
23
+ import"./index-b15qbvph.js";
24
+ import"./index-y5z2qdvk.js";
25
+ import"./index-41fgssqr.js";
26
+ import"./index-8f10r7ay.js";
27
27
  import"./index-2nt4mq9n.js";
28
28
  import"./index-bfwt3abw.js";
29
29
  import"./index-wvrj16f0.js";
@@ -8,9 +8,9 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-5gnp8fyw.js";
12
- import"./index-mmny81g1.js";
13
- import"./index-wg0665ft.js";
11
+ } from "./index-mtzjbaaa.js";
12
+ import"./index-y5z2qdvk.js";
13
+ import"./index-8f10r7ay.js";
14
14
  import"./index-2nt4mq9n.js";
15
15
  import"./index-bfwt3abw.js";
16
16
  import"./index-jtqkh8jf.js";
@@ -25,7 +25,7 @@ import {
25
25
  resolveKnowledgeCounterBaselinePath,
26
26
  resolveKnowledgeEventsPath,
27
27
  resolveLegacyApplicationLogPath
28
- } from "./index-mmny81g1.js";
28
+ } from "./index-y5z2qdvk.js";
29
29
  import"./index-2nt4mq9n.js";
30
30
  import"./index-zgwm4ryv.js";
31
31
  import"./index-1cn967sa.js";
@@ -32,7 +32,7 @@ import {
32
32
  transactFile,
33
33
  transactKnowledge,
34
34
  wordBigrams
35
- } from "./index-wg0665ft.js";
35
+ } from "./index-8f10r7ay.js";
36
36
  import"./index-2nt4mq9n.js";
37
37
  import"./index-bfwt3abw.js";
38
38
  import"./index-jtqkh8jf.js";
@@ -8,6 +8,7 @@ import {
8
8
  DANGEROUS_COMMAND_WARNING_PATTERNS,
9
9
  INJECTION_PATTERNS,
10
10
  INVISIBLE_FORMAT_CHARS,
11
+ RETIRED_SKILL_HISTORY_MAX,
11
12
  SECURITY_DEGRADING_PATTERNS,
12
13
  _internals,
13
14
  appendUnactionable,
@@ -21,8 +22,8 @@ import {
21
22
  validateLesson,
22
23
  validateSkillCandidatePath,
23
24
  validateSkillPath
24
- } from "./index-fz1jgbvw.js";
25
- import"./index-wg0665ft.js";
25
+ } from "./index-41fgssqr.js";
26
+ import"./index-8f10r7ay.js";
26
27
  import"./index-2nt4mq9n.js";
27
28
  import"./index-bfwt3abw.js";
28
29
  import"./index-jtqkh8jf.js";
@@ -47,6 +48,7 @@ export {
47
48
  appendUnactionable,
48
49
  _internals,
49
50
  SECURITY_DEGRADING_PATTERNS,
51
+ RETIRED_SKILL_HISTORY_MAX,
50
52
  INVISIBLE_FORMAT_CHARS,
51
53
  INJECTION_PATTERNS,
52
54
  DANGEROUS_COMMAND_WARNING_PATTERNS,
@@ -33,6 +33,7 @@ import {
33
33
  ExternalSkillCandidateSchema,
34
34
  ExternalSkillCandidateSourceTypeSchema,
35
35
  ExternalSkillsConfigSchema,
36
+ GATE_CONFIG_KNOWN_SECTION_KEYS,
36
37
  GateConfigSchema,
37
38
  GateFeatureSchema,
38
39
  GeneralCouncilConfigSchema,
@@ -85,7 +86,7 @@ import {
85
86
  resolveGeneratedAgentRole,
86
87
  resolveGuardrailsConfig,
87
88
  stripKnownSwarmPrefix
88
- } from "./index-h4c4rrwx.js";
89
+ } from "./index-18690p15.js";
89
90
  import"./index-bfwt3abw.js";
90
91
  import"./index-p0arc26j.js";
91
92
  import"./index-293f68mj.js";
@@ -143,6 +144,7 @@ export {
143
144
  GeneralCouncilConfigSchema,
144
145
  GateFeatureSchema,
145
146
  GateConfigSchema,
147
+ GATE_CONFIG_KNOWN_SECTION_KEYS,
146
148
  ExternalSkillsConfigSchema,
147
149
  ExternalSkillCandidateSourceTypeSchema,
148
150
  ExternalSkillCandidateSchema,
@@ -9,10 +9,13 @@ import {
9
9
  activePath,
10
10
  activeRepoRelativePath,
11
11
  autoApplyProposals,
12
+ clearDraftSkillLinks,
13
+ clearRetiredSkillLinks,
12
14
  clearSkillStale,
13
15
  clusterEntries,
14
16
  findSkillsBySourceKnowledgeId,
15
17
  findStaleSkillsBySourceKnowledgeId,
18
+ generateEvalStub,
16
19
  generateSkills,
17
20
  inspectSkill,
18
21
  isSkillMaturityEligible,
@@ -21,16 +24,18 @@ import {
21
24
  markSkillStale,
22
25
  parseDraftFrontmatter,
23
26
  proposalPath,
27
+ proposalRepoRelativePath,
24
28
  regenerateSkill,
25
29
  renderSkillMarkdown,
26
30
  retireOrMarkStale,
27
31
  retireSkill,
28
32
  sanitizeSlug,
29
- selectCandidateEntries
30
- } from "./index-9qxntjtx.js";
31
- import"./index-mmny81g1.js";
32
- import"./index-fz1jgbvw.js";
33
- import"./index-wg0665ft.js";
33
+ selectCandidateEntries,
34
+ writeEvalStub
35
+ } from "./index-b15qbvph.js";
36
+ import"./index-y5z2qdvk.js";
37
+ import"./index-41fgssqr.js";
38
+ import"./index-8f10r7ay.js";
34
39
  import"./index-2nt4mq9n.js";
35
40
  import"./index-bfwt3abw.js";
36
41
  import"./index-jtqkh8jf.js";
@@ -42,12 +47,14 @@ import"./index-vvk2g744.js";
42
47
  import"./index-7xgqky26.js";
43
48
  import"./index-a76rekgs.js";
44
49
  export {
50
+ writeEvalStub,
45
51
  selectCandidateEntries,
46
52
  sanitizeSlug,
47
53
  retireSkill,
48
54
  retireOrMarkStale,
49
55
  renderSkillMarkdown,
50
56
  regenerateSkill,
57
+ proposalRepoRelativePath,
51
58
  proposalPath,
52
59
  parseDraftFrontmatter,
53
60
  markSkillStale,
@@ -56,10 +63,13 @@ export {
56
63
  isSkillMaturityEligible,
57
64
  inspectSkill,
58
65
  generateSkills,
66
+ generateEvalStub,
59
67
  findStaleSkillsBySourceKnowledgeId,
60
68
  findSkillsBySourceKnowledgeId,
61
69
  clusterEntries,
62
70
  clearSkillStale,
71
+ clearRetiredSkillLinks,
72
+ clearDraftSkillLinks,
63
73
  autoApplyProposals,
64
74
  activeRepoRelativePath,
65
75
  activePath,
@@ -1,4 +1,4 @@
1
- export declare const BUNDLED_PROJECT_SKILLS: readonly ["brainstorm", "specify", "clarify-spec", "resume", "clarify", "discover", "consult", "pre-phase-briefing", "council", "deep-dive", "deep-research", "codebase-review-swarm", "swarm-implement", "design-docs", "swarm-pr-review", "swarm-pr-feedback", "swarm-pr-subscribe", "issue-ingest", "plan", "critic-gate", "execute", "phase-wrap", "loop", "writing-tests", "running-tests", "engineering-conventions", "commit-pr"];
1
+ export declare const BUNDLED_PROJECT_SKILLS: readonly ["brainstorm", "specify", "clarify-spec", "resume", "clarify", "discover", "consult", "pre-phase-briefing", "council", "deep-dive", "deep-research", "codebase-review-swarm", "swarm-implement", "design-docs", "swarm-pr-review", "swarm-pr-feedback", "swarm-pr-subscribe", "issue-ingest", "plan", "critic-gate", "execute", "phase-wrap", "loop", "writing-tests", "running-tests", "engineering-conventions", "commit-pr", "worktree-retry-cleanup", "skill-edit-validation", "merge-queue-readiness", "gate-attribution", "ci-failure-batching"];
2
2
  interface CopyState {
3
3
  files: number;
4
4
  bytes: number;
@@ -285,6 +285,14 @@ export declare const QualityBudgetConfigSchema: z.ZodObject<{
285
285
  exclude_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
286
286
  }, z.core.$strip>;
287
287
  export type QualityBudgetConfig = z.infer<typeof QualityBudgetConfigSchema>;
288
+ export declare const GATE_CONFIG_KNOWN_SECTION_KEYS: {
289
+ readonly syntax_check: readonly ["enabled"];
290
+ readonly placeholder_scan: readonly ["enabled", "deny_patterns", "allow_globs", "max_allowed_findings"];
291
+ readonly sast_scan: readonly ["enabled"];
292
+ readonly sbom_generate: readonly ["enabled"];
293
+ readonly build_check: readonly ["enabled"];
294
+ readonly quality_budget: readonly ["enabled", "max_complexity_delta", "max_public_api_delta", "max_duplication_ratio", "min_test_to_code_ratio", "enforce_on_globs", "exclude_globs"];
295
+ };
288
296
  export declare const GateConfigSchema: z.ZodObject<{
289
297
  syntax_check: z.ZodDefault<z.ZodObject<{
290
298
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -304,7 +312,7 @@ export declare const GateConfigSchema: z.ZodObject<{
304
312
  build_check: z.ZodDefault<z.ZodObject<{
305
313
  enabled: z.ZodDefault<z.ZodBoolean>;
306
314
  }, z.core.$strip>>;
307
- quality_budget: z.ZodObject<{
315
+ quality_budget: z.ZodDefault<z.ZodObject<{
308
316
  enabled: z.ZodDefault<z.ZodBoolean>;
309
317
  max_complexity_delta: z.ZodDefault<z.ZodNumber>;
310
318
  max_public_api_delta: z.ZodDefault<z.ZodNumber>;
@@ -312,7 +320,7 @@ export declare const GateConfigSchema: z.ZodObject<{
312
320
  min_test_to_code_ratio: z.ZodDefault<z.ZodNumber>;
313
321
  enforce_on_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
314
322
  exclude_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
315
- }, z.core.$strip>;
323
+ }, z.core.$strip>>;
316
324
  }, z.core.$strip>;
317
325
  export type GateConfig = z.infer<typeof GateConfigSchema>;
318
326
  export declare const PipelineConfigSchema: z.ZodObject<{
@@ -1624,7 +1632,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
1624
1632
  build_check: z.ZodDefault<z.ZodObject<{
1625
1633
  enabled: z.ZodDefault<z.ZodBoolean>;
1626
1634
  }, z.core.$strip>>;
1627
- quality_budget: z.ZodObject<{
1635
+ quality_budget: z.ZodDefault<z.ZodObject<{
1628
1636
  enabled: z.ZodDefault<z.ZodBoolean>;
1629
1637
  max_complexity_delta: z.ZodDefault<z.ZodNumber>;
1630
1638
  max_public_api_delta: z.ZodDefault<z.ZodNumber>;
@@ -1632,7 +1640,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
1632
1640
  min_test_to_code_ratio: z.ZodDefault<z.ZodNumber>;
1633
1641
  enforce_on_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
1634
1642
  exclude_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
1635
- }, z.core.$strip>;
1643
+ }, z.core.$strip>>;
1636
1644
  }, z.core.$strip>>;
1637
1645
  context_budget: z.ZodOptional<z.ZodObject<{
1638
1646
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -90,6 +90,12 @@ export interface ActionableDirectiveFields {
90
90
  generated_skill_slug?: string;
91
91
  /** Repo-local path to generated SKILL.md. */
92
92
  generated_skill_path?: string;
93
+ /** G10 (issue #1717): slug of a draft proposal compiled from this entry. */
94
+ draft_generated_skill_slug?: string;
95
+ /** G10 (issue #1717): repo-local path to the draft proposal. */
96
+ draft_generated_skill_path?: string;
97
+ /** G12 (issue #1717): retired skill slugs previously generated from this entry. */
98
+ retired_skill_history?: string[];
93
99
  /** Directive priority for ranking/enforcement. */
94
100
  directive_priority?: DirectivePriority;
95
101
  /**
@@ -35,6 +35,11 @@ export declare function validateLesson(candidate: string, existingLessons: strin
35
35
  export declare const ACTIONABLE_STRING_MAX = 200;
36
36
  /** Maximum number of items in any actionable list (triggers, required_actions, etc.). */
37
37
  export declare const ACTIONABLE_LIST_MAX = 20;
38
+ /**
39
+ * Maximum retired_skill_history entries. Must match the FIFO cap in
40
+ * src/services/skill-generator.ts's clearSkillLinks (`if (history.length > 50)`).
41
+ */
42
+ export declare const RETIRED_SKILL_HISTORY_MAX = 50;
38
43
  /** Generated skill paths must be repo-local under one of these prefixes. */
39
44
  export declare const ALLOWED_SKILL_PATH_PREFIXES: string[];
40
45
  export interface ActionableValidationResult {
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Shared skill-invalidation helper for knowledge archival/removal paths.
3
+ *
4
+ * Issue #1717 (G11): the tombstone + retire/stale invalidation sequence was
5
+ * inlined independently in `knowledge-archive.ts` and `knowledge-remove.ts`,
6
+ * and was entirely absent from the curator archive recommendation path. This
7
+ * module is the single shared entry point all three callers use so they can
8
+ * no longer diverge.
9
+ *
10
+ * Contract:
11
+ * - Writes an audit tombstone (fire-and-forget, fail-open) unless
12
+ * `skipTombstone:true` (knowledge-remove hard-deletes and historically
13
+ * wrote no tombstone; that behavior is preserved).
14
+ * - Schedules a microtask that retires/marks-stale every generated skill
15
+ * whose source_knowledge_ids reference the archived entry.
16
+ * - Never throws.
17
+ */
18
+ import { findSkillsBySourceKnowledgeId, findStaleSkillsBySourceKnowledgeId, retireOrMarkStale } from '../services/skill-generator.js';
19
+ import { recordHiveKnowledgeEvent, recordKnowledgeEvent } from './knowledge-events.js';
20
+ import { getArchivedKnowledgeIds } from './knowledge-store.js';
21
+ export interface ArchiveInvalidationContext {
22
+ directory: string;
23
+ entryId: string;
24
+ tier: 'swarm' | 'hive';
25
+ actor: string;
26
+ reason: string;
27
+ mode: 'archive' | 'quarantine' | 'purge';
28
+ evidence?: string;
29
+ previousStatus?: string;
30
+ skipTombstone?: boolean;
31
+ sourceLabel?: string;
32
+ /**
33
+ * Pre-computed archived-ID set for callers invalidating multiple entries
34
+ * in one batch (e.g. curator processing several archive recommendations).
35
+ * Skips this call's own `getArchivedKnowledgeIds` scan when provided.
36
+ */
37
+ precomputedArchivedIds?: Set<string>;
38
+ }
39
+ export declare function writeArchiveTombstoneAndInvalidateSkills(ctx: ArchiveInvalidationContext): Promise<void>;
40
+ export declare const _internals: {
41
+ writeArchiveTombstoneAndInvalidateSkills: typeof writeArchiveTombstoneAndInvalidateSkills;
42
+ recordKnowledgeEvent: typeof recordKnowledgeEvent;
43
+ recordHiveKnowledgeEvent: typeof recordHiveKnowledgeEvent;
44
+ getArchivedKnowledgeIds: typeof getArchivedKnowledgeIds;
45
+ findSkillsBySourceKnowledgeId: typeof findSkillsBySourceKnowledgeId;
46
+ findStaleSkillsBySourceKnowledgeId: typeof findStaleSkillsBySourceKnowledgeId;
47
+ retireOrMarkStale: typeof retireOrMarkStale;
48
+ };