@madewithremy/admin 0.1.57 → 0.1.59

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client.d.ts +199 -0
  4. package/dist/config.d.ts +8 -0
  5. package/dist/ctx.d.ts +36 -0
  6. package/dist/errors.d.ts +68 -0
  7. package/dist/http.d.ts +68 -0
  8. package/dist/index.d.ts +7 -9442
  9. package/dist/index.js +6 -14
  10. package/dist/index.js.map +7 -1
  11. package/dist/ops/agent.d.ts +44 -0
  12. package/dist/ops/analytics.d.ts +285 -0
  13. package/dist/ops/apps.d.ts +33 -0
  14. package/dist/ops/crashes.d.ts +86 -0
  15. package/dist/ops/cron.d.ts +40 -0
  16. package/dist/ops/data.d.ts +68 -0
  17. package/dist/ops/dataSourceConnectors.d.ts +80 -0
  18. package/dist/ops/dataSourceEvals.d.ts +208 -0
  19. package/dist/ops/dataSourceJobs.d.ts +141 -0
  20. package/dist/ops/dataSourceMappers.d.ts +125 -0
  21. package/dist/ops/dataSources.d.ts +654 -0
  22. package/dist/ops/db.d.ts +81 -0
  23. package/dist/ops/diagnostics.d.ts +42 -0
  24. package/dist/ops/domains.d.ts +250 -0
  25. package/dist/ops/email.d.ts +305 -0
  26. package/dist/ops/events.d.ts +56 -0
  27. package/dist/ops/feedback.d.ts +24 -0
  28. package/dist/ops/files.d.ts +166 -0
  29. package/dist/ops/infra.d.ts +163 -0
  30. package/dist/ops/issues.d.ts +160 -0
  31. package/dist/ops/jewels.d.ts +249 -0
  32. package/dist/ops/methods.d.ts +60 -0
  33. package/dist/ops/prerender.d.ts +74 -0
  34. package/dist/ops/previews.d.ts +52 -0
  35. package/dist/ops/qaRecordings.d.ts +68 -0
  36. package/dist/ops/releases.d.ts +193 -0
  37. package/dist/ops/requests.d.ts +73 -0
  38. package/dist/ops/secrets.d.ts +61 -0
  39. package/dist/ops/settings.d.ts +45 -0
  40. package/dist/ops/tasks.d.ts +47 -0
  41. package/dist/ops/usage.d.ts +40 -0
  42. package/dist/ops/users.d.ts +59 -0
  43. package/dist/ops/voice.d.ts +178 -0
  44. package/dist/output.d.ts +19 -0
  45. package/dist/parseJsonConfig.d.ts +41 -0
  46. package/dist/poll.d.ts +38 -0
  47. package/dist/prod.js +39 -55
  48. package/dist/runningMethod.d.ts +25 -0
  49. package/dist/sleep.d.ts +12 -0
  50. package/dist/types/agent.d.ts +95 -0
  51. package/dist/types/analytics.d.ts +225 -0
  52. package/dist/types/apps.d.ts +39 -0
  53. package/dist/types/crashes.d.ts +81 -0
  54. package/dist/types/cron.d.ts +68 -0
  55. package/dist/types/data.d.ts +38 -0
  56. package/dist/types/dataSourceConnectors.d.ts +59 -0
  57. package/dist/types/dataSourceEvals.d.ts +225 -0
  58. package/dist/types/dataSourceJobs.d.ts +283 -0
  59. package/dist/types/dataSourceMappers.d.ts +204 -0
  60. package/dist/types/dataSourceReaders.d.ts +102 -0
  61. package/dist/types/dataSources.d.ts +627 -0
  62. package/dist/types/db.d.ts +63 -0
  63. package/dist/types/diagnostics.d.ts +96 -0
  64. package/dist/types/domains.d.ts +277 -0
  65. package/dist/types/email.d.ts +400 -0
  66. package/dist/types/events.d.ts +54 -0
  67. package/dist/types/feedback.d.ts +11 -0
  68. package/dist/types/files.d.ts +150 -0
  69. package/dist/types/index.d.ts +37 -0
  70. package/dist/types/infra.d.ts +188 -0
  71. package/dist/types/issues.d.ts +106 -0
  72. package/dist/types/jewels.d.ts +336 -0
  73. package/dist/types/methods.d.ts +34 -0
  74. package/dist/types/prerender.d.ts +59 -0
  75. package/dist/types/previews.d.ts +39 -0
  76. package/dist/types/progress.d.ts +31 -0
  77. package/dist/types/qaRecordings.d.ts +51 -0
  78. package/dist/types/releases.d.ts +233 -0
  79. package/dist/types/requests.d.ts +114 -0
  80. package/dist/types/secrets.d.ts +42 -0
  81. package/dist/types/settings.d.ts +79 -0
  82. package/dist/types/tasks.d.ts +99 -0
  83. package/dist/types/usage.d.ts +29 -0
  84. package/dist/types/users.d.ts +61 -0
  85. package/dist/types/voice.d.ts +197 -0
  86. package/dist/upload.d.ts +11 -0
  87. package/package.json +7 -10
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Voice operations: phone numbers, sessions, and policy settings.
3
+ *
4
+ * `findNumberId` resolves a user-supplied E.164 string to a row id (list →
5
+ * normalize → match). It throws a plain Error with the exact historical
6
+ * message if not found — entry-point catch prints it identically to `fatal()`.
7
+ *
8
+ * Ops are pure: (ctx, params) → typed result, throwing AdminApiError /
9
+ * AdminTimeoutError. No printing, no process coupling.
10
+ */
11
+ import type { AdminContext } from '../ctx.js';
12
+ import type { VoiceNumbersListResult, VoiceNumbersSearchResult, VoiceNumbersBuyResult, VoiceNumbersReleaseResult, VoiceNumbersSetNameResult, VoiceSessionsListResult, VoiceSettingsGetResult, VoiceSettingsSetResult } from '../types/voice.js';
13
+ /**
14
+ * All dedicated phone numbers attached to the app.
15
+ *
16
+ * Lazily reconciles any pending orders so callers can poll this until a
17
+ * `pending` number converges to `active` or `failed`.
18
+ *
19
+ * @example
20
+ * const { numbers } = await admin.voice.numbersList();
21
+ * const active = numbers.filter((n) => n.status === 'active');
22
+ */
23
+ export declare function numbersList(ctx: AdminContext): Promise<VoiceNumbersListResult>;
24
+ export interface NumbersSearchParams {
25
+ /** US 3-digit area code to filter by. */
26
+ areaCode?: string;
27
+ /** City name to filter by. */
28
+ locality?: string;
29
+ /** State or region code (e.g. `CA`). */
30
+ administrativeArea?: string;
31
+ /** Max results to return (server clamps to 50). */
32
+ limit?: number;
33
+ }
34
+ /**
35
+ * Search available US numbers by area code or locality.
36
+ *
37
+ * Results are Telnyx availability snapshots — they are not reservations and
38
+ * may be gone by the time `numbersBuy` is called.
39
+ *
40
+ * @throws AdminApiError `missing_search_filter` (400) — neither areaCode nor
41
+ * locality provided; `invalid_area_code` (400) — area code is not 3 digits;
42
+ * `telnyx_not_configured` (412) — phone numbers are not available on this
43
+ * platform host.
44
+ * @example
45
+ * const { results } = await admin.voice.numbersSearch({ areaCode: '310', limit: 5 });
46
+ */
47
+ export declare function numbersSearch(ctx: AdminContext, params: NumbersSearchParams): Promise<VoiceNumbersSearchResult>;
48
+ export interface NumbersBuyParams {
49
+ /** E.164 US number to purchase, from a prior `numbersSearch` result. */
50
+ phoneNumber: string;
51
+ /** City name label — display metadata only, echoed from the search result. */
52
+ locality?: string;
53
+ /** State/region label — display metadata only, echoed from the search result. */
54
+ administrativeArea?: string;
55
+ /** Carrier monthly cost string (e.g. `"1.00000"`) — display metadata only. */
56
+ monthlyCost?: string;
57
+ }
58
+ /**
59
+ * Buy and attach a dedicated phone number to the app ($1/month billed to the
60
+ * workspace starting immediately — an agent acting for the user always
61
+ * confirms with them first).
62
+ *
63
+ * The number is an inbound line to the app's voice agent and a caller ID for
64
+ * `voice.call()`. An app can hold several, one per tenant say, up to its
65
+ * workspace's limit (10 unless support raised it), and the app's own methods
66
+ * can buy and release them with this client by declaring the `voice.manage`
67
+ * admin permission. A
68
+ * `pending` status usually activates within seconds; poll `numbersList` to
69
+ * confirm.
70
+ *
71
+ * @throws AdminApiError `invalid_phone_number` (400) — not a valid +1 E.164
72
+ * US number; `phone_number_limit_reached` (422) — the workspace holds as
73
+ * many numbers as it may; `number_unavailable` (412) — the number is no
74
+ * longer available; `insufficient_credits/*` (402) — the workspace can't
75
+ * cover it; `telnyx_not_configured` (412) — phone numbers unavailable on
76
+ * this host.
77
+ * @example
78
+ * const { number } = await admin.voice.numbersBuy({
79
+ * phoneNumber: '+13105551234',
80
+ * locality: 'Los Angeles',
81
+ * administrativeArea: 'CA',
82
+ * monthlyCost: '1.00000',
83
+ * });
84
+ */
85
+ export declare function numbersBuy(ctx: AdminContext, params: NumbersBuyParams): Promise<VoiceNumbersBuyResult>;
86
+ /**
87
+ * Release a dedicated phone number from the app (permanent).
88
+ *
89
+ * The monthly rental stops immediately (no refund for the current month),
90
+ * the carrier quarantines the number for ~15 days, and the number stops
91
+ * ringing the app and can't be a `voice.call()` caller ID. The app's other
92
+ * numbers are unaffected.
93
+ *
94
+ * @param e164 The phone number in E.164 or bare 10-digit US format.
95
+ * @throws Error `No phone number "${e164}" on this app` when not found;
96
+ * AdminApiError `number_not_found` (404) if the resolved id has gone stale;
97
+ * `order_in_progress` (412) — the purchase is still settling, try again in
98
+ * a minute.
99
+ * @example
100
+ * await admin.voice.numbersRelease('+13105551234');
101
+ */
102
+ export declare function numbersRelease(ctx: AdminContext, e164: string): Promise<VoiceNumbersReleaseResult>;
103
+ /**
104
+ * Set or clear the outbound caller-ID display name (CNAM) for a phone number.
105
+ *
106
+ * CNAM must be 1–15 letters, numbers, or spaces; carrier propagation takes
107
+ * 12–72 hours and display is ultimately the receiving carrier's call. Pass an
108
+ * empty string to remove the listing.
109
+ *
110
+ * @param e164 The phone number in E.164 or bare 10-digit US format.
111
+ * @param displayName 1–15 character CNAM string, or `""` to remove the listing.
112
+ * @throws Error `No phone number "${e164}" on this app` when not found;
113
+ * AdminApiError `number_not_found` (404) if the resolved id has gone stale;
114
+ * `number_not_active` (412) — the number must be active before setting a
115
+ * display name; `invalid_display_name` (400) — value is not 1–15 letters,
116
+ * numbers, or spaces.
117
+ * @example
118
+ * await admin.voice.numbersSetName('+13105551234', 'Acme Corp');
119
+ * // Clear the listing:
120
+ * await admin.voice.numbersSetName('+13105551234', '');
121
+ */
122
+ export declare function numbersSetName(ctx: AdminContext, e164: string, displayName: string): Promise<VoiceNumbersSetNameResult>;
123
+ export interface SessionsListParams {
124
+ /** Max sessions per page (default 20, server clamps to 100). */
125
+ limit?: number;
126
+ /** Pagination cursor from a prior page's `nextCursor`. */
127
+ cursor?: string;
128
+ }
129
+ /**
130
+ * Call log for the app (web, phone-out, phone-in sessions), newest first.
131
+ *
132
+ * Returns cursored pages; pass `nextCursor` from one page as `cursor` for the
133
+ * next. Transcripts are not included — fetch a session with `sessionsGet` for
134
+ * the full transcript.
135
+ *
136
+ * @example
137
+ * const { sessions, nextCursor } = await admin.voice.sessionsList({ limit: 20 });
138
+ */
139
+ export declare function sessionsList(ctx: AdminContext, params?: SessionsListParams): Promise<VoiceSessionsListResult>;
140
+ /**
141
+ * One voice session with full transcript and cost breakdown.
142
+ *
143
+ * `transcript` is the primary tool for debugging and iterating on a voice
144
+ * persona. `cost` is `null` while the session is still active.
145
+ *
146
+ * @throws AdminApiError `session_not_found` (404).
147
+ * @example
148
+ * const session = await admin.voice.sessionsGet('4f6c…');
149
+ * console.log(session.transcript);
150
+ */
151
+ export declare function sessionsGet(ctx: AdminContext, sessionId: string): Promise<import("../index.js").VoiceSessionDetail>;
152
+ /**
153
+ * Voice policy for the app: owner-set overrides, the effective (default-filled
154
+ * and ceiling-clamped) values that apply at session mint, and the platform
155
+ * ceilings.
156
+ *
157
+ * @example
158
+ * const { settings, effective, ceilings } = await admin.voice.settingsGet();
159
+ */
160
+ export declare function settingsGet(ctx: AdminContext): Promise<VoiceSettingsGetResult>;
161
+ export interface VoiceSettingsSetParams {
162
+ /** Cap on simultaneous sessions across all visitors (platform ceiling applies). */
163
+ maxConcurrentSessions?: number;
164
+ /** Cap on simultaneous sessions per visitor. */
165
+ maxConcurrentSessionsPerVisitor?: number;
166
+ /** Max session duration in seconds before the session is terminated. */
167
+ maxSessionDurationSecs?: number;
168
+ }
169
+ /**
170
+ * Override one or more voice-policy settings for the app (merge semantics —
171
+ * fields you omit keep their current values).
172
+ *
173
+ * @throws AdminApiError `invalid_voice_settings` (400) — a field value is not
174
+ * a positive number.
175
+ * @example
176
+ * await admin.voice.settingsSet({ maxConcurrentSessions: 5, maxSessionDurationSecs: 600 });
177
+ */
178
+ export declare function settingsSet(ctx: AdminContext, params: VoiceSettingsSetParams): Promise<VoiceSettingsSetResult>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The CLI's output contract, both halves in one place:
3
+ * results and errors go to stdout as JSON, human progress goes to stderr.
4
+ *
5
+ * That split is what lets a caller pipe stdout straight into a JSON parser
6
+ * while a person watching a long poll still sees something happen.
7
+ */
8
+ import type { OperationProgress } from './types/progress.js';
9
+ export declare function out(data: unknown): void;
10
+ /** Progress to stderr so stdout stays a clean stream of JSON values. */
11
+ export declare function progress(message: string): void;
12
+ /** "about 12 min left" or "about 2.5 h left"; null without an ETA. */
13
+ export declare function describeEta(eta: string | null, now?: number): string | null;
14
+ /**
15
+ * The one progress line every `--wait` prints: the operation's phase, its
16
+ * count, the platform's measured rate and ETA, and how long this wait has run.
17
+ * `extra` is the operation's own addendum (a job's spend, say).
18
+ */
19
+ export declare function renderProgress(p: OperationProgress, start?: number, extra?: string | null): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Pure parser for MindStudio-owned JSON config files. No I/O, no repair.
3
+ *
4
+ * App configs (`mindstudio.json`, interface configs like `web.json`) are
5
+ * authored by remy, so they pick up the usual LLM-JSON slop — most often a
6
+ * trailing comma left behind when an array entry is deleted.
7
+ *
8
+ * Strategy: strict JSON.parse first, JSON5 as a rescue. Strict-first means the
9
+ * steady state is unaffected; the JSON5 path only engages for a file that would
10
+ * otherwise have failed outright.
11
+ *
12
+ * Deliberately pure and read-only: this short-lived CLI must not mutate the
13
+ * workspace out from under the running sandbox, whose own read path
14
+ * (`apps/agent/sandbox/src/utils/jsonConfig.ts`, where this module originated)
15
+ * repairs the file on disk for the callers that DO write.
16
+ */
17
+ export type ParseResult<T> = {
18
+ ok: true;
19
+ value: T;
20
+ repaired: false;
21
+ }
22
+ /** Strict parse failed; JSON5 rescued it. `error` is the strict failure. */
23
+ | {
24
+ ok: true;
25
+ value: T;
26
+ repaired: true;
27
+ error: string;
28
+ }
29
+ /** `notFound` separates "no such file" from "file exists but is broken" —
30
+ * callers log those very differently. */
31
+ | {
32
+ ok: false;
33
+ error: string;
34
+ notFound: boolean;
35
+ };
36
+ export declare function msg(err: unknown): string;
37
+ /**
38
+ * Parse a config string. Pure — no I/O, no repair. Use this when the caller
39
+ * already holds the file contents, or must not write (e.g. the CLI).
40
+ */
41
+ export declare function parseJsonConfig<T>(raw: string): ParseResult<T>;
package/dist/poll.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The one polling loop under every `--wait`: read the thing, ask whether it
3
+ * has settled, sleep, repeat, with a bounded grace for gateway errors and a
4
+ * timeout. The waits differ only in what they read, what "settled" means and
5
+ * how they describe progress; none of them owns a loop.
6
+ */
7
+ export interface PollOptions<T> {
8
+ /**
9
+ * How long the thing may go WITHOUT MOVING before the wait gives up. With
10
+ * `progressKey`, every change of the key restarts this clock, so an
11
+ * operation of any length is waited out as long as it keeps moving and the
12
+ * timeout bounds silence, not duration. Without it, the whole wait.
13
+ */
14
+ timeoutMs: number;
15
+ pollMs: number;
16
+ /** One line of progress for a value that has not settled; `start` is when the wait began. */
17
+ describe?: (value: T, start: number) => string;
18
+ /** Something that changes when the operation moves: a count, a phase, a timestamp. */
19
+ progressKey?: (value: T) => string | number | null | undefined;
20
+ onProgress?: (message: string) => void;
21
+ }
22
+ export type PollOutcome<T> = {
23
+ settled: true;
24
+ value: T;
25
+ } | {
26
+ settled: false;
27
+ value: T;
28
+ };
29
+ /**
30
+ * Poll `read` until `isSettled` says so or the timeout elapses. A wait can run
31
+ * for minutes through a tunnel; one gateway error is not an answer about the
32
+ * thing being waited on, so it is retried for `TRANSIENT_GRACE_MS` before it
33
+ * counts. Any other error propagates.
34
+ */
35
+ export declare function pollUntil<T>(read: () => Promise<T>, isSettled: (value: T) => boolean, options: PollOptions<T>): Promise<PollOutcome<T>>;
36
+ export declare function elapsedSeconds(start: number): number;
37
+ /** The standard timeout line: how long, and where the thing still is. */
38
+ export declare function timedOut(timeoutMs: number, still: string): string;
package/dist/prod.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/args.ts
4
- import { parseArgs } from "util";
4
+ import { parseArgs } from "node:util";
5
5
 
