@langwatch/server 3.22.0 → 3.24.0
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/cli.cjs +290 -155
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -44760,12 +44760,34 @@ var registry2 = {
|
|
|
44760
44760
|
"The server log line next to this failure names the directory that was refused"
|
|
44761
44761
|
]
|
|
44762
44762
|
},
|
|
44763
|
+
storage_credentials_refused: {
|
|
44764
|
+
tips: [
|
|
44765
|
+
"On Azure Blob with a shared key, check AZURE_BLOB_ACCOUNT_NAME and AZURE_BLOB_ACCOUNT_KEY name the same account, then restart the api and worker",
|
|
44766
|
+
"Under a token mode, check the identity's client id, tenant and secret or federated token; a role grant does not fix a credential Azure rejects"
|
|
44767
|
+
],
|
|
44768
|
+
docsPath: "/self-hosting/configuration/environment-variables"
|
|
44769
|
+
},
|
|
44770
|
+
storage_permission_denied: {
|
|
44771
|
+
tips: [
|
|
44772
|
+
'Grant the identity "Storage Blob Data Contributor" on the storage account or the container',
|
|
44773
|
+
'The control-plane "Contributor" role does not grant data access'
|
|
44774
|
+
],
|
|
44775
|
+
docsPath: "/self-hosting/configuration/environment-variables"
|
|
44776
|
+
},
|
|
44763
44777
|
dataset_invalid_column: {
|
|
44764
44778
|
tips: [
|
|
44765
44779
|
"Add the column to the dataset, or remove it from the row, and send it again; retrying unchanged will fail identically",
|
|
44766
44780
|
"The message names the dataset's valid columns"
|
|
44767
44781
|
]
|
|
44768
44782
|
},
|
|
44783
|
+
// ---- data retention ----
|
|
44784
|
+
data_retention_billed_through_billing: {
|
|
44785
|
+
tips: [
|
|
44786
|
+
"Ask someone with subscription:manage in the organization to set this length; it adds a storage line to the subscription",
|
|
44787
|
+
"Or pick 90 days or less, which the plan includes"
|
|
44788
|
+
],
|
|
44789
|
+
docsPath: "/platform/data-retention"
|
|
44790
|
+
},
|
|
44769
44791
|
// ---- automations ----
|
|
44770
44792
|
automation_dataset_unavailable: {
|
|
44771
44793
|
tips: [
|
|
@@ -44781,6 +44803,12 @@ var registry2 = {
|
|
|
44781
44803
|
],
|
|
44782
44804
|
docsPath: "/platform/data-retention"
|
|
44783
44805
|
},
|
|
44806
|
+
trace_withheld_over_plan: {
|
|
44807
|
+
tips: [
|
|
44808
|
+
"Upgrade the plan on Settings > Subscription to show every held trace again",
|
|
44809
|
+
"Or remove members on Settings > Members until they fit the plan"
|
|
44810
|
+
]
|
|
44811
|
+
},
|
|
44784
44812
|
span_not_found: {
|
|
44785
44813
|
tips: ["Check the span id; spans are deleted with their trace after the retention window"],
|
|
44786
44814
|
docsPath: "/platform/data-retention"
|
|
@@ -44894,6 +44922,12 @@ var registry2 = {
|
|
|
44894
44922
|
"Ask an administrator to enable the SQL workbench for this project"
|
|
44895
44923
|
]
|
|
44896
44924
|
},
|
|
44925
|
+
lwql_not_provisioned: {
|
|
44926
|
+
tips: [
|
|
44927
|
+
"This organisation's data is on a server LangWatchQL is not provisioned on; retrying will not help",
|
|
44928
|
+
"On a self-hosted install, let the deploy provision the LangWatchQL access model, then retry"
|
|
44929
|
+
]
|
|
44930
|
+
},
|
|
44897
44931
|
custom_chart_playground_not_enabled: {
|
|
44898
44932
|
tips: [
|
|
44899
44933
|
"Dashboard widgets need both Dashboards and LangWatchQL enabled for this project; retrying will not help",
|
|
@@ -45001,10 +45035,19 @@ var registry2 = {
|
|
|
45001
45035
|
tips: ["Revoked keys cannot be reactivated \u2014 create a new API key if you need one"],
|
|
45002
45036
|
docsPath: "/api-reference/api-keys/create-api-key"
|
|
45003
45037
|
},
|
|
45038
|
+
api_key_expired: {
|
|
45039
|
+
tips: ["An expired key cannot be rotated. Create a new API key instead"],
|
|
45040
|
+
docsPath: "/api-reference/api-keys/create-api-key"
|
|
45041
|
+
},
|
|
45004
45042
|
api_key_permission_denied: {
|
|
45005
45043
|
tips: ["Re-create the API key with the required scope, or ask an admin to raise your role"],
|
|
45006
45044
|
docsPath: "/api-reference/api-keys/create-api-key"
|
|
45007
45045
|
},
|
|
45046
|
+
impersonation_cannot_mint_credential: {
|
|
45047
|
+
tips: [
|
|
45048
|
+
"No role or grant changes this; leave impersonation, and ask the member to create or rotate the key themselves"
|
|
45049
|
+
]
|
|
45050
|
+
},
|
|
45008
45051
|
legacy_project_key_ingestion_only: {
|
|
45009
45052
|
tips: [
|
|
45010
45053
|
"A legacy project key is limited to ingestion and the scopes enabled for its project; create an API key with the permissions this call needs and send it instead"
|
|
@@ -45033,12 +45076,26 @@ var registry2 = {
|
|
|
45033
45076
|
"A self-hosted installation registers more documentation sites in its configuration"
|
|
45034
45077
|
]
|
|
45035
45078
|
},
|
|
45079
|
+
docs_playground_sessions_disabled: {
|
|
45080
|
+
tips: [
|
|
45081
|
+
"Paste an API key into the playground instead",
|
|
45082
|
+
"An organisation admin can turn docs playground sessions back on under Settings, Authentication"
|
|
45083
|
+
]
|
|
45084
|
+
},
|
|
45036
45085
|
api_key_reserved_name: {
|
|
45037
45086
|
tips: [
|
|
45038
45087
|
"This name is reserved for keys LangWatch manages on your behalf; pick a different name"
|
|
45039
45088
|
],
|
|
45040
45089
|
docsPath: "/api-reference/api-keys/create-api-key"
|
|
45041
45090
|
},
|
|
45091
|
+
// ---- ingestion sources ----
|
|
45092
|
+
ingestion_source_disabled: {
|
|
45093
|
+
tips: [
|
|
45094
|
+
"Stop the exporter, or ask an organization admin to set the source back to active",
|
|
45095
|
+
"Events refused while the source was disabled are not kept; resend them after re-enabling if you need them"
|
|
45096
|
+
],
|
|
45097
|
+
docsPath: "/ai-governance/ingestion-sources/index"
|
|
45098
|
+
},
|
|
45042
45099
|
// ---- ingestion keys ----
|
|
45043
45100
|
ingestion_key_not_found: {
|
|
45044
45101
|
tips: [
|
|
@@ -45114,9 +45171,16 @@ var registry2 = {
|
|
|
45114
45171
|
"Organization slugs are unique across the instance; pick a different slug, or omit it to derive one from the name"
|
|
45115
45172
|
]
|
|
45116
45173
|
},
|
|
45174
|
+
workflow_result_too_large: {
|
|
45175
|
+
tips: [
|
|
45176
|
+
"The workflow ran, but its result is over the 6 MB one synchronous answer can carry",
|
|
45177
|
+
"Return less from the end node: fewer rows, shorter text, or a reference to stored data instead of the data itself"
|
|
45178
|
+
],
|
|
45179
|
+
docsPath: "/workflows/overview"
|
|
45180
|
+
},
|
|
45117
45181
|
duplicate_invite: {
|
|
45118
45182
|
tips: [
|
|
45119
|
-
"A pending invite for this email already exists; revoke it first, or treat this as already done"
|
|
45183
|
+
"A pending invite for this email already exists; resend it, revoke it first, or treat this as already done"
|
|
45120
45184
|
]
|
|
45121
45185
|
},
|
|
45122
45186
|
scim_token_not_found: {
|
|
@@ -45126,6 +45190,12 @@ var registry2 = {
|
|
|
45126
45190
|
],
|
|
45127
45191
|
docsPath: "/platform/scim"
|
|
45128
45192
|
},
|
|
45193
|
+
braids_not_enabled: {
|
|
45194
|
+
tips: [
|
|
45195
|
+
"Braid management is not switched on for this organisation yet; retrying will not help",
|
|
45196
|
+
"Braids that already exist keep applying to trace reads; ask LangWatch to switch braids on to create or change them"
|
|
45197
|
+
]
|
|
45198
|
+
},
|
|
45129
45199
|
// ---- personal workspace reads ----
|
|
45130
45200
|
// Both are hit almost entirely by agents and CLIs, which have no UI to fall
|
|
45131
45201
|
// back on, so the tips have to name the key to swap in rather than restate
|
|
@@ -45194,6 +45264,13 @@ var registry2 = {
|
|
|
45194
45264
|
],
|
|
45195
45265
|
docsPath: "/agent-testing/connect-your-agent"
|
|
45196
45266
|
},
|
|
45267
|
+
agent_registry_entry_not_found: {
|
|
45268
|
+
tips: [
|
|
45269
|
+
"List the registry with GET /api/governance/registry/agents and use an `id` from that list",
|
|
45270
|
+
"Registry ids start with agentreg_; a LangWatch agent id is a different id"
|
|
45271
|
+
],
|
|
45272
|
+
docsPath: "/governance/agent-registry"
|
|
45273
|
+
},
|
|
45197
45274
|
agent_offline: {
|
|
45198
45275
|
tips: [
|
|
45199
45276
|
"Start the process that runs the decorated function; the agent shows Online in the agents list once it connects",
|
|
@@ -45332,6 +45409,12 @@ var registry2 = {
|
|
|
45332
45409
|
]
|
|
45333
45410
|
},
|
|
45334
45411
|
// ---- scenario runs ----
|
|
45412
|
+
scenario_red_team_config_mismatch: {
|
|
45413
|
+
tips: [
|
|
45414
|
+
"Send kind red_team together with a redTeam config holding attackGoal and owaspIds",
|
|
45415
|
+
"For a standard scenario, leave redTeam out"
|
|
45416
|
+
]
|
|
45417
|
+
},
|
|
45335
45418
|
scenario_reserved_set_id: {
|
|
45336
45419
|
tips: [
|
|
45337
45420
|
"Send the run without a setId; it is then recorded in the project's own one-off bucket",
|
|
@@ -45439,6 +45522,14 @@ var registry2 = {
|
|
|
45439
45522
|
],
|
|
45440
45523
|
docsPath: "/platform/model-providers"
|
|
45441
45524
|
},
|
|
45525
|
+
model_provider_unavailable: {
|
|
45526
|
+
tips: [
|
|
45527
|
+
"meta.reason is not_configured when the project has no row for the provider, disabled when the row is switched off",
|
|
45528
|
+
"Add or enable the provider in Settings, then Model Providers, or name a model from a provider that is enabled",
|
|
45529
|
+
"Retrying without changing the settings fails the same way"
|
|
45530
|
+
],
|
|
45531
|
+
docsPath: "/platform/model-providers"
|
|
45532
|
+
},
|
|
45442
45533
|
// ---- langy ----
|
|
45443
45534
|
langy_conversation_not_found: {
|
|
45444
45535
|
tips: [
|
|
@@ -45659,9 +45750,16 @@ var registry2 = {
|
|
|
45659
45750
|
instant_eval_free_budget_exhausted: {
|
|
45660
45751
|
tips: [
|
|
45661
45752
|
"Read `meta.spentUsd` against `meta.budgetUsd`; the organization has spent its free Instant Evals allowance across every project",
|
|
45662
|
-
"Upgrade the organization to a paid plan under Settings,
|
|
45753
|
+
"Upgrade the organization to a paid plan under Settings, Plan & billing; judged queries and runs are then billed per input token"
|
|
45663
45754
|
]
|
|
45664
45755
|
},
|
|
45756
|
+
instant_eval_gateway_budget_exceeded: {
|
|
45757
|
+
tips: [
|
|
45758
|
+
"Read `meta.scope` and `meta.budgetId`; that gateway budget is set to block, and Instant Evals count against it like gateway traffic",
|
|
45759
|
+
"Compare `meta.spentUsd` with `meta.limitUsd`, then raise or remove the budget under AI Gateway, Budgets, or wait for its `meta.window` to reset"
|
|
45760
|
+
],
|
|
45761
|
+
docsPath: "/features/instant-evals/limits-and-cost"
|
|
45762
|
+
},
|
|
45665
45763
|
instant_eval_not_enabled: {
|
|
45666
45764
|
tips: [
|
|
45667
45765
|
"Instant Evals are off for this organization; a self-serve organization on the hosted service is switched on by an organization admin from the search bar, and any other organization or install asks LangWatch to"
|
|
@@ -45671,6 +45769,7 @@ var registry2 = {
|
|
|
45671
45769
|
instant_eval_opt_in_not_offered: {
|
|
45672
45770
|
tips: [
|
|
45673
45771
|
"Read `meta.deployment`; an enterprise organization is switched on by LangWatch rather than from the search bar, and a self-hosted install gets Instant Evals from a license that names them, or from its operator's RELEASE_INSTANT_EVALS flag when it judges with its own JEV_API_KEY",
|
|
45772
|
+
"When `meta.deployment` is `hosted_off`, LangWatch's hosted model is off for the organization; set an own decision model as the INSTANT_EVALS default model instead",
|
|
45674
45773
|
"Contact support@langwatch.ai to switch them on, or to add them to the license"
|
|
45675
45774
|
],
|
|
45676
45775
|
docsPath: "/features/instant-evals/limits-and-cost"
|
|
@@ -46008,6 +46107,12 @@ var { outboundProxy } = Config.define((c3) => ({
|
|
|
46008
46107
|
no_proxy: c3.env("no_proxy", external_exports.string().optional())
|
|
46009
46108
|
}
|
|
46010
46109
|
}));
|
|
46110
|
+
var { nodeEnvProxy } = Config.define((c3) => ({
|
|
46111
|
+
nodeEnvProxy: {
|
|
46112
|
+
NODE_USE_ENV_PROXY: c3.env("NODE_USE_ENV_PROXY", environmentOneOrTrueSchema),
|
|
46113
|
+
NODE_OPTIONS: c3.env("NODE_OPTIONS", external_exports.string().optional())
|
|
46114
|
+
}
|
|
46115
|
+
}));
|
|
46011
46116
|
var { blockLocalHttpCalls, allowedProxyHosts } = Config.define((c3) => ({
|
|
46012
46117
|
blockLocalHttpCalls: c3.env("BLOCK_LOCAL_HTTP_CALLS", environmentOneOrTrueSchema),
|
|
46013
46118
|
/** An unset allowlist is EMPTY, never a wildcard. */
|
|
@@ -46036,6 +46141,9 @@ var { publicBaseUrl } = Config.define((c3) => ({
|
|
|
46036
46141
|
external_exports.string().optional().transform((value) => value?.trim() || void 0)
|
|
46037
46142
|
)
|
|
46038
46143
|
}));
|
|
46144
|
+
var { clickhouseCluster } = Config.define((c3) => ({
|
|
46145
|
+
clickhouseCluster: c3.env("CLICKHOUSE_CLUSTER", external_exports.string().optional())
|
|
46146
|
+
}));
|
|
46039
46147
|
var { nlpCodeBlockTimeoutSeconds } = Config.define((c3) => ({
|
|
46040
46148
|
nlpCodeBlockTimeoutSeconds: c3.env(
|
|
46041
46149
|
"NLPGO_ENGINE_CODE_BLOCK_TIMEOUT_SECONDS",
|
|
@@ -56417,7 +56525,7 @@ function collectResult(predeps, detection, installResults) {
|
|
|
56417
56525
|
}
|
|
56418
56526
|
|
|
56419
56527
|
// src/shared/version.ts
|
|
56420
|
-
var CLI_VERSION = true ? "3.
|
|
56528
|
+
var CLI_VERSION = true ? "3.24.0" : "0.0.0-dev";
|
|
56421
56529
|
|
|
56422
56530
|
// src/services/app-dir.ts
|
|
56423
56531
|
function appRoot() {
|
|
@@ -56445,12 +56553,23 @@ function redactedRequestHead(raw) {
|
|
|
56445
56553
|
return raw.slice(0, 2048).split("\r\n").map((line) => SECRET_HEADER.test(line) ? `${line.split(":")[0]}: <redacted>` : line).join("\\r\\n").replace(/[^\x20-\x7e\\]/g, (char) => `\\x${char.charCodeAt(0).toString(16).padStart(2, "0")}`).slice(0, HEAD_CHARS);
|
|
56446
56554
|
}
|
|
56447
56555
|
|
|
56556
|
+
// ../../packages/process/src/lifecycle/not-handled.ts
|
|
56557
|
+
var NOT_HANDLED_HEADER = "x-langwatch-not-handled";
|
|
56558
|
+
var NOT_HANDLED_DRAINING = "draining";
|
|
56559
|
+
|
|
56448
56560
|
// ../../packages/process/src/lifecycle/liveness-thread.ts
|
|
56449
56561
|
var LIVENESS_PATH = "/healthz";
|
|
56450
56562
|
var READINESS_PATH = "/readyz";
|
|
56451
56563
|
var HEARTBEAT_INTERVAL_MS = 1e3;
|
|
56452
56564
|
var HEARTBEAT_STALL_BUDGET_MS = 5 * 60 * 1e3;
|
|
56453
56565
|
var MAIN_THREAD_PROXY_TIMEOUT_MS = 1e4;
|
|
56566
|
+
var PUBLIC_LISTENER_TIMEOUTS = {
|
|
56567
|
+
/** Above the 60s idle reuse of ALB and nginx, so Node never closes a socket a proxy reuses. */
|
|
56568
|
+
keepAliveTimeout: 65e3,
|
|
56569
|
+
headersTimeout: 66e3,
|
|
56570
|
+
/** Two hours, not Node's 300s: a 5 GiB upload at about 6 Mbit/s, still bounding a slow body. */
|
|
56571
|
+
requestTimeout: 2 * 60 * 6e4
|
|
56572
|
+
};
|
|
56454
56573
|
var BIND_HANDOVER_MS = 1e4;
|
|
56455
56574
|
var HOP_BY_HOP_HEADERS = [
|
|
56456
56575
|
"connection",
|
|
@@ -56674,7 +56793,12 @@ const proxy = (req, res) => {
|
|
|
56674
56793
|
});
|
|
56675
56794
|
upstream.on("response", (reply) => {
|
|
56676
56795
|
clearInterval(timer);
|
|
56677
|
-
|
|
56796
|
+
const headers = endToEnd(reply.headers);
|
|
56797
|
+
// A draining main thread takes no new work: close this connection so the proxy goes elsewhere.
|
|
56798
|
+
if (reply.headers[workerData.notHandledHeader] === workerData.notHandledDraining) {
|
|
56799
|
+
headers.connection = "close";
|
|
56800
|
+
}
|
|
56801
|
+
res.writeHead(reply.statusCode ?? 502, headers);
|
|
56678
56802
|
reply.pipe(res);
|
|
56679
56803
|
});
|
|
56680
56804
|
upstream.on("error", () => {
|
|
@@ -56701,13 +56825,18 @@ server.on("upgrade", (req, socket, head) => {
|
|
|
56701
56825
|
upstream.on("error", () => socket.destroy());
|
|
56702
56826
|
socket.on("error", () => upstream.destroy());
|
|
56703
56827
|
});
|
|
56704
|
-
//
|
|
56705
|
-
|
|
56706
|
-
server.keepAliveTimeout = 65000;
|
|
56707
|
-
server.headersTimeout = 66000;
|
|
56828
|
+
// PUBLIC_LISTENER_TIMEOUTS: a proxy's idle reuse outlived, two hours for a request body.
|
|
56829
|
+
Object.assign(server, workerData.listenerTimeouts);
|
|
56708
56830
|
const deadline = Date.now() + workerData.handoverMs;
|
|
56709
56831
|
const bind = () => server.listen(workerData.port);
|
|
56710
|
-
|
|
56832
|
+
const listenerTimeouts = () => ({
|
|
56833
|
+
keepAliveTimeout: server.keepAliveTimeout,
|
|
56834
|
+
headersTimeout: server.headersTimeout,
|
|
56835
|
+
requestTimeout: server.requestTimeout,
|
|
56836
|
+
timeout: server.timeout,
|
|
56837
|
+
});
|
|
56838
|
+
server.on("listening", () =>
|
|
56839
|
+
parentPort.postMessage({ type: "listening", address: server.address(), listenerTimeouts: listenerTimeouts() }));
|
|
56711
56840
|
server.on("error", (error) => {
|
|
56712
56841
|
if (error.code === "EADDRINUSE" && Date.now() < deadline) {
|
|
56713
56842
|
setTimeout(bind, 250);
|
|
@@ -56787,13 +56916,17 @@ async function startLivenessThread({
|
|
|
56787
56916
|
wrongTokensPerMinute: UPGRADE_CONSOLE_WRONG_TOKENS_PER_MINUTE,
|
|
56788
56917
|
clientErrorStatusLines: CLIENT_ERROR_STATUS_LINES,
|
|
56789
56918
|
quietClientErrors: QUIET_CLIENT_ERROR_CODES,
|
|
56790
|
-
hopByHopHeaders: HOP_BY_HOP_HEADERS
|
|
56919
|
+
hopByHopHeaders: HOP_BY_HOP_HEADERS,
|
|
56920
|
+
notHandledHeader: NOT_HANDLED_HEADER,
|
|
56921
|
+
notHandledDraining: NOT_HANDLED_DRAINING,
|
|
56922
|
+
listenerTimeouts: PUBLIC_LISTENER_TIMEOUTS
|
|
56791
56923
|
}
|
|
56792
56924
|
});
|
|
56793
56925
|
thread.unref();
|
|
56794
56926
|
let address;
|
|
56927
|
+
let listenerTimeouts;
|
|
56795
56928
|
try {
|
|
56796
|
-
address = await
|
|
56929
|
+
({ address, listenerTimeouts } = await listening(thread));
|
|
56797
56930
|
} catch (error62) {
|
|
56798
56931
|
await thread.terminate();
|
|
56799
56932
|
throw error62;
|
|
@@ -56808,6 +56941,7 @@ async function startLivenessThread({
|
|
|
56808
56941
|
});
|
|
56809
56942
|
return {
|
|
56810
56943
|
address,
|
|
56944
|
+
listenerTimeouts,
|
|
56811
56945
|
proxyTo: async ({ port: proxyPort2, proxiesLiveness }) => {
|
|
56812
56946
|
const proxying = nextMessage({ thread, type: "proxying" });
|
|
56813
56947
|
thread.postMessage({ type: "proxyTo", port: proxyPort2, proxiesLiveness });
|
|
@@ -56859,13 +56993,13 @@ function nextMessage({ thread, type }) {
|
|
|
56859
56993
|
thread.on("message", onMessage2);
|
|
56860
56994
|
});
|
|
56861
56995
|
}
|
|
56862
|
-
function
|
|
56996
|
+
function listening(thread) {
|
|
56863
56997
|
return new Promise((resolve, reject) => {
|
|
56864
56998
|
const onExit2 = (code) => reject(new Error(`liveness thread exited before listening (code ${code})`));
|
|
56865
56999
|
const onMessage2 = (message) => {
|
|
56866
57000
|
if (message.type === "listening") {
|
|
56867
57001
|
settle2();
|
|
56868
|
-
resolve(message.address);
|
|
57002
|
+
resolve({ address: message.address, listenerTimeouts: message.listenerTimeouts });
|
|
56869
57003
|
}
|
|
56870
57004
|
if (message.type === "failed") {
|
|
56871
57005
|
settle2();
|
|
@@ -58307,140 +58441,6 @@ async function startAigateway(ctx, bus, envFromFile) {
|
|
|
58307
58441
|
return handle;
|
|
58308
58442
|
}
|
|
58309
58443
|
|
|
58310
|
-
// src/services/nlpgo.ts
|
|
58311
|
-
async function startNlpgo(ctx, bus, envFromFile) {
|
|
58312
|
-
bus.emit({ type: "starting", service: "nlpgo" });
|
|
58313
|
-
const start = nowInstant().epochMilliseconds;
|
|
58314
|
-
const binary = ctx.predeps.aigateway?.resolvedPath;
|
|
58315
|
-
if (!binary) throw new Error("aigateway/nlpgo monobinary predep not resolved");
|
|
58316
|
-
const sp = servicePaths(ctx.paths);
|
|
58317
|
-
const handle = supervise({
|
|
58318
|
-
spec: {
|
|
58319
|
-
name: "nlpgo",
|
|
58320
|
-
command: binary,
|
|
58321
|
-
args: ["nlpgo"],
|
|
58322
|
-
env: {
|
|
58323
|
-
...process.env,
|
|
58324
|
-
...envFromFile,
|
|
58325
|
-
SERVER_ADDR: `:${ctx.ports.nlp}`,
|
|
58326
|
-
// Engine pointer back to the langwatch app for evaluator +
|
|
58327
|
-
// agent-workflow callbacks. /api/* routes terminate inside the
|
|
58328
|
-
// langwatch process.
|
|
58329
|
-
NLPGO_ENGINE_LANGWATCH_BASE_URL: `http://127.0.0.1:${ctx.ports.backend}`,
|
|
58330
|
-
// OTel exporter target. Set explicitly for .env backward compat.
|
|
58331
|
-
LANGWATCH_ENDPOINT: `http://127.0.0.1:${ctx.ports.backend}`,
|
|
58332
|
-
LOG_FORMAT: "pretty",
|
|
58333
|
-
LOG_LEVEL: ctx.logLevel ?? DEFAULT_LOG_LEVEL
|
|
58334
|
-
}
|
|
58335
|
-
},
|
|
58336
|
-
paths: sp,
|
|
58337
|
-
bus
|
|
58338
|
-
});
|
|
58339
|
-
const ready = await pollUntilHealthy({
|
|
58340
|
-
handle,
|
|
58341
|
-
check: httpGetCheck(`http://127.0.0.1:${ctx.ports.nlp}/healthz`),
|
|
58342
|
-
timeoutMs: 3e4
|
|
58343
|
-
});
|
|
58344
|
-
if (!ready.ok) {
|
|
58345
|
-
await handle.stop();
|
|
58346
|
-
throw new Error(`nlpgo did not become healthy: ${ready.reason}`);
|
|
58347
|
-
}
|
|
58348
|
-
bus.emit({
|
|
58349
|
-
type: "healthy",
|
|
58350
|
-
service: "nlpgo",
|
|
58351
|
-
durationMs: nowInstant().epochMilliseconds - start
|
|
58352
|
-
});
|
|
58353
|
-
return handle;
|
|
58354
|
-
}
|
|
58355
|
-
|
|
58356
|
-
// src/services/go-services.ts
|
|
58357
|
-
async function monobinaryOffers({
|
|
58358
|
-
binary,
|
|
58359
|
-
command
|
|
58360
|
-
}) {
|
|
58361
|
-
try {
|
|
58362
|
-
const { stdout, stderr } = await execa(binary, [], { reject: false, timeout: 5e3 });
|
|
58363
|
-
return `${stdout}
|
|
58364
|
-
${stderr}`.includes(command);
|
|
58365
|
-
} catch {
|
|
58366
|
-
return false;
|
|
58367
|
-
}
|
|
58368
|
-
}
|
|
58369
|
-
async function startGoServices(ctx, bus, envFromFile) {
|
|
58370
|
-
const binary = ctx.predeps.aigateway?.resolvedPath;
|
|
58371
|
-
if (!binary) throw new Error("aigateway/nlpgo monobinary predep not resolved");
|
|
58372
|
-
if (await monobinaryOffers({ binary, command: "combined" })) {
|
|
58373
|
-
return [await startCombined({ ctx, bus, binary, envFromFile })];
|
|
58374
|
-
}
|
|
58375
|
-
const results = await Promise.allSettled([
|
|
58376
|
-
startNlpgo(ctx, bus, envFromFile),
|
|
58377
|
-
startAigateway(ctx, bus, envFromFile)
|
|
58378
|
-
]);
|
|
58379
|
-
const started = results.flatMap((r) => r.status === "fulfilled" ? [r.value] : []);
|
|
58380
|
-
const failure2 = results.find((r) => r.status === "rejected");
|
|
58381
|
-
if (failure2) {
|
|
58382
|
-
await Promise.allSettled(started.map((handle) => handle.stop()));
|
|
58383
|
-
throw failure2.reason;
|
|
58384
|
-
}
|
|
58385
|
-
return started;
|
|
58386
|
-
}
|
|
58387
|
-
async function startCombined({
|
|
58388
|
-
ctx,
|
|
58389
|
-
bus,
|
|
58390
|
-
binary,
|
|
58391
|
-
envFromFile
|
|
58392
|
-
}) {
|
|
58393
|
-
bus.emit({ type: "starting", service: "go" });
|
|
58394
|
-
const start = nowInstant().epochMilliseconds;
|
|
58395
|
-
const app = `http://127.0.0.1:${ctx.ports.backend}`;
|
|
58396
|
-
const handle = supervise({
|
|
58397
|
-
spec: {
|
|
58398
|
-
name: "go",
|
|
58399
|
-
command: binary,
|
|
58400
|
-
args: ["combined", "nlpgo", "aigateway"],
|
|
58401
|
-
env: {
|
|
58402
|
-
...process.env,
|
|
58403
|
-
...envFromFile,
|
|
58404
|
-
// One process, two listeners: each service reads its own address (cmd/service/combined.go).
|
|
58405
|
-
LANGWATCH_GO_NLPGO_ADDR: `:${ctx.ports.nlp}`,
|
|
58406
|
-
LANGWATCH_GO_AIGATEWAY_ADDR: `:${ctx.ports.aigateway}`,
|
|
58407
|
-
// What startNlpgo and startAigateway each point back at the app.
|
|
58408
|
-
NLPGO_ENGINE_LANGWATCH_BASE_URL: app,
|
|
58409
|
-
LANGWATCH_ENDPOINT: app,
|
|
58410
|
-
LW_GATEWAY_BASE_URL: app,
|
|
58411
|
-
LOG_FORMAT: "pretty",
|
|
58412
|
-
LOG_LEVEL: ctx.logLevel ?? DEFAULT_LOG_LEVEL
|
|
58413
|
-
}
|
|
58414
|
-
},
|
|
58415
|
-
paths: servicePaths(ctx.paths),
|
|
58416
|
-
bus
|
|
58417
|
-
});
|
|
58418
|
-
const probes = await Promise.all(
|
|
58419
|
-
[ctx.ports.nlp, ctx.ports.aigateway].map(
|
|
58420
|
-
(port) => pollUntilHealthy({
|
|
58421
|
-
handle,
|
|
58422
|
-
check: httpGetCheck(`http://127.0.0.1:${port}/healthz`),
|
|
58423
|
-
timeoutMs: 3e4
|
|
58424
|
-
})
|
|
58425
|
-
)
|
|
58426
|
-
);
|
|
58427
|
-
const unhealthy = probes.find((probe) => !probe.ok);
|
|
58428
|
-
if (unhealthy && !unhealthy.ok) {
|
|
58429
|
-
await handle.stop();
|
|
58430
|
-
throw new Error(`nlpgo and aigateway did not become healthy: ${unhealthy.reason}`);
|
|
58431
|
-
}
|
|
58432
|
-
bus.emit({
|
|
58433
|
-
type: "healthy",
|
|
58434
|
-
service: "go",
|
|
58435
|
-
durationMs: nowInstant().epochMilliseconds - start
|
|
58436
|
-
});
|
|
58437
|
-
return handle;
|
|
58438
|
-
}
|
|
58439
|
-
|
|
58440
|
-
// src/services/langevals.ts
|
|
58441
|
-
var import_node_fs34 = require("node:fs");
|
|
58442
|
-
var import_node_path37 = require("node:path");
|
|
58443
|
-
|
|
58444
58444
|
// src/services/offline-defaults.ts
|
|
58445
58445
|
var import_node_crypto5 = require("node:crypto");
|
|
58446
58446
|
var import_node_fs33 = require("node:fs");
|
|
@@ -58536,6 +58536,12 @@ function appOfflineEnv(input2) {
|
|
|
58536
58536
|
NODE_COMPILE_CACHE: (0, import_node_path36.join)(input2.paths.root, "cache", "node-compile")
|
|
58537
58537
|
};
|
|
58538
58538
|
}
|
|
58539
|
+
function modelCatalogDir({ appRootDir }) {
|
|
58540
|
+
return (0, import_node_path36.join)(appRootDir, "modules", "model-provider", "contract", "src", "catalog");
|
|
58541
|
+
}
|
|
58542
|
+
function nlpgoOfflineEnv({ appRootDir }) {
|
|
58543
|
+
return { LANGWATCH_MODEL_CATALOG_DIR: modelCatalogDir({ appRootDir }) };
|
|
58544
|
+
}
|
|
58539
58545
|
function langevalsOfflineEnv({
|
|
58540
58546
|
paths: paths2,
|
|
58541
58547
|
appRootDir
|
|
@@ -58543,14 +58549,7 @@ function langevalsOfflineEnv({
|
|
|
58543
58549
|
const cache = offlineCachePaths({ paths: paths2, appRootDir }).tiktokenCache;
|
|
58544
58550
|
return {
|
|
58545
58551
|
RAGAS_DO_NOT_TRACK: "true",
|
|
58546
|
-
LANGWATCH_MODEL_PRICING_DIR: (
|
|
58547
|
-
appRootDir,
|
|
58548
|
-
"modules",
|
|
58549
|
-
"model-provider",
|
|
58550
|
-
"contract",
|
|
58551
|
-
"src",
|
|
58552
|
-
"catalog"
|
|
58553
|
-
),
|
|
58552
|
+
LANGWATCH_MODEL_PRICING_DIR: modelCatalogDir({ appRootDir }),
|
|
58554
58553
|
TIKTOKEN_CACHE_DIR: cache,
|
|
58555
58554
|
CUSTOM_TIKTOKEN_CACHE_DIR: cache
|
|
58556
58555
|
};
|
|
@@ -58662,7 +58661,143 @@ async function ensureLangevalsTiktokenCache({
|
|
|
58662
58661
|
}
|
|
58663
58662
|
}
|
|
58664
58663
|
|
|
58664
|
+
// src/services/nlpgo.ts
|
|
58665
|
+
async function startNlpgo(ctx, bus, envFromFile) {
|
|
58666
|
+
bus.emit({ type: "starting", service: "nlpgo" });
|
|
58667
|
+
const start = nowInstant().epochMilliseconds;
|
|
58668
|
+
const binary = ctx.predeps.aigateway?.resolvedPath;
|
|
58669
|
+
if (!binary) throw new Error("aigateway/nlpgo monobinary predep not resolved");
|
|
58670
|
+
const sp = servicePaths(ctx.paths);
|
|
58671
|
+
const handle = supervise({
|
|
58672
|
+
spec: {
|
|
58673
|
+
name: "nlpgo",
|
|
58674
|
+
command: binary,
|
|
58675
|
+
args: ["nlpgo"],
|
|
58676
|
+
env: {
|
|
58677
|
+
// Defaults first so the user's shell and .env override them.
|
|
58678
|
+
...nlpgoOfflineEnv({ appRootDir: appRoot() }),
|
|
58679
|
+
...process.env,
|
|
58680
|
+
...envFromFile,
|
|
58681
|
+
SERVER_ADDR: `:${ctx.ports.nlp}`,
|
|
58682
|
+
// Engine pointer back to the langwatch app for evaluator +
|
|
58683
|
+
// agent-workflow callbacks. /api/* routes terminate inside the
|
|
58684
|
+
// langwatch process.
|
|
58685
|
+
NLPGO_ENGINE_LANGWATCH_BASE_URL: `http://127.0.0.1:${ctx.ports.backend}`,
|
|
58686
|
+
// OTel exporter target. Set explicitly for .env backward compat.
|
|
58687
|
+
LANGWATCH_ENDPOINT: `http://127.0.0.1:${ctx.ports.backend}`,
|
|
58688
|
+
LOG_FORMAT: "pretty",
|
|
58689
|
+
LOG_LEVEL: ctx.logLevel ?? DEFAULT_LOG_LEVEL
|
|
58690
|
+
}
|
|
58691
|
+
},
|
|
58692
|
+
paths: sp,
|
|
58693
|
+
bus
|
|
58694
|
+
});
|
|
58695
|
+
const ready = await pollUntilHealthy({
|
|
58696
|
+
handle,
|
|
58697
|
+
check: httpGetCheck(`http://127.0.0.1:${ctx.ports.nlp}/healthz`),
|
|
58698
|
+
timeoutMs: 3e4
|
|
58699
|
+
});
|
|
58700
|
+
if (!ready.ok) {
|
|
58701
|
+
await handle.stop();
|
|
58702
|
+
throw new Error(`nlpgo did not become healthy: ${ready.reason}`);
|
|
58703
|
+
}
|
|
58704
|
+
bus.emit({
|
|
58705
|
+
type: "healthy",
|
|
58706
|
+
service: "nlpgo",
|
|
58707
|
+
durationMs: nowInstant().epochMilliseconds - start
|
|
58708
|
+
});
|
|
58709
|
+
return handle;
|
|
58710
|
+
}
|
|
58711
|
+
|
|
58712
|
+
// src/services/go-services.ts
|
|
58713
|
+
async function monobinaryOffers({
|
|
58714
|
+
binary,
|
|
58715
|
+
command
|
|
58716
|
+
}) {
|
|
58717
|
+
try {
|
|
58718
|
+
const { stdout, stderr } = await execa(binary, [], { reject: false, timeout: 5e3 });
|
|
58719
|
+
return `${stdout}
|
|
58720
|
+
${stderr}`.includes(command);
|
|
58721
|
+
} catch {
|
|
58722
|
+
return false;
|
|
58723
|
+
}
|
|
58724
|
+
}
|
|
58725
|
+
async function startGoServices(ctx, bus, envFromFile) {
|
|
58726
|
+
const binary = ctx.predeps.aigateway?.resolvedPath;
|
|
58727
|
+
if (!binary) throw new Error("aigateway/nlpgo monobinary predep not resolved");
|
|
58728
|
+
if (await monobinaryOffers({ binary, command: "combined" })) {
|
|
58729
|
+
return [await startCombined({ ctx, bus, binary, envFromFile })];
|
|
58730
|
+
}
|
|
58731
|
+
const results = await Promise.allSettled([
|
|
58732
|
+
startNlpgo(ctx, bus, envFromFile),
|
|
58733
|
+
startAigateway(ctx, bus, envFromFile)
|
|
58734
|
+
]);
|
|
58735
|
+
const started = results.flatMap((r) => r.status === "fulfilled" ? [r.value] : []);
|
|
58736
|
+
const failure2 = results.find((r) => r.status === "rejected");
|
|
58737
|
+
if (failure2) {
|
|
58738
|
+
await Promise.allSettled(started.map((handle) => handle.stop()));
|
|
58739
|
+
throw failure2.reason;
|
|
58740
|
+
}
|
|
58741
|
+
return started;
|
|
58742
|
+
}
|
|
58743
|
+
async function startCombined({
|
|
58744
|
+
ctx,
|
|
58745
|
+
bus,
|
|
58746
|
+
binary,
|
|
58747
|
+
envFromFile
|
|
58748
|
+
}) {
|
|
58749
|
+
bus.emit({ type: "starting", service: "go" });
|
|
58750
|
+
const start = nowInstant().epochMilliseconds;
|
|
58751
|
+
const app = `http://127.0.0.1:${ctx.ports.backend}`;
|
|
58752
|
+
const handle = supervise({
|
|
58753
|
+
spec: {
|
|
58754
|
+
name: "go",
|
|
58755
|
+
command: binary,
|
|
58756
|
+
args: ["combined", "nlpgo", "aigateway"],
|
|
58757
|
+
env: {
|
|
58758
|
+
// Defaults first so the user's shell and .env override them.
|
|
58759
|
+
...nlpgoOfflineEnv({ appRootDir: appRoot() }),
|
|
58760
|
+
...process.env,
|
|
58761
|
+
...envFromFile,
|
|
58762
|
+
// One process, two listeners: each service reads its own address (cmd/service/combined.go).
|
|
58763
|
+
LANGWATCH_GO_NLPGO_ADDR: `:${ctx.ports.nlp}`,
|
|
58764
|
+
LANGWATCH_GO_AIGATEWAY_ADDR: `:${ctx.ports.aigateway}`,
|
|
58765
|
+
// What startNlpgo and startAigateway each point back at the app.
|
|
58766
|
+
NLPGO_ENGINE_LANGWATCH_BASE_URL: app,
|
|
58767
|
+
LANGWATCH_ENDPOINT: app,
|
|
58768
|
+
LW_GATEWAY_BASE_URL: app,
|
|
58769
|
+
LOG_FORMAT: "pretty",
|
|
58770
|
+
LOG_LEVEL: ctx.logLevel ?? DEFAULT_LOG_LEVEL
|
|
58771
|
+
}
|
|
58772
|
+
},
|
|
58773
|
+
paths: servicePaths(ctx.paths),
|
|
58774
|
+
bus
|
|
58775
|
+
});
|
|
58776
|
+
const probes = await Promise.all(
|
|
58777
|
+
[ctx.ports.nlp, ctx.ports.aigateway].map(
|
|
58778
|
+
(port) => pollUntilHealthy({
|
|
58779
|
+
handle,
|
|
58780
|
+
check: httpGetCheck(`http://127.0.0.1:${port}/healthz`),
|
|
58781
|
+
timeoutMs: 3e4
|
|
58782
|
+
})
|
|
58783
|
+
)
|
|
58784
|
+
);
|
|
58785
|
+
const unhealthy = probes.find((probe) => !probe.ok);
|
|
58786
|
+
if (unhealthy && !unhealthy.ok) {
|
|
58787
|
+
await handle.stop();
|
|
58788
|
+
throw new Error(`nlpgo and aigateway did not become healthy: ${unhealthy.reason}`);
|
|
58789
|
+
}
|
|
58790
|
+
bus.emit({
|
|
58791
|
+
type: "healthy",
|
|
58792
|
+
service: "go",
|
|
58793
|
+
durationMs: nowInstant().epochMilliseconds - start
|
|
58794
|
+
});
|
|
58795
|
+
return handle;
|
|
58796
|
+
}
|
|
58797
|
+
|
|
58665
58798
|
// src/services/langevals.ts
|
|
58799
|
+
var import_node_fs34 = require("node:fs");
|
|
58800
|
+
var import_node_path37 = require("node:path");
|
|
58666
58801
|
async function startLangevals(ctx, bus, envFromFile) {
|
|
58667
58802
|
bus.emit({ type: "starting", service: "langevals" });
|
|
58668
58803
|
const start = nowInstant().epochMilliseconds;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langwatch/server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"description": "Run LangWatch locally with one command — `npx @langwatch/server`. Complete LangWatch stack: observability, evaluations, AI gateway, agent simulations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|