nolo-cli 0.198.0-alpha.1 → 0.198.0-alpha.3
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-4RT36WBH.js → _executeModel-3D4HLADO.js} +24 -24
- package/{action-BHWB4MOK.js → action-HNG2JKWK.js} +3 -3
- package/{addContentAction-BY375D35.js → addContentAction-FEN3H2EE.js} +6 -6
- package/{addDialogAgentAction-HOZYOCWC.js → addDialogAgentAction-DDA6S3WS.js} +5 -5
- package/{agentDeleteCommand-EU65GA6U.js → agentDeleteCommand-EXBU3PZJ.js} +21 -21
- package/{agentEmailCommands-SRMUB7Y5.js → agentEmailCommands-3T7NAJHR.js} +23 -23
- package/{agentMachineCommands-O3HXC7I2.js → agentMachineCommands-JXXDCTG5.js} +1 -1
- package/{agentRecordCommands-WM6DQE5H.js → agentRecordCommands-RLHYIRGY.js} +22 -22
- package/{agentRunCommand-UTAFQWLA.js → agentRunCommand-7KO6SQPF.js} +23 -23
- package/{agentSlice-QR4DJTUV.js → agentSlice-JFRZAKR4.js} +6 -6
- package/{chunk-6XLEYYRD.js → chunk-2WVRUUXO.js} +5 -5
- package/{chunk-7UODCAWW.js → chunk-32GANJHJ.js} +1 -1
- package/{chunk-KYSNL6JW.js → chunk-3Z7KHXVE.js} +6 -6
- package/{chunk-SHPPZHJU.js → chunk-4SEOTTFQ.js} +2 -2
- package/{chunk-LBXUNNDS.js → chunk-6K2AKJAD.js} +1 -1
- package/{chunk-Y7LWDCQL.js → chunk-7MB72UW6.js} +22 -22
- package/{chunk-CNMQATUF.js → chunk-GL7W7TTR.js} +2 -2
- package/{chunk-N2EBBGNK.js → chunk-HGS3XV5K.js} +1 -1
- package/{chunk-MA4DQQGB.js → chunk-HN3XRWSP.js} +2 -2
- package/{chunk-32ZKZET7.js → chunk-HWZT5DKX.js} +1 -1
- package/{chunk-HRLGOAT6.js → chunk-JW2GK3KC.js} +3 -3
- package/{chunk-VAGLIFTY.js → chunk-L577NIDI.js} +1 -1
- package/{chunk-PYMI4KWK.js → chunk-MGFRMNK5.js} +19 -19
- package/{chunk-4CUA56ZN.js → chunk-MKDEI64N.js} +2 -2
- package/{chunk-BA2FHPS4.js → chunk-MOCY5LJI.js} +1 -1
- package/{chunk-B2N5GZBU.js → chunk-OHYCQKPW.js} +6 -6
- package/{chunk-W2RUNZSW.js → chunk-OYZLT2BN.js} +5 -5
- package/{chunk-SF7ZXCU7.js → chunk-POEYAIBT.js} +6 -6
- package/{chunk-B6EZB6DW.js → chunk-QAYCF4CH.js} +2 -2
- package/{chunk-DFF6B7P7.js → chunk-RXUKDHS5.js} +1 -1
- package/{chunk-YCYVL4LE.js → chunk-RYPJRIFF.js} +4 -4
- package/{chunk-VFD73XRX.js → chunk-S5DELBWY.js} +182 -91
- package/{chunk-A5BLRE3G.js → chunk-T3U2KQF4.js} +2 -2
- package/{chunk-YBHUH2J5.js → chunk-TXQ5BC57.js} +3 -3
- package/{chunk-MW6YS6Y6.js → chunk-UL57BAAE.js} +2 -2
- package/{chunk-4SFMGR5S.js → chunk-W7JWTQTJ.js} +7 -7
- package/{chunk-YIRADHSY.js → chunk-WYKMOZTW.js} +1 -1
- package/{chunk-WRCZXJ4N.js → chunk-X4F26D5K.js} +2 -0
- package/{chunk-TLYAMDPX.js → chunk-YQH5IYWZ.js} +10 -10
- package/{chunk-JGJVDP2W.js → chunk-Z3MQYKRN.js} +1 -1
- package/{commandRegistry-CIAAETIC.js → commandRegistry-A4AXQVI6.js} +15 -15
- package/{contentThunks-5LWWGYMP.js → contentThunks-6BAKBO7Q.js} +11 -11
- package/{createAgentAutomationAction-SW7H6UXU.js → createAgentAutomationAction-HJWAZ7RX.js} +11 -11
- package/{createDialogAction-YPZBMKG4.js → createDialogAction-BDI3T4C7.js} +12 -12
- package/{createPageAction-5SC5LA2Y.js → createPageAction-P5NL5NIZ.js} +11 -11
- package/{dbSlice-QAUXABCC.js → dbSlice-JK7LWBDO.js} +5 -5
- package/{deleteFile-R5OBP7OM.js → deleteFile-CE24BROO.js} +3 -3
- package/{dialogSlice-T4W7ZR2X.js → dialogSlice-UZXUHU3F.js} +10 -10
- package/{docStore-C4XHZ7CI.js → docStore-624W4Z63.js} +6 -6
- package/{handleSendMessageAction-CAB5CVB3.js → handleSendMessageAction-LTXSYSV6.js} +17 -17
- package/index.js +3 -3
- package/{localRuntimeAdapter-4WIRFTYQ.js → localRuntimeAdapter-TXW7C4C6.js} +21 -21
- package/{machineCommands-XED6SQR6.js → machineCommands-NA7OPUFC.js} +22 -22
- package/{machineWsRunDispatch-ZUD23U2R.js → machineWsRunDispatch-H5BYGTVO.js} +22 -22
- package/{memberThunks-QWAAGQBS.js → memberThunks-WT2KVRP4.js} +6 -6
- package/package.json +1 -1
- package/{read-D6NEWSGG.js → read-ILTT75DW.js} +3 -3
- package/{readDocTool-NTAXO7SX.js → readDocTool-374CFJYO.js} +1 -1
- package/{readlineWorkspace-ZTQCBNXR.js → readlineWorkspace-6P3HJ6GO.js} +23 -23
- package/{removeDialogAgentAction-YEPO5AYI.js → removeDialogAgentAction-BDLO7UC2.js} +7 -7
- package/{runAgentClientLoop-PMSGE3HZ.js → runAgentClientLoop-GSEMKTPY.js} +22 -22
- package/{setDialogExtraReferencesAction-EH5GWDAJ.js → setDialogExtraReferencesAction-GBIT7WAG.js} +6 -6
- package/{setPrimaryDialogAgentAction-PNWRK6IY.js → setPrimaryDialogAgentAction-PGBTR247.js} +7 -7
- package/{settingThunks-7VCWB6P7.js → settingThunks-GH326IL5.js} +5 -5
- package/{streamAgentChatTurn-BY74TOYM.js → streamAgentChatTurn-6UMDQLPT.js} +24 -24
- package/{switchDialogAgentAction-23BFWJMV.js → switchDialogAgentAction-O7WTPLKG.js} +5 -5
- package/{tools-RZGJZ2XV.js → tools-3GCMXU2R.js} +19 -19
- package/{updateDialogTitleAction-G7HMA6RA.js → updateDialogTitleAction-SO5P7F64.js} +11 -11
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
remove,
|
|
2
|
+
upsertSSREntity,
|
|
4
3
|
write
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OHYCQKPW.js";
|
|
6
5
|
import {
|
|
7
|
-
getRuntimeServerContext
|
|
8
|
-
|
|
6
|
+
getRuntimeServerContext,
|
|
7
|
+
resolveRecordAuthority
|
|
8
|
+
} from "./chunk-32GANJHJ.js";
|
|
9
9
|
import {
|
|
10
|
+
TIMEOUT,
|
|
10
11
|
asyncThunkCreator,
|
|
11
|
-
buildCreateSlice
|
|
12
|
-
|
|
12
|
+
buildCreateSlice,
|
|
13
|
+
noloRequest
|
|
14
|
+
} from "./chunk-X4F26D5K.js";
|
|
15
|
+
import {
|
|
16
|
+
isLevelNotFoundError
|
|
17
|
+
} from "./chunk-OW765XBU.js";
|
|
13
18
|
import {
|
|
14
19
|
applyAgentSecretMigrationUpdates,
|
|
15
20
|
migrateAgentSecrets,
|
|
@@ -24,6 +29,9 @@ import {
|
|
|
24
29
|
import {
|
|
25
30
|
isRecord
|
|
26
31
|
} from "./chunk-KUG52IAP.js";
|
|
32
|
+
import {
|
|
33
|
+
API_ENDPOINTS
|
|
34
|
+
} from "./chunk-LCBAMY2M.js";
|
|
27
35
|
import {
|
|
28
36
|
createAgentKey,
|
|
29
37
|
createUserKey,
|
|
@@ -36,6 +44,106 @@ import {
|
|
|
36
44
|
asOptionalTrimmedString
|
|
37
45
|
} from "./chunk-G3SUCT4W.js";
|
|
38
46
|
|
|
47
|
+
// packages/database/agentUpdate.ts
|
|
48
|
+
var AgentUpdateError = class extends Error {
|
|
49
|
+
kind;
|
|
50
|
+
status;
|
|
51
|
+
code;
|
|
52
|
+
fieldErrors;
|
|
53
|
+
privateSaved;
|
|
54
|
+
agent;
|
|
55
|
+
constructor(failure) {
|
|
56
|
+
super(failure.message ?? "Agent \u4FDD\u5B58\u5931\u8D25");
|
|
57
|
+
this.name = "AgentUpdateError";
|
|
58
|
+
this.kind = failure.kind;
|
|
59
|
+
Object.assign(this, failure);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var agentUpdateFailure = (error) => {
|
|
63
|
+
const value = error instanceof AgentUpdateError ? error : new AgentUpdateError({
|
|
64
|
+
kind: "server",
|
|
65
|
+
message: error instanceof Error ? error.message : "Agent \u4FDD\u5B58\u5931\u8D25"
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
kind: value.kind,
|
|
69
|
+
status: value.status,
|
|
70
|
+
code: value.code,
|
|
71
|
+
fieldErrors: value.fieldErrors,
|
|
72
|
+
message: value.message,
|
|
73
|
+
...value.privateSaved ? { privateSaved: true, agent: value.agent } : {}
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
async function agentRequest(server, state, path, method, body) {
|
|
77
|
+
const controller = new AbortController();
|
|
78
|
+
const timeout = setTimeout(() => controller.abort(), TIMEOUT);
|
|
79
|
+
try {
|
|
80
|
+
const response = await noloRequest(server, {
|
|
81
|
+
url: `${API_ENDPOINTS.DATABASE}/${path}`,
|
|
82
|
+
method,
|
|
83
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
84
|
+
}, state, controller.signal);
|
|
85
|
+
const result = await response.json().catch(() => ({}));
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
throw new AgentUpdateError({
|
|
88
|
+
kind: response.status === 403 ? "forbidden" : response.status === 409 ? "conflict" : response.status === 400 ? "validation" : "server",
|
|
89
|
+
status: response.status,
|
|
90
|
+
code: result.code ?? result.error,
|
|
91
|
+
fieldErrors: result.fieldErrors,
|
|
92
|
+
message: result.message ?? `Agent \u8BF7\u6C42\u5931\u8D25 (${response.status})`
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (error instanceof AgentUpdateError) throw error;
|
|
98
|
+
throw new AgentUpdateError({
|
|
99
|
+
kind: "network",
|
|
100
|
+
code: controller.signal.aborted ? "timeout" : "network_error",
|
|
101
|
+
message: "\u672A\u786E\u8BA4\u4FDD\u5B58\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u8FDE\u63A5\u5E76\u6838\u5B9E\u670D\u52A1\u7AEF\u8BB0\u5F55\u540E\u518D\u64CD\u4F5C"
|
|
102
|
+
});
|
|
103
|
+
} finally {
|
|
104
|
+
clearTimeout(timeout);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function updateAgentRecord(options) {
|
|
108
|
+
const { server, state, dbKey, changes } = options;
|
|
109
|
+
if (dbKey.startsWith("agent-local-")) {
|
|
110
|
+
if (!options.localDb) throw new AgentUpdateError({ kind: "conflict", code: "missing_local_database", message: "\u672C\u5730\u5B58\u50A8\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u4FDD\u5B58 Agent" });
|
|
111
|
+
let previous;
|
|
112
|
+
const storageFailure = () => new AgentUpdateError({
|
|
113
|
+
kind: "conflict",
|
|
114
|
+
code: "local_storage_error",
|
|
115
|
+
message: "\u672C\u5730\u5B58\u50A8\u8BFB\u5199\u5931\u8D25\uFF0C\u672A\u786E\u8BA4 Agent \u4FDD\u5B58\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u8BBE\u5907\u5B58\u50A8\u540E\u91CD\u8BD5"
|
|
116
|
+
});
|
|
117
|
+
try {
|
|
118
|
+
previous = await options.localDb.get(dbKey);
|
|
119
|
+
} catch (error) {
|
|
120
|
+
if (!isLevelNotFoundError(error)) throw storageFailure();
|
|
121
|
+
}
|
|
122
|
+
if (!previous) throw new AgentUpdateError({ kind: "conflict", code: "local_agent_missing", message: "\u672C\u5730 Agent \u4E0D\u5B58\u5728" });
|
|
123
|
+
const merge = (base, patch) => {
|
|
124
|
+
const result2 = { ...base };
|
|
125
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
126
|
+
if (value === null) delete result2[key];
|
|
127
|
+
else if (value !== void 0) result2[key] = typeof value === "object" && !Array.isArray(value) ? merge(result2[key], value) : value;
|
|
128
|
+
}
|
|
129
|
+
return result2;
|
|
130
|
+
};
|
|
131
|
+
const saved = merge(previous, { ...changes, isPublic: false, userId: "local" });
|
|
132
|
+
saved.updatedAt = Date.now();
|
|
133
|
+
try {
|
|
134
|
+
await options.localDb.put(dbKey, saved);
|
|
135
|
+
} catch {
|
|
136
|
+
throw storageFailure();
|
|
137
|
+
}
|
|
138
|
+
return saved;
|
|
139
|
+
}
|
|
140
|
+
const result = await agentRequest(server, state, `patch/${encodeURIComponent(dbKey)}`, "PATCH", changes);
|
|
141
|
+
if (!result.data || typeof result.data !== "object") {
|
|
142
|
+
throw new AgentUpdateError({ kind: "server", code: "invalid_agent_response", message: "\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u6743\u5A01 Agent \u8BB0\u5F55" });
|
|
143
|
+
}
|
|
144
|
+
return result.data;
|
|
145
|
+
}
|
|
146
|
+
|
|
39
147
|
// packages/ai/chat/agentCredentialSyncClient.ts
|
|
40
148
|
function buildUrl(currentServer, credentialRef) {
|
|
41
149
|
return `${currentServer}/api/agent-credentials/${encodeURIComponent(credentialRef)}`;
|
|
@@ -334,6 +442,9 @@ var processAgentUpdateChanges = (data, userId, previousAgent) => {
|
|
|
334
442
|
changes.whitelist = [];
|
|
335
443
|
}
|
|
336
444
|
}
|
|
445
|
+
for (const key of Object.keys(changes)) {
|
|
446
|
+
if (data[key] === null) changes[key] = null;
|
|
447
|
+
}
|
|
337
448
|
return changes;
|
|
338
449
|
};
|
|
339
450
|
var slice = createSliceWithThunks({
|
|
@@ -347,7 +458,7 @@ var slice = createSliceWithThunks({
|
|
|
347
458
|
const overrides = {};
|
|
348
459
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
349
460
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
350
|
-
const { _executeModel } = await import("./_executeModel-
|
|
461
|
+
const { _executeModel } = await import("./_executeModel-3D4HLADO.js");
|
|
351
462
|
return _executeModel(
|
|
352
463
|
{
|
|
353
464
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -368,7 +479,7 @@ var slice = createSliceWithThunks({
|
|
|
368
479
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
369
480
|
*/
|
|
370
481
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
371
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
482
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-GSEMKTPY.js");
|
|
372
483
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
373
484
|
{
|
|
374
485
|
agentKey: args.agentKey,
|
|
@@ -384,7 +495,7 @@ var slice = createSliceWithThunks({
|
|
|
384
495
|
* 聊天轮次流式 Agent 调用
|
|
385
496
|
*/
|
|
386
497
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
387
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
498
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-6UMDQLPT.js");
|
|
388
499
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
389
500
|
}),
|
|
390
501
|
/**
|
|
@@ -487,15 +598,7 @@ var slice = createSliceWithThunks({
|
|
|
487
598
|
return agent;
|
|
488
599
|
}
|
|
489
600
|
),
|
|
490
|
-
|
|
491
|
-
* 更新 Agent(支持局部字段 patch):
|
|
492
|
-
* - patch 私有副本
|
|
493
|
-
* - 如提供 previousAgent,则同步更新 / 删除公共副本
|
|
494
|
-
*
|
|
495
|
-
* 注意:
|
|
496
|
-
* - Tool 场景下一般不提供 previousAgent,此时只保证私有副本被更新;
|
|
497
|
-
* 公共副本(应用市场)不做强一致保证。
|
|
498
|
-
*/
|
|
601
|
+
// 旧快照只能辅助凭据迁移,不能作为持久化基底;否则会覆盖服务端较新的模型。
|
|
499
602
|
updateAgent: create.asyncThunk(
|
|
500
603
|
async ({ userId, agentId, formData, previousAgent }, thunkApi) => {
|
|
501
604
|
const effectiveUserId = asOptionalTrimmedString(userId) ?? "local";
|
|
@@ -525,85 +628,73 @@ var slice = createSliceWithThunks({
|
|
|
525
628
|
changes.apiKey = null;
|
|
526
629
|
}
|
|
527
630
|
}
|
|
528
|
-
let localExists = false;
|
|
529
631
|
try {
|
|
530
|
-
const
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
const hasIsPublicChange = Object.prototype.hasOwnProperty.call(
|
|
568
|
-
changes,
|
|
569
|
-
"isPublic"
|
|
570
|
-
);
|
|
571
|
-
const nowPublic = hasIsPublicChange ? !!changes.isPublic : wasPublic;
|
|
572
|
-
if (nowPublic) {
|
|
573
|
-
const authorName = await readAuthorNameSnapshot(
|
|
574
|
-
thunkApi.extra?.db,
|
|
575
|
-
effectiveUserId
|
|
576
|
-
);
|
|
577
|
-
const mergedPublic = withAuthorNameSnapshot(
|
|
578
|
-
{
|
|
579
|
-
...previousAgent,
|
|
580
|
-
...changes,
|
|
632
|
+
const state = thunkApi.getState();
|
|
633
|
+
const context = getRuntimeServerContext(state);
|
|
634
|
+
const { currentServer } = context;
|
|
635
|
+
const db = thunkApi.extra?.db;
|
|
636
|
+
const localOnly = effectiveUserId === "local";
|
|
637
|
+
const authority = resolveRecordAuthority({
|
|
638
|
+
dbKey: privateKey,
|
|
639
|
+
currentServer,
|
|
640
|
+
currentUserId: effectiveUserId,
|
|
641
|
+
userAuthorityRegistry: context.userAuthorityRegistry
|
|
642
|
+
});
|
|
643
|
+
const server = authority.authorityServer ?? currentServer ?? "";
|
|
644
|
+
if (!server && !localOnly) throw new AgentUpdateError({
|
|
645
|
+
kind: "network",
|
|
646
|
+
code: "missing_server",
|
|
647
|
+
message: "\u672A\u8FDE\u63A5\u670D\u52A1\u7AEF\uFF0C\u672A\u786E\u8BA4\u4FDD\u5B58\u7ED3\u679C"
|
|
648
|
+
});
|
|
649
|
+
const saved = await updateAgentRecord({ server, state, dbKey: privateKey, changes, localDb: db });
|
|
650
|
+
const entity = { ...saved, dbKey: privateKey };
|
|
651
|
+
thunkApi.dispatch(upsertSSREntity(entity));
|
|
652
|
+
try {
|
|
653
|
+
if (db && !localOnly) await db.put(privateKey, saved);
|
|
654
|
+
} catch (error) {
|
|
655
|
+
throw new AgentUpdateError({
|
|
656
|
+
...agentUpdateFailure(error),
|
|
657
|
+
kind: "conflict",
|
|
658
|
+
code: "local_cache_failed",
|
|
659
|
+
privateSaved: true,
|
|
660
|
+
agent: saved,
|
|
661
|
+
message: "\u79C1\u6709\u8BB0\u5F55\u5DF2\u4FDD\u5B58\uFF0C\u672C\u5730\u7F13\u5B58\u66F4\u65B0\u5931\u8D25\uFF1B\u8BF7\u52FF\u91CD\u65B0\u63D0\u4EA4\u6574\u6B21\u7F16\u8F91"
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
try {
|
|
665
|
+
if (!localOnly && saved.isPublic) {
|
|
666
|
+
const authorName = await readAuthorNameSnapshot(db, effectiveUserId);
|
|
667
|
+
const projection = withAuthorNameSnapshot({
|
|
668
|
+
...saved,
|
|
581
669
|
id: normalizedAgentId,
|
|
582
|
-
type:
|
|
670
|
+
type: saved.type || "agent" /* AGENT */,
|
|
583
671
|
userId: effectiveUserId
|
|
584
|
-
},
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
await thunkApi.dispatch(
|
|
588
|
-
write({
|
|
589
|
-
data: mergedPublic,
|
|
672
|
+
}, authorName);
|
|
673
|
+
await agentRequest(server, state, "write", "POST", {
|
|
674
|
+
data: projection,
|
|
590
675
|
customKey: publicKey,
|
|
591
676
|
userId: effectiveUserId
|
|
592
|
-
})
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
677
|
+
});
|
|
678
|
+
} else if (!localOnly && Object.hasOwn(changes, "isPublic") && changes.isPublic === false) {
|
|
679
|
+
try {
|
|
680
|
+
await agentRequest(server, state, `delete/${encodeURIComponent(publicKey)}`, "DELETE");
|
|
681
|
+
} catch (error) {
|
|
682
|
+
if (!(error instanceof AgentUpdateError && error.status === 404)) throw error;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
} catch (error) {
|
|
686
|
+
throw new AgentUpdateError({
|
|
687
|
+
...agentUpdateFailure(error),
|
|
688
|
+
code: "public_sync_failed",
|
|
689
|
+
privateSaved: true,
|
|
690
|
+
agent: saved,
|
|
691
|
+
message: "\u79C1\u6709\u8BB0\u5F55\u5DF2\u4FDD\u5B58\uFF0C\u516C\u5171\u526F\u672C\u540C\u6B65\u5931\u8D25\uFF1B\u8BF7\u52FF\u91CD\u65B0\u63D0\u4EA4\u6574\u6B21\u7F16\u8F91"
|
|
692
|
+
});
|
|
596
693
|
}
|
|
694
|
+
return saved;
|
|
695
|
+
} catch (error) {
|
|
696
|
+
return thunkApi.rejectWithValue(agentUpdateFailure(error));
|
|
597
697
|
}
|
|
598
|
-
const base = previousAgent ?? {};
|
|
599
|
-
const mergedPrivate = {
|
|
600
|
-
...base,
|
|
601
|
-
...changes,
|
|
602
|
-
id: normalizedAgentId,
|
|
603
|
-
type: base.type || "agent" /* AGENT */,
|
|
604
|
-
userId: effectiveUserId
|
|
605
|
-
};
|
|
606
|
-
return mergedPrivate;
|
|
607
698
|
}
|
|
608
699
|
)
|
|
609
700
|
})
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
patch,
|
|
9
9
|
readAndWait
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OHYCQKPW.js";
|
|
11
11
|
import {
|
|
12
12
|
toErrorMessage
|
|
13
13
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -333,7 +333,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
333
333
|
).unwrap();
|
|
334
334
|
if (dbSpaceId) {
|
|
335
335
|
try {
|
|
336
|
-
const { updateContentTitle } = await import("./contentThunks-
|
|
336
|
+
const { updateContentTitle } = await import("./contentThunks-6BAKBO7Q.js");
|
|
337
337
|
await dispatch(
|
|
338
338
|
updateContentTitle({
|
|
339
339
|
spaceId: dbSpaceId,
|
|
@@ -372,7 +372,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
async function createDocState(args, thunkApi) {
|
|
375
|
-
const { createPageAction } = await import("./createPageAction-
|
|
375
|
+
const { createPageAction } = await import("./createPageAction-P5NL5NIZ.js");
|
|
376
376
|
return createPageAction(args, thunkApi);
|
|
377
377
|
}
|
|
378
378
|
function subscribe(listener) {
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-HS7MLR74.js";
|
|
4
4
|
import {
|
|
5
5
|
performServerProxyFetchWithRetry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OYZLT2BN.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchServerSyncedCredential
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S5DELBWY.js";
|
|
10
10
|
import {
|
|
11
11
|
buildSkillGuidancePromptBlock
|
|
12
12
|
} from "./chunk-5HAPEKNH.js";
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
deleteDialog,
|
|
8
8
|
runtime_default,
|
|
9
9
|
toast
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MGFRMNK5.js";
|
|
11
11
|
import {
|
|
12
12
|
UNCATEGORIZED_ID,
|
|
13
13
|
addContentAction,
|
|
14
14
|
checkSpaceMembership,
|
|
15
15
|
localSpaceAuthorityPatchStamp
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QAYCF4CH.js";
|
|
17
17
|
import {
|
|
18
18
|
createSpaceKey,
|
|
19
19
|
normalizeSpaceId
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
uploadFileAction,
|
|
33
33
|
upsertSSREntity,
|
|
34
34
|
write
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OHYCQKPW.js";
|
|
36
36
|
import {
|
|
37
37
|
resolveFileCategory
|
|
38
38
|
} from "./chunk-3PVYUPXK.js";
|
|
@@ -43,10 +43,10 @@ import {
|
|
|
43
43
|
resolveReplicationServers,
|
|
44
44
|
scheduleDeleteReplication,
|
|
45
45
|
scheduleWriteReplication
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-32GANJHJ.js";
|
|
47
47
|
import {
|
|
48
48
|
createAsyncThunk
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-X4F26D5K.js";
|
|
50
50
|
import {
|
|
51
51
|
getIsDesktopApp
|
|
52
52
|
} from "./chunk-6Q7UTJKR.js";
|
|
@@ -1497,11 +1497,11 @@ var ENTITY_DELETE_STRATEGIES = {
|
|
|
1497
1497
|
await dispatch(deleteTable({ dbKey: key })).unwrap();
|
|
1498
1498
|
},
|
|
1499
1499
|
file: async (key, { thunkAPI }) => {
|
|
1500
|
-
const { deleteFileAction } = await import("./deleteFile-
|
|
1500
|
+
const { deleteFileAction } = await import("./deleteFile-CE24BROO.js");
|
|
1501
1501
|
await deleteFileAction(key, thunkAPI);
|
|
1502
1502
|
},
|
|
1503
1503
|
image: async (key, { thunkAPI }) => {
|
|
1504
|
-
const { deleteFileAction } = await import("./deleteFile-
|
|
1504
|
+
const { deleteFileAction } = await import("./deleteFile-CE24BROO.js");
|
|
1505
1505
|
await deleteFileAction(key, thunkAPI);
|
|
1506
1506
|
},
|
|
1507
1507
|
agent: async (key, { dispatch, userId, sourceServerOrigin }) => {
|
|
@@ -206,7 +206,7 @@ async function readDocFunc(args, thunkApi) {
|
|
|
206
206
|
throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
|
|
207
207
|
}
|
|
208
208
|
try {
|
|
209
|
-
const { readAction } = await import("./read-
|
|
209
|
+
const { readAction } = await import("./read-ILTT75DW.js");
|
|
210
210
|
const pageData = await readAction({ dbKey: id }, thunkApi);
|
|
211
211
|
if (!pageData) {
|
|
212
212
|
throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4SEOTTFQ.js";
|
|
9
9
|
import {
|
|
10
10
|
CONFIRMATION_INPUT_KEYS,
|
|
11
11
|
INVALID_TOOL_ARGS_REPLACEMENT,
|
|
@@ -14,16 +14,16 @@ import {
|
|
|
14
14
|
performFetchRequest,
|
|
15
15
|
sanitizeOutboundMessages,
|
|
16
16
|
stripModelToolArgs
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UL57BAAE.js";
|
|
18
18
|
import {
|
|
19
19
|
findToolExecutor,
|
|
20
20
|
toolDefinitionsByName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-7MB72UW6.js";
|
|
22
22
|
import {
|
|
23
23
|
classifyApiError,
|
|
24
24
|
classifyGenerationError,
|
|
25
25
|
extractErrorDiagnostics
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OYZLT2BN.js";
|
|
27
27
|
import {
|
|
28
28
|
createSSEParser,
|
|
29
29
|
createToolRunId,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
toolRunSetPending,
|
|
33
33
|
toolRunStarted,
|
|
34
34
|
toolRunSucceeded
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-RYPJRIFF.js";
|
|
36
36
|
import {
|
|
37
37
|
getPublicImageAgentMode
|
|
38
38
|
} from "./chunk-VIDPVFP3.js";
|
|
@@ -45,10 +45,10 @@ import {
|
|
|
45
45
|
messageStreaming,
|
|
46
46
|
toolResultNeedsUserConfirmation,
|
|
47
47
|
updateToolMessage
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-MGFRMNK5.js";
|
|
49
49
|
import {
|
|
50
50
|
streamAgentChatTurn
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-S5DELBWY.js";
|
|
52
52
|
import {
|
|
53
53
|
addActiveController,
|
|
54
54
|
removeActiveController,
|
|
@@ -56,13 +56,13 @@ import {
|
|
|
56
56
|
} from "./chunk-OWYYDMGJ.js";
|
|
57
57
|
import {
|
|
58
58
|
selectCurrentServer
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-HWZT5DKX.js";
|
|
60
60
|
import {
|
|
61
61
|
write
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-OHYCQKPW.js";
|
|
63
63
|
import {
|
|
64
64
|
createAsyncThunk
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-X4F26D5K.js";
|
|
66
66
|
import {
|
|
67
67
|
selectIdentityToken
|
|
68
68
|
} from "./chunk-PXYBUFDB.js";
|
|
@@ -111,7 +111,7 @@ function createDaemonShortcutCommand(path, description, command) {
|
|
|
111
111
|
// packages/cli/agentInternalCommandEntries.ts
|
|
112
112
|
function getAgentInternalCommandEntries() {
|
|
113
113
|
const createAgentRunCommand = (path, description) => createContextCommand(path, description, async (args, ctx) => {
|
|
114
|
-
const { runAgentRunCommand } = await import("./agentRunCommand-
|
|
114
|
+
const { runAgentRunCommand } = await import("./agentRunCommand-7KO6SQPF.js");
|
|
115
115
|
return runAgentRunCommand(args, {
|
|
116
116
|
env: ctx.env,
|
|
117
117
|
scriptDir: ctx.scriptDir,
|
|
@@ -127,7 +127,7 @@ function getAgentInternalCommandEntries() {
|
|
|
127
127
|
return runAgentListCommand(args, deps);
|
|
128
128
|
}),
|
|
129
129
|
createEnvCommand(["agent", "create"], "Create a new agent", async (args, deps) => {
|
|
130
|
-
const { runAgentCreateCommand } = await import("./agentRecordCommands-
|
|
130
|
+
const { runAgentCreateCommand } = await import("./agentRecordCommands-RLHYIRGY.js");
|
|
131
131
|
return runAgentCreateCommand(args, deps);
|
|
132
132
|
}),
|
|
133
133
|
createEnvCommand(["agent", "models"], "List models: --preset <id> (server discovery, exit 1 on static fallback) or --url <base> --api-key <key> (OpenAI-compatible /models)", async (args, deps) => {
|
|
@@ -143,7 +143,7 @@ function getAgentInternalCommandEntries() {
|
|
|
143
143
|
return runAgentPullCommand(args, deps);
|
|
144
144
|
}),
|
|
145
145
|
createEnvCommand(["agent", "read"], "Read a single agent", async (args, deps) => {
|
|
146
|
-
const { runAgentReadCommand } = await import("./agentRecordCommands-
|
|
146
|
+
const { runAgentReadCommand } = await import("./agentRecordCommands-RLHYIRGY.js");
|
|
147
147
|
return runAgentReadCommand(args, deps);
|
|
148
148
|
}),
|
|
149
149
|
createAgentRunCommand(["agent", "run"], "Run an agent"),
|
|
@@ -172,31 +172,31 @@ function getAgentInternalCommandEntries() {
|
|
|
172
172
|
return runSetupOfflineMarxistsAgentCommand(args, deps);
|
|
173
173
|
}),
|
|
174
174
|
createEnvCommand(["agent", "update"], "Update agent fields", async (args, deps) => {
|
|
175
|
-
const { runAgentUpdateCommand } = await import("./agentRecordCommands-
|
|
175
|
+
const { runAgentUpdateCommand } = await import("./agentRecordCommands-RLHYIRGY.js");
|
|
176
176
|
return runAgentUpdateCommand(args, deps);
|
|
177
177
|
}),
|
|
178
178
|
createEnvCommand(["agent", "email", "provision"], "Provision a controlled inbox for an agent", async (args, deps) => {
|
|
179
|
-
const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-
|
|
179
|
+
const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-3T7NAJHR.js");
|
|
180
180
|
return runAgentEmailProvisionCommand(args, deps);
|
|
181
181
|
}),
|
|
182
182
|
createEnvCommand(["agent", "email", "bind"], "Bind an existing email address to an agent", async (args, deps) => {
|
|
183
|
-
const { runAgentEmailBindCommand } = await import("./agentEmailCommands-
|
|
183
|
+
const { runAgentEmailBindCommand } = await import("./agentEmailCommands-3T7NAJHR.js");
|
|
184
184
|
return runAgentEmailBindCommand(args, deps);
|
|
185
185
|
}),
|
|
186
186
|
createEnvCommand(["agent", "email", "transfer"], "Transfer an email identity from one agent to another (cross-account)", async (args, deps) => {
|
|
187
|
-
const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-
|
|
187
|
+
const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-3T7NAJHR.js");
|
|
188
188
|
return runAgentEmailTransferCommand(args, deps);
|
|
189
189
|
}),
|
|
190
190
|
createEnvCommand(
|
|
191
191
|
["agent", "email", "create-and-provision"],
|
|
192
192
|
"Create an agent and provision its controlled inbox",
|
|
193
193
|
async (args, deps) => {
|
|
194
|
-
const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-
|
|
194
|
+
const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-3T7NAJHR.js");
|
|
195
195
|
return runAgentEmailCreateAndProvisionCommand(args, deps);
|
|
196
196
|
}
|
|
197
197
|
),
|
|
198
198
|
createEnvCommand(["agent", "delete"], "Hard-delete an agent's private and public records", async (args, deps) => {
|
|
199
|
-
const { runAgentDeleteCommand } = await import("./agentDeleteCommand-
|
|
199
|
+
const { runAgentDeleteCommand } = await import("./agentDeleteCommand-EXBU3PZJ.js");
|
|
200
200
|
return runAgentDeleteCommand(args, deps);
|
|
201
201
|
}),
|
|
202
202
|
createEnvCommand(["agent", "grant"], "Grant another user access to this agent's owner credentials", async (args, deps) => {
|
|
@@ -216,15 +216,15 @@ function getAgentInternalCommandEntries() {
|
|
|
216
216
|
return runAgentRevokeGrantCommand(args, deps);
|
|
217
217
|
}),
|
|
218
218
|
createEnvCommand(["agent", "bind-current"], "Bind an agent to this machine", async (args, deps) => {
|
|
219
|
-
const { runAgentBindCurrentCommand } = await import("./agentMachineCommands-
|
|
219
|
+
const { runAgentBindCurrentCommand } = await import("./agentMachineCommands-JXXDCTG5.js");
|
|
220
220
|
return runAgentBindCurrentCommand(args, deps);
|
|
221
221
|
}),
|
|
222
222
|
createEnvCommand(["agent", "smoke-current"], "Smoke test a bound agent through this machine", async (args, deps) => {
|
|
223
|
-
const { runAgentSmokeCurrentCommand } = await import("./agentMachineCommands-
|
|
223
|
+
const { runAgentSmokeCurrentCommand } = await import("./agentMachineCommands-JXXDCTG5.js");
|
|
224
224
|
return runAgentSmokeCurrentCommand(args, deps);
|
|
225
225
|
}),
|
|
226
226
|
createEnvCommand(["agent", "runtime-doctor"], "Diagnose current machine runtime compatibility", async (args, deps) => {
|
|
227
|
-
const { runAgentRuntimeDoctorCommand } = await import("./agentMachineCommands-
|
|
227
|
+
const { runAgentRuntimeDoctorCommand } = await import("./agentMachineCommands-JXXDCTG5.js");
|
|
228
228
|
return runAgentRuntimeDoctorCommand(args, deps);
|
|
229
229
|
}),
|
|
230
230
|
createAgentRunCommand(["agent", "chat"], "Chat with an agent")
|
|
@@ -547,15 +547,15 @@ function getSystemInternalCommandEntries(renderHelpText2) {
|
|
|
547
547
|
return runWhoamiCommand({ args, env: ctx.env });
|
|
548
548
|
}),
|
|
549
549
|
createEntrypointEnvCommand(["connect"], "Send machine heartbeats or hold a connector websocket", async (args, deps) => {
|
|
550
|
-
const { runMachineConnectCommand } = await import("./machineCommands-
|
|
550
|
+
const { runMachineConnectCommand } = await import("./machineCommands-NA7OPUFC.js");
|
|
551
551
|
return runMachineConnectCommand(args, deps);
|
|
552
552
|
}),
|
|
553
553
|
createDaemonShortcutCommand(["daemon"], "Run the connector daemon shortcut", async (args, deps) => {
|
|
554
|
-
const { runMachineConnectCommand } = await import("./machineCommands-
|
|
554
|
+
const { runMachineConnectCommand } = await import("./machineCommands-NA7OPUFC.js");
|
|
555
555
|
return runMachineConnectCommand(args, deps);
|
|
556
556
|
}),
|
|
557
557
|
createEnvCommand(["machine", "status"], "List machines registered to the current profile", async (args, deps) => {
|
|
558
|
-
const { runMachineStatusCommand } = await import("./machineCommands-
|
|
558
|
+
const { runMachineStatusCommand } = await import("./machineCommands-NA7OPUFC.js");
|
|
559
559
|
return runMachineStatusCommand(args, deps);
|
|
560
560
|
}),
|
|
561
561
|
createEnvCommand(["doctor", "runtime"], "Diagnose local-first agent runtime selection", async (args, deps) => {
|