6
6
  // src/errors.ts
7
7
  var EXIT = {
@@ -1095,7 +1095,7 @@ Examples:
1095
1095
  remy-admin analytics crawlers recent`;
1096
1096
 
1097
1097
  // src/commands/releases.ts
1098
- import { execFileSync } from "child_process";
1098
+ import { execFileSync } from "node:child_process";
1099
1099
 
1100
1100
  // src/config.ts
1101
1101
  var WORKSPACE_DIR = process.env["WORKSPACE_DIR"] || "/home/remy/workspace";
@@ -2439,13 +2439,6 @@ function list6(ctx) {
2439
2439
  `/_internal/v2/apps/${ctx.appId}/secrets`
2440
2440
  );
2441
2441
  }
2442
- function get5(ctx, key) {
2443
- return call(
2444
- ctx,
2445
- "GET",
2446
- `/_internal/v2/apps/${ctx.appId}/secrets/${seg(key)}`
2447
- );
2448
- }
2449
2442
  function set2(ctx, key, params) {
2450
2443
  const body = {};
2451
2444
  if ("devValue" in params) {
@@ -2474,10 +2467,6 @@ var secretsSpecs = {
2474
2467
  "secrets list": {
2475
2468
  usage: "Usage: remy-admin secrets list"
2476
2469
  },
2477
- "secrets get": {
2478
- usage: "Usage: remy-admin secrets get <KEY>",
2479
- positionals: [{ name: "key", required: true }]
2480
- },
2481
2470
  "secrets set": {
2482
2471
  usage: "Usage: remy-admin secrets set <KEY> [--dev <value>] [--prod <value>] [--dev-clear] [--prod-clear]",
2483
2472
  positionals: [{ name: "key", required: true }],
@@ -2500,9 +2489,6 @@ var secretsSpecs = {
2500
2489
  async function secretsList(ctx) {
2501
2490
  out(await list6(ctx));
2502
2491
  }
2503
- async function secretsGet(ctx, a) {
2504
- out(await get5(ctx, a.req("key")));
2505
- }
2506
2492
  async function secretsSet(ctx, a) {
2507
2493
  const key = a.req("key");
2508
2494
  const dev = a.str("dev");
@@ -2532,7 +2518,6 @@ async function secretsDelete(ctx, a) {
2532
2518
  }
2533
2519
  var secretsHandlers = {
2534
2520
  "secrets list": secretsList,
2535
- "secrets get": secretsGet,
2536
2521
  "secrets set": secretsSet,
2537
2522
  "secrets delete": secretsDelete
2538
2523
  };
@@ -2540,13 +2525,11 @@ var secretsHelp = `remy-admin secrets \u2014 Manage app secrets (environment var
2540
2525
 
2541
2526
  Subcommands:
2542
2527
  list List all secret keys (values are not shown, only which environments have values)
2543
- get Get decrypted values for a secret
2544
2528
  set Create or update a secret's value for dev and/or prod
2545
2529
  delete Delete a secret entirely (both dev and prod values)
2546
2530
 
2547
2531
  Usage:
2548
2532
  remy-admin secrets list
2549
- remy-admin secrets get <KEY>
2550
2533
  remy-admin secrets set <KEY> [--dev <value>] [--prod <value>] [--dev-clear] [--prod-clear]
2551
2534
  remy-admin secrets delete <KEY>
2552
2535
 
@@ -2559,13 +2542,14 @@ The set command updates only the environments you specify:
2559
2542
 
2560
2543
  Examples:
2561
2544
  remy-admin secrets list
2562
- remy-admin secrets get STRIPE_SECRET_KEY
2563
2545
  remy-admin secrets set STRIPE_SECRET_KEY --dev sk_test_abc --prod sk_live_xyz
2564
2546
  remy-admin secrets set OPENAI_API_KEY --prod sk-abc123
2565
2547
  remy-admin secrets set OLD_KEY --prod-clear
2566
2548
  remy-admin secrets delete OLD_KEY
2567
2549
 
2568
2550
  Notes:
2551
+ - Values are write-only: nothing reads one back once it's saved. The app's
2552
+ code gets them as environment variables; to change one, set it again.
2569
2553
  - If a value starts with a dash, use the '=' form so it isn't read as a flag:
2570
2554
  remy-admin secrets set KEY --prod=-abc123`;
2571
2555
 
@@ -2978,7 +2962,7 @@ Examples:
2978
2962
  remy-admin data lift-from-live --truncate --confirm`;
2979
2963
 
2980
2964
  // src/commands/issues.ts
2981
- import fs from "fs";
2965
+ import fs from "node:fs";
2982
2966
 
2983
2967
  // src/ops/issues.ts
2984
2968
  function authorship(ctx) {
@@ -3007,7 +2991,7 @@ function filed(ctx, params = {}) {
3007
2991
  `/_internal/v2/apps/${ctx.appId}/issues/filed${listQuery(params)}`
3008
2992
  );
3009
2993
  }
3010
- function get6(ctx, number) {
2994
+ function get5(ctx, number) {
3011
2995
  return call(
3012
2996
  ctx,
3013
2997
  "GET",
@@ -3219,7 +3203,7 @@ async function issuesFiled(ctx, a) {
3219
3203
  );
3220
3204
  }
3221
3205
  async function issuesGet(ctx, a) {
3222
- out(await get6(ctx, a.req("number")));
3206
+ out(await get5(ctx, a.req("number")));
3223
3207
  }
3224
3208
  async function issuesCreate(ctx, a) {
3225
3209
  const issueBody = readBodyFlag(a);
@@ -3531,14 +3515,14 @@ Examples:
3531
3515
  remy-admin prerender get /demos/vector-search/blog/x --host example.com`;
3532
3516
 
3533
3517
  // src/commands/files.ts
3534
- import fs2 from "fs";
3535
- import path2 from "path";
3536
- import { Readable } from "stream";
3537
- import { pipeline } from "stream/promises";
3518
+ import fs2 from "node:fs";
3519
+ import path2 from "node:path";
3520
+ import { Readable } from "node:stream";
3521
+ import { pipeline } from "node:stream/promises";
3538
3522
 
3539
3523
  // src/ops/files.ts
3540
- import path from "path";
3541
- import { createHash } from "crypto";
3524
+ import path from "node:path";
3525
+ import { createHash } from "node:crypto";
3542
3526
 
3543
3527
  // src/upload.ts
3544
3528
  async function uploadDirect(upload, bytes, filename) {
@@ -3891,11 +3875,11 @@ Notes:
3891
3875
  - Public image URLs accept transform params, e.g. ?w=400&fit=cover.`;
3892
3876
 
3893
3877
  // src/commands/dataSources.ts
3894
- import fs6 from "fs";
3895
- import path6 from "path";
3878
+ import fs6 from "node:fs";
3879
+ import path6 from "node:path";
3896
3880
 
3897
3881
  // src/ops/dataSources.ts
3898
- import { createHash as createHash2 } from "crypto";
3882
+ import { createHash as createHash2 } from "node:crypto";
3899
3883
  var DEFAULT_WAIT_TIMEOUT_MS = 15 * 60 * 1e3;
3900
3884
  var POLL_MS2 = 3e3;
3901
3885
  function base(appId) {
@@ -4420,7 +4404,7 @@ function list11(ctx, params) {
4420
4404
  `${base2(ctx.appId)}${qs({ slug: params?.slug })}`
4421
4405
  );
4422
4406
  }
4423
- function get7(ctx, params) {
4407
+ function get6(ctx, params) {
4424
4408
  return call(
4425
4409
  ctx,
4426
4410
  "GET",
@@ -4484,7 +4468,7 @@ function waitForJob(ctx, params) {
4484
4468
  async function settle(ctx, params, isSettled) {
4485
4469
  const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS2;
4486
4470
  const outcome = await pollUntil(
4487
- async () => (await get7(ctx, { id: params.id })).job,
4471
+ async () => (await get6(ctx, { id: params.id })).job,
4488
4472
  isSettled,
4489
4473
  {
4490
4474
  timeoutMs,
@@ -4633,7 +4617,7 @@ function connect(ctx, params) {
4633
4617
  }
4634
4618
  );
4635
4619
  }
4636
- function get8(ctx, params) {
4620
+ function get7(ctx, params) {
4637
4621
  return call(
4638
4622
  ctx,
4639
4623
  "GET",
@@ -4740,7 +4724,7 @@ async function connect2(ctx, a) {
4740
4724
  }
4741
4725
  async function show(ctx, a) {
4742
4726
  const slug = sourceOf(a);
4743
- out({ dataSource: slug, ...await get8(ctx, { slug }) });
4727
+ out({ dataSource: slug, ...await get7(ctx, { slug }) });
4744
4728
  }
4745
4729
  async function disconnect2(ctx, a) {
4746
4730
  const slug = a.str("source");
@@ -4823,8 +4807,8 @@ Following an S3 bucket (connectors):
4823
4807
  `;
4824
4808
 
4825
4809
  // src/commands/dataSourceEvals.ts
4826
- import fs3 from "fs";
4827
- import path3 from "path";
4810
+ import fs3 from "node:fs";
4811
+ import path3 from "node:path";
4828
4812
 
4829
4813
  // src/ops/dataSourceEvals.ts
4830
4814
  var DEFAULT_WAIT_TIMEOUT_MS3 = 30 * 60 * 1e3;
@@ -5591,8 +5575,8 @@ Retrieval evals:
5591
5575
  `;
5592
5576
 
5593
5577
  // src/commands/dataSourceDictionary.ts
5594
- import fs4 from "fs";
5595
- import path4 from "path";
5578
+ import fs4 from "node:fs";
5579
+ import path4 from "node:path";
5596
5580
  var dataSourceDictionarySpecs = {
5597
5581
  "datasources dictionary push": {
5598
5582
  usage: "Usage: remy-admin datasources dictionary push [--source <slug>] [--linker-version <n>] <file.jsonl>",
@@ -5700,8 +5684,8 @@ Dictionary:
5700
5684
  `;
5701
5685
 
5702
5686
  // src/commands/dataSourceJobs.ts
5703
- import fs5 from "fs";
5704
- import path5 from "path";
5687
+ import fs5 from "node:fs";
5688
+ import path5 from "node:path";
5705
5689
  var dataSourceJobsSpecs = {
5706
5690
  "datasources jobs start": {
5707
5691
  usage: "Usage: remy-admin datasources jobs start [--source <slug>] (--store <name> [--access <private|public>] [--prefix <p>] | --manifest <file.jsonl>) [--limit <n>] [--budget <dollars>] [--concurrency <n>] [--priority] [--approve] [--wait] [--timeout <sec>]",
@@ -5834,7 +5818,7 @@ async function jobsList(ctx, a) {
5834
5818
  async function jobsStatus(ctx, a) {
5835
5819
  const id = a.req("id");
5836
5820
  if (!a.bool("wait")) {
5837
- out(await get7(ctx, { id }));
5821
+ out(await get6(ctx, { id }));
5838
5822
  return;
5839
5823
  }
5840
5824
  await waitAndReport(ctx, a, id, "job", { action: "status" });
@@ -7851,7 +7835,7 @@ function list12(ctx, params = {}) {
7851
7835
  `/_internal/v2/apps/${ctx.appId}/task-traces${qs(params)}`
7852
7836
  );
7853
7837
  }
7854
- function get9(ctx, traceId) {
7838
+ function get8(ctx, traceId) {
7855
7839
  return call(
7856
7840
  ctx,
7857
7841
  "GET",
@@ -7881,12 +7865,12 @@ async function list13(ctx, a) {
7881
7865
  })
7882
7866
  );
7883
7867
  }
7884
- async function get10(ctx, a) {
7885
- out(await get9(ctx, a.req("traceId")));
7868
+ async function get9(ctx, a) {
7869
+ out(await get8(ctx, a.req("traceId")));
7886
7870
  }
7887
7871
  var tasksHandlers = {
7888
7872
  "tasks list": list13,
7889
- "tasks get": get10
7873
+ "tasks get": get9
7890
7874
  };
7891
7875
  var tasksHelp = `remy-admin tasks \u2014 Log of the app's task agents (runTask), kept 90 days.
7892
7876
 
@@ -8932,7 +8916,7 @@ function list14(ctx, params = {}) {
8932
8916
  `/_internal/v2/apps/${ctx.appId}/outbound-email/messages${qs(params)}`
8933
8917
  );
8934
8918
  }
8935
- function get11(ctx, messageId) {
8919
+ function get10(ctx, messageId) {
8936
8920
  return call(
8937
8921
  ctx,
8938
8922
  "GET",
@@ -9138,7 +9122,7 @@ async function emailList(ctx, a) {
9138
9122
  );
9139
9123
  }
9140
9124
  async function emailGet(ctx, a) {
9141
- out(await get11(ctx, a.req("messageId")));
9125
+ out(await get10(ctx, a.req("messageId")));
9142
9126
  }
9143
9127
  async function emailStats(ctx, a) {
9144
9128
  out(await stats2(ctx, { start: a.str("start"), end: a.str("end") }));
@@ -9390,7 +9374,7 @@ Examples:
9390
9374
  remy-admin cron run dailyDigest`;
9391
9375
 
9392
9376
  // src/commands/feedback.ts
9393
- import fs7 from "fs";
9377
+ import fs7 from "node:fs";
9394
9378
 
9395
9379
  // src/ops/feedback.ts
9396
9380
  function draft(ctx, message) {
@@ -9464,7 +9448,7 @@ function list16(ctx, params) {
9464
9448
  `${base7(ctx.appId)}${params?.includeDestroyed ? "?includeDestroyed=true" : ""}`
9465
9449
  );
9466
9450
  }
9467
- function get12(ctx, params) {
9451
+ function get11(ctx, params) {
9468
9452
  return call(
9469
9453
  ctx,
9470
9454
  "GET",
@@ -9534,7 +9518,7 @@ async function waitForPhase(ctx, params) {
9534
9518
  const wanted = new Set(params.phases);
9535
9519
  const arrived = (resource2) => wanted.has(resource2.phase) && (params.until?.(resource2) ?? true);
9536
9520
  const outcome = await pollUntil(
9537
- async () => (await get12(ctx, { id: params.id })).resource,
9521
+ async () => (await get11(ctx, { id: params.id })).resource,
9538
9522
  (resource2) => arrived(resource2) || resource2.phase === "failed",
9539
9523
  {
9540
9524
  timeoutMs,
@@ -9652,7 +9636,7 @@ async function infraList(ctx, a) {
9652
9636
  out(await list16(ctx, { includeDestroyed: a.bool("include-destroyed") }));
9653
9637
  }
9654
9638
  async function infraGet(ctx, a) {
9655
- out(await get12(ctx, { id: a.req("id") }));
9639
+ out(await get11(ctx, { id: a.req("id") }));
9656
9640
  }
9657
9641
  var FOLLOW_POLL_MS = 4e3;
9658
9642
  async function infraLogs(ctx, a) {
@@ -10234,8 +10218,8 @@ var GROUP_HELP = {
10234
10218
  };
10235
10219
 
10236
10220
  // src/ctx.ts
10237
- import fs8 from "fs";
10238
- import path7 from "path";
10221
+ import fs8 from "node:fs";
10222
+ import path7 from "node:path";
10239
10223
 
10240
10224
  // src/parseJsonConfig.ts
10241
10225
  import JSON5 from "json5";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The context of an app method that is calling right now: its execution's own
3
+ * credential, so a method can manage its own app with no key in its secrets.
4
+ *
5
+ * The platform runs each method inside `@mindstudio-ai/agent`'s
6
+ * `runWithContext`, which carries the run's hook token and the api it calls
7
+ * back on. That token is accepted by the routes that manage the app when the
8
+ * method declares the admin permission the route needs (`adminPermissions` on
9
+ * the method's entry in `mindstudio.json`). The app id comes from the platform,
10
+ * asked once per token.
11
+ *
12
+ * The agent SDK is an optional peer, loaded here only when a client has no key
13
+ * of its own: it has to be the app's own copy, the one the runtime scoped the
14
+ * run with, and the CLI never needs it.
15
+ */
16
+ import { type AdminContext } from './ctx.js';
17
+ /**
18
+ * The context for a call made inside a running method, or null outside one.
19
+ * `appId` and `baseUrl` from the client's options override what the run says;
20
+ * an app id other than the run's own is refused by the platform.
21
+ */
22
+ export declare function runningMethodContext(options: {
23
+ appId?: string;
24
+ baseUrl?: string;
25
+ }): Promise<AdminContext | null>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Do NOT unref() this timer, and do not "dedupe" it against the identically
3
+ * named helper in DraftSnapshotManager, which does.
4
+ *
5
+ * Inside the CLI's polling loops (`releases wait`, `releases status --wait`,
6
+ * `diagnostics get --wait`) this timer is often the only live handle, so an
7
+ * unref'd version lets node exit mid-wait: the poll silently abandons and never
8
+ * reports a result. Verified — the process exits 13 and the code after the
9
+ * sleep never runs. The server can unref safely because its sockets keep the
10
+ * loop alive; a short-lived CLI cannot.
11
+ */
12
+ export declare function sleep(ms: number): Promise<void>;