@unikode/cli 1.0.13 → 1.0.14
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/dist/index.js +99 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -969,6 +969,22 @@ var SUPPORTED_CHAT_MODELS = [
|
|
|
969
969
|
inputUsdPerMillionTokens: 30,
|
|
970
970
|
outputUsdPerMillionTokens: 30
|
|
971
971
|
}
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
id: "qwen3:4b",
|
|
975
|
+
provider: "local-ollama",
|
|
976
|
+
pricing: {
|
|
977
|
+
inputUsdPerMillionTokens: 30,
|
|
978
|
+
outputUsdPerMillionTokens: 30
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
id: "gpt-oss:120b-cloud",
|
|
983
|
+
provider: "local-ollama",
|
|
984
|
+
pricing: {
|
|
985
|
+
inputUsdPerMillionTokens: 30,
|
|
986
|
+
outputUsdPerMillionTokens: 30
|
|
987
|
+
}
|
|
972
988
|
}
|
|
973
989
|
];
|
|
974
990
|
function findSupportedChatModel(modelId) {
|
|
@@ -1615,8 +1631,8 @@ function getErrorMessage2(error) {
|
|
|
1615
1631
|
return error instanceof Error ? error.message : String(error);
|
|
1616
1632
|
}
|
|
1617
1633
|
async function performLogin() {
|
|
1618
|
-
const clerkFrontendApi =
|
|
1619
|
-
const clientId =
|
|
1634
|
+
const clerkFrontendApi = process.env.CLERK_FRONTEND_API;
|
|
1635
|
+
const clientId = process.env.CLERK_OAUTH_CLIENT_ID;
|
|
1620
1636
|
const apiUrl = process.env.API_URL ?? "http://localhost:3000";
|
|
1621
1637
|
if (!clerkFrontendApi)
|
|
1622
1638
|
throw new Error("CLERK_FRONTEND_API not set");
|
|
@@ -2916,7 +2932,7 @@ function Docs() {
|
|
|
2916
2932
|
}
|
|
2917
2933
|
|
|
2918
2934
|
// src/screens/new-session.tsx
|
|
2919
|
-
import { useEffect as useEffect4, useMemo as
|
|
2935
|
+
import { useEffect as useEffect4, useMemo as useMemo4, useRef as useRef8 } from "react";
|
|
2920
2936
|
import { z as z2 } from "zod";
|
|
2921
2937
|
import { useNavigate as useNavigate5, useLocation } from "react-router";
|
|
2922
2938
|
|
|
@@ -3040,8 +3056,9 @@ function UserMessage({ message, mode }) {
|
|
|
3040
3056
|
}, undefined, false, undefined, this);
|
|
3041
3057
|
}
|
|
3042
3058
|
// src/components/messages/bot-message.tsx
|
|
3059
|
+
import { useMemo as useMemo3 } from "react";
|
|
3043
3060
|
import prettyMs from "pretty-ms";
|
|
3044
|
-
import { TextAttributes as TextAttributes10 } from "@opentui/core";
|
|
3061
|
+
import { SyntaxStyle, TextAttributes as TextAttributes10, getTreeSitterClient, BoxRenderable } from "@opentui/core";
|
|
3045
3062
|
|
|
3046
3063
|
// src/components/messages/question-message.tsx
|
|
3047
3064
|
import { useCallback as useCallback13, useRef as useRef7, useState as useState10 } from "react";
|
|
@@ -3169,6 +3186,58 @@ function BotMessage({
|
|
|
3169
3186
|
onSubmitQuestionAnswer
|
|
3170
3187
|
}) {
|
|
3171
3188
|
const { colors } = useTheme();
|
|
3189
|
+
const syntaxStyle = useMemo3(() => SyntaxStyle.fromStyles({
|
|
3190
|
+
"markup.heading.1": { fg: colors.primary, bold: true },
|
|
3191
|
+
"markup.heading.2": { fg: colors.primary, bold: true },
|
|
3192
|
+
"markup.heading.3": { fg: colors.info, bold: true },
|
|
3193
|
+
"markup.heading.4": { fg: colors.info },
|
|
3194
|
+
"markup.heading.5": { fg: colors.info },
|
|
3195
|
+
"markup.heading.6": { fg: colors.info },
|
|
3196
|
+
"markup.bold": { bold: true },
|
|
3197
|
+
"markup.italic": { italic: true },
|
|
3198
|
+
"markup.raw": { fg: colors.success },
|
|
3199
|
+
"markup.raw.block": { fg: colors.success },
|
|
3200
|
+
"markup.list": { fg: colors.info },
|
|
3201
|
+
"markup.link": { fg: colors.info, underline: true },
|
|
3202
|
+
"markup.link.url": { fg: colors.dimSeparator, underline: true },
|
|
3203
|
+
keyword: { fg: colors.planMode, bold: true },
|
|
3204
|
+
string: { fg: colors.success },
|
|
3205
|
+
comment: { fg: colors.dimSeparator, italic: true },
|
|
3206
|
+
number: { fg: colors.primary },
|
|
3207
|
+
constant: { fg: colors.primary },
|
|
3208
|
+
type: { fg: colors.info },
|
|
3209
|
+
function: { fg: colors.primary },
|
|
3210
|
+
operator: { fg: colors.info },
|
|
3211
|
+
punctuation: { fg: colors.dimSeparator },
|
|
3212
|
+
boolean: { fg: colors.primary },
|
|
3213
|
+
property: { fg: colors.info },
|
|
3214
|
+
variable: { fg: "#E0E0E0" },
|
|
3215
|
+
default: { fg: "#E0E0E0" }
|
|
3216
|
+
}), [colors]);
|
|
3217
|
+
const treeSitterClient = useMemo3(() => getTreeSitterClient(), []);
|
|
3218
|
+
const renderNode = useMemo3(() => {
|
|
3219
|
+
return (token, context) => {
|
|
3220
|
+
if (token.type === "code") {
|
|
3221
|
+
const codeRenderable = context.defaultRender();
|
|
3222
|
+
if (!codeRenderable)
|
|
3223
|
+
return null;
|
|
3224
|
+
const box = new BoxRenderable(codeRenderable.ctx, {
|
|
3225
|
+
border: true,
|
|
3226
|
+
borderStyle: "rounded",
|
|
3227
|
+
borderColor: colors.thinkingBorder,
|
|
3228
|
+
backgroundColor: colors.surface,
|
|
3229
|
+
paddingX: 1,
|
|
3230
|
+
paddingY: 0,
|
|
3231
|
+
width: "100%",
|
|
3232
|
+
title: token.lang ? ` ${token.lang.toUpperCase()} ` : " CODE ",
|
|
3233
|
+
titleColor: colors.primary
|
|
3234
|
+
});
|
|
3235
|
+
box.add(codeRenderable);
|
|
3236
|
+
return box;
|
|
3237
|
+
}
|
|
3238
|
+
return;
|
|
3239
|
+
};
|
|
3240
|
+
}, [colors]);
|
|
3172
3241
|
return /* @__PURE__ */ jsxDEV24("box", {
|
|
3173
3242
|
width: "100%",
|
|
3174
3243
|
alignItems: "center",
|
|
@@ -3232,11 +3301,18 @@ function BotMessage({
|
|
|
3232
3301
|
}, part.toolCallId, false, undefined, this);
|
|
3233
3302
|
}
|
|
3234
3303
|
if (part.type === "text") {
|
|
3304
|
+
if (j > 0)
|
|
3305
|
+
return null;
|
|
3306
|
+
const fullText = group.parts.filter((p) => p.type === "text").map((p) => p.text).join("");
|
|
3235
3307
|
return /* @__PURE__ */ jsxDEV24("box", {
|
|
3236
3308
|
paddingX: 3,
|
|
3237
3309
|
width: "100%",
|
|
3238
|
-
children: /* @__PURE__ */ jsxDEV24("
|
|
3239
|
-
|
|
3310
|
+
children: /* @__PURE__ */ jsxDEV24("markdown", {
|
|
3311
|
+
content: fullText,
|
|
3312
|
+
syntaxStyle,
|
|
3313
|
+
streaming,
|
|
3314
|
+
treeSitterClient,
|
|
3315
|
+
renderNode
|
|
3240
3316
|
}, undefined, false, undefined, this)
|
|
3241
3317
|
}, `text-${j}`, false, undefined, this);
|
|
3242
3318
|
}
|
|
@@ -3331,7 +3407,7 @@ function NewSession() {
|
|
|
3331
3407
|
const location = useLocation();
|
|
3332
3408
|
const toast = useToast();
|
|
3333
3409
|
const hasStartedRef = useRef8(false);
|
|
3334
|
-
const state =
|
|
3410
|
+
const state = useMemo4(() => {
|
|
3335
3411
|
const parsed = newSessionStateSchema.safeParse(location.state);
|
|
3336
3412
|
return parsed.success ? parsed.data : null;
|
|
3337
3413
|
}, [location.state]);
|
|
@@ -3388,12 +3464,12 @@ function NewSession() {
|
|
|
3388
3464
|
}
|
|
3389
3465
|
|
|
3390
3466
|
// src/screens/session.tsx
|
|
3391
|
-
import { useState as useState12, useEffect as useEffect5, useMemo as
|
|
3467
|
+
import { useState as useState12, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef9 } from "react";
|
|
3392
3468
|
import { useParams, useLocation as useLocation2, useNavigate as useNavigate6 } from "react-router";
|
|
3393
3469
|
import { z as z3 } from "zod";
|
|
3394
3470
|
|
|
3395
3471
|
// src/hooks/use-chat.ts
|
|
3396
|
-
import { useCallback as useCallback14, useMemo as
|
|
3472
|
+
import { useCallback as useCallback14, useMemo as useMemo5, useState as useState11 } from "react";
|
|
3397
3473
|
import { useChat as useAiChat } from "@ai-sdk/react";
|
|
3398
3474
|
import {
|
|
3399
3475
|
DefaultChatTransport,
|
|
@@ -3873,7 +3949,7 @@ ${outline.join(`
|
|
|
3873
3949
|
// src/hooks/use-chat.ts
|
|
3874
3950
|
function useChat(sessionId, initialMessages) {
|
|
3875
3951
|
const [questionPrompts, setQuestionPrompts] = useState11([]);
|
|
3876
|
-
const transport =
|
|
3952
|
+
const transport = useMemo5(() => {
|
|
3877
3953
|
return new DefaultChatTransport({
|
|
3878
3954
|
api: apiClient.chat.$url().toString(),
|
|
3879
3955
|
headers() {
|
|
@@ -3986,7 +4062,8 @@ var sessionLocationSchema = z3.object({
|
|
|
3986
4062
|
function ChatMessage({
|
|
3987
4063
|
msg,
|
|
3988
4064
|
questionPrompts,
|
|
3989
|
-
onSubmitQuestionAnswer
|
|
4065
|
+
onSubmitQuestionAnswer,
|
|
4066
|
+
isStreaming = false
|
|
3990
4067
|
}) {
|
|
3991
4068
|
if (msg.role === "user") {
|
|
3992
4069
|
const text = msg.parts.filter((p) => p.type === "text").map((p) => p.text).join("");
|
|
@@ -4000,7 +4077,7 @@ function ChatMessage({
|
|
|
4000
4077
|
model: msg.metadata?.model ?? "unknown",
|
|
4001
4078
|
mode: msg.metadata?.mode ?? "BUILD",
|
|
4002
4079
|
durationMs: msg.metadata?.durationMs,
|
|
4003
|
-
streaming:
|
|
4080
|
+
streaming: isStreaming,
|
|
4004
4081
|
questionPrompts,
|
|
4005
4082
|
onSubmitQuestionAnswer
|
|
4006
4083
|
}, undefined, false, undefined, this);
|
|
@@ -4050,11 +4127,15 @@ function SessionChat({ session, initialPrompt }) {
|
|
|
4050
4127
|
loading: status === "submitted" || status === "streaming",
|
|
4051
4128
|
interruptible: status === "submitted" || status === "streaming",
|
|
4052
4129
|
children: [
|
|
4053
|
-
messages.map((msg) =>
|
|
4054
|
-
msg
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4130
|
+
messages.map((msg, i) => {
|
|
4131
|
+
const isLastAssistant = msg.role === "assistant" && i === messages.length - 1;
|
|
4132
|
+
return /* @__PURE__ */ jsxDEV27(ChatMessage, {
|
|
4133
|
+
msg,
|
|
4134
|
+
questionPrompts,
|
|
4135
|
+
onSubmitQuestionAnswer: submitQuestionAnswer,
|
|
4136
|
+
isStreaming: isLastAssistant && status === "streaming"
|
|
4137
|
+
}, msg.id, false, undefined, this);
|
|
4138
|
+
}),
|
|
4058
4139
|
error && /* @__PURE__ */ jsxDEV27(ErrorMessage, {
|
|
4059
4140
|
message: error.message
|
|
4060
4141
|
}, undefined, false, undefined, this)
|
|
@@ -4066,7 +4147,7 @@ function Session() {
|
|
|
4066
4147
|
const location = useLocation2();
|
|
4067
4148
|
const navigate = useNavigate6();
|
|
4068
4149
|
const toast = useToast();
|
|
4069
|
-
const prefetched =
|
|
4150
|
+
const prefetched = useMemo6(() => {
|
|
4070
4151
|
const parsed = sessionLocationSchema.safeParse(location.state);
|
|
4071
4152
|
return parsed.success ? parsed.data : null;
|
|
4072
4153
|
}, [location.state]);
|