@octen.ai/cli 0.10.0 → 0.12.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.
Files changed (40) hide show
  1. package/README.md +63 -5
  2. package/dist/api/constants.d.ts +50 -5
  3. package/dist/api/constants.js +17 -2
  4. package/dist/api/mediaSearch.d.ts +0 -4
  5. package/dist/api/mediaSearch.js +2 -10
  6. package/dist/api/placeSearch.d.ts +19 -0
  7. package/dist/api/placeSearch.js +54 -0
  8. package/dist/api/verticalSearch.d.ts +41 -0
  9. package/dist/api/verticalSearch.js +112 -0
  10. package/dist/cli.js +6 -1
  11. package/dist/commands/configureSkills.js +1 -1
  12. package/dist/commands/imageSearch.js +1 -7
  13. package/dist/commands/placeSearch.d.ts +2 -0
  14. package/dist/commands/placeSearch.js +36 -0
  15. package/dist/commands/search.d.ts +1 -1
  16. package/dist/commands/search.js +5 -7
  17. package/dist/commands/verticalSearch.d.ts +4 -0
  18. package/dist/commands/verticalSearch.js +82 -0
  19. package/dist/output/pretty/businessSearch.d.ts +7 -0
  20. package/dist/output/pretty/businessSearch.js +159 -0
  21. package/dist/output/pretty/envelope.d.ts +22 -0
  22. package/dist/output/pretty/envelope.js +17 -0
  23. package/dist/output/pretty/newsSearch.d.ts +10 -0
  24. package/dist/output/pretty/newsSearch.js +72 -0
  25. package/dist/output/pretty/placeSearch.d.ts +6 -0
  26. package/dist/output/pretty/placeSearch.js +87 -0
  27. package/dist/output/pretty/pulseSearch.d.ts +11 -0
  28. package/dist/output/pretty/pulseSearch.js +31 -0
  29. package/package.json +1 -1
  30. package/skills/manifest.json +1 -1
  31. package/skills/octen-image-search/SKILL.md +3 -18
  32. package/skills/octen-image-search/agents/openai.yaml +1 -1
  33. package/skills/octen-place-search/SKILL.md +196 -0
  34. package/skills/octen-place-search/agents/openai.yaml +4 -0
  35. package/skills/octen-search/SKILL.md +195 -4
  36. package/skills/octen-web-search/SKILL.md +10 -6
  37. package/skills/octen-design/SKILL.md +0 -241
  38. package/skills/octen-design/agents/openai.yaml +0 -4
  39. package/skills/octen-design/scripts/search.py +0 -559
  40. package/skills/octen-design/scripts/tests/test_search.py +0 -449
