@madewithremy/admin 0.1.62 → 0.1.63

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.
@@ -1,40 +1,52 @@
1
1
  /**
2
- * Usage operations: what the app costs to run.
2
+ * Usage operations: what the app costs to run, and what building it cost.
3
3
  *
4
4
  * Ops are pure: (ctx, params) → typed result, throwing AdminApiError /
5
5
  * AdminTimeoutError. No printing, no process coupling — the CLI skin in
6
6
  * commands/usage.ts and the importable client both call these.
7
7
  */
8
8
  import type { AdminContext } from '../ctx.js';
9
- import type { UsageGroupBy, UsageSummaryResult } from '../types/usage.js';
9
+ import type { UsageGroupBy, UsageScope, UsageSummaryResult } from '../types/usage.js';
10
10
  export interface UsageSummaryParams {
11
11
  /** Window start, ISO 8601. */
12
12
  startTime: string;
13
13
  /** Window end, ISO 8601, after `startTime`. */
14
14
  endTime: string;
15
15
  /**
16
- * The breakdown (default `method`): `method` is the spend each method
17
- * drove, `model` the models' share, `step` the whole spend by action,
18
- * models and everything else.
16
+ * Which spend (default `run`): `run` is the app serving people, on its live
17
+ * release and its previews; `build` is Remy's work on the app, building it,
18
+ * testing it in the sandbox, and its security assessments.
19
+ */
20
+ scope?: UsageScope;
21
+ /**
22
+ * The breakdown: `method` is the spend each method drove, `model` the
23
+ * models' share, `step` the whole spend by action, models and everything
24
+ * else. The default is `method` for run and `model` for build, since build
25
+ * spend is mostly the builder's, which no method drove.
19
26
  */
20
27
  groupBy?: UsageGroupBy;
21
28
  }
22
29
  /**
23
- * The app's runtime spend over a window, broken down one way, in dollars.
24
- * Remy's own work on the app isn't counted: building it, testing it in the
25
- * sandbox, and its security assessments.
30
+ * The app's spend over a window, broken down one way, in dollars: what it
31
+ * costs to run by default, or with `scope: 'build'` what Remy's work on it
32
+ * cost. The two never overlap, and together they're everything the app spent.
26
33
  *
27
- * In a method, needs the `usage.view` admin permission.
34
+ * In a method, needs the `usage.view` admin permission, which reads both.
28
35
  *
29
36
  * @throws AdminApiError `invalid_window` (400) — a date that doesn't parse, or
30
- * an end not after the start; `invalid_group_by` (400);
31
- * `admin_permission_required:usage.view` (403) — a method that doesn't
32
- * declare it.
37
+ * an end not after the start; `invalid_scope` (400); `invalid_group_by`
38
+ * (400); `admin_permission_required:usage.view` (403) — a method that
39
+ * doesn't declare it.
33
40
  * @example
34
41
  * const { totalCostDollars, groups } = await admin.usage.summary({
35
42
  * startTime: '2026-10-01T00:00:00Z',
36
43
  * endTime: '2026-11-01T00:00:00Z',
37
44
  * groupBy: 'method',
38
45
  * });
46
+ * const build = await admin.usage.summary({
47
+ * startTime: '2026-11-01T00:00:00Z',
48
+ * endTime: '2026-11-08T00:00:00Z',
49
+ * scope: 'build',
50
+ * });
39
51
  */
40
52
  export declare function summary(ctx: AdminContext, params: UsageSummaryParams): Promise<UsageSummaryResult>;
package/dist/prod.js CHANGED
@@ -1505,8 +1505,9 @@ Usage:
1505
1505
  remy-admin previews revoke <shareId> <shareId> is a link's id, from 'list'
1506
1506
 
1507
1507
  Notes:
1508
- - A preview runs on a copy of live data, so a link is a credential: make one only
1509
- for what needs it, with the shortest --days that serves, and revoke it when done.
1508
+ - A link opens the app itself, running with its secrets and real effects, so it is
1509
+ a credential: make one only for what needs it, with the shortest --days that
1510
+ serves, and revoke it when done.
1510
1511
  - 'share' returns { link, url, token, previewUrl }, once. A person opens url. A
1511
1512
  client with no cookie jar (curl, git, CI, a test run) sends token as the
1512
1513
  X-Remy-Preview header on each request to previewUrl, beside the app's own
