agent-relay-server 0.61.2 → 0.62.0
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/docs/openapi.json +479 -1
- package/package.json +2 -2
- package/public/assets/{MessageBubble-DVvlvi4B.js → MessageBubble-BP0Ym3xb.js} +2 -2
- package/public/assets/{MessageBubble-DVvlvi4B.js.map → MessageBubble-BP0Ym3xb.js.map} +1 -1
- package/public/assets/PlanGraphPanel-DKc3gdou.js +2 -0
- package/public/assets/PlanGraphPanel-DKc3gdou.js.map +1 -0
- package/public/assets/{activity-IYl3MEXC.js → activity-CRLG6ICe.js} +2 -2
- package/public/assets/{activity-IYl3MEXC.js.map → activity-CRLG6ICe.js.map} +1 -1
- package/public/assets/{agent-profiles-BfGTTbeY.js → agent-profiles-DItyEkXP.js} +2 -2
- package/public/assets/{agent-profiles-BfGTTbeY.js.map → agent-profiles-DItyEkXP.js.map} +1 -1
- package/public/assets/{agents-BquvREQr.js → agents-5mKiZ1rz.js} +2 -2
- package/public/assets/{agents-BquvREQr.js.map → agents-5mKiZ1rz.js.map} +1 -1
- package/public/assets/{analytics-De0cEZGx.js → analytics-J5pPcS-v.js} +3 -3
- package/public/assets/{analytics-De0cEZGx.js.map → analytics-J5pPcS-v.js.map} +1 -1
- package/public/assets/{automation-Ddbermbi.js → automation-BG2HWK5N.js} +2 -2
- package/public/assets/{automation-Ddbermbi.js.map → automation-BG2HWK5N.js.map} +1 -1
- package/public/assets/{badge-DhLyCPag.js → badge-CZhIdlTJ.js} +2 -2
- package/public/assets/{badge-DhLyCPag.js.map → badge-CZhIdlTJ.js.map} +1 -1
- package/public/assets/{branch-state-badge-DSyWKluD.js → branch-state-badge-BZMoxs65.js} +2 -2
- package/public/assets/{branch-state-badge-DSyWKluD.js.map → branch-state-badge-BZMoxs65.js.map} +1 -1
- package/public/assets/{button-K20wAZG1.js → button-2taQeNHW.js} +2 -2
- package/public/assets/{button-K20wAZG1.js.map → button-2taQeNHW.js.map} +1 -1
- package/public/assets/card-DzIsAI41.js +2 -0
- package/public/assets/{card-CcZ9hLI7.js.map → card-DzIsAI41.js.map} +1 -1
- package/public/assets/channels-B2PeqiRT.js +2 -0
- package/public/assets/{channels-BG0Nib7y.js.map → channels-B2PeqiRT.js.map} +1 -1
- package/public/assets/chat-CLRJVagA.js +2 -0
- package/public/assets/{chat-Dx6qWNxb.js.map → chat-CLRJVagA.js.map} +1 -1
- package/public/assets/{connectors-DWh7MwV_.js → connectors-Bzvkxsgo.js} +2 -2
- package/public/assets/{connectors-DWh7MwV_.js.map → connectors-Bzvkxsgo.js.map} +1 -1
- package/public/assets/copy-button-HEkwi6xX.js +2 -0
- package/public/assets/{copy-button-eF3cKp4Q.js.map → copy-button-HEkwi6xX.js.map} +1 -1
- package/public/assets/display-DzNvOu1j.js.map +1 -1
- package/public/assets/dist-1rXN5FN9.js +2 -0
- package/public/assets/{dist-YpHfnnIA.js.map → dist-1rXN5FN9.js.map} +1 -1
- package/public/assets/{dist-1dhfdhm9.js → dist-AbEQuFoK.js} +2 -2
- package/public/assets/{dist-1dhfdhm9.js.map → dist-AbEQuFoK.js.map} +1 -1
- package/public/assets/{dist-COQuunEv.js → dist-B7p1zkvf.js} +2 -2
- package/public/assets/{dist-COQuunEv.js.map → dist-B7p1zkvf.js.map} +1 -1
- package/public/assets/{dist-Ci5Y37nj.js → dist-CG10hM1-.js} +2 -2
- package/public/assets/{dist-Ci5Y37nj.js.map → dist-CG10hM1-.js.map} +1 -1
- package/public/assets/dist-Cfm5_zPB.js +2 -0
- package/public/assets/{dist-qd198ib9.js.map → dist-Cfm5_zPB.js.map} +1 -1
- package/public/assets/{dist-BrQsqBbc.js → dist-Cgw85UcE.js} +2 -2
- package/public/assets/{dist-BrQsqBbc.js.map → dist-Cgw85UcE.js.map} +1 -1
- package/public/assets/{dist-CoROafNg.js → dist-D3_TJKTC.js} +2 -2
- package/public/assets/{dist-CoROafNg.js.map → dist-D3_TJKTC.js.map} +1 -1
- package/public/assets/{dist-I-MFUv51.js → dist-DQkLq0hs.js} +2 -2
- package/public/assets/{dist-I-MFUv51.js.map → dist-DQkLq0hs.js.map} +1 -1
- package/public/assets/{dist-UQGKwqZH.js → dist-D_sl7u_f.js} +2 -2
- package/public/assets/{dist-UQGKwqZH.js.map → dist-D_sl7u_f.js.map} +1 -1
- package/public/assets/{dist-yGOq6sB3.js → dist-Ilb3r1im.js} +2 -2
- package/public/assets/{dist-yGOq6sB3.js.map → dist-Ilb3r1im.js.map} +1 -1
- package/public/assets/dist-Pf_3Gf38.js +2 -0
- package/public/assets/{dist-BLBF7qqr.js.map → dist-Pf_3Gf38.js.map} +1 -1
- package/public/assets/{es2015-CRxz9lOj.js → es2015-GSepNaIS.js} +2 -2
- package/public/assets/{es2015-CRxz9lOj.js.map → es2015-GSepNaIS.js.map} +1 -1
- package/public/assets/{formatted-body-impl-DMm6jeqi.js → formatted-body-impl-QqHxdMGP.js} +2 -2
- package/public/assets/{formatted-body-impl-DMm6jeqi.js.map → formatted-body-impl-QqHxdMGP.js.map} +1 -1
- package/public/assets/index-CCp1V35c.js +22 -0
- package/public/assets/index-CCp1V35c.js.map +1 -0
- package/public/assets/index-DiR-fqy_.css +2 -0
- package/public/assets/{input-BHYNpXAG.js → input-BsNqlONJ.js} +2 -2
- package/public/assets/{input-BHYNpXAG.js.map → input-BsNqlONJ.js.map} +1 -1
- package/public/assets/{insights-C7wKt1_l.js → insights-D-EyDfoZ.js} +2 -2
- package/public/assets/{insights-C7wKt1_l.js.map → insights-D-EyDfoZ.js.map} +1 -1
- package/public/assets/{integrations-CG9qyHUf.js → integrations-D1kc-yNi.js} +2 -2
- package/public/assets/{integrations-CG9qyHUf.js.map → integrations-D1kc-yNi.js.map} +1 -1
- package/public/assets/{lib-Df4aph5u.js → lib-bXPu6xCL.js} +2 -2
- package/public/assets/{lib-Df4aph5u.js.map → lib-bXPu6xCL.js.map} +1 -1
- package/public/assets/lucide-react-DWYjU-AF.js +9 -0
- package/public/assets/{lucide-react-L2UxFDic.js.map → lucide-react-DWYjU-AF.js.map} +1 -1
- package/public/assets/{maintenance-CjpvnV_U.js → maintenance-COqID7aq.js} +2 -2
- package/public/assets/{maintenance-CjpvnV_U.js.map → maintenance-COqID7aq.js.map} +1 -1
- package/public/assets/{managed-agents-CdfuBKJA.js → managed-agents-b4B8qewQ.js} +2 -2
- package/public/assets/{managed-agents-CdfuBKJA.js.map → managed-agents-b4B8qewQ.js.map} +1 -1
- package/public/assets/{markdown-preview-impl-Cf4xCmWt.js → markdown-preview-impl-D7o8jS07.js} +2 -2
- package/public/assets/{markdown-preview-impl-Cf4xCmWt.js.map → markdown-preview-impl-D7o8jS07.js.map} +1 -1
- package/public/assets/memory-Q0qF7_i3.js +2 -0
- package/public/assets/{memory-xKWduhyr.js.map → memory-Q0qF7_i3.js.map} +1 -1
- package/public/assets/{messages-BpZYOUtJ.js → messages-m4EpkK6s.js} +2 -2
- package/public/assets/{messages-BpZYOUtJ.js.map → messages-m4EpkK6s.js.map} +1 -1
- package/public/assets/{orchestrators-BrJvGIOc.js → orchestrators-CnAtGfUN.js} +2 -2
- package/public/assets/{orchestrators-BrJvGIOc.js.map → orchestrators-CnAtGfUN.js.map} +1 -1
- package/public/assets/{overview-BUORwePi.js → overview-D7CF88ik.js} +2 -2
- package/public/assets/{overview-BUORwePi.js.map → overview-D7CF88ik.js.map} +1 -1
- package/public/assets/pairs-Q6PlFJtH.js +2 -0
- package/public/assets/{pairs-DR0GizDN.js.map → pairs-Q6PlFJtH.js.map} +1 -1
- package/public/assets/{react-dom-CrP_AtcL.js → react-dom-CPghDLpB.js} +2 -2
- package/public/assets/{react-dom-CrP_AtcL.js.map → react-dom-CPghDLpB.js.map} +1 -1
- package/public/assets/{security-DLwSqTc_.js → security-BeV-6SdA.js} +2 -2
- package/public/assets/{security-DLwSqTc_.js.map → security-BeV-6SdA.js.map} +1 -1
- package/public/assets/{select-pEru111r.js → select-Dchc0_Jg.js} +2 -2
- package/public/assets/{select-pEru111r.js.map → select-Dchc0_Jg.js.map} +1 -1
- package/public/assets/{settings-B-ueGvwV.js → settings-hPwL-31u.js} +3 -3
- package/public/assets/{settings-B-ueGvwV.js.map → settings-hPwL-31u.js.map} +1 -1
- package/public/assets/store-Buwkqv_7.js +9 -0
- package/public/assets/store-Buwkqv_7.js.map +1 -0
- package/public/assets/tasks-DKUMPEgk.js +2 -0
- package/public/assets/{tasks-C2rRQm6E.js.map → tasks-DKUMPEgk.js.map} +1 -1
- package/public/assets/teams-T5fFsdOX.js +2 -0
- package/public/assets/teams-T5fFsdOX.js.map +1 -0
- package/public/assets/{terminal-viewer-impl-BM_3qoeN.js → terminal-viewer-impl-Bk0u_Mav.js} +3 -3
- package/public/assets/{terminal-viewer-impl-BM_3qoeN.js.map → terminal-viewer-impl-Bk0u_Mav.js.map} +1 -1
- package/public/assets/{use-keyboard-viewport-DrRH_QzG.js → use-keyboard-viewport-NKw1O5gC.js} +2 -2
- package/public/assets/{use-keyboard-viewport-DrRH_QzG.js.map → use-keyboard-viewport-NKw1O5gC.js.map} +1 -1
- package/public/assets/{work-queue-CkIYDAZD.js → work-queue-D26jok09.js} +2 -2
- package/public/assets/{work-queue-CkIYDAZD.js.map → work-queue-D26jok09.js.map} +1 -1
- package/public/assets/{workspaces-CYm5bLg9.js → workspaces-BMj6zx23.js} +3 -3
- package/public/assets/{workspaces-CYm5bLg9.js.map → workspaces-BMj6zx23.js.map} +1 -1
- package/public/index.html +21 -21
- package/src/automations.ts +40 -7
- package/src/branch-landed.ts +5 -0
- package/src/bus.ts +3 -0
- package/src/cli/workspace.ts +9 -17
- package/src/db/activity.ts +191 -3
- package/src/db/integrations.ts +1 -0
- package/src/db/issue-associations.ts +128 -0
- package/src/db/issue-lifecycle.ts +187 -0
- package/src/db/issue-refs.ts +254 -0
- package/src/db/mappers.ts +2 -0
- package/src/db/migrations.ts +47 -0
- package/src/db/schema.ts +2 -2
- package/src/issue-tracker/adapter.ts +24 -0
- package/src/issue-tracker/github.ts +136 -0
- package/src/issue-tracker/index.ts +13 -0
- package/src/issue-tracker/registry.ts +26 -0
- package/src/maintenance.ts +22 -169
- package/src/mcp-issue-activity-tools.ts +114 -0
- package/src/mcp-issue-association-tools.ts +130 -0
- package/src/mcp-issue-lifecycle-tools.ts +55 -0
- package/src/mcp-issue-ref-tools.ts +174 -0
- package/src/mcp-team-tools.ts +1 -1
- package/src/mcp.ts +3 -3
- package/src/provider-config-store.ts +30 -8
- package/src/routes/activity.ts +6 -1
- package/src/routes/commands.ts +29 -0
- package/src/routes/index.ts +19 -0
- package/src/routes/issue-activity.ts +78 -0
- package/src/routes/issue-associations.ts +76 -0
- package/src/routes/issue-lifecycle.ts +34 -0
- package/src/routes/issue-refs.ts +137 -0
- package/src/routes/orchestrator.ts +42 -1
- package/src/security.ts +8 -0
- package/src/services/issue-activity.ts +30 -0
- package/src/services/issue-associations.ts +72 -0
- package/src/services/issue-lifecycle.ts +308 -0
- package/src/services/issue-refs.ts +32 -0
- package/src/services/plan-graph.ts +40 -2
- package/src/services/team.ts +4 -0
- package/src/token-db.ts +3 -3
- package/src/workspace-actions.ts +8 -1
- package/src/workspace-auto-merge.ts +228 -0
- package/src/workspace-probe.ts +125 -0
- package/public/assets/PlanGraphPanel-Dby7wq9c.js +0 -2
- package/public/assets/PlanGraphPanel-Dby7wq9c.js.map +0 -1
- package/public/assets/card-CcZ9hLI7.js +0 -2
- package/public/assets/channels-BG0Nib7y.js +0 -2
- package/public/assets/chat-Dx6qWNxb.js +0 -2
- package/public/assets/copy-button-eF3cKp4Q.js +0 -2
- package/public/assets/dist-BLBF7qqr.js +0 -2
- package/public/assets/dist-YpHfnnIA.js +0 -2
- package/public/assets/dist-qd198ib9.js +0 -2
- package/public/assets/index-B3wOeAPO.js +0 -21
- package/public/assets/index-B3wOeAPO.js.map +0 -1
- package/public/assets/index-Dn_GDXbi.css +0 -2
- package/public/assets/lucide-react-L2UxFDic.js +0 -9
- package/public/assets/memory-xKWduhyr.js +0 -2
- package/public/assets/pairs-DR0GizDN.js +0 -2
- package/public/assets/store-B8xP6z6T.js +0 -9
- package/public/assets/store-B8xP6z6T.js.map +0 -1
- package/public/assets/tasks-C2rRQm6E.js +0 -2
- package/public/assets/teams-Bo0sdBTp.js +0 -2
- package/public/assets/teams-Bo0sdBTp.js.map +0 -1
package/docs/openapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"openapi": "3.1.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Agent Relay API",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.62.0",
|
|
6
6
|
"description": "Real-time message bus for inter-agent communication. Agent-first: this spec is designed for machine consumption — agents can self-discover the full API surface via GET /api/spec.",
|
|
7
7
|
"license": {
|
|
8
8
|
"name": "MIT",
|
|
@@ -7901,6 +7901,484 @@
|
|
|
7901
7901
|
]
|
|
7902
7902
|
}
|
|
7903
7903
|
},
|
|
7904
|
+
"/api/issue-associations": {
|
|
7905
|
+
"post": {
|
|
7906
|
+
"operationId": "postIssueAssociationRoute",
|
|
7907
|
+
"summary": "Post Issue Association",
|
|
7908
|
+
"tags": [
|
|
7909
|
+
"Other"
|
|
7910
|
+
],
|
|
7911
|
+
"responses": {
|
|
7912
|
+
"200": {
|
|
7913
|
+
"description": "Success",
|
|
7914
|
+
"content": {
|
|
7915
|
+
"application/json": {}
|
|
7916
|
+
}
|
|
7917
|
+
}
|
|
7918
|
+
},
|
|
7919
|
+
"security": [
|
|
7920
|
+
{
|
|
7921
|
+
"bearerAuth": []
|
|
7922
|
+
},
|
|
7923
|
+
{
|
|
7924
|
+
"tokenHeader": []
|
|
7925
|
+
},
|
|
7926
|
+
{
|
|
7927
|
+
"tokenQuery": []
|
|
7928
|
+
}
|
|
7929
|
+
]
|
|
7930
|
+
},
|
|
7931
|
+
"delete": {
|
|
7932
|
+
"operationId": "deleteIssueAssociationRoute",
|
|
7933
|
+
"summary": "Delete Issue Association",
|
|
7934
|
+
"tags": [
|
|
7935
|
+
"Other"
|
|
7936
|
+
],
|
|
7937
|
+
"responses": {
|
|
7938
|
+
"200": {
|
|
7939
|
+
"description": "Success",
|
|
7940
|
+
"content": {
|
|
7941
|
+
"application/json": {}
|
|
7942
|
+
}
|
|
7943
|
+
}
|
|
7944
|
+
},
|
|
7945
|
+
"security": [
|
|
7946
|
+
{
|
|
7947
|
+
"bearerAuth": []
|
|
7948
|
+
},
|
|
7949
|
+
{
|
|
7950
|
+
"tokenHeader": []
|
|
7951
|
+
},
|
|
7952
|
+
{
|
|
7953
|
+
"tokenQuery": []
|
|
7954
|
+
}
|
|
7955
|
+
]
|
|
7956
|
+
}
|
|
7957
|
+
},
|
|
7958
|
+
"/api/issue-associations/entities/{entityType}/{entityId}/issues": {
|
|
7959
|
+
"get": {
|
|
7960
|
+
"operationId": "getIssueAssociationEntityIssuesRoute",
|
|
7961
|
+
"summary": "Get Issue Association Entity Issues",
|
|
7962
|
+
"tags": [
|
|
7963
|
+
"Other"
|
|
7964
|
+
],
|
|
7965
|
+
"parameters": [
|
|
7966
|
+
{
|
|
7967
|
+
"name": "entityType",
|
|
7968
|
+
"in": "path",
|
|
7969
|
+
"required": true,
|
|
7970
|
+
"schema": {
|
|
7971
|
+
"type": "string"
|
|
7972
|
+
}
|
|
7973
|
+
},
|
|
7974
|
+
{
|
|
7975
|
+
"name": "entityId",
|
|
7976
|
+
"in": "path",
|
|
7977
|
+
"required": true,
|
|
7978
|
+
"schema": {
|
|
7979
|
+
"type": "string"
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
],
|
|
7983
|
+
"responses": {
|
|
7984
|
+
"200": {
|
|
7985
|
+
"description": "Success",
|
|
7986
|
+
"content": {
|
|
7987
|
+
"application/json": {}
|
|
7988
|
+
}
|
|
7989
|
+
}
|
|
7990
|
+
},
|
|
7991
|
+
"security": [
|
|
7992
|
+
{
|
|
7993
|
+
"bearerAuth": []
|
|
7994
|
+
},
|
|
7995
|
+
{
|
|
7996
|
+
"tokenHeader": []
|
|
7997
|
+
},
|
|
7998
|
+
{
|
|
7999
|
+
"tokenQuery": []
|
|
8000
|
+
}
|
|
8001
|
+
]
|
|
8002
|
+
}
|
|
8003
|
+
},
|
|
8004
|
+
"/api/issue-associations/issues/{issueRefId}/entities": {
|
|
8005
|
+
"get": {
|
|
8006
|
+
"operationId": "getIssueAssociationIssueEntitiesRoute",
|
|
8007
|
+
"summary": "Get Issue Association Issue Entities",
|
|
8008
|
+
"tags": [
|
|
8009
|
+
"Other"
|
|
8010
|
+
],
|
|
8011
|
+
"parameters": [
|
|
8012
|
+
{
|
|
8013
|
+
"name": "issueRefId",
|
|
8014
|
+
"in": "path",
|
|
8015
|
+
"required": true,
|
|
8016
|
+
"schema": {
|
|
8017
|
+
"type": "string"
|
|
8018
|
+
}
|
|
8019
|
+
}
|
|
8020
|
+
],
|
|
8021
|
+
"responses": {
|
|
8022
|
+
"200": {
|
|
8023
|
+
"description": "Success",
|
|
8024
|
+
"content": {
|
|
8025
|
+
"application/json": {}
|
|
8026
|
+
}
|
|
8027
|
+
}
|
|
8028
|
+
},
|
|
8029
|
+
"security": [
|
|
8030
|
+
{
|
|
8031
|
+
"bearerAuth": []
|
|
8032
|
+
},
|
|
8033
|
+
{
|
|
8034
|
+
"tokenHeader": []
|
|
8035
|
+
},
|
|
8036
|
+
{
|
|
8037
|
+
"tokenQuery": []
|
|
8038
|
+
}
|
|
8039
|
+
]
|
|
8040
|
+
}
|
|
8041
|
+
},
|
|
8042
|
+
"/api/issue-activity": {
|
|
8043
|
+
"post": {
|
|
8044
|
+
"operationId": "postIssueActivityRoute",
|
|
8045
|
+
"summary": "Post Issue Activity",
|
|
8046
|
+
"tags": [
|
|
8047
|
+
"Other"
|
|
8048
|
+
],
|
|
8049
|
+
"responses": {
|
|
8050
|
+
"200": {
|
|
8051
|
+
"description": "Success",
|
|
8052
|
+
"content": {
|
|
8053
|
+
"application/json": {}
|
|
8054
|
+
}
|
|
8055
|
+
}
|
|
8056
|
+
},
|
|
8057
|
+
"security": [
|
|
8058
|
+
{
|
|
8059
|
+
"bearerAuth": []
|
|
8060
|
+
},
|
|
8061
|
+
{
|
|
8062
|
+
"tokenHeader": []
|
|
8063
|
+
},
|
|
8064
|
+
{
|
|
8065
|
+
"tokenQuery": []
|
|
8066
|
+
}
|
|
8067
|
+
]
|
|
8068
|
+
}
|
|
8069
|
+
},
|
|
8070
|
+
"/api/issue-activity/issues": {
|
|
8071
|
+
"get": {
|
|
8072
|
+
"operationId": "getIssueActivityAgentsRoute",
|
|
8073
|
+
"summary": "Get Issue Activity Agents",
|
|
8074
|
+
"tags": [
|
|
8075
|
+
"Other"
|
|
8076
|
+
],
|
|
8077
|
+
"responses": {
|
|
8078
|
+
"200": {
|
|
8079
|
+
"description": "Success",
|
|
8080
|
+
"content": {
|
|
8081
|
+
"application/json": {}
|
|
8082
|
+
}
|
|
8083
|
+
}
|
|
8084
|
+
},
|
|
8085
|
+
"security": [
|
|
8086
|
+
{
|
|
8087
|
+
"bearerAuth": []
|
|
8088
|
+
},
|
|
8089
|
+
{
|
|
8090
|
+
"tokenHeader": []
|
|
8091
|
+
},
|
|
8092
|
+
{
|
|
8093
|
+
"tokenQuery": []
|
|
8094
|
+
}
|
|
8095
|
+
]
|
|
8096
|
+
}
|
|
8097
|
+
},
|
|
8098
|
+
"/api/issue-activity/agents/{id}": {
|
|
8099
|
+
"get": {
|
|
8100
|
+
"operationId": "getAgentIssueActivityRoute",
|
|
8101
|
+
"summary": "Get Agent Issue Activity",
|
|
8102
|
+
"tags": [
|
|
8103
|
+
"Other"
|
|
8104
|
+
],
|
|
8105
|
+
"parameters": [
|
|
8106
|
+
{
|
|
8107
|
+
"name": "id",
|
|
8108
|
+
"in": "path",
|
|
8109
|
+
"required": true,
|
|
8110
|
+
"schema": {
|
|
8111
|
+
"type": "string"
|
|
8112
|
+
}
|
|
8113
|
+
}
|
|
8114
|
+
],
|
|
8115
|
+
"responses": {
|
|
8116
|
+
"200": {
|
|
8117
|
+
"description": "Success",
|
|
8118
|
+
"content": {
|
|
8119
|
+
"application/json": {}
|
|
8120
|
+
}
|
|
8121
|
+
}
|
|
8122
|
+
},
|
|
8123
|
+
"security": [
|
|
8124
|
+
{
|
|
8125
|
+
"bearerAuth": []
|
|
8126
|
+
},
|
|
8127
|
+
{
|
|
8128
|
+
"tokenHeader": []
|
|
8129
|
+
},
|
|
8130
|
+
{
|
|
8131
|
+
"tokenQuery": []
|
|
8132
|
+
}
|
|
8133
|
+
]
|
|
8134
|
+
}
|
|
8135
|
+
},
|
|
8136
|
+
"/api/issue-lifecycle/reopen": {
|
|
8137
|
+
"post": {
|
|
8138
|
+
"operationId": "postIssueLifecycleReopenRoute",
|
|
8139
|
+
"summary": "Post Issue Lifecycle Reopen",
|
|
8140
|
+
"tags": [
|
|
8141
|
+
"Other"
|
|
8142
|
+
],
|
|
8143
|
+
"responses": {
|
|
8144
|
+
"200": {
|
|
8145
|
+
"description": "Success",
|
|
8146
|
+
"content": {
|
|
8147
|
+
"application/json": {}
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
},
|
|
8151
|
+
"security": [
|
|
8152
|
+
{
|
|
8153
|
+
"bearerAuth": []
|
|
8154
|
+
},
|
|
8155
|
+
{
|
|
8156
|
+
"tokenHeader": []
|
|
8157
|
+
},
|
|
8158
|
+
{
|
|
8159
|
+
"tokenQuery": []
|
|
8160
|
+
}
|
|
8161
|
+
]
|
|
8162
|
+
}
|
|
8163
|
+
},
|
|
8164
|
+
"/api/issue-refs": {
|
|
8165
|
+
"post": {
|
|
8166
|
+
"operationId": "postIssueRefRoute",
|
|
8167
|
+
"summary": "Post Issue Ref",
|
|
8168
|
+
"tags": [
|
|
8169
|
+
"Other"
|
|
8170
|
+
],
|
|
8171
|
+
"responses": {
|
|
8172
|
+
"200": {
|
|
8173
|
+
"description": "Success",
|
|
8174
|
+
"content": {
|
|
8175
|
+
"application/json": {}
|
|
8176
|
+
}
|
|
8177
|
+
}
|
|
8178
|
+
},
|
|
8179
|
+
"security": [
|
|
8180
|
+
{
|
|
8181
|
+
"bearerAuth": []
|
|
8182
|
+
},
|
|
8183
|
+
{
|
|
8184
|
+
"tokenHeader": []
|
|
8185
|
+
},
|
|
8186
|
+
{
|
|
8187
|
+
"tokenQuery": []
|
|
8188
|
+
}
|
|
8189
|
+
]
|
|
8190
|
+
},
|
|
8191
|
+
"get": {
|
|
8192
|
+
"operationId": "listIssueRefsRoute",
|
|
8193
|
+
"summary": "list Issue Refs",
|
|
8194
|
+
"tags": [
|
|
8195
|
+
"Other"
|
|
8196
|
+
],
|
|
8197
|
+
"responses": {
|
|
8198
|
+
"200": {
|
|
8199
|
+
"description": "Success",
|
|
8200
|
+
"content": {
|
|
8201
|
+
"application/json": {}
|
|
8202
|
+
}
|
|
8203
|
+
}
|
|
8204
|
+
},
|
|
8205
|
+
"security": [
|
|
8206
|
+
{
|
|
8207
|
+
"bearerAuth": []
|
|
8208
|
+
},
|
|
8209
|
+
{
|
|
8210
|
+
"tokenHeader": []
|
|
8211
|
+
},
|
|
8212
|
+
{
|
|
8213
|
+
"tokenQuery": []
|
|
8214
|
+
}
|
|
8215
|
+
]
|
|
8216
|
+
}
|
|
8217
|
+
},
|
|
8218
|
+
"/api/issue-refs/resolve": {
|
|
8219
|
+
"get": {
|
|
8220
|
+
"operationId": "resolveIssueRefRoute",
|
|
8221
|
+
"summary": "resolve Issue Ref",
|
|
8222
|
+
"tags": [
|
|
8223
|
+
"Other"
|
|
8224
|
+
],
|
|
8225
|
+
"responses": {
|
|
8226
|
+
"200": {
|
|
8227
|
+
"description": "Success",
|
|
8228
|
+
"content": {
|
|
8229
|
+
"application/json": {}
|
|
8230
|
+
}
|
|
8231
|
+
}
|
|
8232
|
+
},
|
|
8233
|
+
"security": [
|
|
8234
|
+
{
|
|
8235
|
+
"bearerAuth": []
|
|
8236
|
+
},
|
|
8237
|
+
{
|
|
8238
|
+
"tokenHeader": []
|
|
8239
|
+
},
|
|
8240
|
+
{
|
|
8241
|
+
"tokenQuery": []
|
|
8242
|
+
}
|
|
8243
|
+
]
|
|
8244
|
+
},
|
|
8245
|
+
"post": {
|
|
8246
|
+
"operationId": "resolveIssueRefRoute",
|
|
8247
|
+
"summary": "resolve Issue Ref",
|
|
8248
|
+
"tags": [
|
|
8249
|
+
"Other"
|
|
8250
|
+
],
|
|
8251
|
+
"responses": {
|
|
8252
|
+
"200": {
|
|
8253
|
+
"description": "Success",
|
|
8254
|
+
"content": {
|
|
8255
|
+
"application/json": {}
|
|
8256
|
+
}
|
|
8257
|
+
}
|
|
8258
|
+
},
|
|
8259
|
+
"security": [
|
|
8260
|
+
{
|
|
8261
|
+
"bearerAuth": []
|
|
8262
|
+
},
|
|
8263
|
+
{
|
|
8264
|
+
"tokenHeader": []
|
|
8265
|
+
},
|
|
8266
|
+
{
|
|
8267
|
+
"tokenQuery": []
|
|
8268
|
+
}
|
|
8269
|
+
]
|
|
8270
|
+
}
|
|
8271
|
+
},
|
|
8272
|
+
"/api/issue-refs/{id}": {
|
|
8273
|
+
"get": {
|
|
8274
|
+
"operationId": "getIssueRefRoute",
|
|
8275
|
+
"summary": "Get Issue Ref",
|
|
8276
|
+
"tags": [
|
|
8277
|
+
"Other"
|
|
8278
|
+
],
|
|
8279
|
+
"parameters": [
|
|
8280
|
+
{
|
|
8281
|
+
"name": "id",
|
|
8282
|
+
"in": "path",
|
|
8283
|
+
"required": true,
|
|
8284
|
+
"schema": {
|
|
8285
|
+
"type": "string"
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8288
|
+
],
|
|
8289
|
+
"responses": {
|
|
8290
|
+
"200": {
|
|
8291
|
+
"description": "Success",
|
|
8292
|
+
"content": {
|
|
8293
|
+
"application/json": {}
|
|
8294
|
+
}
|
|
8295
|
+
}
|
|
8296
|
+
},
|
|
8297
|
+
"security": [
|
|
8298
|
+
{
|
|
8299
|
+
"bearerAuth": []
|
|
8300
|
+
},
|
|
8301
|
+
{
|
|
8302
|
+
"tokenHeader": []
|
|
8303
|
+
},
|
|
8304
|
+
{
|
|
8305
|
+
"tokenQuery": []
|
|
8306
|
+
}
|
|
8307
|
+
]
|
|
8308
|
+
},
|
|
8309
|
+
"patch": {
|
|
8310
|
+
"operationId": "patchIssueRefRoute",
|
|
8311
|
+
"summary": "Patch Issue Ref",
|
|
8312
|
+
"tags": [
|
|
8313
|
+
"Other"
|
|
8314
|
+
],
|
|
8315
|
+
"parameters": [
|
|
8316
|
+
{
|
|
8317
|
+
"name": "id",
|
|
8318
|
+
"in": "path",
|
|
8319
|
+
"required": true,
|
|
8320
|
+
"schema": {
|
|
8321
|
+
"type": "string"
|
|
8322
|
+
}
|
|
8323
|
+
}
|
|
8324
|
+
],
|
|
8325
|
+
"responses": {
|
|
8326
|
+
"200": {
|
|
8327
|
+
"description": "Success",
|
|
8328
|
+
"content": {
|
|
8329
|
+
"application/json": {}
|
|
8330
|
+
}
|
|
8331
|
+
}
|
|
8332
|
+
},
|
|
8333
|
+
"security": [
|
|
8334
|
+
{
|
|
8335
|
+
"bearerAuth": []
|
|
8336
|
+
},
|
|
8337
|
+
{
|
|
8338
|
+
"tokenHeader": []
|
|
8339
|
+
},
|
|
8340
|
+
{
|
|
8341
|
+
"tokenQuery": []
|
|
8342
|
+
}
|
|
8343
|
+
]
|
|
8344
|
+
},
|
|
8345
|
+
"delete": {
|
|
8346
|
+
"operationId": "deleteIssueRefRoute",
|
|
8347
|
+
"summary": "Delete Issue Ref",
|
|
8348
|
+
"tags": [
|
|
8349
|
+
"Other"
|
|
8350
|
+
],
|
|
8351
|
+
"parameters": [
|
|
8352
|
+
{
|
|
8353
|
+
"name": "id",
|
|
8354
|
+
"in": "path",
|
|
8355
|
+
"required": true,
|
|
8356
|
+
"schema": {
|
|
8357
|
+
"type": "string"
|
|
8358
|
+
}
|
|
8359
|
+
}
|
|
8360
|
+
],
|
|
8361
|
+
"responses": {
|
|
8362
|
+
"200": {
|
|
8363
|
+
"description": "Success",
|
|
8364
|
+
"content": {
|
|
8365
|
+
"application/json": {}
|
|
8366
|
+
}
|
|
8367
|
+
}
|
|
8368
|
+
},
|
|
8369
|
+
"security": [
|
|
8370
|
+
{
|
|
8371
|
+
"bearerAuth": []
|
|
8372
|
+
},
|
|
8373
|
+
{
|
|
8374
|
+
"tokenHeader": []
|
|
8375
|
+
},
|
|
8376
|
+
{
|
|
8377
|
+
"tokenQuery": []
|
|
8378
|
+
}
|
|
8379
|
+
]
|
|
8380
|
+
}
|
|
8381
|
+
},
|
|
7904
8382
|
"/api/projects": {
|
|
7905
8383
|
"get": {
|
|
7906
8384
|
"operationId": "getProjectsRoute",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-relay-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "Lightweight HTTP message relay for inter-agent communication across machines",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"CONTRIBUTING.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"agent-relay-sdk": "0.2.
|
|
36
|
+
"agent-relay-sdk": "0.2.38",
|
|
37
37
|
"ajv": "^8.20.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,Dn as n,Ht as r,In as i,Jn as a,L as o,Mt as s,P as c,Pn as l,Rn as u,St as d,Xt as f,_n as p,an as m,c as h,dn as g,en as _,h as v,i as y,it as b,ln as x,on as S,p as C,r as w,sn as T,st as E,un as D,xt as O,y as k}from"./lucide-react-L2UxFDic.js";import{n as A,p as j,t as M}from"./store-B8xP6z6T.js";import{D as N,I as P,M as F,W as I,at as L,j as R,w as z,z as ee}from"./display-DzNvOu1j.js";import{a as te,i as ne,o as re,t as B,x as ie}from"./index-B3wOeAPO.js";var V=e(a(),1),H={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},ae=new Set(Object.keys(H)),oe=3e3;function U(e){return new Date(e.occurredAt??e.createdAt).getTime()}function se(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:U(e),turnId:typeof t.turnId==`string`?t.turnId:void 0}}function ce(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`notice`)return null;let n=typeof t.label==`string`&&t.label?t.label:`compacted`;return{id:`notice-${e.id}`,status:n,timestamp:U(e)}}function W(e,t){let n=e.trim();for(let e of t){let t=e.trim();if(t){if(n===t)break;n.startsWith(`${t}\n\n`)&&(n=n.slice(t.length+2).trimStart())}}return n.trim()||e.trim()}function le(e){return e.kind===`system`&&e.from===`system`}var ue=new Set([`agent.ready`,`agent.exited`,`agent.spawn_failed`]);function G(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function de(e){let t=e.filter(e=>ae.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=oe)||n.push(e);return n}function fe(e,t,n,r=[],i){let a=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,I(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;a.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)a.push({ts:I(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&a.push({ts:e,entry:{type:`created`,timestamp:e}})}if(i?.spawnedBy){let e=n?new Date(n).getTime():0,t=Number.isFinite(e)?e:0;a.push({ts:t,entry:{type:`agent-action`,direction:`spawned-by`,agentId:i.spawnedBy.agentId,provider:i.spawnedBy.provider,status:`ready`,timestamp:t}})}let o=new Map,s=new Map,c=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`narration`&&typeof e.turnId==`string`){let n=s.get(e.turnId)??[];n.push({id:t.id,body:t.body.trim()}),s.set(e.turnId,n)}else if(e?.type===`response`&&typeof e.turnId==`string`){let n=o.get(e.turnId)??[];n.push(t.body.trim()),o.set(e.turnId,n)}}let l=new Map;for(let[e,t]of o){let n=(s.get(e)??[]).map(e=>e.body);l.set(e,t.map(e=>W(e,n)))}for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type!==`response`||typeof e.turnId!=`string`)continue;let n=W(t.body,(s.get(e.turnId)??[]).map(e=>e.body));n&&n!==t.body&&c.set(t.id,n)}let u=new Set;for(let[e,t]of l){let n=s.get(e)??[];for(let e of t)for(let t=n.length-1;t>=0;t--){let r=n[t];if(!u.has(r.id)&&ee(e,r.body)){u.add(r.id);break}}}let d=new Map,f=[];for(let t of e){if(le(t)){let e=typeof t.payload?.kind==`string`?t.payload.kind:``;if(ue.has(e)){let n=t.payload,r=typeof n.agentId==`string`?n.agentId:``,i=U(t);if(!r){a.push({ts:i,entry:{type:`notice`,msg:t}});continue}let o=e===`agent.ready`?`ready`:e===`agent.exited`?`exited`:`failed`,s=d.get(r);if(s)s.entry.status=o,typeof n.reason==`string`&&(s.entry.reason=n.reason),s.entry.timestamp=i,s.ts=i;else{let e={ts:i,entry:{type:`agent-action`,direction:`spawned-child`,agentId:r,provider:typeof n.provider==`string`?n.provider:void 0,status:o,reason:typeof n.reason==`string`?n.reason:void 0,timestamp:i}};d.set(r,e),a.push(e)}continue}a.push({ts:U(t),entry:{type:`notice`,msg:t}});continue}let e=ce(t);if(e){f.push(e);continue}let n=se(t);if(n){if(n.kind===`narration`&&u.has(n.id))continue;a.push({ts:n.ts,entry:{type:`activity`,steps:[n],timestamp:n.ts}});continue}if(t.kind===`session`){let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`){let e=c.get(t.id);if(e&&e!==t.body){a.push({ts:U(t),entry:{type:`message`,msg:{...t,body:e}}});continue}}}a.push({ts:U(t),entry:{type:`message`,msg:t}})}for(let e of de([...t,...f]))a.push({ts:e.timestamp,entry:{type:`status`,event:e}});let p={created:0,date:1,"import-boundary":2,"imported-message":3,message:4,activity:4,notice:4,"agent-action":4,status:5};a.sort((e,t)=>{let n=e.ts-t.ts;return Math.abs(n)<3e3&&p[e.entry.type]-p[t.entry.type]||n});let m=[],h=``;for(let{ts:e,entry:t}of a){if(t.type===`created`){m.push(t);continue}let n=G(e);if(n!==h&&(m.push({type:`date`,date:n,timestamp:e}),h=n),t.type===`activity`){let e=m[m.length-1];if(e&&e.type===`activity`&&pe(e,t)){e.steps.push(...t.steps);continue}}m.push(t)}return m}function pe(e,t){let n=e.steps[e.steps.length-1]?.turnId,r=t.steps[0]?.turnId;return n&&r?n===r:!n&&!r}function me(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function he(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function ge(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function _e(e,t){return e.filter(e=>e.status===`online`&&P(t,e.baseDir)).sort((e,t)=>R(t.baseDir).length-R(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function ve(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function K(){return typeof window<`u`&&!!window.getSelection()?.toString()}function ye(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var be=[`👍`,`❤️`,`✅`,`👀`];function xe(e){let t=new Map;for(let n of e.reactions||[]){let e=F(n.emoji),r=t.get(e)??{emoji:e,count:0,mine:!1,actors:[]};r.count+=1,r.mine=r.mine||n.actorId===`user`,r.actors.push(n.actorId),t.set(e,r)}return[...t.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function q(e){return z(e)}function Se(e,t){let n=e.readBy||[],r=e.resolvedToAgent||t||e.to,i=r?n.includes(r):!1,a=n.some(e=>e!==L);if(i||a){let e=i?r:n.find(e=>e!==L);return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:g}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:g};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:f};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let t=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:t,tone:`danger`,icon:m}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:D}}function Ce(e){let t=I(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,I(t.updatedAt||t.createdAt)),t)}function we(e){return e?e.messages.reduce((e,t)=>Math.max(e,Ce(t)),0):0}function J(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function Te(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Ee(e,t,n,r){if(e?.teamId)return{teamId:e.teamId};let i=[...t];n&&!i.some(e=>e.id===n.id)&&i.push(n);let a=i.filter(e=>e.threadId).reverse(),o=a.find(e=>!!r[A(e.threadId,e.channel)])??a[0];return o?.threadId?{threadId:o.threadId,...o.channel?{channel:o.channel}:{}}:null}var Y=i(),De={online:`text-emerald-400`,offline:`text-zinc-400`,shutdown:`text-zinc-400`,restarted:`text-blue-400`,"compaction-requested":`text-zinc-400`,compacting:`text-amber-400`,compacted:`text-amber-400`,"compaction-stalled":`text-red-400`,"clear-requested":`text-zinc-400`,"clearing-context":`text-amber-400`,"context-cleared":`text-amber-400`,"clear-stalled":`text-red-400`,"shutting-down":`text-zinc-400`};function Oe(e){let t=new Date,[n,r,i]=e.split(`-`).map(Number),a=new Date(n,r-1,i);if(e===G(t.getTime()))return`Today`;let o=new Date(t);return o.setDate(o.getDate()-1),e===G(o.getTime())?`Yesterday`:a.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,year:a.getFullYear()===t.getFullYear()?void 0:`numeric`})}function ke({event:e}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(t,{className:l(`w-2 h-2 fill-current`,De[e.status]||`text-zinc-400`)}),(0,Y.jsx)(`span`,{children:H[e.status]||e.status}),(0,Y.jsx)(`span`,{className:`text-muted-foreground/60`,children:J(e.timestamp)})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var Ae={"branch.landed":O,"context.warning":C},je={"branch.landed":`branch landed`,"context.warning":`context warning`};function Me({msg:e}){let t=typeof e.payload?.kind==`string`?e.payload.kind:``,n=Ae[t]??c,r=je[t]??(t||`system signal`);return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(n,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{children:r}),(0,Y.jsx)(`span`,{className:`text-muted-foreground/60`,children:J(e.occurredAt??e.createdAt)})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var Ne={"spawned-child":{ready:`spawned`,exited:`spawned · exited`,failed:`spawn failed`},"spawned-by":{ready:`spawned by`,exited:`spawned by`,failed:`spawned by`}},Pe={"spawned-child-ready":o,"spawned-child-exited":b,"spawned-child-failed":m,"spawned-by-ready":n,"spawned-by-exited":n,"spawned-by-failed":n},Fe={"spawned-child-ready":`text-emerald-400`,"spawned-child-exited":`text-zinc-400`,"spawned-child-failed":`text-red-400`,"spawned-by-ready":`text-blue-400`,"spawned-by-exited":`text-blue-400`,"spawned-by-failed":`text-blue-400`};function Ie({entry:e}){let t=M(e=>e.agentsById),n=M(e=>e.openInboxThread),r=M(e=>e.switchView),i=t[e.agentId]||null,a=i?.label??e.agentId,o=`${e.direction}-${e.status}`,s=Ne[e.direction]?.[e.status]??e.direction,u=Pe[o]??c,d=Fe[o]??`text-muted-foreground`,f=e.status===`failed`;function p(){n(e.agentId),r(`chat`)}return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:l(`flex items-center gap-1.5 rounded-full border bg-muted/30 px-2.5 py-1 text-xs`,f?`border-red-500/30`:`border-border`),children:[(0,Y.jsx)(u,{className:l(`h-3 w-3 shrink-0`,d)}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:s}),(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded hover:text-foreground text-muted-foreground transition-colors hover:bg-muted/50 px-1`,onClick:p,title:`Open chat for ${a}`,children:[(0,Y.jsx)(ie,{agent:i,className:`w-4 h-4 text-[10px]`}),(0,Y.jsx)(`span`,{className:`max-w-[160px] truncate`,children:a})]}),e.reason&&f&&(0,Y.jsxs)(`span`,{className:`text-red-400/80 max-w-[120px] truncate`,title:e.reason,children:[`— `,e.reason]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0`,children:J(e.timestamp)})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Le({blockedLabel:e,onInterrupt:t}){return e?(0,Y.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-red-500/30 px-4 py-2.5`,children:[(0,Y.jsx)(m,{className:`w-3.5 h-3.5 text-red-400`}),(0,Y.jsxs)(`span`,{className:`text-xs text-red-300`,children:[`blocked: `,e]})]})}):(0,Y.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-foreground/10 px-4 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_infinite]`}),(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.2s_infinite]`}),(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.4s_infinite]`})]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`working`}),t&&(0,Y.jsxs)(`button`,{onClick:t,title:`Interrupt`,className:`ml-1 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs text-muted-foreground hover:text-red-300 hover:bg-red-500/10 transition-colors`,children:[(0,Y.jsx)(_,{className:`w-3.5 h-3.5`}),`Stop`]})]})})}var X=`agent-relay:chat-hide-tools`,Z=(()=>{let e=new Set,t=(()=>{try{return window.localStorage.getItem(X)===`on`}catch{return!1}})(),n=()=>e.forEach(e=>e());return typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key===X&&(t=e.newValue===`on`,n())}),{subscribe(t){return e.add(t),()=>e.delete(t)},get:()=>t,toggle(){t=!t;try{window.localStorage.setItem(X,t?`on`:`off`)}catch{}n()}}})();function Re(){return[(0,V.useSyncExternalStore)(Z.subscribe,Z.get,()=>!1),Z.toggle]}function Q({steps:e,showReasoning:t}){let[n,r]=Re(),i=t?e:e.filter(e=>e.kind!==`reasoning`);if(!i.length)return null;let a=i.filter(e=>e.kind===`tool`).length;return(0,Y.jsx)(`div`,{className:`flex justify-start mb-2`,children:(0,Y.jsxs)(`div`,{className:`max-w-[85%] md:max-w-[75%] min-w-0 space-y-1.5`,children:[i.map(e=>e.kind===`narration`?(0,Y.jsx)(B,{text:e.text,className:`text-sm leading-relaxed break-words text-foreground/90 min-w-0`},e.id):e.kind===`reasoning`?(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground/80`,children:[(0,Y.jsx)(p,{className:`w-3.5 h-3.5 mt-0.5 shrink-0 opacity-70`}),(0,Y.jsx)(B,{text:e.text,className:`italic break-words min-w-0`})]},e.id):n?null:(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsx)(v,{className:`w-3 h-3 mt-0.5 shrink-0 opacity-70`}),(0,Y.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:e.label||`tool`}),e.text?(0,Y.jsxs)(`span`,{className:`opacity-70`,children:[` — `,e.text]}):null]})]},e.id)),a>0&&(0,Y.jsxs)(`button`,{onClick:r,className:`flex items-center gap-1 text-[11px] text-muted-foreground/50 hover:text-muted-foreground transition-colors text-left`,children:[(0,Y.jsx)(T,{className:l(`w-3 h-3 shrink-0 transition-transform`,!n&&`rotate-90`)}),(0,Y.jsx)(`span`,{children:n?`show ${a} tool step${a===1?``:`s`}`:`hide tool steps`})]})]})})}function ze({date:e}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-3 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:Oe(e)}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Be({timestamp:e}){let t=new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`});return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground/60`,children:[`created `,t]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Ve({history:e}){let t=e.sourceAgentLabel||e.sourcePeerId,n=e.entries.length;return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-dashed border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(d,{className:`h-3 w-3`}),(0,Y.jsxs)(`span`,{children:[`forked history from `,t]}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[n,` `,n===1?`entry`:`entries`]})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function He({entry:e,sourceLabel:t}){let n=e.message,r=N(n),i=e.originalFrom===L;return(0,Y.jsx)(`div`,{className:l(`flex mb-3 opacity-80`,i?`justify-end`:`justify-start`),children:(0,Y.jsx)(`div`,{className:`max-w-[85%] md:max-w-[75%]`,children:(0,Y.jsxs)(`div`,{className:l(`rounded-2xl border border-dashed px-3.5 py-2 text-sm select-text`,i?`border-primary/25 bg-primary/10 text-foreground rounded-br-sm`:`border-border bg-card/70 rounded-bl-sm`),children:[(0,Y.jsxs)(`div`,{className:l(`mb-1 text-[10px] uppercase tracking-normal`,i?`text-primary/70`:`text-muted-foreground`),children:[`forked history · `,i?`you`:t||e.originalFrom]}),(0,Y.jsx)(B,{text:r,rawBody:n.body,className:`leading-relaxed`}),(0,Y.jsxs)(`p`,{className:l(`mt-1 flex items-center justify-end gap-1.5 text-xs`,i?`text-primary/60`:`text-muted-foreground`),children:[(0,Y.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.originalMessageId]}),(0,Y.jsx)(`span`,{children:J(e.originalCreatedAt)})]})]})})})}function Ue({scrollRef:e,timeline:t}){let[n,r]=(0,V.useState)(!0),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,u]=(0,V.useState)(!0),d=(0,V.useMemo)(()=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(!(!n||n.type!==`message`)&&n.msg.from===`user`)return{id:n.msg.id,body:N(n.msg)}}return null},[t]);if((0,V.useEffect)(()=>{let t=e.current;if(!d||!t){r(!0);return}let n=t.querySelector(`[data-msg-id="${d.id}"]`);if(!n){r(!0);return}let i=new IntersectionObserver(([e])=>{if(e&&(r(e.isIntersecting),!e.isIntersecting)){let n=e.rootBounds?.top??t.getBoundingClientRect().top;u(e.boundingClientRect.top<n)}},{root:t,threshold:0});i.observe(n);let a=()=>{let e=n.getBoundingClientRect(),r=t.getBoundingClientRect();u(e.top<r.top)};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{i.disconnect(),t.removeEventListener(`scroll`,a)}},[d?.id,e]),n||!d||!d.body.trim())return null;let f=i?.id===d.id?i.value:!1,p=o?.id===d.id?o.value:!1;function m(){let t=e.current;!t||!d||t.querySelector(`[data-msg-id="${d.id}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`})}let h=c?`↑`:`↓`;return p?(0,Y.jsx)(`div`,{className:`sticky top-0 z-10 -mx-3 md:-mx-4 -mt-3 md:-mt-4 bg-background`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`w-full flex items-center justify-center gap-1.5 py-1 text-[11px] text-primary/60 hover:text-primary border-b border-primary/10 transition-colors`,onClick:()=>s({id:d.id,value:!1}),children:[(0,Y.jsx)(`span`,{children:`Your prompt`}),(0,Y.jsx)(x,{className:`w-3 h-3`})]})}):(0,Y.jsxs)(`div`,{className:`sticky top-0 z-10 -mx-3 md:-mx-4 -mt-3 md:-mt-4 px-2 md:px-3 pt-2 pb-1.5 bg-background border-b border-primary/10`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mb-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-primary/70`,children:`Your prompt`}),(0,Y.jsxs)(`button`,{type:`button`,className:`ml-auto hover:text-foreground transition-colors`,onClick:m,children:[h,` scroll to original`]}),(0,Y.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors`,onClick:()=>s({id:d.id,value:!0}),title:`Minimize`,children:(0,Y.jsx)(S,{className:`w-3 h-3`})})]}),(0,Y.jsx)(`p`,{className:l(`text-sm text-foreground leading-snug cursor-pointer`,!f&&`line-clamp-2`),onClick:()=>a({id:d.id,value:!f}),children:d.body})]})}function We(){return(0,V.useSyncExternalStore)(e=>j.subscribe(e),()=>j.getPlayingKey(),()=>null)}function Ge({attachment:e,outbound:t}){let n=e.kind===`image`,i=e.title||e.artifactId,[a,o]=(0,V.useState)(null),[c,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),[h,g]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let t=!1,n=null;async function r(){p(!0),d(null),o(null);try{let r=await u(`/artifacts/${encodeURIComponent(e.artifactId)}/content`);if(t)return;n=URL.createObjectURL(r),o(n)}catch(e){t||d(e.message)}finally{t||p(!1)}}return r(),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e.artifactId]);function _(){if(!a)return;let e=document.createElement(`a`);e.href=a,e.download=i,document.body.appendChild(e),e.click(),e.remove()}return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>a&&g(!0),disabled:!a,className:`group/img mt-2 block overflow-hidden rounded-md border border-foreground/10 bg-black/10 text-left disabled:cursor-default relative`,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`img`,{src:a,alt:i,loading:`lazy`,className:`block max-h-72 max-w-full object-contain`}),(0,Y.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/img:bg-black/30 transition-colors`,children:(0,Y.jsx)(w,{className:`w-6 h-6 text-white opacity-0 group-hover/img:opacity-100 transition-opacity drop-shadow-md`})})]}):(0,Y.jsxs)(`span`,{className:l(`flex min-h-20 items-center gap-2 px-3 py-2 text-xs`,c?`text-red-400`:`text-muted-foreground`),children:[f?(0,Y.jsx)(E,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(m,{className:`h-4 w-4`}),c||`Loading image`]})}),a&&(0,Y.jsx)(ne,{open:h,onOpenChange:g,children:(0,Y.jsxs)(te,{className:`max-w-[95vw] max-h-[95vh] w-auto p-0 bg-black/95 border-zinc-800 gap-0 overflow-hidden`,showCloseButton:!1,children:[(0,Y.jsx)(re,{className:`sr-only`,children:i}),(0,Y.jsxs)(`div`,{className:`relative flex items-center justify-center min-h-[200px]`,children:[(0,Y.jsx)(`img`,{src:a,alt:i,className:`max-w-[93vw] max-h-[90vh] object-contain`}),(0,Y.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:_,className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Download`,children:(0,Y.jsx)(r,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>g(!1),className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Close`,children:(0,Y.jsx)(y,{className:`w-4 h-4`})})]})]})]})})]}):(0,Y.jsxs)(`button`,{type:`button`,onClick:_,disabled:!a,className:l(`mt-2 flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-xs transition-colors disabled:cursor-default disabled:opacity-70`,t?`border-primary-foreground/20 bg-primary-foreground/10 hover:bg-primary-foreground/15`:`border-border bg-background hover:bg-muted`),children:[f?(0,Y.jsx)(E,{className:`h-4 w-4 shrink-0 animate-spin`}):c?(0,Y.jsx)(m,{className:`h-4 w-4 shrink-0 text-red-400`}):(0,Y.jsx)(s,{className:`h-4 w-4 shrink-0`}),(0,Y.jsx)(`span`,{className:l(`min-w-0 flex-1 truncate`,c&&`text-red-400`),children:c||i}),(0,Y.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`})]})}function $({open:e,onToggle:t,onReact:n}){return(0,Y.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,Y.jsx)(`button`,{type:`button`,title:`Add reaction`,onClick:t,className:l(`inline-flex h-5 w-6 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground`,e?`opacity-100`:`opacity-0 pointer-events-none md:group-hover/msg:opacity-100 md:group-hover/msg:pointer-events-auto`),children:(0,Y.jsx)(k,{className:`h-3 w-3`})}),e&&(0,Y.jsx)(`div`,{className:`absolute bottom-full left-0 z-30 mb-1 flex gap-0.5 rounded-full border border-border bg-popover p-0.5 shadow-md`,children:be.map(e=>(0,Y.jsx)(`button`,{type:`button`,title:`React ${e}`,onClick:()=>n(e),className:`inline-flex h-6 w-7 items-center justify-center rounded-full text-xs transition-colors hover:bg-muted`,children:e},e))})]})}var Ke=(0,V.memo)(function({msg:e,peer:t,onOpenReferencedPath:n,onPreviewReferencedPath:r,onPreviewReferencedPathEnd:i}){let a=e.from!==`user`&&e.to!==`user`,o=a?e.from===t:e.from===L,s=a?o?`→ ${e.to}`:`from ${e.from}`:null,c=M(e=>e.reactToMessage),u=M(e=>e.voiceTtsEnabled),d=We(),f=M(e=>{let n=e.agentsById[t]?.meta?.cwd;return typeof n==`string`?n:``}),[p,m]=(0,V.useState)(!1),g=(0,V.useRef)(null),v=(0,V.useRef)(null),y=(0,V.useRef)(!1),b=N(e),x=J(e.occurredAt??e.createdAt),S=ye(e),C=xe(e),w=o?Se(e,t):null,T=w?.icon,E=d===String(e.id),D=u&&!o&&!a&&!q(e)&&b.trim().length>0;function O(t){t.stopPropagation(),E?j.bargeIn():j.speak(e.body,String(e.id))}(0,V.useEffect)(()=>{if(!p)return;function e(e){K()||g.current&&!g.current.contains(e.target)&&m(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)}},[p]);function k(e){return he(f||`/`,e)}function A(e,t){let r=k(e);n?.(r,t)}function P(e,t,n){let i=k(e);r?.(i,t,n)}function F(t){c(e,t),m(!1)}function I(e){e.button===0&&(v.current={x:e.clientX,y:e.clientY},y.current=!1)}function R(e){let t=v.current;t&&(Math.abs(e.clientX-t.x)>3||Math.abs(e.clientY-t.y)>3)&&(y.current=!0)}function z(t){if(!(q(e)||o||a)&&!t.target.closest(`a,button,input,textarea,select,[role="button"]`)){if(y.current||K()){y.current=!1;return}m(e=>!e)}}return(0,Y.jsx)(`div`,{"data-msg-id":e.id,className:l(`group/msg flex mb-3`,o?`justify-end`:`justify-start`),children:(0,Y.jsxs)(`div`,{ref:g,className:`relative max-w-[85%] md:max-w-[75%]`,children:[D&&(0,Y.jsx)(`button`,{type:`button`,title:E?`Stop playback`:`Play aloud`,onClick:O,className:l(`absolute -top-2 -right-2 z-20 inline-flex h-6 w-6 items-center justify-center rounded-full border bg-popover shadow-sm transition`,E?`border-primary/50 text-primary opacity-100`:`border-border text-muted-foreground opacity-70 hover:bg-muted hover:text-foreground hover:opacity-100 [@media(hover:hover)]:md:opacity-0 [@media(hover:hover)]:md:group-hover/msg:opacity-100`),children:E?(0,Y.jsx)(_,{className:`h-3.5 w-3.5 animate-pulse`}):(0,Y.jsx)(h,{className:`h-3.5 w-3.5`})}),(0,Y.jsxs)(`div`,{className:l(`rounded-2xl px-3.5 py-2 text-sm select-text`,!o&&!q(e)&&!a&&`cursor-pointer`,o?`bg-primary text-primary-foreground rounded-br-sm`:`bg-card ring-1 ring-foreground/10 rounded-bl-sm`),onPointerDown:I,onPointerMove:R,onClick:z,children:[s&&(0,Y.jsx)(`p`,{className:l(`text-xs font-medium mb-1 opacity-60`,o?`text-primary-foreground`:`text-muted-foreground`),children:s}),e.subject&&(0,Y.jsx)(`p`,{className:l(`text-xs font-semibold mb-1`,o?`text-primary-foreground/70`:`text-muted-foreground`),children:e.subject}),(0,Y.jsx)(B,{text:b,rawBody:e.body,className:`leading-relaxed`,onOpenPath:A,onPreviewPath:P,onPreviewPathEnd:i,resolvePathTitle:(e,t)=>`${k(e)}${t?`:${t}`:``}`}),S.map(t=>(0,Y.jsx)(Ge,{attachment:t,outbound:o},`${e.id}-${t.artifactId}-${t.role||``}`)),(0,Y.jsxs)(`p`,{className:l(`text-xs mt-1 flex items-center gap-1.5`,o?`justify-end text-primary-foreground/60`:`justify-end text-muted-foreground`),children:[(0,Y.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.id]}),(0,Y.jsx)(`span`,{children:x}),w&&T&&(0,Y.jsxs)(`span`,{className:l(`inline-flex items-center gap-1`,w.tone===`ok`&&`text-emerald-300`,w.tone===`warn`&&`text-amber-200`,w.tone===`danger`&&`text-red-200`),title:w.title,children:[(0,Y.jsx)(T,{className:`h-3 w-3`}),w.label]})]})]}),!q(e)&&C.length>0&&(0,Y.jsxs)(`div`,{className:l(`flex flex-wrap items-center gap-0.5 -mt-1 relative z-10`,o?`justify-end pr-2`:`justify-start pl-2`),children:[!o&&(0,Y.jsx)($,{open:p,onToggle:()=>m(e=>!e),onReact:F}),C.map(e=>(0,Y.jsxs)(`button`,{type:`button`,title:e.actors.join(`, `),onClick:()=>F(e.emoji),className:l(`inline-flex h-5 items-center gap-0.5 rounded-full border px-1.5 text-[11px] shadow-sm transition-colors`,e.mine?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-background hover:bg-muted text-foreground`),children:[(0,Y.jsx)(`span`,{children:e.emoji}),e.count>1&&(0,Y.jsx)(`span`,{children:e.count})]},e.emoji))]}),!q(e)&&!o&&C.length===0&&(0,Y.jsx)(`div`,{className:`absolute -bottom-2.5 left-1 z-20`,children:(0,Y.jsx)($,{open:p,onToggle:()=>m(e=>!e),onReact:F})})]})})});export{ve as _,Be as a,He as c,Ue as d,me as f,Te as g,Ee as h,Le as i,Me as l,ge as m,Q as n,ze as o,_e as p,Ie as r,Ve as s,Ke as t,ke as u,we as v,fe as y};
|
|
2
|
-
//# sourceMappingURL=MessageBubble-
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,Fn as n,Ht as r,L as i,Ln as a,Mt as o,On as s,P as c,St as l,Xt as u,Yn as d,c as f,cn as p,dn as m,en as h,fn as g,h as _,i as v,it as y,on as b,p as x,r as S,sn as C,st as w,un as T,vn as E,xt as D,y as O,zn as k}from"./lucide-react-DWYjU-AF.js";import{m as A,r as j,t as M}from"./store-Buwkqv_7.js";import{D as N,I as P,M as F,W as I,at as L,j as R,w as z,z as ee}from"./display-DzNvOu1j.js";import{S as te,a as ne,i as re,o as ie,t as B}from"./index-CCp1V35c.js";var V=e(d(),1),H={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},ae=new Set(Object.keys(H)),oe=3e3;function U(e){return new Date(e.occurredAt??e.createdAt).getTime()}function se(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:U(e),turnId:typeof t.turnId==`string`?t.turnId:void 0}}function ce(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`notice`)return null;let n=typeof t.label==`string`&&t.label?t.label:`compacted`;return{id:`notice-${e.id}`,status:n,timestamp:U(e)}}function W(e,t){let n=e.trim();for(let e of t){let t=e.trim();if(t){if(n===t)break;n.startsWith(`${t}\n\n`)&&(n=n.slice(t.length+2).trimStart())}}return n.trim()||e.trim()}function le(e){return e.kind===`system`&&e.from===`system`}var ue=new Set([`agent.ready`,`agent.exited`,`agent.spawn_failed`]);function G(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function de(e){let t=e.filter(e=>ae.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=oe)||n.push(e);return n}function fe(e,t,n,r=[],i){let a=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,I(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;a.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)a.push({ts:I(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&a.push({ts:e,entry:{type:`created`,timestamp:e}})}if(i?.spawnedBy){let e=n?new Date(n).getTime():0,t=Number.isFinite(e)?e:0;a.push({ts:t,entry:{type:`agent-action`,direction:`spawned-by`,agentId:i.spawnedBy.agentId,provider:i.spawnedBy.provider,status:`ready`,timestamp:t}})}let o=new Map,s=new Map,c=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`narration`&&typeof e.turnId==`string`){let n=s.get(e.turnId)??[];n.push({id:t.id,body:t.body.trim()}),s.set(e.turnId,n)}else if(e?.type===`response`&&typeof e.turnId==`string`){let n=o.get(e.turnId)??[];n.push(t.body.trim()),o.set(e.turnId,n)}}let l=new Map;for(let[e,t]of o){let n=(s.get(e)??[]).map(e=>e.body);l.set(e,t.map(e=>W(e,n)))}for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type!==`response`||typeof e.turnId!=`string`)continue;let n=W(t.body,(s.get(e.turnId)??[]).map(e=>e.body));n&&n!==t.body&&c.set(t.id,n)}let u=new Set;for(let[e,t]of l){let n=s.get(e)??[];for(let e of t)for(let t=n.length-1;t>=0;t--){let r=n[t];if(!u.has(r.id)&&ee(e,r.body)){u.add(r.id);break}}}let d=new Map,f=[];for(let t of e){if(le(t)){let e=typeof t.payload?.kind==`string`?t.payload.kind:``;if(ue.has(e)){let n=t.payload,r=typeof n.agentId==`string`?n.agentId:``,i=U(t);if(!r){a.push({ts:i,entry:{type:`notice`,msg:t}});continue}let o=e===`agent.ready`?`ready`:e===`agent.exited`?`exited`:`failed`,s=d.get(r);if(s)s.entry.status=o,typeof n.reason==`string`&&(s.entry.reason=n.reason),s.entry.timestamp=i,s.ts=i;else{let e={ts:i,entry:{type:`agent-action`,direction:`spawned-child`,agentId:r,provider:typeof n.provider==`string`?n.provider:void 0,status:o,reason:typeof n.reason==`string`?n.reason:void 0,timestamp:i}};d.set(r,e),a.push(e)}continue}a.push({ts:U(t),entry:{type:`notice`,msg:t}});continue}let e=ce(t);if(e){f.push(e);continue}let n=se(t);if(n){if(n.kind===`narration`&&u.has(n.id))continue;a.push({ts:n.ts,entry:{type:`activity`,steps:[n],timestamp:n.ts}});continue}if(t.kind===`session`){let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`){let e=c.get(t.id);if(e&&e!==t.body){a.push({ts:U(t),entry:{type:`message`,msg:{...t,body:e}}});continue}}}a.push({ts:U(t),entry:{type:`message`,msg:t}})}for(let e of de([...t,...f]))a.push({ts:e.timestamp,entry:{type:`status`,event:e}});let p={created:0,date:1,"import-boundary":2,"imported-message":3,message:4,activity:4,notice:4,"agent-action":4,status:5};a.sort((e,t)=>{let n=e.ts-t.ts;return Math.abs(n)<3e3&&p[e.entry.type]-p[t.entry.type]||n});let m=[],h=``;for(let{ts:e,entry:t}of a){if(t.type===`created`){m.push(t);continue}let n=G(e);if(n!==h&&(m.push({type:`date`,date:n,timestamp:e}),h=n),t.type===`activity`){let e=m[m.length-1];if(e&&e.type===`activity`&&pe(e,t)){e.steps.push(...t.steps);continue}}m.push(t)}return m}function pe(e,t){let n=e.steps[e.steps.length-1]?.turnId,r=t.steps[0]?.turnId;return n&&r?n===r:!n&&!r}function me(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function he(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function ge(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function _e(e,t){return e.filter(e=>e.status===`online`&&P(t,e.baseDir)).sort((e,t)=>R(t.baseDir).length-R(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function ve(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function K(){return typeof window<`u`&&!!window.getSelection()?.toString()}function ye(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var be=[`👍`,`❤️`,`✅`,`👀`];function xe(e){let t=new Map;for(let n of e.reactions||[]){let e=F(n.emoji),r=t.get(e)??{emoji:e,count:0,mine:!1,actors:[]};r.count+=1,r.mine=r.mine||n.actorId===`user`,r.actors.push(n.actorId),t.set(e,r)}return[...t.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function q(e){return z(e)}function Se(e,t){let n=e.readBy||[],r=e.resolvedToAgent||t||e.to,i=r?n.includes(r):!1,a=n.some(e=>e!==L);if(i||a){let e=i?r:n.find(e=>e!==L);return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:g}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:g};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:u};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let t=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:t,tone:`danger`,icon:b}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:m}}function Ce(e){let t=I(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,I(t.updatedAt||t.createdAt)),t)}function we(e){return e?e.messages.reduce((e,t)=>Math.max(e,Ce(t)),0):0}function J(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function Te(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Ee(e,t,n,r){if(e?.teamId)return{teamId:e.teamId};let i=[...t];n&&!i.some(e=>e.id===n.id)&&i.push(n);let a=i.filter(e=>e.threadId).reverse(),o=a.find(e=>!!r[j(e.threadId,e.channel)])??a[0];return o?.threadId?{threadId:o.threadId,...o.channel?{channel:o.channel}:{}}:null}var Y=a(),De={online:`text-emerald-400`,offline:`text-zinc-400`,shutdown:`text-zinc-400`,restarted:`text-blue-400`,"compaction-requested":`text-zinc-400`,compacting:`text-amber-400`,compacted:`text-amber-400`,"compaction-stalled":`text-red-400`,"clear-requested":`text-zinc-400`,"clearing-context":`text-amber-400`,"context-cleared":`text-amber-400`,"clear-stalled":`text-red-400`,"shutting-down":`text-zinc-400`};function Oe(e){let t=new Date,[n,r,i]=e.split(`-`).map(Number),a=new Date(n,r-1,i);if(e===G(t.getTime()))return`Today`;let o=new Date(t);return o.setDate(o.getDate()-1),e===G(o.getTime())?`Yesterday`:a.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,year:a.getFullYear()===t.getFullYear()?void 0:`numeric`})}function ke({event:e}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(t,{className:n(`w-2 h-2 fill-current`,De[e.status]||`text-zinc-400`)}),(0,Y.jsx)(`span`,{children:H[e.status]||e.status}),(0,Y.jsx)(`span`,{className:`text-muted-foreground/60`,children:J(e.timestamp)})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var Ae={"branch.landed":D,"context.warning":x},je={"branch.landed":`branch landed`,"context.warning":`context warning`};function Me({msg:e}){let t=typeof e.payload?.kind==`string`?e.payload.kind:``,n=Ae[t]??c,r=je[t]??(t||`system signal`);return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(n,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{children:r}),(0,Y.jsx)(`span`,{className:`text-muted-foreground/60`,children:J(e.occurredAt??e.createdAt)})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var Ne={"spawned-child":{ready:`spawned`,exited:`spawned · exited`,failed:`spawn failed`},"spawned-by":{ready:`spawned by`,exited:`spawned by`,failed:`spawned by`}},Pe={"spawned-child-ready":i,"spawned-child-exited":y,"spawned-child-failed":b,"spawned-by-ready":s,"spawned-by-exited":s,"spawned-by-failed":s},Fe={"spawned-child-ready":`text-emerald-400`,"spawned-child-exited":`text-zinc-400`,"spawned-child-failed":`text-red-400`,"spawned-by-ready":`text-blue-400`,"spawned-by-exited":`text-blue-400`,"spawned-by-failed":`text-blue-400`};function Ie({entry:e}){let t=M(e=>e.agentsById),r=M(e=>e.openInboxThread),i=M(e=>e.switchView),a=t[e.agentId]||null,o=a?.label??e.agentId,s=`${e.direction}-${e.status}`,l=Ne[e.direction]?.[e.status]??e.direction,u=Pe[s]??c,d=Fe[s]??`text-muted-foreground`,f=e.status===`failed`;function p(){r(e.agentId),i(`chat`)}return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:n(`flex items-center gap-1.5 rounded-full border bg-muted/30 px-2.5 py-1 text-xs`,f?`border-red-500/30`:`border-border`),children:[(0,Y.jsx)(u,{className:n(`h-3 w-3 shrink-0`,d)}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:l}),(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded hover:text-foreground text-muted-foreground transition-colors hover:bg-muted/50 px-1`,onClick:p,title:`Open chat for ${o}`,children:[(0,Y.jsx)(te,{agent:a,className:`w-4 h-4 text-[10px]`}),(0,Y.jsx)(`span`,{className:`max-w-[160px] truncate`,children:o})]}),e.reason&&f&&(0,Y.jsxs)(`span`,{className:`text-red-400/80 max-w-[120px] truncate`,title:e.reason,children:[`— `,e.reason]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0`,children:J(e.timestamp)})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Le({blockedLabel:e,onInterrupt:t}){return e?(0,Y.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-red-500/30 px-4 py-2.5`,children:[(0,Y.jsx)(b,{className:`w-3.5 h-3.5 text-red-400`}),(0,Y.jsxs)(`span`,{className:`text-xs text-red-300`,children:[`blocked: `,e]})]})}):(0,Y.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-foreground/10 px-4 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_infinite]`}),(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.2s_infinite]`}),(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-yellow-400 animate-[pulse_1.4s_ease-in-out_0.4s_infinite]`})]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`working`}),t&&(0,Y.jsxs)(`button`,{onClick:t,title:`Interrupt`,className:`ml-1 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs text-muted-foreground hover:text-red-300 hover:bg-red-500/10 transition-colors`,children:[(0,Y.jsx)(h,{className:`w-3.5 h-3.5`}),`Stop`]})]})})}var X=`agent-relay:chat-hide-tools`,Z=(()=>{let e=new Set,t=(()=>{try{return window.localStorage.getItem(X)===`on`}catch{return!1}})(),n=()=>e.forEach(e=>e());return typeof window<`u`&&window.addEventListener(`storage`,e=>{e.key===X&&(t=e.newValue===`on`,n())}),{subscribe(t){return e.add(t),()=>e.delete(t)},get:()=>t,toggle(){t=!t;try{window.localStorage.setItem(X,t?`on`:`off`)}catch{}n()}}})();function Re(){return[(0,V.useSyncExternalStore)(Z.subscribe,Z.get,()=>!1),Z.toggle]}function Q({steps:e,showReasoning:t}){let[r,i]=Re(),a=t?e:e.filter(e=>e.kind!==`reasoning`);if(!a.length)return null;let o=a.filter(e=>e.kind===`tool`).length;return(0,Y.jsx)(`div`,{className:`flex justify-start mb-2`,children:(0,Y.jsxs)(`div`,{className:`max-w-[85%] md:max-w-[75%] min-w-0 space-y-1.5`,children:[a.map(e=>e.kind===`narration`?(0,Y.jsx)(B,{text:e.text,className:`text-sm leading-relaxed break-words text-foreground/90 min-w-0`},e.id):e.kind===`reasoning`?(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground/80`,children:[(0,Y.jsx)(E,{className:`w-3.5 h-3.5 mt-0.5 shrink-0 opacity-70`}),(0,Y.jsx)(B,{text:e.text,className:`italic break-words min-w-0`})]},e.id):r?null:(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsx)(_,{className:`w-3 h-3 mt-0.5 shrink-0 opacity-70`}),(0,Y.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:e.label||`tool`}),e.text?(0,Y.jsxs)(`span`,{className:`opacity-70`,children:[` — `,e.text]}):null]})]},e.id)),o>0&&(0,Y.jsxs)(`button`,{onClick:i,className:`flex items-center gap-1 text-[11px] text-muted-foreground/50 hover:text-muted-foreground transition-colors text-left`,children:[(0,Y.jsx)(p,{className:n(`w-3 h-3 shrink-0 transition-transform`,!r&&`rotate-90`)}),(0,Y.jsx)(`span`,{children:r?`show ${o} tool step${o===1?``:`s`}`:`hide tool steps`})]})]})})}function ze({date:e}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-3 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:Oe(e)}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Be({timestamp:e}){let t=new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`});return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground/60`,children:[`created `,t]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Ve({history:e}){let t=e.sourceAgentLabel||e.sourcePeerId,n=e.entries.length;return(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-dashed border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(l,{className:`h-3 w-3`}),(0,Y.jsxs)(`span`,{children:[`forked history from `,t]}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[n,` `,n===1?`entry`:`entries`]})]}),(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function He({entry:e,sourceLabel:t}){let r=e.message,i=N(r),a=e.originalFrom===L;return(0,Y.jsx)(`div`,{className:n(`flex mb-3 opacity-80`,a?`justify-end`:`justify-start`),children:(0,Y.jsx)(`div`,{className:`max-w-[85%] md:max-w-[75%]`,children:(0,Y.jsxs)(`div`,{className:n(`rounded-2xl border border-dashed px-3.5 py-2 text-sm select-text`,a?`border-primary/25 bg-primary/10 text-foreground rounded-br-sm`:`border-border bg-card/70 rounded-bl-sm`),children:[(0,Y.jsxs)(`div`,{className:n(`mb-1 text-[10px] uppercase tracking-normal`,a?`text-primary/70`:`text-muted-foreground`),children:[`forked history · `,a?`you`:t||e.originalFrom]}),(0,Y.jsx)(B,{text:i,rawBody:r.body,className:`leading-relaxed`}),(0,Y.jsxs)(`p`,{className:n(`mt-1 flex items-center justify-end gap-1.5 text-xs`,a?`text-primary/60`:`text-muted-foreground`),children:[(0,Y.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.originalMessageId]}),(0,Y.jsx)(`span`,{children:J(e.originalCreatedAt)})]})]})})})}function Ue({scrollRef:e,timeline:t}){let[r,i]=(0,V.useState)(!0),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!0),d=(0,V.useMemo)(()=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(!(!n||n.type!==`message`)&&n.msg.from===`user`)return{id:n.msg.id,body:N(n.msg)}}return null},[t]);if((0,V.useEffect)(()=>{let t=e.current;if(!d||!t){i(!0);return}let n=t.querySelector(`[data-msg-id="${d.id}"]`);if(!n){i(!0);return}let r=new IntersectionObserver(([e])=>{if(e&&(i(e.isIntersecting),!e.isIntersecting)){let n=e.rootBounds?.top??t.getBoundingClientRect().top;u(e.boundingClientRect.top<n)}},{root:t,threshold:0});r.observe(n);let a=()=>{let e=n.getBoundingClientRect(),r=t.getBoundingClientRect();u(e.top<r.top)};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{r.disconnect(),t.removeEventListener(`scroll`,a)}},[d?.id,e]),r||!d||!d.body.trim())return null;let f=a?.id===d.id?a.value:!1,p=s?.id===d.id?s.value:!1;function m(){let t=e.current;!t||!d||t.querySelector(`[data-msg-id="${d.id}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`})}let h=l?`↑`:`↓`;return p?(0,Y.jsx)(`div`,{className:`sticky top-0 z-10 -mx-3 md:-mx-4 -mt-3 md:-mt-4 bg-background`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`w-full flex items-center justify-center gap-1.5 py-1 text-[11px] text-primary/60 hover:text-primary border-b border-primary/10 transition-colors`,onClick:()=>c({id:d.id,value:!1}),children:[(0,Y.jsx)(`span`,{children:`Your prompt`}),(0,Y.jsx)(T,{className:`w-3 h-3`})]})}):(0,Y.jsxs)(`div`,{className:`sticky top-0 z-10 -mx-3 md:-mx-4 -mt-3 md:-mt-4 px-2 md:px-3 pt-2 pb-1.5 bg-background border-b border-primary/10`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mb-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-primary/70`,children:`Your prompt`}),(0,Y.jsxs)(`button`,{type:`button`,className:`ml-auto hover:text-foreground transition-colors`,onClick:m,children:[h,` scroll to original`]}),(0,Y.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors`,onClick:()=>c({id:d.id,value:!0}),title:`Minimize`,children:(0,Y.jsx)(C,{className:`w-3 h-3`})})]}),(0,Y.jsx)(`p`,{className:n(`text-sm text-foreground leading-snug cursor-pointer`,!f&&`line-clamp-2`),onClick:()=>o({id:d.id,value:!f}),children:d.body})]})}function We(){return(0,V.useSyncExternalStore)(e=>A.subscribe(e),()=>A.getPlayingKey(),()=>null)}function Ge({attachment:e,outbound:t}){let i=e.kind===`image`,a=e.title||e.artifactId,[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let t=!1,n=null;async function r(){f(!0),u(null),c(null);try{let r=await k(`/artifacts/${encodeURIComponent(e.artifactId)}/content`);if(t)return;n=URL.createObjectURL(r),c(n)}catch(e){t||u(e.message)}finally{t||f(!1)}}return r(),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e.artifactId]);function h(){if(!s)return;let e=document.createElement(`a`);e.href=s,e.download=a,document.body.appendChild(e),e.click(),e.remove()}return i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>s&&m(!0),disabled:!s,className:`group/img mt-2 block overflow-hidden rounded-md border border-foreground/10 bg-black/10 text-left disabled:cursor-default relative`,children:s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`img`,{src:s,alt:a,loading:`lazy`,className:`block max-h-72 max-w-full object-contain`}),(0,Y.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/img:bg-black/30 transition-colors`,children:(0,Y.jsx)(S,{className:`w-6 h-6 text-white opacity-0 group-hover/img:opacity-100 transition-opacity drop-shadow-md`})})]}):(0,Y.jsxs)(`span`,{className:n(`flex min-h-20 items-center gap-2 px-3 py-2 text-xs`,l?`text-red-400`:`text-muted-foreground`),children:[d?(0,Y.jsx)(w,{className:`h-4 w-4 animate-spin`}):(0,Y.jsx)(b,{className:`h-4 w-4`}),l||`Loading image`]})}),s&&(0,Y.jsx)(re,{open:p,onOpenChange:m,children:(0,Y.jsxs)(ne,{className:`max-w-[95vw] max-h-[95vh] w-auto p-0 bg-black/95 border-zinc-800 gap-0 overflow-hidden`,showCloseButton:!1,children:[(0,Y.jsx)(ie,{className:`sr-only`,children:a}),(0,Y.jsxs)(`div`,{className:`relative flex items-center justify-center min-h-[200px]`,children:[(0,Y.jsx)(`img`,{src:s,alt:a,className:`max-w-[93vw] max-h-[90vh] object-contain`}),(0,Y.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:h,className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Download`,children:(0,Y.jsx)(r,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>m(!1),className:`rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Close`,children:(0,Y.jsx)(v,{className:`w-4 h-4`})})]})]})]})})]}):(0,Y.jsxs)(`button`,{type:`button`,onClick:h,disabled:!s,className:n(`mt-2 flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-xs transition-colors disabled:cursor-default disabled:opacity-70`,t?`border-primary-foreground/20 bg-primary-foreground/10 hover:bg-primary-foreground/15`:`border-border bg-background hover:bg-muted`),children:[d?(0,Y.jsx)(w,{className:`h-4 w-4 shrink-0 animate-spin`}):l?(0,Y.jsx)(b,{className:`h-4 w-4 shrink-0 text-red-400`}):(0,Y.jsx)(o,{className:`h-4 w-4 shrink-0`}),(0,Y.jsx)(`span`,{className:n(`min-w-0 flex-1 truncate`,l&&`text-red-400`),children:l||a}),(0,Y.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`})]})}function $({open:e,onToggle:t,onReact:r}){return(0,Y.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,Y.jsx)(`button`,{type:`button`,title:`Add reaction`,onClick:t,className:n(`inline-flex h-5 w-6 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground`,e?`opacity-100`:`opacity-0 pointer-events-none md:group-hover/msg:opacity-100 md:group-hover/msg:pointer-events-auto`),children:(0,Y.jsx)(O,{className:`h-3 w-3`})}),e&&(0,Y.jsx)(`div`,{className:`absolute bottom-full left-0 z-30 mb-1 flex gap-0.5 rounded-full border border-border bg-popover p-0.5 shadow-md`,children:be.map(e=>(0,Y.jsx)(`button`,{type:`button`,title:`React ${e}`,onClick:()=>r(e),className:`inline-flex h-6 w-7 items-center justify-center rounded-full text-xs transition-colors hover:bg-muted`,children:e},e))})]})}var Ke=(0,V.memo)(function({msg:e,peer:t,onOpenReferencedPath:r,onPreviewReferencedPath:i,onPreviewReferencedPathEnd:a}){let o=e.from!==`user`&&e.to!==`user`,s=o?e.from===t:e.from===L,c=o?s?`→ ${e.to}`:`from ${e.from}`:null,l=M(e=>e.reactToMessage),u=M(e=>e.voiceTtsEnabled),d=We(),p=M(e=>{let n=e.agentsById[t]?.meta?.cwd;return typeof n==`string`?n:``}),[m,g]=(0,V.useState)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)(null),y=(0,V.useRef)(!1),b=N(e),x=J(e.occurredAt??e.createdAt),S=ye(e),C=xe(e),w=s?Se(e,t):null,T=w?.icon,E=d===String(e.id),D=u&&!s&&!o&&!q(e)&&b.trim().length>0;function O(t){t.stopPropagation(),E?A.bargeIn():A.speak(e.body,String(e.id))}(0,V.useEffect)(()=>{if(!m)return;function e(e){K()||_.current&&!_.current.contains(e.target)&&g(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)}},[m]);function k(e){return he(p||`/`,e)}function j(e,t){let n=k(e);r?.(n,t)}function P(e,t,n){let r=k(e);i?.(r,t,n)}function F(t){l(e,t),g(!1)}function I(e){e.button===0&&(v.current={x:e.clientX,y:e.clientY},y.current=!1)}function R(e){let t=v.current;t&&(Math.abs(e.clientX-t.x)>3||Math.abs(e.clientY-t.y)>3)&&(y.current=!0)}function z(t){if(!(q(e)||s||o)&&!t.target.closest(`a,button,input,textarea,select,[role="button"]`)){if(y.current||K()){y.current=!1;return}g(e=>!e)}}return(0,Y.jsx)(`div`,{"data-msg-id":e.id,className:n(`group/msg flex mb-3`,s?`justify-end`:`justify-start`),children:(0,Y.jsxs)(`div`,{ref:_,className:`relative max-w-[85%] md:max-w-[75%]`,children:[D&&(0,Y.jsx)(`button`,{type:`button`,title:E?`Stop playback`:`Play aloud`,onClick:O,className:n(`absolute -top-2 -right-2 z-20 inline-flex h-6 w-6 items-center justify-center rounded-full border bg-popover shadow-sm transition`,E?`border-primary/50 text-primary opacity-100`:`border-border text-muted-foreground opacity-70 hover:bg-muted hover:text-foreground hover:opacity-100 [@media(hover:hover)]:md:opacity-0 [@media(hover:hover)]:md:group-hover/msg:opacity-100`),children:E?(0,Y.jsx)(h,{className:`h-3.5 w-3.5 animate-pulse`}):(0,Y.jsx)(f,{className:`h-3.5 w-3.5`})}),(0,Y.jsxs)(`div`,{className:n(`rounded-2xl px-3.5 py-2 text-sm select-text`,!s&&!q(e)&&!o&&`cursor-pointer`,s?`bg-primary text-primary-foreground rounded-br-sm`:`bg-card ring-1 ring-foreground/10 rounded-bl-sm`),onPointerDown:I,onPointerMove:R,onClick:z,children:[c&&(0,Y.jsx)(`p`,{className:n(`text-xs font-medium mb-1 opacity-60`,s?`text-primary-foreground`:`text-muted-foreground`),children:c}),e.subject&&(0,Y.jsx)(`p`,{className:n(`text-xs font-semibold mb-1`,s?`text-primary-foreground/70`:`text-muted-foreground`),children:e.subject}),(0,Y.jsx)(B,{text:b,rawBody:e.body,className:`leading-relaxed`,onOpenPath:j,onPreviewPath:P,onPreviewPathEnd:a,resolvePathTitle:(e,t)=>`${k(e)}${t?`:${t}`:``}`}),S.map(t=>(0,Y.jsx)(Ge,{attachment:t,outbound:s},`${e.id}-${t.artifactId}-${t.role||``}`)),(0,Y.jsxs)(`p`,{className:n(`text-xs mt-1 flex items-center gap-1.5`,s?`justify-end text-primary-foreground/60`:`justify-end text-muted-foreground`),children:[(0,Y.jsxs)(`span`,{className:`opacity-40`,children:[`#`,e.id]}),(0,Y.jsx)(`span`,{children:x}),w&&T&&(0,Y.jsxs)(`span`,{className:n(`inline-flex items-center gap-1`,w.tone===`ok`&&`text-emerald-300`,w.tone===`warn`&&`text-amber-200`,w.tone===`danger`&&`text-red-200`),title:w.title,children:[(0,Y.jsx)(T,{className:`h-3 w-3`}),w.label]})]})]}),!q(e)&&C.length>0&&(0,Y.jsxs)(`div`,{className:n(`flex flex-wrap items-center gap-0.5 -mt-1 relative z-10`,s?`justify-end pr-2`:`justify-start pl-2`),children:[!s&&(0,Y.jsx)($,{open:m,onToggle:()=>g(e=>!e),onReact:F}),C.map(e=>(0,Y.jsxs)(`button`,{type:`button`,title:e.actors.join(`, `),onClick:()=>F(e.emoji),className:n(`inline-flex h-5 items-center gap-0.5 rounded-full border px-1.5 text-[11px] shadow-sm transition-colors`,e.mine?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-background hover:bg-muted text-foreground`),children:[(0,Y.jsx)(`span`,{children:e.emoji}),e.count>1&&(0,Y.jsx)(`span`,{children:e.count})]},e.emoji))]}),!q(e)&&!s&&C.length===0&&(0,Y.jsx)(`div`,{className:`absolute -bottom-2.5 left-1 z-20`,children:(0,Y.jsx)($,{open:m,onToggle:()=>g(e=>!e),onReact:F})})]})})});export{ve as _,Be as a,He as c,Ue as d,me as f,Te as g,Ee as h,Le as i,Me as l,ge as m,Q as n,ze as o,_e as p,Ie as r,Ve as s,Ke as t,ke as u,we as v,fe as y};
|
|
2
|
+
//# sourceMappingURL=MessageBubble-BP0Ym3xb.js.map
|