@agimon-ai/po-log 0.0.0-alpha.111 → 0.0.0-alpha.112
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/extensions/server.cjs +50 -50
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +51 -51
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/{metricsSource-BaoBR_Ia.mjs → metricsSource-BLAhNGEt.mjs} +34 -42
- package/dist/metricsSource-BLAhNGEt.mjs.map +1 -0
- package/dist/{metricsSource-Cy8f47Q0.cjs → metricsSource-BbcKbQJq.cjs} +39 -41
- package/dist/metricsSource-BbcKbQJq.cjs.map +1 -0
- package/dist/{metricsSource-DNT8BrTF.d.mts → metricsSource-sO8OpIes.d.mts} +14 -3
- package/dist/metricsSource-sO8OpIes.d.mts.map +1 -0
- package/dist/metricsSource.cjs +1 -1
- package/dist/metricsSource.d.mts +1 -13
- package/dist/metricsSource.d.mts.map +1 -1
- package/dist/metricsSource.mjs +1 -1
- package/package.json +9 -9
- package/dist/metricsSource-BaoBR_Ia.mjs.map +0 -1
- package/dist/metricsSource-Cy8f47Q0.cjs.map +0 -1
- package/dist/metricsSource-DNT8BrTF.d.mts.map +0 -1
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
|
-
const require_metricsSource = require("../metricsSource-
|
|
27
|
+
const require_metricsSource = require("../metricsSource-BbcKbQJq.cjs");
|
|
28
28
|
let _agimon_ai_po_logsink = require("@agimon-ai/po-logsink");
|
|
29
29
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
30
30
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
@@ -264,6 +264,7 @@ function createLogsinkNamespace(operations) {
|
|
|
264
264
|
name: "logsink",
|
|
265
265
|
summary: "Read captured log issues, metrics, traces and search results. Defaults to this session; explicit bounded history supports workflow analysis. Read-only, never manages the collector.",
|
|
266
266
|
declarations: DECLARATIONS,
|
|
267
|
+
portable: true,
|
|
267
268
|
bind(run) {
|
|
268
269
|
if (run.sessionId !== operations.sessionId) throw new Error("Log Sink namespace belongs to another session.");
|
|
269
270
|
let disposed = false;
|
|
@@ -823,51 +824,7 @@ const createLogServerRoot = ({ context, agent, host, signal: ownerSignal }) => {
|
|
|
823
824
|
//#region src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
824
825
|
var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(createLogServerRoot);
|
|
825
826
|
//#endregion
|
|
826
|
-
//#region src/services/issuesSource/
|
|
827
|
-
/**
|
|
828
|
-
* Agent-issue analysis over the sink's CLI.
|
|
829
|
-
*
|
|
830
|
-
* One transport, not two, because the daemon serves only /api/metrics and
|
|
831
|
-
* /api/logs: there is no issues route to prefer. Every call is a subprocess,
|
|
832
|
-
* which is why the page asks for this only when a reader opens the section
|
|
833
|
-
* rather than alongside each report.
|
|
834
|
-
*/
|
|
835
|
-
const PACKAGE_NAME = "@agimon-ai/po-logsink";
|
|
836
|
-
const CLI_TIMEOUT_MS = 6e4;
|
|
837
|
-
/** The analysis scans the whole window, so its output is larger than a metrics report. */
|
|
838
|
-
const MAX_CLI_BUFFER = 33554432;
|
|
839
|
-
function cliEntryPoint() {
|
|
840
|
-
const packageJson = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve(`${PACKAGE_NAME}/package.json`);
|
|
841
|
-
return node_path.default.join(node_path.default.dirname(packageJson), "dist", "cli.mjs");
|
|
842
|
-
}
|
|
843
|
-
function runCli(params, dbPath) {
|
|
844
|
-
return new Promise((resolve, reject) => {
|
|
845
|
-
(0, node_child_process.execFile)(process.execPath, [
|
|
846
|
-
cliEntryPoint(),
|
|
847
|
-
"logs",
|
|
848
|
-
"agent-issues",
|
|
849
|
-
"--limit",
|
|
850
|
-
String(params.limit),
|
|
851
|
-
...params.sessionId === void 0 ? [] : ["--session-id", params.sessionId],
|
|
852
|
-
...params.startTime === void 0 ? [] : ["--start-time", params.startTime],
|
|
853
|
-
...params.endTime === void 0 ? [] : ["--end-time", params.endTime],
|
|
854
|
-
...dbPath === void 0 ? [] : ["--db-path", dbPath]
|
|
855
|
-
], {
|
|
856
|
-
timeout: CLI_TIMEOUT_MS,
|
|
857
|
-
maxBuffer: MAX_CLI_BUFFER
|
|
858
|
-
}, (error, stdout, stderr) => {
|
|
859
|
-
if (error) {
|
|
860
|
-
reject(new Error(stderr.trim() || error.message));
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
try {
|
|
864
|
-
resolve(JSON.parse(stdout));
|
|
865
|
-
} catch {
|
|
866
|
-
reject(/* @__PURE__ */ new Error("The log sink returned output this version cannot read."));
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
}
|
|
827
|
+
//#region src/services/issuesSource/report.ts
|
|
871
828
|
function isRecord(value) {
|
|
872
829
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
873
830
|
}
|
|
@@ -916,6 +873,52 @@ function toReport$1(raw) {
|
|
|
916
873
|
samples
|
|
917
874
|
};
|
|
918
875
|
}
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/services/issuesSource/index.ts
|
|
878
|
+
/**
|
|
879
|
+
* Agent-issue analysis over the sink's CLI.
|
|
880
|
+
*
|
|
881
|
+
* One transport, not two, because the daemon serves only /api/metrics and
|
|
882
|
+
* /api/logs: there is no issues route to prefer. Every call is a subprocess,
|
|
883
|
+
* which is why the page asks for this only when a reader opens the section
|
|
884
|
+
* rather than alongside each report.
|
|
885
|
+
*/
|
|
886
|
+
const PACKAGE_NAME = "@agimon-ai/po-logsink";
|
|
887
|
+
const CLI_TIMEOUT_MS = 6e4;
|
|
888
|
+
/** The analysis scans the whole window, so its output is larger than a metrics report. */
|
|
889
|
+
const MAX_CLI_BUFFER = 33554432;
|
|
890
|
+
function cliEntryPoint() {
|
|
891
|
+
const packageJson = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve(`${PACKAGE_NAME}/package.json`);
|
|
892
|
+
return node_path.default.join(node_path.default.dirname(packageJson), "dist", "cli.mjs");
|
|
893
|
+
}
|
|
894
|
+
function runCli(params, dbPath) {
|
|
895
|
+
return new Promise((resolve, reject) => {
|
|
896
|
+
(0, node_child_process.execFile)(process.execPath, [
|
|
897
|
+
cliEntryPoint(),
|
|
898
|
+
"logs",
|
|
899
|
+
"agent-issues",
|
|
900
|
+
"--limit",
|
|
901
|
+
String(params.limit),
|
|
902
|
+
...params.sessionId === void 0 ? [] : ["--session-id", params.sessionId],
|
|
903
|
+
...params.startTime === void 0 ? [] : ["--start-time", params.startTime],
|
|
904
|
+
...params.endTime === void 0 ? [] : ["--end-time", params.endTime],
|
|
905
|
+
...dbPath === void 0 ? [] : ["--db-path", dbPath]
|
|
906
|
+
], {
|
|
907
|
+
timeout: CLI_TIMEOUT_MS,
|
|
908
|
+
maxBuffer: MAX_CLI_BUFFER
|
|
909
|
+
}, (error, stdout, stderr) => {
|
|
910
|
+
if (error) {
|
|
911
|
+
reject(new Error(stderr.trim() || error.message));
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
try {
|
|
915
|
+
resolve(JSON.parse(stdout));
|
|
916
|
+
} catch {
|
|
917
|
+
reject(/* @__PURE__ */ new Error("The log sink returned output this version cannot read."));
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
});
|
|
921
|
+
}
|
|
919
922
|
function createIssuesSource(options = {}) {
|
|
920
923
|
const instance = (0, _agimon_ai_po_logsink.resolveLogSinkInstance)({
|
|
921
924
|
env: options.env,
|
|
@@ -1142,10 +1145,7 @@ function createLogHubApi(options = {}) {
|
|
|
1142
1145
|
const source = options.source ?? require_metricsSource.createMetricsSource(identity);
|
|
1143
1146
|
const issues = options.issues ?? createIssuesSource(identity);
|
|
1144
1147
|
const fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
1145
|
-
const sinkEndpoint = options.sinkEndpoint ?? (
|
|
1146
|
-
...identity,
|
|
1147
|
-
healthCheck: true
|
|
1148
|
-
}))?.endpoint);
|
|
1148
|
+
const sinkEndpoint = options.sinkEndpoint ?? (() => require_metricsSource.resolveMetricsEndpoint(identity));
|
|
1149
1149
|
app.get(apiRoutes_default.metrics.path, async (context) => {
|
|
1150
1150
|
const requestedDimension = context.req.query(METRICS_QUERY_PARAMS.dimension) ?? DEFAULT_DIMENSION;
|
|
1151
1151
|
const requestedPeriod = context.req.query(METRICS_QUERY_PARAMS.period) ?? DEFAULT_PERIOD;
|