@blockrun/franklin 3.18.0 → 3.20.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.
@@ -16,6 +16,37 @@
16
16
  * prior crash never bricks the log.
17
17
  */
18
18
  import type { Side } from './portfolio.js';
19
+ /**
20
+ * Trade rationale — the "why" behind a fill, captured at trade time so
21
+ * the journal can score for discipline (not P&L). Inspired by the AI-Trader
22
+ * signal-quality model: verifiability + evidence + specificity drive better
23
+ * decisions than rewarding outcomes (which incentivizes curve-fitting).
24
+ *
25
+ * All fields are optional; the scorer rewards completeness without forcing it.
26
+ */
27
+ export interface TradeRationale {
28
+ direction?: 'long' | 'short' | 'neutral';
29
+ priceTarget?: number;
30
+ stopLoss?: number;
31
+ timeHorizon?: string;
32
+ conviction?: 1 | 2 | 3 | 4 | 5;
33
+ evidence?: string[];
34
+ tags?: string[];
35
+ thesis?: string;
36
+ }
37
+ /**
38
+ * Persisted quality breakdown — five components on 0–1 scales plus a 0–5
39
+ * total. Written next to each entry at append time so portfolio reads
40
+ * never need to re-score.
41
+ */
42
+ export interface QualityScore {
43
+ total: number;
44
+ verifiability: number;
45
+ evidence: number;
46
+ specificity: number;
47
+ novelty: number;
48
+ review: number;
49
+ }
19
50
  export interface TradeLogEntry {
20
51
  timestamp: number;
21
52
  symbol: string;
@@ -25,6 +56,12 @@ export interface TradeLogEntry {
25
56
  feeUsd: number;
26
57
  /** Realized P&L from this specific fill — 0 for opens, ± for closes. */
27
58
  realizedPnlUsd: number;
59
+ /** Journal-v2 fields (optional, back-compat: older entries lack these). */
60
+ rationale?: TradeRationale;
61
+ /** User's post-trade note. Boosts the `review` component of the score. */
62
+ review?: string;
63
+ /** Computed at append time so portfolio reads don't re-score on every render. */
64
+ qualityScore?: QualityScore;
28
65
  }
29
66
  export declare class TradeLog {
30
67
  private filePath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.18.0",
3
+ "version": "3.20.0",
4
4
  "description": "Franklin Agent — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {