@madewithremy/admin 0.1.53 → 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/CHANGELOG.md +12 -0
- package/README.md +21 -0
- package/dist/index.d.ts +156 -19
- package/dist/index.js +142 -60
- package/dist/index.js.map +1 -1
- package/dist/prod.js +78 -9
- package/package.json +9 -1
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
|
|
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
|
-
|
|
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
|
|
1055
|
+
return summary4;
|
|
1056
1056
|
}
|
|
1057
1057
|
return {
|
|
1058
|
-
...
|
|
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,
|
|
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({ ...
|
|
4482
|
+
out({ ...summary4, ...result });
|
|
4483
4483
|
failOnWait(result);
|
|
4484
4484
|
}
|
|
4485
4485
|
|
|
@@ -7807,6 +7807,59 @@ Examples:
|
|
|
7807
7807
|
remy-admin tasks list --limit 10
|
|
7808
7808
|
remy-admin tasks get 0b9e\u2026`;
|
|
7809
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
|
+
|
|
7810
7863
|
// src/ops/events.ts
|
|
7811
7864
|
function channelsList(ctx, params = {}) {
|
|
7812
7865
|
return call(
|
|
@@ -9457,7 +9510,7 @@ var infraSpecs = {
|
|
|
9457
9510
|
}
|
|
9458
9511
|
}
|
|
9459
9512
|
};
|
|
9460
|
-
async function waitAndReport2(ctx, a, id, phases,
|
|
9513
|
+
async function waitAndReport2(ctx, a, id, phases, summary4, until) {
|
|
9461
9514
|
const timeoutSec = a.str("timeout");
|
|
9462
9515
|
const result = await waitForPhase(ctx, {
|
|
9463
9516
|
id,
|
|
@@ -9466,7 +9519,7 @@ async function waitAndReport2(ctx, a, id, phases, summary2, until) {
|
|
|
9466
9519
|
...timeoutSec ? { timeoutMs: Number(timeoutSec) * 1e3 } : {},
|
|
9467
9520
|
onProgress: progress
|
|
9468
9521
|
});
|
|
9469
|
-
out({ ...
|
|
9522
|
+
out({ ...summary4, ...result });
|
|
9470
9523
|
if (result.status === "failed") {
|
|
9471
9524
|
throw new CliError(result.error, EXIT.buildFailed);
|
|
9472
9525
|
}
|
|
@@ -9980,6 +10033,7 @@ var SPECS = {
|
|
|
9980
10033
|
...voiceSpecs,
|
|
9981
10034
|
...agentSpecs,
|
|
9982
10035
|
...tasksSpecs,
|
|
10036
|
+
...usageSpecs,
|
|
9983
10037
|
...eventsSpecs,
|
|
9984
10038
|
...jewelsSpecs,
|
|
9985
10039
|
...settingsSpecs,
|
|
@@ -10016,6 +10070,7 @@ var HANDLERS = {
|
|
|
10016
10070
|
...voiceHandlers,
|
|
10017
10071
|
...agentHandlers,
|
|
10018
10072
|
...tasksHandlers,
|
|
10073
|
+
...usageHandlers,
|
|
10019
10074
|
...eventsHandlers,
|
|
10020
10075
|
...jewelsHandlers,
|
|
10021
10076
|
...settingsHandlers,
|
|
@@ -10046,6 +10101,7 @@ var GROUP_HELP = {
|
|
|
10046
10101
|
voice: voiceHelp,
|
|
10047
10102
|
agent: agentHelp,
|
|
10048
10103
|
tasks: tasksHelp,
|
|
10104
|
+
usage: usageHelp,
|
|
10049
10105
|
events: eventsHelp,
|
|
10050
10106
|
jewels: jewelsHelp,
|
|
10051
10107
|
settings: settingsHelp,
|
|
@@ -10133,6 +10189,7 @@ Commands:
|
|
|
10133
10189
|
voice Phone numbers, voice call log + transcripts, voice policy settings
|
|
10134
10190
|
agent Agent (chat) conversation log + transcripts
|
|
10135
10191
|
tasks Task agent (runTask) log + transcripts
|
|
10192
|
+
usage What the app costs to run, by method, model or step
|
|
10136
10193
|
events Realtime events \u2014 live tail, test publish, channel activity
|
|
10137
10194
|
jewels Monitor jewel shadowing; review + approve the proposal queue
|
|
10138
10195
|
settings App settings \u2014 signup allowlist, test accounts, embed origins, toggles
|
|
@@ -10149,7 +10206,18 @@ with a dash, use --name=value; to pass a positional beginning with a dash, put
|
|
|
10149
10206
|
-- before it.
|
|
10150
10207
|
|
|
10151
10208
|
All output is JSON. Configuration is read from environment variables
|
|
10152
|
-
(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.`;
|
|
10153
10221
|
var GROUPS = [
|
|
10154
10222
|
"requests",
|
|
10155
10223
|
"crashes",
|
|
@@ -10171,6 +10239,7 @@ var GROUPS = [
|
|
|
10171
10239
|
"voice",
|
|
10172
10240
|
"agent",
|
|
10173
10241
|
"tasks",
|
|
10242
|
+
"usage",
|
|
10174
10243
|
"events",
|
|
10175
10244
|
"jewels",
|
|
10176
10245
|
"settings",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madewithremy/admin",
|
|
3
|
-
"version": "0.1.
|
|
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",
|