@morlay/session-branch 0.1.9 → 0.1.10-alpha.0
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 +0 -10
- package/dist/index.mjs +4 -8
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
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
|
-
//#region src/types.d.ts
|
|
5
4
|
export declare const SESSION_BRANCH_VERSION_SCHEMA = 1;
|
|
6
5
|
export type CascadePolicy = "truncate" | "preserve";
|
|
7
6
|
export type VersionOperation = "edit" | "reroll" | "retry" | "fork" | "rewind";
|
|
@@ -54,8 +53,6 @@ export declare class SessionBranchError extends Error {
|
|
|
54
53
|
readonly code: SessionBranchErrorCode;
|
|
55
54
|
constructor(message: string, code: SessionBranchErrorCode);
|
|
56
55
|
}
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/provider.d.ts
|
|
59
56
|
type BranchAnchorMode = "after" | "before";
|
|
60
57
|
interface SessionBranchProvider {
|
|
61
58
|
readonly name: string;
|
|
@@ -63,28 +60,21 @@ interface SessionBranchProvider {
|
|
|
63
60
|
forkFrom(sourceId: SessionId, options?: ForkFromOptions, signal?: AbortSignal): Promise<SessionId>;
|
|
64
61
|
rewind(id: SessionId, toBoundary: number, signal?: AbortSignal): Promise<SessionPersistenceSnapshot>;
|
|
65
62
|
}
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/branch.d.ts
|
|
68
63
|
export declare abstract class SessionBranch extends Service {
|
|
69
64
|
constructor(ctx: import("@deepseek-ai/cordis").Context);
|
|
70
65
|
abstract readBranchPrefix(id: SessionId, atSeq?: number, mode?: BranchAnchorMode, signal?: AbortSignal): Promise<BranchBoundary>;
|
|
71
66
|
abstract forkFrom(sourceId: SessionId, options?: ForkFromOptions, signal?: AbortSignal): Promise<SessionId>;
|
|
72
67
|
abstract rewind(id: SessionId, toBoundary: number, signal?: AbortSignal): Promise<SessionPersistenceSnapshot>;
|
|
73
68
|
}
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/balance.d.ts
|
|
76
69
|
interface BalanceRewindPrefixOptions {
|
|
77
70
|
keepOpenTail?: boolean;
|
|
78
71
|
}
|
|
79
72
|
export declare function balanceRewindPrefix(events: readonly SessionEvent[], options?: BalanceRewindPrefixOptions): SessionEvent[];
|
|
80
73
|
export declare function rewindKeepLength(types: readonly string[], rawKeepLength: number): number;
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/index.d.ts
|
|
83
74
|
declare module "@deepseek-ai/cordis" {
|
|
84
75
|
interface Context {
|
|
85
76
|
sessionBranch: SessionBranch;
|
|
86
77
|
}
|
|
87
78
|
}
|
|
88
79
|
export declare function apply(_ctx: Context): void;
|
|
89
|
-
//#endregion
|
|
90
80
|
export type { BranchAnchorMode, SessionBranchProvider };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Service } from "@deepseek-ai/cordis";
|
|
2
|
-
|
|
2
|
+
// src/branch.ts
|
|
3
3
|
var SessionBranch = class extends Service {
|
|
4
4
|
constructor(ctx) {
|
|
5
5
|
super(ctx, "sessionBranch");
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
//#region src/balance.ts
|
|
8
|
+
// src/balance.ts
|
|
10
9
|
function balanceRewindPrefix(events, options = {}) {
|
|
11
10
|
let keep = events.length;
|
|
12
11
|
let openIndex = -1;
|
|
@@ -54,8 +53,7 @@ function rewindKeepLength(types, rawKeepLength) {
|
|
|
54
53
|
}
|
|
55
54
|
return Math.max(0, rawKeepLength - types.length + relativeKeep);
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
//#region src/types.ts
|
|
56
|
+
// src/types.ts
|
|
59
57
|
const SESSION_BRANCH_VERSION_SCHEMA = 1;
|
|
60
58
|
var SessionBranchError = class extends Error {
|
|
61
59
|
code;
|
|
@@ -65,8 +63,6 @@ var SessionBranchError = class extends Error {
|
|
|
65
63
|
this.code = code;
|
|
66
64
|
}
|
|
67
65
|
};
|
|
68
|
-
|
|
69
|
-
//#region src/index.ts
|
|
66
|
+
// src/index.ts
|
|
70
67
|
function apply(_ctx) {}
|
|
71
|
-
//#endregion
|
|
72
68
|
export { SESSION_BRANCH_VERSION_SCHEMA, SessionBranch, SessionBranchError, apply, balanceRewindPrefix, rewindKeepLength };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/session-branch",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10-alpha.0",
|
|
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",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"./locale/*.json": "./locale/*.json"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
35
|
-
"@deepseek-ai/dsh-session": "^0.2.
|
|
36
|
-
"@deepseek-ai/dsh-session-persistence": "^0.2.
|
|
34
|
+
"@deepseek-ai/cordis": "^4.0.6-alpha.1",
|
|
35
|
+
"@deepseek-ai/dsh-session": "^0.2.2-alpha.2",
|
|
36
|
+
"@deepseek-ai/dsh-session-persistence": "^0.2.2-alpha.2"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"dsh": ">= 0.2.
|
|
39
|
+
"dsh": ">= 0.2.2-alpha.2 < 0.2.3"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "pnpm exec tsdown"
|