openpond-sdk 0.0.8 → 0.0.11

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/index.js CHANGED
@@ -1280,12 +1280,13 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1280
1280
  }
1281
1281
  runAgent(agentId, input) {
1282
1282
  const query = new URLSearchParams({ teamId: input.teamId });
1283
+ const { teamId: _teamId, ...body } = input;
1283
1284
  return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/run?${query.toString()}`, {
1284
1285
  method: "POST",
1285
1286
  headers: {
1286
1287
  Prefer: "respond-async"
1287
1288
  },
1288
- body: JSON.stringify(input)
1289
+ body: JSON.stringify(body)
1289
1290
  });
1290
1291
  }
1291
1292
  getAgentSourceDeployPlan(agentId, input) {
@@ -1965,6 +1966,7 @@ async function* streamHostedChatTurn(options) {
1965
1966
  var DEFAULT_MODEL = "openpond-chat";
1966
1967
  var DEFAULT_MAX_STEPS = 24;
1967
1968
  var MAX_TOOL_OUTPUT_CHARS = 4e4;
1969
+ var MAX_WORK_COMMAND_CHARS = 2e4;
1968
1970
  var WORK_OUTPUT_DIRECTORY = "outputs";
1969
1971
  var WORK_INPUT_DIRECTORY = "inputs/previous-outputs";
1970
1972
  var WORK_INPUT_MANIFEST = "inputs/.openpond-context.json";
@@ -2285,6 +2287,11 @@ var OpenPondWorkClient = class {
2285
2287
  }
2286
2288
  const command = typeof args.command === "string" ? args.command.trim() : "";
2287
2289
  if (!command) return toolMessage(toolCallId, { error: "command is required" });
2290
+ if (command.length > MAX_WORK_COMMAND_CHARS) {
2291
+ const output = `command exceeds the ${MAX_WORK_COMMAND_CHARS} character limit`;
2292
+ await emit({ type: "tool", toolCallId, command, status: "failed", output });
2293
+ return toolMessage(toolCallId, { status: "failed", error: output });
2294
+ }
2288
2295
  await emit({ type: "tool", toolCallId, command, status: "started" });
2289
2296
  try {
2290
2297
  const response = await this.#sandboxes.exec(sandboxId, {
@@ -2324,7 +2331,12 @@ var WORK_TOOLS = [
2324
2331
  type: "object",
2325
2332
  additionalProperties: false,
2326
2333
  properties: {
2327
- command: { type: "string", description: "Shell command to execute." }
2334
+ command: {
2335
+ type: "string",
2336
+ minLength: 1,
2337
+ maxLength: MAX_WORK_COMMAND_CHARS,
2338
+ description: "Shell command to execute."
2339
+ }
2328
2340
  },
2329
2341
  required: ["command"]
2330
2342
  }
@@ -2554,6 +2566,69 @@ function projectActionPath(projectId, suffix, teamId) {
2554
2566
  return `/v1/project-actions/${encodeURIComponent(projectId)}/${suffix}?teamId=${encodeURIComponent(teamId)}`;
2555
2567
  }
2556
2568
 
2569
+ // src/profile-actions.ts
2570
+ var OpenPondProfileActionsClient = class {
2571
+ #apiKey;
2572
+ #apiBaseUrl;
2573
+ constructor(input) {
2574
+ this.#apiKey = input.apiKey;
2575
+ this.#apiBaseUrl = input.apiBaseUrl.replace(/\/+$/, "");
2576
+ }
2577
+ async catalog(input) {
2578
+ const teamId = requiredValue(input.teamId, "teamId");
2579
+ const search = new URLSearchParams({ teamId });
2580
+ if (input.profileId?.trim()) search.set("profileId", input.profileId.trim());
2581
+ if (input.profileName?.trim()) {
2582
+ search.set("profileName", input.profileName.trim());
2583
+ }
2584
+ const response = await apiFetch(
2585
+ this.#apiBaseUrl,
2586
+ this.#apiKey,
2587
+ `/v1/profile/actions?${search.toString()}`
2588
+ );
2589
+ return (await readApiJson(
2590
+ response,
2591
+ "Get Profile Action catalog"
2592
+ )).catalog;
2593
+ }
2594
+ async run(input) {
2595
+ const teamId = requiredValue(input.teamId, "teamId");
2596
+ const actionKey = requiredValue(input.actionKey, "actionKey");
2597
+ const idempotencyKey = requiredValue(input.idempotencyKey, "idempotencyKey");
2598
+ const catalogVersion = requiredValue(input.catalogVersion, "catalogVersion");
2599
+ const response = await apiFetch(
2600
+ this.#apiBaseUrl,
2601
+ this.#apiKey,
2602
+ `/v1/profile/actions/run?${new URLSearchParams({ teamId }).toString()}`,
2603
+ {
2604
+ method: "POST",
2605
+ headers: { "Content-Type": "application/json" },
2606
+ body: JSON.stringify({
2607
+ ...input.profileId?.trim() ? { profileId: input.profileId.trim() } : {},
2608
+ ...input.profileName?.trim() ? { profileName: input.profileName.trim() } : {},
2609
+ actionKey,
2610
+ value: input.value ?? {},
2611
+ conversationId: input.conversationId ?? null,
2612
+ createConversation: input.createConversation,
2613
+ conversationTitle: input.conversationTitle ?? null,
2614
+ idempotencyKey,
2615
+ catalogVersion,
2616
+ externalCapabilityLeases: input.externalCapabilityLeases
2617
+ })
2618
+ }
2619
+ );
2620
+ return readApiJson(
2621
+ response,
2622
+ "Run Profile Action"
2623
+ );
2624
+ }
2625
+ };
2626
+ function requiredValue(value, name) {
2627
+ const normalized = value.trim();
2628
+ if (!normalized) throw new Error(`${name} is required`);
2629
+ return normalized;
2630
+ }
2631
+
2557
2632
  // src/workflows.ts
2558
2633
  import { randomUUID as randomUUID2 } from "node:crypto";
2559
2634
  var OpenPondWorkflowsClient = class {
@@ -2639,6 +2714,7 @@ var OpenPondClient = class {
2639
2714
  work;
2640
2715
  workflows;
2641
2716
  actions;
2717
+ profileActions;
2642
2718
  constructor(options) {
2643
2719
  const apiKey = options.apiKey.trim();
2644
2720
  if (!apiKey) throw new Error("OpenPond API key is required");
@@ -2656,6 +2732,7 @@ var OpenPondClient = class {
2656
2732
  });
2657
2733
  this.workflows = new OpenPondWorkflowsClient({ apiKey, apiBaseUrl });
2658
2734
  this.actions = new OpenPondProjectActionsClient({ apiKey, apiBaseUrl });
2735
+ this.profileActions = new OpenPondProfileActionsClient({ apiKey, apiBaseUrl });
2659
2736
  }
2660
2737
  };
2661
2738
  function createOpenPondClient(options) {
@@ -2664,6 +2741,7 @@ function createOpenPondClient(options) {
2664
2741
  export {
2665
2742
  OpenPondApiError,
2666
2743
  OpenPondClient,
2744
+ OpenPondProfileActionsClient,
2667
2745
  OpenPondProjectActionsClient,
2668
2746
  OpenPondSandboxClient,
2669
2747
  OpenPondWorkClient,