@ottocode/web-sdk 0.1.314 → 0.1.315
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/components/common/ProviderLogo.d.ts.map +1 -1
- package/dist/components/index.js +84 -12
- package/dist/components/index.js.map +9 -8
- package/dist/hooks/index.js +82 -9
- package/dist/hooks/index.js.map +7 -6
- package/dist/hooks/tool-preview-helpers.d.ts +6 -0
- package/dist/hooks/tool-preview-helpers.d.ts.map +1 -0
- package/dist/hooks/useAgents.d.ts +1 -0
- package/dist/hooks/useAgents.d.ts.map +1 -1
- package/dist/hooks/useChatComposer.d.ts +1 -0
- package/dist/hooks/useChatComposer.d.ts.map +1 -1
- package/dist/hooks/useConfig.d.ts +4 -0
- package/dist/hooks/useConfig.d.ts.map +1 -1
- package/dist/hooks/useSessionStream.d.ts.map +1 -1
- package/dist/index.js +84 -12
- package/dist/index.js.map +9 -8
- package/dist/lib/api-client/config.d.ts +3 -0
- package/dist/lib/api-client/config.d.ts.map +1 -1
- package/dist/lib/api-client/index.d.ts +3 -0
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/index.js.map +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderLogo.d.ts","sourceRoot":"","sources":["../../../src/components/common/ProviderLogo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProviderLogo.d.ts","sourceRoot":"","sources":["../../../src/components/common/ProviderLogo.tsx"],"names":[],"mappings":"AAsCA,UAAU,iBAAiB;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,YAAY,yDAoCvB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -3970,7 +3970,6 @@ var providerLogos = {
|
|
|
3970
3970
|
"zai-coding": zaiLogo,
|
|
3971
3971
|
ottorouter: ottorouterLogo,
|
|
3972
3972
|
minimax: minimaxLogo,
|
|
3973
|
-
moonshot: kimiLogo,
|
|
3974
3973
|
kimi: kimiLogo,
|
|
3975
3974
|
opencode: opencodeLogo,
|
|
3976
3975
|
copilot: copilotLogo
|
|
@@ -11669,6 +11668,78 @@ class SSEClient {
|
|
|
11669
11668
|
}
|
|
11670
11669
|
}
|
|
11671
11670
|
|
|
11671
|
+
// src/hooks/tool-preview-helpers.ts
|
|
11672
|
+
function bestEffortUnescapeJsonString(value) {
|
|
11673
|
+
try {
|
|
11674
|
+
return JSON.parse(`"${value.replace(/\\$/, "")}"`);
|
|
11675
|
+
} catch {
|
|
11676
|
+
return value.replace(/\\n/g, `
|
|
11677
|
+
`).replace(/\\t/g, "\t").replace(/\\r/g, "\r").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
11678
|
+
}
|
|
11679
|
+
}
|
|
11680
|
+
function extractJsonStringFieldAt(text, field, startIndex, requireClosed = false) {
|
|
11681
|
+
const marker = `"${field}"`;
|
|
11682
|
+
const markerIndex = text.indexOf(marker, Math.max(0, startIndex));
|
|
11683
|
+
if (markerIndex === -1)
|
|
11684
|
+
return;
|
|
11685
|
+
const colonIndex = text.indexOf(":", markerIndex + marker.length);
|
|
11686
|
+
if (colonIndex === -1)
|
|
11687
|
+
return;
|
|
11688
|
+
const quoteIndex = text.indexOf('"', colonIndex + 1);
|
|
11689
|
+
if (quoteIndex === -1)
|
|
11690
|
+
return;
|
|
11691
|
+
let escaped = "";
|
|
11692
|
+
let escaping = false;
|
|
11693
|
+
let closed = false;
|
|
11694
|
+
let endIndex = text.length;
|
|
11695
|
+
for (let i = quoteIndex + 1;i < text.length; i += 1) {
|
|
11696
|
+
const char = text[i];
|
|
11697
|
+
if (escaping) {
|
|
11698
|
+
escaped += `\\${char}`;
|
|
11699
|
+
escaping = false;
|
|
11700
|
+
continue;
|
|
11701
|
+
}
|
|
11702
|
+
if (char === "\\") {
|
|
11703
|
+
escaping = true;
|
|
11704
|
+
continue;
|
|
11705
|
+
}
|
|
11706
|
+
if (char === '"') {
|
|
11707
|
+
closed = true;
|
|
11708
|
+
endIndex = i + 1;
|
|
11709
|
+
break;
|
|
11710
|
+
}
|
|
11711
|
+
escaped += char;
|
|
11712
|
+
}
|
|
11713
|
+
if (requireClosed && !closed)
|
|
11714
|
+
return;
|
|
11715
|
+
return {
|
|
11716
|
+
value: bestEffortUnescapeJsonString(escaped),
|
|
11717
|
+
endIndex,
|
|
11718
|
+
closed
|
|
11719
|
+
};
|
|
11720
|
+
}
|
|
11721
|
+
function extractStreamingMultiEditPreviewEdits(buffer) {
|
|
11722
|
+
const editsStart = buffer.indexOf('"edits"');
|
|
11723
|
+
if (editsStart === -1)
|
|
11724
|
+
return [];
|
|
11725
|
+
const edits = [];
|
|
11726
|
+
let cursor = editsStart;
|
|
11727
|
+
const maxPreviewEdits = 50;
|
|
11728
|
+
while (cursor < buffer.length && edits.length < maxPreviewEdits) {
|
|
11729
|
+
const oldString = extractJsonStringFieldAt(buffer, "oldString", cursor, true);
|
|
11730
|
+
if (!oldString)
|
|
11731
|
+
break;
|
|
11732
|
+
const newString = extractJsonStringFieldAt(buffer, "newString", oldString.endIndex, false);
|
|
11733
|
+
if (!newString)
|
|
11734
|
+
break;
|
|
11735
|
+
edits.push({ oldString: oldString.value, newString: newString.value });
|
|
11736
|
+
cursor = Math.max(newString.endIndex, oldString.endIndex + 1);
|
|
11737
|
+
if (!newString.closed)
|
|
11738
|
+
break;
|
|
11739
|
+
}
|
|
11740
|
+
return edits;
|
|
11741
|
+
}
|
|
11742
|
+
|
|
11672
11743
|
// src/hooks/useSessionStream.ts
|
|
11673
11744
|
var TOOL_PREVIEW_THROTTLE_MS = 500;
|
|
11674
11745
|
var TOOL_PREVIEW_THROTTLE_MIN_CHARS = 8000;
|
|
@@ -11822,7 +11893,7 @@ ${value.slice(-STREAMING_TOOL_INPUT_TAIL_CHARS)}`;
|
|
|
11822
11893
|
toolInputBuffersRef.current.set(key, next);
|
|
11823
11894
|
return parseArgsRecord(next);
|
|
11824
11895
|
};
|
|
11825
|
-
const
|
|
11896
|
+
const bestEffortUnescapeJsonString2 = (value) => {
|
|
11826
11897
|
try {
|
|
11827
11898
|
return JSON.parse(`"${value.replace(/\\$/, "")}"`);
|
|
11828
11899
|
} catch {
|
|
@@ -11863,7 +11934,7 @@ ${value.slice(-STREAMING_TOOL_INPUT_TAIL_CHARS)}`;
|
|
|
11863
11934
|
}
|
|
11864
11935
|
if (requireClosed && !closed)
|
|
11865
11936
|
return;
|
|
11866
|
-
return
|
|
11937
|
+
return bestEffortUnescapeJsonString2(escaped);
|
|
11867
11938
|
};
|
|
11868
11939
|
const getBufferedToolInput = (payload) => {
|
|
11869
11940
|
const key = getToolBufferKey(payload);
|
|
@@ -11900,7 +11971,7 @@ ${argContent.slice(-STREAMING_WRITE_CONTENT_PREVIEW_CHARS)}`;
|
|
|
11900
11971
|
}
|
|
11901
11972
|
const rawTail = buffer.slice(Math.max(valueStart, buffer.length - STREAMING_WRITE_CONTENT_PREVIEW_CHARS));
|
|
11902
11973
|
return `… showing latest streamed content only …
|
|
11903
|
-
${
|
|
11974
|
+
${bestEffortUnescapeJsonString2(rawTail)}`;
|
|
11904
11975
|
};
|
|
11905
11976
|
const getStreamingPatchPreviewContent = (args, buffer) => {
|
|
11906
11977
|
const argPatch = args?.patch;
|
|
@@ -11929,9 +12000,9 @@ ${argPatch.slice(-STREAMING_PATCH_PREVIEW_TAIL_CHARS)}`;
|
|
|
11929
12000
|
}
|
|
11930
12001
|
const rawHead = buffer.slice(valueStart, valueStart + STREAMING_PATCH_PREVIEW_HEAD_CHARS);
|
|
11931
12002
|
const rawTail = buffer.slice(-STREAMING_PATCH_PREVIEW_TAIL_CHARS);
|
|
11932
|
-
return `${
|
|
12003
|
+
return `${bestEffortUnescapeJsonString2(rawHead)}
|
|
11933
12004
|
… patch preview truncated while streaming …
|
|
11934
|
-
${
|
|
12005
|
+
${bestEffortUnescapeJsonString2(rawTail)}`;
|
|
11935
12006
|
};
|
|
11936
12007
|
const getResultRecord = (payload) => payload?.result && typeof payload.result === "object" && !Array.isArray(payload.result) ? payload.result : null;
|
|
11937
12008
|
const getArtifactRecord = (payload) => {
|
|
@@ -12107,14 +12178,15 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
12107
12178
|
return lines.join(`
|
|
12108
12179
|
`);
|
|
12109
12180
|
};
|
|
12110
|
-
const getMultiEditPreviewEdits = (args) => {
|
|
12181
|
+
const getMultiEditPreviewEdits = (args, buffer) => {
|
|
12111
12182
|
const edits = Array.isArray(args?.edits) ? args.edits : [];
|
|
12112
|
-
|
|
12183
|
+
const parsedEdits = edits.flatMap((edit) => {
|
|
12113
12184
|
if (!edit || typeof edit !== "object" || Array.isArray(edit))
|
|
12114
12185
|
return [];
|
|
12115
12186
|
const record = edit;
|
|
12116
12187
|
return typeof record.oldString === "string" && typeof record.newString === "string" ? [{ oldString: record.oldString, newString: record.newString }] : [];
|
|
12117
12188
|
});
|
|
12189
|
+
return parsedEdits.length > 0 ? parsedEdits : extractStreamingMultiEditPreviewEdits(buffer);
|
|
12118
12190
|
};
|
|
12119
12191
|
const getEditPreviewPatch = (toolName, path, args, buffer, artifact) => {
|
|
12120
12192
|
if (typeof artifact?.patch === "string")
|
|
@@ -12124,7 +12196,7 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
12124
12196
|
const newString = getStringArg(args, buffer, "newString");
|
|
12125
12197
|
return oldString !== undefined && newString !== undefined ? buildStringEditPatchPreview(path, [{ oldString, newString }]) : undefined;
|
|
12126
12198
|
}
|
|
12127
|
-
const edits = getMultiEditPreviewEdits(args);
|
|
12199
|
+
const edits = getMultiEditPreviewEdits(args, buffer);
|
|
12128
12200
|
return buildStringEditPatchPreview(path, edits);
|
|
12129
12201
|
};
|
|
12130
12202
|
const handleReadToolActivity = (eventType, payload, delta) => {
|
|
@@ -41819,7 +41891,7 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
|
|
|
41819
41891
|
setOpenAICodeCopied(false);
|
|
41820
41892
|
setOpenAIAuthMode("choice");
|
|
41821
41893
|
setOpenAIModalOpen(true);
|
|
41822
|
-
} else if (providerId === "
|
|
41894
|
+
} else if (providerId === "kimi" && onStartKimiDeviceFlow) {
|
|
41823
41895
|
setKimiPolling(false);
|
|
41824
41896
|
setKimiDevice(null);
|
|
41825
41897
|
setKimiError(null);
|
|
@@ -43224,7 +43296,7 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
|
|
|
43224
43296
|
className: "flex items-center gap-3 p-6 border-b border-border",
|
|
43225
43297
|
children: [
|
|
43226
43298
|
/* @__PURE__ */ jsx154(ProviderLogo, {
|
|
43227
|
-
provider: "
|
|
43299
|
+
provider: "kimi",
|
|
43228
43300
|
size: 24
|
|
43229
43301
|
}),
|
|
43230
43302
|
/* @__PURE__ */ jsx154("h3", {
|
|
@@ -45307,4 +45379,4 @@ export {
|
|
|
45307
45379
|
AgentProviderModelFields
|
|
45308
45380
|
};
|
|
45309
45381
|
|
|
45310
|
-
//# debugId=
|
|
45382
|
+
//# debugId=93E5C22E4936FCE564756E2164756E21
|