@@ -0,0 +1,82 @@
1
+ import { ENDPOINTS } from "../api/constants.js";
2
+ import { buildBusinessSearchRequest, buildNewsSearchRequest, buildPulseSearchRequest, } from "../api/verticalSearch.js";
3
+ import { chooseMode, emit } from "../output/render.js";
4
+ import { renderBusinessSearch } from "../output/pretty/businessSearch.js";
5
+ import { renderNewsSearch } from "../output/pretty/newsSearch.js";
6
+ import { renderPulseSearch } from "../output/pretty/pulseSearch.js";
7
+ import { makeClient, parseCsvOpt, parseIntOpt } from "./utils.js";
8
+ /**
9
+ * The retrieval options news and business share. Deliberately not `search`'s
10
+ * full set: the API accepts the extras and ignores them, so offering them here
11
+ * would hand back results that silently do not reflect the flags given.
12
+ */
13
+ function addSharedOptions(cmd) {
14
+ return cmd
15
+ .option("-n, --count <n>", "results 1-100", parseIntOpt("--count"))
16
+ .option("--include-domains <list>", "comma list", parseCsvOpt("--include-domains"))
17
+ .option("--exclude-domains <list>", "comma list", parseCsvOpt("--exclude-domains"))
18
+ .option("--language <list>", "ISO 639-1 codes, comma-separated, e.g. en,ja", parseCsvOpt("--language"))
19
+ .option("--time-basis <b>", "auto|published|crawled")
20
+ .option("--time-range <r>", "day|week|month|year (or d|w|m|y)")
21
+ .option("--start-time <when>", "YYYY-MM-DD or ISO datetime")
22
+ .option("--end-time <when>", "YYYY-MM-DD or ISO datetime")
23
+ .option("--highlight")
24
+ .option("--highlight-max-tokens <n>", "max tokens per highlight", parseIntOpt("--highlight-max-tokens"))
25
+ .option("--full-content")
26
+ .option("--full-content-max-tokens <n>", "max tokens per result", parseIntOpt("--full-content-max-tokens"));
27
+ }
28
+ export function registerNewsSearch(program) {
29
+ addSharedOptions(program.command("news")
30
+ .argument("<query...>", "what is being reported")
31
+ .description("Recent news, returned as ranked articles and as storylines"))
32
+ .option("--no-subjects", "skip the storyline clustering")
33
+ .option("--subjects-count <n>", "storylines to return, 1-5", parseIntOpt("--subjects-count"))
34
+ .option("--max-sub-news <n>", "supporting articles per storyline, 1-20", parseIntOpt("--max-sub-news"))
35
+ .action(async (queryArg, opts, command) => {
36
+ const g = command.optsWithGlobals();
37
+ const client = makeClient(g);
38
+ // commander turns `--no-subjects` into `subjects: false`; the builder
39
+ // wants to know only whether it was switched off.
40
+ const o = { ...opts, noSubjects: opts.subjects === false };
41
+ const req = buildNewsSearchRequest(queryArg.join(" "), o);
42
+ const res = await client.request(ENDPOINTS.newsSearch, req);
43
+ emit(res, chooseMode(g, process.stdout.isTTY ?? false), renderNewsSearch);
44
+ });
45
+ }
46
+ export function registerBusinessSearch(program) {
47
+ addSharedOptions(program.command("business")
48
+ .argument("<query...>", "a company, or a person in a business context")
49
+ .description("Companies and people as structured cards, alongside ranked sources"))
50
+ .option("--no-entities", "skip the entity cards and return sources only")
51
+ .option("--entities-count <n>", "entities to profile, 1-20", parseIntOpt("--entities-count"))
52
+ .option("--max-activities <n>", "activities per entity, 1-20", parseIntOpt("--max-activities"))
53
+ .option("--max-entity-news <n>", "news items per entity, 1-20", parseIntOpt("--max-entity-news"))
54
+ .action(async (queryArg, opts, command) => {
55
+ const g = command.optsWithGlobals();
56
+ const client = makeClient(g);
57
+ const o = { ...opts, noEntities: opts.entities === false };
58
+ const req = buildBusinessSearchRequest(queryArg.join(" "), o);
59
+ const res = await client.request(ENDPOINTS.businessSearch, req);
60
+ emit(res, chooseMode(g, process.stdout.isTTY ?? false), renderBusinessSearch);
61
+ });
62
+ }
63
+ export function registerPulseSearch(program) {
64
+ program.command("pulse")
65
+ .argument("<query...>", "what to find the destination for, e.g. 'uv docs'")
66
+ .description("The URL a query most likely means, in about 10ms")
67
+ .option("--mode <m>", "lite|standard — standard adds highlights and content")
68
+ .option("-n, --count <n>", "results 1-10", parseIntOpt("--count"))
69
+ .option("--safesearch <s>", "off|strict")
70
+ .option("--images", "return image URLs per result (standard mode only)")
71
+ .option("--highlight")
72
+ .option("--highlight-max-tokens <n>", "max tokens per highlight", parseIntOpt("--highlight-max-tokens"))
73
+ .option("--full-content")
74
+ .option("--full-content-max-tokens <n>", "max tokens per result", parseIntOpt("--full-content-max-tokens"))
75
+ .action(async (queryArg, opts, command) => {
76
+ const g = command.optsWithGlobals();
77
+ const client = makeClient(g);
78
+ const req = buildPulseSearchRequest(queryArg.join(" "), opts);
79
+ const res = await client.request(ENDPOINTS.pulseSearch, req);
80
+ emit(res, chooseMode(g, process.stdout.isTTY ?? false), renderPulseSearch);
81
+ });
82
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Business results print the entity cards first, then the ranked sources.
3
+ *
4
+ * The cards are the answer — a company's numbers, its people, what it just
5
+ * announced — and the sources are the evidence behind them.
6
+ */
7
+ export declare function renderBusinessSearch(data: any): string;
@@ -0,0 +1,159 @@
1
+ import pc from "picocolors";
2
+ import { formatResultList } from "./search.js";
3
+ import { envelopeError, unwrap } from "./envelope.js";
4
+ // Long series are capped: sixteen quarters of financials on one card is the
5
+ // opposite of what a structured answer is for. The count of what was left out
6
+ // is printed, so the reader knows the series continues.
7
+ const SERIES_SHOWN = 4;
8
+ const MAX_SUMMARY = 400;
9
+ /** `81615003648` → `81.6B`. Raw figures at this magnitude are unreadable. */
10
+ function money(n) {
11
+ if (typeof n !== "number" || !Number.isFinite(n))
12
+ return "";
13
+ const abs = Math.abs(n);
14
+ for (const [limit, suffix] of [[1e12, "T"], [1e9, "B"], [1e6, "M"], [1e3, "K"]]) {
15
+ if (abs >= limit)
16
+ return `${(n / limit).toFixed(1)}${suffix}`;
17
+ }
18
+ return String(n);
19
+ }
20
+ /**
21
+ * Business results print the entity cards first, then the ranked sources.
22
+ *
23
+ * The cards are the answer — a company's numbers, its people, what it just
24
+ * announced — and the sources are the evidence behind them.
25
+ */
26
+ export function renderBusinessSearch(data) {
27
+ const body = unwrap(data);
28
+ const entities = body?.entities ?? [];
29
+ const results = body?.results ?? [];
30
+ if (!entities.length && !results.length) {
31
+ const err = envelopeError(data);
32
+ return err ? pc.red(`error: ${err}`) : pc.dim("No results.");
33
+ }
34
+ const blocks = [];
35
+ if (entities.length)
36
+ blocks.push(entities.map(formatEntity).join("\n\n"));
37
+ if (results.length) {
38
+ if (entities.length)
39
+ blocks.push(pc.bold("Sources"));
40
+ blocks.push(formatResultList(results));
41
+ }
42
+ return blocks.join("\n\n");
43
+ }
44
+ function formatEntity(e) {
45
+ const lines = [];
46
+ const kind = e?.type ? ` ${pc.dim(`(${e.type})`)}` : "";
47
+ lines.push(`${pc.bold(e?.name ?? "(unnamed)")}${kind}`);
48
+ if (e?.summary) {
49
+ const raw = String(e.summary);
50
+ lines.push(` ${raw.length > MAX_SUMMARY ? raw.slice(0, MAX_SUMMARY) + "…" : raw}`);
51
+ }
52
+ lines.push(...formatMetrics(e?.metrics));
53
+ // A person entity carries its own role and history where a company carries
54
+ // key_people. Rendering only the latter leaves a person card with no career
55
+ // information at all.
56
+ if (e?.current_position)
57
+ lines.push(` ${e.current_position}`);
58
+ const career = e?.career ?? [];
59
+ if (career.length) {
60
+ lines.push(` ${pc.bold("Career")}`);
61
+ for (const c of career.slice(0, SERIES_SHOWN)) {
62
+ const span = [c?.start, c?.end ?? "present"].filter(Boolean).join(" – ");
63
+ const role = [c?.title, c?.organization].filter(Boolean).join(" at ");
64
+ lines.push(` ${role || "(role unknown)"}${span ? ` ${pc.dim(`(${span})`)}` : ""}`);
65
+ }
66
+ if (career.length > SERIES_SHOWN)
67
+ pushElided(lines, career.length - SERIES_SHOWN, "earlier roles");
68
+ }
69
+ const people = e?.key_people ?? [];
70
+ if (people.length) {
71
+ lines.push(` ${pc.bold("Key people")}`);
72
+ for (const p of people.slice(0, SERIES_SHOWN * 2)) {
73
+ const role = [p?.title, p?.company].filter(Boolean).join(" at ");
74
+ lines.push(` ${p?.name ?? "(unnamed)"}${role ? ` — ${role}` : ""}`);
75
+ }
76
+ }
77
+ // Requested through --max-activities, so dropping them silently makes that
78
+ // flag do nothing the caller can see.
79
+ const activities = e?.activities ?? [];
80
+ if (activities.length) {
81
+ lines.push(` ${pc.bold("Activity")}`);
82
+ for (const a of activities.slice(0, SERIES_SHOWN)) {
83
+ lines.push(` • ${a?.title ?? "(untitled)"}`);
84
+ if (a?.time_published)
85
+ lines.push(` ${pc.dim(a.time_published)}`);
86
+ if (a?.url)
87
+ lines.push(` ${pc.dim(a.url)}`);
88
+ lines.push(...content(a, " "));
89
+ }
90
+ if (activities.length > SERIES_SHOWN)
91
+ pushElided(lines, activities.length - SERIES_SHOWN, "more");
92
+ }
93
+ const news = e?.news ?? [];
94
+ if (news.length) {
95
+ lines.push(` ${pc.bold("Recent")}`);
96
+ for (const n of news.slice(0, SERIES_SHOWN)) {
97
+ lines.push(` • ${n?.title ?? "(no title)"}`);
98
+ if (n?.url)
99
+ lines.push(` ${pc.dim(n.url)}`);
100
+ // The caller enabled --highlight for these too, and paid for them.
101
+ lines.push(...content(n, " "));
102
+ }
103
+ }
104
+ return lines.join("\n");
105
+ }
106
+ function formatMetrics(m) {
107
+ if (!m || typeof m !== "object")
108
+ return [];
109
+ const out = [];
110
+ const fin = Array.isArray(m.financials) ? m.financials : [];
111
+ if (fin.length) {
112
+ out.push(` ${pc.bold("Financials")}`);
113
+ for (const f of fin.slice(0, SERIES_SHOWN)) {
114
+ const bits = [
115
+ f?.revenue != null ? `revenue ${money(f.revenue)}` : "",
116
+ f?.net_income != null ? `net income ${money(f.net_income)}` : "",
117
+ ].filter(Boolean).join(", ");
118
+ out.push(` ${f?.period ?? "?"}${bits ? ` — ${bits}` : ""}`);
119
+ }
120
+ if (fin.length > SERIES_SHOWN)
121
+ out.push(pc.dim(` (+${fin.length - SERIES_SHOWN} earlier periods)`));
122
+ }
123
+ const fund = Array.isArray(m.funding) ? m.funding : [];
124
+ if (fund.length) {
125
+ out.push(` ${pc.bold("Funding")}`);
126
+ for (const f of fund.slice(0, SERIES_SHOWN)) {
127
+ const led = f?.lead_investors ? ` — led by ${String(f.lead_investors).split(";").join(", ")}` : "";
128
+ out.push(` ${f?.date ?? "?"} ${f?.round ?? ""} ${money(f?.amount)}${led}`.replace(/\s+/g, " "));
129
+ }
130
+ if (fund.length > SERIES_SHOWN)
131
+ out.push(pc.dim(` (+${fund.length - SERIES_SHOWN} earlier rounds)`));
132
+ }
133
+ const s = m.stock;
134
+ if (s && typeof s === "object") {
135
+ const bits = [
136
+ s.price != null ? `${s.price}${s.currency ? ` ${s.currency}` : ""}` : "",
137
+ typeof s.todays_change_percent === "number" ? `${s.todays_change_percent.toFixed(2)}% today` : "",
138
+ ].filter(Boolean).join(", ");
139
+ if (bits)
140
+ out.push(` ${pc.bold("Stock")} ${bits}`);
141
+ }
142
+ return out;
143
+ }
144
+ /** `(+N more)`, so a truncated series says what was left out. */
145
+ function pushElided(lines, n, label) {
146
+ lines.push(pc.dim(` (+${n} ${label})`));
147
+ }
148
+ /** Whatever content an item carries — the caller asked for it. */
149
+ function content(item, indent) {
150
+ const res = [];
151
+ for (const field of ["summary", "highlight", "full_content"]) {
152
+ const raw = item?.[field];
153
+ if (typeof raw !== "string" || !raw.trim())
154
+ continue;
155
+ const text = raw.length > MAX_SUMMARY ? raw.slice(0, MAX_SUMMARY) + "…" : raw;
156
+ res.push(...text.split("\n").map((l) => `${indent}${l}`));
157
+ }
158
+ return res;
159
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The Octen API wraps every payload in `{ code, msg, data, meta }`. Renderers
3
+ * want the inner body, but have to cope with being handed an already-unwrapped
4
+ * object (tests, piped JSON), so the unwrap is conditional.
5
+ *
6
+ * The seven renderers that predate this file each carry their own copy of the
7
+ * same few lines. New ones use this instead; folding the old ones in is a
8
+ * separate change, since each also has its own empty-state wording to preserve.
9
+ */
10
+ export interface Envelope {
11
+ code?: number;
12
+ msg?: string;
13
+ data?: unknown;
14
+ }
15
+ /** The inner body, or the input itself when it is not an envelope. */
16
+ export declare function unwrap(data: unknown): any;
17
+ /**
18
+ * The API reports application errors inside a 200 envelope, so a renderer that
19
+ * only checked for an empty list would print "No results" for an auth failure.
20
+ * Returns the message to show, or undefined when the envelope is healthy.
21
+ */
22
+ export declare function envelopeError(data: unknown): string | undefined;
@@ -0,0 +1,17 @@
1
+ /** The inner body, or the input itself when it is not an envelope. */
2
+ export function unwrap(data) {
3
+ const inner = data?.data;
4
+ return data && typeof data === "object" && inner && typeof inner === "object" && !Array.isArray(inner)
5
+ ? inner
6
+ : data;
7
+ }
8
+ /**
9
+ * The API reports application errors inside a 200 envelope, so a renderer that
10
+ * only checked for an empty list would print "No results" for an auth failure.
11
+ * Returns the message to show, or undefined when the envelope is healthy.
12
+ */
13
+ export function envelopeError(data) {
14
+ const code = data?.code;
15
+ const msg = data?.msg;
16
+ return code != null && code !== 0 && msg ? String(msg) : undefined;
17
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * News results print the storylines first, then the ranked articles.
3
+ *
4
+ * The storylines are a clustering of the coverage, not a second retrieval, and
5
+ * they carry the summary that answers "what happened with X" without reading
6
+ * every article. One caveat the reader has to know: domain filters narrow the
7
+ * ranked articles only and never reach `subjects`, so a source-restricted
8
+ * question has to be answered from the articles below.
9
+ */
10
+ export declare function renderNewsSearch(data: any): string;
@@ -0,0 +1,72 @@
1
+ import pc from "picocolors";
2
+ import { formatResultList } from "./search.js";
3
+ import { envelopeError, unwrap } from "./envelope.js";
4
+ const MAX_SUMMARY = 400;
5
+ /**
6
+ * News results print the storylines first, then the ranked articles.
7
+ *
8
+ * The storylines are a clustering of the coverage, not a second retrieval, and
9
+ * they carry the summary that answers "what happened with X" without reading
10
+ * every article. One caveat the reader has to know: domain filters narrow the
11
+ * ranked articles only and never reach `subjects`, so a source-restricted
12
+ * question has to be answered from the articles below.
13
+ */
14
+ export function renderNewsSearch(data) {
15
+ const body = unwrap(data);
16
+ const subjects = body?.subjects ?? [];
17
+ const results = body?.results ?? [];
18
+ if (!subjects.length && !results.length) {
19
+ const err = envelopeError(data);
20
+ return err ? pc.red(`error: ${err}`) : pc.dim("No results.");
21
+ }
22
+ const blocks = [];
23
+ if (subjects.length)
24
+ blocks.push(subjects.map(formatSubject).join("\n\n"));
25
+ if (results.length) {
26
+ if (subjects.length)
27
+ blocks.push(pc.bold("Articles"));
28
+ blocks.push(formatResultList(results));
29
+ }
30
+ return blocks.join("\n\n");
31
+ }
32
+ function formatSubject(s, i) {
33
+ const lines = [];
34
+ lines.push(`${pc.bold(`Storyline ${i + 1}: ${s?.name ?? "(unnamed)"}`)}`);
35
+ const span = [s?.time_start, s?.time_latest].filter(Boolean).join(" → ");
36
+ if (span)
37
+ lines.push(` ${pc.dim(span)}`);
38
+ if (s?.summary) {
39
+ const raw = String(s.summary);
40
+ lines.push(` ${raw.length > MAX_SUMMARY ? raw.slice(0, MAX_SUMMARY) + "…" : raw}`);
41
+ }
42
+ // `top_news` is the lead article; `sub_news` are the supporting ones. They
43
+ // need not appear in `results` at all, so dropping them would lose coverage
44
+ // the caller already paid for.
45
+ const articles = [s?.top_news, ...(s?.sub_news ?? [])].filter(Boolean);
46
+ for (const a of articles) {
47
+ lines.push(` • ${a?.title ?? "(no title)"}`);
48
+ if (a?.url)
49
+ lines.push(` ${pc.dim(a.url)}`);
50
+ lines.push(...articleContent(a, " "));
51
+ }
52
+ return lines.join("\n");
53
+ }
54
+ /**
55
+ * Whatever content a storyline article carries, indented under it.
56
+ *
57
+ * These are not duplicates of the ranked results: a storyline's articles need
58
+ * not appear in `data.results` at all, so dropping their `summary`,
59
+ * `highlight` and `full_content` discards content the caller enabled and was
60
+ * billed for, with nowhere else to find it.
61
+ */
62
+ function articleContent(a, indent) {
63
+ const out = [];
64
+ for (const field of ["summary", "highlight", "full_content"]) {
65
+ const raw = a?.[field];
66
+ if (typeof raw !== "string" || !raw.trim())
67
+ continue;
68
+ const text = raw.length > MAX_SUMMARY ? raw.slice(0, MAX_SUMMARY) + "…" : raw;
69
+ out.push(...text.split("\n").map((l) => `${indent}${l}`));
70
+ }
71
+ return out;
72
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Place results live under `data.places`, not `data.results` — `results` is
3
+ * where the optional web pages go, and reading the wrong one is an easy way to
4
+ * conclude the endpoint returned nothing.
5
+ */
6
+ export declare function renderPlaceSearch(data: any): string;
@@ -0,0 +1,87 @@
1
+ import pc from "picocolors";
2
+ import { formatResultList } from "./search.js";
3
+ import { envelopeError, unwrap } from "./envelope.js";
4
+ /** `1.2 km` / `450 m` — metres are what the API returns, km is what reads past a point. */
5
+ function distance(m) {
6
+ if (typeof m !== "number" || !Number.isFinite(m))
7
+ return "";
8
+ return m >= 1000 ? `${(m / 1000).toFixed(1)} km` : `${Math.round(m)} m`;
9
+ }
10
+ /**
11
+ * Place results live under `data.places`, not `data.results` — `results` is
12
+ * where the optional web pages go, and reading the wrong one is an easy way to
13
+ * conclude the endpoint returned nothing.
14
+ */
15
+ export function renderPlaceSearch(data) {
16
+ const body = unwrap(data);
17
+ const places = body?.places ?? [];
18
+ const web = body?.results ?? [];
19
+ if (!places.length && !web.length) {
20
+ const err = envelopeError(data);
21
+ return err ? pc.red(`error: ${err}`) : pc.dim("No results.");
22
+ }
23
+ const blocks = [];
24
+ if (places.length)
25
+ blocks.push(places.map(formatPlace).join("\n\n"));
26
+ if (web.length) {
27
+ if (places.length)
28
+ blocks.push(pc.bold("Web results"));
29
+ blocks.push(formatResultList(web));
30
+ }
31
+ return blocks.join("\n\n");
32
+ }
33
+ function formatPlace(p, i) {
34
+ const lines = [];
35
+ lines.push(`${i + 1}. ${pc.bold(p?.name ?? "(unnamed)")}`);
36
+ const sub = [p?.category, distance(p?.distance)].filter(Boolean).join(" · ");
37
+ if (sub)
38
+ lines.push(` ${pc.dim(sub)}`);
39
+ if (p?.address)
40
+ lines.push(` ${p.address}`);
41
+ const rating = typeof p?.rating === "number"
42
+ ? `${p.rating}/5${typeof p.review_count === "number" ? ` (${p.review_count} reviews)` : ""}`
43
+ : "";
44
+ const status = [rating, p?.status].filter(Boolean).join(" · ");
45
+ if (status)
46
+ lines.push(` ${status}`);
47
+ if (p?.phone)
48
+ lines.push(` ${pc.dim(`Phone: ${p.phone}`)}`);
49
+ if (p?.website)
50
+ lines.push(` ${pc.dim(p.website)}`);
51
+ const hours = Array.isArray(p?.opening_hours) ? p.opening_hours.filter(Boolean) : [];
52
+ if (hours.length)
53
+ lines.push(...hours.map((h) => ` ${pc.dim(h)}`));
54
+ // `false` is printed, not dropped: "not wheelchair accessible" is a reason
55
+ // to pick a different place, and dropping it makes a definite no read the
56
+ // same as an unknown.
57
+ if (p?.attributes && typeof p.attributes === "object") {
58
+ const attrs = Object.entries(p.attributes)
59
+ .map(([k, v]) => (v === true ? k : v === false ? `no ${k}` : v == null ? "" : `${k}=${v}`))
60
+ .filter(Boolean)
61
+ .join(", ");
62
+ if (attrs)
63
+ lines.push(` ${pc.dim(attrs)}`);
64
+ }
65
+ if (typeof p?.latitude === "number" && typeof p?.longitude === "number") {
66
+ lines.push(` ${pc.dim(`${p.latitude}, ${p.longitude}`)}`);
67
+ }
68
+ // Only present when `--max-reviews` asked for them, so nothing is printed
69
+ // that was not requested — and nothing requested is dropped.
70
+ const reviews = Array.isArray(p?.reviews) ? p.reviews.filter(Boolean) : [];
71
+ if (reviews.length) {
72
+ lines.push(` ${pc.bold("Reviews")}`);
73
+ for (const r of reviews) {
74
+ const stamp = [
75
+ typeof r?.rating === "number" ? `${r.rating}/5` : "",
76
+ r?.time_published || "",
77
+ ].filter(Boolean).join(" · ");
78
+ if (stamp)
79
+ lines.push(` ${pc.dim(stamp)}`);
80
+ const text = typeof r?.text === "string" ? r.text.trim() : "";
81
+ // Each line indented, so a paragraph break cannot read as a new field.
82
+ if (text)
83
+ lines.push(...text.split("\n").map((l) => ` ${l}`));
84
+ }
85
+ }
86
+ return lines.join("\n");
87
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Give a lite-mode URL its scheme back.
3
+ *
4
+ * `lite` returns `github.com/docs`, not `https://github.com/docs`. A caller
5
+ * piping that into a browser or another tool gets something nothing can fetch,
6
+ * so the scheme goes on here rather than in a note the reader may not see.
7
+ * Anything already carrying one is left alone, which covers `standard` and any
8
+ * future mode.
9
+ */
10
+ export declare function withScheme(url: unknown): unknown;
11
+ export declare function renderPulseSearch(data: any): string;
@@ -0,0 +1,31 @@
1
+ import pc from "picocolors";
2
+ import { formatResultList } from "./search.js";
3
+ import { envelopeError, unwrap } from "./envelope.js";
4
+ /**
5
+ * Give a lite-mode URL its scheme back.
6
+ *
7
+ * `lite` returns `github.com/docs`, not `https://github.com/docs`. A caller
8
+ * piping that into a browser or another tool gets something nothing can fetch,
9
+ * so the scheme goes on here rather than in a note the reader may not see.
10
+ * Anything already carrying one is left alone, which covers `standard` and any
11
+ * future mode.
12
+ */
13
+ export function withScheme(url) {
14
+ if (typeof url !== "string" || url === "")
15
+ return url;
16
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(url))
17
+ return url;
18
+ // `//host/path` already has the slashes and wants only the scheme; adding
19
+ // the pair as well would produce `https:////host/path`.
20
+ return url.startsWith("//") ? `https:${url}` : `https://${url}`;
21
+ }
22
+ export function renderPulseSearch(data) {
23
+ const body = unwrap(data);
24
+ const raw = body?.results ?? [];
25
+ if (!raw.length) {
26
+ const err = envelopeError(data);
27
+ return err ? pc.red(`error: ${err}`) : pc.dim("No results.");
28
+ }
29
+ const results = raw.map((r) => (r && typeof r === "object" ? { ...r, url: withScheme(r.url) } : r));
30
+ return formatResultList(results);
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octen.ai/cli",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
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",
@@ -2,9 +2,9 @@
2
2
  "source": "Octen-Team/octen-skills",
3
3
  "ref": "main",
4
4
  "skills": [
5
- "octen-design",
6
5
  "octen-extract",
7
6
  "octen-image-search",
7
+ "octen-place-search",
8
8
  "octen-search",
9
9
  "octen-video-search",
10
10
  "octen-web-search"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: octen-image-search
3
- description: USE FOR finding images on the web by a text query or a reference image (one input per request), powered by Octen. Returns ranked images with thumbnail, source page, dimensions, and description. In Beta. Contact us to request beta access at https://octen.ai. Use it for general image search (photos, diagrams, products, screenshots). For UI design references with structured style tokens and HTML/CSS snippets, use the octen-design skill instead.
3
+ description: USE FOR finding images on the web by a text query or a reference image (one input per request), powered by Octen. Returns ranked images with thumbnail, source page, dimensions, and description. Use it for general image search (photos, diagrams, products, screenshots).
4
4
  homepage: https://octen.ai
5
5
  keywords: [image search, image, octen, find images, reverse image search, visual search, AI search]
6
6
  metadata: {"clawdbot":{"emoji":"🖼️","requires":{"bins":["curl"],"env":["OCTEN_API_KEY"]},"primaryEnv":"OCTEN_API_KEY"}, "homepage": "https://octen.ai", "support": "support@octen.ai"}
@@ -12,19 +12,9 @@ Find images on the web by a **text query or a reference image** (the API
12
12
  accepts exactly one input per request). Each result includes a thumbnail, the
13
13
  source page, dimensions, and a description.
14
14
 
15
- > **In Beta. Contact us to request beta access.** Octen Image Search is in
16
- > invite-only beta — request access via https://octen.ai (or support@octen.ai).
17
- > Calls will fail without access; if so, tell the user it's in beta and how to
18
- > reach Octen.
19
-
20
- > **Not for UI design refs.** For reference screenshots + structured style tokens
21
- > + HTML/CSS snippets to build/restyle a frontend, use the **octen-design** skill
22
- > (it queries the same endpoint with `topic=design`). This skill is general image
23
- > search.
24
-
25
15
  ## API Key Setup
26
16
 
27
- **Before searching, ensure `OCTEN_API_KEY` is set. On `401`, stop and tell the user a key is required (https://octen.ai). On `403`, the key is valid but the request was refused — this means either no beta access or insufficient account balance; relay both possibilities and how to request beta access.**
17
+ **Before searching, ensure `OCTEN_API_KEY` is set. On `401`, stop and tell the user a key is required (https://octen.ai). On `403`, the key is valid but the request was refused — relay the message verbatim; the usual cause is insufficient account balance.**
28
18
 
29
19
  Configure the key for the relevant agent (same as other Octen skills):
30
20
 
@@ -76,12 +66,10 @@ image, not both (a second input is rejected with 400). For a local image, send
76
66
  | Parameter | Type | Required | Default | Description |
77
67
  |--|--|--|--|--|
78
68
  | `inputs` | array | **Yes** | - | Exactly ONE input: `{"type":"text","data":"<query≤500>"}` or `{"type":"image","url":"<url>"}` or `{"type":"image","data":"<base64>"}` |
79
- | `topic` | string | No | `general` | `general` (web images) or `design` (UI design corpus — prefer the octen-design skill) |
80
69
  | `count` | integer | No | `5` | Number of results (1–10) |
81
70
  | `include_domains` | string[] | No | - | Only include images from these domains |
82
71
  | `exclude_domains` | string[] | No | - | Exclude images from these domains |
83
72
  | `safesearch` | string | No | `strict` | Adult content filter: `off` or `strict` |
84
- | `html_snippet` | object | No | `{"enable": false}` | `{enable, max_tokens (def 5000, 100–100000)}` — design-oriented HTML/CSS snippet (mainly useful with `topic=design`) |
85
73
 
86
74
  There are **no time filters** on this endpoint. `time_range`, `start_time` and
87
75
  `end_time` are silently dropped here — they return `200` with unfiltered
@@ -101,8 +89,6 @@ them on **octen-search** and **octen-video-search**, which do honour them.
101
89
  | `data.results[].description` | string? | Description / alt text |
102
90
  | `data.results[].width` | integer? | Image width (px) |
103
91
  | `data.results[].height` | integer? | Image height (px) |
104
- | `data.results[].summary` | string? | Structured style summary (mainly `topic=design`) |
105
- | `data.results[].html_snippet` | string? | HTML/CSS snippet (mainly `topic=design`) |
106
92
  | `data.results[].time_published` | string? | Publish time, ISO 8601 |
107
93
  | `data.results[].time_last_crawled` | string? | Last crawl time, ISO 8601 |
108
94
  | `meta.latency` | number | Response time in milliseconds |
@@ -114,7 +100,7 @@ them on **octen-search** and **octen-video-search**, which do honour them.
114
100
  |--|--|
115
101
  | `400` | Missing or invalid parameter |
116
102
  | `401` | Invalid or missing API key |
117
- | `403` | Insufficient balance, or no beta access |
103
+ | `403` | Insufficient balance |
118
104
  | `413` | Input too large (image > 5MB base64-encoded) |
119
105
  | `429` | Rate limited |
120
106
  | `500` | Internal server error |
@@ -122,4 +108,3 @@ them on **octen-search** and **octen-video-search**, which do honour them.
122
108
  ## Notes
123
109
 
124
110
  - `count` is capped at 10.
125
- - For **UI design references**, use the **octen-design** skill instead — it wraps this endpoint with `topic=design`, downloads the reference images, and writes the design `summary` / `html_snippet` for you.
@@ -1,4 +1,4 @@
1
1
  interface:
2
- display_name: "Image Search (Beta)"
2
+ display_name: "Image Search"
3
3
  short_description: "Find web images by text or a reference image"
4
4
  default_prompt: "Find images of this and show me the best matches with sources."