@deepseek-ai/dsh-time-context 0.1.2-alpha.3 → 0.1.2-alpha.5
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/lib/index.js +8 -2
- package/lib/invariant.js +4 -3
- package/package.json +22 -22
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { z as z$1 } from "zod";
|
|
3
3
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
|
+
import { SessionSeq } from "@deepseek-ai/dsh-session";
|
|
4
5
|
import { assertNever } from "@deepseek-ai/dsh-util-values";
|
|
5
6
|
//#region lib/types/request-zone.js
|
|
6
7
|
/** Browser-zone derivation and model-facing policy text for one open request turn. */
|
|
@@ -132,8 +133,13 @@ function formatDuration(elapsedMs) {
|
|
|
132
133
|
}
|
|
133
134
|
/** Collect already-entered and proposed user messages belonging to one open turn. */
|
|
134
135
|
function requestMessages(agent, turn, proposed) {
|
|
135
|
-
const
|
|
136
|
-
|
|
136
|
+
const entered = [];
|
|
137
|
+
for (let seq = agent.session.seq - 1; seq >= 0; seq -= 1) {
|
|
138
|
+
const event = agent.session.eventAt(SessionSeq(seq));
|
|
139
|
+
if (event?.type === "turn/start" && event.data.turn === turn) return [...entered.reverse(), ...proposed];
|
|
140
|
+
if (event?.type === "user/message") entered.push(event.data);
|
|
141
|
+
}
|
|
142
|
+
return [...proposed];
|
|
137
143
|
}
|
|
138
144
|
function renderText(now, turn, step, previous, formatter, timeZone, browserContext) {
|
|
139
145
|
const elapsed = previous === void 0 ? "unavailable" : formatDuration(now - previous);
|
package/lib/invariant.js
CHANGED
|
@@ -180,9 +180,10 @@ function validateReading(history, event, fail) {
|
|
|
180
180
|
}
|
|
181
181
|
/** Validate all package-owned readings already present in one session. */
|
|
182
182
|
function validateSession(session, fail) {
|
|
183
|
-
|
|
183
|
+
const events = session.snapshotEvents();
|
|
184
|
+
for (const [index, event] of events.entries()) {
|
|
184
185
|
if (event.type !== "user/message" || event.data.source.kind !== "plugin" || event.data.source.plugin !== SOURCE_NAME) continue;
|
|
185
|
-
validateReading(
|
|
186
|
+
validateReading(events.slice(0, index), event, fail);
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
/** Install validation for loaded and newly appended context readings. */
|
|
@@ -195,7 +196,7 @@ const install = Object.assign((ctx, fail) => {
|
|
|
195
196
|
if (eventName !== "session/event") return;
|
|
196
197
|
const [session, event] = args;
|
|
197
198
|
if (event.type !== "user/message" || event.data.source.kind !== "plugin" || event.data.source.plugin !== SOURCE_NAME) return;
|
|
198
|
-
validateReading(session.
|
|
199
|
+
validateReading(session.snapshotEvents(), event, fail);
|
|
199
200
|
}, { global: true });
|
|
200
201
|
}, { inject: ["sessions"] });
|
|
201
202
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-time-context",
|
|
3
3
|
"description": "Opt-in durable per-step context with the current time and elapsed time",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.5",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -33,33 +33,33 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"zod": "^4.4.3",
|
|
36
|
-
"@deepseek-ai/dsh-util-values": "^0.1.2-alpha.
|
|
36
|
+
"@deepseek-ai/dsh-util-values": "^0.1.2-alpha.5",
|
|
37
37
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
41
|
-
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.
|
|
42
|
-
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.
|
|
43
|
-
"@deepseek-ai/dsh-
|
|
44
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
41
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
|
|
42
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.5",
|
|
43
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.5",
|
|
44
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.5",
|
|
45
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
49
|
-
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.
|
|
50
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.2-alpha.
|
|
51
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.2-alpha.
|
|
52
|
-
"@deepseek-ai/dsh-app-boot": "^0.1.2-alpha.
|
|
53
|
-
"@deepseek-ai/dsh-bash-local": "^0.1.2-alpha.
|
|
54
|
-
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
57
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
60
|
-
"@deepseek-ai/dsh-
|
|
61
|
-
"@deepseek-ai/dsh-
|
|
62
|
-
"@deepseek-ai/dsh-
|
|
63
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.
|
|
49
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
|
|
50
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.2-alpha.5",
|
|
51
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.2-alpha.5",
|
|
52
|
+
"@deepseek-ai/dsh-app-boot": "^0.1.2-alpha.5",
|
|
53
|
+
"@deepseek-ai/dsh-bash-local": "^0.1.2-alpha.5",
|
|
54
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.5",
|
|
55
|
+
"@deepseek-ai/dsh-loader-smoke": "^0.1.2-alpha.5",
|
|
56
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.5",
|
|
57
|
+
"@deepseek-ai/dsh-session-checkpoint-policy": "^0.1.2-alpha.5",
|
|
58
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.1.2-alpha.5",
|
|
59
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
|
|
60
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.5",
|
|
61
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.5",
|
|
62
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.2-alpha.5",
|
|
63
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.5"
|
|
64
64
|
}
|
|
65
65
|
}
|