@hmharness/evolution 0.14.23 → 0.14.24

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.
@@ -51,7 +51,13 @@ export declare function pickFineTuneModel(opts: {
51
51
  export declare function normalizeFineTuneBase(baseUrl: string): string;
52
52
  /** Serialize pairs into the provider DPO JSONL row format (pure). Accepts
53
53
  * the slim {prompt,chosen,rejected} rows the CLI persists - provenance
54
- * fields never leave the machine. */
54
+ * fields never leave the machine.
55
+ * Format verified live 2026-09-25: the documented {"input":{"messages":...}}
56
+ * nesting is REJECTED by the upload validator ("缺少messages字段"); the
57
+ * accepted shape is top-level messages (MUST contain an assistant turn -
58
+ * "缺少assistant角色" otherwise) plus preferred_output/non_preferred_output.
59
+ * The assistant turn carries the chosen answer, so the row is a complete
60
+ * good trajectory and the preference pair trains the separation. */
55
61
  export declare function toDpoJsonl(pairs: Array<Pick<DpoPair, 'prompt' | 'chosen' | 'rejected'>>): string;
56
62
  /** Rough token estimate for a cost preview before upload (chars/4 heuristic;
57
63
  * the upload response returns exact per-tokenizer stats which the UI shows
@@ -90,18 +90,23 @@ export function normalizeFineTuneBase(baseUrl) {
90
90
  }
91
91
  /** Serialize pairs into the provider DPO JSONL row format (pure). Accepts
92
92
  * the slim {prompt,chosen,rejected} rows the CLI persists - provenance
93
- * fields never leave the machine. */
93
+ * fields never leave the machine.
94
+ * Format verified live 2026-09-25: the documented {"input":{"messages":...}}
95
+ * nesting is REJECTED by the upload validator ("缺少messages字段"); the
96
+ * accepted shape is top-level messages (MUST contain an assistant turn -
97
+ * "缺少assistant角色" otherwise) plus preferred_output/non_preferred_output.
98
+ * The assistant turn carries the chosen answer, so the row is a complete
99
+ * good trajectory and the preference pair trains the separation. */
94
100
  export function toDpoJsonl(pairs) {
95
101
  const lines = [];
96
102
  for (const p of pairs) {
97
103
  if (!p.prompt.trim() || !p.chosen.trim() || !p.rejected.trim())
98
104
  continue; // quality gate mirrors rl-governance
99
105
  const row = {
100
- input: {
101
- messages: [{ role: 'user', content: p.prompt }],
102
- tools: [],
103
- parallel_tool_calls: false,
104
- },
106
+ messages: [
107
+ { role: 'user', content: p.prompt },
108
+ { role: 'assistant', content: p.chosen },
109
+ ],
105
110
  preferred_output: [{ role: 'assistant', content: p.chosen }],
106
111
  non_preferred_output: [{ role: 'assistant', content: p.rejected }],
107
112
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/evolution",
3
- "version": "0.14.23",
3
+ "version": "0.14.24",
4
4
  "description": "hmharness evolution subsystem: persistent memory, insight capture, skill library, and the bench that gives evolution its fitness signal. First-class kernel citizen, not a plugin.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",