@withone/cli 1.13.4 → 1.13.5
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.
|
@@ -150,9 +150,17 @@ var OneApi = class {
|
|
|
150
150
|
}
|
|
151
151
|
let queryString = "";
|
|
152
152
|
if (args.queryParams && Object.keys(args.queryParams).length > 0) {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
const entries = [];
|
|
154
|
+
for (const [k, v] of Object.entries(args.queryParams)) {
|
|
155
|
+
if (Array.isArray(v)) {
|
|
156
|
+
for (const item of v) {
|
|
157
|
+
entries.push([k, String(item)]);
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
entries.push([k, String(v)]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const params = new URLSearchParams(entries);
|
|
156
164
|
queryString = `?${params.toString()}`;
|
|
157
165
|
}
|
|
158
166
|
const fullUrl = `${url}${queryString}`;
|
|
@@ -293,31 +301,26 @@ function isActionAllowed(actionId, allowedActionIds) {
|
|
|
293
301
|
return allowedActionIds.includes("*") || allowedActionIds.includes(actionId);
|
|
294
302
|
}
|
|
295
303
|
function buildActionKnowledgeWithGuidance(knowledge, method, platform, actionId) {
|
|
296
|
-
const baseUrl = "https://api.withone.ai";
|
|
297
304
|
return `${knowledge}
|
|
298
305
|
|
|
299
|
-
|
|
306
|
+
CLI PARAMETER MAPPING
|
|
300
307
|
======================
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
IMPORTANT: When constructing the URL, only include the API endpoint path after the base URL.
|
|
304
|
-
Do NOT include the full third-party API URL.
|
|
305
|
-
|
|
306
|
-
Examples:
|
|
307
|
-
Correct: ${baseUrl}/v1/passthrough/crm/v3/objects/contacts/search
|
|
308
|
-
Incorrect: ${baseUrl}/v1/passthrough/https://api.hubapi.com/crm/v3/objects/contacts/search
|
|
308
|
+
Use the One CLI to execute this action. Map parameters from the documentation above to CLI flags:
|
|
309
309
|
|
|
310
|
-
|
|
310
|
+
- **Path variables** (URL placeholders like {userId}, {id}) \u2192 \`--path-vars '{"userId": "me", "id": "123"}'\`
|
|
311
|
+
- **Query parameters** (filtering, pagination, format options) \u2192 \`--query-params '{"key": "value"}'\`
|
|
312
|
+
- For repeated params, use arrays: \`--query-params '{"metadataHeaders": ["From", "Subject"]}'\`
|
|
313
|
+
- **Request body** (POST/PUT/PATCH data) \u2192 \`-d '{"field": "value"}'\`
|
|
311
314
|
|
|
312
|
-
|
|
313
|
-
- x-one-secret: {{process.env.ONE_SECRET}}
|
|
314
|
-
- x-one-connection-key: {{process.env.ONE_${platform.toUpperCase()}_CONNECTION_KEY}}
|
|
315
|
-
- x-one-action-id: ${actionId}
|
|
316
|
-
- ... (other headers)
|
|
315
|
+
Do NOT pass path variables or query parameters in the -d body flag \u2014 they will be ignored.
|
|
317
316
|
|
|
318
|
-
|
|
317
|
+
EXAMPLE COMMAND:
|
|
318
|
+
one --agent actions execute ${platform} ${actionId} <connectionKey> \\
|
|
319
|
+
--path-vars '{ ... }' \\
|
|
320
|
+
--query-params '{ ... }' \\
|
|
321
|
+
-d '{ ... }'
|
|
319
322
|
|
|
320
|
-
|
|
323
|
+
Replace the JSON objects above with the actual parameters from the documentation. Omit any flag that has no parameters for this action (e.g., omit --path-vars if the URL has no placeholders, omit -d for GET requests).`;
|
|
321
324
|
}
|
|
322
325
|
|
|
323
326
|
// src/lib/flow-engine.ts
|
|
@@ -655,7 +658,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
|
|
|
655
658
|
if (flowStack.includes(resolvedKey)) {
|
|
656
659
|
throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
|
|
657
660
|
}
|
|
658
|
-
const { loadFlow: loadFlow2 } = await import("./flow-runner-
|
|
661
|
+
const { loadFlow: loadFlow2 } = await import("./flow-runner-ZTLAFPFP.js");
|
|
659
662
|
const subFlow = loadFlow2(resolvedKey);
|
|
660
663
|
const subContext = await executeFlow(
|
|
661
664
|
subFlow,
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -78,7 +78,7 @@ one --agent actions knowledge <platform> <actionId>
|
|
|
78
78
|
|
|
79
79
|
Get comprehensive documentation for an action including parameters, requirements, validation rules, request/response structure, and examples. Returns JSON with the full API knowledge and HTTP method.
|
|
80
80
|
|
|
81
|
-
Always call this before executing — it tells you exactly what parameters are required
|
|
81
|
+
Always call this before executing — it tells you exactly what parameters are required, how to structure the request, and which CLI flags to use for path variables, query parameters, and body data. Do NOT pass path or query parameters in the `-d` body flag.
|
|
82
82
|
|
|
83
83
|
Example:
|
|
84
84
|
```bash
|
|
@@ -124,6 +124,11 @@ one --agent actions execute hub-spot <actionId> <connectionKey> \
|
|
|
124
124
|
one --agent actions execute shopify <actionId> <connectionKey> \
|
|
125
125
|
--path-vars '{"order_id": "12345"}' \
|
|
126
126
|
--query-params '{"limit": "10"}'
|
|
127
|
+
|
|
128
|
+
# With repeated query params (array values expand to repeated keys)
|
|
129
|
+
one --agent actions execute gmail <actionId> <connectionKey> \
|
|
130
|
+
--path-vars '{"userId": "me", "id": "msg123"}' \
|
|
131
|
+
--query-params '{"format": "metadata", "metadataHeaders": ["From", "Subject", "Date"]}'
|
|
127
132
|
```
|
|
128
133
|
|
|
129
134
|
Output format:
|
|
@@ -147,5 +152,6 @@ Parse the output as JSON. If the `error` key is present, the command failed —
|
|
|
147
152
|
- Always use the **exact action ID** from search results — don't guess or construct them
|
|
148
153
|
- Always read the knowledge output carefully — it tells you which parameters are required vs optional, what format they need to be in, and any caveats specific to that API
|
|
149
154
|
- JSON values passed to `-d`, `--path-vars`, `--query-params`, and `--headers` must be valid JSON strings (use single quotes around the JSON to avoid shell escaping issues)
|
|
155
|
+
- **Array query params**: Use JSON arrays for repeated query parameters — `{"metadataHeaders": ["From", "Subject"]}` expands to `metadataHeaders=From&metadataHeaders=Subject`
|
|
150
156
|
- If search returns no results, try broader queries (e.g., `"list"` instead of `"list active premium customers"`)
|
|
151
157
|
- The execute command respects access control settings configured via `one config` — if execution is blocked, the user may need to adjust their permissions
|