@fa-software/semi2-dsh 0.0.13-preview.20260921160207 → 0.0.13

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 (40) hide show
  1. package/README.md +51 -0
  2. package/lib/api/generated/documents.js +1 -0
  3. package/lib/client.js +16 -0
  4. package/lib/client.js.map +1 -1
  5. package/lib/contract.js +18 -0
  6. package/lib/domains/default-model/domain.js +4 -5
  7. package/lib/domains/models/domain.js +2 -3
  8. package/lib/domains/self-portrait/domain.js +50 -0
  9. package/lib/domains/self-portrait/index.js +33 -0
  10. package/lib/hub/facts.js +1 -0
  11. package/lib/index.js +46 -6
  12. package/lib/service/config-service.js +1 -1
  13. package/lib/service/namespaces.js +9 -3
  14. package/lib/service/orchestrator.js +5 -6
  15. package/lib/service/ports.js +17 -11
  16. package/lib/service/registry.js +2 -0
  17. package/lib/service/settings-sections.js +3 -5
  18. package/lib/types/api/generated/documents.d.ts +1 -1
  19. package/lib/types/api/generated/graphql.d.ts +1 -0
  20. package/lib/types/api/generated/schema.d.ts +42 -0
  21. package/lib/types/contract.d.ts +17 -0
  22. package/lib/types/domains/self-portrait/domain.d.ts +22 -0
  23. package/lib/types/domains/self-portrait/index.d.ts +14 -0
  24. package/lib/types/domains/types.d.ts +5 -1
  25. package/lib/types/domains/workspace/feed.d.ts +4 -20
  26. package/lib/types/hub/facts.d.ts +5 -0
  27. package/lib/types/index.d.ts +51 -6
  28. package/lib/types/service/config-service.d.ts +4 -0
  29. package/lib/types/service/namespaces.d.ts +2 -0
  30. package/lib/types/service/orchestrator.d.ts +4 -4
  31. package/lib/types/service/ports.d.ts +25 -26
  32. package/lib/types/web/fence.d.ts +3 -2
  33. package/lib/types/web/index.d.ts +7 -1
  34. package/lib/types/web/routes.d.ts +7 -9
  35. package/lib/types/web/welcome-ack.d.ts +2 -1
  36. package/lib/web/fence.js +3 -3
  37. package/lib/web/index.js +4 -3
  38. package/lib/web/routes.js +5 -5
  39. package/lib/web/welcome-ack.js +2 -1
  40. package/package.json +24 -8
@@ -1,13 +1,11 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
- import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { WebServer } from '@deepseek-ai/dsh-host-webserver';
3
3
  import { type RequestFence } from './fence.js';
