@getmateo/protocol 0.0.0-stage → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +211 -0
- package/README.md +11 -2
- package/dist/addresses.d.ts +6 -0
- package/dist/addresses.js +2 -0
- package/dist/agent-attention-notification.d.ts +57 -0
- package/dist/agent-attention-notification.js +177 -0
- package/dist/agent-deep-link.d.ts +8 -0
- package/dist/agent-deep-link.js +49 -0
- package/dist/agent-labels.d.ts +14 -0
- package/dist/agent-labels.js +38 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-message.d.ts +20 -0
- package/dist/agent-message.js +12 -0
- package/dist/agent-profile.d.ts +31 -0
- package/dist/agent-profile.js +32 -0
- package/dist/agent-runtime-config.d.ts +4 -0
- package/dist/agent-runtime-config.js +5 -0
- package/dist/agent-shells.d.ts +25 -0
- package/dist/agent-shells.js +17 -0
- package/dist/agent-state-bucket.d.ts +15 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +2 -0
- package/dist/agent-title-limits.js +2 -0
- package/dist/agent-types.d.ts +484 -0
- package/dist/agent-types.js +33 -0
- package/dist/binary-frames/demux.d.ts +15 -0
- package/dist/binary-frames/demux.js +28 -0
- package/dist/binary-frames/file-transfer.d.ts +51 -0
- package/dist/binary-frames/file-transfer.js +108 -0
- package/dist/binary-frames/host-route.d.ts +13 -0
- package/dist/binary-frames/host-route.js +39 -0
- package/dist/binary-frames/index.d.ts +5 -0
- package/dist/binary-frames/index.js +5 -0
- package/dist/binary-frames/terminal.d.ts +35 -0
- package/dist/binary-frames/terminal.js +100 -0
- package/dist/branch-slug.d.ts +14 -0
- package/dist/branch-slug.js +49 -0
- package/dist/browser-automation/capabilities.d.ts +7 -0
- package/dist/browser-automation/capabilities.js +31 -0
- package/dist/browser-automation/rpc-schemas.d.ts +1113 -0
- package/dist/browser-automation/rpc-schemas.js +463 -0
- package/dist/build-metadata.d.ts +17 -0
- package/dist/build-metadata.js +61 -0
- package/dist/chat/rpc-schemas.d.ts +158 -0
- package/dist/chat/rpc-schemas.js +104 -0
- package/dist/chat/types.d.ts +30 -0
- package/dist/chat/types.js +23 -0
- package/dist/check-traits.d.ts +11 -0
- package/dist/check-traits.js +10 -0
- package/dist/chunked-transport.d.ts +42 -0
- package/dist/chunked-transport.js +277 -0
- package/dist/client-capabilities.d.ts +24 -0
- package/dist/client-capabilities.js +52 -0
- package/dist/connection-offer.d.ts +36 -0
- package/dist/connection-offer.js +53 -0
- package/dist/daemon-auth.d.ts +548 -0
- package/dist/daemon-auth.js +152 -0
- package/dist/daemon-endpoints.d.ts +54 -0
- package/dist/daemon-endpoints.js +243 -0
- package/dist/error-utils.d.ts +11 -0
- package/dist/error-utils.js +27 -0
- package/dist/fleet.d.ts +381 -0
- package/dist/fleet.js +134 -0
- package/dist/forge-manifest.d.ts +66 -0
- package/dist/forge-manifest.js +92 -0
- package/dist/generated/validation/ws-outbound-schema-metadata.d.ts +14023 -0
- package/dist/generated/validation/ws-outbound-schema-metadata.js +258 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +512 -0
- package/dist/generated/validation/ws-outbound.aot.js +105425 -0
- package/dist/git-remote.d.ts +33 -0
- package/dist/git-remote.js +94 -0
- package/dist/gitea-status.d.ts +10 -0
- package/dist/gitea-status.js +23 -0
- package/dist/gitlab-pipeline.d.ts +10 -0
- package/dist/gitlab-pipeline.js +17 -0
- package/dist/global-terminal.d.ts +3 -0
- package/dist/global-terminal.js +8 -0
- package/dist/host-connection-schema.d.ts +11 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/host-target.d.ts +20 -0
- package/dist/host-target.js +137 -0
- package/dist/hosts.d.ts +133 -0
- package/dist/hosts.js +82 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +636 -0
- package/dist/loop/rpc-schemas.js +164 -0
- package/dist/mateo-config-schema.d.ts +138 -0
- package/dist/mateo-config-schema.js +98 -0
- package/dist/mateo-tool-call-detail.d.ts +2 -0
- package/dist/mateo-tool-call-detail.js +3 -0
- package/dist/mateo-tool-presentation/agent-message.d.ts +10 -0
- package/dist/mateo-tool-presentation/agent-message.js +23 -0
- package/dist/mateo-tool-presentation/catalog.d.ts +320 -0
- package/dist/mateo-tool-presentation/catalog.js +318 -0
- package/dist/mateo-tool-presentation/detail-sections.d.ts +15 -0
- package/dist/mateo-tool-presentation/detail-sections.js +161 -0
- package/dist/mateo-tool-presentation/index.d.ts +22 -0
- package/dist/mateo-tool-presentation/index.js +62 -0
- package/dist/mateo-tool-presentation/summary-text.d.ts +7 -0
- package/dist/mateo-tool-presentation/summary-text.js +22 -0
- package/dist/messages.d.ts +69382 -0
- package/dist/messages.js +6717 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/plugin-config.d.ts +18 -0
- package/dist/plugin-config.js +13 -0
- package/dist/plugin-overview.d.ts +12 -0
- package/dist/plugin-overview.js +50 -0
- package/dist/plugin-registry.d.ts +153 -0
- package/dist/plugin-registry.js +83 -0
- package/dist/plugin-requirements.d.ts +11 -0
- package/dist/plugin-requirements.js +26 -0
- package/dist/plugin-source-reference.d.ts +11 -0
- package/dist/plugin-source-reference.js +68 -0
- package/dist/provider-config.d.ts +141 -0
- package/dist/provider-config.js +113 -0
- package/dist/provider-icon-names.d.ts +5 -0
- package/dist/provider-icon-names.js +54 -0
- package/dist/provider-manifest.d.ts +30 -0
- package/dist/provider-manifest.js +247 -0
- package/dist/provider-snapshot-codec.d.ts +18 -0
- package/dist/provider-snapshot-codec.js +71 -0
- package/dist/schedule/cadence.d.ts +6 -0
- package/dist/schedule/cadence.js +28 -0
- package/dist/schedule/cron-expression.d.ts +14 -0
- package/dist/schedule/cron-expression.js +107 -0
- package/dist/schedule/rpc-schemas.d.ts +570 -0
- package/dist/schedule/rpc-schemas.js +158 -0
- package/dist/schedule/types.d.ts +201 -0
- package/dist/schedule/types.js +68 -0
- package/dist/search/text-match.d.ts +78 -0
- package/dist/search/text-match.js +330 -0
- package/dist/service-defaults.d.ts +3 -0
- package/dist/service-defaults.js +5 -0
- package/dist/ssh-transport.d.ts +11 -0
- package/dist/ssh-transport.js +72 -0
- package/dist/terminal-activity.d.ts +21 -0
- package/dist/terminal-activity.js +25 -0
- package/dist/terminal-input-mode.d.ts +30 -0
- package/dist/terminal-input-mode.js +180 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +210 -0
- package/dist/terminal-profile.d.ts +10 -0
- package/dist/terminal-profile.js +11 -0
- package/dist/terminal-profiles.d.ts +41 -0
- package/dist/terminal-profiles.js +276 -0
- package/dist/terminal-snapshot.d.ts +4 -0
- package/dist/terminal-snapshot.js +220 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/terminal-subscription-key.d.ts +2 -0
- package/dist/terminal-subscription-key.js +9 -0
- package/dist/timeline-identity.d.ts +3 -0
- package/dist/timeline-identity.js +8 -0
- package/dist/tool-call-display.d.ts +13 -0
- package/dist/tool-call-display.js +144 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/dist/user-agent.d.ts +26 -0
- package/dist/user-agent.js +101 -0
- package/dist/validation/ws-outbound-envelope.d.ts +13261 -0
- package/dist/validation/ws-outbound-envelope.js +17 -0
- package/dist/validation/ws-outbound.d.ts +12 -0
- package/dist/validation/ws-outbound.js +38 -0
- package/dist/websocket-message-limit.d.ts +5 -0
- package/dist/websocket-message-limit.js +5 -0
- package/dist/workspace-labels.d.ts +9 -0
- package/dist/workspace-labels.js +19 -0
- package/package.json +43 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Copyright (c) 2025-present Mohamed Boudra
|
|
2
|
+
|
|
3
|
+
Portions of this software are licensed as follows:
|
|
4
|
+
|
|
5
|
+
* Third-party components incorporated into Mateo remain licensed under
|
|
6
|
+
the licenses provided by their respective copyright holders.
|
|
7
|
+
* Except for those third-party components, Mateo is licensed under the
|
|
8
|
+
Apache License, Version 2.0, reproduced below.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Apache License
|
|
12
|
+
Version 2.0, January 2004
|
|
13
|
+
http://www.apache.org/licenses/
|
|
14
|
+
|
|
15
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
16
|
+
|
|
17
|
+
1. Definitions.
|
|
18
|
+
|
|
19
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
20
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
21
|
+
|
|
22
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
23
|
+
the copyright owner that is granting the License.
|
|
24
|
+
|
|
25
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
26
|
+
other entities that control, are controlled by, or are under common
|
|
27
|
+
control with that entity. For the purposes of this definition,
|
|
28
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
29
|
+
direction or management of such entity, whether by contract or
|
|
30
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
31
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
32
|
+
|
|
33
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
34
|
+
exercising permissions granted by this License.
|
|
35
|
+
|
|
36
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
37
|
+
including but not limited to software source code, documentation
|
|
38
|
+
source, and configuration files.
|
|
39
|
+
|
|
40
|
+
"Object" form shall mean any form resulting from mechanical
|
|
41
|
+
transformation or translation of a Source form, including but
|
|
42
|
+
not limited to compiled object code, generated documentation,
|
|
43
|
+
and conversions to other media types.
|
|
44
|
+
|
|
45
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
46
|
+
Object form, made available under the License, as indicated by a
|
|
47
|
+
copyright notice that is included in or attached to the work
|
|
48
|
+
(an example is provided in the Appendix below).
|
|
49
|
+
|
|
50
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
51
|
+
form, that is based on (or derived from) the Work and for which the
|
|
52
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
53
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
54
|
+
of this License, Derivative Works shall not include works that remain
|
|
55
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
56
|
+
the Work and Derivative Works thereof.
|
|
57
|
+
|
|
58
|
+
"Contribution" shall mean any work of authorship, including
|
|
59
|
+
the original version of the Work and any modifications or additions
|
|
60
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
61
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
62
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
63
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
64
|
+
means any form of electronic, verbal, or written communication sent
|
|
65
|
+
to the Licensor or its representatives, including but not limited to
|
|
66
|
+
communication on electronic mailing lists, source code control systems,
|
|
67
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
68
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
69
|
+
excluding communication that is conspicuously marked or otherwise
|
|
70
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
71
|
+
|
|
72
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
73
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
74
|
+
subsequently incorporated within the Work.
|
|
75
|
+
|
|
76
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
80
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
81
|
+
Work and such Derivative Works in Source or Object form.
|
|
82
|
+
|
|
83
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
84
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
85
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
86
|
+
(except as stated in this section) patent license to make, have made,
|
|
87
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
88
|
+
where such license applies only to those patent claims licensable
|
|
89
|
+
by such Contributor that are necessarily infringed by their
|
|
90
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
91
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
92
|
+
institute patent litigation against any entity (including a
|
|
93
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
94
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
95
|
+
or contributory patent infringement, then any patent licenses
|
|
96
|
+
granted to You under this License for that Work shall terminate
|
|
97
|
+
as of the date such litigation is filed.
|
|
98
|
+
|
|
99
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
100
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
101
|
+
modifications, and in Source or Object form, provided that You
|
|
102
|
+
meet the following conditions:
|
|
103
|
+
|
|
104
|
+
(a) You must give any other recipients of the Work or
|
|
105
|
+
Derivative Works a copy of this License; and
|
|
106
|
+
|
|
107
|
+
(b) You must cause any modified files to carry prominent notices
|
|
108
|
+
stating that You changed the files; and
|
|
109
|
+
|
|
110
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
111
|
+
that You distribute, all copyright, patent, trademark, and
|
|
112
|
+
attribution notices from the Source form of the Work,
|
|
113
|
+
excluding those notices that do not pertain to any part of
|
|
114
|
+
the Derivative Works; and
|
|
115
|
+
|
|
116
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
117
|
+
distribution, then any Derivative Works that You distribute must
|
|
118
|
+
include a readable copy of the attribution notices contained
|
|
119
|
+
within such NOTICE file, excluding those notices that do not
|
|
120
|
+
pertain to any part of the Derivative Works, in at least one
|
|
121
|
+
of the following places: within a NOTICE text file distributed
|
|
122
|
+
as part of the Derivative Works; within the Source form or
|
|
123
|
+
documentation, if provided along with the Derivative Works; or,
|
|
124
|
+
within a display generated by the Derivative Works, if and
|
|
125
|
+
wherever such third-party notices normally appear. The contents
|
|
126
|
+
of the NOTICE file are for informational purposes only and
|
|
127
|
+
do not modify the License. You may add Your own attribution
|
|
128
|
+
notices within Derivative Works that You distribute, alongside
|
|
129
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
130
|
+
that such additional attribution notices cannot be construed
|
|
131
|
+
as modifying the License.
|
|
132
|
+
|
|
133
|
+
You may add Your own copyright statement to Your modifications and
|
|
134
|
+
may provide additional or different license terms and conditions
|
|
135
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
136
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
137
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
138
|
+
the conditions stated in this License.
|
|
139
|
+
|
|
140
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
141
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
142
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
143
|
+
this License, without any additional terms or conditions.
|
|
144
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
145
|
+
the terms of any separate license agreement you may have executed
|
|
146
|
+
with Licensor regarding such Contributions.
|
|
147
|
+
|
|
148
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
149
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
150
|
+
except as required for reasonable and customary use in describing the
|
|
151
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
152
|
+
|
|
153
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
154
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
155
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
156
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
157
|
+
implied, including, without limitation, any warranties or conditions
|
|
158
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
159
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
160
|
+
appropriateness of using or redistributing the Work and assume any
|
|
161
|
+
risks associated with Your exercise of permissions under this License.
|
|
162
|
+
|
|
163
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
164
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
165
|
+
unless required by applicable law (such as deliberate and grossly
|
|
166
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
167
|
+
liable to You for damages, including any direct, indirect, special,
|
|
168
|
+
incidental, or consequential damages of any character arising as a
|
|
169
|
+
result of this License or out of the use or inability to use the
|
|
170
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
171
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
172
|
+
other commercial damages or losses), even if such Contributor
|
|
173
|
+
has been advised of the possibility of such damages.
|
|
174
|
+
|
|
175
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
176
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
177
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
178
|
+
or other liability obligations and/or rights consistent with this
|
|
179
|
+
License. However, in accepting such obligations, You may act only
|
|
180
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
181
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
182
|
+
defend, and hold each Contributor harmless for any liability
|
|
183
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
184
|
+
of your accepting any such warranty or additional liability.
|
|
185
|
+
|
|
186
|
+
END OF TERMS AND CONDITIONS
|
|
187
|
+
|
|
188
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
189
|
+
|
|
190
|
+
To apply the Apache License to your work, attach the following
|
|
191
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
192
|
+
replaced with your own identifying information. (Don't include
|
|
193
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
194
|
+
comment syntax for the file format. We also recommend that a
|
|
195
|
+
file or class name and description of purpose be included on the
|
|
196
|
+
same "printed page" as the copyright notice for easier
|
|
197
|
+
identification within third-party archives.
|
|
198
|
+
|
|
199
|
+
Copyright [yyyy] [name of copyright owner]
|
|
200
|
+
|
|
201
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
202
|
+
you may not use this file except in compliance with the License.
|
|
203
|
+
You may obtain a copy of the License at
|
|
204
|
+
|
|
205
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
206
|
+
|
|
207
|
+
Unless required by applicable law or agreed to in writing, software
|
|
208
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
209
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
210
|
+
See the License for the specific language governing permissions and
|
|
211
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @getmateo/protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared Mateo protocol schemas, codecs, and wire types.
|
|
4
|
+
|
|
5
|
+
## Stability
|
|
6
|
+
|
|
7
|
+
This package is public so Mateo's published packages can depend on it cleanly.
|
|
8
|
+
It is not a stable public API yet.
|
|
9
|
+
|
|
10
|
+
Schemas, exports, wire helpers, and types may change or disappear in any release
|
|
11
|
+
without advance notice. Use it outside Mateo at your own risk until the package
|
|
12
|
+
is explicitly documented as stable.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type AgentAttentionReason = "finished" | "error" | "permission";
|
|
2
|
+
export interface AgentAttentionNotificationData {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
serverId: string;
|
|
5
|
+
workspaceId?: string;
|
|
6
|
+
agentId: string;
|
|
7
|
+
reason: AgentAttentionReason;
|
|
8
|
+
}
|
|
9
|
+
export interface AgentAttentionNotificationPayload {
|
|
10
|
+
title: string;
|
|
11
|
+
body: string;
|
|
12
|
+
data: AgentAttentionNotificationData;
|
|
13
|
+
}
|
|
14
|
+
interface NotificationContext {
|
|
15
|
+
projectName?: string | null;
|
|
16
|
+
workspaceName?: string | null;
|
|
17
|
+
providerLabel?: string | null;
|
|
18
|
+
}
|
|
19
|
+
interface AttentionNotificationTitleInput {
|
|
20
|
+
sessionName?: string | null;
|
|
21
|
+
status: string | null;
|
|
22
|
+
fallbackTitle: string;
|
|
23
|
+
}
|
|
24
|
+
interface BuildAgentAttentionNotificationPayloadInput extends NotificationContext {
|
|
25
|
+
sessionName?: string | null;
|
|
26
|
+
reason: AgentAttentionReason;
|
|
27
|
+
serverId: string;
|
|
28
|
+
workspaceId: string;
|
|
29
|
+
agentId: string;
|
|
30
|
+
assistantMessage?: string | null;
|
|
31
|
+
permissionRequest?: NotificationPermissionRequest | null;
|
|
32
|
+
}
|
|
33
|
+
export interface NotificationPermissionRequest {
|
|
34
|
+
id: string;
|
|
35
|
+
provider: string;
|
|
36
|
+
name: string;
|
|
37
|
+
kind: "tool" | "plan" | "question" | "mode" | "other";
|
|
38
|
+
title?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
input?: Record<string, unknown>;
|
|
41
|
+
metadata?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export type AssistantTimelineItem = {
|
|
44
|
+
type: "assistant_message";
|
|
45
|
+
text: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: string;
|
|
48
|
+
text?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare function buildNotificationLabel(text: string | null | undefined, limit: number): string;
|
|
51
|
+
export declare function buildAttentionNotificationTitle(input: AttentionNotificationTitleInput): string;
|
|
52
|
+
export declare function buildNotificationContext(input: NotificationContext): string;
|
|
53
|
+
export declare function findLatestAssistantMessageFromTimeline(timeline: readonly AssistantTimelineItem[]): string | null;
|
|
54
|
+
export declare function findLatestPermissionRequest(pendingPermissions: ReadonlyMap<string, NotificationPermissionRequest>): NotificationPermissionRequest | null;
|
|
55
|
+
export declare function buildAgentAttentionNotificationPayload(input: BuildAgentAttentionNotificationPayloadInput): AgentAttentionNotificationPayload;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=agent-attention-notification.d.ts.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const NOTIFICATION_PREVIEW_LIMIT = 220;
|
|
2
|
+
const normalizeNotificationText = (text) => text.replace(/\s+/g, " ").trim();
|
|
3
|
+
const truncateNotificationText = (text, limit) => {
|
|
4
|
+
const characters = Array.from(text);
|
|
5
|
+
if (characters.length <= limit) {
|
|
6
|
+
return text;
|
|
7
|
+
}
|
|
8
|
+
const trimmed = characters
|
|
9
|
+
.slice(0, Math.max(0, limit - 3))
|
|
10
|
+
.join("")
|
|
11
|
+
.trimEnd();
|
|
12
|
+
return trimmed.length > 0 ? `${trimmed}...` : characters.slice(0, limit).join("");
|
|
13
|
+
};
|
|
14
|
+
export function buildNotificationLabel(text, limit) {
|
|
15
|
+
return truncateNotificationText(normalizeNotificationText(text ?? ""), limit);
|
|
16
|
+
}
|
|
17
|
+
export function buildAttentionNotificationTitle(input) {
|
|
18
|
+
// Reserve any status suffix instead of truncating the assembled title.
|
|
19
|
+
const sessionName = buildNotificationLabel(input.sessionName, 48);
|
|
20
|
+
if (!sessionName)
|
|
21
|
+
return input.fallbackTitle;
|
|
22
|
+
return input.status === null ? sessionName : `${sessionName} — ${input.status}`;
|
|
23
|
+
}
|
|
24
|
+
export function buildNotificationContext(input) {
|
|
25
|
+
// Bound each identity independently so a long project name cannot hide the workspace.
|
|
26
|
+
const projectName = buildNotificationLabel(input.projectName, 32);
|
|
27
|
+
const workspaceName = buildNotificationLabel(input.workspaceName, 32);
|
|
28
|
+
const providerLabel = buildNotificationLabel(input.providerLabel, 24);
|
|
29
|
+
const location = [projectName, workspaceName].filter(Boolean).join(" / ");
|
|
30
|
+
return [location, providerLabel].filter(Boolean).join(" · ");
|
|
31
|
+
}
|
|
32
|
+
const stripMarkdownToText = (markdown) => {
|
|
33
|
+
let text = markdown.replace(/\r\n/g, "\n");
|
|
34
|
+
// Strip fenced code markers but keep the code content itself.
|
|
35
|
+
text = text.replace(/^\s*```[^\n]*$/gm, "");
|
|
36
|
+
text = text.replace(/^\s*~~~[^\n]*$/gm, "");
|
|
37
|
+
// Markdown links/images.
|
|
38
|
+
text = text.replace(/!\[([^\]]*)\]\((?:[^()\\]|\\.)*\)/g, "$1");
|
|
39
|
+
text = text.replace(/\[([^\]]+)\]\((?:[^()\\]|\\.)*\)/g, "$1");
|
|
40
|
+
// Structural prefixes.
|
|
41
|
+
text = text.replace(/^\s{0,3}#{1,6}\s+/gm, "");
|
|
42
|
+
text = text.replace(/^\s{0,3}>+\s?/gm, "");
|
|
43
|
+
text = text.replace(/^\s{0,3}(?:[*+-]|\d+\.)\s+/gm, "");
|
|
44
|
+
text = text.replace(/^\s{0,3}(?:[-*_]\s*){3,}$/gm, "");
|
|
45
|
+
// Inline markdown markers.
|
|
46
|
+
text = text.replace(/`([^`]+)`/g, "$1");
|
|
47
|
+
text = text.replace(/\*\*([^*]+)\*\*/g, "$1");
|
|
48
|
+
text = text.replace(/__([^_]+)__/g, "$1");
|
|
49
|
+
text = text.replace(/\*([^*\n]+)\*/g, "$1");
|
|
50
|
+
text = text.replace(/_([^_\n]+)_/g, "$1");
|
|
51
|
+
text = text.replace(/~~([^~]+)~~/g, "$1");
|
|
52
|
+
// Angle-bracketed URL autolinks.
|
|
53
|
+
text = text.replace(/<([^>\n]+)>/g, "$1");
|
|
54
|
+
return text;
|
|
55
|
+
};
|
|
56
|
+
const buildNotificationPreview = (text) => {
|
|
57
|
+
if (!text) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const normalized = normalizeNotificationText(stripMarkdownToText(text));
|
|
61
|
+
if (!normalized) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return truncateNotificationText(normalized, NOTIFICATION_PREVIEW_LIMIT);
|
|
65
|
+
};
|
|
66
|
+
const safeStringify = (value) => {
|
|
67
|
+
try {
|
|
68
|
+
return JSON.stringify(value);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const buildPermissionDetails = (request) => {
|
|
75
|
+
if (!request) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const title = request.title?.trim();
|
|
79
|
+
const description = request.description?.trim();
|
|
80
|
+
const details = [];
|
|
81
|
+
if (title) {
|
|
82
|
+
details.push(title);
|
|
83
|
+
}
|
|
84
|
+
else if (description && request.input) {
|
|
85
|
+
// A bare reason ("Hook requires approval") says why, not what; lead with the tool input.
|
|
86
|
+
const inputPreview = safeStringify(request.input);
|
|
87
|
+
if (inputPreview) {
|
|
88
|
+
details.push(inputPreview);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (description && description !== title) {
|
|
92
|
+
details.push(description);
|
|
93
|
+
}
|
|
94
|
+
if (details.length > 0) {
|
|
95
|
+
return details.join(" - ");
|
|
96
|
+
}
|
|
97
|
+
const inputPreview = request.input ? safeStringify(request.input) : null;
|
|
98
|
+
if (inputPreview) {
|
|
99
|
+
return inputPreview;
|
|
100
|
+
}
|
|
101
|
+
const metadataPreview = request.metadata ? safeStringify(request.metadata) : null;
|
|
102
|
+
if (metadataPreview) {
|
|
103
|
+
return metadataPreview;
|
|
104
|
+
}
|
|
105
|
+
return request.name?.trim() || request.kind;
|
|
106
|
+
};
|
|
107
|
+
export function findLatestAssistantMessageFromTimeline(timeline) {
|
|
108
|
+
// Providers may stream assistant content in consecutive chunks.
|
|
109
|
+
const chunks = [];
|
|
110
|
+
for (let i = timeline.length - 1; i >= 0; i -= 1) {
|
|
111
|
+
const item = timeline[i];
|
|
112
|
+
if (item.type !== "assistant_message" || typeof item.text !== "string") {
|
|
113
|
+
if (chunks.length > 0) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
chunks.push(item.text);
|
|
119
|
+
}
|
|
120
|
+
if (chunks.length === 0) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
return chunks.toReversed().join("");
|
|
124
|
+
}
|
|
125
|
+
export function findLatestPermissionRequest(pendingPermissions) {
|
|
126
|
+
let latest = null;
|
|
127
|
+
for (const request of pendingPermissions.values()) {
|
|
128
|
+
latest = request;
|
|
129
|
+
}
|
|
130
|
+
return latest;
|
|
131
|
+
}
|
|
132
|
+
function resolveAgentAttentionStatus(reason) {
|
|
133
|
+
if (reason === "permission")
|
|
134
|
+
return "needs permission";
|
|
135
|
+
if (reason === "error")
|
|
136
|
+
return "needs attention";
|
|
137
|
+
return "finished";
|
|
138
|
+
}
|
|
139
|
+
function resolveAgentAttentionPreview(input) {
|
|
140
|
+
if (input.reason === "finished") {
|
|
141
|
+
return buildNotificationPreview(input.assistantMessage);
|
|
142
|
+
}
|
|
143
|
+
if (input.reason === "permission") {
|
|
144
|
+
return buildNotificationPreview(buildPermissionDetails(input.permissionRequest));
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
function resolveAgentAttentionFallbackBody(reason) {
|
|
149
|
+
if (reason === "permission")
|
|
150
|
+
return "Permission requested.";
|
|
151
|
+
if (reason === "error")
|
|
152
|
+
return "Encountered an error.";
|
|
153
|
+
return "Finished working.";
|
|
154
|
+
}
|
|
155
|
+
export function buildAgentAttentionNotificationPayload(input) {
|
|
156
|
+
const status = resolveAgentAttentionStatus(input.reason);
|
|
157
|
+
const title = buildAttentionNotificationTitle({
|
|
158
|
+
sessionName: input.sessionName,
|
|
159
|
+
status: input.reason === "finished" ? null : status,
|
|
160
|
+
fallbackTitle: `Agent ${status}`,
|
|
161
|
+
});
|
|
162
|
+
const preview = resolveAgentAttentionPreview(input);
|
|
163
|
+
const summary = preview ?? resolveAgentAttentionFallbackBody(input.reason);
|
|
164
|
+
const context = buildNotificationContext(input);
|
|
165
|
+
const body = context ? `${context}\n${summary}` : summary;
|
|
166
|
+
return {
|
|
167
|
+
title,
|
|
168
|
+
body,
|
|
169
|
+
data: {
|
|
170
|
+
serverId: input.serverId,
|
|
171
|
+
workspaceId: input.workspaceId,
|
|
172
|
+
agentId: input.agentId,
|
|
173
|
+
reason: input.reason,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=agent-attention-notification.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface AgentDeepLinkTarget {
|
|
2
|
+
serverId: string;
|
|
3
|
+
agentId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function buildAgentDeepLinkRoute(target: AgentDeepLinkTarget): `/h/${string}/agent/${string}`;
|
|
6
|
+
export declare function buildAgentDeepLink(target: AgentDeepLinkTarget): string;
|
|
7
|
+
export declare function parseAgentDeepLink(input: string): AgentDeepLinkTarget | null;
|
|
8
|
+
//# sourceMappingURL=agent-deep-link.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function normalizeSegment(value) {
|
|
2
|
+
return value.trim();
|
|
3
|
+
}
|
|
4
|
+
function normalizeAgentDeepLinkTarget(target) {
|
|
5
|
+
const serverId = normalizeSegment(target.serverId);
|
|
6
|
+
const agentId = normalizeSegment(target.agentId);
|
|
7
|
+
if (!serverId || !agentId) {
|
|
8
|
+
throw new Error("Agent deep links require a server ID and agent ID.");
|
|
9
|
+
}
|
|
10
|
+
return { serverId, agentId };
|
|
11
|
+
}
|
|
12
|
+
export function buildAgentDeepLinkRoute(target) {
|
|
13
|
+
const { serverId, agentId } = normalizeAgentDeepLinkTarget(target);
|
|
14
|
+
return `/h/${encodeURIComponent(serverId)}/agent/${encodeURIComponent(agentId)}`;
|
|
15
|
+
}
|
|
16
|
+
export function buildAgentDeepLink(target) {
|
|
17
|
+
return `mateo:/${buildAgentDeepLinkRoute(target)}`;
|
|
18
|
+
}
|
|
19
|
+
export function parseAgentDeepLink(input) {
|
|
20
|
+
let url;
|
|
21
|
+
try {
|
|
22
|
+
url = new URL(input);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (url.protocol !== "mateo:" ||
|
|
28
|
+
url.hostname !== "h" ||
|
|
29
|
+
url.username ||
|
|
30
|
+
url.password ||
|
|
31
|
+
url.port ||
|
|
32
|
+
url.search ||
|
|
33
|
+
url.hash) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const segments = url.pathname.split("/").filter(Boolean);
|
|
37
|
+
if (segments.length !== 3 || segments[1] !== "agent") {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const serverId = normalizeSegment(decodeURIComponent(segments[0] ?? ""));
|
|
42
|
+
const agentId = normalizeSegment(decodeURIComponent(segments[2] ?? ""));
|
|
43
|
+
return serverId && agentId ? { serverId, agentId } : null;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=agent-deep-link.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AgentAddress } from "./addresses.js";
|
|
2
|
+
export declare const PARENT_SERVER_ID_LABEL = "mateo.parent-server-id";
|
|
3
|
+
export declare const PARENT_AGENT_ID_LABEL = "mateo.parent-agent-id";
|
|
4
|
+
export declare function getOpenAgentTabLabel(clientId: string): string;
|
|
5
|
+
export declare function isOpenAgentTabLabel(label: string): boolean;
|
|
6
|
+
export interface AgentLabelSource {
|
|
7
|
+
labels?: Record<string, unknown> | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function getParentAgentIdFromLabels(labels: Record<string, unknown> | null | undefined): string | null;
|
|
10
|
+
export declare function isDelegatedAgent(agent: AgentLabelSource): boolean;
|
|
11
|
+
export declare function hasOpenAgentTab(labels: Record<string, unknown> | null | undefined): boolean;
|
|
12
|
+
export declare function getParentAddressFromLabels(labels: Record<string, unknown> | null | undefined, serverId: string): AgentAddress | null;
|
|
13
|
+
export declare function parentAddressLabels(parent: AgentAddress): Record<string, string>;
|
|
14
|
+
//# sourceMappingURL=agent-labels.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const PARENT_SERVER_ID_LABEL = "mateo.parent-server-id";
|
|
2
|
+
export const PARENT_AGENT_ID_LABEL = "mateo.parent-agent-id";
|
|
3
|
+
const OPEN_AGENT_TAB_LABEL_PREFIX = "mateo.open-agent-tab.";
|
|
4
|
+
export function getOpenAgentTabLabel(clientId) {
|
|
5
|
+
return `${OPEN_AGENT_TAB_LABEL_PREFIX}${clientId}`;
|
|
6
|
+
}
|
|
7
|
+
export function isOpenAgentTabLabel(label) {
|
|
8
|
+
return label.startsWith(OPEN_AGENT_TAB_LABEL_PREFIX);
|
|
9
|
+
}
|
|
10
|
+
export function getParentAgentIdFromLabels(labels) {
|
|
11
|
+
const parentAgentId = labels?.[PARENT_AGENT_ID_LABEL];
|
|
12
|
+
return typeof parentAgentId === "string" && parentAgentId.trim().length > 0
|
|
13
|
+
? parentAgentId.trim()
|
|
14
|
+
: null;
|
|
15
|
+
}
|
|
16
|
+
export function isDelegatedAgent(agent) {
|
|
17
|
+
return getParentAgentIdFromLabels(agent.labels) !== null;
|
|
18
|
+
}
|
|
19
|
+
export function hasOpenAgentTab(labels) {
|
|
20
|
+
return Object.entries(labels ?? {}).some(([label, value]) => isOpenAgentTabLabel(label) && value === "true");
|
|
21
|
+
}
|
|
22
|
+
// An absent parent server label means the parent runs on the same host.
|
|
23
|
+
export function getParentAddressFromLabels(labels, serverId) {
|
|
24
|
+
const agentId = getParentAgentIdFromLabels(labels);
|
|
25
|
+
if (!agentId)
|
|
26
|
+
return null;
|
|
27
|
+
const parentServerId = labels?.[PARENT_SERVER_ID_LABEL];
|
|
28
|
+
return {
|
|
29
|
+
serverId: typeof parentServerId === "string" && parentServerId.trim()
|
|
30
|
+
? parentServerId.trim()
|
|
31
|
+
: serverId,
|
|
32
|
+
agentId,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function parentAddressLabels(parent) {
|
|
36
|
+
return { [PARENT_AGENT_ID_LABEL]: parent.agentId, [PARENT_SERVER_ID_LABEL]: parent.serverId };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=agent-labels.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Semantic provenance, independent of provider envelopes and timeline presentation. */
|
|
3
|
+
export declare const AgentMessageSchema: z.ZodObject<{
|
|
4
|
+
event: z.ZodEnum<{
|
|
5
|
+
finished: "finished";
|
|
6
|
+
closed: "closed";
|
|
7
|
+
message: "message";
|
|
8
|
+
errored: "errored";
|
|
9
|
+
"permission-required": "permission-required";
|
|
10
|
+
canceled: "canceled";
|
|
11
|
+
}>;
|
|
12
|
+
sender: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
serverId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
title: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
text: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type AgentMessage = z.infer<typeof AgentMessageSchema>;
|
|
20
|
+
//# sourceMappingURL=agent-message.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Semantic provenance, independent of provider envelopes and timeline presentation. */
|
|
3
|
+
export const AgentMessageSchema = z.object({
|
|
4
|
+
event: z.enum(["message", "finished", "errored", "permission-required", "closed", "canceled"]),
|
|
5
|
+
sender: z.object({
|
|
6
|
+
id: z.string().min(1),
|
|
7
|
+
serverId: z.string().min(1).optional(),
|
|
8
|
+
title: z.string().min(1).optional(),
|
|
9
|
+
}),
|
|
10
|
+
text: z.string(),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=agent-message.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* A named launch bundle: a provider plus the agent-config values a client would
|
|
4
|
+
* otherwise set one control at a time. Field names mirror `AgentSessionConfig`
|
|
5
|
+
* so applying a profile is a copy rather than a translation table.
|
|
6
|
+
*
|
|
7
|
+
* There is deliberately no system prompt here. `AgentSessionConfig.systemPrompt`
|
|
8
|
+
* is creation-only, so a profile carrying one would apply when starting a new
|
|
9
|
+
* agent and silently do nothing when applied to a running one.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AgentProfileSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
15
|
+
color: z.ZodOptional<z.ZodString>;
|
|
16
|
+
provider: z.ZodString;
|
|
17
|
+
model: z.ZodOptional<z.ZodString>;
|
|
18
|
+
modeId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
thinkingOptionId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
featureValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
21
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$loose>;
|
|
23
|
+
export type AgentProfile = z.infer<typeof AgentProfileSchema>;
|
|
24
|
+
export declare const AgentSkillSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
|
+
mode: z.ZodLiteral<"all">;
|
|
26
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
27
|
+
mode: z.ZodLiteral<"custom">;
|
|
28
|
+
skills: z.ZodArray<z.ZodString>;
|
|
29
|
+
}, z.core.$strict>], "mode">;
|
|
30
|
+
export type AgentSkillSelection = z.infer<typeof AgentSkillSelectionSchema>;
|
|
31
|
+
//# sourceMappingURL=agent-profile.d.ts.map
|