commandkit 1.0.0-dev.20250611125312 → 1.0.0-dev.20250611155146
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/ai.cjs +21 -0
- package/ai.d.ts +1 -0
- package/dist/{CommandKit-C0W3U6jh.js → CommandKit-BqZBlSaB.js} +16 -4
- package/dist/CommandKit-BqZBlSaB.js.map +1 -0
- package/dist/{CommandKit-BkMUDbou.d.ts → CommandKit-g7NqIdUD.d.ts} +26 -9
- package/dist/CommandKit.d.ts +1 -1
- package/dist/CommandKit.js +1 -1
- package/dist/{EventWorkerContext-DoFZMT8u.d.ts → EventWorkerContext-BcXmutAi.d.ts} +2 -2
- package/dist/analytics/analytics-engine.d.ts +1 -1
- package/dist/analytics/analytics-engine.js +1 -1
- package/dist/analytics/analytics-provider.d.ts +1 -1
- package/dist/analytics/utils.js +1 -1
- package/dist/app/commands/AppCommandRunner.d.ts +2 -2
- package/dist/app/commands/AppCommandRunner.js +1 -1
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +2 -2
- package/dist/app/handlers/AppCommandHandler.d.ts +2 -2
- package/dist/app/handlers/AppCommandHandler.js +1 -1
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +1 -1
- package/dist/app/index.d.ts +2 -2
- package/dist/app/index.js +1 -1
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +1 -1
- package/dist/{build-CWrpkal-.js → build-B-Ae1hqg.js} +2 -2
- package/dist/{build-CWrpkal-.js.map → build-B-Ae1hqg.js.map} +1 -1
- package/dist/cli/build.d.ts +1 -1
- package/dist/cli/build.js +2 -2
- package/dist/cli/common.d.ts +3 -3
- package/dist/cli/development.js +2 -2
- package/dist/cli/information.js +1 -1
- package/dist/cli/init.js +2 -2
- package/dist/cli/production.js +2 -2
- package/dist/components/index.js +1 -1
- package/dist/components/v1/button/Button.js +1 -1
- package/dist/components/v1/button/ButtonKit.js +1 -1
- package/dist/components/v1/modal/Modal.js +1 -1
- package/dist/components/v1/modal/ModalKit.js +1 -1
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/SelectMenu.js +1 -1
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +1 -1
- package/dist/config/config.d.ts +4 -4
- package/dist/config/config.js +1 -1
- package/dist/config/default.d.ts +3 -3
- package/dist/config/default.js +1 -1
- package/dist/config/loader.d.ts +3 -3
- package/dist/config/loader.js +1 -1
- package/dist/config/types.d.ts +2 -2
- package/dist/config/utils.d.ts +3 -3
- package/dist/{config-aCpqqs1C.d.ts → config-CGECBFwj.d.ts} +3 -3
- package/dist/context/async-context.d.ts +1 -1
- package/dist/context/async-context.js +1 -1
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/{feature-flags-CLZLGnAs.js → feature-flags-CvHcOB7L.js} +2 -2
- package/dist/{feature-flags-CLZLGnAs.js.map → feature-flags-CvHcOB7L.js.map} +1 -1
- package/dist/flags/FlagProvider.d.ts +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +2 -2
- package/dist/flags/store.d.ts +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/{init-_FwacDcI.js → init-BQgLOfl_.js} +2 -2
- package/dist/{init-_FwacDcI.js.map → init-BQgLOfl_.js.map} +1 -1
- package/dist/logger/DefaultLogger.js +1 -1
- package/dist/logger/Logger.js +1 -1
- package/dist/plugins/CompilerPlugin.d.ts +1 -1
- package/dist/plugins/PluginCommon.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +1 -1
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/{types-DwmPE0nY.d.ts → types-uBjT82V4.d.ts} +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/utils/colors.d.ts +2 -2
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +1 -1
- package/dist/utils/utilities.js +1 -1
- package/dist/{utils-DS6OiGvg.d.ts → utils-Bz_BoOnV.d.ts} +2 -2
- package/dist/{version-IoXx-oYe.js → version-AMyvJ7I3.js} +2 -2
- package/dist/{version-IoXx-oYe.js.map → version-AMyvJ7I3.js.map} +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -3
- package/dist/CommandKit-C0W3U6jh.js.map +0 -1
package/ai.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const {
|
|
2
|
+
AiContext,
|
|
3
|
+
AiPlugin,
|
|
4
|
+
configureAI,
|
|
5
|
+
createSystemPrompt,
|
|
6
|
+
createTool,
|
|
7
|
+
getAIConfig,
|
|
8
|
+
useAIContext,
|
|
9
|
+
ai,
|
|
10
|
+
} = require('@commandkit/ai');
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
AiContext,
|
|
14
|
+
AiPlugin,
|
|
15
|
+
configureAI,
|
|
16
|
+
createSystemPrompt,
|
|
17
|
+
createTool,
|
|
18
|
+
getAIConfig,
|
|
19
|
+
useAIContext,
|
|
20
|
+
ai,
|
|
21
|
+
};
|
package/ai.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@commandkit/ai';
|
|
@@ -1383,12 +1383,21 @@ var CommandKitPluginRuntime = class {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
/**
|
|
1385
1385
|
* Checks if there are no plugins registered in this runtime.
|
|
1386
|
+
* @param pluginName The name of the plugin to check.
|
|
1386
1387
|
* @returns Boolean indicating whether the runtime is empty.
|
|
1387
1388
|
*/
|
|
1388
1389
|
getPlugin(pluginName) {
|
|
1389
1390
|
return this.plugins.get(pluginName) ?? null;
|
|
1390
1391
|
}
|
|
1391
1392
|
/**
|
|
1393
|
+
* Fetches the given plugin
|
|
1394
|
+
* @param plugin The plugin to be fetched.
|
|
1395
|
+
*/
|
|
1396
|
+
get(plugin) {
|
|
1397
|
+
const p = this.plugins.find((p$1) => p$1 instanceof plugin) ?? null;
|
|
1398
|
+
return p;
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1392
1401
|
* Soft registers a plugin in the runtime.
|
|
1393
1402
|
* @param plugin The plugin to be registered.
|
|
1394
1403
|
*/
|
|
@@ -2465,7 +2474,7 @@ var AppCommandRunner = class {
|
|
|
2465
2474
|
* @param prepared - The prepared command execution data
|
|
2466
2475
|
* @param source - The source interaction or message that triggered the command
|
|
2467
2476
|
*/
|
|
2468
|
-
async runCommand(prepared, source) {
|
|
2477
|
+
async runCommand(prepared, source, options) {
|
|
2469
2478
|
const { commandkit: commandkit$1 } = this.handler;
|
|
2470
2479
|
const executionMode = this.getExecutionMode(source);
|
|
2471
2480
|
let runCommand = null;
|
|
@@ -2474,6 +2483,7 @@ var AppCommandRunner = class {
|
|
|
2474
2483
|
env.variables.set("commandHandlerType", "app");
|
|
2475
2484
|
env.variables.set("currentCommandName", prepared.command.command.name);
|
|
2476
2485
|
env.variables.set("execHandlerKind", executionMode);
|
|
2486
|
+
env.variables.set("customHandler", (options === null || options === void 0 ? void 0 : options.handler) ?? null);
|
|
2477
2487
|
const ctx = new MiddlewareContext(commandkit$1, {
|
|
2478
2488
|
command: prepared.command,
|
|
2479
2489
|
environment: env,
|
|
@@ -2502,9 +2512,10 @@ var AppCommandRunner = class {
|
|
|
2502
2512
|
}
|
|
2503
2513
|
}
|
|
2504
2514
|
});
|
|
2515
|
+
let result;
|
|
2505
2516
|
if (!ctx.cancelled) {
|
|
2506
2517
|
const targetData = prepared.command.data;
|
|
2507
|
-
const fn = targetData[executionMode];
|
|
2518
|
+
const fn = targetData[(options === null || options === void 0 ? void 0 : options.handler) || executionMode];
|
|
2508
2519
|
if (!fn) Logger.warn(`Command ${prepared.command.command.name} has no handler for ${executionMode}`);
|
|
2509
2520
|
const analytics = commandkit$1.analytics;
|
|
2510
2521
|
if (fn) try {
|
|
@@ -2551,7 +2562,7 @@ var AppCommandRunner = class {
|
|
|
2551
2562
|
const res = await commandkit$1.plugins.execute(async (ctx$1, plugin) => {
|
|
2552
2563
|
return plugin.executeCommand(ctx$1, env, source, prepared, executeCommand);
|
|
2553
2564
|
});
|
|
2554
|
-
if (!res) await executeCommand();
|
|
2565
|
+
if (!res) result = await executeCommand();
|
|
2555
2566
|
} catch (e) {
|
|
2556
2567
|
if (require_error_codes.isErrorType(e, require_error_codes.CommandKitErrorCodes.ExitMiddleware)) middlewaresCanceled = true;
|
|
2557
2568
|
if (!require_error_codes.isErrorType(e, [require_error_codes.CommandKitErrorCodes.ForwardedCommand, require_error_codes.CommandKitErrorCodes.ExitMiddleware])) Logger.error(e);
|
|
@@ -2568,6 +2579,7 @@ var AppCommandRunner = class {
|
|
|
2568
2579
|
}
|
|
2569
2580
|
}
|
|
2570
2581
|
});
|
|
2582
|
+
return result;
|
|
2571
2583
|
}
|
|
2572
2584
|
/**
|
|
2573
2585
|
* @private
|
|
@@ -4112,4 +4124,4 @@ Object.defineProperty(exports, 'useEnvironment', {
|
|
|
4112
4124
|
return useEnvironment;
|
|
4113
4125
|
}
|
|
4114
4126
|
});
|
|
4115
|
-
//# sourceMappingURL=CommandKit-
|
|
4127
|
+
//# sourceMappingURL=CommandKit-BqZBlSaB.js.map
|