dsh-plugin-agent-memory 0.1.7 → 0.1.8

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/index.js +18 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -346,6 +346,20 @@ export function apply(ctx, config) {
346
346
  return payload.data ?? {};
347
347
  }
348
348
 
349
+ async function knowledgeResourcesAll() {
350
+ const known = await teams();
351
+ const merged = [];
352
+ for (const team of known) {
353
+ try {
354
+ const items = await knowledgeResources(team.team_id);
355
+ for (const item of items) merged.push(item);
356
+ } catch {
357
+ /* one unreachable team must not hide the rest */
358
+ }
359
+ }
360
+ return merged;
361
+ }
362
+
349
363
  async function knowledgeResources(teamId) {
350
364
  const key = `knowledge:${teamId}`;
351
365
  const cached = state.assets.get(key);
@@ -384,7 +398,8 @@ export function apply(ctx, config) {
384
398
  const known = await teams();
385
399
  const first = known[0];
386
400
  if (first === undefined) throw new Error('当前 userkey 下没有可见团队');
387
- return { teamId: first.team_id, teamName: first.name, agentId: settings.defaultAgentId, agentName: '' };
401
+ // No expert picked yet: team-level assets still work, memory does not (it needs an agent).
402
+ return { teamId: first.team_id, teamName: first.name, agentId: '', agentName: '', unscoped: true };
388
403
  }
389
404
 
390
405
  const TOOL_TEXT_LIMIT = 12000;
@@ -561,7 +576,7 @@ export function apply(ctx, config) {
561
576
  isConcurrencySafe: () => true,
562
577
  async execute(args, exec) {
563
578
  const scope = await toolScope(exec);
564
- const items = await knowledgeResources(scope.teamId);
579
+ const items = await knowledgeResourcesAll();
565
580
  return knowledgeListText(scope, items, args ?? {});
566
581
  },
567
582
  }),
@@ -587,7 +602,7 @@ export function apply(ctx, config) {
587
602
  const scope = await toolScope(exec);
588
603
  const knowledgeId = String(args.knowledge_id ?? '').trim();
589
604
  if (knowledgeId === '') throw new Error('knowledge_id 不能为空');
590
- const items = await knowledgeResources(scope.teamId);
605
+ const items = await knowledgeResourcesAll();
591
606
  const resource = items.find((item) => item.knowledge_id === knowledgeId);
592
607
  if (resource === undefined) {
593
608
  throw new Error(`未知的 knowledge_id:${knowledgeId}(先用 am_knowledge_resources 查看)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-agent-memory",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "Tencent agent-memory integration: pick a team agent as an expert at the composer, recall its memories into each turn, and expose its wiki, code-graph and skill assets as tools.",
6
6
  "license": "MIT",