@junejs/server 1.0.0-dev.29 → 1.0.0-dev.42
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/agent-compile.d.ts +8 -9
- package/dist/agent-discover.d.ts +3 -4
- package/dist/agent-durable.d.ts +38 -20
- package/dist/agent-durable.js +159 -13
- package/dist/agent-native.d.ts +15 -12
- package/dist/agent-native.js +72 -8
- package/dist/app.d.ts +4 -5
- package/dist/app.js +2 -1
- package/dist/blob.d.ts +4 -5
- package/dist/build.d.ts +6 -6
- package/dist/build.js +38 -7
- package/dist/client-bundle.d.ts +8 -9
- package/dist/{config-freeze-DwI-Rmvq.d.ts → config-freeze-ZWC_Qd4h.d.ts} +1 -1
- package/dist/config-freeze.d.ts +1 -1
- package/dist/config-loader.d.ts +3 -4
- package/dist/connection-auth.d.ts +8 -9
- package/dist/content.d.ts +9 -10
- package/dist/core-version.d.ts +3 -4
- package/dist/core-version.js +1 -1
- package/dist/css-modules-ambient.d.ts +2 -1
- package/dist/css-modules.d.ts +10 -11
- package/dist/css.d.ts +9 -10
- package/dist/d1-migrate.d.ts +6 -7
- package/dist/d1-migrate.js +3 -2
- package/dist/db.d.ts +2 -2
- package/dist/deploy.d.ts +3 -4
- package/dist/deploy.js +3 -2
- package/dist/dev-reload.d.ts +3 -4
- package/dist/dev.d.ts +4 -5
- package/dist/favicon.d.ts +16 -17
- package/dist/host.d.ts +5 -5
- package/dist/icon-letter.d.ts +2 -3
- package/dist/index.d.ts +4 -4
- package/dist/instrumentation.d.ts +2 -3
- package/dist/instrumentation.js +2 -1
- package/dist/island-registry.d.ts +6 -7
- package/dist/isolate-local.d.ts +4 -5
- package/dist/kv.d.ts +3 -4
- package/dist/llms-links.d.ts +8 -5
- package/dist/llms-links.js +31 -1
- package/dist/{manifest-gcNWqWoI.d.ts → manifest-DSNX4I-G.d.ts} +2 -2
- package/dist/manifest.d.ts +1 -1
- package/dist/negotiate.d.ts +4 -3
- package/dist/negotiate.js +24 -14
- package/dist/{pipeline-cCR6MGNK.d.ts → pipeline-BHUjBO0G.d.ts} +5 -1
- package/dist/pipeline.d.ts +2 -2
- package/dist/pipeline.js +260 -41
- package/dist/resources.d.ts +5 -6
- package/dist/router.d.ts +12 -13
- package/dist/rsc-build.d.ts +6 -7
- package/dist/rsc-bundle.d.ts +6 -7
- package/dist/rsc-manifest.d.ts +5 -6
- package/dist/rsc-runtime/flight-render-routes.d.ts +3 -4
- package/dist/rsc-runtime/flight-render.d.ts +2 -3
- package/dist/rsc-runtime/flight-to-html.d.ts +2 -3
- package/dist/rsc-runtime/flight-to-html.js +3 -2
- package/dist/rsc-runtime/rsdw-shims.d.ts +2 -1
- package/dist/segment.d.ts +4 -5
- package/dist/sqlite-driver.d.ts +10 -11
- package/dist/static-files.d.ts +4 -5
- package/dist/tsconfig-jsx.d.ts +4 -5
- package/dist/turn-events.d.ts +2 -3
- package/dist/web-manifest.d.ts +3 -4
- package/dist/web-manifest.js +2 -6
- package/dist/{worker-BkFHGtxp.d.ts → worker-Dv4l6Ybs.d.ts} +4 -2
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +35 -18
- package/package.json +5 -5
- package/src/agent-durable.ts +203 -21
- package/src/agent-native.ts +94 -7
- package/src/build.ts +67 -5
- package/src/core-version.ts +1 -1
- package/src/llms-links.ts +46 -1
- package/src/negotiate.ts +39 -15
- package/src/pipeline.ts +433 -45
- package/src/web-manifest.ts +2 -6
- package/src/worker.ts +55 -17
package/dist/agent-native.js
CHANGED
|
@@ -2,7 +2,7 @@ import { observeTurnEvents } from "./turn-events.js";
|
|
|
2
2
|
import { assertCoreRuntimeVersion } from "./core-version.js";
|
|
3
3
|
import { openLocalSqliteSync } from "./sqlite-driver.js";
|
|
4
4
|
import { buildSystemPrompt, channelFetch } from "@junejs/core/agent-config";
|
|
5
|
-
import { AgentSession, withSystem } from "@junejs/core/agent-runtime";
|
|
5
|
+
import { AgentSession, grantAnswer, withSystem } from "@junejs/core/agent-runtime";
|
|
6
6
|
//#region src/agent-native.ts
|
|
7
7
|
function initSchema(db) {
|
|
8
8
|
db.exec(`CREATE TABLE IF NOT EXISTS agent_sessions (session_id TEXT PRIMARY KEY, status TEXT)`);
|
|
@@ -53,7 +53,7 @@ var SqliteSessionStore = class {
|
|
|
53
53
|
throw e;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
reset() {
|
|
56
|
+
reset(inTx) {
|
|
57
57
|
return this.tx(() => {
|
|
58
58
|
this.db.exec(`CREATE TABLE IF NOT EXISTS agent_messages_archive (session_id TEXT, generation INTEGER, seq INTEGER, body TEXT)`);
|
|
59
59
|
this.db.exec(`CREATE TABLE IF NOT EXISTS agent_steps_archive (session_id TEXT, generation INTEGER, id TEXT, output TEXT)`);
|
|
@@ -65,6 +65,7 @@ var SqliteSessionStore = class {
|
|
|
65
65
|
this.db.query("DELETE FROM agent_steps WHERE session_id = ?").run(this.sid);
|
|
66
66
|
this.db.query("INSERT INTO agent_sessions (session_id, status) VALUES (?, 'new') ON CONFLICT(session_id) DO UPDATE SET status = 'new'").run(this.sid);
|
|
67
67
|
this.db.query("INSERT INTO agent_session_generations (session_id, generation) VALUES (?, ?) ON CONFLICT(session_id) DO UPDATE SET generation = ?").run(this.sid, generation + 1, generation + 1);
|
|
68
|
+
inTx?.();
|
|
68
69
|
return generation;
|
|
69
70
|
});
|
|
70
71
|
}
|
|
@@ -89,18 +90,64 @@ var InProcEventSink = class {
|
|
|
89
90
|
return this.subs.size;
|
|
90
91
|
}
|
|
91
92
|
};
|
|
93
|
+
var AnnouncementRetry = class {
|
|
94
|
+
flush;
|
|
95
|
+
state = /* @__PURE__ */ new Map();
|
|
96
|
+
constructor(flush) {
|
|
97
|
+
this.flush = flush;
|
|
98
|
+
}
|
|
99
|
+
delivered(key) {
|
|
100
|
+
const s = this.state.get(key);
|
|
101
|
+
if (s?.timer) clearTimeout(s.timer);
|
|
102
|
+
this.state.delete(key);
|
|
103
|
+
}
|
|
104
|
+
failed(key, agent, id) {
|
|
105
|
+
const s = this.state.get(key) ?? { failures: 0 };
|
|
106
|
+
this.state.set(key, s);
|
|
107
|
+
if (s.timer) return;
|
|
108
|
+
const delay = Math.min(5e3 * 2 ** s.failures, 3e5);
|
|
109
|
+
s.failures++;
|
|
110
|
+
s.timer = setTimeout(() => {
|
|
111
|
+
s.timer = void 0;
|
|
112
|
+
this.flush(agent, id);
|
|
113
|
+
}, delay);
|
|
114
|
+
s.timer.unref?.();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
function wireAnnouncements(session, def, retry) {
|
|
118
|
+
const hook = def.onInputAnnouncement;
|
|
119
|
+
if (hook) {
|
|
120
|
+
const key = `${session.agent}:${session.id}`;
|
|
121
|
+
session.onAnnounce = async (a) => {
|
|
122
|
+
try {
|
|
123
|
+
await hook(a);
|
|
124
|
+
} catch (err) {
|
|
125
|
+
retry.failed(key, session.agent, session.id);
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
128
|
+
retry.delivered(key);
|
|
129
|
+
};
|
|
130
|
+
session.flushAnnouncements();
|
|
131
|
+
}
|
|
132
|
+
return session;
|
|
133
|
+
}
|
|
134
|
+
const ANNOUNCE_OUTBOX_STEP = "announce-outbox";
|
|
92
135
|
function toAgentDef(agent, model) {
|
|
93
136
|
return {
|
|
94
137
|
model,
|
|
95
138
|
tools: agent.tools,
|
|
96
139
|
instructions: buildSystemPrompt(agent),
|
|
97
|
-
...agent.channelInstructions ? { channelInstructions: agent.channelInstructions } : {}
|
|
140
|
+
...agent.channelInstructions ? { channelInstructions: agent.channelInstructions } : {},
|
|
141
|
+
...agent.onInputAnnouncement ? { onInputAnnouncement: agent.onInputAnnouncement } : {}
|
|
98
142
|
};
|
|
99
143
|
}
|
|
100
144
|
var NativeRuntime = class {
|
|
101
145
|
actors = /* @__PURE__ */ new Map();
|
|
102
146
|
agents;
|
|
103
147
|
db;
|
|
148
|
+
announceRetry = new AnnouncementRetry((agent, id) => {
|
|
149
|
+
this.session(agent, id).flushAnnouncements();
|
|
150
|
+
});
|
|
104
151
|
maxSessions;
|
|
105
152
|
constructor(agents, db, opts = {}) {
|
|
106
153
|
assertCoreRuntimeVersion("NativeRuntime");
|
|
@@ -126,7 +173,7 @@ var NativeRuntime = class {
|
|
|
126
173
|
if (!def) throw new Error(`unknown agent: ${agent}`);
|
|
127
174
|
const model = def.instructions ? withSystem(def.model, def.instructions) : def.model;
|
|
128
175
|
const sink = new InProcEventSink();
|
|
129
|
-
const session = new AgentSession(agent, id, new SqliteSessionStore(this.db, key), sink, model, def.tools, this, def.channelInstructions);
|
|
176
|
+
const session = wireAnnouncements(new AgentSession(agent, id, new SqliteSessionStore(this.db, key), sink, model, def.tools, this, def.channelInstructions), def, this.announceRetry);
|
|
130
177
|
this.evictIdle();
|
|
131
178
|
this.actors.set(key, {
|
|
132
179
|
session,
|
|
@@ -137,6 +184,13 @@ var NativeRuntime = class {
|
|
|
137
184
|
get sessionCount() {
|
|
138
185
|
return this.actors.size;
|
|
139
186
|
}
|
|
187
|
+
recoverAnnouncements() {
|
|
188
|
+
const rows = this.db.query("SELECT output FROM agent_steps WHERE id = ?").all(ANNOUNCE_OUTBOX_STEP);
|
|
189
|
+
for (const { output } of rows) {
|
|
190
|
+
const [first] = JSON.parse(output);
|
|
191
|
+
if (first && this.agents[first.agent]?.onInputAnnouncement) this.session(first.agent, first.session);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
140
194
|
evictIdle() {
|
|
141
195
|
if (this.actors.size < this.maxSessions) return;
|
|
142
196
|
for (const [key, a] of this.actors) {
|
|
@@ -146,7 +200,9 @@ var NativeRuntime = class {
|
|
|
146
200
|
}
|
|
147
201
|
};
|
|
148
202
|
async function createNativeRuntime(agents, path = ":memory:", opts = {}) {
|
|
149
|
-
|
|
203
|
+
const runtime = new NativeRuntime(agents, await openLocalSqliteSync(path), opts);
|
|
204
|
+
runtime.recoverAnnouncements();
|
|
205
|
+
return runtime;
|
|
150
206
|
}
|
|
151
207
|
var MemorySessionStore = class {
|
|
152
208
|
msgs = [];
|
|
@@ -181,7 +237,7 @@ var MemorySessionStore = class {
|
|
|
181
237
|
tx(fn) {
|
|
182
238
|
return fn();
|
|
183
239
|
}
|
|
184
|
-
reset() {
|
|
240
|
+
reset(inTx) {
|
|
185
241
|
const generation = this.generation++;
|
|
186
242
|
this.archives.push({
|
|
187
243
|
generation,
|
|
@@ -191,6 +247,7 @@ var MemorySessionStore = class {
|
|
|
191
247
|
this.msgs = [];
|
|
192
248
|
this.steps = /* @__PURE__ */ new Map();
|
|
193
249
|
this.status = "new";
|
|
250
|
+
inTx?.();
|
|
194
251
|
return generation;
|
|
195
252
|
}
|
|
196
253
|
unwrap() {}
|
|
@@ -199,6 +256,9 @@ var MemoryRuntime = class {
|
|
|
199
256
|
actors = /* @__PURE__ */ new Map();
|
|
200
257
|
stores = /* @__PURE__ */ new Map();
|
|
201
258
|
agents;
|
|
259
|
+
announceRetry = new AnnouncementRetry((agent, id) => {
|
|
260
|
+
this.session(agent, id).flushAnnouncements();
|
|
261
|
+
});
|
|
202
262
|
constructor(agents) {
|
|
203
263
|
assertCoreRuntimeVersion("MemoryRuntime");
|
|
204
264
|
this.agents = agents;
|
|
@@ -215,7 +275,7 @@ var MemoryRuntime = class {
|
|
|
215
275
|
const store = new MemorySessionStore();
|
|
216
276
|
this.stores.set(key, store);
|
|
217
277
|
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);
|
|
278
|
+
a = wireAnnouncements(new AgentSession(agent, id, store, new InProcEventSink(), model, def.tools, this, def.channelInstructions), def, this.announceRetry);
|
|
219
279
|
this.actors.set(key, a);
|
|
220
280
|
}
|
|
221
281
|
return a;
|
|
@@ -271,7 +331,11 @@ function mountAgent(agent, runtime, opts = {}) {
|
|
|
271
331
|
},
|
|
272
332
|
resumeStream: async function* (o) {
|
|
273
333
|
const session = runtime.session(agent.name, o.session ?? "default");
|
|
274
|
-
const
|
|
334
|
+
const granted = await grantAnswer(session, o, agent.authorizeAnswer);
|
|
335
|
+
const { turnId } = session.resume(o.turnId, o.inputId, o.input, {
|
|
336
|
+
by: o.by,
|
|
337
|
+
granted
|
|
338
|
+
});
|
|
275
339
|
yield* observeTurnEvents(session, turnId);
|
|
276
340
|
},
|
|
277
341
|
resetSession: (o) => runtime.session(agent.name, o?.session ?? "default").reset()
|
package/dist/app.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { JuneConfig } from "@junejs/core/config";
|
|
2
2
|
//#region src/app.d.ts
|
|
3
|
-
type CreateAppOptions = {
|
|
3
|
+
export type CreateAppOptions = {
|
|
4
4
|
appDir: string;
|
|
5
5
|
config?: JuneConfig;
|
|
6
6
|
};
|
|
7
|
-
type JuneApp = {
|
|
7
|
+
export type JuneApp = {
|
|
8
8
|
fetch(request: Request): Promise<Response>;
|
|
9
9
|
warmup(): Promise<void>;
|
|
10
10
|
routePaths(): Promise<string[]>;
|
|
11
11
|
earlyHints(): string[];
|
|
12
12
|
};
|
|
13
|
-
declare function createApp({ appDir: appDirInput, config }: CreateAppOptions): JuneApp;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { CreateAppOptions, JuneApp, createApp };
|
|
13
|
+
export declare function createApp({ appDir: appDirInput, config }: CreateAppOptions): JuneApp;
|
|
14
|
+
//#endregion
|
package/dist/app.js
CHANGED
|
@@ -137,7 +137,8 @@ function createApp({ appDir: appDirInput, config = {} }) {
|
|
|
137
137
|
const def = await discoverAgent(agentDir);
|
|
138
138
|
const backend = agent.runtime.backend === "durable" ? "native" : agent.runtime.backend;
|
|
139
139
|
const model = anthropic({ model: def.model });
|
|
140
|
-
const
|
|
140
|
+
const rt = await createAgentRuntime({ [def.name]: toAgentDef(def, model) }, { backend });
|
|
141
|
+
const mounted = mountAgent(def, rt, {
|
|
141
142
|
chatPath: agent.runtime.chat.path,
|
|
142
143
|
channels: agent.runtime.channels
|
|
143
144
|
});
|
package/dist/blob.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BlobFactory } from "@junejs/core/resources";
|
|
2
2
|
//#region src/blob.d.ts
|
|
3
|
-
declare function localBlob(opts?: {
|
|
3
|
+
export declare function localBlob(opts?: {
|
|
4
4
|
dir?: string;
|
|
5
5
|
}): BlobFactory;
|
|
6
6
|
interface R2ObjectBody {
|
|
7
7
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
8
8
|
}
|
|
9
|
-
interface R2Bucket {
|
|
9
|
+
export interface R2Bucket {
|
|
10
10
|
get(key: string): Promise<R2ObjectBody | null>;
|
|
11
11
|
put(key: string, data: ArrayBuffer | Uint8Array | string): Promise<unknown>;
|
|
12
12
|
delete(key: string): Promise<void>;
|
|
@@ -18,6 +18,5 @@ interface R2Bucket {
|
|
|
18
18
|
}[];
|
|
19
19
|
}>;
|
|
20
20
|
}
|
|
21
|
-
declare function r2(bucket: R2Bucket): BlobFactory;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { R2Bucket, localBlob, r2 };
|
|
21
|
+
export declare function r2(bucket: R2Bucket): BlobFactory;
|
|
22
|
+
//#endregion
|
package/dist/build.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { n as scanAppRoutes, r as scanRoutes, t as RouteEntry } from "./route-scan-DMlwoESy.js";
|
|
2
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-
|
|
4
|
-
import { n as buildManifest } from "./manifest-
|
|
3
|
+
import { i as workerName, n as normalizeBase, r as resolveDeployAdapter, t as freezeConfig } from "./config-freeze-ZWC_Qd4h.js";
|
|
4
|
+
import { n as buildManifest } from "./manifest-DSNX4I-G.js";
|
|
5
5
|
//#region src/build.d.ts
|
|
6
|
-
type BuildResult = {
|
|
6
|
+
export type BuildResult = {
|
|
7
7
|
outFile: string;
|
|
8
8
|
routes: string[];
|
|
9
9
|
dynamicRoutes: string[];
|
|
10
10
|
contentCollections: string[];
|
|
11
11
|
prerendered: string[];
|
|
12
12
|
};
|
|
13
|
-
declare const isBunSpecifier: (id: string) => boolean;
|
|
14
|
-
declare function juneBuild(appRoot: string, options?: {
|
|
13
|
+
export declare const isBunSpecifier: (id: string) => boolean;
|
|
14
|
+
export declare function juneBuild(appRoot: string, options?: {
|
|
15
15
|
outDir?: string;
|
|
16
16
|
external?: string[];
|
|
17
17
|
}): Promise<BuildResult>;
|
|
18
18
|
//#endregion
|
|
19
|
-
export {
|
|
19
|
+
export { type RouteEntry, buildManifest, freezeConfig, generateContent, normalizeBase, resolveDeployAdapter, scanAppRoutes, scanRoutes, workerName };
|
package/dist/build.js
CHANGED
|
@@ -157,7 +157,7 @@ async function juneBuild(appRoot, options = {}) {
|
|
|
157
157
|
const layoutBoundariesField = boundaries.length ? `\n layoutBoundaries: {\n${boundaries.join("\n")}\n },` : "";
|
|
158
158
|
const builtExtraFile = findMiddlewareFile(appDir);
|
|
159
159
|
if (builtExtraFile) imports.push(`import extra from ${JSON.stringify(importPath(genDir, builtExtraFile))};`);
|
|
160
|
-
const linkHeader = buildLinkHeader(frozen.agent);
|
|
160
|
+
const linkHeader = buildLinkHeader(frozen.agent, { catalogs: !frozen.document.basePath });
|
|
161
161
|
const adapterEntry = adapter.entry({ linkHeader });
|
|
162
162
|
const resourceFlags = {
|
|
163
163
|
db: !!resourcesCfg?.db,
|
|
@@ -208,6 +208,10 @@ export class JuneAgentDO extends DurableObject {
|
|
|
208
208
|
fetch(req: Request): Promise<Response> {
|
|
209
209
|
return this.#agent.fetch(req);
|
|
210
210
|
}
|
|
211
|
+
// Delivers input announcements left undelivered — a failed hook's retry, or the watchdog (#260).
|
|
212
|
+
alarm(): Promise<void> {
|
|
213
|
+
return this.#agent.alarm();
|
|
214
|
+
}
|
|
211
215
|
}
|
|
212
216
|
` : "";
|
|
213
217
|
const entry = `// AUTO-GENERATED by \`june build\` — do not edit. Regenerate: june build .
|
|
@@ -267,7 +271,14 @@ ${doClass}`;
|
|
|
267
271
|
if (cssAsset) manifest.document.styles = `/${cssAsset}`;
|
|
268
272
|
if (clientAsset) manifest.document.clientScript = `/${clientAsset}`;
|
|
269
273
|
if (moduleCssAsset) manifest.document.moduleStyles = `/${moduleCssAsset}`;
|
|
270
|
-
const
|
|
274
|
+
const isStatic = adapter.capabilities.runtime === "static";
|
|
275
|
+
if (isStatic) manifest.agent = {
|
|
276
|
+
...manifest.agent,
|
|
277
|
+
mcp: false,
|
|
278
|
+
api: false,
|
|
279
|
+
webmcp: false
|
|
280
|
+
};
|
|
281
|
+
const worker = createWorker(manifest, { staticBuild: isStatic });
|
|
271
282
|
let hasAssets = false;
|
|
272
283
|
const publicDir = join(appRoot, "public");
|
|
273
284
|
const publicFiles = [];
|
|
@@ -303,7 +314,6 @@ ${doClass}`;
|
|
|
303
314
|
}
|
|
304
315
|
hasAssets = true;
|
|
305
316
|
}
|
|
306
|
-
const isStatic = adapter.capabilities.runtime === "static";
|
|
307
317
|
const i18n = frozen.i18n;
|
|
308
318
|
const prerenderOne = async (reqPath, def) => {
|
|
309
319
|
const stem = reqPath === "/" ? "index" : reqPath.slice(1);
|
|
@@ -326,6 +336,10 @@ ${doClass}`;
|
|
|
326
336
|
prerendered.push(reqPath);
|
|
327
337
|
hasAssets = true;
|
|
328
338
|
};
|
|
339
|
+
if (isStatic && i18n) {
|
|
340
|
+
const onDomain = Object.keys(i18n.locales).filter((l) => i18n.locales[l].domain);
|
|
341
|
+
if (onDomain.length) throw new Error(`[june build] the static() target serves one host, so i18n locales with their own domain are not supported (${onDomain.join(", ")}). Give them a path prefix instead, e.g. { path: "/${onDomain[0]}" }.`);
|
|
342
|
+
}
|
|
329
343
|
const localeVariants = (path) => isStatic && i18n ? [...new Set(Object.keys(i18n.locales).map((l) => localeHref(i18n, path, l)))] : [path];
|
|
330
344
|
for (const r of routes.filter((x) => !x.dynamic)) {
|
|
331
345
|
const def = manifest.routes[r.path];
|
|
@@ -338,18 +352,34 @@ ${doClass}`;
|
|
|
338
352
|
const sp = dyn.def.staticPaths;
|
|
339
353
|
if (!sp) continue;
|
|
340
354
|
const paths = typeof sp === "function" ? await sp() : sp;
|
|
355
|
+
dyn.def.staticPaths = paths;
|
|
341
356
|
for (const p of paths) await prerenderOne(p, dyn.def);
|
|
342
357
|
}
|
|
343
|
-
|
|
358
|
+
const extra = [
|
|
344
359
|
["/favicon.svg", "favicon.svg"],
|
|
345
360
|
["/manifest.webmanifest", "manifest.webmanifest"],
|
|
346
361
|
["/llms.txt", "llms.txt"],
|
|
347
362
|
["/sitemap.xml", "sitemap.xml"]
|
|
348
|
-
]
|
|
363
|
+
];
|
|
364
|
+
if (manifest.agent.discovery && !manifest.document.site.url && !manifest.document.deployOrigin) console.warn("[june build] no sitemap.xml: set site.url (or deploy.domain) in june.config.ts so its URLs are absolute.");
|
|
365
|
+
const doc = manifest.document;
|
|
366
|
+
if (manifest.agent.discovery && !doc.basePath && (doc.site.url || doc.deployOrigin)) extra.push(["/.well-known/ai-catalog.json", ".well-known/ai-catalog.json"], ["/.well-known/ard.json", ".well-known/ard.json"], ["/.well-known/agent-skills/index.json", ".well-known/agent-skills/index.json"]);
|
|
367
|
+
for (let i = 0; i < extra.length; i++) {
|
|
368
|
+
const [reqPath, file] = extra[i];
|
|
349
369
|
const res = await worker.fetch(new Request(`${PRERENDER_ORIGIN}${reqPath}`));
|
|
350
370
|
if (!res.ok) continue;
|
|
351
|
-
|
|
371
|
+
const bytes = Buffer.from(await res.arrayBuffer());
|
|
372
|
+
await mkdir(dirname(join(assetsDir, file)), { recursive: true });
|
|
373
|
+
await writeFile(join(assetsDir, file), bytes);
|
|
352
374
|
hasAssets = true;
|
|
375
|
+
if (file.endsWith("agent-skills/index.json")) {
|
|
376
|
+
const index = JSON.parse(bytes.toString("utf8"));
|
|
377
|
+
for (const s of index.skills ?? []) {
|
|
378
|
+
if (!s.url) continue;
|
|
379
|
+
const p = new URL(s.url, PRERENDER_ORIGIN).pathname;
|
|
380
|
+
extra.push([p, p.slice(1)]);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
353
383
|
}
|
|
354
384
|
const nf = await worker.fetch(new Request(`${PRERENDER_ORIGIN}/__june_not_found__`));
|
|
355
385
|
await writeFile(join(assetsDir, "404.html"), Buffer.from(await nf.arrayBuffer()));
|
|
@@ -369,7 +399,8 @@ ${doClass}`;
|
|
|
369
399
|
hasAssets = true;
|
|
370
400
|
}
|
|
371
401
|
const pkgPath = join(appRoot, "package.json");
|
|
372
|
-
const
|
|
402
|
+
const pkgName = existsSync(pkgPath) ? JSON.parse(await Bun.file(pkgPath).text()).name : void 0;
|
|
403
|
+
const defaultName = workerName(pkgName ?? basename(appRoot));
|
|
373
404
|
const plan = {
|
|
374
405
|
...resourcesCfg?.db && resourcesCfg.db.kind !== "turso" ? { db: {
|
|
375
406
|
binding: "DB",
|
package/dist/client-bundle.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { ModuleMaps } from "./css-modules.js";
|
|
2
2
|
//#region src/client-bundle.d.ts
|
|
3
|
-
declare const CLIENT_SCRIPT_URL = "/_june/client.js";
|
|
4
|
-
declare function findClientEntry(appDir: string): string | undefined;
|
|
3
|
+
export declare const CLIENT_SCRIPT_URL = "/_june/client.js";
|
|
4
|
+
export declare function findClientEntry(appDir: string): string | undefined;
|
|
5
5
|
type BundleMode = "development" | "production";
|
|
6
|
-
declare function isExpectedClientLog(log: {
|
|
6
|
+
export declare function isExpectedClientLog(log: {
|
|
7
7
|
code?: string;
|
|
8
8
|
exporter?: string;
|
|
9
9
|
}): boolean;
|
|
10
|
-
type ClientChunks = Map<string, string>;
|
|
11
|
-
declare function bundleClientSplit(entryFile: string, cwd: string, mode: BundleMode, maps?: ModuleMaps): Promise<ClientChunks>;
|
|
12
|
-
declare function bundleClientToString(entryFile: string, cwd: string, maps?: ModuleMaps): Promise<string>;
|
|
13
|
-
declare function bundleClientToFile(entryFile: string, cwd: string, destDir: string, maps?: ModuleMaps): Promise<string>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { CLIENT_SCRIPT_URL, ClientChunks, bundleClientSplit, bundleClientToFile, bundleClientToString, findClientEntry, isExpectedClientLog };
|
|
10
|
+
export type ClientChunks = Map<string, string>;
|
|
11
|
+
export declare function bundleClientSplit(entryFile: string, cwd: string, mode: BundleMode, maps?: ModuleMaps): Promise<ClientChunks>;
|
|
12
|
+
export declare function bundleClientToString(entryFile: string, cwd: string, maps?: ModuleMaps): Promise<string>;
|
|
13
|
+
export declare function bundleClientToFile(entryFile: string, cwd: string, destDir: string, maps?: ModuleMaps): Promise<string>;
|
|
14
|
+
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as JuneAdapter } from "./adapter-DcZ-W1-7.js";
|
|
2
|
-
import { n as WorkerManifest } from "./worker-
|
|
2
|
+
import { n as WorkerManifest } from "./worker-Dv4l6Ybs.js";
|
|
3
3
|
import { JuneConfig } from "@junejs/core/config";
|
|
4
4
|
import { DocumentConfig } from "@junejs/core/document";
|
|
5
5
|
//#region src/config-freeze.d.ts
|
package/dist/config-freeze.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as workerName, n as normalizeBase, r as resolveDeployAdapter, t as freezeConfig } from "./config-freeze-
|
|
1
|
+
import { i as workerName, n as normalizeBase, r as resolveDeployAdapter, t as freezeConfig } from "./config-freeze-ZWC_Qd4h.js";
|
|
2
2
|
export { freezeConfig, normalizeBase, resolveDeployAdapter, workerName };
|
package/dist/config-loader.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { JuneConfig } from "@junejs/core/config";
|
|
|
3
3
|
/** The config file loadJuneConfig would import, or null. Exported so callers that need a FRESH
|
|
4
4
|
* load (a subprocess probe — see generateContent's bootstrap retry) target the same file the
|
|
5
5
|
* in-process loader would. */
|
|
6
|
-
declare function findJuneConfigPath(appDir: string): string | null;
|
|
7
|
-
declare function loadJuneConfig(appDir: string): Promise<JuneConfig>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { findJuneConfigPath, loadJuneConfig };
|
|
6
|
+
export declare function findJuneConfigPath(appDir: string): string | null;
|
|
7
|
+
export declare function loadJuneConfig(appDir: string): Promise<JuneConfig>;
|
|
8
|
+
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionContext } from "@junejs/core/context";
|
|
2
2
|
//#region src/connection-auth.d.ts
|
|
3
|
-
type AccountTokenStore = (args: {
|
|
3
|
+
export type AccountTokenStore = (args: {
|
|
4
4
|
userId: string;
|
|
5
5
|
providerId: string;
|
|
6
6
|
}) => Promise<{
|
|
@@ -8,15 +8,15 @@ type AccountTokenStore = (args: {
|
|
|
8
8
|
} | null> | {
|
|
9
9
|
accessToken: string;
|
|
10
10
|
} | null;
|
|
11
|
-
type LinkedAccountAuthOptions = {
|
|
11
|
+
export type LinkedAccountAuthOptions = {
|
|
12
12
|
providerId: string;
|
|
13
13
|
store: AccountTokenStore;
|
|
14
14
|
};
|
|
15
|
-
type ConnectionAuth = (ctx?: ActionContext) => Promise<{
|
|
15
|
+
export type ConnectionAuth = (ctx?: ActionContext) => Promise<{
|
|
16
16
|
token: string;
|
|
17
17
|
}>;
|
|
18
|
-
declare function linkedAccountAuth(opts: LinkedAccountAuthOptions): ConnectionAuth;
|
|
19
|
-
type BetterAuthLike = {
|
|
18
|
+
export declare function linkedAccountAuth(opts: LinkedAccountAuthOptions): ConnectionAuth;
|
|
19
|
+
export type BetterAuthLike = {
|
|
20
20
|
api: {
|
|
21
21
|
getAccessToken: (input: {
|
|
22
22
|
body: {
|
|
@@ -31,9 +31,8 @@ type BetterAuthLike = {
|
|
|
31
31
|
} | null | undefined>;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
declare function betterAuthAccountTokenStore(auth: BetterAuthLike): AccountTokenStore;
|
|
35
|
-
declare function betterAuthAccessToken(auth: BetterAuthLike, opts: {
|
|
34
|
+
export declare function betterAuthAccountTokenStore(auth: BetterAuthLike): AccountTokenStore;
|
|
35
|
+
export declare function betterAuthAccessToken(auth: BetterAuthLike, opts: {
|
|
36
36
|
providerId: string;
|
|
37
37
|
}): ConnectionAuth;
|
|
38
|
-
//#endregion
|
|
39
|
-
export { AccountTokenStore, BetterAuthLike, ConnectionAuth, LinkedAccountAuthOptions, betterAuthAccessToken, betterAuthAccountTokenStore, linkedAccountAuth };
|
|
38
|
+
//#endregion
|
package/dist/content.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ContentSource } from "@junejs/core/config";
|
|
2
2
|
//#region src/content.d.ts
|
|
3
|
-
type Heading = {
|
|
3
|
+
export type Heading = {
|
|
4
4
|
depth: number;
|
|
5
5
|
text: string;
|
|
6
6
|
id: string;
|
|
7
7
|
};
|
|
8
|
-
declare function headingIds(html: string): {
|
|
8
|
+
export declare function headingIds(html: string): {
|
|
9
9
|
html: string;
|
|
10
10
|
headings: Heading[];
|
|
11
11
|
};
|
|
12
|
-
type ContentEntry = {
|
|
12
|
+
export type ContentEntry = {
|
|
13
13
|
slug: string;
|
|
14
14
|
file: string;
|
|
15
15
|
/** Parsed frontmatter (string values; `tags`-style lists become string[]). */
|
|
@@ -29,25 +29,24 @@ type ContentEntry = {
|
|
|
29
29
|
* subdir, undefined for the flat (default-locale) files. */
|
|
30
30
|
locale?: string;
|
|
31
31
|
};
|
|
32
|
-
type ScannedCollection = {
|
|
32
|
+
export type ScannedCollection = {
|
|
33
33
|
default: ContentEntry[];
|
|
34
34
|
byLocale: Record<string, ContentEntry[]>;
|
|
35
35
|
};
|
|
36
|
-
declare function scanCollection(dir: string, knownLocales?: readonly string[]): ScannedCollection;
|
|
36
|
+
export declare function scanCollection(dir: string, knownLocales?: readonly string[]): ScannedCollection;
|
|
37
37
|
/** All entries in a content directory, newest-first by `date` (then slug). With
|
|
38
38
|
* a `locale`, each entry is its locale variant when present, else the default
|
|
39
39
|
* (so a reader sees the whole collection, localized where available). */
|
|
40
|
-
declare function collection(dir: string, locale?: string): ContentEntry[];
|
|
40
|
+
export declare function collection(dir: string, locale?: string): ContentEntry[];
|
|
41
41
|
/** One entry by slug, or null. With a `locale`, prefer `<dir>/<locale>/<slug>`,
|
|
42
42
|
* falling back to the flat default (a dev-warn flags a partial translation).
|
|
43
43
|
* `fallback: false` is STRICT — a missing variant returns null (so a route can
|
|
44
44
|
* 404 rather than serve default-language content). */
|
|
45
|
-
declare function entry(dir: string, slug: string, locale?: string, opts?: {
|
|
45
|
+
export declare function entry(dir: string, slug: string, locale?: string, opts?: {
|
|
46
46
|
fallback?: boolean;
|
|
47
47
|
}): ContentEntry | null;
|
|
48
|
-
declare function generateContentModule(contentDir: string, knownLocales?: readonly string[], sources?: readonly ContentSource[]): {
|
|
48
|
+
export declare function generateContentModule(contentDir: string, knownLocales?: readonly string[], sources?: readonly ContentSource[]): {
|
|
49
49
|
code: string;
|
|
50
50
|
names: string[];
|
|
51
51
|
};
|
|
52
|
-
//#endregion
|
|
53
|
-
export { ContentEntry, Heading, ScannedCollection, collection, entry, generateContentModule, headingIds, scanCollection };
|
|
52
|
+
//#endregion
|
package/dist/core-version.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/core-version.d.ts
|
|
2
|
-
declare function assertCoreRuntimeVersion(surface: string): void;
|
|
3
|
-
declare function checkCoreRuntimeVersion(surface: string, actual: number | undefined, expected?: number): void;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { assertCoreRuntimeVersion, checkCoreRuntimeVersion };
|
|
2
|
+
export declare function assertCoreRuntimeVersion(surface: string): void;
|
|
3
|
+
export declare function checkCoreRuntimeVersion(surface: string, actual: number | undefined, expected?: number): void;
|
|
4
|
+
//#endregion
|
package/dist/core-version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as coreRuntime from "@junejs/core/agent-runtime";
|
|
2
2
|
//#region src/core-version.ts
|
|
3
|
-
const EXPECTED_CORE_RUNTIME_API =
|
|
3
|
+
const EXPECTED_CORE_RUNTIME_API = 6;
|
|
4
4
|
function assertCoreRuntimeVersion(surface) {
|
|
5
5
|
checkCoreRuntimeVersion(surface, coreRuntime.RUNTIME_API_VERSION);
|
|
6
6
|
}
|
package/dist/css-modules.d.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
//#region src/css-modules.d.ts
|
|
2
|
-
declare const MODULE_STYLES_URL = "/_june/modules.css";
|
|
3
|
-
declare const isModuleCss: (id: string) => boolean;
|
|
4
|
-
declare function stableKey(appRoot: string, file: string): string;
|
|
5
|
-
declare function transformCssModule(file: string, appRoot: string): Promise<{
|
|
2
|
+
export declare const MODULE_STYLES_URL = "/_june/modules.css";
|
|
3
|
+
export declare const isModuleCss: (id: string) => boolean;
|
|
4
|
+
export declare function stableKey(appRoot: string, file: string): string;
|
|
5
|
+
export declare function transformCssModule(file: string, appRoot: string): Promise<{
|
|
6
6
|
map: Record<string, string>;
|
|
7
7
|
css: string;
|
|
8
8
|
}>;
|
|
9
|
-
declare const moduleJs: (map: Record<string, string>) => string;
|
|
10
|
-
type ModuleMaps = Record<string, Record<string, string>>;
|
|
11
|
-
declare function buildModuleCss(appDir: string, appRoot: string): Promise<{
|
|
9
|
+
export declare const moduleJs: (map: Record<string, string>) => string;
|
|
10
|
+
export type ModuleMaps = Record<string, Record<string, string>>;
|
|
11
|
+
export declare function buildModuleCss(appDir: string, appRoot: string): Promise<{
|
|
12
12
|
maps: ModuleMaps;
|
|
13
13
|
css: string | null;
|
|
14
14
|
}>;
|
|
15
|
-
declare function rolldownCssModulesPlugin(maps: ModuleMaps): {
|
|
15
|
+
export declare function rolldownCssModulesPlugin(maps: ModuleMaps): {
|
|
16
16
|
name: string;
|
|
17
17
|
load(id: string): {
|
|
18
18
|
code: string;
|
|
19
19
|
moduleType: "js";
|
|
20
20
|
} | null;
|
|
21
21
|
};
|
|
22
|
-
declare function registerCssModules(maps: ModuleMaps): Promise<void>;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { MODULE_STYLES_URL, ModuleMaps, buildModuleCss, isModuleCss, moduleJs, registerCssModules, rolldownCssModulesPlugin, stableKey, transformCssModule };
|
|
22
|
+
export declare function registerCssModules(maps: ModuleMaps): Promise<void>;
|
|
23
|
+
//#endregion
|
package/dist/css.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Targets } from "lightningcss";
|
|
2
2
|
//#region src/css.d.ts
|
|
3
|
-
declare const STYLES_URL = "/_june/global.css";
|
|
4
|
-
declare function findGlobalCss(appDir: string): string | null;
|
|
5
|
-
declare function globalCssUsesTailwind(appDir: string): boolean;
|
|
6
|
-
declare function cssTargets(appDir: string): Promise<Targets>;
|
|
7
|
-
declare function processCssCached(appDir: string): Promise<string | null>;
|
|
8
|
-
declare function invalidateCss(): void;
|
|
9
|
-
declare function minifyCss(css: string, filename?: string, targets?: Targets): Promise<string>;
|
|
10
|
-
declare function processCss(appDir: string, opts?: {
|
|
3
|
+
export declare const STYLES_URL = "/_june/global.css";
|
|
4
|
+
export declare function findGlobalCss(appDir: string): string | null;
|
|
5
|
+
export declare function globalCssUsesTailwind(appDir: string): boolean;
|
|
6
|
+
export declare function cssTargets(appDir: string): Promise<Targets>;
|
|
7
|
+
export declare function processCssCached(appDir: string): Promise<string | null>;
|
|
8
|
+
export declare function invalidateCss(): void;
|
|
9
|
+
export declare function minifyCss(css: string, filename?: string, targets?: Targets): Promise<string>;
|
|
10
|
+
export declare function processCss(appDir: string, opts?: {
|
|
11
11
|
minify?: boolean;
|
|
12
12
|
}): Promise<string | null>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { STYLES_URL, cssTargets, findGlobalCss, globalCssUsesTailwind, invalidateCss, minifyCss, processCss, processCssCached };
|
|
13
|
+
//#endregion
|
package/dist/d1-migrate.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as MigrateResult } from "./migrate-BbWt-PuB.js";
|
|
2
2
|
import { JuneDb } from "@junejs/core/resources";
|
|
3
3
|
//#region src/d1-migrate.d.ts
|
|
4
|
-
type D1Exec = (req: {
|
|
4
|
+
export type D1Exec = (req: {
|
|
5
5
|
sql: string;
|
|
6
6
|
mode: "command" | "file";
|
|
7
7
|
json: boolean;
|
|
@@ -10,16 +10,16 @@ type D1Exec = (req: {
|
|
|
10
10
|
stderr: string;
|
|
11
11
|
exitCode: number;
|
|
12
12
|
}>;
|
|
13
|
-
declare function inlineParams(sql: string, params: readonly unknown[]): string;
|
|
14
|
-
declare function wranglerD1(opts: {
|
|
13
|
+
export declare function inlineParams(sql: string, params: readonly unknown[]): string;
|
|
14
|
+
export declare function wranglerD1(opts: {
|
|
15
15
|
database: string;
|
|
16
16
|
configPath: string;
|
|
17
17
|
cwd: string;
|
|
18
18
|
wranglerVersion?: string;
|
|
19
19
|
exec?: D1Exec;
|
|
20
20
|
}): JuneDb;
|
|
21
|
-
declare function resolveD1Database(appRoot: string, configPath: string): Promise<string | null>;
|
|
22
|
-
declare function migrateD1(opts: {
|
|
21
|
+
export declare function resolveD1Database(appRoot: string, configPath: string): Promise<string | null>;
|
|
22
|
+
export declare function migrateD1(opts: {
|
|
23
23
|
appRoot: string;
|
|
24
24
|
database: string;
|
|
25
25
|
configPath: string;
|
|
@@ -27,5 +27,4 @@ declare function migrateD1(opts: {
|
|
|
27
27
|
exec?: D1Exec;
|
|
28
28
|
now?: string;
|
|
29
29
|
}): Promise<MigrateResult>;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { D1Exec, inlineParams, migrateD1, resolveD1Database, wranglerD1 };
|
|
30
|
+
//#endregion
|
package/dist/d1-migrate.js
CHANGED
|
@@ -142,12 +142,13 @@ async function resolveD1Database(appRoot, configPath) {
|
|
|
142
142
|
return `${(pkgName ?? basename(appRoot)).replace(/[^a-z0-9-]/gi, "-").toLowerCase()}-db`;
|
|
143
143
|
}
|
|
144
144
|
async function migrateD1(opts) {
|
|
145
|
-
|
|
145
|
+
const db = wranglerD1({
|
|
146
146
|
database: opts.database,
|
|
147
147
|
configPath: opts.configPath,
|
|
148
148
|
cwd: opts.appRoot,
|
|
149
149
|
exec: opts.exec
|
|
150
|
-
})
|
|
150
|
+
});
|
|
151
|
+
return migrate(db, join(opts.appRoot, "db", "migrations"), {
|
|
151
152
|
allowDestructive: opts.allowDestructive,
|
|
152
153
|
now: opts.now
|
|
153
154
|
});
|
package/dist/db.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { n as mysql, r as mysqlJuneDb, t as MysqlConnLike } from "./mysql-driver
|
|
|
4
4
|
import { i as turso, r as libsqlJuneDb, t as LibsqlClientLike } from "./turso-driver-C1wEigMZ.js";
|
|
5
5
|
import { DbFactory } from "@junejs/core/resources";
|
|
6
6
|
//#region src/db.d.ts
|
|
7
|
-
declare function sqlite(opts?: {
|
|
7
|
+
export declare function sqlite(opts?: {
|
|
8
8
|
path?: string;
|
|
9
9
|
}): DbFactory;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { type D1Database, type LibsqlClientLike, type MysqlConnLike, type PgClientLike, d1, libsqlJuneDb, mysql, mysqlJuneDb, pgJuneDb, postgres,
|
|
11
|
+
export { type D1Database, type LibsqlClientLike, type MysqlConnLike, type PgClientLike, d1, libsqlJuneDb, mysql, mysqlJuneDb, pgJuneDb, postgres, turso };
|