UNPKG

life

Version:

Life.js is the first fullstack framework to build agentic web applications. It is minimal, extensible, and typesafe. Well, everything you love.

1 lines 2.19 kB
{"version":3,"sources":["../exports/build/server.ts"],"sourcesContent":["import path from \"path\";\nimport type { z } from \"zod\";\nimport type { agentServerConfig } from \"@/agent/server/config\";\nimport type { AgentDefinition } from \"@/agent/server/types\";\nimport * as op from \"@/shared/operation\";\n\n// Those uppercased placeholders will be replaced during compilation.\ntype Mode = \"LIFE_BUILD_MODE\";// @ts-expect-error\ntype ActualServerBuild = typeof import(\"LIFE_SERVER_BUILD_PATH\");\n\nconst defaultBuild = { \n \"Run `life dev` to see your agents here.\": { \n definition: {} as AgentDefinition, \n globalConfigs: {} as z.input<typeof agentServerConfig.schema>[], \n sha: \"\" \n } \n} as const;\nexport type ServerBuild = Mode extends \"production\" \n ? Awaited<ActualServerBuild>[\"default\"] extends never \n ? Awaited<ActualServerBuild>\n : Awaited<ActualServerBuild>[\"default\"] : typeof defaultBuild\n\n/* @__PURE__ */\nexport async function importServerBuild(options: { projectDirectory: string , noCache: boolean} ): Promise<op.OperationResult<ServerBuild>> { \n try {\n const p = path.join(options.projectDirectory, \".life\", \"server\", \"dist\", \"index.js\");\n const v = options.noCache ? (Math.random() * 100000000).toFixed(0) : \"cached\";\n const module = await import(p + `?v=${v}`);\n return op.success((module.default || module) as ServerBuild);\n } catch (e) {\n if (e instanceof Error && e.message.includes(\"Cannot find module\")) {\n return op.success(defaultBuild as ServerBuild);\n }\n return op.failure({ code: \"Unknown\", cause: e });\n }\n}\n\n"],"mappings":";;;;;;;;;AAAA,OAAO,UAAU;AAUjB,IAAM,eAAe;AAAA,EACnB,2CAA2C;AAAA,IACzC,YAAY,CAAC;AAAA,IACb,eAAe,CAAC;AAAA,IAChB,KAAK;AAAA,EACP;AACF;AAOA,eAAsB,kBAAkB,SAAoG;AAC1I,MAAI;AACF,UAAM,IAAI,KAAK,KAAK,QAAQ,kBAAkB,SAAS,UAAU,QAAQ,UAAU;AACnF,UAAM,IAAI,QAAQ,WAAW,KAAK,OAAO,IAAI,KAAW,QAAQ,CAAC,IAAI;AACrE,UAAM,SAAS,MAAM,OAAO,IAAI,MAAM,CAAC;AACvC,WAAU,QAAS,OAAO,WAAW,MAAsB;AAAA,EAC7D,SAAS,GAAG;AACV,QAAI,aAAa,SAAS,EAAE,QAAQ,SAAS,oBAAoB,GAAG;AAClE,aAAU,QAAQ,YAA2B;AAAA,IAC/C;AACA,WAAU,QAAQ,EAAE,MAAM,WAAW,OAAO,EAAE,CAAC;AAAA,EACjD;AACF;AAZsB;","names":[]}