nolo-cli 0.240.0-alpha.2 → 0.241.0-alpha.1

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 (187) hide show
  1. package/{_executeModel-5NA4USGG.js → _executeModel-UCWDB72C.js} +50 -50
  2. package/{action-X75O3XPH.js → action-24MZYW2B.js} +6 -6
  3. package/{addContentAction-GVC77QSN.js → addContentAction-HEMCSSHT.js} +9 -9
  4. package/{addDialogAgentAction-KKDVAMW3.js → addDialogAgentAction-SQYDOXHA.js} +8 -8
  5. package/{agentDeleteCommand-2RFGKFAB.js → agentDeleteCommand-P7O3ACNJ.js} +76 -77
  6. package/{agentEmailCommands-GQCQKKOR.js → agentEmailCommands-A5BRSYWK.js} +80 -81
  7. package/{agentListCommands-HSGLDPDQ.js → agentListCommands-LDRCOOMO.js} +37 -36
  8. package/{agentMachineCommands-BISF6PVV.js → agentMachineCommands-AYL53KJV.js} +31 -30
  9. package/{agentProviderCommands-O3Q25PKU.js → agentProviderCommands-N5EA3ED2.js} +2 -2
  10. package/{agentPullCommand-G6U2LHMW.js → agentPullCommand-QQQZSC6S.js} +1 -1
  11. package/{agentRecordCommands-AOXPGYAJ.js → agentRecordCommands-FICBZ57C.js} +75 -76
  12. package/{agentRunCommand-YTZJCRAL.js → agentRunCommand-CTXQGDUM.js} +81 -80
  13. package/{agentRunControl-VBL7UFSG.js → agentRunControl-CO6BASZF.js} +7 -7
  14. package/{agentRuntimeLocal-T7BX2WGL.js → agentRuntimeLocal-5YN4D5WT.js} +26 -25
  15. package/{agentSlice-XJNKE3PG.js → agentSlice-DJ5D4DU4.js} +9 -9
  16. package/{appDeleteCommands-LURUSPY7.js → appDeleteCommands-B4E7N7M2.js} +32 -31
  17. package/{appDeployCommands-SMEW4AK2.js → appDeployCommands-E4DTXRRM.js} +32 -31
  18. package/{appDeployStatusCommands-VYPJTBJK.js → appDeployStatusCommands-FCNHYHZM.js} +32 -31
  19. package/{appGetCommands-N4NI5GGJ.js → appGetCommands-4DXSQHUZ.js} +32 -31
  20. package/{appListCommands-5C6ONN3Z.js → appListCommands-2NN5E4F6.js} +32 -31
  21. package/{authCommand-4CVBDADE.js → authCommand-47DR6GZT.js} +22 -18
  22. package/{authCommands-EHU2BHOX.js → authCommands-ZZ3L5IFM.js} +10 -6
  23. package/builtinSkillRegistry-AYWYQVA4.js +1 -1
  24. package/{chromeOpsCommands-CSDG2HYN.js → chromeOpsCommands-VZWAY2KR.js} +1 -1
  25. package/{chunk-UFC4J7OY.js → chunk-24GVXSWK.js} +3 -3
  26. package/{chunk-4IQVE43Z.js → chunk-25OCZXSX.js} +15 -15
  27. package/{chunk-4X5AVCM7.js → chunk-2BSLGODA.js} +258 -23
  28. package/{chunk-U3G7RRXJ.js → chunk-2XMKW2OY.js} +4 -4
  29. package/{chunk-MYOSN6BT.js → chunk-3NFWMSTA.js} +31 -10
  30. package/{chunk-E5KY7RAY.js → chunk-3V6JT6WN.js} +344 -137
  31. package/{chunk-2X7WFDT6.js → chunk-4FE3IWRE.js} +1 -1
  32. package/{chunk-XS5A3EKX.js → chunk-4YFC3DWW.js} +75 -1
  33. package/chunk-53W5BXLN.js +340 -0
  34. package/{chunk-H7ZYKHAZ.js → chunk-5TJE4QCL.js} +102 -31
  35. package/{chunk-FZKA3XFA.js → chunk-6BGJHJRN.js} +9 -9
  36. package/{chunk-6WOLPIPY.js → chunk-6RSNVJGO.js} +2 -102
  37. package/{chunk-L32W3PRP.js → chunk-6X3CS6NJ.js} +161 -12
  38. package/{chunk-3FBAVU2Y.js → chunk-6XBOPKUH.js} +11 -76
  39. package/{chunk-62HXNQVV.js → chunk-776CXKMX.js} +1 -1
  40. package/{chunk-7TTMMOKH.js → chunk-7OTNBI77.js} +1 -1
  41. package/{chunk-BGGV6B5O.js → chunk-7Q7MKJZN.js} +83 -50
  42. package/{chunk-2574ANSV.js → chunk-7U2TFUWW.js} +1 -1
  43. package/{chunk-A3LUWRQK.js → chunk-B72AFRR2.js} +4 -4
  44. package/{chunk-P3IZUMIC.js → chunk-BDERPCJW.js} +4 -4
  45. package/{chunk-MYPKBJJO.js → chunk-BIJTI5SX.js} +2 -2
  46. package/{chunk-ZEKUFJLW.js → chunk-BWW6WRX6.js} +3 -3
  47. package/chunk-C5A54QS7.js +108 -0
  48. package/{chunk-IUTUWIKE.js → chunk-C646JEUV.js} +1 -1
  49. package/{chunk-FFYE5ATM.js → chunk-CT6GT2BG.js} +7 -7
  50. package/{chunk-T6VROBY7.js → chunk-CZLSTOVM.js} +2 -2
  51. package/{chunk-SRCCSTIM.js → chunk-DGUUOHBF.js} +2 -2
  52. package/{chunk-A5EVA6HU.js → chunk-DIBQXNGW.js} +2 -2
  53. package/{chunk-AVJDELEA.js → chunk-DLT2DN4M.js} +1 -1
  54. package/{chunk-IJTXNLQE.js → chunk-DLTMAXLF.js} +6 -6
  55. package/{chunk-5QZSEQSK.js → chunk-DWWUVRB5.js} +1 -1
  56. package/{chunk-TRHJ4NJB.js → chunk-EIFSCI4C.js} +381 -155
  57. package/{chunk-DXW5WDHZ.js → chunk-EW37CXCQ.js} +3 -3
  58. package/{chunk-GXXY2NL3.js → chunk-F3FQPVHE.js} +37 -2
  59. package/{chunk-7AJRJGSQ.js → chunk-FCAMGBLY.js} +378 -146
  60. package/{chunk-YGCOJNFZ.js → chunk-FPMPWNVQ.js} +3 -3
  61. package/{chunk-MECDGHLK.js → chunk-FSIEHQNH.js} +2 -2
  62. package/{chunk-B7DE5XJW.js → chunk-FXX6VFMV.js} +208 -25
  63. package/{chunk-Z2WZAE4P.js → chunk-G6OPRPXH.js} +11 -11
  64. package/{chunk-VSRISJXZ.js → chunk-GAHJLSDO.js} +1 -1
  65. package/{chunk-PGKA77TZ.js → chunk-GCVFX6ZL.js} +169 -106
  66. package/{chunk-E5KJOZWY.js → chunk-H6CHPU6M.js} +3 -3
  67. package/{chunk-RETQOQ4D.js → chunk-HNWZJI4N.js} +1 -1
  68. package/{chunk-BGGAY6OK.js → chunk-IPRPYKBP.js} +3 -3
  69. package/{chunk-G22P367E.js → chunk-IUXBKS5L.js} +57 -13
  70. package/{chunk-PRMEU7BT.js → chunk-KGIIZXPL.js} +4 -4
  71. package/chunk-KK3FCYZM.js +647 -0
  72. package/{chunk-4Q6HQORG.js → chunk-KOIDLCAQ.js} +1 -1
  73. package/{chunk-PROOOQZ3.js → chunk-LCQJH7KN.js} +1 -1
  74. package/{chunk-Y2MF4DCJ.js → chunk-LELADM5Q.js} +1 -1
  75. package/{chunk-RTHFJZ6M.js → chunk-LMFMV5UC.js} +2 -2
  76. package/{chunk-ANJRDS6U.js → chunk-LMZRXDWG.js} +3 -3
  77. package/{chunk-6CKUO32A.js → chunk-LN4ZVSO7.js} +6 -3
  78. package/{chunk-N2JROHD3.js → chunk-LT3DMEIB.js} +3 -3
  79. package/{chunk-F6YWDVIB.js → chunk-MDVP5TLI.js} +1 -1
  80. package/chunk-MVOZ22RZ.js +26 -0
  81. package/{chunk-CBUZ6DKA.js → chunk-N6EN3HK3.js} +1 -1
  82. package/{chunk-3EMIEC27.js → chunk-NBB2EBQD.js} +1 -1
  83. package/{chunk-TWTJV35S.js → chunk-NL7J2J5Z.js} +3 -3
  84. package/{chunk-EEOOBRA7.js → chunk-NQQL2DKF.js} +2 -2
  85. package/{chunk-AEQMKYZN.js → chunk-NWWQY2J5.js} +4 -4
  86. package/{chunk-AH5R7BYW.js → chunk-OATIWAKN.js} +5 -5
  87. package/{chunk-CD3RU7XL.js → chunk-OJRTTERA.js} +62 -2
  88. package/{chunk-HOM6LTEW.js → chunk-OYHJ4TW7.js} +6 -6
  89. package/{chunk-BXSMFPTG.js → chunk-QES2NCVM.js} +3 -3
  90. package/{chunk-Y5OWZQMJ.js → chunk-QGMIUVBT.js} +5 -5
  91. package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
  92. package/chunk-SR4FE5VD.js +9 -0
  93. package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
  94. package/{chunk-CKZPMJNU.js → chunk-T444ENEC.js} +3 -3
  95. package/{chunk-TEMLHVGX.js → chunk-TE2XH4KH.js} +1 -1
  96. package/{chunk-4FIO2S7Z.js → chunk-TFGGNRT6.js} +1 -1
  97. package/{chunk-HCNOO374.js → chunk-TTEBPPUV.js} +1 -1
  98. package/{chunk-RM4UMFY4.js → chunk-TXFYIWAW.js} +7 -7
  99. package/{chunk-6WZVM33D.js → chunk-TXQVH72L.js} +2 -2
  100. package/{chunk-OBSEKCVK.js → chunk-U4VSBDO5.js} +88 -0
  101. package/{chunk-OX6GNNVT.js → chunk-U5LOKQ2R.js} +24 -13
  102. package/{chunk-VM72HKW2.js → chunk-UAHUJ4HH.js} +11 -11
  103. package/{chunk-BIABIPGW.js → chunk-UAOFSUG7.js} +1 -1
  104. package/{chunk-D374I563.js → chunk-UKSKCDBG.js} +1 -1
  105. package/{chunk-IUMS6F53.js → chunk-WHO3LYDW.js} +9 -5
  106. package/{chunk-F3XI6WQP.js → chunk-X37RQEA3.js} +2 -2
  107. package/{chunk-B5SV4H3J.js → chunk-XAFOLWLU.js} +1 -1
  108. package/{chunk-HBRDSQ3M.js → chunk-XNEDFWT4.js} +2 -2
  109. package/{chunk-VREG6ANQ.js → chunk-Y5RN44VH.js} +8 -8
  110. package/{chunk-S2MHR4PU.js → chunk-YFRJAE3R.js} +178 -114
  111. package/{chunk-GDUC4VS2.js → chunk-YMCSR7PA.js} +7 -7
  112. package/{chunk-5ZUOVCKT.js → chunk-YUZ2DAIH.js} +3 -1
  113. package/{chunk-CVJRVBJL.js → chunk-ZBQ5UGYY.js} +3 -3
  114. package/{chunk-O6IPRAVV.js → chunk-ZQUCJBS4.js} +2 -2
  115. package/{chunk-KZPEGO6D.js → chunk-ZT3DYK5T.js} +3 -3
  116. package/{chunk-DNZ4JJ7C.js → chunk-ZTLTDUV6.js} +16 -3
  117. package/{cliAgentConfigHelpers-U5OAVAKQ.js → cliAgentConfigHelpers-RFR7ZCSK.js} +6 -6
  118. package/{cliAuthorityBrokerClient-S42VMGB6.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  119. package/{cliLocalAgentRecordReader-HVZAQCUD.js → cliLocalAgentRecordReader-AJ4UKHKT.js} +30 -29
  120. package/{commandRegistry-FIXBZJHE.js → commandRegistry-IHWZVV4G.js} +86 -86
  121. package/{contentThunks-U6OC4R2N.js → contentThunks-YQRCBDKF.js} +22 -21
  122. package/{cooldownCommands-U7XSRVJP.js → cooldownCommands-W67DE765.js} +1 -1
  123. package/{createAgentAutomationAction-IP4LFN3W.js → createAgentAutomationAction-ERSDNR4R.js} +22 -21
  124. package/{createDialogAction-IAGQJ3LH.js → createDialogAction-QXC7JZPE.js} +23 -22
  125. package/{createPageAction-AZ3UIFKA.js → createPageAction-RLZ7776F.js} +24 -23
  126. package/{db-M7FU2GNK.js → db-6NRZLEW2.js} +1 -1
  127. package/{dbSlice-DKKMJJYY.js → dbSlice-7M2ESEUO.js} +8 -8
  128. package/{deleteFile-TQSONMVU.js → deleteFile-WO6WSSNK.js} +5 -5
  129. package/{dialogCommands-PCDRMBWG.js → dialogCommands-UIRO4QNN.js} +37 -36
  130. package/{dialogNotifyCommand-O35MWMOS.js → dialogNotifyCommand-VDUFYBZV.js} +8 -8
  131. package/{dialogSlice-QAKYN4DE.js → dialogSlice-A4U3C76D.js} +20 -19
  132. package/{dialogUsageCommand-2SSLTXKO.js → dialogUsageCommand-SEC6UZWM.js} +2 -2
  133. package/{docCreateCommands-CFQFZOAD.js → docCreateCommands-MHPYTJWR.js} +31 -30
  134. package/{docDeleteCommands-5CPNTIIS.js → docDeleteCommands-VYULMBAQ.js} +32 -31
  135. package/{docReadCommands-XQILYSAJ.js → docReadCommands-FV3GGZ7V.js} +31 -30
  136. package/{docStore-GIVRT7TQ.js → docStore-AWWI72FA.js} +9 -9
  137. package/{docUpdateCommands-VETKSUDD.js → docUpdateCommands-JNS3HX7F.js} +31 -30
  138. package/fetchMessages-TQEUZD7H.js +1 -1
  139. package/{getPricing-LF5C4XSI.js → getPricing-U5AR7ZHS.js} +3 -3
  140. package/{handleSendMessageAction-HKIW4ZNO.js → handleSendMessageAction-WDJOUDNV.js} +41 -40
  141. package/{hostCredentialCreate-6VDJFNDO.js → hostCredentialCreate-H3FF2SAO.js} +75 -76
  142. package/index.js +8 -8
  143. package/keys-RWF7UCB4.js +1 -1
  144. package/{localDialogRead-AV2VKKPG.js → localDialogRead-3T2KMCRC.js} +1 -1
  145. package/{localRuntimeAdapter-BQ4F5PZV.js → localRuntimeAdapter-JAQQXZJP.js} +74 -73
  146. package/{localRuntimeAuthority-WCNA4A3G.js → localRuntimeAuthority-7DKIT7UH.js} +2 -2
  147. package/{localRuntimeDb-CRNIBOOM.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
  148. package/{machineCommands-K6XIGOAD.js → machineCommands-WYOFNB5I.js} +73 -74
  149. package/{machineWsRunDispatch-4OO7Z6UM.js → machineWsRunDispatch-Y7UIAZNM.js} +73 -74
  150. package/markdownToSlate-KIYM7B3P.js +8 -0
  151. package/{mcpLocalAuthorizeCommand-ZP6ESAGE.js → mcpLocalAuthorizeCommand-SCYEFLRK.js} +9 -9
  152. package/{memberThunks-PBJPZ2JU.js → memberThunks-DIITWU4M.js} +10 -10
  153. package/{models-H5NNZRLH.js → models-CINY5UZR.js} +2 -2
  154. package/package.json +1 -1
  155. package/{projectArchive-G7AOQPRW.js → projectArchive-IZJXBW5N.js} +26 -25
  156. package/{providerPresetApply-OPBCAONX.js → providerPresetApply-2QWXPJXZ.js} +5 -5
  157. package/{providerRegistry-J2HCVTHE.js → providerRegistry-W4LCKK6V.js} +5 -5
  158. package/{read-JEGPITEW.js → read-OBLJNMA2.js} +5 -5
  159. package/{readDocTool-TE3XIU4Y.js → readDocTool-QQZ4DAER.js} +1 -1
  160. package/{readlineWorkspace-XMPGXR77.js → readlineWorkspace-WF3SWZGR.js} +2914 -1240
  161. package/rememberExplicit-CPAPONSI.js +15 -0
  162. package/{removeDialogAgentAction-CX3OAH4Y.js → removeDialogAgentAction-HC3SOY3G.js} +10 -10
  163. package/{runAgentClientLoop-HQJPDFGQ.js → runAgentClientLoop-Z7V6TA3O.js} +48 -48
  164. package/{runtimeDoctorCommands-GUH2YGMH.js → runtimeDoctorCommands-KX6YLPWV.js} +8 -8
  165. package/{secretCommands-NJXFVHZU.js → secretCommands-STRAX275.js} +2 -2
  166. package/{setDialogExtraReferencesAction-CGM67EEQ.js → setDialogExtraReferencesAction-DDZUQPY6.js} +9 -9
  167. package/{setPrimaryDialogAgentAction-3ABWPPXR.js → setPrimaryDialogAgentAction-EB67OMAJ.js} +10 -10
  168. package/{settingThunks-AY76OHYX.js → settingThunks-TN6GFASU.js} +8 -8
  169. package/{spaceCommands-G63QGYQO.js → spaceCommands-HBYQUVJI.js} +30 -29
  170. package/{streamAgentChatTurn-E3XH2KFD.js → streamAgentChatTurn-CM7QQXOS.js} +78 -78
  171. package/{switchDialogAgentAction-G6EZRKCQ.js → switchDialogAgentAction-XY5TKQQE.js} +8 -8
  172. package/{tableCommands-JI75ZHDI.js → tableCommands-MXFL3JIT.js} +2 -2
  173. package/{toolApiClient-62UUPDUA.js → toolApiClient-53YMJ2G6.js} +7 -3
  174. package/{tools-7RSX22FT.js → tools-AT6H73LD.js} +39 -40
  175. package/{tuiRestart-KAAA7TND.js → tuiRestart-272SAYSK.js} +8 -8
  176. package/{tuiSummaryLlmCaller-BVNHMWLR.js → tuiSummaryLlmCaller-K2OVRVHG.js} +13 -12
  177. package/{updateCommands-ASK5XYPH.js → updateCommands-O3BOVVVN.js} +3 -3
  178. package/{updateDialogTitleAction-SEWV252V.js → updateDialogTitleAction-PGY4UPLH.js} +22 -21
  179. package/{usageCommand-JVT5J3DC.js → usageCommand-SCF3ROV2.js} +3 -3
  180. package/{usageRebuildCommand-IZYYUTEW.js → usageRebuildCommand-K5WPIBA5.js} +4 -4
  181. package/{windowsSelfUpdate-BSDIS2J5.js → windowsSelfUpdate-WJDUZLEO.js} +2 -2
  182. package/{workContext-MM3P5GP5.js → workContext-Y3ADAPZU.js} +2 -1
  183. package/chunk-XBAEM4RI.js +0 -272
  184. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
  185. package/{chunk-ULLHVDTZ.js → chunk-C3GOEQJF.js} +3 -3
  186. package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
  187. package/{workloadLifecycle-YIZ7KLUP.js → workloadLifecycle-HFJIN5IZ.js} +5 -5
@@ -0,0 +1,108 @@
1
+ import {
2
+ applyMemoryInterpreterMutation
3
+ } from "./chunk-6RSNVJGO.js";
4
+ import {
5
+ getMemoryEvidenceVNextStrict,
6
+ listMemoryStatesForEntityVNext,
7
+ loadMemoryVNextCatalog
8
+ } from "./chunk-324FWHUA.js";
9
+
10
+ // packages/ai/memory/vnext/workContext.ts
11
+ import { createHash } from "crypto";
12
+ var facet = "work-context";
13
+ var statuses = ["active", "paused", "completed", "cancelled"];
14
+ var hash = (v) => createHash("sha256").update(JSON.stringify(v)).digest("hex");
15
+ var isWorkContextState = (state) => state.facet === facet;
16
+ var bounded = (s, max) => typeof s === "string" && s.trim().length > 0 && s.length <= max;
17
+ var list = (x, maxCount, maxLength) => Array.isArray(x) && x.length <= maxCount && x.every((v) => bounded(v, maxLength));
18
+ var object = (x) => !!x && typeof x === "object" && !Array.isArray(x);
19
+ var validScope = (s) => {
20
+ if (!s || !bounded(s.ownerId, 256) || !bounded(s.dialogId, 512) || !(s.spaceId === null || bounded(s.spaceId, 256))) throw new Error("invalid authorized scope");
21
+ };
22
+ function validValue(v) {
23
+ return object(v) && v.version === 1 && Number.isSafeInteger(v.revision) && v.revision > 0 && statuses.includes(v.status) && bounded(v.goal, 4096) && list(v.constraints, 50, 2048) && list(v.openItems, 50, 2048) && (v.nextStep === void 0 || typeof v.nextStep === "string" && v.nextStep.length <= 4096) && list(v.latestSourceRefs, 20, 2048) && v.latestSourceRefs.length > 0 && (v.spaceId === null || bounded(v.spaceId, 256)) && list(v.dialogIds, 100, 512) && v.dialogIds.length > 0;
24
+ }
25
+ function validPatch(p) {
26
+ if (!object(p) || Object.keys(p).some((k) => !["status", "goal", "constraints", "openItems", "nextStep"].includes(k))) throw new Error("invalid patch");
27
+ if (p.status !== void 0 && !statuses.includes(p.status)) throw new Error("invalid status");
28
+ if (p.goal !== void 0 && !bounded(p.goal, 4096)) throw new Error("invalid goal");
29
+ if (p.nextStep !== void 0 && (typeof p.nextStep !== "string" || p.nextStep.length > 4096)) throw new Error("invalid nextStep");
30
+ for (const a of [p.constraints, p.openItems]) if (a !== void 0 && !list(a, 50, 2048)) throw new Error("invalid list");
31
+ }
32
+ async function updateWorkContext(db, scope, input) {
33
+ validScope(scope);
34
+ if (!object(input) || Object.keys(input).some((k) => !["activityId", "expectedRevision", "itemKey", "originRef", "changeId", "sourceRefs", "patch"].includes(k))) throw new Error("invalid input");
35
+ validPatch(input.patch);
36
+ if (!bounded(input.changeId, 256) || !list(input.sourceRefs, 20, 2048) || !input.sourceRefs.length) throw new Error("source and changeId required");
37
+ const creating = input.activityId === void 0;
38
+ if (creating && (!bounded(input.itemKey, 256) || !bounded(input.originRef, 2048) || input.expectedRevision !== void 0)) throw new Error("origin and itemKey required");
39
+ if (!creating && (!bounded(input.activityId, 256) || !Number.isSafeInteger(input.expectedRevision) || input.expectedRevision < 1 || input.itemKey !== void 0 || input.originRef !== void 0)) throw new Error("activityId and revision required");
40
+ const activityId = creating ? `work-${hash([scope.ownerId, scope.spaceId, input.originRef, input.itemKey])}` : input.activityId;
41
+ const evidenceId = `work-change-${hash([activityId, input.changeId])}`;
42
+ const fingerprint = hash([scope.spaceId, scope.dialogId, input]);
43
+ let result;
44
+ await applyMemoryInterpreterMutation(db, scope.ownerId, async () => {
45
+ const states = (await listMemoryStatesForEntityVNext(db, scope.ownerId, activityId)).filter(isWorkContextState);
46
+ const currents = states.filter((s) => !s.retiredAt);
47
+ if (currents.length > 1 || currents[0] && !validValue(currents[0].value)) throw new Error("invalid work context state");
48
+ const current = currents[0];
49
+ const old = current?.value;
50
+ if (old && old.spaceId !== scope.spaceId) {
51
+ result = { activityId, revision: 0, outcome: "conflict" };
52
+ return { action: "no_op", reason: "scope mismatch" };
53
+ }
54
+ const receipt = await getMemoryEvidenceVNextStrict(db, scope.ownerId, evidenceId);
55
+ if (receipt) {
56
+ const matching = states.find((s) => s.evidenceIds.includes(evidenceId));
57
+ const savedValue = matching && validValue(matching.value) ? matching.value : void 0;
58
+ const match = receipt.text === fingerprint && !!savedValue;
59
+ result = { activityId, revision: match ? savedValue.revision : old?.revision ?? 0, outcome: match ? savedValue.revision === 1 ? "created" : "updated" : "conflict" };
60
+ return { action: "no_op", reason: "duplicate change" };
61
+ }
62
+ if (creating && current || !creating && (!old || old.revision !== input.expectedRevision)) {
63
+ result = { activityId, revision: old?.revision ?? 0, outcome: "conflict" };
64
+ return { action: "no_op", reason: "revision conflict" };
65
+ }
66
+ if (!old && !input.patch.goal) throw new Error("goal required");
67
+ const status = input.patch.status ?? old?.status ?? "active";
68
+ const dialogIds = [.../* @__PURE__ */ new Set([...old?.dialogIds ?? [], scope.dialogId])];
69
+ if (dialogIds.length > 100) throw new Error("dialog association limit exceeded");
70
+ const value = { version: 1, revision: (old?.revision ?? 0) + 1, status, goal: input.patch.goal ?? old.goal, constraints: input.patch.constraints ?? old?.constraints ?? [], openItems: input.patch.openItems ?? old?.openItems ?? [], nextStep: input.patch.nextStep ?? old?.nextStep, latestSourceRefs: input.sourceRefs, spaceId: scope.spaceId, dialogIds };
71
+ const unchanged = !!old && JSON.stringify([old.status, old.goal, old.constraints, old.openItems, old.nextStep]) === JSON.stringify([value.status, value.goal, value.constraints, value.openItems, value.nextStep]);
72
+ const now = (/* @__PURE__ */ new Date()).toISOString();
73
+ result = { activityId, revision: unchanged ? old.revision : value.revision, outcome: unchanged ? "unchanged" : old ? "updated" : "created" };
74
+ if (unchanged) return { action: "no_op", reason: "unchanged" };
75
+ const evidence = { id: evidenceId, ownerId: scope.ownerId, text: fingerprint, sourceRef: input.sourceRefs[0], confidence: 1, createdAt: now };
76
+ return { action: old ? "update" : "create", reason: "work context", entities: old ? [] : [{ id: activityId, ownerId: scope.ownerId, type: "activity", subtype: facet, name: value.goal, createdAt: now, updatedAt: now }], evidence: [evidence], states: [{ id: `work-state-${hash([activityId, value.revision])}`, ownerId: scope.ownerId, entityId: activityId, facet, value, text: value.goal, evidenceIds: [evidenceId], createdAt: now, updatedAt: now }], supersededStateIds: current ? [current.id] : [] };
77
+ });
78
+ return result;
79
+ }
80
+ async function readWorkContexts(db, scope, query = {}) {
81
+ validScope(scope);
82
+ if (!object(query) || Object.keys(query).some((k) => !["activityId", "status", "query", "limit", "discovery"].includes(k))) throw new Error("invalid query");
83
+ const limit = query.limit ?? 20;
84
+ if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1 || limit > 100) throw new Error("limit must be 1..100");
85
+ if (query.status !== void 0 && query.status !== "all" && !statuses.some((status) => status === query.status)) throw new Error("invalid status");
86
+ if (query.discovery !== void 0 && query.discovery !== "dialog" && query.discovery !== "scope") throw new Error("invalid discovery");
87
+ if (query.activityId !== void 0 && !bounded(query.activityId, 256)) throw new Error("invalid activityId");
88
+ if (query.query !== void 0 && !bounded(query.query, 512)) throw new Error("invalid query text");
89
+ const states = query.activityId ? await listMemoryStatesForEntityVNext(db, scope.ownerId, query.activityId) : (await loadMemoryVNextCatalog(db, scope.ownerId)).states;
90
+ const items = [];
91
+ for (const state of states) {
92
+ if (!isWorkContextState(state) || state.retiredAt) continue;
93
+ if (!validValue(state.value) || !bounded(state.entityId, 256) || !bounded(state.updatedAt, 128)) throw new Error("invalid work context state");
94
+ const value = state.value;
95
+ if (value.spaceId !== scope.spaceId || !query.activityId && query.discovery !== "scope" && !value.dialogIds.includes(scope.dialogId)) continue;
96
+ if (query.status !== "all" && value.status !== (query.status ?? (query.activityId ? value.status : "active"))) continue;
97
+ if (query.query && !JSON.stringify([value.goal, value.constraints, value.openItems, value.nextStep]).toLowerCase().includes(query.query.toLowerCase())) continue;
98
+ items.push({ activityId: state.entityId, value, updatedAt: state.updatedAt });
99
+ }
100
+ items.sort((a, b) => Number(b.value.dialogIds.includes(scope.dialogId)) - Number(a.value.dialogIds.includes(scope.dialogId)) || b.updatedAt.localeCompare(a.updatedAt) || a.activityId.localeCompare(b.activityId));
101
+ return { items: items.slice(0, limit), hasMore: items.length > limit };
102
+ }
103
+
104
+ export {
105
+ isWorkContextState,
106
+ updateWorkContext,
107
+ readWorkContexts
108
+ };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-UAD2WT54.js";
7
7
  import {
8
8
  toTimestampMs
9
- } from "./chunk-RM4UMFY4.js";
9
+ } from "./chunk-TXFYIWAW.js";
10
10
  import {
11
11
  __toESM
12
12
  } from "./chunk-U67V476Y.js";
