@tickernelz/paperclip-pro-server 2026.926.2 → 2026.926.4

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 (106) hide show
  1. package/dist/build-info.json +1 -1
  2. package/dist/routes/agents.d.ts.map +1 -1
  3. package/dist/routes/agents.js +18 -4
  4. package/dist/routes/agents.js.map +1 -1
  5. package/dist/routes/issues.d.ts.map +1 -1
  6. package/dist/routes/issues.js +7 -0
  7. package/dist/routes/issues.js.map +1 -1
  8. package/dist/routes/openapi.d.ts.map +1 -1
  9. package/dist/routes/openapi.js +21 -8
  10. package/dist/routes/openapi.js.map +1 -1
  11. package/dist/routes/paperclip-mcp.d.ts.map +1 -1
  12. package/dist/routes/paperclip-mcp.js +23 -2
  13. package/dist/routes/paperclip-mcp.js.map +1 -1
  14. package/dist/services/issues.d.ts +5 -0
  15. package/dist/services/issues.d.ts.map +1 -1
  16. package/dist/services/issues.js +15 -1
  17. package/dist/services/issues.js.map +1 -1
  18. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
  19. package/node_modules/micromark/dev/lib/compile.js +14 -4
  20. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
  21. package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
  22. package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
  23. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
  24. package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
  25. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
  26. package/node_modules/micromark/dev/lib/preprocess.js +19 -21
  27. package/node_modules/micromark/lib/compile.d.ts.map +1 -1
  28. package/node_modules/micromark/lib/compile.js +37 -29
  29. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
  30. package/node_modules/micromark/lib/create-tokenizer.js +37 -35
  31. package/node_modules/micromark/lib/initialize/document.js +21 -13
  32. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
  33. package/node_modules/micromark/lib/initialize/text.js +7 -3
  34. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
  35. package/node_modules/micromark/lib/preprocess.js +16 -19
  36. package/node_modules/micromark/package.json +2 -15
  37. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
  38. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
  39. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
  40. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
  41. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
  42. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
  43. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
  44. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
  45. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
  46. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
  47. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
  48. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
  49. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
  50. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  51. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
  52. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
  53. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
  54. package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
  55. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
  56. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
  57. package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
  58. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
  59. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
  60. package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
  61. package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
  62. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
  63. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
  64. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
  65. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
  66. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
  67. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  68. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
  69. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
  70. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
  71. package/node_modules/micromark-core-commonmark/package.json +4 -16
  72. package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
  73. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
  74. package/node_modules/micromark-factory-space/dev/index.js +58 -3
  75. package/node_modules/micromark-factory-space/index.d.ts +24 -1
  76. package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
  77. package/node_modules/micromark-factory-space/index.js +55 -3
  78. package/node_modules/micromark-factory-space/package.json +1 -10
  79. package/node_modules/micromark-factory-space/readme.md +25 -25
  80. package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
  81. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
  82. package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
  83. package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
  84. package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
  85. package/node_modules/micromark-util-edit-map/index.js +225 -0
  86. package/node_modules/micromark-util-edit-map/license +22 -0
  87. package/node_modules/micromark-util-edit-map/package.json +48 -0
  88. package/node_modules/micromark-util-edit-map/readme.md +234 -0
  89. package/node_modules/micromark-util-types/index.d.ts +6 -3
  90. package/node_modules/micromark-util-types/package.json +2 -36
  91. package/node_modules/ws/lib/websocket.js +17 -3
  92. package/node_modules/ws/package.json +1 -1
  93. package/package.json +20 -20
  94. package/skills/paperclip/references/api-reference.md +2 -2
  95. package/ui-dist/assets/{Agents.production-5Tba_pW_.js → Agents.production-DYgcR2ZQ.js} +2 -2
  96. package/ui-dist/assets/{CompanyActivity.production-CONFWTe1.js → CompanyActivity.production-MiS7fCCl.js} +1 -1
  97. package/ui-dist/assets/{CompanyExport-CiOVCS4y.js → CompanyExport-C-7PQaz8.js} +1 -1
  98. package/ui-dist/assets/{CompanySkills.production-gv4ej6PI.js → CompanySkills.production-D3xms9bg.js} +1 -1
  99. package/ui-dist/assets/{Costs.production-C6rOIGNV.js → Costs.production-DdIIwVUT.js} +1 -1
  100. package/ui-dist/assets/{OrgChart.production-DYeuFtY_.js → OrgChart.production-hVW6TgEL.js} +1 -1
  101. package/ui-dist/assets/{RoutineDetail.production-Bt4IHfSD.js → RoutineDetail.production-MBJ3aeg2.js} +1 -1
  102. package/ui-dist/assets/{Routines.production-BBxSwg2A.js → Routines.production-LQRGr5dX.js} +1 -1
  103. package/ui-dist/assets/{definition-B49KTmLW.js → definition-INtTKxdn.js} +1 -1
  104. package/ui-dist/assets/{index-BRCs87uX.js → index-DbWxivZc.js} +161 -161
  105. package/ui-dist/index.html +1 -1
  106. package/ui-dist/sw.js +1 -1
