dsh-strata-sync 0.10.8 → 0.10.9
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 +4 -2
- package/dist/client.js +3 -3
- package/dist/core.mjs +6 -3
- package/docs/README.zh-CN.md +4 -2
- package/docs/README.zh-TW.md +4 -2
- package/docs/VALIDATION.md +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,14 +58,16 @@ Existing conversations keep their selected model route and preset revision. To m
|
|
|
58
58
|
| Setting | How it is chosen |
|
|
59
59
|
|---|---|
|
|
60
60
|
| Model and context | Strata's loaded text model and verified context capacity. |
|
|
61
|
-
| Response output limit | Manual override, if set; otherwise the verified Strata output default. If unavailable or unlimited, use 30% of context,
|
|
61
|
+
| Response output limit | Manual override, if set; otherwise the verified Strata output default. If unavailable or unlimited, use Strata's formula: 30% of context, at least 4,096 and at most 32,768 tokens. |
|
|
62
62
|
| Input types | Confirmed server capabilities, such as text or text plus image. |
|
|
63
63
|
| Reasoning levels | Verified model-template support; unknown templates preserve existing settings. |
|
|
64
64
|
| Default model | Follows the loaded Strata model when **Follow the loaded Strata model as the default** is enabled. |
|
|
65
65
|
|
|
66
66
|
Keep **Follow Strata output limit** enabled for automatic selection. Turn it off to set a manual override under **Advanced settings**. The preview shows the server default, effective value and source separately.
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
The fallback follows [Strata's local output formula](https://github.com/Niko1221/Strata/blob/main/apps/host/server/agent/profile.mjs): `max(4096, min(32768, floor(context × 0.3)))`.
|
|
69
|
+
|
|
70
|
+
When synchronizing, the plugin normally sets a 4,096-token summary output cap and compaction headroom. For small windows using calculated output, both are limited to half the remaining conversation budget, rounded down; an 8K window therefore uses 2,048. The effective compaction trigger is the smaller of **80% of context** and **context − response output − headroom**. Recent-content retention is **(context − response output) × 16%**, rounded down. These compaction budgets are calculated by the plugin, not supplied by Strata.
|
|
69
71
|
|
|
70
72
|
For example, with automatic output calculation, a 32K context uses a 9,830-token response allowance and an 18,842-token compaction trigger. It does **not** necessarily compact at 80%.
|
|
71
73
|
|
package/dist/client.js
CHANGED
|
@@ -11,7 +11,7 @@ window.__ModuleLoader__.load({
|
|
|
11
11
|
"Automatic calculation": {"zh-Hant":"自動計算","zh-Hans":"自动计算"},
|
|
12
12
|
"Server has no fixed output limit.": {"zh-Hant":"伺服器未設定固定輸出上限。","zh-Hans":"服务器未设置固定输出上限。"},
|
|
13
13
|
"Server output limit could not be verified.": {"zh-Hant":"無法確認伺服器的輸出上限。","zh-Hans":"无法确认服务器的输出上限。"},
|
|
14
|
-
"Leave blank to use the server output default; if absent or unlimited, use 30% of context,
|
|
14
|
+
"Leave blank to use the server output default; if absent or unlimited, use 30% of context, at least 4,096 and at most 32,768. An explicit override takes priority.": {"zh-Hant":"留空會採用伺服器輸出預設值;未提供或無固定上限時,使用上下文的 30%,最低 4,096、最高 32,768。明確填寫的覆寫值優先。","zh-Hans":"留空采用服务器输出默认值;未提供或无固定上限时,使用上下文的 30%,最低 4,096、最高 32,768。明确填写的覆盖值优先。"},
|
|
15
15
|
"Strata returned an invalid output limit. Review the server setting before syncing.": {"zh-Hant":"Strata 回傳無效的輸出上限,請先檢查伺服器設定。","zh-Hans":"Strata 返回无效的输出上限,请先检查服务器设置。"},
|
|
16
16
|
"Runs once on the next DSH start; no periodic server checks.": {
|
|
17
17
|
"zh-Hant": "下次啟動 DSH 時同步一次,不再定期檢查伺服器。",
|
|
@@ -377,7 +377,7 @@ window.__ModuleLoader__.load({
|
|
|
377
377
|
'Enabled': {'zh-Hant':'已啟用','zh-Hans':'已启用'},
|
|
378
378
|
'Save option changes below before checking differences again.': {'zh-Hant':'請先在下方儲存選項變更,再重新檢查差異。','zh-Hans':'请先在下方保存选项更改,再重新检查差异。'},
|
|
379
379
|
'Follow Strata output limit': {'zh-Hant':'輸出上限跟隨 Strata','zh-Hans':'输出上限跟随 Strata'},
|
|
380
|
-
'Use the verified server default. If none is available, calculate 30% of context,
|
|
380
|
+
'Use the verified server default. If none is available, calculate 30% of context, at least 4,096 and at most 32,768 tokens.': {'zh-Hant':'採用已確認的伺服器預設值;無固定值時,以上下文的 30% 計算,最低 4,096、最高 32,768 tokens。','zh-Hans':'采用已确认的服务器默认值;无固定值时,按上下文的 30% 计算,最低 4,096、最高 32,768 tokens。'},
|
|
381
381
|
'Advanced settings': {'zh-Hant':'進階設定','zh-Hans':'高级设置'},
|
|
382
382
|
'Manual output limit': {'zh-Hant':'手動輸出上限','zh-Hans':'手动输出上限'},
|
|
383
383
|
'Turn off Follow Strata output limit to enter a manual override.': {'zh-Hant':'關閉「輸出上限跟隨 Strata」後,可輸入手動覆寫值。','zh-Hans':'关闭“输出上限跟随 Strata”后,可输入手动覆盖值。'},
|
|
@@ -570,7 +570,7 @@ REASONING_DEFAULT_CONFLICT: 'The provider default reasoning level is not support
|
|
|
570
570
|
h('summary',{className:'ss-option-title'},h('span',null,t('Sync preferences')),h('span',{className:'ss-option-description'},t('Output limit, default model and startup sync'))),
|
|
571
571
|
h('div',{className:'ss-card'},
|
|
572
572
|
h('label',{className:'ss-check'},h('input',{type:'checkbox',checked:!form.manual,'aria-label':t('Follow Strata output limit'),onChange:e=>edit({manual:!e.target.checked}),disabled:pending||!state}),t('Follow Strata output limit')),
|
|
573
|
-
h('p',{className:'ss-muted'},t('Use the verified server default. If none is available, calculate 30% of context,
|
|
573
|
+
h('p',{className:'ss-muted'},t('Use the verified server default. If none is available, calculate 30% of context, at least 4,096 and at most 32,768 tokens.')),
|
|
574
574
|
activeBudget?outputValues(activeBudget,preview.server?.model):h('p',{className:'ss-muted'},t('Check differences to read the server and effective limits.')),
|
|
575
575
|
h('details',{className:'ss-details',open:form.manual},h('summary',null,t('Advanced settings')),
|
|
576
576
|
h('label',null,t('Manual output limit'),h('input',{type:'number',min:1,step:1,value:form.output,onChange:e=>edit({output:e.target.value}),disabled:pending||!state||!form.manual})),
|
package/dist/core.mjs
CHANGED
|
@@ -59,18 +59,21 @@ export function normalizeBaseURL(value) {
|
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Select the output allowance, then derive DSH's client-side compaction policy.
|
|
62
|
-
* The 4096 headroom also matches the native pi-ai context safety margin.
|
|
62
|
+
* The usual 4096 headroom also matches the native pi-ai context safety margin.
|
|
63
63
|
*/
|
|
64
64
|
export function planBudget(contextWindow, { outputTokens, serverOutputTokens } = {}) {
|
|
65
65
|
if (!isContext(contextWindow) || contextWindow < 8192) {
|
|
66
66
|
fail('UNSUPPORTED_CONTEXT', 'A verified context window of at least 8,192 tokens is required.');
|
|
67
67
|
}
|
|
68
|
-
const output = outputTokens ?? serverOutputTokens ?? Math.min(
|
|
68
|
+
const output = outputTokens ?? serverOutputTokens ?? Math.max(4096, Math.min(32768, Math.floor(contextWindow * 0.3)));
|
|
69
69
|
const outputSource = outputTokens != null ? 'manual' : serverOutputTokens != null ? 'server' : 'calculated';
|
|
70
70
|
if (!Number.isSafeInteger(output) || output < 1 || output >= contextWindow) {
|
|
71
71
|
fail('INVALID_OUTPUT_BUDGET', 'The output budget must be a positive integer smaller than the context window.');
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
// The 4K output floor must still leave compaction room in an 8K window.
|
|
74
|
+
// Keep fixed/manual budgets and the usual 4K reserve unchanged.
|
|
75
|
+
const headroomTokens = outputSource === 'calculated'
|
|
76
|
+
? Math.min(4096, Math.floor((contextWindow - output) / 2)) : 4096;
|
|
74
77
|
const thresholdRatio = 0.8;
|
|
75
78
|
const retainRatio = 0.16;
|
|
76
79
|
const messageBudgetTokens = contextWindow - output;
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -58,14 +58,16 @@ dsh plugin --profile desktop add dsh-strata-sync --registry=https://registry.npm
|
|
|
58
58
|
| 设置 | 如何决定 |
|
|
59
59
|
|---|---|
|
|
60
60
|
| 模型与上下文 | 采用 Strata 已加载的文本模型及已确认的上下文容量。 |
|
|
61
|
-
| 回复输出上限 | 优先使用手动覆盖值;否则采用已确认的 Strata
|
|
61
|
+
| 回复输出上限 | 优先使用手动覆盖值;否则采用已确认的 Strata 输出默认值。无法取得或未限制时,使用 Strata 官方公式:上下文的 30%,最低 4,096、最高 32,768 tokens。 |
|
|
62
62
|
| 输入类型 | 采用服务器已确认的能力,例如文本或文本+图片。 |
|
|
63
63
|
| 推理等级 | 根据已验证的模型模板确定;未知模板保留原有设置。 |
|
|
64
64
|
| 默认模型 | 启用**默认模型跟随 Strata 已加载的模型**时,跟随服务器当前模型。 |
|
|
65
65
|
|
|
66
66
|
保持**输出上限跟随 Strata**开启,即可自动选择。关闭后可在**高级设置**输入手动覆盖值。预览会分别显示服务器默认值、实际应用值及其来源。
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
自动计算采用 [Strata 官方输出公式](https://github.com/Niko1221/Strata/blob/main/apps/host/server/agent/profile.mjs):`max(4096, min(32768, floor(context × 0.3)))`。
|
|
69
|
+
|
|
70
|
+
同步时,摘要输出上限和压缩余量通常均为 4,096 tokens。小窗口使用自动计算输出时,两者最多为剩余对话预算的一半,向下取整;因此 8K 窗口使用 2,048。实际压缩阈值取**上下文的 80%**与**上下文 − 回复输出预算 − 压缩余量**中的较小值,近期内容保留量为 **(上下文 − 回复输出预算)× 16%**,向下取整。这些压缩预算由插件计算,并非 Strata 提供的设置。
|
|
69
71
|
|
|
70
72
|
例如,采用自动输出计算时,32K 上下文的回复预算为 9,830 tokens,压缩阈值为 18,842 tokens,**不一定在 80% 时压缩**。
|
|
71
73
|
|
package/docs/README.zh-TW.md
CHANGED
|
@@ -58,14 +58,16 @@ dsh plugin --profile desktop add dsh-strata-sync --registry=https://registry.npm
|
|
|
58
58
|
| 設定 | 如何決定 |
|
|
59
59
|
|---|---|
|
|
60
60
|
| 模型與上下文 | 採用 Strata 已載入的文字模型及已確認的上下文容量。 |
|
|
61
|
-
| 回覆輸出上限 | 優先使用手動覆寫值;否則採用已確認的 Strata
|
|
61
|
+
| 回覆輸出上限 | 優先使用手動覆寫值;否則採用已確認的 Strata 輸出預設值。無法取得或未限制時,使用 Strata 官方公式:上下文的 30%,最低 4,096、最高 32,768 tokens。 |
|
|
62
62
|
| 輸入類型 | 採用伺服器已確認的能力,例如文字或文字+圖片。 |
|
|
63
63
|
| 推理等級 | 依已驗證的模型範本決定;未知範本保留原有設定。 |
|
|
64
64
|
| 預設模型 | 啟用**預設模型跟隨 Strata 已載入的模型**時,跟隨伺服器目前模型。 |
|
|
65
65
|
|
|
66
66
|
保持**輸出上限跟隨 Strata**開啟,即可自動選擇。關閉後可在**進階設定**輸入手動覆寫值。預覽會分別顯示伺服器預設值、實際套用值及其來源。
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
自動計算採用 [Strata 官方輸出公式](https://github.com/Niko1221/Strata/blob/main/apps/host/server/agent/profile.mjs):`max(4096, min(32768, floor(context × 0.3)))`。
|
|
69
|
+
|
|
70
|
+
同步時,摘要輸出上限和壓縮餘裕通常均為 4,096 tokens。小視窗使用自動計算輸出時,兩者最多為剩餘對話預算的一半,向下取整;因此 8K 視窗使用 2,048。實際壓縮門檻取**上下文的 80%**與**上下文 − 回覆輸出預算 − 壓縮餘裕**中的較小值,近期內容保留量為 **(上下文 − 回覆輸出預算)× 16%**,向下取整。這些壓縮預算由外掛計算,並非 Strata 提供的設定。
|
|
69
71
|
|
|
70
72
|
例如,採用自動輸出計算時,32K 上下文的回覆預算為 9,830 tokens,壓縮門檻為 18,842 tokens,**不一定在 80% 時壓縮**。
|
|
71
73
|
|
package/docs/VALIDATION.md
CHANGED
|
@@ -11,7 +11,9 @@ Validation date: 2026-10-30 (Asia/Taipei).
|
|
|
11
11
|
|
|
12
12
|
## Automated verification
|
|
13
13
|
|
|
14
|
-
All **
|
|
14
|
+
All **162 automated tests pass** for the current runtime. Coverage includes:
|
|
15
|
+
|
|
16
|
+
- Automatic output matches Strata's 30% formula with a 4,096 floor and 32,768 ceiling. Tests cover 8K through 1M contexts, rounding at the ceiling, unchanged server/manual precedence, valid small-window compaction budgets and all three UI translations. The 8K calculated-output case limits compaction headroom and summary cap to 2,048; 32K and larger retain 4,096.
|
|
15
17
|
|
|
16
18
|
- Actual pi-ai context clamping across multiple input sizes, near-full and exhausted context, independent source length, additional prompt costs, disabled-mode zero discovery and restored native requests.
|
|
17
19
|
- Native Cordis waterfall dispatch, immutable messages, concurrent summaries, duplicate hooks, cancellation, metadata failures, early stream closure, native errors and unload.
|