agentlang 0.3.0 → 0.3.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/README.md +295 -31
- package/out/api/http.d.ts.map +1 -1
- package/out/api/http.js +5 -3
- package/out/api/http.js.map +1 -1
- package/out/language/agentlang-validator.d.ts.map +1 -1
- package/out/language/agentlang-validator.js +24 -4
- package/out/language/agentlang-validator.js.map +1 -1
- package/out/language/generated/ast.d.ts +58 -7
- package/out/language/generated/ast.d.ts.map +1 -1
- package/out/language/generated/ast.js +82 -1
- package/out/language/generated/ast.js.map +1 -1
- package/out/language/generated/grammar.d.ts.map +1 -1
- package/out/language/generated/grammar.js +537 -216
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/main.cjs +614 -221
- package/out/language/main.cjs.map +2 -2
- package/out/runtime/agents/common.d.ts +15 -1
- package/out/runtime/agents/common.d.ts.map +1 -1
- package/out/runtime/agents/common.js +71 -2
- package/out/runtime/agents/common.js.map +1 -1
- package/out/runtime/exec-graph.d.ts.map +1 -1
- package/out/runtime/exec-graph.js +1 -7
- package/out/runtime/exec-graph.js.map +1 -1
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +45 -17
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/loader.d.ts +3 -4
- package/out/runtime/loader.d.ts.map +1 -1
- package/out/runtime/loader.js +97 -12
- package/out/runtime/loader.js.map +1 -1
- package/out/runtime/module.d.ts +41 -4
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +237 -18
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.d.ts.map +1 -1
- package/out/runtime/modules/ai.js +16 -7
- package/out/runtime/modules/ai.js.map +1 -1
- package/out/runtime/modules/auth.d.ts.map +1 -1
- package/out/runtime/modules/auth.js +42 -43
- package/out/runtime/modules/auth.js.map +1 -1
- package/out/runtime/modules/core.js +1 -1
- package/out/runtime/util.d.ts +3 -1
- package/out/runtime/util.d.ts.map +1 -1
- package/out/runtime/util.js +16 -0
- package/out/runtime/util.js.map +1 -1
- package/out/syntaxes/agentlang.monarch.js +1 -1
- package/out/syntaxes/agentlang.monarch.js.map +1 -1
- package/package.json +1 -1
- package/src/api/http.ts +5 -3
- package/src/language/agentlang-validator.ts +29 -4
- package/src/language/agentlang.langium +15 -3
- package/src/language/generated/ast.ts +149 -7
- package/src/language/generated/grammar.ts +537 -216
- package/src/runtime/agents/common.ts +96 -3
- package/src/runtime/exec-graph.ts +1 -8
- package/src/runtime/interpreter.ts +47 -16
- package/src/runtime/loader.ts +110 -9
- package/src/runtime/module.ts +268 -24
- package/src/runtime/modules/ai.ts +13 -6
- package/src/runtime/modules/auth.ts +42 -43
- package/src/runtime/modules/core.ts +1 -1
- package/src/runtime/util.ts +19 -0
- package/src/syntaxes/agentlang.monarch.ts +1 -1
package/out/runtime/module.js
CHANGED
|
@@ -6,15 +6,23 @@ import { AdminSession } from './auth/defs.js';
|
|
|
6
6
|
import { FetchModuleFn, PathAttributeName } from './defs.js';
|
|
7
7
|
import { logger } from './logger.js';
|
|
8
8
|
import { FlowStepPattern } from '../language/syntax.js';
|
|
9
|
-
import { getAgentDirectives, getAgentDirectivesJson, getAgentGlossary, getAgentResponseSchema, getAgentScenarios, registerAgentDirectives, registerAgentGlossary, registerAgentResponseSchema, registerAgentScenarios, removeAgentDirectives, removeAgentGlossary, removeAgentResponseSchema, removeAgentScenarios, } from './agents/common.js';
|
|
9
|
+
import { getAgentDirectives, getAgentDirectivesJson, getAgentGlossary, getAgentGlossaryJson, getAgentResponseSchema, getAgentScenarios, getAgentScenariosJson, registerAgentDirectives, registerAgentGlossary, registerAgentResponseSchema, registerAgentScenarios, removeAgentDirectives, removeAgentGlossary, removeAgentResponseSchema, removeAgentScenarios, } from './agents/common.js';
|
|
10
10
|
export class ModuleEntry {
|
|
11
11
|
constructor(name, moduleName) {
|
|
12
|
+
this.taggedAsPublic = false;
|
|
12
13
|
this.name = name;
|
|
13
14
|
this.moduleName = moduleName;
|
|
14
15
|
}
|
|
15
16
|
getFqName() {
|
|
16
17
|
return makeFqName(this.moduleName, this.name);
|
|
17
18
|
}
|
|
19
|
+
setPublic(flag) {
|
|
20
|
+
this.taggedAsPublic = flag;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
isPublic() {
|
|
24
|
+
return this.taggedAsPublic;
|
|
25
|
+
}
|
|
18
26
|
}
|
|
19
27
|
function normalizePropertyNames(props) {
|
|
20
28
|
// Convert iterator to array for compatibility with different Node.js versions
|
|
@@ -452,6 +460,9 @@ export class Record extends ModuleEntry {
|
|
|
452
460
|
const ms = `@meta ${JSON.stringify(metaObj)}`;
|
|
453
461
|
scms = `${scms},\n ${ms}`;
|
|
454
462
|
}
|
|
463
|
+
if (this.isPublic()) {
|
|
464
|
+
s = `@public ${s}`;
|
|
465
|
+
}
|
|
455
466
|
return s.concat('\n{', scms, '\n}\n');
|
|
456
467
|
}
|
|
457
468
|
getUserAttributes() {
|
|
@@ -835,22 +846,28 @@ export class Agent extends Record {
|
|
|
835
846
|
if (conds) {
|
|
836
847
|
attrs.push(` directives ${conds}`);
|
|
837
848
|
}
|
|
838
|
-
const scns =
|
|
849
|
+
const scns = getAgentScenariosJson(fqName);
|
|
839
850
|
if (scns) {
|
|
840
|
-
attrs.push(` scenarios ${
|
|
851
|
+
attrs.push(` scenarios ${scns}`);
|
|
841
852
|
}
|
|
842
|
-
const gls =
|
|
853
|
+
const gls = getAgentGlossaryJson(fqName);
|
|
843
854
|
if (gls) {
|
|
844
|
-
attrs.push(` glossary ${
|
|
855
|
+
attrs.push(` glossary ${gls}`);
|
|
845
856
|
}
|
|
846
857
|
const rscm = getAgentResponseSchema(fqName);
|
|
847
858
|
if (rscm) {
|
|
848
859
|
attrs.push(` responseSchema ${rscm}`);
|
|
849
860
|
}
|
|
850
|
-
|
|
861
|
+
const s = `agent ${Agent.NormalizeName(this.name)}
|
|
851
862
|
{
|
|
852
863
|
${attrs.join(',\n')}
|
|
853
864
|
}`;
|
|
865
|
+
if (this.isPublic()) {
|
|
866
|
+
return `@public ${s}`;
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
return s;
|
|
870
|
+
}
|
|
854
871
|
}
|
|
855
872
|
static EscapeName(n) {
|
|
856
873
|
if (n.endsWith(Agent.Suffix)) {
|
|
@@ -893,6 +910,10 @@ export class Event extends Record {
|
|
|
893
910
|
super(...arguments);
|
|
894
911
|
this.type = RecordType.EVENT;
|
|
895
912
|
}
|
|
913
|
+
isSystemDefined() {
|
|
914
|
+
var _a;
|
|
915
|
+
return ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.get(SystemDefinedEvent)) === 'true';
|
|
916
|
+
}
|
|
896
917
|
}
|
|
897
918
|
var RelType;
|
|
898
919
|
(function (RelType) {
|
|
@@ -911,7 +932,7 @@ export function newRelNodeEntry(nodeFqName, alias) {
|
|
|
911
932
|
function relNodeEntryToString(node) {
|
|
912
933
|
let n = `${node.origName}`;
|
|
913
934
|
if (node.origAlias) {
|
|
914
|
-
n = n.concat(` as ${node.origAlias}`);
|
|
935
|
+
n = n.concat(` @as ${node.origAlias}`);
|
|
915
936
|
}
|
|
916
937
|
return n;
|
|
917
938
|
}
|
|
@@ -1093,10 +1114,10 @@ export class Relationship extends Record {
|
|
|
1093
1114
|
}
|
|
1094
1115
|
}
|
|
1095
1116
|
export class Workflow extends ModuleEntry {
|
|
1096
|
-
constructor(name, patterns, moduleName,
|
|
1117
|
+
constructor(name, patterns, moduleName, isPrePost = false) {
|
|
1097
1118
|
super(name, moduleName);
|
|
1098
1119
|
this.statements = patterns;
|
|
1099
|
-
this.
|
|
1120
|
+
this.isPrePost = isPrePost;
|
|
1100
1121
|
}
|
|
1101
1122
|
async addStatement(stmtCode) {
|
|
1102
1123
|
const result = await parseStatement(stmtCode);
|
|
@@ -1222,11 +1243,30 @@ export class Workflow extends ModuleEntry {
|
|
|
1222
1243
|
statementsToStrings() {
|
|
1223
1244
|
return this.statementsToStringsHelper(this.statements);
|
|
1224
1245
|
}
|
|
1246
|
+
setPublic(flag) {
|
|
1247
|
+
super.setPublic(flag);
|
|
1248
|
+
if (!this.isPrePost) {
|
|
1249
|
+
const n = normalizeWorkflowName(this.name);
|
|
1250
|
+
const event = getEvent(n, this.moduleName);
|
|
1251
|
+
event.setPublic(flag);
|
|
1252
|
+
}
|
|
1253
|
+
return this;
|
|
1254
|
+
}
|
|
1225
1255
|
toString() {
|
|
1226
|
-
const n = this.
|
|
1227
|
-
|
|
1256
|
+
const n = this.isPrePost ? untangleWorkflowName(this.name) : this.name;
|
|
1257
|
+
const nn = normalizeWorkflowName(n);
|
|
1258
|
+
let s = `workflow ${nn} {\n`;
|
|
1228
1259
|
const ss = this.statementsToStringsHelper(this.statements);
|
|
1229
1260
|
s = s.concat(joinStatements(ss));
|
|
1261
|
+
if (!this.isPrePost) {
|
|
1262
|
+
const event = getEvent(nn, this.moduleName);
|
|
1263
|
+
if ((event.isPublic() && event.isSystemDefined()) || this.isPublic()) {
|
|
1264
|
+
s = `@public ${s}`;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
else if (this.isPublic()) {
|
|
1268
|
+
s = `@public ${s}`;
|
|
1269
|
+
}
|
|
1230
1270
|
return s.concat('\n}');
|
|
1231
1271
|
}
|
|
1232
1272
|
}
|
|
@@ -1310,6 +1350,46 @@ export class Flow extends ModuleEntry {
|
|
|
1310
1350
|
}`;
|
|
1311
1351
|
}
|
|
1312
1352
|
}
|
|
1353
|
+
export class Scenario extends ModuleEntry {
|
|
1354
|
+
constructor(name, moduleName, scn) {
|
|
1355
|
+
super(name, moduleName);
|
|
1356
|
+
this.def = scn;
|
|
1357
|
+
}
|
|
1358
|
+
toString() {
|
|
1359
|
+
const obj = {
|
|
1360
|
+
user: this.def.user,
|
|
1361
|
+
ai: this.def.ai,
|
|
1362
|
+
};
|
|
1363
|
+
return `scenario ${this.name} ${JSON.stringify(obj)}`;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
export class Directive extends ModuleEntry {
|
|
1367
|
+
constructor(name, moduleName, def) {
|
|
1368
|
+
super(name, moduleName);
|
|
1369
|
+
this.def = def;
|
|
1370
|
+
}
|
|
1371
|
+
toString() {
|
|
1372
|
+
const obj = {
|
|
1373
|
+
if: this.def.if,
|
|
1374
|
+
then: this.def.then,
|
|
1375
|
+
};
|
|
1376
|
+
return `directive ${this.name} ${JSON.stringify(obj)}`;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
export class GlossaryEntry extends ModuleEntry {
|
|
1380
|
+
constructor(name, moduleName, def) {
|
|
1381
|
+
super(name, moduleName);
|
|
1382
|
+
this.def = def;
|
|
1383
|
+
}
|
|
1384
|
+
toString() {
|
|
1385
|
+
const obj = {
|
|
1386
|
+
name: this.def.name,
|
|
1387
|
+
meaning: this.def.meaning,
|
|
1388
|
+
synonyms: this.def.synonyms,
|
|
1389
|
+
};
|
|
1390
|
+
return `glossaryEntry ${this.name} ${JSON.stringify(obj)}`;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1313
1393
|
export function flowGraphNext(graph, currentNode, onCondition) {
|
|
1314
1394
|
var _a;
|
|
1315
1395
|
if (!currentNode) {
|
|
@@ -1440,6 +1520,108 @@ export class Module {
|
|
|
1440
1520
|
}
|
|
1441
1521
|
return undefined;
|
|
1442
1522
|
}
|
|
1523
|
+
getAllDecisions() {
|
|
1524
|
+
return this.entries.filter((e) => {
|
|
1525
|
+
return e instanceof Decision;
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
removeDecision(name) {
|
|
1529
|
+
for (let i = 0; i < this.entries.length; ++i) {
|
|
1530
|
+
const entry = this.entries[i];
|
|
1531
|
+
if (entry.name === name && entry instanceof Decision) {
|
|
1532
|
+
this.entries.splice(i, 1);
|
|
1533
|
+
return true;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
return false;
|
|
1537
|
+
}
|
|
1538
|
+
addScenario(name, scn) {
|
|
1539
|
+
const entry = new Scenario(name, this.name, scn);
|
|
1540
|
+
this.addEntry(entry);
|
|
1541
|
+
return entry;
|
|
1542
|
+
}
|
|
1543
|
+
getScenario(name) {
|
|
1544
|
+
if (this.hasEntry(name)) {
|
|
1545
|
+
const e = this.getEntry(name);
|
|
1546
|
+
if (e instanceof Scenario) {
|
|
1547
|
+
return e;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
return undefined;
|
|
1551
|
+
}
|
|
1552
|
+
getAllScenarios() {
|
|
1553
|
+
return this.entries.filter((e) => {
|
|
1554
|
+
return e instanceof Scenario;
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
removeScenario(name) {
|
|
1558
|
+
for (let i = 0; i < this.entries.length; ++i) {
|
|
1559
|
+
const entry = this.entries[i];
|
|
1560
|
+
if (entry.name === name && entry instanceof Scenario) {
|
|
1561
|
+
this.entries.splice(i, 1);
|
|
1562
|
+
break;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
return this;
|
|
1566
|
+
}
|
|
1567
|
+
addDirective(name, cond) {
|
|
1568
|
+
const entry = new Directive(name, this.name, cond);
|
|
1569
|
+
this.addEntry(entry);
|
|
1570
|
+
return entry;
|
|
1571
|
+
}
|
|
1572
|
+
getDirective(name) {
|
|
1573
|
+
if (this.hasEntry(name)) {
|
|
1574
|
+
const e = this.getEntry(name);
|
|
1575
|
+
if (e instanceof Directive) {
|
|
1576
|
+
return e;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
return undefined;
|
|
1580
|
+
}
|
|
1581
|
+
getAllDirectives() {
|
|
1582
|
+
return this.entries.filter((e) => {
|
|
1583
|
+
return e instanceof Directive;
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
removeDirective(name) {
|
|
1587
|
+
for (let i = 0; i < this.entries.length; ++i) {
|
|
1588
|
+
const entry = this.entries[i];
|
|
1589
|
+
if (entry.name === name && entry instanceof Directive) {
|
|
1590
|
+
this.entries.splice(i, 1);
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
return this;
|
|
1595
|
+
}
|
|
1596
|
+
addGlossaryEntry(name, ge) {
|
|
1597
|
+
const entry = new GlossaryEntry(name, this.name, ge);
|
|
1598
|
+
this.addEntry(entry);
|
|
1599
|
+
return entry;
|
|
1600
|
+
}
|
|
1601
|
+
getGlossaryEntry(name) {
|
|
1602
|
+
if (this.hasEntry(name)) {
|
|
1603
|
+
const e = this.getEntry(name);
|
|
1604
|
+
if (e instanceof GlossaryEntry) {
|
|
1605
|
+
return e;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
return undefined;
|
|
1609
|
+
}
|
|
1610
|
+
getAllGlossaryEntries() {
|
|
1611
|
+
return this.entries.filter((e) => {
|
|
1612
|
+
return e instanceof GlossaryEntry;
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
removeGlossaryEntry(name) {
|
|
1616
|
+
for (let i = 0; i < this.entries.length; ++i) {
|
|
1617
|
+
const entry = this.entries[i];
|
|
1618
|
+
if (entry.name === name && entry instanceof GlossaryEntry) {
|
|
1619
|
+
this.entries.splice(i, 1);
|
|
1620
|
+
break;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
return this;
|
|
1624
|
+
}
|
|
1443
1625
|
addStandaloneStatement(stmt) {
|
|
1444
1626
|
const s = new StandaloneStatement(stmt, this.name);
|
|
1445
1627
|
this.addEntry(s);
|
|
@@ -1465,6 +1647,12 @@ export class Module {
|
|
|
1465
1647
|
throw new Error(`Entry ${entryName} not found in module ${this.name}`);
|
|
1466
1648
|
return this.entries[idx];
|
|
1467
1649
|
}
|
|
1650
|
+
getEntrySafe(entryName) {
|
|
1651
|
+
const idx = this.getEntryIndex(entryName);
|
|
1652
|
+
if (idx < 0)
|
|
1653
|
+
return undefined;
|
|
1654
|
+
return this.entries[idx];
|
|
1655
|
+
}
|
|
1468
1656
|
getRecord(recordName) {
|
|
1469
1657
|
const e = this.getEntry(recordName);
|
|
1470
1658
|
if (e instanceof Record) {
|
|
@@ -1524,10 +1712,24 @@ export class Module {
|
|
|
1524
1712
|
});
|
|
1525
1713
|
}
|
|
1526
1714
|
getWorkflowForEvent(eventName) {
|
|
1527
|
-
|
|
1715
|
+
const entry = this.getEntrySafe(asWorkflowName(eventName));
|
|
1716
|
+
if (entry)
|
|
1717
|
+
return entry;
|
|
1718
|
+
else
|
|
1719
|
+
return undefined;
|
|
1720
|
+
}
|
|
1721
|
+
eventIsPublic(eventName) {
|
|
1722
|
+
const entry = this.getEntry(eventName);
|
|
1723
|
+
if (entry instanceof Event) {
|
|
1724
|
+
return entry.isPublic();
|
|
1725
|
+
}
|
|
1726
|
+
return false;
|
|
1528
1727
|
}
|
|
1529
1728
|
isPrePostEvent(eventName) {
|
|
1530
|
-
|
|
1729
|
+
const wf = this.getWorkflowForEvent(eventName);
|
|
1730
|
+
if (wf)
|
|
1731
|
+
return wf.isPrePost;
|
|
1732
|
+
return false;
|
|
1531
1733
|
}
|
|
1532
1734
|
isEntryOfType(t, name) {
|
|
1533
1735
|
const entry = this.getEntriesOfType(t).find((v) => {
|
|
@@ -1703,6 +1905,10 @@ const TextualTypes = new Set(['String', 'Email', 'UUID', 'DateTime', 'Date', 'Ti
|
|
|
1703
1905
|
function isTextualType(type) {
|
|
1704
1906
|
return TextualTypes.has(type);
|
|
1705
1907
|
}
|
|
1908
|
+
const NumericTypes = new Set(['Int', 'Number', 'Float', 'Decimal']);
|
|
1909
|
+
function isNumericType(type) {
|
|
1910
|
+
return NumericTypes.has(type);
|
|
1911
|
+
}
|
|
1706
1912
|
export function isBuiltInType(type) {
|
|
1707
1913
|
return builtInTypes.has(type);
|
|
1708
1914
|
}
|
|
@@ -1824,6 +2030,9 @@ export function isArrayAttribute(attrSpec) {
|
|
|
1824
2030
|
export function isObjectAttribute(attrSpec) {
|
|
1825
2031
|
return getBooleanProperty('object', attrSpec);
|
|
1826
2032
|
}
|
|
2033
|
+
export function isNumericAttribute(attrSpec) {
|
|
2034
|
+
return isNumericType(attrSpec.type);
|
|
2035
|
+
}
|
|
1827
2036
|
export function getAttributeExpr(attrSpec) {
|
|
1828
2037
|
return getAnyProperty('expr', attrSpec);
|
|
1829
2038
|
}
|
|
@@ -1897,7 +2106,7 @@ function normalizeWorkflowName(n) {
|
|
|
1897
2106
|
}
|
|
1898
2107
|
return n;
|
|
1899
2108
|
}
|
|
1900
|
-
export function addWorkflow(name, moduleName = activeModule, statements, hdr) {
|
|
2109
|
+
export function addWorkflow(name, moduleName = activeModule, statements, hdr, ispub = false) {
|
|
1901
2110
|
if (hdr) {
|
|
1902
2111
|
name = prePostWorkflowName(hdr.tag, hdr.prefix, hdr.name, moduleName);
|
|
1903
2112
|
}
|
|
@@ -1908,9 +2117,11 @@ export function addWorkflow(name, moduleName = activeModule, statements, hdr) {
|
|
|
1908
2117
|
throw new Error(`Not an event, cannot attach workflow to ${entry.name}`);
|
|
1909
2118
|
}
|
|
1910
2119
|
else {
|
|
1911
|
-
addEvent(name, moduleName);
|
|
1912
|
-
const event = module.getEntry(name);
|
|
2120
|
+
const event = addEvent(name, moduleName);
|
|
1913
2121
|
event.addMeta(SystemDefinedEvent, 'true');
|
|
2122
|
+
if (ispub) {
|
|
2123
|
+
event.setPublic(true);
|
|
2124
|
+
}
|
|
1914
2125
|
}
|
|
1915
2126
|
if (!statements)
|
|
1916
2127
|
statements = new Array();
|
|
@@ -2239,7 +2450,11 @@ export class Instance {
|
|
|
2239
2450
|
attrs.forEach((v, k) => {
|
|
2240
2451
|
const attrSpec = this.record.schema.get(k);
|
|
2241
2452
|
if (attrSpec) {
|
|
2242
|
-
|
|
2453
|
+
const isstr = isString(v);
|
|
2454
|
+
if (isNumericAttribute(attrSpec) && isstr) {
|
|
2455
|
+
attrs.set(k, Number(v));
|
|
2456
|
+
}
|
|
2457
|
+
else if ((isArrayAttribute(attrSpec) || isObjectAttribute(attrSpec)) && isstr) {
|
|
2243
2458
|
const obj = JSON.parse(v);
|
|
2244
2459
|
attrs.set(k, obj);
|
|
2245
2460
|
}
|
|
@@ -2533,7 +2748,7 @@ export function makeInstance(moduleName, entryName, attributes, queryAttributes,
|
|
|
2533
2748
|
if (schema.size > 0) {
|
|
2534
2749
|
attributes.forEach((value, key) => {
|
|
2535
2750
|
if (!schema.has(key)) {
|
|
2536
|
-
throw new Error(`Invalid attribute ${key} specified for ${moduleName}/${entryName}`);
|
|
2751
|
+
throw new Error(`Invalid attribute '${key}' specified for ${moduleName}/${entryName}`);
|
|
2537
2752
|
}
|
|
2538
2753
|
const spec = getAttributeSpec(schema, key);
|
|
2539
2754
|
if (value != null && value != undefined)
|
|
@@ -2628,6 +2843,10 @@ export function defineAgentEvent(moduleName, agentName, instruction) {
|
|
|
2628
2843
|
event.addMeta(DocumentationMetaTag, `This event will trigger an agent which has the instruction - "${instruction}".
|
|
2629
2844
|
So make sure to pass all relevant information in the 'message' attribute of this event.`);
|
|
2630
2845
|
}
|
|
2846
|
+
const agent = module.getAgent(agentName);
|
|
2847
|
+
if (agent && agent.isPublic()) {
|
|
2848
|
+
event.setPublic(true);
|
|
2849
|
+
}
|
|
2631
2850
|
module.addEntry(event);
|
|
2632
2851
|
}
|
|
2633
2852
|
export function isTimer(eventInst) {
|