@@ -7971,9 +7972,11 @@ function summary2(ctx, params) {
7971
7972
  var DEFAULT_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
7972
7973
  var usageSpecs = {
7973
7974
  "usage summary": {
7974
- usage: "Usage: remy-admin usage summary [--start <iso>] [--end <iso>] [--by method|model|step]",
7975
+ usage: "Usage: remy-admin usage summary [--scope run|build] [--start <iso>] [--end <iso>] [--by method|model|step] [--app <appId>]",
7975
7976
  flags: {
7976
7977
  ...WINDOW,
7978
+ ...APP,
7979
+ scope: { type: "string", choices: ["run", "build"] },
7977
7980
  by: { type: "string", choices: ["method", "model", "step"] }
7978
7981
  }
7979
7982
  }
@@ -7985,6 +7988,7 @@ async function summary3(ctx, a) {
7985
7988
  await summary2(ctx, {
7986
7989
  startTime: start2,
7987
7990
  endTime: end,
7991
+ scope: a.str("scope"),
7988
7992
  groupBy: a.str("by")
7989
7993
  })
7990
7994
  );
@@ -7992,25 +7996,33 @@ async function summary3(ctx, a) {
7992
7996
  var usageHandlers = {
7993
7997
  "usage summary": summary3
7994
7998
  };
7995
- var usageHelp = `remy-admin usage \u2014 What the app costs to run.
7999
+ var usageHelp = `remy-admin usage \u2014 What the app costs to run, and what building it cost.
7996
8000
 
7997
8001
  Subcommands:
7998
- summary The app's runtime spend over a window, broken down one way
8002
+ summary The app's spend over a window, run or build, broken down one way
7999
8003
 
8000
8004
  Usage:
8001
- remy-admin usage summary [--start <iso>] [--end <iso>] [--by method|model|step]
8005
+ remy-admin usage summary [--scope run|build] [--start <iso>] [--end <iso>] [--by method|model|step] [--app <appId>]
8002
8006
 
8003
8007
  Notes:
8004
- Costs are in dollars. Your own work on the app isn't counted: building it,
8005
- testing it in the sandbox, and its security assessments.
8006
- --by method (the default) is the spend each method drove, model the models'
8007
- share, step the whole spend by action, models and everything else. The window
8008
- defaults to the 30 days before --end, and --end to now. An app's own method
8009
- can read this with the 'usage.view' admin permission.
8008
+ Costs are in dollars. --scope run (the default) is the app serving people, on
8009
+ its live release and its previews. --scope build is your own work on the app:
8010
+ building it, testing it in the sandbox, and its security assessments. The two
8011
+ never overlap.
8012
+ --by method is the spend each method drove, model the models' share, step the
8013
+ whole spend by action, models and everything else. It defaults to method for
8014
+ run and model for build, since build spend is mostly the builder's, which no
8015
+ method drove. The window defaults to the 30 days before --end, and --end to
8016
+ now. An app's own method can read both scopes with the 'usage.view' admin
8017
+ permission.
8018
+ '--app <appId>' reads another app in the workspace with this credential;
8019
+ 'remy-admin apps list' gives the ids. Outside an app's workspace (a laptop,
8020
+ CI) it's how you name the app.
8010
8021
 
8011
8022
  Examples:
8012
8023
  remy-admin usage summary
8013
- remy-admin usage summary --by model --start 2026-10-01T00:00:00Z`;
8024
+ remy-admin usage summary --by model --start 2026-10-01T00:00:00Z
8025
+ remy-admin usage summary --scope build --start 2026-11-01T00:00:00Z --end 2026-11-08T00:00:00Z`;
8014
8026
 
8015
8027
  // src/ops/events.ts
8016
8028
  function channelsList(ctx, params = {}) {
@@ -10341,7 +10353,7 @@ Commands:
10341
10353
  voice Phone numbers, voice call log + transcripts, voice policy settings
10342
10354
  agent Agent (chat) conversation log + transcripts
10343
10355
  tasks Task agent (runTask) log + transcripts
10344
- usage What the app costs to run, by method, model or step
10356
+ usage What the app costs to run, and what building it cost
10345
10357
  events Realtime events \u2014 live tail, test publish, channel activity
10346
10358
  jewels Monitor jewel shadowing; review + approve the proposal queue
10347
10359
  settings App settings \u2014 signup allowlist, test accounts, embed origins, toggles
@@ -1,9 +1,15 @@
1
1
  /**
2
- * Response types for an app's runtime cost.
2
+ * Response types for an app's cost: to run, or to build.
3
3
  *
4
4
  * Transcribed from the api (apps/api/src/):
5
5
  * roles/http/routes/Apps/manage/usage.ts — the route and its shape
6
6
  */
7
+ /**
8
+ * Which spend is counted: `run` is the app serving people, on its live
9
+ * release and its previews; `build` is Remy's work on the app, building it,
10
+ * testing it in the sandbox, and its security assessments.
11
+ */
12
+ export type UsageScope = 'run' | 'build';
7
13
  /** How the spend is broken down. */
8
14
  export type UsageGroupBy = 'method' | 'model' | 'step';
9
15
  /** One row of the breakdown. */
@@ -19,6 +25,7 @@ export interface UsageGroup {
19
25
  modelType?: string;
20
26
  }
21
27
  export interface UsageSummaryResult {
28
+ scope: UsageScope;
22
29
  groupBy: UsageGroupBy;
23
30
  startTime: string;
24
31
  endTime: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madewithremy/admin",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "description": "Admin SDK + CLI for managing production Remy apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",