copilotkit 0.0.4 → 0.0.5
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/README.md +40 -2
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +8 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/base-command.d.ts +11 -0
- package/dist/commands/base-command.js +70 -0
- package/dist/commands/base-command.js.map +1 -0
- package/dist/commands/dev.d.ts +25 -0
- package/dist/commands/dev.js +591 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/login.d.ts +13 -0
- package/dist/commands/login.js +306 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +13 -0
- package/dist/commands/logout.js +309 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/services/analytics.service.d.ts +25 -0
- package/dist/services/analytics.service.js +75 -0
- package/dist/services/analytics.service.js.map +1 -0
- package/dist/services/auth.service.d.ts +23 -0
- package/dist/services/auth.service.js +226 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/events.d.ts +31 -0
- package/dist/services/events.js +1 -0
- package/dist/services/events.js.map +1 -0
- package/dist/services/tunnel.service.d.ts +15 -0
- package/dist/services/tunnel.service.js +17 -0
- package/dist/services/tunnel.service.js.map +1 -0
- package/dist/utils/detect-endpoint-type.utils.d.ts +13 -0
- package/dist/utils/detect-endpoint-type.utils.js +117 -0
- package/dist/utils/detect-endpoint-type.utils.js.map +1 -0
- package/dist/utils/trpc.d.ts +4 -0
- package/dist/utils/trpc.js +25 -0
- package/dist/utils/trpc.js.map +1 -0
- package/dist/utils/version.d.ts +3 -0
- package/dist/utils/version.js +6 -0
- package/dist/utils/version.js.map +1 -0
- package/oclif.manifest.json +106 -0
- package/package.json +90 -84
- package/LICENSE +0 -13
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @copilotkit/cli
|
|
2
2
|
|
|
3
|
-
CopilotKit
|
|
3
|
+
CopilotKit CLI
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.org/package/@copilotkit/cli)
|
|
6
|
+
[](https://npmjs.org/package/@copilotkit/cli)
|
|
7
|
+
|
|
8
|
+
<!-- toc -->
|
|
9
|
+
* [@copilotkit/cli](#copilotkitcli)
|
|
10
|
+
* [Usage](#usage)
|
|
11
|
+
<!-- tocstop -->
|
|
12
|
+
|
|
13
|
+
# Usage
|
|
14
|
+
|
|
15
|
+
<!-- usage -->
|
|
16
|
+
```sh-session
|
|
17
|
+
$ npm install -g @copilotkit/cli
|
|
18
|
+
$ copilotkit COMMAND
|
|
19
|
+
running command...
|
|
20
|
+
$ copilotkit (--version)
|
|
21
|
+
@copilotkit/cli/0.0.3 darwin-arm64 node-v20.18.0
|
|
22
|
+
$ copilotkit --help [COMMAND]
|
|
23
|
+
USAGE
|
|
24
|
+
$ copilotkit COMMAND
|
|
25
|
+
...
|
|
26
|
+
```
|
|
27
|
+
<!-- usagestop -->
|
|
28
|
+
|
|
29
|
+
The CopilotKit CLI can be used in two ways:
|
|
30
|
+
|
|
31
|
+
1. Run directly with npx:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx @copilotkit/cli tunnel <port>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Install the CLI globally:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm install -g @copilotkit/cli
|
|
41
|
+
```
|
package/bin/dev.cmd
ADDED
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
package/bin/run.js
ADDED
|
@@ -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.5";
|
|
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.5\";\n","import {createTRPCClient as createTRPClient_, unstable_httpBatchStreamLink} from '@trpc/client'\nimport type {CLIRouter} from '@repo/trpc-cli'\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 };
|