@agimon-ai/po-cloudflare 0.0.2-alpha.13 → 0.0.2-alpha.14
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/{agent-DYFqCLl2.js → agent-DTjnYFAN.js} +1 -1
- package/dist/{apiContracts-CDJ9sPkE.js → apiContracts-DepyzMNr.js} +80 -80
- package/dist/{approval-BSX-MRTE.js → approval-Biq3NCWj.js} +2 -2
- package/dist/{approvalPrompt-1FPgNwMA.js → approvalPrompt-DoHlIPkU.js} +2 -2
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/{atomicJson-BF1fVXy1.js → atomicJson-DCIsEywH.js} +3 -3
- package/dist/{backgroundWork-BaczP3Z1.js → backgroundWork-Bswjs1av.js} +1 -1
- package/dist/{codemode-CZ_eYTwm.js → codemode-CgVosRtU.js} +1 -1
- package/dist/{contracts-CnRs-Twx.js → contracts-CylyLZC8.js} +1 -1
- package/dist/{domains-Bl6T2dKV.js → domains-BqChtBLN.js} +23 -5
- package/dist/{exports-DlcCEAe3.js → exports-DERO0cQf.js} +760 -147
- package/dist/{exports-CxkWsXI9.js → exports-DX8LJfSj.js} +9 -9
- package/dist/{extensionFile-D7wk8tFr.js → extensionFile-Ds7RCpnb.js} +1 -1
- package/dist/{harnessStore-flLz1I0F.js → harnessStore-BectazJQ.js} +4 -4
- package/dist/harnessStore-C0Zwvny8.js +1 -0
- package/dist/{help-DjybmnPW.js → help-Dpm82qDr.js} +2 -2
- package/dist/{hubChannel-Bi3PQrfD.js → hubChannel-COvmdWGO.js} +4 -2
- package/dist/{index.edge-CJ2TFpgF.js → index.edge-B0D_Lgbx.js} +2 -2
- package/dist/{index.edge-C9_xuXyy.js → index.edge-BLmsRNW8.js} +2 -2
- package/dist/{layeredConfig-B4s0eZ5o.js → layeredConfig-pQGjhAks.js} +92 -6
- package/dist/{majorModes-IygGmbb8.js → majorModes-BrL4EtzH.js} +5 -14
- package/dist/majorModes-WXt22_km.js +1 -0
- package/dist/{mcpProjection-BA6baFpi.js → mcpProjection-pbPBBuvs.js} +2 -2
- package/dist/{notification-bGq1frYG.js → notification-CINsJWDL.js} +7 -4
- package/dist/{piConfig-CcoMX-1L.js → piConfig-BDUpA6w0.js} +5 -5
- package/dist/piSettings-tdui0CZI.js +1 -0
- package/dist/{platform-CyvF7X-b.js → platform-yhQXrrM_.js} +1 -1
- package/dist/{platformFiles-Ccj9HCvA.js → platformFiles-DB3Cw1l_.js} +1 -1
- package/dist/{protocol-Q7TFrOIs.js → protocol-B6LbEIe6.js} +2 -2
- package/dist/{server-4CmqIbH2.js → server-2o-hl3o0.js} +55 -14
- package/dist/{server-DSu_uLDX.js → server-B-br6deK.js} +6 -6
- package/dist/{server-C9gff7gU.js → server-B2G-c0hg.js} +5 -5
- package/dist/{server-CIhwIcbA.js → server-B3RgnYiZ.js} +13 -4
- package/dist/{server-C8HyW7wN.js → server-BBNCtQtl.js} +7 -7
- package/dist/{server-C_34VM3M.js → server-BmIU37Ei.js} +3 -3
- package/dist/{server-ClsNJwdv.js → server-Bqm5R8kV.js} +13 -13
- package/dist/{server-Co57A8MH.js → server-Bt6Zsqo8.js} +2 -2
- package/dist/{server-il_s2Ycz.js → server-BvYolSs9.js} +339 -43
- package/dist/{server-CpJNq249.js → server-C1x2LoKK.js} +10 -10
- package/dist/{server-CjsKNdSN.js → server-CCwwnpH0.js} +5 -5
- package/dist/{server-CxGGQFJs.js → server-CRPxNGv6.js} +6 -6
- package/dist/{server-COE7BKSa.js → server-Ci_BGVwd.js} +3 -3
- package/dist/{server-CTSvwoDy.js → server-CyYesT-G.js} +9 -9
- package/dist/{server-ziNfBZ2M.js → server-CzJjYgVk.js} +3 -3
- package/dist/{server-C_3jK2WM.js → server-D9qM5XCP.js} +23 -11
- package/dist/{server-C82Qzoh3.js → server-DE3Gzgfb.js} +10 -10
- package/dist/{server-CMaTba5B.js → server-DL6UyXfJ.js} +8 -8
- package/dist/{server-5vLvBTTs.js → server-DPTp6GXS.js} +4 -4
- package/dist/{server-CcNMwEFQ.js → server-Dgn4el5K.js} +5 -5
- package/dist/{server-CQXqMpeC.js → server-DuDp9MhD.js} +116 -54
- package/dist/{server-DeSuziRK.js → server-OerXqXJT.js} +4 -4
- package/dist/{server-ZsazKk-n.js → server-V8W5mcGu.js} +6 -6
- package/dist/{server-Bm6pAAw8.js → server-_0288DYR.js} +4 -4
- package/dist/{server-BHhb0oir.js → server-cStfn1Yv.js} +4 -4
- package/dist/{serverPlugin-pCqlBqQG.js → serverPlugin-OOfjB8tm.js} +1114 -1111
- package/dist/{sessionConfig-DzAs6Pt-.js → sessionConfig-C-zJI72k.js} +242 -54
- package/dist/{validation-CkjZwpf-.js → validation-DuOGOKEi.js} +2 -2
- package/dist/{value-DGT5IoiK.js → value-DyVsxCwZ.js} +1 -1
- package/dist/{vaultSettings-BRr8n821.js → vaultSettings-BFCRCBM3.js} +1 -1
- package/dist/web-cN41ySs9.js +3 -0
- package/dist/worker.js +15822 -1103
- package/dist/workflow-BgwWq0nq.js +79 -0
- package/package.json +32 -32
- package/dist/contextProjection-DlB6wzhm.js +0 -209
- package/dist/harnessStore-Bap8lsAg.js +0 -1
- package/dist/majorModes-xpLK9HpD.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/web-Cfvbn9H1.js +0 -3
- package/dist/workflow-w5JPZXgc.js +0 -23
- /package/dist/assets/plugins/slots/{approval.8b3f37d9-CqQk6XG_.js → approval.293d9a00-CqQk6XG_.js} +0 -0
- /package/dist/assets/plugins/slots/{artifacts.47d00f81-D-vQ-7Iz.js → artifacts.24567664-D-vQ-7Iz.js} +0 -0
- /package/dist/assets/plugins/slots/{autocompact.9a92993d-B3KTYwW1.js → autocompact.dd97d013-B3KTYwW1.js} +0 -0
- /package/dist/assets/plugins/slots/{builtin-tools.939bbfff-CZRYQVIP.js → builtin-tools.36d7400b-CZRYQVIP.js} +0 -0
- /package/dist/assets/plugins/slots/{codemode.782e5bb1-Bzl_K_vt.js → codemode.8eaee717-Bzl_K_vt.js} +0 -0
- /package/dist/assets/plugins/slots/{domain.21790b66-CvnpuKCY.js → domain.5e95fc37-CvnpuKCY.js} +0 -0
- /package/dist/assets/plugins/slots/{edit.c7c85129-kaxIknZ-.js → edit.385c9aa9-kaxIknZ-.js} +0 -0
- /package/dist/assets/plugins/slots/{files.bbcef824-wuB8gcQA.js → files.daf34ed8-wuB8gcQA.js} +0 -0
- /package/dist/assets/plugins/slots/{grep.3dfd3214-3FnU8p-d.js → grep.02052cdc-3FnU8p-d.js} +0 -0
- /package/dist/assets/plugins/slots/{log.33bc7d38-C0PXQ0O1.js → log.a86eb6d0-C0PXQ0O1.js} +0 -0
- /package/dist/assets/plugins/slots/{mcp.59c68bcb-D0CkHnIw.js → mcp.974af249-D0CkHnIw.js} +0 -0
- /package/dist/assets/plugins/slots/{profile.ea55f5e1-BSY3iYfJ.js → profile.48851a1d-BSY3iYfJ.js} +0 -0
- /package/dist/assets/plugins/slots/{prompts.9957cc84-xdCkNkoA.js → prompts.723d7748-xdCkNkoA.js} +0 -0
- /package/dist/assets/plugins/slots/{read.30a617e7-qqaxVlEX.js → read.46bf6536-qqaxVlEX.js} +0 -0
- /package/dist/assets/plugins/slots/{runner.9f3559b0-DfO2Z9HG.js → runner.53e9bd76-DfO2Z9HG.js} +0 -0
- /package/dist/assets/plugins/slots/{skill.f506a5ea-CL_n-l4h.js → skill.086701a4-CL_n-l4h.js} +0 -0
- /package/dist/assets/plugins/slots/{vault.01657352-DbG3F_on.js → vault.ac9935c8-DbG3F_on.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import "./
|
|
1
|
+
import { $ as Boolean$1, $n as requirePoFs, B as String$1, Bn as BACKGROUND_CONTEXT, Jn as PO_SQLITE_SERVICE, Kn as PO_FS_SERVICE, R as Union, W as Null, X as Literal, Z as Integer, _ as composeServerProviderOverrides, ar as requirePoServerScope, at as Intersect, er as requirePoSqlite, ft as _Object_, mt as Optional, nr as PO_SERVER_SCOPE_SERVICE, pn as poHomeDirectory, rr as defineServiceContract, v as defineServerMethod, yt as _Array_ } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { m as jsonApiResponses, t as defineApiContract, x as definePoPluginMethod } from "./apiContracts-DepyzMNr.js";
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import "./piSettings-tdui0CZI.js";
|
|
5
|
+
import { n as Check } from "./value-DyVsxCwZ.js";
|
|
6
|
+
import { n as PO_APPROVAL_VOICE_EVENT, r as PoApprovalPromptSchema } from "./approvalPrompt-DoHlIPkU.js";
|
|
7
|
+
import { a as defineMethod, c as defineRoute, d as defineServerTool, n as composeRootInjects, p as defineServerPlugin, r as defineChannel, s as defineRoot, t as composeRootHooks } from "./extensionFile-Ds7RCpnb.js";
|
|
8
|
+
import { a as PO_APPROVAL_CONTRACT } from "./approval-Biq3NCWj.js";
|
|
8
9
|
import "./worker.js";
|
|
9
|
-
import "./piSettings-B6fsgIBA.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
//#region ../../foundations/po-approval/src/services/approvalRoot/type.ts
|
|
12
12
|
var ApprovalRequestError = class extends Error {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as defineRoute, i as defineHook, m as runCleanups, n as composeRootInjects, p as defineServerPlugin, s as defineRoot, t as composeRootHooks, u as defineServerCommand } from "./extensionFile-
|
|
3
|
-
import { t as PoProtocolError } from "./protocol-
|
|
4
|
-
import { a as MINOR_MODE_CATALOG_SOURCE, c as PO_MINOR_MODE_ENTRY_TYPE, n as validateMinorModeActionArguments, o as MINOR_MODE_ERROR_CODE, r as validateMinorModeDefinition, s as PO_MINOR_MODE_CATALOG_SERVICE, t as minorModeKey } from "./validation-
|
|
1
|
+
import { _ as composeServerProviderOverrides } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { c as defineRoute, i as defineHook, m as runCleanups, n as composeRootInjects, p as defineServerPlugin, s as defineRoot, t as composeRootHooks, u as defineServerCommand } from "./extensionFile-Ds7RCpnb.js";
|
|
3
|
+
import { t as PoProtocolError } from "./protocol-B6LbEIe6.js";
|
|
4
|
+
import { a as MINOR_MODE_CATALOG_SOURCE, c as PO_MINOR_MODE_ENTRY_TYPE, n as validateMinorModeActionArguments, o as MINOR_MODE_ERROR_CODE, r as validateMinorModeDefinition, s as PO_MINOR_MODE_CATALOG_SERVICE, t as minorModeKey } from "./validation-DuOGOKEi.js";
|
|
5
5
|
//#region ../../foundations/po-minor-mode/src/constants/command.ts
|
|
6
6
|
const MINOR_MODE_COMMAND_DESCRIPTION = "Toggle or drive minor modes";
|
|
7
7
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as readBoundedFile, t as FileTooLargeError } from "./platformFiles-
|
|
3
|
-
import
|
|
1
|
+
import { $n as requirePoFs, B as String, Bn as BACKGROUND_CONTEXT, Hn as withAbortSignal, Kn as PO_FS_SERVICE, Z as Integer, ft as _Object_, mt as Optional } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { r as readBoundedFile, t as FileTooLargeError } from "./platformFiles-DB3Cw1l_.js";
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import { t as readPiImageSettings } from "./piConfig-BDUpA6w0.js";
|
|
5
|
+
import { d as defineServerTool, p as defineServerPlugin } from "./extensionFile-Ds7RCpnb.js";
|
|
4
6
|
import { n as formatDimensionNote, r as resizeImage } from "./index.edge-COJJ_Dv2.js";
|
|
5
|
-
import "./platform-CyvF7X-b.js";
|
|
6
|
-
import { t as readPiImageSettings } from "./piConfig-CcoMX-1L.js";
|
|
7
7
|
import { a as decodeUtf8, c as formatFileHeader, i as computeFileTag, l as formatTaggedLine, o as displayPath, p as splitLines, r as resolveReadInputPath, t as isWritableFile } from "./index.edge-ClLTmPFz.js";
|
|
8
8
|
import { i as truncateLine, n as formatSize, r as truncateHead, t as DEFAULT_MAX_BYTES } from "./truncate-M3KbFyVj.js";
|
|
9
9
|
//#region ../../default/po-read/src/schemas/readTool.ts
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as Check } from "./value-
|
|
1
|
+
import { B as String$1, H as Number$1, M as Record, R as Union, X as Literal, Z as Integer, _ as composeServerProviderOverrides, ct as Unsafe, ft as _Object_, ir as readPoServerScope, mt as Optional, yt as _Array_ } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { n as Check } from "./value-DyVsxCwZ.js";
|
|
3
|
+
import { n as defineApiRoutes, t as apiResponse } from "./hubRevisions-58pU2dW5.js";
|
|
4
|
+
import "./web-cN41ySs9.js";
|
|
3
5
|
import { n as defineTool } from "./pluginContributions-Be9EnCAW.js";
|
|
4
|
-
import { c as defineRoute, f as defineTool$1, i as defineHook, n as composeRootInjects, o as defineResource, p as defineServerPlugin, s as defineRoot, t as composeRootHooks, u as defineServerCommand } from "./extensionFile-
|
|
6
|
+
import { c as defineRoute, f as defineTool$1, i as defineHook, n as composeRootInjects, o as defineResource, p as defineServerPlugin, s as defineRoot, t as composeRootHooks, u as defineServerCommand } from "./extensionFile-Ds7RCpnb.js";
|
|
5
7
|
import { n as readPackageResource, t as packageResourcePath } from "./index.edge-uSjRpm6Z.js";
|
|
6
8
|
import { r as sanitizeTelemetryAttributes } from "./telemetry-Csv1ZxAn.js";
|
|
7
9
|
import { o as readPoChildSessionHookRegistry } from "./childSession-Cf2-kH4O.js";
|
|
8
|
-
import {
|
|
10
|
+
import { c as readPoWorkflowContextService, i as PO_LOG_METRICS_CONTRACT, n as METRICS_ATTRIBUTE, t as queryHttp } from "./workflow-BgwWq0nq.js";
|
|
9
11
|
import { A as string, I as toJSONSchema, S as literal, T as object, c as _enum, f as array, j as union, w as number } from "./schemas-Vj8-rCR4.js";
|
|
10
12
|
import { n as datetime } from "./iso-BPQViXM8.js";
|
|
11
13
|
import { t as createPoTelemetry } from "./index.edge-ChYa2LU4.js";
|
|
12
|
-
import {
|
|
13
|
-
import "./web-Cfvbn9H1.js";
|
|
14
|
-
import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-CZ_eYTwm.js";
|
|
14
|
+
import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-CgVosRtU.js";
|
|
15
15
|
import { t as Hono } from "./dist-B-vqs6tA.js";
|
|
16
|
-
import { t as PO_HELP_WHEN } from "./help-
|
|
16
|
+
import { t as PO_HELP_WHEN } from "./help-Dpm82qDr.js";
|
|
17
17
|
//#region ../../core/po-core/src/services/json/core.ts
|
|
18
18
|
function isRecord$1(value) {
|
|
19
19
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -476,6 +476,59 @@ function createLogsinkNamespace(operations) {
|
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
//#endregion
|
|
479
|
+
//#region ../../default/po-log/src/services/metricsForwarder/index.ts
|
|
480
|
+
const RECORD_FAILED = "Metrics could not be recorded.";
|
|
481
|
+
const METRICS_ENTRY_ATTRIBUTES = new Set(Object.values(METRICS_ATTRIBUTE));
|
|
482
|
+
/** Only the fixed, scalar attributes a metrics entry may carry leave the session. */
|
|
483
|
+
function fixedAttributes(attributes) {
|
|
484
|
+
const kept = {};
|
|
485
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
486
|
+
if (!METRICS_ENTRY_ATTRIBUTES.has(key)) continue;
|
|
487
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") kept[key] = value;
|
|
488
|
+
}
|
|
489
|
+
return kept;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Hands a session's sanitized telemetry records to the metrics service a host bound, in batches.
|
|
493
|
+
*
|
|
494
|
+
* A host that bound none, such as one that keeps the log sink, queues nothing. Records made in the same tick
|
|
495
|
+
* travel together, so a session pays one call for a turn rather than one per record.
|
|
496
|
+
*/
|
|
497
|
+
function createMetricsForwarder(options) {
|
|
498
|
+
const now = options.now ?? Date.now;
|
|
499
|
+
let waiting = [];
|
|
500
|
+
let scheduled = false;
|
|
501
|
+
const flush = async () => {
|
|
502
|
+
scheduled = false;
|
|
503
|
+
const batch = waiting;
|
|
504
|
+
waiting = [];
|
|
505
|
+
if (batch.length === 0) return;
|
|
506
|
+
const service = options.resolve();
|
|
507
|
+
if (service === void 0) return;
|
|
508
|
+
for (let start = 0; start < batch.length; start += 500) try {
|
|
509
|
+
await service.record(batch.slice(start, start + 500));
|
|
510
|
+
} catch {
|
|
511
|
+
options.onDiagnostic?.(RECORD_FAILED);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
return {
|
|
515
|
+
record(name, attributes) {
|
|
516
|
+
if (options.resolve() === void 0) return;
|
|
517
|
+
waiting.push({
|
|
518
|
+
at: now(),
|
|
519
|
+
event: name,
|
|
520
|
+
attributes: fixedAttributes(attributes)
|
|
521
|
+
});
|
|
522
|
+
if (scheduled) return;
|
|
523
|
+
scheduled = true;
|
|
524
|
+
queueMicrotask(() => {
|
|
525
|
+
flush().catch(() => options.onDiagnostic?.(RECORD_FAILED));
|
|
526
|
+
});
|
|
527
|
+
},
|
|
528
|
+
flush
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
479
532
|
//#region ../../default/po-log/src/services/telemetryEnabled/index.ts
|
|
480
533
|
function isEnabled(value) {
|
|
481
534
|
return value === "1" || value?.toLowerCase() === "true" || value?.toLowerCase() === "yes";
|
|
@@ -933,9 +986,14 @@ function createServerTelemetry(options = {}) {
|
|
|
933
986
|
//#endregion
|
|
934
987
|
//#region ../../default/po-log/src/extensions/workspaces/sessions/(backend)/_lib/serverRoot.ts
|
|
935
988
|
const createLogServerRoot = ({ context, agent, host, signal: ownerSignal }) => {
|
|
989
|
+
const metrics = createMetricsForwarder({
|
|
990
|
+
resolve: () => readPoServerScope(context)?.resolve(PO_LOG_METRICS_CONTRACT),
|
|
991
|
+
onDiagnostic: (message) => host.context.onNotice(message)
|
|
992
|
+
});
|
|
936
993
|
const runtime = createServerTelemetry({
|
|
937
994
|
workflowContext: readPoWorkflowContextService(context),
|
|
938
|
-
childSessionHookRegistry: readPoChildSessionHookRegistry(context)
|
|
995
|
+
childSessionHookRegistry: readPoChildSessionHookRegistry(context),
|
|
996
|
+
metrics
|
|
939
997
|
});
|
|
940
998
|
const sessionId = agent?.context.sessionId;
|
|
941
999
|
const logQueries = agent && sessionId ? createLogsinkOperations({
|
|
@@ -1031,31 +1089,6 @@ function createIssuesSource(options = {}) {
|
|
|
1031
1089
|
return toReport$1(await options.cliRunner(params));
|
|
1032
1090
|
} };
|
|
1033
1091
|
}
|
|
1034
|
-
const TOKEN_SORT = "total-tokens";
|
|
1035
|
-
/** HTTP is the common transport for local and remote collectors. */
|
|
1036
|
-
async function queryHttp(endpoint, params, fetchImpl) {
|
|
1037
|
-
const search = new URLSearchParams({
|
|
1038
|
-
groupBy: params.groupBy,
|
|
1039
|
-
period: params.period,
|
|
1040
|
-
sort: TOKEN_SORT,
|
|
1041
|
-
limit: String(params.limit),
|
|
1042
|
-
toolLimit: String(params.toolLimit ?? 1)
|
|
1043
|
-
});
|
|
1044
|
-
for (const key of [
|
|
1045
|
-
"sessionId",
|
|
1046
|
-
"agentName",
|
|
1047
|
-
"model",
|
|
1048
|
-
"provider"
|
|
1049
|
-
]) {
|
|
1050
|
-
const value = params.filter?.[key];
|
|
1051
|
-
if (value !== void 0 && value !== "") search.set(key, value);
|
|
1052
|
-
}
|
|
1053
|
-
const response = await fetchImpl(`${endpoint}/api/metrics?${search.toString()}`, { signal: AbortSignal.timeout(5e3) });
|
|
1054
|
-
if (!response.ok) throw new Error(`sink responded ${response.status}`);
|
|
1055
|
-
const body = await response.json();
|
|
1056
|
-
if (body.error || !Array.isArray(body.timeline)) throw new Error(body.error ?? "sink is an older version");
|
|
1057
|
-
return body;
|
|
1058
|
-
}
|
|
1059
1092
|
//#endregion
|
|
1060
1093
|
//#region ../../default/po-log/src/services/metricsSource/index.edge.ts
|
|
1061
1094
|
async function resolveMetricsEndpoint(options = {}) {
|
|
@@ -1285,6 +1318,25 @@ function toReport(report, source, dimension) {
|
|
|
1285
1318
|
function isEmpty(report) {
|
|
1286
1319
|
return report.totals.totalTokens === 0 && report.groups.length === 0 && report.tools.length === 0;
|
|
1287
1320
|
}
|
|
1321
|
+
/**
|
|
1322
|
+
* A bound store answers before any sink is looked for. It claims no transport: it is neither the sink's HTTP
|
|
1323
|
+
* API nor its worker. The store is looked up on every query, because a host binds it after this API starts.
|
|
1324
|
+
*/
|
|
1325
|
+
function preferBound(bound, sink) {
|
|
1326
|
+
let answeredByStore = false;
|
|
1327
|
+
return {
|
|
1328
|
+
async query(params) {
|
|
1329
|
+
const store = bound();
|
|
1330
|
+
answeredByStore = store !== void 0;
|
|
1331
|
+
return store === void 0 ? sink.query(params) : store.query(params);
|
|
1332
|
+
},
|
|
1333
|
+
lastTransport: () => answeredByStore ? void 0 : sink.lastTransport(),
|
|
1334
|
+
instance: () => sink.instance?.(),
|
|
1335
|
+
close: async () => {
|
|
1336
|
+
await sink.close?.();
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1288
1340
|
function createLogHubApi(options = {}) {
|
|
1289
1341
|
const app = new Hono();
|
|
1290
1342
|
const identity = {
|
|
@@ -1292,7 +1344,8 @@ function createLogHubApi(options = {}) {
|
|
|
1292
1344
|
serviceName: "pi",
|
|
1293
1345
|
...options.env === void 0 ? {} : { env: options.env }
|
|
1294
1346
|
};
|
|
1295
|
-
const
|
|
1347
|
+
const sink = options.source ?? createMetricsSource(identity);
|
|
1348
|
+
const source = options.metrics === void 0 ? sink : preferBound(options.metrics, sink);
|
|
1296
1349
|
const issues = options.issues ?? createIssuesSource(identity);
|
|
1297
1350
|
const fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
1298
1351
|
const sinkEndpoint = options.sinkEndpoint ?? (() => resolveMetricsEndpoint(identity));
|
|
@@ -1383,27 +1436,36 @@ function createLogHubApi(options = {}) {
|
|
|
1383
1436
|
});
|
|
1384
1437
|
return app;
|
|
1385
1438
|
}
|
|
1439
|
+
/**
|
|
1440
|
+
* The package's API for a host. `metrics` resolves the store the host bound, if any, so a host that keeps its
|
|
1441
|
+
* own metrics answers from them and every other host keeps answering from the log sink.
|
|
1442
|
+
*/
|
|
1443
|
+
function createLogApi(metrics) {
|
|
1444
|
+
return {
|
|
1445
|
+
basePath: "log",
|
|
1446
|
+
start(context) {
|
|
1447
|
+
const env = { ...context.environment };
|
|
1448
|
+
const source = createMetricsSource({
|
|
1449
|
+
env,
|
|
1450
|
+
packageName: PACKAGE_NAME,
|
|
1451
|
+
serviceName: "pi"
|
|
1452
|
+
});
|
|
1453
|
+
const app = createLogHubApi({
|
|
1454
|
+
source,
|
|
1455
|
+
env,
|
|
1456
|
+
...metrics === void 0 ? {} : { metrics }
|
|
1457
|
+
});
|
|
1458
|
+
return {
|
|
1459
|
+
fetch: (request) => app.fetch(request),
|
|
1460
|
+
close: () => source.close?.()
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1386
1465
|
//#endregion
|
|
1387
1466
|
//#region ../../default/po-log/src/extensions/(backend)/api/log/route.server.ts
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
start(context) {
|
|
1391
|
-
const env = { ...context.environment };
|
|
1392
|
-
const source = createMetricsSource({
|
|
1393
|
-
env,
|
|
1394
|
-
packageName: PACKAGE_NAME,
|
|
1395
|
-
serviceName: "pi"
|
|
1396
|
-
});
|
|
1397
|
-
const app = createLogHubApi({
|
|
1398
|
-
source,
|
|
1399
|
-
env
|
|
1400
|
-
});
|
|
1401
|
-
return {
|
|
1402
|
-
fetch: (request) => app.fetch(request),
|
|
1403
|
-
close: () => source.close?.()
|
|
1404
|
-
};
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1467
|
+
/** The store is resolved per request: a host that keeps its own metrics binds it after this API mounts. */
|
|
1468
|
+
var route_server_default = defineRoute(({ context }) => createLogApi(() => readPoServerScope(context)?.resolve(PO_LOG_METRICS_CONTRACT)));
|
|
1407
1469
|
//#endregion
|
|
1408
1470
|
//#region ../../default/po-log/src/extensions/workspaces/sessions/(backend)/command/log-metrics.server.ts
|
|
1409
1471
|
var log_metrics_server_default = defineServerCommand((context) => context.root.commands[0]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as readBoundedFile, t as FileTooLargeError } from "./platformFiles-
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
1
|
+
import { $ as Boolean, $n as requirePoFs, B as String$1, Bn as BACKGROUND_CONTEXT, Hn as withAbortSignal, Kn as PO_FS_SERVICE, Z as Integer, bn as getOrThrow, ft as _Object_, mt as Optional } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { r as readBoundedFile, t as FileTooLargeError } from "./platformFiles-DB3Cw1l_.js";
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import { d as defineServerTool, p as defineServerPlugin } from "./extensionFile-Ds7RCpnb.js";
|
|
5
5
|
import { a as decodeUtf8, c as formatFileHeader, i as computeFileTag, l as formatTaggedLine, n as resolveInputPath, o as displayPath, p as splitLines, t as isWritableFile } from "./index.edge-ClLTmPFz.js";
|
|
6
6
|
import { i as truncateLine, n as formatSize, r as truncateHead, t as DEFAULT_MAX_BYTES } from "./truncate-M3KbFyVj.js";
|
|
7
7
|
import { basename, posix, resolve } from "node:path";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as readTextIfExists, s as writeFileAtomic } from "./platformFiles-
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import "./harnessStore-
|
|
6
|
-
import { l as readMinorModeCatalog, s as PO_MINOR_MODE_CATALOG_SERVICE } from "./validation-
|
|
1
|
+
import { $n as requirePoFs, Bn as BACKGROUND_CONTEXT, _ as composeServerProviderOverrides, b as Service, bn as getOrThrow, gn as nodeHost, mn as createSerialRunner } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { i as readTextIfExists, s as writeFileAtomic } from "./platformFiles-DB3Cw1l_.js";
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import { i as defineHook, n as composeRootInjects, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-Ds7RCpnb.js";
|
|
5
|
+
import "./harnessStore-C0Zwvny8.js";
|
|
6
|
+
import { l as readMinorModeCatalog, s as PO_MINOR_MODE_CATALOG_SERVICE } from "./validation-DuOGOKEi.js";
|
|
7
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
//#region ../../foundations/po-config/src/services/harnessStore/sync.edge.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as readBoundedFile, t as FileTooLargeError } from "./platformFiles-
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
1
|
+
import { $n as requirePoFs, B as String$1, Bn as BACKGROUND_CONTEXT, Hn as withAbortSignal, Kn as PO_FS_SERVICE, R as Union, W as Null, bn as getOrThrow, ft as _Object_, mt as Optional, yt as _Array_ } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { r as readBoundedFile, t as FileTooLargeError } from "./platformFiles-DB3Cw1l_.js";
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import { d as defineServerTool, p as defineServerPlugin } from "./extensionFile-Ds7RCpnb.js";
|
|
5
5
|
import { a as decodeUtf8, d as normalizeToLf, i as computeFileTag, m as stripBom, n as resolveInputPath, o as displayPath, s as applyHashlineEdits, u as normalizeFileTag } from "./index.edge-ClLTmPFz.js";
|
|
6
6
|
import { posix } from "node:path";
|
|
7
7
|
//#region ../../default/po-edit/src/schemas/editTool.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as defineRoute, i as defineHook, n as composeRootInjects, p as defineServerPlugin, r as defineChannel, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
|
|
1
|
+
import { _ as composeServerProviderOverrides, b as Service } from "./serverPlugin-OOfjB8tm.js";
|
|
3
2
|
import { r as readPoFileAccess } from "./fileAccess-bFgmsyx0.js";
|
|
4
|
-
import "./platform-
|
|
5
|
-
import {
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import { c as defineRoute, i as defineHook, n as composeRootInjects, p as defineServerPlugin, r as defineChannel, s as defineRoot, t as composeRootHooks } from "./extensionFile-Ds7RCpnb.js";
|
|
5
|
+
import { a as readArtifactBytes, c as ArtifactAccessError, d as ARTIFACT_REFRESH_MS, i as openArtifact, l as artifactRoot, m as MAX_PREVIEW_BYTES, n as listArtifactSessions, p as MAX_CONTENT_BYTES, r as listArtifacts, t as ensureArtifactRoot, u as ARTIFACTS_SERVICE } from "./index.edge-BLmsRNW8.js";
|
|
6
6
|
import { t as Hono } from "./dist-B-vqs6tA.js";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { clearTimeout, setTimeout } from "node:timers";
|