@morlay/dsh-session 0.0.0-stage → 0.2.0-alpha.0
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/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/contract-DcuROwBE.mjs +263 -0
- package/dist/contract.d.mts +3 -0
- package/dist/contract.mjs +3 -0
- package/dist/decorate-g56z_1VW.mjs +8 -0
- package/dist/endpoint.d.mts +261 -0
- package/dist/endpoint.mjs +256 -0
- package/dist/index-CslqzhJh.d.mts +87 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +5 -0
- package/dist/rolldown-runtime-3qf6kE1h.d.mts +1 -0
- package/dist/server.d.mts +23 -0
- package/dist/server.mjs +35 -0
- package/dist/testing.d.mts +213 -0
- package/dist/testing.mjs +840 -0
- package/dist/token-meter.contract-BoF6536N.d.mts +136 -0
- package/dist/token-meter.contract-CVJ4qB0S.mjs +20 -0
- package/dist/token-meter.service-B_UwV7QS.d.mts +45 -0
- package/dist/token-meter.service-DVClfYcN.mjs +83 -0
- package/dist/ui.d.mts +50 -0
- package/dist/ui.mjs +77 -0
- package/package.json +65 -3
- package/src/contract/events.ts +62 -0
- package/src/contract/index.ts +14 -0
- package/src/contract/session-format.contract.ts +18 -0
- package/src/contract/session-log.contract.ts +10 -0
- package/src/contract/session-projection-cache.contract.ts +33 -0
- package/src/contract/session-projection-store.contract.ts +47 -0
- package/src/contract/session-projection-value.contract.ts +10 -0
- package/src/contract/session-query-tracing.contract.ts +8 -0
- package/src/contract/session-query.contract.ts +140 -0
- package/src/contract/session-surface.contract.ts +5 -0
- package/src/contract/session-workspace.contract.ts +64 -0
- package/src/contract/session.contract.ts +72 -0
- package/src/contract/token-meter.contract.ts +22 -0
- package/src/endpoint/index.ts +9 -0
- package/src/endpoint/session-controller.remote.ts +13 -0
- package/src/endpoint/session-controller.ts +120 -0
- package/src/endpoint/session-endpoint.ts +443 -0
- package/src/endpoint/session-id.ts +8 -0
- package/src/index.ts +15 -0
- package/src/server/index.ts +19 -0
- package/src/server/session-projection-cache.provide.ts +5 -0
- package/src/server/session-projection.provide.ts +10 -0
- package/src/server/session-projection.registry.ts +4 -0
- package/src/server/session-query.provide.ts +5 -0
- package/src/server/session-stats.service.ts +18 -0
- package/src/server/session-store.plugin.ts +4 -0
- package/src/server/session.provide.ts +5 -0
- package/src/server/sessions-host.provide.ts +6 -0
- package/src/server/token-meter.provide.ts +5 -0
- package/src/session-projection-cache.service.ts +41 -0
- package/src/session-projection-store.service.ts +15 -0
- package/src/session-query.service.ts +37 -0
- package/src/session-turn-outline.service.ts +2 -0
- package/src/session.service.ts +12 -0
- package/src/testing/context.ts +35 -0
- package/src/testing/coordinator-contract.ts +496 -0
- package/src/testing/index.ts +25 -0
- package/src/testing/log.ts +385 -0
- package/src/token-meter.service.ts +14 -0
- package/src/ui/index.ts +4 -0
- package/src/ui/session-endpoint.client.ts +125 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 morlay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @morlay/dsh-session
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
会话的**数据面**:存储、投影、查询、token 计量的契约与默认实现,外加 `session/*` 的两端契约与测试支撑。
|
|
4
|
+
本包没有 `./ui` 面:会话界面不属本包。
|
|
5
|
+
|
|
6
|
+
## 用法
|
|
7
|
+
|
|
8
|
+
- 契约(`@Injectable() abstract class`):`SessionStore` / `SessionProjectionStore` /
|
|
9
|
+
`SessionQuery` / `SessionProjectionCache` / `TokenMeter`;实现在同目录的 `*Default`。
|
|
10
|
+
持久化的契约与实现**不在本包**:用 `@morlay/dsh-session-persistence`。
|
|
11
|
+
- 装配(宿主半,`./server`):`provideSession` / `provideSessionProjection` /
|
|
12
|
+
`provideSessionProjectionCache` / `provideSessionQuerySqlite` / `provideTokenMeter` /
|
|
13
|
+
`provideSessionsHost`。
|
|
14
|
+
- 两端契约(`./endpoint`):`SessionId` 等身份与 `session/*` 的 wire 形状。
|
|
15
|
+
- 测试支撑(`./testing`):造日志的 fixtures、`runCoordinatorContract`、`createSessionContext`。
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
bootstrapApplication({ providers: [...provideSession(), ...provideSessionProjection()] });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 边界
|
|
22
|
+
|
|
23
|
+
- **没有 `./ui` 面**:数据面不持有任何浏览器半的实现。
|
|
24
|
+
|
|
25
|
+
## 设计
|
|
26
|
+
|
|
27
|
+
包内子域怎么分、契约与行各放哪,见[包内子域拆分与注册抽象](../.agents/designs/20261028-包内子域拆分与注册抽象.md);
|
|
28
|
+
接口口径见 [`@morlay/zephyr` 的装配规范](../../zephyr/zephyr/.agents/standards/how-to-write.md)。
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { parseSessionFormatLogFilename, sessionFormatLogFilename } from "@deepseek-ai/dsh-session-format";
|
|
2
|
+
import { createSessionFormatCatalogWithChildren, sessionFormatCatalog } from "@deepseek-ai/dsh-session-format-catalog";
|
|
3
|
+
import { foldSurface as foldSurface$1, interruptedTurnClosers, isSurfaceEvent, snapshotSessionEvent, snapshotSessionEvent as snapshotSessionEvent$1 } from "@deepseek-ai/dsh-session";
|
|
4
|
+
import { foldSurface } from "@deepseek-ai/dsh-session/surface";
|
|
5
|
+
import "./token-meter.contract-CVJ4qB0S.mjs";
|
|
6
|
+
import { currentSessionMessageProjections } from "@deepseek-ai/dsh-session-format-catalog/message-projections";
|
|
7
|
+
import { HarnessError } from "@deepseek-ai/dsh-llm";
|
|
8
|
+
import { EventEmitter, Injectable } from "@morlay/zephyr";
|
|
9
|
+
import { t as __decorate } from "./decorate-g56z_1VW.mjs";
|
|
10
|
+
// \0rolldown/runtime.js
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __exportAll = (all, flags) => {
|
|
13
|
+
let target = Object.setPrototypeOf({}, null);
|
|
14
|
+
for (var name in all) __defProp(target, name, {
|
|
15
|
+
get: all[name],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
20
|
+
};
|
|
21
|
+
// ../../../vendor/deepseek-harness/packages/session-query/session-query/src/config.ts
|
|
22
|
+
/** Public configuration and typed failures for the combined session-query service. */
|
|
23
|
+
/** Typed session-query failure whose `code` is one closed taxonomy member. */
|
|
24
|
+
var SessionQueryError = class extends HarnessError {
|
|
25
|
+
constructor(message, code, options) {
|
|
26
|
+
super(message, code, options);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
// ../../../vendor/deepseek-harness/packages/session-query/session-query/src/tracing.ts
|
|
30
|
+
/** One-shot session-lineage and event-relationship tracing helpers. */
|
|
31
|
+
/**
|
|
32
|
+
* Fold and return the current model surface after validating the whole log.
|
|
33
|
+
* @param sessionId - owner used in query diagnostics.
|
|
34
|
+
* @param events - detached raw event log from one corpus observation.
|
|
35
|
+
* @returns detached current surface events in folded order.
|
|
36
|
+
*/
|
|
37
|
+
function currentSurfaceEvents(sessionId, events) {
|
|
38
|
+
return analyzeEventLog(sessionId, events).currentSeqs.map((seq) => {
|
|
39
|
+
const event = events[seq];
|
|
40
|
+
/* v8 ignore next 6 -- analyzeEventLog validated contiguous seqs and foldSurface returned only surface-event seqs. */
|
|
41
|
+
if (event === void 0 || event.seq !== seq || !isSurfaceEvent(event)) throw new SessionQueryError(`invalid session surface: current node ${seq} is not a surface event`, "SESSION_QUERY_INVALID_SURFACE");
|
|
42
|
+
return snapshotSessionEvent$1(event);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Trace one target after one canonical surface fold and whole-log validation.
|
|
47
|
+
* @param sessionId - owner of the event log.
|
|
48
|
+
* @param events - detached raw event log.
|
|
49
|
+
* @param seq - target event seq.
|
|
50
|
+
* @returns direct surface replacements and relationships to cited source events.
|
|
51
|
+
*/
|
|
52
|
+
function traceEvent(sessionId, events, seq) {
|
|
53
|
+
const target = events[seq];
|
|
54
|
+
if (target === void 0 || target.seq !== seq) throw new SessionQueryError(`session "${sessionId}" has no event at seq ${seq}`, "SESSION_QUERY_EVENT_NOT_FOUND");
|
|
55
|
+
const analysis = analyzeEventLog(sessionId, events);
|
|
56
|
+
const replacementChain = [];
|
|
57
|
+
let replacement = analysis.replacedBy.get(seq);
|
|
58
|
+
while (replacement !== void 0) {
|
|
59
|
+
replacementChain.push(replacement);
|
|
60
|
+
replacement = analysis.replacedBy.get(replacement);
|
|
61
|
+
}
|
|
62
|
+
const derivedEventSeqs = [];
|
|
63
|
+
for (const event of events) {
|
|
64
|
+
if (event.seq <= seq) continue;
|
|
65
|
+
if (eventSources(event).includes(seq)) derivedEventSeqs.push(event.seq);
|
|
66
|
+
}
|
|
67
|
+
const targetRecord = analysis.records[seq];
|
|
68
|
+
const replacedBy = analysis.replacedBy.get(seq);
|
|
69
|
+
return {
|
|
70
|
+
target: targetRecord,
|
|
71
|
+
...replacedBy === void 0 ? {} : { replacedBy },
|
|
72
|
+
replacementChain,
|
|
73
|
+
replacedEventSeqs: analysis.replacedEventSeqs.get(seq) ?? [],
|
|
74
|
+
sourceEventSeqs: [...eventSources(target)],
|
|
75
|
+
derivedEventSeqs
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Trace one target's known ancestry and recursively known descendants.
|
|
80
|
+
* @param records - complete logical corpus from one observation.
|
|
81
|
+
* @param sessionId - target session id.
|
|
82
|
+
* @returns complete or explicitly partial lineage.
|
|
83
|
+
*/
|
|
84
|
+
function traceSession(records, sessionId) {
|
|
85
|
+
const byId = new Map(records.map((record) => [record.header.id, record]));
|
|
86
|
+
const target = byId.get(sessionId);
|
|
87
|
+
if (target === void 0) throw new SessionQueryError(`session "${sessionId}" not found`, "SESSION_QUERY_SESSION_NOT_FOUND");
|
|
88
|
+
const ancestors = [];
|
|
89
|
+
const ancestrySeen = /* @__PURE__ */ new Set([sessionId]);
|
|
90
|
+
let unresolvedParentId;
|
|
91
|
+
let parentId = target.header.parentSession;
|
|
92
|
+
while (parentId !== void 0) {
|
|
93
|
+
if (ancestrySeen.has(parentId)) throw new SessionQueryError(`session lineage contains a cycle at "${parentId}"`, "SESSION_QUERY_INVALID_LINEAGE");
|
|
94
|
+
ancestrySeen.add(parentId);
|
|
95
|
+
const parent = byId.get(parentId);
|
|
96
|
+
if (parent === void 0) {
|
|
97
|
+
unresolvedParentId = parentId;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
ancestors.push(parent);
|
|
101
|
+
parentId = parent.header.parentSession;
|
|
102
|
+
}
|
|
103
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
104
|
+
for (const record of records) {
|
|
105
|
+
const parent = record.header.parentSession;
|
|
106
|
+
if (parent === void 0) continue;
|
|
107
|
+
const children = childrenByParent.get(parent) ?? [];
|
|
108
|
+
children.push(record);
|
|
109
|
+
childrenByParent.set(parent, children);
|
|
110
|
+
}
|
|
111
|
+
for (const children of childrenByParent.values()) children.sort((a, b) => a.header.createdAt - b.header.createdAt || a.header.id.localeCompare(b.header.id));
|
|
112
|
+
const descendants = buildDescendants(childrenByParent, sessionId);
|
|
113
|
+
const common = {
|
|
114
|
+
target: cloneRecord(target),
|
|
115
|
+
ancestors: ancestors.map(cloneRecord),
|
|
116
|
+
descendants
|
|
117
|
+
};
|
|
118
|
+
if (unresolvedParentId !== void 0) return {
|
|
119
|
+
...common,
|
|
120
|
+
complete: false,
|
|
121
|
+
unresolvedParentId
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
...common,
|
|
125
|
+
complete: true,
|
|
126
|
+
root: cloneRecord(ancestors.at(-1) ?? target)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function analyzeEventLog(sessionId, events) {
|
|
130
|
+
let folded;
|
|
131
|
+
try {
|
|
132
|
+
folded = foldSurface$1(events, currentSessionMessageProjections);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
throw new SessionQueryError(
|
|
135
|
+
/* v8 ignore next -- foldSurface throws Error instances */
|
|
136
|
+
`invalid session surface: ${error instanceof Error ? error.message : "unknown error"}`,
|
|
137
|
+
"SESSION_QUERY_INVALID_SURFACE",
|
|
138
|
+
{ cause: error }
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
const current = new Set(folded.nodes);
|
|
142
|
+
const replacedBy = /* @__PURE__ */ new Map();
|
|
143
|
+
const replacedEventSeqs = /* @__PURE__ */ new Map();
|
|
144
|
+
for (const replacement of folded.replacements) {
|
|
145
|
+
const removed = replacement.shadowedSeqs;
|
|
146
|
+
replacedEventSeqs.set(replacement.seq, removed);
|
|
147
|
+
for (const removedSeq of removed) replacedBy.set(removedSeq, replacement.seq);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
records: events.map((event) => ({
|
|
151
|
+
sessionId,
|
|
152
|
+
seq: event.seq,
|
|
153
|
+
type: event.type,
|
|
154
|
+
time: event.time,
|
|
155
|
+
surface: current.has(event.seq) ? "current" : replacedBy.has(event.seq) ? "shadowed" : "log-only"
|
|
156
|
+
})),
|
|
157
|
+
replacedBy,
|
|
158
|
+
replacedEventSeqs,
|
|
159
|
+
currentSeqs: [...folded.nodes]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function eventSources(event) {
|
|
163
|
+
return event.sourceEventSeqs ?? [];
|
|
164
|
+
}
|
|
165
|
+
function buildDescendants(childrenByParent, sessionId) {
|
|
166
|
+
const descendants = [];
|
|
167
|
+
const stack = [{
|
|
168
|
+
sessionId,
|
|
169
|
+
descendants
|
|
170
|
+
}];
|
|
171
|
+
while (stack.length > 0) {
|
|
172
|
+
const frame = stack.pop();
|
|
173
|
+
const nodes = [];
|
|
174
|
+
for (const child of childrenByParent.get(frame.sessionId) ?? []) {
|
|
175
|
+
const node = {
|
|
176
|
+
session: cloneRecord(child),
|
|
177
|
+
descendants: []
|
|
178
|
+
};
|
|
179
|
+
nodes.push(node);
|
|
180
|
+
frame.descendants.push(node);
|
|
181
|
+
}
|
|
182
|
+
for (let index = nodes.length - 1; index >= 0; index -= 1) {
|
|
183
|
+
const node = nodes[index];
|
|
184
|
+
stack.push({
|
|
185
|
+
sessionId: node.session.header.id,
|
|
186
|
+
descendants: node.descendants
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return descendants;
|
|
191
|
+
}
|
|
192
|
+
function cloneRecord(record) {
|
|
193
|
+
return {
|
|
194
|
+
...record,
|
|
195
|
+
header: structuredClone(record.header)
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
// src/contract/session-workspace.contract.ts
|
|
199
|
+
/**
|
|
200
|
+
* 目标工作区不在注册表里:`resolve` 的**可判定失败**。
|
|
201
|
+
*
|
|
202
|
+
* 为什么要一个类:「这个工作区不存在」与「解析本身失败」不能混成一条——建会话的调用方要能
|
|
203
|
+
* 按 `instanceof` 分开处理(前者是用户可选的输入问题,后者是装配问题),不解析文案。
|
|
204
|
+
*/
|
|
205
|
+
var SessionWorkspaceNotFoundError = class extends Error {
|
|
206
|
+
constructor(message) {
|
|
207
|
+
super(message);
|
|
208
|
+
this.name = "SessionWorkspaceNotFoundError";
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
let SessionWorkspace = class SessionWorkspace {};
|
|
212
|
+
SessionWorkspace = __decorate([Injectable()], SessionWorkspace);
|
|
213
|
+
// src/contract/events.ts
|
|
214
|
+
var events_exports = /* @__PURE__ */ __exportAll({
|
|
215
|
+
SessionCreated: () => SessionCreated,
|
|
216
|
+
SessionDisposed: () => SessionDisposed,
|
|
217
|
+
SessionEventAppended: () => SessionEventAppended,
|
|
218
|
+
SessionFlush: () => SessionFlush,
|
|
219
|
+
withEventType: () => withEventType
|
|
220
|
+
});
|
|
221
|
+
/**
|
|
222
|
+
* 把一条事件的 `type` 与 `data` **成对**换掉。
|
|
223
|
+
*
|
|
224
|
+
* 「`event.type` 与 `event.data` 相配」这件事在联合类型上表达不出来(展开一条联合事件时 `type` 各支冲突,
|
|
225
|
+
* TS 连可比性都不给),所以配对由**调用方**在签名里给出:`T` 与 `SessionEventMap[T]` 一起传。断言只在本
|
|
226
|
+
* 函数内发生一次,比在每个改写点各写一条 `as unknown as` 收口;读路径与编辑编排共用这一处。
|
|
227
|
+
* @param event - 原事件(`seq` / `time` / 信封字段都保留)。
|
|
228
|
+
* @param type - 新类型。
|
|
229
|
+
* @param data - 新类型对应的数据。
|
|
230
|
+
* @returns 换过 type/data 的事件。
|
|
231
|
+
*/
|
|
232
|
+
function withEventType(event, type, data) {
|
|
233
|
+
return {
|
|
234
|
+
...event,
|
|
235
|
+
type,
|
|
236
|
+
data
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** 一个会话进了 store(`announce` 之后派发;监听者抛错会回滚这次挂载)。 */
|
|
240
|
+
var SessionCreated = class extends EventEmitter {
|
|
241
|
+
constructor() {
|
|
242
|
+
super("session/created");
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
/** 会话日志追加了一条事件(`emit`,不等待)。 */
|
|
246
|
+
var SessionEventAppended = class extends EventEmitter {
|
|
247
|
+
constructor() {
|
|
248
|
+
super("session/event");
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
/** 并行耐久检查点:每个监听者都跑、调用方等全部结束,没有瀑布否决。 */
|
|
252
|
+
var SessionFlush = class extends EventEmitter {
|
|
253
|
+
constructor() {
|
|
254
|
+
super("session/flush");
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
/** 会话从 store 上摘下来了(之后的读写都指向已关闭的实例)。 */
|
|
258
|
+
var SessionDisposed = class extends EventEmitter {
|
|
259
|
+
constructor() {
|
|
260
|
+
super("session/disposed");
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
export { currentSurfaceEvents as a, foldSurface as c, createSessionFormatCatalogWithChildren as d, parseSessionFormatLogFilename as f, SessionWorkspaceNotFoundError as i, interruptedTurnClosers as l, sessionFormatLogFilename as m, withEventType as n, traceEvent as o, sessionFormatCatalog as p, SessionWorkspace as r, traceSession as s, events_exports as t, snapshotSessionEvent as u };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { C as parseSessionFormatLogFilename, S as createSessionFormatCatalogWithChildren, T as sessionFormatLogFilename, _ as interruptedTurnClosers, a as SessionWorkspaceTarget, b as SessionFormatEvent, c as traceSession, d as ProjectionKeySelection, f as ProjectionSnapshot, g as SurfaceEventType, h as foldSurface, i as SessionWorkspaceNotFoundError, l as ProjectionCheckpoint, m as SurfaceEvent, n as withEventType, o as currentSurfaceEvents, p as SessionProjectionMap, r as SessionWorkspace, s as traceEvent, u as ProjectionCheckpointRow, v as snapshotSessionEvent, w as sessionFormatCatalog, x as SessionFormatHeader, y as SessionFormatCatalog } from "./index-CslqzhJh.mjs";
|
|
2
|
+
import { $ as SessionProjectionCacheCovered, A as SessionQuery, B as SessionTitleObservation, C as SessionEventTraceObservation, D as SessionLogSnapshot, E as SessionListMetadata, F as SessionResultFilter, G as filterSessionEventDocuments, H as buildSessionEventRecords, I as SessionResultRange, J as ProjectionHandle, K as materializeSessionEventResultFilters, L as SessionSearchHit, M as SessionQueryEngine, N as SessionQueryError, O as SessionObservation, P as SessionRecord, Q as SessionProjectionCache, R as SessionSearchPage, S as SessionEventSearchPage, T as SessionLineageTrace, U as buildSessionEventSearchDocuments, V as SessionTitleObservationResult, W as extractSessionEventText, X as SessionProjectionStoreCovered, Y as SessionProjectionStore, Z as CheckpointIdentity, _ as SESSION_QUERY_READ_WINDOW_MAX, a as Session, b as SessionEventResultFilter, c as SessionEventType, d as SessionLogOffset, f as SessionSeq, g as SurfaceOp, h as SessionStoreCovered, i as SESSION_FORMAT_VERSION, j as SessionQueryCovered, k as SessionObservationOptions, l as SessionHeader, m as SessionStore, n as TokenMeterCovered, o as SessionEvent, p as SessionSeqCursor, q as materializeSessionResultFilters, r as AgentCancelCause, s as SessionEventMap, t as TokenMeter, u as SessionId, v as SessionEventReadRequest, w as SessionEventWindow, x as SessionEventSearchDocument, y as SessionEventRecord, z as SessionSurfaceSnapshot } from "./token-meter.contract-BoF6536N.mjs";
|
|
3
|
+
export { type AgentCancelCause, type CheckpointIdentity, type ProjectionCheckpoint, type ProjectionCheckpointRow, type ProjectionHandle, type ProjectionKeySelection, type ProjectionSnapshot, SESSION_FORMAT_VERSION, SESSION_QUERY_READ_WINDOW_MAX, Session, type SessionEvent, type SessionEventMap, type SessionEventReadRequest, type SessionEventRecord, type SessionEventResultFilter, type SessionEventSearchDocument, type SessionEventSearchPage, type SessionEventTraceObservation, type SessionEventType, type SessionEventWindow, type SessionFormatCatalog, type SessionFormatEvent, type SessionFormatHeader, type SessionHeader, SessionId, type SessionLineageTrace, type SessionListMetadata, SessionLogOffset, type SessionLogSnapshot, type SessionObservation, type SessionObservationOptions, SessionProjectionCache, SessionProjectionCacheCovered, type SessionProjectionMap, SessionProjectionStore, SessionProjectionStoreCovered, SessionQuery, SessionQueryCovered, type SessionQueryEngine, SessionQueryError, type SessionRecord, type SessionResultFilter, type SessionResultRange, type SessionSearchHit, type SessionSearchPage, SessionSeq, type SessionSeqCursor, SessionStore, SessionStoreCovered, type SessionSurfaceSnapshot, type SessionTitleObservation, type SessionTitleObservationResult, SessionWorkspace, SessionWorkspaceNotFoundError, SessionWorkspaceTarget, type SurfaceEvent, type SurfaceEventType, type SurfaceOp, TokenMeter, TokenMeterCovered, buildSessionEventRecords, buildSessionEventSearchDocuments, createSessionFormatCatalogWithChildren, currentSurfaceEvents, extractSessionEventText, filterSessionEventDocuments, foldSurface, interruptedTurnClosers, materializeSessionEventResultFilters, materializeSessionResultFilters, parseSessionFormatLogFilename, sessionFormatCatalog, sessionFormatLogFilename, snapshotSessionEvent, traceEvent, traceSession, withEventType };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as currentSurfaceEvents, c as foldSurface, d as createSessionFormatCatalogWithChildren, f as parseSessionFormatLogFilename, i as SessionWorkspaceNotFoundError, l as interruptedTurnClosers, m as sessionFormatLogFilename, n as withEventType, o as traceEvent, p as sessionFormatCatalog, r as SessionWorkspace, s as traceSession, u as snapshotSessionEvent } from "./contract-DcuROwBE.mjs";
|
|
2
|
+
import { _ as materializeSessionResultFilters, a as SessionLogOffset, c as SESSION_QUERY_READ_WINDOW_MAX, d as SessionQueryError, f as buildSessionEventRecords, g as materializeSessionEventResultFilters, h as filterSessionEventDocuments, i as SessionId, l as SessionQuery, m as extractSessionEventText, n as SESSION_FORMAT_VERSION, o as SessionSeq, p as buildSessionEventSearchDocuments, r as Session, s as SessionStore, t as TokenMeter, u as SessionQueryEngine, v as SessionProjectionStore, y as SessionProjectionCache } from "./token-meter.contract-CVJ4qB0S.mjs";
|
|
3
|
+
export { SESSION_FORMAT_VERSION, SESSION_QUERY_READ_WINDOW_MAX, Session, SessionId, SessionLogOffset, SessionProjectionCache, SessionProjectionStore, SessionQuery, SessionQueryEngine, SessionQueryError, SessionSeq, SessionStore, SessionWorkspace, SessionWorkspaceNotFoundError, TokenMeter, buildSessionEventRecords, buildSessionEventSearchDocuments, createSessionFormatCatalogWithChildren, currentSurfaceEvents, extractSessionEventText, filterSessionEventDocuments, foldSurface, interruptedTurnClosers, materializeSessionEventResultFilters, materializeSessionResultFilters, parseSessionFormatLogFilename, sessionFormatCatalog, sessionFormatLogFilename, snapshotSessionEvent, traceEvent, traceSession, withEventType };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// \0@oxc-project+runtime@0.160.0/helpers/esm/decorate.js
|
|
2
|
+
function __decorate(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
}
|
|
8
|
+
export { __decorate as t };
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { ISessions } from "@deepseek-ai/dsh-api-session-controller/client";
|
|
2
|
+
import { TYPERT_REMOTE as SESSION_CONTROLLER_REMOTE } from "@deepseek-ai/dsh-api-session-controller/remote";
|
|
3
|
+
import { ModelCatalog, ModelSelection, PromptContentPart, QueueAction, SessionAttachmentRequest, SessionAttachmentValue, SessionCancelRequest, SessionCancelValue, SessionControlFrame, SessionCreateRequest, SessionCreateValue, SessionEventFrame, SessionEventsPage, SessionFollowFrame, SessionFollowRequest, SessionForkRequest, SessionForkValue, SessionListRequest, SessionListValue, SessionObserveEventRequest, SessionOpenWorkspacePathRequest, SessionOpenWorkspacePathValue, SessionPageRequest, SessionProjectionFrame, SessionProjectionsRequest, SessionProjectionsValue, SessionPromptRequest, SessionPromptValue, SessionRenameRequest, SessionRenameValue, SessionSearchRequest, SessionSearchValue, SessionSelectModelRequest, SessionSelectModelValue, SessionState, SessionStateRequest, SessionSummary, SessionUpdateQueueRequest, SessionUpdateQueueValue, SessionWaitRequest, SessionWaitValue, SessionWorkspacePathApplication } from "@deepseek-ai/dsh-api-session-controller/types";
|
|
4
|
+
import { AssertTrue, AssertWireFace } from "@morlay/zephyr-app/client";
|
|
5
|
+
import { AsyncReturn, DropParam } from "@morlay/zephyr-app/typert";
|
|
6
|
+
import SessionControllerHost from "@deepseek-ai/dsh-api-session-controller";
|
|
7
|
+
import { SessionEvent, SessionHeader, SessionId } from "@deepseek-ai/dsh-session/types";
|
|
8
|
+
/**
|
|
9
|
+
* 会话作用域:上游 `AgentContext`(= `ISessions["scope"]` 的返回)。
|
|
10
|
+
*
|
|
11
|
+
* 这里曾经声明成"本装配实供的成员子集"——那是**谎报**:`scope(id)` 交出去的就是上游那个对象
|
|
12
|
+
* (不复制、不包装,否则 `sessionOf` 靠 ctx 上的标签反查会断链)。收窄只会让读 `ctx.sessions.scope(id)`
|
|
13
|
+
* 的消费方看不见成员,所以形状以上游为准。
|
|
14
|
+
*/
|
|
15
|
+
export type SessionScope = NonNullable<ReturnType<ISessions["scope"]>>;
|
|
16
|
+
/**
|
|
17
|
+
* 会话视图:上游 `SessionFace`(= `ISessions["sessionOf"]` 的返回)。
|
|
18
|
+
*
|
|
19
|
+
* 同 {@link SessionScope}:交出去的就是上游那个对象,收窄是谎报。
|
|
20
|
+
*/
|
|
21
|
+
export type SessionView = NonNullable<ReturnType<ISessions["sessionOf"]>>;
|
|
22
|
+
/**
|
|
23
|
+
* 会话目录快照:上游 `SessionListState`(= `ISessions["list"]` 的快照类型)。
|
|
24
|
+
*
|
|
25
|
+
* 这里曾经手抄成 `{ ids, byId, phase: 'loading'|'ready'|'failed' }`(行是 `unknown`)——上游实际是
|
|
26
|
+
* `{ ids: SessionId[], byId: Record<SessionId, SessionSummary>, phase: 'pending'|'ready', projectionsBySession }`。
|
|
27
|
+
* 键齐、形状不同,正是"覆盖守卫只核键"时看不见的那类错。
|
|
28
|
+
*/
|
|
29
|
+
export type SessionCatalogState = ReturnType<ISessions["list"]["getSnapshot"]>;
|
|
30
|
+
/**
|
|
31
|
+
* 会话目录的只读 observable:上游 `ObservableSnapshot<SessionListState>`。
|
|
32
|
+
*
|
|
33
|
+
* 本装配**原样**交出上游那份快照(`ClientSessions.list`),不重映射相位、不重打字行。
|
|
34
|
+
*/
|
|
35
|
+
export type SessionCatalog = ISessions["list"];
|
|
36
|
+
/**
|
|
37
|
+
* 保留句柄:上游 `SessionReference`(= `ISessions["retain"]` 的返回)。
|
|
38
|
+
*
|
|
39
|
+
* 交出去的就是上游那个对象:`release()` 幂等,`binding` 是惰性 getter(释放后抛)。曾经另造过一个
|
|
40
|
+
* `{ release, dispose, binding: unknown }` 的包装——包装让上游的 `using` 语义(`[Symbol.dispose]`)落空,
|
|
41
|
+
* 也把 `binding` 的类型抹成 `unknown`。
|
|
42
|
+
*/
|
|
43
|
+
export type SessionRetainHandle = ReturnType<ISessions["retain"]>;
|
|
44
|
+
export declare abstract class SessionController implements ISessions {
|
|
45
|
+
abstract readonly list: ISessions["list"];
|
|
46
|
+
/** 建一个新会话(`ui-workspace` 的「在某工作区新建会话」走它)。 */
|
|
47
|
+
abstract create(opts?: Parameters<ISessions["create"]>[0]): ReturnType<ISessions["create"]>;
|
|
48
|
+
/** 搜索条数上限(上游 `searchResultLimit`;UI 直接读它)。 */
|
|
49
|
+
abstract readonly searchResultLimit: ISessions["searchResultLimit"];
|
|
50
|
+
/** 一个会话的直系子代理地址(本装配没有子代理:`undefined`)。 */
|
|
51
|
+
abstract subagentAddress(id: Parameters<ISessions["subagentAddress"]>[0]): ReturnType<ISessions["subagentAddress"]>;
|
|
52
|
+
/** 全文搜索(本装配没有索引面时回 `{ ok: false }`)。 */
|
|
53
|
+
abstract search(query: Parameters<ISessions["search"]>[0], signal: Parameters<ISessions["search"]>[1]): ReturnType<ISessions["search"]>;
|
|
54
|
+
/** 从某个会话的前缀分叉(本装配没有分叉面)。 */
|
|
55
|
+
abstract fork(opts: Parameters<ISessions["fork"]>[0]): ReturnType<ISessions["fork"]>;
|
|
56
|
+
/** 重新拉一次 Host 的会话目录。 */
|
|
57
|
+
abstract refresh(): ReturnType<ISessions["refresh"]>;
|
|
58
|
+
/** 从一个 cordis 上下文反查它所属会话(入参就是上游要的 cordis `Context`)。 */
|
|
59
|
+
abstract scopeOf(ctx: Parameters<ISessions["scopeOf"]>[0]): ReturnType<ISessions["scopeOf"]>;
|
|
60
|
+
/** 重新读一个会话的投影(宿主拒绝复用 blank 时,UI 会刷新那一行)。 */
|
|
61
|
+
abstract refreshProjections(sessionId: Parameters<ISessions["refreshProjections"]>[0]): ReturnType<ISessions["refreshProjections"]>;
|
|
62
|
+
/** 一个会话的作用域(`ui-input-trigger` 用它把 sessionId 换成 controller 的 ctx)。 */
|
|
63
|
+
abstract scope(id: Parameters<ISessions["scope"]>[0]): ReturnType<ISessions["scope"]>;
|
|
64
|
+
/** 从一个作用域反查会话面(输入区触发器用它)。 */
|
|
65
|
+
abstract sessionOf(ctx: Parameters<ISessions["sessionOf"]>[0]): ReturnType<ISessions["sessionOf"]>;
|
|
66
|
+
/** 取一个会话实例(宿主侧的 `ctx.sessions.get(id)`;客户端侧给空)。 */
|
|
67
|
+
abstract get(id: string): ReturnType<ISessions["binding"]>;
|
|
68
|
+
/** 一行的当前 binding(上游 `ui-session` 用它比对保留者)。 */
|
|
69
|
+
abstract binding(id: string): ReturnType<ISessions["binding"]>;
|
|
70
|
+
/** 某一行的保留信息(上游 `ui-session` 的 `watchMainRetention` 订阅它)。 */
|
|
71
|
+
abstract retainInfo(id: string): ReturnType<ISessions["retainInfo"]>;
|
|
72
|
+
abstract retain(target: Parameters<ISessions["retain"]>[0], options: Parameters<ISessions["retain"]>[1]): ReturnType<ISessions["retain"]>;
|
|
73
|
+
abstract using<T>(target: Parameters<ISessions["using"]>[0], options: Parameters<ISessions["using"]>[1], operation: (reference: SessionRetainHandle) => T | Promise<T>): Promise<T>;
|
|
74
|
+
}
|
|
75
|
+
/** 模型目录的应答(上游 `ModelCatalog`;旧名保留给消费方)。 */
|
|
76
|
+
export type SessionModelCatalogValue = ModelCatalog;
|
|
77
|
+
/** 目录里的一行(上游 `SessionSummary`;旧名保留给消费方)。 */
|
|
78
|
+
export type SessionSummaryRow = SessionSummary;
|
|
79
|
+
/** `session/page` 的应答(上游 `SessionEventsPage`;旧名保留给消费方)。 */
|
|
80
|
+
export type SessionPageValue = SessionEventsPage;
|
|
81
|
+
/** `session/follow` 的首帧(上游 `SessionFollowFrame` 的 `snapshot` 分支)。 */
|
|
82
|
+
export type SessionFollowSnapshot = Extract<SessionFollowFrame, {
|
|
83
|
+
readonly type: "snapshot";
|
|
84
|
+
}>;
|
|
85
|
+
/** 一个模型选择(上游 `ModelSelection`)。 */
|
|
86
|
+
export type SessionModelSelection = ModelSelection;
|
|
87
|
+
/**
|
|
88
|
+
* 组名(`session`):唯一 home 是下面契约类上的 `@RemoteGroup({ name })`。
|
|
89
|
+
* @returns wire 组名。
|
|
90
|
+
* @throws 契约类漏了装饰器(装配期就该发现,而不是把空组名塞进 deps)。
|
|
91
|
+
*/
|
|
92
|
+
export declare function sessionGroupName(): string;
|
|
93
|
+
/** `session` 组:目录(建档 / 列表 / 翻页 / 跟随)、改名、选模型、分叉、搜索、投影与会话控制。 */
|
|
94
|
+
export declare class SessionEndpoint {
|
|
95
|
+
/**
|
|
96
|
+
* 列出一条目录(上游 `{ items }`)。
|
|
97
|
+
* @param _request - 预留的空请求(wire 名 `_request`:整组里唯一带下划线的形参)。
|
|
98
|
+
* @returns 目录行。
|
|
99
|
+
*/
|
|
100
|
+
list(_request: SessionListRequest): Promise<SessionListValue>;
|
|
101
|
+
/**
|
|
102
|
+
* 建一个会话(可复用已有的空白会话)。
|
|
103
|
+
* @param _request - 位置、可复用身份与 agent preset。
|
|
104
|
+
* @returns 会话身份。
|
|
105
|
+
*/
|
|
106
|
+
create(_request: SessionCreateRequest): Promise<SessionCreateValue>;
|
|
107
|
+
/**
|
|
108
|
+
* 读一页历史。
|
|
109
|
+
* @param _request - 目标会话与续读位置。
|
|
110
|
+
* @returns 这一页与是否还有更多。
|
|
111
|
+
*/
|
|
112
|
+
page(_request: SessionPageRequest): Promise<SessionEventsPage>;
|
|
113
|
+
/**
|
|
114
|
+
* 打开一个会话窗口:先给基线快照,之后逐帧推事件,直到取消。
|
|
115
|
+
* @param _request - 目标会话。
|
|
116
|
+
* @param _signal - 宿主侧的取消通道(载具注入,不是 wire 参数)。
|
|
117
|
+
* @returns 基线快照与后续事件帧。
|
|
118
|
+
*/
|
|
119
|
+
follow(_request: SessionFollowRequest, _signal: AbortSignal): AsyncIterable<SessionFollowFrame>;
|
|
120
|
+
/**
|
|
121
|
+
* Host 级的投影状态流:一帧基线,之后逐条投影增量,直到取消。
|
|
122
|
+
* @param _signal - 宿主侧的取消通道(载波注入,不是 wire 参数)。
|
|
123
|
+
* @returns baseline 与后续增量帧。
|
|
124
|
+
*/
|
|
125
|
+
control(_signal: AbortSignal): AsyncIterable<SessionControlFrame>;
|
|
126
|
+
/**
|
|
127
|
+
* 改一个会话的标题。
|
|
128
|
+
* @param _request - 会话与提议的标题。
|
|
129
|
+
* @returns 被接受的标题与事件位置。
|
|
130
|
+
*/
|
|
131
|
+
rename(_request: SessionRenameRequest): Promise<SessionRenameValue>;
|
|
132
|
+
/**
|
|
133
|
+
* 选模型。
|
|
134
|
+
* @param _request - 会话与模型选择。
|
|
135
|
+
* @returns 结算后的选择。
|
|
136
|
+
*/
|
|
137
|
+
selectModel(_request: SessionSelectModelRequest): Promise<SessionSelectModelValue>;
|
|
138
|
+
/**
|
|
139
|
+
* 从某个前缀分叉。
|
|
140
|
+
* @param _request - 源会话与分叉位置。
|
|
141
|
+
* @returns 子会话身份。
|
|
142
|
+
*/
|
|
143
|
+
fork(_request: SessionForkRequest): Promise<SessionForkValue>;
|
|
144
|
+
/**
|
|
145
|
+
* 全文搜索。
|
|
146
|
+
* @param _request - 查询。
|
|
147
|
+
* @returns 命中与是否有更多。
|
|
148
|
+
*/
|
|
149
|
+
search(_request: SessionSearchRequest): Promise<SessionSearchValue>;
|
|
150
|
+
/**
|
|
151
|
+
* 模型目录。
|
|
152
|
+
* @returns provider 分组与失败项。
|
|
153
|
+
*/
|
|
154
|
+
modelCatalog(): Promise<ModelCatalog>;
|
|
155
|
+
/** 初始化默认模型选择(首轮前调一次)。 */
|
|
156
|
+
initializeDefaultModel(): Promise<void>;
|
|
157
|
+
/** 宿主能不能「在文件管理器里打开」某个工作区路径。 */
|
|
158
|
+
canOpenWorkspacePath(): Promise<boolean>;
|
|
159
|
+
/**
|
|
160
|
+
* 给会话投递一段输入。
|
|
161
|
+
* @param _request - 输入与投递模式。
|
|
162
|
+
* @returns 受理回执。
|
|
163
|
+
*/
|
|
164
|
+
prompt(_request: SessionPromptRequest): Promise<SessionPromptValue>;
|
|
165
|
+
/**
|
|
166
|
+
* 取消当前这一轮。
|
|
167
|
+
* @param _request - 目标会话。
|
|
168
|
+
* @returns 受理回执。
|
|
169
|
+
*/
|
|
170
|
+
cancel(_request: SessionCancelRequest): Promise<SessionCancelValue>;
|
|
171
|
+
/**
|
|
172
|
+
* 改一条排队中的输入。
|
|
173
|
+
* @param _request - 目标条目与动作。
|
|
174
|
+
* @returns 受理回执。
|
|
175
|
+
*/
|
|
176
|
+
updateQueue(_request: SessionUpdateQueueRequest): Promise<SessionUpdateQueueValue>;
|
|
177
|
+
/**
|
|
178
|
+
* 某个路径可用的「打开方式」列表。
|
|
179
|
+
* @param _request - 目标路径。
|
|
180
|
+
* @returns 应用列表。
|
|
181
|
+
*/
|
|
182
|
+
workspacePathApplications(_request: SessionOpenWorkspacePathRequest): Promise<readonly SessionWorkspacePathApplication[]>;
|
|
183
|
+
/**
|
|
184
|
+
* 读一条会话里的图片附件。
|
|
185
|
+
* @param _request - 会话与附件引用。
|
|
186
|
+
* @returns 校验过的引用与数据。
|
|
187
|
+
*/
|
|
188
|
+
attachment(_request: SessionAttachmentRequest): Promise<SessionAttachmentValue>;
|
|
189
|
+
/**
|
|
190
|
+
* 读一页事件(`session/page` 的旧别名)。
|
|
191
|
+
* @param _request - 目标会话与位置。
|
|
192
|
+
* @returns 这一页。
|
|
193
|
+
*/
|
|
194
|
+
events(_request: SessionPageRequest): Promise<SessionEventsPage>;
|
|
195
|
+
/**
|
|
196
|
+
* 在宿主的文件管理器里打开一个工作区路径。
|
|
197
|
+
* @param _request - 路径与打开方式。
|
|
198
|
+
* @returns 打开结果。
|
|
199
|
+
*/
|
|
200
|
+
openWorkspacePath(_request: SessionOpenWorkspacePathRequest): Promise<SessionOpenWorkspacePathValue>;
|
|
201
|
+
/**
|
|
202
|
+
* 读一份投影快照。
|
|
203
|
+
* @param _request - 会话与投影键。
|
|
204
|
+
* @returns 投影值。
|
|
205
|
+
*/
|
|
206
|
+
projections(_request: SessionProjectionsRequest): Promise<SessionProjectionsValue>;
|
|
207
|
+
/**
|
|
208
|
+
* 观察一个会话的事件流(上游 `SessionEventFrame`)。
|
|
209
|
+
* @param _request - 目标会话地址。
|
|
210
|
+
* @param _signal - 宿主侧的取消通道(载具注入,不是 wire 参数)。
|
|
211
|
+
* @returns 逐帧的事件。
|
|
212
|
+
*/
|
|
213
|
+
observeEvent(_request: SessionObserveEventRequest, _signal: AbortSignal): AsyncIterable<SessionEventFrame>;
|
|
214
|
+
/**
|
|
215
|
+
* 观察一个会话的投影变化流。
|
|
216
|
+
* @param _request - 目标会话地址。
|
|
217
|
+
* @param _signal - 宿主侧的取消通道。
|
|
218
|
+
* @returns 逐帧的投影变化。
|
|
219
|
+
*/
|
|
220
|
+
observeProjections(_request: SessionProjectionsRequest, _signal: AbortSignal): AsyncIterable<SessionProjectionFrame>;
|
|
221
|
+
/**
|
|
222
|
+
* 读一次会话状态(运行中 / 队列 / 待处理输入)。
|
|
223
|
+
* @param _request - 目标会话地址。
|
|
224
|
+
* @returns 这一拍的状态。
|
|
225
|
+
*/
|
|
226
|
+
state(_request: SessionStateRequest): Promise<SessionState>;
|
|
227
|
+
/**
|
|
228
|
+
* 观察会话状态的帧流。
|
|
229
|
+
* @param _request - 目标会话地址。
|
|
230
|
+
* @param _signal - 宿主侧的取消通道。
|
|
231
|
+
* @returns 逐帧的状态。
|
|
232
|
+
*/
|
|
233
|
+
observeState(_request: SessionStateRequest, _signal: AbortSignal): AsyncIterable<SessionState>;
|
|
234
|
+
/**
|
|
235
|
+
* 等这一轮结算(上游 `SessionWaitValue`)。
|
|
236
|
+
* @param _request - 目标会话与等待条件。
|
|
237
|
+
* @returns 等待结果。
|
|
238
|
+
*/
|
|
239
|
+
wait(_request: SessionWaitRequest): Promise<SessionWaitValue>;
|
|
240
|
+
}
|
|
241
|
+
/** 本组覆盖的 **unary** 端点(显式列出:按 `keyof` 取会放过「契约掉了一个端点」)。 */
|
|
242
|
+
type UnaryEndpoints = "list" | "create" | "page" | "rename" | "selectModel" | "fork" | "search" | "modelCatalog" | "initializeDefaultModel" | "canOpenWorkspacePath" | "prompt" | "cancel" | "updateQueue" | "workspacePathApplications" | "attachment" | "events" | "openWorkspacePath" | "projections" | "state" | "wait";
|
|
243
|
+
/** 本组覆盖的**流式**端点。 */
|
|
244
|
+
type StreamEndpoints = "follow" | "control" | "observeEvent" | "observeProjections" | "observeState";
|
|
245
|
+
/**
|
|
246
|
+
* 上游 `session` 的 **wire 面**:宿主类 `SessionController` 的三步投影(规则与出处见
|
|
247
|
+
* `@morlay/zephyr-app/typert` 的 `params.ts`):去末尾 `signal`(走 cancellation)→ `AsyncReturn`
|
|
248
|
+
* (unary 异步化;`AsyncIterable` 不包 `Promise`)。本组没有 lookup 形参(`sessionId` 在请求体里)。
|
|
249
|
+
*/
|
|
250
|
+
type SessionWire = AsyncReturn<DropParam<SessionControllerHost, AbortSignal>>;
|
|
251
|
+
/**
|
|
252
|
+
* 覆盖守卫(unary):契约对上宿主类的 wire 面(形参与返回**双向**,见 `AssertWireFace`)。
|
|
253
|
+
*/
|
|
254
|
+
export type SessionEndpointCovered = AssertTrue<AssertWireFace<Pick<SessionWire, UnaryEndpoints>, Pick<SessionEndpoint, UnaryEndpoints>>>;
|
|
255
|
+
/**
|
|
256
|
+
* 覆盖守卫(流式):**契约侧也要把末尾那个取消信号摘掉再比**——那个 `signal` 是宿主侧的取消通道
|
|
257
|
+
* (载具注入,`registerRemoteGroup` 按 `handler.length >= 2` 传),不是 wire 参数;宿主类的原文同样带它。
|
|
258
|
+
* 这套做法在 `workspaceFiles` 的 `changes` 上验过。
|
|
259
|
+
*/
|
|
260
|
+
export type SessionEndpointStreamCovered = AssertTrue<AssertWireFace<Pick<SessionWire, StreamEndpoints>, Pick<DropParam<SessionEndpoint, AbortSignal>, StreamEndpoints>>>;
|
|
261
|
+
export { type ModelCatalog, type ModelSelection, type PromptContentPart, type QueueAction, SESSION_CONTROLLER_REMOTE, type SessionAttachmentRequest, type SessionAttachmentValue, type SessionCancelRequest, type SessionCancelValue, type SessionControlFrame, type SessionCreateRequest, type SessionCreateValue, type SessionEvent, type SessionEventFrame, type SessionEventsPage, type SessionFollowFrame, type SessionFollowRequest, type SessionForkRequest, type SessionForkValue, type SessionHeader, SessionId, type SessionListRequest, type SessionListValue, type SessionObserveEventRequest, type SessionOpenWorkspacePathRequest, type SessionOpenWorkspacePathValue, type SessionPageRequest, type SessionProjectionFrame, type SessionProjectionsRequest, type SessionProjectionsValue, type SessionPromptRequest, type SessionPromptValue, type SessionRenameRequest, type SessionRenameValue, type SessionSearchRequest, type SessionSearchValue, type SessionSelectModelRequest, type SessionSelectModelValue, type SessionState, type SessionStateRequest, type SessionSummary, type SessionUpdateQueueRequest, type SessionUpdateQueueValue, type SessionWaitRequest, type SessionWaitValue, type SessionWorkspacePathApplication };
|