@@ -1,6 +1,3 @@
1
- import {
2
- markdownToSlate
3
- } from "./chunk-FJ23FZXF.js";
4
1
  import {
5
2
  createEmptyParagraph,
6
3
  splitSlateTitleAndBody
@@ -11,19 +8,22 @@ import {
11
8
  import {
12
9
  buildSkillSummaryMarker
13
10
  } from "./chunk-VF4K2QE6.js";
11
+ import {
12
+ markdownToSlate
13
+ } from "./chunk-VIYVRPMJ.js";
14
14
  import {
15
15
  addContentToSpace,
16
16
  resolveCreationSpaceId
17
- } from "./chunk-FZKA3XFA.js";
17
+ } from "./chunk-6BGJHJRN.js";
18
18
  import {
19
19
  getCurrentSpaceId
20
- } from "./chunk-IUTUWIKE.js";
20
+ } from "./chunk-C646JEUV.js";
21
21
  import {
22
22
  runtime_default
23
- } from "./chunk-B7DE5XJW.js";
23
+ } from "./chunk-FXX6VFMV.js";
24
24
  import {
25
25
  write
26
- } from "./chunk-RM4UMFY4.js";
26
+ } from "./chunk-TXFYIWAW.js";
27
27
  import {
28
28
  selectIdentityUserId
29
29
  } from "./chunk-PXYBUFDB.js";
