@oal-sarl/code 6.0.1 → 6.0.2
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 +977 -846
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -97,6 +97,44 @@ var init_settings = __esm(() => {
|
|
|
97
97
|
};
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
+
// src/config/codeMd.ts
|
|
101
|
+
import fs from "fs/promises";
|
|
102
|
+
import path from "path";
|
|
103
|
+
async function loadCodeConfig() {
|
|
104
|
+
const codeMdPath = path.join(process.cwd(), "CODE.md");
|
|
105
|
+
try {
|
|
106
|
+
const rawContent = await fs.readFile(codeMdPath, "utf-8");
|
|
107
|
+
return { rawContent };
|
|
108
|
+
} catch {
|
|
109
|
+
return { rawContent: "" };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function createCodeConfig() {
|
|
113
|
+
const codeMdPath = path.join(process.cwd(), "CODE.md");
|
|
114
|
+
await fs.writeFile(codeMdPath, DEFAULT_CODE_MD, "utf-8");
|
|
115
|
+
}
|
|
116
|
+
var DEFAULT_CODE_MD = `# CODE.md - Configuration du projet
|
|
117
|
+
|
|
118
|
+
## Stack technique
|
|
119
|
+
<!-- Ex: TypeScript, Next.js 14, PostgreSQL, Vitest -->
|
|
120
|
+
|
|
121
|
+
## Commandes
|
|
122
|
+
- dev: \`npm run dev\`
|
|
123
|
+
- test: \`npm test\`
|
|
124
|
+
- build: \`npm run build\`
|
|
125
|
+
- lint: \`npm run lint\`
|
|
126
|
+
|
|
127
|
+
## Standards de code
|
|
128
|
+
<!-- Ex: 2 espaces, single quotes, camelCase, pas de any TypeScript -->
|
|
129
|
+
|
|
130
|
+
## Architecture des dossiers
|
|
131
|
+
<!-- Decris la structure et le role de chaque dossier principal -->
|
|
132
|
+
|
|
133
|
+
## A eviter
|
|
134
|
+
<!-- Actions que Code ne doit PAS faire automatiquement -->
|
|
135
|
+
`;
|
|
136
|
+
var init_codeMd = () => {};
|
|
137
|
+
|
|
100
138
|
// src/logging/logger.ts
|
|
101
139
|
function shouldWriteToStderr() {
|
|
102
140
|
if (IS_CI)
|
|
@@ -1999,17 +2037,44 @@ function isMissingQuantizedArtifactError(error) {
|
|
|
1999
2037
|
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
2000
2038
|
return /could not locate file/i.test(message) && /_q4|q4\.onnx|decoder_model_merged_q4/i.test(message);
|
|
2001
2039
|
}
|
|
2002
|
-
|
|
2040
|
+
function isRetryableLocalModelCacheError(error, modelId) {
|
|
2041
|
+
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
2042
|
+
const normalizedModel = modelId.replace("/", "\\");
|
|
2043
|
+
return /load model from/i.test(message) && (/system error number 13/i.test(message) || /permission denied/i.test(message) || /access is denied/i.test(message)) && (message.includes(MODELS_DIR) || message.includes(normalizedModel));
|
|
2044
|
+
}
|
|
2045
|
+
function getLocalModelCacheDir(modelId) {
|
|
2046
|
+
return path7.join(MODELS_DIR, ...modelId.split("/"));
|
|
2047
|
+
}
|
|
2048
|
+
async function purgeLocalModelCache(modelId) {
|
|
2049
|
+
const localCacheDir = getLocalModelCacheDir(modelId);
|
|
2050
|
+
await fs9.rm(localCacheDir, { recursive: true, force: true }).catch(() => {});
|
|
2051
|
+
}
|
|
2052
|
+
async function loadEmbeddedVisionPipeline(pipeline, purgeCache = purgeLocalModelCache) {
|
|
2003
2053
|
try {
|
|
2004
2054
|
return await pipeline("image-to-text", VISION_MODEL_ID, {
|
|
2005
2055
|
dtype: "q4",
|
|
2006
2056
|
device: "cpu"
|
|
2007
2057
|
});
|
|
2008
2058
|
} catch (error) {
|
|
2009
|
-
if (
|
|
2059
|
+
if (isRetryableLocalModelCacheError(error, VISION_MODEL_ID)) {
|
|
2060
|
+
logger.warn("vision_pipeline_cache_retry", { modelId: VISION_MODEL_ID, phase: "quantized" });
|
|
2061
|
+
await purgeCache(VISION_MODEL_ID);
|
|
2062
|
+
} else if (!isMissingQuantizedArtifactError(error)) {
|
|
2063
|
+
throw error;
|
|
2064
|
+
} else {
|
|
2065
|
+
logger.warn("vision_pipeline_q4_unavailable", { modelId: VISION_MODEL_ID });
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
try {
|
|
2069
|
+
return await pipeline("image-to-text", VISION_MODEL_ID, {
|
|
2070
|
+
device: "cpu"
|
|
2071
|
+
});
|
|
2072
|
+
} catch (error) {
|
|
2073
|
+
if (!isRetryableLocalModelCacheError(error, VISION_MODEL_ID)) {
|
|
2010
2074
|
throw error;
|
|
2011
2075
|
}
|
|
2012
|
-
logger.warn("
|
|
2076
|
+
logger.warn("vision_pipeline_cache_retry", { modelId: VISION_MODEL_ID });
|
|
2077
|
+
await purgeCache(VISION_MODEL_ID);
|
|
2013
2078
|
return pipeline("image-to-text", VISION_MODEL_ID, {
|
|
2014
2079
|
device: "cpu"
|
|
2015
2080
|
});
|
|
@@ -2043,12 +2108,12 @@ function configureLocalModelRuntime(env) {
|
|
|
2043
2108
|
env.localModelPath = MODELS_DIR;
|
|
2044
2109
|
env.allowRemoteModels = true;
|
|
2045
2110
|
}
|
|
2046
|
-
async function downloadModel(modelId, onProgress) {
|
|
2111
|
+
async function downloadModel(modelId, onProgress, loadRuntime = () => import("@huggingface/transformers")) {
|
|
2047
2112
|
logger.info("model_download_start", { modelId });
|
|
2048
2113
|
let pipeline;
|
|
2049
2114
|
let env;
|
|
2050
2115
|
try {
|
|
2051
|
-
({ pipeline, env } = await
|
|
2116
|
+
({ pipeline, env } = await loadRuntime());
|
|
2052
2117
|
} catch {
|
|
2053
2118
|
throw new Error("Le runtime local @huggingface/transformers n'est pas disponible. Installe-le pour telecharger les modeles embarques.");
|
|
2054
2119
|
}
|
|
@@ -2063,7 +2128,16 @@ async function downloadModel(modelId, onProgress) {
|
|
|
2063
2128
|
};
|
|
2064
2129
|
}
|
|
2065
2130
|
if (modelId === EMBED_MODEL_ID) {
|
|
2066
|
-
|
|
2131
|
+
try {
|
|
2132
|
+
await pipeline("feature-extraction", modelId, { dtype: "q4", device: "cpu" });
|
|
2133
|
+
} catch (error) {
|
|
2134
|
+
if (!isRetryableLocalModelCacheError(error, modelId)) {
|
|
2135
|
+
throw error;
|
|
2136
|
+
}
|
|
2137
|
+
logger.warn("embedding_pipeline_cache_retry", { modelId });
|
|
2138
|
+
await purgeLocalModelCache(modelId);
|
|
2139
|
+
await pipeline("feature-extraction", modelId, { dtype: "q4", device: "cpu" });
|
|
2140
|
+
}
|
|
2067
2141
|
} else {
|
|
2068
2142
|
await loadEmbeddedVisionPipeline(pipeline);
|
|
2069
2143
|
}
|
|
@@ -7535,255 +7609,31 @@ var init_theme = __esm(() => {
|
|
|
7535
7609
|
};
|
|
7536
7610
|
});
|
|
7537
7611
|
|
|
7538
|
-
// src/ui/
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
value: "multi-context shell"
|
|
7561
|
-
}, undefined, false, undefined, this),
|
|
7562
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7563
|
-
label: "Validation",
|
|
7564
|
-
value: "judge + transactions"
|
|
7565
|
-
}, undefined, false, undefined, this),
|
|
7566
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7567
|
-
label: "Local features",
|
|
7568
|
-
value: "vision + semantic index"
|
|
7569
|
-
}, undefined, false, undefined, this),
|
|
7570
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7571
|
-
label: "Workflow",
|
|
7572
|
-
value: "skills + approvals + history"
|
|
7573
|
-
}, undefined, false, undefined, this)
|
|
7574
|
-
]
|
|
7575
|
-
}, undefined, true, undefined, this),
|
|
7576
|
-
/* @__PURE__ */ jsxDEV(Box, {
|
|
7577
|
-
marginTop: 1,
|
|
7578
|
-
flexDirection: "column",
|
|
7579
|
-
children: [
|
|
7580
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
7581
|
-
color: codeTheme.brandStrong,
|
|
7582
|
-
children: "What changes in v6"
|
|
7583
|
-
}, undefined, false, undefined, this),
|
|
7584
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
7585
|
-
color: codeTheme.muted,
|
|
7586
|
-
children: "Cleaner chat UI, stronger runtime visibility, safer approvals and model-backed planning."
|
|
7587
|
-
}, undefined, false, undefined, this)
|
|
7588
|
-
]
|
|
7589
|
-
}, undefined, true, undefined, this),
|
|
7590
|
-
/* @__PURE__ */ jsxDEV(Box, {
|
|
7591
|
-
marginTop: 1,
|
|
7592
|
-
flexDirection: "column",
|
|
7593
|
-
children: [
|
|
7594
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
7595
|
-
color: codeTheme.brandStrong,
|
|
7596
|
-
children: "Platform diagnostics"
|
|
7597
|
-
}, undefined, false, undefined, this),
|
|
7598
|
-
diagnostics ? /* @__PURE__ */ jsxDEV(Fragment, {
|
|
7599
|
-
children: [
|
|
7600
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7601
|
-
label: "Shell",
|
|
7602
|
-
value: diagnostics.shellLabel,
|
|
7603
|
-
tone: diagnostics.shellSupportsPosix ? "success" : "warning"
|
|
7604
|
-
}, undefined, false, undefined, this),
|
|
7605
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7606
|
-
label: "Warnings",
|
|
7607
|
-
value: diagnostics.warnings.length === 0 ? "none" : `${diagnostics.warnings.length} attention point(s)`,
|
|
7608
|
-
tone: diagnostics.warnings.length === 0 ? "success" : "warning"
|
|
7609
|
-
}, undefined, false, undefined, this)
|
|
7610
|
-
]
|
|
7611
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV(Text, {
|
|
7612
|
-
color: codeTheme.muted,
|
|
7613
|
-
children: "Scanning local shell, sandbox and optional capabilities..."
|
|
7614
|
-
}, undefined, false, undefined, this)
|
|
7615
|
-
]
|
|
7616
|
-
}, undefined, true, undefined, this),
|
|
7617
|
-
/* @__PURE__ */ jsxDEV(OnboardingHint, {
|
|
7618
|
-
children: "Press Enter to continue."
|
|
7619
|
-
}, undefined, false, undefined, this)
|
|
7620
|
-
]
|
|
7621
|
-
}, undefined, true, undefined, this);
|
|
7622
|
-
}
|
|
7623
|
-
var init_WizardStep1Welcome = __esm(() => {
|
|
7624
|
-
init_theme();
|
|
7625
|
-
init_wizardHelper();
|
|
7626
|
-
});
|
|
7627
|
-
|
|
7628
|
-
// src/ui/clipboard.ts
|
|
7629
|
-
import { spawnSync as spawnSync2 } from "child_process";
|
|
7630
|
-
function tryCommand(command, args) {
|
|
7631
|
-
try {
|
|
7632
|
-
const result = spawnSync2(command, args, { encoding: "utf-8", windowsHide: true });
|
|
7633
|
-
if (result.status === 0 && typeof result.stdout === "string" && result.stdout.length > 0) {
|
|
7634
|
-
return result.stdout;
|
|
7635
|
-
}
|
|
7636
|
-
} catch {}
|
|
7637
|
-
return null;
|
|
7612
|
+
// src/ui/glyphs.ts
|
|
7613
|
+
function isUnicodeCapableTerminal() {
|
|
7614
|
+
const mode = process.env.CODE_GLYPHS?.toLowerCase() ?? "auto";
|
|
7615
|
+
if (mode === "ascii")
|
|
7616
|
+
return false;
|
|
7617
|
+
if (mode === "unicode")
|
|
7618
|
+
return true;
|
|
7619
|
+
if (process.platform !== "win32")
|
|
7620
|
+
return true;
|
|
7621
|
+
const term = (process.env.TERM ?? "").toLowerCase();
|
|
7622
|
+
const lang = (process.env.LC_ALL ?? process.env.LC_CTYPE ?? process.env.LANG ?? "").toLowerCase();
|
|
7623
|
+
if (process.env.WT_SESSION)
|
|
7624
|
+
return true;
|
|
7625
|
+
if (process.env.TERM_PROGRAM)
|
|
7626
|
+
return true;
|
|
7627
|
+
if ((process.env.ConEmuANSI ?? "").toUpperCase() === "ON")
|
|
7628
|
+
return true;
|
|
7629
|
+
if (term.includes("xterm") || term.includes("utf") || term.includes("256color"))
|
|
7630
|
+
return true;
|
|
7631
|
+
if (lang.includes("utf-8"))
|
|
7632
|
+
return true;
|
|
7633
|
+
return false;
|
|
7638
7634
|
}
|
|
7639
|
-
function
|
|
7640
|
-
|
|
7641
|
-
return tryCommand("powershell", ["-NoProfile", "-Command", "Get-Clipboard -Raw"]) ?? tryCommand("pwsh", ["-NoProfile", "-Command", "Get-Clipboard -Raw"]) ?? "";
|
|
7642
|
-
}
|
|
7643
|
-
if (process.platform === "darwin") {
|
|
7644
|
-
return tryCommand("pbpaste", []) ?? "";
|
|
7645
|
-
}
|
|
7646
|
-
return tryCommand("wl-paste", ["-n"]) ?? tryCommand("xclip", ["-selection", "clipboard", "-o"]) ?? "";
|
|
7647
|
-
}
|
|
7648
|
-
var init_clipboard = () => {};
|
|
7649
|
-
|
|
7650
|
-
// src/ui/wizard/WizardStep2ApiKey.tsx
|
|
7651
|
-
import { useState } from "react";
|
|
7652
|
-
import { Box as Box2, Text as Text2, useInput as useInput2 } from "ink";
|
|
7653
|
-
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
7654
|
-
function WizardStep2ApiKey({ onNext }) {
|
|
7655
|
-
const [value, setValue] = useState("");
|
|
7656
|
-
const [error, setError] = useState("");
|
|
7657
|
-
const [checking, setChecking] = useState(false);
|
|
7658
|
-
useInput2(async (input, key) => {
|
|
7659
|
-
if (key.return) {
|
|
7660
|
-
if (!/^(pk_|sk_)/.test(value)) {
|
|
7661
|
-
setError("La cle doit commencer par pk_ ou sk_.");
|
|
7662
|
-
return;
|
|
7663
|
-
}
|
|
7664
|
-
setChecking(true);
|
|
7665
|
-
setError("");
|
|
7666
|
-
try {
|
|
7667
|
-
const res = await fetch("https://gen.pollinations.ai/v1/chat/completions", {
|
|
7668
|
-
method: "POST",
|
|
7669
|
-
headers: {
|
|
7670
|
-
"Content-Type": "application/json",
|
|
7671
|
-
Authorization: `Bearer ${value}`
|
|
7672
|
-
},
|
|
7673
|
-
body: JSON.stringify({
|
|
7674
|
-
model: "mistral",
|
|
7675
|
-
messages: [{ role: "user", content: "hi" }],
|
|
7676
|
-
max_tokens: 5
|
|
7677
|
-
}),
|
|
7678
|
-
signal: AbortSignal.timeout(8000)
|
|
7679
|
-
});
|
|
7680
|
-
if (res.status === 401) {
|
|
7681
|
-
setError("Cle invalide.");
|
|
7682
|
-
setChecking(false);
|
|
7683
|
-
return;
|
|
7684
|
-
}
|
|
7685
|
-
} catch {
|
|
7686
|
-
setError("Impossible de verifier maintenant. La cle reste acceptee.");
|
|
7687
|
-
}
|
|
7688
|
-
setChecking(false);
|
|
7689
|
-
onNext(value);
|
|
7690
|
-
return;
|
|
7691
|
-
}
|
|
7692
|
-
if (key.backspace || key.delete) {
|
|
7693
|
-
setValue((prev) => prev.slice(0, -1));
|
|
7694
|
-
return;
|
|
7695
|
-
}
|
|
7696
|
-
if (key.ctrl && (input === "v" || input === "\x16")) {
|
|
7697
|
-
const pasted = readClipboardText().replace(/\r\n/g, `
|
|
7698
|
-
`);
|
|
7699
|
-
if (pasted)
|
|
7700
|
-
setValue((prev) => prev + pasted.trim());
|
|
7701
|
-
return;
|
|
7702
|
-
}
|
|
7703
|
-
if (!key.ctrl && !key.meta && input.length > 0) {
|
|
7704
|
-
setValue((prev) => prev + input);
|
|
7705
|
-
}
|
|
7706
|
-
});
|
|
7707
|
-
return /* @__PURE__ */ jsxDEV2(Box2, {
|
|
7708
|
-
flexDirection: "column",
|
|
7709
|
-
gap: 1,
|
|
7710
|
-
children: [
|
|
7711
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7712
|
-
color: codeTheme.text,
|
|
7713
|
-
children: "This key powers preflight, planning, execution and the judge. The shell keeps it local in your Code settings."
|
|
7714
|
-
}, undefined, false, undefined, this),
|
|
7715
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7716
|
-
color: codeTheme.muted,
|
|
7717
|
-
children: "Expected format: `pk_...` or `sk_...`"
|
|
7718
|
-
}, undefined, false, undefined, this),
|
|
7719
|
-
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7720
|
-
marginTop: 1,
|
|
7721
|
-
borderStyle: "round",
|
|
7722
|
-
borderColor: error ? codeTheme.danger : codeTheme.brand,
|
|
7723
|
-
paddingX: 1,
|
|
7724
|
-
children: [
|
|
7725
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7726
|
-
color: codeTheme.brandStrong,
|
|
7727
|
-
children: "key "
|
|
7728
|
-
}, undefined, false, undefined, this),
|
|
7729
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7730
|
-
color: codeTheme.text,
|
|
7731
|
-
children: [
|
|
7732
|
-
"*".repeat(Math.max(0, value.length - 6)),
|
|
7733
|
-
value.slice(-6)
|
|
7734
|
-
]
|
|
7735
|
-
}, undefined, true, undefined, this),
|
|
7736
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7737
|
-
color: codeTheme.brand,
|
|
7738
|
-
children: "|"
|
|
7739
|
-
}, undefined, false, undefined, this)
|
|
7740
|
-
]
|
|
7741
|
-
}, undefined, true, undefined, this),
|
|
7742
|
-
checking ? /* @__PURE__ */ jsxDEV2(Text2, {
|
|
7743
|
-
color: codeTheme.warning,
|
|
7744
|
-
children: "Verification in progress..."
|
|
7745
|
-
}, undefined, false, undefined, this) : null,
|
|
7746
|
-
error ? /* @__PURE__ */ jsxDEV2(Text2, {
|
|
7747
|
-
color: codeTheme.danger,
|
|
7748
|
-
children: error
|
|
7749
|
-
}, undefined, false, undefined, this) : null,
|
|
7750
|
-
/* @__PURE__ */ jsxDEV2(OnboardingHint, {
|
|
7751
|
-
children: "Ctrl+V to paste. Press Enter to validate and continue."
|
|
7752
|
-
}, undefined, false, undefined, this)
|
|
7753
|
-
]
|
|
7754
|
-
}, undefined, true, undefined, this);
|
|
7755
|
-
}
|
|
7756
|
-
var init_WizardStep2ApiKey = __esm(() => {
|
|
7757
|
-
init_clipboard();
|
|
7758
|
-
init_theme();
|
|
7759
|
-
init_wizardHelper();
|
|
7760
|
-
});
|
|
7761
|
-
|
|
7762
|
-
// src/ui/glyphs.ts
|
|
7763
|
-
function isUnicodeCapableTerminal() {
|
|
7764
|
-
const mode = process.env.CODE_GLYPHS?.toLowerCase() ?? "auto";
|
|
7765
|
-
if (mode === "ascii")
|
|
7766
|
-
return false;
|
|
7767
|
-
if (mode === "unicode")
|
|
7768
|
-
return true;
|
|
7769
|
-
if (process.platform !== "win32")
|
|
7770
|
-
return true;
|
|
7771
|
-
const term = (process.env.TERM ?? "").toLowerCase();
|
|
7772
|
-
const lang = (process.env.LC_ALL ?? process.env.LC_CTYPE ?? process.env.LANG ?? "").toLowerCase();
|
|
7773
|
-
if (process.env.WT_SESSION)
|
|
7774
|
-
return true;
|
|
7775
|
-
if (process.env.TERM_PROGRAM)
|
|
7776
|
-
return true;
|
|
7777
|
-
if ((process.env.ConEmuANSI ?? "").toUpperCase() === "ON")
|
|
7778
|
-
return true;
|
|
7779
|
-
if (term.includes("xterm") || term.includes("utf") || term.includes("256color"))
|
|
7780
|
-
return true;
|
|
7781
|
-
if (lang.includes("utf-8"))
|
|
7782
|
-
return true;
|
|
7783
|
-
return false;
|
|
7784
|
-
}
|
|
7785
|
-
function pickGlyph(unicode, ascii) {
|
|
7786
|
-
return isUnicodeCapableTerminal() ? unicode : ascii;
|
|
7635
|
+
function pickGlyph(unicode, ascii) {
|
|
7636
|
+
return isUnicodeCapableTerminal() ? unicode : ascii;
|
|
7787
7637
|
}
|
|
7788
7638
|
var ASCII_GLYPHS, UNICODE_GLYPHS, uiGlyphs;
|
|
7789
7639
|
var init_glyphs = __esm(() => {
|
|
@@ -7967,9 +7817,9 @@ var init_glyphs = __esm(() => {
|
|
|
7967
7817
|
});
|
|
7968
7818
|
|
|
7969
7819
|
// src/ui/ProgressBar.tsx
|
|
7970
|
-
import
|
|
7971
|
-
import { Box
|
|
7972
|
-
import { jsxDEV
|
|
7820
|
+
import React from "react";
|
|
7821
|
+
import { Box, Text } from "ink";
|
|
7822
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
7973
7823
|
function ProgressBar({
|
|
7974
7824
|
progress,
|
|
7975
7825
|
width = 30,
|
|
@@ -7981,10 +7831,10 @@ function ProgressBar({
|
|
|
7981
7831
|
const filled = Math.round(clampedProgress / 100 * width);
|
|
7982
7832
|
const empty = width - filled;
|
|
7983
7833
|
const bar = uiGlyphs.progressStart + uiGlyphs.progressFull.repeat(filled) + uiGlyphs.progressEmpty.repeat(empty) + uiGlyphs.progressEnd;
|
|
7984
|
-
return /* @__PURE__ */
|
|
7834
|
+
return /* @__PURE__ */ jsxDEV(Box, {
|
|
7985
7835
|
flexDirection: "column",
|
|
7986
7836
|
children: [
|
|
7987
|
-
label && /* @__PURE__ */
|
|
7837
|
+
label && /* @__PURE__ */ jsxDEV(Text, {
|
|
7988
7838
|
dimColor: true,
|
|
7989
7839
|
children: [
|
|
7990
7840
|
uiGlyphs.bullet,
|
|
@@ -7992,13 +7842,13 @@ function ProgressBar({
|
|
|
7992
7842
|
label
|
|
7993
7843
|
]
|
|
7994
7844
|
}, undefined, true, undefined, this),
|
|
7995
|
-
/* @__PURE__ */
|
|
7845
|
+
/* @__PURE__ */ jsxDEV(Box, {
|
|
7996
7846
|
children: [
|
|
7997
|
-
/* @__PURE__ */
|
|
7847
|
+
/* @__PURE__ */ jsxDEV(Text, {
|
|
7998
7848
|
color,
|
|
7999
7849
|
children: bar
|
|
8000
7850
|
}, undefined, false, undefined, this),
|
|
8001
|
-
showPercentage && /* @__PURE__ */
|
|
7851
|
+
showPercentage && /* @__PURE__ */ jsxDEV(Text, {
|
|
8002
7852
|
dimColor: true,
|
|
8003
7853
|
children: [
|
|
8004
7854
|
" ",
|
|
@@ -8012,20 +7862,20 @@ function ProgressBar({
|
|
|
8012
7862
|
}, undefined, true, undefined, this);
|
|
8013
7863
|
}
|
|
8014
7864
|
function Spinner({ message, color = codeTheme.brand }) {
|
|
8015
|
-
const [frame, setFrame] =
|
|
8016
|
-
|
|
7865
|
+
const [frame, setFrame] = React.useState(0);
|
|
7866
|
+
React.useEffect(() => {
|
|
8017
7867
|
const interval = setInterval(() => {
|
|
8018
7868
|
setFrame((prev) => (prev + 1) % uiGlyphs.spinner.length);
|
|
8019
7869
|
}, 100);
|
|
8020
7870
|
return () => clearInterval(interval);
|
|
8021
7871
|
}, []);
|
|
8022
|
-
return /* @__PURE__ */
|
|
7872
|
+
return /* @__PURE__ */ jsxDEV(Box, {
|
|
8023
7873
|
children: [
|
|
8024
|
-
/* @__PURE__ */
|
|
7874
|
+
/* @__PURE__ */ jsxDEV(Text, {
|
|
8025
7875
|
color,
|
|
8026
7876
|
children: uiGlyphs.spinner[frame]
|
|
8027
7877
|
}, undefined, false, undefined, this),
|
|
8028
|
-
message && /* @__PURE__ */
|
|
7878
|
+
message && /* @__PURE__ */ jsxDEV(Text, {
|
|
8029
7879
|
children: [
|
|
8030
7880
|
" ",
|
|
8031
7881
|
message
|
|
@@ -8040,19 +7890,19 @@ function LoadingState({
|
|
|
8040
7890
|
progress,
|
|
8041
7891
|
showSpinner = true
|
|
8042
7892
|
}) {
|
|
8043
|
-
return /* @__PURE__ */
|
|
7893
|
+
return /* @__PURE__ */ jsxDEV(Box, {
|
|
8044
7894
|
flexDirection: "column",
|
|
8045
7895
|
marginY: 1,
|
|
8046
7896
|
children: [
|
|
8047
|
-
/* @__PURE__ */
|
|
7897
|
+
/* @__PURE__ */ jsxDEV(Box, {
|
|
8048
7898
|
children: [
|
|
8049
|
-
showSpinner && /* @__PURE__ */
|
|
7899
|
+
showSpinner && /* @__PURE__ */ jsxDEV(Box, {
|
|
8050
7900
|
marginRight: 1,
|
|
8051
|
-
children: /* @__PURE__ */
|
|
7901
|
+
children: /* @__PURE__ */ jsxDEV(Spinner, {
|
|
8052
7902
|
color: "cyan"
|
|
8053
7903
|
}, undefined, false, undefined, this)
|
|
8054
7904
|
}, undefined, false, undefined, this),
|
|
8055
|
-
/* @__PURE__ */
|
|
7905
|
+
/* @__PURE__ */ jsxDEV(Text, {
|
|
8056
7906
|
bold: true,
|
|
8057
7907
|
color: "cyan",
|
|
8058
7908
|
children: [
|
|
@@ -8063,9 +7913,9 @@ function LoadingState({
|
|
|
8063
7913
|
}, undefined, true, undefined, this)
|
|
8064
7914
|
]
|
|
8065
7915
|
}, undefined, true, undefined, this),
|
|
8066
|
-
subMessage && /* @__PURE__ */
|
|
7916
|
+
subMessage && /* @__PURE__ */ jsxDEV(Box, {
|
|
8067
7917
|
marginLeft: 2,
|
|
8068
|
-
children: /* @__PURE__ */
|
|
7918
|
+
children: /* @__PURE__ */ jsxDEV(Text, {
|
|
8069
7919
|
dimColor: true,
|
|
8070
7920
|
children: [
|
|
8071
7921
|
uiGlyphs.arrowRight,
|
|
@@ -8074,10 +7924,10 @@ function LoadingState({
|
|
|
8074
7924
|
]
|
|
8075
7925
|
}, undefined, true, undefined, this)
|
|
8076
7926
|
}, undefined, false, undefined, this),
|
|
8077
|
-
progress !== undefined && /* @__PURE__ */
|
|
7927
|
+
progress !== undefined && /* @__PURE__ */ jsxDEV(Box, {
|
|
8078
7928
|
marginLeft: 2,
|
|
8079
7929
|
marginTop: 1,
|
|
8080
|
-
children: /* @__PURE__ */
|
|
7930
|
+
children: /* @__PURE__ */ jsxDEV(ProgressBar, {
|
|
8081
7931
|
progress,
|
|
8082
7932
|
width: 25,
|
|
8083
7933
|
showPercentage: true
|
|
@@ -8091,168 +7941,587 @@ var init_ProgressBar = __esm(() => {
|
|
|
8091
7941
|
init_theme();
|
|
8092
7942
|
});
|
|
8093
7943
|
|
|
8094
|
-
// src/ui/wizard/
|
|
8095
|
-
import {
|
|
8096
|
-
import {
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
const
|
|
8100
|
-
|
|
8101
|
-
setStatus("testing");
|
|
8102
|
-
(async () => {
|
|
8103
|
-
try {
|
|
8104
|
-
const res = await fetch("https://gen.pollinations.ai/v1/chat/completions", {
|
|
8105
|
-
method: "POST",
|
|
8106
|
-
headers: {
|
|
8107
|
-
"Content-Type": "application/json",
|
|
8108
|
-
Authorization: `Bearer ${apiKey}`
|
|
8109
|
-
},
|
|
8110
|
-
body: JSON.stringify({
|
|
8111
|
-
model: "mistral",
|
|
8112
|
-
messages: [{ role: "user", content: "ping" }],
|
|
8113
|
-
max_tokens: 4
|
|
8114
|
-
}),
|
|
8115
|
-
signal: AbortSignal.timeout(8000)
|
|
8116
|
-
});
|
|
8117
|
-
setStatus(res.ok ? "ok" : "warn");
|
|
8118
|
-
} catch {
|
|
8119
|
-
setStatus("warn");
|
|
8120
|
-
}
|
|
8121
|
-
})();
|
|
8122
|
-
}, [apiKey]);
|
|
8123
|
-
useInput3((_, key) => {
|
|
8124
|
-
if (key.return)
|
|
8125
|
-
onNext();
|
|
8126
|
-
});
|
|
8127
|
-
return /* @__PURE__ */ jsxDEV4(Box4, {
|
|
8128
|
-
flexDirection: "column",
|
|
8129
|
-
gap: 1,
|
|
8130
|
-
children: [
|
|
8131
|
-
/* @__PURE__ */ jsxDEV4(Text4, {
|
|
8132
|
-
color: codeTheme.text,
|
|
8133
|
-
children: "Before entering the shell, Code probes the configured endpoint to avoid a dead setup on first use."
|
|
8134
|
-
}, undefined, false, undefined, this),
|
|
8135
|
-
status === "testing" ? /* @__PURE__ */ jsxDEV4(LoadingState, {
|
|
8136
|
-
message: "Testing model access",
|
|
8137
|
-
subMessage: "Polling the API with a minimal request."
|
|
8138
|
-
}, undefined, false, undefined, this) : null,
|
|
8139
|
-
status === "ok" ? /* @__PURE__ */ jsxDEV4(Text4, {
|
|
8140
|
-
color: codeTheme.success,
|
|
8141
|
-
children: "API check passed."
|
|
8142
|
-
}, undefined, false, undefined, this) : null,
|
|
8143
|
-
status === "warn" ? /* @__PURE__ */ jsxDEV4(Text4, {
|
|
8144
|
-
color: codeTheme.warning,
|
|
8145
|
-
children: "Could not fully validate. You can still continue."
|
|
8146
|
-
}, undefined, false, undefined, this) : null,
|
|
8147
|
-
/* @__PURE__ */ jsxDEV4(OnboardingHint, {
|
|
8148
|
-
children: "Press Enter to continue."
|
|
8149
|
-
}, undefined, false, undefined, this)
|
|
8150
|
-
]
|
|
8151
|
-
}, undefined, true, undefined, this);
|
|
8152
|
-
}
|
|
8153
|
-
var init_WizardStep3Test = __esm(() => {
|
|
8154
|
-
init_ProgressBar();
|
|
8155
|
-
init_theme();
|
|
8156
|
-
init_wizardHelper();
|
|
8157
|
-
});
|
|
8158
|
-
|
|
8159
|
-
// src/ui/wizard/WizardStep4Model.tsx
|
|
8160
|
-
import { useState as useState3 } from "react";
|
|
8161
|
-
import { Box as Box5, Text as Text5, useInput as useInput4 } from "ink";
|
|
8162
|
-
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
8163
|
-
function WizardStep4Model({ onNext }) {
|
|
8164
|
-
const [modelIndex, setModelIndex] = useState3(0);
|
|
8165
|
-
const [langIndex, setLangIndex] = useState3(0);
|
|
8166
|
-
const [editing, setEditing] = useState3("model");
|
|
8167
|
-
useInput4((_, key) => {
|
|
8168
|
-
if (key.upArrow) {
|
|
8169
|
-
if (editing === "model")
|
|
8170
|
-
setModelIndex((i) => Math.max(0, i - 1));
|
|
8171
|
-
else
|
|
8172
|
-
setLangIndex((i) => Math.max(0, i - 1));
|
|
8173
|
-
return;
|
|
8174
|
-
}
|
|
8175
|
-
if (key.downArrow) {
|
|
8176
|
-
if (editing === "model")
|
|
8177
|
-
setModelIndex((i) => Math.min(MODELS.length - 1, i + 1));
|
|
8178
|
-
else
|
|
8179
|
-
setLangIndex((i) => Math.min(LANGUAGES.length - 1, i + 1));
|
|
8180
|
-
return;
|
|
8181
|
-
}
|
|
8182
|
-
if (key.tab) {
|
|
8183
|
-
setEditing((e) => e === "model" ? "lang" : "model");
|
|
8184
|
-
return;
|
|
8185
|
-
}
|
|
8186
|
-
if (key.return) {
|
|
8187
|
-
onNext(MODELS[modelIndex], LANGUAGES[langIndex]);
|
|
8188
|
-
}
|
|
8189
|
-
});
|
|
8190
|
-
return /* @__PURE__ */ jsxDEV5(Box5, {
|
|
7944
|
+
// src/ui/wizard/wizardHelper.tsx
|
|
7945
|
+
import { Box as Box2, Text as Text2, render } from "ink";
|
|
7946
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
7947
|
+
function OnboardingShell({ step, total, steps, children }) {
|
|
7948
|
+
const active = steps[Math.max(0, step - 1)];
|
|
7949
|
+
const progress = step / Math.max(total, 1) * 100;
|
|
7950
|
+
return /* @__PURE__ */ jsxDEV2(Box2, {
|
|
8191
7951
|
flexDirection: "column",
|
|
8192
|
-
|
|
7952
|
+
paddingX: 1,
|
|
8193
7953
|
children: [
|
|
8194
|
-
/* @__PURE__ */
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
}, undefined, false, undefined, this),
|
|
8198
|
-
/* @__PURE__ */ jsxDEV5(Box5, {
|
|
8199
|
-
marginTop: 1,
|
|
8200
|
-
flexDirection: "column",
|
|
7954
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7955
|
+
justifyContent: "space-between",
|
|
7956
|
+
marginBottom: 1,
|
|
8201
7957
|
children: [
|
|
8202
|
-
/* @__PURE__ */
|
|
7958
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7959
|
+
gap: 1,
|
|
7960
|
+
children: [
|
|
7961
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7962
|
+
bold: true,
|
|
7963
|
+
color: codeTheme.brandStrong,
|
|
7964
|
+
children: "Code"
|
|
7965
|
+
}, undefined, false, undefined, this),
|
|
7966
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7967
|
+
color: codeTheme.muted,
|
|
7968
|
+
children: "OAL SARL | v6 onboarding"
|
|
7969
|
+
}, undefined, false, undefined, this)
|
|
7970
|
+
]
|
|
7971
|
+
}, undefined, true, undefined, this),
|
|
7972
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8203
7973
|
color: codeTheme.muted,
|
|
8204
|
-
children:
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
},
|
|
7974
|
+
children: [
|
|
7975
|
+
"Step ",
|
|
7976
|
+
step,
|
|
7977
|
+
"/",
|
|
7978
|
+
total
|
|
7979
|
+
]
|
|
7980
|
+
}, undefined, true, undefined, this)
|
|
8211
7981
|
]
|
|
8212
7982
|
}, undefined, true, undefined, this),
|
|
8213
|
-
/* @__PURE__ */
|
|
8214
|
-
|
|
7983
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7984
|
+
marginBottom: 1,
|
|
7985
|
+
children: /* @__PURE__ */ jsxDEV2(ProgressBar, {
|
|
7986
|
+
progress,
|
|
7987
|
+
width: 34,
|
|
7988
|
+
color: codeTheme.brand,
|
|
7989
|
+
showPercentage: false
|
|
7990
|
+
}, undefined, false, undefined, this)
|
|
7991
|
+
}, undefined, false, undefined, this),
|
|
7992
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7993
|
+
borderStyle: "round",
|
|
7994
|
+
borderColor: codeTheme.line,
|
|
7995
|
+
paddingX: 1,
|
|
7996
|
+
paddingY: 1,
|
|
8215
7997
|
children: [
|
|
8216
|
-
/* @__PURE__ */
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
7998
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7999
|
+
width: 26,
|
|
8000
|
+
marginRight: 2,
|
|
8001
|
+
flexDirection: "column",
|
|
8002
|
+
children: [
|
|
8003
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8004
|
+
color: codeTheme.muted,
|
|
8005
|
+
children: "Setup flow"
|
|
8006
|
+
}, undefined, false, undefined, this),
|
|
8007
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
8008
|
+
marginTop: 1,
|
|
8009
|
+
flexDirection: "column",
|
|
8010
|
+
children: steps.map((item, index) => {
|
|
8011
|
+
const current = index + 1;
|
|
8012
|
+
const done = current < step;
|
|
8013
|
+
const activeStep = current === step;
|
|
8014
|
+
return /* @__PURE__ */ jsxDEV2(Box2, {
|
|
8015
|
+
marginBottom: 1,
|
|
8016
|
+
flexDirection: "column",
|
|
8017
|
+
children: [
|
|
8018
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8019
|
+
color: done ? codeTheme.success : activeStep ? codeTheme.brandStrong : codeTheme.muted,
|
|
8020
|
+
children: [
|
|
8021
|
+
done ? "OK" : activeStep ? ">" : "-",
|
|
8022
|
+
" ",
|
|
8023
|
+
item.title
|
|
8024
|
+
]
|
|
8025
|
+
}, undefined, true, undefined, this),
|
|
8026
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8027
|
+
color: activeStep ? codeTheme.text : codeTheme.muted,
|
|
8028
|
+
children: item.description
|
|
8029
|
+
}, undefined, false, undefined, this)
|
|
8030
|
+
]
|
|
8031
|
+
}, item.title, true, undefined, this);
|
|
8032
|
+
})
|
|
8033
|
+
}, undefined, false, undefined, this)
|
|
8034
|
+
]
|
|
8035
|
+
}, undefined, true, undefined, this),
|
|
8036
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
8037
|
+
flexGrow: 1,
|
|
8038
|
+
flexDirection: "column",
|
|
8039
|
+
borderStyle: "round",
|
|
8040
|
+
borderColor: codeTheme.line,
|
|
8041
|
+
paddingX: 1,
|
|
8042
|
+
paddingY: 1,
|
|
8043
|
+
children: [
|
|
8044
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8045
|
+
color: codeTheme.accent,
|
|
8046
|
+
children: active.eyebrow
|
|
8047
|
+
}, undefined, false, undefined, this),
|
|
8048
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8049
|
+
bold: true,
|
|
8050
|
+
color: codeTheme.brandStrong,
|
|
8051
|
+
children: active.title
|
|
8052
|
+
}, undefined, false, undefined, this),
|
|
8053
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8054
|
+
color: codeTheme.muted,
|
|
8055
|
+
children: active.description
|
|
8056
|
+
}, undefined, false, undefined, this),
|
|
8057
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
8058
|
+
marginTop: 1,
|
|
8059
|
+
flexDirection: "column",
|
|
8060
|
+
children
|
|
8061
|
+
}, undefined, false, undefined, this)
|
|
8062
|
+
]
|
|
8063
|
+
}, undefined, true, undefined, this)
|
|
8064
|
+
]
|
|
8065
|
+
}, undefined, true, undefined, this)
|
|
8066
|
+
]
|
|
8067
|
+
}, undefined, true, undefined, this);
|
|
8068
|
+
}
|
|
8069
|
+
function OnboardingHint({ children }) {
|
|
8070
|
+
return /* @__PURE__ */ jsxDEV2(Text2, {
|
|
8071
|
+
color: codeTheme.muted,
|
|
8072
|
+
children
|
|
8073
|
+
}, undefined, false, undefined, this);
|
|
8074
|
+
}
|
|
8075
|
+
function OnboardingMetric({
|
|
8076
|
+
label,
|
|
8077
|
+
value,
|
|
8078
|
+
tone = "text"
|
|
8079
|
+
}) {
|
|
8080
|
+
const color = tone === "success" ? codeTheme.success : tone === "warning" ? codeTheme.warning : codeTheme.text;
|
|
8081
|
+
return /* @__PURE__ */ jsxDEV2(Box2, {
|
|
8082
|
+
flexDirection: "row",
|
|
8083
|
+
gap: 2,
|
|
8084
|
+
children: [
|
|
8085
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
8086
|
+
width: 20,
|
|
8087
|
+
flexShrink: 0,
|
|
8088
|
+
children: /* @__PURE__ */ jsxDEV2(Text2, {
|
|
8089
|
+
color: codeTheme.muted,
|
|
8090
|
+
children: label
|
|
8091
|
+
}, undefined, false, undefined, this)
|
|
8092
|
+
}, undefined, false, undefined, this),
|
|
8093
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
8094
|
+
flexGrow: 1,
|
|
8095
|
+
children: /* @__PURE__ */ jsxDEV2(Text2, {
|
|
8096
|
+
color,
|
|
8097
|
+
wrap: "wrap",
|
|
8098
|
+
children: value
|
|
8099
|
+
}, undefined, false, undefined, this)
|
|
8100
|
+
}, undefined, false, undefined, this)
|
|
8101
|
+
]
|
|
8102
|
+
}, undefined, true, undefined, this);
|
|
8103
|
+
}
|
|
8104
|
+
function OnboardingChoice({
|
|
8105
|
+
active,
|
|
8106
|
+
label,
|
|
8107
|
+
detail
|
|
8108
|
+
}) {
|
|
8109
|
+
return /* @__PURE__ */ jsxDEV2(Box2, {
|
|
8110
|
+
borderStyle: "round",
|
|
8111
|
+
borderColor: active ? codeTheme.brand : codeTheme.line,
|
|
8112
|
+
paddingX: 1,
|
|
8113
|
+
marginBottom: 1,
|
|
8114
|
+
children: /* @__PURE__ */ jsxDEV2(Box2, {
|
|
8115
|
+
flexDirection: "column",
|
|
8116
|
+
children: [
|
|
8117
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8118
|
+
color: active ? codeTheme.brandStrong : codeTheme.text,
|
|
8119
|
+
children: [
|
|
8120
|
+
active ? ">" : " ",
|
|
8121
|
+
" ",
|
|
8122
|
+
label
|
|
8123
|
+
]
|
|
8124
|
+
}, undefined, true, undefined, this),
|
|
8125
|
+
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
8126
|
+
color: codeTheme.muted,
|
|
8127
|
+
children: detail
|
|
8128
|
+
}, undefined, false, undefined, this)
|
|
8129
|
+
]
|
|
8130
|
+
}, undefined, true, undefined, this)
|
|
8131
|
+
}, undefined, false, undefined, this);
|
|
8132
|
+
}
|
|
8133
|
+
var init_wizardHelper = __esm(() => {
|
|
8134
|
+
init_WizardContainer();
|
|
8135
|
+
init_theme();
|
|
8136
|
+
init_ProgressBar();
|
|
8137
|
+
});
|
|
8138
|
+
|
|
8139
|
+
// src/ui/wizard/WizardStep1Welcome.tsx
|
|
8140
|
+
import { Box as Box3, Text as Text3, useInput } from "ink";
|
|
8141
|
+
import { jsxDEV as jsxDEV3, Fragment } from "react/jsx-dev-runtime";
|
|
8142
|
+
function WizardStep1Welcome({ diagnostics, onNext }) {
|
|
8143
|
+
useInput((_, key) => {
|
|
8144
|
+
if (key.return)
|
|
8145
|
+
onNext();
|
|
8146
|
+
});
|
|
8147
|
+
return /* @__PURE__ */ jsxDEV3(Box3, {
|
|
8148
|
+
flexDirection: "column",
|
|
8149
|
+
gap: 1,
|
|
8150
|
+
children: [
|
|
8151
|
+
/* @__PURE__ */ jsxDEV3(Text3, {
|
|
8152
|
+
color: codeTheme.text,
|
|
8153
|
+
children: "Code is OAL SARL's terminal-native coding shell with multi-session runs, guided execution, visual artifacts and guarded approvals."
|
|
8154
|
+
}, undefined, false, undefined, this),
|
|
8155
|
+
/* @__PURE__ */ jsxDEV3(Box3, {
|
|
8156
|
+
flexDirection: "column",
|
|
8157
|
+
marginTop: 1,
|
|
8158
|
+
children: [
|
|
8159
|
+
/* @__PURE__ */ jsxDEV3(OnboardingMetric, {
|
|
8160
|
+
label: "Sessions",
|
|
8161
|
+
value: "multi-context shell"
|
|
8162
|
+
}, undefined, false, undefined, this),
|
|
8163
|
+
/* @__PURE__ */ jsxDEV3(OnboardingMetric, {
|
|
8164
|
+
label: "Validation",
|
|
8165
|
+
value: "judge + transactions"
|
|
8166
|
+
}, undefined, false, undefined, this),
|
|
8167
|
+
/* @__PURE__ */ jsxDEV3(OnboardingMetric, {
|
|
8168
|
+
label: "Local features",
|
|
8169
|
+
value: "vision + semantic index"
|
|
8170
|
+
}, undefined, false, undefined, this),
|
|
8171
|
+
/* @__PURE__ */ jsxDEV3(OnboardingMetric, {
|
|
8172
|
+
label: "Workflow",
|
|
8173
|
+
value: "skills + approvals + history"
|
|
8174
|
+
}, undefined, false, undefined, this)
|
|
8175
|
+
]
|
|
8176
|
+
}, undefined, true, undefined, this),
|
|
8177
|
+
/* @__PURE__ */ jsxDEV3(Box3, {
|
|
8178
|
+
marginTop: 1,
|
|
8179
|
+
flexDirection: "column",
|
|
8180
|
+
children: [
|
|
8181
|
+
/* @__PURE__ */ jsxDEV3(Text3, {
|
|
8182
|
+
color: codeTheme.brandStrong,
|
|
8183
|
+
children: "What changes in v6"
|
|
8184
|
+
}, undefined, false, undefined, this),
|
|
8185
|
+
/* @__PURE__ */ jsxDEV3(Text3, {
|
|
8186
|
+
color: codeTheme.muted,
|
|
8187
|
+
children: "Cleaner chat UI, stronger runtime visibility, safer approvals and model-backed planning."
|
|
8188
|
+
}, undefined, false, undefined, this)
|
|
8189
|
+
]
|
|
8190
|
+
}, undefined, true, undefined, this),
|
|
8191
|
+
/* @__PURE__ */ jsxDEV3(Box3, {
|
|
8192
|
+
marginTop: 1,
|
|
8193
|
+
flexDirection: "column",
|
|
8194
|
+
children: [
|
|
8195
|
+
/* @__PURE__ */ jsxDEV3(Text3, {
|
|
8196
|
+
color: codeTheme.brandStrong,
|
|
8197
|
+
children: "Platform diagnostics"
|
|
8198
|
+
}, undefined, false, undefined, this),
|
|
8199
|
+
diagnostics ? /* @__PURE__ */ jsxDEV3(Fragment, {
|
|
8200
|
+
children: [
|
|
8201
|
+
/* @__PURE__ */ jsxDEV3(OnboardingMetric, {
|
|
8202
|
+
label: "Shell",
|
|
8203
|
+
value: diagnostics.shellLabel,
|
|
8204
|
+
tone: diagnostics.shellSupportsPosix ? "success" : "warning"
|
|
8205
|
+
}, undefined, false, undefined, this),
|
|
8206
|
+
/* @__PURE__ */ jsxDEV3(OnboardingMetric, {
|
|
8207
|
+
label: "Warnings",
|
|
8208
|
+
value: diagnostics.warnings.length === 0 ? "none" : `${diagnostics.warnings.length} attention point(s)`,
|
|
8209
|
+
tone: diagnostics.warnings.length === 0 ? "success" : "warning"
|
|
8210
|
+
}, undefined, false, undefined, this)
|
|
8211
|
+
]
|
|
8212
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV3(Text3, {
|
|
8213
|
+
color: codeTheme.muted,
|
|
8214
|
+
children: "Scanning local shell, sandbox and optional capabilities..."
|
|
8215
|
+
}, undefined, false, undefined, this)
|
|
8216
|
+
]
|
|
8217
|
+
}, undefined, true, undefined, this),
|
|
8218
|
+
/* @__PURE__ */ jsxDEV3(OnboardingHint, {
|
|
8219
|
+
children: "Press Enter to continue."
|
|
8220
|
+
}, undefined, false, undefined, this)
|
|
8221
|
+
]
|
|
8222
|
+
}, undefined, true, undefined, this);
|
|
8223
|
+
}
|
|
8224
|
+
var init_WizardStep1Welcome = __esm(() => {
|
|
8225
|
+
init_theme();
|
|
8226
|
+
init_wizardHelper();
|
|
8227
|
+
});
|
|
8228
|
+
|
|
8229
|
+
// src/ui/clipboard.ts
|
|
8230
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
8231
|
+
function tryCommand(command, args) {
|
|
8232
|
+
try {
|
|
8233
|
+
const result = spawnSync2(command, args, { encoding: "utf-8", windowsHide: true });
|
|
8234
|
+
if (result.status === 0 && typeof result.stdout === "string" && result.stdout.length > 0) {
|
|
8235
|
+
return result.stdout;
|
|
8236
|
+
}
|
|
8237
|
+
} catch {}
|
|
8238
|
+
return null;
|
|
8239
|
+
}
|
|
8240
|
+
function readClipboardText() {
|
|
8241
|
+
if (process.platform === "win32") {
|
|
8242
|
+
return tryCommand("powershell", ["-NoProfile", "-Command", "Get-Clipboard -Raw"]) ?? tryCommand("pwsh", ["-NoProfile", "-Command", "Get-Clipboard -Raw"]) ?? "";
|
|
8243
|
+
}
|
|
8244
|
+
if (process.platform === "darwin") {
|
|
8245
|
+
return tryCommand("pbpaste", []) ?? "";
|
|
8246
|
+
}
|
|
8247
|
+
return tryCommand("wl-paste", ["-n"]) ?? tryCommand("xclip", ["-selection", "clipboard", "-o"]) ?? "";
|
|
8248
|
+
}
|
|
8249
|
+
var init_clipboard = () => {};
|
|
8250
|
+
|
|
8251
|
+
// src/ui/wizard/WizardStep2ApiKey.tsx
|
|
8252
|
+
import { useState } from "react";
|
|
8253
|
+
import { Box as Box4, Text as Text4, useInput as useInput2 } from "ink";
|
|
8254
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
8255
|
+
function WizardStep2ApiKey({ onNext }) {
|
|
8256
|
+
const [value, setValue] = useState("");
|
|
8257
|
+
const [error, setError] = useState("");
|
|
8258
|
+
const [checking, setChecking] = useState(false);
|
|
8259
|
+
useInput2(async (input, key) => {
|
|
8260
|
+
if (key.return) {
|
|
8261
|
+
if (!/^(pk_|sk_)/.test(value)) {
|
|
8262
|
+
setError("La cle doit commencer par pk_ ou sk_.");
|
|
8263
|
+
return;
|
|
8264
|
+
}
|
|
8265
|
+
setChecking(true);
|
|
8266
|
+
setError("");
|
|
8267
|
+
try {
|
|
8268
|
+
const res = await fetch("https://gen.pollinations.ai/v1/chat/completions", {
|
|
8269
|
+
method: "POST",
|
|
8270
|
+
headers: {
|
|
8271
|
+
"Content-Type": "application/json",
|
|
8272
|
+
Authorization: `Bearer ${value}`
|
|
8273
|
+
},
|
|
8274
|
+
body: JSON.stringify({
|
|
8275
|
+
model: "mistral",
|
|
8276
|
+
messages: [{ role: "user", content: "hi" }],
|
|
8277
|
+
max_tokens: 5
|
|
8278
|
+
}),
|
|
8279
|
+
signal: AbortSignal.timeout(8000)
|
|
8280
|
+
});
|
|
8281
|
+
if (res.status === 401) {
|
|
8282
|
+
setError("Cle invalide.");
|
|
8283
|
+
setChecking(false);
|
|
8284
|
+
return;
|
|
8285
|
+
}
|
|
8286
|
+
} catch {
|
|
8287
|
+
setError("Impossible de verifier maintenant. La cle reste acceptee.");
|
|
8288
|
+
}
|
|
8289
|
+
setChecking(false);
|
|
8290
|
+
onNext(value);
|
|
8291
|
+
return;
|
|
8292
|
+
}
|
|
8293
|
+
if (key.backspace || key.delete) {
|
|
8294
|
+
setValue((prev) => prev.slice(0, -1));
|
|
8295
|
+
return;
|
|
8296
|
+
}
|
|
8297
|
+
if (key.ctrl && (input === "v" || input === "\x16")) {
|
|
8298
|
+
const pasted = readClipboardText().replace(/\r\n/g, `
|
|
8299
|
+
`);
|
|
8300
|
+
if (pasted)
|
|
8301
|
+
setValue((prev) => prev + pasted.trim());
|
|
8302
|
+
return;
|
|
8303
|
+
}
|
|
8304
|
+
if (!key.ctrl && !key.meta && input.length > 0) {
|
|
8305
|
+
setValue((prev) => prev + input);
|
|
8306
|
+
}
|
|
8307
|
+
});
|
|
8308
|
+
return /* @__PURE__ */ jsxDEV4(Box4, {
|
|
8309
|
+
flexDirection: "column",
|
|
8310
|
+
gap: 1,
|
|
8311
|
+
children: [
|
|
8312
|
+
/* @__PURE__ */ jsxDEV4(Text4, {
|
|
8313
|
+
color: codeTheme.text,
|
|
8314
|
+
children: "This key powers preflight, planning, execution and the judge. The shell keeps it local in your Code settings."
|
|
8315
|
+
}, undefined, false, undefined, this),
|
|
8316
|
+
/* @__PURE__ */ jsxDEV4(Text4, {
|
|
8317
|
+
color: codeTheme.muted,
|
|
8318
|
+
children: "Expected format: `pk_...` or `sk_...`"
|
|
8319
|
+
}, undefined, false, undefined, this),
|
|
8320
|
+
/* @__PURE__ */ jsxDEV4(Box4, {
|
|
8321
|
+
marginTop: 1,
|
|
8322
|
+
borderStyle: "round",
|
|
8323
|
+
borderColor: error ? codeTheme.danger : codeTheme.brand,
|
|
8324
|
+
paddingX: 1,
|
|
8325
|
+
children: [
|
|
8326
|
+
/* @__PURE__ */ jsxDEV4(Text4, {
|
|
8327
|
+
color: codeTheme.brandStrong,
|
|
8328
|
+
children: "key "
|
|
8329
|
+
}, undefined, false, undefined, this),
|
|
8330
|
+
/* @__PURE__ */ jsxDEV4(Text4, {
|
|
8331
|
+
color: codeTheme.text,
|
|
8332
|
+
children: [
|
|
8333
|
+
"*".repeat(Math.max(0, value.length - 6)),
|
|
8334
|
+
value.slice(-6)
|
|
8335
|
+
]
|
|
8336
|
+
}, undefined, true, undefined, this),
|
|
8337
|
+
/* @__PURE__ */ jsxDEV4(Text4, {
|
|
8338
|
+
color: codeTheme.brand,
|
|
8339
|
+
children: "|"
|
|
8340
|
+
}, undefined, false, undefined, this)
|
|
8341
|
+
]
|
|
8342
|
+
}, undefined, true, undefined, this),
|
|
8343
|
+
checking ? /* @__PURE__ */ jsxDEV4(Text4, {
|
|
8344
|
+
color: codeTheme.warning,
|
|
8345
|
+
children: "Verification in progress..."
|
|
8346
|
+
}, undefined, false, undefined, this) : null,
|
|
8347
|
+
error ? /* @__PURE__ */ jsxDEV4(Text4, {
|
|
8348
|
+
color: codeTheme.danger,
|
|
8349
|
+
children: error
|
|
8350
|
+
}, undefined, false, undefined, this) : null,
|
|
8351
|
+
/* @__PURE__ */ jsxDEV4(OnboardingHint, {
|
|
8352
|
+
children: "Ctrl+V to paste. Press Enter to validate and continue."
|
|
8353
|
+
}, undefined, false, undefined, this)
|
|
8354
|
+
]
|
|
8355
|
+
}, undefined, true, undefined, this);
|
|
8356
|
+
}
|
|
8357
|
+
var init_WizardStep2ApiKey = __esm(() => {
|
|
8358
|
+
init_clipboard();
|
|
8359
|
+
init_theme();
|
|
8360
|
+
init_wizardHelper();
|
|
8361
|
+
});
|
|
8362
|
+
|
|
8363
|
+
// src/ui/wizard/WizardStep3Test.tsx
|
|
8364
|
+
import { useEffect, useState as useState2 } from "react";
|
|
8365
|
+
import { Box as Box5, Text as Text5, useInput as useInput3 } from "ink";
|
|
8366
|
+
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
8367
|
+
function WizardStep3Test({ apiKey, onNext }) {
|
|
8368
|
+
const [status, setStatus] = useState2("idle");
|
|
8369
|
+
useEffect(() => {
|
|
8370
|
+
setStatus("testing");
|
|
8371
|
+
(async () => {
|
|
8372
|
+
try {
|
|
8373
|
+
const res = await fetch("https://gen.pollinations.ai/v1/chat/completions", {
|
|
8374
|
+
method: "POST",
|
|
8375
|
+
headers: {
|
|
8376
|
+
"Content-Type": "application/json",
|
|
8377
|
+
Authorization: `Bearer ${apiKey}`
|
|
8378
|
+
},
|
|
8379
|
+
body: JSON.stringify({
|
|
8380
|
+
model: "mistral",
|
|
8381
|
+
messages: [{ role: "user", content: "ping" }],
|
|
8382
|
+
max_tokens: 4
|
|
8383
|
+
}),
|
|
8384
|
+
signal: AbortSignal.timeout(8000)
|
|
8385
|
+
});
|
|
8386
|
+
setStatus(res.ok ? "ok" : "warn");
|
|
8387
|
+
} catch {
|
|
8388
|
+
setStatus("warn");
|
|
8389
|
+
}
|
|
8390
|
+
})();
|
|
8391
|
+
}, [apiKey]);
|
|
8392
|
+
useInput3((_, key) => {
|
|
8393
|
+
if (key.return)
|
|
8394
|
+
onNext();
|
|
8395
|
+
});
|
|
8396
|
+
return /* @__PURE__ */ jsxDEV5(Box5, {
|
|
8397
|
+
flexDirection: "column",
|
|
8398
|
+
gap: 1,
|
|
8399
|
+
children: [
|
|
8400
|
+
/* @__PURE__ */ jsxDEV5(Text5, {
|
|
8401
|
+
color: codeTheme.text,
|
|
8402
|
+
children: "Before entering the shell, Code probes the configured endpoint to avoid a dead setup on first use."
|
|
8403
|
+
}, undefined, false, undefined, this),
|
|
8404
|
+
status === "testing" ? /* @__PURE__ */ jsxDEV5(LoadingState, {
|
|
8405
|
+
message: "Testing model access",
|
|
8406
|
+
subMessage: "Polling the API with a minimal request."
|
|
8407
|
+
}, undefined, false, undefined, this) : null,
|
|
8408
|
+
status === "ok" ? /* @__PURE__ */ jsxDEV5(Text5, {
|
|
8409
|
+
color: codeTheme.success,
|
|
8410
|
+
children: "API check passed."
|
|
8411
|
+
}, undefined, false, undefined, this) : null,
|
|
8412
|
+
status === "warn" ? /* @__PURE__ */ jsxDEV5(Text5, {
|
|
8413
|
+
color: codeTheme.warning,
|
|
8414
|
+
children: "Could not fully validate. You can still continue."
|
|
8415
|
+
}, undefined, false, undefined, this) : null,
|
|
8416
|
+
/* @__PURE__ */ jsxDEV5(OnboardingHint, {
|
|
8417
|
+
children: "Press Enter to continue."
|
|
8418
|
+
}, undefined, false, undefined, this)
|
|
8419
|
+
]
|
|
8420
|
+
}, undefined, true, undefined, this);
|
|
8421
|
+
}
|
|
8422
|
+
var init_WizardStep3Test = __esm(() => {
|
|
8423
|
+
init_ProgressBar();
|
|
8424
|
+
init_theme();
|
|
8425
|
+
init_wizardHelper();
|
|
8426
|
+
});
|
|
8427
|
+
|
|
8428
|
+
// src/ui/wizard/WizardStep4Model.tsx
|
|
8429
|
+
import { useState as useState3 } from "react";
|
|
8430
|
+
import { Box as Box6, Text as Text6, useInput as useInput4 } from "ink";
|
|
8431
|
+
import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
|
|
8432
|
+
function WizardStep4Model({ onNext }) {
|
|
8433
|
+
const [modelIndex, setModelIndex] = useState3(0);
|
|
8434
|
+
const [langIndex, setLangIndex] = useState3(0);
|
|
8435
|
+
const [editing, setEditing] = useState3("model");
|
|
8436
|
+
useInput4((_, key) => {
|
|
8437
|
+
if (key.upArrow) {
|
|
8438
|
+
if (editing === "model")
|
|
8439
|
+
setModelIndex((i) => Math.max(0, i - 1));
|
|
8440
|
+
else
|
|
8441
|
+
setLangIndex((i) => Math.max(0, i - 1));
|
|
8442
|
+
return;
|
|
8443
|
+
}
|
|
8444
|
+
if (key.downArrow) {
|
|
8445
|
+
if (editing === "model")
|
|
8446
|
+
setModelIndex((i) => Math.min(MODELS.length - 1, i + 1));
|
|
8447
|
+
else
|
|
8448
|
+
setLangIndex((i) => Math.min(LANGUAGES.length - 1, i + 1));
|
|
8449
|
+
return;
|
|
8450
|
+
}
|
|
8451
|
+
if (key.tab) {
|
|
8452
|
+
setEditing((e) => e === "model" ? "lang" : "model");
|
|
8453
|
+
return;
|
|
8454
|
+
}
|
|
8455
|
+
if (key.return) {
|
|
8456
|
+
onNext(MODELS[modelIndex], LANGUAGES[langIndex]);
|
|
8457
|
+
}
|
|
8458
|
+
});
|
|
8459
|
+
return /* @__PURE__ */ jsxDEV6(Box6, {
|
|
8460
|
+
flexDirection: "column",
|
|
8461
|
+
gap: 1,
|
|
8462
|
+
children: [
|
|
8463
|
+
/* @__PURE__ */ jsxDEV6(Text6, {
|
|
8464
|
+
color: codeTheme.text,
|
|
8465
|
+
children: "Pick the default routing posture for the shell. You can still override it later with `/model`."
|
|
8466
|
+
}, undefined, false, undefined, this),
|
|
8467
|
+
/* @__PURE__ */ jsxDEV6(Box6, {
|
|
8468
|
+
marginTop: 1,
|
|
8469
|
+
flexDirection: "column",
|
|
8470
|
+
children: [
|
|
8471
|
+
/* @__PURE__ */ jsxDEV6(Text6, {
|
|
8472
|
+
color: codeTheme.muted,
|
|
8473
|
+
children: "Model"
|
|
8474
|
+
}, undefined, false, undefined, this),
|
|
8475
|
+
MODELS.map((model, index) => /* @__PURE__ */ jsxDEV6(OnboardingChoice, {
|
|
8476
|
+
active: editing === "model" && modelIndex === index,
|
|
8477
|
+
label: model,
|
|
8478
|
+
detail: model === "mistral" ? "Balanced default for day-to-day execution." : model === "gemini-fast" ? "Fast response profile for lightweight tasks." : "Bigger-context profile for heavier planning."
|
|
8479
|
+
}, model, false, undefined, this))
|
|
8480
|
+
]
|
|
8481
|
+
}, undefined, true, undefined, this),
|
|
8482
|
+
/* @__PURE__ */ jsxDEV6(Box6, {
|
|
8483
|
+
flexDirection: "column",
|
|
8484
|
+
children: [
|
|
8485
|
+
/* @__PURE__ */ jsxDEV6(Text6, {
|
|
8486
|
+
color: codeTheme.muted,
|
|
8487
|
+
children: "Language"
|
|
8488
|
+
}, undefined, false, undefined, this),
|
|
8489
|
+
LANGUAGES.map((language, index) => /* @__PURE__ */ jsxDEV6(OnboardingChoice, {
|
|
8490
|
+
active: editing === "lang" && langIndex === index,
|
|
8491
|
+
label: language,
|
|
8492
|
+
detail: language === "auto" ? "Infer from the environment." : `Force ${language.toUpperCase()} responses.`
|
|
8493
|
+
}, language, false, undefined, this))
|
|
8494
|
+
]
|
|
8495
|
+
}, undefined, true, undefined, this),
|
|
8496
|
+
/* @__PURE__ */ jsxDEV6(OnboardingHint, {
|
|
8497
|
+
children: "Use Up/Down to change the active field, Tab to switch field, Enter to continue."
|
|
8498
|
+
}, undefined, false, undefined, this)
|
|
8499
|
+
]
|
|
8500
|
+
}, undefined, true, undefined, this);
|
|
8501
|
+
}
|
|
8502
|
+
var MODELS, LANGUAGES;
|
|
8503
|
+
var init_WizardStep4Model = __esm(() => {
|
|
8504
|
+
init_theme();
|
|
8505
|
+
init_wizardHelper();
|
|
8506
|
+
MODELS = ["mistral", "gemini-fast", "kimi"];
|
|
8507
|
+
LANGUAGES = ["auto", "fr", "en"];
|
|
8508
|
+
});
|
|
8509
|
+
|
|
8510
|
+
// src/ui/wizard/WizardStep5Features.tsx
|
|
8511
|
+
import { useEffect as useEffect2, useState as useState4 } from "react";
|
|
8512
|
+
import { Box as Box7, Text as Text7, useInput as useInput5 } from "ink";
|
|
8513
|
+
import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
|
|
8514
|
+
function WizardStep5Features({ diagnostics, onNext }) {
|
|
8515
|
+
const [detecting, setDetecting] = useState4(true);
|
|
8516
|
+
const [dockerAvailable, setDockerAvailable] = useState4(false);
|
|
8517
|
+
const [visionCached, setVisionCached] = useState4(false);
|
|
8518
|
+
const [embedCached, setEmbedCached] = useState4(false);
|
|
8519
|
+
const [downloading, setDownloading] = useState4(false);
|
|
8520
|
+
const [downloadChoice, setDownloadChoice] = useState4(null);
|
|
8521
|
+
const [downloadLabel, setDownloadLabel] = useState4("Preparation...");
|
|
8522
|
+
const [downloadError, setDownloadError] = useState4("");
|
|
8523
|
+
const runtimeReady = diagnostics?.capabilities.find((item) => item.key === "transformers")?.status === "ready";
|
|
8524
|
+
useEffect2(() => {
|
|
8256
8525
|
(async () => {
|
|
8257
8526
|
const [hasDocker, visionReady, embedReady] = await Promise.all([
|
|
8258
8527
|
detectDockerAvailability(),
|
|
@@ -8353,98 +8622,98 @@ function WizardStep5Features({ diagnostics, onNext }) {
|
|
|
8353
8622
|
}
|
|
8354
8623
|
});
|
|
8355
8624
|
if (detecting) {
|
|
8356
|
-
return /* @__PURE__ */
|
|
8625
|
+
return /* @__PURE__ */ jsxDEV7(LoadingState, {
|
|
8357
8626
|
message: "Scanning local capabilities",
|
|
8358
8627
|
subMessage: "Inspecting Docker and local model cache."
|
|
8359
8628
|
}, undefined, false, undefined, this);
|
|
8360
8629
|
}
|
|
8361
8630
|
if (downloading) {
|
|
8362
|
-
return /* @__PURE__ */
|
|
8631
|
+
return /* @__PURE__ */ jsxDEV7(LoadingState, {
|
|
8363
8632
|
message: "Downloading local models",
|
|
8364
8633
|
subMessage: `${downloadLabel} Downloading sequentially to keep the setup stable.`
|
|
8365
8634
|
}, undefined, false, undefined, this);
|
|
8366
8635
|
}
|
|
8367
|
-
return /* @__PURE__ */
|
|
8636
|
+
return /* @__PURE__ */ jsxDEV7(Box7, {
|
|
8368
8637
|
flexDirection: "column",
|
|
8369
8638
|
gap: 1,
|
|
8370
8639
|
children: [
|
|
8371
|
-
/* @__PURE__ */
|
|
8640
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
8372
8641
|
color: codeTheme.text,
|
|
8373
8642
|
children: "Code can preload local models now or keep them lazy-loaded for the first real use."
|
|
8374
8643
|
}, undefined, false, undefined, this),
|
|
8375
|
-
/* @__PURE__ */
|
|
8644
|
+
/* @__PURE__ */ jsxDEV7(Box7, {
|
|
8376
8645
|
flexDirection: "column",
|
|
8377
8646
|
marginTop: 1,
|
|
8378
8647
|
children: [
|
|
8379
|
-
/* @__PURE__ */
|
|
8648
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8380
8649
|
label: "Shell runtime",
|
|
8381
8650
|
value: diagnostics?.shellLabel ?? "detecting...",
|
|
8382
8651
|
tone: diagnostics ? diagnostics.shellSupportsPosix ? "success" : "warning" : "text"
|
|
8383
8652
|
}, undefined, false, undefined, this),
|
|
8384
|
-
/* @__PURE__ */
|
|
8653
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8385
8654
|
label: "Vision",
|
|
8386
8655
|
value: "embedded local pipeline",
|
|
8387
8656
|
tone: "success"
|
|
8388
8657
|
}, undefined, false, undefined, this),
|
|
8389
|
-
/* @__PURE__ */
|
|
8658
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8390
8659
|
label: "Embeddings",
|
|
8391
8660
|
value: "semantic index ready",
|
|
8392
8661
|
tone: "success"
|
|
8393
8662
|
}, undefined, false, undefined, this),
|
|
8394
|
-
/* @__PURE__ */
|
|
8663
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8395
8664
|
label: "Sandbox",
|
|
8396
8665
|
value: dockerAvailable ? "docker available" : "safe mode only",
|
|
8397
8666
|
tone: dockerAvailable ? "success" : "warning"
|
|
8398
8667
|
}, undefined, false, undefined, this),
|
|
8399
|
-
/* @__PURE__ */
|
|
8668
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8400
8669
|
label: "Vision cache",
|
|
8401
8670
|
value: visionCached ? "already cached" : "download required",
|
|
8402
8671
|
tone: visionCached ? "success" : "warning"
|
|
8403
8672
|
}, undefined, false, undefined, this),
|
|
8404
|
-
/* @__PURE__ */
|
|
8673
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8405
8674
|
label: "Embedding cache",
|
|
8406
8675
|
value: embedCached ? "already cached" : "download required",
|
|
8407
8676
|
tone: embedCached ? "success" : "warning"
|
|
8408
8677
|
}, undefined, false, undefined, this),
|
|
8409
|
-
/* @__PURE__ */
|
|
8678
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8410
8679
|
label: "Image preprocessing",
|
|
8411
8680
|
value: diagnostics?.capabilities.find((item) => item.key === "sharp")?.detail ?? "detecting...",
|
|
8412
8681
|
tone: diagnostics?.capabilities.find((item) => item.key === "sharp")?.status === "ready" ? "success" : "warning"
|
|
8413
8682
|
}, undefined, false, undefined, this),
|
|
8414
|
-
/* @__PURE__ */
|
|
8683
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8415
8684
|
label: "Screenshots",
|
|
8416
8685
|
value: diagnostics?.capabilities.find((item) => item.key === "playwright")?.detail ?? "detecting...",
|
|
8417
8686
|
tone: diagnostics?.capabilities.find((item) => item.key === "playwright")?.status === "ready" ? "success" : "warning"
|
|
8418
8687
|
}, undefined, false, undefined, this),
|
|
8419
|
-
/* @__PURE__ */
|
|
8688
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8420
8689
|
label: "Validation",
|
|
8421
8690
|
value: "judge + transactions enabled",
|
|
8422
8691
|
tone: "success"
|
|
8423
8692
|
}, undefined, false, undefined, this)
|
|
8424
8693
|
]
|
|
8425
8694
|
}, undefined, true, undefined, this),
|
|
8426
|
-
!visionCached || !embedCached ? /* @__PURE__ */
|
|
8695
|
+
!visionCached || !embedCached ? /* @__PURE__ */ jsxDEV7(Box7, {
|
|
8427
8696
|
marginTop: 1,
|
|
8428
8697
|
flexDirection: "column",
|
|
8429
8698
|
children: [
|
|
8430
|
-
/* @__PURE__ */
|
|
8699
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
8431
8700
|
bold: true,
|
|
8432
8701
|
color: runtimeReady ? codeTheme.warning : codeTheme.danger,
|
|
8433
8702
|
children: runtimeReady ? "Download local models now? [y/n]" : "Local runtime missing - preload unavailable"
|
|
8434
8703
|
}, undefined, false, undefined, this),
|
|
8435
|
-
/* @__PURE__ */
|
|
8704
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
8436
8705
|
color: codeTheme.muted,
|
|
8437
8706
|
children: runtimeReady ? "Vision + embeddings. Download size varies by model version and runtime." : "Install dependencies so @huggingface/transformers is available, then rerun setup."
|
|
8438
8707
|
}, undefined, false, undefined, this)
|
|
8439
8708
|
]
|
|
8440
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
8709
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV7(OnboardingHint, {
|
|
8441
8710
|
children: "Press Enter to continue."
|
|
8442
8711
|
}, undefined, false, undefined, this),
|
|
8443
|
-
downloadError ? /* @__PURE__ */
|
|
8712
|
+
downloadError ? /* @__PURE__ */ jsxDEV7(Text7, {
|
|
8444
8713
|
color: codeTheme.danger,
|
|
8445
8714
|
children: downloadError
|
|
8446
8715
|
}, undefined, false, undefined, this) : null,
|
|
8447
|
-
!visionCached && !embedCached && !runtimeReady ? /* @__PURE__ */
|
|
8716
|
+
!visionCached && !embedCached && !runtimeReady ? /* @__PURE__ */ jsxDEV7(OnboardingHint, {
|
|
8448
8717
|
children: "Press Enter to continue without local preload."
|
|
8449
8718
|
}, undefined, false, undefined, this) : null
|
|
8450
8719
|
]
|
|
@@ -8459,426 +8728,213 @@ var init_WizardStep5Features = __esm(() => {
|
|
|
8459
8728
|
});
|
|
8460
8729
|
|
|
8461
8730
|
// src/ui/wizard/WizardStep6Ready.tsx
|
|
8462
|
-
import { Box as
|
|
8463
|
-
import { jsxDEV as
|
|
8731
|
+
import { Box as Box8, Text as Text8, useInput as useInput6 } from "ink";
|
|
8732
|
+
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
8464
8733
|
function WizardStep6Ready({ data, diagnostics, onNext }) {
|
|
8465
8734
|
useInput6((_, key) => {
|
|
8466
8735
|
if (key.return)
|
|
8467
8736
|
onNext();
|
|
8468
8737
|
});
|
|
8469
8738
|
const preloadLabel = data.modelPreloadStatus === "already_cached" ? "already cached" : data.modelPreloadStatus === "downloaded" ? "downloaded now" : data.modelPreloadStatus === "runtime_missing" ? "unavailable (runtime missing)" : data.modelPreloadStatus === "failed" ? "download failed" : "lazy on first use";
|
|
8470
|
-
return /* @__PURE__ */
|
|
8739
|
+
return /* @__PURE__ */ jsxDEV8(Box8, {
|
|
8471
8740
|
flexDirection: "column",
|
|
8472
8741
|
gap: 1,
|
|
8473
8742
|
children: [
|
|
8474
|
-
/* @__PURE__ */
|
|
8743
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8475
8744
|
color: codeTheme.text,
|
|
8476
8745
|
children: "The shell is configured. This is the runtime profile Code will start with."
|
|
8477
8746
|
}, undefined, false, undefined, this),
|
|
8478
|
-
/* @__PURE__ */
|
|
8747
|
+
/* @__PURE__ */ jsxDEV8(Box8, {
|
|
8479
8748
|
marginTop: 1,
|
|
8480
8749
|
flexDirection: "column",
|
|
8481
8750
|
children: [
|
|
8482
|
-
/* @__PURE__ */
|
|
8751
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8483
8752
|
label: "Default model",
|
|
8484
8753
|
value: data.model
|
|
8485
8754
|
}, undefined, false, undefined, this),
|
|
8486
|
-
/* @__PURE__ */
|
|
8755
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8487
8756
|
label: "Language",
|
|
8488
8757
|
value: data.language
|
|
8489
8758
|
}, undefined, false, undefined, this),
|
|
8490
|
-
/* @__PURE__ */
|
|
8759
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8491
8760
|
label: "Vision",
|
|
8492
8761
|
value: data.visionSource
|
|
8493
8762
|
}, undefined, false, undefined, this),
|
|
8494
|
-
/* @__PURE__ */
|
|
8763
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8495
8764
|
label: "Sandbox",
|
|
8496
8765
|
value: data.sandboxMode
|
|
8497
8766
|
}, undefined, false, undefined, this),
|
|
8498
|
-
/* @__PURE__ */
|
|
8767
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8499
8768
|
label: "Model preload",
|
|
8500
8769
|
value: preloadLabel,
|
|
8501
8770
|
tone: data.modelPreloadStatus === "downloaded" || data.modelPreloadStatus === "already_cached" ? "success" : data.modelPreloadStatus === "runtime_missing" || data.modelPreloadStatus === "failed" ? "warning" : "text"
|
|
8502
8771
|
}, undefined, false, undefined, this)
|
|
8503
8772
|
]
|
|
8504
8773
|
}, undefined, true, undefined, this),
|
|
8505
|
-
/* @__PURE__ */
|
|
8774
|
+
/* @__PURE__ */ jsxDEV8(Box8, {
|
|
8506
8775
|
marginTop: 1,
|
|
8507
8776
|
flexDirection: "column",
|
|
8508
8777
|
children: [
|
|
8509
|
-
/* @__PURE__ */
|
|
8778
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8510
8779
|
color: codeTheme.brandStrong,
|
|
8511
8780
|
children: "Ready for first task"
|
|
8512
8781
|
}, undefined, false, undefined, this),
|
|
8513
|
-
/* @__PURE__ */
|
|
8782
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8514
8783
|
color: codeTheme.muted,
|
|
8515
8784
|
children: "Chat opens as the OAL SARL Code shell with the UI language and model defaults you picked here."
|
|
8516
8785
|
}, undefined, false, undefined, this)
|
|
8517
8786
|
]
|
|
8518
8787
|
}, undefined, true, undefined, this),
|
|
8519
|
-
data.modelPreloadStatus === "failed" || data.modelPreloadStatus === "runtime_missing" ? /* @__PURE__ */
|
|
8788
|
+
data.modelPreloadStatus === "failed" || data.modelPreloadStatus === "runtime_missing" ? /* @__PURE__ */ jsxDEV8(Box8, {
|
|
8520
8789
|
marginTop: 1,
|
|
8521
8790
|
flexDirection: "column",
|
|
8522
8791
|
children: [
|
|
8523
|
-
/* @__PURE__ */
|
|
8792
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8524
8793
|
color: codeTheme.warning,
|
|
8525
8794
|
children: "Local model preload issue"
|
|
8526
8795
|
}, undefined, false, undefined, this),
|
|
8527
|
-
/* @__PURE__ */
|
|
8796
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8528
8797
|
color: codeTheme.muted,
|
|
8529
8798
|
children: data.modelPreloadError ?? "Local models were not preloaded. Code can still start, and local capabilities can be retried later."
|
|
8530
8799
|
}, undefined, false, undefined, this)
|
|
8531
8800
|
]
|
|
8532
8801
|
}, undefined, true, undefined, this) : null,
|
|
8533
|
-
diagnostics && diagnostics.warnings.length > 0 ? /* @__PURE__ */
|
|
8802
|
+
diagnostics && diagnostics.warnings.length > 0 ? /* @__PURE__ */ jsxDEV8(Box8, {
|
|
8534
8803
|
marginTop: 1,
|
|
8535
8804
|
flexDirection: "column",
|
|
8536
8805
|
children: [
|
|
8537
|
-
/* @__PURE__ */
|
|
8806
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8538
8807
|
color: codeTheme.warning,
|
|
8539
8808
|
children: "Attention before launch"
|
|
8540
8809
|
}, undefined, false, undefined, this),
|
|
8541
|
-
diagnostics.warnings.slice(0, 3).map((warning) => /* @__PURE__ */
|
|
8810
|
+
diagnostics.warnings.slice(0, 3).map((warning) => /* @__PURE__ */ jsxDEV8(Text8, {
|
|
8542
8811
|
color: codeTheme.muted,
|
|
8543
8812
|
children: warning
|
|
8544
|
-
}, warning, false, undefined, this))
|
|
8545
|
-
]
|
|
8546
|
-
}, undefined, true, undefined, this) : null,
|
|
8547
|
-
/* @__PURE__ */ jsxDEV7(OnboardingHint, {
|
|
8548
|
-
children: "Press Enter to start Code."
|
|
8549
|
-
}, undefined, false, undefined, this)
|
|
8550
|
-
]
|
|
8551
|
-
}, undefined, true, undefined, this);
|
|
8552
|
-
}
|
|
8553
|
-
var init_WizardStep6Ready = __esm(() => {
|
|
8554
|
-
init_theme();
|
|
8555
|
-
init_wizardHelper();
|
|
8556
|
-
});
|
|
8557
|
-
|
|
8558
|
-
// src/ui/wizard/WizardContainer.tsx
|
|
8559
|
-
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
8560
|
-
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
8561
|
-
function WizardContainer({ onComplete }) {
|
|
8562
|
-
const [step, setStep] = useState5(1);
|
|
8563
|
-
const [data, setData] = useState5({});
|
|
8564
|
-
const [diagnostics, setDiagnostics] = useState5(null);
|
|
8565
|
-
const total = 6;
|
|
8566
|
-
useEffect3(() => {
|
|
8567
|
-
(async () => {
|
|
8568
|
-
const nextDiagnostics = await detectPlatformDiagnostics().catch(() => null);
|
|
8569
|
-
setDiagnostics(nextDiagnostics);
|
|
8570
|
-
})();
|
|
8571
|
-
}, []);
|
|
8572
|
-
const next = async (partial) => {
|
|
8573
|
-
const merged = { ...data, ...partial };
|
|
8574
|
-
setData(merged);
|
|
8575
|
-
if (step < total) {
|
|
8576
|
-
if (step === 5) {
|
|
8577
|
-
const nextDiagnostics = await detectPlatformDiagnostics().catch(() => null);
|
|
8578
|
-
setDiagnostics(nextDiagnostics);
|
|
8579
|
-
}
|
|
8580
|
-
setStep(step + 1);
|
|
8581
|
-
return;
|
|
8582
|
-
}
|
|
8583
|
-
settings.setApiKey(merged.apiKey ?? "");
|
|
8584
|
-
settings.set("defaultModel", merged.model ?? "mistral");
|
|
8585
|
-
settings.set("language", merged.language ?? "auto");
|
|
8586
|
-
settings.set("visionModel", merged.visionSource ?? "embedded");
|
|
8587
|
-
settings.set("sandboxMode", merged.sandboxMode ?? "safe");
|
|
8588
|
-
settings.set("visionModelCached", await isModelCached(VISION_MODEL_ID));
|
|
8589
|
-
settings.set("embeddingModelCached", await isModelCached(EMBED_MODEL_ID));
|
|
8590
|
-
settings.set("setupCompleted", true);
|
|
8591
|
-
settings.set("setupVersion", CURRENT_SETUP_VERSION);
|
|
8592
|
-
onComplete(merged);
|
|
8593
|
-
};
|
|
8594
|
-
const steps = [
|
|
8595
|
-
/* @__PURE__ */ jsxDEV8(WizardStep1Welcome, {
|
|
8596
|
-
diagnostics,
|
|
8597
|
-
onNext: () => void next({})
|
|
8598
|
-
}, 1, false, undefined, this),
|
|
8599
|
-
/* @__PURE__ */ jsxDEV8(WizardStep2ApiKey, {
|
|
8600
|
-
onNext: (apiKey) => void next({ apiKey })
|
|
8601
|
-
}, 2, false, undefined, this),
|
|
8602
|
-
/* @__PURE__ */ jsxDEV8(WizardStep3Test, {
|
|
8603
|
-
apiKey: data.apiKey ?? "",
|
|
8604
|
-
onNext: () => void next({})
|
|
8605
|
-
}, 3, false, undefined, this),
|
|
8606
|
-
/* @__PURE__ */ jsxDEV8(WizardStep4Model, {
|
|
8607
|
-
onNext: (model, language) => void next({ model, language })
|
|
8608
|
-
}, 4, false, undefined, this),
|
|
8609
|
-
/* @__PURE__ */ jsxDEV8(WizardStep5Features, {
|
|
8610
|
-
diagnostics,
|
|
8611
|
-
onNext: (opts) => void next(opts)
|
|
8612
|
-
}, 5, false, undefined, this),
|
|
8613
|
-
/* @__PURE__ */ jsxDEV8(WizardStep6Ready, {
|
|
8614
|
-
data,
|
|
8615
|
-
diagnostics,
|
|
8616
|
-
onNext: () => void next({})
|
|
8617
|
-
}, 6, false, undefined, this)
|
|
8618
|
-
];
|
|
8619
|
-
const stepMeta = [
|
|
8620
|
-
{
|
|
8621
|
-
eyebrow: "Orientation",
|
|
8622
|
-
title: "Start with the shell",
|
|
8623
|
-
description: "Get the product shape, capabilities and operating mode before configuration."
|
|
8624
|
-
},
|
|
8625
|
-
{
|
|
8626
|
-
eyebrow: "Security",
|
|
8627
|
-
title: "Connect the model",
|
|
8628
|
-
description: "Register the API key and validate the trust boundary early."
|
|
8629
|
-
},
|
|
8630
|
-
{
|
|
8631
|
-
eyebrow: "Connectivity",
|
|
8632
|
-
title: "Probe the runtime",
|
|
8633
|
-
description: "Check that Code can actually reach the configured model endpoint."
|
|
8634
|
-
},
|
|
8635
|
-
{
|
|
8636
|
-
eyebrow: "Defaults",
|
|
8637
|
-
title: "Choose your working style",
|
|
8638
|
-
description: "Select default model and language for the shell and non-TTY runs."
|
|
8639
|
-
},
|
|
8640
|
-
{
|
|
8641
|
-
eyebrow: "Local capabilities",
|
|
8642
|
-
title: "Enable embedded features",
|
|
8643
|
-
description: "Inspect sandbox and local model cache before the first real task."
|
|
8644
|
-
},
|
|
8645
|
-
{
|
|
8646
|
-
eyebrow: "Ready",
|
|
8647
|
-
title: "Review and launch",
|
|
8648
|
-
description: "Confirm the final setup and enter the product with a clear runtime profile."
|
|
8649
|
-
}
|
|
8650
|
-
];
|
|
8651
|
-
return /* @__PURE__ */ jsxDEV8(OnboardingShell, {
|
|
8652
|
-
step,
|
|
8653
|
-
total,
|
|
8654
|
-
steps: stepMeta,
|
|
8655
|
-
children: steps[step - 1]
|
|
8656
|
-
}, undefined, false, undefined, this);
|
|
8657
|
-
}
|
|
8658
|
-
var init_WizardContainer = __esm(() => {
|
|
8659
|
-
init_settings();
|
|
8660
|
-
init_modelManager();
|
|
8661
|
-
init_platformDiagnostics();
|
|
8662
|
-
init_WizardStep1Welcome();
|
|
8663
|
-
init_WizardStep2ApiKey();
|
|
8664
|
-
init_WizardStep3Test();
|
|
8665
|
-
init_WizardStep4Model();
|
|
8666
|
-
init_WizardStep5Features();
|
|
8667
|
-
init_WizardStep6Ready();
|
|
8668
|
-
init_wizardHelper();
|
|
8669
|
-
});
|
|
8670
|
-
|
|
8671
|
-
// src/ui/wizard/wizardHelper.tsx
|
|
8672
|
-
var exports_wizardHelper = {};
|
|
8673
|
-
__export(exports_wizardHelper, {
|
|
8674
|
-
waitForWizard: () => waitForWizard,
|
|
8675
|
-
OnboardingShell: () => OnboardingShell,
|
|
8676
|
-
OnboardingMetric: () => OnboardingMetric,
|
|
8677
|
-
OnboardingHint: () => OnboardingHint,
|
|
8678
|
-
OnboardingChoice: () => OnboardingChoice
|
|
8679
|
-
});
|
|
8680
|
-
import { Box as Box8, Text as Text8, render } from "ink";
|
|
8681
|
-
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
8682
|
-
function waitForWizard() {
|
|
8683
|
-
return new Promise((resolve) => {
|
|
8684
|
-
const instance = render(/* @__PURE__ */ jsxDEV9(WizardContainer, {
|
|
8685
|
-
onComplete: (data) => {
|
|
8686
|
-
instance.unmount();
|
|
8687
|
-
instance.waitUntilExit().then(() => resolve(data));
|
|
8688
|
-
}
|
|
8689
|
-
}, undefined, false, undefined, this));
|
|
8690
|
-
});
|
|
8691
|
-
}
|
|
8692
|
-
function OnboardingShell({ step, total, steps, children }) {
|
|
8693
|
-
const active = steps[Math.max(0, step - 1)];
|
|
8694
|
-
const progress = step / Math.max(total, 1) * 100;
|
|
8695
|
-
return /* @__PURE__ */ jsxDEV9(Box8, {
|
|
8696
|
-
flexDirection: "column",
|
|
8697
|
-
paddingX: 1,
|
|
8698
|
-
children: [
|
|
8699
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8700
|
-
justifyContent: "space-between",
|
|
8701
|
-
marginBottom: 1,
|
|
8702
|
-
children: [
|
|
8703
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8704
|
-
gap: 1,
|
|
8705
|
-
children: [
|
|
8706
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8707
|
-
bold: true,
|
|
8708
|
-
color: codeTheme.brandStrong,
|
|
8709
|
-
children: "Code"
|
|
8710
|
-
}, undefined, false, undefined, this),
|
|
8711
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8712
|
-
color: codeTheme.muted,
|
|
8713
|
-
children: "OAL SARL | v6 onboarding"
|
|
8714
|
-
}, undefined, false, undefined, this)
|
|
8715
|
-
]
|
|
8716
|
-
}, undefined, true, undefined, this),
|
|
8717
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8718
|
-
color: codeTheme.muted,
|
|
8719
|
-
children: [
|
|
8720
|
-
"Step ",
|
|
8721
|
-
step,
|
|
8722
|
-
"/",
|
|
8723
|
-
total
|
|
8724
|
-
]
|
|
8725
|
-
}, undefined, true, undefined, this)
|
|
8726
|
-
]
|
|
8727
|
-
}, undefined, true, undefined, this),
|
|
8728
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8729
|
-
marginBottom: 1,
|
|
8730
|
-
children: /* @__PURE__ */ jsxDEV9(ProgressBar, {
|
|
8731
|
-
progress,
|
|
8732
|
-
width: 34,
|
|
8733
|
-
color: codeTheme.brand,
|
|
8734
|
-
showPercentage: false
|
|
8735
|
-
}, undefined, false, undefined, this)
|
|
8736
|
-
}, undefined, false, undefined, this),
|
|
8737
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8738
|
-
borderStyle: "round",
|
|
8739
|
-
borderColor: codeTheme.line,
|
|
8740
|
-
paddingX: 1,
|
|
8741
|
-
paddingY: 1,
|
|
8742
|
-
children: [
|
|
8743
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8744
|
-
width: 26,
|
|
8745
|
-
marginRight: 2,
|
|
8746
|
-
flexDirection: "column",
|
|
8747
|
-
children: [
|
|
8748
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8749
|
-
color: codeTheme.muted,
|
|
8750
|
-
children: "Setup flow"
|
|
8751
|
-
}, undefined, false, undefined, this),
|
|
8752
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8753
|
-
marginTop: 1,
|
|
8754
|
-
flexDirection: "column",
|
|
8755
|
-
children: steps.map((item, index) => {
|
|
8756
|
-
const current = index + 1;
|
|
8757
|
-
const done = current < step;
|
|
8758
|
-
const activeStep = current === step;
|
|
8759
|
-
return /* @__PURE__ */ jsxDEV9(Box8, {
|
|
8760
|
-
marginBottom: 1,
|
|
8761
|
-
flexDirection: "column",
|
|
8762
|
-
children: [
|
|
8763
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8764
|
-
color: done ? codeTheme.success : activeStep ? codeTheme.brandStrong : codeTheme.muted,
|
|
8765
|
-
children: [
|
|
8766
|
-
done ? "OK" : activeStep ? ">" : "-",
|
|
8767
|
-
" ",
|
|
8768
|
-
item.title
|
|
8769
|
-
]
|
|
8770
|
-
}, undefined, true, undefined, this),
|
|
8771
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8772
|
-
color: activeStep ? codeTheme.text : codeTheme.muted,
|
|
8773
|
-
children: item.description
|
|
8774
|
-
}, undefined, false, undefined, this)
|
|
8775
|
-
]
|
|
8776
|
-
}, item.title, true, undefined, this);
|
|
8777
|
-
})
|
|
8778
|
-
}, undefined, false, undefined, this)
|
|
8779
|
-
]
|
|
8780
|
-
}, undefined, true, undefined, this),
|
|
8781
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8782
|
-
flexGrow: 1,
|
|
8783
|
-
flexDirection: "column",
|
|
8784
|
-
borderStyle: "round",
|
|
8785
|
-
borderColor: codeTheme.line,
|
|
8786
|
-
paddingX: 1,
|
|
8787
|
-
paddingY: 1,
|
|
8788
|
-
children: [
|
|
8789
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8790
|
-
color: codeTheme.accent,
|
|
8791
|
-
children: active.eyebrow
|
|
8792
|
-
}, undefined, false, undefined, this),
|
|
8793
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8794
|
-
bold: true,
|
|
8795
|
-
color: codeTheme.brandStrong,
|
|
8796
|
-
children: active.title
|
|
8797
|
-
}, undefined, false, undefined, this),
|
|
8798
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8799
|
-
color: codeTheme.muted,
|
|
8800
|
-
children: active.description
|
|
8801
|
-
}, undefined, false, undefined, this),
|
|
8802
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8803
|
-
marginTop: 1,
|
|
8804
|
-
flexDirection: "column",
|
|
8805
|
-
children
|
|
8806
|
-
}, undefined, false, undefined, this)
|
|
8807
|
-
]
|
|
8808
|
-
}, undefined, true, undefined, this)
|
|
8813
|
+
}, warning, false, undefined, this))
|
|
8809
8814
|
]
|
|
8810
|
-
}, undefined, true, undefined, this)
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
}
|
|
8814
|
-
function OnboardingHint({ children }) {
|
|
8815
|
-
return /* @__PURE__ */ jsxDEV9(Text8, {
|
|
8816
|
-
color: codeTheme.muted,
|
|
8817
|
-
children
|
|
8818
|
-
}, undefined, false, undefined, this);
|
|
8819
|
-
}
|
|
8820
|
-
function OnboardingMetric({
|
|
8821
|
-
label,
|
|
8822
|
-
value,
|
|
8823
|
-
tone = "text"
|
|
8824
|
-
}) {
|
|
8825
|
-
const color = tone === "success" ? codeTheme.success : tone === "warning" ? codeTheme.warning : codeTheme.text;
|
|
8826
|
-
return /* @__PURE__ */ jsxDEV9(Box8, {
|
|
8827
|
-
flexDirection: "row",
|
|
8828
|
-
gap: 2,
|
|
8829
|
-
children: [
|
|
8830
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8831
|
-
width: 20,
|
|
8832
|
-
flexShrink: 0,
|
|
8833
|
-
children: /* @__PURE__ */ jsxDEV9(Text8, {
|
|
8834
|
-
color: codeTheme.muted,
|
|
8835
|
-
children: label
|
|
8836
|
-
}, undefined, false, undefined, this)
|
|
8837
|
-
}, undefined, false, undefined, this),
|
|
8838
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8839
|
-
flexGrow: 1,
|
|
8840
|
-
children: /* @__PURE__ */ jsxDEV9(Text8, {
|
|
8841
|
-
color,
|
|
8842
|
-
wrap: "wrap",
|
|
8843
|
-
children: value
|
|
8844
|
-
}, undefined, false, undefined, this)
|
|
8815
|
+
}, undefined, true, undefined, this) : null,
|
|
8816
|
+
/* @__PURE__ */ jsxDEV8(OnboardingHint, {
|
|
8817
|
+
children: "Press Enter to start Code."
|
|
8845
8818
|
}, undefined, false, undefined, this)
|
|
8846
8819
|
]
|
|
8847
8820
|
}, undefined, true, undefined, this);
|
|
8848
8821
|
}
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8822
|
+
var init_WizardStep6Ready = __esm(() => {
|
|
8823
|
+
init_theme();
|
|
8824
|
+
init_wizardHelper();
|
|
8825
|
+
});
|
|
8826
|
+
|
|
8827
|
+
// src/ui/wizard/WizardContainer.tsx
|
|
8828
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
8829
|
+
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
8830
|
+
function WizardContainer({ onComplete }) {
|
|
8831
|
+
const [step, setStep] = useState5(1);
|
|
8832
|
+
const [data, setData] = useState5({});
|
|
8833
|
+
const [diagnostics, setDiagnostics] = useState5(null);
|
|
8834
|
+
const total = 6;
|
|
8835
|
+
useEffect3(() => {
|
|
8836
|
+
(async () => {
|
|
8837
|
+
const nextDiagnostics = await detectPlatformDiagnostics().catch(() => null);
|
|
8838
|
+
setDiagnostics(nextDiagnostics);
|
|
8839
|
+
})();
|
|
8840
|
+
}, []);
|
|
8841
|
+
const next = async (partial) => {
|
|
8842
|
+
const merged = { ...data, ...partial };
|
|
8843
|
+
setData(merged);
|
|
8844
|
+
if (step < total) {
|
|
8845
|
+
if (step === 5) {
|
|
8846
|
+
const nextDiagnostics = await detectPlatformDiagnostics().catch(() => null);
|
|
8847
|
+
setDiagnostics(nextDiagnostics);
|
|
8848
|
+
}
|
|
8849
|
+
setStep(step + 1);
|
|
8850
|
+
return;
|
|
8851
|
+
}
|
|
8852
|
+
settings.setApiKey(merged.apiKey ?? "");
|
|
8853
|
+
settings.set("defaultModel", merged.model ?? "mistral");
|
|
8854
|
+
settings.set("language", merged.language ?? "auto");
|
|
8855
|
+
settings.set("visionModel", merged.visionSource ?? "embedded");
|
|
8856
|
+
settings.set("sandboxMode", merged.sandboxMode ?? "safe");
|
|
8857
|
+
settings.set("visionModelCached", await isModelCached(VISION_MODEL_ID));
|
|
8858
|
+
settings.set("embeddingModelCached", await isModelCached(EMBED_MODEL_ID));
|
|
8859
|
+
settings.set("setupCompleted", true);
|
|
8860
|
+
settings.set("setupVersion", CURRENT_SETUP_VERSION);
|
|
8861
|
+
onComplete(merged);
|
|
8862
|
+
};
|
|
8863
|
+
const steps = [
|
|
8864
|
+
/* @__PURE__ */ jsxDEV9(WizardStep1Welcome, {
|
|
8865
|
+
diagnostics,
|
|
8866
|
+
onNext: () => void next({})
|
|
8867
|
+
}, 1, false, undefined, this),
|
|
8868
|
+
/* @__PURE__ */ jsxDEV9(WizardStep2ApiKey, {
|
|
8869
|
+
onNext: (apiKey) => void next({ apiKey })
|
|
8870
|
+
}, 2, false, undefined, this),
|
|
8871
|
+
/* @__PURE__ */ jsxDEV9(WizardStep3Test, {
|
|
8872
|
+
apiKey: data.apiKey ?? "",
|
|
8873
|
+
onNext: () => void next({})
|
|
8874
|
+
}, 3, false, undefined, this),
|
|
8875
|
+
/* @__PURE__ */ jsxDEV9(WizardStep4Model, {
|
|
8876
|
+
onNext: (model, language) => void next({ model, language })
|
|
8877
|
+
}, 4, false, undefined, this),
|
|
8878
|
+
/* @__PURE__ */ jsxDEV9(WizardStep5Features, {
|
|
8879
|
+
diagnostics,
|
|
8880
|
+
onNext: (opts) => void next(opts)
|
|
8881
|
+
}, 5, false, undefined, this),
|
|
8882
|
+
/* @__PURE__ */ jsxDEV9(WizardStep6Ready, {
|
|
8883
|
+
data,
|
|
8884
|
+
diagnostics,
|
|
8885
|
+
onNext: () => void next({})
|
|
8886
|
+
}, 6, false, undefined, this)
|
|
8887
|
+
];
|
|
8888
|
+
const stepMeta = [
|
|
8889
|
+
{
|
|
8890
|
+
eyebrow: "Orientation",
|
|
8891
|
+
title: "Start with the shell",
|
|
8892
|
+
description: "Get the product shape, capabilities and operating mode before configuration."
|
|
8893
|
+
},
|
|
8894
|
+
{
|
|
8895
|
+
eyebrow: "Security",
|
|
8896
|
+
title: "Connect the model",
|
|
8897
|
+
description: "Register the API key and validate the trust boundary early."
|
|
8898
|
+
},
|
|
8899
|
+
{
|
|
8900
|
+
eyebrow: "Connectivity",
|
|
8901
|
+
title: "Probe the runtime",
|
|
8902
|
+
description: "Check that Code can actually reach the configured model endpoint."
|
|
8903
|
+
},
|
|
8904
|
+
{
|
|
8905
|
+
eyebrow: "Defaults",
|
|
8906
|
+
title: "Choose your working style",
|
|
8907
|
+
description: "Select default model and language for the shell and non-TTY runs."
|
|
8908
|
+
},
|
|
8909
|
+
{
|
|
8910
|
+
eyebrow: "Local capabilities",
|
|
8911
|
+
title: "Enable embedded features",
|
|
8912
|
+
description: "Inspect sandbox and local model cache before the first real task."
|
|
8913
|
+
},
|
|
8914
|
+
{
|
|
8915
|
+
eyebrow: "Ready",
|
|
8916
|
+
title: "Review and launch",
|
|
8917
|
+
description: "Confirm the final setup and enter the product with a clear runtime profile."
|
|
8918
|
+
}
|
|
8919
|
+
];
|
|
8920
|
+
return /* @__PURE__ */ jsxDEV9(OnboardingShell, {
|
|
8921
|
+
step,
|
|
8922
|
+
total,
|
|
8923
|
+
steps: stepMeta,
|
|
8924
|
+
children: steps[step - 1]
|
|
8876
8925
|
}, undefined, false, undefined, this);
|
|
8877
8926
|
}
|
|
8878
|
-
var
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8927
|
+
var init_WizardContainer = __esm(() => {
|
|
8928
|
+
init_settings();
|
|
8929
|
+
init_modelManager();
|
|
8930
|
+
init_platformDiagnostics();
|
|
8931
|
+
init_WizardStep1Welcome();
|
|
8932
|
+
init_WizardStep2ApiKey();
|
|
8933
|
+
init_WizardStep3Test();
|
|
8934
|
+
init_WizardStep4Model();
|
|
8935
|
+
init_WizardStep5Features();
|
|
8936
|
+
init_WizardStep6Ready();
|
|
8937
|
+
init_wizardHelper();
|
|
8882
8938
|
});
|
|
8883
8939
|
|
|
8884
8940
|
// src/ui/Header.tsx
|
|
@@ -14126,54 +14182,124 @@ var init_App = __esm(() => {
|
|
|
14126
14182
|
init_benchmarkRunner();
|
|
14127
14183
|
});
|
|
14128
14184
|
|
|
14129
|
-
// src/
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
import
|
|
14135
|
-
import
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14185
|
+
// src/ui/BootstrapShell.tsx
|
|
14186
|
+
var exports_BootstrapShell = {};
|
|
14187
|
+
__export(exports_BootstrapShell, {
|
|
14188
|
+
BootstrapShell: () => BootstrapShell
|
|
14189
|
+
});
|
|
14190
|
+
import { useEffect as useEffect5, useState as useState11 } from "react";
|
|
14191
|
+
import { Box as Box31, Text as Text31 } from "ink";
|
|
14192
|
+
import { jsxDEV as jsxDEV32 } from "react/jsx-dev-runtime";
|
|
14193
|
+
function ensureVisionSource() {
|
|
14194
|
+
const current = settings.get("visionModel");
|
|
14195
|
+
if (current === "embedded" || current === "pollinations" || current === "ollama")
|
|
14196
|
+
return;
|
|
14197
|
+
settings.set("visionModel", "embedded");
|
|
14198
|
+
}
|
|
14199
|
+
function BootstrapShell({ forceIndex = false }) {
|
|
14200
|
+
const [bootstrapDone, setBootstrapDone] = useState11(false);
|
|
14201
|
+
const [appProps, setAppProps] = useState11(null);
|
|
14202
|
+
const [error, setError] = useState11(null);
|
|
14203
|
+
useEffect5(() => {
|
|
14204
|
+
if (!bootstrapDone)
|
|
14205
|
+
return;
|
|
14206
|
+
let cancelled = false;
|
|
14207
|
+
(async () => {
|
|
14208
|
+
try {
|
|
14209
|
+
ensureVisionSource();
|
|
14210
|
+
const apiKey = settings.getApiKey();
|
|
14211
|
+
const [config, env, memory, projectFiles, allSkills, platformDiagnostics] = await Promise.all([
|
|
14212
|
+
loadCodeConfig(),
|
|
14213
|
+
detectEnvironment(),
|
|
14214
|
+
settings.get("enableMemory") ? loadMemory() : Promise.resolve(null),
|
|
14215
|
+
discoverProjectFiles(),
|
|
14216
|
+
settings.get("enableSkills") ? loadSkills() : Promise.resolve([]),
|
|
14217
|
+
detectPlatformDiagnostics()
|
|
14218
|
+
]);
|
|
14219
|
+
if (forceIndex && memory) {
|
|
14220
|
+
const sem = new SemanticMemory(memory.projectHash);
|
|
14221
|
+
await sem.indexProjectFiles(env.cwd ?? process.cwd()).catch(() => 0);
|
|
14222
|
+
}
|
|
14223
|
+
const projectContext = config.rawContent ? `Projet: ${env.projectName} (${env.fileCount} fichiers)
|
|
14156
14224
|
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14225
|
+
${config.rawContent}` : `Projet: ${env.projectName} (${env.fileCount} fichiers, ${env.language}, ${env.framework ?? "framework non detecte"})`;
|
|
14226
|
+
const startupNotice = buildStartupDiagnosticsNotice(platformDiagnostics);
|
|
14227
|
+
if (cancelled)
|
|
14228
|
+
return;
|
|
14229
|
+
setAppProps({
|
|
14230
|
+
apiKey,
|
|
14231
|
+
projectContext,
|
|
14232
|
+
env,
|
|
14233
|
+
memory,
|
|
14234
|
+
projectFiles,
|
|
14235
|
+
allSkills,
|
|
14236
|
+
startupMessages: startupNotice ? [startupNotice] : []
|
|
14237
|
+
});
|
|
14238
|
+
} catch (nextError) {
|
|
14239
|
+
if (!cancelled) {
|
|
14240
|
+
setError(nextError instanceof Error ? nextError.message : String(nextError));
|
|
14241
|
+
}
|
|
14242
|
+
}
|
|
14243
|
+
})();
|
|
14244
|
+
return () => {
|
|
14245
|
+
cancelled = true;
|
|
14246
|
+
};
|
|
14247
|
+
}, [bootstrapDone, forceIndex]);
|
|
14248
|
+
if (appProps) {
|
|
14249
|
+
return /* @__PURE__ */ jsxDEV32(App, {
|
|
14250
|
+
...appProps
|
|
14251
|
+
}, undefined, false, undefined, this);
|
|
14167
14252
|
}
|
|
14253
|
+
if (bootstrapDone) {
|
|
14254
|
+
if (error) {
|
|
14255
|
+
return /* @__PURE__ */ jsxDEV32(Box31, {
|
|
14256
|
+
flexDirection: "column",
|
|
14257
|
+
paddingX: 1,
|
|
14258
|
+
children: [
|
|
14259
|
+
/* @__PURE__ */ jsxDEV32(Text31, {
|
|
14260
|
+
color: codeTheme.danger,
|
|
14261
|
+
children: "Unable to launch Code after setup."
|
|
14262
|
+
}, undefined, false, undefined, this),
|
|
14263
|
+
/* @__PURE__ */ jsxDEV32(Text31, {
|
|
14264
|
+
color: codeTheme.muted,
|
|
14265
|
+
children: error
|
|
14266
|
+
}, undefined, false, undefined, this)
|
|
14267
|
+
]
|
|
14268
|
+
}, undefined, true, undefined, this);
|
|
14269
|
+
}
|
|
14270
|
+
return /* @__PURE__ */ jsxDEV32(LoadingState, {
|
|
14271
|
+
message: "Launching Code",
|
|
14272
|
+
subMessage: "Finalizing setup and preparing the shell."
|
|
14273
|
+
}, undefined, false, undefined, this);
|
|
14274
|
+
}
|
|
14275
|
+
return /* @__PURE__ */ jsxDEV32(WizardContainer, {
|
|
14276
|
+
onComplete: () => setBootstrapDone(true)
|
|
14277
|
+
}, undefined, false, undefined, this);
|
|
14168
14278
|
}
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14279
|
+
var init_BootstrapShell = __esm(() => {
|
|
14280
|
+
init_settings();
|
|
14281
|
+
init_codeMd();
|
|
14282
|
+
init_context();
|
|
14283
|
+
init_envDetector();
|
|
14284
|
+
init_platformDiagnostics();
|
|
14285
|
+
init_skillLoader();
|
|
14286
|
+
init_semanticMemory();
|
|
14287
|
+
init_WizardContainer();
|
|
14288
|
+
init_ProgressBar();
|
|
14289
|
+
init_App();
|
|
14290
|
+
init_theme();
|
|
14291
|
+
});
|
|
14173
14292
|
|
|
14174
14293
|
// src/index.ts
|
|
14294
|
+
init_settings();
|
|
14295
|
+
init_codeMd();
|
|
14175
14296
|
init_context();
|
|
14176
14297
|
init_agent();
|
|
14298
|
+
import { Command } from "commander";
|
|
14299
|
+
import { createInterface } from "readline";
|
|
14300
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
14301
|
+
import fs23 from "fs/promises";
|
|
14302
|
+
import path25 from "path";
|
|
14177
14303
|
|
|
14178
14304
|
// src/core/run-output.ts
|
|
14179
14305
|
function cleanRunOutput(text) {
|
|
@@ -14430,8 +14556,13 @@ async function startChat(opts) {
|
|
|
14430
14556
|
const setupRequired = opts.setup || opts.config || !settings.isSetupCurrent() || !hasValidApiKey();
|
|
14431
14557
|
if (setupRequired) {
|
|
14432
14558
|
if (useInkUi) {
|
|
14433
|
-
const {
|
|
14434
|
-
|
|
14559
|
+
const [{ render: render2 }, React13, { BootstrapShell: BootstrapShell2 }] = await Promise.all([
|
|
14560
|
+
import("ink"),
|
|
14561
|
+
import("react"),
|
|
14562
|
+
Promise.resolve().then(() => (init_BootstrapShell(), exports_BootstrapShell))
|
|
14563
|
+
]);
|
|
14564
|
+
render2(React13.createElement(BootstrapShell2, { forceIndex: opts.index }));
|
|
14565
|
+
return;
|
|
14435
14566
|
} else {
|
|
14436
14567
|
console.log("Mode non-TTY : entrez votre cle API Pollinations (pk_... ou sk_...):");
|
|
14437
14568
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -14477,12 +14608,12 @@ ${loaded.rawContent}` : `Projet: ${env.projectName} (${env.fileCount} fichiers,
|
|
|
14477
14608
|
}
|
|
14478
14609
|
}
|
|
14479
14610
|
if (useInkUi) {
|
|
14480
|
-
const [{ render: render2 },
|
|
14611
|
+
const [{ render: render2 }, React13, { App: App2 }] = await Promise.all([
|
|
14481
14612
|
import("ink"),
|
|
14482
14613
|
import("react"),
|
|
14483
14614
|
Promise.resolve().then(() => (init_App(), exports_App))
|
|
14484
14615
|
]);
|
|
14485
|
-
render2(
|
|
14616
|
+
render2(React13.createElement(App2, {
|
|
14486
14617
|
apiKey,
|
|
14487
14618
|
projectContext,
|
|
14488
14619
|
env,
|