@lunora/config 1.0.0-alpha.47 → 1.0.0-alpha.470
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/LICENSE.md +336 -104
- package/README.md +6 -6
- package/dist/celld/index.d.mts +77 -0
- package/dist/celld/index.d.ts +77 -0
- package/dist/celld/index.mjs +1 -0
- package/dist/celld-names/index.d.mts +57 -0
- package/dist/celld-names/index.d.ts +57 -0
- package/dist/celld-names/index.mjs +1 -0
- package/dist/cli/index.d.mts +2 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.mjs +1 -0
- package/dist/cloudflare/index.d.mts +941 -0
- package/dist/cloudflare/index.d.ts +941 -0
- package/dist/cloudflare/index.mjs +1 -0
- package/dist/index.d.mts +1045 -1044
- package/dist/index.d.ts +1045 -1044
- package/dist/index.mjs +1 -25
- package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
- package/dist/packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs +1 -0
- package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs +1 -0
- package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs +1 -0
- package/dist/packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs +1 -0
- package/dist/packem_shared/CELLD_RELEASE_ASSETS_DIRECTORY-YBhEotjs.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs +1 -0
- package/dist/packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs +1 -0
- package/dist/packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs +1 -0
- package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs +6 -0
- package/dist/packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs +1 -0
- package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs +9 -0
- package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
- package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
- package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
- package/dist/packem_shared/MissingBuildOutputError-BAyekzof.mjs +1 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-D66_hwjD.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
- package/dist/packem_shared/STUDIO_PATH-CvVcvTbQ.mjs +1 -0
- package/dist/packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-BF8PUjuo.mjs +1 -0
- package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
- package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-DEwPKcJg.mjs +6 -0
- package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
- package/dist/packem_shared/assertBuildTargetMatches-D11J7F38.mjs +1 -0
- package/dist/packem_shared/assertWranglerSatisfiesSchema-_70vhvqk.mjs +3 -0
- package/dist/packem_shared/asset-headers-CPuEX21i.mjs +4 -0
- package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
- package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.mts +593 -0
- package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.ts +593 -0
- package/dist/packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs +3 -0
- package/dist/packem_shared/blockingFindingsMessage-BQ9z7cie.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +19 -0
- package/dist/packem_shared/canonicalPath-DrfMiT3U.mjs +1 -0
- package/dist/packem_shared/celld-binding-id-9MiUoteo.mjs +1 -0
- package/dist/packem_shared/celld-config-Ef1RZ02t.mjs +3 -0
- package/dist/packem_shared/checkDevEnv-BwZSVBbB.mjs +3 -0
- package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
- package/dist/packem_shared/clearApiSpecMarker-DMGpP41V.mjs +2 -0
- package/dist/packem_shared/collectExportGaps-DHUtghqe.mjs +2 -0
- package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
- package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
- package/dist/packem_shared/createStudioDocumentCache-XBG1aWbl.mjs +1 -0
- package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.mts +190 -0
- package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.ts +190 -0
- package/dist/packem_shared/describePreservedCrons-i5XT6rtl.mjs +1 -0
- package/dist/packem_shared/describeWithheld-CbyzZjZF.mjs +1 -0
- package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
- package/dist/packem_shared/devTriggerHints-CN_RJxWW.mjs +1 -0
- package/dist/packem_shared/devVariablesStamp-BQkGEn9d.mjs +1 -0
- package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
- package/dist/packem_shared/emitProjectAssetHeaders-BdqdTVN3.mjs +1 -0
- package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
- package/dist/packem_shared/env-flag-u4B05gLp.mjs +1 -0
- package/dist/packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs +1 -0
- package/dist/packem_shared/index.d-BoUSSRrk.d.mts +270 -0
- package/dist/packem_shared/index.d-C1nVDcie.d.ts +270 -0
- package/dist/packem_shared/inferLunoraBindings-Biq1OW9V.mjs +1 -0
- package/dist/packem_shared/is-plain-object-CWxHeOY1.mjs +1 -0
- package/dist/packem_shared/isOwnedStudioAssets-CHII-uIX.mjs +1 -0
- package/dist/packem_shared/materializeServiceDevConfigs-CI1HXv7f.mjs +1 -0
- package/dist/packem_shared/mergeWranglerEnvironment-CxT2PV1N.mjs +1 -0
- package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
- package/dist/packem_shared/pendingBindingChanges-DqP40pSQ.mjs +1 -0
- package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.mts +338 -0
- package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.ts +338 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
- package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
- package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
- package/dist/packem_shared/queue-info-D38n7YdX.mjs +1 -0
- package/dist/packem_shared/readManifest-Cighz3WC.mjs +6 -0
- package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
- package/dist/packem_shared/reconcile-services-CjgIJKim.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerBindings-DAdI2Z-R.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-CRDTNivi.mjs +15 -0
- package/dist/packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs +1 -0
- package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
- package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
- package/dist/packem_shared/scanWranglerVariablesForSecrets-DmdOBmwn.mjs +1 -0
- package/dist/packem_shared/secret-key-xi4VK8Jw.mjs +1 -0
- package/dist/packem_shared/sendStudioAsset-B81Pex91.mjs +1 -0
- package/dist/packem_shared/serveJsonHandler-B8_GE6QC.mjs +1 -0
- package/dist/packem_shared/spa-assets-wX8rTPEQ.mjs +1 -0
- package/dist/packem_shared/startCelldDevSession-DfuDVsha.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
- package/dist/packem_shared/studio-assets-BKWx838V.mjs +1 -0
- package/dist/packem_shared/validate-bindings-DSMH8bRQ.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-BXOIqXxv.mjs +1 -0
- package/dist/packem_shared/wranglerCodegenInputs-B8iRZZZw.mjs +1 -0
- package/dist/packem_shared/wranglerToAlchemy-ClIdvJFu.mjs +5 -0
- package/dist/packem_shared/write-atomic-9sY2z8DB.mjs +3 -0
- package/dist/packem_shared/writeAssetHeaders-C5igmezc.mjs +1 -0
- package/dist/studio-host/index.d.mts +371 -136
- package/dist/studio-host/index.d.ts +371 -136
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +43 -10
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_MODE_ENV-DM1Siczo.mjs +0 -17
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs +0 -163
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-8bNMHGiu.mjs +0 -104
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
- package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +0 -72
- package/dist/packem_shared/buildPackageSecretsBlock-B8iSX1Zo.mjs +0 -281
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
- package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
- package/dist/packem_shared/detectFramework-U08038Yp.mjs +0 -41
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
- package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
- package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
- package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/config",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.470",
|
|
4
4
|
"description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bindings",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"homepage": "https://lunora.sh",
|
|
16
16
|
"bugs": "https://github.com/anolilab/lunora/issues",
|
|
17
|
-
"license": "
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
18
|
"author": {
|
|
19
19
|
"name": "Daniel Bannert",
|
|
20
20
|
"email": "d.bannert@anolilab.de"
|
|
@@ -40,6 +40,22 @@
|
|
|
40
40
|
"types": "./dist/index.d.ts",
|
|
41
41
|
"import": "./dist/index.mjs"
|
|
42
42
|
},
|
|
43
|
+
"./celld": {
|
|
44
|
+
"types": "./dist/celld/index.d.ts",
|
|
45
|
+
"import": "./dist/celld/index.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./celld-names": {
|
|
48
|
+
"types": "./dist/celld-names/index.d.ts",
|
|
49
|
+
"import": "./dist/celld-names/index.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./cloudflare": {
|
|
52
|
+
"types": "./dist/cloudflare/index.d.ts",
|
|
53
|
+
"import": "./dist/cloudflare/index.mjs"
|
|
54
|
+
},
|
|
55
|
+
"./cli": {
|
|
56
|
+
"types": "./dist/cli/index.d.ts",
|
|
57
|
+
"import": "./dist/cli/index.mjs"
|
|
58
|
+
},
|
|
43
59
|
"./studio-host": {
|
|
44
60
|
"types": "./dist/studio-host/index.d.ts",
|
|
45
61
|
"import": "./dist/studio-host/index.mjs"
|
|
@@ -50,21 +66,38 @@
|
|
|
50
66
|
"access": "public"
|
|
51
67
|
},
|
|
52
68
|
"dependencies": {
|
|
53
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
54
|
-
"@lunora/container": "1.0.0-alpha.
|
|
55
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
56
|
-
"@lunora/seed": "1.0.0-alpha.
|
|
57
|
-
"@visulima/colorize": "
|
|
58
|
-
"@visulima/find-ai-runner": "1.0.
|
|
69
|
+
"@lunora/codegen": "^1.0.0-alpha.428",
|
|
70
|
+
"@lunora/container": "1.0.0-alpha.108",
|
|
71
|
+
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
72
|
+
"@lunora/seed": "^1.0.0-alpha.282",
|
|
73
|
+
"@visulima/colorize": "3.0.0",
|
|
74
|
+
"@visulima/find-ai-runner": "1.0.2",
|
|
75
|
+
"@visulima/fs": "7.0.0",
|
|
76
|
+
"@visulima/package": "6.0.0",
|
|
59
77
|
"dockerode": "^5.0.1",
|
|
60
|
-
"
|
|
78
|
+
"dotenv": "18.0.5",
|
|
79
|
+
"dotenv-expand": "12.0.2",
|
|
80
|
+
"es-module-lexer": "^2.3.2",
|
|
81
|
+
"jiti": "^2.7.0",
|
|
61
82
|
"jsonc-parser": "^3.3.1",
|
|
62
83
|
"ts-morph": "^28.0.0"
|
|
63
84
|
},
|
|
64
85
|
"peerDependencies": {
|
|
65
|
-
"@
|
|
86
|
+
"@electric-sql/pglite": "^0.5.8",
|
|
87
|
+
"@electric-sql/pglite-pgvector": "^0.0.9",
|
|
88
|
+
"@electric-sql/pglite-socket": "^0.2.11",
|
|
89
|
+
"@lunora/studio": ">=1.0.0-alpha.50 <2.0.0-0"
|
|
66
90
|
},
|
|
67
91
|
"peerDependenciesMeta": {
|
|
92
|
+
"@electric-sql/pglite": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@electric-sql/pglite-pgvector": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@electric-sql/pglite-socket": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
68
101
|
"@lunora/studio": {
|
|
69
102
|
"optional": true
|
|
70
103
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import colorize from '@visulima/colorize';
|
|
2
|
-
|
|
3
|
-
const ACCENT = "#a855f7";
|
|
4
|
-
const INK = "#0b0b0b";
|
|
5
|
-
const STEP_BADGE_NAMES = ["lunora", "dir", "tmpl", "add", "deps", "git", "next"];
|
|
6
|
-
const BADGES = {
|
|
7
|
-
add: { bg: ACCENT, fg: INK, text: "add" },
|
|
8
|
-
debug: { bg: "#6b7280", fg: "#f3f4f6", text: "debug" },
|
|
9
|
-
deps: { bg: ACCENT, fg: INK, text: "deps" },
|
|
10
|
-
dir: { bg: ACCENT, fg: INK, text: "dir" },
|
|
11
|
-
error: { bg: "#ef4444", fg: INK, text: "error" },
|
|
12
|
-
git: { bg: "#f59e0b", fg: INK, text: "git" },
|
|
13
|
-
info: { bg: "#3b82f6", fg: INK, text: "info" },
|
|
14
|
-
lunora: { bg: "#22c55e", fg: INK, text: "lunora" },
|
|
15
|
-
next: { bg: "#06b6d4", fg: INK, text: "next" },
|
|
16
|
-
success: { bg: "#22c55e", fg: INK, text: "ok" },
|
|
17
|
-
tmpl: { bg: ACCENT, fg: INK, text: "tmpl" },
|
|
18
|
-
warn: { bg: "#f59e0b", fg: INK, text: "warn" }
|
|
19
|
-
};
|
|
20
|
-
const LUNA_NAME = "Luna";
|
|
21
|
-
const LUNA_SIGNOFF = "Safe travels, voyager.";
|
|
22
|
-
const LUNA_BUNNY = String.raw`
|
|
23
|
-
.-"""""-.
|
|
24
|
-
/ (\(\ \
|
|
25
|
-
| ( -.-) |
|
|
26
|
-
\ o(")(") /
|
|
27
|
-
'-._____.-'`;
|
|
28
|
-
const LUNA_ART = LUNA_BUNNY.startsWith("\n") ? LUNA_BUNNY.slice(1) : LUNA_BUNNY;
|
|
29
|
-
const BADGE_GUTTER = 6;
|
|
30
|
-
const padBadge = (text) => ` ${text} `;
|
|
31
|
-
const badgeLead = (text) => " ".repeat(Math.max(0, BADGE_GUTTER - text.length));
|
|
32
|
-
const BADGE_COLUMN_WIDTH = BADGE_GUTTER + 2;
|
|
33
|
-
const badgeWidth = (_spec) => BADGE_COLUMN_WIDTH;
|
|
34
|
-
const paintBadge = (spec) => (
|
|
35
|
-
// eslint-disable-next-line import/no-named-as-default-member -- see file header.
|
|
36
|
-
badgeLead(spec.text) + colorize.bgHex(spec.bg).hex(spec.fg).bold(padBadge(spec.text))
|
|
37
|
-
);
|
|
38
|
-
const paintAnswer = (text) => colorize.dim(text);
|
|
39
|
-
|
|
40
|
-
export { ACCENT, BADGES, BADGE_COLUMN_WIDTH, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, STEP_BADGE_NAMES, badgeLead, badgeWidth, padBadge, paintAnswer, paintBadge };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { detectAiSession } from '@visulima/find-ai-runner';
|
|
2
|
-
|
|
3
|
-
const AGENT_MODE_ENV = "LUNORA_AGENT_MODE";
|
|
4
|
-
const isDisabled = (value) => {
|
|
5
|
-
const normalized = value.trim().toLowerCase();
|
|
6
|
-
return normalized === "0" || normalized === "false";
|
|
7
|
-
};
|
|
8
|
-
const detectAiAgent = (env = process.env) => {
|
|
9
|
-
const override = env[AGENT_MODE_ENV];
|
|
10
|
-
if (override !== void 0 && override !== "") {
|
|
11
|
-
return isDisabled(override) ? void 0 : { name: "agent (forced)", variable: AGENT_MODE_ENV };
|
|
12
|
-
}
|
|
13
|
-
const session = detectAiSession(env);
|
|
14
|
-
return session === void 0 ? void 0 : { name: session.agent, variable: session.variable };
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { AGENT_MODE_ENV, detectAiAgent };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const AGENT_RULES_DIR = ".agents/skills";
|
|
5
|
-
const AGENT_RULES_HINT_ENV = "LUNORA_RULES_HINT_SHOWN";
|
|
6
|
-
const LUNORA_SKILL_NAMES = [
|
|
7
|
-
"lunora",
|
|
8
|
-
"lunora-quickstart",
|
|
9
|
-
"lunora-functions",
|
|
10
|
-
"lunora-realtime",
|
|
11
|
-
"lunora-setup-auth",
|
|
12
|
-
"lunora-create-package",
|
|
13
|
-
"lunora-migration-helper",
|
|
14
|
-
"lunora-deploy",
|
|
15
|
-
"lunora-performance-audit"
|
|
16
|
-
];
|
|
17
|
-
const ROOT_SKILL_NAME = "lunora";
|
|
18
|
-
const AGENT_RULES_HINT = "Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.";
|
|
19
|
-
const claimAgentRulesHint = () => {
|
|
20
|
-
if (process.env[AGENT_RULES_HINT_ENV] === "1") {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
process.env[AGENT_RULES_HINT_ENV] = "1";
|
|
24
|
-
return true;
|
|
25
|
-
};
|
|
26
|
-
const skillFile = (projectRoot, name) => join(projectRoot, AGENT_RULES_DIR, name, "SKILL.md");
|
|
27
|
-
const detectAgentRules = (projectRoot) => {
|
|
28
|
-
const present = [];
|
|
29
|
-
const missing = [];
|
|
30
|
-
for (const name of LUNORA_SKILL_NAMES) {
|
|
31
|
-
if (existsSync(skillFile(projectRoot, name))) {
|
|
32
|
-
present.push(name);
|
|
33
|
-
} else {
|
|
34
|
-
missing.push(name);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return { installed: existsSync(skillFile(projectRoot, ROOT_SKILL_NAME)), missing, present };
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, LUNORA_SKILL_NAMES, ROOT_SKILL_NAME, claimAgentRulesHint, detectAgentRules };
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync, rmSync, existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const DEV_STATE_DIR = ".lunora";
|
|
5
|
-
const DEV_STATE_FILE = join(DEV_STATE_DIR, "dev.json");
|
|
6
|
-
const DEV_LOG_FILE = join(DEV_STATE_DIR, "dev.log");
|
|
7
|
-
const DEV_DAEMON_ENV = "LUNORA_DEV_DAEMON";
|
|
8
|
-
const DEV_LOG_FILE_ENV = "LUNORA_DEV_LOG_FILE";
|
|
9
|
-
const DEV_HANDOFF_ENV = "LUNORA_DEV_HANDOFF_PID";
|
|
10
|
-
const isObject = (value) => value !== null && typeof value === "object";
|
|
11
|
-
const stringField = (record, key) => {
|
|
12
|
-
const value = record[key];
|
|
13
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
14
|
-
};
|
|
15
|
-
const isProcessAlive = (pid) => {
|
|
16
|
-
if (!Number.isInteger(pid) || pid <= 0) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
process.kill(pid, 0);
|
|
21
|
-
return true;
|
|
22
|
-
} catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const START_TIME_SKEW_MS = 1e4;
|
|
27
|
-
const LINUX_CLOCK_TICKS_PER_SECOND = 100;
|
|
28
|
-
const processStartTimeMs = (pid) => {
|
|
29
|
-
if (process.platform !== "linux") {
|
|
30
|
-
return void 0;
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const stat = readFileSync(`/proc/${String(pid)}/stat`, "utf8");
|
|
34
|
-
const fields = stat.slice(stat.lastIndexOf(")") + 2).split(" ");
|
|
35
|
-
const startTicks = Number(fields[19]);
|
|
36
|
-
const bootLine = readFileSync("/proc/stat", "utf8").split("\n").find((line) => line.startsWith("btime "));
|
|
37
|
-
const bootSeconds = Number(bootLine?.slice("btime ".length));
|
|
38
|
-
if (!Number.isFinite(startTicks) || !Number.isFinite(bootSeconds)) {
|
|
39
|
-
return void 0;
|
|
40
|
-
}
|
|
41
|
-
return bootSeconds * 1e3 + startTicks / LINUX_CLOCK_TICKS_PER_SECOND * 1e3;
|
|
42
|
-
} catch {
|
|
43
|
-
return void 0;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const isRecordedProcessCurrent = (state) => {
|
|
47
|
-
if (!isProcessAlive(state.pid)) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
const recordedAtMs = state.startedAt === void 0 ? Number.NaN : Date.parse(state.startedAt);
|
|
51
|
-
if (Number.isNaN(recordedAtMs)) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
const actualStartMs = processStartTimeMs(state.pid);
|
|
55
|
-
return actualStartMs === void 0 || actualStartMs <= recordedAtMs + START_TIME_SKEW_MS;
|
|
56
|
-
};
|
|
57
|
-
const readDevServerState = (projectRoot) => {
|
|
58
|
-
const path = join(projectRoot, DEV_STATE_FILE);
|
|
59
|
-
if (!existsSync(path)) {
|
|
60
|
-
return void 0;
|
|
61
|
-
}
|
|
62
|
-
let parsed;
|
|
63
|
-
try {
|
|
64
|
-
parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
65
|
-
} catch {
|
|
66
|
-
return void 0;
|
|
67
|
-
}
|
|
68
|
-
if (!isObject(parsed) || typeof parsed["pid"] !== "number") {
|
|
69
|
-
return void 0;
|
|
70
|
-
}
|
|
71
|
-
const url = stringField(parsed, "url");
|
|
72
|
-
if (url === void 0) {
|
|
73
|
-
return void 0;
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
background: parsed["background"] === true,
|
|
77
|
-
logFile: stringField(parsed, "logFile"),
|
|
78
|
-
mode: parsed["mode"] === "vite" ? "vite" : "cli",
|
|
79
|
-
pid: parsed["pid"],
|
|
80
|
-
startedAt: stringField(parsed, "startedAt"),
|
|
81
|
-
studioUrl: stringField(parsed, "studioUrl"),
|
|
82
|
-
url
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
const writeDevServerState = (projectRoot, state) => {
|
|
86
|
-
try {
|
|
87
|
-
mkdirSync(join(projectRoot, DEV_STATE_DIR), { recursive: true });
|
|
88
|
-
const path = join(projectRoot, DEV_STATE_FILE);
|
|
89
|
-
writeFileSync(path, `${JSON.stringify(state, void 0, 2)}
|
|
90
|
-
`, "utf8");
|
|
91
|
-
return path;
|
|
92
|
-
} catch {
|
|
93
|
-
return void 0;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const updateDevServerState = (projectRoot, patch) => {
|
|
97
|
-
const existing = readDevServerState(projectRoot);
|
|
98
|
-
if (existing === void 0) {
|
|
99
|
-
return void 0;
|
|
100
|
-
}
|
|
101
|
-
const merged = { ...existing, ...patch };
|
|
102
|
-
writeDevServerState(projectRoot, merged);
|
|
103
|
-
return merged;
|
|
104
|
-
};
|
|
105
|
-
const clearDevServerState = (projectRoot, expectedPid) => {
|
|
106
|
-
try {
|
|
107
|
-
if (expectedPid !== void 0) {
|
|
108
|
-
const current = readDevServerState(projectRoot);
|
|
109
|
-
if (current !== void 0 && current.pid !== expectedPid) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
rmSync(join(projectRoot, DEV_STATE_FILE), { force: true });
|
|
114
|
-
} catch {
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const readLiveDevServerState = (projectRoot) => {
|
|
118
|
-
const state = readDevServerState(projectRoot);
|
|
119
|
-
if (state === void 0) {
|
|
120
|
-
return void 0;
|
|
121
|
-
}
|
|
122
|
-
if (isRecordedProcessCurrent(state)) {
|
|
123
|
-
return state;
|
|
124
|
-
}
|
|
125
|
-
clearDevServerState(projectRoot, state.pid);
|
|
126
|
-
return void 0;
|
|
127
|
-
};
|
|
128
|
-
const resolveClaimConflict = (projectRoot, state, supersedePid) => {
|
|
129
|
-
const existing = readLiveDevServerState(projectRoot);
|
|
130
|
-
if (existing === void 0) {
|
|
131
|
-
return void 0;
|
|
132
|
-
}
|
|
133
|
-
if (supersedePid !== void 0 && existing.pid === supersedePid) {
|
|
134
|
-
return { ok: writeDevServerState(projectRoot, state) !== void 0 };
|
|
135
|
-
}
|
|
136
|
-
if (existing.pid !== state.pid) {
|
|
137
|
-
return { existing, ok: false };
|
|
138
|
-
}
|
|
139
|
-
return { ok: writeDevServerState(projectRoot, state) !== void 0 };
|
|
140
|
-
};
|
|
141
|
-
const claimDevServerState = (projectRoot, state, options) => {
|
|
142
|
-
const path = join(projectRoot, DEV_STATE_FILE);
|
|
143
|
-
const payload = `${JSON.stringify(state, void 0, 2)}
|
|
144
|
-
`;
|
|
145
|
-
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
146
|
-
try {
|
|
147
|
-
mkdirSync(join(projectRoot, DEV_STATE_DIR), { recursive: true });
|
|
148
|
-
writeFileSync(path, payload, { encoding: "utf8", flag: "wx" });
|
|
149
|
-
return { ok: true };
|
|
150
|
-
} catch (error) {
|
|
151
|
-
if (error.code !== "EEXIST") {
|
|
152
|
-
return { ok: writeDevServerState(projectRoot, state) !== void 0 };
|
|
153
|
-
}
|
|
154
|
-
const resolved = resolveClaimConflict(projectRoot, state, options?.supersedePid);
|
|
155
|
-
if (resolved !== void 0) {
|
|
156
|
-
return resolved;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return { ok: writeDevServerState(projectRoot, state) !== void 0 };
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export { DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, claimDevServerState, clearDevServerState, isProcessAlive, isRecordedProcessCurrent, readDevServerState, readLiveDevServerState, updateDevServerState, writeDevServerState };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const DEV_VARS_FILE = ".dev.vars";
|
|
2
|
-
const DEV_VARS_EXAMPLE_FILE = ".dev.vars.example";
|
|
3
|
-
const DEV_VARS_KEY_PATTERN = /^[A-Za-z_]\w*$/u;
|
|
4
|
-
const DEV_VARS_NEWLINE = /\r?\n/u;
|
|
5
|
-
const unquoteDevVariable = (value) => {
|
|
6
|
-
if (value.length >= 2 && (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'"))) {
|
|
7
|
-
return value.slice(1, -1);
|
|
8
|
-
}
|
|
9
|
-
return value;
|
|
10
|
-
};
|
|
11
|
-
const splitDevVariableLine = (line) => {
|
|
12
|
-
const trimmed = line.trim();
|
|
13
|
-
if (trimmed === "" || trimmed.startsWith("#")) {
|
|
14
|
-
return void 0;
|
|
15
|
-
}
|
|
16
|
-
const equals = trimmed.indexOf("=");
|
|
17
|
-
if (equals <= 0) {
|
|
18
|
-
return void 0;
|
|
19
|
-
}
|
|
20
|
-
const key = trimmed.slice(0, equals).trim();
|
|
21
|
-
if (!DEV_VARS_KEY_PATTERN.test(key)) {
|
|
22
|
-
return void 0;
|
|
23
|
-
}
|
|
24
|
-
return { key, value: trimmed.slice(equals + 1).trim() };
|
|
25
|
-
};
|
|
26
|
-
const parseDevVariableEntries = (content) => {
|
|
27
|
-
const entries = [];
|
|
28
|
-
for (const line of content.split(DEV_VARS_NEWLINE)) {
|
|
29
|
-
const parsed = splitDevVariableLine(line);
|
|
30
|
-
if (parsed) {
|
|
31
|
-
entries.push({ key: parsed.key, value: unquoteDevVariable(parsed.value) });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return entries;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export { DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_VARS_NEWLINE, parseDevVariableEntries, splitDevVariableLine, unquoteDevVariable };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { parse } from 'jsonc-parser';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
|
|
5
|
-
const LINKED_PROJECT_DIR = ".lunora";
|
|
6
|
-
const LINKED_PROJECT_FILE = join(LINKED_PROJECT_DIR, "project.json");
|
|
7
|
-
const isObject = (value) => value !== null && typeof value === "object";
|
|
8
|
-
const stringField = (record, key) => {
|
|
9
|
-
const value = record[key];
|
|
10
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
11
|
-
};
|
|
12
|
-
const readLinkedProject = (projectRoot) => {
|
|
13
|
-
const path = join(projectRoot, LINKED_PROJECT_FILE);
|
|
14
|
-
if (!existsSync(path)) {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
let text;
|
|
18
|
-
try {
|
|
19
|
-
text = readFileSync(path, "utf8");
|
|
20
|
-
} catch {
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
const parseErrors = [];
|
|
24
|
-
const parsed = parse(text, parseErrors, { allowTrailingComma: true });
|
|
25
|
-
if (parseErrors.length > 0 || !isObject(parsed)) {
|
|
26
|
-
return void 0;
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
account: stringField(parsed, "account"),
|
|
30
|
-
env: stringField(parsed, "env"),
|
|
31
|
-
linkedAt: stringField(parsed, "linkedAt"),
|
|
32
|
-
workerName: stringField(parsed, "workerName"),
|
|
33
|
-
workerUrl: stringField(parsed, "workerUrl")
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
const writeLinkedProject = (projectRoot, link) => {
|
|
37
|
-
const directory = join(projectRoot, LINKED_PROJECT_DIR);
|
|
38
|
-
mkdirSync(directory, { recursive: true });
|
|
39
|
-
const record = {};
|
|
40
|
-
for (const key of ["account", "env", "linkedAt", "workerName", "workerUrl"]) {
|
|
41
|
-
const value = link[key];
|
|
42
|
-
if (value !== void 0 && value !== "") {
|
|
43
|
-
record[key] = value;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const path = join(projectRoot, LINKED_PROJECT_FILE);
|
|
47
|
-
writeFileSync(path, `${JSON.stringify(record, void 0, 2)}
|
|
48
|
-
`, "utf8");
|
|
49
|
-
return path;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export { LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, readLinkedProject, writeLinkedProject };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { parse } from 'jsonc-parser';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
|
|
5
|
-
const LUNORA_CONFIG_FILE = "lunora.json";
|
|
6
|
-
const interpretRemote = (value) => {
|
|
7
|
-
if (typeof value === "boolean") {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
if (value !== null && typeof value === "object") {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
return void 0;
|
|
14
|
-
};
|
|
15
|
-
const readProjectRemotePreference = (projectRoot) => {
|
|
16
|
-
const configPath = join(projectRoot, LUNORA_CONFIG_FILE);
|
|
17
|
-
if (!existsSync(configPath)) {
|
|
18
|
-
return void 0;
|
|
19
|
-
}
|
|
20
|
-
let text;
|
|
21
|
-
try {
|
|
22
|
-
text = readFileSync(configPath, "utf8");
|
|
23
|
-
} catch {
|
|
24
|
-
return void 0;
|
|
25
|
-
}
|
|
26
|
-
const parseErrors = [];
|
|
27
|
-
const parsed = parse(text, parseErrors, { allowTrailingComma: true });
|
|
28
|
-
if (parseErrors.length > 0 || parsed === null || typeof parsed !== "object") {
|
|
29
|
-
return void 0;
|
|
30
|
-
}
|
|
31
|
-
return interpretRemote(parsed.remote);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { LUNORA_CONFIG_FILE, interpretRemote, readProjectRemotePreference };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
const LUNORA_EVENT_SOURCE = "lunora";
|
|
2
|
-
const ROOT_SHARD_NAME = "__root__";
|
|
3
|
-
const asString = (value) => typeof value === "string" ? value : "";
|
|
4
|
-
const asStringList = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
5
|
-
const formatDuration = (value) => typeof value === "number" && Number.isFinite(value) ? `${String(Math.round(value))}ms` : "?ms";
|
|
6
|
-
const toLineLevel = (rawLevel) => {
|
|
7
|
-
if (rawLevel === "error") {
|
|
8
|
-
return "error";
|
|
9
|
-
}
|
|
10
|
-
if (rawLevel === "warn") {
|
|
11
|
-
return "warn";
|
|
12
|
-
}
|
|
13
|
-
return "info";
|
|
14
|
-
};
|
|
15
|
-
const parseLunoraEvent = (line) => {
|
|
16
|
-
const trimmed = line.trim();
|
|
17
|
-
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
|
|
18
|
-
return void 0;
|
|
19
|
-
}
|
|
20
|
-
let parsed;
|
|
21
|
-
try {
|
|
22
|
-
parsed = JSON.parse(trimmed);
|
|
23
|
-
} catch {
|
|
24
|
-
return void 0;
|
|
25
|
-
}
|
|
26
|
-
if (typeof parsed !== "object" || parsed === null) {
|
|
27
|
-
return void 0;
|
|
28
|
-
}
|
|
29
|
-
const event = parsed;
|
|
30
|
-
return event.source === LUNORA_EVENT_SOURCE ? event : void 0;
|
|
31
|
-
};
|
|
32
|
-
const labelFor = (functionPath, event) => {
|
|
33
|
-
const shard = asString(event.shard);
|
|
34
|
-
return shard === "" || shard === ROOT_SHARD_NAME ? functionPath : `${functionPath}@${shard}`;
|
|
35
|
-
};
|
|
36
|
-
const formatRequest = (event, functionPath) => {
|
|
37
|
-
const failed = event.outcome === "error";
|
|
38
|
-
const parts = [labelFor(functionPath, event), failed ? "error" : "ok", formatDuration(event.durationMs)];
|
|
39
|
-
const read = asStringList(event.tablesRead);
|
|
40
|
-
const written = asStringList(event.tablesWritten);
|
|
41
|
-
if (read.length > 0) {
|
|
42
|
-
parts.push(`read[${read.join(",")}]`);
|
|
43
|
-
}
|
|
44
|
-
if (written.length > 0) {
|
|
45
|
-
parts.push(`write[${written.join(",")}]`);
|
|
46
|
-
}
|
|
47
|
-
if (event.cacheHit === true) {
|
|
48
|
-
parts.push("cached");
|
|
49
|
-
}
|
|
50
|
-
const errorMessage = asString(event.error);
|
|
51
|
-
if (failed && errorMessage !== "") {
|
|
52
|
-
parts.push(errorMessage);
|
|
53
|
-
}
|
|
54
|
-
return { kind: "rpc", level: failed ? "error" : "info", text: parts.join(" ") };
|
|
55
|
-
};
|
|
56
|
-
const formatContainer = (event) => {
|
|
57
|
-
const name = asString(event.container) || "<unknown>";
|
|
58
|
-
const instance = asString(event.instance);
|
|
59
|
-
const transition = asString(event.event) || "event";
|
|
60
|
-
const shortId = instance === "" || instance === "unknown" ? "" : `#${instance.slice(0, 8)}`;
|
|
61
|
-
const message = asString(event.message);
|
|
62
|
-
const parts = [`container:${name}${shortId}`, transition];
|
|
63
|
-
if (message !== "") {
|
|
64
|
-
parts.push(message);
|
|
65
|
-
}
|
|
66
|
-
return { kind: "log", level: event.event === "error" ? "error" : "info", text: parts.join(" ") };
|
|
67
|
-
};
|
|
68
|
-
const formatLunoraEvent = (line) => {
|
|
69
|
-
const event = parseLunoraEvent(line);
|
|
70
|
-
if (!event) {
|
|
71
|
-
return void 0;
|
|
72
|
-
}
|
|
73
|
-
const functionPath = asString(event.function) || "<unknown>";
|
|
74
|
-
if (event.type === "log") {
|
|
75
|
-
return { kind: "log", level: toLineLevel(asString(event.level)), text: `${labelFor(functionPath, event)} ${asString(event.message)}`.trimEnd() };
|
|
76
|
-
}
|
|
77
|
-
if (event.type === "request") {
|
|
78
|
-
return formatRequest(event, functionPath);
|
|
79
|
-
}
|
|
80
|
-
if (event.type === "container") {
|
|
81
|
-
return formatContainer(event);
|
|
82
|
-
}
|
|
83
|
-
return void 0;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export { LUNORA_EVENT_SOURCE, formatLunoraEvent };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { paintBadge, badgeWidth, BADGES } from './ACCENT-DW1XJn8i.mjs';
|
|
2
|
-
|
|
3
|
-
const NAME_ALIASES = {
|
|
4
|
-
informational: "info",
|
|
5
|
-
warning: "warn"
|
|
6
|
-
};
|
|
7
|
-
const STDERR_LEVELS = /* @__PURE__ */ new Set(["alert", "critical", "emergency", "error", "warn", "warning"]);
|
|
8
|
-
const resolveBadge = (name) => {
|
|
9
|
-
if (name in BADGES) {
|
|
10
|
-
return BADGES[name];
|
|
11
|
-
}
|
|
12
|
-
const alias = NAME_ALIASES[name];
|
|
13
|
-
return alias === void 0 ? void 0 : BADGES[alias];
|
|
14
|
-
};
|
|
15
|
-
const renderContextArgument = (value) => {
|
|
16
|
-
if (value instanceof Error) {
|
|
17
|
-
return `
|
|
18
|
-
${value.stack ?? value.message}`;
|
|
19
|
-
}
|
|
20
|
-
if (typeof value === "object" && value !== null) {
|
|
21
|
-
try {
|
|
22
|
-
return ` ${JSON.stringify(value)}`;
|
|
23
|
-
} catch {
|
|
24
|
-
return " [unserializable]";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return ` ${String(value)}`;
|
|
28
|
-
};
|
|
29
|
-
const composeMessage = (meta) => {
|
|
30
|
-
const base = typeof meta.message === "string" ? meta.message : String(meta.message);
|
|
31
|
-
const context = meta.context ?? [];
|
|
32
|
-
return context.length === 0 ? base : base + context.map((value) => renderContextArgument(value)).join("");
|
|
33
|
-
};
|
|
34
|
-
class LunoraReporter {
|
|
35
|
-
#stdout = process.stdout;
|
|
36
|
-
#stderr = process.stderr;
|
|
37
|
-
setStdout(stdout) {
|
|
38
|
-
this.#stdout = stdout;
|
|
39
|
-
}
|
|
40
|
-
setStderr(stderr) {
|
|
41
|
-
this.#stderr = stderr;
|
|
42
|
-
}
|
|
43
|
-
// Note: pail's other reporter setters (setLoggerTypes / setInteractiveManager /
|
|
44
|
-
// setIsInteractive) are optional and intentionally omitted — this reporter keeps
|
|
45
|
-
// no type or interactive state; it only needs the two stream setters above.
|
|
46
|
-
log(meta) {
|
|
47
|
-
const data = meta;
|
|
48
|
-
const badge = resolveBadge(data.type.name);
|
|
49
|
-
const stream = STDERR_LEVELS.has(data.type.level ?? data.type.name) ? this.#stderr : this.#stdout;
|
|
50
|
-
stream.write(LunoraReporter.#render(badge, composeMessage(data)));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Frame `text` under `badge`: `<badge> <first line>`, with any further lines
|
|
54
|
-
* indented to align beneath the message. Without a badge (unknown type) the
|
|
55
|
-
* message is written plain.
|
|
56
|
-
*/
|
|
57
|
-
static #render(badge, text) {
|
|
58
|
-
if (badge === void 0) {
|
|
59
|
-
return `${text}
|
|
60
|
-
`;
|
|
61
|
-
}
|
|
62
|
-
const [first = "", ...rest] = text.split("\n");
|
|
63
|
-
const indent = " ".repeat(badgeWidth() + 1);
|
|
64
|
-
const lines = [`${paintBadge(badge)} ${first}`, ...rest.map((line) => `${indent}${line}`)];
|
|
65
|
-
return `${lines.join("\n")}
|
|
66
|
-
`;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { LunoraReporter as default };
|