@ayni.org/ayni-agui-profile 0.0.0-stage → 3.1.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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # @ayni.org/ayni-agui-profile
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript types, constants and JSON schemas of the **Ayni AG-UI Profile 3.1**, the wire contract
4
+ between an Ayni Agent (server) and an Ayni UI (client: the browser UI or the Ayni app). The normative
5
+ text lives in `2060-io/ayni-spec`, `v4/ayni-agui-profile/profile.md`; this package follows it and cites
6
+ its `PROF-*` identifiers. The package version tracks the profile version.
7
+
8
+ The package carries no AG-UI runtime: it describes the Ayni-specific parts (descriptor, session
9
+ endpoints, binding material, the session grant, `ayni.*` custom events, `forwardedProps.ayni` actions,
10
+ `ayni.*` activity messages including the `ayni.flow` card, `state.ayni`, the app links of §10) and the
11
+ few AG-UI message shapes it reuses.
12
+
13
+ ```ts
14
+ import { APP_LINK_DOMAIN, buildAppLink, parseAppLink, PROFILE_VERSION } from '@ayni.org/ayni-agui-profile'
15
+
16
+ buildAppLink(APP_LINK_DOMAIN.devnet, 'wallet', ['card', 'cred-1'])
17
+ // https://app.dev.ayni.org/app/wallet/card/cred-1
18
+ parseAppLink('https://app.dev.ayni.org/app/explore?q=notary&utm=x', APP_LINK_DOMAIN.devnet)
19
+ // { route: 'explore', segments: [], params: { q: 'notary' } }
20
+ ```
21
+
22
+ JSON schemas (draft 2020-12) are served under `schemas/`: `descriptor.schema.json`,
23
+ `create-session.schema.json`, `ayni-action.schema.json`.
24
+
25
+ Published to npm from this repository by the `npm-publish` workflow whenever `package.json` carries a
26
+ version that is not on npm yet.
@@ -0,0 +1,523 @@
1
+ /**
2
+ * Ayni AG-UI Profile 3.1 (2060-io/ayni-spec, v4/ayni-agui-profile/profile.md).
3
+ * Every name below cites the section or the PROF-* requirement it implements.
4
+ *
5
+ * 3.1 over 3.0: the session grant (`CreateSessionRequest.grant`, `features.sessionGrant`, §4.1), `features.flows`,
6
+ * `client.platform` as `web` | `ios` | `android` with `client.description` (PROF-SESS-014), the `ayni.flow` activity
7
+ * and `flowId` on routed capabilities (§5, §6, PROF-MAP-007), `metadata.flowId` (§8), the `grant-used` and
8
+ * `grant-expired` errors (§9), app links (§10, PROF-LINK-*). A 3.0 UI keeps working against a 3.1 agent.
9
+ */
10
+ export declare const PROFILE_VERSION = "3.1";
11
+ export declare const PROFILE_MAJOR = 3;
12
+ export declare const PROFILE_MINOR = 1;
13
+ /** DID Document service type that references the descriptor (PROF-DESC-001). */
14
+ export declare const DID_SERVICE_TYPE = "AyniAgUI";
15
+ /** Well-known path of the descriptor on the agent origin (PROF-DESC-001). */
16
+ export declare const DESCRIPTOR_PATH = "/.well-known/ayni-agent.json";
17
+ /**
18
+ * goal_code of the 3.0 binding invitation (profile section 4). Flow-capable wallets read the flow profile's codes
19
+ * below instead; agents keep emitting this one for wallets without flows.
20
+ */
21
+ export declare const BINDING_GOAL_CODE = "ayni.bind-session";
22
+ /** goal_code values of the flow profile §4 (FLOW-CONN-001): what follows the invitation. */
23
+ export declare const INVITATION_GOAL_CODE: {
24
+ /** just connect */
25
+ readonly connect: "ayni.connect";
26
+ /** a web UI binding, confirmed by the `link-session` flow */
27
+ readonly linkSession: "ayni.link-session";
28
+ /** a service-initiated flow follows */
29
+ readonly flow: "ayni.flow";
30
+ };
31
+ export type InvitationGoalCode = (typeof INVITATION_GOAL_CODE)[keyof typeof INVITATION_GOAL_CODE];
32
+ export interface UploadLimits {
33
+ maxBytes: number;
34
+ types: string[];
35
+ }
36
+ export interface DescriptorFeatures {
37
+ contextualMenu: boolean;
38
+ approvals: boolean;
39
+ reactions: boolean;
40
+ receipts: boolean;
41
+ history: boolean;
42
+ voiceNotes?: boolean;
43
+ uploads: UploadLimits | false;
44
+ /** the agent answers the `session-grant` flow (§4.1, PROF-DESC-004); absent on a 3.0 descriptor */
45
+ sessionGrant?: boolean;
46
+ /** the agent opens flows through the flow profile rather than question-answer and chat (PROF-DESC-004) */
47
+ flows?: boolean;
48
+ }
49
+ export type BindingMode = 'cross-device' | 'same-device';
50
+ export interface AgentDescriptor {
51
+ profileVersion: string;
52
+ did: string;
53
+ name: string;
54
+ description?: string;
55
+ logo?: string;
56
+ sessions: string;
57
+ /**
58
+ * `walletLinkTemplate` is an HTTPS app link on the wallet app's domain with an `{oob}` placeholder, for the Ayni app
59
+ * `https://<app-link-domain>/app/connect?oob={oob}` (PROF-BIND-008); never a `didcomm://` URL.
60
+ */
61
+ binding: {
62
+ modes: BindingMode[];
63
+ walletLinkTemplate: string;
64
+ };
65
+ features: DescriptorFeatures;
66
+ locales: string[];
67
+ }
68
+ export type SessionState = 'provisional' | 'bound' | 'closed';
69
+ /** Closure reasons (section 5, ayni.session.state). */
70
+ export type ClosureReason = 'user' | 'supersede' | 'channel-closed' | 'credential-invalid' | 'idle-timeout' | 'expired' | 'agent';
71
+ export declare const CLOSURE_REASONS: readonly ClosureReason[];
72
+ /** The kind of device a client runs on (PROF-SESS-014). */
73
+ export declare const CLIENT_PLATFORMS: readonly ["web", "ios", "android"];
74
+ export type ClientPlatform = (typeof CLIENT_PLATFORMS)[number];
75
+ export interface ClientDescription {
76
+ name: string;
77
+ version: string;
78
+ /**
79
+ * `web`, `ios` or `android` (PROF-SESS-014). A 3.0 client sent free text here ("Firefox on Linux"); a 3.1 agent
80
+ * records such a value as `description` and treats the platform as `web`.
81
+ */
82
+ platform: ClientPlatform | (string & {});
83
+ /** what the phone shows when it links this session: "Firefox on Linux", "Ayni on iPhone" (PROF-SESS-014) */
84
+ description?: string;
85
+ }
86
+ export declare function isClientPlatform(value: unknown): value is ClientPlatform;
87
+ export interface CreateSessionRequest {
88
+ client: ClientDescription;
89
+ locale?: string;
90
+ /** handle of a device the agent bound before (PROF-BIND-009): the agent asks the phone to re-link it */
91
+ deviceHandle?: string;
92
+ /** the device secret handed with the handle (PROF-BIND-010): with it the session binds without the phone (PROF-SESS-010) */
93
+ deviceProof?: string;
94
+ /** a closed session of the same Principal to resume: its transcript stays readable in the new session (PROF-SESS-009) */
95
+ resumeSessionId?: string;
96
+ /** a conversation of the Principal to open on this device (PROF-CONV-005) */
97
+ conversationId?: string;
98
+ /** start a new conversation; without it and without a conversation named, the session continues the Principal's latest active one (PROF-CONV-006) */
99
+ newConversation?: boolean;
100
+ /** the single-use grant the `session-grant` flow returned (§4.1, PROF-SESS-013): the session is created bound */
101
+ grant?: string;
102
+ }
103
+ export interface BindingMaterial {
104
+ oobUrl: string;
105
+ walletLink: string;
106
+ bindingCode: string;
107
+ expiresAt: string;
108
+ }
109
+ export interface BackingIdentityDisplay {
110
+ kind: 'org' | 'persona';
111
+ name: string;
112
+ }
113
+ export interface PrincipalDisplay {
114
+ displayName: string;
115
+ /** attachment reference (id served by the attachments endpoint) or null */
116
+ photo: string | null;
117
+ backingIdentity: BackingIdentityDisplay | null;
118
+ }
119
+ export interface CreateSessionResponse {
120
+ sessionId: string;
121
+ sessionToken: string;
122
+ state: SessionState;
123
+ agent: {
124
+ did: string;
125
+ name: string;
126
+ };
127
+ /** absent on a sibling session (PROF-SESS-007) */
128
+ binding?: BindingMaterial;
129
+ /** present on a sibling session */
130
+ parentSessionId?: string;
131
+ principal?: PrincipalDisplay;
132
+ idleTimeoutSeconds: number;
133
+ /** 'asked' when the phone of the known device received the re-link question (PROF-BIND-009) */
134
+ rebind?: 'asked' | 'unavailable';
135
+ deviceHandle?: string;
136
+ /** the rotated device secret of a session bound from a proof, or minted at a phone binding (PROF-BIND-010) */
137
+ deviceSecret?: string;
138
+ /** why a presented proof was not accepted (PROF-SESS-010); the client discards its secret */
139
+ pairing?: 'expired' | 'invalid';
140
+ /** set when the resume was accepted (sibling) or recorded for binding (provisional) */
141
+ resumedFromSessionId?: string;
142
+ /** the conversation this session serves, once bound (PROF-CONV-005) */
143
+ conversationId?: string;
144
+ }
145
+ export interface SessionStatus {
146
+ sessionId: string;
147
+ state: SessionState;
148
+ reason?: ClosureReason;
149
+ principal: PrincipalDisplay | null;
150
+ boundAt?: string;
151
+ /** the device secret of a freshly bound session, until the client uses it (PROF-BIND-010) */
152
+ deviceSecret?: string;
153
+ /** the conversation this session serves, once bound */
154
+ conversationId?: string;
155
+ lastActivityAt: string;
156
+ idleTimeoutSeconds: number;
157
+ binding?: BindingMaterial;
158
+ parentSessionId?: string;
159
+ deviceHandle?: string;
160
+ resumedFromSessionId?: string;
161
+ }
162
+ export declare const CUSTOM_EVENT: {
163
+ readonly sessionState: "ayni.session.state";
164
+ readonly sessionBound: "ayni.session.bound";
165
+ readonly sessionToken: "ayni.session.token";
166
+ readonly capabilityRouted: "ayni.capability.routed";
167
+ readonly approvalRequest: "ayni.approval.request";
168
+ readonly approvalUpdate: "ayni.approval.update";
169
+ readonly reaction: "ayni.reaction";
170
+ readonly receipt: "ayni.receipt";
171
+ };
172
+ export type CustomEventName = (typeof CUSTOM_EVENT)[keyof typeof CUSTOM_EVENT];
173
+ export type CapabilityKind = 'authentication' | 'credential-exchange' | 'auth-challenge' | 'authorization' | 'confirmation' | 'signature' | 'link-session';
174
+ export type ChallengeType = 'device' | 'face-match' | 'document';
175
+ export type CapabilityStatus = 'pending' | 'completed' | 'failed' | 'expired' | 'unavailable' | 'degraded';
176
+ export interface SessionStateValue {
177
+ state: SessionState;
178
+ reason?: ClosureReason;
179
+ }
180
+ export interface SessionBoundValue {
181
+ principal: PrincipalDisplay;
182
+ boundAt: string;
183
+ /** opaque handle of this device, presented on later session creations to ask the phone for a re-link */
184
+ deviceHandle?: string;
185
+ /** the closed session this one resumes, when the agent accepted it */
186
+ resumedFromSessionId?: string;
187
+ /** the device secret minted at this binding (PROF-BIND-010) */
188
+ deviceSecret?: string;
189
+ conversationId?: string;
190
+ }
191
+ export interface SessionTokenValue {
192
+ sessionToken: string;
193
+ }
194
+ export interface CapabilityRoutedValue {
195
+ kind: CapabilityKind;
196
+ challengeType?: ChallengeType;
197
+ status: CapabilityStatus;
198
+ originSessionId: string;
199
+ expiresAt?: string;
200
+ /** operator wording for unavailable or degraded outcomes */
201
+ message?: string;
202
+ /** the flow profile's flow id when the capability is served as a flow (PROF-MAP-007) */
203
+ flowId?: string;
204
+ }
205
+ export type ApprovalStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CANCELLED' | 'EXPIRED';
206
+ export type ApprovalKind = 'sensitivity' | 'elevation';
207
+ export interface ApprovalPolicyDisplay {
208
+ type: 'count' | 'percentage';
209
+ value: number;
210
+ vetoOnRefusal?: boolean;
211
+ }
212
+ export interface ApprovalRequestValue {
213
+ approvalId: string;
214
+ kind: ApprovalKind;
215
+ tool: string;
216
+ requester: {
217
+ displayName: string;
218
+ role?: string;
219
+ };
220
+ purpose?: {
221
+ id: string;
222
+ label: string;
223
+ };
224
+ justification?: string;
225
+ policy: ApprovalPolicyDisplay;
226
+ expiresAt: string;
227
+ status?: ApprovalStatus;
228
+ /** true when the receiving Principal is the requester */
229
+ own?: boolean;
230
+ /** true when the receiving Principal may decide */
231
+ canDecide?: boolean;
232
+ }
233
+ export interface ApprovalUpdateValue {
234
+ approvalId: string;
235
+ status: ApprovalStatus;
236
+ decidedBy?: string;
237
+ grantExpiresAt?: string;
238
+ }
239
+ /**
240
+ * One reaction per person per message (PROF-ACT-003): an `add` replaces whatever the same `by`
241
+ * had on that message; a `remove` clears it.
242
+ */
243
+ export interface ReactionValue {
244
+ messageId: string;
245
+ emoji: string;
246
+ action: 'add' | 'remove';
247
+ by: string;
248
+ }
249
+ /** `metadata` of a history or run message (PROF-HIST-006). */
250
+ export interface MessageMetadata {
251
+ createdAt: string;
252
+ initiatedAt?: string;
253
+ sourceType?: string;
254
+ completion?: 'completed' | 'interrupted';
255
+ entryId?: string;
256
+ /** the id the client gave this message in the run that sent it, when it was the client's */
257
+ externalId?: string;
258
+ /** current reactions on the message, one per person */
259
+ reactions?: {
260
+ emoji: string;
261
+ by: string;
262
+ }[];
263
+ /** the message this one answers */
264
+ replyTo?: ReplyReference;
265
+ /** on an `ayni.flow` activity, the flow it records (section 8) */
266
+ flowId?: string;
267
+ }
268
+ export type ReceiptState = 'received' | 'viewed';
269
+ export interface ReceiptValue {
270
+ messageIds: string[];
271
+ state: ReceiptState;
272
+ }
273
+ export interface CustomEventValueMap {
274
+ 'ayni.session.state': SessionStateValue;
275
+ 'ayni.session.bound': SessionBoundValue;
276
+ 'ayni.session.token': SessionTokenValue;
277
+ 'ayni.capability.routed': CapabilityRoutedValue;
278
+ 'ayni.approval.request': ApprovalRequestValue;
279
+ 'ayni.approval.update': ApprovalUpdateValue;
280
+ 'ayni.reaction': ReactionValue;
281
+ 'ayni.receipt': ReceiptValue;
282
+ }
283
+ export interface ContextualMenuItem {
284
+ id: string;
285
+ label: string;
286
+ description?: string;
287
+ badge?: number;
288
+ /** url items open a link instead of sending contextual.select */
289
+ url?: string;
290
+ }
291
+ export interface GeneratingEntry {
292
+ entryId: string;
293
+ kind: 'image';
294
+ startedAt: string;
295
+ }
296
+ export interface AyniState {
297
+ contextualMenu: {
298
+ items: ContextualMenuItem[];
299
+ };
300
+ pendingApprovals: number;
301
+ generating: GeneratingEntry[];
302
+ principal: PrincipalDisplay | null;
303
+ /** purposes a human may declare on an elevation request (PROF-RUN-005) */
304
+ purposes?: {
305
+ id: string;
306
+ label: string;
307
+ description?: string;
308
+ }[];
309
+ }
310
+ export interface AgUiState {
311
+ ayni: AyniState;
312
+ }
313
+ export type AyniActionKind = 'text' | 'menu.select' | 'contextual.select' | 'approval.decide' | 'approval.cancel' | 'elevation.request' | 'reaction' | 'receipt' | 'attachments';
314
+ export declare const AYNI_ACTION_KINDS: readonly AyniActionKind[];
315
+ /** A message the turn answers: the id of a transcript message of the same session (PROF-RUN-009). */
316
+ export interface ReplyReference {
317
+ id: string;
318
+ /** short excerpt of the quoted message, for rendering */
319
+ text: string;
320
+ role: 'user' | 'assistant';
321
+ }
322
+ export type AyniAction = {
323
+ kind: 'text';
324
+ replyTo?: string;
325
+ } | {
326
+ kind: 'menu.select';
327
+ menuId: string;
328
+ itemId: string;
329
+ } | {
330
+ kind: 'contextual.select';
331
+ itemId: string;
332
+ } | {
333
+ kind: 'approval.decide';
334
+ approvalId: string;
335
+ decision: 'approve' | 'reject';
336
+ note?: string;
337
+ } | {
338
+ kind: 'approval.cancel';
339
+ approvalId: string;
340
+ } | {
341
+ kind: 'elevation.request';
342
+ tool: string;
343
+ purposeId: string;
344
+ justification: string;
345
+ } | {
346
+ kind: 'reaction';
347
+ messageId: string;
348
+ emoji: string;
349
+ action: 'add' | 'remove';
350
+ } | {
351
+ kind: 'receipt';
352
+ messageIds: string[];
353
+ state: ReceiptState;
354
+ } | {
355
+ kind: 'attachments';
356
+ attachmentIds: string[];
357
+ replyTo?: string;
358
+ };
359
+ export interface AyniForwardedProps {
360
+ ayni?: AyniAction;
361
+ }
362
+ /** Activity message types inside runs (section 6). */
363
+ export declare const ACTIVITY: {
364
+ readonly menu: "ayni.menu";
365
+ readonly attachment: "ayni.attachment";
366
+ readonly approval: "ayni.approval";
367
+ readonly capability: "ayni.capability";
368
+ readonly flow: "ayni.flow";
369
+ readonly generating: "ayni.generating";
370
+ };
371
+ export type ActivityType = (typeof ACTIVITY)[keyof typeof ACTIVITY];
372
+ export interface MenuActivity {
373
+ menuId: string;
374
+ prompt: string;
375
+ items: {
376
+ id: string;
377
+ label: string;
378
+ description?: string;
379
+ }[];
380
+ /** set once answered */
381
+ selectedItemId?: string;
382
+ }
383
+ export type AttachmentType = 'image' | 'voice' | 'video' | 'file';
384
+ export interface AttachmentActivity {
385
+ attachmentId: string;
386
+ type: AttachmentType;
387
+ mimeType: string;
388
+ /** a short text stand-in: a caption, a transcription, a description; long extractions stay on the agent */
389
+ textRepr: string;
390
+ /** who sent it: the person (`user`) or the agent (`assistant`) */
391
+ role?: 'user' | 'assistant';
392
+ size?: number;
393
+ width?: number;
394
+ height?: number;
395
+ duration?: number;
396
+ filename?: string;
397
+ thumbnailId?: string;
398
+ }
399
+ export type ApprovalActivity = ApprovalRequestValue & {
400
+ status: ApprovalStatus;
401
+ };
402
+ export type CapabilityActivity = CapabilityRoutedValue;
403
+ /** Lifecycle of a flow (flow profile §5.2). */
404
+ export type FlowState = 'pending' | 'active' | 'completed' | 'declined' | 'cancelled' | 'failed' | 'expired';
405
+ export type FlowOutcome = 'completed' | 'declined' | 'cancelled' | 'failed' | 'expired';
406
+ export interface FlowReference {
407
+ type: string;
408
+ id: string;
409
+ }
410
+ /**
411
+ * The flow card (section 6, PROF-MAP-007; app spec §8.5): one per flow whose origin is a conversation, ordered at
412
+ * `openedAt`, replaced in place at close. `preview` holds only what the person received or disclosed, in a shape per
413
+ * kind that the agent pack may restrict.
414
+ */
415
+ export interface FlowActivity {
416
+ flowId: string;
417
+ /** a kind of the flow profile §6: `present`, `issue`, `authorize`, `sign-tx`, `link-session`... */
418
+ kind: string;
419
+ state: FlowState;
420
+ title: string;
421
+ openedAt: string;
422
+ closedAt?: string;
423
+ outcome?: FlowOutcome;
424
+ references?: FlowReference[];
425
+ preview?: Record<string, unknown>;
426
+ }
427
+ export interface GeneratingActivity {
428
+ entryId: string;
429
+ kind: 'image';
430
+ }
431
+ /** Interrupt reasons the agent uses (PROF-RUN-006). */
432
+ export declare const INTERRUPT_REASON: {
433
+ readonly menu: "ayni.menu";
434
+ };
435
+ /** RunError codes the agent uses (PROF-RUN-007). */
436
+ export declare const RUN_ERROR_CODE: {
437
+ readonly cancelled: "cancelled";
438
+ readonly notBound: "not-bound";
439
+ readonly closed: "closed";
440
+ readonly internal: "internal";
441
+ };
442
+ /** A conversation of the Principal with this agent (section 3.6, PROF-CONV-001). */
443
+ export type ConversationState = 'active' | 'archived';
444
+ export interface ConversationInfo {
445
+ id: string;
446
+ title: string;
447
+ state: ConversationState;
448
+ createdAt: string;
449
+ lastActivityAt: string;
450
+ lastPreview?: string;
451
+ /** a session is open on it somewhere */
452
+ open: boolean;
453
+ }
454
+ export interface ConversationsResponse {
455
+ conversations: ConversationInfo[];
456
+ }
457
+ export interface ConversationPatch {
458
+ title?: string;
459
+ state?: ConversationState;
460
+ }
461
+ /** A paired device of the Principal (PROF-SESS-011). */
462
+ export interface DeviceInfo {
463
+ handle: string;
464
+ client: ClientDescription;
465
+ createdAt: string;
466
+ lastUsedAt: string;
467
+ /** the caller's own device */
468
+ current: boolean;
469
+ }
470
+ export interface DevicesResponse {
471
+ devices: DeviceInfo[];
472
+ }
473
+ export interface HistoryPage {
474
+ messages: unknown[];
475
+ nextBefore: string | null;
476
+ }
477
+ export interface UploadResponse {
478
+ attachmentId: string;
479
+ type: AttachmentType;
480
+ mimeType: string;
481
+ size: number;
482
+ }
483
+ export type ErrorCode = 'unauthorized' | 'not-bound' | 'not-found' | 'conflict' | 'closed' | 'too-large' | 'rate-limited' | 'bad-request'
484
+ /** `POST {sessions}` with a grant already used (§3.2, PROF-SESS-013) */
485
+ | 'grant-used'
486
+ /** `POST {sessions}` with a grant past its sixty seconds */
487
+ | 'grant-expired';
488
+ export interface ErrorBody {
489
+ error: ErrorCode | string;
490
+ reason?: ClosureReason;
491
+ message?: string;
492
+ binding?: BindingMaterial;
493
+ }
494
+ /** Binding code format: two letters, a dash, two letters or digits, derived from the nonce (section 3.2). */
495
+ export declare const BINDING_CODE_PATTERN: RegExp;
496
+ /** The app-link domain of each network (section 10; app spec D39): the hosts of the web UI. */
497
+ export declare const APP_LINK_DOMAIN: {
498
+ readonly devnet: "app.dev.ayni.org";
499
+ readonly testnet: "app.test.ayni.org";
500
+ readonly mainnet: "app.ayni.org";
501
+ };
502
+ export type AppLinkNetwork = keyof typeof APP_LINK_DOMAIN;
503
+ /** The first path segment after `/app/` of every destination of section 10. */
504
+ export declare const APP_LINK_ROUTES: readonly ["home", "recent", "scan", "explore", "wallet", "service", "settings", "connect"];
505
+ export type AppLinkRoute = (typeof APP_LINK_ROUTES)[number];
506
+ /** The only query parameters a link may carry (PROF-LINK-003); a UI ignores any other. */
507
+ export declare const APP_LINK_PARAMS: readonly ["q", "to", "amount", "memo", "oob"];
508
+ export type AppLinkParam = (typeof APP_LINK_PARAMS)[number];
509
+ export interface AppLink {
510
+ route: AppLinkRoute;
511
+ /** the path segments after the route: a controller key, `documents`, `card` and an id, a DID, `backup`... */
512
+ segments: string[];
513
+ params: Partial<Record<AppLinkParam, string>>;
514
+ }
515
+ /** Builds an HTTPS app link of section 10 on the given app-link domain (PROF-LINK-001). */
516
+ export declare function buildAppLink(domain: string, route: AppLinkRoute, segments?: string[], params?: Partial<Record<AppLinkParam, string>>): string;
517
+ /**
518
+ * Reads an app link (PROF-LINK-002): null when the URL is not HTTPS on the app-link domain, or not an `/app/<route>`
519
+ * path of section 10. Parameters outside PROF-LINK-003 are dropped. Links navigate, never act.
520
+ */
521
+ export declare function parseAppLink(url: string, domain: string): AppLink | null;
522
+ /** Whether a URL is a link on the app-link domain, whatever its path. */
523
+ export declare function isAppLink(url: string, domain: string): boolean;
package/dist/index.js ADDED
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Ayni AG-UI Profile 3.1 (2060-io/ayni-spec, v4/ayni-agui-profile/profile.md).
3
+ * Every name below cites the section or the PROF-* requirement it implements.
4
+ *
5
+ * 3.1 over 3.0: the session grant (`CreateSessionRequest.grant`, `features.sessionGrant`, §4.1), `features.flows`,
6
+ * `client.platform` as `web` | `ios` | `android` with `client.description` (PROF-SESS-014), the `ayni.flow` activity
7
+ * and `flowId` on routed capabilities (§5, §6, PROF-MAP-007), `metadata.flowId` (§8), the `grant-used` and
8
+ * `grant-expired` errors (§9), app links (§10, PROF-LINK-*). A 3.0 UI keeps working against a 3.1 agent.
9
+ */
10
+ export const PROFILE_VERSION = '3.1';
11
+ export const PROFILE_MAJOR = 3;
12
+ export const PROFILE_MINOR = 1;
13
+ /** DID Document service type that references the descriptor (PROF-DESC-001). */
14
+ export const DID_SERVICE_TYPE = 'AyniAgUI';
15
+ /** Well-known path of the descriptor on the agent origin (PROF-DESC-001). */
16
+ export const DESCRIPTOR_PATH = '/.well-known/ayni-agent.json';
17
+ /**
18
+ * goal_code of the 3.0 binding invitation (profile section 4). Flow-capable wallets read the flow profile's codes
19
+ * below instead; agents keep emitting this one for wallets without flows.
20
+ */
21
+ export const BINDING_GOAL_CODE = 'ayni.bind-session';
22
+ /** goal_code values of the flow profile §4 (FLOW-CONN-001): what follows the invitation. */
23
+ export const INVITATION_GOAL_CODE = {
24
+ /** just connect */
25
+ connect: 'ayni.connect',
26
+ /** a web UI binding, confirmed by the `link-session` flow */
27
+ linkSession: 'ayni.link-session',
28
+ /** a service-initiated flow follows */
29
+ flow: 'ayni.flow',
30
+ };
31
+ export const CLOSURE_REASONS = [
32
+ 'user',
33
+ 'supersede',
34
+ 'channel-closed',
35
+ 'credential-invalid',
36
+ 'idle-timeout',
37
+ 'expired',
38
+ 'agent',
39
+ ];
40
+ /** The kind of device a client runs on (PROF-SESS-014). */
41
+ export const CLIENT_PLATFORMS = ['web', 'ios', 'android'];
42
+ export function isClientPlatform(value) {
43
+ return typeof value === 'string' && CLIENT_PLATFORMS.includes(value);
44
+ }
45
+ // ---------------------------------------------------------------------------------------------
46
+ // Custom events on the session stream (section 5)
47
+ export const CUSTOM_EVENT = {
48
+ sessionState: 'ayni.session.state',
49
+ sessionBound: 'ayni.session.bound',
50
+ sessionToken: 'ayni.session.token',
51
+ capabilityRouted: 'ayni.capability.routed',
52
+ approvalRequest: 'ayni.approval.request',
53
+ approvalUpdate: 'ayni.approval.update',
54
+ reaction: 'ayni.reaction',
55
+ receipt: 'ayni.receipt',
56
+ };
57
+ export const AYNI_ACTION_KINDS = [
58
+ 'text',
59
+ 'menu.select',
60
+ 'contextual.select',
61
+ 'approval.decide',
62
+ 'approval.cancel',
63
+ 'elevation.request',
64
+ 'reaction',
65
+ 'receipt',
66
+ 'attachments',
67
+ ];
68
+ /** Activity message types inside runs (section 6). */
69
+ export const ACTIVITY = {
70
+ menu: 'ayni.menu',
71
+ attachment: 'ayni.attachment',
72
+ approval: 'ayni.approval',
73
+ capability: 'ayni.capability',
74
+ flow: 'ayni.flow',
75
+ generating: 'ayni.generating',
76
+ };
77
+ /** Interrupt reasons the agent uses (PROF-RUN-006). */
78
+ export const INTERRUPT_REASON = {
79
+ menu: 'ayni.menu',
80
+ };
81
+ /** RunError codes the agent uses (PROF-RUN-007). */
82
+ export const RUN_ERROR_CODE = {
83
+ cancelled: 'cancelled',
84
+ notBound: 'not-bound',
85
+ closed: 'closed',
86
+ internal: 'internal',
87
+ };
88
+ /** Binding code format: two letters, a dash, two letters or digits, derived from the nonce (section 3.2). */
89
+ export const BINDING_CODE_PATTERN = /^[A-Z0-9]{2}-[A-Z0-9]{2}$/;
90
+ // ---------------------------------------------------------------------------------------------
91
+ // App links (section 10, PROF-LINK-001..003)
92
+ /** The app-link domain of each network (section 10; app spec D39): the hosts of the web UI. */
93
+ export const APP_LINK_DOMAIN = {
94
+ devnet: 'app.dev.ayni.org',
95
+ testnet: 'app.test.ayni.org',
96
+ mainnet: 'app.ayni.org',
97
+ };
98
+ /** The first path segment after `/app/` of every destination of section 10. */
99
+ export const APP_LINK_ROUTES = [
100
+ 'home',
101
+ 'recent',
102
+ 'scan',
103
+ 'explore',
104
+ 'wallet',
105
+ 'service',
106
+ 'settings',
107
+ 'connect',
108
+ ];
109
+ /** The only query parameters a link may carry (PROF-LINK-003); a UI ignores any other. */
110
+ export const APP_LINK_PARAMS = ['q', 'to', 'amount', 'memo', 'oob'];
111
+ /** Builds an HTTPS app link of section 10 on the given app-link domain (PROF-LINK-001). */
112
+ export function buildAppLink(domain, route, segments = [], params = {}) {
113
+ const path = ['app', route, ...segments.map((segment) => encodeURIComponent(segment))].join('/');
114
+ const url = new URL(`https://${domain}/${path}`);
115
+ for (const key of APP_LINK_PARAMS) {
116
+ const value = params[key];
117
+ if (value !== undefined)
118
+ url.searchParams.set(key, value);
119
+ }
120
+ return url.toString();
121
+ }
122
+ /**
123
+ * Reads an app link (PROF-LINK-002): null when the URL is not HTTPS on the app-link domain, or not an `/app/<route>`
124
+ * path of section 10. Parameters outside PROF-LINK-003 are dropped. Links navigate, never act.
125
+ */
126
+ export function parseAppLink(url, domain) {
127
+ let parsed;
128
+ try {
129
+ parsed = new URL(url);
130
+ }
131
+ catch {
132
+ return null;
133
+ }
134
+ if (parsed.protocol !== 'https:' || parsed.host.toLowerCase() !== domain.toLowerCase())
135
+ return null;
136
+ const segments = parsed.pathname.split('/').filter(Boolean).map(decodeURIComponent);
137
+ if (segments.length < 2 || segments[0] !== 'app')
138
+ return null;
139
+ const route = segments[1];
140
+ if (!APP_LINK_ROUTES.includes(route))
141
+ return null;
142
+ const params = {};
143
+ for (const key of APP_LINK_PARAMS) {
144
+ const value = parsed.searchParams.get(key);
145
+ if (value !== null)
146
+ params[key] = value;
147
+ }
148
+ return { route: route, segments: segments.slice(2), params };
149
+ }
150
+ /** Whether a URL is a link on the app-link domain, whatever its path. */
151
+ export function isAppLink(url, domain) {
152
+ return parseAppLink(url, domain) !== null;
153
+ }
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@ayni.org/ayni-agui-profile",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "3.1.1",
4
+ "description": "Ayni AG-UI Profile 3.1: the wire contract between an Ayni Agent and an Ayni UI (types, constants, JSON schemas, app links)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./schemas/*": "./schemas/*"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "schemas",
18
+ "README.md"
19
+ ],
20
+ "license": "Apache-2.0",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/2060-io/ayni-agent",
24
+ "directory": "packages/agui-profile"
25
+ },
26
+ "devDependencies": {
27
+ "typescript": "^5.9.3"
28
+ },
29
+ "homepage": "https://github.com/2060-io/ayni-agent/tree/main/packages/agui-profile",
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "keywords": [
34
+ "ayni",
35
+ "ag-ui",
36
+ "didcomm",
37
+ "verifiable-trust"
38
+ ],
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "check-types": "tsc -p tsconfig.json --noEmit"
42
+ }
6
43
  }
