@tonyclaw/agent-inspector 4.0.8 → 4.0.10
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/.output/backend/nitro.json +1 -1
- package/.output/cli.js +915 -25970
- package/.output/server/_chunks/ssr-renderer.mjs +1 -38
- package/.output/server/_libs/@opentelemetry/semantic-conventions+[...].mjs +1 -2658
- package/.output/server/_libs/agent-base.mjs +2 -234
- package/.output/server/_libs/ajv-formats.mjs +1 -330
- package/.output/server/_libs/ajv.mjs +8 -6080
- package/.output/server/_libs/anthropic-ai__sdk.mjs +19 -6021
- package/.output/server/_libs/atomically.mjs +1 -155
- package/.output/server/_libs/base64-js.mjs +1 -102
- package/.output/server/_libs/bignumber.js.mjs +1 -1353
- package/.output/server/_libs/buffer-equal-constant-time.mjs +1 -38
- package/.output/server/_libs/conf.mjs +1 -635
- package/.output/server/_libs/cookie-es.mjs +1 -44
- package/.output/server/_libs/core-util-is.mjs +1 -75
- package/.output/server/_libs/data-uri-to-buffer.mjs +1 -39
- package/.output/server/_libs/debounce-fn.mjs +1 -69
- package/.output/server/_libs/debug.mjs +5 -547
- package/.output/server/_libs/dot-prop.mjs +1 -265
- package/.output/server/_libs/ecdsa-sig-formatter.mjs +1 -162
- package/.output/server/_libs/env-paths.mjs +1 -57
- package/.output/server/_libs/extend.mjs +1 -94
- package/.output/server/_libs/fast-deep-equal.mjs +1 -38
- package/.output/server/_libs/fast-uri.mjs +1 -812
- package/.output/server/_libs/fetch-blob.mjs +1 -287
- package/.output/server/_libs/formdata-polyfill.mjs +9 -86
- package/.output/server/_libs/gaxios.mjs +5 -926
- package/.output/server/_libs/gcp-metadata.mjs +1 -322
- package/.output/server/_libs/google-auth-library.mjs +16 -6339
- package/.output/server/_libs/google-logging-utils.mjs +1 -385
- package/.output/server/_libs/google__genai.mjs +13 -18034
- package/.output/server/_libs/h3-v2.mjs +2 -287
- package/.output/server/_libs/h3.mjs +2 -408
- package/.output/server/_libs/has-flag.mjs +1 -16
- package/.output/server/_libs/https-proxy-agent.mjs +7 -280
- package/.output/server/_libs/immediate.mjs +1 -74
- package/.output/server/_libs/inherits.mjs +1 -50
- package/.output/server/_libs/isarray.mjs +1 -14
- package/.output/server/_libs/isbot.mjs +1 -20
- package/.output/server/_libs/json-bigint.mjs +8 -413
- package/.output/server/_libs/json-schema-traverse.mjs +1 -91
- package/.output/server/_libs/jszip.mjs +2 -3051
- package/.output/server/_libs/jwa.mjs +3 -233
- package/.output/server/_libs/jws.mjs +1 -298
- package/.output/server/_libs/lie.mjs +1 -273
- package/.output/server/_libs/mariozechner__pi-agent-core.mjs +1 -824
- package/.output/server/_libs/mariozechner__pi-ai.mjs +34 -22887
- package/.output/server/_libs/mimic-function.mjs +2 -47
- package/.output/server/_libs/mistralai__mistralai.mjs +7 -32045
- package/.output/server/_libs/modelcontextprotocol__core.mjs +1 -1121
- package/.output/server/_libs/modelcontextprotocol__server.mjs +13 -13205
- package/.output/server/_libs/ms.mjs +1 -120
- package/.output/server/_libs/node-domexception.mjs +1 -17
- package/.output/server/_libs/node-fetch.mjs +4 -1578
- package/.output/server/_libs/ohash.mjs +1 -1
- package/.output/server/_libs/openai.mjs +23 -6766
- package/.output/server/_libs/opentelemetry__api.mjs +1 -1678
- package/.output/server/_libs/p-retry.mjs +1 -87
- package/.output/server/_libs/pako.mjs +1 -4223
- package/.output/server/_libs/partial-json.mjs +2 -244
- package/.output/server/_libs/process-nextick-args.mjs +1 -48
- package/.output/server/_libs/react-dom.mjs +62 -10778
- package/.output/server/_libs/react.mjs +1 -519
- package/.output/server/_libs/readable-stream.mjs +1 -1518
- package/.output/server/_libs/retry.mjs +1 -236
- package/.output/server/_libs/rou3.mjs +1 -14
- package/.output/server/_libs/safe-buffer.mjs +1 -126
- package/.output/server/_libs/semver.mjs +1 -1938
- package/.output/server/_libs/seroval-plugins.mjs +1 -58
- package/.output/server/_libs/seroval.mjs +3 -1775
- package/.output/server/_libs/setimmediate.mjs +1 -152
- package/.output/server/_libs/srvx.mjs +4 -1390
- package/.output/server/_libs/stubborn-fs.mjs +1 -91
- package/.output/server/_libs/stubborn-utils.mjs +1 -66
- package/.output/server/_libs/supports-color.mjs +1 -108
- package/.output/server/_libs/tanstack__history.mjs +1 -230
- package/.output/server/_libs/tanstack__react-router.mjs +1 -848
- package/.output/server/_libs/tanstack__react-store.mjs +1 -1
- package/.output/server/_libs/tanstack__router-core.mjs +1 -4839
- package/.output/server/_libs/typebox.mjs +3 -6596
- package/.output/server/_libs/ufo.mjs +1 -54
- package/.output/server/_libs/uint8array-extras.mjs +1 -69
- package/.output/server/_libs/util-deprecate.mjs +1 -12
- package/.output/server/_libs/web-streams-polyfill.mjs +1 -4282
- package/.output/server/_libs/when-exit.mjs +1 -53
- package/.output/server/_libs/ws.mjs +7 -3715
- package/.output/server/_libs/zod-to-json-schema.mjs +5 -1207
- package/.output/server/_libs/zod.mjs +59 -9958
- package/.output/server/_ssr/empty-plugin-adapters-C3Q1xu4u.mjs +1 -0
- package/.output/server/_ssr/index.mjs +2 -1512
- package/.output/server/_ssr/publicBasePathContext--TAQS2_5.mjs +1 -0
- package/.output/server/_ssr/router-B3jax4sN.mjs +341 -0
- package/.output/server/_ssr/start-PDVGOqUN.mjs +1 -0
- package/.output/server/_tanstack-start-manifest_v-D7cKwKzM.mjs +1 -0
- package/.output/server/index.mjs +1 -320
- package/.output/ui/assets/{CompareDrawer-DafpfgaT.js → CompareDrawer-D8fg0prL.js} +1 -1
- package/.output/ui/assets/{InspectorPet-Brsmmfzx.js → InspectorPet-BAY7SAee.js} +1 -1
- package/.output/ui/assets/{ProxyViewerContainer-D2pq1fUr.js → ProxyViewerContainer-BPITPKYp.js} +4 -4
- package/.output/ui/assets/{ReplayDialog-D4mXXgT9.js → ReplayDialog-NLGOmBsc.js} +1 -1
- package/.output/ui/assets/{RequestAnatomy-Ccnsq12U.js → RequestAnatomy-DBhRhis7.js} +1 -1
- package/.output/ui/assets/{ResponseView-CJv3vB5X.js → ResponseView-DNXX-dzj.js} +1 -1
- package/.output/ui/assets/{StreamingChunkSequence-CEkLnOF6.js → StreamingChunkSequence-CLiT5Xun.js} +1 -1
- package/.output/ui/assets/{_sessionId-C7s68UH3.js → _sessionId-CY0Jj2Xv.js} +1 -1
- package/.output/ui/assets/{_sessionId-DlG-yHoI.js → _sessionId-Cf0So2vy.js} +1 -1
- package/.output/ui/assets/{index-ChZZrVHa.js → index-BIMJaHOR.js} +1 -1
- package/.output/ui/assets/{index-CFqnSirZ.js → index-DLG3AIXx.js} +1 -1
- package/.output/ui/assets/{index-B0NCZQ93.js → index-DTj5ErVh.js} +2 -2
- package/.output/ui/assets/{index-Cqh47jeU.js → index-ujyZ2AyC.js} +1 -1
- package/.output/ui/assets/{json-viewer-DvpI0vbY.js → json-viewer-BwPQ5x7s.js} +1 -1
- package/.output/ui/assets/{jszip.min-5AG8hW2c.js → jszip.min-CDwYiHmS.js} +1 -1
- package/.output/ui/index.html +1 -1
- package/.output/workers/logFinalizer.worker.js +41 -17739
- package/.output/workers/sessionWorkerEntry.js +41 -17735
- package/package.json +7 -7
- package/.output/server/_ssr/empty-plugin-adapters-BFgPZ6_d.mjs +0 -6
- package/.output/server/_ssr/publicBasePathContext-IH2ilOfu.mjs +0 -176
- package/.output/server/_ssr/router-BDyF-OMB.mjs +0 -27187
- package/.output/server/_ssr/start-COQu_AgD.mjs +0 -57
- package/.output/server/_tanstack-start-manifest_v-ClTaMkEj.mjs +0 -4
|
@@ -1,385 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import require$$0 from "events";
|
|
3
|
-
import require$$2 from "util";
|
|
4
|
-
var src = {};
|
|
5
|
-
var loggingUtils = {};
|
|
6
|
-
var colours = {};
|
|
7
|
-
var hasRequiredColours;
|
|
8
|
-
function requireColours() {
|
|
9
|
-
if (hasRequiredColours) return colours;
|
|
10
|
-
hasRequiredColours = 1;
|
|
11
|
-
Object.defineProperty(colours, "__esModule", { value: true });
|
|
12
|
-
colours.Colours = void 0;
|
|
13
|
-
class Colours {
|
|
14
|
-
/**
|
|
15
|
-
* @param stream The stream (e.g. process.stderr)
|
|
16
|
-
* @returns true if the stream should have colourization enabled
|
|
17
|
-
*/
|
|
18
|
-
static isEnabled(stream) {
|
|
19
|
-
return stream && // May happen in browsers.
|
|
20
|
-
stream.isTTY && (typeof stream.getColorDepth === "function" ? stream.getColorDepth() > 2 : true);
|
|
21
|
-
}
|
|
22
|
-
static refresh() {
|
|
23
|
-
Colours.enabled = Colours.isEnabled(process === null || process === void 0 ? void 0 : process.stderr);
|
|
24
|
-
if (!this.enabled) {
|
|
25
|
-
Colours.reset = "";
|
|
26
|
-
Colours.bright = "";
|
|
27
|
-
Colours.dim = "";
|
|
28
|
-
Colours.red = "";
|
|
29
|
-
Colours.green = "";
|
|
30
|
-
Colours.yellow = "";
|
|
31
|
-
Colours.blue = "";
|
|
32
|
-
Colours.magenta = "";
|
|
33
|
-
Colours.cyan = "";
|
|
34
|
-
Colours.white = "";
|
|
35
|
-
Colours.grey = "";
|
|
36
|
-
} else {
|
|
37
|
-
Colours.reset = "\x1B[0m";
|
|
38
|
-
Colours.bright = "\x1B[1m";
|
|
39
|
-
Colours.dim = "\x1B[2m";
|
|
40
|
-
Colours.red = "\x1B[31m";
|
|
41
|
-
Colours.green = "\x1B[32m";
|
|
42
|
-
Colours.yellow = "\x1B[33m";
|
|
43
|
-
Colours.blue = "\x1B[34m";
|
|
44
|
-
Colours.magenta = "\x1B[35m";
|
|
45
|
-
Colours.cyan = "\x1B[36m";
|
|
46
|
-
Colours.white = "\x1B[37m";
|
|
47
|
-
Colours.grey = "\x1B[90m";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
colours.Colours = Colours;
|
|
52
|
-
Colours.enabled = false;
|
|
53
|
-
Colours.reset = "";
|
|
54
|
-
Colours.bright = "";
|
|
55
|
-
Colours.dim = "";
|
|
56
|
-
Colours.red = "";
|
|
57
|
-
Colours.green = "";
|
|
58
|
-
Colours.yellow = "";
|
|
59
|
-
Colours.blue = "";
|
|
60
|
-
Colours.magenta = "";
|
|
61
|
-
Colours.cyan = "";
|
|
62
|
-
Colours.white = "";
|
|
63
|
-
Colours.grey = "";
|
|
64
|
-
Colours.refresh();
|
|
65
|
-
return colours;
|
|
66
|
-
}
|
|
67
|
-
var hasRequiredLoggingUtils;
|
|
68
|
-
function requireLoggingUtils() {
|
|
69
|
-
if (hasRequiredLoggingUtils) return loggingUtils;
|
|
70
|
-
hasRequiredLoggingUtils = 1;
|
|
71
|
-
(function(exports$1) {
|
|
72
|
-
var __createBinding = loggingUtils && loggingUtils.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
73
|
-
if (k2 === void 0) k2 = k;
|
|
74
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
75
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
76
|
-
desc = { enumerable: true, get: function() {
|
|
77
|
-
return m[k];
|
|
78
|
-
} };
|
|
79
|
-
}
|
|
80
|
-
Object.defineProperty(o, k2, desc);
|
|
81
|
-
}) : (function(o, m, k, k2) {
|
|
82
|
-
if (k2 === void 0) k2 = k;
|
|
83
|
-
o[k2] = m[k];
|
|
84
|
-
}));
|
|
85
|
-
var __setModuleDefault = loggingUtils && loggingUtils.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
86
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
87
|
-
}) : function(o, v) {
|
|
88
|
-
o["default"] = v;
|
|
89
|
-
});
|
|
90
|
-
var __importStar = loggingUtils && loggingUtils.__importStar || /* @__PURE__ */ (function() {
|
|
91
|
-
var ownKeys = function(o) {
|
|
92
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
93
|
-
var ar = [];
|
|
94
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
95
|
-
return ar;
|
|
96
|
-
};
|
|
97
|
-
return ownKeys(o);
|
|
98
|
-
};
|
|
99
|
-
return function(mod) {
|
|
100
|
-
if (mod && mod.__esModule) return mod;
|
|
101
|
-
var result = {};
|
|
102
|
-
if (mod != null) {
|
|
103
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
104
|
-
}
|
|
105
|
-
__setModuleDefault(result, mod);
|
|
106
|
-
return result;
|
|
107
|
-
};
|
|
108
|
-
})();
|
|
109
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
110
|
-
exports$1.env = exports$1.DebugLogBackendBase = exports$1.placeholder = exports$1.AdhocDebugLogger = exports$1.LogSeverity = void 0;
|
|
111
|
-
exports$1.getNodeBackend = getNodeBackend;
|
|
112
|
-
exports$1.getDebugBackend = getDebugBackend;
|
|
113
|
-
exports$1.getStructuredBackend = getStructuredBackend;
|
|
114
|
-
exports$1.setBackend = setBackend;
|
|
115
|
-
exports$1.log = log;
|
|
116
|
-
const events_1 = require$$0;
|
|
117
|
-
const process2 = __importStar(require$$1);
|
|
118
|
-
const util = __importStar(require$$2);
|
|
119
|
-
const colours_1 = requireColours();
|
|
120
|
-
var LogSeverity;
|
|
121
|
-
(function(LogSeverity2) {
|
|
122
|
-
LogSeverity2["DEFAULT"] = "DEFAULT";
|
|
123
|
-
LogSeverity2["DEBUG"] = "DEBUG";
|
|
124
|
-
LogSeverity2["INFO"] = "INFO";
|
|
125
|
-
LogSeverity2["WARNING"] = "WARNING";
|
|
126
|
-
LogSeverity2["ERROR"] = "ERROR";
|
|
127
|
-
})(LogSeverity || (exports$1.LogSeverity = LogSeverity = {}));
|
|
128
|
-
class AdhocDebugLogger extends events_1.EventEmitter {
|
|
129
|
-
/**
|
|
130
|
-
* @param upstream The backend will pass a function that will be
|
|
131
|
-
* called whenever our logger function is invoked.
|
|
132
|
-
*/
|
|
133
|
-
constructor(namespace, upstream) {
|
|
134
|
-
super();
|
|
135
|
-
this.namespace = namespace;
|
|
136
|
-
this.upstream = upstream;
|
|
137
|
-
this.func = Object.assign(this.invoke.bind(this), {
|
|
138
|
-
// Also add an instance pointer back to us.
|
|
139
|
-
instance: this,
|
|
140
|
-
// And pull over the EventEmitter functionality.
|
|
141
|
-
on: (event, listener) => this.on(event, listener)
|
|
142
|
-
});
|
|
143
|
-
this.func.debug = (...args) => this.invokeSeverity(LogSeverity.DEBUG, ...args);
|
|
144
|
-
this.func.info = (...args) => this.invokeSeverity(LogSeverity.INFO, ...args);
|
|
145
|
-
this.func.warn = (...args) => this.invokeSeverity(LogSeverity.WARNING, ...args);
|
|
146
|
-
this.func.error = (...args) => this.invokeSeverity(LogSeverity.ERROR, ...args);
|
|
147
|
-
this.func.sublog = (namespace2) => log(namespace2, this.func);
|
|
148
|
-
}
|
|
149
|
-
invoke(fields, ...args) {
|
|
150
|
-
if (this.upstream) {
|
|
151
|
-
try {
|
|
152
|
-
this.upstream(fields, ...args);
|
|
153
|
-
} catch (e) {
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
try {
|
|
157
|
-
this.emit("log", fields, args);
|
|
158
|
-
} catch (e) {
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
invokeSeverity(severity, ...args) {
|
|
162
|
-
this.invoke({ severity }, ...args);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
exports$1.AdhocDebugLogger = AdhocDebugLogger;
|
|
166
|
-
exports$1.placeholder = new AdhocDebugLogger("", () => {
|
|
167
|
-
}).func;
|
|
168
|
-
class DebugLogBackendBase {
|
|
169
|
-
constructor() {
|
|
170
|
-
var _a;
|
|
171
|
-
this.cached = /* @__PURE__ */ new Map();
|
|
172
|
-
this.filters = [];
|
|
173
|
-
this.filtersSet = false;
|
|
174
|
-
let nodeFlag = (_a = process2.env[exports$1.env.nodeEnables]) !== null && _a !== void 0 ? _a : "*";
|
|
175
|
-
if (nodeFlag === "all") {
|
|
176
|
-
nodeFlag = "*";
|
|
177
|
-
}
|
|
178
|
-
this.filters = nodeFlag.split(",");
|
|
179
|
-
}
|
|
180
|
-
log(namespace, fields, ...args) {
|
|
181
|
-
try {
|
|
182
|
-
if (!this.filtersSet) {
|
|
183
|
-
this.setFilters();
|
|
184
|
-
this.filtersSet = true;
|
|
185
|
-
}
|
|
186
|
-
let logger = this.cached.get(namespace);
|
|
187
|
-
if (!logger) {
|
|
188
|
-
logger = this.makeLogger(namespace);
|
|
189
|
-
this.cached.set(namespace, logger);
|
|
190
|
-
}
|
|
191
|
-
logger(fields, ...args);
|
|
192
|
-
} catch (e) {
|
|
193
|
-
console.error(e);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
exports$1.DebugLogBackendBase = DebugLogBackendBase;
|
|
198
|
-
class NodeBackend extends DebugLogBackendBase {
|
|
199
|
-
constructor() {
|
|
200
|
-
super(...arguments);
|
|
201
|
-
this.enabledRegexp = /.*/g;
|
|
202
|
-
}
|
|
203
|
-
isEnabled(namespace) {
|
|
204
|
-
return this.enabledRegexp.test(namespace);
|
|
205
|
-
}
|
|
206
|
-
makeLogger(namespace) {
|
|
207
|
-
if (!this.enabledRegexp.test(namespace)) {
|
|
208
|
-
return () => {
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
return (fields, ...args) => {
|
|
212
|
-
var _a;
|
|
213
|
-
const nscolour = `${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`;
|
|
214
|
-
const pid = `${colours_1.Colours.yellow}${process2.pid}${colours_1.Colours.reset}`;
|
|
215
|
-
let level;
|
|
216
|
-
switch (fields.severity) {
|
|
217
|
-
case LogSeverity.ERROR:
|
|
218
|
-
level = `${colours_1.Colours.red}${fields.severity}${colours_1.Colours.reset}`;
|
|
219
|
-
break;
|
|
220
|
-
case LogSeverity.INFO:
|
|
221
|
-
level = `${colours_1.Colours.magenta}${fields.severity}${colours_1.Colours.reset}`;
|
|
222
|
-
break;
|
|
223
|
-
case LogSeverity.WARNING:
|
|
224
|
-
level = `${colours_1.Colours.yellow}${fields.severity}${colours_1.Colours.reset}`;
|
|
225
|
-
break;
|
|
226
|
-
default:
|
|
227
|
-
level = (_a = fields.severity) !== null && _a !== void 0 ? _a : LogSeverity.DEFAULT;
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
const msg = util.formatWithOptions({ colors: colours_1.Colours.enabled }, ...args);
|
|
231
|
-
const filteredFields = Object.assign({}, fields);
|
|
232
|
-
delete filteredFields.severity;
|
|
233
|
-
const fieldsJson = Object.getOwnPropertyNames(filteredFields).length ? JSON.stringify(filteredFields) : "";
|
|
234
|
-
const fieldsColour = fieldsJson ? `${colours_1.Colours.grey}${fieldsJson}${colours_1.Colours.reset}` : "";
|
|
235
|
-
console.error("%s [%s|%s] %s%s", pid, nscolour, level, msg, fieldsJson ? ` ${fieldsColour}` : "");
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
// Regexp patterns below are from here:
|
|
239
|
-
// https://github.com/nodejs/node/blob/c0aebed4b3395bd65d54b18d1fd00f071002ac20/lib/internal/util/debuglog.js#L36
|
|
240
|
-
setFilters() {
|
|
241
|
-
const totalFilters = this.filters.join(",");
|
|
242
|
-
const regexp = totalFilters.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^");
|
|
243
|
-
this.enabledRegexp = new RegExp(`^${regexp}$`, "i");
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function getNodeBackend() {
|
|
247
|
-
return new NodeBackend();
|
|
248
|
-
}
|
|
249
|
-
class DebugBackend extends DebugLogBackendBase {
|
|
250
|
-
constructor(pkg) {
|
|
251
|
-
super();
|
|
252
|
-
this.debugPkg = pkg;
|
|
253
|
-
}
|
|
254
|
-
makeLogger(namespace) {
|
|
255
|
-
const debugLogger = this.debugPkg(namespace);
|
|
256
|
-
return (fields, ...args) => {
|
|
257
|
-
debugLogger(args[0], ...args.slice(1));
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
setFilters() {
|
|
261
|
-
var _a;
|
|
262
|
-
const existingFilters = (_a = process2.env["NODE_DEBUG"]) !== null && _a !== void 0 ? _a : "";
|
|
263
|
-
process2.env["NODE_DEBUG"] = `${existingFilters}${existingFilters ? "," : ""}${this.filters.join(",")}`;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function getDebugBackend(debugPkg) {
|
|
267
|
-
return new DebugBackend(debugPkg);
|
|
268
|
-
}
|
|
269
|
-
class StructuredBackend extends DebugLogBackendBase {
|
|
270
|
-
constructor(upstream) {
|
|
271
|
-
var _a;
|
|
272
|
-
super();
|
|
273
|
-
this.upstream = (_a = upstream) !== null && _a !== void 0 ? _a : void 0;
|
|
274
|
-
}
|
|
275
|
-
makeLogger(namespace) {
|
|
276
|
-
var _a;
|
|
277
|
-
const debugLogger = (_a = this.upstream) === null || _a === void 0 ? void 0 : _a.makeLogger(namespace);
|
|
278
|
-
return (fields, ...args) => {
|
|
279
|
-
var _a2;
|
|
280
|
-
const severity = (_a2 = fields.severity) !== null && _a2 !== void 0 ? _a2 : LogSeverity.INFO;
|
|
281
|
-
const json = Object.assign({
|
|
282
|
-
severity,
|
|
283
|
-
message: util.format(...args)
|
|
284
|
-
}, fields);
|
|
285
|
-
const jsonString = JSON.stringify(json);
|
|
286
|
-
if (debugLogger) {
|
|
287
|
-
debugLogger(fields, jsonString);
|
|
288
|
-
} else {
|
|
289
|
-
console.log("%s", jsonString);
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
setFilters() {
|
|
294
|
-
var _a;
|
|
295
|
-
(_a = this.upstream) === null || _a === void 0 ? void 0 : _a.setFilters();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
function getStructuredBackend(upstream) {
|
|
299
|
-
return new StructuredBackend(upstream);
|
|
300
|
-
}
|
|
301
|
-
exports$1.env = {
|
|
302
|
-
/**
|
|
303
|
-
* Filter wildcards specific to the Node syntax, and similar to the built-in
|
|
304
|
-
* utils.debuglog() environment variable. If missing, disables logging.
|
|
305
|
-
*/
|
|
306
|
-
nodeEnables: "GOOGLE_SDK_NODE_LOGGING"
|
|
307
|
-
};
|
|
308
|
-
const loggerCache = /* @__PURE__ */ new Map();
|
|
309
|
-
let cachedBackend = void 0;
|
|
310
|
-
function setBackend(backend) {
|
|
311
|
-
cachedBackend = backend;
|
|
312
|
-
loggerCache.clear();
|
|
313
|
-
}
|
|
314
|
-
function log(namespace, parent) {
|
|
315
|
-
if (!cachedBackend) {
|
|
316
|
-
const enablesFlag = process2.env[exports$1.env.nodeEnables];
|
|
317
|
-
if (!enablesFlag) {
|
|
318
|
-
return exports$1.placeholder;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
if (!namespace) {
|
|
322
|
-
return exports$1.placeholder;
|
|
323
|
-
}
|
|
324
|
-
if (parent) {
|
|
325
|
-
namespace = `${parent.instance.namespace}:${namespace}`;
|
|
326
|
-
}
|
|
327
|
-
const existing = loggerCache.get(namespace);
|
|
328
|
-
if (existing) {
|
|
329
|
-
return existing.func;
|
|
330
|
-
}
|
|
331
|
-
if (cachedBackend === null) {
|
|
332
|
-
return exports$1.placeholder;
|
|
333
|
-
} else if (cachedBackend === void 0) {
|
|
334
|
-
cachedBackend = getNodeBackend();
|
|
335
|
-
}
|
|
336
|
-
const logger = (() => {
|
|
337
|
-
let previousBackend = void 0;
|
|
338
|
-
const newLogger = new AdhocDebugLogger(namespace, (fields, ...args) => {
|
|
339
|
-
if (previousBackend !== cachedBackend) {
|
|
340
|
-
if (cachedBackend === null) {
|
|
341
|
-
return;
|
|
342
|
-
} else if (cachedBackend === void 0) {
|
|
343
|
-
cachedBackend = getNodeBackend();
|
|
344
|
-
}
|
|
345
|
-
previousBackend = cachedBackend;
|
|
346
|
-
}
|
|
347
|
-
cachedBackend === null || cachedBackend === void 0 ? void 0 : cachedBackend.log(namespace, fields, ...args);
|
|
348
|
-
});
|
|
349
|
-
return newLogger;
|
|
350
|
-
})();
|
|
351
|
-
loggerCache.set(namespace, logger);
|
|
352
|
-
return logger.func;
|
|
353
|
-
}
|
|
354
|
-
})(loggingUtils);
|
|
355
|
-
return loggingUtils;
|
|
356
|
-
}
|
|
357
|
-
var hasRequiredSrc;
|
|
358
|
-
function requireSrc() {
|
|
359
|
-
if (hasRequiredSrc) return src;
|
|
360
|
-
hasRequiredSrc = 1;
|
|
361
|
-
(function(exports$1) {
|
|
362
|
-
var __createBinding = src && src.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
363
|
-
if (k2 === void 0) k2 = k;
|
|
364
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
365
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
366
|
-
desc = { enumerable: true, get: function() {
|
|
367
|
-
return m[k];
|
|
368
|
-
} };
|
|
369
|
-
}
|
|
370
|
-
Object.defineProperty(o, k2, desc);
|
|
371
|
-
}) : (function(o, m, k, k2) {
|
|
372
|
-
if (k2 === void 0) k2 = k;
|
|
373
|
-
o[k2] = m[k];
|
|
374
|
-
}));
|
|
375
|
-
var __exportStar = src && src.__exportStar || function(m, exports$12) {
|
|
376
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
|
|
377
|
-
};
|
|
378
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
379
|
-
__exportStar(requireLoggingUtils(), exports$1);
|
|
380
|
-
})(src);
|
|
381
|
-
return src;
|
|
382
|
-
}
|
|
383
|
-
export {
|
|
384
|
-
requireSrc as r
|
|
385
|
-
};
|
|
1
|
+
import M from"process";import q from"events";import T from"util";var y={},h={},p={},L;function W(){if(L)return p;L=1,Object.defineProperty(p,"__esModule",{value:!0}),p.Colours=void 0;class e{static isEnabled(b){return b&&b.isTTY&&(typeof b.getColorDepth=="function"?b.getColorDepth()>2:!0)}static refresh(){e.enabled=e.isEnabled(process==null?void 0:process.stderr),this.enabled?(e.reset="\x1B[0m",e.bright="\x1B[1m",e.dim="\x1B[2m",e.red="\x1B[31m",e.green="\x1B[32m",e.yellow="\x1B[33m",e.blue="\x1B[34m",e.magenta="\x1B[35m",e.cyan="\x1B[36m",e.white="\x1B[37m",e.grey="\x1B[90m"):(e.reset="",e.bright="",e.dim="",e.red="",e.green="",e.yellow="",e.blue="",e.magenta="",e.cyan="",e.white="",e.grey="")}}return p.Colours=e,e.enabled=!1,e.reset="",e.bright="",e.dim="",e.red="",e.green="",e.yellow="",e.blue="",e.magenta="",e.cyan="",e.white="",e.grey="",e.refresh(),p}var F;function J(){return F||(F=1,(function(e){var B=h&&h.__createBinding||(Object.create?(function(s,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(s,n,i)}):(function(s,t,r,n){n===void 0&&(n=r),s[n]=t[r]})),b=h&&h.__setModuleDefault||(Object.create?(function(s,t){Object.defineProperty(s,"default",{enumerable:!0,value:t})}):function(s,t){s.default=t}),d=h&&h.__importStar||(function(){var s=function(t){return s=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},s(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=s(t),i=0;i<n.length;i++)n[i]!=="default"&&B(r,t,n[i]);return b(r,t),r}})();Object.defineProperty(e,"__esModule",{value:!0}),e.env=e.DebugLogBackendBase=e.placeholder=e.AdhocDebugLogger=e.LogSeverity=void 0,e.getNodeBackend=E,e.getDebugBackend=P,e.getStructuredBackend=U,e.setBackend=A,e.log=_;const l=q,c=d(M),g=d(T),u=W();var a;(function(s){s.DEFAULT="DEFAULT",s.DEBUG="DEBUG",s.INFO="INFO",s.WARNING="WARNING",s.ERROR="ERROR"})(a||(e.LogSeverity=a={}));class D extends l.EventEmitter{constructor(t,r){super(),this.namespace=t,this.upstream=r,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:(n,i)=>this.on(n,i)}),this.func.debug=(...n)=>this.invokeSeverity(a.DEBUG,...n),this.func.info=(...n)=>this.invokeSeverity(a.INFO,...n),this.func.warn=(...n)=>this.invokeSeverity(a.WARNING,...n),this.func.error=(...n)=>this.invokeSeverity(a.ERROR,...n),this.func.sublog=n=>_(n,this.func)}invoke(t,...r){if(this.upstream)try{this.upstream(t,...r)}catch{}try{this.emit("log",t,r)}catch{}}invokeSeverity(t,...r){this.invoke({severity:t},...r)}}e.AdhocDebugLogger=D,e.placeholder=new D("",()=>{}).func;class w{constructor(){var t;this.cached=new Map,this.filters=[],this.filtersSet=!1;let r=(t=c.env[e.env.nodeEnables])!==null&&t!==void 0?t:"*";r==="all"&&(r="*"),this.filters=r.split(",")}log(t,r,...n){try{this.filtersSet||(this.setFilters(),this.filtersSet=!0);let i=this.cached.get(t);i||(i=this.makeLogger(t),this.cached.set(t,i)),i(r,...n)}catch(i){console.error(i)}}}e.DebugLogBackendBase=w;class k extends w{constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(t){return this.enabledRegexp.test(t)}makeLogger(t){return this.enabledRegexp.test(t)?(r,...n)=>{var i;const m=`${u.Colours.green}${t}${u.Colours.reset}`,v=`${u.Colours.yellow}${c.pid}${u.Colours.reset}`;let f;switch(r.severity){case a.ERROR:f=`${u.Colours.red}${r.severity}${u.Colours.reset}`;break;case a.INFO:f=`${u.Colours.magenta}${r.severity}${u.Colours.reset}`;break;case a.WARNING:f=`${u.Colours.yellow}${r.severity}${u.Colours.reset}`;break;default:f=(i=r.severity)!==null&&i!==void 0?i:a.DEFAULT;break}const R=g.formatWithOptions({colors:u.Colours.enabled},...n),O=Object.assign({},r);delete O.severity;const j=Object.getOwnPropertyNames(O).length?JSON.stringify(O):"",I=j?`${u.Colours.grey}${j}${u.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",v,m,f,R,j?` ${I}`:"")}:()=>{}}setFilters(){const r=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${r}$`,"i")}}function E(){return new k}class G extends w{constructor(t){super(),this.debugPkg=t}makeLogger(t){const r=this.debugPkg(t);return(n,...i)=>{r(i[0],...i.slice(1))}}setFilters(){var t;const r=(t=c.env.NODE_DEBUG)!==null&&t!==void 0?t:"";c.env.NODE_DEBUG=`${r}${r?",":""}${this.filters.join(",")}`}}function P(s){return new G(s)}class $ extends w{constructor(t){var r;super(),this.upstream=(r=t)!==null&&r!==void 0?r:void 0}makeLogger(t){var r;const n=(r=this.upstream)===null||r===void 0?void 0:r.makeLogger(t);return(i,...m)=>{var v;const f=(v=i.severity)!==null&&v!==void 0?v:a.INFO,R=Object.assign({severity:f,message:g.format(...m)},i),O=JSON.stringify(R);n?n(i,O):console.log("%s",O)}}setFilters(){var t;(t=this.upstream)===null||t===void 0||t.setFilters()}}function U(s){return new $(s)}e.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};const N=new Map;let o;function A(s){o=s,N.clear()}function _(s,t){if(!o&&!c.env[e.env.nodeEnables]||!s)return e.placeholder;t&&(s=`${t.instance.namespace}:${s}`);const r=N.get(s);if(r)return r.func;if(o===null)return e.placeholder;o===void 0&&(o=E());const n=(()=>{let i;return new D(s,(v,...f)=>{if(i!==o){if(o===null)return;o===void 0&&(o=E()),i=o}o?.log(s,v,...f)})})();return N.set(s,n),n.func}})(h)),h}var S;function H(){return S||(S=1,(function(e){var B=y&&y.__createBinding||(Object.create?(function(d,l,c,g){g===void 0&&(g=c);var u=Object.getOwnPropertyDescriptor(l,c);(!u||("get"in u?!l.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return l[c]}}),Object.defineProperty(d,g,u)}):(function(d,l,c,g){g===void 0&&(g=c),d[g]=l[c]})),b=y&&y.__exportStar||function(d,l){for(var c in d)c!=="default"&&!Object.prototype.hasOwnProperty.call(l,c)&&B(l,d,c)};Object.defineProperty(e,"__esModule",{value:!0}),b(J(),e)})(y)),y}export{H as r};
|