@octen.ai/cli 0.5.1 → 0.5.2

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
@@ -61,7 +61,7 @@ Search the live web.
61
61
  octen search "latest LLM benchmarks" -n 10 --topic news --highlight --time-range week
62
62
  ```
63
63
 
64
- Options: `-n` (result count 1–100), `--topic` (general|news), `--highlight` (+`--highlight-max-tokens`, min 100), `--time-range` (day|week|month|year or d|w|m|y), `--start-time`/`--end-time` (YYYY-MM-DD or ISO datetime), `--include-domains`, `--exclude-domains`, `--full-content`, `--images`, `--videos`, `--format` (text|markdown), `--safesearch`.
64
+ Options: `-n` (result count 1–100), `--topic` (general|news), `--highlight` (+`--highlight-max-tokens`, min 100), `--time-range` (day|week|month|year or d|w|m|y), `--start-time`/`--end-time` (YYYY-MM-DD or ISO datetime), `--include-domains`, `--exclude-domains`, `--full-content`, `--images`, `--videos`, `--format` (text|markdown), `--safesearch`, `--country` (country code for region-specific results — [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) like US or JP, or auto, the default).
65
65
 
66
66
  ---
67
67
 
@@ -85,7 +85,7 @@ Use it for comparisons across many sources (pricing, products, vendors), surveys
85
85
  octen broad-search "compare cloud GPU pricing across providers" --max-queries 5 -n 10
86
86
  ```
87
87
 
88
- Options: `--max-queries` (decompose into up to N sub-queries, 1–30, default 5), plus all `octen search` flags (`-n/--count` per sub-query, `--topic`, `--highlight`, `--full-content`, `--time-range`, `--start-time`/`--end-time`, `--include-domains`/`--exclude-domains`, `--include-text`/`--exclude-text`, `--images`, `--videos`, `--format`, `--safesearch`).
88
+ Options: `--max-queries` (decompose into up to N sub-queries, 1–30, default 5), plus all `octen search` flags (`-n/--count` per sub-query, `--topic`, `--highlight`, `--full-content`, `--time-range`, `--start-time`/`--end-time`, `--include-domains`/`--exclude-domains`, `--include-text`/`--exclude-text`, `--images`, `--videos`, `--format`, `--safesearch`, `--country`).
89
89
 
90
90
  ---
91
91
 
@@ -113,10 +113,11 @@ octen chat "Summarize the Octen docs" -m anthropic/claude-haiku-4.5
113
113
 
114
114
  Streaming is on by default when output is a TTY; use `--no-stream` to get a single JSON response. Pass `-i` for interactive REPL mode. Set `OCTEN_CHAT_MODEL` to avoid specifying `-m` every time.
115
115
 
116
- **Web search** is now powered by the built-in `octen_search` tool. Pass `--search` to let the model search the web (the old `--web-search on` flag has been removed):
116
+ **Web search** is powered by built-in server tools. Pass `--search` to let the model search the web via the `octen_search` tool (the old `--web-search on` flag has been removed), and/or `--broad-search` to enable the `octen_broad_search` tool, which fans a question out into several sub-queries for comprehensive coverage — both may be enabled together:
117
117
 
118
118
  ```sh
119
119
  octen chat "What launched at the latest Octen event?" -m anthropic/claude-haiku-4.5 --search --search-count 10
120
+ octen chat "Compare cloud GPU pricing across providers" -m anthropic/claude-haiku-4.5 --broad-search --search-max-queries 5
120
121
  ```
121
122
 
122
123
  When search runs, cited sources are listed after the answer (pretty mode) and the raw response includes `search_results` and per-message `annotations`.