@@ -0,0 +1,152 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://2060.io/schemas/ayni-agui-profile/3.1/ayni-action.json",
4
+ "title": "forwardedProps.ayni (profile section 6, PROF-RUN-003)",
5
+ "type": "object",
6
+ "required": ["kind"],
7
+ "oneOf": [
8
+ {
9
+ "properties": {
10
+ "kind": {
11
+ "const": "text"
12
+ },
13
+ "replyTo": {
14
+ "type": "string"
15
+ }
16
+ },
17
+ "additionalProperties": false
18
+ },
19
+ {
20
+ "properties": {
21
+ "kind": {
22
+ "const": "menu.select"
23
+ },
24
+ "menuId": {
25
+ "type": "string"
26
+ },
27
+ "itemId": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "required": ["kind", "menuId", "itemId"],
32
+ "additionalProperties": false
33
+ },
34
+ {
35
+ "properties": {
36
+ "kind": {
37
+ "const": "contextual.select"
38
+ },
39
+ "itemId": {
40
+ "type": "string"
41
+ }
42
+ },
43
+ "required": ["kind", "itemId"],
44
+ "additionalProperties": false
45
+ },
46
+ {
47
+ "properties": {
48
+ "kind": {
49
+ "const": "approval.decide"
50
+ },
51
+ "approvalId": {
52
+ "type": "string"
53
+ },
54
+ "decision": {
55
+ "enum": ["approve", "reject"]
56
+ },
57
+ "note": {
58
+ "type": "string"
59
+ }
60
+ },
61
+ "required": ["kind", "approvalId", "decision"],
62
+ "additionalProperties": false
63
+ },
64
+ {
65
+ "properties": {
66
+ "kind": {
67
+ "const": "approval.cancel"
68
+ },
69
+ "approvalId": {
70
+ "type": "string"
71
+ }
72
+ },
73
+ "required": ["kind", "approvalId"],
74
+ "additionalProperties": false
75
+ },
76
+ {
77
+ "properties": {
78
+ "kind": {
79
+ "const": "elevation.request"
80
+ },
81
+ "tool": {
82
+ "type": "string"
83
+ },
84
+ "purposeId": {
85
+ "type": "string",
86
+ "minLength": 1
87
+ },
88
+ "justification": {
89
+ "type": "string",
90
+ "minLength": 1
91
+ }
92
+ },
93
+ "required": ["kind", "tool", "purposeId", "justification"],
94
+ "additionalProperties": false
95
+ },
96
+ {
97
+ "properties": {
98
+ "kind": {
99
+ "const": "reaction"
100
+ },
101
+ "messageId": {
102
+ "type": "string"
103
+ },
104
+ "emoji": {
105
+ "type": "string"
106
+ },
107
+ "action": {
108
+ "enum": ["add", "remove"]
109
+ }
110
+ },
111
+ "required": ["kind", "messageId", "emoji", "action"],
112
+ "additionalProperties": false
113
+ },
114
+ {
115
+ "properties": {
116
+ "kind": {
117
+ "const": "receipt"
118
+ },
119
+ "messageIds": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "string"
123
+ }
124
+ },
125
+ "state": {
126
+ "enum": ["received", "viewed"]
127
+ }
128
+ },
129
+ "required": ["kind", "messageIds", "state"],
130
+ "additionalProperties": false
131
+ },
132
+ {
133
+ "properties": {
134
+ "kind": {
135
+ "const": "attachments"
136
+ },
137
+ "attachmentIds": {
138
+ "type": "array",
139
+ "items": {
140
+ "type": "string"
141
+ },
142
+ "minItems": 1
143
+ },
144
+ "replyTo": {
145
+ "type": "string"
146
+ }
147
+ },
148
+ "required": ["kind", "attachmentIds"],
149
+ "additionalProperties": false
150
+ }
151
+ ]
152
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://2060.io/schemas/ayni-agui-profile/3.1/create-session.json",
4
+ "title": "POST {sessions} body (profile section 3.2, PROF-SESS-013, PROF-SESS-014)",
5
+ "type": "object",
6
+ "required": ["client"],
7
+ "properties": {
8
+ "client": {
9
+ "type": "object",
10
+ "required": ["name", "version", "platform"],
11
+ "properties": {
12
+ "name": {
13
+ "type": "string",
14
+ "minLength": 1,
15
+ "maxLength": 80
16
+ },
17
+ "version": {
18
+ "type": "string",
19
+ "maxLength": 40
20
+ },
21
+ "platform": {
22
+ "type": "string",
23
+ "maxLength": 80,
24
+ "description": "web, ios or android (PROF-SESS-014); a 3.0 client sent free text, which a 3.1 agent records as description and treats as web"
25
+ },
26
+ "description": {
27
+ "type": "string",
28
+ "maxLength": 120,
29
+ "description": "what the phone shows when it links this session (PROF-SESS-014)"
30
+ }
31
+ }
32
+ },
33
+ "locale": {
34
+ "type": "string",
35
+ "maxLength": 20
36
+ },
37
+ "deviceHandle": {
38
+ "type": "string",
39
+ "maxLength": 128
40
+ },
41
+ "resumeSessionId": {
42
+ "type": "string",
43
+ "maxLength": 128
44
+ },
45
+ "deviceProof": {
46
+ "type": "string",
47
+ "maxLength": 128
48
+ },
49
+ "conversationId": {
50
+ "type": "string",
51
+ "maxLength": 128
52
+ },
53
+ "newConversation": {
54
+ "type": "boolean"
55
+ },
56
+ "grant": {
57
+ "type": "string",
58
+ "maxLength": 256,
59
+ "description": "the single-use grant the session-grant flow returned (section 4.1, PROF-SESS-013)"
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,108 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://2060.io/schemas/ayni-agui-profile/3.1/descriptor.json",
4
+ "title": "Ayni agent descriptor (profile section 2, PROF-DESC-002)",
5
+ "type": "object",
6
+ "required": ["profileVersion", "did", "name", "sessions", "binding", "features"],
7
+ "properties": {
8
+ "profileVersion": {
9
+ "type": "string",
10
+ "pattern": "^3\\.[0-9]+$"
11
+ },
12
+ "did": {
13
+ "type": "string",
14
+ "pattern": "^did:[a-z0-9]+:.+$"
15
+ },
16
+ "name": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "description": {
21
+ "type": "string"
22
+ },
23
+ "logo": {
24
+ "type": "string",
25
+ "format": "uri"
26
+ },
27
+ "sessions": {
28
+ "type": "string",
29
+ "format": "uri"
30
+ },
31
+ "binding": {
32
+ "type": "object",
33
+ "required": ["modes", "walletLinkTemplate"],
34
+ "properties": {
35
+ "modes": {
36
+ "type": "array",
37
+ "items": {
38
+ "enum": ["cross-device", "same-device"]
39
+ }
40
+ },
41
+ "walletLinkTemplate": {
42
+ "type": "string",
43
+ "pattern": "^https://.*\\{oob\\}.*$"
44
+ }
45
+ }
46
+ },
47
+ "features": {
48
+ "type": "object",
49
+ "required": ["contextualMenu", "approvals", "reactions", "receipts", "history", "uploads"],
50
+ "properties": {
51
+ "contextualMenu": {
52
+ "type": "boolean"
53
+ },
54
+ "approvals": {
55
+ "type": "boolean"
56
+ },
57
+ "reactions": {
58
+ "type": "boolean"
59
+ },
60
+ "receipts": {
61
+ "type": "boolean"
62
+ },
63
+ "history": {
64
+ "type": "boolean"
65
+ },
66
+ "voiceNotes": {
67
+ "type": "boolean"
68
+ },
69
+ "uploads": {
70
+ "oneOf": [
71
+ {
72
+ "const": false
73
+ },
74
+ {
75
+ "type": "object",
76
+ "required": ["maxBytes", "types"],
77
+ "properties": {
78
+ "maxBytes": {
79
+ "type": "integer"
80
+ },
81
+ "types": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "string"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ]
90
+ },
91
+ "sessionGrant": {
92
+ "type": "boolean",
93
+ "description": "the agent answers the session-grant flow (section 4.1, PROF-DESC-004)"
94
+ },
95
+ "flows": {
96
+ "type": "boolean",
97
+ "description": "the agent opens flows through the flow profile (PROF-DESC-004)"
98
+ }
99
+ }
100
+ },
101
+ "locales": {
102
+ "type": "array",
103
+ "items": {
104
+ "type": "string"
105
+ }
106
+ }
107
+ }
108
+ }