Add Experience V1 schema migration and agent-run completion extractor.
Extend h5_experience with structured fields, wire mindspace-agent-runner and agent-run-gateway to persist task_outcome records with provenance, and add local migration and verification scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Idempotent migration: add h5_experience V1 columns (problem, environment, evidence, …).
|
||||
*
|
||||
* Usage:
|
||||
* node scripts/migrate-h5-experience-v1.mjs
|
||||
* node scripts/migrate-h5-experience-v1.mjs --dry-run
|
||||
*/
|
||||
import { loadH5Environment } from './load-env.mjs';
|
||||
import { createDbPool, migrateSchema } from '../db.mjs';
|
||||
|
||||
function parseArgs(argv) {
|
||||
const options = { dryRun: false };
|
||||
for (const arg of argv) {
|
||||
if (arg === '--dry-run') options.dryRun = true;
|
||||
else if (arg === '-h' || arg === '--help') {
|
||||
console.log('Usage: node scripts/migrate-h5-experience-v1.mjs [--dry-run]');
|
||||
process.exit(0);
|
||||
} else {
|
||||
throw new Error(`未知参数: ${arg}`);
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
loadH5Environment(import.meta.dirname);
|
||||
const options = parseArgs(process.argv.slice(2));
|
||||
|
||||
if (options.dryRun) {
|
||||
console.log('[migrate-h5-experience-v1] dry-run: would run migrateSchema() (includes h5_experience V1 ALTERs)');
|
||||
return;
|
||||
}
|
||||
|
||||
const pool = createDbPool();
|
||||
try {
|
||||
await migrateSchema(pool);
|
||||
console.log('[migrate-h5-experience-v1] ok');
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error('[migrate-h5-experience-v1] failed:', error?.message ?? error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user