@fugood/buttress-server 2.25.0-beta.64 → 2.25.0-beta.70
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/lib/autodiscover/index.d.ts +20 -0
- package/lib/autodiscover/sign.d.ts +10 -0
- package/lib/autodiscover/types.d.ts +32 -0
- package/lib/autodiscover/udp.d.ts +22 -0
- package/lib/cli.d.ts +3 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.mjs +671 -193
- package/lib/package.d.ts +7 -0
- package/lib/routes/anthropic-messages.d.ts +55 -0
- package/lib/routes/file.d.ts +10 -0
- package/lib/routes/index.d.ts +5 -0
- package/lib/routes/info.check.d.ts +1 -0
- package/lib/routes/info.d.ts +4 -0
- package/lib/routes/llm-shared.d.ts +54 -0
- package/lib/routes/openai-compat.d.ts +17 -0
- package/lib/routes/status.d.ts +4 -0
- package/lib/services/common.d.ts +29 -0
- package/lib/services/create-llm-service.d.ts +24 -0
- package/lib/services/ggml-llm.d.ts +5 -0
- package/lib/services/ggml-stt.d.ts +26 -0
- package/lib/services/index.d.ts +39 -0
- package/lib/services/mlx-llm.d.ts +5 -0
- package/lib/services/onnx-stt.d.ts +77 -0
- package/lib/services/onnx-tts.d.ts +48 -0
- package/lib/types.d.ts +158 -0
- package/lib/utils/SessionFileManager.d.ts +16 -0
- package/lib/utils/buttressAuth.d.ts +25 -0
- package/lib/utils/config.d.ts +21 -0
- package/lib/utils/httpAuthGuard.d.ts +1 -0
- package/lib/utils/net.d.ts +6 -0
- package/lib/utils/router.d.ts +2 -0
- package/lib/utils/serialize.d.ts +2 -0
- package/lib/utils/serverCaps.d.ts +4 -0
- package/lib/utils/sessionGuard.d.ts +33 -0
- package/lib/utils/test-caps.d.ts +61 -0
- package/lib/utils/workspaceState.d.ts +21 -0
- package/package.json +6 -6
- package/lib/chunk-C7Qqr4sF.mjs +0 -2
- package/lib/index.d.mts +0 -498
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AutodiscoverConfig } from '../types';
|
|
2
|
+
import type { GetServerInfoFn } from './types';
|
|
3
|
+
import { type AnnounceSigner } from './udp';
|
|
4
|
+
export type { GetServerInfoFn } from './types';
|
|
5
|
+
export { signEnvelope, buildAnnounceSigner, type AnnounceSigner } from './sign';
|
|
6
|
+
/**
|
|
7
|
+
* Autodiscover service that manages discovery transports.
|
|
8
|
+
* Currently supports UDP announcements/responses.
|
|
9
|
+
* HTTP discovery is handled by the info route.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AutodiscoverService {
|
|
12
|
+
private config;
|
|
13
|
+
private getServerInfo;
|
|
14
|
+
private signer;
|
|
15
|
+
private transports;
|
|
16
|
+
private started;
|
|
17
|
+
constructor(config: AutodiscoverConfig, getServerInfo: GetServerInfoFn, signer: AnnounceSigner | null);
|
|
18
|
+
start(): Promise<void>;
|
|
19
|
+
stop(): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import type { WorkspaceState } from '../utils/workspaceState';
|
|
3
|
+
import { type IDiscoveryProtocol } from './types';
|
|
4
|
+
export interface AnnounceSigner {
|
|
5
|
+
kid: string;
|
|
6
|
+
privateKey: crypto.KeyObject;
|
|
7
|
+
}
|
|
8
|
+
export declare const canonicalBytes: (t: 'ANNOUNCE' | 'RESPONSE', d: unknown, ts: number) => Buffer;
|
|
9
|
+
export declare const signEnvelope: (signer: AnnounceSigner | null, t: 'ANNOUNCE' | 'RESPONSE', d: IDiscoveryProtocol['d']) => IDiscoveryProtocol | null;
|
|
10
|
+
export declare const buildAnnounceSigner: (workspaceState: WorkspaceState) => AnnounceSigner | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ServerInfo } from '../types';
|
|
2
|
+
export declare const PROTOCOL_VERSION = "2.0";
|
|
3
|
+
export declare const DEFAULT_PORT = 8089;
|
|
4
|
+
export interface ITransport {
|
|
5
|
+
name: string;
|
|
6
|
+
start(): Promise<void>;
|
|
7
|
+
stop(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
interface DiscoveryAnnounce {
|
|
10
|
+
info: Partial<ServerInfo>;
|
|
11
|
+
}
|
|
12
|
+
export interface DiscoveryRequest {
|
|
13
|
+
id: string;
|
|
14
|
+
filters?: {
|
|
15
|
+
generators?: string[];
|
|
16
|
+
min_version?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface DiscoveryResponse {
|
|
20
|
+
request_id: string;
|
|
21
|
+
info: Partial<ServerInfo>;
|
|
22
|
+
}
|
|
23
|
+
export interface IDiscoveryProtocol {
|
|
24
|
+
t: 'ANNOUNCE' | 'QUERY' | 'RESPONSE';
|
|
25
|
+
v: string;
|
|
26
|
+
d: DiscoveryAnnounce | DiscoveryRequest | DiscoveryResponse;
|
|
27
|
+
ts?: number;
|
|
28
|
+
kid?: string;
|
|
29
|
+
sig?: string;
|
|
30
|
+
}
|
|
31
|
+
export type GetServerInfoFn = () => ServerInfo;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AutodiscoverConfig } from '../types';
|
|
2
|
+
import { ITransport, GetServerInfoFn } from './types';
|
|
3
|
+
import { type AnnounceSigner } from './sign';
|
|
4
|
+
export type { AnnounceSigner } from './sign';
|
|
5
|
+
export declare class UdpTransport implements ITransport {
|
|
6
|
+
name: string;
|
|
7
|
+
private receiver;
|
|
8
|
+
private senders;
|
|
9
|
+
private announcementTimer;
|
|
10
|
+
private config;
|
|
11
|
+
private getServerInfo;
|
|
12
|
+
private port;
|
|
13
|
+
private signer;
|
|
14
|
+
constructor(config: AutodiscoverConfig['udp'], getServerInfo: GetServerInfoFn, signer: AnnounceSigner | null);
|
|
15
|
+
start(): Promise<void>;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
private bindReceiver;
|
|
18
|
+
private createSenders;
|
|
19
|
+
private handleMessage;
|
|
20
|
+
private sendAnnouncement;
|
|
21
|
+
private sendResponse;
|
|
22
|
+
}
|
package/lib/cli.d.ts
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AnyElysia } from 'elysia';
|
|
2
|
+
import * as backendCore from '@fugood/buttress-backend-core';
|
|
3
|
+
import { AutodiscoverService } from './autodiscover';
|
|
4
|
+
import type { Config } from './types';
|
|
5
|
+
export { startModelDownload } from '@fugood/buttress-backend-core';
|
|
6
|
+
export { processConfig } from './utils/config';
|
|
7
|
+
export declare const checkForUpdates: () => Promise<string | null>;
|
|
8
|
+
export declare const compareVersions: (current: string, latest: string) => boolean;
|
|
9
|
+
export declare const logUpdateMessage: (latestVersion: string) => void;
|
|
10
|
+
export declare const checkAndNotifyUpdates: () => Promise<void>;
|
|
11
|
+
export type Backend = typeof backendCore;
|
|
12
|
+
export interface StartServerOptions {
|
|
13
|
+
backend?: Backend;
|
|
14
|
+
router?: AnyElysia;
|
|
15
|
+
config: Config;
|
|
16
|
+
enableOpenAICompat?: boolean;
|
|
17
|
+
enableAnthropicMessages?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const createServer: ({ backend, router, config, enableOpenAICompat, enableAnthropicMessages, }: StartServerOptions) => Promise<{
|
|
20
|
+
app: AnyElysia;
|
|
21
|
+
config: Config;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const startServer: ({ backend, router, config, enableOpenAICompat, enableAnthropicMessages, }: StartServerOptions) => Promise<{
|
|
24
|
+
app: AnyElysia;
|
|
25
|
+
port: number;
|
|
26
|
+
openaiEnabled: boolean;
|
|
27
|
+
anthropicMessagesEnabled: boolean;
|
|
28
|
+
autoDiscover: AutodiscoverService | null;
|
|
29
|
+
}>;
|