@quartal/hub-plugin 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.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # @quartal/hub-plugin
2
-
3
- Quartal Hub's extension of [Quartal Plugin](https://plugin.quartal.com/): what makes a plugin a
4
- Hub plugin.
5
-
6
- - **The channel definition** — `com.quartal.hub/channel.json` in a plugin (an Agent Plugins
7
- extension directory): the channel's name and look, its thread statuses and its agents with their
8
- triggers, instructions and plugins. Types (`ChannelDefinition`), the JSON Schema
9
- (`@quartal/hub-plugin/channel-1.0.schema.json`, regenerate with `pnpm schema`) and the checks
10
- (`parseChannelDefinition`).
11
- - **The Hub settings of a plugin** — `hubPluginSettings('hub' | 'app', …)`: sign-in with Quartal
12
- Hub, and what the plugin's web site serves (`site` in `qrtl.config.json`).
13
- - **A new channel plugin** — `channelPluginFiles(…)`: the definition, the default agent, the Hub
14
- settings, the channel's own page (`templates/channel-page/`, written into
15
- `src/channelPageTemplate.generated.ts` by `pnpm template`) and a README, written over a plugin
16
- project. The page: [docs/channel-pages.md](../../docs/channel-pages.md).
17
-
18
- How channels use it: [docs/channel-definitions.md](../../docs/channel-definitions.md). The package
19
- is private to this workspace for now and exports its TypeScript source.
1
+ # @quartal/hub-plugin
2
+
3
+ Quartal Hub's extension of [Quartal Plugin](https://plugin.quartal.com/): what makes a plugin a
4
+ Hub plugin.
5
+
6
+ - **The channel definition** — `com.quartal.hub/channel.json` in a plugin (an Agent Plugins
7
+ extension directory): the channel's name and look, its thread statuses and its agents with their
8
+ triggers, instructions and plugins. Types (`ChannelDefinition`), the JSON Schema
9
+ (`@quartal/hub-plugin/channel-1.0.schema.json`, regenerate with `pnpm schema`) and the checks
10
+ (`parseChannelDefinition`).
11
+ - **The Hub settings of a plugin** — `hubPluginSettings('hub' | 'app', …)`: sign-in with Quartal
12
+ Hub, and what the plugin's web site serves (`site` in `qrtl.config.json`).
13
+ - **A new channel plugin** — `channelPluginFiles(…)`: the definition, the default agent, the Hub
14
+ settings, the channel's own page (`templates/channel-page/`, written into
15
+ `src/channelPageTemplate.generated.ts` by `pnpm template`) and a README, written over a plugin
16
+ project. The page: [docs/channel-pages.md](../../docs/channel-pages.md).
17
+
18
+ How channels use it: [docs/channel-definitions.md](../../docs/channel-definitions.md). The package
19
+ is private to this workspace for now and exports its TypeScript source.
package/dist/mod.d.ts CHANGED
@@ -163,6 +163,13 @@ interface ChannelStatusDefinition {
163
163
  icon?: string;
164
164
  /** A Bootstrap theme color name or a CSS color; the base status' color when unset. */
165
165
  color?: string;
166
+ /** Not a column of the Kanban view (e.g. an archived status); its threads are still in the other views. */
167
+ hidden?: boolean;
168
+ /**
169
+ * The keys of the statuses a thread may move to from this one: the arrows of the channel's
170
+ * workflow picture. Unset: no arrows are drawn from it.
171
+ */
172
+ next?: string[];
166
173
  }
