@deepseek-ai/dsh-session-title 0.2.0-rc.1 → 0.2.1-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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-session-title",
3
3
  "description": "Log-backed session title service and provider registry for the DeepSeek Harness",
4
- "version": "0.2.0-rc.1",
4
+ "version": "0.2.1-alpha.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -18,10 +18,6 @@
18
18
  "types": "./lib/types/index.d.ts",
19
19
  "default": "./lib/index.js"
20
20
  },
21
- "./invariant": {
22
- "types": "./lib/types/invariant.d.ts",
23
- "default": "./lib/invariant.js"
24
- },
25
21
  "./types": {
26
22
  "types": "./lib/types/types.d.ts",
27
23
  "default": "./lib/types/types.js"
@@ -35,34 +31,31 @@
35
31
  },
36
32
  "files": [
37
33
  "lib/index.js",
38
- "lib/invariant.js",
39
34
  "lib/types/**/*.js",
40
35
  "lib/types/**/*.d.ts"
41
36
  ],
42
37
  "license": "MIT",
43
38
  "peerDependencies": {
44
- "@deepseek-ai/cordis": "~4.0.4",
45
- "@deepseek-ai/dsh-agent": "0.2.0-rc.1",
46
- "@deepseek-ai/dsh-brand": "0.2.0-rc.1",
47
- "@deepseek-ai/dsh-llm": "0.2.0-rc.1",
48
- "@deepseek-ai/dsh-session": "0.2.0-rc.1",
49
- "@deepseek-ai/dsh-invariants": "0.2.0-rc.1",
50
- "@deepseek-ai/dsh-session-projection": "0.2.0-rc.1"
39
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
40
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
41
+ "@deepseek-ai/dsh-brand": "0.2.1-alpha.1",
42
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
43
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.1",
44
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1"
51
45
  },
52
46
  "dependencies": {
53
47
  "zod": "^4.4.3",
54
- "@deepseek-ai/schemastery": "~3.18.4",
55
- "@deepseek-ai/dsh-util-values": "0.2.0-rc.1"
48
+ "@deepseek-ai/dsh-util-values": "0.2.1-alpha.1",
49
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
56
50
  },
57
51
  "devDependencies": {
58
- "@deepseek-ai/cordis": "~4.0.4",
59
- "@deepseek-ai/dsh-agent": "0.2.0-rc.1",
60
- "@deepseek-ai/dsh-agent-loop": "0.2.0-rc.1",
61
- "@deepseek-ai/dsh-brand": "0.2.0-rc.1",
62
- "@deepseek-ai/dsh-llm": "0.2.0-rc.1",
63
- "@deepseek-ai/dsh-session": "0.2.0-rc.1",
64
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.0-rc.1",
65
- "@deepseek-ai/dsh-invariants": "0.2.0-rc.1",
66
- "@deepseek-ai/dsh-session-projection": "0.2.0-rc.1"
52
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
53
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
54
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.1",
55
+ "@deepseek-ai/dsh-brand": "0.2.1-alpha.1",
56
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.1",
57
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.1",
58
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
59
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1"
67
60
  }
68
61
  }