@@ -0,0 +1,234 @@
1
+ # micromark-util-edit-map
2
+
3
+ [![Build][build-badge]][build]
4
+ [![Coverage][coverage-badge]][coverage]
5
+ [![Downloads][downloads-badge]][downloads]
6
+ [![Size][bundle-size-badge]][bundle-size]
7
+ [![Sponsors][sponsors-badge]][opencollective]
8
+ [![Backers][backers-badge]][opencollective]
9
+ [![Chat][chat-badge]][chat]
10
+
11
+ [micromark][] utility to batch changes to lists of events.
12
+
13
+ ## Contents
14
+
15
+ * [What is this?](#what-is-this)
16
+ * [When should I use this?](#when-should-i-use-this)
17
+ * [Install](#install)
18
+ * [Use](#use)
19
+ * [API](#api)
20
+ * [`EditMap()`](#editmap)
21
+ * [`EditMap#add(index, remove, add)`](#editmapaddindex-remove-add)
22
+ * [`EditMap#addBefore(index, remove, add)`](#editmapaddbeforeindex-remove-add)
23
+ * [`EditMap#consume(events)`](#editmapconsumeevents)
24
+ * [Types](#types)
25
+ * [Compatibility](#compatibility)
26
+ * [Security](#security)
27
+ * [Contribute](#contribute)
28
+ * [License](#license)
29
+
30
+ ## What is this?
31
+
32
+ This package exposes an algorithm to batch changes to lists of events,
33
+ needed when authoring complex resolvers, such as for tables or lists.
34
+
35
+ ## When should I use this?
36
+
37
+ This package is only useful when you are making your own micromark extensions
38
+ that need to change many places in lists of events,
39
+ such as injecting the result of parsing subcontent,
40
+ or cleaning up how a construct is represented.
41
+
42
+ ## Install
43
+
44
+ This package is [ESM only][esm].
45
+ In Node.js (version 16+), install with [npm][]:
46
+
47
+ ```sh
48
+ npm install micromark-util-edit-map
49
+ ```
50
+
51
+ In Deno with [`esm.sh`][esmsh]:
52
+
53
+ ```js
54
+ import {EditMap} from 'https://esm.sh/micromark-util-edit-map@1'
55
+ ```
56
+
57
+ In browsers with [`esm.sh`][esmsh]:
58
+
59
+ ```html
60
+ <script type="module">
61
+ import {EditMap} from 'https://esm.sh/micromark-util-edit-map@1?bundle'
62
+ </script>
63
+ ```
64
+
65
+ ## Use
66
+
67
+ ```js
68
+ /**
69
+ * @import {Event} from 'micromark-util-types'
70
+ */
71
+
72
+ import {EditMap} from 'micromark-util-edit-map'
73
+
74
+ /** @type {Array<Event>} */
75
+ const events = [] // Assume this is filled.
76
+
77
+ const editMap = new EditMap()
78
+
79
+ editMap.add(1, 0, [['enter', events[2][1], events[2][2]]])
80
+ editMap.add(2, 1, [])
81
+
82
+ editMap.consume(events)
83
+ ```
84
+
85
+ ## API
86
+
87
+ This module exports the identifier [`EditMap`][api-edit-map].
88
+ There is no default export.
89
+
90
+ ### `EditMap()`
91
+
92
+ Create a new edit map.
93
+
94
+ ###### Returns
95
+
96
+ New instance (`EditMap`).
97
+
98
+ ### `EditMap#add(index, remove, add)`
99
+
100
+ Create an edit: a remove and/or add at a certain place.
101
+
102
+ ###### Parameters
103
+
104
+ * `index` (`number`)
105
+ — index at which to apply the edit
106
+ * `remove` (`number`)
107
+ — count of items to remove at the index
108
+ * `add` (`Array<Event>`)
109
+ — items to add at the index
110
+
111
+ ###### Returns
112
+
113
+ Nothing (`undefined`).
114
+
115
+ ### `EditMap#addBefore(index, remove, add)`
116
+
117
+ Create an edit: but insert `add` before existing additions at `index`,
118
+ instead of after them.
119
+
120
+ ###### Parameters
121
+
122
+ * `index` (`number`)
123
+ — index at which to apply the edit
124
+ * `remove` (`number`)
125
+ — count of items to remove at the index
126
+ * `add` (`Array<Event>`)
127
+ — items to add at the index
128
+
129
+ ###### Returns
130
+
131
+ Nothing (`undefined`).
132
+
133
+ ### `EditMap#consume(events)`
134
+
135
+ Done, change the events.
136
+
137
+ ###### Parameters
138
+
139
+ * `events` (`Array<Event>`)
140
+ — list of events to apply the edits to
141
+
142
+ ###### Returns
143
+
144
+ Nothing (`undefined`).
145
+
146
+ ## Types
147
+
148
+ This package is fully typed with [TypeScript][].
149
+ It exports no additional types.
150
+
151
+ ## Compatibility
152
+
153
+ Projects maintained by the unified collective are compatible with maintained
154
+ versions of Node.js.
155
+
156
+ When we cut a new major release, we drop support for unmaintained versions of
157
+ Node.
158
+ This means we try to keep the current release line,
159
+ `micromark-util-edit-map@1`, compatible with Node.js 16.
160
+ This package works with `micromark@4`.
161
+
162
+ ## Security
163
+
164
+ This package is safe.
165
+ See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
166
+ submit a security report.
167
+
168
+ ## Contribute
169
+
170
+ See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
171
+ to get started.
172
+ See [`support.md`][support] for ways to get help.
173
+
174
+ This project has a [code of conduct][coc].
175
+ By interacting with this repository, organisation, or community you agree to
176
+ abide by its terms.
177
+
178
+ ## License
179
+
180
+ [MIT][license] © [Titus Wormer][author]
181
+
182
+ <!-- Definitions -->
183
+
184
+ [api-edit-map]: #editmap
185
+
186
+ [author]: https://wooorm.com
187
+
188
+ [backers-badge]: https://opencollective.com/unified/backers/badge.svg
189
+
190
+ [build]: https://github.com/micromark/micromark/actions
191
+
192
+ [build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
193
+
194
+ [bundle-size]: https://bundlejs.com/?q=micromark-util-edit-map
195
+
196
+ [bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-edit-map
197
+
198
+ [chat]: https://github.com/micromark/micromark/discussions
199
+
200
+ [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
201
+
202
+ [coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
203
+
204
+ [contributing]: https://github.com/micromark/.github/blob/main/contributing.md
205
+
206
+ [coverage]: https://codecov.io/github/micromark/micromark
207
+
208
+ [coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
209
+
210
+ [downloads]: https://www.npmjs.com/package/micromark-util-edit-map
211
+
212
+ [downloads-badge]: https://img.shields.io/npm/dm/micromark-util-edit-map.svg
213
+
214
+ [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
215
+
216
+ [esmsh]: https://esm.sh
217
+
218
+ [health]: https://github.com/micromark/.github
219
+
220
+ [license]: https://github.com/micromark/micromark/blob/main/license
221
+
222
+ [micromark]: https://github.com/micromark/micromark
223
+
224
+ [npm]: https://docs.npmjs.com/cli/install
225
+
226
+ [opencollective]: https://opencollective.com/unified
227
+
228
+ [securitymd]: https://github.com/micromark/.github/blob/main/security.md
229
+
230
+ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
231
+
232
+ [support]: https://github.com/micromark/.github/blob/main/support.md
233
+
234
+ [typescript]: https://www.typescriptlang.org
@@ -643,6 +643,11 @@ export interface TokenizeContext {
643
643
  */
644
644
  _contentTypeTextTrailing?: boolean | undefined
645
645
 
646
+ /**
647
+ * Stack of label start tokens that can still close.
648
+ */
649
+ _labelStarts?: Array<Token> | undefined
650
+
646
651
  /**
647
652
  * Current code.
648
653
  */
@@ -769,7 +774,6 @@ export type Encoding =
769
774
  | 'utf-16le' // Always supported in Node.
770
775
  | 'utf-16be' // Not supported when ICU is disabled.
771
776
  // Everything else (depends on browser, or full ICU data).
772
- // eslint-disable-next-line @typescript-eslint/ban-types
773
777
  | (string & {})
774
778
 
775
779
  /**
@@ -792,8 +796,7 @@ export interface Extension {
792
796
  flowInitial?: ConstructRecord | undefined
793
797
  flow?: ConstructRecord | undefined
794
798
  insideSpan?:
795
- | {null?: Array<Pick<Construct, 'resolveAll'>> | undefined}
796
- | undefined
799
+ {null?: Array<Pick<Construct, 'resolveAll'>> | undefined} | undefined
797
800
  string?: ConstructRecord | undefined
798
801
  text?: ConstructRecord | undefined
799
802
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micromark-util-types",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "micromark utility with a couple of typescript types",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -33,39 +33,5 @@
33
33
  "index.d.ts",
34
34
  "index.js"
35
35
  ],
36
- "exports": "./index.js",
37
- "xo": {
38
- "envs": [
39
- "shared-node-browser"
40
- ],
41
- "overrides": [
42
- {
43
- "files": [
44
- "**/*.d.ts"
45
- ],
46
- "rules": {
47
- "@typescript-eslint/array-type": [
48
- "error",
49
- {
50
- "default": "generic"
51
- }
52
- ],
53
- "@typescript-eslint/ban-types": [
54
- "error",
55
- {
56
- "extendDefaults": true
57
- }
58
- ],
59
- "@typescript-eslint/consistent-type-definitions": [
60
- "error",
61
- "interface"
62
- ]
63
- }
64
- }
65
- ],
66
- "prettier": true,
67
- "rules": {
68
- "unicorn/text-encoding-identifier-case": "off"
69
- }
70
- }
36
+ "exports": "./index.js"
71
37
  }
@@ -75,11 +75,24 @@ class WebSocket extends EventEmitter {
75
75
  this._redirects = 0;
76
76
 
77
77
  if (protocols === undefined) {
78
- protocols = [];
78
+ if (!options || options.protocols === undefined) {
79
+ protocols = [];
80
+ } else if (Array.isArray(options.protocols)) {
81
+ protocols = options.protocols;
82
+ } else {
83
+ protocols = [options.protocols];
84
+ }
79
85
  } else if (!Array.isArray(protocols)) {
80
86
  if (typeof protocols === 'object' && protocols !== null) {
81
87
  options = protocols;
82
- protocols = [];
88
+
89
+ if (options.protocols === undefined) {
90
+ protocols = [];
91
+ } else if (Array.isArray(options.protocols)) {
92
+ protocols = options.protocols;
93
+ } else {
94
+ protocols = [options.protocols];
95
+ }
83
96
  } else {
84
97
  protocols = [protocols];
85
98
  }
@@ -318,7 +331,6 @@ class WebSocket extends EventEmitter {
318
331
  return;
319
332
  }
320
333
 
321
- this._readyState = WebSocket.CLOSING;
322
334
  this._sender.close(code, data, !this._isServer, (err) => {
323
335
  //
324
336
  // This error is handled by the `'error'` listener on the socket. We only
@@ -336,6 +348,7 @@ class WebSocket extends EventEmitter {
336
348
  }
337
349
  });
338
350
 
351
+ this._readyState = WebSocket.CLOSING;
339
352
  setCloseTimer(this);
340
353
  }
341
354
 
@@ -681,6 +694,7 @@ function initAsClient(websocket, address, protocols, options) {
681
694
  socketPath: undefined,
682
695
  hostname: undefined,
683
696
  protocol: undefined,
697
+ protocols: undefined,
684
698
  timeout: undefined,
685
699
  method: 'GET',
686
700
  host: undefined,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws",
3
- "version": "8.21.3",
3
+ "version": "8.22.0",
4
4
  "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
5
5
  "keywords": [
6
6
  "HyBi",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tickernelz/paperclip-pro-server",
3
- "version": "2026.926.2",
3
+ "version": "2026.926.4",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/tickernelz/paperclip-pro",
6
6
  "bugs": {
@@ -45,24 +45,24 @@
45
45
  "@discordjs/ws": "1.2.3",
46
46
  "@grpc/grpc-js": "1.14.4",
47
47
  "@opentelemetry/api": "^1.9.0",
48
- "@tickernelz/paperclip-pro-adapter-claude-local": "2026.926.2",
49
- "@tickernelz/paperclip-pro-adapter-codex-local": "2026.926.2",
50
- "@tickernelz/paperclip-pro-adapter-cursor-cloud": "2026.926.2",
51
- "@tickernelz/paperclip-pro-adapter-cursor-local": "2026.926.2",
52
- "@tickernelz/paperclip-pro-adapter-gemini-local": "2026.926.2",
53
- "@tickernelz/paperclip-pro-adapter-grok-local": "2026.926.2",
54
- "@tickernelz/paperclip-pro-adapter-kimi-local": "2026.926.2",
55
- "@tickernelz/paperclip-pro-adapter-openclaw-gateway": "2026.926.2",
56
- "@tickernelz/paperclip-pro-adapter-omp-local": "2026.926.2",
57
- "@tickernelz/paperclip-pro-adapter-opencode-local": "2026.926.2",
58
- "@tickernelz/paperclip-pro-adapter-pi-local": "2026.926.2",
59
- "@tickernelz/paperclip-pro-adapter-utils": "2026.926.2",
60
- "@tickernelz/paperclip-pro-db": "2026.926.2",
61
- "@tickernelz/paperclip-pro-hermes-paperclip-adapter": "2026.926.2",
62
- "@tickernelz/paperclip-pro-mcp-server": "2026.926.2",
63
- "@tickernelz/paperclip-pro-plugin-sdk": "2026.926.2",
64
- "@tickernelz/paperclip-pro-shared": "2026.926.2",
65
- "@tickernelz/paperclip-pro-skills-catalog": "2026.926.2",
48
+ "@tickernelz/paperclip-pro-adapter-claude-local": "2026.926.4",
49
+ "@tickernelz/paperclip-pro-adapter-codex-local": "2026.926.4",
50
+ "@tickernelz/paperclip-pro-adapter-cursor-cloud": "2026.926.4",
51
+ "@tickernelz/paperclip-pro-adapter-cursor-local": "2026.926.4",
52
+ "@tickernelz/paperclip-pro-adapter-gemini-local": "2026.926.4",
53
+ "@tickernelz/paperclip-pro-adapter-grok-local": "2026.926.4",
54
+ "@tickernelz/paperclip-pro-adapter-kimi-local": "2026.926.4",
55
+ "@tickernelz/paperclip-pro-adapter-openclaw-gateway": "2026.926.4",
56
+ "@tickernelz/paperclip-pro-adapter-omp-local": "2026.926.4",
57
+ "@tickernelz/paperclip-pro-adapter-opencode-local": "2026.926.4",
58
+ "@tickernelz/paperclip-pro-adapter-pi-local": "2026.926.4",
59
+ "@tickernelz/paperclip-pro-adapter-utils": "2026.926.4",
60
+ "@tickernelz/paperclip-pro-db": "2026.926.4",
61
+ "@tickernelz/paperclip-pro-hermes-paperclip-adapter": "2026.926.4",
62
+ "@tickernelz/paperclip-pro-mcp-server": "2026.926.4",
63
+ "@tickernelz/paperclip-pro-plugin-sdk": "2026.926.4",
64
+ "@tickernelz/paperclip-pro-shared": "2026.926.4",
65
+ "@tickernelz/paperclip-pro-skills-catalog": "2026.926.4",
66
66
  "@photon-ai/advanced-imessage": "2.1.0",
67
67
  "@vercel/connect": "0.6.1",
68
68
  "acorn": "8.18.0",
@@ -112,7 +112,7 @@
112
112
  "acpx"
113
113
  ],
114
114
  "devDependencies": {
115
- "@tickernelz/paperclip-pro-paperclip-runner": "2026.926.2",
115
+ "@tickernelz/paperclip-pro-paperclip-runner": "2026.926.4",
116
116
  "@types/express": "^5.0.0",
117
117
  "@types/express-serve-static-core": "^5.1.3",
118
118
  "@types/jsdom": "^30.0.0",
@@ -479,7 +479,7 @@ paperclipUpdateIssue { issueId: "issue-99", comment: "JWT signing done. Still ne
479
479
 
480
480
  ### Worked Example: Report A Board User's Mine Inbox
481
481
 
482
- When a board user asks "what's in my inbox?", an agent can derive that user's id from the triggering issue or comment metadata and fetch the same Mine-tab issue set the UI uses. `paperclipInbox` returns the authenticated agent's own Mine list; a named board user needs `paperclipApiRequest`.
482
+ When a board user asks "what's in my inbox?", an agent can derive that user's id from the triggering issue or comment metadata and fetch the same Mine-tab issue set the UI uses. `paperclipInbox` takes that user's id as `userId` and returns their Mine list; `paperclipInboxLite` returns the authenticated agent's own compact assignment list.
483
483
 
484
484
  ```
485
485
  # Board user created the requesting issue.
@@ -1368,7 +1368,7 @@ Tools marked extended load only when the operator enables `PAPERCLIP_MCP_TOOLSET
1368
1368
  | Job | Tool | Key arguments |
1369
1369
  | --- | ---- | ------------- |
1370
1370
  | Your agent record + chain of command | `paperclipMe` | none |
1371
- | Your own Mine-tab issue list | `paperclipInbox` | none |
1371
+ | Your own Mine-tab issue list for a board user | `paperclipInbox` | `userId` (the board user's id), optional `status` |
1372
1372
  | Mine-tab issue list for a specific board user | `paperclipApiRequest` | `method: "GET"`, `path: "/agents/me/inbox/mine?userId=:userId"` |
1373
1373
  | Your compact assignment list | `paperclipInboxLite` | none |
1374
1374
  | Agent details + chain of command | `paperclipGetAgent` | `agentId`, `companyId` |
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BRCs87uX.js","assets/rolldown-runtime-ZpX3ckPj.js","assets/createLucideIcon-CZEG6UJ7.js","assets/preload-helper-CceJXRIF.js","assets/router-G1KztA90.js","assets/zap-CCqZhqc3.js","assets/agents-ZcIBncVi.js","assets/EmptyState-DeVTy8IU.js","assets/button-LkWt40cm.js","assets/RoutineRunVariablesDialog-Bj-Q_Ua3.js","assets/mention-chips-BEaOTvHT.js","assets/bot-CcFVz40n.js","assets/MarkdownEditor-7JCtdEaZ.js","assets/dist-Cqh7BG-j.js","assets/dist-pDmgIRxg.js","assets/AgentAvatar-CnpBTXF0.js","assets/dist-DCJXgQu0.js","assets/sheet-H27vJn3G.js","assets/checkbox-CLAkJpms.js","assets/check-CgfxcCMv.js","assets/chevron-right-IZydUoW5.js","assets/label-Dnc69R1W.js","assets/StatusIcon-j05cEqDO.js","assets/clipboard-CjMs5cp9.js","assets/loader-circle-Cu72DKdC.js","assets/octagon-alert-DfqJ6RjK.js","assets/select-DSr2hsz2.js","assets/chevron-down-CpKmud_n.js","assets/heartbeats-DFiFf4Zf.js","assets/useHiddenSettings-vbDpbX0U.js","assets/health-Bj6kLXe5.js","assets/rotate-ccw-DiFaj3XM.js","assets/triangle-alert-DiD4Atur.js","assets/badge-B4sBXDQo.js","assets/environments-xbdxVBLT.js","assets/input-a7SggR2b.js","assets/company-members-Dyq_pnza.js","assets/AgentIdentity-CV55DQtR.js","assets/card-DbvoJZ3K.js","assets/PageSkeleton-DRRnaWWU.js","assets/skeleton-CPVPMT4g.js","assets/tabs-D8G3-AL7.js","assets/use-adapter-capabilities-D_QCYxa2.js","assets/save-D9PtvKKu.js","assets/external-link-BbeUY6zf.js","assets/MarkdownBody-Da7yUIDf.js","assets/file-text-BMJQ4LZs.js","assets/SidebarContext-CxjppFTY.js","assets/index-GCNIGBzC.css"])))=>i.map(i=>d[i]);
2
- var Pe=Object.defineProperty;var n=(e,a)=>Pe(e,"name",{value:a,configurable:!0});import{i as oe}from"./rolldown-runtime-ZpX3ckPj.js";import{En as ke,Fr as qe,Lr as Me,S as B,U as Fe,Y as j,_ as ce,g as U,nr as N,z as Re}from"./createLucideIcon-CZEG6UJ7.js";import{t as $e}from"./preload-helper-CceJXRIF.js";import{it as Be,o as ze,t as de}from"./router-G1KztA90.js";import{S as Ke}from"./zap-CCqZhqc3.js";import{t as ue}from"./AgentAvatar-CnpBTXF0.js";import{t as Oe}from"./tabs-D8G3-AL7.js";import{t as ae}from"./agents-ZcIBncVi.js";import{r as De,t as re}from"./EmptyState-DeVTy8IU.js";import{t as ie}from"./bot-CcFVz40n.js";import{k as Ue,t as V}from"./button-LkWt40cm.js";import{i as Ve,o as He,t as Ge}from"./heartbeats-DFiFf4Zf.js";import{t as me}from"./triangle-alert-DiD4Atur.js";import{n as Qe}from"./SidebarContext-CxjppFTY.js";import{n as Je,t as le}from"./environments-xbdxVBLT.js";import{t as Ye}from"./PageSkeleton-DRRnaWWU.js";import{$t as We,It as Xe,Jt as Ze,Lt as pe,Wt as H,Yt as et,an as ge,cn as tt,dn as st,in as nt,nn as xe,on as G,rn as at,sn as rt,un as fe}from"./index-BRCs87uX.js";var g=oe(Me(),1),t=oe(qe(),1),he=ke,it=(0,g.lazy)(()=>$e(()=>import("./index-BRCs87uX.js").then(e=>e.wt).then(e=>({default:e.ConfigureBuiltInAgentModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]))),lt=["all","active","paused","error","builtin"],ot=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"error",label:"Error"},{value:"builtin",label:"Built-in"}];function ct(e){return lt.includes(e)}n(ct,"isFilterTab");var J={label:"Local",detail:"Paperclip host",title:"Local - Paperclip host"},ve={label:"—",detail:"Loading environment",title:"Loading environment"},be=new Set(["terminated","pending_approval"]);function je(e,a){return a==="all"?!0:a==="active"?e==="active"||e==="running"||e==="idle":a==="paused"?e==="paused":a==="error"?e==="error":!0}n(je,"matchesFilter");function dt(e,a,i){return e.filter(r=>be.has(r.status)?!1:a==="builtin"?i.has(r.id):je(r.status,a)).sort((r,o)=>r.name.localeCompare(o.name))}n(dt,"filterAgents");function ut(e){const a=e.adapterConfig?.model;if(typeof a!="string")return null;const i=a.trim();return i.length>0?i:null}n(ut,"getConfiguredModel");function mt(e){return e==="ssh"?"SSH":e.charAt(0).toUpperCase()+e.slice(1)}n(mt,"formatEnvironmentDriver");function pt(e,a){const i=typeof e.config.provider=="string"?e.config.provider.trim():"";return i?a?.sandboxProviders?.[i]?.displayName??i:"Sandbox"}n(pt,"getSandboxProviderLabel");function gt(e,a){const i=Ze(e)?"Managed by Paperclip":e.driver==="sandbox"?`${pt(e,a)} sandbox provider`:e.driver==="local"?"Paperclip host":mt(e.driver);return{label:e.name,detail:i,title:`${e.name} - ${i}`}}n(gt,"describeEnvironment");function xt(e){return{label:"Unknown environment",detail:e.slice(0,8),title:`Unknown environment - ${e}`}}n(xt,"describeMissingEnvironment");function ft(e,a,i,r){const o=e.defaultEnvironmentId??i;if(!o)return J;const x=a.get(o);return x?gt(x,r):xt(o)}n(ft,"resolveAgentEnvironment");function Ne(e,a,i){return e.reduce((r,o)=>{const x=Ne(o.reports,a,i);return be.has(o.status)?(r.push(...x),r):(((a==="builtin"?i.has(o.id):je(o.status,a))||x.length>0)&&r.push({...o,reports:x}),r)},[]).sort((r,o)=>r.name.localeCompare(o.name))}n(Ne,"filterOrgTree");function Mt(){const{selectedCompanyId:e}=Fe(),{openNewAgent:a}=Ve(),{setBreadcrumbs:i}=De(),r=ze(),o=Be(),{isMobile:x}=Qe(),C=o.pathname.split("/").pop()??"all",v=ct(C)?C:"all",[S,m]=(0,g.useState)("org"),A=x,p=A?"list":S,{data:l}=N({queryKey:j.instance.settings,queryFn:n(()=>Je.get(),"queryFn"),enabled:!!e}),u=l?.experimental.enableBuiltInAgents===!0,h=v==="builtin"&&!u?"all":v,z=(0,g.useMemo)(()=>ot.filter(s=>s.value!=="builtin"||u),[u]),{data:E}=N({queryKey:j.builtInAgents.list(e),queryFn:n(()=>st.list(e),"queryFn"),enabled:!!e&&u}),b=(0,g.useMemo)(()=>{const s=new Map;if(!u)return s;for(const c of E??[])c.agentId&&s.set(c.agentId,c);return s},[E,u]),k=(0,g.useMemo)(()=>new Set(b.keys()),[b]),[y,_]=(0,g.useState)(null),{data:d,isLoading:Ie,error:Y}=N({queryKey:j.agents.list(e),queryFn:n(()=>ae.list(e),"queryFn"),enabled:!!e}),{data:T}=N({queryKey:j.org(e),queryFn:n(()=>ae.org(e),"queryFn"),enabled:!!e&&p==="org"}),q=l?.experimental.enableEnvironments===!0,{data:L}=N({queryKey:j.environments.list(e),queryFn:n(()=>le.list(e),"queryFn"),enabled:!!e&&q}),{data:W}=N({queryKey:j.environments.capabilities(e),queryFn:n(()=>le.capabilities(e),"queryFn"),enabled:!!e&&q}),X=[...j.liveRuns(e),"agents-page"],K=nt({companyId:e,resourceKey:"live-runs:agents-page",queryKey:X,enabled:!!e,refetchInterval:15e3,leaderOnly:!0}),{data:O,dataUpdatedAt:Ce}=N({queryKey:X,queryFn:n(()=>Ge.liveRunsForCompany(e),"queryFn"),enabled:K.enabled,refetchInterval:K.refetchInterval});at(K,O,Ce);const M=tt(e),f=rt(e),F=(0,g.useMemo)(()=>{const s=new Map;for(const c of O??[]){if(c.status!=="running"&&c.status!=="queued")continue;const P=s.get(c.agentId);if(P){P.liveCount+=1;continue}s.set(c.agentId,{runId:c.id,liveCount:1})}return s},[O]),Se=(0,g.useMemo)(()=>{const s=new Map;for(const c of d??[])s.set(c.id,c);return s},[d]),Z=(0,g.useMemo)(()=>{const s=new Map;for(const c of L??[])s.set(c.id,c);return s},[L]),ee=(0,g.useMemo)(()=>{const s=new Map;for(const c of d??[])s.set(c.id,ft(c,Z,l?.defaultEnvironmentId??null,W));return s},[d,Z,W,l?.defaultEnvironmentId]);if((0,g.useEffect)(()=>{i([{label:"Agents"}])},[i]),(0,g.useEffect)(()=>{e&&v==="builtin"&&l&&!u&&r("/agents/all",{replace:!0})},[u,l,r,v,e]),!e)return(0,t.jsx)(re,{icon:ie,message:"Select a company to view agents."});if(Ie)return(0,t.jsx)(Ye,{variant:"list"});const w=dt(d??[],h,k),D=Ne(T??[],h,k),te=q&&L===void 0,se=q&&(L===void 0||L.length>1),Ae=n(s=>te?ve:ee.get(s)??J,"resolveRenderedEnvironment"),Ee=n(s=>{const c=s.orgChainHealth?.status==="invalid_org_chain",P=f.isPending&&f.variables?.resourceType==="agent"&&f.variables.resourceId===s.id,_e=P&&f.variables?.starred!==void 0,ne=P&&f.variables?.starred===void 0,Te=ge(M.data,"agent",s.id),I=b.get(s.id),Le=I?.status==="needs_setup"||I?.status==="pending_approval",R=I&&Le?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(fe,{status:I.status}),I.status==="needs_setup"&&(0,t.jsx)("span",{onClick:n($=>{$.preventDefault(),$.stopPropagation()},"onClick"),children:(0,t.jsx)(V,{size:"xs",variant:"outline",onClick:n(()=>_(I),"onClick"),children:"Set up"})})]}):null;return(0,t.jsx)(Xe,{title:s.name,titleClassName:"flex-1 xl:flex-none xl:w-56",titleTextClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitleClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitle:`${he[s.role]??s.role}${s.title?` - ${s.title}`:""}`,to:ce(s),className:B("group",s.pausedAt&&h!=="paused"?"opacity-50":"",G(M.data,"agent",s.id)==="left"?"sm:text-foreground/55":""),leading:c?(0,t.jsx)(me,{className:"h-3.5 w-3.5 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(ue,{agent:s,size:32}),secondaryRow:R?(0,t.jsx)("div",{className:"xl:hidden flex flex-wrap items-center gap-1.5",children:R}):void 0,meta:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[R&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-1.5",children:R}),(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(we,{agent:s,environment:Ae(s.id),showEnvironment:se})})]}),metaSpacerClassName:"hidden xl:block",trailing:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[F.has(s.id)&&(0,t.jsx)(Q,{agentRef:U(s),runId:F.get(s.id).runId,liveCount:F.get(s.id).liveCount}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(H,{status:s.status})}),(0,t.jsx)(xe,{size:"row",starred:Te,pending:_e,resourceName:s.name,onToggle:n($=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,starred:$}),"onToggle")})]}),(0,t.jsx)(pe,{state:G(M.data,"agent",s.id),pending:ne,pendingState:ne?f.variables?.state??null:null,resourceName:s.name,onJoin:n(()=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,state:"joined"}),"onJoin"),onLeave:n(()=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,state:"left"}),"onLeave")})]})},s.id)},"renderAgentRow");return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Oe,{value:h,onValueChange:n(s=>r(`/agents/${s}`),"onValueChange"),children:(0,t.jsx)(We,{items:z,value:h,onValueChange:n(s=>r(`/agents/${s}`),"onValueChange")})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!A&&(0,t.jsxs)("div",{className:"flex items-center border border-border",role:"group","aria-label":"View mode",children:[(0,t.jsx)("button",{className:B("p-1.5 transition-colors",p==="list"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>m("list"),"onClick"),title:"List view","aria-label":"List view","aria-pressed":p==="list",children:(0,t.jsx)(He,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:B("p-1.5 transition-colors",p==="org"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>m("org"),"onClick"),title:"Org chart view","aria-label":"Org chart view","aria-pressed":p==="org",children:(0,t.jsx)(Ke,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)(V,{size:"sm",variant:"outline",onClick:a,children:[(0,t.jsx)(Ue,{className:"h-3.5 w-3.5 mr-1.5"}),"New Agent"]})]})]}),w.length>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[w.length," agent",w.length!==1?"s":""]}),Y&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:Y.message}),d&&d.length===0&&(0,t.jsx)(re,{icon:ie,message:"Create your first agent to get started.",action:"New Agent",onAction:a}),p==="list"&&w.length>0&&(0,t.jsx)("div",{children:w.map(Ee)}),p==="list"&&d&&d.length>0&&w.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),p==="org"&&D.length>0&&(0,t.jsx)("div",{className:"py-1",children:D.map(s=>(0,t.jsx)(ye,{node:s,depth:0,agentMap:Se,liveRunByAgent:F,environmentByAgentId:ee,environmentDataLoading:te,showEnvironment:se,tab:h,memberships:M.data,membershipMutation:f,builtInByAgentId:b,onConfigureBuiltIn:_},s.id))}),p==="org"&&T&&T.length>0&&D.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),p==="org"&&T&&T.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No organizational hierarchy defined."}),y&&e&&(0,t.jsx)(g.Suspense,{fallback:null,children:(0,t.jsx)(it,{companyId:e,state:y,open:y!==null,onOpenChange:n(s=>{s||_(null)},"onOpenChange")})})]})}n(Mt,"Agents");function ye({node:e,depth:a,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:x,showEnvironment:C,tab:v,memberships:S,membershipMutation:m,builtInByAgentId:A,onConfigureBuiltIn:p}){const l=i.get(e.id),u=A.get(e.id),h=u?.status==="needs_setup"||u?.status==="pending_approval",z=!!(l&&l.orgChainHealth?.status==="invalid_org_chain"),E=G(S,"agent",e.id),b=m.isPending&&m.variables?.resourceType==="agent"&&m.variables.resourceId===e.id,k=b&&m.variables?.starred!==void 0,y=b&&m.variables?.starred===void 0,_=ge(S,"agent",e.id);return(0,t.jsxs)("div",{style:{paddingLeft:a*24},children:[(0,t.jsxs)(de,{to:l?ce(l):`/agents/${e.id}`,className:B("group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50 transition-colors w-full text-left no-underline text-inherit",l?.pausedAt&&v!=="paused"&&"opacity-50",E==="left"&&"sm:text-foreground/55"),children:[z?(0,t.jsx)(me,{className:"h-3.5 w-3.5 shrink-0 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(ue,{agent:l??e,size:24}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"min-w-(--sz-7rem) truncate",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[he[e.role]??e.role,l?.title?` - ${l.title}`:""]})]}),u&&h&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(fe,{status:u.status}),u.status==="needs_setup"&&(0,t.jsx)("span",{onClick:n(d=>{d.preventDefault(),d.stopPropagation()},"onClick"),children:(0,t.jsx)(V,{size:"xs",variant:"outline",onClick:n(()=>p(u),"onClick"),children:"Set up"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,t.jsx)("span",{className:"sm:hidden",children:r.has(e.id)?(0,t.jsx)(Q,{agentRef:l?U(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}):(0,t.jsx)(H,{status:e.status})}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[r.has(e.id)&&(0,t.jsx)(Q,{agentRef:l?U(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}),l&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(we,{agent:l,environment:x?ve:o.get(l.id)??J,showEnvironment:C})}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(H,{status:e.status})})]}),(0,t.jsx)(pe,{state:E,pending:y,pendingState:y?m.variables?.state:null,resourceName:e.name,onJoin:n(()=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,state:"joined"}),"onJoin"),onLeave:n(()=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,state:"left"}),"onLeave")}),(0,t.jsx)("div",{className:"hidden sm:flex items-center gap-3",children:(0,t.jsx)(xe,{size:"row",starred:_,pending:k,resourceName:e.name,onToggle:n(d=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,starred:d}),"onToggle")})})]})]}),e.reports&&e.reports.length>0&&(0,t.jsx)("div",{className:"border-l border-border ml-4",children:e.reports.map(d=>(0,t.jsx)(ye,{node:d,depth:a+1,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:x,showEnvironment:C,tab:v,memberships:S,membershipMutation:m,builtInByAgentId:A,onConfigureBuiltIn:p},d.id))})]})}n(ye,"OrgTreeNode");function we({agent:e,environment:a,showEnvironment:i}){const r=ut(e),o=et(e.adapterType);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs text-muted-foreground",title:r??void 0,children:r??"—"}),(0,t.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground/70",title:o,children:o})]}),i&&(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",title:a.title,children:a.label}),(0,t.jsx)("div",{className:"truncate text-(length:--text-micro) text-muted-foreground/70",children:a.detail})]}),(0,t.jsx)("span",{className:"w-24 whitespace-nowrap text-right text-xs text-muted-foreground",children:e.lastHeartbeatAt?Re(e.lastHeartbeatAt):"—"})]})}n(we,"AgentMetaColumns");function Q({agentRef:e,runId:a,liveCount:i}){return(0,t.jsxs)(de,{to:`/agents/${e}/runs/${a}`,className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline",onClick:n(r=>r.stopPropagation(),"onClick"),children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),(0,t.jsxs)("span",{className:"text-(length:--text-micro) font-medium text-blue-600 dark:text-blue-400",children:["Live",i>1?` (${i})`:""]})]})}n(Q,"LiveRunIndicator");export{Mt as Agents};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DbWxivZc.js","assets/rolldown-runtime-ZpX3ckPj.js","assets/createLucideIcon-CZEG6UJ7.js","assets/preload-helper-CceJXRIF.js","assets/router-G1KztA90.js","assets/zap-CCqZhqc3.js","assets/agents-ZcIBncVi.js","assets/EmptyState-DeVTy8IU.js","assets/button-LkWt40cm.js","assets/RoutineRunVariablesDialog-Bj-Q_Ua3.js","assets/mention-chips-BEaOTvHT.js","assets/bot-CcFVz40n.js","assets/MarkdownEditor-7JCtdEaZ.js","assets/dist-Cqh7BG-j.js","assets/dist-pDmgIRxg.js","assets/AgentAvatar-CnpBTXF0.js","assets/dist-DCJXgQu0.js","assets/sheet-H27vJn3G.js","assets/checkbox-CLAkJpms.js","assets/check-CgfxcCMv.js","assets/chevron-right-IZydUoW5.js","assets/label-Dnc69R1W.js","assets/StatusIcon-j05cEqDO.js","assets/clipboard-CjMs5cp9.js","assets/loader-circle-Cu72DKdC.js","assets/octagon-alert-DfqJ6RjK.js","assets/select-DSr2hsz2.js","assets/chevron-down-CpKmud_n.js","assets/heartbeats-DFiFf4Zf.js","assets/useHiddenSettings-vbDpbX0U.js","assets/health-Bj6kLXe5.js","assets/rotate-ccw-DiFaj3XM.js","assets/triangle-alert-DiD4Atur.js","assets/badge-B4sBXDQo.js","assets/environments-xbdxVBLT.js","assets/input-a7SggR2b.js","assets/company-members-Dyq_pnza.js","assets/AgentIdentity-CV55DQtR.js","assets/card-DbvoJZ3K.js","assets/PageSkeleton-DRRnaWWU.js","assets/skeleton-CPVPMT4g.js","assets/tabs-D8G3-AL7.js","assets/use-adapter-capabilities-D_QCYxa2.js","assets/save-D9PtvKKu.js","assets/external-link-BbeUY6zf.js","assets/MarkdownBody-Da7yUIDf.js","assets/file-text-BMJQ4LZs.js","assets/SidebarContext-CxjppFTY.js","assets/index-GCNIGBzC.css"])))=>i.map(i=>d[i]);
2
+ var Pe=Object.defineProperty;var n=(e,a)=>Pe(e,"name",{value:a,configurable:!0});import{i as oe}from"./rolldown-runtime-ZpX3ckPj.js";import{En as ke,Fr as qe,Lr as Me,S as B,U as Fe,Y as j,_ as ce,g as U,nr as N,z as Re}from"./createLucideIcon-CZEG6UJ7.js";import{t as $e}from"./preload-helper-CceJXRIF.js";import{it as Be,o as ze,t as de}from"./router-G1KztA90.js";import{S as Ke}from"./zap-CCqZhqc3.js";import{t as ue}from"./AgentAvatar-CnpBTXF0.js";import{t as Oe}from"./tabs-D8G3-AL7.js";import{t as ae}from"./agents-ZcIBncVi.js";import{r as De,t as re}from"./EmptyState-DeVTy8IU.js";import{t as ie}from"./bot-CcFVz40n.js";import{k as Ue,t as V}from"./button-LkWt40cm.js";import{i as Ve,o as He,t as Ge}from"./heartbeats-DFiFf4Zf.js";import{t as me}from"./triangle-alert-DiD4Atur.js";import{n as Qe}from"./SidebarContext-CxjppFTY.js";import{n as Je,t as le}from"./environments-xbdxVBLT.js";import{t as Ye}from"./PageSkeleton-DRRnaWWU.js";import{$t as We,It as Xe,Jt as Ze,Lt as pe,Wt as H,Yt as et,an as ge,cn as tt,dn as st,in as nt,nn as xe,on as G,rn as at,sn as rt,un as fe}from"./index-DbWxivZc.js";var g=oe(Me(),1),t=oe(qe(),1),he=ke,it=(0,g.lazy)(()=>$e(()=>import("./index-DbWxivZc.js").then(e=>e.wt).then(e=>({default:e.ConfigureBuiltInAgentModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]))),lt=["all","active","paused","error","builtin"],ot=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"error",label:"Error"},{value:"builtin",label:"Built-in"}];function ct(e){return lt.includes(e)}n(ct,"isFilterTab");var J={label:"Local",detail:"Paperclip host",title:"Local - Paperclip host"},ve={label:"—",detail:"Loading environment",title:"Loading environment"},be=new Set(["terminated","pending_approval"]);function je(e,a){return a==="all"?!0:a==="active"?e==="active"||e==="running"||e==="idle":a==="paused"?e==="paused":a==="error"?e==="error":!0}n(je,"matchesFilter");function dt(e,a,i){return e.filter(r=>be.has(r.status)?!1:a==="builtin"?i.has(r.id):je(r.status,a)).sort((r,o)=>r.name.localeCompare(o.name))}n(dt,"filterAgents");function ut(e){const a=e.adapterConfig?.model;if(typeof a!="string")return null;const i=a.trim();return i.length>0?i:null}n(ut,"getConfiguredModel");function mt(e){return e==="ssh"?"SSH":e.charAt(0).toUpperCase()+e.slice(1)}n(mt,"formatEnvironmentDriver");function pt(e,a){const i=typeof e.config.provider=="string"?e.config.provider.trim():"";return i?a?.sandboxProviders?.[i]?.displayName??i:"Sandbox"}n(pt,"getSandboxProviderLabel");function gt(e,a){const i=Ze(e)?"Managed by Paperclip":e.driver==="sandbox"?`${pt(e,a)} sandbox provider`:e.driver==="local"?"Paperclip host":mt(e.driver);return{label:e.name,detail:i,title:`${e.name} - ${i}`}}n(gt,"describeEnvironment");function xt(e){return{label:"Unknown environment",detail:e.slice(0,8),title:`Unknown environment - ${e}`}}n(xt,"describeMissingEnvironment");function ft(e,a,i,r){const o=e.defaultEnvironmentId??i;if(!o)return J;const x=a.get(o);return x?gt(x,r):xt(o)}n(ft,"resolveAgentEnvironment");function Ne(e,a,i){return e.reduce((r,o)=>{const x=Ne(o.reports,a,i);return be.has(o.status)?(r.push(...x),r):(((a==="builtin"?i.has(o.id):je(o.status,a))||x.length>0)&&r.push({...o,reports:x}),r)},[]).sort((r,o)=>r.name.localeCompare(o.name))}n(Ne,"filterOrgTree");function Mt(){const{selectedCompanyId:e}=Fe(),{openNewAgent:a}=Ve(),{setBreadcrumbs:i}=De(),r=ze(),o=Be(),{isMobile:x}=Qe(),C=o.pathname.split("/").pop()??"all",v=ct(C)?C:"all",[S,m]=(0,g.useState)("org"),A=x,p=A?"list":S,{data:l}=N({queryKey:j.instance.settings,queryFn:n(()=>Je.get(),"queryFn"),enabled:!!e}),u=l?.experimental.enableBuiltInAgents===!0,h=v==="builtin"&&!u?"all":v,z=(0,g.useMemo)(()=>ot.filter(s=>s.value!=="builtin"||u),[u]),{data:E}=N({queryKey:j.builtInAgents.list(e),queryFn:n(()=>st.list(e),"queryFn"),enabled:!!e&&u}),b=(0,g.useMemo)(()=>{const s=new Map;if(!u)return s;for(const c of E??[])c.agentId&&s.set(c.agentId,c);return s},[E,u]),k=(0,g.useMemo)(()=>new Set(b.keys()),[b]),[y,_]=(0,g.useState)(null),{data:d,isLoading:Ie,error:Y}=N({queryKey:j.agents.list(e),queryFn:n(()=>ae.list(e),"queryFn"),enabled:!!e}),{data:T}=N({queryKey:j.org(e),queryFn:n(()=>ae.org(e),"queryFn"),enabled:!!e&&p==="org"}),q=l?.experimental.enableEnvironments===!0,{data:L}=N({queryKey:j.environments.list(e),queryFn:n(()=>le.list(e),"queryFn"),enabled:!!e&&q}),{data:W}=N({queryKey:j.environments.capabilities(e),queryFn:n(()=>le.capabilities(e),"queryFn"),enabled:!!e&&q}),X=[...j.liveRuns(e),"agents-page"],K=nt({companyId:e,resourceKey:"live-runs:agents-page",queryKey:X,enabled:!!e,refetchInterval:15e3,leaderOnly:!0}),{data:O,dataUpdatedAt:Ce}=N({queryKey:X,queryFn:n(()=>Ge.liveRunsForCompany(e),"queryFn"),enabled:K.enabled,refetchInterval:K.refetchInterval});at(K,O,Ce);const M=tt(e),f=rt(e),F=(0,g.useMemo)(()=>{const s=new Map;for(const c of O??[]){if(c.status!=="running"&&c.status!=="queued")continue;const P=s.get(c.agentId);if(P){P.liveCount+=1;continue}s.set(c.agentId,{runId:c.id,liveCount:1})}return s},[O]),Se=(0,g.useMemo)(()=>{const s=new Map;for(const c of d??[])s.set(c.id,c);return s},[d]),Z=(0,g.useMemo)(()=>{const s=new Map;for(const c of L??[])s.set(c.id,c);return s},[L]),ee=(0,g.useMemo)(()=>{const s=new Map;for(const c of d??[])s.set(c.id,ft(c,Z,l?.defaultEnvironmentId??null,W));return s},[d,Z,W,l?.defaultEnvironmentId]);if((0,g.useEffect)(()=>{i([{label:"Agents"}])},[i]),(0,g.useEffect)(()=>{e&&v==="builtin"&&l&&!u&&r("/agents/all",{replace:!0})},[u,l,r,v,e]),!e)return(0,t.jsx)(re,{icon:ie,message:"Select a company to view agents."});if(Ie)return(0,t.jsx)(Ye,{variant:"list"});const w=dt(d??[],h,k),D=Ne(T??[],h,k),te=q&&L===void 0,se=q&&(L===void 0||L.length>1),Ae=n(s=>te?ve:ee.get(s)??J,"resolveRenderedEnvironment"),Ee=n(s=>{const c=s.orgChainHealth?.status==="invalid_org_chain",P=f.isPending&&f.variables?.resourceType==="agent"&&f.variables.resourceId===s.id,_e=P&&f.variables?.starred!==void 0,ne=P&&f.variables?.starred===void 0,Te=ge(M.data,"agent",s.id),I=b.get(s.id),Le=I?.status==="needs_setup"||I?.status==="pending_approval",R=I&&Le?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(fe,{status:I.status}),I.status==="needs_setup"&&(0,t.jsx)("span",{onClick:n($=>{$.preventDefault(),$.stopPropagation()},"onClick"),children:(0,t.jsx)(V,{size:"xs",variant:"outline",onClick:n(()=>_(I),"onClick"),children:"Set up"})})]}):null;return(0,t.jsx)(Xe,{title:s.name,titleClassName:"flex-1 xl:flex-none xl:w-56",titleTextClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitleClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitle:`${he[s.role]??s.role}${s.title?` - ${s.title}`:""}`,to:ce(s),className:B("group",s.pausedAt&&h!=="paused"?"opacity-50":"",G(M.data,"agent",s.id)==="left"?"sm:text-foreground/55":""),leading:c?(0,t.jsx)(me,{className:"h-3.5 w-3.5 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(ue,{agent:s,size:32}),secondaryRow:R?(0,t.jsx)("div",{className:"xl:hidden flex flex-wrap items-center gap-1.5",children:R}):void 0,meta:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[R&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-1.5",children:R}),(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(we,{agent:s,environment:Ae(s.id),showEnvironment:se})})]}),metaSpacerClassName:"hidden xl:block",trailing:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[F.has(s.id)&&(0,t.jsx)(Q,{agentRef:U(s),runId:F.get(s.id).runId,liveCount:F.get(s.id).liveCount}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(H,{status:s.status})}),(0,t.jsx)(xe,{size:"row",starred:Te,pending:_e,resourceName:s.name,onToggle:n($=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,starred:$}),"onToggle")})]}),(0,t.jsx)(pe,{state:G(M.data,"agent",s.id),pending:ne,pendingState:ne?f.variables?.state??null:null,resourceName:s.name,onJoin:n(()=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,state:"joined"}),"onJoin"),onLeave:n(()=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,state:"left"}),"onLeave")})]})},s.id)},"renderAgentRow");return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Oe,{value:h,onValueChange:n(s=>r(`/agents/${s}`),"onValueChange"),children:(0,t.jsx)(We,{items:z,value:h,onValueChange:n(s=>r(`/agents/${s}`),"onValueChange")})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!A&&(0,t.jsxs)("div",{className:"flex items-center border border-border",role:"group","aria-label":"View mode",children:[(0,t.jsx)("button",{className:B("p-1.5 transition-colors",p==="list"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>m("list"),"onClick"),title:"List view","aria-label":"List view","aria-pressed":p==="list",children:(0,t.jsx)(He,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:B("p-1.5 transition-colors",p==="org"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>m("org"),"onClick"),title:"Org chart view","aria-label":"Org chart view","aria-pressed":p==="org",children:(0,t.jsx)(Ke,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)(V,{size:"sm",variant:"outline",onClick:a,children:[(0,t.jsx)(Ue,{className:"h-3.5 w-3.5 mr-1.5"}),"New Agent"]})]})]}),w.length>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[w.length," agent",w.length!==1?"s":""]}),Y&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:Y.message}),d&&d.length===0&&(0,t.jsx)(re,{icon:ie,message:"Create your first agent to get started.",action:"New Agent",onAction:a}),p==="list"&&w.length>0&&(0,t.jsx)("div",{children:w.map(Ee)}),p==="list"&&d&&d.length>0&&w.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),p==="org"&&D.length>0&&(0,t.jsx)("div",{className:"py-1",children:D.map(s=>(0,t.jsx)(ye,{node:s,depth:0,agentMap:Se,liveRunByAgent:F,environmentByAgentId:ee,environmentDataLoading:te,showEnvironment:se,tab:h,memberships:M.data,membershipMutation:f,builtInByAgentId:b,onConfigureBuiltIn:_},s.id))}),p==="org"&&T&&T.length>0&&D.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),p==="org"&&T&&T.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No organizational hierarchy defined."}),y&&e&&(0,t.jsx)(g.Suspense,{fallback:null,children:(0,t.jsx)(it,{companyId:e,state:y,open:y!==null,onOpenChange:n(s=>{s||_(null)},"onOpenChange")})})]})}n(Mt,"Agents");function ye({node:e,depth:a,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:x,showEnvironment:C,tab:v,memberships:S,membershipMutation:m,builtInByAgentId:A,onConfigureBuiltIn:p}){const l=i.get(e.id),u=A.get(e.id),h=u?.status==="needs_setup"||u?.status==="pending_approval",z=!!(l&&l.orgChainHealth?.status==="invalid_org_chain"),E=G(S,"agent",e.id),b=m.isPending&&m.variables?.resourceType==="agent"&&m.variables.resourceId===e.id,k=b&&m.variables?.starred!==void 0,y=b&&m.variables?.starred===void 0,_=ge(S,"agent",e.id);return(0,t.jsxs)("div",{style:{paddingLeft:a*24},children:[(0,t.jsxs)(de,{to:l?ce(l):`/agents/${e.id}`,className:B("group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50 transition-colors w-full text-left no-underline text-inherit",l?.pausedAt&&v!=="paused"&&"opacity-50",E==="left"&&"sm:text-foreground/55"),children:[z?(0,t.jsx)(me,{className:"h-3.5 w-3.5 shrink-0 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(ue,{agent:l??e,size:24}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"min-w-(--sz-7rem) truncate",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[he[e.role]??e.role,l?.title?` - ${l.title}`:""]})]}),u&&h&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(fe,{status:u.status}),u.status==="needs_setup"&&(0,t.jsx)("span",{onClick:n(d=>{d.preventDefault(),d.stopPropagation()},"onClick"),children:(0,t.jsx)(V,{size:"xs",variant:"outline",onClick:n(()=>p(u),"onClick"),children:"Set up"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,t.jsx)("span",{className:"sm:hidden",children:r.has(e.id)?(0,t.jsx)(Q,{agentRef:l?U(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}):(0,t.jsx)(H,{status:e.status})}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[r.has(e.id)&&(0,t.jsx)(Q,{agentRef:l?U(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}),l&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(we,{agent:l,environment:x?ve:o.get(l.id)??J,showEnvironment:C})}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(H,{status:e.status})})]}),(0,t.jsx)(pe,{state:E,pending:y,pendingState:y?m.variables?.state:null,resourceName:e.name,onJoin:n(()=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,state:"joined"}),"onJoin"),onLeave:n(()=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,state:"left"}),"onLeave")}),(0,t.jsx)("div",{className:"hidden sm:flex items-center gap-3",children:(0,t.jsx)(xe,{size:"row",starred:_,pending:k,resourceName:e.name,onToggle:n(d=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,starred:d}),"onToggle")})})]})]}),e.reports&&e.reports.length>0&&(0,t.jsx)("div",{className:"border-l border-border ml-4",children:e.reports.map(d=>(0,t.jsx)(ye,{node:d,depth:a+1,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:x,showEnvironment:C,tab:v,memberships:S,membershipMutation:m,builtInByAgentId:A,onConfigureBuiltIn:p},d.id))})]})}n(ye,"OrgTreeNode");function we({agent:e,environment:a,showEnvironment:i}){const r=ut(e),o=et(e.adapterType);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs text-muted-foreground",title:r??void 0,children:r??"—"}),(0,t.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground/70",title:o,children:o})]}),i&&(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",title:a.title,children:a.label}),(0,t.jsx)("div",{className:"truncate text-(length:--text-micro) text-muted-foreground/70",children:a.detail})]}),(0,t.jsx)("span",{className:"w-24 whitespace-nowrap text-right text-xs text-muted-foreground",children:e.lastHeartbeatAt?Re(e.lastHeartbeatAt):"—"})]})}n(we,"AgentMetaColumns");function Q({agentRef:e,runId:a,liveCount:i}){return(0,t.jsxs)(de,{to:`/agents/${e}/runs/${a}`,className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline",onClick:n(r=>r.stopPropagation(),"onClick"),children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),(0,t.jsxs)("span",{className:"text-(length:--text-micro) font-medium text-blue-600 dark:text-blue-400",children:["Live",i>1?` (${i})`:""]})]})}n(Q,"LiveRunIndicator");export{Mt as Agents};
@@ -1 +1 @@
1
- var xe=Object.defineProperty;var r=(t,a)=>xe(t,"name",{value:a,configurable:!0});import{i as ne}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as pe,Lr as he,S as ge,U as fe,Y as G,Yn as W,nr as X,z as ye}from"./createLucideIcon-CZEG6UJ7.js";import{ct as ve,t as re}from"./router-G1KztA90.js";import{r as ee,t as je}from"./AgentAvatar-CnpBTXF0.js";import{i as te,r as be,t as Ne}from"./tabs-D8G3-AL7.js";import{t as we}from"./agents-ZcIBncVi.js";import{r as Ae,t as Te}from"./EmptyState-DeVTy8IU.js";import{c as _,i as y,n as D,s as F,t as k}from"./select-DSr2hsz2.js";import{t as T}from"./button-LkWt40cm.js";import{t as se}from"./input-a7SggR2b.js";import{o as Se,r as Ce}from"./company-members-Dyq_pnza.js";import{r as v,t as j}from"./card-DbvoJZ3K.js";import{Gn as Ee,O as ae,Pn as Ie,Rt as Ue,_n as Pe,bn as Le,fn as Re,yn as _e}from"./index-BRCs87uX.js";var l=ne(he(),1),e=ne(pe(),1),De=50,n="__all",Fe=[{value:n,label:"All actions"},{value:"issue.",label:"Tasks"},{value:"agent.",label:"Agents"},{value:"heartbeat.",label:"Runs"},{value:"approval.",label:"Approvals"},{value:"project.",label:"Projects"},{value:"goal.",label:"Goals"},{value:"tool_gateway.",label:"Tools"},{value:"cost.",label:"Costs"},{value:"company.",label:"Company"}],ke=[{value:n,label:"All entities"},{value:"issue",label:"Task"},{value:"agent",label:"Agent"},{value:"project",label:"Project"},{value:"goal",label:"Goal"},{value:"company",label:"Company"}];function Be(t){if(!t)return;const a=new Date(`${t}T00:00:00.000Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Be,"toStartIso");function Ve(t){if(!t)return;const a=new Date(`${t}T23:59:59.999Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Ve,"toEndIso");function $e({record:t,agentMap:a,userProfileMap:d}){const u=t.agentId??(t.actorType==="agent"?t.actorId:null),c=u?a.get(u):null;if(c)return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",title:c.name,children:[(0,e.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,e.jsx)(je,{agent:c,size:16,className:"h-3 w-3"})}),(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:c.name})]});if(t.actorType==="user"&&t.actorId){const m=d.get(t.actorId);return(0,e.jsx)(ee,{name:m?.label??"User",avatarUrl:m?.image??null,size:"sm",className:"font-medium text-foreground"})}const h=t.actorType==="plugin"?"Plugin":t.actorType==="agent"?"Agent":t.actorType==="user"?"User":"System";return(0,e.jsx)(ee,{name:h,size:"sm",className:"font-medium text-foreground"})}r($e,"AuditActor");function qe({record:t}){const{issue:a,document:d}=t.entity,u=a?.identifier??a?.id??null;return u?(0,e.jsx)(re,{to:`/issues/${u}`,className:"font-medium text-primary hover:underline",children:a?.identifier?`${a.identifier}${a.title?` · ${a.title}`:""}`:"the task"}):d?(0,e.jsx)("span",{className:"font-medium text-foreground",children:d.key}):(0,e.jsx)("span",{className:"text-muted-foreground",children:t.entityType})}r(qe,"AuditEntityNode");function ze({record:t,agentMap:a,userProfileMap:d}){const u=Ue(t.action,t.details,{agentMap:a,userProfileMap:d}),c=t.responsibleUserId?d.get(t.responsibleUserId):null,h=!!(t.responsibleUserId&&!(t.actorType==="user"&&t.actorId===t.responsibleUserId)),m=c?.label??(t.responsibleUserId?"a user":null),g=t.entity.comment?.excerpt?.trim(),x=t.entity.issue&&t.entity.document?t.entity.document.key:null;return(0,e.jsx)("li",{className:"px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-foreground",children:[(0,e.jsx)($e,{record:t,agentMap:a,userProfileMap:d}),(0,e.jsx)("span",{className:"text-muted-foreground",children:u}),(0,e.jsx)(qe,{record:t})]}),g?(0,e.jsxs)("p",{className:"line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground",children:["“",g,"”"]}):null,x?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Document ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:x})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h&&m?(0,e.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5",children:["on behalf of ",m]}):null,t.runId&&t.agentId?(0,e.jsx)(re,{to:`/agents/${t.agentId}/runs/${t.runId}`,className:"text-primary hover:underline",children:"View run"}):null,(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro) opacity-70",children:t.action})]})]}),(0,e.jsx)("time",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),children:ye(t.createdAt)})]})})}r(ze,"AuditRow");function Me(){return(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(Pe,{className:"h-10 w-10 text-muted-foreground/50"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Agent audit is a Paperclip Enterprise view"}),(0,e.jsxs)("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["The agent audit log gives you a searchable, exportable record of everything your agents did — every comment, task change, approval, and run — with the responsible person for each action. Ask an administrator to grant you the"," ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:"audit:view_agent_actions"})," ","permission to view it."]})]})]})})}r(Me,"AuditUpsell");function Oe({companyId:t,lockedAgentId:a,hideHeader:d,mode:u,onModeChange:c}){const{pushToast:h}=Re(),[m,g]=(0,l.useState)(n),[x,B]=(0,l.useState)(n),[S,V]=(0,l.useState)(n),[C,$]=(0,l.useState)(n),[E,q]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),[U,H]=(0,l.useState)(!1),M=X({queryKey:G.agents.list(t),queryFn:r(()=>we.list(t),"queryFn")}),O=X({queryKey:G.access.companyUserDirectory(t),queryFn:r(()=>Se.listUserDirectory(t),"queryFn"),retry:!1}),ie=(0,l.useMemo)(()=>new Map((M.data??[]).map(s=>[s.id,s])),[M.data]),le=(0,l.useMemo)(()=>Ce(O.data?.users),[O.data]),f=a?"agents":u??"all",o={actorScope:f,agentId:a??(m===n?void 0:m),responsibleUserId:x===n?void 0:x,action:S===n?void 0:S,entityType:C===n?void 0:C,from:Be(E),to:Ve(I)},b=!!(!a&&m!==n||x!==n||S!==n||C!==n||E||I),i=Ee({queryKey:G.audit.agentActions(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),queryFn:r(({pageParam:s})=>ae.listAgentActions(t,{...o,limit:De,cursor:s??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:r(s=>s.nextCursor??void 0,"getNextPageParam"),retry:r((s,p)=>!(p instanceof W&&p.status===403)&&s<2,"retry")}),K=i.error instanceof W&&i.error.status===403,P=i.data?.pages.some(s=>s.accessTier==="basic")??!1,oe=i.data?.pages.some(s=>s.accessTier==="full")??!1,Y=(0,l.useMemo)(()=>{const s=i.data?.pages??[];return(P?s.filter(p=>p.accessTier!=="full"):s).flatMap(p=>p.items)},[i.data,P]),L=P?"basic":i.data?.pages[0]?.accessTier,N=P&&oe,ce=a?!0:L==="full",de=!!(N&&U&&!i.isFetching),R=!!(!a&&!de&&(K&&b||N)),w=!!(K&&!a&&f==="agents"&&c),ue=!!(!a&&c&&!w&&(f==="agents"||L==="full"));(0,l.useEffect)(()=>{w&&c?.("all")},[w,c]),(0,l.useEffect)(()=>{!a&&(L==="basic"||R)&&(g(n),B(n),V(n),$(n),q(""),z(""))},[L,N,a,R]),(0,l.useEffect)(()=>{if(!N){U&&H(!1);return}U||(H(!0),i.refetch())},[U,i,N]);const J=r(()=>{g(n),B(n),V(n),$(n),q(""),z("")},"clearFilters"),me=r(async()=>{Q(!0);try{const s=await ae.exportAgentActionsCsv(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),p=URL.createObjectURL(s),A=document.createElement("a");A.href=p,A.download=`${f==="agents"?"agent-audit":"activity"}-${t}.csv`,document.body.appendChild(A),A.click(),A.remove(),window.setTimeout(()=>URL.revokeObjectURL(p),5e3),h({title:"Audit exported",body:"Your CSV download has started.",tone:"success"})}catch(s){h({title:"Export failed",body:s instanceof Error?s.message:"Could not export the audit log.",tone:"error"})}finally{Q(!1)}},"handleExport");return K&&!R&&!w?(0,e.jsx)(Me,{}):(0,e.jsxs)("div",{className:"space-y-4",children:[d?null:(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Activity"}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:f==="agents"?"Every recorded agent action, newest first — with the responsible person and run behind each one.":"Everything happening in your company, newest first — people, agents, and the system. Each line is one recorded action."})]})}),ue?(0,e.jsx)(Ne,{value:f,onValueChange:r(s=>c?.(s),"onValueChange"),children:(0,e.jsxs)(be,{"aria-label":"Activity scope",children:[(0,e.jsx)(te,{value:"all",children:"All activity"}),(0,e.jsx)(te,{value:"agents",children:"Agent actions"})]})}):null,ce?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a?null:(0,e.jsxs)(k,{value:m,onValueChange:g,children:[(0,e.jsx)(F,{className:"w-40",children:(0,e.jsx)(_,{placeholder:"Agent"})}),(0,e.jsxs)(D,{children:[(0,e.jsx)(y,{value:n,children:"All agents"}),(M.data??[]).map(s=>(0,e.jsx)(y,{value:s.id,children:s.name},s.id))]})]}),(0,e.jsxs)(k,{value:x,onValueChange:B,children:[(0,e.jsx)(F,{className:"w-52",children:(0,e.jsx)(_,{placeholder:"Responsible user"})}),(0,e.jsxs)(D,{children:[(0,e.jsx)(y,{value:n,children:"All responsible users"}),(O.data?.users??[]).map(s=>(0,e.jsx)(y,{value:s.principalId,children:s.user?.name??s.user?.email??s.principalId.slice(0,8)},s.principalId))]})]}),(0,e.jsxs)(k,{value:S,onValueChange:V,children:[(0,e.jsx)(F,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Action"})}),(0,e.jsx)(D,{children:Fe.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsxs)(k,{value:C,onValueChange:$,children:[(0,e.jsx)(F,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Entity"})}),(0,e.jsx)(D,{children:ke.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsx)(se,{type:"date","aria-label":"From date",value:E,max:I||void 0,onChange:r(s=>q(s.target.value),"onChange"),className:"w-36"}),(0,e.jsx)(se,{type:"date","aria-label":"To date",value:I,min:E||void 0,onChange:r(s=>z(s.target.value),"onChange"),className:"w-36"}),b?(0,e.jsx)(T,{variant:"ghost",size:"sm",onClick:J,children:"Clear filters"}):null,(0,e.jsxs)(T,{variant:"outline",size:"sm",className:"ml-auto",onClick:me,disabled:Z||i.isLoading||Y.length===0,children:[(0,e.jsx)(Ie,{className:"mr-1.5 h-4 w-4"}),Z?"Exporting…":"Export CSV"]})]}):null,R||w?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Refreshing audit access…"})}):i.isLoading?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Loading…"})}):i.error?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i.error instanceof Error?i.error.message:"Failed to load the audit log."}),(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.refetch(),"onClick"),children:"Try again"})]})}):Y.length===0?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(_e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:b?"No actions match these filters":"Nothing here yet"}),(0,e.jsx)("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:b?"Try a wider date range or different filters.":f==="agents"?"As soon as your agents start doing things, their actions show up here.":"As soon as anyone in your company does something, it shows up here."})]}),b?(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:J,children:"Clear filters"}):null]})}):(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"px-0 py-0",children:(0,e.jsx)("ul",{className:ge("divide-y divide-border"),children:Y.map(s=>(0,e.jsx)(ze,{record:s,agentMap:ie,userProfileMap:le},s.id))})})}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null,(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recorded by Paperclip — entries can't be edited. Sensitive values are never stored."})]})}r(Oe,"AuditFeed");function rt(){const{selectedCompanyId:t}=fe(),{setBreadcrumbs:a}=Ae(),[d,u]=ve(),c=d.get("mode")==="agents"?"agents":"all";(0,l.useEffect)(()=>{a([{label:"Activity"}])},[a]);const h=(0,l.useCallback)(m=>{u(g=>{const x=new URLSearchParams(g);return m==="agents"?x.set("mode","agents"):x.delete("mode"),x},{replace:!0})},[u]);return t?(0,e.jsx)(Oe,{companyId:t,mode:c,onModeChange:h}):(0,e.jsx)(Te,{icon:Le,message:"Select a company to view activity."})}r(rt,"CompanyActivity");export{rt as CompanyActivity};
1
+ var xe=Object.defineProperty;var r=(t,a)=>xe(t,"name",{value:a,configurable:!0});import{i as ne}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as pe,Lr as he,S as ge,U as fe,Y as G,Yn as W,nr as X,z as ye}from"./createLucideIcon-CZEG6UJ7.js";import{ct as ve,t as re}from"./router-G1KztA90.js";import{r as ee,t as je}from"./AgentAvatar-CnpBTXF0.js";import{i as te,r as be,t as Ne}from"./tabs-D8G3-AL7.js";import{t as we}from"./agents-ZcIBncVi.js";import{r as Ae,t as Te}from"./EmptyState-DeVTy8IU.js";import{c as _,i as y,n as D,s as F,t as k}from"./select-DSr2hsz2.js";import{t as T}from"./button-LkWt40cm.js";import{t as se}from"./input-a7SggR2b.js";import{o as Se,r as Ce}from"./company-members-Dyq_pnza.js";import{r as v,t as j}from"./card-DbvoJZ3K.js";import{Gn as Ee,O as ae,Pn as Ie,Rt as Ue,_n as Pe,bn as Le,fn as Re,yn as _e}from"./index-DbWxivZc.js";var l=ne(he(),1),e=ne(pe(),1),De=50,n="__all",Fe=[{value:n,label:"All actions"},{value:"issue.",label:"Tasks"},{value:"agent.",label:"Agents"},{value:"heartbeat.",label:"Runs"},{value:"approval.",label:"Approvals"},{value:"project.",label:"Projects"},{value:"goal.",label:"Goals"},{value:"tool_gateway.",label:"Tools"},{value:"cost.",label:"Costs"},{value:"company.",label:"Company"}],ke=[{value:n,label:"All entities"},{value:"issue",label:"Task"},{value:"agent",label:"Agent"},{value:"project",label:"Project"},{value:"goal",label:"Goal"},{value:"company",label:"Company"}];function Be(t){if(!t)return;const a=new Date(`${t}T00:00:00.000Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Be,"toStartIso");function Ve(t){if(!t)return;const a=new Date(`${t}T23:59:59.999Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Ve,"toEndIso");function $e({record:t,agentMap:a,userProfileMap:d}){const u=t.agentId??(t.actorType==="agent"?t.actorId:null),c=u?a.get(u):null;if(c)return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",title:c.name,children:[(0,e.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,e.jsx)(je,{agent:c,size:16,className:"h-3 w-3"})}),(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:c.name})]});if(t.actorType==="user"&&t.actorId){const m=d.get(t.actorId);return(0,e.jsx)(ee,{name:m?.label??"User",avatarUrl:m?.image??null,size:"sm",className:"font-medium text-foreground"})}const h=t.actorType==="plugin"?"Plugin":t.actorType==="agent"?"Agent":t.actorType==="user"?"User":"System";return(0,e.jsx)(ee,{name:h,size:"sm",className:"font-medium text-foreground"})}r($e,"AuditActor");function qe({record:t}){const{issue:a,document:d}=t.entity,u=a?.identifier??a?.id??null;return u?(0,e.jsx)(re,{to:`/issues/${u}`,className:"font-medium text-primary hover:underline",children:a?.identifier?`${a.identifier}${a.title?` · ${a.title}`:""}`:"the task"}):d?(0,e.jsx)("span",{className:"font-medium text-foreground",children:d.key}):(0,e.jsx)("span",{className:"text-muted-foreground",children:t.entityType})}r(qe,"AuditEntityNode");function ze({record:t,agentMap:a,userProfileMap:d}){const u=Ue(t.action,t.details,{agentMap:a,userProfileMap:d}),c=t.responsibleUserId?d.get(t.responsibleUserId):null,h=!!(t.responsibleUserId&&!(t.actorType==="user"&&t.actorId===t.responsibleUserId)),m=c?.label??(t.responsibleUserId?"a user":null),g=t.entity.comment?.excerpt?.trim(),x=t.entity.issue&&t.entity.document?t.entity.document.key:null;return(0,e.jsx)("li",{className:"px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-foreground",children:[(0,e.jsx)($e,{record:t,agentMap:a,userProfileMap:d}),(0,e.jsx)("span",{className:"text-muted-foreground",children:u}),(0,e.jsx)(qe,{record:t})]}),g?(0,e.jsxs)("p",{className:"line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground",children:["“",g,"”"]}):null,x?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Document ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:x})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h&&m?(0,e.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5",children:["on behalf of ",m]}):null,t.runId&&t.agentId?(0,e.jsx)(re,{to:`/agents/${t.agentId}/runs/${t.runId}`,className:"text-primary hover:underline",children:"View run"}):null,(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro) opacity-70",children:t.action})]})]}),(0,e.jsx)("time",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),children:ye(t.createdAt)})]})})}r(ze,"AuditRow");function Me(){return(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(Pe,{className:"h-10 w-10 text-muted-foreground/50"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Agent audit is a Paperclip Enterprise view"}),(0,e.jsxs)("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["The agent audit log gives you a searchable, exportable record of everything your agents did — every comment, task change, approval, and run — with the responsible person for each action. Ask an administrator to grant you the"," ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:"audit:view_agent_actions"})," ","permission to view it."]})]})]})})}r(Me,"AuditUpsell");function Oe({companyId:t,lockedAgentId:a,hideHeader:d,mode:u,onModeChange:c}){const{pushToast:h}=Re(),[m,g]=(0,l.useState)(n),[x,B]=(0,l.useState)(n),[S,V]=(0,l.useState)(n),[C,$]=(0,l.useState)(n),[E,q]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),[U,H]=(0,l.useState)(!1),M=X({queryKey:G.agents.list(t),queryFn:r(()=>we.list(t),"queryFn")}),O=X({queryKey:G.access.companyUserDirectory(t),queryFn:r(()=>Se.listUserDirectory(t),"queryFn"),retry:!1}),ie=(0,l.useMemo)(()=>new Map((M.data??[]).map(s=>[s.id,s])),[M.data]),le=(0,l.useMemo)(()=>Ce(O.data?.users),[O.data]),f=a?"agents":u??"all",o={actorScope:f,agentId:a??(m===n?void 0:m),responsibleUserId:x===n?void 0:x,action:S===n?void 0:S,entityType:C===n?void 0:C,from:Be(E),to:Ve(I)},b=!!(!a&&m!==n||x!==n||S!==n||C!==n||E||I),i=Ee({queryKey:G.audit.agentActions(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),queryFn:r(({pageParam:s})=>ae.listAgentActions(t,{...o,limit:De,cursor:s??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:r(s=>s.nextCursor??void 0,"getNextPageParam"),retry:r((s,p)=>!(p instanceof W&&p.status===403)&&s<2,"retry")}),K=i.error instanceof W&&i.error.status===403,P=i.data?.pages.some(s=>s.accessTier==="basic")??!1,oe=i.data?.pages.some(s=>s.accessTier==="full")??!1,Y=(0,l.useMemo)(()=>{const s=i.data?.pages??[];return(P?s.filter(p=>p.accessTier!=="full"):s).flatMap(p=>p.items)},[i.data,P]),L=P?"basic":i.data?.pages[0]?.accessTier,N=P&&oe,ce=a?!0:L==="full",de=!!(N&&U&&!i.isFetching),R=!!(!a&&!de&&(K&&b||N)),w=!!(K&&!a&&f==="agents"&&c),ue=!!(!a&&c&&!w&&(f==="agents"||L==="full"));(0,l.useEffect)(()=>{w&&c?.("all")},[w,c]),(0,l.useEffect)(()=>{!a&&(L==="basic"||R)&&(g(n),B(n),V(n),$(n),q(""),z(""))},[L,N,a,R]),(0,l.useEffect)(()=>{if(!N){U&&H(!1);return}U||(H(!0),i.refetch())},[U,i,N]);const J=r(()=>{g(n),B(n),V(n),$(n),q(""),z("")},"clearFilters"),me=r(async()=>{Q(!0);try{const s=await ae.exportAgentActionsCsv(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),p=URL.createObjectURL(s),A=document.createElement("a");A.href=p,A.download=`${f==="agents"?"agent-audit":"activity"}-${t}.csv`,document.body.appendChild(A),A.click(),A.remove(),window.setTimeout(()=>URL.revokeObjectURL(p),5e3),h({title:"Audit exported",body:"Your CSV download has started.",tone:"success"})}catch(s){h({title:"Export failed",body:s instanceof Error?s.message:"Could not export the audit log.",tone:"error"})}finally{Q(!1)}},"handleExport");return K&&!R&&!w?(0,e.jsx)(Me,{}):(0,e.jsxs)("div",{className:"space-y-4",children:[d?null:(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Activity"}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:f==="agents"?"Every recorded agent action, newest first — with the responsible person and run behind each one.":"Everything happening in your company, newest first — people, agents, and the system. Each line is one recorded action."})]})}),ue?(0,e.jsx)(Ne,{value:f,onValueChange:r(s=>c?.(s),"onValueChange"),children:(0,e.jsxs)(be,{"aria-label":"Activity scope",children:[(0,e.jsx)(te,{value:"all",children:"All activity"}),(0,e.jsx)(te,{value:"agents",children:"Agent actions"})]})}):null,ce?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a?null:(0,e.jsxs)(k,{value:m,onValueChange:g,children:[(0,e.jsx)(F,{className:"w-40",children:(0,e.jsx)(_,{placeholder:"Agent"})}),(0,e.jsxs)(D,{children:[(0,e.jsx)(y,{value:n,children:"All agents"}),(M.data??[]).map(s=>(0,e.jsx)(y,{value:s.id,children:s.name},s.id))]})]}),(0,e.jsxs)(k,{value:x,onValueChange:B,children:[(0,e.jsx)(F,{className:"w-52",children:(0,e.jsx)(_,{placeholder:"Responsible user"})}),(0,e.jsxs)(D,{children:[(0,e.jsx)(y,{value:n,children:"All responsible users"}),(O.data?.users??[]).map(s=>(0,e.jsx)(y,{value:s.principalId,children:s.user?.name??s.user?.email??s.principalId.slice(0,8)},s.principalId))]})]}),(0,e.jsxs)(k,{value:S,onValueChange:V,children:[(0,e.jsx)(F,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Action"})}),(0,e.jsx)(D,{children:Fe.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsxs)(k,{value:C,onValueChange:$,children:[(0,e.jsx)(F,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Entity"})}),(0,e.jsx)(D,{children:ke.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsx)(se,{type:"date","aria-label":"From date",value:E,max:I||void 0,onChange:r(s=>q(s.target.value),"onChange"),className:"w-36"}),(0,e.jsx)(se,{type:"date","aria-label":"To date",value:I,min:E||void 0,onChange:r(s=>z(s.target.value),"onChange"),className:"w-36"}),b?(0,e.jsx)(T,{variant:"ghost",size:"sm",onClick:J,children:"Clear filters"}):null,(0,e.jsxs)(T,{variant:"outline",size:"sm",className:"ml-auto",onClick:me,disabled:Z||i.isLoading||Y.length===0,children:[(0,e.jsx)(Ie,{className:"mr-1.5 h-4 w-4"}),Z?"Exporting…":"Export CSV"]})]}):null,R||w?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Refreshing audit access…"})}):i.isLoading?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Loading…"})}):i.error?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i.error instanceof Error?i.error.message:"Failed to load the audit log."}),(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.refetch(),"onClick"),children:"Try again"})]})}):Y.length===0?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(_e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:b?"No actions match these filters":"Nothing here yet"}),(0,e.jsx)("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:b?"Try a wider date range or different filters.":f==="agents"?"As soon as your agents start doing things, their actions show up here.":"As soon as anyone in your company does something, it shows up here."})]}),b?(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:J,children:"Clear filters"}):null]})}):(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"px-0 py-0",children:(0,e.jsx)("ul",{className:ge("divide-y divide-border"),children:Y.map(s=>(0,e.jsx)(ze,{record:s,agentMap:ie,userProfileMap:le},s.id))})})}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null,(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recorded by Paperclip — entries can't be edited. Sensitive values are never stored."})]})}r(Oe,"AuditFeed");function rt(){const{selectedCompanyId:t}=fe(),{setBreadcrumbs:a}=Ae(),[d,u]=ve(),c=d.get("mode")==="agents"?"agents":"all";(0,l.useEffect)(()=>{a([{label:"Activity"}])},[a]);const h=(0,l.useCallback)(m=>{u(g=>{const x=new URLSearchParams(g);return m==="agents"?x.set("mode","agents"):x.delete("mode"),x},{replace:!0})},[u]);return t?(0,e.jsx)(Oe,{companyId:t,mode:c,onModeChange:h}):(0,e.jsx)(Te,{icon:Le,message:"Select a company to view activity."})}r(rt,"CompanyActivity");export{rt as CompanyActivity};