@withone/cli 2.8.0 → 2.9.0

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 CHANGED
@@ -265,7 +265,7 @@ one actions find hubspot "find a contact by email" gmail "send an email" --task
265
265
  one actions find shopify "list products" -t knowledge
266
266
  ```
267
267
 
268
- - Each **intent** names the operation alone, in a few words (`"send a message to a channel"`), without its data: IDs, names and message text make the search miss. Up to 10 pairs.
268
+ - Each **intent** names the operation alone, in a few words (`"send a message to a channel"`), without its data: IDs, names and message text make the search miss. Up to 10 pairs. Name the platform before every intent, even when they share one (`stripe "list charges" stripe "list refunds"`); a "platform" containing a space is refused as an intent that slipped out of its pair.
269
269
  - **`--task`** describes the whole job in one line, in general terms. Agents are asked to send it with every find, since it helps tell similar actions apart.
270
270
  - **`-t knowledge`** searches the catalog for writing code and building flows and relays, which includes the platform's own (passthrough) endpoints; the default is the catalog for running actions now.
271
271
  - **`--ai-model`** names the model running the CLI (e.g. `claude-sonnet-5`), recorded with the find beside the CLI and the harness that launched it, so the account's usage can report which model asked. Agents are asked to send it with every find.
@@ -274,6 +274,8 @@ one actions find shopify "list products" -t knowledge
274
274
 
275
275
  Each intent's answer gives the action(s) to use with their docs, any actions also needed beside them, a **substitute** when the model was unsure (use one or the other, never both), and a few alternatives, then says once how to execute. Always read the docs before executing. The access settings from `one config` apply: an action they refuse is never offered.
276
276
 
277
+ A platform name no active platform has (`clickup` for `click-up`) is answered with `selector: "unknown_platform"` and a `suggestions` list of the platforms it may have meant, closest first, instead of being searched. Find again with the right name; `one platforms` lists them all.
278
+
277
279
  Large documents come back as a **digest**: request-building sections in full (method/URL, headers, description, enforcement rules, required and optional parameters, sample request, gotchas, error handling), then a notice naming what was left out with the exact command to load it. In knowledge-only mode each pick comes back whole, with how to call it from code.
278
280
 
279
281
  ### `one actions load <actionId...>`
package/dist/index.js CHANGED
@@ -3005,6 +3005,9 @@ var EXECUTE_GUIDE = `Run an action with:
3005
3005
  Connection keys come from \`one --agent list\`. Put each value where the action's documentation says it goes: path variables (placeholders like {userId}) in --path-vars, query parameters in --query-params, the request body in -d. Never put path variables or query parameters in -d.`;
3006
3006
  var FindArgsError = class extends Error {
3007
3007
  };
