@morlay/ui-conversation-manager 0.0.2-alpha.8 → 0.0.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.md +1 -1
- package/dist/client.d.cts +49 -10
- package/dist/client.d.mts +49 -10
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -98,5 +98,5 @@ GC 是唯一会**停止所有运行中 agent** 的动作:确认后进入不可
|
|
|
98
98
|
|
|
99
99
|
## 文档
|
|
100
100
|
|
|
101
|
-
- 决策:[ADR-禁用上游已归档入口改由对话管理页承载](
|
|
101
|
+
- 决策:[ADR-禁用上游已归档入口改由对话管理页承载](../../bundles/better-session/.agents/adrs/20260918-禁用上游已归档入口改由对话管理页承载.md)
|
|
102
102
|
- 测试落点:[`src/__tests__/`](./src/__tests__)(注册面 / 页面 / 注入面 / 数字格式化四条 spec)
|
package/dist/client.d.cts
CHANGED
|
@@ -1096,9 +1096,8 @@ interface ToolRemovalBlock {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
/**
|
|
1098
1098
|
* Merge-extensible content blocks keyed by `type`. New core blocks must land
|
|
1099
|
-
* with adapter, UI, and compaction support.
|
|
1100
|
-
*
|
|
1101
|
-
* their producers and consumers are implemented together.
|
|
1099
|
+
* with adapter, UI, and compaction support. Tool-change blocks belong to
|
|
1100
|
+
* developer messages; `projectToolUpdates` selects what each route receives.
|
|
1102
1101
|
*/
|
|
1103
1102
|
interface ContentBlockMap {
|
|
1104
1103
|
'text': TextBlock;
|
|
@@ -1328,6 +1327,16 @@ interface LlmModelReasoningInfo {
|
|
|
1328
1327
|
* can follow the cached history instead of rewriting message 0.
|
|
1329
1328
|
*/
|
|
1330
1329
|
type SystemPromptUpdate = 'in-history';
|
|
1330
|
+
/**
|
|
1331
|
+
* How a model accepts native tool declarations that change mid-conversation.
|
|
1332
|
+
* `'addition-only'`: the model reads a `tool-addition` block in a later
|
|
1333
|
+
* developer message as activating a tool declared with `deferLoading`, so an
|
|
1334
|
+
* added tool follows the cached history instead of rewriting the declaration
|
|
1335
|
+
* list. `'in-history'`: the model additionally reads `tool-removal` blocks,
|
|
1336
|
+
* so a removed tool keeps its declaration and the removal follows the history.
|
|
1337
|
+
* Absent means every request declares the complete current tool list.
|
|
1338
|
+
*/
|
|
1339
|
+
type ToolUpdate = 'in-history' | 'addition-only';
|
|
1331
1340
|
/** Exact-route model metadata resolved by its owning adapter. */
|
|
1332
1341
|
interface LlmResolvedModelInfo extends LlmModelInfo {
|
|
1333
1342
|
/** Provider-owned context capacity when known. */
|
|
@@ -1338,6 +1347,8 @@ interface LlmResolvedModelInfo extends LlmModelInfo {
|
|
|
1338
1347
|
reasoning?: LlmModelReasoningInfo;
|
|
1339
1348
|
/** Declared mid-conversation system prompt handling; absent means only a leading system message is read. */
|
|
1340
1349
|
systemPromptUpdate?: SystemPromptUpdate;
|
|
1350
|
+
/** Declared mid-conversation tool declaration handling; absent means every request declares the complete tool list. */
|
|
1351
|
+
toolUpdate?: ToolUpdate;
|
|
1341
1352
|
}
|
|
1342
1353
|
/**
|
|
1343
1354
|
* Adapter-private lossless-JSON state for replaying a successful response,
|
|
@@ -1426,6 +1437,18 @@ interface RequestUserInput {
|
|
|
1426
1437
|
}
|
|
1427
1438
|
/** A durable conversation message or a user input used only for one request. */
|
|
1428
1439
|
type RequestMessage = Message | RequestUserInput;
|
|
1440
|
+
/** Logged tool declarations and update identities since the last declaration reset. */
|
|
1441
|
+
interface ToolHistory {
|
|
1442
|
+
/** Complete active declarations at the start of this history. */
|
|
1443
|
+
readonly tools: readonly ToolSchema[];
|
|
1444
|
+
/** Ordered developer messages, with additions resolved from their historical headers. */
|
|
1445
|
+
readonly updates: readonly {
|
|
1446
|
+
/** Identity used to locate this update in the derived request history. */
|
|
1447
|
+
readonly messageId: MessageId;
|
|
1448
|
+
/** Added definitions resolved from the event's referenced request header. */
|
|
1449
|
+
readonly additions: readonly ToolSchema[];
|
|
1450
|
+
}[];
|
|
1451
|
+
}
|
|
1429
1452
|
/** A single model request, fully assembled. */
|
|
1430
1453
|
interface GenerateOptions {
|
|
1431
1454
|
/** Registered provider route selecting the adapter instance. */
|
|
@@ -1447,6 +1470,8 @@ interface GenerateOptions {
|
|
|
1447
1470
|
system?: string;
|
|
1448
1471
|
/** Tool schemas (adapters map to the provider's `tools` field). */
|
|
1449
1472
|
tools?: ToolSchema[];
|
|
1473
|
+
/** Session-folded tool history used for route projection; omission sends complete declarations without tool updates. */
|
|
1474
|
+
toolHistory?: ToolHistory;
|
|
1450
1475
|
temperature?: number;
|
|
1451
1476
|
maxTokens?: number;
|
|
1452
1477
|
/**
|
|
@@ -1884,6 +1909,8 @@ interface PreparedLlmCall {
|
|
|
1884
1909
|
readonly inputModalities?: readonly ModelModality[];
|
|
1885
1910
|
/** Exact model system prompt update mode captured with the adapter dispatch generation. */
|
|
1886
1911
|
readonly systemPromptUpdate?: SystemPromptUpdate;
|
|
1912
|
+
/** Exact model tool update mode captured with the adapter dispatch generation. */
|
|
1913
|
+
readonly toolUpdate?: ToolUpdate;
|
|
1887
1914
|
/** Config fields materialized by the captured adapter rather than proposed by the caller. */
|
|
1888
1915
|
readonly adapterDefaults: LlmCallConfigAdapterDefaults;
|
|
1889
1916
|
/**
|
|
@@ -1933,8 +1960,9 @@ declare abstract class LlmAdapter {
|
|
|
1933
1960
|
imageRequestPricing(_provider: string, _model: string): LlmImageRequestPricing | undefined;
|
|
1934
1961
|
/**
|
|
1935
1962
|
* List models this adapter can currently advertise for one owned provider.
|
|
1936
|
-
*
|
|
1937
|
-
*
|
|
1963
|
+
* Core routing accepts unlisted model ids; catalog-driven entry points such
|
|
1964
|
+
* as the GUI may require membership. Adapters used there must advertise
|
|
1965
|
+
* their available models; the base empty catalog offers no GUI selection.
|
|
1938
1966
|
* @param _provider - one provider route owned by this adapter.
|
|
1939
1967
|
* @returns discoverable models in adapter-preferred order.
|
|
1940
1968
|
*/
|
|
@@ -2122,7 +2150,8 @@ declare class LlmRuntime extends TypertRemoteService {
|
|
|
2122
2150
|
private detachedModalities;
|
|
2123
2151
|
/**
|
|
2124
2152
|
* Discover models advertised by one registered provider. Catalog membership
|
|
2125
|
-
*
|
|
2153
|
+
* does not constrain core routing. Catalog-driven entry points may restrict
|
|
2154
|
+
* selection and submission to the advertised models.
|
|
2126
2155
|
* @param provider - registered provider route to inspect.
|
|
2127
2156
|
* @returns detached model metadata in adapter-preferred order.
|
|
2128
2157
|
*/
|
|
@@ -2436,9 +2465,9 @@ interface RequestContext {
|
|
|
2436
2465
|
* Why a `request/header` snapshot was appended: `'initial'` — the log's first
|
|
2437
2466
|
* header (a new conversation); `'resume'` — a loop instance's first request
|
|
2438
2467
|
* over a log that already has header events (process restart, fork seed);
|
|
2439
|
-
* `'change'` — a later request used a different header
|
|
2440
|
-
*
|
|
2441
|
-
*
|
|
2468
|
+
* `'change'` — a later request used a different header; `'series'` — an unchanged
|
|
2469
|
+
* header began an explicitly distinct message series or followed a surface
|
|
2470
|
+
* replacement. Other reasons carry `startsSeries` when a new series coincides.
|
|
2442
2471
|
*/
|
|
2443
2472
|
type RequestHeaderReason = 'initial' | 'resume' | 'change' | 'series';
|
|
2444
2473
|
/**
|
|
@@ -2588,7 +2617,7 @@ interface SessionEventMap {
|
|
|
2588
2617
|
'request/header': {
|
|
2589
2618
|
header: EpochHeader;
|
|
2590
2619
|
reason: RequestHeaderReason;
|
|
2591
|
-
/**
|
|
2620
|
+
/** This request begins a distinct model-message series, independently of the header reason. */
|
|
2592
2621
|
startsSeries?: true;
|
|
2593
2622
|
};
|
|
2594
2623
|
/**
|
|
@@ -2974,6 +3003,16 @@ declare class Session {
|
|
|
2974
3003
|
* @returns the latest immutable route metadata.
|
|
2975
3004
|
*/
|
|
2976
3005
|
requestContext(): RequestContext | undefined;
|
|
3006
|
+
/** Cached historical tool definitions and updates for request projection. */
|
|
3007
|
+
private readonly toolHistoryProjection;
|
|
3008
|
+
/** Index of the next committed event not yet consumed by the tool-history fold. */
|
|
3009
|
+
private toolHistorySeq;
|
|
3010
|
+
/**
|
|
3011
|
+
* Fold unseen committed events into capability-independent tool history.
|
|
3012
|
+
* Initial access reconstructs inherited history; later reads consume only new events.
|
|
3013
|
+
* @returns an immutable snapshot for LLM request projection, including historical addition definitions.
|
|
3014
|
+
*/
|
|
3015
|
+
toolHistory(): ToolHistory;
|
|
2977
3016
|
/** The derived-message cache: frozen projections, extended per unseen node. */
|
|
2978
3017
|
private derived;
|
|
2979
3018
|
/** Surface position (nodes projected) the cache has reached. */
|
package/dist/client.d.mts
CHANGED
|
@@ -1096,9 +1096,8 @@ interface ToolRemovalBlock {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
/**
|
|
1098
1098
|
* Merge-extensible content blocks keyed by `type`. New core blocks must land
|
|
1099
|
-
* with adapter, UI, and compaction support.
|
|
1100
|
-
*
|
|
1101
|
-
* their producers and consumers are implemented together.
|
|
1099
|
+
* with adapter, UI, and compaction support. Tool-change blocks belong to
|
|
1100
|
+
* developer messages; `projectToolUpdates` selects what each route receives.
|
|
1102
1101
|
*/
|
|
1103
1102
|
interface ContentBlockMap {
|
|
1104
1103
|
'text': TextBlock;
|
|
@@ -1328,6 +1327,16 @@ interface LlmModelReasoningInfo {
|
|
|
1328
1327
|
* can follow the cached history instead of rewriting message 0.
|
|
1329
1328
|
*/
|
|
1330
1329
|
type SystemPromptUpdate = 'in-history';
|
|
1330
|
+
/**
|
|
1331
|
+
* How a model accepts native tool declarations that change mid-conversation.
|
|
1332
|
+
* `'addition-only'`: the model reads a `tool-addition` block in a later
|
|
1333
|
+
* developer message as activating a tool declared with `deferLoading`, so an
|
|
1334
|
+
* added tool follows the cached history instead of rewriting the declaration
|
|
1335
|
+
* list. `'in-history'`: the model additionally reads `tool-removal` blocks,
|
|
1336
|
+
* so a removed tool keeps its declaration and the removal follows the history.
|
|
1337
|
+
* Absent means every request declares the complete current tool list.
|
|
1338
|
+
*/
|
|
1339
|
+
type ToolUpdate = 'in-history' | 'addition-only';
|
|
1331
1340
|
/** Exact-route model metadata resolved by its owning adapter. */
|
|
1332
1341
|
interface LlmResolvedModelInfo extends LlmModelInfo {
|
|
1333
1342
|
/** Provider-owned context capacity when known. */
|
|
@@ -1338,6 +1347,8 @@ interface LlmResolvedModelInfo extends LlmModelInfo {
|
|
|
1338
1347
|
reasoning?: LlmModelReasoningInfo;
|
|
1339
1348
|
/** Declared mid-conversation system prompt handling; absent means only a leading system message is read. */
|
|
1340
1349
|
systemPromptUpdate?: SystemPromptUpdate;
|
|
1350
|
+
/** Declared mid-conversation tool declaration handling; absent means every request declares the complete tool list. */
|
|
1351
|
+
toolUpdate?: ToolUpdate;
|
|
1341
1352
|
}
|
|
1342
1353
|
/**
|
|
1343
1354
|
* Adapter-private lossless-JSON state for replaying a successful response,
|
|
@@ -1426,6 +1437,18 @@ interface RequestUserInput {
|
|
|
1426
1437
|
}
|
|
1427
1438
|
/** A durable conversation message or a user input used only for one request. */
|
|
1428
1439
|
type RequestMessage = Message | RequestUserInput;
|
|
1440
|
+
/** Logged tool declarations and update identities since the last declaration reset. */
|
|
1441
|
+
interface ToolHistory {
|
|
1442
|
+
/** Complete active declarations at the start of this history. */
|
|
1443
|
+
readonly tools: readonly ToolSchema[];
|
|
1444
|
+
/** Ordered developer messages, with additions resolved from their historical headers. */
|
|
1445
|
+
readonly updates: readonly {
|
|
1446
|
+
/** Identity used to locate this update in the derived request history. */
|
|
1447
|
+
readonly messageId: MessageId;
|
|
1448
|
+
/** Added definitions resolved from the event's referenced request header. */
|
|
1449
|
+
readonly additions: readonly ToolSchema[];
|
|
1450
|
+
}[];
|
|
1451
|
+
}
|
|
1429
1452
|
/** A single model request, fully assembled. */
|
|
1430
1453
|
interface GenerateOptions {
|
|
1431
1454
|
/** Registered provider route selecting the adapter instance. */
|
|
@@ -1447,6 +1470,8 @@ interface GenerateOptions {
|
|
|
1447
1470
|
system?: string;
|
|
1448
1471
|
/** Tool schemas (adapters map to the provider's `tools` field). */
|
|
1449
1472
|
tools?: ToolSchema[];
|
|
1473
|
+
/** Session-folded tool history used for route projection; omission sends complete declarations without tool updates. */
|
|
1474
|
+
toolHistory?: ToolHistory;
|
|
1450
1475
|
temperature?: number;
|
|
1451
1476
|
maxTokens?: number;
|
|
1452
1477
|
/**
|
|
@@ -1884,6 +1909,8 @@ interface PreparedLlmCall {
|
|
|
1884
1909
|
readonly inputModalities?: readonly ModelModality[];
|
|
1885
1910
|
/** Exact model system prompt update mode captured with the adapter dispatch generation. */
|
|
1886
1911
|
readonly systemPromptUpdate?: SystemPromptUpdate;
|
|
1912
|
+
/** Exact model tool update mode captured with the adapter dispatch generation. */
|
|
1913
|
+
readonly toolUpdate?: ToolUpdate;
|
|
1887
1914
|
/** Config fields materialized by the captured adapter rather than proposed by the caller. */
|
|
1888
1915
|
readonly adapterDefaults: LlmCallConfigAdapterDefaults;
|
|
1889
1916
|
/**
|
|
@@ -1933,8 +1960,9 @@ declare abstract class LlmAdapter {
|
|
|
1933
1960
|
imageRequestPricing(_provider: string, _model: string): LlmImageRequestPricing | undefined;
|
|
1934
1961
|
/**
|
|
1935
1962
|
* List models this adapter can currently advertise for one owned provider.
|
|
1936
|
-
*
|
|
1937
|
-
*
|
|
1963
|
+
* Core routing accepts unlisted model ids; catalog-driven entry points such
|
|
1964
|
+
* as the GUI may require membership. Adapters used there must advertise
|
|
1965
|
+
* their available models; the base empty catalog offers no GUI selection.
|
|
1938
1966
|
* @param _provider - one provider route owned by this adapter.
|
|
1939
1967
|
* @returns discoverable models in adapter-preferred order.
|
|
1940
1968
|
*/
|
|
@@ -2122,7 +2150,8 @@ declare class LlmRuntime extends TypertRemoteService {
|
|
|
2122
2150
|
private detachedModalities;
|
|
2123
2151
|
/**
|
|
2124
2152
|
* Discover models advertised by one registered provider. Catalog membership
|
|
2125
|
-
*
|
|
2153
|
+
* does not constrain core routing. Catalog-driven entry points may restrict
|
|
2154
|
+
* selection and submission to the advertised models.
|
|
2126
2155
|
* @param provider - registered provider route to inspect.
|
|
2127
2156
|
* @returns detached model metadata in adapter-preferred order.
|
|
2128
2157
|
*/
|
|
@@ -2436,9 +2465,9 @@ interface RequestContext {
|
|
|
2436
2465
|
* Why a `request/header` snapshot was appended: `'initial'` — the log's first
|
|
2437
2466
|
* header (a new conversation); `'resume'` — a loop instance's first request
|
|
2438
2467
|
* over a log that already has header events (process restart, fork seed);
|
|
2439
|
-
* `'change'` — a later request used a different header
|
|
2440
|
-
*
|
|
2441
|
-
*
|
|
2468
|
+
* `'change'` — a later request used a different header; `'series'` — an unchanged
|
|
2469
|
+
* header began an explicitly distinct message series or followed a surface
|
|
2470
|
+
* replacement. Other reasons carry `startsSeries` when a new series coincides.
|
|
2442
2471
|
*/
|
|
2443
2472
|
type RequestHeaderReason = 'initial' | 'resume' | 'change' | 'series';
|
|
2444
2473
|
/**
|
|
@@ -2588,7 +2617,7 @@ interface SessionEventMap {
|
|
|
2588
2617
|
'request/header': {
|
|
2589
2618
|
header: EpochHeader;
|
|
2590
2619
|
reason: RequestHeaderReason;
|
|
2591
|
-
/**
|
|
2620
|
+
/** This request begins a distinct model-message series, independently of the header reason. */
|
|
2592
2621
|
startsSeries?: true;
|
|
2593
2622
|
};
|
|
2594
2623
|
/**
|
|
@@ -2974,6 +3003,16 @@ declare class Session {
|
|
|
2974
3003
|
* @returns the latest immutable route metadata.
|
|
2975
3004
|
*/
|
|
2976
3005
|
requestContext(): RequestContext | undefined;
|
|
3006
|
+
/** Cached historical tool definitions and updates for request projection. */
|
|
3007
|
+
private readonly toolHistoryProjection;
|
|
3008
|
+
/** Index of the next committed event not yet consumed by the tool-history fold. */
|
|
3009
|
+
private toolHistorySeq;
|
|
3010
|
+
/**
|
|
3011
|
+
* Fold unseen committed events into capability-independent tool history.
|
|
3012
|
+
* Initial access reconstructs inherited history; later reads consume only new events.
|
|
3013
|
+
* @returns an immutable snapshot for LLM request projection, including historical addition definitions.
|
|
3014
|
+
*/
|
|
3015
|
+
toolHistory(): ToolHistory;
|
|
2977
3016
|
/** The derived-message cache: frozen projections, extended per unseen node. */
|
|
2978
3017
|
private derived;
|
|
2979
3018
|
/** Surface position (nodes projected) the cache has reached. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/ui-conversation-manager",
|
|
3
|
-
"version": "0.0.2
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "「对话管理」全局面板页(浏览器半):会话(含已归档)的搜索、取消归档、删除,以及导入为新会话。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"archived-sessions",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"react-dom": "^18.2.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@deepseek-ai/cordis": "4.0.4",
|
|
43
|
-
"@deepseek-ai/dsh-api-session-controller": "0.1.7-rc.
|
|
44
|
-
"@deepseek-ai/dsh-client-locale": "0.1.7-rc.
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-layout": "0.1.7-rc.
|
|
46
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.
|
|
47
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.1.7-rc.
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-session": "0.1.7-rc.
|
|
49
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "0.1.7-rc.
|
|
50
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-workspace": "0.1.7-rc.
|
|
52
|
-
"@deepseek-ai/dsh-session": "0.1.7-rc.
|
|
53
|
-
"@morlay/dsh-client-ui-primitives": "0.0.2
|
|
42
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
43
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.7-rc.2",
|
|
44
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.7-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.1.7-rc.2",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-session": "^0.1.7-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.7-rc.2",
|
|
50
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.7-rc.2",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-workspace": "^0.1.7-rc.2",
|
|
52
|
+
"@deepseek-ai/dsh-session": "^0.1.7-rc.2",
|
|
53
|
+
"@morlay/dsh-client-ui-primitives": "0.0.2"
|
|
54
54
|
},
|
|
55
55
|
"dsh": {
|
|
56
56
|
"client": {
|