@teyik0/furin 0.4.0-alpha.2 → 0.5.0-alpha.1
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/build/compile-entry.d.ts +2 -1
- package/dist/build/compile-entry.ts +17 -13
- package/dist/build/elysia-aot.d.ts +9 -0
- package/dist/build/entry-template.d.ts +5 -1
- package/dist/build/entry-template.ts +24 -5
- package/dist/build/index.js +753 -453
- package/dist/build/server-app-entry.d.ts +12 -0
- package/dist/cache.d.ts +1 -0
- package/dist/cache.js +185 -0
- package/dist/cli/index.js +766 -466
- package/dist/client/internal/runtime-types.d.ts +8 -1
- package/dist/client/link.js +221 -11
- package/dist/client/sync.d.ts +1 -0
- package/dist/config.d.ts +22 -21
- package/dist/config.js +1 -1
- package/dist/define-route.d.ts +273 -1009
- package/dist/furin.d.ts +20 -5
- package/dist/furin.js +6222 -5383
- package/dist/plugin/routes.d.ts +6 -0
- package/dist/server/assets/production.d.ts +3 -0
- package/dist/server/auto-invalidate/plugin.d.ts +8 -24
- package/dist/server/auto-invalidate/runtime.d.ts +2 -2
- package/dist/server/cache/invalidation.d.ts +1 -1
- package/dist/server/cache/page-cache-state.d.ts +5 -0
- package/dist/server/cache/page-cache.d.ts +53 -0
- package/dist/server/cache/redis/index.d.ts +39 -0
- package/dist/server/cache/redis/index.js +396 -0
- package/dist/server/cache/redis/scripts.d.ts +6 -0
- package/dist/server/context-logger.d.ts +2 -2
- package/dist/server/dev/runtime.production.d.ts +1 -0
- package/dist/server/dev-page-plugin.d.ts +7 -0
- package/dist/server/evlog.d.ts +14 -0
- package/dist/server/internal.d.ts +6 -0
- package/dist/server/internal.js +2537 -0
- package/dist/server/render/not-found.d.ts +1 -1
- package/dist/server/render/ssg.d.ts +5 -0
- package/dist/server/render/static-params.d.ts +4 -0
- package/dist/server/router/defined-route.d.ts +1 -1
- package/dist/server/router/schemas.d.ts +1 -0
- package/dist/server/sync/index.js +794 -116
- package/dist/server/sync/plugin.d.ts +31 -158
- package/dist/server/sync/stream.d.ts +34 -49
- package/dist/shared/elysia-contract.d.ts +8 -14
- package/package.json +13 -7
- package/src/adapter/README.md +9 -2
- package/src/adapter/bun.ts +73 -27
- package/src/adapter/package.ts +6 -2
- package/src/adapter/runtime-build.ts +11 -4
- package/src/adapter/static.ts +8 -6
- package/src/adapter/vercel.ts +49 -30
- package/src/build/client.ts +18 -1
- package/src/build/compile-entry.ts +17 -13
- package/src/build/elysia-aot.ts +102 -0
- package/src/build/entry-template.ts +24 -5
- package/src/build/index.ts +0 -5
- package/src/build/production-instrumentation.ts +2 -2
- package/src/build/server-app-entry.ts +60 -0
- package/src/build/shared.ts +3 -1
- package/src/build/ssg-cache.ts +5 -10
- package/src/build/virtual-entry.ts +5 -4
- package/src/cache.ts +12 -0
- package/src/cli/config.ts +3 -3
- package/src/cli/index.ts +5 -2
- package/src/client/internal/runtime-types.ts +10 -1
- package/src/client/sync.ts +1 -0
- package/src/config.ts +3 -2
- package/src/define-route.ts +266 -128
- package/src/furin.ts +138 -149
- package/src/plugin/route-config-autofix.ts +11 -2
- package/src/plugin/routes.ts +85 -29
- package/src/server/assets/production.ts +99 -0
- package/src/server/auto-invalidate/plugin.ts +4 -4
- package/src/server/auto-invalidate/runtime.ts +74 -42
- package/src/server/browser-events/plugin.ts +6 -1
- package/src/server/cache/invalidation.ts +61 -20
- package/src/server/cache/page-cache-state.ts +22 -0
- package/src/server/cache/page-cache.ts +300 -0
- package/src/server/cache/redis/index.ts +350 -0
- package/src/server/cache/redis/scripts.ts +160 -0
- package/src/server/context-logger.ts +5 -5
- package/src/server/dev/runtime.production.ts +4 -0
- package/src/server/dev-page-plugin.ts +54 -10
- package/src/server/evlog.ts +99 -0
- package/src/server/internal.ts +7 -0
- package/src/server/render/isr.ts +480 -132
- package/src/server/render/loaders.ts +18 -12
- package/src/server/render/not-found.ts +4 -4
- package/src/server/render/ppr-document.ts +2 -2
- package/src/server/render/ppr-route.ts +193 -7
- package/src/server/render/ssg.ts +148 -4
- package/src/server/render/ssr.ts +4 -6
- package/src/server/render/static-params.ts +174 -0
- package/src/server/router/defined-route.ts +2 -1
- package/src/server/router/hmr.ts +2 -0
- package/src/server/router/plugin.ts +44 -35
- package/src/server/router/schema-merge.ts +1 -1
- package/src/server/router/schemas.ts +174 -61
- package/src/server/sync/plugin.ts +14 -10
- package/src/server/sync/response.ts +3 -3
- package/src/shared/elysia-contract.ts +23 -25
|
@@ -3,6 +3,12 @@ import type { HeadOptions, RenderingMode } from "../../client.ts";
|
|
|
3
3
|
import type { RequestLoaderContext } from "../../define-route.ts";
|
|
4
4
|
export type RuntimeData = Record<string, unknown>;
|
|
5
5
|
type Awaitable<T> = Promise<T> | T;
|
|
6
|
+
export interface RuntimeParams {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}
|
|
9
|
+
export type RuntimeStaticParams = (context: RuntimeData & {
|
|
10
|
+
params: RuntimeParams;
|
|
11
|
+
}) => Awaitable<readonly RuntimeParams[]>;
|
|
6
12
|
export interface RuntimeRoute {
|
|
7
13
|
__type: "FURIN_ROUTE";
|
|
8
14
|
layout?: React.FC<RuntimeData & {
|
|
@@ -16,6 +22,7 @@ export interface RuntimeRoute {
|
|
|
16
22
|
requestLoader?: (ctx: RequestLoaderContext) => Awaitable<object>;
|
|
17
23
|
revalidate?: number;
|
|
18
24
|
sourcePath?: string;
|
|
25
|
+
staticParams?: RuntimeStaticParams;
|
|
19
26
|
tags?: string[];
|
|
20
27
|
}
|
|
21
28
|
export interface RuntimePage {
|
|
@@ -26,7 +33,7 @@ export interface RuntimePage {
|
|
|
26
33
|
loader?: (ctx: RuntimeData) => Awaitable<RuntimeData>;
|
|
27
34
|
mode?: RenderingMode;
|
|
28
35
|
revalidate?: number;
|
|
29
|
-
staticParams?:
|
|
36
|
+
staticParams?: RuntimeStaticParams;
|
|
30
37
|
tags?: string[];
|
|
31
38
|
}
|
|
32
39
|
export {};
|
package/dist/client/link.js
CHANGED
|
@@ -1037,12 +1037,15 @@ function useNavigate() {
|
|
|
1037
1037
|
return router.navigate(href, opts);
|
|
1038
1038
|
}, [router]);
|
|
1039
1039
|
}
|
|
1040
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1040
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/utils.mjs
|
|
1041
1041
|
function formatDuration(ms) {
|
|
1042
1042
|
if (ms < 1000)
|
|
1043
1043
|
return `${Math.round(ms)}ms`;
|
|
1044
1044
|
return `${(ms / 1000).toFixed(2)}s`;
|
|
1045
1045
|
}
|
|
1046
|
+
function isServer() {
|
|
1047
|
+
return typeof window === "undefined";
|
|
1048
|
+
}
|
|
1046
1049
|
function isBrowser() {
|
|
1047
1050
|
if (typeof window === "undefined")
|
|
1048
1051
|
return false;
|
|
@@ -1161,7 +1164,7 @@ function isoNow() {
|
|
|
1161
1164
|
return `${_isoCachedPrefix}.${String(now % 1000).padStart(3, "0")}Z`;
|
|
1162
1165
|
}
|
|
1163
1166
|
|
|
1164
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1167
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/redact-C7FmdhwI.mjs
|
|
1165
1168
|
var DEFAULT_REPLACEMENT = "[REDACTED]";
|
|
1166
1169
|
function normalizeRedactPathPattern(pattern) {
|
|
1167
1170
|
if (!pattern.includes("*") && !pattern.includes("."))
|
|
@@ -1464,7 +1467,7 @@ function applyMaskers(value, maskers) {
|
|
|
1464
1467
|
return result;
|
|
1465
1468
|
}
|
|
1466
1469
|
|
|
1467
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1470
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/globalRegistry-Bh3bIGwA.mjs
|
|
1468
1471
|
function logPluginError(name, hook, err) {
|
|
1469
1472
|
console.error(`[evlog/${name}] ${hook} failed:`, err);
|
|
1470
1473
|
}
|
|
@@ -1622,7 +1625,7 @@ function getRegistry() {
|
|
|
1622
1625
|
}
|
|
1623
1626
|
var globalConfig = getRegistry().config;
|
|
1624
1627
|
|
|
1625
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1628
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/pretty-error-D8rlWNL1.mjs
|
|
1626
1629
|
var snippetReader = null;
|
|
1627
1630
|
var PRETTY_ERROR_TREE_SPACER = "__EVLOG_TREE_SPACER__";
|
|
1628
1631
|
function pushTreeSpacer(children) {
|
|
@@ -1721,6 +1724,17 @@ function formatDisplayPath(file, cwd) {
|
|
|
1721
1724
|
return decoded.slice(srcIdx + 1);
|
|
1722
1725
|
return decoded;
|
|
1723
1726
|
}
|
|
1727
|
+
function compactStackForStorage(stack, maxFrames = 5) {
|
|
1728
|
+
if (!stack)
|
|
1729
|
+
return;
|
|
1730
|
+
const head = stack.split(`
|
|
1731
|
+
`)[0] ?? "";
|
|
1732
|
+
const useful = parseStackFrames(stack).filter((f) => f.file && f.line && f.isApp && !isInternalErrorFrame(f)).slice(0, maxFrames);
|
|
1733
|
+
if (useful.length === 0)
|
|
1734
|
+
return stack;
|
|
1735
|
+
return [head, ...useful.map((f) => f.raw)].join(`
|
|
1736
|
+
`);
|
|
1737
|
+
}
|
|
1724
1738
|
function parseStackFrames(stack) {
|
|
1725
1739
|
if (!stack)
|
|
1726
1740
|
return [];
|
|
@@ -1844,7 +1858,7 @@ function formatGuidanceLine(label, text, labelColor) {
|
|
|
1844
1858
|
let remaining = text.trim();
|
|
1845
1859
|
let first = true;
|
|
1846
1860
|
while (remaining.length > 0) {
|
|
1847
|
-
const budget = first ? Math.max(24, GUIDANCE_WRAP_WIDTH - prefix.length) : Math.max(24,
|
|
1861
|
+
const budget = first ? Math.max(24, GUIDANCE_WRAP_WIDTH - prefix.length) : Math.max(24, 71);
|
|
1848
1862
|
if (remaining.length <= budget) {
|
|
1849
1863
|
lines.push(first ? `${prefix}${remaining}` : `${GUIDANCE_CONTINUATION}${remaining}`);
|
|
1850
1864
|
break;
|
|
@@ -1912,7 +1926,7 @@ function buildErrorEntries(error, options = {}) {
|
|
|
1912
1926
|
}];
|
|
1913
1927
|
}
|
|
1914
1928
|
|
|
1915
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1929
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/dev-terminal-Brarc6vc.mjs
|
|
1916
1930
|
var DEV_PRESETS = {
|
|
1917
1931
|
evlog: {
|
|
1918
1932
|
frameworkOverlay: false,
|
|
@@ -1961,7 +1975,7 @@ function resolveDevTerminal(input = {}) {
|
|
|
1961
1975
|
};
|
|
1962
1976
|
}
|
|
1963
1977
|
|
|
1964
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1978
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/wideEventChannel-BUDW48oP.mjs
|
|
1965
1979
|
var publisher = null;
|
|
1966
1980
|
function publishWideEvent(event) {
|
|
1967
1981
|
if (!publisher)
|
|
@@ -1973,7 +1987,117 @@ function publishWideEvent(event) {
|
|
|
1973
1987
|
}
|
|
1974
1988
|
}
|
|
1975
1989
|
|
|
1976
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1990
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/error-brand-D0-DCPvr.mjs
|
|
1991
|
+
var evlogErrorBrand = Symbol.for("evlog.error.brand");
|
|
1992
|
+
function isEvlogError(error) {
|
|
1993
|
+
return typeof error === "object" && error !== null && error[evlogErrorBrand] === true;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/error.mjs
|
|
1997
|
+
var evlogErrorInternalKey = Symbol.for("evlog.error.internal");
|
|
1998
|
+
var evlogErrorDataKey = Symbol.for("evlog.error.data");
|
|
1999
|
+
var EvlogError = class EvlogError extends Error {
|
|
2000
|
+
static isEvlogError(error) {
|
|
2001
|
+
return isEvlogError(error);
|
|
2002
|
+
}
|
|
2003
|
+
code;
|
|
2004
|
+
status;
|
|
2005
|
+
why;
|
|
2006
|
+
fix;
|
|
2007
|
+
link;
|
|
2008
|
+
get internal() {
|
|
2009
|
+
return this[evlogErrorInternalKey];
|
|
2010
|
+
}
|
|
2011
|
+
constructor(options) {
|
|
2012
|
+
const opts = typeof options === "string" ? { message: options } : options;
|
|
2013
|
+
super(opts.message, { cause: opts.cause });
|
|
2014
|
+
this.name = "EvlogError";
|
|
2015
|
+
this.code = opts.code;
|
|
2016
|
+
this.status = opts.status ?? 500;
|
|
2017
|
+
this.why = opts.why;
|
|
2018
|
+
this.fix = opts.fix;
|
|
2019
|
+
this.link = opts.link;
|
|
2020
|
+
if (opts.internal !== undefined)
|
|
2021
|
+
Object.defineProperty(this, evlogErrorInternalKey, {
|
|
2022
|
+
value: opts.internal,
|
|
2023
|
+
enumerable: false,
|
|
2024
|
+
writable: false,
|
|
2025
|
+
configurable: true
|
|
2026
|
+
});
|
|
2027
|
+
if (opts.data !== undefined)
|
|
2028
|
+
Object.defineProperty(this, evlogErrorDataKey, {
|
|
2029
|
+
value: opts.data,
|
|
2030
|
+
enumerable: false,
|
|
2031
|
+
writable: false,
|
|
2032
|
+
configurable: true
|
|
2033
|
+
});
|
|
2034
|
+
if (Error.captureStackTrace)
|
|
2035
|
+
Error.captureStackTrace(this, EvlogError);
|
|
2036
|
+
}
|
|
2037
|
+
get statusText() {
|
|
2038
|
+
return this.message;
|
|
2039
|
+
}
|
|
2040
|
+
get statusCode() {
|
|
2041
|
+
return this.status;
|
|
2042
|
+
}
|
|
2043
|
+
get statusMessage() {
|
|
2044
|
+
return this.message;
|
|
2045
|
+
}
|
|
2046
|
+
get data() {
|
|
2047
|
+
const extra = this[evlogErrorDataKey];
|
|
2048
|
+
if (!extra && !this.code && !this.why && !this.fix && !this.link)
|
|
2049
|
+
return;
|
|
2050
|
+
return {
|
|
2051
|
+
...extra,
|
|
2052
|
+
...this.code !== undefined && { code: this.code },
|
|
2053
|
+
...this.why !== undefined && { why: this.why },
|
|
2054
|
+
...this.fix !== undefined && { fix: this.fix },
|
|
2055
|
+
...this.link !== undefined && { link: this.link }
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
toString() {
|
|
2059
|
+
const useColors = isServer();
|
|
2060
|
+
const red = useColors ? colors.red : "";
|
|
2061
|
+
const yellow = useColors ? colors.yellow : "";
|
|
2062
|
+
const cyan = useColors ? colors.cyan : "";
|
|
2063
|
+
const dim = useColors ? colors.dim : "";
|
|
2064
|
+
const reset = useColors ? colors.reset : "";
|
|
2065
|
+
const bold = useColors ? colors.bold : "";
|
|
2066
|
+
const lines = [];
|
|
2067
|
+
lines.push(`${red}${bold}Error:${reset} ${this.message}`);
|
|
2068
|
+
if (this.code)
|
|
2069
|
+
lines.push(`${dim}Code:${reset} ${this.code}`);
|
|
2070
|
+
if (this.why)
|
|
2071
|
+
lines.push(`${yellow}Why:${reset} ${this.why}`);
|
|
2072
|
+
if (this.fix)
|
|
2073
|
+
lines.push(`${cyan}Fix:${reset} ${this.fix}`);
|
|
2074
|
+
if (this.link)
|
|
2075
|
+
lines.push(`${dim}More info:${reset} ${this.link}`);
|
|
2076
|
+
if (this.cause)
|
|
2077
|
+
lines.push(`${dim}Caused by:${reset} ${this.cause.message}`);
|
|
2078
|
+
return lines.join(`
|
|
2079
|
+
`);
|
|
2080
|
+
}
|
|
2081
|
+
toJSON() {
|
|
2082
|
+
const { data } = this;
|
|
2083
|
+
return {
|
|
2084
|
+
name: this.name,
|
|
2085
|
+
message: this.message,
|
|
2086
|
+
status: this.status,
|
|
2087
|
+
...data && { data },
|
|
2088
|
+
...this.cause instanceof Error && { cause: {
|
|
2089
|
+
name: this.cause.name,
|
|
2090
|
+
message: this.cause.message
|
|
2091
|
+
} }
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
Object.defineProperty(EvlogError.prototype, evlogErrorBrand, {
|
|
2096
|
+
value: true,
|
|
2097
|
+
enumerable: false
|
|
2098
|
+
});
|
|
2099
|
+
|
|
2100
|
+
// ../../node_modules/.bun/evlog@2.29.0+6594568e47c8e14b/node_modules/evlog/dist/audit-C8euLMvu.mjs
|
|
1977
2101
|
var nativeStdoutWrite = typeof process !== "undefined" && typeof process.stdout?.write === "function" ? process.stdout.write.bind(process.stdout) : undefined;
|
|
1978
2102
|
function writePrettyStdout(text) {
|
|
1979
2103
|
(globalThis.__evlogNativeStdoutWrite ?? nativeStdoutWrite)?.(text);
|
|
@@ -2056,13 +2180,14 @@ function emitWideEvent(level, event, options = {}) {
|
|
|
2056
2180
|
formatted = redactEvent(formatted, state.redact);
|
|
2057
2181
|
markGloballyRedacted(formatted);
|
|
2058
2182
|
}
|
|
2059
|
-
if (!state.silent)
|
|
2183
|
+
if (!state.silent) {
|
|
2060
2184
|
if (state.pretty)
|
|
2061
2185
|
prettyPrintWideEvent(formatted);
|
|
2062
2186
|
else if (state.stringify)
|
|
2063
2187
|
console[getConsoleMethod(level)](JSON.stringify(formatted));
|
|
2064
2188
|
else
|
|
2065
2189
|
console[getConsoleMethod(level)](formatted);
|
|
2190
|
+
}
|
|
2066
2191
|
if (!deferDrain) {
|
|
2067
2192
|
publishWideEvent(formatted);
|
|
2068
2193
|
const drainPromises = [];
|
|
@@ -2113,11 +2238,12 @@ function formatValue(value) {
|
|
|
2113
2238
|
if (isPlainObject$1(value)) {
|
|
2114
2239
|
const pairs = [];
|
|
2115
2240
|
for (const [k, v] of Object.entries(value))
|
|
2116
|
-
if (v !== undefined && v !== null)
|
|
2241
|
+
if (v !== undefined && v !== null) {
|
|
2117
2242
|
if (typeof v === "object")
|
|
2118
2243
|
pairs.push(`${k}=${JSON.stringify(v)}`);
|
|
2119
2244
|
else
|
|
2120
2245
|
pairs.push(`${k}=${v}`);
|
|
2246
|
+
}
|
|
2121
2247
|
return pairs.join(" ");
|
|
2122
2248
|
}
|
|
2123
2249
|
return String(value);
|
|
@@ -2172,6 +2298,22 @@ function asToolCallArray(value) {
|
|
|
2172
2298
|
return;
|
|
2173
2299
|
return value.every(isToolCallEntry) ? value : undefined;
|
|
2174
2300
|
}
|
|
2301
|
+
var CAPTURED_LINE_MAX_LENGTH = 160;
|
|
2302
|
+
var CAPTURED_MAX_LINES = 8;
|
|
2303
|
+
function asCapturedLines(value) {
|
|
2304
|
+
if (typeof value !== "string" || value.length === 0)
|
|
2305
|
+
return;
|
|
2306
|
+
const lines = value.split(`
|
|
2307
|
+
`).map((line) => {
|
|
2308
|
+
return line.length > CAPTURED_LINE_MAX_LENGTH ? `${line.slice(0, CAPTURED_LINE_MAX_LENGTH)}\u2026` : line;
|
|
2309
|
+
});
|
|
2310
|
+
if (lines.length > CAPTURED_MAX_LINES) {
|
|
2311
|
+
lines.length = CAPTURED_MAX_LINES;
|
|
2312
|
+
lines.push(`+${value.split(`
|
|
2313
|
+
`).length - CAPTURED_MAX_LINES} more lines (full text in the event)`);
|
|
2314
|
+
}
|
|
2315
|
+
return lines;
|
|
2316
|
+
}
|
|
2175
2317
|
function buildAIEntries(ai) {
|
|
2176
2318
|
const entries = [];
|
|
2177
2319
|
const headerParts = [];
|
|
@@ -2266,7 +2408,7 @@ function buildAIEntries(ai) {
|
|
|
2266
2408
|
value: "",
|
|
2267
2409
|
children
|
|
2268
2410
|
});
|
|
2269
|
-
} else if (toolCalls?.length)
|
|
2411
|
+
} else if (toolCalls?.length) {
|
|
2270
2412
|
if (toolCallEntries?.length) {
|
|
2271
2413
|
const children = toolCallEntries.map((tc) => {
|
|
2272
2414
|
const inputStr = serializeToolInput(tc.input);
|
|
@@ -2286,6 +2428,7 @@ function buildAIEntries(ai) {
|
|
|
2286
2428
|
value: names.join(", ")
|
|
2287
2429
|
});
|
|
2288
2430
|
}
|
|
2431
|
+
}
|
|
2289
2432
|
const stepsUsage = Array.isArray(ai.stepsUsage) ? ai.stepsUsage.filter(isPlainObject$1) : undefined;
|
|
2290
2433
|
if (stepsUsage?.length) {
|
|
2291
2434
|
const firstModel = stepsUsage[0]?.model;
|
|
@@ -2307,6 +2450,20 @@ function buildAIEntries(ai) {
|
|
|
2307
2450
|
key: "ai.steps",
|
|
2308
2451
|
value: String(steps)
|
|
2309
2452
|
});
|
|
2453
|
+
const promptLines = asCapturedLines(ai.prompt);
|
|
2454
|
+
if (promptLines)
|
|
2455
|
+
entries.push({
|
|
2456
|
+
key: "ai.prompt",
|
|
2457
|
+
value: "",
|
|
2458
|
+
children: promptLines
|
|
2459
|
+
});
|
|
2460
|
+
const outputLines = asCapturedLines(ai.output);
|
|
2461
|
+
if (outputLines)
|
|
2462
|
+
entries.push({
|
|
2463
|
+
key: "ai.output",
|
|
2464
|
+
value: "",
|
|
2465
|
+
children: outputLines
|
|
2466
|
+
});
|
|
2310
2467
|
const embedding = isPlainObject$1(ai.embedding) ? ai.embedding : undefined;
|
|
2311
2468
|
if (embedding) {
|
|
2312
2469
|
const parts = [];
|
|
@@ -2457,10 +2614,63 @@ function prettyPrintWideEvent(event) {
|
|
|
2457
2614
|
if (!browser && lines.length > 0)
|
|
2458
2615
|
flushPrettyLines(lines);
|
|
2459
2616
|
}
|
|
2617
|
+
function removeErrorCycles(value, ancestors) {
|
|
2618
|
+
if (value === null || typeof value !== "object")
|
|
2619
|
+
return value;
|
|
2620
|
+
if (ancestors.has(value))
|
|
2621
|
+
return "[Circular]";
|
|
2622
|
+
ancestors.add(value);
|
|
2623
|
+
let changed = false;
|
|
2624
|
+
const visit = (item) => {
|
|
2625
|
+
const result = removeErrorCycles(item, ancestors);
|
|
2626
|
+
if (!Object.is(result, item))
|
|
2627
|
+
changed = true;
|
|
2628
|
+
return result;
|
|
2629
|
+
};
|
|
2630
|
+
const copy = Array.isArray(value) ? value.map(visit) : Object.fromEntries(Object.entries(value).map(([key, item]) => [key, visit(item)]));
|
|
2631
|
+
ancestors.delete(value);
|
|
2632
|
+
return changed ? copy : value;
|
|
2633
|
+
}
|
|
2634
|
+
function serializeError(err) {
|
|
2635
|
+
const errorObj = {
|
|
2636
|
+
name: err.name,
|
|
2637
|
+
message: err.message,
|
|
2638
|
+
stack: isDev() ? compactStackForStorage(err.stack) : err.stack
|
|
2639
|
+
};
|
|
2640
|
+
const errRecord = err;
|
|
2641
|
+
const ancestors = new WeakSet([err]);
|
|
2642
|
+
for (const k of [
|
|
2643
|
+
"code",
|
|
2644
|
+
"status",
|
|
2645
|
+
"statusText",
|
|
2646
|
+
"statusCode",
|
|
2647
|
+
"statusMessage",
|
|
2648
|
+
"data",
|
|
2649
|
+
"cause",
|
|
2650
|
+
"internal"
|
|
2651
|
+
])
|
|
2652
|
+
if (k in err)
|
|
2653
|
+
errorObj[k] = removeErrorCycles(errRecord[k], ancestors);
|
|
2654
|
+
if (EvlogError.isEvlogError(err)) {
|
|
2655
|
+
if (err.code)
|
|
2656
|
+
errorObj.code = err.code;
|
|
2657
|
+
if (err.why)
|
|
2658
|
+
errorObj.why = err.why;
|
|
2659
|
+
if (err.fix)
|
|
2660
|
+
errorObj.fix = err.fix;
|
|
2661
|
+
if (err.link)
|
|
2662
|
+
errorObj.link = err.link;
|
|
2663
|
+
if (err.status)
|
|
2664
|
+
errorObj.status = err.status;
|
|
2665
|
+
}
|
|
2666
|
+
return errorObj;
|
|
2667
|
+
}
|
|
2460
2668
|
function createLogMethod(level) {
|
|
2461
2669
|
return function logMethod(tagOrEvent, message) {
|
|
2462
2670
|
if (typeof tagOrEvent === "string" && message !== undefined)
|
|
2463
2671
|
emitTaggedLog(level, tagOrEvent, message);
|
|
2672
|
+
else if (tagOrEvent instanceof Error)
|
|
2673
|
+
emitWideEvent(level, { error: serializeError(tagOrEvent) });
|
|
2464
2674
|
else if (typeof tagOrEvent === "object")
|
|
2465
2675
|
emitWideEvent(level, tagOrEvent);
|
|
2466
2676
|
else
|
package/dist/client/sync.d.ts
CHANGED
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BunPlugin } from "bun";
|
|
2
|
-
|
|
2
|
+
import type { Static } from "typebox";
|
|
3
|
+
export declare const BUILD_TARGETS: readonly ["bun", "vercel", "static", "package"];
|
|
3
4
|
export type BuildTarget = (typeof BUILD_TARGETS)[number];
|
|
4
5
|
/**
|
|
5
6
|
* Configuration for the `static` build target.
|
|
@@ -30,18 +31,18 @@ export interface VercelDeploymentConfig {
|
|
|
30
31
|
/** Vercel compute regions, such as "cdg1" or "iad1". */
|
|
31
32
|
regions?: string[];
|
|
32
33
|
}
|
|
33
|
-
export declare const configSchema: import("
|
|
34
|
+
export declare const configSchema: import("typebox").TObject<{
|
|
34
35
|
/**
|
|
35
36
|
* Multi-instance builds: one entry per mounted furin app. Overrides
|
|
36
37
|
* `pagesDir` and server-entry auto-detection. `prefix` must match the
|
|
37
38
|
* `furin({ prefix })` the app is mounted with (`""`/absent = root).
|
|
38
39
|
*/
|
|
39
|
-
apps: import("
|
|
40
|
-
pagesDir: import("
|
|
41
|
-
prefix: import("
|
|
40
|
+
apps: import("typebox").TOptional<import("typebox").TArray<import("typebox").TObject<{
|
|
41
|
+
pagesDir: import("typebox").TString;
|
|
42
|
+
prefix: import("typebox").TOptional<import("typebox").TString>;
|
|
42
43
|
}>>>;
|
|
43
|
-
bun: import("
|
|
44
|
-
compile: import("
|
|
44
|
+
bun: import("typebox").TOptional<import("typebox").TObject<{
|
|
45
|
+
compile: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<"server">, import("typebox").TLiteral<"embed">]>>;
|
|
45
46
|
}>>;
|
|
46
47
|
/**
|
|
47
48
|
* Initialize the browser HTTP log drain in the hydration entry. Off by
|
|
@@ -49,34 +50,34 @@ export declare const configSchema: import("@sinclair/typebox").TObject<{
|
|
|
49
50
|
* events at `/_furin/ingest`. Server-side logging is unaffected (configured
|
|
50
51
|
* via the `furin({ logger })` plugin option).
|
|
51
52
|
*/
|
|
52
|
-
clientLogging: import("
|
|
53
|
+
clientLogging: import("typebox").TOptional<import("typebox").TBoolean>;
|
|
53
54
|
/**
|
|
54
55
|
* Package barrels Bun should parse on demand in production client bundles.
|
|
55
56
|
* Packages declaring `sideEffects: false` are optimized automatically.
|
|
56
57
|
*/
|
|
57
|
-
optimizeImports: import("
|
|
58
|
-
pagesDir: import("
|
|
58
|
+
optimizeImports: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
59
|
+
pagesDir: import("typebox").TOptional<import("typebox").TString>;
|
|
59
60
|
/**
|
|
60
61
|
* Enable Bun's native Rust React Compiler for production client bundles.
|
|
61
62
|
* Enabled by default.
|
|
62
63
|
*/
|
|
63
|
-
reactCompiler: import("
|
|
64
|
-
rootDir: import("
|
|
65
|
-
serverEntry: import("
|
|
66
|
-
static: import("
|
|
67
|
-
basePath: import("
|
|
68
|
-
onSSR: import("
|
|
69
|
-
outDir: import("
|
|
64
|
+
reactCompiler: import("typebox").TOptional<import("typebox").TBoolean>;
|
|
65
|
+
rootDir: import("typebox").TOptional<import("typebox").TString>;
|
|
66
|
+
serverEntry: import("typebox").TOptional<import("typebox").TString>;
|
|
67
|
+
static: import("typebox").TOptional<import("typebox").TObject<{
|
|
68
|
+
basePath: import("typebox").TOptional<import("typebox").TString>;
|
|
69
|
+
onSSR: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TLiteral<"error">, import("typebox").TLiteral<"skip">]>>;
|
|
70
|
+
outDir: import("typebox").TOptional<import("typebox").TString>;
|
|
70
71
|
}>>;
|
|
71
|
-
targets: import("
|
|
72
|
-
vercel: import("
|
|
73
|
-
regions: import("
|
|
72
|
+
targets: import("typebox").TOptional<import("typebox").TArray<import("typebox").TUnion<import("typebox").TLiteral<"bun" | "package" | "static" | "vercel">[]>>>;
|
|
73
|
+
vercel: import("typebox").TOptional<import("typebox").TObject<{
|
|
74
|
+
regions: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
74
75
|
}>>;
|
|
75
76
|
}>;
|
|
76
77
|
export type FurinPlugin = BunPlugin & {
|
|
77
78
|
buildOnly?: boolean;
|
|
78
79
|
};
|
|
79
|
-
export type FurinConfig =
|
|
80
|
+
export type FurinConfig = Static<typeof configSchema> & {
|
|
80
81
|
plugins?: FurinPlugin[];
|
|
81
82
|
static?: StaticExportConfig;
|
|
82
83
|
};
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/config.ts
|
|
3
3
|
import { t } from "elysia";
|
|
4
|
-
var BUILD_TARGETS = ["bun", "
|
|
4
|
+
var BUILD_TARGETS = ["bun", "vercel", "static", "package"];
|
|
5
5
|
var buildTargetSchema = t.Union(BUILD_TARGETS.map((v) => t.Literal(v)));
|
|
6
6
|
var compileTargetSchema = t.Union([t.Literal("server"), t.Literal("embed")]);
|
|
7
7
|
var configSchema = t.Object({
|