@sprucelabs/spruce-conversation-plugin 62.0.1 → 62.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/build/.spruce/errors/errors.types.d.ts +8 -8
  2. package/build/.spruce/errors/options.types.d.ts +2 -2
  3. package/build/__tests__/behavioral/KillingASkill.test.js +1 -1
  4. package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +4 -2
  5. package/build/__tests__/behavioral/RespondingToMessages.test.js +1 -1
  6. package/build/__tests__/implementation/ConversationCoordinator.test.js +24 -6
  7. package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +3 -1
  8. package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +3 -1
  9. package/build/__tests__/implementation/ScriptTester.test.js +3 -4
  10. package/build/__tests__/implementation/TopicScriptPlayer.test.js +5 -1
  11. package/build/__tests__/implementation/TopicSuggester.test.js +7 -1
  12. package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +5 -1
  13. package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +5 -1
  14. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +4 -1
  15. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +4 -1
  16. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +5 -1
  17. package/build/esm/.spruce/errors/errors.types.d.ts +8 -8
  18. package/build/esm/.spruce/errors/options.types.d.ts +2 -2
  19. package/build/esm/__tests__/behavioral/KillingASkill.test.js +1 -1
  20. package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +4 -2
  21. package/build/esm/__tests__/behavioral/RespondingToMessages.test.js +1 -1
  22. package/build/esm/__tests__/implementation/ConversationCoordinator.test.js +24 -6
  23. package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +3 -1
  24. package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +3 -1
  25. package/build/esm/__tests__/implementation/ScriptTester.test.js +1 -2
  26. package/build/esm/__tests__/implementation/TopicScriptPlayer.test.js +5 -1
  27. package/build/esm/__tests__/implementation/TopicSuggester.test.js +7 -1
  28. package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +5 -1
  29. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +5 -1
  30. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +4 -1
  31. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +4 -1
  32. package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +5 -1
  33. package/build/esm/plugins/conversation.plugin.js +25 -20
  34. package/build/esm/tests/AbstractGraphicsInterfaceTest.js +4 -1
  35. package/build/esm/tests/ScriptTester.js +19 -7
  36. package/build/esm/topics/TopicLoader.js +3 -1
  37. package/build/esm/topics/TopicScriptPlayer.js +2 -1
  38. package/build/esm/topics/TopicSuggester.js +5 -1
  39. package/build/esm/types/conversation.types.d.ts +6 -10
  40. package/build/esm/utilities/suggester.utility.d.ts +2 -2
  41. package/build/plugins/conversation.plugin.js +25 -20
  42. package/build/tests/AbstractGraphicsInterfaceTest.js +4 -1
  43. package/build/tests/ScriptTester.js +19 -7
  44. package/build/topics/TopicLoader.js +3 -1
  45. package/build/topics/TopicScriptPlayer.js +2 -1
  46. package/build/topics/TopicSuggester.js +5 -1
  47. package/build/types/conversation.types.d.ts +6 -10
  48. package/build/utilities/suggester.utility.d.ts +2 -2
  49. package/package.json +20 -22
