@oal-sarl/code 6.0.0 → 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 +990 -848
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,7 +20,8 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
20
20
|
// src/config/settings.ts
|
|
21
21
|
var exports_settings = {};
|
|
22
22
|
__export(exports_settings, {
|
|
23
|
-
settings: () => settings
|
|
23
|
+
settings: () => settings,
|
|
24
|
+
CURRENT_SETUP_VERSION: () => CURRENT_SETUP_VERSION
|
|
24
25
|
});
|
|
25
26
|
import Conf from "conf";
|
|
26
27
|
function migrateLegacySettings() {
|
|
@@ -28,8 +29,13 @@ function migrateLegacySettings() {
|
|
|
28
29
|
if (currentVision === "none" || currentVision === "auto") {
|
|
29
30
|
store.set("visionModel", "embedded");
|
|
30
31
|
}
|
|
32
|
+
const setupVersion = store.get("setupVersion");
|
|
33
|
+
if (!Number.isFinite(setupVersion) || (setupVersion ?? 0) < CURRENT_SETUP_VERSION) {
|
|
34
|
+
store.set("setupCompleted", false);
|
|
35
|
+
store.set("setupVersion", CURRENT_SETUP_VERSION);
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
|
-
var store, settings;
|
|
38
|
+
var CURRENT_SETUP_VERSION = 2, store, settings;
|
|
33
39
|
var init_settings = __esm(() => {
|
|
34
40
|
store = new Conf({
|
|
35
41
|
projectName: "code",
|
|
@@ -53,6 +59,7 @@ var init_settings = __esm(() => {
|
|
|
53
59
|
previewServerPort: 7799,
|
|
54
60
|
enableMultiSession: true,
|
|
55
61
|
setupCompleted: false,
|
|
62
|
+
setupVersion: 0,
|
|
56
63
|
enableSkills: true,
|
|
57
64
|
enableTransactions: true,
|
|
58
65
|
enableJudge: true,
|
|
@@ -84,11 +91,50 @@ var init_settings = __esm(() => {
|
|
|
84
91
|
setApiKey: (key) => store.set("apiKey", key),
|
|
85
92
|
getDefaultModel: () => store.get("defaultModel"),
|
|
86
93
|
setDefaultModel: (model) => store.set("defaultModel", model),
|
|
94
|
+
isSetupCurrent: () => Boolean(store.get("setupCompleted")) && Number(store.get("setupVersion")) >= CURRENT_SETUP_VERSION,
|
|
87
95
|
get: (key) => store.get(key),
|
|
88
96
|
set: (key, val) => store.set(key, val)
|
|
89
97
|
};
|
|
90
98
|
});
|
|
91
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
|
+
|
|
92
138
|
// src/logging/logger.ts
|
|
93
139
|
function shouldWriteToStderr() {
|
|
94
140
|
if (IS_CI)
|
|
@@ -1991,17 +2037,44 @@ function isMissingQuantizedArtifactError(error) {
|
|
|
1991
2037
|
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
1992
2038
|
return /could not locate file/i.test(message) && /_q4|q4\.onnx|decoder_model_merged_q4/i.test(message);
|
|
1993
2039
|
}
|
|
1994
|
-
|
|
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) {
|
|
1995
2053
|
try {
|
|
1996
2054
|
return await pipeline("image-to-text", VISION_MODEL_ID, {
|
|
1997
2055
|
dtype: "q4",
|
|
1998
2056
|
device: "cpu"
|
|
1999
2057
|
});
|
|
2000
2058
|
} catch (error) {
|
|
2001
|
-
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)) {
|
|
2002
2074
|
throw error;
|
|
2003
2075
|
}
|
|
2004
|
-
logger.warn("
|
|
2076
|
+
logger.warn("vision_pipeline_cache_retry", { modelId: VISION_MODEL_ID });
|
|
2077
|
+
await purgeCache(VISION_MODEL_ID);
|
|
2005
2078
|
return pipeline("image-to-text", VISION_MODEL_ID, {
|
|
2006
2079
|
device: "cpu"
|
|
2007
2080
|
});
|
|
@@ -2035,12 +2108,12 @@ function configureLocalModelRuntime(env) {
|
|
|
2035
2108
|
env.localModelPath = MODELS_DIR;
|
|
2036
2109
|
env.allowRemoteModels = true;
|
|
2037
2110
|
}
|
|
2038
|
-
async function downloadModel(modelId, onProgress) {
|
|
2111
|
+
async function downloadModel(modelId, onProgress, loadRuntime = () => import("@huggingface/transformers")) {
|
|
2039
2112
|
logger.info("model_download_start", { modelId });
|
|
2040
2113
|
let pipeline;
|
|
2041
2114
|
let env;
|
|
2042
2115
|
try {
|
|
2043
|
-
({ pipeline, env } = await
|
|
2116
|
+
({ pipeline, env } = await loadRuntime());
|
|
2044
2117
|
} catch {
|
|
2045
2118
|
throw new Error("Le runtime local @huggingface/transformers n'est pas disponible. Installe-le pour telecharger les modeles embarques.");
|
|
2046
2119
|
}
|
|
@@ -2055,7 +2128,16 @@ async function downloadModel(modelId, onProgress) {
|
|
|
2055
2128
|
};
|
|
2056
2129
|
}
|
|
2057
2130
|
if (modelId === EMBED_MODEL_ID) {
|
|
2058
|
-
|
|
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
|
+
}
|
|
2059
2141
|
} else {
|
|
2060
2142
|
await loadEmbeddedVisionPipeline(pipeline);
|
|
2061
2143
|
}
|
|
@@ -7527,255 +7609,31 @@ var init_theme = __esm(() => {
|
|
|
7527
7609
|
};
|
|
7528
7610
|
});
|
|
7529
7611
|
|
|
7530
|
-
// src/ui/
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
value: "multi-context shell"
|
|
7553
|
-
}, undefined, false, undefined, this),
|
|
7554
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7555
|
-
label: "Validation",
|
|
7556
|
-
value: "judge + transactions"
|
|
7557
|
-
}, undefined, false, undefined, this),
|
|
7558
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7559
|
-
label: "Local features",
|
|
7560
|
-
value: "vision + semantic index"
|
|
7561
|
-
}, undefined, false, undefined, this),
|
|
7562
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7563
|
-
label: "Workflow",
|
|
7564
|
-
value: "skills + approvals + history"
|
|
7565
|
-
}, undefined, false, undefined, this)
|
|
7566
|
-
]
|
|
7567
|
-
}, undefined, true, undefined, this),
|
|
7568
|
-
/* @__PURE__ */ jsxDEV(Box, {
|
|
7569
|
-
marginTop: 1,
|
|
7570
|
-
flexDirection: "column",
|
|
7571
|
-
children: [
|
|
7572
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
7573
|
-
color: codeTheme.brandStrong,
|
|
7574
|
-
children: "What changes in v6"
|
|
7575
|
-
}, undefined, false, undefined, this),
|
|
7576
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
7577
|
-
color: codeTheme.muted,
|
|
7578
|
-
children: "Cleaner chat UI, stronger runtime visibility, safer approvals and model-backed planning."
|
|
7579
|
-
}, undefined, false, undefined, this)
|
|
7580
|
-
]
|
|
7581
|
-
}, undefined, true, undefined, this),
|
|
7582
|
-
/* @__PURE__ */ jsxDEV(Box, {
|
|
7583
|
-
marginTop: 1,
|
|
7584
|
-
flexDirection: "column",
|
|
7585
|
-
children: [
|
|
7586
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
7587
|
-
color: codeTheme.brandStrong,
|
|
7588
|
-
children: "Platform diagnostics"
|
|
7589
|
-
}, undefined, false, undefined, this),
|
|
7590
|
-
diagnostics ? /* @__PURE__ */ jsxDEV(Fragment, {
|
|
7591
|
-
children: [
|
|
7592
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7593
|
-
label: "Shell",
|
|
7594
|
-
value: diagnostics.shellLabel,
|
|
7595
|
-
tone: diagnostics.shellSupportsPosix ? "success" : "warning"
|
|
7596
|
-
}, undefined, false, undefined, this),
|
|
7597
|
-
/* @__PURE__ */ jsxDEV(OnboardingMetric, {
|
|
7598
|
-
label: "Warnings",
|
|
7599
|
-
value: diagnostics.warnings.length === 0 ? "none" : `${diagnostics.warnings.length} attention point(s)`,
|
|
7600
|
-
tone: diagnostics.warnings.length === 0 ? "success" : "warning"
|
|
7601
|
-
}, undefined, false, undefined, this)
|
|
7602
|
-
]
|
|
7603
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV(Text, {
|
|
7604
|
-
color: codeTheme.muted,
|
|
7605
|
-
children: "Scanning local shell, sandbox and optional capabilities..."
|
|
7606
|
-
}, undefined, false, undefined, this)
|
|
7607
|
-
]
|
|
7608
|
-
}, undefined, true, undefined, this),
|
|
7609
|
-
/* @__PURE__ */ jsxDEV(OnboardingHint, {
|
|
7610
|
-
children: "Press Enter to continue."
|
|
7611
|
-
}, undefined, false, undefined, this)
|
|
7612
|
-
]
|
|
7613
|
-
}, undefined, true, undefined, this);
|
|
7614
|
-
}
|
|
7615
|
-
var init_WizardStep1Welcome = __esm(() => {
|
|
7616
|
-
init_theme();
|
|
7617
|
-
init_wizardHelper();
|
|
7618
|
-
});
|
|
7619
|
-
|
|
7620
|
-
// src/ui/clipboard.ts
|
|
7621
|
-
import { spawnSync as spawnSync2 } from "child_process";
|
|
7622
|
-
function tryCommand(command, args) {
|
|
7623
|
-
try {
|
|
7624
|
-
const result = spawnSync2(command, args, { encoding: "utf-8", windowsHide: true });
|
|
7625
|
-
if (result.status === 0 && typeof result.stdout === "string" && result.stdout.length > 0) {
|
|
7626
|
-
return result.stdout;
|
|
7627
|
-
}
|
|
7628
|
-
} catch {}
|
|
7629
|
-
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;
|
|
7630
7634
|
}
|
|
7631
|
-
function
|
|
7632
|
-
|
|
7633
|
-
return tryCommand("powershell", ["-NoProfile", "-Command", "Get-Clipboard -Raw"]) ?? tryCommand("pwsh", ["-NoProfile", "-Command", "Get-Clipboard -Raw"]) ?? "";
|
|
7634
|
-
}
|
|
7635
|
-
if (process.platform === "darwin") {
|
|
7636
|
-
return tryCommand("pbpaste", []) ?? "";
|
|
7637
|
-
}
|
|
7638
|
-
return tryCommand("wl-paste", ["-n"]) ?? tryCommand("xclip", ["-selection", "clipboard", "-o"]) ?? "";
|
|
7639
|
-
}
|
|
7640
|
-
var init_clipboard = () => {};
|
|
7641
|
-
|
|
7642
|
-
// src/ui/wizard/WizardStep2ApiKey.tsx
|
|
7643
|
-
import { useState } from "react";
|
|
7644
|
-
import { Box as Box2, Text as Text2, useInput as useInput2 } from "ink";
|
|
7645
|
-
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
7646
|
-
function WizardStep2ApiKey({ onNext }) {
|
|
7647
|
-
const [value, setValue] = useState("");
|
|
7648
|
-
const [error, setError] = useState("");
|
|
7649
|
-
const [checking, setChecking] = useState(false);
|
|
7650
|
-
useInput2(async (input, key) => {
|
|
7651
|
-
if (key.return) {
|
|
7652
|
-
if (!/^(pk_|sk_)/.test(value)) {
|
|
7653
|
-
setError("La cle doit commencer par pk_ ou sk_.");
|
|
7654
|
-
return;
|
|
7655
|
-
}
|
|
7656
|
-
setChecking(true);
|
|
7657
|
-
setError("");
|
|
7658
|
-
try {
|
|
7659
|
-
const res = await fetch("https://gen.pollinations.ai/v1/chat/completions", {
|
|
7660
|
-
method: "POST",
|
|
7661
|
-
headers: {
|
|
7662
|
-
"Content-Type": "application/json",
|
|
7663
|
-
Authorization: `Bearer ${value}`
|
|
7664
|
-
},
|
|
7665
|
-
body: JSON.stringify({
|
|
7666
|
-
model: "mistral",
|
|
7667
|
-
messages: [{ role: "user", content: "hi" }],
|
|
7668
|
-
max_tokens: 5
|
|
7669
|
-
}),
|
|
7670
|
-
signal: AbortSignal.timeout(8000)
|
|
7671
|
-
});
|
|
7672
|
-
if (res.status === 401) {
|
|
7673
|
-
setError("Cle invalide.");
|
|
7674
|
-
setChecking(false);
|
|
7675
|
-
return;
|
|
7676
|
-
}
|
|
7677
|
-
} catch {
|
|
7678
|
-
setError("Impossible de verifier maintenant. La cle reste acceptee.");
|
|
7679
|
-
}
|
|
7680
|
-
setChecking(false);
|
|
7681
|
-
onNext(value);
|
|
7682
|
-
return;
|
|
7683
|
-
}
|
|
7684
|
-
if (key.backspace || key.delete) {
|
|
7685
|
-
setValue((prev) => prev.slice(0, -1));
|
|
7686
|
-
return;
|
|
7687
|
-
}
|
|
7688
|
-
if (key.ctrl && (input === "v" || input === "\x16")) {
|
|
7689
|
-
const pasted = readClipboardText().replace(/\r\n/g, `
|
|
7690
|
-
`);
|
|
7691
|
-
if (pasted)
|
|
7692
|
-
setValue((prev) => prev + pasted.trim());
|
|
7693
|
-
return;
|
|
7694
|
-
}
|
|
7695
|
-
if (!key.ctrl && !key.meta && input.length > 0) {
|
|
7696
|
-
setValue((prev) => prev + input);
|
|
7697
|
-
}
|
|
7698
|
-
});
|
|
7699
|
-
return /* @__PURE__ */ jsxDEV2(Box2, {
|
|
7700
|
-
flexDirection: "column",
|
|
7701
|
-
gap: 1,
|
|
7702
|
-
children: [
|
|
7703
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7704
|
-
color: codeTheme.text,
|
|
7705
|
-
children: "This key powers preflight, planning, execution and the judge. The shell keeps it local in your Code settings."
|
|
7706
|
-
}, undefined, false, undefined, this),
|
|
7707
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7708
|
-
color: codeTheme.muted,
|
|
7709
|
-
children: "Expected format: `pk_...` or `sk_...`"
|
|
7710
|
-
}, undefined, false, undefined, this),
|
|
7711
|
-
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7712
|
-
marginTop: 1,
|
|
7713
|
-
borderStyle: "round",
|
|
7714
|
-
borderColor: error ? codeTheme.danger : codeTheme.brand,
|
|
7715
|
-
paddingX: 1,
|
|
7716
|
-
children: [
|
|
7717
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7718
|
-
color: codeTheme.brandStrong,
|
|
7719
|
-
children: "key "
|
|
7720
|
-
}, undefined, false, undefined, this),
|
|
7721
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7722
|
-
color: codeTheme.text,
|
|
7723
|
-
children: [
|
|
7724
|
-
"*".repeat(Math.max(0, value.length - 6)),
|
|
7725
|
-
value.slice(-6)
|
|
7726
|
-
]
|
|
7727
|
-
}, undefined, true, undefined, this),
|
|
7728
|
-
/* @__PURE__ */ jsxDEV2(Text2, {
|
|
7729
|
-
color: codeTheme.brand,
|
|
7730
|
-
children: "|"
|
|
7731
|
-
}, undefined, false, undefined, this)
|
|
7732
|
-
]
|
|
7733
|
-
}, undefined, true, undefined, this),
|
|
7734
|
-
checking ? /* @__PURE__ */ jsxDEV2(Text2, {
|
|
7735
|
-
color: codeTheme.warning,
|
|
7736
|
-
children: "Verification in progress..."
|
|
7737
|
-
}, undefined, false, undefined, this) : null,
|
|
7738
|
-
error ? /* @__PURE__ */ jsxDEV2(Text2, {
|
|
7739
|
-
color: codeTheme.danger,
|
|
7740
|
-
children: error
|
|
7741
|
-
}, undefined, false, undefined, this) : null,
|
|
7742
|
-
/* @__PURE__ */ jsxDEV2(OnboardingHint, {
|
|
7743
|
-
children: "Ctrl+V to paste. Press Enter to validate and continue."
|
|
7744
|
-
}, undefined, false, undefined, this)
|
|
7745
|
-
]
|
|
7746
|
-
}, undefined, true, undefined, this);
|
|
7747
|
-
}
|
|
7748
|
-
var init_WizardStep2ApiKey = __esm(() => {
|
|
7749
|
-
init_clipboard();
|
|
7750
|
-
init_theme();
|
|
7751
|
-
init_wizardHelper();
|
|
7752
|
-
});
|
|
7753
|
-
|
|
7754
|
-
// src/ui/glyphs.ts
|
|
7755
|
-
function isUnicodeCapableTerminal() {
|
|
7756
|
-
const mode = process.env.CODE_GLYPHS?.toLowerCase() ?? "auto";
|
|
7757
|
-
if (mode === "ascii")
|
|
7758
|
-
return false;
|
|
7759
|
-
if (mode === "unicode")
|
|
7760
|
-
return true;
|
|
7761
|
-
if (process.platform !== "win32")
|
|
7762
|
-
return true;
|
|
7763
|
-
const term = (process.env.TERM ?? "").toLowerCase();
|
|
7764
|
-
const lang = (process.env.LC_ALL ?? process.env.LC_CTYPE ?? process.env.LANG ?? "").toLowerCase();
|
|
7765
|
-
if (process.env.WT_SESSION)
|
|
7766
|
-
return true;
|
|
7767
|
-
if (process.env.TERM_PROGRAM)
|
|
7768
|
-
return true;
|
|
7769
|
-
if ((process.env.ConEmuANSI ?? "").toUpperCase() === "ON")
|
|
7770
|
-
return true;
|
|
7771
|
-
if (term.includes("xterm") || term.includes("utf") || term.includes("256color"))
|
|
7772
|
-
return true;
|
|
7773
|
-
if (lang.includes("utf-8"))
|
|
7774
|
-
return true;
|
|
7775
|
-
return false;
|
|
7776
|
-
}
|
|
7777
|
-
function pickGlyph(unicode, ascii) {
|
|
7778
|
-
return isUnicodeCapableTerminal() ? unicode : ascii;
|
|
7635
|
+
function pickGlyph(unicode, ascii) {
|
|
7636
|
+
return isUnicodeCapableTerminal() ? unicode : ascii;
|
|
7779
7637
|
}
|
|
7780
7638
|
var ASCII_GLYPHS, UNICODE_GLYPHS, uiGlyphs;
|
|
7781
7639
|
var init_glyphs = __esm(() => {
|
|
@@ -7959,9 +7817,9 @@ var init_glyphs = __esm(() => {
|
|
|
7959
7817
|
});
|
|
7960
7818
|
|
|
7961
7819
|
// src/ui/ProgressBar.tsx
|
|
7962
|
-
import
|
|
7963
|
-
import { Box
|
|
7964
|
-
import { jsxDEV
|
|
7820
|
+
import React from "react";
|
|
7821
|
+
import { Box, Text } from "ink";
|
|
7822
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
7965
7823
|
function ProgressBar({
|
|
7966
7824
|
progress,
|
|
7967
7825
|
width = 30,
|
|
@@ -7973,10 +7831,10 @@ function ProgressBar({
|
|
|
7973
7831
|
const filled = Math.round(clampedProgress / 100 * width);
|
|
7974
7832
|
const empty = width - filled;
|
|
7975
7833
|
const bar = uiGlyphs.progressStart + uiGlyphs.progressFull.repeat(filled) + uiGlyphs.progressEmpty.repeat(empty) + uiGlyphs.progressEnd;
|
|
7976
|
-
return /* @__PURE__ */
|
|
7834
|
+
return /* @__PURE__ */ jsxDEV(Box, {
|
|
7977
7835
|
flexDirection: "column",
|
|
7978
7836
|
children: [
|
|
7979
|
-
label && /* @__PURE__ */
|
|
7837
|
+
label && /* @__PURE__ */ jsxDEV(Text, {
|
|
7980
7838
|
dimColor: true,
|
|
7981
7839
|
children: [
|
|
7982
7840
|
uiGlyphs.bullet,
|
|
@@ -7984,13 +7842,13 @@ function ProgressBar({
|
|
|
7984
7842
|
label
|
|
7985
7843
|
]
|
|
7986
7844
|
}, undefined, true, undefined, this),
|
|
7987
|
-
/* @__PURE__ */
|
|
7845
|
+
/* @__PURE__ */ jsxDEV(Box, {
|
|
7988
7846
|
children: [
|
|
7989
|
-
/* @__PURE__ */
|
|
7847
|
+
/* @__PURE__ */ jsxDEV(Text, {
|
|
7990
7848
|
color,
|
|
7991
7849
|
children: bar
|
|
7992
7850
|
}, undefined, false, undefined, this),
|
|
7993
|
-
showPercentage && /* @__PURE__ */
|
|
7851
|
+
showPercentage && /* @__PURE__ */ jsxDEV(Text, {
|
|
7994
7852
|
dimColor: true,
|
|
7995
7853
|
children: [
|
|
7996
7854
|
" ",
|
|
@@ -8004,20 +7862,20 @@ function ProgressBar({
|
|
|
8004
7862
|
}, undefined, true, undefined, this);
|
|
8005
7863
|
}
|
|
8006
7864
|
function Spinner({ message, color = codeTheme.brand }) {
|
|
8007
|
-
const [frame, setFrame] =
|
|
8008
|
-
|
|
7865
|
+
const [frame, setFrame] = React.useState(0);
|
|
7866
|
+
React.useEffect(() => {
|
|
8009
7867
|
const interval = setInterval(() => {
|
|
8010
7868
|
setFrame((prev) => (prev + 1) % uiGlyphs.spinner.length);
|
|
8011
7869
|
}, 100);
|
|
8012
7870
|
return () => clearInterval(interval);
|
|
8013
7871
|
}, []);
|
|
8014
|
-
return /* @__PURE__ */
|
|
7872
|
+
return /* @__PURE__ */ jsxDEV(Box, {
|
|
8015
7873
|
children: [
|
|
8016
|
-
/* @__PURE__ */
|
|
7874
|
+
/* @__PURE__ */ jsxDEV(Text, {
|
|
8017
7875
|
color,
|
|
8018
7876
|
children: uiGlyphs.spinner[frame]
|
|
8019
7877
|
}, undefined, false, undefined, this),
|
|
8020
|
-
message && /* @__PURE__ */
|
|
7878
|
+
message && /* @__PURE__ */ jsxDEV(Text, {
|
|
8021
7879
|
children: [
|
|
8022
7880
|
" ",
|
|
8023
7881
|
message
|
|
@@ -8032,19 +7890,19 @@ function LoadingState({
|
|
|
8032
7890
|
progress,
|
|
8033
7891
|
showSpinner = true
|
|
8034
7892
|
}) {
|
|
8035
|
-
return /* @__PURE__ */
|
|
7893
|
+
return /* @__PURE__ */ jsxDEV(Box, {
|
|
8036
7894
|
flexDirection: "column",
|
|
8037
7895
|
marginY: 1,
|
|
8038
7896
|
children: [
|
|
8039
|
-
/* @__PURE__ */
|
|
7897
|
+
/* @__PURE__ */ jsxDEV(Box, {
|
|
8040
7898
|
children: [
|
|
8041
|
-
showSpinner && /* @__PURE__ */
|
|
7899
|
+
showSpinner && /* @__PURE__ */ jsxDEV(Box, {
|
|
8042
7900
|
marginRight: 1,
|
|
8043
|
-
children: /* @__PURE__ */
|
|
7901
|
+
children: /* @__PURE__ */ jsxDEV(Spinner, {
|
|
8044
7902
|
color: "cyan"
|
|
8045
7903
|
}, undefined, false, undefined, this)
|
|
8046
7904
|
}, undefined, false, undefined, this),
|
|
8047
|
-
/* @__PURE__ */
|
|
7905
|
+
/* @__PURE__ */ jsxDEV(Text, {
|
|
8048
7906
|
bold: true,
|
|
8049
7907
|
color: "cyan",
|
|
8050
7908
|
children: [
|
|
@@ -8055,9 +7913,9 @@ function LoadingState({
|
|
|
8055
7913
|
}, undefined, true, undefined, this)
|
|
8056
7914
|
]
|
|
8057
7915
|
}, undefined, true, undefined, this),
|
|
8058
|
-
subMessage && /* @__PURE__ */
|
|
7916
|
+
subMessage && /* @__PURE__ */ jsxDEV(Box, {
|
|
8059
7917
|
marginLeft: 2,
|
|
8060
|
-
children: /* @__PURE__ */
|
|
7918
|
+
children: /* @__PURE__ */ jsxDEV(Text, {
|
|
8061
7919
|
dimColor: true,
|
|
8062
7920
|
children: [
|
|
8063
7921
|
uiGlyphs.arrowRight,
|
|
@@ -8066,10 +7924,10 @@ function LoadingState({
|
|
|
8066
7924
|
]
|
|
8067
7925
|
}, undefined, true, undefined, this)
|
|
8068
7926
|
}, undefined, false, undefined, this),
|
|
8069
|
-
progress !== undefined && /* @__PURE__ */
|
|
7927
|
+
progress !== undefined && /* @__PURE__ */ jsxDEV(Box, {
|
|
8070
7928
|
marginLeft: 2,
|
|
8071
7929
|
marginTop: 1,
|
|
8072
|
-
children: /* @__PURE__ */
|
|
7930
|
+
children: /* @__PURE__ */ jsxDEV(ProgressBar, {
|
|
8073
7931
|
progress,
|
|
8074
7932
|
width: 25,
|
|
8075
7933
|
showPercentage: true
|
|
@@ -8083,167 +7941,586 @@ var init_ProgressBar = __esm(() => {
|
|
|
8083
7941
|
init_theme();
|
|
8084
7942
|
});
|
|
8085
7943
|
|
|
8086
|
-
// src/ui/wizard/
|
|
8087
|
-
import {
|
|
8088
|
-
import {
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
const
|
|
8092
|
-
|
|
8093
|
-
setStatus("testing");
|
|
8094
|
-
(async () => {
|
|
8095
|
-
try {
|
|
8096
|
-
const res = await fetch("https://gen.pollinations.ai/v1/chat/completions", {
|
|
8097
|
-
method: "POST",
|
|
8098
|
-
headers: {
|
|
8099
|
-
"Content-Type": "application/json",
|
|
8100
|
-
Authorization: `Bearer ${apiKey}`
|
|
8101
|
-
},
|
|
8102
|
-
body: JSON.stringify({
|
|
8103
|
-
model: "mistral",
|
|
8104
|
-
messages: [{ role: "user", content: "ping" }],
|
|
8105
|
-
max_tokens: 4
|
|
8106
|
-
}),
|
|
8107
|
-
signal: AbortSignal.timeout(8000)
|
|
8108
|
-
});
|
|
8109
|
-
setStatus(res.ok ? "ok" : "warn");
|
|
8110
|
-
} catch {
|
|
8111
|
-
setStatus("warn");
|
|
8112
|
-
}
|
|
8113
|
-
})();
|
|
8114
|
-
}, [apiKey]);
|
|
8115
|
-
useInput3((_, key) => {
|
|
8116
|
-
if (key.return)
|
|
8117
|
-
onNext();
|
|
8118
|
-
});
|
|
8119
|
-
return /* @__PURE__ */ jsxDEV4(Box4, {
|
|
8120
|
-
flexDirection: "column",
|
|
8121
|
-
gap: 1,
|
|
8122
|
-
children: [
|
|
8123
|
-
/* @__PURE__ */ jsxDEV4(Text4, {
|
|
8124
|
-
color: codeTheme.text,
|
|
8125
|
-
children: "Before entering the shell, Code probes the configured endpoint to avoid a dead setup on first use."
|
|
8126
|
-
}, undefined, false, undefined, this),
|
|
8127
|
-
status === "testing" ? /* @__PURE__ */ jsxDEV4(LoadingState, {
|
|
8128
|
-
message: "Testing model access",
|
|
8129
|
-
subMessage: "Polling the API with a minimal request."
|
|
8130
|
-
}, undefined, false, undefined, this) : null,
|
|
8131
|
-
status === "ok" ? /* @__PURE__ */ jsxDEV4(Text4, {
|
|
8132
|
-
color: codeTheme.success,
|
|
8133
|
-
children: "API check passed."
|
|
8134
|
-
}, undefined, false, undefined, this) : null,
|
|
8135
|
-
status === "warn" ? /* @__PURE__ */ jsxDEV4(Text4, {
|
|
8136
|
-
color: codeTheme.warning,
|
|
8137
|
-
children: "Could not fully validate. You can still continue."
|
|
8138
|
-
}, undefined, false, undefined, this) : null,
|
|
8139
|
-
/* @__PURE__ */ jsxDEV4(OnboardingHint, {
|
|
8140
|
-
children: "Press Enter to continue."
|
|
8141
|
-
}, undefined, false, undefined, this)
|
|
8142
|
-
]
|
|
8143
|
-
}, undefined, true, undefined, this);
|
|
8144
|
-
}
|
|
8145
|
-
var init_WizardStep3Test = __esm(() => {
|
|
8146
|
-
init_ProgressBar();
|
|
8147
|
-
init_theme();
|
|
8148
|
-
init_wizardHelper();
|
|
8149
|
-
});
|
|
8150
|
-
|
|
8151
|
-
// src/ui/wizard/WizardStep4Model.tsx
|
|
8152
|
-
import { useState as useState3 } from "react";
|
|
8153
|
-
import { Box as Box5, Text as Text5, useInput as useInput4 } from "ink";
|
|
8154
|
-
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
8155
|
-
function WizardStep4Model({ onNext }) {
|
|
8156
|
-
const [modelIndex, setModelIndex] = useState3(0);
|
|
8157
|
-
const [langIndex, setLangIndex] = useState3(0);
|
|
8158
|
-
const [editing, setEditing] = useState3("model");
|
|
8159
|
-
useInput4((_, key) => {
|
|
8160
|
-
if (key.upArrow) {
|
|
8161
|
-
if (editing === "model")
|
|
8162
|
-
setModelIndex((i) => Math.max(0, i - 1));
|
|
8163
|
-
else
|
|
8164
|
-
setLangIndex((i) => Math.max(0, i - 1));
|
|
8165
|
-
return;
|
|
8166
|
-
}
|
|
8167
|
-
if (key.downArrow) {
|
|
8168
|
-
if (editing === "model")
|
|
8169
|
-
setModelIndex((i) => Math.min(MODELS.length - 1, i + 1));
|
|
8170
|
-
else
|
|
8171
|
-
setLangIndex((i) => Math.min(LANGUAGES.length - 1, i + 1));
|
|
8172
|
-
return;
|
|
8173
|
-
}
|
|
8174
|
-
if (key.tab) {
|
|
8175
|
-
setEditing((e) => e === "model" ? "lang" : "model");
|
|
8176
|
-
return;
|
|
8177
|
-
}
|
|
8178
|
-
if (key.return) {
|
|
8179
|
-
onNext(MODELS[modelIndex], LANGUAGES[langIndex]);
|
|
8180
|
-
}
|
|
8181
|
-
});
|
|
8182
|
-
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, {
|
|
8183
7951
|
flexDirection: "column",
|
|
8184
|
-
|
|
7952
|
+
paddingX: 1,
|
|
8185
7953
|
children: [
|
|
8186
|
-
/* @__PURE__ */
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
}, undefined, false, undefined, this),
|
|
8190
|
-
/* @__PURE__ */ jsxDEV5(Box5, {
|
|
8191
|
-
marginTop: 1,
|
|
8192
|
-
flexDirection: "column",
|
|
7954
|
+
/* @__PURE__ */ jsxDEV2(Box2, {
|
|
7955
|
+
justifyContent: "space-between",
|
|
7956
|
+
marginBottom: 1,
|
|
8193
7957
|
children: [
|
|
8194
|
-
/* @__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, {
|
|
8195
7973
|
color: codeTheme.muted,
|
|
8196
|
-
children:
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
},
|
|
7974
|
+
children: [
|
|
7975
|
+
"Step ",
|
|
7976
|
+
step,
|
|
7977
|
+
"/",
|
|
7978
|
+
total
|
|
7979
|
+
]
|
|
7980
|
+
}, undefined, true, undefined, this)
|
|
8203
7981
|
]
|
|
8204
7982
|
}, undefined, true, undefined, this),
|
|
8205
|
-
/* @__PURE__ */
|
|
8206
|
-
|
|
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,
|
|
8207
7997
|
children: [
|
|
8208
|
-
/* @__PURE__ */
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
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
|
-
|
|
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";
|
|
8247
8524
|
useEffect2(() => {
|
|
8248
8525
|
(async () => {
|
|
8249
8526
|
const [hasDocker, visionReady, embedReady] = await Promise.all([
|
|
@@ -8345,98 +8622,98 @@ function WizardStep5Features({ diagnostics, onNext }) {
|
|
|
8345
8622
|
}
|
|
8346
8623
|
});
|
|
8347
8624
|
if (detecting) {
|
|
8348
|
-
return /* @__PURE__ */
|
|
8625
|
+
return /* @__PURE__ */ jsxDEV7(LoadingState, {
|
|
8349
8626
|
message: "Scanning local capabilities",
|
|
8350
8627
|
subMessage: "Inspecting Docker and local model cache."
|
|
8351
8628
|
}, undefined, false, undefined, this);
|
|
8352
8629
|
}
|
|
8353
8630
|
if (downloading) {
|
|
8354
|
-
return /* @__PURE__ */
|
|
8631
|
+
return /* @__PURE__ */ jsxDEV7(LoadingState, {
|
|
8355
8632
|
message: "Downloading local models",
|
|
8356
8633
|
subMessage: `${downloadLabel} Downloading sequentially to keep the setup stable.`
|
|
8357
8634
|
}, undefined, false, undefined, this);
|
|
8358
8635
|
}
|
|
8359
|
-
return /* @__PURE__ */
|
|
8636
|
+
return /* @__PURE__ */ jsxDEV7(Box7, {
|
|
8360
8637
|
flexDirection: "column",
|
|
8361
8638
|
gap: 1,
|
|
8362
8639
|
children: [
|
|
8363
|
-
/* @__PURE__ */
|
|
8640
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
8364
8641
|
color: codeTheme.text,
|
|
8365
8642
|
children: "Code can preload local models now or keep them lazy-loaded for the first real use."
|
|
8366
8643
|
}, undefined, false, undefined, this),
|
|
8367
|
-
/* @__PURE__ */
|
|
8644
|
+
/* @__PURE__ */ jsxDEV7(Box7, {
|
|
8368
8645
|
flexDirection: "column",
|
|
8369
8646
|
marginTop: 1,
|
|
8370
8647
|
children: [
|
|
8371
|
-
/* @__PURE__ */
|
|
8648
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8372
8649
|
label: "Shell runtime",
|
|
8373
8650
|
value: diagnostics?.shellLabel ?? "detecting...",
|
|
8374
8651
|
tone: diagnostics ? diagnostics.shellSupportsPosix ? "success" : "warning" : "text"
|
|
8375
8652
|
}, undefined, false, undefined, this),
|
|
8376
|
-
/* @__PURE__ */
|
|
8653
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8377
8654
|
label: "Vision",
|
|
8378
8655
|
value: "embedded local pipeline",
|
|
8379
8656
|
tone: "success"
|
|
8380
8657
|
}, undefined, false, undefined, this),
|
|
8381
|
-
/* @__PURE__ */
|
|
8658
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8382
8659
|
label: "Embeddings",
|
|
8383
8660
|
value: "semantic index ready",
|
|
8384
8661
|
tone: "success"
|
|
8385
8662
|
}, undefined, false, undefined, this),
|
|
8386
|
-
/* @__PURE__ */
|
|
8663
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8387
8664
|
label: "Sandbox",
|
|
8388
8665
|
value: dockerAvailable ? "docker available" : "safe mode only",
|
|
8389
8666
|
tone: dockerAvailable ? "success" : "warning"
|
|
8390
8667
|
}, undefined, false, undefined, this),
|
|
8391
|
-
/* @__PURE__ */
|
|
8668
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8392
8669
|
label: "Vision cache",
|
|
8393
8670
|
value: visionCached ? "already cached" : "download required",
|
|
8394
8671
|
tone: visionCached ? "success" : "warning"
|
|
8395
8672
|
}, undefined, false, undefined, this),
|
|
8396
|
-
/* @__PURE__ */
|
|
8673
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8397
8674
|
label: "Embedding cache",
|
|
8398
8675
|
value: embedCached ? "already cached" : "download required",
|
|
8399
8676
|
tone: embedCached ? "success" : "warning"
|
|
8400
8677
|
}, undefined, false, undefined, this),
|
|
8401
|
-
/* @__PURE__ */
|
|
8678
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8402
8679
|
label: "Image preprocessing",
|
|
8403
8680
|
value: diagnostics?.capabilities.find((item) => item.key === "sharp")?.detail ?? "detecting...",
|
|
8404
8681
|
tone: diagnostics?.capabilities.find((item) => item.key === "sharp")?.status === "ready" ? "success" : "warning"
|
|
8405
8682
|
}, undefined, false, undefined, this),
|
|
8406
|
-
/* @__PURE__ */
|
|
8683
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8407
8684
|
label: "Screenshots",
|
|
8408
8685
|
value: diagnostics?.capabilities.find((item) => item.key === "playwright")?.detail ?? "detecting...",
|
|
8409
8686
|
tone: diagnostics?.capabilities.find((item) => item.key === "playwright")?.status === "ready" ? "success" : "warning"
|
|
8410
8687
|
}, undefined, false, undefined, this),
|
|
8411
|
-
/* @__PURE__ */
|
|
8688
|
+
/* @__PURE__ */ jsxDEV7(OnboardingMetric, {
|
|
8412
8689
|
label: "Validation",
|
|
8413
8690
|
value: "judge + transactions enabled",
|
|
8414
8691
|
tone: "success"
|
|
8415
8692
|
}, undefined, false, undefined, this)
|
|
8416
8693
|
]
|
|
8417
8694
|
}, undefined, true, undefined, this),
|
|
8418
|
-
!visionCached || !embedCached ? /* @__PURE__ */
|
|
8695
|
+
!visionCached || !embedCached ? /* @__PURE__ */ jsxDEV7(Box7, {
|
|
8419
8696
|
marginTop: 1,
|
|
8420
8697
|
flexDirection: "column",
|
|
8421
8698
|
children: [
|
|
8422
|
-
/* @__PURE__ */
|
|
8699
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
8423
8700
|
bold: true,
|
|
8424
8701
|
color: runtimeReady ? codeTheme.warning : codeTheme.danger,
|
|
8425
8702
|
children: runtimeReady ? "Download local models now? [y/n]" : "Local runtime missing - preload unavailable"
|
|
8426
8703
|
}, undefined, false, undefined, this),
|
|
8427
|
-
/* @__PURE__ */
|
|
8704
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
8428
8705
|
color: codeTheme.muted,
|
|
8429
8706
|
children: runtimeReady ? "Vision + embeddings. Download size varies by model version and runtime." : "Install dependencies so @huggingface/transformers is available, then rerun setup."
|
|
8430
8707
|
}, undefined, false, undefined, this)
|
|
8431
8708
|
]
|
|
8432
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
8709
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV7(OnboardingHint, {
|
|
8433
8710
|
children: "Press Enter to continue."
|
|
8434
8711
|
}, undefined, false, undefined, this),
|
|
8435
|
-
downloadError ? /* @__PURE__ */
|
|
8712
|
+
downloadError ? /* @__PURE__ */ jsxDEV7(Text7, {
|
|
8436
8713
|
color: codeTheme.danger,
|
|
8437
8714
|
children: downloadError
|
|
8438
8715
|
}, undefined, false, undefined, this) : null,
|
|
8439
|
-
!visionCached && !embedCached && !runtimeReady ? /* @__PURE__ */
|
|
8716
|
+
!visionCached && !embedCached && !runtimeReady ? /* @__PURE__ */ jsxDEV7(OnboardingHint, {
|
|
8440
8717
|
children: "Press Enter to continue without local preload."
|
|
8441
8718
|
}, undefined, false, undefined, this) : null
|
|
8442
8719
|
]
|
|
@@ -8451,425 +8728,213 @@ var init_WizardStep5Features = __esm(() => {
|
|
|
8451
8728
|
});
|
|
8452
8729
|
|
|
8453
8730
|
// src/ui/wizard/WizardStep6Ready.tsx
|
|
8454
|
-
import { Box as
|
|
8455
|
-
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";
|
|
8456
8733
|
function WizardStep6Ready({ data, diagnostics, onNext }) {
|
|
8457
8734
|
useInput6((_, key) => {
|
|
8458
8735
|
if (key.return)
|
|
8459
8736
|
onNext();
|
|
8460
8737
|
});
|
|
8461
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";
|
|
8462
|
-
return /* @__PURE__ */
|
|
8739
|
+
return /* @__PURE__ */ jsxDEV8(Box8, {
|
|
8463
8740
|
flexDirection: "column",
|
|
8464
8741
|
gap: 1,
|
|
8465
8742
|
children: [
|
|
8466
|
-
/* @__PURE__ */
|
|
8743
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8467
8744
|
color: codeTheme.text,
|
|
8468
8745
|
children: "The shell is configured. This is the runtime profile Code will start with."
|
|
8469
8746
|
}, undefined, false, undefined, this),
|
|
8470
|
-
/* @__PURE__ */
|
|
8747
|
+
/* @__PURE__ */ jsxDEV8(Box8, {
|
|
8471
8748
|
marginTop: 1,
|
|
8472
8749
|
flexDirection: "column",
|
|
8473
8750
|
children: [
|
|
8474
|
-
/* @__PURE__ */
|
|
8751
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8475
8752
|
label: "Default model",
|
|
8476
8753
|
value: data.model
|
|
8477
8754
|
}, undefined, false, undefined, this),
|
|
8478
|
-
/* @__PURE__ */
|
|
8755
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8479
8756
|
label: "Language",
|
|
8480
8757
|
value: data.language
|
|
8481
8758
|
}, undefined, false, undefined, this),
|
|
8482
|
-
/* @__PURE__ */
|
|
8759
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8483
8760
|
label: "Vision",
|
|
8484
8761
|
value: data.visionSource
|
|
8485
8762
|
}, undefined, false, undefined, this),
|
|
8486
|
-
/* @__PURE__ */
|
|
8763
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8487
8764
|
label: "Sandbox",
|
|
8488
8765
|
value: data.sandboxMode
|
|
8489
8766
|
}, undefined, false, undefined, this),
|
|
8490
|
-
/* @__PURE__ */
|
|
8767
|
+
/* @__PURE__ */ jsxDEV8(OnboardingMetric, {
|
|
8491
8768
|
label: "Model preload",
|
|
8492
8769
|
value: preloadLabel,
|
|
8493
8770
|
tone: data.modelPreloadStatus === "downloaded" || data.modelPreloadStatus === "already_cached" ? "success" : data.modelPreloadStatus === "runtime_missing" || data.modelPreloadStatus === "failed" ? "warning" : "text"
|
|
8494
8771
|
}, undefined, false, undefined, this)
|
|
8495
8772
|
]
|
|
8496
8773
|
}, undefined, true, undefined, this),
|
|
8497
|
-
/* @__PURE__ */
|
|
8774
|
+
/* @__PURE__ */ jsxDEV8(Box8, {
|
|
8498
8775
|
marginTop: 1,
|
|
8499
8776
|
flexDirection: "column",
|
|
8500
8777
|
children: [
|
|
8501
|
-
/* @__PURE__ */
|
|
8778
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8502
8779
|
color: codeTheme.brandStrong,
|
|
8503
8780
|
children: "Ready for first task"
|
|
8504
8781
|
}, undefined, false, undefined, this),
|
|
8505
|
-
/* @__PURE__ */
|
|
8782
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8506
8783
|
color: codeTheme.muted,
|
|
8507
8784
|
children: "Chat opens as the OAL SARL Code shell with the UI language and model defaults you picked here."
|
|
8508
8785
|
}, undefined, false, undefined, this)
|
|
8509
8786
|
]
|
|
8510
8787
|
}, undefined, true, undefined, this),
|
|
8511
|
-
data.modelPreloadStatus === "failed" || data.modelPreloadStatus === "runtime_missing" ? /* @__PURE__ */
|
|
8788
|
+
data.modelPreloadStatus === "failed" || data.modelPreloadStatus === "runtime_missing" ? /* @__PURE__ */ jsxDEV8(Box8, {
|
|
8512
8789
|
marginTop: 1,
|
|
8513
8790
|
flexDirection: "column",
|
|
8514
8791
|
children: [
|
|
8515
|
-
/* @__PURE__ */
|
|
8792
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8516
8793
|
color: codeTheme.warning,
|
|
8517
8794
|
children: "Local model preload issue"
|
|
8518
8795
|
}, undefined, false, undefined, this),
|
|
8519
|
-
/* @__PURE__ */
|
|
8796
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8520
8797
|
color: codeTheme.muted,
|
|
8521
8798
|
children: data.modelPreloadError ?? "Local models were not preloaded. Code can still start, and local capabilities can be retried later."
|
|
8522
8799
|
}, undefined, false, undefined, this)
|
|
8523
8800
|
]
|
|
8524
8801
|
}, undefined, true, undefined, this) : null,
|
|
8525
|
-
diagnostics && diagnostics.warnings.length > 0 ? /* @__PURE__ */
|
|
8802
|
+
diagnostics && diagnostics.warnings.length > 0 ? /* @__PURE__ */ jsxDEV8(Box8, {
|
|
8526
8803
|
marginTop: 1,
|
|
8527
8804
|
flexDirection: "column",
|
|
8528
8805
|
children: [
|
|
8529
|
-
/* @__PURE__ */
|
|
8806
|
+
/* @__PURE__ */ jsxDEV8(Text8, {
|
|
8530
8807
|
color: codeTheme.warning,
|
|
8531
8808
|
children: "Attention before launch"
|
|
8532
8809
|
}, undefined, false, undefined, this),
|
|
8533
|
-
diagnostics.warnings.slice(0, 3).map((warning) => /* @__PURE__ */
|
|
8534
|
-
color: codeTheme.muted,
|
|
8535
|
-
children: warning
|
|
8536
|
-
}, warning, false, undefined, this))
|
|
8537
|
-
]
|
|
8538
|
-
}, undefined, true, undefined, this) : null,
|
|
8539
|
-
/* @__PURE__ */ jsxDEV7(OnboardingHint, {
|
|
8540
|
-
children: "Press Enter to start Code."
|
|
8541
|
-
}, undefined, false, undefined, this)
|
|
8542
|
-
]
|
|
8543
|
-
}, undefined, true, undefined, this);
|
|
8544
|
-
}
|
|
8545
|
-
var init_WizardStep6Ready = __esm(() => {
|
|
8546
|
-
init_theme();
|
|
8547
|
-
init_wizardHelper();
|
|
8548
|
-
});
|
|
8549
|
-
|
|
8550
|
-
// src/ui/wizard/WizardContainer.tsx
|
|
8551
|
-
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
8552
|
-
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
8553
|
-
function WizardContainer({ onComplete }) {
|
|
8554
|
-
const [step, setStep] = useState5(1);
|
|
8555
|
-
const [data, setData] = useState5({});
|
|
8556
|
-
const [diagnostics, setDiagnostics] = useState5(null);
|
|
8557
|
-
const total = 6;
|
|
8558
|
-
useEffect3(() => {
|
|
8559
|
-
(async () => {
|
|
8560
|
-
const nextDiagnostics = await detectPlatformDiagnostics().catch(() => null);
|
|
8561
|
-
setDiagnostics(nextDiagnostics);
|
|
8562
|
-
})();
|
|
8563
|
-
}, []);
|
|
8564
|
-
const next = async (partial) => {
|
|
8565
|
-
const merged = { ...data, ...partial };
|
|
8566
|
-
setData(merged);
|
|
8567
|
-
if (step < total) {
|
|
8568
|
-
if (step === 5) {
|
|
8569
|
-
const nextDiagnostics = await detectPlatformDiagnostics().catch(() => null);
|
|
8570
|
-
setDiagnostics(nextDiagnostics);
|
|
8571
|
-
}
|
|
8572
|
-
setStep(step + 1);
|
|
8573
|
-
return;
|
|
8574
|
-
}
|
|
8575
|
-
settings.setApiKey(merged.apiKey ?? "");
|
|
8576
|
-
settings.set("defaultModel", merged.model ?? "mistral");
|
|
8577
|
-
settings.set("language", merged.language ?? "auto");
|
|
8578
|
-
settings.set("visionModel", merged.visionSource ?? "embedded");
|
|
8579
|
-
settings.set("sandboxMode", merged.sandboxMode ?? "safe");
|
|
8580
|
-
settings.set("visionModelCached", await isModelCached(VISION_MODEL_ID));
|
|
8581
|
-
settings.set("embeddingModelCached", await isModelCached(EMBED_MODEL_ID));
|
|
8582
|
-
settings.set("setupCompleted", true);
|
|
8583
|
-
onComplete(merged);
|
|
8584
|
-
};
|
|
8585
|
-
const steps = [
|
|
8586
|
-
/* @__PURE__ */ jsxDEV8(WizardStep1Welcome, {
|
|
8587
|
-
diagnostics,
|
|
8588
|
-
onNext: () => void next({})
|
|
8589
|
-
}, 1, false, undefined, this),
|
|
8590
|
-
/* @__PURE__ */ jsxDEV8(WizardStep2ApiKey, {
|
|
8591
|
-
onNext: (apiKey) => void next({ apiKey })
|
|
8592
|
-
}, 2, false, undefined, this),
|
|
8593
|
-
/* @__PURE__ */ jsxDEV8(WizardStep3Test, {
|
|
8594
|
-
apiKey: data.apiKey ?? "",
|
|
8595
|
-
onNext: () => void next({})
|
|
8596
|
-
}, 3, false, undefined, this),
|
|
8597
|
-
/* @__PURE__ */ jsxDEV8(WizardStep4Model, {
|
|
8598
|
-
onNext: (model, language) => void next({ model, language })
|
|
8599
|
-
}, 4, false, undefined, this),
|
|
8600
|
-
/* @__PURE__ */ jsxDEV8(WizardStep5Features, {
|
|
8601
|
-
diagnostics,
|
|
8602
|
-
onNext: (opts) => void next(opts)
|
|
8603
|
-
}, 5, false, undefined, this),
|
|
8604
|
-
/* @__PURE__ */ jsxDEV8(WizardStep6Ready, {
|
|
8605
|
-
data,
|
|
8606
|
-
diagnostics,
|
|
8607
|
-
onNext: () => void next({})
|
|
8608
|
-
}, 6, false, undefined, this)
|
|
8609
|
-
];
|
|
8610
|
-
const stepMeta = [
|
|
8611
|
-
{
|
|
8612
|
-
eyebrow: "Orientation",
|
|
8613
|
-
title: "Start with the shell",
|
|
8614
|
-
description: "Get the product shape, capabilities and operating mode before configuration."
|
|
8615
|
-
},
|
|
8616
|
-
{
|
|
8617
|
-
eyebrow: "Security",
|
|
8618
|
-
title: "Connect the model",
|
|
8619
|
-
description: "Register the API key and validate the trust boundary early."
|
|
8620
|
-
},
|
|
8621
|
-
{
|
|
8622
|
-
eyebrow: "Connectivity",
|
|
8623
|
-
title: "Probe the runtime",
|
|
8624
|
-
description: "Check that Code can actually reach the configured model endpoint."
|
|
8625
|
-
},
|
|
8626
|
-
{
|
|
8627
|
-
eyebrow: "Defaults",
|
|
8628
|
-
title: "Choose your working style",
|
|
8629
|
-
description: "Select default model and language for the shell and non-TTY runs."
|
|
8630
|
-
},
|
|
8631
|
-
{
|
|
8632
|
-
eyebrow: "Local capabilities",
|
|
8633
|
-
title: "Enable embedded features",
|
|
8634
|
-
description: "Inspect sandbox and local model cache before the first real task."
|
|
8635
|
-
},
|
|
8636
|
-
{
|
|
8637
|
-
eyebrow: "Ready",
|
|
8638
|
-
title: "Review and launch",
|
|
8639
|
-
description: "Confirm the final setup and enter the product with a clear runtime profile."
|
|
8640
|
-
}
|
|
8641
|
-
];
|
|
8642
|
-
return /* @__PURE__ */ jsxDEV8(OnboardingShell, {
|
|
8643
|
-
step,
|
|
8644
|
-
total,
|
|
8645
|
-
steps: stepMeta,
|
|
8646
|
-
children: steps[step - 1]
|
|
8647
|
-
}, undefined, false, undefined, this);
|
|
8648
|
-
}
|
|
8649
|
-
var init_WizardContainer = __esm(() => {
|
|
8650
|
-
init_settings();
|
|
8651
|
-
init_modelManager();
|
|
8652
|
-
init_platformDiagnostics();
|
|
8653
|
-
init_WizardStep1Welcome();
|
|
8654
|
-
init_WizardStep2ApiKey();
|
|
8655
|
-
init_WizardStep3Test();
|
|
8656
|
-
init_WizardStep4Model();
|
|
8657
|
-
init_WizardStep5Features();
|
|
8658
|
-
init_WizardStep6Ready();
|
|
8659
|
-
init_wizardHelper();
|
|
8660
|
-
});
|
|
8661
|
-
|
|
8662
|
-
// src/ui/wizard/wizardHelper.tsx
|
|
8663
|
-
var exports_wizardHelper = {};
|
|
8664
|
-
__export(exports_wizardHelper, {
|
|
8665
|
-
waitForWizard: () => waitForWizard,
|
|
8666
|
-
OnboardingShell: () => OnboardingShell,
|
|
8667
|
-
OnboardingMetric: () => OnboardingMetric,
|
|
8668
|
-
OnboardingHint: () => OnboardingHint,
|
|
8669
|
-
OnboardingChoice: () => OnboardingChoice
|
|
8670
|
-
});
|
|
8671
|
-
import { Box as Box8, Text as Text8, render } from "ink";
|
|
8672
|
-
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
8673
|
-
function waitForWizard() {
|
|
8674
|
-
return new Promise((resolve) => {
|
|
8675
|
-
const instance = render(/* @__PURE__ */ jsxDEV9(WizardContainer, {
|
|
8676
|
-
onComplete: (data) => {
|
|
8677
|
-
instance.unmount();
|
|
8678
|
-
instance.waitUntilExit().then(() => resolve(data));
|
|
8679
|
-
}
|
|
8680
|
-
}, undefined, false, undefined, this));
|
|
8681
|
-
});
|
|
8682
|
-
}
|
|
8683
|
-
function OnboardingShell({ step, total, steps, children }) {
|
|
8684
|
-
const active = steps[Math.max(0, step - 1)];
|
|
8685
|
-
const progress = step / Math.max(total, 1) * 100;
|
|
8686
|
-
return /* @__PURE__ */ jsxDEV9(Box8, {
|
|
8687
|
-
flexDirection: "column",
|
|
8688
|
-
paddingX: 1,
|
|
8689
|
-
children: [
|
|
8690
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8691
|
-
justifyContent: "space-between",
|
|
8692
|
-
marginBottom: 1,
|
|
8693
|
-
children: [
|
|
8694
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8695
|
-
gap: 1,
|
|
8696
|
-
children: [
|
|
8697
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8698
|
-
bold: true,
|
|
8699
|
-
color: codeTheme.brandStrong,
|
|
8700
|
-
children: "Code"
|
|
8701
|
-
}, undefined, false, undefined, this),
|
|
8702
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8703
|
-
color: codeTheme.muted,
|
|
8704
|
-
children: "OAL SARL | v6 onboarding"
|
|
8705
|
-
}, undefined, false, undefined, this)
|
|
8706
|
-
]
|
|
8707
|
-
}, undefined, true, undefined, this),
|
|
8708
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8810
|
+
diagnostics.warnings.slice(0, 3).map((warning) => /* @__PURE__ */ jsxDEV8(Text8, {
|
|
8709
8811
|
color: codeTheme.muted,
|
|
8710
|
-
children:
|
|
8711
|
-
|
|
8712
|
-
step,
|
|
8713
|
-
"/",
|
|
8714
|
-
total
|
|
8715
|
-
]
|
|
8716
|
-
}, undefined, true, undefined, this)
|
|
8717
|
-
]
|
|
8718
|
-
}, undefined, true, undefined, this),
|
|
8719
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8720
|
-
marginBottom: 1,
|
|
8721
|
-
children: /* @__PURE__ */ jsxDEV9(ProgressBar, {
|
|
8722
|
-
progress,
|
|
8723
|
-
width: 34,
|
|
8724
|
-
color: codeTheme.brand,
|
|
8725
|
-
showPercentage: false
|
|
8726
|
-
}, undefined, false, undefined, this)
|
|
8727
|
-
}, undefined, false, undefined, this),
|
|
8728
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8729
|
-
borderStyle: "round",
|
|
8730
|
-
borderColor: codeTheme.line,
|
|
8731
|
-
paddingX: 1,
|
|
8732
|
-
paddingY: 1,
|
|
8733
|
-
children: [
|
|
8734
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8735
|
-
width: 26,
|
|
8736
|
-
marginRight: 2,
|
|
8737
|
-
flexDirection: "column",
|
|
8738
|
-
children: [
|
|
8739
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8740
|
-
color: codeTheme.muted,
|
|
8741
|
-
children: "Setup flow"
|
|
8742
|
-
}, undefined, false, undefined, this),
|
|
8743
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8744
|
-
marginTop: 1,
|
|
8745
|
-
flexDirection: "column",
|
|
8746
|
-
children: steps.map((item, index) => {
|
|
8747
|
-
const current = index + 1;
|
|
8748
|
-
const done = current < step;
|
|
8749
|
-
const activeStep = current === step;
|
|
8750
|
-
return /* @__PURE__ */ jsxDEV9(Box8, {
|
|
8751
|
-
marginBottom: 1,
|
|
8752
|
-
flexDirection: "column",
|
|
8753
|
-
children: [
|
|
8754
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8755
|
-
color: done ? codeTheme.success : activeStep ? codeTheme.brandStrong : codeTheme.muted,
|
|
8756
|
-
children: [
|
|
8757
|
-
done ? "OK" : activeStep ? ">" : "-",
|
|
8758
|
-
" ",
|
|
8759
|
-
item.title
|
|
8760
|
-
]
|
|
8761
|
-
}, undefined, true, undefined, this),
|
|
8762
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8763
|
-
color: activeStep ? codeTheme.text : codeTheme.muted,
|
|
8764
|
-
children: item.description
|
|
8765
|
-
}, undefined, false, undefined, this)
|
|
8766
|
-
]
|
|
8767
|
-
}, item.title, true, undefined, this);
|
|
8768
|
-
})
|
|
8769
|
-
}, undefined, false, undefined, this)
|
|
8770
|
-
]
|
|
8771
|
-
}, undefined, true, undefined, this),
|
|
8772
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8773
|
-
flexGrow: 1,
|
|
8774
|
-
flexDirection: "column",
|
|
8775
|
-
borderStyle: "round",
|
|
8776
|
-
borderColor: codeTheme.line,
|
|
8777
|
-
paddingX: 1,
|
|
8778
|
-
paddingY: 1,
|
|
8779
|
-
children: [
|
|
8780
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8781
|
-
color: codeTheme.accent,
|
|
8782
|
-
children: active.eyebrow
|
|
8783
|
-
}, undefined, false, undefined, this),
|
|
8784
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8785
|
-
bold: true,
|
|
8786
|
-
color: codeTheme.brandStrong,
|
|
8787
|
-
children: active.title
|
|
8788
|
-
}, undefined, false, undefined, this),
|
|
8789
|
-
/* @__PURE__ */ jsxDEV9(Text8, {
|
|
8790
|
-
color: codeTheme.muted,
|
|
8791
|
-
children: active.description
|
|
8792
|
-
}, undefined, false, undefined, this),
|
|
8793
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8794
|
-
marginTop: 1,
|
|
8795
|
-
flexDirection: "column",
|
|
8796
|
-
children
|
|
8797
|
-
}, undefined, false, undefined, this)
|
|
8798
|
-
]
|
|
8799
|
-
}, undefined, true, undefined, this)
|
|
8812
|
+
children: warning
|
|
8813
|
+
}, warning, false, undefined, this))
|
|
8800
8814
|
]
|
|
8801
|
-
}, undefined, true, undefined, this)
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
}
|
|
8805
|
-
function OnboardingHint({ children }) {
|
|
8806
|
-
return /* @__PURE__ */ jsxDEV9(Text8, {
|
|
8807
|
-
color: codeTheme.muted,
|
|
8808
|
-
children
|
|
8809
|
-
}, undefined, false, undefined, this);
|
|
8810
|
-
}
|
|
8811
|
-
function OnboardingMetric({
|
|
8812
|
-
label,
|
|
8813
|
-
value,
|
|
8814
|
-
tone = "text"
|
|
8815
|
-
}) {
|
|
8816
|
-
const color = tone === "success" ? codeTheme.success : tone === "warning" ? codeTheme.warning : codeTheme.text;
|
|
8817
|
-
return /* @__PURE__ */ jsxDEV9(Box8, {
|
|
8818
|
-
flexDirection: "row",
|
|
8819
|
-
gap: 2,
|
|
8820
|
-
children: [
|
|
8821
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8822
|
-
width: 20,
|
|
8823
|
-
flexShrink: 0,
|
|
8824
|
-
children: /* @__PURE__ */ jsxDEV9(Text8, {
|
|
8825
|
-
color: codeTheme.muted,
|
|
8826
|
-
children: label
|
|
8827
|
-
}, undefined, false, undefined, this)
|
|
8828
|
-
}, undefined, false, undefined, this),
|
|
8829
|
-
/* @__PURE__ */ jsxDEV9(Box8, {
|
|
8830
|
-
flexGrow: 1,
|
|
8831
|
-
children: /* @__PURE__ */ jsxDEV9(Text8, {
|
|
8832
|
-
color,
|
|
8833
|
-
wrap: "wrap",
|
|
8834
|
-
children: value
|
|
8835
|
-
}, undefined, false, undefined, this)
|
|
8815
|
+
}, undefined, true, undefined, this) : null,
|
|
8816
|
+
/* @__PURE__ */ jsxDEV8(OnboardingHint, {
|
|
8817
|
+
children: "Press Enter to start Code."
|
|
8836
8818
|
}, undefined, false, undefined, this)
|
|
8837
8819
|
]
|
|
8838
8820
|
}, undefined, true, undefined, this);
|
|
8839
8821
|
}
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
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]
|
|
8867
8925
|
}, undefined, false, undefined, this);
|
|
8868
8926
|
}
|
|
8869
|
-
var
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
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();
|
|
8873
8938
|
});
|
|
8874
8939
|
|
|
8875
8940
|
// src/ui/Header.tsx
|
|
@@ -14117,54 +14182,124 @@ var init_App = __esm(() => {
|
|
|
14117
14182
|
init_benchmarkRunner();
|
|
14118
14183
|
});
|
|
14119
14184
|
|
|
14120
|
-
// src/
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
import
|
|
14126
|
-
import
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
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)
|
|
14147
14224
|
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
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);
|
|
14158
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);
|
|
14159
14278
|
}
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
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
|
+
});
|
|
14164
14292
|
|
|
14165
14293
|
// src/index.ts
|
|
14294
|
+
init_settings();
|
|
14295
|
+
init_codeMd();
|
|
14166
14296
|
init_context();
|
|
14167
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";
|
|
14168
14303
|
|
|
14169
14304
|
// src/core/run-output.ts
|
|
14170
14305
|
function cleanRunOutput(text) {
|
|
@@ -14418,11 +14553,16 @@ async function bootstrapContext(apiKey, taskForSkills = "") {
|
|
|
14418
14553
|
program.name("oal-code").description("Code v6 Augmented | OAL SARL | Vision embarquee | Transactions | Judge").version("6.0.0");
|
|
14419
14554
|
async function startChat(opts) {
|
|
14420
14555
|
const useInkUi = shouldUseInkUi();
|
|
14421
|
-
const setupRequired = opts.setup || opts.config || !settings.
|
|
14556
|
+
const setupRequired = opts.setup || opts.config || !settings.isSetupCurrent() || !hasValidApiKey();
|
|
14422
14557
|
if (setupRequired) {
|
|
14423
14558
|
if (useInkUi) {
|
|
14424
|
-
const {
|
|
14425
|
-
|
|
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;
|
|
14426
14566
|
} else {
|
|
14427
14567
|
console.log("Mode non-TTY : entrez votre cle API Pollinations (pk_... ou sk_...):");
|
|
14428
14568
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -14430,6 +14570,7 @@ async function startChat(opts) {
|
|
|
14430
14570
|
rl.close();
|
|
14431
14571
|
settings.setApiKey(key);
|
|
14432
14572
|
settings.set("setupCompleted", true);
|
|
14573
|
+
settings.set("setupVersion", CURRENT_SETUP_VERSION);
|
|
14433
14574
|
}
|
|
14434
14575
|
}
|
|
14435
14576
|
await resolveVisionSource();
|
|
@@ -14467,12 +14608,12 @@ ${loaded.rawContent}` : `Projet: ${env.projectName} (${env.fileCount} fichiers,
|
|
|
14467
14608
|
}
|
|
14468
14609
|
}
|
|
14469
14610
|
if (useInkUi) {
|
|
14470
|
-
const [{ render: render2 },
|
|
14611
|
+
const [{ render: render2 }, React13, { App: App2 }] = await Promise.all([
|
|
14471
14612
|
import("ink"),
|
|
14472
14613
|
import("react"),
|
|
14473
14614
|
Promise.resolve().then(() => (init_App(), exports_App))
|
|
14474
14615
|
]);
|
|
14475
|
-
render2(
|
|
14616
|
+
render2(React13.createElement(App2, {
|
|
14476
14617
|
apiKey,
|
|
14477
14618
|
projectContext,
|
|
14478
14619
|
env,
|
|
@@ -14490,6 +14631,7 @@ program.command("start").description("Alias de chat").option("--setup", "Relance
|
|
|
14490
14631
|
program.command("config").description("Configurer Code").option("-k, --key <apiKey>", "Cle API Pollinations (pk_... ou sk_...)").option("-m, --model <model>", "Modele par defaut (kimi | mistral | gemini-fast)").option("-l, --language <lang>", "Langue (fr | en | auto)").option("--vision <source>", "embedded | pollinations | ollama").option("--sandbox <mode>", "safe | docker | none").option("--max-iterations <n>", "Nombre max d'iterations agent").option("--setup", "Relancer le wizard au prochain demarrage").option("--no-memory", "Desactiver la memoire inter-sessions").option("--no-web-search", "Desactiver la recherche web").option("--no-undo", "Desactiver l'undo stack").option("--no-judge", "Desactiver le judge pass").option("--judge-threshold <score>", "Score minimum judge (defaut 80)").option("--no-transactions", "Desactiver les transactions atomiques").option("--no-semantic-index", "Desactiver l'index semantique").option("--autonomy <mode>", "guarded | supervised").option("--clarify <mode>", "moderate | high-only | never").option("--llm-judge <mode>", "always | required | off").action((options) => {
|
|
14491
14632
|
if (options.setup) {
|
|
14492
14633
|
settings.set("setupCompleted", false);
|
|
14634
|
+
settings.set("setupVersion", 0);
|
|
14493
14635
|
console.log("Wizard reinitialise. Lance `oal-code chat --setup`.");
|
|
14494
14636
|
}
|
|
14495
14637
|
if (options.key) {
|