nolo-cli 0.11.0 → 0.12.0-alpha.10

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.
Files changed (123) hide show
  1. package/{_executeModel-ZEDPX6OF.js → _executeModel-4F7VZR5U.js} +52 -50
  2. package/{action-AA4IJ5K2.js → action-OTOWUMPW.js} +8 -9
  3. package/{addContentAction-QYVO4SYP.js → addContentAction-JGBUVR7K.js} +7 -9
  4. package/{addDialogAgentAction-WVVKT5WQ.js → addDialogAgentAction-V6CL2UCF.js} +9 -10
  5. package/{agentDeleteCommand-RDPGYIWF.js → agentDeleteCommand-MMRSG6AB.js} +39 -28
  6. package/{agentEmailCommands-2HJJKS5F.js → agentEmailCommands-YFVKOGM7.js} +65 -62
  7. package/{agentListCommands-HFEVV3ZW.js → agentListCommands-2PZHIQ3I.js} +128 -31
  8. package/{agentMachineCommands-25ZOENJU.js → agentMachineCommands-55UUZNHF.js} +38 -26
  9. package/{agentPullCommand-GOL2S4W2.js → agentPullCommand-KRBRIFIY.js} +7 -7
  10. package/{agentRecordCommands-GTCOAM3L.js → agentRecordCommands-BTP3OAPL.js} +57 -54
  11. package/{agentRunCommand-YBS3JDLD.js → agentRunCommand-AA4QLRQZ.js} +60 -59
  12. package/{agentRunControl-K4VKNEHF.js → agentRunControl-IX4F5W2C.js} +3 -3
  13. package/{agentRuntimeLocal-UQBMQI2M.js → agentRuntimeLocal-QDJCBXM2.js} +31 -15
  14. package/{agentSlice-6EKOBCCS.js → agentSlice-6JAJOU3X.js} +8 -9
  15. package/{authCommand-O2OWACN4.js → authCommand-DMW336GT.js} +15 -15
  16. package/{authCommands-H7365TZP.js → authCommands-GH5T6RYV.js} +6 -6
  17. package/{chunk-E4HNJSHC.js → chunk-2BVGERJ2.js} +81 -19
  18. package/{chunk-LP65VRCI.js → chunk-3MI5LDDU.js} +6 -6
  19. package/{chunk-OPZYGHUC.js → chunk-3WGLLTK4.js} +59 -1
  20. package/{chunk-KJR5KAUQ.js → chunk-3XF6LCCN.js} +20 -7
  21. package/{chunk-PXZAAB4L.js → chunk-4LG74DRG.js} +4 -4
  22. package/{chunk-2FTTDCD4.js → chunk-4ON5AV72.js} +2 -1
  23. package/{chunk-IWX4UW2E.js → chunk-524BDL33.js} +89 -8
  24. package/{chunk-ISNCLGUZ.js → chunk-5NBHQD4D.js} +4 -3
  25. package/{chunk-ZPRK73XY.js → chunk-5S4SWV5G.js} +51 -38
  26. package/{chunk-EVZKZF32.js → chunk-5V524MHX.js} +195 -78
  27. package/{chunk-CKOJQDKR.js → chunk-7JJCGV7N.js} +146 -3
  28. package/{chunk-NEM67FX7.js → chunk-ARSC56DC.js} +1 -1
  29. package/{chunk-AFON4QUU.js → chunk-AS3ZQ3O2.js} +19 -28
  30. package/{chunk-4SOKXIW4.js → chunk-B4KT7RN2.js} +10 -13
  31. package/chunk-BYXBJQAS.js +0 -0
  32. package/{chunk-PXQN7IBQ.js → chunk-C3BFP57W.js} +95 -2
  33. package/{chunk-AEZAORLG.js → chunk-CGDQDXKZ.js} +5 -5
  34. package/{chunk-MQI77IRB.js → chunk-DPFWKRHG.js} +2 -2
  35. package/{chunk-TACHTH5D.js → chunk-EIMX5ER5.js} +18 -18
  36. package/{chunk-5MOUAAMK.js → chunk-FSUZIGIG.js} +197 -2578
  37. package/{chunk-FXXSGWAJ.js → chunk-H5Y2H2N6.js} +1 -1
  38. package/chunk-IKXL2HZ3.js +70 -0
  39. package/{chunk-QNMFBBZK.js → chunk-IVAOVLM7.js} +1 -1
  40. package/chunk-JFANOO7I.js +2274 -0
  41. package/{chunk-YPRZSPF3.js → chunk-JKWWVF2I.js} +1 -1
  42. package/{chunk-3NSIQZZ6.js → chunk-JU7J7EAV.js} +45 -45
  43. package/{chunk-X2S7JTIG.js → chunk-KWBH4RAL.js} +1280 -137
  44. package/{chunk-OUI3ZHYD.js → chunk-LUKQQJFL.js} +39 -2
  45. package/{chunk-BX6U3ETE.js → chunk-MG6BVV3T.js} +320 -102
  46. package/{chunk-L53FGHA4.js → chunk-MQRZ5QUH.js} +1 -1
  47. package/{chunk-2W2VYVI5.js → chunk-MZHSAPZP.js} +675 -177
  48. package/{chunk-YOCHZD7D.js → chunk-NCGFB7NN.js} +5 -3
  49. package/{chunk-DWGAEFJL.js → chunk-O4FOPRCP.js} +1 -1
  50. package/chunk-OGGHETUE.js +4900 -0
  51. package/{chunk-PNEW2Z3T.js → chunk-OHEKYYJF.js} +7 -7
  52. package/chunk-OOIN7HSO.js +146 -0
  53. package/{chunk-SV5MWASH.js → chunk-OPM2DE2J.js} +12 -12
  54. package/{chunk-5OIFWVX7.js → chunk-QJSTNKJY.js} +1 -1
  55. package/{chunk-C4FTUXVF.js → chunk-QLUFR47U.js} +11 -1
  56. package/{chunk-LAX2JSTX.js → chunk-QUHUVG6Y.js} +20 -2
  57. package/{chunk-D6OQHXVG.js → chunk-RQSOAMPJ.js} +22 -6
  58. package/{chunk-ZEYDOXHF.js → chunk-RUGEW4P7.js} +1515 -884
  59. package/{chunk-GBDSZATH.js → chunk-RWO5DGXI.js} +3 -3
  60. package/{chunk-S3GS2PRL.js → chunk-TA7VKOHU.js} +613 -70
  61. package/{chunk-XYZA7S7V.js → chunk-TQYYGE6G.js} +6 -6
  62. package/{chunk-YTBMA7NO.js → chunk-TYPHUVK5.js} +70 -8
  63. package/{chunk-4ZDM73SD.js → chunk-V2J635L5.js} +1 -1
  64. package/{chunk-C2MDQQ4O.js → chunk-VBSWHE5W.js} +1 -1
  65. package/{chunk-O26GI2JP.js → chunk-VKG4HXYV.js} +39 -8
  66. package/{chunk-IPYUUY4E.js → chunk-WPHL6ALY.js} +1 -1
  67. package/{chunk-7D3JY6C2.js → chunk-WVTBAALN.js} +64 -5
  68. package/{chunk-XFOLQLDN.js → chunk-XHQWJUW4.js} +2 -2
  69. package/{chunk-Q3UKJVU4.js → chunk-Y5P3ZRGC.js} +10 -10
  70. package/{chunk-KQQVGRA3.js → chunk-YUMYYXPI.js} +53 -183
  71. package/cliEnvHelpers-VYC2OPTB.js +30 -0
  72. package/{createAgentAutomationAction-LTI5QU35.js → createAgentAutomationAction-4NY4JLOK.js} +26 -26
  73. package/{createDialogAction-OJJ7L3L3.js → createDialogAction-I5WUWFJ6.js} +26 -26
  74. package/{createPageAction-5MXWVRGY.js → createPageAction-HFTIQ7TW.js} +26 -26
  75. package/{dbSlice-RQFQQVHT.js → dbSlice-J4PUZ6Y5.js} +6 -7
  76. package/{deleteFile-7XP5BGC7.js → deleteFile-M7UNIUOO.js} +4 -4
  77. package/{dialogCommands-JTJ3RPPW.js → dialogCommands-SVXRJFZS.js} +34 -23
  78. package/{dialogSlice-OWROKURJ.js → dialogSlice-35LA3ZRG.js} +26 -26
  79. package/{docCreateCommands-WJBEW2V7.js → docCreateCommands-Z7RIAYKQ.js} +34 -23
  80. package/{docDeleteCommands-BVEHJOY5.js → docDeleteCommands-NEYHUVZF.js} +35 -25
  81. package/{docReadCommands-NEWOZIJV.js → docReadCommands-I4US2SDE.js} +34 -23
  82. package/{docStore-3DXRYBMD.js → docStore-3CP2IO6M.js} +25 -25
  83. package/{docUpdateCommands-C7WHT7UU.js → docUpdateCommands-UU5HQBRP.js} +34 -23
  84. package/fetchMessages-KTNM7QAR.js +1 -1
  85. package/{getPricing-3E6UNPKL.js → getPricing-UGDJHI7M.js} +7 -3
  86. package/{handleSendMessageAction-B5PRR7BE.js → handleSendMessageAction-FWTLQGOZ.js} +30 -30
  87. package/index.js +77 -76
  88. package/{localDialogRead-YSKFFRTT.js → localDialogRead-2VRI24F4.js} +1 -1
  89. package/{machineCommands-IIIREAEK.js → machineCommands-STHZKBDJ.js} +64 -61
  90. package/{machineWsRunDispatch-3SIU6ILW.js → machineWsRunDispatch-7YHT4TPT.js} +56 -53
  91. package/{memoryCommands-O4MIPIWQ.js → memoryCommands-AFMES3LN.js} +5 -5
  92. package/{models-4OPOOLFS.js → models-LSCRJJ6P.js} +2 -2
  93. package/package.json +1 -1
  94. package/{read-QJNKRROM.js → read-2MIMRBZ2.js} +4 -4
  95. package/{readDocTool-H6X6KO6X.js → readDocTool-QHVGQHUJ.js} +1 -1
  96. package/{readlineWorkspace-HGP3I3OC.js → readlineWorkspace-OMRWYMB6.js} +1279 -716
  97. package/{removeDialogAgentAction-TCT35SOF.js → removeDialogAgentAction-XUZYQBV4.js} +13 -13
  98. package/{runAgentClientLoop-EFM4PTVI.js → runAgentClientLoop-FP2K33ZO.js} +47 -46
  99. package/{runtimeDoctorCommands-ID43Z7VX.js → runtimeDoctorCommands-QNF3J3UV.js} +6 -6
  100. package/{setDialogExtraReferencesAction-CGYLZMFH.js → setDialogExtraReferencesAction-PTAIFKGM.js} +9 -10
  101. package/{setPrimaryDialogAgentAction-F6BFQDJU.js → setPrimaryDialogAgentAction-HRFTDB44.js} +13 -13
  102. package/{settingSlice-2I5HMG47.js → settingSlice-VGRJUSE5.js} +7 -8
  103. package/{skillDiscovery-UGSQGX2U.js → skillDiscovery-6M2BZUFN.js} +3 -3
  104. package/{spaceCommands-MT7BWCIL.js → spaceCommands-GN73BCOB.js} +38 -29
  105. package/{spaceSlice-BS5TSW3W.js → spaceSlice-WTFNKOVA.js} +30 -26
  106. package/{streamAgentChatTurn-I3VBFNR3.js → streamAgentChatTurn-HBAQQVNK.js} +442 -130
  107. package/{toolApiClient-C7P7YSE4.js → toolApiClient-QI3YBNWB.js} +2 -2
  108. package/{tools-XSD2BOEN.js → tools-TPQYTLQZ.js} +34 -33
  109. package/{tuiSummaryLlmCaller-32NRHTT2.js → tuiSummaryLlmCaller-XDC7WG4K.js} +11 -7
  110. package/{updateCommands-VOSPKXFF.js → updateCommands-XZDOOYFH.js} +13 -5
  111. package/{updateDialogTitleAction-7FYNJOGP.js → updateDialogTitleAction-AWXNPUQJ.js} +30 -29
  112. package/chunk-AZPCASRE.js +0 -36
  113. package/chunk-BBYVOSU2.js +0 -792
  114. package/chunk-DCOA4QSN.js +0 -105
  115. package/chunk-UAD2WT54.js +0 -64
  116. package/{chunk-JK7VW2FN.js → chunk-5MIDPSSK.js} +3 -3
  117. package/{chunk-5CS33IBL.js → chunk-PDL2AV3E.js} +3 -3
  118. package/{chunk-5MMZUWSG.js → chunk-TOILAPLH.js} +5 -5
  119. package/{chunk-OOM6SJNR.js → chunk-TSUJOM6N.js} +6 -6
  120. package/{db-6QED3ZVO.js → db-HCJ5PRB5.js} +3 -3
  121. package/{offlineMarxistsAgentCommand-BCPJITJL.js → offlineMarxistsAgentCommand-5OOWZLJI.js} +3 -3
  122. package/{tableCommands-M3DJUETS.js → tableCommands-E4SQWDOX.js} +6 -6
  123. package/{understanding-ZOESBLF3.js → understanding-3CUQQ6SV.js} +3 -3
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  resolveMachineId
3
3
  } from "./chunk-6HYVJV7B.js";