4
- /** 注册路由所需的最小 webServer 面(dsh-host-webserver 的 `register`)。 */
5
- export interface WebServerRouteSink {
6
- register(route: {
7
- kind: 'exact';
8
- path: string;
9
- handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
10
- }): () => void;
4
+ /** 注册路由所需的 webServer 面(dsh-host-webserver 的 `register`)。 */
5
+ export type WebServerRouteSink = Pick<WebServer, 'register'>;
6
+ export interface RouteOptions {
7
+ /** 请求体上限(字节);缺省见入口 Config。 */
8
+ bodyLimitBytes?: number | undefined;
11
9
  }
12
10
  /**
13
11
  * 本模块消费的配置面(登录 / 登出 / 健康):由入口按运行实例直接传入。
@@ -30,4 +28,4 @@ export interface RouteRuntime {
30
28
  * 注册三条路由:依赖全部由调用方传入(webServer 来自 `inject(['webServer'])` 作用域、fence 来自
31
29
  * `connection`)。模块内不做「依赖缺席就静默不装」的判断;注册一律走 ctx.effect 保证可回收。
32
30
  */
33
- export declare function installRoutes(ctx: Context, webServer: WebServerRouteSink, runtime: RouteRuntime, fence: RequestFence): void;
31
+ export declare function installRoutes(ctx: Context, webServer: WebServerRouteSink, runtime: RouteRuntime, fence: RequestFence, options?: RouteOptions): void;
@@ -1,7 +1,8 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  /**
3
3
  * dsh-client-ui-settings-models 中 bundle 私有常量的镜像(比 notice 文案高一层):升级 pinned dsh channel
4
- * (DSH_VERSION)时须核对该串仍等于客户端 bundle 里的值,回归测试钉住它;陈旧值只退化为原生行为。
4
+ * 时由 `test/dsh/unit/dsh-contract.test.mjs` 核对该串仍等于客户端 bundle 里的字面量;
5
+ * 陈旧值只退化为原生行为。
5
6
  */
6
7
  export declare const WELCOME_NOTICE_VERSION = "2026-08-13.1";
7
8
  /** 产品级 GUI onboarding 事实的 durable settings 命名空间。 */
package/lib/web/fence.js CHANGED
@@ -1,10 +1,10 @@
1
- /** 校验不过就地应答,返回是否已拒绝(非 undefined 即拒)。 */
1
+ /** 校验不过就地应答(状态码照官方拒绝码:401 未鉴权 / 403 栅栏拒绝),返回是否已拒绝。 */
2
2
  export function rejected(req, res, fence) {
3
3
  const rejection = fence.requestRejection(req);
4
- if (rejection === undefined || rejection === null)
4
+ if (rejection === undefined)
5
5
  return false;
6
6
  if (!res.headersSent)
7
- res.statusCode = 403;
7
+ res.statusCode = rejection;
8
8
  res.end();
9
9
  return true;
10
10
  }
package/lib/web/index.js CHANGED
@@ -2,7 +2,8 @@ import { installRoutes } from './routes.js';
2
2
  import { installWelcomeAck } from './welcome-ack.js';
3
3
  /** 登录路由健康判定的等待上限:校验面缺席时按「登录路由缺失」暴露,而不是静默。 */
4
4
  const FENCE_TIMEOUT_MS = 5_000;
5
- export function installWebSurface(ctx, runtime, registerHealth) {
5
+ export function installWebSurface(ctx, runtime, registerHealth, options = {}) {
6
+ const fenceTimeoutMs = options.fenceTimeoutMs ?? FENCE_TIMEOUT_MS;
6
7
  let surface = 'absent';
7
8
  registerHealth({
8
9
  key: 'healthWeb',
@@ -27,7 +28,7 @@ export function installWebSurface(ctx, runtime, registerHealth) {
27
28
  // 无 logger 的宿主忽略。
28
29
  }
29
30
  }
30
- }, FENCE_TIMEOUT_MS);
31
+ }, fenceTimeoutMs);
31
32
  workstationCtx.effect(() => () => {
32
33
  clearTimeout(timer);
33
34
  });
@@ -35,7 +36,7 @@ export function installWebSurface(ctx, runtime, registerHealth) {
35
36
  // 校验面缺席就不装路由,由健康字段把这种情形暴露出来,而不是让路由静默失效。
36
37
  workstationCtx.inject(['connection'], (connCtx) => {
37
38
  surface = 'ready';
38
- installRoutes(connCtx, webServer, runtime, connCtx.get('connection'));
39
+ installRoutes(connCtx, webServer, runtime, connCtx.get('connection'), { bodyLimitBytes: options.bodyLimitBytes });
39
40
  });
40
41
  installWelcomeAck(workstationCtx);
41
42
  });
package/lib/web/routes.js CHANGED
@@ -2,7 +2,6 @@ import { rejected } from './fence.js';
2
2
  const LOGIN_PATH = '/semi2/login';
3
3
  const LOGOUT_PATH = '/semi2/logout';
4
4
  const HEALTH_PATH = '/semi2/health';
