melchizedek-agents 1.0.3 → 1.2.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 (172) hide show
  1. package/.env.example +29 -2
  2. package/AGENT_SETUP.md +3 -1
  3. package/CHANGELOG.md +524 -0
  4. package/DOCUMENTATION.md +178 -43
  5. package/ONBOARDING.md +339 -0
  6. package/QUICKSTART.md +15 -2
  7. package/README.md +6 -2
  8. package/config/agents/README.md +2 -2
  9. package/config/agents/examples/ares.yaml +6 -10
  10. package/config/agents/examples/assistant.yaml +6 -6
  11. package/config/agents/examples/augustin.yaml +9 -15
  12. package/config/agents/examples/cartographers.yaml +6 -6
  13. package/config/agents/examples/council.yaml +7 -7
  14. package/config/agents/examples/critic.yaml +24 -24
  15. package/config/agents/examples/harness.yaml +4 -4
  16. package/config/agents/examples/image_production.yaml +37 -35
  17. package/config/agents/examples/librarian.yaml +4 -4
  18. package/config/agents/examples/patient_advocate.yaml +6 -10
  19. package/config/agents/examples/pipeline.yaml +20 -19
  20. package/config/agents/examples/research.yaml +36 -43
  21. package/config/agents/examples/scribe.yaml +31 -32
  22. package/config/agents/examples/scriptorium.yaml +6 -6
  23. package/config/agents/examples/structured_critic.yaml +82 -0
  24. package/config/agents/examples/style_council.yaml +9 -11
  25. package/config/agents/examples/syndicate.yaml +3 -5
  26. package/config/agents/examples/tutor.yaml +2 -2
  27. package/config/agents/examples/weather.yaml +2 -2
  28. package/config/agents/syndicate.schema.json +859 -13
  29. package/config/agents/syndicateSchema.yaml +122 -73
  30. package/config/agents/templates/README.md +1 -1
  31. package/config/agents/templates/account_memory.yaml +4 -4
  32. package/config/agents/templates/case_desk.yaml +6 -6
  33. package/config/agents/templates/conversational.yaml +2 -2
  34. package/config/agents/templates/draft_review.yaml +6 -6
  35. package/config/agents/templates/intake_extractor.yaml +64 -62
  36. package/config/agents/templates/research_brief.yaml +6 -6
  37. package/config/agents/templates/research_desk.yaml +6 -6
  38. package/config/agents/templates/review_panel.yaml +8 -8
  39. package/config/agents/templates/support_triage.yaml +30 -29
  40. package/config/agents/templates/systems_operator.yaml +24 -5
  41. package/db/migrations/0014_durable_runs.sql +31 -0
  42. package/dist/lib/a2a/app.d.ts +27 -0
  43. package/dist/lib/a2a/app.js +64 -5
  44. package/dist/lib/a2a/executor.d.ts +7 -1
  45. package/dist/lib/a2a/executor.js +43 -5
  46. package/dist/lib/a2a/oauthSetup.d.ts +106 -0
  47. package/dist/lib/a2a/oauthSetup.js +259 -0
  48. package/dist/lib/agentDialect.d.ts +76 -0
  49. package/dist/lib/agentDialect.js +151 -0
  50. package/dist/lib/compile.d.ts +42 -6
  51. package/dist/lib/compile.js +97 -45
  52. package/dist/lib/compileNative.d.ts +11 -3
  53. package/dist/lib/compileNative.js +20 -1
  54. package/dist/lib/dispatch.d.ts +10 -5
  55. package/dist/lib/dispatch.js +10 -5
  56. package/dist/lib/doctor.d.ts +110 -1
  57. package/dist/lib/doctor.js +205 -9
  58. package/dist/lib/loadSyndicate.d.ts +54 -2
  59. package/dist/lib/loadSyndicate.js +22 -2
  60. package/dist/lib/memory/namespace.d.ts +6 -5
  61. package/dist/lib/memory/namespace.js +6 -5
  62. package/dist/lib/memory/providers.js +3 -4
  63. package/dist/lib/models/capabilities.d.ts +25 -1
  64. package/dist/lib/models/capabilities.js +79 -1
  65. package/dist/lib/models/chatCompletionsAdapter.d.ts +11 -3
  66. package/dist/lib/models/chatCompletionsAdapter.js +19 -5
  67. package/dist/lib/models/claudeAdapter.js +4 -0
  68. package/dist/lib/models/contract.d.ts +5 -2
  69. package/dist/lib/models/gateway.d.ts +2 -1
  70. package/dist/lib/models/gateway.js +4 -2
  71. package/dist/lib/models/gatewayAdapter.d.ts +7 -1
  72. package/dist/lib/models/gatewayAdapter.js +8 -0
  73. package/dist/lib/models/geminiAdapter.js +8 -2
  74. package/dist/lib/models/genaiMapping.d.ts +8 -4
  75. package/dist/lib/models/genaiMapping.js +23 -9
  76. package/dist/lib/models/gptAdapter.d.ts +4 -2
  77. package/dist/lib/models/gptAdapter.js +11 -4
  78. package/dist/lib/models/grokAdapter.d.ts +3 -1
  79. package/dist/lib/models/grokAdapter.js +11 -3
  80. package/dist/lib/models/kimiAdapter.d.ts +2 -1
  81. package/dist/lib/models/kimiAdapter.js +3 -3
  82. package/dist/lib/models/reasoning.d.ts +30 -2
  83. package/dist/lib/models/reasoning.js +56 -5
  84. package/dist/lib/observability/tracer.d.ts +8 -1
  85. package/dist/lib/observability/tracer.js +33 -5
  86. package/dist/lib/onboarding.d.ts +134 -0
  87. package/dist/lib/onboarding.js +539 -0
  88. package/dist/lib/runtime/approvals.d.ts +8 -0
  89. package/dist/lib/runtime/approvals.js +4 -3
  90. package/dist/lib/runtime/credentials.d.ts +6 -0
  91. package/dist/lib/runtime/native/agentLoop.d.ts +23 -3
  92. package/dist/lib/runtime/native/agentLoop.js +107 -11
  93. package/dist/lib/runtime/native/checkpoint.d.ts +171 -0
  94. package/dist/lib/runtime/native/checkpoint.js +359 -0
  95. package/dist/lib/runtime/native/delegate.d.ts +222 -18
  96. package/dist/lib/runtime/native/delegate.js +390 -39
  97. package/dist/lib/runtime/native/interrupts.d.ts +184 -2
  98. package/dist/lib/runtime/native/interrupts.js +391 -1
  99. package/dist/lib/runtime/native/request.d.ts +13 -3
  100. package/dist/lib/runtime/native/request.js +28 -4
  101. package/dist/lib/runtime/native/telemetry.js +10 -15
  102. package/dist/lib/runtime/questions.d.ts +7 -4
  103. package/dist/lib/runtime/sessions.d.ts +1 -1
  104. package/dist/lib/runtime/syndicateTurn.d.ts +11 -3
  105. package/dist/lib/runtime/syndicateTurn.js +353 -68
  106. package/dist/lib/runtime/turnControl.d.ts +56 -0
  107. package/dist/lib/runtime/turnControl.js +10 -0
  108. package/dist/lib/session/transcript.d.ts +9 -0
  109. package/dist/lib/session/transcript.js +20 -1
  110. package/dist/lib/skills.d.ts +18 -0
  111. package/dist/lib/skills.js +73 -1
  112. package/dist/lib/storage/postgres/index.d.ts +12 -2
  113. package/dist/lib/storage/postgres/index.js +8 -3
  114. package/dist/lib/storage/postgres/taskQueue.d.ts +20 -4
  115. package/dist/lib/storage/postgres/taskQueue.js +29 -5
  116. package/dist/lib/storage/postgres/taskStore.d.ts +26 -2
  117. package/dist/lib/storage/postgres/taskStore.js +74 -8
  118. package/dist/lib/syndicateSchema.d.ts +316 -1
  119. package/dist/lib/syndicateSchema.js +203 -29
  120. package/dist/lib/tools/auth.d.ts +20 -6
  121. package/dist/lib/tools/auth.js +21 -5
  122. package/dist/lib/tools/credentialEnv.d.ts +28 -0
  123. package/dist/lib/tools/credentialEnv.js +52 -0
  124. package/dist/lib/tools/credentialHosts.d.ts +88 -0
  125. package/dist/lib/tools/credentialHosts.js +165 -0
  126. package/dist/lib/tools/credentialStore.js +9 -2
  127. package/dist/lib/tools/credentialUses.d.ts +92 -0
  128. package/dist/lib/tools/credentialUses.js +112 -0
  129. package/dist/lib/tools/mcpToolFactory.d.ts +25 -2
  130. package/dist/lib/tools/mcpToolFactory.js +179 -21
  131. package/dist/lib/tools/oauthConsent.js +8 -1
  132. package/dist/lib/tools/oauthHosts.d.ts +73 -0
  133. package/dist/lib/tools/oauthHosts.js +154 -0
  134. package/dist/lib/tools/oauthTools.d.ts +242 -0
  135. package/dist/lib/tools/oauthTools.js +447 -0
  136. package/dist/lib/tools/openapiTools.d.ts +11 -6
  137. package/dist/lib/tools/openapiTools.js +88 -38
  138. package/dist/lib/tools/taskTools.d.ts +61 -6
  139. package/dist/lib/tools/taskTools.js +145 -21
  140. package/dist/lib/workflow/turn.d.ts +22 -3
  141. package/dist/lib/workflow/turn.js +151 -31
  142. package/dist/lib/workflow.d.ts +14 -7
  143. package/dist/lib/workflow.js +14 -7
  144. package/dist/lib/workflowConfig.d.ts +6 -0
  145. package/dist/scripts/a2a_server.d.ts +36 -0
  146. package/dist/scripts/a2a_server.js +131 -1
  147. package/dist/scripts/assistant_worker.d.ts +12 -0
  148. package/dist/scripts/assistant_worker.js +81 -22
  149. package/dist/scripts/doctor.d.ts +7 -2
  150. package/dist/scripts/doctor.js +9 -4
  151. package/dist/scripts/setup.d.ts +23 -0
  152. package/dist/scripts/setup.js +154 -0
  153. package/dist/scripts/skills_install.d.ts +3 -1
  154. package/dist/scripts/skills_install.js +17 -2
  155. package/dist/scripts/yaml_codemod.d.ts +62 -0
  156. package/dist/scripts/yaml_codemod.js +652 -0
  157. package/package.json +8 -2
  158. package/skills/README.md +11 -2
  159. package/skills/briefs/_shared.md +1 -1
  160. package/skills/briefs/melchizedek-author.md +7 -5
  161. package/skills/briefs/melchizedek-models.md +7 -4
  162. package/skills/briefs/melchizedek.md +1 -0
  163. package/skills/briefs/skills-readme.md +3 -1
  164. package/skills/melchizedek/SKILL.md +1 -0
  165. package/skills/melchizedek-author/SKILL.md +7 -4
  166. package/skills/melchizedek-author/assets/minimal.yaml +13 -13
  167. package/skills/melchizedek-models/SKILL.md +11 -4
  168. package/skills/melchizedek-onboard/SKILL.md +49 -0
  169. package/skills/melchizedek-onboard-cloud/SKILL.md +38 -0
  170. package/skills/melchizedek-onboard-keys/SKILL.md +35 -0
  171. package/skills/melchizedek-onboard-local/SKILL.md +41 -0
  172. package/skills/melchizedek-onboard-serve/SKILL.md +43 -0
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * scripts/setup.ts — the `melchizedek-setup` bin and `npm run setup`.
4
+ *
5
+ * The onboarding command: a menu of authentication levels (no key, one
6
+ * provider, several, a gateway, a cloud platform, per-caller keys, caller
7
+ * tokens, OAuth tool grants, and an honest entry for subscription sign-ins),
8
+ * each with a startup guide: the variables to set (names and shapes only),
9
+ * the doctor command that confirms it, the shipped files that run there and
10
+ * the first commands to try. The levels and guides live in lib/onboarding.ts;
11
+ * ONBOARDING.md is generated from the same function.
12
+ *
13
+ * npx melchizedek-setup # the menu (interactive terminal)
14
+ * npx melchizedek-setup --auto # detect from the environment, names only
15
+ * npx melchizedek-setup --level gateway # one guide, by id or number
16
+ * npx melchizedek-setup --level 2 --write-env # also create .env from .env.example
17
+ * npx melchizedek-setup --list
18
+ * npx melchizedek-setup --markdown # ONBOARDING.md, regenerated
19
+ *
20
+ * Never prints a value. `--write-env` never overwrites `.env`, leaves every
21
+ * name blank, and refuses unless `git check-ignore` confirms `.env` is ignored.
22
+ */
23
+ import { realpathSync } from 'node:fs';
24
+ import { createInterface } from 'node:readline/promises';
25
+ import { fileURLToPath, pathToFileURL } from 'node:url';
26
+ import { loadEnv } from '../lib/loadEnv.js';
27
+ import { runDoctor } from '../lib/doctor.js';
28
+ import { detectLevels, highestLevel, LEVELS, levelById, renderAuto, renderGuide, renderMenu, renderOnboardingDoc, writeEnvForLevel, } from '../lib/onboarding.js';
29
+ const USAGE = `melchizedek-setup — start from what you have
30
+
31
+ melchizedek-setup the menu of authentication levels
32
+ melchizedek-setup --auto detect the highest level from the environment (names only)
33
+ melchizedek-setup --level <id|number> print one level's startup guide
34
+ melchizedek-setup --list the levels
35
+ melchizedek-setup --markdown every guide as Markdown (ONBOARDING.md)
36
+
37
+ --write-env with --level or --auto: create .env from .env.example with the level's
38
+ names left blank (never overwrites; requires git to ignore .env)
39
+ --clone | --package spell commands for a clone or an installed package (default: detected)
40
+
41
+ Levels:
42
+ ${renderMenu()}
43
+ `;
44
+ function pickLevel(raw) {
45
+ const n = Number(raw);
46
+ if (Number.isInteger(n) && n >= 1 && n <= LEVELS.length)
47
+ return LEVELS[n - 1];
48
+ return levelById(raw.trim());
49
+ }
50
+ function writeEnv(level) {
51
+ const r = writeEnvForLevel(level);
52
+ switch (r.status) {
53
+ case 'written':
54
+ console.log(`\n✓ wrote ${r.path} (mode 600) from .env.example${r.added.length ? `, adding blank: ${r.added.join(', ')}` : ''}. Fill in the values yourself, in your editor.`);
55
+ return 0;
56
+ case 'exists':
57
+ console.log(`\n· kept ${r.path}: it exists, and setup never overwrites it. Add the names above to it yourself.`);
58
+ return 0;
59
+ case 'not-ignored':
60
+ console.error(`\n✗ did not write .env: ${r.reason}`);
61
+ return 1;
62
+ case 'no-template':
63
+ console.error('\n✗ did not write .env: .env.example was not found beside the package');
64
+ return 1;
65
+ }
66
+ }
67
+ export async function main(argv = process.argv.slice(2)) {
68
+ const args = argv.filter((a) => a !== '--');
69
+ const flag = (name) => {
70
+ const i = args.indexOf(`--${name}`);
71
+ return i >= 0 && i + 1 < args.length ? args[i + 1] : undefined;
72
+ };
73
+ const inPackage = fileURLToPath(import.meta.url).includes('node_modules');
74
+ const form = args.includes('--clone') ? 'clone' : args.includes('--package') ? 'package' : inPackage ? 'package' : 'clone';
75
+ if (args.includes('--help') || args.includes('-h')) {
76
+ console.log(USAGE);
77
+ return 0;
78
+ }
79
+ if (args.includes('--list')) {
80
+ console.log(renderMenu());
81
+ return 0;
82
+ }
83
+ if (args.includes('--markdown')) {
84
+ process.stdout.write(renderOnboardingDoc());
85
+ return 0;
86
+ }
87
+ let level;
88
+ if (args.includes('--auto')) {
89
+ loadEnv();
90
+ const result = runDoctor();
91
+ console.log(renderAuto(result, form));
92
+ if (!args.includes('--write-env'))
93
+ return 0;
94
+ return writeEnv(highestLevel(detectLevels(result)));
95
+ }
96
+ const raw = flag('level');
97
+ if (raw !== undefined) {
98
+ level = pickLevel(raw);
99
+ if (!level) {
100
+ console.error(`✗ unknown level "${raw}"\n\n${USAGE}`);
101
+ return 2;
102
+ }
103
+ console.log(renderGuide(level, form));
104
+ return args.includes('--write-env') ? writeEnv(level) : 0;
105
+ }
106
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
107
+ console.log(USAGE);
108
+ return 0;
109
+ }
110
+ // The interactive menu.
111
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
112
+ try {
113
+ console.log(`What do you have? Pick the closest; you can come back for another.\n\n${renderMenu()}\n`);
114
+ const answer = (await rl.question(`Level [1-${LEVELS.length}], a = detect from my environment, q = quit: `)).trim().toLowerCase();
115
+ if (answer === 'q' || answer === '')
116
+ return 0;
117
+ if (answer === 'a') {
118
+ loadEnv();
119
+ console.log(`\n${renderAuto(runDoctor(), form)}`);
120
+ return 0;
121
+ }
122
+ level = pickLevel(answer);
123
+ if (!level) {
124
+ console.error(`✗ "${answer}" is not a level`);
125
+ return 2;
126
+ }
127
+ console.log(`\n${renderGuide(level, form)}\n`);
128
+ if (level.detectable) {
129
+ const write = (await rl.question('Create .env from .env.example with these names left blank? (never overwrites) [y/N]: ')).trim().toLowerCase();
130
+ if (write === 'y' || write === 'yes')
131
+ return writeEnv(level);
132
+ }
133
+ return 0;
134
+ }
135
+ finally {
136
+ rl.close();
137
+ }
138
+ }
139
+ const invokedAsMain = (() => {
140
+ if (!process.argv[1])
141
+ return false;
142
+ try {
143
+ return import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;
144
+ }
145
+ catch {
146
+ return false;
147
+ }
148
+ })();
149
+ if (invokedAsMain) {
150
+ main().then((code) => process.exit(code), (err) => {
151
+ console.error(`✗ ${err instanceof Error ? err.message : String(err)}`);
152
+ process.exit(1);
153
+ });
154
+ }
@@ -2,6 +2,8 @@
2
2
  import { type InstallOptions } from '../lib/skills.ts';
