@madewithremy/admin 0.1.52 → 0.1.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.
package/dist/prod.js CHANGED
@@ -1034,7 +1034,7 @@ async function primaryUrl(ctx) {
1034
1034
  return dashboard.primaryUrl;
1035
1035
  }
1036
1036
  function summarizeRelease(release) {
1037
- const summary2 = {
1037
+ const summary4 = {
1038
1038
  releaseId: release.id,
1039
1039
  commitSha: release.commitSha,
1040
1040
  branch: release.branch ?? null,
@@ -1046,16 +1046,16 @@ function summarizeRelease(release) {
1046
1046
  };
1047
1047
  const readers = (release.dataSources ?? []).filter((d) => d.reader);
1048
1048
  if (readers.length > 0 && release.status === "live") {
1049
- summary2.readers = readers.map((d) => ({
1049
+ summary4.readers = readers.map((d) => ({
1050
1050
  slug: d.slug,
1051
1051
  unread: d.readerUnread ?? 0
1052
1052
  }));
1053
1053
  }
1054
1054
  if (release.status !== "failed") {
1055
- return summary2;
1055
+ return summary4;
1056
1056
  }
1057
1057
  return {
1058
- ...summary2,
1058
+ ...summary4,
1059
1059
  error: release.failureReason ?? "Build failed (no error entry in the build log)",
1060
1060
  ...release.failureKind ? { failureKind: release.failureKind } : {},
1061
1061
  ...release.failurePhase ? { failurePhase: release.failurePhase } : {}
@@ -4476,10 +4476,10 @@ function failOnWait(result) {
4476
4476
  );
4477
4477
  }
4478
4478
  }
4479
- async function waitAndReport(ctx, a, id, mode, summary2) {
4479
+ async function waitAndReport(ctx, a, id, mode, summary4) {
4480
4480
  const wait = mode === "plan" ? waitForPlan : waitForJob;
4481
4481
  const result = await wait(ctx, { id, ...timeoutOf(a), onProgress: progress });
4482
- out({ ...summary2, ...result });
4482
+ out({ ...summary4, ...result });
4483
4483
  failOnWait(result);
4484
4484
  }
4485
4485
 
@@ -7611,7 +7611,7 @@ Subcommands:
7611
7611
  numbers list The app's dedicated phone number(s) and their status
7612
7612
  numbers search Search available US numbers by area code / locality
7613
7613
  numbers buy Buy + attach a dedicated number ($1/month \u2014 confirm with the user first)
7614
- numbers release Release the number (permanent \u2014 the rental stops, no refund, ~15-day carrier quarantine)
7614
+ numbers release Release a number (permanent \u2014 the rental stops, no refund, ~15-day carrier quarantine)
7615
7615
  numbers set-name Set/clear the outbound caller-ID display name (CNAM)
7616
7616
  sessions list Call log (web, phone-out, phone-in), newest first
7617
7617
  sessions get One session with full transcript and cost breakdown
@@ -7635,9 +7635,11 @@ Examples:
7635
7635
 
7636
7636
  Notes:
7637
7637
  Buying a number starts a recurring $1/month workspace charge \u2014 never run
7638
- 'numbers buy' without the user's explicit confirmation. The dedicated number
7639
- is both the outbound caller ID for voice.call() and the app's inbound line
7640
- (inbound calls answer the LIVE release's voice agent). A 'pending' number
7638
+ 'numbers buy' without the user's explicit confirmation. An app can hold
7639
+ several numbers (one per tenant, say), up to its workspace's limit
7640
+ (phone_number_limit_reached past it; support raises it). Each is an inbound
7641
+ line (answered by the LIVE release's voice agent) and a caller ID for
7642
+ voice.call(), which takes 'from' once there are several. A 'pending' number
7641
7643
  usually activates within seconds \u2014 poll 'numbers list'. The display name
7642
7644
  (CNAM) is 1-15 letters/numbers/spaces and takes 12-72h to propagate.
7643
7645
  'settings set' merges \u2014 settings you don't pass keep their current values.
@@ -7805,6 +7807,59 @@ Examples:
7805
7807
  remy-admin tasks list --limit 10
7806
7808
  remy-admin tasks get 0b9e\u2026`;
7807
7809
 
7810
+ // src/ops/usage.ts
7811
+ function summary2(ctx, params) {
7812
+ return call(
7813
+ ctx,
7814
+ "GET",
7815
+ `/_internal/v2/apps/${ctx.appId}/usage/summary${qs(params)}`
7816
+ );
7817
+ }
7818
+
7819
+ // src/commands/usage.ts
7820
+ var DEFAULT_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
7821
+ var usageSpecs = {
7822
+ "usage summary": {
7823
+ usage: "Usage: remy-admin usage summary [--start <iso>] [--end <iso>] [--by method|model|step]",
7824
+ flags: {
7825
+ ...WINDOW,
7826
+ by: { type: "string", choices: ["method", "model", "step"] }
7827
+ }
7828
+ }
7829
+ };
7830
+ async function summary3(ctx, a) {
7831
+ const end = a.str("end") ?? (/* @__PURE__ */ new Date()).toISOString();
7832
+ const start2 = a.str("start") ?? new Date(new Date(end).getTime() - DEFAULT_WINDOW_MS).toISOString();
7833
+ out(
7834
+ await summary2(ctx, {
7835
+ startTime: start2,
7836
+ endTime: end,
7837
+ groupBy: a.str("by")
7838
+ })
7839
+ );
7840
+ }
7841
+ var usageHandlers = {
7842
+ "usage summary": summary3
7843
+ };
7844
+ var usageHelp = `remy-admin usage \u2014 What the app costs to run.
7845
+
7846
+ Subcommands:
7847
+ summary The app's runtime spend over a window, broken down one way
7848
+
7849
+ Usage:
7850
+ remy-admin usage summary [--start <iso>] [--end <iso>] [--by method|model|step]
7851
+
7852
+ Notes:
7853
+ Costs are in dollars. Builds (your own work on the app) aren't counted.
7854
+ --by method (the default) is the spend each method drove, model the models'
7855
+ share, step the whole spend by action, models and everything else. The window
7856
+ defaults to the 30 days before --end, and --end to now. An app's own method
7857
+ can read this with the 'usage.view' admin permission.
7858
+
7859
+ Examples:
7860
+ remy-admin usage summary
7861
+ remy-admin usage summary --by model --start 2026-10-01T00:00:00Z`;
7862
+
7808
7863
  // src/ops/events.ts
7809
7864
  function channelsList(ctx, params = {}) {
7810
7865
  return call(
@@ -9455,7 +9510,7 @@ var infraSpecs = {
9455
9510
  }
9456
9511
  }
9457
9512
  };
9458
- async function waitAndReport2(ctx, a, id, phases, summary2, until) {
9513
+ async function waitAndReport2(ctx, a, id, phases, summary4, until) {
9459
9514
  const timeoutSec = a.str("timeout");
9460
9515
  const result = await waitForPhase(ctx, {
9461
9516
  id,
@@ -9464,7 +9519,7 @@ async function waitAndReport2(ctx, a, id, phases, summary2, until) {
9464
9519
  ...timeoutSec ? { timeoutMs: Number(timeoutSec) * 1e3 } : {},
9465
9520
  onProgress: progress
9466
9521
  });
9467
- out({ ...summary2, ...result });
9522
+ out({ ...summary4, ...result });
9468
9523
  if (result.status === "failed") {
9469
9524
  throw new CliError(result.error, EXIT.buildFailed);
9470
9525
  }
@@ -9978,6 +10033,7 @@ var SPECS = {
9978
10033
  ...voiceSpecs,
9979
10034
  ...agentSpecs,
9980
10035
  ...tasksSpecs,
10036
+ ...usageSpecs,
9981
10037
  ...eventsSpecs,
9982
10038
  ...jewelsSpecs,
9983
10039
  ...settingsSpecs,
@@ -10014,6 +10070,7 @@ var HANDLERS = {
10014
10070
  ...voiceHandlers,
10015
10071
  ...agentHandlers,
10016
10072
  ...tasksHandlers,
10073
+ ...usageHandlers,
10017
10074
  ...eventsHandlers,
10018
10075
  ...jewelsHandlers,
10019
10076
  ...settingsHandlers,
@@ -10044,6 +10101,7 @@ var GROUP_HELP = {
10044
10101
  voice: voiceHelp,
10045
10102
  agent: agentHelp,
10046
10103
  tasks: tasksHelp,
10104
+ usage: usageHelp,
10047
10105
  events: eventsHelp,
10048
10106
  jewels: jewelsHelp,
10049
10107
  settings: settingsHelp,
@@ -10131,6 +10189,7 @@ Commands:
10131
10189
  voice Phone numbers, voice call log + transcripts, voice policy settings
10132
10190
  agent Agent (chat) conversation log + transcripts
10133
10191
  tasks Task agent (runTask) log + transcripts
10192
+ usage What the app costs to run, by method, model or step
10134
10193
  events Realtime events \u2014 live tail, test publish, channel activity
10135
10194
  jewels Monitor jewel shadowing; review + approve the proposal queue
10136
10195
  settings App settings \u2014 signup allowlist, test accounts, embed origins, toggles
@@ -10147,7 +10206,18 @@ with a dash, use --name=value; to pass a positional beginning with a dash, put
10147
10206
  -- before it.
10148
10207
 
10149
10208
  All output is JSON. Configuration is read from environment variables
10150
- (MINDSTUDIO_API_KEY, MINDSTUDIO_BASE_URL) and mindstudio.json (appId).`;
10209
+ (MINDSTUDIO_API_KEY, MINDSTUDIO_BASE_URL) and mindstudio.json (appId).
10210
+
10211
+ From an app's own method, the same operations run through the import layer
10212
+ with no key: createAdminClient() in the method acts on its own app, as the
10213
+ method's run, for what the method's "adminPermissions" in mindstudio.json
10214
+ allow. analytics.view, usage.view, requests.view (requests, crashes),
10215
+ agent.view, tasks.view, voice.view|manage, users.view|manage (live runs only),
10216
+ settings.manage, email.view|manage, domains.manage (custom domains, the
10217
+ subdomain), issues.view|manage, datasources.manage, cron.view|manage,
10218
+ releases.view. A .manage includes its .view. A call the method doesn't hold is
10219
+ admin_permission_required:<name>; another app is app_credential_wrong_app and
10220
+ needs a key. The full list and rules are createAdminClient's docs.`;
10151
10221
  var GROUPS = [
10152
10222
  "requests",
10153
10223
  "crashes",
@@ -10169,6 +10239,7 @@ var GROUPS = [
10169
10239
  "voice",
10170
10240
  "agent",
10171
10241
  "tasks",
10242
+ "usage",
10172
10243
  "events",
10173
10244
  "jewels",
10174
10245
  "settings",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madewithremy/admin",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "description": "Admin SDK + CLI for managing production Remy apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -53,6 +53,14 @@
53
53
  "dependencies": {
54
54
  "json5": "^2.2.3"
55
55
  },
56
+ "peerDependencies": {
57
+ "@mindstudio-ai/agent": ">=0.1.46"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "@mindstudio-ai/agent": {
61
+ "optional": true
62
+ }
63
+ },
56
64
  "devDependencies": {
57
65
  "@types/node": "^26.6.5",
58
66
  "@typescript/native": "npm:typescript@^7.0.2",