@junejs/server 0.1.2 → 0.2.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/assets/icon-latin.LICENSE.txt +92 -0
- package/assets/icon-latin.ttf +0 -0
- package/dist/adapter-DcZ-W1-7.d.ts +62 -0
- package/dist/adapter.d.ts +2 -56
- package/dist/adapter.js +62 -5
- package/dist/agent-compile.d.ts +38 -0
- package/dist/agent-compile.js +145 -0
- package/dist/agent-discover.d.ts +4 -4
- package/dist/agent-discover.js +30 -44
- package/dist/agent-durable.d.ts +94 -19
- package/dist/agent-durable.js +647 -32
- package/dist/agent-native.d.ts +44 -13
- package/dist/agent-native.js +264 -27
- package/dist/app.d.ts +5 -5
- package/dist/app.js +42 -10
- package/dist/blob.d.ts +4 -5
- package/dist/build.d.ts +8 -29
- package/dist/build.js +138 -289
- package/dist/client-bundle.d.ts +8 -9
- package/dist/client-bundle.js +1 -1
- package/dist/config-freeze-CyXvNqi2.d.ts +17 -0
- package/dist/config-freeze.d.ts +2 -0
- package/dist/config-freeze.js +54 -0
- package/dist/config-loader.d.ts +3 -4
- package/dist/connection-auth.d.ts +38 -0
- package/dist/connection-auth.js +31 -0
- package/dist/content-freeze-CyiW2fRK.d.ts +4 -0
- package/dist/content-freeze.d.ts +2 -0
- package/dist/content-freeze.js +83 -0
- package/dist/content.d.ts +22 -9
- package/dist/content.js +43 -3
- package/dist/core-version.d.ts +4 -0
- package/dist/core-version.js +12 -0
- 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 +8 -5
- package/dist/dev.js +40 -9
- package/dist/favicon.d.ts +37 -0
- package/dist/favicon.js +248 -0
- package/dist/host.d.ts +6 -5
- package/dist/host.js +2 -1
- package/dist/icon-letter.d.ts +3 -0
- package/dist/icon-letter.js +8 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +9 -3
- 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 +5 -0
- package/dist/isolate-local.js +12 -0
- package/dist/kv.d.ts +3 -4
- package/dist/llms-links.d.ts +9 -0
- package/dist/llms-links.js +65 -0
- package/dist/manifest-CwTT1zVs.d.ts +11 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.js +113 -0
- package/dist/negotiate.d.ts +4 -3
- package/dist/negotiate.js +24 -14
- package/dist/{pipeline-CCp9idQ4.d.ts → pipeline-BHUjBO0G.d.ts} +13 -1
- package/dist/pipeline.d.ts +2 -2
- package/dist/pipeline.js +286 -35
- package/dist/resources.d.ts +5 -6
- package/dist/route-rank.d.ts +10 -0
- package/dist/route-rank.js +38 -0
- package/dist/route-scan-BMbBzPIB.d.ts +20 -0
- package/dist/route-scan.d.ts +2 -0
- package/dist/route-scan.js +100 -0
- package/dist/router.d.ts +12 -13
- package/dist/router.js +58 -44
- 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/rsc-worker.js +11 -8
- package/dist/rsc-runtime/rsdw-shims.d.ts +2 -1
- package/dist/segment.d.ts +4 -5
- package/dist/sqlite-driver.d.ts +11 -11
- package/dist/sqlite-driver.js +17 -4
- package/dist/static-files.d.ts +4 -5
- package/dist/tsconfig-jsx.d.ts +4 -4
- package/dist/tsconfig-jsx.js +1 -1
- package/dist/turn-events.d.ts +4 -0
- package/dist/turn-events.js +46 -0
- package/dist/web-manifest.d.ts +5 -0
- package/dist/web-manifest.js +42 -0
- package/dist/worker-2qbQjj2c.d.ts +64 -0
- package/dist/worker.d.ts +2 -56
- package/dist/worker.js +121 -103
- package/package.json +22 -9
- package/src/adapter.ts +84 -3
- package/src/agent-compile.ts +271 -0
- package/src/agent-discover.ts +77 -63
- package/src/agent-durable.ts +998 -30
- package/src/agent-native.ts +370 -35
- package/src/app.ts +75 -6
- package/src/build.ts +237 -444
- package/src/config-freeze.ts +109 -0
- package/src/connection-auth.ts +101 -0
- package/src/content-freeze.ts +151 -0
- package/src/content.ts +55 -4
- package/src/core-version.ts +34 -0
- package/src/dev.ts +41 -8
- package/src/favicon.ts +325 -0
- package/src/host.ts +4 -3
- package/src/icon-letter.ts +14 -0
- package/src/index.ts +22 -0
- package/src/isolate-local.ts +33 -0
- package/src/llms-links.ts +96 -0
- package/src/manifest.ts +130 -0
- package/src/negotiate.ts +39 -15
- package/src/pipeline.ts +494 -44
- package/src/route-rank.ts +60 -0
- package/src/route-scan.ts +161 -0
- package/src/router.ts +75 -58
- package/src/rsc-runtime/rsc-worker.tsx +5 -4
- package/src/sqlite-driver.ts +36 -6
- package/src/tsconfig-jsx.ts +2 -2
- package/src/turn-events.ts +43 -0
- package/src/web-manifest.ts +38 -0
- package/src/worker.ts +197 -117
package/dist/agent-durable.d.ts
CHANGED
|
@@ -1,73 +1,148 @@
|
|
|
1
1
|
import { Channel, ChannelFactory } from "@junejs/core/agent-config";
|
|
2
|
-
import { Model, Msg, SessionStore, Tool } from "@junejs/core/agent-runtime";
|
|
2
|
+
import { AuthorizeAnswer, ChannelPolicy, InboundEvent, InputAnnouncement, Model, Msg, NoteKind, ProactiveTrigger, SessionStore, Tool, TurnError, TurnEvent, TurnFailurePhase } from "@junejs/core/agent-runtime";
|
|
3
|
+
import { FileStore } from "@junejs/core/agent-files";
|
|
4
|
+
import { Connection } from "@junejs/core/connections";
|
|
3
5
|
import { Resources } from "@junejs/core/resources";
|
|
4
6
|
//#region src/agent-durable.d.ts
|
|
5
|
-
type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
6
|
-
interface SqlStorageCursor<T extends Record<string, SqlStorageValue> = Record<string, SqlStorageValue>> {
|
|
7
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
8
|
+
export interface SqlStorageCursor<T extends Record<string, SqlStorageValue> = Record<string, SqlStorageValue>> {
|
|
7
9
|
toArray(): T[];
|
|
8
10
|
one(): T;
|
|
9
11
|
}
|
|
10
|
-
interface SqlStorage {
|
|
12
|
+
export interface SqlStorage {
|
|
11
13
|
exec<T extends Record<string, SqlStorageValue> = Record<string, SqlStorageValue>>(query: string, ...bindings: unknown[]): SqlStorageCursor<T>;
|
|
12
14
|
}
|
|
13
|
-
interface DurableStorage {
|
|
15
|
+
export interface DurableStorage {
|
|
14
16
|
sql: SqlStorage;
|
|
15
17
|
transactionSync<T>(fn: () => T): T;
|
|
18
|
+
setAlarm?(scheduledTime: number): unknown;
|
|
16
19
|
}
|
|
17
|
-
interface DurableObjectState {
|
|
20
|
+
export interface DurableObjectState {
|
|
18
21
|
storage: DurableStorage;
|
|
19
22
|
}
|
|
20
|
-
interface DurableObjectStub {
|
|
23
|
+
export interface DurableObjectStub {
|
|
21
24
|
fetch(request: Request): Promise<Response>;
|
|
22
25
|
}
|
|
23
|
-
interface DurableObjectNamespace {
|
|
26
|
+
export interface DurableObjectNamespace {
|
|
24
27
|
idFromName(name: string): unknown;
|
|
25
28
|
get(id: unknown): DurableObjectStub;
|
|
26
29
|
}
|
|
27
|
-
declare class DoSessionStore implements SessionStore {
|
|
30
|
+
export declare class DoSessionStore implements SessionStore {
|
|
28
31
|
private readonly storage;
|
|
29
32
|
constructor(storage: DurableStorage);
|
|
30
33
|
private get sql();
|
|
31
34
|
appendMessage(m: Msg): void;
|
|
32
35
|
messages(): Msg[];
|
|
33
|
-
|
|
36
|
+
hasOpeningMessage(turnId: string): boolean;
|
|
34
37
|
getStep(id: string): unknown | undefined;
|
|
35
38
|
putStep(id: string, output: unknown): void;
|
|
39
|
+
delStep(id: string): void;
|
|
36
40
|
getStatus(): string;
|
|
37
41
|
setStatus(s: string): void;
|
|
42
|
+
getSessionKey(): string | undefined;
|
|
43
|
+
setSessionKey(key: string): void;
|
|
38
44
|
tx<T>(fn: () => T): T;
|
|
45
|
+
reset(inTx?: () => void): number;
|
|
39
46
|
unwrap<H = unknown>(): H;
|
|
40
47
|
}
|
|
41
|
-
type DoAgentDef = {
|
|
48
|
+
export type DoAgentDef = {
|
|
42
49
|
name?: string;
|
|
43
50
|
model: Model;
|
|
44
51
|
tools: Tool[];
|
|
45
52
|
instructions?: string;
|
|
46
|
-
|
|
53
|
+
channelInstructions?: Record<string, string | ChannelPolicy>;
|
|
54
|
+
channels?: (Channel | ChannelFactory)[];
|
|
55
|
+
env?: unknown;
|
|
56
|
+
resources?: Resources | ((env: unknown) => Promise<Resources> | Resources);
|
|
57
|
+
connections?: Connection[];
|
|
47
58
|
services?: unknown;
|
|
59
|
+
onTurnError?: (failure: {
|
|
60
|
+
turnId: string;
|
|
61
|
+
error: TurnError;
|
|
62
|
+
phase?: TurnFailurePhase;
|
|
63
|
+
step?: string;
|
|
64
|
+
}) => void | Promise<void>;
|
|
65
|
+
authorizeAnswer?: AuthorizeAnswer;
|
|
66
|
+
onInputAnnouncement?: (a: InputAnnouncement) => void | Promise<void>;
|
|
67
|
+
files?: FileStore;
|
|
48
68
|
};
|
|
49
|
-
declare class AgentDurableObject {
|
|
69
|
+
export declare class AgentDurableObject {
|
|
50
70
|
private session;
|
|
51
|
-
private
|
|
71
|
+
private sessionKey;
|
|
72
|
+
private readonly name;
|
|
73
|
+
private readonly store;
|
|
74
|
+
private readonly sink;
|
|
75
|
+
private readonly model;
|
|
76
|
+
private readonly tools;
|
|
77
|
+
private readonly channels;
|
|
78
|
+
private readonly channelInstructions?;
|
|
79
|
+
private readonly resourcesInput;
|
|
80
|
+
private resourcesOpened;
|
|
81
|
+
private readonly connectionsInput;
|
|
82
|
+
private connectionsOpened;
|
|
83
|
+
private readonly doEnv;
|
|
52
84
|
private readonly services;
|
|
85
|
+
private readonly authorizeAnswer?;
|
|
86
|
+
private readonly onInputAnnouncement?;
|
|
87
|
+
private readonly storage;
|
|
88
|
+
private readonly files;
|
|
89
|
+
private announceFailures;
|
|
90
|
+
private resolveResources;
|
|
91
|
+
private resolveConnections;
|
|
92
|
+
private ready;
|
|
53
93
|
constructor(state: DurableObjectState, def: DoAgentDef);
|
|
94
|
+
private resolveSession;
|
|
95
|
+
alarm(): Promise<void>;
|
|
96
|
+
private armWatchdog;
|
|
97
|
+
private scheduleAlarm;
|
|
98
|
+
private deliverHeld;
|
|
54
99
|
turn(input: {
|
|
55
100
|
turnId?: string;
|
|
56
101
|
userText: string;
|
|
102
|
+
event?: InboundEvent;
|
|
103
|
+
trigger?: ProactiveTrigger;
|
|
104
|
+
session?: string;
|
|
57
105
|
}): Promise<string>;
|
|
106
|
+
start(input: {
|
|
107
|
+
turnId?: string;
|
|
108
|
+
userText: string;
|
|
109
|
+
event?: InboundEvent;
|
|
110
|
+
trigger?: ProactiveTrigger;
|
|
111
|
+
session?: string;
|
|
112
|
+
}): Promise<{
|
|
113
|
+
turnId: string;
|
|
114
|
+
}>;
|
|
115
|
+
note(input: {
|
|
116
|
+
by: string;
|
|
117
|
+
kind: NoteKind;
|
|
118
|
+
text: string;
|
|
119
|
+
session?: string;
|
|
120
|
+
}): Promise<{
|
|
121
|
+
noteId: string;
|
|
122
|
+
}>;
|
|
123
|
+
reset(opts?: {
|
|
124
|
+
session?: string;
|
|
125
|
+
}): Promise<{
|
|
126
|
+
previousSession: string;
|
|
127
|
+
generation: number;
|
|
128
|
+
}>;
|
|
58
129
|
transcript(): import("@junejs/core/agent-runtime").Turn[];
|
|
59
130
|
fetch(req: Request): Promise<Response>;
|
|
60
131
|
}
|
|
61
|
-
declare function
|
|
62
|
-
declare function
|
|
132
|
+
export declare function sseTurnFinalText(res: Response): Promise<string>;
|
|
133
|
+
export declare function sseTurnEvents(res: Response): AsyncIterable<TurnEvent>;
|
|
134
|
+
export declare const SESSION_HEADER = "x-june-session";
|
|
135
|
+
export declare function durableFetch(namespace: DurableObjectNamespace, agent: string, session: string, req: Request): Promise<Response>;
|
|
136
|
+
export declare function durableAgentSurface(getNamespace: () => DurableObjectNamespace | undefined, opts: {
|
|
63
137
|
agentName: string;
|
|
64
138
|
chatPath?: string;
|
|
65
139
|
}): (req: Request) => Promise<Response | null>;
|
|
66
|
-
declare function durableChannelSurface(getNamespace: () => DurableObjectNamespace | undefined, opts: {
|
|
140
|
+
export declare function durableChannelSurface(getNamespace: () => DurableObjectNamespace | undefined, opts: {
|
|
67
141
|
agentName: string;
|
|
68
142
|
channels: (Channel | ChannelFactory)[];
|
|
69
143
|
env: unknown;
|
|
144
|
+
services?: (env: unknown) => unknown;
|
|
70
145
|
waitUntil?: (p: Promise<unknown>) => void;
|
|
146
|
+
files?: FileStore;
|
|
71
147
|
}): (req: Request) => Promise<Response | null>;
|
|
72
|
-
//#endregion
|
|
73
|
-
export { AgentDurableObject, DoAgentDef, DoSessionStore, DurableObjectNamespace, DurableObjectState, DurableObjectStub, DurableStorage, SqlStorage, SqlStorageCursor, SqlStorageValue, durableAgentSurface, durableChannelSurface, durableFetch };
|
|
148
|
+
//#endregion
|