openpond 0.0.52 → 0.0.54

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.
@@ -2,11 +2,11 @@ import { createRequire as __openpondCreateRequire } from "node:module"; var requ
2
2
  import {
3
3
  APP_SERVER_COMPOSITION,
4
4
  createOpenPondAppServer
5
- } from "./chunk-KNKZSVGO.js";
5
+ } from "./chunk-FFTPXXNU.js";
6
6
  import "./chunk-NFNEENNR.js";
7
7
  import "./chunk-EIRW6Z6S.js";
8
- import "./chunk-FFD2YSZR.js";
9
- import "./chunk-C4DAHPVI.js";
8
+ import "./chunk-MMUU5J64.js";
9
+ import "./chunk-OW3B5BRD.js";
10
10
  import "./chunk-55KT7K5P.js";
11
11
  import "./chunk-US7DOPAH.js";
12
12
  import "./chunk-WYDVQOBL.js";
@@ -34,14 +34,14 @@ import {
34
34
  truncatePatch,
35
35
  uniqueSortedPaths,
36
36
  workspaceImageContentType
37
- } from "./chunk-FFD2YSZR.js";
37
+ } from "./chunk-MMUU5J64.js";
38
38
  import {
39
39
  HOSTED_CHAT_SYSTEM_PROMPT,
40
40
  VERSION,
41
41
  event,
42
42
  now,
43
43
  textFromUnknown
44
- } from "./chunk-C4DAHPVI.js";
44
+ } from "./chunk-OW3B5BRD.js";
45
45
  import {
46
46
  AppPreferencesSchema,
47
47
  ApplyCreateImproveRunActionRequestSchema,
@@ -29447,6 +29447,92 @@ function asRecord11(value) {
29447
29447
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
29448
29448
  }
29449
29449
 
29450
+ // ../server/src/training/hosted-token-pricing.ts
29451
+ function hostedTokenPricingFromCatalog(raw) {
29452
+ const pricing = record4(record4(record4(raw.metadata).billing).pricing);
29453
+ return {
29454
+ version: requiredString5(pricing.version, "pricing version"),
29455
+ source: requiredString5(pricing.source, "pricing source"),
29456
+ effectiveAt: requiredString5(pricing.effectiveAt, "pricing effective date"),
29457
+ inputUsdPerMillionTokens: requiredRate(
29458
+ pricing.inputUsdPerMillionTokens,
29459
+ "input token rate"
29460
+ ),
29461
+ cachedInputUsdPerMillionTokens: requiredRate(
29462
+ pricing.cachedInputUsdPerMillionTokens,
29463
+ "cached input token rate"
29464
+ ),
29465
+ outputUsdPerMillionTokens: requiredRate(
29466
+ pricing.outputUsdPerMillionTokens,
29467
+ "output token rate"
29468
+ )
29469
+ };
29470
+ }
29471
+ function hostedTokenPricingFromValue(value) {
29472
+ const pricing = record4(value);
29473
+ try {
29474
+ return {
29475
+ version: requiredString5(pricing.version, "pricing version"),
29476
+ source: requiredString5(pricing.source, "pricing source"),
29477
+ effectiveAt: requiredString5(pricing.effectiveAt, "pricing effective date"),
29478
+ inputUsdPerMillionTokens: requiredRate(
29479
+ pricing.inputUsdPerMillionTokens,
29480
+ "input token rate"
29481
+ ),
29482
+ cachedInputUsdPerMillionTokens: requiredRate(
29483
+ pricing.cachedInputUsdPerMillionTokens,
29484
+ "cached input token rate"
29485
+ ),
29486
+ outputUsdPerMillionTokens: requiredRate(
29487
+ pricing.outputUsdPerMillionTokens,
29488
+ "output token rate"
29489
+ )
29490
+ };
29491
+ } catch {
29492
+ return null;
29493
+ }
29494
+ }
29495
+ function hostedUsageCostUsd(usage, pricing) {
29496
+ const normalized = normalizeModelUsageTokens(usage);
29497
+ if (normalized.promptTokens === null && normalized.completionTokens === null) return null;
29498
+ const usageRecord = record4(usage);
29499
+ const cached = Math.min(
29500
+ normalized.promptTokens ?? 0,
29501
+ cachedInputTokens(usageRecord)
29502
+ );
29503
+ const uncached = Math.max(0, (normalized.promptTokens ?? 0) - cached);
29504
+ return (uncached * pricing.inputUsdPerMillionTokens + cached * pricing.cachedInputUsdPerMillionTokens + (normalized.completionTokens ?? 0) * pricing.outputUsdPerMillionTokens) / 1e6;
29505
+ }
29506
+ function cachedInputTokens(usage) {
29507
+ const candidates = [
29508
+ usage.cached_input_tokens,
29509
+ usage.cachedInputTokens,
29510
+ record4(usage.prompt_tokens_details).cached_tokens,
29511
+ record4(usage.promptTokensDetails).cachedTokens,
29512
+ record4(usage.input_tokens_details).cached_tokens,
29513
+ record4(usage.inputTokensDetails).cachedTokens
29514
+ ];
29515
+ for (const value of candidates) {
29516
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
29517
+ return Math.trunc(value);
29518
+ }
29519
+ }
29520
+ return 0;
29521
+ }
29522
+ function record4(value) {
29523
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
29524
+ }
29525
+ function requiredString5(value, label) {
29526
+ if (typeof value === "string" && value.trim()) return value.trim();
29527
+ throw new Error(`Hosted model catalog is missing ${label}.`);
29528
+ }
29529
+ function requiredRate(value, label) {
29530
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
29531
+ return value;
29532
+ }
29533
+ throw new Error(`Hosted model catalog is missing ${label}.`);
29534
+ }
29535
+
29450
29536
  // ../server/src/training/taskset-work-attempt-runner.ts
