@reminix/cli 1.0.0-rc.6 → 1.0.0-rc.8

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 (3) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/dist/reminix.mjs +1207 -734
  3. package/package.json +4 -4
package/dist/reminix.mjs CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: true });
6
+ };
2
7
 
3
8
  // src/main.ts
4
9
  import { spawn } from "node:child_process";
@@ -16,6 +21,8 @@ var brand_default = {
16
21
  topics: ["scripts", "automation", "ai-agents", "mcp", "api-client", "sdk"]
17
22
  },
18
23
  domain: "reminix.com",
24
+ devDomain: "reminix.dev",
25
+ labs: ["lab"],
19
26
  discordInvite: "https://discord.gg/UU9NbEcNQj",
20
27
  summary: "Reminix lets your whole team, your software and your agents run your team's scripts, and the ones AI writes: one publish gives a form, an API and an agent tool, with keys kept out of the code and every run on record.",
21
28
  expectedAssets: [
@@ -28,25 +35,52 @@ var brand_default = {
28
35
  "apple-touch-icon.png"
29
36
  ],
30
37
  colors: {
31
- brand: "#1F5A45",
32
- brandForeground: "#F2F5F3",
33
- brandDark: "#8DBFA3",
34
- brandDarkForeground: "#1C2421",
35
- bench: "#1F5A45",
36
- moss: "#8DBFA3",
37
- chalk: "#F2F5F3",
38
- graphite: "#1C2421",
39
- tag: "#F0C4D1",
40
- hold: "#D9902F"
38
+ brand: "#151515",
39
+ brandForeground: "#F7F6F2",
40
+ brandDark: "#FFC72C",
41
+ brandDarkForeground: "#151515",
42
+ black: "#151515",
43
+ signal: "#FFC72C",
44
+ paper: "#F7F6F2",
45
+ graphite: "#1A1A19",
46
+ lemon: "#FFF2C2",
47
+ done: "#2F9E44",
48
+ waiting: "#C2410C",
49
+ failed: "#C92A2A",
50
+ night: "#0D0D0D",
51
+ signalDark: "#FFC72C",
52
+ paperDark: "#0D0D0D",
53
+ graphiteDark: "#1F1F1D",
54
+ lemonDark: "#1E1B10",
55
+ doneDark: "#51CF66",
56
+ waitingDark: "#FF8A4C",
57
+ failedDark: "#FF6B6B",
58
+ lemonBorder: "#F0DC8E",
59
+ lemonBorderDark: "#3A3315",
60
+ waitingBackground: "#FFF1E8",
61
+ waitingBackgroundDark: "#2A1A12"
41
62
  },
42
63
  fonts: {
43
- display: "Bricolage Grotesque Variable",
44
- body: "Figtree Variable"
64
+ display: "Schibsted Grotesk Variable",
65
+ body: "Instrument Sans Variable",
66
+ code: "IBM Plex Mono"
67
+ },
68
+ layout: {
69
+ radius: "12px",
70
+ gutter: "1.5rem",
71
+ contentWidth: "72rem",
72
+ readableWidth: "42rem",
73
+ sectionGap: "2rem",
74
+ navGap: "1.5rem",
75
+ barPadding: "1rem",
76
+ navCurrentWeight: "400",
77
+ radiusControl: "8px"
45
78
  },
46
79
  signIn: {
47
80
  providerOrder: ["github", "google"],
48
81
  emailSignUp: "button"
49
- }
82
+ },
83
+ devPortOffset: 200
50
84
  };
51
85
 
52
86
  // src/brand/index.ts
@@ -71,6 +105,12 @@ var brand = {
71
105
  */
72
106
  legalName: optional.legalName ?? brand_default.productName,
73
107
  domain: brand_default.domain,
108
+ /**
109
+ * The apex of everything that isn't prod: stage is `*.stage.<devDomain>`
110
+ * (docs/deployment.md "Domains for stage and lab"). `domain` unless
111
+ * brand.json sets one.
112
+ */
113
+ devDomain: optional.devDomain ?? brand_default.domain,
74
114
  /**
75
115
  * Where the product's community talks: https://<domain>/discord, the
76
116
  * site's redirect to brand.json `discordInvite` (pnpm brand:sync); null
@@ -83,7 +123,21 @@ var brand = {
83
123
  securityContact: optional.securityContact ?? `security@${brand_default.domain}`,
84
124
  /** The support address the /contact page shows. Defaults to support@<domain>. */
85
125
  supportContact: optional.supportContact ?? `support@${brand_default.domain}`,
126
+ /**
127
+ * Where operational alerts go (dead letters, failed crons, unhandled
128
+ * API errors, failed uptime probes — the worker's `sendOpsAlert`).
129
+ * Defaults to ops@<domain>; null when brand.json sets `false` (the
130
+ * platform's own deployment: no customers, alerts only logged).
131
+ */
132
+ opsContact: optional.opsContact === false ? null : optional.opsContact ?? `ops@${brand_default.domain}`,
86
133
  colors: brand_default.colors,
134
+ /**
135
+ * True once the product has launched (brand.json `launched`, set at
136
+ * launch, never back): its data is customers', so the pre-launch
137
+ * product reset's `/ops` route is not mounted at all
138
+ * (docs/deployment.md "Resetting product data"). False when absent.
139
+ */
140
+ launched: optional.launched === true,
87
141
  /** True once the product has its own brand (brand.json `status: "ready"`), not the platform's placeholders. */
88
142
  ready: brand_default.status === "ready"
89
143
  };
@@ -103,11 +157,11 @@ function resolveProductFeatures(features) {
103
157
  guests: teams && on("guests"),
104
158
  /** The public `/v1` API: its router, the OpenAPI spec and reference, SDK and CLI publishing. */
105
159
  publicApi,
106
- /** Workspace API keys: Settings → API Keys, `/internal/workspace/api-keys`, `sk_` authentication on `/v1`. */
160
+ /** Workspace API keys: Settings → Developers, `/internal/workspace/api-keys`, `sk_` authentication on `/v1`. */
107
161
  apiKeys: publicApi && on("apiKeys"),
108
162
  /** Personal access tokens: Account → API tokens, `/internal/account/pats`, `/v1/user/*`, `pat_` authentication, the CLI's sign-in. */
109
163
  personalTokens: publicApi && on("personalTokens"),
110
- /** Outgoing webhooks: Settings → Webhooks, `/internal/workspace/webhooks`, the admin tab, queued deliveries. */
164
+ /** Outgoing webhooks: Settings → Developers, `/internal/workspace/webhooks`, the admin tab, queued deliveries. */
111
165
  webhooks: on("webhooks"),
112
166
  /** Billing: Settings → Billing, the Stripe plugin, the admin Billing surfaces, the site's pricing page; a free product. */
113
167
  billing: on("billing"),
@@ -125,7 +179,8 @@ function resolveProductEnvironments(environments, defaultEnvironment, docs) {
125
179
  name: env.name,
126
180
  keyPrefix: env.keyPrefix,
127
181
  readOnlyWorkspace: env.readOnlyWorkspace ?? false,
128
- description: env.description ?? ""
182
+ description: env.description ?? "",
183
+ agentLabel: env.agentLabel ?? env.description ?? ""
129
184
  }));
130
185
  const names = new Set(list.map((env) => env.name));
131
186
  const prefixes = new Set(list.map((env) => env.keyPrefix));
@@ -668,17 +723,27 @@ function apiErrorFrom(error, response) {
668
723
  return new ApiError(response.status, envelope.error?.code ?? "http_error", envelope.error?.message ?? `HTTP ${response.status}`, envelope.error?.requestId);
669
724
  }
670
725
 
726
+ // node_modules/@reminix/sdk/dist/product/index.js
727
+ var product_exports = {};
728
+ __export(product_exports, {
729
+ RunError: () => RunError,
730
+ productMethods: () => productMethods,
731
+ run: () => run,
732
+ uploadFile: () => uploadFile,
733
+ waitForRun: () => waitForRun
734
+ });
735
+
671
736
  // node_modules/@reminix/sdk/dist/product/upload.js
