@hongmaple0820/scale-engine 0.27.1 → 0.28.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/README.en.md CHANGED
@@ -33,7 +33,7 @@ scale ai-os plan \
33
33
 
34
34
  This is not a claim that SCALE replaces human judgment. It is the first testable, explainable, and measurable runtime planning layer for the AI Engineering OS direction.
35
35
 
36
- The near-term target is a one-week push from `ai-os plan` to a runnable beta loop: `ai-os run`, memory providers, Context Compiler v2, Skill Router v2, Adaptive Workflow, Failure Learning, Dashboard, migration, and benchmark evidence. The long-range target is an AI Engineering OS beta in 8-12 weeks, a stable governance runtime in 3-6 months, and a cross-agent engineering operating layer in 6-12 months. See the full roadmap in [AI Engineering OS Strategic Positioning](docs/AI_ENGINEERING_OS_POSITIONING.md).
36
+ The near-term target is `0.28.0` as a usable closed-loop enhancement: connect `ai-os plan`, `ai-os run`, verification recommendations, failure learning, dashboard, benchmark, migration, and adoption into one verifiable loop. The long-range target is an AI Engineering OS beta in 8-12 weeks, a stable governance runtime in 3-6 months, and a cross-agent engineering operating layer in 6-12 months. See the full roadmap in [AI Engineering OS Strategic Positioning](docs/AI_ENGINEERING_OS_POSITIONING.md).
37
37
 
38
38
  The current 0.27.0 beta runtime now includes the controlled run entry point: `scale ai-os run --dry-run` reuses the unified plan, produces execution steps, evidence requirements, next actions, and writes the run report to `.scale/ai-os/runs/`. When real verification is required, use guarded mode with explicit `--verify` commands. Commands run through the safe runner by default and are recorded as runtime evidence; failed verification returns a `blocked` JSON report and a non-zero CLI exit code.
39
39
 
@@ -61,21 +61,34 @@ scale ai-os run \
61
61
  After multiple runs, use the dashboard to summarize ready/blocked runs, verification commands, pending evidence, and failure learning:
62
62
 
63
63
  ```bash
64
+ scale ai-os status --lang en
64
65
  scale ai-os dashboard --json
65
66
  ```
66
67
 
68
+ `status` is the 0.28.0 closed-loop visibility entry point. It checks runtime directories, plan/run evidence, guarded verification, dashboard health, benchmark evidence, and the adoption report in one place.
69
+ When guarded verification evidence is missing, it also recommends concrete commands from `.scale/verification.json` or `package.json` scripts so an agent can choose the next governed `--verify` step without guessing.
70
+
67
71
  Before a release or milestone review, run the fixed benchmark scenarios to compare context, memory, skill, governance, and dashboard metrics:
68
72
 
69
73
  ```bash
70
74
  scale ai-os benchmark --json
71
75
  ```
72
76
 
73
- Before adopting the 0.27.0 beta runtime in an existing project, create or verify the AI OS runtime state directories:
77
+ Before adopting the AI OS beta runtime in an existing project, create or verify the AI OS runtime state directories:
74
78
 
75
79
  ```bash
76
80
  scale ai-os migrate --json
77
81
  ```
78
82
 
83
+ You can also use the one-command adoption path. It runs migrate, the first dry-run, benchmark, and doctor in order, then writes the adoption report to `.scale/ai-os/adoption.json`:
84
+
85
+ ```bash
86
+ scale ai-os adopt \
87
+ --task "Adopt AI OS runtime and generate the first governance evidence" \
88
+ --files "README.md,src/runtime/AiOsRuntime.ts" \
89
+ --json
90
+ ```
91
+
79
92
  For project-level readiness, run the AI OS doctor. It checks runtime directories, run history, dashboard health, benchmark freshness, and prints the next required action in English or Chinese:
80
93
 
81
94
  ```bash
@@ -83,7 +96,7 @@ scale ai-os doctor --lang en --json
83
96
  scale ai-os doctor --lang zh
84
97
  ```
85
98
 
