@madewithremy/admin 0.1.32 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/prod.js CHANGED
@@ -1019,13 +1019,6 @@ async function dashboardLive(ctx) {
1019
1019
  );
1020
1020
  return dashboard.liveRelease;
1021
1021
  }
1022
- function buildFailureReason(release) {
1023
- const log = Array.isArray(release.buildLog) ? release.buildLog : [];
1024
- const errors = log.filter(
1025
- (entry) => entry?.phase === "error" && typeof entry.message === "string"
1026
- );
1027
- return errors.length ? errors[errors.length - 1].message : null;
1028
- }
1029
1022
  function summarizeRelease(release) {
1030
1023
  const summary2 = {
1031
1024
  releaseId: release.id,
@@ -1048,7 +1041,7 @@ function summarizeRelease(release) {
1048
1041
  }
1049
1042
  return {
1050
1043
  ...summary2,
1051
- error: release.failureReason ?? buildFailureReason(release) ?? "Build failed (no error entry in the build log)",
1044
+ error: release.failureReason ?? "Build failed (no error entry in the build log)",
1052
1045
  ...release.failureKind ? { failureKind: release.failureKind } : {},
1053
1046
  ...release.failurePhase ? { failurePhase: release.failurePhase } : {}
1054
1047
  };
@@ -3171,6 +3164,7 @@ var summarize = (d) => ({
3171
3164
  });
3172
3165
  async function addDocument(ctx, params) {
3173
3166
  const { slug, filename, content, metadata, entities: entities2, onProgress } = params;
3167
+ const { budgetDollars } = params;
3174
3168
  const contentHash = createHash2("sha256").update(content).digest("hex");
3175
3169
  const token = await call(
3176
3170
  ctx,
@@ -3186,11 +3180,13 @@ async function addDocument(ctx, params) {
3186
3180
  );
3187
3181
  if (token.alreadyCurrent) {
3188
3182
  onProgress?.(`${filename}: unchanged, skipped`);
3183
+ const documents3 = token.documents ?? [token.document];
3189
3184
  return {
3190
3185
  filename,
3191
3186
  skipped: true,
3192
3187
  document: token.document,
3193
- documents: token.documents ?? [token.document]
3188
+ documents: documents3,
3189
+ documentCount: token.documentCount ?? documents3.length
3194
3190
  };
3195
3191
  }
3196
3192
  onProgress?.(
@@ -3208,16 +3204,21 @@ async function addDocument(ctx, params) {
3208
3204
  contentType: token.contentType,
3209
3205
  size: content.length,
3210
3206
  ...metadata ? { metadata } : {},
3211
- ...entities2 ? { entities: entities2 } : {}
3207
+ ...entities2 ? { entities: entities2 } : {},
3208
+ ...budgetDollars !== void 0 ? { budgetDollars } : {}
3212
3209
  }
3213
3210
  );
3211
+ const documents2 = confirmed.documents ?? (confirmed.document ? [confirmed.document] : []);
3214
3212
  return {
3215
3213
  filename,
3216
3214
  skipped: false,
3217
3215
  queued: confirmed.queued,
3218
3216
  document: confirmed.document,
3219
- documents: confirmed.documents ?? (confirmed.document ? [confirmed.document] : []),
3220
- outcome: confirmed.outcome
3217
+ documents: documents2,
3218
+ documentCount: confirmed.documentCount ?? documents2.length,
3219
+ outcome: confirmed.outcome,
3220
+ invalid: confirmed.invalid ?? null,
3221
+ job: confirmed.job ?? null
3221
3222
  };
3222
3223
  }
3223
3224
  async function waitForIngest(ctx, params) {
@@ -5583,14 +5584,21 @@ Mapping raw objects into documents (mappers):
5583
5584
  map(object) reads the raw object (object.key, .bytes(), .text(), .json())
5584
5585
  and answers documents([{ externalId, title, markdown, metadata?, replaces? }]),
5585
5586
  passthrough() (ingest the raw object as-is), skip(reason) or
5586
- deletes([externalId, ...]); throwing is the object's error. It may call
5587
- models or fetch \u2014 every call is spend per object. Everything entering a
5588
- mapped source is mapped: jobs, syncs and Source.add() alike.
5587
+ deletes([externalId, ...]); throwing is the object's error. documents()
5588
+ takes an array or any iterable, with no cap: the platform stores what it
5589
+ produces as it goes, so a generator yielding a document per row streams an
5590
+ export of any size. It may call models or fetch \u2014 every call is spend per
5591
+ object. Everything entering
5592
+ a mapped source is mapped: jobs, syncs and Source.add() alike; an add() of
5593
+ an object mapping to more than a thousand documents registers the first
5594
+ thousand and hands the rest to a job (\`datasources add --budget\` caps it).
5589
5595
 
5590
5596
  The loop: \`inspect\` profiles the objects (key shapes, extensions, sizes,
5591
5597
  JSON key signatures of ten sampled heads) before a line is written;
5592
5598
  \`map test --dev\` runs the LOCAL mapper through the running dev session
5593
- over real objects and prints every outcome without ingesting anything;
5599
+ over real objects and prints every outcome without ingesting anything
5600
+ (each object's count, its first documents, and every document that fails
5601
+ validation, by its place in the mapper's output);
5594
5602
  push a branch and wait for its build (\`releases wait\`) \u2014 a mapper runs on
5595
5603
  the platform, so the platform has to compile it, and a private branch
5596
5604
  build is all it needs; \`map deploy\` makes that build's mapper the
@@ -5609,7 +5617,11 @@ Mapping raw objects into documents (mappers):
5609
5617
  ids this document supersedes (a writethru's original); deletes([...])
5610
5618
  removes by id. A plan on a mapped source records the mapper's outcome mix
5611
5619
  on its sample; a run whose skip share climbs past twice that (floor 5%)
5612
- pauses with pauseReason 'skips' for a look at the quarantine.
5620
+ pauses with pauseReason 'skips' for a look at the quarantine. Documents
5621
+ that fail validation are left out and their object gets one quarantine row
5622
+ naming them; the rest register. A mapper built with an older
5623
+ @mindstudio-ai/agent, which returns documents inline, errors every
5624
+ documents outcome until it is upgraded, pushed and map deployed.
5613
5625
  `;
5614
5626
 
5615
5627
  // src/ops/dataSourceReaders.ts
@@ -5870,12 +5882,13 @@ var CONFIG_FLAGS = {
5870
5882
  };
5871
5883
  var dataSourcesSpecs = {
5872
5884
  "datasources add": {
5873
- usage: "Usage: remy-admin datasources add [--source <slug>] [--metadata <k=v,...>] [--entities <id,...>] [--wait] [--timeout <sec>] <file...>",
5885
+ usage: "Usage: remy-admin datasources add [--source <slug>] [--metadata <k=v,...>] [--entities <id,...>] [--budget <dollars>] [--wait] [--timeout <sec>] <file...>",
5874
5886
  positionals: [{ name: "file", required: true, variadic: true }],
5875
5887
  flags: {
5876
5888
  source: { type: "string" },
5877
5889
  metadata: { type: "string" },
5878
5890
  entities: { type: "string" },
5891
+ budget: { type: "number", min: 0.01 },
5879
5892
  wait: { type: "boolean" },
5880
5893
  timeout: { type: "string" }
5881
5894
  }
@@ -6019,6 +6032,7 @@ async function dataSourcesAdd(ctx, a) {
6019
6032
  const slug = sourceOf(a);
6020
6033
  const metadata = parseKeyValuePairs(a.str("metadata"), "metadata");
6021
6034
  const entities2 = parseIdList(a.str("entities"));
6035
+ const budgetDollars = a.num("budget");
6022
6036
  const results = [];
6023
6037
  for (const file of files) {
6024
6038
  const abs = path6.isAbsolute(file) ? file : path6.join(WORKSPACE_DIR, file);
@@ -6036,10 +6050,22 @@ async function dataSourcesAdd(ctx, a) {
6036
6050
  content: bytes,
6037
6051
  ...metadata ? { metadata } : {},
6038
6052
  ...entities2 ? { entities: entities2 } : {},
6053
+ ...budgetDollars !== void 0 ? { budgetDollars } : {},
6039
6054
  onProgress: progress
6040
6055
  })
6041
6056
  );
6042
6057
  }
6058
+ const jobs = results.flatMap(
6059
+ (r) => r.job ? [
6060
+ {
6061
+ file: r.filename,
6062
+ documents: r.documentCount,
6063
+ job: r.job.id,
6064
+ state: r.job.state,
6065
+ follow: `remy-admin datasources jobs status ${r.job.id}`
6066
+ }
6067
+ ] : []
6068
+ );
6043
6069
  if (a.bool("wait")) {
6044
6070
  const timeoutSec = a.num("timeout");
6045
6071
  const timeoutMs = timeoutSec ? timeoutSec * 1e3 : DEFAULT_WAIT_TIMEOUT_MS;
@@ -6055,7 +6081,8 @@ async function dataSourcesAdd(ctx, a) {
6055
6081
  dataSource: slug,
6056
6082
  status: result.status,
6057
6083
  ...result.error ? { error: result.error } : {},
6058
- documents: result.documents
6084
+ documents: result.documents,
6085
+ ...jobs.length > 0 ? { jobs } : {}
6059
6086
  });
6060
6087
  if (result.status === "timeout") {
6061
6088
  throw new CliError(result.error ?? "Timed out.", EXIT.timeout);
@@ -6065,7 +6092,11 @@ async function dataSourcesAdd(ctx, a) {
6065
6092
  }
6066
6093
  return;
6067
6094
  }
6068
- out({ dataSource: slug, documents: results });
6095
+ out({
6096
+ dataSource: slug,
6097
+ documents: results.map(({ job, ...r }) => r),
6098
+ ...jobs.length > 0 ? { jobs } : {}
6099
+ });
6069
6100
  }
6070
6101
  async function dataSourcesList(ctx) {
6071
6102
  out(await list8(ctx));
@@ -6516,7 +6547,7 @@ Subcommands:
6516
6547
  delete Delete a whole data source \u2014 documents, vectors and versions
6517
6548
 
6518
6549
  Usage:
6519
- remy-admin datasources add [--source <slug>] [--metadata <k=v,...>] [--entities <id,...>] [--wait] [--timeout <sec>] <file...>
6550
+ remy-admin datasources add [--source <slug>] [--metadata <k=v,...>] [--entities <id,...>] [--budget <dollars>] [--wait] [--timeout <sec>] <file...>
6520
6551
  remy-admin datasources list
6521
6552
  remy-admin datasources status [--source <slug>] [--status error] [--all]
6522
6553
  remy-admin datasources rm [--source <slug>] (--document <id> | --filter <k=v,...|json>)
@@ -6657,6 +6688,10 @@ Notes:
6657
6688
  --metadata tags documents for search-time filtering (scalars, \u226416 keys).
6658
6689
  --entities names what a document is about, as your own ids (\u2264256, no spaces
6659
6690
  or commas); an empty --entities clears them. Also free on a re-add.
6691
+ On a mapped source, a file that maps to more than a thousand documents adds
6692
+ the first thousand and starts a job for the rest, listed under \`jobs\` in
6693
+ the output; --budget caps that job. --wait waits for the first thousand;
6694
+ follow the job with \`jobs status <id> --wait\`.
6660
6695
  rm --filter removes every matching document in pages of a thousand: k=v
6661
6696
  pairs match metadata; a JSON object takes the full selector \u2014 metadata,
6662
6697
  filename, documentIds, externalIdPrefix (the key a job or connector
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madewithremy/admin",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "Admin SDK + CLI for managing production Remy apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",