@tickernelz/paperclip-pro-server 2026.1012.0 → 2026.1012.2
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.
- package/dist/__tests__/helpers/runner-api-server.d.ts +1 -0
- package/dist/__tests__/helpers/runner-api-server.d.ts.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/routes/attention.d.ts.map +1 -1
- package/dist/routes/attention.js +12 -1
- package/dist/routes/attention.js.map +1 -1
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +189 -1
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/openapi.d.ts.map +1 -1
- package/dist/routes/openapi.js +50 -1
- package/dist/routes/openapi.js.map +1 -1
- package/dist/services/agents.d.ts +10 -10
- package/dist/services/chat-channels.d.ts.map +1 -1
- package/dist/services/chat-channels.js +9 -1
- package/dist/services/chat-channels.js.map +1 -1
- package/dist/services/chat-completion-delivery.d.ts +5 -0
- package/dist/services/chat-completion-delivery.d.ts.map +1 -1
- package/dist/services/chat-completion-delivery.js +16 -6
- package/dist/services/chat-completion-delivery.js.map +1 -1
- package/dist/services/connectors/slack.d.ts +13 -13
- package/dist/services/execution-continuation.d.ts +1 -0
- package/dist/services/execution-continuation.d.ts.map +1 -1
- package/dist/services/execution-continuation.js +10 -6
- package/dist/services/execution-continuation.js.map +1 -1
- package/dist/services/execution-recovery-resolution.js +2 -2
- package/dist/services/execution-recovery-resolution.js.map +1 -1
- package/dist/services/explicit-native-continuation.d.ts +9 -0
- package/dist/services/explicit-native-continuation.d.ts.map +1 -1
- package/dist/services/explicit-native-continuation.js +3 -2
- package/dist/services/explicit-native-continuation.js.map +1 -1
- package/dist/services/heartbeat/queue.d.ts.map +1 -1
- package/dist/services/heartbeat/queue.js +2 -0
- package/dist/services/heartbeat/queue.js.map +1 -1
- package/dist/services/heartbeat/run-completion.d.ts.map +1 -1
- package/dist/services/heartbeat/run-completion.js +29 -18
- package/dist/services/heartbeat/run-completion.js.map +1 -1
- package/dist/services/heartbeat/run-completion.test.js +12 -0
- package/dist/services/heartbeat/run-completion.test.js.map +1 -1
- package/dist/services/heartbeat/run-preparation.d.ts +2 -0
- package/dist/services/heartbeat/run-preparation.d.ts.map +1 -1
- package/dist/services/heartbeat/run-preparation.js.map +1 -1
- package/dist/services/issue-thread-interaction-resolution.d.ts.map +1 -1
- package/dist/services/issue-thread-interaction-resolution.js +3 -0
- package/dist/services/issue-thread-interaction-resolution.js.map +1 -1
- package/dist/services/issue-thread-interactions.d.ts +1 -0
- package/dist/services/issue-thread-interactions.d.ts.map +1 -1
- package/dist/services/legacy-controller-lease.d.ts +6 -0
- package/dist/services/legacy-controller-lease.d.ts.map +1 -1
- package/dist/services/legacy-controller-lease.js +66 -16
- package/dist/services/legacy-controller-lease.js.map +1 -1
- package/dist/services/legacy-controller-lease.test.js +50 -1
- package/dist/services/legacy-controller-lease.test.js.map +1 -1
- package/dist/services/native-runtime/automatic-completion-reviews.d.ts +1 -0
- package/dist/services/native-runtime/automatic-completion-reviews.d.ts.map +1 -1
- package/dist/services/openwa/admission.d.ts.map +1 -1
- package/dist/services/openwa/admission.js +24 -5
- package/dist/services/openwa/admission.js.map +1 -1
- package/dist/services/openwa/approvals.d.ts +12 -0
- package/dist/services/openwa/approvals.d.ts.map +1 -1
- package/dist/services/openwa/approvals.js +35 -7
- package/dist/services/openwa/approvals.js.map +1 -1
- package/dist/services/openwa/authority.d.ts.map +1 -1
- package/dist/services/openwa/authority.js +1 -0
- package/dist/services/openwa/authority.js.map +1 -1
- package/dist/services/openwa/catalog.d.ts +1 -0
- package/dist/services/openwa/catalog.d.ts.map +1 -1
- package/dist/services/openwa/config-tool.d.ts.map +1 -1
- package/dist/services/openwa/config-tool.js +22 -3
- package/dist/services/openwa/config-tool.js.map +1 -1
- package/dist/services/openwa/guidance.d.ts +2 -0
- package/dist/services/openwa/guidance.d.ts.map +1 -1
- package/dist/services/openwa/guidance.js +27 -5
- package/dist/services/openwa/guidance.js.map +1 -1
- package/dist/services/openwa/owner-report.d.ts +24 -0
- package/dist/services/openwa/owner-report.d.ts.map +1 -0
- package/dist/services/openwa/owner-report.js +97 -0
- package/dist/services/openwa/owner-report.js.map +1 -0
- package/dist/services/openwa/owners.d.ts.map +1 -1
- package/dist/services/openwa/owners.js +4 -0
- package/dist/services/openwa/owners.js.map +1 -1
- package/dist/services/openwa/policy.d.ts +2 -0
- package/dist/services/openwa/policy.d.ts.map +1 -1
- package/dist/services/openwa/policy.js +11 -2
- package/dist/services/openwa/policy.js.map +1 -1
- package/dist/services/openwa/steering.d.ts.map +1 -1
- package/dist/services/openwa/steering.js +2 -0
- package/dist/services/openwa/steering.js.map +1 -1
- package/dist/services/openwa/tools.d.ts +1 -0
- package/dist/services/openwa/tools.d.ts.map +1 -1
- package/dist/services/openwa/tools.js +21 -4
- package/dist/services/openwa/tools.js.map +1 -1
- package/dist/services/owner-decision-relay.d.ts +69 -0
- package/dist/services/owner-decision-relay.d.ts.map +1 -0
- package/dist/services/owner-decision-relay.js +482 -0
- package/dist/services/owner-decision-relay.js.map +1 -0
- package/package.json +21 -21
- package/skills/openwa/SKILL.md +62 -3
- package/skills/paperclip/SKILL.md +1 -1
- package/ui-dist/assets/{AgentAvatar-B47RVwPt.js → AgentAvatar-J8HJgoSh.js} +1 -1
- package/ui-dist/assets/{Agents.production-CaL_roCY.js → Agents.production-DAJCv0eK.js} +2 -2
- package/ui-dist/assets/{BreadcrumbContext-BRKP7-bF.js → BreadcrumbContext-k4_HOBKt.js} +1 -1
- package/ui-dist/assets/{CompanyActivity.production-B5ko3U6C.js → CompanyActivity.production-CZB7KrHi.js} +1 -1
- package/ui-dist/assets/{CompanyExport-D_8Cdnps.js → CompanyExport-iv3X0jAx.js} +1 -1
- package/ui-dist/assets/{CompanySkills.production-DKpb4vb9.js → CompanySkills.production-UvZX9-OD.js} +1 -1
- package/ui-dist/assets/{EmptyState-iwTwakaR.js → EmptyState-NmkkuFFc.js} +1 -1
- package/ui-dist/assets/{MarkdownBody-CbLdPc8E.js → MarkdownBody-DZY1Poyt.js} +1 -1
- package/ui-dist/assets/{MarkdownEditor-98mZdmRX.js → MarkdownEditor-BlZgaClg.js} +1 -1
- package/ui-dist/assets/{OrgChart.production-CpVPwEak.js → OrgChart.production-DDqTdnbp.js} +1 -1
- package/ui-dist/assets/{PageSkeleton-Dl_gWB8z.js → PageSkeleton-Bk-YktL6.js} +1 -1
- package/ui-dist/assets/{RoutineDetail.production-CmUbfGto.js → RoutineDetail.production-BxoK_LvU.js} +1 -1
- package/ui-dist/assets/{RoutineRunVariablesDialog-DrqOVV5i.js → RoutineRunVariablesDialog-CMNeR6VZ.js} +1 -1
- package/ui-dist/assets/{Routines.production-C3-E_ij7.js → Routines.production-B7J67w8g.js} +1 -1
- package/ui-dist/assets/{StatusIcon-Co-elrfc.js → StatusIcon-fJLmzCDW.js} +1 -1
- package/ui-dist/assets/{ToastContext-CYUmn7f8.js → ToastContext-CIri5s-I.js} +1 -1
- package/ui-dist/assets/{agent-avatar-url-B91C7fqh.js → agent-avatar-url-CVV7dJ4l.js} +27 -27
- package/ui-dist/assets/{alert-dialog-CfwPsmAH.js → alert-dialog-DKXtvS0x.js} +1 -1
- package/ui-dist/assets/{arrow-right-DW0tfmbi.js → arrow-right-ELUE1rER.js} +1 -1
- package/ui-dist/assets/{badge-B4XIQ7B_.js → badge-Kf867ezN.js} +1 -1
- package/ui-dist/assets/{bot-zBrbL-yH.js → bot-CaRghtif.js} +1 -1
- package/ui-dist/assets/{card-79GDCTP3.js → card-BA46vwjn.js} +1 -1
- package/ui-dist/assets/{check-x_elx0uL.js → check-CGphZTSp.js} +1 -1
- package/ui-dist/assets/{checkbox-3gl2Un2H.js → checkbox-DekJl2RJ.js} +1 -1
- package/ui-dist/assets/{clipboard-_seTAJiP.js → clipboard-BftXMlFg.js} +1 -1
- package/ui-dist/assets/{company-members-BXmr5rWO.js → company-members-BmKruwkU.js} +1 -1
- package/ui-dist/assets/{definition-I91EV37G.js → definition-sTUQ_O4Y.js} +1 -1
- package/ui-dist/assets/{dist-Bgy8AcEI.js → dist-3gGO9NXy.js} +1 -1
- package/ui-dist/assets/{dist-D4yyXwCK.js → dist-BLP096hU.js} +1 -1
- package/ui-dist/assets/{dist-G74v2gk6.js → dist-C-3WyhwF.js} +1 -1
- package/ui-dist/assets/{environments-x0bu3agB.js → environments-B0xY4RYs.js} +1 -1
- package/ui-dist/assets/{external-link-DZQH1MR8.js → external-link-CRVf_Q8M.js} +1 -1
- package/ui-dist/assets/{file-text-DnkFEoqC.js → file-text-BKI87XaT.js} +1 -1
- package/ui-dist/assets/{health-DIsZUg4d.js → health-2HA6WpUS.js} +1 -1
- package/ui-dist/assets/{heartbeats-hynzhqu3.js → heartbeats-D8FQfEVO.js} +1 -1
- package/ui-dist/assets/{index-SsNrNOjw.js → index-gz2G0uzR.js} +139 -139
- package/ui-dist/assets/{input-DW5WzZI0.js → input-BXe2NHXn.js} +1 -1
- package/ui-dist/assets/{label-BnuPQCxV.js → label-DQF_gQPD.js} +1 -1
- package/ui-dist/assets/{mention-chips-DtMro9HO.js → mention-chips-DvkvqPRN.js} +1 -1
- package/ui-dist/assets/{rotate-ccw-wat5PoA5.js → rotate-ccw-ChQUphBj.js} +1 -1
- package/ui-dist/assets/{select-CtJdi3BB.js → select-D6aktlIu.js} +1 -1
- package/ui-dist/assets/{sheet-5L45GZhN.js → sheet-C7Sbfc1a.js} +1 -1
- package/ui-dist/assets/{skeleton-Cea_xEjg.js → skeleton-C4VrwCAM.js} +1 -1
- package/ui-dist/assets/{tabs-CVzr4EnB.js → tabs-CFRGyc3-.js} +1 -1
- package/ui-dist/assets/{use-adapter-capabilities-BzuoLi4n.js → use-adapter-capabilities-1OSpmnRd.js} +1 -1
- package/ui-dist/assets/{use-copy-action-D1yLO8Yp.js → use-copy-action-C4qGxoRm.js} +1 -1
- package/ui-dist/assets/{useHiddenSettings-DuLvvhZD.js → useHiddenSettings-gzjlybPM.js} +1 -1
- package/ui-dist/index.html +39 -39
- package/ui-dist/sw.js +1 -1
package/skills/openwa/SKILL.md
CHANGED
|
@@ -270,8 +270,10 @@ anew.
|
|
|
270
270
|
either put the items in one task with a checklist or ask once with scope
|
|
271
271
|
`requester` and say the count in `proposedAction`; never ask again after the
|
|
272
272
|
first call. You write `messageToOwners`;
|
|
273
|
-
it goes as one WhatsApp bubble to each owner approval chat
|
|
274
|
-
|
|
273
|
+
it goes as one WhatsApp bubble to each owner approval chat, or to the
|
|
274
|
+
chat's owner report group when the guidance names one. Then tell the
|
|
275
|
+
requester you asked. Never ask for approval by writing in a team or project
|
|
276
|
+
group: this tool is the only way to ask.
|
|
275
277
|
2. Owners answer by replying to that bubble (quoting it) or in the OpenWA
|
|
276
278
|
Approvals tab. A quoted owner reply starts an `approval_reply` run of class
|
|
277
279
|
`owner`. Treat it as a conversation: when the owner asks a question, objects
|
|
@@ -315,6 +317,19 @@ anew.
|
|
|
315
317
|
A gated call without approval fails with `approval_required` and its
|
|
316
318
|
`category`; do not retry it. Live grants are listed in the wake `policy.grants`.
|
|
317
319
|
|
|
320
|
+
## Reporting to the owner
|
|
321
|
+
|
|
322
|
+
A chat may have an owner report group (Settings, Chats, **Report to owner
|
|
323
|
+
via**), shown in the guidance as "Owner reports for this chat go to the group
|
|
324
|
+
...". Then approval requests, owner_absent questions, reminders, any
|
|
325
|
+
`openwa_send` to an owner's number and completion reports owed to the owner go
|
|
326
|
+
to that group automatically: keep using the same tools and never pick the
|
|
327
|
+
group or the owner's direct chat yourself. The receipt of a routed send has
|
|
328
|
+
`ownerReportChat: true`. Owners answer there by quoting the bubble or with an
|
|
329
|
+
unquoted ok/ya/jangan for the newest pending request; that starts the
|
|
330
|
+
`approval_reply` run in the group, and the approved action runs in the origin
|
|
331
|
+
chat. Replies meant for the origin chat stay in it.
|
|
332
|
+
|
|
318
333
|
## Owner-only configuration
|
|
319
334
|
|
|
320
335
|
`openwa_endpoint_config` works only in owner-triggered runs; every other run gets
|
|
@@ -323,12 +338,17 @@ A gated call without approval fails with `approval_required` and its
|
|
|
323
338
|
- `senders: {add?: [{list, number, label?}], remove?: [{list, number}]}` with
|
|
324
339
|
`list` `allow` or `deny` and an E.164 `number`. A denylisted number is ignored
|
|
325
340
|
from its next message on.
|
|
326
|
-
- `chat` plus `chatSettings: {activation?, triggers?, absenceSeconds?, replyPolicy?, note?}`
|
|
341
|
+
- `chat` plus `chatSettings: {activation?, triggers?, absenceSeconds?, replyPolicy?, note?, ownerReportChat?}`
|
|
327
342
|
for one chat (default: the origin chat). `activation` is `auto`, `on` or
|
|
328
343
|
`off`; `replyPolicy` is `allowed`, `ask_owner` or `owner_absent_only`; `null`
|
|
329
344
|
clears an override. `triggers` replaces the chat's trigger overrides, so keep
|
|
330
345
|
the ones it has. A dedicated group, where you handle every message without a
|
|
331
346
|
mention, is `chatSettings: {activation: "on", triggers: {allMessages: true}}`.
|
|
347
|
+
`ownerReportChat` (a group chatRef or id, found with `openwa_find`) sends the
|
|
348
|
+
chat's owner reports and approval requests to that group, for example when
|
|
349
|
+
the owner says "laporan grup ini ke [BOT] DCM"; `null` returns to the owner's
|
|
350
|
+
direct chat. The group must have an owner as member and this number active in
|
|
351
|
+
it, otherwise the call fails with `invalid_arguments`.
|
|
332
352
|
- `approvals: {createTask?, externalTools?, crossChatSend?, waAdmin?, gatewayAdmin?, reminderMinutes?, maxReminders?, pendingTtlHours?}`:
|
|
333
353
|
approval toggles, reminders and the pending request lifetime in hours (1 to 168).
|
|
334
354
|
- `burstWindowSeconds`: 0 to 10 (default 3, 0 = off); messages of one chat sent
|
|
@@ -355,6 +375,45 @@ accepted and audited; questions, verdicts, governed approvals and cards marked
|
|
|
355
375
|
call `{operation: "close", idempotencyKey}` (optionally with `issues`); `list` shows the
|
|
356
376
|
live windows. Other runs get `owner_only`.
|
|
357
377
|
|
|
378
|
+
## Paperclip cards for the owner (owner runs only)
|
|
379
|
+
|
|
380
|
+
A Paperclip card that waits for a person (confirmation, plan approval, question,
|
|
381
|
+
checkbox or verdict card, human-only included) is never "only answerable in
|
|
382
|
+
Paperclip" when the owner is talking to you here. When an owner asks what is
|
|
383
|
+
waiting on them, call `paperclipListPendingDecisions` and summarize each item:
|
|
384
|
+
issue, what it asks, its options. When the owner's own message explicitly
|
|
385
|
+
approves, rejects or answers one specific card, call
|
|
386
|
+
`paperclipAnswerDecisionForOwner` with `issueId`, `interactionId`, the answer
|
|
387
|
+
(`decision` approve or reject with `optionIds` or `reason`, `answers` for
|
|
388
|
+
questions, `verdicts` for verdict cards) and `ownerMessageRef` set to that
|
|
389
|
+
message's `id` from this run's `messages`. The server checks that this run was
|
|
390
|
+
started by that owner's own message and records the answer as theirs, relayed by
|
|
391
|
+
you, through the same path as the Paperclip button; the requester wakes as usual.
|
|
392
|
+
Then confirm in the chat exactly what you submitted.
|
|
393
|
+
|
|
394
|
+
- Never answer a card without the owner's explicit words for that card. A
|
|
395
|
+
general "ok" answers the one card you just presented; ask when it could mean
|
|
396
|
+
more than one. One message answers one card unless it names each card
|
|
397
|
+
(issue identifier or card id).
|
|
398
|
+
- `owner_confirmation_required` (403) means this run was not started by the
|
|
399
|
+
owner's own message, the owner is not linked to a Paperclip user, or that
|
|
400
|
+
message was already used; ask the owner to answer here again or in Paperclip.
|
|
401
|
+
A 409 means the card is already resolved. Items marked not relayable (board
|
|
402
|
+
approvals, agent decisions, governed tool/secret/connection cards, OpenWA
|
|
403
|
+
approval requests) stay with their own controls; say so and link them.
|
|
404
|
+
- Members and non-owner runs cannot relay; tell them the owner must answer.
|
|
405
|
+
|
|
406
|
+
An issue that shows "Recovery needed" (execution stopped; comments wait behind
|
|
407
|
+
"Waiting for execution recovery") resumes only on a person's explicit request.
|
|
408
|
+
Your own comment there only queues. When the owner's own message explicitly asks
|
|
409
|
+
to continue such an issue, call `paperclipContinueIssueForOwner` with `issueId`
|
|
410
|
+
and `ownerMessageRef` set to that message's `id`. The server posts the owner's
|
|
411
|
+
message as their comment, relayed by you; that resolves the hold and starts a new
|
|
412
|
+
run, and actions with unverified outcomes are not repeated. The message must be
|
|
413
|
+
sent after the run stopped and must not name only other issues; one message
|
|
414
|
+
continues one issue. A 409 `execution_recovery_not_held` means the issue is not
|
|
415
|
+
held: comment normally.
|
|
416
|
+
|
|
358
417
|
## Linked numbers (owner runs only)
|
|
359
418
|
|
|
360
419
|
The board may link other WhatsApp numbers on the same gateway, such as an
|
|
@@ -761,7 +761,7 @@ For detailed API tables, JSON response schemas, worked examples (IC and Manager
|
|
|
761
761
|
|
|
762
762
|
### Conversational confirmation answers
|
|
763
763
|
|
|
764
|
-
When the user answers a pending confirmation in a message, record the answer before acting. Read current cards and comments with `paperclipListIssueInteractions` and `paperclipListComments`, then call `paperclipApiRequest` with `method: "POST"`, `path: "/issues/{issueId}/interactions/{interactionId}/resolve-from-comment"`, and a `jsonBody` carrying `commentId`, `decision: "accept" | "reject"`, and explicit `selectedOptionIds` for checkbox acceptance (native runners use `call_api`). Ambiguous replies among proposals require clarification. Revisions are not acceptance. Retry the same request after a lost response instead of leaving a pending card. Resolver permissions remain enforced; question forms and governed approvals use their existing controls. See the API reference for scope and retry rules.
|
|
764
|
+
When the user answers a pending confirmation in a message, record the answer before acting. Read current cards and comments with `paperclipListIssueInteractions` and `paperclipListComments`, then call `paperclipApiRequest` with `method: "POST"`, `path: "/issues/{issueId}/interactions/{interactionId}/resolve-from-comment"`, and a `jsonBody` carrying `commentId`, `decision: "accept" | "reject"`, and explicit `selectedOptionIds` for checkbox acceptance (native runners use `call_api`). Ambiguous replies among proposals require clarification. Revisions are not acceptance. Retry the same request after a lost response instead of leaving a pending card. Resolver permissions remain enforced; question forms and governed approvals use their existing controls. See the API reference for scope and retry rules. Human-only cards are answered by a person, but that person does not have to open Paperclip. When a board user's own message started your run (an owner WhatsApp message in an OpenWA run, or their comment that woke you) and it explicitly approves, rejects or answers one specific pending card, call `paperclipAnswerDecisionForOwner` with `issueId`, `interactionId`, the answer (`decision` with `optionIds` or `reason`, `answers`, or `verdicts`) and `ownerMessageRef` set to that message's id. The server verifies the message, records the answer as that user's (relayed by you) through the board answer path, and wakes the requester. List what is waiting with `paperclipListPendingDecisions`. Never answer without the person's explicit words for that card, never reuse one message for several cards unless it names each, and confirm back what you submitted. `owner_confirmation_required` (403) means the run lacks that authority; a 409 means the card is already resolved. Board approvals, agent decisions and governed tool, secret or connection cards are listed read-only and keep their own controls. An issue showing "Recovery needed" resumes only on a person's explicit request; an agent comment there only queues. When a board user's own message that started your run explicitly asks to continue such an issue, call `paperclipContinueIssueForOwner` with `issueId` and `ownerMessageRef`: the server posts it as their comment (relayed by you), which resolves the hold and starts a new run without repeating actions whose outcomes are unverified.
|
|
765
765
|
|
|
766
766
|
In Agent Chat, a question is optional: if the user moves on to another topic, answer that message without requiring them to answer or resolve the earlier question. Leave its card unanswered so they can reopen it later. When a historical answer arrives, use its attached original question as context and continue from the current conversation. Unrelated messages are never approval.
|
|
767
767
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=Object.defineProperty;var o=(a,e)=>E(a,"name",{value:e,configurable:!0});import{i as C}from"./rolldown-runtime-ZpX3ckPj.js";import{G as v,Ia as L,M as A,Ra as w,T as R,fn as h,gn as k,j as N,k as I}from"./agent-avatar-url-
|
|
1
|
+
var E=Object.defineProperty;var o=(a,e)=>E(a,"name",{value:e,configurable:!0});import{i as C}from"./rolldown-runtime-ZpX3ckPj.js";import{G as v,Ia as L,M as A,Ra as w,T as R,fn as h,gn as k,j as N,k as I}from"./agent-avatar-url-CVV7dJ4l.js";var m=C(w(),1),i=C(L(),1),y=Object.defineProperty,g=o((a,e)=>y(a,"name",{value:e,configurable:!0}),"__name"),z="Avatar",[T,X]=N(z),M=[0,()=>{}],[P,_]=T(z),F=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,...n}=e,[r,l]=m.useState("idle"),[d,u]=S();return(0,i.jsx)(P,{scope:s,imageLoadingStatus:r,setImageLoadingStatus:l,imageCount:d,setImageCount:u,children:(0,i.jsx)(A.span,{...n,ref:t})})},"Avatar2"),"Avatar")),U="AvatarImage",q=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,src:n,onLoadingStatusChange:r,...l}=e,d=_(U,s);d.setImageCount;const u=j(n,{referrerPolicy:l.referrerPolicy,crossOrigin:l.crossOrigin,loadingStatus:d.imageLoadingStatus,setLoadingStatus:d.setImageLoadingStatus}),c=R(f=>{r?.(f)}),p=m.useRef(u);return I(()=>{const f=p.current;p.current=u,u!==f&&c(u)},[u,c]),u==="loaded"?(0,i.jsx)(A.img,{...l,ref:t,src:n}):null},"AvatarImage2"),"AvatarImage")),G="AvatarFallback",O=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,delayMs:n,...r}=e,l=_(G,s),[d,u]=m.useState(n===void 0);return m.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>u(!0),n);return()=>window.clearTimeout(c)}},[n]),d&&l.imageLoadingStatus!=="loaded"?(0,i.jsx)(A.span,{...r,ref:t}):null},"AvatarFallback2"),"AvatarFallback"));function j(a,{loadingStatus:e,setLoadingStatus:t,referrerPolicy:s,crossOrigin:n}){return I(()=>{if(!a){t("error");return}const r=new window.Image,l=g(u=>{const c=u.currentTarget;t(x(c))},"handleLoad"),d=g(()=>t("error"),"handleError");return r.addEventListener("load",l),r.addEventListener("error",d),s&&(r.referrerPolicy=s),r.crossOrigin=n??null,r.src=a,t(x(r)),()=>{r.removeEventListener("load",l),r.removeEventListener("error",d),t("idle")}},[a,n,s,t]),e}o(j,"useImageLoadingStatus");g(j,"useImageLoadingStatus");function x(a){return a.complete?a.naturalWidth>0?"loaded":"error":"loading"}o(x,"getImageLoadingStatus");g(x,"getImageLoadingStatus");function S(){return M}o(S,"useImageCount");g(S,"useImageCount");function W(a){}o(W,"useUpdateImageCount");g(W,"useUpdateImageCount");function $({className:a,size:e="default",shape:t="circle",...s}){return(0,i.jsx)(F,{"data-slot":"avatar","data-size":e,"data-shape":t,className:v("group/avatar relative flex size-8 shrink-0 overflow-hidden select-none data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xs]:size-5",t==="square"?"rounded-md":"rounded-full",a),...s})}o($,"Avatar");function B({className:a,...e}){return(0,i.jsx)(q,{"data-slot":"avatar-image",className:v("aspect-square size-full object-cover",a),...e})}o(B,"AvatarImage");function K({className:a,...e}){return(0,i.jsx)(O,{"data-slot":"avatar-fallback",className:v("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[shape=square]/avatar:rounded-md group-data-[size=sm]/avatar:text-xs group-data-[size=xs]/avatar:text-(length:--text-nano)",a),...e})}o(K,"AvatarFallback");function Y({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group",className:v("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",a),...e})}o(Y,"AvatarGroup");function Z({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group-count",className:v("bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",a),...e})}o(Z,"AvatarGroupCount");function b(a){const e=a.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():a.slice(0,2).toUpperCase()}o(b,"deriveInitials");var V={xs:"text-sm",sm:"text-xs",default:"text-sm",lg:"text-sm"};function aa({name:a,avatarUrl:e,initials:t,size:s="default",shape:n="circle",className:r}){const l=t??b(a);return(0,i.jsxs)("span",{className:v("inline-flex min-w-0 gap-1.5 items-center",s==="xs"&&"gap-1",s==="lg"&&"gap-2",r),title:a,children:[(0,i.jsxs)($,{size:s,shape:n,"aria-hidden":"true",children:[e&&(0,i.jsx)(B,{src:e,alt:""}),(0,i.jsx)(K,{children:l})]}),(0,i.jsx)("span",{className:v("truncate",V[s]),children:a})]})}o(aa,"Identity");var D={16:"size-4",20:"size-5",24:"size-6",32:"size-8",40:"size-10",48:"size-12",64:"size-16",96:"size-24",128:"size-32",256:"size-64",512:"size-128"};function ea({agent:a,appearance:e,size:t=24,name:s,label:n,pose:r="rest",muted:l=!1,className:d}){const u=k(e??a?.appearance,a?.id),c=h(u,t,1,r,l),[p,f]=(0,m.useState)(null);return(0,i.jsx)("span",{"data-slot":"agent-avatar",className:v("relative inline-flex shrink-0 items-center justify-center align-middle",D[t],d),role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,children:p===c?(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:b(s??a?.name??"Agent")}):(0,i.jsx)("img",{src:c,srcSet:u.customAvatarAssetId?void 0:`${h(u,t,2,r,l)} 2x`,alt:"",width:t,height:t,decoding:"async",loading:"lazy",className:"size-full object-contain",onError:o(()=>f(c),"onError")})})}o(ea,"AgentAvatar");export{$ as a,Z as c,b as i,B as l,D as n,K as o,aa as r,Y as s,ea as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
var Ie=Object.defineProperty;var a=(e,n)=>Ie(e,"name",{value:n,configurable:!0});import{i as ae}from"./rolldown-runtime-ZpX3ckPj.js";import{B as re,G as T,Ia as Ae,Ra as Ce,St as b,ht as Se,mi as Ee,na as j,ut as _e,z as $}from"./agent-avatar-url-B91C7fqh.js";import{t as Le}from"./preload-helper-CceJXRIF.js";import{Ln as Me,ct as Te,f as ke,i as K,n as qe,r as ee,s as ie,yt as Pe}from"./BreadcrumbContext-BRKP7-bF.js";import{m as le}from"./alert-dialog-CfwPsmAH.js";import{t as oe}from"./AgentAvatar-B47RVwPt.js";import{t as Re}from"./tabs-CVzr4EnB.js";import{t as te}from"./bot-zBrbL-yH.js";import{i as Be,o as Fe,t as $e}from"./heartbeats-hynzhqu3.js";import{i as Ke,n as De,t as se}from"./environments-x0bu3agB.js";import{t as ne}from"./EmptyState-iwTwakaR.js";import{t as Oe}from"./PageSkeleton-Dl_gWB8z.js";import{Dt as ze,Ft as D,Gt as Ve,Kt as ce,Lt as Ge,Rt as Ue,Vt as He,Wt as Qe,Xt as We,Yt as ue,Zt as Xe,qt as Ye}from"./index-SsNrNOjw.js";var d=ae(Ce(),1),t=ae(Ae(),1),de=Ee,Ze=(0,d.lazy)(()=>Le(()=>import("./index-SsNrNOjw.js").then(e=>e.gt).then(e=>({default:e.ConfigureBuiltInAgentModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]))),Je=["all","active","paused","error","builtin"],et=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"error",label:"Error"},{value:"builtin",label:"Built-in"}];function tt(e){return Je.includes(e)}a(tt,"isFilterTab");var z={label:"Local",detail:"Paperclip host",title:"Local - Paperclip host"},me={label:"—",detail:"Loading environment",title:"Loading environment"},pe=new Set(["terminated","pending_approval"]);function ge(e,n){return n==="all"?!0:n==="active"?e==="active"||e==="running"||e==="idle":n==="paused"?e==="paused":n==="error"?e==="error":!0}a(ge,"matchesFilter");function st(e,n,i){return e.filter(r=>pe.has(r.status)?!1:n==="builtin"?i.has(r.id):ge(r.status,n)).sort((r,o)=>r.name.localeCompare(o.name))}a(st,"filterAgents");function nt(e){const n=e.adapterConfig?.model;if(typeof n!="string")return null;const i=n.trim();return i.length>0?i:null}a(nt,"getConfiguredModel");function at(e){return e==="ssh"?"SSH":e.charAt(0).toUpperCase()+e.slice(1)}a(at,"formatEnvironmentDriver");function rt(e,n){const i=typeof e.config.provider=="string"?e.config.provider.trim():"";return i?n?.sandboxProviders?.[i]?.displayName??i:"Sandbox"}a(rt,"getSandboxProviderLabel");function it(e,n){const i=Ge(e)?"Managed by Paperclip":e.driver==="sandbox"?`${rt(e,n)} sandbox provider`:e.driver==="local"?"Paperclip host":at(e.driver);return{label:e.name,detail:i,title:`${e.name} - ${i}`}}a(it,"describeEnvironment");function lt(e){return{label:"Unknown environment",detail:e.slice(0,8),title:`Unknown environment - ${e}`}}a(lt,"describeMissingEnvironment");function ot(e,n,i,r){const o=e.defaultEnvironmentId??i;if(!o)return z;const m=n.get(o);return m?it(m,r):lt(o)}a(ot,"resolveAgentEnvironment");function xe(e,n,i){return e.reduce((r,o)=>{const m=xe(o.reports,n,i);return pe.has(o.status)?(r.push(...m),r):(((n==="builtin"?i.has(o.id):ge(o.status,n))||m.length>0)&&r.push({...o,reports:m}),r)},[]).sort((r,o)=>r.name.localeCompare(o.name))}a(xe,"filterOrgTree");function wt(){const{selectedCompanyId:e}=Se(),{openNewAgent:n}=Be(),{setBreadcrumbs:i}=qe(),r=ke(),o=Me(),{isMobile:m}=Ke(),N=o.pathname.split("/").pop()??"all",v=tt(N)?N:"all",[S,w]=(0,d.useState)("org"),I=m,l=I?"list":S,{data:u}=j({queryKey:b.instance.settings,queryFn:a(()=>De.get(),"queryFn"),enabled:!!e}),p=u?.experimental.enableBuiltInAgents===!0,f=v==="builtin"&&!p?"all":v,k=(0,d.useMemo)(()=>et.filter(s=>s.value!=="builtin"||p),[p]),{data:h}=j({queryKey:b.builtInAgents.list(e),queryFn:a(()=>We.list(e),"queryFn"),enabled:!!e&&p}),E=(0,d.useMemo)(()=>{const s=new Map;if(!p)return s;for(const c of h??[])c.agentId&&s.set(c.agentId,c);return s},[h,p]),V=(0,d.useMemo)(()=>new Set(E.keys()),[E]),[q,P]=(0,d.useState)(null),{data:g,isLoading:ve,error:G}=j({queryKey:b.agents.list(e),queryFn:a(()=>ee.list(e),"queryFn"),enabled:!!e}),{data:A}=j({queryKey:b.org(e),queryFn:a(()=>ee.org(e),"queryFn"),enabled:!!e&&l==="org"}),_=u?.experimental.enableEnvironments===!0,{data:C}=j({queryKey:b.environments.list(e),queryFn:a(()=>se.list(e),"queryFn"),enabled:!!e&&_}),{data:U}=j({queryKey:b.environments.capabilities(e),queryFn:a(()=>se.capabilities(e),"queryFn"),enabled:!!e&&_}),H=[...b.liveRuns(e),"agents-page"],R=Ve({companyId:e,resourceKey:"live-runs:agents-page",queryKey:H,enabled:!!e,refetchInterval:15e3,leaderOnly:!0}),{data:B,dataUpdatedAt:be}=j({queryKey:H,queryFn:a(()=>$e.liveRunsForCompany(e),"queryFn"),enabled:R.enabled,refetchInterval:R.refetchInterval});Qe(R,B,be);const Q=Ye(e),L=(0,d.useMemo)(()=>{const s=new Map;for(const c of B??[]){if(c.status!=="running"&&c.status!=="queued")continue;const x=s.get(c.agentId);if(x){x.liveCount+=1;continue}s.set(c.agentId,{runId:c.id,liveCount:1})}return s},[B]),je=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,c);return s},[g]),W=(0,d.useMemo)(()=>{const s=new Map;for(const c of C??[])s.set(c.id,c);return s},[C]),X=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,ot(c,W,u?.defaultEnvironmentId??null,U));return s},[g,W,U,u?.defaultEnvironmentId]);if((0,d.useEffect)(()=>{i([{label:"Agents"}])},[i]),(0,d.useEffect)(()=>{e&&v==="builtin"&&u&&!p&&r("/agents/all",{replace:!0})},[p,u,r,v,e]),!e)return(0,t.jsx)(ne,{icon:te,message:"Select a company to view agents."});if(ve)return(0,t.jsx)(Oe,{variant:"list"});const y=st(g??[],f,V),F=xe(A??[],f,V),Y=_&&C===void 0,Z=_&&(C===void 0||C.length>1),ye=a(s=>Y?me:X.get(s)??z,"resolveRenderedEnvironment"),Ne=a(s=>{const c=s.orgChainHealth?.status==="invalid_org_chain",x=E.get(s.id),we=x?.status==="needs_setup"||x?.status==="pending_approval",M=x&&we?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ue,{status:x.status}),x.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(J=>{J.preventDefault(),J.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>P(x),"onClick"),children:"Set up"})})]}):null;return(0,t.jsx)(ze,{title:s.name,titleAccessory:(0,t.jsx)(Xe,{agentId:s.id,companyId:s.companyId}),titleClassName:"flex-1 xl:flex-none xl:w-56",titleTextClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitleClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitle:`${de[s.role]??s.role}${s.title?` - ${s.title}`:""}`,to:re(s),className:T("group",s.pausedAt&&f!=="paused"?"opacity-50":"",ce(Q.data,"agent",s.id)==="left"?"sm:text-foreground/55":""),leading:c?(0,t.jsx)(le,{className:"h-3.5 w-3.5 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:s,size:32}),secondaryRow:M?(0,t.jsx)("div",{className:"xl:hidden flex flex-wrap items-center gap-1.5",children:M}):void 0,meta:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[M&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-1.5",children:M}),(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:s,environment:ye(s.id),showEnvironment:Z})})]}),metaSpacerClassName:"hidden xl:block",trailing:(0,t.jsx)("div",{className:"flex items-center gap-3",children:(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[L.has(s.id)&&(0,t.jsx)(O,{agentRef:$(s),runId:L.get(s.id).runId,liveCount:L.get(s.id).liveCount}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:s.status})})]})})},s.id)},"renderAgentRow");return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Re,{value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange"),children:(0,t.jsx)(He,{items:k,value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange")})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!I&&(0,t.jsxs)("div",{className:"flex items-center border border-border",role:"group","aria-label":"View mode",children:[(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="list"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("list"),"onClick"),title:"List view","aria-label":"List view","aria-pressed":l==="list",children:(0,t.jsx)(Fe,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="org"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("org"),"onClick"),title:"Org chart view","aria-label":"Org chart view","aria-pressed":l==="org",children:(0,t.jsx)(Pe,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)(K,{size:"sm",variant:"outline",onClick:n,children:[(0,t.jsx)(Te,{className:"h-3.5 w-3.5 mr-1.5"}),"New Agent"]})]})]}),y.length>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[y.length," agent",y.length!==1?"s":""]}),G&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:G.message}),g&&g.length===0&&(0,t.jsx)(ne,{icon:te,message:"Create your first agent to get started.",action:"New Agent",onAction:n}),l==="list"&&y.length>0&&(0,t.jsx)("div",{children:y.map(Ne)}),l==="list"&&g&&g.length>0&&y.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&F.length>0&&(0,t.jsx)("div",{className:"py-1",children:F.map(s=>(0,t.jsx)(fe,{node:s,depth:0,agentMap:je,liveRunByAgent:L,environmentByAgentId:X,environmentDataLoading:Y,showEnvironment:Z,tab:f,memberships:Q.data,builtInByAgentId:E,onConfigureBuiltIn:P},s.id))}),l==="org"&&A&&A.length>0&&F.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&A&&A.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No organizational hierarchy defined."}),q&&e&&(0,t.jsx)(d.Suspense,{fallback:null,children:(0,t.jsx)(Ze,{companyId:e,state:q,open:q!==null,onOpenChange:a(s=>{s||P(null)},"onOpenChange")})})]})}a(wt,"Agents");function fe({node:e,depth:n,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I}){const l=i.get(e.id),u=w.get(e.id),p=u?.status==="needs_setup"||u?.status==="pending_approval",f=!!(l&&l.orgChainHealth?.status==="invalid_org_chain"),k=ce(S,"agent",e.id);return(0,t.jsxs)("div",{style:{paddingLeft:n*24},children:[(0,t.jsxs)(ie,{to:l?re(l):`/agents/${e.id}`,className:T("group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50 transition-colors w-full text-left no-underline text-inherit",l?.pausedAt&&v!=="paused"&&"opacity-50",k==="left"&&"sm:text-foreground/55"),children:[f?(0,t.jsx)(le,{className:"h-3.5 w-3.5 shrink-0 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:l??e,size:24}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"min-w-(--sz-7rem) truncate",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[de[e.role]??e.role,l?.title?` - ${l.title}`:""]})]}),u&&p&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(ue,{status:u.status}),u.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(h=>{h.preventDefault(),h.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>I(u),"onClick"),children:"Set up"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,t.jsx)("span",{className:"sm:hidden",children:r.has(e.id)?(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}):(0,t.jsx)(D,{status:e.status})}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[r.has(e.id)&&(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}),l&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:l,environment:m?me:o.get(l.id)??z,showEnvironment:N})}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:e.status})})]})]})]}),e.reports&&e.reports.length>0&&(0,t.jsx)("div",{className:"border-l border-border ml-4",children:e.reports.map(h=>(0,t.jsx)(fe,{node:h,depth:n+1,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I},h.id))})]})}a(fe,"OrgTreeNode");function he({agent:e,environment:n,showEnvironment:i}){const r=nt(e),o=Ue(e.adapterType);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs text-muted-foreground",title:r??void 0,children:r??"—"}),(0,t.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground/70",title:o,children:o})]}),i&&(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",title:n.title,children:n.label}),(0,t.jsx)("div",{className:"truncate text-(length:--text-micro) text-muted-foreground/70",children:n.detail})]}),(0,t.jsx)("span",{className:"w-24 whitespace-nowrap text-right text-xs text-muted-foreground",children:e.lastHeartbeatAt?_e(e.lastHeartbeatAt):"—"})]})}a(he,"AgentMetaColumns");function O({agentRef:e,runId:n,liveCount:i}){return(0,t.jsxs)(ie,{to:`/agents/${e}/runs/${n}`,className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline",onClick:a(r=>r.stopPropagation(),"onClick"),children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),(0,t.jsxs)("span",{className:"text-(length:--text-micro) font-medium text-blue-600 dark:text-blue-400",children:["Live",i>1?` (${i})`:""]})]})}a(O,"LiveRunIndicator");export{wt as Agents};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-gz2G0uzR.js","assets/rolldown-runtime-ZpX3ckPj.js","assets/agent-avatar-url-CVV7dJ4l.js","assets/preload-helper-CceJXRIF.js","assets/BreadcrumbContext-k4_HOBKt.js","assets/label-DQF_gQPD.js","assets/mention-chips-DvkvqPRN.js","assets/dist-C-3WyhwF.js","assets/dist-3gGO9NXy.js","assets/checkbox-DekJl2RJ.js","assets/check-CGphZTSp.js","assets/clipboard-BftXMlFg.js","assets/RoutineRunVariablesDialog-CMNeR6VZ.js","assets/alert-dialog-DKXtvS0x.js","assets/AgentAvatar-J8HJgoSh.js","assets/MarkdownEditor-BlZgaClg.js","assets/dist-BLP096hU.js","assets/dist-BhxPxuMy.js","assets/StatusIcon-fJLmzCDW.js","assets/badge-Kf867ezN.js","assets/bot-CaRghtif.js","assets/select-D6aktlIu.js","assets/ToastContext-CIri5s-I.js","assets/sheet-C7Sbfc1a.js","assets/heartbeats-D8FQfEVO.js","assets/useHiddenSettings-gzjlybPM.js","assets/health-2HA6WpUS.js","assets/rotate-ccw-ChQUphBj.js","assets/environments-B0xY4RYs.js","assets/input-BXe2NHXn.js","assets/company-members-BmKruwkU.js","assets/card-BA46vwjn.js","assets/EmptyState-NmkkuFFc.js","assets/PageSkeleton-Bk-YktL6.js","assets/skeleton-C4VrwCAM.js","assets/tabs-CFRGyc3-.js","assets/use-adapter-capabilities-1OSpmnRd.js","assets/use-copy-action-C4qGxoRm.js","assets/arrow-right-ELUE1rER.js","assets/external-link-CRVf_Q8M.js","assets/MarkdownBody-DZY1Poyt.js","assets/file-text-BKI87XaT.js","assets/index-B2A-dAWv.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Ie=Object.defineProperty;var a=(e,n)=>Ie(e,"name",{value:n,configurable:!0});import{i as ae}from"./rolldown-runtime-ZpX3ckPj.js";import{B as re,G as T,Ia as Ae,Ra as Ce,St as b,ht as Se,mi as Ee,na as j,ut as _e,z as $}from"./agent-avatar-url-CVV7dJ4l.js";import{t as Le}from"./preload-helper-CceJXRIF.js";import{Ln as Me,ct as Te,f as ke,i as K,n as qe,r as ee,s as ie,yt as Pe}from"./BreadcrumbContext-k4_HOBKt.js";import{m as le}from"./alert-dialog-DKXtvS0x.js";import{t as oe}from"./AgentAvatar-J8HJgoSh.js";import{t as Re}from"./tabs-CFRGyc3-.js";import{t as te}from"./bot-CaRghtif.js";import{i as Be,o as Fe,t as $e}from"./heartbeats-D8FQfEVO.js";import{i as Ke,n as De,t as se}from"./environments-B0xY4RYs.js";import{t as ne}from"./EmptyState-NmkkuFFc.js";import{t as Oe}from"./PageSkeleton-Bk-YktL6.js";import{Dt as ze,Ft as D,Gt as Ve,Kt as ce,Lt as Ge,Rt as Ue,Vt as He,Wt as Qe,Xt as We,Yt as ue,Zt as Xe,qt as Ye}from"./index-gz2G0uzR.js";var d=ae(Ce(),1),t=ae(Ae(),1),de=Ee,Ze=(0,d.lazy)(()=>Le(()=>import("./index-gz2G0uzR.js").then(e=>e.gt).then(e=>({default:e.ConfigureBuiltInAgentModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]))),Je=["all","active","paused","error","builtin"],et=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"error",label:"Error"},{value:"builtin",label:"Built-in"}];function tt(e){return Je.includes(e)}a(tt,"isFilterTab");var z={label:"Local",detail:"Paperclip host",title:"Local - Paperclip host"},me={label:"—",detail:"Loading environment",title:"Loading environment"},pe=new Set(["terminated","pending_approval"]);function ge(e,n){return n==="all"?!0:n==="active"?e==="active"||e==="running"||e==="idle":n==="paused"?e==="paused":n==="error"?e==="error":!0}a(ge,"matchesFilter");function st(e,n,i){return e.filter(r=>pe.has(r.status)?!1:n==="builtin"?i.has(r.id):ge(r.status,n)).sort((r,o)=>r.name.localeCompare(o.name))}a(st,"filterAgents");function nt(e){const n=e.adapterConfig?.model;if(typeof n!="string")return null;const i=n.trim();return i.length>0?i:null}a(nt,"getConfiguredModel");function at(e){return e==="ssh"?"SSH":e.charAt(0).toUpperCase()+e.slice(1)}a(at,"formatEnvironmentDriver");function rt(e,n){const i=typeof e.config.provider=="string"?e.config.provider.trim():"";return i?n?.sandboxProviders?.[i]?.displayName??i:"Sandbox"}a(rt,"getSandboxProviderLabel");function it(e,n){const i=Ge(e)?"Managed by Paperclip":e.driver==="sandbox"?`${rt(e,n)} sandbox provider`:e.driver==="local"?"Paperclip host":at(e.driver);return{label:e.name,detail:i,title:`${e.name} - ${i}`}}a(it,"describeEnvironment");function lt(e){return{label:"Unknown environment",detail:e.slice(0,8),title:`Unknown environment - ${e}`}}a(lt,"describeMissingEnvironment");function ot(e,n,i,r){const o=e.defaultEnvironmentId??i;if(!o)return z;const m=n.get(o);return m?it(m,r):lt(o)}a(ot,"resolveAgentEnvironment");function xe(e,n,i){return e.reduce((r,o)=>{const m=xe(o.reports,n,i);return pe.has(o.status)?(r.push(...m),r):(((n==="builtin"?i.has(o.id):ge(o.status,n))||m.length>0)&&r.push({...o,reports:m}),r)},[]).sort((r,o)=>r.name.localeCompare(o.name))}a(xe,"filterOrgTree");function wt(){const{selectedCompanyId:e}=Se(),{openNewAgent:n}=Be(),{setBreadcrumbs:i}=qe(),r=ke(),o=Me(),{isMobile:m}=Ke(),N=o.pathname.split("/").pop()??"all",v=tt(N)?N:"all",[S,w]=(0,d.useState)("org"),I=m,l=I?"list":S,{data:u}=j({queryKey:b.instance.settings,queryFn:a(()=>De.get(),"queryFn"),enabled:!!e}),p=u?.experimental.enableBuiltInAgents===!0,f=v==="builtin"&&!p?"all":v,k=(0,d.useMemo)(()=>et.filter(s=>s.value!=="builtin"||p),[p]),{data:h}=j({queryKey:b.builtInAgents.list(e),queryFn:a(()=>We.list(e),"queryFn"),enabled:!!e&&p}),E=(0,d.useMemo)(()=>{const s=new Map;if(!p)return s;for(const c of h??[])c.agentId&&s.set(c.agentId,c);return s},[h,p]),V=(0,d.useMemo)(()=>new Set(E.keys()),[E]),[q,P]=(0,d.useState)(null),{data:g,isLoading:ve,error:G}=j({queryKey:b.agents.list(e),queryFn:a(()=>ee.list(e),"queryFn"),enabled:!!e}),{data:A}=j({queryKey:b.org(e),queryFn:a(()=>ee.org(e),"queryFn"),enabled:!!e&&l==="org"}),_=u?.experimental.enableEnvironments===!0,{data:C}=j({queryKey:b.environments.list(e),queryFn:a(()=>se.list(e),"queryFn"),enabled:!!e&&_}),{data:U}=j({queryKey:b.environments.capabilities(e),queryFn:a(()=>se.capabilities(e),"queryFn"),enabled:!!e&&_}),H=[...b.liveRuns(e),"agents-page"],R=Ve({companyId:e,resourceKey:"live-runs:agents-page",queryKey:H,enabled:!!e,refetchInterval:15e3,leaderOnly:!0}),{data:B,dataUpdatedAt:be}=j({queryKey:H,queryFn:a(()=>$e.liveRunsForCompany(e),"queryFn"),enabled:R.enabled,refetchInterval:R.refetchInterval});Qe(R,B,be);const Q=Ye(e),L=(0,d.useMemo)(()=>{const s=new Map;for(const c of B??[]){if(c.status!=="running"&&c.status!=="queued")continue;const x=s.get(c.agentId);if(x){x.liveCount+=1;continue}s.set(c.agentId,{runId:c.id,liveCount:1})}return s},[B]),je=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,c);return s},[g]),W=(0,d.useMemo)(()=>{const s=new Map;for(const c of C??[])s.set(c.id,c);return s},[C]),X=(0,d.useMemo)(()=>{const s=new Map;for(const c of g??[])s.set(c.id,ot(c,W,u?.defaultEnvironmentId??null,U));return s},[g,W,U,u?.defaultEnvironmentId]);if((0,d.useEffect)(()=>{i([{label:"Agents"}])},[i]),(0,d.useEffect)(()=>{e&&v==="builtin"&&u&&!p&&r("/agents/all",{replace:!0})},[p,u,r,v,e]),!e)return(0,t.jsx)(ne,{icon:te,message:"Select a company to view agents."});if(ve)return(0,t.jsx)(Oe,{variant:"list"});const y=st(g??[],f,V),F=xe(A??[],f,V),Y=_&&C===void 0,Z=_&&(C===void 0||C.length>1),ye=a(s=>Y?me:X.get(s)??z,"resolveRenderedEnvironment"),Ne=a(s=>{const c=s.orgChainHealth?.status==="invalid_org_chain",x=E.get(s.id),we=x?.status==="needs_setup"||x?.status==="pending_approval",M=x&&we?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ue,{status:x.status}),x.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(J=>{J.preventDefault(),J.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>P(x),"onClick"),children:"Set up"})})]}):null;return(0,t.jsx)(ze,{title:s.name,titleAccessory:(0,t.jsx)(Xe,{agentId:s.id,companyId:s.companyId}),titleClassName:"flex-1 xl:flex-none xl:w-56",titleTextClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitleClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitle:`${de[s.role]??s.role}${s.title?` - ${s.title}`:""}`,to:re(s),className:T("group",s.pausedAt&&f!=="paused"?"opacity-50":"",ce(Q.data,"agent",s.id)==="left"?"sm:text-foreground/55":""),leading:c?(0,t.jsx)(le,{className:"h-3.5 w-3.5 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:s,size:32}),secondaryRow:M?(0,t.jsx)("div",{className:"xl:hidden flex flex-wrap items-center gap-1.5",children:M}):void 0,meta:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[M&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-1.5",children:M}),(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:s,environment:ye(s.id),showEnvironment:Z})})]}),metaSpacerClassName:"hidden xl:block",trailing:(0,t.jsx)("div",{className:"flex items-center gap-3",children:(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[L.has(s.id)&&(0,t.jsx)(O,{agentRef:$(s),runId:L.get(s.id).runId,liveCount:L.get(s.id).liveCount}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:s.status})})]})})},s.id)},"renderAgentRow");return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Re,{value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange"),children:(0,t.jsx)(He,{items:k,value:f,onValueChange:a(s=>r(`/agents/${s}`),"onValueChange")})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!I&&(0,t.jsxs)("div",{className:"flex items-center border border-border",role:"group","aria-label":"View mode",children:[(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="list"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("list"),"onClick"),title:"List view","aria-label":"List view","aria-pressed":l==="list",children:(0,t.jsx)(Fe,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:T("p-1.5 transition-colors",l==="org"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:a(()=>w("org"),"onClick"),title:"Org chart view","aria-label":"Org chart view","aria-pressed":l==="org",children:(0,t.jsx)(Pe,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)(K,{size:"sm",variant:"outline",onClick:n,children:[(0,t.jsx)(Te,{className:"h-3.5 w-3.5 mr-1.5"}),"New Agent"]})]})]}),y.length>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[y.length," agent",y.length!==1?"s":""]}),G&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:G.message}),g&&g.length===0&&(0,t.jsx)(ne,{icon:te,message:"Create your first agent to get started.",action:"New Agent",onAction:n}),l==="list"&&y.length>0&&(0,t.jsx)("div",{children:y.map(Ne)}),l==="list"&&g&&g.length>0&&y.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&F.length>0&&(0,t.jsx)("div",{className:"py-1",children:F.map(s=>(0,t.jsx)(fe,{node:s,depth:0,agentMap:je,liveRunByAgent:L,environmentByAgentId:X,environmentDataLoading:Y,showEnvironment:Z,tab:f,memberships:Q.data,builtInByAgentId:E,onConfigureBuiltIn:P},s.id))}),l==="org"&&A&&A.length>0&&F.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),l==="org"&&A&&A.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No organizational hierarchy defined."}),q&&e&&(0,t.jsx)(d.Suspense,{fallback:null,children:(0,t.jsx)(Ze,{companyId:e,state:q,open:q!==null,onOpenChange:a(s=>{s||P(null)},"onOpenChange")})})]})}a(wt,"Agents");function fe({node:e,depth:n,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I}){const l=i.get(e.id),u=w.get(e.id),p=u?.status==="needs_setup"||u?.status==="pending_approval",f=!!(l&&l.orgChainHealth?.status==="invalid_org_chain"),k=ce(S,"agent",e.id);return(0,t.jsxs)("div",{style:{paddingLeft:n*24},children:[(0,t.jsxs)(ie,{to:l?re(l):`/agents/${e.id}`,className:T("group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50 transition-colors w-full text-left no-underline text-inherit",l?.pausedAt&&v!=="paused"&&"opacity-50",k==="left"&&"sm:text-foreground/55"),children:[f?(0,t.jsx)(le,{className:"h-3.5 w-3.5 shrink-0 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(oe,{agent:l??e,size:24}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"min-w-(--sz-7rem) truncate",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[de[e.role]??e.role,l?.title?` - ${l.title}`:""]})]}),u&&p&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(ue,{status:u.status}),u.status==="needs_setup"&&(0,t.jsx)("span",{onClick:a(h=>{h.preventDefault(),h.stopPropagation()},"onClick"),children:(0,t.jsx)(K,{size:"xs",variant:"outline",onClick:a(()=>I(u),"onClick"),children:"Set up"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,t.jsx)("span",{className:"sm:hidden",children:r.has(e.id)?(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}):(0,t.jsx)(D,{status:e.status})}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[r.has(e.id)&&(0,t.jsx)(O,{agentRef:l?$(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}),l&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(he,{agent:l,environment:m?me:o.get(l.id)??z,showEnvironment:N})}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(D,{status:e.status})})]})]})]}),e.reports&&e.reports.length>0&&(0,t.jsx)("div",{className:"border-l border-border ml-4",children:e.reports.map(h=>(0,t.jsx)(fe,{node:h,depth:n+1,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:m,showEnvironment:N,tab:v,memberships:S,builtInByAgentId:w,onConfigureBuiltIn:I},h.id))})]})}a(fe,"OrgTreeNode");function he({agent:e,environment:n,showEnvironment:i}){const r=nt(e),o=Ue(e.adapterType);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs text-muted-foreground",title:r??void 0,children:r??"—"}),(0,t.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground/70",title:o,children:o})]}),i&&(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",title:n.title,children:n.label}),(0,t.jsx)("div",{className:"truncate text-(length:--text-micro) text-muted-foreground/70",children:n.detail})]}),(0,t.jsx)("span",{className:"w-24 whitespace-nowrap text-right text-xs text-muted-foreground",children:e.lastHeartbeatAt?_e(e.lastHeartbeatAt):"—"})]})}a(he,"AgentMetaColumns");function O({agentRef:e,runId:n,liveCount:i}){return(0,t.jsxs)(ie,{to:`/agents/${e}/runs/${n}`,className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline",onClick:a(r=>r.stopPropagation(),"onClick"),children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),(0,t.jsxs)("span",{className:"text-(length:--text-micro) font-medium text-blue-600 dark:text-blue-400",children:["Live",i>1?` (${i})`:""]})]})}a(O,"LiveRunIndicator");export{wt as Agents};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var On=Object.defineProperty;var a=(e,t)=>On(e,"name",{value:t,configurable:!0});import{i as jt}from"./rolldown-runtime-ZpX3ckPj.js";import{Er as st,Fa as jn,G as K,Hi as d,Ia as Bn,P as Nn,Ra as zn,St as de,Tr as Fn,Ui as qn,Vi as Bt,Wi as Hn,a as Wn,c as Vn,ht as Kn,ji as Qn,l as Jn,n as k,na as Gn,pt as Yn,r as Zn,t as Xn,u as ea}from"./agent-avatar-url-B91C7fqh.js";import{t as ta}from"./preload-helper-CceJXRIF.js";var l=jt(zn(),1),We=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Nt=/^[\\/]{2}/;function ra(e,t){return t+e.replace(/\\/g,"/")}a(ra,"normalizeProtocolRelativeUrl");var it="popstate";function lt(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}a(lt,"isLocation");function na(e={}){function t(n,o){let s=o.state?.masked,{pathname:i,search:u,hash:c}=s||n.location;return Oe("",{pathname:i,search:u,hash:c},o.state&&o.state.usr||null,o.state&&o.state.key||"default",s?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}a(t,"createBrowserLocation");function r(n,o){return typeof o=="string"?o:Q(o)}return a(r,"createBrowserHref"),oa(t,r,null,e)}a(na,"createBrowserHistory");function $(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}a($,"invariant");function M(e,t){if(!e)try{throw new Error(t)}catch{}}a(M,"warning");function aa(){return Math.random().toString(36).substring(2,10)}a(aa,"createKey");function ut(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}a(ut,"getHistoryState");function Oe(e,t,r=null,n,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?te(t):t,state:r,key:t&&t.key||n||aa(),mask:o}}a(Oe,"createLocation");function Q({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}a(Q,"createPath");function te(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}a(te,"parsePath");function oa(e,t,r,n={}){let{window:o=document.defaultView,v5Compat:s=!1}=n,i=o.history,u="POP",c=null,m=p();m==null&&(m=0,i.replaceState({...i.state,idx:m},""));function p(){return(i.state||{idx:null}).idx}a(p,"getIndex");function f(){u="POP";let h=p(),x=h==null?null:h-m;m=h,c&&c({action:u,location:y.location,delta:x})}a(f,"handlePop");function g(h,x){u="PUSH";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p()+1;let I=ut(w,m),_=y.createHref(w.mask||w);try{i.pushState(I,"",_)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;o.location.assign(_)}s&&c&&c({action:u,location:y.location,delta:1})}a(g,"push");function b(h,x){u="REPLACE";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p();let I=ut(w,m),_=y.createHref(w.mask||w);i.replaceState(I,"",_),s&&c&&c({action:u,location:y.location,delta:0})}a(b,"replace2");function v(h){return sa(o,h)}a(v,"createURL");let y={get action(){return u},get location(){return e(o,i)},listen(h){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(it,f),c=h,()=>{o.removeEventListener(it,f),c=null}},createHref(h){return t(o,h)},createURL:v,encodeLocation(h){let x=v(h);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:g,replace:b,go(h){return i.go(h)}};return y}a(oa,"getUrlBasedHistory");function sa(e,t,r=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),$(n,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Q(t);return o=o.replace(/ $/,"%20"),!r&&Nt.test(o)&&(o=n+o),new URL(o,n)}a(sa,"createBrowserURLImpl");var ia;ia=new WeakMap;function zt(e,t,r="/"){return Ft(e,t,r,!1)}a(zt,"matchRoutes");function Ft(e,t,r,n,o){let s=q((typeof t=="string"?te(t):t).pathname||"/",r);if(s==null)return null;let i=o??ua(e),u=null,c=ka(s);for(let m=0;u==null&&m<i.length;++m)u=ba(i[m],c,n);return u}a(Ft,"matchRoutesImpl");function la(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],loaderData:t[r.id],handle:r.handle}}a(la,"convertRouteMatchToUiMatch");function ua(e){let t=qt(e);return ca(t),t}a(ua,"flattenAndRankRoutes");function qt(e,t=[],r=[],n="",o=!1){let s=a((i,u,c=o,m)=>{let p={relativePath:m===void 0?i.path||"":m,caseSensitive:i.caseSensitive===!0,childrenIndex:u,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&c)return;$(p.relativePath.startsWith(n),`Absolute route path "${p.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(n.length)}let f=B([n,p.relativePath]),g=r.concat(p);i.children&&i.children.length>0&&($(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),qt(i.children,t,g,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:ya(f,i.index),routesMeta:g.map((b,v)=>{let[y,h]=Vt(b.relativePath,b.caseSensitive,v===g.length-1);return{...b,matcher:y,compiledParams:h}})})},"flattenRoute");return e.forEach((i,u)=>{if(i.path===""||!i.path?.includes("?"))s(i,u);else for(let c of Ht(i.path))s(i,u,!0,c)}),t}a(qt,"flattenRoutes");function Ht(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return o?[s,""]:[s];let i=Ht(n.join("/")),u=[];return u.push(...i.map(c=>c===""?s:[s,c].join("/"))),o&&u.push(...i),u.map(c=>e.startsWith("/")&&c===""?"/":c)}a(Ht,"explodeOptionalSegments");function ca(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:va(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}a(ca,"rankRouteBranches");var da=/^:[\w-]+$/,ma=3,fa=2,pa=1,ha=10,ga=-2,ct=a(e=>e==="*","isSplat");function ya(e,t){let r=e.split("/"),n=r.length;return r.some(ct)&&(n+=ga),t&&(n+=fa),r.filter(o=>!ct(o)).reduce((o,s)=>o+(da.test(s)?ma:s===""?pa:ha),n)}a(ya,"computeScore");function va(e,t){return e.length===t.length&&e.slice(0,-1).every((r,n)=>r===t[n])?e[e.length-1]-t[t.length-1]:0}a(va,"compareIndexes");function ba(e,t,r=!1){let{routesMeta:n}=e,o={},s="/",i=[];for(let u=0;u<n.length;++u){let c=n[u],m=u===n.length-1,p=s==="/"?t:t.slice(s.length)||"/",f={path:c.relativePath,caseSensitive:c.caseSensitive,end:m},g=c.matcher&&c.compiledParams?Wt(f,p,c.matcher,c.compiledParams):xe(f,p),b=c.route;if(!g&&m&&r&&!n[n.length-1].route.index&&(g=xe({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},p)),!g)return null;Object.assign(o,g.params),i.push({params:o,pathname:B([s,g.pathname]),pathnameBase:Ia(B([s,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(s=B([s,g.pathnameBase]))}return i}a(ba,"matchRouteBranch");function xe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Vt(e.path,e.caseSensitive,e.end);return Wt(e,t,r,n)}a(xe,"matchPath");function Wt(e,t,r,n){let o=t.match(r);if(!o)return null;let s=o[0],i=X(s,1),u=o.slice(1);return{params:n.reduce((c,{paramName:m,isOptional:p},f)=>{if(m==="*"){let b=u[f]||"";i=X(s.slice(0,s.length-b.length),1)}const g=u[f];return p&&!g?c[m]=void 0:c[m]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:e}}a(Wt,"matchPathImpl");function Vt(e,t=!1,r=!0){M(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,i,u,c,m)=>{if(n.push({paramName:i,isOptional:u!=null}),u){let p=m.charAt(c+s.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}a(Vt,"compilePath");function ka(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}a(ka,"decodePath");function q(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}a(q,"stripBasename");function xa(e,t="/"){let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?te(e):e,s;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?s=dt(r.substring(1),"/"):s=dt(r,t)):s=t,{pathname:s,search:Sa(n),hash:Ra(o)}}a(xa,"resolvePath");function dt(e,t){let r=X(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}a(dt,"resolvePathname");function Le(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}a(Le,"getInvalidPathError");function wa(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}a(wa,"getPathContributingMatches");function Ve(e){let t=wa(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}a(Ve,"getResolveToMatches");function Re(e,t,r,n=!1){let o;typeof e=="string"?o=te(e):(o={...e},$(!o.pathname||!o.pathname.includes("?"),Le("?","pathname","search",o)),$(!o.pathname||!o.pathname.includes("#"),Le("#","pathname","hash",o)),$(!o.search||!o.search.includes("#"),Le("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.pathname,u;if(i==null)u=r;else{let f=t.length-1;if(!n&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),f-=1;o.pathname=g.join("/")}u=f>=0?t[f]:"/"}let c=xa(o,u),m=i&&i!=="/"&&i.endsWith("/"),p=(s||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(m||p)&&(c.pathname+="/"),c}a(Re,"resolveTo$1");var Kt=a(e=>e.replace(/[\\/]{2,}/g,"/"),"removeDoubleSlashes"),B=a(e=>Kt(e.join("/")),"joinPaths");function X(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}a(X,"removeTrailingSlash");var Ia=a(e=>X(e).replace(/^\/*/,"/"),"normalizePathname"),Sa=a(e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,"normalizeSearch"),Ra=a(e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,"normalizeHash"),Ca=class{static{a(this,"ErrorResponseImpl")}constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Qt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}a(Qt,"isRouteErrorResponse");function Ea(e){return B(e.map(t=>t.route.path).filter(Boolean))||"/"}a(Ea,"getRoutePattern");var Jt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gt(e,t){let r=e;if(typeof r!="string"||!We.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,o=!1;if(Jt)try{let s=new URL(window.location.href),i=Nt.test(r)?new URL(ra(r,s.protocol)):new URL(r),u=q(i.pathname,t);i.origin===s.origin&&u!=null?r=u+i.search+i.hash:o=!0}catch{M(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:o,to:r}}a(Gt,"parseToInfo");var Ji=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),mt=new URL("http://localhost");function Ke(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),mt)}catch{return mt}}a(Ke,"getNavigatorCurrentUrl");function Me(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}a(Me,"isSameOrigin");function $a(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}a($a,"isExplicitUrl");function Qe(e,t,r,n){let o=null;try{o=e==null?null:new URL(e,r)}catch{}let s=new URL(t,r),i=o!=null&&!Me(o,r),u=!Me(s,r);if(n==="reject"){if(i||u)throw new Error("External navigation is not allowed")}else if(u&&(o==null||!$a(e,o)||!Me(o,s)))throw new Error("External navigation is not allowed")}a(Qe,"validateNavigationTarget");var Yt=["POST","PUT","PATCH","DELETE"],Gi=new Set(Yt),_a=["GET",...Yt],Yi=new Set(_a),Aa,Da,Pa,La;Aa=new WeakMap;Da=new WeakMap;Pa=new WeakMap;La=new WeakMap;var Ma=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Ta(e){try{return Ma.includes(new URL(e).protocol)}catch{return!1}}a(Ta,"hasInvalidProtocol");var re=l.createContext(null);re.displayName="DataRouter";var me=l.createContext(null);me.displayName="DataRouterState";var Zt=l.createContext(!1);function Xt(){return l.useContext(Zt)}a(Xt,"useIsRSCRouterContext");var er=l.createContext({isTransitioning:!1});er.displayName="ViewTransition";var Ua=l.createContext(new Map);Ua.displayName="Fetchers";var je=l.createContext(null);je.displayName="Await";var P=l.createContext(null);P.displayName="Navigation";var ne=l.createContext(null);ne.displayName="Location";var O=l.createContext({outlet:null,matches:[],isDataRoute:!1});O.displayName="Route";var Je=l.createContext(null);Je.displayName="RouteError";var tr="REACT_ROUTER_ERROR",Oa="REDIRECT",ja="ROUTE_ERROR_RESPONSE";function Ba(e){if(e.startsWith(`${tr}:${Oa}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}a(Ba,"decodeRedirectErrorDigest");function Na(e){if(e.startsWith(`${tr}:${ja}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ca(t.status,t.statusText,t.data)}catch{}}a(Na,"decodeRouteErrorResponseDigest");function za(e,{relative:t}={}){$(ae(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=l.useContext(P),{hash:o,pathname:s,search:i}=fe(e,{relative:t}),u=s;return r!=="/"&&(u=s==="/"?r:B([r,s])),n.createHref({pathname:u,search:i,hash:o})}a(za,"useHref");function ae(){return l.useContext(ne)!=null}a(ae,"useInRouterContext");function T(){return $(ae(),"useLocation() may be used only in the context of a <Router> component."),l.useContext(ne).location}a(T,"useLocation");function Zi(){return l.useContext(ne).navigationType}a(Zi,"useNavigationType");var rr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){l.useContext(P).static||l.useLayoutEffect(e)}a(nr,"useIsomorphicLayoutEffect");function Ce(){let{isDataRoute:e}=l.useContext(O);return e?no():Fa()}a(Ce,"useNavigate$1");function Fa(){$(ae(),"useNavigate() may be used only in the context of a <Router> component.");let e=l.useContext(re),{basename:t,navigator:r}=l.useContext(P),{matches:n}=l.useContext(O),{pathname:o}=T(),s=JSON.stringify(Ve(n)),i=l.useRef(!1);return nr(()=>{i.current=!0}),l.useCallback((u,c={})=>{if(M(i.current,rr),!i.current)return;if(typeof u=="number"){r.go(u);return}let m=Re(u,JSON.parse(s),o,c.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:B([t,m.pathname])),Qe(typeof u=="string"?u:Q(u),r.createHref(m),Ke(r),"reject"),(c.replace?r.replace:r.push)(m,c.state,c)},[t,r,s,o,e])}a(Fa,"useNavigateUnstable");var qa=l.createContext(null);function Ha(e){let t=l.useContext(O).outlet;return l.useMemo(()=>t&&l.createElement(qa.Provider,{value:e},t),[t,e])}a(Ha,"useOutlet");function Wa(){let{matches:e}=l.useContext(O);return e[e.length-1]?.params??{}}a(Wa,"useParams");function fe(e,{relative:t}={}){let{matches:r}=l.useContext(O),{pathname:n}=T(),o=JSON.stringify(Ve(r));return l.useMemo(()=>Re(e,JSON.parse(o),n,t==="path"),[e,o,n,t])}a(fe,"useResolvedPath");function Va(e,t){return ar(e,t)}a(Va,"useRoutes");function ar(e,t,r){$(ae(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=l.useContext(P),{matches:o}=l.useContext(O),s=o[o.length-1],i=s?s.params:{},u=s?s.pathname:"/",c=s?s.pathnameBase:"/",m=s&&s.route;{let h=m&&m.path||"";ir(u,!m||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
var On=Object.defineProperty;var a=(e,t)=>On(e,"name",{value:t,configurable:!0});import{i as jt}from"./rolldown-runtime-ZpX3ckPj.js";import{Er as st,Fa as jn,G as K,Hi as d,Ia as Bn,P as Nn,Ra as zn,St as de,Tr as Fn,Ui as qn,Vi as Bt,Wi as Hn,a as Wn,c as Vn,ht as Kn,ji as Qn,l as Jn,n as k,na as Gn,pt as Yn,r as Zn,t as Xn,u as ea}from"./agent-avatar-url-CVV7dJ4l.js";import{t as ta}from"./preload-helper-CceJXRIF.js";var l=jt(zn(),1),We=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Nt=/^[\\/]{2}/;function ra(e,t){return t+e.replace(/\\/g,"/")}a(ra,"normalizeProtocolRelativeUrl");var it="popstate";function lt(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}a(lt,"isLocation");function na(e={}){function t(n,o){let s=o.state?.masked,{pathname:i,search:u,hash:c}=s||n.location;return Oe("",{pathname:i,search:u,hash:c},o.state&&o.state.usr||null,o.state&&o.state.key||"default",s?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}a(t,"createBrowserLocation");function r(n,o){return typeof o=="string"?o:Q(o)}return a(r,"createBrowserHref"),oa(t,r,null,e)}a(na,"createBrowserHistory");function $(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}a($,"invariant");function M(e,t){if(!e)try{throw new Error(t)}catch{}}a(M,"warning");function aa(){return Math.random().toString(36).substring(2,10)}a(aa,"createKey");function ut(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}a(ut,"getHistoryState");function Oe(e,t,r=null,n,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?te(t):t,state:r,key:t&&t.key||n||aa(),mask:o}}a(Oe,"createLocation");function Q({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}a(Q,"createPath");function te(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}a(te,"parsePath");function oa(e,t,r,n={}){let{window:o=document.defaultView,v5Compat:s=!1}=n,i=o.history,u="POP",c=null,m=p();m==null&&(m=0,i.replaceState({...i.state,idx:m},""));function p(){return(i.state||{idx:null}).idx}a(p,"getIndex");function f(){u="POP";let h=p(),x=h==null?null:h-m;m=h,c&&c({action:u,location:y.location,delta:x})}a(f,"handlePop");function g(h,x){u="PUSH";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p()+1;let I=ut(w,m),_=y.createHref(w.mask||w);try{i.pushState(I,"",_)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;o.location.assign(_)}s&&c&&c({action:u,location:y.location,delta:1})}a(g,"push");function b(h,x){u="REPLACE";let w=lt(h)?h:Oe(y.location,h,x);r&&r(w,h),m=p();let I=ut(w,m),_=y.createHref(w.mask||w);i.replaceState(I,"",_),s&&c&&c({action:u,location:y.location,delta:0})}a(b,"replace2");function v(h){return sa(o,h)}a(v,"createURL");let y={get action(){return u},get location(){return e(o,i)},listen(h){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(it,f),c=h,()=>{o.removeEventListener(it,f),c=null}},createHref(h){return t(o,h)},createURL:v,encodeLocation(h){let x=v(h);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:g,replace:b,go(h){return i.go(h)}};return y}a(oa,"getUrlBasedHistory");function sa(e,t,r=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),$(n,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Q(t);return o=o.replace(/ $/,"%20"),!r&&Nt.test(o)&&(o=n+o),new URL(o,n)}a(sa,"createBrowserURLImpl");var ia;ia=new WeakMap;function zt(e,t,r="/"){return Ft(e,t,r,!1)}a(zt,"matchRoutes");function Ft(e,t,r,n,o){let s=q((typeof t=="string"?te(t):t).pathname||"/",r);if(s==null)return null;let i=o??ua(e),u=null,c=ka(s);for(let m=0;u==null&&m<i.length;++m)u=ba(i[m],c,n);return u}a(Ft,"matchRoutesImpl");function la(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],loaderData:t[r.id],handle:r.handle}}a(la,"convertRouteMatchToUiMatch");function ua(e){let t=qt(e);return ca(t),t}a(ua,"flattenAndRankRoutes");function qt(e,t=[],r=[],n="",o=!1){let s=a((i,u,c=o,m)=>{let p={relativePath:m===void 0?i.path||"":m,caseSensitive:i.caseSensitive===!0,childrenIndex:u,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(n)&&c)return;$(p.relativePath.startsWith(n),`Absolute route path "${p.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(n.length)}let f=B([n,p.relativePath]),g=r.concat(p);i.children&&i.children.length>0&&($(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),qt(i.children,t,g,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:ya(f,i.index),routesMeta:g.map((b,v)=>{let[y,h]=Vt(b.relativePath,b.caseSensitive,v===g.length-1);return{...b,matcher:y,compiledParams:h}})})},"flattenRoute");return e.forEach((i,u)=>{if(i.path===""||!i.path?.includes("?"))s(i,u);else for(let c of Ht(i.path))s(i,u,!0,c)}),t}a(qt,"flattenRoutes");function Ht(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return o?[s,""]:[s];let i=Ht(n.join("/")),u=[];return u.push(...i.map(c=>c===""?s:[s,c].join("/"))),o&&u.push(...i),u.map(c=>e.startsWith("/")&&c===""?"/":c)}a(Ht,"explodeOptionalSegments");function ca(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:va(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}a(ca,"rankRouteBranches");var da=/^:[\w-]+$/,ma=3,fa=2,pa=1,ha=10,ga=-2,ct=a(e=>e==="*","isSplat");function ya(e,t){let r=e.split("/"),n=r.length;return r.some(ct)&&(n+=ga),t&&(n+=fa),r.filter(o=>!ct(o)).reduce((o,s)=>o+(da.test(s)?ma:s===""?pa:ha),n)}a(ya,"computeScore");function va(e,t){return e.length===t.length&&e.slice(0,-1).every((r,n)=>r===t[n])?e[e.length-1]-t[t.length-1]:0}a(va,"compareIndexes");function ba(e,t,r=!1){let{routesMeta:n}=e,o={},s="/",i=[];for(let u=0;u<n.length;++u){let c=n[u],m=u===n.length-1,p=s==="/"?t:t.slice(s.length)||"/",f={path:c.relativePath,caseSensitive:c.caseSensitive,end:m},g=c.matcher&&c.compiledParams?Wt(f,p,c.matcher,c.compiledParams):xe(f,p),b=c.route;if(!g&&m&&r&&!n[n.length-1].route.index&&(g=xe({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},p)),!g)return null;Object.assign(o,g.params),i.push({params:o,pathname:B([s,g.pathname]),pathnameBase:Ia(B([s,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(s=B([s,g.pathnameBase]))}return i}a(ba,"matchRouteBranch");function xe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Vt(e.path,e.caseSensitive,e.end);return Wt(e,t,r,n)}a(xe,"matchPath");function Wt(e,t,r,n){let o=t.match(r);if(!o)return null;let s=o[0],i=X(s,1),u=o.slice(1);return{params:n.reduce((c,{paramName:m,isOptional:p},f)=>{if(m==="*"){let b=u[f]||"";i=X(s.slice(0,s.length-b.length),1)}const g=u[f];return p&&!g?c[m]=void 0:c[m]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:e}}a(Wt,"matchPathImpl");function Vt(e,t=!1,r=!0){M(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,i,u,c,m)=>{if(n.push({paramName:i,isOptional:u!=null}),u){let p=m.charAt(c+s.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}a(Vt,"compilePath");function ka(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}a(ka,"decodePath");function q(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}a(q,"stripBasename");function xa(e,t="/"){let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?te(e):e,s;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?s=dt(r.substring(1),"/"):s=dt(r,t)):s=t,{pathname:s,search:Sa(n),hash:Ra(o)}}a(xa,"resolvePath");function dt(e,t){let r=X(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}a(dt,"resolvePathname");function Le(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}a(Le,"getInvalidPathError");function wa(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}a(wa,"getPathContributingMatches");function Ve(e){let t=wa(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}a(Ve,"getResolveToMatches");function Re(e,t,r,n=!1){let o;typeof e=="string"?o=te(e):(o={...e},$(!o.pathname||!o.pathname.includes("?"),Le("?","pathname","search",o)),$(!o.pathname||!o.pathname.includes("#"),Le("#","pathname","hash",o)),$(!o.search||!o.search.includes("#"),Le("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.pathname,u;if(i==null)u=r;else{let f=t.length-1;if(!n&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),f-=1;o.pathname=g.join("/")}u=f>=0?t[f]:"/"}let c=xa(o,u),m=i&&i!=="/"&&i.endsWith("/"),p=(s||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(m||p)&&(c.pathname+="/"),c}a(Re,"resolveTo$1");var Kt=a(e=>e.replace(/[\\/]{2,}/g,"/"),"removeDoubleSlashes"),B=a(e=>Kt(e.join("/")),"joinPaths");function X(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}a(X,"removeTrailingSlash");var Ia=a(e=>X(e).replace(/^\/*/,"/"),"normalizePathname"),Sa=a(e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,"normalizeSearch"),Ra=a(e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,"normalizeHash"),Ca=class{static{a(this,"ErrorResponseImpl")}constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Qt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}a(Qt,"isRouteErrorResponse");function Ea(e){return B(e.map(t=>t.route.path).filter(Boolean))||"/"}a(Ea,"getRoutePattern");var Jt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gt(e,t){let r=e;if(typeof r!="string"||!We.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,o=!1;if(Jt)try{let s=new URL(window.location.href),i=Nt.test(r)?new URL(ra(r,s.protocol)):new URL(r),u=q(i.pathname,t);i.origin===s.origin&&u!=null?r=u+i.search+i.hash:o=!0}catch{M(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:o,to:r}}a(Gt,"parseToInfo");var Ji=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),mt=new URL("http://localhost");function Ke(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),mt)}catch{return mt}}a(Ke,"getNavigatorCurrentUrl");function Me(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}a(Me,"isSameOrigin");function $a(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}a($a,"isExplicitUrl");function Qe(e,t,r,n){let o=null;try{o=e==null?null:new URL(e,r)}catch{}let s=new URL(t,r),i=o!=null&&!Me(o,r),u=!Me(s,r);if(n==="reject"){if(i||u)throw new Error("External navigation is not allowed")}else if(u&&(o==null||!$a(e,o)||!Me(o,s)))throw new Error("External navigation is not allowed")}a(Qe,"validateNavigationTarget");var Yt=["POST","PUT","PATCH","DELETE"],Gi=new Set(Yt),_a=["GET",...Yt],Yi=new Set(_a),Aa,Da,Pa,La;Aa=new WeakMap;Da=new WeakMap;Pa=new WeakMap;La=new WeakMap;var Ma=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Ta(e){try{return Ma.includes(new URL(e).protocol)}catch{return!1}}a(Ta,"hasInvalidProtocol");var re=l.createContext(null);re.displayName="DataRouter";var me=l.createContext(null);me.displayName="DataRouterState";var Zt=l.createContext(!1);function Xt(){return l.useContext(Zt)}a(Xt,"useIsRSCRouterContext");var er=l.createContext({isTransitioning:!1});er.displayName="ViewTransition";var Ua=l.createContext(new Map);Ua.displayName="Fetchers";var je=l.createContext(null);je.displayName="Await";var P=l.createContext(null);P.displayName="Navigation";var ne=l.createContext(null);ne.displayName="Location";var O=l.createContext({outlet:null,matches:[],isDataRoute:!1});O.displayName="Route";var Je=l.createContext(null);Je.displayName="RouteError";var tr="REACT_ROUTER_ERROR",Oa="REDIRECT",ja="ROUTE_ERROR_RESPONSE";function Ba(e){if(e.startsWith(`${tr}:${Oa}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}a(Ba,"decodeRedirectErrorDigest");function Na(e){if(e.startsWith(`${tr}:${ja}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ca(t.status,t.statusText,t.data)}catch{}}a(Na,"decodeRouteErrorResponseDigest");function za(e,{relative:t}={}){$(ae(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=l.useContext(P),{hash:o,pathname:s,search:i}=fe(e,{relative:t}),u=s;return r!=="/"&&(u=s==="/"?r:B([r,s])),n.createHref({pathname:u,search:i,hash:o})}a(za,"useHref");function ae(){return l.useContext(ne)!=null}a(ae,"useInRouterContext");function T(){return $(ae(),"useLocation() may be used only in the context of a <Router> component."),l.useContext(ne).location}a(T,"useLocation");function Zi(){return l.useContext(ne).navigationType}a(Zi,"useNavigationType");var rr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){l.useContext(P).static||l.useLayoutEffect(e)}a(nr,"useIsomorphicLayoutEffect");function Ce(){let{isDataRoute:e}=l.useContext(O);return e?no():Fa()}a(Ce,"useNavigate$1");function Fa(){$(ae(),"useNavigate() may be used only in the context of a <Router> component.");let e=l.useContext(re),{basename:t,navigator:r}=l.useContext(P),{matches:n}=l.useContext(O),{pathname:o}=T(),s=JSON.stringify(Ve(n)),i=l.useRef(!1);return nr(()=>{i.current=!0}),l.useCallback((u,c={})=>{if(M(i.current,rr),!i.current)return;if(typeof u=="number"){r.go(u);return}let m=Re(u,JSON.parse(s),o,c.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:B([t,m.pathname])),Qe(typeof u=="string"?u:Q(u),r.createHref(m),Ke(r),"reject"),(c.replace?r.replace:r.push)(m,c.state,c)},[t,r,s,o,e])}a(Fa,"useNavigateUnstable");var qa=l.createContext(null);function Ha(e){let t=l.useContext(O).outlet;return l.useMemo(()=>t&&l.createElement(qa.Provider,{value:e},t),[t,e])}a(Ha,"useOutlet");function Wa(){let{matches:e}=l.useContext(O);return e[e.length-1]?.params??{}}a(Wa,"useParams");function fe(e,{relative:t}={}){let{matches:r}=l.useContext(O),{pathname:n}=T(),o=JSON.stringify(Ve(r));return l.useMemo(()=>Re(e,JSON.parse(o),n,t==="path"),[e,o,n,t])}a(fe,"useResolvedPath");function Va(e,t){return ar(e,t)}a(Va,"useRoutes");function ar(e,t,r){$(ae(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=l.useContext(P),{matches:o}=l.useContext(O),s=o[o.length-1],i=s?s.params:{},u=s?s.pathname:"/",c=s?s.pathnameBase:"/",m=s&&s.route;{let h=m&&m.path||"";ir(u,!m||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
2
|
|
|
3
3
|
Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let p=T(),f;if(t){let h=typeof t=="string"?te(t):t;$(c==="/"||h.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${h.pathname}" was given in the \`location\` prop.`),f=h}else f=p;let g=f.pathname||"/",b=g;if(c!=="/"){let h=c.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(h.length).join("/")}let v=r&&r.state.matches.length?r.state.matches.map(h=>Object.assign(h,{route:r.manifest[h.route.id]||h.route})):zt(e,{pathname:b});M(m||v!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),M(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let y=Ya(v&&v.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:B([c,n.encodeLocation?n.encodeLocation(h.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:B([c,n.encodeLocation?n.encodeLocation(h.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),o,r);return t&&y?l.createElement(ne.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},y):y}a(ar,"useRoutesImpl");function Ka(){let e=ro(),t=Qt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},s={padding:"2px 4px",backgroundColor:n},i=null;return i=l.createElement(l.Fragment,null,l.createElement("p",null,"💿 Hey developer 👋"),l.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",l.createElement("code",{style:s},"ErrorBoundary")," or"," ",l.createElement("code",{style:s},"errorElement")," prop on your route.")),l.createElement(l.Fragment,null,l.createElement("h2",null,"Unexpected Application Error!"),l.createElement("h3",{style:{fontStyle:"italic"}},t),r?l.createElement("pre",{style:o},r):null,i)}a(Ka,"DefaultErrorComponent");var Qa=l.createElement(Ka,null),or=class extends l.Component{static{a(this,"RenderErrorBoundary")}constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError&&this.props.onError(e,t)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=Na(e.digest);r&&(e=r)}let t=e!==void 0?l.createElement(O.Provider,{value:this.props.routeContext},l.createElement(Je.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?l.createElement(Ja,{error:e},t):t}};or.contextType=Zt;var Te=new WeakMap;function Ja({children:e,error:t}){let{basename:r,navigator:n}=l.useContext(P);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=Ba(t.digest);if(o){let s=Te.get(t);if(s)throw s;let i=Gt(o.location,r),u=i.absoluteURL||i.to;if(Qe(o.location,u,Ke(n),"allow-explicit"),Ta(u))throw new Error("Invalid redirect location");if(Jt&&!Te.get(t))if(i.isExternal||o.reloadDocument)window.location.href=u;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:o.replace}));throw Te.set(t,c),c}return l.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}a(Ja,"RSCErrorHandler");function Ga({routeContext:e,match:t,children:r}){let n=l.useContext(re);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),l.createElement(O.Provider,{value:e},r)}a(Ga,"RenderedRoute");function Ya(e,t=[],r){let n=r?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,s=n?.errors;if(s!=null){let p=o.findIndex(f=>f.route.id&&s?.[f.route.id]!==void 0);$(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let i=!1,u=-1;if(r&&n){i=n.renderFallback;for(let p=0;p<o.length;p++){let f=o[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=p),f.route.id){let{loaderData:g,errors:b}=n,v=f.route.loader&&!g.hasOwnProperty(f.route.id)&&(!b||b[f.route.id]===void 0);if(f.route.lazy||v){r.isStatic&&(i=!0),u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}}let c=r?.onError,m=n&&c?(p,f)=>{c(p,{location:n.location,params:n.matches?.[0]?.params??{},pattern:Ea(n.matches),errorInfo:f})}:void 0;return o.reduceRight((p,f,g)=>{let b,v=!1,y=null,h=null;n&&(b=s&&f.route.id?s[f.route.id]:void 0,y=f.route.errorElement||Qa,i&&(u<0&&g===0?(ir("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,h=null):u===g&&(v=!0,h=f.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,g+1)),w=a(()=>{let I;return b?I=y:v?I=h:f.route.Component?I=l.createElement(f.route.Component,null):f.route.element?I=f.route.element:I=p,l.createElement(Ga,{match:f,routeContext:{outlet:p,matches:x,isDataRoute:n!=null},children:I})},"getChildren");return n&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?l.createElement(or,{location:n.location,revalidation:n.revalidation,component:y,error:b,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:m}):w()},null)}a(Ya,"_renderMatches");function Ge(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}a(Ge,"getDataRouterConsoleError");function Za(e){let t=l.useContext(re);return $(t,Ge(e)),t}a(Za,"useDataRouterContext");function Ye(e){let t=l.useContext(me);return $(t,Ge(e)),t}a(Ye,"useDataRouterState");function Xa(e){let t=l.useContext(O);return $(t,Ge(e)),t}a(Xa,"useRouteContext");function Ze(e){let t=Xa(e),r=t.matches[t.matches.length-1];return $(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}a(Ze,"useCurrentRouteId");function eo(){return Ze("useRouteId")}a(eo,"useRouteId");function to(){let e=Ye("useNavigation");return l.useMemo(()=>{let{matches:t,historyAction:r,...n}=e.navigation;return n},[e.navigation])}a(to,"useNavigation");function sr(){let{matches:e,loaderData:t}=Ye("useMatches");return l.useMemo(()=>e.map(r=>la(r,t)),[e,t])}a(sr,"useMatches");function ro(){let e=l.useContext(Je),t=Ye("useRouteError"),r=Ze("useRouteError");return e!==void 0?e:t.errors?.[r]}a(ro,"useRouteError");function no(){let{router:e}=Za("useNavigate"),t=Ze("useNavigate"),r=l.useRef(!1);return nr(()=>{r.current=!0}),l.useCallback(async(n,o={})=>{M(r.current,rr),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}a(no,"useNavigateStable");var ft={};function ir(e,t,r){!t&&!ft[e]&&(ft[e]=!0,M(!1,r))}a(ir,"warningOnce");var pt={};function ao(e,t){!e&&!pt[t]&&(pt[t]=!0)}a(ao,"warnOnce");var Xi=l.memo(oo);function oo({routes:e,manifest:t,future:r,state:n,isStatic:o,onError:s}){return ar(e,void 0,{manifest:t,state:n,isStatic:o,onError:s,future:r})}a(oo,"DataRoutes2");function so({to:e,replace:t,state:r,relative:n}){$(ae(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:s}=l.useContext(P);M(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=l.useContext(O),{pathname:u}=T(),c=Ce(),m=Re(e,Ve(i),u,n==="path");Qe(typeof e=="string"?e:Q(e),s.createHref(m),Ke(s),"reject");let p=JSON.stringify(m);return l.useEffect(()=>{c(JSON.parse(p),{replace:t,state:r,relative:n})},[c,p,n,t,r]),null}a(so,"Navigate$1");function el(e){return Ha(e.context)}a(el,"Outlet");function io(e){$(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}a(io,"Route");function lr({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:o,static:s=!1,useTransitions:i}){$(!ae(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),c=l.useMemo(()=>({basename:u,navigator:o,static:s,useTransitions:i,future:{}}),[u,o,s,i]);typeof r=="string"&&(r=te(r));let{pathname:m="/",search:p="",hash:f="",state:g=null,key:b="default",mask:v}=r,y=l.useMemo(()=>{let h=q(m,u);return h==null?null:{location:{pathname:h,search:p,hash:f,state:g,key:b,mask:v},navigationType:n}},[u,m,p,f,g,b,n,v]);return M(y!=null,`<Router basename="${u}"> is not able to match the URL "${m}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:l.createElement(P.Provider,{value:c},l.createElement(ne.Provider,{children:t,value:y}))}a(lr,"Router");function tl({children:e,location:t}){return Va(Be(e),t)}a(tl,"Routes");var rl=class extends l.Component{static{a(this,"AwaitErrorBoundary")}constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError&&this.props.onError(e,t)}render(){let{children:e,errorElement:t,resolve:r}=this.props,n=null,o=0;if(!(r instanceof Promise))o=1,n=Promise.resolve(),Object.defineProperty(n,"_tracked",{get:a(()=>!0,"get")}),Object.defineProperty(n,"_data",{get:a(()=>r,"get")});else if(this.state.error){o=2;let s=this.state.error;n=Promise.reject().catch(()=>{}),Object.defineProperty(n,"_tracked",{get:a(()=>!0,"get")}),Object.defineProperty(n,"_error",{get:a(()=>s,"get")})}else r._tracked?(n=r,o="_error"in n?2:"_data"in n?1:0):(o=0,Object.defineProperty(r,"_tracked",{get:a(()=>!0,"get")}),n=r.then(s=>Object.defineProperty(r,"_data",{get:a(()=>s,"get")}),s=>{this.props.onError?.(s),Object.defineProperty(r,"_error",{get:a(()=>s,"get")})}));if(o===2&&!t)throw n._error;if(o===2)return l.createElement(je.Provider,{value:n,children:t});if(o===1)return l.createElement(je.Provider,{value:n,children:e});throw n}};function Be(e,t=[]){let r=[];return l.Children.forEach(e,(n,o)=>{if(!l.isValidElement(n))return;let s=[...t,o];if(n.type===l.Fragment){r.push.apply(r,Be(n.props.children,s));return}$(n.type===io,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),$(!n.props.index||!n.props.children,"An index route cannot have child routes.");let i={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(i.children=Be(n.props.children,s)),r.push(i)}),r}a(Be,"createRoutesFromChildren");var be="get",ke="application/x-www-form-urlencoded";function Ee(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}a(Ee,"isHtmlElement");function lo(e){return Ee(e)&&e.tagName.toLowerCase()==="button"}a(lo,"isButtonElement");function uo(e){return Ee(e)&&e.tagName.toLowerCase()==="form"}a(uo,"isFormElement");function co(e){return Ee(e)&&e.tagName.toLowerCase()==="input"}a(co,"isInputElement");function mo(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}a(mo,"isModifiedEvent");function fo(e,t){return e.button===0&&(!t||t==="_self")&&!mo(e)}a(fo,"shouldProcessLinkClick");function Ne(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}a(Ne,"createSearchParams");function po(e,t){let r=Ne(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(s=>{r.append(o,s)})}),r}a(po,"getSearchParamsForLocation");var ge=null;function ho(){if(ge===null)try{new FormData(document.createElement("form"),0),ge=!1}catch{ge=!0}return ge}a(ho,"isFormDataSubmitterSupported");var go=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ue(e){return e!=null&&!go.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ke}"`),null):e}a(Ue,"getFormEncType");function yo(e,t){let r,n,o,s,i;if(uo(e)){let u=e.getAttribute("action");n=u?q(u,t):null,r=e.getAttribute("method")||be,o=Ue(e.getAttribute("enctype"))||ke,s=new FormData(e)}else if(lo(e)||co(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||u.getAttribute("action");if(n=c?q(c,t):null,r=e.getAttribute("formmethod")||u.getAttribute("method")||be,o=Ue(e.getAttribute("formenctype"))||Ue(u.getAttribute("enctype"))||ke,s=new FormData(u,e),!ho()){let{name:m,type:p,value:f}=e;if(p==="image"){let g=m?`${m}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else m&&s.append(m,f)}}else{if(Ee(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=be,n=null,o=ke,i=e}return s&&o==="text/plain"&&(i=s,s=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:s,body:i}}a(yo,"getFormSubmissionInfo");var nl=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),vo={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},bo=/[&><\u2028\u2029]/g;function ht(e){return e.replace(bo,t=>vo[t])}a(ht,"escapeHtml");function $e(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}a($e,"invariant2");function ur(e,t,r,n){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${n}`:o.pathname=`${o.pathname}.${n}`:o.pathname==="/"?o.pathname=`_root.${n}`:t&&q(o.pathname,t)==="/"?o.pathname=`${X(t)}/_root.${n}`:o.pathname=`${X(o.pathname)}.${n}`,o}a(ur,"singleFetchUrl");async function ko(e,t){if(e.id in t)return t[e.id];try{let r=await ta(()=>import(e.module),[]);return t[e.id]=r,r}catch{return window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}a(ko,"loadRouteModule");function xo(e){return e!=null&&typeof e.page=="string"}a(xo,"isPageLinkDescriptor");function wo(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}a(wo,"isHtmlLinkDescriptor");async function Io(e,t,r){return Co((await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let s=await ko(o,r);return s.links?s.links():[]}return[]}))).flat(1).filter(wo).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}a(Io,"getKeyedPrefetchLinks");function gt(e,t,r,n,o,s){let i=a((c,m)=>r[m]?c.route.id!==r[m].route.id:!0,"isNew"),u=a((c,m)=>r[m].pathname!==c.pathname||r[m].route.path?.endsWith("*")&&r[m].params["*"]!==c.params["*"],"matchPathChanged");return s==="assets"?t.filter((c,m)=>i(c,m)||u(c,m)):s==="data"?t.filter((c,m)=>{let p=n.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(i(c,m)||u(c,m))return!0;if(c.route.shouldRevalidate){let f=c.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}a(gt,"getNewMatchesForLinks");function cr(e,t,{includeHydrateFallback:r}={}){return So(e.map(n=>{let o=t.routes[n.route.id];if(!o)return[];let s=[o.module];return o.clientActionModule&&(s=s.concat(o.clientActionModule)),o.clientLoaderModule&&(s=s.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(s=s.concat(o.hydrateFallbackModule)),o.imports&&(s=s.concat(o.imports)),s}).flat(1))}a(cr,"getModuleLinkHrefs");function So(e){return[...new Set(e)]}a(So,"dedupeHrefs");function Ro(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}a(Ro,"sortKeys");function Co(e,t){let r=new Set,n=new Set(t);return e.reduce((o,s)=>{if(t&&!xo(s)&&s.as==="script"&&s.href&&n.has(s.href))return o;let i=JSON.stringify(Ro(s));return r.has(i)||(r.add(i),o.push({key:i,link:s})),o},[])}a(Co,"dedupeLinkDescriptors");function Eo(e,t){return e.mode==="lazy"&&t===!0}a(Eo,"isFogOfWarEnabled");function $o({sri:e,...t},r){let n=new Set(r.state.matches.map(u=>u.route.id)),o=r.state.location.pathname.split("/").filter(Boolean),s=["/"];for(o.pop();o.length>0;)s.push(`/${o.join("/")}`),o.pop();s.forEach(u=>{let c=Ft(r.routes,u,r.basename||"/",!1,r.branches);c&&c.forEach(m=>n.add(m.route.id))});let i=[...n].reduce((u,c)=>Object.assign(u,{[c]:t.routes[c]}),{});return{...t,routes:i,sri:e?!0:void 0}}a($o,"getPartialManifest");function _e(){let e=l.useContext(re);return $e(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}a(_e,"useDataRouterContext2");function dr(){let e=l.useContext(me);return $e(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}a(dr,"useDataRouterStateContext");var Ae=l.createContext(void 0);Ae.displayName="FrameworkContext";function J(){let e=l.useContext(Ae);return $e(e,"You must render this element inside a <HydratedRouter> element"),e}a(J,"useFrameworkContext");function _o(e,t){let r=l.useContext(Ae),[n,o]=l.useState(!1),[s,i]=l.useState(!1),{onFocus:u,onBlur:c,onMouseEnter:m,onMouseLeave:p,onTouchStart:f}=t,g=l.useRef(null);l.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let y=a(x=>{x.forEach(w=>{i(w.isIntersecting)})},"callback"),h=new IntersectionObserver(y,{threshold:.5});return g.current&&h.observe(g.current),()=>{h.disconnect()}}},[e]),l.useEffect(()=>{if(n){let y=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(y)}}},[n]);let b=a(()=>{o(!0)},"setIntent"),v=a(()=>{o(!1),i(!1)},"cancelIntent");return r?e!=="intent"?[s,g,{}]:[s,g,{onFocus:ie(u,b),onBlur:ie(c,v),onMouseEnter:ie(m,b),onMouseLeave:ie(p,v),onTouchStart:ie(f,b)}]:[!1,g,{}]}a(_o,"usePrefetchBehavior");function ie(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}a(ie,"composeEventHandlers");function Ao(e,t,r){if(r&&!we)return[e[0]];if(t){let n=e.findIndex(o=>t[o.route.id]!==void 0);return e.slice(0,n+1)}return e}a(Ao,"getActiveMatches");function Do({page:e,...t}){let r=Xt(),{nonce:n}=J(),{router:o}=_e(),s=l.useMemo(()=>zt(o.routes,e,o.basename),[o.routes,e,o.basename]);return s?(t.nonce==null&&n&&(t={...t,nonce:n}),r?l.createElement(Lo,{page:e,matches:s,...t}):l.createElement(Mo,{page:e,matches:s,...t})):null}a(Do,"PrefetchPageLinks");function Po(e){let{manifest:t,routeModules:r}=J(),[n,o]=l.useState([]);return l.useEffect(()=>{let s=!1;return Io(e,t,r).then(i=>{s||o(i)}),()=>{s=!0}},[e,t,r]),n}a(Po,"useKeyedPrefetchLinks");function Lo({page:e,matches:t,...r}){let n=T(),{future:o}=J(),{basename:s}=_e(),i=l.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let u=ur(e,s,o.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,m=[];for(let p of t)typeof p.route.shouldRevalidate=="function"?c=!0:m.push(p.route.id);return c&&m.length>0&&u.searchParams.set("_routes",m.join(",")),[u.pathname+u.search]},[s,o.v8_trailingSlashAwareDataRequests,e,n,t]);return l.createElement(l.Fragment,null,i.map(u=>l.createElement("link",{key:u,rel:"prefetch",as:"fetch",href:u,...r})))}a(Lo,"RSCPrefetchPageLinksImpl");function Mo({page:e,matches:t,...r}){let n=T(),{future:o,manifest:s,routeModules:i}=J(),{basename:u}=_e(),{loaderData:c,matches:m}=dr(),p=l.useMemo(()=>gt(e,t,m,s,n,"data"),[e,t,m,s,n]),f=l.useMemo(()=>gt(e,t,m,s,n,"assets"),[e,t,m,s,n]),g=l.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let y=new Set,h=!1;if(t.forEach(w=>{let I=s.routes[w.route.id];!I||!I.hasLoader||(!p.some(_=>_.route.id===w.route.id)&&w.route.id in c&&i[w.route.id]?.shouldRevalidate||I.hasClientLoader?h=!0:y.add(w.route.id))}),y.size===0)return[];let x=ur(e,u,o.v8_trailingSlashAwareDataRequests,"data");return h&&y.size>0&&x.searchParams.set("_routes",t.filter(w=>y.has(w.route.id)).map(w=>w.route.id).join(",")),[x.pathname+x.search]},[u,o.v8_trailingSlashAwareDataRequests,c,n,s,p,t,e,i]),b=l.useMemo(()=>cr(f,s),[f,s]),v=Po(f);return l.createElement(l.Fragment,null,g.map(y=>l.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...r})),b.map(y=>l.createElement("link",{key:y,rel:"modulepreload",href:y,...r})),v.map(({key:y,link:h})=>l.createElement("link",{key:y,nonce:r.nonce,...h,crossOrigin:h.crossOrigin??r.crossOrigin})))}a(Mo,"PrefetchPageLinksImpl");var we=!1;function To(){we=!0}a(To,"setIsHydrated");function Uo(e){let{manifest:t,serverHandoffString:r,isSpaMode:n,renderMeta:o,routeDiscovery:s,ssr:i,nonce:u}=J(),{router:c,static:m,staticContext:p}=_e(),{matches:f}=dr(),g=Xt(),b=Eo(s,i);e.nonce==null&&u&&(e={...e,nonce:u}),o&&(o.didRenderScripts=!0);let v=Ao(f,null,n);l.useEffect(()=>{To()},[]);let y=l.useMemo(()=>{if(g)return null;let w=p?`window.__reactRouterContext = ${r};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());`:" ",I=m?`${t.hmr?.runtime?`import ${JSON.stringify(t.hmr.runtime)};`:""}${b?"":`import ${JSON.stringify(t.url)}`};
|
|
4
4
|
${v.map((_,C)=>{let A=`route${C}`,L=t.routes[_.route.id];$e(L,`Route ${_.route.id} not found in manifest`);let{clientActionModule:j,clientLoaderModule:D,clientMiddlewareModule:N,hydrateFallbackModule:G,module:U}=L,H=[...j?[{module:j,varName:`${A}_clientAction`}]:[],...D?[{module:D,varName:`${A}_clientLoader`}]:[],...N?[{module:N,varName:`${A}_clientMiddleware`}]:[],...G?[{module:G,varName:`${A}_HydrateFallback`}]:[],{module:U,varName:`${A}_main`}];return H.length===1?`import * as ${A} from ${JSON.stringify(U)};`:[H.map(z=>`import * as ${z.varName} from "${z.module}";`).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var xe=Object.defineProperty;var r=(t,a)=>xe(t,"name",{value:a,configurable:!0});import{i as ne}from"./rolldown-runtime-ZpX3ckPj.js";import{G as pe,Ia as he,Ra as ge,St as Y,Vi as W,ht as fe,na as X,ut as ye}from"./agent-avatar-url-B91C7fqh.js";import{Vn as ve,i as T,n as je,r as be,s as re}from"./BreadcrumbContext-BRKP7-bF.js";import{r as ee,t as Ne}from"./AgentAvatar-B47RVwPt.js";import{i as te,r as we,t as Ae}from"./tabs-CVzr4EnB.js";import{a as Te}from"./ToastContext-CYUmn7f8.js";import{a as y,c as L,l as _,n as F,r as k}from"./select-CtJdi3BB.js";import{t as se}from"./input-DW5WzZI0.js";import{o as Se,r as Ce}from"./company-members-BXmr5rWO.js";import{r as v,t as j}from"./card-79GDCTP3.js";import{t as Ee}from"./EmptyState-iwTwakaR.js";import{Ot as Ie,b as ae,hn as Ue,in as Pe,rn as Re,tn as De,xn as Le}from"./index-SsNrNOjw.js";var l=ne(ge(),1),e=ne(he(),1),_e=50,n="__all",Fe=[{value:n,label:"All actions"},{value:"issue.",label:"Tasks"},{value:"agent.",label:"Agents"},{value:"heartbeat.",label:"Runs"},{value:"approval.",label:"Approvals"},{value:"project.",label:"Projects"},{value:"goal.",label:"Goals"},{value:"tool_gateway.",label:"Tools"},{value:"cost.",label:"Costs"},{value:"company.",label:"Company"}],ke=[{value:n,label:"All entities"},{value:"issue",label:"Task"},{value:"agent",label:"Agent"},{value:"project",label:"Project"},{value:"goal",label:"Goal"},{value:"company",label:"Company"}];function Be(t){if(!t)return;const a=new Date(`${t}T00:00:00.000Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Be,"toStartIso");function Ve(t){if(!t)return;const a=new Date(`${t}T23:59:59.999Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Ve,"toEndIso");function $e({record:t,agentMap:a,userProfileMap:d}){const u=t.agentId??(t.actorType==="agent"?t.actorId:null),c=u?a.get(u):null;if(c)return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",title:c.name,children:[(0,e.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,e.jsx)(Ne,{agent:c,size:16,className:"h-3 w-3"})}),(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:c.name})]});if(t.actorType==="user"&&t.actorId){const m=d.get(t.actorId);return(0,e.jsx)(ee,{name:m?.label??"User",avatarUrl:m?.image??null,size:"sm",className:"font-medium text-foreground"})}const h=t.actorType==="plugin"?"Plugin":t.actorType==="agent"?"Agent":t.actorType==="user"?"User":"System";return(0,e.jsx)(ee,{name:h,size:"sm",className:"font-medium text-foreground"})}r($e,"AuditActor");function qe({record:t}){const{issue:a,document:d}=t.entity,u=a?.identifier??a?.id??null;return u?(0,e.jsx)(re,{to:`/issues/${u}`,className:"font-medium text-primary hover:underline",children:a?.identifier?`${a.identifier}${a.title?` · ${a.title}`:""}`:"the task"}):d?(0,e.jsx)("span",{className:"font-medium text-foreground",children:d.key}):(0,e.jsx)("span",{className:"text-muted-foreground",children:t.entityType})}r(qe,"AuditEntityNode");function ze({record:t,agentMap:a,userProfileMap:d}){const u=Ie(t.action,t.details,{agentMap:a,userProfileMap:d}),c=t.responsibleUserId?d.get(t.responsibleUserId):null,h=!!(t.responsibleUserId&&!(t.actorType==="user"&&t.actorId===t.responsibleUserId)),m=c?.label??(t.responsibleUserId?"a user":null),g=t.entity.comment?.excerpt?.trim(),x=t.entity.issue&&t.entity.document?t.entity.document.key:null;return(0,e.jsx)("li",{className:"px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-foreground",children:[(0,e.jsx)($e,{record:t,agentMap:a,userProfileMap:d}),(0,e.jsx)("span",{className:"text-muted-foreground",children:u}),(0,e.jsx)(qe,{record:t})]}),g?(0,e.jsxs)("p",{className:"line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground",children:["“",g,"”"]}):null,x?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Document ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:x})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h&&m?(0,e.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5",children:["on behalf of ",m]}):null,t.runId&&t.agentId?(0,e.jsx)(re,{to:`/agents/${t.agentId}/runs/${t.runId}`,className:"text-primary hover:underline",children:"View run"}):null,(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro) opacity-70",children:t.action})]})]}),(0,e.jsx)("time",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),children:ye(t.createdAt)})]})})}r(ze,"AuditRow");function Me(){return(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(De,{className:"h-10 w-10 text-muted-foreground/50"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Agent audit is a Paperclip Enterprise view"}),(0,e.jsxs)("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["The agent audit log gives you a searchable, exportable record of everything your agents did — every comment, task change, approval, and run — with the responsible person for each action. Ask an administrator to grant you the"," ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:"audit:view_agent_actions"})," ","permission to view it."]})]})]})})}r(Me,"AuditUpsell");function Oe({companyId:t,lockedAgentId:a,hideHeader:d,mode:u,onModeChange:c}){const{pushToast:h}=Te(),[m,g]=(0,l.useState)(n),[x,B]=(0,l.useState)(n),[S,V]=(0,l.useState)(n),[C,$]=(0,l.useState)(n),[E,q]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),[U,H]=(0,l.useState)(!1),M=X({queryKey:Y.agents.list(t),queryFn:r(()=>be.list(t),"queryFn")}),O=X({queryKey:Y.access.companyUserDirectory(t),queryFn:r(()=>Se.listUserDirectory(t),"queryFn"),retry:!1}),ie=(0,l.useMemo)(()=>new Map((M.data??[]).map(s=>[s.id,s])),[M.data]),le=(0,l.useMemo)(()=>Ce(O.data?.users),[O.data]),f=a?"agents":u??"all",o={actorScope:f,agentId:a??(m===n?void 0:m),responsibleUserId:x===n?void 0:x,action:S===n?void 0:S,entityType:C===n?void 0:C,from:Be(E),to:Ve(I)},b=!!(!a&&m!==n||x!==n||S!==n||C!==n||E||I),i=Le({queryKey:Y.audit.agentActions(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),queryFn:r(({pageParam:s})=>ae.listAgentActions(t,{...o,limit:_e,cursor:s??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:r(s=>s.nextCursor??void 0,"getNextPageParam"),retry:r((s,p)=>!(p instanceof W&&p.status===403)&&s<2,"retry")}),K=i.error instanceof W&&i.error.status===403,P=i.data?.pages.some(s=>s.accessTier==="basic")??!1,oe=i.data?.pages.some(s=>s.accessTier==="full")??!1,G=(0,l.useMemo)(()=>{const s=i.data?.pages??[];return(P?s.filter(p=>p.accessTier!=="full"):s).flatMap(p=>p.items)},[i.data,P]),R=P?"basic":i.data?.pages[0]?.accessTier,N=P&&oe,ce=a?!0:R==="full",de=!!(N&&U&&!i.isFetching),D=!!(!a&&!de&&(K&&b||N)),w=!!(K&&!a&&f==="agents"&&c),ue=!!(!a&&c&&!w&&(f==="agents"||R==="full"));(0,l.useEffect)(()=>{w&&c?.("all")},[w,c]),(0,l.useEffect)(()=>{!a&&(R==="basic"||D)&&(g(n),B(n),V(n),$(n),q(""),z(""))},[R,N,a,D]),(0,l.useEffect)(()=>{if(!N){U&&H(!1);return}U||(H(!0),i.refetch())},[U,i,N]);const J=r(()=>{g(n),B(n),V(n),$(n),q(""),z("")},"clearFilters"),me=r(async()=>{Q(!0);try{const s=await ae.exportAgentActionsCsv(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),p=URL.createObjectURL(s),A=document.createElement("a");A.href=p,A.download=`${f==="agents"?"agent-audit":"activity"}-${t}.csv`,document.body.appendChild(A),A.click(),A.remove(),window.setTimeout(()=>URL.revokeObjectURL(p),5e3),h({title:"Audit exported",body:"Your CSV download has started.",tone:"success"})}catch(s){h({title:"Export failed",body:s instanceof Error?s.message:"Could not export the audit log.",tone:"error"})}finally{Q(!1)}},"handleExport");return K&&!D&&!w?(0,e.jsx)(Me,{}):(0,e.jsxs)("div",{className:"space-y-4",children:[d?null:(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Activity"}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:f==="agents"?"Every recorded agent action, newest first — with the responsible person and run behind each one.":"Everything happening in your company, newest first — people, agents, and the system. Each line is one recorded action."})]})}),ue?(0,e.jsx)(Ae,{value:f,onValueChange:r(s=>c?.(s),"onValueChange"),children:(0,e.jsxs)(we,{"aria-label":"Activity scope",children:[(0,e.jsx)(te,{value:"all",children:"All activity"}),(0,e.jsx)(te,{value:"agents",children:"Agent actions"})]})}):null,ce?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a?null:(0,e.jsxs)(F,{value:m,onValueChange:g,children:[(0,e.jsx)(L,{className:"w-40",children:(0,e.jsx)(_,{placeholder:"Agent"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All agents"}),(M.data??[]).map(s=>(0,e.jsx)(y,{value:s.id,children:s.name},s.id))]})]}),(0,e.jsxs)(F,{value:x,onValueChange:B,children:[(0,e.jsx)(L,{className:"w-52",children:(0,e.jsx)(_,{placeholder:"Responsible user"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All responsible users"}),(O.data?.users??[]).map(s=>(0,e.jsx)(y,{value:s.principalId,children:s.user?.name??s.user?.email??s.principalId.slice(0,8)},s.principalId))]})]}),(0,e.jsxs)(F,{value:S,onValueChange:V,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Action"})}),(0,e.jsx)(k,{children:Fe.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsxs)(F,{value:C,onValueChange:$,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Entity"})}),(0,e.jsx)(k,{children:ke.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsx)(se,{type:"date","aria-label":"From date",value:E,max:I||void 0,onChange:r(s=>q(s.target.value),"onChange"),className:"w-36"}),(0,e.jsx)(se,{type:"date","aria-label":"To date",value:I,min:E||void 0,onChange:r(s=>z(s.target.value),"onChange"),className:"w-36"}),b?(0,e.jsx)(T,{variant:"ghost",size:"sm",onClick:J,children:"Clear filters"}):null,(0,e.jsxs)(T,{variant:"outline",size:"sm",className:"ml-auto",onClick:me,disabled:Z||i.isLoading||G.length===0,children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-4 w-4"}),Z?"Exporting…":"Export CSV"]})]}):null,D||w?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Refreshing audit access…"})}):i.isLoading?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Loading…"})}):i.error?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i.error instanceof Error?i.error.message:"Failed to load the audit log."}),(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.refetch(),"onClick"),children:"Try again"})]})}):G.length===0?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(Re,{className:"h-10 w-10 text-muted-foreground/40"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:b?"No actions match these filters":"Nothing here yet"}),(0,e.jsx)("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:b?"Try a wider date range or different filters.":f==="agents"?"As soon as your agents start doing things, their actions show up here.":"As soon as anyone in your company does something, it shows up here."})]}),b?(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:J,children:"Clear filters"}):null]})}):(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"px-0 py-0",children:(0,e.jsx)("ul",{className:pe("divide-y divide-border"),children:G.map(s=>(0,e.jsx)(ze,{record:s,agentMap:ie,userProfileMap:le},s.id))})})}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null,(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recorded by Paperclip — entries can't be edited. Sensitive values are never stored."})]})}r(Oe,"AuditFeed");function nt(){const{selectedCompanyId:t}=fe(),{setBreadcrumbs:a}=je(),[d,u]=ve(),c=d.get("mode")==="agents"?"agents":"all";(0,l.useEffect)(()=>{a([{label:"Activity"}])},[a]);const h=(0,l.useCallback)(m=>{u(g=>{const x=new URLSearchParams(g);return m==="agents"?x.set("mode","agents"):x.delete("mode"),x},{replace:!0})},[u]);return t?(0,e.jsx)(Oe,{companyId:t,mode:c,onModeChange:h}):(0,e.jsx)(Ee,{icon:Pe,message:"Select a company to view activity."})}r(nt,"CompanyActivity");export{nt as CompanyActivity};
|
|
1
|
+
var xe=Object.defineProperty;var r=(t,a)=>xe(t,"name",{value:a,configurable:!0});import{i as ne}from"./rolldown-runtime-ZpX3ckPj.js";import{G as pe,Ia as he,Ra as ge,St as Y,Vi as W,ht as fe,na as X,ut as ye}from"./agent-avatar-url-CVV7dJ4l.js";import{Vn as ve,i as T,n as je,r as be,s as re}from"./BreadcrumbContext-k4_HOBKt.js";import{r as ee,t as Ne}from"./AgentAvatar-J8HJgoSh.js";import{i as te,r as we,t as Ae}from"./tabs-CFRGyc3-.js";import{a as Te}from"./ToastContext-CIri5s-I.js";import{a as y,c as L,l as _,n as F,r as k}from"./select-D6aktlIu.js";import{t as se}from"./input-BXe2NHXn.js";import{o as Se,r as Ce}from"./company-members-BmKruwkU.js";import{r as v,t as j}from"./card-BA46vwjn.js";import{t as Ee}from"./EmptyState-NmkkuFFc.js";import{Ot as Ie,b as ae,hn as Ue,in as Pe,rn as Re,tn as De,xn as Le}from"./index-gz2G0uzR.js";var l=ne(ge(),1),e=ne(he(),1),_e=50,n="__all",Fe=[{value:n,label:"All actions"},{value:"issue.",label:"Tasks"},{value:"agent.",label:"Agents"},{value:"heartbeat.",label:"Runs"},{value:"approval.",label:"Approvals"},{value:"project.",label:"Projects"},{value:"goal.",label:"Goals"},{value:"tool_gateway.",label:"Tools"},{value:"cost.",label:"Costs"},{value:"company.",label:"Company"}],ke=[{value:n,label:"All entities"},{value:"issue",label:"Task"},{value:"agent",label:"Agent"},{value:"project",label:"Project"},{value:"goal",label:"Goal"},{value:"company",label:"Company"}];function Be(t){if(!t)return;const a=new Date(`${t}T00:00:00.000Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Be,"toStartIso");function Ve(t){if(!t)return;const a=new Date(`${t}T23:59:59.999Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Ve,"toEndIso");function $e({record:t,agentMap:a,userProfileMap:d}){const u=t.agentId??(t.actorType==="agent"?t.actorId:null),c=u?a.get(u):null;if(c)return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",title:c.name,children:[(0,e.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,e.jsx)(Ne,{agent:c,size:16,className:"h-3 w-3"})}),(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:c.name})]});if(t.actorType==="user"&&t.actorId){const m=d.get(t.actorId);return(0,e.jsx)(ee,{name:m?.label??"User",avatarUrl:m?.image??null,size:"sm",className:"font-medium text-foreground"})}const h=t.actorType==="plugin"?"Plugin":t.actorType==="agent"?"Agent":t.actorType==="user"?"User":"System";return(0,e.jsx)(ee,{name:h,size:"sm",className:"font-medium text-foreground"})}r($e,"AuditActor");function qe({record:t}){const{issue:a,document:d}=t.entity,u=a?.identifier??a?.id??null;return u?(0,e.jsx)(re,{to:`/issues/${u}`,className:"font-medium text-primary hover:underline",children:a?.identifier?`${a.identifier}${a.title?` · ${a.title}`:""}`:"the task"}):d?(0,e.jsx)("span",{className:"font-medium text-foreground",children:d.key}):(0,e.jsx)("span",{className:"text-muted-foreground",children:t.entityType})}r(qe,"AuditEntityNode");function ze({record:t,agentMap:a,userProfileMap:d}){const u=Ie(t.action,t.details,{agentMap:a,userProfileMap:d}),c=t.responsibleUserId?d.get(t.responsibleUserId):null,h=!!(t.responsibleUserId&&!(t.actorType==="user"&&t.actorId===t.responsibleUserId)),m=c?.label??(t.responsibleUserId?"a user":null),g=t.entity.comment?.excerpt?.trim(),x=t.entity.issue&&t.entity.document?t.entity.document.key:null;return(0,e.jsx)("li",{className:"px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-foreground",children:[(0,e.jsx)($e,{record:t,agentMap:a,userProfileMap:d}),(0,e.jsx)("span",{className:"text-muted-foreground",children:u}),(0,e.jsx)(qe,{record:t})]}),g?(0,e.jsxs)("p",{className:"line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground",children:["“",g,"”"]}):null,x?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Document ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:x})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h&&m?(0,e.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5",children:["on behalf of ",m]}):null,t.runId&&t.agentId?(0,e.jsx)(re,{to:`/agents/${t.agentId}/runs/${t.runId}`,className:"text-primary hover:underline",children:"View run"}):null,(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro) opacity-70",children:t.action})]})]}),(0,e.jsx)("time",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),children:ye(t.createdAt)})]})})}r(ze,"AuditRow");function Me(){return(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(De,{className:"h-10 w-10 text-muted-foreground/50"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Agent audit is a Paperclip Enterprise view"}),(0,e.jsxs)("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["The agent audit log gives you a searchable, exportable record of everything your agents did — every comment, task change, approval, and run — with the responsible person for each action. Ask an administrator to grant you the"," ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:"audit:view_agent_actions"})," ","permission to view it."]})]})]})})}r(Me,"AuditUpsell");function Oe({companyId:t,lockedAgentId:a,hideHeader:d,mode:u,onModeChange:c}){const{pushToast:h}=Te(),[m,g]=(0,l.useState)(n),[x,B]=(0,l.useState)(n),[S,V]=(0,l.useState)(n),[C,$]=(0,l.useState)(n),[E,q]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),[U,H]=(0,l.useState)(!1),M=X({queryKey:Y.agents.list(t),queryFn:r(()=>be.list(t),"queryFn")}),O=X({queryKey:Y.access.companyUserDirectory(t),queryFn:r(()=>Se.listUserDirectory(t),"queryFn"),retry:!1}),ie=(0,l.useMemo)(()=>new Map((M.data??[]).map(s=>[s.id,s])),[M.data]),le=(0,l.useMemo)(()=>Ce(O.data?.users),[O.data]),f=a?"agents":u??"all",o={actorScope:f,agentId:a??(m===n?void 0:m),responsibleUserId:x===n?void 0:x,action:S===n?void 0:S,entityType:C===n?void 0:C,from:Be(E),to:Ve(I)},b=!!(!a&&m!==n||x!==n||S!==n||C!==n||E||I),i=Le({queryKey:Y.audit.agentActions(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),queryFn:r(({pageParam:s})=>ae.listAgentActions(t,{...o,limit:_e,cursor:s??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:r(s=>s.nextCursor??void 0,"getNextPageParam"),retry:r((s,p)=>!(p instanceof W&&p.status===403)&&s<2,"retry")}),K=i.error instanceof W&&i.error.status===403,P=i.data?.pages.some(s=>s.accessTier==="basic")??!1,oe=i.data?.pages.some(s=>s.accessTier==="full")??!1,G=(0,l.useMemo)(()=>{const s=i.data?.pages??[];return(P?s.filter(p=>p.accessTier!=="full"):s).flatMap(p=>p.items)},[i.data,P]),R=P?"basic":i.data?.pages[0]?.accessTier,N=P&&oe,ce=a?!0:R==="full",de=!!(N&&U&&!i.isFetching),D=!!(!a&&!de&&(K&&b||N)),w=!!(K&&!a&&f==="agents"&&c),ue=!!(!a&&c&&!w&&(f==="agents"||R==="full"));(0,l.useEffect)(()=>{w&&c?.("all")},[w,c]),(0,l.useEffect)(()=>{!a&&(R==="basic"||D)&&(g(n),B(n),V(n),$(n),q(""),z(""))},[R,N,a,D]),(0,l.useEffect)(()=>{if(!N){U&&H(!1);return}U||(H(!0),i.refetch())},[U,i,N]);const J=r(()=>{g(n),B(n),V(n),$(n),q(""),z("")},"clearFilters"),me=r(async()=>{Q(!0);try{const s=await ae.exportAgentActionsCsv(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),p=URL.createObjectURL(s),A=document.createElement("a");A.href=p,A.download=`${f==="agents"?"agent-audit":"activity"}-${t}.csv`,document.body.appendChild(A),A.click(),A.remove(),window.setTimeout(()=>URL.revokeObjectURL(p),5e3),h({title:"Audit exported",body:"Your CSV download has started.",tone:"success"})}catch(s){h({title:"Export failed",body:s instanceof Error?s.message:"Could not export the audit log.",tone:"error"})}finally{Q(!1)}},"handleExport");return K&&!D&&!w?(0,e.jsx)(Me,{}):(0,e.jsxs)("div",{className:"space-y-4",children:[d?null:(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Activity"}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:f==="agents"?"Every recorded agent action, newest first — with the responsible person and run behind each one.":"Everything happening in your company, newest first — people, agents, and the system. Each line is one recorded action."})]})}),ue?(0,e.jsx)(Ae,{value:f,onValueChange:r(s=>c?.(s),"onValueChange"),children:(0,e.jsxs)(we,{"aria-label":"Activity scope",children:[(0,e.jsx)(te,{value:"all",children:"All activity"}),(0,e.jsx)(te,{value:"agents",children:"Agent actions"})]})}):null,ce?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a?null:(0,e.jsxs)(F,{value:m,onValueChange:g,children:[(0,e.jsx)(L,{className:"w-40",children:(0,e.jsx)(_,{placeholder:"Agent"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All agents"}),(M.data??[]).map(s=>(0,e.jsx)(y,{value:s.id,children:s.name},s.id))]})]}),(0,e.jsxs)(F,{value:x,onValueChange:B,children:[(0,e.jsx)(L,{className:"w-52",children:(0,e.jsx)(_,{placeholder:"Responsible user"})}),(0,e.jsxs)(k,{children:[(0,e.jsx)(y,{value:n,children:"All responsible users"}),(O.data?.users??[]).map(s=>(0,e.jsx)(y,{value:s.principalId,children:s.user?.name??s.user?.email??s.principalId.slice(0,8)},s.principalId))]})]}),(0,e.jsxs)(F,{value:S,onValueChange:V,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Action"})}),(0,e.jsx)(k,{children:Fe.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsxs)(F,{value:C,onValueChange:$,children:[(0,e.jsx)(L,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Entity"})}),(0,e.jsx)(k,{children:ke.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsx)(se,{type:"date","aria-label":"From date",value:E,max:I||void 0,onChange:r(s=>q(s.target.value),"onChange"),className:"w-36"}),(0,e.jsx)(se,{type:"date","aria-label":"To date",value:I,min:E||void 0,onChange:r(s=>z(s.target.value),"onChange"),className:"w-36"}),b?(0,e.jsx)(T,{variant:"ghost",size:"sm",onClick:J,children:"Clear filters"}):null,(0,e.jsxs)(T,{variant:"outline",size:"sm",className:"ml-auto",onClick:me,disabled:Z||i.isLoading||G.length===0,children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-4 w-4"}),Z?"Exporting…":"Export CSV"]})]}):null,D||w?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Refreshing audit access…"})}):i.isLoading?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Loading…"})}):i.error?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i.error instanceof Error?i.error.message:"Failed to load the audit log."}),(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.refetch(),"onClick"),children:"Try again"})]})}):G.length===0?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(Re,{className:"h-10 w-10 text-muted-foreground/40"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:b?"No actions match these filters":"Nothing here yet"}),(0,e.jsx)("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:b?"Try a wider date range or different filters.":f==="agents"?"As soon as your agents start doing things, their actions show up here.":"As soon as anyone in your company does something, it shows up here."})]}),b?(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:J,children:"Clear filters"}):null]})}):(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"px-0 py-0",children:(0,e.jsx)("ul",{className:pe("divide-y divide-border"),children:G.map(s=>(0,e.jsx)(ze,{record:s,agentMap:ie,userProfileMap:le},s.id))})})}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null,(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recorded by Paperclip — entries can't be edited. Sensitive values are never stored."})]})}r(Oe,"AuditFeed");function nt(){const{selectedCompanyId:t}=fe(),{setBreadcrumbs:a}=je(),[d,u]=ve(),c=d.get("mode")==="agents"?"agents":"all";(0,l.useEffect)(()=>{a([{label:"Activity"}])},[a]);const h=(0,l.useCallback)(m=>{u(g=>{const x=new URLSearchParams(g);return m==="agents"?x.set("mode","agents"):x.delete("mode"),x},{replace:!0})},[u]);return t?(0,e.jsx)(Oe,{companyId:t,mode:c,onModeChange:h}):(0,e.jsx)(Ee,{icon:Pe,message:"Select a company to view activity."})}r(nt,"CompanyActivity");export{nt as CompanyActivity};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ze=Object.defineProperty;var d=(e,r)=>ze(e,"name",{value:r,configurable:!0});import{i as we}from"./rolldown-runtime-ZpX3ckPj.js";import{$t as De,Bi as te,Ct as _e,Er as Ue,G as ne,Ia as We,Ra as qe,St as G,ht as Ke,na as X,ta as pe}from"./agent-avatar-url-
|
|
1
|
+
var ze=Object.defineProperty;var d=(e,r)=>ze(e,"name",{value:r,configurable:!0});import{i as we}from"./rolldown-runtime-ZpX3ckPj.js";import{$t as De,Bi as te,Ct as _e,Er as Ue,G as ne,Ia as We,Ra as qe,St as G,ht as Ke,na as X,ta as pe}from"./agent-avatar-url-CVV7dJ4l.js";import{Ln as Ye,f as Ze,i as H,it as Ge,lt as z,n as Xe,r as He,y as Je}from"./BreadcrumbContext-k4_HOBKt.js";import{Z as Ve}from"./mention-chips-DvkvqPRN.js";import{h as Qe}from"./StatusIcon-fJLmzCDW.js";import{a as et}from"./ToastContext-CIri5s-I.js";import{t as fe}from"./MarkdownBody-DZY1Poyt.js";import{r as tt}from"./badge-Kf867ezN.js";import{t as me}from"./rotate-ccw-ChQUphBj.js";import{t as D}from"./EmptyState-NmkkuFFc.js";import{t as st}from"./PageSkeleton-Bk-YktL6.js";import{Jt as nt,Pt as rt,Ut as ot,a as at,dt as it,ft as he,hn as ct,ht as lt,i as dt,mt as ut,n as pt,pt as ft,r as mt,t as je,ut as ht}from"./index-gz2G0uzR.js";var h=we(qe(),1),xt=["agents","projects","skills","routines","tasks","attachments"],gt={agents:"Agents",projects:"Projects",skills:"Skills",routines:"Routines",tasks:"Tasks",attachments:"Attachments"};function bt(){return{agents:!0,projects:!0,skills:!0,routines:!0,tasks:!0,attachments:!0}}d(bt,"buildDefaultExportCategorySelection");function ye(e){return e.tasks||e.routines}d(ye,"isAttachmentsCategoryEnabled");function ve(e){const r=new Set;for(const a of e){if(!a.recurring)continue;const n=a.path.trim();if(!n)continue;r.add(n);const o=n.lastIndexOf("/");o>=0&&r.add(`${n.slice(0,o+1)}`)}return r}d(ve,"buildRecurringTaskPrefixes");function wt(e,r){for(const a of r)if(e===a||e.startsWith(a))return!0;return!1}d(wt,"isRecurringTaskFile");function jt(e){const r=new Set,a=new Set;for(const n of e)for(const o of n.attachments??[]){const c=o.sha256.trim().toLowerCase();c&&(n.recurring?r:a).add(c)}return{recurring:r,oneOff:a}}d(jt,"buildAttachmentShaOwnership");var yt=new Set(["agents","projects","skills","routines","tasks"]);function vt(e){const r=new Map;for(const a of e){const n=a.sha256.trim().toLowerCase();if(!n)continue;const o=r.get(n)??new Set,c=a.ownedBy&&a.ownedBy.length>0?a.ownedBy:["always"];for(const p of c)o.add(p);r.set(n,o)}return r}d(vt,"buildEmbeddedAssetShaOwnership");function kt(e,r){for(const a of e)if(!yt.has(a)||r[a])return!0;return!1}d(kt,"isEmbeddedAssetBlobIncluded");function ke(e,r){return e.startsWith("agents/")?"agents":e.startsWith("projects/")?"projects":e.startsWith("skills/")?"skills":e.startsWith("tasks/")?wt(e,r)?"routines":"tasks":e.startsWith("blobs/")?"attachments":null}d(ke,"categorizeExportFile");function St(e,r){const a=ve(r),n={agents:0,projects:0,skills:0,routines:0,tasks:0,attachments:0};for(const o of e){const c=ke(o,a);c&&(n[c]+=1)}return n}d(St,"countExportFilesByCategory");function Ct(e){const{filePaths:r,issues:a,categories:n}=e,o=ve(a),c=jt(a),p=vt(e.embeddedAssets??[]),f=n.attachments&&ye(n),x=new Set;for(const l of r){const b=ke(l,o);if(b===null){x.add(l);continue}if(b==="attachments"){const i=l.slice(6).trim().toLowerCase(),g=p.get(i);if(g&&kt(g,n)){x.add(l);continue}if(!f)continue;const j=c.recurring.has(i),y=c.oneOff.has(i);!j&&!y?g||x.add(l):(y&&n.tasks||j&&n.routines)&&x.add(l);continue}n[b]&&x.add(l)}return x}d(Ct,"buildExportCheckedFiles");function Se(e,r){if(!r.has(e))return r.add(e),e;let a=2;for(;;){const n=`${e}-${a}`;if(!r.has(n))return r.add(n),n;a+=1}}d(Se,"uniqueSlug");function Et(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=Ue(o.name)??"agent";a.set(o.id,Se(c,r))}return a}d(Et,"buildPortableAgentSlugMap");function Nt(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=De(o.name,o.name);a.set(o.id,Se(c,r))}return a}d(Nt,"buildPortableProjectSlugMap");function At(e){const r=Et(e.agents),a=Nt(e.projects),n={agents:e.orderedAgents.map(o=>r.get(o.id)).filter(o=>!!o),projects:e.orderedProjects.map(o=>a.get(o.id)).filter(o=>!!o)};return n.agents.length>0||n.projects.length>0?n:void 0}d(At,"buildPortableSidebarOrder");var t=we(We(),1);function Ce(e){const r=new Set,a=new Set,n=new Set;for(const o of e){const c=o.match(/^agents\/([^/]+)\//);c&&r.add(c[1]);const p=o.match(/^projects\/([^/]+)\//);p&&a.add(p[1]);const f=o.match(/^tasks\/([^/]+)\//);f&&n.add(f[1])}return{agents:r,projects:a,tasks:n,routines:new Set(n)}}d(Ce,"checkedSlugs");function Pt(e,r){const a=Ce(r),n=e.split(`
|
|
2
2
|
`),o=[],c=new Set(["agents","projects","tasks","routines"]),p=new Set(["agents","projects"]);let f=null,x=null,l=!0,b=null,i=null,g=[],j=null,y=[];function T(){i!==null&&g.length>0&&(y.push(i),y.push(...g)),i=null,g=[]}d(T,"flushSidebarSection");function N(){T(),j!==null&&y.length>0&&(o.push(j),o.push(...y)),j=null,y=[]}d(N,"flushSection");for(const w of n){const U=w.match(/^([a-zA-Z_][\w-]*):\s*(.*)$/);if(U&&!w.startsWith(" ")){N(),x=null,l=!0;const E=U[0].split(":")[0];if(c.has(E)){f=E,j=w;continue}else if(E==="sidebar"){f=E,b=null,j=w;continue}else{f=null,o.push(w);continue}}if(f==="sidebar"){const E=w.match(/^ ([\w-]+):\s*$/);if(E&&!w.startsWith(" ")){T();const A=E[1];b=A&&p.has(A)?A:null,i=b?w:null;continue}const L=w.match(/^ - ["']?([^"'\n]+)["']?\s*$/);if(L&&b){const A=L[1],W=a[b];A&&W.has(A)&&g.push(w);continue}if(b){g.push(w);continue}}if(f&&c.has(f)){const E=w.match(/^ ([\w][\w-]*):\s*(.*)$/);if(E&&!w.startsWith(" ")){const L=E[1];x=L,l=a[f].has(L),l&&y.push(w);continue}if(x!==null){l&&y.push(w);continue}y.push(w);continue}o.push(w)}N();let C=o.join(`
|
|
3
3
|
`);const _=C.match(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*$/m);return _&&!r.has(_[1])&&(C=C.replace(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*\n?/m,"")),C}d(Pt,"filterPaperclipYaml");function Ee(e,r){if(!r)return e;const a=r.toLowerCase();return e.map(n=>{if(n.kind==="file")return n.name.toLowerCase().includes(a)||n.path.toLowerCase().includes(a)?n:null;const o=Ee(n.children,r);return o.length>0?{...n,children:o}:null}).filter(n=>n!==null)}d(Ee,"filterTree");function Rt(e,r){const a=new Set,n=r.toLowerCase();function o(c,p){if(c.kind==="file"){if(c.name.toLowerCase().includes(n)||c.path.toLowerCase().includes(n))for(const f of p)a.add(f)}else for(const f of c.children)o(f,[...p,c.path])}d(o,"walk");for(const c of e)o(c,[]);return a}d(Rt,"collectMatchedParentDirs");var xe=10;function Tt(e,r,a,n){let o=0,c=0;return{nodes:e.map(p=>{if(p.kind==="dir"&&p.name==="tasks"){o=p.children.length;const f=[],x=[],l=a.toLowerCase();for(const g of p.children){const j=ft([g],"file"),y=n!==null&&j.has(n),T=a&&(g.name.toLowerCase().includes(l)||g.path.toLowerCase().includes(l)||[...j].some(N=>N.toLowerCase().includes(l)));y||T?f.push(g):x.push(g)}const b=Math.max(0,r-f.length),i=[...f,...x.slice(0,b)];return c=i.length,{...p,children:i}}return p}),totalTaskChildren:o,visibleTaskChildren:c}}d(Tt,"paginateTaskNodes");function Ne(e,r,a){const n={};for(const o of Object.keys(e))r.has(o)&&(n[o]=a[o]??e[o]);return n}d(Ne,"filterExportForDownload");function Lt(e,r,a){const n=Ne(e.files,r,a),o=dt(n,e.rootPath),c=new ArrayBuffer(o.byteLength);new Uint8Array(c).set(o);const p=new Blob([c],{type:"application/zip"}),f=URL.createObjectURL(p),x=document.createElement("a");x.href=f,x.download=`${e.rootPath}.zip`,document.body.appendChild(x),x.click(),x.remove(),window.setTimeout(()=>URL.revokeObjectURL(f),1e3)}d(Lt,"downloadZip");function Ot({data:e,onSkillClick:r}){return(0,t.jsx)("div",{className:"rounded-md border border-border bg-accent/20 px-4 py-3 mb-4",children:(0,t.jsx)("dl",{className:"grid grid-cols-(--gtc-5) gap-x-4 gap-y-1.5 text-sm",children:Object.entries(e).map(([a,n])=>(0,t.jsxs)("div",{className:"contents",children:[(0,t.jsx)("dt",{className:"text-muted-foreground whitespace-nowrap py-0.5",children:ht[a]??a}),(0,t.jsx)("dd",{className:"py-0.5",children:Array.isArray(n)?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(o=>(0,t.jsx)("button",{type:"button",className:ne("inline-flex items-center rounded-md border border-border bg-background px-2 py-0.5 text-xs",a==="skills"&&r&&"cursor-pointer hover:bg-accent/50 hover:border-foreground/30 transition-colors"),onClick:d(()=>a==="skills"&&r?.(o),"onClick"),children:o},o))}):(0,t.jsx)("span",{children:n})})]},a))})})}d(Ot,"FrontmatterCard");var Mt={ceo:"CEO",cto:"CTO",cmo:"CMO",cfo:"CFO",coo:"COO",vp:"VP",manager:"Manager",engineer:"Engineer",agent:"Agent"};function Ft(e,r,a,n){const o=Ce(r),c=e.agents.filter(i=>o.agents.has(i.slug)),p=e.projects.filter(i=>o.projects.has(i.slug)),f=e.issues.filter(i=>o.tasks.has(i.slug)),x=e.skills.filter(i=>[...r].some(g=>g.startsWith(`skills/${i.key}/`)||g.startsWith("skills/")&&g.includes(`/${i.slug}/`))),l=[];l.push(`# ${a}`),l.push(""),n&&(l.push(`> ${n}`),l.push("")),c.length>0&&(l.push(""),l.push("")),l.push("## What's Inside"),l.push(""),l.push("This is an [Agent Company](https://paperclip.ing) package."),l.push("");const b=[];if(c.length>0&&b.push(["Agents",c.length]),p.length>0&&b.push(["Projects",p.length]),x.length>0&&b.push(["Skills",x.length]),f.length>0&&b.push(["Tasks",f.length]),b.length>0){l.push("| Content | Count |"),l.push("|---------|-------|");for(const[i,g]of b)l.push(`| ${i} | ${g} |`);l.push("")}if(c.length>0){l.push("### Agents"),l.push(""),l.push("| Agent | Role | Reports To |"),l.push("|-------|------|------------|");for(const i of c){const g=Mt[i.role]??i.role,j=i.reportsToSlug??"—";l.push(`| ${i.name} | ${g} | ${j} |`)}l.push("")}if(p.length>0){l.push("### Projects"),l.push("");for(const i of p){const g=i.description?` — ${i.description}`:"";l.push(`- **${i.name}**${g}`)}l.push("")}return l.push("## Getting Started"),l.push(""),l.push("```bash"),l.push("npx @tickernelz/paperclip-pro company import this-github-url-or-folder"),l.push("```"),l.push(""),l.push("See [Paperclip](https://paperclip.ing) for more information."),l.push(""),l.push("---"),l.push(`Exported from [Paperclip](https://paperclip.ing) on ${new Date().toISOString().split("T")[0]}`),l.push(""),l.join(`
|
|
4
4
|
`)}d(Ft,"generateReadmeFromSelection");function It(e){const{src:r,selectedFile:a,allFiles:n,orgChartPreviewUrl:o}=e;if(/^(?:https?:|data:)/i.test(r))return null;if(r.replace(/^\.\//,"")==="images/org-chart.png"&&o)return o;const c=(a.includes("/")?a.slice(0,a.lastIndexOf("/")+1):"")+r,p=n[c]??n[r];return p?je(c in n?c:r,p):null}d(It,"resolveExportPreviewImageSrc");function $t({selectedFile:e,content:r,allFiles:a,orgChartPreviewUrl:n,onSkillClick:o}){if(!e||r===null)return(0,t.jsx)(D,{icon:z,message:"Select a file to preview its contents."});const c=pt(r),p=e.endsWith(".md")&&c!==null,f=p&&c?lt(c):null,x=mt(e,r)?je(e,r):null,l=p?b=>It({src:b,selectedFile:e,allFiles:a,orgChartPreviewUrl:n}):void 0;return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"border-b border-border px-5 py-3",children:(0,t.jsx)("div",{className:"truncate font-mono text-sm",children:e})}),(0,t.jsx)("div",{className:"min-h-(--sz-560px) px-5 py-5",children:f?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Ot,{data:f.data,onSkillClick:o}),f.body.trim()&&(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:f.body})]}):p?(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:c??""}):x?(0,t.jsx)("div",{className:"flex min-h-(--sz-520px) items-center justify-center rounded-lg border border-border bg-accent/10 p-6",children:(0,t.jsx)("img",{src:x,alt:e,className:"max-h-(--sz-480px) max-w-full object-contain"})}):c!==null?(0,t.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words border-0 bg-transparent p-0 font-mono text-sm text-foreground",children:(0,t.jsx)("code",{children:c})}):(0,t.jsx)("div",{className:"rounded-lg border border-border bg-accent/10 px-4 py-3 text-sm text-muted-foreground",children:"Binary asset preview is not available for this file type."})})]})}d($t,"ExportPreviewPane");function ge(e){const r="/company/export/files/",a=Je(e),n=a.indexOf(r);return n===-1?null:decodeURIComponent(a.slice(n+22))||null}d(ge,"filePathFromLocation");function be(e){const r=e.split("/").slice(0,-1),a=[];let n="";for(const o of r)n=n?`${n}/${o}`:o,a.push(n);return a}d(be,"expandAncestors");function Bt(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}d(Bt,"isAbortError");function se(e){return e instanceof Error?e.message:"Failed to load export data."}d(se,"previewErrorMessage");function Vt(){const{selectedCompanyId:e,selectedCompany:r}=Ke(),{setBreadcrumbs:a}=Xe(),{pushToast:n}=et(),o=Ze(),c=Ye(),p=(0,h.useRef)(ge(c.pathname)),{data:f}=X({queryKey:G.auth.session,queryFn:d(()=>_e.getSession(),"queryFn")}),{data:x=[]}=X({queryKey:G.agents.list(e),queryFn:d(()=>He.list(e),"queryFn"),enabled:!!e}),{data:l=[]}=X({queryKey:G.projects.list(e),queryFn:d(()=>Qe.list(e),"queryFn"),enabled:!!e}),{data:b}=X({queryKey:G.companies.exportFidelity(e),queryFn:d(()=>te.exportFidelity(e),"queryFn"),enabled:!!e}),[i,g]=(0,h.useState)(null),[j,y]=(0,h.useState)(null),[T,N]=(0,h.useState)(new Set),[C,_]=(0,h.useState)(()=>({...bt(),tasks:!1,routines:!1,attachments:!1})),[w,U]=(0,h.useState)(""),[E,L]=(0,h.useState)(xe),[A,W]=(0,h.useState)(!1),q=(0,h.useRef)(null),I=(0,h.useRef)(null),M=(0,h.useRef)(0),re=(0,h.useRef)(null),oe=f?.user?.id??f?.session?.userId??null,J=(0,h.useMemo)(()=>x.filter(s=>s.status!=="terminated"),[x]),V=(0,h.useMemo)(()=>l,[l]),{orderedAgents:ae}=nt({agents:J,companyId:e,userId:oe}),{orderedProjects:ie}=ot({projects:V,companyId:e,userId:oe}),ce=(0,h.useMemo)(()=>At({agents:J,orderedAgents:ae,projects:V,orderedProjects:ie}),[ae,ie,J,V]),Q=C.tasks||C.routines,ee=(0,h.useCallback)((s,u=!1)=>{y(s),s?o(`/company/export/files/${encodeURI(s)}`,{replace:u}):o("/company/export",{replace:u})},[o]);(0,h.useEffect)(()=>{if(!i)return;const s=ge(c.pathname);s&&s in i.files&&s!==j?(y(s),N(u=>{const m=new Set(u);for(const v of be(s))m.add(v);return m})):!s&&j&&y(null)},[c.pathname,i]),(0,h.useEffect)(()=>{a([{label:r?.name??"Organization",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Export"}])},[r?.name,a]);const P=pe({mutationFn:d(({includeIssues:s,includeSkills:u,signal:m})=>te.exportPreview(e,{include:{company:!0,agents:!0,projects:!0,issues:s,skills:u},sidebarOrder:ce},{signal:m}),"mutationFn"),onSuccess:d((s,u)=>{if(u.requestId!==M.current)return;g(s);const m=he(s.files),v=new Set;for(const k of m)k.kind==="dir"&&k.name!=="tasks"&&v.add(k.path);const S=p.current;if(S&&S in s.files){y(S);const k=be(S);N(new Set([...v,...k]))}else{const k="README.md"in s.files?"README.md":Object.keys(s.files)[0];k&&ee(k,!0),N(v)}},"onSuccess"),onError:d((s,u)=>{u.requestId!==M.current||Bt(s)||n({tone:"error",title:"Export failed",body:se(s)})},"onError")});function F(){if(!e)return;I.current?.abort();const s=new AbortController,u=M.current+1;M.current=u,I.current=s,W(!1),P.mutate({includeIssues:Q,includeSkills:C.skills,requestId:u,signal:s.signal})}d(F,"startPreviewRequest");const K=pe({mutationFn:d(()=>te.exportBundle(e,{include:{company:!0,agents:!0,projects:!0,issues:Q,skills:C.skills},selectedFiles:Array.from(R).sort(),sidebarOrder:ce}),"mutationFn"),onSuccess:d(s=>{const u=new Set(Object.keys(s.files));Lt(s,u,s.files),n({tone:"success",title:"Export downloaded",body:`${u.size} file${u.size===1?"":"s"} exported as ${s.rootPath}.zip`})},"onSuccess"),onError:d(s=>{n({tone:"error",title:"Export failed",body:s instanceof Error?s.message:"Failed to build export package."})},"onError")});(0,h.useEffect)(()=>{e&&(re.current!==e&&(re.current=e,g(null),y(null)),F())},[e,Q,C.skills]),(0,h.useEffect)(()=>()=>{M.current+=1,I.current?.abort()},[]);const O=(0,h.useMemo)(()=>i?he(i.files):[],[i]),R=(0,h.useMemo)(()=>i?Ct({filePaths:Object.keys(i.files),issues:i.manifest.issues,categories:C,embeddedAssets:i.manifest.embeddedAssets??[]}):new Set,[i,C]),Ae=(0,h.useMemo)(()=>i?St(Object.keys(i.files),i.manifest.issues):null,[i]),{displayTree:Pe,totalTaskChildren:le,visibleTaskChildren:de}=(0,h.useMemo)(()=>{let s=O;w&&(s=Ee(s,w));const u=Tt(s,E,w,j);return{displayTree:u.nodes,totalTaskChildren:u.totalTaskChildren,visibleTaskChildren:u.visibleTaskChildren}},[O,w,E,j]),Re=(0,h.useMemo)(()=>{const s={};function u(m){if(m.kind==="file"){const S=R.has(m.path);return S||(s[m.path]="muted"),S}let v=!1;for(const S of m.children)u(S)&&(v=!0);return v||(s[m.path]="muted"),v}d(u,"walk");for(const m of O)u(m);return s},[O,R]),Y=(0,h.useMemo)(()=>{if(!i)return{};const s={...i.files},u=i.paperclipExtensionPath;if(u&&typeof i.files[u]=="string"&&(s[u]=Pt(i.files[u],R)),typeof i.files["README.md"]=="string"){const m=i.manifest.company?.name??r?.name??"Company",v=i.manifest.company?.description??null;s["README.md"]=Ft(i.manifest,R,m,v)}return s},[i,R,r?.name]),Te=(0,h.useMemo)(()=>i?at(Ne(i.files,R,Y),i.rootPath):0,[i,R,Y]),ue=(0,h.useMemo)(()=>ut(O),[O]),$=R.size,B=(0,h.useMemo)(()=>i?i.warnings.filter(s=>!/terminated agent/i.test(s)):[],[i]);function Le(s){N(u=>{const m=new Set(u);return m.has(s)?m.delete(s):m.add(s),m})}d(Le,"handleToggleDir");function Oe(s){_(u=>({...u,[s]:!u[s]}))}d(Oe,"handleToggleCategory");function Me(s){const u=w.length>0,m=s.length>0;if(m&&!u&&(q.current=new Set(T)),U(s),m){const v=Rt(O,s);N(S=>{const k=new Set(S);for(const Z of v)k.add(Z);return k})}else u&&q.current&&(N(q.current),q.current=null)}d(Me,"handleSearchChange");function Fe(s){if(!i)return;const u=i.manifest.skills.find(m=>m.key===s||m.slug===s)?.path??`skills/${s}/SKILL.md`;u in i.files&&(ee(u),N(m=>{const v=new Set(m);v.add("skills");const S=u.split("/").slice(0,-1);let k="";for(const Z of S)k=k?`${k}/${Z}`:Z,v.add(k);return v}))}d(Fe,"handleSkillClick");function Ie(){!i||R.size===0||K.isPending||K.mutate()}d(Ie,"handleDownload");function $e(){M.current+=1,I.current?.abort(),I.current=null,P.reset(),W(!0)}if(d($e,"handleCancelPreview"),!e)return(0,t.jsx)(D,{icon:z,message:"Select an organization to export."});if(P.isPending&&!i)return(0,t.jsx)(st,{variant:"detail"});if(A&&!i)return(0,t.jsx)(D,{icon:z,title:"Export preview cancelled",message:"The preview request was cancelled. Your export settings are unchanged.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(P.isError&&!i)return(0,t.jsx)(D,{icon:z,title:"Export preview failed",message:se(P.error),description:"Retry the preview. You do not need to reload this page.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(!i)return(0,t.jsx)(D,{icon:z,title:"Export preview unavailable",message:"No export preview is loaded.",action:"Load preview",onAction:F,hideActionIcon:!0});const Be=j?Y[j]??null:null;return(0,t.jsxs)("div",{className:"max-w-6xl",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 border-b border-border bg-background px-5 py-3",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[(0,t.jsxs)("span",{className:"font-medium",children:[r?.name??"Organization"," export"]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["Exporting ",$.toLocaleString()," of ",ue.toLocaleString()," file",ue===1?"":"s",$>0&&` (~${rt(Te)})`]}),B.length>0&&(0,t.jsxs)("span",{className:"text-amber-500",children:[B.length," warning",B.length===1?"":"s"]})]}),(0,t.jsxs)(H,{size:"sm",onClick:Ie,disabled:$===0||K.isPending||P.isPending||P.isError||A,children:[(0,t.jsx)(ct,{className:"mr-1.5 h-3.5 w-3.5"}),K.isPending?"Building export...":`Export ${$.toLocaleString()} file${$===1?"":"s"}`]})]})}),B.length>0&&(0,t.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:B.map(s=>(0,t.jsx)("div",{className:"text-xs text-amber-500",children:s},s))}),b&&b.warnings.length>0&&(0,t.jsxs)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:[(0,t.jsx)("h3",{className:"mb-1.5 text-xs font-medium",children:"Not included in this export"}),b.warnings.map(s=>(0,t.jsx)("div",{className:ne("text-xs",s.severity==="blocker"?"font-medium text-destructive":"text-amber-500"),children:s.message},s.code))]}),(0,t.jsxs)("div",{className:"grid gap-4 xl:h-(--sz-calc-30) xl:grid-cols-(--gtc-25) xl:gap-0",children:[(0,t.jsxs)("aside",{className:"flex max-h-(--sz-24rem) flex-col overflow-hidden border-b border-border xl:max-h-none xl:border-b-0 xl:border-r",children:[(0,t.jsx)("div",{className:"border-b border-border px-4 py-3 shrink-0",children:(0,t.jsx)("h2",{className:"text-base font-semibold",children:"Package files"})}),(0,t.jsxs)("div",{className:"border-b border-border px-4 py-3 shrink-0",children:[(0,t.jsx)("h3",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"What to include"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5",role:"group","aria-label":"What to include",children:xt.map(s=>{const u=s==="attachments"&&!ye(C),m=C[s]&&!u,v=Ae?.[s]??0,S=i.manifest.includes.issues||s!=="tasks"&&s!=="routines"&&s!=="attachments";return(0,t.jsxs)("label",{className:ne("flex items-center gap-2 text-sm",u?"cursor-not-allowed opacity-50":"cursor-pointer"),title:u?"Attachments travel with tasks and routines; re-enable one of them to include attachments.":void 0,children:[(0,t.jsx)("input",{type:"checkbox",checked:m,disabled:u,onChange:d(()=>Oe(s),"onChange"),className:"accent-foreground","data-export-category":s}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:gt[s]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:S?v.toLocaleString():"—"})]},s)})}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Task and routine history is opt-in because it can be large."})]}),(0,t.jsx)("div",{className:"border-b border-border px-3 py-2 shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border px-2 py-1",children:[(0,t.jsx)(Ge,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("input",{type:"text",value:w,onChange:d(s=>Me(s.target.value),"onChange"),placeholder:"Search files...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-page-search-target":"true"})]})}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,t.jsx)(it,{nodes:Pe,selectedFile:j,expandedDirs:T,onToggleDir:Le,onSelectFile:ee,fileTones:Re,showCheckboxes:!1,wrapLabels:!1}),le>de&&!w&&(0,t.jsx)("div",{className:"px-4 py-2",children:(0,t.jsxs)("button",{type:"button",onClick:d(()=>L(s=>s+xe),"onClick"),className:"w-full rounded-md border border-border px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/30 hover:text-foreground transition-colors",children:["Show more tasks (",de," of ",le,")"]})})]})]}),(0,t.jsxs)("div",{className:"relative min-w-0 overflow-y-auto xl:pl-6",children:[(0,t.jsx)($t,{selectedFile:j,content:Be,allFiles:Y,orgChartPreviewUrl:`/api/companies/${encodeURIComponent(e)}/org.svg`,onSkillClick:Fe}),P.isPending?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center",role:"status","aria-live":"polite","aria-busy":"true","data-export-preview-state":"loading",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsx)(tt,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Updating export preview…"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large task histories can take a minute. You can untick Tasks or cancel this update."})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:$e,children:[(0,t.jsx)(Ve,{}),"Cancel update"]})]})}):A?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center","data-export-preview-state":"cancelled",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Preview update cancelled"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"The previous preview remains available. Retry when you are ready."})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):P.isError?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center",role:"alert","data-export-preview-state":"error",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-destructive",children:"Export preview failed"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:se(P.error)})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):null]})]})]})}d(Vt,"CompanyExport");export{Vt as CompanyExport};
|