@adecore/agent-contracts 0.17.0-beta.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chat.d.ts CHANGED
@@ -3372,6 +3372,36 @@ export declare const ChatBookmarksEventSchema: z.ZodObject<{
3372
3372
  }, z.core.$strip>>;
3373
3373
  }, z.core.$strip>;
3374
3374
  export type ChatBookmarksEvent = z.infer<typeof ChatBookmarksEventSchema>;
3375
+ export declare const ChatRemoveVisualPayloadSchema: z.ZodObject<{
3376
+ chatId: z.ZodString;
3377
+ visualId: z.ZodString;
3378
+ }, z.core.$strip>;
3379
+ export type ChatRemoveVisualPayload = z.infer<typeof ChatRemoveVisualPayloadSchema>;
3380
+ export declare const ChatVisualsResultSchema: z.ZodObject<{
3381
+ visuals: z.ZodArray<z.ZodObject<{
3382
+ id: z.ZodString;
3383
+ title: z.ZodString;
3384
+ at: z.ZodNumber;
3385
+ maxHeight: z.ZodNumber;
3386
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
3387
+ size: z.ZodNumber;
3388
+ turnId: z.ZodOptional<z.ZodString>;
3389
+ }, z.core.$strip>>;
3390
+ }, z.core.$strip>;
3391
+ export type ChatVisualsResult = z.infer<typeof ChatVisualsResultSchema>;
3392
+ export declare const ChatVisualsEventSchema: z.ZodObject<{
3393
+ chatId: z.ZodString;
3394
+ visuals: z.ZodArray<z.ZodObject<{
3395
+ id: z.ZodString;
3396
+ title: z.ZodString;
3397
+ at: z.ZodNumber;
3398
+ maxHeight: z.ZodNumber;
3399
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
3400
+ size: z.ZodNumber;
3401
+ turnId: z.ZodOptional<z.ZodString>;
3402
+ }, z.core.$strip>>;
3403
+ }, z.core.$strip>;
3404
+ export type ChatVisualsEvent = z.infer<typeof ChatVisualsEventSchema>;
3375
3405
  export declare const ChatAttachResultSchema: z.ZodObject<{
3376
3406
  info: z.ZodObject<{
3377
3407
  chatId: z.ZodString;
@@ -4780,6 +4810,15 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
4780
4810
  excerpt: z.ZodString;
4781
4811
  createdAt: z.ZodNumber;
4782
4812
  }, z.core.$strip>>>;
4813
+ visuals: z.ZodOptional<z.ZodArray<z.ZodObject<{
4814
+ id: z.ZodString;
4815
+ title: z.ZodString;
4816
+ at: z.ZodNumber;
4817
+ maxHeight: z.ZodNumber;
4818
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
4819
+ size: z.ZodNumber;
4820
+ turnId: z.ZodOptional<z.ZodString>;
4821
+ }, z.core.$strip>>>;
4783
4822
  }, z.core.$strip>;
4784
4823
  export type ChatAttachResult = z.infer<typeof ChatAttachResultSchema>;
