@prettier-ai/dsh-client-ui-trajectory 0.1.2-alpha.1 → 0.1.2-alpha.3
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 +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +62 -12
- package/package.json +20 -32
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/client/ui-trajectory/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 73bacf0761e2427b0c2632ed274de68986058ebd
|
|
6
|
+
README.zh.md: 8672ff0787472b284ccb4639876f7fc3097af9e1
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ A fixed Overview above the ledger projects real record start/duration timing fro
|
|
|
43
43
|
<details>
|
|
44
44
|
<summary>Implementation internals — click to expand</summary>
|
|
45
45
|
|
|
46
|
-
The view is a pure projection: Trajectory-owned Definitions assemble business records from the shared Session window — including durable cancellation-finalized prefixes, chunk-only interruption fallbacks, and interrupted Tool records — so Trajectory neither reads nor changes the Chat conversation snapshot.
|
|
46
|
+
The view is a pure projection: Trajectory-owned Definitions assemble business records from the shared Session window — including durable cancellation-finalized prefixes, chunk-only interruption fallbacks, and interrupted Tool records — so Trajectory neither reads nor changes the Chat conversation snapshot. Its steering classifier retains only next-step Inbox IDs through persistent splice state and shares each current claimed batch across later Contexts.
|
|
47
47
|
|
|
48
48
|
### Virtual rows
|
|
49
49
|
|
package/README.zh.md
CHANGED
|
@@ -43,7 +43,7 @@ kind: "package-reference"
|
|
|
43
43
|
<details>
|
|
44
44
|
<summary>实现细节——点击展开</summary>
|
|
45
45
|
|
|
46
|
-
视图是纯投影:Trajectory 自有的 Definition 从共享 Session 窗口组装业务记录——包括持久化的取消定稿前缀、只能从分片恢复的打断前缀与被打断的工具记录——因此 Trajectory 既不读取也不改变 Chat
|
|
46
|
+
视图是纯投影:Trajectory 自有的 Definition 从共享 Session 窗口组装业务记录——包括持久化的取消定稿前缀、只能从分片恢复的打断前缀与被打断的工具记录——因此 Trajectory 既不读取也不改变 Chat 会话快照。其 steering 分类器通过持久 splice state 只保留 next-step Inbox ID,并让后续 Context 共享当前 claimed batch。
|
|
47
47
|
|
|
48
48
|
### 虚拟行
|
|
49
49
|
|
package/lib/client.js
CHANGED
|
@@ -1131,23 +1131,73 @@ window.__ModuleLoader__.load({
|
|
|
1131
1131
|
}
|
|
1132
1132
|
//#endregion
|
|
1133
1133
|
//#region lib/types/client/trajectory-message-definitions.js
|
|
1134
|
+
const EMPTY_PENDING = {
|
|
1135
|
+
kind: "snapshot",
|
|
1136
|
+
ids: []
|
|
1137
|
+
};
|
|
1138
|
+
const EMPTY_CURRENT_CLAIMED = /* @__PURE__ */ new Set();
|
|
1139
|
+
function materializePending(state) {
|
|
1140
|
+
const splices = [];
|
|
1141
|
+
let current = state;
|
|
1142
|
+
while (current.kind === "splice") {
|
|
1143
|
+
splices.push(current);
|
|
1144
|
+
current = current.previous;
|
|
1145
|
+
}
|
|
1146
|
+
const pending = [...current.ids];
|
|
1147
|
+
for (const splice of splices.reverse()) pending.splice(splice.start, splice.removedCount, ...splice.inserted);
|
|
1148
|
+
return pending;
|
|
1149
|
+
}
|
|
1150
|
+
function withoutInserted(claimed, inserted) {
|
|
1151
|
+
let next;
|
|
1152
|
+
for (const id of inserted) {
|
|
1153
|
+
if (!claimed.has(id)) continue;
|
|
1154
|
+
next ??= new Set(claimed);
|
|
1155
|
+
next.delete(id);
|
|
1156
|
+
}
|
|
1157
|
+
return next ?? claimed;
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Apply one next-step splice under the AgentLoop's durable event ordering.
|
|
1161
|
+
* An entered claim logs its complete message batch before another claim; a
|
|
1162
|
+
* rejected claim logs no messages, so only the current claim can classify a
|
|
1163
|
+
* later `user/message`.
|
|
1164
|
+
*/
|
|
1134
1165
|
function applySplice(previous, splice) {
|
|
1135
|
-
const
|
|
1136
|
-
const
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1166
|
+
const priorPending = previous?.state.pending ?? EMPTY_PENDING;
|
|
1167
|
+
const inserted = splice.inserted.map((identity) => identity.id);
|
|
1168
|
+
const removedCount = splice.removedCount ?? 0;
|
|
1169
|
+
if (removedCount > 0 && splice.outcome !== "canceled") {
|
|
1170
|
+
const pending = materializePending(priorPending);
|
|
1171
|
+
const removed = pending.splice(splice.start, removedCount, ...inserted);
|
|
1172
|
+
return {
|
|
1173
|
+
pending: {
|
|
1174
|
+
kind: "snapshot",
|
|
1175
|
+
ids: pending
|
|
1176
|
+
},
|
|
1177
|
+
currentClaimed: new Set(removed)
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
const currentClaimed = withoutInserted(previous?.state.currentClaimed ?? EMPTY_CURRENT_CLAIMED, inserted);
|
|
1140
1181
|
return {
|
|
1141
|
-
pending
|
|
1142
|
-
|
|
1182
|
+
pending: {
|
|
1183
|
+
kind: "splice",
|
|
1184
|
+
previous: priorPending,
|
|
1185
|
+
start: splice.start,
|
|
1186
|
+
removedCount,
|
|
1187
|
+
inserted
|
|
1188
|
+
},
|
|
1189
|
+
currentClaimed
|
|
1143
1190
|
};
|
|
1144
1191
|
}
|
|
1145
1192
|
const trajectoryInboxDefinition = {
|
|
1146
1193
|
kind: "trajectory-inbox-next-step",
|
|
1147
|
-
match: (event) =>
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1194
|
+
match: (event) => {
|
|
1195
|
+
if (event.type === "agent/inbox/spliced" && event.data.target === "next-step") return {
|
|
1196
|
+
id: String(event.seq),
|
|
1197
|
+
role: "start"
|
|
1198
|
+
};
|
|
1199
|
+
return null;
|
|
1200
|
+
},
|
|
1151
1201
|
start: (_context, match, reader) => {
|
|
1152
1202
|
if (match.event.type !== "agent/inbox/spliced") throw new Error("trajectory-inbox-next-step start requires agent/inbox/spliced");
|
|
1153
1203
|
return applySplice(reader.previous("trajectory-inbox-next-step"), match.event.data);
|
|
@@ -1174,7 +1224,7 @@ window.__ModuleLoader__.load({
|
|
|
1174
1224
|
provenance: contextProvenance(event.data.source),
|
|
1175
1225
|
form: contextForm(event.data.source)
|
|
1176
1226
|
};
|
|
1177
|
-
return reader.previous("trajectory-inbox-next-step")?.state.
|
|
1227
|
+
return reader.previous("trajectory-inbox-next-step")?.state.currentClaimed.has(String(event.data.id)) === true ? {
|
|
1178
1228
|
kind: "steering",
|
|
1179
1229
|
messageId: event.data.id,
|
|
1180
1230
|
seq: event.seq,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prettier-ai/dsh-client-ui-trajectory",
|
|
3
3
|
"description": "Trajectory event ledger with an interactive timing overview: pure-consumer plugin registering into the conversation ViewMap (no service)",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -47,43 +47,31 @@
|
|
|
47
47
|
"diff": "^9.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@prettier-ai/
|
|
51
|
-
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
|
|
52
|
-
"@prettier-ai/cordis": "^4.0.1",
|
|
53
|
-
"@prettier-ai/dsh-agent": "^0.1.2-alpha.1",
|
|
54
|
-
"@prettier-ai/dsh-compaction": "^0.1.2-alpha.1",
|
|
55
|
-
"@prettier-ai/dsh-tools": "^0.1.2-alpha.1",
|
|
56
|
-
"@prettier-ai/dsh-session": "^0.1.2-alpha.1",
|
|
57
|
-
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
|
|
58
|
-
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
|
|
59
|
-
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
|
|
60
|
-
"@prettier-ai/dsh-llm": "^0.1.2-alpha.1",
|
|
61
|
-
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
|
|
62
|
-
"@prettier-ai/dsh-attachment": "^0.1.2-alpha.1"
|
|
50
|
+
"@prettier-ai/cordis": "^4.0.2"
|
|
63
51
|
},
|
|
64
52
|
"devDependencies": {
|
|
65
53
|
"@types/react": "~18.3.1",
|
|
66
54
|
"@types/react-dom": "~18.3.0",
|
|
67
55
|
"react": "^18.2.0",
|
|
68
56
|
"react-dom": "^18.2.0",
|
|
69
|
-
"@prettier-ai/dsh-agent": "^0.1.2-alpha.
|
|
70
|
-
"@prettier-ai/dsh-client-
|
|
71
|
-
"@prettier-ai/dsh-client-
|
|
72
|
-
"@prettier-ai/dsh-client-
|
|
73
|
-
"@prettier-ai/dsh-client-ui-
|
|
74
|
-
"@prettier-ai/dsh-client-
|
|
75
|
-
"@prettier-ai/dsh-compaction": "^0.1.2-alpha.
|
|
76
|
-
"@prettier-ai/dsh-tools": "^0.1.2-alpha.
|
|
77
|
-
"@prettier-ai/
|
|
78
|
-
"@prettier-ai/
|
|
79
|
-
"@prettier-ai/dsh-
|
|
80
|
-
"@prettier-ai/dsh-
|
|
81
|
-
"@prettier-ai/dsh-client-ui-chat": "^0.1.2-alpha.
|
|
82
|
-
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.
|
|
83
|
-
"@prettier-ai/dsh-client-ui-
|
|
84
|
-
"@prettier-ai/dsh-llm": "^0.1.2-alpha.
|
|
85
|
-
"@prettier-ai/dsh-
|
|
86
|
-
"@prettier-ai/dsh-
|
|
57
|
+
"@prettier-ai/dsh-agent": "^0.1.2-alpha.3",
|
|
58
|
+
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.3",
|
|
59
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.3",
|
|
60
|
+
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.3",
|
|
61
|
+
"@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.3",
|
|
62
|
+
"@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.3",
|
|
63
|
+
"@prettier-ai/dsh-compaction": "^0.1.2-alpha.3",
|
|
64
|
+
"@prettier-ai/dsh-tools": "^0.1.2-alpha.3",
|
|
65
|
+
"@prettier-ai/dsh-client-store": "^0.1.2-alpha.3",
|
|
66
|
+
"@prettier-ai/cordis": "^4.0.2",
|
|
67
|
+
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.3",
|
|
68
|
+
"@prettier-ai/dsh-session": "^0.1.2-alpha.3",
|
|
69
|
+
"@prettier-ai/dsh-client-ui-chat": "^0.1.2-alpha.3",
|
|
70
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.3",
|
|
71
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.3",
|
|
72
|
+
"@prettier-ai/dsh-llm": "^0.1.2-alpha.3",
|
|
73
|
+
"@prettier-ai/dsh-attachment": "^0.1.2-alpha.3",
|
|
74
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.3"
|
|
87
75
|
},
|
|
88
76
|
"files": [
|
|
89
77
|
"lib/index.js",
|