gemi 0.199.0 → 0.200.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.
Files changed (41) hide show
  1. package/dist/ai/AgentController.d.ts.map +1 -1
  2. package/dist/ai/client/index.js +2 -1
  3. package/dist/ai/client/index.js.map +1 -1
  4. package/dist/ai/index.js +10 -10
  5. package/dist/ai/index.js.map +3 -3
  6. package/dist/ai/useChat.d.ts +5 -0
  7. package/dist/ai/useChat.d.ts.map +1 -1
  8. package/dist/{chunk-mzns19hy.js → chunk-8nmcyavt.js} +1 -1
  9. package/dist/{chunk-gknvmhby.js → chunk-c9259a9e.js} +2 -2
  10. package/dist/{chunk-gknvmhby.js.map → chunk-c9259a9e.js.map} +1 -1
  11. package/dist/chunk-ff22412e.js.map +2 -2
  12. package/dist/{chunk-jtbe5n3c.js → chunk-qf4fhwc9.js} +1 -1
  13. package/dist/chunks/{RealtimeClient-B7zh4okq.js → RealtimeClient-DmBC8zxt.js} +2 -2
  14. package/dist/chunks/{RealtimeClient-B7zh4okq.js.map → RealtimeClient-DmBC8zxt.js.map} +1 -1
  15. package/dist/chunks/{ThemeProvider-D33bPpf8.js → ThemeProvider-BTVQYl5O.js} +119 -14
  16. package/dist/chunks/ThemeProvider-BTVQYl5O.js.map +1 -0
  17. package/dist/chunks/{fetchFileRequest-Cp0QjioM.js → fetchFileRequest-BHCSZqKL.js} +2 -2
  18. package/dist/chunks/{fetchFileRequest-Cp0QjioM.js.map → fetchFileRequest-BHCSZqKL.js.map} +1 -1
  19. package/dist/chunks/{live-D08wnrrZ.js → live-DIj7rF0t.js} +3 -3
  20. package/dist/chunks/{live-D08wnrrZ.js.map → live-DIj7rF0t.js.map} +1 -1
  21. package/dist/chunks/{mutationExtras-BbDboF8F.js → mutationExtras-BRFfb6-L.js} +2 -2
  22. package/dist/chunks/{mutationExtras-BbDboF8F.js.map → mutationExtras-BRFfb6-L.js.map} +1 -1
  23. package/dist/chunks/{subscriptionStream-CRj9aV4K.js → subscriptionStream-CRRgUXJp.js} +2 -2
  24. package/dist/chunks/{subscriptionStream-CRj9aV4K.js.map → subscriptionStream-CRRgUXJp.js.map} +1 -1
  25. package/dist/chunks/useParams-BN3XXfmG.js.map +1 -1
  26. package/dist/client/ClientRouter.d.ts +0 -1
  27. package/dist/client/ClientRouter.d.ts.map +1 -1
  28. package/dist/client/ClientRouterContext.d.ts +0 -5
  29. package/dist/client/ClientRouterContext.d.ts.map +1 -1
  30. package/dist/client/RouteStateContext.d.ts +5 -0
  31. package/dist/client/RouteStateContext.d.ts.map +1 -1
  32. package/dist/client/index.js +22 -29
  33. package/dist/client/index.js.map +1 -1
  34. package/dist/client/scrollRestoration.d.ts +37 -0
  35. package/dist/client/scrollRestoration.d.ts.map +1 -0
  36. package/dist/server/index.js +1 -1
  37. package/dist/testing/index.js +2 -2
  38. package/package.json +1 -1
  39. package/dist/chunks/ThemeProvider-D33bPpf8.js.map +0 -1
  40. /package/dist/{chunk-mzns19hy.js.map → chunk-8nmcyavt.js.map} +0 -0
  41. /package/dist/{chunk-jtbe5n3c.js.map → chunk-qf4fhwc9.js.map} +0 -0