4
+ import {
5
+ getDefaultCliLocalRuntimeDb
6
+ } from "./chunk-H33743XH.js";
4
7
  import {
5
8
  buildCliRuntimeEnv,
6
9
  clearProfileAuthToken,
@@ -18,18 +21,15 @@ import {
18
21
  import {
19
22
  asTrimmedNonEmptyStringArray
20
23
  } from "./chunk-I42VC5KR.js";
24
+ import {
25
+ asTrimmedString
26
+ } from "./chunk-3EUW3WEO.js";
21
27
  import {
22
28
  resolveAuthTokenFromEnv
23
- } from "./chunk-ISNCLGUZ.js";
29
+ } from "./chunk-5NBHQD4D.js";
24
30
  import {
25
31
  DEFAULT_NOLO_SERVER_URL
26
32
  } from "./chunk-OLZBQWZU.js";
27
- import {
28
- getDefaultCliLocalRuntimeDb
29
- } from "./chunk-H33743XH.js";
30
- import {
31
- asTrimmedString
32
- } from "./chunk-3EUW3WEO.js";
33
33
  import {
34
34
  normalizeServerOrigin
35
35
  } from "./chunk-CF7PE763.js";
@@ -0,0 +1,146 @@
1
+ import {
2
+ getModelAbility
3
+ } from "./chunk-IKXL2HZ3.js";
4
+
5
+ // packages/ai/agent/safeAgentSummary.ts
6
+ function parseTimestamp(val) {
7
+ if (typeof val === "number" && Number.isFinite(val)) return val;
8
+ if (typeof val === "string") return Date.parse(val) || 0;
9
+ return 0;
10
+ }
11
+ function safeTimestamp(val) {
12
+ if (typeof val === "number" && Number.isFinite(val)) return val;
13
+ if (typeof val === "string") return val;
14
+ return null;
15
+ }
16
+ function parseAgentRecordId(privateKey, explicitId) {
17
+ if (explicitId && typeof explicitId === "string" && explicitId.trim()) {
18
+ return explicitId.trim();
19
+ }
20
+ if (privateKey && typeof privateKey === "string") {
21
+ const match = privateKey.match(/^agent-[^-]+-(.+)$/i);
22
+ if (match?.[1]) return match[1];
23
+ }
24
+ return null;
25
+ }
26
+ function resolveFavoriteStatus(record, options) {
27
+ if (options?.isFavorite !== void 0) {
28
+ return {
29
+ isFavorite: !!options.isFavorite,
30
+ favoritedAt: safeTimestamp(options.favoritedAt)
31
+ };
32
+ }
33
+ if (record?.isFavorite === true) {
34
+ return {
35
+ isFavorite: true,
36
+ favoritedAt: safeTimestamp(record?.favoritedAt)
37
+ };
38
+ }
39
+ const favoritesMap = options?.favoritesMap;
40
+ if (!favoritesMap) {
41
+ return { isFavorite: false, favoritedAt: null };
42
+ }
43
+ const candidateKeys = [];
44
+ if (typeof record?.dbKey === "string" && record.dbKey) candidateKeys.push(record.dbKey);
45
+ if (typeof record?.privateKey === "string" && record.privateKey) candidateKeys.push(record.privateKey);
46
+ if (typeof record?.publicKey === "string" && record.publicKey) candidateKeys.push(record.publicKey);
47
+ if (typeof record?.id === "string" && record.id) {
48
+ candidateKeys.push(record.id);
49
+ candidateKeys.push(`agent-pub-${record.id}`);
50
+ if (options?.userId) {
51
+ candidateKeys.push(`agent-${options.userId}-${record.id}`);
52
+ }
53
+ }
54
+ let matched = false;
55
+ let highestFavAt = null;
56
+ let highestFavTime = -1;
57
+ for (const key of candidateKeys) {
58
+ const val = favoritesMap instanceof Map ? favoritesMap.get(key) : favoritesMap[key];
59
+ if (val !== void 0 && val !== false && val !== null) {
60
+ const favAt = val === true ? 1 : safeTimestamp(val);
61
+ if (favAt === null) continue;
62
+ matched = true;
63
+ const time = parseTimestamp(favAt);
64
+ if (time > highestFavTime) {
65
+ highestFavTime = time;
66
+ highestFavAt = favAt;
67
+ }
68
+ }
69
+ }
70
+ if (matched) {
71
+ return {
72
+ isFavorite: true,
73
+ favoritedAt: highestFavAt ?? 1
74
+ };
75
+ }
76
+ return { isFavorite: false, favoritedAt: null };
77
+ }
78
+ function toSafeAgentSummary(record, options) {
79
+ const rawId = parseAgentRecordId(
80
+ typeof record?.privateKey === "string" ? record.privateKey : record?.dbKey,
81
+ typeof record?.id === "string" ? record.id : void 0
82
+ );
83
+ const id = rawId ?? (typeof record?.id === "string" ? record.id : null);
84
+ const publicRecordDenied = record?.publicRecordExists === false || options?.publicRecordExists === false;
85
+ const publicRecordConfirmed = record?.publicRecordExists === true || options?.publicRecordExists === true;
86
+ let publicKey;
87
+ if (typeof record?.publicKey === "string" && record.publicKey && !publicRecordDenied) {
88
+ publicKey = record.publicKey;
89
+ } else if (publicRecordConfirmed && id) {
90
+ publicKey = `agent-pub-${id}`;
91
+ }
92
+ const name = typeof record?.name === "string" && record.name ? record.name : "(unnamed)";
93
+ const handle = typeof record?.handle === "string" && record.handle ? record.handle : null;
94
+ const introduction = typeof record?.introduction === "string" && record.introduction ? record.introduction : typeof record?.description === "string" && record.description ? record.description : null;
95
+ const model = typeof record?.model === "string" && record.model ? record.model : null;
96
+ const provider = typeof record?.provider === "string" && record.provider ? record.provider : typeof record?.apiSource === "string" && record.apiSource ? record.apiSource : null;
97
+ const apiSource = typeof record?.apiSource === "string" && record.apiSource ? record.apiSource : null;
98
+ const cliProvider = typeof record?.cliProvider === "string" && record.cliProvider ? record.cliProvider : null;
99
+ const tools = Array.isArray(record?.tools) ? record.tools.filter((t) => typeof t === "string") : [];
100
+ const inputPrice = typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? record.inputPrice : null;
101
+ const outputPrice = typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? record.outputPrice : null;
102
+ const modelAbility = model ? getModelAbility(model) ?? null : null;
103
+ const favStatus = resolveFavoriteStatus(record, options);
104
+ const isPublic = record?.isPublic === true || record?.isPublicFlag === true || record?.publicRecordExists === true;
105
+ const updatedAt = safeTimestamp(record?.updatedAt ?? record?.createdAt ?? record?.created);
106
+ return {
107
+ id,
108
+ ...publicKey !== void 0 ? { publicKey } : {},
109
+ name,
110
+ handle,
111
+ introduction,
112
+ model,
113
+ provider,
114
+ apiSource,
115
+ cliProvider,
116
+ tools,
117
+ inputPrice,
118
+ outputPrice,
119
+ modelAbility,
120
+ isFavorite: favStatus.isFavorite,
121
+ favoritedAt: favStatus.favoritedAt,
122
+ isPublic,
123
+ updatedAt
124
+ };
125
+ }
126
+ function sortSafeAgentSummaries(agents) {
127
+ return [...agents].sort((left, right) => {
128
+ const leftFav = left.isFavorite === true;
129
+ const rightFav = right.isFavorite === true;
130
+ if (leftFav && !rightFav) return -1;
131
+ if (!leftFav && rightFav) return 1;
132
+ if (leftFav && rightFav) {
133
+ const leftFavAt = parseTimestamp(left.favoritedAt);
134
+ const rightFavAt = parseTimestamp(right.favoritedAt);
135
+ if (leftFavAt !== rightFavAt) return rightFavAt - leftFavAt;
136
+ }
137
+ const leftUpdated = parseTimestamp(left.updatedAt ?? left.createdAt);
138
+ const rightUpdated = parseTimestamp(right.updatedAt ?? right.createdAt);
139
+ return rightUpdated - leftUpdated;
140
+ });
141
+ }
142
+
143
+ export {
144
+ toSafeAgentSummary,
145
+ sortSafeAgentSummaries
146
+ };
@@ -7,11 +7,14 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-DWGAEFJL.js";
10
+ } from "./chunk-O4FOPRCP.js";
11
11
  import {
12
12
  buildDialogAttachmentPlan,
13
13
  extractFileContentIds
14
14
  } from "./chunk-MTU75CZ2.js";
