@ancha-labs/cli 0.4.22 → 0.4.24

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/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;
@@ -57354,10 +57354,10 @@ var EXECUTION_SUPPORT = {
57354
57354
  "agent.input.per_event": sceneOnly,
57355
57355
  "agent.input.events": localOnly,
57356
57356
  "agent.input.http": all,
57357
- "agent.endpoint": localOnly,
57357
+ "agent.endpoint": { ...localOnly, "cloud-vm": true },
57358
57358
  "agent.slack_transport.feed": sceneOnly,
57359
- "agent.slack_transport.http": localOnly,
57360
- "agent.slack_transport.socket": localOnly,
57359
+ "agent.slack_transport.http": { ...localOnly, "cloud-vm": true },
57360
+ "agent.slack_transport.socket": { ...localOnly, "cloud-vm": true },
57361
57361
  "agent.env": sceneOnly,
57362
57362
  "agent.pass_env": sceneOnly,
57363
57363
  "agent.execution": sceneOnly,
@@ -57590,15 +57590,15 @@ var ChatGPTAdsSeedSchema = external_exports.strictObject({
57590
57590
  });
57591
57591
  });
57592
57592
  function chatGPTAdsStarterSeed() {
57593
- const created = Date.parse("2026-10-20T16:00:00Z") / 1e3;
57593
+ const created2 = Date.parse("2026-10-20T16:00:00Z") / 1e3;
57594
57594
  return ChatGPTAdsSeedSchema.parse({
57595
57595
  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
57596
  principals: [{ id: "acme-editor", accountId: "adacct_acme" }, { id: "helix-editor", accountId: "adacct_helix" }],
57597
57597
  actor: "acme-editor",
57598
57598
  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" }],
57599
+ 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" }],
57600
+ 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 } }],
57601
+ 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
57602
  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
57603
  });
57604
57604
  }
@@ -58806,11 +58806,11 @@ var GoogleDriveSeedSchema = external_exports.strictObject({
58806
58806
  if (grant.email === entry2.owner) issue2(at("permissions", j, "email"), "the owner already has the owner role");
58807
58807
  }
58808
58808
  });
