@copilotkitnext/shared 1.51.4 → 1.51.5-next.1

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 (58) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/constants.cjs +7 -0
  3. package/dist/constants.cjs.map +1 -0
  4. package/dist/constants.d.cts +5 -0
  5. package/dist/constants.d.cts.map +1 -0
  6. package/dist/constants.d.mts +5 -0
  7. package/dist/constants.d.mts.map +1 -0
  8. package/dist/constants.mjs +6 -0
  9. package/dist/constants.mjs.map +1 -0
  10. package/dist/finalize-events.cjs +106 -0
  11. package/dist/finalize-events.cjs.map +1 -0
  12. package/dist/finalize-events.d.cts +11 -0
  13. package/dist/finalize-events.d.cts.map +1 -0
  14. package/dist/finalize-events.d.mts +11 -0
  15. package/dist/finalize-events.d.mts.map +1 -0
  16. package/dist/finalize-events.mjs +105 -0
  17. package/dist/finalize-events.mjs.map +1 -0
  18. package/dist/index.cjs +14 -0
  19. package/dist/index.d.cts +7 -0
  20. package/dist/index.d.mts +7 -84
  21. package/dist/index.mjs +6 -213
  22. package/dist/index.umd.js +245 -2
  23. package/dist/index.umd.js.map +1 -1
  24. package/dist/logger.cjs +7 -0
  25. package/dist/logger.cjs.map +1 -0
  26. package/dist/logger.d.cts +5 -0
  27. package/dist/logger.d.cts.map +1 -0
  28. package/dist/logger.d.mts +5 -0
  29. package/dist/logger.d.mts.map +1 -0
  30. package/dist/logger.mjs +6 -0
  31. package/dist/logger.mjs.map +1 -0
  32. package/dist/transcription-errors.cjs +84 -0
  33. package/dist/transcription-errors.cjs.map +1 -0
  34. package/dist/transcription-errors.d.cts +52 -0
  35. package/dist/transcription-errors.d.cts.map +1 -0
  36. package/dist/transcription-errors.d.mts +52 -0
  37. package/dist/transcription-errors.d.mts.map +1 -0
  38. package/dist/transcription-errors.mjs +82 -0
  39. package/dist/transcription-errors.mjs.map +1 -0
  40. package/dist/types.d.cts +22 -0
  41. package/dist/types.d.cts.map +1 -0
  42. package/dist/types.d.mts +22 -0
  43. package/dist/types.d.mts.map +1 -0
  44. package/dist/utils.cjs +21 -0
  45. package/dist/utils.cjs.map +1 -0
  46. package/dist/utils.d.cts +6 -0
  47. package/dist/utils.d.cts.map +1 -0
  48. package/dist/utils.d.mts +6 -0
  49. package/dist/utils.d.mts.map +1 -0
  50. package/dist/utils.mjs +18 -0
  51. package/dist/utils.mjs.map +1 -0
  52. package/package.json +17 -13
  53. package/tsdown.config.ts +36 -0
  54. package/dist/index.d.ts +0 -84
  55. package/dist/index.js +0 -257
  56. package/dist/index.js.map +0 -1
  57. package/dist/index.mjs.map +0 -1
  58. package/rollup.config.mjs +0 -36