15
+ import {
16
+ toErrorMessage
17
+ } from "./chunk-HNMXYYJR.js";
15
18
  import {
16
19
  parsePositiveFiniteNumberOrFallback
17
20
  } from "./chunk-Y5GCAMGP.js";
@@ -22,6 +25,12 @@ import {
22
25
  asNonEmptyStringArray,
23
26
  asTrimmedNonEmptyStringArray
24
27
  } from "./chunk-I42VC5KR.js";
28
+ import {
29
+ isRecord
30
+ } from "./chunk-KUG52IAP.js";
31
+ import {
32
+ asTrimmedString
33
+ } from "./chunk-3EUW3WEO.js";
25
34
  import {
26
35
  parseUserIdFromAuthToken,
27
36
  readOption,
@@ -29,16 +38,7 @@ import {
29
38
  resolveDeleteServerCandidates,
30
39
  resolveServerCandidates,
31
40
  resolveServerUrl
32
- } from "./chunk-ISNCLGUZ.js";
33
- import {
34
- toErrorMessage
35
- } from "./chunk-HNMXYYJR.js";
36
- import {
37
- asTrimmedString
38
- } from "./chunk-3EUW3WEO.js";
39
- import {
40
- isRecord
41
- } from "./chunk-KUG52IAP.js";
41
+ } from "./chunk-5NBHQD4D.js";
42
42
  import {
43
43
  asOptionalTrimmedString
44
44
  } from "./chunk-G3SUCT4W.js";
