@chatbotkit/cli 1.28.0 → 1.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,6 +9,20 @@
9
9
 
10
10
  A powerful command-line interface for ChatBotKit that provides both API management commands and an autonomous AI agent mode for interactive development tasks.
11
11
 
12
+ ## Why ChatBotKit?
13
+
14
+ **Build lighter, future-proof AI agents.** When you build with ChatBotKit, the heavy lifting happens on our servers—not in your application. This architectural advantage delivers:
15
+
16
+ - 🪶 **Lightweight Agents**: Your agents stay lean because complex AI processing, model orchestration, and tool execution happen server-side. Less code in your app means faster load times and simpler maintenance.
17
+
18
+ - 🛡️ **Robust & Streamlined**: Server-side processing provides a more reliable experience with built-in error handling, automatic retries, and consistent behavior across all platforms.
19
+
20
+ - 🔄 **Backward & Forward Compatible**: As AI technology evolves—new models, new capabilities, new paradigms—your agents automatically benefit. No code changes required on your end.
21
+
22
+ - 🔮 **Future-Proof**: Agents you build today will remain capable tomorrow. When we add support for new AI models or capabilities, your existing agents gain those powers without any updates to your codebase.
23
+
24
+ This means you can focus on building great user experiences while ChatBotKit handles the complexity of the ever-changing AI landscape.
25
+
12
26
  ## Installation
13
27
 
14
28
  Install globally via npm:
@@ -80,15 +80,24 @@ function getClient() {
80
80
  exports.command = new commander_1.Command()
81
81
  .name('agent')
82
82
  .description('Run an agent as a background worker with a prompt')
83
+ .addOption(new commander_1.Option('-a, --agent <agent>', 'Path to an agent markdown file'))
83
84
  .addOption(new commander_1.Option('-b, --bot <bot>', 'Bot id'))
84
85
  .addOption(new commander_1.Option('-m, --model <model>', 'Model name'))
86
+ .addOption(new commander_1.Option('--skillset <skillset>', 'Skillset id'))
87
+ .addOption(new commander_1.Option('--dataset <dataset>', 'Dataset id'))
85
88
  .addOption(new commander_1.Option('-p, --prompt <prompt>', 'The prompt to execute (or path to a file containing the prompt)').makeOptionMandatory())
86
89
  .addOption(new commander_1.Option('-t, --tools <tools...>', 'Specific tools to enable').choices((0, tools_js_1.getToolNames)()))
90
+ .addOption(new commander_1.Option('-s, --skills <dirs...>', 'Directories to load skills from'))
87
91
  .addOption(new commander_1.Option('-i, --max-iterations <maxIterations>', 'Maximum number of iterations')
88
- .default(50)
92
+ .default(100)
89
93
  .argParser((value) => parseInt(value, 10)))
94
+ .addOption(new commander_1.Option('-d, --debug', 'Print raw stream items to stderr'))
90
95
  .action(async (options) => {
91
96
  const client = getClient();
97
+ const agentDef = options.agent ? await (0, agent_1.loadAgent)(options.agent) : null;
98
+ const { skills, close: closeSkills } = options.skills
99
+ ? await (0, agent_1.loadSkills)(options.skills, { watch: false })
100
+ : { skills: [], close: () => { } };
92
101
  const tools = (0, tools_js_1.getTools)(options.tools);
93
102
  let prompt = options.prompt;
94
103
  {
@@ -109,17 +118,33 @@ exports.command = new commander_1.Command()
109
118
  let hasOutput = false;
110
119
  for await (const { type, data } of (0, agent_1.execute)({
111
120
  client,
112
- botId: options.bot,
113
- model: options.model,
121
+ ...(options.bot
122
+ ? { botId: options.bot }
123
+ : agentDef?.botId
124
+ ? { botId: agentDef.botId }
125
+ : { model: options.model ?? agentDef?.model }),
126
+ ...(agentDef?.backstory ? { backstory: agentDef.backstory } : {}),
127
+ ...(options.skillset ?? agentDef?.skillsetId
128
+ ? { skillsetId: options.skillset ?? agentDef?.skillsetId }
129
+ : {}),
130
+ ...(options.dataset ?? agentDef?.datasetId
131
+ ? { datasetId: options.dataset ?? agentDef?.datasetId }
132
+ : {}),
114
133
  messages: [{ type: 'user', text: prompt }],
115
134
  tools,
116
135
  maxIterations: options.maxIterations,
136
+ ...(skills.length > 0
137
+ ? { extensions: { features: [(0, agent_1.createSkillsFeature)(skills)] } }
138
+ : {}),
117
139
  })) {
140
+ if (options.debug) {
141
+ process.stderr.write(`[debug] ${JSON.stringify({ type, data })}\n`);
142
+ }
118
143
  if (type === 'iteration') {
119
144
  if (isInteractive) {
120
145
  const iterationNum = data.iteration - 1;
121
146
  output.writeLine((0, color_js_1.formatBlue)(`\n╭─ Iteration ${iterationNum} ─╮`));
122
- if (spinner) {
147
+ if (spinner && !options.debug) {
123
148
  spinner.start();
124
149
  }
125
150
  }
@@ -135,7 +160,7 @@ exports.command = new commander_1.Command()
135
160
  status: 'running',
136
161
  args: data.args,
137
162
  });
138
- if (spinner) {
163
+ if (spinner && !options.debug) {
139
164
  spinner.start();
140
165
  }
141
166
  }
@@ -145,7 +170,7 @@ exports.command = new commander_1.Command()
145
170
  status: 'completed',
146
171
  result: data.result,
147
172
  });
148
- if (spinner) {
173
+ if (spinner && !options.debug) {
149
174
  spinner.start();
150
175
  }
151
176
  }
@@ -155,7 +180,7 @@ exports.command = new commander_1.Command()
155
180
  status: 'error',
156
181
  error: data.error,
157
182
  });
158
- if (spinner) {
183
+ if (spinner && !options.debug) {
159
184
  spinner.start();
160
185
  }
161
186
  }
@@ -181,6 +206,7 @@ exports.command = new commander_1.Command()
181
206
  }
182
207
  }
183
208
  }