29451
29537
  async function runTasksetWorkAttempt(input) {
29452
29538
  if (input.taskset.environment.kind !== "work") {
@@ -30001,7 +30087,11 @@ async function runTasksetWorkAttempt(input) {
30001
30087
  };
30002
30088
  }
30003
30089
  );
30004
- const providerInferenceUsd = explicitCosts.length ? sumUsd(explicitCosts) : null;
30090
+ const estimatedUsageCosts = input.hostedTokenPricing ? usages.flatMap((usage) => {
30091
+ const cost = hostedUsageCostUsd(usage, input.hostedTokenPricing);
30092
+ return cost === null ? [] : [cost];
30093
+ }) : [];
30094
+ const providerInferenceUsd = explicitCosts.length ? sumUsd(explicitCosts) : estimatedUsageCosts.length ? sumUsd(estimatedUsageCosts) : infrastructureError && usages.length === 0 ? 0 : null;
30005
30095
  const costComponents = [
30006
30096
  providerInferenceUsd,
30007
30097
  workRuntimeCost?.billableUsd ?? null
@@ -30742,6 +30832,20 @@ function segment(value) {
30742
30832
  return normalized || "asset";
30743
30833
  }
30744
30834
 
30835
+ // ../server/src/training/evaluation-grader-cost.ts
30836
+ function hostedModelJudgeCallCost(input) {
30837
+ if (typeof input.costUsd === "number" && Number.isFinite(input.costUsd) && input.costUsd >= 0) {
30838
+ return input.costUsd;
30839
+ }
30840
+ if (!input.pricing) return null;
30841
+ const usages = Array.isArray(input.usage) ? input.usage : input.usage === void 0 ? [] : [input.usage];
30842
+ const costs = usages.map((usage) => hostedUsageCostUsd(usage, input.pricing));
30843
+ if (!costs.length || !costs.every((cost) => cost !== null)) {
30844
+ return null;
30845
+ }
30846
+ return costs.reduce((total, cost) => total + cost, 0);
30847
+ }
30848
+
30745
30849
  // ../server/src/training/evaluation-service-statistics.ts
30746
30850
  function reviewRefMatches(value, expected) {
30747
30851
  return Boolean(
@@ -30826,7 +30930,8 @@ function createTaskEvaluationService(deps) {
30826
30930
  const gradeResult = await grade({
30827
30931
  tasksetId: taskset.id,
30828
30932
  taskId: task.id,
30829
- attempt
30933
+ attempt,
30934
+ hostedTokenPricing: input.hostedTokenPricing
30830
30935
  });
30831
30936
  const artifacts = await deps.store.listTaskAttemptArtifacts({
30832
30937
  attemptId: attempt.id
@@ -30881,7 +30986,7 @@ function createTaskEvaluationService(deps) {
30881
30986
  const rawUsages = [];
30882
30987
  let explicitCostUsd = 0;
30883
30988
  let modelJudgeCalls = 0;
30884
- let modelJudgeCostObserved = false;
30989
+ let modelJudgeCostAccounted = 0;
30885
30990
  const result = await gradeTasksetEvaluationAttempt({
30886
30991
  task,
30887
30992
  attempt,
@@ -30891,9 +30996,14 @@ function createTaskEvaluationService(deps) {
30891
30996
  const judged = await deps.modelJudge(judgeInput);
30892
30997
  if (Array.isArray(judged.usage)) rawUsages.push(...judged.usage);
30893
30998
  else if (judged.usage !== void 0) rawUsages.push(judged.usage);
30894
- if (typeof judged.costUsd === "number" && Number.isFinite(judged.costUsd) && judged.costUsd >= 0) {
30895
- explicitCostUsd += judged.costUsd;
30896
- modelJudgeCostObserved = true;
30999
+ const callCostUsd = hostedModelJudgeCallCost({
31000
+ costUsd: judged.costUsd,
31001
+ usage: judged.usage,
31002
+ pricing: input.hostedTokenPricing
31003
+ });
31004
+ if (callCostUsd !== null) {
31005
+ explicitCostUsd += callCostUsd;
31006
+ modelJudgeCostAccounted += 1;
30897
31007
  }
30898
31008
  return judged;
30899
31009
  } : void 0,
@@ -30918,7 +31028,7 @@ function createTaskEvaluationService(deps) {
30918
31028
  // judge entirely. That is an authoritative zero-cost grading path, not
30919
31029
  // missing accounting. If a judge did run, retain fail-closed semantics
30920
31030
  // unless its hosted cost was actually observed.
30921
- costUsd: modelJudgeCalls === 0 ? 0 : modelJudgeCostObserved ? explicitCostUsd : null
31031
+ costUsd: modelJudgeCalls === 0 ? 0 : modelJudgeCostAccounted === modelJudgeCalls ? explicitCostUsd : null
30922
31032
  });
30923
31033
  return result;
30924
31034
  }
@@ -31821,92 +31931,6 @@ function isRecord4(value) {
31821
31931
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
31822
31932
  }
31823
31933
 
31824
- // ../server/src/training/hosted-token-pricing.ts
31825
- function hostedTokenPricingFromCatalog(raw) {
31826
- const pricing = record4(record4(record4(raw.metadata).billing).pricing);
31827
- return {
31828
- version: requiredString5(pricing.version, "pricing version"),
31829
- source: requiredString5(pricing.source, "pricing source"),
31830
- effectiveAt: requiredString5(pricing.effectiveAt, "pricing effective date"),
31831
- inputUsdPerMillionTokens: requiredRate(
31832
- pricing.inputUsdPerMillionTokens,
31833
- "input token rate"
31834
- ),
31835
- cachedInputUsdPerMillionTokens: requiredRate(
31836
- pricing.cachedInputUsdPerMillionTokens,
31837
- "cached input token rate"
31838
- ),
31839
- outputUsdPerMillionTokens: requiredRate(
31840
- pricing.outputUsdPerMillionTokens,
31841
- "output token rate"
31842
- )
31843
- };
31844
- }
31845
- function hostedTokenPricingFromValue(value) {
31846
- const pricing = record4(value);
31847
- try {
31848
- return {
31849
- version: requiredString5(pricing.version, "pricing version"),
31850
- source: requiredString5(pricing.source, "pricing source"),
31851
- effectiveAt: requiredString5(pricing.effectiveAt, "pricing effective date"),
31852
- inputUsdPerMillionTokens: requiredRate(
31853
- pricing.inputUsdPerMillionTokens,
31854
- "input token rate"
31855
- ),
31856
- cachedInputUsdPerMillionTokens: requiredRate(
31857
- pricing.cachedInputUsdPerMillionTokens,
31858
- "cached input token rate"
31859
- ),
31860
- outputUsdPerMillionTokens: requiredRate(
31861
- pricing.outputUsdPerMillionTokens,
31862
- "output token rate"
31863
- )
31864
- };
31865
- } catch {
31866
- return null;
31867
- }
31868
- }
31869
- function hostedUsageCostUsd(usage, pricing) {
31870
- const normalized = normalizeModelUsageTokens(usage);
31871
- if (normalized.promptTokens === null && normalized.completionTokens === null) return null;
31872
- const usageRecord = record4(usage);
31873
- const cached = Math.min(
31874
- normalized.promptTokens ?? 0,
31875
- cachedInputTokens(usageRecord)
31876
- );
31877
- const uncached = Math.max(0, (normalized.promptTokens ?? 0) - cached);
31878
- return (uncached * pricing.inputUsdPerMillionTokens + cached * pricing.cachedInputUsdPerMillionTokens + (normalized.completionTokens ?? 0) * pricing.outputUsdPerMillionTokens) / 1e6;
31879
- }
31880
- function cachedInputTokens(usage) {
31881
- const candidates = [
31882
- usage.cached_input_tokens,
31883
- usage.cachedInputTokens,
31884
- record4(usage.prompt_tokens_details).cached_tokens,
31885
- record4(usage.promptTokensDetails).cachedTokens,
31886
- record4(usage.input_tokens_details).cached_tokens,
31887
- record4(usage.inputTokensDetails).cachedTokens
31888
- ];
31889
- for (const value of candidates) {
31890
- if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
31891
- return Math.trunc(value);
31892
- }
31893
- }
31894
- return 0;
31895
- }
31896
- function record4(value) {
31897
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
31898
- }
31899
- function requiredString5(value, label) {
31900
- if (typeof value === "string" && value.trim()) return value.trim();
31901
- throw new Error(`Hosted model catalog is missing ${label}.`);
31902
- }
31903
- function requiredRate(value, label) {
31904
- if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
31905
- return value;
31906
- }
31907
- throw new Error(`Hosted model catalog is missing ${label}.`);
31908
- }
31909
-
31910
31934
  // ../server/src/training/hosted-provider-retry.ts
31911
31935
  function retryableHostedError(error) {
31912
31936
  const message = hostedErrorText(error);
@@ -41908,7 +41932,7 @@ function uniqueEvidence(run, evidence) {
41908
41932
  }
41909
41933
  async function verifyAppliedProfileCommit(input) {
41910
41934
  const command = input.command ?? (async (name, args, cwd, env) => {
41911
- const { runWorkspaceCommand } = await import("./workspaces-YLNB6DS7.js");
41935
+ const { runWorkspaceCommand } = await import("./workspaces-HHLJWD3H.js");
41912
41936
  return runWorkspaceCommand(name, args, cwd, env);
41913
41937
  });
41914
41938
  const result = await command("git", ["rev-parse", "HEAD"], input.repoPath);
@@ -49591,12 +49615,12 @@ export {
49591
49615
  createWebFetchModelToolDefinition,
49592
49616
  createWebSearchModelToolDefinition,
49593
49617
  waitForWorkReceiptSettlement,
49618
+ hostedTokenPricingFromValue,
49619
+ hostedUsageCostUsd,
49594
49620
  compileDesktopHarnessContext,
49595
49621
  createTaskEvaluationService,
49596
49622
  qualifyHarnessModelImprovement,
49597
49623
  requireQualifiedModelImprovement,
49598
- hostedTokenPricingFromValue,
49599
- hostedUsageCostUsd,
49600
49624
  retryableHostedError,
49601
49625
  hostedRetryDelayMs,
49602
49626
  abortableDelay,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
2
  import {
3
3
  now
4
- } from "./chunk-C4DAHPVI.js";
4
+ } from "./chunk-OW3B5BRD.js";
5
5
 
6
6
  // ../server/src/workspace/workspace-command.ts
7
7
  import { spawn, spawnSync } from "node:child_process";
@@ -3,7 +3,7 @@ import { createRequire as __openpondCreateRequire } from "node:module"; var requ
3
3
  // ../server/src/constants.ts
4
4
  var DEFAULT_HOST = "127.0.0.1";
5
5
  var DEFAULT_PORT = 17874;
6
- var VERSION = "0.0.52";
6
+ var VERSION = "0.0.54";
7
7
  var HOSTED_CHAT_SYSTEM_PROMPT = "You are OpenPond Chat. Respond in the user's language. If the user's latest message is language-neutral, ambiguous, or only a short test, respond in English. Be concise and directly answer the latest request. Do not use emojis. Use Markdown when it improves scanability. If you emit reasoning or thinking content, keep it sparse and user-readable: at most one short sentence for major progress, decisions, or blockers. Omit reasoning for routine searches, reads, tool calls, and obvious next steps. Do not restate the user request, narrate every action, or include code blocks, code excerpts, diffs, raw tool payloads, or markdown examples in reasoning. Put necessary code or exact snippets only in the final assistant answer. When the user asks to show or preview an image that is available as a workspace path or signed image URL, use Markdown image syntax like ![description](path-or-url) instead of a bare path or raw HTML. For workspace-backed answers, use a Codex-style shape: brief outcome first, then Changed Files if files changed, then Verification if checks ran. End with a concise final answer that summarizes the result and verification when relevant. Do not mention raw tool JSON, internal repo paths, or origin/remote URLs unless the user explicitly asks for them or they are necessary to explain a git/deploy failure.";
8
8
  var APP_PREFERENCES_CACHE_TYPE = "app_preferences";
9
9
  var APP_PREFERENCES_CACHE_KEY = "global";
@@ -10,7 +10,7 @@ import {
10
10
  DEFAULT_HOST,
11
11
  DEFAULT_PORT,
12
12
  parseListen
13
- } from "./chunk-C4DAHPVI.js";
13
+ } from "./chunk-OW3B5BRD.js";
14
14
 
15
15
  // ../server/src/cli.ts
16
16
  import { existsSync } from "node:fs";
@@ -3,10 +3,10 @@ import {
3
3
  resolveWebLaunchMessages,
4
4
  runOpenPondAppServerCli,
5
5
  runOpenPondServerCli
6
- } from "./chunk-3UPQUD6Y.js";
6
+ } from "./chunk-TGXBIUAR.js";
7
7
  import "./chunk-NFNEENNR.js";
8
8
  import "./chunk-EIRW6Z6S.js";
9
- import "./chunk-C4DAHPVI.js";
9
+ import "./chunk-OW3B5BRD.js";
10
10
  import "./chunk-55KT7K5P.js";
11
11
  import "./chunk-US7DOPAH.js";
12
12
  import "./chunk-WYDVQOBL.js";
@@ -117,10 +117,10 @@ import {
117
117
  workspaceHasHead,
118
118
  workspaceToolExperienceBlocker,
119
119
  writeWorkspaceFile
120
- } from "./chunk-KNKZSVGO.js";
120
+ } from "./chunk-FFTPXXNU.js";
121
121
  import {
122
122
  runOpenPondServerCli
123
- } from "./chunk-3UPQUD6Y.js";
123
+ } from "./chunk-TGXBIUAR.js";
124
124
  import {
125
125
  createAppServer,
126
126
  runAgentCompaction
@@ -166,7 +166,7 @@ import {
166
166
  runCommand,
167
167
  startMacOSCommandLineToolsInstall,
168
168
  workspaceImageContentType
169
- } from "./chunk-FFD2YSZR.js";
169
+ } from "./chunk-MMUU5J64.js";
170
170
  import {
171
171
  APP_PREFERENCES_CACHE_KEY,
172
172
  APP_PREFERENCES_CACHE_TYPE,
@@ -178,7 +178,7 @@ import {
178
178
  isCliEntrypoint,
179
179
  now,
180
180
  textFromUnknown
181
- } from "./chunk-C4DAHPVI.js";
181
+ } from "./chunk-OW3B5BRD.js";
182
182
  import {
183
183
  AccountStateSchema,
184
184
  AdapterValidationReceiptSchema,
@@ -45,8 +45,8 @@ import {
45
45
  truncatePatch,
46
46
  uniqueSortedPaths,
47
47
  workspaceImageContentType
48
- } from "./chunk-FFD2YSZR.js";
49
- import "./chunk-C4DAHPVI.js";
48
+ } from "./chunk-MMUU5J64.js";
49
+ import "./chunk-OW3B5BRD.js";
50
50
  import "./chunk-UACZUFIA.js";
51
51
  export {
52
52
  MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,
package/dist/cli.js CHANGED
@@ -70,8 +70,8 @@ async function runEmbeddedCompanion(argv) {
70
70
  if (argv[0] === "__app-server") {
71
71
  process.argv = [process.execPath, "openpond-app-server", ...argv.slice(1)];
72
72
  const [{ createOpenPondAppServer }, { runOpenPondAppServerCli }] = await Promise.all([
73
- import("./chunks/app-server-runtime-2P2727X6.js"),
74
- import("./chunks/cli-Z2CULBCU.js")
73
+ import("./chunks/app-server-runtime-VKUKAGJF.js"),
74
+ import("./chunks/cli-IL3DJI7D.js")
75
75
  ]);
76
76
  await runOpenPondAppServerCli(createOpenPondAppServer);
77
77
  return true;
@@ -79,10 +79,10 @@ async function runEmbeddedCompanion(argv) {
79
79
  if (argv[0] === "__server") {
80
80
  process.argv = [process.execPath, "openpond-server", ...argv.slice(1)];
81
81
  const [{ createOpenPondServer }, { runOpenPondServerCli }] = await Promise.all([
82
- import("./chunks/src-R5VKB33T.js"),
83
- import("./chunks/cli-Z2CULBCU.js")
82
+ import("./chunks/src-G5WGKMQZ.js"),
83
+ import("./chunks/cli-IL3DJI7D.js")
84
84
  ]);
85
- const { createOpenPondAppServer } = await import("./chunks/app-server-runtime-2P2727X6.js");
85
+ const { createOpenPondAppServer } = await import("./chunks/app-server-runtime-VKUKAGJF.js");
86
86
  await runOpenPondServerCli({ createOpenPondServer, createOpenPondAppServer });
87
87
  return true;
88
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "openpondReleaseVersioned": true,
5
5
  "license": "MIT",
6
6
  "description": "OpenPond CLI and local harness",