@xuda.io/ai_module 1.1.5658 → 1.1.5659
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/index.mjs +54 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3447,6 +3447,10 @@ export const get_code_run = async function (req) {
|
|
|
3447
3447
|
repo_id: run.repo_id || null,
|
|
3448
3448
|
branch: run.branch || null,
|
|
3449
3449
|
base_sha: run.base_sha || null,
|
|
3450
|
+
// UI-228: what the verification found. Present only on a xudex run, and the reason the
|
|
3451
|
+
// panel can say "test failed" with the output instead of leaving the customer to guess
|
|
3452
|
+
// why the answer sounded confident and the build is red.
|
|
3453
|
+
verify: run.verify || null,
|
|
3450
3454
|
commands: (run.commands || []).map((c) => ({ command: c.command, exit_code: c.exit_code, ts: c.ts, output: c.output })),
|
|
3451
3455
|
files: (run.files || []).map((f) => ({ path: f.path, rel: f.rel, change: f.change, diff_available: !!f.diff_available, revert_available: !!f.revert_available, reverted_ts: f.reverted_ts || null })),
|
|
3452
3456
|
files_truncated: !!run.files_truncated,
|
|
@@ -11352,7 +11356,11 @@ ${conversation_history || `User (dashboard): ${prompt}`}
|
|
|
11352
11356
|
app_id: target_app_id,
|
|
11353
11357
|
conversation_id,
|
|
11354
11358
|
prompt,
|
|
11355
|
-
|
|
11359
|
+
// The picker sends its choice in the dashboard CONTEXT, which is where the Code
|
|
11360
|
+
// workspace already puts code_surface and project_id, so read it from there first and
|
|
11361
|
+
// fall back to a top-level field for any caller that sets one. Unset means the engine
|
|
11362
|
+
// registry's own default decides, rather than a name hard-coded here.
|
|
11363
|
+
engine: get_dashboard_context_obj(req, conversation_doc)?.xudex_engine || req.xudex_engine || null,
|
|
11356
11364
|
model: req.codex_model || req.ai_model || null,
|
|
11357
11365
|
resume_session_id: conversation_doc.codex_session_id && conversation_doc.codex_session_host === code_run_host() ? conversation_doc.codex_session_id : null,
|
|
11358
11366
|
on_event: (event) => {
|
|
@@ -11393,6 +11401,51 @@ ${conversation_history || `User (dashboard): ${prompt}`}
|
|
|
11393
11401
|
emitToDashboard('response_start');
|
|
11394
11402
|
streamText(answer);
|
|
11395
11403
|
emitToDashboard('stream_end');
|
|
11404
|
+
// A code_run doc, so the workspace panel keeps working unchanged. The panel loads the
|
|
11405
|
+
// latest run for a conversation and renders files, diffs, revert and the git header from
|
|
11406
|
+
// it; without this a xudex run would leave it saying "nothing has run in this chat yet"
|
|
11407
|
+
// right after a run, and every one of those features would have to be rebuilt against a
|
|
11408
|
+
// second representation of the same thing.
|
|
11409
|
+
try {
|
|
11410
|
+
await db_module.save_app_couch_doc_native(account_profile_info.app_id, {
|
|
11411
|
+
_id: await _common.xuda_get_uuid('code_run'),
|
|
11412
|
+
docType: 'code_run',
|
|
11413
|
+
stat: 3,
|
|
11414
|
+
engine: xret.data.engine || 'xudex',
|
|
11415
|
+
state: xret.data.ok ? 'done' : 'failed',
|
|
11416
|
+
uid,
|
|
11417
|
+
profile_id,
|
|
11418
|
+
app_id: account_profile_info.app_id,
|
|
11419
|
+
target_app_id,
|
|
11420
|
+
conversation_id,
|
|
11421
|
+
reference_id: conversation_doc.reference_id,
|
|
11422
|
+
host: code_run_host(),
|
|
11423
|
+
repo_id: project_repo?._id || null,
|
|
11424
|
+
branch: xret.data.branch || null,
|
|
11425
|
+
base_sha: xret.data.base_sha || null,
|
|
11426
|
+
codex_session_id: xret.data.session_id || null,
|
|
11427
|
+
started_ts: xret.record?.started_ts || Date.now(),
|
|
11428
|
+
ended_ts: xret.record?.ended_ts || Date.now(),
|
|
11429
|
+
usage: xret.record?.tokens || null,
|
|
11430
|
+
// Revert is deliberately NOT offered on a xudex run yet: the file lives on the
|
|
11431
|
+
// machine, and code_run_revert_file works against the region server's own copy. A
|
|
11432
|
+
// Revert button that quietly did nothing is worse than no button.
|
|
11433
|
+
files: (xret.data.files || []).map((f) => ({ path: f.rel, rel: f.rel, change: f.status === '??' ? 'add' : f.status === 'D' ? 'delete' : 'change', diff_available: false, revert_available: false })),
|
|
11434
|
+
commands: [],
|
|
11435
|
+
verify: {
|
|
11436
|
+
ok: xret.data.ok,
|
|
11437
|
+
verdict: xret.data.verdict,
|
|
11438
|
+
repair_turns: xret.data.repair_turns || 0,
|
|
11439
|
+
pre_existing_failure: !!xret.data.pre_existing_failure,
|
|
11440
|
+
failed: xret.data.failed ? { name: xret.data.failed.name, output: xret.data.failed.output, exit_code: xret.data.failed.exit_code } : null,
|
|
11441
|
+
steps: (xret.data.steps || []).map((s) => ({ name: s.name, ran: s.ran, ok: s.ok, why: s.why, ms: s.ms })),
|
|
11442
|
+
},
|
|
11443
|
+
ts: Date.now(),
|
|
11444
|
+
});
|
|
11445
|
+
} catch (e) {
|
|
11446
|
+
console.error(`[xudex] could not save the run doc: ${e.message}`);
|
|
11447
|
+
}
|
|
11448
|
+
|
|
11396
11449
|
return await saveAssistantItem(answer, { xudex: true, verified: xret.data.ok, files: xret.data.files, branch: xret.data.branch });
|
|
11397
11450
|
}
|
|
11398
11451
|
|