atabey-shared 0.0.33 → 0.0.35

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.ts CHANGED
@@ -19,3 +19,4 @@ export * from "./sandbox-fs.js";
19
19
  export * from "./resilience.js";
20
20
  export * from "./policy-gate.js";
21
21
  export * from "./storage.js";
22
+ export * from "./time.js";
package/dist/index.js CHANGED
@@ -19,4 +19,5 @@ export * from "./sandbox-fs.js";
19
19
  export * from "./resilience.js";
20
20
  export * from "./policy-gate.js";
21
21
  export * from "./storage.js";
22
+ export * from "./time.js";
22
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
package/dist/time.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Time and unique ID utilities shared across Atabey CLI and MCP servers.
3
+ */
4
+ export declare function generateULID(seedTime?: number, seed?: number): string;
5
+ export declare function sleep(ms: number): void;
package/dist/time.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Time and unique ID utilities shared across Atabey CLI and MCP servers.
3
+ */
4
+ export function generateULID(seedTime = Date.now(), seed) {
5
+ const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
6
+ const ENCODING_LEN = ENCODING.length;
7
+ let time = seedTime;
8
+ const timeChars = new Array(10);
9
+ for (let i = 9; i >= 0; i--) {
10
+ timeChars[i] = ENCODING.charAt(time % ENCODING_LEN);
11
+ time = Math.floor(time / ENCODING_LEN);
12
+ }
13
+ const randomChars = new Array(16);
14
+ if (seed) {
15
+ let pseudoRandom = seed;
16
+ for (let i = 0; i < 16; i++) {
17
+ pseudoRandom = (pseudoRandom * 16807) % 2147483647;
18
+ randomChars[i] = ENCODING.charAt(pseudoRandom % ENCODING_LEN);
19
+ }
20
+ }
21
+ else {
22
+ for (let i = 0; i < 16; i++) {
23
+ randomChars[i] = ENCODING.charAt(Math.floor(Math.random() * ENCODING_LEN));
24
+ }
25
+ }
26
+ return timeChars.join("") + randomChars.join("");
27
+ }
28
+ export function sleep(ms) {
29
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
30
+ }
31
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,UAAU,YAAY,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,IAAa;IAC7D,MAAM,QAAQ,GAAG,kCAAkC,CAAC;IACpD,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC;IACrC,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1B,SAAS,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,YAAY,CAAC,CAAC;QACpD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,IAAI,EAAE,CAAC;QACP,IAAI,YAAY,GAAG,IAAI,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1B,YAAY,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC,GAAG,UAAU,CAAC;YACnD,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1B,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;QAC/E,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,EAAU;IAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACrE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atabey-shared",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Shared utility modules for Atabey — AI Governance & Multi-Agent Platform / Orchestrator",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "AGPL-3.0",
@@ -55,7 +55,8 @@
55
55
  "./sandbox-fs.js": "./dist/sandbox-fs.js",
56
56
  "./resilience.js": "./dist/resilience.js",
57
57
  "./policy-gate.js": "./dist/policy-gate.js",
58
- "./storage.js": "./dist/storage.js"
58
+ "./storage.js": "./dist/storage.js",
59
+ "./time.js": "./dist/time.js"
59
60
  },
60
61
  "scripts": {
61
62
  "build": "tsc",