@hicaru/pi-rlm 0.3.19 → 0.3.20

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.
@@ -14,9 +14,8 @@ type MutableSubcall = {
14
14
  -readonly [Key in keyof RlmSubcall]: RlmSubcall[Key];
15
15
  };
16
16
 
17
- /** Accumulated cost/tokens, shared by getTotals() and takeSettledSubtrees(). */
17
+ /** Accumulated tokens, shared by getTotals() and takeSettledSubtrees(). */
18
18
  export interface SubcallTotals {
19
- readonly costUsd: number;
20
19
  readonly tokens: number;
21
20
  /** In/out split (input / output) — mirrors tokens, shown separately in the tree. */
22
21
  readonly tokensIn: number;
@@ -26,11 +25,9 @@ export interface SubcallTotals {
26
25
  export class SubcallStore extends EmitterListener {
27
26
  private readonly subcalls = new Map<string, MutableSubcall>();
28
27
 
29
- private totalCostUsd = 0;
30
28
  private totalTokens = 0;
31
29
  private totalTokensIn = 0;
32
30
  private totalTokensOut = 0;
33
- private rootCostUsd = 0;
34
31
  private rootTokens = 0;
35
32
  private rootTokensIn = 0;
36
33
  private rootTokensOut = 0;
@@ -57,7 +54,6 @@ export class SubcallStore extends EmitterListener {
57
54
  detail: event.detail,
58
55
  args: event.args,
59
56
  startedAt: Date.now(),
60
- costUsd: 0,
61
57
  tokens: 0,
62
58
  tokensIn: 0,
63
59
  tokensOut: 0,
@@ -76,10 +72,6 @@ export class SubcallStore extends EmitterListener {
76
72
  if (event.detail !== undefined) sc.detail = event.detail;
77
73
  if (event.args !== undefined) sc.args = event.args;
78
74
  if (event.resultPreview !== undefined) sc.resultPreview = event.resultPreview;
79
- if (event.costUsd !== undefined) {
80
- sc.costUsd += event.costUsd;
81
- this.totalCostUsd += event.costUsd;
82
- }
83
75
  if (event.tokens !== undefined) {
84
76
  sc.tokens += event.tokens;
85
77
  this.totalTokens += event.tokens;
@@ -105,7 +97,7 @@ export class SubcallStore extends EmitterListener {
105
97
 
106
98
  /** Snapshot running totals. O(1). */
107
99
  getTotals(): SubcallTotals {
108
- return { costUsd: this.totalCostUsd, tokens: this.totalTokens, tokensIn: this.totalTokensIn, tokensOut: this.totalTokensOut };
100
+ return { tokens: this.totalTokens, tokensIn: this.totalTokensIn, tokensOut: this.totalTokensOut };
109
101
  }
110
102
 
111
103
  /**
@@ -141,7 +133,6 @@ export class SubcallStore extends EmitterListener {
141
133
  };
142
134
 
143
135
  const taken: RlmSubcall[] = [];
144
- let costUsd = 0;
145
136
  let tokens = 0;
146
137
  let tokensIn = 0;
147
138
  let tokensOut = 0;
@@ -149,7 +140,6 @@ export class SubcallStore extends EmitterListener {
149
140
  const subtree = settledSubtree(root);
150
141
  if (subtree === undefined) continue;
151
142
  for (const node of subtree) {
152
- costUsd += node.costUsd;
153
143
  tokens += node.tokens;
154
144
  tokensIn += node.tokensIn;
155
145
  tokensOut += node.tokensOut;
@@ -157,22 +147,19 @@ export class SubcallStore extends EmitterListener {
157
147
  this.subcalls.delete(node.id);
158
148
  }
159
149
  }
160
- this.totalCostUsd -= costUsd;
161
150
  this.totalTokens -= tokens;
162
151
  this.totalTokensIn -= tokensIn;
163
152
  this.totalTokensOut -= tokensOut;
164
- return { subcalls: taken, totals: { costUsd, tokens, tokensIn, tokensOut } };
153
+ return { subcalls: taken, totals: { tokens, tokensIn, tokensOut } };
165
154
  }
166
155
 
167
156
  // ── Root usage (delegated from RlmEventAggregator) ──
168
157
 
169
158
  /** Accumulate root-level usage into shared totals. Called by aggregator. */
170
- addRootUsage(costUsd: number, tokens: number, tokensIn = 0, tokensOut = 0): void {
171
- this.totalCostUsd += costUsd;
159
+ addRootUsage(tokens: number, tokensIn = 0, tokensOut = 0): void {
172
160
  this.totalTokens += tokens;
173
161
  this.totalTokensIn += tokensIn;
174
162
  this.totalTokensOut += tokensOut;
175
- this.rootCostUsd += costUsd;
176
163
  this.rootTokens += tokens;
177
164
  this.rootTokensIn += tokensIn;
178
165
  this.rootTokensOut += tokensOut;
@@ -180,6 +167,6 @@ export class SubcallStore extends EmitterListener {
180
167
 
181
168
  /** Root engine's OWN spend (driver-model turns only) — never blends sub-call models. */
182
169
  getRootUsage(): SubcallTotals {
183
- return { costUsd: this.rootCostUsd, tokens: this.rootTokens, tokensIn: this.rootTokensIn, tokensOut: this.rootTokensOut };
170
+ return { tokens: this.rootTokens, tokensIn: this.rootTokensIn, tokensOut: this.rootTokensOut };
184
171
  }
185
172
  }
@@ -9,7 +9,7 @@ import { THINKING_LEVELS } from "../config/settings.ts";
9
9
 
10
10
  const CHOICES = Object.freeze({
11
11
  maxDepth: Object.freeze(["1", "2", "3", "4"]),
12
- maxIterations: Object.freeze(["10", "20", "30", "50"]),
12
+ maxIterations: Object.freeze(["100", "200", "500", "1000"]),
13
13
  execTimeoutS: Object.freeze(["30", "60", "120", "300"]),
14
14
  maxConcurrentSubcalls: Object.freeze(["2", "4", "8", "16", "32"]),
15
15
  maxConcurrentChildren: Object.freeze(["1", "2", "3", "4", "6", "8"]),
@@ -20,7 +20,6 @@ const CHOICES = Object.freeze({
20
20
  compaction: Object.freeze(["on", "off"]),
21
21
  compactionThresholdPct: Object.freeze(["50", "65", "80", "90"]),
22
22
  rootSamplingMaxTokens: Object.freeze(["4096", "8192", "16384", "32768"]),
23
- rootSamplingTemperature: Object.freeze(["0", "0.3", "0.7", "1.0", "default"]),
24
23
  smartReasoning: Object.freeze(["default", ...Object.keys(THINKING_LEVELS)]),
25
24
  subSamplingMaxTokens: Object.freeze(["1024", "2048", "4096", "8192"]),
26
25
  subSamplingTemperature: Object.freeze(["0", "0.3", "0.7", "1.0", "default"]),
@@ -43,7 +42,7 @@ export async function showConfigPanel(ctx: ExtensionContext, config: RlmConfig):
43
42
  let edited = config;
44
43
  const items: SettingItem[] = [
45
44
  item("maxDepth", "Max recursion depth", String(config.maxDepth), CHOICES.maxDepth, "rlm_query past this depth degrades to plain llm_query (1 = no recursion)."),
46
- item("maxIterations", "Max iterations", String(config.maxIterations), CHOICES.maxIterations, "Maximum root REPL turns before RLM asks the model for a final answer."),
45
+ item("maxIterations", "Max iterations", String(config.maxIterations), CHOICES.maxIterations, "Maximum root REPL turns before RLM asks the model for a final answer. Large by design — runs end on FINAL/errors/wall-clock first."),
47
46
  item("execTimeoutS", "REPL block timeout (s)", String(config.execTimeoutS), CHOICES.execTimeoutS, "Wall-clock limit for one model-authored Python REPL block."),
48
47
  item("maxConcurrentSubcalls", "Max concurrent sub-calls", String(config.maxConcurrentSubcalls), CHOICES.maxConcurrentSubcalls, "Concurrency pool size for llm_batch and rlm_batch."),
49
48
  item("maxConcurrentChildren", "Max concurrent children", String(config.maxConcurrentChildren), CHOICES.maxConcurrentChildren, "Concurrent rlm_query child engines per depth. Each is a Python process holding its own copy of the inherited context."),
@@ -54,8 +53,6 @@ export async function showConfigPanel(ctx: ExtensionContext, config: RlmConfig):
54
53
  item("compaction", "Trajectory compaction", config.compaction ? "on" : "off", CHOICES.compaction, "Summarize old turns when history approaches the model context window."),
55
54
  item("compactionThresholdPct", "Compaction threshold (%)", String(Math.round(config.compactionThresholdPct * 100)), CHOICES.compactionThresholdPct, "DEPRECATED — ignored: compaction uses the absolute 256k ceiling (COMPACTION_CEILING_TOKENS)."),
56
55
  item("rootSamplingMaxTokens", "Root model output cap (tok)", String(config.rootSampling?.maxTokens ?? 16384), CHOICES.rootSamplingMaxTokens, "Max output tokens per root-model turn. Lower values keep each turn lean."),
57
- item("rootSamplingTemperature", "Root sampling temperature", config.rootSampling?.temperature === undefined ? "default" : String(config.rootSampling?.temperature), CHOICES.rootSamplingTemperature,
58
- "Sampling temperature for RLM root turns, finalize included — 0 = deterministic (the r3 reproducibility setting); 'default' = provider default. Applies to RLM-mode runs, rlm() delegation and child recursion; the native Pi agent loop follows Pi's own session settings."),
59
56
  item("smartReasoning", "Root reasoning effort", config.smartReasoning ?? "default", CHOICES.smartReasoning,
60
57
  "Thinking effort for the root model ('default' = none). Only models whose registry entry supports reasoning will think; others silently run without it. Reasoning tokens share the output cap — raise the root output cap when thinking is on."),
61
58
  item("subSamplingMaxTokens", "Worker output cap (tok)", String(config.subSampling?.maxTokens ?? 8192), CHOICES.subSamplingMaxTokens,
@@ -68,12 +65,6 @@ export async function showConfigPanel(ctx: ExtensionContext, config: RlmConfig):
68
65
  "Allow add_context() to pull an external dir, file, document, or git repo into context."),
69
66
  item("autoSeedCwd", "Auto-seed cwd", config.autoSeedCwd ? "on" : "off", CHOICES.autoSeedCwd,
70
67
  "Seed the working directory into context on the first repl() call (otherwise starts empty)."),
71
- // R0 (/tmp/ROOT_FULL_SKILLSTATE_PLAN.md): the SKILL.state / Root Σ paradigm flags are
72
- // ENFORCED — rendered as a read-only badge so the truth is visible instead of hidden.
73
- // No toggle exists: applySetting has no case for them and the validator forces true.
74
- item("__sigma_enforced__", "SKILL.state / Root Σ", "enforced", ["enforced"],
75
- "ENFORCED (no opt-out): run state, skill state + distill, root context transform, state fences, digest compaction. " +
76
- "Override attempts in rlm.json are traced (skillstate.override-ignored) and ignored; RLM_BENCH_NO_ROOTCONTEXT=1 is the dev-only measurement hatch."),
77
68
  // R5: the window calibrations are rlm.json-only knobs — shown read-only with live values.
78
69
  item("__sigma_window__", "Root Σ window (calibration)",
79
70
  `keepTurns=${config.rootContextKeepTurns} · elide=${config.rootContextElideChars} · snapshot=${config.rootContextSnapshot ? "on" : "off"}`,
@@ -138,12 +129,6 @@ export function applySetting(config: RlmConfig, id: string, value: string): RlmC
138
129
  case "compactionThresholdPct": return Object.freeze({ ...config, compactionThresholdPct: Number(value) / 100 });
139
130
  case "rootSamplingMaxTokens":
140
131
  return Object.freeze({ ...config, rootSampling: Object.freeze({ ...config.rootSampling, maxTokens: Number(value) }) });
141
- case "rootSamplingTemperature": {
142
- const t = optionalTemperature(value);
143
- // Reject invalid values (NaN / out of range) — keep the current setting.
144
- if (t === undefined && value !== "default") return config;
145
- return Object.freeze({ ...config, rootSampling: Object.freeze({ ...config.rootSampling, temperature: t }) });
146
- }
147
132
  case "smartReasoning":
148
133
  if (value === "default") return Object.freeze({ ...config, smartReasoning: undefined });
149
134
  return Object.hasOwn(THINKING_LEVELS, value)
@@ -20,7 +20,7 @@ interface RunRegistration {
20
20
  readonly label: string;
21
21
  readonly emitter: RlmEmitter;
22
22
  readonly subcalls: () => readonly RlmSubcall[];
23
- readonly totals: () => { readonly costUsd: number; readonly tokens: number };
23
+ readonly totals: () => { readonly tokens: number };
24
24
  /** Live root state; defaults: running, no phase, no turns. */
25
25
  readonly rootStatus?: () => RlmRunStatus;
26
26
  readonly rootPhase?: () => SubcallPhase | undefined;
@@ -40,7 +40,7 @@ export interface RunEntry {
40
40
  readonly label: string;
41
41
  readonly timeline: TimelineStore;
42
42
  readonly subcalls: () => readonly RlmSubcall[];
43
- readonly totals: () => { readonly costUsd: number; readonly tokens: number };
43
+ readonly totals: () => { readonly tokens: number };
44
44
  readonly rootStatus: () => RlmRunStatus;
45
45
  readonly rootPhase: () => SubcallPhase | undefined;
46
46
  readonly turns: () => { readonly current: number; readonly max: number };