3
3
  export declare function parseArgs(argv: string[]): {
4
4
  command: string;
5
- opts: InstallOptions;
5
+ opts: InstallOptions & {
6
+ agentsMd?: boolean;
7
+ };
6
8
  };
7
9
  export declare function main(argv?: string[]): number;
@@ -16,6 +16,7 @@
16
16
  * melchizedek-skills install --only melchizedek,melchizedek-scribe
17
17
  * melchizedek-skills install --force # overwrite files that differ
18
18
  * melchizedek-skills install --dry-run
19
+ * melchizedek-skills install --agents-md # also point AGENTS.md at the skills
19
20
  *
20
21
  * Clone equivalent: npm run skills:install -- <same flags>.
21
22
  * Nothing is read from the network; nothing is written outside the chosen
@@ -23,12 +24,12 @@
23
24
  */
24
25
  import { realpathSync } from 'node:fs';
25
26
  import { pathToFileURL } from 'node:url';
26
- import { DEFAULT_TARGETS, SKILL_TARGETS, destinationsFor, installSkills, listSkills, } from '../lib/skills.js';
27
+ import { DEFAULT_TARGETS, SKILL_TARGETS, destinationsFor, installSkills, listSkills, writeAgentsMdPointer, } from '../lib/skills.js';
27
28
  const USAGE = `melchizedek-skills — install the Melchizedek agent-skills suite into your coding agent
28
29
 
29
30
  melchizedek-skills list
30
31
  melchizedek-skills paths
31
- melchizedek-skills install [--for <targets>] [--global] [--dir <path>] [--only <skills>] [--force] [--dry-run]
32
+ melchizedek-skills install [--for <targets>] [--global] [--dir <path>] [--only <skills>] [--force] [--dry-run] [--agents-md]
32
33
 
33
34
  --for comma list of: ${Object.keys(SKILL_TARGETS).join(', ')}, all (default: ${DEFAULT_TARGETS.join(',')})
34
35
  --global write to the home-directory locations instead of this project's
@@ -36,6 +37,10 @@ const USAGE = `melchizedek-skills — install the Melchizedek agent-skills suite
36
37
  --only comma list of skill names (default: every skill)
