nolo-cli 0.102.1 → 0.102.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.
Files changed (107) hide show
  1. package/{_executeModel-WLFACVFR.js → _executeModel-TOH473HN.js} +32 -32
  2. package/{action-PNPQLJHG.js → action-C4KMTCJF.js} +2 -2
  3. package/{addContentAction-RBOUD7SJ.js → addContentAction-7TNIOVZI.js} +6 -6
  4. package/{addDialogAgentAction-IODCR6TB.js → addDialogAgentAction-O47J3MVW.js} +5 -5
  5. package/{agentDeleteCommand-XHHDYJ3U.js → agentDeleteCommand-3EV2EOUI.js} +38 -38
  6. package/{agentEmailCommands-GJ2TE3CV.js → agentEmailCommands-V2V54ZIH.js} +38 -38
  7. package/{agentListCommands-B3YHJQNM.js → agentListCommands-SRRN3TCW.js} +21 -21
  8. package/{agentMachineCommands-KQLRJF5O.js → agentMachineCommands-JYJMU27G.js} +19 -19
  9. package/{agentRecordCommands-LXDIXYQM.js → agentRecordCommands-KQMZLZHW.js} +38 -38
  10. package/{agentRunCommand-P2KLVSYL.js → agentRunCommand-IWKQO47Q.js} +38 -38
  11. package/{agentRuntimeLocal-SXYAKX3A.js → agentRuntimeLocal-3QKZ76C7.js} +16 -16
  12. package/{agentSlice-WBSSBKBB.js → agentSlice-MR6JWMM5.js} +7 -7
  13. package/{appDeleteCommands-4EX37I4K.js → appDeleteCommands-SZFKFV4S.js} +20 -20
  14. package/{appDeployCommands-SDBR3J75.js → appDeployCommands-JWH5HMET.js} +20 -20
  15. package/{appDeployStatusCommands-764PQNYN.js → appDeployStatusCommands-CLONFBVO.js} +20 -20
  16. package/{appGetCommands-BBCN3XJC.js → appGetCommands-4Z7V7UYA.js} +20 -20
  17. package/{appListCommands-OGTABCS3.js → appListCommands-IIUS64VI.js} +20 -20
  18. package/{authCommand-NHDLY3IB.js → authCommand-NQPMGYHP.js} +3 -3
  19. package/{authCommands-UDBJVSZU.js → authCommands-LWLOZETU.js} +2 -2
  20. package/{builtinSkillRegistry-MAR5LPAC.js → builtinSkillRegistry-GFY77VRN.js} +4 -4
  21. package/{chunk-UM4PH574.js → chunk-22RVE2PC.js} +1 -1
  22. package/{chunk-XFUBXRVI.js → chunk-2H6SEVDS.js} +1 -1
  23. package/{chunk-PCF3QU5Q.js → chunk-2K4TM6AW.js} +1 -1
  24. package/{chunk-ODTDLPBV.js → chunk-3MSJ4XDQ.js} +3 -3
  25. package/{chunk-VEYL5MO5.js → chunk-4G4C5SXT.js} +3 -3
  26. package/{chunk-WCGC6S77.js → chunk-4HTMUQIZ.js} +2 -2
  27. package/{chunk-4FFUDT6D.js → chunk-56HJ2LAA.js} +17 -7
  28. package/{chunk-E73ON47R.js → chunk-5EPHWMP5.js} +2 -2
  29. package/{chunk-7EPXUZOX.js → chunk-6UEJDFF7.js} +2 -2
  30. package/{chunk-5LTAPGPV.js → chunk-6XHM3LNF.js} +2 -2
  31. package/{chunk-5OA5HMTL.js → chunk-7JWCVINR.js} +1 -1
  32. package/{chunk-4YSOUKUR.js → chunk-7KWFIKKK.js} +1 -1
  33. package/{chunk-AOJB5QYD.js → chunk-AFRHU2JO.js} +10 -11
  34. package/{chunk-G53AA7RW.js → chunk-BML3APFI.js} +90 -18
  35. package/{chunk-YXZYNMYK.js → chunk-CMKQ7RCH.js} +2 -2
  36. package/{chunk-6O4IK4V2.js → chunk-CUF4MYKI.js} +1 -1
  37. package/{chunk-PTDYOADJ.js → chunk-D2GQE6AF.js} +1 -1
  38. package/{chunk-46Y5D2BZ.js → chunk-EV235ILT.js} +1 -1
  39. package/{chunk-HRYFI64G.js → chunk-F6DFZLO4.js} +3 -3
  40. package/{chunk-FJ5BGMNM.js → chunk-FBTNYNAL.js} +1 -1
  41. package/{chunk-EHER73LN.js → chunk-GCTKWVLU.js} +1 -1
  42. package/{chunk-CJN5OERD.js → chunk-GLD6Q25H.js} +22 -22
  43. package/{chunk-SEB5HAUU.js → chunk-HD3S2F7U.js} +1 -1
  44. package/{chunk-XIRXOUBV.js → chunk-HDYUKPEB.js} +6 -6
  45. package/{chunk-LKERWYPX.js → chunk-IRZTHHNM.js} +2 -2
  46. package/{chunk-CHNCM7EF.js → chunk-JVP74JRH.js} +7 -7
  47. package/{chunk-7TKWCTSY.js → chunk-KNVDNYH7.js} +2 -2
  48. package/{chunk-7MMSLEPA.js → chunk-LB5A6JTU.js} +3 -3
  49. package/{chunk-PH275YDS.js → chunk-MEZSLGQZ.js} +25 -18
  50. package/{chunk-TVCAR26G.js → chunk-MSFZ7FMO.js} +1 -1
  51. package/chunk-NKWIS6G2.js +442 -0
  52. package/{chunk-DNHENQ3T.js → chunk-NR7N2RWA.js} +5 -5
  53. package/{chunk-Z56IK6UT.js → chunk-O2LBWZLR.js} +8 -8
  54. package/{chunk-UJXNKP5V.js → chunk-O7SVKKLY.js} +129 -14
  55. package/{chunk-SNMQMOD2.js → chunk-Q7O72MF5.js} +1 -1
  56. package/{chunk-U6IGAJT4.js → chunk-REPRKRB2.js} +7 -7
  57. package/{chunk-GARACBQB.js → chunk-RILRSUGC.js} +1 -1
  58. package/{chunk-OYPMWCIQ.js → chunk-S274RDSE.js} +9 -9
  59. package/{chunk-SEA64CDY.js → chunk-TSXNDTXL.js} +1 -1
  60. package/{chunk-W72ISAKC.js → chunk-UNAOTLKO.js} +1 -1
  61. package/{chunk-KLUBZL6X.js → chunk-USTPPV3J.js} +1 -1
  62. package/{chunk-N4QIAW6W.js → chunk-V6YASAZR.js} +1 -1
  63. package/{chunk-V5OWQOJZ.js → chunk-VL3H5ZU3.js} +48 -7
  64. package/{chunk-AUDNYVRC.js → chunk-VLGL7FOL.js} +1 -1
  65. package/{chunk-NTDEBTK5.js → chunk-XMUZHRSB.js} +6 -6
  66. package/{chunk-ADBZWMFB.js → chunk-YDO5ERB4.js} +1 -1
  67. package/{chunk-U7XXEI5R.js → chunk-YGCJITP3.js} +2 -2
  68. package/{chunk-GUYEMTRK.js → chunk-YIEUDVD6.js} +45 -32
  69. package/{chunk-OW4APERY.js → chunk-YK5MHOWM.js} +54 -9
  70. package/{commandRegistry-TDXN5OP7.js → commandRegistry-POKHERIN.js} +50 -50
  71. package/{contentThunks-F2BNWOZV.js → contentThunks-HEEW3GBT.js} +15 -15
  72. package/{createAgentAutomationAction-5N2NRNR7.js → createAgentAutomationAction-C5UTM2ZI.js} +15 -15
  73. package/{createDialogAction-DSEG4L5Y.js → createDialogAction-VODZCSHM.js} +18 -18
  74. package/{createPageAction-K32FYQPE.js → createPageAction-XUFSVLBC.js} +16 -16
  75. package/{dbSlice-Q25STFGJ.js → dbSlice-QOLNF5GN.js} +5 -5
  76. package/{deleteFile-AJ2EZMHT.js → deleteFile-KESP65GC.js} +2 -2
  77. package/{dialogCommands-ODG2OKLO.js → dialogCommands-4XNYPCE7.js} +21 -21
  78. package/{dialogSlice-4GBOUTGL.js → dialogSlice-KXBFWRVK.js} +14 -14
  79. package/{docCreateCommands-Q6FQUHUF.js → docCreateCommands-P4XCR2SW.js} +21 -21
  80. package/{docDeleteCommands-N224CFZL.js → docDeleteCommands-KZZ3L6LS.js} +22 -22
  81. package/{docReadCommands-CJWAEAB4.js → docReadCommands-JN6HL4BC.js} +21 -21
  82. package/{docStore-ZTYSP3YE.js → docStore-PLGBTV5U.js} +6 -6
  83. package/{docUpdateCommands-OPG6ZY4H.js → docUpdateCommands-EYE7BTXW.js} +21 -21
  84. package/{fetchMessages-I5ICDDHM.js → fetchMessages-5L7OVM5Y.js} +2 -2
  85. package/{handleSendMessageAction-XFZH2TQS.js → handleSendMessageAction-BBB6A54Z.js} +14 -14
  86. package/index.js +3 -3
  87. package/{localDialogRead-ZHZ3KXDM.js → localDialogRead-O5A26FDK.js} +1 -1
  88. package/{machineCommands-KMU3D5I5.js → machineCommands-4LP4XFEY.js} +37 -37
  89. package/{machineWsRunDispatch-6GJ5YOSW.js → machineWsRunDispatch-4PWOZYRA.js} +37 -37
  90. package/{memberThunks-R75S3RWP.js → memberThunks-25K6DDRA.js} +6 -6
  91. package/package.json +1 -1
  92. package/{read-SRQMNO26.js → read-PJIT2YEJ.js} +2 -2
  93. package/{readDocTool-RC3JUNJ2.js → readDocTool-DRSXHGNL.js} +1 -1
  94. package/{readlineWorkspace-EXCG3IFX.js → readlineWorkspace-CFUUABFV.js} +70 -71
  95. package/{removeDialogAgentAction-46XQV5Q7.js → removeDialogAgentAction-VIWJL6MX.js} +6 -6
  96. package/{runAgentClientLoop-URRDZ5WG.js → runAgentClientLoop-CAPNBF7Q.js} +30 -30
  97. package/{setDialogExtraReferencesAction-J4V5ADQF.js → setDialogExtraReferencesAction-A7VA3NFM.js} +6 -6
  98. package/{setPrimaryDialogAgentAction-UHHV2QZW.js → setPrimaryDialogAgentAction-B4P7YQX2.js} +6 -6
  99. package/{settingThunks-PPZZZOWN.js → settingThunks-KOYSAT65.js} +5 -5
  100. package/{spaceCommands-7CLUNI2I.js → spaceCommands-QCZUWUMS.js} +19 -19
  101. package/{streamAgentChatTurn-YPUYKXDX.js → streamAgentChatTurn-XX3N3P4J.js} +33 -33
  102. package/{switchDialogAgentAction-A2TMVGAE.js → switchDialogAgentAction-3VYWHZKH.js} +5 -5
  103. package/{tools-M5ENXZRJ.js → tools-U6BT6H56.js} +27 -27
  104. package/{tuiSummaryLlmCaller-Q65IBDGO.js → tuiSummaryLlmCaller-QCHCULPM.js} +9 -9
  105. package/{updateDialogTitleAction-7PNUE23W.js → updateDialogTitleAction-NKHQ5LCX.js} +15 -15
  106. package/chunk-CQ3WA2NE.js +0 -299
  107. /package/{chunk-3AH7LNUB.js → chunk-ODAPITXL.js} +0 -0
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-5LTAPGPV.js";
8
+ } from "./chunk-6XHM3LNF.js";
9
9
  import {
10
10
  INVALID_TOOL_ARGS_REPLACEMENT,
11
11
  buildInvalidToolCallSelfHealResult,
12
12
  parseToolCallArguments,
13
13
  performFetchRequest,
14
14
  sanitizeOutboundMessages
15
- } from "./chunk-OYPMWCIQ.js";
15
+ } from "./chunk-S274RDSE.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,7 +23,7 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-GUYEMTRK.js";
26
+ } from "./chunk-YIEUDVD6.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
@@ -38,10 +38,10 @@ import {
38
38
  messageStreamEnd,
39
39
  messageStreaming,
40
40
  updateToolMessage
41
- } from "./chunk-CJN5OERD.js";
41
+ } from "./chunk-GLD6Q25H.js";
42
42
  import {
43
43
  streamAgentChatTurn
44
- } from "./chunk-CHNCM7EF.js";
44
+ } from "./chunk-JVP74JRH.js";
45
45
  import {
46
46
  addActiveController,
47
47
  removeActiveController,
@@ -59,10 +59,10 @@ import {
59
59
  import {
60
60
  EMPTY_ASSISTANT_REPAIR_PROMPT,
61
61
  getModelInfo
62
- } from "./chunk-LKERWYPX.js";
62
+ } from "./chunk-IRZTHHNM.js";
63
63
  import {
64
64
  write
65
- } from "./chunk-4FFUDT6D.js";
65
+ } from "./chunk-56HJ2LAA.js";
66
66
  import {
67
67
  getApiEndpoint
68
68
  } from "./chunk-3BXNTXYI.js";