@@ -0,0 +1,5 @@
1
+ //#region src/logger.d.ts
2
+ declare const logger: Console;
3
+ //#endregion
4
+ export { logger };
5
+ //# sourceMappingURL=logger.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.cts","names":[],"sources":["../src/logger.ts"],"mappings":";cAAa,MAAA,EAAM,OAAA"}
@@ -0,0 +1,5 @@
1
+ //#region src/logger.d.ts
2
+ declare const logger: Console;
3
+ //#endregion
4
+ export { logger };
5
+ //# sourceMappingURL=logger.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.mts","names":[],"sources":["../src/logger.ts"],"mappings":";cAAa,MAAA,EAAM,OAAA"}
@@ -0,0 +1,6 @@
1
+ //#region src/logger.ts
2
+ const logger = console;
3
+
4
+ //#endregion
5
+ export { logger };
6
+ //# sourceMappingURL=logger.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.mjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["export const logger = console;\n"],"mappings":";AAAA,MAAa,SAAS"}
@@ -0,0 +1,84 @@
1
+
2
+ //#region src/transcription-errors.ts
3
+ /**
4
+ * Error codes for transcription HTTP responses.
5
+ * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
6
+ * These codes are returned by the runtime and parsed by the client.
7
+ */
8
+ let TranscriptionErrorCode = /* @__PURE__ */ function(TranscriptionErrorCode) {
9
+ /** Transcription service not configured in runtime */
10
+ TranscriptionErrorCode["SERVICE_NOT_CONFIGURED"] = "service_not_configured";
11
+ /** Audio format not supported */
12
+ TranscriptionErrorCode["INVALID_AUDIO_FORMAT"] = "invalid_audio_format";
13
+ /** Audio file is too long */
14
+ TranscriptionErrorCode["AUDIO_TOO_LONG"] = "audio_too_long";
15
+ /** Audio file is empty or too short */
16
+ TranscriptionErrorCode["AUDIO_TOO_SHORT"] = "audio_too_short";
17
+ /** Rate limited by transcription provider */
18
+ TranscriptionErrorCode["RATE_LIMITED"] = "rate_limited";
19
+ /** Authentication failed with transcription provider */
20
+ TranscriptionErrorCode["AUTH_FAILED"] = "auth_failed";
21
+ /** Transcription provider returned an error */
22
+ TranscriptionErrorCode["PROVIDER_ERROR"] = "provider_error";
23
+ /** Network error during transcription */
24
+ TranscriptionErrorCode["NETWORK_ERROR"] = "network_error";
25
+ /** Invalid request format */
26
+ TranscriptionErrorCode["INVALID_REQUEST"] = "invalid_request";
27
+ return TranscriptionErrorCode;
28
+ }({});
29
+ /**
30
+ * Helper functions to create transcription error responses.
31
+ * Used by the runtime to return consistent error responses.
32
+ */
33
+ const TranscriptionErrors = {
34
+ serviceNotConfigured: () => ({
35
+ error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,
36
+ message: "Transcription service is not configured",
37
+ retryable: false
38
+ }),
39
+ invalidAudioFormat: (format, supported) => ({
40
+ error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,
41
+ message: `Unsupported audio format: ${format}. Supported: ${supported.join(", ")}`,
42
+ retryable: false
43
+ }),
44
+ invalidRequest: (details) => ({
45
+ error: TranscriptionErrorCode.INVALID_REQUEST,
46
+ message: details,
47
+ retryable: false
48
+ }),
49
+ rateLimited: () => ({
50
+ error: TranscriptionErrorCode.RATE_LIMITED,
51
+ message: "Rate limited. Please try again later.",
52
+ retryable: true
53
+ }),
54
+ authFailed: () => ({
55
+ error: TranscriptionErrorCode.AUTH_FAILED,
56
+ message: "Authentication failed with transcription provider",
57
+ retryable: false
58
+ }),
59
+ providerError: (message) => ({
60
+ error: TranscriptionErrorCode.PROVIDER_ERROR,
61
+ message,
62
+ retryable: true
63
+ }),
64
+ networkError: (message = "Network error during transcription") => ({
65
+ error: TranscriptionErrorCode.NETWORK_ERROR,
66
+ message,
67
+ retryable: true
68
+ }),
69
+ audioTooLong: () => ({
70
+ error: TranscriptionErrorCode.AUDIO_TOO_LONG,
71
+ message: "Audio file is too long",
72
+ retryable: false
73
+ }),
74
+ audioTooShort: () => ({
75
+ error: TranscriptionErrorCode.AUDIO_TOO_SHORT,
76
+ message: "Audio is too short to transcribe",
77
+ retryable: false
78
+ })
79
+ };
80
+
81
+ //#endregion
82
+ exports.TranscriptionErrorCode = TranscriptionErrorCode;
83
+ exports.TranscriptionErrors = TranscriptionErrors;
84
+ //# sourceMappingURL=transcription-errors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-errors.cjs","names":[],"sources":["../src/transcription-errors.ts"],"sourcesContent":["/**\n * Error codes for transcription HTTP responses.\n * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.\n * These codes are returned by the runtime and parsed by the client.\n */\nexport enum TranscriptionErrorCode {\n /** Transcription service not configured in runtime */\n SERVICE_NOT_CONFIGURED = \"service_not_configured\",\n /** Audio format not supported */\n INVALID_AUDIO_FORMAT = \"invalid_audio_format\",\n /** Audio file is too long */\n AUDIO_TOO_LONG = \"audio_too_long\",\n /** Audio file is empty or too short */\n AUDIO_TOO_SHORT = \"audio_too_short\",\n /** Rate limited by transcription provider */\n RATE_LIMITED = \"rate_limited\",\n /** Authentication failed with transcription provider */\n AUTH_FAILED = \"auth_failed\",\n /** Transcription provider returned an error */\n PROVIDER_ERROR = \"provider_error\",\n /** Network error during transcription */\n NETWORK_ERROR = \"network_error\",\n /** Invalid request format */\n INVALID_REQUEST = \"invalid_request\",\n}\n\n/**\n * Error response format returned by the transcription endpoint.\n */\nexport interface TranscriptionErrorResponse {\n error: TranscriptionErrorCode;\n message: string;\n retryable?: boolean;\n}\n\n/**\n * Helper functions to create transcription error responses.\n * Used by the runtime to return consistent error responses.\n */\nexport const TranscriptionErrors = {\n serviceNotConfigured: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,\n message: \"Transcription service is not configured\",\n retryable: false,\n }),\n\n invalidAudioFormat: (\n format: string,\n supported: string[],\n ): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,\n message: `Unsupported audio format: ${format}. Supported: ${supported.join(\", \")}`,\n retryable: false,\n }),\n\n invalidRequest: (details: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_REQUEST,\n message: details,\n retryable: false,\n }),\n\n rateLimited: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.RATE_LIMITED,\n message: \"Rate limited. Please try again later.\",\n retryable: true,\n }),\n\n authFailed: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUTH_FAILED,\n message: \"Authentication failed with transcription provider\",\n retryable: false,\n }),\n\n providerError: (message: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.PROVIDER_ERROR,\n message,\n retryable: true,\n }),\n\n networkError: (\n message: string = \"Network error during transcription\",\n ): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.NETWORK_ERROR,\n message,\n retryable: true,\n }),\n\n audioTooLong: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_LONG,\n message: \"Audio file is too long\",\n retryable: false,\n }),\n\n audioTooShort: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_SHORT,\n message: \"Audio is too short to transcribe\",\n retryable: false,\n }),\n};\n"],"mappings":";;;;;;;AAKA,IAAY,0EAAL;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;;;;;;AAgBF,MAAa,sBAAsB;CACjC,6BAAyD;EACvD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,qBACE,QACA,eACgC;EAChC,OAAO,uBAAuB;EAC9B,SAAS,6BAA6B,OAAO,eAAe,UAAU,KAAK,KAAK;EAChF,WAAW;EACZ;CAED,iBAAiB,aAAiD;EAChE,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,oBAAgD;EAC9C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,mBAA+C;EAC7C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,gBAAgB,aAAiD;EAC/D,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,eACE,UAAkB,0CACc;EAChC,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,qBAAiD;EAC/C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,sBAAkD;EAChD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CACF"}
@@ -0,0 +1,52 @@
1
+ //#region src/transcription-errors.d.ts
2
+ /**
3
+ * Error codes for transcription HTTP responses.
4
+ * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
5
+ * These codes are returned by the runtime and parsed by the client.
6
+ */
7
+ declare enum TranscriptionErrorCode {
8
+ /** Transcription service not configured in runtime */
9
+ SERVICE_NOT_CONFIGURED = "service_not_configured",
10
+ /** Audio format not supported */
11
+ INVALID_AUDIO_FORMAT = "invalid_audio_format",
12
+ /** Audio file is too long */
13
+ AUDIO_TOO_LONG = "audio_too_long",
14
+ /** Audio file is empty or too short */
15
+ AUDIO_TOO_SHORT = "audio_too_short",
16
+ /** Rate limited by transcription provider */
17
+ RATE_LIMITED = "rate_limited",
18
+ /** Authentication failed with transcription provider */
19
+ AUTH_FAILED = "auth_failed",
20
+ /** Transcription provider returned an error */
21
+ PROVIDER_ERROR = "provider_error",
22
+ /** Network error during transcription */
23
+ NETWORK_ERROR = "network_error",
24
+ /** Invalid request format */
25
+ INVALID_REQUEST = "invalid_request"
26
+ }
27
+ /**
28
+ * Error response format returned by the transcription endpoint.
29
+ */
30
+ interface TranscriptionErrorResponse {
31
+ error: TranscriptionErrorCode;
32
+ message: string;
33
+ retryable?: boolean;
34
+ }
35
+ /**
36
+ * Helper functions to create transcription error responses.
37
+ * Used by the runtime to return consistent error responses.
38
+ */
39
+ declare const TranscriptionErrors: {
40
+ serviceNotConfigured: () => TranscriptionErrorResponse;
41
+ invalidAudioFormat: (format: string, supported: string[]) => TranscriptionErrorResponse;
42
+ invalidRequest: (details: string) => TranscriptionErrorResponse;
43
+ rateLimited: () => TranscriptionErrorResponse;
44
+ authFailed: () => TranscriptionErrorResponse;
45
+ providerError: (message: string) => TranscriptionErrorResponse;
46
+ networkError: (message?: string) => TranscriptionErrorResponse;
47
+ audioTooLong: () => TranscriptionErrorResponse;
48
+ audioTooShort: () => TranscriptionErrorResponse;
49
+ };
50
+ //#endregion
51
+ export { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors };
52
+ //# sourceMappingURL=transcription-errors.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-errors.d.cts","names":[],"sources":["../src/transcription-errors.ts"],"mappings":";;AAKA;;;;aAAY,sBAAA;EAIV;EAFA,sBAAA;EAMA;EAJA,oBAAA;EAQA;EANA,cAAA;EAUA;EARA,eAAA;EAUe;EARf,YAAA;EAce;EAZf,WAAA;;EAEA,cAAA;EAWA;EATA,aAAA;EAUA;EARA,eAAA;AAAA;;AAgBF;;UAViB,0BAAA;EACf,KAAA,EAAO,sBAAA;EACP,OAAA;EACA,SAAA;AAAA;;;;;cAOW,mBAAA;8BACe,0BAAA;uCAOV,SAAA,eAEb,0BAAA;uCAMgC,0BAAA;qBAMlB,0BAAA;oBAMD,0BAAA;sCAMkB,0BAAA;sCAQ/B,0BAAA;sBAMe,0BAAA;uBAMC,0BAAA;AAAA"}
@@ -0,0 +1,52 @@
1
+ //#region src/transcription-errors.d.ts
2
+ /**
3
+ * Error codes for transcription HTTP responses.
4
+ * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
5
+ * These codes are returned by the runtime and parsed by the client.
6
+ */
7
+ declare enum TranscriptionErrorCode {
8
+ /** Transcription service not configured in runtime */
9
+ SERVICE_NOT_CONFIGURED = "service_not_configured",
10
+ /** Audio format not supported */
11
+ INVALID_AUDIO_FORMAT = "invalid_audio_format",
12
+ /** Audio file is too long */
13
+ AUDIO_TOO_LONG = "audio_too_long",
14
+ /** Audio file is empty or too short */
15
+ AUDIO_TOO_SHORT = "audio_too_short",
16
+ /** Rate limited by transcription provider */
17
+ RATE_LIMITED = "rate_limited",
18
+ /** Authentication failed with transcription provider */
19
+ AUTH_FAILED = "auth_failed",
20
+ /** Transcription provider returned an error */
21
+ PROVIDER_ERROR = "provider_error",
22
+ /** Network error during transcription */
23
+ NETWORK_ERROR = "network_error",
24
+ /** Invalid request format */
25
+ INVALID_REQUEST = "invalid_request"
26
+ }
27
+ /**
28
+ * Error response format returned by the transcription endpoint.
29
+ */
30
+ interface TranscriptionErrorResponse {
31
+ error: TranscriptionErrorCode;
32
+ message: string;
33
+ retryable?: boolean;
34
+ }
35
+ /**
36
+ * Helper functions to create transcription error responses.
37
+ * Used by the runtime to return consistent error responses.
38
+ */
39
+ declare const TranscriptionErrors: {
40
+ serviceNotConfigured: () => TranscriptionErrorResponse;
41
+ invalidAudioFormat: (format: string, supported: string[]) => TranscriptionErrorResponse;
42
+ invalidRequest: (details: string) => TranscriptionErrorResponse;
43
+ rateLimited: () => TranscriptionErrorResponse;
44
+ authFailed: () => TranscriptionErrorResponse;
45
+ providerError: (message: string) => TranscriptionErrorResponse;
46
+ networkError: (message?: string) => TranscriptionErrorResponse;
47
+ audioTooLong: () => TranscriptionErrorResponse;
48
+ audioTooShort: () => TranscriptionErrorResponse;
49
+ };
50
+ //#endregion
51
+ export { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors };
52
+ //# sourceMappingURL=transcription-errors.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-errors.d.mts","names":[],"sources":["../src/transcription-errors.ts"],"mappings":";;AAKA;;;;aAAY,sBAAA;EAIV;EAFA,sBAAA;EAMA;EAJA,oBAAA;EAQA;EANA,cAAA;EAUA;EARA,eAAA;EAUe;EARf,YAAA;EAce;EAZf,WAAA;;EAEA,cAAA;EAWA;EATA,aAAA;EAUA;EARA,eAAA;AAAA;;AAgBF;;UAViB,0BAAA;EACf,KAAA,EAAO,sBAAA;EACP,OAAA;EACA,SAAA;AAAA;;;;;cAOW,mBAAA;8BACe,0BAAA;uCAOV,SAAA,eAEb,0BAAA;uCAMgC,0BAAA;qBAMlB,0BAAA;oBAMD,0BAAA;sCAMkB,0BAAA;sCAQ/B,0BAAA;sBAMe,0BAAA;uBAMC,0BAAA;AAAA"}
@@ -0,0 +1,82 @@
1
+ //#region src/transcription-errors.ts
2
+ /**
3
+ * Error codes for transcription HTTP responses.
4
+ * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
5
+ * These codes are returned by the runtime and parsed by the client.
6
+ */
7
+ let TranscriptionErrorCode = /* @__PURE__ */ function(TranscriptionErrorCode) {
8
+ /** Transcription service not configured in runtime */
9
+ TranscriptionErrorCode["SERVICE_NOT_CONFIGURED"] = "service_not_configured";
10
+ /** Audio format not supported */
11
+ TranscriptionErrorCode["INVALID_AUDIO_FORMAT"] = "invalid_audio_format";
12
+ /** Audio file is too long */
13
+ TranscriptionErrorCode["AUDIO_TOO_LONG"] = "audio_too_long";
14
+ /** Audio file is empty or too short */
15
+ TranscriptionErrorCode["AUDIO_TOO_SHORT"] = "audio_too_short";
16
+ /** Rate limited by transcription provider */
17
+ TranscriptionErrorCode["RATE_LIMITED"] = "rate_limited";
18
+ /** Authentication failed with transcription provider */
19
+ TranscriptionErrorCode["AUTH_FAILED"] = "auth_failed";
20
+ /** Transcription provider returned an error */
21
+ TranscriptionErrorCode["PROVIDER_ERROR"] = "provider_error";
22
+ /** Network error during transcription */
23
+ TranscriptionErrorCode["NETWORK_ERROR"] = "network_error";
24
+ /** Invalid request format */
25
+ TranscriptionErrorCode["INVALID_REQUEST"] = "invalid_request";
26
+ return TranscriptionErrorCode;
27
+ }({});
28
+ /**
29
+ * Helper functions to create transcription error responses.
30
+ * Used by the runtime to return consistent error responses.
31
+ */
32
+ const TranscriptionErrors = {
33
+ serviceNotConfigured: () => ({
34
+ error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,
35
+ message: "Transcription service is not configured",
36
+ retryable: false
37
+ }),
38
+ invalidAudioFormat: (format, supported) => ({
39
+ error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,
40
+ message: `Unsupported audio format: ${format}. Supported: ${supported.join(", ")}`,
41
+ retryable: false
42
+ }),
43
+ invalidRequest: (details) => ({
44
+ error: TranscriptionErrorCode.INVALID_REQUEST,
45
+ message: details,
46
+ retryable: false
47
+ }),
48
+ rateLimited: () => ({
49
+ error: TranscriptionErrorCode.RATE_LIMITED,
50
+ message: "Rate limited. Please try again later.",
51
+ retryable: true
52
+ }),
53
+ authFailed: () => ({
54
+ error: TranscriptionErrorCode.AUTH_FAILED,
55
+ message: "Authentication failed with transcription provider",
56
+ retryable: false
57
+ }),
58
+ providerError: (message) => ({
59
+ error: TranscriptionErrorCode.PROVIDER_ERROR,
60
+ message,
61
+ retryable: true
62
+ }),
63
+ networkError: (message = "Network error during transcription") => ({
64
+ error: TranscriptionErrorCode.NETWORK_ERROR,
65
+ message,
66
+ retryable: true
67
+ }),
68
+ audioTooLong: () => ({
69
+ error: TranscriptionErrorCode.AUDIO_TOO_LONG,
70
+ message: "Audio file is too long",
71
+ retryable: false
72
+ }),
73
+ audioTooShort: () => ({
74
+ error: TranscriptionErrorCode.AUDIO_TOO_SHORT,
75
+ message: "Audio is too short to transcribe",
76
+ retryable: false
77
+ })
78
+ };
79
+
80
+ //#endregion
81
+ export { TranscriptionErrorCode, TranscriptionErrors };
82
+ //# sourceMappingURL=transcription-errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription-errors.mjs","names":[],"sources":["../src/transcription-errors.ts"],"sourcesContent":["/**\n * Error codes for transcription HTTP responses.\n * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.\n * These codes are returned by the runtime and parsed by the client.\n */\nexport enum TranscriptionErrorCode {\n /** Transcription service not configured in runtime */\n SERVICE_NOT_CONFIGURED = \"service_not_configured\",\n /** Audio format not supported */\n INVALID_AUDIO_FORMAT = \"invalid_audio_format\",\n /** Audio file is too long */\n AUDIO_TOO_LONG = \"audio_too_long\",\n /** Audio file is empty or too short */\n AUDIO_TOO_SHORT = \"audio_too_short\",\n /** Rate limited by transcription provider */\n RATE_LIMITED = \"rate_limited\",\n /** Authentication failed with transcription provider */\n AUTH_FAILED = \"auth_failed\",\n /** Transcription provider returned an error */\n PROVIDER_ERROR = \"provider_error\",\n /** Network error during transcription */\n NETWORK_ERROR = \"network_error\",\n /** Invalid request format */\n INVALID_REQUEST = \"invalid_request\",\n}\n\n/**\n * Error response format returned by the transcription endpoint.\n */\nexport interface TranscriptionErrorResponse {\n error: TranscriptionErrorCode;\n message: string;\n retryable?: boolean;\n}\n\n/**\n * Helper functions to create transcription error responses.\n * Used by the runtime to return consistent error responses.\n */\nexport const TranscriptionErrors = {\n serviceNotConfigured: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,\n message: \"Transcription service is not configured\",\n retryable: false,\n }),\n\n invalidAudioFormat: (\n format: string,\n supported: string[],\n ): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,\n message: `Unsupported audio format: ${format}. Supported: ${supported.join(\", \")}`,\n retryable: false,\n }),\n\n invalidRequest: (details: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_REQUEST,\n message: details,\n retryable: false,\n }),\n\n rateLimited: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.RATE_LIMITED,\n message: \"Rate limited. Please try again later.\",\n retryable: true,\n }),\n\n authFailed: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUTH_FAILED,\n message: \"Authentication failed with transcription provider\",\n retryable: false,\n }),\n\n providerError: (message: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.PROVIDER_ERROR,\n message,\n retryable: true,\n }),\n\n networkError: (\n message: string = \"Network error during transcription\",\n ): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.NETWORK_ERROR,\n message,\n retryable: true,\n }),\n\n audioTooLong: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_LONG,\n message: \"Audio file is too long\",\n retryable: false,\n }),\n\n audioTooShort: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_SHORT,\n message: \"Audio is too short to transcribe\",\n retryable: false,\n }),\n};\n"],"mappings":";;;;;;AAKA,IAAY,0EAAL;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;;;;;;AAgBF,MAAa,sBAAsB;CACjC,6BAAyD;EACvD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,qBACE,QACA,eACgC;EAChC,OAAO,uBAAuB;EAC9B,SAAS,6BAA6B,OAAO,eAAe,UAAU,KAAK,KAAK;EAChF,WAAW;EACZ;CAED,iBAAiB,aAAiD;EAChE,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,oBAAgD;EAC9C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,mBAA+C;EAC7C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,gBAAgB,aAAiD;EAC/D,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,eACE,UAAkB,0CACc;EAChC,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,qBAAiD;EAC/C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,sBAAkD;EAChD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CACF"}
@@ -0,0 +1,22 @@
1
+ //#region src/types.d.ts
2
+ type MaybePromise<T> = T | PromiseLike<T>;
3
+ /**
4
+ * More specific utility for records with at least one key
5
+ */
6
+ type NonEmptyRecord<T> = T extends Record<string, unknown> ? keyof T extends never ? never : T : never;
7
+ /**
8
+ * Type representing an agent's basic information
9
+ */
10
+ interface AgentDescription {
11
+ name: string;
12
+ className: string;
13
+ description: string;
14
+ }
15
+ interface RuntimeInfo {
16
+ version: string;
17
+ agents: Record<string, AgentDescription>;
18
+ audioFileTranscriptionEnabled: boolean;
19
+ }
20
+ //#endregion
21
+ export { AgentDescription, MaybePromise, NonEmptyRecord, RuntimeInfo };
22
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;AAA9C;;;AAAA,KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;AAAA"}
@@ -0,0 +1,22 @@
1
+ //#region src/types.d.ts
2
+ type MaybePromise<T> = T | PromiseLike<T>;
3
+ /**
4
+ * More specific utility for records with at least one key
5
+ */
6
+ type NonEmptyRecord<T> = T extends Record<string, unknown> ? keyof T extends never ? never : T : never;
7
+ /**
8
+ * Type representing an agent's basic information
9
+ */
10
+ interface AgentDescription {
11
+ name: string;
12
+ className: string;
13
+ description: string;
14
+ }
15
+ interface RuntimeInfo {
16
+ version: string;
17
+ agents: Record<string, AgentDescription>;
18
+ audioFileTranscriptionEnabled: boolean;
19
+ }
20
+ //#endregion
21
+ export { AgentDescription, MaybePromise, NonEmptyRecord, RuntimeInfo };
22
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;AAA9C;;;AAAA,KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;AAAA"}
package/dist/utils.cjs ADDED
@@ -0,0 +1,21 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ let uuid = require("uuid");
3
+ let partial_json = require("partial-json");
4
+ partial_json = require_runtime.__toESM(partial_json);
5
+
6
+ //#region src/utils.ts
7
+ function randomUUID() {
8
+ return (0, uuid.v4)();
9
+ }
10
+ function partialJSONParse(json) {
11
+ try {
12
+ return partial_json.parse(json);
13
+ } catch (error) {
14
+ return {};
15
+ }
16
+ }
17
+
18
+ //#endregion
19
+ exports.partialJSONParse = partialJSONParse;
20
+ exports.randomUUID = randomUUID;
21
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":["PartialJSON"],"sources":["../src/utils.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport * as PartialJSON from \"partial-json\";\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function partialJSONParse(json: string) {\n try {\n return PartialJSON.parse(json);\n } catch (error) {\n return {};\n }\n}\n"],"mappings":";;;;;;AAGA,SAAgB,aAAa;AAC3B,sBAAe;;AAGjB,SAAgB,iBAAiB,MAAc;AAC7C,KAAI;AACF,SAAOA,aAAY,MAAM,KAAK;UACvB,OAAO;AACd,SAAO,EAAE"}
@@ -0,0 +1,6 @@
1
+ //#region src/utils.d.ts
2
+ declare function randomUUID(): string;
3
+ declare function partialJSONParse(json: string): any;
4
+ //#endregion
5
+ export { partialJSONParse, randomUUID };
6
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","names":[],"sources":["../src/utils.ts"],"mappings":";iBAGgB,UAAA,CAAA;AAAA,iBAIA,gBAAA,CAAiB,IAAA"}
@@ -0,0 +1,6 @@
1
+ //#region src/utils.d.ts
2
+ declare function randomUUID(): string;
3
+ declare function partialJSONParse(json: string): any;
4
+ //#endregion
5
+ export { partialJSONParse, randomUUID };
6
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";iBAGgB,UAAA,CAAA;AAAA,iBAIA,gBAAA,CAAiB,IAAA"}
package/dist/utils.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import { v4 } from "uuid";
2
+ import * as PartialJSON from "partial-json";
3
+
4
+ //#region src/utils.ts
5
+ function randomUUID() {
6
+ return v4();
7
+ }
8
+ function partialJSONParse(json) {
9
+ try {
10
+ return PartialJSON.parse(json);
11
+ } catch (error) {
12
+ return {};
13
+ }
14
+ }
15
+
16
+ //#endregion
17
+ export { partialJSONParse, randomUUID };
18
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","names":["uuidv4"],"sources":["../src/utils.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport * as PartialJSON from \"partial-json\";\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function partialJSONParse(json: string) {\n try {\n return PartialJSON.parse(json);\n } catch (error) {\n return {};\n }\n}\n"],"mappings":";;;;AAGA,SAAgB,aAAa;AAC3B,QAAOA,IAAQ;;AAGjB,SAAgB,iBAAiB,MAAc;AAC7C,KAAI;AACF,SAAO,YAAY,MAAM,KAAK;UACvB,OAAO;AACd,SAAO,EAAE"}
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@copilotkitnext/shared",
3
- "version": "1.51.4",
3
+ "version": "1.51.5-next.1",
4
4
  "description": "Shared utilities and types for CopilotKit2",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "./dist/index.cjs",
