@nocobase/plugin-ai 2.1.0-beta.17 → 2.1.0-beta.19

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.
Files changed (57) hide show
  1. package/dist/ai/ai-employees/atlas/prompt.md +28 -22
  2. package/dist/ai/ai-employees/viz.js +14 -88
  3. package/dist/ai/skills/business-analysis-report/SKILLS.md +8 -3
  4. package/dist/ai/skills/business-analysis-report/tools/businessReportGenerator.js +49 -8
  5. package/dist/client/280.003b9e9788599244.js +10 -0
  6. package/dist/client/{646.51313bb0d85d6366.js → 646.cba98d80e9e6ea74.js} +1 -1
  7. package/dist/client/index.js +4 -4
  8. package/dist/common/recommended-models.js +1 -25
  9. package/dist/externalVersion.js +14 -14
  10. package/dist/locale/en-US.json +9 -0
  11. package/dist/locale/zh-CN.json +9 -0
  12. package/dist/node_modules/fast-glob/package.json +1 -1
  13. package/dist/node_modules/flexsearch/package.json +1 -1
  14. package/dist/node_modules/fs-extra/package.json +1 -1
  15. package/dist/node_modules/jsonrepair/bin/cli.js +179 -0
  16. package/dist/node_modules/jsonrepair/lib/cjs/index.js +1 -0
  17. package/dist/node_modules/jsonrepair/lib/cjs/package.json +3 -0
  18. package/dist/node_modules/jsonrepair/lib/cjs/regular/jsonrepair.js +746 -0
  19. package/dist/node_modules/jsonrepair/lib/cjs/stream.js +13 -0
  20. package/dist/node_modules/jsonrepair/lib/cjs/streaming/buffer/InputBuffer.js +75 -0
  21. package/dist/node_modules/jsonrepair/lib/cjs/streaming/buffer/OutputBuffer.js +117 -0
  22. package/dist/node_modules/jsonrepair/lib/cjs/streaming/core.js +824 -0
  23. package/dist/node_modules/jsonrepair/lib/cjs/streaming/stack.js +51 -0
  24. package/dist/node_modules/jsonrepair/lib/cjs/streaming/stream.js +37 -0
  25. package/dist/node_modules/jsonrepair/lib/cjs/utils/JSONRepairError.js +14 -0
  26. package/dist/node_modules/jsonrepair/lib/cjs/utils/stringUtils.js +174 -0
  27. package/dist/node_modules/jsonrepair/lib/esm/index.js +4 -0
  28. package/dist/node_modules/jsonrepair/lib/esm/regular/jsonrepair.js +740 -0
  29. package/dist/node_modules/jsonrepair/lib/esm/stream.js +3 -0
  30. package/dist/node_modules/jsonrepair/lib/esm/streaming/buffer/InputBuffer.js +69 -0
  31. package/dist/node_modules/jsonrepair/lib/esm/streaming/buffer/OutputBuffer.js +111 -0
  32. package/dist/node_modules/jsonrepair/lib/esm/streaming/core.js +818 -0
  33. package/dist/node_modules/jsonrepair/lib/esm/streaming/stack.js +44 -0
  34. package/dist/node_modules/jsonrepair/lib/esm/streaming/stream.js +31 -0
  35. package/dist/node_modules/jsonrepair/lib/esm/utils/JSONRepairError.js +7 -0
  36. package/dist/node_modules/jsonrepair/lib/esm/utils/stringUtils.js +147 -0
  37. package/dist/node_modules/jsonrepair/lib/types/index.d.ts +3 -0
  38. package/dist/node_modules/jsonrepair/lib/types/regular/jsonrepair.d.ts +18 -0
  39. package/dist/node_modules/jsonrepair/lib/types/stream.d.ts +2 -0
  40. package/dist/node_modules/jsonrepair/lib/types/streaming/buffer/InputBuffer.d.ts +14 -0
  41. package/dist/node_modules/jsonrepair/lib/types/streaming/buffer/OutputBuffer.d.ts +18 -0
  42. package/dist/node_modules/jsonrepair/lib/types/streaming/core.d.ts +11 -0
  43. package/dist/node_modules/jsonrepair/lib/types/streaming/stack.d.ts +20 -0
  44. package/dist/node_modules/jsonrepair/lib/types/streaming/stream.d.ts +7 -0
  45. package/dist/node_modules/jsonrepair/lib/types/utils/JSONRepairError.d.ts +5 -0
  46. package/dist/node_modules/jsonrepair/lib/types/utils/stringUtils.d.ts +65 -0
  47. package/dist/node_modules/jsonrepair/lib/umd/jsonrepair.js +903 -0
  48. package/dist/node_modules/jsonrepair/lib/umd/jsonrepair.min.js +3 -0
  49. package/dist/node_modules/jsonrepair/lib/umd/package.json +3 -0
  50. package/dist/node_modules/jsonrepair/package.json +1 -0
  51. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  52. package/dist/node_modules/openai/package.json +1 -1
  53. package/dist/node_modules/zod/package.json +1 -1
  54. package/dist/server/resource/aiEmployees.js +15 -1
  55. package/dist/server/resource/aiSkills.js +1 -1
  56. package/package.json +2 -2
  57. package/dist/client/280.029428b83d62155f.js +0 -10