672
737
  async function uploadFile(client, file, options = {}) {
673
738
  const body = file.data instanceof Blob ? file.data : new Blob([file.data], {
674
- type: file.type ?? "application/octet-stream"
739
+ type: file.mediaType ?? "application/octet-stream"
675
740
  });
676
741
  return unwrap(await client.POST("/files", {
677
742
  params: { query: { name: file.name } },
678
743
  body,
679
744
  bodySerializer: (value) => value,
680
745
  headers: {
681
- "content-type": file.type ?? (body.type || "application/octet-stream"),
746
+ "content-type": file.mediaType ?? (body.type || "application/octet-stream"),
682
747
  ...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {}
683
748
  }
684
749
  }));
@@ -688,7 +753,7 @@ async function uploadFile(client, file, options = {}) {
688
753
  var RunError = class extends Error {
689
754
  run;
690
755
  constructor(run3) {
691
- super(run3.status === "cancelled" ? `Run ${run3.id} was cancelled: its approval was denied or expired` : `Run ${run3.id} failed: ${run3.error ?? "no error message"}`);
756
+ super(run3.status === "cancelled" ? `Run ${run3.id} was cancelled: ${run3.error ?? "no reason given"}` : `Run ${run3.id} failed: ${run3.error ?? "no error message"}`);
692
757
  this.name = "RunError";
693
758
  this.run = run3;
694
759
  }
@@ -699,7 +764,7 @@ async function withFileIds(client, inputs, idempotencyKey) {
699
764
  let uploaded = 0;
700
765
  const upload = async (value) => (await uploadFile(client, value instanceof Blob ? {
701
766
  name: "name" in value ? String(value.name) : "upload",
702
- type: value.type,
767
+ mediaType: value.type,
703
768
  data: value
704
769
  } : value, idempotencyKey ? { idempotencyKey: `${idempotencyKey}:file-${++uploaded}` } : {})).id;
705
770
  const out = {};
@@ -741,7 +806,7 @@ async function run(client, slug, inputs = {}, options = {}) {
741
806
  inputs: await withFileIds(client, inputs, options.idempotencyKey)
742
807
  };
743
808
  const keyed = options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {};
744
- const started = options.version === void 0 ? await client.runs.create(slug, body, keyed) : await client.scriptVersions.run(slug, options.version, body, keyed);
809
+ const started = options.version === void 0 ? await client.runs.create(slug, body, keyed) : await client.scriptVersions.testRun(slug, options.version, body, keyed);
745
810
  if (started.status === "awaiting_approval") {
746
811
  options.onApproval?.(started.approval?.approveUrl ?? null);
747
812
  }
@@ -817,11 +882,7 @@ function resources(client) {
817
882
  files: {
818
883
  download: (
819
884
  /** Download a file */
820
- (fileId, options) => call(client, { "method": "get", "path": "/files/{fileId}/content", "query": [], "hasBody": false, "rawResponse": "application/octet-stream" }, { "fileId": fileId }, void 0, options)
821
- ),
822
- upload: (
823
- /** Upload a file */
824
- (content, input, options) => call(client, { "method": "post", "path": "/files", "query": ["name"], "hasBody": false, "rawBody": "application/octet-stream" }, {}, input, options, content)
885
+ (fileId, options) => call(client, { "method": "get", "path": "/files/{fileId}/download", "query": [], "hasBody": false, "rawResponse": "application/octet-stream" }, { "fileId": fileId }, void 0, options)
825
886
  ),
826
887
  get: (
827
888
  /** Get a file */
@@ -829,7 +890,11 @@ function resources(client) {
829
890
  ),
830
891
  list: (
831
892
  /** List files */
832
- (input, options) => call(client, { "method": "get", "path": "/files", "query": ["limit", "cursor", "script", "direction", "q"], "hasBody": false }, {}, input, options)
893
+ (input, options) => call(client, { "method": "get", "path": "/files", "query": ["limit", "cursor", "script", "origin", "q"], "hasBody": false }, {}, input, options)
894
+ ),
895
+ upload: (
896
+ /** Upload a file */
897
+ (content, input, options) => call(client, { "method": "post", "path": "/files", "query": ["name"], "hasBody": false, "rawBody": "application/octet-stream" }, {}, input, options, content)
833
898
  )
834
899
  },
835
900
  runs: {
@@ -849,9 +914,9 @@ function resources(client) {
849
914
  /** List runs */
850
915
  (input, options) => call(client, { "method": "get", "path": "/runs", "query": ["limit", "cursor", "script"], "hasBody": false }, {}, input, options)
851
916
  ),
852
- logs: (
917
+ log: (
853
918
  /** Get a run's log */
854
- (runId, options) => call(client, { "method": "get", "path": "/runs/{runId}/logs", "query": [], "hasBody": false }, { "runId": runId }, void 0, options)
919
+ (runId, options) => call(client, { "method": "get", "path": "/runs/{runId}/log", "query": [], "hasBody": false }, { "runId": runId }, void 0, options)
855
920
  )
856
921
  },
857
922
  schedules: {
@@ -909,21 +974,21 @@ function resources(client) {
909
974
  )
910
975
  },
911
976
  scriptVersions: {
912
- create: (
913
- /** Upload a version */
914
- (slug, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions", "query": [], "hasBody": true }, { "slug": slug }, input, options)
915
- ),
916
977
  list: (
917
978
  /** List a script's versions */
918
979
  (slug, options) => call(client, { "method": "get", "path": "/scripts/{slug}/versions", "query": [], "hasBody": false }, { "slug": slug }, void 0, options)
919
980
  ),
920
981
  publish: (
921
982
  /** Publish a version */
922
- (slug, number, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{number}/publish", "query": [], "hasBody": false }, { "slug": slug, "number": number }, void 0, options)
983
+ (slug, version, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{version}/publish", "query": [], "hasBody": false }, { "slug": slug, "version": version }, void 0, options)
923
984
  ),
924
- run: (
985
+ testRun: (
925
986
  /** Test-run a version */
926
- (slug, number, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{number}/runs", "query": [], "hasBody": true }, { "slug": slug, "number": number }, input, options)
987
+ (slug, version, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{version}/runs", "query": [], "hasBody": true }, { "slug": slug, "version": version }, input, options)
988
+ ),
989
+ upload: (
990
+ /** Upload a version */
991
+ (slug, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions", "query": [], "hasBody": true }, { "slug": slug }, input, options)
927
992
  )
928
993
  },
929
994
  secrets: {
@@ -938,8 +1003,10 @@ function resources(client) {
938
1003
  set: (
939
1004
  /** Save a secret */
940
1005
  (name, input, options) => call(client, { "method": "put", "path": "/secrets/{name}", "query": [], "hasBody": true }, { "name": name }, input, options)
941
- ),
942
- unset: (
1006
+ )
1007
+ },
1008
+ secretValues: {
1009
+ delete: (
943
1010
  /** Remove a secret's value from an environment */
944
1011
  (name, environment2, options) => call(client, { "method": "delete", "path": "/secrets/{name}/values/{environment}", "query": [], "hasBody": false }, { "name": name, "environment": environment2 }, void 0, options)
945
1012
  )
@@ -1065,6 +1132,10 @@ function resources(client) {
1065
1132
  test: (
1066
1133
  /** Send a test event */
1067
1134
  (endpointId, options) => call(client, { "method": "post", "path": "/workspace/webhook-endpoints/{endpointId}/test", "query": [], "hasBody": false }, { "endpointId": endpointId }, void 0, options)
1135
+ ),
1136
+ update: (
1137
+ /** Update a webhook endpoint */
1138
+ (endpointId, input, options) => call(client, { "method": "patch", "path": "/workspace/webhook-endpoints/{endpointId}", "query": [], "hasBody": true }, { "endpointId": endpointId }, input, options)
1068
1139
  )
1069
1140
  }
1070
1141
  }
@@ -1077,6 +1148,8 @@ var RETRY_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
1077
1148
  var DEFAULT_MAX_RETRIES = 2;
1078
1149
  var MAX_WAIT_MS = 2e4;
1079
1150
  var MAX_BASE_KEY = 200;
1151
+ var PRODUCT_RETRY_HEADER = "x-sdk-product-retry";
1152
+ var productRetry = () => "productRetry" in product_exports ? Reflect.get(product_exports, "productRetry") ?? null : null;
1080
1153
  var wait = (ms) => new Promise((done) => setTimeout(done, ms));
1081
1154
  function backoff(attempt) {
1082
1155
  const base = Math.min(500 * 2 ** attempt, 8e3);
@@ -1104,10 +1177,24 @@ async function retryable(response) {
1104
1177
  return false;
1105
1178
  }
1106
1179
  }
1180
+ function takeProductRetryHeader(request) {
1181
+ if (!request.headers.has(PRODUCT_RETRY_HEADER))
1182
+ return [request, false];
1183
+ const returns = request.headers.get(PRODUCT_RETRY_HEADER) === "return";
1184
+ const headers = new Headers(request.headers);
1185
+ headers.delete(PRODUCT_RETRY_HEADER);
1186
+ return [new Request(request, { headers }), returns];
1187
+ }
1188
+ function withoutProductRetryHeader(fetch2) {
1189
+ return (request) => fetch2(takeProductRetryHeader(request)[0]);
1190
+ }
1107
1191
  function withRetries(fetch2, options = {}) {
1108
1192
  const maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
1109
1193
  const sleep = options.sleep ?? wait;
1194
+ const later = options.product === void 0 ? productRetry() : options.product;
1110
1195
  return async (request) => {
1196
+ let returnLater;
1197
+ [request, returnLater] = takeProductRetryHeader(request);
1111
1198
  if (WRITES.has(request.method) && !request.headers.has("idempotency-key")) {
1112
1199
  const url = new URL(request.url);
1113
1200
  const key = options.key ? await options.key(request.method, url.pathname) : crypto.randomUUID();
@@ -1115,9 +1202,11 @@ function withRetries(fetch2, options = {}) {
1115
1202
  headers.set("idempotency-key", key);
1116
1203
  request = new Request(request, { headers });
1117
1204
  }
1205
+ let laterTries = 0;
1206
+ let laterWaited = 0;
1118
1207
  for (let attempt = 0; ; attempt++) {
1119
1208
  const last = attempt >= maxRetries;
1120
- const sending = last ? request : request.clone();
1209
+ const sending = last && !later ? request : request.clone();
1121
1210
  let response;
1122
1211
  try {
1123
1212
  response = await fetch2(sending);
@@ -1127,6 +1216,18 @@ function withRetries(fetch2, options = {}) {
1127
1216
  await sleep(backoff(attempt));
1128
1217
  continue;
1129
1218
  }
1219
+ const laterMs = later ? await later.wait(response, laterTries) : null;
1220
+ if (laterMs !== null && later) {
1221
+ if (returnLater || laterWaited + laterMs > later.budgetMs) {
1222
+ return response;
1223
+ }
1224
+ laterTries++;
1225
+ laterWaited += laterMs;
1226
+ await response.body?.cancel();
1227
+ await sleep(laterMs);
1228
+ attempt--;
1229
+ continue;
1230
+ }
1130
1231
  if (last || !await retryable(response))
1131
1232
  return response;
1132
1233
  const delay = retryAfter(response) ?? backoff(attempt);
@@ -1228,10 +1329,11 @@ async function verifyWebhook(body, headers, secret, options = {}) {
1228
1329
 
1229
1330
  // node_modules/@reminix/sdk/dist/index.js
1230
1331
  var API_KEY_ENV = `${brand2.identifier.toUpperCase()}_API_KEY`;
1332
+ var TOKEN_ENV = `${brand2.identifier.toUpperCase()}_TOKEN`;
1231
1333
  var DEFAULT_API = `https://api.${brand2.domain}`;
1232
1334
  function createClient2(options = {}) {
1233
1335
  const client = createBaseClient(options);
1234
- const extend = productMethods;
1336
+ const extend = Reflect.get(product_exports, "productMethods");
1235
1337
  if (!extend)
1236
1338
  return client;
1237
1339
  const methods = extend(client);
@@ -1243,15 +1345,18 @@ function createClient2(options = {}) {
1243
1345
  return Object.assign(client, methods);
1244
1346
  }
1245
1347
  function createBaseClient(options) {
1246
- const token = options.token ?? keyFromEnvironment();
1348
+ if (options.apiKey && options.token) {
1349
+ throw new Error(`${brand2.productName}: pass apiKey or token, not both.`);
1350
+ }
1351
+ const token = options.apiKey || options.token || credentialFromEnvironment();
1247
1352
  if (!token) {
1248
- throw new Error(`${brand2.productName}: no API key. Pass { token } or set ${API_KEY_ENV}.`);
1353
+ throw new Error(`${brand2.productName}: no API key. Pass { apiKey } or set ${API_KEY_ENV}.`);
1249
1354
  }
1250
- const origin = (options.api ?? DEFAULT_API).replace(/\/+$/, "");
1355
+ const origin = withoutTrailingSlashes(options.api ?? DEFAULT_API);
1251
1356
  const send = options.fetch ?? ((request) => fetch(request));
1252
1357
  const client = createClient({
1253
1358
  baseUrl: `${origin}/v1`,
1254
- fetch: options.maxRetries === 0 ? send : withRetries(send, { maxRetries: options.maxRetries })
1359
+ fetch: options.maxRetries === 0 ? withoutProductRetryHeader(send) : withRetries(send, { maxRetries: options.maxRetries })
1255
1360
  });
1256
1361
  client.use({
1257
1362
  onRequest({ request }) {
@@ -1269,9 +1374,10 @@ function createBaseClient(options) {
1269
1374
  webhooks: { verify: verifyWebhook }
1270
1375
  });
1271
1376
  }
1272
- function keyFromEnvironment() {
1377
+ function credentialFromEnvironment() {
1273
1378
  const runtime = globalThis;
1274
- return runtime.process?.env?.[API_KEY_ENV] || void 0;
1379
+ const env = runtime.process?.env;
1380
+ return env?.[API_KEY_ENV] || env?.[TOKEN_ENV] || void 0;
1275
1381
  }
1276
1382
  function unwrap(result) {
1277
1383
  if (result.error !== void 0 || !result.response.ok) {
@@ -1279,6 +1385,12 @@ function unwrap(result) {
1279
1385
  }
1280
1386
  return result.data;
1281
1387
  }
1388
+ function withoutTrailingSlashes(url) {
1389
+ let end = url.length;
1390
+ while (end > 0 && url[end - 1] === "/")
1391
+ end--;
1392
+ return url.slice(0, end);
1393
+ }
1282
1394
 
1283
1395
  // node_modules/commander/lib/error.js
1284
1396
  var CommanderError = class extends Error {
@@ -4720,14 +4832,14 @@ function browserLogin(options) {
4720
4832
  send(
4721
4833
  200,
4722
4834
  "You are signed in",
4723
- "Return to your terminal \u2014 you can close this tab."
4835
+ "Return to your terminal. You can close this tab."
4724
4836
  );
4725
4837
  finish(() => resolve4(token));
4726
4838
  });
4727
4839
  const timer = setTimeout(
4728
4840
  () => finish(
4729
4841
  () => reject(
4730
- new Error("timed out waiting for the browser \u2014 run login again")
4842
+ new Error("timed out waiting for the browser. Run login again.")
4731
4843
  )
4732
4844
  ),
4733
4845
  options.timeoutMs ?? 5 * 60 * 1e3
@@ -4753,8 +4865,8 @@ function webOriginFor(api2) {
4753
4865
  url.hostname = `app.${url.hostname.slice(4)}`;
4754
4866
  return url.origin;
4755
4867
  }
4756
- if ((url.hostname === "localhost" || url.hostname === "127.0.0.1") && url.port === "8787") {
4757
- url.port = "3000";
4868
+ if ((url.hostname === "localhost" || url.hostname === "127.0.0.1") && Number(url.port) >= 8787 && Number(url.port) % 100 === 87) {
4869
+ url.port = String(Number(url.port) - 5787);
4758
4870
  return url.origin;
4759
4871
  }
4760
4872
  return null;
@@ -4781,7 +4893,7 @@ function readConfig(homeDir) {
4781
4893
  try {
4782
4894
  return JSON.parse(readFileSync(path2, "utf8"));
4783
4895
  } catch {
4784
- throw new Error(`${path2} is not valid JSON \u2014 fix or delete it`);
4896
+ throw new Error(`${path2} is not valid JSON. Fix or delete it.`);
4785
4897
  }
4786
4898
  }
4787
4899
  function writeConfig(homeDir, config2) {
@@ -4799,11 +4911,18 @@ function resolveSettings(env, homeDir, flags = {}) {
4799
4911
  const environment2 = flags.environment ? { environment: flags.environment, environmentSource: "flag" } : env[environmentEnvVar()] ? { environment: env[environmentEnvVar()], environmentSource: "env" } : config2.environment ? { environment: config2.environment, environmentSource: "config" } : { environment: void 0, environmentSource: null };
4800
4912
  return {
4801
4913
  ...environment2,
4802
- api: (env[`${brand.identifier.toUpperCase()}_API`] ?? config2.api ?? DEFAULT_API).replace(/\/+$/, ""),
4914
+ api: withoutTrailingSlashes2(
4915
+ env[`${brand.identifier.toUpperCase()}_API`] ?? config2.api ?? DEFAULT_API
4916
+ ),
4803
4917
  token: env[tokenEnvVar()] ?? config2.token,
4804
4918
  workspace: env[`${brand.identifier.toUpperCase()}_WORKSPACE`] ?? config2.workspace
4805
4919
  };
4806
4920
  }
4921
+ function withoutTrailingSlashes2(url) {
4922
+ let end = url.length;
4923
+ while (end > 0 && url[end - 1] === "/") end--;
4924
+ return url.slice(0, end);
4925
+ }
4807
4926
 
4808
4927
  // src/http.ts
4809
4928
  async function rawRequest(ctx, options) {
@@ -4853,7 +4972,9 @@ function writeEnvVar(path2, name, value) {
4853
4972
  }
4854
4973
  var approvals = (program3, ctx) => {
4855
4974
  const workspace2 = program3.commands.find((c) => c.name() === "workspace") ?? program3.command("workspace");
4856
- const group = workspace2.command("approval-requests").description("approval-requests commands");
4975
+ const group = workspace2.command("approval-requests").description(
4976
+ "Ask a person to approve an action, and collect what it creates"
4977
+ );
4857
4978
  group.command("redeem <request-id>").description(
4858
4979
  "Collect an approved secret once, into an env file (never printed)"
4859
4980
  ).requiredOption(
@@ -4884,7 +5005,7 @@ var approvals = (program3, ctx) => {
4884
5005
  }
4885
5006
  if (request.status !== "approved") {
4886
5007
  throw new Error(
4887
- request.status === "pending" ? `Not approved yet \u2014 ask a person to approve it: ${request.approveUrl}` : `This request is ${request.status}; nothing to collect.`
5008
+ request.status === "pending" ? `Not approved yet. Ask a person to approve it: ${request.approveUrl}` : `This request is ${request.status}; nothing to collect.`
4888
5009
  );
4889
5010
  }
4890
5011
  const redeemed = await call3(
@@ -4926,7 +5047,7 @@ async function saveToken(ctx, token, api2) {
4926
5047
  writeConfig(ctx.io.homeDir, previous);
4927
5048
  const reason = error instanceof Error ? error.message : String(error);
4928
5049
  throw new Error(
4929
- `could not verify the token (${reason}) \u2014 nothing was saved`,
5050
+ `could not verify the token (${reason}). Nothing was saved.`,
4930
5051
  { cause: error }
4931
5052
  );
4932
5053
  }
@@ -4934,7 +5055,7 @@ async function saveToken(ctx, token, api2) {
4934
5055
  `Logged in. Token stored in ${configPath(ctx.io.homeDir)} (0600).`
4935
5056
  );
4936
5057
  ctx.io.stdout(
4937
- `Hello ${user.name} <${user.email}> \u2014 ${user.workspaces.length} workspace(s).`
5058
+ `Hello ${user.name} <${user.email}>. You have ${user.workspaces.length} workspace(s).`
4938
5059
  );
4939
5060
  if (!config2.workspace && user.workspaces.length === 1) {
4940
5061
  config2.workspace = user.workspaces[0].slug;
@@ -4946,7 +5067,7 @@ async function saveToken(ctx, token, api2) {
4946
5067
  }
4947
5068
  var login = (program3, ctx) => {
4948
5069
  program3.command("login").description(
4949
- "Sign in through the browser (or store a personal access token with --token)"
5070
+ "Sign in through the browser, or store a personal access token with --token"
4950
5071
  ).option("--token <pat>", "a personal access token (CI, servers)").option("--api <origin>", `API origin (default ${DEFAULT_API})`).option("--web <origin>", "web app origin for the browser sign-in").action(async (options) => {
4951
5072
  if (!productFeatures.personalTokens) {
4952
5073
  throw new Error(
@@ -4959,7 +5080,7 @@ var login = (program3, ctx) => {
4959
5080
  }
4960
5081
  if (!ctx.io.interactive) {
4961
5082
  ctx.io.stderr(
4962
- `Paste a personal access token (Account \u2192 API tokens in ${brand.productName}), then Enter:`
5083
+ `Paste a personal access token (Account \u2192 Personal access tokens in ${brand.productName}), then Enter:`
4963
5084
  );
4964
5085
  await saveToken(ctx, (await ctx.io.stdin()).trim(), options.api);
4965
5086
  return;
@@ -4968,7 +5089,7 @@ var login = (program3, ctx) => {
4968
5089
  const webOrigin = options.web ?? webOriginFor(api2);
4969
5090
  if (!webOrigin) {
4970
5091
  throw new Error(
4971
- `cannot tell the web app's address from ${api2} \u2014 pass --web <origin>`
5092
+ `cannot tell the web app's address from ${api2}. Pass --web <origin>.`
4972
5093
  );
4973
5094
  }
4974
5095
  const token = await browserLogin({
@@ -4995,13 +5116,13 @@ var logout = (program3, ctx) => {
4995
5116
  ).catch(() => null);
4996
5117
  if (revoked && !revoked.ok && revoked.status !== 401) {
4997
5118
  ctx.io.stderr(
4998
- `Could not revoke the token (HTTP ${revoked.status}) \u2014 revoke it under Account \u2192 API tokens.`
5119
+ `Could not revoke the token (HTTP ${revoked.status}). Revoke it under Account \u2192 Personal access tokens.`
4999
5120
  );
5000
5121
  }
5001
5122
  }
5002
5123
  delete config2.token;
5003
5124
  writeConfig(ctx.io.homeDir, config2);
5004
- ctx.io.stdout("Logged out \u2014 the token is revoked and forgotten.");
5125
+ ctx.io.stdout("Logged out. The token is revoked and forgotten.");
5005
5126
  });
5006
5127
  };
5007
5128
  async function printWorkspaces(ctx, asJson) {
@@ -5024,13 +5145,13 @@ async function printWorkspaces(ctx, asJson) {
5024
5145
  );
5025
5146
  }
5026
5147
  var whoami = (program3, ctx) => {
5027
- program3.command("whoami").description("Who the token acts as, and their workspaces").option("--json", "machine-readable output").action(
5148
+ program3.command("whoami").description("Show who the token acts as and which workspaces it can use").option("--json", "machine-readable output").action(
5028
5149
  (options) => printWorkspaces(ctx, options.json === true)
5029
5150
  );
5030
5151
  };
5031
5152
  var workspace = (program3, ctx) => {
5032
5153
  const group = program3.command("workspace").description(
5033
- "Your workspaces (list, use), and the current one's members, webhooks, approvals, usage \u2026"
5154
+ "Work with your workspaces and the current one's members, webhooks, approvals and usage"
5034
5155
  );
5035
5156
  group.command("list", { isDefault: true }).description("List the workspaces the token can act in").option("--json", "machine-readable output").action(
5036
5157
  (options) => printWorkspaces(ctx, options.json === true)
@@ -5047,7 +5168,7 @@ var workspace = (program3, ctx) => {
5047
5168
  });
5048
5169
  };
5049
5170
  var environment = (program3, ctx) => {
5050
- const group = program3.command("environment").description("The environment commands act in (list, use, unset)");
5171
+ const group = program3.command("environment").description("Choose the environment commands act in");
5051
5172
  group.command("list", { isDefault: true }).description("Show the environment commands act in").action(() => {
5052
5173
  const { environment: current, environmentSource } = ctx.settings();
5053
5174
  const from = environmentSource ? `(from ${{ flag: "--environment", env: environmentEnvVar(), config: "config" }[environmentSource]})` : null;
@@ -5061,14 +5182,14 @@ var environment = (program3, ctx) => {
5061
5182
  return;
5062
5183
  }
5063
5184
  ctx.io.stdout(
5064
- current ? `${current} ${from}` : "None set \u2014 the API acts in the workspace's default."
5185
+ current ? `${current} ${from}` : "None set. The API acts in the workspace's default."
5065
5186
  );
5066
5187
  });
5067
5188
  group.command("use <name>").description("Make <name> the default environment for commands").action((name) => {
5068
5189
  const declared = productEnvironments.list.map((env) => env.name);
5069
5190
  if (declared.length > 0 && !declared.includes(name)) {
5070
5191
  throw new Error(
5071
- `unknown environment '${name}' \u2014 ${brand.productName}'s are ${declared.join(", ")}`
5192
+ `unknown environment '${name}'. ${brand.productName}'s environments are ${declared.join(", ")}.`
5072
5193
  );
5073
5194
  }
5074
5195
  const config2 = readConfig(ctx.io.homeDir);
@@ -5077,7 +5198,7 @@ var environment = (program3, ctx) => {
5077
5198
  ctx.io.stdout(`Default environment: ${name}`);
5078
5199
  });
5079
5200
  group.command("unset").description(
5080
- "Forget the default environment (the product's default applies)"
5201
+ "Forget the default environment and go back to the product's default"
5081
5202
  ).action(() => {
5082
5203
  const config2 = readConfig(ctx.io.homeDir);
5083
5204
  delete config2.environment;
@@ -5086,7 +5207,7 @@ var environment = (program3, ctx) => {
5086
5207
  });
5087
5208
  };
5088
5209
  var api = (program3, ctx) => {
5089
- program3.command("api <method> <path>").description("Call any endpoint as the selected workspace (escape hatch)").option("--data <json>", "JSON request body").option("--workspace <slug>", "act in this workspace for one call").action(
5210
+ program3.command("api <method> <path>").description("Call any API endpoint directly, in the selected workspace").option("--data <json>", "JSON request body").option("--workspace <slug>", "act in this workspace for one call").action(
5090
5211
  async (method, path2, options) => {
5091
5212
  if (!path2.startsWith("/")) {
5092
5213
  throw new Error("usage: api <method> </v1/...> [--data '<json>']");
@@ -5106,7 +5227,7 @@ var api = (program3, ctx) => {
5106
5227
  );
5107
5228
  };
5108
5229
  var config = (program3, ctx) => {
5109
- program3.command("config").description("Show the effective settings (token masked)").action(() => {
5230
+ program3.command("config").description("Show the settings in effect, with the token hidden").action(() => {
5110
5231
  const settings = ctx.settings();
5111
5232
  ctx.io.stdout(
5112
5233
  json({
@@ -5152,8 +5273,11 @@ function operationRequest(op, input, body = {}) {
5152
5273
  json2[field.name] = value;
5153
5274
  }
5154
5275
  }
5155
- const missing = path2.match(/\{([^}]+)\}/);
5156
- if (missing) throw new Error(`missing ${missing[1]}`);
5276
+ const open = path2.indexOf("{");
5277
+ const close = open === -1 ? -1 : path2.indexOf("}", open + 1);
5278
+ if (close > open + 1) {
5279
+ throw new Error(`missing ${path2.slice(open + 1, close)}`);
5280
+ }
5157
5281
  const qs = query.toString();
5158
5282
  return {
5159
5283
  method: op.method.toUpperCase(),
@@ -5176,20 +5300,20 @@ var OPERATIONS = [
5176
5300
  },
5177
5301
  "mcp": {
5178
5302
  "exposed": false,
5179
- "reason": "Environments hold secret values and rules \u2014 a person sets them up; an agent asks"
5303
+ "reason": "Environments hold secret values and rules. A person sets them up, and an agent asks a person to."
5180
5304
  },
5181
- "description": "Adds an environment with no secret values yet \u2014 save them with X-Environment set to it. Lowercase letters, digits and dashes. Owners and admins, or a workspace API key.",
5305
+ "description": "Adds an environment with no secret values yet. To save its values, call secrets.set with X-Environment set to the new environment. Workspace owners, admins and API keys can add an environment.",
5182
5306
  "fields": [
5183
5307
  {
5184
5308
  "name": "name",
5185
5309
  "in": "body",
5186
5310
  "type": "string",
5187
5311
  "required": true,
5188
- "description": "Its name, unique in the workspace.",
5312
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter.",
5189
5313
  "example": "staging",
5190
5314
  "schema": {
5191
5315
  "type": "string",
5192
- "description": "Its name, unique in the workspace."
5316
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter."
5193
5317
  }
5194
5318
  },
5195
5319
  {
@@ -5197,7 +5321,8 @@ var OPERATIONS = [
5197
5321
  "in": "body",
5198
5322
  "type": "string",
5199
5323
  "required": false,
5200
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy. Default: none.",
5324
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy. The default is `none`.",
5325
+ "example": "agents",
5201
5326
  "schema": {
5202
5327
  "type": "string",
5203
5328
  "enum": [
@@ -5205,7 +5330,7 @@ var OPERATIONS = [
5205
5330
  "agents",
5206
5331
  "always"
5207
5332
  ],
5208
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy. Default: none."
5333
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy. The default is `none`."
5209
5334
  }
5210
5335
  },
5211
5336
  {
@@ -5213,15 +5338,16 @@ var OPERATIONS = [
5213
5338
  "in": "body",
5214
5339
  "type": "boolean",
5215
5340
  "required": false,
5216
- "description": "Whether agents (MCP) may run scripts here, or schedule them to. Default: true.",
5341
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here. The default is true.",
5217
5342
  "schema": {
5218
5343
  "type": "boolean",
5219
- "description": "Whether agents (MCP) may run scripts here, or schedule them to. Default: true."
5344
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here. The default is true."
5220
5345
  }
5221
5346
  }
5222
5347
  ],
5223
5348
  "hasBody": true,
5224
5349
  "workspace": true,
5350
+ "acceptsApiKey": true,
5225
5351
  "scope": "environments:write"
5226
5352
  },
5227
5353
  {
@@ -5238,23 +5364,26 @@ var OPERATIONS = [
5238
5364
  },
5239
5365
  "mcp": {
5240
5366
  "exposed": false,
5241
- "reason": "Environments hold secret values and rules \u2014 a person sets them up; an agent asks"
5367
+ "reason": "Environments hold secret values and rules. A person sets them up, and an agent asks a person to."
5242
5368
  },
5243
- "description": "Deletes it and every secret value it holds (GET it first to see how many). Refused for the only environment, the default, and one a schedule or trigger runs in. Owners and admins, or a workspace API key.",
5369
+ "description": "Deletes an environment and every secret value it holds. Get the environment first to see how many values that is. You can't delete the only environment, the default environment, or one that a schedule or trigger runs in. Workspace owners, admins and API keys can delete an environment.",
5244
5370
  "fields": [
5245
5371
  {
5246
5372
  "name": "environment",
5247
5373
  "in": "path",
5248
5374
  "type": "string",
5249
5375
  "required": true,
5376
+ "description": "The environment's ID.",
5250
5377
  "example": "staging",
5251
5378
  "schema": {
5252
- "type": "string"
5379
+ "type": "string",
5380
+ "description": "The environment's ID."
5253
5381
  }
5254
5382
  }
5255
5383
  ],
5256
5384
  "hasBody": false,
5257
5385
  "workspace": true,
5386
+ "acceptsApiKey": true,
5258
5387
  "scope": "environments:write"
5259
5388
  },
5260
5389
  {
@@ -5278,21 +5407,24 @@ var OPERATIONS = [
5278
5407
  "idempotentHint": true
5279
5408
  }
5280
5409
  },
5281
- "description": "One environment, with what uses it: the secret values deleting it would delete, and the schedules and triggers that keep it from being deleted.",
5410
+ "description": "Returns one environment and what uses it: its secret values, and the schedules and triggers that run in it. Deleting the environment deletes its secret values. You can't delete it while a schedule or trigger runs in it.",
5282
5411
  "fields": [
5283
5412
  {
5284
5413
  "name": "environment",
5285
5414
  "in": "path",
5286
5415
  "type": "string",
5287
5416
  "required": true,
5417
+ "description": "The environment's ID.",
5288
5418
  "example": "staging",
5289
5419
  "schema": {
5290
- "type": "string"
5420
+ "type": "string",
5421
+ "description": "The environment's ID."
5291
5422
  }
5292
5423
  }
5293
5424
  ],
5294
5425
  "hasBody": false,
5295
5426
  "workspace": true,
5427
+ "acceptsApiKey": true,
5296
5428
  "scope": "environments:read"
5297
5429
  },
5298
5430
  {
@@ -5314,10 +5446,11 @@ var OPERATIONS = [
5314
5446
  "idempotentHint": true
5315
5447
  }
5316
5448
  },
5317
- "description": "The workspace's environments, oldest first, with which is the default. Name one with the X-Environment header to act in it.",
5449
+ "description": "Lists the workspace's environments, oldest first, and shows which one is the default. To act in an environment, name it in the X-Environment header.",
5318
5450
  "fields": [],
5319
5451
  "hasBody": false,
5320
5452
  "workspace": true,
5453
+ "acceptsApiKey": true,
5321
5454
  "scope": "environments:read"
5322
5455
  },
5323
5456
  {
@@ -5334,18 +5467,20 @@ var OPERATIONS = [
5334
5467
  },
5335
5468
  "mcp": {
5336
5469
  "exposed": false,
5337
- "reason": "Environments hold secret values and rules \u2014 a person sets them up; an agent asks"
5470
+ "reason": "Environments hold secret values and rules. A person sets them up, and an agent asks a person to."
5338
5471
  },
5339
- "description": "Renames it, changes its rules, or makes it the workspace's default (`isDefault: true`). Runs keep the name they ran under. Owners and admins, or a workspace API key.",
5472
+ "description": "Renames an environment, changes its rules, or makes it the workspace's default with `isDefault: true`. Runs keep the environment name they ran under. Workspace owners, admins and API keys can change an environment.",
5340
5473
  "fields": [
5341
5474
  {
5342
5475
  "name": "environment",
5343
5476
  "in": "path",
5344
5477
  "type": "string",
5345
5478
  "required": true,
5479
+ "description": "The environment's ID.",
5346
5480
  "example": "staging",
5347
5481
  "schema": {
5348
- "type": "string"
5482
+ "type": "string",
5483
+ "description": "The environment's ID."
5349
5484
  }
5350
5485
  },
5351
5486
  {
@@ -5353,10 +5488,10 @@ var OPERATIONS = [
5353
5488
  "in": "body",
5354
5489
  "type": "string",
5355
5490
  "required": false,
5356
- "description": "Its name, unique in the workspace.",
5491
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter.",
5357
5492
  "schema": {
5358
5493
  "type": "string",
5359
- "description": "Its name, unique in the workspace."
5494
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter."
5360
5495
  }
5361
5496
  },
5362
5497
  {
@@ -5364,7 +5499,8 @@ var OPERATIONS = [
5364
5499
  "in": "body",
5365
5500
  "type": "string",
5366
5501
  "required": false,
5367
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy.",
5502
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy.",
5503
+ "example": "agents",
5368
5504
  "schema": {
5369
5505
  "type": "string",
5370
5506
  "enum": [
@@ -5372,7 +5508,7 @@ var OPERATIONS = [
5372
5508
  "agents",
5373
5509
  "always"
5374
5510
  ],
5375
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy."
5511
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy."
5376
5512
  }
5377
5513
  },
5378
5514
  {
@@ -5380,10 +5516,10 @@ var OPERATIONS = [
5380
5516
  "in": "body",
5381
5517
  "type": "boolean",
5382
5518
  "required": false,
5383
- "description": "Whether agents (MCP) may run scripts here, or schedule them to.",
5519
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here.",
5384
5520
  "schema": {
5385
5521
  "type": "boolean",
5386
- "description": "Whether agents (MCP) may run scripts here, or schedule them to."
5522
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here."
5387
5523
  }
5388
5524
  },
5389
5525
  {
@@ -5391,24 +5527,25 @@ var OPERATIONS = [
5391
5527
  "in": "body",
5392
5528
  "type": "boolean",
5393
5529
  "required": false,
5394
- "description": "Make it the default. To change the default, make another one the default.",
5530
+ "description": "Makes this the default environment. To change the default, make another environment the default.",
5395
5531
  "schema": {
5396
5532
  "type": "boolean",
5397
5533
  "enum": [
5398
5534
  true
5399
5535
  ],
5400
- "description": "Make it the default. To change the default, make another one the default."
5536
+ "description": "Makes this the default environment. To change the default, make another environment the default."
5401
5537
  }
5402
5538
  }
5403
5539
  ],
5404
5540
  "hasBody": true,
5405
5541
  "workspace": true,
5542
+ "acceptsApiKey": true,
5406
5543
  "scope": "environments:write"
5407
5544
  },
5408
5545
  {
5409
- "operationId": "files.content",
5546
+ "operationId": "files.download",
5410
5547
  "method": "get",
5411
- "path": "/files/{fileId}/content",
5548
+ "path": "/files/{fileId}/download",
5412
5549
  "summary": "Download a file",
5413
5550
  "cli": {
5414
5551
  "command": "files download",
@@ -5421,59 +5558,27 @@ var OPERATIONS = [
5421
5558
  "exposed": false,
5422
5559
  "reason": "Returns raw bytes; agents use the file's downloadUrl (files.get) instead."
5423
5560
  },
5424
- "description": "The file's bytes, always as an attachment (`Content-Disposition: attachment`) \u2014 never shown as a page.",
5561
+ "description": "Returns the file's bytes as a download. The response always has `Content-Disposition: attachment`, so a browser saves the file instead of showing it as a page.",
5425
5562
  "fields": [
5426
5563
  {
5427
5564
  "name": "fileId",
5428
5565
  "in": "path",
5429
5566
  "type": "string",
5430
5567
  "required": true,
5568
+ "description": "The file's ID.",
5569
+ "example": "file_4c1e\u2026",
5431
5570
  "schema": {
5432
- "type": "string"
5571
+ "type": "string",
5572
+ "description": "The file's ID."
5433
5573
  }
5434
5574
  }
5435
5575
  ],
5436
5576
  "hasBody": false,
5437
5577
  "rawResponse": "application/octet-stream",
5438
5578
  "workspace": true,
5579
+ "acceptsApiKey": true,
5439
5580
  "scope": "runs:read"
5440
5581
  },
5441
- {
5442
- "operationId": "files.create",
5443
- "method": "post",
5444
- "path": "/files",
5445
- "summary": "Upload a file",
5446
- "cli": {
5447
- "command": "files upload",
5448
- "args": [],
5449
- "confirm": false
5450
- },
5451
- "mcp": {
5452
- "exposed": false,
5453
- "reason": "Takes raw bytes, which an agent's tool call can't carry; agents pass an https link as the file input instead."
5454
- },
5455
- "description": 'Uploads a file to give a run: send its bytes as the body with its `Content-Type` and `Content-Length`, and its name as `?name=`. Then pass the returned id as a file input (`{ "<input>": "file_\u2026" }`). An upload no run uses within a day is deleted; one run uses it.',
5456
- "fields": [
5457
- {
5458
- "name": "name",
5459
- "in": "query",
5460
- "type": "string",
5461
- "required": true,
5462
- "description": "The file's name.",
5463
- "example": "adjustments.csv",
5464
- "schema": {
5465
- "type": "string",
5466
- "minLength": 1,
5467
- "maxLength": 500,
5468
- "description": "The file's name."
5469
- }
5470
- }
5471
- ],
5472
- "hasBody": false,
5473
- "rawBody": "application/octet-stream",
5474
- "workspace": true,
5475
- "scope": "runs:write"
5476
- },
5477
5582
  {
5478
5583
  "operationId": "files.get",
5479
5584
  "method": "get",
@@ -5495,20 +5600,24 @@ var OPERATIONS = [
5495
5600
  "idempotentHint": true
5496
5601
  }
5497
5602
  },
5498
- "description": "A file's name, type, size and the run that took or wrote it, with a download link valid for an hour. A run's files are readable by whoever can see the run; an upload not yet used, by whoever uploaded it.",
5603
+ "description": "Returns a file's name, media type and size, the run that took or saved it, and a download link that works for an hour. Anyone who can see a run can read its files. Until a run uses an upload, only the person who uploaded it, a workspace owner or admin, or a workspace API key can read it.",
5499
5604
  "fields": [
5500
5605
  {
5501
5606
  "name": "fileId",
5502
5607
  "in": "path",
5503
5608
  "type": "string",
5504
5609
  "required": true,
5610
+ "description": "The file's ID.",
5611
+ "example": "file_4c1e\u2026",
5505
5612
  "schema": {
5506
- "type": "string"
5613
+ "type": "string",
5614
+ "description": "The file's ID."
5507
5615
  }
5508
5616
  }
5509
5617
  ],
5510
5618
  "hasBody": false,
5511
5619
  "workspace": true,
5620
+ "acceptsApiKey": true,
5512
5621
  "scope": "runs:read"
5513
5622
  },
5514
5623
  {
@@ -5530,7 +5639,7 @@ var OPERATIONS = [
5530
5639
  "idempotentHint": true
5531
5640
  }
5532
5641
  },
5533
- "description": "Files runs wrote, newest first, across the scripts you can see \u2014 until they expire. `?script=<slug>` narrows to one script, `?direction=in` lists the files runs were given (`all` for both), and `?q=` matches names. Each comes with a download link valid for an hour. Paginate with the opaque `nextCursor` token.",
5642
+ "description": "Lists the files that runs saved, newest first, across the scripts you can see. A file stays in the list until it expires. Pass `?script=<slug>` for one script's files. Pass `?origin=input` for the files runs took as inputs, or `?origin=all` for both. Pass `?q=` to match file names. Each file comes with a download link that works for an hour. Paginate with the opaque `nextCursor` token.",
5534
5643
  "fields": [
5535
5644
  {
5536
5645
  "name": "limit",
@@ -5563,27 +5672,27 @@ var OPERATIONS = [
5563
5672
  "in": "query",
5564
5673
  "type": "string",
5565
5674
  "required": false,
5566
- "description": "Only files from this script's runs (its slug).",
5675
+ "description": "Only files from this script's runs, by its slug.",
5567
5676
  "example": "monthly-report",
5568
5677
  "schema": {
5569
5678
  "type": "string",
5570
- "description": "Only files from this script's runs (its slug)."
5679
+ "description": "Only files from this script's runs, by its slug."
5571
5680
  }
5572
5681
  },
5573
5682
  {
5574
- "name": "direction",
5683
+ "name": "origin",
5575
5684
  "in": "query",
5576
5685
  "type": "string",
5577
5686
  "required": false,
5578
- "description": "`out` (default): written by runs; `in`: given to them.",
5687
+ "description": "Which files to list: `saved` for files runs saved (the default), `input` for files runs took as inputs, or `all` for both.",
5579
5688
  "schema": {
5580
5689
  "type": "string",
5581
5690
  "enum": [
5582
- "in",
5583
- "out",
5691
+ "input",
5692
+ "saved",
5584
5693
  "all"
5585
5694
  ],
5586
- "description": "`out` (default): written by runs; `in`: given to them."
5695
+ "description": "Which files to list: `saved` for files runs saved (the default), `input` for files runs took as inputs, or `all` for both."
5587
5696
  }
5588
5697
  },
5589
5698
  {
@@ -5591,19 +5700,58 @@ var OPERATIONS = [
5591
5700
  "in": "query",
5592
5701
  "type": "string",
5593
5702
  "required": false,
5594
- "description": "Only files whose name contains this.",
5703
+ "description": "Only files whose name contains this text.",
5595
5704
  "example": "revenue",
5596
5705
  "schema": {
5597
5706
  "type": "string",
5598
5707
  "maxLength": 200,
5599
- "description": "Only files whose name contains this."
5708
+ "description": "Only files whose name contains this text."
5600
5709
  }
5601
5710
  }
5602
5711
  ],
5603
5712
  "hasBody": false,
5604
5713
  "workspace": true,
5714
+ "acceptsApiKey": true,
5605
5715
  "scope": "runs:read"
5606
5716
  },
5717
+ {
5718
+ "operationId": "files.upload",
5719
+ "method": "post",
5720
+ "path": "/files",
5721
+ "summary": "Upload a file",
5722
+ "cli": {
5723
+ "command": "files upload",
5724
+ "args": [],
5725
+ "confirm": false,
5726
+ "sample": "reminix files upload ./adjustments.csv"
5727
+ },
5728
+ "mcp": {
5729
+ "exposed": false,
5730
+ "reason": "Takes raw bytes, which an agent's tool call can't carry; agents pass an https link as the file input instead."
5731
+ },
5732
+ "description": 'Uploads a file that a run can take as a file input. Send the file\'s bytes as the request body, with `Content-Type` and `Content-Length` headers, and its name as `?name=`. Then pass the returned id as the file input\'s value (`{ "adjustments": "file_4c1e\u2026" }`). You can give each upload to only one run. If no run uses an upload within a day, Reminix deletes it. Your plan sets the largest file you can upload. Reminix refuses a file over 1,000 MB on every plan.',
5733
+ "fields": [
5734
+ {
5735
+ "name": "name",
5736
+ "in": "query",
5737
+ "type": "string",
5738
+ "required": true,
5739
+ "description": "The file's name.",
5740
+ "example": "adjustments.csv",
5741
+ "schema": {
5742
+ "type": "string",
5743
+ "minLength": 1,
5744
+ "maxLength": 500,
5745
+ "description": "The file's name."
5746
+ }
5747
+ }
5748
+ ],
5749
+ "hasBody": false,
5750
+ "rawBody": "application/octet-stream",
5751
+ "workspace": true,
5752
+ "acceptsApiKey": true,
5753
+ "scope": "runs:write"
5754
+ },
5607
5755
  {
5608
5756
  "operationId": "runs.cancel",
5609
5757
  "method": "post",
@@ -5625,20 +5773,24 @@ var OPERATIONS = [
5625
5773
  "idempotentHint": false
5626
5774
  }
5627
5775
  },
5628
- "description": "Stops a LONG run that is still running: its code stops and the run ends `cancelled`. For the person who started it, the script's owner, or an owner or admin.",
5776
+ "description": "Cancels a long run that is still running. The run's code stops, the run ends `cancelled`, and Reminix sends a `run.cancelled` event. The person who started the run, the script owner, a workspace owner or admin, or a workspace API key can cancel it.",
5629
5777
  "fields": [
5630
5778
  {
5631
5779
  "name": "runId",
5632
5780
  "in": "path",
5633
5781
  "type": "string",
5634
5782
  "required": true,
5783
+ "description": "The run's ID.",
5784
+ "example": "run_7b1a\u2026",
5635
5785
  "schema": {
5636
- "type": "string"
5786
+ "type": "string",
5787
+ "description": "The run's ID."
5637
5788
  }
5638
5789
  }
5639
5790
  ],
5640
5791
  "hasBody": false,
5641
5792
  "workspace": true,
5793
+ "acceptsApiKey": true,
5642
5794
  "scope": "runs:write"
5643
5795
  },
5644
5796
  {
@@ -5663,16 +5815,18 @@ var OPERATIONS = [
5663
5815
  "idempotentHint": false
5664
5816
  }
5665
5817
  },
5666
- "description": "Runs the script's PUBLISHED version with these inputs and answers when it finishes, with its output (or error). The inputs are checked against the version's input schema first \u2014 a mismatch is a 400 with one `details` entry per field. A file input takes a file id (upload it with files.create first, or pass another run's output) or an https link Reminix fetches. The script runs in its own container, reaching only the hosts its version declares, for at most 30 seconds \u2014 a script whose `timeout` is longer runs durably and answers 202 at once. Every run counts toward the workspace's `runs` usage.",
5818
+ "description": "Runs the script's published version with these inputs, and returns the run when it finishes, with its output or error. Reminix first checks the inputs against the version's input schema. If they don't match, the request returns 400 with one `details` entry per field. For a file input, pass a file id or an https link that Reminix fetches. The id can be a file you uploaded with files.upload, or a file another run saved. The script runs on its own fresh machine and can reach only the hosts its version declares. A run can last up to its version's `timeoutSeconds`, at most 30, counted from when its code starts. Getting a machine can take up to 2 minutes first. If the run is still in progress after 60 seconds, the request returns 202 with status `running`, and you follow the run with runs.get. If the version's `timeoutSeconds` is over 30, the run is a long run. A long run runs durably, and the request returns 202 at once. Every run counts toward the workspace's `runs` usage.",
5667
5819
  "fields": [
5668
5820
  {
5669
5821
  "name": "slug",
5670
5822
  "in": "path",
5671
5823
  "type": "string",
5672
5824
  "required": true,
5825
+ "description": "The slug's ID.",
5673
5826
  "example": "unlock-account",
5674
5827
  "schema": {
5675
- "type": "string"
5828
+ "type": "string",
5829
+ "description": "The slug's ID."
5676
5830
  }
5677
5831
  },
5678
5832
  {
@@ -5680,7 +5834,7 @@ var OPERATIONS = [
5680
5834
  "in": "body",
5681
5835
  "type": "json",
5682
5836
  "required": false,
5683
- "description": "The script's inputs, by name. Default: none.",
5837
+ "description": "The script's inputs, by name. The default is no inputs.",
5684
5838
  "example": {
5685
5839
  "email": "jane@example.com"
5686
5840
  },
@@ -5688,7 +5842,7 @@ var OPERATIONS = [
5688
5842
  "type": "object",
5689
5843
  "additionalProperties": {},
5690
5844
  "default": {},
5691
- "description": "The script's inputs, by name. Default: none."
5845
+ "description": "The script's inputs, by name. The default is no inputs."
5692
5846
  }
5693
5847
  },
5694
5848
  {
@@ -5696,19 +5850,20 @@ var OPERATIONS = [
5696
5850
  "in": "body",
5697
5851
  "type": "string",
5698
5852
  "required": false,
5699
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp.",
5853
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says.",
5700
5854
  "schema": {
5701
5855
  "type": "string",
5702
5856
  "enum": [
5703
5857
  "api",
5704
5858
  "cli"
5705
5859
  ],
5706
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp."
5860
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says."
5707
5861
  }
5708
5862
  }
5709
5863
  ],
5710
5864
  "hasBody": true,
5711
5865
  "workspace": true,
5866
+ "acceptsApiKey": true,
5712
5867
  "scope": "runs:write"
5713
5868
  },
5714
5869
  {
@@ -5732,20 +5887,24 @@ var OPERATIONS = [
5732
5887
  "idempotentHint": true
5733
5888
  }
5734
5889
  },
5735
- "description": "One run: its inputs, status, output or error, who started it and how, and its files \u2014 given to it and written by it \u2014 with download links.",
5890
+ "description": "Returns one run, with its inputs, status, output or error, and who started it and how. The response also has the run's files, both given and saved, each with a download link.",
5736
5891
  "fields": [
5737
5892
  {
5738
5893
  "name": "runId",
5739
5894
  "in": "path",
5740
5895
  "type": "string",
5741
5896
  "required": true,
5897
+ "description": "The run's ID.",
5898
+ "example": "run_7b1a\u2026",
5742
5899
  "schema": {
5743
- "type": "string"
5900
+ "type": "string",
5901
+ "description": "The run's ID."
5744
5902
  }
5745
5903
  }
5746
5904
  ],
5747
5905
  "hasBody": false,
5748
5906
  "workspace": true,
5907
+ "acceptsApiKey": true,
5749
5908
  "scope": "runs:read"
5750
5909
  },
5751
5910
  {
@@ -5767,7 +5926,7 @@ var OPERATIONS = [
5767
5926
  "idempotentHint": true
5768
5927
  }
5769
5928
  },
5770
- "description": "The workspace's runs, newest first \u2014 of one script with `?script=<slug>`. Paginate with the opaque `nextCursor` token.",
5929
+ "description": "Lists the workspace's runs, newest first. Pass `?script=<slug>` for one script's runs. Paginate with the opaque `nextCursor` token.",
5771
5930
  "fields": [
5772
5931
  {
5773
5932
  "name": "limit",
@@ -5800,25 +5959,26 @@ var OPERATIONS = [
5800
5959
  "in": "query",
5801
5960
  "type": "string",
5802
5961
  "required": false,
5803
- "description": "Only this script's runs (its slug).",
5962
+ "description": "Only this script's runs, by its slug.",
5804
5963
  "example": "unlock-account",
5805
5964
  "schema": {
5806
5965
  "type": "string",
5807
- "description": "Only this script's runs (its slug)."
5966
+ "description": "Only this script's runs, by its slug."
5808
5967
  }
5809
5968
  }
5810
5969
  ],
5811
5970
  "hasBody": false,
5812
5971
  "workspace": true,
5972
+ "acceptsApiKey": true,
5813
5973
  "scope": "runs:read"
5814
5974
  },
5815
5975
  {
5816
- "operationId": "runs.logs",
5976
+ "operationId": "runs.log",
5817
5977
  "method": "get",
5818
- "path": "/runs/{runId}/logs",
5978
+ "path": "/runs/{runId}/log",
5819
5979
  "summary": "Get a run's log",
5820
5980
  "cli": {
5821
- "command": "runs logs",
5981
+ "command": "runs log",
5822
5982
  "args": [
5823
5983
  "runId"
5824
5984
  ],
@@ -5826,27 +5986,31 @@ var OPERATIONS = [
5826
5986
  },
5827
5987
  "mcp": {
5828
5988
  "exposed": true,
5829
- "name": "runs_logs",
5989
+ "name": "runs_log",
5830
5990
  "hints": {
5831
5991
  "readOnlyHint": true,
5832
5992
  "destructiveHint": false,
5833
5993
  "idempotentHint": true
5834
5994
  }
5835
5995
  },
5836
- "description": "What the script wrote to standard error, line by line, with a line per request it made.",
5996
+ "description": "Returns the run's log: what the script wrote to standard error, line by line. The log also has a line for each request the script made.",
5837
5997
  "fields": [
5838
5998
  {
5839
5999
  "name": "runId",
5840
6000
  "in": "path",
5841
6001
  "type": "string",
5842
6002
  "required": true,
6003
+ "description": "The run's ID.",
6004
+ "example": "run_7b1a\u2026",
5843
6005
  "schema": {
5844
- "type": "string"
6006
+ "type": "string",
6007
+ "description": "The run's ID."
5845
6008
  }
5846
6009
  }
5847
6010
  ],
5848
6011
  "hasBody": false,
5849
6012
  "workspace": true,
6013
+ "acceptsApiKey": true,
5850
6014
  "scope": "runs:read"
5851
6015
  },
5852
6016
  {
@@ -5863,18 +6027,20 @@ var OPERATIONS = [
5863
6027
  },
5864
6028
  "mcp": {
5865
6029
  "exposed": false,
5866
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
6030
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
5867
6031
  },
5868
- "description": "Runs the published version on a 5-field cron in a timezone, with these inputs, as you \u2014 at least 5 minutes apart. Switched off (with why) if you can no longer run it.",
6032
+ "description": "Schedules the script's published version to run on a cron in a timezone, with these inputs. The runs act as you. The cron has 5 fields, and its runs must be at least 5 minutes apart. If every run of the script, or every run in the environment, needs approval, only workspace owners and admins can create a schedule. If you can no longer run the script, Reminix disables the schedule and sets `disabledReason`.",
5869
6033
  "fields": [
5870
6034
  {
5871
6035
  "name": "slug",
5872
6036
  "in": "path",
5873
6037
  "type": "string",
5874
6038
  "required": true,
6039
+ "description": "The slug's ID.",
5875
6040
  "example": "monthly-report",
5876
6041
  "schema": {
5877
- "type": "string"
6042
+ "type": "string",
6043
+ "description": "The slug's ID."
5878
6044
  }
5879
6045
  },
5880
6046
  {
@@ -5910,11 +6076,11 @@ var OPERATIONS = [
5910
6076
  "in": "body",
5911
6077
  "type": "string",
5912
6078
  "required": false,
5913
- "description": "The timezone the cron is read in. Default: UTC.",
6079
+ "description": "The timezone the cron is read in. The default is UTC.",
5914
6080
  "example": "Europe/Berlin",
5915
6081
  "schema": {
5916
6082
  "type": "string",
5917
- "description": "The timezone the cron is read in. Default: UTC."
6083
+ "description": "The timezone the cron is read in. The default is UTC."
5918
6084
  }
5919
6085
  },
5920
6086
  {
@@ -5934,15 +6100,16 @@ var OPERATIONS = [
5934
6100
  "in": "body",
5935
6101
  "type": "string",
5936
6102
  "required": false,
5937
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default.",
6103
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment.",
5938
6104
  "schema": {
5939
6105
  "type": "string",
5940
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default."
6106
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment."
5941
6107
  }
5942
6108
  }
5943
6109
  ],
5944
6110
  "hasBody": true,
5945
6111
  "workspace": true,
6112
+ "acceptsApiKey": false,
5946
6113
  "scope": "scripts:write"
5947
6114
  },
5948
6115
  {
@@ -5960,18 +6127,20 @@ var OPERATIONS = [
5960
6127
  },
5961
6128
  "mcp": {
5962
6129
  "exposed": false,
5963
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
6130
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
5964
6131
  },
5965
- "description": "Its creator, or an owner or admin.",
6132
+ "description": "Deletes a schedule. The schedule's creator, a workspace owner or admin, or a workspace API key can delete it.",
5966
6133
  "fields": [
5967
6134
  {
5968
6135
  "name": "slug",
5969
6136
  "in": "path",
5970
6137
  "type": "string",
5971
6138
  "required": true,
6139
+ "description": "The slug's ID.",
5972
6140
  "example": "monthly-report",
5973
6141
  "schema": {
5974
- "type": "string"
6142
+ "type": "string",
6143
+ "description": "The slug's ID."
5975
6144
  }
5976
6145
  },
5977
6146
  {
@@ -5979,13 +6148,17 @@ var OPERATIONS = [
5979
6148
  "in": "path",
5980
6149
  "type": "string",
5981
6150
  "required": true,
6151
+ "description": "The schedule's ID.",
6152
+ "example": "sch_2b9f\u2026",
5982
6153
  "schema": {
5983
- "type": "string"
6154
+ "type": "string",
6155
+ "description": "The schedule's ID."
5984
6156
  }
5985
6157
  }
5986
6158
  ],
5987
6159
  "hasBody": false,
5988
6160
  "workspace": true,
6161
+ "acceptsApiKey": true,
5989
6162
  "scope": "scripts:write"
5990
6163
  },
5991
6164
  {
@@ -6009,21 +6182,24 @@ var OPERATIONS = [
6009
6182
  "idempotentHint": true
6010
6183
  }
6011
6184
  },
6012
- "description": "Its schedules, with when each runs next.",
6185
+ "description": "Lists a script's schedules, with when each one runs next.",
6013
6186
  "fields": [
6014
6187
  {
6015
6188
  "name": "slug",
6016
6189
  "in": "path",
6017
6190
  "type": "string",
6018
6191
  "required": true,
6192
+ "description": "The slug's ID.",
6019
6193
  "example": "monthly-report",
6020
6194
  "schema": {
6021
- "type": "string"
6195
+ "type": "string",
6196
+ "description": "The slug's ID."
6022
6197
  }
6023
6198
  }
6024
6199
  ],
6025
6200
  "hasBody": false,
6026
6201
  "workspace": true,
6202
+ "acceptsApiKey": true,
6027
6203
  "scope": "scripts:read"
6028
6204
  },
6029
6205
  {
@@ -6041,18 +6217,20 @@ var OPERATIONS = [
6041
6217
  },
6042
6218
  "mcp": {
6043
6219
  "exposed": false,
6044
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
6220
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
6045
6221
  },
6046
- "description": "Its name, cron, timezone, inputs, or switch it on or off. Its creator, or an owner or admin.",
6222
+ "description": "Changes a schedule's name, cron, timezone, inputs or environment, or whether it's enabled. The schedule's creator, a workspace owner or admin, or a workspace API key can change it.",
6047
6223
  "fields": [
6048
6224
  {
6049
6225
  "name": "slug",
6050
6226
  "in": "path",
6051
6227
  "type": "string",
6052
6228
  "required": true,
6229
+ "description": "The slug's ID.",
6053
6230
  "example": "monthly-report",
6054
6231
  "schema": {
6055
- "type": "string"
6232
+ "type": "string",
6233
+ "description": "The slug's ID."
6056
6234
  }
6057
6235
  },
6058
6236
  {
@@ -6060,8 +6238,11 @@ var OPERATIONS = [
6060
6238
  "in": "path",
6061
6239
  "type": "string",
6062
6240
  "required": true,
6241
+ "description": "The schedule's ID.",
6242
+ "example": "sch_2b9f\u2026",
6063
6243
  "schema": {
6064
- "type": "string"
6244
+ "type": "string",
6245
+ "description": "The schedule's ID."
6065
6246
  }
6066
6247
  },
6067
6248
  {
@@ -6096,11 +6277,11 @@ var OPERATIONS = [
6096
6277
  "in": "body",
6097
6278
  "type": "string",
6098
6279
  "required": false,
6099
- "description": "The timezone the cron is read in. Default: UTC.",
6280
+ "description": "The timezone the cron is read in. The default is UTC.",
6100
6281
  "example": "Europe/Berlin",
6101
6282
  "schema": {
6102
6283
  "type": "string",
6103
- "description": "The timezone the cron is read in. Default: UTC."
6284
+ "description": "The timezone the cron is read in. The default is UTC."
6104
6285
  }
6105
6286
  },
6106
6287
  {
@@ -6120,10 +6301,10 @@ var OPERATIONS = [
6120
6301
  "in": "body",
6121
6302
  "type": "boolean",
6122
6303
  "required": false,
6123
- "description": "Whether it runs. Default: true.",
6304
+ "description": "Whether the schedule runs. With `false`, it's disabled.",
6124
6305
  "schema": {
6125
6306
  "type": "boolean",
6126
- "description": "Whether it runs. Default: true."
6307
+ "description": "Whether the schedule runs. With `false`, it's disabled."
6127
6308
  }
6128
6309
  },
6129
6310
  {
@@ -6131,15 +6312,16 @@ var OPERATIONS = [
6131
6312
  "in": "body",
6132
6313
  "type": "string",
6133
6314
  "required": false,
6134
- "description": "Move its runs to another environment.",
6315
+ "description": "Another environment for the schedule's runs to use.",
6135
6316
  "schema": {
6136
6317
  "type": "string",
6137
- "description": "Move its runs to another environment."
6318
+ "description": "Another environment for the schedule's runs to use."
6138
6319
  }
6139
6320
  }
6140
6321
  ],
6141
6322
  "hasBody": true,
6142
6323
  "workspace": true,
6324
+ "acceptsApiKey": true,
6143
6325
  "scope": "scripts:write"
6144
6326
  },
6145
6327
  {
@@ -6156,23 +6338,26 @@ var OPERATIONS = [
6156
6338
  },
6157
6339
  "mcp": {
6158
6340
  "exposed": false,
6159
- "reason": "Stopping a script the team relies on is a person's decision; an agent asks one to"
6341
+ "reason": "Stopping a script the team relies on is a person's decision. An agent asks a person to."
6160
6342
  },
6161
- "description": "Stops it: it leaves the scripts list, can't be run, and its schedules and triggers skip it. Its runs, versions and files stay on record \u2014 scripts are archived, never deleted. Refused while a run of it is going or waiting for approval. The script's owner, or a workspace owner or admin.",
6343
+ "description": "Archives a script, which stops it. An archived script leaves the scripts list, nobody can run it, and its schedules and triggers skip it. Reminix never deletes a script, so its runs and versions stay. You can't archive a script while one of its runs is in progress or waiting for approval. The script owner, a workspace owner or admin, or a workspace API key can archive a script.",
6162
6344
  "fields": [
6163
6345
  {
6164
6346
  "name": "slug",
6165
6347
  "in": "path",
6166
6348
  "type": "string",
6167
6349
  "required": true,
6350
+ "description": "The slug's ID.",
6168
6351
  "example": "unlock-account",
6169
6352
  "schema": {
6170
- "type": "string"
6353
+ "type": "string",
6354
+ "description": "The slug's ID."
6171
6355
  }
6172
6356
  }
6173
6357
  ],
6174
6358
  "hasBody": false,
6175
6359
  "workspace": true,
6360
+ "acceptsApiKey": true,
6176
6361
  "scope": "scripts:write"
6177
6362
  },
6178
6363
  {
@@ -6194,18 +6379,18 @@ var OPERATIONS = [
6194
6379
  "idempotentHint": false
6195
6380
  }
6196
6381
  },
6197
- "description": "Creates an empty script \u2014 upload a version, then publish it. The `slug` names it everywhere (the API path, the agent tool, the command line) and is unique in the workspace.",
6382
+ "description": "Creates an empty script. Upload a version next, then publish it. The `slug` names the script everywhere: in the API path, in the agent's tool name and in the CLI. Each slug is unique in the workspace.",
6198
6383
  "fields": [
6199
6384
  {
6200
6385
  "name": "slug",
6201
6386
  "in": "body",
6202
6387
  "type": "string",
6203
6388
  "required": true,
6204
- "description": "Its id in URLs and commands: lowercase letters, digits and dashes, unique in the workspace.",
6389
+ "description": "The script's id in URLs and commands. It's 2 to 64 lowercase letters, digits and dashes, starts with a letter, and is unique in the workspace.",
6205
6390
  "example": "unlock-account",
6206
6391
  "schema": {
6207
6392
  "type": "string",
6208
- "description": "Its id in URLs and commands: lowercase letters, digits and dashes, unique in the workspace."
6393
+ "description": "The script's id in URLs and commands. It's 2 to 64 lowercase letters, digits and dashes, starts with a letter, and is unique in the workspace."
6209
6394
  }
6210
6395
  },
6211
6396
  {
@@ -6213,13 +6398,13 @@ var OPERATIONS = [
6213
6398
  "in": "body",
6214
6399
  "type": "string",
6215
6400
  "required": true,
6216
- "description": "What people see in the app.",
6401
+ "description": "The name people see in the app.",
6217
6402
  "example": "Unlock an account",
6218
6403
  "schema": {
6219
6404
  "type": "string",
6220
6405
  "minLength": 1,
6221
6406
  "maxLength": 100,
6222
- "description": "What people see in the app."
6407
+ "description": "The name people see in the app."
6223
6408
  }
6224
6409
  },
6225
6410
  {
@@ -6227,16 +6412,18 @@ var OPERATIONS = [
6227
6412
  "in": "body",
6228
6413
  "type": "string",
6229
6414
  "required": false,
6230
- "description": "What it does, in a sentence or two.",
6415
+ "description": "What the script does, in a sentence or two.",
6416
+ "example": "Unlocks a customer's account after too many failed sign-ins.",
6231
6417
  "schema": {
6232
6418
  "type": "string",
6233
6419
  "maxLength": 1e3,
6234
- "description": "What it does, in a sentence or two."
6420
+ "description": "What the script does, in a sentence or two."
6235
6421
  }
6236
6422
  }
6237
6423
  ],
6238
6424
  "hasBody": true,
6239
6425
  "workspace": true,
6426
+ "acceptsApiKey": true,
6240
6427
  "scope": "scripts:write"
6241
6428
  },
6242
6429
  {
@@ -6260,21 +6447,24 @@ var OPERATIONS = [
6260
6447
  "idempotentHint": true
6261
6448
  }
6262
6449
  },
6263
- "description": "One script by its slug: its name, owner, status, published version, README, and who uses it \u2014 people, schedules, triggers and the scripts that follow it.",
6450
+ "description": "Returns one script by its slug, with its name, owner, status, published version and README. The response also lists what uses the script: the people who run it, its schedules and triggers, and the scripts its runs start.",
6264
6451
  "fields": [
6265
6452
  {
6266
6453
  "name": "slug",
6267
6454
  "in": "path",
6268
6455
  "type": "string",
6269
6456
  "required": true,
6457
+ "description": "The slug's ID.",
6270
6458
  "example": "unlock-account",
6271
6459
  "schema": {
6272
- "type": "string"
6460
+ "type": "string",
6461
+ "description": "The slug's ID."
6273
6462
  }
6274
6463
  }
6275
6464
  ],
6276
6465
  "hasBody": false,
6277
6466
  "workspace": true,
6467
+ "acceptsApiKey": true,
6278
6468
  "scope": "scripts:read"
6279
6469
  },
6280
6470
  {
@@ -6296,7 +6486,7 @@ var OPERATIONS = [
6296
6486
  "idempotentHint": true
6297
6487
  }
6298
6488
  },
6299
- "description": "The workspace's scripts you may see, newest first, with the version each runs, tags and 30-day stats. Search with `q` (best match first) and filter by `tag`, `owner` or `published` \u2014 look here before writing a new one. Paginate with the opaque `nextCursor` token.",
6489
+ "description": "Lists the workspace's scripts that you can see, newest first, with the version each one runs, its tags and its 30-day stats. Search with `q` to get the best match first. Filter with `tag`, `owner` or `published`. Check here for an existing script before writing a new one. Paginate with the opaque `nextCursor` token.",
6300
6490
  "fields": [
6301
6491
  {
6302
6492
  "name": "limit",
@@ -6329,11 +6519,11 @@ var OPERATIONS = [
6329
6519
  "in": "query",
6330
6520
  "type": "string",
6331
6521
  "required": false,
6332
- "description": "Search the name, slug, description and tags \u2014 each word matches the start of a word. Results are best match first, one page (no cursor).",
6522
+ "description": "Words to search for in the name, slug, description and tags. Each word matches the start of a word. Results come best match first, on one page with no cursor.",
6333
6523
  "schema": {
6334
6524
  "type": "string",
6335
6525
  "maxLength": 200,
6336
- "description": "Search the name, slug, description and tags \u2014 each word matches the start of a word. Results are best match first, one page (no cursor)."
6526
+ "description": "Words to search for in the name, slug, description and tags. Each word matches the start of a word. Results come best match first, on one page with no cursor."
6337
6527
  }
6338
6528
  },
6339
6529
  {
@@ -6353,10 +6543,10 @@ var OPERATIONS = [
6353
6543
  "in": "query",
6354
6544
  "type": "string",
6355
6545
  "required": false,
6356
- "description": "An owner's user id.",
6546
+ "description": "Only scripts this person owns, by their user id.",
6357
6547
  "schema": {
6358
6548
  "type": "string",
6359
- "description": "An owner's user id."
6549
+ "description": "Only scripts this person owns, by their user id."
6360
6550
  }
6361
6551
  },
6362
6552
  {
@@ -6364,14 +6554,14 @@ var OPERATIONS = [
6364
6554
  "in": "query",
6365
6555
  "type": "string",
6366
6556
  "required": false,
6367
- "description": "`true`: only scripts with a published version.",
6557
+ "description": "With `true`, only scripts that have a published version.",
6368
6558
  "schema": {
6369
6559
  "type": "string",
6370
6560
  "enum": [
6371
6561
  "true",
6372
6562
  "false"
6373
6563
  ],
6374
- "description": "`true`: only scripts with a published version."
6564
+ "description": "With `true`, only scripts that have a published version."
6375
6565
  }
6376
6566
  },
6377
6567
  {
@@ -6379,19 +6569,20 @@ var OPERATIONS = [
6379
6569
  "in": "query",
6380
6570
  "type": "string",
6381
6571
  "required": false,
6382
- "description": "`true`: the archived scripts instead (they are left out otherwise).",
6572
+ "description": "With `true`, only archived scripts. The list leaves them out otherwise.",
6383
6573
  "schema": {
6384
6574
  "type": "string",
6385
6575
  "enum": [
6386
6576
  "true",
6387
6577
  "false"
6388
6578
  ],
6389
- "description": "`true`: the archived scripts instead (they are left out otherwise)."
6579
+ "description": "With `true`, only archived scripts. The list leaves them out otherwise."
6390
6580
  }
6391
6581
  }
6392
6582
  ],
6393
6583
  "hasBody": false,
6394
6584
  "workspace": true,
6585
+ "acceptsApiKey": true,
6395
6586
  "scope": "scripts:read"
6396
6587
  },
6397
6588
  {
@@ -6408,23 +6599,26 @@ var OPERATIONS = [
6408
6599
  },
6409
6600
  "mcp": {
6410
6601
  "exposed": false,
6411
- "reason": "Stopping a script the team relies on is a person's decision; an agent asks one to"
6602
+ "reason": "Stopping a script the team relies on is a person's decision. An agent asks a person to."
6412
6603
  },
6413
- "description": "Brings an archived script back: listed and runnable again, its schedules and triggers resumed. The script's owner, or a workspace owner or admin.",
6604
+ "description": "Restores an archived script. The script comes back to the scripts list, people can run it again, and its schedules and triggers resume. The script owner, a workspace owner or admin, or a workspace API key can restore a script.",
6414
6605
  "fields": [
6415
6606
  {
6416
6607
  "name": "slug",
6417
6608
  "in": "path",
6418
6609
  "type": "string",
6419
6610
  "required": true,
6611
+ "description": "The slug's ID.",
6420
6612
  "example": "unlock-account",
6421
6613
  "schema": {
6422
- "type": "string"
6614
+ "type": "string",
6615
+ "description": "The slug's ID."
6423
6616
  }
6424
6617
  }
6425
6618
  ],
6426
6619
  "hasBody": false,
6427
6620
  "workspace": true,
6621
+ "acceptsApiKey": true,
6428
6622
  "scope": "scripts:write"
6429
6623
  },
6430
6624
  {
@@ -6448,16 +6642,18 @@ var OPERATIONS = [
6448
6642
  "idempotentHint": false
6449
6643
  }
6450
6644
  },
6451
- "description": "Changes its name or description, who may see and run it (access, teams), and which runs need a person's approval. The script's owner, or a workspace owner or admin.",
6645
+ "description": "Changes a script's name, description or tags, who can see and run it, and which runs need a person's approval. The script owner, a workspace owner or admin, or a workspace API key can change a script. An agent can't change `access`, `teamIds` or `approvalPolicy`.",
6452
6646
  "fields": [
6453
6647
  {
6454
6648
  "name": "slug",
6455
6649
  "in": "path",
6456
6650
  "type": "string",
6457
6651
  "required": true,
6652
+ "description": "The slug's ID.",
6458
6653
  "example": "unlock-account",
6459
6654
  "schema": {
6460
- "type": "string"
6655
+ "type": "string",
6656
+ "description": "The slug's ID."
6461
6657
  }
6462
6658
  },
6463
6659
  {
@@ -6465,12 +6661,12 @@ var OPERATIONS = [
6465
6661
  "in": "body",
6466
6662
  "type": "string",
6467
6663
  "required": false,
6468
- "description": "What people see in the app.",
6664
+ "description": "The name people see in the app.",
6469
6665
  "schema": {
6470
6666
  "type": "string",
6471
6667
  "minLength": 1,
6472
6668
  "maxLength": 100,
6473
- "description": "What people see in the app."
6669
+ "description": "The name people see in the app."
6474
6670
  }
6475
6671
  },
6476
6672
  {
@@ -6478,11 +6674,11 @@ var OPERATIONS = [
6478
6674
  "in": "body",
6479
6675
  "type": "string",
6480
6676
  "required": false,
6481
- "description": "What it does, in a sentence or two.",
6677
+ "description": "What the script does, in a sentence or two.",
6482
6678
  "schema": {
6483
6679
  "type": "string",
6484
6680
  "maxLength": 1e3,
6485
- "description": "What it does, in a sentence or two."
6681
+ "description": "What the script does, in a sentence or two."
6486
6682
  }
6487
6683
  },
6488
6684
  {
@@ -6490,14 +6686,14 @@ var OPERATIONS = [
6490
6686
  "in": "body",
6491
6687
  "type": "string",
6492
6688
  "required": false,
6493
- "description": "`workspace`: every member may see and run it. `teams`: only members of `teamIds` (and owners and admins).",
6689
+ "description": "Who can see and run the script. With `workspace`, every member can. With `teams`, only members of `teamIds` and workspace owners and admins can.",
6494
6690
  "schema": {
6495
6691
  "type": "string",
6496
6692
  "enum": [
6497
6693
  "workspace",
6498
6694
  "teams"
6499
6695
  ],
6500
- "description": "`workspace`: every member may see and run it. `teams`: only members of `teamIds` (and owners and admins)."
6696
+ "description": "Who can see and run the script. With `workspace`, every member can. With `teams`, only members of `teamIds` and workspace owners and admins can."
6501
6697
  }
6502
6698
  },
6503
6699
  {
@@ -6505,14 +6701,14 @@ var OPERATIONS = [
6505
6701
  "in": "body",
6506
6702
  "type": "json",
6507
6703
  "required": false,
6508
- "description": "With `access: teams`: the teams whose members may see and run it.",
6704
+ "description": "With `access: teams`, the teams whose members can see and run the script.",
6509
6705
  "schema": {
6510
6706
  "type": "array",
6511
6707
  "items": {
6512
6708
  "type": "string"
6513
6709
  },
6514
6710
  "maxItems": 50,
6515
- "description": "With `access: teams`: the teams whose members may see and run it."
6711
+ "description": "With `access: teams`, the teams whose members can see and run the script."
6516
6712
  }
6517
6713
  },
6518
6714
  {
@@ -6520,7 +6716,7 @@ var OPERATIONS = [
6520
6716
  "in": "body",
6521
6717
  "type": "json",
6522
6718
  "required": false,
6523
- "description": "Up to 10; lowercase letters, digits and dashes.",
6719
+ "description": "Up to 10 tags, each 1 to 30 lowercase letters, digits and dashes.",
6524
6720
  "example": [
6525
6721
  "support",
6526
6722
  "accounts"
@@ -6531,7 +6727,7 @@ var OPERATIONS = [
6531
6727
  "type": "string"
6532
6728
  },
6533
6729
  "maxItems": 10,
6534
- "description": "Up to 10; lowercase letters, digits and dashes."
6730
+ "description": "Up to 10 tags, each 1 to 30 lowercase letters, digits and dashes."
6535
6731
  }
6536
6732
  },
6537
6733
  {
@@ -6539,7 +6735,7 @@ var OPERATIONS = [
6539
6735
  "in": "body",
6540
6736
  "type": "string",
6541
6737
  "required": false,
6542
- "description": "Which runs wait for a person's approval: `none`, `agents` (runs started through an agent's token) or `always`.",
6738
+ "description": "Which runs wait for a person's approval: `none`, `agents` for runs started with an agent's token, or `always` for every run. A token issued for the MCP server can't change this field, `access` or `teamIds`.",
6543
6739
  "schema": {
6544
6740
  "type": "string",
6545
6741
  "enum": [
@@ -6547,12 +6743,13 @@ var OPERATIONS = [
6547
6743
  "agents",
6548
6744
  "always"
6549
6745
  ],
6550
- "description": "Which runs wait for a person's approval: `none`, `agents` (runs started through an agent's token) or `always`."
6746
+ "description": "Which runs wait for a person's approval: `none`, `agents` for runs started with an agent's token, or `always` for every run. A token issued for the MCP server can't change this field, `access` or `teamIds`."
6551
6747
  }
6552
6748
  }
6553
6749
  ],
6554
6750
  "hasBody": true,
6555
6751
  "workspace": true,
6752
+ "acceptsApiKey": true,
6556
6753
  "scope": "scripts:write"
6557
6754
  },
6558
6755
  {
@@ -6574,10 +6771,11 @@ var OPERATIONS = [
6574
6771
  "idempotentHint": true
6575
6772
  }
6576
6773
  },
6577
- "description": "How the workspace governs scripts \u2014 e.g. whether publishing needs a second person.",
6774
+ "description": "Returns how the workspace governs scripts, such as whether publishing needs a second person.",
6578
6775
  "fields": [],
6579
6776
  "hasBody": false,
6580
6777
  "workspace": true,
6778
+ "acceptsApiKey": true,
6581
6779
  "scope": "scripts:read"
6582
6780
  },
6583
6781
  {
@@ -6594,124 +6792,310 @@ var OPERATIONS = [
6594
6792
  "exposed": false,
6595
6793
  "reason": "Governance settings are a person's to change; an agent must not loosen them"
6596
6794
  },
6597
- "description": "Workspace owners and admins, or a workspace API key.",
6795
+ "description": "Changes how the workspace governs scripts. Workspace owners and admins can change these settings, and so can a workspace API key. Turning on second-person publishing needs the Business plan.",
6598
6796
  "fields": [
6599
6797
  {
6600
6798
  "name": "publishNeedsSecondPerson",
6601
6799
  "in": "body",
6602
6800
  "type": "boolean",
6603
6801
  "required": false,
6604
- "description": "Publishing needs a person other than the one who asks: a publish becomes a request an owner or admin approves.",
6802
+ "description": "Whether publishing needs a second person. When it's on, each publish becomes a request. Another owner or admin, not the person who asked, approves it.",
6803
+ "example": false,
6605
6804
  "schema": {
6606
6805
  "type": "boolean",
6607
- "description": "Publishing needs a person other than the one who asks: a publish becomes a request an owner or admin approves."
6806
+ "description": "Whether publishing needs a second person. When it's on, each publish becomes a request. Another owner or admin, not the person who asked, approves it."
6608
6807
  }
6609
6808
  }
6610
6809
  ],
6611
6810
  "hasBody": true,
6612
6811
  "workspace": true,
6812
+ "acceptsApiKey": true,
6613
6813
  "scope": "scripts:write"
6614
6814
  },
6615
6815
  {
6616
- "operationId": "scriptVersions.create",
6617
- "method": "post",
6816
+ "operationId": "scriptVersions.list",
6817
+ "method": "get",
6618
6818
  "path": "/scripts/{slug}/versions",
6619
- "summary": "Upload a version",
6819
+ "summary": "List a script's versions",
6620
6820
  "cli": {
6621
- "command": "script-versions create",
6821
+ "command": "script-versions list",
6622
6822
  "args": [
6623
6823
  "slug"
6624
6824
  ],
6625
- "confirm": false,
6626
- "shortcut": "publish --draft [dir...]"
6825
+ "confirm": false
6627
6826
  },
6628
6827
  "mcp": {
6629
6828
  "exposed": true,
6630
- "name": "script_versions_create",
6829
+ "name": "script_versions_list",
6631
6830
  "hints": {
6632
- "readOnlyHint": false,
6831
+ "readOnlyHint": true,
6633
6832
  "destructiveHint": false,
6634
- "idempotentHint": false
6833
+ "idempotentHint": true
6635
6834
  }
6636
6835
  },
6637
- "description": "Uploads a new DRAFT version: the script's folder (a .tar.gz, base64 \u2014 the CLI makes it), the command that runs it and the JSON Schema of its inputs. Leave the command out and it is worked out from the folder: pyproject.toml's one script, package.json's bin, start or main, or the folder's one .py, .js, .ts or .sh file; leave the schema out and each `{name}` in the command is a text input. Its dependencies (requirements.txt, pyproject.toml, package.json) are installed now, once; a failed install answers 400 with what it printed. Runs keep using the published version until this one is published.",
6836
+ "description": "Lists every version of a script, newest first, and marks the published one.",
6638
6837
  "fields": [
6639
6838
  {
6640
6839
  "name": "slug",
6641
6840
  "in": "path",
6642
6841
  "type": "string",
6643
6842
  "required": true,
6843
+ "description": "The slug's ID.",
6644
6844
  "example": "unlock-account",
6645
6845
  "schema": {
6646
- "type": "string"
6846
+ "type": "string",
6847
+ "description": "The slug's ID."
6647
6848
  }
6648
- },
6849
+ }
6850
+ ],
6851
+ "hasBody": false,
6852
+ "workspace": true,
6853
+ "acceptsApiKey": true,
6854
+ "scope": "scripts:read"
6855
+ },
6856
+ {
6857
+ "operationId": "scriptVersions.publish",
6858
+ "method": "post",
6859
+ "path": "/scripts/{slug}/versions/{version}/publish",
6860
+ "summary": "Publish a version",
6861
+ "cli": {
6862
+ "command": "script-versions publish",
6863
+ "args": [
6864
+ "slug",
6865
+ "version"
6866
+ ],
6867
+ "confirm": false
6868
+ },
6869
+ "mcp": {
6870
+ "exposed": true,
6871
+ "name": "script_versions_publish",
6872
+ "hints": {
6873
+ "readOnlyHint": false,
6874
+ "destructiveHint": false,
6875
+ "idempotentHint": false
6876
+ }
6877
+ },
6878
+ "description": "Makes a version the one every run of the script uses, however the run starts. Publishing an older version again rolls the script back. The script owner or a workspace owner or admin can publish. An agent's publish becomes a request that a person approves, and the call returns 202. If the workspace requires a second person to publish, everyone's publish becomes a request like this.",
6879
+ "fields": [
6649
6880
  {
6650
- "name": "command",
6651
- "in": "body",
6881
+ "name": "slug",
6882
+ "in": "path",
6652
6883
  "type": "string",
6653
- "required": false,
6654
- "description": "What a run executes. `{name}` is an input; `[ \u2026 ]` is left out when its inputs are empty. Run as arguments, never through a shell. Omitted: worked out from the folder, or a 400 saying what to add.",
6655
- "example": "python unlock.py {email}",
6884
+ "required": true,
6885
+ "description": "The slug's ID.",
6886
+ "example": "unlock-account",
6656
6887
  "schema": {
6657
6888
  "type": "string",
6658
- "minLength": 1,
6659
- "maxLength": 2e3,
6660
- "description": "What a run executes. `{name}` is an input; `[ \u2026 ]` is left out when its inputs are empty. Run as arguments, never through a shell. Omitted: worked out from the folder, or a 400 saying what to add."
6889
+ "description": "The slug's ID."
6661
6890
  }
6662
6891
  },
6663
6892
  {
6664
- "name": "build",
6665
- "in": "body",
6893
+ "name": "version",
6894
+ "in": "path",
6895
+ "type": "number",
6896
+ "required": true,
6897
+ "description": "The version's ID.",
6898
+ "example": 3,
6899
+ "schema": {
6900
+ "type": "integer",
6901
+ "minimum": 1,
6902
+ "description": "The version's ID."
6903
+ }
6904
+ }
6905
+ ],
6906
+ "hasBody": false,
6907
+ "workspace": true,
6908
+ "acceptsApiKey": false,
6909
+ "scope": "scripts:write"
6910
+ },
6911
+ {
6912
+ "operationId": "scriptVersions.testRun",
6913
+ "method": "post",
6914
+ "path": "/scripts/{slug}/versions/{version}/runs",
6915
+ "summary": "Test-run a version",
6916
+ "cli": {
6917
+ "command": "script-versions test-run",
6918
+ "args": [
6919
+ "slug",
6920
+ "version"
6921
+ ],
6922
+ "confirm": false
6923
+ },
6924
+ "mcp": {
6925
+ "exposed": true,
6926
+ "name": "script_versions_test_run",
6927
+ "hints": {
6928
+ "readOnlyHint": false,
6929
+ "destructiveHint": false,
6930
+ "idempotentHint": false
6931
+ }
6932
+ },
6933
+ "description": "Test-runs one version of a script with these inputs, such as a draft before it's published. Reminix records a test run with `test: true` and leaves it out of the script's stats. A test run sends no run events, so no webhooks or triggers fire. The version's uploader, the script owner, a workspace owner or admin, or a workspace API key can test-run a version. The script's approval policy still applies. Use a test run to prove a draft works before asking a person to publish it.",
6934
+ "fields": [
6935
+ {
6936
+ "name": "slug",
6937
+ "in": "path",
6666
6938
  "type": "string",
6667
- "required": false,
6668
- "description": "Replaces the usual install (requirements.txt, else pyproject.toml, into .deps; package.json with npm). Runs in the folder with the package registries reachable.",
6669
- "example": "pip install -r requirements.txt",
6939
+ "required": true,
6940
+ "description": "The slug's ID.",
6941
+ "example": "unlock-account",
6670
6942
  "schema": {
6671
- "type": [
6672
- "string",
6673
- "null"
6674
- ],
6675
- "maxLength": 2e3,
6676
- "description": "Replaces the usual install (requirements.txt, else pyproject.toml, into .deps; package.json with npm). Runs in the folder with the package registries reachable."
6943
+ "type": "string",
6944
+ "description": "The slug's ID."
6677
6945
  }
6678
6946
  },
6679
6947
  {
6680
- "name": "inputSchema",
6681
- "in": "body",
6682
- "type": "json",
6683
- "required": false,
6684
- "description": "The inputs, as JSON Schema. Omitted: a required text input for each `{name}` in the command (optional inside `[ \u2026 ]`).",
6948
+ "name": "version",
6949
+ "in": "path",
6950
+ "type": "number",
6951
+ "required": true,
6952
+ "description": "The version's ID.",
6953
+ "example": 3,
6685
6954
  "schema": {
6686
- "type": "object",
6687
- "additionalProperties": {},
6688
- "description": "The inputs, as JSON Schema. Omitted: a required text input for each `{name}` in the command (optional inside `[ \u2026 ]`)."
6955
+ "type": "integer",
6956
+ "minimum": 1,
6957
+ "description": "The version's ID."
6689
6958
  }
6690
6959
  },
6691
6960
  {
6692
- "name": "outputSchema",
6961
+ "name": "inputs",
6693
6962
  "in": "body",
6694
6963
  "type": "json",
6695
6964
  "required": false,
6696
- "description": "A JSON Schema document.",
6965
+ "description": "The script's inputs, by name. The default is no inputs.",
6966
+ "example": {
6967
+ "email": "jane@example.com"
6968
+ },
6697
6969
  "schema": {
6698
- "type": [
6699
- "object",
6700
- "null"
6701
- ],
6970
+ "type": "object",
6702
6971
  "additionalProperties": {},
6703
- "description": "A JSON Schema document."
6972
+ "default": {},
6973
+ "description": "The script's inputs, by name. The default is no inputs."
6704
6974
  }
6705
6975
  },
6706
6976
  {
6707
- "name": "archive",
6977
+ "name": "via",
6708
6978
  "in": "body",
6709
6979
  "type": "string",
6710
- "required": true,
6711
- "description": "The script's folder as a .tar.gz, base64 \u2014 at most 10 MB, without its dependencies.",
6980
+ "required": false,
6981
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says.",
6712
6982
  "schema": {
6713
6983
  "type": "string",
6714
- "description": "The script's folder as a .tar.gz, base64 \u2014 at most 10 MB, without its dependencies."
6984
+ "enum": [
6985
+ "api",
6986
+ "cli"
6987
+ ],
6988
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says."
6989
+ }
6990
+ }
6991
+ ],
6992
+ "hasBody": true,
6993
+ "workspace": true,
6994
+ "acceptsApiKey": true,
6995
+ "scope": "runs:write"
6996
+ },
6997
+ {
6998
+ "operationId": "scriptVersions.upload",
6999
+ "method": "post",
7000
+ "path": "/scripts/{slug}/versions",
7001
+ "summary": "Upload a version",
7002
+ "cli": {
7003
+ "command": "script-versions upload",
7004
+ "args": [
7005
+ "slug"
7006
+ ],
7007
+ "confirm": false,
7008
+ "shortcut": "upload [dir...]"
7009
+ },
7010
+ "mcp": {
7011
+ "exposed": true,
7012
+ "name": "script_versions_upload",
7013
+ "hints": {
7014
+ "readOnlyHint": false,
7015
+ "destructiveHint": false,
7016
+ "idempotentHint": false
7017
+ }
7018
+ },
7019
+ "description": "Uploads a new draft version of a script. Send the version's source, the command that runs it and the JSON Schema of its inputs. The source is the script's folder as a .tar.gz file in base64, and the CLI makes it for you. If you leave out the command, Reminix works it out from the folder: the one script in pyproject.toml, the `bin`, `start` or `main` in package.json, or the folder's one .py, .js, .ts or .sh file. If you leave out the input schema, each `{name}` in the command becomes a text input. If you leave out the README, Reminix uses the folder's README.md. Reminix installs the dependencies from requirements.txt, pyproject.toml or package.json once, during the upload. If the install fails, the request returns 400 with what the install printed. Runs keep using the published version until you publish this one. To upload and publish in one call, pass `publish: true`, and add `create: true` for a new script.",
7020
+ "fields": [
7021
+ {
7022
+ "name": "slug",
7023
+ "in": "path",
7024
+ "type": "string",
7025
+ "required": true,
7026
+ "description": "The slug's ID.",
7027
+ "example": "unlock-account",
7028
+ "schema": {
7029
+ "type": "string",
7030
+ "description": "The slug's ID."
7031
+ }
7032
+ },
7033
+ {
7034
+ "name": "command",
7035
+ "in": "body",
7036
+ "type": "string",
7037
+ "required": false,
7038
+ "description": "The command a run executes. Each `{name}` in it is an input, and Reminix drops a part inside `[ \u2026 ]` when its inputs are empty. Reminix runs the command as arguments, never through a shell. If you leave it out, Reminix works it out from the folder, or returns 400 saying what to add.",
7039
+ "example": "python unlock.py {email}",
7040
+ "schema": {
7041
+ "type": "string",
7042
+ "minLength": 1,
7043
+ "maxLength": 2e3,
7044
+ "description": "The command a run executes. Each `{name}` in it is an input, and Reminix drops a part inside `[ \u2026 ]` when its inputs are empty. Reminix runs the command as arguments, never through a shell. If you leave it out, Reminix works it out from the folder, or returns 400 saying what to add."
7045
+ }
7046
+ },
7047
+ {
7048
+ "name": "install",
7049
+ "in": "body",
7050
+ "type": "string",
7051
+ "required": false,
7052
+ "description": "A command that replaces the usual install. The usual install puts Python packages from requirements.txt, or else pyproject.toml, into .deps, and installs package.json with npm. Your command runs in the folder, and it can reach the package registries.",
7053
+ "schema": {
7054
+ "type": [
7055
+ "string",
7056
+ "null"
7057
+ ],
7058
+ "maxLength": 2e3,
7059
+ "description": "A command that replaces the usual install. The usual install puts Python packages from requirements.txt, or else pyproject.toml, into .deps, and installs package.json with npm. Your command runs in the folder, and it can reach the package registries."
7060
+ }
7061
+ },
7062
+ {
7063
+ "name": "inputSchema",
7064
+ "in": "body",
7065
+ "type": "json",
7066
+ "required": false,
7067
+ "description": "The inputs, as JSON Schema. If you leave it out, each `{name}` in the command becomes a required text input, or an optional one inside `[ \u2026 ]`.",
7068
+ "schema": {
7069
+ "type": "object",
7070
+ "additionalProperties": {},
7071
+ "description": "The inputs, as JSON Schema. If you leave it out, each `{name}` in the command becomes a required text input, or an optional one inside `[ \u2026 ]`."
7072
+ }
7073
+ },
7074
+ {
7075
+ "name": "outputSchema",
7076
+ "in": "body",
7077
+ "type": "json",
7078
+ "required": false,
7079
+ "description": "What the script returns on standard output, as JSON Schema.",
7080
+ "schema": {
7081
+ "type": [
7082
+ "object",
7083
+ "null"
7084
+ ],
7085
+ "additionalProperties": {},
7086
+ "description": "What the script returns on standard output, as JSON Schema."
7087
+ }
7088
+ },
7089
+ {
7090
+ "name": "source",
7091
+ "in": "body",
7092
+ "type": "string",
7093
+ "required": true,
7094
+ "description": "The script's folder as a .tar.gz file in base64, at most 10 MB. Leave out its dependencies, because Reminix installs them during the upload.",
7095
+ "example": "H4sIAAAAAAAAA\u2026",
7096
+ "schema": {
7097
+ "type": "string",
7098
+ "description": "The script's folder as a .tar.gz file in base64, at most 10 MB. Leave out its dependencies, because Reminix installs them during the upload."
6715
7099
  }
6716
7100
  },
6717
7101
  {
@@ -6719,7 +7103,7 @@ var OPERATIONS = [
6719
7103
  "in": "body",
6720
7104
  "type": "json",
6721
7105
  "required": false,
6722
- "description": "The only hosts the script may reach (HTTPS). Omitted: no network.",
7106
+ "description": "The only hosts the script can reach, over HTTPS. If you leave it out, the script has no network access.",
6723
7107
  "example": [
6724
7108
  "api.yourapp.com"
6725
7109
  ],
@@ -6728,7 +7112,7 @@ var OPERATIONS = [
6728
7112
  "items": {
6729
7113
  "type": "string"
6730
7114
  },
6731
- "description": "The only hosts the script may reach (HTTPS). Omitted: no network."
7115
+ "description": "The only hosts the script can reach, over HTTPS. If you leave it out, the script has no network access."
6732
7116
  }
6733
7117
  },
6734
7118
  {
@@ -6736,7 +7120,14 @@ var OPERATIONS = [
6736
7120
  "in": "body",
6737
7121
  "type": "json",
6738
7122
  "required": false,
6739
- "description": "Secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of them.",
7123
+ "description": "The secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of those hosts.",
7124
+ "example": {
7125
+ "ADMIN_KEY": {
7126
+ "host": "api.yourapp.com",
7127
+ "header": "Authorization",
7128
+ "format": "Bearer {secret}"
7129
+ }
7130
+ },
6740
7131
  "schema": {
6741
7132
  "type": "object",
6742
7133
  "additionalProperties": {
@@ -6747,7 +7138,7 @@ var OPERATIONS = [
6747
7138
  "items": {
6748
7139
  "type": "string"
6749
7140
  },
6750
- "description": "Some of the version's hosts. A run attaches the secret to those its environment's value may go to."
7141
+ "description": "Which of the version's hosts get the secret. A run attaches it only to those that the secret's value in the run's environment allows."
6751
7142
  },
6752
7143
  "host": {
6753
7144
  "type": "string",
@@ -6756,44 +7147,44 @@ var OPERATIONS = [
6756
7147
  "header": {
6757
7148
  "type": "string"
6758
7149
  },
6759
- "value": {
7150
+ "format": {
6760
7151
  "type": "string",
6761
- "description": "The header's value; `{secret}` is replaced. Default: `{secret}`."
7152
+ "description": "The header's value, with `{secret}` where the secret goes. Default: `{secret}`."
6762
7153
  }
6763
7154
  },
6764
7155
  "required": [
6765
7156
  "header"
6766
7157
  ]
6767
7158
  },
6768
- "description": "Secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of them."
7159
+ "description": "The secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of those hosts."
6769
7160
  }
6770
7161
  },
6771
7162
  {
6772
- "name": "env",
7163
+ "name": "envVars",
6773
7164
  "in": "body",
6774
7165
  "type": "json",
6775
7166
  "required": false,
6776
- "description": "Secrets the script reads as environment variables (only those whose owner allowed it).",
7167
+ "description": "Secrets the script reads as environment variables. Each secret must allow this with `allowEnvVar`.",
6777
7168
  "schema": {
6778
7169
  "type": "array",
6779
7170
  "items": {
6780
7171
  "type": "string"
6781
7172
  },
6782
- "description": "Secrets the script reads as environment variables (only those whose owner allowed it)."
7173
+ "description": "Secrets the script reads as environment variables. Each secret must allow this with `allowEnvVar`."
6783
7174
  }
6784
7175
  },
6785
7176
  {
6786
- "name": "timeout",
7177
+ "name": "timeoutSeconds",
6787
7178
  "in": "body",
6788
7179
  "type": "number",
6789
7180
  "required": false,
6790
- "description": "Seconds a run may take (default 30). Over 30 makes a LONG script: runs answer 202 at once and run durably, with live logs and progress, and can be cancelled.",
6791
- "example": 600,
7181
+ "description": "How long a run can take, in seconds. The default is 30. With more than 30, the script's runs are long runs. A long run returns 202 at once. It shows a live log and progress, and you can cancel it. Long runs need the Pro plan or above.",
7182
+ "example": 30,
6792
7183
  "schema": {
6793
7184
  "type": "integer",
6794
7185
  "minimum": 1,
6795
7186
  "maximum": 900,
6796
- "description": "Seconds a run may take (default 30). Over 30 makes a LONG script: runs answer 202 at once and run durably, with live logs and progress, and can be cancelled."
7187
+ "description": "How long a run can take, in seconds. The default is 30. With more than 30, the script's runs are long runs. A long run returns 202 at once. It shows a live log and progress, and you can cancel it. Long runs need the Pro plan or above."
6797
7188
  }
6798
7189
  },
6799
7190
  {
@@ -6801,14 +7192,14 @@ var OPERATIONS = [
6801
7192
  "in": "body",
6802
7193
  "type": "string",
6803
7194
  "required": false,
6804
- "description": "README.md (markdown), shown on the script's page while this version is published.",
7195
+ "description": "The README, in Markdown. The script's page shows it while this version is the published one.",
6805
7196
  "schema": {
6806
7197
  "type": [
6807
7198
  "string",
6808
7199
  "null"
6809
7200
  ],
6810
7201
  "maxLength": 1e5,
6811
- "description": "README.md (markdown), shown on the script's page while this version is published."
7202
+ "description": "The README, in Markdown. The script's page shows it while this version is the published one."
6812
7203
  }
6813
7204
  },
6814
7205
  {
@@ -6816,7 +7207,7 @@ var OPERATIONS = [
6816
7207
  "in": "body",
6817
7208
  "type": "json",
6818
7209
  "required": false,
6819
- "description": "When given, become the script's tags.",
7210
+ "description": "If given, these become the script's tags.",
6820
7211
  "example": [
6821
7212
  "support",
6822
7213
  "accounts"
@@ -6827,7 +7218,7 @@ var OPERATIONS = [
6827
7218
  "type": "string"
6828
7219
  },
6829
7220
  "maxItems": 10,
6830
- "description": "When given, become the script's tags."
7221
+ "description": "If given, these become the script's tags."
6831
7222
  }
6832
7223
  },
6833
7224
  {
@@ -6835,7 +7226,7 @@ var OPERATIONS = [
6835
7226
  "in": "body",
6836
7227
  "type": "string",
6837
7228
  "required": false,
6838
- "description": "How it was uploaded (for the history). Default: api.",
7229
+ "description": "Where the upload came from, kept in the history. The default is `api`.",
6839
7230
  "schema": {
6840
7231
  "type": "string",
6841
7232
  "enum": [
@@ -6843,182 +7234,62 @@ var OPERATIONS = [
6843
7234
  "api",
6844
7235
  "app"
6845
7236
  ],
6846
- "description": "How it was uploaded (for the history). Default: api."
6847
- }
6848
- }
6849
- ],
6850
- "hasBody": true,
6851
- "workspace": true,
6852
- "scope": "scripts:write"
6853
- },
6854
- {
6855
- "operationId": "scriptVersions.list",
6856
- "method": "get",
6857
- "path": "/scripts/{slug}/versions",
6858
- "summary": "List a script's versions",
6859
- "cli": {
6860
- "command": "script-versions list",
6861
- "args": [
6862
- "slug"
6863
- ],
6864
- "confirm": false
6865
- },
6866
- "mcp": {
6867
- "exposed": true,
6868
- "name": "script_versions_list",
6869
- "hints": {
6870
- "readOnlyHint": true,
6871
- "destructiveHint": false,
6872
- "idempotentHint": true
6873
- }
6874
- },
6875
- "description": "Every version, newest first, and which one is published.",
6876
- "fields": [
6877
- {
6878
- "name": "slug",
6879
- "in": "path",
6880
- "type": "string",
6881
- "required": true,
6882
- "example": "unlock-account",
6883
- "schema": {
6884
- "type": "string"
6885
- }
6886
- }
6887
- ],
6888
- "hasBody": false,
6889
- "workspace": true,
6890
- "scope": "scripts:read"
6891
- },
6892
- {
6893
- "operationId": "scriptVersions.publish",
6894
- "method": "post",
6895
- "path": "/scripts/{slug}/versions/{number}/publish",
6896
- "summary": "Publish a version",
6897
- "cli": {
6898
- "command": "script-versions publish",
6899
- "args": [
6900
- "slug",
6901
- "number"
6902
- ],
6903
- "confirm": false
6904
- },
6905
- "mcp": {
6906
- "exposed": true,
6907
- "name": "script_versions_publish",
6908
- "hints": {
6909
- "readOnlyHint": false,
6910
- "destructiveHint": false,
6911
- "idempotentHint": false
6912
- }
6913
- },
6914
- "description": "Makes this version the one every run uses \u2014 from the app, the API, agents and schedules. Publishing an older version again rolls back. The script's owner, or a workspace owner or admin. An agent's publish (and anyone's, when the workspace requires a second person) becomes a request a person approves \u2014 answered 202.",
6915
- "fields": [
6916
- {
6917
- "name": "slug",
6918
- "in": "path",
6919
- "type": "string",
6920
- "required": true,
6921
- "example": "unlock-account",
6922
- "schema": {
6923
- "type": "string"
7237
+ "description": "Where the upload came from, kept in the history. The default is `api`."
6924
7238
  }
6925
7239
  },
6926
7240
  {
6927
- "name": "number",
6928
- "in": "path",
6929
- "type": "number",
6930
- "required": true,
6931
- "example": 3,
6932
- "schema": {
6933
- "type": "integer",
6934
- "minimum": 1
6935
- }
6936
- }
6937
- ],
6938
- "hasBody": false,
6939
- "workspace": true,
6940
- "scope": "scripts:write"
6941
- },
6942
- {
6943
- "operationId": "scriptVersions.run",
6944
- "method": "post",
6945
- "path": "/scripts/{slug}/versions/{number}/runs",
6946
- "summary": "Test-run a version",
6947
- "cli": {
6948
- "command": "script-versions run",
6949
- "args": [
6950
- "slug",
6951
- "number"
6952
- ],
6953
- "confirm": false
6954
- },
6955
- "mcp": {
6956
- "exposed": true,
6957
- "name": "script_versions_run",
6958
- "hints": {
6959
- "readOnlyHint": false,
6960
- "destructiveHint": false,
6961
- "idempotentHint": false
6962
- }
6963
- },
6964
- "description": "Runs one VERSION \u2014 a draft before publishing \u2014 with these inputs, as a test run: recorded with `test: true`, not counted as the script's use, and without run events (no webhooks, no triggers). For the version's uploader, the script's owner, or an owner or admin; the script's approval policy still applies. Prove a draft works before asking a person to publish it.",
6965
- "fields": [
6966
- {
6967
- "name": "slug",
6968
- "in": "path",
6969
- "type": "string",
6970
- "required": true,
6971
- "example": "unlock-account",
7241
+ "name": "create",
7242
+ "in": "body",
7243
+ "type": "boolean",
7244
+ "required": false,
7245
+ "description": "With `true`, creates the script if no script has this slug. The new script's name comes from `name` if you send one. Otherwise it comes from pyproject.toml or package.json, or else from the slug. By default an unknown slug returns 404 instead, which keeps a typo from creating a script.",
6972
7246
  "schema": {
6973
- "type": "string"
7247
+ "type": "boolean",
7248
+ "description": "With `true`, creates the script if no script has this slug. The new script's name comes from `name` if you send one. Otherwise it comes from pyproject.toml or package.json, or else from the slug. By default an unknown slug returns 404 instead, which keeps a typo from creating a script."
6974
7249
  }
6975
7250
  },
6976
7251
  {
6977
- "name": "number",
6978
- "in": "path",
6979
- "type": "number",
6980
- "required": true,
6981
- "example": 2,
7252
+ "name": "name",
7253
+ "in": "body",
7254
+ "type": "string",
7255
+ "required": false,
7256
+ "description": "If given, this becomes the script's name. It applies to every upload that sends it.",
7257
+ "example": "Unlock an account",
6982
7258
  "schema": {
6983
- "type": "integer",
6984
- "minimum": 1
7259
+ "type": "string",
7260
+ "minLength": 1,
7261
+ "maxLength": 100,
7262
+ "description": "If given, this becomes the script's name. It applies to every upload that sends it."
6985
7263
  }
6986
7264
  },
6987
7265
  {
6988
- "name": "inputs",
7266
+ "name": "description",
6989
7267
  "in": "body",
6990
- "type": "json",
7268
+ "type": "string",
6991
7269
  "required": false,
6992
- "description": "The script's inputs, by name. Default: none.",
6993
- "example": {
6994
- "email": "jane@example.com"
6995
- },
7270
+ "description": "If given, this becomes the script's description, in the same way as `name`.",
6996
7271
  "schema": {
6997
- "type": "object",
6998
- "additionalProperties": {},
6999
- "default": {},
7000
- "description": "The script's inputs, by name. Default: none."
7272
+ "type": "string",
7273
+ "maxLength": 500,
7274
+ "description": "If given, this becomes the script's description, in the same way as `name`."
7001
7275
  }
7002
7276
  },
7003
7277
  {
7004
- "name": "via",
7278
+ "name": "publish",
7005
7279
  "in": "body",
7006
- "type": "string",
7280
+ "type": "boolean",
7007
7281
  "required": false,
7008
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp.",
7282
+ "description": "With `true`, also publishes this version in the same call, exactly as Publish a version does. If publishing needs a person's approval, the response carries `approval`, and Reminix publishes the version once a person approves it.",
7009
7283
  "schema": {
7010
- "type": "string",
7011
- "enum": [
7012
- "api",
7013
- "cli"
7014
- ],
7015
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp."
7284
+ "type": "boolean",
7285
+ "description": "With `true`, also publishes this version in the same call, exactly as Publish a version does. If publishing needs a person's approval, the response carries `approval`, and Reminix publishes the version once a person approves it."
7016
7286
  }
7017
7287
  }
7018
7288
  ],
7019
7289
  "hasBody": true,
7020
7290
  "workspace": true,
7021
- "scope": "runs:write"
7291
+ "acceptsApiKey": false,
7292
+ "scope": "scripts:write"
7022
7293
  },
7023
7294
  {
7024
7295
  "operationId": "secrets.delete",
@@ -7036,21 +7307,24 @@ var OPERATIONS = [
7036
7307
  "exposed": false,
7037
7308
  "reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
7038
7309
  },
7039
- "description": "Deletes it and its value in every environment; runs of scripts that use it fail until it is saved again. Workspace owners and admins, or a workspace API key.",
7310
+ "description": "Deletes a secret and its value in every environment. Runs of scripts that use it fail until someone saves it again. Workspace owners, admins and API keys can delete a secret.",
7040
7311
  "fields": [
7041
7312
  {
7042
7313
  "name": "name",
7043
7314
  "in": "path",
7044
7315
  "type": "string",
7045
7316
  "required": true,
7317
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
7046
7318
  "example": "ADMIN_KEY",
7047
7319
  "schema": {
7048
- "type": "string"
7320
+ "type": "string",
7321
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
7049
7322
  }
7050
7323
  }
7051
7324
  ],
7052
7325
  "hasBody": false,
7053
7326
  "workspace": true,
7327
+ "acceptsApiKey": true,
7054
7328
  "scope": "secrets:write"
7055
7329
  },
7056
7330
  {
@@ -7072,10 +7346,11 @@ var OPERATIONS = [
7072
7346
  "idempotentHint": true
7073
7347
  }
7074
7348
  },
7075
- "description": "The workspace's secrets by name, with the environments that have a value and the hosts each value may be sent to \u2014 never the values.",
7349
+ "description": "Lists the workspace's secrets by name, with the environments that have a value and the hosts each value may go to. The list never includes the values themselves.",
7076
7350
  "fields": [],
7077
7351
  "hasBody": false,
7078
7352
  "workspace": true,
7353
+ "acceptsApiKey": true,
7079
7354
  "scope": "secrets:read"
7080
7355
  },
7081
7356
  {
@@ -7088,22 +7363,25 @@ var OPERATIONS = [
7088
7363
  "args": [
7089
7364
  "name"
7090
7365
  ],
7091
- "confirm": false
7366
+ "confirm": false,
7367
+ "sample": 'printf %s "$ADMIN_KEY" | \\\n reminix secrets set ADMIN_KEY \\\n --hosts api.yourapp.com'
7092
7368
  },
7093
7369
  "mcp": {
7094
7370
  "exposed": false,
7095
7371
  "reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
7096
7372
  },
7097
- "description": "Saves the secret's value in the request's environment: creates it, or replaces the value and its hosts (rotation). The value is encrypted and never returned by any call. `hosts` are the ONLY hosts that value is ever sent to \u2014 a script cannot send it anywhere else. Workspace owners and admins, or a workspace API key.",
7373
+ "description": "Saves a secret's value in the request's environment. Saving creates the secret if it's new, or replaces the value and its hosts to rotate it. Reminix encrypts the value, and no call ever returns it. Reminix sends the value only to the hosts in `hosts`. Workspace owners, admins and API keys can save a secret.",
7098
7374
  "fields": [
7099
7375
  {
7100
7376
  "name": "name",
7101
7377
  "in": "path",
7102
7378
  "type": "string",
7103
7379
  "required": true,
7380
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
7104
7381
  "example": "ADMIN_KEY",
7105
7382
  "schema": {
7106
- "type": "string"
7383
+ "type": "string",
7384
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
7107
7385
  }
7108
7386
  },
7109
7387
  {
@@ -7111,10 +7389,11 @@ var OPERATIONS = [
7111
7389
  "in": "body",
7112
7390
  "type": "string",
7113
7391
  "required": true,
7114
- "description": "The secret itself.",
7392
+ "description": "The secret itself, at most 16,384 bytes.",
7393
+ "example": "ak_live_\u2026",
7115
7394
  "schema": {
7116
7395
  "type": "string",
7117
- "description": "The secret itself."
7396
+ "description": "The secret itself, at most 16,384 bytes."
7118
7397
  }
7119
7398
  },
7120
7399
  {
@@ -7122,6 +7401,7 @@ var OPERATIONS = [
7122
7401
  "in": "body",
7123
7402
  "type": "json",
7124
7403
  "required": true,
7404
+ "description": "The only hosts Reminix sends this value to, such as `api.stripe.com`.",
7125
7405
  "example": [
7126
7406
  "api.yourapp.com"
7127
7407
  ],
@@ -7129,32 +7409,34 @@ var OPERATIONS = [
7129
7409
  "type": "array",
7130
7410
  "items": {
7131
7411
  "type": "string"
7132
- }
7412
+ },
7413
+ "description": "The only hosts Reminix sends this value to, such as `api.stripe.com`."
7133
7414
  }
7134
7415
  },
7135
7416
  {
7136
- "name": "allowEnv",
7417
+ "name": "allowEnvVar",
7137
7418
  "in": "body",
7138
7419
  "type": "boolean",
7139
7420
  "required": false,
7140
- "description": "Let scripts read it as a plain value. Default false \u2014 attached to requests only.",
7421
+ "description": "Whether scripts can read the secret as an environment variable. The default is false, so Reminix only attaches it to requests.",
7141
7422
  "schema": {
7142
7423
  "type": "boolean",
7143
- "description": "Let scripts read it as a plain value. Default false \u2014 attached to requests only."
7424
+ "description": "Whether scripts can read the secret as an environment variable. The default is false, so Reminix only attaches it to requests."
7144
7425
  }
7145
7426
  }
7146
7427
  ],
7147
7428
  "hasBody": true,
7148
7429
  "workspace": true,
7430
+ "acceptsApiKey": true,
7149
7431
  "scope": "secrets:write"
7150
7432
  },
7151
7433
  {
7152
- "operationId": "secrets.unset",
7434
+ "operationId": "secretValues.delete",
7153
7435
  "method": "delete",
7154
7436
  "path": "/secrets/{name}/values/{environment}",
7155
7437
  "summary": "Remove a secret's value from an environment",
7156
7438
  "cli": {
7157
- "command": "secrets unset",
7439
+ "command": "secret-values delete",
7158
7440
  "args": [
7159
7441
  "name",
7160
7442
  "environment"
@@ -7165,16 +7447,18 @@ var OPERATIONS = [
7165
7447
  "exposed": false,
7166
7448
  "reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
7167
7449
  },
7168
- "description": "Removes the value in that environment only; the secret and its other values stay. Runs there that use it fail until a value is saved again. Workspace owners and admins, or a workspace API key.",
7450
+ "description": "Removes a secret's value from one environment. The secret and its values in other environments stay. Runs in that environment that use the secret fail until someone saves a value there again. Workspace owners, admins and API keys can remove a value.",
7169
7451
  "fields": [
7170
7452
  {
7171
7453
  "name": "name",
7172
7454
  "in": "path",
7173
7455
  "type": "string",
7174
7456
  "required": true,
7457
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
7175
7458
  "example": "ADMIN_KEY",
7176
7459
  "schema": {
7177
- "type": "string"
7460
+ "type": "string",
7461
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
7178
7462
  }
7179
7463
  },
7180
7464
  {
@@ -7182,14 +7466,17 @@ var OPERATIONS = [
7182
7466
  "in": "path",
7183
7467
  "type": "string",
7184
7468
  "required": true,
7469
+ "description": "The environment's ID.",
7185
7470
  "example": "staging",
7186
7471
  "schema": {
7187
- "type": "string"
7472
+ "type": "string",
7473
+ "description": "The environment's ID."
7188
7474
  }
7189
7475
  }
7190
7476
  ],
7191
7477
  "hasBody": false,
7192
7478
  "workspace": true,
7479
+ "acceptsApiKey": true,
7193
7480
  "scope": "secrets:write"
7194
7481
  },
7195
7482
  {
@@ -7206,18 +7493,20 @@ var OPERATIONS = [
7206
7493
  },
7207
7494
  "mcp": {
7208
7495
  "exposed": false,
7209
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
7496
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
7210
7497
  },
7211
- "description": "Starts a run, as you, when an event of `eventType` happens in the workspace (GET /v1/workspace/event-types lists them) and its data matches `filter` \u2014 within about a minute. A chain of triggered runs stops after 3.",
7498
+ "description": "Starts a run of the script, as you, when an event of `eventType` happens in the workspace and its data matches `filter`. GET /v1/workspace/event-types lists the event types. The run starts within about a minute of the event. A chain of triggered runs stops after 3. If every run of the script, or every run in the environment, needs approval, only workspace owners and admins can create a trigger.",
7212
7499
  "fields": [
7213
7500
  {
7214
7501
  "name": "slug",
7215
7502
  "in": "path",
7216
7503
  "type": "string",
7217
7504
  "required": true,
7505
+ "description": "The slug's ID.",
7218
7506
  "example": "alert-on-failure",
7219
7507
  "schema": {
7220
- "type": "string"
7508
+ "type": "string",
7509
+ "description": "The slug's ID."
7221
7510
  }
7222
7511
  },
7223
7512
  {
@@ -7239,12 +7528,12 @@ var OPERATIONS = [
7239
7528
  "in": "body",
7240
7529
  "type": "string",
7241
7530
  "required": true,
7242
- "description": "The event that starts a run: any webhook event type, such as run.failed.",
7531
+ "description": "The event that starts a run. It can be any webhook event type, such as `run.failed`.",
7243
7532
  "example": "run.failed",
7244
7533
  "schema": {
7245
7534
  "type": "string",
7246
7535
  "minLength": 1,
7247
- "description": "The event that starts a run: any webhook event type, such as run.failed."
7536
+ "description": "The event that starts a run. It can be any webhook event type, such as `run.failed`."
7248
7537
  }
7249
7538
  },
7250
7539
  {
@@ -7252,14 +7541,14 @@ var OPERATIONS = [
7252
7541
  "in": "body",
7253
7542
  "type": "json",
7254
7543
  "required": false,
7255
- "description": "Event data fields (dotted paths) that must equal these values.",
7544
+ "description": "Event data fields, as dotted paths, that must equal these values.",
7256
7545
  "example": {
7257
7546
  "script.slug": "nightly-sync"
7258
7547
  },
7259
7548
  "schema": {
7260
7549
  "type": "object",
7261
7550
  "additionalProperties": {},
7262
- "description": "Event data fields (dotted paths) that must equal these values."
7551
+ "description": "Event data fields, as dotted paths, that must equal these values."
7263
7552
  }
7264
7553
  },
7265
7554
  {
@@ -7267,7 +7556,7 @@ var OPERATIONS = [
7267
7556
  "in": "body",
7268
7557
  "type": "json",
7269
7558
  "required": false,
7270
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`,
7559
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`,
7271
7560
  "example": {
7272
7561
  "runId": "{{event.data.runId}}",
7273
7562
  "error": "{{event.data.error}}"
@@ -7275,7 +7564,7 @@ var OPERATIONS = [
7275
7564
  "schema": {
7276
7565
  "type": "object",
7277
7566
  "additionalProperties": {},
7278
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`
7567
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`
7279
7568
  }
7280
7569
  },
7281
7570
  {
@@ -7283,15 +7572,16 @@ var OPERATIONS = [
7283
7572
  "in": "body",
7284
7573
  "type": "string",
7285
7574
  "required": false,
7286
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default.",
7575
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment.",
7287
7576
  "schema": {
7288
7577
  "type": "string",
7289
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default."
7578
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment."
7290
7579
  }
7291
7580
  }
7292
7581
  ],
7293
7582
  "hasBody": true,
7294
7583
  "workspace": true,
7584
+ "acceptsApiKey": false,
7295
7585
  "scope": "scripts:write"
7296
7586
  },
7297
7587
  {
@@ -7309,18 +7599,20 @@ var OPERATIONS = [
7309
7599
  },
7310
7600
  "mcp": {
7311
7601
  "exposed": false,
7312
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
7602
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
7313
7603
  },
7314
- "description": "Its creator, or an owner or admin.",
7604
+ "description": "Deletes a trigger. The trigger's creator, a workspace owner or admin, or a workspace API key can delete it.",
7315
7605
  "fields": [
7316
7606
  {
7317
7607
  "name": "slug",
7318
7608
  "in": "path",
7319
7609
  "type": "string",
7320
7610
  "required": true,
7611
+ "description": "The slug's ID.",
7321
7612
  "example": "alert-on-failure",
7322
7613
  "schema": {
7323
- "type": "string"
7614
+ "type": "string",
7615
+ "description": "The slug's ID."
7324
7616
  }
7325
7617
  },
7326
7618
  {
@@ -7328,13 +7620,17 @@ var OPERATIONS = [
7328
7620
  "in": "path",
7329
7621
  "type": "string",
7330
7622
  "required": true,
7623
+ "description": "The trigger's ID.",
7624
+ "example": "trg_6e4a\u2026",
7331
7625
  "schema": {
7332
- "type": "string"
7626
+ "type": "string",
7627
+ "description": "The trigger's ID."
7333
7628
  }
7334
7629
  }
7335
7630
  ],
7336
7631
  "hasBody": false,
7337
7632
  "workspace": true,
7633
+ "acceptsApiKey": true,
7338
7634
  "scope": "scripts:write"
7339
7635
  },
7340
7636
  {
@@ -7358,21 +7654,24 @@ var OPERATIONS = [
7358
7654
  "idempotentHint": true
7359
7655
  }
7360
7656
  },
7361
- "description": "The events that start it.",
7657
+ "description": "Lists a script's triggers, which are the events that start it.",
7362
7658
  "fields": [
7363
7659
  {
7364
7660
  "name": "slug",
7365
7661
  "in": "path",
7366
7662
  "type": "string",
7367
7663
  "required": true,
7664
+ "description": "The slug's ID.",
7368
7665
  "example": "alert-on-failure",
7369
7666
  "schema": {
7370
- "type": "string"
7667
+ "type": "string",
7668
+ "description": "The slug's ID."
7371
7669
  }
7372
7670
  }
7373
7671
  ],
7374
7672
  "hasBody": false,
7375
7673
  "workspace": true,
7674
+ "acceptsApiKey": true,
7376
7675
  "scope": "scripts:read"
7377
7676
  },
7378
7677
  {
@@ -7390,18 +7689,20 @@ var OPERATIONS = [
7390
7689
  },
7391
7690
  "mcp": {
7392
7691
  "exposed": false,
7393
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
7692
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
7394
7693
  },
7395
- "description": "Its name, filter, inputs, or switch it on or off. Its creator, or an owner or admin.",
7694
+ "description": "Changes a trigger's name, filter, inputs or environment, or whether it's enabled. The trigger's creator, a workspace owner or admin, or a workspace API key can change it.",
7396
7695
  "fields": [
7397
7696
  {
7398
7697
  "name": "slug",
7399
7698
  "in": "path",
7400
7699
  "type": "string",
7401
7700
  "required": true,
7701
+ "description": "The slug's ID.",
7402
7702
  "example": "alert-on-failure",
7403
7703
  "schema": {
7404
- "type": "string"
7704
+ "type": "string",
7705
+ "description": "The slug's ID."
7405
7706
  }
7406
7707
  },
7407
7708
  {
@@ -7409,8 +7710,11 @@ var OPERATIONS = [
7409
7710
  "in": "path",
7410
7711
  "type": "string",
7411
7712
  "required": true,
7713
+ "description": "The trigger's ID.",
7714
+ "example": "trg_6e4a\u2026",
7412
7715
  "schema": {
7413
- "type": "string"
7716
+ "type": "string",
7717
+ "description": "The trigger's ID."
7414
7718
  }
7415
7719
  },
7416
7720
  {
@@ -7431,14 +7735,14 @@ var OPERATIONS = [
7431
7735
  "in": "body",
7432
7736
  "type": "json",
7433
7737
  "required": false,
7434
- "description": "Event data fields (dotted paths) that must equal these values.",
7738
+ "description": "Event data fields, as dotted paths, that must equal these values.",
7435
7739
  "example": {
7436
7740
  "script.slug": "nightly-sync"
7437
7741
  },
7438
7742
  "schema": {
7439
7743
  "type": "object",
7440
7744
  "additionalProperties": {},
7441
- "description": "Event data fields (dotted paths) that must equal these values."
7745
+ "description": "Event data fields, as dotted paths, that must equal these values."
7442
7746
  }
7443
7747
  },
7444
7748
  {
@@ -7446,7 +7750,7 @@ var OPERATIONS = [
7446
7750
  "in": "body",
7447
7751
  "type": "json",
7448
7752
  "required": false,
7449
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`,
7753
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`,
7450
7754
  "example": {
7451
7755
  "runId": "{{event.data.runId}}",
7452
7756
  "error": "{{event.data.error}}"
@@ -7454,7 +7758,7 @@ var OPERATIONS = [
7454
7758
  "schema": {
7455
7759
  "type": "object",
7456
7760
  "additionalProperties": {},
7457
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`
7761
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`
7458
7762
  }
7459
7763
  },
7460
7764
  {
@@ -7462,10 +7766,10 @@ var OPERATIONS = [
7462
7766
  "in": "body",
7463
7767
  "type": "boolean",
7464
7768
  "required": false,
7465
- "description": "Whether it fires. Default: true.",
7769
+ "description": "Whether the trigger starts runs. With `false`, it's disabled.",
7466
7770
  "schema": {
7467
7771
  "type": "boolean",
7468
- "description": "Whether it fires. Default: true."
7772
+ "description": "Whether the trigger starts runs. With `false`, it's disabled."
7469
7773
  }
7470
7774
  },
7471
7775
  {
@@ -7473,15 +7777,16 @@ var OPERATIONS = [
7473
7777
  "in": "body",
7474
7778
  "type": "string",
7475
7779
  "required": false,
7476
- "description": "Move its runs to another environment.",
7780
+ "description": "Another environment for the trigger's runs to use.",
7477
7781
  "schema": {
7478
7782
  "type": "string",
7479
- "description": "Move its runs to another environment."
7783
+ "description": "Another environment for the trigger's runs to use."
7480
7784
  }
7481
7785
  }
7482
7786
  ],
7483
7787
  "hasBody": true,
7484
7788
  "workspace": true,
7789
+ "acceptsApiKey": true,
7485
7790
  "scope": "scripts:write"
7486
7791
  },
7487
7792
  {
@@ -7496,12 +7801,13 @@ var OPERATIONS = [
7496
7801
  },
7497
7802
  "mcp": {
7498
7803
  "exposed": false,
7499
- "reason": "Personal access tokens only; an agent's connection acts in one workspace (workspace_get)."
7804
+ "reason": "Only a personal access token can call this. An agent's connection acts in one workspace, which workspace_get returns."
7500
7805
  },
7501
- "description": 'Returns the user the personal access token belongs to, with their workspace memberships. Useful as an integration smoke test ("who am I?").',
7806
+ "description": 'Returns the user the personal access token belongs to, and their workspace memberships. Use it as a smoke test for an integration ("who am I?").',
7502
7807
  "fields": [],
7503
7808
  "hasBody": false,
7504
- "workspace": false
7809
+ "workspace": false,
7810
+ "acceptsApiKey": false
7505
7811
  },
7506
7812
  {
7507
7813
  "operationId": "user.revokeToken",
@@ -7515,12 +7821,13 @@ var OPERATIONS = [
7515
7821
  },
7516
7822
  "mcp": {
7517
7823
  "exposed": false,
7518
- "reason": "Revokes a person's own credential; agents connect through OAuth, not personal tokens."
7824
+ "reason": "Revokes a person's own credential. Agents connect through OAuth and never use personal tokens."
7519
7825
  },
7520
- "description": "Revokes the personal access token used to call it \u2014 signing out from a script or the CLI (`logout`). The token stops working immediately; other tokens are untouched.",
7826
+ "description": "Revokes the personal access token that makes the request. Use it to sign out from a script or the CLI (`logout`). The token stops working immediately. Your other tokens keep working.",
7521
7827
  "fields": [],
7522
7828
  "hasBody": false,
7523
- "workspace": false
7829
+ "workspace": false,
7830
+ "acceptsApiKey": false
7524
7831
  },
7525
7832
  {
7526
7833
  "operationId": "workspace.approvalActions.list",
@@ -7541,10 +7848,11 @@ var OPERATIONS = [
7541
7848
  "idempotentHint": true
7542
7849
  }
7543
7850
  },
7544
- "description": "Actions a credential may not take itself but may ASK a person to approve: each one's input (JSON Schema), who can approve it, and whether it creates a secret.",
7851
+ "description": "Lists the actions a credential can't take itself but can ask a person to approve. Each action comes with its input as a JSON Schema, who can approve it and whether it creates a secret.",
7545
7852
  "fields": [],
7546
7853
  "hasBody": false,
7547
7854
  "workspace": true,
7855
+ "acceptsApiKey": true,
7548
7856
  "scope": "workspace.approvals:read"
7549
7857
  },
7550
7858
  {
@@ -7566,7 +7874,7 @@ var OPERATIONS = [
7566
7874
  "idempotentHint": false
7567
7875
  }
7568
7876
  },
7569
- "description": "Files a request for an action you may not take yourself (see approval-actions) and notifies everyone who can approve it. Show the person `approveUrl` and why you need it; then check the request until it is decided (it expires after 24 hours). A personal access token or an app a person connected may ask \u2014 not a workspace API key.",
7877
+ "description": "Creates a request for an action you can't take yourself and notifies everyone who can approve it. The actions you can ask for are in approval-actions. Show the person `approveUrl` and why you need the action. Then check the request until a person decides. A request expires after 24 hours. A personal access token or an app a person connected can ask. A workspace API key can't.",
7570
7878
  "fields": [
7571
7879
  {
7572
7880
  "name": "action",
@@ -7585,7 +7893,7 @@ var OPERATIONS = [
7585
7893
  "in": "body",
7586
7894
  "type": "json",
7587
7895
  "required": true,
7588
- "description": "The action's input, per its JSON Schema.",
7896
+ "description": "The action's input. It must match the action's JSON Schema.",
7589
7897
  "example": {
7590
7898
  "name": "acme-web",
7591
7899
  "scopes": [
@@ -7595,7 +7903,7 @@ var OPERATIONS = [
7595
7903
  "schema": {
7596
7904
  "type": "object",
7597
7905
  "additionalProperties": {},
7598
- "description": "The action's input, per its JSON Schema."
7906
+ "description": "The action's input. It must match the action's JSON Schema."
7599
7907
  }
7600
7908
  },
7601
7909
  {
@@ -7603,17 +7911,19 @@ var OPERATIONS = [
7603
7911
  "in": "body",
7604
7912
  "type": "string",
7605
7913
  "required": true,
7606
- "description": "Why \u2014 the person reads it before deciding.",
7914
+ "description": "Why you need the action. The person reads it before deciding.",
7915
+ "example": "A key for the deploy pipeline.",
7607
7916
  "schema": {
7608
7917
  "type": "string",
7609
7918
  "minLength": 1,
7610
7919
  "maxLength": 500,
7611
- "description": "Why \u2014 the person reads it before deciding."
7920
+ "description": "Why you need the action. The person reads it before deciding."
7612
7921
  }
7613
7922
  }
7614
7923
  ],
7615
7924
  "hasBody": true,
7616
7925
  "workspace": true,
7926
+ "acceptsApiKey": false,
7617
7927
  "scope": "workspace.approvals:write"
7618
7928
  },
7619
7929
  {
@@ -7637,7 +7947,7 @@ var OPERATIONS = [
7637
7947
  "idempotentHint": true
7638
7948
  }
7639
7949
  },
7640
- "description": "The request you filed: pending, denied, completed (the action ran \u2014 see `result`), approved (waiting for the CLI to redeem it), failed or expired.",
7950
+ "description": "Returns an approval request you created, with its status. A `pending` request is waiting for a person to decide. A `completed` request's action ran, and `result` holds the outcome. An `approved` request is waiting for the CLI to redeem it. A request can also be `denied`, `failed` or `expired`.",
7641
7951
  "fields": [
7642
7952
  {
7643
7953
  "name": "requestId",
@@ -7645,6 +7955,7 @@ var OPERATIONS = [
7645
7955
  "type": "string",
7646
7956
  "required": true,
7647
7957
  "description": "The request's id.",
7958
+ "example": "apr_7c2e\u2026",
7648
7959
  "schema": {
7649
7960
  "type": "string",
7650
7961
  "description": "The request's id."
@@ -7653,6 +7964,7 @@ var OPERATIONS = [
7653
7964
  ],
7654
7965
  "hasBody": false,
7655
7966
  "workspace": true,
7967
+ "acceptsApiKey": true,
7656
7968
  "scope": "workspace.approvals:read"
7657
7969
  },
7658
7970
  {
@@ -7669,9 +7981,9 @@ var OPERATIONS = [
7669
7981
  },
7670
7982
  "mcp": {
7671
7983
  "exposed": false,
7672
- "reason": "Returns a secret; secrets never enter an agent's conversation \u2014 the CLI writes them to a file."
7984
+ "reason": "Returns a secret. Secrets never enter an agent's conversation. The CLI writes them to a file instead."
7673
7985
  },
7674
- "description": "Runs an approved, secret-producing action ONCE and returns its secret \u2014 to the personal access token that asked, only. The CLI writes it to a file without printing it.",
7986
+ "description": "Runs an approved action that creates a secret, and returns the secret. The action runs only once. Only the personal access token that asked can redeem it. The CLI writes the secret to a file without printing it.",
7675
7987
  "fields": [
7676
7988
  {
7677
7989
  "name": "requestId",
@@ -7679,6 +7991,7 @@ var OPERATIONS = [
7679
7991
  "type": "string",
7680
7992
  "required": true,
7681
7993
  "description": "The request's id.",
7994
+ "example": "apr_7c2e\u2026",
7682
7995
  "schema": {
7683
7996
  "type": "string",
7684
7997
  "description": "The request's id."
@@ -7687,6 +8000,7 @@ var OPERATIONS = [
7687
8000
  ],
7688
8001
  "hasBody": false,
7689
8002
  "workspace": true,
8003
+ "acceptsApiKey": false,
7690
8004
  "scope": "workspace.approvals:write"
7691
8005
  },
7692
8006
  {
@@ -7708,7 +8022,7 @@ var OPERATIONS = [
7708
8022
  "idempotentHint": true
7709
8023
  }
7710
8024
  },
7711
- "description": "The workspace's audit trail, newest first. Paginate with the opaque `nextCursor` token; `limit` is clamped to 1\u2013100 (default 25). Owner-only for personal access tokens, like the audit page in the application; a Workspace API key is its workspace and always passes.",
8025
+ "description": "Lists the workspace's audit events, newest first. Paginate with the opaque `nextCursor` token. `limit` takes 1 to 100 and defaults to 25. With a personal access token, only workspace owners can call this, as with the audit page in the app. A workspace API key always can, because it acts as the workspace itself.",
7712
8026
  "fields": [
7713
8027
  {
7714
8028
  "name": "limit",
@@ -7739,6 +8053,7 @@ var OPERATIONS = [
7739
8053
  ],
7740
8054
  "hasBody": false,
7741
8055
  "workspace": true,
8056
+ "acceptsApiKey": true,
7742
8057
  "scope": "workspace.audit:read"
7743
8058
  },
7744
8059
  {
@@ -7760,10 +8075,11 @@ var OPERATIONS = [
7760
8075
  "idempotentHint": true
7761
8076
  }
7762
8077
  },
7763
- "description": "Every workspace event a webhook endpoint can subscribe to, with what it means. Pass some as `eventTypes` when adding an endpoint; an endpoint without a list receives them all.",
8078
+ "description": "Lists every workspace event a webhook endpoint can subscribe to, and what each one means. Pass some as `eventTypes` when you add an endpoint. An endpoint without a list receives every event.",
7764
8079
  "fields": [],
7765
8080
  "hasBody": false,
7766
8081
  "workspace": true,
8082
+ "acceptsApiKey": true,
7767
8083
  "scope": "workspace.webhooks:read"
7768
8084
  },
7769
8085
  {
@@ -7785,10 +8101,11 @@ var OPERATIONS = [
7785
8101
  "idempotentHint": true
7786
8102
  }
7787
8103
  },
7788
- "description": `Returns the Workspace the credential acts in \u2014 the API key's own, or the one named by X-Workspace for a personal access token. Useful as an integration smoke test ("who am I?").`,
8104
+ "description": 'Returns the workspace the credential acts in. For an API key, that is the key\'s own workspace. For a personal access token, it is the one named in `X-Workspace`. Use it as a smoke test for an integration ("who am I?").',
7789
8105
  "fields": [],
7790
8106
  "hasBody": false,
7791
8107
  "workspace": true,
8108
+ "acceptsApiKey": true,
7792
8109
  "scope": "workspace:read"
7793
8110
  },
7794
8111
  {
@@ -7810,7 +8127,7 @@ var OPERATIONS = [
7810
8127
  "idempotentHint": true
7811
8128
  }
7812
8129
  },
7813
- "description": "Invitations sent and not yet accepted, declined or expired, newest first. Owners and admins only for a personal credential, as in the app. Paginate with the opaque `nextCursor`.",
8130
+ "description": "Lists the invitations that are not yet accepted, declined or expired, newest first. With a personal credential, only owners and admins can call this, as in the app. A workspace API key always can. Paginate with the opaque `nextCursor`.",
7814
8131
  "fields": [
7815
8132
  {
7816
8133
  "name": "limit",
@@ -7841,6 +8158,7 @@ var OPERATIONS = [
7841
8158
  ],
7842
8159
  "hasBody": false,
7843
8160
  "workspace": true,
8161
+ "acceptsApiKey": true,
7844
8162
  "scope": "workspace.members:read"
7845
8163
  },
7846
8164
  {
@@ -7862,7 +8180,7 @@ var OPERATIONS = [
7862
8180
  "idempotentHint": true
7863
8181
  }
7864
8182
  },
7865
- "description": "The workspace's members with their roles, newest first. Paginate with the opaque `nextCursor`; `limit` is clamped to 1\u2013100 (default 25). Members are invited, removed and given roles in the app.",
8183
+ "description": "Lists the workspace's members and their roles, newest first. Paginate with the opaque `nextCursor`. `limit` takes 1 to 100 and defaults to 25. Invite members, remove them and give them roles in the app.",
7866
8184
  "fields": [
7867
8185
  {
7868
8186
  "name": "limit",
@@ -7893,6 +8211,7 @@ var OPERATIONS = [
7893
8211
  ],
7894
8212
  "hasBody": false,
7895
8213
  "workspace": true,
8214
+ "acceptsApiKey": true,
7896
8215
  "scope": "workspace.members:read"
7897
8216
  },
7898
8217
  {
@@ -7914,7 +8233,7 @@ var OPERATIONS = [
7914
8233
  "idempotentHint": true
7915
8234
  }
7916
8235
  },
7917
- "description": "The workspace's teams with their members' user ids, newest first. Paginate with the opaque `nextCursor`; `limit` is clamped to 1\u2013100 (default 25). Teams are created and staffed in the app.",
8236
+ "description": "Lists the workspace's teams and their members' user ids, newest first. Paginate with the opaque `nextCursor`. `limit` takes 1 to 100 and defaults to 25. Create teams and add members to them in the app.",
7918
8237
  "fields": [
7919
8238
  {
7920
8239
  "name": "limit",
@@ -7945,6 +8264,7 @@ var OPERATIONS = [
7945
8264
  ],
7946
8265
  "hasBody": false,
7947
8266
  "workspace": true,
8267
+ "acceptsApiKey": true,
7948
8268
  "scope": "workspace.teams:read"
7949
8269
  },
7950
8270
  {
@@ -7966,10 +8286,11 @@ var OPERATIONS = [
7966
8286
  "idempotentHint": true
7967
8287
  }
7968
8288
  },
7969
- "description": "How much of each meter the workspace used this period, with the plan's limit for it (null = unlimited). A period is a month from the workspace's billing date: its subscription's (an annual plan refills monthly from its start), else the day the workspace was created.",
8289
+ "description": "Returns what the workspace used this period, with one entry for each thing its plan counts. Each entry has the plan's limit, or null when there is no limit. A period is one month from the workspace's billing date. That date comes from its subscription or, without one, from the day you created the workspace. On an annual plan, the counts still reset every month from the subscription's start.",
7970
8290
  "fields": [],
7971
8291
  "hasBody": false,
7972
8292
  "workspace": true,
8293
+ "acceptsApiKey": true,
7973
8294
  "scope": "workspace:read"
7974
8295
  },
7975
8296
  {
@@ -7993,16 +8314,18 @@ var OPERATIONS = [
7993
8314
  "idempotentHint": true
7994
8315
  }
7995
8316
  },
7996
- "description": "Delivery history for one endpoint, newest first: each event's status, attempts and last HTTP status (payloads are not returned). Kept for 30 days. Paginate with the opaque `nextCursor`.",
8317
+ "description": "Lists one endpoint's delivery history, newest first. Each entry shows the event's status, attempts and last HTTP status. Payloads aren't included. We keep the history for 30 days. Paginate with the opaque `nextCursor`. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
7997
8318
  "fields": [
7998
8319
  {
7999
8320
  "name": "endpointId",
8000
8321
  "in": "path",
8001
8322
  "type": "string",
8002
8323
  "required": true,
8324
+ "description": "The endpoint's ID.",
8003
8325
  "example": "we_3f0c\u2026",
8004
8326
  "schema": {
8005
- "type": "string"
8327
+ "type": "string",
8328
+ "description": "The endpoint's ID."
8006
8329
  }
8007
8330
  },
8008
8331
  {
@@ -8034,6 +8357,7 @@ var OPERATIONS = [
8034
8357
  ],
8035
8358
  "hasBody": false,
8036
8359
  "workspace": true,
8360
+ "acceptsApiKey": true,
8037
8361
  "scope": "workspace.webhooks:read"
8038
8362
  },
8039
8363
  {
@@ -8058,16 +8382,18 @@ var OPERATIONS = [
8058
8382
  "idempotentHint": false
8059
8383
  }
8060
8384
  },
8061
- "description": "Sends a recorded delivery's event again, as a new delivery with its own history entry; the event id is unchanged, so receivers can deduplicate. The endpoint must be enabled.",
8385
+ "description": "Sends a recorded delivery's event again, as a new delivery. The new delivery gets its own history entry. The event id stays the same, so receivers can deduplicate. Redelivery only works on an enabled endpoint. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8062
8386
  "fields": [
8063
8387
  {
8064
8388
  "name": "endpointId",
8065
8389
  "in": "path",
8066
8390
  "type": "string",
8067
8391
  "required": true,
8392
+ "description": "The endpoint's ID.",
8068
8393
  "example": "we_3f0c\u2026",
8069
8394
  "schema": {
8070
- "type": "string"
8395
+ "type": "string",
8396
+ "description": "The endpoint's ID."
8071
8397
  }
8072
8398
  },
8073
8399
  {
@@ -8075,14 +8401,17 @@ var OPERATIONS = [
8075
8401
  "in": "path",
8076
8402
  "type": "string",
8077
8403
  "required": true,
8404
+ "description": "The delivery's ID.",
8078
8405
  "example": "del_8a1b\u2026",
8079
8406
  "schema": {
8080
- "type": "string"
8407
+ "type": "string",
8408
+ "description": "The delivery's ID."
8081
8409
  }
8082
8410
  }
8083
8411
  ],
8084
8412
  "hasBody": false,
8085
8413
  "workspace": true,
8414
+ "acceptsApiKey": true,
8086
8415
  "scope": "workspace.webhooks:write"
8087
8416
  },
8088
8417
  {
@@ -8097,22 +8426,22 @@ var OPERATIONS = [
8097
8426
  },
8098
8427
  "mcp": {
8099
8428
  "exposed": false,
8100
- "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Webhooks in the app)."
8429
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8101
8430
  },
8102
- "description": "Registers an https URL to receive the workspace's events, signed Svix-compatibly. The response carries the endpoint's signing secret (`whsec_\u2026`) \u2014 shown ONCE, store it to verify deliveries. Private and non-https hosts are refused; at most 10 per workspace.",
8431
+ "description": "Registers an HTTPS URL to receive the workspace's events. Deliveries use the same signature format as Svix. The response includes the endpoint's signing secret (`whsec_\u2026`). You see it only once, so store it to verify deliveries. The API refuses private hosts and hosts without HTTPS. A workspace can have at most 10 endpoints. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8103
8432
  "fields": [
8104
8433
  {
8105
8434
  "name": "url",
8106
8435
  "in": "body",
8107
8436
  "type": "string",
8108
8437
  "required": true,
8109
- "description": "The https URL that receives the events.",
8438
+ "description": "The HTTPS URL that receives the events.",
8110
8439
  "example": "https://example.com/hooks",
8111
8440
  "schema": {
8112
8441
  "type": "string",
8113
8442
  "minLength": 1,
8114
8443
  "maxLength": 2048,
8115
- "description": "The https URL that receives the events."
8444
+ "description": "The HTTPS URL that receives the events."
8116
8445
  }
8117
8446
  },
8118
8447
  {
@@ -8132,7 +8461,7 @@ var OPERATIONS = [
8132
8461
  "in": "body",
8133
8462
  "type": "json",
8134
8463
  "required": false,
8135
- "description": "Only these event types (see event-types); omit for every event.",
8464
+ "description": "Send only these event types, from event-types. Leave it out for every event.",
8136
8465
  "example": [
8137
8466
  "workspace.member.joined"
8138
8467
  ],
@@ -8142,12 +8471,13 @@ var OPERATIONS = [
8142
8471
  "type": "string"
8143
8472
  },
8144
8473
  "maxItems": 100,
8145
- "description": "Only these event types (see event-types); omit for every event."
8474
+ "description": "Send only these event types, from event-types. Leave it out for every event."
8146
8475
  }
8147
8476
  }
8148
8477
  ],
8149
8478
  "hasBody": true,
8150
8479
  "workspace": true,
8480
+ "acceptsApiKey": true,
8151
8481
  "scope": "workspace.webhooks:write"
8152
8482
  },
8153
8483
  {
@@ -8164,23 +8494,26 @@ var OPERATIONS = [
8164
8494
  },
8165
8495
  "mcp": {
8166
8496
  "exposed": false,
8167
- "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Webhooks in the app)."
8497
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8168
8498
  },
8169
- "description": "Stops all deliveries to the endpoint and deletes it with its secret. Its delivery history goes with it.",
8499
+ "description": "Deletes the endpoint and its signing secret. All deliveries to the endpoint stop. Its delivery history goes with it. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8170
8500
  "fields": [
8171
8501
  {
8172
8502
  "name": "endpointId",
8173
8503
  "in": "path",
8174
8504
  "type": "string",
8175
8505
  "required": true,
8506
+ "description": "The endpoint's ID.",
8176
8507
  "example": "we_3f0c\u2026",
8177
8508
  "schema": {
8178
- "type": "string"
8509
+ "type": "string",
8510
+ "description": "The endpoint's ID."
8179
8511
  }
8180
8512
  }
8181
8513
  ],
8182
8514
  "hasBody": false,
8183
8515
  "workspace": true,
8516
+ "acceptsApiKey": true,
8184
8517
  "scope": "workspace.webhooks:write"
8185
8518
  },
8186
8519
  {
@@ -8197,23 +8530,26 @@ var OPERATIONS = [
8197
8530
  },
8198
8531
  "mcp": {
8199
8532
  "exposed": false,
8200
- "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Webhooks in the app)."
8533
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8201
8534
  },
8202
- "description": "Resumes deliveries to an endpoint that was disabled after repeated failures, keeping its signing secret; the failure count resets.",
8535
+ "description": "Resumes deliveries to an endpoint that stopped after repeated failures. The endpoint keeps its signing secret. Its failure count resets. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8203
8536
  "fields": [
8204
8537
  {
8205
8538
  "name": "endpointId",
8206
8539
  "in": "path",
8207
8540
  "type": "string",
8208
8541
  "required": true,
8542
+ "description": "The endpoint's ID.",
8209
8543
  "example": "we_3f0c\u2026",
8210
8544
  "schema": {
8211
- "type": "string"
8545
+ "type": "string",
8546
+ "description": "The endpoint's ID."
8212
8547
  }
8213
8548
  }
8214
8549
  ],
8215
8550
  "hasBody": false,
8216
8551
  "workspace": true,
8552
+ "acceptsApiKey": true,
8217
8553
  "scope": "workspace.webhooks:write"
8218
8554
  },
8219
8555
  {
@@ -8237,21 +8573,24 @@ var OPERATIONS = [
8237
8573
  "idempotentHint": true
8238
8574
  }
8239
8575
  },
8240
- "description": "One endpoint, without its signing secret: whether it is enabled, its consecutive failures and its last delivery status.",
8576
+ "description": "Returns one endpoint without its signing secret. It shows whether the endpoint is on, its consecutive failures and its last delivery status. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8241
8577
  "fields": [
8242
8578
  {
8243
8579
  "name": "endpointId",
8244
8580
  "in": "path",
8245
8581
  "type": "string",
8246
8582
  "required": true,
8583
+ "description": "The endpoint's ID.",
8247
8584
  "example": "we_3f0c\u2026",
8248
8585
  "schema": {
8249
- "type": "string"
8586
+ "type": "string",
8587
+ "description": "The endpoint's ID."
8250
8588
  }
8251
8589
  }
8252
8590
  ],
8253
8591
  "hasBody": false,
8254
8592
  "workspace": true,
8593
+ "acceptsApiKey": true,
8255
8594
  "scope": "workspace.webhooks:read"
8256
8595
  },
8257
8596
  {
@@ -8273,10 +8612,11 @@ var OPERATIONS = [
8273
8612
  "idempotentHint": true
8274
8613
  }
8275
8614
  },
8276
- "description": "The workspace's outgoing webhook endpoints, newest first, without their signing secrets. A workspace has at most 10, so the list is a single page (`nextCursor` is null).",
8615
+ "description": "Lists the workspace's outgoing webhook endpoints, newest first. The list leaves out their signing secrets. A workspace has at most 10 endpoints, so the list is a single page. Its `nextCursor` is null. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8277
8616
  "fields": [],
8278
8617
  "hasBody": false,
8279
8618
  "workspace": true,
8619
+ "acceptsApiKey": true,
8280
8620
  "scope": "workspace.webhooks:read"
8281
8621
  },
8282
8622
  {
@@ -8300,21 +8640,110 @@ var OPERATIONS = [
8300
8640
  "idempotentHint": false
8301
8641
  }
8302
8642
  },
8303
- "description": "Sends a `ping` event to the endpoint, signed like every delivery \u2014 the way to check an integration verifies and accepts deliveries.",
8643
+ "description": "Sends a `ping` event to the endpoint, signed like every delivery. Use it to check that an integration verifies and accepts deliveries. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8304
8644
  "fields": [
8305
8645
  {
8306
8646
  "name": "endpointId",
8307
8647
  "in": "path",
8308
8648
  "type": "string",
8309
8649
  "required": true,
8650
+ "description": "The endpoint's ID.",
8310
8651
  "example": "we_3f0c\u2026",
8311
8652
  "schema": {
8312
- "type": "string"
8653
+ "type": "string",
8654
+ "description": "The endpoint's ID."
8313
8655
  }
8314
8656
  }
8315
8657
  ],
8316
8658
  "hasBody": false,
8317
8659
  "workspace": true,
8660
+ "acceptsApiKey": true,
8661
+ "scope": "workspace.webhooks:write"
8662
+ },
8663
+ {
8664
+ "operationId": "workspace.webhookEndpoints.update",
8665
+ "method": "patch",
8666
+ "path": "/workspace/webhook-endpoints/{endpointId}",
8667
+ "summary": "Update a webhook endpoint",
8668
+ "cli": {
8669
+ "command": "workspace webhook-endpoints update",
8670
+ "args": [
8671
+ "endpointId"
8672
+ ],
8673
+ "confirm": false
8674
+ },
8675
+ "mcp": {
8676
+ "exposed": false,
8677
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8678
+ },
8679
+ "description": "Changes an endpoint's URL, description or event types in place. Only the fields you send change. The endpoint keeps its signing secret, so receivers keep verifying deliveries. A new URL must pass the same checks as on create. It must use HTTPS and can't be a private host. With a personal access token, only workspace owners can call this. A workspace API key with this scope can.",
8680
+ "fields": [
8681
+ {
8682
+ "name": "endpointId",
8683
+ "in": "path",
8684
+ "type": "string",
8685
+ "required": true,
8686
+ "description": "The endpoint's ID.",
8687
+ "example": "we_3f0c\u2026",
8688
+ "schema": {
8689
+ "type": "string",
8690
+ "description": "The endpoint's ID."
8691
+ }
8692
+ },
8693
+ {
8694
+ "name": "url",
8695
+ "in": "body",
8696
+ "type": "string",
8697
+ "required": false,
8698
+ "description": "The HTTPS URL that receives the events.",
8699
+ "example": "https://example.com/hooks",
8700
+ "schema": {
8701
+ "type": "string",
8702
+ "minLength": 1,
8703
+ "maxLength": 2048,
8704
+ "description": "The HTTPS URL that receives the events."
8705
+ }
8706
+ },
8707
+ {
8708
+ "name": "description",
8709
+ "in": "body",
8710
+ "type": "string",
8711
+ "required": false,
8712
+ "description": "A note for people managing the endpoint. Null clears it.",
8713
+ "schema": {
8714
+ "type": [
8715
+ "string",
8716
+ "null"
8717
+ ],
8718
+ "maxLength": 200,
8719
+ "description": "A note for people managing the endpoint. Null clears it."
8720
+ }
8721
+ },
8722
+ {
8723
+ "name": "eventTypes",
8724
+ "in": "body",
8725
+ "type": "json",
8726
+ "required": false,
8727
+ "description": "Send only these event types, from event-types. Null or an empty list means every event.",
8728
+ "example": [
8729
+ "workspace.member.joined"
8730
+ ],
8731
+ "schema": {
8732
+ "type": [
8733
+ "array",
8734
+ "null"
8735
+ ],
8736
+ "items": {
8737
+ "type": "string"
8738
+ },
8739
+ "maxItems": 100,
8740
+ "description": "Send only these event types, from event-types. Null or an empty list means every event."
8741
+ }
8742
+ }
8743
+ ],
8744
+ "hasBody": true,
8745
+ "workspace": true,
8746
+ "acceptsApiKey": true,
8318
8747
  "scope": "workspace.webhooks:write"
8319
8748
  }
8320
8749
  ];
@@ -8404,14 +8833,15 @@ ${op.description}`);
8404
8833
  if (op.workspace) {
8405
8834
  command.option("--workspace <slug>", "act in this workspace for one call");
8406
8835
  }
8407
- if (op.cli.confirm) command.option("--yes", "confirm \u2014 it cannot be undone");
8836
+ if (op.cli.confirm)
8837
+ command.option("--yes", "confirm an operation that cannot be undone");
8408
8838
  command.option("--json", "machine-readable output");
8409
8839
  command.action(async (...input) => {
8410
8840
  const values = input.slice(0, op.cli.args.length);
8411
8841
  const options = input[op.cli.args.length];
8412
8842
  if (op.cli.confirm && !options.yes) {
8413
8843
  throw new Error(
8414
- `${op.summary} cannot be undone \u2014 re-run with --yes to confirm`
8844
+ `${op.summary} cannot be undone. Run it again with --yes to confirm.`
8415
8845
  );
8416
8846
  }
8417
8847
  const args = Object.fromEntries(
@@ -8546,24 +8976,6 @@ function print(ctx, data, asJson) {
8546
8976
  // src/product/files.ts
8547
8977
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
8548
8978
  import { basename, dirname, join as join2, resolve, sep } from "node:path";
8549
- var TYPES = {
8550
- csv: "text/csv",
8551
- tsv: "text/tab-separated-values",
8552
- txt: "text/plain",
8553
- md: "text/markdown",
8554
- json: "application/json",
8555
- xml: "application/xml",
8556
- pdf: "application/pdf",
8557
- zip: "application/zip",
8558
- gz: "application/gzip",
8559
- ofx: "application/x-ofx",
8560
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
8561
- xls: "application/vnd.ms-excel",
8562
- png: "image/png",
8563
- jpg: "image/jpeg",
8564
- jpeg: "image/jpeg"
8565
- };
8566
- var typeOf = (path2) => TYPES[path2.split(".").pop()?.toLowerCase() ?? ""] ?? "application/octet-stream";
8567
8979
  async function uploadPath(ctx, path2, workspace2) {
8568
8980
  let data;
8569
8981
  try {
@@ -8574,13 +8986,13 @@ async function uploadPath(ctx, path2, workspace2) {
8574
8986
  });
8575
8987
  }
8576
8988
  return uploadFile(ctx.client({ workspace: workspace2 }), {
8989
+ // No type: the API takes it from the name (one table for every client).
8577
8990
  name: basename(path2),
8578
- type: typeOf(path2),
8579
8991
  data: new Uint8Array(data)
8580
8992
  });
8581
8993
  }
8582
8994
  async function downloadBytes(ctx, id, workspace2) {
8583
- const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/content", {
8995
+ const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/download", {
8584
8996
  params: { path: { fileId: id } },
8585
8997
  parseAs: "arrayBuffer"
8586
8998
  });
@@ -8592,7 +9004,7 @@ async function downloadBytes(ctx, id, workspace2) {
8592
9004
  }
8593
9005
  return new Uint8Array(result.data);
8594
9006
  }
8595
- function outputPath(dir, name) {
9007
+ function localPath(dir, name) {
8596
9008
  const root = resolve(dir);
8597
9009
  const path2 = resolve(root, name);
8598
9010
  if (path2 !== root && !path2.startsWith(root + sep)) {
@@ -8600,10 +9012,10 @@ function outputPath(dir, name) {
8600
9012
  }
8601
9013
  return path2;
8602
9014
  }
8603
- async function saveOutputs(ctx, files, dir, workspace2) {
9015
+ async function downloadSavedFiles(ctx, files, dir, workspace2) {
8604
9016
  const saved = [];
8605
- for (const file of files.filter((f) => f.direction === "out")) {
8606
- const path2 = outputPath(dir, file.name);
9017
+ for (const file of files.filter((f) => f.origin === "saved")) {
9018
+ const path2 = localPath(dir, file.name);
8607
9019
  mkdirSync2(dirname(path2), { recursive: true });
8608
9020
  writeFileSync4(path2, await downloadBytes(ctx, file.id, workspace2));
8609
9021
  saved.push(path2);
@@ -8618,7 +9030,7 @@ var fileCommands = (program3, ctx) => {
8618
9030
  ctx.io.stdout(options.json ? json(file) : file.id);
8619
9031
  }
8620
9032
  );
8621
- group.command("download <file-id>").description("Save a file that a run took in or wrote").option("--out <path>", "where to save it").option("--workspace <slug>", "act in this workspace for one call").action(
9033
+ group.command("download <file-id>").description("Download a file that a run received or saved").option("--out <path>", "where to save it").option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the file and where it was saved").action(
8622
9034
  async (id, options) => {
8623
9035
  const client = ctx.client({ workspace: options.workspace });
8624
9036
  const meta = await client.GET("/files/{fileId}", {
@@ -8632,19 +9044,29 @@ var fileCommands = (program3, ctx) => {
8632
9044
  const path2 = options.out ?? join2(".", basename(meta.data.name) || meta.data.id);
8633
9045
  mkdirSync2(dirname(resolve(path2)), { recursive: true });
8634
9046
  writeFileSync4(path2, await downloadBytes(ctx, id, options.workspace));
8635
- ctx.io.stdout(`Saved ${path2}`);
9047
+ ctx.io.stdout(
9048
+ options.json ? json({ ...meta.data, path: path2 }) : `Downloaded ${path2}`
9049
+ );
8636
9050
  }
8637
9051
  );
8638
9052
  };
8639
- function describeOutputs(files) {
8640
- return files.filter((f) => f.direction === "out").map(
8641
- (f) => `Wrote ${f.name}: ${f.downloadUrl ?? `${brand.name} files download ${f.id}`}`
9053
+ function describeSavedFiles(files) {
9054
+ return files.filter((f) => f.origin === "saved").map(
9055
+ (f) => `Saved ${f.name}: ${f.downloadUrl ?? `${brand.name} files download ${f.id}`}`
8642
9056
  );
8643
9057
  }
8644
9058
 
8645
9059
  // src/product/scripts.ts
8646
9060
  import { spawnSync } from "node:child_process";
8647
- import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync5, statSync } from "node:fs";
9061
+ import {
9062
+ closeSync,
9063
+ existsSync as existsSync3,
9064
+ fstatSync,
9065
+ openSync,
9066
+ readdirSync,
9067
+ readFileSync as readFileSync5,
9068
+ statSync
9069
+ } from "node:fs";
8648
9070
  import { basename as basename2, join as join3, relative, resolve as resolve2 } from "node:path";
8649
9071
 
8650
9072
  // node_modules/smol-toml/dist/error.js
@@ -9617,9 +10039,41 @@ function withName(result, folder) {
9617
10039
  }
9618
10040
  };
9619
10041
  }
10042
+ function inputSchemaForCommand(command) {
10043
+ const optional2 = new Set(
10044
+ optionalGroups(command).flatMap(
10045
+ (group) => [...group.matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10046
+ )
10047
+ );
10048
+ const names = [
10049
+ ...new Set(
10050
+ [...command.matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10051
+ )
10052
+ ];
10053
+ return {
10054
+ type: "object",
10055
+ required: names.filter((name) => !optional2.has(name)),
10056
+ properties: Object.fromEntries(
10057
+ names.map((name) => [name, { type: "string" }])
10058
+ )
10059
+ };
10060
+ }
10061
+ function optionalGroups(command) {
10062
+ const groups = [];
10063
+ let from = 0;
10064
+ for (; ; ) {
10065
+ const open = command.indexOf("[", from);
10066
+ if (open === -1) break;
10067
+ const close = command.indexOf("]", open + 1);
10068
+ if (close === -1) break;
10069
+ groups.push(command.slice(open, close + 1));
10070
+ from = close + 1;
10071
+ }
10072
+ return groups;
10073
+ }
9620
10074
 
9621
10075
  // src/product/scripts.ts
9622
- var MAX_ARCHIVE_BYTES = 1e7;
10076
+ var MAX_SOURCE_BYTES = 1e7;
9623
10077
  function readReadme(dir) {
9624
10078
  for (const name of ["README.md", "readme.md", "Readme.md"]) {
9625
10079
  try {
@@ -9633,11 +10087,14 @@ function localFolder(dir, files) {
9633
10087
  return {
9634
10088
  files,
9635
10089
  read: (path2) => {
10090
+ let fd;
9636
10091
  try {
9637
- const full = join3(dir, path2);
9638
- return statSync(full).size <= 1e6 ? readFileSync5(full, "utf8") : null;
10092
+ fd = openSync(join3(dir, path2), "r");
10093
+ return fstatSync(fd).size <= 1e6 ? readFileSync5(fd, "utf8") : null;
9639
10094
  } catch {
9640
10095
  return null;
10096
+ } finally {
10097
+ if (fd !== void 0) closeSync(fd);
9641
10098
  }
9642
10099
  },
9643
10100
  executable: (path2) => {
@@ -9684,9 +10141,13 @@ function loadScriptDir(dir, flags = {}) {
9684
10141
  return {
9685
10142
  manifest,
9686
10143
  files,
9687
- archive: pack(dir, files),
10144
+ source: pack(dir, files),
9688
10145
  readme: readReadme(dir),
9689
- detected: command ? null : detected
10146
+ detected: command ? null : detected,
10147
+ explicit: {
10148
+ ...(given.name ?? flags.name) !== void 0 ? { name: given.name ?? flags.name } : {},
10149
+ ...given.description !== void 0 ? { description: given.description } : {}
10150
+ }
9690
10151
  };
9691
10152
  }
9692
10153
  var SKIPPED = /* @__PURE__ */ new Set([
@@ -9719,15 +10180,15 @@ function walk(root, dir) {
9719
10180
  }
9720
10181
  function pack(dir, files) {
9721
10182
  const size = files.reduce((sum, f) => sum + statSync(join3(dir, f)).size, 0);
9722
- if (size > MAX_ARCHIVE_BYTES * 5) {
10183
+ if (size > MAX_SOURCE_BYTES * 5) {
9723
10184
  throw new Error(
9724
- `The folder holds ${(size / 1e6).toFixed(1)} MB of files \u2014 leave out data and installed dependencies (they are installed at publish)`
10185
+ `The folder holds ${(size / 1e6).toFixed(1)} MB of files. Leave out data and installed dependencies, which Reminix installs at upload.`
9725
10186
  );
9726
10187
  }
9727
10188
  const tar = spawnSync("tar", ["-czf", "-", "--null", "-T", "-"], {
9728
10189
  cwd: dir,
9729
10190
  input: files.join("\0"),
9730
- maxBuffer: MAX_ARCHIVE_BYTES * 2,
10191
+ maxBuffer: MAX_SOURCE_BYTES * 2,
9731
10192
  // macOS: no AppleDouble (._*) files in the archive.
9732
10193
  env: { ...process.env, COPYFILE_DISABLE: "1" }
9733
10194
  });
@@ -9736,14 +10197,15 @@ function pack(dir, files) {
9736
10197
  `Could not pack the folder: ${tar.stderr?.toString().trim() || tar.error?.message}`
9737
10198
  );
9738
10199
  }
9739
- if (tar.stdout.length > MAX_ARCHIVE_BYTES) {
10200
+ if (tar.stdout.length > MAX_SOURCE_BYTES) {
9740
10201
  throw new Error(
9741
- `The packed folder is ${(tar.stdout.length / 1e6).toFixed(1)} MB \u2014 at most ${MAX_ARCHIVE_BYTES / 1e6} MB (leave out data and installed dependencies)`
10202
+ `The packed folder is ${(tar.stdout.length / 1e6).toFixed(1)} MB, and the limit is ${MAX_SOURCE_BYTES / 1e6} MB. Leave out data and installed dependencies.`
9742
10203
  );
9743
10204
  }
9744
10205
  return tar.stdout;
9745
10206
  }
9746
10207
  var POLL_MS2 = 2e3;
10208
+ var ENDED2 = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled"]);
9747
10209
  function isScript(dir) {
9748
10210
  return existsSync3(join3(dir, "reminix.json")) || detectScript(localFolder(dir, scriptFiles(dir))).ok;
9749
10211
  }
@@ -9784,103 +10246,88 @@ function describeDetected(manifest, detected) {
9784
10246
  if (command) lines.push(` command ${command}`);
9785
10247
  return lines.join("\n");
9786
10248
  }
9787
- async function publishFolder(ctx, dir, options) {
9788
- const { manifest, archive, readme, detected } = loadScriptDir(dir, options);
9789
- if (options.plan) {
10249
+ async function publishFolder(ctx, dir, options, mode) {
10250
+ const { manifest, source, explicit, detected } = loadScriptDir(dir, options);
10251
+ if (options.dryRun) {
9790
10252
  return {
9791
10253
  slug: manifest.slug,
9792
10254
  version: null,
9793
10255
  script: null,
9794
10256
  line: `${describeDetected(manifest, detected)}
9795
- Nothing was uploaded (--plan).`
10257
+ Nothing was uploaded (--dry-run).`
9796
10258
  };
9797
10259
  }
9798
10260
  const call3 = (method, path2, body) => rawRequest(ctx, { method, path: path2, body, workspace: options.workspace });
9799
10261
  const slug = encodeURIComponent(manifest.slug);
9800
10262
  if (options.number !== void 0) {
9801
- const number = Number(options.number);
9802
- if (!Number.isInteger(number) || number < 1) {
9803
- throw new Error("--number: a version number, like --number 3");
9804
- }
9805
- if (options.draft) {
9806
- throw new Error(
9807
- "--number publishes a version already uploaded; leave out --draft"
9808
- );
10263
+ const version2 = Number(options.number);
10264
+ if (!Number.isInteger(version2) || version2 < 1) {
10265
+ throw new Error("--number: a version's number, like --number 3");
9809
10266
  }
9810
10267
  const script2 = await call3(
9811
10268
  "POST",
9812
- `/v1/scripts/${slug}/versions/${number}/publish`
10269
+ `/v1/scripts/${slug}/versions/${version2}/publish`
9813
10270
  );
9814
10271
  const approveUrl2 = script2.approval?.approveUrl ?? null;
9815
10272
  return {
9816
10273
  slug: manifest.slug,
9817
- version: { number },
10274
+ version: { version: version2 },
9818
10275
  script: script2,
9819
- line: approveUrl2 ? `Publishing ${manifest.slug} version ${number} waits for a person's approval: ${approveUrl2}` : `Published ${manifest.slug} version ${number}.`
10276
+ line: approveUrl2 ? `Publishing ${manifest.slug} version ${version2} waits for a person's approval: ${approveUrl2}` : `Published ${manifest.slug} version ${version2}.`
9820
10277
  };
9821
10278
  }
9822
- try {
9823
- await call3("GET", `/v1/scripts/${slug}`);
9824
- } catch (error) {
9825
- if (error.status !== 404) throw error;
9826
- await call3("POST", "/v1/scripts", {
9827
- slug: manifest.slug,
9828
- name: manifest.name,
9829
- description: manifest.description
9830
- });
9831
- }
9832
10279
  const version = await call3("POST", `/v1/scripts/${slug}/versions`, {
9833
10280
  command: manifest.command,
9834
- build: manifest.build ?? null,
10281
+ install: manifest.install ?? null,
9835
10282
  inputSchema: manifest.inputSchema,
9836
10283
  outputSchema: manifest.outputSchema ?? null,
9837
10284
  hosts: manifest.hosts,
9838
10285
  secrets: manifest.secrets,
9839
- env: manifest.env,
10286
+ envVars: manifest.envVars,
9840
10287
  tags: manifest.tags,
9841
- timeout: manifest.timeout,
9842
- readme,
9843
- archive: archive.toString("base64"),
9844
- via: "cli"
10288
+ timeoutSeconds: manifest.timeoutSeconds,
10289
+ source: source.toString("base64"),
10290
+ via: "cli",
10291
+ create: true,
10292
+ ...explicit,
10293
+ publish: mode === "publish"
9845
10294
  });
9846
- let script = null;
9847
- let approveUrl = null;
9848
- if (!options.draft) {
9849
- script = await call3(
9850
- "POST",
9851
- `/v1/scripts/${slug}/versions/${version.number}/publish`
9852
- );
9853
- approveUrl = script.approval?.approveUrl ?? null;
9854
- }
9855
- const line = approveUrl ? `Uploaded ${manifest.slug} version ${version.number}; publishing waits for a person's approval: ${approveUrl}` : options.draft ? `Uploaded ${manifest.slug} version ${version.number} as a draft. Publish it in the app, or run \`${brand.name} publish\` again without --draft.` : `Published ${manifest.slug} version ${version.number}.`;
10295
+ const script = null;
10296
+ const approveUrl = version.approval?.approveUrl ?? null;
10297
+ const line = approveUrl ? `Uploaded ${manifest.slug} version ${version.version}; publishing waits for a person's approval: ${approveUrl}` : mode === "upload" ? `Uploaded ${manifest.slug} version ${version.version} as a draft. Test it with \`${brand.name} run ${manifest.slug} --number ${version.version}\`, then publish it in the app or with \`${brand.name} publish --number ${version.version}\`.` : `Published ${manifest.slug} version ${version.version}.`;
9856
10298
  const found = detected ? `${describeDetected(manifest, detected)}
9857
10299
  ` : "";
9858
10300
  return { slug: manifest.slug, version, script, line: `${found}${line}` };
9859
10301
  }
9860
- var definePublish = (command, ctx) => covers(
9861
- command,
9862
- "scripts.create",
9863
- "scriptVersions.create",
9864
- "scriptVersions.publish"
9865
- ).option(
9866
- "--draft",
9867
- "upload a draft to test and publish later (agents use it and ask a person)"
9868
- ).option(
9869
- "--number <n>",
9870
- "publish version n, already uploaded (the draft you tested), instead of uploading"
9871
- ).option(
10302
+ var definePublish = (mode) => (command, ctx) => defineFolderOptions(
10303
+ mode === "publish" ? covers(
10304
+ command,
10305
+ "scripts.create",
10306
+ "scriptVersions.upload",
10307
+ "scriptVersions.publish"
10308
+ ).option(
10309
+ "--number <n>",
10310
+ "publish version n, already uploaded (the draft you tested), instead of uploading (--version is the CLI's own)"
10311
+ ) : covers(command, "scripts.create", "scriptVersions.upload"),
10312
+ ctx,
10313
+ mode
10314
+ );
10315
+ var defineFolderOptions = (command, ctx, mode) => command.option(
9872
10316
  "--command <line>",
9873
10317
  `how it runs, when the folder doesn't say: "python report.py {month}"`
9874
10318
  ).option("--name <name>", "the name people see (default: from the folder)").option(
9875
10319
  "--slug <slug>",
9876
10320
  "its id in URLs and commands (default: from the folder)"
9877
- ).option("--plan", "show what would be published, and upload nothing").option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").addHelpText(
10321
+ ).option(
10322
+ "--dry-run",
10323
+ `show what would be ${mode === "publish" ? "published" : "uploaded"}, and upload nothing`
10324
+ ).option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").addHelpText(
9878
10325
  "after",
9879
10326
  `
9880
- Publishes the folder as it is: it says how it runs (pyproject.toml, package.json,
10327
+ ${mode === "publish" ? "Publishes" : "Uploads"} the folder as it is: it says how it runs (pyproject.toml, package.json,
9881
10328
  or its one .py, .js, .ts or .sh file). Customize it with a reminix.json.
9882
- Several folders publish one after another; a folder of scripts publishes each
9883
- subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
10329
+ Several folders go one after another; a folder of scripts does each
10330
+ subfolder that is one: \`${brand.name} ${mode} scripts/\` does them all.`
9884
10331
  ).action(
9885
10332
  async (dirs, options) => {
9886
10333
  const { folders, missing, skipped: skipped2 } = scriptFolders(dirs);
@@ -9891,7 +10338,7 @@ subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
9891
10338
  throw new Error("--number publishes one script: name one folder");
9892
10339
  }
9893
10340
  if (folders.length === 1 && missing.length === 0) {
9894
- const result = await publishFolder(ctx, folders[0], options);
10341
+ const result = await publishFolder(ctx, folders[0], options, mode);
9895
10342
  ctx.io.stdout(
9896
10343
  options.json ? json({ version: result.version, script: result.script }) : result.line
9897
10344
  );
@@ -9909,7 +10356,7 @@ subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
9909
10356
  }
9910
10357
  for (const dir of folders) {
9911
10358
  try {
9912
- const result = await publishFolder(ctx, dir, options);
10359
+ const result = await publishFolder(ctx, dir, options, mode);
9913
10360
  results.push({
9914
10361
  dir,
9915
10362
  version: result.version,
@@ -9928,18 +10375,21 @@ subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
9928
10375
  }
9929
10376
  }
9930
10377
  );
9931
- var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions.run").option("--input <json>", "the inputs, as a JSON object", "{}").option(
10378
+ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions.testRun").option("--input <json>", "the inputs, as a JSON object", "{}").option(
9932
10379
  "--file <input=path>",
9933
10380
  "upload a file as a file input (repeat it for several)",
9934
10381
  (value, all) => [...all, value],
9935
10382
  []
9936
10383
  ).option(
9937
10384
  "--out <dir>",
9938
- "save the files the run writes here (else their links are printed)"
10385
+ "download the files the run saves into this folder (else their links are printed)"
9939
10386
  ).option(
9940
10387
  "--number <n>",
9941
- "test-run version n (a draft) instead of the published one"
9942
- ).option("--log", "also print what the run logged (to stderr)").option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the whole run, not just its output").action(
10388
+ "test-run version n (a draft) instead of the published one (--version is the CLI's own)"
10389
+ ).option("--log", "also print what the run logged (to stderr)").option(
10390
+ "--no-wait",
10391
+ "answer at once with a run awaiting approval or still running, instead of following it"
10392
+ ).option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the whole run, not just its output").action(
9943
10393
  async (slug, options) => {
9944
10394
  let inputs;
9945
10395
  try {
@@ -9973,44 +10423,45 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
9973
10423
  spec.slice(at + 1)
9974
10424
  ]);
9975
10425
  }
9976
- const script = await call3(
9977
- "GET",
9978
- `/v1/scripts/${encodeURIComponent(slug)}`
9979
- );
9980
- const properties = script.inputSchema?.properties ?? {};
9981
10426
  for (const [name, paths] of byInput) {
9982
10427
  const ids = [];
9983
10428
  for (const path2 of paths) {
9984
10429
  ids.push((await uploadPath(ctx, path2, options.workspace)).id);
9985
10430
  }
9986
- inputs[name] = properties[name]?.type === "array" || ids.length > 1 ? ids : ids[0];
10431
+ inputs[name] = ids.length > 1 ? ids : ids[0];
9987
10432
  }
9988
10433
  }
9989
10434
  if (options.number !== void 0 && !/^[1-9]\d*$/.test(options.number)) {
9990
- throw new Error("--number: a version number, like --number 2");
10435
+ throw new Error("--number: a version's number, like --number 2");
9991
10436
  }
9992
10437
  let run3 = await call3(
9993
10438
  "POST",
9994
10439
  options.number === void 0 ? `/v1/scripts/${encodeURIComponent(slug)}/runs` : `/v1/scripts/${encodeURIComponent(slug)}/versions/${options.number}/runs`,
9995
10440
  { inputs, via: "cli" }
9996
10441
  );
9997
- if (run3.status === "awaiting_approval") {
10442
+ if (!options.wait && !ENDED2.has(run3.status)) {
9998
10443
  ctx.io.stdout(
9999
- options.json ? json(run3) : `Waiting for a person's approval (run ${run3.id}): ${run3.approval?.approveUrl ?? "see Approvals in the app"}`
10444
+ options.json ? json(run3) : `Run ${run3.id} is ${run3.status}.`
10000
10445
  );
10001
10446
  return;
10002
10447
  }
10448
+ const approveUrl = run3.approval?.approveUrl;
10449
+ if (run3.status === "awaiting_approval") {
10450
+ ctx.io.stderr(
10451
+ `Waiting for a person's approval (run ${run3.id}): ${approveUrl ?? "see Approvals in the app"}`
10452
+ );
10453
+ }
10003
10454
  let printed = 0;
10004
10455
  const printLog = async () => {
10005
- if (!options.log) return;
10456
+ if (!options.log || run3.status === "awaiting_approval") return;
10006
10457
  const { lines } = await call3(
10007
10458
  "GET",
10008
- `/v1/runs/${encodeURIComponent(run3.id)}/logs`
10459
+ `/v1/runs/${encodeURIComponent(run3.id)}/log`
10009
10460
  );
10010
10461
  for (const line of lines.slice(printed)) ctx.io.stderr(line);
10011
10462
  printed = Math.max(printed, lines.length);
10012
10463
  };
10013
- while (run3.status === "running") {
10464
+ while (!ENDED2.has(run3.status)) {
10014
10465
  await printLog();
10015
10466
  await new Promise((resolve4) => setTimeout(resolve4, POLL_MS2));
10016
10467
  run3 = await call3(
@@ -10021,16 +10472,16 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
10021
10472
  await printLog();
10022
10473
  const files = run3.files ?? [];
10023
10474
  if (options.out) {
10024
- for (const path2 of await saveOutputs(
10475
+ for (const path2 of await downloadSavedFiles(
10025
10476
  ctx,
10026
10477
  files,
10027
10478
  options.out,
10028
10479
  options.workspace
10029
10480
  )) {
10030
- ctx.io.stderr(`Saved ${path2}`);
10481
+ ctx.io.stderr(`Downloaded ${path2}`);
10031
10482
  }
10032
10483
  } else {
10033
- for (const line of describeOutputs(files)) ctx.io.stderr(line);
10484
+ for (const line of describeSavedFiles(files)) ctx.io.stderr(line);
10034
10485
  }
10035
10486
  if (options.json) {
10036
10487
  ctx.io.stdout(json(run3));
@@ -10039,95 +10490,105 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
10039
10490
  typeof run3.output === "string" ? run3.output : json(run3.output)
10040
10491
  );
10041
10492
  }
10493
+ if (run3.status === "cancelled") {
10494
+ throw new Error(
10495
+ `The run was cancelled (${run3.id}): ${run3.error ?? "no reason given"}`
10496
+ );
10497
+ }
10042
10498
  if (run3.status !== "succeeded") {
10043
- throw new Error(`The run failed (${run3.id}): ${run3.error}`);
10499
+ throw new Error(
10500
+ `The run failed (${run3.id}): ${run3.error ?? "no error message"}`
10501
+ );
10044
10502
  }
10045
10503
  }
10046
10504
  );
10047
10505
  var scriptCommands = (program3, ctx) => {
10048
10506
  const group = program3.commands.find((c) => c.name() === "scripts") ?? program3.command("scripts").description("scripts commands");
10049
- definePublish(group.command("publish [dir...]"), ctx).description(
10050
- `Upload a folder's script and publish it (--draft to test first; shortcut: ${brand.name} publish)`
10507
+ definePublish("publish")(group.command("publish [dir...]"), ctx).description(
10508
+ `Upload a folder's script and publish it, so runs use that version. Shortcut: ${brand.name} publish`
10509
+ );
10510
+ definePublish("publish")(
10511
+ program3.command("publish [dir...]"),
10512
+ ctx
10513
+ ).description(
10514
+ `Upload a folder's script and publish it. Short for ${brand.name} scripts publish`
10515
+ );
10516
+ definePublish("upload")(group.command("upload [dir...]"), ctx).description(
10517
+ `Upload a folder's script as a draft version, to test before publishing (shortcut: ${brand.name} upload)`
10051
10518
  );
10052
- definePublish(program3.command("publish [dir...]"), ctx).description(
10053
- `Short for ${brand.name} scripts publish: upload a folder's script and publish it (--draft to test first)`
10519
+ definePublish("upload")(program3.command("upload [dir...]"), ctx).description(
10520
+ `Upload a folder's script as a draft version. Short for ${brand.name} scripts upload`
10054
10521
  );
10055
10522
  defineRun(group.command("run <slug>"), ctx).description(
10056
- `Run a script and print its output (--number to test a draft; shortcut: ${brand.name} run)`
10523
+ `Run a script and print its output. Use --number to test a draft. Shortcut: ${brand.name} run`
10057
10524
  );
10058
10525
  defineRun(program3.command("run <slug>"), ctx).description(
10059
- `Short for ${brand.name} scripts run: run a script and print its output (--number to test a draft)`
10526
+ `Run a script and print its output. Use --number to test a draft. Short for ${brand.name} scripts run`
10060
10527
  );
10061
10528
  };
10062
10529
 
10063
10530
  // src/product/init.ts
10064
- import { existsSync as existsSync4, readdirSync as readdirSync2, writeFileSync as writeFileSync5 } from "node:fs";
10065
- import { basename as basename3, extname, join as join4, resolve as resolve3 } from "node:path";
10066
- function slugFrom(name) {
10067
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^[^a-z]+/, "").replace(/-+$/, "").slice(0, 64).replace(/-+$/, "");
10068
- return slug.length >= 2 ? slug : "my-script";
10069
- }
10070
- var titleFrom = (slug) => slug.split("-").filter(Boolean).map((w, i) => i === 0 ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
10071
- function programFor(file) {
10072
- const ext = extname(file).toLowerCase();
10073
- if (ext === ".py") return "python";
10074
- if ([".js", ".mjs", ".cjs", ".ts", ".mts"].includes(ext)) return "node";
10075
- if (ext === ".sh") return "sh";
10076
- if (ext === "") return `./${file}`;
10077
- throw new Error(
10078
- `${file}: say how to run it, like: ${brand.name} init "python ${file} --month {month}"`
10079
- );
10080
- }
10081
- var SCRIPT_FILE = /\.(py|sh|js|mjs|cjs|ts|mts)$/i;
10082
- var NOT_A_SCRIPT2 = /(\.config\.|^setup\.py$|^conftest\.py$|\.d\.ts$)/i;
10083
- function onlyScript(dir) {
10084
- const files = readdirSync2(dir).filter(
10085
- (f) => SCRIPT_FILE.test(f) && !NOT_A_SCRIPT2.test(f)
10086
- );
10087
- if (files.length !== 1) {
10531
+ import { closeSync as closeSync2, openSync as openSync2, unlinkSync, writeFileSync as writeFileSync5 } from "node:fs";
10532
+ import { basename as basename3, join as join4, resolve as resolve3 } from "node:path";
10533
+ var INIT_HELP = `Say which file and how it runs, like: ${brand.name} init "python report.py --month {month}"`;
10534
+ function commandFor(dir, given) {
10535
+ const line = given?.trim();
10536
+ if (line && /\s|\{/.test(line)) return line;
10537
+ const folder = localFolder(dir, line ? [line] : scriptFiles(dir));
10538
+ const detection = detectScript(folder);
10539
+ if (!detection.ok) {
10088
10540
  throw new Error(
10089
- `${files.length === 0 ? "No script file here" : `Several script files here (${files.join(", ")})`} \u2014 say which and how it runs, like: ${brand.name} init "python report.py --month {month}"`
10541
+ `${detection.error.replace(/ Pass --command .*$/, "")} ${INIT_HELP}`
10090
10542
  );
10091
10543
  }
10092
- return files[0];
10093
- }
10094
- function commandFor(dir, given) {
10095
- const line = given?.trim() || onlyScript(dir);
10096
- return /\s|\{/.test(line) ? line : `${programFor(line)} ${line}`;
10544
+ return detection.value.command;
10097
10545
  }
10098
10546
  function inputSchemaFor(command) {
10099
- const optional2 = new Set(
10100
- [...command.matchAll(/\[[^\]]*\]/g)].flatMap(
10101
- (group) => [...group[0].matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10102
- )
10103
- );
10104
- const names = [
10105
- ...new Set(
10106
- [...command.matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10107
- )
10108
- ];
10547
+ const schema = inputSchemaForCommand(command);
10109
10548
  return {
10110
- type: "object",
10111
- required: names.filter((name) => !optional2.has(name)),
10549
+ ...schema,
10112
10550
  properties: Object.fromEntries(
10113
- names.map((name) => [name, { type: "string", description: "" }])
10551
+ Object.entries(schema.properties).map(([name, property]) => [
10552
+ name,
10553
+ { ...property, description: "" }
10554
+ ])
10114
10555
  )
10115
10556
  };
10116
10557
  }
10558
+ function createNew(path2) {
10559
+ try {
10560
+ return openSync2(path2, "wx");
10561
+ } catch (error) {
10562
+ if (error.code === "EEXIST") return null;
10563
+ throw error;
10564
+ }
10565
+ }
10117
10566
  function scaffold(dir, given) {
10118
10567
  const manifest = join4(dir, "reminix.json");
10119
- if (existsSync4(manifest)) {
10120
- throw new Error(`${manifest} already exists`);
10568
+ const alreadyExists = () => new Error(`${manifest} already exists`);
10569
+ let command;
10570
+ try {
10571
+ command = commandFor(dir, given);
10572
+ } catch (error) {
10573
+ let probe;
10574
+ try {
10575
+ probe = createNew(manifest);
10576
+ } catch {
10577
+ throw error;
10578
+ }
10579
+ if (probe === null) throw alreadyExists();
10580
+ closeSync2(probe);
10581
+ unlinkSync(manifest);
10582
+ throw error;
10121
10583
  }
10122
- const command = commandFor(dir, given);
10123
- const slug = slugFrom(basename3(resolve3(dir)));
10124
- const created = [];
10125
- writeFileSync5(
10584
+ const detected = detectScript(localFolder(dir, scriptFiles(dir)));
10585
+ const slug = (detected.ok ? detected.value.slug : void 0) ?? slugOf(basename3(resolve3(dir))) ?? "my-script";
10586
+ writeNew(
10126
10587
  manifest,
10127
10588
  `${JSON.stringify(
10128
10589
  {
10129
10590
  slug,
10130
- name: titleFrom(slug),
10591
+ name: titleOf(slug),
10131
10592
  description: "",
10132
10593
  command,
10133
10594
  tags: [],
@@ -10137,21 +10598,30 @@ function scaffold(dir, given) {
10137
10598
  null,
10138
10599
  2
10139
10600
  )}
10140
- `
10601
+ `,
10602
+ alreadyExists
10141
10603
  );
10142
- created.push("reminix.json");
10143
- if (!existsSync4(join4(dir, "README.md"))) {
10144
- writeFileSync5(
10145
- join4(dir, "README.md"),
10146
- `# ${titleFrom(slug)}
10604
+ const created = ["reminix.json"];
10605
+ const readme = `# ${titleOf(slug)}
10147
10606
 
10148
10607
  What it does, when to use it, and what its inputs mean.
10149
- `
10150
- );
10151
- created.push("README.md");
10152
- }
10608
+ `;
10609
+ if (writeNew(join4(dir, "README.md"), readme)) created.push("README.md");
10153
10610
  return created;
10154
10611
  }
10612
+ function writeNew(path2, content, onExists) {
10613
+ const fd = createNew(path2);
10614
+ if (fd === null) {
10615
+ if (onExists) throw onExists();
10616
+ return false;
10617
+ }
10618
+ try {
10619
+ writeFileSync5(fd, content);
10620
+ } finally {
10621
+ closeSync2(fd);
10622
+ }
10623
+ return true;
10624
+ }
10155
10625
  var initCommand = (program3, ctx) => {
10156
10626
  program3.command("init [command]").description("Make the script in this folder a Reminix script").addHelpText(
10157
10627
  "after",
@@ -10170,7 +10640,10 @@ var secretCommands = (program3, ctx) => {
10170
10640
  group.command("set <name>").description("Save a secret's value, read from stdin").requiredOption(
10171
10641
  "--hosts <hosts>",
10172
10642
  "the hosts it may be sent to, comma-separated (e.g. api.stripe.com)"
10173
- ).option("--allow-env", "let scripts read the value itself (off by default)").option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").action(
10643
+ ).option(
10644
+ "--allow-env-var",
10645
+ "let scripts read the value as an environment variable (off by default)"
10646
+ ).option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").action(
10174
10647
  async (name, options) => {
10175
10648
  const value = (await ctx.io.stdin()).replace(/\r?\n$/, "");
10176
10649
  if (!value) {
@@ -10184,7 +10657,7 @@ var secretCommands = (program3, ctx) => {
10184
10657
  body: {
10185
10658
  value,
10186
10659
  hosts: options.hosts.split(",").map((h) => h.trim()).filter(Boolean),
10187
- allowEnv: options.allowEnv ?? false
10660
+ allowEnvVar: options.allowEnvVar ?? false
10188
10661
  },
10189
10662
  workspace: options.workspace
10190
10663
  });
@@ -10215,7 +10688,7 @@ function tokenEnvVar() {
10215
10688
  function build(io) {
10216
10689
  let actedIn = null;
10217
10690
  let sending;
10218
- const program3 = new Command().name(brand.name).description(`${brand.productName} command line`).version("1.0.0-rc.6").addHelpText(
10691
+ const program3 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version("1.0.0-rc.8").addHelpText(
10219
10692
  "after",
10220
10693
  `
10221
10694
  Token: \`${brand.name} login\` stores it in ~/.config/${brand.name}/; ${tokenEnvVar()} overrides.
@@ -10239,7 +10712,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
10239
10712
  const settings = ctx.settings();
10240
10713
  if (!settings.token) {
10241
10714
  throw new Error(
10242
- `not logged in \u2014 run \`${brand.name} login\` or set ${tokenEnvVar()}`
10715
+ `not logged in. Run \`${brand.name} login\` or set ${tokenEnvVar()}.`
10243
10716
  );
10244
10717
  }
10245
10718
  if (!settings.token.startsWith("pat_")) {
@@ -10258,7 +10731,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
10258
10731
  const workspace2 = options.workspace === false ? void 0 : options.workspace ?? settings.workspace;
10259
10732
  if (options.workspace !== false && !workspace2) {
10260
10733
  throw new Error(
10261
- `no workspace selected \u2014 \`${brand.name} workspace use <slug>\` or pass --workspace <slug>`
10734
+ `no workspace selected. Run \`${brand.name} workspace use <slug>\` or pass --workspace <slug>.`
10262
10735
  );
10263
10736
  }
10264
10737
  return {