4785
4824
  export declare const ChatSendPayloadSchema: z.ZodObject<{
package/dist/chat.js CHANGED
@@ -3,6 +3,7 @@ import { AgentKindSchema, AgentStatusSchema, SuggestedTitleSchema } from './agen
3
3
  import { WorktreeSchema } from './worktree.js';
4
4
  import { ModelSelectionSchema, RuntimeModeSchema } from './model.js';
5
5
  import { ProviderAccountIdSchema } from './provider-accounts.js';
6
+ import { ChatVisualsSchema } from './visual.js';
6
7
  // The client picks the id (its node id), like a terminal session.
7
8
  export const ChatIdSchema = z.string().min(1);
8
9
  // The daemon's estimate of what `contextTokens` is made of, scaled to add up to it; `system` is whatever the thread cannot account for.
@@ -617,6 +618,11 @@ export const ChatRemoveBookmarkPayloadSchema = ChatTargetPayloadSchema.extend({
617
618
  export const ChatBookmarksResultSchema = z.object({ bookmarks: ChatBookmarksSchema });
618
619
  // The whole list after every change, to every client attached to the chat.
619
620
  export const ChatBookmarksEventSchema = z.object({ chatId: ChatIdSchema, bookmarks: ChatBookmarksSchema });
621
+ // A person takes a visual out of the thread from its card; one that is already gone is no refusal.
622
+ export const ChatRemoveVisualPayloadSchema = ChatTargetPayloadSchema.extend({ visualId: z.string().min(1) });
623
+ export const ChatVisualsResultSchema = z.object({ visuals: ChatVisualsSchema });
624
+ // The whole list after every change, to every client attached to the chat.
625
+ export const ChatVisualsEventSchema = z.object({ chatId: ChatIdSchema, visuals: ChatVisualsSchema });
620
626
  export const ChatAttachResultSchema = z.object({
621
627
  info: ChatInfoSchema,
622
628
  items: z.array(ChatItemSchema),
@@ -626,7 +632,9 @@ export const ChatAttachResultSchema = z.object({
626
632
  // Only when `since` was honored: what happened after it, in order; `items` is then empty.
627
633
  events: z.array(ChatEventSchema).optional(),
628
634
  // Absent from a daemon that keeps no bookmarks.
629
- bookmarks: ChatBookmarksSchema.optional()
635
+ bookmarks: ChatBookmarksSchema.optional(),
636
+ // Absent from a host that keeps no visuals.
637
+ visuals: ChatVisualsSchema.optional()
630
638
  });
631
639
  export const ChatSendPayloadSchema = z
632
640
  .object({
package/dist/index.d.ts CHANGED
@@ -8,5 +8,6 @@ export * from './provider-accounts.ts';
8
8
  export * from './task.ts';
9
9
  export * from './text.ts';
10
10
  export * from './usage.ts';
11
+ export * from './visual.ts';
11
12
  export * from './worktree.ts';
12
13
  export type * from './port.ts';
package/dist/index.js CHANGED
@@ -8,4 +8,5 @@ export * from './provider-accounts.js';
8
8
  export * from './task.js';
9
9
  export * from './text.js';
10
10
  export * from './usage.js';
11
+ export * from './visual.js';
11
12
  export * from './worktree.js';
@@ -1833,6 +1833,15 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1833
1833
  excerpt: z.ZodString;
1834
1834
  createdAt: z.ZodNumber;
1835
1835
  }, z.core.$strip>>>;
1836
+ visuals: z.ZodOptional<z.ZodArray<z.ZodObject<{
1837
+ id: z.ZodString;
1838
+ title: z.ZodString;
1839
+ at: z.ZodNumber;
1840
+ maxHeight: z.ZodNumber;
1841
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
1842
+ size: z.ZodNumber;
1843
+ turnId: z.ZodOptional<z.ZodString>;
1844
+ }, z.core.$strip>>>;
1836
1845
  }, z.core.$strip>;
1837
1846
  };
1838
1847
  readonly 'chat.detach': {
@@ -2861,6 +2870,23 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2861
2870
  }, z.core.$strip>>;
2862
2871
  }, z.core.$strip>;
2863
2872
  };
2873
+ readonly 'chat.removeVisual': {
2874
+ readonly payload: z.ZodObject<{
2875
+ chatId: z.ZodString;
2876
+ visualId: z.ZodString;
2877
+ }, z.core.$strip>;
2878
+ readonly result: z.ZodObject<{
2879
+ visuals: z.ZodArray<z.ZodObject<{
2880
+ id: z.ZodString;
2881
+ title: z.ZodString;
2882
+ at: z.ZodNumber;
2883
+ maxHeight: z.ZodNumber;
2884
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
2885
+ size: z.ZodNumber;
2886
+ turnId: z.ZodOptional<z.ZodString>;
2887
+ }, z.core.$strip>>;
2888
+ }, z.core.$strip>;
2889
+ };
2864
2890
  readonly 'skills.list': {
2865
2891
  readonly payload: z.ZodObject<{
2866
2892
  chatId: z.ZodString;
@@ -4481,6 +4507,18 @@ export declare const AGENT_EVENT_SCHEMAS: {
4481
4507
  createdAt: z.ZodNumber;
4482
4508
  }, z.core.$strip>>;
4483
4509
  }, z.core.$strip>;
4510
+ readonly 'chat.visuals': z.ZodObject<{
4511
+ chatId: z.ZodString;
4512
+ visuals: z.ZodArray<z.ZodObject<{
4513
+ id: z.ZodString;
4514
+ title: z.ZodString;
4515
+ at: z.ZodNumber;
4516
+ maxHeight: z.ZodNumber;
4517
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
4518
+ size: z.ZodNumber;
4519
+ turnId: z.ZodOptional<z.ZodString>;
4520
+ }, z.core.$strip>>;
4521
+ }, z.core.$strip>;
4484
4522
  readonly 'usage.changed': z.ZodObject<{
4485
4523
  scannedAt: z.ZodNumber;
4486
4524
  }, z.core.$strip>;
package/dist/protocol.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ChatAddBookmarkPayloadSchema, ChatAnswerPayloadSchema, ChatApprovePayloadSchema, ChatAttachPayloadSchema, ChatAttachResultSchema, ChatBookmarksEventSchema, ChatBookmarksResultSchema, ChatCancelPayloadSchema, ChatClearPayloadSchema, ChatConfigurePayloadSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatCreatePayloadSchema, ChatDismissPayloadSchema, ChatEventEnvelopeSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatForkPayloadSchema, ChatForkResultSchema, ChatHistoryPayloadSchema, ChatHistoryResultSchema, ChatInfoSchema, ChatListResultSchema, ChatPreferencesPayloadSchema, ChatQueuePayloadSchema, ChatRemoveBookmarkPayloadSchema, ChatRenameBookmarkPayloadSchema, ChatSendPayloadSchema, ChatSendResultSchema, ChatStatusEventSchema, ChatStopSubagentPayloadSchema, ChatStopTaskPayloadSchema, ChatSubagentChangedEventSchema, ChatSubagentPayloadSchema, ChatSubagentResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatTargetPayloadSchema, ChatTurnDiffPayloadSchema, ChatTurnDiffResultSchema, ChatUnqueueResultSchema, SkillsListPayloadSchema, SkillsListResultSchema } from './chat.js';
2
+ import { ChatAddBookmarkPayloadSchema, ChatAnswerPayloadSchema, ChatApprovePayloadSchema, ChatAttachPayloadSchema, ChatAttachResultSchema, ChatBookmarksEventSchema, ChatBookmarksResultSchema, ChatCancelPayloadSchema, ChatClearPayloadSchema, ChatConfigurePayloadSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatCreatePayloadSchema, ChatDismissPayloadSchema, ChatEventEnvelopeSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatForkPayloadSchema, ChatForkResultSchema, ChatHistoryPayloadSchema, ChatHistoryResultSchema, ChatInfoSchema, ChatListResultSchema, ChatPreferencesPayloadSchema, ChatQueuePayloadSchema, ChatRemoveBookmarkPayloadSchema, ChatRemoveVisualPayloadSchema, ChatRenameBookmarkPayloadSchema, ChatSendPayloadSchema, ChatSendResultSchema, ChatStatusEventSchema, ChatStopSubagentPayloadSchema, ChatStopTaskPayloadSchema, ChatSubagentChangedEventSchema, ChatSubagentPayloadSchema, ChatSubagentResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatTargetPayloadSchema, ChatTurnDiffPayloadSchema, ChatTurnDiffResultSchema, ChatUnqueueResultSchema, ChatVisualsEventSchema, ChatVisualsResultSchema, SkillsListPayloadSchema, SkillsListResultSchema } from './chat.js';
3
3
  import { ProviderListResultSchema } from './model.js';
4
4
  import { ProviderAccountCreatePayloadSchema, ProviderAccountCreateResultSchema, ProviderAccountWatchLoginPayloadSchema, ProviderAccountsSavePayloadSchema, ProviderAccountsSchema } from './provider-accounts.js';
5
5
  import { UsageChangedEventSchema, UsageLimitsSnapshotSchema, UsageSummaryPayloadSchema, UsageSummaryResultSchema } from './usage.js';
@@ -36,6 +36,7 @@ export const AGENT_REQUEST_SCHEMAS = {
36
36
  'chat.addBookmark': { payload: ChatAddBookmarkPayloadSchema, result: ChatBookmarksResultSchema },
37
37
  'chat.renameBookmark': { payload: ChatRenameBookmarkPayloadSchema, result: ChatBookmarksResultSchema },
38
38
  'chat.removeBookmark': { payload: ChatRemoveBookmarkPayloadSchema, result: ChatBookmarksResultSchema },
39
+ 'chat.removeVisual': { payload: ChatRemoveVisualPayloadSchema, result: ChatVisualsResultSchema },
39
40
  'skills.list': { payload: SkillsListPayloadSchema, result: SkillsListResultSchema },
40
41
  'provider.list': { payload: EmptySchema, result: ProviderListResultSchema },
41
42
  'accounts.list': { payload: EmptySchema, result: ProviderAccountsSchema },
@@ -58,6 +59,7 @@ export const AGENT_EVENT_SCHEMAS = {
58
59
  'chat.status': ChatStatusEventSchema,
59
60
  'chat.subagentChanged': ChatSubagentChangedEventSchema,
60
61
  'chat.bookmarks': ChatBookmarksEventSchema,
62
+ 'chat.visuals': ChatVisualsEventSchema,
61
63
  'usage.changed': UsageChangedEventSchema,
62
64
  'usage.limitsChanged': UsageLimitsSnapshotSchema,
63
65
  'accounts.changed': ProviderAccountsSchema
@@ -0,0 +1,120 @@
1
+ import { z } from 'zod';
2
+ export declare const VISUAL_LIMITS: {
3
+ readonly title: 200;
4
+ readonly minHeight: 80;
5
+ readonly maxHeight: 2000;
6
+ readonly bytes: number;
7
+ readonly heights: 24;
8
+ };
9
+ export declare const VISUAL_MEASURE_WIDTHS: readonly number[];
10
+ export declare const VisualHeightSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
11
+ export type VisualHeight = z.infer<typeof VisualHeightSchema>;
12
+ export declare const ChatVisualSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ title: z.ZodString;
15
+ at: z.ZodNumber;
16
+ maxHeight: z.ZodNumber;
17
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
18
+ size: z.ZodNumber;
19
+ turnId: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ export type ChatVisual = z.infer<typeof ChatVisualSchema>;
22
+ export declare const ChatVisualsSchema: z.ZodArray<z.ZodObject<{
23
+ id: z.ZodString;
24
+ title: z.ZodString;
25
+ at: z.ZodNumber;
26
+ maxHeight: z.ZodNumber;
27
+ heights: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
28
+ size: z.ZodNumber;
29
+ turnId: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>>;
31
+ export declare function visualFrameHeight(visual: Pick<ChatVisual, 'maxHeight' | 'heights'>, width: number): number | undefined;
32
+ export declare const VISUAL_BRIDGE_METHODS: {
33
+ readonly sandboxProxyReady: 'ui/notifications/sandbox-proxy-ready';
34
+ readonly sandboxResourceReady: 'ui/notifications/sandbox-resource-ready';
35
+ readonly hostContextChanged: 'ui/notifications/host-context-changed';
36
+ readonly sizeChanged: 'ui/notifications/size-changed';
37
+ readonly openLink: 'ui/open-link';
38
+ };
39
+ export type VisualAppearance = 'light' | 'dark';
40
+ export interface VisualTheme {
41
+ appearance: VisualAppearance;
42
+ variables: Readonly<Record<string, string>>;
43
+ }
44
+ export type VisualRequestId = string | number;
45
+ export type VisualMessage = {
46
+ method: typeof VISUAL_BRIDGE_METHODS.sandboxProxyReady;
47
+ } | {
48
+ method: typeof VISUAL_BRIDGE_METHODS.sandboxResourceReady;
49
+ html: string;
50
+ } | {
51
+ method: typeof VISUAL_BRIDGE_METHODS.hostContextChanged;
52
+ theme: VisualTheme;
53
+ } | {
54
+ method: typeof VISUAL_BRIDGE_METHODS.sizeChanged;
55
+ width?: number;
56
+ height: number;
57
+ } | {
58
+ method: typeof VISUAL_BRIDGE_METHODS.openLink;
59
+ id: VisualRequestId;
60
+ url: string;
61
+ };
62
+ export declare function visualProxyReadyMessage(): {
63
+ readonly jsonrpc: '2.0';
64
+ readonly method: "ui/notifications/sandbox-proxy-ready";
65
+ };
66
+ export declare function visualResourceReadyMessage(html: string): {
67
+ readonly jsonrpc: '2.0';
68
+ readonly method: "ui/notifications/sandbox-resource-ready";
69
+ readonly params: {
70
+ readonly html: string;
71
+ };
72
+ };
73
+ export declare function visualHostContextMessage(theme: VisualTheme): {
74
+ readonly jsonrpc: '2.0';
75
+ readonly method: "ui/notifications/host-context-changed";
76
+ readonly params: {
77
+ readonly theme: VisualAppearance;
78
+ readonly styles: {
79
+ readonly variables: {
80
+ readonly [x: string]: string;
81
+ };
82
+ };
83
+ };
84
+ };
85
+ export declare function visualSizeChangedMessage(size: {
86
+ width: number;
87
+ height: number;
88
+ }): {
89
+ readonly jsonrpc: '2.0';
90
+ readonly method: "ui/notifications/size-changed";
91
+ readonly params: {
92
+ readonly width: number;
93
+ readonly height: number;
94
+ };
95
+ };
96
+ export declare function visualOpenLinkRequest(id: VisualRequestId, url: string): {
97
+ readonly jsonrpc: '2.0';
98
+ readonly id: VisualRequestId;
99
+ readonly method: "ui/open-link";
100
+ readonly params: {
101
+ readonly url: string;
102
+ };
103
+ };
104
+ export declare function visualOpenLinkResult(id: VisualRequestId): {
105
+ readonly jsonrpc: '2.0';
106
+ readonly id: VisualRequestId;
107
+ readonly result: {};
108
+ };
109
+ export declare function parseVisualMessage(data: unknown): VisualMessage | undefined;
110
+ export declare const VISUAL_THEME_VARIABLES: readonly ['--background', '--foreground', '--muted', '--muted-foreground', '--card', '--card-foreground', '--popover', '--popover-foreground', '--secondary', '--secondary-foreground', '--border', '--input', '--ring', '--primary', '--primary-foreground', '--accent', '--accent-foreground', '--destructive', '--destructive-foreground', '--warning', '--warning-foreground', '--success', '--success-foreground', '--info', '--info-foreground', '--code-background', '--code-foreground', '--chart-1', '--chart-2', '--chart-3', '--chart-4', '--chart-5', '--chart-6', '--radius', '--font-sans', '--font-mono'];
111
+ export type VisualThemeVariable = (typeof VISUAL_THEME_VARIABLES)[number];
112
+ export declare const VISUAL_LIGHT_THEME: VisualTheme;
113
+ export declare const VISUAL_DARK_THEME: VisualTheme;
114
+ export declare function cleanVisualVariables(input: unknown): Record<string, string>;
115
+ export declare function visualThemeFragment(theme: VisualTheme): string;
116
+ export declare const VISUAL_PAGE_RULES: string;
117
+ export declare const VISUAL_LAYOUT_GUIDE: string;
118
+ export declare const VISUAL_THEME_GUIDE: string;
119
+ export declare function injectVisualBootstrap(html: string): string;
120
+ export declare const VISUAL_HOST_PAGE: string;