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.
- package/.env.example +29 -2
- package/AGENT_SETUP.md +3 -1
- package/CHANGELOG.md +524 -0
- package/DOCUMENTATION.md +178 -43
- package/ONBOARDING.md +339 -0
- package/QUICKSTART.md +15 -2
- package/README.md +6 -2
- package/config/agents/README.md +2 -2
- package/config/agents/examples/ares.yaml +6 -10
- package/config/agents/examples/assistant.yaml +6 -6
- package/config/agents/examples/augustin.yaml +9 -15
- package/config/agents/examples/cartographers.yaml +6 -6
- package/config/agents/examples/council.yaml +7 -7
- package/config/agents/examples/critic.yaml +24 -24
- package/config/agents/examples/harness.yaml +4 -4
- package/config/agents/examples/image_production.yaml +37 -35
- package/config/agents/examples/librarian.yaml +4 -4
- package/config/agents/examples/patient_advocate.yaml +6 -10
- package/config/agents/examples/pipeline.yaml +20 -19
- package/config/agents/examples/research.yaml +36 -43
- package/config/agents/examples/scribe.yaml +31 -32
- package/config/agents/examples/scriptorium.yaml +6 -6
- package/config/agents/examples/structured_critic.yaml +82 -0
- package/config/agents/examples/style_council.yaml +9 -11
- package/config/agents/examples/syndicate.yaml +3 -5
- package/config/agents/examples/tutor.yaml +2 -2
- package/config/agents/examples/weather.yaml +2 -2
- package/config/agents/syndicate.schema.json +859 -13
- package/config/agents/syndicateSchema.yaml +122 -73
- package/config/agents/templates/README.md +1 -1
- package/config/agents/templates/account_memory.yaml +4 -4
- package/config/agents/templates/case_desk.yaml +6 -6
- package/config/agents/templates/conversational.yaml +2 -2
- package/config/agents/templates/draft_review.yaml +6 -6
- package/config/agents/templates/intake_extractor.yaml +64 -62
- package/config/agents/templates/research_brief.yaml +6 -6
- package/config/agents/templates/research_desk.yaml +6 -6
- package/config/agents/templates/review_panel.yaml +8 -8
- package/config/agents/templates/support_triage.yaml +30 -29
- package/config/agents/templates/systems_operator.yaml +24 -5
- package/db/migrations/0014_durable_runs.sql +31 -0
- package/dist/lib/a2a/app.d.ts +27 -0
- package/dist/lib/a2a/app.js +64 -5
- package/dist/lib/a2a/executor.d.ts +7 -1
- package/dist/lib/a2a/executor.js +43 -5
- package/dist/lib/a2a/oauthSetup.d.ts +106 -0
- package/dist/lib/a2a/oauthSetup.js +259 -0
- package/dist/lib/agentDialect.d.ts +76 -0
- package/dist/lib/agentDialect.js +151 -0
- package/dist/lib/compile.d.ts +42 -6
- package/dist/lib/compile.js +97 -45
- package/dist/lib/compileNative.d.ts +11 -3
- package/dist/lib/compileNative.js +20 -1
- package/dist/lib/dispatch.d.ts +10 -5
- package/dist/lib/dispatch.js +10 -5
- package/dist/lib/doctor.d.ts +110 -1
- package/dist/lib/doctor.js +205 -9
- package/dist/lib/loadSyndicate.d.ts +54 -2
- package/dist/lib/loadSyndicate.js +22 -2
- package/dist/lib/memory/namespace.d.ts +6 -5
- package/dist/lib/memory/namespace.js +6 -5
- package/dist/lib/memory/providers.js +3 -4
- package/dist/lib/models/capabilities.d.ts +25 -1
- package/dist/lib/models/capabilities.js +79 -1
- package/dist/lib/models/chatCompletionsAdapter.d.ts +11 -3
- package/dist/lib/models/chatCompletionsAdapter.js +19 -5
- package/dist/lib/models/claudeAdapter.js +4 -0
- package/dist/lib/models/contract.d.ts +5 -2
- package/dist/lib/models/gateway.d.ts +2 -1
- package/dist/lib/models/gateway.js +4 -2
- package/dist/lib/models/gatewayAdapter.d.ts +7 -1
- package/dist/lib/models/gatewayAdapter.js +8 -0
- package/dist/lib/models/geminiAdapter.js +8 -2
- package/dist/lib/models/genaiMapping.d.ts +8 -4
- package/dist/lib/models/genaiMapping.js +23 -9
- package/dist/lib/models/gptAdapter.d.ts +4 -2
- package/dist/lib/models/gptAdapter.js +11 -4
- package/dist/lib/models/grokAdapter.d.ts +3 -1
- package/dist/lib/models/grokAdapter.js +11 -3
- package/dist/lib/models/kimiAdapter.d.ts +2 -1
- package/dist/lib/models/kimiAdapter.js +3 -3
- package/dist/lib/models/reasoning.d.ts +30 -2
- package/dist/lib/models/reasoning.js +56 -5
- package/dist/lib/observability/tracer.d.ts +8 -1
- package/dist/lib/observability/tracer.js +33 -5
- package/dist/lib/onboarding.d.ts +134 -0
- package/dist/lib/onboarding.js +539 -0
- package/dist/lib/runtime/approvals.d.ts +8 -0
- package/dist/lib/runtime/approvals.js +4 -3
- package/dist/lib/runtime/credentials.d.ts +6 -0
- package/dist/lib/runtime/native/agentLoop.d.ts +23 -3
- package/dist/lib/runtime/native/agentLoop.js +107 -11
- package/dist/lib/runtime/native/checkpoint.d.ts +171 -0
- package/dist/lib/runtime/native/checkpoint.js +359 -0
- package/dist/lib/runtime/native/delegate.d.ts +222 -18
- package/dist/lib/runtime/native/delegate.js +390 -39
- package/dist/lib/runtime/native/interrupts.d.ts +184 -2
- package/dist/lib/runtime/native/interrupts.js +391 -1
- package/dist/lib/runtime/native/request.d.ts +13 -3
- package/dist/lib/runtime/native/request.js +28 -4
- package/dist/lib/runtime/native/telemetry.js +10 -15
- package/dist/lib/runtime/questions.d.ts +7 -4
- package/dist/lib/runtime/sessions.d.ts +1 -1
- package/dist/lib/runtime/syndicateTurn.d.ts +11 -3
- package/dist/lib/runtime/syndicateTurn.js +353 -68
- package/dist/lib/runtime/turnControl.d.ts +56 -0
- package/dist/lib/runtime/turnControl.js +10 -0
- package/dist/lib/session/transcript.d.ts +9 -0
- package/dist/lib/session/transcript.js +20 -1
- package/dist/lib/skills.d.ts +18 -0
- package/dist/lib/skills.js +73 -1
- package/dist/lib/storage/postgres/index.d.ts +12 -2
- package/dist/lib/storage/postgres/index.js +8 -3
- package/dist/lib/storage/postgres/taskQueue.d.ts +20 -4
- package/dist/lib/storage/postgres/taskQueue.js +29 -5
- package/dist/lib/storage/postgres/taskStore.d.ts +26 -2
- package/dist/lib/storage/postgres/taskStore.js +74 -8
- package/dist/lib/syndicateSchema.d.ts +316 -1
- package/dist/lib/syndicateSchema.js +203 -29
- package/dist/lib/tools/auth.d.ts +20 -6
- package/dist/lib/tools/auth.js +21 -5
- package/dist/lib/tools/credentialEnv.d.ts +28 -0
- package/dist/lib/tools/credentialEnv.js +52 -0
- package/dist/lib/tools/credentialHosts.d.ts +88 -0
- package/dist/lib/tools/credentialHosts.js +165 -0
- package/dist/lib/tools/credentialStore.js +9 -2
- package/dist/lib/tools/credentialUses.d.ts +92 -0
- package/dist/lib/tools/credentialUses.js +112 -0
- package/dist/lib/tools/mcpToolFactory.d.ts +25 -2
- package/dist/lib/tools/mcpToolFactory.js +179 -21
- package/dist/lib/tools/oauthConsent.js +8 -1
- package/dist/lib/tools/oauthHosts.d.ts +73 -0
- package/dist/lib/tools/oauthHosts.js +154 -0
- package/dist/lib/tools/oauthTools.d.ts +242 -0
- package/dist/lib/tools/oauthTools.js +447 -0
- package/dist/lib/tools/openapiTools.d.ts +11 -6
- package/dist/lib/tools/openapiTools.js +88 -38
- package/dist/lib/tools/taskTools.d.ts +61 -6
- package/dist/lib/tools/taskTools.js +145 -21
- package/dist/lib/workflow/turn.d.ts +22 -3
- package/dist/lib/workflow/turn.js +151 -31
- package/dist/lib/workflow.d.ts +14 -7
- package/dist/lib/workflow.js +14 -7
- package/dist/lib/workflowConfig.d.ts +6 -0
- package/dist/scripts/a2a_server.d.ts +36 -0
- package/dist/scripts/a2a_server.js +131 -1
- package/dist/scripts/assistant_worker.d.ts +12 -0
- package/dist/scripts/assistant_worker.js +81 -22
- package/dist/scripts/doctor.d.ts +7 -2
- package/dist/scripts/doctor.js +9 -4
- package/dist/scripts/setup.d.ts +23 -0
- package/dist/scripts/setup.js +154 -0
- package/dist/scripts/skills_install.d.ts +3 -1
- package/dist/scripts/skills_install.js +17 -2
- package/dist/scripts/yaml_codemod.d.ts +62 -0
- package/dist/scripts/yaml_codemod.js +652 -0
- package/package.json +8 -2
- package/skills/README.md +11 -2
- package/skills/briefs/_shared.md +1 -1
- package/skills/briefs/melchizedek-author.md +7 -5
- package/skills/briefs/melchizedek-models.md +7 -4
- package/skills/briefs/melchizedek.md +1 -0
- package/skills/briefs/skills-readme.md +3 -1
- package/skills/melchizedek/SKILL.md +1 -0
- package/skills/melchizedek-author/SKILL.md +7 -4
- package/skills/melchizedek-author/assets/minimal.yaml +13 -13
- package/skills/melchizedek-models/SKILL.md +11 -4
- package/skills/melchizedek-onboard/SKILL.md +49 -0
- package/skills/melchizedek-onboard-cloud/SKILL.md +38 -0
- package/skills/melchizedek-onboard-keys/SKILL.md +35 -0
- package/skills/melchizedek-onboard-local/SKILL.md +41 -0
- 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;
|