openpond-code 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/CHANGELOG.md +6 -0
- package/dist/api.d.ts +92 -0
- package/dist/cli.js +74 -2
- package/dist/index.d.ts +13 -3
- package/dist/index.js +30 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/api.d.ts
CHANGED
|
@@ -125,6 +125,96 @@ export type AppListItem = {
|
|
|
125
125
|
gitBranch: string | null;
|
|
126
126
|
} | null;
|
|
127
127
|
};
|
|
128
|
+
export type AppRuntimeSummary = {
|
|
129
|
+
app: {
|
|
130
|
+
appId: string;
|
|
131
|
+
name: string;
|
|
132
|
+
description: string | null;
|
|
133
|
+
teamId: string;
|
|
134
|
+
templateRepoUrl: string | null;
|
|
135
|
+
templateBranch: string | null;
|
|
136
|
+
initialPromptSnapshot: string | null;
|
|
137
|
+
};
|
|
138
|
+
runtime: {
|
|
139
|
+
latestDeployment: {
|
|
140
|
+
id: string;
|
|
141
|
+
status: string;
|
|
142
|
+
isProduction: boolean | null;
|
|
143
|
+
createdAt: string;
|
|
144
|
+
} | null;
|
|
145
|
+
schedules: {
|
|
146
|
+
total: number;
|
|
147
|
+
enabled: number;
|
|
148
|
+
disabled: number;
|
|
149
|
+
};
|
|
150
|
+
notifications: {
|
|
151
|
+
scheduleEmailsEnabled: boolean;
|
|
152
|
+
scheduleTweetsEnabled: boolean;
|
|
153
|
+
};
|
|
154
|
+
toolNotifyEmail: {
|
|
155
|
+
notifyEmailEnabledCount: number;
|
|
156
|
+
toolsConfiguredCount: number;
|
|
157
|
+
};
|
|
158
|
+
lastScheduleRun: {
|
|
159
|
+
id: string;
|
|
160
|
+
status: string;
|
|
161
|
+
executionTime: string;
|
|
162
|
+
scheduleName: string;
|
|
163
|
+
errorMessage: string | null;
|
|
164
|
+
} | null;
|
|
165
|
+
lastToolRun: {
|
|
166
|
+
id: string;
|
|
167
|
+
status: string;
|
|
168
|
+
endpoint: string;
|
|
169
|
+
toolName: string | null;
|
|
170
|
+
method: string | null;
|
|
171
|
+
createdAt: string;
|
|
172
|
+
executionTime: number | null;
|
|
173
|
+
error: string | null;
|
|
174
|
+
} | null;
|
|
175
|
+
};
|
|
176
|
+
wallet: {
|
|
177
|
+
personalWalletAddress: string | null;
|
|
178
|
+
operatingWalletAddress: string | null;
|
|
179
|
+
arbitrum: {
|
|
180
|
+
eth: {
|
|
181
|
+
raw: string;
|
|
182
|
+
formatted: string;
|
|
183
|
+
} | null;
|
|
184
|
+
usdc: {
|
|
185
|
+
raw: string;
|
|
186
|
+
formatted: string;
|
|
187
|
+
} | null;
|
|
188
|
+
};
|
|
189
|
+
hyperliquid: {
|
|
190
|
+
mainnet: {
|
|
191
|
+
accountValue: number | null;
|
|
192
|
+
withdrawable: number | null;
|
|
193
|
+
totalMarginUsed: number | null;
|
|
194
|
+
error?: string;
|
|
195
|
+
};
|
|
196
|
+
testnet: {
|
|
197
|
+
accountValue: number | null;
|
|
198
|
+
withdrawable: number | null;
|
|
199
|
+
totalMarginUsed: number | null;
|
|
200
|
+
error?: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
asOf: string;
|
|
205
|
+
};
|
|
206
|
+
export type AssistantMode = "plan" | "performance";
|
|
207
|
+
export type AssistantRunRequest = {
|
|
208
|
+
appId: string;
|
|
209
|
+
mode: AssistantMode;
|
|
210
|
+
prompt: string;
|
|
211
|
+
};
|
|
212
|
+
export type AssistantRunResponse = {
|
|
213
|
+
ok: boolean;
|
|
214
|
+
mode: AssistantMode;
|
|
215
|
+
conversationId: string;
|
|
216
|
+
response: string;
|
|
217
|
+
};
|
|
128
218
|
export declare function listApps(apiBase: string, token: string, options?: {
|
|
129
219
|
handle?: string;
|
|
130
220
|
}): Promise<AppListItem[]>;
|
|
@@ -161,6 +251,8 @@ export declare function createAgentFromPrompt(baseUrl: string, token: string, pa
|
|
|
161
251
|
export declare function getUserPerformance(baseUrl: string, token: string, options?: {
|
|
162
252
|
appId?: string;
|
|
163
253
|
}): Promise<unknown>;
|
|
254
|
+
export declare function getAppRuntimeSummary(baseUrl: string, token: string, appId: string): Promise<AppRuntimeSummary>;
|
|
255
|
+
export declare function runAssistantMode(baseUrl: string, token: string, payload: AssistantRunRequest): Promise<AssistantRunResponse>;
|
|
164
256
|
export declare function postAgentDigest(baseUrl: string, token: string, body: {
|
|
165
257
|
content: string;
|
|
166
258
|
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",
|
|
@@ -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);
|
|
@@ -1445,6 +1495,7 @@ async function runAppsToolsExecute(options, appId, deploymentId, toolName) {
|
|
|
1445
1495
|
const headers = typeof options.headers === "string" ? parseJsonOption(String(options.headers), "headers") : undefined;
|
|
1446
1496
|
const scheduleId = typeof options.scheduleId === "string" ? String(options.scheduleId) : undefined;
|
|
1447
1497
|
const notifyEmail = parseBooleanOption(options.notifyEmail);
|
|
1498
|
+
const withSummary = parseBooleanOption(options.summary) || parseBooleanOption(options.withSummary);
|
|
1448
1499
|
const result = await executeUserTool(apiBase, apiKey, {
|
|
1449
1500
|
appId,
|
|
1450
1501
|
deploymentId,
|
|
@@ -1456,6 +1507,10 @@ async function runAppsToolsExecute(options, appId, deploymentId, toolName) {
|
|
|
1456
1507
|
notifyEmail: notifyEmail || undefined
|
|
1457
1508
|
});
|
|
1458
1509
|
console.log(JSON.stringify(result, null, 2));
|
|
1510
|
+
if (withSummary && result.ok) {
|
|
1511
|
+
const summary = await getAppRuntimeSummary(apiBase, apiKey, appId);
|
|
1512
|
+
console.log(JSON.stringify({ summary }, null, 2));
|
|
1513
|
+
}
|
|
1459
1514
|
}
|
|
1460
1515
|
async function runAppsEnvSet(options, target) {
|
|
1461
1516
|
const rawEnv = typeof options.env === "string" ? options.env : typeof options.vars === "string" ? options.vars : typeof options.envVars === "string" ? options.envVars : null;
|
|
@@ -1731,6 +1786,23 @@ async function main() {
|
|
|
1731
1786
|
await runAppsPerformance(options);
|
|
1732
1787
|
return;
|
|
1733
1788
|
}
|
|
1789
|
+
if (subcommand === "summary") {
|
|
1790
|
+
const target = rest[1];
|
|
1791
|
+
if (!target) {
|
|
1792
|
+
throw new Error("usage: apps summary <handle>/<repo>");
|
|
1793
|
+
}
|
|
1794
|
+
await runAppsSummary(options, target);
|
|
1795
|
+
return;
|
|
1796
|
+
}
|
|
1797
|
+
if (subcommand === "assistant") {
|
|
1798
|
+
const mode = rest[1];
|
|
1799
|
+
const target = rest[2];
|
|
1800
|
+
if (mode !== "plan" && mode !== "performance" || !target) {
|
|
1801
|
+
throw new Error("usage: apps assistant <plan|performance> <handle>/<repo> --prompt <text>");
|
|
1802
|
+
}
|
|
1803
|
+
await runAppsAssistant(options, mode, target, rest.slice(3));
|
|
1804
|
+
return;
|
|
1805
|
+
}
|
|
1734
1806
|
if (subcommand === "store" && rest[1] === "events") {
|
|
1735
1807
|
await runAppsStoreEvents(options);
|
|
1736
1808
|
return;
|
|
@@ -1747,7 +1819,7 @@ async function main() {
|
|
|
1747
1819
|
await runAppsPositionsTx(options);
|
|
1748
1820
|
return;
|
|
1749
1821
|
}
|
|
1750
|
-
throw new Error("usage: apps <list|tools|deploy|env get|env set|performance|store events|trade-facts|agent create|positions tx> [args]");
|
|
1822
|
+
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
1823
|
}
|
|
1752
1824
|
if (command === "opentool") {
|
|
1753
1825
|
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",
|
|
@@ -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,
|