copilotkit 2.1.1 → 3.0.0
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 +151 -0
- package/index.js +91091 -87590
- package/package.json +1 -1
- package/src/commands/docs.d.ts +0 -17
- package/src/commands/docs.d.ts.map +0 -1
- package/src/commands/init.d.ts +0 -142
- package/src/commands/init.d.ts.map +0 -1
- package/src/commands/kite.d.ts +0 -8
- package/src/commands/kite.d.ts.map +0 -1
- package/src/commands/license.d.ts +0 -25
- package/src/commands/license.d.ts.map +0 -1
- package/src/commands/login.d.ts +0 -13
- package/src/commands/login.d.ts.map +0 -1
- package/src/commands/logs.d.ts +0 -32
- package/src/commands/logs.d.ts.map +0 -1
- package/src/commands/version.d.ts +0 -8
- package/src/commands/version.d.ts.map +0 -1
- package/src/config.d.ts +0 -46
- package/src/config.d.ts.map +0 -1
- package/src/index.d.ts +0 -21
- package/src/index.d.ts.map +0 -1
- package/src/services/agentcore-config.d.ts +0 -34
- package/src/services/agentcore-config.d.ts.map +0 -1
- package/src/services/api-client.d.ts +0 -99
- package/src/services/api-client.d.ts.map +0 -1
- package/src/services/auth.service.d.ts +0 -141
- package/src/services/auth.service.d.ts.map +0 -1
- package/src/services/cli-auth-diagnostics.d.ts +0 -71
- package/src/services/cli-auth-diagnostics.d.ts.map +0 -1
- package/src/services/cli-logs.d.ts +0 -45
- package/src/services/cli-logs.d.ts.map +0 -1
- package/src/services/cli-tips.d.ts +0 -45
- package/src/services/cli-tips.d.ts.map +0 -1
- package/src/services/config.service.d.ts +0 -53
- package/src/services/config.service.d.ts.map +0 -1
- package/src/services/kite-game-engine.d.ts +0 -99
- package/src/services/kite-game-engine.d.ts.map +0 -1
- package/src/services/kite-game-score.d.ts +0 -33
- package/src/services/kite-game-score.d.ts.map +0 -1
- package/src/services/project-scaffold.d.ts +0 -49
- package/src/services/project-scaffold.d.ts.map +0 -1
- package/src/services/showcase-config.d.ts +0 -19
- package/src/services/showcase-config.d.ts.map +0 -1
- package/src/services/telemetry/event-properties.d.ts +0 -102
- package/src/services/telemetry/event-properties.d.ts.map +0 -1
- package/src/services/telemetry/index.d.ts +0 -48
- package/src/services/telemetry/index.d.ts.map +0 -1
- package/src/services/telemetry/installation-id.d.ts +0 -22
- package/src/services/telemetry/installation-id.d.ts.map +0 -1
- package/src/services/telemetry/opt-out.d.ts +0 -24
- package/src/services/telemetry/opt-out.d.ts.map +0 -1
- package/src/services/telemetry/telemetry.service.d.ts +0 -74
- package/src/services/telemetry/telemetry.service.d.ts.map +0 -1
- package/src/types.d.ts +0 -227
- package/src/types.d.ts.map +0 -1
- package/src/ui/banner.d.ts +0 -3
- package/src/ui/banner.d.ts.map +0 -1
- package/src/ui/browser-login.d.ts +0 -75
- package/src/ui/browser-login.d.ts.map +0 -1
- package/src/ui/cli-tip.d.ts +0 -111
- package/src/ui/cli-tip.d.ts.map +0 -1
- package/src/ui/init-flow.d.ts +0 -28
- package/src/ui/init-flow.d.ts.map +0 -1
- package/src/ui/kite-game.d.ts +0 -26
- package/src/ui/kite-game.d.ts.map +0 -1
- package/src/ui/login-flow.d.ts +0 -22
- package/src/ui/login-flow.d.ts.map +0 -1
- package/src/ui/spinner.d.ts +0 -9
- package/src/ui/spinner.d.ts.map +0 -1
package/package.json
CHANGED
package/src/commands/docs.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** CopilotKit documentation URL opened by `copilotkit docs`. */
|
|
2
|
-
export declare const COPILOTKIT_DOCS_URL = "https://docs.copilotkit.ai";
|
|
3
|
-
/**
|
|
4
|
-
* Detects whether browser automation should be skipped for the current process.
|
|
5
|
-
*
|
|
6
|
-
* @param env - Process environment variables.
|
|
7
|
-
* @returns `true` when the command should print the URL instead of opening it.
|
|
8
|
-
*/
|
|
9
|
-
export declare function shouldSkipBrowserOpen(env?: NodeJS.ProcessEnv): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Opens the CopilotKit documentation in the user's browser.
|
|
12
|
-
*
|
|
13
|
-
* In CI, or when browser opening fails, the command prints the URL so it can be
|
|
14
|
-
* opened manually.
|
|
15
|
-
*/
|
|
16
|
-
export declare function runDocs(): Promise<void>;
|
|
17
|
-
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/docs.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAInF;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAY7C"}
|
package/src/commands/init.d.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { type ReactElement } from 'react';
|
|
2
|
-
import type { InitOptions, InitTemplateDefinition } from '../types.js';
|
|
3
|
-
import { login, verifyAndRefresh } from '../services/auth.service.js';
|
|
4
|
-
import { createApiClient } from '../services/api-client.js';
|
|
5
|
-
import { scaffoldProject, copyEnvExample } from '../services/project-scaffold.js';
|
|
6
|
-
import { type BrowserLoginPhase } from '../ui/browser-login.js';
|
|
7
|
-
import { getOpsApiUrl } from '../config.js';
|
|
8
|
-
/**
|
|
9
|
-
* Flags accepted by the `copilotkit init` command.
|
|
10
|
-
*/
|
|
11
|
-
export interface InitFlags {
|
|
12
|
-
/** Human-readable project name (sets the directory name). */
|
|
13
|
-
name?: string;
|
|
14
|
-
/** Pre-select the Intelligence (threads) path. */
|
|
15
|
-
intelligence?: boolean;
|
|
16
|
-
/** Pre-select a framework (skips intelligence question). */
|
|
17
|
-
framework?: string;
|
|
18
|
-
}
|
|
19
|
-
/** Phases of the scaffolding flow rendered after options are collected. */
|
|
20
|
-
type ScaffoldPhase = 'auth' | 'scaffold' | 'license' | 'git' | 'success' | 'error';
|
|
21
|
-
/**
|
|
22
|
-
* Returns whether the embedded init browser-login UI should take over rendering.
|
|
23
|
-
*
|
|
24
|
-
* @param phase - Current shared browser-login phase.
|
|
25
|
-
* @returns True when the browser-login component has an active visible state.
|
|
26
|
-
*/
|
|
27
|
-
export declare function shouldRenderInitBrowserLoginConfirmation(phase: BrowserLoginPhase): boolean;
|
|
28
|
-
/** Writes a license key into the project's .env file. */
|
|
29
|
-
declare function writeLicenseKey(projectDir: string, licenseKey: string): void;
|
|
30
|
-
/** Runs git init and creates an initial commit if identity is configured. */
|
|
31
|
-
declare function initGit(projectDir: string): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Checks whether a command is available on PATH.
|
|
34
|
-
*
|
|
35
|
-
* @param command - Executable name to check.
|
|
36
|
-
* @param environment - Environment variables that provide PATH/PATHEXT.
|
|
37
|
-
* @param platform - Platform used to apply executable extension rules.
|
|
38
|
-
* @returns `true` when the command can be resolved.
|
|
39
|
-
*/
|
|
40
|
-
export declare function commandExists(command: string, environment?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
|
|
41
|
-
/** Outcome from preparing environment files during scaffolding. */
|
|
42
|
-
export interface InitScaffoldResult {
|
|
43
|
-
/** Absolute project directory created by init. */
|
|
44
|
-
projectDir: string;
|
|
45
|
-
/** Whether `.env` was created from `.env.example`. */
|
|
46
|
-
envCreatedFromExample: boolean;
|
|
47
|
-
/** Whether a license token was written to `.env`. */
|
|
48
|
-
licenseWritten: boolean;
|
|
49
|
-
/** Prerequisite commands missing from PATH. */
|
|
50
|
-
missingPrerequisites: string[];
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Dependencies used by the `copilotkit init` scaffold flow.
|
|
54
|
-
*
|
|
55
|
-
* Extracted so the behavior split can be tested without rendering Ink or
|
|
56
|
-
* touching the network/filesystem.
|
|
57
|
-
*/
|
|
58
|
-
export interface InitScaffoldDependencies {
|
|
59
|
-
/** Verifies the current CLI session, refreshing persisted auth when valid. */
|
|
60
|
-
verifyAndRefresh: typeof verifyAndRefresh;
|
|
61
|
-
/** Launches the browser login flow when no valid CLI session exists. */
|
|
62
|
-
login: typeof login;
|
|
63
|
-
/** Reads the persisted CLI session token after authentication. */
|
|
64
|
-
getCliToken: () => string | null;
|
|
65
|
-
/** Creates an authenticated ops API client. */
|
|
66
|
-
createApiClient: typeof createApiClient;
|
|
67
|
-
/** Resolves the ops API base URL used by the API client. */
|
|
68
|
-
getOpsApiUrl: typeof getOpsApiUrl;
|
|
69
|
-
/** Downloads and copies the selected starter template. */
|
|
70
|
-
scaffoldProject: typeof scaffoldProject;
|
|
71
|
-
/** Initializes git in the scaffolded project directory. */
|
|
72
|
-
initGit: typeof initGit;
|
|
73
|
-
/** Copies `.env.example` to `.env` when present. */
|
|
74
|
-
copyEnvExample: typeof copyEnvExample;
|
|
75
|
-
/** Writes the issued license key into the scaffolded project. */
|
|
76
|
-
writeLicenseKey: typeof writeLicenseKey;
|
|
77
|
-
/** Checks whether a prerequisite command is available on PATH. */
|
|
78
|
-
commandExists: typeof commandExists;
|
|
79
|
-
/** Resolves the final project directory for the supplied project name. */
|
|
80
|
-
resolveProjectDir: (projectName: string) => string;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Builds the final onboarding copy from template metadata and scaffold results.
|
|
84
|
-
*
|
|
85
|
-
* @param templateDefinition - Selected template metadata.
|
|
86
|
-
* @param projectName - Directory name chosen by the user.
|
|
87
|
-
* @param result - Filesystem and prerequisite outcomes from scaffolding.
|
|
88
|
-
* @returns Lines rendered as post-init next steps.
|
|
89
|
-
*/
|
|
90
|
-
export declare function buildInitNextSteps(templateDefinition: InitTemplateDefinition, projectName: string, result: InitScaffoldResult): string[];
|
|
91
|
-
/**
|
|
92
|
-
* Runs the `copilotkit init` scaffold steps for the resolved template.
|
|
93
|
-
*
|
|
94
|
-
* The template metadata decides whether auth and license issuance are required,
|
|
95
|
-
* allowing non-license templates to scaffold without touching auth at all.
|
|
96
|
-
*
|
|
97
|
-
* @param options - Fully resolved init options.
|
|
98
|
-
* @param dependencies - Injectable dependencies for IO and auth operations.
|
|
99
|
-
* @param onPhaseChange - Optional callback used by the Ink UI to update progress.
|
|
100
|
-
*/
|
|
101
|
-
export declare function scaffoldInitProject(options: InitOptions, dependencies?: InitScaffoldDependencies, onPhaseChange?: (phase: Exclude<ScaffoldPhase, 'success' | 'error'>) => void, onTerminalSessionInvalidation?: () => void): Promise<InitScaffoldResult>;
|
|
102
|
-
/**
|
|
103
|
-
* Root Ink component for the `init` command.
|
|
104
|
-
*
|
|
105
|
-
* Manages two phases:
|
|
106
|
-
* 1. **Prompts** — renders {@link InitFlow} to collect missing options.
|
|
107
|
-
* 2. **Scaffolding** — renders {@link ScaffoldProgress} to perform async work.
|
|
108
|
-
*
|
|
109
|
-
* A single `render()` call is used; internal state drives the transition
|
|
110
|
-
* between phases.
|
|
111
|
-
*/
|
|
112
|
-
/** Renders the scaffold progress UI for resolved init options. */
|
|
113
|
-
type ScaffoldProgressRenderer = (options: InitOptions) => ReactElement;
|
|
114
|
-
/** Props for {@link InitApp}. */
|
|
115
|
-
export interface InitAppProps {
|
|
116
|
-
/** Project name supplied by flags, or `null` when interactive collection is required. */
|
|
117
|
-
initialName: string | null;
|
|
118
|
-
/** Intelligence selection supplied by flags, or `null` when interactive collection is required. */
|
|
119
|
-
initialIntelligence: boolean | null;
|
|
120
|
-
/** Framework supplied by flags, or `null` when interactive collection is required. */
|
|
121
|
-
initialFramework: string | null;
|
|
122
|
-
/** Injectable scaffold renderer, primarily for tests. */
|
|
123
|
-
renderScaffoldProgress?: ScaffoldProgressRenderer;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Resolves fully pre-filled flags into InitOptions without prompts.
|
|
127
|
-
*
|
|
128
|
-
* Returns `null` when interactive prompts are still needed.
|
|
129
|
-
*/
|
|
130
|
-
export declare function resolvePrefilledOptions(name: string | null, intelligence: boolean | null, framework: string | null): InitOptions | null;
|
|
131
|
-
export declare function InitApp({ initialName, initialIntelligence, initialFramework, renderScaffoldProgress, }: InitAppProps): import("react/jsx-runtime").JSX.Element;
|
|
132
|
-
/**
|
|
133
|
-
* Entry point for the `copilotkit init` command.
|
|
134
|
-
*
|
|
135
|
-
* Parses and validates flags, then renders the interactive Ink UI that
|
|
136
|
-
* guides the user through prompts and scaffolding.
|
|
137
|
-
*
|
|
138
|
-
* @param flags - Raw flags passed from the CLI argument parser.
|
|
139
|
-
*/
|
|
140
|
-
export declare function runInit(flags: InitFlags): Promise<void>;
|
|
141
|
-
export {};
|
|
142
|
-
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/init.tsx"],"names":[],"mappings":"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"}
|
package/src/commands/kite.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kite.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/kite.tsx"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAS7C"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type BrowserLoginPhase } from "../ui/browser-login.js";
|
|
2
|
-
import type { CliLicenseScope } from "../types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Parsed `copilotkit license` command variants.
|
|
5
|
-
*/
|
|
6
|
-
export type LicenseCommand = {
|
|
7
|
-
action: "create";
|
|
8
|
-
} | {
|
|
9
|
-
action: "list";
|
|
10
|
-
scope: CliLicenseScope;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Returns whether the embedded license-create browser-login UI should take over rendering.
|
|
14
|
-
*
|
|
15
|
-
* @param phase - Current shared browser-login phase.
|
|
16
|
-
* @returns True when the browser-login component has an active visible state.
|
|
17
|
-
*/
|
|
18
|
-
export declare function shouldRenderLicenseCreateBrowserLoginConfirmation(phase: BrowserLoginPhase): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Entry point for the `copilotkit license` command.
|
|
21
|
-
*
|
|
22
|
-
* @param command - Resolved license command variant.
|
|
23
|
-
*/
|
|
24
|
-
export declare function runLicense(command: LicenseCommand): Promise<void>;
|
|
25
|
-
//# sourceMappingURL=license.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/license.tsx"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,iBAAiB,EAGvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,aAAa,CAAC;AAIrB;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GACpB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAC;AAK/C;;;;;GAKG;AACH,wBAAgB,iDAAiD,CAC/D,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAET;AAmTD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBvE"}
|
package/src/commands/login.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runs the ink-based login command.
|
|
3
|
-
*
|
|
4
|
-
* Renders {@link LoginFlow} inside an ink instance and returns a promise that
|
|
5
|
-
* resolves when the user authenticates successfully or rejects when the login
|
|
6
|
-
* attempt fails. A short delay before unmounting ensures all output is flushed
|
|
7
|
-
* to the terminal before the process continues.
|
|
8
|
-
*
|
|
9
|
-
* @returns A promise that resolves on successful login.
|
|
10
|
-
* @throws When the browser-based login flow fails.
|
|
11
|
-
*/
|
|
12
|
-
export declare function runLogin(): Promise<void>;
|
|
13
|
-
//# sourceMappingURL=login.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/login.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAmB9C"}
|
package/src/commands/logs.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** Supported `copilotkit logs` actions. */
|
|
2
|
-
export interface LogsFlags {
|
|
3
|
-
lines?: number;
|
|
4
|
-
path?: boolean;
|
|
5
|
-
tail?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/** Normalized `copilotkit logs` action after validating flag combinations. */
|
|
8
|
-
type NormalizedLogsAction = {
|
|
9
|
-
type: 'path';
|
|
10
|
-
} | {
|
|
11
|
-
lines: number;
|
|
12
|
-
type: 'tail';
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Validates raw `copilotkit logs` flags and resolves the intended action.
|
|
16
|
-
*
|
|
17
|
-
* @param flags - Parsed command flags.
|
|
18
|
-
* @returns Normalized action to run.
|
|
19
|
-
*/
|
|
20
|
-
export declare function normalizeLogsFlags(flags: LogsFlags): NormalizedLogsAction;
|
|
21
|
-
/**
|
|
22
|
-
* Runs the CLI logs command.
|
|
23
|
-
*
|
|
24
|
-
* `--path` prints the resolved log file path.
|
|
25
|
-
* `--tail` prints the most recent log lines.
|
|
26
|
-
* With no flags, this defaults to `--path`.
|
|
27
|
-
*
|
|
28
|
-
* @param flags - Parsed command flags.
|
|
29
|
-
*/
|
|
30
|
-
export declare function runLogs(flags: LogsFlags): Promise<void>;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/logs.ts"],"names":[],"mappings":"AAEA,2CAA2C;AAC3C,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,8EAA8E;AAC9E,KAAK,oBAAoB,GACrB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,oBAAoB,CAiBzE;AAED;;;;;;;;GAQG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAe7D"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prints the CLI's build identity: semantic version, GitHub Actions run id,
|
|
3
|
-
* and the commit sha the binary was built from.
|
|
4
|
-
*
|
|
5
|
-
* `buildNumber` and `commitSha` are `"dev"` for local (non-CI) builds.
|
|
6
|
-
*/
|
|
7
|
-
export declare function runVersion(): void;
|
|
8
|
-
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/version.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAKjC"}
|
package/src/config.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build-time configuration injected via esbuild `define`.
|
|
3
|
-
*
|
|
4
|
-
* These values are replaced at build time with the corresponding
|
|
5
|
-
* environment variables. If not set during build, the build fails.
|
|
6
|
-
*
|
|
7
|
-
* {@link OPS_API_URL} can be overridden at runtime via the hidden
|
|
8
|
-
* `--ops-api-url` flag, which calls {@link setOpsApiUrl}.
|
|
9
|
-
*/
|
|
10
|
-
/** Base URL for the CopilotKit operations API. */
|
|
11
|
-
export declare function getOpsApiUrl(): string;
|
|
12
|
-
/** Override the ops API URL at runtime. */
|
|
13
|
-
export declare function setOpsApiUrl(url: string): void;
|
|
14
|
-
/** Base URL for the CopilotKit operations frontend (serves CLI auth page). */
|
|
15
|
-
export declare function getOpsFrontendUrl(): string;
|
|
16
|
-
/** Override the ops frontend URL at runtime. */
|
|
17
|
-
export declare function setOpsFrontendUrl(url: string): void;
|
|
18
|
-
/**
|
|
19
|
-
* Resolves the telemetry sink ingest endpoint URL.
|
|
20
|
-
*
|
|
21
|
-
* Honors the `COPILOTKIT_TELEMETRY_ENDPOINT` env var when set, otherwise falls
|
|
22
|
-
* back to the build-time default baked in via esbuild `define`. When neither
|
|
23
|
-
* is available (unbundled execution like `tsx` or unit tests), returns the
|
|
24
|
-
* production endpoint as a final fallback — the caller is expected to also
|
|
25
|
-
* gate sends on dev-mode detection via {@link getBuildInfo}.
|
|
26
|
-
*
|
|
27
|
-
* @returns Absolute URL of the telemetry ingest endpoint.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getTelemetryEndpointUrl(): string;
|
|
30
|
-
/**
|
|
31
|
-
* Build identity for this CLI binary.
|
|
32
|
-
*
|
|
33
|
-
* - `version` — semantic version from `apps/cli/package.json`.
|
|
34
|
-
* - `buildNumber` — GitHub Actions run id of the build, or `"dev"` for local builds.
|
|
35
|
-
* Maps back to a workflow run at github.com/<repo>/actions/runs/<buildNumber>.
|
|
36
|
-
* - `commitSha` — git commit the binary was built from, or `"dev"` for local builds.
|
|
37
|
-
*
|
|
38
|
-
* Falls back to `"dev"` when running outside an esbuild bundle (e.g., `tsx`
|
|
39
|
-
* or vitest), so callers do not crash with a `ReferenceError`.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getBuildInfo(): {
|
|
42
|
-
version: string;
|
|
43
|
-
buildNumber: string;
|
|
44
|
-
commitSha: string;
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=config.d.ts.map
|
package/src/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../apps/cli/src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,kDAAkD;AAClD,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,2CAA2C;AAC3C,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,gDAAgD;AAChD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAQhD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,IAAI;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAUA"}
|
package/src/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Returns help text for a CLI argv list when it requests help.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getHelpTextForArgs(argv: readonly string[]): string | null;
|
|
6
|
-
/**
|
|
7
|
-
* Main CLI entrypoint.
|
|
8
|
-
*/
|
|
9
|
-
export declare function main(rawArgv?: string[]): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Detects whether this module is the process entrypoint.
|
|
12
|
-
*
|
|
13
|
-
* Package managers often execute bin shims through symlinks, so both sides are
|
|
14
|
-
* compared after resolving their real filesystem paths.
|
|
15
|
-
*
|
|
16
|
-
* @param entrypoint - The process entrypoint path, usually `process.argv[1]`.
|
|
17
|
-
* @param moduleUrl - The current module URL.
|
|
18
|
-
* @returns `true` when the entrypoint resolves to the current module.
|
|
19
|
-
*/
|
|
20
|
-
export declare function isDirectInvocation(entrypoint: string | undefined, moduleUrl: string): boolean;
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../apps/cli/src/index.ts"],"names":[],"mappings":";AAgPA;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAIzE;AA8QD;;GAEG;AACH,wBAAsB,IAAI,CAAC,OAAO,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFzE;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAMT"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Variant of the AgentCore template the user picked.
|
|
3
|
-
*
|
|
4
|
-
* Both variants download the same generic `agentcore` example; this value
|
|
5
|
-
* tells {@link configureAgentCore} which agent stays and which gets removed.
|
|
6
|
-
*/
|
|
7
|
-
export type AgentCoreVariant = 'agentcore-langgraph' | 'agentcore-strands';
|
|
8
|
-
/**
|
|
9
|
-
* Specializes a freshly-scaffolded `agentcore` template into a single-framework
|
|
10
|
-
* project (LangGraph or Strands).
|
|
11
|
-
*
|
|
12
|
-
* Mirrors the behavior of the old CopilotKit CLI's `configureAgentCore` (in
|
|
13
|
-
* `packages/cli/src/commands/create.ts`) so existing AgentCore starters keep
|
|
14
|
-
* working unchanged. Specifically:
|
|
15
|
-
*
|
|
16
|
-
* 1. Renames `config.yaml.example` → `config.yaml`, patching the `pattern:`
|
|
17
|
-
* and `stack_name_base:` fields for the chosen variant.
|
|
18
|
-
* 2. Removes the unused agent folder, the unused deploy script, and the
|
|
19
|
-
* Terraform infra path that the merged template ships with.
|
|
20
|
-
* 3. Renames the kept `deploy-{framework}.sh` to `deploy.sh` and scrubs stale
|
|
21
|
-
* references to its sibling.
|
|
22
|
-
* 4. Patches Docker compose / `up.sh` / `resolve-env.py` defaults to use the
|
|
23
|
-
* chosen agent.
|
|
24
|
-
* 5. Replaces the README with a framework-specific version.
|
|
25
|
-
*
|
|
26
|
-
* Throws when the template is missing the expected files or when the YAML
|
|
27
|
-
* config doesn't match the expected `pattern:` / `stack_name_base:` shape —
|
|
28
|
-
* this keeps the CLI honest if upstream restructures the template.
|
|
29
|
-
*
|
|
30
|
-
* @param projectDir - The freshly-scaffolded AgentCore project directory.
|
|
31
|
-
* @param variant - The AgentCore framework variant to specialize for.
|
|
32
|
-
*/
|
|
33
|
-
export declare function configureAgentCore(projectDir: string, variant: AgentCoreVariant): Promise<void>;
|
|
34
|
-
//# sourceMappingURL=agentcore-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentcore-config.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/services/agentcore-config.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAgLf"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import type { AuthPayload, CliLicenseRecord, CliLicenseScope } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Error raised when ops-api returns a structured non-OK response.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ApiClientError extends Error {
|
|
6
|
-
/** HTTP status returned by the API. */
|
|
7
|
-
readonly status: number;
|
|
8
|
-
/** Stable API error code when present. */
|
|
9
|
-
readonly code?: string;
|
|
10
|
-
/**
|
|
11
|
-
* @param status - HTTP status from the failed response.
|
|
12
|
-
* @param message - User-facing error message.
|
|
13
|
-
* @param code - Optional stable API error code.
|
|
14
|
-
*/
|
|
15
|
-
constructor(status: number, message: string, code?: string);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Shape of the response from the session verification endpoint.
|
|
19
|
-
*/
|
|
20
|
-
export interface VerifySessionResponse {
|
|
21
|
-
/** The authenticated user record returned by ops-api. */
|
|
22
|
-
user: {
|
|
23
|
-
id: string;
|
|
24
|
-
email: string;
|
|
25
|
-
name: string | null;
|
|
26
|
-
};
|
|
27
|
-
/** The organization the user authenticated under. */
|
|
28
|
-
organization: {
|
|
29
|
-
clerkOrgId: string;
|
|
30
|
-
organizationName?: string;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* HTTP client for the CopilotKit ops-api CLI endpoints.
|
|
35
|
-
*
|
|
36
|
-
* Encapsulates auth, session verification, logout, and license management
|
|
37
|
-
* requests against the configured `baseUrl`.
|
|
38
|
-
*/
|
|
39
|
-
export interface ApiClient {
|
|
40
|
-
/**
|
|
41
|
-
* Exchanges a Clerk short-lived token for a CLI session token.
|
|
42
|
-
*
|
|
43
|
-
* POSTs to `/api/cli/auth/session` without an auth header since this is
|
|
44
|
-
* a pre-login exchange. Throws if the response is not OK.
|
|
45
|
-
*
|
|
46
|
-
* @param clerkToken - The Clerk token returned from the browser OAuth flow.
|
|
47
|
-
* @returns The parsed {@link AuthPayload} containing the CLI session token.
|
|
48
|
-
*/
|
|
49
|
-
exchangeClerkToken(clerkToken: string): Promise<AuthPayload>;
|
|
50
|
-
/**
|
|
51
|
-
* Verifies the current CLI session token against ops-api.
|
|
52
|
-
*
|
|
53
|
-
* GETs `/api/cli/auth/verify` with a Bearer authorization header.
|
|
54
|
-
* Throws with the server-provided auth guidance on non-OK responses.
|
|
55
|
-
*
|
|
56
|
-
* @returns The session user/org data.
|
|
57
|
-
*/
|
|
58
|
-
verifySession(): Promise<VerifySessionResponse>;
|
|
59
|
-
/**
|
|
60
|
-
* Terminates the current CLI session on the server.
|
|
61
|
-
*
|
|
62
|
-
* POSTs to `/api/cli/auth/logout` with a Bearer authorization header.
|
|
63
|
-
*/
|
|
64
|
-
logout(): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* Lists licenses for the authenticated organization or current user.
|
|
67
|
-
*
|
|
68
|
-
* GETs `/api/cli/license?scope=...` with a Bearer authorization header.
|
|
69
|
-
* Throws if the response is not OK.
|
|
70
|
-
*
|
|
71
|
-
* @param scope - Whether to list organization-wide or user-only licenses.
|
|
72
|
-
* @returns The parsed list of license metadata.
|
|
73
|
-
*/
|
|
74
|
-
listLicenses(scope: CliLicenseScope): Promise<CliLicenseRecord[]>;
|
|
75
|
-
/**
|
|
76
|
-
* Issues a new license key for the current authenticated organization.
|
|
77
|
-
*
|
|
78
|
-
* POSTs to `/api/cli/license` with a Bearer authorization header. Throws if
|
|
79
|
-
* the response is not OK.
|
|
80
|
-
*
|
|
81
|
-
* @returns An object containing the newly issued `licenseKey`.
|
|
82
|
-
*/
|
|
83
|
-
issueLicense(): Promise<{
|
|
84
|
-
licenseKey: string;
|
|
85
|
-
}>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Creates an HTTP client bound to the given base URL and optional bearer token.
|
|
89
|
-
*
|
|
90
|
-
* Methods that require authentication use the supplied `token` as a Bearer
|
|
91
|
-
* credential. The `exchangeClerkToken` method intentionally omits the auth
|
|
92
|
-
* header because it is used before a session exists.
|
|
93
|
-
*
|
|
94
|
-
* @param baseUrl - The root URL of the ops-api instance (no trailing slash).
|
|
95
|
-
* @param token - Optional CLI session token for authenticated requests.
|
|
96
|
-
* @returns An {@link ApiClient} instance.
|
|
97
|
-
*/
|
|
98
|
-
export declare function createApiClient(baseUrl: string, token?: string): ApiClient;
|
|
99
|
-
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/services/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,uCAAuC;IACvC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,0CAA0C;IAC1C,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAM3D;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACzD,qDAAqD;IACrD,YAAY,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE;AAmBD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEhD;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAElE;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAmE1E"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import * as http from "http";
|
|
2
|
-
import { ApiClientError } from "./api-client.js";
|
|
3
|
-
import type { VerifySessionResponse } from "./api-client.js";
|
|
4
|
-
/**
|
|
5
|
-
* Result of a successful callback from the browser-based login flow.
|
|
6
|
-
*/
|
|
7
|
-
export interface CallbackResult {
|
|
8
|
-
/** Short-lived Clerk token returned from the frontend callback. */
|
|
9
|
-
clerkToken: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Starts a temporary HTTP server on a random port bound to 127.0.0.1 that
|
|
13
|
-
* handles the CLI auth callback from the browser.
|
|
14
|
-
*
|
|
15
|
-
* The browser redirects (GET) to `/callback?clerkToken=…&state=…` after
|
|
16
|
-
* sign-in. The server validates `state`, resolves the result promise with
|
|
17
|
-
* the received `clerkToken`, and responds with a small HTML page telling
|
|
18
|
-
* the user they can close the tab. A full-page navigation is used rather
|
|
19
|
-
* than `fetch` so the flow works in Safari 15+ and Chrome 130+, which
|
|
20
|
-
* block HTTPS → private-network `fetch` requests.
|
|
21
|
-
*
|
|
22
|
-
* @param expectedState - The CSRF state token to validate against the callback
|
|
23
|
-
* payload.
|
|
24
|
-
* @returns A promise that resolves once the server is listening, providing the
|
|
25
|
-
* bound `port`, a `resultPromise` that resolves/rejects based on the callback
|
|
26
|
-
* payload, and the raw `server` handle for cleanup.
|
|
27
|
-
*/
|
|
28
|
-
export declare function startCallbackServer(expectedState: string): Promise<{
|
|
29
|
-
port: number;
|
|
30
|
-
resultPromise: Promise<CallbackResult>;
|
|
31
|
-
server: http.Server;
|
|
32
|
-
}>;
|
|
33
|
-
/**
|
|
34
|
-
* Origin of the Clerk token resolved during a CLI login attempt.
|
|
35
|
-
*/
|
|
36
|
-
export type ClerkTokenSource = "callback" | "manual";
|
|
37
|
-
/**
|
|
38
|
-
* Races the loopback callback against an optional manual paste promise so
|
|
39
|
-
* either path can complete the login flow.
|
|
40
|
-
*
|
|
41
|
-
* Both inputs are guarded with rejection handlers because the loser may stay
|
|
42
|
-
* pending or reject after the winner is consumed; a hanging or rejected loser
|
|
43
|
-
* must not produce an unhandled rejection or block cleanup.
|
|
44
|
-
*
|
|
45
|
-
* @param resultPromise - Loopback callback result for the CLI auth state.
|
|
46
|
-
* @param manualClerkToken - Optional manual paste promise.
|
|
47
|
-
* @returns The resolved Clerk token and the path that produced it.
|
|
48
|
-
*/
|
|
49
|
-
export declare function raceForClerkToken(resultPromise: Promise<CallbackResult>, manualClerkToken: Promise<string> | undefined): Promise<{
|
|
50
|
-
clerkToken: string;
|
|
51
|
-
source: ClerkTokenSource;
|
|
52
|
-
}>;
|
|
53
|
-
/**
|
|
54
|
-
* Optional inputs that adjust how {@link login} resolves the Clerk token.
|
|
55
|
-
*/
|
|
56
|
-
export interface LoginOptions {
|
|
57
|
-
/**
|
|
58
|
-
* Promise that resolves with a manually pasted Clerk token. Races against
|
|
59
|
-
* the loopback callback so the CLI can recover when the browser redirect
|
|
60
|
-
* never reaches the local callback server.
|
|
61
|
-
*/
|
|
62
|
-
manualClerkToken?: Promise<string>;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Launches the browser-based login flow, waits for the callback, exchanges
|
|
66
|
-
* the Clerk token for a CLI session token, persists the credentials, and
|
|
67
|
-
* returns the authenticated user and organization.
|
|
68
|
-
*
|
|
69
|
-
* Steps:
|
|
70
|
-
* 1. Generate a random CSRF state token.
|
|
71
|
-
* 2. Start a local callback server.
|
|
72
|
-
* 3. Open the browser to the ops-frontend CLI auth page.
|
|
73
|
-
* 4. Wait for the callback with the Clerk token, or accept a manually pasted
|
|
74
|
-
* token from {@link LoginOptions.manualClerkToken} when supplied.
|
|
75
|
-
* 5. Exchange the Clerk token for a CLI session via ops-api.
|
|
76
|
-
* 6. Persist credentials to the auth store.
|
|
77
|
-
*
|
|
78
|
-
* @param options - Optional login overrides such as a manual paste token.
|
|
79
|
-
* @returns The authenticated user and organization from the ops-api response.
|
|
80
|
-
*/
|
|
81
|
-
export declare function login(options?: LoginOptions): Promise<{
|
|
82
|
-
user: {
|
|
83
|
-
id: string;
|
|
84
|
-
email: string;
|
|
85
|
-
name: string | null;
|
|
86
|
-
};
|
|
87
|
-
organization: {
|
|
88
|
-
clerkOrgId: string;
|
|
89
|
-
organizationName?: string;
|
|
90
|
-
};
|
|
91
|
-
source: ClerkTokenSource;
|
|
92
|
-
}>;
|
|
93
|
-
export interface VerifyAndRefreshOptions {
|
|
94
|
-
/** When true, preserve the specific auth/session error instead of returning null. */
|
|
95
|
-
throwOnInvalid?: boolean;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* User-facing guidance shown when a stored CLI session is no longer usable
|
|
99
|
-
* after the Clerk cutover and the user must authenticate again.
|
|
100
|
-
*/
|
|
101
|
-
export declare const TERMINAL_SESSION_INVALID_MESSAGE = "Existing CLI sessions are invalid after the Clerk cutover. Please log in again.";
|
|
102
|
-
/**
|
|
103
|
-
* Checks whether an API error means the current stored CLI auth is no longer
|
|
104
|
-
* recoverable and must be cleared before the user logs in again.
|
|
105
|
-
*
|
|
106
|
-
* Treats all CLI session retirement errors, plus Clerk active-organization
|
|
107
|
-
* resolution failures, as terminal invalidation signals.
|
|
108
|
-
*
|
|
109
|
-
* @param error - Error raised by the API client.
|
|
110
|
-
* @returns `true` when local auth should be cleared and the user reauthenticated.
|
|
111
|
-
*/
|
|
112
|
-
export declare function isTerminalSessionInvalidationError(error: unknown): error is ApiClientError;
|
|
113
|
-
/**
|
|
114
|
-
* Clears the local auth store when the error represents a terminal CLI auth
|
|
115
|
-
* invalidation that requires a fresh login.
|
|
116
|
-
*
|
|
117
|
-
* @param error - Error raised by the API client.
|
|
118
|
-
* @returns `true` when local auth was cleared.
|
|
119
|
-
*/
|
|
120
|
-
export declare function clearAuthOnTerminalSessionInvalidation(error: unknown): boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Verifies the stored CLI session token against ops-api and refreshes the
|
|
123
|
-
* locally persisted credentials if still valid.
|
|
124
|
-
*
|
|
125
|
-
* Returns `null` and clears the local auth store only when the server confirms
|
|
126
|
-
* the session is invalid. Missing local auth also returns `null`. Transport or
|
|
127
|
-
* server failures are rethrown so the caller can preserve the local session.
|
|
128
|
-
*
|
|
129
|
-
* @param options - Controls how invalid sessions are surfaced to the caller.
|
|
130
|
-
* @returns The fresh session user/org data, or `null` if unauthenticated.
|
|
131
|
-
*/
|
|
132
|
-
export declare function verifyAndRefresh(options?: VerifyAndRefreshOptions): Promise<VerifySessionResponse | null>;
|
|
133
|
-
/**
|
|
134
|
-
* Terminates the current CLI session on ops-api (best-effort) and clears all
|
|
135
|
-
* locally stored credentials.
|
|
136
|
-
*
|
|
137
|
-
* Any network error from the server-side logout is swallowed; the local
|
|
138
|
-
* credentials are always cleared.
|
|
139
|
-
*/
|
|
140
|
-
export declare function logout(): Promise<void>;
|
|
141
|
-
//# sourceMappingURL=auth.service.d.ts.map
|