@xcompiler/cli 0.2.3 → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const XCOMPILER_VERSION = "0.2.3";
3
+ declare const XCOMPILER_VERSION = "0.2.4";
4
4
  declare const XCOMPILER_PLUGIN_API_VERSION = 1;
5
5
 
6
6
  /** Supported target languages for generated projects. */
@@ -377,11 +377,12 @@ declare class AuditLogger {
377
377
  llmResponse(role: string, model: string, content: string, meta?: Record<string, unknown>): Promise<void>;
378
378
  llmError(role: string, model: string, err: unknown): Promise<void>;
379
379
  /**
380
- * 记录一轮 Executor 思考:thoughts 文本、计划调用的 actions、是否完成。
381
- * 写入 jsonl + markdown 折叠块,交付时可作为"AI 思考过程完整记录"。
380
+ * 记录一轮 Executor 执行摘要:简短 intent、issue 处理方案、计划调用的 actions、是否完成。
381
+ * 写入 jsonl + markdown 折叠块,交付时可追溯每轮决策和动作。
382
382
  */
383
383
  executorTurn(stepId: string, role: string, round: number, payload: {
384
384
  thoughts?: string;
385
+ issueResolutionPlan?: string;
385
386
  actions?: unknown[];
386
387
  done?: boolean;
387
388
  raw?: string;
@@ -445,11 +446,23 @@ interface ExecResult {
445
446
  stderr: string;
446
447
  timedOut: boolean;
447
448
  durationMs: number;
449
+ timeoutReason?: string;
450
+ }
451
+ interface ExecProgressWatch {
452
+ /** Host-side paths whose recursive size indicates install progress. */
453
+ paths: string[];
454
+ /** Kill the child only after this much time without size growth. */
455
+ idleTimeoutMs: number;
456
+ /** Poll interval for recursive size checks. */
457
+ checkIntervalMs?: number;
458
+ /** Human-readable label used in timeout diagnostics. */
459
+ label?: string;
448
460
  }
449
461
  interface ExecExtra {
450
462
  cwd?: string;
451
463
  env?: Record<string, string>;
452
464
  timeoutMs?: number;
465
+ progressWatch?: ExecProgressWatch;
453
466
  }
454
467
  /** 沙盒统一接口。任意 phase / tool 都通过此接口与运行时交互。 */
455
468
  interface Sandbox {
@@ -900,10 +913,11 @@ interface ScoreStoreOptions {
900
913
  * 设计动机:
901
914
  * - 配置允许给一个角色挂多个 provider;运行时按评分降序选择当前"最可信"的。
902
915
  * - 评分会随成功/失败动态调整:失败 -0.5 直到 0.1;成功 +0.1 直到 cap=1。
903
- * - 只有用户在配置中显式设置 score=0 才表示禁用;运行时自动评分不会写出 0。
916
+ * - `llm_scores.yaml` XCompiler 维护的动态快照;它不是用户策略文件。
917
+ * - 用户手动覆盖写在 `llm_scores_user.yaml`;其中 score=0 表示禁用,并且优先生效。
904
918
  * - preflight 检测到 ollama 服务器上**模型不存在**会在当前运行跳过该 provider,并把评分降到 0.1。
905
- * - 持久化到 config 同目录的 sidecar 文件 `llm_scores.yaml`,避免改写用户的 config.yaml
906
- * (会丢注释)。配置里 `llm.scores` 段作为 sidecar 缺失时的初值。
919
+ * - 动态评分持久化到 config 同目录的 sidecar 文件 `llm_scores.yaml`,避免改写用户的 config.yaml
920
+ * (会丢注释)。配置里 `llm.scores` 段仅作为兼容初值;旧配置中显式 0 仍视为用户禁用。
907
921
  */
908
922
  declare class ScoreStore {
909
923
  private readonly audit?;
@@ -915,26 +929,31 @@ declare class ScoreStore {
915
929
  static readonly CLUSTER_MAX = 0.5;
916
930
  static readonly DECAY = 0.5;
917
931
  static readonly BOOST = 0.1;
918
- private readonly scores;
919
- private readonly userDisabled;
932
+ private readonly dynamicScores;
933
+ private readonly userScores;
920
934
  private readonly clusterProviders;
921
935
  private readonly clusterMin;
922
936
  private readonly clusterMax;
923
937
  private dirty;
924
938
  private writeQueue;
925
939
  private readonly sidecarPath;
940
+ private readonly userScoresPath;
926
941
  constructor(configPath: string, initial?: Record<string, number>, audit?: AuditLogger | undefined, opts?: ScoreStoreOptions);
927
- /** 异步加载 sidecar 文件;失败/不存在不抛错,使用 ctor 提供的初值。 */
942
+ /** 异步加载动态 sidecar 与用户覆盖文件;失败/不存在不抛错,使用 ctor 提供的初值。 */
928
943
  load(): Promise<void>;
944
+ private loadDynamicScores;
945
+ private loadUserScores;
929
946
  get(name: string): number;
930
- /** 主动设置评分;value=0 仅用于显式禁用,其它值会归一到动态范围。 */
947
+ /** 主动设置动态评分;用户覆盖只从配置或 llm_scores_user.yaml 读取。 */
931
948
  set(name: string, value: number, reason?: string): void;
932
949
  decay(name: string, reason: string): void;
933
950
  boost(name: string, reason: string): void;
934
- /** True only for providers explicitly disabled by user config (`llm.scores.<provider>: 0`). */
951
+ /** True only for providers explicitly disabled by user config or llm_scores_user.yaml. */
935
952
  isUserDisabled(name: string): boolean;
936
- /** 全量快照(用于测试与 audit 输出)。 */
953
+ /** 动态评分快照(用于持久化、测试与 audit 输出;不包含用户覆盖)。 */
937
954
  snapshot(): Record<string, number>;
955
+ /** 用户覆盖快照(用于测试/诊断;运行时不会改写用户文件)。 */
956
+ userSnapshot(): Record<string, number>;
938
957
  /** 等待待写入完成(CLI 退出前调用,确保评分已落盘)。 */
939
958
  flush(): Promise<void>;
940
959
  private scheduleSave;
@@ -943,8 +962,10 @@ declare class ScoreStore {
943
962
  private minFor;
944
963
  private maxFor;
945
964
  private isClusterProvider;
946
- private clampConfigured;
965
+ private dynamicScore;
947
966
  private clampDynamic;
967
+ private clampPersistedDynamic;
968
+ private clampUserScore;
948
969
  }
949
970
 
950
971
  /** 插件注册、扩展能力合并与生命周期 Hook 调度中心。 */
@@ -1012,6 +1033,8 @@ interface ExecuteOptions {
1012
1033
  force?: boolean;
1013
1034
  /** Optional XXX.xc project file to keep in sync with execution progress. */
1014
1035
  projectFilePath?: string;
1036
+ /** Optional debug wiki root directory. Defaults to XCompiler's own .xcompiler/debug-wiki. */
1037
+ debugWikiPath?: string;
1015
1038
  /** Project-file history command label; defaults to run. */
1016
1039
  projectCommand?: string;
1017
1040
  /** Whether to append a history row when execution starts; defaults to true. */
@@ -1054,6 +1077,7 @@ declare function runBuildCommand(opts: RuntimeBuildCommandOptions): Promise<Runt
1054
1077
  type RuntimeEvolveCommandOptions = Omit<CompileOptions, 'workspace' | 'outputFile' | 'projectCommand'> & WorkspaceOptions & {
1055
1078
  planOut?: string;
1056
1079
  cwd?: string;
1080
+ debugWikiPath?: string;
1057
1081
  };
1058
1082
  interface RuntimeEvolveCommandResult {
1059
1083
  workspace: string;
@@ -1075,6 +1099,7 @@ declare function runLoadCommand(opts: RuntimeLoadCommandOptions): Promise<Execut
1075
1099
  type RuntimeAppendCommandOptions = Omit<CompileOptions, 'workspace' | 'baselinePlanFile' | 'outputFile' | 'projectFilePath' | 'projectCommand'> & {
1076
1100
  projectFile: string;
1077
1101
  planOut?: string;
1102
+ debugWikiPath?: string;
1078
1103
  };
1079
1104
  interface RuntimeAppendCommandResult {
1080
1105
  workspace: string;