copilotkit 2.0.3 → 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 +653 -190
- 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/cli-tips.d.ts +45 -0
- package/src/services/cli-tips.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/index.js
CHANGED
|
@@ -63,9 +63,9 @@ function setOpsFrontendUrl(url2) {
|
|
|
63
63
|
}
|
|
64
64
|
function getBuildInfo() {
|
|
65
65
|
return {
|
|
66
|
-
version: "2.0.
|
|
67
|
-
buildNumber: "
|
|
68
|
-
commitSha: "
|
|
66
|
+
version: "2.0.4",
|
|
67
|
+
buildNumber: "25565986307",
|
|
68
|
+
commitSha: "b30c431cac977de7dc0637d19bbe914b6bb1248d"
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
var opsApiUrlOverride, opsFrontendUrlOverride;
|
|
@@ -50395,7 +50395,7 @@ var require_backend = __commonJS({
|
|
|
50395
50395
|
});
|
|
50396
50396
|
return value;
|
|
50397
50397
|
},
|
|
50398
|
-
useEffect: function
|
|
50398
|
+
useEffect: function useEffect14(create3) {
|
|
50399
50399
|
nextHook();
|
|
50400
50400
|
hookLog.push({
|
|
50401
50401
|
displayName: null,
|
|
@@ -50441,7 +50441,7 @@ var require_backend = __commonJS({
|
|
|
50441
50441
|
dispatcherHookName: "InsertionEffect"
|
|
50442
50442
|
});
|
|
50443
50443
|
},
|
|
50444
|
-
useMemo: function
|
|
50444
|
+
useMemo: function useMemo8(nextCreate) {
|
|
50445
50445
|
var hook = nextHook();
|
|
50446
50446
|
nextCreate = null !== hook ? hook.memoizedState[0] : nextCreate();
|
|
50447
50447
|
hookLog.push({
|
|
@@ -50483,7 +50483,7 @@ var require_backend = __commonJS({
|
|
|
50483
50483
|
});
|
|
50484
50484
|
return initialValue;
|
|
50485
50485
|
},
|
|
50486
|
-
useState: function
|
|
50486
|
+
useState: function useState12(initialState) {
|
|
50487
50487
|
var hook = nextHook();
|
|
50488
50488
|
initialState = null !== hook ? hook.memoizedState : "function" === typeof initialState ? initialState() : initialState;
|
|
50489
50489
|
hookLog.push({
|
|
@@ -60118,7 +60118,7 @@ var require_backend = __commonJS({
|
|
|
60118
60118
|
var symbolOrNumber = renderer_typeof(type) === "object" && type !== null ? type.$$typeof : type;
|
|
60119
60119
|
return renderer_typeof(symbolOrNumber) === "symbol" ? symbolOrNumber.toString() : symbolOrNumber;
|
|
60120
60120
|
}
|
|
60121
|
-
var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, IncompleteFunctionComponent = _ReactTypeOfWork.IncompleteFunctionComponent, FunctionComponent = _ReactTypeOfWork.FunctionComponent, IndeterminateComponent = _ReactTypeOfWork.IndeterminateComponent, ForwardRef = _ReactTypeOfWork.ForwardRef, HostRoot = _ReactTypeOfWork.HostRoot, HostHoistable = _ReactTypeOfWork.HostHoistable, HostSingleton = _ReactTypeOfWork.HostSingleton, HostComponent = _ReactTypeOfWork.HostComponent, HostPortal = _ReactTypeOfWork.HostPortal, HostText = _ReactTypeOfWork.HostText,
|
|
60121
|
+
var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, IncompleteFunctionComponent = _ReactTypeOfWork.IncompleteFunctionComponent, FunctionComponent = _ReactTypeOfWork.FunctionComponent, IndeterminateComponent = _ReactTypeOfWork.IndeterminateComponent, ForwardRef = _ReactTypeOfWork.ForwardRef, HostRoot = _ReactTypeOfWork.HostRoot, HostHoistable = _ReactTypeOfWork.HostHoistable, HostSingleton = _ReactTypeOfWork.HostSingleton, HostComponent = _ReactTypeOfWork.HostComponent, HostPortal = _ReactTypeOfWork.HostPortal, HostText = _ReactTypeOfWork.HostText, Fragment2 = _ReactTypeOfWork.Fragment, LazyComponent = _ReactTypeOfWork.LazyComponent, LegacyHiddenComponent = _ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = _ReactTypeOfWork.MemoComponent, OffscreenComponent = _ReactTypeOfWork.OffscreenComponent, Profiler = _ReactTypeOfWork.Profiler, ScopeComponent = _ReactTypeOfWork.ScopeComponent, SimpleMemoComponent = _ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = _ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = _ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = _ReactTypeOfWork.TracingMarkerComponent, Throw = _ReactTypeOfWork.Throw, ViewTransitionComponent = _ReactTypeOfWork.ViewTransitionComponent, ActivityComponent = _ReactTypeOfWork.ActivityComponent;
|
|
60122
60122
|
function resolveFiberType(type) {
|
|
60123
60123
|
var typeSymbol = getTypeSymbol(type);
|
|
60124
60124
|
switch (typeSymbol) {
|
|
@@ -60174,7 +60174,7 @@ var require_backend = __commonJS({
|
|
|
60174
60174
|
case HostPortal:
|
|
60175
60175
|
case HostText:
|
|
60176
60176
|
return null;
|
|
60177
|
-
case
|
|
60177
|
+
case Fragment2:
|
|
60178
60178
|
return "Fragment";
|
|
60179
60179
|
case LazyComponent:
|
|
60180
60180
|
return "Lazy";
|
|
@@ -60329,7 +60329,7 @@ var require_backend = __commonJS({
|
|
|
60329
60329
|
function renderer_attach(hook, rendererID, renderer2, global2, shouldStartProfilingNow, profilingSettings) {
|
|
60330
60330
|
var version2 = renderer2.reconcilerVersion || renderer2.version;
|
|
60331
60331
|
var _getInternalReactCons = getInternalReactConstants(version2), getDisplayNameForFiber = _getInternalReactCons.getDisplayNameForFiber, getTypeSymbol = _getInternalReactCons.getTypeSymbol, ReactPriorityLevels = _getInternalReactCons.ReactPriorityLevels, ReactTypeOfWork = _getInternalReactCons.ReactTypeOfWork, StrictModeBits = _getInternalReactCons.StrictModeBits, SuspenseyImagesMode = _getInternalReactCons.SuspenseyImagesMode;
|
|
60332
|
-
var ActivityComponent = ReactTypeOfWork.ActivityComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef,
|
|
60332
|
+
var ActivityComponent = ReactTypeOfWork.ActivityComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef, Fragment2 = ReactTypeOfWork.Fragment, FunctionComponent = ReactTypeOfWork.FunctionComponent, HostRoot = ReactTypeOfWork.HostRoot, HostHoistable = ReactTypeOfWork.HostHoistable, HostSingleton = ReactTypeOfWork.HostSingleton, HostPortal = ReactTypeOfWork.HostPortal, HostComponent = ReactTypeOfWork.HostComponent, HostText = ReactTypeOfWork.HostText, IncompleteClassComponent = ReactTypeOfWork.IncompleteClassComponent, IncompleteFunctionComponent = ReactTypeOfWork.IncompleteFunctionComponent, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, LegacyHiddenComponent = ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = ReactTypeOfWork.MemoComponent, OffscreenComponent = ReactTypeOfWork.OffscreenComponent, SimpleMemoComponent = ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = ReactTypeOfWork.TracingMarkerComponent, Throw = ReactTypeOfWork.Throw, ViewTransitionComponent = ReactTypeOfWork.ViewTransitionComponent;
|
|
60333
60333
|
var ImmediatePriority = ReactPriorityLevels.ImmediatePriority, UserBlockingPriority = ReactPriorityLevels.UserBlockingPriority, NormalPriority = ReactPriorityLevels.NormalPriority, LowPriority = ReactPriorityLevels.LowPriority, IdlePriority = ReactPriorityLevels.IdlePriority, NoPriority = ReactPriorityLevels.NoPriority;
|
|
60334
60334
|
var getLaneLabelMap = renderer2.getLaneLabelMap, injectProfilingHooks = renderer2.injectProfilingHooks, overrideHookState = renderer2.overrideHookState, overrideHookStateDeletePath = renderer2.overrideHookStateDeletePath, overrideHookStateRenamePath = renderer2.overrideHookStateRenamePath, overrideProps = renderer2.overrideProps, overridePropsDeletePath = renderer2.overridePropsDeletePath, overridePropsRenamePath = renderer2.overridePropsRenamePath, scheduleRefresh = renderer2.scheduleRefresh, setErrorHandler = renderer2.setErrorHandler, setSuspenseHandler = renderer2.setSuspenseHandler, scheduleUpdate = renderer2.scheduleUpdate, scheduleRetry = renderer2.scheduleRetry, getCurrentFiber = renderer2.getCurrentFiber;
|
|
60335
60335
|
var supportsTogglingError = typeof setErrorHandler === "function" && typeof scheduleUpdate === "function";
|
|
@@ -60690,7 +60690,7 @@ var require_backend = __commonJS({
|
|
|
60690
60690
|
return true;
|
|
60691
60691
|
case HostRoot:
|
|
60692
60692
|
return false;
|
|
60693
|
-
case
|
|
60693
|
+
case Fragment2:
|
|
60694
60694
|
return key === null;
|
|
60695
60695
|
default:
|
|
60696
60696
|
var typeSymbol = getTypeSymbol(type);
|
|
@@ -60764,7 +60764,7 @@ var require_backend = __commonJS({
|
|
|
60764
60764
|
return ElementTypeHostComponent;
|
|
60765
60765
|
case HostPortal:
|
|
60766
60766
|
case HostText:
|
|
60767
|
-
case
|
|
60767
|
+
case Fragment2:
|
|
60768
60768
|
return ElementTypeOtherOrUnknown;
|
|
60769
60769
|
case MemoComponent:
|
|
60770
60770
|
case SimpleMemoComponent:
|
|
@@ -72062,6 +72062,285 @@ var init_build3 = __esm({
|
|
|
72062
72062
|
}
|
|
72063
72063
|
});
|
|
72064
72064
|
|
|
72065
|
+
// apps/cli/src/services/cli-tips.ts
|
|
72066
|
+
function rankCliTips(tips = CLI_TIPS) {
|
|
72067
|
+
return [...tips].sort((firstTip, secondTip) => {
|
|
72068
|
+
const relevancyDifference = secondTip.relevancy - firstTip.relevancy;
|
|
72069
|
+
if (relevancyDifference !== 0) {
|
|
72070
|
+
return relevancyDifference;
|
|
72071
|
+
}
|
|
72072
|
+
const insightDifference = secondTip.insight - firstTip.insight;
|
|
72073
|
+
if (insightDifference !== 0) {
|
|
72074
|
+
return insightDifference;
|
|
72075
|
+
}
|
|
72076
|
+
return firstTip.id.localeCompare(secondTip.id);
|
|
72077
|
+
});
|
|
72078
|
+
}
|
|
72079
|
+
function selectCliTips(options = {}) {
|
|
72080
|
+
const {
|
|
72081
|
+
tips = CLI_TIPS,
|
|
72082
|
+
limit = tips.length,
|
|
72083
|
+
minimumRelevancy = Number.NEGATIVE_INFINITY,
|
|
72084
|
+
minimumInsight = Number.NEGATIVE_INFINITY
|
|
72085
|
+
} = options;
|
|
72086
|
+
const normalizedLimit = Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : tips.length;
|
|
72087
|
+
return rankCliTips(tips).filter((tip) => tip.relevancy >= minimumRelevancy && tip.insight >= minimumInsight).slice(0, normalizedLimit);
|
|
72088
|
+
}
|
|
72089
|
+
var CLI_TIPS;
|
|
72090
|
+
var init_cli_tips = __esm({
|
|
72091
|
+
"apps/cli/src/services/cli-tips.ts"() {
|
|
72092
|
+
"use strict";
|
|
72093
|
+
CLI_TIPS = Object.freeze([
|
|
72094
|
+
{
|
|
72095
|
+
id: "examples-as-full-stack-starters",
|
|
72096
|
+
text: "Treat CopilotKit examples as full-stack starters, not isolated snippets, because frontend, runtime, and agent code usually depend on each other.",
|
|
72097
|
+
relevancy: 85,
|
|
72098
|
+
insight: 68
|
|
72099
|
+
},
|
|
72100
|
+
{
|
|
72101
|
+
id: "runtime-info-before-react-state",
|
|
72102
|
+
text: "If your frontend cannot find an agent, check the runtime `/info` endpoint and try `127.0.0.1` before debugging React state.",
|
|
72103
|
+
relevancy: 92,
|
|
72104
|
+
insight: 94
|
|
72105
|
+
},
|
|
72106
|
+
{
|
|
72107
|
+
id: "runtime-for-production-boundaries",
|
|
72108
|
+
text: "Use Copilot Runtime for production auth, middleware, routing, threads, and observability; direct AG-UI connections are best kept for prototyping.",
|
|
72109
|
+
relevancy: 96,
|
|
72110
|
+
insight: 93
|
|
72111
|
+
},
|
|
72112
|
+
{
|
|
72113
|
+
id: "default-agent-before-agent-ids",
|
|
72114
|
+
text: "Register a `default` agent for simple apps, then pass matching `agentId` values once your app has multiple agents.",
|
|
72115
|
+
relevancy: 94,
|
|
72116
|
+
insight: 88
|
|
72117
|
+
},
|
|
72118
|
+
{
|
|
72119
|
+
id: "debug-ag-ui-event-stream",
|
|
72120
|
+
text: "AG-UI streams lifecycle, message, tool, state, and activity events over SSE, so debug the event stream instead of scraping chat text.",
|
|
72121
|
+
relevancy: 82,
|
|
72122
|
+
insight: 90
|
|
72123
|
+
},
|
|
72124
|
+
{
|
|
72125
|
+
id: "built-in-agent-before-factory-mode",
|
|
72126
|
+
text: "Use `BuiltInAgent` for fast in-process chat and tools, and switch to factory mode only when you need full control of the model stream.",
|
|
72127
|
+
relevancy: 78,
|
|
72128
|
+
insight: 82
|
|
72129
|
+
},
|
|
72130
|
+
{
|
|
72131
|
+
id: "mcp-servers-vs-clients",
|
|
72132
|
+
text: "Use `mcpServers` for runtime-managed MCP connections and `mcpClients` when you need custom auth, caching, or lifecycle control.",
|
|
72133
|
+
relevancy: 72,
|
|
72134
|
+
insight: 89
|
|
72135
|
+
},
|
|
72136
|
+
{
|
|
72137
|
+
id: "mcp-apps-stable-server-ids",
|
|
72138
|
+
text: "For MCP Apps, configure runtime `mcpApps.servers` and pin stable `serverId` values so restored conversations keep their UI.",
|
|
72139
|
+
relevancy: 65,
|
|
72140
|
+
insight: 92
|
|
72141
|
+
},
|
|
72142
|
+
{
|
|
72143
|
+
id: "use-threads-for-resume",
|
|
72144
|
+
text: "Use `useThreads` for persistent conversation lists and pass `threadId` to `CopilotChat` when resuming a specific thread.",
|
|
72145
|
+
relevancy: 80,
|
|
72146
|
+
insight: 88
|
|
72147
|
+
},
|
|
72148
|
+
{
|
|
72149
|
+
id: "archive-vs-delete-threads",
|
|
72150
|
+
text: "Remember that archived threads are recoverable but deleted threads are not, so add your own confirmation UX for destructive thread actions.",
|
|
72151
|
+
relevancy: 76,
|
|
72152
|
+
insight: 84
|
|
72153
|
+
},
|
|
72154
|
+
{
|
|
72155
|
+
id: "dev-console-and-production-errors",
|
|
72156
|
+
text: "Use `showDevConsole` only during local development and wire `onError` for production error handling.",
|
|
72157
|
+
relevancy: 91,
|
|
72158
|
+
insight: 91
|
|
72159
|
+
},
|
|
72160
|
+
{
|
|
72161
|
+
id: "server-debug-for-missing-events",
|
|
72162
|
+
text: "Enable server `debug: true` when events, state, or tool calls disappear, then use the Inspector or `/cpk-debug-events` for live AG-UI details.",
|
|
72163
|
+
relevancy: 82,
|
|
72164
|
+
insight: 90
|
|
72165
|
+
},
|
|
72166
|
+
{
|
|
72167
|
+
id: "react-core-v2-imports",
|
|
72168
|
+
text: "Import the provider from `@copilotkit/react-core`, v2 APIs from `@copilotkit/react-core/v2`, and load v2 styles once.",
|
|
72169
|
+
relevancy: 95,
|
|
72170
|
+
insight: 86
|
|
72171
|
+
},
|
|
72172
|
+
{
|
|
72173
|
+
id: "built-in-chat-surfaces-first",
|
|
72174
|
+
text: "Reach for `CopilotChat`, `CopilotSidebar`, or `CopilotPopup` before building a chat shell from scratch.",
|
|
72175
|
+
relevancy: 93,
|
|
72176
|
+
insight: 72
|
|
72177
|
+
},
|
|
72178
|
+
{
|
|
72179
|
+
id: "customize-before-replacing-chat",
|
|
72180
|
+
text: "Customize copy with labels, structure with slots, and visuals with scoped CSS before replacing built-in chat components wholesale.",
|
|
72181
|
+
relevancy: 88,
|
|
72182
|
+
insight: 86
|
|
72183
|
+
},
|
|
72184
|
+
{
|
|
72185
|
+
id: "slots-before-headless",
|
|
72186
|
+
text: "Use slots before going headless because v2 slots support class strings, prop overrides, and full component replacement.",
|
|
72187
|
+
relevancy: 90,
|
|
72188
|
+
insight: 84
|
|
72189
|
+
},
|
|
72190
|
+
{
|
|
72191
|
+
id: "use-agent-for-custom-chat",
|
|
72192
|
+
text: "For custom chat UIs, use `useAgent` for messages, state, and running status, then call `copilotkit.runAgent({ agent })`.",
|
|
72193
|
+
relevancy: 86,
|
|
72194
|
+
insight: 94
|
|
72195
|
+
},
|
|
72196
|
+
{
|
|
72197
|
+
id: "throttle-custom-message-lists",
|
|
72198
|
+
text: "Add `throttleMs` to `useAgent` when token-by-token streaming causes hot re-renders in custom message lists.",
|
|
72199
|
+
relevancy: 78,
|
|
72200
|
+
insight: 84
|
|
72201
|
+
},
|
|
72202
|
+
{
|
|
72203
|
+
id: "proxied-agent-for-isolated-state",
|
|
72204
|
+
text: "Use `registerProxiedAgent` when multiple chat windows share one runtime agent but need isolated frontend state.",
|
|
72205
|
+
relevancy: 55,
|
|
72206
|
+
insight: 88
|
|
72207
|
+
},
|
|
72208
|
+
{
|
|
72209
|
+
id: "chat-configuration-provider-context",
|
|
72210
|
+
text: "Use `CopilotChatConfigurationProvider` when custom chat pieces need shared labels, `agentId`, `threadId`, or modal state.",
|
|
72211
|
+
relevancy: 60,
|
|
72212
|
+
insight: 78
|
|
72213
|
+
},
|
|
72214
|
+
{
|
|
72215
|
+
id: "agent-context-for-serializable-state",
|
|
72216
|
+
text: "Use `useAgentContext` in v2 to expose serializable app state such as selected rows, filters, or preferences to the agent.",
|
|
72217
|
+
relevancy: 88,
|
|
72218
|
+
insight: 84
|
|
72219
|
+
},
|
|
72220
|
+
{
|
|
72221
|
+
id: "frontend-tools-with-dependencies",
|
|
72222
|
+
text: "Register browser-side actions with `useFrontendTool`, include dependencies for captured state, and use `runTool` for button-triggered tools.",
|
|
72223
|
+
relevancy: 86,
|
|
72224
|
+
insight: 93
|
|
72225
|
+
},
|
|
72226
|
+
{
|
|
72227
|
+
id: "capability-gated-controls",
|
|
72228
|
+
text: "Use `useCapabilities` to hide controls for features the current agent did not declare.",
|
|
72229
|
+
relevancy: 62,
|
|
72230
|
+
insight: 79
|
|
72231
|
+
},
|
|
72232
|
+
{
|
|
72233
|
+
id: "component-rendering-from-typed-params",
|
|
72234
|
+
text: "Use `useComponent` when the agent should render one of your React components from typed parameters.",
|
|
72235
|
+
relevancy: 73,
|
|
72236
|
+
insight: 80
|
|
72237
|
+
},
|
|
72238
|
+
{
|
|
72239
|
+
id: "render-tool-names-match-backend",
|
|
72240
|
+
text: "Use `useRenderTool` for backend tool-call UI, and keep renderer names identical to backend tool names.",
|
|
72241
|
+
relevancy: 84,
|
|
72242
|
+
insight: 87
|
|
72243
|
+
},
|
|
72244
|
+
{
|
|
72245
|
+
id: "wildcard-tool-renderers",
|
|
72246
|
+
text: "Add wildcard or default tool renderers during development to reveal unexpected tool calls and unhandled MCP tools.",
|
|
72247
|
+
relevancy: 76,
|
|
72248
|
+
insight: 88
|
|
72249
|
+
},
|
|
72250
|
+
{
|
|
72251
|
+
id: "tool-progress-from-status",
|
|
72252
|
+
text: "Render tool progress from `ToolCallStatus` instead of guessing from partial arguments.",
|
|
72253
|
+
relevancy: 72,
|
|
72254
|
+
insight: 84
|
|
72255
|
+
},
|
|
72256
|
+
{
|
|
72257
|
+
id: "human-in-loop-and-interrupts",
|
|
72258
|
+
text: "Use `useHumanInTheLoop` for model-initiated approvals and `useInterrupt` for graph-enforced checkpoints on supported runtimes.",
|
|
72259
|
+
relevancy: 76,
|
|
72260
|
+
insight: 91
|
|
72261
|
+
},
|
|
72262
|
+
{
|
|
72263
|
+
id: "agent-scoped-suggestions",
|
|
72264
|
+
text: "Use `useConfigureSuggestions` and `useSuggestions` for agent-scoped prompt pills instead of hard-coded static chips.",
|
|
72265
|
+
relevancy: 72,
|
|
72266
|
+
insight: 82
|
|
72267
|
+
},
|
|
72268
|
+
{
|
|
72269
|
+
id: "suggestions-by-provider-and-consumer",
|
|
72270
|
+
text: "Scope suggestions by provider and consumer agent when multiple agents share a page.",
|
|
72271
|
+
relevancy: 64,
|
|
72272
|
+
insight: 84
|
|
72273
|
+
},
|
|
72274
|
+
{
|
|
72275
|
+
id: "welcome-screen-render-prop",
|
|
72276
|
+
text: "Use the `welcomeScreen` render prop to customize the empty state while preserving default input and suggestions.",
|
|
72277
|
+
relevancy: 68,
|
|
72278
|
+
insight: 73
|
|
72279
|
+
},
|
|
72280
|
+
{
|
|
72281
|
+
id: "open-generative-ui-sandbox",
|
|
72282
|
+
text: "Use Open Generative UI for sandboxed ad hoc UI, and expose only deliberate host callbacks through `sandboxFunctions`.",
|
|
72283
|
+
relevancy: 55,
|
|
72284
|
+
insight: 89
|
|
72285
|
+
},
|
|
72286
|
+
{
|
|
72287
|
+
id: "a2ui-for-catalog-backed-ui",
|
|
72288
|
+
text: "Use A2UI when you want declarative, catalog-backed generative UI with runtime middleware and frontend theming.",
|
|
72289
|
+
relevancy: 55,
|
|
72290
|
+
insight: 84
|
|
72291
|
+
},
|
|
72292
|
+
{
|
|
72293
|
+
id: "mcp-apps-inline-ui",
|
|
72294
|
+
text: "Use MCP Apps when remote MCP-provided UI resources should render inline inside normal CopilotKit chat.",
|
|
72295
|
+
relevancy: 62,
|
|
72296
|
+
insight: 88
|
|
72297
|
+
},
|
|
72298
|
+
{
|
|
72299
|
+
id: "langgraph-for-ag-ui-bridges",
|
|
72300
|
+
text: "Use LangGraph integration when you need subgraph streaming, state/context injection, frontend tool interception, or graph interrupts bridged into AG-UI.",
|
|
72301
|
+
relevancy: 86,
|
|
72302
|
+
insight: 92
|
|
72303
|
+
},
|
|
72304
|
+
{
|
|
72305
|
+
id: "backend-aligned-starters",
|
|
72306
|
+
text: "Pick the starter closest to your backend, whether LangGraph, CrewAI, Mastra, LlamaIndex, PydanticAI, ADK, Strands, Microsoft Agent Framework, or A2A.",
|
|
72307
|
+
relevancy: 83,
|
|
72308
|
+
insight: 68
|
|
72309
|
+
},
|
|
72310
|
+
{
|
|
72311
|
+
id: "ag-ui-at-a2a-boundary",
|
|
72312
|
+
text: "For A2A systems, keep AG-UI at the app boundary and let A2A middleware coordinate agents behind it.",
|
|
72313
|
+
relevancy: 70,
|
|
72314
|
+
insight: 88
|
|
72315
|
+
},
|
|
72316
|
+
{
|
|
72317
|
+
id: "canvas-shared-state-source",
|
|
72318
|
+
text: "In canvas-style apps, make shared state the source of truth and expose narrow frontend actions for each operation the agent can perform.",
|
|
72319
|
+
relevancy: 82,
|
|
72320
|
+
insight: 90
|
|
72321
|
+
},
|
|
72322
|
+
{
|
|
72323
|
+
id: "canvas-card-type-coordination",
|
|
72324
|
+
text: "When adding a new canvas card type, update the frontend schema, renderer, agent schema, and matching actions together.",
|
|
72325
|
+
relevancy: 78,
|
|
72326
|
+
insight: 89
|
|
72327
|
+
},
|
|
72328
|
+
{
|
|
72329
|
+
id: "production-observability-hooks",
|
|
72330
|
+
text: "Use production observability hooks when you need structured chat, error, and runtime signals in Sentry, Datadog, New Relic, OpenTelemetry, or analytics tools.",
|
|
72331
|
+
relevancy: 84,
|
|
72332
|
+
insight: 87
|
|
72333
|
+
},
|
|
72334
|
+
{
|
|
72335
|
+
id: "enterprise-intelligence-platform",
|
|
72336
|
+
text: "Use the Enterprise Intelligence Platform when you need persistent threads, observability, and production operations beyond local debugging.",
|
|
72337
|
+
relevancy: 82,
|
|
72338
|
+
insight: 79
|
|
72339
|
+
}
|
|
72340
|
+
]);
|
|
72341
|
+
}
|
|
72342
|
+
});
|
|
72343
|
+
|
|
72065
72344
|
// node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-runtime.production.js
|
|
72066
72345
|
var require_react_jsx_runtime_production = __commonJS({
|
|
72067
72346
|
"node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-runtime.production.js"(exports) {
|
|
@@ -72368,28 +72647,191 @@ var require_jsx_runtime = __commonJS({
|
|
|
72368
72647
|
}
|
|
72369
72648
|
});
|
|
72370
72649
|
|
|
72650
|
+
// apps/cli/src/ui/cli-tip.tsx
|
|
72651
|
+
function normalizeCliTipSelectionIndex(selectionIndex = 0) {
|
|
72652
|
+
return Number.isFinite(selectionIndex) ? Math.max(0, Math.floor(selectionIndex)) : 0;
|
|
72653
|
+
}
|
|
72654
|
+
function normalizeCliTipLimit(limit, fallback) {
|
|
72655
|
+
return Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : fallback;
|
|
72656
|
+
}
|
|
72657
|
+
function normalizeCliTipRandomValue(randomValue) {
|
|
72658
|
+
if (!Number.isFinite(randomValue)) {
|
|
72659
|
+
return 0;
|
|
72660
|
+
}
|
|
72661
|
+
return Math.min(Math.max(randomValue, 0), 1 - Number.EPSILON);
|
|
72662
|
+
}
|
|
72663
|
+
function shuffleCliTips(tips, rng = Math.random) {
|
|
72664
|
+
const shuffledTips = [...tips];
|
|
72665
|
+
for (let index = shuffledTips.length - 1; index > 0; index -= 1) {
|
|
72666
|
+
const swapIndex = Math.floor(normalizeCliTipRandomValue(rng()) * (index + 1));
|
|
72667
|
+
const currentTip = shuffledTips[index];
|
|
72668
|
+
const swapTip = shuffledTips[swapIndex];
|
|
72669
|
+
if (currentTip !== void 0 && swapTip !== void 0) {
|
|
72670
|
+
shuffledTips[index] = swapTip;
|
|
72671
|
+
shuffledTips[swapIndex] = currentTip;
|
|
72672
|
+
}
|
|
72673
|
+
}
|
|
72674
|
+
return shuffledTips;
|
|
72675
|
+
}
|
|
72676
|
+
function selectCliTipRotationSubset(tips, options = {}) {
|
|
72677
|
+
const {
|
|
72678
|
+
rotationLimit = CLI_TIP_DEFAULT_ROTATION_LIMIT,
|
|
72679
|
+
rotationPoolLimit = CLI_TIP_DEFAULT_ROTATION_POOL_LIMIT,
|
|
72680
|
+
randomize = false,
|
|
72681
|
+
rng = Math.random
|
|
72682
|
+
} = typeof options === "number" ? { rotationLimit: options } : options;
|
|
72683
|
+
const normalizedLimit = normalizeCliTipLimit(
|
|
72684
|
+
rotationLimit,
|
|
72685
|
+
CLI_TIP_DEFAULT_ROTATION_LIMIT
|
|
72686
|
+
);
|
|
72687
|
+
const normalizedPoolLimit = normalizeCliTipLimit(
|
|
72688
|
+
rotationPoolLimit,
|
|
72689
|
+
CLI_TIP_DEFAULT_ROTATION_POOL_LIMIT
|
|
72690
|
+
);
|
|
72691
|
+
const rankedPool = selectCliTips({
|
|
72692
|
+
tips,
|
|
72693
|
+
limit: Math.max(normalizedLimit, normalizedPoolLimit)
|
|
72694
|
+
}).slice(0, normalizedPoolLimit);
|
|
72695
|
+
if (!randomize) {
|
|
72696
|
+
return rankedPool.slice(0, normalizedLimit);
|
|
72697
|
+
}
|
|
72698
|
+
return shuffleCliTips(rankedPool, rng).slice(0, normalizedLimit);
|
|
72699
|
+
}
|
|
72700
|
+
function parseCliTipText(text) {
|
|
72701
|
+
const segments = [];
|
|
72702
|
+
let cursor = 0;
|
|
72703
|
+
while (cursor < text.length) {
|
|
72704
|
+
const openingBacktick = text.indexOf("`", cursor);
|
|
72705
|
+
if (openingBacktick === -1) {
|
|
72706
|
+
segments.push({ kind: "text", text: text.slice(cursor) });
|
|
72707
|
+
break;
|
|
72708
|
+
}
|
|
72709
|
+
const closingBacktick = text.indexOf("`", openingBacktick + 1);
|
|
72710
|
+
if (closingBacktick === -1) {
|
|
72711
|
+
segments.push({ kind: "text", text: text.slice(cursor) });
|
|
72712
|
+
break;
|
|
72713
|
+
}
|
|
72714
|
+
if (openingBacktick > cursor) {
|
|
72715
|
+
segments.push({
|
|
72716
|
+
kind: "text",
|
|
72717
|
+
text: text.slice(cursor, openingBacktick)
|
|
72718
|
+
});
|
|
72719
|
+
}
|
|
72720
|
+
segments.push({
|
|
72721
|
+
kind: "code",
|
|
72722
|
+
text: text.slice(openingBacktick + 1, closingBacktick)
|
|
72723
|
+
});
|
|
72724
|
+
cursor = closingBacktick + 1;
|
|
72725
|
+
}
|
|
72726
|
+
return segments;
|
|
72727
|
+
}
|
|
72728
|
+
function CliTip({
|
|
72729
|
+
tips,
|
|
72730
|
+
selectionIndex = 0,
|
|
72731
|
+
delayMs = CLI_TIP_DEFAULT_DELAY_MS,
|
|
72732
|
+
rotationMs = CLI_TIP_DEFAULT_ROTATION_MS,
|
|
72733
|
+
rotationLimit = CLI_TIP_DEFAULT_ROTATION_LIMIT,
|
|
72734
|
+
rotationPoolLimit = CLI_TIP_DEFAULT_ROTATION_POOL_LIMIT,
|
|
72735
|
+
randomize = true,
|
|
72736
|
+
rng = Math.random
|
|
72737
|
+
}) {
|
|
72738
|
+
const [visible, setVisible] = (0, import_react30.useState)(delayMs <= 0);
|
|
72739
|
+
const selectedTips = (0, import_react30.useMemo)(
|
|
72740
|
+
() => selectCliTipRotationSubset(tips, {
|
|
72741
|
+
rotationLimit,
|
|
72742
|
+
rotationPoolLimit,
|
|
72743
|
+
randomize,
|
|
72744
|
+
rng
|
|
72745
|
+
}),
|
|
72746
|
+
[tips, rotationLimit, rotationPoolLimit, randomize, rng]
|
|
72747
|
+
);
|
|
72748
|
+
const initialSelectionIndex = (0, import_react30.useMemo)(
|
|
72749
|
+
() => selectedTips.length === 0 ? 0 : normalizeCliTipSelectionIndex(selectionIndex) % selectedTips.length,
|
|
72750
|
+
[selectedTips.length, selectionIndex]
|
|
72751
|
+
);
|
|
72752
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react30.useState)(initialSelectionIndex);
|
|
72753
|
+
const selectedTip = selectedTips[selectedIndex] ?? null;
|
|
72754
|
+
const textSegments = (0, import_react30.useMemo)(
|
|
72755
|
+
() => selectedTip === null ? [] : parseCliTipText(selectedTip.text),
|
|
72756
|
+
[selectedTip]
|
|
72757
|
+
);
|
|
72758
|
+
(0, import_react30.useEffect)(() => {
|
|
72759
|
+
if (delayMs <= 0) {
|
|
72760
|
+
setVisible(true);
|
|
72761
|
+
return;
|
|
72762
|
+
}
|
|
72763
|
+
setVisible(false);
|
|
72764
|
+
const timer = setTimeout(() => {
|
|
72765
|
+
setVisible(true);
|
|
72766
|
+
}, delayMs);
|
|
72767
|
+
return () => {
|
|
72768
|
+
clearTimeout(timer);
|
|
72769
|
+
};
|
|
72770
|
+
}, [delayMs]);
|
|
72771
|
+
(0, import_react30.useEffect)(() => {
|
|
72772
|
+
setSelectedIndex(initialSelectionIndex);
|
|
72773
|
+
}, [initialSelectionIndex, selectedTips]);
|
|
72774
|
+
(0, import_react30.useEffect)(() => {
|
|
72775
|
+
if (!visible || selectedTips.length <= 1 || rotationMs <= 0) {
|
|
72776
|
+
return;
|
|
72777
|
+
}
|
|
72778
|
+
const timer = setInterval(() => {
|
|
72779
|
+
setSelectedIndex(
|
|
72780
|
+
(currentIndex) => (currentIndex + 1) % selectedTips.length
|
|
72781
|
+
);
|
|
72782
|
+
}, rotationMs);
|
|
72783
|
+
return () => {
|
|
72784
|
+
clearInterval(timer);
|
|
72785
|
+
};
|
|
72786
|
+
}, [rotationMs, selectedTips.length, visible]);
|
|
72787
|
+
if (!visible || selectedTip === null) {
|
|
72788
|
+
return null;
|
|
72789
|
+
}
|
|
72790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "gray", children: [
|
|
72791
|
+
"Tip:",
|
|
72792
|
+
" ",
|
|
72793
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "cyan", children: textSegments.map(
|
|
72794
|
+
(segment, index) => segment.kind === "code" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "white", children: segment.text }, `${segment.kind}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "cyan", children: segment.text }, `${segment.kind}-${index}`)
|
|
72795
|
+
) })
|
|
72796
|
+
] }) });
|
|
72797
|
+
}
|
|
72798
|
+
var import_react30, import_jsx_runtime, CLI_TIP_DEFAULT_DELAY_MS, CLI_TIP_DEFAULT_ROTATION_MS, CLI_TIP_DEFAULT_ROTATION_LIMIT, CLI_TIP_DEFAULT_ROTATION_POOL_LIMIT;
|
|
72799
|
+
var init_cli_tip = __esm({
|
|
72800
|
+
async "apps/cli/src/ui/cli-tip.tsx"() {
|
|
72801
|
+
"use strict";
|
|
72802
|
+
import_react30 = __toESM(require_react(), 1);
|
|
72803
|
+
await init_build2();
|
|
72804
|
+
init_cli_tips();
|
|
72805
|
+
import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
72806
|
+
CLI_TIP_DEFAULT_DELAY_MS = 2500;
|
|
72807
|
+
CLI_TIP_DEFAULT_ROTATION_MS = 12e3;
|
|
72808
|
+
CLI_TIP_DEFAULT_ROTATION_LIMIT = 5;
|
|
72809
|
+
CLI_TIP_DEFAULT_ROTATION_POOL_LIMIT = 20;
|
|
72810
|
+
}
|
|
72811
|
+
});
|
|
72812
|
+
|
|
72371
72813
|
// apps/cli/src/ui/spinner.tsx
|
|
72372
72814
|
function Spinner({ label }) {
|
|
72373
|
-
const [frame, setFrame] = (0,
|
|
72374
|
-
(0,
|
|
72815
|
+
const [frame, setFrame] = (0, import_react31.useState)(0);
|
|
72816
|
+
(0, import_react31.useEffect)(() => {
|
|
72375
72817
|
const id = setInterval(() => {
|
|
72376
72818
|
setFrame((prev) => (prev + 1) % KITE_FRAMES.length);
|
|
72377
72819
|
}, FRAME_INTERVAL_MS);
|
|
72378
72820
|
return () => clearInterval(id);
|
|
72379
72821
|
}, []);
|
|
72380
|
-
return /* @__PURE__ */ (0,
|
|
72381
|
-
/* @__PURE__ */ (0,
|
|
72822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
72823
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "magenta", children: KITE_FRAMES[frame] }),
|
|
72382
72824
|
" ",
|
|
72383
72825
|
label
|
|
72384
72826
|
] });
|
|
72385
72827
|
}
|
|
72386
|
-
var
|
|
72828
|
+
var import_react31, import_jsx_runtime2, KITE_FRAMES, FRAME_INTERVAL_MS;
|
|
72387
72829
|
var init_spinner = __esm({
|
|
72388
72830
|
async "apps/cli/src/ui/spinner.tsx"() {
|
|
72389
72831
|
"use strict";
|
|
72390
|
-
|
|
72832
|
+
import_react31 = __toESM(require_react(), 1);
|
|
72391
72833
|
await init_build2();
|
|
72392
|
-
|
|
72834
|
+
import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
72393
72835
|
KITE_FRAMES = [
|
|
72394
72836
|
"\u{1FA81} ",
|
|
72395
72837
|
"~\u{1FA81} ",
|
|
@@ -72412,11 +72854,11 @@ function BrowserLoginProvider({
|
|
|
72412
72854
|
loginRunner = login,
|
|
72413
72855
|
isInteractive
|
|
72414
72856
|
}) {
|
|
72415
|
-
const [state, setState] = (0,
|
|
72416
|
-
const pendingConfirmationRef = (0,
|
|
72417
|
-
const pendingManualTokenRef = (0,
|
|
72857
|
+
const [state, setState] = (0, import_react32.useState)(idleState);
|
|
72858
|
+
const pendingConfirmationRef = (0, import_react32.useRef)(null);
|
|
72859
|
+
const pendingManualTokenRef = (0, import_react32.useRef)(null);
|
|
72418
72860
|
const shouldConfirm = isInteractive ?? isBrowserLoginConfirmationInteractive();
|
|
72419
|
-
const confirmBrowserLoginStart = (0,
|
|
72861
|
+
const confirmBrowserLoginStart = (0, import_react32.useCallback)(() => {
|
|
72420
72862
|
const pendingConfirmation = pendingConfirmationRef.current;
|
|
72421
72863
|
if (pendingConfirmation === null) {
|
|
72422
72864
|
return void 0;
|
|
@@ -72425,7 +72867,7 @@ function BrowserLoginProvider({
|
|
|
72425
72867
|
pendingConfirmation.resolve(void 0);
|
|
72426
72868
|
return void 0;
|
|
72427
72869
|
}, []);
|
|
72428
|
-
const submitManualClerkToken = (0,
|
|
72870
|
+
const submitManualClerkToken = (0, import_react32.useCallback)((clerkToken) => {
|
|
72429
72871
|
const pendingManualToken = pendingManualTokenRef.current;
|
|
72430
72872
|
if (pendingManualToken === null) {
|
|
72431
72873
|
return void 0;
|
|
@@ -72438,7 +72880,7 @@ function BrowserLoginProvider({
|
|
|
72438
72880
|
pendingManualToken.resolve(trimmed);
|
|
72439
72881
|
return void 0;
|
|
72440
72882
|
}, []);
|
|
72441
|
-
const runLogin2 = (0,
|
|
72883
|
+
const runLogin2 = (0, import_react32.useCallback)(async (passthroughOptions) => {
|
|
72442
72884
|
if (pendingConfirmationRef.current !== null) {
|
|
72443
72885
|
throw new Error("Browser login is already waiting for confirmation.");
|
|
72444
72886
|
}
|
|
@@ -72508,7 +72950,7 @@ function BrowserLoginProvider({
|
|
|
72508
72950
|
throw concreteError;
|
|
72509
72951
|
}
|
|
72510
72952
|
}, [loginRunner, shouldConfirm]);
|
|
72511
|
-
(0,
|
|
72953
|
+
(0, import_react32.useEffect)(() => {
|
|
72512
72954
|
return () => {
|
|
72513
72955
|
const pendingConfirmation = pendingConfirmationRef.current;
|
|
72514
72956
|
if (pendingConfirmation !== null) {
|
|
@@ -72526,7 +72968,7 @@ function BrowserLoginProvider({
|
|
|
72526
72968
|
}
|
|
72527
72969
|
};
|
|
72528
72970
|
}, []);
|
|
72529
|
-
const value = (0,
|
|
72971
|
+
const value = (0, import_react32.useMemo)(
|
|
72530
72972
|
() => ({
|
|
72531
72973
|
runLogin: runLogin2,
|
|
72532
72974
|
state,
|
|
@@ -72535,10 +72977,10 @@ function BrowserLoginProvider({
|
|
|
72535
72977
|
}),
|
|
72536
72978
|
[confirmBrowserLoginStart, runLogin2, state, submitManualClerkToken]
|
|
72537
72979
|
);
|
|
72538
|
-
return /* @__PURE__ */ (0,
|
|
72980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BrowserLoginContext.Provider, { value, children });
|
|
72539
72981
|
}
|
|
72540
72982
|
function useBrowserLogin() {
|
|
72541
|
-
const context = (0,
|
|
72983
|
+
const context = (0, import_react32.useContext)(BrowserLoginContext);
|
|
72542
72984
|
if (context === null) {
|
|
72543
72985
|
throw new Error("useBrowserLogin must be used inside BrowserLoginProvider.");
|
|
72544
72986
|
}
|
|
@@ -72546,7 +72988,7 @@ function useBrowserLogin() {
|
|
|
72546
72988
|
}
|
|
72547
72989
|
function BrowserLoginConfirmation() {
|
|
72548
72990
|
const { state, confirmBrowserLoginStart, submitManualClerkToken } = useBrowserLogin();
|
|
72549
|
-
const [manualTokenInput, setManualTokenInput] = (0,
|
|
72991
|
+
const [manualTokenInput, setManualTokenInput] = (0, import_react32.useState)("");
|
|
72550
72992
|
use_input_default((_input, key) => {
|
|
72551
72993
|
if (state.phase === "confirming" && key.return) {
|
|
72552
72994
|
confirmBrowserLoginStart();
|
|
@@ -72556,22 +72998,22 @@ function BrowserLoginConfirmation() {
|
|
|
72556
72998
|
return null;
|
|
72557
72999
|
}
|
|
72558
73000
|
if (state.phase === "confirming") {
|
|
72559
|
-
return /* @__PURE__ */ (0,
|
|
72560
|
-
/* @__PURE__ */ (0,
|
|
72561
|
-
/* @__PURE__ */ (0,
|
|
73001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
73002
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { children: BROWSER_LOGIN_CONFIRMATION_MESSAGE }),
|
|
73003
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "gray", children: BROWSER_LOGIN_CONFIRMATION_PROMPT })
|
|
72562
73004
|
] });
|
|
72563
73005
|
}
|
|
72564
73006
|
if (state.phase === "waiting") {
|
|
72565
|
-
return /* @__PURE__ */ (0,
|
|
72566
|
-
/* @__PURE__ */ (0,
|
|
72567
|
-
/* @__PURE__ */ (0,
|
|
72568
|
-
/* @__PURE__ */ (0,
|
|
72569
|
-
/* @__PURE__ */ (0,
|
|
72570
|
-
/* @__PURE__ */ (0,
|
|
73007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
73008
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spinner, { label: "\u{1FA81} Waiting for browser sign-in\u2026" }),
|
|
73009
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", children: [
|
|
73010
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "gray", children: BROWSER_LOGIN_MANUAL_PASTE_LABEL }),
|
|
73011
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { children: [
|
|
73012
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
72571
73013
|
">",
|
|
72572
73014
|
" "
|
|
72573
73015
|
] }),
|
|
72574
|
-
/* @__PURE__ */ (0,
|
|
73016
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
72575
73017
|
build_default,
|
|
72576
73018
|
{
|
|
72577
73019
|
value: manualTokenInput,
|
|
@@ -72584,52 +73026,55 @@ function BrowserLoginConfirmation() {
|
|
|
72584
73026
|
}
|
|
72585
73027
|
)
|
|
72586
73028
|
] })
|
|
72587
|
-
] })
|
|
73029
|
+
] }),
|
|
73030
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CliTip, {})
|
|
72588
73031
|
] });
|
|
72589
73032
|
}
|
|
72590
73033
|
if (state.phase === "finalizing" && state.identity !== null) {
|
|
72591
|
-
return /* @__PURE__ */ (0,
|
|
72592
|
-
/* @__PURE__ */ (0,
|
|
72593
|
-
/* @__PURE__ */ (0,
|
|
73034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
73035
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "green", children: "Logged in successfully!" }),
|
|
73036
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
72594
73037
|
"Email: ",
|
|
72595
|
-
/* @__PURE__ */ (0,
|
|
73038
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, children: state.identity.email })
|
|
72596
73039
|
] }),
|
|
72597
|
-
/* @__PURE__ */ (0,
|
|
73040
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
72598
73041
|
"Organization: ",
|
|
72599
|
-
/* @__PURE__ */ (0,
|
|
73042
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, children: state.identity.organizationName })
|
|
72600
73043
|
] }),
|
|
72601
|
-
/* @__PURE__ */ (0,
|
|
73044
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spinner, { label: "Wrapping up..." }) }),
|
|
73045
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CliTip, {})
|
|
72602
73046
|
] });
|
|
72603
73047
|
}
|
|
72604
73048
|
if (state.phase === "success" && state.identity !== null) {
|
|
72605
|
-
return /* @__PURE__ */ (0,
|
|
72606
|
-
/* @__PURE__ */ (0,
|
|
72607
|
-
/* @__PURE__ */ (0,
|
|
73049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
73050
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "green", children: "Logged in successfully!" }),
|
|
73051
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
72608
73052
|
"Email: ",
|
|
72609
|
-
/* @__PURE__ */ (0,
|
|
73053
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, children: state.identity.email })
|
|
72610
73054
|
] }),
|
|
72611
|
-
/* @__PURE__ */ (0,
|
|
73055
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
|
|
72612
73056
|
"Organization: ",
|
|
72613
|
-
/* @__PURE__ */ (0,
|
|
73057
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: true, children: state.identity.organizationName })
|
|
72614
73058
|
] })
|
|
72615
73059
|
] });
|
|
72616
73060
|
}
|
|
72617
|
-
return /* @__PURE__ */ (0,
|
|
73061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: "red", children: [
|
|
72618
73062
|
"Login failed: ",
|
|
72619
73063
|
state.errorMessage
|
|
72620
73064
|
] }) });
|
|
72621
73065
|
}
|
|
72622
|
-
var
|
|
73066
|
+
var import_react32, import_jsx_runtime3, BROWSER_LOGIN_CONFIRMATION_MESSAGE, BROWSER_LOGIN_CONFIRMATION_PROMPT, MANUAL_PASTE_FINALIZING_MS, idleState, BrowserLoginContext, BROWSER_LOGIN_MANUAL_PASTE_LABEL;
|
|
72623
73067
|
var init_browser_login = __esm({
|
|
72624
73068
|
async "apps/cli/src/ui/browser-login.tsx"() {
|
|
72625
73069
|
"use strict";
|
|
72626
|
-
|
|
73070
|
+
import_react32 = __toESM(require_react(), 1);
|
|
72627
73071
|
await init_build2();
|
|
72628
73072
|
await init_build3();
|
|
72629
73073
|
init_auth_service();
|
|
72630
73074
|
init_cli_auth_diagnostics();
|
|
73075
|
+
await init_cli_tip();
|
|
72631
73076
|
await init_spinner();
|
|
72632
|
-
|
|
73077
|
+
import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
72633
73078
|
BROWSER_LOGIN_CONFIRMATION_MESSAGE = "Sign in to your \u{1FA81} CopilotKit account in your browser.";
|
|
72634
73079
|
BROWSER_LOGIN_CONFIRMATION_PROMPT = "Press Enter to continue...";
|
|
72635
73080
|
MANUAL_PASTE_FINALIZING_MS = 6e3;
|
|
@@ -72638,7 +73083,7 @@ var init_browser_login = __esm({
|
|
|
72638
73083
|
identity: null,
|
|
72639
73084
|
errorMessage: ""
|
|
72640
73085
|
};
|
|
72641
|
-
BrowserLoginContext = (0,
|
|
73086
|
+
BrowserLoginContext = (0, import_react32.createContext)(null);
|
|
72642
73087
|
BROWSER_LOGIN_MANUAL_PASTE_LABEL = "If your browser finished sign-in but the CLI didn't notice, paste the code shown in the browser:";
|
|
72643
73088
|
}
|
|
72644
73089
|
});
|
|
@@ -72646,8 +73091,12 @@ var init_browser_login = __esm({
|
|
|
72646
73091
|
// apps/cli/src/commands/license.tsx
|
|
72647
73092
|
var license_exports = {};
|
|
72648
73093
|
__export(license_exports, {
|
|
72649
|
-
runLicense: () => runLicense
|
|
73094
|
+
runLicense: () => runLicense,
|
|
73095
|
+
shouldRenderLicenseCreateBrowserLoginConfirmation: () => shouldRenderLicenseCreateBrowserLoginConfirmation
|
|
72650
73096
|
});
|
|
73097
|
+
function shouldRenderLicenseCreateBrowserLoginConfirmation(phase) {
|
|
73098
|
+
return phase === "confirming" || phase === "waiting" || phase === "finalizing";
|
|
73099
|
+
}
|
|
72651
73100
|
async function ensureCliToken(loginRunner = login, onTerminalSessionInvalidation) {
|
|
72652
73101
|
const storedToken = authStore.getToken();
|
|
72653
73102
|
let session;
|
|
@@ -72745,10 +73194,10 @@ function formatLicenseList(scope, licenses) {
|
|
|
72745
73194
|
function LicenseCreateApp({ onIssued }) {
|
|
72746
73195
|
const { exit } = use_app_default();
|
|
72747
73196
|
const browserLogin = useBrowserLogin();
|
|
72748
|
-
const [phase, setPhase] = (0,
|
|
72749
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
72750
|
-
const [authMessage, setAuthMessage] = (0,
|
|
72751
|
-
(0,
|
|
73197
|
+
const [phase, setPhase] = (0, import_react33.useState)("auth");
|
|
73198
|
+
const [errorMessage, setErrorMessage] = (0, import_react33.useState)("");
|
|
73199
|
+
const [authMessage, setAuthMessage] = (0, import_react33.useState)("");
|
|
73200
|
+
(0, import_react33.useEffect)(() => {
|
|
72752
73201
|
let cancelled = false;
|
|
72753
73202
|
async function run() {
|
|
72754
73203
|
setPhase("auth");
|
|
@@ -72796,32 +73245,32 @@ function LicenseCreateApp({ onIssued }) {
|
|
|
72796
73245
|
cancelled = true;
|
|
72797
73246
|
};
|
|
72798
73247
|
}, [browserLogin.runLogin, onIssued, exit]);
|
|
72799
|
-
if (browserLogin.state.phase
|
|
72800
|
-
return /* @__PURE__ */ (0,
|
|
73248
|
+
if (shouldRenderLicenseCreateBrowserLoginConfirmation(browserLogin.state.phase)) {
|
|
73249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BrowserLoginConfirmation, {});
|
|
72801
73250
|
}
|
|
72802
73251
|
if (phase === "auth") {
|
|
72803
|
-
return /* @__PURE__ */ (0,
|
|
72804
|
-
authMessage ? /* @__PURE__ */ (0,
|
|
72805
|
-
/* @__PURE__ */ (0,
|
|
73252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
73253
|
+
authMessage ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "yellow", children: authMessage }) : null,
|
|
73254
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { label: "Verifying authentication\u2026" })
|
|
72806
73255
|
] });
|
|
72807
73256
|
}
|
|
72808
73257
|
if (phase === "issue") {
|
|
72809
|
-
return /* @__PURE__ */ (0,
|
|
72810
|
-
authMessage ? /* @__PURE__ */ (0,
|
|
72811
|
-
/* @__PURE__ */ (0,
|
|
73258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
73259
|
+
authMessage ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "yellow", children: authMessage }) : null,
|
|
73260
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { label: "Issuing license key\u2026" })
|
|
72812
73261
|
] });
|
|
72813
73262
|
}
|
|
72814
73263
|
if (phase === "success") {
|
|
72815
|
-
return /* @__PURE__ */ (0,
|
|
72816
|
-
/* @__PURE__ */ (0,
|
|
72817
|
-
/* @__PURE__ */ (0,
|
|
73264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { flexDirection: "column", gap: 1, children: [
|
|
73265
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: "green", children: "License key issued." }),
|
|
73266
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { children: [
|
|
72818
73267
|
"Add the line printed below to your ",
|
|
72819
|
-
/* @__PURE__ */ (0,
|
|
73268
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: true, children: ".env" }),
|
|
72820
73269
|
" file:"
|
|
72821
73270
|
] })
|
|
72822
73271
|
] });
|
|
72823
73272
|
}
|
|
72824
|
-
return /* @__PURE__ */ (0,
|
|
73273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: "red", children: [
|
|
72825
73274
|
"License failed: ",
|
|
72826
73275
|
errorMessage
|
|
72827
73276
|
] }) });
|
|
@@ -72851,7 +73300,7 @@ async function runLicense(command) {
|
|
|
72851
73300
|
}
|
|
72852
73301
|
let issuedKey = null;
|
|
72853
73302
|
const { waitUntilExit } = render_default(
|
|
72854
|
-
/* @__PURE__ */ (0,
|
|
73303
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LicenseCreateApp, { onIssued: (k) => {
|
|
72855
73304
|
issuedKey = k;
|
|
72856
73305
|
} }) })
|
|
72857
73306
|
);
|
|
@@ -72861,11 +73310,11 @@ async function runLicense(command) {
|
|
|
72861
73310
|
`);
|
|
72862
73311
|
}
|
|
72863
73312
|
}
|
|
72864
|
-
var
|
|
73313
|
+
var import_react33, import_jsx_runtime4;
|
|
72865
73314
|
var init_license = __esm({
|
|
72866
73315
|
async "apps/cli/src/commands/license.tsx"() {
|
|
72867
73316
|
"use strict";
|
|
72868
|
-
|
|
73317
|
+
import_react33 = __toESM(require_react(), 1);
|
|
72869
73318
|
await init_build2();
|
|
72870
73319
|
await init_build2();
|
|
72871
73320
|
init_auth_service();
|
|
@@ -72874,7 +73323,7 @@ var init_license = __esm({
|
|
|
72874
73323
|
await init_browser_login();
|
|
72875
73324
|
await init_spinner();
|
|
72876
73325
|
init_config();
|
|
72877
|
-
|
|
73326
|
+
import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
72878
73327
|
}
|
|
72879
73328
|
});
|
|
72880
73329
|
|
|
@@ -73637,17 +74086,17 @@ var init_project_scaffold = __esm({
|
|
|
73637
74086
|
|
|
73638
74087
|
// apps/cli/src/ui/banner.tsx
|
|
73639
74088
|
function Banner() {
|
|
73640
|
-
return /* @__PURE__ */ (0,
|
|
73641
|
-
/* @__PURE__ */ (0,
|
|
73642
|
-
/* @__PURE__ */ (0,
|
|
74089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
|
|
74090
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "magenta", children: KITE }),
|
|
74091
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "magenta", children: "~ Welcome to CopilotKit! ~" })
|
|
73643
74092
|
] });
|
|
73644
74093
|
}
|
|
73645
|
-
var
|
|
74094
|
+
var import_jsx_runtime5, KITE;
|
|
73646
74095
|
var init_banner = __esm({
|
|
73647
74096
|
async "apps/cli/src/ui/banner.tsx"() {
|
|
73648
74097
|
"use strict";
|
|
73649
74098
|
await init_build2();
|
|
73650
|
-
|
|
74099
|
+
import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
73651
74100
|
KITE = `\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
73652
74101
|
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u2819\u28FF\u285B\u283B\u283F\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
73653
74102
|
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u280B\u2800\u2800\u2808\u28BF\u2844\u2800\u2800\u2800\u2808\u2809\u2819\u28FB\u28FF\u28FF\u28FF
|
|
@@ -73967,13 +74416,13 @@ var init_figures = __esm({
|
|
|
73967
74416
|
|
|
73968
74417
|
// node_modules/.pnpm/ink-select-input@6.2.0_ink@6.8.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-select-input/build/Indicator.js
|
|
73969
74418
|
function Indicator({ isSelected = false }) {
|
|
73970
|
-
return
|
|
74419
|
+
return import_react34.default.createElement(Box_default, { marginRight: 1 }, isSelected ? import_react34.default.createElement(Text, { color: "blue" }, figures_default.pointer) : import_react34.default.createElement(Text, null, " "));
|
|
73971
74420
|
}
|
|
73972
|
-
var
|
|
74421
|
+
var import_react34, Indicator_default;
|
|
73973
74422
|
var init_Indicator = __esm({
|
|
73974
74423
|
async "node_modules/.pnpm/ink-select-input@6.2.0_ink@6.8.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-select-input/build/Indicator.js"() {
|
|
73975
74424
|
"use strict";
|
|
73976
|
-
|
|
74425
|
+
import_react34 = __toESM(require_react(), 1);
|
|
73977
74426
|
await init_build2();
|
|
73978
74427
|
init_figures();
|
|
73979
74428
|
Indicator_default = Indicator;
|
|
@@ -74027,17 +74476,17 @@ function SelectInput({ items = [], isFocused = true, initialIndex = 0, indicator
|
|
|
74027
74476
|
const hasLimit = typeof customLimit === "number" && items.length > customLimit;
|
|
74028
74477
|
const limit = hasLimit ? Math.min(customLimit, items.length) : items.length;
|
|
74029
74478
|
const lastIndex = limit - 1;
|
|
74030
|
-
const [rotateIndex, setRotateIndex] = (0,
|
|
74031
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
74032
|
-
const previousItems = (0,
|
|
74033
|
-
(0,
|
|
74479
|
+
const [rotateIndex, setRotateIndex] = (0, import_react35.useState)(initialIndex > lastIndex ? lastIndex - initialIndex : 0);
|
|
74480
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react35.useState)(initialIndex ? initialIndex > lastIndex ? lastIndex : initialIndex : 0);
|
|
74481
|
+
const previousItems = (0, import_react35.useRef)(items);
|
|
74482
|
+
(0, import_react35.useEffect)(() => {
|
|
74034
74483
|
if (!isDeepStrictEqual2(previousItems.current.map((item) => item.value), items.map((item) => item.value))) {
|
|
74035
74484
|
setRotateIndex(0);
|
|
74036
74485
|
setSelectedIndex(0);
|
|
74037
74486
|
}
|
|
74038
74487
|
previousItems.current = items;
|
|
74039
74488
|
}, [items]);
|
|
74040
|
-
use_input_default((0,
|
|
74489
|
+
use_input_default((0, import_react35.useCallback)((input, key) => {
|
|
74041
74490
|
if (input === "k" || key.upArrow) {
|
|
74042
74491
|
const lastIndex2 = (hasLimit ? limit : items.length) - 1;
|
|
74043
74492
|
const atFirstIndex = selectedIndex === 0;
|
|
@@ -74089,24 +74538,24 @@ function SelectInput({ items = [], isFocused = true, initialIndex = 0, indicator
|
|
|
74089
74538
|
onHighlight
|
|
74090
74539
|
]), { isActive: isFocused });
|
|
74091
74540
|
const slicedItems = hasLimit ? toRotated(items, rotateIndex).slice(0, limit) : items;
|
|
74092
|
-
return
|
|
74541
|
+
return import_react35.default.createElement(Box_default, { flexDirection: "column" }, slicedItems.map((item, index) => {
|
|
74093
74542
|
const isSelected = index === selectedIndex;
|
|
74094
74543
|
return (
|
|
74095
74544
|
// @ts-expect-error - `key` can't be optional but `item.value` is generic T
|
|
74096
|
-
|
|
74545
|
+
import_react35.default.createElement(
|
|
74097
74546
|
Box_default,
|
|
74098
74547
|
{ key: item.key ?? item.value },
|
|
74099
|
-
|
|
74100
|
-
|
|
74548
|
+
import_react35.default.createElement(indicatorComponent, { isSelected }),
|
|
74549
|
+
import_react35.default.createElement(itemComponent, { ...item, isSelected })
|
|
74101
74550
|
)
|
|
74102
74551
|
);
|
|
74103
74552
|
}));
|
|
74104
74553
|
}
|
|
74105
|
-
var
|
|
74554
|
+
var import_react35, SelectInput_default;
|
|
74106
74555
|
var init_SelectInput = __esm({
|
|
74107
74556
|
async "node_modules/.pnpm/ink-select-input@6.2.0_ink@6.8.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-select-input/build/SelectInput.js"() {
|
|
74108
74557
|
"use strict";
|
|
74109
|
-
|
|
74558
|
+
import_react35 = __toESM(require_react(), 1);
|
|
74110
74559
|
init_to_rotated();
|
|
74111
74560
|
await init_build2();
|
|
74112
74561
|
await init_Indicator();
|
|
@@ -74141,8 +74590,8 @@ function InitFlow({
|
|
|
74141
74590
|
initialFramework,
|
|
74142
74591
|
onComplete
|
|
74143
74592
|
}) {
|
|
74144
|
-
const [name, setName] = (0,
|
|
74145
|
-
const [nameError, setNameError] = (0,
|
|
74593
|
+
const [name, setName] = (0, import_react36.useState)(initialName ?? "");
|
|
74594
|
+
const [nameError, setNameError] = (0, import_react36.useState)(null);
|
|
74146
74595
|
function firstStep() {
|
|
74147
74596
|
if (initialName === null)
|
|
74148
74597
|
return "name";
|
|
@@ -74154,8 +74603,8 @@ function InitFlow({
|
|
|
74154
74603
|
return "framework";
|
|
74155
74604
|
return "intelligence";
|
|
74156
74605
|
}
|
|
74157
|
-
const [step, setStep] = (0,
|
|
74158
|
-
(0,
|
|
74606
|
+
const [step, setStep] = (0, import_react36.useState)(firstStep);
|
|
74607
|
+
(0, import_react36.useEffect)(() => {
|
|
74159
74608
|
if (step === "done") {
|
|
74160
74609
|
if (initialFramework !== null) {
|
|
74161
74610
|
onComplete({
|
|
@@ -74230,16 +74679,16 @@ function InitFlow({
|
|
|
74230
74679
|
framework: chosen
|
|
74231
74680
|
});
|
|
74232
74681
|
}
|
|
74233
|
-
return /* @__PURE__ */ (0,
|
|
74234
|
-
step === "name" && /* @__PURE__ */ (0,
|
|
74235
|
-
/* @__PURE__ */ (0,
|
|
74236
|
-
/* @__PURE__ */ (0,
|
|
74237
|
-
/* @__PURE__ */ (0,
|
|
74238
|
-
/* @__PURE__ */ (0,
|
|
74682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
74683
|
+
step === "name" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
74684
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: "Project name" }),
|
|
74685
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "gray", children: "Lowercase letters, numbers, hyphens \u2014 max 30 chars" }),
|
|
74686
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { children: [
|
|
74687
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
|
|
74239
74688
|
">",
|
|
74240
74689
|
" "
|
|
74241
74690
|
] }),
|
|
74242
|
-
/* @__PURE__ */ (0,
|
|
74691
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
74243
74692
|
build_default,
|
|
74244
74693
|
{
|
|
74245
74694
|
value: name,
|
|
@@ -74249,29 +74698,29 @@ function InitFlow({
|
|
|
74249
74698
|
}
|
|
74250
74699
|
)
|
|
74251
74700
|
] }),
|
|
74252
|
-
nameError !== null && /* @__PURE__ */ (0,
|
|
74701
|
+
nameError !== null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "red", children: nameError })
|
|
74253
74702
|
] }),
|
|
74254
|
-
step === "intelligence" && /* @__PURE__ */ (0,
|
|
74255
|
-
/* @__PURE__ */ (0,
|
|
74256
|
-
/* @__PURE__ */ (0,
|
|
74257
|
-
/* @__PURE__ */ (0,
|
|
74703
|
+
step === "intelligence" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
74704
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: "Do you want to use CopilotKit Intelligence?" }),
|
|
74705
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "gray", children: "Intelligence adds durable threads, state persistence, and insights." }),
|
|
74706
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectInput_default, { items: INTELLIGENCE_CHOICES, onSelect: handleIntelligenceSelect })
|
|
74258
74707
|
] }),
|
|
74259
|
-
step === "framework" && /* @__PURE__ */ (0,
|
|
74260
|
-
/* @__PURE__ */ (0,
|
|
74261
|
-
/* @__PURE__ */ (0,
|
|
74708
|
+
step === "framework" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
74709
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: "Select agent framework" }),
|
|
74710
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectInput_default, { items: FRAMEWORK_CHOICES, onSelect: handleFrameworkSelect })
|
|
74262
74711
|
] })
|
|
74263
74712
|
] });
|
|
74264
74713
|
}
|
|
74265
|
-
var
|
|
74714
|
+
var import_react36, import_jsx_runtime6, PROJECT_NAME_RE, INTELLIGENCE_CHOICES;
|
|
74266
74715
|
var init_init_flow = __esm({
|
|
74267
74716
|
async "apps/cli/src/ui/init-flow.tsx"() {
|
|
74268
74717
|
"use strict";
|
|
74269
|
-
|
|
74718
|
+
import_react36 = __toESM(require_react(), 1);
|
|
74270
74719
|
await init_build2();
|
|
74271
74720
|
await init_build4();
|
|
74272
74721
|
await init_build3();
|
|
74273
74722
|
init_types();
|
|
74274
|
-
|
|
74723
|
+
import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
74275
74724
|
PROJECT_NAME_RE = /^[a-z0-9-]{1,30}$/;
|
|
74276
74725
|
INTELLIGENCE_CHOICES = [
|
|
74277
74726
|
{ label: "Yes \u2014 enable Intelligence (threads, persistence, insights)", value: "yes" },
|
|
@@ -74283,14 +74732,20 @@ var init_init_flow = __esm({
|
|
|
74283
74732
|
// apps/cli/src/commands/init.tsx
|
|
74284
74733
|
var init_exports = {};
|
|
74285
74734
|
__export(init_exports, {
|
|
74735
|
+
InitApp: () => InitApp,
|
|
74286
74736
|
buildInitNextSteps: () => buildInitNextSteps,
|
|
74287
74737
|
commandExists: () => commandExists,
|
|
74738
|
+
resolvePrefilledOptions: () => resolvePrefilledOptions,
|
|
74288
74739
|
runInit: () => runInit,
|
|
74289
|
-
scaffoldInitProject: () => scaffoldInitProject
|
|
74740
|
+
scaffoldInitProject: () => scaffoldInitProject,
|
|
74741
|
+
shouldRenderInitBrowserLoginConfirmation: () => shouldRenderInitBrowserLoginConfirmation
|
|
74290
74742
|
});
|
|
74291
74743
|
import { accessSync, constants as constants2 } from "node:fs";
|
|
74292
74744
|
import * as path10 from "node:path";
|
|
74293
74745
|
import { execSync as execSync2 } from "node:child_process";
|
|
74746
|
+
function shouldRenderInitBrowserLoginConfirmation(phase) {
|
|
74747
|
+
return phase === "confirming" || phase === "waiting" || phase === "finalizing";
|
|
74748
|
+
}
|
|
74294
74749
|
function writeLicenseKey(projectDir, licenseKey) {
|
|
74295
74750
|
writeEnvLicenseKey(projectDir, licenseKey);
|
|
74296
74751
|
}
|
|
@@ -74463,25 +74918,25 @@ function ScaffoldProgress({ options }) {
|
|
|
74463
74918
|
const { exit } = use_app_default();
|
|
74464
74919
|
const browserLogin = useBrowserLogin();
|
|
74465
74920
|
const templateDefinition = resolveInitTemplate(options);
|
|
74466
|
-
const [phase, setPhase] = (0,
|
|
74921
|
+
const [phase, setPhase] = (0, import_react37.useState)(
|
|
74467
74922
|
templateDefinition.requiresLicense ? "auth" : "scaffold"
|
|
74468
74923
|
);
|
|
74469
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
74470
|
-
const [authMessage, setAuthMessage] = (0,
|
|
74471
|
-
const [nextSteps, setNextSteps] = (0,
|
|
74472
|
-
const scaffoldDependencies = (0,
|
|
74924
|
+
const [errorMessage, setErrorMessage] = (0, import_react37.useState)("");
|
|
74925
|
+
const [authMessage, setAuthMessage] = (0, import_react37.useState)("");
|
|
74926
|
+
const [nextSteps, setNextSteps] = (0, import_react37.useState)([]);
|
|
74927
|
+
const scaffoldDependencies = (0, import_react37.useMemo)(
|
|
74473
74928
|
() => ({
|
|
74474
74929
|
...defaultInitScaffoldDependencies,
|
|
74475
74930
|
login: browserLogin.runLogin
|
|
74476
74931
|
}),
|
|
74477
74932
|
[browserLogin.runLogin]
|
|
74478
74933
|
);
|
|
74479
|
-
(0,
|
|
74934
|
+
(0, import_react37.useEffect)(() => {
|
|
74480
74935
|
if (phase === "success" || phase === "error") {
|
|
74481
74936
|
exit();
|
|
74482
74937
|
}
|
|
74483
74938
|
}, [phase, exit]);
|
|
74484
|
-
(0,
|
|
74939
|
+
(0, import_react37.useEffect)(() => {
|
|
74485
74940
|
let cancelled = false;
|
|
74486
74941
|
async function run() {
|
|
74487
74942
|
const result = await scaffoldInitProject(
|
|
@@ -74517,43 +74972,46 @@ function ScaffoldProgress({ options }) {
|
|
|
74517
74972
|
cancelled = true;
|
|
74518
74973
|
};
|
|
74519
74974
|
}, [options, scaffoldDependencies]);
|
|
74520
|
-
if (browserLogin.state.phase
|
|
74521
|
-
return /* @__PURE__ */ (0,
|
|
74975
|
+
if (shouldRenderInitBrowserLoginConfirmation(browserLogin.state.phase)) {
|
|
74976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BrowserLoginConfirmation, {});
|
|
74522
74977
|
}
|
|
74523
74978
|
if (phase === "auth") {
|
|
74524
|
-
return /* @__PURE__ */ (0,
|
|
74525
|
-
authMessage ? /* @__PURE__ */ (0,
|
|
74526
|
-
/* @__PURE__ */ (0,
|
|
74979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
74980
|
+
authMessage ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", children: authMessage }) : null,
|
|
74981
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { label: "\u{1FA81} Verifying authentication\u2026" })
|
|
74527
74982
|
] });
|
|
74528
74983
|
}
|
|
74529
74984
|
if (phase === "license") {
|
|
74530
|
-
return /* @__PURE__ */ (0,
|
|
74531
|
-
authMessage ? /* @__PURE__ */ (0,
|
|
74532
|
-
/* @__PURE__ */ (0,
|
|
74985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
74986
|
+
authMessage ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", children: authMessage }) : null,
|
|
74987
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { label: "\u{1FA81} Issuing license key\u2026" })
|
|
74533
74988
|
] });
|
|
74534
74989
|
}
|
|
74535
74990
|
if (phase === "scaffold") {
|
|
74536
|
-
return /* @__PURE__ */ (0,
|
|
74991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { label: "\u{1FA81} Downloading template\u2026" }) });
|
|
74537
74992
|
}
|
|
74538
74993
|
if (phase === "git") {
|
|
74539
|
-
return /* @__PURE__ */ (0,
|
|
74994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { label: "Initializing git repository\u2026" }) });
|
|
74540
74995
|
}
|
|
74541
74996
|
if (phase === "success") {
|
|
74542
|
-
return /* @__PURE__ */ (0,
|
|
74543
|
-
/* @__PURE__ */ (0,
|
|
74997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
74998
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "green", children: [
|
|
74544
74999
|
templateDefinition.successEmoji,
|
|
74545
75000
|
' Project "',
|
|
74546
75001
|
options.name,
|
|
74547
75002
|
'" created successfully!'
|
|
74548
75003
|
] }),
|
|
74549
|
-
nextSteps.map((step, index) => /* @__PURE__ */ (0,
|
|
75004
|
+
nextSteps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "gray", children: step }, `step-${index}`))
|
|
74550
75005
|
] });
|
|
74551
75006
|
}
|
|
74552
|
-
return /* @__PURE__ */ (0,
|
|
75007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "red", children: [
|
|
74553
75008
|
"Init failed: ",
|
|
74554
75009
|
errorMessage
|
|
74555
75010
|
] }) });
|
|
74556
75011
|
}
|
|
75012
|
+
function renderDefaultScaffoldProgress(options) {
|
|
75013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ScaffoldProgress, { options });
|
|
75014
|
+
}
|
|
74557
75015
|
function resolvePrefilledOptions(name, intelligence, framework) {
|
|
74558
75016
|
if (name === null)
|
|
74559
75017
|
return null;
|
|
@@ -74572,29 +75030,33 @@ function resolvePrefilledOptions(name, intelligence, framework) {
|
|
|
74572
75030
|
function InitApp({
|
|
74573
75031
|
initialName,
|
|
74574
75032
|
initialIntelligence,
|
|
74575
|
-
initialFramework
|
|
75033
|
+
initialFramework,
|
|
75034
|
+
renderScaffoldProgress = renderDefaultScaffoldProgress
|
|
74576
75035
|
}) {
|
|
74577
75036
|
const prefilled = resolvePrefilledOptions(
|
|
74578
75037
|
initialName,
|
|
74579
75038
|
initialIntelligence,
|
|
74580
75039
|
initialFramework
|
|
74581
75040
|
);
|
|
74582
|
-
const [options, setOptions] = (0,
|
|
74583
|
-
return /* @__PURE__ */ (0,
|
|
74584
|
-
/* @__PURE__ */ (0,
|
|
74585
|
-
options !== null ? /* @__PURE__ */ (0,
|
|
74586
|
-
|
|
74587
|
-
|
|
74588
|
-
|
|
74589
|
-
|
|
74590
|
-
|
|
74591
|
-
|
|
74592
|
-
|
|
74593
|
-
|
|
75041
|
+
const [options, setOptions] = (0, import_react37.useState)(prefilled);
|
|
75042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
75043
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Banner, {}),
|
|
75044
|
+
options !== null ? renderScaffoldProgress(options) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
75045
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
75046
|
+
InitFlow,
|
|
75047
|
+
{
|
|
75048
|
+
initialName,
|
|
75049
|
+
initialIntelligence,
|
|
75050
|
+
initialFramework,
|
|
75051
|
+
onComplete: (resolved) => {
|
|
75052
|
+
if (resolved !== null) {
|
|
75053
|
+
setOptions(resolved);
|
|
75054
|
+
}
|
|
74594
75055
|
}
|
|
74595
75056
|
}
|
|
74596
|
-
|
|
74597
|
-
|
|
75057
|
+
),
|
|
75058
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CliTip, {})
|
|
75059
|
+
] })
|
|
74598
75060
|
] });
|
|
74599
75061
|
}
|
|
74600
75062
|
async function runInit(flags) {
|
|
@@ -74607,7 +75069,7 @@ async function runInit(flags) {
|
|
|
74607
75069
|
}
|
|
74608
75070
|
const initialFramework = frameworkFlag;
|
|
74609
75071
|
const { waitUntilExit } = render_default(
|
|
74610
|
-
/* @__PURE__ */ (0,
|
|
75072
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
74611
75073
|
InitApp,
|
|
74612
75074
|
{
|
|
74613
75075
|
initialName,
|
|
@@ -74618,11 +75080,11 @@ async function runInit(flags) {
|
|
|
74618
75080
|
);
|
|
74619
75081
|
await waitUntilExit();
|
|
74620
75082
|
}
|
|
74621
|
-
var
|
|
75083
|
+
var import_react37, import_jsx_runtime7, defaultInitScaffoldDependencies;
|
|
74622
75084
|
var init_init = __esm({
|
|
74623
75085
|
async "apps/cli/src/commands/init.tsx"() {
|
|
74624
75086
|
"use strict";
|
|
74625
|
-
|
|
75087
|
+
import_react37 = __toESM(require_react(), 1);
|
|
74626
75088
|
await init_build2();
|
|
74627
75089
|
await init_build2();
|
|
74628
75090
|
init_types();
|
|
@@ -74632,10 +75094,11 @@ var init_init = __esm({
|
|
|
74632
75094
|
init_config_service();
|
|
74633
75095
|
await init_banner();
|
|
74634
75096
|
await init_browser_login();
|
|
75097
|
+
await init_cli_tip();
|
|
74635
75098
|
await init_init_flow();
|
|
74636
75099
|
await init_spinner();
|
|
74637
75100
|
init_config();
|
|
74638
|
-
|
|
75101
|
+
import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
|
|
74639
75102
|
defaultInitScaffoldDependencies = {
|
|
74640
75103
|
verifyAndRefresh,
|
|
74641
75104
|
login,
|
|
@@ -74676,7 +75139,7 @@ var init_version = __esm({
|
|
|
74676
75139
|
// apps/cli/src/ui/login-flow.tsx
|
|
74677
75140
|
function LoginFlow({ onComplete }) {
|
|
74678
75141
|
const { runLogin: runLogin2 } = useBrowserLogin();
|
|
74679
|
-
(0,
|
|
75142
|
+
(0, import_react38.useEffect)(() => {
|
|
74680
75143
|
runLogin2().then(() => {
|
|
74681
75144
|
onComplete({ success: true });
|
|
74682
75145
|
}).catch((error48) => {
|
|
@@ -74688,15 +75151,15 @@ function LoginFlow({ onComplete }) {
|
|
|
74688
75151
|
onComplete({ error: fallbackError, success: false });
|
|
74689
75152
|
});
|
|
74690
75153
|
}, [onComplete, runLogin2]);
|
|
74691
|
-
return /* @__PURE__ */ (0,
|
|
75154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BrowserLoginConfirmation, {});
|
|
74692
75155
|
}
|
|
74693
|
-
var
|
|
75156
|
+
var import_react38, import_jsx_runtime8;
|
|
74694
75157
|
var init_login_flow = __esm({
|
|
74695
75158
|
async "apps/cli/src/ui/login-flow.tsx"() {
|
|
74696
75159
|
"use strict";
|
|
74697
|
-
|
|
75160
|
+
import_react38 = __toESM(require_react(), 1);
|
|
74698
75161
|
await init_browser_login();
|
|
74699
|
-
|
|
75162
|
+
import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
74700
75163
|
}
|
|
74701
75164
|
});
|
|
74702
75165
|
|
|
@@ -74708,7 +75171,7 @@ __export(login_exports, {
|
|
|
74708
75171
|
async function runLogin() {
|
|
74709
75172
|
return await new Promise((resolve2, reject) => {
|
|
74710
75173
|
const { unmount } = render_default(
|
|
74711
|
-
/* @__PURE__ */ (0,
|
|
75174
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BrowserLoginProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
74712
75175
|
LoginFlow,
|
|
74713
75176
|
{
|
|
74714
75177
|
onComplete: (result) => {
|
|
@@ -74726,14 +75189,14 @@ async function runLogin() {
|
|
|
74726
75189
|
);
|
|
74727
75190
|
});
|
|
74728
75191
|
}
|
|
74729
|
-
var
|
|
75192
|
+
var import_jsx_runtime9;
|
|
74730
75193
|
var init_login = __esm({
|
|
74731
75194
|
async "apps/cli/src/commands/login.tsx"() {
|
|
74732
75195
|
"use strict";
|
|
74733
75196
|
await init_build2();
|
|
74734
75197
|
await init_login_flow();
|
|
74735
75198
|
await init_browser_login();
|
|
74736
|
-
|
|
75199
|
+
import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
74737
75200
|
}
|
|
74738
75201
|
});
|
|
74739
75202
|
|
|
@@ -89304,16 +89767,16 @@ function KiteGame({
|
|
|
89304
89767
|
const { stdout } = use_stdout_default();
|
|
89305
89768
|
const terminalWidth = useTerminalWidth(stdout);
|
|
89306
89769
|
const playableWidth = getPlayableWidth(terminalWidth);
|
|
89307
|
-
const rngRef = (0,
|
|
89308
|
-
const [highScore, setHighScore] = (0,
|
|
89309
|
-
const [state, setState] = (0,
|
|
89770
|
+
const rngRef = (0, import_react39.useRef)(rng);
|
|
89771
|
+
const [highScore, setHighScore] = (0, import_react39.useState)(() => readKiteGameHighScore());
|
|
89772
|
+
const [state, setState] = (0, import_react39.useState)(
|
|
89310
89773
|
() => createKiteGame({ width: playableWidth, rng: rngRef.current })
|
|
89311
89774
|
);
|
|
89312
|
-
const rows = (0,
|
|
89313
|
-
(0,
|
|
89775
|
+
const rows = (0, import_react39.useMemo)(() => renderKiteGameRows(state), [state]);
|
|
89776
|
+
(0, import_react39.useEffect)(() => {
|
|
89314
89777
|
rngRef.current = rng;
|
|
89315
89778
|
}, [rng]);
|
|
89316
|
-
(0,
|
|
89779
|
+
(0, import_react39.useEffect)(() => {
|
|
89317
89780
|
setState((currentState) => {
|
|
89318
89781
|
if (currentState.width === playableWidth) {
|
|
89319
89782
|
return currentState;
|
|
@@ -89325,13 +89788,13 @@ function KiteGame({
|
|
|
89325
89788
|
});
|
|
89326
89789
|
});
|
|
89327
89790
|
}, [playableWidth]);
|
|
89328
|
-
(0,
|
|
89791
|
+
(0, import_react39.useEffect)(() => {
|
|
89329
89792
|
if (!state.crashed) {
|
|
89330
89793
|
return;
|
|
89331
89794
|
}
|
|
89332
89795
|
setHighScore(saveKiteGameHighScore(state.score));
|
|
89333
89796
|
}, [state.crashed, state.score]);
|
|
89334
|
-
(0,
|
|
89797
|
+
(0, import_react39.useEffect)(() => {
|
|
89335
89798
|
if (!state.started || state.crashed) {
|
|
89336
89799
|
return void 0;
|
|
89337
89800
|
}
|
|
@@ -89374,23 +89837,23 @@ function KiteGame({
|
|
|
89374
89837
|
setState((currentState) => flapKite(currentState));
|
|
89375
89838
|
}
|
|
89376
89839
|
});
|
|
89377
|
-
return /* @__PURE__ */ (0,
|
|
89378
|
-
/* @__PURE__ */ (0,
|
|
89840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
89841
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { children: [
|
|
89379
89842
|
"CopilotKit Kite Score ",
|
|
89380
89843
|
state.score,
|
|
89381
89844
|
" High",
|
|
89382
89845
|
" ",
|
|
89383
89846
|
Math.max(highScore, state.score)
|
|
89384
89847
|
] }),
|
|
89385
|
-
/* @__PURE__ */ (0,
|
|
89386
|
-
/* @__PURE__ */ (0,
|
|
89848
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { flexDirection: "column", borderStyle: "single", children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: row }, `${index}-${row}`)) }),
|
|
89849
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: state.crashed ? "Crashed. Enter/r to reset. Space to restart. q/Esc to quit." : state.started ? "Space/up to send wind. q/Esc to quit." : "Ready. Space/up to start. q/Esc to quit." })
|
|
89387
89850
|
] });
|
|
89388
89851
|
}
|
|
89389
89852
|
function useTerminalWidth(stdout) {
|
|
89390
|
-
const [terminalWidth, setTerminalWidth] = (0,
|
|
89853
|
+
const [terminalWidth, setTerminalWidth] = (0, import_react39.useState)(
|
|
89391
89854
|
() => getStdoutColumns(stdout)
|
|
89392
89855
|
);
|
|
89393
|
-
(0,
|
|
89856
|
+
(0, import_react39.useEffect)(() => {
|
|
89394
89857
|
const updateTerminalWidth = () => {
|
|
89395
89858
|
setTerminalWidth(getStdoutColumns(stdout));
|
|
89396
89859
|
};
|
|
@@ -89407,15 +89870,15 @@ function getStdoutColumns(stdout) {
|
|
|
89407
89870
|
function getPlayableWidth(terminalWidth) {
|
|
89408
89871
|
return Math.max(MIN_PLAYABLE_WIDTH, terminalWidth - BORDER_COLUMNS);
|
|
89409
89872
|
}
|
|
89410
|
-
var
|
|
89873
|
+
var import_react39, import_jsx_runtime10, DEFAULT_TICK_MS, MIN_PLAYABLE_WIDTH, BORDER_COLUMNS;
|
|
89411
89874
|
var init_kite_game = __esm({
|
|
89412
89875
|
async "apps/cli/src/ui/kite-game.tsx"() {
|
|
89413
89876
|
"use strict";
|
|
89414
89877
|
await init_build2();
|
|
89415
|
-
|
|
89878
|
+
import_react39 = __toESM(require_react(), 1);
|
|
89416
89879
|
init_kite_game_engine();
|
|
89417
89880
|
init_kite_game_score();
|
|
89418
|
-
|
|
89881
|
+
import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
|
|
89419
89882
|
DEFAULT_TICK_MS = 75;
|
|
89420
89883
|
MIN_PLAYABLE_WIDTH = 32;
|
|
89421
89884
|
BORDER_COLUMNS = 2;
|
|
@@ -89429,19 +89892,19 @@ __export(kite_exports, {
|
|
|
89429
89892
|
});
|
|
89430
89893
|
async function runKite() {
|
|
89431
89894
|
return await new Promise((resolve2, reject) => {
|
|
89432
|
-
const { waitUntilExit } = render_default(/* @__PURE__ */ (0,
|
|
89895
|
+
const { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(KiteGame, { onExit: resolve2 }));
|
|
89433
89896
|
waitUntilExit().then(() => {
|
|
89434
89897
|
resolve2();
|
|
89435
89898
|
}).catch(reject);
|
|
89436
89899
|
});
|
|
89437
89900
|
}
|
|
89438
|
-
var
|
|
89901
|
+
var import_jsx_runtime11;
|
|
89439
89902
|
var init_kite = __esm({
|
|
89440
89903
|
async "apps/cli/src/commands/kite.tsx"() {
|
|
89441
89904
|
"use strict";
|
|
89442
89905
|
await init_build2();
|
|
89443
89906
|
await init_kite_game();
|
|
89444
|
-
|
|
89907
|
+
import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
89445
89908
|
}
|
|
89446
89909
|
});
|
|
89447
89910
|
|