@agent_memory/dsh 0.5.1 → 0.5.3
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/client/client.js +14 -2
- package/dist/plugin.mjs +19 -8
- package/dist/plugin.mjs.map +2 -2
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -711,7 +711,13 @@ function MemoryPage() {
|
|
|
711
711
|
setUpdateBusy(true);
|
|
712
712
|
setUpdateInfo({ checking: true });
|
|
713
713
|
fetch("/api/agent-memory/update/check", { headers: { accept: "application/json" } }).then(async (response) => {
|
|
714
|
-
const
|
|
714
|
+
const text = await response.text();
|
|
715
|
+
let data2;
|
|
716
|
+
try {
|
|
717
|
+
data2 = JSON.parse(text);
|
|
718
|
+
} catch {
|
|
719
|
+
throw new Error(`更新接口返回非 JSON(HTTP ${response.status}):${text.slice(0, 80)}`);
|
|
720
|
+
}
|
|
715
721
|
if (!response.ok) throw new Error(data2.error || `HTTP ${response.status}`);
|
|
716
722
|
return data2;
|
|
717
723
|
}).then((data2) => setUpdateInfo(data2)).catch((error) => setUpdateInfo({ error: String(error) })).finally(() => setUpdateBusy(false));
|
|
@@ -725,7 +731,13 @@ function MemoryPage() {
|
|
|
725
731
|
headers: { accept: "application/json", "content-type": "application/json" },
|
|
726
732
|
body: JSON.stringify({ version: updateInfo.latest })
|
|
727
733
|
}).then(async (response) => {
|
|
728
|
-
const
|
|
734
|
+
const text = await response.text();
|
|
735
|
+
let data2;
|
|
736
|
+
try {
|
|
737
|
+
data2 = JSON.parse(text);
|
|
738
|
+
} catch {
|
|
739
|
+
throw new Error(`更新接口返回非 JSON(HTTP ${response.status}):${text.slice(0, 80)}`);
|
|
740
|
+
}
|
|
729
741
|
if (!response.ok || data2.ok === false) throw new Error(data2.error || `HTTP ${response.status}`);
|
|
730
742
|
return data2;
|
|
731
743
|
}).then((data2) => setUpdateInfo((previous) => ({ ...previous || {}, applied: data2 }))).catch((error) => setUpdateInfo((previous) => ({ ...previous || {}, applyError: String(error) }))).finally(() => setUpdateBusy(false));
|
package/dist/plugin.mjs
CHANGED
|
@@ -5364,7 +5364,7 @@ function registerTools(ctx, service2, actor, quota = new SessionQuota(service2.c
|
|
|
5364
5364
|
memory_recall: "\u68C0\u7D22\u957F\u671F\u8BB0\u5FC6\uFF1A\u6309\u67E5\u8BE2\u8FD4\u56DE\u76F8\u5173\u6458\u8981\u4E0E\u8BB0\u5FC6\u7F16\u53F7",
|
|
5365
5365
|
memory_read: "\u8BFB\u53D6\u4E00\u6761\u8BB0\u5FC6\u7684\u5168\u6587\u3001\u51FA\u5904\u4E0E\u72B6\u6001",
|
|
5366
5366
|
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\
|
|
5367
|
+
memory_propose: "\u63D0\u51FA\u8BB0\u5FC6\u4FEE\u8BA2\u6216\u5220\u9664\u63D0\u6848\uFF1B\u53EA\u521B\u5EFA\u5F85\u5BA1\u63D0\u6848\uFF0C\u4E0D\u81EA\u52A8\u5BA1\u6279",
|
|
5368
5368
|
memory_review: "\u4E3A\u5F85\u5BA1\u63D0\u6848\u5F39\u51FA\u4E2D\u6587\u5BA1\u6279\u5361\u7247",
|
|
5369
5369
|
memory_context: "\u67E5\u770B\u5F53\u524D\u4F1A\u8BDD\u6700\u8FD1\u4E8B\u4EF6\uFF0C\u53D6\u5F97\u53EF\u7528\u4E8E\u51FA\u5904\u7684 event_seq",
|
|
5370
5370
|
rules_list: "\u5217\u51FA\u5F53\u524D\u751F\u6548\u7684\u89C4\u5219"
|
|
@@ -5414,10 +5414,7 @@ function registerTools(ctx, service2, actor, quota = new SessionQuota(service2.c
|
|
|
5414
5414
|
if (service2.mode === "readonly") {
|
|
5415
5415
|
throw new ToolInputError("\u5F53\u524D\u4E3A readonly \u6A21\u5F0F\uFF1A\u53EA\u80FD\u8BFB\u53D6\u8BB0\u5FC6\uFF0C\u4E0D\u80FD\u63D0\u51FA\u4FEE\u6539");
|
|
5416
5416
|
}
|
|
5417
|
-
|
|
5418
|
-
if (hooks.reviewProposal === void 0) return proposal;
|
|
5419
|
-
const review = await hooks.reviewProposal(proposal, exec);
|
|
5420
|
-
return { proposal, review };
|
|
5417
|
+
return service2.propose(args, actor, exec);
|
|
5421
5418
|
},
|
|
5422
5419
|
memory_review: async (args, exec) => {
|
|
5423
5420
|
if (hooks.reviewPending === void 0) {
|
|
@@ -5514,11 +5511,17 @@ async function reviewProposal(deps, proposal, exec) {
|
|
|
5514
5511
|
...exec.callId === void 0 ? {} : { wait: { callId: exec.callId } }
|
|
5515
5512
|
});
|
|
5516
5513
|
const decision = decisionFromAnswer(answer);
|
|
5514
|
+
if (answer.answers[0]?.id !== proposal.id) {
|
|
5515
|
+
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" };
|
|
5516
|
+
}
|
|
5517
5517
|
const line = commandForDecision(proposal.id, decision);
|
|
5518
5518
|
if (line === void 0) {
|
|
5519
5519
|
return { decision, message: "\u5DF2\u6682\u7F13\uFF0C\u63D0\u6848\u7EE7\u7EED\u5F85\u5BA1" };
|
|
5520
5520
|
}
|
|
5521
5521
|
const result = await executeCommandLine(deps, exec.agent, line, exec.signal);
|
|
5522
|
+
if (result.ok && listProposals(deps.store).some((entry) => entry.id === proposal.id)) {
|
|
5523
|
+
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" };
|
|
5524
|
+
}
|
|
5522
5525
|
return { decision, command: line, result, message: result.text };
|
|
5523
5526
|
}
|
|
5524
5527
|
|
|
@@ -6584,7 +6587,7 @@ function registerGuiRoutes(connection, deps, effect) {
|
|
|
6584
6587
|
}
|
|
6585
6588
|
|
|
6586
6589
|
// packages/dsh/src/update.ts
|
|
6587
|
-
var PLUGIN_VERSION = "0.5.
|
|
6590
|
+
var PLUGIN_VERSION = "0.5.3";
|
|
6588
6591
|
var PACKAGE_NAME = "@agent_memory/dsh";
|
|
6589
6592
|
var REGISTRY_LATEST = [
|
|
6590
6593
|
"https://registry.npmjs.org/@agent_memory%2Fdsh/latest",
|
|
@@ -6612,8 +6615,16 @@ function createUpdateService(manager, fetcher = fetch) {
|
|
|
6612
6615
|
headers: { accept: "application/json" },
|
|
6613
6616
|
signal: AbortSignal.timeout(8e3)
|
|
6614
6617
|
});
|
|
6615
|
-
|
|
6616
|
-
|
|
6618
|
+
const text = await response.text();
|
|
6619
|
+
if (!response.ok) {
|
|
6620
|
+
throw new Error(`registry returned HTTP ${response.status}: ${text.slice(0, 120)}`);
|
|
6621
|
+
}
|
|
6622
|
+
let body;
|
|
6623
|
+
try {
|
|
6624
|
+
body = JSON.parse(text);
|
|
6625
|
+
} catch {
|
|
6626
|
+
throw new Error(`registry returned non-JSON: ${text.slice(0, 120)}`);
|
|
6627
|
+
}
|
|
6617
6628
|
if (typeof body.version !== "string" || !/^\d+\.\d+\.\d+/.test(body.version)) {
|
|
6618
6629
|
throw new Error("registry response has no valid version");
|
|
6619
6630
|
}
|