nolo-cli 0.29.2 → 0.30.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 (138) hide show
  1. package/{_executeModel-BFVTGZXE.js → _executeModel-5ARVVUIK.js} +64 -69
  2. package/{action-LG32A6DJ.js → action-HI3VRQLP.js} +15 -16
  3. package/{addContentAction-MPGMBJTQ.js → addContentAction-NCURJ6PK.js} +13 -13
  4. package/{addDialogAgentAction-ZH23WDID.js → addDialogAgentAction-RCY4ECF4.js} +12 -12
  5. package/{agentDeleteCommand-4S4STG42.js → agentDeleteCommand-5Q6TDCJU.js} +62 -40
  6. package/{agentEmailCommands-3F4IP4DI.js → agentEmailCommands-DSX4BJ2I.js} +77 -81
  7. package/{agentGrantCommands-JNDE4RWR.js → agentGrantCommands-E7ZZFRHK.js} +2 -1
  8. package/{agentListCommands-JCRV2XF6.js → agentListCommands-S66HL5RO.js} +59 -41
  9. package/{agentMachineCommands-KYXPYSFP.js → agentMachineCommands-ULCQ5ZNN.js} +55 -36
  10. package/{agentPullCommand-ZZGU5KOY.js → agentPullCommand-4V36XNGV.js} +4 -3
  11. package/{agentRecordCommands-UADUPIXO.js → agentRecordCommands-2AA3GEGO.js} +75 -79
  12. package/{agentRunCommand-MJWSR53W.js → agentRunCommand-3KOT77XY.js} +79 -83
  13. package/{agentRunControl-SNUKXN6J.js → agentRunControl-AKBN2366.js} +13 -1
  14. package/{agentRuntimeLocal-PC5RRRPT.js → agentRuntimeLocal-7TMDJD4S.js} +50 -31
  15. package/{agentSlice-C5OYLNBT.js → agentSlice-6IQRQZX3.js} +13 -14
  16. package/{appDeleteCommands-ZXODZ5AD.js → appDeleteCommands-UUDIWLNE.js} +55 -36
  17. package/{appDeployCommands-AWC6JPZH.js → appDeployCommands-CO6SZ7YP.js} +55 -36
  18. package/{appDeployStatusCommands-74NXMDAI.js → appDeployStatusCommands-QEVKVECJ.js} +55 -36
  19. package/{appGetCommands-6YGIAP5L.js → appGetCommands-3YSCCLK4.js} +55 -36
  20. package/{appListCommands-DZWBHMNK.js → appListCommands-FBJAFZKK.js} +55 -36
  21. package/{authCommand-XMQHBK5L.js → authCommand-3ADNCFKD.js} +16 -16
  22. package/{authCommands-JSOG2H4E.js → authCommands-CXJ6PI2O.js} +7 -7
  23. package/{chunk-TOGGHWHI.js → chunk-2CYGIPJH.js} +3 -3
  24. package/{chunk-HRJEPMZY.js → chunk-2HQ4OG6N.js} +2 -2
  25. package/{chunk-XMLRJUU5.js → chunk-2IJAKBK2.js} +12 -10
  26. package/{chunk-OLWMGSW2.js → chunk-2SOQY5L6.js} +41 -39
  27. package/{chunk-7H3UTGPM.js → chunk-3AUWC6EM.js} +82 -3
  28. package/{chunk-6HTWA77J.js → chunk-43EPBPZ2.js} +1 -1
  29. package/{chunk-RJBTU7AS.js → chunk-4F77PJBR.js} +302 -14
  30. package/{chunk-RZNYL4LW.js → chunk-4SAV7BD7.js} +65 -1
  31. package/{chunk-R5V5G73M.js → chunk-5RDLGLAP.js} +0 -1
  32. package/{chunk-VKBTAQWT.js → chunk-6JH2DF7J.js} +6 -6
  33. package/{chunk-DZ3XJVET.js → chunk-AOS5IN2I.js} +1 -1
  34. package/{chunk-5ZXNLOAG.js → chunk-ARPAHODF.js} +17 -10
  35. package/{chunk-IC7W63RM.js → chunk-ATK5WJOA.js} +4 -4
  36. package/{chunk-OEWEE4VW.js → chunk-BIPRFBC2.js} +4 -2
  37. package/{chunk-YTA2QOEE.js → chunk-CAENRKNJ.js} +15 -0
  38. package/chunk-CYRMUTGB.js +1707 -0
  39. package/chunk-DCDL3GC4.js +171 -0
  40. package/{chunk-WX3ZOSTL.js → chunk-EBNSAABL.js} +24 -26
  41. package/{chunk-2TYLTEAH.js → chunk-EDWM6D6L.js} +1 -1
  42. package/{chunk-GT3GG2H7.js → chunk-EIQDGAAE.js} +148 -2
  43. package/chunk-F3MP7CP6.js +73 -0
  44. package/{chunk-R7LOFGRE.js → chunk-G5GVZAXF.js} +19 -15
  45. package/{chunk-KEF5OBOZ.js → chunk-GKXS4F2I.js} +33 -27
  46. package/{chunk-R3JSTDQO.js → chunk-GVPMJPCT.js} +1 -1
  47. package/{chunk-WMB7GVPN.js → chunk-IPSPETAL.js} +152 -1177
  48. package/{chunk-MQRZ5QUH.js → chunk-IXZX5CJK.js} +1 -1
  49. package/{chunk-2FX23RGA.js → chunk-J3LHGBNO.js} +5 -5
  50. package/{chunk-VHBWHNVT.js → chunk-K6QEHQZ3.js} +8 -4
  51. package/{chunk-HRPWRVBI.js → chunk-KGEVMUMI.js} +11 -11
  52. package/{chunk-L65QKSVJ.js → chunk-L3GCUVOH.js} +1 -1
  53. package/{chunk-G2BZ43DV.js → chunk-LAXMH7JY.js} +14 -14
  54. package/chunk-LEVCXTDN.js +5558 -0
  55. package/{chunk-HEXXIS77.js → chunk-N2IX3ZYK.js} +1 -1
  56. package/{chunk-32ZM6HVI.js → chunk-NZBH7FTB.js} +95 -95
  57. package/{chunk-XOIF2TNF.js → chunk-OB6FBSH3.js} +13 -0
  58. package/{chunk-PSK2RUHV.js → chunk-OIW2RJ74.js} +360 -2
  59. package/{chunk-FRN5QOKN.js → chunk-PACNSC37.js} +19 -4
  60. package/{chunk-QC6ZWDSV.js → chunk-PIC6Z7VI.js} +3 -3
  61. package/{chunk-H5S4XUGI.js → chunk-Q243PXRU.js} +185 -158
  62. package/{chunk-BBGRJB5E.js → chunk-QBOW6RZN.js} +4 -4
  63. package/{chunk-FVOSIYXM.js → chunk-R5Y4XELF.js} +43 -394
  64. package/{chunk-DF7SMWEV.js → chunk-RWJPDKPB.js} +1 -1
  65. package/{chunk-NXMJ55RU.js → chunk-S2BMRBR2.js} +3 -3
  66. package/{chunk-GC34RRTQ.js → chunk-SWYMCHM7.js} +1 -69
  67. package/chunk-T27IEBNQ.js +149 -0
  68. package/{chunk-GMJS5AYP.js → chunk-T4X4GCYT.js} +19 -179
  69. package/{chunk-4BDPDTJU.js → chunk-TXVSNFHC.js} +8 -8
  70. package/{chunk-JSB4N6NU.js → chunk-V54H24CQ.js} +3 -3
  71. package/chunk-VQ4QPCKE.js +3226 -0
  72. package/{chunk-Q5RXHXKU.js → chunk-W3UDJJMA.js} +189 -122
  73. package/{chunk-L3QFIBZG.js → chunk-WTGCTVJG.js} +1 -1
  74. package/{chunk-XS7UPVR7.js → chunk-WTPC3XD4.js} +5 -5
  75. package/{chunk-WSQLK2KR.js → chunk-XFGM5PJP.js} +6 -6
  76. package/{chunk-HALKDXKP.js → chunk-XORE26Z4.js} +8 -4
  77. package/chunk-YLC42PIE.js +7889 -0
  78. package/{chunk-SKDNBYZK.js → chunk-ZJ2WITOO.js} +2 -2
  79. package/{chunk-L6RBX4L4.js → chunk-ZJH3LKEW.js} +21 -9
  80. package/{codingSkills-EN6Z6G6U.js → codingSkills-V35TRR4Y.js} +1 -2
  81. package/{createAgentAutomationAction-BK4UZJKU.js → createAgentAutomationAction-EYNYY2LB.js} +31 -37
  82. package/{createDialogAction-MJJUI2MK.js → createDialogAction-OUIRWYZP.js} +34 -39
  83. package/{createPageAction-YMZ7K363.js → createPageAction-2I5PHJFF.js} +45 -51
  84. package/{dbSlice-6QJYQUBV.js → dbSlice-BBL3PEVW.js} +12 -12
  85. package/{deleteFile-WDZ3VM7B.js → deleteFile-RJTEPOT4.js} +6 -6
  86. package/{dialogCommands-OKH45ASS.js → dialogCommands-5CL4QYQ7.js} +55 -38
  87. package/{dialogSlice-UDOKNDHB.js → dialogSlice-EKKVFKBJ.js} +28 -35
  88. package/{docCreateCommands-MCLMR4TE.js → docCreateCommands-QHCLYGNW.js} +54 -37
  89. package/{docDeleteCommands-ONDHI7JV.js → docDeleteCommands-DS6KOU6N.js} +56 -39
  90. package/{docReadCommands-FCXBMISW.js → docReadCommands-FRI5DAKH.js} +54 -37
  91. package/{docStore-N66O4CGH.js → docStore-V7EJS4PX.js} +30 -36
  92. package/{docUpdateCommands-T3XN6XOX.js → docUpdateCommands-RQO5ZTXT.js} +57 -40
  93. package/{fetchMessages-W4IKHPCS.js → fetchMessages-VPPQDDZ4.js} +3 -3
  94. package/{getPricing-X6I23RN6.js → getPricing-67TQVKFV.js} +6 -7
  95. package/{handleSendMessageAction-KC4AYUZP.js → handleSendMessageAction-KCF7KII4.js} +30 -37
  96. package/index.js +72 -72
  97. package/{localDialogRead-UFLBS6OT.js → localDialogRead-P72W2U2R.js} +1 -1
  98. package/{machineCommands-DIMRFA3Y.js → machineCommands-IAGAKTHV.js} +78 -82
  99. package/{machineWsRunDispatch-2DYJZI6Z.js → machineWsRunDispatch-JGKC2HEK.js} +73 -77
  100. package/{models-YT32CTT5.js → models-WDUTTYFS.js} +2 -2
  101. package/{offlineMarxistsAgentCommand-5OOWZLJI.js → offlineMarxistsAgentCommand-E6LUG63A.js} +6 -2
  102. package/package.json +1 -1
  103. package/{read-C7Y6LSBM.js → read-64OQDO3I.js} +7 -7
  104. package/{readDocTool-TOHRYJHP.js → readDocTool-MXM3T6PE.js} +2 -1
  105. package/{readlineWorkspace-HUPHMLDG.js → readlineWorkspace-5AQHHIBK.js} +209 -183
  106. package/{removeDialogAgentAction-WZXPOH5S.js → removeDialogAgentAction-NEKVAMSH.js} +16 -17
  107. package/{runAgentClientLoop-5TGSUKHV.js → runAgentClientLoop-6OGPS6SI.js} +63 -67
  108. package/{setDialogExtraReferencesAction-INZY2ENI.js → setDialogExtraReferencesAction-WTOHQDIV.js} +13 -13
  109. package/{setPrimaryDialogAgentAction-WCVLPYCF.js → setPrimaryDialogAgentAction-LDJOYC4F.js} +16 -17
  110. package/{settingSlice-IDUM4LWU.js → settingSlice-4M37TN7V.js} +14 -15
  111. package/{skillDiscovery-ITA7BI7A.js → skillDiscovery-I3QRA7NE.js} +2 -2
  112. package/{spaceCommands-XSSDB3YK.js → spaceCommands-VTDNKTSF.js} +240 -41
  113. package/{spaceSlice-BXDCO6PT.js → spaceSlice-LGUZMB7Y.js} +29 -35
  114. package/{streamAgentChatTurn-HRFMVSVC.js → streamAgentChatTurn-TIGCZUNZ.js} +133 -1301
  115. package/{switchDialogAgentAction-YBFFCBOD.js → switchDialogAgentAction-XVWGKR2Z.js} +12 -12
  116. package/{tableCommands-QSZILI7I.js → tableCommands-RJZ3V4TF.js} +7 -7
  117. package/{toolApiClient-WVTUYOFM.js → toolApiClient-ARGFDJAG.js} +2 -2
  118. package/{tools-5V6FHWQU.js → tools-BQAOPYMR.js} +51 -56
  119. package/{tuiSummaryLlmCaller-GCUPULOV.js → tuiSummaryLlmCaller-YQBN5IMG.js} +12 -12
  120. package/{updateDialogTitleAction-W62C4W4K.js → updateDialogTitleAction-E6HMEDPH.js} +39 -45
  121. package/chunk-5CS33IBL.js +0 -301
  122. package/chunk-5MMAK75Q.js +0 -15
  123. package/chunk-HYSJHRWD.js +0 -669
  124. package/chunk-MRC4Q34M.js +0 -188
  125. package/chunk-SIZQB7BD.js +0 -91
  126. package/chunk-UEOPA6MV.js +0 -641
  127. package/chunk-UFL6WHHJ.js +0 -15419
  128. package/chunk-VIDPVFP3.js +0 -20
  129. package/chunk-W2LZV5GE.js +0 -231
  130. package/chunk-Y5GCAMGP.js +0 -9
  131. package/chunk-YYLHWIW6.js +0 -48
  132. package/chunk-Z54ZAZZC.js +0 -1791
  133. package/chunk-ZZ2MH7LE.js +0 -84
  134. package/{chunk-OMP5L5NF.js → chunk-44HACRCK.js} +3 -3
  135. package/{chunk-ZVZMT3EA.js → chunk-KWCLUYGQ.js} +3 -3
  136. package/{chunk-NRY4GCKJ.js → chunk-WHLVPK32.js} +3 -3
  137. package/{chunk-RQSOAMPJ.js → chunk-Z5MXSEOJ.js} +2 -2
  138. package/{runtimeDoctorCommands-HSU632DY.js → runtimeDoctorCommands-E2OUORHK.js} +3 -3
