@rezti/dsh-rez-suite 0.1.35 → 0.1.37

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/index.js CHANGED
@@ -2864,21 +2864,23 @@ function isLegalAssistantRoom(hint) {
2864
2864
  return roomFolderFromPath(hint) === LEGAL_ROOM_FOLDER;
2865
2865
  }
2866
2866
  function isQccToolName(name) {
2867
- return name.startsWith("mcp__qcc-") || name.startsWith("mcp__qcc__");
2867
+ return /^mcp__qcc(?:-|__|_)/.test(name);
2868
2868
  }
2869
- /** Session cwd from a tool execution. Missing / unknown shapes → undefined. */
2870
- function cwdFromExecution(execution) {
2871
- const agent = execution.agent;
2872
- if (typeof agent !== "object" || agent === null) return void 0;
2873
- const record = agent;
2869
+ function readCwdFromObject(value) {
2870
+ if (typeof value !== "object" || value === null) return void 0;
2871
+ const record = value;
2874
2872
  const session = record.session;
2875
2873
  const header = typeof session === "object" && session !== null ? session.header : void 0;
2876
2874
  const candidates = [
2877
- typeof header === "object" && header !== null ? header.cwd : void 0,
2875
+ record.cwd,
2878
2876
  typeof session === "object" && session !== null ? session.cwd : void 0,
2879
- record.cwd
2877
+ typeof header === "object" && header !== null ? header.cwd : void 0
2880
2878
  ];
2881
- for (const value of candidates) if (typeof value === "string" && value.trim().length > 0) return value;
2879
+ for (const item of candidates) if (typeof item === "string" && item.trim().length > 0) return item;
2880
+ }
2881
+ /** Session cwd from a tool execution. Missing / unknown shapes → undefined. */
2882
+ function cwdFromExecution(execution) {
2883
+ return readCwdFromObject(execution) ?? readCwdFromObject(execution.session) ?? readCwdFromObject(execution.agent);
2882
2884
  }
2883
2885
  /**
2884
2886
  * Official `ctx.tools.guard` reason. Only Qichacha tools are gated.
@@ -2919,9 +2921,14 @@ function mcpToolPrefix(server) {
2919
2921
  }
2920
2922
  /** Count tools whose public name belongs to one composed MCP server. */
2921
2923
  function countMcpTools(toolNames, server) {
2922
- const prefix = mcpToolPrefix(server);
2923
2924
  let count = 0;
2924
- for (const name of toolNames) if (name.startsWith(prefix)) count += 1;
2925
+ for (const name of toolNames) {
2926
+ if (server === "qcc") {
2927
+ if (isQccToolName(name)) count += 1;
2928
+ continue;
2929
+ }
2930
+ if (name.startsWith(mcpToolPrefix(server))) count += 1;
2931
+ }
2925
2932
  return count;
2926
2933
  }
2927
2934
  function listRegisteredToolNames(tools) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rezti/dsh-rez-suite",
3
3
  "description": "ReZ-TI one-package install for DeepSeek Harness. Update with: dsh plugin --profile web update @rezti/dsh-rez-suite",
4
- "version": "0.1.35",
4
+ "version": "0.1.37",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": "^22.19.0 || >=24.0.0"
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { lastMcpStartError, REZ_CREDENTIAL_REFS, secretConfigured, type RezSystem } from '@rezti/dsh-rez-sso'
10
10
  import type { RezConfig, RezServerStatus, RezTestResult } from './protocol.ts'
11
- import { isLegalAssistantRoom, QCC_STATUS_ROOM_OFF } from './rooms.ts'
11
+ import { isLegalAssistantRoom, isQccToolName, QCC_STATUS_ROOM_OFF } from './rooms.ts'
12
12
 
13
13
  export const COMPOSED_SERVERS = ['odoo', 'nextcloud', 'wechat', 'homeassistant', 'tapd', 'gsc', 'qcc', 'tianyancha'] as const
14
14
 
@@ -21,10 +21,13 @@ export function mcpToolPrefix(server: string): string {
21
21
 
22
22
  /** Count tools whose public name belongs to one composed MCP server. */
23
23
  export function countMcpTools(toolNames: readonly string[], server: string): number {
24
- const prefix = mcpToolPrefix(server)
25
24
  let count = 0
26
25
  for (const name of toolNames) {
27
- if (name.startsWith(prefix)) count += 1
26
+ if (server === 'qcc') {
27
+ if (isQccToolName(name)) count += 1
28
+ continue
29
+ }
30
+ if (name.startsWith(mcpToolPrefix(server))) count += 1
28
31
  }
29
32
  return count
30
33
  }
package/src/rooms.ts CHANGED
@@ -25,29 +25,36 @@ export function isLegalAssistantRoom(hint: string | undefined): boolean {
25
25
  }
26
26
 
27
27
  export function isQccToolName(name: string): boolean {
28
- return name.startsWith('mcp__qcc-') || name.startsWith('mcp__qcc__')
28
+ return /^mcp__qcc(?:-|__|_)/.test(name)
29
29
  }
30
30
 
31
- /** Session cwd from a tool execution. Missing / unknown shapes undefined. */
32
- export function cwdFromExecution(execution: { agent?: unknown }): string | undefined {
33
- const agent = execution.agent
34
- if (typeof agent !== 'object' || agent === null) return undefined
35
- const record = agent as Record<string, unknown>
31
+ function readCwdFromObject(value: unknown): string | undefined {
32
+ if (typeof value !== 'object' || value === null) return undefined
33
+ const record = value as Record<string, unknown>
36
34
  const session = record.session
37
35
  const header = typeof session === 'object' && session !== null
38
36
  ? (session as Record<string, unknown>).header
39
37
  : undefined
40
38
  const candidates = [
41
- typeof header === 'object' && header !== null ? (header as Record<string, unknown>).cwd : undefined,
42
- typeof session === 'object' && session !== null ? (session as Record<string, unknown>).cwd : undefined,
43
39
  record.cwd,
40
+ typeof session === 'object' && session !== null ? (session as Record<string, unknown>).cwd : undefined,
41
+ typeof header === 'object' && header !== null ? (header as Record<string, unknown>).cwd : undefined,
44
42
  ]
45
- for (const value of candidates) {
46
- if (typeof value === 'string' && value.trim().length > 0) return value
43
+ for (const item of candidates) {
44
+ if (typeof item === 'string' && item.trim().length > 0) return item
47
45
  }
48
46
  return undefined
49
47
  }
50
48
 
49
+ /** Session cwd from a tool execution. Missing / unknown shapes → undefined. */
50
+ export function cwdFromExecution(execution: { agent?: unknown; session?: unknown; cwd?: unknown }): string | undefined {
51
+ return (
52
+ readCwdFromObject(execution)
53
+ ?? readCwdFromObject(execution.session)
54
+ ?? readCwdFromObject(execution.agent)
55
+ )
56
+ }
57
+
51
58
  /**
52
59
  * Official `ctx.tools.guard` reason. Only Qichacha tools are gated.
53
60
  * Must never throw: this guard is global and a throw would block WeChat turns.