209
+ closeSkills();
184
210
  if (exitResult) {
185
211
  output.printStructured({
186
212
  status: exitResult.code === 0 ? 'success' : 'failed',
@@ -12,9 +12,10 @@ const index_js_6 = tslib_1.__importDefault(require("./file/index.cjs"));
12
12
  const index_js_7 = tslib_1.__importDefault(require("./integration/index.cjs"));
13
13
  const index_js_8 = tslib_1.__importDefault(require("./memory/index.cjs"));
14
14
  const index_js_9 = tslib_1.__importDefault(require("./partner/index.cjs"));
15
- const index_js_10 = tslib_1.__importDefault(require("./secret/index.cjs"));
16
- const index_js_11 = tslib_1.__importDefault(require("./skillset/index.cjs"));
17
- const index_js_12 = tslib_1.__importDefault(require("./team/index.cjs"));
15
+ const index_js_10 = tslib_1.__importDefault(require("./platform/index.cjs"));
16
+ const index_js_11 = tslib_1.__importDefault(require("./secret/index.cjs"));
17
+ const index_js_12 = tslib_1.__importDefault(require("./skillset/index.cjs"));
18
+ const index_js_13 = tslib_1.__importDefault(require("./team/index.cjs"));
18
19
  const commander_1 = require("commander");
19
20
  const commands = {
20
21
  blueprint: index_js_1.default,
@@ -26,9 +27,10 @@ const commands = {
26
27
  integration: index_js_7.default,
27
28
  memory: index_js_8.default,
28
29
  partner: index_js_9.default,
29
- secret: index_js_10.default,
30
- skillset: index_js_11.default,
31
- team: index_js_12.default,
30
+ platform: index_js_10.default,
31
+ secret: index_js_11.default,
32
+ skillset: index_js_12.default,
33
+ team: index_js_13.default,
32
34
  };
33
35
  exports.command = new commander_1.Command()
34
36
  .name('api')
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const index_js_1 = tslib_1.__importDefault(require("./model/index.cjs"));
6
+ const commander_1 = require("commander");
7
+ const commands = {
8
+ model: index_js_1.default,
9
+ };
10
+ exports.command = new commander_1.Command()
11
+ .name('platform')
12
+ .description('Platform tools for ChatBotKit');
13
+ for (const cmd of Object.values(commands)) {
14
+ exports.command.addCommand(cmd);
15
+ }
16
+ exports.default = exports.command;
@@ -0,0 +1,3 @@
1
+ export const command: Command;
2
+ export default command;
3
+ import { Command } from 'commander';
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = exports.modelList = void 0;
4
+ const env_js_1 = require("../../../../env.cjs");
5
+ const output_js_1 = require("../../../../output.cjs");
6
+ const index_js_1 = require("@chatbotkit/sdk/platform/model/index.js");
7
+ const commander_1 = require("commander");
8
+ function getClient() {
9
+ return new index_js_1.PlatformModelClient({
10
+ secret: (0, env_js_1.getSECRET)(),
11
+ runAsUserId: (0, env_js_1.getRUNAS_USERID)(),
12
+ });
13
+ }
14
+ exports.modelList = new commander_1.Command()
15
+ .name('list')
16
+ .description('List platform models')
17
+ .option('-s, --stream', 'Stream models')
18
+ .action(async (str, options) => {
19
+ const { stream } = options;
20
+ const client = getClient();
21
+ if (stream) {
22
+ for await (const model of client.list().stream()) {
23
+ (0, output_js_1.print)(model);
24
+ }
25
+ }
26
+ else {
27
+ const { items } = await client.list();
28
+ for (const model of items) {
29
+ (0, output_js_1.print)(model);
30
+ }
31
+ }
32
+ });
33
+ const commands = {
34
+ list: exports.modelList,
35
+ };
36
+ exports.command = new commander_1.Command()
37
+ .name('model')
38
+ .description('Model tools for ChatBotKit platform');
39
+ for (const cmd of Object.values(commands)) {
40
+ exports.command.addCommand(cmd);
41
+ }
42
+ exports.default = exports.command;
@@ -0,0 +1,4 @@
1
+ export const modelList: Command;
2
+ export const command: Command;
3
+ export default command;
4
+ import { Command } from 'commander';
@@ -18,15 +18,29 @@ function getClient() {
18
18
  exports.command = new commander_1.Command()
19
19
  .name('chat')
20
20
  .description('Start a chat session')
21
+ .addOption(new commander_1.Option('-a, --agent <agent>', 'Path to an agent markdown file'))
21
22
  .addOption(new commander_1.Option('-b, --bot <bot>', 'Bot id'))
22
23
  .addOption(new commander_1.Option('-m, --model <model>', 'Model name'))
24
+ .addOption(new commander_1.Option('--skillset <skillset>', 'Skillset id'))
25
+ .addOption(new commander_1.Option('--dataset <dataset>', 'Dataset id'))
23
26
  .addOption(new commander_1.Option('-t, --tools <tools...>', 'Specific tools to enable').choices((0, tools_js_1.getToolNames)()))
27
+ .addOption(new commander_1.Option('-s, --skills <dirs...>', 'Directories to load skills from'))
28
+ .addOption(new commander_1.Option('-d, --debug', 'Print raw stream items to stderr'))
24
29
  .action(async (options) => {
25
30
  const client = getClient();
31
+ const agent = options.agent ? await (0, agent_1.loadAgent)(options.agent) : null;
32
+ const { skills, close: closeSkills } = options.skills
33
+ ? await (0, agent_1.loadSkills)(options.skills, { watch: true })
34
+ : { skills: [], close: () => { } };
26
35
  const rl = promises_1.default.createInterface({
27
36
  input: process.stdin,
28
37
  output: process.stdout,
29
38
  });
39
+ rl.on('close', () => {
40
+ process.stdout.write('\n');
41
+ closeSkills();
42
+ process.exit(0);
43
+ });
30
44
  const messages = [];
31
45
  const tools = (0, tools_js_1.getTools)(options.tools);
32
46
  const colors = {
@@ -34,34 +48,131 @@ exports.command = new commander_1.Command()
34
48
  bold: '\x1b[1m',
35
49
  cyan: '\x1b[36m',
36
50
  green: '\x1b[32m',
51
+ dim: '\x1b[2m',
52
+ gray: '\x1b[90m',
37
53
  };
54
+ const effectiveBot = options.bot || agent?.botId;
55
+ const effectiveModel = options.model ?? agent?.model;
56
+ const effectiveSkillset = options.skillset ?? agent?.skillsetId;
57
+ const effectiveDataset = options.dataset ?? agent?.datasetId;
58
+ const effectiveSkills = options.skills;
59
+ const metaLines = [];
60
+ if (agent?.name) {
61
+ metaLines.push(`agent ${agent.name}`);
62
+ }
63
+ if (effectiveBot) {
64
+ metaLines.push(`bot ${effectiveBot}`);
65
+ }
66
+ if (effectiveModel) {
67
+ metaLines.push(`model ${effectiveModel}`);
68
+ }
69
+ if (effectiveSkillset) {
70
+ metaLines.push(`skillset ${effectiveSkillset}`);
71
+ }
72
+ if (effectiveDataset) {
73
+ metaLines.push(`dataset ${effectiveDataset}`);
74
+ }
75
+ if (effectiveSkills) {
76
+ metaLines.push(`skills ${effectiveSkills.join(', ')}`);
77
+ }
78
+ if (metaLines.length > 0) {
79
+ process.stdout.write('\n');
80
+ for (const line of metaLines) {
81
+ process.stdout.write(`${colors.gray} ${line}${colors.reset}\n`);
82
+ }
83
+ }
84
+ process.stdout.write(`\n${colors.gray} shortcuts Ctrl+C re-prompt · Ctrl+C×2 abort response · Ctrl+D exit${colors.reset}\n`);
85
+ let agentAbort = null;
86
+ let promptAbort = null;
87
+ let sigintCount = 0;
88
+ rl.on('SIGINT', () => {
89
+ if (agentAbort) {
90
+ sigintCount++;
91
+ if (sigintCount === 1) {
92
+ process.stdout.write(`\n ${colors.dim}(Press Ctrl+C again to cancel)${colors.reset}\n`);
93
+ }
94
+ else {
95
+ sigintCount = 0;
96
+ agentAbort.abort();
97
+ }
98
+ }
99
+ else {
100
+ process.stdout.write('^C\n');
101
+ promptAbort?.abort();
102
+ }
103
+ });
38
104
  for (;;) {
39
105
  process.stdout.write('\n');
40
- const user = await rl.question(`${colors.cyan}●${colors.reset} ${colors.bold}You${colors.reset}\n\n> `);
41
- messages.push({ type: 'user', text: user });
106
+ promptAbort = new AbortController();
107
+ let text;
108
+ try {
109
+ text = await rl.question(`${colors.cyan}●${colors.reset} ${colors.bold}You${colors.reset}\n\n> `, { signal: promptAbort.signal });
110
+ }
111
+ catch {
112
+ continue;
113
+ }
114
+ finally {
115
+ promptAbort = null;
116
+ }
117
+ text = text?.trim();
118
+ if (!text) {
119
+ continue;
120
+ }
121
+ messages.push({ type: 'user', text: text });
42
122
  process.stdout.write(`\n${colors.green}●${colors.reset} ${colors.bold}Assistant${colors.reset}\n\n `);
43
123
  const spinner = new spinner_js_1.Spinner('');
44
- spinner.start();
124
+ if (!options.debug) {
125
+ spinner.start();
126
+ }
45
127
  let firstToken = true;
46
- for await (const { type, data } of (0, agent_1.complete)({
47
- client,
48
- botId: options.bot,
49
- model: options.model,
50
- messages,
51
- tools,
52
- })) {
53
- if (type === 'token') {
54
- if (firstToken) {
55
- spinner.stop();
56
- firstToken = false;
128
+ sigintCount = 0;
129
+ agentAbort = new AbortController();
130
+ try {
131
+ for await (const item of (0, agent_1.execute)({
132
+ client,
133
+ ...(options.bot
134
+ ? { botId: options.bot }
135
+ : agent?.botId
136
+ ? { botId: agent.botId }
137
+ : { model: options.model ?? agent?.model }),
138
+ ...(agent?.backstory ? { backstory: agent.backstory } : {}),
139
+ ...(options.skillset ?? agent?.skillsetId
140
+ ? { skillsetId: options.skillset ?? agent?.skillsetId }
141
+ : {}),
142
+ ...(options.dataset ?? agent?.datasetId
143
+ ? { datasetId: options.dataset ?? agent?.datasetId }
144
+ : {}),
145
+ messages,
146
+ tools,
147
+ abortSignal: agentAbort.signal,
148
+ ...(skills.length > 0
149
+ ? { extensions: { features: [(0, agent_1.createSkillsFeature)(skills)] } }
150
+ : {}),
151
+ })) {
152
+ const { type, data } = item;
153
+ if (options.debug) {
154
+ process.stderr.write(`${colors.dim}[debug] ${JSON.stringify(item)}${colors.reset}\n`);
155
+ }
156
+ else if (type === 'token') {
157
+ if (firstToken) {
158
+ spinner.stop();
159
+ firstToken = false;
160
+ }
161
+ process.stdout.write(data.token);
162
+ }
163
+ if (type === 'message') {
164
+ messages.push(data);
57
165
  }
58
- process.stdout.write(data.token);
59
- }
60
- else if (type === 'result') {
61
- messages.push({ type: 'bot', text: data.text });
62
166
  }
63
167
  }
64
- spinner.stop();
168
+ catch {
169
+ }
170
+ finally {
171
+ agentAbort = null;
172
+ }
173
+ if (!options.debug) {
174
+ spinner.stop();
175
+ }
65
176
  process.stdout.write('\n');
66
177
  }
67
178
  });
@@ -215,6 +215,7 @@ exports.SlackIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema
215
215
  ratings: zod_1.z.boolean().optional(),
216
216
  visibleMessages: zod_1.z.number().optional(),
217
217
  autoRespond: zod_1.z.string().optional(),
218
+ allowFrom: zod_1.z.string().optional(),
218
219
  }),
219
220
  });
220
221
  exports.DiscordIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema.extend({
@@ -234,6 +235,7 @@ exports.DiscordIntegrationResourceConfigSchema = exports.BasicResourceConfigSche
234
235
  sessionDuration: zod_1.z.number().optional(),
235
236
  attachments: zod_1.z.boolean().optional(),
236
237
  stream: zod_1.z.boolean().optional(),
238
+ allowFrom: zod_1.z.string().optional(),
237
239
  }),
238
240
  });
239
241
  exports.TelegramIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema.extend({
@@ -248,6 +250,7 @@ exports.TelegramIntegrationResourceConfigSchema = exports.BasicResourceConfigSch
248
250
  contactCollection: zod_1.z.boolean().optional(),
249
251
  sessionDuration: zod_1.z.number().optional(),
250
252
  attachments: zod_1.z.boolean().optional(),
253
+ allowFrom: zod_1.z.string().optional(),
251
254
  }),
252
255
  });