@@ -5,11 +5,11 @@ import {
5
5
  import {
6
6
  patch,
7
7
  read
8
- } from "./chunk-RM4UMFY4.js";
8
+ } from "./chunk-TXFYIWAW.js";
9
9
  import {
10
10
  DEVICE_LOCAL_OWNER_ID,
11
11
  isDeviceLocalSpaceBody
12
- } from "./chunk-GXXY2NL3.js";
12
+ } from "./chunk-F3FQPVHE.js";
13
13
  import {
14
14
  selectIdentityUserId
15
15
  } from "./chunk-PXYBUFDB.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-U6VC4MU4.js";
10
10
  import {
11
11
  getModelConfig
12
- } from "./chunk-CD3RU7XL.js";
12
+ } from "./chunk-OJRTTERA.js";
13
13
  import {
14
14
  asOptionalFiniteNumber
15
15
  } from "./chunk-WWC7I6TA.js";
@@ -17,7 +17,7 @@ import {
17
17
  isPlatformHostedImageModel,
18
18
  isPlatformManagedProvider,
19
19
  resolvePlatformEffectiveModel
20
- } from "./chunk-OBSEKCVK.js";
20
+ } from "./chunk-U4VSBDO5.js";
21
21
 
22
22
  // packages/ai/llm/getPricing.ts
