@dsh-workbench/module-tools 1.2.3-beta.5 → 1.2.3-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/module-tools",
3
- "version": "1.2.3-beta.5",
3
+ "version": "1.2.3-beta.7",
4
4
  "description": "模块包的构建与门禁工具:build(单文件 ESM 宿主侧 + 套 loader 壳的浏览器侧)、check(契约/产物边界/源码边界/卡片渲染)。模块包不再各带一份构建脚本。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "semver": "^7.8.5",
34
34
  "typescript": "5.9.3",
35
35
  "typescript-eslint": "^8.71.0",
36
- "@dsh-workbench/shared": "1.2.3-beta.5"
36
+ "@dsh-workbench/shared": "1.2.3-beta.7"
37
37
  },
38
38
  "repository": {
39
39
  "type": "git",
package/src/init.mjs CHANGED
@@ -10,7 +10,7 @@ const UNIT_ID = /^[a-z][a-z0-9-]*$/;
10
10
 
11
11
  const FALLBACK_RANGE = '^0.1.0';
12
12
 
13
- const FALLBACK_DSH_UI = '0.2.1-rc.5';
13
+ const FALLBACK_DSH_UI = '0.2.2-rc.1';
14
14
  const DSH_UI = '@deepseek-ai/dsh-client-ui-primitives';
15
15
 
16
16
  const dshUiVersion = (root) => {
@@ -2,7 +2,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
2
  import { tmpdir } from 'node:os';
3
3
  import { join } from 'node:path';
4
4
  import { afterAll, describe, expect, it, vi } from 'vitest';
5
- import type { DshToolDefinition } from '@dsh-workbench/core/contract';
5
+ import type { DshToolDefinition, DshToolRunContext } from '@dsh-workbench/core/contract';
6
6
  import { createFlowHost, createLongTaskHost, type LongTaskBase } from '@dsh-workbench/shared/host';
7
7
 
8
8
  vi.mock('@dsh-workbench/core/client', () => ({
@@ -208,7 +208,7 @@ async function settled(h: Harness, id: string): Promise<LongTaskBase | null> {
208
208
 
209
209
  const execContext = {
210
210
  agent: { session: { id: 'session-1', header: { cwd: join(scratch, 'sample') } } },
211
- };
211
+ } as unknown as DshToolRunContext;
212
212
 
213
213
  describe('__NAME__ 的面', () => {
214
214
  it('插件名就是包名', () => {
@@ -294,7 +294,7 @@ describe('宿主侧的长任务与工具', () => {
294
294
  const tool = toolOf(h, DECLARED_TOOLS.run.name);
295
295
  const started = (await tool?.execute({}, execContext)) as { ok: boolean; runId: string };
296
296
  await settled(h, started.runId);
297
- const again = (await tool?.execute({ runId: started.runId }, {})) as { ok: boolean; runId: string };
297
+ const again = (await tool?.execute({ runId: started.runId }, {} as DshToolRunContext)) as { ok: boolean; runId: string };
298
298
  expect(again.runId).toBe(started.runId);
299
299
  });
300
300
 
@@ -309,7 +309,7 @@ describe('宿主侧的长任务与工具', () => {
309
309
  it('没有工作区时工具说清楚,不抛', async () => {
310
310
  const h = harness();
311
311
  h.mounted.registerTools();
312
- const answer = (await toolOf(h, DECLARED_TOOLS.run.name)?.execute({}, {})) as { ok: boolean; text: string };
312
+ const answer = (await toolOf(h, DECLARED_TOOLS.run.name)?.execute({}, {} as DshToolRunContext)) as { ok: boolean; text: string };
313
313
  expect(answer.ok).toBe(false);
314
314
  expect(answer.text).toContain('工作区');
315
315
  });
@@ -19,7 +19,7 @@ const face: UnitClientFace = {
19
19
  export const inject = ['workbenchUnits'];
20
20
 
21
21
  export function apply(ctx: ClientContext): void {
22
- const units = ctx.get<UnitClientApi>('workbenchUnits');
22
+ const units = (ctx.get as (name: string) => UnitClientApi | undefined)('workbenchUnits');
23
23
  if (units === undefined) {
24
24
  console.warn(`[${UNIT_ID}] 外壳没有提供 workbenchUnits 服务:这张卡片装不进来`);
25
25
  return;
@@ -60,7 +60,7 @@ const face: UnitModuleFace = {
60
60
  },
61
61
  },
62
62
  registerTools: () => {
63
- const tools = deps.ctx.get<DshToolRegistry>('tools');
63
+ const tools = (deps.ctx.get as (name: string) => DshToolRegistry | undefined)('tools');
64
64
  if (tools === undefined) {
65
65
  deps.logger?.warn?.(`[${UNIT_ID}] 外壳没有提供 tools 服务:这两把工具注册不进去`);
66
66
  return [];