@@ -1,40 +1,7 @@
1
1
  import {
2
2
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
3
3
  isAntigravityOAuthAgent
4
- } from "./chunk-2FX23RGA.js";
5
- import {
6
- clipMultilineText,
7
- fetchAndSerializeTable,
8
- resolveBuiltinSkillPage,
9
- waitForAbortableDelay
10
- } from "./chunk-WMB7GVPN.js";
11
- import {
12
- createDrainExhaustedResponse,
13
- isCoreDrainingBody,
14
- isGatewayHttpStatus,
15
- normalizeNonNegativeMs,
16
- parseRetryAfterHeaderMs
17
- } from "./chunk-RQSOAMPJ.js";
18
- import {
19
- slateToSimplifiedMarkdown
20
- } from "./chunk-GC34RRTQ.js";
21
- import {
22
- extractCategorizedMentions
23
- } from "./chunk-VP4WJWKW.js";
24
- import {
25
- fetchAndCacheMessages
26
- } from "./chunk-UFL6WHHJ.js";
27
- import {
28
- fetchServerSyncedCredential
29
- } from "./chunk-RJBTU7AS.js";
30
- import {
31
- shouldUseServerProxy
32
- } from "./chunk-YYLHWIW6.js";
33
- import {
34
- buildSkillGuidancePromptBlock,
35
- extractRuntimePageCapabilities,
36
- resolveSkillGraphFromRoots
37
- } from "./chunk-7H3UTGPM.js";
4
+ } from "./chunk-J3LHGBNO.js";
38
5
  import {
39
6
  buildCurrentTimeBlock,
40
7
  buildIdentityBlock,
@@ -42,7 +9,7 @@ import {
42
9
  requiresBareImageUrl,
43
10
  resolveToolGuidedSections,
44
11
  toBareImageUrlMessages
45
- } from "./chunk-PSK2RUHV.js";
12
+ } from "./chunk-OIW2RJ74.js";
46
13
  import {
47
14
  convertMessagesToResponsesInput,
48
15
  preserveAgentStateFields
@@ -52,60 +19,69 @@ import {
52
19
  isOpenAiResponsesModel,
53
20
  resolvePlatformChatCompletionsEndpoint,
54
21
  resolvePlatformResponsesEndpoint
55
- } from "./chunk-XS7UPVR7.js";
56
- import {
57
- estimateTokenCount
58
- } from "./chunk-HYSJHRWD.js";
59
- import {
60
- createFileCredentialBroker
61
- } from "./chunk-5CS33IBL.js";
62
- import {
63
- clampReasoningEffort,
64
- getModelConfig,
65
- isModelSupportReasoningEffort
66
- } from "./chunk-GT3GG2H7.js";
22
+ } from "./chunk-WTPC3XD4.js";
67
23
  import {
68
24
  MEMORY_USE_GUIDANCE,
69
25
  wrapHistoricalSummaryWithReplayGuard
70
26
  } from "./chunk-4PWB7JRR.js";
