agenttwin 0.3.34 → 0.3.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/worker.js CHANGED
@@ -5031,7 +5031,7 @@ function parseWorld(value) {
5031
5031
  const services = /* @__PURE__ */ new Map();
5032
5032
  const requestPathFaults = /* @__PURE__ */ new Set();
5033
5033
  for (const service of v.services) {
5034
- if (!object2(service) || typeof service.name !== "string" || !namePattern.test(service.name) || services.has(service.name)) invalid("service names must be unique lowercase identifiers");
5034
+ if (!object2(service) || typeof service.name !== "string" || !namePattern.test(service.name) || services.has(service.name)) invalid(`service names must be unique lowercase identifiers (${object2(service) && typeof service.name === "string" ? services.has(service.name) ? `${service.name} appears twice` : `${JSON.stringify(service.name)} is not one` : "a service has no name"})`);
5035
5035
  const item = service;
5036
5036
  if (!Array.isArray(item.collections) || !item.collections.length || item.collections.length > 20) invalid("each service needs 1\u201320 collections");
5037
5037
  if (item.adapter !== void 0 && !["json-collection", "slack", "stripe", "openai", "anthropic", "github", "linear", "notion", "hubspot", "shopify", "datadog", "gmail", "google-calendar", "gitlab", "jira", "discord", "twilio", "zendesk", "google-oauth", "composio", "upstash-redis", ...ENTERPRISE_ADAPTERS].includes(String(item.adapter)) && !isGeneratedAdapter(item.adapter) && !isPackAdapter(item.adapter)) invalid("unsupported service adapter");
@@ -7726,6 +7726,7 @@ var postgresNoUnscopedDestructive = {
7726
7726
  }
7727
7727
  };
7728
7728
  var NOT_EFFECTS = /* @__PURE__ */ new Set(["openai", "anthropic", "google-oauth"]);
7729
+ var isEventRecord = (r) => typeof r.type === "string" && /^[a-z_]+(\.[a-z_]+)+$/.test(r.type) && !!r.data && typeof r.data === "object";
7729
7730
  var genericRepeat = {
7730
7731
  id: "generic.no-repeat-after-fault",
7731
7732
  title: "Writes are not repeated after a fault",
@@ -7741,7 +7742,9 @@ var genericRepeat = {
7741
7742
  const faults = ctx.events.filter((e) => e.operation === "fault").map((e) => e.sequence);
7742
7743
  if (!faults.length && !ctx.duplicateDelivery) return out;
7743
7744
  for (const path of Object.keys(ctx.finalState?.[s] ?? {}).filter((p) => !judged.has(p))) {
7744
- for (const group of groups(addedRows(rowsOf(ctx.initialState, s, path), rowsOf(ctx.finalState, s, path)), (r) => contentSignature(r, path))) {
7745
+ const added = addedRows(rowsOf(ctx.initialState, s, path), rowsOf(ctx.finalState, s, path));
7746
+ if (added.length && added.every((r) => isEventRecord(r))) continue;
7747
+ for (const group of groups(added, (r) => contentSignature(r, path))) {
7745
7748
  const seq = writeSequences(ctx, s, group.map((r) => r.id));
7746
7749
  if (!ctx.duplicateDelivery && seq.length && !faults.some((f) => f < Math.max(...seq))) continue;
7747
7750
  const label2 = path.split("/").filter(Boolean).pop() ?? "record";
@@ -5277,7 +5277,7 @@ function parseWorld(value) {
5277
5277
  const services = /* @__PURE__ */ new Map();
5278
5278
  const requestPathFaults = /* @__PURE__ */ new Set();
5279
5279
  for (const service of v.services) {
5280
- if (!object2(service) || typeof service.name !== "string" || !namePattern.test(service.name) || services.has(service.name)) invalid("service names must be unique lowercase identifiers");
5280
+ if (!object2(service) || typeof service.name !== "string" || !namePattern.test(service.name) || services.has(service.name)) invalid(`service names must be unique lowercase identifiers (${object2(service) && typeof service.name === "string" ? services.has(service.name) ? `${service.name} appears twice` : `${JSON.stringify(service.name)} is not one` : "a service has no name"})`);
5281
5281
  const item = service;
5282
5282
  if (!Array.isArray(item.collections) || !item.collections.length || item.collections.length > 20) invalid("each service needs 1\u201320 collections");
5283
5283
  if (item.adapter !== void 0 && !["json-collection", "slack", "stripe", "openai", "anthropic", "github", "linear", "notion", "hubspot", "shopify", "datadog", "gmail", "google-calendar", "gitlab", "jira", "discord", "twilio", "zendesk", "google-oauth", "composio", "upstash-redis", ...ENTERPRISE_ADAPTERS].includes(String(item.adapter)) && !isGeneratedAdapter(item.adapter) && !isPackAdapter(item.adapter)) invalid("unsupported service adapter");
@@ -8249,7 +8249,7 @@ function runDefaultChecks(input) {
8249
8249
  };
8250
8250
  });
8251
8251
  }
8252
- var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical3, contentSignature, writeSequences, times2, money, stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries, NEGATIVE, gmailText, TARGETED, postgresUpdateApplied, postgresNoDuplicateInsert, RELATIVE_SET, postgresNoRepeatedRelativeUpdate, UNSCOPED, postgresNoUnscopedDestructive, NOT_EFFECTS, genericRepeat, DEFAULT_CHECKS, VENDOR_COVERS, registryFor, refOf;
8252
+ var PROVIDER, displayName, rowsOf, VOLATILE2, volatileKey, canonical3, contentSignature, writeSequences, times2, money, stripeRefundOnce, stripeNoDuplicatePayment, stripeIdempotentRetries, NEGATIVE, gmailText, TARGETED, postgresUpdateApplied, postgresNoDuplicateInsert, RELATIVE_SET, postgresNoRepeatedRelativeUpdate, UNSCOPED, postgresNoUnscopedDestructive, NOT_EFFECTS, isEventRecord, genericRepeat, DEFAULT_CHECKS, VENDOR_COVERS, registryFor, refOf;
8253
8253
  var init_default_checks = __esm({
8254
8254
  "src/runtime/default-checks.ts"() {
8255
8255
  "use strict";
@@ -8481,6 +8481,7 @@ var init_default_checks = __esm({
8481
8481
  }
8482
8482
  };
8483
8483
  NOT_EFFECTS = /* @__PURE__ */ new Set(["openai", "anthropic", "google-oauth"]);
8484
+ isEventRecord = (r) => typeof r.type === "string" && /^[a-z_]+(\.[a-z_]+)+$/.test(r.type) && !!r.data && typeof r.data === "object";
8484
8485
  genericRepeat = {
8485
8486
  id: "generic.no-repeat-after-fault",
8486
8487
  title: "Writes are not repeated after a fault",
@@ -8496,7 +8497,9 @@ var init_default_checks = __esm({
8496
8497
  const faults = ctx.events.filter((e) => e.operation === "fault").map((e) => e.sequence);
8497
8498
  if (!faults.length && !ctx.duplicateDelivery) return out;
8498
8499
  for (const path of Object.keys(ctx.finalState?.[s] ?? {}).filter((p) => !judged.has(p))) {
8499
- for (const group of groups(addedRows(rowsOf(ctx.initialState, s, path), rowsOf(ctx.finalState, s, path)), (r) => contentSignature(r, path))) {
8500
+ const added = addedRows(rowsOf(ctx.initialState, s, path), rowsOf(ctx.finalState, s, path));
8501
+ if (added.length && added.every((r) => isEventRecord(r))) continue;
8502
+ for (const group of groups(added, (r) => contentSignature(r, path))) {
8500
8503
  const seq = writeSequences(ctx, s, group.map((r) => r.id));
8501
8504
  if (!ctx.duplicateDelivery && seq.length && !faults.some((f) => f < Math.max(...seq))) continue;
8502
8505
  const label2 = path.split("/").filter(Boolean).pop() ?? "record";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenttwin",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
4
4
  "description": "AgentTwin builds digital twins for testing AI agents. The current CLI prepares supported Node.js workflows with synthetic services, failures, and outcome checks.",
5
5
  "mcpName": "io.github.AgentTwin/agenttwin",
6
6
  "keywords": [