6
+ "types": "./dist/index.d.cts",
7
+ "type": "module",
7
8
  "exports": {
8
9
  ".": {
9
- "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
12
- }
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./package.json": "./package.json"
13
14
  },
14
15
  "unpkg": "./dist/index.umd.js",
15
16
  "jsdelivr": "./dist/index.umd.js",
@@ -19,23 +20,26 @@
19
20
  "devDependencies": {
20
21
  "@types/node": "^22.15.3",
21
22
  "eslint": "^9.30.0",
22
- "tsup": "^8.5.0",
23
+ "tsdown": "^0.20.3",
23
24
  "typescript": "5.8.2",
24
- "@copilotkitnext/eslint-config": "1.51.4",
25
- "@copilotkitnext/typescript-config": "1.51.4"
25
+ "@copilotkitnext/eslint-config": "1.51.5-next.1",
26
+ "@copilotkitnext/typescript-config": "1.51.5-next.1"
26
27
  },
27
28
  "dependencies": {
28
- "@ag-ui/client": "0.0.42",
29
+ "@ag-ui/client": "0.0.45",
29
30
  "uuid": "^11.1.0",
30
31
  "partial-json": "^0.1.7"
31
32
  },
32
33
  "engines": {
33
34
  "node": ">=18"
34
35
  },
