@coasys/ad4m-connect 0.13.0-test-interpretation → 0.13.0-test-interpretation-2

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/core.js CHANGED
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
39
39
  };
40
40
 
41
41
  // ../package.json
42
- var version = "0.13.0-test-interpretation";
42
+ var version = "0.13.0-test-interpretation-2";
43
43
 
44
44
  // src/utils.ts
45
45
  function isEmbedded() {
@@ -764,6 +764,14 @@ var Literal = class {
764
764
  const numberString = body.substring(7);
765
765
  return parseFloat(numberString);
766
766
  }
767
+ if (body.startsWith("boolean:")) {
768
+ const boolString = decodeURIComponent(body.substring(8));
769
+ if (boolString === "true")
770
+ return true;
771
+ if (boolString === "false")
772
+ return false;
773
+ throw new Error(`Can't parse boolean literal: ${boolString}`);
774
+ }
767
775
  if (body.startsWith("json:")) {
768
776
  const json = body.substring(5);
769
777
  return JSON.parse(decodeURIComponent(json));
@@ -1090,6 +1098,10 @@ var SHACLShape = class {
1090
1098
  }
1091
1099
  if (prop.writable !== void 0) {
1092
1100
  turtle += ` ad4m:writable ${prop.writable} ;
1101
+ `;
1102
+ }
1103
+ if (prop.identity !== void 0) {
1104
+ turtle += ` ad4m:identity ${prop.identity} ;
1093
1105
  `;
1094
1106
  }
1095
1107
  turtle = turtle.slice(0, -2) + "\n";
@@ -1580,7 +1592,8 @@ var SHACLShape = class {
1580
1592
  where_predicates: p.wherePredicates,
1581
1593
  filter: p.filter,
1582
1594
  transform: p.transform,
1583
- interpretation_hint: p.interpretationHint
1595
+ interpretation_hint: p.interpretationHint,
1596
+ identity: p.identity
1584
1597
  })),
1585
1598
  constructor_actions: this.constructor_actions,
1586
1599
  destructor_actions: this.destructor_actions
@@ -1605,7 +1618,7 @@ var SHACLShape = class {
1605
1618
  hasValue: p.has_value,
1606
1619
  local: p.local,
1607
1620
  writable: p.writable,
1608
- resolveLanguage: p.resolve_language,
1621
+ resolveLanguage: p.resolve_language ?? p.resolveLanguage,
1609
1622
  setter: p.setter,
1610
1623
  adder: p.adder,
1611
1624
  remover: p.remover,
@@ -1619,7 +1632,8 @@ var SHACLShape = class {
1619
1632
  wherePredicates: p.where_predicates,
1620
1633
  filter: p.filter,
1621
1634
  transform: p.transform,
1622
- interpretationHint: p.interpretation_hint
1635
+ interpretationHint: p.interpretation_hint,
1636
+ identity: p.identity
1623
1637
  });
1624
1638
  }
