@ancha-labs/cli 0.4.23 → 0.4.25

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.
@@ -943,6 +943,8 @@ button.k-name{all:unset;cursor:pointer;font-weight:500;color:var(--k-ink);overfl
943
943
  button.k-name:focus-visible{outline:2px solid var(--k-ink);outline-offset:2px;border-radius:4px}
944
944
  .k-table a.k-quiet{color:var(--k-mid);text-decoration:none}.k-table a.k-quiet:hover{color:var(--k-ink);text-decoration:underline}
945
945
  .k-id{font-family:var(--k-mono);font-size:12.5px;color:var(--k-mid)}
946
+ /* At most two lines of a long value (a multi-line agent command); the whole value is in its title. */
947
+ .k-clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
946
948
 
947
949
  /* Badges (radius 4) and status icons: pass with a check, fail with an ×, no result with a !. */
948
950
  .k-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:4px;background:var(--k-neutral-tint);color:var(--k-soft);font-size:12px;font-weight:600;line-height:1.35;white-space:nowrap;vertical-align:middle}
package/lib/mcp-entry.mjs CHANGED
@@ -28092,8 +28092,8 @@ function stampErrorBrands(instance, ctor) {
28092
28092
  const brands = /* @__PURE__ */ new Set();
28093
28093
  let current = ctor;
28094
28094
  while (typeof current === "function") {
28095
- const brand = current.mcpBrand;
28096
- if (Object.prototype.hasOwnProperty.call(current, "mcpBrand") && typeof brand === "string") brands.add(brand);
28095
+ const brand2 = current.mcpBrand;
28096
+ if (Object.prototype.hasOwnProperty.call(current, "mcpBrand") && typeof brand2 === "string") brands.add(brand2);
28097
28097
  current = Object.getPrototypeOf(current);
28098
28098
  }
28099
28099
  if (brands.size === 0) return;
@@ -44403,8 +44403,8 @@ function stampErrorBrands2(instance, ctor) {
44403
44403
  const brands = /* @__PURE__ */ new Set();
44404
44404
  let current = ctor;
44405
44405
  while (typeof current === "function") {
44406
- const brand = current.mcpBrand;
44407
- if (Object.prototype.hasOwnProperty.call(current, "mcpBrand") && typeof brand === "string") brands.add(brand);
44406
+ const brand2 = current.mcpBrand;
44407
+ if (Object.prototype.hasOwnProperty.call(current, "mcpBrand") && typeof brand2 === "string") brands.add(brand2);
44408
44408
  current = Object.getPrototypeOf(current);
44409
44409
  }
44410
44410
  if (brands.size === 0) return;
@@ -57470,12 +57470,33 @@ var AnswerNumberSchema = external_exports.strictObject({
57470
57470
  tolerance: external_exports.number().nonnegative().optional().describe("How far the stated number may be from value; default: half the last decimal place of value (1200.00 \u2192 0.005, 1240.5 \u2192 0.05, 1200 \u2192 0.5)")
57471
57471
  });
57472
57472
  var texts = external_exports.union([external_exports.string().min(1), external_exports.array(external_exports.string().min(1)).min(1)]);
57473
+ var AnswerRowSchema = external_exports.record(external_exports.string().min(1), external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()])).superRefine((row, ctx) => {
57474
+ if (!Object.keys(row).length) ctx.addIssue({ code: "custom", message: "a row needs at least one column" });
57475
+ if (Object.hasOwn(row, "amount_minor")) {
57476
+ if (!Number.isSafeInteger(row.amount_minor)) ctx.addIssue({ code: "custom", path: ["amount_minor"], message: "amount_minor must be a safe integer in minor units" });
57477
+ if (typeof row.currency !== "string" || !/^[A-Z]{3}$/.test(row.currency)) ctx.addIssue({ code: "custom", path: ["currency"], message: "amount_minor requires an explicit three-letter uppercase currency" });
57478
+ }
57479
+ });
57480
+ var AnswerRowsSchema = external_exports.strictObject({
57481
+ field: external_exports.string().min(1).describe("The top-level answer field containing the rows"),
57482
+ expected: external_exports.array(AnswerRowSchema).describe("Exact rows, compared as an unordered multiset with exact columns and values")
57483
+ }).superRefine(({ expected }, ctx) => {
57484
+ const columns = JSON.stringify(Object.keys(expected[0] ?? {}).sort());
57485
+ expected.forEach((row, i) => {
57486
+ if (JSON.stringify(Object.keys(row).sort()) !== columns) ctx.addIssue({ code: "custom", path: ["expected", i], message: "every expected row must have the same columns" });
57487
+ });
57488
+ });
57473
57489
  var AnswerCheckSchema = external_exports.strictObject({
57474
57490
  contains: texts.optional().describe("Text the final answer must contain, each piece"),
57475
57491
  not_contains: texts.optional().describe("Text the final answer must not contain"),
57476
57492
  numbers: external_exports.array(AnswerNumberSchema).min(1).optional().describe("Numbers the final answer must state, each within its tolerance; thousands separators, currency codes and symbols, minus signs and parentheses for negatives are read"),
57477
- case: external_exports.enum(["insensitive", "sensitive"]).optional().describe("How contains and not_contains compare letters; default insensitive")
57478
- }).describe("Checks the agent's final answer (what it posts to ANCHA_DONE_URL, its HTTP reply, or what it prints on stdout): the text and numbers it states");
57493
+ case: external_exports.enum(["insensitive", "sensitive"]).optional().describe("How contains and not_contains compare letters; default insensitive"),
57494
+ rows: AnswerRowsSchema.optional()
57495
+ }).superRefine((check3, ctx) => {
57496
+ if (check3.rows !== void 0) for (const key2 of ["contains", "not_contains", "numbers", "case"]) {
57497
+ if (check3[key2] !== void 0) ctx.addIssue({ code: "custom", path: [key2], message: `rows is mutually exclusive with ${key2}` });
57498
+ }
57499
+ }).describe("Checks the agent's final answer (what it posts to ANCHA_DONE_URL, its HTTP reply, or what it prints on stdout): text and numbers, or exact structured rows");
57479
57500
 
57480
57501
  // packages/core/src/duration.ts
57481
57502
  var DURATION_RE = /^(-?)(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;
@@ -57590,15 +57611,15 @@ var ChatGPTAdsSeedSchema = external_exports.strictObject({
57590
57611
  });
57591
57612
  });
