copilotkit 2.0.3 → 2.1.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/index.js +16416 -15589
- 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/config.d.ts +15 -0
- package/src/config.d.ts.map +1 -1
- package/src/index.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/services/telemetry/event-properties.d.ts +102 -0
- package/src/services/telemetry/event-properties.d.ts.map +1 -0
- package/src/services/telemetry/index.d.ts +48 -0
- package/src/services/telemetry/index.d.ts.map +1 -0
- package/src/services/telemetry/installation-id.d.ts +22 -0
- package/src/services/telemetry/installation-id.d.ts.map +1 -0
- package/src/services/telemetry/opt-out.d.ts +24 -0
- package/src/services/telemetry/opt-out.d.ts.map +1 -0
- package/src/services/telemetry/telemetry.service.d.ts +74 -0
- package/src/services/telemetry/telemetry.service.d.ts.map +1 -0
- 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;AAC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,EAAE,MAAM,GAAG,IAAI,EACnB,YAAY,EAAE,OAAO,GAAG,IAAI,EAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,WAAW,GAAG,IAAI,CAcpB;AAED,wBAAgB,OAAO,CAAC,EACtB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsD,GACvD,EAAE,YAAY,2CA8Bd;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,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"}
|
package/src/config.d.ts
CHANGED
|
@@ -15,6 +15,18 @@ export declare function setOpsApiUrl(url: string): void;
|
|
|
15
15
|
export declare function getOpsFrontendUrl(): string;
|
|
16
16
|
/** Override the ops frontend URL at runtime. */
|
|
17
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;
|
|
18
30
|
/**
|
|
19
31
|
* Build identity for this CLI binary.
|
|
20
32
|
*
|
|
@@ -22,6 +34,9 @@ export declare function setOpsFrontendUrl(url: string): void;
|
|
|
22
34
|
* - `buildNumber` — GitHub Actions run id of the build, or `"dev"` for local builds.
|
|
23
35
|
* Maps back to a workflow run at github.com/<repo>/actions/runs/<buildNumber>.
|
|
24
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`.
|
|
25
40
|
*/
|
|
26
41
|
export declare function getBuildInfo(): {
|
|
27
42
|
version: string;
|
package/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../apps/cli/src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
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,CAMA"}
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../apps/cli/src/index.ts"],"names":[],"mappings":";
|
|
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"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** Bounded enum of `command` values emitted on telemetry events. */
|
|
2
|
+
export type TelemetryCommand = "init" | "login" | "logout" | "license" | "whoami" | "docs" | "help" | "version" | "unknown";
|
|
3
|
+
/** Bounded enum of `outcome` values emitted on telemetry events. */
|
|
4
|
+
export type TelemetryOutcome = "started" | "succeeded" | "failed";
|
|
5
|
+
/** Bounded enum of `error_code` values emitted on failed events. */
|
|
6
|
+
export type TelemetryErrorCode = "validation" | "auth" | "network" | "timeout" | "prerequisite_missing" | "template_fetch" | "git" | "filesystem" | "user_aborted" | "unknown";
|
|
7
|
+
/**
|
|
8
|
+
* Minimal session payload read from the auth store when building base
|
|
9
|
+
* properties. Decouples this module from the full {@link StoredAuth} shape.
|
|
10
|
+
*/
|
|
11
|
+
export interface TelemetryAuthSnapshot {
|
|
12
|
+
userId: string;
|
|
13
|
+
email: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Build identity payload mirroring the shape of {@link getBuildInfo}.
|
|
17
|
+
*/
|
|
18
|
+
export interface TelemetryBuildInfo {
|
|
19
|
+
version: string;
|
|
20
|
+
buildNumber: string;
|
|
21
|
+
commitSha: string;
|
|
22
|
+
}
|
|
23
|
+
/** Injectable dependencies for {@link buildBaseProperties}. */
|
|
24
|
+
export interface BaseDeps {
|
|
25
|
+
installationId: string;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
buildInfo: TelemetryBuildInfo;
|
|
28
|
+
auth: TelemetryAuthSnapshot | null;
|
|
29
|
+
env: NodeJS.ProcessEnv;
|
|
30
|
+
nodeVersion: string;
|
|
31
|
+
platform: NodeJS.Platform | string;
|
|
32
|
+
arch: string;
|
|
33
|
+
}
|
|
34
|
+
/** Output shape of {@link buildBaseProperties}. */
|
|
35
|
+
export interface BaseProperties {
|
|
36
|
+
installation_id: string;
|
|
37
|
+
session_id: string;
|
|
38
|
+
cli_version: string;
|
|
39
|
+
cli_build_number: string;
|
|
40
|
+
cli_commit_sha: string;
|
|
41
|
+
node_version: string;
|
|
42
|
+
platform: string;
|
|
43
|
+
arch: string;
|
|
44
|
+
is_ci: boolean;
|
|
45
|
+
is_authenticated: boolean;
|
|
46
|
+
clerk_user_id?: string;
|
|
47
|
+
email_hash?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Detects whether the current process is running in a CI environment.
|
|
51
|
+
*
|
|
52
|
+
* @param env - Process environment variables.
|
|
53
|
+
* @returns `true` when any known CI indicator env var is set to a non-empty value.
|
|
54
|
+
*/
|
|
55
|
+
export declare function detectCi(env: NodeJS.ProcessEnv): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Truncated SHA-256 hash of an email for PII-free correlation.
|
|
58
|
+
*
|
|
59
|
+
* Matches the wire format used by ops-api at
|
|
60
|
+
* `apps/ops-api/src/services/telemetry-sink.service.ts:68-70`.
|
|
61
|
+
*
|
|
62
|
+
* @param email - The email to hash.
|
|
63
|
+
* @returns A 16-character lowercase hex string.
|
|
64
|
+
*/
|
|
65
|
+
export declare function hashEmail(email: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Builds the base property set emitted on every telemetry event.
|
|
68
|
+
*
|
|
69
|
+
* @param deps - Build identity, auth snapshot, env, and platform info.
|
|
70
|
+
* @returns The base properties object.
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildBaseProperties(deps: BaseDeps): BaseProperties;
|
|
73
|
+
/**
|
|
74
|
+
* Flag shape for {@link subcommandForInit}.
|
|
75
|
+
*/
|
|
76
|
+
export interface InitSubcommandFlags {
|
|
77
|
+
intelligence?: boolean;
|
|
78
|
+
framework?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Derives the bounded `subcommand` property for the init/create command.
|
|
82
|
+
*
|
|
83
|
+
* Returns `"interactive"` when neither branching flag is set, `"intelligence"`
|
|
84
|
+
* for the intelligence branch, the framework value when `--framework` is set
|
|
85
|
+
* to a known {@link AgentFramework}, and `"invalid"` when an unknown framework
|
|
86
|
+
* value is supplied (to avoid leaking arbitrary user-typed strings).
|
|
87
|
+
*
|
|
88
|
+
* @param flags - The parsed init flags.
|
|
89
|
+
* @returns The bounded subcommand value.
|
|
90
|
+
*/
|
|
91
|
+
export declare function subcommandForInit(flags: InitSubcommandFlags): string;
|
|
92
|
+
/**
|
|
93
|
+
* Classifies an unknown error value into a bounded {@link TelemetryErrorCode}.
|
|
94
|
+
*
|
|
95
|
+
* Inspects `Error.name`, status codes on `ApiClientError`-shaped errors, and
|
|
96
|
+
* `AbortError` for timeouts. Never returns or emits the raw error message.
|
|
97
|
+
*
|
|
98
|
+
* @param err - The thrown value.
|
|
99
|
+
* @returns A bounded error code suitable for the `error_code` property.
|
|
100
|
+
*/
|
|
101
|
+
export declare function classifyError(err: unknown): TelemetryErrorCode;
|
|
102
|
+
//# sourceMappingURL=event-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-properties.d.ts","sourceRoot":"","sources":["../../../../../../apps/cli/src/services/telemetry/event-properties.ts"],"names":[],"mappings":"AAGA,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,MAAM,GACN,MAAM,GACN,SAAS,GACT,SAAS,CAAC;AAEd,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAElE,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAC1B,YAAY,GACZ,MAAM,GACN,SAAS,GACT,SAAS,GACT,sBAAsB,GACtB,gBAAgB,GAChB,KAAK,GACL,YAAY,GACZ,cAAc,GACd,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OA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;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAQpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,CA6B9D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type TelemetryEvent, type TelemetryEventProperties, type TelemetryService } from "./telemetry.service.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lazily constructs and returns the process-wide telemetry service.
|
|
4
|
+
*
|
|
5
|
+
* Generates a fresh `session_id` on first call, resolves opt-out state, and
|
|
6
|
+
* persists the anonymous `installation_id` if not already present.
|
|
7
|
+
*
|
|
8
|
+
* @returns The singleton telemetry service.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getTelemetry(): TelemetryService;
|
|
11
|
+
/**
|
|
12
|
+
* Records a telemetry event through the process-wide singleton.
|
|
13
|
+
*
|
|
14
|
+
* @param event - The event payload to send.
|
|
15
|
+
*/
|
|
16
|
+
export declare function recordTelemetryEvent(event: TelemetryEvent): void;
|
|
17
|
+
/**
|
|
18
|
+
* Awaits in-flight telemetry sends up to a bounded timeout. No-op when the
|
|
19
|
+
* singleton has not been initialised.
|
|
20
|
+
*
|
|
21
|
+
* @param timeoutMs - Optional override for the flush ceiling.
|
|
22
|
+
*/
|
|
23
|
+
export declare function flushTelemetry(timeoutMs?: number): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Flushes telemetry then exits the process with the given code. Use this in
|
|
26
|
+
* place of bare `process.exit(N)` calls anywhere an event may have just been
|
|
27
|
+
* recorded.
|
|
28
|
+
*
|
|
29
|
+
* @param code - The exit code to use.
|
|
30
|
+
*/
|
|
31
|
+
export declare function exitWithFlush(code: number): Promise<never>;
|
|
32
|
+
/**
|
|
33
|
+
* Wraps an async command runner with a `started` event on entry and a
|
|
34
|
+
* `succeeded` or `failed` event on exit. The wrapped function's return value
|
|
35
|
+
* and rejections pass through unchanged.
|
|
36
|
+
*
|
|
37
|
+
* @param base - The event properties common to both started and finished
|
|
38
|
+
* events (typically `{ command, subcommand?, scope? }`).
|
|
39
|
+
* @param fn - The command runner to wrap.
|
|
40
|
+
* @returns The result of `fn`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function withTelemetry<T>(base: Omit<TelemetryEventProperties, "outcome" | "duration_ms" | "error_code">, fn: () => Promise<T>): Promise<T>;
|
|
43
|
+
/**
|
|
44
|
+
* Test-only helper that drops the singleton so each test sees a fresh state.
|
|
45
|
+
* Not part of the public production surface.
|
|
46
|
+
*/
|
|
47
|
+
export declare function __resetTelemetryForTests(): void;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../apps/cli/src/services/telemetry/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAE7B,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AA2BhC;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,gBAAgB,CA4B/C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAEhE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,SAAS,GAAE,MAAiC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAGhE;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,IAAI,EAAE,IAAI,CAAC,wBAAwB,EAAE,SAAS,GAAG,aAAa,GAAG,YAAY,CAAC,EAC9E,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAoBZ;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Config-store key under which the persistent installation id is stored. */
|
|
2
|
+
export declare const INSTALLATION_ID_KEY = "telemetry.installationId";
|
|
3
|
+
/** Minimal config-store surface used to persist the installation id. */
|
|
4
|
+
export interface ConfigStoreReadWrite {
|
|
5
|
+
get<T>(key: string): T | undefined;
|
|
6
|
+
set(key: string, value: unknown): void;
|
|
7
|
+
}
|
|
8
|
+
/** Injectable dependencies for {@link getOrCreateInstallationId}. */
|
|
9
|
+
export interface InstallationIdDeps {
|
|
10
|
+
configStore: ConfigStoreReadWrite;
|
|
11
|
+
/** Injectable UUID generator for deterministic tests. Defaults to crypto. */
|
|
12
|
+
generateId?: () => string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reads the persistent anonymous installation id, generating and persisting
|
|
16
|
+
* a fresh UUID v4 on first call.
|
|
17
|
+
*
|
|
18
|
+
* @param deps - Injectable config store and id generator.
|
|
19
|
+
* @returns The installation id as a string.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getOrCreateInstallationId(deps: InstallationIdDeps): string;
|
|
22
|
+
//# sourceMappingURL=installation-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installation-id.d.ts","sourceRoot":"","sources":["../../../../../../apps/cli/src/services/telemetry/installation-id.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACxC;AAED,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,oBAAoB,CAAC;IAClC,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAS1E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves whether telemetry should be disabled for this process.
|
|
3
|
+
*
|
|
4
|
+
* Honors, in order of precedence:
|
|
5
|
+
* 1. The `DO_NOT_TRACK` env var (consoledonottrack.com standard).
|
|
6
|
+
* 2. The `COPILOTKIT_TELEMETRY_DISABLED` env var.
|
|
7
|
+
* 3. A persisted `telemetry.optOut` boolean in {@link ConfigStoreReader}.
|
|
8
|
+
*
|
|
9
|
+
* Env values are matched case-insensitively against `1 | true | yes | on`.
|
|
10
|
+
* Empty or unset values are treated as not-set.
|
|
11
|
+
*/
|
|
12
|
+
/** Minimal config-store surface used to read the persisted opt-out flag. */
|
|
13
|
+
export interface ConfigStoreReader {
|
|
14
|
+
get<T>(key: string): T | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the effective opt-out state for the current process.
|
|
18
|
+
*
|
|
19
|
+
* @param env - Process environment variables (defaults to `process.env`).
|
|
20
|
+
* @param configStore - Persistent config store with `telemetry.optOut`.
|
|
21
|
+
* @returns `true` when telemetry should be disabled.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveOptOut(env: NodeJS.ProcessEnv, configStore: ConfigStoreReader): boolean;
|
|
24
|
+
//# sourceMappingURL=opt-out.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opt-out.d.ts","sourceRoot":"","sources":["../../../../../../apps/cli/src/services/telemetry/opt-out.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;CACpC;AAaD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAIT"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { BaseProperties, TelemetryCommand, TelemetryErrorCode, TelemetryOutcome } from "./event-properties.js";
|
|
2
|
+
/** Wire-shape event name; one allowlist entry covers every CLI event. */
|
|
3
|
+
export declare const CLI_TELEMETRY_EVENT_NAME: "cli.command.invoked";
|
|
4
|
+
/** Per-event property keys that may appear in addition to base properties. */
|
|
5
|
+
export interface TelemetryEventProperties {
|
|
6
|
+
command: TelemetryCommand;
|
|
7
|
+
outcome: TelemetryOutcome;
|
|
8
|
+
subcommand?: string;
|
|
9
|
+
scope?: "org" | "user";
|
|
10
|
+
duration_ms?: number;
|
|
11
|
+
error_code?: TelemetryErrorCode;
|
|
12
|
+
}
|
|
13
|
+
/** Full event payload accepted by {@link TelemetryService.recordEvent}. */
|
|
14
|
+
export interface TelemetryEvent {
|
|
15
|
+
properties: TelemetryEventProperties;
|
|
16
|
+
}
|
|
17
|
+
/** Maximum concurrent in-flight requests; excess events are dropped. */
|
|
18
|
+
export declare const MAX_INFLIGHT = 32;
|
|
19
|
+
/** Per-request hard timeout for the outbound POST. */
|
|
20
|
+
export declare const DEFAULT_PER_REQUEST_TIMEOUT_MS = 2000;
|
|
21
|
+
/** Default flush timeout used by {@link TelemetryService.flush}. */
|
|
22
|
+
export declare const DEFAULT_FLUSH_TIMEOUT_MS = 1500;
|
|
23
|
+
/**
|
|
24
|
+
* Minimal logger surface used by the telemetry service. Mirrors the subset of
|
|
25
|
+
* the CLI's `writeCliLog` signature so callers can pass a thin wrapper.
|
|
26
|
+
*/
|
|
27
|
+
export interface TelemetryLogger {
|
|
28
|
+
debug: (payload: Record<string, unknown>) => void;
|
|
29
|
+
warn: (payload: Record<string, unknown>) => void;
|
|
30
|
+
error: (payload: Record<string, unknown>) => void;
|
|
31
|
+
}
|
|
32
|
+
/** Injectable dependencies for {@link createTelemetryService}. */
|
|
33
|
+
export interface TelemetryServiceDeps {
|
|
34
|
+
/** Master on/off; when `false`, `recordEvent` is a synchronous no-op. */
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
/** Absolute URL of the telemetry ingest endpoint. */
|
|
37
|
+
endpointUrl: string;
|
|
38
|
+
/** Producer of the base properties merged into every event. */
|
|
39
|
+
buildBaseProperties: () => BaseProperties;
|
|
40
|
+
/** Structured logger for diagnostic events. */
|
|
41
|
+
logger: TelemetryLogger;
|
|
42
|
+
/** Injectable fetch for tests. Defaults to global `fetch`. */
|
|
43
|
+
fetch?: typeof fetch;
|
|
44
|
+
/** Per-request hard timeout. Defaults to {@link DEFAULT_PER_REQUEST_TIMEOUT_MS}. */
|
|
45
|
+
perRequestTimeoutMs?: number;
|
|
46
|
+
/** Cap on in-flight requests. Defaults to {@link MAX_INFLIGHT}. */
|
|
47
|
+
maxInFlight?: number;
|
|
48
|
+
}
|
|
49
|
+
/** Public surface of the telemetry service. */
|
|
50
|
+
export interface TelemetryService {
|
|
51
|
+
/**
|
|
52
|
+
* Synchronously schedules a telemetry event for fire-and-forget delivery.
|
|
53
|
+
* Returns `void` and never throws — callers must not `await` this.
|
|
54
|
+
*/
|
|
55
|
+
recordEvent(event: TelemetryEvent): void;
|
|
56
|
+
/**
|
|
57
|
+
* Awaits all in-flight requests up to a bounded timeout, then resolves.
|
|
58
|
+
* Safe to call multiple times; resolves immediately when the queue is empty.
|
|
59
|
+
*/
|
|
60
|
+
flush(timeoutMs?: number): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Constructs a CLI telemetry service.
|
|
64
|
+
*
|
|
65
|
+
* Sends `{ event: "cli.command.invoked", properties }` to the configured
|
|
66
|
+
* endpoint as fire-and-forget POSTs, with a bounded in-flight queue and a
|
|
67
|
+
* per-request `AbortController`. All failures are swallowed and logged via
|
|
68
|
+
* the injected `logger`.
|
|
69
|
+
*
|
|
70
|
+
* @param deps - Injectable configuration and collaborators.
|
|
71
|
+
* @returns The telemetry service instance.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createTelemetryService(deps: TelemetryServiceDeps): TelemetryService;
|
|
74
|
+
//# sourceMappingURL=telemetry.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.service.d.ts","sourceRoot":"","sources":["../../../../../../apps/cli/src/services/telemetry/telemetry.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEpH,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,EAAG,qBAA8B,CAAC;AAEvE,8EAA8E;AAC9E,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAED,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,wBAAwB,CAAC;CACtC;AAED,wEAAwE;AACxE,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,sDAAsD;AACtD,eAAO,MAAM,8BAA8B,OAAQ,CAAC;AAEpD,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAClD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACjD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,mBAAmB,EAAE,MAAM,cAAc,CAAC;IAC1C,+CAA+C;IAC/C,MAAM,EAAE,eAAe,CAAC;IACxB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAEzC;;;OAGG;IACH,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,gBAAgB,CA6FnF"}
|
|
@@ -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;AAGf,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,6BAA6B,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,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0B,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":"AAAA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAEL,KAAK,MAAM,IAAI,WAAW,EAC3B,MAAM,yBAAyB,CAAC;AAEjC,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,sEAAsE;AACtE,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD,wEAAwE;AACxE,eAAO,MAAM,mCAAmC,KAAK,CAAC;AAEtD,qEAAqE;AACrE,MAAM,MAAM,2BAA2B,GAAG,MAAM,MAAM,CAAC;AAEvD,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uDAAuD;AACvD,MAAM,WAAW,iCAAiC;IAChD,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yEAAyE;IACzE,GAAG,CAAC,EAAE,2BAA2B,CAAC;CACnC;AAED,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC1B,oDAAoD;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