@tencent-ai/agent-sdk 0.0.7 → 0.0.9

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.
Files changed (64) hide show
  1. package/dist/agent-sdk.js +1 -1
  2. package/lib/common/services/event.d.ts +1 -1
  3. package/lib/common/services/event.d.ts.map +1 -1
  4. package/lib/common/services/event.js.map +1 -1
  5. package/lib/common/services/index.d.ts +1 -1
  6. package/lib/common/services/index.d.ts.map +1 -1
  7. package/lib/common/services/index.js +1 -1
  8. package/lib/common/services/index.js.map +1 -1
  9. package/lib/common/services/logger.d.ts +5 -5
  10. package/lib/common/services/logger.d.ts.map +1 -1
  11. package/lib/common/services/logger.js +5 -6
  12. package/lib/common/services/logger.js.map +1 -1
  13. package/lib/common/services/product.d.ts +1 -3
  14. package/lib/common/services/product.d.ts.map +1 -1
  15. package/lib/common/services/product.js +1 -4
  16. package/lib/common/services/product.js.map +1 -1
  17. package/lib/common/services/tracing.d.ts +9 -0
  18. package/lib/common/services/tracing.d.ts.map +1 -0
  19. package/lib/common/services/{trace.js → tracing.js} +1 -1
  20. package/lib/common/services/tracing.js.map +1 -0
  21. package/lib/common/types/event/chat.d.ts +8 -3
  22. package/lib/common/types/event/chat.d.ts.map +1 -1
  23. package/lib/common/types/event/craft.d.ts +8 -4
  24. package/lib/common/types/event/craft.d.ts.map +1 -1
  25. package/lib/common/types/event/events.d.ts +5 -5
  26. package/lib/common/types/event/events.d.ts.map +1 -1
  27. package/lib/common/types/event/events.js +2 -2
  28. package/lib/common/types/event/events.js.map +1 -1
  29. package/lib/common/types/event/ide-event.d.ts +0 -8
  30. package/lib/common/types/event/ide-event.d.ts.map +1 -1
  31. package/lib/common/types/index.d.ts +3 -0
  32. package/lib/common/types/index.d.ts.map +1 -1
  33. package/lib/common/types/index.js +3 -0
  34. package/lib/common/types/index.js.map +1 -1
  35. package/lib/common/types/logger/index.d.ts +2 -0
  36. package/lib/common/types/logger/index.d.ts.map +1 -0
  37. package/lib/common/types/logger/index.js +18 -0
  38. package/lib/common/types/logger/index.js.map +1 -0
  39. package/lib/common/types/logger/protocol.d.ts +10 -0
  40. package/lib/common/types/logger/protocol.d.ts.map +1 -0
  41. package/lib/common/types/logger/protocol.js +3 -0
  42. package/lib/common/types/logger/protocol.js.map +1 -0
  43. package/lib/common/types/product/features.d.ts +1 -1
  44. package/lib/common/types/product/features.d.ts.map +1 -1
  45. package/lib/common/types/product/features.js +1 -1
  46. package/lib/common/types/product/features.js.map +1 -1
  47. package/lib/common/types/product/telemetry.d.ts +1 -1
  48. package/lib/common/types/product/telemetry.d.ts.map +1 -1
  49. package/lib/common/types/protocol.d.ts +9 -0
  50. package/lib/common/types/protocol.d.ts.map +1 -0
  51. package/lib/common/types/protocol.js +10 -0
  52. package/lib/common/types/protocol.js.map +1 -0
  53. package/lib/common/types/tracing/index.d.ts +2 -0
  54. package/lib/common/types/tracing/index.d.ts.map +1 -0
  55. package/lib/common/types/tracing/index.js +18 -0
  56. package/lib/common/types/tracing/index.js.map +1 -0
  57. package/lib/common/types/tracing/protocol.d.ts +74 -0
  58. package/lib/common/types/tracing/protocol.d.ts.map +1 -0
  59. package/lib/common/types/tracing/protocol.js +3 -0
  60. package/lib/common/types/tracing/protocol.js.map +1 -0
  61. package/package.json +1 -1
  62. package/lib/common/services/trace.d.ts +0 -10
  63. package/lib/common/services/trace.d.ts.map +0 -1
  64. package/lib/common/services/trace.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ export interface TracingInitOptions {
2
+ serviceName?: string;
3
+ serviceVersion?: string;
4
+ }
5
+ export interface ResourcesProvider {
6
+ /** 提供服务初始化时注册的信息,如用户信息等 */
7
+ provide(): Promise<Attributes>;
8
+ }
9
+ export interface Trace {
10
+ get traceId(): string;
11
+ /** 开始一个全新的链路追踪,返回整个链路的根结点 */
12
+ startSpan(name: string, options?: SpanOptions): RootSpan;
13
+ }
14
+ export type RootSpan = Span;
15
+ export type Attributes = Record<string, unknown>;
16
+ export interface Span {
17
+ /** 获取 traceId */
18
+ get traceId(): string;
19
+ /** 获取 span 相关的信息用于 http 请求头 */
20
+ get requestHeaders(): Record<string, string>;
21
+ /** 开始一个子链路 */
22
+ startSpan(name: string, options?: SpanOptions): Span;
23
+ /** 设置当前 span 状态为 UNSET 并且结束追踪 */
24
+ markAsUnset(time?: TimeInput): void;
25
+ /** 设置当前 span 状态为 FAILED 并且结束追踪 */
26
+ markAsFailed(exception?: Exception, time?: TimeInput): void;
27
+ /** 设置当前 span 状态为 SUCCESSFUL 并且结束追踪 */
28
+ markAsSuccessful(time?: TimeInput): void;
29
+ /** 设置当前 span 的 traceId */
30
+ setTraceId(traceId: string): void;
31
+ /** 在当前 span 的关键链路上添加一个事件标记 */
32
+ addEvent(name: string, attributes?: Attributes): void;
33
+ /** 为当前链路添加属性 */
34
+ setAttributes(attributes: Attributes): void;
35
+ /** 记录异常 */
36
+ recordException(exception: Exception, time?: TimeInput): void;
37
+ }
38
+ interface ExceptionWithCode {
39
+ code: string | number;
40
+ name?: string;
41
+ message?: string;
42
+ stack?: string;
43
+ }
44
+ interface ExceptionWithMessage {
45
+ code?: string | number;
46
+ message: string;
47
+ name?: string;
48
+ stack?: string;
49
+ }
50
+ interface ExceptionWithName {
51
+ code?: string | number;
52
+ message?: string;
53
+ name: string;
54
+ stack?: string;
55
+ }
56
+ /**
57
+ * Defines Exception.
58
+ *
59
+ * string or an object with one of (message or name or code) and optional stack
60
+ */
61
+ export declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
62
+ export declare type HrTime = [number, number];
63
+ /**
64
+ * Defines TimeInput.
65
+ *
66
+ * hrtime, epoch milliseconds, performance.now() or Date
67
+ */
68
+ export declare type TimeInput = HrTime | number | Date;
69
+ export interface SpanOptions {
70
+ attributes?: Attributes;
71
+ startTime?: TimeInput;
72
+ }
73
+ export {};
74
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot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IAChB,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5C,WAAW;IACX,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACjE;AAED,UAAU,iBAAiB;IACvB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,oBAAoB;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,iBAAiB;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,MAAM,SAAS,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,iBAAiB,GAAG,MAAM,CAAC;AAEtG,MAAM,CAAC,OAAO,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9C;;;;GAIG;AACH,MAAM,CAAC,OAAO,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAEvD,MAAM,WAAW,WAAW;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../../src/common/types/tracing/protocol.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-ai/agent-sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Tencent AI Agent SDK",
5
5
  "main": "./dist/agent-sdk.js",
6
6
  "typings": "lib/common/index.d.ts",
@@ -1,10 +0,0 @@
1
- import { Newable } from '@celljs/core';
2
- import { InitOptions, ResourcesProvider, RootSpan, SpanOptions } from '@genie/telemetry';
3
- export type { ResourcesProvider as TracingResourcesProvider, InitOptions as TraceInitOptions, SpanOptions, RootSpan, Span, Exception, TimeInput, Attributes } from '@genie/telemetry';
4
- export declare abstract class Tracing {
5
- static init(options?: InitOptions): Promise<void>;
6
- static shutdown(): Promise<void>;
7
- static startTrace(traceName: string, traceId?: string, spanOptions?: SpanOptions): Promise<RootSpan>;
8
- static registerResourcesProvider(constructor: Newable<ResourcesProvider>): Promise<void>;
9
- }
10
- //# sourceMappingURL=trace.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/common/services/trace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAKvG,YAAY,EACR,iBAAiB,IAAI,wBAAwB,EAC7C,WAAW,IAAI,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EACjG,MAAM,kBAAkB,CAAC;AAE1B,8BAAsB,OAAO;WACZ,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;WAK1C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;WAKzB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAA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