253
256
  exports.WhatsAppIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema.extend({
@@ -263,6 +266,7 @@ exports.WhatsAppIntegrationResourceConfigSchema = exports.BasicResourceConfigSch
263
266
  contactCollection: zod_1.z.boolean().optional(),
264
267
  sessionDuration: zod_1.z.number().optional(),
265
268
  attachments: zod_1.z.boolean().optional(),
269
+ allowFrom: zod_1.z.string().optional(),
266
270
  }),
267
271
  });
268
272
  exports.MessengerIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema.extend({
@@ -303,6 +307,7 @@ exports.EmailIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema
303
307
  contactCollection: zod_1.z.boolean().optional(),
304
308
  sessionDuration: zod_1.z.number().optional(),
305
309
  attachments: zod_1.z.boolean().optional(),
310
+ allowFrom: zod_1.z.string().optional(),
306
311
  }),
307
312
  });
308
313
  exports.TriggerIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema.extend({
@@ -326,6 +331,8 @@ exports.TriggerIntegrationResourceConfigSchema = exports.BasicResourceConfigSche
326
331
  ])
327
332
  .optional(),
328
333
  sessionDuration: zod_1.z.number().optional(),
334
+ maxIterations: zod_1.z.number().optional(),
335
+ maxTime: zod_1.z.number().optional(),
329
336
  }),
330
337
  });