@@ -82,7 +82,7 @@ import {
82
82
  createDialogMessageKeyAndId,
83
83
  dialogMessageKey,
84
84
  toTrimmedString
85
- } from "./chunk-3AH7LNUB.js";
85
+ } from "./chunk-ODAPITXL.js";
86
86
  import {
87
87
  createAsyncThunk
88
88
  } from "./chunk-VY6VFGKR.js";
@@ -410,6 +410,80 @@ var resolveRecordOwnerUserId = (record) => {
410
410
  return fromKey;
411
411
  };
412
412
 
413
+ // packages/database/actions/writeAck.ts
414
+ var ACK_ENTRY_RETENTION_MS = 1e4;
415
+ var ACK_ENTRY_MAX = 256;
416
+ var replicationTargetKey = (server) => normalizeKnownServerOrigin(server) ?? normalizeServerOrigin(server);
417
+ var ackEntries = /* @__PURE__ */ new Map();
418
+ var sweepAckEntries = () => {
419
+ const wallClock = Date.now();
420
+ for (const [key, entry] of ackEntries) {
421
+ if (entry.settledAt !== null && wallClock - entry.settledAt > ACK_ENTRY_RETENTION_MS) {
422
+ ackEntries.delete(key);
423
+ }
424
+ }
425
+ while (ackEntries.size > ACK_ENTRY_MAX) {
426
+ const oldest = ackEntries.keys().next().value;
427
+ if (oldest === void 0) break;
428
+ ackEntries.delete(oldest);
429
+ }
430
+ };
431
+ var isReplicationAckHandle = (value) => {
432
+ if (!value || typeof value !== "object") return false;
433
+ const handle = value;
434
+ return typeof handle.primary?.then === "function" && handle.targets instanceof Map;
435
+ };
436
+ var asAckStatus = (ack) => ack.then(
437
+ (ok) => ok ? "acked" : "failed",
438
+ () => "failed"
439
+ );
440
+ var beginWriteAck = (dbKey) => {
441
+ let resolveOutcome = () => {
442
+ };
443
+ const promise = new Promise((resolve) => {
444
+ resolveOutcome = resolve;
445
+ });
446
+ const entry = {
447
+ promise,
448
+ settledAt: null,
449
+ servers: [],
450
+ primaryTargetKey: null,
451
+ planRegistered: false,
452
+ targetAcks: /* @__PURE__ */ new Map(),
453
+ settle: (status) => {
454
+ entry.settledAt = Date.now();
455
+ resolveOutcome(status);
456
+ }
457
+ };
458
+ ackEntries.set(dbKey, entry);
459
+ sweepAckEntries();
460
+ return {
461
+ settleWithReplication: (replication) => {
462
+ if (isReplicationAckHandle(replication)) {
463
+ entry.planRegistered = true;
464
+ entry.servers = [...replication.servers];
465
+ entry.primaryTargetKey = replicationTargetKey(replication.servers[0]);
466
+ for (const [key, ack] of replication.targets) {
467
+ entry.targetAcks.set(key, asAckStatus(ack));
468
+ }
469
+ void asAckStatus(replication.primary).then(
470
+ (status) => entry.settle(status)
471
+ );
472
+ return;
473
+ }
474
+ if (replication && typeof replication.then === "function") {
475
+ void asAckStatus(replication).then(
476
+ (status) => entry.settle(status)
477
+ );
478
+ return;
479
+ }
480
+ entry.settle("not-replicated");
481
+ },
482
+ markNotReplicated: () => entry.settle("not-replicated"),
483
+ markAborted: () => entry.settle("aborted")
484
+ };
485
+ };
486
+
413
487
  // packages/database/actions/replication.ts
