tarsk 0.4.20 → 0.4.22
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 +78 -165
- package/dist/public/assets/{account-view-D1kGyryt.js → account-view-pOQZWJfl.js} +1 -1
- package/dist/public/assets/{alert-dialog-Bk7neo_n.js → alert-dialog-BeLER45U.js} +1 -1
- package/dist/public/assets/{api-DL5XaoTS.js → api-Bagaj1rQ.js} +1 -1
- package/dist/public/assets/{browser-tab-Cz-q-Pvk.js → browser-tab-DmootUHa.js} +1 -1
- package/dist/public/assets/chat-input-container-CfXgimBQ.js +1 -0
- package/dist/public/assets/context-menu-BlG_bTqN.js +1 -0
- package/dist/public/assets/conversation-history-view-DjO711iz.js +1 -0
- package/dist/public/assets/{dialogs-config-DmDjliuA.js → dialogs-config-Dwpv4SNp.js} +1 -1
- package/dist/public/assets/{diff-view-VbYca6ii.js → diff-view-B8Grak1p.js} +2 -2
- package/dist/public/assets/{explorer-tab-view-uSxyCL34.js → explorer-tab-view-lFzzjVe8.js} +2 -2
- package/dist/public/assets/explorer-tree-CyWyxQvY.js +1 -0
- package/dist/public/assets/{explorer-view-B0uaxiLf.js → explorer-view-DjN4dtgh.js} +1 -1
- package/dist/public/assets/{history-view-BOjZoBCb.js → history-view-BvAOaO8q.js} +1 -1
- package/dist/public/assets/index-BPF49zet.css +1 -0
- package/dist/public/assets/index-C7dA1l3u.js +50 -0
- package/dist/public/assets/onboarding-dialog-DSmKEXk4.js +1 -0
- package/dist/public/assets/onboarding-vGz3IczM.js +1 -0
- package/dist/public/assets/{page-toolbar-CvreDTwj.js → page-toolbar-CBE5_3E3.js} +1 -1
- package/dist/public/assets/{project-settings-view-BJYR_l3u.js → project-settings-view-B13GlkU6.js} +1 -1
- package/dist/public/assets/{provider-details-view-B1eTEo0M.js → provider-details-view-BQQKYvR8.js} +1 -1
- package/dist/public/assets/providers-sidebar-C2RknYQn.js +1 -0
- package/dist/public/assets/react-vendor-CYvpNUsM.js +17 -0
- package/dist/public/assets/{resizable-DJ5w1ZWX.js → resizable-C82J5y6K.js} +1 -1
- package/dist/public/assets/{run-stop-button-Z7jiLiq7.js → run-stop-button-1ECLRujs.js} +2 -2
- package/dist/public/assets/{settings-view-C38jeeqJ.js → settings-view-CxiVTevy.js} +2 -2
- package/dist/public/assets/{side-panel-container-BqWSTCOr.js → side-panel-container-B9Dn9qD2.js} +2 -2
- package/dist/public/assets/{standard-list-item-CpBjveM0.js → standard-list-item-BJWg4I9s.js} +1 -1
- package/dist/public/assets/store-Cn1lT5YJ.js +2 -0
- package/dist/public/assets/{tab-context-Bmd79Rk0.js → tab-context-COCYkRNN.js} +1 -1
- package/dist/public/assets/{tabs-DEmnnGvq.js → tabs-M7nUZf6O.js} +1 -1
- package/dist/public/assets/{terminal-panel-D6GPXaCe.js → terminal-panel-Cea0pLdX.js} +2 -2
- package/dist/public/assets/{textarea-BjfyGfGR.js → textarea-C5IMo2ya.js} +1 -1
- package/dist/public/assets/todos-view-DDVfCfgF.js +1 -0
- package/dist/public/assets/{use-toast-C9B1H3P9.js → use-toast-rlEtMnzM.js} +1 -1
- package/dist/public/assets/{utils-BG_JNnOl.js → utils-C3gmypZX.js} +1 -1
- package/dist/public/index.html +19 -19
- package/package.json +1 -1
- package/dist/public/assets/chat-input-container-0T-khQfd.js +0 -1
- package/dist/public/assets/context-menu-DHHElhQ1.js +0 -1
- package/dist/public/assets/conversation-history-view-HVFzgO9e.js +0 -1
- package/dist/public/assets/explorer-tree-DOg67ane.js +0 -1
- package/dist/public/assets/index-BE8v6oQ0.js +0 -50
- package/dist/public/assets/index-DVUFB7SX.css +0 -1
- package/dist/public/assets/onboarding-BgEjTEKs.js +0 -1
- package/dist/public/assets/onboarding-dialog-EiVl-ynw.js +0 -1
- package/dist/public/assets/providers-sidebar-Df50eL_5.js +0 -1
- package/dist/public/assets/react-vendor-CaS5zjF7.js +0 -17
- package/dist/public/assets/store-CLOSXq_q.js +0 -2
- package/dist/public/assets/todos-view-yPftPooW.js +0 -1
package/dist/index.js
CHANGED
|
@@ -7824,7 +7824,7 @@ $ ${validationScript}`
|
|
|
7824
7824
|
console.log("[ChatRoute] Validation script passed");
|
|
7825
7825
|
const passEvent = {
|
|
7826
7826
|
type: "thinking",
|
|
7827
|
-
content: `[
|
|
7827
|
+
content: `[Validated] Validation passed (exit code 0)${result.output ? `
|
|
7828
7828
|
${result.output}` : ""}`
|
|
7829
7829
|
};
|
|
7830
7830
|
processingStateManager.pushEvent(threadId, passEvent);
|
|
@@ -7834,7 +7834,7 @@ ${result.output}` : ""}`
|
|
|
7834
7834
|
console.log(`[ChatRoute] Validation script failed (exit code ${result.exitCode})`);
|
|
7835
7835
|
const failEvent = {
|
|
7836
7836
|
type: "thinking",
|
|
7837
|
-
content: `[
|
|
7837
|
+
content: `[Validated] Validation failed (exit code ${result.exitCode})
|
|
7838
7838
|
${result.output}`
|
|
7839
7839
|
};
|
|
7840
7840
|
processingStateManager.pushEvent(threadId, failEvent);
|
|
@@ -7884,7 +7884,7 @@ ${result.output}`;
|
|
|
7884
7884
|
if (attempt >= MAX_VALIDATION_ATTEMPTS) {
|
|
7885
7885
|
const maxAttemptsEvent = {
|
|
7886
7886
|
type: "thinking",
|
|
7887
|
-
content: `[
|
|
7887
|
+
content: `[Validated] Validation script still failing after ${MAX_VALIDATION_ATTEMPTS} attempts. Stopping.`
|
|
7888
7888
|
};
|
|
7889
7889
|
processingStateManager.pushEvent(threadId, maxAttemptsEvent);
|
|
7890
7890
|
yield maxAttemptsEvent;
|
|
@@ -15519,13 +15519,9 @@ async function getScriptsByProject(db, projectId) {
|
|
|
15519
15519
|
async function upsertProjectScripts(projectId, scripts) {
|
|
15520
15520
|
const db = await getDatabase();
|
|
15521
15521
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
15522
|
-
await db.execute({
|
|
15523
|
-
sql: `DELETE FROM project_scripts WHERE projectId = ?`,
|
|
15524
|
-
args: [projectId]
|
|
15525
|
-
});
|
|
15526
15522
|
for (const script of scripts) {
|
|
15527
15523
|
await db.execute({
|
|
15528
|
-
sql: `INSERT INTO project_scripts (id, projectId, workspace, name, command, friendlyName, updatedAt)
|
|
15524
|
+
sql: `INSERT OR REPLACE INTO project_scripts (id, projectId, workspace, name, command, friendlyName, updatedAt)
|
|
15529
15525
|
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
15530
15526
|
args: [
|
|
15531
15527
|
randomUUID9(),
|
|
@@ -15636,9 +15632,8 @@ async function resolvePackageJsonWorkspaces(projectPath) {
|
|
|
15636
15632
|
for (const folder of folders) {
|
|
15637
15633
|
const absPath = join22(projectPath, folder);
|
|
15638
15634
|
if (existsSync14(join22(absPath, "package.json"))) {
|
|
15639
|
-
const wsPkg = await readPackageJson(absPath);
|
|
15640
15635
|
workspaces.push({
|
|
15641
|
-
name:
|
|
15636
|
+
name: basename4(folder),
|
|
15642
15637
|
folder: absPath,
|
|
15643
15638
|
relativePath: folder
|
|
15644
15639
|
});
|
|
@@ -15795,9 +15790,8 @@ async function resolveFolderWorkspaces(projectPath) {
|
|
|
15795
15790
|
const folders = await detectFolderBasedWorkspaces(projectPath);
|
|
15796
15791
|
const workspaces = [];
|
|
15797
15792
|
for (const folder of folders) {
|
|
15798
|
-
const wsPkg = await readPackageJson(folder.absPath);
|
|
15799
15793
|
workspaces.push({
|
|
15800
|
-
name:
|
|
15794
|
+
name: folder.name,
|
|
15801
15795
|
folder: folder.absPath,
|
|
15802
15796
|
relativePath: folder.name
|
|
15803
15797
|
});
|
|
@@ -17611,111 +17605,19 @@ import { existsSync as existsSync17 } from "fs";
|
|
|
17611
17605
|
init_utils();
|
|
17612
17606
|
import { existsSync as existsSync16, readFileSync as readFileSync5, statSync as statSync4 } from "fs";
|
|
17613
17607
|
import { isAbsolute as isAbsolute3, normalize as normalize2, resolve as resolve3, join as join27 } from "path";
|
|
17614
|
-
import {
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
17620
|
-
|
|
17621
|
-
|
|
17622
|
-
groq: "groq",
|
|
17623
|
-
cerebras: "cerebras",
|
|
17624
|
-
xai: "xai",
|
|
17625
|
-
openrouter: "openrouter",
|
|
17626
|
-
"github copilot": "github-copilot",
|
|
17627
|
-
minimax: "minimax",
|
|
17628
|
-
"kimi coding plan": "kimi-coding",
|
|
17629
|
-
"hugging face": "huggingface",
|
|
17630
|
-
codex: "openai-codex",
|
|
17631
|
-
mistral: "mistral"
|
|
17632
|
-
};
|
|
17633
|
-
var DEFAULT_MODEL_MAP = {
|
|
17634
|
-
Anthropic: "claude-3-5-sonnet-20241022",
|
|
17635
|
-
OpenAI: "gpt-4o-mini",
|
|
17636
|
-
OpenRouter: "anthropic/claude-3.5-sonnet",
|
|
17637
|
-
Groq: "llama-3.3-70b-versatile",
|
|
17638
|
-
DeepSeek: "deepseek-chat"
|
|
17639
|
-
};
|
|
17640
|
-
function resolveModelForGit(providerName, modelId, apiUrl) {
|
|
17641
|
-
const piProvider = PROVIDER_NAME_TO_PI2[providerName.toLowerCase()];
|
|
17642
|
-
if (piProvider) {
|
|
17643
|
-
try {
|
|
17644
|
-
return getModel2(piProvider, modelId);
|
|
17645
|
-
} catch {
|
|
17646
|
-
}
|
|
17647
|
-
}
|
|
17648
|
-
if (!apiUrl) throw new Error(`No API URL configured for provider: ${providerName}`);
|
|
17649
|
-
const apiType = apiUrl.includes("/anthropic/") || apiUrl.includes("api.anthropic.com") ? "anthropic-messages" : "openai-completions";
|
|
17650
|
-
return {
|
|
17651
|
-
id: modelId,
|
|
17652
|
-
name: modelId,
|
|
17653
|
-
api: apiType,
|
|
17654
|
-
provider: providerName.toLowerCase(),
|
|
17655
|
-
baseUrl: apiUrl,
|
|
17656
|
-
reasoning: false,
|
|
17657
|
-
input: ["text"],
|
|
17658
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
17659
|
-
contextWindow: 128e3,
|
|
17660
|
-
maxTokens: 16384
|
|
17661
|
-
};
|
|
17662
|
-
}
|
|
17663
|
-
async function getAllProviders() {
|
|
17664
|
-
const catalog = await getModelsCatalog();
|
|
17665
|
-
if (!catalog) return [];
|
|
17666
|
-
return Object.values(catalog);
|
|
17667
|
-
}
|
|
17668
|
-
async function findProviderByName(name) {
|
|
17669
|
-
const providers = await getAllProviders();
|
|
17670
|
-
return providers.find((p) => p.name.toLowerCase() === name.toLowerCase()) ?? null;
|
|
17671
|
-
}
|
|
17672
|
-
async function overlayCatalogApi(prov) {
|
|
17673
|
-
return prov;
|
|
17674
|
-
}
|
|
17675
|
-
async function resolveProviderAndKey(metadataProviderKeys, preferredProvider) {
|
|
17676
|
-
if (preferredProvider) {
|
|
17677
|
-
const prov = await findProviderByName(preferredProvider);
|
|
17678
|
-
if (prov) {
|
|
17679
|
-
const envKey = prov.env.length > 0 ? prov.env[0] : void 0;
|
|
17680
|
-
const key = envKey && process.env[envKey] ? process.env[envKey] : metadataProviderKeys[prov.name] ?? (() => {
|
|
17681
|
-
const foundKey = Object.keys(metadataProviderKeys).find(
|
|
17682
|
-
(k) => k.toLowerCase() === prov.name.toLowerCase()
|
|
17683
|
-
);
|
|
17684
|
-
return foundKey ? metadataProviderKeys[foundKey] : void 0;
|
|
17685
|
-
})();
|
|
17686
|
-
if (key) return { provider: await overlayCatalogApi(prov), apiKey: key };
|
|
17687
|
-
}
|
|
17688
|
-
}
|
|
17689
|
-
const providerPriority = ["Anthropic", "OpenAI", "OpenRouter", "Groq", "DeepSeek"];
|
|
17690
|
-
for (const name of providerPriority) {
|
|
17691
|
-
const prov = await findProviderByName(name);
|
|
17692
|
-
if (prov && prov.env.length > 0) {
|
|
17693
|
-
const envKey = process.env[prov.env[0]];
|
|
17694
|
-
if (envKey) return { provider: await overlayCatalogApi(prov), apiKey: envKey };
|
|
17695
|
-
}
|
|
17696
|
-
}
|
|
17697
|
-
for (const name of providerPriority) {
|
|
17698
|
-
const prov = await findProviderByName(name);
|
|
17699
|
-
if (prov && metadataProviderKeys[prov.name]) {
|
|
17700
|
-
return { provider: await overlayCatalogApi(prov), apiKey: metadataProviderKeys[prov.name] };
|
|
17701
|
-
}
|
|
17702
|
-
}
|
|
17703
|
-
const allProviders = await getAllProviders();
|
|
17704
|
-
for (const prov of allProviders) {
|
|
17705
|
-
if (prov.api && prov.env.length > 0) {
|
|
17706
|
-
const envKey = process.env[prov.env[0]];
|
|
17707
|
-
if (envKey) return { provider: await overlayCatalogApi(prov), apiKey: envKey };
|
|
17708
|
-
const metadataKey = Object.keys(metadataProviderKeys).find(
|
|
17709
|
-
(k) => k.toLowerCase() === prov.name.toLowerCase()
|
|
17710
|
-
);
|
|
17711
|
-
if (metadataKey)
|
|
17712
|
-
return {
|
|
17713
|
-
provider: await overlayCatalogApi(prov),
|
|
17714
|
-
apiKey: metadataProviderKeys[metadataKey]
|
|
17715
|
-
};
|
|
17716
|
-
}
|
|
17608
|
+
import { completeSimple } from "@mariozechner/pi-ai";
|
|
17609
|
+
async function resolveModelAndKey(provider, modelId, metadataManager) {
|
|
17610
|
+
const providerConfig = await resolveProviderConfig(provider);
|
|
17611
|
+
if (!providerConfig) return null;
|
|
17612
|
+
let apiKey = providerConfig.env && providerConfig.env.length > 0 ? process.env[providerConfig.env[0]] : void 0;
|
|
17613
|
+
if (!apiKey) {
|
|
17614
|
+
const providerKeys = await metadataManager.getProviderKeys();
|
|
17615
|
+
apiKey = providerKeys[providerConfig.id];
|
|
17717
17616
|
}
|
|
17718
|
-
return null;
|
|
17617
|
+
if (!apiKey) return null;
|
|
17618
|
+
const cleanModelId = modelId.replace(`${provider.toLowerCase()}/`, "");
|
|
17619
|
+
const resolvedModel = resolveModel(provider, cleanModelId, providerConfig);
|
|
17620
|
+
return { model: resolvedModel, apiKey };
|
|
17719
17621
|
}
|
|
17720
17622
|
async function generatePRInfoWithAI(commitLog, detailedCommits, diff, currentBranch, baseBranch, metadataManager, model, provider) {
|
|
17721
17623
|
let promptContent;
|
|
@@ -17751,29 +17653,21 @@ Generate the response in this exact format:
|
|
|
17751
17653
|
TITLE: <title here>
|
|
17752
17654
|
DESCRIPTION: <description here>`;
|
|
17753
17655
|
try {
|
|
17754
|
-
|
|
17755
|
-
|
|
17656
|
+
if (!provider || !model) {
|
|
17657
|
+
console.log(`[pr-generation] Missing provider or model`);
|
|
17658
|
+
return { title: "Update", description: "" };
|
|
17659
|
+
}
|
|
17660
|
+
const resolved = await resolveModelAndKey(provider, model, metadataManager);
|
|
17756
17661
|
if (!resolved) {
|
|
17757
|
-
const errorMsg =
|
|
17662
|
+
const errorMsg = `AI provider "${provider}" is specified but no API key is configured. Please add the API key in settings.`;
|
|
17758
17663
|
console.log(`[pr-generation] ${errorMsg}`);
|
|
17759
17664
|
return { title: "Update", description: "" };
|
|
17760
17665
|
}
|
|
17761
|
-
let selectedModel = model;
|
|
17762
|
-
if (selectedModel) {
|
|
17763
|
-
selectedModel = selectedModel.replace(`${resolved.provider.name.toLowerCase()}/`, "");
|
|
17764
|
-
} else {
|
|
17765
|
-
selectedModel = DEFAULT_MODEL_MAP[resolved.provider.name] || "default";
|
|
17766
|
-
}
|
|
17767
|
-
const resolvedModel = resolveModelForGit(
|
|
17768
|
-
resolved.provider.name,
|
|
17769
|
-
selectedModel,
|
|
17770
|
-
resolved.provider.api
|
|
17771
|
-
);
|
|
17772
17666
|
console.log(
|
|
17773
|
-
`[pr-generation] Using model: ${
|
|
17667
|
+
`[pr-generation] Using model: ${resolved.model.id} provider: ${provider}. key: ${resolved.apiKey ? "exists" : "undefined"} prompt length: ${prompt.length}`
|
|
17774
17668
|
);
|
|
17775
17669
|
const response = await completeSimple(
|
|
17776
|
-
|
|
17670
|
+
resolved.model,
|
|
17777
17671
|
{
|
|
17778
17672
|
messages: [{ role: "user", content: prompt, timestamp: Date.now() }]
|
|
17779
17673
|
},
|
|
@@ -17806,30 +17700,24 @@ ${truncatedDiff}
|
|
|
17806
17700
|
|
|
17807
17701
|
Generate only the commit message, nothing else:`;
|
|
17808
17702
|
try {
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
if (!resolved) {
|
|
17812
|
-
const errorMsg = provider ? `AI provider "${provider}" is specified but no API key is configured. Please add the API key in settings.` : `No AI provider configured. Please configure a provider in settings.`;
|
|
17703
|
+
if (!provider || !model) {
|
|
17704
|
+
const errorMsg = `No provider or model specified for commit message generation.`;
|
|
17813
17705
|
process.stdout.write(`[generate-commit-message] ${errorMsg}
|
|
17814
17706
|
`);
|
|
17815
17707
|
return `AI Error: ${errorMsg}`;
|
|
17816
17708
|
}
|
|
17817
|
-
|
|
17818
|
-
if (
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17709
|
+
const resolved = await resolveModelAndKey(provider, model, metadataManager);
|
|
17710
|
+
if (!resolved) {
|
|
17711
|
+
const errorMsg = `AI provider "${provider}" is specified but no API key is configured. Please add the API key in settings.`;
|
|
17712
|
+
process.stdout.write(`[generate-commit-message] ${errorMsg}
|
|
17713
|
+
`);
|
|
17714
|
+
return `AI Error: ${errorMsg}`;
|
|
17822
17715
|
}
|
|
17823
|
-
const resolvedModel = resolveModelForGit(
|
|
17824
|
-
resolved.provider.name,
|
|
17825
|
-
selectedModel,
|
|
17826
|
-
resolved.provider.api
|
|
17827
|
-
);
|
|
17828
17716
|
console.log(
|
|
17829
|
-
`[generate-commit-message] Using model: ${
|
|
17717
|
+
`[generate-commit-message] Using model: ${resolved.model.id} provider: ${provider}. key: ${resolved.apiKey ? "exists" : "undefined"} prompt: ${prompt}`
|
|
17830
17718
|
);
|
|
17831
17719
|
const response = await completeSimple(
|
|
17832
|
-
|
|
17720
|
+
resolved.model,
|
|
17833
17721
|
{
|
|
17834
17722
|
messages: [{ role: "user", content: prompt, timestamp: Date.now() }]
|
|
17835
17723
|
},
|
|
@@ -18735,11 +18623,12 @@ async function gitGenerateCommitMessageHandler(c, metadataManager) {
|
|
|
18735
18623
|
process.stdout.write("[generate-commit-message] thread path missing\n");
|
|
18736
18624
|
return c.json({ error: "Thread path not found" }, 404);
|
|
18737
18625
|
}
|
|
18738
|
-
const
|
|
18626
|
+
const body = await c.req.json().catch(() => ({}));
|
|
18627
|
+
const provider = body.provider ?? thread.modelProvider;
|
|
18739
18628
|
if (!provider) {
|
|
18740
|
-
throw new Error("Provider not found in thread metadata
|
|
18629
|
+
throw new Error("Provider not found in request or thread metadata");
|
|
18741
18630
|
}
|
|
18742
|
-
const model = thread.model;
|
|
18631
|
+
const model = body.model ?? thread.model;
|
|
18743
18632
|
const absolutePath = resolveThreadPath(repoPath);
|
|
18744
18633
|
process.stdout.write(`[generate-commit-message] resolved path: ${absolutePath}
|
|
18745
18634
|
`);
|
|
@@ -18952,19 +18841,20 @@ async function gitGeneratePrInfoHandler(c, metadataManager) {
|
|
|
18952
18841
|
console.log(`[pr-generation] Thread path not found for threadId: ${threadId}`);
|
|
18953
18842
|
return c.json({ error: "Thread path not found" }, 404);
|
|
18954
18843
|
}
|
|
18955
|
-
const
|
|
18844
|
+
const body = await c.req.json().catch(() => ({}));
|
|
18845
|
+
const provider = body.provider ?? thread.modelProvider;
|
|
18956
18846
|
if (!provider) {
|
|
18957
|
-
console.log(`[pr-generation] \u2717 Provider not found in thread metadata`);
|
|
18847
|
+
console.log(`[pr-generation] \u2717 Provider not found in request or thread metadata`);
|
|
18958
18848
|
return c.json(
|
|
18959
18849
|
{
|
|
18960
18850
|
title: "Update",
|
|
18961
18851
|
description: "",
|
|
18962
|
-
error: "Provider not found in thread metadata"
|
|
18852
|
+
error: "Provider not found in request or thread metadata"
|
|
18963
18853
|
},
|
|
18964
18854
|
400
|
|
18965
18855
|
);
|
|
18966
18856
|
}
|
|
18967
|
-
const model = thread.model;
|
|
18857
|
+
const model = body.model ?? thread.model;
|
|
18968
18858
|
console.log(`[pr-generation] Using provider: ${provider}, model: ${model}`);
|
|
18969
18859
|
const absolutePath = resolveThreadPath(repoPath);
|
|
18970
18860
|
console.log(`[pr-generation] Resolved path: ${absolutePath}`);
|
|
@@ -20042,7 +19932,26 @@ function stashWithLabel(gitRoot, label) {
|
|
|
20042
19932
|
}
|
|
20043
19933
|
proc.on("close", (code) => {
|
|
20044
19934
|
if (code === 0) {
|
|
20045
|
-
|
|
19935
|
+
const nothingSaved = out.includes("No local changes to save");
|
|
19936
|
+
if (nothingSaved) {
|
|
19937
|
+
resolve6(false);
|
|
19938
|
+
return;
|
|
19939
|
+
}
|
|
19940
|
+
const apply = spawnProcess("git", ["stash", "apply", "--index"], { cwd: gitRoot });
|
|
19941
|
+
let applyErr = "";
|
|
19942
|
+
if (apply.stderr) {
|
|
19943
|
+
apply.stderr.on("data", (d) => {
|
|
19944
|
+
applyErr += d.toString();
|
|
19945
|
+
});
|
|
19946
|
+
}
|
|
19947
|
+
apply.on("close", (applyCode) => {
|
|
19948
|
+
if (applyCode === 0) {
|
|
19949
|
+
resolve6(true);
|
|
19950
|
+
} else {
|
|
19951
|
+
reject(new Error(applyErr || "Failed to re-apply stash after checkpoint"));
|
|
19952
|
+
}
|
|
19953
|
+
});
|
|
19954
|
+
apply.on("error", reject);
|
|
20046
19955
|
} else {
|
|
20047
19956
|
reject(new Error(err || "Failed to create checkpoint"));
|
|
20048
19957
|
}
|
|
@@ -20758,17 +20667,21 @@ Return ONLY the title text, nothing else.
|
|
|
20758
20667
|
|
|
20759
20668
|
Todo description: ${description}`;
|
|
20760
20669
|
try {
|
|
20761
|
-
const
|
|
20762
|
-
|
|
20670
|
+
const DEFAULT_MODELS = {
|
|
20671
|
+
anthropic: "claude-3-5-sonnet-20241022",
|
|
20672
|
+
openai: "gpt-4o-mini",
|
|
20673
|
+
openrouter: "anthropic/claude-3.5-sonnet",
|
|
20674
|
+
groq: "llama-3.3-70b-versatile",
|
|
20675
|
+
deepseek: "deepseek-chat"
|
|
20676
|
+
};
|
|
20677
|
+
let resolved = null;
|
|
20678
|
+
for (const [slug, defaultModel] of Object.entries(DEFAULT_MODELS)) {
|
|
20679
|
+
resolved = await resolveModelAndKey(slug, defaultModel, metadataManager);
|
|
20680
|
+
if (resolved) break;
|
|
20681
|
+
}
|
|
20763
20682
|
if (!resolved) return description.slice(0, 60);
|
|
20764
|
-
const selectedModel = DEFAULT_MODEL_MAP[resolved.provider.name] || "default";
|
|
20765
|
-
const resolvedModel = resolveModelForGit(
|
|
20766
|
-
resolved.provider.name,
|
|
20767
|
-
selectedModel,
|
|
20768
|
-
resolved.provider.api
|
|
20769
|
-
);
|
|
20770
20683
|
const response = await completeSimple2(
|
|
20771
|
-
|
|
20684
|
+
resolved.model,
|
|
20772
20685
|
{
|
|
20773
20686
|
messages: [{ role: "user", content: prompt, timestamp: Date.now() }]
|
|
20774
20687
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bi as t,Cr as n,Gt as r,Pn as i,Wn as a,Z as o,ca as s,ea as c,fi as l,ua as u}from"./dialogs-config-Dwpv4SNp.js";import{t as d}from"./use-toast-rlEtMnzM.js";var f=e(u(),1),p=s(),m=n();function h(e){let t=(0,p.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,m.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function g(){let[e,n]=(0,f.useState)(null),[a,s]=(0,f.useState)(!0);(0,f.useEffect)(()=>{u();let e=()=>{document.visibilityState===`visible`&&u()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function u(){s(!0);try{n(await o())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{s(!1)}}function p(){r(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){r(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(a)return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(h,{className:`h-8 w-32 mb-2`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsx)(h,{className:`h-4 w-20`}),(0,m.jsx)(h,{className:`h-9 w-28`})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsx)(h,{className:`h-6 w-32`}),(0,m.jsx)(h,{className:`h-4 w-full`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-28`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsx)(h,{className:`h-9 w-28 shrink-0`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-36`}),(0,m.jsx)(h,{className:`h-4 w-56`}),(0,m.jsx)(h,{className:`h-4 w-32`})]}),(0,m.jsx)(h,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(l,{className:`h-4 w-4`}),`Balance`]}),(0,m.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,m.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(t,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(i,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(t,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(c,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(c,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(i,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Fn as n,Wn as r,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Fn as n,Wn as r,ca as i,ua as a}from"./dialogs-config-Dwpv4SNp.js";import{at as o,ct as s,it as c,lt as l,ot as u,rt as d,st as f,ut as p}from"./react-vendor-CYvpNUsM.js";var m=i(),h=e(a(),1),g=t(),_=l,v=s,y=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(f,{className:o,...a,ref:t}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});y.displayName=f.displayName;var b=h.forwardRef((e,t)=>{let n=(0,m.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,g.jsx)(y,{}),n[3]=s):s=n[3];let c;n[4]===i?c=n[5]:(c=r(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,i),n[4]=i,n[5]=c);let l;return n[6]!==a||n[7]!==t||n[8]!==c?(l=(0,g.jsxs)(v,{children:[s,(0,g.jsx)(o,{ref:t,className:c,...a})]}),n[6]=a,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});b.displayName=o.displayName;var x=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};x.displayName=`AlertDialogHeader`;var S=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};S.displayName=`AlertDialogFooter`;var C=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-lg font-semibold`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(p,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});C.displayName=p.displayName;var w=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-sm text-muted-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(u,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});w.displayName=u.displayName;var T=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n(),a),i[3]=a,i[4]=s);let c;return i[5]!==o||i[6]!==t||i[7]!==s?(c=(0,g.jsx)(d,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=c):c=i[8],c});T.displayName=d.displayName;var E=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n({variant:`outline`}),`mt-2 sm:mt-0`,a),i[3]=a,i[4]=s);let l;return i[5]!==o||i[6]!==t||i[7]!==s?(l=(0,g.jsx)(c,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=l):l=i[8],l});E.displayName=c.displayName;export{w as a,C as c,b as i,T as n,S as o,E as r,x as s,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-
|
|
1
|
+
import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-Dwpv4SNp.js";async function s(t,n){return o(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function c(t,n){return o(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(n)}`)}async function l(t,n,i){return r(`api/threads/${e(t)}/ai-file`,{path:n,content:i})}async function u(t,n){return i(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(t,r,i){return n(`api/threads/${e(t)}/explorer`,{path:r,newName:i})}async function f(n,r,i){return t(`api/threads/${e(n)}/explorer/file`,{dirPath:r,name:i})}function p(t,n){return`${a()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(n)}`}async function m(n,r,i){return t(`api/threads/${e(n)}/explorer/folder`,{dirPath:r,name:i})}export{p as a,l as c,c as i,m as n,s as o,u as r,d as s,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Li as r,Rr as i,Wr as a,Xr as o,ca as s,si as c,ua as l}from"./dialogs-config-Dwpv4SNp.js";import{a as u}from"./store-Cn1lT5YJ.js";import{n as d}from"./tab-context-COCYkRNN.js";import{t as f}from"./run-stop-button-1ECLRujs.js";var p=s(),m=e(l(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:s}=d(),{state:l}=u(),{selectedProjectId:g,projects:_}=l,v;if(e[0]!==_||e[1]!==g){let t;e[3]===g?t=e[4]:(t=e=>e.projectId===g,e[3]=g,e[4]=t),v=_.find(t),e[0]=_,e[1]=g,e[2]=v}else v=e[2];let y=v,[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`desktop`),E=(0,m.useRef)(null),D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{C(``),x(``),E.current&&(E.current.src=``)},e[5]=D):D=e[5];let O;e[6]===s?O=e[7]:(O=[s],e[6]=s,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===t?(k=e[9],A=e[10]):(k=()=>{t&&(x(t),C(t))},A=[t],e[8]=t,e[9]=k,e[10]=A),(0,m.useEffect)(k,A);let j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),x(t),C(t))},e[11]=j):j=e[11];let M=j,N;e[12]===b?N=e[13]:(N=e=>{e.key===`Enter`&&M(b)},e[12]=b,e[13]=N);let P=N,F;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{if(E.current){let e=E.current.src;E.current.src=``,setTimeout(()=>{E.current&&(E.current.src=e)},0)}},e[14]=F):F=e[14];let I=F,L;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(L={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}},e[15]=L):L=e[15];let R=L[w],z;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x(e.target.value),e[16]=z):z=e[16];let B;e[17]!==P||e[18]!==b?(B=(0,h.jsx)(`input`,{type:`text`,value:b,onChange:z,onKeyDown:P,placeholder:`Enter URL...`,className:`flex-1 px-4 py-1.5 text-sm bg-muted rounded-full border border-border outline-none focus:ring-1 focus:ring-ring font-mono`,spellCheck:!1}),e[17]=P,e[18]=b,e[19]=B):B=e[19];let V;e[20]===S?V=e[21]:(V=S&&(0,h.jsx)(`button`,{onClick:I,title:`Refresh page`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(o,{size:15})}),e[20]=S,e[21]=V);let H;e[22]!==w||e[23]!==S?(H=S&&(0,h.jsxs)(`div`,{className:`flex items-center bg-muted rounded-md p-0.5`,children:[(0,h.jsx)(`button`,{onClick:()=>T(`desktop`),title:`Desktop view`,className:`p-1.5 rounded transition-colors ${w===`desktop`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(c,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`tablet`),title:`Tablet view`,className:`p-1.5 rounded transition-colors ${w===`tablet`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(i,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`mobile`),title:`Mobile view`,className:`p-1.5 rounded transition-colors ${w===`mobile`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(a,{size:15})})]}),e[22]=w,e[23]=S,e[24]=H):H=e[24];let U;e[25]===S?U=e[26]:(U=S&&(0,h.jsx)(`button`,{onClick:()=>void n(S),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(r,{size:15})}),e[25]=S,e[26]=U);let W;e[27]!==B||e[28]!==V||e[29]!==H||e[30]!==U?(W=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[B,V,H,U]}),e[27]=B,e[28]=V,e[29]=H,e[30]=U,e[31]=W):W=e[31];let G;e[32]!==R||e[33]!==w||e[34]!==S||e[35]!==y||e[36]!==g?(G=S?(0,h.jsx)(`div`,{className:`flex-1 flex items-center justify-center bg-background`,children:w===`desktop`?(0,h.jsx)(`iframe`,{ref:E,src:S,className:`flex-1 w-full h-full border-none`,title:`Browser`}):(0,h.jsx)(`div`,{className:`bg-white border border-border rounded-lg shadow-lg overflow-hidden transition-all duration-200`,style:{width:R.width,height:R.height,maxWidth:`100%`,maxHeight:`100%`},children:(0,h.jsx)(`iframe`,{ref:E,src:S,className:`w-full h-full border-none`,title:`Browser`})})}):(0,h.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-6 text-muted-foreground`,children:g&&y?.runCommand?(0,h.jsx)(f,{projectId:g,runCommand:y.runCommand,large:!0}):(0,h.jsx)(`p`,{className:`text-sm`,children:`Enter a URL to browse`})}),e[32]=R,e[33]=w,e[34]=S,e[35]=y,e[36]=g,e[37]=G):G=e[37];let K;return e[38]!==W||e[39]!==G?(K=(0,h.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[W,G]}),e[38]=W,e[39]=G,e[40]=K):K=e[40],K}export{g as BrowserTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,Ai as n,Cr as r,D as i,Ei as a,Jr as o,Lr as s,Ni as c,Nr as l,Or as u,Pi as d,Pn as f,Q as p,Qr as m,Si as h,Tn as g,Tt as _,Vr as v,Wn as y,Xi as b,Y as x,Yt as S,_i as C,bi as w,bn as T,ca as E,cn as D,d as O,di as k,ea as A,fn as j,ia as M,jt as N,kr as P,kt as F,m as I,nt as L,on as ee,pn as te,ti as ne,tt as re,ua as R,ui as ie,w as z,xn as B,y as V}from"./dialogs-config-Dwpv4SNp.js";import{gt as H}from"./react-vendor-CYvpNUsM.js";import{a as U,l as W,s as G,t as K,u as q}from"./store-Cn1lT5YJ.js";import{c as J,s as Y,u as ae}from"./history-view-BvAOaO8q.js";import{a as oe,c as se,i as ce,o as le,s as ue,t as de}from"./alert-dialog-BeLER45U.js";import{n as X}from"./tab-context-COCYkRNN.js";import{r as fe}from"./onboarding-vGz3IczM.js";var Z=E(),Q=e(R(),1),$=r();function pe(e){let t=(0,Z.c)(24),{node:n,level:r,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l}=e,u=!!(n.children&&n.children.length>0),d=c[n.id]??a,f;t[0]!==n.id||t[1]!==l?(f=()=>l(n.id),t[0]=n.id,t[1]=l,t[2]=f):f=t[2];let p=f,m;t[3]!==u||t[4]!==d||t[5]!==r||t[6]!==n||t[7]!==i||t[8]!==p?(m=i(n,{isOpen:d,level:r,toggle:p,hasChildren:u}),t[3]=u,t[4]=d,t[5]=r,t[6]=n,t[7]=i,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==s||t[11]!==a||t[12]!==u||t[13]!==o||t[14]!==d||t[15]!==r||t[16]!==n.children||t[17]!==l||t[18]!==c||t[19]!==i?(h=u&&d&&(0,$.jsx)(`div`,{style:{paddingLeft:o},className:s,children:n.children.map(e=>(0,$.jsx)(pe,{node:e,level:r+1,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l},e.id))}),t[10]=s,t[11]=a,t[12]=u,t[13]=o,t[14]=d,t[15]=r,t[16]=n.children,t[17]=l,t[18]=c,t[19]=i,t[20]=h):h=t[20];let g;return t[21]!==m||t[22]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[21]=m,t[22]=h,t[23]=g):g=t[23],g}function me(e){let t=(0,Z.c)(23),{nodes:n,renderNode:r,resetKey:i,defaultOpen:a,indent:o,childContainerClassName:s,className:c}=e,l=a===void 0?!1:a,u=o===void 0?16:o,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Q.useState)(d),[m,h]=(0,Q.useState)(i);i!==m&&(h(i),p({}));let g;t[1]===l?g=t[2]:(g=e=>{p(t=>({...t,[e]:!(t[e]??l)}))},t[1]=l,t[2]=g);let _=g,v;t[3]===c?v=t[4]:(v=y(`min-w-0`,c),t[3]=c,t[4]=v);let b;if(t[5]!==s||t[6]!==l||t[7]!==_||t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==r){let e;t[13]!==s||t[14]!==l||t[15]!==_||t[16]!==u||t[17]!==f||t[18]!==r?(e=e=>(0,$.jsx)(pe,{node:e,level:0,renderNode:r,defaultOpen:l,indent:u,childContainerClassName:s,openState:f,onToggle:_},e.id),t[13]=s,t[14]=l,t[15]=_,t[16]=u,t[17]=f,t[18]=r,t[19]=e):e=t[19],b=n.map(e),t[5]=s,t[6]=l,t[7]=_,t[8]=u,t[9]=n,t[10]=f,t[11]=r,t[12]=b}else b=t[12];let x;return t[20]!==v||t[21]!==b?(x=(0,$.jsx)(`div`,{className:v,children:b}),t[20]=v,t[21]=b,t[22]=x):x=t[22],x}var he=new Map,ge=new Map;function _e(e){return he.get(e)}function ve(e,t){let n=ge.get(e);return n||(n=new Set,ge.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&ge.delete(e)}}function ye(e){let t=ge.get(e);if(t)for(let e of t)e()}function be(e,t){return async function(n,r){let i=await fetch(e+`/api/browser-js/execute-tool`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({threadId:t,toolName:n,params:r})});if(!i.ok){let e=await i.text();try{let t=JSON.parse(e).error||{};e=t.details||t.message||e}catch{}return{text:null,error:`Tool `+n+` failed: `+e}}let a=await i.json();return{text:a.content&&a.content[0]?a.content[0].text:null,error:null}}}function xe(e,t,n){if(he.has(e))return;he.set(e,{status:`running`}),ye(e);let r=g();(async()=>{try{let i=be(r,n),a=Object.getPrototypeOf(async function(){}).constructor,o=await new a(`callTool`,t)(i),s=o===void 0?null:o;he.set(e,{status:`success`,result:s}),ye(e),await j(e,s)}catch(t){let n=t instanceof Error?t.stack||t.message:String(t);he.set(e,{status:`error`,error:n}),ye(e);try{await j(e,{error:n})}catch(e){console.error(`[browser-js-executor] failed to submit error result`,e)}}})()}var Se=()=>{if(typeof window>`u`)return null;let e=window.SpeechRecognition||window.webkitSpeechRecognition;return e?new e:null};function Ce(){let e=(0,Z.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useRef)(null),u=(0,Q.useRef)(``),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{try{let e=Se();e?(e.continuous=!0,e.interimResults=!0,e.lang=`en-US`,e.onstart=()=>{n(!0),o(null),u.current=``},e.onresult=e=>{let t=``;for(let n=e.resultIndex;n<e.results.length;n++){let r=e.results[n][0].transcript;e.results[n].isFinal?i(e=>e+r+` `):t+=r}u.current=t},e.onerror=e=>{console.error(`Speech recognition error:`,e.error),o(e.error||`An error occurred during speech recognition`)},e.onend=()=>{n(!1)},l.current=e,c(!0)):(c(!1),o(`Speech Recognition API is not supported in your browser`))}catch(e){console.error(`Failed to initialize speech recognition:`,e),c(!1),o(`Failed to initialize speech recognition`)}return()=>{l.current&&l.current.abort()}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=()=>{l.current&&!t&&l.current.start()},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=()=>{l.current&&t&&l.current.stop()},e[4]=t,e[5]=h);let g=h,_;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{i(``),u.current=``},e[6]=_):_=e[6];let v=_,y;return e[7]!==a||e[8]!==t||e[9]!==s||e[10]!==m||e[11]!==g||e[12]!==r?(y={isListening:t,transcript:r,error:a,startListening:m,stopListening:g,resetTranscript:v,isSupported:s},e[7]=a,e[8]=t,e[9]=s,e[10]=m,e[11]=g,e[12]=r,e[13]=y):y=e[13],y}function we({initialValue:e}={}){let{state:n,dispatch:r}=U(),[i,a]=(0,Q.useState)(e??``),[o,s]=(0,Q.useState)(-1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(0),[f,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)(()=>(n.selectedThreadId?n.projectModelSelections[n.selectedThreadId]:void 0)??null),v=(0,Q.useRef)(h?.id??``),y=(0,Q.useRef)(h?.provider??``),b=(0,Q.useRef)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)([]),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)([]),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)([]),[ee,te]=(0,Q.useState)(!1),[ne,R]=(0,Q.useState)(``),[ie,B]=(0,Q.useState)(0),[V,H]=(0,Q.useState)([]),[W,G]=(0,Q.useState)([]),[q,J]=(0,Q.useState)(!1),[Y,ae]=(0,Q.useState)(``),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{v.current=h?.id??``,y.current=h?.provider??``},[h?.id,h?.provider]);let X=(0,Q.useCallback)((e,t)=>{g(e);let i=n.selectedThreadId;if(!i||(r({type:K.SetProjectModel,threadId:i,model:e}),t?.persist===!1))return;let a=`${i}:${e.provider??``}:${e.id}`;b.current!==a&&(b.current=a,console.log(`[useChatInputState] Persisting model to thread:`,{threadId:i,model:{id:e.id,provider:e.provider}}),T(i,{model:e.id,modelProvider:e.provider}).then(()=>{b.current===a&&(b.current=null),console.log(`[useChatInputState] Model persisted successfully`)}).catch(e=>{b.current===a&&(b.current=null),console.error(`Failed to save model to thread:`,e)}))},[n.selectedThreadId,r]);(0,Q.useEffect)(()=>{(async()=>{let e=n.selectedProjectId?n.projects.find(e=>e.projectId===n.selectedProjectId)?.threads.find(e=>e.threadId===n.selectedThreadId):void 0,r=n.selectedThreadId?n.projectModelSelections[n.selectedThreadId]:void 0,i=e?.model??r?.id??null,a=e?.modelProvider??r?.provider??null;console.log(`[useChatInputState] Loading models for thread:`,{threadId:n.selectedThreadId,projectId:n.selectedProjectId,currentThread:e?{model:e.model,modelProvider:e.modelProvider}:void 0,storedModel:r?{id:r.id,provider:r.provider}:void 0,savedModelId:i,savedModelProvider:a});try{let e=await t(),n=Object.values(e).flat();if(n.length===0){m([]),g(null);return}m(n);let r=i&&a?n.find(e=>e.id===i&&e.provider===a)??null:null,o=n[0],s=r??o,c=!r&&!!(i||a),l=v.current===s.id&&y.current===s.provider;console.log(`[useChatInputState] Model selection decision:`,{matchedSavedModel:r?{id:r.id}:null,fallbackModel:{id:o.id},modelToSelect:{id:s.id},shouldPersistFallback:c,hasSameSelection:l,currentSelected:{id:v.current,provider:y.current}}),l||X(s,{persist:c})}catch(e){console.error(`Failed to load enabled models:`,e)}})()},[n.selectedThreadId,n.selectedProjectId,n.projects,X]);let fe=(0,Q.useRef)(X);(0,Q.useEffect)(()=>{fe.current=X},[X]),(0,Q.useEffect)(()=>{n.configUpdatedAt!==0&&(async()=>{try{let e=await t(),n=Object.values(e).flat();if(n.length>0){m(n);let e=v.current,t=y.current;n.some(n=>n.id===e&&n.provider===t)||fe.current(n[0],{persist:!0})}}catch(e){console.error(`Failed to reload enabled models:`,e)}})()},[n.configUpdatedAt]),(0,Q.useEffect)(()=>{!A||M.length>0||(async()=>{try{let e=await p(),t=Object.values(e).flat();t.length>0&&(N(t),F(e=>e??t[0]))}catch(e){console.error(`Failed to load image models:`,e)}})()},[A,M.length]);let[Z,$]=(0,Q.useState)(n.selectedThreadId);return(0,Q.useEffect)(()=>{n.selectedThreadId!==Z&&setTimeout(()=>{$(n.selectedThreadId),L([]),te(!1),H([]),G([]),J(!1),k(!1),j(!1)},0)},[n.selectedThreadId,Z]),(0,Q.useEffect)(()=>{n.selectedThreadId&&_(n.selectedThreadId).then(({commands:e,skills:t})=>{console.log(`Loaded slash commands:`,e,`skills:`,t),H(e),G(t)}).catch(e=>console.error(`Failed to load slash commands and skills:`,e))},[n.selectedThreadId]),(0,Q.useEffect)(()=>{n.focusChatInput&&n.selectedThreadId&&!n.isStreaming&&(se.current?.focus(),r({type:K.ClearFocusChatInput}))},[n.focusChatInput,n.selectedThreadId,n.isStreaming,r]),(0,Q.useEffect)(()=>{let e=e=>{ce.current&&!ce.current.contains(e.target)&&S(!1),le.current&&!le.current.contains(e.target)&&w(!1)};if(x||C)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[x,C]),{message:i,setMessage:a,historyIndex:o,setHistoryIndex:s,draftMessage:c,setDraftMessage:l,cursorPosition:u,setCursorPosition:d,availableModels:f,setAvailableModels:m,selectedModel:h,setSelectedModel:X,selectedModelIdRef:v,showModelMenu:x,setShowModelMenu:S,showPlusMenu:C,setShowPlusMenu:w,attachments:E,setAttachments:D,planMode:O,setPlanMode:k,imageMode:A,setImageMode:j,availableImageModels:M,setAvailableImageModels:N,selectedImageModel:P,setSelectedImageModel:F,allFiles:I,setAllFiles:L,showSuggestions:ee,setShowSuggestions:te,suggestionQuery:ne,setSuggestionQuery:R,selectedIndex:ie,setSelectedIndex:B,slashCommands:V,setSlashCommands:H,skills:W,setSkills:G,showCommandSuggestions:q,setShowCommandSuggestions:J,commandQuery:Y,setCommandQuery:ae,fileInputRef:oe,textareaRef:se,modelMenuRef:ce,plusMenuRef:le,suggestionsRef:ue,commandSuggestionsRef:de,handleNewChat:async()=>{if(n.selectedThreadId)try{let e=await z(n.selectedThreadId);r({type:K.ClearMessages}),console.log(`New conversation started:`,e);let t=await re(n.selectedThreadId);r({type:K.SetMessages,messages:t.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},state:n,dispatch:r}}var Te=e=>{O(e)};function Ee(e){let t=(0,Z.c)(99),{message:n,setMessage:r,attachments:i,selectedModel:a,onSend:o,isStreaming:s,selectedThreadId:c,isListening:l,stopListening:u,resetTranscript:d,dispatch:f,historyIndex:p,setHistoryIndex:m,draftMessage:h,setDraftMessage:g,cursorPosition:_,setCursorPosition:v,showSuggestions:y,setShowSuggestions:b,suggestionQuery:x,setSuggestionQuery:S,allFiles:C,setAllFiles:w,selectedIndex:T,setSelectedIndex:E,showCommandSuggestions:D,setShowCommandSuggestions:O,commandQuery:k,setCommandQuery:A,slashCommands:j,skills:M,textareaRef:N,setAttachments:P,planMode:L,setPlanMode:ee,imageMode:te,selectedImageModel:ne}=e,re;t[0]!==i||t[1]!==f||t[2]!==te||t[3]!==l||t[4]!==s||t[5]!==n||t[6]!==o||t[7]!==L||t[8]!==d||t[9]!==ne||t[10]!==a||t[11]!==c||t[12]!==P||t[13]!==g||t[14]!==m||t[15]!==r||t[16]!==u||t[17]!==N?(re=()=>{if(!n.trim()&&i.length===0||!c)return;let e=te?ne:a;e&&(l&&(u(),d()),s?f({type:K.EnqueueChatMessage,message:{id:`queued-${Date.now()}`,threadId:c,message:n,model:e.id,attachments:i,provider:e.provider,planMode:L,imageMode:te}}):o(n,e.id,i,e.provider,L,te),Te(n),r(``),P([]),m(-1),g(``),N.current&&(N.current.style.height=`auto`))},t[0]=i,t[1]=f,t[2]=te,t[3]=l,t[4]=s,t[5]=n,t[6]=o,t[7]=L,t[8]=d,t[9]=ne,t[10]=a,t[11]=c,t[12]=P,t[13]=g,t[14]=m,t[15]=r,t[16]=u,t[17]=N,t[18]=re):re=t[18];let R=re,ie;t[19]!==_||t[20]!==n||t[21]!==r||t[22]!==b||t[23]!==x||t[24]!==N?(ie=e=>{let t=n.substring(0,_-x.length-1);r(`${t}${e} ${n.substring(_)}`),b(!1),setTimeout(()=>{if(N.current){N.current.focus();let n=t.length+e.length+1;N.current.setSelectionRange(n,n)}},0)},t[19]=_,t[20]=n,t[21]=r,t[22]=b,t[23]=x,t[24]=N,t[25]=ie):ie=t[25];let z=ie,B;t[26]!==k||t[27]!==_||t[28]!==n||t[29]!==r||t[30]!==ee||t[31]!==O||t[32]!==N?(B=e=>{let t=n.substring(0,_-k.length-1),i=n.substring(_);r(`${t}${e.content}${i}`),O(!1),setTimeout(()=>{if(N.current){N.current.focus();let n=t.length+e.content.length;N.current.setSelectionRange(n,n)}},0),e.metadata.mode===`plan`&&ee(!0)},t[26]=k,t[27]=_,t[28]=n,t[29]=r,t[30]=ee,t[31]=O,t[32]=N,t[33]=B):B=t[33];let V=B,H;t[34]!==k||t[35]!==_||t[36]!==n||t[37]!==r||t[38]!==O||t[39]!==N?(H=e=>{let t=n.substring(0,_-k.length-1),i=n.substring(_),a=e.name.includes(` `)?`/"${e.name}"`:`/${e.name}`;r(`${t}${a}${i}`),O(!1),setTimeout(()=>{if(N.current){N.current.focus();let e=t.length+a.length;N.current.setSelectionRange(e,e)}},0)},t[34]=k,t[35]=_,t[36]=n,t[37]=r,t[38]=O,t[39]=N,t[40]=H):H=t[40];let U=H,W,G,q,J;if(t[41]!==C||t[42]!==k||t[43]!==h||t[44]!==R||t[45]!==p||t[46]!==V||t[47]!==z||t[48]!==U||t[49]!==n||t[50]!==T||t[51]!==c||t[52]!==w||t[53]!==A||t[54]!==v||t[55]!==g||t[56]!==m||t[57]!==r||t[58]!==E||t[59]!==O||t[60]!==b||t[61]!==S||t[62]!==D||t[63]!==y||t[64]!==M||t[65]!==j||t[66]!==x){q=e=>{if(D){if(e.key===`ArrowDown`){e.preventDefault(),E((T+1)%W.length);return}if(e.key===`ArrowUp`){e.preventDefault(),E((T-1+W.length)%W.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=W[T];t&&(t.type===`command`?V(t.data):U(t.data));return}if(e.key===`Escape`){O(!1);return}}if(y){let t=G.length>0;if(e.key===`ArrowDown`&&t){e.preventDefault(),E((T+1)%G.length);return}if(e.key===`ArrowUp`&&t){e.preventDefault(),E((T-1+G.length)%G.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),G[T]&&z(G[T]);return}if(e.key===`Escape`){b(!1);return}}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),R();return}let t=I();t.length!==0&&(e.key===`ArrowUp`?(e.preventDefault(),p===-1?(g(n),m(t.length-1),r(t[t.length-1])):p>0&&(m(p-1),r(t[p-1]))):e.key===`ArrowDown`&&(e.preventDefault(),p>0?(m(p-1),r(t[p-1])):p===0&&(m(-1),r(h))))};let e;t[71]!==C||t[72]!==c||t[73]!==w||t[74]!==A||t[75]!==v||t[76]!==r||t[77]!==E||t[78]!==O||t[79]!==b||t[80]!==S?(e=e=>{let t=e.target.value,n=e.target.selectionStart;r(t),v(n);let i=t.substring(0,n),a=i.lastIndexOf(`/`);if(a!==-1){let e=a>0?i[a-1]:``;if(a===0||/\s/.test(e)){let e=i.substring(a+1);e.includes(` `)?O(!1):(A(e),O(!0),b(!1),E(0))}else O(!1)}else{O(!1);let e=i.lastIndexOf(`#`);if(e!==-1){let t=e>0?i[e-1]:``;if(e===0||/\s/.test(t)){let t=i.substring(e+1);t.includes(` `)?b(!1):(S(t),b(!0),E(0),C.length===0&&c&&F(c).then(e=>{w(e)}).catch(ke))}else b(!1)}else b(!1)}let o=e.target;o.style.height=`auto`,o.style.height=`${Math.min(o.scrollHeight,160)}px`},t[71]=C,t[72]=c,t[73]=w,t[74]=A,t[75]=v,t[76]=r,t[77]=E,t[78]=O,t[79]=b,t[80]=S,t[81]=e):e=t[81],J=e;let i;if(t[82]!==k||t[83]!==M||t[84]!==j){let e;t[86]===k?e=t[87]:(e=e=>e.name.toLowerCase().includes(k.toLowerCase()),t[86]=k,t[87]=e);let n=j.filter(e),r;t[88]===k?r=t[89]:(r=e=>e.name.toLowerCase().includes(k.toLowerCase()),t[88]=k,t[89]=r);let a=M.filter(r);i=[...n.map(Oe),...a.map(De)],t[82]=k,t[83]=M,t[84]=j,t[85]=i}else i=t[85];W=i.slice(0,10),G=y?C.filter(e=>e.toLowerCase().includes(x.toLowerCase())).slice(0,10):[],t[41]=C,t[42]=k,t[43]=h,t[44]=R,t[45]=p,t[46]=V,t[47]=z,t[48]=U,t[49]=n,t[50]=T,t[51]=c,t[52]=w,t[53]=A,t[54]=v,t[55]=g,t[56]=m,t[57]=r,t[58]=E,t[59]=O,t[60]=b,t[61]=S,t[62]=D,t[63]=y,t[64]=M,t[65]=j,t[66]=x,t[67]=W,t[68]=G,t[69]=q,t[70]=J}else W=t[67],G=t[68],q=t[69],J=t[70];let Y;return t[90]!==W||t[91]!==G||t[92]!==q||t[93]!==R||t[94]!==J||t[95]!==V||t[96]!==z||t[97]!==U?(Y={handleSend:R,handleKeyDown:q,handleTextareaInput:J,insertFileReference:z,insertCommand:V,insertSkill:U,allSuggestions:W,fileSuggestions:G},t[90]=W,t[91]=G,t[92]=q,t[93]=R,t[94]=J,t[95]=V,t[96]=z,t[97]=U,t[98]=Y):Y=t[98],Y}function De(e){return{type:`skill`,data:e}}function Oe(e){return{type:`command`,data:e}}function ke(e){return console.error(`Failed to fetch files:`,e)}function Ae(e){let t=(0,Z.c)(21),{visible:n,commands:r,skills:i,query:a,selectedIndex:o,onSelectCommand:c,onSelectSkill:l,onMouseEnterSuggestion:d,containerRef:f}=e;if(!n)return null;let p;if(t[0]!==r||t[1]!==a||t[2]!==i){let e;t[4]===a?e=t[5]:(e=e=>e.name.toLowerCase().includes(a.toLowerCase()),t[4]=a,t[5]=e);let n=r.filter(e),o;t[6]===a?o=t[7]:(o=e=>e.name.toLowerCase().includes(a.toLowerCase()),t[6]=a,t[7]=o);let s=i.filter(o);p=[...n.map(Me),...s.map(je)].slice(0,10),t[0]=r,t[1]=a,t[2]=i,t[3]=p}else p=t[3];let m=p,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(s,{className:`h-3 w-3`}),t[8]=h):h=t[8];let g=a&&` matching "${a}"`,_;t[9]===g?_=t[10]:(_=(0,$.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border/50 mb-1 flex items-center gap-2`,children:[h,`Commands & Skills`,g]}),t[9]=g,t[10]=_);let v;t[11]!==m||t[12]!==d||t[13]!==c||t[14]!==l||t[15]!==o?(v=m.length>0?m.map((e,t)=>{let n=t===o;if(e.type===`command`){let r=e.data;return(0,$.jsxs)(`button`,{type:`button`,className:y(`flex w-full flex-col gap-1 rounded-lg px-3 py-2 text-left transition-colors`,n?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>c(r),onMouseEnter:()=>d(t),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(s,{className:`h-3 w-3 text-muted-foreground`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),r.metadata.argumentHint&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.argumentHint}),r.scope===`project`&&(0,$.jsx)(`span`,{className:`ml-auto text-[10px] rounded-full bg-primary/10 px-1.5 py-0.5 text-primary`,children:`project`})]}),r.metadata.description&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.description})]},`cmd-${r.name}`)}else{let r=e.data;return(0,$.jsxs)(`button`,{type:`button`,className:y(`flex w-full flex-col gap-1 rounded-lg px-3 py-2 text-left transition-colors`,n?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>l(r),onMouseEnter:()=>d(t),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(u,{className:`h-3 w-3 text-amber-500`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),(0,$.jsx)(`span`,{className:`ml-auto text-[10px] rounded-full bg-amber-500/10 px-1.5 py-0.5 text-amber-700 dark:text-amber-400`,children:`skill`}),r.scope===`project`&&(0,$.jsx)(`span`,{className:`text-[10px] rounded-full bg-primary/10 px-1.5 py-0.5 text-primary`,children:`project`})]}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.description})]},`skill-${r.name}`)}}):(0,$.jsxs)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:[`No commands or skills found.`,(0,$.jsx)(`br`,{}),(0,$.jsxs)(`span`,{className:`text-[10px]`,children:[`Create commands in `,(0,$.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/commands/`}),` or skills in `,(0,$.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/skills/`})]})]}),t[11]=m,t[12]=d,t[13]=c,t[14]=l,t[15]=o,t[16]=v):v=t[16];let b;return t[17]!==f||t[18]!==_||t[19]!==v?(b=(0,$.jsxs)(`div`,{ref:f,className:`absolute bottom-full left-0 mb-2 w-full max-h-64 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50 animate-in fade-in slide-in-from-bottom-2`,children:[_,v]}),t[17]=f,t[18]=_,t[19]=v,t[20]=b):b=t[20],b}function je(e){return{type:`skill`,data:e}}function Me(e){return{type:`command`,data:e}}function Ne(e){return e.startsWith(`image/`)}function Pe(e){let t=(0,Z.c)(7),{attachments:n,onRemove:r}=e;if(n.length===0)return null;let i;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=(e,t)=>(0,$.jsx)(`div`,{className:`group relative flex items-center gap-1 rounded-md bg-muted text-xs text-muted-foreground`,children:Ne(e.mimeType)?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:e.fileName,className:`h-16 w-16 rounded-md object-cover`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-foreground text-background opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,$.jsx)(P,{className:`h-2.5 w-2.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Remove attachment`})]})]}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[(0,$.jsx)(ne,{className:`h-3 w-3`}),e.fileName,(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`ml-1 hover:text-foreground`,children:[(0,$.jsx)(P,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Remove attachment`})]})]})},t),t[3]=r,t[4]=e),i=n.map(e),t[0]=n,t[1]=r,t[2]=i}else i=t[2];let a;return t[5]===i?a=t[6]:(a=(0,$.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:i}),t[5]=i,t[6]=a),a}function Fe(e,t){let n=e.target.files;if(!n||n.length===0)return;let r=Array.from(n),i=r.length,a=Array.from({length:i}),o=0;e.target.value=``,r.forEach((e,n)=>{let r=new FileReader;r.onload=()=>{let s=r.result.split(`,`)[1];a[n]={fileName:e.name,content:s,mimeType:e.type||`application/octet-stream`},o+=1,o===i&&t(a)},r.readAsDataURL(e)})}function Ie(e){let t=(0,Z.c)(16),{showSuggestions:n,fileSuggestions:r,suggestionQuery:i,selectedIndex:a,onSelectFile:s,onMouseEnterSuggestion:l,containerRef:u}=e;if(!n||r.length===0)return null;let f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(o,{className:`h-3 w-3`}),t[0]=f):f=t[0];let p;t[1]===i?p=t[2]:(p=(0,$.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border/50 mb-1 flex items-center gap-2`,children:[f,`Files matching "`,i,`"`]}),t[1]=i,t[2]=p);let m;if(t[3]!==r||t[4]!==l||t[5]!==s||t[6]!==a){let e;t[8]!==l||t[9]!==s||t[10]!==a?(e=(e,t)=>{let n=e.split(`/`).pop()??e;return(0,$.jsxs)(`button`,{type:`button`,className:y(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-left transition-colors`,t===a?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>s(e),onMouseEnter:()=>l(t),children:[e.endsWith(`.ts`)||e.endsWith(`.tsx`)||e.endsWith(`.js`)||e.endsWith(`.jsx`)?(0,$.jsx)(d,{className:`h-4 w-4 text-blue-500`}):(0,$.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}),(0,$.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,$.jsx)(`span`,{className:`truncate font-medium`,children:n}),(0,$.jsx)(`span`,{className:`truncate text-[10px] text-muted-foreground opacity-70`,children:e})]})]},e)},t[8]=l,t[9]=s,t[10]=a,t[11]=e):e=t[11],m=r.map(e),t[3]=r,t[4]=l,t[5]=s,t[6]=a,t[7]=m}else m=t[7];let h;return t[12]!==u||t[13]!==p||t[14]!==m?(h=(0,$.jsxs)(`div`,{ref:u,className:`absolute bottom-full left-0 mb-2 w-full max-h-64 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50 animate-in fade-in slide-in-from-bottom-2`,children:[p,m]}),t[12]=u,t[13]=p,t[14]=m,t[15]=h):h=t[15],h}function Le(e){let t=(0,Z.c)(3),{provider:n}=e;if(!n)return null;let r=`https://models.tarsk.io/svg/${n}.svg`,i=`${n} logo`,a;return t[0]!==r||t[1]!==i?(a=(0,$.jsx)(`img`,{src:r,alt:i,className:`h-3.5 w-3.5 flex-shrink-0`,onError:Re}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function Re(e){e.currentTarget.style.visibility=`hidden`}function ze(e){let t=(0,Z.c)(26),{availableModels:n,selectedModel:r,onModelSelect:i}=e,[a,o]=Q.useState(!1),s=Q.useRef(null),c,l;t[0]===a?(c=t[1],l=t[2]):(c=()=>{let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};if(a)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},l=[a],t[0]=a,t[1]=c,t[2]=l),Q.useEffect(c,l);let u;t[3]===i?u=t[4]:(u=e=>{i(e),o(!1)},t[3]=i,t[4]=u);let d=u,p;t[5]===a?p=t[6]:(p=()=>o(!a),t[5]=a,t[6]=p);let m=r?.provider,h;t[7]===m?h=t[8]:(h=(0,$.jsx)(Le,{provider:m}),t[7]=m,t[8]=h);let g;t[9]===r?g=t[10]:(g=r?fe(r.id):`No model`,t[9]=r,t[10]=g);let _;t[11]===g?_=t[12]:(_=(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:g}),t[11]=g,t[12]=_);let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(b,{className:`h-3 w-3`}),t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==h||t[16]!==_?(y=(0,$.jsxs)(f,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:p,children:[h,_,v]}),t[14]=p,t[15]=h,t[16]=_,t[17]=y):y=t[17];let x;t[18]!==n||t[19]!==d||t[20]!==r?.id||t[21]!==a?(x=a&&(0,$.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 w-80 max-h-80 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:Object.entries(n.reduce(Be,{})).map(e=>{let[t,n]=e;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:[(0,$.jsx)(Le,{provider:t}),t]}),n.map(e=>(0,$.jsx)(`button`,{type:`button`,className:`flex w-full items-center whitespace-nowrap rounded-md px-3 py-1.5 pl-8 text-sm text-popover-foreground hover:bg-accent ${e.id===r?.id?`bg-accent font-medium`:``}`,onClick:()=>d(e),children:fe(e.id)},e.id))]},t)})}),t[18]=n,t[19]=d,t[20]=r?.id,t[21]=a,t[22]=x):x=t[22];let S;return t[23]!==y||t[24]!==x?(S=(0,$.jsxs)(`div`,{className:`relative`,ref:s,children:[y,x]}),t[23]=y,t[24]=x,t[25]=S):S=t[25],S}function Be(e,t){let n=t.provider??`Other`;return e[n]||(e[n]=[]),e[n].push(t),e}var Ve=[{value:`build`,label:`Build`,icon:h},{value:`plan`,label:`Plan`,icon:C},{value:`image`,label:`Image`,icon:w}];function He(e,t){return e?`plan`:t?`image`:`build`}function Ue(e){let t=(0,Z.c)(29),{planMode:n,imageMode:r,setPlanMode:i,setImageMode:a}=e,[o,s]=Q.useState(!1),c=Q.useRef(null),l;t[0]!==r||t[1]!==n?(l=He(n,r),t[0]=r,t[1]=n,t[2]=l):l=t[2];let u=l,d;t[3]===u?d=t[4]:(d=Ve.find(e=>e.value===u),t[3]=u,t[4]=d);let p=d,m=p.icon,h,g;t[5]===o?(h=t[6],g=t[7]):(h=()=>{let e=function(e){c.current&&!c.current.contains(e.target)&&s(!1)};if(o)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},g=[o],t[5]=o,t[6]=h,t[7]=g),Q.useEffect(h,g);let _;t[8]!==a||t[9]!==i?(_=function(e){i(e===`plan`),a(e===`image`),s(!1)},t[8]=a,t[9]=i,t[10]=_):_=t[10];let v=_,y;t[11]===o?y=t[12]:(y=()=>s(!o),t[11]=o,t[12]=y);let x;t[13]===m?x=t[14]:(x=(0,$.jsx)(m,{className:`h-3.5 w-3.5`}),t[13]=m,t[14]=x);let S;t[15]===p.label?S=t[16]:(S=(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:p.label}),t[15]=p.label,t[16]=S);let C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(b,{className:`h-3 w-3`}),t[17]=C):C=t[17];let w;t[18]!==y||t[19]!==x||t[20]!==S?(w=(0,$.jsxs)(f,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:y,children:[x,S,C]}),t[18]=y,t[19]=x,t[20]=S,t[21]=w):w=t[21];let T;t[22]!==u||t[23]!==o||t[24]!==v?(T=o&&(0,$.jsx)(`div`,{className:`absolute bottom-full right-0 mb-1 w-40 rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:Ve.map(e=>{let t=e.icon,n=e.value===u;return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-popover-foreground hover:bg-accent`,onClick:()=>v(e.value),children:[(0,$.jsx)(t,{className:`h-3.5 w-3.5`}),e.label,n&&(0,$.jsx)(A,{className:`ml-auto h-3.5 w-3.5`})]},e.value)})}),t[22]=u,t[23]=o,t[24]=v,t[25]=T):T=t[25];let E;return t[26]!==w||t[27]!==T?(E=(0,$.jsxs)(`div`,{className:`relative`,ref:c,children:[w,T]}),t[26]=w,t[27]=T,t[28]=E):E=t[28],E}function We(e){let t=(0,Z.c)(17),{onFileAttach:n}=e,[r,i]=Q.useState(!1),a=Q.useRef(null),o,s;t[0]===r?(o=t[1],s=t[2]):(o=()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};if(r)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},s=[r],t[0]=r,t[1]=o,t[2]=s),Q.useEffect(o,s);let c;t[3]===n?c=t[4]:(c=function(){n(),i(!1)},t[3]=n,t[4]=c);let l=c,u;t[5]===r?u=t[6]:(u=()=>i(!r),t[5]=r,t[6]=u);let d,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(m,{}),p=(0,$.jsx)(`span`,{className:`sr-only`,children:`More options`}),t[7]=d,t[8]=p):(d=t[7],p=t[8]);let h;t[9]===u?h=t[10]:(h=(0,$.jsxs)(f,{variant:`action`,size:`icon-sm`,onClick:u,children:[d,p]}),t[9]=u,t[10]=h);let g;t[11]!==l||t[12]!==r?(g=r&&(0,$.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 w-48 rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-popover-foreground hover:bg-accent`,onClick:l,children:[(0,$.jsx)(ne,{className:`h-3.5 w-3.5`}),`Attach File`]})}),t[11]=l,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==h||t[15]!==g?(_=(0,$.jsxs)(`div`,{className:`relative`,ref:a,children:[h,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16],_}function Ge(e){let t=(0,Z.c)(14),{onToggleSpeech:n}=e,{isListening:r,isSupported:i}=Ce();if(!i)return null;let a=r?`bg-red-500/20 text-red-500 hover:bg-red-500/30`:`text-muted-foreground hover:text-background`,o;t[0]===r?o=t[1]:(o=r?(0,$.jsx)(k,{}):(0,$.jsx)(ie,{}),t[0]=r,t[1]=o);let s=r?`Stop listening`:`Start listening`,c;t[2]===s?c=t[3]:(c=(0,$.jsx)(`span`,{className:`sr-only`,children:s}),t[2]=s,t[3]=c);let l;t[4]!==n||t[5]!==a||t[6]!==o||t[7]!==c?(l=(0,$.jsx)(ae,{asChild:!0,children:(0,$.jsxs)(f,{variant:`ghost`,size:`icon-sm`,className:a,onClick:n,children:[o,c]})}),t[4]=n,t[5]=a,t[6]=o,t[7]=c,t[8]=l):l=t[8];let u=r?`Stop listening`:`Start listening`,d;t[9]===u?d=t[10]:(d=(0,$.jsx)(J,{side:`top`,className:`bg-popover text-popover-foreground`,children:u}),t[9]=u,t[10]=d);let p;return t[11]!==l||t[12]!==d?(p=(0,$.jsxs)(Y,{children:[l,d]}),t[11]=l,t[12]=d,t[13]=p):p=t[13],p}function Ke(e){let t=(0,Z.c)(8),{queuedMessages:n,onRemoveQueuedMessage:r}=e;if(n.length===0)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Queued messages`}),t[0]=i):i=t[0];let a;if(t[1]!==r||t[2]!==n){let e;t[4]===r?e=t[5]:(e=e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border/60 bg-background px-3 py-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1 whitespace-pre-wrap text-foreground`,children:e.message}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-full p-1 text-muted-foreground transition-colors hover:bg-foreground hover:text-background`,onClick:()=>r(e.id),"aria-label":`Remove queued message`,children:(0,$.jsx)(P,{className:`h-3.5 w-3.5`})})]},e.id),t[4]=r,t[5]=e),a=n.map(e),t[1]=r,t[2]=n,t[3]=a}else a=t[3];let o;return t[6]===a?o=t[7]:(o=(0,$.jsxs)(`div`,{className:`mb-3 rounded-lg border border-border/60 bg-muted/30 px-4 py-3`,children:[i,(0,$.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:a})]}),t[6]=a,t[7]=o),o}function qe(e){let t=(0,Z.c)(141),{onSend:n,onStop:r,isStreaming:i,disabled:a,initialValue:o,queuedMessages:s,onRemoveQueuedMessage:c,isOverlay:u}=e,d=i===void 0?!1:i,p=u===void 0?!1:u,{isListening:m,transcript:h,startListening:g,stopListening:_,resetTranscript:y}=Ce(),b;t[0]===o?b=t[1]:(b={initialValue:o},t[0]=o,t[1]=b);let{message:x,setMessage:S,historyIndex:C,setHistoryIndex:w,draftMessage:T,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,availableModels:k,selectedModel:A,setSelectedModel:j,attachments:N,setAttachments:P,planMode:F,setPlanMode:I,imageMode:L,setImageMode:ee,availableImageModels:te,selectedImageModel:ne,setSelectedImageModel:re,allFiles:R,setAllFiles:ie,showSuggestions:z,setShowSuggestions:B,suggestionQuery:V,setSuggestionQuery:H,selectedIndex:U,setSelectedIndex:W,slashCommands:G,skills:K,showCommandSuggestions:q,setShowCommandSuggestions:J,commandQuery:Y,setCommandQuery:ae,fileInputRef:oe,textareaRef:se,suggestionsRef:ce,commandSuggestionsRef:le,state:ue,dispatch:de}=we(b),X=L?ne:A,fe=L?te:k,pe=ue.selectedThreadId??void 0,me;t[2]!==R||t[3]!==N||t[4]!==Y||t[5]!==D||t[6]!==de||t[7]!==T||t[8]!==C||t[9]!==L||t[10]!==m||t[11]!==d||t[12]!==x||t[13]!==n||t[14]!==F||t[15]!==y||t[16]!==ne||t[17]!==U||t[18]!==A||t[19]!==ie||t[20]!==P||t[21]!==ae||t[22]!==O||t[23]!==E||t[24]!==w||t[25]!==S||t[26]!==I||t[27]!==W||t[28]!==J||t[29]!==B||t[30]!==H||t[31]!==q||t[32]!==z||t[33]!==K||t[34]!==G||t[35]!==_||t[36]!==V||t[37]!==pe||t[38]!==se?(me={message:x,setMessage:S,attachments:N,selectedModel:A,onSend:n,isStreaming:d,selectedThreadId:pe,isListening:m,stopListening:_,resetTranscript:y,dispatch:de,historyIndex:C,setHistoryIndex:w,draftMessage:T,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,showSuggestions:z,setShowSuggestions:B,suggestionQuery:V,setSuggestionQuery:H,allFiles:R,setAllFiles:ie,selectedIndex:U,setSelectedIndex:W,showCommandSuggestions:q,setShowCommandSuggestions:J,commandQuery:Y,setCommandQuery:ae,slashCommands:G,skills:K,textareaRef:se,setAttachments:P,planMode:F,setPlanMode:I,imageMode:L,selectedImageModel:ne},t[2]=R,t[3]=N,t[4]=Y,t[5]=D,t[6]=de,t[7]=T,t[8]=C,t[9]=L,t[10]=m,t[11]=d,t[12]=x,t[13]=n,t[14]=F,t[15]=y,t[16]=ne,t[17]=U,t[18]=A,t[19]=ie,t[20]=P,t[21]=ae,t[22]=O,t[23]=E,t[24]=w,t[25]=S,t[26]=I,t[27]=W,t[28]=J,t[29]=B,t[30]=H,t[31]=q,t[32]=z,t[33]=K,t[34]=G,t[35]=_,t[36]=V,t[37]=pe,t[38]=se,t[39]=me):me=t[39];let{handleSend:he,handleKeyDown:ge,handleTextareaInput:_e,insertFileReference:ve,insertCommand:ye,insertSkill:be,fileSuggestions:xe}=Ee(me),Se=Q.useRef(``),Te,De;t[40]!==S||t[41]!==h?(Te=()=>{if(h&&h!==Se.current){let e=h.substring(Se.current.length);S(t=>(t.endsWith(` `),t+e)),Se.current=h}},De=[h,S],t[40]=S,t[41]=h,t[42]=Te,t[43]=De):(Te=t[42],De=t[43]),Q.useEffect(Te,De);let Oe;t[44]===P?Oe=t[45]:(Oe=e=>{let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(Ye);if(n.length!==0){e.preventDefault();for(let e of n){let t=e.getAsFile();if(!t)continue;let n=new FileReader;n.onload=()=>{let e=n.result.split(`,`)[1];P(n=>[...n,{fileName:t.name||`pasted-image.${t.type.split(`/`)[1]||`png`}`,content:e,mimeType:t.type}])},n.readAsDataURL(t)}}},t[44]=P,t[45]=Oe);let ke=Oe,je;t[46]!==m||t[47]!==y||t[48]!==g||t[49]!==_?(je=()=>{m?(_(),y()):(y(),g())},t[46]=m,t[47]=y,t[48]=g,t[49]=_,t[50]=je):je=t[50];let Me=je,Ne=p?`absolute inset-x-0 bottom-0 mx-auto w-full max-w-3xl px-4 pb-4 pointer-events-none`:`relative mx-auto w-full max-w-3xl px-4 pb-4`,Le=`flex flex-col rounded-2xl border focus-within:ring-2 focus-within:ring-brand pointer-events-auto ${p?`border-border/50 bg-background/80 shadow-lg backdrop-blur-sm`:`border-border bg-background shadow-2xl`}`,Re;t[51]!==c||t[52]!==s?(Re=(0,$.jsx)(Ke,{queuedMessages:s,onRemoveQueuedMessage:c}),t[51]=c,t[52]=s,t[53]=Re):Re=t[53];let Be=F?`Describe what you want Tarsk to plan...`:L?`Describe the image you want to generate...`:`Ask Tarsk anything, # for files, / for commands & skills`,Ve;t[54]!==a||t[55]!==ge||t[56]!==ke||t[57]!==_e||t[58]!==x||t[59]!==Be||t[60]!==se?(Ve=(0,$.jsx)(`textarea`,{ref:se,value:x,onChange:_e,onKeyDown:ge,onPaste:ke,placeholder:Be,rows:1,className:`w-full resize-none bg-transparent px-6 pt-4 pb-4 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none`,disabled:a}),t[54]=a,t[55]=ge,t[56]=ke,t[57]=_e,t[58]=x,t[59]=Be,t[60]=se,t[61]=Ve):Ve=t[61];let He;t[62]!==Y||t[63]!==le||t[64]!==ye||t[65]!==be||t[66]!==U||t[67]!==W||t[68]!==q||t[69]!==K||t[70]!==G?(He=(0,$.jsx)(Ae,{visible:q,commands:G,skills:K,query:Y,selectedIndex:U,onSelectCommand:ye,onSelectSkill:be,onMouseEnterSuggestion:W,containerRef:le}),t[62]=Y,t[63]=le,t[64]=ye,t[65]=be,t[66]=U,t[67]=W,t[68]=q,t[69]=K,t[70]=G,t[71]=He):He=t[71];let qe;t[72]!==xe||t[73]!==ve||t[74]!==U||t[75]!==W||t[76]!==z||t[77]!==V||t[78]!==ce?(qe=(0,$.jsx)(Ie,{showSuggestions:z,fileSuggestions:xe,suggestionQuery:V,selectedIndex:U,onSelectFile:ve,onMouseEnterSuggestion:W,containerRef:ce}),t[72]=xe,t[73]=ve,t[74]=U,t[75]=W,t[76]=z,t[77]=V,t[78]=ce,t[79]=qe):qe=t[79];let Xe;t[80]!==N||t[81]!==A?.id||t[82]!==A?.name||t[83]!==A?.supportsImages||t[84]!==P?(Xe=N.length>0&&(0,$.jsxs)(`div`,{className:`px-4`,children:[(0,$.jsx)(Pe,{attachments:N,onRemove:e=>P(t=>t.filter((t,n)=>n!==e))}),N.some(Je)&&A?.supportsImages===!1&&(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-xs text-amber-500`,children:[(0,$.jsx)(l,{className:`h-3 w-3 shrink-0`}),(0,$.jsxs)(`span`,{children:[`Images are not supported by `,A?.name||A?.id]})]})]}),t[80]=N,t[81]=A?.id,t[82]=A?.name,t[83]=A?.supportsImages,t[84]=P,t[85]=Xe):Xe=t[85];let Ze;t[86]===oe?Ze=t[87]:(Ze=(0,$.jsx)(We,{onFileAttach:()=>oe.current?.click()}),t[86]=oe,t[87]=Ze);let Qe;t[88]===Me?Qe=t[89]:(Qe=(0,$.jsx)(Ge,{onToggleSpeech:Me}),t[88]=Me,t[89]=Qe);let $e=L?re:j,et;t[90]!==fe||t[91]!==X||t[92]!==$e?(et=(0,$.jsx)(ze,{availableModels:fe,selectedModel:X,onModelSelect:$e}),t[90]=fe,t[91]=X,t[92]=$e,t[93]=et):et=t[93];let tt;t[94]!==Ze||t[95]!==Qe||t[96]!==et?(tt=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Ze,Qe,et]}),t[94]=Ze,t[95]=Qe,t[96]=et,t[97]=tt):tt=t[97];let nt;t[98]!==L||t[99]!==F||t[100]!==ee||t[101]!==I?(nt=(0,$.jsx)(Ue,{planMode:F,imageMode:L,setPlanMode:I,setImageMode:ee}),t[98]=L,t[99]=F,t[100]=ee,t[101]=I,t[102]=nt):nt=t[102];let rt=d?r:he,it;t[103]!==N.length||t[104]!==a||t[105]!==X||t[106]!==d||t[107]!==x?(it=!d&&((a??!1)||!x.trim()&&N.length===0||!X),t[103]=N.length,t[104]=a,t[105]=X,t[106]=d,t[107]=x,t[108]=it):it=t[108];let at;t[109]===d?at=t[110]:(at=d?(0,$.jsx)(v,{className:`h-3 w-3 fill-current`}):(0,$.jsx)(M,{className:`h-3 w-3`}),t[109]=d,t[110]=at);let ot=d?`Stop generation`:`Send message`,st;t[111]===ot?st=t[112]:(st=(0,$.jsx)(`span`,{className:`sr-only`,children:ot}),t[111]=ot,t[112]=st);let ct;t[113]!==rt||t[114]!==it||t[115]!==at||t[116]!==st?(ct=(0,$.jsxs)(f,{size:`icon`,className:`h-7 w-7 rounded-full`,onClick:rt,disabled:it,children:[at,st]}),t[113]=rt,t[114]=it,t[115]=at,t[116]=st,t[117]=ct):ct=t[117];let lt;t[118]!==nt||t[119]!==ct?(lt=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[nt,ct]}),t[118]=nt,t[119]=ct,t[120]=lt):lt=t[120];let ut;t[121]!==tt||t[122]!==lt?(ut=(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-2`,children:[tt,lt]}),t[121]=tt,t[122]=lt,t[123]=ut):ut=t[123];let dt;t[124]!==Le||t[125]!==Re||t[126]!==Ve||t[127]!==He||t[128]!==qe||t[129]!==Xe||t[130]!==ut?(dt=(0,$.jsxs)(`div`,{className:Le,children:[Re,Ve,He,qe,Xe,ut]}),t[124]=Le,t[125]=Re,t[126]=Ve,t[127]=He,t[128]=qe,t[129]=Xe,t[130]=ut,t[131]=dt):dt=t[131];let ft;t[132]===P?ft=t[133]:(ft=e=>Fe(e,e=>P(t=>[...t,...e])),t[132]=P,t[133]=ft);let pt;t[134]!==oe||t[135]!==ft?(pt=(0,$.jsx)(`input`,{ref:oe,type:`file`,multiple:!0,className:`hidden`,onChange:ft}),t[134]=oe,t[135]=ft,t[136]=pt):pt=t[136];let mt;return t[137]!==Ne||t[138]!==dt||t[139]!==pt?(mt=(0,$.jsxs)(`div`,{className:Ne,children:[dt,pt]}),t[137]=Ne,t[138]=dt,t[139]=pt,t[140]=mt):mt=t[140],mt}function Je(e){return e.mimeType.startsWith(`image/`)}function Ye(e){return e.type.startsWith(`image/`)}function Xe({threadId:e}){let[t,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{e&&L(e).then(a).catch(()=>{})},[e]),(0,$.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-8 py-2 mt-[-1rem] min-h-[2.25rem]`,children:e&&(0,$.jsxs)(Y,{children:[(0,$.jsx)(ae,{asChild:!0,children:(0,$.jsx)(f,{variant:`ghost`,size:`icon`,className:`h-6 w-6 opacity-50 hover:opacity-80`,onClick:async()=>{if(!(!e||t)){r(!0);try{let t=await L(e);await navigator.clipboard.writeText(t)}finally{r(!1)}}},disabled:t,"aria-label":`Copy repository folder path`,children:(0,$.jsx)(n,{className:`h-3 w-3`})})}),(0,$.jsxs)(J,{side:`top`,className:`bg-slate-900 text-white`,children:[(0,$.jsx)(`div`,{children:`Copy repository folder path`}),i&&(0,$.jsx)(`div`,{className:`opacity-70 text-xs`,children:i})]})]})})}function Ze(e,t){if(!(!t||!e.includes(`"run_js"`)))try{let n=JSON.parse(e.trim());if(!Array.isArray(n))return;for(let e of n)e?.type===`tool_use`&&e?.name===`run_js`&&e?.id&&e?.input?.code&&xe(e.id,e.input.code,t)}catch{}}function Qe(){let{state:e,dispatch:t}=U(),[n,r]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(``),c=(0,Q.useRef)(``),l=(0,Q.useRef)([]),u=(0,Q.useRef)(!1),d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(()=>{}),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),{selectedThreadId:C,selectedProjectId:w,messages:E,queuedChatMessages:O,isStreaming:k,streamingModel:A,processingThreadIds:j}=e,M=!!(C&&j.includes(C)),N=(0,Q.useCallback)(n=>{if(d.current=null,f.current=null,g.current){g.current=!1;return}let r=l.current,i=G(r)||`...`;if(v.current&&(r.length===0||i===`...`)){let r={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${v.current}`,contentType:`text`,timestamp:new Date().toISOString(),model:e.streamingModel||n,isThinking:!1};t({type:K.AddMessage,message:r}),t({type:K.ResetStream}),C&&t({type:K.RemoveProcessingThread,threadId:C}),v.current=null;return}let a={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:i,contentType:`markdown`,timestamp:new Date().toISOString(),model:e.streamingModel||n,isThinking:!1};s.current=``,c.current=``,l.current=[],v.current=null,t({type:K.AddMessage,message:a}),t({type:K.ResetStream}),C&&(t({type:K.MarkThreadCompleted,threadId:C}),t({type:K.RemoveProcessingThread,threadId:C}))},[e.streamingModel,t,C]);(0,Q.useEffect)(()=>{p.current=N},[N]);let P=(0,Q.useCallback)(()=>{C&&h(C),g.current=!0,C&&D(C),d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),s.current=``,c.current=``,l.current=[],v.current=null;let n={messageId:`msg-${Date.now()}-stopped`,sender:`agent`,content:`I've stopped working on your request.`,contentType:`text`,timestamp:new Date().toISOString(),model:e.streamingModel||`default`,isThinking:!1};t({type:K.AddMessage,message:n}),t({type:K.ResetStream}),C&&(t({type:K.MarkThreadCompleted,threadId:C}),t({type:K.RemoveProcessingThread,threadId:C}))},[C,t,e.streamingModel]);(0,Q.useEffect)(()=>{_.current&&!k&&d.current&&(d.current.abort(),d.current=null,f.current&&=(f.current(),null),p.current(A||`default`)),_.current=k},[k,A]),(0,Q.useEffect)(()=>{if(y.current&&=(clearTimeout(y.current),null),k){let e=12e4,t=n=>{y.current&&=(clearTimeout(y.current),null),y.current=setTimeout(()=>{let n=Date.now(),r=b?.current??null;if(r!=null){let i=n-r;if(i<e){t(e-i);return}}console.warn(`[stream-safety] Streaming stuck for 2 minutes with no activity, auto-finalizing`),d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),p.current(A||`default`)},n)},n=e;if(b?.current!=null){let t=Date.now()-b.current;n=t>=e?0:e-t}t(n)}return()=>{y.current&&=(clearTimeout(y.current),null)}},[k,A]),(0,Q.useEffect)(()=>()=>{d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),s.current=``,c.current=``,l.current=[],u.current=!1,v.current=null,t({type:K.ResetStream})},[C,t]),(0,Q.useEffect)(()=>{if(!C)return;let e=!1;async function n(){try{let n=await re(C);e||t({type:K.SetMessages,messages:n.messages})}catch(n){console.error(`Failed to load chat history:`,n),e||t({type:K.SetMessages,messages:[]})}}return n(),()=>{e=!0}},[C,w,t]),(0,Q.useEffect)(()=>{if(!C||!M||k)return;let e=new AbortController;return d.current=e,t({type:K.ResetStream}),t({type:K.SetStreaming,isStreaming:!0}),s.current=``,c.current=``,l.current=[],u.current=!1,v.current=null,te(C,e.signal).then(n=>{if(!n||e.signal.aborted){p.current(`default`);return}f.current=S(n,e=>{if(e.type===`error`){let t=e.content||`Unknown error occurred`;v.current=t,r(t);return}if(e.type!==`message`){if(e.type===`toolcall_delta`){e.partial?.content?.[0]?.id&&e.delta&&t({type:K.UpdateToolCallProgress,toolCallId:e.partial.content[0].id,progress:{toolCallId:e.partial.content[0].id,toolName:e.partial.content[0].name,delta:e.delta,partial:e.partial}});return}if(e.model&&t({type:K.SetStreamModel,model:e.model}),e.type===`thinking`||e.isThinking){let n=e.content??``;Ze(n,C),c.current+=n;let r=W(l.current,`thinking`,n);l.current=r,t({type:K.AppendStreamChunk,chunkType:`thinking`,content:n,segments:r})}else if(e.type===`result`)u.current=!0,s.current=e.content??``,l.current=q(l.current,e.content??``),t({type:K.SetStreamContent,content:e.content??``});else{if(u.current)return;s.current+=e.content??``;let n=W(l.current,`content`,e.content??``);l.current=n,t({type:K.AppendStreamChunk,chunkType:`content`,content:e.content??``,segments:n})}}},()=>{p.current(`default`)},e=>{if(e.includes(`AbortError`)||e.includes(`canceled`)||e.includes(`BodyStreamBuffer was aborted`)){p.current(`default`);return}v.current=e,r(e)},e=>{if(e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=W(l.current,`thinking`,r);l.current=e,t({type:K.AppendStreamChunk,chunkType:`thinking`,content:r,segments:e});return}let i=!1;if(typeof n==`object`&&Array.isArray(n)&&n.length>0)i=!0;else if(typeof r==`string`&&r.trim().startsWith(`[`))try{let e=JSON.parse(r);i=Array.isArray(e)&&e.length>0}catch{}if(i)u.current=!0,s.current=r,l.current=q(l.current,r),t({type:K.SetStreamContent,content:r});else{s.current+=r;let e=W(l.current,`content`,r);l.current=e,t({type:K.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}else if(e.role===`tool`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(r){s.current+=r;let e=W(l.current,`content`,r);l.current=e,t({type:K.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}})}).catch(e=>{if(e instanceof Error&&e.name===`AbortError`){t({type:K.ResetStream});return}if(e instanceof Error&&e.message.includes(`not currently processing`)){t({type:K.ResetStream});return}console.error(`Failed to subscribe to chat stream:`,e),t({type:K.ResetStream})}),()=>{e.abort(),f.current&&=(f.current(),null)}},[C,M]);let F=(0,Q.useCallback)(async(n,a,m,g,_,y)=>{if(!C)return;r(null),h(null),d.current&&d.current.abort(),f.current&&f.current();let b=`msg-${Date.now()}`,E;try{let e=await i(C,b);e.success&&e.stashed&&e.checkpointRef&&(E=e.checkpointRef)}catch{}let D={messageId:b,sender:`user`,content:n,contentType:`text`,timestamp:new Date().toISOString(),model:a,attachments:m.map(e=>({fileName:e.fileName,content:e.content,mimeType:e.mimeType})),checkpointRef:E};t({type:K.AddMessage,message:D});let O=n.trim().replace(/\n/g,` `).slice(0,100);if(w&&C&&(T(C,{title:O}).catch(e=>{console.error(`Failed to update thread title:`,e)}),t({type:K.UpdateThreadTitle,projectId:w,threadId:C,title:O})),y){let e=g??void 0;if(!e&&typeof a==`string`){let t=a.split(/[:/]/)[0]?.trim();t&&(e=t)}if(!e){let e={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Image generation is not available because no provider is configured for the selected model.`,contentType:`text`,timestamp:new Date().toISOString(),model:a,isThinking:!1};t({type:K.AddMessage,message:e}),t({type:K.ResetStream});return}t({type:K.SetStreaming,isStreaming:!0});try{let r=await x(n,a,e,C),i={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:n,contentType:`text`,timestamp:new Date().toISOString(),model:a,isThinking:!1,generatedImageUrl:r.imageUrl,generatedImageData:r.imageData};t({type:K.AddMessage,message:i})}catch(e){let n=e instanceof Error?e.message:`Image generation failed`,r={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${n}`,contentType:`text`,timestamp:new Date().toISOString(),model:a,isThinking:!1};t({type:K.AddMessage,message:r})}finally{t({type:K.ResetStream})}return}t({type:K.ResetStream}),t({type:K.SetStreaming,isStreaming:!0}),s.current=``,u.current=!1;let k=new AbortController;d.current=k;try{let i=await ee(C,n,a,m,k.signal,g,_);if(!i){p.current(a);return}f.current=S(i,n=>{if(n.type===`error`){let e=n.content||`Unknown error occurred`;v.current=e,r(e);return}if(n.type!==`message`){if(n.type===`toolcall_delta`){if(n.partial?.content?.[0]?.id&&n.delta){let e=n.partial.content[0].id,r=n.partial.content[0].name;t({type:K.UpdateToolCallProgress,toolCallId:e,progress:{toolCallId:e,toolName:r,delta:n.delta,partial:n.partial}})}return}if(n.model&&t({type:K.SetStreamModel,model:n.model}),n.type===`thinking`||n.isThinking){let r=n.content??``;Ze(r,e.selectedThreadId),c.current+=r;let i=W(l.current,`thinking`,r);l.current=i,t({type:K.AppendStreamChunk,chunkType:`thinking`,content:r,segments:i})}else if(n.type===`result`)u.current=!0,s.current=n.content??``,l.current=q(l.current,n.content??``),t({type:K.SetStreamContent,content:n.content??``});else{if(u.current)return;s.current+=n.content??``;let e=W(l.current,`content`,n.content??``);l.current=e,t({type:K.AppendStreamChunk,chunkType:`content`,content:n.content??``,segments:e})}}},()=>{p.current(a)},e=>{if(e.includes(`AbortError`)||e.includes(`canceled`)||e.includes(`BodyStreamBuffer was aborted`)){p.current(a);return}v.current=e,r(e)},e=>{if(e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=W(l.current,`thinking`,r);l.current=e,t({type:K.AppendStreamChunk,chunkType:`thinking`,content:r,segments:e});return}let i=!1;if(typeof n==`object`&&Array.isArray(n)&&n.length>0)i=!0;else if(typeof r==`string`&&r.trim().startsWith(`[`))try{let e=JSON.parse(r);i=Array.isArray(e)&&e.length>0}catch{}if(i)u.current=!0,s.current=r,l.current=q(l.current,r),t({type:K.SetStreamContent,content:r});else{s.current+=r;let e=W(l.current,`content`,r);l.current=e,t({type:K.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}else if(e.role===`tool`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(r){s.current+=r;let e=W(l.current,`content`,r);l.current=e,t({type:K.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}})}catch(e){if(e instanceof Error&&e.name===`AbortError`||e instanceof Error&&e.message.includes(`BodyStreamBuffer was aborted`))return;if(e instanceof V){t({type:K.ResetStream}),o(!0);return}r(e instanceof Error?e.message:`Failed to send message. Please ensure the CLI server is running on localhost:641`),v.current=e instanceof Error?e.message:`Failed to send message. Please ensure the CLI server is running on localhost:641`,t({type:K.ResetStream})}},[C,w,t]);(0,Q.useEffect)(()=>{let n=e.pendingChatMessage;if(!n||k||n.threadId!==C)return;let r=setTimeout(()=>{t({type:K.ClearPendingChatMessage}),F(n.message,n.model,[],n.provider)},100);return()=>clearTimeout(r)},[e.pendingChatMessage,k,C,t,F]);let I=(0,Q.useMemo)(()=>C?O.filter(e=>e.threadId===C):[],[C,O]),L=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(k||!C||I.length===0||L.current)return;let[e]=I;L.current=!0,t({type:K.RemoveQueuedChatMessage,queuedMessageId:e.id});let n=setTimeout(()=>{F(e.message,e.model,e.attachments,e.provider,e.planMode),L.current=!1},0);return()=>{clearTimeout(n),L.current=!1}},[t,F,k,I,C]),{error:n,setError:r,handleSend:F,handleStop:P,isStreaming:k,selectedThreadId:C,queuedMessagesForThread:I,handleRemoveQueuedMessage:(0,Q.useCallback)(e=>{let n=I.find(t=>t.id===e);t({type:K.RemoveQueuedChatMessage,queuedMessageId:e}),!(!n||k||E.length>0||!C)&&F(n.message,n.model,n.attachments,n.provider,n.planMode)},[t,F,k,E.length,I,C]),showEmptyBalanceDialog:a,setShowEmptyBalanceDialog:o}}function $e(e){let t=(0,Z.c)(10),{open:n,onClose:r}=e,i=H(),a;t[0]===r?a=t[1]:(a=e=>{e||r()},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(ue,{children:[(0,$.jsx)(se,{children:`Balance empty`}),(0,$.jsx)(oe,{children:`You have no prompts remaining. Purchase additional prompts to continue.`})]}),t[2]=o):o=t[2];let s;t[3]!==i||t[4]!==r?(s=(0,$.jsxs)(ce,{children:[o,(0,$.jsx)(le,{children:(0,$.jsx)(f,{onClick:()=>{r(),i(`/settings/account`)},children:`Go to Account`})})]}),t[3]=i,t[4]=r,t[5]=s):s=t[5];let c;return t[6]!==n||t[7]!==a||t[8]!==s?(c=(0,$.jsx)(de,{open:n,onOpenChange:a,children:s}),t[6]=n,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}var et=3e4;function tt(e){let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(void 0),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(`Up to date`),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(void 0),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),P=(0,Q.useRef)(!0),F=(0,Q.useCallback)(e=>{n(e.hasChanges),i(e.changedFilesCount),o(e.hasUnpushedCommits),c(e.currentBranch),v(e.hasRemoteBranch),u(e.isOnGitHub),f(e.remoteUrl),m(e.canCreateRepo),g(e.repoUrl),b(e.status),S(e.defaultBranch??null),w(e.prExists),E(e.prUrl),O(e.prState),A(e.commitsAheadOfDefault??!1)},[]),I=(0,Q.useCallback)(async(t=!1)=>{if(!e)return;let n=setTimeout(()=>M(!0),100);try{let n=`unified-git-status-${e}`;t&&B.invalidate(n),F(await B.get(n,()=>N(e,t),et))}catch(e){console.error(`Failed to fetch unified git status:`,e)}finally{clearTimeout(n),M(!1)}},[e,F]);return(0,Q.useEffect)(()=>{e&&(async()=>{if(P.current){let t=`unified-git-status-${e}`,n=B.getSync(t);n&&F(n),P.current=!1}await I()})()},[e,I,F]),{hasChanges:t,changedFilesCount:r,hasUnpushedCommits:a,hasRemoteBranch:_,currentBranch:s,isOnGitHub:l,remoteUrl:d,canCreateRepo:p,repoUrl:h,status:y,defaultBranch:x,prExists:C,prUrl:T,prState:D,commitsAheadOfDefault:k,isRefreshing:j,fetchUnifiedStatus:I}}function nt(e){let t=(0,Z.c)(34),{messages:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?[]:n,t[0]=n,t[1]=r);let i=r,{state:o,dispatch:s}=U(),{isCreatingProject:c,selectedThreadId:l}=o,{handleSend:u,handleStop:d,isStreaming:p,queuedMessagesForThread:h,handleRemoveQueuedMessage:g,showEmptyBalanceDialog:_,setShowEmptyBalanceDialog:v}=Qe(),y=o.pendingChatMessage?.threadId===l,b=p||y,x=i.length>0,{hasChanges:S,changedFilesCount:C}=tt(l??void 0),{setActiveMainTab:w}=X(),T;t[2]!==s||t[3]!==l?(T=async()=>{if(l)try{let e=await z(l);s({type:K.ClearMessages}),console.log(`New conversation started:`,e);let t=await re(l);s({type:K.SetMessages,messages:t.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},t[2]=s,t[3]=l,t[4]=T):T=t[4];let E=T,D;t[5]===v?D=t[6]:(D=()=>v(!1),t[5]=v,t[6]=D);let O;t[7]!==_||t[8]!==D?(O=(0,$.jsx)($e,{open:_,onClose:D}),t[7]=_,t[8]=D,t[9]=O):O=t[9];let k;t[10]!==C||t[11]!==E||t[12]!==S||t[13]!==x||t[14]!==w?(k=x&&(0,$.jsxs)(`div`,{className:`absolute -top-8 left-0 z-10 ml-8`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs bg-background`,onClick:E,children:[(0,$.jsx)(m,{className:`h-3.5 w-3.5 mr-1`}),`New Chat`]}),S&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs bg-background ml-2`,onClick:()=>w(`review`),children:[(0,$.jsx)(a,{className:`h-3.5 w-3.5 mr-1`}),C,` `,C===1?`File`:`Files`,` Changed`]})]}),t[10]=C,t[11]=E,t[12]=S,t[13]=x,t[14]=w,t[15]=k):k=t[15];let A=!l&&!c,j;t[16]!==b||t[17]!==g||t[18]!==u||t[19]!==d||t[20]!==h||t[21]!==A?(j=(0,$.jsx)(qe,{onSend:u,onStop:d,isStreaming:b,disabled:A,initialValue:``,queuedMessages:h,onRemoveQueuedMessage:g,isOverlay:!1}),t[16]=b,t[17]=g,t[18]=u,t[19]=d,t[20]=h,t[21]=A,t[22]=j):j=t[22];let M;t[23]!==k||t[24]!==j?(M=(0,$.jsxs)(`div`,{className:`relative`,children:[k,j]}),t[23]=k,t[24]=j,t[25]=M):M=t[25];let N=l??void 0,P;t[26]===N?P=t[27]:(P=(0,$.jsx)(Xe,{threadId:N}),t[26]=N,t[27]=P);let F;t[28]!==P||t[29]!==M?(F=(0,$.jsxs)(`div`,{className:`relative mx-auto min-w-[400px] w-[90vw] max-w-3xl`,children:[M,P]}),t[28]=P,t[29]=M,t[30]=F):F=t[30];let I;return t[31]!==F||t[32]!==O?(I=(0,$.jsxs)($.Fragment,{children:[O,F]}),t[31]=F,t[32]=O,t[33]=I):I=t[33],I}export{ve as a,_e as i,tt as n,me as o,xe as r,nt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Ki as n,Wn as r,Zi as i,ca as a,ea as o,ua as s}from"./dialogs-config-Dwpv4SNp.js";import{a as c,d as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,s as _,t as v,u as y}from"./react-vendor-CYvpNUsM.js";var b=a(),x=e(s(),1),S=t(),C=y,w=u,T=x.forwardRef((e,t)=>{let n=(0,b.c)(14),a,o,s,c;n[0]===e?(a=n[1],o=n[2],s=n[3],c=n[4]):({className:o,inset:s,children:a,...c}=e,n[0]=e,n[1]=a,n[2]=o,n[3]=s,n[4]=c);let l=s&&`pl-8`,u;n[5]!==o||n[6]!==l?(u=r(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,l,o),n[5]=o,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(i,{className:`ml-auto h-4 w-4`}),n[8]=d):d=n[8];let f;return n[9]!==a||n[10]!==c||n[11]!==t||n[12]!==u?(f=(0,S.jsxs)(p,{ref:t,className:u,...c,children:[a,d]}),n[9]=a,n[10]=c,n[11]=t,n[12]=u,n[13]=f):f=n[13],f});T.displayName=p.displayName;var E=x.forwardRef((e,t)=>{let n=(0,b.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(g,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});E.displayName=g.displayName;var D=x.forwardRef((e,t)=>{let n=(0,b.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(_,{children:(0,S.jsx)(m,{ref:t,className:o,...a})}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});D.displayName=m.displayName;var O=x.forwardRef((e,t)=>{let n=(0,b.c)(11),i,a,o;n[0]===e?(i=n[1],a=n[2],o=n[3]):({className:i,inset:a,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==i||n[5]!==s?(c=r(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,s,i),n[4]=i,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(d,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});O.displayName=d.displayName;var k=x.forwardRef((e,t)=>{let n=(0,b.c)(14),i,a,s,l;n[0]===e?(i=n[1],a=n[2],s=n[3],l=n[4]):({className:s,children:a,checked:i,...l}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=s,n[4]=l);let u;n[5]===s?u=n[6]:(u=r(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,s),n[5]=s,n[6]=u);let d;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(o,{className:`h-4 w-4`})})}),n[7]=d):d=n[7];let f;return n[8]!==i||n[9]!==a||n[10]!==l||n[11]!==t||n[12]!==u?(f=(0,S.jsxs)(v,{ref:t,className:u,checked:i,...l,children:[d,a]}),n[8]=i,n[9]=a,n[10]=l,n[11]=t,n[12]=u,n[13]=f):f=n[13],f});k.displayName=v.displayName;var A=x.forwardRef((e,t)=>{let i=(0,b.c)(12),a,o,s;i[0]===e?(a=i[1],o=i[2],s=i[3]):({className:o,children:a,...s}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s);let l;i[4]===o?l=i[5]:(l=r(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,o),i[4]=o,i[5]=l);let u;i[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(n,{className:`h-2 w-2 fill-current`})})}),i[6]=u):u=i[6];let d;return i[7]!==a||i[8]!==s||i[9]!==t||i[10]!==l?(d=(0,S.jsxs)(f,{ref:t,className:l,...s,children:[u,a]}),i[7]=a,i[8]=s,i[9]=t,i[10]=l,i[11]=d):d=i[11],d});A.displayName=f.displayName;var j=x.forwardRef((e,t)=>{let n=(0,b.c)(11),i,a,o;n[0]===e?(i=n[1],a=n[2],o=n[3]):({className:i,inset:a,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==i||n[5]!==s?(c=r(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,i),n[4]=i,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(h,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});j.displayName=h.displayName;var M=x.forwardRef((e,t)=>{let n=(0,b.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`-mx-1 my-1 h-px bg-border`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(l,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});M.displayName=l.displayName;var N=e=>{let t=(0,b.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`ml-auto text-xs tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,S.jsx)(`span`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};N.displayName=`ContextMenuShortcut`;export{w as a,M as i,D as n,O as r,C as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./history-view-BvAOaO8q.js";export{e as ConversationHistoryView,e as default};
|