@axiom-lattice/gateway 4.3.2 → 4.4.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.
Files changed (73) hide show
  1. package/dist/{a2a-standard-ALXWP7V6.mjs → a2a-standard-P7JDL6ZA.mjs} +63 -35
  2. package/dist/a2a-standard-P7JDL6ZA.mjs.map +1 -0
  3. package/dist/{registerExposedPlugins-63EUF4VS.mjs → chunk-3XIIQ6EK.mjs} +62 -18
  4. package/dist/chunk-3XIIQ6EK.mjs.map +1 -0
  5. package/dist/chunk-526UYVNQ.mjs +157 -0
  6. package/dist/chunk-526UYVNQ.mjs.map +1 -0
  7. package/dist/chunk-73QZQQOT.mjs +43 -0
  8. package/dist/chunk-73QZQQOT.mjs.map +1 -0
  9. package/dist/{chunk-GF4GGTWJ.mjs → chunk-HVIKCUOF.mjs} +10 -7
  10. package/dist/chunk-HVIKCUOF.mjs.map +1 -0
  11. package/dist/embed/embed-page-AgentDetailSideApp-PSRQVFNR.js +1 -0
  12. package/dist/embed/{embed-page-AgentGovernanceWorkbench-ZNW72EEJ.js → embed-page-AgentGovernanceWorkbench-UPQHJZD7.js} +1 -1
  13. package/dist/embed/embed-page-MessageGraph-PDNQ67T4.js +6 -0
  14. package/dist/embed/{embed-page-TasksSideApp-F4XUHPTG.css → embed-page-MessageGraph-UT2TCPSO.css} +1 -1
  15. package/dist/embed/{embed-page-ReactChart-XS7D26VP.js → embed-page-ReactChart-25KAFLQ3.js} +1 -1
  16. package/dist/embed/embed-page-ReactChart-MXGF35OQ.css +1 -0
  17. package/dist/embed/embed-page-SkillFlow-TKBMB5VV.js +1 -0
  18. package/dist/embed/{embed-page-TasksSideApp-MQTUCJO4.js → embed-page-TasksSideApp-DLH5LRMS.js} +1 -1
  19. package/dist/embed/{embed-page-TopologyRuntimeView-2NQ3OOYI.css → embed-page-TasksSideApp-HV6DKQ26.css} +1 -1
  20. package/dist/embed/{embed-page-TeamWorkspace-7T2HRXLG.js → embed-page-TeamWorkspace-2WJJWF25.js} +1 -1
  21. package/dist/embed/{embed-page-TeamWorkspace-DXKGNQ3C.css → embed-page-TeamWorkspace-YQFWXDLI.css} +1 -1
  22. package/dist/embed/{embed-page-MessageGraph-TYOOATYV.css → embed-page-TopologyRuntimeView-CWOXLVFW.css} +1 -1
  23. package/dist/embed/{embed-page-TopologyRuntimeView-PU2D7VZ7.js → embed-page-TopologyRuntimeView-WDQRHDMO.js} +1 -1
  24. package/dist/embed/{embed-page-WorkflowAutomationView-ST76M33F.js → embed-page-WorkflowAutomationView-BAMJ2WVB.js} +1 -1
  25. package/dist/embed/embed-page-WorkflowAutomationView-YQFB3CTV.css +1 -0
  26. package/dist/embed/{embed-page-chunk-T25T2YE6.js → embed-page-chunk-HMTKPZ5B.js} +7 -5
  27. package/dist/embed/{embed-page-chunk-ZKJ7Z7P3.js → embed-page-chunk-LOXLXZNP.js} +1 -1
  28. package/dist/embed/{embed-page-chunk-Z4S4OYA4.js → embed-page-chunk-MQDYZS3S.js} +1 -1
  29. package/dist/embed/embed-page-chunk-OBM5EUWZ.js +6974 -0
  30. package/dist/embed/{embed-page-chunk-RLP3BC7G.js → embed-page-chunk-SSC7ANWV.js} +2 -2
  31. package/dist/embed/embed-page-chunk-TL2AYM76.js +2 -0
  32. package/dist/embed/{embed-page-chunk-LE6OFJ7R.js → embed-page-chunk-XVUA7UHE.js} +1 -1
  33. package/dist/embed/embed-page.js +1 -1
  34. package/dist/index.js +5103 -3988
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +1566 -411
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/{open-HH7RKGML.mjs → open-AMEMJOFJ.mjs} +99 -14
  39. package/dist/open-AMEMJOFJ.mjs.map +1 -0
  40. package/dist/{open-catalog-WYS2AENM.mjs → open-catalog-SZQ435AY.mjs} +34 -3
  41. package/dist/open-catalog-SZQ435AY.mjs.map +1 -0
  42. package/dist/{open-exposure-FK4G6O6L.mjs → open-exposure-I44Q4M3T.mjs} +37 -7
  43. package/dist/open-exposure-I44Q4M3T.mjs.map +1 -0
  44. package/dist/{open-files-GVRMK5PL.mjs → open-files-EJ6O2SGX.mjs} +4 -4
  45. package/dist/{open-session-3VN65PRR.mjs → open-session-LBTCU3AE.mjs} +4 -4
  46. package/dist/{openLattice-GAAGQJST.mjs → openLattice-Q6M5S6CY.mjs} +4 -2
  47. package/dist/registerExposedPlugins-6GCOE64C.mjs +11 -0
  48. package/dist/{resources-JFKAPS45.mjs → resources-DXPXAXEZ.mjs} +16 -9
  49. package/dist/{resources-JFKAPS45.mjs.map → resources-DXPXAXEZ.mjs.map} +1 -1
  50. package/package.json +11 -8
  51. package/dist/a2a-standard-ALXWP7V6.mjs.map +0 -1
  52. package/dist/chunk-GF4GGTWJ.mjs.map +0 -1
  53. package/dist/chunk-QKPZWWHH.mjs +0 -433
  54. package/dist/chunk-QKPZWWHH.mjs.map +0 -1
  55. package/dist/embed/embed-page-AgentDetailSideApp-7PQ2JKG6.js +0 -1
  56. package/dist/embed/embed-page-MessageGraph-P7DBTZCL.js +0 -6
  57. package/dist/embed/embed-page-ReactChart-VBM467ER.css +0 -1
  58. package/dist/embed/embed-page-SkillFlow-HPH37PZH.js +0 -1
  59. package/dist/embed/embed-page-WorkflowAutomationView-MAYS27YJ.css +0 -1
  60. package/dist/embed/embed-page-chunk-4ZSGPIBZ.js +0 -1
  61. package/dist/embed/embed-page-chunk-BRETUPSG.js +0 -4094
  62. package/dist/embed/embed-page-chunk-I42T7B7V.js +0 -2415
  63. package/dist/embed/embed-page-chunk-VRV57DFE.js +0 -466
  64. package/dist/embed/embed-page-chunk-ZXFZANZM.js +0 -1
  65. package/dist/mcp-configs-WCY5EXCW.mjs +0 -30
  66. package/dist/open-HH7RKGML.mjs.map +0 -1
  67. package/dist/open-catalog-WYS2AENM.mjs.map +0 -1
  68. package/dist/open-exposure-FK4G6O6L.mjs.map +0 -1
  69. package/dist/registerExposedPlugins-63EUF4VS.mjs.map +0 -1
  70. /package/dist/{open-files-GVRMK5PL.mjs.map → open-files-EJ6O2SGX.mjs.map} +0 -0
  71. /package/dist/{open-session-3VN65PRR.mjs.map → open-session-LBTCU3AE.mjs.map} +0 -0
  72. /package/dist/{mcp-configs-WCY5EXCW.mjs.map → openLattice-Q6M5S6CY.mjs.map} +0 -0
  73. /package/dist/{openLattice-GAAGQJST.mjs.map → registerExposedPlugins-6GCOE64C.mjs.map} +0 -0