1625
1639
  if (json.constructor_actions) {
@@ -1688,16 +1702,19 @@ function buildSHACL(subjectName, target, properties, allRelationsMeta, conforman
1688
1702
  name: propName,
1689
1703
  path: propMeta.through
1690
1704
  };
1691
- if (propMeta.resolveLanguage === "literal") {
1692
- propShape.datatype = "xsd://string";
1693
- } else if (propMeta.initial) {
1694
- const initialType = typeof obj[propName];
1695
- if (initialType === "number") {
1696
- propShape.datatype = "xsd://integer";
1697
- } else if (initialType === "boolean") {
1698
- propShape.datatype = "xsd://boolean";
1699
- } else if (initialType === "string") {
1700
- propShape.datatype = "xsd://string";
1705
+ if (propMeta.datatype) {
1706
+ propShape.datatype = propMeta.datatype;
1707
+ } else {
1708
+ const isLiteral = propMeta.resolveLanguage === void 0 || propMeta.resolveLanguage === "literal";
1709
+ if ((propMeta.initial !== void 0 || isLiteral) && !propMeta.getter) {
1710
+ const initialType = typeof obj[propName];
1711
+ if (initialType === "number") {
1712
+ propShape.datatype = "xsd://integer";
1713
+ } else if (initialType === "boolean") {
1714
+ propShape.datatype = "xsd://boolean";
1715
+ } else if (initialType === "string" || isLiteral) {
1716
+ propShape.datatype = "xsd://string";
1717
+ }
1701
1718
  }
1702
1719
  }
1703
1720
  if (propMeta.required) {
@@ -1771,7 +1788,12 @@ function buildSHACL(subjectName, target, properties, allRelationsMeta, conforman
1771
1788
  name: relName,
1772
1789
  path: synthesizedPath
1773
1790
  };
1774
- relShape.nodeKind = "IRI";
1791
+ if (relMeta.datatype) {
1792
+ relShape.datatype = relMeta.datatype;
1793
+ relShape.nodeKind = "Literal";
1794
+ } else {
1795
+ relShape.nodeKind = "IRI";
1796
+ }
1775
1797
  relShape.relationKind = relMeta.kind;
1776
1798
  if (relMeta.kind === "hasOne" || relMeta.kind === "belongsToOne") {
1777
1799
  relShape.maxCount = 1;
@@ -2032,33 +2054,6 @@ function Optional(opts) {
2032
2054
  readOnly: opts.readOnly ?? false
2033
2055
  });
2034
2056
  }
2035
- function Flag(opts) {
2036
- return function(target, key) {
2037
- if (!opts.through && !opts.value) {
2038
- throw new Error("SubjectFlag requires a 'through' and 'value' option");
2039
- }
2040
- if (!opts.through) {
2041
- throw new Error("SubjectFlag requires a 'through' option");
2042
- }
2043
- if (!opts.value) {
2044
- throw new Error("SubjectFlag requires a 'value' option");
2045
- }
2046
- const entry = {
2047
- through: opts.through,
2048
- required: true,
2049
- initial: opts.value,
2050
- flag: true,
2051
- readOnly: true,
2052
- writable: false
2053
- };
2054
- const ctor = target.constructor;
2055
- if (!propertyRegistry.has(ctor))
2056
- propertyRegistry.set(ctor, {});
2057
- propertyRegistry.get(ctor)[key] = entry;
2058
- target[key] = opts.value;
2059
- Object.defineProperty(target, key, { configurable: true, writable: true });
2060
- };
2061
- }
2062
2057
  function Model$1(opts) {
2063
2058
  return function(target) {
2064
2059
  target.prototype.className = opts.name;
@@ -2078,7 +2073,6 @@ function Property(opts) {
2078
2073
  ...opts,
2079
2074
  required,
2080
2075
  readOnly: opts.readOnly ?? false,
2081
- resolveLanguage: opts.resolveLanguage ?? "literal",
2082
2076
  initial: opts.initial ?? (required ? "literal:string:uninitialized" : void 0)
2083
2077
  });
2084
2078
  }
@@ -2120,7 +2114,8 @@ function HasMany(first, second) {
2120
2114
  local: opts.local,
2121
2115
  ...opts.getter && { getter: opts.getter },
2122
2116
  ...opts.filter !== void 0 && { filter: opts.filter },
2123
- ...opts.where && { where: opts.where }
2117
+ ...opts.where && { where: opts.where },
2118
+ ...opts.datatype && { datatype: opts.datatype }
2124
2119
  };
2125
2120
  const relKey = key;
2126
2121
  if (opts.through) {
@@ -2662,6 +2657,9 @@ var PerspectiveProxy = class {
2662
2657
  async addAutoProcessorEventListener(cb) {
2663
2658
  return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addAutoProcessorEventListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, cb);
2664
2659
  }
2660
+ async addAutoProcessorNeighbourhoodStateListener(cb) {
2661
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addAutoProcessorNeighbourhoodStateListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, cb);
2662
+ }
2665
2663
  async infer(query) {
2666
2664
  return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
2667
2665
  }
@@ -3104,16 +3102,14 @@ var PerspectiveProxy = class {
3104
3102
  return null;
3105
3103
  }
3106
3104
  const flowUri = flowUriLinks[0].data.target;
3107
- const alternatePrefix = flowUri.endsWith("Flow") ? flowUri.slice(0, -4) + "." : flowUri + ".";
3108
- const sparqlQuery = `SELECT ?s ?p ?o WHERE {
3109
- ?s ?p ?o .
3110
- FILTER(?s = <${flowUri}> || STRSTARTS(STR(?s), "${alternatePrefix}"))
3111
- }`;
3112
- const sparqlResult = await this.querySparql(sparqlQuery);
3113
- const flowLinks = (sparqlResult || []).map((r) => ({
3114
- source: r.s,
3115
- predicate: r.p,
3116
- target: r.o
3105
+ const flowLevelLinks = await this.get(new LinkQuery({ source: flowUri }));
3106
+ const childUris = flowLevelLinks.filter((l) => l.data.predicate === "ad4m://hasState" || l.data.predicate === "ad4m://hasTransition").map((l) => l.data.target);
3107
+ const childResults = await Promise.all(childUris.map((uri) => this.get(new LinkQuery({ source: uri }))));
3108
+ const allExprs = [...flowLevelLinks, ...childResults.flat()];
3109
+ const flowLinks = allExprs.map((l) => ({
3110
+ source: l.data.source,
3111
+ predicate: l.data.predicate,
3112
+ target: l.data.target
3117
3113
  }));
3118
3114
  return SHACLFlow.fromLinks(flowLinks, flowUri);
3119
3115
  }
@@ -3791,9 +3787,9 @@ var PerspectiveClient = class {
3791
3787
  async linkMutations(uuid, mutations, status) {
3792
3788
  return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.linkMutations", { uuid, mutations, status });
3793
3789
  }
3794
- async runInterpretation(uuid, transcript, basePrefix, classes) {
3790
+ async runInterpretation(uuid, transcript, basePrefix, classes, existingScope, mintScope) {
3795
3791
  const RUN_INTERPRETATION_TIMEOUT_MS = 20 * 60 * 1e3;
3796
- return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.runInterpretation", { uuid, transcript, basePrefix, classes }, RUN_INTERPRETATION_TIMEOUT_MS);
3792
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.runInterpretation", { uuid, transcript, basePrefix, classes, existingScope, mintScope }, RUN_INTERPRETATION_TIMEOUT_MS);
3797
3793
  }
3798
3794
  async addAutoProcessor(uuid, config) {
3799
3795
  return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.addAutoProcessor", { uuid, ...config });
@@ -3813,7 +3809,20 @@ var PerspectiveClient = class {
3813
3809
  cb(data);
3814
3810
  }
3815
3811
  });
3816
- __classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
3812
+ let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
3813
+ existing.push(unsub);
3814
+ __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
3815
+ await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
3816
+ }
3817
+ async addAutoProcessorNeighbourhoodStateListener(uuid, cb) {
3818
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
3819
+ if (data.type === "auto-processor-neighbourhood-state" && data.perspectiveUuid === uuid) {
3820
+ cb(data);
3821
+ }
3822
+ });
3823
+ let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
3824
+ existing.push(unsub);
3825
+ __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
3817
3826
  await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
3818
3827
  }
3819
3828
  async addLinkExpression(uuid, link, status = "shared", batchId) {
@@ -9344,10 +9353,6 @@ function isArrayType(schema) {
9344
9353
  function isObjectType(schema) {
9345
9354
  return isSchemaType(schema, "object");
9346
9355
  }
9347
- function isNumericType(schema) {
9348
- const normalized = normalizeSchemaType(schema.type);
9349
- return normalized === "number" || normalized === "integer";
9350
- }
9351
9356
  function determineNamespace(schema, options) {
9352
9357
  if (options.namespace) {
9353
9358
  return options.namespace;
@@ -9469,10 +9474,6 @@ function buildModelFromJSONSchema(BaseClass, schema, options) {
9469
9474
  DynamicModelClass.prototype[setterName] = function() {
9470
9475
  };
9471
9476
  } else {
9472
- let resolveLanguage = getPropertyOption(propertyName, propertySchema, options, "resolveLanguage");
9473
- if (!resolveLanguage && options.resolveLanguage) {
9474
- resolveLanguage = options.resolveLanguage;
9475
- }
9476
9477
  const local = getPropertyOption(propertyName, propertySchema, options, "local");
9477
9478
  let readOnly = getPropertyOption(propertyName, propertySchema, options, "readOnly");
9478
9479
  if (readOnly === void 0) {
@@ -9481,16 +9482,10 @@ function buildModelFromJSONSchema(BaseClass, schema, options) {
9481
9482
  }
9482
9483
  const writable = !readOnly;
9483
9484
  let initial = getPropertyOption(propertyName, propertySchema, options, "initial");
9484
- if (isObjectType(propertySchema) && !resolveLanguage) {
9485
- resolveLanguage = "literal";
9485
+ const resolveLanguage = getPropertyOption(propertyName, propertySchema, options, "resolveLanguage");
9486
+ if (isObjectType(propertySchema)) {
9486
9487
  console.warn(`Property "${propertyName}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`);
9487
9488
  }
9488
- if ((resolveLanguage === void 0 || resolveLanguage === null) && isNumericType(propertySchema)) {
9489
- resolveLanguage = "literal";
9490
- }
9491
- if (resolveLanguage === void 0 || resolveLanguage === null) {
9492
- resolveLanguage = "literal";
9493
- }
9494
9489
  if (isRequired && !initial) {
9495
9490
  if (isObjectType(propertySchema)) {
9496
9491
  initial = "literal:json:{}";
@@ -9502,7 +9497,7 @@ function buildModelFromJSONSchema(BaseClass, schema, options) {
9502
9497
  through: predicate,
9503
9498
  required: isRequired,
9504
9499
  writable,
9505
- ...resolveLanguage && { resolveLanguage },
9500
+ ...resolveLanguage !== void 0 && { resolveLanguage },
9506
9501
  ...local !== void 0 && { local },
9507
9502
  ...initial && { initial }
9508
9503
  };
@@ -9565,13 +9560,43 @@ function hasJsOnlyWhereFilters(metadata, allRelationsMetadata, where) {
9565
9560
  }
9566
9561
  return false;
9567
9562
  }
9568
- function isLiteralStoredProperty(propMeta) {
9569
- if (propMeta.flag)
9563
+ function looksLikeUri(value) {
9564
+ if (!/^[a-zA-Z][a-zA-Z0-9+\-._]*:/.test(value))
9570
9565
  return false;
9571
- if (propMeta.resolveLanguage && propMeta.resolveLanguage !== "literal")
9566
+ if (/[\s<>{}"\u0000-\u001F\u007F-\u009F]/.test(value))
9572
9567
  return false;
9573
9568
  return true;
9574
9569
  }
9570
+ function valueToLiteralIri(value) {
9571
+ if (typeof value === "string") {
9572
+ if (looksLikeUri(value))
9573
+ return value;
9574
+ return Literal.from(value).toUrl();
9575
+ }
9576
+ if (typeof value === "number") {
9577
+ return Literal.from(value).toUrl();
9578
+ }
9579
+ if (typeof value === "boolean") {
9580
+ return Literal.from(value).toUrl();
9581
+ }
9582
+ if (value !== null && typeof value === "object") {
9583
+ return Literal.from(value).toUrl();
9584
+ }
9585
+ return Literal.from(String(value)).toUrl();
9586
+ }
9587
+ function effectiveLiteralStorage(meta) {
9588
+ const lang = meta.resolveLanguage;
9589
+ if (lang === void 0)
9590
+ return { kind: "deterministic" };
9591
+ if (lang === "literal")
9592
+ return { kind: "envelope" };
9593
+ return { kind: "custom", language: lang };
9594
+ }
9595
+ function isLiteralStoredProperty(propMeta) {
9596
+ if (propMeta.flag)
9597
+ return false;
9598
+ return effectiveLiteralStorage(propMeta).kind === "deterministic";
9599
+ }
9575
9600
  function escapeSPARQL(value) {
9576
9601
  return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\0/g, "").replace(/\f/g, "\\u000C");
9577
9602
  }
@@ -10307,7 +10332,7 @@ var Ad4mModel = class {
10307
10332
  predicate,
10308
10333
  required: isRequired,
10309
10334
  readOnly: propertySchema["x-ad4m"]?.writable === false,
10310
- ...propertySchema["x-ad4m"]?.resolveLanguage && { resolveLanguage: propertySchema["x-ad4m"].resolveLanguage },
10335
+ ...propertySchema["x-ad4m"]?.resolveLanguage !== void 0 && { resolveLanguage: propertySchema["x-ad4m"].resolveLanguage },
10311
10336
  ...propertySchema["x-ad4m"]?.initial && { initial: propertySchema["x-ad4m"].initial },
10312
10337
  ...propertySchema["x-ad4m"]?.local !== void 0 && { local: propertySchema["x-ad4m"].local }
10313
10338
  };
@@ -10323,7 +10348,7 @@ var Ad4mModel = class {
10323
10348
  }
10324
10349
  constructor(perspective, baseExpression) {
10325
10350
  this._snapshot = null;
10326
- this._baseExpression = baseExpression ? baseExpression : Literal.from(makeRandomId(24)).toUrl();
10351
+ this._baseExpression = baseExpression ? baseExpression : `ad4m://obj/${makeRandomId(24)}`;
10327
10352
  this._perspective = perspective;
10328
10353
  }
10329
10354
  get id() {
@@ -10613,12 +10638,16 @@ var Ad4mModel = class {
10613
10638
  return;
10614
10639
  }
10615
10640
  const actions = this.generatePropertySetterAction(key, metadata);
10616
- let resolveLanguage = metadata.resolveLanguage;
10617
10641
  if (value === void 0 || value === null || value === "") {
10618
10642
  return;
10619
10643
  }
10620
- if (resolveLanguage) {
10621
- value = await this._perspective.createExpression(value, resolveLanguage);
10644
+ const mode = effectiveLiteralStorage(metadata);
10645
+ if (mode.kind === "custom") {
10646
+ value = await this._perspective.createExpression(value, mode.language);
10647
+ } else if (mode.kind === "envelope") {
10648
+ value = await this._perspective.createExpression(value, "literal");
10649
+ } else {
10650
+ value = valueToLiteralIri(value);
10622
10651
  }
10623
10652
  await this._perspective.executeAction(actions, this._baseExpression, [{ name: "value", value }], batchId);
10624
10653
  }
@@ -10691,14 +10720,14 @@ var Ad4mModel = class {
10691
10720
  }
10692
10721
  const metadata = this.constructor.getModelMetadata();
10693
10722
  const hasConstructor = Object.values(metadata.properties).some((p) => p.required || p.flag || p.initial !== void 0);
10694
- const deferredResolveLanguageProps = [];
10723
+ const deferredExpressionProps = [];
10695
10724
  if (hasConstructor) {
10696
10725
  const initialValues = {};
10697
10726
  for (const [key, value] of Object.entries(this)) {
10698
10727
  if (value !== void 0 && value !== null && !(Array.isArray(value) && value.length > 0) && !value?.action) {
10699
10728
  const propMeta = metadata.properties[key];
10700
- if (propMeta?.resolveLanguage && propMeta.resolveLanguage !== "literal" && typeof value === "object") {
10701
- deferredResolveLanguageProps.push(key);
10729
+ if (propMeta && effectiveLiteralStorage(propMeta).kind !== "deterministic") {
10730
+ deferredExpressionProps.push(key);
10702
10731
  continue;
10703
10732
  }
10704
10733
  initialValues[key] = value;
@@ -10708,7 +10737,7 @@ var Ad4mModel = class {
10708
10737
  await this.perspective.createSubject(className, this._baseExpression, initialValues, batchId);
10709
10738
  }
10710
10739
  await this.innerUpdate(!hasConstructor, batchId);
10711
- for (const key of deferredResolveLanguageProps) {
10740
+ for (const key of deferredExpressionProps) {
10712
10741
  const value = this[key];
10713
10742
  if (value !== void 0 && value !== null) {
10714
10743
  await this.setProperty(key, value, batchId);
@@ -11124,7 +11153,6 @@ var __metadata = function(k, v) {
11124
11153
  var AutoProcessorConfig = class AutoProcessorConfig2 extends Ad4mModel {
11125
11154
  constructor() {
11126
11155
  super(...arguments);
11127
- this.type = "ad4m://AutoProcessor";
11128
11156
  this.processorId = "";
11129
11157
  this.sourceScopeQuery = "";
11130
11158
  this.interpretationClasses = [];
@@ -11133,10 +11161,6 @@ var AutoProcessorConfig = class AutoProcessorConfig2 extends Ad4mModel {
11133
11161
  this.claimTtlMs = "60000";
11134
11162
  }
11135
11163
  };
11136
- __decorate([
11137
- Flag({ through: "rdf://type", value: "ad4m://AutoProcessor" }),
11138
- __metadata("design:type", String)
11139
- ], AutoProcessorConfig.prototype, "type", void 0);
11140
11164
  __decorate([
11141
11165
  Property({ through: "ad4m://processor_id", required: true, identity: true }),
11142
11166
  __metadata("design:type", String)
@@ -11146,11 +11170,11 @@ __decorate([
11146
11170
  __metadata("design:type", String)
11147
11171
  ], AutoProcessorConfig.prototype, "sourceScopeQuery", void 0);
11148
11172
  __decorate([
11149
- Optional({ through: "ad4m://base_prefix", resolveLanguage: "literal" }),
11173
+ Optional({ through: "ad4m://base_prefix" }),
11150
11174
  __metadata("design:type", String)
11151
11175
  ], AutoProcessorConfig.prototype, "basePrefix", void 0);
11152
11176
  __decorate([
11153
- HasMany({ through: "ad4m://interpretation_class" }),
11177
+ HasMany({ through: "ad4m://interpretation_class", datatype: "xsd:string" }),
11154
11178
  __metadata("design:type", Array)
11155
11179
  ], AutoProcessorConfig.prototype, "interpretationClasses", void 0);
11156
11180
  __decorate([
@@ -11158,7 +11182,7 @@ __decorate([
11158
11182
  __metadata("design:type", String)
11159
11183
  ], AutoProcessorConfig.prototype, "debounceMs", void 0);
11160
11184
  __decorate([
11161
- Optional({ through: "ad4m://batch_min", resolveLanguage: "literal" }),
11185
+ Optional({ through: "ad4m://batch_min" }),
11162
11186
  __metadata("design:type", String)
11163
11187
  ], AutoProcessorConfig.prototype, "batchMin", void 0);
11164
11188
  __decorate([
@@ -11166,7 +11190,7 @@ __decorate([
11166
11190
  __metadata("design:type", String)
11167
11191
  ], AutoProcessorConfig.prototype, "batchMax", void 0);
11168
11192
  __decorate([
11169
- Optional({ through: "ad4m://max_wait_ms", resolveLanguage: "literal" }),
11193
+ Optional({ through: "ad4m://max_wait_ms" }),
11170
11194
  __metadata("design:type", String)
11171
11195
  ], AutoProcessorConfig.prototype, "maxWaitMs", void 0);
11172
11196
  __decorate([
@@ -11174,52 +11198,75 @@ __decorate([
11174
11198
  __metadata("design:type", String)
11175
11199
  ], AutoProcessorConfig.prototype, "claimTtlMs", void 0);
11176
11200
  __decorate([
11177
- Optional({ through: "ad4m://source_window_ms", resolveLanguage: "literal" }),
11201
+ Optional({ through: "ad4m://source_window_ms" }),
11178
11202
  __metadata("design:type", String)
11179
11203
  ], AutoProcessorConfig.prototype, "sourceWindowMs", void 0);
11180
11204
  __decorate([
11181
- Optional({ through: "ad4m://dedup_strategy", resolveLanguage: "literal" }),
11205
+ Optional({ through: "ad4m://dedup_strategy" }),
11182
11206
  __metadata("design:type", String)
11183
11207
  ], AutoProcessorConfig.prototype, "dedupStrategy", void 0);
11208
+ __decorate([
11209
+ Optional({ through: "ad4m://existing_scope" }),
11210
+ __metadata("design:type", String)
11211
+ ], AutoProcessorConfig.prototype, "existingScope", void 0);
11212
+ __decorate([
11213
+ Optional({ through: "ad4m://mint_scope" }),
11214
+ __metadata("design:type", String)
11215
+ ], AutoProcessorConfig.prototype, "mintScope", void 0);
11216
+ __decorate([
11217
+ Optional({ through: "ad4m://debug_mode", resolveLanguage: "literal" }),
11218
+ __metadata("design:type", String)
11219
+ ], AutoProcessorConfig.prototype, "debugMode", void 0);
11220
+ __decorate([
11221
+ Optional({ through: "ad4m://persist_debug", resolveLanguage: "literal" }),
11222
+ __metadata("design:type", String)
11223
+ ], AutoProcessorConfig.prototype, "persistDebug", void 0);
11224
+ __decorate([
11225
+ Optional({ through: "ad4m://emit_debug_events", resolveLanguage: "literal" }),
11226
+ __metadata("design:type", String)
11227
+ ], AutoProcessorConfig.prototype, "emitDebugEvents", void 0);
11184
11228
  AutoProcessorConfig = __decorate([
11185
- Model$1({ name: "AutoProcessorConfig" })
11229
+ Model$1({ name: "AutoProcessor" })
11186
11230
  ], AutoProcessorConfig);
11187
11231
  var InterpretationRun = class InterpretationRun2 extends Ad4mModel {
11188
11232
  constructor() {
11189
11233
  super(...arguments);
11190
- this.type = "ad4m://interpretation-run";
11191
11234
  this.runId = "";
11192
11235
  this.sources = [];
11193
11236
  }
11194
11237
  };
11195
- __decorate([
11196
- Flag({ through: "ad4m://type", value: "ad4m://interpretation-run" }),
11197
- __metadata("design:type", String)
11198
- ], InterpretationRun.prototype, "type", void 0);
11199
11238
  __decorate([
11200
11239
  Property({ through: "ad4m://interp/run_id", required: true, identity: true }),
11201
11240
  __metadata("design:type", String)
11202
11241
  ], InterpretationRun.prototype, "runId", void 0);
11203
11242
  __decorate([
11204
- Optional({ through: "ad4m://interp/model", resolveLanguage: "literal" }),
11243
+ Optional({ through: "ad4m://interp/model" }),
11205
11244
  __metadata("design:type", String)
11206
11245
  ], InterpretationRun.prototype, "model", void 0);
11207
11246
  __decorate([
11208
- Optional({ through: "ad4m://interp/prompt_version", resolveLanguage: "literal" }),
11247
+ Optional({ through: "ad4m://interp/prompt_version" }),
11209
11248
  __metadata("design:type", String)
11210
11249
  ], InterpretationRun.prototype, "promptVersion", void 0);
11211
11250
  __decorate([
11212
- Optional({ through: "ad4m://interp/ran_at", resolveLanguage: "literal" }),
11251
+ Optional({ through: "ad4m://interp/ran_at" }),
11213
11252
  __metadata("design:type", String)
11214
11253
  ], InterpretationRun.prototype, "ranAt", void 0);
11215
11254
  __decorate([
11216
- Optional({ through: "ad4m://interp/processor", resolveLanguage: "literal" }),
11255
+ Optional({ through: "ad4m://interp/processor" }),
11217
11256
  __metadata("design:type", String)
11218
11257
  ], InterpretationRun.prototype, "processor", void 0);
11219
11258
  __decorate([
11220
- HasMany({ through: "ad4m://interp/sources" }),
11259
+ HasMany({ through: "ad4m://interp/sources", datatype: "xsd:string" }),
11221
11260
  __metadata("design:type", Array)
11222
11261
  ], InterpretationRun.prototype, "sources", void 0);
11262
+ __decorate([
11263
+ Optional({ through: "ad4m://interp/debug_prompt", resolveLanguage: "literal" }),
11264
+ __metadata("design:type", String)
11265
+ ], InterpretationRun.prototype, "debugPrompt", void 0);
11266
+ __decorate([
11267
+ Optional({ through: "ad4m://interp/debug_response", resolveLanguage: "literal" }),
11268
+ __metadata("design:type", String)
11269
+ ], InterpretationRun.prototype, "debugResponse", void 0);
11223
11270
  InterpretationRun = __decorate([
11224
11271
  Model$1({ name: "InterpretationRun" })
11225
11272
  ], InterpretationRun);
@@ -11230,11 +11277,11 @@ var InterpretationOverlay = class InterpretationOverlay2 extends Ad4mModel {
11230
11277
  }
11231
11278
  };
11232
11279
  __decorate([
11233
- Property({ through: "ad4m://interp/kind", required: true, resolveLanguage: "literal" }),
11280
+ Property({ through: "ad4m://interp/kind", required: true }),
11234
11281
  __metadata("design:type", String)
11235
11282
  ], InterpretationOverlay.prototype, "kind", void 0);
11236
11283
  __decorate([
11237
- Optional({ through: "ad4m://interp/run", resolveLanguage: "literal" }),
11284
+ Optional({ through: "ad4m://interp/run" }),
11238
11285
  __metadata("design:type", String)
11239
11286
  ], InterpretationOverlay.prototype, "run", void 0);
11240
11287
  InterpretationOverlay = __decorate([