@myassis/gateway 1.0.70 → 1.0.72

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.
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.MemoryManager = void 0;
4
27
  const shared_1 = require("@myassis/shared");
@@ -210,6 +233,10 @@ ${conversation}
210
233
  const summaryPrompt = this.buildSummaryPrompt(messages, lastSummary);
211
234
  const token = index_js_1.authStore.get(this.session.userId).accessToken;
212
235
  const llmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: summaryPrompt }], this.signal, [], 600000);
236
+ if (this.session.useSystemMode) {
237
+ const { getRequestToken, getServerBaseUrl } = await Promise.resolve().then(() => __importStar(require('../../api/index.js')));
238
+ llmClient.setSystemMode(true, this.session.selectModelId, getServerBaseUrl(), getRequestToken());
239
+ }
213
240
  const response = await llmClient.Chat();
214
241
  const content = (response.content || '').trim();
215
242
  if (!content) {
@@ -234,6 +261,10 @@ ${conversation}
234
261
  const batchPrompt = `请简洁总结以下对话片段的关键信息,特别关注:项目结构、关键决策、错误及修复。\n\n${batch.join('\n\n')}`;
235
262
  const token = index_js_1.authStore.get(this.session.userId).accessToken;
236
263
  const llmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: batchPrompt }], this.signal, [], 600000);
264
+ if (this.session.useSystemMode) {
265
+ const { getRequestToken, getServerBaseUrl } = await Promise.resolve().then(() => __importStar(require('../../api/index.js')));
266
+ llmClient.setSystemMode(true, this.session.selectModelId, getServerBaseUrl(), getRequestToken());
267
+ }
237
268
  const response = await llmClient.Chat();
238
269
  const subContent = (response.content || '').trim();
239
270
  if (subContent) {
@@ -251,6 +282,10 @@ ${conversation}
251
282
  const mergePrompt = this.buildMergePrompt(subSummaries, lastSummary);
252
283
  const token = index_js_1.authStore.get(this.session.userId).accessToken;
253
284
  const mergeLlmClient = new LLMClient_js_1.LLMClient((await dataService_js_1.modelsService.list(token)).data.map((x) => (0, models_js_1.toModel)(x)), [{ role: 'user', content: mergePrompt }], this.signal, [], 600000);
285
+ if (this.session.useSystemMode) {
286
+ const { getRequestToken, getServerBaseUrl } = await Promise.resolve().then(() => __importStar(require('../../api/index.js')));
287
+ mergeLlmClient.setSystemMode(true, this.session.selectModelId, getServerBaseUrl(), getRequestToken());
288
+ }
254
289
  const mergeResponse = await mergeLlmClient.Chat();
255
290
  const mergedContent = (mergeResponse.content || '').trim();
256
291
  return mergedContent || subSummaries.join('\n\n');
@@ -197,7 +197,7 @@ exports.execTool = {
197
197
  },
198
198
  cwd: {
199
199
  type: 'string',
200
- description: '命令执行的工作目录(可选)。',
200
+ description: '命令执行的工作目录',
201
201
  },
202
202
  timeout: {
203
203
  type: 'number',
@@ -216,6 +216,14 @@ exports.execTool = {
216
216
  return new Promise(async (resolve) => {
217
217
  const { cwd, timeout = 60000, approved, isUserAsk = false } = args;
218
218
  let command = args.command;
219
+ // 没有指定工作目录,直接返回错误信息给大模型
220
+ if (!cwd || (typeof cwd === 'string' && cwd.trim() === '')) {
221
+ resolve({
222
+ success: false,
223
+ errorMessage: '执行命令必须指定工作目录(cwd),请提供 cwd 参数后重试。',
224
+ });
225
+ return;
226
+ }
219
227
  // 检查危险命令(如果已批准或用户主动要求则跳过拦截)
220
228
  if (!approved && isDangerousCommand(command)) {
221
229
  if (isUserAsk) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myassis/gateway",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "我的助手 Gateway Service - 本地 AI 网关服务,支持认证、WebSocket 实时通信和任务调度",
5
5
  "main": "dist/index.js",
6
6
  "bin": {