57592
57613
  function chatGPTAdsStarterSeed() {
57593
- const created = Date.parse("2026-10-20T16:00:00Z") / 1e3;
57614
+ const created2 = Date.parse("2026-10-20T16:00:00Z") / 1e3;
57594
57615
  return ChatGPTAdsSeedSchema.parse({
57595
57616
  accounts: [{ id: "adacct_acme", name: "Acme", url: "https://acme.example", status: "active", timezone: "America/Los_Angeles", currency_code: "USD", review: { status: "approved" }, integrityReview: { status: "approved" } }, { id: "adacct_helix", name: "Helix Manufacturing", url: "https://helix-manufacturing.example", status: "active", timezone: "UTC", currency_code: "USD", review: { status: "approved" }, integrityReview: { status: "approved" } }],
57596
57617
  principals: [{ id: "acme-editor", accountId: "adacct_acme" }, { id: "helix-editor", accountId: "adacct_helix" }],
57597
57618
  actor: "acme-editor",
57598
57619
  files: [{ id: "file_acme_card", accountId: "adacct_acme", width: 1024, height: 1024, mimeType: "image/png" }, { id: "file_helix_card", accountId: "adacct_helix", width: 1024, height: 1024, mimeType: "image/png" }],
57599
- campaigns: [{ id: "cmpn_acme_pilot", accountId: "adacct_acme", name: "Ridgeway Robotics Q4 pilot", status: "active", created_at: created, updated_at: created, budget: { daily_spend_limit_micros: 5e7 }, bidding_type: "clicks", targeting: { locations: { countries: ["US"] }, platforms: { included: ["web"] } } }, { id: "cmpn_helix_private", accountId: "adacct_helix", name: "Helix private campaign", status: "paused", created_at: created, updated_at: created, budget: { lifetime_spend_limit_micros: 1e8 }, bidding_type: "clicks" }],
57600
- adGroups: [{ id: "adgrp_acme_revenue", accountId: "adacct_acme", campaign_id: "cmpn_acme_pilot", name: "Revenue operations", status: "active", created_at: created, updated_at: created, context_hints: ["Account-level pipeline reporting for revenue operations"], bidding_config: { billing_event_type: "click", strategy: "fixed_bid", max_bid_micros: 2e6 } }],
57601
- ads: [{ id: "ad_acme_reporting", accountId: "adacct_acme", ad_group_id: "adgrp_acme_revenue", name: "Pipeline clarity", status: "active", created_at: created, updated_at: created, creative: { type: "chat_card", title: "See the pipeline behind your campaigns", body: "Connect campaign activity to qualified opportunities.", target_url: "https://acme.example/pilot", file_id: "file_acme_card" }, review: { status: "approved" } }, { id: "ad_acme_pending", accountId: "adacct_acme", ad_group_id: "adgrp_acme_revenue", name: "Pilot invitation", status: "active", created_at: created, updated_at: created, creative: { type: "chat_card", title: "Start with a focused pilot", body: "Evaluate account-level reporting with your team.", target_url: "https://acme.example/pilot", file_id: "file_acme_card" }, review: { status: "in_review" }, reviewAfterMs: 12e4, reviewOutcome: "approved" }],
57620
+ campaigns: [{ id: "cmpn_acme_pilot", accountId: "adacct_acme", name: "Ridgeway Robotics Q4 pilot", status: "active", created_at: created2, updated_at: created2, budget: { daily_spend_limit_micros: 5e7 }, bidding_type: "clicks", targeting: { locations: { countries: ["US"] }, platforms: { included: ["web"] } } }, { id: "cmpn_helix_private", accountId: "adacct_helix", name: "Helix private campaign", status: "paused", created_at: created2, updated_at: created2, budget: { lifetime_spend_limit_micros: 1e8 }, bidding_type: "clicks" }],
57621
+ adGroups: [{ id: "adgrp_acme_revenue", accountId: "adacct_acme", campaign_id: "cmpn_acme_pilot", name: "Revenue operations", status: "active", created_at: created2, updated_at: created2, context_hints: ["Account-level pipeline reporting for revenue operations"], bidding_config: { billing_event_type: "click", strategy: "fixed_bid", max_bid_micros: 2e6 } }],
57622
+ ads: [{ id: "ad_acme_reporting", accountId: "adacct_acme", ad_group_id: "adgrp_acme_revenue", name: "Pipeline clarity", status: "active", created_at: created2, updated_at: created2, creative: { type: "chat_card", title: "See the pipeline behind your campaigns", body: "Connect campaign activity to qualified opportunities.", target_url: "https://acme.example/pilot", file_id: "file_acme_card" }, review: { status: "approved" } }, { id: "ad_acme_pending", accountId: "adacct_acme", ad_group_id: "adgrp_acme_revenue", name: "Pilot invitation", status: "active", created_at: created2, updated_at: created2, creative: { type: "chat_card", title: "Start with a focused pilot", body: "Evaluate account-level reporting with your team.", target_url: "https://acme.example/pilot", file_id: "file_acme_card" }, review: { status: "in_review" }, reviewAfterMs: 12e4, reviewOutcome: "approved" }],
57602
57623
  insights: [{ adId: "ad_acme_reporting", start_time: Date.parse("2026-10-23T16:00:00Z") / 1e3, end_time: Date.parse("2026-10-23T17:00:00Z") / 1e3, impressions: 1200, clicks: 36, spend_micros: 1842e4 }, { adId: "ad_acme_reporting", start_time: Date.parse("2026-10-24T16:00:00Z") / 1e3, end_time: Date.parse("2026-10-24T17:00:00Z") / 1e3, impressions: 980, clicks: 29, spend_micros: 1486e4 }]
57603
57624
  });
57604
57625
  }
