@steerable/pack-sdk 0.12.3 → 0.12.5

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 (2) hide show
  1. package/package.json +1 -1
  2. package/types/index.d.ts +32 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steerable/pack-sdk",
3
- "version": "0.12.3",
3
+ "version": "0.12.5",
4
4
  "type": "module",
5
5
  "description": "Scenario pack contract for @steerable/agent-shell (pure types, zero runtime). A scenario pack declares every extension a vertical scenario needs — services, tools, tables, skills, agent seeds, HTTP routes, renderer slots, branding — and the host composes the selected packs at build time.",
6
6
  "license": "Apache-2.0",
package/types/index.d.ts CHANGED
@@ -290,19 +290,50 @@ export interface PackBackendRouteResponse<T = unknown> {
290
290
  data: T;
291
291
  }
292
292
 
293
+ /** 二进制文件流响应:由宿主 HTTP 层按字节流式输出并自动支持 Range 206。 */
294
+ export interface PackBackendBinaryFileResponse {
295
+ readonly status: number;
296
+ readonly kind: 'file';
297
+ readonly filePath: string;
298
+ readonly contentType: string;
299
+ readonly fileName?: string;
300
+ readonly cacheControl?: string;
301
+ readonly etag?: string;
302
+ }
303
+
304
+ /** 内存二进制响应:由宿主 HTTP 层直接输出字节,不经过 JSON/base64 编码。 */
305
+ export interface PackBackendBinaryBytesResponse {
306
+ readonly status: number;
307
+ readonly kind: 'bytes';
308
+ readonly body: Uint8Array;
309
+ readonly contentType: string;
310
+ readonly fileName?: string;
311
+ readonly cacheControl?: string;
312
+ }
313
+
314
+ export type PackBackendBinaryResponse =
315
+ | PackBackendBinaryFileResponse
316
+ | PackBackendBinaryBytesResponse;
317
+
318
+ export type PackBackendAnyResponse<T = unknown> =
319
+ | PackBackendRouteResponse<T>
320
+ | PackBackendBinaryResponse;
321
+
293
322
  /** 包路由请求:段参数 + query + 反序列化后的 body。 */
294
323
  export interface PackBackendRouteRequest {
295
324
  readonly params: Record<string, string>;
296
325
  /** URL query(searchParams 原样透传,多值键取逗号拼接语义同 URL 规范)。 */
297
326
  readonly query: URLSearchParams;
298
327
  readonly body: unknown;
328
+ /** 原始请求头(HTTP 模式下透传,便于检查 Range / If-None-Match)。 */
329
+ readonly headers?: Record<string, string | string[] | undefined>;
299
330
  }
300
331
 
301
332
  export interface PackBackendRoute {
302
333
  readonly method: 'GET' | 'POST' | 'PUT' | 'DELETE';
303
334
  /** 路径模式,如 '/api/v2/ppt-preview/edits/:id/cancel'。 */
304
335
  readonly path: string;
305
- readonly handler: (req: PackBackendRouteRequest) => Promise<PackBackendRouteResponse>;
336
+ readonly handler: (req: PackBackendRouteRequest) => Promise<PackBackendAnyResponse>;
306
337
  }
307
338
 
308
339
  // ─── 回合级钩子契约 ───