openpond-sdk 0.0.6 → 0.0.7
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/README.md +25 -0
- package/dist/index.js +82 -4
- package/dist/index.js.map +4 -4
- package/dist/types/packages/cloud/src/sandbox/client.d.ts.map +1 -1
- package/dist/types/packages/cloud/src/sandbox/sandbox-instance-client.d.ts +2 -1
- package/dist/types/packages/cloud/src/sandbox/sandbox-instance-client.d.ts.map +1 -1
- package/dist/types/packages/cloud/src/sandbox/types/org-project-agent.d.ts +4 -0
- package/dist/types/packages/cloud/src/sandbox/types/org-project-agent.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/index.d.ts +4 -0
- package/dist/types/packages/sdk/src/index.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/workflows.d.ts +121 -0
- package/dist/types/packages/sdk/src/workflows.d.ts.map +1 -0
- package/dist/workflows.js +244 -0
- package/dist/workflows.js.map +7 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -96,6 +96,31 @@ console.log(result.command.output);
|
|
|
96
96
|
|
|
97
97
|
The package also exports `createOpenPondSandboxClient`, all public sandbox input and response types, and the OpChat helpers used by the Work loop.
|
|
98
98
|
|
|
99
|
+
## Workflows and scheduled Work
|
|
100
|
+
|
|
101
|
+
Use `openpond.workflows` for model-driven scheduled Work. Workflows use the same Saved Work definitions, conversations, runs, and scheduler as the hosted OpenPond Workflows UI:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
const workflow = await openpond.workflows.create({
|
|
105
|
+
name: "Morning market brief",
|
|
106
|
+
prompt: "Summarize the overnight market and write the brief to outputs.",
|
|
107
|
+
recurrence: {
|
|
108
|
+
version: 1,
|
|
109
|
+
kind: "weekdays",
|
|
110
|
+
timeZone: "America/New_York",
|
|
111
|
+
startDate: "2026-08-18",
|
|
112
|
+
localTime: "08:30",
|
|
113
|
+
end: { kind: "never" },
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const catalog = await openpond.workflows.list();
|
|
118
|
+
await openpond.workflows.runNow(workflow.scheduleId);
|
|
119
|
+
await openpond.workflows.update(workflow.scheduleId, { enabled: false });
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`openpond.workflows` is distinct from `openpond.sandboxes.createSchedule()`. Workflows schedule model-driven Work and create normal Work conversations and run history. Raw sandbox schedules execute a declared sandbox command or action.
|
|
123
|
+
|
|
99
124
|
## Project Actions
|
|
100
125
|
|
|
101
126
|
Project Actions expose typed business functions from a normal Git Project to local OpenPond Work. The website and action wrapper can import the same neutral domain module, so the harness does not duplicate application logic.
|
package/dist/index.js
CHANGED
|
@@ -1188,7 +1188,8 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
1188
1188
|
return this.requestApiRoot(`/projects?${query.toString()}`).then((payload) => payload.projects);
|
|
1189
1189
|
}
|
|
1190
1190
|
upsertProject(input) {
|
|
1191
|
-
|
|
1191
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1192
|
+
return this.requestApiRoot(`/projects?${query.toString()}`, {
|
|
1192
1193
|
method: "POST",
|
|
1193
1194
|
body: JSON.stringify(input)
|
|
1194
1195
|
}).then((payload) => payload.project);
|
|
@@ -1255,7 +1256,8 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
1255
1256
|
return this.requestApiRoot(`/agents?${query.toString()}`).then((payload) => payload.agents);
|
|
1256
1257
|
}
|
|
1257
1258
|
upsertAgent(input) {
|
|
1258
|
-
|
|
1259
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1260
|
+
return this.requestApiRoot(`/agents?${query.toString()}`, {
|
|
1259
1261
|
method: "POST",
|
|
1260
1262
|
body: JSON.stringify(input)
|
|
1261
1263
|
}).then((payload) => payload.agent);
|
|
@@ -1277,7 +1279,8 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
1277
1279
|
}).then((payload) => payload.agent);
|
|
1278
1280
|
}
|
|
1279
1281
|
runAgent(agentId, input) {
|
|
1280
|
-
|
|
1282
|
+
const query = new URLSearchParams({ teamId: input.teamId });
|
|
1283
|
+
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/run?${query.toString()}`, {
|
|
1281
1284
|
method: "POST",
|
|
1282
1285
|
headers: {
|
|
1283
1286
|
Prefer: "respond-async"
|
|
@@ -1300,7 +1303,8 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
|
|
|
1300
1303
|
const { teamId: _teamId, ...body } = input;
|
|
1301
1304
|
return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/checks?${query.toString()}`, {
|
|
1302
1305
|
method: "POST",
|
|
1303
|
-
body: JSON.stringify(body)
|
|
1306
|
+
body: JSON.stringify(body),
|
|
1307
|
+
timeoutMs: 15 * 60 * 1e3
|
|
1304
1308
|
});
|
|
1305
1309
|
}
|
|
1306
1310
|
publishAgentSource(agentId, input) {
|
|
@@ -2550,6 +2554,77 @@ function projectActionPath(projectId, suffix, teamId) {
|
|
|
2550
2554
|
return `/v1/project-actions/${encodeURIComponent(projectId)}/${suffix}?teamId=${encodeURIComponent(teamId)}`;
|
|
2551
2555
|
}
|
|
2552
2556
|
|
|
2557
|
+
// src/workflows.ts
|
|
2558
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
2559
|
+
var OpenPondWorkflowsClient = class {
|
|
2560
|
+
#apiKey;
|
|
2561
|
+
#apiBaseUrl;
|
|
2562
|
+
constructor(input) {
|
|
2563
|
+
this.#apiKey = input.apiKey;
|
|
2564
|
+
this.#apiBaseUrl = input.apiBaseUrl.replace(/\/+$/, "");
|
|
2565
|
+
}
|
|
2566
|
+
async list(options = {}) {
|
|
2567
|
+
return this.#request("", "List Workflows", {
|
|
2568
|
+
signal: options.signal
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
async create(input, options = {}) {
|
|
2572
|
+
return this.#request("", "Create Workflow", {
|
|
2573
|
+
method: "POST",
|
|
2574
|
+
body: JSON.stringify({
|
|
2575
|
+
...input,
|
|
2576
|
+
clientRequestId: input.clientRequestId?.trim() || randomUUID2()
|
|
2577
|
+
}),
|
|
2578
|
+
signal: options.signal
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
async update(scheduleId, input, options = {}) {
|
|
2582
|
+
return this.#request(
|
|
2583
|
+
`/schedules/${encodeURIComponent(requiredId(scheduleId, "scheduleId"))}`,
|
|
2584
|
+
"Update Workflow",
|
|
2585
|
+
{
|
|
2586
|
+
method: "PATCH",
|
|
2587
|
+
body: JSON.stringify(input),
|
|
2588
|
+
signal: options.signal
|
|
2589
|
+
}
|
|
2590
|
+
);
|
|
2591
|
+
}
|
|
2592
|
+
async delete(scheduleId, options = {}) {
|
|
2593
|
+
return this.#request(
|
|
2594
|
+
`/schedules/${encodeURIComponent(requiredId(scheduleId, "scheduleId"))}`,
|
|
2595
|
+
"Delete Workflow",
|
|
2596
|
+
{ method: "DELETE", signal: options.signal }
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
async runNow(scheduleId, input = {}, options = {}) {
|
|
2600
|
+
return this.#request(
|
|
2601
|
+
`/schedules/${encodeURIComponent(requiredId(scheduleId, "scheduleId"))}/run`,
|
|
2602
|
+
"Run Workflow",
|
|
2603
|
+
{
|
|
2604
|
+
method: "POST",
|
|
2605
|
+
body: JSON.stringify({
|
|
2606
|
+
clientRequestId: input.clientRequestId?.trim() || randomUUID2()
|
|
2607
|
+
}),
|
|
2608
|
+
signal: options.signal
|
|
2609
|
+
}
|
|
2610
|
+
);
|
|
2611
|
+
}
|
|
2612
|
+
async #request(suffix, label, options = {}) {
|
|
2613
|
+
const response = await apiFetch(
|
|
2614
|
+
this.#apiBaseUrl,
|
|
2615
|
+
this.#apiKey,
|
|
2616
|
+
`/v1/saved-work${suffix}`,
|
|
2617
|
+
options
|
|
2618
|
+
);
|
|
2619
|
+
return readApiJson(response, label);
|
|
2620
|
+
}
|
|
2621
|
+
};
|
|
2622
|
+
function requiredId(value, label) {
|
|
2623
|
+
const normalized = value.trim();
|
|
2624
|
+
if (!normalized) throw new Error(`${label} is required`);
|
|
2625
|
+
return normalized;
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2553
2628
|
// ../cloud/dist/sandbox/types/runtime-profiles.js
|
|
2554
2629
|
var SANDBOX_RUNTIME_PROFILE_IDS = [
|
|
2555
2630
|
"openpond-generic-v1",
|
|
@@ -2562,6 +2637,7 @@ var SANDBOX_RUNTIME_PROFILE_IDS = [
|
|
|
2562
2637
|
var OpenPondClient = class {
|
|
2563
2638
|
sandboxes;
|
|
2564
2639
|
work;
|
|
2640
|
+
workflows;
|
|
2565
2641
|
actions;
|
|
2566
2642
|
constructor(options) {
|
|
2567
2643
|
const apiKey = options.apiKey.trim();
|
|
@@ -2578,6 +2654,7 @@ var OpenPondClient = class {
|
|
|
2578
2654
|
chatApiBaseUrl: options.chatApiUrl?.trim() || resolveOpChatApiBaseUrl({ apiBaseUrl, env: {} }),
|
|
2579
2655
|
sandboxes: this.sandboxes
|
|
2580
2656
|
});
|
|
2657
|
+
this.workflows = new OpenPondWorkflowsClient({ apiKey, apiBaseUrl });
|
|
2581
2658
|
this.actions = new OpenPondProjectActionsClient({ apiKey, apiBaseUrl });
|
|
2582
2659
|
}
|
|
2583
2660
|
};
|
|
@@ -2590,6 +2667,7 @@ export {
|
|
|
2590
2667
|
OpenPondProjectActionsClient,
|
|
2591
2668
|
OpenPondSandboxClient,
|
|
2592
2669
|
OpenPondWorkClient,
|
|
2670
|
+
OpenPondWorkflowsClient,
|
|
2593
2671
|
SANDBOX_RUNTIME_PROFILE_IDS,
|
|
2594
2672
|
createOpenPondClient,
|
|
2595
2673
|
createOpenPondSandboxClient,
|