331
338
  exports.SupportIntegrationResourceConfigSchema = exports.BasicResourceConfigSchema.extend({
@@ -3,7 +3,7 @@ import { getRUNAS_USERID, getSECRET } from '../../env.js';
3
3
  import { print, printError } from '../../output.js';
4
4
  import { Spinner } from '../../spinner.js';
5
5
  import { getToolNames, getTools } from '../../tools.js';
6
- import { execute } from '@chatbotkit/agent';
6
+ import { createSkillsFeature, execute, loadAgent, loadSkills, } from '@chatbotkit/agent';
7
7
  import { ChatBotKit } from '@chatbotkit/sdk';
8
8
  import { Command, Option } from 'commander';
9
9
  import { existsSync, readFileSync } from 'fs';
@@ -77,15 +77,24 @@ function getClient() {
77
77
  export const command = new Command()
78
78
  .name('agent')
79
79
  .description('Run an agent as a background worker with a prompt')
80
+ .addOption(new Option('-a, --agent <agent>', 'Path to an agent markdown file'))
80
81
  .addOption(new Option('-b, --bot <bot>', 'Bot id'))
81
82
  .addOption(new Option('-m, --model <model>', 'Model name'))
83
+ .addOption(new Option('--skillset <skillset>', 'Skillset id'))
84
+ .addOption(new Option('--dataset <dataset>', 'Dataset id'))
82
85
  .addOption(new Option('-p, --prompt <prompt>', 'The prompt to execute (or path to a file containing the prompt)').makeOptionMandatory())
83
86
  .addOption(new Option('-t, --tools <tools...>', 'Specific tools to enable').choices(getToolNames()))
87
+ .addOption(new Option('-s, --skills <dirs...>', 'Directories to load skills from'))
84
88
  .addOption(new Option('-i, --max-iterations <maxIterations>', 'Maximum number of iterations')
85
- .default(50)
89
+ .default(100)
86
90
  .argParser((value) => parseInt(value, 10)))
91
+ .addOption(new Option('-d, --debug', 'Print raw stream items to stderr'))
87
92
  .action(async (options) => {
88
93
  const client = getClient();
94
+ const agentDef = options.agent ? await loadAgent(options.agent) : null;
95
+ const { skills, close: closeSkills } = options.skills
96
+ ? await loadSkills(options.skills, { watch: false })
97
+ : { skills: [], close: () => { } };
89
98
  const tools = getTools(options.tools);
90
99
  let prompt = options.prompt;
91
100
  {
@@ -106,17 +115,33 @@ export const command = new Command()
106
115
  let hasOutput = false;
107
116
  for await (const { type, data } of execute({
108
117
  client,
109
- botId: options.bot,
110
- model: options.model,
118
+ ...(options.bot
119
+ ? { botId: options.bot }
120
+ : agentDef?.botId
121
+ ? { botId: agentDef.botId }
122
+ : { model: options.model ?? agentDef?.model }),
123
+ ...(agentDef?.backstory ? { backstory: agentDef.backstory } : {}),
124
+ ...(options.skillset ?? agentDef?.skillsetId
125
+ ? { skillsetId: options.skillset ?? agentDef?.skillsetId }
126
+ : {}),
127
+ ...(options.dataset ?? agentDef?.datasetId
128
+ ? { datasetId: options.dataset ?? agentDef?.datasetId }
129
+ : {}),
111
130
  messages: [{ type: 'user', text: prompt }],
112
131
  tools,
113
132
  maxIterations: options.maxIterations,
133
+ ...(skills.length > 0
134
+ ? { extensions: { features: [createSkillsFeature(skills)] } }
135
+ : {}),
114
136
  })) {
137
+ if (options.debug) {
138
+ process.stderr.write(`[debug] ${JSON.stringify({ type, data })}\n`);
139
+ }
115
140
  if (type === 'iteration') {
116
141
  if (isInteractive) {
117
142
  const iterationNum = data.iteration - 1;
118
143
  output.writeLine(formatBlue(`\n╭─ Iteration ${iterationNum} ─╮`));
119
- if (spinner) {
144
+ if (spinner && !options.debug) {
120
145
  spinner.start();
121
146
  }
122
147
  }
@@ -132,7 +157,7 @@ export const command = new Command()
132
157
  status: 'running',
133
158
  args: data.args,
134
159
  });
135
- if (spinner) {
160
+ if (spinner && !options.debug) {
136
161
  spinner.start();
137
162
  }
138
163
  }
@@ -142,7 +167,7 @@ export const command = new Command()
142
167
  status: 'completed',
143
168
  result: data.result,
144
169
  });
145
- if (spinner) {
170
+ if (spinner && !options.debug) {
146
171
  spinner.start();
147
172
  }
148
173
  }
@@ -152,7 +177,7 @@ export const command = new Command()
152
177
  status: 'error',
153
178
  error: data.error,
154
179
  });
155
- if (spinner) {
180
+ if (spinner && !options.debug) {
156
181
  spinner.start();
157
182
  }
158
183
  }
@@ -178,6 +203,7 @@ export const command = new Command()
178
203
  }
179
204
  }
180
205
  }
