@deepseek-ai/dsh-tmux-context 0.1.7-alpha.2 → 0.1.7-rc.2
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.i18n.yaml +66 -5
- package/lib/index.js +111 -9
- package/package.json +12 -12
package/README.i18n.yaml
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
|
-
# Bilingual-pair consistency record (docs/i18n/README.md):
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/context/tmux-context/README.md
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/:
|
|
6
|
+
en: d1bef1216dfe10fa
|
|
7
|
+
zh: aee241b6eed43293
|
|
8
|
+
/deepseek-ai-dsh-tmux-context:
|
|
9
|
+
en: 18e42c83b8bc27da
|
|
10
|
+
zh: 89f0739235511ab1
|
|
11
|
+
/deepseek-ai-dsh-tmux-context/summary:
|
|
12
|
+
en: 4c62923f1912d201
|
|
13
|
+
zh: 7f2211f9616c0197
|
|
14
|
+
/deepseek-ai-dsh-tmux-context/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/deepseek-ai-dsh-tmux-context/use-this-package:
|
|
18
|
+
en: 872d46d8bbbcda8d
|
|
19
|
+
zh: 9d14bbdb45851c07
|
|
20
|
+
/deepseek-ai-dsh-tmux-context/use-this-package/what-the-model-gets:
|
|
21
|
+
en: 8d594d379878de46
|
|
22
|
+
zh: cfa52a5e0b297a6d
|
|
23
|
+
/deepseek-ai-dsh-tmux-context/use-this-package/configuration:
|
|
24
|
+
en: bdbf74db21f91152
|
|
25
|
+
zh: 6722e00c4a3e29db
|
|
26
|
+
/deepseek-ai-dsh-tmux-context/use-this-package/when-the-location-is-known:
|
|
27
|
+
en: 360821e2ef8f3d50
|
|
28
|
+
zh: 691d23a188558e9f
|
|
29
|
+
/deepseek-ai-dsh-tmux-context/understand-the-implementation:
|
|
30
|
+
en: 2d21fa2aad5a729d
|
|
31
|
+
zh: cfbfada0eb647435
|
|
32
|
+
/deepseek-ai-dsh-tmux-context/understand-the-implementation/design-concept:
|
|
33
|
+
en: 1902de51becf7c7d
|
|
34
|
+
zh: 130e673b471c38c4
|
|
35
|
+
/deepseek-ai-dsh-tmux-context/understand-the-implementation/source-map:
|
|
36
|
+
en: 57d240751bb587a0
|
|
37
|
+
zh: 0a4195a9e3024208
|
|
38
|
+
/deepseek-ai-dsh-tmux-context/understand-the-implementation/main-flow:
|
|
39
|
+
en: 2d5768fe44120780
|
|
40
|
+
zh: cd601c59d9604e6e
|
|
41
|
+
/deepseek-ai-dsh-tmux-context/further-exploration:
|
|
42
|
+
en: 08c09f5eb13c30e6
|
|
43
|
+
zh: 1b34ef9ca42ac9e7
|
|
44
|
+
/deepseek-ai-dsh-tmux-context/model-experience:
|
|
45
|
+
en: 215e7ba838619b7b
|
|
46
|
+
zh: a311da3843709f90
|
|
47
|
+
/deepseek-ai-dsh-tmux-context/model-experience/preparation-time-tmux-location:
|
|
48
|
+
en: 9c9825ee622e4b92
|
|
49
|
+
zh: b9edc0c529612fe6
|
|
50
|
+
/deepseek-ai-dsh-tmux-context/model-experience/preparation-time-tmux-location/what-the-model-sees:
|
|
51
|
+
en: 8697059219e2ab02
|
|
52
|
+
zh: d321f11003c93de9
|
|
53
|
+
/deepseek-ai-dsh-tmux-context/model-experience/preparation-time-tmux-location/what-the-model-sees/changed-turn-reading:
|
|
54
|
+
en: efdd843a7c1aa9d7
|
|
55
|
+
zh: 533b6f25b583363e
|
|
56
|
+
/deepseek-ai-dsh-tmux-context/model-experience/preparation-time-tmux-location/token-effect:
|
|
57
|
+
en: 6a0348385ba38e7e
|
|
58
|
+
zh: 02af00a2c5aea469
|
|
59
|
+
/deepseek-ai-dsh-tmux-context/model-experience/preparation-time-tmux-location/kv-cache-effect:
|
|
60
|
+
en: 2fbf2175168e8244
|
|
61
|
+
zh: b70653f9cbe2a47b
|
|
62
|
+
/deepseek-ai-dsh-tmux-context/known-limitations-and-deferred-work:
|
|
63
|
+
en: af80ce3c69f582ab
|
|
64
|
+
zh: da5ad546c19d7d56
|
|
65
|
+
/deepseek-ai-dsh-tmux-context/known-limitations-and-deferred-work/dev-note:
|
|
66
|
+
en: e67f633dc6fe7773
|
|
67
|
+
zh: 3bb0c20c93f16f98
|
package/lib/index.js
CHANGED
|
@@ -165,6 +165,16 @@ function validateName(subject, value) {
|
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region ../../util/values/src/index.ts
|
|
167
167
|
/**
|
|
168
|
+
* Mark an unreachable closed-union branch.
|
|
169
|
+
* @param value - impossible value; an unhandled typed variant fails at the call site.
|
|
170
|
+
* @param context - optional switch-site label included in the failure message.
|
|
171
|
+
* @returns never; a runtime value that escaped its type always throws.
|
|
172
|
+
*/
|
|
173
|
+
function assertNever(value, context) {
|
|
174
|
+
const rendered = JSON.stringify(value) ?? String(value);
|
|
175
|
+
throw new Error(`unreachable variant${context ? ` in ${context}` : ""}: ${rendered}`);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
168
178
|
* Deep-freeze an object graph in place while leaving live AbortSignal objects mutable.
|
|
169
179
|
* @param value - value to freeze.
|
|
170
180
|
* @returns the same value after every reachable enumerable child is frozen.
|
|
@@ -610,6 +620,89 @@ function projectImagesForTextModel(messages) {
|
|
|
610
620
|
};
|
|
611
621
|
});
|
|
612
622
|
}
|
|
623
|
+
function withoutDeveloperMessages(messages) {
|
|
624
|
+
const retained = messages.filter((message) => message.role !== "developer");
|
|
625
|
+
return retained.length === messages.length ? messages : retained;
|
|
626
|
+
}
|
|
627
|
+
function toolDeclarations(tools, mode, history) {
|
|
628
|
+
const declarations = new Map(history.tools.map((tool) => [tool.name, tool]));
|
|
629
|
+
for (const update of history.updates) for (const tool of update.additions) if (!declarations.has(tool.name)) declarations.set(tool.name, {
|
|
630
|
+
...tool,
|
|
631
|
+
deferLoading: true
|
|
632
|
+
});
|
|
633
|
+
switch (mode) {
|
|
634
|
+
case "in-history": return declarations;
|
|
635
|
+
case "addition-only": {
|
|
636
|
+
const activeNames = new Set(tools?.map((tool) => tool.name));
|
|
637
|
+
for (const name of declarations.keys()) if (!activeNames.has(name)) declarations.delete(name);
|
|
638
|
+
return declarations;
|
|
639
|
+
}
|
|
640
|
+
/* v8 ignore next 2 -- closed-union exhaustiveness guard */
|
|
641
|
+
default: return assertNever(mode);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Construct provider declarations from session-folded history without changing logged active tools.
|
|
646
|
+
* Unsupported routes and incomplete history use current declarations without developer updates.
|
|
647
|
+
* Explicitly deferred baseline tools become available only after their first retained addition.
|
|
648
|
+
* @param messages - complete request inputs, or the prefix selected for an auxiliary call.
|
|
649
|
+
* @param tools - currently active tool schemas.
|
|
650
|
+
* @param toolUpdate - the resolved route's update mode.
|
|
651
|
+
* @param history - immutable state folded from committed headers and developer messages.
|
|
652
|
+
* @returns provider declarations and the corresponding filtered history.
|
|
653
|
+
*/
|
|
654
|
+
function projectToolUpdates(messages, tools, toolUpdate, history) {
|
|
655
|
+
if (toolUpdate === void 0) {
|
|
656
|
+
let immediateTools = tools;
|
|
657
|
+
if (tools?.some((tool) => tool.deferLoading === true)) immediateTools = tools.map(({ deferLoading: _loading, ...tool }) => tool);
|
|
658
|
+
return {
|
|
659
|
+
messages: withoutDeveloperMessages(messages),
|
|
660
|
+
tools: immediateTools
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
if (history === void 0) return {
|
|
664
|
+
messages: withoutDeveloperMessages(messages),
|
|
665
|
+
tools
|
|
666
|
+
};
|
|
667
|
+
const messageIds = new Set(messages.flatMap((message) => message.role === "developer" ? [message.id] : []));
|
|
668
|
+
if (history.updates.some((update) => !messageIds.has(update.messageId))) return {
|
|
669
|
+
messages: withoutDeveloperMessages(messages),
|
|
670
|
+
tools
|
|
671
|
+
};
|
|
672
|
+
const declarations = toolDeclarations(tools, toolUpdate, history);
|
|
673
|
+
const updateIds = new Set(history.updates.map((update) => update.messageId));
|
|
674
|
+
const offered = new Set(history.tools.filter((tool) => !tool.deferLoading).map((tool) => tool.name));
|
|
675
|
+
const projectedMessages = [];
|
|
676
|
+
for (const message of messages) {
|
|
677
|
+
if (message.role !== "developer") {
|
|
678
|
+
projectedMessages.push(message);
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
if (!updateIds.has(message.id)) continue;
|
|
682
|
+
const content = message.content.filter((block) => {
|
|
683
|
+
switch (block.type) {
|
|
684
|
+
case "tool-addition":
|
|
685
|
+
if (!declarations.has(block.toolName) || offered.has(block.toolName)) return false;
|
|
686
|
+
offered.add(block.toolName);
|
|
687
|
+
return true;
|
|
688
|
+
case "tool-removal":
|
|
689
|
+
if (toolUpdate !== "in-history") return false;
|
|
690
|
+
return offered.delete(block.toolName);
|
|
691
|
+
default: return true;
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
if (content.length === 0) continue;
|
|
695
|
+
if (content.length === message.content.length) projectedMessages.push(message);
|
|
696
|
+
else projectedMessages.push({
|
|
697
|
+
...message,
|
|
698
|
+
content
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
return {
|
|
702
|
+
messages: projectedMessages.length === messages.length && projectedMessages.every((message, index) => message === messages[index]) ? messages : projectedMessages,
|
|
703
|
+
tools: [...declarations.values()]
|
|
704
|
+
};
|
|
705
|
+
}
|
|
613
706
|
//#endregion
|
|
614
707
|
//#region ../../llm/llm/src/attribution.ts
|
|
615
708
|
/**
|
|
@@ -1021,7 +1114,8 @@ var LlmError = class extends HarnessError {
|
|
|
1021
1114
|
}
|
|
1022
1115
|
/**
|
|
1023
1116
|
* Discover models advertised by one registered provider. Catalog membership
|
|
1024
|
-
*
|
|
1117
|
+
* does not constrain core routing. Catalog-driven entry points may restrict
|
|
1118
|
+
* selection and submission to the advertised models.
|
|
1025
1119
|
* @param provider - registered provider route to inspect.
|
|
1026
1120
|
* @returns detached model metadata in adapter-preferred order.
|
|
1027
1121
|
*/
|
|
@@ -1066,6 +1160,8 @@ var LlmError = class extends HarnessError {
|
|
|
1066
1160
|
const inputModalities = this.detachedModalities(resolved.inputModalities);
|
|
1067
1161
|
const systemPromptUpdate = resolved.systemPromptUpdate;
|
|
1068
1162
|
if (systemPromptUpdate !== void 0 && systemPromptUpdate !== "in-history") throw new LlmError(`adapter returned invalid system prompt update mode for provider "${provider}" model "${model}"`, "INVALID_MODEL_INFO");
|
|
1163
|
+
const toolUpdate = resolved.toolUpdate;
|
|
1164
|
+
if (toolUpdate !== void 0 && toolUpdate !== "in-history" && toolUpdate !== "addition-only") throw new LlmError(`adapter returned invalid tool update mode for provider "${provider}" model "${model}"`, "INVALID_MODEL_INFO");
|
|
1069
1165
|
const defaultMaxTokens = resolved.defaultMaxTokens;
|
|
1070
1166
|
if (defaultMaxTokens !== void 0 && (!Number.isSafeInteger(defaultMaxTokens) || defaultMaxTokens <= 0)) throw new LlmError(`adapter returned invalid default maxTokens for provider "${provider}" model "${model}"`, "INVALID_MODEL_MAX_TOKENS");
|
|
1071
1167
|
const info = {
|
|
@@ -1076,7 +1172,8 @@ var LlmError = class extends HarnessError {
|
|
|
1076
1172
|
...inputModalities === void 0 ? {} : { inputModalities },
|
|
1077
1173
|
...context === void 0 ? {} : { context: { contextWindow: context.contextWindow } },
|
|
1078
1174
|
...defaultMaxTokens === void 0 ? {} : { defaultMaxTokens },
|
|
1079
|
-
...resolved.systemPromptUpdate === void 0 ? {} : { systemPromptUpdate: resolved.systemPromptUpdate }
|
|
1175
|
+
...resolved.systemPromptUpdate === void 0 ? {} : { systemPromptUpdate: resolved.systemPromptUpdate },
|
|
1176
|
+
...resolved.toolUpdate === void 0 ? {} : { toolUpdate: resolved.toolUpdate }
|
|
1080
1177
|
};
|
|
1081
1178
|
const reasoning = resolved.reasoning;
|
|
1082
1179
|
if (reasoning === void 0) return info;
|
|
@@ -1171,6 +1268,7 @@ var LlmError = class extends HarnessError {
|
|
|
1171
1268
|
...context === void 0 ? {} : { context },
|
|
1172
1269
|
...modelInfo.inputModalities === void 0 ? {} : { inputModalities: Object.freeze([...modelInfo.inputModalities]) },
|
|
1173
1270
|
...modelInfo.systemPromptUpdate === void 0 ? {} : { systemPromptUpdate: modelInfo.systemPromptUpdate },
|
|
1271
|
+
...modelInfo.toolUpdate === void 0 ? {} : { toolUpdate: modelInfo.toolUpdate },
|
|
1174
1272
|
stream: (options) => {
|
|
1175
1273
|
if (dispatched) throw new LlmError("a prepared LLM call can only be dispatched once", "INVALID_PREPARED_CALL");
|
|
1176
1274
|
if (!callConfigEquals(options, resolvedConfig)) throw new LlmError("prepared LLM call config changed before adapter dispatch", "INVALID_PREPARED_CALL");
|
|
@@ -1260,13 +1358,17 @@ var LlmError = class extends HarnessError {
|
|
|
1260
1358
|
let projectedMessages = resolvedOptions.messages;
|
|
1261
1359
|
if (projectedMessages.some((message) => contentHasFile(message.content))) projectedMessages = projectFilesToText(projectedMessages, (ref) => this.fileReadPath(ref));
|
|
1262
1360
|
if (modelInfo.inputModalities !== void 0 && !modelInfo.inputModalities.includes("image") && projectedMessages.some((message) => contentHasImage(message.content))) projectedMessages = projectImagesForTextModel(projectedMessages);
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1361
|
+
const projectedTools = projectToolUpdates(projectedMessages, resolvedOptions.tools, modelInfo.toolUpdate, resolvedOptions.toolHistory);
|
|
1362
|
+
projectedMessages = projectedTools.messages;
|
|
1363
|
+
let projectedOptions = resolvedOptions;
|
|
1364
|
+
if (projectedMessages !== resolvedOptions.messages || projectedTools.tools !== resolvedOptions.tools) {
|
|
1365
|
+
projectedOptions = {
|
|
1366
|
+
...resolvedOptions,
|
|
1367
|
+
messages: projectedMessages,
|
|
1368
|
+
...projectedTools.tools === void 0 ? {} : { tools: projectedTools.tools }
|
|
1369
|
+
};
|
|
1370
|
+
if (Object.isFrozen(resolvedOptions)) deepFreeze(projectedOptions);
|
|
1371
|
+
}
|
|
1270
1372
|
iterator = dispatch(this.forAdapter(projectedOptions, adapter))[Symbol.asyncIterator]();
|
|
1271
1373
|
} catch (error) {
|
|
1272
1374
|
yield adapterFailureChunk(error, options.signal);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-tmux-context",
|
|
3
3
|
"description": "Opt-in durable per-step context with this agent's tmux pane and window location",
|
|
4
|
-
"version": "0.1.7-
|
|
4
|
+
"version": "0.1.7-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"@deepseek-ai/schemastery": "~3.18.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@deepseek-ai/dsh-
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-session": "0.1.7-
|
|
34
|
+
"@deepseek-ai/dsh-agent": "0.1.7-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-shell": "0.1.7-rc.2",
|
|
36
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
37
37
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
38
|
-
"@deepseek-ai/dsh-session-projection": "0.1.7-
|
|
38
|
+
"@deepseek-ai/dsh-session-projection": "0.1.7-rc.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@deepseek-ai/dsh-agent": "0.1.7-
|
|
42
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-
|
|
43
|
-
"@deepseek-ai/dsh-
|
|
44
|
-
"@deepseek-ai/dsh-session": "0.1.7-
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/dsh-system-prompt": "0.1.7-alpha.2",
|
|
41
|
+
"@deepseek-ai/dsh-agent": "0.1.7-rc.2",
|
|
42
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-rc.2",
|
|
43
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
44
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-shell": "0.1.7-rc.2",
|
|
47
46
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
48
|
-
"@deepseek-ai/dsh-session-projection": "0.1.7-
|
|
47
|
+
"@deepseek-ai/dsh-session-projection": "0.1.7-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2"
|
|
49
49
|
}
|
|
50
50
|
}
|