@deepseek-ai/dsh-session 0.0.1-rc.3 → 0.1.0-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/LICENSE +17 -24
- package/lib/index.js +2 -20
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +1 -1
- package/lib/types/repair.d.ts +1 -17
- package/lib/types/repair.js +1 -19
- package/package.json +15 -15
package/LICENSE
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
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:
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
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/lib/index.js
CHANGED
|
@@ -607,27 +607,9 @@ var SessionPreparation = class SessionPreparation {
|
|
|
607
607
|
/**
|
|
608
608
|
* Crash-recovery repair for an interrupted session log. It preserves a fully
|
|
609
609
|
* written final turn and supplies the missing tool, step, and turn boundaries
|
|
610
|
-
* needed to resume with a provider-valid transcript
|
|
611
|
-
* read that must skip the end-seed boundary — which this module does
|
|
612
|
-
* not write (`Session`'s constructor does) but whose synthetic closers can
|
|
613
|
-
* inherit that boundary's timestamp, the one real coupling between the two.
|
|
610
|
+
* needed to resume with a provider-valid transcript.
|
|
614
611
|
* @module @deepseek-ai/dsh-session/repair
|
|
615
612
|
*/
|
|
616
|
-
/**
|
|
617
|
-
* The `time` of the log's last event representing actual work, skipping the
|
|
618
|
-
* `session/end-seed` boundary — picking a session up is not activity, so
|
|
619
|
-
* activity ordering must exclude it.
|
|
620
|
-
*
|
|
621
|
-
* Excluded by type, so a pickup time still leaks when a boundary is the last
|
|
622
|
-
* event of an open turn: {@link interruptedTurnClosers} copies it onto the
|
|
623
|
-
* synthetic `turn/end`, which this counts as work. Reachable only by seeding an
|
|
624
|
-
* unbalanced log directly — `load()` balances first.
|
|
625
|
-
* @param events - the log to scan, in seq order.
|
|
626
|
-
* @returns the latest non-boundary event's `time`, or undefined when there is none.
|
|
627
|
-
*/
|
|
628
|
-
function lastActivityTime(events) {
|
|
629
|
-
return events.findLast((event) => event.type !== "session/end-seed")?.time;
|
|
630
|
-
}
|
|
631
613
|
/** Recovery code for an assistant tool request that never reached a recorded call start. */
|
|
632
614
|
const TOOL_NOT_STARTED = "TOOL_NOT_STARTED";
|
|
633
615
|
/** Recovery code for a recorded tool call whose completed outcome was not durably recorded. */
|
|
@@ -1901,4 +1883,4 @@ var SessionStore = class extends Service {
|
|
|
1901
1883
|
}
|
|
1902
1884
|
};
|
|
1903
1885
|
//#endregion
|
|
1904
|
-
export { KNOWN_SESSION_EVENT_TYPES, SESSION_FORMAT_VERSION, Session, SessionForkError, SessionId, SessionPreparation, SessionStore, SessionStore as default, TOOL_NOT_STARTED, TOOL_OUTCOME_UNKNOWN, adoptSessionEvent, canonicalHeader, decodeStorageRecord, deriveEventMessage, foldRequestHeader, foldSurface, headerEquals, interruptedTurnClosers, isAppendSurfaceEvent, isJsonValue, isReplacementSurfaceEvent, isSurfaceEligibleType, isSurfaceEvent,
|
|
1886
|
+
export { KNOWN_SESSION_EVENT_TYPES, SESSION_FORMAT_VERSION, Session, SessionForkError, SessionId, SessionPreparation, SessionStore, SessionStore as default, TOOL_NOT_STARTED, TOOL_OUTCOME_UNKNOWN, adoptSessionEvent, canonicalHeader, decodeStorageRecord, deriveEventMessage, foldRequestHeader, foldSurface, headerEquals, interruptedTurnClosers, isAppendSurfaceEvent, isJsonValue, isReplacementSurfaceEvent, isSurfaceEligibleType, isSurfaceEvent, packChunkRuns, snapshotJsonValue, snapshotSessionEvent };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type { SessionPreparationOptions } from './preparation.ts';
|
|
|
18
18
|
export type { AssistantMessage, ToolResultMessage, UserMessage } from '@deepseek-ai/dsh-llm';
|
|
19
19
|
export { isJsonValue, snapshotJsonValue } from './json.ts';
|
|
20
20
|
export type { JsonValue } from './json.ts';
|
|
21
|
-
export { interruptedTurnClosers,
|
|
21
|
+
export { interruptedTurnClosers, TOOL_NOT_STARTED, TOOL_OUTCOME_UNKNOWN } from './repair.ts';
|
|
22
22
|
export { decodeStorageRecord, packChunkRuns } from './chunk-rows.ts';
|
|
23
23
|
export type { ChunkRow, StorageRecord } from './chunk-rows.ts';
|
|
24
24
|
export type { SessionSurface, SurfaceFoldReplacement, SurfaceFoldResult } from './surface.ts';
|
package/lib/types/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { foldRequestHeader } from "./request-header.js";
|
|
|
16
16
|
export * from "./types.js";
|
|
17
17
|
export { SessionPreparation } from "./preparation.js";
|
|
18
18
|
export { isJsonValue, snapshotJsonValue } from "./json.js";
|
|
19
|
-
export { interruptedTurnClosers,
|
|
19
|
+
export { interruptedTurnClosers, TOOL_NOT_STARTED, TOOL_OUTCOME_UNKNOWN } from "./repair.js";
|
|
20
20
|
export { decodeStorageRecord, packChunkRuns } from "./chunk-rows.js";
|
|
21
21
|
export { deriveEventMessage, foldSurface, isAppendSurfaceEvent, isReplacementSurfaceEvent, isSurfaceEvent, isSurfaceEligibleType } from "./surface.js";
|
|
22
22
|
export { canonicalHeader, foldRequestHeader, headerEquals } from "./request-header.js";
|
package/lib/types/repair.d.ts
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Crash-recovery repair for an interrupted session log. It preserves a fully
|
|
3
3
|
* written final turn and supplies the missing tool, step, and turn boundaries
|
|
4
|
-
* needed to resume with a provider-valid transcript
|
|
5
|
-
* read that must skip the end-seed boundary — which this module does
|
|
6
|
-
* not write (`Session`'s constructor does) but whose synthetic closers can
|
|
7
|
-
* inherit that boundary's timestamp, the one real coupling between the two.
|
|
4
|
+
* needed to resume with a provider-valid transcript.
|
|
8
5
|
* @module @deepseek-ai/dsh-session/repair
|
|
9
6
|
*/
|
|
10
7
|
import type { SessionEvent } from './types.ts';
|
|
11
|
-
/**
|
|
12
|
-
* The `time` of the log's last event representing actual work, skipping the
|
|
13
|
-
* `session/end-seed` boundary — picking a session up is not activity, so
|
|
14
|
-
* activity ordering must exclude it.
|
|
15
|
-
*
|
|
16
|
-
* Excluded by type, so a pickup time still leaks when a boundary is the last
|
|
17
|
-
* event of an open turn: {@link interruptedTurnClosers} copies it onto the
|
|
18
|
-
* synthetic `turn/end`, which this counts as work. Reachable only by seeding an
|
|
19
|
-
* unbalanced log directly — `load()` balances first.
|
|
20
|
-
* @param events - the log to scan, in seq order.
|
|
21
|
-
* @returns the latest non-boundary event's `time`, or undefined when there is none.
|
|
22
|
-
*/
|
|
23
|
-
export declare function lastActivityTime(events: readonly SessionEvent[]): number | undefined;
|
|
24
8
|
/** Recovery code for an assistant tool request that never reached a recorded call start. */
|
|
25
9
|
export declare const TOOL_NOT_STARTED = "TOOL_NOT_STARTED";
|
|
26
10
|
/** Recovery code for a recorded tool call whose completed outcome was not durably recorded. */
|
package/lib/types/repair.js
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Crash-recovery repair for an interrupted session log. It preserves a fully
|
|
3
3
|
* written final turn and supplies the missing tool, step, and turn boundaries
|
|
4
|
-
* needed to resume with a provider-valid transcript
|
|
5
|
-
* read that must skip the end-seed boundary — which this module does
|
|
6
|
-
* not write (`Session`'s constructor does) but whose synthetic closers can
|
|
7
|
-
* inherit that boundary's timestamp, the one real coupling between the two.
|
|
4
|
+
* needed to resume with a provider-valid transcript.
|
|
8
5
|
* @module @deepseek-ai/dsh-session/repair
|
|
9
6
|
*/
|
|
10
7
|
import { MessageId, freezeMessage } from '@deepseek-ai/dsh-llm';
|
|
11
|
-
/**
|
|
12
|
-
* The `time` of the log's last event representing actual work, skipping the
|
|
13
|
-
* `session/end-seed` boundary — picking a session up is not activity, so
|
|
14
|
-
* activity ordering must exclude it.
|
|
15
|
-
*
|
|
16
|
-
* Excluded by type, so a pickup time still leaks when a boundary is the last
|
|
17
|
-
* event of an open turn: {@link interruptedTurnClosers} copies it onto the
|
|
18
|
-
* synthetic `turn/end`, which this counts as work. Reachable only by seeding an
|
|
19
|
-
* unbalanced log directly — `load()` balances first.
|
|
20
|
-
* @param events - the log to scan, in seq order.
|
|
21
|
-
* @returns the latest non-boundary event's `time`, or undefined when there is none.
|
|
22
|
-
*/
|
|
23
|
-
export function lastActivityTime(events) {
|
|
24
|
-
return events.findLast(event => event.type !== 'session/end-seed')?.time;
|
|
25
|
-
}
|
|
26
8
|
/** Recovery code for an assistant tool request that never reached a recorded call start. */
|
|
27
9
|
export const TOOL_NOT_STARTED = 'TOOL_NOT_STARTED';
|
|
28
10
|
/** Recovery code for a recorded tool call whose completed outcome was not durably recorded. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session",
|
|
3
3
|
"description": "Event-sourced session store for the DeepSeek Harness",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"lib/types/**/*.js",
|
|
40
40
|
"lib/types/**/*.d.ts"
|
|
41
41
|
],
|
|
42
|
-
"license": "
|
|
42
|
+
"license": "MIT",
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@deepseek-ai/dsh-brand": "^0.0
|
|
45
|
-
"@deepseek-ai/dsh-invariants": "^0.0
|
|
46
|
-
"@deepseek-ai/dsh-llm": "^0.0
|
|
47
|
-
"@deepseek-ai/dsh-scope": "^0.0
|
|
48
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.0
|
|
49
|
-
"@deepseek-ai/cordis": "^4.0.1
|
|
44
|
+
"@deepseek-ai/dsh-brand": "^0.1.0-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.2",
|
|
46
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-scope": "^0.1.0-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.2",
|
|
49
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@deepseek-ai/dsh-brand": "^0.0
|
|
53
|
-
"@deepseek-ai/dsh-invariants": "^0.0
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/
|
|
57
|
-
"@deepseek-ai/dsh-typert-
|
|
58
|
-
"@deepseek-ai/
|
|
52
|
+
"@deepseek-ai/dsh-brand": "^0.1.0-rc.2",
|
|
53
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.2",
|
|
54
|
+
"@deepseek-ai/dsh-scope": "^0.1.0-rc.2",
|
|
55
|
+
"@deepseek-ai/dsh-typert-registry": "^0.1.0-rc.2",
|
|
56
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
57
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.2"
|
|
59
59
|
}
|
|
60
60
|
}
|