@creature-ai/sdk 0.1.1 → 0.1.2
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/dist/core/index.d.ts +18 -3
- package/dist/core/index.js +15 -0
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.d.ts +32 -3
- package/dist/react/index.js +114 -1
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/{types-DcoqlK46.d.ts → types-JBEuUzEi.d.ts} +25 -2
- package/package.json +1 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as StateListener, f as HostClientEvents, e as HostClientState, H as HostClient, d as HostClientConfig, T as ToolResult, W as WidgetState, L as LogLevel, E as Environment, a as AppSessionState, b as AppSessionListener } from '../types-
|
|
2
|
-
export { A as AppSessionOptions, c as HostContext, S as StructuredWidgetState } from '../types-
|
|
1
|
+
import { g as StateListener, f as HostClientEvents, e as HostClientState, H as HostClient, d as HostClientConfig, T as ToolResult, W as WidgetState, D as DisplayMode, L as LogLevel, E as Environment, a as AppSessionState, b as AppSessionListener } from '../types-JBEuUzEi.js';
|
|
2
|
+
export { A as AppSessionOptions, c as HostContext, S as StructuredWidgetState } from '../types-JBEuUzEi.js';
|
|
3
3
|
export { applyDocumentTheme, applyHostFonts, applyHostStyleVariables, getDocumentTheme } from '@modelcontextprotocol/ext-apps';
|
|
4
4
|
|
|
5
5
|
declare abstract class Subscribable {
|
|
@@ -89,6 +89,11 @@ declare class McpHostClient extends Subscribable implements HostClient {
|
|
|
89
89
|
* @param state - New widget state (or null to clear)
|
|
90
90
|
*/
|
|
91
91
|
setWidgetState(state: WidgetState | null): void;
|
|
92
|
+
requestDisplayMode(params: {
|
|
93
|
+
mode: DisplayMode;
|
|
94
|
+
}): Promise<{
|
|
95
|
+
mode: DisplayMode;
|
|
96
|
+
}>;
|
|
92
97
|
/**
|
|
93
98
|
* Send a log message to the host's DevConsole.
|
|
94
99
|
*
|
|
@@ -116,6 +121,11 @@ interface OpenAIBridge {
|
|
|
116
121
|
text?: string;
|
|
117
122
|
}>;
|
|
118
123
|
}>;
|
|
124
|
+
requestDisplayMode?: (args: {
|
|
125
|
+
mode: string;
|
|
126
|
+
}) => Promise<{
|
|
127
|
+
mode: string;
|
|
128
|
+
}>;
|
|
119
129
|
}
|
|
120
130
|
declare global {
|
|
121
131
|
interface Window {
|
|
@@ -149,6 +159,11 @@ declare class ChatGPTHostClient extends Subscribable implements HostClient {
|
|
|
149
159
|
* @param data - Optional structured data
|
|
150
160
|
*/
|
|
151
161
|
log(level: LogLevel, message: string, data?: Record<string, unknown>): void;
|
|
162
|
+
requestDisplayMode(params: {
|
|
163
|
+
mode: DisplayMode;
|
|
164
|
+
}): Promise<{
|
|
165
|
+
mode: DisplayMode;
|
|
166
|
+
}>;
|
|
152
167
|
}
|
|
153
168
|
|
|
154
169
|
/**
|
|
@@ -212,4 +227,4 @@ declare function createChannel<TSend = unknown, TReceive = unknown>(url: string,
|
|
|
212
227
|
|
|
213
228
|
declare function createHost(config: HostClientConfig): HostClient;
|
|
214
229
|
|
|
215
|
-
export { AppSession, AppSessionListener, AppSessionState, type ChannelClient, type ChannelClientConfig, type ChannelStatus, ChatGPTHostClient, Environment, HostClient, HostClientConfig, HostClientEvents, HostClientState, LogLevel, McpHostClient, StateListener, ToolResult, WidgetState, createChannel, createHost, detectEnvironment };
|
|
230
|
+
export { AppSession, AppSessionListener, AppSessionState, type ChannelClient, type ChannelClientConfig, type ChannelStatus, ChatGPTHostClient, DisplayMode, Environment, HostClient, HostClientConfig, HostClientEvents, HostClientState, LogLevel, McpHostClient, StateListener, ToolResult, WidgetState, createChannel, createHost, detectEnvironment };
|
package/dist/core/index.js
CHANGED
|
@@ -9527,6 +9527,13 @@ var McpHostClient = class extends Subscribable {
|
|
|
9527
9527
|
widgetState: state
|
|
9528
9528
|
});
|
|
9529
9529
|
}
|
|
9530
|
+
async requestDisplayMode(params) {
|
|
9531
|
+
if (!this.app) {
|
|
9532
|
+
return { mode: params.mode };
|
|
9533
|
+
}
|
|
9534
|
+
const result = await this.app.requestDisplayMode({ mode: params.mode });
|
|
9535
|
+
return { mode: result.mode };
|
|
9536
|
+
}
|
|
9530
9537
|
/**
|
|
9531
9538
|
* Send a log message to the host's DevConsole.
|
|
9532
9539
|
*
|
|
@@ -9664,6 +9671,14 @@ var ChatGPTHostClient = class extends Subscribable {
|
|
|
9664
9671
|
const consoleMethod = level === "error" ? "error" : level === "warning" ? "warn" : "log";
|
|
9665
9672
|
console[consoleMethod](`[${this.config.name}]`, message, data ?? "");
|
|
9666
9673
|
}
|
|
9674
|
+
async requestDisplayMode(params) {
|
|
9675
|
+
const openai = window.openai;
|
|
9676
|
+
if (openai?.requestDisplayMode) {
|
|
9677
|
+
const result = await openai.requestDisplayMode({ mode: params.mode });
|
|
9678
|
+
return { mode: result.mode };
|
|
9679
|
+
}
|
|
9680
|
+
return { mode: params.mode };
|
|
9681
|
+
}
|
|
9667
9682
|
};
|
|
9668
9683
|
|
|
9669
9684
|
// src/core/utils.ts
|