36
+ "module": "./dist/index.mjs",
35
37
  "scripts": {
36
- "build": "tsup && rollup -c rollup.config.mjs",
37
- "dev": "tsup --watch",
38
+ "build": "tsdown",
39
+ "dev": "tsdown --watch",
38
40
  "lint": "eslint .",
39
- "check-types": "tsc --noEmit"
41
+ "check-types": "tsc --noEmit",
42
+ "publint": "publint .",
43
+ "attw": "attw --pack . --profile node16"
40
44
  }
41
45
  }
@@ -0,0 +1,36 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig([
4
+ {
5
+ entry: ["src/index.ts"],
6
+ format: ["esm", "cjs"],
7
+ dts: true,
8
+ sourcemap: true,
9
+ target: "es2022",
10
+ outDir: "dist",
11
+ unbundle: true,
12
+ checks: { pluginTimings: false },
13
+ exports: true,
14
+ },
15
+ {
16
+ entry: ["src/index.ts"],
17
+ format: ["umd"],
18
+ globalName: "CopilotKitNextShared",
19
+ sourcemap: true,
20
+ target: "es2018",
21
+ outDir: "dist",
22
+ external: ["zod"],
23
+ codeSplitting: false,
24
+ checks: { pluginTimings: false },
25
+ outputOptions(options) {
26
+ options.entryFileNames = "[name].umd.js";
27
+ options.globals = {
28
+ zod: "Zod",
29
+ uuid: "uuid",
30
+ "partial-json": "partialJson",
31
+ "@ag-ui/client": "AgUIClient",
32
+ };
33
+ return options;
34
+ },
35
+ },
36
+ ]);
package/dist/index.d.ts DELETED
@@ -1,84 +0,0 @@
1
- import { BaseEvent } from '@ag-ui/client';
2
-
3
- type MaybePromise<T> = T | PromiseLike<T>;
4
- /**
5
- * More specific utility for records with at least one key
6
- */
7
- type NonEmptyRecord<T> = T extends Record<string, unknown> ? keyof T extends never ? never : T : never;
8
- /**
9
- * Type representing an agent's basic information
10
- */
11
- interface AgentDescription {
12
- name: string;
13
- className: string;
14
- description: string;
15
- }
16
- interface RuntimeInfo {
17
- version: string;
18
- agents: Record<string, AgentDescription>;
19
- audioFileTranscriptionEnabled: boolean;
20
- }
21
-
22
- declare function randomUUID(): string;
23
- declare function partialJSONParse(json: string): any;
24
-
25
- declare const logger: Console;
26
-
27
- declare const DEFAULT_AGENT_ID = "default";
28
-
29
- interface FinalizeRunOptions {
30
- stopRequested?: boolean;
31
- interruptionMessage?: string;
32
- }
33
- declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
34
-
35
- /**
36
- * Error codes for transcription HTTP responses.
37
- * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
38
- * These codes are returned by the runtime and parsed by the client.
39
- */
40
- declare enum TranscriptionErrorCode {
41
- /** Transcription service not configured in runtime */
42
- SERVICE_NOT_CONFIGURED = "service_not_configured",
43
- /** Audio format not supported */
44
- INVALID_AUDIO_FORMAT = "invalid_audio_format",
45
- /** Audio file is too long */
46
- AUDIO_TOO_LONG = "audio_too_long",
47
- /** Audio file is empty or too short */
48
- AUDIO_TOO_SHORT = "audio_too_short",
49
- /** Rate limited by transcription provider */
50
- RATE_LIMITED = "rate_limited",
51
- /** Authentication failed with transcription provider */
52
- AUTH_FAILED = "auth_failed",
53
- /** Transcription provider returned an error */
54
- PROVIDER_ERROR = "provider_error",
55
- /** Network error during transcription */
56
- NETWORK_ERROR = "network_error",
57
- /** Invalid request format */
58
- INVALID_REQUEST = "invalid_request"
59
- }
60
- /**
61
- * Error response format returned by the transcription endpoint.
62
- */
63
- interface TranscriptionErrorResponse {
64
- error: TranscriptionErrorCode;
65
- message: string;
66
- retryable?: boolean;
67
- }
68
- /**
69
- * Helper functions to create transcription error responses.
70
- * Used by the runtime to return consistent error responses.
71
- */
72
- declare const TranscriptionErrors: {
73
- serviceNotConfigured: () => TranscriptionErrorResponse;
74
- invalidAudioFormat: (format: string, supported: string[]) => TranscriptionErrorResponse;
75
- invalidRequest: (details: string) => TranscriptionErrorResponse;
76
- rateLimited: () => TranscriptionErrorResponse;
77
- authFailed: () => TranscriptionErrorResponse;
78
- providerError: (message: string) => TranscriptionErrorResponse;
79
- networkError: (message?: string) => TranscriptionErrorResponse;
80
- audioTooLong: () => TranscriptionErrorResponse;
81
- audioTooShort: () => TranscriptionErrorResponse;
82
- };
83
-
84
- export { type AgentDescription, DEFAULT_AGENT_ID, type MaybePromise, type NonEmptyRecord, type RuntimeInfo, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, finalizeRunEvents, logger, partialJSONParse, randomUUID };