@memberjunction/ng-agent-client 0.0.1 → 5.22.0

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.
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "@angular/common";
3
+ export declare class AgentClientModule {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<AgentClientModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AgentClientModule, never, [typeof i1.CommonModule], never>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<AgentClientModule>;
7
+ }
8
+ //# sourceMappingURL=agent-client.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-client.module.d.ts","sourceRoot":"","sources":["../../src/lib/agent-client.module.ts"],"names":[],"mappings":";;AASA,qBAKa,iBAAiB;yCAAjB,iBAAiB;0CAAjB,iBAAiB;0CAAjB,iBAAiB;CAAG"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @fileoverview Angular module for the Agent Client adapter.
3
+ *
4
+ * @module @memberjunction/ng-agent-client
5
+ */
6
+ import { NgModule } from '@angular/core';
7
+ import { CommonModule } from '@angular/common';
8
+ import * as i0 from "@angular/core";
9
+ export class AgentClientModule {
10
+ static ɵfac = function AgentClientModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AgentClientModule)(); };
11
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AgentClientModule });
12
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule] });
13
+ }
14
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AgentClientModule, [{
15
+ type: NgModule,
16
+ args: [{
17
+ imports: [CommonModule],
18
+ declarations: [],
19
+ exports: [],
20
+ }]
21
+ }], null, null); })();
22
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AgentClientModule, { imports: [CommonModule] }); })();
23
+ //# sourceMappingURL=agent-client.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-client.module.js","sourceRoot":"","sources":["../../src/lib/agent-client.module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;;AAO/C,MAAM,OAAO,iBAAiB;2GAAjB,iBAAiB;4DAAjB,iBAAiB;gEAJhB,YAAY;;iFAIb,iBAAiB;cAL7B,QAAQ;eAAC;gBACN,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,EAAE;aACd;;wFACY,iBAAiB,cAJhB,YAAY","sourcesContent":["/**\n * @fileoverview Angular module for the Agent Client adapter.\n *\n * @module @memberjunction/ng-agent-client\n */\n\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [],\n exports: [],\n})\nexport class AgentClientModule {}\n"]}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @fileoverview Angular adapter for the MJ Agent Client SDK.
3
+ *
4
+ * Provides an injectable service that wraps AgentClientSession with
5
+ * RxJS observables for reactive Angular consumption.
6
+ *
7
+ * @module @memberjunction/ng-agent-client
8
+ */
9
+ import { OnDestroy } from '@angular/core';
10
+ import { BehaviorSubject, Subject } from 'rxjs';
11
+ import { ClientToolDefinition, AgentMessage, AgentProgress, AgentError, ClientToolRequest, TransportOptions } from '@memberjunction/ai-agent-client';
12
+ import * as i0 from "@angular/core";
13
+ /**
14
+ * Angular injectable service that wraps the framework-agnostic Agent Client SDK.
15
+ *
16
+ * Provides RxJS observable bridges for agent messages, progress, and connection state.
17
+ * Pre-registers built-in navigation and component tools.
18
+ */
19
+ export declare class AgentClientService implements OnDestroy {
20
+ private session;
21
+ private toolRegistry;
22
+ private router;
23
+ /** Stream of all agent messages received during the session */
24
+ AgentMessages$: BehaviorSubject<AgentMessage[]>;
25
+ /** Whether the client is currently connected to an agent */
26
+ IsConnected$: BehaviorSubject<boolean>;
27
+ /** Stream of agent progress updates */
28
+ Progress$: Subject<AgentProgress>;
29
+ /** Stream of agent errors */
30
+ Errors$: Subject<AgentError>;
31
+ /** Stream of client tool requests (for UI visualization) */
32
+ ToolRequests$: Subject<ClientToolRequest>;
33
+ constructor();
34
+ /**
35
+ * Connect to an agent using WebSocket transport.
36
+ *
37
+ * @param url - The WebSocket URL of the agent server
38
+ * @param agentId - The ID of the agent to connect to
39
+ * @param conversationId - Optional existing conversation to resume
40
+ * @param options - Optional transport options (auth, reconnection)
41
+ */
42
+ ConnectToAgent(url: string, agentId: string, conversationId?: string, options?: TransportOptions): Promise<void>;
43
+ /**
44
+ * Send a user message to the connected agent.
45
+ */
46
+ SendMessage(content: string): Promise<void>;
47
+ /**
48
+ * Disconnect from the current agent session.
49
+ */
50
+ Disconnect(): Promise<void>;
51
+ /**
52
+ * Register a custom client-side tool.
53
+ */
54
+ RegisterTool(tool: ClientToolDefinition): void;
55
+ /**
56
+ * Get the current conversation ID.
57
+ */
58
+ get ConversationId(): string | null;
59
+ /**
60
+ * Clean up on service destruction.
61
+ */
62
+ ngOnDestroy(): void;
63
+ /**
64
+ * Set up event handlers on the session that feed into RxJS observables.
65
+ */
66
+ private setupSessionHandlers;
67
+ /**
68
+ * Register built-in navigation and component tools.
69
+ */
70
+ private registerBuiltInTools;
71
+ static ɵfac: i0.ɵɵFactoryDeclaration<AgentClientService, never>;
72
+ static ɵprov: i0.ɵɵInjectableDeclaration<AgentClientService>;
73
+ }
74
+ //# sourceMappingURL=agent-client.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-client.service.d.ts","sourceRoot":"","sources":["../../src/lib/agent-client.service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAc,SAAS,EAAU,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAIH,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EACnB,MAAM,iCAAiC,CAAC;;AAEzC;;;;;GAKG;AACH,qBACa,kBAAmB,YAAW,SAAS;IAChD,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,MAAM,CAAkB;IAEhC,+DAA+D;IACxD,cAAc,kCAA2C;IAEhE,4DAA4D;IACrD,YAAY,2BAAuC;IAE1D,uCAAuC;IAChC,SAAS,yBAAgC;IAEhD,6BAA6B;IACtB,OAAO,sBAA6B;IAE3C,4DAA4D;IACrD,aAAa,6BAAoC;;IAMxD;;;;;;;OAOG;IACU,cAAc,CACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,gBAAgB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAchB;;OAEG;IACU,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxD;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASxC;;OAEG;IACI,YAAY,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI;IAIrD;;OAEG;IACH,IAAW,cAAc,IAAI,MAAM,GAAG,IAAI,CAEzC;IAED;;OAEG;IACI,WAAW,IAAI,IAAI;IAU1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;yCAlInB,kBAAkB;6CAAlB,kBAAkB;CAwL9B"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * @fileoverview Angular adapter for the MJ Agent Client SDK.
3
+ *
4
+ * Provides an injectable service that wraps AgentClientSession with
5
+ * RxJS observables for reactive Angular consumption.
6
+ *
7
+ * @module @memberjunction/ng-agent-client
8
+ */
9
+ import { Injectable, inject } from '@angular/core';
10
+ import { Router } from '@angular/router';
11
+ import { BehaviorSubject, Subject } from 'rxjs';
12
+ import { AgentClientSession, ClientToolRegistry, WebSocketTransport, } from '@memberjunction/ai-agent-client';
13
+ import * as i0 from "@angular/core";
14
+ /**
15
+ * Angular injectable service that wraps the framework-agnostic Agent Client SDK.
16
+ *
17
+ * Provides RxJS observable bridges for agent messages, progress, and connection state.
18
+ * Pre-registers built-in navigation and component tools.
19
+ */
20
+ export class AgentClientService {
21
+ session = null;
22
+ toolRegistry = new ClientToolRegistry();
23
+ router = inject(Router);
24
+ /** Stream of all agent messages received during the session */
25
+ AgentMessages$ = new BehaviorSubject([]);
26
+ /** Whether the client is currently connected to an agent */
27
+ IsConnected$ = new BehaviorSubject(false);
28
+ /** Stream of agent progress updates */
29
+ Progress$ = new Subject();
30
+ /** Stream of agent errors */
31
+ Errors$ = new Subject();
32
+ /** Stream of client tool requests (for UI visualization) */
33
+ ToolRequests$ = new Subject();
34
+ constructor() {
35
+ this.registerBuiltInTools();
36
+ }
37
+ /**
38
+ * Connect to an agent using WebSocket transport.
39
+ *
40
+ * @param url - The WebSocket URL of the agent server
41
+ * @param agentId - The ID of the agent to connect to
42
+ * @param conversationId - Optional existing conversation to resume
43
+ * @param options - Optional transport options (auth, reconnection)
44
+ */
45
+ async ConnectToAgent(url, agentId, conversationId, options) {
46
+ // Clean up any existing session
47
+ await this.Disconnect();
48
+ const transport = new WebSocketTransport();
49
+ await transport.Connect(url, options);
50
+ this.session = new AgentClientSession(transport, this.toolRegistry);
51
+ this.setupSessionHandlers();
52
+ await this.session.Connect(agentId, conversationId);
53
+ this.IsConnected$.next(true);
54
+ }
55
+ /**
56
+ * Send a user message to the connected agent.
57
+ */
58
+ async SendMessage(content) {
59
+ if (!this.session) {
60
+ throw new Error('Not connected to an agent. Call ConnectToAgent() first.');
61
+ }
62
+ await this.session.SendMessage(content);
63
+ }
64
+ /**
65
+ * Disconnect from the current agent session.
66
+ */
67
+ async Disconnect() {
68
+ if (this.session) {
69
+ await this.session.Disconnect();
70
+ this.session = null;
71
+ this.IsConnected$.next(false);
72
+ this.AgentMessages$.next([]);
73
+ }
74
+ }
75
+ /**
76
+ * Register a custom client-side tool.
77
+ */
78
+ RegisterTool(tool) {
79
+ this.toolRegistry.Register(tool);
80
+ }
81
+ /**
82
+ * Get the current conversation ID.
83
+ */
84
+ get ConversationId() {
85
+ return this.session?.ConversationId ?? null;
86
+ }
87
+ /**
88
+ * Clean up on service destruction.
89
+ */
90
+ ngOnDestroy() {
91
+ // Fire-and-forget disconnect on destroy
92
+ this.Disconnect().catch(() => { });
93
+ this.AgentMessages$.complete();
94
+ this.IsConnected$.complete();
95
+ this.Progress$.complete();
96
+ this.Errors$.complete();
97
+ this.ToolRequests$.complete();
98
+ }
99
+ /**
100
+ * Set up event handlers on the session that feed into RxJS observables.
101
+ */
102
+ setupSessionHandlers() {
103
+ if (!this.session)
104
+ return;
105
+ this.session.OnAgentMessage((msg) => {
106
+ const current = this.AgentMessages$.value;
107
+ this.AgentMessages$.next([...current, msg]);
108
+ });
109
+ this.session.OnProgress((progress) => {
110
+ this.Progress$.next(progress);
111
+ });
112
+ this.session.OnError((error) => {
113
+ this.Errors$.next(error);
114
+ if (error.Code === 'DISCONNECTED') {
115
+ this.IsConnected$.next(false);
116
+ }
117
+ });
118
+ this.session.OnToolRequest((req) => {
119
+ this.ToolRequests$.next(req);
120
+ });
121
+ }
122
+ /**
123
+ * Register built-in navigation and component tools.
124
+ */
125
+ registerBuiltInTools() {
126
+ this.toolRegistry.Register({
127
+ Name: 'navigate_to_record',
128
+ Description: 'Navigate the browser to a specific entity record in MJ Explorer',
129
+ ParameterSchema: {
130
+ type: 'object',
131
+ properties: {
132
+ EntityName: { type: 'string' },
133
+ RecordID: { type: 'string' },
134
+ },
135
+ required: ['EntityName', 'RecordID'],
136
+ },
137
+ Handler: async (params) => {
138
+ const entityName = String(params['EntityName']);
139
+ const recordId = String(params['RecordID']);
140
+ await this.router.navigate(['/resource', 'entity', entityName, recordId]);
141
+ return { Success: true, Data: { Navigated: true } };
142
+ },
143
+ });
144
+ this.toolRegistry.Register({
145
+ Name: 'navigate_to_app',
146
+ Description: 'Switch to a different MJ Explorer application',
147
+ ParameterSchema: {
148
+ type: 'object',
149
+ properties: {
150
+ AppName: { type: 'string' },
151
+ },
152
+ required: ['AppName'],
153
+ },
154
+ Handler: async (params) => {
155
+ const appName = String(params['AppName']);
156
+ await this.router.navigate(['/app', appName]);
157
+ return { Success: true, Data: { Navigated: true } };
158
+ },
159
+ });
160
+ this.toolRegistry.Register({
161
+ Name: 'navigate_to_tab',
162
+ Description: 'Switch to a specific tab within the current application',
163
+ ParameterSchema: {
164
+ type: 'object',
165
+ properties: {
166
+ TabName: { type: 'string' },
167
+ },
168
+ required: ['TabName'],
169
+ },
170
+ Handler: async (params) => {
171
+ // Tab navigation is handled via the app's internal routing
172
+ const tabName = String(params['TabName']);
173
+ return { Success: true, Data: { TabName: tabName, Note: 'Tab switch requested' } };
174
+ },
175
+ });
176
+ }
177
+ static ɵfac = function AgentClientService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AgentClientService)(); };
178
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AgentClientService, factory: AgentClientService.ɵfac, providedIn: 'root' });
179
+ }
180
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AgentClientService, [{
181
+ type: Injectable,
182
+ args: [{ providedIn: 'root' }]
183
+ }], () => [], null); })();
184
+ //# sourceMappingURL=agent-client.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-client.service.js","sourceRoot":"","sources":["../../src/lib/agent-client.service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,E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C;aACxB;YACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBACtB,2DAA2D;gBAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAAE,CAAC;YACvF,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;4GAvLQ,kBAAkB;gEAAlB,kBAAkB,WAAlB,kBAAkB,mBADL,MAAM;;iFACnB,kBAAkB;cAD9B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["/**\n * @fileoverview Angular adapter for the MJ Agent Client SDK.\n *\n * Provides an injectable service that wraps AgentClientSession with\n * RxJS observables for reactive Angular consumption.\n *\n * @module @memberjunction/ng-agent-client\n */\n\nimport { Injectable, OnDestroy, inject } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { BehaviorSubject, Subject } from 'rxjs';\nimport {\n AgentClientSession,\n ClientToolRegistry,\n WebSocketTransport,\n ClientToolDefinition,\n AgentMessage,\n AgentProgress,\n AgentError,\n ClientToolRequest,\n TransportOptions,\n} from '@memberjunction/ai-agent-client';\n\n/**\n * Angular injectable service that wraps the framework-agnostic Agent Client SDK.\n *\n * Provides RxJS observable bridges for agent messages, progress, and connection state.\n * Pre-registers built-in navigation and component tools.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentClientService implements OnDestroy {\n private session: AgentClientSession | null = null;\n private toolRegistry = new ClientToolRegistry();\n private router = inject(Router);\n\n /** Stream of all agent messages received during the session */\n public AgentMessages$ = new BehaviorSubject<AgentMessage[]>([]);\n\n /** Whether the client is currently connected to an agent */\n public IsConnected$ = new BehaviorSubject<boolean>(false);\n\n /** Stream of agent progress updates */\n public Progress$ = new Subject<AgentProgress>();\n\n /** Stream of agent errors */\n public Errors$ = new Subject<AgentError>();\n\n /** Stream of client tool requests (for UI visualization) */\n public ToolRequests$ = new Subject<ClientToolRequest>();\n\n constructor() {\n this.registerBuiltInTools();\n }\n\n /**\n * Connect to an agent using WebSocket transport.\n *\n * @param url - The WebSocket URL of the agent server\n * @param agentId - The ID of the agent to connect to\n * @param conversationId - Optional existing conversation to resume\n * @param options - Optional transport options (auth, reconnection)\n */\n public async ConnectToAgent(\n url: string,\n agentId: string,\n conversationId?: string,\n options?: TransportOptions\n ): Promise<void> {\n // Clean up any existing session\n await this.Disconnect();\n\n const transport = new WebSocketTransport();\n await transport.Connect(url, options);\n\n this.session = new AgentClientSession(transport, this.toolRegistry);\n this.setupSessionHandlers();\n\n await this.session.Connect(agentId, conversationId);\n this.IsConnected$.next(true);\n }\n\n /**\n * Send a user message to the connected agent.\n */\n public async SendMessage(content: string): Promise<void> {\n if (!this.session) {\n throw new Error('Not connected to an agent. Call ConnectToAgent() first.');\n }\n await this.session.SendMessage(content);\n }\n\n /**\n * Disconnect from the current agent session.\n */\n public async Disconnect(): Promise<void> {\n if (this.session) {\n await this.session.Disconnect();\n this.session = null;\n this.IsConnected$.next(false);\n this.AgentMessages$.next([]);\n }\n }\n\n /**\n * Register a custom client-side tool.\n */\n public RegisterTool(tool: ClientToolDefinition): void {\n this.toolRegistry.Register(tool);\n }\n\n /**\n * Get the current conversation ID.\n */\n public get ConversationId(): string | null {\n return this.session?.ConversationId ?? null;\n }\n\n /**\n * Clean up on service destruction.\n */\n public ngOnDestroy(): void {\n // Fire-and-forget disconnect on destroy\n this.Disconnect().catch(() => { /* intentional: best-effort cleanup */ });\n this.AgentMessages$.complete();\n this.IsConnected$.complete();\n this.Progress$.complete();\n this.Errors$.complete();\n this.ToolRequests$.complete();\n }\n\n /**\n * Set up event handlers on the session that feed into RxJS observables.\n */\n private setupSessionHandlers(): void {\n if (!this.session) return;\n\n this.session.OnAgentMessage((msg) => {\n const current = this.AgentMessages$.value;\n this.AgentMessages$.next([...current, msg]);\n });\n\n this.session.OnProgress((progress) => {\n this.Progress$.next(progress);\n });\n\n this.session.OnError((error) => {\n this.Errors$.next(error);\n if (error.Code === 'DISCONNECTED') {\n this.IsConnected$.next(false);\n }\n });\n\n this.session.OnToolRequest((req) => {\n this.ToolRequests$.next(req);\n });\n }\n\n /**\n * Register built-in navigation and component tools.\n */\n private registerBuiltInTools(): void {\n this.toolRegistry.Register({\n Name: 'navigate_to_record',\n Description: 'Navigate the browser to a specific entity record in MJ Explorer',\n ParameterSchema: {\n type: 'object',\n properties: {\n EntityName: { type: 'string' },\n RecordID: { type: 'string' },\n },\n required: ['EntityName', 'RecordID'],\n },\n Handler: async (params) => {\n const entityName = String(params['EntityName']);\n const recordId = String(params['RecordID']);\n await this.router.navigate(['/resource', 'entity', entityName, recordId]);\n return { Success: true, Data: { Navigated: true } };\n },\n });\n\n this.toolRegistry.Register({\n Name: 'navigate_to_app',\n Description: 'Switch to a different MJ Explorer application',\n ParameterSchema: {\n type: 'object',\n properties: {\n AppName: { type: 'string' },\n },\n required: ['AppName'],\n },\n Handler: async (params) => {\n const appName = String(params['AppName']);\n await this.router.navigate(['/app', appName]);\n return { Success: true, Data: { Navigated: true } };\n },\n });\n\n this.toolRegistry.Register({\n Name: 'navigate_to_tab',\n Description: 'Switch to a specific tab within the current application',\n ParameterSchema: {\n type: 'object',\n properties: {\n TabName: { type: 'string' },\n },\n required: ['TabName'],\n },\n Handler: async (params) => {\n // Tab navigation is handled via the app's internal routing\n const tabName = String(params['TabName']);\n return { Success: true, Data: { TabName: tabName, Note: 'Tab switch requested' } };\n },\n });\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview Component interaction tool definitions for the Angular Agent Client.
3
+ *
4
+ * Pre-built tool definitions for manipulating Knowledge Hub UI components
5
+ * from agent commands (opening panels, applying filters, etc.).
6
+ *
7
+ * @module @memberjunction/ng-agent-client
8
+ */
9
+ import { ClientToolDefinition } from '@memberjunction/ai-agent-client';
10
+ /**
11
+ * Create an "open_search_panel" tool definition.
12
+ * Opens or focuses the search panel in the Knowledge Hub.
13
+ */
14
+ export declare function CreateOpenSearchPanelTool(): ClientToolDefinition;
15
+ /**
16
+ * Create an "apply_search_filter" tool definition.
17
+ * Applies filters to the current Knowledge Hub search results.
18
+ */
19
+ export declare function CreateApplySearchFilterTool(): ClientToolDefinition;
20
+ /**
21
+ * Create a "show_entity_details" tool definition.
22
+ * Opens a details panel for a specific entity record.
23
+ */
24
+ export declare function CreateShowEntityDetailsTool(): ClientToolDefinition;
25
+ //# sourceMappingURL=component-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-tool.d.ts","sourceRoot":"","sources":["../../../src/lib/tools/component-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAoB,MAAM,iCAAiC,CAAC;AAEzF;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,oBAAoB,CAoBhE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,oBAAoB,CAoClE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,oBAAoB,CAuBlE"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @fileoverview Component interaction tool definitions for the Angular Agent Client.
3
+ *
4
+ * Pre-built tool definitions for manipulating Knowledge Hub UI components
5
+ * from agent commands (opening panels, applying filters, etc.).
6
+ *
7
+ * @module @memberjunction/ng-agent-client
8
+ */
9
+ /**
10
+ * Create an "open_search_panel" tool definition.
11
+ * Opens or focuses the search panel in the Knowledge Hub.
12
+ */
13
+ export function CreateOpenSearchPanelTool() {
14
+ return {
15
+ Name: 'open_search_panel',
16
+ Description: 'Open or focus the search panel in the Knowledge Hub',
17
+ ParameterSchema: {
18
+ type: 'object',
19
+ properties: {
20
+ Query: { type: 'string', description: 'Optional search query to pre-fill' },
21
+ },
22
+ },
23
+ Handler: async (params) => {
24
+ const query = params['Query'] != null ? String(params['Query']) : undefined;
25
+ // In a real implementation, this would emit an event picked up by the
26
+ // Knowledge Hub shell component. For now, return success with the intent.
27
+ return {
28
+ Success: true,
29
+ Data: { Action: 'open_search_panel', Query: query },
30
+ };
31
+ },
32
+ };
33
+ }
34
+ /**
35
+ * Create an "apply_search_filter" tool definition.
36
+ * Applies filters to the current Knowledge Hub search results.
37
+ */
38
+ export function CreateApplySearchFilterTool() {
39
+ return {
40
+ Name: 'apply_search_filter',
41
+ Description: 'Apply filters to the current Knowledge Hub search results',
42
+ ParameterSchema: {
43
+ type: 'object',
44
+ properties: {
45
+ EntityNames: {
46
+ type: 'array',
47
+ items: { type: 'string' },
48
+ description: 'Filter to specific entity names',
49
+ },
50
+ SourceTypes: {
51
+ type: 'array',
52
+ items: { type: 'string' },
53
+ description: 'Filter to specific source types',
54
+ },
55
+ Tags: {
56
+ type: 'array',
57
+ items: { type: 'string' },
58
+ description: 'Filter to specific tags',
59
+ },
60
+ },
61
+ },
62
+ Handler: async (params) => {
63
+ return {
64
+ Success: true,
65
+ Data: {
66
+ Action: 'apply_search_filter',
67
+ EntityNames: params['EntityNames'],
68
+ SourceTypes: params['SourceTypes'],
69
+ Tags: params['Tags'],
70
+ },
71
+ };
72
+ },
73
+ };
74
+ }
75
+ /**
76
+ * Create a "show_entity_details" tool definition.
77
+ * Opens a details panel for a specific entity record.
78
+ */
79
+ export function CreateShowEntityDetailsTool() {
80
+ return {
81
+ Name: 'show_entity_details',
82
+ Description: 'Open a details panel for a specific entity record',
83
+ ParameterSchema: {
84
+ type: 'object',
85
+ properties: {
86
+ EntityName: { type: 'string', description: 'The MJ entity name' },
87
+ RecordID: { type: 'string', description: 'The record ID to show details for' },
88
+ },
89
+ required: ['EntityName', 'RecordID'],
90
+ },
91
+ Handler: async (params) => {
92
+ return {
93
+ Success: true,
94
+ Data: {
95
+ Action: 'show_entity_details',
96
+ EntityName: String(params['EntityName']),
97
+ RecordID: String(params['RecordID']),
98
+ },
99
+ };
100
+ },
101
+ };
102
+ }
103
+ //# sourceMappingURL=component-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-tool.js","sourceRoot":"","sources":["../../../src/lib/tools/component-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;GAGG;AACH,MAAM,UAAU,yBAAyB;IACrC,OAAO;QACH,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,qDAAqD;QAClE,eAAe,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;aAC9E;SACJ;QACD,OAAO,EAAE,KAAK,EAAE,MAA+B,EAA6B,EAAE;YAC1E,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC5E,sEAAsE;YACtE,0EAA0E;YAC1E,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE;aACtD,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B;IACvC,OAAO;QACH,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,2DAA2D;QACxE,eAAe,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,WAAW,EAAE;oBACT,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,WAAW,EAAE,iCAAiC;iBACjD;gBACD,WAAW,EAAE;oBACT,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,WAAW,EAAE,iCAAiC;iBACjD;gBACD,IAAI,EAAE;oBACF,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,WAAW,EAAE,yBAAyB;iBACzC;aACJ;SACJ;QACD,OAAO,EAAE,KAAK,EAAE,MAA+B,EAA6B,EAAE;YAC1E,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE;oBACF,MAAM,EAAE,qBAAqB;oBAC7B,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC;oBAClC,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC;oBAClC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;iBACvB;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B;IACvC,OAAO;QACH,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,mDAAmD;QAChE,eAAe,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;gBACjE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;aACjF;YACD,QAAQ,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC;SACvC;QACD,OAAO,EAAE,KAAK,EAAE,MAA+B,EAA6B,EAAE;YAC1E,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE;oBACF,MAAM,EAAE,qBAAqB;oBAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;oBACxC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;iBACvC;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["/**\n * @fileoverview Component interaction tool definitions for the Angular Agent Client.\n *\n * Pre-built tool definitions for manipulating Knowledge Hub UI components\n * from agent commands (opening panels, applying filters, etc.).\n *\n * @module @memberjunction/ng-agent-client\n */\n\nimport { ClientToolDefinition, ClientToolResult } from '@memberjunction/ai-agent-client';\n\n/**\n * Create an \"open_search_panel\" tool definition.\n * Opens or focuses the search panel in the Knowledge Hub.\n */\nexport function CreateOpenSearchPanelTool(): ClientToolDefinition {\n return {\n Name: 'open_search_panel',\n Description: 'Open or focus the search panel in the Knowledge Hub',\n ParameterSchema: {\n type: 'object',\n properties: {\n Query: { type: 'string', description: 'Optional search query to pre-fill' },\n },\n },\n Handler: async (params: Record<string, unknown>): Promise<ClientToolResult> => {\n const query = params['Query'] != null ? String(params['Query']) : undefined;\n // In a real implementation, this would emit an event picked up by the\n // Knowledge Hub shell component. For now, return success with the intent.\n return {\n Success: true,\n Data: { Action: 'open_search_panel', Query: query },\n };\n },\n };\n}\n\n/**\n * Create an \"apply_search_filter\" tool definition.\n * Applies filters to the current Knowledge Hub search results.\n */\nexport function CreateApplySearchFilterTool(): ClientToolDefinition {\n return {\n Name: 'apply_search_filter',\n Description: 'Apply filters to the current Knowledge Hub search results',\n ParameterSchema: {\n type: 'object',\n properties: {\n EntityNames: {\n type: 'array',\n items: { type: 'string' },\n description: 'Filter to specific entity names',\n },\n SourceTypes: {\n type: 'array',\n items: { type: 'string' },\n description: 'Filter to specific source types',\n },\n Tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Filter to specific tags',\n },\n },\n },\n Handler: async (params: Record<string, unknown>): Promise<ClientToolResult> => {\n return {\n Success: true,\n Data: {\n Action: 'apply_search_filter',\n EntityNames: params['EntityNames'],\n SourceTypes: params['SourceTypes'],\n Tags: params['Tags'],\n },\n };\n },\n };\n}\n\n/**\n * Create a \"show_entity_details\" tool definition.\n * Opens a details panel for a specific entity record.\n */\nexport function CreateShowEntityDetailsTool(): ClientToolDefinition {\n return {\n Name: 'show_entity_details',\n Description: 'Open a details panel for a specific entity record',\n ParameterSchema: {\n type: 'object',\n properties: {\n EntityName: { type: 'string', description: 'The MJ entity name' },\n RecordID: { type: 'string', description: 'The record ID to show details for' },\n },\n required: ['EntityName', 'RecordID'],\n },\n Handler: async (params: Record<string, unknown>): Promise<ClientToolResult> => {\n return {\n Success: true,\n Data: {\n Action: 'show_entity_details',\n EntityName: String(params['EntityName']),\n RecordID: String(params['RecordID']),\n },\n };\n },\n };\n}\n"]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @fileoverview Navigation tool definitions for the Angular Agent Client.
3
+ *
4
+ * Pre-built tool definitions for navigating MJ Explorer from agent commands.
5
+ * These are registered automatically by the AgentClientService.
6
+ *
7
+ * @module @memberjunction/ng-agent-client
8
+ */
9
+ import { Router } from '@angular/router';
10
+ import { ClientToolDefinition } from '@memberjunction/ai-agent-client';
11
+ /**
12
+ * Create a "navigate_to_record" tool definition bound to a specific Angular Router.
13
+ */
14
+ export declare function CreateNavigateToRecordTool(router: Router): ClientToolDefinition;
15
+ /**
16
+ * Create a "navigate_to_app" tool definition bound to a specific Angular Router.
17
+ */
18
+ export declare function CreateNavigateToAppTool(router: Router): ClientToolDefinition;
19
+ //# sourceMappingURL=navigation-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-tool.d.ts","sourceRoot":"","sources":["../../../src/lib/tools/navigation-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAoB,MAAM,iCAAiC,CAAC;AAEzF;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAyB/E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAuB5E"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @fileoverview Navigation tool definitions for the Angular Agent Client.
3
+ *
4
+ * Pre-built tool definitions for navigating MJ Explorer from agent commands.
5
+ * These are registered automatically by the AgentClientService.
6
+ *
7
+ * @module @memberjunction/ng-agent-client
8
+ */
9
+ /**
10
+ * Create a "navigate_to_record" tool definition bound to a specific Angular Router.
11
+ */
12
+ export function CreateNavigateToRecordTool(router) {
13
+ return {
14
+ Name: 'navigate_to_record',
15
+ Description: 'Navigate the browser to a specific entity record in MJ Explorer',
16
+ ParameterSchema: {
17
+ type: 'object',
18
+ properties: {
19
+ EntityName: { type: 'string', description: 'The MJ entity name' },
20
+ RecordID: { type: 'string', description: 'The record ID to navigate to' },
21
+ },
22
+ required: ['EntityName', 'RecordID'],
23
+ },
24
+ Handler: async (params) => {
25
+ const entityName = String(params['EntityName']);
26
+ const recordId = String(params['RecordID']);
27
+ try {
28
+ await router.navigate(['/resource', 'entity', entityName, recordId]);
29
+ return { Success: true, Data: { Navigated: true, EntityName: entityName, RecordID: recordId } };
30
+ }
31
+ catch (error) {
32
+ const message = error instanceof Error ? error.message : String(error);
33
+ return { Success: false, ErrorMessage: `Navigation failed: ${message}` };
34
+ }
35
+ },
36
+ };
37
+ }
38
+ /**
39
+ * Create a "navigate_to_app" tool definition bound to a specific Angular Router.
40
+ */
41
+ export function CreateNavigateToAppTool(router) {
42
+ return {
43
+ Name: 'navigate_to_app',
44
+ Description: 'Switch to a different MJ Explorer application by name',
45
+ ParameterSchema: {
46
+ type: 'object',
47
+ properties: {
48
+ AppName: { type: 'string', description: 'The application name to switch to' },
49
+ },
50
+ required: ['AppName'],
51
+ },
52
+ Handler: async (params) => {
53
+ const appName = String(params['AppName']);
54
+ try {
55
+ await router.navigate(['/app', appName]);
56
+ return { Success: true, Data: { Navigated: true, AppName: appName } };
57
+ }
58
+ catch (error) {
59
+ const message = error instanceof Error ? error.message : String(error);
60
+ return { Success: false, ErrorMessage: `Navigation failed: ${message}` };
61
+ }
62
+ },
63
+ };
64
+ }
65
+ //# sourceMappingURL=navigation-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-tool.js","sourceRoot":"","sources":["../../../src/lib/tools/navigation-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC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;QACpE,eAAe,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;aAChF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACxB;QACD,OAAO,EAAE,KAAK,EAAE,MAA+B,EAA6B,EAAE;YAC1E,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;YAE1C,IAAI,CAAC;gBACD,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;gBACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;YAC1E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,sBAAsB,OAAO,EAAE,EAAE,CAAC;YAC7E,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["/**\n * @fileoverview Navigation tool definitions for the Angular Agent Client.\n *\n * Pre-built tool definitions for navigating MJ Explorer from agent commands.\n * These are registered automatically by the AgentClientService.\n *\n * @module @memberjunction/ng-agent-client\n */\n\nimport { Router } from '@angular/router';\nimport { ClientToolDefinition, ClientToolResult } from '@memberjunction/ai-agent-client';\n\n/**\n * Create a \"navigate_to_record\" tool definition bound to a specific Angular Router.\n */\nexport function CreateNavigateToRecordTool(router: Router): ClientToolDefinition {\n return {\n Name: 'navigate_to_record',\n Description: 'Navigate the browser to a specific entity record in MJ Explorer',\n ParameterSchema: {\n type: 'object',\n properties: {\n EntityName: { type: 'string', description: 'The MJ entity name' },\n RecordID: { type: 'string', description: 'The record ID to navigate to' },\n },\n required: ['EntityName', 'RecordID'],\n },\n Handler: async (params: Record<string, unknown>): Promise<ClientToolResult> => {\n const entityName = String(params['EntityName']);\n const recordId = String(params['RecordID']);\n\n try {\n await router.navigate(['/resource', 'entity', entityName, recordId]);\n return { Success: true, Data: { Navigated: true, EntityName: entityName, RecordID: recordId } };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { Success: false, ErrorMessage: `Navigation failed: ${message}` };\n }\n },\n };\n}\n\n/**\n * Create a \"navigate_to_app\" tool definition bound to a specific Angular Router.\n */\nexport function CreateNavigateToAppTool(router: Router): ClientToolDefinition {\n return {\n Name: 'navigate_to_app',\n Description: 'Switch to a different MJ Explorer application by name',\n ParameterSchema: {\n type: 'object',\n properties: {\n AppName: { type: 'string', description: 'The application name to switch to' },\n },\n required: ['AppName'],\n },\n Handler: async (params: Record<string, unknown>): Promise<ClientToolResult> => {\n const appName = String(params['AppName']);\n\n try {\n await router.navigate(['/app', appName]);\n return { Success: true, Data: { Navigated: true, AppName: appName } };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { Success: false, ErrorMessage: `Navigation failed: ${message}` };\n }\n },\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './lib/agent-client.service';
2
+ export * from './lib/agent-client.module';
3
+ export * from './lib/tools/navigation-tool';
4
+ export * from './lib/tools/component-tool';
5
+ //# sourceMappingURL=public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Public API Surface for @memberjunction/ng-agent-client
3
+ */
4
+ export * from './lib/agent-client.service';
5
+ export * from './lib/agent-client.module';
6
+ export * from './lib/tools/navigation-tool';
7
+ export * from './lib/tools/component-tool';
8
+ //# sourceMappingURL=public-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC","sourcesContent":["/*\n * Public API Surface for @memberjunction/ng-agent-client\n */\n\nexport * from './lib/agent-client.service';\nexport * from './lib/agent-client.module';\nexport * from './lib/tools/navigation-tool';\nexport * from './lib/tools/component-tool';\n"]}
package/package.json CHANGED
@@ -1,10 +1,39 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-agent-client",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @memberjunction/ng-agent-client",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
3
+ "version": "5.22.0",
4
+ "description": "MemberJunction: Angular adapter for the Agent Client SDK - injectable service, navigation tools, RxJS bridges",
5
+ "main": "./dist/public-api.js",
6
+ "typings": "./dist/public-api.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "test": "echo \"No tests configured yet\"",
12
+ "build": "ngc",
13
+ "test:watch": "vitest"
14
+ },
15
+ "keywords": [],
16
+ "author": "MemberJunction.com",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "@angular/compiler": "21.1.3",
20
+ "@angular/compiler-cli": "21.1.3",
21
+ "vitest": "^4.0.18"
22
+ },
23
+ "peerDependencies": {
24
+ "@angular/common": "21.1.3",
25
+ "@angular/core": "21.1.3",
26
+ "@angular/router": "21.1.3"
27
+ },
28
+ "dependencies": {
29
+ "@memberjunction/ai-agent-client": "5.22.0",
30
+ "@memberjunction/global": "5.22.0",
31
+ "rxjs": "^7.8.2",
32
+ "tslib": "^2.8.1"
33
+ },
34
+ "sideEffects": false,
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/MemberJunction/MJ"
38
+ }
10
39
  }
package/README.md DELETED
@@ -1,45 +0,0 @@
1
- # @memberjunction/ng-agent-client
2
-
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@memberjunction/ng-agent-client`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**