copilotkit 2.0.2 → 2.0.4
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/index.js +909 -326
- package/package.json +1 -1
- package/src/commands/init.d.ts +39 -0
- package/src/commands/init.d.ts.map +1 -1
- package/src/commands/license.d.ts +8 -0
- package/src/commands/license.d.ts.map +1 -1
- package/src/services/auth.service.d.ts +36 -2
- package/src/services/auth.service.d.ts.map +1 -1
- package/src/services/cli-tips.d.ts +45 -0
- package/src/services/cli-tips.d.ts.map +1 -0
- package/src/ui/browser-login.d.ts +5 -1
- package/src/ui/browser-login.d.ts.map +1 -1
- package/src/ui/cli-tip.d.ts +111 -0
- package/src/ui/cli-tip.d.ts.map +1 -0
package/package.json
CHANGED
package/src/commands/init.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
1
2
|
import type { InitOptions, InitTemplateDefinition } from '../types.js';
|
|
2
3
|
import { login, verifyAndRefresh } from '../services/auth.service.js';
|
|
3
4
|
import { createApiClient } from '../services/api-client.js';
|
|
4
5
|
import { scaffoldProject, copyEnvExample } from '../services/project-scaffold.js';
|
|
6
|
+
import { type BrowserLoginPhase } from '../ui/browser-login.js';
|
|
5
7
|
import { getOpsApiUrl } from '../config.js';
|
|
6
8
|
/**
|
|
7
9
|
* Flags accepted by the `copilotkit init` command.
|
|
@@ -16,6 +18,13 @@ export interface InitFlags {
|
|
|
16
18
|
}
|
|
17
19
|
/** Phases of the scaffolding flow rendered after options are collected. */
|
|
18
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;
|
|
19
28
|
/** Writes a license key into the project's .env file. */
|
|
20
29
|
declare function writeLicenseKey(projectDir: string, licenseKey: string): void;
|
|
21
30
|
/** Runs git init and creates an initial commit if identity is configured. */
|
|
@@ -90,6 +99,36 @@ export declare function buildInitNextSteps(templateDefinition: InitTemplateDefin
|
|
|
90
99
|
* @param onPhaseChange - Optional callback used by the Ink UI to update progress.
|
|
91
100
|
*/
|
|
92
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;
|
|
93
132
|
/**
|
|
94
133
|
* Entry point for the `copilotkit init` command.
|
|
95
134
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/init.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/init.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAMxE,OAAO,KAAK,EAEV,WAAW,EACX,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAOrB,OAAO,EAEL,KAAK,EAEL,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,eAAe,EAIf,cAAc,EACf,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,2EAA2E;AAC3E,KAAK,aAAa,GACd,MAAM,GACN,UAAU,GACV,SAAS,GACT,KAAK,GACL,SAAS,GACT,OAAO,CAAC;AAEZ;;;;;GAKG;AACH,wBAAgB,wCAAw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I,CAAC,CAsB7D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type BrowserLoginPhase } from "../ui/browser-login.js";
|
|
1
2
|
import type { CliLicenseScope } from "../types.js";
|
|
2
3
|
/**
|
|
3
4
|
* Parsed `copilotkit license` command variants.
|
|
@@ -8,6 +9,13 @@ export type LicenseCommand = {
|
|
|
8
9
|
action: "list";
|
|
9
10
|
scope: CliLicenseScope;
|
|
10
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;
|
|
11
19
|
/**
|
|
12
20
|
* Entry point for the `copilotkit license` command.
|
|
13
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/commands/license.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -30,6 +30,37 @@ export declare function startCallbackServer(expectedState: string): Promise<{
|
|
|
30
30
|
resultPromise: Promise<CallbackResult>;
|
|
31
31
|
server: http.Server;
|
|
32
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
|
+
}
|
|
33
64
|
/**
|
|
34
65
|
* Launches the browser-based login flow, waits for the callback, exchanges
|
|
35
66
|
* the Clerk token for a CLI session token, persists the credentials, and
|
|
@@ -39,13 +70,15 @@ export declare function startCallbackServer(expectedState: string): Promise<{
|
|
|
39
70
|
* 1. Generate a random CSRF state token.
|
|
40
71
|
* 2. Start a local callback server.
|
|
41
72
|
* 3. Open the browser to the ops-frontend CLI auth page.
|
|
42
|
-
* 4. Wait for the callback with the Clerk token
|
|
73
|
+
* 4. Wait for the callback with the Clerk token, or accept a manually pasted
|
|
74
|
+
* token from {@link LoginOptions.manualClerkToken} when supplied.
|
|
43
75
|
* 5. Exchange the Clerk token for a CLI session via ops-api.
|
|
44
76
|
* 6. Persist credentials to the auth store.
|
|
45
77
|
*
|
|
78
|
+
* @param options - Optional login overrides such as a manual paste token.
|
|
46
79
|
* @returns The authenticated user and organization from the ops-api response.
|
|
47
80
|
*/
|
|
48
|
-
export declare function login(): Promise<{
|
|
81
|
+
export declare function login(options?: LoginOptions): Promise<{
|
|
49
82
|
user: {
|
|
50
83
|
id: string;
|
|
51
84
|
email: string;
|
|
@@ -55,6 +88,7 @@ export declare function login(): Promise<{
|
|
|
55
88
|
clerkOrgId: string;
|
|
56
89
|
organizationName?: string;
|
|
57
90
|
};
|
|
91
|
+
source: ClerkTokenSource;
|
|
58
92
|
}>;
|
|
59
93
|
export interface VerifyAndRefreshOptions {
|
|
60
94
|
/** When true, preserve the specific auth/session error instead of returning null. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/services/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAmB,MAAM,iBAAiB,CAAC;AASlE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACvC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB,CAAC,CA8ID;AAED
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/services/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAmB,MAAM,iBAAiB,CAAC;AASlE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACvC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB,CAAC,CA8ID;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,QAAQ,CAAC;AASrD;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,OAAO,CAAC,cAAc,CAAC,EACtC,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,GAC5C,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAqB3D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC;IAC/D,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACzD,YAAY,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC,CAiID;AAED,MAAM,WAAW,uBAAuB;IACtC,qFAAqF;IACrF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,oFACsC,CAAC;AAEpF;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,cAAc,CAOzB;AAED;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAO9E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA2BvC;AAED;;;;;;GAMG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAa5C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** User-facing CopilotKit guidance that can be rendered by future CLI surfaces. */
|
|
2
|
+
export interface CliTip {
|
|
3
|
+
/** Stable identifier for analytics, tests, and renderer keys. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Tip copy shown to the user. */
|
|
6
|
+
text: string;
|
|
7
|
+
/** Numeric estimate of how relevant the tip is to common CLI users. */
|
|
8
|
+
relevancy: number;
|
|
9
|
+
/** Numeric estimate of how much implementation insight the tip provides. */
|
|
10
|
+
insight: number;
|
|
11
|
+
}
|
|
12
|
+
/** Options used to select a ranked subset of CLI tips. */
|
|
13
|
+
export interface SelectCliTipsOptions {
|
|
14
|
+
/** Candidate tips to rank and filter. */
|
|
15
|
+
tips?: readonly CliTip[];
|
|
16
|
+
/** Maximum number of tips to return after ranking. */
|
|
17
|
+
limit?: number;
|
|
18
|
+
/** Minimum relevancy score required for inclusion. */
|
|
19
|
+
minimumRelevancy?: number;
|
|
20
|
+
/** Minimum insight score required for inclusion. */
|
|
21
|
+
minimumInsight?: number;
|
|
22
|
+
}
|
|
23
|
+
/** Reusable CopilotKit tip catalog for later CLI rendering. */
|
|
24
|
+
export declare const CLI_TIPS: readonly CliTip[];
|
|
25
|
+
/**
|
|
26
|
+
* Returns the reusable CopilotKit CLI tip catalog.
|
|
27
|
+
*
|
|
28
|
+
* @returns Read-only CopilotKit tip entries.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCliTips(): readonly CliTip[];
|
|
31
|
+
/**
|
|
32
|
+
* Ranks CLI tips by relevancy, then insight, then stable identifier.
|
|
33
|
+
*
|
|
34
|
+
* @param tips - Candidate tips to rank.
|
|
35
|
+
* @returns A new ranked array without mutating the input.
|
|
36
|
+
*/
|
|
37
|
+
export declare function rankCliTips(tips?: readonly CliTip[]): readonly CliTip[];
|
|
38
|
+
/**
|
|
39
|
+
* Selects ranked CLI tips using optional score thresholds and a limit.
|
|
40
|
+
*
|
|
41
|
+
* @param options - Selection options.
|
|
42
|
+
* @returns Ranked tips matching the provided filters.
|
|
43
|
+
*/
|
|
44
|
+
export declare function selectCliTips(options?: SelectCliTipsOptions): readonly CliTip[];
|
|
45
|
+
//# sourceMappingURL=cli-tips.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-tips.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/services/cli-tips.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,WAAW,MAAM;IACrB,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+DAA+D;AAC/D,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAuPpC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,SAAS,MAAM,EAAE,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE,SAAS,MAAM,EAAa,GAAG,SAAS,MAAM,EAAE,CAcjF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,SAAS,MAAM,EAAE,CAYnF"}
|
|
@@ -7,7 +7,7 @@ export declare const BROWSER_LOGIN_CONFIRMATION_PROMPT = "Press Enter to continu
|
|
|
7
7
|
/** Browser login function shape shared by command flows. */
|
|
8
8
|
export type BrowserLoginRunner = typeof defaultLogin;
|
|
9
9
|
/** Rendered state for the shared browser-login interaction. */
|
|
10
|
-
export type BrowserLoginPhase = "idle" | "confirming" | "waiting" | "success" | "error";
|
|
10
|
+
export type BrowserLoginPhase = "idle" | "confirming" | "waiting" | "finalizing" | "success" | "error";
|
|
11
11
|
/** User and organization data displayed after a successful login. */
|
|
12
12
|
export interface BrowserLoginIdentity {
|
|
13
13
|
/** Authenticated user email. */
|
|
@@ -32,6 +32,8 @@ export interface BrowserLoginContextValue {
|
|
|
32
32
|
state: BrowserLoginState;
|
|
33
33
|
/** Confirms that the browser login may begin. */
|
|
34
34
|
confirmBrowserLoginStart: () => unknown;
|
|
35
|
+
/** Submits a manually pasted Clerk token to complete login when the loopback callback never fires. */
|
|
36
|
+
submitManualClerkToken: (clerkToken: string) => unknown;
|
|
35
37
|
}
|
|
36
38
|
/** Props for {@link BrowserLoginProvider}. */
|
|
37
39
|
export interface BrowserLoginProviderProps {
|
|
@@ -62,6 +64,8 @@ export declare function BrowserLoginProvider({ children, loginRunner, isInteract
|
|
|
62
64
|
* @throws When rendered outside {@link BrowserLoginProvider}.
|
|
63
65
|
*/
|
|
64
66
|
export declare function useBrowserLogin(): BrowserLoginContextValue;
|
|
67
|
+
/** Hint shown beneath the spinner so users know about the manual paste fallback. */
|
|
68
|
+
export declare const BROWSER_LOGIN_MANUAL_PASTE_LABEL = "If your browser finished sign-in but the CLI didn't notice, paste the code shown in the browser:";
|
|
65
69
|
/**
|
|
66
70
|
* Renders the shared browser-login confirmation and result states.
|
|
67
71
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-login.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/ui/browser-login.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"browser-login.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/ui/browser-login.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKpE,yEAAyE;AACzE,eAAO,MAAM,kCAAkC,qEACW,CAAC;AAE3D,oDAAoD;AACpD,eAAO,MAAM,iCAAiC,+BAChB,CAAC;AAE/B,4DAA4D;AAC5D,MAAM,MAAM,kBAAkB,GAAG,OAAO,YAAY,CAAC;AAErD,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,SAAS,GACT,OAAO,CAAC;AAUZ,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,KAAK,EAAE,iBAAiB,CAAC;IACzB,uDAAuD;IACvD,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACtC,0DAA0D;IAC1D,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,6DAA6D;AAC7D,MAAM,WAAW,wBAAwB;IACvC,mFAAmF;IACnF,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,sCAAsC;IACtC,KAAK,EAAE,iBAAiB,CAAC;IACzB,iDAAiD;IACjD,wBAAwB,EAAE,MAAM,OAAO,CAAC;IACxC,sGAAsG;IACtG,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CACzD;AAED,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,4DAA4D;IAC5D,QAAQ,EAAE,SAAS,CAAC;IACpB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,oDAAoD;IACpD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA2BD;;;;GAIG;AACH,wBAAgB,qCAAqC,IAAI,OAAO,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,WAA0B,EAC1B,aAAa,GACd,EAAE,yBAAyB,GAAG,YAAY,CAoJ1C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,wBAAwB,CAO1D;AAED,oFAAoF;AACpF,eAAO,MAAM,gCAAgC,qGACuD,CAAC;AAErG;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,YAAY,GAAG,IAAI,CAoF9D"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type CliTip as CliTipEntry } from '../services/cli-tips.js';
|
|
3
|
+
/** Default delay before a CLI tip appears in a dwell surface. */
|
|
4
|
+
export declare const CLI_TIP_DEFAULT_DELAY_MS = 2500;
|
|
5
|
+
/** Default quiet rotation interval after the first CLI tip is visible. */
|
|
6
|
+
export declare const CLI_TIP_DEFAULT_ROTATION_MS = 12000;
|
|
7
|
+
/** Default maximum number of top-ranked tips included in rotation. */
|
|
8
|
+
export declare const CLI_TIP_DEFAULT_ROTATION_LIMIT = 5;
|
|
9
|
+
/** Default size of the ranked pool eligible for randomized rotation. */
|
|
10
|
+
export declare const CLI_TIP_DEFAULT_ROTATION_POOL_LIMIT = 20;
|
|
11
|
+
/** Function used to generate a random number in the range [0, 1). */
|
|
12
|
+
export type CliTipRandomNumberGenerator = () => number;
|
|
13
|
+
/** Parsed segment of CLI tip text. */
|
|
14
|
+
export interface CliTipTextSegment {
|
|
15
|
+
/** Segment rendering style. */
|
|
16
|
+
kind: 'text' | 'code';
|
|
17
|
+
/** Segment text content. */
|
|
18
|
+
text: string;
|
|
19
|
+
}
|
|
20
|
+
/** Options for selecting a CLI tip rotation subset. */
|
|
21
|
+
export interface SelectCliTipRotationSubsetOptions {
|
|
22
|
+
/** Maximum number of top-ranked tips included in rotation. */
|
|
23
|
+
rotationLimit?: number;
|
|
24
|
+
/** Maximum number of top-ranked tips eligible for randomized selection. */
|
|
25
|
+
rotationPoolLimit?: number;
|
|
26
|
+
/** Whether to shuffle the ranked pool before taking the rotation subset. */
|
|
27
|
+
randomize?: boolean;
|
|
28
|
+
/** Random number generator used when randomizing the rotation subset. */
|
|
29
|
+
rng?: CliTipRandomNumberGenerator;
|
|
30
|
+
}
|
|
31
|
+
/** Props for {@link CliTip}. */
|
|
32
|
+
export interface CliTipProps {
|
|
33
|
+
/** Optional candidate tips, primarily for tests. */
|
|
34
|
+
tips?: readonly CliTipEntry[];
|
|
35
|
+
/** Zero-based index into the deterministic ranked tip list. */
|
|
36
|
+
selectionIndex?: number;
|
|
37
|
+
/** Delay before rendering the selected tip. */
|
|
38
|
+
delayMs?: number;
|
|
39
|
+
/** Quiet rotation interval once the first tip is visible. */
|
|
40
|
+
rotationMs?: number;
|
|
41
|
+
/** Maximum number of top-ranked tips included in rotation. */
|
|
42
|
+
rotationLimit?: number;
|
|
43
|
+
/** Maximum number of top-ranked tips eligible for randomized selection. */
|
|
44
|
+
rotationPoolLimit?: number;
|
|
45
|
+
/** Whether to randomize the bounded rotation subset. */
|
|
46
|
+
randomize?: boolean;
|
|
47
|
+
/** Random number generator used when randomizing the rotation subset. */
|
|
48
|
+
rng?: CliTipRandomNumberGenerator;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Normalizes a numeric index for deterministic tip selection.
|
|
52
|
+
*
|
|
53
|
+
* @param selectionIndex - Candidate index.
|
|
54
|
+
* @returns A finite non-negative integer index.
|
|
55
|
+
*/
|
|
56
|
+
export declare function normalizeCliTipSelectionIndex(selectionIndex?: number): number;
|
|
57
|
+
/**
|
|
58
|
+
* Normalizes a positive integer limit with a fallback.
|
|
59
|
+
*
|
|
60
|
+
* @param limit - Candidate limit.
|
|
61
|
+
* @param fallback - Fallback limit for non-finite values.
|
|
62
|
+
* @returns A finite non-negative integer limit.
|
|
63
|
+
*/
|
|
64
|
+
export declare function normalizeCliTipLimit(limit: number, fallback: number): number;
|
|
65
|
+
/**
|
|
66
|
+
* Normalizes RNG output for bounded array indexing.
|
|
67
|
+
*
|
|
68
|
+
* @param randomValue - Candidate random number.
|
|
69
|
+
* @returns A finite number in the range [0, 1).
|
|
70
|
+
*/
|
|
71
|
+
export declare function normalizeCliTipRandomValue(randomValue: number): number;
|
|
72
|
+
/**
|
|
73
|
+
* Shuffles tips using Fisher-Yates without mutating the input.
|
|
74
|
+
*
|
|
75
|
+
* @param tips - Tips to shuffle.
|
|
76
|
+
* @param rng - Random number generator.
|
|
77
|
+
* @returns Shuffled tip copy.
|
|
78
|
+
*/
|
|
79
|
+
export declare function shuffleCliTips(tips: readonly CliTipEntry[], rng?: CliTipRandomNumberGenerator): readonly CliTipEntry[];
|
|
80
|
+
/**
|
|
81
|
+
* Selects a bounded subset from the ranked catalog.
|
|
82
|
+
*
|
|
83
|
+
* @param tips - Candidate tips to rank.
|
|
84
|
+
* @param options - Rotation subset options.
|
|
85
|
+
* @returns Tips included in rotation.
|
|
86
|
+
*/
|
|
87
|
+
export declare function selectCliTipRotationSubset(tips?: readonly CliTipEntry[], options?: SelectCliTipRotationSubsetOptions | number): readonly CliTipEntry[];
|
|
88
|
+
/**
|
|
89
|
+
* Selects one deterministic CLI tip from the bounded ranked rotation subset.
|
|
90
|
+
*
|
|
91
|
+
* @param tips - Candidate tips to rank.
|
|
92
|
+
* @param selectionIndex - Zero-based initial offset into the rotation subset.
|
|
93
|
+
* @param rotationLimit - Maximum number of top-ranked tips to include.
|
|
94
|
+
* @returns The selected tip, or `null` when no tip is available.
|
|
95
|
+
*/
|
|
96
|
+
export declare function selectCliTipForRender(tips?: readonly CliTipEntry[], selectionIndex?: number, rotationLimit?: number): CliTipEntry | null;
|
|
97
|
+
/**
|
|
98
|
+
* Parses matched backtick code spans while preserving unmatched backticks.
|
|
99
|
+
*
|
|
100
|
+
* @param text - Tip text to parse.
|
|
101
|
+
* @returns Ordered text and code segments.
|
|
102
|
+
*/
|
|
103
|
+
export declare function parseCliTipText(text: string): readonly CliTipTextSegment[];
|
|
104
|
+
/**
|
|
105
|
+
* Renders a delayed CopilotKit CLI tip for intentional dwell moments.
|
|
106
|
+
*
|
|
107
|
+
* @param props - Component props.
|
|
108
|
+
* @returns Ink element once the delay has elapsed, otherwise `null`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function CliTip({ tips, selectionIndex, delayMs, rotationMs, rotationLimit, rotationPoolLimit, randomize, rng, }: CliTipProps): ReactElement | null;
|
|
111
|
+
//# sourceMappingURL=cli-tip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-tip.d.ts","sourceRoot":"","sources":["../../../../../apps/cli/src/ui/cli-tip.tsx"],"names":[],"mappings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