@@ -625,7 +625,7 @@ async function tryHttpDialogCandidates(args) {
625
625
  throw Object.assign(new Error("All HTTP dialog reads failed"), { attempts });
626
626
  }
627
627
  async function readDialogFromLocalDb(dialogKey, dialogId, limit) {
628
- const { readDialogFromLocalDb: readLocalDialog } = await import("./localDialogRead-YSKFFRTT.js");
628
+ const { readDialogFromLocalDb: readLocalDialog } = await import("./localDialogRead-2VRI24F4.js");
629
629
  const result = await readLocalDialog({ dialogKey, dialogId, limit });
630
630
  return {
631
631
  ...result,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_AGENT_BASE_POLICY,
3
3
  DEFAULT_USER_PREFERENCE_PROFILE
4
- } from "./chunk-3NSIQZZ6.js";
4
+ } from "./chunk-JU7J7EAV.js";
5
5
 
6
6
  // packages/ai/policy/runtimePolicy.ts
7
7
  var clampLevel = (value, fallback) => {
@@ -1,5 +1,6 @@
1
1
  import {
2
- MEMORY_USE_GUIDANCE
2
+ MEMORY_USE_GUIDANCE,
3
+ wrapHistoricalSummaryWithReplayGuard
3
4
  } from "./chunk-KKY4B2Q2.js";
4
5
 
5
6
  // packages/agent-runtime/turnContext.ts
@@ -122,6 +123,14 @@ var buildLinkedSpacesSection = async (args) => {
122
123
  "\u63D0\u793A\uFF1A\u5982\u9700\u67E5\u8BE2\u8FD9\u4E9B\u7A7A\u95F4\u7684\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u53EF\u4F7F\u7528 read \u5DE5\u5177\u914D\u5408\u5BF9\u5E94\u7684 dbKey\u3002"
123
124
  ].join("\n");
124
125
  };
