nolo-cli 0.8.0-alpha.19 → 0.8.0-alpha.20
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/{_executeModel-BOMQGOZC.js → _executeModel-WRUCQIV5.js} +19 -19
- package/{action-AEHDRQHP.js → action-R4M4ORGA.js} +7 -7
- package/{addContentAction-OL5YQ6LW.js → addContentAction-UYFFTEWJ.js} +6 -6
- package/{addDialogAgentAction-XU5Y2E2X.js → addDialogAgentAction-OT4XZAVP.js} +5 -5
- package/{agentEmailCommands-SE7MBTAG.js → agentEmailCommands-IASM2YBQ.js} +19 -19
- package/{agentMachineCommands-SBYN6EXT.js → agentMachineCommands-OUP3YQP7.js} +1 -1
- package/{agentRecordCommands-F74NBFOZ.js → agentRecordCommands-QKGE2JTA.js} +19 -19
- package/{agentRunCommand-3DGDK4Y3.js → agentRunCommand-TVZXUBQ5.js} +19 -19
- package/{agentSlice-XEH6Y334.js → agentSlice-T4PMW7W6.js} +6 -6
- package/{chunk-OFM4S5P3.js → chunk-2EHX7F5G.js} +9 -9
- package/{chunk-6RSAUKSQ.js → chunk-4FBRSEV4.js} +5 -5
- package/{chunk-PY4NLIAF.js → chunk-5W3VUFOX.js} +1 -1
- package/{chunk-C77B4AFC.js → chunk-7T5PWAZN.js} +1 -1
- package/{chunk-SHAFJ4TI.js → chunk-BCIOM4NZ.js} +2 -2
- package/{chunk-4NDK6NWB.js → chunk-FM5IVZXO.js} +4 -4
- package/{chunk-2EISRLRC.js → chunk-GLYVN7EQ.js} +2 -2
- package/{chunk-4P2MDGKS.js → chunk-IHBCLYEE.js} +40 -2265
- package/{chunk-IX4C5TCO.js → chunk-IJGXKGXW.js} +3 -3
- package/{chunk-64AAZRGY.js → chunk-K6BPOQLF.js} +4 -4
- package/{chunk-ELRRLDWI.js → chunk-K777STIO.js} +2 -2
- package/{chunk-IEKTE4JQ.js → chunk-MNJDFJND.js} +1 -1
- package/{chunk-2BIV3FMX.js → chunk-PFTAG6DY.js} +7 -7
- package/{chunk-XKIMRZO2.js → chunk-PMKQGGGM.js} +1 -1
- package/{chunk-OZNNTJM7.js → chunk-PP4S6RTL.js} +3 -3
- package/{chunk-OI54SUZ7.js → chunk-QJ7FZNYN.js} +3 -3
- package/{chunk-2NNJ6S5U.js → chunk-RGIM3WLT.js} +2 -2
- package/{chunk-JRCUAPXX.js → chunk-TIMLUWQA.js} +1 -1
- package/{chunk-KPSWSDUF.js → chunk-TISCADJH.js} +6 -6
- package/chunk-WI4XWASA.js +208 -0
- package/{chunk-EYEEHCU4.js → chunk-XBROXIGL.js} +1 -1
- package/{chunk-RM7KF6OT.js → chunk-YN4XDB7B.js} +5 -5
- package/{chunk-2T2C6CNY.js → chunk-Z6EKEXJW.js} +4 -4
- package/{chunk-YRG2GO6E.js → chunk-ZDRZMLKO.js} +19 -19
- package/{createAgentAutomationAction-MBUL3ALA.js → createAgentAutomationAction-CCABEOM6.js} +10 -10
- package/{createDialogAction-3JLD4VED.js → createDialogAction-YPKF5ITI.js} +11 -11
- package/{createPageAction-Z2AOWGIW.js → createPageAction-YEZ7EK5F.js} +10 -10
- package/{dbSlice-LSKJDY2R.js → dbSlice-QPVZHBOE.js} +5 -5
- package/{deleteFile-4SKGPHOZ.js → deleteFile-SV5MS23W.js} +3 -3
- package/{dialogSlice-NRQ5WIJO.js → dialogSlice-OVTO7QGW.js} +10 -10
- package/{docStore-DBFNPMHU.js → docStore-ZAYLW2HN.js} +11 -11
- package/{handleSendMessageAction-G3WLT6I7.js → handleSendMessageAction-TZMZ4EP5.js} +10 -10
- package/index.js +26 -26
- package/{machineCommands-GPEWO27H.js → machineCommands-M4ZJZIMS.js} +19 -19
- package/{machineWsRunDispatch-2LSYCV4S.js → machineWsRunDispatch-TPJAUGLP.js} +19 -19
- package/package.json +4 -2
- package/{read-RIJCIVKX.js → read-EBMWX4Z6.js} +3 -3
- package/{readDocTool-GZD2N3LO.js → readDocTool-2MWHSTQE.js} +1 -1
- package/{readlineWorkspace-UL4LXWHX.js → readlineWorkspace-OMCIU3WT.js} +19 -19
- package/{removeDialogAgentAction-U3CP2M2H.js → removeDialogAgentAction-SNZ662NP.js} +7 -7
- package/{runAgentClientLoop-KKV7BWWC.js → runAgentClientLoop-H6NGOUAM.js} +17 -17
- package/{setDialogExtraReferencesAction-S7GUFLTN.js → setDialogExtraReferencesAction-XDI2KM2N.js} +5 -5
- package/{setPrimaryDialogAgentAction-5SF7G5OS.js → setPrimaryDialogAgentAction-PYEC4N4Z.js} +7 -7
- package/{settingSlice-EXYZ5EFP.js → settingSlice-NOWHY2FK.js} +6 -6
- package/{spaceSlice-KIDVQWOV.js → spaceSlice-QHBPICA2.js} +10 -10
- package/{streamAgentChatTurn-YQH6ZGE6.js → streamAgentChatTurn-3XTBA2HN.js} +19 -19
- package/{tableCommands-GOFP7QKA.js → tableCommands-R5UCM63M.js} +1 -1
- package/{tools-5C7OGJEW.js → tools-GHLZ3XD6.js} +15 -15
- package/{updateDialogTitleAction-JHAVYVIP.js → updateDialogTitleAction-XA2OZTLP.js} +10 -10
- package/chunk-QYXLLLGL.js +0 -4519
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
updateContentTitle
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IHBCLYEE.js";
|
|
4
4
|
import {
|
|
5
5
|
require_date_fns
|
|
6
6
|
} from "./chunk-M76ECQRD.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
patch,
|
|
15
15
|
readAndWait
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TISCADJH.js";
|
|
17
17
|
import {
|
|
18
18
|
asOptionalTrimmedString
|
|
19
19
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
async function createDocState(args, thunkApi) {
|
|
370
|
-
const { createPageAction } = await import("./createPageAction-
|
|
370
|
+
const { createPageAction } = await import("./createPageAction-YEZ7EK5F.js");
|
|
371
371
|
return createPageAction(args, thunkApi);
|
|
372
372
|
}
|
|
373
373
|
function subscribe(listener) {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
toTimestampMs,
|
|
8
8
|
upsert,
|
|
9
9
|
write
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TISCADJH.js";
|
|
11
11
|
import {
|
|
12
12
|
asRecordOrEmpty
|
|
13
13
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-QSJ3HFEF.js";
|
|
22
22
|
import {
|
|
23
23
|
BUILTIN_NOLO_AGENT_KEY
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-K777STIO.js";
|
|
25
25
|
import {
|
|
26
26
|
asyncThunkCreator,
|
|
27
27
|
buildCreateSlice,
|
|
@@ -29,12 +29,12 @@ import {
|
|
|
29
29
|
createAsyncThunk,
|
|
30
30
|
createSelector,
|
|
31
31
|
selectIdentityUserId
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XBROXIGL.js";
|
|
33
33
|
import {
|
|
34
34
|
getAllServers,
|
|
35
35
|
getIsDesktopApp,
|
|
36
36
|
isProduction
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-WI4XWASA.js";
|
|
38
38
|
import {
|
|
39
39
|
isLocalServerUrl
|
|
40
40
|
} from "./chunk-4SN6J65J.js";
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
scheduleExistingRecordReplication,
|
|
8
8
|
shouldReplaceLocalWithRemoteRecord,
|
|
9
9
|
shouldReplicateLocalRecord
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XBROXIGL.js";
|
|
11
11
|
import {
|
|
12
12
|
fetchFromClientDb,
|
|
13
13
|
fetchFromServer,
|
|
14
14
|
isAbortError,
|
|
15
15
|
isReadTimeoutError,
|
|
16
16
|
logger
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WI4XWASA.js";
|
|
18
18
|
import {
|
|
19
19
|
shouldReplaceWithNextRecord
|
|
20
20
|
} from "./chunk-GBRG75BQ.js";
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText,
|
|
7
7
|
fetchAndSerializeTable
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZDRZMLKO.js";
|
|
9
9
|
import {
|
|
10
10
|
normalizeNonNegativeMs,
|
|
11
11
|
parseRetryAfterHeaderMs
|
|
12
12
|
} from "./chunk-GAKEBQD6.js";
|
|
13
13
|
import {
|
|
14
14
|
slateToSimplifiedMarkdown
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PMKQGGGM.js";
|
|
16
16
|
import {
|
|
17
17
|
extractCategorizedMentions
|
|
18
18
|
} from "./chunk-VP4WJWKW.js";
|
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
import {
|
|
23
23
|
estimateTokenCount,
|
|
24
24
|
fetchAndCacheMessages
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-IHBCLYEE.js";
|
|
26
26
|
import {
|
|
27
27
|
fetchServerSyncedCredential
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-4FBRSEV4.js";
|
|
29
29
|
import {
|
|
30
30
|
createSpaceKey
|
|
31
31
|
} from "./chunk-UAD2WT54.js";
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
} from "./chunk-HNMXYYJR.js";
|
|
69
69
|
import {
|
|
70
70
|
read
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-TISCADJH.js";
|
|
72
72
|
import {
|
|
73
73
|
asNonEmptyStringArray
|
|
74
74
|
} from "./chunk-I42VC5KR.js";
|
|
@@ -77,10 +77,10 @@ import {
|
|
|
77
77
|
} from "./chunk-QSJ3HFEF.js";
|
|
78
78
|
import {
|
|
79
79
|
getRuntimeServerContext
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-XBROXIGL.js";
|
|
81
81
|
import {
|
|
82
82
|
isAbortError
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-WI4XWASA.js";
|
|
84
84
|
import {
|
|
85
85
|
isLoopbackUrl
|
|
86
86
|
} from "./chunk-4SN6J65J.js";
|
|
@@ -199,7 +199,7 @@ async function readDocFunc(args, thunkApi) {
|
|
|
199
199
|
throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
|
|
200
200
|
}
|
|
201
201
|
try {
|
|
202
|
-
const { readAction } = await import("./read-
|
|
202
|
+
const { readAction } = await import("./read-EBMWX4Z6.js");
|
|
203
203
|
const pageData = await readAction({ dbKey: id }, thunkApi);
|
|
204
204
|
if (!pageData) {
|
|
205
205
|
throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
selectCurrentServer,
|
|
3
3
|
selectRemoteServers
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-K6BPOQLF.js";
|
|
5
5
|
import {
|
|
6
6
|
createUserKey,
|
|
7
7
|
extractAgentInfo,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
noloWriteRequest,
|
|
17
17
|
selectIdentityUser,
|
|
18
18
|
selectIdentityUserId
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XBROXIGL.js";
|
|
20
20
|
import {
|
|
21
21
|
normalizeTimeFields
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WI4XWASA.js";
|
|
23
23
|
|
|
24
24
|
// packages/share/action.ts
|
|
25
25
|
var generateToken = () => {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
prepareAndPersistMessage,
|
|
8
8
|
uiAskChoiceFunc,
|
|
9
9
|
uiAskChoiceFunctionSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IHBCLYEE.js";
|
|
11
11
|
import {
|
|
12
12
|
require_date_fns
|
|
13
13
|
} from "./chunk-M76ECQRD.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
removeCachedEntity,
|
|
28
28
|
upsertSSREntity,
|
|
29
29
|
write
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-TISCADJH.js";
|
|
31
31
|
import {
|
|
32
32
|
createAgentKey,
|
|
33
33
|
createDialogKey,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./chunk-O4BU24WZ.js";
|
|
37
37
|
import {
|
|
38
38
|
selectIdentityUserId
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-XBROXIGL.js";
|
|
40
40
|
import {
|
|
41
41
|
asTrimmedString
|
|
42
42
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
patch,
|
|
6
6
|
read
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TISCADJH.js";
|
|
8
8
|
import {
|
|
9
9
|
DEVICE_LOCAL_OWNER_ID,
|
|
10
10
|
isDeviceLocalSpaceBody,
|
|
11
11
|
selectIdentityUserId
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XBROXIGL.js";
|
|
13
13
|
|
|
14
14
|
// packages/create/space/utils/permissions.ts
|
|
15
15
|
var checkSpaceMembership = (spaceData, userId) => {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
loadFileFromIndexedDb,
|
|
6
6
|
removeAction,
|
|
7
7
|
saveFileToIndexedDb
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GLYVN7EQ.js";
|
|
9
9
|
import {
|
|
10
10
|
fileKey,
|
|
11
11
|
getFileIdFromKey,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
readAction,
|
|
16
16
|
readRequestManager,
|
|
17
17
|
resolveAgentReadServers
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-K777STIO.js";
|
|
19
19
|
import {
|
|
20
20
|
asyncThunkCreator,
|
|
21
21
|
buildCreateSlice,
|
|
@@ -35,13 +35,13 @@ import {
|
|
|
35
35
|
shouldReplaceLocalWithRemoteRecord,
|
|
36
36
|
shouldReplicateLocalRecord,
|
|
37
37
|
uploadToCurrentServer
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-XBROXIGL.js";
|
|
39
39
|
import {
|
|
40
40
|
fetchFromClientDb,
|
|
41
41
|
fetchFromServer,
|
|
42
42
|
logger,
|
|
43
43
|
normalizeTimeFields
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-WI4XWASA.js";
|
|
45
45
|
import {
|
|
46
46
|
isTombstoneRecord
|
|
47
47
|
} from "./chunk-GBRG75BQ.js";
|
|
@@ -674,7 +674,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
674
674
|
// 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
|
|
675
675
|
read: create.asyncThunk(
|
|
676
676
|
async (payload, thunkApi) => {
|
|
677
|
-
const { readAction: readAction2 } = await import("./read-
|
|
677
|
+
const { readAction: readAction2 } = await import("./read-EBMWX4Z6.js");
|
|
678
678
|
return readAction2(payload, thunkApi);
|
|
679
679
|
},
|
|
680
680
|
{
|
|
@@ -748,7 +748,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
748
748
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
749
749
|
share: create.asyncThunk(
|
|
750
750
|
async (config, thunkApi) => {
|
|
751
|
-
const { shareResourceAction } = await import("./action-
|
|
751
|
+
const { shareResourceAction } = await import("./action-R4M4ORGA.js");
|
|
752
752
|
return shareResourceAction(config, thunkApi);
|
|
753
753
|
}
|
|
754
754
|
),
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import {
|
|
2
|
+
API_ENDPOINTS,
|
|
3
|
+
NOLO_CLUSTER_SERVERS,
|
|
4
|
+
isLocalDevServerOrigin,
|
|
5
|
+
isNoloClusterServerOrigin,
|
|
6
|
+
normalizeKnownServerOrigin
|
|
7
|
+
} from "./chunk-LCBAMY2M.js";
|
|
8
|
+
import {
|
|
9
|
+
normalizeServerOrigin
|
|
10
|
+
} from "./chunk-CF7PE763.js";
|
|
11
|
+
|
|
12
|
+
// packages/app/utils/env.ts
|
|
13
|
+
var processEnv = typeof process !== "undefined" ? process.env : void 0;
|
|
14
|
+
var reactNativeDev = typeof globalThis !== "undefined" && "__DEV__" in globalThis ? globalThis.__DEV__ : void 0;
|
|
15
|
+
var isProduction = processEnv?.NOLO_FORCE_PRODUCTION === "1" || processEnv?.NODE_ENV === "production" || reactNativeDev === false;
|
|
16
|
+
var getIsDesktopApp = () => (typeof process !== "undefined" ? process.env?.NOLO_DESKTOP : processEnv?.NOLO_DESKTOP) === "1" || typeof window !== "undefined" && window.__NOLO_DESKTOP__ === true;
|
|
17
|
+
var isDesktopApp = getIsDesktopApp();
|
|
18
|
+
|
|
19
|
+
// packages/core/abortError.ts
|
|
20
|
+
function isAbortError(error) {
|
|
21
|
+
if (!error || typeof error !== "object") return false;
|
|
22
|
+
return error.name === "AbortError";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// packages/database/actions/common.ts
|
|
26
|
+
import pino from "pino";
|
|
27
|
+
|
|
28
|
+
// packages/app/utils/retryFetch.ts
|
|
29
|
+
var TRANSIENT_READ_RETRY_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
30
|
+
var DEFAULT_RETRY_DELAYS_MS = [300, 1e3];
|
|
31
|
+
var sleep = (ms) => new Promise((resolve) => {
|
|
32
|
+
setTimeout(resolve, ms);
|
|
33
|
+
});
|
|
34
|
+
var getRequestMethod = (input, init) => {
|
|
35
|
+
if (init?.method) return init.method.toUpperCase();
|
|
36
|
+
if (typeof Request !== "undefined" && input instanceof Request) {
|
|
37
|
+
return input.method.toUpperCase();
|
|
38
|
+
}
|
|
39
|
+
return "GET";
|
|
40
|
+
};
|
|
41
|
+
var isRetryableReadMethod = (method) => method === "GET" || method === "HEAD";
|
|
42
|
+
var fetchWithTransientReadRetry = async (input, init, options = {}) => {
|
|
43
|
+
const method = getRequestMethod(input, init);
|
|
44
|
+
const canRetry = isRetryableReadMethod(method);
|
|
45
|
+
const delaysMs = options.delaysMs ?? DEFAULT_RETRY_DELAYS_MS;
|
|
46
|
+
const retryStatuses = options.retryStatuses ?? TRANSIENT_READ_RETRY_STATUSES;
|
|
47
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
48
|
+
const wait = options.sleep ?? sleep;
|
|
49
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
50
|
+
try {
|
|
51
|
+
const response = await fetchImpl(input, init);
|
|
52
|
+
const shouldRetry = canRetry && retryStatuses.has(response.status) && attempt < delaysMs.length;
|
|
53
|
+
if (!shouldRetry) return response;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
const shouldRetry = canRetry && !isAbortError(error) && attempt < delaysMs.length;
|
|
56
|
+
if (!shouldRetry) throw error;
|
|
57
|
+
}
|
|
58
|
+
await wait(delaysMs[attempt]);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// packages/database/levelNotFoundError.ts
|
|
63
|
+
function isLevelNotFoundError(error) {
|
|
64
|
+
if (!error || typeof error !== "object") return false;
|
|
65
|
+
const e = error;
|
|
66
|
+
return e.notFound === true || e.name === "NotFoundError" || e.code === "LEVEL_NOT_FOUND" || e.code === "LEVEL_NOT_FOUND_ERROR" || e.message === "NotFound";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// packages/database/actions/common.ts
|
|
70
|
+
var isRN = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
71
|
+
var logger = isRN ? {
|
|
72
|
+
info: (...args) => console.log(...args),
|
|
73
|
+
warn: (...args) => console.warn(...args),
|
|
74
|
+
error: (...args) => console.error(...args),
|
|
75
|
+
debug: (...args) => console.log(...args),
|
|
76
|
+
// console.debug in RN behaves like log
|
|
77
|
+
trace: (...args) => console.log(...args),
|
|
78
|
+
fatal: (...args) => console.error(...args),
|
|
79
|
+
child: () => logger
|
|
80
|
+
// 简单返回自己
|
|
81
|
+
} : pino({
|
|
82
|
+
level: "info"
|
|
83
|
+
// transport: {
|
|
84
|
+
// target: "pino-pretty",
|
|
85
|
+
// },
|
|
86
|
+
});
|
|
87
|
+
var normalizeServer = (server) => normalizeKnownServerOrigin(server) ?? normalizeServerOrigin(server);
|
|
88
|
+
var mergeConfiguredServers = (currentServer, syncServers) => {
|
|
89
|
+
const runtimeOrigin = !getIsDesktopApp() && typeof window !== "undefined" && typeof window.location?.origin === "string" && /^https?:\/\//.test(window.location.origin) ? window.location.origin : void 0;
|
|
90
|
+
const raw = [
|
|
91
|
+
currentServer,
|
|
92
|
+
...Array.isArray(syncServers) ? syncServers : [],
|
|
93
|
+
runtimeOrigin
|
|
94
|
+
].filter(
|
|
95
|
+
(s) => typeof s === "string" && s.trim().length > 0
|
|
96
|
+
);
|
|
97
|
+
const normalized = raw.map(normalizeServer);
|
|
98
|
+
const shouldIncludeClusterPeers = normalized.some(isNoloClusterServerOrigin) || typeof currentServer === "string" && isLocalDevServerOrigin(currentServer);
|
|
99
|
+
if (shouldIncludeClusterPeers) {
|
|
100
|
+
normalized.push(...NOLO_CLUSTER_SERVERS);
|
|
101
|
+
}
|
|
102
|
+
return Array.from(new Set(normalized));
|
|
103
|
+
};
|
|
104
|
+
var getAllServers = (currentServer, syncServers, preferredServer) => {
|
|
105
|
+
const preferredNormalized = typeof preferredServer === "string" && preferredServer.trim().length > 0 ? normalizeServer(preferredServer) : null;
|
|
106
|
+
const servers = mergeConfiguredServers(
|
|
107
|
+
currentServer,
|
|
108
|
+
preferredNormalized && isNoloClusterServerOrigin(preferredNormalized) ? [...Array.isArray(syncServers) ? syncServers : [], preferredNormalized] : syncServers
|
|
109
|
+
);
|
|
110
|
+
if (!preferredServer || typeof preferredServer !== "string") {
|
|
111
|
+
return servers;
|
|
112
|
+
}
|
|
113
|
+
const remaining = servers.filter(
|
|
114
|
+
(server) => normalizeServer(server) !== preferredNormalized
|
|
115
|
+
);
|
|
116
|
+
return preferredNormalized ? [preferredNormalized, ...remaining] : remaining;
|
|
117
|
+
};
|
|
118
|
+
var fetchFromClientDb = async (clientDb, dbKey) => {
|
|
119
|
+
if (!clientDb) {
|
|
120
|
+
logger.error(
|
|
121
|
+
{ dbKey },
|
|
122
|
+
"Client database is undefined in fetchFromClientDb"
|
|
123
|
+
);
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
return await clientDb.get(dbKey);
|
|
128
|
+
} catch (err) {
|
|
129
|
+
if (isLevelNotFoundError(err)) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
logger.error({ err, dbKey }, "Failed to get local data");
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var SERVER_TIMEOUT = 5e3;
|
|
137
|
+
var READ_TIMEOUT_ERROR_NAME = "ReadTimeoutError";
|
|
138
|
+
var isPublicFileDbKey = (dbKey) => dbKey.startsWith("file-");
|
|
139
|
+
var buildReadUrl = (dbKey) => isPublicFileDbKey(dbKey) ? `${API_ENDPOINTS.DATABASE}/file/metadata/${encodeURIComponent(dbKey)}` : `${API_ENDPOINTS.DATABASE}/read/${encodeURIComponent(dbKey)}`;
|
|
140
|
+
var createReadTimeoutError = (server, dbKey) => {
|
|
141
|
+
const error = new Error(
|
|
142
|
+
`Timed out reading key "${dbKey}" from ${normalizeServer(server)}.`
|
|
143
|
+
);
|
|
144
|
+
error.name = READ_TIMEOUT_ERROR_NAME;
|
|
145
|
+
return error;
|
|
146
|
+
};
|
|
147
|
+
var isReadTimeoutError = (error) => error instanceof Error && error.name === READ_TIMEOUT_ERROR_NAME;
|
|
148
|
+
var fetchFromServer = async (server, dbKey, token, signal) => {
|
|
149
|
+
if (signal?.aborted) {
|
|
150
|
+
throw new DOMException("Aborted", "AbortError");
|
|
151
|
+
}
|
|
152
|
+
const controller = new AbortController();
|
|
153
|
+
let didTimeout = false;
|
|
154
|
+
const timeoutId = setTimeout(() => {
|
|
155
|
+
didTimeout = true;
|
|
156
|
+
controller.abort();
|
|
157
|
+
}, SERVER_TIMEOUT);
|
|
158
|
+
const onExternalAbort = () => controller.abort();
|
|
159
|
+
signal?.addEventListener("abort", onExternalAbort);
|
|
160
|
+
try {
|
|
161
|
+
const res = await fetchWithTransientReadRetry(
|
|
162
|
+
`${server}${buildReadUrl(dbKey)}`,
|
|
163
|
+
{
|
|
164
|
+
signal: controller.signal,
|
|
165
|
+
headers: {
|
|
166
|
+
"Content-Type": "application/json",
|
|
167
|
+
...token && { Authorization: `Bearer ${token}` }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
clearTimeout(timeoutId);
|
|
172
|
+
signal?.removeEventListener("abort", onExternalAbort);
|
|
173
|
+
if (res.status === 200) {
|
|
174
|
+
return await res.json();
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
} catch (err) {
|
|
178
|
+
clearTimeout(timeoutId);
|
|
179
|
+
signal?.removeEventListener("abort", onExternalAbort);
|
|
180
|
+
if (didTimeout) {
|
|
181
|
+
throw createReadTimeoutError(server, dbKey);
|
|
182
|
+
}
|
|
183
|
+
if (signal?.aborted || isAbortError(err)) {
|
|
184
|
+
throw err;
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var normalizeTimeFields = (data) => ({
|
|
190
|
+
...data,
|
|
191
|
+
createdAt: data.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
192
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
193
|
+
updated_at: void 0,
|
|
194
|
+
created_at: void 0
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
isProduction,
|
|
199
|
+
getIsDesktopApp,
|
|
200
|
+
isAbortError,
|
|
201
|
+
fetchWithTransientReadRetry,
|
|
202
|
+
logger,
|
|
203
|
+
getAllServers,
|
|
204
|
+
fetchFromClientDb,
|
|
205
|
+
isReadTimeoutError,
|
|
206
|
+
fetchFromServer,
|
|
207
|
+
normalizeTimeFields
|
|
208
|
+
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-VHBWHNVT.js";
|
|
18
18
|
import {
|
|
19
19
|
inferCaptureIntent
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-TIMLUWQA.js";
|
|
21
21
|
import {
|
|
22
22
|
CliProviderQuotaError,
|
|
23
23
|
executeCli
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "./chunk-ATNTHIZI.js";
|
|
28
28
|
import {
|
|
29
29
|
prepareTools
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-7T5PWAZN.js";
|
|
31
31
|
import {
|
|
32
32
|
getAntigravityUserAgent,
|
|
33
33
|
isAntigravityOAuthAgent,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
readXPostFunctionSchema,
|
|
44
44
|
readXhsProfileFunc,
|
|
45
45
|
readXhsProfileFunctionSchema
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-ZDRZMLKO.js";
|
|
47
47
|
import {
|
|
48
48
|
normalizeDialogTitle
|
|
49
49
|
} from "./chunk-OWOHNGCN.js";
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
} from "./chunk-4ZDM73SD.js";
|
|
53
53
|
import {
|
|
54
54
|
fetchServerSyncedCredential
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-4FBRSEV4.js";
|
|
56
56
|
import {
|
|
57
57
|
isCompiledBinary,
|
|
58
58
|
parseUserIdFromAuthToken
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
PUBLIC_GLM_52_AGENT_KEY,
|
|
140
140
|
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
|
|
141
141
|
PUBLIC_KIMI_K27_CODING_AGENT_KEY
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-K777STIO.js";
|
|
143
143
|
import {
|
|
144
144
|
isLoopbackHostname
|
|
145
145
|
} from "./chunk-4SN6J65J.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
selectCurrentServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K6BPOQLF.js";
|
|
4
4
|
import {
|
|
5
5
|
patch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TISCADJH.js";
|
|
7
7
|
import {
|
|
8
8
|
selectIdentityToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XBROXIGL.js";
|
|
10
10
|
import {
|
|
11
11
|
getIsDesktopApp
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WI4XWASA.js";
|
|
13
13
|
|
|
14
14
|
// packages/ai/agent/cliChatClient.ts
|
|
15
15
|
function getCliChatRequestConfig(thunkApi) {
|