gemi 0.222.0 → 0.223.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/ai/index.js +1 -1
- package/dist/bin/gemi.js +71 -54
- package/dist/bin/gemi.js.map +6 -5
- package/dist/{chunk-140r27bn.js → chunk-fn166jp3.js} +1 -1
- package/dist/{chunk-4xgjg08e.js → chunk-ke1q6hfm.js} +1 -1
- package/dist/chunk-p1ern8r4.js +577 -0
- package/dist/chunk-p1ern8r4.js.map +27 -0
- package/dist/{chunk-7czgj8ae.js → chunk-qtczhd81.js} +2 -2
- package/dist/{chunk-7czgj8ae.js.map → chunk-qtczhd81.js.map} +1 -1
- package/dist/{chunk-tn8gkch4.js → chunk-qvxs1vjh.js} +1 -1
- package/dist/{chunk-3b68kpz1.js → chunk-rw45xz3f.js} +3 -3
- package/dist/{chunk-3b68kpz1.js.map → chunk-rw45xz3f.js.map} +3 -3
- package/dist/{chunk-073j13t7.js → chunk-sqyf0gey.js} +1 -1
- package/dist/console/run.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/queue/DatabaseQueueDriver.d.ts +16 -0
- package/dist/services/queue/DatabaseQueueDriver.d.ts.map +1 -1
- package/dist/services/queue/DatabaseSlots.d.ts +100 -0
- package/dist/services/queue/DatabaseSlots.d.ts.map +1 -0
- package/dist/services/queue/Job.d.ts +20 -3
- package/dist/services/queue/Job.d.ts.map +1 -1
- package/dist/services/queue/MemoryQueueDriver.d.ts +11 -1
- package/dist/services/queue/MemoryQueueDriver.d.ts.map +1 -1
- package/dist/services/queue/QueueDriver.d.ts +24 -0
- package/dist/services/queue/QueueDriver.d.ts.map +1 -1
- package/dist/services/queue/QueueManager.d.ts +71 -8
- package/dist/services/queue/QueueManager.d.ts.map +1 -1
- package/dist/services/queue/slots.d.ts +111 -0
- package/dist/services/queue/slots.d.ts.map +1 -0
- package/dist/services/queue/work.js +1 -1
- package/dist/services/queue/workflow/MemoryWorkflowStore.d.ts +2 -0
- package/dist/services/queue/workflow/MemoryWorkflowStore.d.ts.map +1 -1
- package/dist/services/queue/workflow/Workflow.d.ts +16 -0
- package/dist/services/queue/workflow/Workflow.d.ts.map +1 -1
- package/dist/services/queue/workflow/WorkflowRuntime.d.ts +10 -0
- package/dist/services/queue/workflow/WorkflowRuntime.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-wcj7rjfe.js +0 -517
- package/dist/chunk-wcj7rjfe.js.map +0 -25
- /package/dist/{chunk-140r27bn.js.map → chunk-fn166jp3.js.map} +0 -0
- /package/dist/{chunk-4xgjg08e.js.map → chunk-ke1q6hfm.js.map} +0 -0
- /package/dist/{chunk-tn8gkch4.js.map → chunk-qvxs1vjh.js.map} +0 -0
- /package/dist/{chunk-073j13t7.js.map → chunk-sqyf0gey.js.map} +0 -0
package/dist/ai/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ca as uQ,da as lQ,ea as iQ,fa as _6,ga as B6,ha as S6,ia as m$,ja as M6,ka as A6,la as P$,ma as R6,na as E6,oa as k6,pa as T6}from"../chunk-9yascc81.js";import{$c as X6,Ac as CZ,Bc as YQ,Dc as VQ,Ec as FQ,Fc as HQ,Gc as PQ,Hc as NQ,Ic as OQ,Jc as UQ,Kc as CQ,Lc as LQ,Mc as _Q,Nc as BQ,Oc as SQ,Qc as c$,Rc as a9,Sc as t9,Tc as r9,Uc as e9,Vc as J6,Wc as $6,Xc as Q6,Yc as Z6,Zc as W6,_c as K6,ad as DJ,bd as G6,cd as eZ,dd as Y6,ed as J8,fd as V6,gd as z6,hd as D6,ic as h$,id as kJ,jc as lZ,jd as K$,kc as iZ,kd as H6,lc as g$,ld as P6,md as $8,nd as N6,od as F6,pc as gQ,pd as O6,qc as fQ,qd as U6,rc as GJ,rd as C6,sc as s9,sd as L6,tc as b,td as Z$,uc as KQ,vc as XQ,xc as GQ,yc as g,zc as UZ}from"../chunk-
|
|
2
|
+
import{ca as uQ,da as lQ,ea as iQ,fa as _6,ga as B6,ha as S6,ia as m$,ja as M6,ka as A6,la as P$,ma as R6,na as E6,oa as k6,pa as T6}from"../chunk-9yascc81.js";import{$c as X6,Ac as CZ,Bc as YQ,Dc as VQ,Ec as FQ,Fc as HQ,Gc as PQ,Hc as NQ,Ic as OQ,Jc as UQ,Kc as CQ,Lc as LQ,Mc as _Q,Nc as BQ,Oc as SQ,Qc as c$,Rc as a9,Sc as t9,Tc as r9,Uc as e9,Vc as J6,Wc as $6,Xc as Q6,Yc as Z6,Zc as W6,_c as K6,ad as DJ,bd as G6,cd as eZ,dd as Y6,ed as J8,fd as V6,gd as z6,hd as D6,ic as h$,id as kJ,jc as lZ,jd as K$,kc as iZ,kd as H6,lc as g$,ld as P6,md as $8,nd as N6,od as F6,pc as gQ,pd as O6,qc as fQ,qd as U6,rc as GJ,rd as C6,sc as s9,sd as L6,tc as b,td as Z$,uc as KQ,vc as XQ,xc as GQ,yc as g,zc as UZ}from"../chunk-qvxs1vjh.js";import{Gd as m,Hd as u$,Kd as dZ,Ld as nZ,Md as oZ,Nd as qJ,Od as sZ,Pd as mJ,Qd as vJ,Rd as w$,Sd as aZ,Td as tZ,Ud as pJ,Vd as rZ,_d as t,ae as a,xd as nQ,yd as A,zd as T}from"../chunk-kp7wcpx7.js";import{re as e$}from"../chunk-7xe5vd4w.js";import"../chunk-p1ern8r4.js";import{Ni as I,li as qZ,oi as hZ,uj as gZ,zj as S$}from"../chunk-8gnbc9dg.js";import{Aj as vZ,Cj as uJ,Dj as cJ}from"../chunk-h1wmpa03.js";import{Mj as c}from"../chunk-t586p2g2.js";import{Oj as d9,Pj as n9,Qj as o9}from"../chunk-qs2xvc8g.js";import"../chunk-anc5v266.js";import{Xk as uZ,Yk as cZ,Zk as mZ,_k as pZ}from"../chunk-tac25cnj.js";import"../chunk-0k2r6bep.js";import{el as o,fl as s,ul as AJ}from"../chunk-0av1gyns.js";import"../chunk-zmt5kdpb.js";import"../chunk-yj7pbbnm.js";import{lm as GZ}from"../chunk-37209psn.js";import"../chunk-fqhkkpq3.js";import"../chunk-6r7956dh.js";import{Im as nJ}from"../chunk-5mrtgr7q.js";import"../chunk-3dkv4989.js";import{existsSync as z8,readdirSync as x6,readFileSync as a$}from"fs";import{isAbsolute as D8,join as CJ,relative as H8,sep as P8}from"path";var t$="prompts.json",N8=/\{\{>\s*([\w./-]+)\s*\}\}/g,n$=/\{\{(\w+)\}\}/g,F8=/^[\w-]+(\/[\w-]+)*$/,o$={dir:"app/agents",shared:"prompts"},_J={},iJ=new Map,LJ;function O8(){if(LJ===void 0){let J=CJ(nJ(),"dist","server",t$);LJ=z8(J)?JSON.parse(a$(J,"utf8")):null}return LJ??null}function U8(J){return J.replace(/\r?\n$/,"")}function s$(){return _J.cache??Bun.env.NODE_ENV==="production"}function C8(J,$){if(!F8.test(J))throw Error(`"${J}" is not a prompt name. Use letters, digits, "-" and "_", with "/" between folders.`);let Q=$.dir??_J.dir??o$.dir,Z=D8(Q)?Q:CJ(process.cwd(),Q),W=J.includes("/")?`${J}.md`:CJ($.shared??_J.shared??o$.shared,`${J}.md`);return CJ(Z,W)}function L8(J,$){let Q=C8(J,$),Z=s$()?iJ.get(Q):void 0;if(Z!==void 0)return Z;let W=Bun.env.NODE_ENV==="production";if(W){let X=O8()?.[H8(nJ(),Q).split(P8).join("/")];if(X!==void 0)return X}let K;try{K=U8(a$(Q,"utf8"))}catch(X){if(X.code==="ENOENT"){let G=W?` or in dist/server/${t$}`:"";throw Error(`The prompt "${J}" does not exist (looked for ${Q}${G}).`)}throw X}if(s$())iJ.set(Q,K);return K}function dJ(J,$,Q){if($.includes(J))throw Error(`The prompt "${J}" includes itself: ${[...$,J].join(" > ")}.`);return L8(J,Q).replace(N8,(Z,W)=>dJ(W,[...$,J],Q))}class r${static configure(J){_J={...J},iJ.clear(),LJ=void 0}static render(J,$={},Q={}){return dJ(J,[],Q).replace(n$,(Z,W)=>{if(!Object.hasOwn($,W))throw Error(`The prompt "${J}" has no value for {{${W}}}.`);return String($[W])})}static placeholders(J,$={}){let Q=[...dJ(J,[],$).matchAll(n$)].map((Z)=>Z[1]);return[...new Set(Q)]}}class oJ extends e${name="AgentJobDeadlineSweep";cron="* * * * *";async callback(){while(await g.sweep({limit:100})===100);}}var SJ=20,_8=300,B8=200;function $Q(J,$){if($<=0||J.length===0)return null;let Q=(K,X)=>X.createdAt-K.createdAt||(K.id<X.id?1:-1);return["<jobs>","Background jobs that tools started in this conversation, running ones first. A running job's result replaces its tool result when it finishes. Do not start the same work again while a job for it is running.",...[...J.filter((K)=>!b(K.state)).sort(Q),...J.filter((K)=>b(K.state)).sort(Q)].slice(0,$).map((K)=>{let X=[`- ${K.id} (${K.toolName})`];if(K.state==="waiting")X.push(`waiting for ${(K.after??[]).join(", ")} since ${BJ(K.createdAt)}`);else if(K.state==="running")X.push(`running since ${BJ(K.createdAt)}`);else if(K.state==="ok")X.push(`finished at ${BJ(K.settledAt??K.updatedAt)}`);else{let G=K.error?`${K.error.code}: ${JQ(K.error.message,B8)}`:"failed";X.push(`failed at ${BJ(K.settledAt??K.updatedAt)} (${G})`)}if(K.summary!==void 0)X.push(`summary: ${JQ(JSON.stringify(K.summary),_8)}`);if(K.orphaned)X.push("its tool call was lost when the turn that started it was cut short");return X.join("; ")}),"</jobs>"].join(`
|
|
3
3
|
`)}function BJ(J){return new Date(J).toISOString().replace(/\.\d{3}Z$/,"Z")}function JQ(J,$){return J.length<=$?J:`${J.slice(0,$-1)}\u2026`}var QQ=["after_jobs","batch_key","queued","inbox","job_checkpoint"],ZQ=20;class sJ{table;sql;dialect;connection;later;constructor(J,$={}){let Q=$.table??"gemi_agent_jobs";if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(Q))throw Error(`The agent jobs table name "${Q}" is not a plain identifier. Use letters, digits and underscores.`);this.table=Q,this.sql=J.sql,this.dialect=J.dialect,this.connection=J.name}async createTable(){for(let J of S8(this.dialect,this.table))await this.sql.unsafe(J)}async transaction(J){if(this.connection===void 0||this.joinable())return J();return AJ(this.sql,()=>J(),{connection:this.connection})}async create(J){let $=J.after!==void 0||J.batch!==void 0||J.queued!==void 0;if($)await this.requireLaterColumns("A job with `after` or `batch`");let Q=this.q(),Z=this.clock(Q),W=J.state??"running";if($)await Q`
|
|
4
4
|
INSERT INTO ${this.name(Q)}
|
|
5
5
|
(id, thread_id, run_id, tool_call_id, tool_name, owner, job, summary, state,
|
package/dist/bin/gemi.js
CHANGED
|
@@ -35956,7 +35956,7 @@ function camelCase(text) {
|
|
|
35956
35956
|
|
|
35957
35957
|
// bin/ai-client/extract.ts
|
|
35958
35958
|
import { createRequire } from "module";
|
|
35959
|
-
import
|
|
35959
|
+
import path9 from "path";
|
|
35960
35960
|
function parseAgentReference(reference) {
|
|
35961
35961
|
const hash = reference.lastIndexOf("#");
|
|
35962
35962
|
if (hash === -1)
|
|
@@ -35970,7 +35970,7 @@ function parseAgentReference(reference) {
|
|
|
35970
35970
|
}
|
|
35971
35971
|
async function loadTypeScript(cwd) {
|
|
35972
35972
|
try {
|
|
35973
|
-
return createRequire(
|
|
35973
|
+
return createRequire(path9.join(cwd, "package.json"))("typescript");
|
|
35974
35974
|
} catch {
|
|
35975
35975
|
try {
|
|
35976
35976
|
return (await import("typescript")).default;
|
|
@@ -35980,7 +35980,7 @@ async function loadTypeScript(cwd) {
|
|
|
35980
35980
|
}
|
|
35981
35981
|
}
|
|
35982
35982
|
function extractAgent(ts, reference, { cwd = process.cwd(), name } = {}) {
|
|
35983
|
-
const file =
|
|
35983
|
+
const file = path9.resolve(cwd, reference.file);
|
|
35984
35984
|
if (!ts.sys.fileExists(file)) {
|
|
35985
35985
|
throw new GenerateClientError(`${reference.file} does not exist.`);
|
|
35986
35986
|
}
|
|
@@ -35992,7 +35992,7 @@ function extractAgent(ts, reference, { cwd = process.cwd(), name } = {}) {
|
|
|
35992
35992
|
if (agentType.getSymbol()?.getName() !== "Agent" || !agentFile) {
|
|
35993
35993
|
throw new GenerateClientError(`${reference.file}#${reference.exportName} is not an Agent \u2014 it is ` + `\`${checker.typeToString(agentType)}\`. Point at the value \`Agent.create(...)\` returned.`);
|
|
35994
35994
|
}
|
|
35995
|
-
const probe =
|
|
35995
|
+
const probe = path9.join(path9.dirname(file), `__gemi_generate_client_${process.pid}.ts`);
|
|
35996
35996
|
const source = [
|
|
35997
35997
|
`import type { OutputOf, ToolShapesOf } from ${JSON.stringify(specifier(probe, agentFile))};`,
|
|
35998
35998
|
`import type * as agentModule from ${JSON.stringify(specifier(probe, file))};`,
|
|
@@ -36013,7 +36013,7 @@ function extractAgent(ts, reference, { cwd = process.cwd(), name } = {}) {
|
|
|
36013
36013
|
return second.getTypeChecker().getTypeAtLocation(declaration.name);
|
|
36014
36014
|
};
|
|
36015
36015
|
const mapper = new TypeMapper(ts, second.getTypeChecker());
|
|
36016
|
-
const agentName = name ?? pascalCase(exported === "default" ?
|
|
36016
|
+
const agentName = name ?? pascalCase(exported === "default" ? path9.parse(file).name : exported);
|
|
36017
36017
|
const toolsType = alias("Tools");
|
|
36018
36018
|
const tools = mapper.checker.getPropertiesOfType(toolsType).map((tool) => {
|
|
36019
36019
|
const shape = mapper.checker.getTypeOfSymbol(tool);
|
|
@@ -36029,7 +36029,7 @@ function extractAgent(ts, reference, { cwd = process.cwd(), name } = {}) {
|
|
|
36029
36029
|
const output = mapper.map(alias("Output"), "StructuredOutput", "the agent's output");
|
|
36030
36030
|
return {
|
|
36031
36031
|
name: agentName,
|
|
36032
|
-
source: `${
|
|
36032
|
+
source: `${path9.relative(cwd, file).split(path9.sep).join("/")}#${reference.exportName}`,
|
|
36033
36033
|
tools,
|
|
36034
36034
|
output,
|
|
36035
36035
|
types: mapper.types,
|
|
@@ -36037,7 +36037,7 @@ function extractAgent(ts, reference, { cwd = process.cwd(), name } = {}) {
|
|
|
36037
36037
|
};
|
|
36038
36038
|
}
|
|
36039
36039
|
function compilerOptions(ts, file) {
|
|
36040
|
-
const configPath = ts.findConfigFile(
|
|
36040
|
+
const configPath = ts.findConfigFile(path9.dirname(file), ts.sys.fileExists);
|
|
36041
36041
|
let options = {
|
|
36042
36042
|
target: ts.ScriptTarget.ESNext,
|
|
36043
36043
|
module: ts.ModuleKind.ESNext,
|
|
@@ -36045,7 +36045,7 @@ function compilerOptions(ts, file) {
|
|
|
36045
36045
|
};
|
|
36046
36046
|
if (configPath) {
|
|
36047
36047
|
const config = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
36048
|
-
options = ts.parseJsonConfigFileContent(config.config, ts.sys,
|
|
36048
|
+
options = ts.parseJsonConfigFileContent(config.config, ts.sys, path9.dirname(configPath)).options;
|
|
36049
36049
|
}
|
|
36050
36050
|
return {
|
|
36051
36051
|
...options,
|
|
@@ -36067,7 +36067,7 @@ function exportedType(ts, checker, sourceFile, reference) {
|
|
|
36067
36067
|
return { type: checker.getTypeOfSymbolAtLocation(symbol, sourceFile), name: symbol.getName() };
|
|
36068
36068
|
}
|
|
36069
36069
|
function specifier(from, to) {
|
|
36070
|
-
const relative6 =
|
|
36070
|
+
const relative6 = path9.relative(path9.dirname(from), to).split(path9.sep).join("/").replace(/(\.d)?\.(ts|tsx|mts|cts)$/, "");
|
|
36071
36071
|
return relative6.startsWith(".") ? relative6 : `./${relative6}`;
|
|
36072
36072
|
}
|
|
36073
36073
|
function isFrameworkJsonValue(type) {
|
|
@@ -36710,7 +36710,7 @@ __export(exports_generate, {
|
|
|
36710
36710
|
GenerateClientError: () => GenerateClientError
|
|
36711
36711
|
});
|
|
36712
36712
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
36713
|
-
import
|
|
36713
|
+
import path10 from "path";
|
|
36714
36714
|
async function generateClient(options) {
|
|
36715
36715
|
const cwd = options.cwd ?? process.cwd();
|
|
36716
36716
|
const platform = parsePlatform(options.platform);
|
|
@@ -36723,8 +36723,8 @@ async function generateClient(options) {
|
|
|
36723
36723
|
}
|
|
36724
36724
|
const ts = await loadTypeScript(cwd);
|
|
36725
36725
|
const model = extractAgent(ts, parseAgentReference(options.agent), { cwd, name: options.name });
|
|
36726
|
-
const directory =
|
|
36727
|
-
const file =
|
|
36726
|
+
const directory = path10.resolve(cwd, options.out);
|
|
36727
|
+
const file = path10.join(directory, `${model.name}.${platform === "swift" ? "swift" : "kt"}`);
|
|
36728
36728
|
mkdirSync3(directory, { recursive: true });
|
|
36729
36729
|
writeFileSync4(file, platform === "swift" ? renderSwift(model) : renderKotlin(model, options.package));
|
|
36730
36730
|
const warnings = [...model.warnings];
|
|
@@ -36748,8 +36748,8 @@ var init_generate = __esm(() => {
|
|
|
36748
36748
|
});
|
|
36749
36749
|
|
|
36750
36750
|
// bin/gemi.ts
|
|
36751
|
-
import
|
|
36752
|
-
import { existsSync as
|
|
36751
|
+
import path11 from "path";
|
|
36752
|
+
import { existsSync as existsSync14 } from "fs";
|
|
36753
36753
|
import { mkdtemp, rm } from "fs/promises";
|
|
36754
36754
|
import { tmpdir as tmpdir2 } from "os";
|
|
36755
36755
|
|
|
@@ -42110,15 +42110,39 @@ async function loadRouteTable(rootDir, preloadArgs, options = {}) {
|
|
|
42110
42110
|
}
|
|
42111
42111
|
}
|
|
42112
42112
|
|
|
42113
|
+
// bin/buildServer.ts
|
|
42114
|
+
import { existsSync as existsSync13 } from "fs";
|
|
42115
|
+
import path8 from "path";
|
|
42116
|
+
function serverEntrypoints(rootDir) {
|
|
42117
|
+
const entries = ["./app/server.ts"];
|
|
42118
|
+
if (existsSync13(path8.join(rootDir, "app", "bootstrap.ts")))
|
|
42119
|
+
entries.push("./app/bootstrap.ts");
|
|
42120
|
+
return entries;
|
|
42121
|
+
}
|
|
42122
|
+
function buildServerEntries(rootDir, plugins) {
|
|
42123
|
+
return Bun.build({
|
|
42124
|
+
root: rootDir,
|
|
42125
|
+
entrypoints: serverEntrypoints(rootDir).map((entry) => path8.join(rootDir, entry)),
|
|
42126
|
+
outdir: path8.join(rootDir, "dist", "server"),
|
|
42127
|
+
naming: "[name].mjs",
|
|
42128
|
+
target: "bun",
|
|
42129
|
+
minify: true,
|
|
42130
|
+
sourcemap: "linked",
|
|
42131
|
+
plugins,
|
|
42132
|
+
packages: "external",
|
|
42133
|
+
loader: { ".css": "text" }
|
|
42134
|
+
});
|
|
42135
|
+
}
|
|
42136
|
+
|
|
42113
42137
|
// bin/gemi.ts
|
|
42114
42138
|
function appPreloadArgs(appDir) {
|
|
42115
|
-
const preloadPath =
|
|
42116
|
-
return
|
|
42139
|
+
const preloadPath = path11.join(appDir, "preload.ts");
|
|
42140
|
+
return existsSync14(preloadPath) ? ["--preload", preloadPath] : [];
|
|
42117
42141
|
}
|
|
42118
42142
|
program.command("dev").action(async () => {
|
|
42119
42143
|
console.log("Starting dev server...");
|
|
42120
|
-
const rootDir =
|
|
42121
|
-
const appDir =
|
|
42144
|
+
const rootDir = path11.resolve(process.cwd());
|
|
42145
|
+
const appDir = path11.join(rootDir, "app");
|
|
42122
42146
|
process.env.NODE_ENV = "development";
|
|
42123
42147
|
const exited = spawnForwardingSignals({
|
|
42124
42148
|
cmd: [
|
|
@@ -42128,7 +42152,7 @@ program.command("dev").action(async () => {
|
|
|
42128
42152
|
"--preload",
|
|
42129
42153
|
"gemi/bun/preload",
|
|
42130
42154
|
...appPreloadArgs(appDir),
|
|
42131
|
-
`${
|
|
42155
|
+
`${path11.join(appDir, "server.ts")}`
|
|
42132
42156
|
]
|
|
42133
42157
|
});
|
|
42134
42158
|
reportUpdate({ rootDir });
|
|
@@ -42142,15 +42166,15 @@ async function printStats(rootDir, options) {
|
|
|
42142
42166
|
return runStats({
|
|
42143
42167
|
rootDir,
|
|
42144
42168
|
config: config.stats,
|
|
42145
|
-
json: options.json &&
|
|
42146
|
-
base: options.base &&
|
|
42147
|
-
markdown: options.markdown &&
|
|
42169
|
+
json: options.json && path11.resolve(options.json),
|
|
42170
|
+
base: options.base && path11.resolve(options.base),
|
|
42171
|
+
markdown: options.markdown && path11.resolve(options.markdown),
|
|
42148
42172
|
routes: options.routes,
|
|
42149
|
-
preloadArgs: appPreloadArgs(
|
|
42173
|
+
preloadArgs: appPreloadArgs(path11.join(rootDir, "app"))
|
|
42150
42174
|
});
|
|
42151
42175
|
}
|
|
42152
42176
|
withStatsOptions(program.command("stats").description("Print the initial JavaScript each route loads (raw, gzip, brotli) from the " + "last `gemi build`, and fail when a route is over its budget " + "(`stats.budgets` in gemi.config.ts)")).action(async (options) => {
|
|
42153
|
-
process.exit(await printStats(
|
|
42177
|
+
process.exit(await printStats(path11.resolve(process.cwd()), options));
|
|
42154
42178
|
});
|
|
42155
42179
|
withStatsOptions(program.command("build").option("--stats", "After building, print the initial JS per route and check the budgets")).action(async (options) => {
|
|
42156
42180
|
if (process.env.GEMI_BUILD_PROD !== "1") {
|
|
@@ -42164,14 +42188,14 @@ withStatsOptions(program.command("build").option("--stats", "After building, pri
|
|
|
42164
42188
|
process.exit(proc.exitCode ?? 0);
|
|
42165
42189
|
}
|
|
42166
42190
|
process.env.NODE_ENV = "production";
|
|
42167
|
-
const rootDir =
|
|
42168
|
-
const appDir =
|
|
42191
|
+
const rootDir = path11.resolve(process.cwd());
|
|
42192
|
+
const appDir = path11.join(rootDir, "app");
|
|
42169
42193
|
const config = await loadGemiConfig(rootDir);
|
|
42170
42194
|
const input = await createRollupInput_default(appDir);
|
|
42171
42195
|
process.env.GEMI_INPUT = JSON.stringify(input);
|
|
42172
42196
|
const previousAssets = resolvePreviousAssets(config.previousAssets, rootDir);
|
|
42173
|
-
const stagingDir = previousAssets ? await mkdtemp(
|
|
42174
|
-
const clientDir =
|
|
42197
|
+
const stagingDir = previousAssets ? await mkdtemp(path11.join(tmpdir2(), "gemi-previous-assets-")) : undefined;
|
|
42198
|
+
const clientDir = path11.join(rootDir, "dist", "client");
|
|
42175
42199
|
const emitted = [];
|
|
42176
42200
|
let carriedPaths = [];
|
|
42177
42201
|
try {
|
|
@@ -42218,34 +42242,27 @@ withStatsOptions(program.command("build").option("--stats", "After building, pri
|
|
|
42218
42242
|
plugins: [vite_default()],
|
|
42219
42243
|
build: { ssr: true, outDir: "dist/server" }
|
|
42220
42244
|
});
|
|
42221
|
-
const serverBuild = await
|
|
42222
|
-
|
|
42223
|
-
|
|
42224
|
-
|
|
42225
|
-
target: "bun",
|
|
42226
|
-
minify: true,
|
|
42227
|
-
sourcemap: "linked",
|
|
42228
|
-
plugins: [gemiPlugin(), ...config.bun?.plugins ?? []],
|
|
42229
|
-
packages: "external",
|
|
42230
|
-
loader: { ".css": "text" }
|
|
42231
|
-
});
|
|
42245
|
+
const serverBuild = await buildServerEntries(rootDir, [
|
|
42246
|
+
gemiPlugin(),
|
|
42247
|
+
...config.bun?.plugins ?? []
|
|
42248
|
+
]);
|
|
42232
42249
|
if (!serverBuild.success) {
|
|
42233
42250
|
for (const message of serverBuild.logs)
|
|
42234
42251
|
console.error(message);
|
|
42235
42252
|
process.exit(1);
|
|
42236
42253
|
}
|
|
42237
42254
|
const documentScripts = await bundleDocumentScripts(appDir);
|
|
42238
|
-
await Bun.write(
|
|
42255
|
+
await Bun.write(path11.join(rootDir, "dist", "server", DOCUMENT_SCRIPTS_MANIFEST), JSON.stringify(documentScripts));
|
|
42239
42256
|
if (Object.keys(documentScripts).length > 0) {
|
|
42240
42257
|
console.log(`Bundled ${Object.keys(documentScripts).length} document script(s).`);
|
|
42241
42258
|
}
|
|
42242
42259
|
const probes = await bundleProbes(appDir);
|
|
42243
|
-
await Bun.write(
|
|
42260
|
+
await Bun.write(path11.join(rootDir, "dist", "server", PROBES_MANIFEST), JSON.stringify(probes));
|
|
42244
42261
|
if (Object.keys(probes).length > 0) {
|
|
42245
42262
|
console.log(`Bundled ${Object.keys(probes).length} probe(s).`);
|
|
42246
42263
|
}
|
|
42247
42264
|
const prompts = bundlePrompts(rootDir);
|
|
42248
|
-
await Bun.write(
|
|
42265
|
+
await Bun.write(path11.join(rootDir, "dist", "server", PROMPTS_MANIFEST), JSON.stringify(prompts));
|
|
42249
42266
|
if (Object.keys(prompts).length > 0) {
|
|
42250
42267
|
console.log(`Bundled ${Object.keys(prompts).length} prompt file(s).`);
|
|
42251
42268
|
}
|
|
@@ -42257,8 +42274,8 @@ withStatsOptions(program.command("build").option("--stats", "After building, pri
|
|
|
42257
42274
|
});
|
|
42258
42275
|
program.command("start").action(async () => {
|
|
42259
42276
|
console.log("Starting server...");
|
|
42260
|
-
const rootDir =
|
|
42261
|
-
const appDir =
|
|
42277
|
+
const rootDir = path11.resolve(process.cwd());
|
|
42278
|
+
const appDir = path11.join(rootDir, "app");
|
|
42262
42279
|
const code = await spawnForwardingSignals({
|
|
42263
42280
|
cmd: [
|
|
42264
42281
|
"bun",
|
|
@@ -42272,8 +42289,8 @@ program.command("start").action(async () => {
|
|
|
42272
42289
|
process.exit(code);
|
|
42273
42290
|
});
|
|
42274
42291
|
program.command("queue:work").description("Boot the app and run queued jobs, without serving HTTP, so job capacity " + "scales apart from web traffic. Needs a queue driver every process can " + 'reach, such as "database". Drains on SIGTERM/SIGINT like `gemi start`').action(async () => {
|
|
42275
|
-
const rootDir =
|
|
42276
|
-
const appDir =
|
|
42292
|
+
const rootDir = path11.resolve(process.cwd());
|
|
42293
|
+
const appDir = path11.join(rootDir, "app");
|
|
42277
42294
|
let entry;
|
|
42278
42295
|
try {
|
|
42279
42296
|
entry = Bun.resolveSync("gemi/queue/work", rootDir);
|
|
@@ -42289,8 +42306,8 @@ program.command("queue:work").description("Boot the app and run queued jobs, wit
|
|
|
42289
42306
|
});
|
|
42290
42307
|
program.enablePositionalOptions();
|
|
42291
42308
|
program.command("run").description("Run a Command from app/commands. Everything after the name is the " + "command's own, including its flags. Omit the name to list them").argument("[name]", "The command's name").argument("[args...]", "Passed through to the command untouched").passThroughOptions().action(async (name, args) => {
|
|
42292
|
-
const rootDir =
|
|
42293
|
-
const appDir =
|
|
42309
|
+
const rootDir = path11.resolve(process.cwd());
|
|
42310
|
+
const appDir = path11.join(rootDir, "app");
|
|
42294
42311
|
let entry;
|
|
42295
42312
|
try {
|
|
42296
42313
|
entry = Bun.resolveSync("gemi/console/run", rootDir);
|
|
@@ -42314,13 +42331,13 @@ program.command("run").description("Run a Command from app/commands. Everything
|
|
|
42314
42331
|
process.exit(code);
|
|
42315
42332
|
});
|
|
42316
42333
|
program.command("migrate").description("Migrate an app from the 0.42 service-provider layout to the config + " + "container layout, flagging APIs retired since").option("--dry-run", "Print the plan without writing anything").action(async (options) => {
|
|
42317
|
-
const rootDir =
|
|
42334
|
+
const rootDir = path11.resolve(process.cwd());
|
|
42318
42335
|
console.log(options.dryRun ? `Planning migration of ${rootDir}...` : `Migrating ${rootDir}...`);
|
|
42319
42336
|
await runMigrate({ rootDir, dryRun: options.dryRun });
|
|
42320
42337
|
});
|
|
42321
42338
|
program.command("upgrade").description("Upgrade the `gemi` package. With no argument it moves to the newest " + "release on the channel you are already on \u2014 `rc` for a release " + "candidate, `latest` otherwise \u2014 so an rc is never 'upgraded' backwards " + "onto the older stable release").argument("[target]", "A version (`0.59.0`) to pin or roll back to, or a dist-tag (`rc`, " + "`latest`). Defaults to the current channel's tag").option("--dry-run", "Resolve the version and print the install command, run nothing").action(async (target, options) => {
|
|
42322
42339
|
const code = await runUpgrade({
|
|
42323
|
-
rootDir:
|
|
42340
|
+
rootDir: path11.resolve(process.cwd()),
|
|
42324
42341
|
target,
|
|
42325
42342
|
dryRun: options.dryRun
|
|
42326
42343
|
});
|
|
@@ -42328,7 +42345,7 @@ program.command("upgrade").description("Upgrade the `gemi` package. With no argu
|
|
|
42328
42345
|
});
|
|
42329
42346
|
program.command("install-skill").description(`Install the \`${SKILL_NAME}\` agent skill that ships with your gemi into ` + `.agents/skills/. \`gemi upgrade\` re-runs this afterwards, so the rules an ` + `agent reads stay pinned to the gemi the app actually runs`).option("--force", "Replace an installed copy that has local edits, or one this command did not write").action(async (options) => {
|
|
42330
42347
|
process.exit(installSkill({
|
|
42331
|
-
rootDir:
|
|
42348
|
+
rootDir: path11.resolve(process.cwd()),
|
|
42332
42349
|
force: options.force
|
|
42333
42350
|
}));
|
|
42334
42351
|
});
|
|
@@ -42342,7 +42359,7 @@ check.command("models").description("Report policied model classes that the modu
|
|
|
42342
42359
|
], []).action(async (options) => {
|
|
42343
42360
|
try {
|
|
42344
42361
|
const report2 = await checkModels({
|
|
42345
|
-
rootDir:
|
|
42362
|
+
rootDir: path11.resolve(process.cwd()),
|
|
42346
42363
|
modelsDir: options.dir,
|
|
42347
42364
|
ignore: options.ignore,
|
|
42348
42365
|
models: options.models
|
|
@@ -42361,7 +42378,7 @@ program.command("ai:generate-client").description("Generate an agent's tool and
|
|
|
42361
42378
|
const { file, warnings } = await generateClient2({ agent, ...options });
|
|
42362
42379
|
for (const warning of warnings)
|
|
42363
42380
|
console.warn(`warning: ${warning}`);
|
|
42364
|
-
console.log(`Wrote ${
|
|
42381
|
+
console.log(`Wrote ${path11.relative(process.cwd(), file)}`);
|
|
42365
42382
|
process.exit(0);
|
|
42366
42383
|
} catch (error) {
|
|
42367
42384
|
if (!(error instanceof GenerateClientError2))
|
|
@@ -42386,5 +42403,5 @@ program.command("app:route-manifest").action(async () => {
|
|
|
42386
42403
|
});
|
|
42387
42404
|
program.parse();
|
|
42388
42405
|
|
|
42389
|
-
//# debugId=
|
|
42406
|
+
//# debugId=6AB4123CB5FCD7EE64756E2164756E21
|
|
42390
42407
|
//# sourceMappingURL=gemi.js.map
|