71
27
  import {
72
- canonicalizeToolNames
73
- } from "./chunk-ZZ2MH7LE.js";
28
+ waitForAbortableDelay
29
+ } from "./chunk-IPSPETAL.js";
30
+ import {
31
+ createDrainExhaustedResponse,
32
+ isCoreDrainingBody,
33
+ isGatewayHttpStatus,
34
+ normalizeNonNegativeMs,
35
+ parseRetryAfterHeaderMs
36
+ } from "./chunk-Z5MXSEOJ.js";
37
+ import {
38
+ resolveBuiltinSkillPage
39
+ } from "./chunk-CYRMUTGB.js";
40
+ import {
41
+ estimateTokenCount,
42
+ shouldUseServerProxy
43
+ } from "./chunk-LEVCXTDN.js";
44
+ import {
45
+ createFileCredentialBroker,
46
+ fetchServerSyncedCredential
47
+ } from "./chunk-4F77PJBR.js";
74
48
  import {
75
49
  toErrorMessage
76
50
  } from "./chunk-HNMXYYJR.js";
51
+ import {
52
+ clampReasoningEffort,
53
+ getModelConfig,
54
+ isModelSupportReasoningEffort
55
+ } from "./chunk-EIQDGAAE.js";
77
56
  import {
78
57
  isDeepInfraKimiModel,
79
58
  isFireworksKimiModel,
80
59
  resolveFireworksKimiModel
81
- } from "./chunk-YTA2QOEE.js";
82
- import {
83
- createSpaceKey
84
- } from "./chunk-JSB4N6NU.js";
60
+ } from "./chunk-CAENRKNJ.js";
85
61
  import {
86
62
  read
87
- } from "./chunk-G2BZ43DV.js";
63
+ } from "./chunk-LAXMH7JY.js";
88
64
  import {
89
65
  asTrimmedLowercaseString
90
66
  } from "./chunk-QSJ3HFEF.js";
