@copilotkitnext/shared 0.0.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.
@@ -0,0 +1,22 @@
1
+
2
+ > @copilotkitnext/shared@0.0.0 build /Users/mme/Code/CopilotKit2/packages/shared
3
+ > tsup
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.0
8
+ CLI Using tsup config: /Users/mme/Code/CopilotKit2/packages/shared/tsup.config.ts
9
+ CLI Target: es2022
10
+ CLI Cleaning output folder
11
+ CJS Build start
12
+ ESM Build start
13
+ ESM dist/index.mjs 466.00 B
14
+ ESM dist/index.mjs.map 722.00 B
15
+ ESM ⚡️ Build success in 8ms
16
+ CJS dist/index.js 2.17 KB
17
+ CJS dist/index.js.map 1.04 KB
18
+ CJS ⚡️ Build success in 8ms
19
+ DTS Build start
20
+ DTS ⚡️ Build success in 694ms
21
+ DTS dist/index.d.ts 826.00 B
22
+ DTS dist/index.d.mts 826.00 B
@@ -0,0 +1,4 @@
1
+
2
+ > @copilotkit/shared@0.0.0 check-types /Users/mme/Code/CopilotKit2/packages/shared
3
+ > tsc --noEmit
4
+
@@ -0,0 +1,4 @@
1
+
2
+ > @copilotkit/shared@0.0.0 lint /Users/mme/Code/CopilotKit2/packages/shared
3
+ > eslint . --max-warnings 0
4
+
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Note: This license does not apply to the whole project. Individual packages may contain their own licenses.
2
+
3
+ MIT License
4
+
5
+ Copyright 2025 Tawkit Inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ type MaybePromise<T> = T | PromiseLike<T>;
2
+ /**
3
+ * More specific utility for records with at least one key
4
+ */
5
+ type NonEmptyRecord<T> = T extends Record<string, unknown> ? keyof T extends never ? never : T : never;
6
+ /**
7
+ * Type representing an agent's basic information
8
+ */
9
+ interface AgentDescription {
10
+ name: string;
11
+ className: string;
12
+ description: string;
13
+ }
14
+ interface RuntimeInfo {
15
+ version: string;
16
+ agents: Record<string, AgentDescription>;
17
+ audioFileTranscriptionEnabled: boolean;
18
+ }
19
+
20
+ declare function randomUUID(): string;
21
+ declare function partialJSONParse(json: string): any;
22
+
23
+ declare const logger: Console;
24
+
25
+ declare const DEFAULT_AGENT_ID = "default";
26
+
27
+ export { type AgentDescription, DEFAULT_AGENT_ID, type MaybePromise, type NonEmptyRecord, type RuntimeInfo, logger, partialJSONParse, randomUUID };
@@ -0,0 +1,27 @@
1
+ type MaybePromise<T> = T | PromiseLike<T>;
2
+ /**
3
+ * More specific utility for records with at least one key
4
+ */
5
+ type NonEmptyRecord<T> = T extends Record<string, unknown> ? keyof T extends never ? never : T : never;
6
+ /**
7
+ * Type representing an agent's basic information
8
+ */
9
+ interface AgentDescription {
10
+ name: string;
11
+ className: string;
12
+ description: string;
13
+ }
14
+ interface RuntimeInfo {
15
+ version: string;
16
+ agents: Record<string, AgentDescription>;
17
+ audioFileTranscriptionEnabled: boolean;
18
+ }
19
+
20
+ declare function randomUUID(): string;
21
+ declare function partialJSONParse(json: string): any;
22
+
23
+ declare const logger: Console;
24
+
25
+ declare const DEFAULT_AGENT_ID = "default";
26
+
27
+ export { type AgentDescription, DEFAULT_AGENT_ID, type MaybePromise, type NonEmptyRecord, type RuntimeInfo, logger, partialJSONParse, randomUUID };
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ DEFAULT_AGENT_ID: () => DEFAULT_AGENT_ID,
34
+ logger: () => logger,
35
+ partialJSONParse: () => partialJSONParse,
36
+ randomUUID: () => randomUUID
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/utils.ts
41
+ var import_uuid = require("uuid");
42
+ var PartialJSON = __toESM(require("partial-json"));
43
+ function randomUUID() {
44
+ return (0, import_uuid.v4)();
45
+ }
46
+ function partialJSONParse(json) {
47
+ try {
48
+ return PartialJSON.parse(json);
49
+ } catch (error) {
50
+ return {};
51
+ }
52
+ }
53
+
54
+ // src/logger.ts
55
+ var logger = console;
56
+
57
+ // src/constants.ts
58
+ var DEFAULT_AGENT_ID = "default";
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ DEFAULT_AGENT_ID,
62
+ logger,
63
+ partialJSONParse,
64
+ randomUUID
65
+ });
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/logger.ts","../src/constants.ts"],"sourcesContent":["export {\n type MaybePromise,\n type NonEmptyRecord,\n type AgentDescription,\n type RuntimeInfo,\n} from \"./types\";\n\nexport * from \"./utils\";\n\nexport { logger } from \"./logger\";\nexport { DEFAULT_AGENT_ID } from \"./constants\";\n","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","export const logger = console;\n","export const DEFAULT_AGENT_ID = \"default\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA6B;AAC7B,kBAA6B;AAEtB,SAAS,aAAa;AAC3B,aAAO,YAAAA,IAAO;AAChB;AAEO,SAAS,iBAAiB,MAAc;AAC7C,MAAI;AACF,WAAmB,kBAAM,IAAI;AAAA,EAC/B,SAAS,OAAO;AACd,WAAO,CAAC;AAAA,EACV;AACF;;;ACbO,IAAM,SAAS;;;ACAf,IAAM,mBAAmB;","names":["uuidv4"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,26 @@
1
+ // src/utils.ts
2
+ import { v4 as uuidv4 } from "uuid";
3
+ import * as PartialJSON from "partial-json";
4
+ function randomUUID() {
5
+ return uuidv4();
6
+ }
7
+ function partialJSONParse(json) {
8
+ try {
9
+ return PartialJSON.parse(json);
10
+ } catch (error) {
11
+ return {};
12
+ }
13
+ }
14
+
15
+ // src/logger.ts
16
+ var logger = console;
17
+
18
+ // src/constants.ts
19
+ var DEFAULT_AGENT_ID = "default";
20
+ export {
21
+ DEFAULT_AGENT_ID,
22
+ logger,
23
+ partialJSONParse,
24
+ randomUUID
25
+ };
26
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts","../src/logger.ts","../src/constants.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","export const logger = console;\n","export const DEFAULT_AGENT_ID = \"default\";\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAC7B,YAAY,iBAAiB;AAEtB,SAAS,aAAa;AAC3B,SAAO,OAAO;AAChB;AAEO,SAAS,iBAAiB,MAAc;AAC7C,MAAI;AACF,WAAmB,kBAAM,IAAI;AAAA,EAC/B,SAAS,OAAO;AACd,WAAO,CAAC;AAAA,EACV;AACF;;;ACbO,IAAM,SAAS;;;ACAf,IAAM,mBAAmB;","names":[]}
@@ -0,0 +1,3 @@
1
+ import { config as baseConfig } from "@copilotkitnext/eslint-config/base";
2
+
3
+ export default [...baseConfig];
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@copilotkitnext/shared",
3
+ "version": "0.0.1",
4
+ "description": "Shared utilities and types for CopilotKit2",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js"
12
+ }
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "devDependencies": {
18
+ "@types/node": "^22.15.3",
19
+ "eslint": "^9.30.0",
20
+ "tsup": "^8.5.0",
21
+ "typescript": "5.8.2",
22
+ "@copilotkitnext/eslint-config": "0.0.0",
23
+ "@copilotkitnext/typescript-config": "0.0.0"
24
+ },
25
+ "dependencies": {
26
+ "uuid": "^11.1.0",
27
+ "partial-json": "^0.1.7"
28
+ },
29
+ "engines": {
30
+ "node": ">=18"
31
+ },
32
+ "scripts": {
33
+ "build": "tsup",
34
+ "dev": "tsup --watch",
35
+ "lint": "eslint . --max-warnings 0",
36
+ "check-types": "tsc --noEmit",
37
+ "clean": "rm -rf dist"
38
+ }
39
+ }
@@ -0,0 +1 @@
1
+ export const DEFAULT_AGENT_ID = "default";
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ export {
2
+ type MaybePromise,
3
+ type NonEmptyRecord,
4
+ type AgentDescription,
5
+ type RuntimeInfo,
6
+ } from "./types";
7
+
8
+ export * from "./utils";
9
+
10
+ export { logger } from "./logger";
11
+ export { DEFAULT_AGENT_ID } from "./constants";
package/src/logger.ts ADDED
@@ -0,0 +1 @@
1
+ export const logger = console;
package/src/types.ts ADDED
@@ -0,0 +1,26 @@
1
+ export type MaybePromise<T> = T | PromiseLike<T>;
2
+
3
+ /**
4
+ * More specific utility for records with at least one key
5
+ */
6
+ export type NonEmptyRecord<T> =
7
+ T extends Record<string, unknown>
8
+ ? keyof T extends never
9
+ ? never
10
+ : T
11
+ : never;
12
+
13
+ /**
14
+ * Type representing an agent's basic information
15
+ */
16
+ export interface AgentDescription {
17
+ name: string;
18
+ className: string;
19
+ description: string;
20
+ }
21
+
22
+ export interface RuntimeInfo {
23
+ version: string;
24
+ agents: Record<string, AgentDescription>;
25
+ audioFileTranscriptionEnabled: boolean;
26
+ }
package/src/utils.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { v4 as uuidv4 } from "uuid";
2
+ import * as PartialJSON from "partial-json";
3
+
4
+ export function randomUUID() {
5
+ return uuidv4();
6
+ }
7
+
8
+ export function partialJSONParse(json: string) {
9
+ try {
10
+ return PartialJSON.parse(json);
11
+ } catch (error) {
12
+ return {};
13
+ }
14
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "@copilotkitnext/typescript-config/base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true
9
+ },
10
+ "include": ["src/**/*"],
11
+ "exclude": ["dist", "node_modules"]
12
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['cjs', 'esm'],
6
+ dts: true,
7
+ sourcemap: true,
8
+ clean: true,
9
+ target: 'es2022',
10
+ outDir: 'dist',
11
+ });