@@ -0,0 +1,37 @@
1
+ import { Action } from "history";
2
+ /**
3
+ * The history entry `location` is: the `history` package's key, or the URL for
4
+ * an entry it has not keyed (`"default"`): the one a page loaded on, or one a
5
+ * same-page `#hash` link added, which is why the hash is part of it.
6
+ */
7
+ export declare function entryKey(location: {
8
+ key?: string;
9
+ pathname: string;
10
+ search: string;
11
+ hash: string;
12
+ }): string;
13
+ /** The entry the window is on right now (before the router has a location). */
14
+ export declare function currentEntryKey(): string;
15
+ /** Records the scroll position of the page on screen, before the router leaves it. */
16
+ export declare function saveScroll(): void;
17
+ /**
18
+ * Switches the browser's restoration off and keeps the positions across a
19
+ * reload. Returns the cleanup.
20
+ */
21
+ export declare function manageScroll(): () => void;
22
+ /**
23
+ * Scrolls for a navigation that has just committed, once per navigation:
24
+ * - a push or replace goes to the top, or to the `#hash` element when there is one;
25
+ * - back/forward goes back to where the entry was left (the hash, or the top,
26
+ * for an entry without a position);
27
+ * - a shallow navigation stays where it is: the page on screen did not change;
28
+ * - the page a document loaded on is restored only on a reload or a
29
+ * back/forward to it; otherwise the browser has placed it (at its `#hash`).
30
+ */
31
+ export declare function restoreScroll(navigation: {
32
+ key: string;
33
+ action: Action | null;
34
+ hash: string;
35
+ shallow: boolean;
36
+ }): void;
37
+ //# sourceMappingURL=scrollRestoration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrollRestoration.d.ts","sourceRoot":"","sources":["../../client/scrollRestoration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAoCjC;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,UAIA;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,WAO9B;AAED,sFAAsF;AACtF,wBAAgB,UAAU,SAMzB;AAED;;;GAGG;AACH,wBAAgB,YAAY,eAY3B;AAQD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,QA6BA"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Da as f}from"../chunk-s0z61m9j.js";import{Ea as S}from"../chunk-rh84xq17.js";import{Kl as Q,Ml as Z,Nl as P,Ol as y,Pl as U,Ql as A}from"../chunk-1yq2b55s.js";import{Ul as H}from"../chunk-ahss6dcp.js";import"../chunk-y167pt0p.js";import{am as F}from"../chunk-zpqcawmq.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-mzns19hy.js");this.server=await J(this.app,I)}else{f();let{httpDev:J}=await import("../chunk-jtbe5n3c.js"),K=new Y(this.app);this.server=await J(this.app,K.track(I)),N(K)}return this.server}stop(z={}){let B=this.app.sockets();return this.stopping??=P({server:this.server,closeSockets:B?()=>B.shutdown():void 0,shutdownProviders:(I)=>this.app.shutdown(I),settings:{...this.settings??Z(),...z}}),this.stopping}}export{W as liveness,Q as isShuttingDown,k as Server};
2
+ import{Da as f}from"../chunk-s0z61m9j.js";import{Ea as S}from"../chunk-rh84xq17.js";import{Kl as Q,Ml as Z,Nl as P,Ol as y,Pl as U,Ql as A}from"../chunk-1yq2b55s.js";import{Ul as H}from"../chunk-ahss6dcp.js";import"../chunk-y167pt0p.js";import{am as F}from"../chunk-zpqcawmq.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-8nmcyavt.js");this.server=await J(this.app,I)}else{f();let{httpDev:J}=await import("../chunk-qf4fhwc9.js"),K=new Y(this.app);this.server=await J(this.app,K.track(I)),N(K)}return this.server}stop(z={}){let B=this.app.sockets();return this.stopping??=P({server:this.server,closeSockets:B?()=>B.shutdown():void 0,shutdownProviders:(I)=>this.app.shutdown(I),settings:{...this.settings??Z(),...z}}),this.stopping}}export{W as liveness,Q as isShuttingDown,k as Server};
3
3
 
4
4
  //# debugId=EAB95CD8462D447D64756E2164756E21
@@ -1,5 +1,5 @@
1
- import { t as followLive } from "../chunks/live-D08wnrrZ.js";
2
- import { $ as applyParams, B as createMemoryHistory, M as I18nProvider, N as ServerDataContext, Q as toVariantKey, R as ProgressManager, W as RealtimeContext, bt as Subject, c as ClientRouterContext, i as RouteTransitionProvider, nt as QueryManagerProvider, q as liveModule, r as m, t as ThemeProvider, tt as QueryManagerContext, z as Action } from "../chunks/ThemeProvider-D33bPpf8.js";
1
+ import { t as followLive } from "../chunks/live-DIj7rF0t.js";
2
+ import { $ as toVariantKey, B as Action, G as RealtimeContext, J as liveModule, N as I18nProvider, P as ServerDataContext, V as createMemoryHistory, c as ClientRouterContext, et as applyParams, i as RouteTransitionProvider, nt as QueryManagerContext, r as m, rt as QueryManagerProvider, t as ThemeProvider, xt as Subject, z as ProgressManager } from "../chunks/ThemeProvider-BTVQYl5O.js";
3
3
  import { r as RouteStateProvider } from "../chunks/useParams-BN3XXfmG.js";
4
4
  import { t as channelKey } from "../chunks/channelKey-CIhHpX6x.js";
5
5
  import { Suspense, createElement, useContext, useMemo, useRef, useState } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemi",
3
- "version": "0.199.0",
3
+ "version": "0.200.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Enes Tufekci <enes@gemijs.dev>",