@tabs-and-spaces/sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/server.d.ts +94 -0
  2. package/package.json +1 -1
package/dist/server.d.ts CHANGED
@@ -54,6 +54,100 @@ export interface ActionRequest<Input = Record<string, unknown>> {
54
54
  dataKey: string;
55
55
  dataUrl: string;
56
56
  }
57
+ type Tone = "good" | "warning" | "bad" | "neutral";
58
+ /** A day (`2030-01-08`, all day) or an ISO time; without an offset, the asker's. */
59
+ type When = string;
60
+ /**
61
+ * A card showing what an action found, drawn under the agent's answer (the
62
+ * agent then doesn't retype it). Links are http(s) only. At most 8 per answer.
63
+ */
64
+ export type ActionCard = {
65
+ type: "emails";
66
+ title?: string;
67
+ items: {
68
+ from: string;
69
+ subject: string;
70
+ snippet?: string;
71
+ at?: When;
72
+ url?: string;
73
+ unread?: boolean;
74
+ important?: boolean;
75
+ note?: string;
76
+ }[];
77
+ } | {
78
+ type: "events";
79
+ title?: string;
80
+ items: {
81
+ title: string;
82
+ start: When;
83
+ end?: When;
84
+ where?: string;
85
+ people?: string[];
86
+ url?: string;
87
+ /** A video call's link. */
88
+ join?: string;
89
+ status?: "accepted" | "tentative" | "declined" | "needs_answer";
90
+ note?: string;
91
+ }[];
92
+ } | {
93
+ type: "metrics";
94
+ title?: string;
95
+ items: {
96
+ label: string;
97
+ value: string;
98
+ detail?: string;
99
+ tone?: Tone;
100
+ }[];
101
+ } | {
102
+ type: "table";
103
+ title?: string;
104
+ columns: string[];
105
+ rows: (string | number | null)[][];
106
+ } | {
107
+ type: "list";
108
+ title?: string;
109
+ items: {
110
+ title: string;
111
+ detail?: string;
112
+ meta?: string;
113
+ url?: string;
114
+ tone?: Tone;
115
+ }[];
116
+ } | {
117
+ type: "links";
118
+ title?: string;
119
+ items: {
120
+ label: string;
121
+ url: string;
122
+ detail?: string;
123
+ }[];
124
+ } | {
125
+ type: "note";
126
+ tone?: "info" | "success" | "warning" | "danger";
127
+ title?: string;
128
+ text: string;
129
+ } | {
130
+ type: "bars";
131
+ title?: string;
132
+ unit?: string;
133
+ items: {
134
+ label: string;
135
+ value: number;
136
+ }[];
137
+ } | {
138
+ type: "actions";
139
+ items: {
140
+ label: string;
141
+ prompt: string;
142
+ }[];
143
+ };
144
+ /** What an action's endpoint answers, with 200. */
145
+ export interface ActionAnswer {
146
+ /** For the agent to read: a sentence, or any JSON. */
147
+ result: unknown;
148
+ /** What it found, shown as cards under the agent's answer (actions that change nothing). */
149
+ cards?: ActionCard[];
150
+ }
57
151
  /**
58
152
  * Your app's data in the workspace, from your server, with the data key an
59
153
  * action was given: the same place (its space, tab and person) as the action,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tabs-and-spaces/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Building apps for Tabs & Spaces: a Custom tab's page talks to the workspace, its server checks who's looking. No dependencies.",
5
5
  "license": "MIT",
6
6
  "author": "Tabs & Spaces",