@mondaydotcomorg/atp-runtime 0.17.16 → 0.18.4-rc.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/dist/approval/index.js +2 -1
- package/dist/approval/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/llm/index.d.ts +1 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +1 -1
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/replay.d.ts +75 -0
- package/dist/llm/replay.d.ts.map +1 -1
- package/dist/llm/replay.js +187 -5
- package/dist/llm/replay.js.map +1 -1
- package/dist/metadata/generated.d.ts +4 -0
- package/dist/metadata/generated.d.ts.map +1 -1
- package/dist/metadata/generated.js +189 -189
- package/dist/metadata/generated.js.map +1 -1
- package/dist/metadata/index.d.ts +14 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +45 -3
- package/dist/metadata/index.js.map +1 -1
- package/dist/metadata/types.d.ts +2 -1
- package/dist/metadata/types.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/approval/index.ts +2 -2
- package/src/index.ts +13 -0
- package/src/llm/index.ts +13 -0
- package/src/llm/replay.ts +239 -11
- package/src/metadata/generated.ts +288 -275
- package/src/metadata/index.ts +59 -3
- package/src/metadata/types.ts +3 -1
|
@@ -8,283 +8,283 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export const GENERATED_METADATA = [
|
|
10
10
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
name: 'approval',
|
|
12
|
+
description: 'Approval API - Request explicit human approval for sensitive operations',
|
|
13
|
+
methods: [
|
|
14
14
|
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
name: 'request',
|
|
16
|
+
description: 'Request approval from a human',
|
|
17
|
+
params: [
|
|
18
18
|
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
name: 'message',
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'The message to display to the user',
|
|
22
|
+
optional: false,
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
25
|
+
name: 'context',
|
|
26
|
+
type: 'Record<string, unknown>',
|
|
27
|
+
description: 'Optional context information about what needs approval',
|
|
28
|
+
optional: true,
|
|
29
|
+
},
|
|
30
30
|
],
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
]
|
|
31
|
+
returns: 'Promise<ApprovalResponse>',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
name: 'cache',
|
|
37
|
+
description: 'Cache API - Store and retrieve data with optional TTL',
|
|
38
|
+
methods: [
|
|
39
39
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
name: 'get',
|
|
41
|
+
description: 'Get a value from cache by key',
|
|
42
|
+
params: [
|
|
43
43
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
44
|
+
name: 'key',
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Cache key',
|
|
47
|
+
optional: false,
|
|
48
|
+
},
|
|
49
49
|
],
|
|
50
|
-
|
|
50
|
+
returns: 'Promise<T | null>',
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
name: 'set',
|
|
54
|
+
description: 'Set a value in cache with optional TTL',
|
|
55
|
+
params: [
|
|
56
56
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
name: 'key',
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Cache key',
|
|
60
|
+
optional: false,
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
name: 'value',
|
|
64
|
+
type: 'unknown',
|
|
65
|
+
description: 'Value to cache',
|
|
66
|
+
optional: false,
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
69
|
+
name: 'ttl',
|
|
70
|
+
type: 'number',
|
|
71
|
+
description: 'Time to live in seconds',
|
|
72
|
+
optional: true,
|
|
73
|
+
},
|
|
74
74
|
],
|
|
75
|
-
|
|
75
|
+
returns: 'Promise<void>',
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
name: 'delete',
|
|
79
|
+
description: 'Delete a value from cache',
|
|
80
|
+
params: [
|
|
81
81
|
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
82
|
+
name: 'key',
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'Cache key to delete',
|
|
85
|
+
optional: false,
|
|
86
|
+
},
|
|
87
87
|
],
|
|
88
|
-
|
|
88
|
+
returns: 'Promise<void>',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
name: 'has',
|
|
92
|
+
description: 'Check if a key exists in cache',
|
|
93
|
+
params: [
|
|
94
94
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
95
|
+
name: 'key',
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'Cache key to check',
|
|
98
|
+
optional: false,
|
|
99
|
+
},
|
|
100
100
|
],
|
|
101
|
-
|
|
101
|
+
returns: 'Promise<boolean>',
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
]
|
|
104
|
+
name: 'clear',
|
|
105
|
+
description: 'Clear all cache entries',
|
|
106
|
+
params: [],
|
|
107
|
+
returns: 'Promise<void>',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
name: 'embedding',
|
|
113
|
+
description: 'Embedding API - Client-side embedding with server-side vector storage',
|
|
114
|
+
methods: [
|
|
115
115
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
name: 'embed',
|
|
117
|
+
description: 'Request client to generate and store embeddings',
|
|
118
|
+
params: [
|
|
119
119
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
name: 'input',
|
|
121
|
+
type: 'string | string[]',
|
|
122
|
+
description: 'Text(s) to embed',
|
|
123
|
+
optional: false,
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
126
|
+
name: 'metadata',
|
|
127
|
+
type: 'Record<string, unknown>',
|
|
128
|
+
description: 'Optional metadata to store with embeddings',
|
|
129
|
+
optional: true,
|
|
130
|
+
},
|
|
131
131
|
],
|
|
132
|
-
|
|
132
|
+
returns: 'Promise<string | string[]>',
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
name: 'search',
|
|
136
|
+
description: 'Search stored embeddings by similarity',
|
|
137
|
+
params: [
|
|
138
138
|
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
name: 'query',
|
|
140
|
+
type: 'string',
|
|
141
|
+
description: 'Search query text (will be embedded by client)',
|
|
142
|
+
optional: false,
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
145
|
+
name: 'options',
|
|
146
|
+
type: "Omit<SearchOptions, 'query'>",
|
|
147
|
+
description: 'Search options (topK, minSimilarity, filter)',
|
|
148
|
+
optional: true,
|
|
149
|
+
},
|
|
150
150
|
],
|
|
151
|
-
|
|
151
|
+
returns: 'Promise<SearchResult[]>',
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
name: 'similarity',
|
|
155
|
+
description: 'Calculate cosine similarity between two embedding vectors',
|
|
156
|
+
params: [
|
|
157
157
|
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
name: 'embedding1',
|
|
159
|
+
type: 'number[]',
|
|
160
|
+
description: 'First embedding vector',
|
|
161
|
+
optional: false,
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
164
|
+
name: 'embedding2',
|
|
165
|
+
type: 'number[]',
|
|
166
|
+
description: 'Second embedding vector',
|
|
167
|
+
optional: false,
|
|
168
|
+
},
|
|
169
169
|
],
|
|
170
|
-
|
|
170
|
+
returns: 'number',
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
name: 'getAll',
|
|
174
|
+
description: 'Get all stored embeddings',
|
|
175
|
+
params: [],
|
|
176
|
+
returns: 'EmbeddingRecord[]',
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
]
|
|
179
|
+
name: 'count',
|
|
180
|
+
description: 'Get count of stored embeddings',
|
|
181
|
+
params: [],
|
|
182
|
+
returns: 'number',
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
name: 'llm',
|
|
188
|
+
description: 'LLM API - Large Language Model calls using client-provided LLM (requires client.provideLLM())',
|
|
189
|
+
methods: [
|
|
190
190
|
{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
name: 'call',
|
|
192
|
+
description: 'Make an LLM call with a prompt',
|
|
193
|
+
params: [
|
|
194
194
|
{
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
195
|
+
name: 'options',
|
|
196
|
+
type: 'LLMCallOptions',
|
|
197
|
+
description: 'LLM call options including prompt',
|
|
198
|
+
optional: false,
|
|
199
|
+
},
|
|
200
200
|
],
|
|
201
|
-
|
|
201
|
+
returns: 'Promise<string>',
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
name: 'extract',
|
|
205
|
+
description: 'Extract structured data from text using an LLM',
|
|
206
|
+
params: [
|
|
207
207
|
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
208
|
+
name: 'options',
|
|
209
|
+
type: 'LLMExtractOptions',
|
|
210
|
+
description: 'Extraction options with JSON schema',
|
|
211
|
+
optional: false,
|
|
212
|
+
},
|
|
213
213
|
],
|
|
214
|
-
|
|
214
|
+
returns: 'Promise<T>',
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
name: 'classify',
|
|
218
|
+
description: 'Classify text into one of the provided categories',
|
|
219
|
+
params: [
|
|
220
220
|
{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
221
|
+
name: 'options',
|
|
222
|
+
type: 'LLMClassifyOptions',
|
|
223
|
+
description: 'Classification options with categories',
|
|
224
|
+
optional: false,
|
|
225
|
+
},
|
|
226
226
|
],
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
]
|
|
227
|
+
returns: 'Promise<string>',
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
name: 'progress',
|
|
233
|
+
description: 'Progress API - Report execution progress to clients',
|
|
234
|
+
methods: [
|
|
235
235
|
{
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
name: 'report',
|
|
237
|
+
description: 'Report progress with message and completion fraction',
|
|
238
|
+
params: [
|
|
239
239
|
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
name: 'message',
|
|
241
|
+
type: 'string',
|
|
242
|
+
description: 'Progress message',
|
|
243
|
+
optional: false,
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
246
|
+
name: 'fraction',
|
|
247
|
+
type: 'number',
|
|
248
|
+
description: 'Completion fraction (0-1)',
|
|
249
|
+
optional: false,
|
|
250
|
+
},
|
|
251
251
|
],
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
}
|
|
252
|
+
returns: 'void',
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
},
|
|
256
256
|
];
|
|
257
257
|
/**
|
|
258
258
|
* Type definitions extracted using ts-json-schema-generator
|
|
259
259
|
*/
|
|
260
260
|
export const TYPE_REGISTRY = [
|
|
261
261
|
{
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
name: 'ApprovalResponse',
|
|
263
|
+
definition: 'export interface ApprovalResponse<T = unknown> {\n\tapproved: boolean;\n\tresponse?: T;\n\ttimestamp: number;\n}',
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
name: 'SearchOptions',
|
|
267
|
+
definition: 'interface SearchOptions {\n query: string;\n topK?: number;\n minSimilarity?: number;\n filter?: Record<string, unknown>;\n}',
|
|
268
268
|
},
|
|
269
269
|
{
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
name: 'SearchResult',
|
|
271
|
+
definition: 'interface SearchResult {\n id: string;\n text: string;\n similarity: number;\n metadata?: Record<string, unknown>;\n}',
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
name: 'EmbeddingRecord',
|
|
275
|
+
definition: 'interface EmbeddingRecord {\n id: string;\n text: string;\n embedding: number[];\n metadata?: Record<string, unknown>;\n}',
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
name: 'LLMCallOptions',
|
|
279
|
+
definition: 'interface LLMCallOptions {\n prompt: string;\n context?: Record<string, unknown>;\n model?: string;\n maxTokens?: number;\n temperature?: number;\n systemPrompt?: string;\n}',
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
name: 'LLMExtractOptions',
|
|
283
|
+
definition: 'interface LLMExtractOptions {\n prompt: string;\n context?: Record<string, unknown>;\n schema: unknown;\n}',
|
|
284
284
|
},
|
|
285
285
|
{
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
286
|
+
name: 'LLMClassifyOptions',
|
|
287
|
+
definition: 'interface LLMClassifyOptions {\n text: string;\n categories: string[];\n context?: Record<string, unknown>;\n}',
|
|
288
|
+
},
|
|
289
289
|
];
|
|
290
290
|
//# sourceMappingURL=generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated.js","sourceRoot":"","sources":["../../src/metadata/generated.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAyB;
|
|
1
|
+
{"version":3,"file":"generated.js","sourceRoot":"","sources":["../../src/metadata/generated.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAyB;IACvD;QACC,IAAI,EAAE,U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P;wBACC,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,oBAAoB;wBAC1B,WAAW,EAAE,wCAAwC;wBACrD,QAAQ,EAAE,KAAK;qBACf;iBACD;gBACD,OAAO,EAAE,iBAAiB;aAC1B;SACD;KACD;IACD;QACC,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,qDAAqD;QAClE,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sDAAsD;gBACnE,MAAM,EAAE;oBACP;wBACC,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,kBAAkB;wBAC/B,QAAQ,EAAE,KAAK;qBACf;oBACD;wBACC,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2BAA2B;wBACxC,QAAQ,EAAE,KAAK;qBACf;iBACD;gBACD,OAAO,EAAE,MAAM;aACf;SACD;KACD;CACD,CAAC;AAOF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B;QACC,IAAI,EAAE,kBAAkB;QACxB,UAAU,EACT,kHAAkH;KACnH;IACD;QACC,IAAI,EAAE,eAAe;QACrB,UAAU,EACT,kIAAkI;KACnI;IACD;QACC,IAAI,EAAE,cAAc;QACpB,UAAU,EACT,2HAA2H;KAC5H;IACD;QACC,IAAI,EAAE,iBAAiB;QACvB,UAAU,EACT,+HAA+H;KAChI;IACD;QACC,IAAI,EAAE,gBAAgB;QACtB,UAAU,EACT,qLAAqL;KACtL;IACD;QACC,IAAI,EAAE,mBAAmB;QACzB,UAAU,EACT,+GAA+G;KAChH;IACD;QACC,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EACT,mHAAmH;KACpH;CACD,CAAC"}
|
package/dist/metadata/index.d.ts
CHANGED
|
@@ -3,9 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type { RuntimeAPIParam, RuntimeAPIMethod, RuntimeAPIMetadata } from './types.js';
|
|
5
5
|
export { RuntimeAPI, RuntimeMethod } from './decorators.js';
|
|
6
|
+
export type { RuntimeAPIName } from './generated.js';
|
|
6
7
|
import type { RuntimeAPIMetadata } from './types.js';
|
|
8
|
+
import type { RuntimeAPIName } from './generated.js';
|
|
9
|
+
interface ClientServices {
|
|
10
|
+
hasLLM: boolean;
|
|
11
|
+
hasApproval: boolean;
|
|
12
|
+
hasEmbedding: boolean;
|
|
13
|
+
hasTools: boolean;
|
|
14
|
+
}
|
|
7
15
|
/**
|
|
8
16
|
* Generates TypeScript definitions from runtime API metadata
|
|
17
|
+
* @param apis - Runtime API metadata
|
|
18
|
+
* @param options - Optional filtering options
|
|
9
19
|
*/
|
|
10
|
-
export declare function generateRuntimeTypes(apis: RuntimeAPIMetadata[]
|
|
20
|
+
export declare function generateRuntimeTypes(apis: RuntimeAPIMetadata[], options?: {
|
|
21
|
+
clientServices?: ClientServices;
|
|
22
|
+
requestedApis?: RuntimeAPIName[];
|
|
23
|
+
}): string;
|
|
11
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,UAAU,cAAc;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,kBAAkB,EAAE,EAC1B,OAAO,CAAC,EAAE;IACT,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC;CACjC,GACC,MAAM,CAsFR"}
|
package/dist/metadata/index.js
CHANGED
|
@@ -2,12 +2,54 @@
|
|
|
2
2
|
* Metadata and Type Generation Utilities
|
|
3
3
|
*/
|
|
4
4
|
export { RuntimeAPI, RuntimeMethod } from './decorators.js';
|
|
5
|
+
import { TYPE_REGISTRY } from './generated.js';
|
|
5
6
|
/**
|
|
6
7
|
* Generates TypeScript definitions from runtime API metadata
|
|
8
|
+
* @param apis - Runtime API metadata
|
|
9
|
+
* @param options - Optional filtering options
|
|
7
10
|
*/
|
|
8
|
-
export function generateRuntimeTypes(apis) {
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
+
export function generateRuntimeTypes(apis, options) {
|
|
12
|
+
let filteredApis = apis;
|
|
13
|
+
if (options?.requestedApis && options.requestedApis.length > 0) {
|
|
14
|
+
const requestedApis = options.requestedApis.map((api) => apis.find((a) => a.name === api));
|
|
15
|
+
filteredApis = requestedApis.filter((api) => api !== undefined);
|
|
16
|
+
}
|
|
17
|
+
else if (options?.clientServices) {
|
|
18
|
+
filteredApis = apis.filter((api) => {
|
|
19
|
+
if (api.name === 'llm' && !options.clientServices.hasLLM)
|
|
20
|
+
return false;
|
|
21
|
+
if (api.name === 'approval' && !options.clientServices.hasApproval)
|
|
22
|
+
return false;
|
|
23
|
+
if (api.name === 'embedding' && !options.clientServices.hasEmbedding)
|
|
24
|
+
return false;
|
|
25
|
+
if (api.name === 'progress')
|
|
26
|
+
return false;
|
|
27
|
+
return true;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
filteredApis = apis.filter((api) => api.name === 'cache');
|
|
32
|
+
}
|
|
33
|
+
let typescript = '// Runtime SDK Type Definitions\n\n';
|
|
34
|
+
const usedTypes = new Set();
|
|
35
|
+
for (const api of filteredApis) {
|
|
36
|
+
for (const method of api.methods) {
|
|
37
|
+
const allTypes = [method.returns, ...method.params.map((p) => p.type)].join(' ');
|
|
38
|
+
const typeMatches = allTypes.match(/\b[A-Z][a-zA-Z]+\b/g);
|
|
39
|
+
if (typeMatches) {
|
|
40
|
+
typeMatches.forEach((t) => usedTypes.add(t));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const type of TYPE_REGISTRY) {
|
|
45
|
+
const typeNameMatch = type.definition.match(/(?:interface|type)\s+([A-Z][a-zA-Z]+)/);
|
|
46
|
+
const typeName = typeNameMatch?.[1];
|
|
47
|
+
if (typeName && usedTypes.has(typeName)) {
|
|
48
|
+
typescript += `${type.definition}\n\n`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
typescript += '// Runtime SDK\ndeclare const atp: {\n';
|
|
52
|
+
for (const api of filteredApis) {
|
|
11
53
|
typescript += ` /**\n`;
|
|
12
54
|
for (const line of api.description.split('\n')) {
|
|
13
55
|
typescript += ` * ${line}\n`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,C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