86
- The standard upgrade path also surfaces this readiness. `scale upgrade check --json` now includes the AI OS doctor result, and `scale upgrade plan --json` adds explicit `ai-os migrate` / `ai-os doctor` steps when a project has not yet adopted the runtime state.
99
+ The standard upgrade path also surfaces this readiness. `scale upgrade check --json` now includes the AI OS doctor result, and `scale upgrade plan --json` adds explicit `ai-os adopt`, `ai-os migrate`, and `ai-os doctor` steps when a project has not yet adopted the runtime state. Human-facing `scale upgrade check/plan --lang en` prints localized next commands; keep `--json` for scripts, CI, and agent integrations.
87
100
 
88
101
  ## Community
89
102
 
@@ -222,6 +235,12 @@ scale upgrade apply --dir . --confirm --lang en
222
235
  scale upgrade rollback --dir . --lang en
223
236
  ```
224
237
 
238
+ If the upgrade plan says the AI OS runtime has not been adopted yet, run:
239
+
240
+ ```bash
241
+ scale ai-os adopt --dir . --task "Adopt AI OS runtime" --lang en
242
+ ```
243
+
225
244
  Chinese output is the default. Add `--lang en` for English prompts and English HTML plans.
226
245
 
227
246
  Upgrade rules:
package/README.md CHANGED
@@ -33,7 +33,7 @@ scale ai-os plan \
33
33
 
34
34
  这不是“完全替代人类判断”的声明;它是把 AI Engineering OS 的核心闭环先做成可测试、可解释、可度量的运行时规划层。
35
35
 
36
- 短期目标是用一周冲刺把 `ai-os plan` 推进到可运行的 beta 闭环:`ai-os run`、记忆供应商、Context Compiler v2Skill Router v2、Adaptive Workflow、Failure Learning、Dashboard、迁移和 benchmark。远景目标是 8-12 周形成 AI Engineering OS beta,3-6 个月进入稳定治理运行时,6-12 个月沉淀为跨 Agent 的工程操作层。完整路线图见 [AI Engineering OS 战略定位](docs/AI_ENGINEERING_OS_POSITIONING.md)。
36
+ 短期目标是把 `0.28.0` 做成可用闭环增强版:让 `ai-os plan`、`ai-os run`、验证建议、失败沉淀、Dashboardbenchmark、迁移和 adoption 串成可验证闭环。远景目标是 8-12 周形成 AI Engineering OS beta,3-6 个月进入稳定治理运行时,6-12 个月沉淀为跨 Agent 的工程操作层。完整路线图见 [AI Engineering OS 战略定位](docs/AI_ENGINEERING_OS_POSITIONING.md)。
37
37
 
38
38
  当前 0.27.0 beta runtime 已包含受控运行入口:`scale ai-os run --dry-run` 会复用统一 plan,生成执行步骤、证据要求、下一步动作,并把运行报告写入 `.scale/ai-os/runs/`。需要真实验证时可切到 guarded 模式并显式传入 `--verify`,命令默认通过 safe runner 执行并写入 runtime evidence;验证失败时 JSON 报告会返回 `blocked`,CLI 退出码为非零。
39
39
 
@@ -61,21 +61,35 @@ scale ai-os run \
61
61
  运行多次后可以用 dashboard 汇总 ready/blocked、验证命令、pending evidence 和 failure learning:
62
62
 
63
63
  ```bash
64
+ scale ai-os status --lang zh
64
65
  scale ai-os dashboard --json
65
66
  ```
66
67
 
68
+ 当 guarded verification 证据缺失时,`status` 会从 `.scale/verification.json` 或 `package.json` scripts 推导具体验证命令,帮助 agent 自主选择下一条受治理的 `--verify` 步骤。
69
+
70
+ `status` 是 0.28.0 闭环可见性入口,会一次性检查 runtime 目录、plan/run 证据、guarded verification、dashboard health、benchmark 和 adoption 报告是否齐全。
71
+
67
72
  发版或阶段验收前,用 benchmark 固定样例对比 context、memory、skill、governance 和 dashboard 指标:
68
73
 
69
74
  ```bash
