@junejs/server 1.0.0-dev.19 → 1.0.0-dev.24

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 (43) hide show
  1. package/dist/adapter-DcZ-W1-7.d.ts +62 -0
  2. package/dist/adapter.d.ts +1 -61
  3. package/dist/agent-durable.js +1 -43
  4. package/dist/agent-native.d.ts +15 -5
  5. package/dist/agent-native.js +85 -16
  6. package/dist/app.js +2 -7
  7. package/dist/build.d.ts +5 -26
  8. package/dist/build.js +10 -276
  9. package/dist/config-freeze-DwI-Rmvq.d.ts +17 -0
  10. package/dist/config-freeze.d.ts +2 -0
  11. package/dist/config-freeze.js +51 -0
  12. package/dist/connection-auth.d.ts +39 -0
  13. package/dist/connection-auth.js +31 -0
  14. package/dist/content-freeze-CyiW2fRK.d.ts +4 -0
  15. package/dist/content-freeze.d.ts +2 -0
  16. package/dist/content-freeze.js +83 -0
  17. package/dist/core-version.js +1 -1
  18. package/dist/index.d.ts +9 -4
  19. package/dist/index.js +7 -2
  20. package/dist/manifest-gcNWqWoI.d.ts +11 -0
  21. package/dist/manifest.d.ts +2 -0
  22. package/dist/manifest.js +111 -0
  23. package/dist/route-scan-DMlwoESy.d.ts +13 -0
  24. package/dist/route-scan.d.ts +2 -0
  25. package/dist/route-scan.js +55 -0
  26. package/dist/turn-events.d.ts +5 -0
  27. package/dist/turn-events.js +46 -0
  28. package/dist/worker-BkFHGtxp.d.ts +61 -0
  29. package/dist/worker.d.ts +1 -60
  30. package/package.json +2 -2
  31. package/src/agent-discover.ts +10 -7
  32. package/src/agent-durable.ts +1 -39
  33. package/src/agent-native.ts +133 -21
  34. package/src/app.ts +4 -6
  35. package/src/build.ts +26 -440
  36. package/src/config-freeze.ts +104 -0
  37. package/src/connection-auth.ts +101 -0
  38. package/src/content-freeze.ts +151 -0
  39. package/src/core-version.ts +1 -1
  40. package/src/index.ts +14 -0
  41. package/src/manifest.ts +128 -0
  42. package/src/route-scan.ts +84 -0
  43. package/src/turn-events.ts +43 -0