414
488
  var isReadonlyPublicRecordKey = (dbKey) => dbKey.startsWith("agent-pub-");
415
489
  var normalizeCurrentUserId = (state) => {
@@ -447,26 +521,66 @@ var resolveAuthorityReplicationServers = ({
447
521
  });
448
522
  };
449
523
  var scheduleWriteReplication = (servers, request, state) => {
450
- if (servers.length === 0) return;
451
- Promise.resolve().then(async () => {
452
- const [primaryServer, ...backupServers] = servers;
453
- const primarySucceeded = await noloWriteRequest(primaryServer, request, state);
524
+ if (servers.length === 0) return null;
525
+ const [primaryServer, ...backupServers] = servers;
526
+ const targets = /* @__PURE__ */ new Map();
527
+ const settleTarget = /* @__PURE__ */ new Map();
528
+ for (const server of servers) {
529
+ const key = replicationTargetKey(server);
530
+ if (!key || targets.has(key)) continue;
531
+ targets.set(
532
+ key,
533
+ new Promise((resolve) => {
534
+ settleTarget.set(key, resolve);
535
+ })
536
+ );
537
+ }
538
+ const settleTargetFor = (server, ok) => {
539
+ const key = replicationTargetKey(server);
540
+ const resolve = settleTarget.get(key);
541
+ if (!resolve) return;
542
+ settleTarget.delete(key);
543
+ resolve(ok);
544
+ };
545
+ const primaryAck = Promise.resolve().then(async () => {
546
+ let primarySucceeded = false;
547
+ try {
548
+ primarySucceeded = await noloWriteRequest(primaryServer, request, state);
549
+ } finally {
550
+ settleTargetFor(primaryServer, primarySucceeded);
551
+ }
454
552
  if (!primarySucceeded) {
455
553
  console.warn(`Primary write sync failed for ${request.customKey} on ${primaryServer}`);
456
554
  }
457
555
  if (backupServers.length === 0) {
458
- return;
556
+ return primarySucceeded;
459
557
  }
460
- syncWithServers(
461
- backupServers,
462
- (server, requestConfig, requestState, signal) => noloWriteRequest(server, requestConfig, requestState, signal, {
463
- failureLogLevel: "info"
464
- }),
465
- `Backup write sync failed for ${request.customKey} on`,
466
- request,
467
- state
468
- );
558
+ try {
559
+ syncWithServers(
560
+ backupServers,
561
+ (server, requestConfig, requestState, signal) => noloWriteRequest(server, requestConfig, requestState, signal, {
562
+ failureLogLevel: "info"
563
+ }).then(
564
+ (ok) => {
565
+ settleTargetFor(server, ok);
566
+ return ok;
567
+ },
568
+ (error) => {
569
+ settleTargetFor(server, false);
570
+ throw error;
571
+ }
572
+ ),
573
+ `Backup write sync failed for ${request.customKey} on`,
574
+ request,
575
+ state
576
+ );
577
+ } catch (error) {
578
+ for (const server of backupServers) settleTargetFor(server, false);
579
+ throw error;
580
+ }
581
+ return primarySucceeded;
469
582
  });
583
+ return { servers: [...servers], primary: primaryAck, targets };
470
584
  };
471
585
  var resolveTenantReplicationServers = ({
472
586
  currentServer,
@@ -742,6 +856,7 @@ export {
742
856
  isDeviceLocalSpaceBody,
743
857
  resolveRecordOwnerUserId,
744
858
  resolveRecordAuthority,
859
+ beginWriteAck,
745
860
  partitionReadServers,
746
861
  compareRemoteRecordsByComparableTime,
747
862
  pickBestSettledRemoteRecord,
@@ -29,7 +29,7 @@ import {
29
29
  createMemoryOwnerIndexKey,
30
30
  createMemorySubjectKindIndexKey,
31
31
  memoryOwnerRange
32
- } from "./chunk-3AH7LNUB.js";
32
+ } from "./chunk-ODAPITXL.js";
33
33
  import {
34
34
  asTrimmedString
35
35
  } from "./chunk-3EUW3WEO.js";
@@ -7,7 +7,7 @@ import {
7
7
  deleteDialog,
8
8
  runtime_default,
9
9
  toast
10
- } from "./chunk-CJN5OERD.js";
10
+ } from "./chunk-GLD6Q25H.js";
11
11
  import {
12
12
  formatISO
13
13
  } from "./chunk-ZRAU6T47.js";
@@ -25,7 +25,7 @@ import {
25
25
  addContentAction,
26
26
  checkSpaceMembership,
27
27
  localSpaceAuthorityPatchStamp
28
- } from "./chunk-E73ON47R.js";
28
+ } from "./chunk-5EPHWMP5.js";
29
29
  import {
30
30
  createSpaceKey,
31
31
  normalizeSpaceId
@@ -39,7 +39,7 @@ import {
39
39
  uploadFileAction,
40
40
  upsertSSREntity,
41
41
  write
42
- } from "./chunk-4FFUDT6D.js";
42
+ } from "./chunk-56HJ2LAA.js";
43
43
  import {
44
44
  DEVICE_LOCAL_OWNER_ID,
45
45
  getRuntimeServerContext,
@@ -47,7 +47,7 @@ import {
47
47
  resolveReplicationServers,
48
48
  scheduleDeleteReplication,
49
49
  scheduleWriteReplication
50
- } from "./chunk-UJXNKP5V.js";
50
+ } from "./chunk-O7SVKKLY.js";
51
51
  import {
52
52
  buildTombstoneRecord
53
53
  } from "./chunk-D2MDMY2M.js";
@@ -68,7 +68,7 @@ import {
68
68
  rowKey,
69
69
  splitKey,
70
70
  ulid
71
- } from "./chunk-3AH7LNUB.js";
71
+ } from "./chunk-ODAPITXL.js";
72
72
  import {
73
73
  asOptionalFiniteNumber
74
74
  } from "./chunk-WWC7I6TA.js";
@@ -1434,11 +1434,11 @@ var ENTITY_DELETE_STRATEGIES = {
1434
1434
  await dispatch(deleteTable({ dbKey: key })).unwrap();
1435
1435
  },
1436
1436
  file: async (key, { thunkAPI }) => {
1437
- const { deleteFileAction } = await import("./deleteFile-AJ2EZMHT.js");
1437
+ const { deleteFileAction } = await import("./deleteFile-KESP65GC.js");
1438
1438
  await deleteFileAction(key, thunkAPI);
1439
1439
  },
1440
1440
  image: async (key, { thunkAPI }) => {
1441
- const { deleteFileAction } = await import("./deleteFile-AJ2EZMHT.js");
1441
+ const { deleteFileAction } = await import("./deleteFile-KESP65GC.js");
1442
1442
  await deleteFileAction(key, thunkAPI);
1443
1443
  },
1444
1444
  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-SRQMNO26.js");
209
+ const { readAction } = await import("./read-PJIT2YEJ.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`);
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  clipMultilineText,
9
9
  fetchAndSerializeTable
10
- } from "./chunk-GUYEMTRK.js";
10
+ } from "./chunk-YIEUDVD6.js";
11
11
  import {
12
12
  isGatewayHttpStatus
13
13
  } from "./chunk-NF64D32W.js";
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  resolvePageReadMarkdown,
22
22
  slateToSimplifiedMarkdown
