@mastra/client-js 1.15.3-alpha.1 → 1.16.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +52 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/channels.d.ts +63 -0
- package/dist/resources/channels.d.ts.map +1 -0
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './client.js';
|
|
2
2
|
export * from './types.js';
|
|
3
3
|
export * from './tools.js';
|
|
4
|
+
export type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectOAuth, ChannelConnectDeepLink, ChannelConnectImmediate, ChannelConnectResult, } from './resources/channels.js';
|
|
4
5
|
export { RequestContext } from '@mastra/core/request-context';
|
|
5
6
|
export type { UIMessageWithMetadata } from '@mastra/core/agent';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4732,16 +4732,68 @@ var Responses = class extends BaseResource {
|
|
|
4732
4732
|
}
|
|
4733
4733
|
};
|
|
4734
4734
|
|
|
4735
|
+
// src/resources/channels.ts
|
|
4736
|
+
var Channels = class extends BaseResource {
|
|
4737
|
+
constructor(options) {
|
|
4738
|
+
super(options);
|
|
4739
|
+
}
|
|
4740
|
+
/**
|
|
4741
|
+
* Lists all registered channel platforms and their configuration status.
|
|
4742
|
+
* @returns Array of available platforms
|
|
4743
|
+
*/
|
|
4744
|
+
listPlatforms() {
|
|
4745
|
+
return this.request("/channels/platforms");
|
|
4746
|
+
}
|
|
4747
|
+
/**
|
|
4748
|
+
* Lists installations for a given platform, optionally filtered by agent.
|
|
4749
|
+
* @param platform - Platform identifier (e.g., "slack")
|
|
4750
|
+
* @param agentId - Optional agent ID to filter by (client-side)
|
|
4751
|
+
* @returns Array of installations
|
|
4752
|
+
*/
|
|
4753
|
+
async listInstallations(platform, agentId) {
|
|
4754
|
+
const all = await this.request(`/channels/${platform}/installations`);
|
|
4755
|
+
if (agentId) {
|
|
4756
|
+
return all.filter((i) => i.agentId === agentId);
|
|
4757
|
+
}
|
|
4758
|
+
return all;
|
|
4759
|
+
}
|
|
4760
|
+
/**
|
|
4761
|
+
* Connects an agent to a channel platform.
|
|
4762
|
+
* @param platform - Platform identifier (e.g., "slack")
|
|
4763
|
+
* @param agentId - Agent to connect
|
|
4764
|
+
* @param options - Platform-specific connection options
|
|
4765
|
+
* @returns Discriminated connect result — check `type` for the authorization flow
|
|
4766
|
+
*/
|
|
4767
|
+
connect(platform, agentId, options) {
|
|
4768
|
+
return this.request(`/channels/${platform}/connect`, {
|
|
4769
|
+
method: "POST",
|
|
4770
|
+
body: { agentId, options }
|
|
4771
|
+
});
|
|
4772
|
+
}
|
|
4773
|
+
/**
|
|
4774
|
+
* Disconnects an agent from a channel platform.
|
|
4775
|
+
* @param platform - Platform identifier (e.g., "slack")
|
|
4776
|
+
* @param agentId - Agent to disconnect
|
|
4777
|
+
*/
|
|
4778
|
+
disconnect(platform, agentId) {
|
|
4779
|
+
return this.request(`/channels/${platform}/${agentId}/disconnect`, {
|
|
4780
|
+
method: "POST"
|
|
4781
|
+
});
|
|
4782
|
+
}
|
|
4783
|
+
};
|
|
4784
|
+
|
|
4735
4785
|
// src/client.ts
|
|
4736
4786
|
var MastraClient = class extends BaseResource {
|
|
4737
4787
|
observability;
|
|
4738
4788
|
conversations;
|
|
4739
4789
|
responses;
|
|
4790
|
+
channels;
|
|
4740
4791
|
constructor(options) {
|
|
4741
4792
|
super(options);
|
|
4742
4793
|
this.observability = new Observability(options);
|
|
4743
4794
|
this.conversations = new Conversations(options);
|
|
4744
4795
|
this.responses = new Responses(options);
|
|
4796
|
+
this.channels = new Channels(options);
|
|
4745
4797
|
}
|
|
4746
4798
|
/**
|
|
4747
4799
|
* Retrieves all available agents
|