@scout9/app 1.0.0-alpha.0.1.85 → 1.0.0-alpha.0.1.87
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-dc75cb8b.cjs → exports-85e8c05c.cjs} +420 -239
- package/dist/index.cjs +37 -1
- package/dist/{multipart-parser-f133fa41.cjs → multipart-parser-1f8d78d0.cjs} +1 -1
- package/dist/testing-tools.cjs +1 -1
- package/package.json +1 -1
- package/src/core/index.js +15 -35
- package/src/exports.js +12 -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 +12 -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 +4 -4
- package/src/runtime/client/workflow.js +73 -5
- package/types/index.d.ts +4068 -505
- package/types/index.d.ts.map +87 -18
|
@@ -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-1f8d78d0.cjs"); });
|
|
41178
41178
|
return toFormData(this.body, ct);
|
|
41179
41179
|
}
|
|
41180
41180
|
|
|
@@ -81230,7 +81230,7 @@ function _loadUserPackageJson$1() {
|
|
|
81230
81230
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
81231
81231
|
_context2.t0 = JSON;
|
|
81232
81232
|
_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-
|
|
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-85e8c05c.js', document.baseURI).href))), 'utf-8');
|
|
81234
81234
|
case 10:
|
|
81235
81235
|
_context2.t1 = _context2.sent;
|
|
81236
81236
|
pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
|
|
@@ -82075,7 +82075,7 @@ function _loadUserPackageJson() {
|
|
|
82075
82075
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
82076
82076
|
_context.t0 = JSON;
|
|
82077
82077
|
_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-
|
|
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-85e8c05c.js', document.baseURI).href))), 'utf-8');
|
|
82079
82079
|
case 10:
|
|
82080
82080
|
_context.t1 = _context.sent;
|
|
82081
82081
|
pkg = _context.t0.parse.call(_context.t0, _context.t1);
|
|
@@ -86634,24 +86634,52 @@ var momentExports = moment$1.exports;
|
|
|
86634
86634
|
var moment = /*@__PURE__*/getDefaultExportFromCjs(momentExports);
|
|
86635
86635
|
|
|
86636
86636
|
/**
|
|
86637
|
-
*
|
|
86638
86637
|
* @param {string} name
|
|
86639
|
-
* @
|
|
86638
|
+
* @param {Object} [props]
|
|
86639
|
+
* @returns {import('zod').ZodString}
|
|
86640
86640
|
*/
|
|
86641
86641
|
function zId(name) {
|
|
86642
|
-
|
|
86642
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
86643
|
+
return z.string(props).regex(/^[A-Za-z0-9\-_\[\]]+$/, {
|
|
86643
86644
|
message: "Invalid ".concat(name, " ID: ID must not contain spaces and should only contain alphanumeric characters, dashes, or underscores.")
|
|
86644
86645
|
});
|
|
86645
86646
|
}
|
|
86646
86647
|
|
|
86648
|
+
/**
|
|
86649
|
+
* @typedef {import('zod').infer<typeof MessageSchema>} IMessage
|
|
86650
|
+
*/
|
|
86647
86651
|
var MessageSchema = z.object({
|
|
86648
|
-
|
|
86652
|
+
id: zId('Message ID', {
|
|
86653
|
+
description: 'Unique ID for the message'
|
|
86654
|
+
}),
|
|
86649
86655
|
role: z["enum"](['agent', 'customer', 'system']),
|
|
86650
|
-
|
|
86651
|
-
|
|
86656
|
+
content: z.string(),
|
|
86657
|
+
time: z.string({
|
|
86658
|
+
description: 'Datetime ISO 8601 timestamp'
|
|
86659
|
+
}),
|
|
86660
|
+
name: z.string().optional(),
|
|
86661
|
+
scheduled: z.string({
|
|
86662
|
+
description: 'Datetime ISO 8601 timestamp'
|
|
86663
|
+
}).optional(),
|
|
86664
|
+
context: z.any({
|
|
86665
|
+
description: 'The context generated from the message'
|
|
86666
|
+
}).optional(),
|
|
86667
|
+
intent: z.string({
|
|
86668
|
+
description: 'Detected intent'
|
|
86669
|
+
}).optional().nullable(),
|
|
86670
|
+
intentScore: z.number({
|
|
86671
|
+
description: 'Confidence score of the assigned intent'
|
|
86672
|
+
}).nullable().optional()
|
|
86652
86673
|
});
|
|
86653
86674
|
|
|
86675
|
+
/**
|
|
86676
|
+
* @typedef {import('zod').infer<typeof customerValueSchema>} ICustomerValue
|
|
86677
|
+
*/
|
|
86654
86678
|
var customerValueSchema = z.union([z["boolean"](), z.number(), z.string()]);
|
|
86679
|
+
|
|
86680
|
+
/**
|
|
86681
|
+
* @typedef {import('zod').infer<typeof customerSchema>} ICustomer
|
|
86682
|
+
*/
|
|
86655
86683
|
var customerSchema = z.object({
|
|
86656
86684
|
firstName: z.string().optional(),
|
|
86657
86685
|
lastName: z.string().optional(),
|
|
@@ -86671,6 +86699,10 @@ var customerSchema = z.object({
|
|
|
86671
86699
|
stripe: z.string().nullable().optional(),
|
|
86672
86700
|
stripeDev: z.string().nullable().optional()
|
|
86673
86701
|
}).catchall(customerValueSchema);
|
|
86702
|
+
|
|
86703
|
+
/**
|
|
86704
|
+
* @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IAgentBase
|
|
86705
|
+
*/
|
|
86674
86706
|
var agentBaseConfigurationSchema = z.object({
|
|
86675
86707
|
deployed: z.object({
|
|
86676
86708
|
web: z.string({
|
|
@@ -86683,6 +86715,7 @@ var agentBaseConfigurationSchema = z.object({
|
|
|
86683
86715
|
description: 'Email address for agent'
|
|
86684
86716
|
}).optional()
|
|
86685
86717
|
}).optional(),
|
|
86718
|
+
img: z.string().nullable().optional(),
|
|
86686
86719
|
firstName: z.string({
|
|
86687
86720
|
description: 'Agent first name'
|
|
86688
86721
|
}).optional(),
|
|
@@ -86723,190 +86756,70 @@ var agentBaseConfigurationSchema = z.object({
|
|
|
86723
86756
|
transcripts: z.array(z.array(MessageSchema)).optional(),
|
|
86724
86757
|
audios: z.array(z.any()).optional()
|
|
86725
86758
|
});
|
|
86759
|
+
|
|
86760
|
+
/**
|
|
86761
|
+
* @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IAgent
|
|
86762
|
+
* @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IPersona
|
|
86763
|
+
*/
|
|
86726
86764
|
var agentConfigurationSchema = agentBaseConfigurationSchema.extend({
|
|
86727
|
-
id: zId('Agent ID',
|
|
86765
|
+
id: zId('Agent ID', {
|
|
86728
86766
|
description: 'Unique ID for agent'
|
|
86729
|
-
})
|
|
86767
|
+
})
|
|
86730
86768
|
});
|
|
86769
|
+
|
|
86770
|
+
/**
|
|
86771
|
+
* @typedef {import('zod').infer<typeof agentsConfigurationSchema>} IAgentsConfiguration
|
|
86772
|
+
*/
|
|
86731
86773
|
var agentsConfigurationSchema = z.array(agentConfigurationSchema);
|
|
86732
|
-
var agentsBaseConfigurationSchema = z.array(agentBaseConfigurationSchema);
|
|
86733
86774
|
|
|
86734
|
-
|
|
86735
|
-
|
|
86736
|
-
|
|
86737
|
-
|
|
86738
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86739
|
-
// RouteId extends string | null = string | null,
|
|
86740
|
-
// SearchParams extends Partial<Record<string, string | string[]>> = Partial<Record<string, string>>
|
|
86741
|
-
// > = (event: EventRequest<RequestBody, Params, RouteId, SearchParams>) => MaybePromise<EventResponse<ResponseBody>>;
|
|
86742
|
-
//
|
|
86743
|
-
// /**
|
|
86744
|
-
// * For QUERY entity api calls, this is used for getting multiple entities
|
|
86745
|
-
// */
|
|
86746
|
-
// export type QueryRequestHandler<
|
|
86747
|
-
// ResponseBody = Record<string | number, any>,
|
|
86748
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86749
|
-
// RouteId extends string | null = string | null,
|
|
86750
|
-
// > = RequestHandler<unknown, ResponseBody[], Params, RouteId, {q?: string, page?: string, limit?: string, orderBy?: string, endAt?: string, startAt?: string}>;
|
|
86751
|
-
//
|
|
86752
|
-
// /**
|
|
86753
|
-
// * For GET entity api calls, this is used for getting one entity
|
|
86754
|
-
// */
|
|
86755
|
-
// export type GetRequestHandler<
|
|
86756
|
-
// ResponseBody = Record<string | number, any>,
|
|
86757
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86758
|
-
// RouteId extends string | null = string | null,
|
|
86759
|
-
// > = RequestHandler<unknown, ResponseBody, Params, RouteId>;
|
|
86760
|
-
//
|
|
86761
|
-
// /**
|
|
86762
|
-
// * For POST entity api calls, this is used for creating an entity
|
|
86763
|
-
// */
|
|
86764
|
-
// export type PostRequestHandler<
|
|
86765
|
-
// RequestBody = Record<string | number, any>,
|
|
86766
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86767
|
-
// RouteId extends string | null = string | null
|
|
86768
|
-
// > = RequestHandler<RequestBody, {success: boolean, id: string, error?: string | object, [key: string]: any}, Params, RouteId>;
|
|
86769
|
-
//
|
|
86770
|
-
// export type CreatedRequestHandler<
|
|
86771
|
-
// RequestBody = Record<string | number, any>,
|
|
86772
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86773
|
-
// RouteId extends string | null = string | null
|
|
86774
|
-
// > = PostRequestHandler<RequestBody, Params, RouteId>;
|
|
86775
|
-
//
|
|
86776
|
-
//
|
|
86777
|
-
// /**
|
|
86778
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86779
|
-
// */
|
|
86780
|
-
// export type PutRequestHandler<
|
|
86781
|
-
// RequestBody = Record<string | number, any>,
|
|
86782
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86783
|
-
// RouteId extends string | null = string | null
|
|
86784
|
-
// > = RequestHandler<Partial<RequestBody>, {success: boolean, error?: string | object, [key: string]: any}, Params, RouteId>;
|
|
86785
|
-
//
|
|
86786
|
-
//
|
|
86787
|
-
// /**
|
|
86788
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86789
|
-
// */
|
|
86790
|
-
// export type PatchRequestHandler<
|
|
86791
|
-
// RequestBody = Record<string | number, any>,
|
|
86792
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86793
|
-
// RouteId extends string | null = string | null
|
|
86794
|
-
// > = PutRequestHandler<RequestBody, Params, RouteId>;
|
|
86795
|
-
//
|
|
86796
|
-
// /**
|
|
86797
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86798
|
-
// */
|
|
86799
|
-
// export type UpdateRequestHandler<
|
|
86800
|
-
// RequestBody = Record<string | number, any>,
|
|
86801
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86802
|
-
// RouteId extends string | null = string | null
|
|
86803
|
-
// > = PutRequestHandler<RequestBody, Params, RouteId>;
|
|
86804
|
-
//
|
|
86805
|
-
// /**
|
|
86806
|
-
// * For PUT entity api calls, this is used for creating an entity
|
|
86807
|
-
// */
|
|
86808
|
-
// export type DeleteRequestHandler<
|
|
86809
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86810
|
-
// RouteId extends string | null = string | null
|
|
86811
|
-
// > = RequestHandler<unknown, {success: boolean, error?: string | object, [key: string]: any}, Params, RouteId>;
|
|
86812
|
-
//
|
|
86813
|
-
//
|
|
86814
|
-
// export interface EventRequest<
|
|
86815
|
-
// Body = unknown,
|
|
86816
|
-
// Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
|
|
86817
|
-
// RouteId extends string | null = string | null,
|
|
86818
|
-
// SearchParams extends Partial<Record<string, string | string[]>> = Partial<Record<string, string>>,
|
|
86819
|
-
// > {
|
|
86820
|
-
//
|
|
86821
|
-
// /**
|
|
86822
|
-
// * `fetch` is equivalent to the [native `fetch` web API](https://developer.mozilla.org/en-US/docs/Web/API/fetch), with a few additional features:
|
|
86823
|
-
// *
|
|
86824
|
-
// * - It can be used to make credentialed requests on the server, as it inherits the `cookie` and `authorization` headers for the page request.
|
|
86825
|
-
// * - It can make relative requests on the server (ordinarily, `fetch` requires a URL with an origin when used in a server context).
|
|
86826
|
-
// * - 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.
|
|
86827
|
-
// * - 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
|
|
86828
|
-
// * - During hydration, the response will be read from the HTML, guaranteeing consistency and preventing an additional network request.
|
|
86829
|
-
// *
|
|
86830
|
-
// */
|
|
86831
|
-
// fetch: typeof fetch;
|
|
86832
|
-
//
|
|
86833
|
-
// /**
|
|
86834
|
-
// * The parameters of the current route - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object
|
|
86835
|
-
// */
|
|
86836
|
-
// params: Params;
|
|
86837
|
-
//
|
|
86838
|
-
// /**
|
|
86839
|
-
// * The requested URL.
|
|
86840
|
-
// */
|
|
86841
|
-
// url: URL;
|
|
86842
|
-
//
|
|
86843
|
-
// /**
|
|
86844
|
-
// * The anticipated searchParams inside `const { searchParams } = new URL(req.url)`
|
|
86845
|
-
// */
|
|
86846
|
-
// searchParams: SearchParams;
|
|
86847
|
-
//
|
|
86848
|
-
// /**
|
|
86849
|
-
// * The anticipated parsed body inside `request.body`
|
|
86850
|
-
// */
|
|
86851
|
-
// body: Body;
|
|
86852
|
-
//
|
|
86853
|
-
// /**
|
|
86854
|
-
// * The original request object
|
|
86855
|
-
// */
|
|
86856
|
-
// request: Request;
|
|
86857
|
-
//
|
|
86858
|
-
// /**
|
|
86859
|
-
// * 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:
|
|
86860
|
-
// *
|
|
86861
|
-
// * ```js
|
|
86862
|
-
// * /// file: src/routes/blog/+page.js
|
|
86863
|
-
// * export async function load({ fetch, setHeaders }) {
|
|
86864
|
-
// * const url = `https://cms.example.com/articles.json`;
|
|
86865
|
-
// * const response = await fetch(url);
|
|
86866
|
-
// *
|
|
86867
|
-
// * setHeaders({
|
|
86868
|
-
// * age: response.headers.get('age'),
|
|
86869
|
-
// * 'cache-control': response.headers.get('cache-control')
|
|
86870
|
-
// * });
|
|
86871
|
-
// *
|
|
86872
|
-
// * return response.json();
|
|
86873
|
-
// * }
|
|
86874
|
-
// * ```
|
|
86875
|
-
// *
|
|
86876
|
-
// * Setting the same header multiple times (even in separate `load` functions) is an error — you can only set a given header once.
|
|
86877
|
-
// *
|
|
86878
|
-
// * You cannot add a `set-cookie` header with `setHeaders` API instead.
|
|
86879
|
-
// */
|
|
86880
|
-
// setHeaders(headers: Record<string, string>): void;
|
|
86881
|
-
//
|
|
86882
|
-
// /**
|
|
86883
|
-
// * Info about the current route
|
|
86884
|
-
// */
|
|
86885
|
-
// route: {
|
|
86886
|
-
// /**
|
|
86887
|
-
// * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`
|
|
86888
|
-
// */
|
|
86889
|
-
// id: RouteId;
|
|
86890
|
-
// };
|
|
86891
|
-
// }
|
|
86775
|
+
/**
|
|
86776
|
+
* @typedef {import('zod').infer<typeof agentsBaseConfigurationSchema>} IAgentsBaseConfiguration
|
|
86777
|
+
*/
|
|
86778
|
+
var agentsBaseConfigurationSchema = z.array(agentBaseConfigurationSchema);
|
|
86892
86779
|
|
|
86893
86780
|
/**
|
|
86894
86781
|
* Utility runtime class used to guide event output
|
|
86782
|
+
* @template T
|
|
86895
86783
|
*/
|
|
86896
86784
|
var EventResponse = /*#__PURE__*/function () {
|
|
86785
|
+
/**
|
|
86786
|
+
* Create an EventResponse.
|
|
86787
|
+
* @param {T} body - The body of the response.
|
|
86788
|
+
* @param {ResponseInit} [init] - Additional options for the response.
|
|
86789
|
+
* @throws {Error} If the body is not a valid object.
|
|
86790
|
+
*/
|
|
86897
86791
|
function EventResponse(body, init) {
|
|
86898
86792
|
spirits._classCallCheck(this, EventResponse);
|
|
86793
|
+
/**
|
|
86794
|
+
* @type {T}
|
|
86795
|
+
* @private
|
|
86796
|
+
*/
|
|
86899
86797
|
this.body = body;
|
|
86798
|
+
|
|
86799
|
+
/**
|
|
86800
|
+
* @type {ResponseInit}
|
|
86801
|
+
* @private
|
|
86802
|
+
*/
|
|
86900
86803
|
this.init = init;
|
|
86901
86804
|
if (spirits._typeof(this.body) !== 'object') {
|
|
86902
86805
|
throw new Error("EventResponse body in not a valid object:\n\"".concat(JSON.stringify(body, null, 2), "\""));
|
|
86903
86806
|
}
|
|
86904
86807
|
}
|
|
86808
|
+
|
|
86809
|
+
/**
|
|
86810
|
+
* Get the response object.
|
|
86811
|
+
* @returns {Response} The response object.
|
|
86812
|
+
*/
|
|
86905
86813
|
spirits._createClass(EventResponse, [{
|
|
86906
86814
|
key: "response",
|
|
86907
86815
|
get: function get() {
|
|
86908
86816
|
return Response.json(this.body, this.init);
|
|
86909
86817
|
}
|
|
86818
|
+
|
|
86819
|
+
/**
|
|
86820
|
+
* Get the data of the response.
|
|
86821
|
+
* @returns {T} The body of the response.
|
|
86822
|
+
*/
|
|
86910
86823
|
}, {
|
|
86911
86824
|
key: "data",
|
|
86912
86825
|
get: function get() {
|
|
@@ -86914,14 +86827,44 @@ var EventResponse = /*#__PURE__*/function () {
|
|
|
86914
86827
|
}
|
|
86915
86828
|
}], [{
|
|
86916
86829
|
key: "json",
|
|
86917
|
-
value:
|
|
86830
|
+
value:
|
|
86831
|
+
/**
|
|
86832
|
+
* Create a new EventResponse instance with a JSON body.
|
|
86833
|
+
* @template T
|
|
86834
|
+
* @param {T} body - The body of the response.
|
|
86835
|
+
* @param {ResponseInit} [options] - Additional options for the response.
|
|
86836
|
+
* @returns {EventResponse<T>} A new EventResponse instance.
|
|
86837
|
+
*/
|
|
86838
|
+
function json(body, options) {
|
|
86918
86839
|
return new EventResponse(body, options);
|
|
86919
86840
|
}
|
|
86920
86841
|
}]);
|
|
86921
86842
|
return EventResponse;
|
|
86922
86843
|
}();
|
|
86844
|
+
var responseInitSchema = z.object({
|
|
86845
|
+
status: z.number().optional(),
|
|
86846
|
+
statusText: z.string().optional(),
|
|
86847
|
+
headers: z.any().optional() // Headers can be complex; adjust as needed
|
|
86848
|
+
});
|
|
86849
|
+
|
|
86850
|
+
/**
|
|
86851
|
+
* @template T
|
|
86852
|
+
* @typedef {object} IEventResponse
|
|
86853
|
+
* @property {T} body - The body of the response.
|
|
86854
|
+
* @property {ResponseInit} [init] - Additional options for the response.
|
|
86855
|
+
* @property {Response} response - The response object.
|
|
86856
|
+
* @property {T} data - The body of the response.
|
|
86857
|
+
*/
|
|
86858
|
+
var eventResponseSchema = z.object({
|
|
86859
|
+
body: z.any(),
|
|
86860
|
+
// Adjust as per your actual body structure
|
|
86861
|
+
init: responseInitSchema.optional()
|
|
86862
|
+
});
|
|
86923
86863
|
|
|
86924
|
-
|
|
86864
|
+
/**
|
|
86865
|
+
* @typedef {import('zod').infer<typeof entityApiConfigurationSchema>} IEntityApiConfiguration
|
|
86866
|
+
*/
|
|
86867
|
+
var entityApiConfigurationSchema = z.object({
|
|
86925
86868
|
// path: z.string(),
|
|
86926
86869
|
GET: z["boolean"]().optional(),
|
|
86927
86870
|
UPDATE: z["boolean"]().optional(),
|
|
@@ -86929,8 +86872,7 @@ var _entityApiConfigurationSchema = z.object({
|
|
|
86929
86872
|
PUT: z["boolean"]().optional(),
|
|
86930
86873
|
PATCH: z["boolean"]().optional(),
|
|
86931
86874
|
DELETE: z["boolean"]().optional()
|
|
86932
|
-
});
|
|
86933
|
-
var entityApiConfigurationSchema = _entityApiConfigurationSchema.nullable();
|
|
86875
|
+
}).nullable();
|
|
86934
86876
|
var entityConfigurationDefinitionSchema = z.object({
|
|
86935
86877
|
utterance: zId('Utterance', z.string({
|
|
86936
86878
|
description: 'What entity utterance this represents, if not provided, it will default to the entity id'
|
|
@@ -86970,6 +86912,10 @@ var _entityConfigurationSchema = z.object({
|
|
|
86970
86912
|
training: z.array(entityConfigurationTrainingSchema).optional(),
|
|
86971
86913
|
tests: z.array(entityConfigurationTestSchema).optional()
|
|
86972
86914
|
}).strict();
|
|
86915
|
+
|
|
86916
|
+
/**
|
|
86917
|
+
* @typedef {import('zod').infer<typeof entityConfigurationSchema>} IEntityConfiguration
|
|
86918
|
+
*/
|
|
86973
86919
|
var entityConfigurationSchema = _entityConfigurationSchema.refine(function (data) {
|
|
86974
86920
|
// If 'definitions' is provided, then 'training' must also be provided
|
|
86975
86921
|
if (data.definitions !== undefined) {
|
|
@@ -86981,7 +86927,11 @@ var entityConfigurationSchema = _entityConfigurationSchema.refine(function (data
|
|
|
86981
86927
|
// Custom error message
|
|
86982
86928
|
message: "If 'definitions' is provided, then 'training' must also be provided"
|
|
86983
86929
|
});
|
|
86984
|
-
|
|
86930
|
+
|
|
86931
|
+
/**
|
|
86932
|
+
* @typedef {import('zod').infer<typeof entitiesRootConfigurationSchema>} IEntitiesRootConfiguration
|
|
86933
|
+
*/
|
|
86934
|
+
var entitiesRootConfigurationSchema = z.array(entityConfigurationSchema);
|
|
86985
86935
|
var entityExtendedProjectConfigurationSchema = z.object({
|
|
86986
86936
|
entities: z.array(zId('Entity Folder', z.string()), {
|
|
86987
86937
|
description: 'Entity id association, used to handle route params'
|
|
@@ -86992,7 +86942,10 @@ var entityExtendedProjectConfigurationSchema = z.object({
|
|
|
86992
86942
|
var _entityRootProjectConfigurationSchema = _entityConfigurationSchema.extend(entityExtendedProjectConfigurationSchema.shape);
|
|
86993
86943
|
z.array(_entityRootProjectConfigurationSchema);
|
|
86994
86944
|
|
|
86995
|
-
|
|
86945
|
+
/**
|
|
86946
|
+
* @TODO why type extend not valid?
|
|
86947
|
+
* @typedef {import('zod').infer<typeof entityRootProjectConfigurationSchema>} IEntityRootProjectConfiguration
|
|
86948
|
+
*/
|
|
86996
86949
|
var entityRootProjectConfigurationSchema = _entityConfigurationSchema.extend(entityExtendedProjectConfigurationSchema.shape).refine(function (data) {
|
|
86997
86950
|
// If 'definitions' is provided, then 'training' must also be provided
|
|
86998
86951
|
if (data.definitions !== undefined) {
|
|
@@ -87004,15 +86957,30 @@ var entityRootProjectConfigurationSchema = _entityConfigurationSchema.extend(ent
|
|
|
87004
86957
|
// Custom error message
|
|
87005
86958
|
message: "If 'definitions' is provided, then 'training' must also be provided"
|
|
87006
86959
|
});
|
|
86960
|
+
|
|
86961
|
+
/**
|
|
86962
|
+
* @typedef {import('zod').infer<typeof entitiesRootProjectConfigurationSchema>} IEntitiesRootProjectConfiguration
|
|
86963
|
+
*/
|
|
87007
86964
|
var entitiesRootProjectConfigurationSchema = z.array(entityRootProjectConfigurationSchema);
|
|
87008
86965
|
|
|
86966
|
+
/**
|
|
86967
|
+
* @typedef {import('zod').infer<typeof WorkflowConfigurationSchema>} IWorkflowConfiguration
|
|
86968
|
+
*/
|
|
87009
86969
|
var WorkflowConfigurationSchema = z.object({
|
|
87010
86970
|
entities: z.array(zId('Workflow Folder', z.string()), {
|
|
87011
86971
|
description: 'Workflow id association, used to handle route params'
|
|
87012
86972
|
}).min(1, 'Must have at least 1 entity').max(15, 'Cannot have more than 15 entity paths'),
|
|
87013
86973
|
entity: zId('Workflow Folder', z.string())
|
|
87014
86974
|
});
|
|
86975
|
+
|
|
86976
|
+
/**
|
|
86977
|
+
* @typedef {import('zod').infer<typeof WorkflowsConfigurationSchema>} IWorkflowsConfiguration
|
|
86978
|
+
*/
|
|
87015
86979
|
var WorkflowsConfigurationSchema = z.array(WorkflowConfigurationSchema);
|
|
86980
|
+
|
|
86981
|
+
/**
|
|
86982
|
+
* @typedef {import('zod').infer<typeof ConversationSchema>} IConversation
|
|
86983
|
+
*/
|
|
87016
86984
|
var ConversationSchema = z.object({
|
|
87017
86985
|
$agent: zId('Conversation Agent ID', z.string({
|
|
87018
86986
|
description: 'Default agent assigned to the conversation(s)'
|
|
@@ -87031,19 +86999,56 @@ var ConversationSchema = z.object({
|
|
|
87031
86999
|
platformEmailThreadId: z.string({
|
|
87032
87000
|
description: 'Used to sync email messages with the conversation'
|
|
87033
87001
|
}).optional()
|
|
87034
|
-
}).optional()
|
|
87002
|
+
}).optional(),
|
|
87003
|
+
locked: z["boolean"]({
|
|
87004
|
+
description: 'Whether the conversation is locked or not'
|
|
87005
|
+
}).optional().nullable(),
|
|
87006
|
+
lockedReason: z.string({
|
|
87007
|
+
description: 'Why this conversation was locked'
|
|
87008
|
+
}).optional().nullable(),
|
|
87009
|
+
lockAttempts: z.number({
|
|
87010
|
+
description: 'Number attempts made until conversation is locked'
|
|
87011
|
+
}).optional().nullable(),
|
|
87012
|
+
forwardedTo: z.string({
|
|
87013
|
+
description: 'What personaId/phone/email was forwarded'
|
|
87014
|
+
}).optional().nullable(),
|
|
87015
|
+
forwarded: z.string({
|
|
87016
|
+
description: 'Datetime ISO 8601 timestamp when persona was forwarded'
|
|
87017
|
+
}).optional().nullable(),
|
|
87018
|
+
forwardNote: z.string().optional().nullable(),
|
|
87019
|
+
intent: z.string({
|
|
87020
|
+
description: 'Detected intent of conversation'
|
|
87021
|
+
}).optional().nullable(),
|
|
87022
|
+
intentScore: z.number({
|
|
87023
|
+
description: 'Confidence score of the assigned intent'
|
|
87024
|
+
}).optional().nullable()
|
|
87035
87025
|
});
|
|
87026
|
+
|
|
87027
|
+
/**
|
|
87028
|
+
* @typedef {import('zod').infer<typeof IntentWorkflowEventSchema>} IIntentWorkflowEvent
|
|
87029
|
+
*/
|
|
87036
87030
|
var IntentWorkflowEventSchema = z.object({
|
|
87037
87031
|
current: z.string().nullable(),
|
|
87038
87032
|
flow: z.array(z.string()),
|
|
87039
87033
|
initial: z.string().nullable()
|
|
87040
87034
|
});
|
|
87035
|
+
|
|
87036
|
+
/**
|
|
87037
|
+
* @typedef {import('zod').infer<typeof WorkflowEventSchema>} IWorkflowEvent
|
|
87038
|
+
*/
|
|
87041
87039
|
var WorkflowEventSchema = z.object({
|
|
87042
87040
|
messages: z.array(MessageSchema),
|
|
87043
87041
|
conversation: ConversationSchema,
|
|
87044
87042
|
context: z.any(),
|
|
87045
87043
|
message: MessageSchema,
|
|
87046
|
-
agent: agentConfigurationSchema
|
|
87044
|
+
agent: agentConfigurationSchema.omit({
|
|
87045
|
+
transcripts: true,
|
|
87046
|
+
audios: true,
|
|
87047
|
+
includedLocations: true,
|
|
87048
|
+
excludedLocations: true,
|
|
87049
|
+
model: true,
|
|
87050
|
+
context: true
|
|
87051
|
+
}),
|
|
87047
87052
|
customer: customerSchema,
|
|
87048
87053
|
intent: IntentWorkflowEventSchema,
|
|
87049
87054
|
stagnationCount: z.number(),
|
|
@@ -87054,15 +87059,33 @@ var WorkflowEventSchema = z.object({
|
|
|
87054
87059
|
var Primitive = z.union([z.string(), z.number(), z["boolean"]()]);
|
|
87055
87060
|
// Assuming ConversationContext is already defined as a Zod schema
|
|
87056
87061
|
|
|
87057
|
-
|
|
87062
|
+
/**
|
|
87063
|
+
* Lazy is used to handle recursive types.
|
|
87064
|
+
* @typedef {import('zod').infer<typeof ConversationContext>} IConversation
|
|
87065
|
+
*/
|
|
87058
87066
|
var ConversationContext = z.lazy(function () {
|
|
87059
87067
|
return z.record(Primitive.or(ConversationContext));
|
|
87060
87068
|
});
|
|
87061
87069
|
z.record(Primitive.or(ConversationContext));
|
|
87070
|
+
|
|
87071
|
+
/**
|
|
87072
|
+
* Forward input information of a conversation
|
|
87073
|
+
* @typedef {import('zod').infer<typeof ForwardSchema>} IForward
|
|
87074
|
+
*/
|
|
87062
87075
|
var ForwardSchema = z.union([z["boolean"](), z.string(), z.object({
|
|
87063
87076
|
to: z.string().optional(),
|
|
87064
|
-
mode: z["enum"](['after-reply', 'immediately']).optional()
|
|
87065
|
-
|
|
87077
|
+
mode: z["enum"](['after-reply', 'immediately']).optional(),
|
|
87078
|
+
note: z.string({
|
|
87079
|
+
description: 'Note to provide to the agent'
|
|
87080
|
+
}).optional()
|
|
87081
|
+
})], {
|
|
87082
|
+
description: 'Forward input information of a conversation'
|
|
87083
|
+
});
|
|
87084
|
+
|
|
87085
|
+
/**
|
|
87086
|
+
* Instruction object schema used to send context to guide conversations
|
|
87087
|
+
* @typedef {import('zod').infer<typeof InstructionSchema>} IInstruction
|
|
87088
|
+
*/
|
|
87066
87089
|
var InstructionSchema = z.object({
|
|
87067
87090
|
id: zId('Instruction ID').describe('Unique ID for the instruction, this is used to remove the instruction later'),
|
|
87068
87091
|
content: z.string()
|
|
@@ -87071,12 +87094,17 @@ var InstructionSchema = z.object({
|
|
|
87071
87094
|
/**
|
|
87072
87095
|
* If its a string, it will be sent as a static string.
|
|
87073
87096
|
* If it's a object or WorkflowResponseMessageAPI - it will use
|
|
87097
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseMessage>} IWorkflowResponseMessage
|
|
87074
87098
|
*/
|
|
87075
|
-
z.union(z.string(),
|
|
87099
|
+
var WorkflowResponseMessage = z.union(z.string(),
|
|
87076
87100
|
/**
|
|
87077
87101
|
* An api call that should be called later, must return a string or {message: string}
|
|
87078
87102
|
*/
|
|
87079
87103
|
WorkflowResponseMessageApiRequest);
|
|
87104
|
+
|
|
87105
|
+
/**
|
|
87106
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseMessageApiRequest>} IWorkflowResponseMessageApiRequest
|
|
87107
|
+
*/
|
|
87080
87108
|
var WorkflowResponseMessageApiRequest = z.object({
|
|
87081
87109
|
uri: z.string(),
|
|
87082
87110
|
data: z.any().optional(),
|
|
@@ -87086,8 +87114,9 @@ var WorkflowResponseMessageApiRequest = z.object({
|
|
|
87086
87114
|
|
|
87087
87115
|
/**
|
|
87088
87116
|
* The intended response provided by the WorkflowResponseMessageApiRequest
|
|
87117
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseMessageApiResponse>} IWorkflowResponseMessageApiResponse
|
|
87089
87118
|
*/
|
|
87090
|
-
z.union([z.string(), z.object({
|
|
87119
|
+
var WorkflowResponseMessageApiResponse = z.union([z.string(), z.object({
|
|
87091
87120
|
message: z.string()
|
|
87092
87121
|
}), z.object({
|
|
87093
87122
|
text: z.string()
|
|
@@ -87100,8 +87129,16 @@ z.union([z.string(), z.object({
|
|
|
87100
87129
|
text: z.string()
|
|
87101
87130
|
})
|
|
87102
87131
|
})]);
|
|
87132
|
+
|
|
87133
|
+
/**
|
|
87134
|
+
* The workflow response object slot
|
|
87135
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseSlotSchema>} IWorkflowResponseSlot
|
|
87136
|
+
*/
|
|
87103
87137
|
var WorkflowResponseSlotSchema = z.object({
|
|
87104
87138
|
forward: ForwardSchema.optional(),
|
|
87139
|
+
forwardNote: z.string({
|
|
87140
|
+
description: 'Note to provide to the agent, recommend using forward object api instead'
|
|
87141
|
+
}).optional(),
|
|
87105
87142
|
instructions: z.union([z.string(), InstructionSchema, z.array(z.string()), z.array(InstructionSchema)]).optional(),
|
|
87106
87143
|
removeInstructions: z.array(z.string()).optional(),
|
|
87107
87144
|
message: z.string().optional(),
|
|
@@ -87111,7 +87148,17 @@ var WorkflowResponseSlotSchema = z.object({
|
|
|
87111
87148
|
contextUpsert: ConversationContext.optional(),
|
|
87112
87149
|
resetIntent: z["boolean"]().optional()
|
|
87113
87150
|
});
|
|
87114
|
-
|
|
87151
|
+
|
|
87152
|
+
/**
|
|
87153
|
+
* The workflow response to send in any given workflow
|
|
87154
|
+
* @typedef {import('zod').infer<typeof WorkflowResponseSchema>} IWorkflowResponse
|
|
87155
|
+
*/
|
|
87156
|
+
var WorkflowResponseSchema = z.union([WorkflowResponseSlotSchema, z.array(WorkflowResponseSlotSchema)]);
|
|
87157
|
+
|
|
87158
|
+
/**
|
|
87159
|
+
* @typedef {import('zod').infer<typeof WorkflowFunctionSchema>} IWorkflowFunction
|
|
87160
|
+
*/
|
|
87161
|
+
var WorkflowFunctionSchema = z["function"]().args(WorkflowEventSchema).returns(z.union([z.promise(WorkflowResponseSchema), WorkflowResponseSchema]));
|
|
87115
87162
|
|
|
87116
87163
|
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
|
|
87117
87164
|
]);
|
|
@@ -87128,21 +87175,45 @@ var bardSchema = z.object({
|
|
|
87128
87175
|
engine: z.literal('bard'),
|
|
87129
87176
|
model: z.string()
|
|
87130
87177
|
});
|
|
87178
|
+
|
|
87179
|
+
/**
|
|
87180
|
+
* Configure personal model transformer (PMT) settings to align auto replies the agent's tone
|
|
87181
|
+
*/
|
|
87131
87182
|
var pmtSchema = z.object({
|
|
87132
87183
|
engine: z.literal('scout9'),
|
|
87133
87184
|
// model: pmtModelOptions
|
|
87134
87185
|
model: z.string()
|
|
87186
|
+
}, {
|
|
87187
|
+
description: 'Configure personal model transformer (PMT) settings to align auto replies the agent\'s tone'
|
|
87135
87188
|
});
|
|
87136
|
-
|
|
87189
|
+
|
|
87190
|
+
/**
|
|
87191
|
+
* Represents the configuration provided in src/index.{js | ts} in a project
|
|
87192
|
+
* @typedef {import('zod').infer<typeof Scout9ProjectConfigSchema>} IScout9ProjectConfig
|
|
87193
|
+
*/
|
|
87194
|
+
var Scout9ProjectConfigSchema = z.object({
|
|
87195
|
+
/**
|
|
87196
|
+
* Tag to reference this application
|
|
87197
|
+
* @defaut your local package.json name + version, or scout9-app-v1.0.0
|
|
87198
|
+
*/
|
|
87137
87199
|
tag: z.string().optional(),
|
|
87138
87200
|
// Defaults to scout9-app-v1.0.0
|
|
87139
|
-
agents: agentsBaseConfigurationSchema,
|
|
87140
|
-
entities: entitiesRootProjectConfigurationSchema,
|
|
87141
|
-
workflows: WorkflowsConfigurationSchema,
|
|
87142
87201
|
llm: z.union([llmSchema, llamaSchema, bardSchema]),
|
|
87202
|
+
/**
|
|
87203
|
+
* Configure personal model transformer (PMT) settings to align auto replies the agent's tone
|
|
87204
|
+
*/
|
|
87143
87205
|
pmt: pmtSchema,
|
|
87144
|
-
|
|
87145
|
-
|
|
87206
|
+
/**
|
|
87207
|
+
* Determines the max auto replies without further conversation progression (defined by new context data gathered)
|
|
87208
|
+
* before the conversation is locked and requires manual intervention
|
|
87209
|
+
* @default 3
|
|
87210
|
+
*/
|
|
87211
|
+
maxLockAttempts: z.number({
|
|
87212
|
+
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'
|
|
87213
|
+
}).min(0).max(20)["default"](3).optional(),
|
|
87214
|
+
initialContext: z.array(z.string(), {
|
|
87215
|
+
description: 'Configure the initial contexts for every conversation'
|
|
87216
|
+
}),
|
|
87146
87217
|
organization: z.object({
|
|
87147
87218
|
name: z.string(),
|
|
87148
87219
|
description: z.string(),
|
|
@@ -87156,6 +87227,96 @@ var Scout9ProjectBuildConfigSchema = z.object({
|
|
|
87156
87227
|
}).optional()
|
|
87157
87228
|
});
|
|
87158
87229
|
|
|
87230
|
+
/**
|
|
87231
|
+
* @typedef {import('zod').infer<typeof Scout9ProjectBuildConfigSchema>} IScout9ProjectBuildConfig
|
|
87232
|
+
*/
|
|
87233
|
+
var Scout9ProjectBuildConfigSchema = Scout9ProjectConfigSchema.extend({
|
|
87234
|
+
agents: agentsBaseConfigurationSchema,
|
|
87235
|
+
entities: entitiesRootProjectConfigurationSchema,
|
|
87236
|
+
workflows: WorkflowsConfigurationSchema
|
|
87237
|
+
});
|
|
87238
|
+
|
|
87239
|
+
/**
|
|
87240
|
+
* @typedef {object} IApiFunctionParams
|
|
87241
|
+
* @property {Object.<string, string|string[]>} searchParams
|
|
87242
|
+
* @property {Record<string, string>} params
|
|
87243
|
+
*/
|
|
87244
|
+
var apiFunctionParamsSchema = z.object({
|
|
87245
|
+
searchParams: z.record(z.union([z.string(), z.array(z.string())])),
|
|
87246
|
+
params: z.record(z.string())
|
|
87247
|
+
});
|
|
87248
|
+
|
|
87249
|
+
/**
|
|
87250
|
+
* @typedef {IApiFunctionParams & { id: string }} IApiEntityFunctionParams
|
|
87251
|
+
*/
|
|
87252
|
+
apiFunctionParamsSchema.extend({
|
|
87253
|
+
id: z.string()
|
|
87254
|
+
});
|
|
87255
|
+
|
|
87256
|
+
/**
|
|
87257
|
+
* @template Params
|
|
87258
|
+
* @template Response
|
|
87259
|
+
* @typedef {function(IApiFunctionParams): Promise<EventResponse>} IApiFunction
|
|
87260
|
+
*/
|
|
87261
|
+
var apiFunctionSchema = z["function"]().args(apiFunctionParamsSchema).returns(z.promise(eventResponseSchema));
|
|
87262
|
+
|
|
87263
|
+
/**
|
|
87264
|
+
* @template Params
|
|
87265
|
+
* @template Response
|
|
87266
|
+
* @typedef {IApiFunction<Params, Response>} IQueryApiFunction
|
|
87267
|
+
*/
|
|
87268
|
+
var queryApiFunctionSchema = apiFunctionSchema;
|
|
87269
|
+
|
|
87270
|
+
/**
|
|
87271
|
+
* @template Params
|
|
87272
|
+
* @template Response
|
|
87273
|
+
* @typedef {IApiFunction<Params, Response>} GetApiFunction
|
|
87274
|
+
*/
|
|
87275
|
+
var getApiFunctionSchema = apiFunctionSchema;
|
|
87276
|
+
|
|
87277
|
+
/**
|
|
87278
|
+
* @template Params
|
|
87279
|
+
* @template RequestBody
|
|
87280
|
+
* @template Response
|
|
87281
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPostApiFunction
|
|
87282
|
+
*/
|
|
87283
|
+
var postApiFunctionSchema = function postApiFunctionSchema(requestBodySchema) {
|
|
87284
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
87285
|
+
body: requestBodySchema.partial()
|
|
87286
|
+
})).returns(z.promise(eventResponseSchema));
|
|
87287
|
+
};
|
|
87288
|
+
|
|
87289
|
+
/**
|
|
87290
|
+
* @template Params
|
|
87291
|
+
* @template RequestBody
|
|
87292
|
+
* @template Response
|
|
87293
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPutApiFunction
|
|
87294
|
+
*/
|
|
87295
|
+
var putApiFunctionSchema = function putApiFunctionSchema(requestBodySchema) {
|
|
87296
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
87297
|
+
body: requestBodySchema.partial()
|
|
87298
|
+
})).returns(z.promise(eventResponseSchema));
|
|
87299
|
+
};
|
|
87300
|
+
|
|
87301
|
+
/**
|
|
87302
|
+
* @template Params
|
|
87303
|
+
* @template RequestBody
|
|
87304
|
+
* @template Response
|
|
87305
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPatchApiFunction
|
|
87306
|
+
*/
|
|
87307
|
+
var patchApiFunctionSchema = function patchApiFunctionSchema(requestBodySchema) {
|
|
87308
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
87309
|
+
body: requestBodySchema.partial()
|
|
87310
|
+
})).returns(z.promise(eventResponseSchema));
|
|
87311
|
+
};
|
|
87312
|
+
|
|
87313
|
+
/**
|
|
87314
|
+
* @template Params
|
|
87315
|
+
* @template Response
|
|
87316
|
+
* @typedef {IApiFunction<Params, Response>} IDeleteApiFunction
|
|
87317
|
+
*/
|
|
87318
|
+
var deleteApiFunctionSchema = apiFunctionSchema;
|
|
87319
|
+
|
|
87159
87320
|
function loadEntityApiConfig$1(_x, _x2) {
|
|
87160
87321
|
return _loadEntityApiConfig$1.apply(this, arguments);
|
|
87161
87322
|
}
|
|
@@ -88350,36 +88511,8 @@ function report(config, logger) {
|
|
|
88350
88511
|
logger.primary("Run ".concat(cyan('scout9 dev'), " to test your project locally"));
|
|
88351
88512
|
}
|
|
88352
88513
|
|
|
88353
|
-
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-
|
|
88514
|
+
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-85e8c05c.js', document.baseURI).href)));
|
|
88354
88515
|
var __dirname$1 = path__default["default"].dirname(__filename$1);
|
|
88355
|
-
|
|
88356
|
-
/**
|
|
88357
|
-
* @returns {Promise<string>} - the output directory
|
|
88358
|
-
*/
|
|
88359
|
-
// async function runNpmRunBuild({cwd = process.cwd(), src = 'src'} = {}) {
|
|
88360
|
-
// const pkg = JSON.parse(fss.readFileSync(new URL(`${cwd}/package.json`, import.meta.url), 'utf-8'));
|
|
88361
|
-
// // Package.json must have a "build" script
|
|
88362
|
-
// const buildScript = pkg.scripts?.build;
|
|
88363
|
-
// if (!buildScript) {
|
|
88364
|
-
// // If no build script then just return src
|
|
88365
|
-
// return path.resolve(cwd, src);
|
|
88366
|
-
// }
|
|
88367
|
-
// // "build" script cannot contain "scout9 build" (otherwise we'll get stuck in a loop)
|
|
88368
|
-
// if (buildScript.includes('scout9 build')) {
|
|
88369
|
-
// throw new Error(`"build" script in ${cwd}/package.json cannot contain "scout9 build"`);
|
|
88370
|
-
// }
|
|
88371
|
-
//
|
|
88372
|
-
// return new Promise((resolve, reject) => {
|
|
88373
|
-
// exec('npm run build', {cwd}, (error, stdout, stderr) => {
|
|
88374
|
-
// if (error) {
|
|
88375
|
-
// return reject(error);
|
|
88376
|
-
// }
|
|
88377
|
-
// // @TODO don't assume build script created a "build" directory (use a config)
|
|
88378
|
-
// return resolve(path.resolve(cwd, 'build'));
|
|
88379
|
-
// });
|
|
88380
|
-
// });
|
|
88381
|
-
// }
|
|
88382
|
-
|
|
88383
88516
|
function zipDirectory(source, out) {
|
|
88384
88517
|
var archive = archiver$1('tar', {
|
|
88385
88518
|
gzip: true,
|
|
@@ -88593,7 +88726,7 @@ function _buildApp() {
|
|
|
88593
88726
|
case 11:
|
|
88594
88727
|
_context4.t0 = JSON;
|
|
88595
88728
|
_context4.next = 14;
|
|
88596
|
-
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-
|
|
88729
|
+
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-85e8c05c.js', document.baseURI).href))), 'utf-8');
|
|
88597
88730
|
case 14:
|
|
88598
88731
|
_context4.t1 = _context4.sent;
|
|
88599
88732
|
packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
|
@@ -88675,6 +88808,13 @@ function _buildApp() {
|
|
|
88675
88808
|
function downloadDevApp(_x8, _x9) {
|
|
88676
88809
|
return _downloadDevApp.apply(this, arguments);
|
|
88677
88810
|
}
|
|
88811
|
+
/**
|
|
88812
|
+
* @param {Object} [options]
|
|
88813
|
+
* @param {string} [options.cwd]
|
|
88814
|
+
* @param {string} [options.src]
|
|
88815
|
+
* @param {boolean} [options.ignoreAppRequire]
|
|
88816
|
+
* @returns {Promise<{app: *, fileName: string, exe: string, filePath: string}>}
|
|
88817
|
+
*/
|
|
88678
88818
|
function _downloadDevApp() {
|
|
88679
88819
|
_downloadDevApp = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee5(destination, version) {
|
|
88680
88820
|
var url, downloadLocalResponse, arrayBuffer;
|
|
@@ -88805,10 +88945,10 @@ function getAgentContacts() {
|
|
|
88805
88945
|
* Runs a given project container from scout9 to given environment
|
|
88806
88946
|
* Runs the project in a container
|
|
88807
88947
|
*
|
|
88808
|
-
* @param {
|
|
88948
|
+
* @param {import('../runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
88809
88949
|
* @param {Object} options
|
|
88810
88950
|
* @param {string} options.eventSource - the source path of the event
|
|
88811
|
-
* @returns {Promise<
|
|
88951
|
+
* @returns {Promise<import('../runtime/client/workflow.js').IWorkflowResponse>}
|
|
88812
88952
|
*/
|
|
88813
88953
|
function _getAgentContacts() {
|
|
88814
88954
|
_getAgentContacts = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee7() {
|
|
@@ -88908,7 +89048,7 @@ function runConfig() {
|
|
|
88908
89048
|
/**
|
|
88909
89049
|
* Builds a local project
|
|
88910
89050
|
* @param {{cwd: string; src: string; dest: string; logger: ProgressLogger; mode: string;}} - build options
|
|
88911
|
-
* @param {
|
|
89051
|
+
* @param {import('../runtime/client/').IScout9ProjectBuildConfig} config
|
|
88912
89052
|
* @returns {messages: string[]}
|
|
88913
89053
|
*/
|
|
88914
89054
|
function _runConfig() {
|
|
@@ -88951,6 +89091,7 @@ function build() {
|
|
|
88951
89091
|
* Deploys a local project to scout9
|
|
88952
89092
|
* @param {{cwd: string; src: string, dest: string}} - build options
|
|
88953
89093
|
* @param {Scout9ProjectBuildConfig} config
|
|
89094
|
+
* @return {Promise<{deploy: Object, contacts: any}>}
|
|
88954
89095
|
*/
|
|
88955
89096
|
function _build() {
|
|
88956
89097
|
_build = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee10() {
|
|
@@ -89042,7 +89183,7 @@ function deploy(_x11, _x12) {
|
|
|
89042
89183
|
/**
|
|
89043
89184
|
* Tests a local project to scout9 by running a dummy parse command with the project's local entities
|
|
89044
89185
|
* @param {{cwd: string; src: string, dest: string}} - build options
|
|
89045
|
-
* @param {
|
|
89186
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
89046
89187
|
*/
|
|
89047
89188
|
function _deploy() {
|
|
89048
89189
|
_deploy = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee11(_ref4, config) {
|
|
@@ -89118,8 +89259,8 @@ function test(_x13, _x14) {
|
|
|
89118
89259
|
/**
|
|
89119
89260
|
*
|
|
89120
89261
|
* @param {{cwd: string; src: string; projectFiles: ProjectFiles; logger: ProgressLogger}} options
|
|
89121
|
-
* @param {
|
|
89122
|
-
* @returns {Promise<{success: boolean; config:
|
|
89262
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
89263
|
+
* @returns {Promise<{success: boolean; config: import('../runtime/client/config.js').IScout9ProjectBuildConfig}>}
|
|
89123
89264
|
*/
|
|
89124
89265
|
function _test() {
|
|
89125
89266
|
_test = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee12(_ref5, config) {
|
|
@@ -90489,7 +90630,7 @@ var Scout9Platform = {
|
|
|
90489
90630
|
* @param {string} [params.cwd=process.cwd()] - the working directory
|
|
90490
90631
|
* @param {string} [params.src='src'] - the source directory
|
|
90491
90632
|
* @param {string} [params.mode='production'] - the build mode
|
|
90492
|
-
* @returns {Promise<
|
|
90633
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90493
90634
|
*/
|
|
90494
90635
|
sync: function () {
|
|
90495
90636
|
var _sync2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee() {
|
|
@@ -90564,7 +90705,7 @@ var Scout9Platform = {
|
|
|
90564
90705
|
* @param {string} [params.dest='/tmp/project'] - the destination directory
|
|
90565
90706
|
* @param {'development' | 'production'} [params.mode='production'] - the build mode
|
|
90566
90707
|
* @param {boolean} [params.sync=true] - whether to sync the project after deploying
|
|
90567
|
-
* @returns {Promise<
|
|
90708
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90568
90709
|
*/
|
|
90569
90710
|
deploy: function () {
|
|
90570
90711
|
var _deploy2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee2() {
|
|
@@ -90686,7 +90827,7 @@ var Scout9Platform = {
|
|
|
90686
90827
|
* @param {string} [params.src='./src'] - the source directory
|
|
90687
90828
|
* @param {string} [params.dest='/tmp/project'] - the destination directory
|
|
90688
90829
|
* @param {'development' | 'production'} [params.mode='production'] - the build mode
|
|
90689
|
-
* @returns {Promise<
|
|
90830
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90690
90831
|
*/
|
|
90691
90832
|
test: function () {
|
|
90692
90833
|
var _test2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee3() {
|
|
@@ -90760,7 +90901,7 @@ var Scout9Platform = {
|
|
|
90760
90901
|
* @param {string} [params.src='./src'] - the source directory
|
|
90761
90902
|
* @param {string} [params.dest='/tmp/project'] - the destination directory
|
|
90762
90903
|
* @param {'development' | 'production'} [params.mode='production'] - the build mode
|
|
90763
|
-
* @returns {Promise<
|
|
90904
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90764
90905
|
*/
|
|
90765
90906
|
build: function () {
|
|
90766
90907
|
var _build2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee4() {
|
|
@@ -90837,7 +90978,7 @@ var Scout9Platform = {
|
|
|
90837
90978
|
* @param {string} [params.cwd=process.cwd()] - the working directory
|
|
90838
90979
|
* @param {boolean} [params.local=false] - whether to only load the local config (ignores what's saved on server)
|
|
90839
90980
|
* @param {string} [params.src='./src'] - the source directory
|
|
90840
|
-
* @returns {Promise<
|
|
90981
|
+
* @returns {Promise<import('./runtime/client/config.js').IScout9ProjectBuildConfig>}
|
|
90841
90982
|
*/
|
|
90842
90983
|
config: function () {
|
|
90843
90984
|
var _config = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee5() {
|
|
@@ -90891,13 +91032,13 @@ var Scout9Platform = {
|
|
|
90891
91032
|
}(),
|
|
90892
91033
|
/**
|
|
90893
91034
|
* Runs the project in a container
|
|
90894
|
-
* @param {
|
|
91035
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
90895
91036
|
* @param {Object} options
|
|
90896
91037
|
* @param {string} [options.cwd=process.cwd()] - the working directory
|
|
90897
91038
|
* @param {string} [options.mode='production'] - the build mode
|
|
90898
91039
|
* @param {string} [options.src='./src'] - the source directory
|
|
90899
91040
|
* @param {string} options.eventSource - the source of the workflow event
|
|
90900
|
-
* @returns {Promise<
|
|
91041
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
90901
91042
|
*/
|
|
90902
91043
|
run: function () {
|
|
90903
91044
|
var _run2 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee6(event, _ref6) {
|
|
@@ -91607,18 +91748,22 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91607
91748
|
}();
|
|
91608
91749
|
|
|
91609
91750
|
/**
|
|
91610
|
-
* @param {
|
|
91611
|
-
* @param {
|
|
91612
|
-
* @
|
|
91751
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
91752
|
+
* @param {Object} options
|
|
91753
|
+
* @param {string} [options.cwd=process.cwd()] - the working directory
|
|
91754
|
+
* @param {string} [options.mode='production'] - the build mode
|
|
91755
|
+
* @param {string} [options.src='./src'] - the source directory
|
|
91756
|
+
* @param {string} options.eventSource - the source of the workflow event
|
|
91757
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
91613
91758
|
*/
|
|
91614
91759
|
function run(_x, _x2) {
|
|
91615
91760
|
return _run.apply(this, arguments);
|
|
91616
91761
|
}
|
|
91617
91762
|
|
|
91618
91763
|
/**
|
|
91619
|
-
* @param {
|
|
91764
|
+
* @param {import('./runtime/client/workflow.js').IWorkflowEvent} event - every workflow receives an event object
|
|
91620
91765
|
* @param {{cwd: string; mode: 'development' | 'production'; src: string}} options - build options
|
|
91621
|
-
* @returns {Promise<
|
|
91766
|
+
* @returns {Promise<import('./runtime/client/workflow.js').IWorkflowResponse>}
|
|
91622
91767
|
*/
|
|
91623
91768
|
function _run() {
|
|
91624
91769
|
_run = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee(event, options) {
|
|
@@ -91639,7 +91784,7 @@ var sendEvent = run;
|
|
|
91639
91784
|
/**
|
|
91640
91785
|
* @param data {T}
|
|
91641
91786
|
* @param init {ResponseInit | undefined}
|
|
91642
|
-
* @returns {EventResponse<T>}
|
|
91787
|
+
* @returns {import('./runtime/client/api.js').EventResponse<T>}
|
|
91643
91788
|
*/
|
|
91644
91789
|
function json(data, init) {
|
|
91645
91790
|
if (data instanceof Promise) {
|
|
@@ -91665,15 +91810,51 @@ function json(data, init) {
|
|
|
91665
91810
|
}
|
|
91666
91811
|
var encoder = new TextEncoder();
|
|
91667
91812
|
|
|
91813
|
+
exports.ConversationContext = ConversationContext;
|
|
91814
|
+
exports.ConversationSchema = ConversationSchema;
|
|
91668
91815
|
exports.EventResponse = EventResponse;
|
|
91669
91816
|
exports.File = File;
|
|
91670
91817
|
exports.FormData = FormData$2;
|
|
91818
|
+
exports.ForwardSchema = ForwardSchema;
|
|
91819
|
+
exports.InstructionSchema = InstructionSchema;
|
|
91820
|
+
exports.IntentWorkflowEventSchema = IntentWorkflowEventSchema;
|
|
91821
|
+
exports.MessageSchema = MessageSchema;
|
|
91822
|
+
exports.Scout9ProjectBuildConfigSchema = Scout9ProjectBuildConfigSchema;
|
|
91823
|
+
exports.Scout9ProjectConfigSchema = Scout9ProjectConfigSchema;
|
|
91671
91824
|
exports.Scout9Test = Scout9Test;
|
|
91825
|
+
exports.WorkflowConfigurationSchema = WorkflowConfigurationSchema;
|
|
91826
|
+
exports.WorkflowEventSchema = WorkflowEventSchema;
|
|
91827
|
+
exports.WorkflowFunctionSchema = WorkflowFunctionSchema;
|
|
91828
|
+
exports.WorkflowResponseMessage = WorkflowResponseMessage;
|
|
91829
|
+
exports.WorkflowResponseMessageApiRequest = WorkflowResponseMessageApiRequest;
|
|
91830
|
+
exports.WorkflowResponseMessageApiResponse = WorkflowResponseMessageApiResponse;
|
|
91831
|
+
exports.WorkflowResponseSchema = WorkflowResponseSchema;
|
|
91832
|
+
exports.WorkflowResponseSlotSchema = WorkflowResponseSlotSchema;
|
|
91833
|
+
exports.WorkflowsConfigurationSchema = WorkflowsConfigurationSchema;
|
|
91834
|
+
exports.agentBaseConfigurationSchema = agentBaseConfigurationSchema;
|
|
91835
|
+
exports.agentConfigurationSchema = agentConfigurationSchema;
|
|
91836
|
+
exports.agentsBaseConfigurationSchema = agentsBaseConfigurationSchema;
|
|
91837
|
+
exports.agentsConfigurationSchema = agentsConfigurationSchema;
|
|
91838
|
+
exports.apiFunctionSchema = apiFunctionSchema;
|
|
91672
91839
|
exports.createMockAgent = createMockAgent;
|
|
91673
91840
|
exports.createMockConversation = createMockConversation;
|
|
91674
91841
|
exports.createMockCustomer = createMockCustomer;
|
|
91675
91842
|
exports.createMockMessage = createMockMessage;
|
|
91676
91843
|
exports.createMockWorkflowEvent = createMockWorkflowEvent;
|
|
91844
|
+
exports.customerSchema = customerSchema;
|
|
91845
|
+
exports.customerValueSchema = customerValueSchema;
|
|
91846
|
+
exports.deleteApiFunctionSchema = deleteApiFunctionSchema;
|
|
91847
|
+
exports.entitiesRootConfigurationSchema = entitiesRootConfigurationSchema;
|
|
91848
|
+
exports.entitiesRootProjectConfigurationSchema = entitiesRootProjectConfigurationSchema;
|
|
91849
|
+
exports.entityApiConfigurationSchema = entityApiConfigurationSchema;
|
|
91850
|
+
exports.entityConfigurationSchema = entityConfigurationSchema;
|
|
91851
|
+
exports.entityRootProjectConfigurationSchema = entityRootProjectConfigurationSchema;
|
|
91852
|
+
exports.eventResponseSchema = eventResponseSchema;
|
|
91853
|
+
exports.getApiFunctionSchema = getApiFunctionSchema;
|
|
91677
91854
|
exports.json = json;
|
|
91855
|
+
exports.patchApiFunctionSchema = patchApiFunctionSchema;
|
|
91856
|
+
exports.postApiFunctionSchema = postApiFunctionSchema;
|
|
91857
|
+
exports.putApiFunctionSchema = putApiFunctionSchema;
|
|
91858
|
+
exports.queryApiFunctionSchema = queryApiFunctionSchema;
|
|
91678
91859
|
exports.run = run;
|
|
91679
91860
|
exports.sendEvent = sendEvent;
|