@jeffreyjyz/mpc 0.1.0 → 0.1.2
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.
- package/package.json +6 -2
- package/src/cli/engine/ability.ts +1 -1
- package/src/cli/engine/cost.ts +2 -2
- package/src/cli/engine/index.ts +2 -2
- package/src/cli/engine/project.ts +3 -3
- package/src/cli/engine/rows.ts +2 -2
- package/src/cli/engine/score.ts +2 -2
- package/src/cli/flow/check.ts +4 -4
- package/src/cli/flow/collect.ts +9 -9
- package/src/cli/flow/columns.ts +2 -2
- package/src/cli/flow/sort.ts +2 -2
- package/src/cli/options.ts +2 -2
- package/src/cli/parse/cac.ts +1 -1
- package/src/cli/parse/fields.ts +1 -1
- package/src/cli/parse/map.ts +3 -3
- package/src/cli/parse/validate.ts +1 -1
- package/src/cli/run.ts +4 -4
- package/src/constants/cli.ts +3 -3
- package/src/constants/scoring.ts +1 -1
- package/src/constants/view.ts +3 -3
- package/src/data/bench/cc.ts +2 -2
- package/src/data/bench/resolve.ts +1 -1
- package/src/data/bench/store.ts +4 -4
- package/src/data/scrape/catalog/catalog.ts +3 -3
- package/src/data/scrape/catalog/deal.ts +3 -3
- package/src/data/scrape/catalog/numeric.ts +2 -2
- package/src/data/scrape/roleRows.ts +1 -1
- package/src/data/scrape/tables.ts +1 -1
- package/src/data/shape.ts +2 -2
- package/src/data/sources/aa/api.ts +1 -1
- package/src/data/sources/aa/parse.ts +1 -1
- package/src/data/sources/aa/web.ts +3 -3
- package/src/data/sources/cc/catalog.ts +3 -3
- package/src/data/sources/cc/cmduse.ts +1 -1
- package/src/data/sources/cc/plans.ts +2 -2
- package/src/data/sources/opencode.ts +7 -3
- package/src/data/usage/index.ts +1 -1
- package/src/data/usage/log.ts +1 -1
- package/src/data/usage/logs.ts +1 -1
- package/src/data/usage/opencodeDb.ts +1 -1
- package/src/data/usage/parse.ts +2 -2
- package/src/keys.ts +1 -1
- package/src/view/columns/cc.ts +2 -2
- package/src/view/columns/meta.ts +3 -3
- package/src/view/columns/oc.ts +2 -2
- package/src/view/footer.ts +2 -2
- package/src/view/layout/fit.ts +3 -3
- package/src/view/layout/segments.ts +4 -4
- package/src/view/layout/table.ts +4 -4
- package/src/view/layout/usage.ts +4 -4
- package/src/view/render.ts +2 -2
- package/src/view/schema.ts +1 -1
- package/src/view/text/export.ts +3 -3
- package/src/view/text/format.ts +3 -3
- package/src/view/text/index.ts +1 -1
- package/src/view/text/styles.ts +3 -3
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffreyjyz/mpc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Compare model pricing across opencode Go and Command Code plans",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"mpc": "src/index.ts"
|
|
8
|
+
"mpc": "src/index.ts",
|
|
9
|
+
"mpcdev": "src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"imports": {
|
|
12
|
+
"#~/*": "./src/*"
|
|
9
13
|
},
|
|
10
14
|
"files": [
|
|
11
15
|
"src",
|
package/src/cli/engine/cost.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PER_MILLION } from "
|
|
2
|
-
import type { ModelPricing, PlanInfo, Workload } from "
|
|
1
|
+
import { PER_MILLION } from "#~/constants/scoring.ts";
|
|
2
|
+
import type { ModelPricing, PlanInfo, Workload } from "#~/types.ts";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* USD of list-rate spend for a single request under the fixed workload.
|
package/src/cli/engine/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DEFAULT_SCORE } from "
|
|
1
|
+
import { DEFAULT_SCORE } from "#~/constants/scoring.ts";
|
|
2
2
|
import type {
|
|
3
3
|
CatalogEntry,
|
|
4
4
|
EntryMetrics,
|
|
5
5
|
PlanInfo,
|
|
6
6
|
ProviderId,
|
|
7
7
|
Workload,
|
|
8
|
-
} from "
|
|
8
|
+
} from "#~/types.ts";
|
|
9
9
|
import { lookupAbility, lookupTps } from "./ability.ts";
|
|
10
10
|
import { costPerRequest, windowRatios } from "./cost.ts";
|
|
11
11
|
import { assignIndex, assignValueIndex, type ScoreConfig } from "./score.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PER_MILLION } from "
|
|
2
|
-
import type { UsageEntry } from "
|
|
3
|
-
import type { CatalogEntry, PlanInfo, ProviderId } from "
|
|
1
|
+
import { PER_MILLION } from "#~/constants/scoring.ts";
|
|
2
|
+
import type { UsageEntry } from "#~/data/usage/index.ts";
|
|
3
|
+
import type { CatalogEntry, PlanInfo, ProviderId } from "#~/types.ts";
|
|
4
4
|
|
|
5
5
|
export interface SideProjection {
|
|
6
6
|
/** Cost of one real request at list rates. */
|
package/src/cli/engine/rows.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_SCORE } from "
|
|
1
|
+
import { DEFAULT_SCORE } from "#~/constants/scoring.ts";
|
|
2
2
|
import type {
|
|
3
3
|
CatalogEntry,
|
|
4
4
|
CompareRow,
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
PlanInfo,
|
|
7
7
|
ProviderId,
|
|
8
8
|
Workload,
|
|
9
|
-
} from "
|
|
9
|
+
} from "#~/types.ts";
|
|
10
10
|
import { buildMetrics } from "./index.ts";
|
|
11
11
|
import type { ScoreConfig } from "./score.ts";
|
|
12
12
|
|
package/src/cli/engine/score.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ScaleMode } from "
|
|
2
|
-
import type { EntryMetrics } from "
|
|
1
|
+
import type { ScaleMode } from "#~/cli/options.ts";
|
|
2
|
+
import type { EntryMetrics } from "#~/types.ts";
|
|
3
3
|
import { logMinmax, minmax } from "./cost.ts";
|
|
4
4
|
|
|
5
5
|
/** Everything the scorer can be told to do differently. */
|
package/src/cli/flow/check.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Options } from "
|
|
2
|
-
import { loadOcGoModelIds } from "
|
|
3
|
-
import { normalizeKey } from "
|
|
4
|
-
import type { CatalogEntry, CompareRow } from "
|
|
1
|
+
import type { Options } from "#~/cli/options.ts";
|
|
2
|
+
import { loadOcGoModelIds } from "#~/data/sources/opencode.ts";
|
|
3
|
+
import { normalizeKey } from "#~/keys.ts";
|
|
4
|
+
import type { CatalogEntry, CompareRow } from "#~/types.ts";
|
|
5
5
|
|
|
6
6
|
export interface AbilityInfo {
|
|
7
7
|
label: string;
|
package/src/cli/flow/collect.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { buildRows } from "
|
|
2
|
-
import type { ScoreConfig } from "
|
|
3
|
-
import type { Options } from "
|
|
4
|
-
import { loadAbility } from "
|
|
5
|
-
import { loadShapes } from "
|
|
6
|
-
import { loadCcCatalog } from "
|
|
7
|
-
import { loadCcPlan } from "
|
|
8
|
-
import { loadOcGoCatalog, ocGoPlan } from "
|
|
9
|
-
import type { ProviderId, Workload } from "
|
|
1
|
+
import { buildRows } from "#~/cli/engine/index.ts";
|
|
2
|
+
import type { ScoreConfig } from "#~/cli/engine/score.ts";
|
|
3
|
+
import type { Options } from "#~/cli/options.ts";
|
|
4
|
+
import { loadAbility } from "#~/data/bench/index.ts";
|
|
5
|
+
import { loadShapes } from "#~/data/shape.ts";
|
|
6
|
+
import { loadCcCatalog } from "#~/data/sources/cc/catalog.ts";
|
|
7
|
+
import { loadCcPlan } from "#~/data/sources/cc/plans.ts";
|
|
8
|
+
import { loadOcGoCatalog, ocGoPlan } from "#~/data/sources/opencode.ts";
|
|
9
|
+
import type { ProviderId, Workload } from "#~/types.ts";
|
|
10
10
|
|
|
11
11
|
function scoreConfig(options: Options): ScoreConfig {
|
|
12
12
|
return {
|
package/src/cli/flow/columns.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Options } from "
|
|
2
|
-
import { SETS, TIERS, type Tier } from "
|
|
1
|
+
import type { Options } from "#~/cli/options.ts";
|
|
2
|
+
import { SETS, TIERS, type Tier } from "#~/constants/cli.ts";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The tier the flags asked for. The default is the full set — `--fit` used to
|
package/src/cli/flow/sort.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Metric, Options } from "
|
|
2
|
-
import type { CompareRow } from "
|
|
1
|
+
import type { Metric, Options } from "#~/cli/options.ts";
|
|
2
|
+
import type { CompareRow } from "#~/types.ts";
|
|
3
3
|
|
|
4
4
|
export function matches(row: CompareRow, pattern: Options["model"]): boolean {
|
|
5
5
|
if (!pattern) return true;
|
package/src/cli/options.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FORMATS, METRICS } from "
|
|
2
|
-
import type { Workload } from "
|
|
1
|
+
import { FORMATS, METRICS } from "#~/constants/cli.ts";
|
|
2
|
+
import type { Workload } from "#~/types.ts";
|
|
3
3
|
|
|
4
4
|
export type Metric = "val" | "cost" | "perreq" | "req" | "name";
|
|
5
5
|
export type ColorMode = "auto" | "always" | "never";
|
package/src/cli/parse/cac.ts
CHANGED
package/src/cli/parse/fields.ts
CHANGED
package/src/cli/parse/map.ts
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
parseMetric,
|
|
7
7
|
parseOnly,
|
|
8
8
|
type ScaleMode,
|
|
9
|
-
} from "
|
|
10
|
-
import { ARG_DEFAULTS, BENCH_DEFAULT } from "
|
|
11
|
-
import { SHAPE_MEASURED } from "
|
|
9
|
+
} from "#~/cli/options.ts";
|
|
10
|
+
import { ARG_DEFAULTS, BENCH_DEFAULT } from "#~/constants/cli.ts";
|
|
11
|
+
import { SHAPE_MEASURED } from "#~/constants/shape.ts";
|
|
12
12
|
import {
|
|
13
13
|
colorMode,
|
|
14
14
|
numbers,
|
package/src/cli/run.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { COLUMN_HELP, COLUMN_IDS } from "
|
|
3
|
-
import { loadUsage } from "
|
|
4
|
-
import { renderUsage } from "
|
|
2
|
+
import { COLUMN_HELP, COLUMN_IDS } from "#~/constants/view.ts";
|
|
3
|
+
import { loadUsage } from "#~/data/usage/index.ts";
|
|
4
|
+
import { renderUsage } from "#~/view/layout/usage.ts";
|
|
5
5
|
import {
|
|
6
6
|
fitColumns,
|
|
7
7
|
renderCsv,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
setColorMode,
|
|
12
12
|
setThresholds,
|
|
13
13
|
tally,
|
|
14
|
-
} from "
|
|
14
|
+
} from "#~/view/render.ts";
|
|
15
15
|
import { describeConfig, resolveBag } from "./config.ts";
|
|
16
16
|
import { project } from "./engine/project.ts";
|
|
17
17
|
import { runCheck } from "./flow/check.ts";
|
package/src/constants/cli.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Format, Metric } from "
|
|
2
|
-
import { SHAPE_AUTO } from "
|
|
1
|
+
import type { Format, Metric } from "#~/cli/options.ts";
|
|
2
|
+
import { SHAPE_AUTO } from "#~/constants/shape.ts";
|
|
3
3
|
import {
|
|
4
4
|
DETAIL_COLUMNS,
|
|
5
5
|
MEDIUM_COLUMNS,
|
|
6
6
|
MINIMAL_COLUMNS,
|
|
7
|
-
} from "
|
|
7
|
+
} from "#~/constants/view.ts";
|
|
8
8
|
|
|
9
9
|
/** Workload defaults asserted by `--in` / `--cache` / `--out` when unset. */
|
|
10
10
|
export const OPTION_DEFAULTS = {
|
package/src/constants/scoring.ts
CHANGED
package/src/constants/view.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ProviderId } from "
|
|
2
|
-
import { CC_COLUMNS } from "
|
|
3
|
-
import { OC_COLUMNS } from "
|
|
1
|
+
import type { ProviderId } from "#~/types.ts";
|
|
2
|
+
import { CC_COLUMNS } from "#~/view/columns/cc.ts";
|
|
3
|
+
import { OC_COLUMNS } from "#~/view/columns/oc.ts";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* SGR codes with **one meaning each**. `green` = favourable (cheaper side, free,
|
package/src/data/bench/cc.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PAGES, TPS_HEADER } from "
|
|
1
|
+
import { PAGES, TPS_HEADER } from "#~/constants/sources.ts";
|
|
2
2
|
import {
|
|
3
3
|
extractNumericColumn,
|
|
4
4
|
fetchText,
|
|
5
5
|
parseTables,
|
|
6
|
-
} from "
|
|
6
|
+
} from "#~/data/scrape/index.ts";
|
|
7
7
|
import { type BenchData, emptyData } from "./types.ts";
|
|
8
8
|
|
|
9
9
|
export async function loadCc(): Promise<BenchData> {
|
package/src/data/bench/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CACHE_TTL_MS } from "
|
|
2
|
-
import { fetchText } from "
|
|
3
|
-
import { normalizeKey } from "
|
|
1
|
+
import { CACHE_TTL_MS } from "#~/constants/sources.ts";
|
|
2
|
+
import { fetchText } from "#~/data/scrape/index.ts";
|
|
3
|
+
import { normalizeKey } from "#~/keys.ts";
|
|
4
4
|
|
|
5
5
|
function parseJsonScores(text: string): Map<string, number> {
|
|
6
6
|
const body = JSON.parse(text) as unknown;
|
|
@@ -39,7 +39,7 @@ export async function loadUrl(url: string): Promise<Map<string, number>> {
|
|
|
39
39
|
import { mkdir } from "node:fs/promises";
|
|
40
40
|
import { homedir } from "node:os";
|
|
41
41
|
import { join } from "node:path";
|
|
42
|
-
import { loadAaWeb } from "
|
|
42
|
+
import { loadAaWeb } from "#~/data/sources/aa/web.ts";
|
|
43
43
|
|
|
44
44
|
function cachePath(): string {
|
|
45
45
|
const base = process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache");
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
nameCell,
|
|
5
5
|
parseMoney,
|
|
6
6
|
type Table,
|
|
7
|
-
} from "
|
|
8
|
-
import { displayName, normalizeKey } from "
|
|
9
|
-
import type { CatalogEntry, ModelPricing, ProviderId } from "
|
|
7
|
+
} from "#~/data/scrape/tables.ts";
|
|
8
|
+
import { displayName, normalizeKey } from "#~/keys.ts";
|
|
9
|
+
import type { CatalogEntry, ModelPricing, ProviderId } from "#~/types.ts";
|
|
10
10
|
import { dealIn } from "./deal.ts";
|
|
11
11
|
import { variantScore } from "./variant.ts";
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BADGE, BOUNDARY, ENDS } from "
|
|
2
|
-
import { cellText } from "
|
|
3
|
-
import type { Deal } from "
|
|
1
|
+
import { BADGE, BOUNDARY, ENDS } from "#~/constants/data.ts";
|
|
2
|
+
import { cellText } from "#~/data/scrape/tables.ts";
|
|
3
|
+
import type { Deal } from "#~/types.ts";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Read the promotion from a raw model name cell. `nameCell` deliberately keeps
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
headerIndex,
|
|
4
4
|
nameCell,
|
|
5
5
|
type Table,
|
|
6
|
-
} from "
|
|
7
|
-
import { normalizeKey } from "
|
|
6
|
+
} from "#~/data/scrape/tables.ts";
|
|
7
|
+
import { normalizeKey } from "#~/keys.ts";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Pull one numeric column out of any tables that carry it, keyed by model.
|
package/src/data/shape.ts
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
SHAPE_MEASURED,
|
|
5
5
|
SHAPE_MIN_REQS,
|
|
6
6
|
SHAPE_OFF,
|
|
7
|
-
} from "
|
|
8
|
-
import type { Workload } from "
|
|
7
|
+
} from "#~/constants/shape.ts";
|
|
8
|
+
import type { Workload } from "#~/types.ts";
|
|
9
9
|
import { runBinary } from "./cmduse.ts";
|
|
10
10
|
|
|
11
11
|
interface Profile {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AA_MODELS_URL } from "
|
|
2
|
-
import { fetchText } from "
|
|
3
|
-
import { normalizeKey } from "
|
|
1
|
+
import { AA_MODELS_URL } from "#~/constants/sources.ts";
|
|
2
|
+
import { fetchText } from "#~/data/scrape/index.ts";
|
|
3
|
+
import { normalizeKey } from "#~/keys.ts";
|
|
4
4
|
|
|
5
5
|
/** A model label and its Artificial Analysis Intelligence Index. */
|
|
6
6
|
interface Scored {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CC_PLANS } from "
|
|
1
|
+
import { CC_PLANS } from "#~/constants/sources.ts";
|
|
2
2
|
import {
|
|
3
3
|
extractCatalog,
|
|
4
4
|
fetchText,
|
|
5
5
|
parseRoleRows,
|
|
6
6
|
parseTables,
|
|
7
|
-
} from "
|
|
8
|
-
import type { CatalogEntry } from "
|
|
7
|
+
} from "#~/data/scrape/index.ts";
|
|
8
|
+
import type { CatalogEntry } from "#~/types.ts";
|
|
9
9
|
|
|
10
10
|
/** Per-model token rates + monthly credit allowance for a CommandCode plan. */
|
|
11
11
|
export async function loadCcCatalog(planId: string): Promise<CatalogEntry[]> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CC_PLANS } from "
|
|
2
|
-
import type { PlanInfo } from "
|
|
1
|
+
import { CC_PLANS } from "#~/constants/sources.ts";
|
|
2
|
+
import type { PlanInfo } from "#~/types.ts";
|
|
3
3
|
import { cmdusePlans, money } from "./cmduse.ts";
|
|
4
4
|
|
|
5
5
|
/** Plan price + windows for a CommandCode plan, from the official JSON. */
|
|
@@ -2,9 +2,13 @@ import {
|
|
|
2
2
|
DOC_URL,
|
|
3
3
|
OC_MODELS_URL,
|
|
4
4
|
PRICE_PER_MONTH,
|
|
5
|
-
} from "
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
} from "#~/constants/sources.ts";
|
|
6
|
+
import {
|
|
7
|
+
extractCatalog,
|
|
8
|
+
fetchText,
|
|
9
|
+
parseTables,
|
|
10
|
+
} from "#~/data/scrape/index.ts";
|
|
11
|
+
import type { CatalogEntry, PlanInfo } from "#~/types.ts";
|
|
8
12
|
|
|
9
13
|
/** Per-model token rates + monthly usage limit for OpenCode Go. */
|
|
10
14
|
export async function loadOcGoCatalog(peak = false): Promise<CatalogEntry[]> {
|
package/src/data/usage/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runCmduse } from "
|
|
1
|
+
import { runCmduse } from "#~/data/cmduse.ts";
|
|
2
2
|
import { defaultUsageLog, mergeUsage, readUsageLog } from "./log.ts";
|
|
3
3
|
import { scanLogs } from "./logs.ts";
|
|
4
4
|
import { defaultOpencodeDb, readOpencodeDb } from "./opencodeDb.ts";
|
package/src/data/usage/log.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { normalizeKey } from "
|
|
4
|
+
import { normalizeKey } from "#~/keys.ts";
|
|
5
5
|
import type { UsageEntry } from "./parse.ts";
|
|
6
6
|
|
|
7
7
|
interface LogLine {
|
package/src/data/usage/logs.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { normalizeKey } from "
|
|
4
|
+
import { normalizeKey } from "#~/keys.ts";
|
|
5
5
|
import type { UsageEntry } from "./parse.ts";
|
|
6
6
|
|
|
7
7
|
interface Totals {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Database } from "bun:sqlite";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { normalizeKey } from "
|
|
4
|
+
import { normalizeKey } from "#~/keys.ts";
|
|
5
5
|
import { hasV2, readV2Turns, type Turn } from "./opencodeV2.ts";
|
|
6
6
|
import type { UsageEntry } from "./parse.ts";
|
|
7
7
|
|
package/src/data/usage/parse.ts
CHANGED
package/src/keys.ts
CHANGED
package/src/view/columns/cc.ts
CHANGED
package/src/view/columns/meta.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SGR } from "
|
|
2
|
-
import type { Column } from "
|
|
3
|
-
import * as f from "
|
|
1
|
+
import { SGR } from "#~/constants/view.ts";
|
|
2
|
+
import type { Column } from "#~/view/schema.ts";
|
|
3
|
+
import * as f from "#~/view/text/index.ts";
|
|
4
4
|
|
|
5
5
|
export const META_COLUMNS: Record<string, Column> = {
|
|
6
6
|
model: { header: "MODEL", value: (r) => r.name, style: () => SGR.bold },
|
package/src/view/columns/oc.ts
CHANGED
package/src/view/footer.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LEGEND, PROVIDER_COLOR, SGR } from "
|
|
2
|
-
import type { CompareRow, PlanInfo, Workload } from "
|
|
1
|
+
import { LEGEND, PROVIDER_COLOR, SGR } from "#~/constants/view.ts";
|
|
2
|
+
import type { CompareRow, PlanInfo, Workload } from "#~/types.ts";
|
|
3
3
|
import { tally } from "./layout/segments.ts";
|
|
4
4
|
import type { ReportMeta } from "./schema.ts";
|
|
5
5
|
import {
|
package/src/view/layout/fit.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BAR } from "
|
|
2
|
-
import type { Column, FitResult, Row } from "
|
|
3
|
-
import { columns } from "
|
|
1
|
+
import { BAR } from "#~/constants/view.ts";
|
|
2
|
+
import type { Column, FitResult, Row } from "#~/view/schema.ts";
|
|
3
|
+
import { columns } from "#~/view/schema.ts";
|
|
4
4
|
import { buildSegments } from "./segments.ts";
|
|
5
5
|
|
|
6
6
|
function measure(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GAP } from "
|
|
2
|
-
import type { Column, GroupKey, Segment } from "
|
|
3
|
-
import { paint } from "
|
|
1
|
+
import { GAP } from "#~/constants/view.ts";
|
|
2
|
+
import type { Column, GroupKey, Segment } from "#~/view/schema.ts";
|
|
3
|
+
import { paint } from "#~/view/text/index.ts";
|
|
4
4
|
|
|
5
5
|
function groupOf(id: string): GroupKey {
|
|
6
6
|
if (id === "model") return "model";
|
|
@@ -70,7 +70,7 @@ export function renderSegment(
|
|
|
70
70
|
.join(GAP);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
import type { Row, Tally } from "
|
|
73
|
+
import type { Row, Tally } from "#~/view/schema.ts";
|
|
74
74
|
|
|
75
75
|
export function tally(rows: Row[]): Tally {
|
|
76
76
|
const result: Tally = {
|
package/src/view/layout/table.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BAR, BAR_RULE, SGR } from "
|
|
2
|
-
import type { Column, GroupKey, GroupLabel, Row } from "
|
|
3
|
-
import { columns } from "
|
|
4
|
-
import { paint } from "
|
|
1
|
+
import { BAR, BAR_RULE, SGR } from "#~/constants/view.ts";
|
|
2
|
+
import type { Column, GroupKey, GroupLabel, Row } from "#~/view/schema.ts";
|
|
3
|
+
import { columns } from "#~/view/schema.ts";
|
|
4
|
+
import { paint } from "#~/view/text/index.ts";
|
|
5
5
|
import { buildSegments, renderSegment } from "./segments.ts";
|
|
6
6
|
|
|
7
7
|
function measure(
|
package/src/view/layout/usage.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { UsageProjection, UsageRow } from "
|
|
2
|
-
import { HEADERS, SGR } from "
|
|
3
|
-
import type { PlanInfo, ProviderId } from "
|
|
4
|
-
import { fmtCount, fmtUsd, paint, planTitle } from "
|
|
1
|
+
import type { UsageProjection, UsageRow } from "#~/cli/engine/project.ts";
|
|
2
|
+
import { HEADERS, SGR } from "#~/constants/view.ts";
|
|
3
|
+
import type { PlanInfo, ProviderId } from "#~/types.ts";
|
|
4
|
+
import { fmtCount, fmtUsd, paint, planTitle } from "#~/view/text/index.ts";
|
|
5
5
|
|
|
6
6
|
export interface UsageMeta {
|
|
7
7
|
label: string;
|
package/src/view/render.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PROVIDER_COLOR, SGR } from "
|
|
2
|
-
import type { CompareRow } from "
|
|
1
|
+
import { PROVIDER_COLOR, SGR } from "#~/constants/view.ts";
|
|
2
|
+
import type { CompareRow } from "#~/types.ts";
|
|
3
3
|
import { footer } from "./footer.ts";
|
|
4
4
|
import { tally } from "./layout/segments.ts";
|
|
5
5
|
import { printTable } from "./layout/table.ts";
|
package/src/view/schema.ts
CHANGED
package/src/view/text/export.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CSV_HEADER } from "
|
|
2
|
-
import type { PlanInfo } from "
|
|
3
|
-
import type { Row, Tally } from "
|
|
1
|
+
import { CSV_HEADER } from "#~/constants/view.ts";
|
|
2
|
+
import type { PlanInfo } from "#~/types.ts";
|
|
3
|
+
import type { Row, Tally } from "#~/view/schema.ts";
|
|
4
4
|
import { fmtAbility, fmtCount, fmtTps, planTitle } from "./format.ts";
|
|
5
5
|
|
|
6
6
|
function csvCell(value: string | number): string {
|
package/src/view/text/format.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EntryMetrics } from "
|
|
2
|
-
import type { Row } from "
|
|
1
|
+
import type { EntryMetrics } from "#~/types.ts";
|
|
2
|
+
import type { Row } from "#~/view/schema.ts";
|
|
3
3
|
|
|
4
4
|
export function fmtCount(n: number): string {
|
|
5
5
|
if (!Number.isFinite(n)) return "∞";
|
|
@@ -59,7 +59,7 @@ export function fmtTps(row: Row): string {
|
|
|
59
59
|
return tps === null ? "—" : Math.round(tps).toString();
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
import type { ProviderId } from "
|
|
62
|
+
import type { ProviderId } from "#~/types.ts";
|
|
63
63
|
|
|
64
64
|
export function providerName(provider: ProviderId): string {
|
|
65
65
|
return provider === "oc-go" ? "OpenCode" : "CommandCode";
|
package/src/view/text/index.ts
CHANGED
package/src/view/text/styles.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PROVIDER_COLOR, PROVIDER_TINT, SGR } from "
|
|
2
|
-
import type { EntryMetrics, ProviderId } from "
|
|
3
|
-
import type { Row } from "
|
|
1
|
+
import { PROVIDER_COLOR, PROVIDER_TINT, SGR } from "#~/constants/view.ts";
|
|
2
|
+
import type { EntryMetrics, ProviderId } from "#~/types.ts";
|
|
3
|
+
import type { Row } from "#~/view/schema.ts";
|
|
4
4
|
import { fmtRate, shortProviderName } from "./format.ts";
|
|
5
5
|
|
|
6
6
|
/** Which side is cheaper per request on this row. */
|