@withone/cli 2.0.0 → 2.1.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
@@ -269,6 +269,7 @@ one actions find shopify "list products" -t knowledge
269
269
  - **`--task`** describes the whole job in one line, in general terms, which helps choose between similar actions.
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`), for tuning documentation per model later.
272
+ - **`--no-knowledge`** lists the chosen actions (actionId, title, method, path) without fetching their documentation; load it later with `one actions load <actionId>`.
272
273
 
273
274
  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.
274
275
 
package/dist/index.js CHANGED
@@ -3580,7 +3580,7 @@ function document(action, details, platform, settings) {
3580
3580
  truncated: true
3581
3581
  };
3582
3582
  }
3583
- async function find(requests, task, deps, settings, knowledgeCatalog = false) {
3583
+ async function find(requests, task, deps, settings, { knowledgeCatalog = false, knowledge = true } = {}) {
3584
3584
  if (requests.length === 0 || requests.length > FIND_MAX_INTENTS) {
3585
3585
  throw new FindArgsError(`Send between 1 and ${FIND_MAX_INTENTS} platform and intent pairs.`);
3586
3586
  }
@@ -3600,19 +3600,19 @@ async function find(requests, task, deps, settings, knowledgeCatalog = false) {
3600
3600
  if (!reaches(intent.platform)) return { intent, unreachable: true };
3601
3601
  const narrowed = narrow(answers[next++], settings);
3602
3602
  const { answer } = narrowed;
3603
- const picks = settings.knowledgeAgent ? answer.selected.slice(0, 1) : answer.selected;
3603
+ const picks = knowledge && settings.knowledgeAgent ? answer.selected.slice(0, 1) : answer.selected;
3604
3604
  return {
3605
3605
  intent,
3606
3606
  unreachable: false,
3607
3607
  narrowed,
3608
3608
  picks,
3609
3609
  deferred: [...answer.selected.slice(picks.length), ...answer.alsoSelected ?? []],
3610
- runnerUpDocumented: !settings.knowledgeAgent && answer.runnerUp !== void 0
3610
+ runnerUpDocumented: knowledge && !settings.knowledgeAgent && answer.runnerUp !== void 0
3611
3611
  };
3612
3612
  });
3613
3613
  const ids = /* @__PURE__ */ new Set();
3614
3614
  for (const plan of plans) {
3615
- if (plan.unreachable) continue;
3615
+ if (plan.unreachable || !knowledge) continue;
3616
3616
  plan.picks.forEach((a) => ids.add(a.systemId));
3617
3617
  if (plan.runnerUpDocumented && plan.narrowed.answer.runnerUp) ids.add(plan.narrowed.answer.runnerUp.systemId);
3618
3618
  }
@@ -3646,9 +3646,9 @@ async function find(requests, task, deps, settings, knowledgeCatalog = false) {
3646
3646
  };
3647
3647
  }
3648
3648
  const { answer } = plan.narrowed;
3649
- const selected = [];
3649
+ const selected = knowledge ? [] : plan.picks.map(ref);
3650
3650
  const deferred = [];
3651
- for (const [index, pick] of plan.picks.entries()) {
3651
+ for (const [index, pick] of (knowledge ? plan.picks : []).entries()) {
3652
3652
  const doc = document(ref(pick), details.get(pick.systemId) ?? new Error("not fetched"), plan.intent.platform, settings);
3653
3653
  if (!admit(doc)) {
3654
3654
  deferred.push(...plan.picks.slice(index).map(ref));
@@ -3676,7 +3676,7 @@ async function find(requests, task, deps, settings, knowledgeCatalog = false) {
3676
3676
  result[index].runnerUp = doc;
3677
3677
  }
3678
3678
  });
3679
- const documented = result.some((a) => a.selected.length > 0 || a.runnerUp && "knowledge" in a.runnerUp);
3679
+ const documented = result.some((a) => a.selected.some((s) => "knowledge" in s) || a.runnerUp && "knowledge" in a.runnerUp);
3680
3680
  return { answers: result, ...documented ? { guide: closingGuide(settings) } : {} };
3681
3681
  }
3682
3682
  async function load(actionIds, options, deps, settings) {
@@ -3844,7 +3844,9 @@ ${doc.knowledge}`;
3844
3844
  const parts = [`## ${answer.platform}: ${answer.intent}
3845
3845
 
3846
3846
  ${answer.status}`];
