@ai-agent-forge/plugin-overflow-policy 0.88.11 → 0.88.13
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 +2 -0
- package/agent-forge.json +1 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +2 -0
- package/dist/entry.js.map +1 -1
- package/package.json +4 -3
- package/plugin.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
# @agent-forge/plugin-overflow-policy
|
|
2
2
|
|
|
3
3
|
Agent Forge 出厂默认溢出策略插件(context overflow 与 recoverable length 分类 decide),bundled 分发,宿主通过 manifest 加载并经供给基座注入共享模块。
|
|
4
|
+
|
|
5
|
+
已知本地失败(`failureSource: "local"`)不因错误文案触发溢出或长度恢复。未知来源仍沿用原分类;自定义策略可依据公共事实自主判断,宿主不内置 local 禁止规则。完整边界见 [模型调用恢复契约](../../docs/design/模型调用恢复契约.md)。
|
package/agent-forge.json
CHANGED
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAEpF,oGAAoG;AACpG,eAAO,MAAM,4BAA4B,YAAY,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAA8B,+BAA+B,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAEpF,oGAAoG;AACpG,eAAO,MAAM,4BAA4B,YAAY,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAA8B,+BAA+B,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,CAqBlH","sourcesContent":["import { type AssistantMessage, isContextOverflow, isRecoverableLength } from \"@agent-forge/ai/compat\";\nimport { t } from \"@agent-forge/host/i18n\";\nimport type { CapabilityAPI, OverflowPolicyRequest } from \"@agent-forge/plugin-sdk\";\n\n/** Policy name under the `overflow-policy` capability; matches the host's embedded default name. */\nexport const DEFAULT_OVERFLOW_POLICY_NAME = \"default\";\n\n/**\n * Default-export factory consumed by the host's manifest plugin loader.\n *\n * Registers the current provider classification (overflow and recoverable-length\n * logic migrated verbatim from the host's embedded `bootstrap-overflow-policy.ts`,\n * D-082 batch 3) under the fixed default name: rerouting via overflowPolicyName\n * config selects a different policy, while a same-name registration competes by\n * load order — it is not a replacement mechanism.\n */\nexport default async function createOverflowPolicyPluginEntry(api: CapabilityAPI): Promise<{ dispose: () => void }> {\n\tconst registration = api.registerOverflowPolicy(DEFAULT_OVERFLOW_POLICY_NAME, {\n\t\tdecide: (request: OverflowPolicyRequest) => {\n\t\t\tif (!request.message || typeof request.message !== \"object\") {\n\t\t\t\tthrow new Error(t(\"Overflow policy requires an assistant message object\"));\n\t\t\t}\n\t\t\tconst message = request.message as AssistantMessage;\n\t\t\tif (message.failureSource === \"local\") return { contextOverflow: false, recoverableLength: false };\n\t\t\treturn {\n\t\t\t\tcontextOverflow: isContextOverflow(message, request.contextWindow),\n\t\t\t\trecoverableLength: isRecoverableLength(message, request.desiredMaxOutput),\n\t\t\t};\n\t\t},\n\t});\n\treturn {\n\t\tdispose: () => {\n\t\t\t// Registration disposal in the capability runtime is synchronous;\n\t\t\t// void consumes the declared Promise possibility of the contract.\n\t\t\tvoid registration.dispose();\n\t\t},\n\t};\n}\n"]}
|
package/dist/entry.js
CHANGED
|
@@ -18,6 +18,8 @@ export default async function createOverflowPolicyPluginEntry(api) {
|
|
|
18
18
|
throw new Error(t("Overflow policy requires an assistant message object"));
|
|
19
19
|
}
|
|
20
20
|
const message = request.message;
|
|
21
|
+
if (message.failureSource === "local")
|
|
22
|
+
return { contextOverflow: false, recoverableLength: false };
|
|
21
23
|
return {
|
|
22
24
|
contextOverflow: isContextOverflow(message, request.contextWindow),
|
|
23
25
|
recoverableLength: isRecoverableLength(message, request.desiredMaxOutput),
|
package/dist/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,oGAAoG;AACpG,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B,CAAC,GAAkB,EAAoC;IACnH,MAAM,YAAY,GAAG,GAAG,CAAC,sBAAsB,CAAC,4BAA4B,EAAE;QAC7E,MAAM,EAAE,CAAC,OAA8B,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAC7D,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,sDAAsD,CAAC,CAAC,CAAC;YAC5E,CAAC;YACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAA2B,CAAC;YACpD,OAAO;gBACN,eAAe,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC;gBAClE,iBAAiB,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC;aACzE,CAAC;QAAA,CACF;KACD,CAAC,CAAC;IACH,OAAO;QACN,OAAO,EAAE,GAAG,EAAE,CAAC;YACd,kEAAkE;YAClE,kEAAkE;YAClE,KAAK,YAAY,CAAC,OAAO,EAAE,CAAC;QAAA,CAC5B;KACD,CAAC;AAAA,CACF","sourcesContent":["import { type AssistantMessage, isContextOverflow, isRecoverableLength } from \"@agent-forge/ai/compat\";\nimport { t } from \"@agent-forge/host/i18n\";\nimport type { CapabilityAPI, OverflowPolicyRequest } from \"@agent-forge/plugin-sdk\";\n\n/** Policy name under the `overflow-policy` capability; matches the host's embedded default name. */\nexport const DEFAULT_OVERFLOW_POLICY_NAME = \"default\";\n\n/**\n * Default-export factory consumed by the host's manifest plugin loader.\n *\n * Registers the current provider classification (overflow and recoverable-length\n * logic migrated verbatim from the host's embedded `bootstrap-overflow-policy.ts`,\n * D-082 batch 3) under the fixed default name: rerouting via overflowPolicyName\n * config selects a different policy, while a same-name registration competes by\n * load order — it is not a replacement mechanism.\n */\nexport default async function createOverflowPolicyPluginEntry(api: CapabilityAPI): Promise<{ dispose: () => void }> {\n\tconst registration = api.registerOverflowPolicy(DEFAULT_OVERFLOW_POLICY_NAME, {\n\t\tdecide: (request: OverflowPolicyRequest) => {\n\t\t\tif (!request.message || typeof request.message !== \"object\") {\n\t\t\t\tthrow new Error(t(\"Overflow policy requires an assistant message object\"));\n\t\t\t}\n\t\t\tconst message = request.message as AssistantMessage;\n\t\t\treturn {\n\t\t\t\tcontextOverflow: isContextOverflow(message, request.contextWindow),\n\t\t\t\trecoverableLength: isRecoverableLength(message, request.desiredMaxOutput),\n\t\t\t};\n\t\t},\n\t});\n\treturn {\n\t\tdispose: () => {\n\t\t\t// Registration disposal in the capability runtime is synchronous;\n\t\t\t// void consumes the declared Promise possibility of the contract.\n\t\t\tvoid registration.dispose();\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,oGAAoG;AACpG,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B,CAAC,GAAkB,EAAoC;IACnH,MAAM,YAAY,GAAG,GAAG,CAAC,sBAAsB,CAAC,4BAA4B,EAAE;QAC7E,MAAM,EAAE,CAAC,OAA8B,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAC7D,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,sDAAsD,CAAC,CAAC,CAAC;YAC5E,CAAC;YACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAA2B,CAAC;YACpD,IAAI,OAAO,CAAC,aAAa,KAAK,OAAO;gBAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC;YACnG,OAAO;gBACN,eAAe,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC;gBAClE,iBAAiB,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC;aACzE,CAAC;QAAA,CACF;KACD,CAAC,CAAC;IACH,OAAO;QACN,OAAO,EAAE,GAAG,EAAE,CAAC;YACd,kEAAkE;YAClE,kEAAkE;YAClE,KAAK,YAAY,CAAC,OAAO,EAAE,CAAC;QAAA,CAC5B;KACD,CAAC;AAAA,CACF","sourcesContent":["import { type AssistantMessage, isContextOverflow, isRecoverableLength } from \"@agent-forge/ai/compat\";\nimport { t } from \"@agent-forge/host/i18n\";\nimport type { CapabilityAPI, OverflowPolicyRequest } from \"@agent-forge/plugin-sdk\";\n\n/** Policy name under the `overflow-policy` capability; matches the host's embedded default name. */\nexport const DEFAULT_OVERFLOW_POLICY_NAME = \"default\";\n\n/**\n * Default-export factory consumed by the host's manifest plugin loader.\n *\n * Registers the current provider classification (overflow and recoverable-length\n * logic migrated verbatim from the host's embedded `bootstrap-overflow-policy.ts`,\n * D-082 batch 3) under the fixed default name: rerouting via overflowPolicyName\n * config selects a different policy, while a same-name registration competes by\n * load order — it is not a replacement mechanism.\n */\nexport default async function createOverflowPolicyPluginEntry(api: CapabilityAPI): Promise<{ dispose: () => void }> {\n\tconst registration = api.registerOverflowPolicy(DEFAULT_OVERFLOW_POLICY_NAME, {\n\t\tdecide: (request: OverflowPolicyRequest) => {\n\t\t\tif (!request.message || typeof request.message !== \"object\") {\n\t\t\t\tthrow new Error(t(\"Overflow policy requires an assistant message object\"));\n\t\t\t}\n\t\t\tconst message = request.message as AssistantMessage;\n\t\t\tif (message.failureSource === \"local\") return { contextOverflow: false, recoverableLength: false };\n\t\t\treturn {\n\t\t\t\tcontextOverflow: isContextOverflow(message, request.contextWindow),\n\t\t\t\trecoverableLength: isRecoverableLength(message, request.desiredMaxOutput),\n\t\t\t};\n\t\t},\n\t});\n\treturn {\n\t\tdispose: () => {\n\t\t\t// Registration disposal in the capability runtime is synchronous;\n\t\t\t// void consumes the declared Promise possibility of the contract.\n\t\t\tvoid registration.dispose();\n\t\t},\n\t};\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-agent-forge/plugin-overflow-policy",
|
|
3
|
-
"version": "0.88.
|
|
3
|
+
"version": "0.88.13",
|
|
4
4
|
"description": "Default overflow policy plugin for Agent Forge (context-overflow and recoverable-length classification)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/entry.js",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"clean": "shx rm -rf dist",
|
|
22
22
|
"build": "tsgo -p tsconfig.build.json",
|
|
23
23
|
"test": "vitest --run",
|
|
24
|
-
"prepublishOnly": "npm run clean && npm run build"
|
|
24
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
25
|
+
"test:coverage": "vitest --run --coverage"
|
|
25
26
|
},
|
|
26
27
|
"keywords": [
|
|
27
28
|
"agent-forge",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"shx": "0.4
|
|
48
|
+
"shx": "0.3.4",
|
|
48
49
|
"vitest": "4.1.11"
|
|
49
50
|
}
|
|
50
51
|
}
|