openpond-code 0.1.1 → 0.1.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 +12 -0
- package/dist/api.d.ts +92 -3
- package/dist/cli.js +78 -8
- package/dist/index.d.ts +13 -3
- package/dist/index.js +32 -2
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/api.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export declare function startDeviceLogin(baseUrl: string): Promise<DeviceStartRe
|
|
|
24
24
|
export declare function pollDeviceLogin(baseUrl: string, deviceCode?: string, userCode?: string): Promise<DevicePollResponse>;
|
|
25
25
|
export type CreateLocalProjectInput = {
|
|
26
26
|
name: string;
|
|
27
|
-
templateId?: string;
|
|
28
27
|
templateRepoUrl?: string;
|
|
29
28
|
templateBranch?: string;
|
|
30
29
|
envVars?: Record<string, string>;
|
|
@@ -50,7 +49,6 @@ export type CreateRepoResponse = {
|
|
|
50
49
|
export type HeadlessAppRequest = {
|
|
51
50
|
name?: string;
|
|
52
51
|
description?: string;
|
|
53
|
-
templateId?: string;
|
|
54
52
|
templateRepoUrl?: string;
|
|
55
53
|
templateBranch?: string;
|
|
56
54
|
templateName?: string;
|
|
@@ -125,6 +123,96 @@ export type AppListItem = {
|
|
|
125
123
|
gitBranch: string | null;
|
|
126
124
|
} | null;
|
|
127
125
|
};
|
|
126
|
+
export type AppRuntimeSummary = {
|
|
127
|
+
app: {
|
|
128
|
+
appId: string;
|
|
129
|
+
name: string;
|
|
130
|
+
description: string | null;
|
|
131
|
+
teamId: string;
|
|
132
|
+
templateRepoUrl: string | null;
|
|
133
|
+
templateBranch: string | null;
|
|
134
|
+
initialPromptSnapshot: string | null;
|
|
135
|
+
};
|
|
136
|
+
runtime: {
|
|
137
|
+
latestDeployment: {
|
|
138
|
+
id: string;
|
|
139
|
+
status: string;
|
|
140
|
+
isProduction: boolean | null;
|
|
141
|
+
createdAt: string;
|
|
142
|
+
} | null;
|
|
143
|
+
schedules: {
|
|
144
|
+
total: number;
|
|
145
|
+
enabled: number;
|
|
146
|
+
disabled: number;
|
|
147
|
+
};
|
|
148
|
+
notifications: {
|
|
149
|
+
scheduleEmailsEnabled: boolean;
|
|
150
|
+
scheduleTweetsEnabled: boolean;
|
|
151
|
+
};
|
|
152
|
+
toolNotifyEmail: {
|
|
153
|
+
notifyEmailEnabledCount: number;
|
|
154
|
+
toolsConfiguredCount: number;
|
|
155
|
+
};
|
|
156
|
+
lastScheduleRun: {
|
|
157
|
+
id: string;
|
|
158
|
+
status: string;
|
|
159
|
+
executionTime: string;
|
|
160
|
+
scheduleName: string;
|
|
161
|
+
errorMessage: string | null;
|
|
162
|
+
} | null;
|
|
163
|
+
lastToolRun: {
|
|
164
|
+
id: string;
|
|
165
|
+
status: string;
|
|
166
|
+
endpoint: string;
|
|
167
|
+
toolName: string | null;
|
|
168
|
+
method: string | null;
|
|
169
|
+
createdAt: string;
|
|
170
|
+
executionTime: number | null;
|
|
171
|
+
error: string | null;
|
|
172
|
+
} | null;
|
|
173
|
+
};
|
|
174
|
+
wallet: {
|
|
175
|
+
personalWalletAddress: string | null;
|
|
176
|
+
operatingWalletAddress: string | null;
|
|
177
|
+
arbitrum: {
|
|
178
|
+
eth: {
|
|
179
|
+
raw: string;
|
|
180
|
+
formatted: string;
|
|
181
|
+
} | null;
|
|
182
|
+
usdc: {
|
|
183
|
+
raw: string;
|
|
184
|
+
formatted: string;
|
|
185
|
+
} | null;
|
|
186
|
+
};
|
|
187
|
+
hyperliquid: {
|
|
188
|
+
mainnet: {
|
|
189
|
+
accountValue: number | null;
|
|
190
|
+
withdrawable: number | null;
|
|
191
|
+
totalMarginUsed: number | null;
|
|
192
|
+
error?: string;
|
|
193
|
+
};
|
|
194
|
+
testnet: {
|
|
195
|
+
accountValue: number | null;
|
|
196
|
+
withdrawable: number | null;
|
|
197
|
+
totalMarginUsed: number | null;
|
|
198
|
+
error?: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
asOf: string;
|
|
203
|
+
};
|
|
204
|
+
export type AssistantMode = "plan" | "performance";
|
|
205
|
+
export type AssistantRunRequest = {
|
|
206
|
+
appId: string;
|
|
207
|
+
mode: AssistantMode;
|
|
208
|
+
prompt: string;
|
|
209
|
+
};
|
|
210
|
+
export type AssistantRunResponse = {
|
|
211
|
+
ok: boolean;
|
|
212
|
+
mode: AssistantMode;
|
|
213
|
+
conversationId: string;
|
|
214
|
+
response: string;
|
|
215
|
+
};
|
|
128
216
|
export declare function listApps(apiBase: string, token: string, options?: {
|
|
129
217
|
handle?: string;
|
|
130
218
|
}): Promise<AppListItem[]>;
|
|
@@ -147,7 +235,6 @@ export type AgentCreateRequest = {
|
|
|
147
235
|
template?: {
|
|
148
236
|
name?: string;
|
|
149
237
|
description?: string;
|
|
150
|
-
templateId?: string;
|
|
151
238
|
templateRepoUrl?: string;
|
|
152
239
|
templateBranch?: string;
|
|
153
240
|
envVars?: Record<string, string>;
|
|
@@ -161,6 +248,8 @@ export declare function createAgentFromPrompt(baseUrl: string, token: string, pa
|
|
|
161
248
|
export declare function getUserPerformance(baseUrl: string, token: string, options?: {
|
|
162
249
|
appId?: string;
|
|
163
250
|
}): Promise<unknown>;
|
|
251
|
+
export declare function getAppRuntimeSummary(baseUrl: string, token: string, appId: string): Promise<AppRuntimeSummary>;
|
|
252
|
+
export declare function runAssistantMode(baseUrl: string, token: string, payload: AssistantRunRequest): Promise<AssistantRunResponse>;
|
|
164
253
|
export declare function postAgentDigest(baseUrl: string, token: string, body: {
|
|
165
254
|
content: string;
|
|
166
255
|
runAt?: string;
|
package/dist/cli.js
CHANGED
|
@@ -143,6 +143,28 @@ async function getUserPerformance(baseUrl, token, options) {
|
|
|
143
143
|
}
|
|
144
144
|
return await response.json();
|
|
145
145
|
}
|
|
146
|
+
async function getAppRuntimeSummary(baseUrl, token, appId) {
|
|
147
|
+
const params = new URLSearchParams({ appId });
|
|
148
|
+
const response = await apiFetch(baseUrl, token, `/apps/summary?${params.toString()}`, {
|
|
149
|
+
method: "GET"
|
|
150
|
+
});
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
const text = await response.text().catch(() => "");
|
|
153
|
+
throw new Error(`Summary lookup failed: ${response.status} ${text}`);
|
|
154
|
+
}
|
|
155
|
+
return await response.json();
|
|
156
|
+
}
|
|
157
|
+
async function runAssistantMode(baseUrl, token, payload) {
|
|
158
|
+
const response = await apiFetch(baseUrl, token, "/apps/assistant/run", {
|
|
159
|
+
method: "POST",
|
|
160
|
+
body: JSON.stringify(payload)
|
|
161
|
+
});
|
|
162
|
+
if (!response.ok) {
|
|
163
|
+
const text = await response.text().catch(() => "");
|
|
164
|
+
throw new Error(`Assistant run failed: ${response.status} ${text}`);
|
|
165
|
+
}
|
|
166
|
+
return await response.json();
|
|
167
|
+
}
|
|
146
168
|
async function executeUserTool(baseUrl, token, body) {
|
|
147
169
|
const response = await apiFetch(baseUrl, token, "/apps/tools/execute", {
|
|
148
170
|
method: "POST",
|
|
@@ -603,8 +625,8 @@ function formatStreamItem(item) {
|
|
|
603
625
|
return null;
|
|
604
626
|
if (type === "app_creation_started") {
|
|
605
627
|
const name = item.appName || item.name || item.appId || "app";
|
|
606
|
-
const
|
|
607
|
-
const suffix =
|
|
628
|
+
const templateRepoUrl = typeof item.templateRepoUrl === "string" ? item.templateRepoUrl : null;
|
|
629
|
+
const suffix = templateRepoUrl ? ` template=${templateRepoUrl}` : "";
|
|
608
630
|
return `app_creation_started: ${name}${suffix}`;
|
|
609
631
|
}
|
|
610
632
|
if (type === "app_created") {
|
|
@@ -972,10 +994,12 @@ function printHelp() {
|
|
|
972
994
|
console.log(" openpond apps env get <handle>/<repo>");
|
|
973
995
|
console.log(" openpond apps env set <handle>/<repo> --env <json>");
|
|
974
996
|
console.log(" openpond apps performance [--app-id <id>]");
|
|
997
|
+
console.log(" openpond apps summary <handle>/<repo>");
|
|
998
|
+
console.log(" openpond apps assistant <plan|performance> <handle>/<repo> --prompt <text>");
|
|
975
999
|
console.log(" openpond apps store events [--source <source>] [--status <csv>] [--symbol <symbol>] [--wallet-address <0x...>] [--since <ms|iso>] [--until <ms|iso>] [--limit <n>] [--cursor <cursor>] [--history <true|false>] [--params <json>]");
|
|
976
1000
|
console.log(" openpond apps trade-facts [--app-id <id>]");
|
|
977
1001
|
console.log(" openpond apps agent create --prompt <text> [--template-id <id>]");
|
|
978
|
-
console.log(" openpond apps tools execute <appId> <deploymentId> <tool> [--body <json>] [--method <METHOD>] [--headers <json>]");
|
|
1002
|
+
console.log(" openpond apps tools execute <appId> <deploymentId> <tool> [--body <json>] [--method <METHOD>] [--headers <json>] [--summary <true|false>]");
|
|
979
1003
|
console.log(" openpond apps positions tx [--method <GET|POST>] [--body <json>] [--params <json>]");
|
|
980
1004
|
console.log(" openpond opentool <init|validate|build> [args]");
|
|
981
1005
|
console.log("");
|
|
@@ -1345,6 +1369,32 @@ async function runAppsPerformance(options) {
|
|
|
1345
1369
|
const performance = await getUserPerformance(apiBase, apiKey, { appId });
|
|
1346
1370
|
console.log(JSON.stringify(performance, null, 2));
|
|
1347
1371
|
}
|
|
1372
|
+
async function runAppsSummary(_options, target) {
|
|
1373
|
+
const config = await loadConfig();
|
|
1374
|
+
const uiBase = resolveBaseUrl(config);
|
|
1375
|
+
const apiBase = resolvePublicApiBaseUrl();
|
|
1376
|
+
const apiKey = await ensureApiKey(config, uiBase);
|
|
1377
|
+
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
1378
|
+
const summary = await getAppRuntimeSummary(apiBase, apiKey, app.id);
|
|
1379
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
1380
|
+
}
|
|
1381
|
+
async function runAppsAssistant(options, mode, target, contentParts) {
|
|
1382
|
+
const prompt = (typeof options.prompt === "string" ? options.prompt : null) || contentParts.join(" ");
|
|
1383
|
+
if (!prompt.trim()) {
|
|
1384
|
+
throw new Error("usage: apps assistant <plan|performance> <handle>/<repo> --prompt <text>");
|
|
1385
|
+
}
|
|
1386
|
+
const config = await loadConfig();
|
|
1387
|
+
const uiBase = resolveBaseUrl(config);
|
|
1388
|
+
const apiBase = resolvePublicApiBaseUrl();
|
|
1389
|
+
const apiKey = await ensureApiKey(config, uiBase);
|
|
1390
|
+
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
1391
|
+
const result = await runAssistantMode(apiBase, apiKey, {
|
|
1392
|
+
appId: app.id,
|
|
1393
|
+
mode,
|
|
1394
|
+
prompt: prompt.trim()
|
|
1395
|
+
});
|
|
1396
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1397
|
+
}
|
|
1348
1398
|
async function runAppsAgentCreate(options, contentParts) {
|
|
1349
1399
|
const config = await loadConfig();
|
|
1350
1400
|
const uiBase = resolveBaseUrl(config);
|
|
@@ -1354,12 +1404,11 @@ async function runAppsAgentCreate(options, contentParts) {
|
|
|
1354
1404
|
if (!prompt.trim()) {
|
|
1355
1405
|
throw new Error("usage: apps agent create --prompt <text>");
|
|
1356
1406
|
}
|
|
1357
|
-
const templateId = typeof options.templateId === "string" ? options.templateId : undefined;
|
|
1358
1407
|
const templateRepoUrl = typeof options.templateRepoUrl === "string" ? options.templateRepoUrl : undefined;
|
|
1359
1408
|
const templateBranch = typeof options.templateBranch === "string" ? options.templateBranch : undefined;
|
|
1360
1409
|
const templateLocalPath = typeof options.templateLocalPath === "string" ? options.templateLocalPath : undefined;
|
|
1361
1410
|
if (templateLocalPath && String(templateLocalPath).trim().length > 0) {
|
|
1362
|
-
throw new Error("templateLocalPath is not supported; use
|
|
1411
|
+
throw new Error("templateLocalPath is not supported; use templateRepoUrl");
|
|
1363
1412
|
}
|
|
1364
1413
|
const envVars = typeof options.env === "string" ? parseJsonOption(options.env, "env") : undefined;
|
|
1365
1414
|
if (envVars) {
|
|
@@ -1372,8 +1421,7 @@ async function runAppsAgentCreate(options, contentParts) {
|
|
|
1372
1421
|
}
|
|
1373
1422
|
}
|
|
1374
1423
|
}
|
|
1375
|
-
const template =
|
|
1376
|
-
templateId,
|
|
1424
|
+
const template = templateRepoUrl || templateBranch || envVars ? {
|
|
1377
1425
|
templateRepoUrl,
|
|
1378
1426
|
templateBranch,
|
|
1379
1427
|
envVars
|
|
@@ -1445,6 +1493,7 @@ async function runAppsToolsExecute(options, appId, deploymentId, toolName) {
|
|
|
1445
1493
|
const headers = typeof options.headers === "string" ? parseJsonOption(String(options.headers), "headers") : undefined;
|
|
1446
1494
|
const scheduleId = typeof options.scheduleId === "string" ? String(options.scheduleId) : undefined;
|
|
1447
1495
|
const notifyEmail = parseBooleanOption(options.notifyEmail);
|
|
1496
|
+
const withSummary = parseBooleanOption(options.summary) || parseBooleanOption(options.withSummary);
|
|
1448
1497
|
const result = await executeUserTool(apiBase, apiKey, {
|
|
1449
1498
|
appId,
|
|
1450
1499
|
deploymentId,
|
|
@@ -1456,6 +1505,10 @@ async function runAppsToolsExecute(options, appId, deploymentId, toolName) {
|
|
|
1456
1505
|
notifyEmail: notifyEmail || undefined
|
|
1457
1506
|
});
|
|
1458
1507
|
console.log(JSON.stringify(result, null, 2));
|
|
1508
|
+
if (withSummary && result.ok) {
|
|
1509
|
+
const summary = await getAppRuntimeSummary(apiBase, apiKey, appId);
|
|
1510
|
+
console.log(JSON.stringify({ summary }, null, 2));
|
|
1511
|
+
}
|
|
1459
1512
|
}
|
|
1460
1513
|
async function runAppsEnvSet(options, target) {
|
|
1461
1514
|
const rawEnv = typeof options.env === "string" ? options.env : typeof options.vars === "string" ? options.vars : typeof options.envVars === "string" ? options.envVars : null;
|
|
@@ -1731,6 +1784,23 @@ async function main() {
|
|
|
1731
1784
|
await runAppsPerformance(options);
|
|
1732
1785
|
return;
|
|
1733
1786
|
}
|
|
1787
|
+
if (subcommand === "summary") {
|
|
1788
|
+
const target = rest[1];
|
|
1789
|
+
if (!target) {
|
|
1790
|
+
throw new Error("usage: apps summary <handle>/<repo>");
|
|
1791
|
+
}
|
|
1792
|
+
await runAppsSummary(options, target);
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
if (subcommand === "assistant") {
|
|
1796
|
+
const mode = rest[1];
|
|
1797
|
+
const target = rest[2];
|
|
1798
|
+
if (mode !== "plan" && mode !== "performance" || !target) {
|
|
1799
|
+
throw new Error("usage: apps assistant <plan|performance> <handle>/<repo> --prompt <text>");
|
|
1800
|
+
}
|
|
1801
|
+
await runAppsAssistant(options, mode, target, rest.slice(3));
|
|
1802
|
+
return;
|
|
1803
|
+
}
|
|
1734
1804
|
if (subcommand === "store" && rest[1] === "events") {
|
|
1735
1805
|
await runAppsStoreEvents(options);
|
|
1736
1806
|
return;
|
|
@@ -1747,7 +1817,7 @@ async function main() {
|
|
|
1747
1817
|
await runAppsPositionsTx(options);
|
|
1748
1818
|
return;
|
|
1749
1819
|
}
|
|
1750
|
-
throw new Error("usage: apps <list|tools|deploy|env get|env set|performance|store events|trade-facts|agent create|positions tx> [args]");
|
|
1820
|
+
throw new Error("usage: apps <list|tools|deploy|env get|env set|performance|summary|assistant|store events|trade-facts|agent create|positions tx> [args]");
|
|
1751
1821
|
}
|
|
1752
1822
|
if (command === "opentool") {
|
|
1753
1823
|
await runOpentool(process.argv.slice(3));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type AgentCreateRequest, type AppEnvironmentGetResponse, type AppEnvironmentUpdateResponse, type AppListItem, type CreateRepoRequest, type CreateRepoResponse, type DeploymentLogEntry, type TemplateBranchesResponse, type TemplateDeployLatestRequest, type TemplateDeployLatestResponse, type TemplateStatusResponse, type ToolExecuteRequest, type ToolExecuteResponse } from "./api";
|
|
1
|
+
import { type AssistantMode, type AssistantRunResponse, type AgentCreateRequest, type AppEnvironmentGetResponse, type AppEnvironmentUpdateResponse, type AppListItem, type AppRuntimeSummary, type CreateRepoRequest, type CreateRepoResponse, type DeploymentLogEntry, type TemplateBranchesResponse, type TemplateDeployLatestRequest, type TemplateDeployLatestResponse, type TemplateStatusResponse, type ToolExecuteRequest, type ToolExecuteResponse } from "./api";
|
|
2
2
|
import type { StreamCallbacks } from "./stream";
|
|
3
3
|
export type { StreamCallbacks } from "./stream";
|
|
4
|
-
export type { AgentCreateRequest, AppEnvironmentGetResponse, AppEnvironmentUpdateRequest, AppEnvironmentUpdateResponse, AppListItem, CreateRepoRequest, CreateRepoResponse, DeploymentDetail, DeploymentLogEntry, TemplateBranchesResponse, TemplateDeployLatestRequest, TemplateDeployLatestResponse, TemplateStatusResponse, ToolExecuteRequest, ToolExecuteResponse, } from "./api";
|
|
4
|
+
export type { AssistantMode, AssistantRunResponse, AgentCreateRequest, AppEnvironmentGetResponse, AppEnvironmentUpdateRequest, AppEnvironmentUpdateResponse, AppListItem, AppRuntimeSummary, CreateRepoRequest, CreateRepoResponse, DeploymentDetail, DeploymentLogEntry, TemplateBranchesResponse, TemplateDeployLatestRequest, TemplateDeployLatestResponse, TemplateStatusResponse, ToolExecuteRequest, ToolExecuteResponse, } from "./api";
|
|
5
5
|
export type { ChatRequestBody, ResponseItem, ResponseMessageItem, TemplateBootstrap, ToolCallItem, ToolOutputItem, UsageInfo, } from "./types";
|
|
6
6
|
export type { Bar as IndicatorBar, BollingerResult, MacdResult, MaCrossResult, MaCrossSignal, PriceChangeResult, } from "./indicators";
|
|
7
|
-
export { apiFetch, commitFiles, createAgentFromPrompt, createRepo, createHeadlessApps, createLocalProject, deployApp, deployLatestTemplate, getAppEnvironment, updateAppEnvironment, executeHostedTool, executeUserTool, fetchToolManifest, getDeploymentDetail, getDeploymentLogs, getDeploymentStatus, getLatestDeploymentForApp, getTemplateStatus, getUserPerformance, listApps, listTemplateBranches, listUserTools, pollDeviceLogin, postAgentDigest, resolveWorkerBaseUrl, startDeviceLogin, submitPositionsTx, } from "./api";
|
|
7
|
+
export { apiFetch, getAppRuntimeSummary, commitFiles, createAgentFromPrompt, createRepo, createHeadlessApps, createLocalProject, deployApp, deployLatestTemplate, getAppEnvironment, updateAppEnvironment, executeHostedTool, executeUserTool, fetchToolManifest, getDeploymentDetail, getDeploymentLogs, getDeploymentStatus, getLatestDeploymentForApp, getTemplateStatus, getUserPerformance, runAssistantMode, listApps, listTemplateBranches, listUserTools, pollDeviceLogin, postAgentDigest, resolveWorkerBaseUrl, startDeviceLogin, submitPositionsTx, } from "./api";
|
|
8
8
|
export { computeAtr, computeBollinger, computeEma, computeEmaSeries, computeMacd, computeMaCross, computePriceChange, computeRsi, computeSma, computeSmaSeries, } from "./indicators";
|
|
9
9
|
export { DEFAULT_CACHE_TTL_MS, getCachedApps, getCachedTools, setCachedApps, setCachedTools, } from "./cache";
|
|
10
10
|
export { getConfigPath, loadConfig, loadGlobalConfig, saveConfig, saveGlobalConfig, } from "./config";
|
|
@@ -62,6 +62,8 @@ export type OpenPondClient = {
|
|
|
62
62
|
list: (options?: AppsListOptions) => Promise<AppListItem[]>;
|
|
63
63
|
tools: (options?: AppsToolsOptions) => Promise<unknown[]>;
|
|
64
64
|
performance: (options?: AppsPerformanceOptions) => Promise<unknown>;
|
|
65
|
+
summary: (input: AppSummaryOptions) => Promise<AppRuntimeSummary>;
|
|
66
|
+
assistantRun: (input: AppsAssistantRunOptions) => Promise<AssistantRunResponse>;
|
|
65
67
|
agentCreate: (input: AgentCreateRequest & {
|
|
66
68
|
refreshCache?: boolean;
|
|
67
69
|
}, callbacks?: AgentCreateStreamCallbacks) => Promise<AgentCreateStreamResult>;
|
|
@@ -121,6 +123,14 @@ export type AppsToolsOptions = {
|
|
|
121
123
|
export type AppsPerformanceOptions = {
|
|
122
124
|
appId?: string;
|
|
123
125
|
};
|
|
126
|
+
export type AppSummaryOptions = {
|
|
127
|
+
appId: string;
|
|
128
|
+
};
|
|
129
|
+
export type AppsAssistantRunOptions = {
|
|
130
|
+
appId: string;
|
|
131
|
+
mode: AssistantMode;
|
|
132
|
+
prompt: string;
|
|
133
|
+
};
|
|
124
134
|
export type ExecuteUserToolOptions = {
|
|
125
135
|
appId: string;
|
|
126
136
|
deploymentId: string;
|
package/dist/index.js
CHANGED
|
@@ -181,6 +181,28 @@ async function getUserPerformance(baseUrl, token, options) {
|
|
|
181
181
|
}
|
|
182
182
|
return await response.json();
|
|
183
183
|
}
|
|
184
|
+
async function getAppRuntimeSummary(baseUrl, token, appId) {
|
|
185
|
+
const params = new URLSearchParams({ appId });
|
|
186
|
+
const response = await apiFetch(baseUrl, token, `/apps/summary?${params.toString()}`, {
|
|
187
|
+
method: "GET"
|
|
188
|
+
});
|
|
189
|
+
if (!response.ok) {
|
|
190
|
+
const text = await response.text().catch(() => "");
|
|
191
|
+
throw new Error(`Summary lookup failed: ${response.status} ${text}`);
|
|
192
|
+
}
|
|
193
|
+
return await response.json();
|
|
194
|
+
}
|
|
195
|
+
async function runAssistantMode(baseUrl, token, payload) {
|
|
196
|
+
const response = await apiFetch(baseUrl, token, "/apps/assistant/run", {
|
|
197
|
+
method: "POST",
|
|
198
|
+
body: JSON.stringify(payload)
|
|
199
|
+
});
|
|
200
|
+
if (!response.ok) {
|
|
201
|
+
const text = await response.text().catch(() => "");
|
|
202
|
+
throw new Error(`Assistant run failed: ${response.status} ${text}`);
|
|
203
|
+
}
|
|
204
|
+
return await response.json();
|
|
205
|
+
}
|
|
184
206
|
async function postAgentDigest(baseUrl, token, body) {
|
|
185
207
|
const response = await apiFetch(baseUrl, token, "/apps/agent/digest", {
|
|
186
208
|
method: "POST",
|
|
@@ -622,8 +644,8 @@ function formatStreamItem(item) {
|
|
|
622
644
|
return null;
|
|
623
645
|
if (type === "app_creation_started") {
|
|
624
646
|
const name = item.appName || item.name || item.appId || "app";
|
|
625
|
-
const
|
|
626
|
-
const suffix =
|
|
647
|
+
const templateRepoUrl = typeof item.templateRepoUrl === "string" ? item.templateRepoUrl : null;
|
|
648
|
+
const suffix = templateRepoUrl ? ` template=${templateRepoUrl}` : "";
|
|
627
649
|
return `app_creation_started: ${name}${suffix}`;
|
|
628
650
|
}
|
|
629
651
|
if (type === "app_created") {
|
|
@@ -1210,6 +1232,12 @@ function createClient(options) {
|
|
|
1210
1232
|
performance: async (options2) => {
|
|
1211
1233
|
return getUserPerformance(apiUrl, apiKey, { appId: options2?.appId });
|
|
1212
1234
|
},
|
|
1235
|
+
summary: async (input) => {
|
|
1236
|
+
return getAppRuntimeSummary(apiUrl, apiKey, input.appId);
|
|
1237
|
+
},
|
|
1238
|
+
assistantRun: async (input) => {
|
|
1239
|
+
return runAssistantMode(apiUrl, apiKey, input);
|
|
1240
|
+
},
|
|
1213
1241
|
agentCreate: async (input, callbacks) => {
|
|
1214
1242
|
const { refreshCache: refreshCacheFlag, ...rest } = input;
|
|
1215
1243
|
const payload = {
|
|
@@ -1293,6 +1321,7 @@ export {
|
|
|
1293
1321
|
setCachedApps,
|
|
1294
1322
|
saveGlobalConfig,
|
|
1295
1323
|
saveConfig,
|
|
1324
|
+
runAssistantMode,
|
|
1296
1325
|
resolveWorkerBaseUrl,
|
|
1297
1326
|
postAgentDigest,
|
|
1298
1327
|
pollDeviceLogin,
|
|
@@ -1311,6 +1340,7 @@ export {
|
|
|
1311
1340
|
getConfigPath,
|
|
1312
1341
|
getCachedTools,
|
|
1313
1342
|
getCachedApps,
|
|
1343
|
+
getAppRuntimeSummary,
|
|
1314
1344
|
getAppEnvironment,
|
|
1315
1345
|
formatStreamItem,
|
|
1316
1346
|
fetchToolManifest,
|
package/dist/types.d.ts
CHANGED