@madewithremy/admin 0.1.61 → 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.
package/dist/ops/db.d.ts CHANGED
@@ -74,9 +74,13 @@ export declare function historyQuery(ctx: AdminContext, releaseId: string, sql:
74
74
  * run in one transaction; the attached copy is private to the call, so
75
75
  * nothing written into it lasts.
76
76
  *
77
+ * A past database larger than 1 GB can't be attached: read it with
78
+ * `historyQuery` instead, and write what's needed to live with `query`.
79
+ *
77
80
  * @param releaseId A release from `history()` that isn't `current`.
78
81
  * @throws AdminApiError the same as `historyQuery`; a `sql_error` is the
79
- * database refusing the statement, and nothing in it was applied.
82
+ * database refusing the statement, or a past database too large to attach,
83
+ * or a server with no room to copy it right now, and nothing was applied.
80
84
  * @example
81
85
  * await admin.db.historyAttach(releaseId,
82
86
  * 'UPDATE orders SET note = h.note FROM history.orders h WHERE h.id = orders.id AND orders.note IS NULL');
@@ -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
@@ -2405,6 +2406,10 @@ Past releases:
2405
2406
  statement runs as one transaction. The attached copy is private to the
2406
2407
  call, so writing into it changes nothing anywhere.
2407
2408
  PRAGMA history.table_info(<table>) shows a past table's columns.
2409
+ A past database larger than 1 GB can't be attached, and the sql_error says
2410
+ so: read what you need from it with 'db history query', then write that to
2411
+ live with 'db query'. One the server has no room to copy right now says
2412
+ that instead; try again shortly.
2408
2413
 
2409
2414
  Recovering data is a merge, not a rollback. Live has moved on since the
2410
2415
  copy was made (rows added, edits people meant to make), so decide what
@@ -7967,9 +7972,11 @@ function summary2(ctx, params) {
7967
7972
  var DEFAULT_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
7968
7973
  var usageSpecs = {
7969
7974
  "usage summary": {
7970
- 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>]",
7971
7976
  flags: {
7972
7977
  ...WINDOW,
7978
+ ...APP,
7979
+ scope: { type: "string", choices: ["run", "build"] },
7973
7980
  by: { type: "string", choices: ["method", "model", "step"] }
7974
7981
  }
7975
7982
  }
@@ -7981,6 +7988,7 @@ async function summary3(ctx, a) {
7981
7988
  await summary2(ctx, {
7982
7989
  startTime: start2,
7983
7990
  endTime: end,
7991
+ scope: a.str("scope"),
7984
7992
  groupBy: a.str("by")
7985
7993
  })
7986
7994
  );
@@ -7988,25 +7996,33 @@ async function summary3(ctx, a) {
7988
7996
  var usageHandlers = {
7989
7997
  "usage summary": summary3
7990
7998
  };
7991
- 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.
7992
8000
 
7993
8001
  Subcommands:
7994
- 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
7995
8003
 
7996
8004
  Usage:
7997
- 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>]
7998
8006
 
7999
8007
  Notes:
8000
- Costs are in dollars. Your own work on the app isn't counted: building it,
8001
- testing it in the sandbox, and its security assessments.
8002
- --by method (the default) is the spend each method drove, model the models'
8003
- share, step the whole spend by action, models and everything else. The window
8004
- defaults to the 30 days before --end, and --end to now. An app's own method
8005
- 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.
8006
8021
 
8007
8022
  Examples:
8008
8023
  remy-admin usage summary
8009
- 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`;
8010
8026
 
8011
8027
  // src/ops/events.ts
8012
8028
  function channelsList(ctx, params = {}) {
@@ -10337,7 +10353,7 @@ Commands:
10337
10353
  voice Phone numbers, voice call log + transcripts, voice policy settings
10338
10354
  agent Agent (chat) conversation log + transcripts
10339
10355
  tasks Task agent (runTask) log + transcripts
10340
- 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
10341
10357
  events Realtime events \u2014 live tail, test publish, channel activity
10342
10358
  jewels Monitor jewel shadowing; review + approve the proposal queue
10343
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.61",
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",