91
- import {
92
- getRuntimeServerContext
93
- } from "./chunk-XMLRJUU5.js";
94
67
  import {
95
68
  isAbortError
96
- } from "./chunk-R5V5G73M.js";
97
- import {
98
- asTrimmedString
99
- } from "./chunk-3EUW3WEO.js";
100
- import {
101
- extractCustomId
102
- } from "./chunk-TOW4E763.js";
69
+ } from "./chunk-5RDLGLAP.js";
103
70
  import {
104
71
  API_ENDPOINTS
105
72
  } from "./chunk-LCBAMY2M.js";
106
73
  import {
107
74
  isLoopbackUrl
108
75
  } from "./chunk-4SN6J65J.js";
76
+ import {
77
+ asTrimmedString
78
+ } from "./chunk-3EUW3WEO.js";
79
+ import {
80
+ buildSkillGuidancePromptBlock,
81
+ canonicalizeToolNames,
82
+ extractRuntimePageCapabilities,
83
+ resolveSkillGraphFromRoots
84
+ } from "./chunk-3AUWC6EM.js";
109
85
  import {
110
86
  asOptionalTrimmedString
111
87
  } from "./chunk-G3SUCT4W.js";
@@ -567,6 +543,7 @@ var compileContextLayers = (layers) => {
567
543
  const stablePrefixContent = stablePrefixLayers.map((layer) => layer.content).join("\n\n");
568
544
  const dynamicLayers = compiledLayers.slice(stablePrefixLayers.length);
569
545
  const dynamicContent = dynamicLayers.map((layer) => layer.content).join("\n\n");
546
+ const misorderedLayerIds = dynamicLayers.filter((layer) => layer.cacheScope !== "turn").map((layer) => layer.id);
570
547
  return {
571
548
  content: compiledLayers.map((layer) => layer.content).join("\n\n"),
572
549
  stablePrefixContent,
@@ -576,7 +553,8 @@ var compileContextLayers = (layers) => {
576
553
  stablePrefixHash: createHash("sha256").update(stablePrefixContent).digest("hex"),
577
554
  stablePrefixLayerIds: stablePrefixLayers.map((layer) => layer.id),
578
555
  stablePrefixCharCount: stablePrefixContent.length,
579
- stablePrefixEstimatedTokens: estimateContextTokens(stablePrefixContent)
556
+ stablePrefixEstimatedTokens: estimateContextTokens(stablePrefixContent),
557
+ misorderedLayerIds
580
558
  }
581
559
  };
582
560
  };