23
- } from "./chunk-GARACBQB.js";
23
+ } from "./chunk-RILRSUGC.js";
24
24
  import {
25
25
  waitForAbortableDelay
26
26
  } from "./chunk-N4G4PKQ6.js";
@@ -29,19 +29,19 @@ import {
29
29
  } from "./chunk-AGIM7IMJ.js";
30
30
  import {
31
31
  fetchAndCacheMessages
32
- } from "./chunk-CJN5OERD.js";
32
+ } from "./chunk-GLD6Q25H.js";
33
33
  import {
34
34
  shouldUseServerProxy
35
35
  } from "./chunk-YYLHWIW6.js";
36
36
  import {
37
37
  fetchServerSyncedCredential
38
- } from "./chunk-CHNCM7EF.js";
38
+ } from "./chunk-JVP74JRH.js";
39
39
  import {
40
40
  buildSkillGuidancePromptBlock,
41
41
  extractRuntimePageCapabilities,
42
42
  resolveBuiltinSkillPage,
43
43
  resolveSkillGraphFromRoots
44
- } from "./chunk-VEYL5MO5.js";
44
+ } from "./chunk-4G4C5SXT.js";
45
45
  import {
46
46
  DELETE_SAFETY_RED_LINE,
47
47
  buildIdentityBlock,
@@ -50,7 +50,7 @@ import {
50
50
  detectDispatchIntentFromMessages,
51
51
  normalizeChatCompletionsBodyForProvider,
52
52
  resolveToolGuidedSections
53
- } from "./chunk-7TKWCTSY.js";
53
+ } from "./chunk-KNVDNYH7.js";
54
54
  import {
55
55
  convertMessagesToResponsesInput,
56
56
  getUsageRequestOptions,
@@ -59,7 +59,7 @@ import {
59
59
  } from "./chunk-M7VLQGQP.js";
60
60
  import {
61
61
  createFileCredentialBroker
62
- } from "./chunk-XFUBXRVI.js";
62
+ } from "./chunk-2H6SEVDS.js";
63
63
  import {
64
64
  estimateTokenCount
65
65
  } from "./chunk-PSCNXBYA.js";
