@southwind-ai/server-sdk 0.1.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/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export type {
2
+ ModuleHost,
3
+ ModuleInitializer,
4
+ ModuleUploadPolicy,
5
+ } from "./src/module-host.js";
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@southwind-ai/server-sdk",
3
+ "version": "0.1.0",
4
+ "license": "UNLICENSED",
5
+ "type": "module",
6
+ "engines": {
7
+ "bun": ">=1.3.0"
8
+ },
9
+ "files": [
10
+ "index.ts",
11
+ "src/module-host.ts"
12
+ ],
13
+ "scripts": {
14
+ "typecheck": "tsc --noEmit --project tsconfig.json"
15
+ },
16
+ "dependencies": {
17
+ "@southwind-ai/jobs": "workspace:*"
18
+ },
19
+ "exports": {
20
+ ".": "./index.ts"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ }
25
+ }
@@ -0,0 +1,29 @@
1
+ import type { DurableHandlerDefinition } from "@southwind-ai/jobs";
2
+
3
+ export interface ModuleUploadPolicy {
4
+ purpose: string;
5
+ maxByteSize: number;
6
+ maxPartByteSize: number;
7
+ sessionTtlMs: number;
8
+ allowedTypes: Readonly<Record<string, readonly string[]>>;
9
+ signature?: "image" | "none";
10
+ }
11
+
12
+ /**
13
+ * 模块作用域 Host。注册的任务 Key 与上传用途必须使用初始化器模块名作为命名空间。
14
+ */
15
+ export interface ModuleHost {
16
+ readonly moduleName: string;
17
+ registerUploadPolicy(policy: ModuleUploadPolicy): void;
18
+ registerDurableHandler<T>(definition: DurableHandlerDefinition<T>): void;
19
+ }
20
+
21
+ /**
22
+ * 已安装模块的 Server 初始化入口。
23
+ *
24
+ * 初始化器在 Storage 与 Durable Job 运行时创建前顺序执行;这里只注册定义,不启动 Worker。
25
+ */
26
+ export interface ModuleInitializer {
27
+ readonly moduleName: string;
28
+ initialize(host: ModuleHost): Promise<void> | void;
29
+ }