@hawk.so/types 0.6.4 → 0.7.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/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './src/ai/stream';
1
2
  export * from './src/auth/tokensPair';
2
3
  export * from './src/base/businessOperation/businessOperation';
3
4
  export * from './src/billing/planProlongrationPayload';
@@ -7,6 +8,7 @@ export * from './src/base/event/breadcrumb';
7
8
  export * from './src/base/event/event';
8
9
  export * from './src/base/event/sourceCodeLine';
9
10
  export * from './src/base/event/taskManagerItem';
11
+ export * from './src/base/event/trace';
10
12
  export * from './src/base/event/addons';
11
13
  export * from './src/base/integrations/integrationToken';
12
14
  export * from './src/base/project/ProjectTaskManager';
package/build/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/ai/stream"), exports);
17
18
  __exportStar(require("./src/auth/tokensPair"), exports);
18
19
  __exportStar(require("./src/base/businessOperation/businessOperation"), exports);
19
20
  __exportStar(require("./src/billing/planProlongrationPayload"), exports);
@@ -23,6 +24,7 @@ __exportStar(require("./src/base/event/breadcrumb"), exports);
23
24
  __exportStar(require("./src/base/event/event"), exports);
24
25
  __exportStar(require("./src/base/event/sourceCodeLine"), exports);
25
26
  __exportStar(require("./src/base/event/taskManagerItem"), exports);
27
+ __exportStar(require("./src/base/event/trace"), exports);
26
28
  __exportStar(require("./src/base/event/addons"), exports);
27
29
  __exportStar(require("./src/base/integrations/integrationToken"), exports);
28
30
  __exportStar(require("./src/base/project/ProjectTaskManager"), exports);
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Stream part that carries generated text.
3
+ */
4
+ export type AiStreamTextDeltaPart = {
5
+ /**
6
+ * Discriminant of a text-carrying part.
7
+ */
8
+ type: 'text-delta';
9
+ /**
10
+ * Text generated for this part.
11
+ */
12
+ delta: string;
13
+ };
14
+ /**
15
+ * Stream part that carries a generation failure.
16
+ */
17
+ export type AiStreamErrorPart = {
18
+ /**
19
+ * Discriminant of a failure-carrying part.
20
+ */
21
+ type: 'error';
22
+ /**
23
+ * Description of the failure.
24
+ */
25
+ errorText: string;
26
+ };
27
+ /**
28
+ * Discriminated union of parts an AI stream consists of.
29
+ */
30
+ export type AiStreamPart = AiStreamTextDeltaPart | AiStreamErrorPart;
31
+ /**
32
+ * Asynchronous sequence of parts forming an AI-generated answer.
33
+ */
34
+ export type AiStream = AsyncIterable<AiStreamPart>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,6 +3,7 @@ import type { AffectedUser } from './affectedUser.ts';
3
3
  import type { EventAddons } from './addons/index.ts';
4
4
  import type { Json } from '../../utils/index.ts';
5
5
  import type { Breadcrumb } from './breadcrumb.ts';
6
+ import type { EventTrace } from './trace.ts';
6
7
  /**
7
8
  * Information about event (Payload of the event)
8
9
  * That object will be sent as 'payload' from the Collector to the workers
@@ -45,6 +46,10 @@ export interface EventData<Addons extends EventAddons> {
45
46
  * Catcher version
46
47
  */
47
48
  catcherVersion?: string;
49
+ /**
50
+ * Distributed trace metadata for linking related events within the same execution chain.
51
+ */
52
+ trace?: EventTrace;
48
53
  }
49
54
  /**
50
55
  * Event data with decoded unsafe fields
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Distributed trace metadata attached to error and performance events.
3
+ */
4
+ export interface EventTrace {
5
+ /**
6
+ * Shared identifier for events from the same execution chain.
7
+ */
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Trace metadata attached to error events for linking related frontend/backend occurrences.
3
+ */
4
+ export interface TraceContext {
5
+ /**
6
+ * Shared identifier for events from the same execution chain.
7
+ */
8
+ traceId: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './src/ai/stream';
2
+
1
3
  export * from './src/auth/tokensPair';
2
4
 
3
5
  export * from './src/base/businessOperation/businessOperation';
@@ -10,6 +12,7 @@ export * from './src/base/event/breadcrumb';
10
12
  export * from './src/base/event/event';
11
13
  export * from './src/base/event/sourceCodeLine';
12
14
  export * from './src/base/event/taskManagerItem';
15
+ export * from './src/base/event/trace';
13
16
  export * from './src/base/event/addons';
14
17
 
15
18
  export * from './src/base/integrations/integrationToken';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawk.so/types",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
4
4
  "description": "TypeScript definitions for Hawk",
5
5
  "types": "build/index.d.ts",
6
6
  "main": "build/index.js",
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Stream part that carries generated text.
3
+ */
4
+ export type AiStreamTextDeltaPart = {
5
+ /**
6
+ * Discriminant of a text-carrying part.
7
+ */
8
+ type: 'text-delta';
9
+
10
+ /**
11
+ * Text generated for this part.
12
+ */
13
+ delta: string;
14
+ };
15
+
16
+ /**
17
+ * Stream part that carries a generation failure.
18
+ */
19
+ export type AiStreamErrorPart = {
20
+ /**
21
+ * Discriminant of a failure-carrying part.
22
+ */
23
+ type: 'error';
24
+
25
+ /**
26
+ * Description of the failure.
27
+ */
28
+ errorText: string;
29
+ };
30
+
31
+ /**
32
+ * Discriminated union of parts an AI stream consists of.
33
+ */
34
+ export type AiStreamPart = AiStreamTextDeltaPart | AiStreamErrorPart;
35
+
36
+ /**
37
+ * Asynchronous sequence of parts forming an AI-generated answer.
38
+ */
39
+ export type AiStream = AsyncIterable<AiStreamPart>;
@@ -3,6 +3,7 @@ import type { AffectedUser } from './affectedUser.ts';
3
3
  import type { EventAddons } from './addons/index.ts';
4
4
  import type { Json } from '../../utils/index.ts';
5
5
  import type { Breadcrumb } from './breadcrumb.ts';
6
+ import type { EventTrace } from './trace.ts';
6
7
 
7
8
  /**
8
9
  * Information about event (Payload of the event)
@@ -54,6 +55,11 @@ export interface EventData<Addons extends EventAddons> {
54
55
  * Catcher version
55
56
  */
56
57
  catcherVersion?: string;
58
+
59
+ /**
60
+ * Distributed trace metadata for linking related events within the same execution chain.
61
+ */
62
+ trace?: EventTrace;
57
63
  }
58
64
 
59
65
  /**
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Distributed trace metadata attached to error and performance events.
3
+ */
4
+ export interface EventTrace {
5
+ /**
6
+ * Shared identifier for events from the same execution chain.
7
+ */
8
+ id: string;
9
+ }
package/tsconfig.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  /* Basic Options */
4
4
  // "incremental": true, /* Enable incremental compilation */
5
- "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
5
+ "target": "es2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', 'ES2022', 'ES2023', 'ES2024', or 'ESNEXT'. */
6
6
  "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
7
7
  // "lib": [], /* Specify library files to be included in the compilation. */
8
8
  // "allowJs": true, /* Allow javascript files to be compiled. */