3847
- parts.push(...answer.selected.map(shown));
3847
+ const documented = answer.selected.filter((s) => "knowledge" in s);
3848
+ parts.push(...documented.map(shown));
3849
+ parts.push(...listing("Chosen for this intent", answer.selected.filter((s) => !("knowledge" in s))));
3848
3850
  parts.push(
3849
3851
  ...listing(
3850
3852
  answer.selected.length === 0 ? "Chosen for this intent, documentation left out to keep the answer small" : "Also chosen for this intent, documentation left out to keep the answer small",
@@ -3931,7 +3933,7 @@ async function actionsFindCommand(pairs, options) {
3931
3933
  options.task,
3932
3934
  findDeps(api, connectionKeys, options.cache !== false),
3933
3935
  settings,
3934
- options.type === "knowledge"
3936
+ { knowledgeCatalog: options.type === "knowledge", knowledge: options.knowledge !== false }
3935
3937
  );
3936
3938
  if (isAgentMode()) {
3937
3939
  json(result);
@@ -11427,6 +11429,7 @@ One call for the whole task: one platform and intent pair per operation, on any
11427
11429
  - **\`--task\`** (optional) is the whole job in one line, **in general terms**: what it does, without names, addresses, IDs, or message text. It helps choose between similar actions.
11428
11430
  - **\`-t knowledge\`** searches the catalog for writing code and building flows and relays, which includes the platform's own (passthrough) endpoints; the default, \`-t execute\`, is the catalog for running actions now. Knowledge-only mode always uses \`knowledge\`.
11429
11431
  - **\`--ai-model\`** (optional) names the model running the CLI (e.g. \`claude-sonnet-5\`); it will be used to tune documentation per model.
11432
+ - **\`--no-knowledge\`** (optional) lists the chosen actions without their documentation, when only the actionIds are needed. Load the documentation with \`actions load\` before executing.
11430
11433
 
11431
11434
  In \`--agent\` mode:
11432
11435
 
@@ -13176,7 +13179,7 @@ program.command("platforms").alias("p").description("List available platforms").
13176
13179
  await platformsCommand(options);
13177
13180
  });
13178
13181
  var actions = program.command("actions").alias("a").description("Find, read, and execute platform actions (workflow: find \u2192 execute)");
13179
- actions.command("find <pairs...>").alias("f").description('Find the action for every operation a task needs, across platforms, with its documentation, in one call: one actions find <platform> "<intent>" [<platform> "<intent>" ...] (up to 10 pairs). Each intent names the operation alone ("send an email"), without its data. Large documents come back as a digest; each names the exact `actions load` command for what it left out').option("--task <task>", 'The whole task in one line, in general terms (e.g. "email a report to a contact"): what it does, without names, addresses, IDs or message text. Helps choose between similar actions').option("-t, --type <type>", "execute (default: actions to run now) or knowledge (the catalog for writing code and building flows and relays, with the platform's own endpoints). Knowledge-only mode always uses knowledge").option("--ai-model <model>", "The AI model running the CLI (e.g. claude-sonnet-5), which helps optimize the documentation returned. Optional").option("--no-cache", "Bypass the cache for action documentation and re-fetch it (the fresh response still refreshes the cache)").action(async (pairs, options) => {
13182
+ actions.command("find <pairs...>").alias("f").description('Find the action for every operation a task needs, across platforms, with its documentation, in one call: one actions find <platform> "<intent>" [<platform> "<intent>" ...] (up to 10 pairs). Each intent names the operation alone ("send an email"), without its data. Large documents come back as a digest; each names the exact `actions load` command for what it left out').option("--task <task>", 'The whole task in one line, in general terms (e.g. "email a report to a contact"): what it does, without names, addresses, IDs or message text. Helps choose between similar actions').option("-t, --type <type>", "execute (default: actions to run now) or knowledge (the catalog for writing code and building flows and relays, with the platform's own endpoints). Knowledge-only mode always uses knowledge").option("--ai-model <model>", "The AI model running the CLI (e.g. claude-sonnet-5), which helps optimize the documentation returned. Optional").option("--no-cache", "Bypass the cache for action documentation and re-fetch it (the fresh response still refreshes the cache)").option("--no-knowledge", "List the chosen actions (actionId, title, method, path) without their documentation; load it with `one actions load <actionId>`").action(async (pairs, options) => {
13180
13183
  await actionsFindCommand(pairs, options);
13181
13184
  });
13182
13185
  actions.command("load <actionIds...>").alias("l").description("More of an action's documentation (up to 10 actions): the digest by default, --section for one a digest left out, --full for the whole document, --toc for its contents. Also how to read an alternative from a find answer").option("--section <name>", 'Return only the named section(s) \u2014 by heading, id, or alias (e.g. "Response Fields", response, optional). Repeatable or comma-separated', collect, []).option("--full", "Return the whole document instead of the digest").option("--toc", "List every section (id, heading, size) without the document").option("--no-cache", "Bypass the cache and re-fetch from the API (the fresh response still refreshes the cache)").option("--cache-status", "Print cache metadata without fetching").action(async (actionIds, options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -83,6 +83,7 @@ one --agent actions find <platform> "<intent>" [<platform> "<intent>" ...] --tas
83
83
  - **`--task`** (optional) 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 choose between similar actions.
84
84
  - **`-t knowledge`** searches the catalog for writing code and building flows and relays (it includes the platform's own passthrough endpoints); the default, `-t execute`, is the catalog for running actions now.
85
85
  - **`--ai-model`** (optional): the model you are running as (e.g. `claude-sonnet-5`), used to tune documentation per model.
86
+ - **`--no-knowledge`** (optional): list the chosen actions without their documentation, when you only need the actionIds. Load the documentation with `actions load` before executing.
86
87
  - Platform names are lowercase; multi-word names use dashes: `gmail`, `hubspot`, `ship-station`, `google-calendar`.
87
88
 
88
89
  Each entry of `answers[]` carries: