@tangle-network/agent-app 0.45.14 → 0.45.16

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 (39) hide show
  1. package/README.md +2 -2
  2. package/dist/assistant/index.d.ts +3 -3
  3. package/dist/assistant/index.js +5 -5
  4. package/dist/chat-routes/index.d.ts +3 -3
  5. package/dist/chat-routes/index.js +6 -6
  6. package/dist/chat-store/index.d.ts +27 -5
  7. package/dist/chat-store/index.js +40 -8
  8. package/dist/chat-store/index.js.map +1 -1
  9. package/dist/{chunk-AIZZU6ZW.js → chunk-6JPFYXEU.js} +2 -2
  10. package/dist/{chunk-WUZZVQKR.js → chunk-B2UEW62O.js} +2 -2
  11. package/dist/{chunk-CKUZVDZ7.js → chunk-GWSBBSEW.js} +224 -34
  12. package/dist/{chunk-CKUZVDZ7.js.map → chunk-GWSBBSEW.js.map} +1 -1
  13. package/dist/{chunk-3ZK5IJSW.js → chunk-M3K2HVQD.js} +2 -2
  14. package/dist/chunk-M3K2HVQD.js.map +1 -0
  15. package/dist/{chunk-73F3CKVK.js → chunk-TH7L265V.js} +5 -17
  16. package/dist/chunk-TH7L265V.js.map +1 -0
  17. package/dist/{chunk-5EPIPT4V.js → chunk-XZ27ENOZ.js} +2 -2
  18. package/dist/{chunk-3BK3BC2L.js → chunk-ZSSCVT6H.js} +2 -2
  19. package/dist/{contract-CQNvv5th.d.ts → contract-OxG_jVMx.d.ts} +9 -27
  20. package/dist/harness/index.d.ts +5 -12
  21. package/dist/harness/index.js +1 -1
  22. package/dist/interactions/index.d.ts +2 -2
  23. package/dist/interactions/index.js +2 -2
  24. package/dist/{parts-F8W3-iry.d.ts → parts-BqIHMdyu.d.ts} +1 -1
  25. package/dist/run/index.js +1 -1
  26. package/dist/sandbox/index.js +2 -2
  27. package/dist/skills-placement/index.js +1 -1
  28. package/dist/stream/index.d.ts +3 -3
  29. package/dist/stream/index.js +2 -2
  30. package/dist/{stream-normalizer-CnPnMaTp.d.ts → stream-normalizer-DKRxyVlZ.d.ts} +1 -1
  31. package/dist/web-react/index.d.ts +19 -7
  32. package/dist/web-react/index.js +5 -5
  33. package/package.json +11 -11
  34. package/dist/chunk-3ZK5IJSW.js.map +0 -1
  35. package/dist/chunk-73F3CKVK.js.map +0 -1
  36. /package/dist/{chunk-AIZZU6ZW.js.map → chunk-6JPFYXEU.js.map} +0 -0
  37. /package/dist/{chunk-WUZZVQKR.js.map → chunk-B2UEW62O.js.map} +0 -0
  38. /package/dist/{chunk-5EPIPT4V.js.map → chunk-XZ27ENOZ.js.map} +0 -0
  39. /package/dist/{chunk-3BK3BC2L.js.map → chunk-ZSSCVT6H.js.map} +0 -0
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-YTMKRL3L.js";
13
13
  import {
14
14
  attachmentPartsFromMessageParts
15
- } from "./chunk-WUZZVQKR.js";
15
+ } from "./chunk-B2UEW62O.js";
16
16
  import {
17
17
  formatBytes
18
18
  } from "./chunk-KWXUBMXU.js";
@@ -25,7 +25,7 @@ import {
25
25
  parseInteractionRequest,
26
26
  persistedPartToInteraction,
27
27
  questionInteractionContentSignature
28
- } from "./chunk-3ZK5IJSW.js";
28
+ } from "./chunk-M3K2HVQD.js";
29
29
  import {
30
30
  parsePlanSubmittedEvent,
31
31
  persistedPartToPlan
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  snapHarnessToModel,
35
35
  snapModelToHarness
36
- } from "./chunk-73F3CKVK.js";
36
+ } from "./chunk-TH7L265V.js";
37
37
 
