@xagent/one-shot 1.1.101 → 1.1.103
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/README.md +1 -1
- package/dist/index.js +60 -300
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -7331,10 +7331,10 @@ var init_dependency_analyzer = __esm({
|
|
|
7331
7331
|
const circularDeps = [];
|
|
7332
7332
|
const visited = /* @__PURE__ */ new Set();
|
|
7333
7333
|
const visiting = /* @__PURE__ */ new Set();
|
|
7334
|
-
const dfs = (filePath,
|
|
7334
|
+
const dfs = (filePath, path33) => {
|
|
7335
7335
|
if (visiting.has(filePath)) {
|
|
7336
|
-
const cycleStart =
|
|
7337
|
-
const cycle =
|
|
7336
|
+
const cycleStart = path33.indexOf(filePath);
|
|
7337
|
+
const cycle = path33.slice(cycleStart).concat([filePath]);
|
|
7338
7338
|
circularDeps.push({
|
|
7339
7339
|
cycle: cycle.map((fp) => graph.nodes.get(fp)?.filePath || fp),
|
|
7340
7340
|
severity: cycle.length <= 2 ? "error" : "warning",
|
|
@@ -7350,7 +7350,7 @@ var init_dependency_analyzer = __esm({
|
|
|
7350
7350
|
if (node) {
|
|
7351
7351
|
for (const dependency of node.dependencies) {
|
|
7352
7352
|
if (graph.nodes.has(dependency)) {
|
|
7353
|
-
dfs(dependency, [...
|
|
7353
|
+
dfs(dependency, [...path33, filePath]);
|
|
7354
7354
|
}
|
|
7355
7355
|
}
|
|
7356
7356
|
}
|
|
@@ -12097,131 +12097,6 @@ ${option.id}) ${option.title}`);
|
|
|
12097
12097
|
}
|
|
12098
12098
|
});
|
|
12099
12099
|
|
|
12100
|
-
// src/utils/context-loader.ts
|
|
12101
|
-
var context_loader_exports = {};
|
|
12102
|
-
__export(context_loader_exports, {
|
|
12103
|
-
formatContextStatus: () => formatContextStatus,
|
|
12104
|
-
loadContext: () => loadContext
|
|
12105
|
-
});
|
|
12106
|
-
function loadMarkdownDirectory(dirPath) {
|
|
12107
|
-
if (!fs2__default.existsSync(dirPath)) {
|
|
12108
|
-
return "";
|
|
12109
|
-
}
|
|
12110
|
-
const files = fs2__default.readdirSync(dirPath).filter((file) => file.endsWith(".md")).sort();
|
|
12111
|
-
let content = "";
|
|
12112
|
-
for (const file of files) {
|
|
12113
|
-
const filePath = path8__default.join(dirPath, file);
|
|
12114
|
-
try {
|
|
12115
|
-
const fileContent = fs2__default.readFileSync(filePath, "utf-8");
|
|
12116
|
-
content += `
|
|
12117
|
-
|
|
12118
|
-
=== ${file} ===
|
|
12119
|
-
|
|
12120
|
-
${fileContent}`;
|
|
12121
|
-
} catch (error) {
|
|
12122
|
-
console.warn(`Failed to read ${filePath}:`, error);
|
|
12123
|
-
}
|
|
12124
|
-
}
|
|
12125
|
-
return content;
|
|
12126
|
-
}
|
|
12127
|
-
function extractDateFromFilename(filename) {
|
|
12128
|
-
const match = filename.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
12129
|
-
if (match) {
|
|
12130
|
-
return new Date(match[1]);
|
|
12131
|
-
}
|
|
12132
|
-
return /* @__PURE__ */ new Date(0);
|
|
12133
|
-
}
|
|
12134
|
-
function summarizeContent(content, maxLength = MAX_SUMMARY_LENGTH) {
|
|
12135
|
-
if (content.length <= maxLength) {
|
|
12136
|
-
return content;
|
|
12137
|
-
}
|
|
12138
|
-
const truncated = content.substring(0, maxLength);
|
|
12139
|
-
const lastNewline = truncated.lastIndexOf("\n\n");
|
|
12140
|
-
if (lastNewline > maxLength * 0.8) {
|
|
12141
|
-
return truncated.substring(0, lastNewline);
|
|
12142
|
-
}
|
|
12143
|
-
return truncated + "\n\n[...content truncated for context budget...]";
|
|
12144
|
-
}
|
|
12145
|
-
function loadTaskFiles(tasksDir, maxBudget) {
|
|
12146
|
-
if (!fs2__default.existsSync(tasksDir)) {
|
|
12147
|
-
return [];
|
|
12148
|
-
}
|
|
12149
|
-
const files = fs2__default.readdirSync(tasksDir).filter((file) => file.endsWith(".md")).map((filename) => {
|
|
12150
|
-
const filePath = path8__default.join(tasksDir, filename);
|
|
12151
|
-
const content = fs2__default.readFileSync(filePath, "utf-8");
|
|
12152
|
-
return {
|
|
12153
|
-
filename,
|
|
12154
|
-
content,
|
|
12155
|
-
size: Buffer.byteLength(content, "utf-8"),
|
|
12156
|
-
date: extractDateFromFilename(filename),
|
|
12157
|
-
isSummarized: false
|
|
12158
|
-
};
|
|
12159
|
-
}).sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
12160
|
-
const result = [];
|
|
12161
|
-
let usedBudget = 0;
|
|
12162
|
-
for (const file of files) {
|
|
12163
|
-
let finalContent = file.content;
|
|
12164
|
-
let isSummarized = false;
|
|
12165
|
-
if (usedBudget + file.size > maxBudget) {
|
|
12166
|
-
finalContent = summarizeContent(file.content);
|
|
12167
|
-
const summarizedSize = Buffer.byteLength(finalContent, "utf-8");
|
|
12168
|
-
if (usedBudget + summarizedSize > maxBudget) {
|
|
12169
|
-
continue;
|
|
12170
|
-
}
|
|
12171
|
-
usedBudget += summarizedSize;
|
|
12172
|
-
isSummarized = true;
|
|
12173
|
-
} else {
|
|
12174
|
-
usedBudget += file.size;
|
|
12175
|
-
}
|
|
12176
|
-
result.push({
|
|
12177
|
-
...file,
|
|
12178
|
-
content: finalContent,
|
|
12179
|
-
isSummarized
|
|
12180
|
-
});
|
|
12181
|
-
}
|
|
12182
|
-
return result;
|
|
12183
|
-
}
|
|
12184
|
-
function loadContext(agentDir = ".agent") {
|
|
12185
|
-
const systemContent = loadMarkdownDirectory(path8__default.join(agentDir, "system"));
|
|
12186
|
-
const sopContent = loadMarkdownDirectory(path8__default.join(agentDir, "sop"));
|
|
12187
|
-
const systemSize = Buffer.byteLength(systemContent, "utf-8");
|
|
12188
|
-
const sopSize = Buffer.byteLength(sopContent, "utf-8");
|
|
12189
|
-
const taskBudget = Math.max(0, CONTEXT_BUDGET_BYTES - systemSize - sopSize);
|
|
12190
|
-
const tasks = loadTaskFiles(path8__default.join(agentDir, "tasks"), taskBudget);
|
|
12191
|
-
const totalSize = systemSize + sopSize + tasks.reduce((sum, task) => sum + Buffer.byteLength(task.content, "utf-8"), 0);
|
|
12192
|
-
const warnings = [];
|
|
12193
|
-
if (totalSize > CONTEXT_BUDGET_BYTES) {
|
|
12194
|
-
warnings.push(`Context size (${(totalSize / 1024).toFixed(1)}KB) exceeds budget (${CONTEXT_BUDGET_BYTES / 1024}KB)`);
|
|
12195
|
-
}
|
|
12196
|
-
return {
|
|
12197
|
-
system: systemContent,
|
|
12198
|
-
sop: sopContent,
|
|
12199
|
-
tasks,
|
|
12200
|
-
totalSize,
|
|
12201
|
-
warnings
|
|
12202
|
-
};
|
|
12203
|
-
}
|
|
12204
|
-
function formatContextStatus(pack) {
|
|
12205
|
-
const taskCount = pack.tasks.length;
|
|
12206
|
-
const summarizedCount = pack.tasks.filter((t) => t.isSummarized).length;
|
|
12207
|
-
const sizeKB = (pack.totalSize / 1024).toFixed(1);
|
|
12208
|
-
let status = `[x-cli] Context: loaded system docs, sop docs, ${taskCount} task docs (~${sizeKB} KB).`;
|
|
12209
|
-
if (summarizedCount > 0) {
|
|
12210
|
-
status += ` Summarized ${summarizedCount} older tasks for context budget.`;
|
|
12211
|
-
}
|
|
12212
|
-
if (pack.warnings.length > 0) {
|
|
12213
|
-
status += ` Warnings: ${pack.warnings.join("; ")}`;
|
|
12214
|
-
}
|
|
12215
|
-
return status;
|
|
12216
|
-
}
|
|
12217
|
-
var CONTEXT_BUDGET_BYTES, MAX_SUMMARY_LENGTH;
|
|
12218
|
-
var init_context_loader = __esm({
|
|
12219
|
-
"src/utils/context-loader.ts"() {
|
|
12220
|
-
CONTEXT_BUDGET_BYTES = 280 * 1024;
|
|
12221
|
-
MAX_SUMMARY_LENGTH = 2e3;
|
|
12222
|
-
}
|
|
12223
|
-
});
|
|
12224
|
-
|
|
12225
12100
|
// src/agent/grok-agent.ts
|
|
12226
12101
|
var grok_agent_exports = {};
|
|
12227
12102
|
__export(grok_agent_exports, {
|
|
@@ -12256,6 +12131,7 @@ var init_grok_agent = __esm({
|
|
|
12256
12131
|
const savedModel = manager.getCurrentModel();
|
|
12257
12132
|
const modelToUse = model || savedModel || "grok-code-fast-1";
|
|
12258
12133
|
this.maxToolRounds = maxToolRounds || 400;
|
|
12134
|
+
this.contextPack = contextPack;
|
|
12259
12135
|
this.sessionLogPath = process.env.GROK_SESSION_LOG || `${process.env.HOME}/.grok/session.log`;
|
|
12260
12136
|
this.grokClient = new GrokClient(apiKey2, modelToUse, baseURL);
|
|
12261
12137
|
this.textEditor = new TextEditorTool();
|
|
@@ -12285,16 +12161,16 @@ CUSTOM INSTRUCTIONS:
|
|
|
12285
12161
|
${customInstructions}
|
|
12286
12162
|
|
|
12287
12163
|
The above custom instructions should be followed alongside the standard instructions below.` : "";
|
|
12288
|
-
const contextSection = contextPack ? `
|
|
12164
|
+
const contextSection = this.contextPack ? `
|
|
12289
12165
|
|
|
12290
12166
|
PROJECT CONTEXT:
|
|
12291
|
-
${contextPack.system}
|
|
12167
|
+
${this.contextPack.system}
|
|
12292
12168
|
|
|
12293
12169
|
SOP:
|
|
12294
|
-
${contextPack.sop}
|
|
12170
|
+
${this.contextPack.sop}
|
|
12295
12171
|
|
|
12296
12172
|
TASKS:
|
|
12297
|
-
${contextPack.tasks.map((t) => `- ${t.filename}: ${t.content}`).join("\n")}
|
|
12173
|
+
${this.contextPack.tasks.map((t) => `- ${t.filename}: ${t.content}`).join("\n")}
|
|
12298
12174
|
|
|
12299
12175
|
The above project context should inform your responses and decision making.` : "";
|
|
12300
12176
|
this.messages.push({
|
|
@@ -12452,14 +12328,12 @@ Current working directory: ${process.cwd()}`
|
|
|
12452
12328
|
this.logEntry(userEntry);
|
|
12453
12329
|
this.messages.push({ role: "user", content: message });
|
|
12454
12330
|
try {
|
|
12455
|
-
const contextPack = await this.loadContextPack();
|
|
12456
12331
|
const workflowService = new ResearchRecommendService(this);
|
|
12457
12332
|
const request = {
|
|
12458
|
-
userTask: message
|
|
12459
|
-
context: contextPack ? "Project context loaded" : void 0
|
|
12333
|
+
userTask: message
|
|
12460
12334
|
};
|
|
12461
12335
|
console.log("\u{1F50D} Researching and analyzing...");
|
|
12462
|
-
const { output, approval, revisions } = await workflowService.researchAndGetApproval(request, contextPack);
|
|
12336
|
+
const { output, approval, revisions } = await workflowService.researchAndGetApproval(request, this.contextPack);
|
|
12463
12337
|
if (!approval.approved) {
|
|
12464
12338
|
const rejectionEntry = {
|
|
12465
12339
|
type: "assistant",
|
|
@@ -12863,10 +12737,10 @@ Current working directory: ${process.cwd()}`
|
|
|
12863
12737
|
return await this.textEditor.view(args.path, range);
|
|
12864
12738
|
} catch (error) {
|
|
12865
12739
|
console.warn(`view_file tool failed, falling back to bash: ${error.message}`);
|
|
12866
|
-
const
|
|
12867
|
-
let command = `cat "${
|
|
12740
|
+
const path33 = args.path;
|
|
12741
|
+
let command = `cat "${path33}"`;
|
|
12868
12742
|
if (args.start_line && args.end_line) {
|
|
12869
|
-
command = `sed -n '${args.start_line},${args.end_line}p' "${
|
|
12743
|
+
command = `sed -n '${args.start_line},${args.end_line}p' "${path33}"`;
|
|
12870
12744
|
}
|
|
12871
12745
|
return await this.bash.execute(command);
|
|
12872
12746
|
}
|
|
@@ -13130,18 +13004,6 @@ EOF`;
|
|
|
13130
13004
|
console.warn("Failed to log session entry:", error);
|
|
13131
13005
|
}
|
|
13132
13006
|
}
|
|
13133
|
-
/**
|
|
13134
|
-
* Load .agent context pack for enhanced recommendations
|
|
13135
|
-
*/
|
|
13136
|
-
async loadContextPack() {
|
|
13137
|
-
try {
|
|
13138
|
-
const contextLoader = await Promise.resolve().then(() => (init_context_loader(), context_loader_exports));
|
|
13139
|
-
return await contextLoader.loadContext(".agent");
|
|
13140
|
-
} catch (error) {
|
|
13141
|
-
console.warn("[Workflow] Failed to load context pack:", error);
|
|
13142
|
-
return void 0;
|
|
13143
|
-
}
|
|
13144
|
-
}
|
|
13145
13007
|
/**
|
|
13146
13008
|
* Convert workflow results to chat entries for display
|
|
13147
13009
|
*/
|
|
@@ -18638,7 +18500,7 @@ var init_package = __esm({
|
|
|
18638
18500
|
package_default = {
|
|
18639
18501
|
type: "module",
|
|
18640
18502
|
name: "@xagent/one-shot",
|
|
18641
|
-
version: "1.1.
|
|
18503
|
+
version: "1.1.103",
|
|
18642
18504
|
description: "An open-source AI agent that brings advanced AI capabilities directly into your terminal with automatic documentation updates.",
|
|
18643
18505
|
main: "dist/index.js",
|
|
18644
18506
|
module: "dist/index.js",
|
|
@@ -21202,125 +21064,50 @@ var init_use_context_info = __esm({
|
|
|
21202
21064
|
"src/hooks/use-context-info.ts"() {
|
|
21203
21065
|
}
|
|
21204
21066
|
});
|
|
21205
|
-
function
|
|
21067
|
+
function useCLAUDEmd(setChatHistory) {
|
|
21206
21068
|
useEffect(() => {
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
21214
|
-
|
|
21215
|
-
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
|
|
21220
|
-
|
|
21221
|
-
|
|
21222
|
-
|
|
21223
|
-
|
|
21224
|
-
|
|
21225
|
-
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
|
|
21229
|
-
const showSummaryMessage = config2?.showSummaryMessage !== false;
|
|
21230
|
-
const showFileContents = config2?.showFileContents === true;
|
|
21231
|
-
if (!isEnabled) {
|
|
21232
|
-
return;
|
|
21233
|
-
}
|
|
21234
|
-
if (showLoadingMessage) {
|
|
21235
|
-
initialMessages.push({
|
|
21236
|
-
type: "assistant",
|
|
21237
|
-
content: "\u{1F4DA} Reading core documentation into memory...",
|
|
21238
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
21239
|
-
});
|
|
21240
|
-
}
|
|
21241
|
-
console.log("\u{1F50D} Auto-reading .agent documentation...");
|
|
21242
|
-
const folders = config2?.folders || [
|
|
21243
|
-
{
|
|
21244
|
-
name: "system",
|
|
21245
|
-
priority: 1,
|
|
21246
|
-
files: [
|
|
21247
|
-
{ name: "architecture.md", title: "System Architecture", icon: "\u{1F4CB}", required: true },
|
|
21248
|
-
{ name: "critical-state.md", title: "Critical State", icon: "\u{1F3D7}\uFE0F", required: false },
|
|
21249
|
-
{ name: "installation.md", title: "Installation", icon: "\u{1F3D7}\uFE0F", required: false },
|
|
21250
|
-
{ name: "api-schema.md", title: "API Schema", icon: "\u{1F3D7}\uFE0F", required: false },
|
|
21251
|
-
{ name: "auto-read-system.md", title: "Auto-Read System", icon: "\u{1F3D7}\uFE0F", required: false }
|
|
21252
|
-
]
|
|
21253
|
-
},
|
|
21254
|
-
{
|
|
21255
|
-
name: "sop",
|
|
21256
|
-
priority: 2,
|
|
21257
|
-
files: [
|
|
21258
|
-
{ name: "git-workflow.md", title: "Git Workflow SOP", icon: "\u{1F527}", required: true },
|
|
21259
|
-
{ name: "release-management.md", title: "Release Management SOP", icon: "\u{1F4D6}", required: false },
|
|
21260
|
-
{ name: "automation-protection.md", title: "Automation Protection SOP", icon: "\u{1F4D6}", required: false },
|
|
21261
|
-
{ name: "npm-publishing-troubleshooting.md", title: "NPM Publishing Troubleshooting", icon: "\u{1F4D6}", required: false }
|
|
21262
|
-
]
|
|
21263
|
-
}
|
|
21264
|
-
];
|
|
21265
|
-
if (config2?.customFolders) {
|
|
21266
|
-
folders.push(...config2.customFolders);
|
|
21267
|
-
}
|
|
21268
|
-
folders.sort((a, b) => (a.priority || 999) - (b.priority || 999));
|
|
21269
|
-
for (const folder of folders) {
|
|
21270
|
-
const folderPath = path8__default.join(".agent", folder.name);
|
|
21271
|
-
if (!fs2__default.existsSync(folderPath)) {
|
|
21272
|
-
continue;
|
|
21069
|
+
const filesToLoad = [
|
|
21070
|
+
{ path: "GROK.md", label: "GROK.md", fallback: "CLAUDE.md" },
|
|
21071
|
+
{ path: "docs-index.md", label: "Documentation Index" }
|
|
21072
|
+
];
|
|
21073
|
+
const loadedDocs = [];
|
|
21074
|
+
let totalChars = 0;
|
|
21075
|
+
for (const file of filesToLoad) {
|
|
21076
|
+
let filePath = file.path;
|
|
21077
|
+
let exists = fs2__default.existsSync(filePath);
|
|
21078
|
+
if (!exists && file.fallback) {
|
|
21079
|
+
filePath = file.fallback;
|
|
21080
|
+
exists = fs2__default.existsSync(filePath);
|
|
21081
|
+
}
|
|
21082
|
+
if (exists) {
|
|
21083
|
+
try {
|
|
21084
|
+
const content = fs2__default.readFileSync(filePath, "utf8");
|
|
21085
|
+
const charCount = content.length;
|
|
21086
|
+
totalChars += charCount;
|
|
21087
|
+
loadedDocs.push(file.label);
|
|
21088
|
+
console.log(`\u{1F4C4} Loaded: ${file.label} (${charCount} chars)`);
|
|
21089
|
+
} catch (error) {
|
|
21090
|
+
console.warn(`\u26A0\uFE0F Failed to load ${file.label}:`, error);
|
|
21273
21091
|
}
|
|
21274
|
-
|
|
21275
|
-
|
|
21276
|
-
|
|
21277
|
-
continue;
|
|
21278
|
-
} else {
|
|
21279
|
-
filePaths = [file.name];
|
|
21280
|
-
}
|
|
21281
|
-
for (const fileName of filePaths) {
|
|
21282
|
-
const filePath = path8__default.join(folderPath, fileName);
|
|
21283
|
-
if (!fs2__default.existsSync(filePath)) {
|
|
21284
|
-
if (file.required) ;
|
|
21285
|
-
continue;
|
|
21286
|
-
}
|
|
21287
|
-
try {
|
|
21288
|
-
const content = fs2__default.readFileSync(filePath, "utf8");
|
|
21289
|
-
const displayTitle = file.title || fileName.replace(".md", "").replace("-", " ").toUpperCase();
|
|
21290
|
-
const icon = file.icon || "\u{1F4C4}";
|
|
21291
|
-
console.log(`\u{1F4C4} Loaded: ${folder.name}/${fileName} (${content.length} chars)`);
|
|
21292
|
-
if (showFileContents) {
|
|
21293
|
-
initialMessages.push({
|
|
21294
|
-
type: "assistant",
|
|
21295
|
-
content: `${icon} **${displayTitle} (from .agent/${folder.name}/${fileName})**
|
|
21296
|
-
|
|
21297
|
-
${content}`,
|
|
21298
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
21299
|
-
});
|
|
21300
|
-
}
|
|
21301
|
-
docsRead++;
|
|
21302
|
-
} catch (_error) {
|
|
21303
|
-
console.log(`\u26A0\uFE0F Failed to read: ${folder.name}/${fileName}`);
|
|
21304
|
-
}
|
|
21305
|
-
}
|
|
21092
|
+
} else {
|
|
21093
|
+
if (process.env.NODE_ENV === "development") {
|
|
21094
|
+
console.log(`\u2139\uFE0F ${file.label} not found - will be created in Sprint 1`);
|
|
21306
21095
|
}
|
|
21307
21096
|
}
|
|
21308
|
-
|
|
21309
|
-
|
|
21310
|
-
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
}
|
|
21316
|
-
|
|
21317
|
-
setChatHistory(initialMessages);
|
|
21318
|
-
}
|
|
21097
|
+
}
|
|
21098
|
+
if (loadedDocs.length > 0) {
|
|
21099
|
+
const tokenEstimate = Math.round(totalChars / 4);
|
|
21100
|
+
console.log(`\u2705 Context initialized: ${loadedDocs.join(", ")}`);
|
|
21101
|
+
console.log(`\u{1F4CA} Estimated tokens loaded: ~${tokenEstimate} (target: ~700)`);
|
|
21102
|
+
console.log("\u{1F4DA} Additional docs available on-demand via Read tool");
|
|
21103
|
+
} else {
|
|
21104
|
+
console.log("\u{1F4DD} No GROK.md found yet - proceeding without initial context");
|
|
21105
|
+
console.log("\u{1F4A1} Docs will be loaded on-demand via Read tool");
|
|
21319
21106
|
}
|
|
21320
21107
|
}, [setChatHistory]);
|
|
21321
21108
|
}
|
|
21322
|
-
var
|
|
21323
|
-
"src/hooks/use-
|
|
21109
|
+
var init_use_claude_md = __esm({
|
|
21110
|
+
"src/hooks/use-claude-md.ts"() {
|
|
21324
21111
|
}
|
|
21325
21112
|
});
|
|
21326
21113
|
function useStreaming(agent, initialMessage, setChatHistory, streamingState) {
|
|
@@ -23619,9 +23406,7 @@ __export(chat_interface_exports, {
|
|
|
23619
23406
|
function ChatInterfaceWithAgent({
|
|
23620
23407
|
agent,
|
|
23621
23408
|
initialMessage,
|
|
23622
|
-
quiet = false
|
|
23623
|
-
contextPack: _contextPack,
|
|
23624
|
-
contextStatus
|
|
23409
|
+
quiet = false
|
|
23625
23410
|
}) {
|
|
23626
23411
|
const [chatHistory, setChatHistory] = useState([]);
|
|
23627
23412
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
@@ -23631,18 +23416,7 @@ function ChatInterfaceWithAgent({
|
|
|
23631
23416
|
const [confirmationOptions, setConfirmationOptions] = useState(null);
|
|
23632
23417
|
const [showContextTooltip, setShowContextTooltip] = useState(false);
|
|
23633
23418
|
const processingStartTime = useRef(0);
|
|
23634
|
-
|
|
23635
|
-
useEffect(() => {
|
|
23636
|
-
const initialHistory = [];
|
|
23637
|
-
if (contextStatus) {
|
|
23638
|
-
initialHistory.push({
|
|
23639
|
-
type: "assistant",
|
|
23640
|
-
content: `\u{1F527} ${contextStatus}`,
|
|
23641
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
23642
|
-
});
|
|
23643
|
-
}
|
|
23644
|
-
setChatHistory(initialHistory);
|
|
23645
|
-
}, [contextStatus]);
|
|
23419
|
+
useCLAUDEmd(setChatHistory);
|
|
23646
23420
|
useSessionLogging(chatHistory);
|
|
23647
23421
|
const { contextInfo } = useContextInfo(agent);
|
|
23648
23422
|
const handleGlobalShortcuts = (str, key) => {
|
|
@@ -23739,9 +23513,7 @@ function ChatInterfaceWithAgent({
|
|
|
23739
23513
|
function ChatInterface({
|
|
23740
23514
|
agent,
|
|
23741
23515
|
initialMessage,
|
|
23742
|
-
quiet = false
|
|
23743
|
-
contextPack,
|
|
23744
|
-
contextStatus
|
|
23516
|
+
quiet = false
|
|
23745
23517
|
}) {
|
|
23746
23518
|
const [currentAgent, setCurrentAgent] = useState(
|
|
23747
23519
|
agent || null
|
|
@@ -23757,9 +23529,7 @@ function ChatInterface({
|
|
|
23757
23529
|
{
|
|
23758
23530
|
agent: currentAgent,
|
|
23759
23531
|
initialMessage,
|
|
23760
|
-
quiet
|
|
23761
|
-
contextPack,
|
|
23762
|
-
contextStatus
|
|
23532
|
+
quiet
|
|
23763
23533
|
}
|
|
23764
23534
|
);
|
|
23765
23535
|
}
|
|
@@ -23769,7 +23539,7 @@ var init_chat_interface = __esm({
|
|
|
23769
23539
|
init_confirmation_service();
|
|
23770
23540
|
init_api_key_input();
|
|
23771
23541
|
init_use_context_info();
|
|
23772
|
-
|
|
23542
|
+
init_use_claude_md();
|
|
23773
23543
|
init_use_streaming();
|
|
23774
23544
|
init_use_confirmations();
|
|
23775
23545
|
init_use_introduction();
|
|
@@ -24038,7 +23808,7 @@ var require_package = __commonJS({
|
|
|
24038
23808
|
module.exports = {
|
|
24039
23809
|
type: "module",
|
|
24040
23810
|
name: "@xagent/one-shot",
|
|
24041
|
-
version: "1.1.
|
|
23811
|
+
version: "1.1.103",
|
|
24042
23812
|
description: "An open-source AI agent that brings advanced AI capabilities directly into your terminal with automatic documentation updates.",
|
|
24043
23813
|
main: "dist/index.js",
|
|
24044
23814
|
module: "dist/index.js",
|
|
@@ -24223,7 +23993,6 @@ try {
|
|
|
24223
23993
|
const { createToggleConfirmationsCommand: createToggleConfirmationsCommand2 } = await Promise.resolve().then(() => (init_toggle_confirmations(), toggle_confirmations_exports));
|
|
24224
23994
|
const pkg = await Promise.resolve().then(() => __toESM(require_package(), 1));
|
|
24225
23995
|
const { checkForUpdates: checkForUpdates2 } = await Promise.resolve().then(() => (init_version_checker(), version_checker_exports));
|
|
24226
|
-
const { loadContext: loadContext2, formatContextStatus: formatContextStatus2 } = await Promise.resolve().then(() => (init_context_loader(), context_loader_exports));
|
|
24227
23996
|
log("\u2705 All modules imported successfully");
|
|
24228
23997
|
process.on("SIGTERM", () => {
|
|
24229
23998
|
log("\u{1F44B} Gracefully shutting down...");
|
|
@@ -24297,15 +24066,7 @@ try {
|
|
|
24297
24066
|
console.error("\u274C Error: X CLI requires an interactive terminal.");
|
|
24298
24067
|
process.exit(1);
|
|
24299
24068
|
}
|
|
24300
|
-
|
|
24301
|
-
let statusMessage;
|
|
24302
|
-
try {
|
|
24303
|
-
contextPack = loadContext2();
|
|
24304
|
-
statusMessage = formatContextStatus2(contextPack);
|
|
24305
|
-
log("\u{1F4DA} Context loaded successfully");
|
|
24306
|
-
} catch (error) {
|
|
24307
|
-
log(`\u26A0\uFE0F Context loading failed: ${error}`);
|
|
24308
|
-
}
|
|
24069
|
+
log("\u{1F4DA} Documentation available via GROK.md + docs-index.md");
|
|
24309
24070
|
log("\u{1F680} Launching interactive CLI...");
|
|
24310
24071
|
if (!options.quiet) {
|
|
24311
24072
|
printWelcomeBanner2(options.quiet);
|
|
@@ -24314,8 +24075,7 @@ try {
|
|
|
24314
24075
|
const app = render(React4.createElement(ChatInterface2, {
|
|
24315
24076
|
agent,
|
|
24316
24077
|
initialMessage,
|
|
24317
|
-
quiet: options.quiet
|
|
24318
|
-
contextStatus: statusMessage
|
|
24078
|
+
quiet: options.quiet
|
|
24319
24079
|
}));
|
|
24320
24080
|
const cleanup = () => {
|
|
24321
24081
|
log("\u{1F44B} Shutting down...");
|