@@ -68,7 +68,7 @@ import {
68
68
  } from "./chunk-UAD2WT54.js";
69
69
  import {
70
70
  read
71
- } from "./chunk-4FFUDT6D.js";
71
+ } from "./chunk-56HJ2LAA.js";
72
72
  import {
73
73
  MEMORY_USE_GUIDANCE,
74
74
  buildUserResponseLanguageContext,
@@ -108,7 +108,7 @@ import {
108
108
  } from "./chunk-QSJ3HFEF.js";
109
109
  import {
110
110
  getRuntimeServerContext
111
- } from "./chunk-UJXNKP5V.js";
111
+ } from "./chunk-O7SVKKLY.js";
112
112
  import {
113
113
  extractCustomId
114
114
  } from "./chunk-M2EJHDJP.js";
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-7EPXUZOX.js";
5
+ } from "./chunk-6UEJDFF7.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-OXME3PEE.js";
@@ -10,7 +10,7 @@ import {
10
10
  sanitizeShareData,
11
11
  shareKey,
12
12
  toNonEmptyString
13
- } from "./chunk-3AH7LNUB.js";
13
+ } from "./chunk-ODAPITXL.js";
14
14
  import {
15
15
  noloDeleteRequest,
16
16
  noloWriteRequest
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-OYPMWCIQ.js";
4
+ } from "./chunk-S274RDSE.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireTokenUser
3
- } from "./chunk-EHER73LN.js";
3
+ } from "./chunk-GCTKWVLU.js";
4
4
  import {
5
5
  resolveServerUrl
6
6
  } from "./chunk-A7GB5UGH.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GMZLP5DV.js";