23
23
  var MAX_OUTPUT_TOKENS = 8192;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getRuntimeServerContext,
3
3
  scheduleDeleteReplication
4
- } from "./chunk-GXXY2NL3.js";
4
+ } from "./chunk-F3FQPVHE.js";
5
5
  import {
6
6
  fetchFromClientDb
7
- } from "./chunk-ULLHVDTZ.js";
7
+ } from "./chunk-C3GOEQJF.js";
8
8
  import {
9
9
  selectIdentityToken
10
10
  } from "./chunk-PXYBUFDB.js";
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // packages/cli/agentCommandSupport.ts
6
6
  async function getDefaultCliDb() {
7
- const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-CRNIBOOM.js");
7
+ const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-5WZ4RJJO.js");
8
8
  return getDefaultCliLocalRuntimeDb();
9
9
  }
10
10
  function createNullCliDb() {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  upsertSSREntity,
3
3
  write
4
- } from "./chunk-RM4UMFY4.js";
4
+ } from "./chunk-TXFYIWAW.js";
5
5
  import {
6
6
  getRuntimeServerContext,
7
7
  resolveRecordAuthority
8
- } from "./chunk-GXXY2NL3.js";
8
+ } from "./chunk-F3FQPVHE.js";
9
9
  import {
10
10
  TIMEOUT,
11
11
  asyncThunkCreator,
12
12
  buildCreateSlice,
13
13
  noloRequest
14
- } from "./chunk-7TTMMOKH.js";
14
+ } from "./chunk-7OTNBI77.js";
15
15
  import {
16
16
  applyAgentSecretMigrationUpdates,
17
17
  migrateAgentSecrets,
@@ -458,7 +458,7 @@ var slice = createSliceWithThunks({
458
458
  const overrides = {};
459
459
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
460
460
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
461
- const { _executeModel } = await import("./_executeModel-5NA4USGG.js");
461
+ const { _executeModel } = await import("./_executeModel-UCWDB72C.js");
462
462
  return _executeModel(
463
463
  {
464
464
  isStreaming: args.isStreaming ?? false,
@@ -479,7 +479,7 @@ var slice = createSliceWithThunks({
479
479
  * - 循环直到无工具调用或触发其他运行时停止条件
480
480
  */
481
481
  runAgent: create.asyncThunk(async (args, thunkApi) => {
482
- const { runAgentClientLoop } = await import("./runAgentClientLoop-HQJPDFGQ.js");
482
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-Z7V6TA3O.js");
483
483
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
484
484
  {
485
485
  agentKey: args.agentKey,
@@ -495,7 +495,7 @@ var slice = createSliceWithThunks({
495
495
  * 聊天轮次流式 Agent 调用
496
496
  */
497
497
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
498
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-E3XH2KFD.js");
498
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-CM7QQXOS.js");
499
499
  return streamAgentChatTurnHandler(args, thunkApi);
500
500
  }),
501
501
  /**
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  describeAttachmentForModel
3
- } from "./chunk-DNZ4JJ7C.js";
3
+ } from "./chunk-ZTLTDUV6.js";
4
4
 
5
5
  // packages/ai/attachments/projectUserPart.ts
6
6
  var isRecord = (value) => typeof value === "object" && value !== null;