package/lib/invariant.js DELETED
@@ -1,59 +0,0 @@
1
- import { SessionSeq } from "@deepseek-ai/dsh-session";
2
- //#region lib/types/invariant.js
3
- /**
4
- * Package-owned invariant companion for `@deepseek-ai/dsh-session-title`.
5
- * @module @deepseek-ai/dsh-session-title/invariant
6
- */
7
- const PACKAGE_NAME = "@deepseek-ai/dsh-session-title";
8
- /** Cordis companion plugin name. */
9
- const name = "session-title-invariant";
10
- /** Service required before the companion can reserve package ownership. */
11
- const inject = ["invariants"];
12
- /**
13
- * Durable title-source invariant: an automatic title always cites at
14
- * least one human `user/message` seq, and an explicit user rename cites none
15
- * — `messageSeqs` is empty iff `source.kind` is `user`. Provider revisions
16
- * are validated by the service before their append; this checks the durable
17
- * relationship every appended `session/title` event must keep, whichever
18
- * writer produced it.
19
- */
20
- function validate(session, event, fail) {
21
- const { source, messageSeqs } = event.data;
22
- if (messageSeqs.length === 0 !== (source.kind === "user")) {
23
- const requirement = source.kind === "user" ? "cite no message seqs" : "cite at least one message seq";
24
- fail(`session/title event ${String(event.seq)} with source "${source.kind}" must ${requirement}; got ${String(messageSeqs.length)}`);
25
- }
26
- const seen = /* @__PURE__ */ new Set();
27
- for (const seq of messageSeqs) {
28
- let checked;
29
- try {
30
- checked = SessionSeq(seq);
31
- } catch {
32
- fail(`session/title event ${String(event.seq)} has an invalid message seq ${String(seq)}`);
33
- }
34
- if (seen.has(checked)) fail(`session/title event ${String(event.seq)} repeats message seq ${checked}`);
35
- seen.add(checked);
36
- const cited = checked < event.seq ? session.eventAt(checked) : void 0;
37
- if (cited?.type !== "user/message" || cited.data.source.kind !== "user") fail(`session/title event ${String(event.seq)} message seq ${checked} must name an earlier human user/message`);
38
- }
39
- }
40
- const install = Object.assign((ctx, fail) => {
41
- const validateExisting = (session) => {
42
- for (const event of session.snapshotEvents()) if (event.type === "session/title") validate(session, event, fail);
43
- };
44
- ctx.sessions.list().forEach(validateExisting);
45
- ctx.on("session/created", validateExisting, { global: true });
46
- ctx.on("internal/dispatch", (_mode, eventName, args) => {
47
- if (eventName !== "session/event") return;
48
- const [session, event] = args;
49
- if (event.type === "session/title") validate(session, event, fail);
50
- }, { global: true });
51
- }, { inject: ["sessions"] });
52
- /**
53
- * Register this package's invariant companion.
54
- * @param ctx - Cordis context carrying the invariant service.
55
- * @returns the installed registration's disposer after setup succeeds.
56
- */
57
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
58
- //#endregion
59
- export { apply, inject, name };
@@ -1,16 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@deepseek-ai/dsh-session-title`.
3
- * @module @deepseek-ai/dsh-session-title/invariant
4
- */
5
- import type { Context } from '@deepseek-ai/cordis';
6
- /** Cordis companion plugin name. */
7
- export declare const name = "session-title-invariant";
8
- /** Service required before the companion can reserve package ownership. */
9
- export declare const inject: string[];
10
- /**
11
- * Register this package's invariant companion.
12
- * @param ctx - Cordis context carrying the invariant service.
13
- * @returns the installed registration's disposer after setup succeeds.
14
- */
15
- export declare const apply: (ctx: Context) => Promise<() => void>;
16
- //# sourceMappingURL=invariant.d.ts.map
@@ -1,72 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@deepseek-ai/dsh-session-title`.
3
- * @module @deepseek-ai/dsh-session-title/invariant
4
- */
5
- import { SessionSeq } from '@deepseek-ai/dsh-session';
6
- const PACKAGE_NAME = '@deepseek-ai/dsh-session-title';
7
- /** Cordis companion plugin name. */
8
- export const name = 'session-title-invariant';
9
- /** Service required before the companion can reserve package ownership. */
10
- export const inject = ['invariants'];
11
- /**
12
- * Durable title-source invariant: an automatic title always cites at
13
- * least one human `user/message` seq, and an explicit user rename cites none
14
- * — `messageSeqs` is empty iff `source.kind` is `user`. Provider revisions
15
- * are validated by the service before their append; this checks the durable
16
- * relationship every appended `session/title` event must keep, whichever
17
- * writer produced it.
18
- */
19
- function validate(session, event, fail) {
20
- const { source, messageSeqs } = event.data;
21
- if ((messageSeqs.length === 0) !== (source.kind === 'user')) {
22
- const requirement = source.kind === 'user' ? 'cite no message seqs' : 'cite at least one message seq';
23
- fail(`session/title event ${String(event.seq)} with source "${source.kind}" must ${requirement}; got ${String(messageSeqs.length)}`);
24
- }
25
- const seen = new Set();
26
- for (const seq of messageSeqs) {
27
- let checked;
28
- try {
29
- checked = SessionSeq(seq);
30
- }
31
- catch {
32
- fail(`session/title event ${String(event.seq)} has an invalid message seq ${String(seq)}`);
33
- }
34
- if (seen.has(checked)) {
35
- fail(`session/title event ${String(event.seq)} repeats message seq ${checked}`);
36
- }
37
- seen.add(checked);
38
- // oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
39
- const cited = checked < event.seq ? session.eventAt(checked) : undefined;
40
- if (cited?.type !== 'user/message' || cited.data.source.kind !== 'user') {
41
- fail(`session/title event ${String(event.seq)} message seq ${checked} must name an earlier human user/message`);
42
- }
43
- }
44
- }
45
- const install = Object.assign((ctx, fail) => {
46
- const validateExisting = (session) => {
47
- // oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
48
- for (const event of session.snapshotEvents()) {
49
- if (event.type === 'session/title')
50
- validate(session, event, fail);
51
- }
52
- };
53
- ctx.sessions.list().forEach(validateExisting);
54
- ctx.on('session/created', validateExisting, { global: true });
55
- // internal/dispatch interception rejects the append before publication
56
- // (the session/event listener would only observe the already-committed log).
57
- ctx.on('internal/dispatch', (_mode, eventName, args) => {
58
- if (eventName !== 'session/event')
59
- return;
60
- const [session, event] = args;
61
- if (event.type === 'session/title')
62
- validate(session, event, fail);
63
- }, { global: true });
64
- }, { inject: ['sessions'] });
65
- /**
66
- * Register this package's invariant companion.
67
- * @param ctx - Cordis context carrying the invariant service.
68
- * @returns the installed registration's disposer after setup succeeds.
69
- */
70
- export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
71
- /* jscpd:ignore-end */
72
- //# sourceMappingURL=invariant.js.map