4
4
  import {
5
5
  sanitizeForOutbound
6
- } from "./chunk-CQ3WA2NE.js";
6
+ } from "./chunk-NKWIS6G2.js";
7
7
  import {
8
8
  accumulateToolCallDelta,
9
9
  createThinkParserState,
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  isMeaningfulChatCompletionOutput,
34
34
  isMeaningfulResponsesOutput
35
- } from "./chunk-7MMSLEPA.js";
35
+ } from "./chunk-LB5A6JTU.js";
36
36
  import {
37
37
  clipCompactText
38
38
  } from "./chunk-5MMAK75Q.js";
@@ -218,18 +218,58 @@ function createResponsesToolAccumulator() {
218
218
  function keyOf(event) {
219
219
  return typeof event?.item_id === "string" && event.item_id ? event.item_id : typeof event?.item?.id === "string" && event.item.id ? event.item.id : typeof event?.item?.call_id === "string" && event.item.call_id ? event.item.call_id : typeof event?.call_id === "string" && event.call_id ? event.call_id : "";
220
220
  }
221
+ function shortFingerprint(value) {
222
+ let hash = 2166136261;
223
+ for (let i = 0; i < value.length; i++) {
224
+ hash ^= value.charCodeAt(i);
225
+ hash = Math.imul(hash, 16777619);
226
+ }
227
+ return (hash >>> 0).toString(16).padStart(8, "0");
228
+ }
229
+ function parsesAsJsonObject(value) {
230
+ try {
231
+ const parsed = JSON.parse(value);
232
+ return parsed !== null && typeof parsed === "object";
233
+ } catch {
234
+ return false;
235
+ }
236
+ }
221
237
  function applyResponsesToolEvent(calls, event) {
222
238
  const key = keyOf(event);
223
239
  if (!key) return;
224
240
  const item = event?.item;
225
241
  const id = item?.call_id || item?.id || event?.call_id || key;
226
- const current = calls.get(key) ?? { id, name: "", arguments: "" };
242
+ const current = calls.get(key) ?? { id, name: "", arguments: "", sawDelta: false };
227
243
  if (typeof item?.name === "string" && item.name) current.name = item.name;
244
+ const applySnapshot = (next) => {
245
+ if (!current.sawDelta) {
246
+ current.arguments = next;
247
+ return;
248
+ }
249
+ if (next.startsWith(current.arguments)) {
250
+ current.arguments = next;
251
+ } else if (current.arguments.startsWith(next)) {
252
+ } else {
253
+ if (!parsesAsJsonObject(current.arguments) && parsesAsJsonObject(next)) {
254
+ console.warn(
255
+ `[responses-tool-call] adopting parsable snapshot over unparsable accumulation (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`
256
+ );
257
+ current.arguments = next;
258
+ return;
259
+ }
260
+ console.warn(
261
+ `[responses-tool-call] conflicting arguments snapshot (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`
262
+ );
263
+ }
264
+ };
228
265
  const itemArguments = normalizeResponsesToolArguments(item?.arguments);
229
- if (itemArguments !== void 0) current.arguments = itemArguments;
266
+ if (itemArguments !== void 0) applySnapshot(itemArguments);
230
267
  const eventArguments = normalizeResponsesToolArguments(event?.arguments);
231
- if (eventArguments !== void 0) current.arguments = eventArguments;
232
- if (typeof event?.delta === "string") current.arguments += event.delta;
268
+ if (eventArguments !== void 0) applySnapshot(eventArguments);
269
+ if (typeof event?.delta === "string") {
270
+ current.sawDelta = true;
271
+ current.arguments += event.delta;
272
+ }
233
273
  calls.set(key, current);
234
274
  }
235
275
  function addResponsesToolCall(calls, call) {
@@ -237,7 +277,8 @@ function addResponsesToolCall(calls, call) {
237
277
  calls.set(key, {
238
278
  id: call.id,
239
279
  name: call.function.name,
240
- arguments: call.function.arguments
280
+ arguments: call.function.arguments,
281
+ sawDelta: false
241
282
  });
242
283
  }
243
284
  function finalizeResponsesToolCalls(calls) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-KHCLMKZZ.js";
5
5
  import {
6
6
  asTrimmedNonEmptyStringArray
7
- } from "./chunk-3AH7LNUB.js";
7
+ } from "./chunk-ODAPITXL.js";
8
8
  import {
9
9
  asOptionalTrimmedString
10
10
  } from "./chunk-G3SUCT4W.js";
@@ -7,7 +7,7 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-SEA64CDY.js";
10
+ } from "./chunk-TSXNDTXL.js";
11
11
  import {
12
12
  fetchWithTransientRetry,
13
13
  parsePositiveFiniteNumberOrFallback
@@ -26,12 +26,12 @@ import {
26
26
  import {
27
27
  buildDialogAttachmentPlan,
28
28
  extractFileContentIds
29
- } from "./chunk-6O4IK4V2.js";
29
+ } from "./chunk-CUF4MYKI.js";
30
30
  import {
31
31
  boundSummaryText,
32
32
  buildDialogReadEnvelope,
33
33
  projectDialogReadForAgent
34
- } from "./chunk-4YSOUKUR.js";
34
+ } from "./chunk-7KWFIKKK.js";
35
35
  import {
36
36
  asRecordOrEmpty
37
37
  } from "./chunk-KX6YBIHG.js";