37
38
  --force overwrite a file that exists with different content
38
39
  --dry-run print what would be written, write nothing
40
+ --agents-md also write a pointer block into ./AGENTS.md (created if absent; only the
41
+ block between its markers is ever rewritten). Project installs only.
42
+
43
+ Onboarding starts with the melchizedek-onboard skill, or: npx melchizedek-setup
39
44
  `;
40
45
  export function parseArgs(argv) {
41
46
  const [command = 'help', ...rest] = argv.filter((a) => a !== '--');
@@ -62,6 +67,8 @@ export function parseArgs(argv) {
62
67
  opts.force = true;
63
68
  else if (a === '--dry-run')
64
69
  opts.dryRun = true;
70
+ else if (a === '--agents-md')
71
+ opts.agentsMd = true;
65
72
  else if (a === '-h' || a === '--help')
66
73
  return { command: 'help', opts };
67
74
  else
@@ -117,6 +124,14 @@ export function main(argv = process.argv.slice(2)) {
117
124
  for (const f of r.skipped)
118
125
  console.log(` ! ${f} exists with different content (use --force to overwrite)`);
119
126
  }
127
+ if (opts.agentsMd) {
128
+ if (opts.global || opts.dir) {
129
+ console.error('✗ --agents-md writes ./AGENTS.md beside a project install; it is not used with --global or --dir');
130
+ return 2;
131
+ }
132
+ const r = writeAgentsMdPointer(process.cwd(), destinationsFor(opts), { dryRun: opts.dryRun });
133
+ console.log(`${opts.dryRun ? '○' : '✓'} ${r.path}: ${r.status}${opts.dryRun ? ' (dry run)' : ''}`);
134
+ }
120
135
  if (!opts.dir) {
121
136
  const sample = destinationsFor(opts);
122
137
  console.log(`\nOpen your coding agent in ${opts.global ? 'any project' : 'this project'} and ask it about a Melchizedek syndicate; the skills load from ${sample.map((d) => d).join(' and ')}.`);
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * scripts/yaml_codemod.ts — the `melchizedek-codemod` bin and `npm run yaml:codemod`.
4
+ *
5
+ * Rewrites an agent's v1 spellings into the v2 keys (ADR 0115):
6
+ *
7
+ * npm run yaml:codemod -- config/agents/my_syndicate.yaml # rewrite in place
8
+ * npm run yaml:codemod -- config/agents # every *.yaml below it
9
+ * npm run yaml:codemod -- --check config/agents # exit 1 if any file would change
10
+ *
11
+ * Per agent (the orchestrator and every inline subagent):
12
+ *
13
+ * outputSchema → output.schema
14
+ * generateContentConfig.responseMimeType → output.mime (application/json | text/plain)
15
+ * generateContentConfig.temperature → sampling.temperature
16
+ * generateContentConfig.topP → sampling.top_p
17
+ * generateContentConfig.maxOutputTokens → sampling.max_output_tokens
18
+ * generateContentConfig.stopSequences → sampling.stop
19
+ * generateContentConfig.thinkingConfig / reasoningEffort → reasoning:, ONLY
20
+ * when the engine reads the same ReasoningSetting before and after for
21
+ * the agent's model (reasoningOf over the old config equals reasoningOf
22
+ * over what reasoningConfig makes of the new key). `xhigh` and `max`
23
+ * included (ADR 0117).
24
+ * generateContentConfig.thinkingConfig.includeThoughts → dropped: the
25
+ * engine reads it nowhere, and the Gemini adapter asks for the thought
26
+ * trace itself whenever reasoning is not `none` (ADR 0117); `true` gets a
27
+ * note saying so.
28
+ * generateContentConfig.toolConfig → tool_choice: (ADR 0117), when it holds
29
+ * only functionCallingConfig (mode AUTO, NONE or ANY, and
30
+ * allowedFunctionNames) and includeServerSideToolInvocations, which the
31
+ * compiler sets on every agent: AUTO is `auto`, NONE `none`, ANY with
32
+ * one name `{ name }`, and ANY with none or several `required`, which is
33
+ * what the engine reads (genaiMapping toolChoiceOf) either way.
34
+ *
35
+ * Anything else stays under generateContentConfig with a note naming its key
36
+ * path (never its value); an emptied generateContentConfig is removed. An
37
+ * agent that already has the v2 key for a concept is left alone for that
38
+ * concept, with a note: the loader refuses an overlap.
39
+ *
40
+ * HOW: the file is parsed with the `yaml` package's Document API, which
41
+ * locates every key and value in the source. The edit splices whole lines:
42
+ * a moved key travels with its own lines (its leading and inline comments,
43
+ * its indentation and quoting); the comments of a key that is converted or
44
+ * dropped are kept as comment lines where the new key goes. Every line the
45
+ * codemod does not move is left byte for byte. The result is parsed again and
46
+ * must read back as the planned data, or the file is refused. Running it
47
+ * twice changes nothing the second time.
48
+ */
49
+ export interface MigrateResult {
50
+ /** The migrated text; the input itself when nothing changed. */
51
+ text: string;
52
+ changed: boolean;
53
+ /** One line per key left in a v1 spelling, naming its key path (never a value). */
54
+ notes: string[];
55
+ }
56
+ /**
57
+ * Rewrites one YAML text's v1 agent keys into v2 (see the header). Throws on
58
+ * text that is not one YAML document, and on an edit that would not read
59
+ * back as planned (a bug, never a silent change).
60
+ */
61
+ export declare function migrateYaml(text: string): MigrateResult;
62
+ export declare function main(argv: string[]): number;