126
+ var buildDialogSummaryLayer = (args) => {
127
+ const historical = wrapHistoricalSummaryWithReplayGuard(
128
+ asTrimmed(args.summary)
129
+ );
130
+ if (!historical) return null;
131
+ return makeLayer("dialog-summary", `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
132
+ ${historical}`);
133
+ };
125
134
  var buildMemoryOverlayLayer = (args) => {
126
135
  const promptBlock = asTrimmed(args.promptBlock);
127
136
  if (!promptBlock) return null;
@@ -141,6 +150,7 @@ export {
141
150
  buildSpaceContextLayer,
142
151
  buildSkillDiscoveryLayer,
143
152
  buildLinkedSpacesSection,
153
+ buildDialogSummaryLayer,
144
154
  buildMemoryOverlayLayer,
145
155
  buildMemoryUseGuidanceLayer
146
156
  };
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-DWGAEFJL.js";
4
+ } from "./chunk-O4FOPRCP.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-AEZAORLG.js";
7
+ } from "./chunk-CGDQDXKZ.js";
8
+ import {
9
+ toSafeAgentSummary
10
+ } from "./chunk-OOIN7HSO.js";
8
11
 
9
12
  // packages/cli/agentListHelpers.ts
10
13
  function parseAgentRecordId(privateKey, explicitId) {
@@ -34,6 +37,11 @@ function normalizeListedAgent(record) {
34
37
  publicKey: keys.publicKey,
35
38
  name: typeof record?.name === "string" && record.name ? record.name : "(unnamed)",
36
39
  model: typeof record?.model === "string" && record.model ? record.model : "-",
40
+ ...typeof record?.handle === "string" && record.handle ? { handle: record.handle } : {},
41
+ ...typeof record?.introduction === "string" && record.introduction ? { introduction: record.introduction } : typeof record?.description === "string" && record.description ? { introduction: record.description } : {},
42
+ ...typeof record?.provider === "string" && record.provider ? { provider: record.provider } : {},
43
+ ...typeof record?.inputPrice === "number" && Number.isFinite(record.inputPrice) ? { inputPrice: record.inputPrice } : {},
44
+ ...typeof record?.outputPrice === "number" && Number.isFinite(record.outputPrice) ? { outputPrice: record.outputPrice } : {},
37
45
  updatedAt: typeof record?.updatedAt === "string" || typeof record?.updatedAt === "number" ? record.updatedAt : typeof record?.createdAt === "string" || typeof record?.createdAt === "number" ? record.createdAt : typeof record?.created === "string" || typeof record?.created === "number" ? record.created : null,
38
46
  isPublicFlag: !!record?.isPublic,
39
47
  publicRecordExists: false,
@@ -46,6 +54,13 @@ function normalizeListedAgent(record) {
46
54
  ...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {}
47
55
  };
48
56
  }
57
+ function toSafeListedAgentSummary(agent, options) {
58
+ const summary = toSafeAgentSummary(agent, options);
59
+ if (agent.publicRecordExists === false) {
60
+ delete summary.publicKey;
61
+ }
62
+ return summary;
63
+ }
49
64
  function sortListedAgents(agents) {
50
65
  agents.sort((a, b) => {
51
66
  const ta = a.updatedAt == null ? 0 : new Date(a.updatedAt).getTime();
@@ -57,6 +72,7 @@ function sortListedAgents(agents) {
57
72
  function parseAgentListArgs(args) {
58
73
  return {
59
74
  wantJson: args.includes("--json"),
75
+ wantSafe: args.includes("--safe"),
60
76
  publicOnly: args.includes("--public-only"),
61
77
  idsOnly: args.includes("--ids-only")
62
78
  };
@@ -182,6 +198,8 @@ async function decorateAgentsWithPublicStatusAcrossServers(args) {
182
198
  }
183
199
 
184
200
  export {
201
+ normalizeListedAgent,
202
+ toSafeListedAgentSummary,
185
203
  parseAgentListArgs,
186
204
  listLocalCachedAgents,
187
205
  listRemoteAgents,
@@ -1,9 +1,17 @@
1
1
  // packages/core/drainReason.ts
2
2
  var CORE_DRAIN_REASON = "core_draining";
3
-
4
- // packages/core/gatewayHttpStatus.ts
5
- function isGatewayHttpStatus(status) {
6
- return status === 502 || status === 503 || status === 504;
3
+ var DRAIN_EXHAUSTED_USER_MESSAGE = "\u670D\u52A1\u6B63\u5728\u91CD\u542F\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5";
4
+ function isCoreDrainingBody(body) {
5
+ return typeof body === "object" && body !== null && body.reason === CORE_DRAIN_REASON;
6
+ }
7
+ function createDrainExhaustedResponse(original) {
8
+ const retryAfter = original.headers.get("Retry-After");
9
+ const headers = { "Content-Type": "text/plain; charset=utf-8" };
10
+ if (retryAfter) headers["Retry-After"] = retryAfter;
11
+ return new Response(DRAIN_EXHAUSTED_USER_MESSAGE, {
12
+ status: 503,
13
+ headers
14
+ });
7
15
  }
8
16
 
9
17
  // packages/core/retryAfterMs.ts
@@ -26,9 +34,17 @@ function parseRetryAfterHeaderMs(value, nowMs = Date.now()) {
26
34
  return null;
27
35
  }
28
36
 
37
+ // packages/core/gatewayHttpStatus.ts
38
+ function isGatewayHttpStatus(status) {
39
+ return status === 502 || status === 503 || status === 504;
40
+ }
41
+
29
42
  export {
30
43
  CORE_DRAIN_REASON,
31
- isGatewayHttpStatus,
44
+ DRAIN_EXHAUSTED_USER_MESSAGE,
45
+ isCoreDrainingBody,
46
+ createDrainExhaustedResponse,
32
47
  normalizeNonNegativeMs,
33
- parseRetryAfterHeaderMs
48
+ parseRetryAfterHeaderMs,
49
+ isGatewayHttpStatus
34
50
  };