167
174
  /**
168
175
  * How an agent calls a plugin.
@@ -403,6 +410,19 @@ declare const channelDefinitionSchema: {
403
410
  readonly color: {
404
411
  readonly type: "string";
405
412
  };
413
+ readonly hidden: {
414
+ readonly type: "boolean";
415
+ readonly description: "Not a column of the Kanban view; its threads are still in the other views.";
416
+ };
417
+ readonly next: {
418
+ readonly type: "array";
419
+ readonly description: "The keys of the statuses a thread may move to from this one (the arrows of the workflow picture).";
420
+ readonly items: {
421
+ readonly type: "string";
422
+ readonly pattern: "^[a-z0-9][a-z0-9_-]*$";
423
+ };
424
+ readonly uniqueItems: true;
425
+ };
406
426
  };
407
427
  readonly additionalProperties: false;
408
428
  };
package/dist/mod.js CHANGED
@@ -204,7 +204,20 @@ const channelDefinitionSchema = {
204
204
  description: localizedText,
205
205
  baseStatus: { enum: [...CHANNEL_BASE_STATUSES] },
206
206
  icon: { type: "string" },
207
- color: { type: "string" }
207
+ color: { type: "string" },
208
+ hidden: {
209
+ type: "boolean",
210
+ description: "Not a column of the Kanban view; its threads are still in the other views."
211
+ },
212
+ next: {
213
+ type: "array",
214
+ description: "The keys of the statuses a thread may move to from this one (the arrows of the workflow picture).",
215
+ items: {
216
+ type: "string",
217
+ pattern: "^[a-z0-9][a-z0-9_-]*$"
218
+ },
219
+ uniqueItems: true
220
+ }
208
221
  },
209
222
  additionalProperties: false
210
223
  }
@@ -664,8 +677,17 @@ function parseChannelDefinition(input, ownPluginId) {
664
677
  if (icon !== void 0) status.icon = icon;
665
678
  const color = optionalString(item.color, `${path}.color`);
666
679
  if (color !== void 0) status.color = color;
680
+ if (item.hidden !== void 0) {
681
+ if (typeof item.hidden !== "boolean") errors.push(`${path}.hidden: true or false.`);
682
+ else if (item.hidden) status.hidden = true;
683
+ }
684
+ if (item.next !== void 0) if (!Array.isArray(item.next) || item.next.some((k) => typeof k !== "string" || !STATUS_KEY.test(k))) errors.push(`${path}.next: an array of status keys.`);
685
+ else status.next = [...new Set(item.next)];
667
686
  definition.statuses.push(status);
668
687
  });
688
+ definition.statuses.forEach((status, i) => {
689
+ for (const k of status.next ?? []) if (!keys.has(k)) errors.push(`statuses[${i}].next: no status "${k}".`);
690
+ });
669
691
  if (raw.agents !== void 0 && !Array.isArray(raw.agents)) errors.push("agents: an array.");
670
692
  const refs = /* @__PURE__ */ new Set();