58809
- const created = parseDuration(entry2.created);
58809
+ const created2 = parseDuration(entry2.created);
58810
58810
  entry2.comments.forEach((thread, j) => {
58811
58811
  known(thread.author, at("comments", j, "author"));
58812
58812
  const commented = parseDuration(thread.at);
58813
- if (commented < created) issue2(at("comments", j, "at"), "comment is older than its file");
58813
+ if (commented < created2) issue2(at("comments", j, "at"), "comment is older than its file");
58814
58814
  thread.replies.forEach((answer, k) => {
58815
58815
  known(answer.author, at("comments", j, "replies", k, "author"));
58816
58816
  if (parseDuration(answer.at) < commented) issue2(at("comments", j, "replies", k, "at"), "reply is older than its comment");
@@ -59927,6 +59927,7 @@ var moment = external_exports.string().refine(
59927
59927
  "expected an ISO 8601 time with a timezone, or an offset from the start of the test such as 72h or -24h"
59928
59928
  );
59929
59929
  var StripeSeedSchema = external_exports.strictObject({
59930
+ livemode: external_exports.boolean().optional().describe("Defaults to true; false selects a test account and test-card defaults"),
59930
59931
  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
59932
  /** Funds on the account, in the account currency. */
59932
59933
  balance: external_exports.strictObject({ available: amount.default(0), pending: amount.default(0) }).default({ available: 0, pending: 0 }),
@@ -59957,12 +59958,18 @@ var StripeSeedSchema = external_exports.strictObject({
59957
59958
  balance: external_exports.number().int().min(-99999999).max(99999999).default(0),
59958
59959
  created: past,
59959
59960
  invoice_prefix: external_exports.string().regex(/^[A-Z0-9]{3,12}$/).optional(),
59961
+ /** Cash held separately from the customer's invoice credit balance. */
59962
+ cash_balance: external_exports.strictObject({
59963
+ available: external_exports.partialRecord(external_exports.enum(["usd", "eur", "gbp", "cad", "aud"]), amount).optional(),
59964
+ reconciliation_mode: external_exports.enum(["automatic", "manual"]).default("automatic")
59965
+ }).optional(),
59960
59966
  /** The default payment method; `decline` makes every charge to it fail with that decline code. */
59961
59967
  card: external_exports.strictObject({
59962
59968
  brand: external_exports.enum(["visa", "mastercard", "amex"]),
59963
59969
  last4: external_exports.string().regex(/^\d{4}$/),
59964
59970
  exp_month: external_exports.number().int().min(1).max(12),
59965
59971
  exp_year: external_exports.number().int().min(2020).max(2099),
59972
+ fingerprint: external_exports.string().regex(/^[A-Za-z0-9]{1,64}$/).optional(),
59966
59973
  decline: external_exports.enum(["generic_decline", "insufficient_funds", "expired_card"]).optional()
59967
59974
  }).optional()
59968
59975
  })).max(2e3).default([]),
@@ -60022,6 +60029,26 @@ var StripeSeedSchema = external_exports.strictObject({
60022
60029
  receipt_email: external_exports.string().regex(EMAIL3).optional(),
60023
60030
  metadata
60024
60031
  })).max(5e3).default([]),
60032
+ /** Credit notes on paid invoices, credited to the customer's invoice balance. */
60033
+ credit_notes: external_exports.array(external_exports.strictObject({
60034
+ ref: ref9,
60035
+ invoice: ref9,
60036
+ amount: amount.min(1),
60037
+ created: past,
60038
+ memo: external_exports.string().max(500).optional(),
60039
+ reason: external_exports.enum(["duplicate", "fraudulent", "order_change", "product_unsatisfactory"]).optional(),
60040
+ metadata
60041
+ })).max(5e3).optional(),
60042
+ /** Card inquiries do not withdraw funds from the account balance. */
60043
+ disputes: external_exports.array(external_exports.strictObject({
60044
+ ref: ref9,
60045
+ payment: ref9,
60046
+ amount: amount.min(1).optional(),
60047
+ created: past,
60048
+ status: external_exports.enum(["warning_needs_response", "warning_under_review", "warning_closed"]).default("warning_needs_response"),
60049
+ reason: external_exports.enum(["duplicate", "fraudulent", "product_not_received", "product_unacceptable", "subscription_canceled", "unrecognized", "credit_not_processed", "general"]).default("general"),
60050
+ metadata
60051
+ })).max(5e3).optional(),
60025
60052
  refunds: external_exports.array(external_exports.strictObject({
60026
60053
  ref: ref9.optional(),
60027
60054
  /** The ref of a succeeded payment or a paid invoice. */
@@ -60080,11 +60107,46 @@ var StripeSeedSchema = external_exports.strictObject({
60080
60107
  if (p2.customer !== void 0 && refs.get(p2.customer) !== "customer") issue2(["payments", i, "customer"], `unknown customer ${p2.customer}`);
60081
60108
  if (p2.status === "succeeded") paid.add(p2.ref);
60082
60109
  });
60110
+ const credited = /* @__PURE__ */ new Map();
60111
+ seed2.credit_notes?.forEach((n, i) => {
60112
+ declare("credit_note", n.ref, ["credit_notes", i, "ref"]);
60113
+ const inv = seed2.invoices.find((v) => v.ref === n.invoice);
60114
+ if (!inv || inv.status !== "paid") issue2(["credit_notes", i, "invoice"], "credit notes need a paid invoice");
60115
+ const total = inv?.lines.reduce((sum, l) => sum + (l.unit_amount ?? prices.get(l.price)?.unit_amount ?? 0) * l.quantity, 0) ?? 0;
60116
+ const cumulative = (credited.get(n.invoice) ?? 0) + n.amount;
60117
+ credited.set(n.invoice, cumulative);
60118
+ if (cumulative > total) issue2(["credit_notes", i, "amount"], "credit notes exceed the invoice total");
60119
+ });
60120
+ const disputed = /* @__PURE__ */ new Set();
60121
+ seed2.disputes?.forEach((d, i) => {
60122
+ declare("dispute", d.ref, ["disputes", i, "ref"]);
60123
+ if (!paid.has(d.payment)) issue2(["disputes", i, "payment"], "disputes need a succeeded payment or a paid invoice");
60124
+ if (disputed.has(d.payment)) issue2(["disputes", i, "payment"], "a payment can have only one dispute");
60125
+ disputed.add(d.payment);
60126
+ const payment = seed2.payments.find((p2) => p2.ref === d.payment), inv = seed2.invoices.find((v) => v.ref === d.payment);
60127
+ const card = inv ? seed2.customers.find((c) => c.ref === inv.customer)?.card : void 0;
60128
+ if (inv && (card?.decline || seed2.livemode === false && !card)) issue2(["disputes", i, "payment"], "an invoice dispute needs a successful card charge");
60129
+ const total = payment?.amount ?? inv?.lines.reduce((sum, l) => sum + (l.unit_amount ?? prices.get(l.price)?.unit_amount ?? 0) * l.quantity, 0) ?? 0;
60130
+ if (d.amount !== void 0 && d.amount > total) issue2(["disputes", i, "amount"], "dispute amount exceeds the payment");
60131
+ });
60083
60132
  seed2.refunds.forEach((r, i) => {
60084
60133
  declare("refund", r.ref, ["refunds", i, "ref"]);
60085
60134
  if (!paid.has(r.payment)) issue2(["refunds", i, "payment"], "refunds need a succeeded payment or a paid invoice");
60086
60135
  });
60087
60136
  });
60137
+ 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");
60138
+ var StripeObjectTypeSchema = external_exports.enum(["customer", "payment_method", "product", "price", "subscription", "invoice", "invoiceitem", "payment_intent", "charge", "refund"]);
60139
+ var StripeRefundsCheckSchema = external_exports.strictObject({
60140
+ charge: objectId.optional(),
60141
+ payment_intent: objectId.optional(),
60142
+ count: external_exports.number().int().nonnegative().optional(),
60143
+ amount: external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
60144
+ after_start: external_exports.boolean().optional()
60145
+ }).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");
60146
+ var StripeBalanceCheckSchema = external_exports.strictObject({ customer: objectId, balance: external_exports.number().int().min(-99999999).max(99999999) });
60147
+ var StripeUnchangedCheckSchema = external_exports.strictObject({
60148
+ objects: external_exports.array(external_exports.strictObject({ type: StripeObjectTypeSchema, id: objectId })).min(1).max(1e3)
60149
+ });
60088
60150
  var stripeStarterSeed = {
60089
60151
  account: { name: "Acme", currency: "usd", statement_descriptor: "ACME ANALYTICS" },
60090
60152
  balance: { available: 1284550, pending: 12e4 },
@@ -60097,11 +60159,11 @@ var stripeStarterSeed = {
60097
60159
  { 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
60160
  ],
60099
60161
  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 } }
60162
+ { 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 } },
60163
+ { 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 } },
60164
+ { 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" } },
60165
+ { 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 } },
60166
+ { 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
60167
  ],
60106
60168
  subscriptions: [
60107
60169
  { 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 +60181,7 @@ var stripeStarterSeed = {
60119
60181
  ],
60120
60182
  payments: [
60121
60183
  { 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" }
60184
+ { ref: "pinecrest_deposit", customer: "pinecrest", amount: 5e5, description: "Implementation deposit", created: "-27h", receipt_email: "nora.bell@pinecrest-health.com" }
60123
60185
  ],
60124
60186
  refunds: [{ ref: "summit_duplicate_refund", payment: "summit_duplicate", reason: "duplicate", created: "-1400h" }]
60125
60187
  };
@@ -61938,12 +62000,12 @@ var LobSeedSchema = external_exports.strictObject({
61938
62000
  else if (from.country !== "US") issue2([field2, i, "from"], "the return address must be in the US");
61939
62001
  }
61940
62002
  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");
62003
+ const created2 = parseDuration(entry2.created), send = entry2.sendDate === void 0 ? created2 : parseDuration(entry2.sendDate);
62004
+ if (send < created2) issue2([field2, i, "sendDate"], "sendDate is before created");
61943
62005
  if (entry2.canceled !== void 0) {
61944
62006
  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");
62007
+ if (canceled < created2) issue2([field2, i, "canceled"], "canceled is before created");
62008
+ 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
62009
  }
61948
62010
  return to;
61949
62011
  };
@@ -62315,7 +62377,7 @@ var PayPalOrderCheckSchema = external_exports.strictObject({
62315
62377
  currency: external_exports.string().regex(/^[A-Z]{3}$/).optional(),
62316
62378
  total: money4.optional(),
62317
62379
  tax: money4.optional(),
62318
- items: external_exports.array(checkItem.omit({ tax_percent: true, tax: true })).min(1).optional(),
62380
+ items: external_exports.array(checkItem.omit({ tax_percent: true })).min(1).optional(),
62319
62381
  ...recordCountFields
62320
62382
  }).refine(validRecordCount, recordCountMessage);
62321
62383
  var PayPalPaymentCheckSchema = external_exports.strictObject({
@@ -62744,9 +62806,9 @@ var KalshiSeedSchema = external_exports.strictObject({
62744
62806
  issue2(["orders", i, "market"], `${entry2.market} is not a market`);
62745
62807
  return;
62746
62808
  }
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;
62809
+ const created2 = parseDuration(entry2.created);
62810
+ if (created2 < parseDuration(target.open) || created2 >= parseDuration(target.close)) issue2(["orders", i, "created"], "orders are placed while the market is open");
62811
+ let filled = 0, last = created2;
62750
62812
  entry2.fills.forEach((fill, j) => {
62751
62813
  const at = parseDuration(fill.at);
62752
62814
  if (at < last) issue2(["orders", i, "fills", j, "at"], "fills come after the order and after each other");
@@ -63190,6 +63252,7 @@ var user4 = external_exports.strictObject({
63190
63252
  });
63191
63253
  var organization2 = external_exports.strictObject({
63192
63254
  name: external_exports.string().min(1).max(255),
63255
+ externalId: external_exports.string().min(1).max(255).optional(),
63193
63256
  domains: external_exports.array(external_exports.string().regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/)).max(20).default([]),
63194
63257
  tags: external_exports.array(tag).max(50).default([]),
63195
63258
  notes: external_exports.string().max(5e3).optional(),
@@ -63239,11 +63302,19 @@ var view = external_exports.strictObject({
63239
63302
  order: external_exports.enum(["asc", "desc"]).default("desc"),
63240
63303
  active: external_exports.boolean().default(true)
63241
63304
  });
63305
+ var brand = external_exports.strictObject({
63306
+ name: external_exports.string().min(1).max(255),
63307
+ subdomain: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/).max(63),
63308
+ default: external_exports.boolean().default(false),
63309
+ active: external_exports.boolean().default(true),
63310
+ created: offset12.default("-2000h")
63311
+ });
63242
63312
  var ZendeskSeedSchema = external_exports.strictObject({
63243
63313
  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
63314
  /** The agent the API token authenticates as (`email/token:…`). */
63245
63315
  apiUser: email9,
63246
63316
  users: external_exports.array(user4).min(1).max(5e3),
63317
+ brands: external_exports.array(brand).min(1).max(100).optional(),
63247
63318
  organizations: external_exports.array(organization2).max(1e3).default([]),
63248
63319
  groups: external_exports.array(group4).max(100).default([]),
63249
63320
  tickets: external_exports.array(ticket).max(5e3).default([]),
@@ -63251,6 +63322,15 @@ var ZendeskSeedSchema = external_exports.strictObject({
63251
63322
  views: external_exports.array(view).max(100).default([])
63252
63323
  }).superRefine((seed2, ctx) => {
63253
63324
  const issue2 = (at, message4) => ctx.addIssue({ code: "custom", path: at, message: message4 });
63325
+ if (seed2.brands) {
63326
+ if (seed2.brands.filter((entry2) => entry2.default).length !== 1) issue2(["brands"], "exactly one default brand");
63327
+ if (seed2.brands.some((entry2) => entry2.default && !entry2.active)) issue2(["brands"], "the default brand is active");
63328
+ const subdomains = /* @__PURE__ */ new Set();
63329
+ seed2.brands.forEach((entry2, i) => {
63330
+ if (subdomains.has(entry2.subdomain)) issue2(["brands", i, "subdomain"], "duplicate subdomain");
63331
+ subdomains.add(entry2.subdomain);
63332
+ });
63333
+ }
63254
63334
  const people2 = /* @__PURE__ */ new Map(), organizations = /* @__PURE__ */ new Set(), groups = /* @__PURE__ */ new Set();
63255
63335
  seed2.users.forEach((entry2, i) => {
63256
63336
  if (people2.has(entry2.email)) issue2(["users", i, "email"], "duplicate email");
@@ -63392,6 +63472,24 @@ function zendeskStarterSeed() {
63392
63472
  ]
63393
63473
  });
63394
63474
  }
63475
+ var ticketSelector = { id: external_exports.number().int().positive().safe().optional(), subject: external_exports.string().min(1).max(255).optional() };
63476
+ var oneSelector = (value2) => value2.id === void 0 !== (value2.subject === void 0);
63477
+ var selectorMessage = "name the ticket with id or subject, not both";
63478
+ var statusList = external_exports.array(external_exports.enum(ZENDESK_STATUSES)).min(1);
63479
+ var ZendeskTicketCheckSchema = external_exports.strictObject({
63480
+ ...ticketSelector,
63481
+ status: external_exports.enum(ZENDESK_STATUSES).optional(),
63482
+ status_in: statusList.optional(),
63483
+ status_not_in: statusList.optional(),
63484
+ 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(),
63485
+ assignee: external_exports.union([external_exports.number().int().positive().safe(), email9, external_exports.null()]).optional(),
63486
+ priority: external_exports.enum(ZENDESK_PRIORITIES).nullable().optional(),
63487
+ group: external_exports.union([external_exports.number().int().positive().safe(), external_exports.string().min(1).max(255), external_exports.null()]).optional(),
63488
+ public_comment: external_exports.union([external_exports.literal(true), external_exports.strictObject({ contains: external_exports.string().min(1).max(65e3).optional() })]).optional()
63489
+ }).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");
63490
+ var ZendeskUnchangedCheckSchema = external_exports.strictObject({
63491
+ tickets: external_exports.array(external_exports.strictObject(ticketSelector).refine(oneSelector, selectorMessage)).min(1).max(5e3)
63492
+ });
63395
63493
 
63396
63494
  // packages/core/src/tools/google-calendar.ts
63397
63495
  var GOOGLE_CALENDAR_SCOPES = [
@@ -65801,6 +65899,7 @@ var day5 = external_exports.string().refine(
65801
65899
  (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
65900
  "expected YYYY-MM-DD or an offset in days from the start of the test, e.g. -30d"
65803
65901
  );
65902
+ var created = external_exports.union([external_exports.iso.datetime({ offset: true }), external_exports.iso.date(), external_exports.string().regex(/^-?\d+d$/)]).optional();
65804
65903
  var external = text11.optional();
65805
65904
  var named = external_exports.union([id8, text11]).describe("internal ID or name");
65806
65905
  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 +65932,7 @@ var entity = {
65833
65932
  comments: long.optional(),
65834
65933
  externalId: external,
65835
65934
  addresses: external_exports.array(address5).max(50).default([]),
65935
+ dateCreated: created,
65836
65936
  custom: custom2,
65837
65937
  extra,
65838
65938
  subsidiary: named.optional()
@@ -65853,6 +65953,7 @@ var expenseLine = external_exports.strictObject({ account: id8, amount: positive
65853
65953
  var application = external_exports.strictObject({ doc: id8, line: external_exports.number().int().nonnegative().optional(), amount: positive });
65854
65954
  var tx = {
65855
65955
  id: id8,
65956
+ createdBy: id8.optional(),
65856
65957
  tranId: text11.optional(),
65857
65958
  date: day5,
65858
65959
  memo: long.optional(),
@@ -65952,6 +66053,7 @@ var NetsuiteSeedFieldsSchema = external_exports.strictObject({
65952
66053
  title: text11.optional(),
65953
66054
  email: external_exports.email().max(254).optional(),
65954
66055
  phone: external_exports.string().max(32).optional(),
66056
+ dateCreated: created,
65955
66057
  mobilePhone: external_exports.string().max(32).optional(),
65956
66058
  company: id8.optional(),
65957
66059
  inactive: external_exports.boolean().default(false),
@@ -65967,6 +66069,7 @@ var NetsuiteSeedFieldsSchema = external_exports.strictObject({
65967
66069
  title: text11.optional(),
65968
66070
  email: external_exports.email().max(254).optional(),
65969
66071
  phone: external_exports.string().max(32).optional(),
66072
+ dateCreated: created,
65970
66073
  supervisor: id8.optional(),
65971
66074
  ...segments,
65972
66075
  salesRep: external_exports.boolean().default(false),
@@ -66334,6 +66437,9 @@ function books(seed2, issue2, money8) {
66334
66437
  "journalEntries",
66335
66438
  "expenseReports"
66336
66439
  ];
66440
+ for (const name3 of transactions) for (const [index, record4] of seed2[name3].entries()) {
66441
+ if (record4.createdBy !== void 0 && !employees.has(record4.createdBy)) issue2([name3, index, "createdBy"], "missing employee");
66442
+ }
66337
66443
  const externalIds = (names) => {
66338
66444
  const seen = /* @__PURE__ */ new Set();
66339
66445
  for (const name3 of names) for (const [index, record4] of seed2[name3].entries()) {
@@ -66867,6 +66973,7 @@ var SlackPost = external_exports.strictObject({
66867
66973
  thread_of: refUse3.optional()
66868
66974
  });
66869
66975
  var SlackMessageSeed = SlackPost.extend({
66976
+ pinned: external_exports.boolean().optional().describe("Pin this message in its channel at world start"),
66870
66977
  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
66978
  at: duration6("Offset from start_time; must be <= 0 (seed messages are history)").default("0s")
66872
66979
  });
@@ -66927,7 +67034,13 @@ var GitHubSeedSchema = external_exports.strictObject({
66927
67034
  parents: external_exports.array(refUse3).optional(),
66928
67035
  files: external_exports.record(external_exports.string(), external_exports.string().nullable())
66929
67036
  })).min(1, "at least one commit is required"),
66930
- branches: external_exports.array(external_exports.strictObject({ name: external_exports.string(), head: refUse3 })).optional(),
67037
+ branches: external_exports.array(external_exports.strictObject({
67038
+ name: external_exports.string(),
67039
+ head: refUse3,
67040
+ protection: external_exports.strictObject({
67041
+ required_pull_request_reviews: external_exports.strictObject({ required_approving_review_count: external_exports.number().int().min(0).max(6) })
67042
+ }).optional()
67043
+ })).optional(),
66931
67044
  labels: external_exports.array(external_exports.strictObject({
66932
67045
  name: external_exports.string().min(1),
66933
67046
  color: external_exports.string().regex(/^[0-9a-fA-F]{6}$/, "expected a 6-digit hex color without #, e.g. d73a4a").default("ededed"),
@@ -66945,7 +67058,13 @@ var GitHubSeedSchema = external_exports.strictObject({
66945
67058
  user: refUse3.optional().describe("Author; defaults to the GitHub bot"),
66946
67059
  labels: external_exports.array(external_exports.string()).optional(),
66947
67060
  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()
67061
+ at: duration6("Creation offset from start_time; must be <= 0; defaults to start_time").optional(),
67062
+ reviews: external_exports.array(external_exports.strictObject({
67063
+ user: refUse3,
67064
+ state: external_exports.enum(["APPROVED", "CHANGES_REQUESTED", "COMMENTED"]),
67065
+ body: external_exports.string().optional(),
67066
+ at: duration6("Submission offset from start_time; between pull creation and start_time").optional()
67067
+ })).optional()
66949
67068
  })).optional(),
66950
67069
  issues: external_exports.array(external_exports.strictObject({
66951
67070
  ref: refName3,
@@ -66967,6 +67086,13 @@ var GitHubSeedSchema = external_exports.strictObject({
66967
67086
  })).optional()
66968
67087
  })).optional(),
66969
67088
  production: refUse3.optional(),
67089
+ statuses: external_exports.array(external_exports.strictObject({
67090
+ commit: refUse3,
67091
+ context: external_exports.string().min(1),
67092
+ state: external_exports.enum(["error", "failure", "pending", "success"]),
67093
+ description: external_exports.string().nullable().optional(),
67094
+ target_url: external_exports.url().nullable().optional()
67095
+ })).optional().describe("Commit status history, oldest first; the latest status per context determines combined state"),
66970
67096
  check_runs: external_exports.array(external_exports.strictObject({
66971
67097
  name: external_exports.string(),
66972
67098
  commit: refUse3,
@@ -67017,6 +67143,11 @@ var StateCheckSchema = external_exports.union([
67017
67143
  external_exports.strictObject({ "gmail.thread": GmailThreadCheckSchema }),
67018
67144
  external_exports.strictObject({ "outlook.message": OutlookMessageCheckSchema }),
67019
67145
  external_exports.strictObject({ "gmail.message": GmailMessageCheckSchema }),
67146
+ external_exports.strictObject({ "stripe.refunds": StripeRefundsCheckSchema }),
67147
+ external_exports.strictObject({ "stripe.balance": StripeBalanceCheckSchema }),
67148
+ external_exports.strictObject({ "stripe.unchanged": StripeUnchangedCheckSchema }),
67149
+ external_exports.strictObject({ "zendesk.ticket": ZendeskTicketCheckSchema }),
67150
+ external_exports.strictObject({ "zendesk.unchanged": ZendeskUnchangedCheckSchema }),
67020
67151
  external_exports.strictObject({ "netsuite.record": NetsuiteRecordCheckSchema }),
67021
67152
  external_exports.strictObject({ "netsuite.unchanged": NetsuiteUnchangedCheckSchema }),
67022
67153
  external_exports.strictObject({ "netsuite.count": NetsuiteCountCheckSchema }),
@@ -67302,6 +67433,7 @@ var fields2 = {
67302
67433
  };
67303
67434
  var TestFileSchema = external_exports.strictObject({
67304
67435
  ...fields2,
67436
+ function_tools: SceneSchema.shape.tools,
67305
67437
  world: external_exports.union([WorldId, external_exports.record(external_exports.string(), external_exports.unknown())], { error: WORLD_ERROR }),
67306
67438
  until: external_exports.unknown().optional(),
67307
67439
  checks: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
@@ -67309,6 +67441,7 @@ var TestFileSchema = external_exports.strictObject({
67309
67441
  });
67310
67442
  var TestFileDocument = external_exports.strictObject({
67311
67443
  ...fields2,
67444
+ function_tools: SceneSchema.shape.tools,
67312
67445
  world: external_exports.union([WorldId, WorldBodySchema]).describe("A world file's id (ancha/worlds/<id>.yaml), or the world inline"),
67313
67446
  until: SceneSchema.shape.until,
67314
67447
  checks: SceneSchema.shape.checks.optional(),
@@ -67703,7 +67836,7 @@ var TOOL_DESCRIPTORS = [
67703
67836
  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."]),
67704
67837
  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."]),
67705
67838
  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."]),
67706
- 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."]),
67839
+ 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."]),
67707
67840
  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."]),
67708
67841
  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."]),
67709
67842
  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."]),
@@ -67798,6 +67931,22 @@ var NAMED_TARGETS = {
67798
67931
  var TRANSACTIONS = new Set(NETSUITE_TRANSACTION_TYPES);
67799
67932
  var ITEMS = new Set(NETSUITE_ITEM_TYPES);
67800
67933
 
67934
+ // packages/core/src/function-tool-observation.ts
67935
+ var functionToolObservationSchema = external_exports.strictObject({
67936
+ registered: external_exports.array(external_exports.string()),
67937
+ complete: external_exports.boolean(),
67938
+ protocol_version: external_exports.number().int().nonnegative().optional(),
67939
+ required: external_exports.array(external_exports.string()),
67940
+ missing: external_exports.array(external_exports.string()),
67941
+ tools: external_exports.array(external_exports.strictObject({
67942
+ name: external_exports.string(),
67943
+ registered: external_exports.boolean(),
67944
+ called: external_exports.number().int().nonnegative(),
67945
+ completed: external_exports.number().int().nonnegative(),
67946
+ pending: external_exports.number().int().nonnegative()
67947
+ }))
67948
+ });
67949
+
67801
67950
  // backend/src/mcp/configuration.ts
67802
67951
  function validateMcpConnection(connection) {
67803
67952
  let url3;
@@ -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 } }));