@equinor/fusion-framework-cli-plugin-ai-base 4.0.5 → 4.0.6
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/CHANGELOG.md +19 -0
- package/dist/esm/configure-fusion-ai.js +21 -0
- package/dist/esm/configure-fusion-ai.js.map +1 -0
- package/dist/esm/fusion-ai-config.js +2 -0
- package/dist/esm/fusion-ai-config.js.map +1 -0
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{config.js → load-fusion-ai-config.js} +3 -21
- package/dist/esm/load-fusion-ai-config.js.map +1 -0
- package/dist/esm/options/{schema.js → ai-options-schema.js} +1 -1
- package/dist/esm/options/ai-options-schema.js.map +1 -0
- package/dist/esm/options/index.js +1 -1
- package/dist/esm/options/index.js.map +1 -1
- package/dist/esm/options/options.js +9 -1
- package/dist/esm/options/options.js.map +1 -1
- package/dist/esm/options/with-options.js +6 -0
- package/dist/esm/options/with-options.js.map +1 -1
- package/dist/esm/{register.js → register-ai-plugin.js} +3 -2
- package/dist/esm/register-ai-plugin.js.map +1 -0
- package/dist/esm/setup-framework.js +5 -0
- package/dist/esm/setup-framework.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/configure-fusion-ai.d.ts +21 -0
- package/dist/types/fusion-ai-config.d.ts +11 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/{config.d.ts → load-fusion-ai-config.d.ts} +2 -31
- package/dist/types/options/{schema.d.ts → ai-options-schema.d.ts} +2 -2
- package/dist/types/options/index.d.ts +1 -1
- package/dist/types/options/options.d.ts +7 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +7 -7
- package/src/configure-fusion-ai.ts +22 -0
- package/src/fusion-ai-config.ts +11 -0
- package/src/index.ts +4 -7
- package/src/{config.ts → load-fusion-ai-config.ts} +3 -33
- package/src/options/index.ts +1 -1
- package/src/options/options.ts +11 -1
- package/src/options/with-options.ts +6 -0
- package/src/{register.ts → register-ai-plugin.ts} +2 -1
- package/src/setup-framework.ts +5 -0
- package/src/version.ts +1 -1
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/options/schema.js.map +0 -1
- package/dist/esm/register.js.map +0 -1
- /package/dist/types/{register.d.ts → register-ai-plugin.d.ts} +0 -0
- /package/src/options/{schema.ts → ai-options-schema.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FusionAIConfig } from './fusion-ai-config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration factory function for Fusion AI operations.
|
|
4
|
+
*
|
|
5
|
+
* This helper function provides type safety and consistency for creating AI configuration
|
|
6
|
+
* functions. It accepts a function that returns configuration (either synchronously or
|
|
7
|
+
* asynchronously) and returns it unchanged, providing a typed interface for consumers.
|
|
8
|
+
*
|
|
9
|
+
* @param fn - Function that returns Fusion AI configuration (sync or async)
|
|
10
|
+
* @returns The same configuration function, typed for use with loadFusionAIConfig
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* // fusion-ai.config.ts
|
|
15
|
+
* export default configureFusionAI(async () => ({
|
|
16
|
+
* apiKey: process.env.OPENAI_API_KEY,
|
|
17
|
+
* deployment: 'gpt-4',
|
|
18
|
+
* }));
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const configureFusionAI: <T extends FusionAIConfig>(fn: () => Promise<T> | T) => () => Promise<T> | T;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base configuration interface for Fusion AI operations.
|
|
3
|
+
*
|
|
4
|
+
* This interface serves as the base type for all Fusion AI configuration objects.
|
|
5
|
+
* Implementations should extend this interface with specific configuration properties
|
|
6
|
+
* relevant to their use case. The configuration is typically created using
|
|
7
|
+
* `configureFusionAI` and loaded via `loadFusionAIConfig`.
|
|
8
|
+
*/
|
|
9
|
+
export interface FusionAIConfig {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
|
-
export {
|
|
11
|
+
export type { FusionAIConfig } from './fusion-ai-config.js';
|
|
12
|
+
export { configureFusionAI } from './configure-fusion-ai.js';
|
|
13
|
+
export { type LoadFusionAIConfigOptions, loadFusionAIConfig } from './load-fusion-ai-config.js';
|
|
12
14
|
export { setupFramework, type FrameworkInstance } from './setup-framework.js';
|
|
13
|
-
export { registerAiPlugin } from './register.js';
|
|
15
|
+
export { registerAiPlugin } from './register-ai-plugin.js';
|
|
@@ -1,34 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Base configuration interface for Fusion AI operations.
|
|
3
|
-
*
|
|
4
|
-
* This interface serves as the base type for all Fusion AI configuration objects.
|
|
5
|
-
* Implementations should extend this interface with specific configuration properties
|
|
6
|
-
* relevant to their use case. The configuration is typically created using
|
|
7
|
-
* `configureFusionAI` and loaded via `loadFusionAIConfig`.
|
|
8
|
-
*/
|
|
9
|
-
export interface FusionAIConfig {
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Configuration factory function for Fusion AI operations.
|
|
14
|
-
*
|
|
15
|
-
* This helper function provides type safety and consistency for creating AI configuration
|
|
16
|
-
* functions. It accepts a function that returns configuration (either synchronously or
|
|
17
|
-
* asynchronously) and returns it unchanged, providing a typed interface for consumers.
|
|
18
|
-
*
|
|
19
|
-
* @param fn - Function that returns Fusion AI configuration (sync or async)
|
|
20
|
-
* @returns The same configuration function, typed for use with loadFusionAIConfig
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* // fusion-ai.config.ts
|
|
25
|
-
* export default configureFusionAI(async () => ({
|
|
26
|
-
* apiKey: process.env.OPENAI_API_KEY,
|
|
27
|
-
* deployment: 'gpt-4',
|
|
28
|
-
* }));
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare const configureFusionAI: <T extends FusionAIConfig>(fn: () => Promise<T> | T) => () => Promise<T> | T;
|
|
1
|
+
import type { FusionAIConfig } from './fusion-ai-config.js';
|
|
32
2
|
/**
|
|
33
3
|
* Options controlling how {@link loadFusionAIConfig} resolves and imports the
|
|
34
4
|
* Fusion AI configuration file.
|
|
@@ -53,6 +23,7 @@ export interface LoadFusionAIConfigOptions {
|
|
|
53
23
|
* The config file should export a function (via `configureFusionAI`) that returns
|
|
54
24
|
* the configuration object. The function can be synchronous or asynchronous.
|
|
55
25
|
*
|
|
26
|
+
* @template T - Shape of the resolved Fusion AI configuration object.
|
|
56
27
|
* @param configPath - Path to the config file without extension (default: 'fusion-ai.config')
|
|
57
28
|
* @param options - Optional parameters for loading the configuration
|
|
58
29
|
* @returns Promise resolving to the loaded and executed configuration
|
|
@@ -19,6 +19,6 @@ export declare const AiOptionsSchema: z.ZodObject<{
|
|
|
19
19
|
chatModel: z.ZodOptional<z.ZodString>;
|
|
20
20
|
embedModel: z.ZodOptional<z.ZodString>;
|
|
21
21
|
indexName: z.ZodOptional<z.ZodString>;
|
|
22
|
-
debug: z.ZodDefault<z.
|
|
23
|
-
}, z.
|
|
22
|
+
debug: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
24
|
export type AiOptionsType = z.infer<typeof AiOptionsSchema>;
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { default as options } from './options.js';
|
|
13
13
|
export { withOptions } from './with-options.js';
|
|
14
|
-
export { AiOptionsSchema, type AiOptionsType } from './schema.js';
|
|
14
|
+
export { AiOptionsSchema, type AiOptionsType } from './ai-options-schema.js';
|
|
15
15
|
export type { AiOptions } from './types.js';
|
|
@@ -14,6 +14,13 @@ export declare const embedModelOption: import("node_modules/commander/typings/in
|
|
|
14
14
|
export declare const indexNameOption: import("node_modules/commander/typings/index.js").Option;
|
|
15
15
|
/** `-d, --debug` | `RUNNER_DEBUG` — enable verbose logging */
|
|
16
16
|
export declare const debugOption: import("node_modules/commander/typings/index.js").Option;
|
|
17
|
+
/**
|
|
18
|
+
* Aggregated Commander option definitions for Fusion AI CLI commands.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Individual options are defined above and re-exported here for convenient
|
|
22
|
+
* access as a single object.
|
|
23
|
+
*/
|
|
17
24
|
declare const _default: {
|
|
18
25
|
envOption: import("node_modules/commander/typings/index.js").Option;
|
|
19
26
|
tokenOption: import("node_modules/commander/typings/index.js").Option;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.0.
|
|
1
|
+
export declare const version = "4.0.6";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-cli-plugin-ai-base",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Base AI plugin package for Fusion Framework CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"commander": "^15.0.0",
|
|
47
47
|
"zod": "^4.4.3",
|
|
48
|
-
"@equinor/fusion-framework-module": "6.1.
|
|
49
|
-
"@equinor/fusion-framework-module-ai": "6.0.
|
|
50
|
-
"@equinor/fusion-imports": "2.0.
|
|
48
|
+
"@equinor/fusion-framework-module": "6.1.1",
|
|
49
|
+
"@equinor/fusion-framework-module-ai": "6.0.2",
|
|
50
|
+
"@equinor/fusion-imports": "2.0.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@equinor/fusion-framework-cli": "^15.1
|
|
53
|
+
"@equinor/fusion-framework-cli": "^15.2.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"typescript": "^
|
|
56
|
+
"typescript": "^7.0.2",
|
|
57
57
|
"vitest": "^4.1.0",
|
|
58
|
-
"@equinor/fusion-framework-cli": "^15.1
|
|
58
|
+
"@equinor/fusion-framework-cli": "^15.2.1"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsc -b",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FusionAIConfig } from './fusion-ai-config.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration factory function for Fusion AI operations.
|
|
5
|
+
*
|
|
6
|
+
* This helper function provides type safety and consistency for creating AI configuration
|
|
7
|
+
* functions. It accepts a function that returns configuration (either synchronously or
|
|
8
|
+
* asynchronously) and returns it unchanged, providing a typed interface for consumers.
|
|
9
|
+
*
|
|
10
|
+
* @param fn - Function that returns Fusion AI configuration (sync or async)
|
|
11
|
+
* @returns The same configuration function, typed for use with loadFusionAIConfig
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // fusion-ai.config.ts
|
|
16
|
+
* export default configureFusionAI(async () => ({
|
|
17
|
+
* apiKey: process.env.OPENAI_API_KEY,
|
|
18
|
+
* deployment: 'gpt-4',
|
|
19
|
+
* }));
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const configureFusionAI = <T extends FusionAIConfig>(fn: () => Promise<T> | T) => fn;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base configuration interface for Fusion AI operations.
|
|
3
|
+
*
|
|
4
|
+
* This interface serves as the base type for all Fusion AI configuration objects.
|
|
5
|
+
* Implementations should extend this interface with specific configuration properties
|
|
6
|
+
* relevant to their use case. The configuration is typically created using
|
|
7
|
+
* `configureFusionAI` and loaded via `loadFusionAIConfig`.
|
|
8
|
+
*/
|
|
9
|
+
export interface FusionAIConfig {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -9,11 +9,8 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
configureFusionAI,
|
|
16
|
-
loadFusionAIConfig,
|
|
17
|
-
} from './config.js';
|
|
12
|
+
export type { FusionAIConfig } from './fusion-ai-config.js';
|
|
13
|
+
export { configureFusionAI } from './configure-fusion-ai.js';
|
|
14
|
+
export { type LoadFusionAIConfigOptions, loadFusionAIConfig } from './load-fusion-ai-config.js';
|
|
18
15
|
export { setupFramework, type FrameworkInstance } from './setup-framework.js';
|
|
19
|
-
export { registerAiPlugin } from './register.js';
|
|
16
|
+
export { registerAiPlugin } from './register-ai-plugin.js';
|
|
@@ -1,37 +1,5 @@
|
|
|
1
1
|
import { importConfig } from '@equinor/fusion-imports';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Base configuration interface for Fusion AI operations.
|
|
5
|
-
*
|
|
6
|
-
* This interface serves as the base type for all Fusion AI configuration objects.
|
|
7
|
-
* Implementations should extend this interface with specific configuration properties
|
|
8
|
-
* relevant to their use case. The configuration is typically created using
|
|
9
|
-
* `configureFusionAI` and loaded via `loadFusionAIConfig`.
|
|
10
|
-
*/
|
|
11
|
-
export interface FusionAIConfig {
|
|
12
|
-
[key: string]: unknown;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Configuration factory function for Fusion AI operations.
|
|
17
|
-
*
|
|
18
|
-
* This helper function provides type safety and consistency for creating AI configuration
|
|
19
|
-
* functions. It accepts a function that returns configuration (either synchronously or
|
|
20
|
-
* asynchronously) and returns it unchanged, providing a typed interface for consumers.
|
|
21
|
-
*
|
|
22
|
-
* @param fn - Function that returns Fusion AI configuration (sync or async)
|
|
23
|
-
* @returns The same configuration function, typed for use with loadFusionAIConfig
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* // fusion-ai.config.ts
|
|
28
|
-
* export default configureFusionAI(async () => ({
|
|
29
|
-
* apiKey: process.env.OPENAI_API_KEY,
|
|
30
|
-
* deployment: 'gpt-4',
|
|
31
|
-
* }));
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export const configureFusionAI = <T extends FusionAIConfig>(fn: () => Promise<T> | T) => fn;
|
|
2
|
+
import type { FusionAIConfig } from './fusion-ai-config.js';
|
|
35
3
|
|
|
36
4
|
/**
|
|
37
5
|
* Options controlling how {@link loadFusionAIConfig} resolves and imports the
|
|
@@ -58,6 +26,7 @@ export interface LoadFusionAIConfigOptions {
|
|
|
58
26
|
* The config file should export a function (via `configureFusionAI`) that returns
|
|
59
27
|
* the configuration object. The function can be synchronous or asynchronous.
|
|
60
28
|
*
|
|
29
|
+
* @template T - Shape of the resolved Fusion AI configuration object.
|
|
61
30
|
* @param configPath - Path to the config file without extension (default: 'fusion-ai.config')
|
|
62
31
|
* @param options - Optional parameters for loading the configuration
|
|
63
32
|
* @returns Promise resolving to the loaded and executed configuration
|
|
@@ -86,6 +55,7 @@ export async function loadFusionAIConfig<T extends FusionAIConfig = FusionAIConf
|
|
|
86
55
|
|
|
87
56
|
// Execute the configuration function (handles both sync and async)
|
|
88
57
|
const configFn = result.config;
|
|
58
|
+
// Config files export a function via configureFusionAI; execute it to resolve the value.
|
|
89
59
|
if (typeof configFn === 'function') {
|
|
90
60
|
return await configFn();
|
|
91
61
|
}
|
package/src/options/index.ts
CHANGED
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
|
|
13
13
|
export { default as options } from './options.js';
|
|
14
14
|
export { withOptions } from './with-options.js';
|
|
15
|
-
export { AiOptionsSchema, type AiOptionsType } from './schema.js';
|
|
15
|
+
export { AiOptionsSchema, type AiOptionsType } from './ai-options-schema.js';
|
|
16
16
|
export type { AiOptions } from './types.js';
|
package/src/options/options.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { createOption } from 'commander';
|
|
2
2
|
|
|
3
|
-
// Default Fusion AAD
|
|
3
|
+
// Default Fusion AAD tenant ID (same default as the CLI's auth options)
|
|
4
4
|
const DEFAULT_TENANT_ID = '3aa4a235-b6e2-48d5-9195-7fcf05b459b0' as const;
|
|
5
|
+
|
|
6
|
+
// Default Fusion AAD client ID (same default as the CLI's auth options)
|
|
5
7
|
const DEFAULT_CLIENT_ID = 'a318b8e1-0295-4e17-98d5-35f67dfeba14' as const;
|
|
8
|
+
|
|
6
9
|
const DEFAULT_MODEL_CHAT = 'gpt-5.1-chat' as const;
|
|
7
10
|
const DEFAULT_MODEL_EMBED = 'text-embedding-3-large' as const;
|
|
8
11
|
|
|
@@ -56,6 +59,13 @@ export const debugOption = createOption('-d, --debug', 'Enable debug mode for ve
|
|
|
56
59
|
.env('RUNNER_DEBUG')
|
|
57
60
|
.default(false);
|
|
58
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Aggregated Commander option definitions for Fusion AI CLI commands.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Individual options are defined above and re-exported here for convenient
|
|
67
|
+
* access as a single object.
|
|
68
|
+
*/
|
|
59
69
|
export default {
|
|
60
70
|
envOption,
|
|
61
71
|
tokenOption,
|
|
@@ -41,23 +41,29 @@ export const withOptions = (
|
|
|
41
41
|
command.addOption(clientIdOption);
|
|
42
42
|
command.addOption(debugOption);
|
|
43
43
|
|
|
44
|
+
// Optional options are only added when the corresponding feature flag is set.
|
|
44
45
|
if (args?.includeChat) command.addOption(chatModelOption);
|
|
46
|
+
// Embed option is opt-in via includeEmbedding.
|
|
45
47
|
if (args?.includeEmbedding) command.addOption(embedModelOption);
|
|
48
|
+
// Search option is opt-in via includeSearch.
|
|
46
49
|
if (args?.includeSearch) command.addOption(indexNameOption);
|
|
47
50
|
|
|
48
51
|
command.hook('preAction', (thisCommand) => {
|
|
49
52
|
const opts = thisCommand.opts();
|
|
50
53
|
|
|
54
|
+
// Enforce chat model presence when the chat option was requested.
|
|
51
55
|
if (args?.includeChat && !opts.chatModel?.trim()) {
|
|
52
56
|
throw new InvalidOptionArgumentError(
|
|
53
57
|
'Chat model name is required. Provide --chat-model or set FUSION_AI_CHAT_MODEL.',
|
|
54
58
|
);
|
|
55
59
|
}
|
|
60
|
+
// Enforce embed model presence when the embedding option was requested.
|
|
56
61
|
if (args?.includeEmbedding && !opts.embedModel?.trim()) {
|
|
57
62
|
throw new InvalidOptionArgumentError(
|
|
58
63
|
'Embedding model name is required. Provide --embed-model or set FUSION_AI_EMBED_MODEL.',
|
|
59
64
|
);
|
|
60
65
|
}
|
|
66
|
+
// Enforce index name presence when the search option was requested.
|
|
61
67
|
if (args?.includeSearch && !opts.indexName?.trim()) {
|
|
62
68
|
throw new InvalidOptionArgumentError(
|
|
63
69
|
'Index name is required. Provide --index-name or set FUSION_AI_INDEX_NAME.',
|
|
@@ -23,8 +23,9 @@ import { createCommand } from 'commander';
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export function registerAiPlugin(program: Command, command: Command): void {
|
|
26
|
-
//
|
|
26
|
+
// Look up an existing 'ai' command group before creating a new one.
|
|
27
27
|
let aiCommand = program.commands.find((cmd) => cmd.name() === 'ai');
|
|
28
|
+
// Create 'ai' command group if it doesn't exist
|
|
28
29
|
if (!aiCommand) {
|
|
29
30
|
aiCommand = createCommand('ai').description(
|
|
30
31
|
'Commands for interacting with AI models and Azure OpenAI services',
|
package/src/setup-framework.ts
CHANGED
|
@@ -32,6 +32,7 @@ export const setupFramework = async (options: AiOptions): Promise<FusionFramewor
|
|
|
32
32
|
|
|
33
33
|
const env = (options.env as FusionEnv) ?? FusionEnv.ContinuesIntegration;
|
|
34
34
|
|
|
35
|
+
// Surface resolved environment and auth mode when debug logging is enabled.
|
|
35
36
|
if (debug) {
|
|
36
37
|
console.debug('[debug] Environment:', env);
|
|
37
38
|
console.debug('[debug] Auth mode:', options.token ? 'static-token' : 'azure-identity');
|
|
@@ -39,6 +40,7 @@ export const setupFramework = async (options: AiOptions): Promise<FusionFramewor
|
|
|
39
40
|
|
|
40
41
|
/** Initialise the framework, resolve the AI service, and pre-cache tokens. */
|
|
41
42
|
const initAndSetup = async (): Promise<FusionFramework<[AIModule]>> => {
|
|
43
|
+
// Trace framework initialization start when debug logging is enabled.
|
|
42
44
|
if (debug) console.debug('[debug] Initializing framework with AI module…');
|
|
43
45
|
|
|
44
46
|
const framework = await initializeFramework<[AIModule]>({ env, auth }, (configurator) => {
|
|
@@ -50,6 +52,7 @@ export const setupFramework = async (options: AiOptions): Promise<FusionFramewor
|
|
|
50
52
|
const service = await framework.serviceDiscovery.resolveService('ai');
|
|
51
53
|
const scopes = service.scopes ?? service.defaultScopes ?? [];
|
|
52
54
|
|
|
55
|
+
// Surface resolved service URL and scopes when debug logging is enabled.
|
|
53
56
|
if (debug) {
|
|
54
57
|
console.debug('[debug] AI service URL:', service.uri);
|
|
55
58
|
console.debug('[debug] AI service scopes:', scopes);
|
|
@@ -58,8 +61,10 @@ export const setupFramework = async (options: AiOptions): Promise<FusionFramewor
|
|
|
58
61
|
// Pre-cache a token for the AI service scopes so strategy callbacks
|
|
59
62
|
// don't attempt (and fail) a silent acquisition later.
|
|
60
63
|
const token = await framework.auth.acquireAccessToken({ request: { scopes } });
|
|
64
|
+
// Guard: acquireAccessToken can resolve falsy when the token cache is empty.
|
|
61
65
|
if (!token) throw new Error('Failed to acquire access token for the AI service.');
|
|
62
66
|
|
|
67
|
+
// Trace successful token acquisition when debug logging is enabled.
|
|
63
68
|
if (debug) console.debug('[debug] Token acquired successfully');
|
|
64
69
|
|
|
65
70
|
return framework;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '4.0.
|
|
2
|
+
export const version = '4.0.6';
|
package/dist/esm/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAcvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAA2B,EAAwB,EAAE,EAAE,CAAC,EAAE,CAAC;AAqB5F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,aAAqB,kBAAkB,EACvC,UAAqC,EAAE;IAEvC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAExD,gFAAgF;IAChF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAuB,UAAU,EAAE;QAClE,OAAO;QACP,UAAU;KACX,CAAC,CAAC;IAEH,mEAAmE;IACnE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO,MAAM,QAAQ,EAAE,CAAC;IAC1B,CAAC;IACD,sEAAsE;IACtE,OAAO,QAAa,CAAC;AACvB,CAAC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/options/schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACzC,CAAC;KACD,QAAQ,CAAC,gCAAgC,CAAC,CAAC"}
|
package/dist/esm/register.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,OAAgB;IACjE,gDAAgD;IAChD,IAAI,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC;IACpE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,WAAW,CACzC,mEAAmE,CACpE,CAAC;QACF,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IAED,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
File without changes
|
|
File without changes
|