@jait/gateway 0.1.19 → 0.1.20

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,10 @@
1
+ /**
2
+ * UUIDv7 — time-sortable unique identifiers.
3
+ *
4
+ * Format: 48-bit ms timestamp + 4-bit version (7) + 12-bit rand + 2-bit variant + 62-bit rand
5
+ * Total: 128 bits, lexicographically sortable by creation time.
6
+ */
7
+ export declare function uuidv7(): string;
8
+ /** Generate a new action ID (UUIDv7). */
9
+ export declare function newActionId(): string;
10
+ //# sourceMappingURL=uuidv7.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuidv7.d.ts","sourceRoot":"","sources":["../../src/lib/uuidv7.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,MAAM,IAAI,MAAM,CA2B/B;AAED,yCAAyC;AACzC,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
@@ -0,0 +1,35 @@
1
+ import { webcrypto } from "node:crypto";
2
+ const _crypto = globalThis.crypto ?? webcrypto;
3
+ /**
4
+ * UUIDv7 — time-sortable unique identifiers.
5
+ *
6
+ * Format: 48-bit ms timestamp + 4-bit version (7) + 12-bit rand + 2-bit variant + 62-bit rand
7
+ * Total: 128 bits, lexicographically sortable by creation time.
8
+ */
9
+ export function uuidv7() {
10
+ const now = Date.now();
11
+ const bytes = new Uint8Array(16);
12
+ // Fill with random bytes first
13
+ _crypto.getRandomValues(bytes);
14
+ // Timestamp: first 48 bits (6 bytes)
15
+ bytes[0] = (now / 2 ** 40) & 0xff;
16
+ bytes[1] = (now / 2 ** 32) & 0xff;
17
+ bytes[2] = (now / 2 ** 24) & 0xff;
18
+ bytes[3] = (now / 2 ** 16) & 0xff;
19
+ bytes[4] = (now / 2 ** 8) & 0xff;
20
+ bytes[5] = now & 0xff;
21
+ // Version 7: set bits 48-51 to 0111
22
+ bytes[6] = (bytes[6] & 0x0f) | 0x70;
23
+ // Variant: set bits 64-65 to 10
24
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
25
+ // Convert to hex string
26
+ const hex = Array.from(bytes)
27
+ .map((b) => b.toString(16).padStart(2, "0"))
28
+ .join("");
29
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
30
+ }
31
+ /** Generate a new action ID (UUIDv7). */
32
+ export function newActionId() {
33
+ return uuidv7();
34
+ }
35
+ //# sourceMappingURL=uuidv7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuidv7.js","sourceRoot":"","sources":["../../src/lib/uuidv7.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,MAAM,OAAO,GAAI,UAAU,CAAC,MAAoB,IAAK,SAAkC,CAAC;AAExF;;;;;GAKG;AACH,MAAM,UAAU,MAAM;IACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAEjC,+BAA+B;IAC/B,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAE/B,qCAAqC;IACrC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IACjC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IAEtB,oCAAoC;IACpC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAErC,gCAAgC;IAChC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAErC,wBAAwB;IACxB,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAC1B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7G,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,WAAW;IACzB,OAAO,MAAM,EAAE,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jait/gateway",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Jait AI gateway — local-first AI coding agent with terminal, filesystem, and browser control",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",