@bike4mind/cli 0.2.10-fix-b4m-cli-flicker.17230 → 0.2.10-ja-fix-confluence-table-data-5752.17252
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/{artifactExtractor-JAGU7QRL.js → artifactExtractor-WFUONETP.js} +1 -1
- package/dist/{chunk-GCVIRGIN.js → chunk-3I4UTS5N.js} +1 -1
- package/dist/{chunk-GO75FMLY.js → chunk-BFYTGKUM.js} +2 -2
- package/dist/{chunk-VZU4Z7WI.js → chunk-KPZSR7LA.js} +2 -2
- package/dist/{chunk-DJPXSSP4.js → chunk-THQIBKD4.js} +115 -30
- package/dist/{chunk-AQBZVAYO.js → chunk-Y7TWJGN7.js} +2 -2
- package/dist/{create-ZDOTF7XD.js → create-QKBTX2SB.js} +3 -3
- package/dist/index.js +109 -132
- package/dist/{llmMarkdownGenerator-LXUGJ7QH.js → llmMarkdownGenerator-NALGM3SY.js} +1 -1
- package/dist/{markdownGenerator-IMDG6OX6.js → markdownGenerator-GUZ3H2KM.js} +1 -1
- package/dist/{mementoService-TURUS3OH.js → mementoService-DVN7VNSJ.js} +3 -3
- package/dist/{src-YNY32ELR.js → src-KKM67YED.js} +7 -3
- package/dist/{src-6ZRXGE5J.js → src-Q25OMI3Y.js} +2 -2
- package/dist/{subtractCredits-GOVKM3IR.js → subtractCredits-YCAHUW6W.js} +3 -3
- package/package.json +6 -6
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
dayjsConfig_default,
|
|
17
17
|
extractSnippetMeta,
|
|
18
18
|
settingsMap
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-THQIBKD4.js";
|
|
20
20
|
|
|
21
21
|
// ../../b4m-core/packages/utils/dist/src/storage/S3Storage.js
|
|
22
22
|
import { S3Client, PutObjectCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3I4UTS5N.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-THQIBKD4.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3I4UTS5N.js";
|
|
6
6
|
import {
|
|
7
7
|
GenericCreditDeductTransaction,
|
|
8
8
|
ImageEditUsageTransaction,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
RealtimeVoiceUsageTransaction,
|
|
11
11
|
TextGenerationUsageTransaction,
|
|
12
12
|
TransferCreditTransaction
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-THQIBKD4.js";
|
|
14
14
|
|
|
15
15
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
16
16
|
import { z } from "zod";
|
|
@@ -5052,6 +5052,74 @@ function formatUserList(users) {
|
|
|
5052
5052
|
}
|
|
5053
5053
|
|
|
5054
5054
|
// ../../b4m-core/packages/common/dist/src/jira/api.js
|
|
5055
|
+
function wikiMarkupToAdf(text) {
|
|
5056
|
+
const lines = text.split("\n");
|
|
5057
|
+
const content = [];
|
|
5058
|
+
let currentTableRows = [];
|
|
5059
|
+
let inTable = false;
|
|
5060
|
+
for (const line of lines) {
|
|
5061
|
+
const trimmedLine = line.trim();
|
|
5062
|
+
if (trimmedLine.startsWith("||") && trimmedLine.endsWith("||")) {
|
|
5063
|
+
inTable = true;
|
|
5064
|
+
const cells = trimmedLine.slice(2, -2).split("||").map((cell) => cell.trim());
|
|
5065
|
+
const headerRow = {
|
|
5066
|
+
type: "tableRow",
|
|
5067
|
+
content: cells.map((cell) => ({
|
|
5068
|
+
type: "tableHeader",
|
|
5069
|
+
attrs: {},
|
|
5070
|
+
content: [{ type: "paragraph", content: [{ type: "text", text: cell || " " }] }]
|
|
5071
|
+
}))
|
|
5072
|
+
};
|
|
5073
|
+
currentTableRows.push(headerRow);
|
|
5074
|
+
continue;
|
|
5075
|
+
}
|
|
5076
|
+
if (trimmedLine.startsWith("|") && trimmedLine.endsWith("|") && !trimmedLine.startsWith("||")) {
|
|
5077
|
+
inTable = true;
|
|
5078
|
+
const cells = trimmedLine.slice(1, -1).split("|").map((cell) => cell.trim());
|
|
5079
|
+
const dataRow = {
|
|
5080
|
+
type: "tableRow",
|
|
5081
|
+
content: cells.map((cell) => ({
|
|
5082
|
+
type: "tableCell",
|
|
5083
|
+
attrs: {},
|
|
5084
|
+
content: [{ type: "paragraph", content: [{ type: "text", text: cell || " " }] }]
|
|
5085
|
+
}))
|
|
5086
|
+
};
|
|
5087
|
+
currentTableRows.push(dataRow);
|
|
5088
|
+
continue;
|
|
5089
|
+
}
|
|
5090
|
+
if (inTable && currentTableRows.length > 0) {
|
|
5091
|
+
const table = {
|
|
5092
|
+
type: "table",
|
|
5093
|
+
attrs: { isNumberColumnEnabled: false, layout: "default" },
|
|
5094
|
+
content: currentTableRows
|
|
5095
|
+
};
|
|
5096
|
+
content.push(table);
|
|
5097
|
+
currentTableRows = [];
|
|
5098
|
+
inTable = false;
|
|
5099
|
+
}
|
|
5100
|
+
if (trimmedLine) {
|
|
5101
|
+
content.push({
|
|
5102
|
+
type: "paragraph",
|
|
5103
|
+
content: [{ type: "text", text: trimmedLine }]
|
|
5104
|
+
});
|
|
5105
|
+
}
|
|
5106
|
+
}
|
|
5107
|
+
if (currentTableRows.length > 0) {
|
|
5108
|
+
const table = {
|
|
5109
|
+
type: "table",
|
|
5110
|
+
attrs: { isNumberColumnEnabled: false, layout: "default" },
|
|
5111
|
+
content: currentTableRows
|
|
5112
|
+
};
|
|
5113
|
+
content.push(table);
|
|
5114
|
+
}
|
|
5115
|
+
if (content.length === 0) {
|
|
5116
|
+
content.push({ type: "paragraph", content: [{ type: "text", text: " " }] });
|
|
5117
|
+
}
|
|
5118
|
+
return { type: "doc", version: 1, content };
|
|
5119
|
+
}
|
|
5120
|
+
function containsWikiTable(text) {
|
|
5121
|
+
return /^\|\|.+\|\|$/m.test(text) || /^\|(?!\|).+\|$/m.test(text);
|
|
5122
|
+
}
|
|
5055
5123
|
var JiraApi = class {
|
|
5056
5124
|
config;
|
|
5057
5125
|
constructor(config) {
|
|
@@ -5131,16 +5199,21 @@ var JiraApi = class {
|
|
|
5131
5199
|
...customFields
|
|
5132
5200
|
};
|
|
5133
5201
|
if (description) {
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5202
|
+
if (containsWikiTable(description)) {
|
|
5203
|
+
console.log("[JIRA-ADF] Converting wiki table to ADF", { length: description.length });
|
|
5204
|
+
fields.description = wikiMarkupToAdf(description);
|
|
5205
|
+
} else {
|
|
5206
|
+
fields.description = {
|
|
5207
|
+
type: "doc",
|
|
5208
|
+
version: 1,
|
|
5209
|
+
content: [
|
|
5210
|
+
{
|
|
5211
|
+
type: "paragraph",
|
|
5212
|
+
content: [{ type: "text", text: description }]
|
|
5213
|
+
}
|
|
5214
|
+
]
|
|
5215
|
+
};
|
|
5216
|
+
}
|
|
5144
5217
|
}
|
|
5145
5218
|
if (assignee) {
|
|
5146
5219
|
fields.assignee = { id: assignee };
|
|
@@ -5166,16 +5239,21 @@ var JiraApi = class {
|
|
|
5166
5239
|
fields.summary = summary;
|
|
5167
5240
|
}
|
|
5168
5241
|
if (description) {
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5242
|
+
if (containsWikiTable(description)) {
|
|
5243
|
+
console.log("[JIRA-ADF] Converting wiki table to ADF (update)", { length: description.length });
|
|
5244
|
+
fields.description = wikiMarkupToAdf(description);
|
|
5245
|
+
} else {
|
|
5246
|
+
fields.description = {
|
|
5247
|
+
type: "doc",
|
|
5248
|
+
version: 1,
|
|
5249
|
+
content: [
|
|
5250
|
+
{
|
|
5251
|
+
type: "paragraph",
|
|
5252
|
+
content: [{ type: "text", text: description }]
|
|
5253
|
+
}
|
|
5254
|
+
]
|
|
5255
|
+
};
|
|
5256
|
+
}
|
|
5179
5257
|
}
|
|
5180
5258
|
if (labels) {
|
|
5181
5259
|
fields.labels = labels;
|
|
@@ -5335,16 +5413,21 @@ var JiraApi = class {
|
|
|
5335
5413
|
issuetype: { name: issueTypeName }
|
|
5336
5414
|
};
|
|
5337
5415
|
if (description) {
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5416
|
+
if (containsWikiTable(description)) {
|
|
5417
|
+
console.log("[JIRA-ADF] Converting wiki table to ADF (bulk)", { length: description.length });
|
|
5418
|
+
fields.description = wikiMarkupToAdf(description);
|
|
5419
|
+
} else {
|
|
5420
|
+
fields.description = {
|
|
5421
|
+
type: "doc",
|
|
5422
|
+
version: 1,
|
|
5423
|
+
content: [
|
|
5424
|
+
{
|
|
5425
|
+
type: "paragraph",
|
|
5426
|
+
content: [{ type: "text", text: description }]
|
|
5427
|
+
}
|
|
5428
|
+
]
|
|
5429
|
+
};
|
|
5430
|
+
}
|
|
5348
5431
|
}
|
|
5349
5432
|
if (assignee) {
|
|
5350
5433
|
fields.assignee = { id: assignee };
|
|
@@ -6161,6 +6244,8 @@ export {
|
|
|
6161
6244
|
formatUser,
|
|
6162
6245
|
formatTransitionResult,
|
|
6163
6246
|
formatUserList,
|
|
6247
|
+
wikiMarkupToAdf,
|
|
6248
|
+
containsWikiTable,
|
|
6164
6249
|
JiraApi,
|
|
6165
6250
|
getErrorMessage,
|
|
6166
6251
|
getAtlassianConfig,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3I4UTS5N.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-THQIBKD4.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-Y7TWJGN7.js";
|
|
6
|
+
import "./chunk-3I4UTS5N.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-THQIBKD4.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
|
10
10
|
export {
|
|
11
11
|
createFabFile,
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-BFYTGKUM.js";
|
|
8
|
+
import "./chunk-KPZSR7LA.js";
|
|
9
|
+
import "./chunk-Y7TWJGN7.js";
|
|
10
10
|
import {
|
|
11
11
|
BFLImageService,
|
|
12
12
|
BaseStorage,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
OpenAIBackend,
|
|
16
16
|
OpenAIImageService,
|
|
17
17
|
XAIImageService
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3I4UTS5N.js";
|
|
19
19
|
import {
|
|
20
20
|
Logger
|
|
21
21
|
} from "./chunk-AMDXHL6S.js";
|
|
@@ -73,19 +73,19 @@ import {
|
|
|
73
73
|
XAI_IMAGE_MODELS,
|
|
74
74
|
b4mLLMTools,
|
|
75
75
|
getMcpProviderMetadata
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-THQIBKD4.js";
|
|
77
77
|
import {
|
|
78
78
|
__require
|
|
79
79
|
} from "./chunk-PDX44BCA.js";
|
|
80
80
|
|
|
81
81
|
// src/index.tsx
|
|
82
|
-
import
|
|
83
|
-
import { render, Box as
|
|
82
|
+
import React16, { useState as useState7, useEffect as useEffect3, useCallback, useRef } from "react";
|
|
83
|
+
import { render, Box as Box15, Text as Text15, useApp, useInput as useInput6 } from "ink";
|
|
84
84
|
import { v4 as uuidv49 } from "uuid";
|
|
85
85
|
|
|
86
86
|
// src/components/App.tsx
|
|
87
|
-
import
|
|
88
|
-
import { Box as
|
|
87
|
+
import React10 from "react";
|
|
88
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
89
89
|
|
|
90
90
|
// src/components/StatusBar.tsx
|
|
91
91
|
import React from "react";
|
|
@@ -918,29 +918,6 @@ var useCliStore = create((set) => ({
|
|
|
918
918
|
// Session state
|
|
919
919
|
session: null,
|
|
920
920
|
setSession: (session) => set({ session }),
|
|
921
|
-
// Pending messages
|
|
922
|
-
pendingMessages: [],
|
|
923
|
-
addPendingMessage: (message) => set((state) => ({ pendingMessages: [...state.pendingMessages, message] })),
|
|
924
|
-
updatePendingMessage: (index, message) => set((state) => {
|
|
925
|
-
const updated = [...state.pendingMessages];
|
|
926
|
-
updated[index] = message;
|
|
927
|
-
return { pendingMessages: updated };
|
|
928
|
-
}),
|
|
929
|
-
clearPendingMessages: () => set({ pendingMessages: [] }),
|
|
930
|
-
completePendingMessage: (index, finalMessage) => set((state) => {
|
|
931
|
-
const pending = [...state.pendingMessages];
|
|
932
|
-
pending.splice(index, 1);
|
|
933
|
-
const session = state.session;
|
|
934
|
-
if (!session) return { pendingMessages: pending };
|
|
935
|
-
return {
|
|
936
|
-
pendingMessages: pending,
|
|
937
|
-
session: {
|
|
938
|
-
...session,
|
|
939
|
-
messages: [...session.messages, finalMessage],
|
|
940
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
941
|
-
}
|
|
942
|
-
};
|
|
943
|
-
}),
|
|
944
921
|
// UI state
|
|
945
922
|
isThinking: false,
|
|
946
923
|
setIsThinking: (thinking) => set({ isThinking: thinking }),
|
|
@@ -1240,26 +1217,6 @@ function ConfigEditor({ config, availableModels, onSave, onClose }) {
|
|
|
1240
1217
|
})), /* @__PURE__ */ React9.createElement(Box8, { borderStyle: "single", borderColor: "gray", paddingX: 1 }, /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, "\u2191/\u2193: Navigate | Space/\u2190/\u2192: Change | q/Esc: Save & Exit")));
|
|
1241
1218
|
}
|
|
1242
1219
|
|
|
1243
|
-
// src/components/MessageItem.tsx
|
|
1244
|
-
import React10 from "react";
|
|
1245
|
-
import { Box as Box9, Text as Text9 } from "ink";
|
|
1246
|
-
function MessageItem({ message }) {
|
|
1247
|
-
const isUser = message.role === "user";
|
|
1248
|
-
return /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Box9, null, /* @__PURE__ */ React10.createElement(Text9, { bold: true, color: isUser ? "cyan" : "green" }, isUser ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), isUser && message.content && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { backgroundColor: "whiteBright", color: "black" }, " ", message.content, " ")), !isUser && message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1249
|
-
if (step.type === "thought") {
|
|
1250
|
-
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` ${step.content.slice(0, 200)}${step.content.length > 200 ? "..." : ""}`));
|
|
1251
|
-
}
|
|
1252
|
-
if (step.type === "action") {
|
|
1253
|
-
const toolName = step.metadata?.toolName || "unknown";
|
|
1254
|
-
const toolInput = step.metadata?.toolInput;
|
|
1255
|
-
const observationStep = message.metadata.steps[idx + 1];
|
|
1256
|
-
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1257
|
-
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1258
|
-
}
|
|
1259
|
-
return null;
|
|
1260
|
-
}).filter(Boolean)), !isUser && message.content !== "..." && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: message.metadata?.steps?.length ? 1 : 0 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u26A0\uFE0F ", message.content) : /* @__PURE__ */ React10.createElement(Text9, null, message.content)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)));
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
1220
|
// src/utils/processFileReferences.ts
|
|
1264
1221
|
import * as fs2 from "fs";
|
|
1265
1222
|
import * as path2 from "path";
|
|
@@ -1388,7 +1345,6 @@ function App({
|
|
|
1388
1345
|
onPrefillConsumed
|
|
1389
1346
|
}) {
|
|
1390
1347
|
const messages = useCliStore((state) => state.session?.messages || []);
|
|
1391
|
-
const pendingMessages = useCliStore((state) => state.pendingMessages);
|
|
1392
1348
|
const sessionName = useCliStore((state) => state.session?.name || "New Session");
|
|
1393
1349
|
const currentModel = useCliStore((state) => state.session?.model || "claude-sonnet-4-5-20250929");
|
|
1394
1350
|
const totalTokens = useCliStore((state) => state.session?.metadata.totalTokens || 0);
|
|
@@ -1398,7 +1354,7 @@ function App({
|
|
|
1398
1354
|
const setShowConfigEditor = useCliStore((state) => state.setShowConfigEditor);
|
|
1399
1355
|
const exitRequested = useCliStore((state) => state.exitRequested);
|
|
1400
1356
|
const setIsThinking = useCliStore((state) => state.setIsThinking);
|
|
1401
|
-
const handleSubmit =
|
|
1357
|
+
const handleSubmit = React10.useCallback(
|
|
1402
1358
|
async (input) => {
|
|
1403
1359
|
const trimmed = input.trim();
|
|
1404
1360
|
if (!trimmed) return;
|
|
@@ -1427,7 +1383,7 @@ ${errorBlock}`;
|
|
|
1427
1383
|
},
|
|
1428
1384
|
[onMessage, onCommand, setIsThinking]
|
|
1429
1385
|
);
|
|
1430
|
-
return /* @__PURE__ */
|
|
1386
|
+
return /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column" }, /* @__PURE__ */ React10.createElement(StatusBar, { sessionName, model: currentModel, tokenUsage: totalTokens }), showConfigEditor && config && onSaveConfig ? /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React10.createElement(
|
|
1431
1387
|
ConfigEditor,
|
|
1432
1388
|
{
|
|
1433
1389
|
config,
|
|
@@ -1435,7 +1391,7 @@ ${errorBlock}`;
|
|
|
1435
1391
|
onSave: onSaveConfig,
|
|
1436
1392
|
onClose: () => setShowConfigEditor(false)
|
|
1437
1393
|
}
|
|
1438
|
-
)) : permissionPrompt ? /* @__PURE__ */
|
|
1394
|
+
)) : permissionPrompt ? /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React10.createElement(
|
|
1439
1395
|
PermissionPrompt,
|
|
1440
1396
|
{
|
|
1441
1397
|
toolName: permissionPrompt.toolName,
|
|
@@ -1444,7 +1400,7 @@ ${errorBlock}`;
|
|
|
1444
1400
|
canBeTrusted: permissionPrompt.canBeTrusted,
|
|
1445
1401
|
onResponse: onPermissionResponse
|
|
1446
1402
|
}
|
|
1447
|
-
)) : /* @__PURE__ */
|
|
1403
|
+
)) : /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column" }, messages.map((message, index) => /* @__PURE__ */ React10.createElement(Box9, { key: `${message.timestamp}-${message.role}-${index}`, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React10.createElement(MessageItem, { message })))), /* @__PURE__ */ React10.createElement(AgentThinking, null), exitRequested && /* @__PURE__ */ React10.createElement(Box9, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Text9, { color: "yellow", bold: true }, "Press Ctrl+C again to exit")), /* @__PURE__ */ React10.createElement(Box9, { borderStyle: "single", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React10.createElement(
|
|
1448
1404
|
InputPrompt,
|
|
1449
1405
|
{
|
|
1450
1406
|
onSubmit: handleSubmit,
|
|
@@ -1456,22 +1412,38 @@ ${errorBlock}`;
|
|
|
1456
1412
|
}
|
|
1457
1413
|
))));
|
|
1458
1414
|
}
|
|
1415
|
+
function MessageItem({ message }) {
|
|
1416
|
+
const isUser = message.role === "user";
|
|
1417
|
+
return /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Box9, null, /* @__PURE__ */ React10.createElement(Text9, { bold: true, color: isUser ? "cyan" : "green" }, isUser ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), isUser && message.content && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { backgroundColor: "whiteBright", color: "black" }, " ", message.content, " ")), !isUser && message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1418
|
+
if (step.type === "thought") {
|
|
1419
|
+
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` ${step.content.slice(0, 200)}${step.content.length > 200 ? "..." : ""}`));
|
|
1420
|
+
}
|
|
1421
|
+
if (step.type === "action") {
|
|
1422
|
+
const toolName = step.metadata?.toolName || "unknown";
|
|
1423
|
+
const toolInput = step.metadata?.toolInput;
|
|
1424
|
+
const observationStep = message.metadata.steps[idx + 1];
|
|
1425
|
+
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1426
|
+
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1427
|
+
}
|
|
1428
|
+
return null;
|
|
1429
|
+
}).filter(Boolean)), !isUser && message.content !== "..." && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: message.metadata?.steps?.length ? 1 : 0 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u26A0\uFE0F ", message.content) : /* @__PURE__ */ React10.createElement(Text9, null, message.content)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)));
|
|
1430
|
+
}
|
|
1459
1431
|
|
|
1460
1432
|
// src/components/MessageList.tsx
|
|
1461
|
-
import
|
|
1462
|
-
import { Box as
|
|
1433
|
+
import React11 from "react";
|
|
1434
|
+
import { Box as Box10, Text as Text10 } from "ink";
|
|
1463
1435
|
function stripThinkingTags(content) {
|
|
1464
1436
|
return content.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
|
|
1465
1437
|
}
|
|
1466
|
-
var MessageList =
|
|
1438
|
+
var MessageList = React11.memo(
|
|
1467
1439
|
function MessageList2({ messages }) {
|
|
1468
1440
|
if (messages.length === 0) {
|
|
1469
|
-
return /* @__PURE__ */
|
|
1441
|
+
return /* @__PURE__ */ React11.createElement(Box10, { paddingY: 1 }, /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, "No messages yet. Type a message to start!"));
|
|
1470
1442
|
}
|
|
1471
|
-
return /* @__PURE__ */
|
|
1443
|
+
return /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", gap: 1, paddingY: 1 }, messages.map((message, index) => /* @__PURE__ */ React11.createElement(Box10, { key: index, flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Box10, null, /* @__PURE__ */ React11.createElement(Text10, { bold: true, color: message.role === "user" ? "cyan" : "green" }, message.role === "user" ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), /* @__PURE__ */ React11.createElement(Box10, { paddingLeft: 2 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React11.createElement(Text10, { color: "yellow" }, "\u26A0\uFE0F ", stripThinkingTags(message.content)) : /* @__PURE__ */ React11.createElement(Text10, null, stripThinkingTags(message.content))), message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React11.createElement(Box10, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React11.createElement(Text10, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " tools used,", " ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1472
1444
|
if (step.type === "thought") {
|
|
1473
|
-
return /* @__PURE__ */
|
|
1474
|
-
|
|
1445
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React11.createElement(Text10, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React11.createElement(
|
|
1446
|
+
Text10,
|
|
1475
1447
|
{
|
|
1476
1448
|
dimColor: true
|
|
1477
1449
|
},
|
|
@@ -1483,10 +1455,10 @@ var MessageList = React12.memo(
|
|
|
1483
1455
|
const toolInput = step.metadata?.toolInput;
|
|
1484
1456
|
const observationStep = message.metadata.steps[idx + 1];
|
|
1485
1457
|
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1486
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ React11.createElement(Box10, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React11.createElement(Text10, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1487
1459
|
}
|
|
1488
1460
|
return null;
|
|
1489
|
-
}).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */
|
|
1461
|
+
}).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React11.createElement(Box10, { paddingLeft: 2 }, /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)))));
|
|
1490
1462
|
},
|
|
1491
1463
|
(prevProps, nextProps) => {
|
|
1492
1464
|
if (prevProps.messages.length !== nextProps.messages.length) {
|
|
@@ -1497,8 +1469,8 @@ var MessageList = React12.memo(
|
|
|
1497
1469
|
);
|
|
1498
1470
|
|
|
1499
1471
|
// src/components/TrustLocationSelector.tsx
|
|
1500
|
-
import
|
|
1501
|
-
import { Box as
|
|
1472
|
+
import React12 from "react";
|
|
1473
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
1502
1474
|
import SelectInput2 from "ink-select-input";
|
|
1503
1475
|
function TrustLocationSelector({ inProject, onSelect, onCancel }) {
|
|
1504
1476
|
const items = [];
|
|
@@ -1519,19 +1491,19 @@ function TrustLocationSelector({ inProject, onSelect, onCancel }) {
|
|
|
1519
1491
|
const handleSelect = (item) => {
|
|
1520
1492
|
onSelect(item.value);
|
|
1521
1493
|
};
|
|
1522
|
-
return /* @__PURE__ */
|
|
1494
|
+
return /* @__PURE__ */ React12.createElement(Box11, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React12.createElement(Box11, { marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Text11, { bold: true }, "Where should this rule be saved?")), /* @__PURE__ */ React12.createElement(
|
|
1523
1495
|
SelectInput2,
|
|
1524
1496
|
{
|
|
1525
1497
|
items,
|
|
1526
1498
|
onSelect: handleSelect,
|
|
1527
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1499
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React12.createElement(Box11, null, /* @__PURE__ */ React12.createElement(Text11, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1528
1500
|
}
|
|
1529
|
-
), /* @__PURE__ */
|
|
1501
|
+
), /* @__PURE__ */ React12.createElement(Box11, { marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Ctrl+C to cancel")));
|
|
1530
1502
|
}
|
|
1531
1503
|
|
|
1532
1504
|
// src/components/RewindSelector.tsx
|
|
1533
|
-
import
|
|
1534
|
-
import { Box as
|
|
1505
|
+
import React13, { useState as useState4 } from "react";
|
|
1506
|
+
import { Box as Box12, Text as Text12, useInput as useInput4 } from "ink";
|
|
1535
1507
|
import SelectInput3 from "ink-select-input";
|
|
1536
1508
|
function RewindSelector({ messages, onSelect, onCancel }) {
|
|
1537
1509
|
const [step, setStep] = useState4("selection");
|
|
@@ -1573,14 +1545,14 @@ function RewindSelector({ messages, onSelect, onCancel }) {
|
|
|
1573
1545
|
return sum2 + (msg.metadata?.tokenUsage?.total || 0);
|
|
1574
1546
|
}, 0);
|
|
1575
1547
|
if (step === "selection") {
|
|
1576
|
-
return /* @__PURE__ */
|
|
1548
|
+
return /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React13.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Text12, { bold: true }, "Select a point to rewind to:")), /* @__PURE__ */ React13.createElement(
|
|
1577
1549
|
SelectInput3,
|
|
1578
1550
|
{
|
|
1579
1551
|
items,
|
|
1580
1552
|
onSelect: handleSelectionSelect,
|
|
1581
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1553
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React13.createElement(Box12, null, /* @__PURE__ */ React13.createElement(Text12, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1582
1554
|
}
|
|
1583
|
-
), /* @__PURE__ */
|
|
1555
|
+
), /* @__PURE__ */ React13.createElement(Box12, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text12, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to cancel")));
|
|
1584
1556
|
}
|
|
1585
1557
|
const confirmationItems = [
|
|
1586
1558
|
{ label: "Yes, rewind to this point", value: "confirm" },
|
|
@@ -1588,19 +1560,19 @@ function RewindSelector({ messages, onSelect, onCancel }) {
|
|
|
1588
1560
|
];
|
|
1589
1561
|
const selectedMessage = selectedMessageIndex !== null && selectedMessageIndex >= 0 && selectedMessageIndex < messages.length ? messages[selectedMessageIndex] : null;
|
|
1590
1562
|
const selectedPreview = selectedMessage ? selectedMessage.content.length > 50 ? selectedMessage.content.substring(0, 50) + "..." : selectedMessage.content : "";
|
|
1591
|
-
return /* @__PURE__ */
|
|
1563
|
+
return /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React13.createElement(Box12, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React13.createElement(Text12, { bold: true }, "Confirm rewind operation:"), /* @__PURE__ */ React13.createElement(Text12, { dimColor: true }, "Message: ", selectedPreview), /* @__PURE__ */ React13.createElement(Text12, { color: "yellow" }, "This will remove ", messagesToRemove.length, " message(s) (", tokensToRemove.toLocaleString(), " tokens)"), /* @__PURE__ */ React13.createElement(Text12, { color: "cyan" }, "The selected message will be placed in your input for editing.")), /* @__PURE__ */ React13.createElement(
|
|
1592
1564
|
SelectInput3,
|
|
1593
1565
|
{
|
|
1594
1566
|
items: confirmationItems,
|
|
1595
1567
|
onSelect: handleConfirmationSelect,
|
|
1596
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1568
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React13.createElement(Box12, null, /* @__PURE__ */ React13.createElement(Text12, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1597
1569
|
}
|
|
1598
|
-
), /* @__PURE__ */
|
|
1570
|
+
), /* @__PURE__ */ React13.createElement(Box12, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text12, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to go back")));
|
|
1599
1571
|
}
|
|
1600
1572
|
|
|
1601
1573
|
// src/components/SessionSelector.tsx
|
|
1602
|
-
import
|
|
1603
|
-
import { Box as
|
|
1574
|
+
import React14, { useState as useState5 } from "react";
|
|
1575
|
+
import { Box as Box13, Text as Text13, useInput as useInput5 } from "ink";
|
|
1604
1576
|
import SelectInput4 from "ink-select-input";
|
|
1605
1577
|
function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
|
|
1606
1578
|
const [step, setStep] = useState5("selection");
|
|
@@ -1638,32 +1610,32 @@ function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
|
|
|
1638
1610
|
}
|
|
1639
1611
|
};
|
|
1640
1612
|
if (step === "selection") {
|
|
1641
|
-
return /* @__PURE__ */
|
|
1613
|
+
return /* @__PURE__ */ React14.createElement(Box13, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React14.createElement(Box13, { marginBottom: 1 }, /* @__PURE__ */ React14.createElement(Text13, { bold: true }, "Select a session to resume:")), /* @__PURE__ */ React14.createElement(
|
|
1642
1614
|
SelectInput4,
|
|
1643
1615
|
{
|
|
1644
1616
|
items,
|
|
1645
1617
|
onSelect: handleSelectionSelect,
|
|
1646
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1618
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React14.createElement(Box13, null, /* @__PURE__ */ React14.createElement(Text13, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1647
1619
|
}
|
|
1648
|
-
), /* @__PURE__ */
|
|
1620
|
+
), /* @__PURE__ */ React14.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to cancel")));
|
|
1649
1621
|
}
|
|
1650
1622
|
const confirmationItems = [
|
|
1651
1623
|
{ label: "Yes, resume this session", value: "confirm" },
|
|
1652
1624
|
{ label: "No, go back to selection", value: "cancel" }
|
|
1653
1625
|
];
|
|
1654
|
-
return /* @__PURE__ */
|
|
1626
|
+
return /* @__PURE__ */ React14.createElement(Box13, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React14.createElement(Box13, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React14.createElement(Text13, { bold: true }, 'Resume session: "', selectedSession?.name, '"'), /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, selectedSession?.messages.length, " messages | ", selectedSession?.model, " |", " ", selectedSession?.metadata?.totalTokens?.toLocaleString() ?? 0, " tokens"), hasUnsavedWork && /* @__PURE__ */ React14.createElement(Text13, { color: "yellow" }, "Warning: Your current session has unsaved messages. Use /save first if needed.")), /* @__PURE__ */ React14.createElement(
|
|
1655
1627
|
SelectInput4,
|
|
1656
1628
|
{
|
|
1657
1629
|
items: confirmationItems,
|
|
1658
1630
|
onSelect: handleConfirmationSelect,
|
|
1659
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1631
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React14.createElement(Box13, null, /* @__PURE__ */ React14.createElement(Text13, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1660
1632
|
}
|
|
1661
|
-
), /* @__PURE__ */
|
|
1633
|
+
), /* @__PURE__ */ React14.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to go back")));
|
|
1662
1634
|
}
|
|
1663
1635
|
|
|
1664
1636
|
// src/components/LoginFlow.tsx
|
|
1665
|
-
import
|
|
1666
|
-
import { Box as
|
|
1637
|
+
import React15, { useState as useState6, useEffect as useEffect2 } from "react";
|
|
1638
|
+
import { Box as Box14, Text as Text14 } from "ink";
|
|
1667
1639
|
import Spinner2 from "ink-spinner";
|
|
1668
1640
|
import jwt from "jsonwebtoken";
|
|
1669
1641
|
import open from "open";
|
|
@@ -1826,15 +1798,15 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
|
|
|
1826
1798
|
}
|
|
1827
1799
|
}, [deviceFlow, status]);
|
|
1828
1800
|
if (status === "initiating") {
|
|
1829
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React15.createElement(Box14, null, /* @__PURE__ */ React15.createElement(Text14, { color: "cyan" }, /* @__PURE__ */ React15.createElement(Spinner2, { type: "dots" }), " Initiating device authorization...")));
|
|
1830
1802
|
}
|
|
1831
1803
|
if (status === "error") {
|
|
1832
|
-
return /* @__PURE__ */
|
|
1804
|
+
return /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text14, { color: "red", bold: true }, "\u2716 Authentication Failed")), /* @__PURE__ */ React15.createElement(Box14, null, /* @__PURE__ */ React15.createElement(Text14, { color: "red" }, error)));
|
|
1833
1805
|
}
|
|
1834
1806
|
if (status === "success") {
|
|
1835
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text14, { color: "green", bold: true }, "\u2714 Successfully authenticated!")), /* @__PURE__ */ React15.createElement(Box14, null, /* @__PURE__ */ React15.createElement(Text14, { dimColor: true }, "You can now use B4M CLI with your account.")));
|
|
1836
1808
|
}
|
|
1837
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "cyan" }, /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text14, { color: "cyan", bold: true }, "\u{1F510} Device Authorization")), /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text14, null, "Opening browser automatically... If it doesn't open, please visit:")), /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React15.createElement(Text14, { color: "blue", bold: true }, deviceFlow?.verification_uri)), /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text14, null, "And enter this code when prompted:")), /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React15.createElement(Text14, { color: "yellow", bold: true }, deviceFlow?.user_code)), /* @__PURE__ */ React15.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React15.createElement(Text14, { color: "cyan" }, /* @__PURE__ */ React15.createElement(Spinner2, { type: "dots" }), " ", statusMessage)), /* @__PURE__ */ React15.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React15.createElement(Text14, { dimColor: true }, "Expires in ", deviceFlow ? Math.floor(deviceFlow.expires_in / 60) : 0, " minutes")));
|
|
1838
1810
|
}
|
|
1839
1811
|
|
|
1840
1812
|
// src/storage/SessionStore.ts
|
|
@@ -11113,7 +11085,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11113
11085
|
// package.json
|
|
11114
11086
|
var package_default = {
|
|
11115
11087
|
name: "@bike4mind/cli",
|
|
11116
|
-
version: "0.2.10-fix-
|
|
11088
|
+
version: "0.2.10-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
11117
11089
|
type: "module",
|
|
11118
11090
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11119
11091
|
license: "UNLICENSED",
|
|
@@ -11216,10 +11188,10 @@ var package_default = {
|
|
|
11216
11188
|
},
|
|
11217
11189
|
devDependencies: {
|
|
11218
11190
|
"@bike4mind/agents": "0.1.0",
|
|
11219
|
-
"@bike4mind/common": "2.39.1-fix-
|
|
11220
|
-
"@bike4mind/mcp": "1.20.4-fix-
|
|
11221
|
-
"@bike4mind/services": "2.34.2-fix-
|
|
11222
|
-
"@bike4mind/utils": "2.1.4-fix-
|
|
11191
|
+
"@bike4mind/common": "2.39.1-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
11192
|
+
"@bike4mind/mcp": "1.20.4-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
11193
|
+
"@bike4mind/services": "2.34.2-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
11194
|
+
"@bike4mind/utils": "2.1.4-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
11223
11195
|
"@types/better-sqlite3": "^7.6.13",
|
|
11224
11196
|
"@types/diff": "^5.0.9",
|
|
11225
11197
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11232,7 +11204,7 @@ var package_default = {
|
|
|
11232
11204
|
typescript: "^5.9.3",
|
|
11233
11205
|
vitest: "^3.2.4"
|
|
11234
11206
|
},
|
|
11235
|
-
gitHead: "
|
|
11207
|
+
gitHead: "81d5adcec14d4130cc4f0851dbdb8cd2393d6115"
|
|
11236
11208
|
};
|
|
11237
11209
|
|
|
11238
11210
|
// src/config/constants.ts
|
|
@@ -11589,16 +11561,23 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11589
11561
|
const currentSteps = [];
|
|
11590
11562
|
const stepHandler = (step) => {
|
|
11591
11563
|
currentSteps.push(step);
|
|
11592
|
-
const
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
...
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11564
|
+
const currentSession = useCliStore.getState().session;
|
|
11565
|
+
if (currentSession) {
|
|
11566
|
+
const messages = [...currentSession.messages];
|
|
11567
|
+
const lastMessage = messages[messages.length - 1];
|
|
11568
|
+
if (lastMessage && lastMessage.role === "assistant") {
|
|
11569
|
+
messages[messages.length - 1] = {
|
|
11570
|
+
...lastMessage,
|
|
11571
|
+
metadata: {
|
|
11572
|
+
...lastMessage.metadata,
|
|
11573
|
+
steps: [...currentSteps]
|
|
11574
|
+
}
|
|
11575
|
+
};
|
|
11576
|
+
setStoreSession({
|
|
11577
|
+
...currentSession,
|
|
11578
|
+
messages
|
|
11579
|
+
});
|
|
11580
|
+
}
|
|
11602
11581
|
}
|
|
11603
11582
|
};
|
|
11604
11583
|
state.agent.on("action", stepHandler);
|
|
@@ -11623,14 +11602,13 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11623
11602
|
steps: []
|
|
11624
11603
|
}
|
|
11625
11604
|
};
|
|
11626
|
-
const
|
|
11605
|
+
const sessionWithMessages = {
|
|
11627
11606
|
...state.session,
|
|
11628
|
-
messages: [...state.session.messages, userMessage],
|
|
11607
|
+
messages: [...state.session.messages, userMessage, pendingAssistantMessage],
|
|
11629
11608
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11630
11609
|
};
|
|
11631
|
-
setState((prev) => ({ ...prev, session:
|
|
11632
|
-
setStoreSession(
|
|
11633
|
-
useCliStore.getState().addPendingMessage(pendingAssistantMessage);
|
|
11610
|
+
setState((prev) => ({ ...prev, session: sessionWithMessages }));
|
|
11611
|
+
setStoreSession(sessionWithMessages);
|
|
11634
11612
|
const recentMessages = state.session.messages.slice(-20);
|
|
11635
11613
|
const previousMessages = recentMessages.filter((msg) => msg.role === "user" || msg.role === "assistant").map((msg) => ({
|
|
11636
11614
|
role: msg.role,
|
|
@@ -11644,6 +11622,9 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11644
11622
|
console.log("\n\u26A0\uFE0F Action denied by user\n");
|
|
11645
11623
|
}
|
|
11646
11624
|
const successfulToolCalls = result.steps.filter((s) => s.type === "observation").length;
|
|
11625
|
+
const currentSession = useCliStore.getState().session;
|
|
11626
|
+
if (!currentSession) return;
|
|
11627
|
+
const finalMessages = [...currentSession.messages];
|
|
11647
11628
|
const finalAssistantMessage = {
|
|
11648
11629
|
role: "assistant",
|
|
11649
11630
|
content: result.finalAnswer,
|
|
@@ -11659,22 +11640,21 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11659
11640
|
permissionDenied
|
|
11660
11641
|
}
|
|
11661
11642
|
};
|
|
11662
|
-
|
|
11663
|
-
const currentSession = useCliStore.getState().session;
|
|
11664
|
-
if (!currentSession) return;
|
|
11643
|
+
finalMessages[finalMessages.length - 1] = finalAssistantMessage;
|
|
11665
11644
|
const updatedSession = {
|
|
11666
11645
|
...currentSession,
|
|
11646
|
+
messages: finalMessages,
|
|
11647
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11667
11648
|
metadata: {
|
|
11668
|
-
...
|
|
11669
|
-
totalTokens:
|
|
11670
|
-
toolCallCount:
|
|
11649
|
+
...state.session.metadata,
|
|
11650
|
+
totalTokens: state.session.metadata.totalTokens + result.completionInfo.totalTokens,
|
|
11651
|
+
toolCallCount: state.session.metadata.toolCallCount + successfulToolCalls
|
|
11671
11652
|
}
|
|
11672
11653
|
};
|
|
11673
11654
|
setState((prev) => ({ ...prev, session: updatedSession }));
|
|
11674
11655
|
setStoreSession(updatedSession);
|
|
11675
11656
|
await state.sessionStore.save(updatedSession);
|
|
11676
11657
|
} catch (error) {
|
|
11677
|
-
useCliStore.getState().clearPendingMessages();
|
|
11678
11658
|
if (error instanceof Error) {
|
|
11679
11659
|
if (error.message.includes("Authentication failed") || error.message.includes("Authentication expired")) {
|
|
11680
11660
|
console.log("\n\u274C Authentication failed");
|
|
@@ -11811,7 +11791,6 @@ Project Configuration:
|
|
|
11811
11791
|
setState((prev) => ({ ...prev, session: loadedSession }));
|
|
11812
11792
|
setStoreSession(loadedSession);
|
|
11813
11793
|
useCliStore.getState().clearAgentSteps();
|
|
11814
|
-
useCliStore.getState().clearPendingMessages();
|
|
11815
11794
|
usageCache = null;
|
|
11816
11795
|
console.log(`
|
|
11817
11796
|
\u2705 Session resumed: "${loadedSession.name}"`);
|
|
@@ -12047,7 +12026,6 @@ Project Configuration:
|
|
|
12047
12026
|
setState((prev) => ({ ...prev, session: newSession }));
|
|
12048
12027
|
setStoreSession(newSession);
|
|
12049
12028
|
useCliStore.getState().clearAgentSteps();
|
|
12050
|
-
useCliStore.getState().clearPendingMessages();
|
|
12051
12029
|
usageCache = null;
|
|
12052
12030
|
console.log("New session started.");
|
|
12053
12031
|
console.log(`
|
|
@@ -12100,7 +12078,6 @@ Project Configuration:
|
|
|
12100
12078
|
prefillInput: prefillContent
|
|
12101
12079
|
}));
|
|
12102
12080
|
setStoreSession(rewindedSession);
|
|
12103
|
-
useCliStore.getState().clearPendingMessages();
|
|
12104
12081
|
await state.sessionStore.save(rewindedSession);
|
|
12105
12082
|
console.log("\u2705 Conversation rewound successfully");
|
|
12106
12083
|
console.log(`\u{1F4CA} Current state: ${rewindedMessages.length} messages, ${newMetadata.totalTokens} tokens`);
|
|
@@ -12268,12 +12245,12 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12268
12245
|
setState((prev) => ({ ...prev, config: updatedConfig }));
|
|
12269
12246
|
};
|
|
12270
12247
|
if (initError) {
|
|
12271
|
-
return /* @__PURE__ */
|
|
12248
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React16.createElement(Text15, { color: "red", bold: true }, "\u274C Initialization Error"), /* @__PURE__ */ React16.createElement(Text15, null, initError), /* @__PURE__ */ React16.createElement(Text15, { dimColor: true }, "\n", "Tip: Run /config to set up your API keys"));
|
|
12272
12249
|
}
|
|
12273
12250
|
if (state.trustLocationSelector) {
|
|
12274
12251
|
const projectDir = state.configStore.getProjectConfigDir();
|
|
12275
12252
|
const inProject = projectDir !== null;
|
|
12276
|
-
return /* @__PURE__ */
|
|
12253
|
+
return /* @__PURE__ */ React16.createElement(
|
|
12277
12254
|
TrustLocationSelector,
|
|
12278
12255
|
{
|
|
12279
12256
|
inProject,
|
|
@@ -12291,7 +12268,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12291
12268
|
);
|
|
12292
12269
|
}
|
|
12293
12270
|
if (state.rewindSelector && state.session) {
|
|
12294
|
-
return /* @__PURE__ */
|
|
12271
|
+
return /* @__PURE__ */ React16.createElement(
|
|
12295
12272
|
RewindSelector,
|
|
12296
12273
|
{
|
|
12297
12274
|
messages: state.session.messages,
|
|
@@ -12309,7 +12286,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12309
12286
|
);
|
|
12310
12287
|
}
|
|
12311
12288
|
if (state.sessionSelector) {
|
|
12312
|
-
return /* @__PURE__ */
|
|
12289
|
+
return /* @__PURE__ */ React16.createElement(
|
|
12313
12290
|
SessionSelector,
|
|
12314
12291
|
{
|
|
12315
12292
|
sessions: state.sessionSelector.sessions,
|
|
@@ -12329,7 +12306,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12329
12306
|
}
|
|
12330
12307
|
if (state.showLoginFlow) {
|
|
12331
12308
|
const loginApiUrl = getApiUrl(state.config?.apiConfig);
|
|
12332
|
-
return /* @__PURE__ */
|
|
12309
|
+
return /* @__PURE__ */ React16.createElement(
|
|
12333
12310
|
LoginFlow,
|
|
12334
12311
|
{
|
|
12335
12312
|
apiUrl: loginApiUrl,
|
|
@@ -12352,9 +12329,9 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12352
12329
|
);
|
|
12353
12330
|
}
|
|
12354
12331
|
if (!isInitialized) {
|
|
12355
|
-
return /* @__PURE__ */
|
|
12332
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React16.createElement(Text15, null, "\u{1F680} Initializing..."));
|
|
12356
12333
|
}
|
|
12357
|
-
return /* @__PURE__ */
|
|
12334
|
+
return /* @__PURE__ */ React16.createElement(
|
|
12358
12335
|
App,
|
|
12359
12336
|
{
|
|
12360
12337
|
onMessage: handleMessage,
|
|
@@ -12393,6 +12370,6 @@ var isDevMode = import.meta.url.includes("/src/") || process.env.NODE_ENV === "d
|
|
|
12393
12370
|
if (isDevMode) {
|
|
12394
12371
|
console.log("\u{1F527} Running in development mode (using TypeScript source)\n");
|
|
12395
12372
|
}
|
|
12396
|
-
render(/* @__PURE__ */
|
|
12373
|
+
render(/* @__PURE__ */ React16.createElement(CliApp, null), {
|
|
12397
12374
|
exitOnCtrlC: false
|
|
12398
12375
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-BFYTGKUM.js";
|
|
6
|
+
import "./chunk-3I4UTS5N.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-THQIBKD4.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
|
10
10
|
export {
|
|
11
11
|
findMostSimilarMemento,
|
|
@@ -229,6 +229,7 @@ import {
|
|
|
229
229
|
canUserDeleteArtifact,
|
|
230
230
|
canUserReadArtifact,
|
|
231
231
|
canUserWriteArtifact,
|
|
232
|
+
containsWikiTable,
|
|
232
233
|
createArtifactId,
|
|
233
234
|
createDefaultPermissions,
|
|
234
235
|
dayjsConfig_default,
|
|
@@ -292,8 +293,9 @@ import {
|
|
|
292
293
|
validateQuest,
|
|
293
294
|
validateQuestMasterArtifactV2,
|
|
294
295
|
validateReactArtifactV2,
|
|
295
|
-
validateSvgArtifactV2
|
|
296
|
-
|
|
296
|
+
validateSvgArtifactV2,
|
|
297
|
+
wikiMarkupToAdf
|
|
298
|
+
} from "./chunk-THQIBKD4.js";
|
|
297
299
|
import "./chunk-PDX44BCA.js";
|
|
298
300
|
export {
|
|
299
301
|
ALL_IMAGE_MODELS,
|
|
@@ -525,6 +527,7 @@ export {
|
|
|
525
527
|
canUserDeleteArtifact,
|
|
526
528
|
canUserReadArtifact,
|
|
527
529
|
canUserWriteArtifact,
|
|
530
|
+
containsWikiTable,
|
|
528
531
|
createArtifactId,
|
|
529
532
|
createDefaultPermissions,
|
|
530
533
|
dayjsConfig_default as dayjs,
|
|
@@ -588,5 +591,6 @@ export {
|
|
|
588
591
|
validateQuest,
|
|
589
592
|
validateQuestMasterArtifactV2,
|
|
590
593
|
validateReactArtifactV2,
|
|
591
|
-
validateSvgArtifactV2
|
|
594
|
+
validateSvgArtifactV2,
|
|
595
|
+
wikiMarkupToAdf
|
|
592
596
|
};
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
validateMermaidSyntax,
|
|
121
121
|
warmUpSettingsCache,
|
|
122
122
|
withRetry
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-3I4UTS5N.js";
|
|
124
124
|
import {
|
|
125
125
|
Logger,
|
|
126
126
|
NotificationDeduplicator,
|
|
@@ -129,7 +129,7 @@ import {
|
|
|
129
129
|
postLowCreditsNotificationToSlack,
|
|
130
130
|
postMessageToSlack
|
|
131
131
|
} from "./chunk-AMDXHL6S.js";
|
|
132
|
-
import "./chunk-
|
|
132
|
+
import "./chunk-THQIBKD4.js";
|
|
133
133
|
import "./chunk-PDX44BCA.js";
|
|
134
134
|
export {
|
|
135
135
|
AWSBackend,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-KPZSR7LA.js";
|
|
6
|
+
import "./chunk-3I4UTS5N.js";
|
|
7
7
|
import "./chunk-AMDXHL6S.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-THQIBKD4.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
|
10
10
|
export {
|
|
11
11
|
SubtractCreditsSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.10-fix-
|
|
3
|
+
"version": "0.2.10-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -103,10 +103,10 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@bike4mind/agents": "0.1.0",
|
|
106
|
-
"@bike4mind/common": "2.39.1-fix-
|
|
107
|
-
"@bike4mind/mcp": "1.20.4-fix-
|
|
108
|
-
"@bike4mind/services": "2.34.2-fix-
|
|
109
|
-
"@bike4mind/utils": "2.1.4-fix-
|
|
106
|
+
"@bike4mind/common": "2.39.1-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
107
|
+
"@bike4mind/mcp": "1.20.4-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
108
|
+
"@bike4mind/services": "2.34.2-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
109
|
+
"@bike4mind/utils": "2.1.4-ja-fix-confluence-table-data-5752.17252+81d5adcec",
|
|
110
110
|
"@types/better-sqlite3": "^7.6.13",
|
|
111
111
|
"@types/diff": "^5.0.9",
|
|
112
112
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"typescript": "^5.9.3",
|
|
120
120
|
"vitest": "^3.2.4"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "81d5adcec14d4130cc4f0851dbdb8cd2393d6115"
|
|
123
123
|
}
|