@@ -58090,6 +58111,7 @@ var GitHubIssueCheckSchema = external_exports.strictObject({
58090
58111
  body_contains: textList.optional(),
58091
58112
  labels: external_exports.array(external_exports.string().min(1)).min(1).optional().describe("The issue has every one of these labels"),
58092
58113
  state: external_exports.enum(["open", "closed"]).optional(),
58114
+ state_reason: external_exports.enum(["completed", "not_planned", "duplicate", "reopened"]).nullable().optional().describe("The issue state reason, or null after clearing"),
58093
58115
  count: external_exports.number().int().min(0).optional().describe("Exactly this many issues match"),
58094
58116
  count_gte: external_exports.number().int().min(0).optional(),
58095
58117
  count_lte: external_exports.number().int().min(0).optional()
@@ -58806,11 +58828,11 @@ var GoogleDriveSeedSchema = external_exports.strictObject({
58806
58828
  if (grant.email === entry2.owner) issue2(at("permissions", j, "email"), "the owner already has the owner role");
58807
58829
  }
58808
58830
  });
58809
- const created = parseDuration(entry2.created);
58831
+ const created2 = parseDuration(entry2.created);
58810
58832
  entry2.comments.forEach((thread, j) => {
58811
58833
  known(thread.author, at("comments", j, "author"));
58812
58834
  const commented = parseDuration(thread.at);
58813
- if (commented < created) issue2(at("comments", j, "at"), "comment is older than its file");
58835
+ if (commented < created2) issue2(at("comments", j, "at"), "comment is older than its file");
58814
58836
  thread.replies.forEach((answer, k) => {
58815
58837
  known(answer.author, at("comments", j, "replies", k, "author"));
58816
58838
  if (parseDuration(answer.at) < commented) issue2(at("comments", j, "replies", k, "at"), "reply is older than its comment");
@@ -59927,6 +59949,7 @@ var moment = external_exports.string().refine(
59927
59949
  "expected an ISO 8601 time with a timezone, or an offset from the start of the test such as 72h or -24h"
59928
59950
  );
59929
59951
  var StripeSeedSchema = external_exports.strictObject({
59952
+ livemode: external_exports.boolean().optional().describe("Defaults to true; false selects a test account and test-card defaults"),
59930
59953
  account: external_exports.strictObject({ name: text8, currency: external_exports.enum(["usd", "eur", "gbp", "cad", "aud"]).default("usd"), statement_descriptor: external_exports.string().regex(/^[A-Za-z0-9 .-]{5,22}$/).optional() }),
59931
59954
  /** Funds on the account, in the account currency. */
59932
59955
  balance: external_exports.strictObject({ available: amount.default(0), pending: amount.default(0) }).default({ available: 0, pending: 0 }),
@@ -59957,12 +59980,18 @@ var StripeSeedSchema = external_exports.strictObject({
59957
59980
  balance: external_exports.number().int().min(-99999999).max(99999999).default(0),
59958
59981
  created: past,
59959
59982
  invoice_prefix: external_exports.string().regex(/^[A-Z0-9]{3,12}$/).optional(),
59983
+ /** Cash held separately from the customer's invoice credit balance. */
59984
+ cash_balance: external_exports.strictObject({
59985
+ available: external_exports.partialRecord(external_exports.enum(["usd", "eur", "gbp", "cad", "aud"]), amount).optional(),
59986
+ reconciliation_mode: external_exports.enum(["automatic", "manual"]).default("automatic")
59987
+ }).optional(),
59960
59988
  /** The default payment method; `decline` makes every charge to it fail with that decline code. */
59961
59989
  card: external_exports.strictObject({
59962
59990
  brand: external_exports.enum(["visa", "mastercard", "amex"]),
59963
59991
  last4: external_exports.string().regex(/^\d{4}$/),
59964
59992
  exp_month: external_exports.number().int().min(1).max(12),
59965
59993
  exp_year: external_exports.number().int().min(2020).max(2099),
59994
+ fingerprint: external_exports.string().regex(/^[A-Za-z0-9]{1,64}$/).optional(),
59966
59995
  decline: external_exports.enum(["generic_decline", "insufficient_funds", "expired_card"]).optional()
59967
59996
  }).optional()
59968
59997
  })).max(2e3).default([]),
@@ -60022,6 +60051,26 @@ var StripeSeedSchema = external_exports.strictObject({
60022
60051
  receipt_email: external_exports.string().regex(EMAIL3).optional(),
60023
60052
  metadata
60024
60053
  })).max(5e3).default([]),
60054
+ /** Credit notes on paid invoices, credited to the customer's invoice balance. */
60055
+ credit_notes: external_exports.array(external_exports.strictObject({
60056
+ ref: ref9,
60057
+ invoice: ref9,
60058
+ amount: amount.min(1),
60059
+ created: past,
60060
+ memo: external_exports.string().max(500).optional(),
60061
+ reason: external_exports.enum(["duplicate", "fraudulent", "order_change", "product_unsatisfactory"]).optional(),
60062
+ metadata
60063
+ })).max(5e3).optional(),
60064
+ /** Card inquiries do not withdraw funds from the account balance. */
60065
+ disputes: external_exports.array(external_exports.strictObject({
60066
+ ref: ref9,
60067
+ payment: ref9,
60068
+ amount: amount.min(1).optional(),
60069
+ created: past,
60070
+ status: external_exports.enum(["warning_needs_response", "warning_under_review", "warning_closed"]).default("warning_needs_response"),
60071
+ reason: external_exports.enum(["duplicate", "fraudulent", "product_not_received", "product_unacceptable", "subscription_canceled", "unrecognized", "credit_not_processed", "general"]).default("general"),
60072
+ metadata
60073
+ })).max(5e3).optional(),
60025
60074
  refunds: external_exports.array(external_exports.strictObject({
60026
60075
  ref: ref9.optional(),
60027
60076
  /** The ref of a succeeded payment or a paid invoice. */
@@ -60080,11 +60129,46 @@ var StripeSeedSchema = external_exports.strictObject({
60080
60129
  if (p2.customer !== void 0 && refs.get(p2.customer) !== "customer") issue2(["payments", i, "customer"], `unknown customer ${p2.customer}`);
60081
60130
  if (p2.status === "succeeded") paid.add(p2.ref);
60082
60131
  });
60132
+ const credited = /* @__PURE__ */ new Map();
60133
+ seed2.credit_notes?.forEach((n, i) => {
60134
+ declare("credit_note", n.ref, ["credit_notes", i, "ref"]);
60135
+ const inv = seed2.invoices.find((v) => v.ref === n.invoice);
60136
+ if (!inv || inv.status !== "paid") issue2(["credit_notes", i, "invoice"], "credit notes need a paid invoice");
60137
+ const total = inv?.lines.reduce((sum, l) => sum + (l.unit_amount ?? prices.get(l.price)?.unit_amount ?? 0) * l.quantity, 0) ?? 0;
60138
+ const cumulative = (credited.get(n.invoice) ?? 0) + n.amount;
60139
+ credited.set(n.invoice, cumulative);
60140
+ if (cumulative > total) issue2(["credit_notes", i, "amount"], "credit notes exceed the invoice total");
60141
+ });
60142
+ const disputed = /* @__PURE__ */ new Set();
60143
+ seed2.disputes?.forEach((d, i) => {
60144
+ declare("dispute", d.ref, ["disputes", i, "ref"]);
60145
+ if (!paid.has(d.payment)) issue2(["disputes", i, "payment"], "disputes need a succeeded payment or a paid invoice");
60146
+ if (disputed.has(d.payment)) issue2(["disputes", i, "payment"], "a payment can have only one dispute");
60147
+ disputed.add(d.payment);
60148
+ const payment = seed2.payments.find((p2) => p2.ref === d.payment), inv = seed2.invoices.find((v) => v.ref === d.payment);
60149
+ const card = inv ? seed2.customers.find((c) => c.ref === inv.customer)?.card : void 0;
60150
+ if (inv && (card?.decline || seed2.livemode === false && !card)) issue2(["disputes", i, "payment"], "an invoice dispute needs a successful card charge");
60151
+ const total = payment?.amount ?? inv?.lines.reduce((sum, l) => sum + (l.unit_amount ?? prices.get(l.price)?.unit_amount ?? 0) * l.quantity, 0) ?? 0;
60152
+ if (d.amount !== void 0 && d.amount > total) issue2(["disputes", i, "amount"], "dispute amount exceeds the payment");
60153
+ });
60083
60154
  seed2.refunds.forEach((r, i) => {
60084
60155
  declare("refund", r.ref, ["refunds", i, "ref"]);
60085
60156
  if (!paid.has(r.payment)) issue2(["refunds", i, "payment"], "refunds need a succeeded payment or a paid invoice");
60086
60157
  });
60087
60158
  });
60159
+ var objectId = external_exports.string().regex(/^(?:\$(?:[a-z_]+\.)?[A-Za-z0-9_-]{1,80}|[a-z]+_[A-Za-z0-9]+)$/, "expected a native Stripe id or $ref");
60160
+ var StripeObjectTypeSchema = external_exports.enum(["customer", "payment_method", "product", "price", "subscription", "invoice", "invoiceitem", "payment_intent", "charge", "refund"]);
60161
+ var StripeRefundsCheckSchema = external_exports.strictObject({
60162
+ charge: objectId.optional(),
60163
+ payment_intent: objectId.optional(),
60164
+ count: external_exports.number().int().nonnegative().optional(),
60165
+ amount: external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
60166
+ after_start: external_exports.boolean().optional()
60167
+ }).refine((c) => c.charge !== void 0 !== (c.payment_intent !== void 0), "give exactly one of charge or payment_intent").refine((c) => c.count !== void 0 || c.amount !== void 0, "give count, amount, or both");
60168
+ var StripeBalanceCheckSchema = external_exports.strictObject({ customer: objectId, balance: external_exports.number().int().min(-99999999).max(99999999) });
60169
+ var StripeUnchangedCheckSchema = external_exports.strictObject({
60170
+ objects: external_exports.array(external_exports.strictObject({ type: StripeObjectTypeSchema, id: objectId })).min(1).max(1e3)
60171
+ });
60088
60172
  var stripeStarterSeed = {
60089
60173
  account: { name: "Acme", currency: "usd", statement_descriptor: "ACME ANALYTICS" },
60090
60174
  balance: { available: 1284550, pending: 12e4 },
@@ -60097,11 +60181,11 @@ var stripeStarterSeed = {
60097
60181
  { ref: "onboarding", name: "Onboarding package", description: "Two guided setup sessions and a data review", prices: [{ ref: "onboarding_once", unit_amount: 25e4, lookup_key: "onboarding_once" }] }
60098
60182
  ],
60099
60183
  customers: [
60100
- { ref: "pinecrest", name: "Pinecrest Health", email: "nora.bell@pinecrest-health.example", description: "Enterprise, 120 seats from December 1", created: "-30h", invoice_prefix: "PINECRST", metadata: { hubspot_deal: "302" }, card: { brand: "visa", last4: "4242", exp_month: 8, exp_year: 2028 } },
60101
- { ref: "kestrel", name: "Kestrel Credit Union", email: "peter.novak@kestrel-cu.example", description: "Annual contract; invoices must reference their PO", created: "-8760h", invoice_prefix: "KESTREL", metadata: { hubspot_deal: "304" }, card: { brand: "mastercard", last4: "4444", exp_month: 3, exp_year: 2027 } },
60102
- { ref: "helix", name: "Helix Manufacturing", email: "ap@helix-manufacturing.example", description: "Team plan; renewal in 45 days", created: "-7000h", invoice_prefix: "HELIXMFG", card: { brand: "visa", last4: "9995", exp_month: 11, exp_year: 2027, decline: "insufficient_funds" } },
60103
- { ref: "summit", name: "Summit Freight", email: "daniel.reyes@summit-freight.example", created: "-2200h", invoice_prefix: "SUMMITFR", card: { brand: "amex", last4: "8431", exp_month: 5, exp_year: 2029 } },
60104
- { ref: "ridgeway", name: "Ridgeway Robotics", email: "erin.walsh@ridgeway-robotics.example", description: "Pilot", created: "-200h", invoice_prefix: "RIDGEWAY", card: { brand: "visa", last4: "1881", exp_month: 1, exp_year: 2028 } }
60184
+ { ref: "pinecrest", name: "Pinecrest Health", email: "nora.bell@pinecrest-health.com", description: "Enterprise, 120 seats from December 1", created: "-30h", invoice_prefix: "PINECRST", metadata: { hubspot_deal: "302" }, card: { brand: "visa", last4: "7319", exp_month: 8, exp_year: 2028 } },
60185
+ { ref: "kestrel", name: "Kestrel Credit Union", email: "peter.novak@kestrel-cu.com", description: "Annual contract; invoices must reference their PO", created: "-8760h", invoice_prefix: "KESTREL", metadata: { hubspot_deal: "304" }, card: { brand: "mastercard", last4: "6218", exp_month: 3, exp_year: 2027 } },
60186
+ { ref: "helix", name: "Helix Manufacturing", email: "ap@helix-manufacturing.com", description: "Team plan; renewal in 45 days", created: "-7000h", invoice_prefix: "HELIXMFG", card: { brand: "visa", last4: "9027", exp_month: 11, exp_year: 2027, decline: "insufficient_funds" } },
60187
+ { ref: "summit", name: "Summit Freight", email: "daniel.reyes@summit-freight.com", created: "-2200h", invoice_prefix: "SUMMITFR", card: { brand: "amex", last4: "8431", exp_month: 5, exp_year: 2029 } },
60188
+ { ref: "ridgeway", name: "Ridgeway Robotics", email: "erin.walsh@ridgeway-robotics.com", description: "Pilot", created: "-200h", invoice_prefix: "RIDGEWAY", card: { brand: "visa", last4: "1881", exp_month: 1, exp_year: 2028 } }
60105
60189
  ],
60106
60190
  subscriptions: [
60107
60191
  { ref: "pinecrest_seats", customer: "pinecrest", items: [{ price: "enterprise_seat_monthly", quantity: 120 }], status: "trialing", start: "-28h", current_period_start: "-28h", trial_end: "2026-12-01T00:00:00Z", metadata: { seats_contracted: "120" } },
@@ -60119,7 +60203,7 @@ var stripeStarterSeed = {
60119
60203
  ],
60120
60204
  payments: [
60121
60205
  { ref: "summit_duplicate", customer: "summit", amount: 12e4, description: "Team plan, September (duplicate)", created: "-1428h" },
60122
- { ref: "pinecrest_deposit", customer: "pinecrest", amount: 5e5, description: "Implementation deposit", created: "-27h", receipt_email: "nora.bell@pinecrest-health.example" }
60206
+ { ref: "pinecrest_deposit", customer: "pinecrest", amount: 5e5, description: "Implementation deposit", created: "-27h", receipt_email: "nora.bell@pinecrest-health.com" }
60123
60207
  ],
60124
60208
  refunds: [{ ref: "summit_duplicate_refund", payment: "summit_duplicate", reason: "duplicate", created: "-1400h" }]
60125
60209
  };
@@ -61938,12 +62022,12 @@ var LobSeedSchema = external_exports.strictObject({
61938
62022
  else if (from.country !== "US") issue2([field2, i, "from"], "the return address must be in the US");
61939
62023
  }
61940
62024
  for (const [name3, value2] of contents) if (value2 && "template" in value2 && !templates.has(value2.template)) issue2([field2, i, name3], `${value2.template} is not a template`);
61941
- const created = parseDuration(entry2.created), send = entry2.sendDate === void 0 ? created : parseDuration(entry2.sendDate);
61942
- if (send < created) issue2([field2, i, "sendDate"], "sendDate is before created");
62025
+ const created2 = parseDuration(entry2.created), send = entry2.sendDate === void 0 ? created2 : parseDuration(entry2.sendDate);
62026
+ if (send < created2) issue2([field2, i, "sendDate"], "sendDate is before created");
61943
62027
  if (entry2.canceled !== void 0) {
61944
62028
  const canceled = parseDuration(entry2.canceled);
61945
- if (canceled < created) issue2([field2, i, "canceled"], "canceled is before created");
61946
- if (canceled >= Math.max(send, created + window)) issue2([field2, i, "canceled"], "a piece can be canceled only before its send date and within the cancellation window");
62029
+ if (canceled < created2) issue2([field2, i, "canceled"], "canceled is before created");
62030
+ if (canceled >= Math.max(send, created2 + window)) issue2([field2, i, "canceled"], "a piece can be canceled only before its send date and within the cancellation window");
61947
62031
  }
61948
62032
  return to;
61949
62033
  };
@@ -62315,7 +62399,7 @@ var PayPalOrderCheckSchema = external_exports.strictObject({
62315
62399
  currency: external_exports.string().regex(/^[A-Z]{3}$/).optional(),
62316
62400
  total: money4.optional(),
62317
62401
  tax: money4.optional(),
62318
- items: external_exports.array(checkItem.omit({ tax_percent: true, tax: true })).min(1).optional(),
62402
+ items: external_exports.array(checkItem.omit({ tax_percent: true })).min(1).optional(),
62319
62403
  ...recordCountFields
62320
62404
  }).refine(validRecordCount, recordCountMessage);
62321
62405
  var PayPalPaymentCheckSchema = external_exports.strictObject({
@@ -62744,9 +62828,9 @@ var KalshiSeedSchema = external_exports.strictObject({
62744
62828
  issue2(["orders", i, "market"], `${entry2.market} is not a market`);
62745
62829
  return;
62746
62830
  }
62747
- const created = parseDuration(entry2.created);
62748
- if (created < parseDuration(target.open) || created >= parseDuration(target.close)) issue2(["orders", i, "created"], "orders are placed while the market is open");
62749
- let filled = 0, last = created;
62831
+ const created2 = parseDuration(entry2.created);
62832
+ if (created2 < parseDuration(target.open) || created2 >= parseDuration(target.close)) issue2(["orders", i, "created"], "orders are placed while the market is open");
62833
+ let filled = 0, last = created2;
62750
62834
  entry2.fills.forEach((fill, j) => {
62751
62835
  const at = parseDuration(fill.at);
62752
62836
  if (at < last) issue2(["orders", i, "fills", j, "at"], "fills come after the order and after each other");
@@ -63190,6 +63274,7 @@ var user4 = external_exports.strictObject({
63190
63274
  });
63191
63275
  var organization2 = external_exports.strictObject({
63192
63276
  name: external_exports.string().min(1).max(255),
63277
+ externalId: external_exports.string().min(1).max(255).optional(),
63193
63278
  domains: external_exports.array(external_exports.string().regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/)).max(20).default([]),
63194
63279
  tags: external_exports.array(tag).max(50).default([]),
63195
63280
  notes: external_exports.string().max(5e3).optional(),
@@ -63239,11 +63324,19 @@ var view = external_exports.strictObject({
63239
63324
  order: external_exports.enum(["asc", "desc"]).default("desc"),
63240
63325
  active: external_exports.boolean().default(true)
63241
63326
  });
63327
+ var brand = external_exports.strictObject({
63328
+ name: external_exports.string().min(1).max(255),
63329
+ subdomain: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/).max(63),
63330
+ default: external_exports.boolean().default(false),
63331
+ active: external_exports.boolean().default(true),
63332
+ created: offset12.default("-2000h")
63333
+ });
63242
63334
  var ZendeskSeedSchema = external_exports.strictObject({
63243
63335
  account: external_exports.strictObject({ subdomain: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/).max(63), name: external_exports.string().min(1).max(100) }),
63244
63336
  /** The agent the API token authenticates as (`email/token:…`). */
63245
63337
  apiUser: email9,
63246
63338
  users: external_exports.array(user4).min(1).max(5e3),
63339
+ brands: external_exports.array(brand).min(1).max(100).optional(),
63247
63340
  organizations: external_exports.array(organization2).max(1e3).default([]),
63248
63341
  groups: external_exports.array(group4).max(100).default([]),
63249
63342
  tickets: external_exports.array(ticket).max(5e3).default([]),
@@ -63251,6 +63344,15 @@ var ZendeskSeedSchema = external_exports.strictObject({
63251
63344
  views: external_exports.array(view).max(100).default([])
63252
63345
  }).superRefine((seed2, ctx) => {
63253
63346
  const issue2 = (at, message4) => ctx.addIssue({ code: "custom", path: at, message: message4 });
63347
+ if (seed2.brands) {
63348
+ if (seed2.brands.filter((entry2) => entry2.default).length !== 1) issue2(["brands"], "exactly one default brand");
63349
+ if (seed2.brands.some((entry2) => entry2.default && !entry2.active)) issue2(["brands"], "the default brand is active");
63350
+ const subdomains = /* @__PURE__ */ new Set();
63351
+ seed2.brands.forEach((entry2, i) => {
63352
+ if (subdomains.has(entry2.subdomain)) issue2(["brands", i, "subdomain"], "duplicate subdomain");
63353
+ subdomains.add(entry2.subdomain);
63354
+ });
63355
+ }
63254
63356
  const people2 = /* @__PURE__ */ new Map(), organizations = /* @__PURE__ */ new Set(), groups = /* @__PURE__ */ new Set();
63255
63357
  seed2.users.forEach((entry2, i) => {
63256
63358
  if (people2.has(entry2.email)) issue2(["users", i, "email"], "duplicate email");
@@ -63392,6 +63494,24 @@ function zendeskStarterSeed() {
63392
63494
  ]
63393
63495
  });
63394
63496
  }
63497
+ var ticketSelector = { id: external_exports.number().int().positive().safe().optional(), subject: external_exports.string().min(1).max(255).optional() };
63498
+ var oneSelector = (value2) => value2.id === void 0 !== (value2.subject === void 0);
63499
+ var selectorMessage = "name the ticket with id or subject, not both";
63500
+ var statusList = external_exports.array(external_exports.enum(ZENDESK_STATUSES)).min(1);
63501
+ var ZendeskTicketCheckSchema = external_exports.strictObject({
63502
+ ...ticketSelector,
63503
+ status: external_exports.enum(ZENDESK_STATUSES).optional(),
63504
+ status_in: statusList.optional(),
63505
+ status_not_in: statusList.optional(),
63506
+ tags: external_exports.strictObject({ has: external_exports.array(tag).min(1).optional(), lacks: external_exports.array(tag).min(1).optional() }).refine((value2) => value2.has !== void 0 || value2.lacks !== void 0, "give has or lacks").refine((value2) => !value2.has?.some((tag3) => value2.lacks?.includes(tag3)), "a tag cannot be both required and excluded").optional(),
63507
+ assignee: external_exports.union([external_exports.number().int().positive().safe(), email9, external_exports.null()]).optional(),
63508
+ priority: external_exports.enum(ZENDESK_PRIORITIES).nullable().optional(),
63509
+ group: external_exports.union([external_exports.number().int().positive().safe(), external_exports.string().min(1).max(255), external_exports.null()]).optional(),
63510
+ public_comment: external_exports.union([external_exports.literal(true), external_exports.strictObject({ contains: external_exports.string().min(1).max(65e3).optional() })]).optional()
63511
+ }).refine(oneSelector, selectorMessage).refine((value2) => [value2.status, value2.status_in, value2.status_not_in].filter((value3) => value3 !== void 0).length <= 1, "give one of status, status_in or status_not_in");
63512
+ var ZendeskUnchangedCheckSchema = external_exports.strictObject({
63513
+ tickets: external_exports.array(external_exports.strictObject(ticketSelector).refine(oneSelector, selectorMessage)).min(1).max(5e3)
63514
+ });
63395
63515
 
63396
63516
  // packages/core/src/tools/google-calendar.ts
63397
63517
  var GOOGLE_CALENDAR_SCOPES = [
@@ -65801,6 +65921,7 @@ var day5 = external_exports.string().refine(
65801
65921
  (value2) => /^-?\d+d$/.test(value2) || /^\d{4}-\d{2}-\d{2}$/.test(value2) && (/* @__PURE__ */ new Date(`${value2}T00:00:00Z`)).toISOString().slice(0, 10) === value2,
65802
65922
  "expected YYYY-MM-DD or an offset in days from the start of the test, e.g. -30d"
65803
65923
  );
65924
+ var created = external_exports.union([external_exports.iso.datetime({ offset: true }), external_exports.iso.date(), external_exports.string().regex(/^-?\d+d$/)]).optional();
65804
65925
  var external = text11.optional();
65805
65926
  var named = external_exports.union([id8, text11]).describe("internal ID or name");
65806
65927
  var custom2 = external_exports.record(external_exports.string().regex(/^cust(?:entity|body|col|item)[a-z0-9_]+$/), external_exports.union([external_exports.string().max(4e3), external_exports.number(), external_exports.boolean(), external_exports.null()])).optional();
@@ -65833,6 +65954,7 @@ var entity = {
65833
65954
  comments: long.optional(),
65834
65955
  externalId: external,
65835
65956
  addresses: external_exports.array(address5).max(50).default([]),
65957
+ dateCreated: created,
65836
65958
  custom: custom2,
65837
65959
  extra,
65838
65960
  subsidiary: named.optional()
@@ -65853,6 +65975,7 @@ var expenseLine = external_exports.strictObject({ account: id8, amount: positive
65853
65975
  var application = external_exports.strictObject({ doc: id8, line: external_exports.number().int().nonnegative().optional(), amount: positive });
65854
65976
  var tx = {
65855
65977
  id: id8,
65978
+ createdBy: id8.optional(),
65856
65979
  tranId: text11.optional(),
65857
65980
  date: day5,
65858
65981
  memo: long.optional(),
@@ -65952,6 +66075,7 @@ var NetsuiteSeedFieldsSchema = external_exports.strictObject({
65952
66075
  title: text11.optional(),
65953
66076
  email: external_exports.email().max(254).optional(),
65954
66077
  phone: external_exports.string().max(32).optional(),
66078
+ dateCreated: created,
65955
66079
  mobilePhone: external_exports.string().max(32).optional(),
65956
66080
  company: id8.optional(),
65957
66081
  inactive: external_exports.boolean().default(false),
@@ -65967,6 +66091,7 @@ var NetsuiteSeedFieldsSchema = external_exports.strictObject({
65967
66091
  title: text11.optional(),
65968
66092
  email: external_exports.email().max(254).optional(),
65969
66093
  phone: external_exports.string().max(32).optional(),
66094
+ dateCreated: created,
65970
66095
  supervisor: id8.optional(),
65971
66096
  ...segments,
65972
66097
  salesRep: external_exports.boolean().default(false),
@@ -66334,6 +66459,9 @@ function books(seed2, issue2, money8) {
66334
66459
  "journalEntries",
66335
66460
  "expenseReports"
66336
66461
  ];
66462
+ for (const name3 of transactions) for (const [index, record4] of seed2[name3].entries()) {
66463
+ if (record4.createdBy !== void 0 && !employees.has(record4.createdBy)) issue2([name3, index, "createdBy"], "missing employee");
66464
+ }
66337
66465
  const externalIds = (names) => {
66338
66466
  const seen = /* @__PURE__ */ new Set();
66339
66467
  for (const name3 of names) for (const [index, record4] of seed2[name3].entries()) {
@@ -66824,6 +66952,14 @@ var NetsuiteUnchangedCheckSchema = external_exports.strictObject({
66824
66952
  except: external_exports.array(external_exports.strictObject({ type: external_exports.enum(netsuiteRecordTypes), id: id8.optional(), externalId: text11.optional() }).refine((check3) => check3.id === void 0 !== (check3.externalId === void 0), { message: "name the record with id or with externalId, not both" })).optional()
66825
66953
  });
66826
66954
  var NetsuiteCountCheckSchema = external_exports.strictObject({ type: external_exports.enum(netsuiteRecordTypes), count: external_exports.number().int().min(0), includeSettlement: external_exports.boolean().optional() });
66955
+ var NetsuitePreservedCheckSchema = external_exports.strictObject({
66956
+ type: external_exports.enum(netsuiteRecordTypes),
66957
+ id: id8,
66958
+ except_fields: external_exports.array(external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "name a top-level field")).refine(
66959
+ (fields3) => new Set(fields3).size === fields3.length,
66960
+ "name each field once"
66961
+ )
66962
+ });
66827
66963
 
66828
66964
  // packages/core/src/scene/schema.ts
66829
66965
  var SUPPORTED_TWINS = ["slack", "github", "datadog", "pagerduty", "linkedin-ads", "salesforce", "gong", "hubspot", "ga4", "google-ads", "chatgpt-ads", "open-meteo", "google-drive", "gmail", "amazon-s3", "linear", "okta", "stripe", "clerk", "better-stack", "notion", "attio", "dropbox", "resend", "microsoft-word", "outlook", "shopify", "lob", "paypal", "jira", "kalshi", "intercom", "zendesk", "google-calendar", "twilio", "asana", "discord", "sentry", "airtable", "netsuite", "carrier-portal"];
@@ -66867,6 +67003,7 @@ var SlackPost = external_exports.strictObject({
66867
67003
  thread_of: refUse3.optional()
66868
67004
  });
66869
67005
  var SlackMessageSeed = SlackPost.extend({
67006
+ pinned: external_exports.boolean().optional().describe("Pin this message in its channel at world start"),
66870
67007
  ts: external_exports.string().regex(/^\d{10}\.\d{6}$/, "a Slack message ts, e.g. 1792591080.000000").optional().describe("Pins the message id; it must be at or before start_time, later than the seed messages before it, and agree with at"),
66871
67008
  at: duration6("Offset from start_time; must be <= 0 (seed messages are history)").default("0s")
66872
67009
  });
@@ -66927,7 +67064,13 @@ var GitHubSeedSchema = external_exports.strictObject({
66927
67064
  parents: external_exports.array(refUse3).optional(),
66928
67065
  files: external_exports.record(external_exports.string(), external_exports.string().nullable())
66929
67066
  })).min(1, "at least one commit is required"),
66930
- branches: external_exports.array(external_exports.strictObject({ name: external_exports.string(), head: refUse3 })).optional(),
67067
+ branches: external_exports.array(external_exports.strictObject({
67068
+ name: external_exports.string(),
67069
+ head: refUse3,
67070
+ protection: external_exports.strictObject({
67071
+ required_pull_request_reviews: external_exports.strictObject({ required_approving_review_count: external_exports.number().int().min(0).max(6) })
67072
+ }).optional()
67073
+ })).optional(),
66931
67074
  labels: external_exports.array(external_exports.strictObject({
66932
67075
  name: external_exports.string().min(1),
66933
67076
  color: external_exports.string().regex(/^[0-9a-fA-F]{6}$/, "expected a 6-digit hex color without #, e.g. d73a4a").default("ededed"),
@@ -66945,7 +67088,13 @@ var GitHubSeedSchema = external_exports.strictObject({
66945
67088
  user: refUse3.optional().describe("Author; defaults to the GitHub bot"),
66946
67089
  labels: external_exports.array(external_exports.string()).optional(),
66947
67090
  assignees: external_exports.array(refUse3).optional().describe("Assigned GitHub users"),
66948
- at: duration6("Creation offset from start_time; must be <= 0; defaults to start_time").optional()
67091
+ at: duration6("Creation offset from start_time; must be <= 0; defaults to start_time").optional(),
67092
+ reviews: external_exports.array(external_exports.strictObject({
67093
+ user: refUse3,
67094
+ state: external_exports.enum(["APPROVED", "CHANGES_REQUESTED", "COMMENTED"]),
67095
+ body: external_exports.string().optional(),
67096
+ at: duration6("Submission offset from start_time; between pull creation and start_time").optional()
67097
+ })).optional()
66949
67098
  })).optional(),
66950
67099
  issues: external_exports.array(external_exports.strictObject({
66951
67100
  ref: refName3,
@@ -66953,6 +67102,7 @@ var GitHubSeedSchema = external_exports.strictObject({
66953
67102
  title: external_exports.string(),
66954
67103
  body: external_exports.string().optional(),
66955
67104
  state: external_exports.enum(["open", "closed"]).optional(),
67105
+ state_reason: external_exports.enum(["completed", "not_planned", "duplicate"]).optional().describe("Reason for a closed issue"),
66956
67106
  user: refUse3.optional().describe("Author; defaults to the GitHub bot"),
66957
67107
  labels: external_exports.array(external_exports.string()).optional(),
66958
67108
  assignees: external_exports.array(refUse3).optional().describe("Assigned GitHub users"),
@@ -66967,6 +67117,13 @@ var GitHubSeedSchema = external_exports.strictObject({
66967
67117
  })).optional()
66968
67118
  })).optional(),
66969
67119
  production: refUse3.optional(),
67120
+ statuses: external_exports.array(external_exports.strictObject({
67121
+ commit: refUse3,
67122
+ context: external_exports.string().min(1),
67123
+ state: external_exports.enum(["error", "failure", "pending", "success"]),
67124
+ description: external_exports.string().nullable().optional(),
67125
+ target_url: external_exports.url().nullable().optional()
67126
+ })).optional().describe("Commit status history, oldest first; the latest status per context determines combined state"),
66970
67127
  check_runs: external_exports.array(external_exports.strictObject({
66971
67128
  name: external_exports.string(),
66972
67129
  commit: refUse3,
@@ -67017,8 +67174,14 @@ var StateCheckSchema = external_exports.union([
67017
67174
  external_exports.strictObject({ "gmail.thread": GmailThreadCheckSchema }),
67018
67175
  external_exports.strictObject({ "outlook.message": OutlookMessageCheckSchema }),
67019
67176
  external_exports.strictObject({ "gmail.message": GmailMessageCheckSchema }),
67177
+ external_exports.strictObject({ "stripe.refunds": StripeRefundsCheckSchema }),
67178
+ external_exports.strictObject({ "stripe.balance": StripeBalanceCheckSchema }),
67179
+ external_exports.strictObject({ "stripe.unchanged": StripeUnchangedCheckSchema }),
67180
+ external_exports.strictObject({ "zendesk.ticket": ZendeskTicketCheckSchema }),
67181
+ external_exports.strictObject({ "zendesk.unchanged": ZendeskUnchangedCheckSchema }),
67020
67182
  external_exports.strictObject({ "netsuite.record": NetsuiteRecordCheckSchema }),
67021
67183
  external_exports.strictObject({ "netsuite.unchanged": NetsuiteUnchangedCheckSchema }),
67184
+ external_exports.strictObject({ "netsuite.preserved": NetsuitePreservedCheckSchema }),
67022
67185
  external_exports.strictObject({ "netsuite.count": NetsuiteCountCheckSchema }),
67023
67186
  external_exports.strictObject({ "carrier-portal.request": CarrierRequestCheckSchema }),
67024
67187
  external_exports.strictObject({ "carrier-portal.downloaded": CarrierDownloadCheckSchema }),
@@ -67705,7 +67868,7 @@ var TOOL_DESCRIPTORS = [
67705
67868
  descriptor("amazon-s3", "Amazon S3", "Buckets, objects and multipart uploads", ["Buckets", "Objects", "Tags", "Multipart uploads"], "REST (SigV4)", ["Path-style addressing: the SDK chooses it for an IP endpoint; set forcePathStyle for a host name.", "One account and access key; per-bucket read-write, read-only or no access stands in for IAM policies.", "Presigned URLs are verified."]),
67706
67869
  descriptor("linear", "Linear", "Issues, projects and team workflows", ["Issues", "Comments", "Teams", "Workflow states", "Labels", "Projects", "Users"], "GraphQL", ["Linear's published schema.", "Filters cover the common comparators.", "@linear/sdk accepts a plain-http apiUrl only on localhost, 127.0.0.1 or [::1]; elsewhere the endpoint needs TLS."]),
67707
67870
  descriptor("okta", "Okta", "People, groups, app assignments and the System Log", ["Users", "Groups", "Applications", "App assignments", "System Log"], "Management API v1", ["One org and one SSWS API token owned by a super administrator.", "Lifecycle changes are immediate; activation and reset links are returned.", "The System Log records every change made through the API."]),
67708
- descriptor("stripe", "Stripe", "Customers, subscriptions, invoices and payments", ["Customers", "Products", "Prices", "Subscriptions", "Invoices", "Invoice items", "Payment intents", "Charges", "Refunds", "Balance"], "API 2026-10-28.endive", ["Test mode only: cards are test tokens (pm_card_visa, pm_card_chargeDeclined\u2026) or seeded cards.", "The SDK takes no base path: point host/port/protocol at the env-scoped host ({env}-stripe.localhost) or prefix STRIPE_API_URL in a custom fetch client."]),
67871
+ descriptor("stripe", "Stripe", "Customers, subscriptions, invoices and payments", ["Customers", "Products", "Prices", "Subscriptions", "Invoices", "Invoice items", "Payment intents", "Charges", "Refunds", "Balance"], "API 2026-10-28.endive", ["Live-account objects and a stored card per seeded customer by default. Set seed.stripe.livemode: false for test tokens (pm_card_visa, pm_card_chargeDeclined\u2026).", "The SDK takes no base path: point host/port/protocol at the env-scoped host ({env}-stripe.localhost) or prefix STRIPE_API_URL in a custom fetch client."]),
67709
67872
  descriptor("clerk", "Clerk", "Users, organizations, invitations and sessions", ["Users", "Organizations", "Memberships", "Invitations", "Sessions"], "Backend API v1", ["One application instance with email sign-in.", "Invitations are recorded; pending ones expire on the scene clock.", "Sessions can be listed and revoked."]),
67710
67873
  descriptor("better-stack", "Better Stack", "Uptime monitors, heartbeats, incidents and status pages", ["Monitors", "Heartbeats", "Incidents", "On-call", "Status pages"], "Uptime API v2 / v3", ["A monitor is down while it has an open incident, and heartbeats recover when pinged.", "No official SDK exists; tested against the documented REST shapes."]),
67711
67874
  descriptor("notion", "Notion", "Pages, databases, blocks and comments", ["Pages", "Blocks", "Databases", "Data sources", "Comments", "Users", "Search"], "Notion-Version 2025-09-03", ["An internal integration: it sees only pages shared with it, as Notion does.", "Text, heading, list, to-do, toggle, quote, callout, code, divider and bookmark blocks.", "Databases are served as data sources."]),
@@ -241,6 +241,18 @@ CREATE VIEW ns_q_mediaitemfolder AS SELECT id, name, parent, description, datecr
241
241
  var col = (name, type, more = {}) => ({ name, type, ...more });
242
242
  var ref = (name, table) => col(name, "id", { ref: table });
243
243
  var dated = [col("datecreated", "datetime"), col("lastmodifieddate", "datetime")];
244
+ var TRANSACTION_LINKS = `SELECT * FROM ns_q_nexttransactionlinelink
245
+ UNION ALL SELECT l.createdfrom, l.orderline, l."transaction", l.line,
246
+ CASE WHEN t.type IN ('ItemRcpt','ItemShip') THEN 'ShipRcpt' WHEN t.type IN ('VendBill','CustInvc') THEN 'OrdBill' END,
247
+ l.amount, p.type, t.type, t.lastmodifieddate
248
+ FROM ns_lines l JOIN ns_transactions t ON t.id=l."transaction" JOIN ns_transactions p ON p.id=l.createdfrom
249
+ WHERE l.createdfrom IS NOT NULL
250
+ UNION ALL SELECT t.createdfrom, 0, t.id, 0, NULL, t.total, p.type, t.type, t.lastmodifieddate
251
+ FROM ns_transactions t JOIN ns_transactions p ON p.id=t.createdfrom
252
+ WHERE NOT EXISTS (SELECT 1 FROM ns_lines l WHERE l."transaction"=t.id AND l.createdfrom=t.createdfrom)
253
+ AND NOT EXISTS (SELECT 1 FROM ns_applications a WHERE a.source=t.id AND a.doc=t.createdfrom)`;
254
+ var SYSTEM_NOTES = `SELECT ${["id", "recordid", "recordtypeid", "date", "name", "field", "oldvalue", "newvalue", "context", "type"].map((c) => `json_extract(n.value, '$.${c}') AS "${c}"`).join(", ")}
255
+ FROM ns_extra e, json_each(e.fields, '$.notes') n WHERE substr(e.owner,1,20)='netsuite:systemnote:'`;
244
256
  var SUITEQL_TABLES = [
245
257
  { name: "customer", view: "ns_q_customer", display: "entityid", columns: [
246
258
  col("id", "id"),
@@ -432,6 +444,9 @@ var SUITEQL_TABLES = [
432
444
  col("closedondate", "date")
433
445
  ] },
434
446
  { name: "transaction", view: "ns_q_transaction", display: "tranid", columns: [
447
+ col("createdby", "id", { ref: "employee", sql: `COALESCE(
448
+ (SELECT json_extract(a.fields, '$.createdBy') FROM ns_extra a WHERE a.owner='netsuite:systemnote:' || ns_q_transaction.recordtype AND a.id=ns_q_transaction.id),
449
+ (SELECT COALESCE(json_extract(x.fields, '$.createdBy.id'),json_extract(x.fields, '$.createdby.id'),json_extract(x.fields, '$.createdBy'),json_extract(x.fields, '$.createdby')) FROM ns_extra x WHERE x.owner='transaction' AND x.id=ns_q_transaction.id))` }),
435
450
  col("id", "id"),
436
451
  col("tranid", "text"),
437
452
  col("trandate", "date"),
@@ -503,7 +518,7 @@ var SUITEQL_TABLES = [
503
518
  col("posting", "boolean"),
504
519
  ref("postingperiod", "accountingperiod")
505
520
  ] },
506
- ...["nexttransactionlinelink", "previoustransactionlinelink"].map((name) => ({ name, view: `ns_q_${name}`, display: "linktype", columns: [
521
+ ...["nexttransactionlinelink", "previoustransactionlinelink"].map((name) => ({ name, view: `ns_q_${name}`, source: TRANSACTION_LINKS, display: "linktype", columns: [
507
522
  ref("previousdoc", "transaction"),
508
523
  col("previousline", "integer"),
509
524
  ref("nextdoc", "transaction"),
@@ -514,6 +529,18 @@ var SUITEQL_TABLES = [
514
529
  col("nexttype", "text"),
515
530
  col("lastmodifieddate", "datetime")
516
531
  ] })),
532
+ { name: "systemnote", view: "ns_extra", source: SYSTEM_NOTES, display: "field", columns: [
533
+ col("id", "id"),
534
+ col("recordid", "id"),
535
+ col("recordtypeid", "integer"),
536
+ col("date", "datetime"),
537
+ ref("name", "entity"),
538
+ col("field", "text"),
539
+ col("oldvalue", "text"),
540
+ col("newvalue", "text"),
541
+ col("context", "text"),
542
+ col("type", "integer")
543
+ ] },
517
544
  { name: "file", view: "ns_q_file", display: "name", columns: [
518
545
  col("id", "id"),
519
546
  col("name", "text"),
@@ -1293,7 +1320,9 @@ function resolve(scope, name, qualifier) {
1293
1320
  scope.correlations.push(value);
1294
1321
  return value;
1295
1322
  }
1296
- invalid(`Field '${qualifier ? `${qualifier}.` : ""}${name}' was not found.`);
1323
+ const pending = { transaction: ["createdfrom", "total", "amountremaining"], transactionline: ["amount"] };
1324
+ const gap = owners.some((r) => r.columns.some((c) => c.origin && pending[c.origin.table.name]?.includes(name)));
1325
+ invalid(`Field '${qualifier ? `${qualifier}.` : ""}${name}' was not found.`, gap);
1297
1326
  }
1298
1327
  var key = (b) => JSON.stringify([b.sql, b.params]);
1299
1328
  var numeric = (t) => ["id", "integer", "number"].includes(t);
@@ -1544,7 +1573,7 @@ var Compiler = class {
1544
1573
  columns = [{ name: "dummy", type: "text", value: sql("") }];
1545
1574
  } else {
1546
1575
  const table = this.tables.find((t) => t.name === source.table);
1547
- if (!table) invalid(`Record '${source.table}' was not found.`);
1576
+ if (!table) invalid(`Record '${source.table}' was not found.`, source.table === "transactionlink");
1548
1577
  const computed = table.columns.filter((c) => c.sql);
1549
1578
  value = table.source ? sql("(", table.source, ")") : computed.length ? sql("(SELECT *, ", computed.map((c) => `${c.sql} AS ${quote(c.name)}`).join(", "), " FROM ", quote(table.view), ")") : sql(quote(table.view));
1550
1579
  columns = table.columns.map((column) => ({ name: column.name, type: column.type, value: sql(""), origin: { table, column, relation: alias } }));