@deepseek-ai/dsh-client-connection 0.1.2-alpha.3 → 0.1.2-alpha.5

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/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/client/connection/README.md
5
- README.md: ee0566bf811a0bad32f7d59b4c8849e26efea613
6
- README.zh.md: 48425a428247b7749bf0dd75f592b5f7e4088ef2
5
+ README.md: 54acac0ed815ea24a4a30a80d0b13eb6ceda6b47
6
+ README.zh.md: 46c7d0b20e3b7a27db963866949d01f1ee96781a
package/README.md CHANGED
@@ -72,3 +72,5 @@ None; this package neither assembles nor sends a provider request.
72
72
  None.
73
73
 
74
74
  </details>
75
+
76
+ **Runtime invariant:** No companion is published. Browser-session verification reads the credential record asynchronously at the request that authorizes work, while the credentials companion owns record commit-event lifetime. Stream/reconnect sequencing and rpcId round-trip discipline are exercised directly by behavior specs, and route register/dispose symmetry is audited by the webserver companion.
package/README.zh.md CHANGED
@@ -72,3 +72,5 @@ API Gateway Client 把内部 `$events` logical stream 注册为唯一 generation
72
72
  无。
73
73
 
74
74
  </details>
75
+
76
+ **运行时不变式:** 不发布伴生入口。授权请求会异步读取 credential 权威记录,commit-event 生命周期由 credentials 伴生入口负责;流、重连、rpcId 与路由释放关系由行为测试及 webserver 不变式覆盖。
package/lib/client.js CHANGED
@@ -269,14 +269,14 @@ window.__ModuleLoader__.load({
269
269
  //#endregion
270
270
  //#region ../../util/brand/lib/index.js
271
271
  /**
272
- * Duplicate-install-safe nominal string helpers.
272
+ * Duplicate-install-safe nominal primitive helpers.
273
273
  *
274
- * A brand makes structurally-identical strings non-interchangeable at the type
275
- * level: a `SessionId` cannot be passed where a `ToolCallId` is expected, even
276
- * though both are plain strings at runtime. Comparison, logging, and
277
- * serialization all behave as ordinary strings.
274
+ * A brand makes structurally identical strings or numbers non-interchangeable
275
+ * at the type level: a `SessionId` cannot be passed where a `ToolCallId` is
276
+ * expected, and an event sequence cannot be passed as a log offset. Comparison,
277
+ * logging, and serialization retain the underlying primitive behavior.
278
278
  *
279
- * This package owns no concrete id and keeps no runtime identity or mutable
279
+ * This package owns no concrete domain value and keeps no runtime identity or mutable
280
280
  * state, so independently installed copies produce interchangeable values.
281
281
  *
282
282
  * @module @deepseek-ai/dsh-brand
@@ -289,6 +289,14 @@ window.__ModuleLoader__.load({
289
289
  function brandString(value) {
290
290
  return value;
291
291
  }
292
+ /**
293
+ * Apply a compile-time number brand without changing the value.
294
+ * @param value - number admitted by the domain that owns the target brand.
295
+ * @returns the same number with the requested compile-time brand.
296
+ */
297
+ function brandNumber(value) {
298
+ return value;
299
+ }
292
300
  //#endregion
293
301
  //#region ../../util/values/lib/index.js
294
302
  /**
@@ -401,6 +409,26 @@ window.__ModuleLoader__.load({
401
409
  });
402
410
  }
403
411
  //#endregion
412
+ //#region ../../core/session/lib/types/types.js
413
+ /**
414
+ * Admit a numeric value as an existing Session event position.
415
+ * @param value - non-negative safe integer admitted by the owning log operation.
416
+ * @returns the same number with the Session-sequence brand.
417
+ */
418
+ function SessionSeq(value) {
419
+ if (!Number.isSafeInteger(value) || value < 0 || Object.is(value, -0)) throw new TypeError(`SessionSeq must be a non-negative safe integer, got ${String(value)}`);
420
+ return brandNumber(value);
421
+ }
422
+ /**
423
+ * Admit a numeric value as a Session log offset.
424
+ * @param value - non-negative safe integer used as a gap or prefix length.
425
+ * @returns the same number with the Session-log-offset brand.
426
+ */
427
+ function SessionLogOffset(value) {
428
+ if (!Number.isSafeInteger(value) || value < 0 || Object.is(value, -0)) throw new TypeError(`SessionLogOffset must be a non-negative safe integer, got ${String(value)}`);
429
+ return brandNumber(value);
430
+ }
431
+ //#endregion
404
432
  //#region ../../core/session/lib/types/chunk-rows.js
405
433
  /**
406
434
  * Lossless row packing for `assistant/chunk` delta runs. Providers stream
@@ -411,7 +439,7 @@ window.__ModuleLoader__.load({
411
439
  * `tool-call-chunks` — and expands rows back to the exact original events.
412
440
  *
413
441
  * Packed rows are an encoding vocabulary, NOT session events: they never enter
414
- * `Session.events`, have no `SessionEventMap` entry, and use bare (slash-less)
442
+ * `Session.snapshotEvents()`, have no `SessionEventMap` entry, and use bare (slash-less)
415
443
  * type tags so a reader cannot confuse them with the event taxonomy
416
444
  * (precedent: the JSONL header line's `session` tag). Persistence and bounded
417
445
  * history transport both use the codec. The encoder whitelists exact shapes —
@@ -459,7 +487,7 @@ window.__ModuleLoader__.load({
459
487
  "time",
460
488
  "data"
461
489
  ])) return void 0;
462
- if (!Number.isSafeInteger(event.seq) || event.seq < 0 || !Number.isSafeInteger(event.time)) return void 0;
490
+ if (!Number.isSafeInteger(event.seq) || event.seq < 0 || Object.is(event.seq, -0) || !Number.isSafeInteger(event.time)) return void 0;
463
491
  const data = event.data;
464
492
  if (!isRecord$1(data) || !hasExactKeys(data, [
465
493
  "turn",
@@ -647,7 +675,7 @@ window.__ModuleLoader__.load({
647
675
  }
648
676
  /** Whether a runtime value is a non-negative safe event sequence. */
649
677
  function isEventSeq(value) {
650
- return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
678
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && !Object.is(value, -0);
651
679
  }
652
680
  /** Whether a runtime value is the exact positional-replacement shape. */
653
681
  function isReplaceOp(value) {
@@ -798,7 +826,7 @@ window.__ModuleLoader__.load({
798
826
  const state = createFoldState();
799
827
  const replacements = [];
800
828
  for (const [index, event] of events.entries()) {
801
- const replacement = applySurfaceEvent(state, event, index, events, 0);
829
+ const replacement = applySurfaceEvent(state, event, SessionSeq(index), events, SessionLogOffset(0));
802
830
  if (replacement !== void 0) replacements.push(replacement);
803
831
  }
804
832
  return {
@@ -2628,7 +2656,7 @@ window.__ModuleLoader__.load({
2628
2656
  const append = (id, e) => {
2629
2657
  const log = logOf(id);
2630
2658
  const event = {
2631
- seq: log.length,
2659
+ seq: SessionSeq(log.length),
2632
2660
  time: Date.now(),
2633
2661
  ...e
2634
2662
  };
@@ -3563,7 +3591,7 @@ window.__ModuleLoader__.load({
3563
3591
  log.push({
3564
3592
  type: "user/message",
3565
3593
  surfaceOp: "append",
3566
- seq: log.length,
3594
+ seq: SessionSeq(log.length),
3567
3595
  time: Date.now(),
3568
3596
  data: userMessage(text(msg))
3569
3597
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-connection",
3
3
  "description": "Authenticated RPC transport, generation lifecycle, and browser fixture",
4
- "version": "0.1.2-alpha.3",
4
+ "version": "0.1.2-alpha.5",
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
  "./client": {
26
22
  "types": "./lib/types/client/index.d.ts",
27
23
  "default": "./lib/client.js"
@@ -39,12 +35,11 @@
39
35
  "license": "MIT",
40
36
  "dependencies": {
41
37
  "zod": "^4.4.3",
42
- "@deepseek-ai/dsh-credentials": "^0.1.2-alpha.3",
38
+ "@deepseek-ai/dsh-credentials": "^0.1.2-alpha.5",
43
39
  "@deepseek-ai/schemastery": "^3.18.2"
44
40
  },
45
41
  "files": [
46
42
  "lib/index.js",
47
- "lib/invariant.js",
48
43
  "lib/client.js",
49
44
  "lib/types/**/*.d.ts"
50
45
  ],
@@ -53,16 +48,15 @@
53
48
  },
54
49
  "devDependencies": {
55
50
  "@deepseek-ai/cordis": "^4.0.2",
56
- "@deepseek-ai/dsh-attachment": "^0.1.2-alpha.3",
57
- "@deepseek-ai/dsh-brand": "^0.1.2-alpha.3",
58
- "@deepseek-ai/dsh-commands": "^0.1.2-alpha.3",
59
- "@deepseek-ai/dsh-host-directory-picker": "^0.1.2-alpha.3",
60
- "@deepseek-ai/dsh-host-webserver": "^0.1.2-alpha.3",
61
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.3",
62
- "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
63
- "@deepseek-ai/dsh-settings": "^0.1.2-alpha.3",
64
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.3",
65
- "@deepseek-ai/dsh-tool-todo": "^0.1.2-alpha.3",
66
- "@deepseek-ai/dsh-util-values": "^0.1.2-alpha.3"
51
+ "@deepseek-ai/dsh-attachment": "^0.1.2-alpha.5",
52
+ "@deepseek-ai/dsh-brand": "^0.1.2-alpha.5",
53
+ "@deepseek-ai/dsh-commands": "^0.1.2-alpha.5",
54
+ "@deepseek-ai/dsh-host-directory-picker": "^0.1.2-alpha.5",
55
+ "@deepseek-ai/dsh-host-webserver": "^0.1.2-alpha.5",
56
+ "@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
57
+ "@deepseek-ai/dsh-settings": "^0.1.2-alpha.5",
58
+ "@deepseek-ai/dsh-tool-todo": "^0.1.2-alpha.5",
59
+ "@deepseek-ai/dsh-util-values": "^0.1.2-alpha.5",
60
+ "@deepseek-ai/dsh-session": "^0.1.2-alpha.5"
67
61
  }
68
62
  }
package/lib/invariant.js DELETED
@@ -1,27 +0,0 @@
1
- //#region lib/types/invariant.js
2
- /**
3
- * Package-owned invariant companion for `@deepseek-ai/dsh-client-connection`.
4
- * @module @deepseek-ai/dsh-client-connection/invariant
5
- */
6
- const PACKAGE_NAME = "@deepseek-ai/dsh-client-connection";
7
- /** Cordis companion plugin name. */
8
- const name = "client-connection-invariant";
9
- /** Service required before the companion can reserve package ownership. */
10
- const inject = ["invariants"];
11
- /**
12
- * No runtime invariant: browser-session verification reads the credential
13
- * record asynchronously at the request that authorizes work, while the
14
- * credentials companion owns record commit-event lifetime. Stream/reconnect
15
- * sequencing and rpcId round-trip discipline are exercised directly by
16
- * behavior specs, and route register/dispose symmetry is
17
- * audited by the webserver companion.
18
- */
19
- const install = () => {};
20
- /**
21
- * Register this package's invariant companion.
22
- * @param ctx - Cordis context carrying the invariant service.
23
- * @returns the installed registration's disposer after setup succeeds.
24
- */
25
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
26
- //#endregion
27
- export { apply, inject, name };
@@ -1,16 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@deepseek-ai/dsh-client-connection`.
3
- * @module @deepseek-ai/dsh-client-connection/invariant
4
- */
5
- import type { Context } from '@deepseek-ai/cordis';
6
- /** Cordis companion plugin name. */
7
- export declare const name = "client-connection-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