@@ -52,7 +52,7 @@ import {
52
52
  import {
53
53
  asNonEmptyStringArray,
54
54
  asTrimmedNonEmptyStringArray
55
- } from "./chunk-3AH7LNUB.js";
55
+ } from "./chunk-ODAPITXL.js";
56
56
  import {
57
57
  createClientLogger
58
58
  } from "./chunk-HIM3FCLF.js";
@@ -723,7 +723,7 @@ function isExplicitDialogIdMismatch(meta, dialogId) {
723
723
  return meta && typeof meta === "object" && "id" in meta && meta.id != null && String(meta.id) !== dialogId;
724
724
  }
725
725
  async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
726
- const reader = readLocalDialog ?? (await import("./localDialogRead-ZHZ3KXDM.js")).readDialogFromLocalDb;
726
+ const reader = readLocalDialog ?? (await import("./localDialogRead-O5A26FDK.js")).readDialogFromLocalDb;
727
727
  const result = await reader({ dialogKey, dialogId, limit });
728
728
  return {
729
729
  ...result,
@@ -740,7 +740,7 @@ async function readLocalDialogAtDbPathDefault(args) {
740
740
  const [{ Level }, { safeJsonEncoding }, { fetchMessages }] = await Promise.all([
741
741
  import("./levelLazyShim-GZBKODGI.js"),
742
742
  import("./serverStoreFactory-YMXDF4NI.js"),
743
- import("./fetchMessages-I5ICDDHM.js")
743
+ import("./fetchMessages-5L7OVM5Y.js")
744
744
  ]);
745
745
  const db = new Level(args.dbPath, {
746
746
  valueEncoding: safeJsonEncoding,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-KUG52IAP.js";
7
7
  import {
8
8
  dialogMessageRange
9
- } from "./chunk-3AH7LNUB.js";
9
+ } from "./chunk-ODAPITXL.js";
10
10
 
11
11
  // packages/chat/messages/fetchMessages.ts
12
12
  function isUnboundedMessageLimit(limit) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-YYLHWIW6.js";
4
4
  import {
5
5
  compareAgentSelection
6
- } from "./chunk-4YSOUKUR.js";
6
+ } from "./chunk-7KWFIKKK.js";
7
7
  import {
8
8
  isAgentUnavailableNow
9
9
  } from "./chunk-H6A6X4EK.js";
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-CYSYR67N.js";
20
20
  import {
21
21
  fnv1a32Hex
22
- } from "./chunk-UJXNKP5V.js";
22
+ } from "./chunk-O7SVKKLY.js";
23
23
  import {
24
24
  isOwnedAgentKey,
25
25
  ownedAgentKey,