copilotkit 0.0.4 → 0.0.7

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 (44) hide show
  1. package/README.md +56 -2
  2. package/bin/dev.cmd +3 -0
  3. package/bin/dev.js +8 -0
  4. package/bin/run.cmd +3 -0
  5. package/bin/run.js +5 -0
  6. package/dist/commands/base-command.d.ts +11 -0
  7. package/dist/commands/base-command.js +70 -0
  8. package/dist/commands/base-command.js.map +1 -0
  9. package/dist/commands/dev.d.ts +25 -0
  10. package/dist/commands/dev.js +591 -0
  11. package/dist/commands/dev.js.map +1 -0
  12. package/dist/commands/login.d.ts +13 -0
  13. package/dist/commands/login.js +306 -0
  14. package/dist/commands/login.js.map +1 -0
  15. package/dist/commands/logout.d.ts +13 -0
  16. package/dist/commands/logout.js +309 -0
  17. package/dist/commands/logout.js.map +1 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +6 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/services/analytics.service.d.ts +25 -0
  22. package/dist/services/analytics.service.js +75 -0
  23. package/dist/services/analytics.service.js.map +1 -0
  24. package/dist/services/auth.service.d.ts +23 -0
  25. package/dist/services/auth.service.js +226 -0
  26. package/dist/services/auth.service.js.map +1 -0
  27. package/dist/services/events.d.ts +31 -0
  28. package/dist/services/events.js +1 -0
  29. package/dist/services/events.js.map +1 -0
  30. package/dist/services/tunnel.service.d.ts +15 -0
  31. package/dist/services/tunnel.service.js +17 -0
  32. package/dist/services/tunnel.service.js.map +1 -0
  33. package/dist/utils/detect-endpoint-type.utils.d.ts +13 -0
  34. package/dist/utils/detect-endpoint-type.utils.js +117 -0
  35. package/dist/utils/detect-endpoint-type.utils.js.map +1 -0
  36. package/dist/utils/trpc.d.ts +139 -0
  37. package/dist/utils/trpc.js +25 -0
  38. package/dist/utils/trpc.js.map +1 -0
  39. package/dist/utils/version.d.ts +3 -0
  40. package/dist/utils/version.js +6 -0
  41. package/dist/utils/version.js.map +1 -0
  42. package/oclif.manifest.json +106 -0
  43. package/package.json +85 -81
  44. package/LICENSE +0 -13
package/README.md CHANGED
@@ -1,3 +1,57 @@
1
- # CopilotKit
1
+ # 🪁 CopilotKit CLI
2
2
 