@@ -13,7 +13,10 @@ const topicDefinition = {
13
13
  script: [
14
14
  'what is your favorite color?',
15
15
  (options) => __awaiter(void 0, void 0, void 0, function* () {
16
- const answer = yield options.ui.prompt({ type: 'text', isRequired: true });
16
+ const answer = yield options.ui.prompt({
17
+ type: 'text',
18
+ isRequired: true,
19
+ });
17
20
  options.ui.renderLine(answer);
18
21
  return {
19
22
  transitionConversationTo: 'discovery',
@@ -1,6 +1,10 @@
1
1
  const topicDefinition = {
2
2
  label: 'Cancel appointment',
3
- utterances: ['Cancel appointment', 'Can i cancel my appointment?', 'cancel'],
3
+ utterances: [
4
+ 'Cancel appointment',
5
+ 'Can i cancel my appointment?',
6
+ 'cancel',
7
+ ],
4
8
  script: [
5
9
  () => {
6
10
  throw new Error('In Script');
@@ -125,25 +125,26 @@ export class ConversationFeature {
125
125
  if (this.coordinatorsBySource[sourceId]) {
126
126
  return this.coordinatorsBySource[sourceId];
127
127
  }
128
- this.coordinatorsBySource[sourceId] = ConversationCoordinator.Coordinator({
129
- topicLookupPath: this.skill.activeDir,
130
- getContext: () => this.skill.getContext(),
131
- sendMessageHandler: (message) => __awaiter(this, void 0, void 0, function* () {
132
- try {
133
- const { target } = message, values = __rest(message, ["target"]);
134
- const results = yield client.emit('send-message::v2020_12_25', {
135
- target,
136
- payload: {
137
- message: values,
138
- },
139
- });
140
- eventResponseUtil.getFirstResponseOrThrow(results);
141
- }
142
- catch (err) {
143
- this.log.error(err.message);
144
- }
145
- }),
146
- });
128
+ this.coordinatorsBySource[sourceId] =
129
+ ConversationCoordinator.Coordinator({
130
+ topicLookupPath: this.skill.activeDir,
131
+ getContext: () => this.skill.getContext(),
132
+ sendMessageHandler: (message) => __awaiter(this, void 0, void 0, function* () {
133
+ try {
134
+ const { target } = message, values = __rest(message, ["target"]);
135
+ const results = yield client.emit('send-message::v2020_12_25', {
136
+ target,
137
+ payload: {
138
+ message: values,
139
+ },
140
+ });
141
+ eventResponseUtil.getFirstResponseOrThrow(results);
142
+ }
143
+ catch (err) {
144
+ this.log.error(err.message);
145
+ }
146
+ }),
147
+ });
147
148
  return this.coordinatorsBySource[sourceId];
148
149
  });
149
150
  }
@@ -158,7 +159,11 @@ export class ConversationFeature {
158
159
  });
159
160
  if (topics.length > 0) {
160
161
  this.log.info(`Registering new ${topics.length} topic${topics.length === 1 ? '' : 's'}.`);
161
- const results = yield client.emit(`register-conversation-topics::v2020_12_25`, { payload: { topics: topics.map((topic) => ({ key: topic.key })) } });
162
+ const results = yield client.emit(`register-conversation-topics::v2020_12_25`, {
163
+ payload: {
164
+ topics: topics.map((topic) => ({ key: topic.key })),
165
+ },
166
+ });
162
167
  eventResponseUtil.getFirstResponseOrThrow(results);
163
168
  this.log.info('Topics now in sync.');
164
169
  }
@@ -18,7 +18,10 @@ export default class AbstractGraphicsInterfaceTest extends AbstractConversationT
18
18
  yield _super.beforeEach.call(this);
19
19
  this.sentMessages = [];
20
20
  this.ui = new MessageGraphicsInterface({
21
- invalidValueRepairs: ['invalid-value-repair', 'invalid-value-repair2'],
21
+ invalidValueRepairs: [
22
+ 'invalid-value-repair',
23
+ 'invalid-value-repair2',
24
+ ],
22
25
  sendMessageHandler: (message) => __awaiter(this, void 0, void 0, function* () {
23
26
  this.sentMessages.push(message);
24
27
  }),
@@ -17,7 +17,8 @@ import randomUtil from '../utilities/random.utility.js';
17
17
  export default class ScriptTester {
18
18
  constructor(topics, getContext, writeHandler, selectPromptHandler, promptHandler, lineDelay, shouldPlayReplayAfterFinish) {
19
19
  this.isDestroyed = false;
20
- this.writeHandler = writeHandler !== null && writeHandler !== void 0 ? writeHandler : ((message) => console.log(message.body));
20
+ this.writeHandler =
21
+ writeHandler !== null && writeHandler !== void 0 ? writeHandler : ((message) => console.log(message.body));
21
22
  this.getContext = getContext;
22
23
  this.topics = topics;
23
24
  this.selectPromptHandler =
@@ -57,7 +58,6 @@ export default class ScriptTester {
57
58
  });
58
59
  }
59
60
  yield this.reportOnConfidence(msg);
60
- // eslint-disable-next-line no-constant-condition
61
61
  while (true) {
62
62
  if (this.isDestroyed) {
63
63
  return;
@@ -68,10 +68,14 @@ export default class ScriptTester {
68
68
  }
69
69
  if (response === null || response === void 0 ? void 0 : response.transitionConversationTo) {
70
70
  if (response.topicChangers) {
71
- this.writeHandler({ body: randomUtil.rand(response.topicChangers) });
71
+ this.writeHandler({
72
+ body: randomUtil.rand(response.topicChangers),
73
+ });
72
74
  }
73
75
  else if (response.repairs) {
74
- this.writeHandler({ body: randomUtil.rand(response.repairs) });
76
+ this.writeHandler({
77
+ body: randomUtil.rand(response.repairs),
78
+ });
75
79
  }
76
80
  this.writeHandler({
77
81
  body: generateTransitionMessage(response.transitionConversationTo),
@@ -91,7 +95,9 @@ export default class ScriptTester {
91
95
  reportOnConfidence(msg) {
92
96
  return __awaiter(this, void 0, void 0, function* () {
93
97
  if (!this.suggester) {
94
- this.suggester = yield TopicSuggester.Suggester({ topics: this.topics });
98
+ this.suggester = yield TopicSuggester.Suggester({
99
+ topics: this.topics,
100
+ });
95
101
  }
96
102
  const suggestions = yield this.suggester.suggest(msg);
97
103
  if (suggestions.length > 0) {
@@ -142,7 +148,10 @@ export default class ScriptTester {
142
148
  missing.push('script');
143
149
  }
144
150
  if (missing.length > 0) {
145
- throw new SchemaError({ code: 'MISSING_PARAMETERS', parameters: missing });
151
+ throw new SchemaError({
152
+ code: 'MISSING_PARAMETERS',
153
+ parameters: missing,
154
+ });
146
155
  }
147
156
  return new ScriptTester(options.topics, options.getContext, options.writeHandler, options.selectPromptHandler, options.promptHandler, options.lineDelay, options.shouldPlayReplayAfterFinish);
148
157
  });
@@ -157,7 +166,10 @@ const inquirerSelectPromptHandler = (message) => __awaiter(void 0, void 0, void
157
166
  type: 'list',
158
167
  name: 'select',
159
168
  message: message.body,
160
- choices: (_a = message.choices) === null || _a === void 0 ? void 0 : _a.map((c) => ({ name: c.label, value: c.value })),
169
+ choices: (_a = message.choices) === null || _a === void 0 ? void 0 : _a.map((c) => ({
170
+ name: c.label,
171
+ value: c.value,
172
+ })),
161
173
  });
162
174
  return answer.select;
163
175
  });
@@ -29,7 +29,9 @@ export default class TopicLoader {
29
29
  }
30
30
  static loadTopic(match) {
31
31
  const imported = require(match);
32
- const file = pathUtil.basename(match).replace(pathUtil.extname(match), '');
32
+ const file = pathUtil
33
+ .basename(match)
34
+ .replace(pathUtil.extname(match), '');
33
35
  const key = file.split('.')[0];
34
36
  if (!imported || !imported.default) {
35
37
  throw new SpruceError({
@@ -117,7 +117,8 @@ export class TopicScriptPlayer {
117
117
  do {
118
118
  yield new Promise((resolve) => setTimeout(resolve, 10));
119
119
  done =
120
- ((_a = this.runningLine) === null || _a === void 0 ? void 0 : _a.isDone) || this.graphicsInterface.isWaitingForInput();
120
+ ((_a = this.runningLine) === null || _a === void 0 ? void 0 : _a.isDone) ||
121
+ this.graphicsInterface.isWaitingForInput();
121
122
  } while (!done);
122
123
  }
123
124
  if (this.runningLine.isDone) {
@@ -23,7 +23,11 @@ export class TopicSuggester {
23
23
  const container = containerBootstrap();
24
24
  container.use(LangEn);
25
25
  container.use(NluNeural);
26
- const manager = new NluManager({ container, locales: ['en'], log: false });
26
+ const manager = new NluManager({
27
+ container,
28
+ locales: ['en'],
29
+ log: false,
30
+ });
27
31
  for (const topic of options.topics) {
28
32
  manager.assignDomain('en', topic.key, topic.key);
29
33
  for (const utterance of topic.utterances) {
@@ -10,17 +10,15 @@ export type SendMessage = SpruceSchemas.Spruce.v2020_07_22.SendMessage;
10
10
  export type SendMessageHandler = (message: SendMessage) => Promise<void>;
11
11
  export type DidMessageResponsePayloadSchema = SkillEventContract['eventSignatures']['did-message::v2020_12_25']['responsePayloadSchema'];
12
12
  export type DidMessageResponsePayload = SchemaValues<DidMessageResponsePayloadSchema>;
13
- export type ScriptLineCallbackOptions = {
13
+ export interface ScriptLineCallbackOptions {
14
14
  ui: GraphicsInterface;
15
15
  state: Record<string, any>;
16
16
  rand<T>(possibilities: T[]): T;
17
17
  message: Message;
18
18
  context: SkillContext;
19
- };
20
- export type ScriptLine = string | ScriptLineCallback | string[];
21
- export interface ScriptLineCallback {
22
- (options: ScriptLineCallbackOptions): Promise<void | DidMessageResponsePayload>;
23
19
  }
20
+ export type ScriptLine = string | ScriptLineCallback | string[];
21
+ export type ScriptLineCallback = (options: ScriptLineCallbackOptions) => Promise<void | DidMessageResponsePayload>;
24
22
  export type Script = ScriptLine[];
25
23
  export interface ScriptPlayerOptions {
26
24
  script: Script;
@@ -30,10 +28,10 @@ export interface ScriptPlayerOptions {
30
28
  graphicsInterface?: MessageGraphicsInterface;
31
29
  getContext: () => SkillContext;
32
30
  }
33
- export type ScriptPlayerSendMessage = {
31
+ export interface ScriptPlayerSendMessage {
34
32
  body: string;
35
33
  choices?: Message['choices'];
36
- };
34
+ }
37
35
  export declare const suggestedConversationTopicSchema: {
38
36
  id: string;
39
37
  fields: {
@@ -78,6 +76,4 @@ export interface FieldHandlerOptions<D extends FieldDefinitions = FieldDefinitio
78
76
  waitForNextMessageHandler: () => Promise<string>;
79
77
  definition: D;
80
78
  }
81
- export interface FieldHandler<F extends FieldDefinitions = FieldDefinitions> {
82
- (options: FieldHandlerOptions<F>): Promise<any>;
83
- }
79
+ export type FieldHandler<F extends FieldDefinitions = FieldDefinitions> = (options: FieldHandlerOptions<F>) => Promise<any>;
@@ -1,7 +1,7 @@
1
- type Suggestion = {
1
+ interface Suggestion {
2
2
  key: string;
3
3
  score: number;
4
- };
4
+ }
5
5
  declare const suggesterUtil: {
6
6
  rank(possibilities: {
7
7
  key: string;
@@ -111,25 +111,26 @@ class ConversationFeature {
111
111
  if (this.coordinatorsBySource[sourceId]) {
112
112
  return this.coordinatorsBySource[sourceId];
113
113
  }
114
- this.coordinatorsBySource[sourceId] = ConversationCoordinator_1.ConversationCoordinator.Coordinator({
115
- topicLookupPath: this.skill.activeDir,
116
- getContext: () => this.skill.getContext(),
117
- sendMessageHandler: async (message) => {
118
- try {
119
- const { target } = message, values = __rest(message, ["target"]);
120
- const results = await client.emit('send-message::v2020_12_25', {
121
- target,
122
- payload: {
123
- message: values,
124
- },
125
- });
126
- spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
127
- }
128
- catch (err) {
129
- this.log.error(err.message);
130
- }
131
- },
132
- });
114
+ this.coordinatorsBySource[sourceId] =
115
+ ConversationCoordinator_1.ConversationCoordinator.Coordinator({
116
+ topicLookupPath: this.skill.activeDir,
117
+ getContext: () => this.skill.getContext(),
118
+ sendMessageHandler: async (message) => {
119
+ try {
120
+ const { target } = message, values = __rest(message, ["target"]);
121
+ const results = await client.emit('send-message::v2020_12_25', {
122
+ target,
123
+ payload: {
124
+ message: values,
125
+ },
126
+ });
127
+ spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
128
+ }
129
+ catch (err) {
130
+ this.log.error(err.message);
131
+ }
132
+ },
133
+ });
133
134
  return this.coordinatorsBySource[sourceId];
134
135
  }
135
136
  async syncTopics() {
@@ -142,7 +143,11 @@ class ConversationFeature {
142
143
  });
143
144
  if (topics.length > 0) {
144
145
  this.log.info(`Registering new ${topics.length} topic${topics.length === 1 ? '' : 's'}.`);
145
- const results = await client.emit(`register-conversation-topics::v2020_12_25`, { payload: { topics: topics.map((topic) => ({ key: topic.key })) } });
146
+ const results = await client.emit(`register-conversation-topics::v2020_12_25`, {
147
+ payload: {
148
+ topics: topics.map((topic) => ({ key: topic.key })),
149
+ },
150
+ });
146
151
  spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
147
152
  this.log.info('Topics now in sync.');
148
153
  }
@@ -10,7 +10,10 @@ class AbstractGraphicsInterfaceTest extends AbstractConversationTest_1.default {
10
10
  await super.beforeEach();
11
11
  this.sentMessages = [];
12
12
  this.ui = new MessageGraphicsInterface_1.default({
13
- invalidValueRepairs: ['invalid-value-repair', 'invalid-value-repair2'],
13
+ invalidValueRepairs: [
14
+ 'invalid-value-repair',
15
+ 'invalid-value-repair2',
16
+ ],
14
17
  sendMessageHandler: async (message) => {
15
18
  this.sentMessages.push(message);
16
19
  },
@@ -14,7 +14,8 @@ const random_utility_1 = __importDefault(require("../utilities/random.utility"))
14
14
  class ScriptTester {
15
15
  constructor(topics, getContext, writeHandler, selectPromptHandler, promptHandler, lineDelay, shouldPlayReplayAfterFinish) {
16
16
  this.isDestroyed = false;
17
- this.writeHandler = writeHandler !== null && writeHandler !== void 0 ? writeHandler : ((message) => console.log(message.body));
17
+ this.writeHandler =
18
+ writeHandler !== null && writeHandler !== void 0 ? writeHandler : ((message) => console.log(message.body));
18
19
  this.getContext = getContext;
19
20
  this.topics = topics;
20
21
  this.selectPromptHandler =
@@ -53,7 +54,6 @@ class ScriptTester {
53
54
  });
54
55
  }
55
56
  await this.reportOnConfidence(msg);
56
- // eslint-disable-next-line no-constant-condition
57
57
  while (true) {
58
58
  if (this.isDestroyed) {
59
59
  return;
@@ -64,10 +64,14 @@ class ScriptTester {
64
64
  }
65
65
  if (response === null || response === void 0 ? void 0 : response.transitionConversationTo) {
66
66
  if (response.topicChangers) {
67
- this.writeHandler({ body: random_utility_1.default.rand(response.topicChangers) });
67
+ this.writeHandler({
68
+ body: random_utility_1.default.rand(response.topicChangers),
69
+ });
68
70
  }
69
71
  else if (response.repairs) {
70
- this.writeHandler({ body: random_utility_1.default.rand(response.repairs) });
72
+ this.writeHandler({
73
+ body: random_utility_1.default.rand(response.repairs),
74
+ });
71
75
  }
72
76
  this.writeHandler({
73
77
  body: generateTransitionMessage(response.transitionConversationTo),
@@ -85,7 +89,9 @@ class ScriptTester {
85
89
  }
86
90
  async reportOnConfidence(msg) {
87
91
  if (!this.suggester) {
88
- this.suggester = await TopicSuggester_1.TopicSuggester.Suggester({ topics: this.topics });
92
+ this.suggester = await TopicSuggester_1.TopicSuggester.Suggester({
93
+ topics: this.topics,
94
+ });
89
95
  }
90
96
  const suggestions = await this.suggester.suggest(msg);
91
97
  if (suggestions.length > 0) {
@@ -130,7 +136,10 @@ class ScriptTester {
130
136
  missing.push('script');
131
137
  }
132
138
  if (missing.length > 0) {
133
- throw new schema_1.SchemaError({ code: 'MISSING_PARAMETERS', parameters: missing });
139
+ throw new schema_1.SchemaError({
140
+ code: 'MISSING_PARAMETERS',
141
+ parameters: missing,
142
+ });
134
143
  }
135
144
  return new ScriptTester(options.topics, options.getContext, options.writeHandler, options.selectPromptHandler, options.promptHandler, options.lineDelay, options.shouldPlayReplayAfterFinish);
136
145
  }
@@ -146,7 +155,10 @@ const inquirerSelectPromptHandler = async (message) => {
146
155
  type: 'list',
147
156
  name: 'select',
148
157
  message: message.body,
149
- choices: (_a = message.choices) === null || _a === void 0 ? void 0 : _a.map((c) => ({ name: c.label, value: c.value })),
158
+ choices: (_a = message.choices) === null || _a === void 0 ? void 0 : _a.map((c) => ({
159
+ name: c.label,
160
+ value: c.value,
161
+ })),
150
162
  });
151
163
  return answer.select;
152
164
  };
@@ -23,7 +23,9 @@ class TopicLoader {
23
23
  }
24
24
  static loadTopic(match) {
25
25
  const imported = require(match);
26
- const file = path_1.default.basename(match).replace(path_1.default.extname(match), '');
26
+ const file = path_1.default
27
+ .basename(match)
28
+ .replace(path_1.default.extname(match), '');
27
29
  const key = file.split('.')[0];
28
30
  if (!imported || !imported.default) {
29
31
  throw new SpruceError_1.default({
@@ -105,7 +105,8 @@ class TopicScriptPlayer {
105
105
  do {
106
106
  await new Promise((resolve) => setTimeout(resolve, 10));
107
107
  done =
108
- ((_a = this.runningLine) === null || _a === void 0 ? void 0 : _a.isDone) || this.graphicsInterface.isWaitingForInput();
108
+ ((_a = this.runningLine) === null || _a === void 0 ? void 0 : _a.isDone) ||
109
+ this.graphicsInterface.isWaitingForInput();
109
110
  } while (!done);
110
111
  }
111
112
  if (this.runningLine.isDone) {
@@ -16,7 +16,11 @@ class TopicSuggester {
16
16
  const container = (0, core_1.containerBootstrap)();
17
17
  container.use(lang_en_1.LangEn);
18
18
  container.use(nlu_1.NluNeural);
19
- const manager = new nlu_1.NluManager({ container, locales: ['en'], log: false });
19
+ const manager = new nlu_1.NluManager({
20
+ container,
21
+ locales: ['en'],
22
+ log: false,
23
+ });
20
24
  for (const topic of options.topics) {
21
25
  manager.assignDomain('en', topic.key, topic.key);
22
26
  for (const utterance of topic.utterances) {
@@ -10,17 +10,15 @@ export type SendMessage = SpruceSchemas.Spruce.v2020_07_22.SendMessage;
10
10
  export type SendMessageHandler = (message: SendMessage) => Promise<void>;
11
11
  export type DidMessageResponsePayloadSchema = SkillEventContract['eventSignatures']['did-message::v2020_12_25']['responsePayloadSchema'];
12
12
  export type DidMessageResponsePayload = SchemaValues<DidMessageResponsePayloadSchema>;
13
- export type ScriptLineCallbackOptions = {
13
+ export interface ScriptLineCallbackOptions {
14
14
  ui: GraphicsInterface;
15
15
  state: Record<string, any>;
16
16
  rand<T>(possibilities: T[]): T;
17
17
  message: Message;
18
18
  context: SkillContext;
19
- };
20
- export type ScriptLine = string | ScriptLineCallback | string[];
21
- export interface ScriptLineCallback {
22
- (options: ScriptLineCallbackOptions): Promise<void | DidMessageResponsePayload>;
23
19
  }
20
+ export type ScriptLine = string | ScriptLineCallback | string[];
21
+ export type ScriptLineCallback = (options: ScriptLineCallbackOptions) => Promise<void | DidMessageResponsePayload>;
24
22
  export type Script = ScriptLine[];
25
23
  export interface ScriptPlayerOptions {
26
24
  script: Script;
@@ -30,10 +28,10 @@ export interface ScriptPlayerOptions {
30
28
  graphicsInterface?: MessageGraphicsInterface;
31
29
  getContext: () => SkillContext;
32
30
  }
33
- export type ScriptPlayerSendMessage = {
31
+ export interface ScriptPlayerSendMessage {
34
32
  body: string;
35
33
  choices?: Message['choices'];
36
- };
34
+ }
37
35
  export declare const suggestedConversationTopicSchema: {
38
36
  id: string;
39
37
  fields: {
@@ -78,6 +76,4 @@ export interface FieldHandlerOptions<D extends FieldDefinitions = FieldDefinitio
78
76
  waitForNextMessageHandler: () => Promise<string>;
79
77
  definition: D;
80
78
  }
81
- export interface FieldHandler<F extends FieldDefinitions = FieldDefinitions> {
82
- (options: FieldHandlerOptions<F>): Promise<any>;
83
- }
79
+ export type FieldHandler<F extends FieldDefinitions = FieldDefinitions> = (options: FieldHandlerOptions<F>) => Promise<any>;
@@ -1,7 +1,7 @@
1
- type Suggestion = {
1
+ interface Suggestion {
2
2
  key: string;
3
3
  score: number;
4
- };
4
+ }
5
5
  declare const suggesterUtil: {
6
6
  rank(possibilities: {
7
7
  key: string;
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "@types/inquirer"
13
13
  ]
14
14
  },
15
- "version": "62.0.1",
15
+ "version": "62.0.3",
16
16
  "files": [
17
17
  "build/**/*",
18
18
  "!build/__tests__",
@@ -59,43 +59,41 @@
59
59
  "post.watch.build": "yarn run build.copy-files && yarn run build.resolve-paths",
60
60
  "spruce.upgrade": "spruce upgrade",
61
61
  "watch.build.dev": "tsc-watch --sourceMap --onCompilationComplete 'yarn post.watch.build'",
62
- "watch.lint": "concurrently 'yarn run lint' \"chokidar 'src/**/*' -c 'yarn run lint.tsc'\"",
63
62
  "watch.rebuild": "yarn run clean.all && yarn install && yarn run watch.build.dev",
64
63
  "watch.tsc": "tsc -w",
65
64
  "lint.tsc": "tsc -p . --noEmit"
66
65
  },
67
66
  "dependencies": {
68
67
  "@nlpjs/nlu": "^4.27.0",
69
- "@sprucelabs/error": "^6.0.3",
70
- "@sprucelabs/globby": "^2.0.3",
71
- "@sprucelabs/mercury-core-events": "^24.0.2",
72
- "@sprucelabs/schema": "^30.0.4",
73
- "@sprucelabs/spruce-core-schemas": "^40.0.2",
74
- "@sprucelabs/spruce-event-plugin": "^62.0.1",
75
- "@sprucelabs/spruce-event-utils": "^40.0.2",
76
- "@sprucelabs/spruce-skill-booter": "^62.0.1",
77
- "@sprucelabs/spruce-skill-utils": "^31.0.5",
78
- "@sprucelabs/spruce-test-fixtures": "^62.0.1",
68
+ "@sprucelabs/error": "^6.0.13",
69
+ "@sprucelabs/globby": "^2.0.11",
70
+ "@sprucelabs/mercury-core-events": "^24.0.8",
71
+ "@sprucelabs/schema": "^30.0.17",
72
+ "@sprucelabs/spruce-core-schemas": "^40.0.13",
73
+ "@sprucelabs/spruce-event-plugin": "^62.0.3",
74
+ "@sprucelabs/spruce-event-utils": "^40.0.13",
75
+ "@sprucelabs/spruce-skill-booter": "^62.0.3",
76
+ "@sprucelabs/spruce-skill-utils": "^31.0.17",
77
+ "@sprucelabs/spruce-test-fixtures": "^62.0.3",
79
78
  "fuzzyset": "^1.0.7",
80
79
  "inquirer": "^8.2.4",
81
80
  "node-nlp": "^4.27.0",
82
81
  "random": "^4.1.0"
83
82
  },
84
83
  "devDependencies": {
85
- "@sprucelabs/esm-postbuild": "^6.0.3",
86
- "@sprucelabs/jest-json-reporter": "^8.0.1",
87
- "@sprucelabs/mercury-client": "^42.0.3",
88
- "@sprucelabs/resolve-path-aliases": "^2.0.5",
84
+ "@sprucelabs/esm-postbuild": "^6.0.12",
85
+ "@sprucelabs/jest-json-reporter": "^8.0.15",
86
+ "@sprucelabs/mercury-client": "^42.0.13",
87
+ "@sprucelabs/resolve-path-aliases": "^2.0.14",
89
88
  "@sprucelabs/semantic-release": "^5.0.1",
90
- "@sprucelabs/test": "^9.0.4",
91
- "@sprucelabs/test-utils": "^5.0.3",
89
+ "@sprucelabs/test": "^9.0.10",
90
+ "@sprucelabs/test-utils": "^5.0.12",
92
91
  "@types/fuzzyset": "^1.0.7",
93
92
  "@types/inquirer": "^8.2.1",
94
93
  "@types/node": "17.0.5",
95
94
  "chokidar-cli": "^3.0.0",
96
- "concurrently": "^8.2.2",
97
- "eslint": "^9.0.0",
98
- "eslint-config-spruce": "^11.2.7",
95
+ "eslint": "^9.1.1",
96
+ "eslint-config-spruce": "^11.2.14",
99
97
  "jest": "^29.7.0",
100
98
  "jest-circus": "^29.7.0",
101
99
  "prettier": "^3.2.5",
@@ -121,5 +119,5 @@
121
119
  "^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
122
120
  }
123
121
  },
124
- "gitHead": "611e0486870e0121549bddb4a086a3c388b2e02d"
122
+ "gitHead": "cd2ddfd22a6c237cb6b20f085967f5df56623e78"
125
123
  }