206
+ closeSkills();
181
207
  if (exitResult) {
182
208
  output.printStructured({
183
209
  status: exitResult.code === 0 ? 'success' : 'failed',
@@ -8,6 +8,7 @@ import file from './file/index.js';
8
8
  import integration from './integration/index.js';
9
9
  import memory from './memory/index.js';
10
10
  import partner from './partner/index.js';
11
+ import platform from './platform/index.js';
11
12
  import secret from './secret/index.js';
12
13
  import skillset from './skillset/index.js';
13
14
  import team from './team/index.js';
@@ -22,6 +23,7 @@ const commands = {
22
23
  integration,
23
24
  memory,
24
25
  partner,
26
+ platform,
25
27
  secret,
26
28
  skillset,
27
29
  team,
@@ -0,0 +1,3 @@
1
+ export const command: Command;
2
+ export default command;
3
+ import { Command } from 'commander';
@@ -0,0 +1,12 @@
1
+ import model from './model/index.js';
2
+ import { Command } from 'commander';
3
+ const commands = {
4
+ model,
5
+ };
6
+ export const command = new Command()
7
+ .name('platform')
8
+ .description('Platform tools for ChatBotKit');
9
+ for (const cmd of Object.values(commands)) {
10
+ command.addCommand(cmd);
11
+ }
12
+ export default command;
@@ -0,0 +1,4 @@
1
+ export const modelList: Command;
2
+ export const command: Command;
3
+ export default command;
4
+ import { Command } from 'commander';
@@ -0,0 +1,39 @@
1
+ import { getRUNAS_USERID, getSECRET } from '../../../../env.js';
2
+ import { print } from '../../../../output.js';
3
+ import { PlatformModelClient } from '@chatbotkit/sdk/platform/model/index.js';
4
+ import { Command } from 'commander';
5
+ function getClient() {
6
+ return new PlatformModelClient({
7
+ secret: getSECRET(),
8
+ runAsUserId: getRUNAS_USERID(),
9
+ });
10
+ }
11
+ export const modelList = new Command()
12
+ .name('list')
13
+ .description('List platform models')
14
+ .option('-s, --stream', 'Stream models')
15
+ .action(async (str, options) => {
16
+ const { stream } = options;
17
+ const client = getClient();
18
+ if (stream) {
19
+ for await (const model of client.list().stream()) {
20
+ print(model);
21
+ }
22
+ }
23
+ else {
24
+ const { items } = await client.list();
25
+ for (const model of items) {
26
+ print(model);
27
+ }
28
+ }
29
+ });
30
+ const commands = {
31
+ list: modelList,
32
+ };
33
+ export const command = new Command()
34
+ .name('model')
35
+ .description('Model tools for ChatBotKit platform');
36
+ for (const cmd of Object.values(commands)) {
37
+ command.addCommand(cmd);
38
+ }
39
+ export default command;
@@ -1,7 +1,7 @@
1
1
  import { getRUNAS_USERID, getSECRET } from '../../env.js';
2
2
  import { Spinner } from '../../spinner.js';
3
3
  import { getToolNames, getTools } from '../../tools.js';
4
- import { complete } from '@chatbotkit/agent';
4
+ import { createSkillsFeature, execute, loadAgent, loadSkills, } from '@chatbotkit/agent';
5
5
  import { ChatBotKit } from '@chatbotkit/sdk';
6
6
  import { Command, Option } from 'commander';
7
7
  import readline from 'readline/promises';
@@ -14,15 +14,29 @@ function getClient() {
14
14
  export const command = new Command()
15
15
  .name('chat')
16
16
  .description('Start a chat session')
17
+ .addOption(new Option('-a, --agent <agent>', 'Path to an agent markdown file'))
17
18
  .addOption(new Option('-b, --bot <bot>', 'Bot id'))
18
19
  .addOption(new Option('-m, --model <model>', 'Model name'))
20
+ .addOption(new Option('--skillset <skillset>', 'Skillset id'))
21
+ .addOption(new Option('--dataset <dataset>', 'Dataset id'))
19
22
  .addOption(new Option('-t, --tools <tools...>', 'Specific tools to enable').choices(getToolNames()))
23
+ .addOption(new Option('-s, --skills <dirs...>', 'Directories to load skills from'))
24
+ .addOption(new Option('-d, --debug', 'Print raw stream items to stderr'))
20
25
  .action(async (options) => {
21
26
  const client = getClient();
27
+ const agent = options.agent ? await loadAgent(options.agent) : null;
28
+ const { skills, close: closeSkills } = options.skills
29
+ ? await loadSkills(options.skills, { watch: true })
30
+ : { skills: [], close: () => { } };
22
31
  const rl = readline.createInterface({
23
32
  input: process.stdin,
24
33
  output: process.stdout,
25
34
  });
35
+ rl.on('close', () => {
36
+ process.stdout.write('\n');
37
+ closeSkills();
38
+ process.exit(0);
39
+ });
26
40
  const messages = [];
27
41
  const tools = getTools(options.tools);
28
42
  const colors = {
@@ -30,34 +44,131 @@ export const command = new Command()
30
44
  bold: '\x1b[1m',
31
45
  cyan: '\x1b[36m',
32
46
  green: '\x1b[32m',
47
+ dim: '\x1b[2m',
48
+ gray: '\x1b[90m',
33
49
  };
50
+ const effectiveBot = options.bot || agent?.botId;
51
+ const effectiveModel = options.model ?? agent?.model;
52
+ const effectiveSkillset = options.skillset ?? agent?.skillsetId;
53
+ const effectiveDataset = options.dataset ?? agent?.datasetId;
54
+ const effectiveSkills = options.skills;
55
+ const metaLines = [];
56
+ if (agent?.name) {
57
+ metaLines.push(`agent ${agent.name}`);
58
+ }
59
+ if (effectiveBot) {
60
+ metaLines.push(`bot ${effectiveBot}`);
61
+ }
62
+ if (effectiveModel) {
63
+ metaLines.push(`model ${effectiveModel}`);
64
+ }
65
+ if (effectiveSkillset) {
66
+ metaLines.push(`skillset ${effectiveSkillset}`);
67
+ }
68
+ if (effectiveDataset) {
69
+ metaLines.push(`dataset ${effectiveDataset}`);
70
+ }
71
+ if (effectiveSkills) {
72
+ metaLines.push(`skills ${effectiveSkills.join(', ')}`);
73
+ }
74
+ if (metaLines.length > 0) {
75
+ process.stdout.write('\n');
76
+ for (const line of metaLines) {
77
+ process.stdout.write(`${colors.gray} ${line}${colors.reset}\n`);
78
+ }
79
+ }
80
+ process.stdout.write(`\n${colors.gray} shortcuts Ctrl+C re-prompt · Ctrl+C×2 abort response · Ctrl+D exit${colors.reset}\n`);
81
+ let agentAbort = null;
82
+ let promptAbort = null;
83
+ let sigintCount = 0;
84
+ rl.on('SIGINT', () => {
85
+ if (agentAbort) {
86
+ sigintCount++;
87
+ if (sigintCount === 1) {
88
+ process.stdout.write(`\n ${colors.dim}(Press Ctrl+C again to cancel)${colors.reset}\n`);
89
+ }
90
+ else {
91
+ sigintCount = 0;
92
+ agentAbort.abort();
93
+ }
94
+ }
95
+ else {
96
+ process.stdout.write('^C\n');
97
+ promptAbort?.abort();
98
+ }
99
+ });
34
100
  for (;;) {
35
101
  process.stdout.write('\n');
36
- const user = await rl.question(`${colors.cyan}●${colors.reset} ${colors.bold}You${colors.reset}\n\n> `);
37
- messages.push({ type: 'user', text: user });
102
+ promptAbort = new AbortController();
103
+ let text;
104
+ try {
105
+ text = await rl.question(`${colors.cyan}●${colors.reset} ${colors.bold}You${colors.reset}\n\n> `, { signal: promptAbort.signal });
106
+ }
107
+ catch {
108
+ continue;
109
+ }
110
+ finally {
111
+ promptAbort = null;
112
+ }
113
+ text = text?.trim();
114
+ if (!text) {
115
+ continue;
116
+ }
117
+ messages.push({ type: 'user', text: text });
38
118
  process.stdout.write(`\n${colors.green}●${colors.reset} ${colors.bold}Assistant${colors.reset}\n\n `);
39
119
  const spinner = new Spinner('');
40
- spinner.start();
120
+ if (!options.debug) {
121
+ spinner.start();
122
+ }
41
123
  let firstToken = true;
42
- for await (const { type, data } of complete({
43
- client,
44
- botId: options.bot,
45
- model: options.model,
46
- messages,
47
- tools,
48
- })) {
49
- if (type === 'token') {
50
- if (firstToken) {
51
- spinner.stop();
52
- firstToken = false;
124
+ sigintCount = 0;
125
+ agentAbort = new AbortController();
126
+ try {
127
+ for await (const item of execute({
128
+ client,
129
+ ...(options.bot
130
+ ? { botId: options.bot }
131
+ : agent?.botId
132
+ ? { botId: agent.botId }
133
+ : { model: options.model ?? agent?.model }),
134
+ ...(agent?.backstory ? { backstory: agent.backstory } : {}),
135
+ ...(options.skillset ?? agent?.skillsetId
136
+ ? { skillsetId: options.skillset ?? agent?.skillsetId }
137
+ : {}),
138
+ ...(options.dataset ?? agent?.datasetId
139
+ ? { datasetId: options.dataset ?? agent?.datasetId }
140
+ : {}),
141
+ messages,
142
+ tools,
143
+ abortSignal: agentAbort.signal,
144
+ ...(skills.length > 0
145
+ ? { extensions: { features: [createSkillsFeature(skills)] } }
146
+ : {}),
147
+ })) {
148
+ const { type, data } = item;
149
+ if (options.debug) {
150
+ process.stderr.write(`${colors.dim}[debug] ${JSON.stringify(item)}${colors.reset}\n`);
151
+ }
152
+ else if (type === 'token') {
153
+ if (firstToken) {
154
+ spinner.stop();
155
+ firstToken = false;
156
+ }
157
+ process.stdout.write(data.token);
158
+ }
159
+ if (type === 'message') {
160
+ messages.push(data);
53
161
  }
54
- process.stdout.write(data.token);
55
- }
56
- else if (type === 'result') {
57
- messages.push({ type: 'bot', text: data.text });
58
162
  }
59
163
  }
60
- spinner.stop();
164
+ catch {
165
+ }
166
+ finally {
167
+ agentAbort = null;
168
+ }
169
+ if (!options.debug) {
170
+ spinner.stop();
171
+ }
61
172
  process.stdout.write('\n');
62
173
  }
63
174
  });
@@ -165,6 +165,7 @@ export const ResourceConfigSchema: z.ZodUnion<[ResourceConfigSchemaFor<"blueprin
165
165
  ratings?: boolean;
166
166
  visibleMessages?: number;
167
167
  autoRespond?: string;
168
+ allowFrom?: string;
168
169
  }>, ResourceConfigSchemaFor<"discordIntegration", {
169
170
  name?: string;
170
171
  description?: string;
@@ -179,6 +180,7 @@ export const ResourceConfigSchema: z.ZodUnion<[ResourceConfigSchemaFor<"blueprin
179
180
  handle?: string;
180
181
  contactCollection?: boolean;
181
182
  sessionDuration?: number;
183
+ allowFrom?: string;
182
184
  }>, ResourceConfigSchemaFor<"telegramIntegration", {
183
185
  name?: string;
184
186
  description?: string;
@@ -191,6 +193,7 @@ export const ResourceConfigSchema: z.ZodUnion<[ResourceConfigSchemaFor<"blueprin
191
193
  contactCollection?: boolean;
192
194
  sessionDuration?: number;
193
195
  attachments?: boolean;
196
+ allowFrom?: string;
194
197
  }>, ResourceConfigSchemaFor<"whatsappIntegration", {
195
198
  name?: string;
196
199
  description?: string;
@@ -204,6 +207,7 @@ export const ResourceConfigSchema: z.ZodUnion<[ResourceConfigSchemaFor<"blueprin
204
207
  contactCollection?: boolean;
205
208
  sessionDuration?: number;
206
209
  attachments?: boolean;
210
+ allowFrom?: string;
207
211
  }>, ResourceConfigSchemaFor<"messengerIntegration", {
208
212
  name?: string;
209
213
  description?: string;
@@ -213,6 +217,7 @@ export const ResourceConfigSchema: z.ZodUnion<[ResourceConfigSchemaFor<"blueprin
213
217
  blueprintId?: string;
214
218
  botId?: string;
215
219
  accessToken?: string;
220
+ contactCollection?: boolean;
216
221
  sessionDuration?: number;
217
222
  attachments?: boolean;
218
223
  }>, ResourceConfigSchemaFor<"notionIntegration", {
@@ -237,6 +242,7 @@ export const ResourceConfigSchema: z.ZodUnion<[ResourceConfigSchemaFor<"blueprin
237
242
  contactCollection?: boolean;
238
243
  sessionDuration?: number;
239
244
  attachments?: boolean;
245
+ allowFrom?: string;
240
246
  }>, ResourceConfigSchemaFor<"triggerIntegration", {
241
247
  name?: string;
242
248
  description?: string;
@@ -248,6 +254,8 @@ export const ResourceConfigSchema: z.ZodUnion<[ResourceConfigSchemaFor<"blueprin
248
254
  authenticate?: boolean;
249
255
  triggerSchedule?: "never" | "quarterhourly" | "halfhourly" | "hourly" | "daily" | "weekly" | "monthly";
250
256
  sessionDuration?: number;
257
+ maxIterations?: number;
258
+ maxTime?: number;
251
259
  }>, ResourceConfigSchemaFor<"supportIntegration", {
252
260
  name?: string;
253
261
  description?: string;
@@ -417,6 +425,7 @@ export const SolutionConfigSchema: z.ZodObject<{
417
425
  ratings?: boolean;
418
426
  visibleMessages?: number;
419
427
  autoRespond?: string;
428
+ allowFrom?: string;
420
429
  }>, ResourceConfigSchemaFor<"discordIntegration", {
421
430
  name?: string;
422
431
  description?: string;
@@ -431,6 +440,7 @@ export const SolutionConfigSchema: z.ZodObject<{
431
440
  handle?: string;
432
441
  contactCollection?: boolean;
433
442
  sessionDuration?: number;
443
+ allowFrom?: string;
434
444
  }>, ResourceConfigSchemaFor<"telegramIntegration", {
435
445
  name?: string;
436
446
  description?: string;
@@ -443,6 +453,7 @@ export const SolutionConfigSchema: z.ZodObject<{
443
453
  contactCollection?: boolean;
444
454
  sessionDuration?: number;
445
455
  attachments?: boolean;
456
+ allowFrom?: string;
446
457
  }>, ResourceConfigSchemaFor<"whatsappIntegration", {
447
458
  name?: string;
448
459
  description?: string;
@@ -456,6 +467,7 @@ export const SolutionConfigSchema: z.ZodObject<{
456
467
  contactCollection?: boolean;
457
468
  sessionDuration?: number;
458
469
  attachments?: boolean;
470
+ allowFrom?: string;
459
471
  }>, ResourceConfigSchemaFor<"messengerIntegration", {
460
472
  name?: string;
461
473
  description?: string;
@@ -465,6 +477,7 @@ export const SolutionConfigSchema: z.ZodObject<{
465
477
  blueprintId?: string;
466
478
  botId?: string;
467
479
  accessToken?: string;
480
+ contactCollection?: boolean;
468
481
  sessionDuration?: number;
469
482
  attachments?: boolean;
470
483
  }>, ResourceConfigSchemaFor<"notionIntegration", {
@@ -489,6 +502,7 @@ export const SolutionConfigSchema: z.ZodObject<{
489
502
  contactCollection?: boolean;
490
503
  sessionDuration?: number;
491
504
  attachments?: boolean;
505
+ allowFrom?: string;
492
506
  }>, ResourceConfigSchemaFor<"triggerIntegration", {
493
507
  name?: string;
494
508
  description?: string;
@@ -500,6 +514,8 @@ export const SolutionConfigSchema: z.ZodObject<{
500
514
  authenticate?: boolean;
501
515
  triggerSchedule?: "never" | "quarterhourly" | "halfhourly" | "hourly" | "daily" | "weekly" | "monthly";
502
516
  sessionDuration?: number;
517
+ maxIterations?: number;
518
+ maxTime?: number;
503
519
  }>, ResourceConfigSchemaFor<"supportIntegration", {
504
520
  name?: string;
505
521
  description?: string;
@@ -726,6 +742,7 @@ export const SolutionConfigSchema: z.ZodObject<{
726
742
  ratings?: boolean | undefined;
727
743
  visibleMessages?: number | undefined;
728
744
  autoRespond?: string | undefined;
745
+ allowFrom?: string | undefined;
729
746
  };
730
747
  slug?: string | undefined;
731
748
  id?: string | undefined;
@@ -742,6 +759,7 @@ export const SolutionConfigSchema: z.ZodObject<{
742
759
  sessionDuration?: number | undefined;
743
760
  contactCollection?: boolean | undefined;
744
761
  botToken?: string | undefined;
762
+ allowFrom?: string | undefined;
745
763
  appId?: string | undefined;
746
764
  publicKey?: string | undefined;
747
765
  handle?: string | undefined;
@@ -762,6 +780,7 @@ export const SolutionConfigSchema: z.ZodObject<{
762
780
  sessionDuration?: number | undefined;
763
781
  contactCollection?: boolean | undefined;
764
782
  botToken?: string | undefined;
783
+ allowFrom?: string | undefined;
765
784
  };
766
785
  slug?: string | undefined;
767
786
  id?: string | undefined;
@@ -778,6 +797,7 @@ export const SolutionConfigSchema: z.ZodObject<{
778
797
  blueprintId?: string | undefined;
779
798
  sessionDuration?: number | undefined;
780
799
  contactCollection?: boolean | undefined;
800
+ allowFrom?: string | undefined;
781
801
  phoneNumberId?: string | undefined;
782
802
  accessToken?: string | undefined;
783
803
  };
@@ -795,6 +815,7 @@ export const SolutionConfigSchema: z.ZodObject<{
795
815
  } | undefined;
796
816
  blueprintId?: string | undefined;
797
817
  sessionDuration?: number | undefined;
818
+ contactCollection?: boolean | undefined;
798
819
  accessToken?: string | undefined;
799
820
  };
800
821
  slug?: string | undefined;
@@ -828,6 +849,7 @@ export const SolutionConfigSchema: z.ZodObject<{
828
849
  blueprintId?: string | undefined;
829
850
  sessionDuration?: number | undefined;
830
851
  contactCollection?: boolean | undefined;
852
+ allowFrom?: string | undefined;
831
853
  };
832
854
  slug?: string | undefined;
833
855
  id?: string | undefined;
@@ -836,6 +858,7 @@ export const SolutionConfigSchema: z.ZodObject<{
836
858
  properties: {
837
859
  name?: string | undefined;
838
860
  botId?: string | undefined;
861
+ maxIterations?: number | undefined;
839
862
  description?: string | undefined;
840
863
  meta?: {
841
864
  [key: string]: unknown;
@@ -844,6 +867,7 @@ export const SolutionConfigSchema: z.ZodObject<{
844
867
  sessionDuration?: number | undefined;
845
868
  authenticate?: boolean | undefined;
846
869
  triggerSchedule?: "never" | "quarterhourly" | "halfhourly" | "hourly" | "daily" | "weekly" | "monthly" | undefined;
870
+ maxTime?: number | undefined;
847
871
  };
848
872
  slug?: string | undefined;
849
873
  id?: string | undefined;
@@ -1093,6 +1117,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1093
1117
  ratings?: boolean | undefined;
1094
1118
  visibleMessages?: number | undefined;
1095
1119
  autoRespond?: string | undefined;
1120
+ allowFrom?: string | undefined;
1096
1121
  };
1097
1122
  slug?: string | undefined;
1098
1123
  id?: string | undefined;
@@ -1109,6 +1134,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1109
1134
  sessionDuration?: number | undefined;
1110
1135
  contactCollection?: boolean | undefined;
1111
1136
  botToken?: string | undefined;
1137
+ allowFrom?: string | undefined;
1112
1138
  appId?: string | undefined;
1113
1139
  publicKey?: string | undefined;
1114
1140
  handle?: string | undefined;
@@ -1129,6 +1155,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1129
1155
  sessionDuration?: number | undefined;
1130
1156
  contactCollection?: boolean | undefined;
1131
1157
  botToken?: string | undefined;
1158
+ allowFrom?: string | undefined;
1132
1159
  };
1133
1160
  slug?: string | undefined;
1134
1161
  id?: string | undefined;
@@ -1145,6 +1172,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1145
1172
  blueprintId?: string | undefined;
1146
1173
  sessionDuration?: number | undefined;
1147
1174
  contactCollection?: boolean | undefined;
1175
+ allowFrom?: string | undefined;
1148
1176
  phoneNumberId?: string | undefined;
1149
1177
  accessToken?: string | undefined;
1150
1178
  };
@@ -1162,6 +1190,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1162
1190
  } | undefined;
1163
1191
  blueprintId?: string | undefined;
1164
1192
  sessionDuration?: number | undefined;
1193
+ contactCollection?: boolean | undefined;
1165
1194
  accessToken?: string | undefined;
1166
1195
  };
1167
1196
  slug?: string | undefined;
@@ -1195,6 +1224,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1195
1224
  blueprintId?: string | undefined;
1196
1225
  sessionDuration?: number | undefined;
1197
1226
  contactCollection?: boolean | undefined;
1227
+ allowFrom?: string | undefined;
1198
1228
  };
1199
1229
  slug?: string | undefined;
1200
1230
  id?: string | undefined;
@@ -1203,6 +1233,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1203
1233
  properties: {
1204
1234
  name?: string | undefined;
1205
1235
  botId?: string | undefined;
1236
+ maxIterations?: number | undefined;
1206
1237
  description?: string | undefined;
1207
1238
  meta?: {
1208
1239
  [key: string]: unknown;
@@ -1211,6 +1242,7 @@ export const SolutionConfigSchema: z.ZodObject<{
1211
1242
  sessionDuration?: number | undefined;
1212
1243
  authenticate?: boolean | undefined;
1213
1244
  triggerSchedule?: "never" | "quarterhourly" | "halfhourly" | "hourly" | "daily" | "weekly" | "monthly" | undefined;
1245
+ maxTime?: number | undefined;
1214
1246
  };
1215
1247
  slug?: string | undefined;
1216
1248
  id?: string | undefined;
@@ -1461,6 +1493,7 @@ export class Resource {
1461
1493
  ratings?: boolean | undefined;
1462
1494
  visibleMessages?: number | undefined;
1463
1495
  autoRespond?: string | undefined;
1496
+ allowFrom?: string | undefined;
1464
1497
  };
1465
1498
  slug?: string | undefined;
1466
1499
  id?: string | undefined;
@@ -1477,6 +1510,7 @@ export class Resource {
1477
1510
  sessionDuration?: number | undefined;
1478
1511
  contactCollection?: boolean | undefined;
1479
1512
  botToken?: string | undefined;
1513
+ allowFrom?: string | undefined;
1480
1514
  appId?: string | undefined;
1481
1515
  publicKey?: string | undefined;
1482
1516
  handle?: string | undefined;
@@ -1497,6 +1531,7 @@ export class Resource {
1497
1531
  sessionDuration?: number | undefined;
1498
1532
  contactCollection?: boolean | undefined;
1499
1533
  botToken?: string | undefined;
1534
+ allowFrom?: string | undefined;
1500
1535
  };
1501
1536
  slug?: string | undefined;
1502
1537
  id?: string | undefined;
@@ -1513,6 +1548,7 @@ export class Resource {
1513
1548
  blueprintId?: string | undefined;
1514
1549
  sessionDuration?: number | undefined;
1515
1550
  contactCollection?: boolean | undefined;
1551
+ allowFrom?: string | undefined;
1516
1552
  phoneNumberId?: string | undefined;
1517
1553
  accessToken?: string | undefined;
1518
1554
  };
@@ -1530,6 +1566,7 @@ export class Resource {
1530
1566
  } | undefined;
1531
1567
  blueprintId?: string | undefined;
1532
1568
  sessionDuration?: number | undefined;
1569
+ contactCollection?: boolean | undefined;
1533
1570
  accessToken?: string | undefined;
1534
1571
  };
1535
1572
  slug?: string | undefined;
@@ -1563,6 +1600,7 @@ export class Resource {
1563
1600
  blueprintId?: string | undefined;
1564
1601
  sessionDuration?: number | undefined;
1565
1602
  contactCollection?: boolean | undefined;
1603
+ allowFrom?: string | undefined;
1566
1604
  };
1567
1605
  slug?: string | undefined;
1568
1606
  id?: string | undefined;
@@ -1571,6 +1609,7 @@ export class Resource {
1571
1609
  properties: {
1572
1610
  name?: string | undefined;
1573
1611
  botId?: string | undefined;
1612
+ maxIterations?: number | undefined;
1574
1613
  description?: string | undefined;
1575
1614
  meta?: {
1576
1615
  [key: string]: unknown;
@@ -1579,6 +1618,7 @@ export class Resource {
1579
1618
  sessionDuration?: number | undefined;
1580
1619
  authenticate?: boolean | undefined;
1581
1620
  triggerSchedule?: "never" | "quarterhourly" | "halfhourly" | "hourly" | "daily" | "weekly" | "monthly" | undefined;
1621
+ maxTime?: number | undefined;
1582
1622
  };
1583
1623
  slug?: string | undefined;
1584
1624
  id?: string | undefined;
@@ -1909,6 +1949,7 @@ export class Solution {
1909
1949
  ratings?: boolean | undefined;
1910
1950
  visibleMessages?: number | undefined;
1911
1951
  autoRespond?: string | undefined;
1952
+ allowFrom?: string | undefined;
1912
1953
  };
1913
1954
  slug?: string | undefined;
1914
1955
  id?: string | undefined;
@@ -1925,6 +1966,7 @@ export class Solution {
1925
1966
  sessionDuration?: number | undefined;
1926
1967
  contactCollection?: boolean | undefined;
1927
1968
  botToken?: string | undefined;
1969
+ allowFrom?: string | undefined;
1928
1970
  appId?: string | undefined;
1929
1971
  publicKey?: string | undefined;
1930
1972
  handle?: string | undefined;
@@ -1945,6 +1987,7 @@ export class Solution {
1945
1987
  sessionDuration?: number | undefined;
1946
1988
  contactCollection?: boolean | undefined;
1947
1989
  botToken?: string | undefined;
1990
+ allowFrom?: string | undefined;
1948
1991
  };
1949
1992
  slug?: string | undefined;
1950
1993
  id?: string | undefined;
@@ -1961,6 +2004,7 @@ export class Solution {
1961
2004
  blueprintId?: string | undefined;
1962
2005
  sessionDuration?: number | undefined;
1963
2006
  contactCollection?: boolean | undefined;
2007
+ allowFrom?: string | undefined;
1964
2008
  phoneNumberId?: string | undefined;
1965
2009
  accessToken?: string | undefined;
1966
2010
  };
@@ -1978,6 +2022,7 @@ export class Solution {
1978
2022
  } | undefined;
1979
2023
  blueprintId?: string | undefined;
1980
2024
  sessionDuration?: number | undefined;
2025
+ contactCollection?: boolean | undefined;
1981
2026
  accessToken?: string | undefined;
1982
2027
  };
1983
2028
  slug?: string | undefined;
@@ -2011,6 +2056,7 @@ export class Solution {
2011
2056
  blueprintId?: string | undefined;
2012
2057
  sessionDuration?: number | undefined;
2013
2058
  contactCollection?: boolean | undefined;
2059
+ allowFrom?: string | undefined;
2014
2060
  };
2015
2061
  slug?: string | undefined;
2016
2062
  id?: string | undefined;
@@ -2019,6 +2065,7 @@ export class Solution {
2019
2065
  properties: {
2020
2066
  name?: string | undefined;
2021
2067
  botId?: string | undefined;
2068
+ maxIterations?: number | undefined;
2022
2069
  description?: string | undefined;
2023
2070
  meta?: {
2024
2071
  [key: string]: unknown;
@@ -2027,6 +2074,7 @@ export class Solution {
2027
2074
  sessionDuration?: number | undefined;
2028
2075
  authenticate?: boolean | undefined;
2029
2076
  triggerSchedule?: "never" | "quarterhourly" | "halfhourly" | "hourly" | "daily" | "weekly" | "monthly" | undefined;
2077
+ maxTime?: number | undefined;
2030
2078
  };
2031
2079
  slug?: string | undefined;
2032
2080
  id?: string | undefined;
@@ -205,6 +205,7 @@ export const SlackIntegrationResourceConfigSchema = BasicResourceConfigSchema.ex
205
205
  ratings: z.boolean().optional(),
206
206
  visibleMessages: z.number().optional(),
207
207
  autoRespond: z.string().optional(),
208
+ allowFrom: z.string().optional(),
208
209
  }),
209
210
  });
210
211
  export const DiscordIntegrationResourceConfigSchema = BasicResourceConfigSchema.extend({
@@ -224,6 +225,7 @@ export const DiscordIntegrationResourceConfigSchema = BasicResourceConfigSchema.
224
225
  sessionDuration: z.number().optional(),
225
226
  attachments: z.boolean().optional(),
226
227
  stream: z.boolean().optional(),
228
+ allowFrom: z.string().optional(),
227
229
  }),
228
230
  });
229
231
  export const TelegramIntegrationResourceConfigSchema = BasicResourceConfigSchema.extend({
@@ -238,6 +240,7 @@ export const TelegramIntegrationResourceConfigSchema = BasicResourceConfigSchema
238
240
  contactCollection: z.boolean().optional(),
239
241
  sessionDuration: z.number().optional(),
240
242
  attachments: z.boolean().optional(),
243
+ allowFrom: z.string().optional(),
241
244
  }),
242
245
  });
243
246
  export const WhatsAppIntegrationResourceConfigSchema = BasicResourceConfigSchema.extend({
@@ -253,6 +256,7 @@ export const WhatsAppIntegrationResourceConfigSchema = BasicResourceConfigSchema
253
256
  contactCollection: z.boolean().optional(),
254
257
  sessionDuration: z.number().optional(),
255
258
  attachments: z.boolean().optional(),
259
+ allowFrom: z.string().optional(),
256
260
  }),
257
261
  });
258
262
  export const MessengerIntegrationResourceConfigSchema = BasicResourceConfigSchema.extend({
@@ -293,6 +297,7 @@ export const EmailIntegrationResourceConfigSchema = BasicResourceConfigSchema.ex
293
297
  contactCollection: z.boolean().optional(),
294
298
  sessionDuration: z.number().optional(),
295
299
  attachments: z.boolean().optional(),
300
+ allowFrom: z.string().optional(),
296
301
  }),
297
302
  });
298
303
  export const TriggerIntegrationResourceConfigSchema = BasicResourceConfigSchema.extend({
@@ -316,6 +321,8 @@ export const TriggerIntegrationResourceConfigSchema = BasicResourceConfigSchema.
316
321
  ])
317
322
  .optional(),
318
323
  sessionDuration: z.number().optional(),
324
+ maxIterations: z.number().optional(),
325
+ maxTime: z.number().optional(),
319
326
  }),
320
327
  });
321
328
  export const SupportIntegrationResourceConfigSchema = BasicResourceConfigSchema.extend({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatbotkit/cli",
3
- "version": "1.28.0",
3
+ "version": "1.29.1",
4
4
  "description": "ChatBotKit command line tools",
5
5
  "license": "ISC",
6
6
  "engines": {
@@ -945,6 +945,66 @@
945
945
  "default": "./dist/cjs/command/api/partner/user/index.cjs"
946
946
  }
947
947
  },
948
+ "./command/api/platform": {
949
+ "import": {
950
+ "types": "./dist/esm/command/api/platform/index.d.ts",
951
+ "default": "./dist/esm/command/api/platform/index.js"
952
+ },
953
+ "require": {
954
+ "types": "./dist/cjs/command/api/platform/index.d.ts",
955
+ "default": "./dist/cjs/command/api/platform/index.cjs"
956
+ }
957
+ },
958
+ "./command/api/platform/index": {
959
+ "import": {
960
+ "types": "./dist/esm/command/api/platform/index.d.ts",
961
+ "default": "./dist/esm/command/api/platform/index.js"
962
+ },
963
+ "require": {
964
+ "types": "./dist/cjs/command/api/platform/index.d.ts",
965
+ "default": "./dist/cjs/command/api/platform/index.cjs"
966
+ }
967
+ },
968
+ "./command/api/platform/index.js": {
969
+ "import": {
970
+ "types": "./dist/esm/command/api/platform/index.d.ts",
971
+ "default": "./dist/esm/command/api/platform/index.js"
972
+ },
973
+ "require": {
974
+ "types": "./dist/cjs/command/api/platform/index.d.ts",
975
+ "default": "./dist/cjs/command/api/platform/index.cjs"
976
+ }
977
+ },
978
+ "./command/api/platform/model": {
979
+ "import": {
980
+ "types": "./dist/esm/command/api/platform/model/index.d.ts",
981
+ "default": "./dist/esm/command/api/platform/model/index.js"
982
+ },
983
+ "require": {
984
+ "types": "./dist/cjs/command/api/platform/model/index.d.ts",
985
+ "default": "./dist/cjs/command/api/platform/model/index.cjs"
986
+ }
987
+ },
988
+ "./command/api/platform/model/index": {
989
+ "import": {
990
+ "types": "./dist/esm/command/api/platform/model/index.d.ts",
991
+ "default": "./dist/esm/command/api/platform/model/index.js"
992
+ },
993
+ "require": {
994
+ "types": "./dist/cjs/command/api/platform/model/index.d.ts",
995
+ "default": "./dist/cjs/command/api/platform/model/index.cjs"
996
+ }
997
+ },
998
+ "./command/api/platform/model/index.js": {
999
+ "import": {
1000
+ "types": "./dist/esm/command/api/platform/model/index.d.ts",
1001
+ "default": "./dist/esm/command/api/platform/model/index.js"
1002
+ },
1003
+ "require": {
1004
+ "types": "./dist/cjs/command/api/platform/model/index.d.ts",
1005
+ "default": "./dist/cjs/command/api/platform/model/index.cjs"
1006
+ }
1007
+ },
948
1008
  "./command/api/secret": {
949
1009
  "import": {
950
1010
  "types": "./dist/esm/command/api/secret/index.d.ts",
@@ -1404,8 +1464,8 @@
1404
1464
  "js-yaml": "^4.1.0",
1405
1465
  "tslib": "^2.6.2",
1406
1466
  "zod": "^3.25.76",
1407
- "@chatbotkit/agent": "1.28.0",
1408
- "@chatbotkit/sdk": "1.28.0"
1467
+ "@chatbotkit/agent": "1.29.1",
1468
+ "@chatbotkit/sdk": "1.29.0"
1409
1469
  },
1410
1470
  "devDependencies": {
1411
1471
  "@types/js-yaml": "^4.0.9",