dsh-mnemon 0.5.42 → 0.5.43
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/lib/bundle.js +1 -1
- package/lib/client.js +139 -78
- package/lib/extension-sdk.js +39 -1
- package/lib/index.js +550 -96
- package/lib/{starter-resolution-B5mdKlvf.js → starter-resolution-CTY14Exj.js} +7 -7
- package/lib/starter.js +1 -1
- package/lib/types/src/client/locales.d.ts +10 -0
- package/lib/types/src/host/protocol.d.ts +5 -0
- package/lib/types/src/sdk/index.d.ts +1 -0
- package/lib/types/src/sdk/projection-reservation.d.ts +3 -0
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ The default **Layered strategy** keeps runtime memory resident and reads the oth
|
|
|
83
83
|
| [](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/guides/skills.md#in-a-conversation) | [](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/guides/skills.md#evolution) |
|
|
84
84
|
|
|
85
85
|
- **Manage.** Switch a skill off for the model or the `/` menu, use it in the conversation in one click, edit it, and go back to any earlier version.
|
|
86
|
-
- **Evolve.** With self-evolution on, finished conversations are reviewed in the background for corrections, "from now on" instructions, failed tools and reusable procedures. A suggestion cites the steps it rests on; a task Agent drafts the new `SKILL.md`, which is backtested against the current version before you adopt it.
|
|
86
|
+
- **Evolve.** With self-evolution on, finished conversations are reviewed in the background for corrections, "from now on" instructions, failed tools and reusable procedures. A suggestion cites the steps it rests on; a task Agent drafts the new `SKILL.md`, which is backtested against the current version before you adopt it. Manual **Adopt** remains the default; opt-in automatic adoption can process new idle-review suggestions after complete, non-regressing backtests.
|
|
87
87
|
- **Test.** Each skill has its own cases, from reviews, from recorded conversations or written by hand, and a backtest scores any version on them.
|
|
88
88
|
- **Install.** The market searches skills.sh's open index and reads any GitHub repository, any site publishing an Agent Skills discovery index, and curated catalogs; every install is previewed, with security reviews where they exist.
|
|
89
89
|
- **In the conversation.** A line under each turn names the skills it used and what its review suggested, each one click from its page.
|
package/README.zh-CN.md
CHANGED
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
| [](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/guides/skills.md#对话中) | [](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/guides/skills.md#进化) |
|
|
85
85
|
|
|
86
86
|
- **管理。** 让技能不被模型加载或不出现在 `/` 菜单里,一键在对话中使用,直接编辑,并能回到任意历史版本。
|
|
87
|
-
- **进化。** 开启自进化后,对话结束会在后台复盘,寻找多次纠正、“以后都这样做”的指示、工具失败和可复用的流程。每条建议都标出所依据的步骤;任务 Agent 写出新的 `SKILL.md
|
|
87
|
+
- **进化。** 开启自进化后,对话结束会在后台复盘,寻找多次纠正、“以后都这样做”的指示、工具失败和可复用的流程。每条建议都标出所依据的步骤;任务 Agent 写出新的 `SKILL.md`,先与当前版本回测对比,再由你采纳。默认仍须手动**采纳**;可显式开启自动采纳,让新的空闲审查建议在完整回测不退步时落地。
|
|
88
88
|
- **测试。** 每个技能都有自己的用例,来自复盘、记录的对话或手写,任意版本都能在这些用例上回测打分。
|
|
89
89
|
- **安装。** 市场可以搜索 skills.sh 的开放索引,读取任意 GitHub 仓库、任何按 Agent Skills 发现协议发布技能的网站,以及技能目录;每次安装前都能预览,有安全审核的会一并显示。
|
|
90
90
|
- **对话中。** 每个回合下方的一行列出这一回合用到的技能和复盘提出的建议,点一下就能打开。
|
package/lib/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as prepareStarterResolution } from "./starter-resolution-
|
|
1
|
+
import { t as prepareStarterResolution } from "./starter-resolution-CTY14Exj.js";
|
|
2
2
|
//#region src/bundle.ts
|
|
3
3
|
const groupKey = Symbol.for("cordis.group");
|
|
4
4
|
const init = Symbol.for("cordis.init");
|
package/lib/client.js
CHANGED
|
@@ -318,6 +318,7 @@ window.__ModuleLoader__.load({
|
|
|
318
318
|
allowUpdate: true,
|
|
319
319
|
targetScope: "user",
|
|
320
320
|
autoBacktest: true,
|
|
321
|
+
autoAdopt: false,
|
|
321
322
|
draftMaxTokens: 32768,
|
|
322
323
|
draftRetryMaxTokens: 65536,
|
|
323
324
|
hints: true,
|
|
@@ -1188,7 +1189,13 @@ window.__ModuleLoader__.load({
|
|
|
1188
1189
|
"runtime.result.localCompaction": "本地画像整理完成:未写入记忆空间,已更新{target} · 当前 {count} 条",
|
|
1189
1190
|
"runtime.result.localArchive": "容量整理完成:没有可写的记忆空间,已先把 {archived} 条移入本地归档,再更新{target} · 当前 {count} 条",
|
|
1190
1191
|
"runtime.readOnly": "当前为只读模式;运行时记忆仍会进入上下文,但不能在此修改。",
|
|
1191
|
-
"runtime.footnote": "memories.json 是唯一事实源;两个 Markdown 文件由控制层生成,不应直接编辑。"
|
|
1192
|
+
"runtime.footnote": "memories.json 是唯一事实源;两个 Markdown 文件由控制层生成,不应直接编辑。",
|
|
1193
|
+
"runtime.pinned": "已固定",
|
|
1194
|
+
"runtime.pin": "固定",
|
|
1195
|
+
"runtime.unpin": "取消固定",
|
|
1196
|
+
"runtime.pinnedNotice": "条目已固定,容量整理时会保留在运行时记忆中。",
|
|
1197
|
+
"runtime.unpinnedNotice": "已取消固定,恢复通常的容量维护规则。",
|
|
1198
|
+
"runtime.pinBudget": "固定:{count} 条 · 投影字符 {used} / {limit}"
|
|
1192
1199
|
};
|
|
1193
1200
|
var en$3 = {
|
|
1194
1201
|
"nav.runtime": "Runtime",
|
|
@@ -1235,7 +1242,13 @@ window.__ModuleLoader__.load({
|
|
|
1235
1242
|
"runtime.result.localCompaction": "Local profile compaction complete: no Memory Space write; updated {target} · {count} entries",
|
|
1236
1243
|
"runtime.result.localArchive": "Capacity maintenance complete: with no Memory Space to write to, moved {archived} entries to the local archive, then updated {target} · {count} entries",
|
|
1237
1244
|
"runtime.readOnly": "Read only here: runtime memory still enters context but cannot be changed on this page.",
|
|
1238
|
-
"runtime.footnote": "memories.json is the only source of truth. The control plane generates both Markdown files; do not edit them directly."
|
|
1245
|
+
"runtime.footnote": "memories.json is the only source of truth. The control plane generates both Markdown files; do not edit them directly.",
|
|
1246
|
+
"runtime.pinned": "Pinned",
|
|
1247
|
+
"runtime.pin": "Pin",
|
|
1248
|
+
"runtime.unpin": "Unpin",
|
|
1249
|
+
"runtime.pinnedNotice": "Entry pinned. It stays in hot memory during capacity maintenance.",
|
|
1250
|
+
"runtime.unpinnedNotice": "Entry unpinned. Normal capacity rules apply.",
|
|
1251
|
+
"runtime.pinBudget": "Pinned: {count} entries · {used} / {limit} projection characters"
|
|
1239
1252
|
};
|
|
1240
1253
|
//#endregion
|
|
1241
1254
|
//#region plugins/dsh-mnemon-source-documents/presentation/locales.json
|
|
@@ -2720,6 +2733,8 @@ window.__ModuleLoader__.load({
|
|
|
2720
2733
|
"config.workspaceScopeHint": "每个工作区自己的 .mnemon 目录",
|
|
2721
2734
|
"config.dataDirectory": "数据目录",
|
|
2722
2735
|
"config.runtimeUserScopeTitle": "用户画像范围",
|
|
2736
|
+
"config.runtimeInheritance": "子 Agent 自动继承 Runtime 记忆",
|
|
2737
|
+
"config.runtimeInheritanceHint": "默认关闭。开启后,新建子 Agent 自动获得用户画像和工作记忆。已派发任务沿用原设置;任务明确提供的上下文和记忆工具不受影响。",
|
|
2723
2738
|
"config.runtimeUserScopeStorage": "跟随存储范围",
|
|
2724
2739
|
"config.runtimeUserScopeStorageHint": "与 MEMORY.md 在同一目录",
|
|
2725
2740
|
"config.runtimeUserScopeGlobal": "全局共享",
|
|
@@ -3157,6 +3172,8 @@ window.__ModuleLoader__.load({
|
|
|
3157
3172
|
"skills.targetScope.project": "项目",
|
|
3158
3173
|
"skills.targetScope.storage": "跟随存储范围",
|
|
3159
3174
|
"skills.evolutionHint": "后台复盘并建议改进技能;会创建落盘的任务及子代理会话,Mnemon 不自动删除这些记录",
|
|
3175
|
+
"skills.autoAdopt": "自动采纳新建议",
|
|
3176
|
+
"skills.autoAdoptHint": "默认关闭。需要自动回测:仅处理新的空闲审查建议,全部启用的文本用例不退步才采纳,最多重写两次;未测出或超出每轮用例上限时转人工审查。回测是文本模拟,不验证真实外部操作。",
|
|
3160
3177
|
"skills.autoBacktest": "草案自动回测",
|
|
3161
3178
|
"skills.autoBacktestHint": "草案写好后,用测试用例与当前版本对比",
|
|
3162
3179
|
"skills.parameters": "复盘参数",
|
|
@@ -3545,6 +3562,8 @@ window.__ModuleLoader__.load({
|
|
|
3545
3562
|
"config.workspaceScopeHint": "Each workspace keeps its own .mnemon directory",
|
|
3546
3563
|
"config.dataDirectory": "Data directory",
|
|
3547
3564
|
"config.runtimeUserScopeTitle": "User profile scope",
|
|
3565
|
+
"config.runtimeInheritance": "Automatically share Runtime memory with subagents",
|
|
3566
|
+
"config.runtimeInheritanceHint": "Off by default. New subagents receive the user profile and working memory when enabled. Existing tasks keep their setting; explicit task context and memory tools are unaffected.",
|
|
3548
3567
|
"config.runtimeUserScopeStorage": "Follow storage scope",
|
|
3549
3568
|
"config.runtimeUserScopeStorageHint": "Kept with MEMORY.md",
|
|
3550
3569
|
"config.runtimeUserScopeGlobal": "Shared globally",
|
|
@@ -3982,6 +4001,8 @@ window.__ModuleLoader__.load({
|
|
|
3982
4001
|
"skills.targetScope.project": "Project",
|
|
3983
4002
|
"skills.targetScope.storage": "Follow storage",
|
|
3984
4003
|
"skills.evolutionHint": "Review conversations and suggest skills. Task and subagent sessions are saved locally; Mnemon does not automatically delete them.",
|
|
4004
|
+
"skills.autoAdopt": "Automatically adopt new suggestions",
|
|
4005
|
+
"skills.autoAdoptHint": "Off by default; requires automatic backtests. Draft new idle-review suggestions and adopt only with no regression on all enabled text cases, retrying at most twice. Unmeasured or over-limit cases need manual review. Text simulations do not verify real external actions.",
|
|
3985
4006
|
"skills.autoBacktest": "Backtest drafts",
|
|
3986
4007
|
"skills.autoBacktestHint": "Compare a new draft with the current version on its test cases",
|
|
3987
4008
|
"skills.parameters": "Review parameters",
|
|
@@ -12107,6 +12128,7 @@ window.__ModuleLoader__.load({
|
|
|
12107
12128
|
const allowCreate = useLive(saved.allowCreate, write("allowCreate"));
|
|
12108
12129
|
const allowUpdate = useLive(saved.allowUpdate, write("allowUpdate"));
|
|
12109
12130
|
const autoBacktest = useLive(saved.autoBacktest, write("autoBacktest"));
|
|
12131
|
+
const autoAdopt = useLive(saved.autoAdopt, write("autoAdopt"));
|
|
12110
12132
|
const hints = useLive(saved.hints, write("hints"));
|
|
12111
12133
|
const sidebar = useLive(saved.sidebar, write("sidebar"));
|
|
12112
12134
|
const destination = useStaged({ targetScope: saved.targetScope }, async (draft) => {
|
|
@@ -12234,6 +12256,14 @@ window.__ModuleLoader__.load({
|
|
|
12234
12256
|
disabled,
|
|
12235
12257
|
onChange: autoBacktest.set
|
|
12236
12258
|
}),
|
|
12259
|
+
evolution.value && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleRow, {
|
|
12260
|
+
id: "mnemon-skills-auto-adopt",
|
|
12261
|
+
label: t("skills.autoAdopt"),
|
|
12262
|
+
hint: t("skills.autoAdoptHint"),
|
|
12263
|
+
checked: autoAdopt.value,
|
|
12264
|
+
disabled: disabled || !autoBacktest.value,
|
|
12265
|
+
onChange: autoAdopt.set
|
|
12266
|
+
}),
|
|
12237
12267
|
evolution.value && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
|
|
12238
12268
|
className: MnemonSettingsCard_module_css_default.advanced,
|
|
12239
12269
|
children: [
|
|
@@ -12287,7 +12317,7 @@ window.__ModuleLoader__.load({
|
|
|
12287
12317
|
})
|
|
12288
12318
|
]
|
|
12289
12319
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WriteFailure, {
|
|
12290
|
-
error: evolution.failed ?? allowCreate.failed ?? allowUpdate.failed ?? autoBacktest.failed ?? hints.failed ?? sidebar.failed,
|
|
12320
|
+
error: evolution.failed ?? allowCreate.failed ?? allowUpdate.failed ?? autoBacktest.failed ?? autoAdopt.failed ?? hints.failed ?? sidebar.failed,
|
|
12291
12321
|
t
|
|
12292
12322
|
})]
|
|
12293
12323
|
});
|
|
@@ -12678,6 +12708,16 @@ window.__ModuleLoader__.load({
|
|
|
12678
12708
|
});
|
|
12679
12709
|
const disabled = !page.writable || snapshot.status === "loading" || !snapshot.writable;
|
|
12680
12710
|
const configured = snapshot.value?.runtimeMemory;
|
|
12711
|
+
const inheritance = useLive(configured?.inheritToSubagents === true, async (value) => {
|
|
12712
|
+
await scope.mutate([{
|
|
12713
|
+
op: "set",
|
|
12714
|
+
path: ["runtimeMemory"],
|
|
12715
|
+
value: {
|
|
12716
|
+
...configured,
|
|
12717
|
+
inheritToSubagents: value
|
|
12718
|
+
}
|
|
12719
|
+
}]);
|
|
12720
|
+
});
|
|
12681
12721
|
const savedLimits = {
|
|
12682
12722
|
userLimitBytes: String(configured?.userLimitBytes ?? RUNTIME_MEMORY_LIMITS.user),
|
|
12683
12723
|
memoryLimitBytes: String(configured?.memoryLimitBytes ?? RUNTIME_MEMORY_LIMITS.memory)
|
|
@@ -12694,82 +12734,103 @@ window.__ModuleLoader__.load({
|
|
|
12694
12734
|
}]);
|
|
12695
12735
|
});
|
|
12696
12736
|
const invalid = RUNTIME_LIMITS.find((key) => runtimeLimitValue(limits.draft[key]) === void 0);
|
|
12697
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
|
-
|
|
12717
|
-
|
|
12718
|
-
|
|
12719
|
-
|
|
12720
|
-
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
|
|
12750
|
-
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
failed: limits.failed,
|
|
12759
|
-
disabled,
|
|
12760
|
-
t,
|
|
12761
|
-
note: t("config.runtimeLimitsApply"),
|
|
12762
|
-
invalid: invalid === void 0 ? null : t("config.runtimeLimitInvalid", {
|
|
12763
|
-
field: t(`config.runtime.${invalid}`),
|
|
12764
|
-
max: RUNTIME_MEMORY_LIMIT_MAX_BYTES
|
|
12737
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12738
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
12739
|
+
className: MnemonSettingsCard_module_css_default.panelSection,
|
|
12740
|
+
"aria-label": t("config.runtimeUserScopeTitle"),
|
|
12741
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12742
|
+
className: MnemonSettingsCard_module_css_default.rows,
|
|
12743
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectRow, {
|
|
12744
|
+
id: "mnemon-runtime-user-scope",
|
|
12745
|
+
label: t("config.runtimeUserScopeTitle"),
|
|
12746
|
+
value: profile.value,
|
|
12747
|
+
disabled,
|
|
12748
|
+
onChange: profile.set,
|
|
12749
|
+
options: [{
|
|
12750
|
+
value: "storage",
|
|
12751
|
+
label: t("config.runtimeUserScopeStorage"),
|
|
12752
|
+
detail: t("config.runtimeUserScopeStorageHint")
|
|
12753
|
+
}, {
|
|
12754
|
+
value: "global",
|
|
12755
|
+
label: t("config.runtimeUserScopeGlobal"),
|
|
12756
|
+
detail: t("config.runtimeUserScopeGlobalHint")
|
|
12757
|
+
}]
|
|
12758
|
+
})
|
|
12759
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WriteFailure, {
|
|
12760
|
+
error: profile.failed,
|
|
12761
|
+
t
|
|
12762
|
+
})]
|
|
12763
|
+
}),
|
|
12764
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
12765
|
+
className: MnemonSettingsCard_module_css_default.panelSection,
|
|
12766
|
+
"aria-label": t("config.runtimeInheritance"),
|
|
12767
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12768
|
+
className: MnemonSettingsCard_module_css_default.rows,
|
|
12769
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleRow, {
|
|
12770
|
+
id: "mnemon-runtime-inherit-subagents",
|
|
12771
|
+
label: t("config.runtimeInheritance"),
|
|
12772
|
+
hint: t("config.runtimeInheritanceHint"),
|
|
12773
|
+
checked: inheritance.value,
|
|
12774
|
+
disabled,
|
|
12775
|
+
onChange: inheritance.set
|
|
12776
|
+
})
|
|
12777
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WriteFailure, {
|
|
12778
|
+
error: inheritance.failed,
|
|
12779
|
+
t
|
|
12780
|
+
})]
|
|
12781
|
+
}),
|
|
12782
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
12783
|
+
className: MnemonSettingsCard_module_css_default.panelSection,
|
|
12784
|
+
"aria-labelledby": "mnemon-runtime-limits",
|
|
12785
|
+
children: [
|
|
12786
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12787
|
+
className: MnemonSettingsCard_module_css_default.panelHeading,
|
|
12788
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
12789
|
+
id: "mnemon-runtime-limits",
|
|
12790
|
+
children: t("config.runtimeLimitsTitle")
|
|
12791
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12792
|
+
id: "mnemon-runtime-limits-hint",
|
|
12793
|
+
children: t("config.runtimeLimitsHint", {
|
|
12794
|
+
user: RUNTIME_MEMORY_LIMITS.user / 1024,
|
|
12795
|
+
memory: RUNTIME_MEMORY_LIMITS.memory / 1024
|
|
12796
|
+
})
|
|
12797
|
+
})]
|
|
12765
12798
|
}),
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12799
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12800
|
+
className: MnemonSettingsCard_module_css_default.fieldGrid,
|
|
12801
|
+
children: RUNTIME_LIMITS.map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t(`config.runtime.${key}`), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
12802
|
+
type: "number",
|
|
12803
|
+
min: "1",
|
|
12804
|
+
max: RUNTIME_MEMORY_LIMIT_MAX_BYTES,
|
|
12805
|
+
step: "1",
|
|
12806
|
+
inputMode: "numeric",
|
|
12807
|
+
value: limits.draft[key],
|
|
12808
|
+
disabled: disabled || limits.saving,
|
|
12809
|
+
"aria-describedby": "mnemon-runtime-limits-hint",
|
|
12810
|
+
"aria-invalid": runtimeLimitValue(limits.draft[key]) === void 0,
|
|
12811
|
+
onChange: (event) => limits.edit({ [key]: event.target.value })
|
|
12812
|
+
})] }, key))
|
|
12813
|
+
}),
|
|
12814
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelActions, {
|
|
12815
|
+
dirty: limits.dirty,
|
|
12816
|
+
saving: limits.saving,
|
|
12817
|
+
applied: limits.applied,
|
|
12818
|
+
failed: limits.failed,
|
|
12819
|
+
disabled,
|
|
12820
|
+
t,
|
|
12821
|
+
note: t("config.runtimeLimitsApply"),
|
|
12822
|
+
invalid: invalid === void 0 ? null : t("config.runtimeLimitInvalid", {
|
|
12823
|
+
field: t(`config.runtime.${invalid}`),
|
|
12824
|
+
max: RUNTIME_MEMORY_LIMIT_MAX_BYTES
|
|
12825
|
+
}),
|
|
12826
|
+
onDiscard: limits.discard,
|
|
12827
|
+
onApply: () => {
|
|
12828
|
+
limits.apply();
|
|
12829
|
+
}
|
|
12830
|
+
})
|
|
12831
|
+
]
|
|
12832
|
+
})
|
|
12833
|
+
] });
|
|
12773
12834
|
}
|
|
12774
12835
|
/** Each limit as the page shows it: the interval in seconds, the others as stored. */
|
|
12775
12836
|
const LIMITS = [
|
package/lib/extension-sdk.js
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
import { a as memoryConfigurationDigest, c as record, d as truncate, f as canonicalWorkspacePath, i as integer, l as stringArray, m as withMemoryStorageLock, o as migrationLineage, p as workspaceStorageId, s as receipt, t as defineMemoryStrategyConfiguration, u as text } from "./strategy-configuration-CKP2kRss.js";
|
|
2
2
|
import { COMPOSABLE_MEMORY_API_VERSION, MEMORY_VIEW_EXTENSION_SLOTS } from "./contracts.js";
|
|
3
3
|
import { a as defineMemoryStrategy, i as defineMemorySource, o as defineMemoryStrategyExtension, r as defineMemoryPlugin } from "./definitions-DU7MLBhu.js";
|
|
4
|
+
//#region src/sdk/projection-reservation.ts
|
|
5
|
+
/** Reserve complete Source-declared resident data inside the existing View ceiling. */
|
|
6
|
+
function reserveMemoryProjection(spec, sources, budget) {
|
|
7
|
+
const minimums = spec.sources.map((selected) => {
|
|
8
|
+
const source = sources.find((item) => item.sourceInstanceKey === selected.sourceInstanceKey);
|
|
9
|
+
const hints = source?.hints;
|
|
10
|
+
const value = source?.capabilities.includes("project") && hints !== null && typeof hints === "object" && !Array.isArray(hints) ? hints?.minimumProjectionCharacters : void 0;
|
|
11
|
+
if (value === void 0) return 0;
|
|
12
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw new Error("Invalid minimum projection hint");
|
|
13
|
+
return value;
|
|
14
|
+
});
|
|
15
|
+
if (minimums.every((value) => value === 0)) return spec;
|
|
16
|
+
const minimum = minimums.reduce((sum, value) => sum + value, 0);
|
|
17
|
+
if (minimum > budget) throw new Error(`Pinned memory requires ${minimum} projection characters but the View budget is ${budget}. Unpin entries or increase the View budget.`);
|
|
18
|
+
const allocation = spec.sources.map((selected, index) => Math.max(minimums[index], selected.projection?.maxCharacters ?? 0));
|
|
19
|
+
let excess = allocation.reduce((sum, value) => sum + value, 0) - budget;
|
|
20
|
+
for (let index = allocation.length - 1; index >= 0 && excess > 0; index--) {
|
|
21
|
+
const reclaimed = Math.min(excess, allocation[index] - minimums[index]);
|
|
22
|
+
allocation[index] -= reclaimed;
|
|
23
|
+
excess -= reclaimed;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
...spec,
|
|
27
|
+
sources: spec.sources.map((selected, index) => {
|
|
28
|
+
const { projection, ...rest } = selected;
|
|
29
|
+
const characters = allocation[index];
|
|
30
|
+
return {
|
|
31
|
+
...rest,
|
|
32
|
+
...minimums[index] > 0 ? { required: true } : {},
|
|
33
|
+
...characters === 0 ? {} : { projection: {
|
|
34
|
+
mode: projection?.mode ?? "eager",
|
|
35
|
+
maxCharacters: characters
|
|
36
|
+
} }
|
|
37
|
+
};
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
4
42
|
//#region src/sdk/install.ts
|
|
5
43
|
function locatedEntryId(ctx) {
|
|
6
44
|
const located = ctx.get("loader", false)?.locate(ctx.fiber)?.trim();
|
|
@@ -108,4 +146,4 @@ function defineMemoryViewExtension(definition) {
|
|
|
108
146
|
});
|
|
109
147
|
}
|
|
110
148
|
//#endregion
|
|
111
|
-
export { canonicalWorkspacePath, receipt as createMemoryMutationReceipt, defineMemoryPlugin, defineMemorySource, defineMemoryStrategy, defineMemoryStrategyConfiguration, defineMemoryStrategyExtension, defineMemoryViewExtension, installMemory, memoryConfigurationDigest, integer as memoryInputInteger, migrationLineage as memoryInputMigrationLineage, record as memoryInputRecord, stringArray as memoryInputStringArray, text as memoryInputText, memoryViewExtensionValues, truncate as truncateMemoryText, validateMemoryViewExtension, withMemoryStorageLock, workspaceStorageId };
|
|
149
|
+
export { canonicalWorkspacePath, receipt as createMemoryMutationReceipt, defineMemoryPlugin, defineMemorySource, defineMemoryStrategy, defineMemoryStrategyConfiguration, defineMemoryStrategyExtension, defineMemoryViewExtension, installMemory, memoryConfigurationDigest, integer as memoryInputInteger, migrationLineage as memoryInputMigrationLineage, record as memoryInputRecord, stringArray as memoryInputStringArray, text as memoryInputText, memoryViewExtensionValues, reserveMemoryProjection, truncate as truncateMemoryText, validateMemoryViewExtension, withMemoryStorageLock, workspaceStorageId };
|