3008
+ function misplacedIntent(requests) {
3009
+ return requests.map((r) => r.platform.trim()).find((platform) => /\s/.test(platform));
3010
+ }
3008
3011
  function findHint(task, aiModel) {
3009
3012
  const missing = [
3010
3013
  task?.trim() ? null : '--task "<the whole job in one line, in general terms, without names, addresses, IDs or message text>"',
@@ -3063,6 +3066,11 @@ function status(answer, narrowed) {
3063
3066
  if (narrowed.replaced) {
3064
3067
  return "The chosen action is not allowed by this CLI, so this is the next allowed candidate: check it fits before using it.";
3065
3068
  }
3069
+ if (answer.selector === "unknown_platform") {
3070
+ const opening = `No active platform is named \`${answer.platform}\`.`;
3071
+ const suggestions = answer.suggestions ?? [];
3072
+ return suggestions.length === 0 ? `${opening} Check the platform name: \`one platforms\` lists them all.` : `${opening} Did you mean ${suggestions.map((s) => `\`${s}\``).join(", ")}? Find again with the platform you meant.`;
3073
+ }
3066
3074
  if (answer.selector === "none_fit" || answer.selected.length === 0) {
3067
3075
  return answer.alternatives.length === 0 ? "No action fits this intent, and nothing close was found. Rephrase it, or check the platform name." : "No action fits this intent. Rephrase it more specifically, or load one of the alternatives.";
3068
3076
  }
@@ -3105,6 +3113,12 @@ async function find(requests, task, deps, settings, { knowledgeCatalog = false,
3105
3113
  if (empty) {
3106
3114
  throw new FindArgsError("Every request needs a platform and an intent.");
3107
3115
  }
3116
+ const misplaced = misplacedIntent(requests);
3117
+ if (misplaced) {
3118
+ throw new FindArgsError(
3119
+ `"${misplaced}" looks like an intent, not a platform: the pairs are out of step. Name the platform before every intent, e.g. one actions find stripe "list charges" stripe "list refunds".`
3120
+ );
3121
+ }
3108
3122
  const platforms = await reachable(settings, deps);
3109
3123
  const reaches = (platform) => platforms === null || platforms.includes(platform.toLowerCase());
3110
3124
  const asked = requests.filter((r) => reaches(r.platform));
@@ -3181,7 +3195,8 @@ async function find(requests, task, deps, settings, { knowledgeCatalog = false,
3181
3195
  selected,
3182
3196
  alsoSelected: [...deferred, ...plan.deferred.map(ref)],
3183
3197
  ...answer.runnerUp ? { runnerUp: ref(answer.runnerUp) } : {},
3184
- alternatives: answer.alternatives.map(ref)
3198
+ alternatives: answer.alternatives.map(ref),
3199
+ ...answer.suggestions?.length ? { suggestions: answer.suggestions } : {}
3185
3200
  };
3186
3201
  });
3187
3202
  plans.forEach((plan, index) => {
@@ -3433,7 +3448,9 @@ async function actionsFindCommand(pairs, options) {
3433
3448
  error("--type must be execute or knowledge.");
3434
3449
  }
3435
3450
  if (pairs.length === 0 || pairs.length % 2 !== 0) {
3436
- error('Pass platform and intent pairs: one actions find <platform> "<intent>" [<platform> "<intent>" ...]');
3451
+ error(
3452
+ 'Pass platform and intent pairs, naming the platform before every intent: one actions find <platform> "<intent>" [<platform> "<intent>" ...], e.g. one actions find stripe "list charges" stripe "list refunds"'
3453
+ );
3437
3454
  }
3438
3455
  const requests = [];
3439
3456
  for (let i = 0; i < pairs.length; i += 2) {
@@ -10944,7 +10961,7 @@ Removes a connection by its key. In agent mode, returns \`{"deleted": true, "pla
10944
10961
  one --agent actions find <platform> "<intent>" [<platform> "<intent>" ...] --task "<the job, in general terms>" --ai-model "<your model>"
10945
10962
  \`\`\`
10946
10963
 
10947
- One call for the whole task: one platform and intent pair per operation, on any platforms (up to 10). One's decision model picks the action for each and returns it **with its documentation** \u2014 required fields, validation rules, request structure. **Read it before execute.**
10964
+ One call for the whole task: one platform and intent pair per operation, on any platforms (up to 10). Name the platform before **every** intent, even when they share one: \`stripe "list charges" stripe "list refunds"\`. One's decision model picks the action for each and returns it **with its documentation** \u2014 required fields, validation rules, request structure. **Read it before execute.**
10948
10965
 
10949
10966
  - **\`intent\` names the operation alone**, in a few words: \`"send a message to a channel"\`, not \`"post 'deploy done' in #eng"\`. IDs, names, and message text in the intent make the search miss.
10950
10967
  - **\`--task\`**: send it with every find. It is the whole job in one line, **in general terms**: what it does, without names, addresses, IDs, or message text. It helps tell similar actions apart.
@@ -10981,7 +10998,8 @@ In \`--agent\` mode:
10981
10998
  - **\`alsoSelected\`** \u2014 also needed, listed rather than documented to keep the answer small: \`actions load\` them.
10982
10999
  - **\`runnerUp\`** \u2014 only when the model was unsure: a **substitute** for the pick. Use one or the other, **never both**.
10983
11000
  - **\`alternatives\`** \u2014 other candidates, undocumented.
10984
- - **\`status\`** \u2014 why: a confidence, *no action fits* (rephrase the intent by outcome, or check the platform), *the decision model was unavailable* (top search result: check it fits), *not allowed by this CLI* (the next allowed candidate stood in), or *allow none of them* (your access settings block the operation \u2014 rephrasing won't help).
11001
+ - **\`suggestions\`** \u2014 only when \`selector\` is \`unknown_platform\`: no active platform has the name you sent, so nothing was answered. These are the platforms you may have meant, closest first (\`clickup\` \u2192 \`click-up\`). Find again with the right one; \`one platforms\` lists every name.
11002
+ - **\`status\`** \u2014 why: a confidence, *no active platform is named* (use a \`suggestions\` entry, or check \`one platforms\`), *no action fits* (rephrase the intent by outcome, or check the platform), *the decision model was unavailable* (top search result: check it fits), *not allowed by this CLI* (the next allowed candidate stood in), or *allow none of them* (your access settings block the operation \u2014 rephrasing won't help).
10985
11003
  - **\`guide\`** \u2014 how to execute, stated once for every action.
10986
11004
  - \`truncated: false\` means \`knowledge\` is the whole document; small docs are never trimmed.
10987
11005
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -79,7 +79,7 @@ Removes a connection. Returns `{"deleted": true, "platform": "...", "key": "..."
79
79
  one --agent actions find <platform> "<intent>" [<platform> "<intent>" ...] --task "<the job, in general terms>" --ai-model "<your model>"
80
80
  ```
81
81
 
82
- **One call for the whole task**: one platform and intent pair per operation, on any platforms (up to 10). One's decision model picks the action for each and returns it **with its documentation**: exactly what parameters are required, how to structure the request, and where each value goes. Never execute without reading it — without it you'll guess wrong on parameters.
82
+ **One call for the whole task**: one platform and intent pair per operation, on any platforms (up to 10). Name the platform before **every** intent, even when they share one: `stripe "list charges" stripe "list refunds"`. One's decision model picks the action for each and returns it **with its documentation**: exactly what parameters are required, how to structure the request, and where each value goes. Never execute without reading it — without it you'll guess wrong on parameters.
83
83
 
84
84
  - **`intent` names the operation alone**, in a few words: `"send a message to a channel"`, not `"post 'deploy done' in #eng"`. IDs, names, and message text in the intent make the search miss.
85
85
  - **`--task`**: send it with every find. It is the whole job in one line, **in general terms**: `"email a weather report to a contact"`, without names, addresses, IDs, or message text. It helps tell similar actions apart.
@@ -95,7 +95,8 @@ Each entry of `answers[]` carries:
95
95
  - `alsoSelected[]` — also needed, listed rather than documented to keep the answer small: `actions load` them.
96
96
  - `runnerUp` — only when the model was unsure: a **substitute** for the pick. Use **one or the other, never both**.
97
97
  - `alternatives[]` — other candidates, undocumented.
98
- - `status` — why: a confidence; *no action fits* (rephrase the intent by outcome, or check the platform); *the decision model was unavailable* (the top search result — check it fits); *not allowed by this CLI* (the next allowed candidate stood in); or *allow none of them* (the access settings block the operation — tell the user, rephrasing won't help).
98
+ - `suggestions[]` — only when `selector` is `unknown_platform`: no active platform has the name you sent, so nothing was answered. These are the platforms you may have meant, closest first (`clickup` → `click-up`). Find again with the right one; `one platforms` lists every name.
99
+ - `status` — why: a confidence; *no active platform is named* (use a `suggestions` entry, or check `one platforms`); *no action fits* (rephrase the intent by outcome, or check the platform); *the decision model was unavailable* (the top search result — check it fits); *not allowed by this CLI* (the next allowed candidate stood in); or *allow none of them* (the access settings block the operation — tell the user, rephrasing won't help).
99
100
 
100
101
  `guide` (once, at the end) says how to execute any of them.
101
102