@quartal/hub-plugin 0.2.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 +19 -18
- package/dist/mod.d.ts +42 -20
- package/dist/mod.js +66 -17
- package/package.json +3 -2
- package/schemas/channel-1.0.schema.json +354 -341
package/README.md
CHANGED
|
@@ -1,18 +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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
};
|
|
@@ -537,6 +557,10 @@ declare const channelDefinitionSchema: {
|
|
|
537
557
|
readonly additionalProperties: false;
|
|
538
558
|
};
|
|
539
559
|
//#endregion
|
|
560
|
+
//#region src/channelPageTemplate.generated.d.ts
|
|
561
|
+
/** The files of a channel's own page, by path in the plugin (`templates/channel-page/`). */
|
|
562
|
+
declare const CHANNEL_PAGE_FILES: Readonly<Record<string, string>>;
|
|
563
|
+
//#endregion
|
|
540
564
|
//#region src/channelPluginFiles.d.ts
|
|
541
565
|
/** What a new channel plugin starts with. */
|
|
542
566
|
interface ChannelPluginOptions {
|
|
@@ -562,10 +586,20 @@ interface ChannelPluginOptions {
|
|
|
562
586
|
plugins?: ChannelAgentPlugin[];
|
|
563
587
|
/** The plugin's `qrtl.config.json` as the scaffold wrote it; title and description are kept from the options. */
|
|
564
588
|
baseConfig?: Record<string, unknown>;
|
|
589
|
+
/** The plugin's `package.json` as the scaffold wrote it; the page's dependencies are added. */
|
|
590
|
+
basePackage?: Record<string, unknown>;
|
|
565
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* What the channel's own page needs (`templates/channel-page/`): an Astro site with Vue, the chat
|
|
594
|
+
* of `@quartal/ui-messages` and the components of `@quartal/ui-core`. Raise the `@quartal/*` ranges
|
|
595
|
+
* when a release of those packages is what the template needs.
|
|
596
|
+
*/
|
|
597
|
+
declare const CHANNEL_PAGE_DEPENDENCIES: Readonly<Record<string, string>>;
|
|
566
598
|
/**
|
|
567
599
|
* The files of a new channel plugin, by path: `com.quartal.hub/channel.json`, `agents/default.md`,
|
|
568
|
-
* `qrtl.config.json` (Hub sign-in, the
|
|
600
|
+
* `qrtl.config.json` (Hub sign-in, the channel's page as the start page), `package.json` (the page's
|
|
601
|
+
* dependencies), the page ({@link CHANNEL_PAGE_FILES}: the chat with the channel's agents) and
|
|
602
|
+
* `README.md`.
|
|
569
603
|
* @param options What the channel starts with.
|
|
570
604
|
*/
|
|
571
605
|
declare function channelPluginFiles(options: ChannelPluginOptions): Record<string, string>;
|
|
@@ -622,36 +656,24 @@ declare function isTimeZone(timeZone: string): boolean;
|
|
|
622
656
|
/**
|
|
623
657
|
* What a Hub plugin's web site is.
|
|
624
658
|
*
|
|
625
|
-
* - `
|
|
626
|
-
* (
|
|
627
|
-
*
|
|
659
|
+
* - `channel` — a channel's own page (`src/pages/`), as its customers see it. Anyone may open it:
|
|
660
|
+
* the page signs in through the Hub, which hands over the session (`connectHubSession` of
|
|
661
|
+
* `@quartal/ui-messages`), and reads and writes through the Messages API as that person.
|
|
662
|
+
* - `app` — end-user pages (`src/pages/**`, container pages for widgets); every page needs a sign-in
|
|
628
663
|
* with a Hub account, except the `publicPages`.
|
|
629
664
|
*/
|
|
630
|
-
type HubSiteKind = '
|
|
665
|
+
type HubSiteKind = 'channel' | 'app';
|
|
631
666
|
/** The `auth` and `site` settings of a Hub plugin (the subset of `qrtl.config` they set). */
|
|
632
667
|
interface HubPluginSettings {
|
|
633
668
|
/** Sign-in is always Quartal Hub. */
|
|
634
669
|
auth: 'quartal-hub';
|
|
635
670
|
/** The web site (`qrtl.config` `site`). */
|
|
636
671
|
site: {
|
|
637
|
-
/** What `/` serves. */root: 'pages'
|
|
638
|
-
redirect: string;
|
|
639
|
-
}; /** Who may open the pages. */
|
|
672
|
+
/** What `/` serves: the plugin's own pages. */root: 'pages'; /** Who may open the pages. */
|
|
640
673
|
access?: 'user'; /** Pages anyone may open (path globs). */
|
|
641
674
|
public?: string[];
|
|
642
675
|
};
|
|
643
676
|
}
|
|
644
|
-
/**
|
|
645
|
-
* The placeholder of the Hub's address in a plugin's settings. The plugin host replaces it with the
|
|
646
|
-
* address of the Hub it serves (`HOST_HUB_URL`), so the same plugin works from any Hub and moves
|
|
647
|
-
* between repositories as it is.
|
|
648
|
-
*/
|
|
649
|
-
declare const HUB_URL_PLACEHOLDER = "{hub}";
|
|
650
|
-
/**
|
|
651
|
-
* A plugin's page in the Hub, as the start page of a `hub` plugin: `{hub}` is the Hub's address
|
|
652
|
-
* (filled by the plugin host), `{name}` the plugin's id (filled by the plugin runtime).
|
|
653
|
-
*/
|
|
654
|
-
declare const HUB_PLUGIN_PAGE = "{hub}/app/plugins/hosted/{name}";
|
|
655
677
|
/** Options of {@link hubPluginSettings}. */
|
|
656
678
|
interface HubPluginSettingsOptions {
|
|
657
679
|
/** For `app`: the pages anyone may open, as path globs (`/register/**`), e.g. a registration form. */
|
|
@@ -680,4 +702,4 @@ type ChannelDefinitionResult = {
|
|
|
680
702
|
*/
|
|
681
703
|
declare function parseChannelDefinition(input: string | unknown, ownPluginId: string): ChannelDefinitionResult;
|
|
682
704
|
//#endregion
|
|
683
|
-
export { CHANNEL_AGENT_TRIGGERS, CHANNEL_BASE_STATUSES, CHANNEL_DEFINITION_FILE, CHANNEL_DEFINITION_SCHEMA_URL, CHANNEL_KINDS, CHANNEL_SCHEDULE_TARGETS, ChannelAgentDefinition, ChannelAgentPlugin, ChannelAgentSchedule, ChannelAgentTrigger, ChannelBaseStatus, ChannelDefinition, ChannelDefinitionResult, ChannelKind, ChannelPluginAuth, ChannelPluginOptions, ChannelScheduleTarget, ChannelStatusDefinition, CronSchedule, DEFAULT_CHANNEL_AGENT, DEFAULT_SCHEDULE_TIME_ZONE, HUB_EXTENSION_NAMESPACE, HUB_LANGUAGES,
|
|
705
|
+
export { CHANNEL_AGENT_TRIGGERS, CHANNEL_BASE_STATUSES, CHANNEL_DEFINITION_FILE, CHANNEL_DEFINITION_SCHEMA_URL, CHANNEL_KINDS, CHANNEL_PAGE_DEPENDENCIES, CHANNEL_PAGE_FILES, CHANNEL_SCHEDULE_TARGETS, ChannelAgentDefinition, ChannelAgentPlugin, ChannelAgentSchedule, ChannelAgentTrigger, ChannelBaseStatus, ChannelDefinition, ChannelDefinitionResult, ChannelKind, ChannelPluginAuth, ChannelPluginOptions, ChannelScheduleTarget, ChannelStatusDefinition, CronSchedule, DEFAULT_CHANNEL_AGENT, DEFAULT_SCHEDULE_TIME_ZONE, HUB_EXTENSION_NAMESPACE, HUB_LANGUAGES, HUB_TOOLS, HUB_TOOL_GROUPS, HUB_TOOL_SETTINGS, HubLanguage, HubPluginSettings, HubPluginSettingsOptions, HubSiteKind, HubToolGroup, HubToolInfo, HubToolLevel, HubToolSetting, LocalizedText, ResolvedAgentRef, channelDefinitionSchema, channelPluginFiles, cronError, hubPluginSettings, hubTool, isHubToolKey, isLocalizedText, isTimeZone, localize, parseChannelDefinition, parseCron, resolveAgentRef, resolveHubTools };
|
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
|
}
|
|
@@ -321,19 +334,19 @@ const channelDefinitionSchema = {
|
|
|
321
334
|
additionalProperties: false
|
|
322
335
|
};
|
|
323
336
|
//#endregion
|
|
337
|
+
//#region src/channelPageTemplate.generated.ts
|
|
338
|
+
/** The files of a channel's own page, by path in the plugin (`templates/channel-page/`). */
|
|
339
|
+
const CHANNEL_PAGE_FILES = {
|
|
340
|
+
"astro.config.mjs": "import { defineConfig } from \"astro/config\";\nimport node from \"@astrojs/node\";\nimport vue from \"@astrojs/vue\";\nimport qrtlPlugin from \"@quartal/plugin/astro\";\n\nexport default defineConfig({\n output: \"server\",\n adapter: node({ mode: \"standalone\" }),\n // The channel's page is a Vue app (src/app/): vueApp.ts sets it up for every island.\n integrations: [vue({ appEntrypoint: \"/src/app/vueApp.ts\" }), qrtlPlugin()],\n});\n",
|
|
341
|
+
"src/app/channel-page.css": "/*\n * The channel page's own styles (dev-time staging: move them to a skin when they settle).\n * Every rule nests under the page's root class.\n */\n.channel-page {\n display: flex;\n flex-direction: column;\n height: 100vh;\n background: var(--bs-body-bg);\n\n /* Signed in at the page's own address: the guard holds the header and the body. */\n .channel-page-guard {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n }\n\n .channel-page-header {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.75rem;\n padding: 0.75rem 1rem;\n border-bottom: 1px solid var(--bs-border-color);\n }\n\n .channel-page-loading {\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n }\n\n .channel-page-body {\n display: flex;\n flex: 1;\n min-height: 0;\n }\n\n .channel-page-threads {\n width: 280px;\n flex-shrink: 0;\n overflow-y: auto;\n border-right: 1px solid var(--bs-border-color);\n }\n\n .channel-page-chat {\n flex: 1;\n min-width: 0;\n }\n\n @media (max-width: 767.98px) {\n .channel-page-threads {\n display: none;\n }\n }\n}\n",
|
|
342
|
+
"src/app/ChannelPage.vue": "<script setup lang=\"ts\">\nimport { onMounted, ref, watch } from \"vue\";\nimport {\n completeSignin,\n configureClient,\n configureSignin,\n connectHubSession,\n isSigninCallback,\n loadTexts,\n QActAsCompany,\n QAuthGuard,\n QChannelChat,\n QChannelThreadList,\n} from \"@quartal/ui-messages\";\n\n/**\n * The channel's page: the company's conversations on the left and the chat on the right.\n *\n * Opened at its own address, the page signs the person in with Quartal IAM (`QAuthGuard`) and they\n * pick the customer company they act as (`QActAsCompany`): a customer's user their own company, an\n * advisor any customer of their teams, to see the page as that customer would. `?company=<id>`\n * picks the company. In the Hub's customer's view the page is in a frame and takes the Hub's\n * session instead (`connectHubSession`).\n */\nconst props = defineProps<{\n /** The channel. */\n channelId: string;\n /** The channel's name. */\n title: string;\n /** The Hub's address: a frame takes its session only from it. */\n hubUrl: string;\n /** The Messages API's address. */\n apiUrl: string;\n /** Quartal IAM's realm (issuer). */\n oidcAuthority: string;\n /** The OIDC client of the browser apps. */\n oidcClientId: string;\n}>();\n\n/** `hub`: in the Hub's frame, the company comes with the session; `own`: signed in here. */\nconst mode = ref<\"connecting\" | \"hub\" | \"own\">(\"connecting\");\nconst companyId = ref<string | null>(new URLSearchParams(location.search).get(\"company\"));\n/** The open conversation; null starts a new one. */\nconst threadId = ref<string | null>(null);\nconst threadList = ref<InstanceType<typeof QChannelThreadList> | null>(null);\n\nconfigureClient({ messagesApiUrl: props.apiUrl, oidcAuthority: props.oidcAuthority, oidcClientId: props.oidcClientId });\nconfigureSignin(`${location.origin}/`);\n\n// The chosen company is in the address, so a reload keeps it.\nwatch(companyId, (id) => {\n const url = new URL(location.href);\n if (id) url.searchParams.set(\"company\", id);\n else url.searchParams.delete(\"company\");\n history.replaceState(history.state, \"\", url);\n threadId.value = null;\n});\n\nonMounted(async () => {\n if (window.parent !== window) {\n const session = await connectHubSession({ hubUrl: props.hubUrl });\n if (session) {\n companyId.value = session.companyId;\n mode.value = \"hub\";\n return;\n }\n }\n if (isSigninCallback()) await completeSignin();\n await loadTexts();\n mode.value = \"own\";\n});\n<\/script>\n\n<template>\n <div class=\"channel-page\">\n <div v-if=\"mode === 'connecting'\" class=\"channel-page-loading\">\n <div class=\"spinner-border text-body-secondary\" role=\"status\"></div>\n </div>\n <template v-else-if=\"mode === 'hub'\">\n <header class=\"channel-page-header\">\n <h1 class=\"h5 mb-0\">{{ title }}</h1>\n </header>\n <div v-if=\"companyId\" class=\"channel-page-body\">\n <aside class=\"channel-page-threads\">\n <QChannelThreadList ref=\"threadList\" v-model:thread-id=\"threadId\" :channel-id=\"channelId\" :company-id=\"companyId\" />\n </aside>\n <main class=\"channel-page-chat\">\n <QChannelChat v-model:thread-id=\"threadId\" :channel-id=\"channelId\" :company-id=\"companyId\" @created=\"threadList?.reload()\" />\n </main>\n </div>\n </template>\n <QAuthGuard v-else class=\"channel-page-guard\">\n <header class=\"channel-page-header\">\n <h1 class=\"h5 mb-0 me-auto\">{{ title }}</h1>\n <QActAsCompany v-model=\"companyId\" :channel-id=\"channelId\" />\n </header>\n <div v-if=\"companyId\" :key=\"companyId\" class=\"channel-page-body\">\n <aside class=\"channel-page-threads\">\n <QChannelThreadList ref=\"threadList\" v-model:thread-id=\"threadId\" :channel-id=\"channelId\" :company-id=\"companyId\" />\n </aside>\n <main class=\"channel-page-chat\">\n <QChannelChat v-model:thread-id=\"threadId\" :channel-id=\"channelId\" :company-id=\"companyId\" @created=\"threadList?.reload()\" />\n </main>\n </div>\n </QAuthGuard>\n </div>\n</template>\n",
|
|
343
|
+
"src/app/vueApp.ts": "import type { App } from \"vue\";\nimport { FakeSessionProvider, QUiCore, setSessionProvider, UiHelpers } from \"@quartal/ui-core\";\n\n// Styles: the Quartal skin (below), the chat's staging styles and this page's own.\nimport \"@quartal/ui-messages/dev-time-styles.css\";\nimport \"./channel-page.css\";\n\n/** Sets up the Vue app of every island on the page (`appEntrypoint` in astro.config.mjs). */\nexport default (app: App): void => {\n // The skin: Bootstrap and the Quartal look. Another skin of https://cdn.quartal.com/skins/ by name.\n UiHelpers.setCssLink(\"quartalSkin\", \"default\");\n // @quartal/ui-core's components read a session; the person's own comes from the Hub.\n const session = new FakeSessionProvider();\n setSessionProvider(session);\n session.login();\n app.use(QUiCore as never, { addBootstrapScripts: true, addMaterialSymbols: true });\n};\n",
|
|
344
|
+
"src/pages/index.astro": "---\n/**\n * The channel's own page, as its customers see it: by default the chat with the channel's agents.\n * The person signs in here, or the Hub's customer's view frames it with its session\n * (src/app/ChannelPage.vue).\n * The plugin host tells where the Hub and the Messages API are (HUB_URL, MESSAGES_API_URL).\n */\nimport ChannelPage from \"../app/ChannelPage.vue\";\nimport pkg from \"../../package.json\";\nimport config from \"../../qrtl.config.json\";\n\n// The plugin is the channel's own: `ch-<id>` is the plugin of the channel `<id>`.\nconst channelId = pkg.name.startsWith(\"ch-\") ? pkg.name.slice(3) : pkg.name;\nconst hubUrl = process.env.HUB_URL ?? \"https://hub.test.qrtl.com\";\nconst apiUrl = process.env.MESSAGES_API_URL ?? \"https://hub-api.test.qrtl.com\";\n// Quartal IAM: the page signs the person in itself when opened at its own address.\nconst oidcAuthority = process.env.HUB_OIDC_AUTHORITY ?? \"https://iam2026.test.qrtl.com/auth/realms/quartal\";\nconst oidcClientId = process.env.HUB_OIDC_CLIENT_ID ?? \"quartal-messages-web\";\n---\n<!doctype html>\n<html lang=\"fi\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>{config.title}</title>\n </head>\n <body>\n <ChannelPage\n client:only=\"vue\"\n channelId={channelId}\n title={config.title}\n hubUrl={hubUrl}\n apiUrl={apiUrl}\n oidcAuthority={oidcAuthority}\n oidcClientId={oidcClientId}\n />\n </body>\n</html>\n",
|
|
345
|
+
"src/tools/mod.ts": "// The channel's own tools: every class exported here is analyzed by @quartal/plugin, and each\n// public method becomes an MCP tool and a REST action that the channel's agents and pages can call.\n// Add your tool files and export them here, e.g.:\n// export * from \"./Orders.ts\";\nexport {};\n"
|
|
346
|
+
};
|
|
347
|
+
//#endregion
|
|
324
348
|
//#region src/hubSite.ts
|
|
325
349
|
/**
|
|
326
|
-
* The placeholder of the Hub's address in a plugin's settings. The plugin host replaces it with the
|
|
327
|
-
* address of the Hub it serves (`HOST_HUB_URL`), so the same plugin works from any Hub and moves
|
|
328
|
-
* between repositories as it is.
|
|
329
|
-
*/
|
|
330
|
-
const HUB_URL_PLACEHOLDER = "{hub}";
|
|
331
|
-
/**
|
|
332
|
-
* A plugin's page in the Hub, as the start page of a `hub` plugin: `{hub}` is the Hub's address
|
|
333
|
-
* (filled by the plugin host), `{name}` the plugin's id (filled by the plugin runtime).
|
|
334
|
-
*/
|
|
335
|
-
const HUB_PLUGIN_PAGE = `${HUB_URL_PLACEHOLDER}/app/plugins/hosted/{name}`;
|
|
336
|
-
/**
|
|
337
350
|
* The `auth` and `site` settings for a Hub plugin's `qrtl.config.json`.
|
|
338
351
|
* @param kind What the web site is.
|
|
339
352
|
* @param options The public pages.
|
|
@@ -349,7 +362,7 @@ function hubPluginSettings(kind, options = {}) {
|
|
|
349
362
|
};
|
|
350
363
|
return {
|
|
351
364
|
auth: "quartal-hub",
|
|
352
|
-
site: { root:
|
|
365
|
+
site: { root: "pages" }
|
|
353
366
|
};
|
|
354
367
|
}
|
|
355
368
|
//#endregion
|
|
@@ -383,12 +396,29 @@ function isLocalizedText(value) {
|
|
|
383
396
|
}
|
|
384
397
|
//#endregion
|
|
385
398
|
//#region src/channelPluginFiles.ts
|
|
399
|
+
/**
|
|
400
|
+
* What the channel's own page needs (`templates/channel-page/`): an Astro site with Vue, the chat
|
|
401
|
+
* of `@quartal/ui-messages` and the components of `@quartal/ui-core`. Raise the `@quartal/*` ranges
|
|
402
|
+
* when a release of those packages is what the template needs.
|
|
403
|
+
*/
|
|
404
|
+
const CHANNEL_PAGE_DEPENDENCIES = {
|
|
405
|
+
"@astrojs/node": "^11.1.14",
|
|
406
|
+
"@astrojs/vue": "^7.1.6",
|
|
407
|
+
"@quartal/plugin": "2.0.0-beta.0",
|
|
408
|
+
"@quartal/ui-core": "^1.6.0",
|
|
409
|
+
"@quartal/ui-messages": "^0.3.0",
|
|
410
|
+
astro: "^7.4.13",
|
|
411
|
+
vue: "^3.5.32",
|
|
412
|
+
"vue-router": "^5.0.4"
|
|
413
|
+
};
|
|
386
414
|
function yamlString(value) {
|
|
387
415
|
return JSON.stringify(value);
|
|
388
416
|
}
|
|
389
417
|
/**
|
|
390
418
|
* The files of a new channel plugin, by path: `com.quartal.hub/channel.json`, `agents/default.md`,
|
|
391
|
-
* `qrtl.config.json` (Hub sign-in, the
|
|
419
|
+
* `qrtl.config.json` (Hub sign-in, the channel's page as the start page), `package.json` (the page's
|
|
420
|
+
* dependencies), the page ({@link CHANNEL_PAGE_FILES}: the chat with the channel's agents) and
|
|
421
|
+
* `README.md`.
|
|
392
422
|
* @param options What the channel starts with.
|
|
393
423
|
*/
|
|
394
424
|
function channelPluginFiles(options) {
|
|
@@ -423,13 +453,23 @@ function channelPluginFiles(options) {
|
|
|
423
453
|
...options.baseConfig ?? {},
|
|
424
454
|
title,
|
|
425
455
|
description: description || `The channel ${title}.`,
|
|
426
|
-
...hubPluginSettings("
|
|
456
|
+
...hubPluginSettings("channel")
|
|
457
|
+
};
|
|
458
|
+
const basePackage = options.basePackage ?? {};
|
|
459
|
+
const pkg = {
|
|
460
|
+
...basePackage,
|
|
461
|
+
dependencies: {
|
|
462
|
+
...basePackage.dependencies,
|
|
463
|
+
...CHANNEL_PAGE_DEPENDENCIES
|
|
464
|
+
}
|
|
427
465
|
};
|
|
428
466
|
return {
|
|
429
467
|
[CHANNEL_DEFINITION_FILE]: `${JSON.stringify(definition, null, 2)}\n`,
|
|
430
468
|
[`agents/${DEFAULT_CHANNEL_AGENT}.md`]: agent,
|
|
431
469
|
"qrtl.config.json": `${JSON.stringify(config, null, 2)}\n`,
|
|
432
|
-
"
|
|
470
|
+
"package.json": `${JSON.stringify(pkg, null, 2)}\n`,
|
|
471
|
+
...CHANNEL_PAGE_FILES,
|
|
472
|
+
"README.md": `# ${title}\n\n${description || `The channel ${title}.`}\n\nA Quartal Hub channel: its definition is \`${CHANNEL_DEFINITION_FILE}\`, its agent \`agents/${DEFAULT_CHANNEL_AGENT}.md\`, its page \`src/pages/index.astro\` (the chat, in \`src/app/\`).\n`
|
|
433
473
|
};
|
|
434
474
|
}
|
|
435
475
|
//#endregion
|
|
@@ -637,8 +677,17 @@ function parseChannelDefinition(input, ownPluginId) {
|
|
|
637
677
|
if (icon !== void 0) status.icon = icon;
|
|
638
678
|
const color = optionalString(item.color, `${path}.color`);
|
|
639
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)];
|
|
640
686
|
definition.statuses.push(status);
|
|
641
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
|
+
});
|
|
642
691
|
if (raw.agents !== void 0 && !Array.isArray(raw.agents)) errors.push("agents: an array.");
|
|
643
692
|
const refs = /* @__PURE__ */ new Set();
|
|
644
693
|
(Array.isArray(raw.agents) ? raw.agents : []).forEach((item, i) => {
|
|
@@ -739,4 +788,4 @@ function parseChannelDefinition(input, ownPluginId) {
|
|
|
739
788
|
};
|
|
740
789
|
}
|
|
741
790
|
//#endregion
|
|
742
|
-
export { CHANNEL_AGENT_TRIGGERS, CHANNEL_BASE_STATUSES, CHANNEL_DEFINITION_FILE, CHANNEL_DEFINITION_SCHEMA_URL, CHANNEL_KINDS, CHANNEL_SCHEDULE_TARGETS, DEFAULT_CHANNEL_AGENT, DEFAULT_SCHEDULE_TIME_ZONE, HUB_EXTENSION_NAMESPACE, HUB_LANGUAGES,
|
|
791
|
+
export { CHANNEL_AGENT_TRIGGERS, CHANNEL_BASE_STATUSES, CHANNEL_DEFINITION_FILE, CHANNEL_DEFINITION_SCHEMA_URL, CHANNEL_KINDS, CHANNEL_PAGE_DEPENDENCIES, CHANNEL_PAGE_FILES, CHANNEL_SCHEDULE_TARGETS, DEFAULT_CHANNEL_AGENT, DEFAULT_SCHEDULE_TIME_ZONE, HUB_EXTENSION_NAMESPACE, HUB_LANGUAGES, HUB_TOOLS, HUB_TOOL_GROUPS, HUB_TOOL_SETTINGS, channelDefinitionSchema, channelPluginFiles, cronError, hubPluginSettings, hubTool, isHubToolKey, isLocalizedText, isTimeZone, localize, parseChannelDefinition, parseCron, resolveAgentRef, resolveHubTools };
|
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.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Quartal Accounting Software Oy",
|
|
7
7
|
"repository": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
37
37
|
"test": "tsx --test \"src/**/*.test.ts\"",
|
|
38
38
|
"schema": "tsx scripts/writeSchema.ts",
|
|
39
|
-
"build": "tsdown"
|
|
39
|
+
"build": "tsdown",
|
|
40
|
+
"template": "tsx scripts/writeTemplate.ts"
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
"
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
"
|
|
256
|
-
"
|
|
257
|
-
"
|
|
258
|
-
"
|
|
259
|
-
"
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
"
|
|
265
|
-
"
|
|
266
|
-
"
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
"
|
|
272
|
-
"
|
|
273
|
-
"
|
|
274
|
-
"
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
"
|
|
284
|
-
"
|
|
285
|
-
"
|
|
286
|
-
"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
"
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
"
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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
|
+
}
|