38
38
  // src/web-react/index.tsx
39
39
  import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef9, useState as useState14, memo } from "react";
@@ -3176,6 +3176,7 @@ function SessionHistoryPanel({
3176
3176
  respondingSessionIds,
3177
3177
  onRename,
3178
3178
  onDelete,
3179
+ onBulkAction,
3179
3180
  renameLabel = "Rename",
3180
3181
  deleteLabel = "Delete",
3181
3182
  extraActions,
@@ -3196,7 +3197,58 @@ function SessionHistoryPanel({
3196
3197
  });
3197
3198
  const searchTerm = query.trim();
3198
3199
  const isSearching = searchTerm.length > 0;
3199
- const column = contentWidth === "full" ? "w-full" : "mx-auto w-full max-w-3xl";
3200
+ const column = contentWidth === "full" ? "w-full" : "mx-auto w-full max-w-4xl";
3201
+ const [selectedIds, setSelectedIds] = useState12(/* @__PURE__ */ new Set());
3202
+ const [ageDays, setAgeDays] = useState12("30");
3203
+ const [bulkTarget, setBulkTarget] = useState12(null);
3204
+ const [bulkBusy, setBulkBusy] = useState12(false);
3205
+ const [bulkError, setBulkError] = useState12(null);
3206
+ useEffect9(() => {
3207
+ setSelectedIds(/* @__PURE__ */ new Set());
3208
+ }, [searchTerm, sort]);
3209
+ useEffect9(() => {
3210
+ const visible = new Set(history.items.map((item) => item.id));
3211
+ setSelectedIds((current) => {
3212
+ const next = new Set([...current].filter((id) => visible.has(id)));
3213
+ return next.size === current.size ? current : next;
3214
+ });
3215
+ }, [history.items]);
3216
+ const selectedCount = selectedIds.size;
3217
+ const allVisibleSelected = history.items.length > 0 && history.items.every((item) => selectedIds.has(item.id));
3218
+ const parsedAgeDays = Number(ageDays);
3219
+ const validAgeDays = Number.isInteger(parsedAgeDays) && parsedAgeDays >= 1 && parsedAgeDays <= 36500;
3220
+ const openBulkAction = useCallback7((action) => {
3221
+ const verb = deleteLabel.toLowerCase();
3222
+ if (action.kind === "selected") {
3223
+ setBulkTarget({
3224
+ action,
3225
+ title: `${deleteLabel} selected sessions?`,
3226
+ body: `${verb === "delete" ? "This permanently removes" : `This ${verb}s`} ${action.ids.length} selected session${action.ids.length === 1 ? "" : "s"} and its messages.`
3227
+ });
3228
+ return;
3229
+ }
3230
+ const range = action.kind === "older-than" ? `older than ${action.days} days` : `from the last ${action.days} days`;
3231
+ setBulkTarget({
3232
+ action,
3233
+ title: `${deleteLabel} sessions ${range}?`,
3234
+ body: "This applies to every matching session in this workspace, including sessions not currently loaded in this list."
3235
+ });
3236
+ }, [deleteLabel]);
3237
+ const confirmBulkAction = useCallback7(async () => {
3238
+ if (!bulkTarget || !onBulkAction) return;
3239
+ setBulkBusy(true);
3240
+ setBulkError(null);
3241
+ try {
3242
+ await onBulkAction(bulkTarget.action);
3243
+ setBulkTarget(null);
3244
+ setSelectedIds(/* @__PURE__ */ new Set());
3245
+ history.reload();
3246
+ } catch (error) {
3247
+ setBulkError(error instanceof Error ? error.message : `Could not ${deleteLabel.toLowerCase()} sessions`);
3248
+ } finally {
3249
+ setBulkBusy(false);
3250
+ }
3251
+ }, [bulkTarget, deleteLabel, history, onBulkAction]);
3200
3252
  return /* @__PURE__ */ jsxs10("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
3201
3253
  /* @__PURE__ */ jsx12("header", { className: "flex h-14 shrink-0 items-center border-b border-border px-4 sm:px-6", children: /* @__PURE__ */ jsxs10("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
3202
3254
  /* @__PURE__ */ jsx12("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
@@ -3213,32 +3265,117 @@ function SessionHistoryPanel({
3213
3265
  )
3214
3266
  ] }) }),
3215
3267
  /* @__PURE__ */ jsxs10("div", { ref: scrollRef, className: "min-h-0 flex-1 overflow-y-auto", children: [
3216
- hasAnySessions && /* @__PURE__ */ jsx12("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
3217
- /* @__PURE__ */ jsx12(
3218
- "input",
3219
- {
3220
- type: "search",
3221
- value: query,
3222
- onChange: (e) => onQueryChange(e.target.value),
3223
- placeholder: "Search your sessions\u2026",
3224
- "aria-label": "Search sessions",
3225
- className: "h-9 min-w-0 appearance-none rounded-md border border-border bg-card px-3 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none"
3226
- }
3227
- ),
3228
- /* @__PURE__ */ jsxs10(
3229
- "select",
3230
- {
3231
- value: sort,
3232
- onChange: (e) => onSortChange(e.target.value),
3233
- "aria-label": "Sort sessions",
3234
- className: "h-9 shrink-0 appearance-none rounded-md border border-border bg-card px-2 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring sm:w-[132px]",
3235
- children: [
3236
- /* @__PURE__ */ jsx12("option", { value: "newest", children: "Newest" }),
3237
- /* @__PURE__ */ jsx12("option", { value: "oldest", children: "Oldest" })
3238
- ]
3239
- }
3240
- )
3241
- ] }) }),
3268
+ hasAnySessions && /* @__PURE__ */ jsxs10("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: [
3269
+ /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
3270
+ /* @__PURE__ */ jsx12(
3271
+ "input",
3272
+ {
3273
+ type: "search",
3274
+ value: query,
3275
+ onChange: (e) => onQueryChange(e.target.value),
3276
+ placeholder: "Search your sessions\u2026",
3277
+ "aria-label": "Search sessions",
3278
+ className: "h-9 min-w-0 appearance-none rounded-md border border-border bg-card px-3 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none"
3279
+ }
3280
+ ),
3281
+ /* @__PURE__ */ jsxs10(
3282
+ "select",
3283
+ {
3284
+ value: sort,
3285
+ onChange: (e) => onSortChange(e.target.value),
3286
+ "aria-label": "Sort sessions",
3287
+ className: "h-9 shrink-0 appearance-none rounded-md border border-border bg-card px-2 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring sm:w-[132px]",
3288
+ children: [
3289
+ /* @__PURE__ */ jsx12("option", { value: "newest", children: "Newest" }),
3290
+ /* @__PURE__ */ jsx12("option", { value: "oldest", children: "Oldest" })
3291
+ ]
3292
+ }
3293
+ )
3294
+ ] }),
3295
+ onBulkAction && /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 border-t border-border/60 px-3 py-3 ${column}`, children: [
3296
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-2", children: [
3297
+ /* @__PURE__ */ jsx12(
3298
+ "button",
3299
+ {
3300
+ type: "button",
3301
+ onClick: () => setSelectedIds(new Set(history.items.map((item) => item.id))),
3302
+ disabled: allVisibleSelected || history.items.length === 0,
3303
+ className: "h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent/30 disabled:opacity-50",
3304
+ children: "Select all"
3305
+ }
3306
+ ),
3307
+ /* @__PURE__ */ jsx12(
3308
+ "button",
3309
+ {
3310
+ type: "button",
3311
+ onClick: () => setSelectedIds(/* @__PURE__ */ new Set()),
3312
+ disabled: selectedCount === 0,
3313
+ className: "h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent/30 disabled:opacity-50",
3314
+ children: "Deselect all"
3315
+ }
3316
+ ),
3317
+ /* @__PURE__ */ jsxs10("span", { className: "text-xs text-muted-foreground", "aria-live": "polite", children: [
3318
+ selectedCount,
3319
+ " selected"
3320
+ ] }),
3321
+ selectedCount > 0 && /* @__PURE__ */ jsxs10(
3322
+ "button",
3323
+ {
3324
+ type: "button",
3325
+ onClick: () => openBulkAction({ kind: "selected", ids: [...selectedIds] }),
3326
+ className: "h-8 rounded-md bg-destructive px-2.5 text-xs font-medium text-destructive-foreground transition hover:opacity-90",
3327
+ children: [
3328
+ deleteLabel,
3329
+ " selected"
3330
+ ]
3331
+ }
3332
+ )
3333
+ ] }),
3334
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-2", children: [
3335
+ /* @__PURE__ */ jsx12("label", { htmlFor: "agent-app-session-age", className: "text-xs text-muted-foreground", children: "Session age" }),
3336
+ /* @__PURE__ */ jsx12(
3337
+ "input",
3338
+ {
3339
+ id: "agent-app-session-age",
3340
+ type: "number",
3341
+ min: 1,
3342
+ max: 36500,
3343
+ value: ageDays,
3344
+ onChange: (event) => setAgeDays(event.target.value),
3345
+ "aria-invalid": ageDays.length > 0 && !validAgeDays,
3346
+ className: "h-8 w-20 rounded-md border border-border bg-card px-2 text-xs tabular-nums text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"
3347
+ }
3348
+ ),
3349
+ /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: "days" }),
3350
+ /* @__PURE__ */ jsxs10(
3351
+ "button",
3352
+ {
3353
+ type: "button",
3354
+ onClick: () => openBulkAction({ kind: "older-than", days: parsedAgeDays }),
3355
+ disabled: !validAgeDays,
3356
+ className: "h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent/30 disabled:opacity-50",
3357
+ children: [
3358
+ deleteLabel,
3359
+ " older"
3360
+ ]
3361
+ }
3362
+ ),
3363
+ /* @__PURE__ */ jsxs10(
3364
+ "button",
3365
+ {
3366
+ type: "button",
3367
+ onClick: () => openBulkAction({ kind: "newer-than", days: parsedAgeDays }),
3368
+ disabled: !validAgeDays,
3369
+ className: "h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent/30 disabled:opacity-50",
3370
+ children: [
3371
+ deleteLabel,
3372
+ " recent"
3373
+ ]
3374
+ }
3375
+ )
3376
+ ] })
3377
+ ] })
3378
+ ] }),
3242
3379
  /* @__PURE__ */ jsx12("div", { className: `px-4 pb-8 pt-1 sm:px-6 ${column}`, children: !hasAnySessions ? /* @__PURE__ */ jsxs10("div", { className: "flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center", children: [
3243
3380
  /* @__PURE__ */ jsx12("p", { className: "text-sm font-medium text-foreground", children: emptyTitle }),
3244
3381
  /* @__PURE__ */ jsx12("p", { className: "max-w-xs text-xs text-muted-foreground", children: emptyDescription })
@@ -3246,7 +3383,7 @@ function SessionHistoryPanel({
3246
3383
  "No sessions match \u201C",
3247
3384
  searchTerm,
3248
3385
  "\u201D."
3249
- ] }) : /* @__PURE__ */ jsx12(SkeletonRows, {}) : /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-0.5", children: [
3386
+ ] }) : /* @__PURE__ */ jsx12("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "No sessions remain." }) : /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-0.5", children: [
3250
3387
  history.items.map((session) => /* @__PURE__ */ jsx12(
3251
3388
  SessionRow,
3252
3389
  {
@@ -3258,6 +3395,16 @@ function SessionHistoryPanel({
3258
3395
  timestamp: formatTimestamp(session.updatedAt),
3259
3396
  onRename,
3260
3397
  onDelete,
3398
+ selectable: Boolean(onBulkAction),
3399
+ selected: selectedIds.has(session.id),
3400
+ onSelectedChange: (selected) => {
3401
+ setSelectedIds((current) => {
3402
+ const next = new Set(current);
3403
+ if (selected) next.add(session.id);
3404
+ else next.delete(session.id);
3405
+ return next;
3406
+ });
3407
+ },
3261
3408
  renameLabel,
3262
3409
  deleteLabel,
3263
3410
  extraActions
@@ -3266,7 +3413,37 @@ function SessionHistoryPanel({
3266
3413
  )),
3267
3414
  history.isError ? /* @__PURE__ */ jsx12(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load more sessions.", inline: true }) : history.hasMore ? /* @__PURE__ */ jsx12("div", { ref: sentinelRef, className: "flex items-center justify-center py-6", children: history.isLoadingMore && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: "Loading\u2026" }) }) : null
3268
3415
  ] }) })
3269
- ] })
3416
+ ] }),
3417
+ bulkTarget && /* @__PURE__ */ jsx12(
3418
+ SessionDialog,
3419
+ {
3420
+ title: bulkTarget.title,
3421
+ onClose: () => {
3422
+ if (!bulkBusy) {
3423
+ setBulkTarget(null);
3424
+ setBulkError(null);
3425
+ }
3426
+ },
3427
+ busy: bulkBusy,
3428
+ error: bulkError,
3429
+ footer: /* @__PURE__ */ jsxs10(Fragment6, { children: [
3430
+ /* @__PURE__ */ jsx12(
3431
+ DialogButton,
3432
+ {
3433
+ onClick: () => {
3434
+ setBulkTarget(null);
3435
+ setBulkError(null);
3436
+ },
3437
+ disabled: bulkBusy,
3438
+ variant: "ghost",
3439
+ children: "Cancel"
3440
+ }
3441
+ ),
3442
+ /* @__PURE__ */ jsx12(DialogButton, { onClick: () => void confirmBulkAction(), disabled: bulkBusy, variant: "destructive", children: bulkBusy ? "Working\u2026" : deleteLabel })
3443
+ ] }),
3444
+ children: /* @__PURE__ */ jsx12("p", { className: "text-sm text-muted-foreground", children: bulkTarget.body })
3445
+ }
3446
+ )
3270
3447
  ] });
3271
3448
  }
3272
3449
  function ErrorBlock({ message, onRetry, inline }) {
@@ -3300,13 +3477,26 @@ function SessionRow({
3300
3477
  onDelete,
3301
3478
  renameLabel,
3302
3479
  deleteLabel,
3303
- extraActions
3480
+ extraActions,
3481
+ selectable,
3482
+ selected,
3483
+ onSelectedChange
3304
3484
  }) {
3305
3485
  const [menuOpen, setMenuOpen] = useState12(false);
3306
3486
  const extras = extraActions?.(session) ?? [];
3307
3487
  const hasMenu = Boolean(onRename) || Boolean(onDelete) || extras.length > 0;
3308
3488
  const showUnread = Boolean(session.unread) && !responding;
3309
3489
  return /* @__PURE__ */ jsxs10("div", { className: "group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent/20", children: [
3490
+ selectable && /* @__PURE__ */ jsx12(
3491
+ "input",
3492
+ {
3493
+ type: "checkbox",
3494
+ checked: selected,
3495
+ onChange: (event) => onSelectedChange(event.target.checked),
3496
+ "aria-label": `Select ${sessionLabel(session, untitledLabel)}`,
3497
+ className: "h-4 w-4 shrink-0 rounded border-border accent-primary"
3498
+ }
3499
+ ),
3310
3500
  /* @__PURE__ */ jsxs10(Link, { to: href, className: "flex min-w-0 flex-1 items-center gap-3", children: [
3311
3501
  showUnread && /* @__PURE__ */ jsx12("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary", "aria-hidden": true }),
3312
3502
  /* @__PURE__ */ jsx12(MessageIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
@@ -4309,4 +4499,4 @@ export {
4309
4499
  useThinkingSeconds,
4310
4500
  ChatMessages
4311
4501
  };
4312
- //# sourceMappingURL=chunk-CKUZVDZ7.js.map
4502
+ //# sourceMappingURL=chunk-GWSBBSEW.js.map