@@ -127,7 +128,7 @@ Sampling: `--temperature`, `--top-p`, `--top-k`, `--min-p`, `--top-a`, `--repeti
127
128
 
128
129
  Reasoning: `--reasoning-effort` (xhigh|high|medium|low|minimal|none), `--reasoning-max-tokens`. When a model emits reasoning it is shown under a dim `reasoning:` prefix in pretty mode.
129
130
 
130
- Web search (only meaningful with `--search`): `--search-max-searches <n>` (default 5), `--search-count <n>` (1-100), `--search-include-domains <list>`, `--search-exclude-domains <list>`, `--search-time-basis` (auto|published|crawled), `--search-start-time <when>`, `--search-end-time <when>`, `--search-format` (markdown|text), `--search-safesearch` (off|strict), `--search-full-content` (+`--search-full-content-max-tokens <n>`), `--search-highlight-max-tokens <n>`.
131
+ Web search (only meaningful with `--search` and/or `--broad-search`): `--search-max-searches <n>` (octen_search only; default 5), `--search-max-queries <n>` (octen_broad_search only; 1-30, default 5), `--search-topic` (general|news), `--search-count <n>` (1-100), `--search-include-domains <list>`, `--search-exclude-domains <list>`, `--search-include-text <list>`/`--search-exclude-text <list>` (max 5 each), `--search-time-basis` (auto|published|crawled), `--search-time-range` (day|week|month|year or d|w|m|y), `--search-start-time <when>`, `--search-end-time <when>`, `--search-format` (markdown|text), `--search-safesearch` (off|strict), `--search-country` (ISO 3166-1 alpha-2 like US or JP, or auto), `--search-include-images`, `--search-full-content` (+`--search-full-content-max-tokens <n>`), `--search-highlight-max-tokens <n>`. The shared options apply to whichever tool(s) are enabled.
131
132
 
132
133
  ---
133
134
 
@@ -1,3 +1,4 @@
1
+ import { TOPIC_OPTIONS } from "./constants.js";
1
2
  /** A cache_control marker that can ride along on a content block. */
2
3
  export interface CacheControl {
3
4
  type: "ephemeral";
@@ -61,20 +62,36 @@ export declare const SEARCH_SAFESEARCH_OPTIONS: readonly ["off", "strict"];
61
62
  export type SearchSafesearch = (typeof SEARCH_SAFESEARCH_OPTIONS)[number];
62
63
  export declare const SEARCH_FORMAT_OPTIONS: readonly ["markdown", "text"];
63
64
  export type SearchFormat = (typeof SEARCH_FORMAT_OPTIONS)[number];
64
- /** Options for the built-in octen_search tool (web search). */
65
+ export type SearchTopic = (typeof TOPIC_OPTIONS)[number];
66
+ /**
67
+ * Options for the built-in web search tools (octen_search / octen_broad_search).
68
+ * The shared fields map to WebSearchOptions and apply to whichever tool(s) are
69
+ * enabled; `maxSearches` is octen_search-only and `maxQueries` is
70
+ * octen_broad_search-only.
71
+ */
65
72
  export interface SearchOpts {
73
+ /** Enable the octen_search tool. */
66
74
  enabled?: boolean;
75
+ /** Enable the octen_broad_search tool (may be combined with `enabled`). */
76
+ broadEnabled?: boolean;
77
+ /** octen_search only. */
67
78
  maxSearches?: number;
79
+ /** octen_broad_search only. */
80
+ maxQueries?: number;
81
+ topic?: SearchTopic;
68
82
  count?: number;
69
83
  includeDomains?: string[];
70
84
  excludeDomains?: string[];
71
85
  includeText?: string[];
72
86
  excludeText?: string[];
73
87
  timeBasis?: SearchTimeBasis;
88
+ timeRange?: string;
74
89
  startTime?: string;
75
90
  endTime?: string;
76
91
  format?: SearchFormat;
77
92
  safesearch?: SearchSafesearch;
93
+ country?: string;
94
+ includeImages?: boolean;
78
95
  fullContent?: boolean;
79
96
  fullContentMaxTokens?: number;
80
97
  highlightMaxTokens?: number;
package/dist/api/chat.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { OctenValidationError } from "./errors.js";
2
2
  import { normalizeTimeBound } from "./search.js";
3
- import { LIMITS } from "./constants.js";
3
+ import { LIMITS, TOPIC_OPTIONS, TIME_RANGE_OPTIONS } from "./constants.js";
4
4
  export const VERBOSITY_OPTIONS = ["low", "medium", "high"];
5
5
  export const REASONING_EFFORT_OPTIONS = [
6
6
  "xhigh",
@@ -18,29 +18,38 @@ function assertEnum(value, allowed, flag) {
18
18
  throw new OctenValidationError(`${flag} must be one of: ${allowed.join(", ")}`);
19
19
  }
20
20
  }
21
- /** Build the octen_search tool entry from search options. */
22
- function buildSearchTool(s) {
21
+ /** Build the shared WebSearchOptions parameters common to both search tools. */
22
+ function buildWebSearchParameters(s) {
23
+ assertEnum(s.topic, TOPIC_OPTIONS, "--search-topic");
24
+ assertEnum(s.timeRange, TIME_RANGE_OPTIONS, "--search-time-range");
23
25
  assertEnum(s.timeBasis, SEARCH_TIME_BASIS_OPTIONS, "--search-time-basis");
24
26
  assertEnum(s.safesearch, SEARCH_SAFESEARCH_OPTIONS, "--search-safesearch");
25
27
  assertEnum(s.format, SEARCH_FORMAT_OPTIONS, "--search-format");
26
28
  if (s.count != null && (s.count < LIMITS.searchCount.min || s.count > LIMITS.searchCount.max))
27
29
  throw new OctenValidationError(`--search-count must be ${LIMITS.searchCount.min}-${LIMITS.searchCount.max}`);
30
+ if (s.includeText && s.includeText.length > LIMITS.includeText)
31
+ throw new OctenValidationError(`--search-include-text max ${LIMITS.includeText}`);
32
+ if (s.excludeText && s.excludeText.length > LIMITS.excludeText)
33
+ throw new OctenValidationError(`--search-exclude-text max ${LIMITS.excludeText}`);
28
34
  const parameters = {};
29
35
  const put = (k, v) => {
30
36
  if (v != null)
31
37
  parameters[k] = v;
32
38
  };
33
- put("max_searches", s.maxSearches);
39
+ put("topic", s.topic);
34
40
  put("count", s.count);
35
41
  put("include_domains", s.includeDomains);
36
42
  put("exclude_domains", s.excludeDomains);
37
43
  put("include_text", s.includeText);
38
44
  put("exclude_text", s.excludeText);
39
45
  put("time_basis", s.timeBasis);
46
+ put("time_range", s.timeRange);
40
47
  put("start_time", normalizeTimeBound("--search-start-time", s.startTime, false));
41
48
  put("end_time", normalizeTimeBound("--search-end-time", s.endTime, true));
42
49
  put("format", s.format);
43
50
  put("safesearch", s.safesearch);
51
+ put("country", s.country);
52
+ put("include_images", s.includeImages);
44
53
  if (s.fullContent) {
45
54
  parameters["full_content"] = {
46
55
  enable: true,
@@ -50,8 +59,24 @@ function buildSearchTool(s) {
50
59
  if (s.highlightMaxTokens != null) {
51
60
  parameters["highlight"] = { enable: true, max_tokens: s.highlightMaxTokens };
52
61
  }
62
+ return parameters;
63
+ }
64
+ /** Build the octen_search tool entry from search options. */
65
+ function buildSearchTool(s) {
66
+ const parameters = buildWebSearchParameters(s);
67
+ if (s.maxSearches != null)
68
+ parameters["max_searches"] = s.maxSearches;
53
69
  return { type: "octen_search", parameters };
54
70
  }
71
+ /** Build the octen_broad_search tool entry from search options. */
72
+ function buildBroadSearchTool(s) {
73
+ if (s.maxQueries != null && (s.maxQueries < LIMITS.maxQueries.min || s.maxQueries > LIMITS.maxQueries.max))
74
+ throw new OctenValidationError(`--search-max-queries must be ${LIMITS.maxQueries.min}-${LIMITS.maxQueries.max}`);
75
+ const parameters = buildWebSearchParameters(s);
76
+ if (s.maxQueries != null)
77
+ parameters["max_queries"] = s.maxQueries;
78
+ return { type: "octen_broad_search", parameters };
79
+ }
55
80
  /**
56
81
  * Wrap message content so the system message can carry cache_control. The system
57
82
  * message becomes a single text content block tagged ephemeral; other messages are
@@ -103,8 +128,12 @@ export function buildChatRequest(messages, model, o) {
103
128
  reasoning["max_tokens"] = o.reasoningMaxTokens;
104
129
  req["reasoning"] = reasoning;
105
130
  }
106
- if (o.search?.enabled) {
107
- req["tools"] = [buildSearchTool(o.search)];
108
- }
131
+ const tools = [];
132
+ if (o.search?.enabled)
133
+ tools.push(buildSearchTool(o.search));
134
+ if (o.search?.broadEnabled)
135
+ tools.push(buildBroadSearchTool(o.search));
136
+ if (tools.length)
137
+ req["tools"] = tools;
109
138
  return req;
110
139
  }
@@ -43,6 +43,7 @@ export interface SearchOpts {
43
43
  endTime?: string;
44
44
  format?: "text" | "markdown";
45
45
  safesearch?: "off" | "strict";
46
+ country?: string;
46
47
  highlight?: boolean;
47
48
  highlightMaxTokens?: number;
48
49
  fullContent?: boolean;
@@ -56,6 +56,7 @@ export function buildSearchOptions(o) {
56
56
  put("end_time", normalizeTimeBound("--end-time", o.endTime, true));
57
57
  put("format", o.format);
58
58
  put("safesearch", o.safesearch);
59
+ put("country", o.country);
59
60
  put("include_images", o.images);
60
61
  put("include_videos", o.videos);
61
62
  if (o.highlight)
@@ -19,6 +19,7 @@ export function registerBroadSearch(program) {
19
19
  .option("--start-time <when>", "YYYY-MM-DD or ISO datetime (e.g. 2024-01-01T00:00:00Z)")
20
20
  .option("--end-time <when>", "YYYY-MM-DD or ISO datetime (e.g. 2024-12-31T23:59:59Z)")
21
21
  .option("--format <f>", "text|markdown").option("--safesearch <s>", "off|strict")
22
+ .option("--country <code>", "country code for region-specific results — ISO 3166-1 alpha-2 (e.g. US, JP) or auto (default)")
22
23
  .option("--highlight").option("--highlight-max-tokens <n>", "max tokens per highlight", parseIntOpt("--highlight-max-tokens"))
23
24
  .option("--full-content").option("--full-content-max-tokens <n>", "max tokens per result", parseIntOpt("--full-content-max-tokens"))
24
25
  .option("--images").option("--videos")
@@ -77,20 +77,29 @@ export function registerChat(program) {
77
77
  .option("-m, --model <id>", "model ID, e.g. anthropic/claude-haiku-4.5 (required unless OCTEN_CHAT_MODEL is set)")
78
78
  .option("--system <s>", "system message")
79
79
  .option("--cache-system", "send the system message as a cache_control ephemeral block")
80
- // ── Web search (octen_search tool) ──────────────────────────────────────
80
+ // ── Web search (octen_search / octen_broad_search tools) ────────────────
81
+ // The remaining --search-* options apply to whichever tool(s) are enabled.
81
82
  .option("--search", "enable web search via the built-in octen_search tool")
83
+ .option("--broad-search", "enable broad (multi-query) web search via the built-in octen_broad_search tool")
82
84
  .option("--search-max-searches <n>", "octen_search: max searches (default 5)", parseIntOpt("--search-max-searches"))
83
- .option("--search-count <n>", "octen_search: results per search (1-100)", parseIntOpt("--search-count"))
84
- .option("--search-include-domains <list>", "octen_search: comma-separated domains to include", splitList)
85
- .option("--search-exclude-domains <list>", "octen_search: comma-separated domains to exclude", splitList)
86
- .option("--search-time-basis <b>", "octen_search: auto|published|crawled")
87
- .option("--search-start-time <when>", "octen_search: start time filter")
88
- .option("--search-end-time <when>", "octen_search: end time filter")
89
- .option("--search-format <f>", "octen_search: markdown|text")
90
- .option("--search-safesearch <s>", "octen_search: off|strict")
91
- .option("--search-full-content", "octen_search: include full page content")
92
- .option("--search-full-content-max-tokens <n>", "octen_search: max tokens for full content", parseIntOpt("--search-full-content-max-tokens"))
93
- .option("--search-highlight-max-tokens <n>", "octen_search: max tokens for highlights", parseIntOpt("--search-highlight-max-tokens"))
85
+ .option("--search-max-queries <n>", "octen_broad_search: max sub-queries (1-30, default 5)", parseIntOpt("--search-max-queries"))
86
+ .option("--search-topic <t>", "search tools: general|news")
87
+ .option("--search-count <n>", "search tools: results per search (1-100)", parseIntOpt("--search-count"))
88
+ .option("--search-include-domains <list>", "search tools: comma-separated domains to include", splitList)
89
+ .option("--search-exclude-domains <list>", "search tools: comma-separated domains to exclude", splitList)
90
+ .option("--search-include-text <list>", "search tools: comma-separated phrases to require (max 5)", splitList)
91
+ .option("--search-exclude-text <list>", "search tools: comma-separated phrases to exclude (max 5)", splitList)
92
+ .option("--search-time-basis <b>", "search tools: auto|published|crawled")
93
+ .option("--search-time-range <r>", "search tools: day|week|month|year (or d|w|m|y)")
94
+ .option("--search-start-time <when>", "search tools: start time filter")
95
+ .option("--search-end-time <when>", "search tools: end time filter")
96
+ .option("--search-format <f>", "search tools: markdown|text")
97
+ .option("--search-safesearch <s>", "search tools: off|strict")
98
+ .option("--search-country <code>", "search tools: ISO 3166-1 alpha-2 country code (e.g. US, JP) or auto")
99
+ .option("--search-include-images", "search tools: include image results")
100
+ .option("--search-full-content", "search tools: include full page content")
101
+ .option("--search-full-content-max-tokens <n>", "search tools: max tokens for full content", parseIntOpt("--search-full-content-max-tokens"))
102
+ .option("--search-highlight-max-tokens <n>", "search tools: max tokens for highlights", parseIntOpt("--search-highlight-max-tokens"))
94
103
  // ── Sampling ────────────────────────────────────────────────────────────
95
104
  .option("--temperature <n>", "sampling temperature", parseFloatOpt("--temperature"))
96
105
  .option("--top-p <n>", "nucleus sampling top-p", parseFloatOpt("--top-p"))
@@ -117,15 +126,23 @@ export function registerChat(program) {
117
126
  const chatOpts = {
118
127
  search: {
119
128
  enabled: Boolean(opts.search),
129
+ broadEnabled: Boolean(opts.broadSearch),
120
130
  maxSearches: opts.searchMaxSearches,
131
+ maxQueries: opts.searchMaxQueries,
132
+ topic: opts.searchTopic,
121
133
  count: opts.searchCount,
122
134
  includeDomains: opts.searchIncludeDomains,
123
135
  excludeDomains: opts.searchExcludeDomains,
136
+ includeText: opts.searchIncludeText,
137
+ excludeText: opts.searchExcludeText,
124
138
  timeBasis: opts.searchTimeBasis,
139
+ timeRange: opts.searchTimeRange,
125
140
  startTime: opts.searchStartTime,
126
141
  endTime: opts.searchEndTime,
127
142
  format: opts.searchFormat,
128
143
  safesearch: opts.searchSafesearch,
144
+ country: opts.searchCountry,
145
+ includeImages: opts.searchIncludeImages,
129
146
  fullContent: Boolean(opts.searchFullContent),
130
147
  fullContentMaxTokens: opts.searchFullContentMaxTokens,
131
148
  highlightMaxTokens: opts.searchHighlightMaxTokens,
@@ -16,6 +16,7 @@ export function registerSearch(program, fixedTopic) {
16
16
  .option("--start-time <when>", "YYYY-MM-DD or ISO datetime (e.g. 2024-01-01T00:00:00Z)")
17
17
  .option("--end-time <when>", "YYYY-MM-DD or ISO datetime (e.g. 2024-12-31T23:59:59Z)")
18
18
  .option("--format <f>", "text|markdown").option("--safesearch <s>", "off|strict")
19
+ .option("--country <code>", "country code for region-specific results — ISO 3166-1 alpha-2 (e.g. US, JP) or auto (default)")
19
20
  .option("--highlight").option("--highlight-max-tokens <n>", "max tokens per highlight", parseIntOpt("--highlight-max-tokens"))
20
21
  .option("--full-content").option("--full-content-max-tokens <n>", "max tokens per result", parseIntOpt("--full-content-max-tokens"))
21
22
  .option("--images").option("--videos");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octen.ai/cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Command-line tool for Octen — web search, extract, chat, embeddings, and one-command MCP/Skills setup.",
5
5
  "type": "module",
6
6
  "license": "MIT",