5
- const MAX_BODY = 8 * 1024;
6
5
  function send(res, status, body) {
7
6
  const payload = JSON.stringify(body);
8
7
  res.writeHead(status, {
@@ -12,13 +11,13 @@ function send(res, status, body) {
12
11
  });
13
12
  res.end(payload);
14
13
  }
15
- async function readJson(req) {
14
+ async function readJson(req, maxBody) {
16
15
  const chunks = [];
17
16
  let size = 0;
18
17
  for await (const chunk of req) {
19
18
  const buffer = chunk instanceof Uint8Array ? chunk : Buffer.from(chunk);
20
19
  size += buffer.byteLength;
21
- if (size > MAX_BODY)
20
+ if (size > maxBody)
22
21
  throw new Error('BODY_TOO_LARGE');
23
22
  chunks.push(buffer);
24
23
  }
@@ -31,7 +30,8 @@ function text(value) {
31
30
  * 注册三条路由:依赖全部由调用方传入(webServer 来自 `inject(['webServer'])` 作用域、fence 来自
32
31
  * `connection`)。模块内不做「依赖缺席就静默不装」的判断;注册一律走 ctx.effect 保证可回收。
33
32
  */
34
- export function installRoutes(ctx, webServer, runtime, fence) {
33
+ export function installRoutes(ctx, webServer, runtime, fence, options = {}) {
34
+ const maxBody = options.bodyLimitBytes ?? 8 * 1024;
35
35
  ctx.effect(() => webServer.register({
36
36
  kind: 'exact',
37
37
  path: LOGIN_PATH,
@@ -43,7 +43,7 @@ export function installRoutes(ctx, webServer, runtime, fence) {
43
43
  return;
44
44
  }
45
45
  try {
46
- const raw = await readJson(req);
46
+ const raw = await readJson(req, maxBody);
47
47
  const body = raw !== null && typeof raw === 'object'
48
48
  ? raw
49
49
  : {};
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * dsh-client-ui-settings-models 中 bundle 私有常量的镜像(比 notice 文案高一层):升级 pinned dsh channel
3
- * (DSH_VERSION)时须核对该串仍等于客户端 bundle 里的值,回归测试钉住它;陈旧值只退化为原生行为。
3
+ * 时由 `test/dsh/unit/dsh-contract.test.mjs` 核对该串仍等于客户端 bundle 里的字面量;
4
+ * 陈旧值只退化为原生行为。
4
5
  */
5
6
  export const WELCOME_NOTICE_VERSION = '2026-08-13.1';
6
7
  /** 产品级 GUI onboarding 事实的 durable settings 命名空间。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fa-software/semi2-dsh",
3
- "version": "0.0.13-preview.20260921160207",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "description": "Semi2 单插件:semi2-hub 配置引导 + 公共 Web 能力,并挂载 CodeGraph 官方 MCP 服务。",
6
6
  "main": "lib/index.js",
@@ -37,34 +37,50 @@
37
37
  ]
38
38
  }
39
39
  },
40
- "dependencies": {
41
- "ws": "^8.21.3"
42
- },
43
40
  "peerDependencies": {
44
41
  "@deepseek-ai/cordis": "^4.0.2",
45
- "@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
42
+ "@deepseek-ai/dsh-agent-default-model": "^0.1.6-alpha.2",
43
+ "@deepseek-ai/dsh-api-workspace-controller": "^0.1.6-alpha.2",
44
+ "@deepseek-ai/dsh-client-connection": "^0.1.6-alpha.2",
46
45
  "@deepseek-ai/dsh-credentials": "^0.1.6-alpha.2",
47
46
  "@deepseek-ai/dsh-host-webserver": "^0.1.6-alpha.2",
47
+ "@deepseek-ai/dsh-settings": "^0.1.6-alpha.2",
48
48
  "@deepseek-ai/dsh-skill": "^0.1.6-alpha.2",
49
- "@deepseek-ai/dsh-tools": "^0.1.6-alpha.2",
49
+ "@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.2",
50
50
  "@deepseek-ai/schemastery": "^3.18.1"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
+ "@deepseek-ai/dsh-agent-default-model": {
54
+ "optional": true
55
+ },
56
+ "@deepseek-ai/dsh-api-workspace-controller": {
57
+ "optional": true
58
+ },
59
+ "@deepseek-ai/dsh-client-connection": {
60
+ "optional": true
61
+ },
53
62
  "@deepseek-ai/dsh-credentials": {
54
63
  "optional": true
55
64
  },
56
65
  "@deepseek-ai/dsh-host-webserver": {
57
66
  "optional": true
67
+ },
68
+ "@deepseek-ai/dsh-settings": {
69
+ "optional": true
70
+ },
71
+ "@deepseek-ai/dsh-skill": {
72
+ "optional": true
73
+ },
74
+ "@deepseek-ai/dsh-system-prompt": {
75
+ "optional": true
58
76
  }
59
77
  },
60
78
  "devDependencies": {
61
- "@deepseek-ai/dsh-util-values": "^0.1.6-alpha.2",
62
79
  "@graphql-codegen/cli": "7.4.0",
63
80
  "@graphql-codegen/typescript": "6.1.0",
64
81
  "@graphql-codegen/typescript-operations": "6.1.6",
65
82
  "@types/node": "^24.0.0",
66
83
  "@types/react": "^19.0.0",
67
- "@types/ws": "^8.18.1",
68
84
  "graphql": "^16.11.0",
69
85
  "react": "^19.2.0",
70
86
  "tsdown": "^0.22.2",