@morlay/session-branch 0.1.2 → 0.1.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/dist/index.d.mts +17 -17
- package/dist/invariant.d.mts +4 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,11 +2,11 @@ import { Context, Service } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import { SessionEvent, SessionId } from "@deepseek-ai/dsh-session";
|
|
3
3
|
import { SessionPersistenceSnapshot } from "@deepseek-ai/dsh-session-persistence";
|
|
4
4
|
//#region src/types.d.ts
|
|
5
|
-
declare const SESSION_BRANCH_VERSION_SCHEMA = 1;
|
|
6
|
-
type CascadePolicy = "truncate" | "preserve";
|
|
7
|
-
type VersionOperation = "edit" | "reroll" | "retry" | "fork" | "rewind";
|
|
8
|
-
type EditableBlockKind = "user" | "assistant.reasoning" | "assistant.response";
|
|
9
|
-
interface SessionBranchEffect {
|
|
5
|
+
export declare const SESSION_BRANCH_VERSION_SCHEMA = 1;
|
|
6
|
+
export type CascadePolicy = "truncate" | "preserve";
|
|
7
|
+
export type VersionOperation = "edit" | "reroll" | "retry" | "fork" | "rewind";
|
|
8
|
+
export type EditableBlockKind = "user" | "assistant.reasoning" | "assistant.response";
|
|
9
|
+
export interface SessionBranchEffect {
|
|
10
10
|
id: string;
|
|
11
11
|
operation: VersionOperation;
|
|
12
12
|
cascade: CascadePolicy;
|
|
@@ -17,11 +17,11 @@ interface SessionBranchEffect {
|
|
|
17
17
|
before?: string;
|
|
18
18
|
after?: string;
|
|
19
19
|
}
|
|
20
|
-
interface SessionBranchInverse {
|
|
20
|
+
export interface SessionBranchInverse {
|
|
21
21
|
kind: "restore-version";
|
|
22
22
|
sessionId: SessionId;
|
|
23
23
|
}
|
|
24
|
-
interface SessionBranchVersionEvent {
|
|
24
|
+
export interface SessionBranchVersionEvent {
|
|
25
25
|
schemaVersion: typeof SESSION_BRANCH_VERSION_SCHEMA;
|
|
26
26
|
effect: SessionBranchEffect;
|
|
27
27
|
inverse: SessionBranchInverse;
|
|
@@ -31,26 +31,26 @@ declare module "@deepseek-ai/dsh-session" {
|
|
|
31
31
|
"session-branch/version": SessionBranchVersionEvent;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
interface BranchBoundary {
|
|
34
|
+
export interface BranchBoundary {
|
|
35
35
|
seq: number;
|
|
36
36
|
events: readonly SessionEvent[];
|
|
37
37
|
}
|
|
38
|
-
interface BranchForkMeta {
|
|
38
|
+
export interface BranchForkMeta {
|
|
39
39
|
cwd?: string;
|
|
40
40
|
createdAt?: number;
|
|
41
41
|
agentPreset?: string;
|
|
42
42
|
origin?: "subagent";
|
|
43
43
|
delegationDepth?: number;
|
|
44
44
|
}
|
|
45
|
-
interface ForkFromOptions {
|
|
45
|
+
export interface ForkFromOptions {
|
|
46
46
|
atSeq?: number;
|
|
47
47
|
anchorMode?: BranchAnchorMode;
|
|
48
48
|
seedSuffix?: readonly SessionEvent[];
|
|
49
49
|
childSessionId?: SessionId;
|
|
50
50
|
meta?: BranchForkMeta;
|
|
51
51
|
}
|
|
52
|
-
type SessionBranchErrorCode = "SESSION_NOT_FOUND" | "INVALID_BOUNDARY" | "OPEN_TURN" | "FORK_UNAVAILABLE" | "REWIND_CONFLICT";
|
|
53
|
-
declare class SessionBranchError extends Error {
|
|
52
|
+
export type SessionBranchErrorCode = "SESSION_NOT_FOUND" | "INVALID_BOUNDARY" | "OPEN_TURN" | "FORK_UNAVAILABLE" | "REWIND_CONFLICT";
|
|
53
|
+
export declare class SessionBranchError extends Error {
|
|
54
54
|
readonly code: SessionBranchErrorCode;
|
|
55
55
|
constructor(message: string, code: SessionBranchErrorCode);
|
|
56
56
|
}
|
|
@@ -65,7 +65,7 @@ interface SessionBranchProvider {
|
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/branch.d.ts
|
|
68
|
-
declare abstract class SessionBranch extends Service {
|
|
68
|
+
export declare abstract class SessionBranch extends Service {
|
|
69
69
|
constructor(ctx: import("@deepseek-ai/cordis").Context);
|
|
70
70
|
abstract readBranchPrefix(id: SessionId, atSeq?: number, mode?: BranchAnchorMode, signal?: AbortSignal): Promise<BranchBoundary>;
|
|
71
71
|
abstract forkFrom(sourceId: SessionId, options?: ForkFromOptions, signal?: AbortSignal): Promise<SessionId>;
|
|
@@ -76,8 +76,8 @@ declare abstract class SessionBranch extends Service {
|
|
|
76
76
|
interface BalanceRewindPrefixOptions {
|
|
77
77
|
keepOpenTail?: boolean;
|
|
78
78
|
}
|
|
79
|
-
declare function balanceRewindPrefix(events: readonly SessionEvent[], options?: BalanceRewindPrefixOptions): SessionEvent[];
|
|
80
|
-
declare function rewindKeepLength(types: readonly string[], rawKeepLength: number): number;
|
|
79
|
+
export declare function balanceRewindPrefix(events: readonly SessionEvent[], options?: BalanceRewindPrefixOptions): SessionEvent[];
|
|
80
|
+
export declare function rewindKeepLength(types: readonly string[], rawKeepLength: number): number;
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/index.d.ts
|
|
83
83
|
declare module "@deepseek-ai/cordis" {
|
|
@@ -85,6 +85,6 @@ declare module "@deepseek-ai/cordis" {
|
|
|
85
85
|
sessionBranch: SessionBranch;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
declare function apply(_ctx: Context): void;
|
|
88
|
+
export declare function apply(_ctx: Context): void;
|
|
89
89
|
//#endregion
|
|
90
|
-
export {
|
|
90
|
+
export type { BranchAnchorMode, SessionBranchProvider };
|
package/dist/invariant.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
//#region src/invariant.d.ts
|
|
3
|
-
declare const name = "session-branch-invariant";
|
|
4
|
-
declare const inject: string[];
|
|
5
|
-
declare const apply: (ctx: Context) => Promise<() => void>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { apply, inject, name };
|
|
3
|
+
export declare const name = "session-branch-invariant";
|
|
4
|
+
export declare const inject: string[];
|
|
5
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
6
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/session-branch",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Contract layer for branch-based session editing: the provider abstraction (rewind / forkFrom / readBranchPrefix) plus the high-level service over DeepSeek Harness event-sourced sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|