@@ -0,0 +1,44 @@
1
+ export let Caret = /*#__PURE__*/function (Caret) {
2
+ Caret["beforeValue"] = "beforeValue";
3
+ Caret["afterValue"] = "afterValue";
4
+ Caret["beforeKey"] = "beforeKey";
5
+ return Caret;
6
+ }({});
7
+ export let StackType = /*#__PURE__*/function (StackType) {
8
+ StackType["root"] = "root";
9
+ StackType["object"] = "object";
10
+ StackType["array"] = "array";
11
+ StackType["ndJson"] = "ndJson";
12
+ StackType["functionCall"] = "dataType";
13
+ return StackType;
14
+ }({});
15
+ export function createStack() {
16
+ const stack = [StackType.root];
17
+ let caret = Caret.beforeValue;
18
+ return {
19
+ get type() {
20
+ return last(stack);
21
+ },
22
+ get caret() {
23
+ return caret;
24
+ },
25
+ pop() {
26
+ stack.pop();
27
+ caret = Caret.afterValue;
28
+ return true;
29
+ },
30
+ push(type, newCaret) {
31
+ stack.push(type);
32
+ caret = newCaret;
33
+ return true;
34
+ },
35
+ update(newCaret) {
36
+ caret = newCaret;
37
+ return true;
38
+ }
39
+ };
40
+ }
41
+ function last(array) {
42
+ return array[array.length - 1];
43
+ }
44
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1,31 @@
1
+ import { Transform } from 'node:stream';
2
+ import { jsonrepairCore } from './core.js';
3
+ export function jsonrepairTransform(options) {
4
+ const repair = jsonrepairCore({
5
+ onData: chunk => transform.push(chunk),
6
+ bufferSize: options?.bufferSize,
7
+ chunkSize: options?.chunkSize
8
+ });
9
+ const transform = new Transform({
10
+ transform(chunk, _encoding, callback) {
11
+ try {
12
+ repair.transform(chunk.toString());
13
+ } catch (err) {
14
+ this.emit('error', err);
15
+ } finally {
16
+ callback();
17
+ }
18
+ },
19
+ flush(callback) {
20
+ try {
21
+ repair.flush();
22
+ } catch (err) {
23
+ this.emit('error', err);
24
+ } finally {
25
+ callback();
26
+ }
27
+ }
28
+ });
29
+ return transform;
30
+ }
31
+ //# sourceMappingURL=stream.js.map
@@ -0,0 +1,7 @@
1
+ export class JSONRepairError extends Error {
2
+ constructor(message, position) {
3
+ super(`${message} at position ${position}`);
4
+ this.position = position;
5
+ }
6
+ }
7
+ //# sourceMappingURL=JSONRepairError.js.map
@@ -0,0 +1,147 @@
1
+ const codeSpace = 0x20; // " "
2
+ const codeNewline = 0xa; // "\n"
3
+ const codeTab = 0x9; // "\t"
4
+ const codeReturn = 0xd; // "\r"
5
+ const codeNonBreakingSpace = 0xa0;
6
+ const codeEnQuad = 0x2000;
7
+ const codeHairSpace = 0x200a;
8
+ const codeNarrowNoBreakSpace = 0x202f;
9
+ const codeMediumMathematicalSpace = 0x205f;
10
+ const codeIdeographicSpace = 0x3000;
11
+ export function isHex(char) {
12
+ return /^[0-9A-Fa-f]$/.test(char);
13
+ }
14
+ export function isDigit(char) {
15
+ return char >= '0' && char <= '9';
16
+ }
17
+ export function isValidStringCharacter(char) {
18
+ // note that the valid range is between \u{0020} and \u{10ffff},
19
+ // but in JavaScript it is not possible to create a code point larger than
20
+ // \u{10ffff}, so there is no need to test for that here.
21
+ return char >= '\u0020';
22
+ }
23
+ export function isDelimiter(char) {
24
+ return ',:[]/{}()\n+'.includes(char);
25
+ }
26
+ export function isFunctionNameCharStart(char) {
27
+ return char >= 'a' && char <= 'z' || char >= 'A' && char <= 'Z' || char === '_' || char === '$';
28
+ }
29
+ export function isFunctionNameChar(char) {
30
+ return char >= 'a' && char <= 'z' || char >= 'A' && char <= 'Z' || char === '_' || char === '$' || char >= '0' && char <= '9';
31
+ }
32
+
33
+ // matches "https://" and other schemas
34
+ export const regexUrlStart = /^(http|https|ftp|mailto|file|data|irc):\/\/$/;
35
+
36
+ // matches all valid URL characters EXCEPT "[", "]", and ",", since that are important JSON delimiters
37
+ export const regexUrlChar = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
38
+ export function isUnquotedStringDelimiter(char) {
39
+ return ',[]/{}\n+'.includes(char);
40
+ }
41
+ export function isStartOfValue(char) {
42
+ return isQuote(char) || regexStartOfValue.test(char);
43
+ }
44
+
45
+ // alpha, number, minus, or opening bracket or brace
46
+ const regexStartOfValue = /^[[{\w-]$/;
47
+ export function isControlCharacter(char) {
48
+ return char === '\n' || char === '\r' || char === '\t' || char === '\b' || char === '\f';
49
+ }
50
+ /**
51
+ * Check if the given character is a whitespace character like space, tab, or
52
+ * newline
53
+ */
54
+ export function isWhitespace(text, index) {
55
+ const code = text.charCodeAt(index);
56
+ return code === codeSpace || code === codeNewline || code === codeTab || code === codeReturn;
57
+ }
58
+
59
+ /**
60
+ * Check if the given character is a whitespace character like space or tab,
61
+ * but NOT a newline
62
+ */
63
+ export function isWhitespaceExceptNewline(text, index) {
64
+ const code = text.charCodeAt(index);
65
+ return code === codeSpace || code === codeTab || code === codeReturn;
66
+ }
67
+
68
+ /**
69
+ * Check if the given character is a special whitespace character, some
70
+ * unicode variant
71
+ */
72
+ export function isSpecialWhitespace(text, index) {
73
+ const code = text.charCodeAt(index);
74
+ return code === codeNonBreakingSpace || code >= codeEnQuad && code <= codeHairSpace || code === codeNarrowNoBreakSpace || code === codeMediumMathematicalSpace || code === codeIdeographicSpace;
75
+ }
76
+
77
+ /**
78
+ * Test whether the given character is a quote or double quote character.
79
+ * Also tests for special variants of quotes.
80
+ */
81
+ export function isQuote(char) {
82
+ // the first check double quotes, since that occurs most often
83
+ return isDoubleQuoteLike(char) || isSingleQuoteLike(char);
84
+ }
85
+
86
+ /**
87
+ * Test whether the given character is a double quote character.
88
+ * Also tests for special variants of double quotes.
89
+ */
90
+ export function isDoubleQuoteLike(char) {
91
+ return char === '"' || char === '\u201c' || char === '\u201d';
92
+ }
93
+
94
+ /**
95
+ * Test whether the given character is a double quote character.
96
+ * Does NOT test for special variants of double quotes.
97
+ */
98
+ export function isDoubleQuote(char) {
99
+ return char === '"';
100
+ }
101
+
102
+ /**
103
+ * Test whether the given character is a single quote character.
104
+ * Also tests for special variants of single quotes.
105
+ */
106
+ export function isSingleQuoteLike(char) {
107
+ return char === "'" || char === '\u2018' || char === '\u2019' || char === '\u0060' || char === '\u00b4';
108
+ }
109
+
110
+ /**
111
+ * Test whether the given character is a single quote character.
112
+ * Does NOT test for special variants of single quotes.
113
+ */
114
+ export function isSingleQuote(char) {
115
+ return char === "'";
116
+ }
117
+
118
+ /**
119
+ * Strip last occurrence of textToStrip from text
120
+ */
121
+ export function stripLastOccurrence(text, textToStrip) {
122
+ let stripRemainingText = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
123
+ const index = text.lastIndexOf(textToStrip);
124
+ return index !== -1 ? text.substring(0, index) + (stripRemainingText ? '' : text.substring(index + 1)) : text;
125
+ }
126
+ export function insertBeforeLastWhitespace(text, textToInsert) {
127
+ let index = text.length;
128
+ if (!isWhitespace(text, index - 1)) {
129
+ // no trailing whitespaces
130
+ return text + textToInsert;
131
+ }
132
+ while (isWhitespace(text, index - 1)) {
133
+ index--;
134
+ }
135
+ return text.substring(0, index) + textToInsert + text.substring(index);
136
+ }
137
+ export function removeAtIndex(text, start, count) {
138
+ return text.substring(0, start) + text.substring(start + count);
139
+ }
140
+
141
+ /**
142
+ * Test whether a string ends with a newline or comma character and optional whitespace
143
+ */
144
+ export function endsWithCommaOrNewline(text) {
145
+ return /[,\n][ \t\r]*$/.test(text);
146
+ }
147
+ //# sourceMappingURL=stringUtils.js.map
@@ -0,0 +1,3 @@
1
+ export { jsonrepair } from './regular/jsonrepair.js';
2
+ export { JSONRepairError } from './utils/JSONRepairError.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Repair a string containing an invalid JSON document.
3
+ * For example changes JavaScript notation into JSON notation.
4
+ *
5
+ * Example:
6
+ *
7
+ * try {
8
+ * const json = "{name: 'John'}"
9
+ * const repaired = jsonrepair(json)
10
+ * console.log(repaired)
11
+ * // '{"name": "John"}'
12
+ * } catch (err) {
13
+ * console.error(err)
14
+ * }
15
+ *
16
+ */
17
+ export declare function jsonrepair(text: string): string;
18
+ //# sourceMappingURL=jsonrepair.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { type JsonRepairTransformOptions, jsonrepairTransform } from './streaming/stream.js';
2
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1,14 @@
1
+ export interface InputBuffer {
2
+ push: (chunk: string) => void;
3
+ flush: (position: number) => void;
4
+ charAt: (index: number) => string;
5
+ charCodeAt: (index: number) => number;
6
+ substring: (start: number, end: number) => string;
7
+ length: () => number;
8
+ currentLength: () => number;
9
+ currentBufferSize: () => number;
10
+ isEnd: (index: number) => boolean;
11
+ close: () => void;
12
+ }
13
+ export declare function createInputBuffer(): InputBuffer;
14
+ //# sourceMappingURL=InputBuffer.d.ts.map
@@ -0,0 +1,18 @@
1
+ export interface OutputBuffer {
2
+ push: (text: string) => void;
3
+ unshift: (text: string) => void;
4
+ remove: (start: number, end?: number) => void;
5
+ insertAt: (index: number, text: string) => void;
6
+ length: () => number;
7
+ flush: () => void;
8
+ stripLastOccurrence: (textToStrip: string, stripRemainingText?: boolean) => void;
9
+ insertBeforeLastWhitespace: (textToInsert: string) => void;
10
+ endsWithIgnoringWhitespace: (char: string) => boolean;
11
+ }
12
+ export interface OutputBufferOptions {
13
+ write: (chunk: string) => void;
14
+ chunkSize: number;
15
+ bufferSize: number;
16
+ }
17
+ export declare function createOutputBuffer({ write, chunkSize, bufferSize }: OutputBufferOptions): OutputBuffer;
18
+ //# sourceMappingURL=OutputBuffer.d.ts.map
@@ -0,0 +1,11 @@
1
+ export interface JsonRepairCoreOptions {
2
+ onData: (chunk: string) => void;
3
+ chunkSize?: number;
4
+ bufferSize?: number;
5
+ }
6
+ export interface JsonRepairCore {
7
+ transform: (chunk: string) => void;
8
+ flush: () => void;
9
+ }
10
+ export declare function jsonrepairCore({ onData, bufferSize, chunkSize }: JsonRepairCoreOptions): JsonRepairCore;
11
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1,20 @@
1
+ export declare enum Caret {
2
+ beforeValue = "beforeValue",
3
+ afterValue = "afterValue",
4
+ beforeKey = "beforeKey"
5
+ }
6
+ export declare enum StackType {
7
+ root = "root",
8
+ object = "object",
9
+ array = "array",
10
+ ndJson = "ndJson",
11
+ functionCall = "dataType"
12
+ }
13
+ export declare function createStack(): {
14
+ readonly type: StackType;
15
+ readonly caret: Caret;
16
+ pop(): true;
17
+ push(type: StackType, newCaret: Caret): true;
18
+ update(newCaret: Caret): true;
19
+ };
20
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Transform } from 'node:stream';
2
+ export interface JsonRepairTransformOptions {
3
+ chunkSize?: number;
4
+ bufferSize?: number;
5
+ }
6
+ export declare function jsonrepairTransform(options?: JsonRepairTransformOptions): Transform;
7
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1,5 @@
1
+ export declare class JSONRepairError extends Error {
2
+ position: number;
3
+ constructor(message: string, position: number);
4
+ }
5
+ //# sourceMappingURL=JSONRepairError.d.ts.map
@@ -0,0 +1,65 @@
1
+ export declare function isHex(char: string): boolean;
2
+ export declare function isDigit(char: string): boolean;
3
+ export declare function isValidStringCharacter(char: string): boolean;
4
+ export declare function isDelimiter(char: string): boolean;
5
+ export declare function isFunctionNameCharStart(char: string): boolean;
6
+ export declare function isFunctionNameChar(char: string): boolean;
7
+ export declare const regexUrlStart: RegExp;
8
+ export declare const regexUrlChar: RegExp;
9
+ export declare function isUnquotedStringDelimiter(char: string): boolean;
10
+ export declare function isStartOfValue(char: string): boolean;
11
+ export declare function isControlCharacter(char: string): char is "\n" | "\r" | "\t" | "\b" | "\f";
12
+ export interface Text {
13
+ charCodeAt: (index: number) => number;
14
+ }
15
+ /**
16
+ * Check if the given character is a whitespace character like space, tab, or
17
+ * newline
18
+ */
19
+ export declare function isWhitespace(text: Text, index: number): boolean;
20
+ /**
21
+ * Check if the given character is a whitespace character like space or tab,
22
+ * but NOT a newline
23
+ */
24
+ export declare function isWhitespaceExceptNewline(text: Text, index: number): boolean;
25
+ /**
26
+ * Check if the given character is a special whitespace character, some
27
+ * unicode variant
28
+ */
29
+ export declare function isSpecialWhitespace(text: Text, index: number): boolean;
30
+ /**
31
+ * Test whether the given character is a quote or double quote character.
32
+ * Also tests for special variants of quotes.
33
+ */
34
+ export declare function isQuote(char: string): boolean;
35
+ /**
36
+ * Test whether the given character is a double quote character.
37
+ * Also tests for special variants of double quotes.
38
+ */
39
+ export declare function isDoubleQuoteLike(char: string): boolean;
40
+ /**
41
+ * Test whether the given character is a double quote character.
42
+ * Does NOT test for special variants of double quotes.
43
+ */
44
+ export declare function isDoubleQuote(char: string): boolean;
45
+ /**
46
+ * Test whether the given character is a single quote character.
47
+ * Also tests for special variants of single quotes.
48
+ */
49
+ export declare function isSingleQuoteLike(char: string): boolean;
50
+ /**
51
+ * Test whether the given character is a single quote character.
52
+ * Does NOT test for special variants of single quotes.
53
+ */
54
+ export declare function isSingleQuote(char: string): boolean;
55
+ /**
56
+ * Strip last occurrence of textToStrip from text
57
+ */
58
+ export declare function stripLastOccurrence(text: string, textToStrip: string, stripRemainingText?: boolean): string;
59
+ export declare function insertBeforeLastWhitespace(text: string, textToInsert: string): string;
60
+ export declare function removeAtIndex(text: string, start: number, count: number): string;
61
+ /**
62
+ * Test whether a string ends with a newline or comma character and optional whitespace
63
+ */
64
+ export declare function endsWithCommaOrNewline(text: string): boolean;
65
+ //# sourceMappingURL=stringUtils.d.ts.map