@@ -1,466 +0,0 @@
1
- import{B as $e,E as Re,I as Ae,Ma as B,Ua as Be,V as De,_a as z,b as de,ia as V,j as Ne,l as Ie,ma as Se,u as ce,va as pe,x as Ce,y as J}from"./embed-page-chunk-BRETUPSG.js";import{a as S}from"./embed-page-chunk-MB65DZAX.js";import{W as Te,Z as se,pa as we,va as le}from"./embed-page-chunk-O4QK5LWZ.js";import{a as X}from"./embed-page-chunk-4BKXE5ON.js";import{e as N}from"./embed-page-chunk-6Y3UYJ6Z.js";var ee=N(X());var k=N(X());var q=N(X());var T=N(S());function Fe(e){if(!e||!de(e).success)return e??"";let t=e.split(`
2
- `),n,m=t.map(l=>{let s=l.match(/^ {0,3}(`{3,}|~{3,})/),x=n!==void 0;return!n&&s?n={marker:s[1][0],length:s[1].length}:n&&new RegExp(`^ {0,3}\\${n.marker}{${n.length},}[ \\t]*$`).test(l)&&(n=void 0),x||s!==null}),c=t.findIndex((l,s)=>!m[s]&&/^ {0,3}##\s+Belief State\s*$/i.test(l.trimEnd()));if(c<0)return e;let h=t.slice(c+1).findIndex((l,s)=>!m[c+1+s]&&/^ {0,3}#{1,2}(?:[ \t]+|$)/.test(l)),g=h<0?t.length:c+1+h;return[...t.slice(0,c),...t.slice(g)].join(`
3
- `).replace(/\n{3,}/g,`
4
-
5
- `).trim()}var lt=B(({token:e,css:t})=>({block:t`
6
- display: flex;
7
- flex-direction: column;
8
- gap: 8px;
9
- `,label:t`
10
- margin: 0;
11
- font-size: 13px;
12
- font-weight: 600;
13
- color: ${e.colorTextSecondary};
14
- `,table:t`
15
- width: 100%;
16
- border-collapse: collapse;
17
- font-size: 13px;
18
- line-height: 1.5;
19
- `,th:t`
20
- text-align: left;
21
- font-weight: 600;
22
- color: ${e.colorTextTertiary};
23
- padding: 4px 8px;
24
- border-bottom: 1px solid ${e.colorBorderSecondary};
25
- `,td:t`
26
- padding: 4px 8px;
27
- border-bottom: 1px solid ${e.colorBorderSecondary};
28
- color: ${e.colorText};
29
- vertical-align: top;
30
- `,keyCell:t`
31
- font-family: ${e.fontFamilyCode};
32
- `,basisCell:t`
33
- color: ${e.colorTextSecondary};
34
- `})),Pe=({description:e})=>{let{styles:t}=lt(),n=(0,q.useMemo)(()=>de(e??""),[e]),m=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{!n.success&&!m.current&&(m.current=!0,console.warn(`[TaskBeliefState] ${n.code}: ${n.message}`))},[n]),n.success?(0,T.jsxs)("div",{"data-testid":"belief-state",className:t.block,children:[(0,T.jsx)("div",{className:t.label,children:"Belief State (Last reconciled snapshot)"}),(0,T.jsxs)("table",{className:t.table,children:[(0,T.jsx)("thead",{children:(0,T.jsxs)("tr",{children:[(0,T.jsx)("th",{className:t.th,children:"Key"}),(0,T.jsx)("th",{className:t.th,style:{textAlign:"right"},children:"Probability"}),(0,T.jsx)("th",{className:t.th,style:{textAlign:"right"},children:"Target"}),(0,T.jsx)("th",{className:t.th,children:"Basis"})]})}),(0,T.jsx)("tbody",{children:n.state.entries.map(c=>(0,T.jsxs)("tr",{children:[(0,T.jsx)("td",{className:`${t.td} ${t.keyCell}`,children:c.key}),(0,T.jsxs)("td",{className:t.td,style:{textAlign:"right"},children:[c.probability,"%"]}),(0,T.jsxs)("td",{className:t.td,style:{textAlign:"right"},children:[c.target,"%"]}),(0,T.jsx)("td",{className:`${t.td} ${t.basisCell}`,children:c.basis})]},c.key))})]})]}):null};var v=N(S()),dt=B(({token:e,css:t})=>({root:t`
35
- display: flex;
36
- flex-direction: column;
37
- gap: 6px;
38
- margin-top: 6px;
39
- padding-left: 2px;
40
- `,markdown:t`
41
- font-size: 13px;
42
- color: ${e.colorText};
43
- `,resultLabel:t`
44
- font-size: 12px;
45
- font-weight: 600;
46
- color: ${e.colorTextSecondary};
47
- `,impactList:t`
48
- display: flex;
49
- flex-direction: column;
50
- gap: 4px;
51
- `,impactRow:t`
52
- display: inline-flex;
53
- align-items: center;
54
- gap: 6px;
55
- font-size: 12px;
56
- color: ${e.colorText};
57
- background: ${e.colorFillTertiary};
58
- border-radius: 6px;
59
- padding: 3px 8px;
60
- align-self: flex-start;
61
- `,impactKey:t`
62
- font-weight: 600;
63
- color: ${e.colorInfo};
64
- `,impactBasis:t`
65
- color: ${e.colorTextTertiary};
66
- `,viewChat:t`
67
- display: inline-flex;
68
- align-items: center;
69
- gap: 4px;
70
- font-size: 12px;
71
- color: ${e.colorInfo};
72
- cursor: pointer;
73
- appearance: none;
74
- background: transparent;
75
- border: 0;
76
- font-family: inherit;
77
- margin: 0;
78
- min-height: 24px;
79
- padding: 2px 4px;
80
- align-self: flex-start;
81
- &:hover {
82
- text-decoration: underline;
83
- }
84
- &:active {
85
- opacity: 0.75;
86
- }
87
- &:focus-visible {
88
- outline: 2px solid ${e.colorPrimaryBorder};
89
- outline-offset: 2px;
90
- border-radius: 4px;
91
- }
92
- `})),me=({item:e,viewChat:t})=>{let{styles:n}=dt(),m=typeof e.detail?.markdown=="string"&&e.detail.markdown.length>0?e.detail.markdown:void 0,c=typeof e.detail?.result=="string"&&e.detail.result.length>0?e.detail.result:void 0,h=e.detail?.beliefImpact,g=(Array.isArray(h)?h:[]).filter(s=>typeof s=="object"&&s!==null).map(s=>({key:typeof s.key=="string"?s.key:"",after:typeof s.after=="number"?s.after:Number.NaN,basis:typeof s.basis=="string"?s.basis:""})).filter(s=>s.key.length>0),l=!!(e.threadId&&t);return!m&&!c&&g.length===0&&!l?null:(0,v.jsxs)("div",{className:n.root,"data-testid":"task-activity-detail",children:[m&&(0,v.jsx)("div",{className:n.markdown,children:(0,v.jsx)(z,{content:m})}),c&&(0,v.jsxs)("div",{className:n.markdown,children:[(0,v.jsx)("div",{className:n.resultLabel,children:"Result"}),(0,v.jsx)(z,{content:c})]}),g.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{className:n.resultLabel,children:"Belief Impact"}),(0,v.jsx)("div",{className:n.impactList,children:g.map((s,x)=>(0,v.jsxs)("span",{className:n.impactRow,children:[(0,v.jsxs)("span",{className:n.impactKey,children:[s.key,":"]}),(0,v.jsxs)("span",{children:["reported ",Number.isFinite(s.after)?`${s.after}%`:"n/a"]}),s.basis&&(0,v.jsxs)("span",{className:n.impactBasis,children:["\u2014 ",s.basis]})]},`${s.key}-${x}`))})]}),l&&(0,v.jsxs)("button",{type:"button",className:n.viewChat,onClick:t,children:[(0,v.jsx)(V,{size:12}),"View Chat"]})]})};var r=N(S()),Ee=B(({token:e,css:t})=>({workbench:t`
93
- min-width: 0;
94
- max-width: 100%;
95
- color: ${e.colorText};
96
- container-name: task-detail-workbench;
97
- container-type: inline-size;
98
- `,command:t`
99
- display: flex;
100
- align-items: center;
101
- gap: 12px;
102
- margin-bottom: 18px;
103
- min-width: 0;
104
- `,commandMain:t`
105
- flex: 1 1 auto;
106
- min-width: 0;
107
- `,parentPath:t`
108
- appearance: none;
109
- display: inline-flex;
110
- align-items: center;
111
- min-height: 32px;
112
- margin-bottom: 4px;
113
- padding: 0 4px;
114
- border: 0;
115
- border-radius: 6px;
116
- background: transparent;
117
- color: ${e.colorTextTertiary};
118
- font: inherit;
119
- font-size: 12px;
120
- cursor: default;
121
- &:focus-visible {
122
- outline: 2px solid ${e.colorPrimaryBorder};
123
- outline-offset: 2px;
124
- }
125
- `,parentAction:t`
126
- cursor: pointer;
127
- &:hover { color: ${e.colorPrimary}; }
128
- `,title:t`
129
- margin: 0;
130
- color: ${e.colorText};
131
- font-size: 22px;
132
- font-weight: 650;
133
- line-height: 1.25;
134
- overflow-wrap: anywhere;
135
- &:focus-visible {
136
- outline: 2px solid ${e.colorPrimaryBorder};
137
- outline-offset: 3px;
138
- border-radius: 4px;
139
- }
140
- `,commandMeta:t`
141
- display: flex;
142
- flex-wrap: wrap;
143
- gap: 10px;
144
- margin-top: 6px;
145
- color: ${e.colorTextSecondary};
146
- font-size: 12px;
147
- `,commandActions:t`
148
- display: flex;
149
- align-items: center;
150
- gap: 8px;
151
- flex: 0 0 auto;
152
- `,backButton:t`
153
- appearance: none;
154
- display: inline-flex;
155
- align-items: center;
156
- justify-content: center;
157
- width: 32px;
158
- height: 32px;
159
- padding: 0;
160
- border: 1px solid ${e.colorBorderSecondary};
161
- border-radius: ${e.borderRadius}px;
162
- background: ${e.colorBgContainer};
163
- color: ${e.colorTextSecondary};
164
- cursor: pointer;
165
- flex: 0 0 auto;
166
- &:hover {
167
- color: ${e.colorText};
168
- border-color: ${e.colorBorder};
169
- background: ${e.colorBgTextHover};
170
- }
171
- &:focus-visible {
172
- outline: 2px solid ${e.colorPrimary};
173
- outline-offset: 2px;
174
- }
175
- `,commandAction:t`
176
- min-height: 32px;
177
- white-space: normal;
178
- `,factStrip:t`
179
- display: grid;
180
- grid-template-columns: repeat(3, minmax(0, 1fr));
181
- gap: 12px;
182
- margin-bottom: 16px;
183
- @container task-detail-workbench (min-width: 640px) and (max-width: ${899}px) {
184
- grid-template-columns: repeat(2, minmax(0, 1fr));
185
- > :first-child { grid-column: 1 / -1; }
186
- }
187
- @container task-detail-workbench (max-width: 639px) {
188
- grid-template-columns: minmax(0, 1fr);
189
- }
190
- `,factCard:t`
191
- min-width: 0;
192
- padding: 14px 16px;
193
- border: 1px solid ${e.colorBorderSecondary};
194
- border-radius: 14px;
195
- background: ${e.colorBgContainer};
196
- &:first-child { border-top: 2px solid ${e.colorPrimary}; }
197
- `,heading:t`
198
- margin: 0 0 10px;
199
- color: ${e.colorTextSecondary};
200
- font-size: 12px;
201
- font-weight: 700;
202
- letter-spacing: 0.04em;
203
- text-transform: uppercase;
204
- `,facts:t`
205
- display: grid;
206
- grid-template-columns: minmax(0, 1fr) auto;
207
- gap: 7px 12px;
208
- margin: 0;
209
- font-size: 12px;
210
- dt { color: ${e.colorTextTertiary}; }
211
- dd {
212
- min-width: 0;
213
- margin: 0;
214
- color: ${e.colorText};
215
- font-weight: 650;
216
- text-align: right;
217
- overflow-wrap: anywhere;
218
- }
219
- `,overdue:t`
220
- color: ${e.colorError};
221
- font-weight: 700;
222
- `,grid:t`
223
- display: grid;
224
- grid-template-columns: 2fr 1fr;
225
- gap: 16px;
226
- align-items: start;
227
- @container task-detail-workbench (max-width: ${899}px) {
228
- grid-template-columns: minmax(0, 1fr);
229
- }
230
- `,card:t`
231
- min-width: 0;
232
- padding: 18px;
233
- border: 1px solid ${e.colorBorderSecondary};
234
- border-radius: 16px;
235
- background: ${e.colorBgContainer};
236
- `,contextCard:t`
237
- @container task-detail-workbench (min-width: 640px) and (max-width: ${899}px) {
238
- padding: 14px 18px;
239
- }
240
- `,contextContent:t`
241
- min-width: 0;
242
- @container task-detail-workbench (min-width: 640px) and (max-width: ${899}px) {
243
- > * {
244
- display: grid;
245
- grid-template-columns: repeat(2, minmax(0, 1fr));
246
- column-gap: 24px;
247
- }
248
- }
249
- `,activity:t`
250
- grid-column: 1 / -1;
251
- `,commandResponsive:t`
252
- @container task-detail-workbench (max-width: 639px) {
253
- flex-wrap: wrap;
254
- align-items: flex-start;
255
- .ant-btn { min-height: 32px; }
256
- }
257
- `,actionsResponsive:t`
258
- @container task-detail-workbench (max-width: 639px) {
259
- width: 100%;
260
- > * { min-height: 32px; }
261
- }
262
- `}));function ue(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function ct(e){let t=e instanceof Date?e:new Date(e),n=Date.now()-t.getTime();return n<60*1e3?"just now":n<3600*1e3?`${Math.floor(n/(60*1e3))}m ago`:n<1440*60*1e3?`${Math.floor(n/(3600*1e3))}h ago`:n<10080*60*1e3?`${Math.floor(n/(1440*60*1e3))}d ago`:t.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})}function pt(e){let t=Object.entries(e).filter(n=>n[1]);return t.length===0?"None":t.map(([n,m])=>`${n.replaceAll("_"," ")} ${m}`).join(" \xB7 ")}var w=({label:e,children:t})=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("dt",{children:e}),(0,r.jsx)("dd",{children:t})]}),H=({name:e,children:t,className:n,showHeading:m=!0})=>{let{styles:c}=Ee();return(0,r.jsxs)("section",{role:"region","aria-label":e,className:`${c.card} ${n??""}`,children:[m&&(0,r.jsx)("h3",{className:c.heading,children:e}),t]})},Me=({task:e,facts:t,parent:n,canGoBack:m=!1,onBack:c,onParentClick:h,headingRef:g,statusControl:l,priorityControl:s,regions:x,threadId:b,onViewChat:u})=>{let{styles:p}=Ee(),A=e.ownerType==="agent"?`@${e.ownerId}`:e.ownerId,I=t.execution.dependencies;return(0,r.jsxs)("div",{className:p.workbench,"data-testid":"task-detail-workbench",children:[(0,r.jsxs)("header",{"aria-label":"Task command",className:`${p.command} ${p.commandResponsive}`,children:[m&&c&&(0,r.jsx)("button",{type:"button",className:p.backButton,"data-testid":"task-detail-back",onClick:c,"aria-label":"Back",children:(0,r.jsx)(Ne,{size:16})}),(0,r.jsxs)("div",{className:p.commandMain,children:[n&&(h?(0,r.jsxs)("button",{type:"button",className:`${p.parentPath} ${p.parentAction}`,"data-testid":"parent-row","aria-label":`Parent: ${n.title}`,onClick:()=>h(n),children:[n.title," /"]}):(0,r.jsxs)("div",{className:p.parentPath,"data-testid":"parent-row",children:[n.title," /"]})),(0,r.jsx)("h2",{ref:g,className:p.title,tabIndex:g?-1:void 0,"data-testid":"task-detail-heading",children:e.title}),(0,r.jsxs)("div",{className:p.commandMeta,children:[(0,r.jsx)("span",{children:A}),(0,r.jsx)("span",{children:"Updated"}),(0,r.jsx)("span",{title:ue(e.updatedAt),children:ct(e.updatedAt)})]})]}),(0,r.jsx)("div",{className:`${p.commandActions} ${p.actionsResponsive}`,children:b&&u&&(0,r.jsx)(Te,{className:`${p.commandAction} task-detail-compact-action`,"data-testid":"thread-row","aria-label":"View agent work",icon:(0,r.jsx)(V,{size:14}),onClick:()=>u(b),children:"View agent work"})})]}),(0,r.jsxs)("div",{className:p.factStrip,children:[(0,r.jsxs)("section",{role:"region","aria-label":"State",className:p.factCard,children:[(0,r.jsx)("h3",{className:p.heading,children:"State"}),(0,r.jsxs)("dl",{className:p.facts,children:[(0,r.jsx)(w,{label:"Status",children:l}),(0,r.jsx)(w,{label:"Priority",children:s}),(0,r.jsx)(w,{label:"Due",children:t.state.dueDate?(0,r.jsxs)(r.Fragment,{children:[ue(t.state.dueDate),t.state.overdue&&(0,r.jsx)("span",{className:p.overdue,"data-testid":"overdue-marker",children:" \xB7 Overdue"})]}):"Not set"}),(0,r.jsx)(w,{label:"Review policy",children:t.state.requiresReview?"Yes":"No"}),(0,r.jsx)(w,{label:"Waiting approval",children:t.state.awaitingReview?"Yes":"No"}),(0,r.jsx)(w,{label:"Failure reason recorded",children:t.state.hasFailureReason?"Yes":"No"})]})]}),(0,r.jsxs)("section",{role:"region","aria-label":"Execution",className:p.factCard,children:[(0,r.jsx)("h3",{className:p.heading,children:"Execution"}),(0,r.jsxs)("dl",{className:p.facts,children:[(0,r.jsxs)(w,{label:"Subtasks",children:[t.execution.subtasks.completed," / ",t.execution.subtasks.total]}),(0,r.jsx)(w,{label:"Status distribution",children:pt(t.execution.subtasks.byStatus)}),(0,r.jsx)(w,{label:"Dependencies",children:I.total===0?"None":`${I.completed} completed / ${I.known} known / ${I.unavailable} unavailable`}),(0,r.jsx)(w,{label:"Latest activity",children:t.execution.latestActivityAt?ue(t.execution.latestActivityAt):"None"}),(0,r.jsx)(w,{label:"Maximum attempt",children:t.execution.maxAttempt??"None"})]})]}),(0,r.jsxs)("section",{role:"region","aria-label":"Output",className:p.factCard,children:[(0,r.jsx)("h3",{className:p.heading,children:"Output"}),(0,r.jsxs)("dl",{className:p.facts,children:[(0,r.jsx)(w,{label:"Result recorded",children:t.output.hasResult?"Yes":"No"}),(0,r.jsx)(w,{label:"Failure recorded",children:t.output.hasFailureReason?"Yes":"No"}),(0,r.jsx)(w,{label:"Files",children:t.output.files}),(0,r.jsx)(w,{label:"Artifacts",children:t.output.artifacts}),(0,r.jsx)(w,{label:"References",children:t.output.references}),(0,r.jsx)(w,{label:"Conversation",children:t.output.hasConversation?"Yes":"No"})]})]})]}),(0,r.jsxs)("div",{className:p.grid,children:[(0,r.jsx)(H,{name:"Task Content",children:x.taskContent}),(0,r.jsx)(H,{name:"Context",className:p.contextCard,children:(0,r.jsx)("div",{className:p.contextContent,children:x.context})}),(0,r.jsx)(H,{name:"Output details",children:x.output}),(0,r.jsx)(H,{name:"Subtasks",children:x.subtasks}),(0,r.jsx)(H,{name:"Activity",className:p.activity,showHeading:!1,children:x.activity})]})]})};function fe(e){return e==="completed"||e==="cancelled"}function Ft(e,t){let m=t?.hideCompleted??!1?e.filter(l=>!fe(l.status)):e,c=new Set(m.map(l=>l.id)),h=[],g=new Set;for(let l of m){if(l.parentId&&c.has(l.parentId)&&l.parentId!==l.id){let s=`${l.parentId}|${l.id}|parent`;g.has(s)||(g.add(s),h.push({from:l.parentId,to:l.id,kind:"parent"}))}for(let s of l.dependencies??[])if(c.has(s)&&s!==l.id){let x=`${s}|${l.id}|dependency`;g.has(x)||(g.add(x),h.push({from:s,to:l.id,kind:"dependency"}))}}return{nodes:m.map(l=>({id:l.id,task:l})),edges:mt(c,h)}}function mt(e,t){let n=[...t];for(;;){let m=new Map,c=new Map;for(let u of e)m.set(u,0),c.set(u,[]);for(let u of n)m.set(u.to,(m.get(u.to)??0)+1),c.get(u.from)?.push(u.to);let h=[...m.entries()].filter(([,u])=>u===0).map(([u])=>u),g=0;for(;h.length>0;){let u=h.shift();g+=1;for(let p of c.get(u)??[]){let A=(m.get(p)??0)-1;m.set(p,A),A===0&&h.push(p)}}if(g>=e.size)return n;let l=new Set([...m.entries()].filter(([,u])=>u>0).map(([u])=>u)),s=u=>l.has(u.from)&&l.has(u.to),x=n.findIndex(u=>u.kind==="dependency"&&s(u)),b=x>=0?x:n.findIndex(s);if(b===-1)return n;n.splice(b,1)}}function _e(e){let{task:t,workItems:n,subtasks:m,relatedTasks:c}=e,h=e.now??new Date,g=t.dueDate===void 0?Number.NaN:new Date(t.dueDate).getTime(),l=h.getTime(),s=t.failureReason!==void 0,x=t.context?.interruption,b=t.status==="interrupted"&&typeof x=="object"&&x!==null&&x.type==="review_required",u={};for(let y of m)u[y.status]=(u[y.status]??0)+1;let p=new Set(t.dependencies??[]),A=new Map(c.map(y=>[y.id,y])),I=0,P=0;for(let y of p){let C=A.get(y);C&&(I+=1,C.status==="completed"&&(P+=1))}let i,D;for(let y of n){let C=Le(y.createdAt);C!==void 0&&(i===void 0||C>i.getTime())&&(i=new Date(C)),typeof y.attempt=="number"&&Number.isFinite(y.attempt)&&(D=D===void 0?y.attempt:Math.max(D,y.attempt))}let E=t.files??[],M=ge(t,n);return{state:{status:t.status,priority:t.priority,dueDate:t.dueDate,overdue:Number.isFinite(g)&&Number.isFinite(l)&&g<l&&!fe(t.status),requiresReview:t.requireReview===!0,awaitingReview:b,hasFailureReason:s},execution:{subtasks:{total:m.length,completed:u.completed??0,byStatus:u},dependencies:{total:p.size,known:I,completed:P,unavailable:p.size-I},latestActivityAt:i,maxAttempt:D},output:{hasResult:t.result!==void 0,hasFailureReason:s,files:E.length,artifacts:E.filter(y=>y.addedBy==="agent").length,references:E.filter(y=>y.addedBy==="user").length,hasConversation:M!==void 0}}}function ge(e,t){let n=e.context?.thread_id;if(ze(n))return n;let m,c=Number.NEGATIVE_INFINITY;for(let h of t){if(!ze(h.threadId))continue;let g=Le(h.createdAt);g!==void 0&&g>c&&(m=h.threadId,c=g)}return m}function Le(e){if(!(e instanceof Date)&&typeof e!="string")return;let t=e instanceof Date?e.getTime():new Date(e).getTime();return Number.isFinite(t)?t:void 0}function ze(e){return typeof e=="string"&&e.trim().length>0}var a=N(S()),K={pending:{label:"Pending",color:"#7A7A7A"},in_progress:{label:"In Progress",color:"#3b82f6"},review:{label:"Review",color:"#f59e0b"},failed:{label:"Failed",color:"#ef4444"},interrupted:{label:"Interrupted",color:"#8b5cf6"},completed:{label:"Completed",color:"#22c55e"},cancelled:{label:"Cancelled",color:"#7A7A7A"}},Ge={high:{label:"High",color:"#ef4444"},medium:{label:"Medium",color:"#f59e0b"},low:{label:"Low",color:"#22c55e"}},ut={approved:(0,a.jsx)(J,{size:14,style:{color:"#22c55e"}}),rejected:(0,a.jsx)(Re,{size:14,style:{color:"#ef4444"}}),started:(0,a.jsx)(pe,{size:14,style:{color:"#3b82f6"}}),failed:(0,a.jsx)(Ce,{size:14,style:{color:"#ef4444"}}),completed:(0,a.jsx)(J,{size:14,style:{color:"#22c55e"}}),retried:(0,a.jsx)(pe,{size:14,style:{color:"#f59e0b"}}),cancelled:(0,a.jsx)(Ie,{size:14,style:{color:"#7A7A7A"}}),created:(0,a.jsx)($e,{size:14,style:{color:"#7A7A7A"}})};function he(e){return(e instanceof Date?e:new Date(e)).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function We(e){let t=e instanceof Date?e:new Date(e),n=Date.now()-t.getTime();return n<60*1e3?"just now":n<3600*1e3?`${Math.floor(n/(60*1e3))}m ago`:n<1440*60*1e3?`${Math.floor(n/(3600*1e3))}h ago`:n<10080*60*1e3?`${Math.floor(n/(1440*60*1e3))}d ago`:t.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})}function ft(e){if(e.name)return e.name;let t=e.uri.split("/").filter(Boolean);return t[t.length-1]||e.uri}var gt=B(({token:e,css:t})=>({main:t`
263
- flex: 1 1 380px;
264
- min-width: 0;
265
- display: flex;
266
- flex-direction: column;
267
- gap: 16px;
268
- `,rail:t`
269
- display: flex;
270
- flex-direction: column;
271
- `,sectionTitle:t`
272
- margin: 0 0 8px;
273
- font-size: 13px;
274
- font-weight: 600;
275
- color: ${e.colorTextSecondary};
276
- `,description:t`
277
- font-size: 14px;
278
- color: ${e.colorText};
279
- line-height: 1.7;
280
- `,resultCard:t`
281
- background: #f6ffed;
282
- border: 1px solid #b7eb8f;
283
- border-radius: 12px;
284
- padding: 16px;
285
- `,failureCard:t`
286
- background: #fff2f0;
287
- border: 1px solid #ffccc7;
288
- border-radius: 12px;
289
- padding: 16px;
290
- `,waitingCard:t`
291
- background: #fffbe6;
292
- border: 1px solid #ffe58f;
293
- border-radius: 12px;
294
- padding: 16px;
295
- display: flex;
296
- flex-direction: column;
297
- gap: 10px;
298
- `,propRow:t`
299
- display: flex;
300
- align-items: center;
301
- justify-content: space-between;
302
- gap: 8px;
303
- padding: 6px 0;
304
- font-size: 13px;
305
- `,propLabel:t`
306
- color: ${e.colorTextTertiary};
307
- flex-shrink: 0;
308
- `,propValue:t`
309
- color: ${e.colorText};
310
- display: flex;
311
- align-items: center;
312
- gap: 6px;
313
- min-width: 0;
314
- `,statusBadge:t`
315
- display: inline-flex;
316
- align-items: center;
317
- gap: 6px;
318
- font-weight: 600;
319
- `,quietButton:t`
320
- appearance: none;
321
- background: transparent;
322
- border: 0;
323
- color: inherit;
324
- font: inherit;
325
- margin: 0;
326
- padding: 0;
327
- text-align: inherit;
328
- cursor: pointer;
329
- &:active {
330
- background: ${e.colorFillSecondary};
331
- }
332
- &:focus-visible {
333
- outline: 2px solid ${e.colorPrimaryBorder};
334
- outline-offset: 2px;
335
- border-radius: 6px;
336
- }
337
- `,actionRow:t`
338
- width: 100%;
339
- &:hover {
340
- background: ${e.colorFillTertiary};
341
- }
342
- `,compactAction:t`
343
- min-height: 24px;
344
- padding: 2px 4px;
345
- @container task-detail-workbench (max-width: 639px) {
346
- min-height: 32px;
347
- }
348
- `,statusTrigger:t`
349
- border-radius: 6px;
350
- &:hover {
351
- background: ${e.colorFillTertiary};
352
- }
353
- `,statusDot:t`
354
- width: 8px;
355
- height: 8px;
356
- border-radius: 50%;
357
- flex-shrink: 0;
358
- `,checklistItem:t`
359
- display: flex;
360
- align-items: flex-start;
361
- gap: 8px;
362
- padding: 4px 0;
363
- font-size: 13px;
364
- line-height: 1.5;
365
- color: ${e.colorText};
366
- `,checklistDone:t`
367
- color: ${e.colorTextTertiary};
368
- `,subtaskRow:t`
369
- display: flex;
370
- align-items: center;
371
- gap: 8px;
372
- padding: 6px 8px;
373
- margin: 0 -8px;
374
- border-radius: 6px;
375
- font-size: 13px;
376
- color: ${e.colorText};
377
- transition: background 0.15s ease;
378
- `,subtaskStatus:t`
379
- flex-shrink: 0;
380
- font-size: 12px;
381
- white-space: nowrap;
382
- `,subtaskTitle:t`
383
- flex: 1;
384
- min-width: 0;
385
- overflow: hidden;
386
- text-overflow: ellipsis;
387
- white-space: nowrap;
388
- `,fileRow:t`
389
- display: flex;
390
- align-items: center;
391
- gap: 8px;
392
- padding: 4px 0;
393
- font-size: 13px;
394
- color: ${e.colorText};
395
- `,fileName:t`
396
- flex: 1;
397
- min-width: 0;
398
- overflow: hidden;
399
- text-overflow: ellipsis;
400
- white-space: nowrap;
401
- `,fileKind:t`
402
- flex-shrink: 0;
403
- font-size: 12px;
404
- color: ${e.colorTextTertiary};
405
- `,feedHeader:t`
406
- display: flex;
407
- align-items: center;
408
- gap: 6px;
409
- user-select: none;
410
- width: fit-content;
411
- min-height: 24px;
412
- padding: 2px 4px;
413
- &:hover {
414
- color: ${e.colorPrimary};
415
- }
416
- @container task-detail-workbench (max-width: 639px) {
417
- min-height: 32px;
418
- }
419
- `,feed:t`
420
- display: flex;
421
- flex-direction: column;
422
- gap: 10px;
423
- margin-top: 10px;
424
- `,feedItem:t`
425
- display: flex;
426
- gap: 8px;
427
- font-size: 13px;
428
- `,feedSummary:t`
429
- color: ${e.colorText};
430
- `,feedMeta:t`
431
- display: flex;
432
- gap: 8px;
433
- font-size: 12px;
434
- color: ${e.colorTextTertiary};
435
- `,threadLink:t`
436
- display: inline-flex;
437
- align-items: center;
438
- gap: 4px;
439
- color: ${e.colorInfo};
440
- min-height: 24px;
441
- padding: 2px 4px;
442
- &:hover {
443
- text-decoration: underline;
444
- }
445
- @container task-detail-workbench (max-width: 639px) {
446
- min-height: 32px;
447
- }
448
- `,spinner:t`
449
- display: flex;
450
- align-items: center;
451
- justify-content: center;
452
- padding: 48px 0;
453
- `})),Oe=({task:e,relatedTasks:t=[],onRelatedTaskClick:n,headingRef:m,workItems:c=[],loading:h=!1,activityError:g,actions:l,transitionPending:s=!1,subtaskProgress:x,subtasks:b,onSubtaskClick:u,parent:p,onParentClick:A,canGoBack:I=!1,onBack:P})=>{let{styles:i}=gt(),[D,E]=(0,k.useState)(!1),[M,y]=(0,k.useState)(!1),[C,xe]=(0,k.useState)(!1),be=(0,k.useId)(),ye=(0,k.useId)(),$=K[e.status]||K.pending,te=Ge[e.priority]||Ge.medium,j=e.context?.interruption,_=e.status==="interrupted"&&typeof j=="object"&&j!==null&&j.type==="review_required",ae=ge(e,c),G=l?.onViewChat,qe=(0,k.useMemo)(()=>_e({task:e,workItems:c,subtasks:b??[],relatedTasks:t}),[t,b,e,c]),U=_?j.evidenceId:void 0,ie=typeof U=="string"&&U.length>0,L=(0,k.useMemo)(()=>{let o=c.filter(d=>d.action==="completion_evidence");return ie?o.find(d=>d.id===U):[...o].sort((d,f)=>new Date(f.createdAt).getTime()-new Date(d.createdAt).getTime())[0]},[ie,U,c]),He=typeof L?.detail?.result=="string"&&L.detail.result.length>0,{checklistItems:ne,doneCount:Ke}=(0,k.useMemo)(()=>{if(!e.description)return{checklistItems:[],doneCount:0};let o=e.description.split(`
454
- `).filter(d=>/^\s*[-*]\s*\[[ x]\]/i.test(d)).map(d=>({text:d.replace(/^\s*[-*]\s*\[[ x]\]\s*/i,""),done:/^\s*[-*]\s*\[[x]\]/i.test(d)}));return o.sort((d,f)=>Number(d.done)-Number(f.done)),{checklistItems:o,doneCount:o.filter(d=>d.done).length}},[e.description]),ve=(0,k.useMemo)(()=>e.description?Fe(e.description).split(`
455
- `).filter(o=>!/^\s*[-*]\s*\[[ x]\]/i.test(o)).join(`
456
- `).trim():"",[e.description]),je=typeof e.description=="string"&&e.description.trim().length>0,Ue=e.files?.filter(o=>o.addedBy==="agent")??[],Ye=e.files?.filter(o=>o.addedBy==="user")??[],Xe=e.files?.filter(o=>o.addedBy===void 0)??[],oe=(0,k.useMemo)(()=>c.length>0?[...c].sort((o,d)=>new Date(o.createdAt).getTime()-new Date(d.createdAt).getTime()):[{id:"created",action:"created",actor:e.ownerId,summary:"Task created",createdAt:e.createdAt},{id:"status",action:e.status,actor:e.ownerId,summary:`Status: ${$.label}`,createdAt:e.updatedAt}],[c,e,$.label]),W=(0,k.useMemo)(()=>{let o=new Set,d=new Set;for(let f of oe){if(f.action==="completion_evidence")continue;let R=f.detail?.eventKey??f.eventKey;typeof R=="string"&&R.length>0&&o.add(R);let F=f.detail?.evidenceId;typeof F=="string"&&F.length>0&&d.add(F)}return oe.filter(f=>{if(f.action!=="completion_evidence")return!0;if(_&&f.id===L?.id)return!1;let R=f.detail?.eventKey??f.eventKey;return d.has(f.id)?!1:typeof R!="string"||!o.has(R)})},[oe,_,L?.id]),Je=g?0:W.length,Qe=M?W:W.slice(-3),Ze=D?b:b?.slice(0,5),re=(0,k.useMemo)(()=>b&&b.length>0?{done:b.filter(o=>o.status==="completed").length,total:b.length}:x,[b,x]),Y=(0,k.useMemo)(()=>{if(!l||e.ownerType==="agent")return[];let o=[];return e.status==="failed"&&(l.onRetry&&o.push({key:"retry",label:"Retry",onClick:l.onRetry}),l.onCancel&&o.push({key:"cancel",label:"Cancel task",danger:!0,onClick:l.onCancel})),o},[l,e.ownerType,e.status]);(0,k.useEffect)(()=>{xe(!1)},[e.id,e.status,s]),(0,k.useEffect)(()=>{E(!1),y(!1)},[e.id]);let ke=Y.length>0?(0,a.jsxs)("button",{type:"button",className:`${i.statusBadge} ${i.quietButton} ${i.compactAction} ${i.statusTrigger}`,style:{color:$.color},"data-testid":"status-badge","aria-label":`Change status, current status ${$.label}`,"aria-haspopup":"menu","aria-expanded":C,children:[(0,a.jsx)("span",{className:i.statusDot,style:{background:$.color}}),$.label,(0,a.jsx)(ce,{size:12})]}):(0,a.jsxs)("span",{className:i.statusBadge,style:{color:$.color},"data-testid":"status-badge",children:[(0,a.jsx)("span",{className:i.statusDot,style:{background:$.color}}),$.label]}),et=(0,a.jsxs)(a.Fragment,{children:[ve?(0,a.jsx)("div",{className:i.description,children:(0,a.jsx)(z,{content:ve})}):je?null:(0,a.jsx)("div",{className:i.feedMeta,children:"No task description"}),ne.length>0&&(0,a.jsxs)("div",{style:{marginTop:16},children:[(0,a.jsxs)("div",{className:i.sectionTitle,children:["Acceptance \u2713 ",Ke,"/",ne.length]}),ne.map((o,d)=>(0,a.jsxs)("div",{"data-testid":"checklist-item",className:`${i.checklistItem} ${o.done?i.checklistDone:""}`,children:[o.done?(0,a.jsx)(J,{size:14,style:{color:"#22c55e",flexShrink:0,marginTop:2}}):(0,a.jsx)("div",{style:{width:14,height:14,border:"2px solid #d9d9d9",borderRadius:3,flexShrink:0,marginTop:2}}),(0,a.jsx)("span",{children:o.text})]},d))]}),(0,a.jsx)(Pe,{description:e.description})]}),tt=(0,a.jsxs)("div",{className:i.main,children:[_&&(0,a.jsxs)("div",{className:i.waitingCard,"data-testid":"approval-waiting",children:[(0,a.jsx)("div",{className:i.sectionTitle,style:{color:"#b45309",margin:0},children:"Waiting for approval"}),L&&(0,a.jsx)(me,{item:L}),!L&&ie&&(0,a.jsx)("div",{className:i.feedMeta,children:h?"Approval evidence is loading...":"Approval evidence is unavailable."}),e.result!==void 0&&!He&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:i.sectionTitle,children:"Result"}),(0,a.jsx)("div",{className:i.description,children:e.result.length>0?(0,a.jsx)(z,{content:e.result}):"No text provided"})]}),!ae||!G?(0,a.jsx)("div",{className:i.feedMeta,children:"The agent conversation is unavailable because no thread is associated with this task."}):null]}),e.result!==void 0&&!_?(0,a.jsxs)("div",{className:i.resultCard,children:[(0,a.jsx)("h4",{className:i.sectionTitle,children:"Result"}),(0,a.jsx)("div",{className:i.description,children:e.result.length>0?(0,a.jsx)(z,{content:e.result}):"No text provided"})]}):_?null:(0,a.jsx)("div",{className:i.feedMeta,children:"No result recorded"}),e.failureReason!==void 0&&(0,a.jsxs)("div",{className:i.failureCard,children:[(0,a.jsx)("h4",{className:i.sectionTitle,style:{color:"#ef4444"},children:"Failure Reason"}),(0,a.jsx)("div",{className:i.description,children:e.failureReason.length>0?(0,a.jsx)(z,{content:e.failureReason}):"No text provided"})]}),e.failureReason===void 0&&(0,a.jsx)("div",{className:i.feedMeta,children:"No failure reason recorded"}),e.files&&e.files.length>0?(0,a.jsx)("div",{"data-testid":"files-section",children:[["Artifacts",Ue],["References",Ye],["Other files",Xe]].map(([o,d])=>d.length>0&&(0,a.jsxs)("div",{style:{marginTop:8},children:[(0,a.jsx)("h4",{className:i.sectionTitle,children:o}),d.map((f,R)=>{let F=ft(f),O=/^https?:\/\//.test(f.uri);return(0,a.jsxs)("div",{"data-testid":"file-row",className:i.fileRow,children:[(0,a.jsx)(Se,{size:13,style:{flexShrink:0,color:"#7A7A7A"}}),O?(0,a.jsx)("a",{href:f.uri,target:"_blank",rel:"noreferrer",className:i.fileName,children:F}):(0,a.jsx)("span",{className:i.fileName,title:f.uri,children:F})]},`${f.uri}-${R}`)})]},o))}):(0,a.jsx)("div",{className:i.feedMeta,children:"No files attached"}),!ae&&!_&&(0,a.jsx)("div",{className:i.feedMeta,children:"No conversation associated"})]}),at=(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:i.sectionTitle,children:["Activity (",Je,")"]}),(0,a.jsx)("div",{id:be,children:h?(0,a.jsx)("div",{className:i.spinner,"data-testid":"feed-loading",children:(0,a.jsx)(le,{size:"small"})}):g?(0,a.jsx)("div",{role:"alert",className:i.feedMeta,children:g}):W.length===0?(0,a.jsx)(se,{description:"No activity yet",image:se.PRESENTED_IMAGE_SIMPLE}):(0,a.jsx)("div",{className:i.feed,"data-testid":"activity-feed",children:Qe.map(o=>{let d=o.action==="activity"&&typeof o.detail?.markdown=="string",f=o.action==="completion_evidence",R=typeof o.detail?.result=="string"||Array.isArray(o.detail?.beliefImpact),F=d||f||R,O=o.threadId,st=O&&G?()=>G(O):void 0;return(0,a.jsxs)("div",{className:i.feedItem,"data-testid":o.action==="update_agent"?"feed-item-update_agent":"activity-item",style:o.action==="update_agent"?{borderLeft:"2px solid #6366f1",paddingLeft:8}:void 0,children:[(0,a.jsx)("span",{style:{flexShrink:0,marginTop:2},children:ut[o.action]||(0,a.jsx)(De,{size:14,style:{color:"#7A7A7A"}})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:i.feedSummary,children:f?"Completion evidence recorded":o.summary||o.action}),F&&(0,a.jsx)(me,{item:o,viewChat:st}),(0,a.jsxs)("div",{className:i.feedMeta,children:[(0,a.jsx)("span",{children:o.actor}),(0,a.jsx)("span",{title:he(o.createdAt),children:We(o.createdAt)}),o.attempt!==void 0&&o.attempt>1&&(0,a.jsxs)("span",{children:["Attempt #",o.attempt]}),O&&G&&!F&&(0,a.jsxs)("button",{type:"button",className:`${i.threadLink} ${i.quietButton}`,onClick:()=>G(O),children:[(0,a.jsx)(V,{size:12}),"View Chat"]})]})]})]},o.id)})})}),!h&&!g&&W.length>3&&(0,a.jsxs)("button",{type:"button",className:`${i.feedHeader} ${i.quietButton}`,onClick:()=>y(o=>!o),"aria-expanded":M,"aria-controls":be,children:[M?(0,a.jsx)(ce,{size:14}):null,M?"Show fewer activity items":`View all ${W.length} activity items`]})]}),it=s?(0,a.jsxs)("span",{className:i.statusBadge,style:{color:$.color},"data-testid":"status-pending",role:"status","aria-live":"polite","aria-label":`Updating task status; current status ${$.label}`,children:[(0,a.jsx)(le,{size:"small"}),"Updating \xB7 ",$.label]}):Y.length>0?(0,a.jsx)(we,{menu:{items:Y.map(({key:o,label:d,danger:f})=>({key:o,label:d,danger:f})),onClick:({key:o})=>Y.find(d=>d.key===o)?.onClick()},trigger:["click"],open:C,onOpenChange:xe,children:ke}):ke,nt=(0,a.jsxs)("span",{className:i.propValue,"data-testid":"priority-row",children:[(0,a.jsx)("span",{className:i.statusDot,style:{background:te.color}}),(0,a.jsx)("span",{style:{color:te.color,fontWeight:600},children:te.label})]}),ot=(0,a.jsxs)("div",{className:i.rail,"data-testid":"rail",children:[(0,a.jsxs)("div",{className:i.propRow,children:[(0,a.jsx)("span",{className:i.propLabel,children:"Created"}),(0,a.jsxs)("span",{className:i.propValue,children:[(0,a.jsx)(Ae,{size:13}),(0,a.jsx)("span",{title:he(e.createdAt),children:We(e.createdAt)})]})]}),e.dueDate&&(0,a.jsxs)("div",{className:i.propRow,children:[(0,a.jsx)("span",{className:i.propLabel,children:"Due"}),(0,a.jsx)("span",{className:i.propValue,children:he(e.dueDate)})]}),e.dependencies&&e.dependencies.length>0?[...new Set(e.dependencies)].map(o=>{let d=t.find(R=>R.id===o),f=d?K[d.status]?.label??d.status:void 0;return(0,a.jsxs)("div",{className:i.propRow,children:[(0,a.jsx)("span",{className:i.propLabel,children:"Dependency"}),d&&n?(0,a.jsxs)("button",{type:"button",className:`${i.propValue} ${i.quietButton} ${i.compactAction}`,"aria-label":`Dependency: ${d.title}, status ${f}`,onClick:()=>n(d),children:[d.title," \xB7 ",f]}):(0,a.jsx)("span",{className:i.propValue,children:d?`${d.title} \xB7 ${f}`:"Dependency unavailable"})]},o)}):(0,a.jsx)("div",{className:i.feedMeta,children:"No dependencies"})]}),rt=b&&b.length>0?(0,a.jsxs)("div",{"data-testid":"subtasks-section",children:[re&&(0,a.jsxs)("div",{className:i.sectionTitle,children:[re.done,"/",re.total," completed"]}),(0,a.jsx)("div",{id:ye,children:Ze?.map(o=>{let d=K[o.status]||K.pending,f=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:i.statusDot,style:{background:d.color}}),(0,a.jsx)("span",{className:i.subtaskTitle,children:o.title}),(0,a.jsx)("span",{className:i.subtaskStatus,style:{color:d.color},children:d.label})]});return u?(0,a.jsx)("button",{type:"button","data-testid":"subtask-row",className:`${i.subtaskRow} ${i.quietButton} ${i.actionRow}`,title:`${d.label} \xB7 ${o.title}`,"aria-label":`${o.title}, status ${d.label}`,onClick:()=>u(o),children:f},o.id):(0,a.jsx)("div",{"data-testid":"subtask-row",className:i.subtaskRow,title:`${d.label} \xB7 ${o.title}`,children:f},o.id)})}),b.length>5&&(0,a.jsx)("button",{type:"button",className:`${i.feedHeader} ${i.quietButton}`,onClick:()=>E(o=>!o),"aria-expanded":D,"aria-controls":ye,children:D?"Show fewer subtasks":`View all ${b.length} subtasks`})]}):x&&x.total>0?(0,a.jsxs)("div",{children:[x.done,"/",x.total," completed"]}):(0,a.jsx)("div",{className:i.feedMeta,children:"No subtasks"});return(0,a.jsx)(Me,{task:e,facts:qe,parent:p,canGoBack:I,onBack:P,onParentClick:A,headingRef:m,statusControl:it,priorityControl:nt,regions:{taskContent:et,context:ot,output:tt,subtasks:rt,activity:at},threadId:ae,onViewChat:G})};var Z=N(S()),xt=B(({css:e})=>({container:e`
457
- display: flex;
458
- flex-direction: column;
459
- height: 100%;
460
- overflow: hidden;
461
- `,body:e`
462
- flex: 1 1 auto;
463
- min-height: 0;
464
- overflow-y: auto;
465
- padding: clamp(12px, 3cqi, 16px) clamp(16px, 4cqi, ${24}px);
466
- `})),Jt=({task:e,relatedTasks:t,onRelatedTaskClick:n,workItems:m,loading:c,activityError:h,transitionPending:g=!1,onApprove:l,onReject:s,onRetry:x,onCancel:b,onViewChat:u,onBack:p,canGoBack:A=!0,maxHeight:I,focusKey:P,subtasks:i,onSubtaskClick:D,parent:E,onParentClick:M})=>{let{styles:y}=xt(),C=(0,ee.useRef)(null);return(0,ee.useEffect)(()=>{P!==void 0&&C.current?.focus()},[P]),(0,Z.jsx)("div",{className:y.container,"data-testid":"task-detail-panel",style:I===void 0?void 0:{maxHeight:I},children:(0,Z.jsx)("div",{className:y.body,children:(0,Z.jsx)(Oe,{task:e,relatedTasks:t,onRelatedTaskClick:n,headingRef:P===void 0?void 0:C,workItems:m,loading:c,activityError:h,transitionPending:g,actions:{onApprove:l,onReject:s,onRetry:x,onCancel:b,onViewChat:u},subtasks:i,onSubtaskClick:D,parent:E,onParentClick:M,canGoBack:A,onBack:p})})})};var Ve=N(X());function bt(e,t){let n=e.ownerType==="agent"?e.ownerId:"general-purpose";return{component_key:"task",message:e.title||"Task",data:{thread_id:t,description:e.description||"",subagent_type:n}}}var ea=e=>{let{openSideApp:t}=Be();return(0,Ve.useCallback)(n=>{if(e)try{t(bt(e,n))}catch{console.warn("Cannot open task chat: ChatUIContextProvider is not mounted")}},[t,e])};export{fe as a,Ft as b,Jt as c,ea as d};
@@ -1 +0,0 @@
1
- import{Pa as n}from"./embed-page-chunk-BRETUPSG.js";import{l as i,m as p,q as s}from"./embed-page-chunk-T25T2YE6.js";import{a as d}from"./embed-page-chunk-MB65DZAX.js";import{e as a}from"./embed-page-chunk-6Y3UYJ6Z.js";var e=a(d()),P=({defaultWorkspaceId:t,defaultProjectId:o,children:r})=>{let c=p("__GLOBAL__");return(0,e.jsx)(n,{workspaceId:t,projectId:o,client:c,children:r})},f=({children:t,defaultProjectId:o,defaultWorkspaceId:r})=>{let{config:{baseURL:c}}=s();return(0,e.jsx)(i,{config:{baseURL:c,apiKey:"",assistantId:"__GLOBAL__",transport:"sse"},children:(0,e.jsx)(P,{defaultWorkspaceId:r,defaultProjectId:o,children:t})})},I=f;export{f as a,I as b};
@@ -1,30 +0,0 @@
1
- import {
2
- connectMcpServer,
3
- convertToConnection,
4
- createMcpServerConfig,
5
- deleteMcpServerConfig,
6
- disconnectMcpServer,
7
- getMcpServerConfig,
8
- getMcpServerConfigList,
9
- listMcpServerTools,
10
- registerMcpServerConfigRoutes,
11
- testMcpServerConnection,
12
- testMcpServerTools,
13
- updateMcpServerConfig
14
- } from "./chunk-QKPZWWHH.mjs";
15
- import "./chunk-NFEGQTCC.mjs";
16
- export {
17
- connectMcpServer,
18
- convertToConnection,
19
- createMcpServerConfig,
20
- deleteMcpServerConfig,
21
- disconnectMcpServer,
22
- getMcpServerConfig,
23
- getMcpServerConfigList,
24
- listMcpServerTools,
25
- registerMcpServerConfigRoutes,
26
- testMcpServerConnection,
27
- testMcpServerTools,
28
- updateMcpServerConfig
29
- };
30
- //# sourceMappingURL=mcp-configs-WCY5EXCW.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/open.ts","../src/services/open/openRateLimiter.ts","../src/services/open/openMcpServer.ts"],"sourcesContent":["/**\n * Open API surface routes: POST/DELETE /open/mcp.\n *\n * The route is a thin shell — credential resolution (OpenAuthService),\n * catalog filtering and invocation (OpenLattice), and session lifecycle\n * (mcpTransportRegistry) live in services/open/*. The transport writes the\n * response itself, so the reply is hijacked (same precedent as the Project\n * Room SSE route).\n */\n\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from \"fastify\";\nimport { isInitializeRequest } from \"@modelcontextprotocol/sdk/types.js\";\nimport { getStoreLattice } from \"@axiom-lattice/core\";\nimport type { A2AApiKeyStore, OpenAuditStore, OpenGrant, ProjectStore } from \"@axiom-lattice/protocols\";\nimport { OpenCredentialService } from \"../services/open/openCredentialService\";\nimport { OpenAuditService } from \"../services/open/openAuditService\";\nimport { OpenRateLimiter } from \"../services/open/openRateLimiter\";\nimport type { OpenCredential } from \"../services/open/openCredentialService\";\nimport {\n openLattice,\n ActionNotFoundError,\n GrantDeniedError,\n ValidationError,\n} from \"../services/open/openLattice\";\nimport { buildSessionServer } from \"../services/open/openMcpServer\";\nimport { getSession, deleteSession } from \"../services/open/mcpTransportRegistry\";\n\nexport interface OpenRouteDeps {\n openAuth?: OpenCredentialService;\n grantsSource?: (ctx: OpenCredential) => OpenGrant[];\n audit?: OpenAuditService;\n rateLimiter?: OpenRateLimiter;\n}\n\nfunction extractBearer(request: FastifyRequest): string | undefined {\n const header = request.headers.authorization;\n if (!header?.startsWith(\"Bearer \")) return undefined;\n return header.slice(\"Bearer \".length).trim() || undefined;\n}\n\nfunction readSessionId(request: FastifyRequest): string | undefined {\n const raw = request.headers[\"mcp-session-id\"];\n const value = Array.isArray(raw) ? raw[0] : raw;\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n\n/** JSON-RPC error codes used on the Open surface. */\nconst RPC_ERROR = {\n GRANT_DENIED: -32001,\n ACTION_NOT_FOUND: -32002,\n VALIDATION_FAILED: -32003,\n EXECUTION_ERROR: -32004,\n RATE_LIMITED: -32005,\n} as const;\n\nexport function registerOpenRoutes(\n app: FastifyInstance,\n deps: OpenRouteDeps = {},\n): void {\n const openAuth =\n deps.openAuth ??\n new OpenCredentialService(\n getStoreLattice(\"default\", \"a2aApiKey\").store as A2AApiKeyStore,\n getStoreLattice(\"default\", \"project\").store as ProjectStore,\n );\n const grantsSource =\n deps.grantsSource ?? ((ctx: OpenCredential) => ctx.grants);\n const audit =\n deps.audit ??\n (() => {\n try {\n const store = getStoreLattice(\"default\", \"openAudit\").store as OpenAuditStore;\n return new OpenAuditService(store);\n } catch {\n return undefined;\n }\n })();\n\n const rateLimiter = deps.rateLimiter ?? new OpenRateLimiter();\n\n app.post(\"/open/mcp\", async (request: FastifyRequest, reply: FastifyReply) => {\n const context = await openAuth.resolve(extractBearer(request));\n if (!context) {\n return reply.status(401).send({ error: \"AUTH_FAILED\" });\n }\n\n const body: unknown = request.body;\n const sessionId = readSessionId(request);\n\n // Existing session: reuse its server/transport. Bearer must match the\n // session's credential — a session is not usable by another key.\n if (sessionId) {\n const session = await getSession(sessionId);\n if (\n !session ||\n session.credential.credentialId !== context.credentialId\n ) {\n return reply.status(404).send({ error: \"SESSION_NOT_FOUND\" });\n }\n reply.hijack();\n await session.transport.handleRequest(request.raw, reply.raw, body);\n return;\n }\n\n // New session: only initialize may create one. Registration into the\n // session registry happens inside sessionIdGenerator (see openMcpServer).\n if (!isInitializeRequest(body)) {\n return reply.status(400).send({ error: \"SESSION_REQUIRED\" });\n }\n\n const grants = grantsSource(context);\n const catalog = await openLattice.catalogFor(grants, { tenantId: context.tenantId });\n const built = await buildSessionServer({\n credential: { credentialId: context.credentialId, kind: context.kind },\n grants,\n catalog,\n invoke: async (toolName, args) => {\n const startedAt = Date.now();\n const sep = toolName.indexOf(\"_\");\n const auditDomain = sep > 0 ? toolName.slice(0, sep) : toolName;\n const auditAction = sep > 0 ? toolName.slice(sep + 1) : \"\";\n\n const decision = rateLimiter.check(context.credentialId, auditDomain);\n if (!decision.allowed) {\n await audit?.record({\n tenantId: context.tenantId,\n credentialId: context.credentialId,\n credentialKind: context.kind,\n projectId: context.projectId,\n domain: auditDomain,\n action: auditAction,\n args,\n status: \"error\",\n errorCode: \"RATE_LIMITED\",\n durationMs: Date.now() - startedAt,\n });\n throw Object.assign(\n new Error(\n `RATE_LIMITED: retry after ${decision.retryAfterMs ?? 1000}ms`,\n ),\n { rpcCode: RPC_ERROR.RATE_LIMITED },\n );\n }\n\n try {\n const result = await openLattice.invoke(\n grants,\n {\n tenantId: context.tenantId,\n projectId: context.projectId,\n workspaceId: context.workspaceId,\n runConfig: {\n sandboxName: context.sandboxName,\n credentialId: context.credentialId,\n },\n },\n toolName,\n args,\n );\n await audit?.record({\n tenantId: context.tenantId,\n credentialId: context.credentialId,\n credentialKind: context.kind,\n projectId: context.projectId,\n domain: auditDomain,\n action: auditAction,\n args,\n status: \"ok\",\n durationMs: Date.now() - startedAt,\n });\n return result;\n } catch (err) {\n const code =\n err instanceof GrantDeniedError\n ? RPC_ERROR.GRANT_DENIED\n : err instanceof ActionNotFoundError\n ? RPC_ERROR.ACTION_NOT_FOUND\n : err instanceof ValidationError\n ? RPC_ERROR.VALIDATION_FAILED\n : RPC_ERROR.EXECUTION_ERROR;\n await audit?.record({\n tenantId: context.tenantId,\n credentialId: context.credentialId,\n credentialKind: context.kind,\n projectId: context.projectId,\n domain: auditDomain,\n action: auditAction,\n args,\n status: \"error\",\n errorCode:\n err instanceof GrantDeniedError\n ? \"GRANT_DENIED\"\n : err instanceof ActionNotFoundError\n ? \"ACTION_NOT_FOUND\"\n : err instanceof ValidationError\n ? \"VALIDATION_FAILED\"\n : \"EXECUTION_ERROR\",\n durationMs: Date.now() - startedAt,\n });\n throw Object.assign(\n new Error(err instanceof Error ? err.message : String(err)),\n { rpcCode: code },\n );\n }\n },\n });\n reply.hijack();\n await built.transport.handleRequest(request.raw, reply.raw, body);\n });\n\n app.delete(\n \"/open/mcp\",\n async (request: FastifyRequest, reply: FastifyReply) => {\n const sessionId = readSessionId(request);\n if (!sessionId) {\n return reply.status(400).send({ error: \"SESSION_REQUIRED\" });\n }\n await deleteSession(sessionId);\n return reply.status(204).send();\n },\n );\n}\n","/**\n * In-memory per-credential rate limiter (token bucket). The agent domain gets\n * a stricter bucket because each call consumes LLM budget.\n *\n * Process-local by design (V1 single-gateway); a distributed limiter is V2.\n */\n\nexport interface RateLimitDecision {\n allowed: boolean;\n retryAfterMs?: number;\n}\n\ninterface Bucket {\n tokens: number;\n updatedAt: number;\n}\n\nexport interface OpenRateLimiterOptions {\n /** Default requests per minute per credential. */\n defaultPerMinute?: number;\n /** Stricter limit for the agent domain. */\n agentPerMinute?: number;\n}\n\nexport class OpenRateLimiter {\n private readonly buckets = new Map<string, Bucket>();\n private readonly defaultPerMinute: number;\n private readonly agentPerMinute: number;\n\n constructor(options: OpenRateLimiterOptions = {}) {\n this.defaultPerMinute = options.defaultPerMinute ?? 60;\n this.agentPerMinute = options.agentPerMinute ?? 10;\n }\n\n private bucketClass(domain: string): string {\n return domain === \"agent\" ? \"agent\" : \"default\";\n }\n\n private limitFor(domain: string): number {\n return domain === \"agent\" ? this.agentPerMinute : this.defaultPerMinute;\n }\n\n /** Consume one token; denied calls report how long to wait. */\n check(credentialId: string, domain: string): RateLimitDecision {\n const limit = this.limitFor(domain);\n const key = `${this.bucketClass(domain)}:${credentialId}`;\n const now = Date.now();\n const bucket = this.buckets.get(key) ?? { tokens: limit, updatedAt: now };\n\n const refillPerMs = limit / 60_000;\n const elapsed = now - bucket.updatedAt;\n bucket.tokens = Math.min(limit, bucket.tokens + elapsed * refillPerMs);\n bucket.updatedAt = now;\n\n if (bucket.tokens >= 1) {\n bucket.tokens -= 1;\n this.buckets.set(key, bucket);\n return { allowed: true };\n }\n\n this.buckets.set(key, bucket);\n const deficit = 1 - bucket.tokens;\n return { allowed: false, retryAfterMs: Math.ceil(deficit / refillPerMs) };\n }\n\n /** Test helper. */\n reset(): void {\n this.buckets.clear();\n }\n}\n","/**\n * Builds a per-session MCP server instance whose tool list is the\n * credential-filtered OpenLattice catalog. Per-session instances are what\n * make grant-filtered tools/list possible on the official SDK.\n *\n * Session registration happens inside sessionIdGenerator — the SDK invokes\n * it exactly once while handling initialize, which guarantees the registry\n * key equals the transport-generated id that the response header carries.\n *\n * Every tool executor routes through the OpenLattice invoke kernel, so\n * authorization is re-checked on each invocation (default-deny, live grants).\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/streamableHttp.js\";\nimport { randomUUID } from \"crypto\";\nimport type { OpenGrant } from \"@axiom-lattice/protocols\";\nimport type { OpenToolDescriptor } from \"./openLattice\";\nimport { registerSession } from \"./mcpTransportRegistry\";\n\nexport const OPEN_MCP_SERVER_INFO = {\n name: \"axiom-open\",\n version: \"0.1.0\",\n} as const;\n\nexport interface BuiltSession {\n server: McpServer;\n transport: StreamableHTTPServerTransport;\n tools: OpenToolDescriptor[];\n}\n\nexport async function buildSessionServer(options: {\n credential: { credentialId: string; kind: string };\n grants: OpenGrant[];\n catalog: OpenToolDescriptor[];\n invoke: (\n toolName: string,\n args: unknown,\n ) => Promise<{\n content: Array<{ type: \"text\"; text: string }>;\n isError?: boolean;\n }>;\n}): Promise<BuiltSession> {\n const { credential, grants, catalog, invoke } = options;\n const server = new McpServer(OPEN_MCP_SERVER_INFO);\n for (const tool of catalog) {\n server.registerTool(\n tool.toolName,\n {\n description: tool.description,\n inputSchema: tool.schema,\n annotations: {\n readOnlyHint: tool.annotations.readOnlyHint,\n destructiveHint: tool.annotations.destructiveHint,\n },\n },\n async (args: unknown) => {\n const result = await invoke(tool.toolName, args);\n return { content: result.content, isError: result.isError };\n },\n );\n }\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => {\n const sessionId = randomUUID();\n void registerSession(\n sessionId,\n { credentialId: credential.credentialId, kind: credential.kind },\n { server, transport },\n );\n return sessionId;\n },\n enableJsonResponse: true,\n onsessionclosed: (closedId: string) => {\n void import(\"./mcpTransportRegistry\").then(({ deleteSession }) =>\n deleteSession(closedId),\n );\n },\n });\n // Required: without connect the transport has no onmessage handler, the\n // initialize request is swallowed and handleRequest never resolves (hang).\n await server.connect(transport);\n return { server, transport, tools: catalog };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;;;ACYzB,IAAM,kBAAN,MAAsB;AAAA,EAK3B,YAAY,UAAkC,CAAC,GAAG;AAJlD,SAAiB,UAAU,oBAAI,IAAoB;AAKjD,SAAK,mBAAmB,QAAQ,oBAAoB;AACpD,SAAK,iBAAiB,QAAQ,kBAAkB;AAAA,EAClD;AAAA,EAEQ,YAAY,QAAwB;AAC1C,WAAO,WAAW,UAAU,UAAU;AAAA,EACxC;AAAA,EAEQ,SAAS,QAAwB;AACvC,WAAO,WAAW,UAAU,KAAK,iBAAiB,KAAK;AAAA,EACzD;AAAA;AAAA,EAGA,MAAM,cAAsB,QAAmC;AAC7D,UAAM,QAAQ,KAAK,SAAS,MAAM;AAClC,UAAM,MAAM,GAAG,KAAK,YAAY,MAAM,CAAC,IAAI,YAAY;AACvD,UAAM,MAAM,KAAK,IAAI;AACrB,UAAM,SAAS,KAAK,QAAQ,IAAI,GAAG,KAAK,EAAE,QAAQ,OAAO,WAAW,IAAI;AAExE,UAAM,cAAc,QAAQ;AAC5B,UAAM,UAAU,MAAM,OAAO;AAC7B,WAAO,SAAS,KAAK,IAAI,OAAO,OAAO,SAAS,UAAU,WAAW;AACrE,WAAO,YAAY;AAEnB,QAAI,OAAO,UAAU,G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AC3B,CAAC;AACD,gBAAM,OAAO;AAAA,YACX,IAAI,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,YAC1D,EAAE,SAAS,KAAK;AAAA,UAClB;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AACD,UAAM,OAAO;AACb,UAAM,MAAM,UAAU,cAAc,QAAQ,KAAK,MAAM,KAAK,IAAI;AAAA,EAClE,CAAC;AAED,MAAI;AAAA,IACF;AAAA,IACA,OAAO,SAAyB,UAAwB;AACtD,YAAM,YAAY,cAAc,OAAO;AACvC,UAAI,CAAC,WAAW;AACd,eAAO,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,OAAO,mBAAmB,CAAC;AAAA,MAC7D;AACA,YAAM,cAAc,SAAS;AAC7B,aAAO,MAAM,OAAO,GAAG,EAAE,KAAK;AAAA,IAChC;AAAA,EACF;AACF;","names":["deleteSession"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/open-catalog.ts","../src/services/open/openCatalogService.ts"],"sourcesContent":["/**\n * Open capability catalog endpoint (console-session guarded): returns the\n * grantable capabilities for the caller's tenant, driving the key picker.\n */\n\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from \"fastify\";\nimport { getStoreLattice } from \"@axiom-lattice/core\";\nimport type { AssistantStore } from \"@axiom-lattice/protocols\";\nimport { OpenCatalogService } from \"../services/open/openCatalogService\";\n\ninterface RequestWithUser extends FastifyRequest {\n user?: { id: string; tenantId?: string };\n}\n\nfunction tenantIdOf(request: FastifyRequest): string | undefined {\n return (request as RequestWithUser).user?.tenantId;\n}\n\nexport function registerOpenCatalogRoutes(app: FastifyInstance): void {\n app.get(\"/api/open/catalog\", async (request: FastifyRequest, reply: FastifyReply) => {\n const tenantId = tenantIdOf(request);\n if (!tenantId) {\n return reply.status(401).send({ success: false, error: \"Unauthorized\" });\n }\n const assistantStore = getStoreLattice(\"default\", \"assistant\")\n .store as AssistantStore;\n const service = new OpenCatalogService(assistantStore);\n const catalog = await service.buildForTenant(tenantId);\n return reply.status(200).send({ success: true, data: catalog });\n });\n}\n","/**\n * OpenCatalogService — assembles the tenant-scoped grantable capability\n * catalog for the key-management picker: registry domains (built-in + plugin)\n * plus per-tenant agent instances.\n */\n\nimport type {\n AssistantStore,\n OpenCatalog,\n OpenCatalogDomain,\n} from \"@axiom-lattice/protocols\";\nimport { OpenLattice, openLattice } from \"./openLattice\";\n\nexport class OpenCatalogService {\n constructor(\n private readonly assistantStore: AssistantStore,\n private readonly lattice: OpenLattice = openLattice,\n ) {}\n\n async buildForTenant(tenantId: string): Promise<OpenCatalog> {\n const domains = this.lattice.describeCatalog();\n const enriched: OpenCatalogDomain[] = [];\n for (const domain of domains) {\n if (domain.domain === \"agent\" && domain.itemKind === \"instance\") {\n let items: OpenCatalogDomain[\"items\"] = [];\n try {\n const assistants = await this.assistantStore.getAllAssistants(tenantId);\n items = assistants.map((a) => ({\n id: a.id,\n toolName: `invoke_${a.id}`,\n label: a.name || a.id,\n }));\n } catch {\n items = [];\n }\n enriched.push({ ...domain, items });\n } else {\n enriched.push(domain);\n }\n }\n return { domains: enriched };\n }\n}\n"],"mappings":";;;;;;AAMA,SAAS,uBAAuB;;;ACOzB,IAAM,qBAAN,MAAyB;AAAA,EAC9B,YACmB,gBACA,UAAuB,aACxC;AAFiB;AACA;AAAA,EAChB;AAAA,EAEH,MAAM,eAAe,UAAwC;AAC3D,UAAM,UAAU,KAAK,QAAQ,gBAAgB;AAC7C,UAAM,WAAgC,CAAC;AACvC,eAAW,UAAU,SAAS;AAC5B,UAAI,OAAO,WAAW,WAAW,OAAO,aAAa,YAAY;AAC/D,YAAI,QAAoC,CAAC;AACzC,YAAI;AACF,gBAAM,aAAa,MAAM,KAAK,eAAe,iBAAiB,QAAQ;AACtE,kBAAQ,WAAW,IAAI,CAAC,OAAO;AAAA,YAC7B,IAAI,EAAE;AAAA,YACN,UAAU,UAAU,EAAE,EAAE;AAAA,YACxB,OAAO,EAAE,QAAQ,EAAE;AAAA,UACrB,EAAE;AAAA,QACJ,QAAQ;AACN,kBAAQ,CAAC;AAAA,QACX;AACA,iBAAS,KAAK,EAAE,GAAG,QAAQ,MAAM,CAAC;AAAA,MACpC,OAAO;AACL,iBAAS,KAAK,MAAM;AAAA,MACtB;AAAA,IACF;AACA,WAAO,EAAE,SAAS,SAAS;AAAA,EAC7B;AACF;;;AD5BA,SAAS,WAAW,SAA6C;AAC/D,SAAQ,QAA4B,MAAM;AAC5C;AAEO,SAAS,0BAA0B,KAA4B;AACpE,MAAI,IAAI,qBAAqB,OAAO,SAAyB,UAAwB;AACnF,UAAM,WAAW,WAAW,OAAO;AACnC,QAAI,CAAC,UAAU;AACb,aAAO,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,SAAS,OAAO,OAAO,eAAe,CAAC;AAAA,IACzE;AACA,UAAM,iBAAiB,gBAAgB,WAAW,WAAW,EAC1D;AACH,UAAM,UAAU,IAAI,mBAAmB,cAAc;AACrD,UAAM,UAAU,MAAM,QAAQ,eAAe,QAAQ;AACrD,WAAO,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,SAAS,MAAM,MAAM,QAAQ,CAAC;AAAA,EAChE,CAAC;AACH;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/open-exposure.ts"],"sourcesContent":["/**\n * Key exposure endpoint: what a given API key exposes to external callers —\n * the MCP tools (per grants) and the A2A agent cards (for granted agents).\n * Console-session guarded and tenant-scoped.\n */\n\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from \"fastify\";\nimport { getStoreLattice } from \"@axiom-lattice/core\";\nimport type {\n A2AApiKeyStore,\n AssistantStore,\n OpenGrant,\n} from \"@axiom-lattice/protocols\";\nimport { effectiveGrants } from \"@axiom-lattice/protocols\";\nimport { openLattice } from \"../services/open/openLattice\";\nimport { buildAgentCardForAssistant } from \"../services/a2a/A2AAgentCardBuilder\";\n\ninterface RequestWithUser extends FastifyRequest {\n user?: { id: string; tenantId?: string };\n}\n\nexport function registerOpenExposureRoutes(app: FastifyInstance): void {\n app.get<{ Params: { id: string } }>(\n \"/api/keys/:id/exposure\",\n async (\n request: FastifyRequest<{ Params: { id: string } }>,\n reply: FastifyReply,\n ) => {\n const tenantId = (request as RequestWithUser).user?.tenantId;\n if (!tenantId) {\n return reply.status(401).send({ success: false, error: \"Unauthorized\" });\n }\n\n const keyStore = getStoreLattice(\"default\", \"a2aApiKey\")\n .store as A2AApiKeyStore;\n const record = await keyStore.findById(request.params.id);\n if (!record || record.tenantId !== tenantId) {\n return reply.status(404).send({ success: false, error: \"Key not found\" });\n }\n\n const grants: OpenGrant[] = effectiveGrants(record);\n // Include the port: request.hostname strips it, request.headers.host keeps it.\n const forwardedHost = request.headers[\"x-forwarded-host\"];\n const host =\n (Array.isArray(forwardedHost) ? forwardedHost[0] : forwardedHost) ??\n (Array.isArray(request.headers.host) ? request.headers.host[0] : request.headers.host) ??\n request.hostname;\n const baseUrl = `${request.protocol}://${host}`;\n\n // MCP surface: the credential-filtered tool catalog.\n const tools = (await openLattice.catalogFor(grants, { tenantId })).map((t) => ({\n domain: t.domain,\n toolName: t.toolName,\n description: t.description,\n annotations: t.annotations,\n }));\n\n // A2A surface: one card per granted agent.\n const agentGrant = grants.find((g) => g.domain === \"agent\");\n const assistantStore = getStoreLattice(\"default\", \"assistant\")\n .store as AssistantStore;\n const agents: Array<{\n assistantId: string;\n cardUrl: string;\n jsonrpcUrl: string;\n card: unknown;\n }> = [];\n for (const assistantId of agentGrant?.items ?? []) {\n const assistant = await assistantStore.getAssistantById(\n tenantId,\n assistantId,\n );\n if (!assistant) continue;\n agents.push({\n assistantId,\n cardUrl: `${baseUrl}/api/a2a/agents/${assistantId}/.well-known/agent-card.json`,\n jsonrpcUrl: `${baseUrl}/api/a2a/agents/${assistantId}/jsonrpc`,\n card: buildAgentCardForAssistant({ assistant, baseUrl }),\n });\n }\n\n return reply.status(200).send({\n success: true,\n data: {\n tenantId,\n projectId: record.projectId,\n grants,\n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AY,SAAS,CAAC,GAAG;AACjD,cAAM,YAAY,MAAM,eAAe;AAAA,UACrC;AAAA,UACA;AAAA,QACF;AACA,YAAI,CAAC,UAAW;AAChB,eAAO,KAAK;AAAA,UACV;AAAA,UACA,SAAS,GAAG,OAAO,mBAAmB,WAAW;AAAA,UACjD,YAAY,GAAG,OAAO,mBAAmB,WAAW;AAAA,UACpD,MAAM,2BAA2B,EAAE,WAAW,QAAQ,CAAC;AAAA,QACzD,CAAC;AAAA,MACH;AAEA,aAAO,MAAM,OAAO,GAAG,EAAE,KAAK;AAAA,QAC5B,SAAS;AAAA,QACT,MAAM;AAAA,UACJ;AAAA,UACA,WAAW,OAAO;AAAA,UAClB;AAAA,UACA,KAAK,EAAE,UAAU,GAAG,OAAO,aAAa,MAAM;AAAA,UAC9C,KAAK,EAAE,OAAO;AAAA,QAChB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/open/registerExposedPlugins.ts","../src/services/open/pluginExposeAdapter.ts"],"sourcesContent":["import { PluginRegistry } from \"@axiom-lattice/core\";\nimport { openLattice } from \"./openLattice\";\nimport { createPluginProvider } from \"./pluginExposeAdapter\";\n\n/** Walk PluginRegistry and register every exposed tool as an Open provider. */\nexport async function registerExposedPluginTools(): Promise<void> {\n for (const key of PluginRegistry.list()) {\n const plugin = PluginRegistry.get(key);\n if (!plugin?.middleware) continue;\n // Declaration source: meta.openExpose (preferred, standalone) or\n // meta.tools[].expose (per-tool flags).\n const openExpose = plugin.meta.openExpose;\n const exposed = openExpose\n ? openExpose.map((entry) =>\n typeof entry === \"string\"\n ? { name: entry, description: \"\", expose: true }\n : {\n name: entry.name,\n description: \"\",\n expose: true,\n readOnly: entry.readOnly,\n destructive: entry.destructive,\n },\n )\n : (plugin.meta.tools?.filter((t) => t.expose) ?? []);\n if (exposed.length === 0) continue;\n try {\n // Open-door semantics: resolve the tenant's connections at call time\n // (credential → tenant → tenant's own Connection Store entries).\n const middleware = await plugin.middleware({\n ...(plugin.meta.defaultConfig ?? {}),\n connectAll: true,\n });\n const toolObjects = (middleware as { tools?: Array<{ name: string; description: string; invoke: (input: unknown, config?: unknown) => Promise<string> }> }).tools ?? [];\n const matched = exposed\n .map((tm) => {\n const tool = toolObjects.find((t: { name: string }) => t.name === tm.name);\n if (!tool) return null;\n const annotations = tm as { readOnly?: boolean; destructive?: boolean };\n return {\n name: tm.name,\n description: tm.description,\n tool,\n readOnly: annotations.readOnly,\n destructive: annotations.destructive,\n };\n })\n .filter(Boolean) as Array<{\n name: string;\n description?: string;\n tool: { name: string; description: string; invoke: (input: unknown, config?: unknown) => Promise<string> };\n readOnly?: boolean;\n destructive?: boolean;\n }>;\n if (matched.length === 0) continue;\n const provider = createPluginProvider(key, matched, { label: plugin.meta.name });\n openLattice.register(provider);\n } catch {\n // skip plugins whose middleware fails to instantiate\n }\n }\n}","/**\n * Plugin expose adapter: converts a plugin's middleware-emitted tools into an\n * OpenProvider, so `expose: true` tools surface on the Open API catalog.\n *\n * The LangChain tool emits schema via .lc_kwargs.schema (ZodType) and runs via\n * .invoke(input, exeConfig). We synthesize the exeConfig the way the Agent\n * path would — injecting tenantId + _resolvedConnections into runConfig.\n */\n\nimport { z } from \"zod\";\nimport type { OpenExecutionContext, OpenGrant } from \"@axiom-lattice/protocols\";\nimport type { OpenProviderDeclaration, OpenActionDeclaration } from \"./openLattice\";\n\nexport interface PluginToolLike {\n name: string;\n description: string;\n invoke: (input: unknown, exeConfig?: unknown) => Promise<string>;\n lc_kwargs?: { schema?: z.ZodTypeAny };\n schema?: z.ZodTypeAny;\n}\n\nfunction schemaOf(tool: PluginToolLike): z.ZodTypeAny {\n return tool.lc_kwargs?.schema ?? tool.schema ?? z.object({}).passthrough();\n}\n\n/** Build an Open provider exposing the given plugin tools under a domain. */\nexport interface PluginExposedTool {\n name: string;\n description?: string;\n tool: PluginToolLike;\n /** MCP readOnlyHint (default false — conservative). */\n readOnly?: boolean;\n /** MCP destructiveHint (default false). */\n destructive?: boolean;\n}\n\nexport function createPluginProvider(\n domain: string,\n tools: PluginExposedTool[],\n options: { label?: string } = {},\n): OpenProviderDeclaration {\n function toAction(info: PluginExposedTool): OpenActionDeclaration {\n return {\n name: info.name,\n description:\n info.description || info.tool.description || `Plugin tool ${info.name}`,\n schema: schemaOf(info.tool),\n annotations: {\n readOnlyHint: info.readOnly ?? false,\n destructiveHint: info.destructive ?? false,\n },\n };\n }\n\n const actions = tools.map(toAction);\n return {\n domain,\n label: options.label ?? domain,\n source: \"plugin\",\n scopeKind: \"tenant\",\n actions,\n execute: async (action: string, args: unknown, ctx: OpenExecutionContext) => {\n const info = tools.find((t) => t.name === action);\n if (!info) {\n return {\n content: [{ type: \"text\", text: `Unknown action: ${action}` }],\n isError: true,\n };\n }\n const exeConfig = {\n configurable: {\n runConfig: {\n tenantId: ctx.tenantId,\n _resolvedConnections: ctx.runConfig._resolvedConnections ?? [],\n },\n },\n };\n const output = await info.tool.invoke(args, exeConfig);\n return { content: [{ type: \"text\", text: output }] };\n },\n };\n}"],"mappings":";;;;;;AAAA,SAAS,sBAAsB;;;ACS/B,SAAS,SAAS;AAYlB,SAAS,SAAS,MAAoC;AACpD,SAAO,KAAK,WAAW,UAAU,KAAK,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,YAAY;AAC3E;AAaO,SAAS,qBACd,QACA,OACA,UAA8B,CAAC,GACN;AACzB,WAAS,SAAS,MAAgD;AAChE,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,aACE,KAAK,eAAe,KAAK,KAAK,eAAe,eAAe,KAAK,IAAI;AAAA,MACvE,QAAQ,SAAS,KAAK,IAAI;AAAA,MAC1B,aAAa;AAAA,QACX,cAAc,KAAK,YAAY;AAAA,QAC/B,iBAAiB,KAAK,eAAe;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,MAAM,IAAI,QAAQ;AAClC,SAAO;AAAA,IACL;AAAA,IACA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