@deepseek-ai/dsh-session-format-v2-to-v3 0.1.5-alpha.1
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.i18n.yaml +6 -0
- package/README.md +207 -0
- package/README.zh.md +207 -0
- package/lib/index.js +870 -0
- package/lib/types/codec.d.ts +43 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/migration.d.ts +4 -0
- package/lib/types/payload.d.ts +51 -0
- package/lib/types/references.d.ts +11 -0
- package/lib/types/validation.d.ts +21 -0
- package/package.json +52 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** V3 framing with hard structural admission and recoverable canonical event validation. */
|
|
2
|
+
import type { SessionFormatEvent, SessionFormatHeader } from '@deepseek-ai/dsh-session-format';
|
|
3
|
+
/** V3 codec validates structural rows before recovery and logical envelopes after provenance decoding. */
|
|
4
|
+
export declare const releasedV3SessionFormatCodec: Readonly<{
|
|
5
|
+
version: number;
|
|
6
|
+
decodeHeader(value: unknown): {
|
|
7
|
+
version: number;
|
|
8
|
+
id: string;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
parentSession?: string;
|
|
12
|
+
isSeeded: boolean;
|
|
13
|
+
origin?: "subagent";
|
|
14
|
+
delegationDepth: number;
|
|
15
|
+
agentPreset?: string;
|
|
16
|
+
};
|
|
17
|
+
createDecoder(value: unknown, recovery: import("@deepseek-ai/dsh-session-format").SessionFormatRecovery): {
|
|
18
|
+
header: {
|
|
19
|
+
version: number;
|
|
20
|
+
id: string;
|
|
21
|
+
createdAt: number;
|
|
22
|
+
cwd?: string;
|
|
23
|
+
parentSession?: string;
|
|
24
|
+
isSeeded: boolean;
|
|
25
|
+
origin?: "subagent";
|
|
26
|
+
delegationDepth: number;
|
|
27
|
+
agentPreset?: string;
|
|
28
|
+
};
|
|
29
|
+
decodeRow(row: unknown, context: import("@deepseek-ai/dsh-session-format").SessionFormatMigrationContext): void;
|
|
30
|
+
finish(context: import("@deepseek-ai/dsh-session-format").SessionFormatMigrationContext): number;
|
|
31
|
+
};
|
|
32
|
+
encodeHeader(header: SessionFormatHeader, inheritedEventCount: number): {
|
|
33
|
+
version: number;
|
|
34
|
+
};
|
|
35
|
+
encodeEvent(event: SessionFormatEvent): import("@deepseek-ai/dsh-session-format").SessionFormatJsonObject;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Validate owned V3 admission rules before a scanner or codec can discard a recoverable tail.
|
|
39
|
+
* This checks only identified structural payloads; physical provenance still belongs to decoding.
|
|
40
|
+
* @param row - parsed physical row, before envelope or compressed-range decoding.
|
|
41
|
+
*/
|
|
42
|
+
export declare function assertV3RowAdmission(row: unknown): void;
|
|
43
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Released-V2 codec and streaming system, canonical-envelope, and PTC migration into V3. */
|
|
2
|
+
export { releasedV2SessionFormatCodec } from '@deepseek-ai/dsh-session-format-v1-to-v2';
|
|
3
|
+
export * from './codec.ts';
|
|
4
|
+
export * from './migration.ts';
|
|
5
|
+
export * from './validation.ts';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Streaming system-prompt promotion followed by canonical V3 envelope conversion. */
|
|
2
|
+
/** Promote system prompts, remap audited references, and canonicalize envelopes and PTC vocabulary. */
|
|
3
|
+
export declare const sessionFormatV2ToV3: import("@deepseek-ai/dsh-session-format").SessionFormatMigration;
|
|
4
|
+
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Audited V2 migration admission and V3 payload validation, independent of installed core Session types. */
|
|
2
|
+
import type { SessionFormatEvent, SessionFormatJsonObject, SessionFormatJsonValue } from '@deepseek-ai/dsh-session-format';
|
|
3
|
+
/** Audited surface event names; all other admitted events are log-only. */
|
|
4
|
+
export declare const SURFACE_TYPES: ReadonlySet<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Require a JSON object at the durable input boundary.
|
|
7
|
+
* @param value - decoded value.
|
|
8
|
+
* @param label - diagnostic subject.
|
|
9
|
+
* @returns the narrowed object.
|
|
10
|
+
*/
|
|
11
|
+
export declare function record(value: SessionFormatJsonValue | undefined, label: string): SessionFormatJsonObject;
|
|
12
|
+
/**
|
|
13
|
+
* Reject missing and unaudited members rather than guessing whether they contain coordinates.
|
|
14
|
+
* @param value - decoded record.
|
|
15
|
+
* @param required - required member names.
|
|
16
|
+
* @param optional - additional admitted names.
|
|
17
|
+
* @param label - diagnostic subject.
|
|
18
|
+
*/
|
|
19
|
+
export declare function keys(value: SessionFormatJsonObject, required: readonly string[], optional: readonly string[], label: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Validate classified payloads before migration, or native V3 system/header payloads.
|
|
22
|
+
* @param event - decoded logical event.
|
|
23
|
+
* @param version - source or target generation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function assertEvent(event: SessionFormatEvent, version: 2 | 3): void;
|
|
26
|
+
/**
|
|
27
|
+
* Recognize stable generated repair IDs without interpreting their historical suffix as a current coordinate.
|
|
28
|
+
* @param id - durable message identity.
|
|
29
|
+
* @param callId - advertised tool identity.
|
|
30
|
+
* @returns whether the identity has the canonical historical repair form.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isRepairIdentity(id: SessionFormatJsonValue | undefined, callId: SessionFormatJsonValue | undefined): callId is string;
|
|
33
|
+
/**
|
|
34
|
+
* Reject V3 structural payload violations even beyond a recoverable physical-row failure.
|
|
35
|
+
* @param value - raw physical row; ordinary rows retain the frozen decoder's recovery policy.
|
|
36
|
+
*/
|
|
37
|
+
export declare function assertV3StructuralRow(value: unknown): void;
|
|
38
|
+
/**
|
|
39
|
+
* Validate one canonical V3 event without interpreting plugin-owned payloads or log relationships.
|
|
40
|
+
* Unclassified metadata is deferred to vocabulary-aware restoration; unknown required types must not become recoverable corruption.
|
|
41
|
+
* @param event - decoded logical event.
|
|
42
|
+
* @param knownEventTypes - additional installed event types whose envelopes are interpreted.
|
|
43
|
+
*/
|
|
44
|
+
export declare function assertV3Event(event: SessionFormatEvent, knownEventTypes?: ReadonlySet<string>): void;
|
|
45
|
+
/**
|
|
46
|
+
* Canonicalize structurally transformed events without changing their target coordinates.
|
|
47
|
+
* @param event - transformed event using released replacement names and target coordinates.
|
|
48
|
+
* @returns a V3 event sharing all unchanged payloads and reference values.
|
|
49
|
+
*/
|
|
50
|
+
export declare function canonicalizeTransformedEvent(event: SessionFormatEvent): SessionFormatEvent;
|
|
51
|
+
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Explicit local-coordinate remapping; captured generations and owner-local counters remain opaque. */
|
|
2
|
+
import type { SessionFormatEvent } from '@deepseek-ai/dsh-session-format';
|
|
3
|
+
/**
|
|
4
|
+
* Remap only audited same-artifact references, preserving IDs and embedded model input.
|
|
5
|
+
* @param event - validated source event.
|
|
6
|
+
* @param seq - output event position.
|
|
7
|
+
* @param mapping - earlier source positions mapped to output positions.
|
|
8
|
+
* @returns the event in target coordinates.
|
|
9
|
+
*/
|
|
10
|
+
export declare function remapEvent(event: SessionFormatEvent, seq: number, mapping: readonly number[]): SessionFormatEvent;
|
|
11
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Native V3 system-head validation with a private view for frozen non-system relationships. */
|
|
2
|
+
import type { SessionFormatArtifact, SessionFormatEvent, SessionFormatHeader } from '@deepseek-ai/dsh-session-format';
|
|
3
|
+
/**
|
|
4
|
+
* Validate v3 logical metadata with the released-v2 fields.
|
|
5
|
+
* @param header - decoded v3 Session header.
|
|
6
|
+
*/
|
|
7
|
+
export declare function assertReleasedV3Header(header: SessionFormatHeader): void;
|
|
8
|
+
/**
|
|
9
|
+
* Validate system ownership, protected-head operations, ordinary relationships, and inherited cut.
|
|
10
|
+
* The private relationship view never escapes; the returned artifact and its messages are unchanged.
|
|
11
|
+
* @param artifact - detached v3 artifact.
|
|
12
|
+
* @param knownEventTypes - event types understood by the installed Session package.
|
|
13
|
+
* @returns the same validated artifact.
|
|
14
|
+
*/
|
|
15
|
+
export declare function restoreReleasedV3Artifact(artifact: SessionFormatArtifact, knownEventTypes: ReadonlySet<string>): SessionFormatArtifact;
|
|
16
|
+
/**
|
|
17
|
+
* Refuse required predecessor PTC tags without interpreting native extension payloads.
|
|
18
|
+
* @param event - event envelope whose type and ignorable admission markers are available.
|
|
19
|
+
*/
|
|
20
|
+
export declare function assertV3EventAdmission(event: SessionFormatEvent): void;
|
|
21
|
+
//# sourceMappingURL=validation.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-session-format-v2-to-v3",
|
|
3
|
+
"description": "Streaming system-prompt, canonical-envelope and PTC migration into V3",
|
|
4
|
+
"version": "0.1.5-alpha.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/session/session-format-v2-to-v3"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/index.js",
|
|
26
|
+
"lib/types/**/*.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dsh": {
|
|
30
|
+
"sessionFormatMigration": {
|
|
31
|
+
"from": 2,
|
|
32
|
+
"to": 3,
|
|
33
|
+
"export": ".",
|
|
34
|
+
"migration": "sessionFormatV2ToV3",
|
|
35
|
+
"sourceCodec": "releasedV2SessionFormatCodec",
|
|
36
|
+
"targetCodec": "releasedV3SessionFormatCodec",
|
|
37
|
+
"targetHeaderValidator": "assertReleasedV3Header",
|
|
38
|
+
"targetRestorer": "restoreReleasedV3Artifact"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@deepseek-ai/dsh-session-format-v0-to-v1": "^0.1.5-alpha.1",
|
|
43
|
+
"@deepseek-ai/dsh-session-format-v1-to-v2": "^0.1.5-alpha.1",
|
|
44
|
+
"@deepseek-ai/dsh-session-format": "^0.1.5-alpha.1"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@deepseek-ai/cordis": "^4.0.2"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@deepseek-ai/cordis": "^4.0.2"
|
|
51
|
+
}
|
|
52
|
+
}
|