3
- CopilotKit is **a library for easily building Copilot capabilities into apps **.
3
+ > **NOTE:** The CopilotKit CLI is an optional tool that enhances the developer experience of CopilotKit. [It is not required to use CopilotKit. Click here to get started with CopilotKit](https://docs.copilotkit.ai)..
4
+
5
+ [![Version](https://img.shields.io/npm/v/copilotkit.svg)](https://npmjs.org/package/copilotkit)
6
+ [![Downloads/week](https://img.shields.io/npm/dw/copilotkit.svg)](https://npmjs.org/package/copilotkit)
7
+
8
+ <!-- toc -->
9
+ * [Installation](#installation)
10
+ * [Commands](#commands)
11
+ * [Need help?](#need-help)
12
+ <!-- tocstop -->
13
+
14
+ ## What is the CopilotKit CLI?
15
+
16
+ The CopilotKit CLI boosts your [CopilotKit](https://github.com/copilotkit/copilotkit) development experience. It integrates neatly with Copilot Cloud.
17
+
18
+ ## Installation
19
+
20
+ ```sh
21
+ # npm
22
+ npm install -g copilotkit
23
+
24
+ # pnpm
25
+ pnpm install -g copilotkit
26
+
27
+ # yarn
28
+ yarn global add copilotkit
29
+ ```
30
+
31
+ ## Commands
32
+
33
+ ### `login`: Authenticating with Copilot Cloud
34
+
35
+ First, ensure you have an account on [Copilot Cloud](https://cloud.copilotkit.ai).
36
+
37
+ Then, run the following command to authenticate with Copilot Cloud:
38
+
39
+ ```sh
40
+ copilotkit login
41
+ ```
42
+
43
+ ### `dev`: Local Endpoint Development
44
+
45
+ The CopilotKit CLI allows you to create a local tunnel to your CopilotKit remote endpoints, agents, and LangGraph apps.
46
+
47
+ For example, to create a local tunnel to an endpoint running locally on port 8000, you can run:
48
+
49
+ ```sh
50
+ copilotkit dev --port 8000
51
+ ```
52
+
53
+ ## Need help?
54
+
55
+ You can always run `copilotkit --help` to get help on the CopilotKit CLI.
56
+
57
+ You're welcome tojoin our [Discord](https://discord.gg/copilotkit) to get help from the CopilotKit team and community.
package/bin/dev.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
+
3
+ // eslint-disable-next-line n/shebang
4
+ import {execute} from '@oclif/core'
5
+
6
+ process.env.SENTRY_DISABLED = 'true'
7
+ process.env.SEGMENT_DISABLED = 'true'
8
+ await execute({development: true, dir: import.meta.url})
package/bin/run.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({dir: import.meta.url})
@@ -0,0 +1,11 @@
1
+ import { Command } from '@oclif/core';
2
+
3
+ declare class BaseCommand extends Command {
4
+ init(): Promise<void>;
5
+ catch(err: any): Promise<void>;
6
+ finally(): Promise<void>;
7
+ run(): Promise<void>;
8
+ checkCLIVersion(): Promise<void>;
9
+ }
10
+
11
+ export { BaseCommand };
@@ -0,0 +1,70 @@
1
+ // src/commands/base-command.ts
2
+ import { Command } from "@oclif/core";
3
+ import Sentry, { consoleIntegration } from "@sentry/node";
4
+
5
+ // src/utils/version.ts
6
+ var LIB_VERSION = "0.0.7";
7
+
8
+ // src/utils/trpc.ts
9
+ import { createTRPCClient as createTRPClient_, unstable_httpBatchStreamLink } from "@trpc/client";
10
+ import superjson from "superjson";
11
+ var COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || "https://cloud.copilotkit.ai";
12
+
13
+ // src/commands/base-command.ts
14
+ import chalk from "chalk";
15
+ var BaseCommand = class extends Command {
16
+ async init() {
17
+ await this.checkCLIVersion();
18
+ if (process.env.SENTRY_DISABLED === "true") {
19
+ return;
20
+ }
21
+ Sentry.init({
22
+ dsn: process.env.SENTRY_DSN || "https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120",
23
+ integrations: [
24
+ consoleIntegration()
25
+ ],
26
+ // Tracing
27
+ tracesSampleRate: 1
28
+ // Capture 100% of the transactions
29
+ });
30
+ }
31
+ async catch(err) {
32
+ if (process.env.SENTRY_DISABLED === "true") {
33
+ super.catch(err);
34
+ return;
35
+ }
36
+ Sentry.captureException(err);
37
+ super.catch(err);
38
+ }
39
+ async finally() {
40
+ if (process.env.SENTRY_DISABLED === "true") {
41
+ return;
42
+ }
43
+ Sentry.close();
44
+ }
45
+ async run() {
46
+ }
47
+ async checkCLIVersion() {
48
+ const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`);
49
+ const data = await response.json();
50
+ const cloudVersion = data.cliVersion;
51
+ if (cloudVersion === LIB_VERSION) {
52
+ return;
53
+ }
54
+ this.log(chalk.yellow("================ New version available! =================\n"));
55
+ this.log(`A new CopilotKit CLI version is available (${LIB_VERSION}).
56
+ `);
57
+ this.log("Please update your CLI to the latest version:\n\n");
58
+ this.log(`${chalk.cyan(chalk.underline(chalk.bold("npm:")))} npm install -g copilotkit@${LIB_VERSION}
59
+ `);
60
+ this.log(`${chalk.cyan(chalk.underline(chalk.bold("pnpm:")))} pnpm install -g copilotkit@${LIB_VERSION}
61
+ `);
62
+ this.log(`${chalk.cyan(chalk.underline(chalk.bold("yarn:")))} yarn global add copilotkit@${LIB_VERSION}
63
+ `);
64
+ process.exit(0);
65
+ }
66
+ };
67
+ export {
68
+ BaseCommand
69
+ };
70
+ //# sourceMappingURL=base-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts"],"sourcesContent":["import { Command } from \"@oclif/core\";\nimport Sentry, { consoleIntegration } from \"@sentry/node\";\nimport { LIB_VERSION } from \"../utils/version.js\";\nimport { COPILOT_CLOUD_BASE_URL } from \"../utils/trpc.js\";\nimport chalk from \"chalk\";\n\nexport class BaseCommand extends Command {\n async init() {\n await this.checkCLIVersion();\n\n if (process.env.SENTRY_DISABLED === 'true') {\n return;\n }\n\n Sentry.init({\n dsn: process.env.SENTRY_DSN || \"https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120\",\n integrations: [\n consoleIntegration(),\n ],\n // Tracing\n tracesSampleRate: 1.0, // Capture 100% of the transactions\n });\n }\n\n async catch(err: any) {\n if (process.env.SENTRY_DISABLED === 'true') {\n super.catch(err)\n return;\n }\n\n Sentry.captureException(err)\n super.catch(err)\n }\n\n async finally() {\n if (process.env.SENTRY_DISABLED === 'true') {\n return;\n }\n\n Sentry.close()\n }\n \n async run() {}\n\n async checkCLIVersion() {\n const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`)\n const data = await response.json()\n const cloudVersion = data.cliVersion\n\n if (cloudVersion === LIB_VERSION) {\n return;\n }\n\n this.log(chalk.yellow('================ New version available! =================\\n'))\n this.log(`A new CopilotKit CLI version is available (${LIB_VERSION}).\\n`)\n this.log('Please update your CLI to the latest version:\\n\\n')\n this.log(`${chalk.cyan(chalk.underline(chalk.bold('npm:')))}\\t npm install -g copilotkit@${LIB_VERSION}\\n`)\n this.log(`${chalk.cyan(chalk.underline(chalk.bold('pnpm:')))}\\t pnpm install -g copilotkit@${LIB_VERSION}\\n`)\n this.log(`${chalk.cyan(chalk.underline(chalk.bold('yarn:')))}\\t yarn global add copilotkit@${LIB_VERSION}\\n`)\n\n process.exit(0)\n }\n}\n","// This is auto generated!\nexport const LIB_VERSION = \"0.0.7\";\n","import {createTRPCClient as createTRPClient_, unstable_httpBatchStreamLink} from '@trpc/client'\nimport type {CLIRouter} from '@repo/trpc-cli/cli-router'\nimport superjson from 'superjson'\n\nexport const COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || 'https://cloud.copilotkit.ai'\n\nexport function createTRPCClient(cliToken: string) {\n return createTRPClient_<CLIRouter>({\n links: [\n unstable_httpBatchStreamLink({\n transformer: superjson,\n url: `${COPILOT_CLOUD_BASE_URL}/api/trpc-cli`,\n headers: () => {\n const headers = new Headers()\n headers.set('x-trpc-source', 'cli')\n headers.set('x-cli-token', cliToken)\n return headers\n },\n }),\n ],\n })\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAQ,oBAAoB,kBAAkB,oCAAmC;AAEjF,OAAO,eAAe;AAEf,IAAM,yBAAyB,QAAQ,IAAI,0BAA0B;;;AFA5E,OAAO,WAAW;AAEX,IAAM,cAAN,cAA0B,QAAQ;AAAA,EACvC,MAAM,OAAO;AACX,UAAM,KAAK,gBAAgB;AAE3B,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,KAAK;AAAA,MACV,KAAK,QAAQ,IAAI,cAAc;AAAA,MAC/B,cAAc;AAAA,QACZ,mBAAmB;AAAA,MACrB;AAAA;AAAA,MAEA,kBAAkB;AAAA;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAM,KAAU;AACpB,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C,YAAM,MAAM,GAAG;AACf;AAAA,IACF;AAEA,WAAO,iBAAiB,GAAG;AAC3B,UAAM,MAAM,GAAG;AAAA,EACjB;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,MAAM,MAAM;AAAA,EAAC;AAAA,EAEb,MAAM,kBAAkB;AACtB,UAAM,WAAW,MAAM,MAAM,GAAG,sBAAsB,cAAc;AACpE,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,eAAe,KAAK;AAE1B,QAAI,iBAAiB,aAAa;AAChC;AAAA,IACF;AAEA,SAAK,IAAI,MAAM,OAAO,6DAA6D,CAAC;AACpF,SAAK,IAAI,8CAA8C,WAAW;AAAA,CAAM;AACxE,SAAK,IAAI,mDAAmD;AAC5D,SAAK,IAAI,GAAG,MAAM,KAAK,MAAM,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,+BAAgC,WAAW;AAAA,CAAI;AAC1G,SAAK,IAAI,GAAG,MAAM,KAAK,MAAM,UAAU,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,gCAAiC,WAAW;AAAA,CAAI;AAC5G,SAAK,IAAI,GAAG,MAAM,KAAK,MAAM,UAAU,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,gCAAiC,WAAW;AAAA,CAAI;AAE5G,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
@@ -0,0 +1,25 @@
1
+ import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
+ import { Config } from '@oclif/core';
3
+ import { AuthService } from '../services/auth.service.js';
4
+ import { TunnelService } from '../services/tunnel.service.js';
5
+ import { BaseCommand } from './base-command.js';
6
+ import 'localtunnel';
7
+
8
+ declare class Dev extends BaseCommand {
9
+ private authService;
10
+ private tunnelService;
11
+ static flags: {
12
+ port: _oclif_core_interfaces.OptionFlag<string, _oclif_core_interfaces.CustomOptions>;
13
+ project: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
14
+ };
15
+ static description: string;
16
+ static examples: string[];
17
+ private trpcClient;
18
+ private copilotCloudTunnelId;
19
+ constructor(argv: string[], config: Config, authService?: AuthService, tunnelService?: TunnelService);
20
+ private pingTunnelRecursively;
21
+ run(): Promise<void>;
22
+ private setupTunnel;
23
+ }
24
+
25
+ export { Dev as default };