70
75
  scale ai-os benchmark --json
71
76
  ```
72
77
 
73
- 旧项目接入 0.27.0 beta runtime 前,可先创建或核验 AI OS 运行态目录:
78
+ 旧项目接入 AI OS beta runtime 前,可先创建或核验 AI OS 运行态目录:
74
79
 
75
80
  ```bash
76
81
  scale ai-os migrate --json
77
82
  ```
78
83
 
84
+ 也可以使用一键接入入口,它会按顺序执行 migrate、首个 dry-run、benchmark、doctor,并把采用报告写入 `.scale/ai-os/adoption.json`:
85
+
86
+ ```bash
87
+ scale ai-os adopt \
88
+ --task "接入 AI OS runtime 并生成首份治理证据" \
89
+ --files "README.md,src/runtime/AiOsRuntime.ts" \
90
+ --json
91
+ ```
92
+
79
93
  项目级就绪检查可使用 AI OS doctor。它会检查运行态目录、运行历史、dashboard 健康度、benchmark 新鲜度,并按中英文输出下一步动作:
80
94
 
81
95
  ```bash
@@ -83,7 +97,7 @@ scale ai-os doctor --lang zh --json
83
97
  scale ai-os doctor --lang en
84
98
  ```
85
99
 
86
- 标准升级入口也会带出这项检查。`scale upgrade check --json` 会包含 AI OS doctor 结果;当项目尚未接入运行态目录时,`scale upgrade plan --json` 会补充明确的 `ai-os migrate` / `ai-os doctor` 步骤。
100
+ 标准升级入口也会带出这项检查。`scale upgrade check --json` 会包含 AI OS doctor 结果;当项目尚未接入运行态目录时,`scale upgrade plan --json` 会补充明确的 `ai-os adopt`、`ai-os migrate` `ai-os doctor` 步骤。面向人使用的 `scale upgrade check/plan --lang zh` 会输出中文 task 和中文下一步命令;`--json` 保留给脚本、CI 和 Agent 集成。
87
101
 
88
102
  ## 先怎么学
89
103
 
@@ -228,6 +242,12 @@ scale tools outdated --dir .
228
242
  scale skill outdated --dir .
229
243
  ```
230
244
 
245
+ 如果升级计划提示 AI OS runtime 尚未接入,先运行:
246
+
247
+ ```bash
248
+ scale ai-os adopt --dir . --task "接入 AI OS runtime" --lang zh
249
+ ```
250
+
231
251
  升级原则:
232
252
 
233
253
  - `scale upgrade check` 读取 `.scale/governance.lock.json`,判断当前项目是干净、缺文件、模板过期,还是存在本地改动。
package/dist/api/cli.js CHANGED
@@ -65,7 +65,7 @@ import { doctorHtmlArtifacts, renderHtmlArtifact, resolveHtmlArtifactForOpen, se
65
65
  import { renderGovernanceDashboard } from '../output/GovernanceDashboard.js';
66
66
  import { cleanupWorkspaceLifecycle, inspectWorkspaceLifecycle, } from '../workflow/WorkspaceLifecycle.js';
67
67
  import { inspectWorkspaceSafety } from '../workflow/WorkspaceSafety.js';
68
- import { RuntimeEvidenceLedger, SessionLedger, createAiOsBenchmark, createAiOsDashboard, createAiOsDoctor, createAiOsMigration, createAiOsPlan, createAiOsRun, doctorRuntimeEvidence, evaluateFinalReportReadiness, } from '../runtime/index.js';
68
+ import { RuntimeEvidenceLedger, SessionLedger, createAiOsAdoption, createAiOsBenchmark, createAiOsDashboard, createAiOsDoctor, createAiOsMigration, createAiOsPlan, createAiOsRun, createAiOsStatus, doctorRuntimeEvidence, evaluateFinalReportReadiness, } from '../runtime/index.js';
69
69
  import { MemoryFabric, MemoryBrain, doctorMemoryFabric, renderContextPackMarkdown, renderMemoryLearningCandidateMarkdown, inspectMemoryProviders, recallMemoryProviders, settleMemoryLearning, writeMemoryProvidersConfig, } from '../memory/index.js';
70
70
  import { resolveWorkspaceTopology, workspaceTopologyPath, workspaceTopologyTemplate, } from '../workflow/WorkspaceTopology.js';
71
71
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
@@ -3136,9 +3136,149 @@ const aiOsDoctorCommand = defineCommand({
3136
3136
  process.exitCode = 1;
3137
3137
  },
3138
3138
  });