@@ -0,0 +1,62 @@
1
+ import { JuneConfig } from "@junejs/core/config";
2
+ //#region src/adapter.d.ts
3
+ type AdapterCapabilities = {
4
+ runtime: "edge" | "node" | "serverless" | "native" | "static";
5
+ persistentConnections: boolean;
6
+ assets: "platform" | "server" | "none";
7
+ durableObjects?: boolean;
8
+ };
9
+ type AdapterEntry = {
10
+ imports: string[];
11
+ wrap(pipelineVar: string): string;
12
+ };
13
+ type ResourcePlan = {
14
+ db?: {
15
+ binding: string;
16
+ databaseName: string;
17
+ };
18
+ agent?: {
19
+ binding: string;
20
+ className: string;
21
+ };
22
+ };
23
+ type AdapterEmitContext = {
24
+ appRoot: string;
25
+ outDir: string;
26
+ hasAssets: boolean;
27
+ linkHeader: string | null;
28
+ config: JuneConfig;
29
+ plan: ResourcePlan;
30
+ defaultName: string;
31
+ publicFiles?: string[];
32
+ };
33
+ interface JuneAdapter {
34
+ readonly name: string;
35
+ readonly capabilities: AdapterCapabilities;
36
+ readonly conditions: string[];
37
+ readonly buildExternal?: string[];
38
+ validate?(ctx: {
39
+ plan: ResourcePlan;
40
+ config: JuneConfig;
41
+ }): void;
42
+ entry(opts: {
43
+ linkHeader: string | null;
44
+ }): AdapterEntry;
45
+ emit(ctx: AdapterEmitContext): Promise<void>;
46
+ }
47
+ declare function hasDurableBinding(text: string, file: string, binding: string, className: string): boolean;
48
+ declare function workers(opts?: {
49
+ name?: string;
50
+ domain?: string;
51
+ }): JuneAdapter;
52
+ declare function vercel(opts?: {
53
+ runtime?: "node" | "edge";
54
+ regions?: string[];
55
+ }): JuneAdapter;
56
+ declare function deno(opts?: {
57
+ org?: string;
58
+ app?: string;
59
+ }): JuneAdapter;
60
+ declare function staticSite(): JuneAdapter;
61
+ //#endregion
62
+ export { ResourcePlan as a, staticSite as c, JuneAdapter as i, vercel as l, AdapterEmitContext as n, deno as o, AdapterEntry as r, hasDurableBinding as s, AdapterCapabilities as t, workers as u };
package/dist/adapter.d.ts CHANGED
@@ -1,62 +1,2 @@
1
- import { JuneConfig } from "@junejs/core/config";
2
- //#region src/adapter.d.ts
3
- type AdapterCapabilities = {
4
- runtime: "edge" | "node" | "serverless" | "native" | "static";
5
- persistentConnections: boolean;
6
- assets: "platform" | "server" | "none";
7
- durableObjects?: boolean;
8
- };
9
- type AdapterEntry = {
10
- imports: string[];
11
- wrap(pipelineVar: string): string;
12
- };
13
- type ResourcePlan = {
14
- db?: {
15
- binding: string;
16
- databaseName: string;
17
- };
18
- agent?: {
19
- binding: string;
20
- className: string;
21
- };
22
- };
23
- type AdapterEmitContext = {
24
- appRoot: string;
25
- outDir: string;
26
- hasAssets: boolean;
27
- linkHeader: string | null;
28
- config: JuneConfig;
29
- plan: ResourcePlan;
30
- defaultName: string;
31
- publicFiles?: string[];
32
- };
33
- interface JuneAdapter {
34
- readonly name: string;
35
- readonly capabilities: AdapterCapabilities;
36
- readonly conditions: string[];
37
- readonly buildExternal?: string[];
38
- validate?(ctx: {
39
- plan: ResourcePlan;
40
- config: JuneConfig;
41
- }): void;
42
- entry(opts: {
43
- linkHeader: string | null;
44
- }): AdapterEntry;
45
- emit(ctx: AdapterEmitContext): Promise<void>;
46
- }
47
- declare function hasDurableBinding(text: string, file: string, binding: string, className: string): boolean;
48
- declare function workers(opts?: {
49
- name?: string;
50
- domain?: string;
51
- }): JuneAdapter;
52
- declare function vercel(opts?: {
53
- runtime?: "node" | "edge";
54
- regions?: string[];
55
- }): JuneAdapter;
56
- declare function deno(opts?: {
57
- org?: string;
58
- app?: string;
59
- }): JuneAdapter;
60
- declare function staticSite(): JuneAdapter;
61
- //#endregion
1
+ import { a as ResourcePlan, c as staticSite, i as JuneAdapter, l as vercel, n as AdapterEmitContext, o as deno, r as AdapterEntry, s as hasDurableBinding, t as AdapterCapabilities, u as workers } from "./adapter-DcZ-W1-7.js";
62
2
  export { AdapterCapabilities, AdapterEmitContext, AdapterEntry, JuneAdapter, ResourcePlan, deno, hasDurableBinding, staticSite, vercel, workers };
@@ -1,3 +1,4 @@
1
+ import { observeTurnEvents } from "./turn-events.js";
1
2
  import { isolateLocal } from "./isolate-local.js";
2
3
  import { assertCoreRuntimeVersion } from "./core-version.js";
