agentlang 0.3.1 → 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.
@@ -20,9 +20,6 @@ import {
20
20
  RbacSpecEntries,
21
21
  RbacOpr,
22
22
  WorkflowHeader,
23
- ScenarioDefinition,
24
- DirectiveDefinition,
25
- GlossaryEntryDefinition,
26
23
  } from '../language/generated/ast.js';
27
24
  import {
28
25
  Path,
@@ -1596,54 +1593,55 @@ export class Flow extends ModuleEntry {
1596
1593
  }
1597
1594
  }
1598
1595
 
1599
- class Scenario extends ModuleEntry {
1600
- private def: ScenarioDefinition;
1596
+ export class Scenario extends ModuleEntry {
1597
+ def: AgentScenario;
1601
1598
 
1602
- constructor(def: ScenarioDefinition, moduleName: string) {
1603
- super(def.name, moduleName);
1604
- this.def = def;
1599
+ constructor(name: string, moduleName: string, scn: AgentScenario) {
1600
+ super(name, moduleName);
1601
+ this.def = scn;
1605
1602
  }
1606
1603
 
1607
1604
  override toString(): string {
1608
- const s = this.def.$cstNode?.text;
1609
- if (s) {
1610
- return s;
1611
- }
1612
- throw new Error(`failed to generate code for scenario ${this.moduleName}/${this.name}`);
1605
+ const obj: any = {
1606
+ user: this.def.user,
1607
+ ai: this.def.ai,
1608
+ };
1609
+ return `scenario ${this.name} ${JSON.stringify(obj)}`;
1613
1610
  }
1614
1611
  }
1615
1612
 
1616
- class Directive extends ModuleEntry {
1617
- private def: DirectiveDefinition;
1613
+ export class Directive extends ModuleEntry {
1614
+ private def: AgentCondition;
1618
1615
 
1619
- constructor(def: DirectiveDefinition, moduleName: string) {
1620
- super(def.name, moduleName);
1616
+ constructor(name: string, moduleName: string, def: AgentCondition) {
1617
+ super(name, moduleName);
1621
1618
  this.def = def;
1622
1619
  }
1623
1620
 
1624
1621
  override toString(): string {
1625
- const s = this.def.$cstNode?.text;
1626
- if (s) {
1627
- return s;
1628
- }
1629
- throw new Error(`failed to generate code for directive ${this.moduleName}/${this.name}`);
1622
+ const obj: any = {
1623
+ if: this.def.if,
1624
+ then: this.def.then,
1625
+ };
1626
+ return `directive ${this.name} ${JSON.stringify(obj)}`;
1630
1627
  }
1631
1628
  }
1632
1629
 
1633
- class GlossaryEntry extends ModuleEntry {
1634
- private def: GlossaryEntryDefinition;
1630
+ export class GlossaryEntry extends ModuleEntry {
1631
+ private def: AgentGlossaryEntry;
1635
1632
 
1636
- constructor(def: GlossaryEntryDefinition, moduleName: string) {
1637
- super(def.name, moduleName);
1633
+ constructor(name: string, moduleName: string, def: AgentGlossaryEntry) {
1634
+ super(name, moduleName);
1638
1635
  this.def = def;
1639
1636
  }
1640
1637
 
1641
1638
  override toString(): string {
1642
- const s = this.def.$cstNode?.text;
1643
- if (s) {
1644
- return s;
1645
- }
1646
- throw new Error(`failed to generate code for glossaryEntry ${this.moduleName}/${this.name}`);
1639
+ const obj: any = {
1640
+ name: this.def.name,
1641
+ meaning: this.def.meaning,
1642
+ synonyms: this.def.synonyms,
1643
+ };
1644
+ return `glossaryEntry ${this.name} ${JSON.stringify(obj)}`;
1647
1645
  }
1648
1646
  }
1649
1647
 
@@ -1802,66 +1800,119 @@ export class Module {
1802
1800
  return undefined;
1803
1801
  }
1804
1802
 
1805
- addScenario(scn: ScenarioDefinition): Scenario {
1806
- const entry = new Scenario(scn, this.name);
1803
+ getAllDecisions(): Decision[] {
1804
+ return this.entries.filter((e: ModuleEntry) => {
1805
+ return e instanceof Decision;
1806
+ });
1807
+ }
1808
+
1809
+ removeDecision(name: string): boolean {
1810
+ for (let i = 0; i < this.entries.length; ++i) {
1811
+ const entry = this.entries[i];
1812
+ if (entry.name === name && entry instanceof Decision) {
1813
+ this.entries.splice(i, 1);
1814
+ return true;
1815
+ }
1816
+ }
1817
+ return false;
1818
+ }
1819
+
1820
+ addScenario(name: string, scn: AgentScenario): Scenario {
1821
+ const entry = new Scenario(name, this.name, scn);
1807
1822
  this.addEntry(entry);
1808
1823
  return entry;
1809
1824
  }
1810
1825
 
1826
+ getScenario(name: string): Scenario | undefined {
1827
+ if (this.hasEntry(name)) {
1828
+ const e = this.getEntry(name);
1829
+ if (e instanceof Scenario) {
1830
+ return e as Scenario;
1831
+ }
1832
+ }
1833
+ return undefined;
1834
+ }
1835
+
1836
+ getAllScenarios(): Scenario[] {
1837
+ return this.entries.filter((e: ModuleEntry) => {
1838
+ return e instanceof Scenario;
1839
+ });
1840
+ }
1841
+
1811
1842
  removeScenario(name: string): Module {
1812
- let idx = -1;
1813
1843
  for (let i = 0; i < this.entries.length; ++i) {
1814
1844
  const entry = this.entries[i];
1815
1845
  if (entry.name === name && entry instanceof Scenario) {
1816
- idx = i;
1846
+ this.entries.splice(i, 1);
1817
1847
  break;
1818
1848
  }
1819
1849
  }
1820
- if (idx >= 0) {
1821
- this.entries.splice(idx, 1);
1822
- }
1823
1850
  return this;
1824
1851
  }
1825
1852
 
1826
- addDirective(dd: DirectiveDefinition): Directive {
1827
- const entry = new Directive(dd, this.name);
1853
+ addDirective(name: string, cond: AgentCondition): Directive {
1854
+ const entry = new Directive(name, this.name, cond);
1828
1855
  this.addEntry(entry);
1829
1856
  return entry;
1830
1857
  }
1831
1858
 
1859
+ getDirective(name: string): Directive | undefined {
1860
+ if (this.hasEntry(name)) {
1861
+ const e = this.getEntry(name);
1862
+ if (e instanceof Directive) {
1863
+ return e as Directive;
1864
+ }
1865
+ }
1866
+ return undefined;
1867
+ }
1868
+
1869
+ getAllDirectives(): Directive[] {
1870
+ return this.entries.filter((e: ModuleEntry) => {
1871
+ return e instanceof Directive;
1872
+ });
1873
+ }
1874
+
1832
1875
  removeDirective(name: string): Module {
1833
- let idx = -1;
1834
1876
  for (let i = 0; i < this.entries.length; ++i) {
1835
1877
  const entry = this.entries[i];
1836
1878
  if (entry.name === name && entry instanceof Directive) {
1837
- idx = i;
1879
+ this.entries.splice(i, 1);
1838
1880
  break;
1839
1881
  }
1840
1882
  }
1841
- if (idx >= 0) {
1842
- this.entries.splice(idx, 1);
1843
- }
1844
1883
  return this;
1845
1884
  }
1846
1885
 
1847
- addGlossaryEntry(ge: GlossaryEntryDefinition): GlossaryEntry {
1848
- const entry = new GlossaryEntry(ge, this.name);
1886
+ addGlossaryEntry(name: string, ge: AgentGlossaryEntry): GlossaryEntry {
1887
+ const entry = new GlossaryEntry(name, this.name, ge);
1849
1888
  this.addEntry(entry);
1850
1889
  return entry;
1851
1890
  }
1852
1891
 
1892
+ getGlossaryEntry(name: string): GlossaryEntry | undefined {
1893
+ if (this.hasEntry(name)) {
1894
+ const e = this.getEntry(name);
1895
+ if (e instanceof GlossaryEntry) {
1896
+ return e as GlossaryEntry;
1897
+ }
1898
+ }
1899
+ return undefined;
1900
+ }
1901
+
1902
+ getAllGlossaryEntries(): GlossaryEntry[] {
1903
+ return this.entries.filter((e: ModuleEntry) => {
1904
+ return e instanceof GlossaryEntry;
1905
+ });
1906
+ }
1907
+
1853
1908
  removeGlossaryEntry(name: string): Module {
1854
- let idx = -1;
1855
1909
  for (let i = 0; i < this.entries.length; ++i) {
1856
1910
  const entry = this.entries[i];
1857
1911
  if (entry.name === name && entry instanceof GlossaryEntry) {
1858
- idx = i;
1912
+ this.entries.splice(i, 1);
1859
1913
  break;
1860
1914
  }
1861
1915
  }
1862
- if (idx >= 0) {
1863
- this.entries.splice(idx, 1);
1864
- }
1865
1916
  return this;
1866
1917
  }
1867
1918
 
@@ -3443,6 +3494,10 @@ export function defineAgentEvent(moduleName: string, agentName: string, instruct
3443
3494
  So make sure to pass all relevant information in the 'message' attribute of this event.`
3444
3495
  );
3445
3496
  }
3497
+ const agent = module.getAgent(agentName);
3498
+ if (agent && agent.isPublic()) {
3499
+ event.setPublic(true);
3500
+ }
3446
3501
  module.addEntry(event);
3447
3502
  }
3448
3503
 
@@ -229,7 +229,7 @@ export class AgentInstance {
229
229
  '\nUse the following guidelines to take more accurate decisions in relevant scenarios.\n'
230
230
  );
231
231
  conds.forEach((ac: AgentCondition) => {
232
- ss.push(`if ${ac.cond}, then ${ac.then}`);
232
+ ss.push(`if ${ac.if}, then ${ac.then}`);
233
233
  });
234
234
  return `${ss.join('\n')}\n`;
235
235
  }
@@ -1,18 +0,0 @@
1
- import { Result, Environment } from '../interpreter.js';
2
- import { ActiveSessionInfo } from '../auth/defs.js';
3
- export declare const CoreFilesModuleName: string;
4
- declare const _default: string;
5
- export default _default;
6
- export declare function createFileRecord(fileInfo: {
7
- filename: string;
8
- originalName: string;
9
- mimetype: string;
10
- size: number;
11
- path: string;
12
- uploadedBy?: string;
13
- }, sessionInfo?: ActiveSessionInfo, callback?: (result: Result) => void, env?: Environment): Promise<Result>;
14
- export declare function findFileByFilename(filename: string, sessionInfo?: ActiveSessionInfo, callback?: (result: Result) => void, env?: Environment): Promise<Result>;
15
- export declare function deleteFileRecord(filename: string, sessionInfo?: ActiveSessionInfo, callback?: (result: Result) => void, env?: Environment): Promise<Result>;
16
- export declare function listAllFiles(sessionInfo?: ActiveSessionInfo, callback?: (result: Result) => void, env?: Environment): Promise<Result>;
17
- export declare function listUserFiles(userId: string, sessionInfo?: ActiveSessionInfo, callback?: (result: Result) => void, env?: Environment): Promise<Result>;
18
- //# sourceMappingURL=files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/runtime/modules/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAY,MAAM,mBAAmB,CAAC;AAIlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,mBAAmB,QAA8B,CAAC;;AAE/D,wBA2DE;AAEF,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE;IACR,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,WAAW,CAAC,EAAE,iBAAiB,EAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EACnC,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAED,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,iBAAiB,EAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EACnC,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,iBAAiB,EAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EACnC,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAsB,YAAY,CAChC,WAAW,CAAC,EAAE,iBAAiB,EAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EACnC,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,iBAAiB,EAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EACnC,GAAG,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,MAAM,CAAC,CAcjB"}
@@ -1,116 +0,0 @@
1
- import { evaluate } from '../interpreter.js';
2
- import { makeCoreModuleName } from '../util.js';
3
- import { makeInstance, objectAsInstanceAttributes } from '../module.js';
4
- import crypto from 'crypto';
5
- export const CoreFilesModuleName = makeCoreModuleName('files');
6
- export default `module ${CoreFilesModuleName}
7
-
8
- entity File {
9
- id String @id,
10
- filename String @unique @indexed,
11
- originalName String @optional,
12
- mimetype String @default("application/octet-stream"),
13
- size Int @optional,
14
- uploadedBy String @optional,
15
- uploadedAt DateTime @default(now()),
16
- path String @optional,
17
- @rbac [(roles: [*], allow: [create])
18
- (allow: [read, delete], where: auth.user = this.uploadedBy)]
19
- }
20
-
21
- workflow CreateFile {
22
- {File {id CreateFile.id,
23
- filename CreateFile.filename,
24
- originalName CreateFile.originalName,
25
- mimetype CreateFile.mimetype,
26
- size CreateFile.size,
27
- uploadedBy CreateFile.uploadedBy,
28
- uploadedAt CreateFile.uploadedAt,
29
- path CreateFile.path},
30
- @upsert}
31
- }
32
-
33
- workflow FindFile {
34
- {File {id? FindFile.id}} @as [file];
35
- file
36
- }
37
-
38
- workflow FindFileByFilename {
39
- {File {filename? FindFileByFilename.filename}} @as [file];
40
- file
41
- }
42
-
43
- workflow ListFiles {
44
- {File? {}}
45
- }
46
-
47
- workflow ListUserFiles {
48
- {File {uploadedBy? ListUserFiles.userId}}
49
- }
50
-
51
- workflow DeleteFile {
52
- delete {File {id? DeleteFile.id}}
53
- }
54
-
55
- workflow DeleteFileByFilename {
56
- delete {File {filename? DeleteFileByFilename.filename}}
57
- }
58
-
59
- workflow UpdateFile {
60
- {File {id? UpdateFile.id,
61
- originalName UpdateFile.originalName,
62
- mimetype UpdateFile.mimetype,
63
- size UpdateFile.size}}
64
- }
65
- `;
66
- export async function createFileRecord(fileInfo, sessionInfo, callback, env) {
67
- let inst = makeInstance(CoreFilesModuleName, 'CreateFile', objectAsInstanceAttributes({
68
- id: crypto.randomUUID(),
69
- filename: fileInfo.filename,
70
- originalName: fileInfo.originalName,
71
- mimetype: fileInfo.mimetype,
72
- size: fileInfo.size,
73
- path: fileInfo.path,
74
- uploadedBy: fileInfo.uploadedBy || '',
75
- uploadedAt: new Date().toISOString(),
76
- }));
77
- if (sessionInfo) {
78
- inst = inst.setAuthContext(sessionInfo);
79
- }
80
- return await evaluate(inst, callback, env);
81
- }
82
- export async function findFileByFilename(filename, sessionInfo, callback, env) {
83
- let inst = makeInstance(CoreFilesModuleName, 'FindFileByFilename', objectAsInstanceAttributes({
84
- filename: filename,
85
- }));
86
- if (sessionInfo) {
87
- inst = inst.setAuthContext(sessionInfo);
88
- }
89
- return await evaluate(inst, callback, env);
90
- }
91
- export async function deleteFileRecord(filename, sessionInfo, callback, env) {
92
- let inst = makeInstance(CoreFilesModuleName, 'DeleteFileByFilename', objectAsInstanceAttributes({
93
- filename: filename,
94
- }));
95
- if (sessionInfo) {
96
- inst = inst.setAuthContext(sessionInfo);
97
- }
98
- return await evaluate(inst, callback, env);
99
- }
100
- export async function listAllFiles(sessionInfo, callback, env) {
101
- let inst = makeInstance(CoreFilesModuleName, 'ListFiles', objectAsInstanceAttributes({}));
102
- if (sessionInfo) {
103
- inst = inst.setAuthContext(sessionInfo);
104
- }
105
- return await evaluate(inst, callback, env);
106
- }
107
- export async function listUserFiles(userId, sessionInfo, callback, env) {
108
- let inst = makeInstance(CoreFilesModuleName, 'ListUserFiles', objectAsInstanceAttributes({
109
- userId: userId,
110
- }));
111
- if (sessionInfo) {
112
- inst = inst.setAuthContext(sessionInfo);
113
- }
114
- return await evaluate(inst, callback, env);
115
- }
116
- //# sourceMappingURL=files.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../../src/runtime/modules/files.ts"],"names":[],"mappings":"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"}
@@ -1,98 +0,0 @@
1
- export declare const setupConfigClassic: () => {
2
- $type: string;
3
- editorAppConfig: {
4
- codeResources: {
5
- modified: {
6
- uri: string;
7
- text: string;
8
- };
9
- };
10
- useDiffEditor: boolean;
11
- languageDef: {
12
- languageExtensionConfig: {
13
- id: string;
14
- };
15
- monarchLanguage: {
16
- keywords: string[];
17
- operators: string[];
18
- symbols: RegExp;
19
- tokenizer: {
20
- initial: ({
21
- regex: RegExp;
22
- action: {
23
- cases: {
24
- '@keywords': {
25
- token: string;
26
- };
27
- '@default': {
28
- token: string;
29
- };
30
- '@operators'?: undefined;
31
- };
32
- token?: undefined;
33
- };
34
- include?: undefined;
35
- } | {
36
- regex: RegExp;
37
- action: {
38
- token: string;
39
- cases?: undefined;
40
- };
41
- include?: undefined;
42
- } | {
43
- include: string;
44
- regex?: undefined;
45
- action?: undefined;
46
- } | {
47
- regex: RegExp;
48
- action: {
49
- cases: {
50
- '@operators': {
51
- token: string;
52
- };
53
- '@default': {
54
- token: string;
55
- };
56
- '@keywords'?: undefined;
57
- };
58
- token?: undefined;
59
- };
60
- include?: undefined;
61
- })[];
62
- whitespace: ({
63
- regex: RegExp;
64
- action: {
65
- token: string;
66
- next?: undefined;
67
- };
68
- } | {
69
- regex: RegExp;
70
- action: {
71
- token: string;
72
- next: string;
73
- };
74
- })[];
75
- comment: ({
76
- regex: RegExp;
77
- action: {
78
- token: string;
79
- next?: undefined;
80
- };
81
- } | {
82
- regex: RegExp;
83
- action: {
84
- token: string;
85
- next: string;
86
- };
87
- })[];
88
- };
89
- };
90
- };
91
- editorOptions: {
92
- 'semanticHighlighting.enabled': boolean;
93
- theme: string;
94
- };
95
- };
96
- };
97
- export declare const executeClassic: (htmlElement: HTMLElement) => Promise<void>;
98
- //# sourceMappingURL=setupClassic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupClassic.d.ts","sourceRoot":"","sources":["../src/setupClassic.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,aAAa,WAAW,kBAgB5D,CAAC"}
@@ -1,38 +0,0 @@
1
- import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper';
2
- import monarchSyntax from './syntaxes/agentlang.monarch.js';
3
- export const setupConfigClassic = () => {
4
- return {
5
- $type: 'classic',
6
- editorAppConfig: {
7
- codeResources: {
8
- modified: {
9
- uri: '/workspace/example.al',
10
- text: `// Agentlang is running in the web!`,
11
- },
12
- },
13
- useDiffEditor: false,
14
- languageDef: {
15
- languageExtensionConfig: { id: 'agentlang' },
16
- monarchLanguage: monarchSyntax,
17
- },
18
- editorOptions: {
19
- 'semanticHighlighting.enabled': true,
20
- theme: 'vs-dark',
21
- },
22
- },
23
- };
24
- };
25
- export const executeClassic = async (htmlElement) => {
26
- try {
27
- const config = setupConfigClassic();
28
- const wrapper = new MonacoEditorLanguageClientWrapper();
29
- // Add the HTML container to the config
30
- const wrapperConfig = Object.assign(Object.assign({}, config), { htmlContainer: htmlElement });
31
- // Initialize and start the wrapper
32
- await wrapper.initAndStart(wrapperConfig);
33
- }
34
- catch (error) {
35
- console.error('Error initializing monaco editor:', error);
36
- }
37
- };
38
- //# sourceMappingURL=setupClassic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupClassic.js","sourceRoot":"","sources":["../src/setupClassic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAsB,MAAM,uBAAuB,CAAC;AAC9F,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO;QACL,KAAK,EAAE,SAAS;QAChB,eAAe,EAAE;YACf,aAAa,EAAE;gBACb,QAAQ,EAAE;oBACR,GAAG,EAAE,uBAAuB;oBAC5B,IAAI,EAAE,qCAAqC;iBAC5C;aACF;YACD,aAAa,EAAE,KAAK;YACpB,WAAW,EAAE;gBACX,uBAAuB,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;gBAC5C,eAAe,EAAE,aAAa;aAC/B;YACD,aAAa,EAAE;gBACb,8BAA8B,EAAE,IAAI;gBACpC,KAAK,EAAE,SAAS;aACjB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,WAAwB,EAAE,EAAE;IAC/D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,iCAAiC,EAAE,CAAC;QAExD,uCAAuC;QACvC,MAAM,aAAa,GAAG,gCACjB,MAAM,KACT,aAAa,EAAE,WAAW,GACV,CAAC;QAEnB,mCAAmC;QACnC,MAAM,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=setupCommon.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupCommon.d.ts","sourceRoot":"","sources":["../src/setupCommon.ts"],"names":[],"mappings":""}
@@ -1,33 +0,0 @@
1
- // This file is kept for reference but is not used directly anymore
2
- // The monaco-editor-wrapper API has changed significantly in v6+
3
- export {};
4
- // These functions are kept for reference but not used directly anymore
5
- /*
6
- export const defineUserServices = () => {
7
- return {
8
- userServices: {
9
- // This API has changed in the latest version
10
- },
11
- debugLogging: true,
12
- };
13
- };
14
-
15
- export const configureMonacoWorkers = () => {
16
- // This function is kept for compatibility, but implementation has changed
17
- // Use configureDefaultWorkerFactory from monaco-editor-wrapper/workers/workerLoaders in newer code
18
- };
19
-
20
- export const configureWorker = () => {
21
- // vite does not extract the worker properly if it is URL is a variable
22
- const lsWorker = new Worker(new URL('./language/main-browser', import.meta.url), {
23
- type: 'module',
24
- name: 'Agentlang Language Server',
25
- });
26
-
27
- return {
28
- type: 'WorkerDirect',
29
- worker: lsWorker,
30
- };
31
- };
32
- */
33
- //# sourceMappingURL=setupCommon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupCommon.js","sourceRoot":"","sources":["../src/setupCommon.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,iEAAiE;;AAEjE,uEAAuE;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE"}
@@ -1,40 +0,0 @@
1
- export declare const setupConfigExtended: () => {
2
- $type: string;
3
- editorAppConfig: {
4
- codeResources: {
5
- modified: {
6
- uri: string;
7
- text: string;
8
- };
9
- };
10
- useDiffEditor: boolean;
11
- extensions: {
12
- config: {
13
- name: string;
14
- publisher: string;
15
- version: string;
16
- engines: {
17
- vscode: string;
18
- };
19
- contributes: {
20
- languages: {
21
- id: string;
22
- extensions: string[];
23
- configuration: string;
24
- }[];
25
- grammars: {
26
- language: string;
27
- scopeName: string;
28
- path: string;
29
- }[];
30
- };
31
- };
32
- filesOrContents: Map<any, any>;
33
- }[];
34
- userConfiguration: {
35
- json: string;
36
- };
37
- };
38
- };
39
- export declare const executeExtended: (htmlElement: HTMLElement) => Promise<void>;
40
- //# sourceMappingURL=setupExtended.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupExtended.d.ts","sourceRoot":"","sources":["../src/setupExtended.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0D/B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,aAAa,WAAW,kBAgB7D,CAAC"}