3139
+ const aiOsAdoptCommand = defineCommand({
3140
+ meta: { name: 'adopt', description: 'Prepare a project for AI OS runtime use by running migrate, first dry-run, benchmark, and doctor' },
3141
+ args: {
3142
+ dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
3143
+ 'task-id': { type: 'string', description: 'Task id for the first adoption dry-run report' },
3144
+ task: { type: 'string', required: true, description: 'Task or adoption scenario description' },
3145
+ level: { type: 'string', default: 'M', description: 'Task level: S, M, L, or CRITICAL' },
3146
+ files: { type: 'string', description: 'Comma-separated changed or target files' },
3147
+ services: { type: 'string', description: 'Comma-separated affected services' },
3148
+ budget: { type: 'string', description: 'Maximum estimated tokens for the adoption plan and benchmark' },
3149
+ 'requested-mode': { type: 'string', description: 'Requested governance mode: minimal, standard, expanded, or critical' },
3150
+ lang: { type: 'string', default: 'en', description: 'Output language zh/en' },
3151
+ 'benchmark-max-age-hours': { type: 'string', description: 'Maximum accepted benchmark report age in hours' },
3152
+ json: { type: 'boolean', default: false },
3153
+ },
3154
+ async run({ args }) {
3155
+ const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
3156
+ const scaleDir = resolveScaleDirForProject(projectDir);
3157
+ const lang = normalizeLangArg(args.lang);
3158
+ const report = await createAiOsAdoption({
3159
+ projectDir,
3160
+ scaleDir,
3161
+ taskId: args['task-id'] ? String(args['task-id']) : undefined,
3162
+ task: String(args.task),
3163
+ level: normalizeTaskArtifactLevel(args.level),
3164
+ files: parseCommaList(args.files),
3165
+ services: parseCommaList(args.services),
3166
+ budget: parsePositiveIntArg(args.budget, '--budget'),
3167
+ requestedMode: normalizeGovernanceMode(args['requested-mode']),
3168
+ lang,
3169
+ benchmarkMaxAgeHours: parsePositiveIntArg(args['benchmark-max-age-hours'], '--benchmark-max-age-hours'),
3170
+ });
3171
+ if (args.json) {
3172
+ console.log(JSON.stringify(report, null, 2));
3173
+ if (report.status === 'blocked')
3174
+ process.exitCode = 1;
3175
+ return;
3176
+ }
3177
+ if (lang === 'zh') {
3178
+ console.log('SCALE AI OS 接入');
3179
+ console.log(` 状态: ${report.status}`);
3180
+ console.log(` 迁移: ${report.migration.status}`);
3181
+ console.log(` 首次运行: ${report.run.status} (${report.run.mode})`);
3182
+ console.log(` 基准: ${report.benchmark.summary.scenarios} 个场景`);
3183
+ console.log(` Doctor: ${report.doctor.status}`);
3184
+ console.log(` 报告: ${report.artifacts.adoptionReport}`);
3185
+ for (const phase of report.phases)
3186
+ console.log(` [${phase.status}] ${phase.id}: ${phase.summary}`);
3187
+ for (const action of report.nextActions)
3188
+ console.log(` 下一步: ${action}`);
3189
+ for (const warning of report.warnings)
3190
+ console.log(` 警告: ${warning}`);
3191
+ }
3192
+ else {
3193
+ console.log('SCALE AI OS Adoption');
3194
+ console.log(` Status: ${report.status}`);
3195
+ console.log(` Migration: ${report.migration.status}`);
3196
+ console.log(` First run: ${report.run.status} (${report.run.mode})`);
3197
+ console.log(` Benchmark: ${report.benchmark.summary.scenarios} scenario(s)`);
3198
+ console.log(` Doctor: ${report.doctor.status}`);
3199
+ console.log(` Report: ${report.artifacts.adoptionReport}`);
3200
+ for (const phase of report.phases)
3201
+ console.log(` [${phase.status}] ${phase.id}: ${phase.summary}`);
3202
+ for (const action of report.nextActions)
3203
+ console.log(` next: ${action}`);
3204
+ for (const warning of report.warnings)
3205
+ console.log(` warning: ${warning}`);
3206
+ }
3207
+ if (report.status === 'blocked')
3208
+ process.exitCode = 1;
3209
+ },
3210
+ });
3211
+ const aiOsStatusCommand = defineCommand({
3212
+ meta: { name: 'status', description: 'Show AI OS closed-loop readiness across runtime, run, verification, dashboard, benchmark, and adoption evidence' },
3213
+ args: {
3214
+ dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
3215
+ lang: { type: 'string', default: 'en', description: 'Output language zh/en' },
3216
+ 'benchmark-max-age-hours': { type: 'string', description: 'Maximum accepted benchmark report age in hours' },
3217
+ json: { type: 'boolean', default: false },
3218
+ },
3219
+ run({ args }) {
3220
+ const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
3221
+ const scaleDir = resolveScaleDirForProject(projectDir);
3222
+ const lang = normalizeLangArg(args.lang);
3223
+ const report = createAiOsStatus({
3224
+ projectDir,
3225
+ scaleDir,
3226
+ benchmarkMaxAgeHours: parsePositiveIntArg(args['benchmark-max-age-hours'], '--benchmark-max-age-hours'),
3227
+ lang,
3228
+ });
3229
+ if (args.json) {
3230
+ console.log(JSON.stringify(report, null, 2));
3231
+ if (report.status === 'blocked')
3232
+ process.exitCode = 1;
3233
+ return;
3234
+ }
3235
+ if (lang === 'zh') {
3236
+ console.log('SCALE AI OS 状态');
3237
+ console.log(` 状态: ${report.status}`);
3238
+ console.log(` 检查: ${report.summary.ready} ready, ${report.summary.warning} warning, ${report.summary.blocked} blocked`);
3239
+ console.log(` Dashboard: ${report.dashboard.health.status} (${report.dashboard.health.score})`);
3240
+ console.log(` Doctor: ${report.doctor.status}`);
3241
+ for (const check of report.checks)
3242
+ console.log(` [${check.status}] ${check.id}: ${check.summary}`);
3243
+ if (report.verificationRecommendations.length > 0) {
3244
+ console.log(' 验证建议:');
3245
+ for (const recommendation of report.verificationRecommendations) {
3246
+ console.log(` - ${recommendation.command} (${recommendation.source})`);
3247
+ }
3248
+ }
3249
+ for (const action of report.nextActions)
3250
+ console.log(` 下一步: ${action}`);
3251
+ for (const warning of report.warnings)
3252
+ console.log(` 警告: ${warning}`);
3253
+ }
3254
+ else {
3255
+ console.log('SCALE AI OS Status');
3256
+ console.log(` Status: ${report.status}`);
3257
+ console.log(` Checks: ${report.summary.ready} ready, ${report.summary.warning} warning, ${report.summary.blocked} blocked`);
3258
+ console.log(` Dashboard: ${report.dashboard.health.status} (${report.dashboard.health.score})`);
3259
+ console.log(` Doctor: ${report.doctor.status}`);
3260
+ for (const check of report.checks)
3261
+ console.log(` [${check.status}] ${check.id}: ${check.summary}`);
3262
+ if (report.verificationRecommendations.length > 0) {
3263
+ console.log(' Verification recommendations:');
3264
+ for (const recommendation of report.verificationRecommendations) {
3265
+ console.log(` - ${recommendation.command} (${recommendation.source})`);
3266
+ }
3267
+ }
3268
+ for (const action of report.nextActions)
3269
+ console.log(` next: ${action}`);
3270
+ for (const warning of report.warnings)
3271
+ console.log(` warning: ${warning}`);
3272
+ }
3273
+ if (report.status === 'blocked')
3274
+ process.exitCode = 1;
3275
+ },
3276
+ });
3139
3277
  const aiOs = defineCommand({
3140
3278
  meta: { name: 'ai-os', description: 'AI Engineering OS runtime planning and governance orchestration' },
3141
3279
  subCommands: {
3280
+ adopt: aiOsAdoptCommand,
3281
+ status: aiOsStatusCommand,
3142
3282
  plan: aiOsPlanCommand,
3143
3283
  run: aiOsRunCommand,
3144
3284
  dashboard: aiOsDashboardCommand,
@@ -3193,7 +3333,7 @@ const upgradeCheck = defineCommand({
3193
3333
  console.log(' Next:');
3194
3334
  }
3195
3335
  for (const command of report.recommendedCommands)
3196
- console.log(` ${command}`);
3336
+ console.log(` ${formatUpgradeCommand(command, lang)}`);
3197
3337
  },
3198
3338
  });
3199
3339
  const upgradePlan = defineCommand({
@@ -3238,7 +3378,7 @@ const upgradePlan = defineCommand({
3238
3378
  console.log(lang === 'zh' ? ' 步骤:' : ' Steps:');
3239
3379
  for (const step of report.steps) {
3240
3380
  const path = step.path ? ` ${step.path}` : '';
3241
- const command = step.command ? ` -> ${step.command}` : '';
3381
+ const command = step.command ? ` -> ${formatUpgradeCommand(step.command, lang)}` : '';
3242
3382
  console.log(` [${step.risk}] ${step.action}${path}: ${formatUpgradeStepReason(step.action, step.reason, lang)}${command}`);
3243
3383
  }
3244
3384
  if (htmlPath)
@@ -3339,12 +3479,32 @@ function formatUpgradeStepReason(action, fallback, lang) {
3339
3479
  return fallback
3340
3480
  .replace('updates require manual-review; SCALE never auto-installs third-party capabilities.', '更新需要人工审阅;SCALE 不会自动安装第三方能力。')
3341
3481
  .replace('updates require blocked; SCALE never auto-installs third-party capabilities.', '更新默认阻断;SCALE 不会自动安装第三方能力。');
3482
+ case 'adopt-ai-os-runtime':
3483
+ return '运行 AI OS 一键接入路径,生成运行态目录、首份 dry-run、benchmark 和 doctor 报告。';
3484
+ case 'migrate-ai-os-runtime':
3485
+ return 'AI OS 运行态目录缺失;接入 beta runtime 前先创建目录结构。';
3486
+ case 'check-ai-os-runtime':
3487
+ return '依赖 AI OS beta 编排前,先复核运行态就绪状态。';
3342
3488
  case 'run-preflight':
3343
3489
  return '完成已接受的升级后,运行项目级预检。';
3344
3490
  default:
3345
3491
  return fallback;
3346
3492
  }
3347
3493
  }
3494
+ function formatUpgradeCommand(command, lang) {
3495
+ if (command === 'scale ai-os adopt --dir . --task "Adopt AI OS runtime" --json') {
3496
+ return lang === 'zh'
3497
+ ? 'scale ai-os adopt --dir . --task "接入 AI OS runtime" --lang zh'
3498
+ : 'scale ai-os adopt --dir . --task "Adopt AI OS runtime" --lang en';
3499
+ }
3500
+ if (command === 'scale ai-os doctor --dir . --json') {
3501
+ return lang === 'zh' ? 'scale ai-os doctor --dir . --lang zh' : 'scale ai-os doctor --dir . --lang en';
3502
+ }
3503
+ if (command === 'scale ai-os migrate --dir . --json') {
3504
+ return 'scale ai-os migrate --dir .';
3505
+ }
3506
+ return command;
3507
+ }
3348
3508
  function formatUpgradeApplyReason(reason, lang) {
3349
3509
  if (lang !== 'zh')
3350
3510
  return reason;