@agent_memory/dsh 0.5.2 → 0.5.4

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/dist/plugin.mjs CHANGED
@@ -5347,6 +5347,9 @@ function replacementProblems(replacement, path) {
5347
5347
  });
5348
5348
  return problems;
5349
5349
  }
5350
+ function proposalPendingReminder(proposalId) {
5351
+ return `\u63D0\u6848\u5DF2\u521B\u5EFA\uFF08${proposalId}\uFF09\uFF0C\u7B49\u5F85\u4EBA\u5DE5\u5BA1\u6279\u3002\u8BF7\u5230\u3010\u8BB0\u5FC6 \u2192 \u63D0\u6848\u3011\u67E5\u770B\u5E76\u70B9\u51FB\u300C\u91C7\u7EB3\u300D\u6216\u300C\u9A73\u56DE\u300D\u3002`;
5352
+ }
5350
5353
  function capabilitiesFor(mode, delegationDepth) {
5351
5354
  const capabilities = ["facts.read", "rules.read"];
5352
5355
  if (delegationDepth === 0) {
@@ -5364,7 +5367,7 @@ function registerTools(ctx, service2, actor, quota = new SessionQuota(service2.c
5364
5367
  memory_recall: "\u68C0\u7D22\u957F\u671F\u8BB0\u5FC6\uFF1A\u6309\u67E5\u8BE2\u8FD4\u56DE\u76F8\u5173\u6458\u8981\u4E0E\u8BB0\u5FC6\u7F16\u53F7",
5365
5368
  memory_read: "\u8BFB\u53D6\u4E00\u6761\u8BB0\u5FC6\u7684\u5168\u6587\u3001\u51FA\u5904\u4E0E\u72B6\u6001",
5366
5369
  memory_record: "\u5199\u5165\u4E00\u6761\u65B0\u8BB0\u5FC6\uFF08\u5FC5\u987B\u7ED9\u51FA\u771F\u5B9E\u4E8B\u4EF6\u51FA\u5904\uFF09",
5367
- memory_propose: "\u63D0\u51FA\u8BB0\u5FC6\u4FEE\u8BA2\u6216\u5220\u9664\u63D0\u6848\uFF0C\u7B49\u5F85\u4EBA\u786E\u8BA4",
5370
+ memory_propose: "\u63D0\u51FA\u8BB0\u5FC6\u4FEE\u8BA2\u6216\u5220\u9664\u63D0\u6848\uFF1B\u53EA\u521B\u5EFA\u5F85\u5BA1\u63D0\u6848\uFF0C\u521B\u5EFA\u540E\u5FC5\u987B\u63D0\u9192\u7528\u6237\u53BB\u3010\u8BB0\u5FC6 \u2192 \u63D0\u6848\u3011\u5BA1\u6279\uFF0C\u4E0D\u81EA\u52A8\u5BA1\u6279",
5368
5371
  memory_review: "\u4E3A\u5F85\u5BA1\u63D0\u6848\u5F39\u51FA\u4E2D\u6587\u5BA1\u6279\u5361\u7247",
5369
5372
  memory_context: "\u67E5\u770B\u5F53\u524D\u4F1A\u8BDD\u6700\u8FD1\u4E8B\u4EF6\uFF0C\u53D6\u5F97\u53EF\u7528\u4E8E\u51FA\u5904\u7684 event_seq",
5370
5373
  rules_list: "\u5217\u51FA\u5F53\u524D\u751F\u6548\u7684\u89C4\u5219"
@@ -5381,9 +5384,10 @@ function registerTools(ctx, service2, actor, quota = new SessionQuota(service2.c
5381
5384
  const proposal = candidate.proposal ?? candidate;
5382
5385
  const review = candidate.review;
5383
5386
  const proposalId = name2 === "memory_propose" && review === void 0 ? proposal.id : void 0;
5384
- const hint = typeof proposalId === "string" ? `
5387
+ const reminder = typeof candidate.reminder === "string" ? candidate.reminder : typeof proposalId === "string" ? proposalPendingReminder(proposalId) : "";
5388
+ const hint = reminder === "" ? "" : `
5385
5389
 
5386
- \u4EBA\u5728\u804A\u5929\u6846\u51B3\u5B9A\uFF1A/mem decide ${proposalId} accept \u6216 reject\uFF1B\u4E5F\u53EF\u8C03\u7528 memory_review \u91CD\u65B0\u5F39\u51FA\u5361\u7247` : "";
5390
+ ${reminder}`;
5387
5391
  return [{ type: "text", text: text + hint }];
5388
5392
  }
5389
5393
  },
@@ -5415,9 +5419,12 @@ function registerTools(ctx, service2, actor, quota = new SessionQuota(service2.c
5415
5419
  throw new ToolInputError("\u5F53\u524D\u4E3A readonly \u6A21\u5F0F\uFF1A\u53EA\u80FD\u8BFB\u53D6\u8BB0\u5FC6\uFF0C\u4E0D\u80FD\u63D0\u51FA\u4FEE\u6539");
5416
5420
  }
5417
5421
  const proposal = await service2.propose(args, actor, exec);
5418
- if (hooks.reviewProposal === void 0) return proposal;
5419
- const review = await hooks.reviewProposal(proposal, exec);
5420
- return { proposal, review };
5422
+ const proposalId = typeof proposal.id === "string" ? proposal.id : "";
5423
+ return {
5424
+ ...proposal,
5425
+ status: "pending",
5426
+ reminder: proposalPendingReminder(proposalId)
5427
+ };
5421
5428
  },
5422
5429
  memory_review: async (args, exec) => {
5423
5430
  if (hooks.reviewPending === void 0) {
@@ -5514,11 +5521,17 @@ async function reviewProposal(deps, proposal, exec) {
5514
5521
  ...exec.callId === void 0 ? {} : { wait: { callId: exec.callId } }
5515
5522
  });
5516
5523
  const decision = decisionFromAnswer(answer);
5524
+ if (answer.answers[0]?.id !== proposal.id) {
5525
+ return { decision: "defer", message: "\u6536\u5230\u7684\u5BA1\u6279\u7B54\u590D\u4E0D\u5C5E\u4E8E\u5F53\u524D\u63D0\u6848\uFF0C\u63D0\u6848\u4FDD\u7559\u5F85\u5BA1" };
5526
+ }
5517
5527
  const line = commandForDecision(proposal.id, decision);
5518
5528
  if (line === void 0) {
5519
5529
  return { decision, message: "\u5DF2\u6682\u7F13\uFF0C\u63D0\u6848\u7EE7\u7EED\u5F85\u5BA1" };
5520
5530
  }
5521
5531
  const result = await executeCommandLine(deps, exec.agent, line, exec.signal);
5532
+ if (result.ok && listProposals(deps.store).some((entry) => entry.id === proposal.id)) {
5533
+ return { decision, command: line, result, message: "\u5BA1\u6279\u547D\u4EE4\u5DF2\u6267\u884C\uFF0C\u4F46\u63D0\u6848\u4ECD\u5728\u5F85\u5BA1\uFF1B\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5" };
5534
+ }
5522
5535
  return { decision, command: line, result, message: result.text };
5523
5536
  }
5524
5537
 
@@ -6584,7 +6597,7 @@ function registerGuiRoutes(connection, deps, effect) {
6584
6597
  }
6585
6598
 
6586
6599
  // packages/dsh/src/update.ts
6587
- var PLUGIN_VERSION = "0.5.2";
6600
+ var PLUGIN_VERSION = "0.5.4";
6588
6601
  var PACKAGE_NAME = "@agent_memory/dsh";
6589
6602
  var REGISTRY_LATEST = [
6590
6603
  "https://registry.npmjs.org/@agent_memory%2Fdsh/latest",