671
693
  (Array.isArray(raw.agents) ? raw.agents : []).forEach((item, i) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quartal/hub-plugin",
3
3
  "description": "Quartal Hub's extension of Quartal Plugin: channel definitions, Hub sign-in and pages",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "license": "MIT",
6
6
  "author": "Quartal Accounting Software Oy",
7
7
  "repository": {
@@ -1,341 +1,354 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://hub.quartal.com/schemas/channel-1.0.schema.json",
4
- "title": "Quartal Hub channel definition",
5
- "type": "object",
6
- "required": [
7
- "title"
8
- ],
9
- "properties": {
10
- "$schema": {
11
- "type": "string"
12
- },
13
- "title": {
14
- "oneOf": [
15
- {
16
- "type": "string"
17
- },
18
- {
19
- "type": "object",
20
- "properties": {
21
- "fi": {
22
- "type": "string"
23
- },
24
- "en": {
25
- "type": "string"
26
- },
27
- "sv": {
28
- "type": "string"
29
- }
30
- },
31
- "additionalProperties": false
32
- }
33
- ],
34
- "description": "The name a channel made from the definition gets."
35
- },
36
- "description": {
37
- "oneOf": [
38
- {
39
- "type": "string"
40
- },
41
- {
42
- "type": "object",
43
- "properties": {
44
- "fi": {
45
- "type": "string"
46
- },
47
- "en": {
48
- "type": "string"
49
- },
50
- "sv": {
51
- "type": "string"
52
- }
53
- },
54
- "additionalProperties": false
55
- }
56
- ]
57
- },
58
- "kind": {
59
- "enum": [
60
- "multi-party",
61
- "copilot"
62
- ],
63
- "description": "multi-party (default): people and agents in Quartal's chat; copilot: one person and one agent per thread, open to AG-UI clients."
64
- },
65
- "icon": {
66
- "type": "string",
67
- "description": "A Material Symbols icon name."
68
- },
69
- "color": {
70
- "type": "string",
71
- "description": "A Bootstrap theme color name or a CSS color."
72
- },
73
- "avatar": {
74
- "type": "string",
75
- "description": "A picture shown instead of the icon: a path in the plugin or a URL."
76
- },
77
- "statuses": {
78
- "type": "array",
79
- "description": "The thread statuses, in view order; the first is a new thread's.",
80
- "items": {
81
- "type": "object",
82
- "required": [
83
- "key",
84
- "text",
85
- "baseStatus"
86
- ],
87
- "properties": {
88
- "key": {
89
- "type": "string",
90
- "pattern": "^[a-z0-9][a-z0-9_-]*$"
91
- },
92
- "text": {
93
- "oneOf": [
94
- {
95
- "type": "string"
96
- },
97
- {
98
- "type": "object",
99
- "properties": {
100
- "fi": {
101
- "type": "string"
102
- },
103
- "en": {
104
- "type": "string"
105
- },
106
- "sv": {
107
- "type": "string"
108
- }
109
- },
110
- "additionalProperties": false
111
- }
112
- ]
113
- },
114
- "description": {
115
- "oneOf": [
116
- {
117
- "type": "string"
118
- },
119
- {
120
- "type": "object",
121
- "properties": {
122
- "fi": {
123
- "type": "string"
124
- },
125
- "en": {
126
- "type": "string"
127
- },
128
- "sv": {
129
- "type": "string"
130
- }
131
- },
132
- "additionalProperties": false
133
- }
134
- ]
135
- },
136
- "baseStatus": {
137
- "enum": [
138
- "unread",
139
- "in_progress",
140
- "handled",
141
- "archived",
142
- "error",
143
- "warning"
144
- ]
145
- },
146
- "icon": {
147
- "type": "string"
148
- },
149
- "color": {
150
- "type": "string"
151
- }
152
- },
153
- "additionalProperties": false
154
- }
155
- },
156
- "agents": {
157
- "type": "array",
158
- "items": {
159
- "type": "object",
160
- "required": [
161
- "agent",
162
- "triggers"
163
- ],
164
- "properties": {
165
- "agent": {
166
- "type": "string",
167
- "pattern": "^[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)?$",
168
- "description": "<name> or <plugin id>/<name>"
169
- },
170
- "triggers": {
171
- "type": "array",
172
- "items": {
173
- "enum": [
174
- "manual",
175
- "create_thread",
176
- "company_message",
177
- "advisor_message",
178
- "assign",
179
- "status_change",
180
- "schedule"
181
- ]
182
- },
183
- "uniqueItems": true
184
- },
185
- "active": {
186
- "type": "boolean"
187
- },
188
- "instructions": {
189
- "type": "string"
190
- },
191
- "approve": {
192
- "type": "array",
193
- "items": {
194
- "type": "string",
195
- "minLength": 1
196
- },
197
- "uniqueItems": true,
198
- "description": "Tools that run only after the person the agent answers approves the call."
199
- },
200
- "plugins": {
201
- "type": "array",
202
- "items": {
203
- "type": "object",
204
- "required": [
205
- "id"
206
- ],
207
- "properties": {
208
- "id": {
209
- "type": "string",
210
- "minLength": 1
211
- },
212
- "tools": {
213
- "type": "array",
214
- "items": {
215
- "type": "string"
216
- }
217
- },
218
- "skills": {
219
- "type": "array",
220
- "items": {
221
- "type": "string"
222
- }
223
- },
224
- "widgets": {
225
- "type": "boolean"
226
- },
227
- "auth": {
228
- "enum": [
229
- "none",
230
- "token"
231
- ]
232
- }
233
- },
234
- "additionalProperties": false
235
- }
236
- },
237
- "hubTools": {
238
- "type": "object",
239
- "description": "The Hub's own tools for this agent, by tool or group: allow, ask (approval), off, or on (the tool's own level).",
240
- "propertyNames": {
241
- "enum": [
242
- "thread",
243
- "files",
244
- "memory",
245
- "plan",
246
- "context",
247
- "web",
248
- "thread_set_status",
249
- "ask_user",
250
- "thread_assign",
251
- "message_post",
252
- "thread_create",
253
- "thread_search",
254
- "files_list",
255
- "files_read",
256
- "files_search",
257
- "files_write",
258
- "files_edit",
259
- "files_move",
260
- "files_copy",
261
- "files_mkdir",
262
- "files_delete",
263
- "memory",
264
- "plan",
265
- "company_context",
266
- "web_fetch"
267
- ]
268
- },
269
- "additionalProperties": {
270
- "enum": [
271
- "on",
272
- "allow",
273
- "ask",
274
- "off"
275
- ]
276
- }
277
- },
278
- "schedules": {
279
- "type": "array",
280
- "description": "Time-based runs: at each time, the agent gets the message in each customer company the schedule names, acting for the company with its own agent token.",
281
- "items": {
282
- "type": "object",
283
- "required": [
284
- "id",
285
- "cron",
286
- "message"
287
- ],
288
- "properties": {
289
- "id": {
290
- "type": "string",
291
- "pattern": "^[a-z0-9][a-z0-9_-]*$"
292
- },
293
- "cron": {
294
- "type": "string",
295
- "description": "minute hour day-of-month month day-of-week, e.g. \"0 9 5 * *\"."
296
- },
297
- "timeZone": {
298
- "type": "string",
299
- "description": "IANA time zone (default Europe/Helsinki)."
300
- },
301
- "message": {
302
- "type": "string",
303
- "minLength": 1
304
- },
305
- "threadTitle": {
306
- "type": "string"
307
- },
308
- "companies": {
309
- "description": "The companies it runs for: \"all\" (default) for every customer the channel lists, or their directory ids.",
310
- "oneOf": [
311
- {
312
- "const": "all"
313
- },
314
- {
315
- "type": "array",
316
- "items": {
317
- "type": "string",
318
- "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
319
- },
320
- "uniqueItems": true
321
- }
322
- ]
323
- },
324
- "target": {
325
- "enum": [
326
- "message",
327
- "thread"
328
- ],
329
- "description": "Where each run goes (default message): a new message in one thread per company, or a new thread each time."
330
- }
331
- },
332
- "additionalProperties": false
333
- }
334
- }
335
- },
336
- "additionalProperties": false
337
- }
338
- }
339
- },
340
- "additionalProperties": false
341
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://hub.quartal.com/schemas/channel-1.0.schema.json",
4
+ "title": "Quartal Hub channel definition",
5
+ "type": "object",
6
+ "required": [
7
+ "title"
8
+ ],
9
+ "properties": {
10
+ "$schema": {
11
+ "type": "string"
12
+ },
13
+ "title": {
14
+ "oneOf": [
15
+ {
16
+ "type": "string"
17
+ },
18
+ {
19
+ "type": "object",
20
+ "properties": {
21
+ "fi": {
22
+ "type": "string"
23
+ },
24
+ "en": {
25
+ "type": "string"
26
+ },
27
+ "sv": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "additionalProperties": false
32
+ }
33
+ ],
34
+ "description": "The name a channel made from the definition gets."
35
+ },
36
+ "description": {
37
+ "oneOf": [
38
+ {
39
+ "type": "string"
40
+ },
41
+ {
42
+ "type": "object",
43
+ "properties": {
44
+ "fi": {
45
+ "type": "string"
46
+ },
47
+ "en": {
48
+ "type": "string"
49
+ },
50
+ "sv": {
51
+ "type": "string"
52
+ }
53
+ },
54
+ "additionalProperties": false
55
+ }
56
+ ]
57
+ },
58
+ "kind": {
59
+ "enum": [
60
+ "multi-party",
61
+ "copilot"
62
+ ],
63
+ "description": "multi-party (default): people and agents in Quartal's chat; copilot: one person and one agent per thread, open to AG-UI clients."
64
+ },
65
+ "icon": {
66
+ "type": "string",
67
+ "description": "A Material Symbols icon name."
68
+ },
69
+ "color": {
70
+ "type": "string",
71
+ "description": "A Bootstrap theme color name or a CSS color."
72
+ },
73
+ "avatar": {
74
+ "type": "string",
75
+ "description": "A picture shown instead of the icon: a path in the plugin or a URL."
76
+ },
77
+ "statuses": {
78
+ "type": "array",
79
+ "description": "The thread statuses, in view order; the first is a new thread's.",
80
+ "items": {
81
+ "type": "object",
82
+ "required": [
83
+ "key",
84
+ "text",
85
+ "baseStatus"
86
+ ],
87
+ "properties": {
88
+ "key": {
89
+ "type": "string",
90
+ "pattern": "^[a-z0-9][a-z0-9_-]*$"
91
+ },
92
+ "text": {
93
+ "oneOf": [
94
+ {
95
+ "type": "string"
96
+ },
97
+ {
98
+ "type": "object",
99
+ "properties": {
100
+ "fi": {
101
+ "type": "string"
102
+ },
103
+ "en": {
104
+ "type": "string"
105
+ },
106
+ "sv": {
107
+ "type": "string"
108
+ }
109
+ },
110
+ "additionalProperties": false
111
+ }
112
+ ]
113
+ },
114
+ "description": {
115
+ "oneOf": [
116
+ {
117
+ "type": "string"
118
+ },
119
+ {
120
+ "type": "object",
121
+ "properties": {
122
+ "fi": {
123
+ "type": "string"
124
+ },
125
+ "en": {
126
+ "type": "string"
127
+ },
128
+ "sv": {
129
+ "type": "string"
130
+ }
131
+ },
132
+ "additionalProperties": false
133
+ }
134
+ ]
135
+ },
136
+ "baseStatus": {
137
+ "enum": [
138
+ "unread",
139
+ "in_progress",
140
+ "handled",
141
+ "archived",
142
+ "error",
143
+ "warning"
144
+ ]
145
+ },
146
+ "icon": {
147
+ "type": "string"
148
+ },
149
+ "color": {
150
+ "type": "string"
151
+ },
152
+ "hidden": {
153
+ "type": "boolean",
154
+ "description": "Not a column of the Kanban view; its threads are still in the other views."
155
+ },
156
+ "next": {
157
+ "type": "array",
158
+ "description": "The keys of the statuses a thread may move to from this one (the arrows of the workflow picture).",
159
+ "items": {
160
+ "type": "string",
161
+ "pattern": "^[a-z0-9][a-z0-9_-]*$"
162
+ },
163
+ "uniqueItems": true
164
+ }
165
+ },
166
+ "additionalProperties": false
167
+ }
168
+ },
169
+ "agents": {
170
+ "type": "array",
171
+ "items": {
172
+ "type": "object",
173
+ "required": [
174
+ "agent",
175
+ "triggers"
176
+ ],
177
+ "properties": {
178
+ "agent": {
179
+ "type": "string",
180
+ "pattern": "^[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)?$",
181
+ "description": "<name> or <plugin id>/<name>"
182
+ },
183
+ "triggers": {
184
+ "type": "array",
185
+ "items": {
186
+ "enum": [
187
+ "manual",
188
+ "create_thread",
189
+ "company_message",
190
+ "advisor_message",
191
+ "assign",
192
+ "status_change",
193
+ "schedule"
194
+ ]
195
+ },
196
+ "uniqueItems": true
197
+ },
198
+ "active": {
199
+ "type": "boolean"
200
+ },
201
+ "instructions": {
202
+ "type": "string"
203
+ },
204
+ "approve": {
205
+ "type": "array",
206
+ "items": {
207
+ "type": "string",
208
+ "minLength": 1
209
+ },
210
+ "uniqueItems": true,
211
+ "description": "Tools that run only after the person the agent answers approves the call."
212
+ },
213
+ "plugins": {
214
+ "type": "array",
215
+ "items": {
216
+ "type": "object",
217
+ "required": [
218
+ "id"
219
+ ],
220
+ "properties": {
221
+ "id": {
222
+ "type": "string",
223
+ "minLength": 1
224
+ },
225
+ "tools": {
226
+ "type": "array",
227
+ "items": {
228
+ "type": "string"
229
+ }
230
+ },
231
+ "skills": {
232
+ "type": "array",
233
+ "items": {
234
+ "type": "string"
235
+ }
236
+ },
237
+ "widgets": {
238
+ "type": "boolean"
239
+ },
240
+ "auth": {
241
+ "enum": [
242
+ "none",
243
+ "token"
244
+ ]
245
+ }
246
+ },
247
+ "additionalProperties": false
248
+ }
249
+ },
250
+ "hubTools": {
251
+ "type": "object",
252
+ "description": "The Hub's own tools for this agent, by tool or group: allow, ask (approval), off, or on (the tool's own level).",
253
+ "propertyNames": {
254
+ "enum": [
255
+ "thread",
256
+ "files",
257
+ "memory",
258
+ "plan",
259
+ "context",
260
+ "web",
261
+ "thread_set_status",
262
+ "ask_user",
263
+ "thread_assign",
264
+ "message_post",
265
+ "thread_create",
266
+ "thread_search",
267
+ "files_list",
268
+ "files_read",
269
+ "files_search",
270
+ "files_write",
271
+ "files_edit",
272
+ "files_move",
273
+ "files_copy",
274
+ "files_mkdir",
275
+ "files_delete",
276
+ "memory",
277
+ "plan",
278
+ "company_context",
279
+ "web_fetch"
280
+ ]
281
+ },
282
+ "additionalProperties": {
283
+ "enum": [
284
+ "on",
285
+ "allow",
286
+ "ask",
287
+ "off"
288
+ ]
289
+ }
290
+ },
291
+ "schedules": {
292
+ "type": "array",
293
+ "description": "Time-based runs: at each time, the agent gets the message in each customer company the schedule names, acting for the company with its own agent token.",
294
+ "items": {
295
+ "type": "object",
296
+ "required": [
297
+ "id",
298
+ "cron",
299
+ "message"
300
+ ],
301
+ "properties": {
302
+ "id": {
303
+ "type": "string",
304
+ "pattern": "^[a-z0-9][a-z0-9_-]*$"
305
+ },
306
+ "cron": {
307
+ "type": "string",
308
+ "description": "minute hour day-of-month month day-of-week, e.g. \"0 9 5 * *\"."
309
+ },
310
+ "timeZone": {
311
+ "type": "string",
312
+ "description": "IANA time zone (default Europe/Helsinki)."
313
+ },
314
+ "message": {
315
+ "type": "string",
316
+ "minLength": 1
317
+ },
318
+ "threadTitle": {
319
+ "type": "string"
320
+ },
321
+ "companies": {
322
+ "description": "The companies it runs for: \"all\" (default) for every customer the channel lists, or their directory ids.",
323
+ "oneOf": [
324
+ {
325
+ "const": "all"
326
+ },
327
+ {
328
+ "type": "array",
329
+ "items": {
330
+ "type": "string",
331
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
332
+ },
333
+ "uniqueItems": true
334
+ }
335
+ ]
336
+ },
337
+ "target": {
338
+ "enum": [
339
+ "message",
340
+ "thread"
341
+ ],
342
+ "description": "Where each run goes (default message): a new message in one thread per company, or a new thread each time."
343
+ }
344
+ },
345
+ "additionalProperties": false
346
+ }
347
+ }
348
+ },
349
+ "additionalProperties": false
350
+ }
351
+ }
352
+ },
353
+ "additionalProperties": false
354
+ }