@deepseek-ai/dsh-session-format-v0-to-v1 0.1.3-alpha.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.
@@ -0,0 +1,39 @@
1
+ import type { SessionFormatEventRun, SessionFormatHeader, SessionFormatJsonObject, SessionFormatMigrationContext, SessionFormatRecovery } from '@deepseek-ai/dsh-session-format';
2
+ /** A released packed Assistant row retained until v1-to-v2 embeds its compact stream. */
3
+ export interface ReleasedAssistantChunkRun extends SessionFormatEventRun {
4
+ readonly runType: 'released-assistant-chunks';
5
+ readonly turn: number;
6
+ readonly step: number;
7
+ readonly lastSeq: number;
8
+ readonly lastTime: number;
9
+ readonly stream: SessionFormatJsonObject;
10
+ }
11
+ /**
12
+ * Test whether a compact migration item is a released packed Assistant row.
13
+ * @param run - compact migration item to classify.
14
+ * @returns whether the item carries the released Assistant chunk representation.
15
+ */
16
+ export declare function isReleasedAssistantChunkRun(run: SessionFormatEventRun): run is ReleasedAssistantChunkRun;
17
+ /** Frozen physical JSON codec for the released v0 layout. */
18
+ export declare const releasedV0SessionFormatCodec: Readonly<{
19
+ version: 0 | 1;
20
+ decodeHeader: (value: unknown) => SessionFormatHeader;
21
+ createDecoder(headerValue: unknown, recovery: SessionFormatRecovery): {
22
+ header: SessionFormatHeader;
23
+ headerInheritedEventCount: number;
24
+ decodeRow: (rowValue: unknown, context: SessionFormatMigrationContext) => void;
25
+ finish(_context: SessionFormatMigrationContext): number;
26
+ };
27
+ }>;
28
+ /** Frozen physical JSON codec for the shared-layout released v1 format. */
29
+ export declare const releasedV1SessionFormatCodec: Readonly<{
30
+ version: 0 | 1;
31
+ decodeHeader: (value: unknown) => SessionFormatHeader;
32
+ createDecoder(headerValue: unknown, recovery: SessionFormatRecovery): {
33
+ header: SessionFormatHeader;
34
+ headerInheritedEventCount: number;
35
+ decodeRow: (rowValue: unknown, context: SessionFormatMigrationContext) => void;
36
+ finish(_context: SessionFormatMigrationContext): number;
37
+ };
38
+ }>;
39
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1,26 @@
1
+ /** Exact top-level payload disposition frozen for every released-v0 event type. */
2
+ export interface ReleasedV0PayloadDisposition {
3
+ readonly required: readonly string[];
4
+ readonly optional: readonly string[];
5
+ /** JSON members whose nested representation is intentionally owner-opaque. */
6
+ readonly opaque: readonly string[];
7
+ }
8
+ /**
9
+ * Freeze one exact released payload-member disposition for adjacent format validators.
10
+ * @param required - members that must be present.
11
+ * @param optional - additional admitted members.
12
+ * @param opaque - members retained as lossless JSON without nested semantic inspection.
13
+ * @returns the detached frozen disposition.
14
+ */
15
+ export declare function defineReleasedPayloadDisposition(required: readonly string[], optional?: readonly string[], opaque?: readonly string[]): ReleasedV0PayloadDisposition;
16
+ /**
17
+ * Frozen released-v0 event and payload-member inventory.
18
+ * Every listed member is preserved by the identity edge. Members in `opaque`
19
+ * remain lossless JSON without nested Session-sequence interpretation. Nested
20
+ * merge-extensible discriminants validate known variants and preserve
21
+ * unknown variants as owner-opaque JSON.
22
+ */
23
+ export declare const RELEASED_V0_EVENT_DISPOSITIONS: Readonly<Record<string, ReleasedV0PayloadDisposition>>;
24
+ /** Stable sorted released-v0 event inventory. */
25
+ export declare const RELEASED_V0_EVENT_TYPES: readonly string[];
26
+ //# sourceMappingURL=dispositions.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Frozen released-v0 physical codec and identity migration into shared-layout v1. */
2
+ export * from './codec.ts';
3
+ export * from './dispositions.ts';
4
+ export * from './migration.ts';
5
+ export { assertReleasedPayloadSemantics } from './payload-validation.ts';
6
+ export { assertReleasedArtifactRelationships } from './relationships.ts';
7
+ export { assertReleasedSurfaceMetadata, assertReleasedEventPayload, assertReleasedV1Header, restoreReleasedV1Artifact, } from './validation.ts';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Identity format edge that promotes released v0 into released v1. */
2
+ export declare const sessionFormatV0ToV1: import("@deepseek-ai/dsh-session-format").SessionFormatMigration;
3
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { SessionFormatEvent } from '@deepseek-ai/dsh-session-format';
2
+ /**
3
+ * Validate nested released payload semantics for one known event.
4
+ * @param event - known event with exact top-level members.
5
+ * @param version - source or current payload generation.
6
+ */
7
+ export declare function assertReleasedPayloadSemantics(event: SessionFormatEvent, version: number): void;
8
+ //# sourceMappingURL=payload-validation.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { SessionFormatArtifact } from '@deepseek-ai/dsh-session-format';
2
+ /** Relationship roles added by a later format while reusing the released validator. */
3
+ export interface ReleasedRelationshipExtensions {
4
+ /** Event types that must occur inside the current open step. */
5
+ readonly stepEvents?: ReadonlySet<string>;
6
+ /** Title-request model input was source-validated and preserved across sequence remapping. */
7
+ readonly preservedSourceTitleRequestText?: true;
8
+ /** Admit the released resume pattern whose next-turn inbox insert omitted the prior turn/end. */
9
+ readonly legacyInterruptedTurnRestart?: true;
10
+ }
11
+ /**
12
+ * Validate cross-event relationships required to construct one current Session safely.
13
+ * @param artifact - complete normalized v0 or exact current v1 artifact.
14
+ * @param extensions - later-generation event roles interpreted by the calling format owner.
15
+ */
16
+ export declare function assertReleasedArtifactRelationships(artifact: SessionFormatArtifact, extensions?: ReleasedRelationshipExtensions): void;
17
+ //# sourceMappingURL=relationships.d.ts.map
@@ -0,0 +1,18 @@
1
+ import type { SessionFormatArtifact, SessionFormatRecovery } from '@deepseek-ai/dsh-session-format';
2
+ /**
3
+ * Restore released v0 rows through the production decoder and v0-to-v1 stage.
4
+ * @param header - released v0 physical header.
5
+ * @param rows - released v0 physical rows.
6
+ * @param recovery - strict or recoverable row policy.
7
+ * @returns the transformed released v1 artifact.
8
+ */
9
+ export declare function restoreV0ToV1(header: unknown, rows: readonly unknown[], recovery?: SessionFormatRecovery): SessionFormatArtifact;
10
+ /**
11
+ * Restore released v1 rows through the production decoder and current collector.
12
+ * @param header - released v1 physical header.
13
+ * @param rows - released v1 physical rows.
14
+ * @param recovery - strict or recoverable row policy.
15
+ * @returns the restored released v1 artifact.
16
+ */
17
+ export declare function restoreV1(header: unknown, rows: readonly unknown[], recovery?: SessionFormatRecovery): SessionFormatArtifact;
18
+ //# sourceMappingURL=restore.d.ts.map
@@ -0,0 +1,27 @@
1
+ import type { SessionFormatArtifact } from '@deepseek-ai/dsh-session-format';
2
+ /**
3
+ * Validate one decoded released-v0 source artifact in tests.
4
+ * @param artifact - released-v0 source artifact.
5
+ */
6
+ export declare function assertReleasedV0SourceArtifact(artifact: SessionFormatArtifact): void;
7
+ /**
8
+ * Validate normalized v0 output before the identity header bump in tests.
9
+ * @param artifact - normalized v0 artifact.
10
+ */
11
+ export declare function assertNormalizedReleasedV0Artifact(artifact: SessionFormatArtifact): void;
12
+ /**
13
+ * Validate v1 input accepted by the v1-to-v2 migration in tests.
14
+ * @param artifact - v1 migration source artifact.
15
+ */
16
+ export declare function assertReleasedV1MigrationSource(artifact: SessionFormatArtifact): void;
17
+ /**
18
+ * Validate the exact released-v1 logical artifact in tests.
19
+ * @param artifact - released-v1 logical artifact.
20
+ */
21
+ export declare function assertReleasedV1Artifact(artifact: SessionFormatArtifact): void;
22
+ /**
23
+ * Validate released-v1 physical decoding without interpreting event vocabulary in tests.
24
+ * @param artifact - released-v1 physical artifact.
25
+ */
26
+ export declare function assertReleasedV1PhysicalArtifact(artifact: SessionFormatArtifact): void;
27
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { SessionFormatJsonValue } from '@deepseek-ai/dsh-session-format';
2
+ /**
3
+ * Require one plain JSON object.
4
+ * @param value - candidate JSON value.
5
+ * @param label - diagnostic subject.
6
+ * @returns validated object record.
7
+ */
8
+ export declare function releasedV0Record(value: unknown, label: string): Record<string, SessionFormatJsonValue>;
9
+ /**
10
+ * Require every named member and no member outside the optional list.
11
+ * @param record - candidate object.
12
+ * @param required - members that must exist.
13
+ * @param optional - additional admitted members.
14
+ * @param label - diagnostic subject.
15
+ */
16
+ export declare function assertReleasedV0Keys(record: Readonly<Record<string, unknown>>, required: readonly string[], optional: readonly string[] | undefined, label: string): void;
17
+ //# sourceMappingURL=validation-helpers.d.ts.map
@@ -0,0 +1,43 @@
1
+ import type { SessionFormatArtifact, SessionFormatEvent, SessionFormatHeader, SessionFormatJsonValue } from '@deepseek-ai/dsh-session-format';
2
+ /**
3
+ * Validate the logical header shared by released v0 and v1.
4
+ * @param header - detached logical header.
5
+ * @param version - exact expected generation.
6
+ */
7
+ export declare function assertReleasedSessionFormatHeader(header: SessionFormatHeader, version: 0 | 1): void;
8
+ /**
9
+ * Validate one released-v1 logical header.
10
+ * @param header - detached logical header.
11
+ */
12
+ export declare function assertReleasedV1Header(header: SessionFormatHeader): void;
13
+ /**
14
+ * Restore v1 against the installed build's ordinary event vocabulary without freezing payload additions.
15
+ * @param artifact - vocabulary-neutral released-v1 physical decode.
16
+ * @param knownEventTypes - event types understood by the installed current Session package.
17
+ * @returns the same validated detached artifact.
18
+ */
19
+ export declare function restoreReleasedV1Artifact(artifact: SessionFormatArtifact, knownEventTypes: ReadonlySet<string>): SessionFormatArtifact;
20
+ /**
21
+ * Validate released-v0/v1 artifact coordinates under an explicit vocabulary policy.
22
+ * @param artifact - logical artifact to validate.
23
+ * @param allowLegacySteering - whether to accept the retired steering event name.
24
+ * @param knownEventTypes - installed event vocabulary, when vocabulary-aware.
25
+ * @param vocabularyNeutral - whether unknown event types remain opaque.
26
+ * @param frozenEnvelope - whether event envelopes must already be frozen.
27
+ */
28
+ export declare function assertReleasedArtifactCoordinates(artifact: SessionFormatArtifact, allowLegacySteering: boolean, knownEventTypes?: ReadonlySet<string>, vocabularyNeutral?: boolean, frozenEnvelope?: boolean): void;
29
+ /**
30
+ * Validate shared-layout surface references for one released generation.
31
+ * @param record - exact event envelope.
32
+ * @param seq - event position used for earlier-reference checks.
33
+ * @param type - surface event type used in diagnostics.
34
+ * @param assistantSources - whether this generation admits empty Assistant chunk provenance.
35
+ */
36
+ export declare function assertReleasedSurfaceMetadata(record: Record<string, SessionFormatJsonValue>, seq: number, type: string, assistantSources: 'allow-empty-assistant' | 'forbid-assistant'): void;
37
+ /**
38
+ * Validate one exact known payload after legacy normalization.
39
+ * @param event - known event to validate.
40
+ * @param version - payload generation controlling versioned members.
41
+ */
42
+ export declare function assertReleasedEventPayload(event: SessionFormatEvent, version: 0 | 1): void;
43
+ //# sourceMappingURL=validation.d.ts.map
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-session-format-v0-to-v1",
3
+ "description": "Frozen released-v0 Session codec and identity migration to v1",
4
+ "version": "0.1.3-alpha.2",
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-v0-to-v1"
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": 0,
32
+ "to": 1,
33
+ "export": ".",
34
+ "migration": "sessionFormatV0ToV1",
35
+ "sourceCodec": "releasedV0SessionFormatCodec",
36
+ "targetCodec": "releasedV1SessionFormatCodec",
37
+ "targetHeaderValidator": "assertReleasedV1Header",
38
+ "targetRestorer": "restoreReleasedV1Artifact"
39
+ }
40
+ },
41
+ "dependencies": {
42
+ "@deepseek-ai/dsh-session-format": "^0.1.3-alpha.2",
43
+ "@deepseek-ai/dsh-util-values": "^0.1.3-alpha.2"
44
+ },
45
+ "peerDependencies": {
46
+ "@deepseek-ai/cordis": "^4.0.2"
47
+ },
48
+ "devDependencies": {
49
+ "@deepseek-ai/cordis": "^4.0.2",
50
+ "@deepseek-ai/dsh-session": "^0.1.3-alpha.2"
51
+ }
52
+ }