@scout9/app 1.0.0-alpha.0.1.86 → 1.0.0-alpha.0.1.88
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/{exports-291eb22e.cjs → exports-b2e88386.cjs} +427 -267
- package/dist/index.cjs +12 -3
- package/dist/{multipart-parser-caa634a9.cjs → multipart-parser-78fb466c.cjs} +2 -2
- package/dist/{spirits-643c422a.cjs → spirits-1dc18cf4.cjs} +19 -19
- package/dist/spirits.cjs +1 -1
- package/dist/testing-tools.cjs +2 -2
- package/package.json +1 -1
- package/src/core/config/entities.js +2 -2
- package/src/core/config/index.js +2 -4
- package/src/core/config/project.js +3 -2
- package/src/core/config/workflow.js +3 -7
- package/src/core/index.js +15 -35
- package/src/core/sync.js +2 -2
- package/src/core/templates/project-files.js +1 -5
- package/src/exports.js +11 -7
- package/src/platform.js +213 -211
- package/src/public.d.ts +43 -80
- package/src/runtime/client/api.js +51 -159
- package/src/runtime/client/config.js +43 -7
- package/src/runtime/client/entity.js +19 -5
- package/src/runtime/client/index.js +2 -1
- package/src/runtime/client/message.js +13 -3
- package/src/runtime/client/platform.js +86 -0
- package/src/runtime/client/{agent.js → users.js} +25 -4
- package/src/runtime/client/utils.js +3 -2
- package/src/runtime/client/workflow.js +73 -5
- package/src/testing-tools/dev.js +13 -13
- package/src/testing-tools/mocks.js +6 -6
- package/src/testing-tools/spirits.js +19 -19
- package/src/utils/project-templates.js +5 -4
- package/types/index.d.ts +3036 -1318
- package/types/index.d.ts.map +53 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var spirits = require("./spirits-
|
|
3
|
+
var spirits = require("./spirits-1dc18cf4.cjs");
|
|
4
4
|
var readline = require('node:readline');
|
|
5
5
|
var require$$0$2 = require('fs');
|
|
6
6
|
var require$$2$1 = require('events');
|
|
@@ -41174,7 +41174,7 @@ class Body {
|
|
|
41174
41174
|
}
|
|
41175
41175
|
const {
|
|
41176
41176
|
toFormData
|
|
41177
|
-
} = await Promise.resolve().then(function () { return require("./multipart-parser-
|
|
41177
|
+
} = await Promise.resolve().then(function () { return require("./multipart-parser-78fb466c.cjs"); });
|
|
41178
41178
|
return toFormData(this.body, ct);
|
|
41179
41179
|
}
|
|
41180
41180
|
|
|
@@ -79141,20 +79141,21 @@ var _excluded$1 = ["entity", "entities", "api", "id"];
|
|
|
79141
79141
|
* @returns {string}
|
|
79142
79142
|
*/
|
|
79143
79143
|
function agentsTemplate(agents) {
|
|
79144
|
-
return "\n/**\n * Required core entity type: Agents represents you and your team\n * @returns {Array<import('@scout9/app').
|
|
79144
|
+
return "\n/**\n * Required core entity type: Agents represents you and your team\n * @returns {Array<import('@scout9/app').IAgent>}\n */\nexport default function Agents() {\n return ".concat(JSON.stringify(agents, null, 2), ";\n}\n");
|
|
79145
79145
|
}
|
|
79146
79146
|
|
|
79147
79147
|
/**
|
|
79148
79148
|
* @param {Scout9ProjectBuildConfig} config
|
|
79149
79149
|
* @param {string} exe - file extension
|
|
79150
79150
|
* @returns {string}
|
|
79151
|
+
*
|
|
79151
79152
|
*/
|
|
79152
79153
|
function rootTemplate(config) {
|
|
79153
79154
|
var _config$llm, _config$llm2, _config$pmt, _config$pmt2;
|
|
79154
|
-
return "\n/**\n * Configuration for the Scout9 project.\n * @type {import('@scout9/app').
|
|
79155
|
+
return "\n/**\n * Configuration for the Scout9 project.\n * @type {import('@scout9/app').IScout9ProjectConfig}\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: ".concat(config !== null && config !== void 0 && (_config$llm = config.llm) !== null && _config$llm !== void 0 && _config$llm.engine ? "'".concat(config.llm.engine, "'") : "'openai'", ",\n model: ").concat(config !== null && config !== void 0 && (_config$llm2 = config.llm) !== null && _config$llm2 !== void 0 && _config$llm2.model ? "'".concat(config.llm.model, "'") : "'gpt-3.5-turbo'", ",\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: ").concat(config !== null && config !== void 0 && (_config$pmt = config.pmt) !== null && _config$pmt !== void 0 && _config$pmt.engine ? "'".concat(config.pmt.engine, "'") : "'scout9'", ",\n model: ").concat(config !== null && config !== void 0 && (_config$pmt2 = config.pmt) !== null && _config$pmt2 !== void 0 && _config$pmt2.model ? "'".concat(config.pmt.model, "'") : "'orin-2.2'", ",\n },\n organization: ").concat(config !== null && config !== void 0 && config.organization ? JSON.stringify(config.organization, null, 2) : "{name: \"Organization Name\", description: \"Organization description.\"}", ",\n initialContext: ").concat(config !== null && config !== void 0 && config.initialContext ? JSON.stringify(config.initialContext, null, 2) : "[]", "\n}\n ");
|
|
79155
79156
|
}
|
|
79156
79157
|
function appTemplate() {
|
|
79157
|
-
return "\n/**\n * @param {import('@scout9/app').
|
|
79158
|
+
return "\n/**\n * @param {import('@scout9/app').IWorkflowEvent} event - every workflow receives an event object\n * @returns {Promise<import('@scout9/app').IWorkflowResponse>} - every workflow must return a WorkflowResponse\n */\nexport default async function Scout9App(event) {\n return {\n forward: true,\n };\n}\n ";
|
|
79158
79159
|
}
|
|
79159
79160
|
|
|
79160
79161
|
/**
|
|
@@ -81151,7 +81152,8 @@ function writeImageToServer(_x) {
|
|
|
81151
81152
|
return _writeImageToServer.apply(this, arguments);
|
|
81152
81153
|
}
|
|
81153
81154
|
/**
|
|
81154
|
-
* Loads the users local package.json, if they provide a package-s9-test.json,
|
|
81155
|
+
* Loads the users local package.json, if they provide a package-s9-test.json,
|
|
81156
|
+
* it will load that instead (used for scout9 internal testing)
|
|
81155
81157
|
* @param {cwd?: string}
|
|
81156
81158
|
* @returns {Promise<{isTest: boolean, pkg: {name: string; version: string; dependencies: Record<string, string>}}>}
|
|
81157
81159
|
*/
|
|
@@ -81213,7 +81215,7 @@ function loadUserPackageJson$1(_x2) {
|
|
|
81213
81215
|
}
|
|
81214
81216
|
|
|
81215
81217
|
/**
|
|
81216
|
-
* @returns {Promise<
|
|
81218
|
+
* @returns {Promise<import('@scout9/app').IScout9ProjectConfig>}
|
|
81217
81219
|
*/
|
|
81218
81220
|
function _loadUserPackageJson$1() {
|
|
81219
81221
|
_loadUserPackageJson$1 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
@@ -81230,7 +81232,7 @@ function _loadUserPackageJson$1() {
|
|
|
81230
81232
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
81231
81233
|
_context2.t0 = JSON;
|
|
81232
81234
|
_context2.next = 10;
|
|
81233
|
-
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-
|
|
81235
|
+
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-b2e88386.js', document.baseURI).href))), 'utf-8');
|
|
81234
81236
|
case 10:
|
|
81235
81237
|
_context2.t1 = _context2.sent;
|
|
81236
81238
|
pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
|
|
@@ -81562,8 +81564,8 @@ function _platformApi() {
|
|
|
81562
81564
|
}
|
|
81563
81565
|
|
|
81564
81566
|
/**
|
|
81565
|
-
* @param {
|
|
81566
|
-
* @returns {Promise<
|
|
81567
|
+
* @param {import('@scout9/app').IScout9ProjectBuildConfig} config
|
|
81568
|
+
* @returns {Promise<import('@scout9/app').IScout9ProjectBuildConfig>}
|
|
81567
81569
|
*/
|
|
81568
81570
|
function syncData(_x) {
|
|
81569
81571
|
return _syncData.apply(this, arguments);
|
|
@@ -82075,7 +82077,7 @@ function _loadUserPackageJson() {
|
|
|
82075
82077
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
82076
82078
|
_context.t0 = JSON;
|
|
82077
82079
|
_context.next = 10;
|
|
82078
|
-
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-
|
|
82080
|
+
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-b2e88386.js', document.baseURI).href))), 'utf-8');
|
|
82079
82081
|
case 10:
|
|
82080
82082
|
_context.t1 = _context.sent;
|
|
82081
82083
|
pkg = _context.t0.parse.call(_context.t0, _context.t1);
|
|
@@ -86635,22 +86637,54 @@ var moment = /*@__PURE__*/getDefaultExportFromCjs(momentExports);
|
|
|
86635
86637
|
|
|
86636
86638
|
/**
|
|
86637
86639
|
* @param {string} name
|
|
86640
|
+
* @param {Object} [props]
|
|
86638
86641
|
* @returns {import('zod').ZodString}
|
|
86639
86642
|
*/
|
|
86640
86643
|
function zId(name) {
|
|
86641
|
-
|
|
86644
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
86645
|
+
return z.string(props).regex(/^[A-Za-z0-9\-_\[\]]+$/, {
|
|
86642
86646
|
message: "Invalid ".concat(name, " ID: ID must not contain spaces and should only contain alphanumeric characters, dashes, or underscores.")
|
|
86643
86647
|
});
|
|
86644
86648
|
}
|
|
86645
86649
|
|
|
86650
|
+
/**
|
|
86651
|
+
* @typedef {import('zod').infer<typeof MessageSchema>} IMessage
|
|
86652
|
+
*/
|
|
86646
86653
|
var MessageSchema = z.object({
|
|
86647
|
-
|
|
86654
|
+
id: zId('Message ID', {
|
|
86655
|
+
description: 'Unique ID for the message'
|
|
86656
|
+
}),
|
|
86648
86657
|
role: z["enum"](['agent', 'customer', 'system']),
|
|
86649
|
-
|
|
86650
|
-
|
|
86658
|
+
content: z.string(),
|
|
86659
|
+
time: z.string({
|
|
86660
|
+
description: 'Datetime ISO 8601 timestamp'
|
|
86661
|
+
}),
|
|
86662
|
+
name: z.string().optional(),
|
|
86663
|
+
scheduled: z.string({
|
|
86664
|
+
description: 'Datetime ISO 8601 timestamp'
|
|
86665
|
+
}).optional(),
|
|
86666
|
+
context: z.any({
|
|
86667
|
+
description: 'The context generated from the message'
|
|
86668
|
+
}).optional(),
|
|
86669
|
+
intent: z.string({
|
|
86670
|
+
description: 'Detected intent'
|
|
86671
|
+
}).optional().nullable(),
|
|
86672
|
+
intentScore: z.number({
|
|
86673
|
+
description: 'Confidence score of the assigned intent'
|
|
86674
|
+
}).nullable().optional(),
|
|
86675
|
+
delayInSeconds: z.number({
|
|
86676
|
+
description: 'How long to delay the message manually in seconds'
|
|
86677
|
+
}).nullable().optional()
|
|
86651
86678
|
});
|
|
86652
86679
|
|
|
86680
|
+
/**
|
|
86681
|
+
* @typedef {import('zod').infer<typeof customerValueSchema>} ICustomerValue
|
|
86682
|
+
*/
|
|
86653
86683
|
var customerValueSchema = z.union([z["boolean"](), z.number(), z.string()]);
|
|
86684
|
+
|
|
86685
|
+
/**
|
|
86686
|
+
* @typedef {import('zod').infer<typeof customerSchema>} ICustomer
|
|
86687
|
+
*/
|
|
86654
86688
|
var customerSchema = z.object({
|
|
86655
86689
|
firstName: z.string().optional(),
|
|
86656
86690
|
lastName: z.string().optional(),
|
|
@@ -86670,6 +86704,10 @@ var customerSchema = z.object({
|
|
|
86670
86704
|
stripe: z.string().nullable().optional(),
|
|
86671
86705
|
stripeDev: z.string().nullable().optional()
|
|
86672
86706
|
}).catchall(customerValueSchema);
|
|
86707
|
+
|
|
86708
|
+
/**
|
|
86709
|
+
* @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IAgentBase
|
|
86710
|
+
*/
|
|
86673
86711
|
var agentBaseConfigurationSchema = z.object({
|
|
86674
86712
|
deployed: z.object({
|
|
86675
86713
|
web: z.string({
|
|
@@ -86682,6 +86720,7 @@ var agentBaseConfigurationSchema = z.object({
|
|
|
86682
86720
|
description: 'Email address for agent'
|
|
86683
86721
|
}).optional()
|
|
86684
86722
|
}).optional(),
|
|
86723
|
+
img: z.string().nullable().optional(),
|
|
86685
86724
|
firstName: z.string({
|
|
86686
86725
|
description: 'Agent first name'
|
|
86687
86726
|
}).optional(),
|
|
@@ -86722,190 +86761,70 @@ var agentBaseConfigurationSchema = z.object({
|
|
|
86722
86761
|
transcripts: z.array(z.array(MessageSchema)).optional(),
|
|
86723
86762
|
audios: z.array(z.any()).optional()
|
|
86724
86763
|
});
|
|
86764
|
+
|
|
86765
|
+
/**
|
|
86766
|
+
* @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IAgent
|
|
86767
|
+
* @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IPersona
|
|
86768
|
+
*/
|
|
86725
86769
|
var agentConfigurationSchema = agentBaseConfigurationSchema.extend({
|
|
86726
|
-
id: zId('Agent ID',
|
|
86770
|
+
id: zId('Agent ID', {
|
|
86727
86771
|
description: 'Unique ID for agent'
|
|
86728
|
-
})
|
|
86772
|
+
})
|
|
86729
86773
|
});
|
|
86774
|
+
|
|
86775
|
+
/**
|
|
86776
|
+
* @typedef {import('zod').infer<typeof agentsConfigurationSchema>} IAgentsConfiguration
|
|
86777
|
+
*/
|
|
86730
86778
|
var agentsConfigurationSchema = z.array(agentConfigurationSchema);
|
|
86731
|
-
var agentsBaseConfigurationSchema = z.array(agentBaseConfigurationSchema);
|
|
86732
86779
|
|
|
86733
|
-
|
|
86734
|
-
|
|
86735
|
-
|
|
86736
|
-
|
|
86737
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86738
|
-
// RouteId extends string | null = string | null,
|
|
86739
|
-
// SearchParams extends Partial<Record<string, string | string[]>> = Partial<Record<string, string>>
|
|
86740
|
-
// > = (event: EventRequest<RequestBody, Params, RouteId, SearchParams>) => MaybePromise<EventResponse<ResponseBody>>;
|
|
86741
|
-
//
|
|
86742
|
-
// /**
|
|
86743
|
-
// * For QUERY entity api calls, this is used for getting multiple entities
|
|
86744
|
-
// */
|
|
86745
|
-
// export type QueryRequestHandler<
|
|
86746
|
-
// ResponseBody = Record<string | number, any>,
|
|
86747
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86748
|
-
// RouteId extends string | null = string | null,
|
|
86749
|
-
// > = RequestHandler<unknown, ResponseBody[], Params, RouteId, {q?: string, page?: string, limit?: string, orderBy?: string, endAt?: string, startAt?: string}>;
|
|
86750
|
-
//
|
|
86751
|
-
// /**
|
|
86752
|
-
// * For GET entity api calls, this is used for getting one entity
|
|
86753
|
-
// */
|
|
86754
|
-
// export type GetRequestHandler<
|
|
86755
|
-
// ResponseBody = Record<string | number, any>,
|
|
86756
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86757
|
-
// RouteId extends string | null = string | null,
|
|
86758
|
-
// > = RequestHandler<unknown, ResponseBody, Params, RouteId>;
|
|
86759
|
-
//
|
|
86760
|
-
// /**
|
|
86761
|
-
// * For POST entity api calls, this is used for creating an entity
|
|
86762
|
-
// */
|
|
86763
|
-
// export type PostRequestHandler<
|
|
86764
|
-
// RequestBody = Record<string | number, any>,
|
|
86765
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86766
|
-
// RouteId extends string | null = string | null
|
|
86767
|
-
// > = RequestHandler<RequestBody, {success: boolean, id: string, error?: string | object, [key: string]: any}, Params, RouteId>;
|
|
86768
|
-
//
|
|
86769
|
-
// export type CreatedRequestHandler<
|
|
86770
|
-
// RequestBody = Record<string | number, any>,
|
|
86771
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86772
|
-
// RouteId extends string | null = string | null
|
|
86773
|
-
// > = PostRequestHandler<RequestBody, Params, RouteId>;
|
|
86774
|
-
//
|
|
86775
|
-
//
|
|
86776
|
-
// /**
|
|
86777
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86778
|
-
// */
|
|
86779
|
-
// export type PutRequestHandler<
|
|
86780
|
-
// RequestBody = Record<string | number, any>,
|
|
86781
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86782
|
-
// RouteId extends string | null = string | null
|
|
86783
|
-
// > = RequestHandler<Partial<RequestBody>, {success: boolean, error?: string | object, [key: string]: any}, Params, RouteId>;
|
|
86784
|
-
//
|
|
86785
|
-
//
|
|
86786
|
-
// /**
|
|
86787
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86788
|
-
// */
|
|
86789
|
-
// export type PatchRequestHandler<
|
|
86790
|
-
// RequestBody = Record<string | number, any>,
|
|
86791
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86792
|
-
// RouteId extends string | null = string | null
|
|
86793
|
-
// > = PutRequestHandler<RequestBody, Params, RouteId>;
|
|
86794
|
-
//
|
|
86795
|
-
// /**
|
|
86796
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86797
|
-
// */
|
|
86798
|
-
// export type UpdateRequestHandler<
|
|
86799
|
-
// RequestBody = Record<string | number, any>,
|
|
86800
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86801
|
-
// RouteId extends string | null = string | null
|
|
86802
|
-
// > = PutRequestHandler<RequestBody, Params, RouteId>;
|
|
86803
|
-
//
|
|
86804
|
-
// /**
|
|
86805
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86806
|
-
// */
|
|
86807
|
-
// export type DeleteRequestHandler<
|
|
86808
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86809
|
-
// RouteId extends string | null = string | null
|
|
86810
|
-
// > = RequestHandler<unknown, {success: boolean, error?: string | object, [key: string]: any}, Params, RouteId>;
|
|
86811
|
-
//
|
|
86812
|
-
//
|
|
86813
|
-
// export interface EventRequest<
|
|
86814
|
-
// Body = unknown,
|
|
86815
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86816
|
-
// RouteId extends string | null = string | null,
|
|
86817
|
-
// SearchParams extends Partial<Record<string, string | string[]>> = Partial<Record<string, string>>,
|
|
86818
|
-
// > {
|
|
86819
|
-
//
|
|
86820
|
-
// /**
|
|
86821
|
-
// * `fetch` is equivalent to the [native `fetch` web API](https://developer.mozilla.org/en-US/docs/Web/API/fetch), with a few additional features:
|
|
86822
|
-
// *
|
|
86823
|
-
// * - It can be used to make credentialed requests on the server, as it inherits the `cookie` and `authorization` headers for the page request.
|
|
86824
|
-
// * - It can make relative requests on the server (ordinarily, `fetch` requires a URL with an origin when used in a server context).
|
|
86825
|
-
// * - Internal requests (e.g. for `+server.js` routes) go directly to the handler function when running on the server, without the overhead of an HTTP call.
|
|
86826
|
-
// * - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included
|
|
86827
|
-
// * - During hydration, the response will be read from the HTML, guaranteeing consistency and preventing an additional network request.
|
|
86828
|
-
// *
|
|
86829
|
-
// */
|
|
86830
|
-
// fetch: typeof fetch;
|
|
86831
|
-
//
|
|
86832
|
-
// /**
|
|
86833
|
-
// * The parameters of the current route - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object
|
|
86834
|
-
// */
|
|
86835
|
-
// params: Params;
|
|
86836
|
-
//
|
|
86837
|
-
// /**
|
|
86838
|
-
// * The requested URL.
|
|
86839
|
-
// */
|
|
86840
|
-
// url: URL;
|
|
86841
|
-
//
|
|
86842
|
-
// /**
|
|
86843
|
-
// * The anticipated searchParams inside `const { searchParams } = new URL(req.url)`
|
|
86844
|
-
// */
|
|
86845
|
-
// searchParams: SearchParams;
|
|
86846
|
-
//
|
|
86847
|
-
// /**
|
|
86848
|
-
// * The anticipated parsed body inside `request.body`
|
|
86849
|
-
// */
|
|
86850
|
-
// body: Body;
|
|
86851
|
-
//
|
|
86852
|
-
// /**
|
|
86853
|
-
// * The original request object
|
|
86854
|
-
// */
|
|
86855
|
-
// request: Request;
|
|
86856
|
-
//
|
|
86857
|
-
// /**
|
|
86858
|
-
// * If you need to set headers for the response, you can do so using the this method. This is useful if you want the page to be cached, for example:
|
|
86859
|
-
// *
|
|
86860
|
-
// * ```js
|
|
86861
|
-
// * /// file: src/routes/blog/+page.js
|
|
86862
|
-
// * export async function load({ fetch, setHeaders }) {
|
|
86863
|
-
// * const url = `https://cms.example.com/articles.json`;
|
|
86864
|
-
// * const response = await fetch(url);
|
|
86865
|
-
// *
|
|
86866
|
-
// * setHeaders({
|
|
86867
|
-
// * age: response.headers.get('age'),
|
|
86868
|
-
// * 'cache-control': response.headers.get('cache-control')
|
|
86869
|
-
// * });
|
|
86870
|
-
// *
|
|
86871
|
-
// * return response.json();
|
|
86872
|
-
// * }
|
|
86873
|
-
// * ```
|
|
86874
|
-
// *
|
|
86875
|
-
// * Setting the same header multiple times (even in separate `load` functions) is an error — you can only set a given header once.
|
|
86876
|
-
// *
|
|
86877
|
-
// * You cannot add a `set-cookie` header with `setHeaders` API instead.
|
|
86878
|
-
// */
|
|
86879
|
-
// setHeaders(headers: Record<string, string>): void;
|
|
86880
|
-
//
|
|
86881
|
-
// /**
|
|
86882
|
-
// * Info about the current route
|
|
86883
|
-
// */
|
|
86884
|
-
// route: {
|
|
86885
|
-
// /**
|
|
86886
|
-
// * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`
|
|
86887
|
-
// */
|
|
86888
|
-
// id: RouteId;
|
|
86889
|
-
// };
|
|
86890
|
-
// }
|
|
86780
|
+
/**
|
|
86781
|
+
* @typedef {import('zod').infer<typeof agentsBaseConfigurationSchema>} IAgentsBaseConfiguration
|
|
86782
|
+
*/
|
|
86783
|
+
var agentsBaseConfigurationSchema = z.array(agentBaseConfigurationSchema);
|
|
86891
86784
|
|
|
86892
86785
|
/**
|
|
86893
86786
|
* Utility runtime class used to guide event output
|
|
86787
|
+
* @template T
|
|
86894
86788
|
*/
|
|
86895
86789
|
var EventResponse = /*#__PURE__*/function () {
|
|
86790
|
+
/**
|
|
86791
|
+
* Create an EventResponse.
|
|
86792
|
+
* @param {T} body - The body of the response.
|
|
86793
|
+
* @param {ResponseInit} [init] - Additional options for the response.
|
|
86794
|
+
* @throws {Error} If the body is not a valid object.
|
|
86795
|
+
*/
|
|
86896
86796
|
function EventResponse(body, init) {
|
|
86897
86797
|
spirits._classCallCheck(this, EventResponse);
|
|
86798
|
+
/**
|
|
86799
|
+
* @type {T}
|
|
86800
|
+
* @private
|
|
86801
|
+
*/
|
|
86898
86802
|
this.body = body;
|
|
86803
|
+
|
|
86804
|
+
/**
|
|
86805
|
+
* @type {ResponseInit}
|
|
86806
|
+
* @private
|
|
86807
|
+
*/
|
|
86899
86808
|
this.init = init;
|
|
86900
86809
|
if (spirits._typeof(this.body) !== 'object') {
|
|
86901
86810
|
throw new Error("EventResponse body in not a valid object:\n\"".concat(JSON.stringify(body, null, 2), "\""));
|
|
86902
86811
|
}
|
|
86903
86812
|
}
|
|
86813
|
+
|
|
86814
|
+
/**
|
|
86815
|
+
* Get the response object.
|
|
86816
|
+
* @returns {Response} The response object.
|
|
86817
|
+
*/
|
|
86904
86818
|
spirits._createClass(EventResponse, [{
|
|
86905
86819
|
key: "response",
|
|
86906
86820
|
get: function get() {
|
|
86907
86821
|
return Response.json(this.body, this.init);
|
|
86908
86822
|
}
|
|
86823
|
+
|
|
86824
|
+
/**
|
|
86825
|
+
* Get the data of the response.
|
|
86826
|
+
* @returns {T} The body of the response.
|
|
86827
|
+
*/
|
|
86909
86828
|
}, {
|
|
86910
86829
|
key: "data",
|
|
86911
86830
|
get: function get() {
|
|
@@ -86913,14 +86832,44 @@ var EventResponse = /*#__PURE__*/function () {
|
|
|
86913
86832
|
}
|
|
86914
86833
|
}], [{
|
|
86915
86834
|
key: "json",
|
|
86916
|
-
value:
|
|
86835
|
+
value:
|
|
86836
|
+
/**
|
|
86837
|
+
* Create a new EventResponse instance with a JSON body.
|
|
86838
|
+
* @template T
|
|
86839
|
+
* @param {T} body - The body of the response.
|
|
86840
|
+
* @param {ResponseInit} [options] - Additional options for the response.
|
|
86841
|
+
* @returns {EventResponse<T>} A new EventResponse instance.
|
|
86842
|
+
*/
|
|
86843
|
+
function json(body, options) {
|
|
86917
86844
|
return new EventResponse(body, options);
|
|
86918
86845
|
}
|
|
86919
86846
|
}]);
|
|
86920
86847
|
return EventResponse;
|
|
86921
86848
|
}();
|
|
86849
|
+
var responseInitSchema = z.object({
|
|
86850
|
+
status: z.number().optional(),
|
|
86851
|
+
statusText: z.string().optional(),
|
|
86852
|
+
headers: z.any().optional() // Headers can be complex; adjust as needed
|
|
86853
|
+
});
|
|
86922
86854
|
|
|
86923
|
-
|
|
86855
|
+
/**
|
|
86856
|
+
* @template T
|
|
86857
|
+
* @typedef {object} IEventResponse
|
|
86858
|
+
* @property {T} body - The body of the response.
|
|
86859
|
+
* @property {ResponseInit} [init] - Additional options for the response.
|
|
86860
|
+
* @property {Response} response - The response object.
|
|
86861
|
+
* @property {T} data - The body of the response.
|
|
86862
|
+
*/
|
|
86863
|
+
var eventResponseSchema = z.object({
|
|
86864
|
+
body: z.any(),
|
|
86865
|
+
// Adjust as per your actual body structure
|
|
86866
|
+
init: responseInitSchema.optional()
|
|
86867
|
+
});
|
|
86868
|
+
|
|
86869
|
+
/**
|
|
86870
|
+
* @typedef {import('zod').infer<typeof entityApiConfigurationSchema>} IEntityApiConfiguration
|
|
86871
|
+
*/
|
|
86872
|
+
var entityApiConfigurationSchema = z.object({
|
|
86924
86873
|
// path: z.string(),
|
|
86925
86874
|
GET: z["boolean"]().optional(),
|
|
86926
86875
|
UPDATE: z["boolean"]().optional(),
|
|
@@ -86928,8 +86877,7 @@ var _entityApiConfigurationSchema = z.object({
|
|
|
86928
86877
|
PUT: z["boolean"]().optional(),
|
|
86929
86878
|
PATCH: z["boolean"]().optional(),
|
|
86930
86879
|
DELETE: z["boolean"]().optional()
|
|
86931
|
-
});
|
|
86932
|
-
var entityApiConfigurationSchema = _entityApiConfigurationSchema.nullable();
|
|
86880
|
+
}).nullable();
|
|
86933
86881
|
var entityConfigurationDefinitionSchema = z.object({
|
|
86934
86882
|
utterance: zId('Utterance', z.string({
|
|
86935
86883
|
description: 'What entity utterance this represents, if not provided, it will default to the entity id'
|
|
@@ -86969,6 +86917,10 @@ var _entityConfigurationSchema = z.object({
|
|
|
86969
86917
|
training: z.array(entityConfigurationTrainingSchema).optional(),
|
|
86970
86918
|
tests: z.array(entityConfigurationTestSchema).optional()
|
|
86971
86919
|
}).strict();
|
|
86920
|
+
|
|
86921
|
+
/**
|
|
86922
|
+
* @typedef {import('zod').infer<typeof entityConfigurationSchema>} IEntityConfiguration
|
|
86923
|
+
*/
|
|
86972
86924
|
var entityConfigurationSchema = _entityConfigurationSchema.refine(function (data) {
|
|
86973
86925
|
// If 'definitions' is provided, then 'training' must also be provided
|
|
86974
86926
|
if (data.definitions !== undefined) {
|
|
@@ -86980,6 +86932,10 @@ var entityConfigurationSchema = _entityConfigurationSchema.refine(function (data
|
|
|
86980
86932
|
// Custom error message
|
|
86981
86933
|
message: "If 'definitions' is provided, then 'training' must also be provided"
|
|
86982
86934
|
});
|
|
86935
|
+
|
|
86936
|
+
/**
|
|
86937
|
+
* @typedef {import('zod').infer<typeof entitiesRootConfigurationSchema>} IEntitiesRootConfiguration
|
|
86938
|
+
*/
|
|
86983
86939
|
var entitiesRootConfigurationSchema = z.array(entityConfigurationSchema);
|
|
86984
86940
|
var entityExtendedProjectConfigurationSchema = z.object({
|
|
86985
86941
|
entities: z.array(zId('Entity Folder', z.string()), {
|
|
@@ -86991,7 +86947,10 @@ var entityExtendedProjectConfigurationSchema = z.object({
|
|
|
86991
86947
|
var _entityRootProjectConfigurationSchema = _entityConfigurationSchema.extend(entityExtendedProjectConfigurationSchema.shape);
|
|
86992
86948
|
z.array(_entityRootProjectConfigurationSchema);
|
|
86993
86949
|
|
|
86994
|
-
|
|
86950
|
+
/**
|
|
86951
|
+
* @TODO why type extend not valid?
|
|
86952
|
+
* @typedef {import('zod').infer<typeof entityRootProjectConfigurationSchema>} IEntityRootProjectConfiguration
|
|
86953
|
+
*/
|
|
86995
86954
|
var entityRootProjectConfigurationSchema = _entityConfigurationSchema.extend(entityExtendedProjectConfigurationSchema.shape).refine(function (data) {
|
|
86996
86955
|
// If 'definitions' is provided, then 'training' must also be provided
|
|
86997
86956
|
if (data.definitions !== undefined) {
|
|
@@ -87003,15 +86962,30 @@ var entityRootProjectConfigurationSchema = _entityConfigurationSchema.extend(ent
|
|
|
87003
86962
|
// Custom error message
|
|
87004
86963
|
message: "If 'definitions' is provided, then 'training' must also be provided"
|
|
87005
86964
|
});
|
|
86965
|
+
|
|
86966
|
+
/**
|
|
86967
|
+
* @typedef {import('zod').infer<typeof entitiesRootProjectConfigurationSchema>} IEntitiesRootProjectConfiguration
|
|
86968
|
+
*/
|
|
87006
86969
|
var entitiesRootProjectConfigurationSchema = z.array(entityRootProjectConfigurationSchema);
|
|
87007
86970
|
|
|
86971
|
+
/**
|
|
86972
|
+
* @typedef {import('zod').infer<typeof WorkflowConfigurationSchema>} IWorkflowConfiguration
|
|
86973
|
+
*/
|
|
87008
86974
|
var WorkflowConfigurationSchema = z.object({
|
|
87009
86975
|
entities: z.array(zId('Workflow Folder', z.string()), {
|
|
87010
86976
|
description: 'Workflow id association, used to handle route params'
|
|
87011
86977
|
}).min(1, 'Must have at least 1 entity').max(15, 'Cannot have more than 15 entity paths'),
|
|
87012
86978
|
entity: zId('Workflow Folder', z.string())
|
|
87013
86979
|
});
|
|
86980
|
+
|
|
86981
|
+
/**
|
|
86982
|
+
* @typedef {import('zod').infer<typeof WorkflowsConfigurationSchema>} IWorkflowsConfiguration
|
|
86983
|
+
*/
|
|
87014
86984
|
var WorkflowsConfigurationSchema = z.array(WorkflowConfigurationSchema);
|
|
86985
|
+
|
|
86986
|
+
/**
|
|
86987
|
+
* @typedef {import('zod').infer<typeof ConversationSchema>} IConversation
|
|
86988
|
+
*/
|
|
87015
86989
|
var ConversationSchema = z.object({
|
|
87016
86990
|
$agent: zId('Conversation Agent ID', z.string({
|
|
87017
86991
|
description: 'Default agent assigned to the conversation(s)'
|
|
@@ -87030,19 +87004,56 @@ var ConversationSchema = z.object({
|
|
|
87030
87004
|
platformEmailThreadId: z.string({
|
|
87031
87005
|
description: 'Used to sync email messages with the conversation'
|
|
87032
87006
|
}).optional()
|
|
87033
|
-
}).optional()
|
|
87007
|
+
}).optional(),
|
|
87008
|
+
locked: z["boolean"]({
|
|
87009
|
+
description: 'Whether the conversation is locked or not'
|
|
87010
|
+
}).optional().nullable(),
|
|
87011
|
+
lockedReason: z.string({
|
|
87012
|
+
description: 'Why this conversation was locked'
|
|
87013
|
+
}).optional().nullable(),
|
|
87014
|
+
lockAttempts: z.number({
|
|
87015
|
+
description: 'Number attempts made until conversation is locked'
|
|
87016
|
+
}).optional().nullable(),
|
|
87017
|
+
forwardedTo: z.string({
|
|
87018
|
+
description: 'What personaId/phone/email was forwarded'
|
|
87019
|
+
}).optional().nullable(),
|
|
87020
|
+
forwarded: z.string({
|
|
87021
|
+
description: 'Datetime ISO 8601 timestamp when persona was forwarded'
|
|
87022
|
+
}).optional().nullable(),
|
|
87023
|
+
forwardNote: z.string().optional().nullable(),
|
|
87024
|
+
intent: z.string({
|
|
87025
|
+
description: 'Detected intent of conversation'
|
|
87026
|
+
}).optional().nullable(),
|
|
87027
|
+
intentScore: z.number({
|
|
87028
|
+
description: 'Confidence score of the assigned intent'
|
|
87029
|
+
}).optional().nullable()
|
|
87034
87030
|
});
|
|
87031
|
+
|
|
87032
|
+
/**
|
|
87033
|
+
* @typedef {import('zod').infer<typeof IntentWorkflowEventSchema>} IIntentWorkflowEvent
|
|
87034
|
+
*/
|
|
87035
87035
|
var IntentWorkflowEventSchema = z.object({
|
|
87036
87036
|
current: z.string().nullable(),
|
|
87037
87037
|
flow: z.array(z.string()),
|
|
87038
87038
|
initial: z.string().nullable()
|
|
87039
87039
|
});
|
|
87040
|
+
|
|
87041
|
+
/**
|
|
87042
|
+
* @typedef {import('zod').infer<typeof WorkflowEventSchema>} IWorkflowEvent
|
|
87043
|
+
*/
|
|
87040
87044
|
var WorkflowEventSchema = z.object({
|
|
87041
87045
|
messages: z.array(MessageSchema),
|
|
87042
87046
|
conversation: ConversationSchema,
|
|
87043
87047
|
context: z.any(),
|
|
87044
87048
|
message: MessageSchema,
|
|
87045
|
-
agent: agentConfigurationSchema
|
|
87049
|
+
agent: agentConfigurationSchema.omit({
|
|
87050
|
+
transcripts: true,
|
|
87051
|
+
audios: true,
|
|
87052
|
+
includedLocations: true,
|
|
87053
|
+
excludedLocations: true,
|
|
87054
|
+
model: true,
|
|
87055
|
+
context: true
|
|
87056
|
+
}),
|
|
87046
87057
|
customer: customerSchema,
|
|
87047
87058
|
intent: IntentWorkflowEventSchema,
|
|
87048
87059
|
stagnationCount: z.number(),
|
|
@@ -87053,15 +87064,33 @@ var WorkflowEventSchema = z.object({
|
|
|
87053
87064
|
var Primitive = z.union([z.string(), z.number(), z["boolean"]()]);
|
|
87054
87065
|
// Assuming ConversationContext is already defined as a Zod schema
|
|
87055
87066
|
|
|
87056
|
-
|
|
87067
|
+
/**
|
|
87068
|
+
* Lazy is used to handle recursive types.
|
|
87069
|
+
* @typedef {import('zod').infer<typeof ConversationContext>} IConversation
|
|
87070
|
+
*/
|
|
87057
87071
|
var ConversationContext = z.lazy(function () {
|
|
87058
87072
|
return z.record(Primitive.or(ConversationContext));
|
|
87059
87073
|
});
|
|
87060
87074
|
z.record(Primitive.or(ConversationContext));
|
|
87075
|
+
|
|
87076
|
+
/**
|
|
87077
|
+
* Forward input information of a conversation
|
|
87078
|
+
* @typedef {import('zod').infer<typeof ForwardSchema>} IForward
|
|
87079
|
+
*/
|
|
87061
87080
|
var ForwardSchema = z.union([z["boolean"](), z.string(), z.object({
|
|
87062
87081
|
to: z.string().optional(),
|
|
87063
|
-
mode: z["enum"](['after-reply', 'immediately']).optional()
|
|
87064
|
-
|
|
87082
|
+
mode: z["enum"](['after-reply', 'immediately']).optional(),
|
|
87083
|
+
note: z.string({
|
|
87084
|
+
description: 'Note to provide to the agent'
|
|
87085
|
+
}).optional()
|
|
87086
|
+
})], {
|
|
87087
|
+
description: 'Forward input information of a conversation'
|
|
87088
|
+
});
|
|
87089
|
+
|
|
87090
|
+
/**
|
|
87091
|
+
* Instruction object schema used to send context to guide conversations
|
|
87092
|
+
* @typedef {import('zod').infer<typeof InstructionSchema>} IInstruction
|
|
87093
|
+
*/
|
|
87065
87094
|
var InstructionSchema = z.object({
|
|
87066
87095
|
id: zId('Instruction ID').describe('Unique ID for the instruction, this is used to remove the instruction later'),
|
|
87067
87096
|
content: z.string()
|
|
@@ -87070,12 +87099,17 @@ var InstructionSchema = z.object({
|
|
|
87070
87099
|
/**
|
|
87071
87100
|
* If its a string, it will be sent as a static string.
|
|
87072
87101
|
* If it's a object or WorkflowResponseMessageAPI - it will use
|
|
87102
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseMessage>} IWorkflowResponseMessage
|
|
87073
87103
|
*/
|
|
87074
87104
|
var WorkflowResponseMessage = z.union(z.string(),
|
|
87075
87105
|
/**
|
|
87076
87106
|
* An api call that should be called later, must return a string or {message: string}
|
|
87077
87107
|
*/
|
|
87078
87108
|
WorkflowResponseMessageApiRequest);
|
|
87109
|
+
|
|
87110
|
+
/**
|
|
87111
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseMessageApiRequest>} IWorkflowResponseMessageApiRequest
|
|
87112
|
+
*/
|
|
87079
87113
|
var WorkflowResponseMessageApiRequest = z.object({
|
|
87080
87114
|
uri: z.string(),
|
|
87081
87115
|
data: z.any().optional(),
|
|
@@ -87085,6 +87119,7 @@ var WorkflowResponseMessageApiRequest = z.object({
|
|
|
87085
87119
|
|
|
87086
87120
|
/**
|
|
87087
87121
|
* The intended response provided by the WorkflowResponseMessageApiRequest
|
|
87122
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseMessageApiResponse>} IWorkflowResponseMessageApiResponse
|
|
87088
87123
|
*/
|
|
87089
87124
|
var WorkflowResponseMessageApiResponse = z.union([z.string(), z.object({
|
|
87090
87125
|
message: z.string()
|
|
@@ -87099,8 +87134,16 @@ var WorkflowResponseMessageApiResponse = z.union([z.string(), z.object({
|
|
|
87099
87134
|
text: z.string()
|
|
87100
87135
|
})
|
|
87101
87136
|
})]);
|
|
87137
|
+
|
|
87138
|
+
/**
|
|
87139
|
+
* The workflow response object slot
|
|
87140
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseSlotSchema>} IWorkflowResponseSlot
|
|
87141
|
+
*/
|
|
87102
87142
|
var WorkflowResponseSlotSchema = z.object({
|
|
87103
87143
|
forward: ForwardSchema.optional(),
|
|
87144
|
+
forwardNote: z.string({
|
|
87145
|
+
description: 'Note to provide to the agent, recommend using forward object api instead'
|
|
87146
|
+
}).optional(),
|
|
87104
87147
|
instructions: z.union([z.string(), InstructionSchema, z.array(z.string()), z.array(InstructionSchema)]).optional(),
|
|
87105
87148
|
removeInstructions: z.array(z.string()).optional(),
|
|
87106
87149
|
message: z.string().optional(),
|
|
@@ -87110,8 +87153,18 @@ var WorkflowResponseSlotSchema = z.object({
|
|
|
87110
87153
|
contextUpsert: ConversationContext.optional(),
|
|
87111
87154
|
resetIntent: z["boolean"]().optional()
|
|
87112
87155
|
});
|
|
87156
|
+
|
|
87157
|
+
/**
|
|
87158
|
+
* The workflow response to send in any given workflow
|
|
87159
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseSchema>} IWorkflowResponse
|
|
87160
|
+
*/
|
|
87113
87161
|
var WorkflowResponseSchema = z.union([WorkflowResponseSlotSchema, z.array(WorkflowResponseSlotSchema)]);
|
|
87114
87162
|
|
|
87163
|
+
/**
|
|
87164
|
+
* @typedef {import('zod').infer<typeof WorkflowFunctionSchema>} IWorkflowFunction
|
|
87165
|
+
*/
|
|
87166
|
+
var WorkflowFunctionSchema = z["function"]().args(WorkflowEventSchema).returns(z.union([z.promise(WorkflowResponseSchema), WorkflowResponseSchema]));
|
|
87167
|
+
|
|
87115
87168
|
var llmModelOptions = z.union([z.literal('gpt-4-1106-preview'), z.literal('gpt-4-vision-preview'), z.literal('gpt-4'), z.literal('gpt-4-0314'), z.literal('gpt-4-0613'), z.literal('gpt-4-32k'), z.literal('gpt-4-32k-0314'), z.literal('gpt-4-32k-0613'), z.literal('gpt-3.5-turbo'), z.literal('gpt-3.5-turbo-16k'), z.literal('gpt-3.5-turbo-0301'), z.literal('gpt-3.5-turbo-0613'), z.literal('gpt-3.5-turbo-16k-0613'), z.string() // for the (string & {}) part
|
|
87116
87169
|
]);
|
|
87117
87170
|
z.union([z.literal('orin-1.0'), z.literal('orin-2.0-preview')]);
|
|
@@ -87127,21 +87180,45 @@ var bardSchema = z.object({
|
|
|
87127
87180
|
engine: z.literal('bard'),
|
|
87128
87181
|
model: z.string()
|
|
87129
87182
|
});
|
|
87183
|
+
|
|
87184
|
+
/**
|
|
87185
|
+
* Configure personal model transformer (PMT) settings to align auto replies the agent's tone
|
|
87186
|
+
*/
|
|
87130
87187
|
var pmtSchema = z.object({
|
|
87131
87188
|
engine: z.literal('scout9'),
|
|
87132
87189
|
// model: pmtModelOptions
|
|
87133
87190
|
model: z.string()
|
|
87191
|
+
}, {
|
|
87192
|
+
description: 'Configure personal model transformer (PMT) settings to align auto replies the agent\'s tone'
|
|
87134
87193
|
});
|
|
87135
|
-
|
|
87194
|
+
|
|
87195
|
+
/**
|
|
87196
|
+
* Represents the configuration provided in src/index.{js | ts} in a project
|
|
87197
|
+
* @typedef {import('zod').infer<typeof Scout9ProjectConfigSchema>} IScout9ProjectConfig
|
|
87198
|
+
*/
|
|
87199
|
+
var Scout9ProjectConfigSchema = z.object({
|
|
87200
|
+
/**
|
|
87201
|
+
* Tag to reference this application
|
|
87202
|
+
* @defaut your local package.json name + version, or scout9-app-v1.0.0
|
|
87203
|
+
*/
|
|
87136
87204
|
tag: z.string().optional(),
|
|
87137
87205
|
// Defaults to scout9-app-v1.0.0
|
|
87138
|
-
agents: agentsBaseConfigurationSchema,
|
|
87139
|
-
entities: entitiesRootProjectConfigurationSchema,
|
|
87140
|
-
workflows: WorkflowsConfigurationSchema,
|
|
87141
87206
|
llm: z.union([llmSchema, llamaSchema, bardSchema]),
|
|
87207
|
+
/**
|
|
87208
|
+
* Configure personal model transformer (PMT) settings to align auto replies the agent's tone
|
|
87209
|
+
*/
|
|
87142
87210
|
pmt: pmtSchema,
|
|
87143
|
-
|
|
87144
|
-
|
|
87211
|
+
/**
|
|
87212
|
+
* Determines the max auto replies without further conversation progression (defined by new context data gathered)
|
|
87213
|
+
* before the conversation is locked and requires manual intervention
|
|
87214
|
+
* @default 3
|
|
87215
|
+
*/
|
|
87216
|
+
maxLockAttempts: z.number({
|
|
87217
|
+
description: 'Determines the max auto replies without further conversation progression (defined by new context data gathered), before the conversation is locked and requires manual intervention'
|
|
87218
|
+
}).min(0).max(20)["default"](3).optional(),
|
|
87219
|
+
initialContext: z.array(z.string(), {
|
|
87220
|
+
description: 'Configure the initial contexts for every conversation'
|
|
87221
|
+
}),
|
|
87145
87222
|
organization: z.object({
|
|
87146
87223
|
name: z.string(),
|
|
87147
87224
|
description: z.string(),
|
|
@@ -87155,6 +87232,96 @@ var Scout9ProjectBuildConfigSchema = z.object({
|
|
|
87155
87232
|
}).optional()
|
|
87156
87233
|
});
|
|
87157
87234
|
|
|
87235
|
+
/**
|
|
87236
|
+
* @typedef {import('zod').infer<typeof Scout9ProjectBuildConfigSchema>} IScout9ProjectBuildConfig
|
|
87237
|
+
*/
|
|
87238
|
+
var Scout9ProjectBuildConfigSchema = Scout9ProjectConfigSchema.extend({
|
|
87239
|
+
agents: agentsBaseConfigurationSchema,
|
|
87240
|
+
entities: entitiesRootProjectConfigurationSchema,
|
|
87241
|
+
workflows: WorkflowsConfigurationSchema
|
|
87242
|
+
});
|
|
87243
|
+
|
|
87244
|
+
/**
|
|
87245
|
+
* @typedef {object} IApiFunctionParams
|
|
87246
|
+
* @property {Object.<string, string|string[]>} searchParams
|
|
87247
|
+
* @property {Record<string, string>} params
|
|
87248
|
+
*/
|
|
87249
|
+
var apiFunctionParamsSchema = z.object({
|
|
87250
|
+
searchParams: z.record(z.union([z.string(), z.array(z.string())])),
|
|
87251
|
+
params: z.record(z.string())
|
|
87252
|
+
});
|
|
87253
|
+
|
|
87254
|
+
/**
|
|
87255
|
+
* @typedef {IApiFunctionParams & { id: string }} IApiEntityFunctionParams
|
|
87256
|
+
*/
|
|
87257
|
+
apiFunctionParamsSchema.extend({
|
|
87258
|
+
id: z.string()
|
|
87259
|
+
});
|
|
87260
|
+
|
|
87261
|
+
/**
|
|
87262
|
+
* @template Params
|
|
87263
|
+
* @template Response
|
|
87264
|
+
* @typedef {function(IApiFunctionParams): Promise<EventResponse>} IApiFunction
|
|
87265
|
+
*/
|
|
87266
|
+
var apiFunctionSchema = z["function"]().args(apiFunctionParamsSchema).returns(z.promise(eventResponseSchema));
|
|
87267
|
+
|
|
87268
|
+
/**
|
|
87269
|
+
* @template Params
|
|
87270
|
+
* @template Response
|
|
87271
|
+
* @typedef {IApiFunction<Params, Response>} IQueryApiFunction
|
|
87272
|
+
*/
|
|
87273
|
+
var queryApiFunctionSchema = apiFunctionSchema;
|
|
87274
|
+
|
|
87275
|
+
/**
|
|
87276
|
+
* @template Params
|
|
87277
|
+
* @template Response
|
|
87278
|
+
* @typedef {IApiFunction<Params, Response>} GetApiFunction
|
|
87279
|
+
*/
|
|
87280
|
+
var getApiFunctionSchema = apiFunctionSchema;
|
|
87281
|
+
|
|
87282
|
+
/**
|
|
87283
|
+
* @template Params
|
|
87284
|
+
* @template RequestBody
|
|
87285
|
+
* @template Response
|
|
87286
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPostApiFunction
|
|
87287
|
+
*/
|
|
87288
|
+
var postApiFunctionSchema = function postApiFunctionSchema(requestBodySchema) {
|
|
87289
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
87290
|
+
body: requestBodySchema.partial()
|
|
87291
|
+
})).returns(z.promise(eventResponseSchema));
|
|
87292
|
+
};
|
|
87293
|
+
|
|
87294
|
+
/**
|
|
87295
|
+
* @template Params
|
|
87296
|
+
* @template RequestBody
|
|
87297
|
+
* @template Response
|
|
87298
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPutApiFunction
|
|
87299
|
+
*/
|
|
87300
|
+
var putApiFunctionSchema = function putApiFunctionSchema(requestBodySchema) {
|
|
87301
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
87302
|
+
body: requestBodySchema.partial()
|
|
87303
|
+
})).returns(z.promise(eventResponseSchema));
|
|
87304
|
+
};
|
|
87305
|
+
|
|
87306
|
+
/**
|
|
87307
|
+
* @template Params
|
|
87308
|
+
* @template RequestBody
|
|
87309
|
+
* @template Response
|
|
87310
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPatchApiFunction
|
|
87311
|
+
*/
|
|
87312
|
+
var patchApiFunctionSchema = function patchApiFunctionSchema(requestBodySchema) {
|
|
87313
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
87314
|
+
body: requestBodySchema.partial()
|
|
87315
|
+
})).returns(z.promise(eventResponseSchema));
|
|
87316
|
+
};
|
|
87317
|
+
|
|
87318
|
+
/**
|
|
87319
|
+
* @template Params
|
|
87320
|
+
* @template Response
|
|
87321
|
+
* @typedef {IApiFunction<Params, Response>} IDeleteApiFunction
|
|
87322
|
+
*/
|
|
87323
|
+
var deleteApiFunctionSchema = apiFunctionSchema;
|
|
87324
|
+
|
|
87158
87325
|
function loadEntityApiConfig$1(_x, _x2) {
|
|
87159
87326
|
return _loadEntityApiConfig$1.apply(this, arguments);
|
|
87160
87327
|
}
|
|
@@ -88349,36 +88516,8 @@ function report(config, logger) {
|
|
|
88349
88516
|
logger.primary("Run ".concat(cyan('scout9 dev'), " to test your project locally"));
|
|
88350
88517
|
}
|
|
88351
88518
|
|
|
88352
|
-
var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-
|
|
88519
|
+
var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-b2e88386.js', document.baseURI).href)));
|
|
88353
88520
|
var __dirname$1 = path__default["default"].dirname(__filename$1);
|
|
88354
|
-
|
|
88355
|
-
/**
|
|
88356
|
-
* @returns {Promise<string>} - the output directory
|
|
88357
|
-
*/
|
|
88358
|
-
// async function runNpmRunBuild({cwd = process.cwd(), src = 'src'} = {}) {
|
|
88359
|
-
// const pkg = JSON.parse(fss.readFileSync(new URL(`${cwd}/package.json`, import.meta.url), 'utf-8'));
|
|
88360
|
-
// // Package.json must have a "build" script
|
|
88361
|
-
// const buildScript = pkg.scripts?.build;
|
|
88362
|
-
// if (!buildScript) {
|
|
88363
|
-
// // If no build script then just return src
|
|
88364
|
-
// return path.resolve(cwd, src);
|
|
88365
|
-
// }
|
|
88366
|
-
// // "build" script cannot contain "scout9 build" (otherwise we'll get stuck in a loop)
|
|
88367
|
-
// if (buildScript.includes('scout9 build')) {
|
|
88368
|
-
// throw new Error(`"build" script in ${cwd}/package.json cannot contain "scout9 build"`);
|
|
88369
|
-
// }
|
|
88370
|
-
//
|
|
88371
|
-
// return new Promise((resolve, reject) => {
|
|
88372
|
-
// exec('npm run build', {cwd}, (error, stdout, stderr) => {
|
|
88373
|
-
// if (error) {
|
|
88374
|
-
// return reject(error);
|
|
88375
|
-
// }
|
|
88376
|
-
// // @TODO don't assume build script created a "build" directory (use a config)
|
|
88377
|
-
// return resolve(path.resolve(cwd, 'build'));
|
|
88378
|
-
// });
|
|
88379
|
-
// });
|
|
88380
|
-
// }
|
|
88381
|
-
|
|
88382
88521
|
function zipDirectory(source, out) {
|
|
88383
88522
|
var archive = archiver$1('tar', {
|
|
88384
88523
|
gzip: true,
|
|
@@ -88592,7 +88731,7 @@ function _buildApp() {
|
|
|
88592
88731
|
case 11:
|
|
88593
88732
|
_context4.t0 = JSON;
|
|
88594
88733
|
_context4.next = 14;
|
|
88595
|
-
return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-
|
|
88734
|
+
return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-b2e88386.js', document.baseURI).href))), 'utf-8');
|
|
88596
88735
|
case 14:
|
|
88597
88736
|
_context4.t1 = _context4.sent;
|
|
88598
88737
|
packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
|
@@ -88674,6 +88813,13 @@ function _buildApp() {
|
|
|
88674
88813
|
function downloadDevApp(_x8, _x9) {
|
|
88675
88814
|
return _downloadDevApp.apply(this, arguments);
|
|
88676
88815
|
}
|
|
88816
|
+
/**
|
|
88817
|
+
* @param {Object} [options]
|
|
88818
|
+
* @param {string} [options.cwd]
|
|
88819
|
+
* @param {string} [options.src]
|
|
88820
|
+
* @param {boolean} [options.ignoreAppRequire]
|
|
88821
|
+
* @returns {Promise<{app: *, fileName: string, exe: string, filePath: string}>}
|
|
88822
|
+
*/
|
|
88677
88823
|
function _downloadDevApp() {
|
|
88678
88824
|
_downloadDevApp = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee5(destination, version) {
|
|
88679
88825
|
var url, downloadLocalResponse, arrayBuffer;
|
|
@@ -88804,10 +88950,10 @@ function getAgentContacts() {
|
|
|
88804
88950
|
* Runs a given project container from scout9 to given environment
|
|
88805
88951
|
* Runs the project in a container
|
|
88806
88952
|
*
|
|
88807
|
-
* @param {
|
|
88953
|
+
* @param {import('../runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
88808
88954
|
* @param {Object} options
|
|
88809
88955
|
* @param {string} options.eventSource - the source path of the event
|
|
88810
|
-
* @returns {Promise<
|
|
88956
|
+
* @returns {Promise<import('../runtime/client/workflow.js').IWorkflowResponse>}
|
|
88811
88957
|
*/
|
|
88812
88958
|
function _getAgentContacts() {
|
|
88813
88959
|
_getAgentContacts = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee7() {
|
|
@@ -88907,7 +89053,7 @@ function runConfig() {
|
|
|
88907
89053
|
/**
|
|
88908
89054
|
* Builds a local project
|
|
88909
89055
|
* @param {{cwd: string; src: string; dest: string; logger: ProgressLogger; mode: string;}} - build options
|
|
88910
|
-
* @param {
|
|
89056
|
+
* @param {import('../runtime/client/').IScout9ProjectBuildConfig} config
|
|
88911
89057
|
* @returns {messages: string[]}
|
|
88912
89058
|
*/
|
|
88913
89059
|
function _runConfig() {
|
|
@@ -88950,6 +89096,7 @@ function build() {
|
|
|
88950
89096
|
* Deploys a local project to scout9
|
|
88951
89097
|
* @param {{cwd: string; src: string, dest: string}} - build options
|
|
88952
89098
|
* @param {Scout9ProjectBuildConfig} config
|
|
89099
|
+
* @return {Promise<{deploy: Object, contacts: any}>}
|
|
88953
89100
|
*/
|
|
88954
89101
|
function _build() {
|
|
88955
89102
|
_build = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee10() {
|
|
@@ -89041,7 +89188,7 @@ function deploy(_x11, _x12) {
|
|
|
89041
89188
|
/**
|
|
89042
89189
|
* Tests a local project to scout9 by running a dummy parse command with the project's local entities
|
|
89043
89190
|
* @param {{cwd: string; src: string, dest: string}} - build options
|
|
89044
|
-
* @param {
|
|
89191
|
+
* @param {import('@scout9/app').IScout9ProjectBuildConfig} config
|
|
89045
89192
|
*/
|
|
89046
89193
|
function _deploy() {
|
|
89047
89194
|
_deploy = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee11(_ref4, config) {
|
|
@@ -89117,8 +89264,8 @@ function test(_x13, _x14) {
|
|
|
89117
89264
|
/**
|
|
89118
89265
|
*
|
|
89119
89266
|
* @param {{cwd: string; src: string; projectFiles: ProjectFiles; logger: ProgressLogger}} options
|
|
89120
|
-
* @param {
|
|
89121
|
-
* @returns {Promise<{success: boolean; config:
|
|
89267
|
+
* @param {import('@scout9/app').IScout9ProjectBuildConfig} config
|
|
89268
|
+
* @returns {Promise<{success: boolean; config: import('@scout9/app').IScout9ProjectBuildConfig}>}
|
|
89122
89269
|
*/
|
|
89123
89270
|
function _test() {
|
|
89124
89271
|
_test = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee12(_ref5, config) {
|
|
@@ -90007,7 +90154,7 @@ function loadEntityApiConfig(_x, _x2) {
|
|
|
90007
90154
|
return _loadEntityApiConfig.apply(this, arguments);
|
|
90008
90155
|
}
|
|
90009
90156
|
/**
|
|
90010
|
-
* @returns {Promise<
|
|
90157
|
+
* @returns {Promise<import('@scout9/app').IEntitiesRootProjectConfiguration>}
|
|
90011
90158
|
*/
|
|
90012
90159
|
function _loadEntityApiConfig() {
|
|
90013
90160
|
_loadEntityApiConfig = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee(cwd, filePath) {
|
|
@@ -90070,7 +90217,7 @@ function _loadEntitiesConfig() {
|
|
|
90070
90217
|
while (1) switch (_context4.prev = _context4.next) {
|
|
90071
90218
|
case 0:
|
|
90072
90219
|
_ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$cwd = _ref.cwd, cwd = _ref$cwd === void 0 ? process.cwd() : _ref$cwd, _ref$src = _ref.src, src = _ref$src === void 0 ? 'src' : _ref$src, _ref.logger, _ref.cb;
|
|
90073
|
-
/** @type
|
|
90220
|
+
/** @type import('@scout9/app').IEntitiesRootProjectConfiguration */
|
|
90074
90221
|
config = []; // const paths = globSync(path.resolve(cwd, `${src}/entities/**/{index,config,api}.{ts,js}`), {cwd, absolute: true});
|
|
90075
90222
|
filePaths = globSync("".concat(src, "/entities/**/{index,config,api}.{ts,js}"), {
|
|
90076
90223
|
cwd: cwd,
|
|
@@ -90284,7 +90431,7 @@ function _loadEntitiesConfig() {
|
|
|
90284
90431
|
}
|
|
90285
90432
|
|
|
90286
90433
|
/**
|
|
90287
|
-
* @returns {Promise<
|
|
90434
|
+
* @returns {Promise<import('@scout9/app').IWorkflowsConfiguration>}
|
|
90288
90435
|
*/
|
|
90289
90436
|
function loadWorkflowsConfig() {
|
|
90290
90437
|
return _loadWorkflowsConfig.apply(this, arguments);
|
|
@@ -90326,7 +90473,7 @@ function _loadWorkflowsConfig() {
|
|
|
90326
90473
|
_ref2.path;
|
|
90327
90474
|
var parents = _ref2.parents;
|
|
90328
90475
|
// Validate project configuration
|
|
90329
|
-
/** @type {
|
|
90476
|
+
/** @type {import('@scout9/app').IWorkflowConfiguration} */
|
|
90330
90477
|
var workflowConfig = {
|
|
90331
90478
|
entity: parents[0],
|
|
90332
90479
|
entities: parents.reverse()
|
|
@@ -90373,7 +90520,7 @@ function loadEnvConfig() {
|
|
|
90373
90520
|
/**
|
|
90374
90521
|
* @deprecated use "new ProjectFiles(...).load()" instead
|
|
90375
90522
|
* @param {{cwd: string; src: string; logger?: ProgressLogger; deploying?: boolean; cb?: (message: string) => void}} - build options
|
|
90376
|
-
* @returns {Promise<
|
|
90523
|
+
* @returns {Promise<import('@scout9/app').IScout9ProjectBuildConfig>}
|
|
90377
90524
|
*/
|
|
90378
90525
|
function loadConfig() {
|
|
90379
90526
|
return _loadConfig.apply(this, arguments);
|
|
@@ -90453,7 +90600,7 @@ function _loadConfig() {
|
|
|
90453
90600
|
case 13:
|
|
90454
90601
|
workflowsConfig = _context.sent;
|
|
90455
90602
|
/**
|
|
90456
|
-
* @type {
|
|
90603
|
+
* @type {import('@scout9/app').IScout9ProjectBuildConfig}
|
|
90457
90604
|
*/
|
|
90458
90605
|
projectConfig = spirits._objectSpread2(spirits._objectSpread2({}, baseProjectConfig), {}, {
|
|
90459
90606
|
entities: entitiesConfig,
|
|
@@ -90488,7 +90635,7 @@ var Scout9Platform = {
|
|
|
90488
90635
|
* @param {string} [params.cwd=process.cwd()] - the working directory
|
|
90489
90636
|
* @param {string} [params.src='src'] - the source directory
|
|
90490
90637
|
* @param {string} [params.mode='production'] - the build mode
|
|
90491
|
-
* @returns {Promise<
|
|
90638
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90492
90639
|
*/
|
|
90493
90640
|
sync: function () {
|
|
90494
90641
|
var _sync2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee() {
|
|
@@ -90563,7 +90710,7 @@ var Scout9Platform = {
|
|
|
90563
90710
|
* @param {string} [params.dest='/tmp/project'] - the destination directory
|
|
90564
90711
|
* @param {'development' | 'production'} [params.mode='production'] - the build mode
|
|
90565
90712
|
* @param {boolean} [params.sync=true] - whether to sync the project after deploying
|
|
90566
|
-
* @returns {Promise<
|
|
90713
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90567
90714
|
*/
|
|
90568
90715
|
deploy: function () {
|
|
90569
90716
|
var _deploy2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee2() {
|
|
@@ -90685,7 +90832,7 @@ var Scout9Platform = {
|
|
|
90685
90832
|
* @param {string} [params.src='./src'] - the source directory
|
|
90686
90833
|
* @param {string} [params.dest='/tmp/project'] - the destination directory
|
|
90687
90834
|
* @param {'development' | 'production'} [params.mode='production'] - the build mode
|
|
90688
|
-
* @returns {Promise<
|
|
90835
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90689
90836
|
*/
|
|
90690
90837
|
test: function () {
|
|
90691
90838
|
var _test2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee3() {
|
|
@@ -90759,7 +90906,7 @@ var Scout9Platform = {
|
|
|
90759
90906
|
* @param {string} [params.src='./src'] - the source directory
|
|
90760
90907
|
* @param {string} [params.dest='/tmp/project'] - the destination directory
|
|
90761
90908
|
* @param {'development' | 'production'} [params.mode='production'] - the build mode
|
|
90762
|
-
* @returns {Promise<
|
|
90909
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90763
90910
|
*/
|
|
90764
90911
|
build: function () {
|
|
90765
90912
|
var _build2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee4() {
|
|
@@ -90836,7 +90983,7 @@ var Scout9Platform = {
|
|
|
90836
90983
|
* @param {string} [params.cwd=process.cwd()] - the working directory
|
|
90837
90984
|
* @param {boolean} [params.local=false] - whether to only load the local config (ignores what's saved on server)
|
|
90838
90985
|
* @param {string} [params.src='./src'] - the source directory
|
|
90839
|
-
* @returns {Promise<
|
|
90986
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90840
90987
|
*/
|
|
90841
90988
|
config: function () {
|
|
90842
90989
|
var _config = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee5() {
|
|
@@ -90890,13 +91037,13 @@ var Scout9Platform = {
|
|
|
90890
91037
|
}(),
|
|
90891
91038
|
/**
|
|
90892
91039
|
* Runs the project in a container
|
|
90893
|
-
* @param {
|
|
91040
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
90894
91041
|
* @param {Object} options
|
|
90895
91042
|
* @param {string} [options.cwd=process.cwd()] - the working directory
|
|
90896
91043
|
* @param {string} [options.mode='production'] - the build mode
|
|
90897
91044
|
* @param {string} [options.src='./src'] - the source directory
|
|
90898
91045
|
* @param {string} options.eventSource - the source of the workflow event
|
|
90899
|
-
* @returns {Promise<
|
|
91046
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
90900
91047
|
*/
|
|
90901
91048
|
run: function () {
|
|
90902
91049
|
var _run2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee6(event, _ref6) {
|
|
@@ -90958,7 +91105,7 @@ var Scout9Platform = {
|
|
|
90958
91105
|
};
|
|
90959
91106
|
|
|
90960
91107
|
/**
|
|
90961
|
-
* @returns {import('@scout9/app').
|
|
91108
|
+
* @returns {import('@scout9/app').IAgent}
|
|
90962
91109
|
*/
|
|
90963
91110
|
var createMockAgent = function createMockAgent() {
|
|
90964
91111
|
var firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Carmela';
|
|
@@ -90971,7 +91118,7 @@ var createMockAgent = function createMockAgent() {
|
|
|
90971
91118
|
};
|
|
90972
91119
|
|
|
90973
91120
|
/**
|
|
90974
|
-
* @returns {import('@scout9/app').
|
|
91121
|
+
* @returns {import('@scout9/app').ICustomer}
|
|
90975
91122
|
*/
|
|
90976
91123
|
var createMockCustomer = function createMockCustomer() {
|
|
90977
91124
|
var firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Tony';
|
|
@@ -90989,7 +91136,7 @@ var createMockCustomer = function createMockCustomer() {
|
|
|
90989
91136
|
* @param content
|
|
90990
91137
|
* @param role
|
|
90991
91138
|
* @param time
|
|
90992
|
-
* @returns {import('@scout9/app').
|
|
91139
|
+
* @returns {import('@scout9/app').IMessage}
|
|
90993
91140
|
*/
|
|
90994
91141
|
var createMockMessage = function createMockMessage(content) {
|
|
90995
91142
|
var role = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'customer';
|
|
@@ -91005,7 +91152,7 @@ var createMockMessage = function createMockMessage(content) {
|
|
|
91005
91152
|
};
|
|
91006
91153
|
|
|
91007
91154
|
/**
|
|
91008
|
-
* @returns {import('@scout9/app').
|
|
91155
|
+
* @returns {import('@scout9/app').IConversation}
|
|
91009
91156
|
*/
|
|
91010
91157
|
var createMockConversation = function createMockConversation() {
|
|
91011
91158
|
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'phone';
|
|
@@ -91020,8 +91167,8 @@ var createMockConversation = function createMockConversation() {
|
|
|
91020
91167
|
|
|
91021
91168
|
/**
|
|
91022
91169
|
* @param {string} message
|
|
91023
|
-
* @param {string | import('@scout9/app').
|
|
91024
|
-
* @returns {import('@scout9/app').
|
|
91170
|
+
* @param {string | import('@scout9/app').IWorkflowEvent['intent'] | null} intent
|
|
91171
|
+
* @returns {import('@scout9/app').IWorkflowEvent}
|
|
91025
91172
|
*/
|
|
91026
91173
|
var createMockWorkflowEvent = function createMockWorkflowEvent(message) {
|
|
91027
91174
|
var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -91048,16 +91195,16 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91048
91195
|
/**
|
|
91049
91196
|
* Mimics a customer message to your app (useful for testing)
|
|
91050
91197
|
* @param props - the Scout9Test properties
|
|
91051
|
-
* @param {import('@scout9/app').
|
|
91198
|
+
* @param {import('@scout9/app').ICustomer | undefined} [props.customer] - customer to use
|
|
91052
91199
|
* @param {any | undefined} [props.context] - prior conversation context
|
|
91053
91200
|
* @param {string | undefined} [props.persona] id to use
|
|
91054
|
-
* @param {import('@scout9/app').
|
|
91201
|
+
* @param {import('@scout9/app').IConversation | undefined} [props.conversation] - existing conversation
|
|
91055
91202
|
* @param {string | undefined} [props.cwd]
|
|
91056
91203
|
* @param {string | undefined} [props.src]
|
|
91057
91204
|
* @param {string | undefined} [props.mode]
|
|
91058
91205
|
* @param {import('@scout9/admin').Scout9Api} [props.api]
|
|
91059
|
-
* @param {import('@scout9/app').
|
|
91060
|
-
* @param {import('scout9/app').
|
|
91206
|
+
* @param {import('@scout9/app').IWorkflowFunction} [props.app]
|
|
91207
|
+
* @param {import('scout9/app').IScout9ProjectBuildConfig} [props.project]
|
|
91061
91208
|
*/
|
|
91062
91209
|
function Scout9Test() {
|
|
91063
91210
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
@@ -91081,19 +91228,19 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91081
91228
|
project = _ref.project;
|
|
91082
91229
|
spirits._classCallCheck(this, Scout9Test);
|
|
91083
91230
|
/**
|
|
91084
|
-
* @type {import('@scout9/app').
|
|
91231
|
+
* @type {import('@scout9/app').ICustomer}
|
|
91085
91232
|
*/
|
|
91086
91233
|
spirits._defineProperty(this, "customer", void 0);
|
|
91087
91234
|
/**
|
|
91088
|
-
* @type {import('@scout9/app').
|
|
91235
|
+
* @type {import('@scout9/app').IPersona}
|
|
91089
91236
|
*/
|
|
91090
91237
|
spirits._defineProperty(this, "persona", void 0);
|
|
91091
91238
|
/**
|
|
91092
|
-
* @type {import('@scout9/app').
|
|
91239
|
+
* @type {import('@scout9/app').IConversation}
|
|
91093
91240
|
*/
|
|
91094
91241
|
spirits._defineProperty(this, "conversation", void 0);
|
|
91095
91242
|
/**
|
|
91096
|
-
* @type {import('@scout9/app').
|
|
91243
|
+
* @type {import('@scout9/app').IMessage[]}
|
|
91097
91244
|
*/
|
|
91098
91245
|
spirits._defineProperty(this, "messages", void 0);
|
|
91099
91246
|
/**
|
|
@@ -91102,12 +91249,12 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91102
91249
|
spirits._defineProperty(this, "context", void 0);
|
|
91103
91250
|
/**
|
|
91104
91251
|
* @private
|
|
91105
|
-
* @type {import('scout9/app').
|
|
91252
|
+
* @type {import('scout9/app').IScout9ProjectBuildConfig | null}
|
|
91106
91253
|
*/
|
|
91107
91254
|
spirits._defineProperty(this, "_project", null);
|
|
91108
91255
|
/**
|
|
91109
91256
|
* @private
|
|
91110
|
-
* @type {import('@scout9/app').
|
|
91257
|
+
* @type {import('@scout9/app').IWorkflowFunction | null}
|
|
91111
91258
|
*/
|
|
91112
91259
|
spirits._defineProperty(this, "_app", null);
|
|
91113
91260
|
/**
|
|
@@ -91456,8 +91603,8 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91456
91603
|
/**
|
|
91457
91604
|
* Runs your local app workflow
|
|
91458
91605
|
* @param {string} message - the message to run through the workflow
|
|
91459
|
-
* @param {Omit<Partial<import('@scout9/app').
|
|
91460
|
-
* @returns {Promise<import('@scout9/app').
|
|
91606
|
+
* @param {Omit<Partial<import('@scout9/app').IWorkflowEvent>, 'message'> | undefined} [event] - additional event data
|
|
91607
|
+
* @returns {Promise<import('@scout9/app').IWorkflowResponse>}
|
|
91461
91608
|
*/
|
|
91462
91609
|
)
|
|
91463
91610
|
}, {
|
|
@@ -91496,7 +91643,7 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91496
91643
|
* @param {Object} [input] - Generation input, defaults to test registered data such as existing messages, context, and persona information.
|
|
91497
91644
|
* @param {string} [input.personaId] - Persona ID to use, defaults to test registered persona id.
|
|
91498
91645
|
* @param {Partial<import('@scout9/admin').ConversationCreateRequest>} [input.conversation] - Conversation overrides, defaults to test registered conversation data.
|
|
91499
|
-
* @param {import('@scout9/app').
|
|
91646
|
+
* @param {import('@scout9/app').IMessage[]} [input.messages] - Message overrides, defaults to test registered message data.
|
|
91500
91647
|
* @param {any} [input.context] - Context overrides, defaults to test registered context data.
|
|
91501
91648
|
* @returns {Promise<import('@scout9/admin').GenerateResponse>}
|
|
91502
91649
|
*/
|
|
@@ -91606,18 +91753,22 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91606
91753
|
}();
|
|
91607
91754
|
|
|
91608
91755
|
/**
|
|
91609
|
-
* @param {
|
|
91610
|
-
* @param {
|
|
91611
|
-
* @
|
|
91756
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
91757
|
+
* @param {Object} options
|
|
91758
|
+
* @param {string} [options.cwd=process.cwd()] - the working directory
|
|
91759
|
+
* @param {string} [options.mode='production'] - the build mode
|
|
91760
|
+
* @param {string} [options.src='./src'] - the source directory
|
|
91761
|
+
* @param {string} options.eventSource - the source of the workflow event
|
|
91762
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
91612
91763
|
*/
|
|
91613
91764
|
function run(_x, _x2) {
|
|
91614
91765
|
return _run.apply(this, arguments);
|
|
91615
91766
|
}
|
|
91616
91767
|
|
|
91617
91768
|
/**
|
|
91618
|
-
* @param {
|
|
91769
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
91619
91770
|
* @param {{cwd: string; mode: 'development' | 'production'; src: string}} options - build options
|
|
91620
|
-
* @returns {Promise<
|
|
91771
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
91621
91772
|
*/
|
|
91622
91773
|
function _run() {
|
|
91623
91774
|
_run = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee(event, options) {
|
|
@@ -91638,7 +91789,7 @@ var sendEvent = run;
|
|
|
91638
91789
|
/**
|
|
91639
91790
|
* @param data {T}
|
|
91640
91791
|
* @param init {ResponseInit | undefined}
|
|
91641
|
-
* @returns {EventResponse<T>}
|
|
91792
|
+
* @returns {import('./runtime/client/api.js').EventResponse<T>}
|
|
91642
91793
|
*/
|
|
91643
91794
|
function json(data, init) {
|
|
91644
91795
|
if (data instanceof Promise) {
|
|
@@ -91674,20 +91825,22 @@ exports.InstructionSchema = InstructionSchema;
|
|
|
91674
91825
|
exports.IntentWorkflowEventSchema = IntentWorkflowEventSchema;
|
|
91675
91826
|
exports.MessageSchema = MessageSchema;
|
|
91676
91827
|
exports.Scout9ProjectBuildConfigSchema = Scout9ProjectBuildConfigSchema;
|
|
91828
|
+
exports.Scout9ProjectConfigSchema = Scout9ProjectConfigSchema;
|
|
91677
91829
|
exports.Scout9Test = Scout9Test;
|
|
91678
91830
|
exports.WorkflowConfigurationSchema = WorkflowConfigurationSchema;
|
|
91679
91831
|
exports.WorkflowEventSchema = WorkflowEventSchema;
|
|
91832
|
+
exports.WorkflowFunctionSchema = WorkflowFunctionSchema;
|
|
91680
91833
|
exports.WorkflowResponseMessage = WorkflowResponseMessage;
|
|
91681
91834
|
exports.WorkflowResponseMessageApiRequest = WorkflowResponseMessageApiRequest;
|
|
91682
91835
|
exports.WorkflowResponseMessageApiResponse = WorkflowResponseMessageApiResponse;
|
|
91683
91836
|
exports.WorkflowResponseSchema = WorkflowResponseSchema;
|
|
91684
91837
|
exports.WorkflowResponseSlotSchema = WorkflowResponseSlotSchema;
|
|
91685
91838
|
exports.WorkflowsConfigurationSchema = WorkflowsConfigurationSchema;
|
|
91686
|
-
exports._entityApiConfigurationSchema = _entityApiConfigurationSchema;
|
|
91687
91839
|
exports.agentBaseConfigurationSchema = agentBaseConfigurationSchema;
|
|
91688
91840
|
exports.agentConfigurationSchema = agentConfigurationSchema;
|
|
91689
91841
|
exports.agentsBaseConfigurationSchema = agentsBaseConfigurationSchema;
|
|
91690
91842
|
exports.agentsConfigurationSchema = agentsConfigurationSchema;
|
|
91843
|
+
exports.apiFunctionSchema = apiFunctionSchema;
|
|
91691
91844
|
exports.createMockAgent = createMockAgent;
|
|
91692
91845
|
exports.createMockConversation = createMockConversation;
|
|
91693
91846
|
exports.createMockCustomer = createMockCustomer;
|
|
@@ -91695,11 +91848,18 @@ exports.createMockMessage = createMockMessage;
|
|
|
91695
91848
|
exports.createMockWorkflowEvent = createMockWorkflowEvent;
|
|
91696
91849
|
exports.customerSchema = customerSchema;
|
|
91697
91850
|
exports.customerValueSchema = customerValueSchema;
|
|
91851
|
+
exports.deleteApiFunctionSchema = deleteApiFunctionSchema;
|
|
91698
91852
|
exports.entitiesRootConfigurationSchema = entitiesRootConfigurationSchema;
|
|
91699
91853
|
exports.entitiesRootProjectConfigurationSchema = entitiesRootProjectConfigurationSchema;
|
|
91700
91854
|
exports.entityApiConfigurationSchema = entityApiConfigurationSchema;
|
|
91701
91855
|
exports.entityConfigurationSchema = entityConfigurationSchema;
|
|
91702
91856
|
exports.entityRootProjectConfigurationSchema = entityRootProjectConfigurationSchema;
|
|
91857
|
+
exports.eventResponseSchema = eventResponseSchema;
|
|
91858
|
+
exports.getApiFunctionSchema = getApiFunctionSchema;
|
|
91703
91859
|
exports.json = json;
|
|
91860
|
+
exports.patchApiFunctionSchema = patchApiFunctionSchema;
|
|
91861
|
+
exports.postApiFunctionSchema = postApiFunctionSchema;
|
|
91862
|
+
exports.putApiFunctionSchema = putApiFunctionSchema;
|
|
91863
|
+
exports.queryApiFunctionSchema = queryApiFunctionSchema;
|
|
91704
91864
|
exports.run = run;
|
|
91705
91865
|
exports.sendEvent = sendEvent;
|