codeply-cli 0.1.0 → 0.1.1
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/lib/agent.mjs +5 -4
- package/lib/ai.js +4 -1
- package/lib/config.js +11 -2
- package/lib/edit-engine.js +1 -1
- package/lib/tui.mjs +1 -1
- package/package.json +1 -1
package/lib/agent.mjs
CHANGED
|
@@ -389,12 +389,13 @@ const NO_NATIVE_TOOLS_REMINDER =
|
|
|
389
389
|
'[system] Your last reply tried to invoke a function through the API. That is not available here and the response was discarded. ' +
|
|
390
390
|
'Write the action block as literal text in your message — the tags exactly as shown in the OUTPUT FORMAT section — and nothing else.';
|
|
391
391
|
|
|
392
|
-
async function callModel(messages) {
|
|
393
|
-
|
|
392
|
+
async function callModel(messages, promptText) {
|
|
393
|
+
const meta = promptText ? { promptText } : undefined;
|
|
394
|
+
let result = await ai.chat(messages, { meta });
|
|
394
395
|
if (result.success || !isNativeToolCallError(result.error)) return { result, messages };
|
|
395
396
|
|
|
396
397
|
const corrected = [...messages, { role: 'user', content: NO_NATIVE_TOOLS_REMINDER }];
|
|
397
|
-
result = await ai.chat(corrected);
|
|
398
|
+
result = await ai.chat(corrected, { meta });
|
|
398
399
|
return { result, messages: corrected };
|
|
399
400
|
}
|
|
400
401
|
|
|
@@ -427,7 +428,7 @@ export async function* runAgent({ userMessage, history, mode, cwd, approve, sign
|
|
|
427
428
|
for (let step = 0; step < MAX_STEPS; step++) {
|
|
428
429
|
if (signal.aborted) { yield { type: 'aborted' }; return; }
|
|
429
430
|
|
|
430
|
-
const attempt = await callModel(trimTranscript(messages));
|
|
431
|
+
const attempt = await callModel(trimTranscript(messages), userMessage);
|
|
431
432
|
const result = attempt.result;
|
|
432
433
|
if (!result.success) {
|
|
433
434
|
yield {
|
package/lib/ai.js
CHANGED
|
@@ -85,7 +85,10 @@ async function chatViaProxy(messages, opts) {
|
|
|
85
85
|
'Authorization': `Bearer ${token}`,
|
|
86
86
|
'apikey': SUPABASE_ANON_KEY,
|
|
87
87
|
},
|
|
88
|
-
|
|
88
|
+
// meta is optional, display-only context (what was asked, which file) —
|
|
89
|
+
// the proxy logs it to usage_history so CLI activity shows up in the
|
|
90
|
+
// admin dashboard next to the desktop app, same as this app's own calls.
|
|
91
|
+
body: JSON.stringify({ messages, opts, meta: opts.meta }),
|
|
89
92
|
});
|
|
90
93
|
} catch (e) {
|
|
91
94
|
// Network-level failure — also worth another go.
|
package/lib/config.js
CHANGED
|
@@ -77,7 +77,7 @@ function maskKey(key) {
|
|
|
77
77
|
return key.slice(0, 4) + '…' + key.slice(-4);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
/** One-line description of where completions are coming from. */
|
|
80
|
+
/** One-line description of where completions are coming from, model included (for `codeply provider`). */
|
|
81
81
|
function describeProvider(cfg = getConfig()) {
|
|
82
82
|
if (cfg.provider === 'ollama') {
|
|
83
83
|
const where = /localhost|127\.0\.0\.1/.test(cfg.ollama.host) ? 'local' : 'cloud';
|
|
@@ -86,4 +86,13 @@ function describeProvider(cfg = getConfig()) {
|
|
|
86
86
|
return 'codeply proxy';
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
/** Same, but without naming the specific model — for passive UI chrome (the TUI status line). */
|
|
90
|
+
function describeProviderShort(cfg = getConfig()) {
|
|
91
|
+
if (cfg.provider === 'ollama') {
|
|
92
|
+
const where = /localhost|127\.0\.0\.1/.test(cfg.ollama.host) ? 'local' : 'cloud';
|
|
93
|
+
return `ollama ${where}`;
|
|
94
|
+
}
|
|
95
|
+
return 'codeply proxy';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = { getConfig, saveConfig, maskKey, describeProvider, describeProviderShort, configPath };
|
package/lib/edit-engine.js
CHANGED
|
@@ -155,7 +155,7 @@ async function computeInstructionEdits(instruction, filePath) {
|
|
|
155
155
|
];
|
|
156
156
|
if (feedback) messages.push({ role: 'user', content: feedback });
|
|
157
157
|
|
|
158
|
-
const aiResult = await ai.chat(messages, { json: true });
|
|
158
|
+
const aiResult = await ai.chat(messages, { json: true, meta: { promptText: instruction, filePath } });
|
|
159
159
|
if (!aiResult.success) throw new Error(aiResult.error);
|
|
160
160
|
if (aiResult.modelUsed) lastModelUsed = aiResult.modelUsed;
|
|
161
161
|
const data = aiResult.data;
|
package/lib/tui.mjs
CHANGED
|
@@ -713,7 +713,7 @@ const App = () => {
|
|
|
713
713
|
const provider = React.useMemo(() => appConfig.getConfig(), []);
|
|
714
714
|
const usingOllama = provider.provider === 'ollama';
|
|
715
715
|
const account = usingOllama
|
|
716
|
-
? appConfig.
|
|
716
|
+
? appConfig.describeProviderShort(provider)
|
|
717
717
|
: session ? session.user.email : 'not signed in';
|
|
718
718
|
|
|
719
719
|
// Advertise the key that actually inserts a newline in THIS terminal.
|
package/package.json
CHANGED