@@ -1438,336 +1416,7 @@ var performFetchRequest = async (params) => {
1438
1416
  }
1439
1417
  };
1440
1418
 
1441
- // packages/create/editor/transforms/slateToText.ts
1442
- function getNodeText(node) {
1443
- if (node.text) {
1444
- return node.text;
1445
- }
1446
- if (node.children && Array.isArray(node.children)) {
1447
- return node.children.map(getNodeText).join("\n");
1448
- }
1449
- return "";
1450
- }
1451
- function slateToText(nodes) {
1452
- if (!nodes || nodes.length === 0) {
1453
- return "";
1454
- }
1455
- return nodes.map(getNodeText).join("\n\n");
1456
- }
1457
-
1458
- // packages/ai/context/buildReferenceContext.ts
1459
- var MAX_META_TEXT_LENGTH = 80;
1460
- var DIALOG_REFERENCE_MESSAGE_LIMIT = 20;
1461
- var DIALOG_REFERENCE_SNIPPET_CHARS = 1200;
1462
- var DIALOG_HANDOFF_SNIPPET_CHARS = 360;
1463
- var truncateMetaText = (value, max = MAX_META_TEXT_LENGTH) => {
1464
- if (!value) return "";
1465
- if (value.length <= max) return value;
1466
- return `${value.slice(0, max - 3)}...`;
1467
- };
1468
- var readSafe = async (dispatch, dbKey) => {
1469
- try {
1470
- return await dispatch(read({
1471
- dbKey
1472
- })).unwrap();
1473
- } catch {
1474
- return null;
1475
- }
1476
- };
1477
- var buildMentionMetaMap = async (slateData, dispatch) => {
1478
- const metaMap = /* @__PURE__ */ new Map();
1479
- const mentions = extractCategorizedMentions(slateData);
1480
- if (!mentions) return metaMap;
1481
- const pageEntries = await Promise.all(
1482
- (mentions.pages || []).map(async (pageId) => {
1483
- const pageData = await readSafe(dispatch, pageId);
1484
- if (!pageData) {
1485
- return [`page:${pageId}`, { displayType: "page", metaParts: [] }];
1486
- }
1487
- if (pageData.type === "dialog" /* DIALOG */) {
1488
- const agentCount = Array.isArray(pageData.cybots) ? pageData.cybots.length : 0;
1489
- return [
1490
- `page:${pageId}`,
1491
- {
1492
- displayType: "dialog",
1493
- title: pageData.title,
1494
- metaParts: [
1495
- `agents=${agentCount}`,
1496
- `updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
1497
- ]
1498
- }
1499
- ];
1500
- }
1501
- const tags = pageData.tags && pageData.tags.length > 0 ? pageData.tags.slice(0, 5).join(", ") : "";
1502
- return [
1503
- `page:${pageId}`,
1504
- {
1505
- displayType: "page",
1506
- title: pageData.title,
1507
- metaParts: [
1508
- pageData.spaceId ? `space=${pageData.spaceId}` : "",
1509
- tags ? `tags=${tags}` : "",
1510
- `updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
1511
- ].filter(Boolean)
1512
- }
1513
- ];
1514
- })
1515
- );
1516
- pageEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
1517
- const agentEntries = await Promise.all(
1518
- (mentions.agents || []).map(async (agentId) => {
1519
- const agentData = await readSafe(dispatch, agentId);
1520
- if (!agentData) {
1521
- return [`agent:${agentId}`, { displayType: "agent", metaParts: [] }];
1522
- }
1523
- const desc = truncateMetaText(
1524
- agentData.description || agentData.introduction || ""
1525
- );
1526
- return [
1527
- `agent:${agentId}`,
1528
- {
1529
- displayType: "agent",
1530
- title: agentData.name,
1531
- metaParts: [
1532
- `public=${agentData.isPublic ? "yes" : "no"}`,
1533
- desc ? `desc=${desc}` : ""
1534
- ].filter(Boolean)
1535
- }
1536
- ];
1537
- })
1538
- );
1539
- agentEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
1540
- const spaceEntries = await Promise.all(
1541
- (mentions.spaces || []).map(async (spaceId) => {
1542
- const spaceKey = createSpaceKey.space(spaceId);
1543
- const spaceData = await readSafe(dispatch, spaceKey);
1544
- if (!spaceData) {
1545
- return [`space:${spaceId}`, { displayType: "space", metaParts: [] }];
1546
- }
1547
- const desc = truncateMetaText(spaceData.description || "");
1548
- const categoriesCount = Object.keys(spaceData.categories || {}).length;
1549
- const contentsCount = Object.keys(spaceData.contents || {}).length;
1550
- return [
1551
- `space:${spaceId}`,
1552
- {
1553
- displayType: "space",
1554
- title: spaceData.name,
1555
- metaParts: [
1556
- desc ? `desc=${desc}` : "",
1557
- `categories=${categoriesCount}`,
1558
- `contents=${contentsCount}`
1559
- ].filter(Boolean)
1560
- }
1561
- ];
1562
- })
1563
- );
1564
- spaceEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
1565
- return metaMap;
1566
- };
1567
- var buildInlineMention = (node, metaMap) => {
1568
- const resourceType = node.resourceType || "unknown";
1569
- const resourceId = node.resourceId || "unknown";
1570
- const key = `${resourceType}:${resourceId}`;
1571
- const meta = metaMap.get(key);
1572
- const label = meta?.title || node.label || resourceId || "mention";
1573
- const displayType = meta?.displayType || resourceType;
1574
- const metaParts = meta?.metaParts ?? [];
1575
- const idPart = resourceType === "tool" ? `tool=${resourceId}` : `dbkey=${resourceId}`;
1576
- const metaSuffix = metaParts.length ? ` | ${metaParts.join(" | ")}` : "";
1577
- return `@${label}(${displayType} | ${idPart}${metaSuffix})`;
1578
- };
1579
- var clipReferenceText = (value, max) => {
1580
- const raw = typeof value === "string" ? value : value == null ? "" : JSON.stringify(value);
1581
- return clipMultilineText(raw, max);
1582
- };
1583
- var fetchDialogReference = async (dbKey, refContent, dispatch) => {
1584
- const dialogConfig = refContent;
1585
- const dialogTitle = dialogConfig.title || `Untitled Dialog (${dbKey})`;
1586
- const dialogId = extractCustomId(dbKey) || dbKey.replace(/^dialog-/, "");
1587
- const checkpoint = dialogConfig.runtimeCheckpoint || null;
1588
- const summary = asTrimmedString(dialogConfig.summary);
1589
- const messages = await dispatch(
1590
- async (_dispatch, getState, { db }) => {
1591
- const state = getState();
1592
- const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
1593
- return await fetchAndCacheMessages({
1594
- db,
1595
- dialogId,
1596
- limit: DIALOG_REFERENCE_MESSAGE_LIMIT,
1597
- token,
1598
- remoteServers: remoteServers.length > 0 ? remoteServers : void 0
1599
- });
1600
- }
1601
- );
1602
- const sortedMessages = [...messages].reverse();
1603
- const formatContent = (content) => clipReferenceText(content, DIALOG_REFERENCE_SNIPPET_CHARS);
1604
- const transcript = sortedMessages.map((msg, index) => {
1605
- const toolLine = msg.toolName ? ` tool=${msg.toolName}` : "";
1606
- const agentLine = msg.cybotKey ? ` agent=${msg.cybotKey}` : "";
1607
- const createdLine = msg.createdAt ? ` at=${msg.createdAt}` : "";
1608
- return [
1609
- `### Message ${index + 1}: ${msg.role || "unknown"} id=${msg.id || "unknown"}${toolLine}${agentLine}${createdLine}`,
1610
- formatContent(msg.content) || "[empty]"
1611
- ].join("\n");
1612
- }).join("\n\n");
1613
- const checkpointLines = [];
1614
- if (checkpoint && typeof checkpoint === "object") {
1615
- if (checkpoint.status) checkpointLines.push(`- status: ${checkpoint.status}`);
1616
- if (checkpoint.lastUserInput) checkpointLines.push(`- lastUserInput: ${formatContent(checkpoint.lastUserInput)}`);
1617
- if (checkpoint.lastAssistantText) checkpointLines.push(`- lastAssistantText: ${formatContent(checkpoint.lastAssistantText)}`);
1618
- if (Array.isArray(checkpoint.lastToolNames) && checkpoint.lastToolNames.length) {
1619
- checkpointLines.push(`- lastToolNames: ${checkpoint.lastToolNames.join(", ")}`);
1620
- }
1621
- if (Array.isArray(checkpoint.availableToolNames) && checkpoint.availableToolNames.length) {
1622
- checkpointLines.push(`- availableToolNames: ${checkpoint.availableToolNames.join(", ")}`);
1623
- }
1624
- }
1625
- const recentToolEvidence = sortedMessages.filter((msg) => msg.role === "tool" || msg.toolName).slice(-3).map((msg) => {
1626
- const label = msg.toolName ? `${msg.toolName}` : "tool";
1627
- return `- ${label} id=${msg.id || "unknown"}: ${clipReferenceText(msg.content, DIALOG_HANDOFF_SNIPPET_CHARS) || "[empty]"}`;
1628
- });
1629
- const handoffLines = [
1630
- `- Use this when continuing work, transferring to another Agent, comparing with the current task, or preparing a document/plan from the prior discussion.`,
1631
- `- Current state source: ${checkpointLines.length ? "Runtime Checkpoint" : "summaries and recent transcript"}.`,
1632
- summary ? `- Compressed background: passive summary is available below; treat it as lossy, not original wording.` : "",
1633
- recentToolEvidence.length ? `- Recent tool evidence:
1634
- ${recentToolEvidence.join("\n")}` : `- Recent tool evidence: none loaded in the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages.`,
1635
- `- For exact claims, old decisions, original wording, files/tools mentioned earlier, or anything not visible in the recent transcript, call searchDialogMessages with DB Key ${dbKey}.`
1636
- ].filter(Boolean);
1637
- const referenceBody = [
1638
- `Conversation Reference:`,
1639
- `DB Key: ${dbKey}`,
1640
- `Title: ${dialogTitle}`,
1641
- `Status: ${dialogConfig.status || "unknown"}`,
1642
- `Loaded Recent Messages: ${sortedMessages.length}`,
1643
- `Conversation Handoff:
1644
- ${handoffLines.join("\n")}`,
1645
- checkpointLines.length ? `Runtime Checkpoint:
1646
- ${checkpointLines.join("\n")}` : "",
1647
- summary ? `Passive Summary (compressed history, not original wording):
1648
- ${wrapHistoricalSummaryWithReplayGuard(summary)}` : "",
1649
- `Recent Transcript (original message excerpts, oldest to newest):
1650
- ${transcript || "[no recent messages loaded]"}`,
1651
- [
1652
- `Coverage Note: This reference intentionally loads only the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages plus summaries/checkpoint to control token load.`,
1653
- `Original Message Lookup Policy: If the user asks for an exact old message, original wording, who said what, why a decision was made, early-history detail, file/tool evidence, failed attempts, or a comparison with prior work, use searchDialogMessages({ dialogKey: "${dbKey}", query: "..." }) before making a factual claim from this referenced conversation.`
1654
- ].join("\n")
1655
- ].filter(Boolean).join("\n\n");
1656
- const tokenEstimate = estimateTokenCount(referenceBody);
1657
- return `${referenceBody}
1658
-
1659
- Token Load Estimate: ${tokenEstimate} tokens for this conversation reference.
1660
- ---
1661
-
1662
- `;
1663
- };
1664
- var fetchTableReference = async (dbKey, refContent, dispatch) => {
1665
- const tableMeta = refContent;
1666
- const title = tableMeta.displayName || tableMeta.description || `Untitled Table (${dbKey})`;
1667
- const { markdown: tableMd } = await dispatch(
1668
- async (_dispatch, getState, { db }) => {
1669
- const state = getState();
1670
- const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
1671
- return await fetchAndSerializeTable(tableMeta, db, {
1672
- token,
1673
- remoteServers
1674
- });
1675
- }
1676
- );
1677
- const tags = tableMeta.tags?.length ? tableMeta.tags.join(", ") : "None";
1678
- const description = tableMeta.description || "No description provided.";
1679
- return `Reference Item (Table):
1680
- DB Key: ${dbKey}
1681
- Title: ${title}
1682
- Description: ${description}
1683
- Tags: ${tags}
1684
- Content (Markdown Table):
1685
-
1686
- ${tableMd}
1687
- ---
1688
-
1689
- `;
1690
- };
1691
- var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
1692
- if (!refContent?.slateData) return null;
1693
- const title = refContent.title || `Untitled (${dbKey})`;
1694
- let contentString;
1695
- let contentType;
1696
- const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
1697
- switch (options.format) {
1698
- case "text":
1699
- contentType = "Plain Text";
1700
- contentString = slateToText(refContent.slateData);
1701
- break;
1702
- case "simplified_markdown":
1703
- contentType = "Simplified Markdown";
1704
- if (inlineMentionMeta) {
1705
- const metaMap = await buildMentionMetaMap(refContent.slateData, dispatch);
1706
- contentString = slateToSimplifiedMarkdown(refContent.slateData, {
1707
- mentionResolver: (node) => buildInlineMention(node, metaMap)
1708
- });
1709
- } else {
1710
- contentString = slateToSimplifiedMarkdown(refContent.slateData);
1711
- }
1712
- break;
1713
- case "json":
1714
- default:
1715
- contentType = "Slate JSON";
1716
- contentString = JSON.stringify(refContent.slateData, null, 2);
1717
- break;
1718
- }
1719
- if (!contentString || typeof contentString === "string" && !contentString.trim() || contentString === "[]") {
1720
- return null;
1721
- }
1722
- const tags = (refContent.tags || []).length > 0 ? refContent.tags.join(", ") : "None";
1723
- const createdAt = refContent.created || "Unknown Creation Date";
1724
- const updatedAt = refContent.updated || "Unknown Update Date";
1725
- return `Reference Item:
1726
- DB Key: ${dbKey}
1727
- Title: ${title}
1728
- Content (${contentType}):
1729
- ${contentString}
1730
- Tags: ${tags}
1731
- Created At: ${createdAt}
1732
- Updated At: ${updatedAt}
1733
- ---
1734
-
1735
- `;
1736
- };
1737
- var fetchReferenceContents = async (references, dispatch, options = { format: "simplified_markdown" }) => {
1738
- const result = /* @__PURE__ */ new Map();
1739
- if (!references || references.length === 0) return result;
1740
- const referencePromises = references.map(async (dbKey) => {
1741
- try {
1742
- const hasPreloaded = options.preloaded?.has(dbKey);
1743
- const refContent = hasPreloaded ? options.preloaded?.get(dbKey) : await dispatch(read({
1744
- dbKey
1745
- })).unwrap();
1746
- if (!refContent) return null;
1747
- let formatted = null;
1748
- if (refContent.type === "dialog" /* DIALOG */) {
1749
- formatted = await fetchDialogReference(dbKey, refContent, dispatch);
1750
- } else if (refContent.type === "table" /* TABLE */) {
1751
- formatted = await fetchTableReference(dbKey, refContent, dispatch);
1752
- } else {
1753
- formatted = await fetchSlateReference(dbKey, refContent, dispatch, options);
1754
- }
1755
- if (formatted) return [dbKey, formatted];
1756
- return null;
1757
- } catch (error) {
1758
- console.error(`Error fetching reference ${dbKey}:`, error);
1759
- return null;
1760
- }
1761
- });
1762
- const resolved = await Promise.all(referencePromises);
1763
- resolved.forEach((item) => {
1764
- if (item) result.set(item[0], item[1]);
1765
- });
1766
- return result;
1767
- };
1768
-
1769
1419
  export {
1770
- fetchReferenceContents,
1771
1420
  mergeReferences,
1772
1421
  resolveReferenceAssets,
1773
1422
  resolveToolsFromKeys,
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-QC6ZWDSV.js";
5
+ } from "./chunk-PIC6Z7VI.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-KQHGZWSV.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-DF7SMWEV.js";
4
+ } from "./chunk-RWJPDKPB.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-QC6ZWDSV.js";
7
+ } from "./chunk-PIC6Z7VI.js";
8
8
  import {
9
9
  toSafeAgentSummary
10
- } from "./chunk-HRJEPMZY.js";
10
+ } from "./chunk-2HQ4OG6N.js";
11
11
  import {
12
12
  PUBLIC_AGENT_KEY_PREFIX,
13
13
  isOwnedAgentKey,
@@ -1,7 +1,3 @@
1
- import {
2
- toErrorMessage
3
- } from "./chunk-HNMXYYJR.js";
4
-
5
1
  // packages/create/editor/transforms/slateToSimplifiedMarkdown.ts
6
2
  function renderTextNode(node) {
7
3
  if (!node || typeof node.text !== "string") return "";
@@ -152,70 +148,6 @@ function slateToSimplifiedMarkdown(nodes, options = {}) {
152
148
  return nodes.map((node) => renderNode(node, 0, options)).join("").trim() + "\n";
153
149
  }
154
150
 
155
- // packages/ai/tools/readDocTool.ts
156
- var readDocFunctionSchema = {
157
- name: "readDoc",
158
- description: [
159
- "\u8BFB\u53D6\u6307\u5B9A\u9875\u9762\u7684\u5185\u5BB9\uFF0C\u5E76\u5C06\u7ED3\u6784\u5316\u7684\u6570\u636E\u8F6C\u6362\u4E3A Markdown \u683C\u5F0F\u8FD4\u56DE\u3002",
160
- "\u5982\u679C\u4F60\u62FF\u5230\u4E86\u9875\u9762\u7684 dbKey\uFF08\u5982 page-xxx\uFF09\uFF0C\u8BF7\u4F7F\u7528\u6B64\u5DE5\u5177\u67E5\u770B\u9875\u9762\u5185\u5BB9\u3002"
161
- ].join("\n"),
162
- parameters: {
163
- type: "object",
164
- properties: {
165
- id: {
166
- type: "string",
167
- description: "\u9875\u9762/\u6587\u6863\u7684\u6570\u636E\u5E93\u952E\uFF08dbKey\uFF09\uFF0C\u4F8B\u5982 page-xxx\u3002"
168
- }
169
- },
170
- required: ["id"]
171
- }
172
- };
173
- var readPageFunctionSchema = {
174
- ...readDocFunctionSchema,
175
- name: "readPage"
176
- };
177
- var buildReadDocResult = (pageData) => {
178
- const markdownContent = slateToSimplifiedMarkdown(pageData.slateData || []);
179
- const rawData = {
180
- success: true,
181
- id: pageData.dbKey,
182
- title: pageData.title,
183
- content: markdownContent,
184
- metadata: {
185
- spaceId: pageData.spaceId,
186
- created: pageData.created
187
- }
188
- };
189
- const displayData = `\u5DF2\u6210\u529F\u8BFB\u53D6\u9875\u9762\u300A${pageData.title}\u300B\u3002
190
-
191
- \u5185\u5BB9\u5982\u4E0B\uFF1A
192
-
193
- ${markdownContent}`;
194
- return { rawData, displayData };
195
- };
196
- async function readDocFunc(args, thunkApi) {
197
- const id = args.id ?? args.doc ?? args.docKey ?? args.pageKey ?? args.key;
198
- if (!id || !id.toLowerCase().startsWith("page-")) {
199
- throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
200
- }
201
- try {
202
- const { readAction } = await import("./read-C7Y6LSBM.js");
203
- const pageData = await readAction({ dbKey: id }, thunkApi);
204
- if (!pageData) {
205
- throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
206
- }
207
- return buildReadDocResult(pageData);
208
- } catch (error) {
209
- throw new Error(`\u8BFB\u53D6\u9875\u9762\u65F6\u51FA\u9519: ${toErrorMessage(error)}`);
210
- }
211
- }
212
- var readPageFunc = readDocFunc;
213
-
214
151
  export {
215
- slateToSimplifiedMarkdown,
216
- readDocFunctionSchema,
217
- readPageFunctionSchema,
218
- buildReadDocResult,
219
- readDocFunc,
220
- readPageFunc
152
+ slateToSimplifiedMarkdown
221
153
  };