3
4
  import { DeliverUnsupportedError, actionToTool, channelDispatch, resolveChannel } from "@junejs/core/agent-config";
@@ -373,49 +374,6 @@ function sseTurnStream(session, turnId) {
373
374
  }
374
375
  });
375
376
  }
376
- function observeTurnEvents(session, turnId) {
377
- const queue = [];
378
- let terminal = false;
379
- let notify;
380
- const unsub = session.observe((e) => {
381
- queue.push(e);
382
- if (e.type === "turn.completed" || e.type === "turn.failed" || e.type === "turn.cancelled" || e.type === "input.requested") terminal = true;
383
- notify?.();
384
- }, { turnId });
385
- return { [Symbol.asyncIterator]() {
386
- return {
387
- async next() {
388
- for (;;) {
389
- const e = queue.shift();
390
- if (e) return {
391
- value: e,
392
- done: false
393
- };
394
- if (terminal) {
395
- unsub();
396
- return {
397
- value: void 0,
398
- done: true
399
- };
400
- }
401
- await new Promise((resolve) => {
402
- notify = resolve;
403
- });
404
- notify = void 0;
405
- }
406
- },
407
- async return() {
408
- unsub();
409
- terminal = true;
410
- queue.length = 0;
411
- return {
412
- value: void 0,
413
- done: true
414
- };
415
- }
416
- };
417
- } };
418
- }
419
377
  async function sseTurnFinalText(res) {
420
378
  const ct = res.headers.get("content-type") ?? "";
421
379
  if (!res.body || !ct.includes("text/event-stream")) {
@@ -1,32 +1,42 @@
1
1
  import { SyncSqlite } from "./sqlite-driver.js";
2
2
  import { AgentDefinition, ChannelContext } from "@junejs/core/agent-config";
3
- import { AgentSession, Model, Runtime, Tool } from "@junejs/core/agent-runtime";
3
+ import { AgentSession, ChannelPolicy, Model, Runtime, Tool } from "@junejs/core/agent-runtime";
4
4
  //#region src/agent-native.d.ts
5
5
  type AgentDef = {
6
6
  model: Model;
7
7
  tools: Tool[];
8
8
  instructions?: string;
9
- channelInstructions?: Record<string, string>;
9
+ channelInstructions?: Record<string, string | ChannelPolicy>;
10
+ };
11
+ declare function toAgentDef(agent: AgentDefinition, model: Model): AgentDef;
12
+ type NativeRuntimeOptions = {
13
+ maxSessions?: number;
10
14
  };
11
15
  declare class NativeRuntime implements Runtime {
12
16
  private actors;
13
17
  private readonly agents;
14
18
  private readonly db;
15
- constructor(agents: Record<string, AgentDef>, db: SyncSqlite);
19
+ private readonly maxSessions;
20
+ constructor(agents: Record<string, AgentDef>, db: SyncSqlite, opts?: NativeRuntimeOptions);
21
+ agentDef(name: string): AgentDef | undefined;
16
22
  session(agent: string, id: string): AgentSession;
23
+ get sessionCount(): number;
24
+ private evictIdle;
17
25
  }
18
- declare function createNativeRuntime(agents: Record<string, AgentDef>, path?: string): Promise<NativeRuntime>;
26
+ declare function createNativeRuntime(agents: Record<string, AgentDef>, path?: string, opts?: NativeRuntimeOptions): Promise<NativeRuntime>;
19
27
  declare class MemoryRuntime implements Runtime {
20
28
  private actors;
21
29
  private stores;
22
30
  private readonly agents;
23
31
  constructor(agents: Record<string, AgentDef>);
32
+ agentDef(name: string): AgentDef | undefined;
24
33
  session(agent: string, id: string): AgentSession;
25
34
  }
26
35
  type AgentBackend = "native" | "memory" | "durable";
27
36
  declare function createAgentRuntime(agents: Record<string, AgentDef>, opts?: {
28
37
  backend?: AgentBackend;
29
38
  path?: string;
39
+ maxSessions?: number;
30
40
  }): Promise<Runtime>;
31
41
  declare function mountAgent(agent: AgentDefinition, runtime: Runtime, opts?: {
32
42
  chatPath?: string;
@@ -39,4 +49,4 @@ declare function mountAgent(agent: AgentDefinition, runtime: Runtime, opts?: {
39
49
  ctx: ChannelContext;
40
50
  };
41
51
  //#endregion
42
- export { AgentBackend, AgentDef, MemoryRuntime, NativeRuntime, createAgentRuntime, createNativeRuntime, mountAgent };
52
+ export { AgentBackend, AgentDef, MemoryRuntime, NativeRuntime, NativeRuntimeOptions, createAgentRuntime, createNativeRuntime, mountAgent, toAgentDef };
@@ -1,11 +1,13 @@
1
+ import { observeTurnEvents } from "./turn-events.js";
1
2
  import { assertCoreRuntimeVersion } from "./core-version.js";
2
3
  import { openLocalSqliteSync } from "./sqlite-driver.js";
3
- import { channelFetch } from "@junejs/core/agent-config";
4
+ import { buildSystemPrompt, channelFetch } from "@junejs/core/agent-config";
4
5
  import { AgentSession, withSystem } from "@junejs/core/agent-runtime";
5
6
  //#region src/agent-native.ts
6
7
  function initSchema(db) {
7
8
  db.exec(`CREATE TABLE IF NOT EXISTS agent_sessions (session_id TEXT PRIMARY KEY, status TEXT)`);
8
9
  db.exec(`CREATE TABLE IF NOT EXISTS agent_messages (seq INTEGER PRIMARY KEY AUTOINCREMENT, session_id TEXT, body TEXT)`);
10
+ db.exec(`CREATE INDEX IF NOT EXISTS agent_messages_session ON agent_messages (session_id, seq)`);
9
11
  db.exec(`CREATE TABLE IF NOT EXISTS agent_steps (session_id TEXT, id TEXT, output TEXT, PRIMARY KEY (session_id, id))`);
10
12
  }
11
13
  var SqliteSessionStore = class {
@@ -22,7 +24,7 @@ var SqliteSessionStore = class {
22
24
  return this.db.query("SELECT body FROM agent_messages WHERE session_id = ? ORDER BY seq").all(this.sid).map((r) => JSON.parse(r.body));
23
25
  }
24
26
  hasOpeningMessage(turnId) {
25
- return this.messages().some((m) => (m.role === "user" || m.role === "trigger") && m.turnId === turnId);
27
+ return this.db.query("SELECT 1 FROM agent_messages WHERE session_id = ? AND json_extract(body, '$.turnId') = ? AND json_extract(body, '$.role') IN ('user', 'trigger') LIMIT 1").get(this.sid, turnId) != null;
26
28
  }
27
29
  getStep(id) {
28
30
  const r = this.db.query("SELECT output FROM agent_steps WHERE session_id = ? AND id = ?").get(this.sid, id);
@@ -83,32 +85,68 @@ var InProcEventSink = class {
83
85
  this.subs.add(cb);
84
86
  return () => this.subs.delete(cb);
85
87
  }
88
+ get size() {
89
+ return this.subs.size;
90
+ }
86
91
  };
92
+ function toAgentDef(agent, model) {
93
+ return {
94
+ model,
95
+ tools: agent.tools,
96
+ instructions: buildSystemPrompt(agent),
97
+ ...agent.channelInstructions ? { channelInstructions: agent.channelInstructions } : {}
98
+ };
99
+ }
87
100
  var NativeRuntime = class {
88
101
  actors = /* @__PURE__ */ new Map();
89
102
  agents;
90
103
  db;
91
- constructor(agents, db) {
104
+ maxSessions;
105
+ constructor(agents, db, opts = {}) {
92
106
  assertCoreRuntimeVersion("NativeRuntime");
93
107
  this.agents = agents;
94
108
  this.db = db;
109
+ const max = opts.maxSessions ?? 1e3;
110
+ if (!(Number.isInteger(max) && max >= 1) && max !== Infinity) throw new RangeError(`NativeRuntime: maxSessions must be an integer >= 1 (or Infinity for no cap), got ${max}`);
111
+ this.maxSessions = max;
95
112
  initSchema(db);
96
113
  }
114
+ agentDef(name) {
115
+ return this.agents[name];
116
+ }
97
117
  session(agent, id) {
98
118
  const key = `${agent}:${id}`;
99
- let a = this.actors.get(key);
100
- if (!a) {
101
- const def = this.agents[agent];
102
- if (!def) throw new Error(`unknown agent: ${agent}`);
103
- const model = def.instructions ? withSystem(def.model, def.instructions) : def.model;
104
- a = new AgentSession(agent, id, new SqliteSessionStore(this.db, key), new InProcEventSink(), model, def.tools, this, def.channelInstructions);
105
- this.actors.set(key, a);
119
+ const hit = this.actors.get(key);
120
+ if (hit) {
121
+ this.actors.delete(key);
122
+ this.actors.set(key, hit);
123
+ return hit.session;
124
+ }
125
+ const def = this.agents[agent];
126
+ if (!def) throw new Error(`unknown agent: ${agent}`);
127
+ const model = def.instructions ? withSystem(def.model, def.instructions) : def.model;
128
+ const sink = new InProcEventSink();
129
+ const session = new AgentSession(agent, id, new SqliteSessionStore(this.db, key), sink, model, def.tools, this, def.channelInstructions);
130
+ this.evictIdle();
131
+ this.actors.set(key, {
132
+ session,
133
+ sink
134
+ });
135
+ return session;
136
+ }
137
+ get sessionCount() {
138
+ return this.actors.size;
139
+ }
140
+ evictIdle() {
141
+ if (this.actors.size < this.maxSessions) return;
142
+ for (const [key, a] of this.actors) {
143
+ if (this.actors.size < this.maxSessions) break;
144
+ if (a.session.idle() && a.sink.size === 0) this.actors.delete(key);
106
145
  }
107
- return a;
108
146
  }
109
147
  };
110
- async function createNativeRuntime(agents, path = ":memory:") {
111
- return new NativeRuntime(agents, await openLocalSqliteSync(path));
148
+ async function createNativeRuntime(agents, path = ":memory:", opts = {}) {
149
+ return new NativeRuntime(agents, await openLocalSqliteSync(path), opts);
112
150
  }
113
151
  var MemorySessionStore = class {
114
152
  msgs = [];
@@ -165,6 +203,9 @@ var MemoryRuntime = class {
165
203
  assertCoreRuntimeVersion("MemoryRuntime");
166
204
  this.agents = agents;
167
205
  }
206
+ agentDef(name) {
207
+ return this.agents[name];
208
+ }
168
209
  session(agent, id) {
169
210
  const key = `${agent}:${id}`;
170
211
  let a = this.actors.get(key);
@@ -173,7 +214,8 @@ var MemoryRuntime = class {
173
214
  if (!def) throw new Error(`unknown agent: ${agent}`);
174
215
  const store = new MemorySessionStore();
175
216
  this.stores.set(key, store);
176
- a = new AgentSession(agent, id, store, new InProcEventSink(), def.model, def.tools, this);
217
+ const model = def.instructions ? withSystem(def.model, def.instructions) : def.model;
218
+ a = new AgentSession(agent, id, store, new InProcEventSink(), model, def.tools, this, def.channelInstructions);
177
219
  this.actors.set(key, a);
178
220
  }
179
221
  return a;
@@ -182,12 +224,23 @@ var MemoryRuntime = class {
182
224
  async function createAgentRuntime(agents, opts = {}) {
183
225
  const backend = opts.backend ?? "native";
184
226
  if (backend === "memory") return new MemoryRuntime(agents);
185
- if (backend === "native") return createNativeRuntime(agents, opts.path);
227
+ if (backend === "native") return createNativeRuntime(agents, opts.path, { maxSessions: opts.maxSessions });
186
228
  throw new Error("backend 'durable' is the Cloudflare Durable Object target — construct AgentDurableObject in your worker, not via createAgentRuntime");
187
229
  }
230
+ function warnOnDrift(agent, runtime) {
231
+ const def = runtime.agentDef?.(agent.name);
232
+ if (!def) return;
233
+ const names = (tools) => tools.map((t) => t.spec.name).sort();
234
+ const want = names(agent.tools), have = names(def.tools);
235
+ if (want.join("\0") !== have.join("\0")) {
236
+ const missing = want.filter((n) => !have.includes(n)), extra = have.filter((n) => !want.includes(n));
237
+ console.warn(`[june] mountAgent("${agent.name}"): the runtime's tools differ from the agent definition's` + (missing.length ? ` — missing from the runtime: ${missing.join(", ")}` : "") + (extra.length ? ` — only in the runtime: ${extra.join(", ")}` : "") + `. Build the runtime entry with toAgentDef(agent, model) so both come from one definition.`);
238
+ }
239
+ }
188
240
  function mountAgent(agent, runtime, opts = {}) {
189
241
  const chatPath = opts.chatPath ?? "/message";
190
242
  const channelsOn = opts.channels ?? true;
243
+ warnOnDrift(agent, runtime);
191
244
  const ctx = {
192
245
  agent,
193
246
  services: opts.services,
@@ -205,6 +258,22 @@ function mountAgent(agent, runtime, opts = {}) {
205
258
  trigger: o?.trigger,
206
259
  replace: o?.replace
207
260
  }),
261
+ runStream: async function* (message, o) {
262
+ const session = runtime.session(agent.name, o?.session ?? "default");
263
+ const { turnId } = session.start({
264
+ turnId: o?.turnId,
265
+ userText: message,
266
+ event: o?.event,
267
+ trigger: o?.trigger,
268
+ replace: o?.replace
269
+ });
270
+ yield* observeTurnEvents(session, turnId);
271
+ },
272
+ resumeStream: async function* (o) {
273
+ const session = runtime.session(agent.name, o.session ?? "default");
274
+ const { turnId } = session.resume(o.turnId, o.inputId, o.input, { by: o.by });
275
+ yield* observeTurnEvents(session, turnId);
276
+ },
208
277
  resetSession: (o) => runtime.session(agent.name, o?.session ?? "default").reset()
209
278
  };
210
279
  const channels = channelFetch(agent, ctx);
@@ -226,4 +295,4 @@ function mountAgent(agent, runtime, opts = {}) {
226
295
  };
227
296
  }
228
297
  //#endregion
229
- export { MemoryRuntime, NativeRuntime, createAgentRuntime, createNativeRuntime, mountAgent };
298
+ export { MemoryRuntime, NativeRuntime, createAgentRuntime, createNativeRuntime, mountAgent, toAgentDef };
package/dist/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { discoverAgent } from "./agent-discover.js";
2
- import { createAgentRuntime, mountAgent } from "./agent-native.js";
2
+ import { createAgentRuntime, mountAgent, toAgentDef } from "./agent-native.js";
3
3
  import { findMiddlewareFile, isResourceFile, listRoutes, matchRouteTree, resolveNotFound, routeFiles } from "./router.js";
4
4
  import { createPipeline } from "./pipeline.js";
5
5
  import { resolveBoundary } from "./segment.js";
@@ -13,7 +13,6 @@ import { existsSync, lstatSync, realpathSync } from "node:fs";
13
13
  import { readFile } from "node:fs/promises";
14
14
  import { dirname, join, resolve } from "node:path";
15
15
  import { pathToFileURL } from "node:url";
16
- import { buildSystemPrompt } from "@junejs/core/agent-config";
17
16
  import { routeFromModule } from "@junejs/core/route";
18
17
  import { resolveAgent, resolveClientRouter, resolveSpeculationRules } from "@junejs/core/config";
19
18
  import { runWithTrace } from "@junejs/core/instrumentation";
@@ -125,11 +124,7 @@ function createApp({ appDir: appDirInput, config = {} }) {
125
124
  const def = await discoverAgent(agentDir);
126
125
  const backend = agent.runtime.backend === "durable" ? "native" : agent.runtime.backend;
127
126
  const model = anthropic({ model: def.model });
128
- const mounted = mountAgent(def, await createAgentRuntime({ [def.name]: {
129
- model,
130
- tools: def.tools,
131
- instructions: buildSystemPrompt(def)
132
- } }, { backend }), {
127
+ const mounted = mountAgent(def, await createAgentRuntime({ [def.name]: toAgentDef(def, model) }, { backend }), {
133
128
  chatPath: agent.runtime.chat.path,
134
129
  channels: agent.runtime.channels
135
130
  });
package/dist/build.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { JuneAdapter } from "./adapter.js";
2
- import { WorkerManifest } from "./worker.js";
3
- import { JuneConfig } from "@junejs/core/config";
4
- import { DocumentConfig } from "@junejs/core/document";
1
+ import { n as scanAppRoutes, r as scanRoutes, t as RouteEntry } from "./route-scan-DMlwoESy.js";
2
+ import { t as generateContent } from "./content-freeze-CyiW2fRK.js";
3
+ import { i as workerName, n as normalizeBase, r as resolveDeployAdapter, t as freezeConfig } from "./config-freeze-DwI-Rmvq.js";
4
+ import { n as buildManifest } from "./manifest-gcNWqWoI.js";
5
5
  //#region src/build.d.ts
6
6
  type BuildResult = {
7
7
  outFile: string;
@@ -10,31 +10,10 @@ type BuildResult = {
10
10
  contentCollections: string[];
11
11
  prerendered: string[];
12
12
  };
13
- type RouteEntry = {
14
- path: string;
15
- file: string;
16
- dynamic: boolean;
17
- resource?: boolean;
18
- layouts: string[];
19
- loading?: string;
20
- };
21
13
  declare const isBunSpecifier: (id: string) => boolean;
22
- declare function resolveDeployAdapter(deploy: JuneConfig["deploy"]): JuneAdapter;
23
- declare function scanRoutes(appDir: string, dir?: string, layouts?: string[], out?: RouteEntry[], loading?: string): Promise<RouteEntry[]>;
24
- declare function generateContent(appRoot: string): Promise<string[]>;
25
- declare function freezeConfig(appRoot: string): Promise<{
26
- document: DocumentConfig;
27
- agent: WorkerManifest["agent"];
28
- i18n: WorkerManifest["i18n"];
29
- earlyHints: string[];
30
- buildExternal: string[];
31
- }>;
32
- declare function normalizeBase(base?: string): string;
33
- declare function workerName(raw: string): string;
34
- declare function buildManifest(appRoot: string): Promise<WorkerManifest>;
35
14
  declare function juneBuild(appRoot: string, options?: {
36
15
  outDir?: string;
37
16
  external?: string[];
38
17
  }): Promise<BuildResult>;
39
18
  //#endregion
40
- export { BuildResult, buildManifest, freezeConfig, generateContent, isBunSpecifier, juneBuild, normalizeBase, resolveDeployAdapter, scanRoutes, workerName };
19
+ export { BuildResult, type RouteEntry, buildManifest, freezeConfig, generateContent, isBunSpecifier, juneBuild, normalizeBase, resolveDeployAdapter, scanAppRoutes, scanRoutes, workerName };