@versori/run 0.4.0-alpha.1 → 0.4.0-alpha.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/src/internal/supervisor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/src/internal/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6D,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAMzD,eAAO,MAAM,OAAO,SAEjB,CAAA;AAIH,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,CAAC;AAC5E,KAAK,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjC,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBxE;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/D;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqCxH;AAoBD,qBAAa,IAAK,YAAW,YAAY;;IAOrC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAiBnF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { GoogleGenAI } from "@google/genai";
|
|
2
1
|
import { ExportResultCode, hrTimeToMilliseconds, hrTimeToTimeStamp } from '@opentelemetry/core';
|
|
3
2
|
import { ConsoleLogger } from '../observability/logging/ConsoleLogger.js';
|
|
4
3
|
const supervisorURL = function () {
|
|
5
4
|
return Deno.env.get('RUN_SUPERVISOR_URL') || '';
|
|
6
5
|
}();
|
|
7
|
-
const ai = function () {
|
|
8
|
-
return new GoogleGenAI({
|
|
9
|
-
apiKey: "AIzaSyB4HU72JjVceHgk35bk5o4foy19HAfkv3E" // this my personal token for the free use of gemini
|
|
10
|
-
});
|
|
11
|
-
}();
|
|
12
6
|
export const enabled = function () {
|
|
13
7
|
return Deno.env.get('RUN_SUPERVISOR_URL') ? true : false;
|
|
14
8
|
}();
|
|
@@ -48,22 +42,37 @@ export async function registerCrons(crons) {
|
|
|
48
42
|
}
|
|
49
43
|
}
|
|
50
44
|
export async function mockAPIRequest(info, cnx, options) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
45
|
+
if (!enabled) {
|
|
46
|
+
return new Response();
|
|
47
|
+
}
|
|
48
|
+
const mockRequest = {
|
|
49
|
+
url: info.toString(),
|
|
50
|
+
payload: options?.body || '',
|
|
51
|
+
method: options?.method || "GET",
|
|
52
|
+
headers: options?.headers,
|
|
53
|
+
connection: cnx?.name,
|
|
54
|
+
connectionId: cnx?.id,
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(`${supervisorURL}/ai/fake-fetch-call`, {
|
|
58
|
+
method: "POST",
|
|
59
|
+
body: JSON.stringify(mockRequest),
|
|
60
|
+
headers: {
|
|
61
|
+
"Content-Type": "application/json",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
logger.error('Failed to mock api request', { response });
|
|
66
|
+
const text = await response.text();
|
|
67
|
+
return new Response();
|
|
68
|
+
}
|
|
69
|
+
const text = await response.text();
|
|
70
|
+
return new Response(text);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
logger.error('Failed to mock api request', { error: err });
|
|
74
|
+
return new Response();
|
|
75
|
+
}
|
|
67
76
|
}
|
|
68
77
|
function printableSpan(s) {
|
|
69
78
|
return {
|
|
@@ -91,7 +100,7 @@ export class Fake {
|
|
|
91
100
|
export(spans, resultCallback) {
|
|
92
101
|
const ss = spans.map(printableSpan);
|
|
93
102
|
try {
|
|
94
|
-
fetch(`${supervisorURL}/receive-
|
|
103
|
+
fetch(`${supervisorURL}/receive-spans`, {
|
|
95
104
|
method: "POST",
|
|
96
105
|
body: JSON.stringify({ spans: ss }),
|
|
97
106
|
headers: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versori/run",
|
|
3
|
-
"version": "v0.4.0-alpha.
|
|
3
|
+
"version": "v0.4.0-alpha.2",
|
|
4
4
|
"description": "Versori Run",
|
|
5
5
|
"homepage": "https://github.com/versori/versori-run#readme",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@bufbuild/protobuf": "^2.5.2",
|
|
27
27
|
"@connectrpc/connect": "^2.0.4",
|
|
28
28
|
"@connectrpc/connect-node": "^2.0.4",
|
|
29
|
-
"@google/genai": "^1.21.0",
|
|
30
29
|
"@opentelemetry/api": "^1.9.0",
|
|
31
30
|
"@opentelemetry/core": "^2.1.0",
|
|
32
31
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.200.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/src/internal/supervisor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/src/internal/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6D,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAMzD,eAAO,MAAM,OAAO,SAEjB,CAAA;AAIH,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,CAAC;AAC5E,KAAK,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjC,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBxE;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/D;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqCxH;AAoBD,qBAAa,IAAK,YAAW,YAAY;;IAOrC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAiBnF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
|
|
@@ -4,17 +4,11 @@ exports.Fake = exports.enabled = void 0;
|
|
|
4
4
|
exports.registerWebhooks = registerWebhooks;
|
|
5
5
|
exports.registerCrons = registerCrons;
|
|
6
6
|
exports.mockAPIRequest = mockAPIRequest;
|
|
7
|
-
const genai_1 = require("@google/genai");
|
|
8
7
|
const core_1 = require("@opentelemetry/core");
|
|
9
8
|
const ConsoleLogger_js_1 = require("../observability/logging/ConsoleLogger.js");
|
|
10
9
|
const supervisorURL = function () {
|
|
11
10
|
return Deno.env.get('RUN_SUPERVISOR_URL') || '';
|
|
12
11
|
}();
|
|
13
|
-
const ai = function () {
|
|
14
|
-
return new genai_1.GoogleGenAI({
|
|
15
|
-
apiKey: "AIzaSyB4HU72JjVceHgk35bk5o4foy19HAfkv3E" // this my personal token for the free use of gemini
|
|
16
|
-
});
|
|
17
|
-
}();
|
|
18
12
|
exports.enabled = function () {
|
|
19
13
|
return Deno.env.get('RUN_SUPERVISOR_URL') ? true : false;
|
|
20
14
|
}();
|
|
@@ -54,22 +48,37 @@ async function registerCrons(crons) {
|
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
50
|
async function mockAPIRequest(info, cnx, options) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
if (!exports.enabled) {
|
|
52
|
+
return new Response();
|
|
53
|
+
}
|
|
54
|
+
const mockRequest = {
|
|
55
|
+
url: info.toString(),
|
|
56
|
+
payload: options?.body || '',
|
|
57
|
+
method: options?.method || "GET",
|
|
58
|
+
headers: options?.headers,
|
|
59
|
+
connection: cnx?.name,
|
|
60
|
+
connectionId: cnx?.id,
|
|
61
|
+
};
|
|
62
|
+
try {
|
|
63
|
+
const response = await fetch(`${supervisorURL}/ai/fake-fetch-call`, {
|
|
64
|
+
method: "POST",
|
|
65
|
+
body: JSON.stringify(mockRequest),
|
|
66
|
+
headers: {
|
|
67
|
+
"Content-Type": "application/json",
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
logger.error('Failed to mock api request', { response });
|
|
72
|
+
const text = await response.text();
|
|
73
|
+
return new Response();
|
|
74
|
+
}
|
|
75
|
+
const text = await response.text();
|
|
76
|
+
return new Response(text);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
logger.error('Failed to mock api request', { error: err });
|
|
80
|
+
return new Response();
|
|
81
|
+
}
|
|
73
82
|
}
|
|
74
83
|
function printableSpan(s) {
|
|
75
84
|
return {
|
|
@@ -97,7 +106,7 @@ class Fake {
|
|
|
97
106
|
export(spans, resultCallback) {
|
|
98
107
|
const ss = spans.map(printableSpan);
|
|
99
108
|
try {
|
|
100
|
-
fetch(`${supervisorURL}/receive-
|
|
109
|
+
fetch(`${supervisorURL}/receive-spans`, {
|
|
101
110
|
method: "POST",
|
|
102
111
|
body: JSON.stringify({ spans: ss }),
|
|
103
112
|
headers: {
|