@symbolica/agentica 0.3.1 → 0.4.0
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/LICENSE +21 -77
- package/README.md +10 -9
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/src/agentica/agent.d.ts +3 -2
- package/dist/src/agentica/agent.d.ts.map +1 -1
- package/dist/src/agentica/agent.js +3 -4
- package/dist/src/agentica/agent.js.map +1 -1
- package/dist/src/agentica/agentic.d.ts.map +1 -1
- package/dist/src/agentica/agentic.js +1 -3
- package/dist/src/agentica/agentic.js.map +1 -1
- package/dist/src/agentica/common.d.ts +10 -5
- package/dist/src/agentica/common.d.ts.map +1 -1
- package/dist/src/agentica/common.js +32 -17
- package/dist/src/agentica/common.js.map +1 -1
- package/dist/src/agentica-unplugin.d.ts +2 -2
- package/dist/src/agentica-unplugin.d.ts.map +1 -1
- package/dist/src/bundlers/esbuild.d.ts +1 -1
- package/dist/src/bundlers/vite.d.ts +1 -1
- package/dist/src/client-session-manager/client-session-manager.d.ts +10 -8
- package/dist/src/client-session-manager/client-session-manager.d.ts.map +1 -1
- package/dist/src/client-session-manager/client-session-manager.js +172 -95
- package/dist/src/client-session-manager/client-session-manager.js.map +1 -1
- package/dist/src/client-session-manager/types.d.ts +1 -1
- package/dist/src/client-session-manager/types.d.ts.map +1 -1
- package/dist/src/coming-soon.d.ts +7 -18
- package/dist/src/coming-soon.d.ts.map +1 -1
- package/dist/src/coming-soon.js +21 -41
- package/dist/src/coming-soon.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.d.ts +7 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.d.ts.map +1 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.js +144 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.js.map +1 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.test.d.ts +2 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.test.d.ts.map +1 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.test.js +253 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/str.test.js.map +1 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/utils.d.ts +5 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/utils.d.ts.map +1 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/utils.js +17 -0
- package/dist/src/warpc/msg-protocol/concept/python-mirrors/utils.js.map +1 -0
- package/dist/src/warpc/msg-protocol/concept/resource/system-msg.d.ts +2 -1
- package/dist/src/warpc/msg-protocol/concept/resource/system-msg.d.ts.map +1 -1
- package/dist/src/warpc/msg-protocol/concept/resource/system-msg.js +14 -10
- package/dist/src/warpc/msg-protocol/concept/resource/system-msg.js.map +1 -1
- package/dist-transformer/agentica/agent.d.ts +4 -2
- package/dist-transformer/agentica/agent.d.ts.map +1 -1
- package/dist-transformer/agentica/agent.js +3 -3
- package/dist-transformer/agentica/agentic.d.ts.map +1 -1
- package/dist-transformer/agentica/agentic.js +1 -3
- package/dist-transformer/agentica/common.d.ts +23 -13
- package/dist-transformer/agentica/common.d.ts.map +1 -1
- package/dist-transformer/agentica/common.js +46 -25
- package/dist-transformer/client-session-manager/client-session-manager.d.ts +20 -12
- package/dist-transformer/client-session-manager/client-session-manager.d.ts.map +1 -1
- package/dist-transformer/client-session-manager/client-session-manager.js +214 -108
- package/dist-transformer/client-session-manager/types.d.ts +1 -1
- package/dist-transformer/client-session-manager/types.d.ts.map +1 -1
- package/dist-transformer/coming-soon.d.ts +7 -18
- package/dist-transformer/coming-soon.d.ts.map +1 -1
- package/dist-transformer/coming-soon.js +21 -39
- package/dist-transformer/version.d.ts +1 -1
- package/dist-transformer/version.js +1 -1
- package/dist-transformer/warpc/msg-protocol/concept/python-mirrors/str.d.ts +7 -0
- package/dist-transformer/warpc/msg-protocol/concept/python-mirrors/str.d.ts.map +1 -0
- package/dist-transformer/warpc/msg-protocol/concept/python-mirrors/str.js +151 -0
- package/dist-transformer/warpc/msg-protocol/concept/python-mirrors/utils.d.ts +5 -0
- package/dist-transformer/warpc/msg-protocol/concept/python-mirrors/utils.d.ts.map +1 -0
- package/dist-transformer/warpc/msg-protocol/concept/python-mirrors/utils.js +16 -0
- package/dist-transformer/warpc/msg-protocol/concept/resource/system-msg.d.ts +2 -1
- package/dist-transformer/warpc/msg-protocol/concept/resource/system-msg.d.ts.map +1 -1
- package/dist-transformer/warpc/msg-protocol/concept/resource/system-msg.js +14 -11
- package/package.json +5 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { id } from './common.js';
|
|
2
2
|
var Feature;
|
|
3
3
|
(function (Feature) {
|
|
4
|
-
Feature["JSON_MODE"] = "JSON mode";
|
|
5
4
|
Feature["ENUM_VALUES"] = "Enum support";
|
|
6
5
|
Feature["FUTURE_VALUES"] = "Promises and futures";
|
|
7
6
|
Feature["LOCAL_FILE_ACCESS"] = "Local file access";
|
|
@@ -9,11 +8,9 @@ var Feature;
|
|
|
9
8
|
Feature["NUMERIC_RANGES"] = "Numeric range objects";
|
|
10
9
|
Feature["BINARY_BUFFERS"] = "Binary buffer objects";
|
|
11
10
|
Feature["URL_OBJECTS"] = "URL objects";
|
|
12
|
-
Feature["JSON_BASE_EXCEPTIONS"] = "Richer exceptions in JSON mode";
|
|
13
11
|
Feature["CUSTOM_EXCEPTIONS"] = "Custom exceptions";
|
|
14
12
|
Feature["TYPE"] = "Type";
|
|
15
13
|
Feature["TYPE_CONSTRUCTORS"] = "Type constructor";
|
|
16
|
-
Feature["ARBITRARY"] = "Arbitrary";
|
|
17
14
|
Feature["VIRTUALIZATION"] = "Virtualization";
|
|
18
15
|
Feature["UNSUPPORTED_BUILTIN_CLASS"] = "Unsupported builtin class";
|
|
19
16
|
Feature["GENERATORS"] = "Generators";
|
|
@@ -21,16 +18,8 @@ var Feature;
|
|
|
21
18
|
Feature["INTERSECTION_RETURN_TYPE"] = "Intersection as return type";
|
|
22
19
|
})(Feature || (Feature = {}));
|
|
23
20
|
export class ComingSoon extends Error {
|
|
24
|
-
constructor(feature, mode, detail = '') {
|
|
25
|
-
super(`${feature} ${detail} is Coming Soon${mode ? ` in ${mode} mode` : ''}!`.replace(/\s\s+/g, ' '));
|
|
26
|
-
this.feature = feature;
|
|
27
|
-
this.mode = mode;
|
|
28
|
-
this.detail = detail;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export class TryCodeMode extends Error {
|
|
32
21
|
constructor(feature, detail = '') {
|
|
33
|
-
super(`${feature} ${detail}
|
|
22
|
+
super(`${feature} ${detail} is Coming Soon!`.replace(/\s\s+/g, ' '));
|
|
34
23
|
this.feature = feature;
|
|
35
24
|
this.detail = detail;
|
|
36
25
|
}
|
|
@@ -101,7 +90,7 @@ const isGeneratorLike = (obj) => {
|
|
|
101
90
|
return false;
|
|
102
91
|
return typeof obj.next === 'function' && typeof obj.throw === 'function' && typeof obj.return === 'function';
|
|
103
92
|
};
|
|
104
|
-
export const validateFeature = (thing
|
|
93
|
+
export const validateFeature = (thing) => {
|
|
105
94
|
const seen = new Set();
|
|
106
95
|
const _check = (obj) => {
|
|
107
96
|
const objId = getIdIfObject(obj);
|
|
@@ -111,16 +100,16 @@ export const validateFeature = (thing, mode = 'code') => {
|
|
|
111
100
|
seen.add(objId);
|
|
112
101
|
}
|
|
113
102
|
if (isGeneratorLike(obj)) {
|
|
114
|
-
throw new ComingSoon(Feature.GENERATORS
|
|
103
|
+
throw new ComingSoon(Feature.GENERATORS);
|
|
115
104
|
}
|
|
116
105
|
if (isFileHandleLike(obj)) {
|
|
117
|
-
throw new ComingSoon(Feature.LOCAL_FILE_ACCESS
|
|
106
|
+
throw new ComingSoon(Feature.LOCAL_FILE_ACCESS);
|
|
118
107
|
}
|
|
119
108
|
if (ArrayBuffer.isView(obj) || obj instanceof ArrayBuffer) {
|
|
120
|
-
throw new ComingSoon(Feature.BINARY_BUFFERS
|
|
109
|
+
throw new ComingSoon(Feature.BINARY_BUFFERS);
|
|
121
110
|
}
|
|
122
111
|
if (isUrlObjectLike(obj)) {
|
|
123
|
-
throw new ComingSoon(Feature.URL_OBJECTS
|
|
112
|
+
throw new ComingSoon(Feature.URL_OBJECTS);
|
|
124
113
|
}
|
|
125
114
|
// recurse
|
|
126
115
|
if (obj instanceof Map) {
|
|
@@ -143,29 +132,25 @@ export const validateFeature = (thing, mode = 'code') => {
|
|
|
143
132
|
_check(v);
|
|
144
133
|
return;
|
|
145
134
|
}
|
|
146
|
-
if (mode === 'json') {
|
|
147
|
-
// we just do not support json-mode at all
|
|
148
|
-
throw new TryCodeMode(Feature.ARBITRARY);
|
|
149
|
-
}
|
|
150
135
|
};
|
|
151
136
|
_check(thing);
|
|
152
137
|
};
|
|
153
|
-
export const constructorTypes = (
|
|
154
|
-
return new ComingSoon(Feature.TYPE_CONSTRUCTORS,
|
|
138
|
+
export const constructorTypes = () => {
|
|
139
|
+
return new ComingSoon(Feature.TYPE_CONSTRUCTORS, 'and built-in type support');
|
|
155
140
|
};
|
|
156
|
-
export const unsupportedBultinClass = (className
|
|
157
|
-
return new ComingSoon(Feature.UNSUPPORTED_BUILTIN_CLASS,
|
|
141
|
+
export const unsupportedBultinClass = (className) => {
|
|
142
|
+
return new ComingSoon(Feature.UNSUPPORTED_BUILTIN_CLASS, `(${className})`);
|
|
158
143
|
};
|
|
159
|
-
export const unsupportedEnum = (enumName
|
|
160
|
-
return new ComingSoon(Feature.ENUM_VALUES,
|
|
144
|
+
export const unsupportedEnum = (enumName) => {
|
|
145
|
+
return new ComingSoon(Feature.ENUM_VALUES, `(enum '${enumName}'). Use string or number literal unions instead: type MyType = "value1" | "value2" | "value3"`);
|
|
161
146
|
};
|
|
162
|
-
export const interfaceReturnType = (
|
|
163
|
-
return new ComingSoon(Feature.INTERFACE_RETURN_TYPE
|
|
147
|
+
export const interfaceReturnType = () => {
|
|
148
|
+
return new ComingSoon(Feature.INTERFACE_RETURN_TYPE);
|
|
164
149
|
};
|
|
165
|
-
export const intersectionReturnType = (
|
|
166
|
-
return new ComingSoon(Feature.INTERSECTION_RETURN_TYPE
|
|
150
|
+
export const intersectionReturnType = () => {
|
|
151
|
+
return new ComingSoon(Feature.INTERSECTION_RETURN_TYPE);
|
|
167
152
|
};
|
|
168
|
-
export const validateReturnType = (returnType, context
|
|
153
|
+
export const validateReturnType = (returnType, context) => {
|
|
169
154
|
const seen = new Set();
|
|
170
155
|
const check = (type) => {
|
|
171
156
|
if (!type)
|
|
@@ -184,10 +169,10 @@ export const validateReturnType = (returnType, context, mode = 'code') => {
|
|
|
184
169
|
seen.add(uidStr);
|
|
185
170
|
}
|
|
186
171
|
if (type.kind === 'interface') {
|
|
187
|
-
throw interfaceReturnType(
|
|
172
|
+
throw interfaceReturnType();
|
|
188
173
|
}
|
|
189
174
|
if (type.kind === 'intersection') {
|
|
190
|
-
throw intersectionReturnType(
|
|
175
|
+
throw intersectionReturnType();
|
|
191
176
|
}
|
|
192
177
|
if (type.kind === 'union') {
|
|
193
178
|
for (const member of type.payload.classes) {
|
|
@@ -198,13 +183,10 @@ export const validateReturnType = (returnType, context, mode = 'code') => {
|
|
|
198
183
|
};
|
|
199
184
|
check(returnType);
|
|
200
185
|
};
|
|
201
|
-
export const throwNoJsonMode = () => {
|
|
202
|
-
throw new ComingSoon(Feature.JSON_MODE);
|
|
203
|
-
};
|
|
204
186
|
export const throwNoVirtualization = () => {
|
|
205
|
-
throw new ComingSoon(Feature.VIRTUALIZATION, '
|
|
187
|
+
throw new ComingSoon(Feature.VIRTUALIZATION, 'of remote resources');
|
|
206
188
|
};
|
|
207
189
|
export const throwNoBareFutures = () => {
|
|
208
|
-
throw new ComingSoon(Feature.FUTURE_VALUES, '
|
|
190
|
+
throw new ComingSoon(Feature.FUTURE_VALUES, 'as values that can be passed to the agent');
|
|
209
191
|
};
|
|
210
192
|
export default ComingSoon;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface StringifierOptions {
|
|
2
|
+
maxDepth?: number;
|
|
3
|
+
repr?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function __str__(obj: any, options?: Omit<StringifierOptions, 'repr'>): string;
|
|
6
|
+
export declare function __repr__(obj: any, options?: Omit<StringifierOptions, 'repr'>): string;
|
|
7
|
+
//# sourceMappingURL=str.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"str.d.ts","sourceRoot":"","sources":["../../../../../src/warpc/msg-protocol/concept/python-mirrors/str.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AA4JD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAM,GAAG,MAAM,CAGxF;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAM,GAAG,MAAM,CAGzF"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { getJsClassName, getJsSymbolName } from './utils.js';
|
|
2
|
+
class Stringifier {
|
|
3
|
+
constructor(options = {}) {
|
|
4
|
+
this._seen = new Set();
|
|
5
|
+
this._currentDepth = 0;
|
|
6
|
+
this._options = {
|
|
7
|
+
maxDepth: options.maxDepth ?? 3,
|
|
8
|
+
repr: options.repr ?? false,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
get _isRoot() {
|
|
12
|
+
return this._currentDepth == 0;
|
|
13
|
+
}
|
|
14
|
+
_token(name) {
|
|
15
|
+
return `<${name}>`;
|
|
16
|
+
}
|
|
17
|
+
_dataclassStyle(ctorName, args = [], kwargs = []) {
|
|
18
|
+
const props = [...args, ...kwargs.map(([k, v]) => `${k}=${v}`)].join(', ');
|
|
19
|
+
return `${ctorName}(${props})`;
|
|
20
|
+
}
|
|
21
|
+
_error(o) {
|
|
22
|
+
if (this._isRoot) {
|
|
23
|
+
return o.message;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return this._dataclassStyle(getJsClassName(o), [o.message]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
_bool(o) {
|
|
30
|
+
return o ? 'True' : 'False';
|
|
31
|
+
}
|
|
32
|
+
_nonish(_) {
|
|
33
|
+
return 'None';
|
|
34
|
+
}
|
|
35
|
+
_sanitizeKey(k) {
|
|
36
|
+
// TODO: Implement for compatibility with Python idents
|
|
37
|
+
return k;
|
|
38
|
+
}
|
|
39
|
+
_reprString(o) {
|
|
40
|
+
return JSON.stringify(o);
|
|
41
|
+
}
|
|
42
|
+
_string(o) {
|
|
43
|
+
if (this._options.repr) {
|
|
44
|
+
return this._reprString(o);
|
|
45
|
+
}
|
|
46
|
+
if (this._isRoot) {
|
|
47
|
+
return o;
|
|
48
|
+
}
|
|
49
|
+
return `'${o}'`;
|
|
50
|
+
}
|
|
51
|
+
_function(o) {
|
|
52
|
+
return this._token(`function ${o.name}`);
|
|
53
|
+
}
|
|
54
|
+
_array(o) {
|
|
55
|
+
const arr = [];
|
|
56
|
+
for (const item of o) {
|
|
57
|
+
this._currentDepth++;
|
|
58
|
+
const result = this.stringify(item);
|
|
59
|
+
this._currentDepth--;
|
|
60
|
+
// Check length?
|
|
61
|
+
arr.push(result);
|
|
62
|
+
}
|
|
63
|
+
return `[${arr.join(', ')}]`;
|
|
64
|
+
}
|
|
65
|
+
_number(o) {
|
|
66
|
+
return `${o}`;
|
|
67
|
+
}
|
|
68
|
+
_symbol(o) {
|
|
69
|
+
return this._dataclassStyle('Symbol', [getJsSymbolName(o)]);
|
|
70
|
+
}
|
|
71
|
+
_circular(o) {
|
|
72
|
+
return this._token(`circular ${getJsClassName(o)}`);
|
|
73
|
+
}
|
|
74
|
+
_depthExceeded(o) {
|
|
75
|
+
return this._token(`depth exceeded ${getJsClassName(o)}`);
|
|
76
|
+
}
|
|
77
|
+
_object(o) {
|
|
78
|
+
const stringifiedPairs = [];
|
|
79
|
+
// Using Object.keys to avoid getter side-effects
|
|
80
|
+
// Ignore inherited, non-enumerable, and symbol keys
|
|
81
|
+
for (const k of Object.keys(o)) {
|
|
82
|
+
let stringified;
|
|
83
|
+
try {
|
|
84
|
+
this._currentDepth++;
|
|
85
|
+
// Resolve the property; might be a getter
|
|
86
|
+
const value = o[k];
|
|
87
|
+
stringified = this.stringify(value);
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
// Getters might error.
|
|
91
|
+
stringified = this._token(`errored(${e.message})`);
|
|
92
|
+
}
|
|
93
|
+
this._currentDepth--;
|
|
94
|
+
const pair = [this._sanitizeKey(k), stringified];
|
|
95
|
+
stringifiedPairs.push(pair);
|
|
96
|
+
}
|
|
97
|
+
return this._dataclassStyle(getJsClassName(o), [], stringifiedPairs);
|
|
98
|
+
}
|
|
99
|
+
stringify(item) {
|
|
100
|
+
if (item === null || item === undefined) {
|
|
101
|
+
return this._nonish(item);
|
|
102
|
+
}
|
|
103
|
+
if (typeof item === 'boolean') {
|
|
104
|
+
return this._bool(item);
|
|
105
|
+
}
|
|
106
|
+
if (typeof item === 'string') {
|
|
107
|
+
return this._string(item);
|
|
108
|
+
}
|
|
109
|
+
if (typeof item === 'number' || typeof item === 'bigint') {
|
|
110
|
+
// Python's int is unbounded so it will work fine with bigint
|
|
111
|
+
return this._number(item);
|
|
112
|
+
}
|
|
113
|
+
if (typeof item === 'symbol') {
|
|
114
|
+
// Python doesn't actually have this
|
|
115
|
+
return this._symbol(item);
|
|
116
|
+
}
|
|
117
|
+
if (typeof item === 'function') {
|
|
118
|
+
return this._function(item);
|
|
119
|
+
}
|
|
120
|
+
if (this._seen.has(item)) {
|
|
121
|
+
return this._circular(item);
|
|
122
|
+
}
|
|
123
|
+
if (this._currentDepth >= this._options.maxDepth) {
|
|
124
|
+
return this._depthExceeded(item);
|
|
125
|
+
}
|
|
126
|
+
this._seen.add(item);
|
|
127
|
+
try {
|
|
128
|
+
if (item instanceof Error) {
|
|
129
|
+
return this._error(item);
|
|
130
|
+
}
|
|
131
|
+
// <- Add more specific object types here if desired
|
|
132
|
+
if (Array.isArray(item)) {
|
|
133
|
+
return this._array(item);
|
|
134
|
+
}
|
|
135
|
+
this._seen.add(item);
|
|
136
|
+
const result = this._object(item);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
this._seen.delete(item);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export function __str__(obj, options = {}) {
|
|
145
|
+
const x = new Stringifier(options);
|
|
146
|
+
return x.stringify(obj);
|
|
147
|
+
}
|
|
148
|
+
export function __repr__(obj, options = {}) {
|
|
149
|
+
const x = new Stringifier({ ...options, repr: true });
|
|
150
|
+
return x.stringify(obj);
|
|
151
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getJsClassName(obj: any): string;
|
|
2
|
+
export declare function getJsSymbolName(sym: symbol): string;
|
|
3
|
+
export declare function isNumberLike(value: any): boolean;
|
|
4
|
+
export declare function isIntLike(value: any): boolean;
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/warpc/msg-protocol/concept/python-mirrors/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAK/C;AACD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAEhD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAE7C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function getJsClassName(obj) {
|
|
2
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
3
|
+
throw new Error('Input must be an object');
|
|
4
|
+
}
|
|
5
|
+
return obj[Symbol.toStringTag] || obj.constructor?.name || 'Object';
|
|
6
|
+
}
|
|
7
|
+
export function getJsSymbolName(sym) {
|
|
8
|
+
const desc = sym.description;
|
|
9
|
+
return desc ?? '';
|
|
10
|
+
}
|
|
11
|
+
export function isNumberLike(value) {
|
|
12
|
+
return +value === parseFloat(value);
|
|
13
|
+
}
|
|
14
|
+
export function isIntLike(value) {
|
|
15
|
+
return isNumberLike(value) && Number.isInteger(+value);
|
|
16
|
+
}
|
|
@@ -5,9 +5,10 @@ import { FunctionMsg } from './function-msg.js';
|
|
|
5
5
|
import { ObjectMsg } from './object-msg.js';
|
|
6
6
|
declare global {
|
|
7
7
|
function magicStackTrace(): string | undefined;
|
|
8
|
-
function magicRepr(obj: any): string
|
|
8
|
+
function magicRepr(obj: any): string;
|
|
9
9
|
function magicLen(obj: any): number;
|
|
10
10
|
function magicKeys(obj: any): string[];
|
|
11
|
+
function magicStr(obj: any): string;
|
|
11
12
|
var MagicNone: object;
|
|
12
13
|
var AttributeError: typeof Error;
|
|
13
14
|
var KeyError: typeof Error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-msg.d.ts","sourceRoot":"","sources":["../../../../../src/warpc/msg-protocol/concept/resource/system-msg.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,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,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ;CASlE"}
|
|
@@ -2,24 +2,25 @@ import { extractAllPropertyNames } from '../../../frame-context/message-conversi
|
|
|
2
2
|
import { ClassMsg } from './class-msg.js';
|
|
3
3
|
import { FunctionMsg } from './function-msg.js';
|
|
4
4
|
import { ObjectMsg } from './object-msg.js';
|
|
5
|
+
import { __repr__, __str__ } from '../python-mirrors/str.js';
|
|
5
6
|
import { BoolMsg, FloatMsg, IntMsg, StrMsg } from '../value/atom.js';
|
|
6
7
|
globalThis.magicStackTrace = function () {
|
|
7
8
|
return new Error().stack;
|
|
8
9
|
};
|
|
10
|
+
globalThis.magicStr = function (obj) {
|
|
11
|
+
return __str__(obj, {
|
|
12
|
+
maxDepth: 3,
|
|
13
|
+
});
|
|
14
|
+
};
|
|
9
15
|
globalThis.magicRepr = function (obj) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return obj.repr();
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
16
|
+
return __repr__(obj, {
|
|
17
|
+
maxDepth: 3,
|
|
18
|
+
});
|
|
20
19
|
};
|
|
21
20
|
globalThis.magicLen = function (obj) {
|
|
22
|
-
|
|
21
|
+
if (typeof obj === 'string' || Array.isArray(obj))
|
|
22
|
+
return obj.length;
|
|
23
|
+
return Object.keys(obj).length;
|
|
23
24
|
};
|
|
24
25
|
globalThis.magicKeys = function (obj) {
|
|
25
26
|
return Array.from(extractAllPropertyNames(obj));
|
|
@@ -83,9 +84,11 @@ export const FUNCTION_IDS = {
|
|
|
83
84
|
magicStackTrace: -303,
|
|
84
85
|
magicLen: -304,
|
|
85
86
|
magicKeys: -305,
|
|
87
|
+
magicStr: -306,
|
|
86
88
|
'Object.entries': -401,
|
|
87
89
|
'Object.keys': -402,
|
|
88
90
|
'Object.is': -403,
|
|
91
|
+
'Object.toString': -404,
|
|
89
92
|
'Reflect.getPrototypeOf': -501,
|
|
90
93
|
'Reflect.isExtensible': -502,
|
|
91
94
|
'Reflect.has': -503,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbolica/agentica",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agentica TypeScript SDK",
|
|
6
6
|
"homepage": "https://www.symbolica.ai/agentica",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"version:sync:prod-rc": "eval $(sh scripts/detect-pm.sh all) && $RT scripts/sync-version-from-git.js prod rc",
|
|
15
15
|
"version:sync:prod": "eval $(sh scripts/detect-pm.sh all) && $RT scripts/sync-version-from-git.js prod release",
|
|
16
16
|
"print:version": "eval $(sh scripts/detect-pm.sh all) && $RT -e \"console.log(require('./package.json').version);\"",
|
|
17
|
+
"gen": "$(sh scripts/detect-pm.sh exec) openapi-typescript ../../session_manager/src/openapi_schema.json -o ./src/types/api.d.ts",
|
|
17
18
|
"build:transformer": "tsc -p tsconfig.transformer.json && tsc-alias -p tsconfig.transformer.json",
|
|
18
19
|
"build": "tspc -p tsconfig.json && tsc-alias -p tsconfig.json",
|
|
19
20
|
"build:all": "eval $(sh scripts/detect-pm.sh all) && $PM run version:sync && $PM run build:transformer && $PM run build",
|
|
@@ -46,7 +47,8 @@
|
|
|
46
47
|
"dist/",
|
|
47
48
|
"dist-transformer/",
|
|
48
49
|
"bun/",
|
|
49
|
-
"default-configs/"
|
|
50
|
+
"default-configs/",
|
|
51
|
+
"THIRD_PARTY_NOTICES.md"
|
|
50
52
|
],
|
|
51
53
|
"license": "SEE LICENSE IN LICENSE",
|
|
52
54
|
"repository": {
|
|
@@ -107,7 +109,7 @@
|
|
|
107
109
|
"@opentelemetry/semantic-conventions": "^1.38.0",
|
|
108
110
|
"bufferutil": "^4.0.9",
|
|
109
111
|
"consola": "^3.4.2",
|
|
110
|
-
"next": "^
|
|
112
|
+
"next": "^16.1.5",
|
|
111
113
|
"openapi-fetch": "^0.12.2",
|
|
112
114
|
"pathe": "^2.0.3",
|
|
113
115
|
"picocolors": "^1.1.1",
|