arcmira 0.6.2 → 0.6.3

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 (61) hide show
  1. package/GUIDE.md +576 -88
  2. package/README.md +93 -20
  3. package/dist/cjs/BaseClient.js +2 -2
  4. package/dist/cjs/api/resources/channels/client/Client.d.ts +1 -1
  5. package/dist/cjs/api/resources/channels/client/Client.js +1 -1
  6. package/dist/cjs/api/resources/channels/resources/videos/client/Client.d.ts +1 -1
  7. package/dist/cjs/api/resources/channels/resources/videos/client/Client.js +1 -1
  8. package/dist/cjs/api/resources/entities/client/Client.d.ts +1 -1
  9. package/dist/cjs/api/resources/entities/client/Client.js +1 -1
  10. package/dist/cjs/api/resources/feedback/client/Client.d.ts +1 -1
  11. package/dist/cjs/api/resources/feedback/client/Client.js +1 -1
  12. package/dist/cjs/api/resources/mentions/client/Client.d.ts +1 -1
  13. package/dist/cjs/api/resources/mentions/client/Client.js +1 -1
  14. package/dist/cjs/api/resources/transcripts/client/Client.d.ts +2 -2
  15. package/dist/cjs/api/resources/transcripts/client/Client.js +2 -2
  16. package/dist/cjs/api/resources/transcripts/client/requests/GetTranscriptsRequest.d.ts +1 -1
  17. package/dist/cjs/api/resources/transcripts/client/requests/SearchTranscriptsRequest.d.ts +2 -2
  18. package/dist/cjs/api/types/Alert.d.ts +1 -1
  19. package/dist/cjs/api/types/Mention.d.ts +1 -1
  20. package/dist/cjs/api/types/TranscriptResponse.d.ts +6 -2
  21. package/dist/cjs/api/types/TranscriptSearchChunk.d.ts +16 -3
  22. package/dist/cjs/api/types/TranscriptSearchChunk.js +10 -0
  23. package/dist/cjs/version.d.ts +1 -1
  24. package/dist/cjs/version.js +1 -1
  25. package/dist/cli/operations.js +2 -2
  26. package/dist/esm/BaseClient.mjs +2 -2
  27. package/dist/esm/api/resources/channels/client/Client.d.mts +1 -1
  28. package/dist/esm/api/resources/channels/client/Client.mjs +1 -1
  29. package/dist/esm/api/resources/channels/resources/videos/client/Client.d.mts +1 -1
  30. package/dist/esm/api/resources/channels/resources/videos/client/Client.mjs +1 -1
  31. package/dist/esm/api/resources/entities/client/Client.d.mts +1 -1
  32. package/dist/esm/api/resources/entities/client/Client.mjs +1 -1
  33. package/dist/esm/api/resources/feedback/client/Client.d.mts +1 -1
  34. package/dist/esm/api/resources/feedback/client/Client.mjs +1 -1
  35. package/dist/esm/api/resources/mentions/client/Client.d.mts +1 -1
  36. package/dist/esm/api/resources/mentions/client/Client.mjs +1 -1
  37. package/dist/esm/api/resources/transcripts/client/Client.d.mts +2 -2
  38. package/dist/esm/api/resources/transcripts/client/Client.mjs +2 -2
  39. package/dist/esm/api/resources/transcripts/client/requests/GetTranscriptsRequest.d.mts +1 -1
  40. package/dist/esm/api/resources/transcripts/client/requests/SearchTranscriptsRequest.d.mts +2 -2
  41. package/dist/esm/api/types/Alert.d.mts +1 -1
  42. package/dist/esm/api/types/Mention.d.mts +1 -1
  43. package/dist/esm/api/types/TranscriptResponse.d.mts +6 -2
  44. package/dist/esm/api/types/TranscriptSearchChunk.d.mts +16 -3
  45. package/dist/esm/api/types/TranscriptSearchChunk.mjs +9 -1
  46. package/dist/esm/version.d.mts +1 -1
  47. package/dist/esm/version.mjs +1 -1
  48. package/llms.txt +6 -2
  49. package/package.json +4 -3
  50. package/reference.md +7 -7
  51. package/skills/arcmira/SKILL.md +27 -38
  52. package/skills/brand-mention-monitoring/SKILL.md +91 -0
  53. package/skills/company-watch/SKILL.md +8 -58
  54. package/skills/compare-shows/SKILL.md +4 -2
  55. package/skills/find-quotes/SKILL.md +5 -3
  56. package/skills/person-research/SKILL.md +11 -8
  57. package/skills/podcast-transcript-search/SKILL.md +88 -0
  58. package/skills/sponsor-research/SKILL.md +4 -2
  59. package/skills/what-did-they-say/SKILL.md +84 -0
  60. package/skills/youtube-clip-finder/SKILL.md +105 -0
  61. package/skills/youtube-transcript-search/SKILL.md +85 -0
package/GUIDE.md CHANGED
@@ -1,14 +1,10 @@
1
- # SDK guide
1
+ # Arcmira SDK Guide (TypeScript and JavaScript)
2
2
 
3
- The official TypeScript SDK and CLI for searching indexed YouTube transcripts. Find timestamped quotes, speaker appearances, mentions, sponsors and recommendations.
3
+ Search YouTube video and podcast transcripts, read the surrounding conversation, and follow company mentions with the Arcmira SDK and CLI.
4
4
 
5
5
  [Arcmira](https://arcmira.com) · [API docs](https://arcmira.com/docs) · [OpenAPI schema](https://api.arcmira.com/v1/openapi.json) · [MCP setup](https://arcmira.com/docs/mcp-server)
6
6
 
7
- - Zero runtime dependencies. Uses the global `fetch`, so it runs in Node 18 and later, Cloudflare Workers, Deno, Bun and browsers.
8
- - ESM and CommonJS builds with types.
9
- - Every list pages itself. Every error is a typed class carrying the parsed API body.
10
- - The whole documented API: search, transcripts (Premium included), mentions, momentum, sponsors and recommendations, monitors, trackers, Slack integrations and feedback.
11
- - Reads take ids (`ent_14`, `UC...`). `entities.resolve` turns a name into one.
7
+ [Investigate a research question](#investigate-a-research-question-with-youtube-video-and-podcast-transcript-search) · [Read a Premium transcript](#premium-transcripts) · [Set up YouTube monitoring](#set-up-youtube-monitoring)
12
8
 
13
9
  ## Install
14
10
 
@@ -27,94 +23,576 @@ npx arcmira setup # apply, then sign in once per agent
27
23
 
28
24
  Get a key at [arcmira.com/docs/authentication](https://arcmira.com/docs/authentication) and set `ARCMIRA_API_KEY`, or pass `apiKey` to the client.
29
25
 
30
- ## Premium transcripts
26
+ ## Investigate a research question with YouTube video and podcast transcript search
27
+
28
+ Find evidence that could change your mind. Continue the [README](README.md#search-youtube-videos-and-podcast-transcripts-for-quotes-and-clips)'s `GPU demand` search. The TBPN passage gives you a starting claim: compute demand exceeds supply. The next question is whether that demand becomes profitable, funded capacity. Search company mentions, executive interviews, and expert commentary to test what could support or challenge that thesis.
29
+
30
+ With the [Arcmira MCP server](https://arcmira.com/docs/mcp-server) connected, ask your agent:
31
31
 
32
- A Premium read uses credits from your plan, then your on-demand budget. `transcripts.quote({ video_id })` shows how many credits a read of the video will use, free, before you read it.
32
+ > Investigate the semiconductor investment thesis using the last 60 days of public conversations. Look for changes in demand, customer commitments, financing, and usable capacity. Find evidence for and against each explanation, cite the original moments, and verify material claims against filings and earnings disclosures.
33
+
34
+ ### Search the next question
35
+
36
+ Keep the search broad enough to find customers and suppliers outside the first interview. Start with `GPU financing`, then try `compute margins` or `capacity commitments` as the evidence develops. This example searches the latest 60 days and prints up to 20 full passages, using the same layout as the [README](README.md#search-youtube-videos-and-podcast-transcripts-for-quotes-and-clips).
33
37
 
34
38
  ```ts
35
39
  import { ArcmiraClient } from "arcmira";
36
- const arcmira = new ArcmiraClient();
37
- const read = await arcmira.transcripts.get({ video_id: "dQw4w9WgXcQ", quality: "premium" });
38
- if (read.state === "ready") {
39
- for (const line of read.lines ?? []) console.log(line.speaker, line.text);
40
- } else if (read.state === "failed") {
41
- throw new Error(`${read.last_attempt.status}: ${read.last_attempt.error}`);
40
+
41
+ const client = new ArcmiraClient({ apiKey: process.env.ARCMIRA_API_KEY });
42
+ const query = "GPU financing";
43
+
44
+ // Search the last 60 days.
45
+ const now = Date.now();
46
+ const day = 86_400_000;
47
+ const after = new Date(now - 60 * day).toISOString();
48
+ const before = new Date(now).toISOString();
49
+
50
+ const hits = await client.transcripts.search({
51
+ q: query, after, before, limit: 20,
52
+ });
53
+ console.log(`\n${query} (${hits.chunks.length} passages)`);
54
+ console.log(
55
+ `${hits.window.after?.slice(0, 10) ?? "unknown"} - ` +
56
+ `${hits.window.before?.slice(0, 10) ?? "unknown"}\n`,
57
+ );
58
+ for (const [i, hit] of hits.chunks.entries()) {
59
+ console.log(`${String(i + 1).padStart(2, "0")}\n${hit.text}\n`);
60
+ console.log(`Video: ${hit.video_title ?? hit.video_id}`);
61
+ console.log(`Channel: ${hit.channel_name ?? "Unknown"}`);
62
+ console.log(`Published: ${hit.published_at?.slice(0, 10) ?? "Unknown"}`);
63
+ console.log(`Transcript: ${hit.source_label ?? "Unknown"}`);
64
+ const watch = new URL(hit.watch_url, "https://arcmira.com").href;
65
+ console.log(`Watch: ${watch}\n--\n`);
66
+ }
67
+
68
+ ```
69
+
70
+ **Sample console output**
71
+
72
+ Excerpt from result 20 of the October 17, 2026 run. The script prints full passages; `...` marks omitted output here.
73
+
74
+ ```text
75
+ GPU financing (20 passages)
76
+ 2026-08-18 - 2026-10-17
77
+
78
+ ...
79
+
80
+ 20
81
+ ...
82
+ Gavin Baker: And then also, like, we should also talk if particularly if you're
83
+ buying NVIDIA GPUs to a lesser extent TPUs, you can finance these.
84
+ David George: Yes.
85
+ David George: And there's a very sophisticated, you know, yeah, it's a very low
86
+ cost of capital to finance 'em today.
87
+ Gavin Baker: Yeah.
88
+ Gavin Baker: And everybody's, you know, worked up about, you know, circularity
89
+ and it's like, well, I don't know.
90
+ Gavin Baker: I know a lot of smart people who work at Blackstone and KKR and
91
+ Apollo, and they're the ones that are financing it.
92
+
93
+ Video: Why AI Demand Is Outrunning Compute Supply
94
+ Channel: a16z
95
+ Published: 2026-08-31
96
+ Transcript: Arcmira Premium
97
+ Watch: https://arcmira.com/watch?v=FGC4ofTcg2k&t=760
98
+ --
99
+ ```
100
+
101
+ ### Read the surrounding exchange
102
+
103
+ Result 20 in this capture points to a financing counterargument. Choose the result number you want from your own output; ranks and results change. The next block continues the same script and prints the surrounding transcript with speaker names and start/end seconds.
104
+
105
+ Premium uses credits from your plan, then your on-demand budget. It reads the full video even though this example prints only nearby lines. Get a free estimate with `client.transcripts.quote` first; see [Premium states, polling, and retries](https://arcmira.com/docs/transcripts).
106
+
107
+ ```ts
108
+ // Choose a result from the output above. This capture uses result 20.
109
+ const selectedNumber = 20;
110
+ const selected = hits.chunks[selectedNumber - 1];
111
+ if (!selected) throw new Error("Choose a result number from your search.");
112
+
113
+ const transcript = await client.transcripts.get({
114
+ video_id: selected.video_id,
115
+ quality: "premium",
116
+ timestamps: true,
117
+ });
118
+ if (transcript.state === "ready") {
119
+ const names = new Map(
120
+ (transcript.speakers ?? []).map(speaker => [speaker.id, speaker.name]),
121
+ );
122
+ const start = Math.max(0, (selected.start_seconds ?? 0) - 30);
123
+ const end = (selected.start_seconds ?? 0) + 120;
124
+ console.log(`Video: ${transcript.video.title}\n`);
125
+ for (const line of transcript.lines ?? []) {
126
+ if (line.end <= start || line.start >= end) continue;
127
+ const speaker = names.get(line.speaker ?? -1) ?? "Unknown speaker";
128
+ console.log(`${line.start} - ${line.end} seconds | ${speaker}`);
129
+ console.log(`${line.text}\n`);
130
+ }
131
+ } else if (transcript.state === "pending") {
132
+ console.log(`Try again in ${transcript.job.next_poll_seconds} seconds.`);
42
133
  } else {
43
- console.log(`transcribing, read again in ${read.job.next_poll_seconds ?? 30} s`);
134
+ console.log(transcript.last_attempt.error);
44
135
  }
45
136
  ```
46
137
 
47
- A Premium read is one GET. When your account does not own the transcript yet, the read starts transcribing it and uses credits from your plan, then your on-demand budget. You set that budget in the dashboard, and Arcmira enforces it, so no call takes a spending amount. The answer is `state: "ready"` (HTTP 200) with the lines, or `state: "pending"` (HTTP 202) with the `job` while it transcribes. Read again after `Retry-After` or `job.next_poll_seconds`. Repeated and concurrent reads join the same job and never use credits twice. When the last transcription failed or was refunded, the read answers `state: "failed"` (HTTP 200) with `last_attempt` and uses no credits; read with `retry: true` to transcribe it again, which uses credits again. `transcripts.quote({ video_id })` shows the credits first, free.
138
+ **Sample transcript output**
48
139
 
49
- A read your plan and budget cannot cover throws instead. `PaymentRequiredError` carries `quota_exceeded` or `spend_limit_exceeded`, and `ForbiddenError` carries `paid_plan_required` on a free plan. Both carry the price in `err.body.error.details.quote`.
140
+ Excerpt from the same video, beyond the search passage. Wording is unchanged; lines are wrapped for readability.
141
+
142
+ ```text
143
+ Video: Why AI Demand Is Outrunning Compute Supply
144
+
145
+ ...
146
+
147
+ 825.1 - 827.32 seconds | David George
148
+ They're the ones who are financing it at a relatively low cost.
149
+
150
+ 827.32 - 829.28 seconds | Gavin Baker
151
+ At a relatively low cost.
152
+
153
+ 829.28 - 833.94 seconds | Gavin Baker
154
+ And I think one reason that's happening is useful lives just keep getting
155
+ extended.
156
+
157
+ 833.94 - 843.42 seconds | Gavin Baker
158
+ And as these models get better and better and better and the ROI on token spend
159
+ goes up, you know, the monetization rate per gigawatt goes up.
160
+
161
+ 843.42 - 852.53 seconds | Gavin Baker
162
+ So I mean, the true equity payback like might be way inside of a year.
163
+
164
+ ...
165
+ ```
166
+
167
+ The surrounding exchange adds an assumption: useful GPU lifetimes keep extending. That gives you something concrete to test against depreciation schedules, rental prices, utilization, and financing terms. Preserve the distinction between what the speakers claim and what you have verified.
168
+
169
+ ### Follow the speaker
170
+
171
+ The captured result identifies Gavin Baker as `ent_158280`. Resolve the name to get the current ID rather than guessing it, then use `by` to find his comments on the same topic. The returned `speakers_by` field is another source of these public person IDs.
50
172
 
51
173
  ```ts
52
- import { Arcmira } from "arcmira";
53
- const sleep = (s: number) => new Promise((done) => setTimeout(done, s * 1000));
54
- async function premium(video_id: string) {
55
- for (;;) {
56
- const { data, rawResponse } = await arcmira.transcripts.get({ video_id, quality: "premium" }).withRawResponse();
57
- if (data.state === "ready") return data;
58
- if (data.state === "failed") throw new Error(`${data.last_attempt.status}: ${data.last_attempt.error}`);
59
- await sleep(Number(rawResponse.headers.get("retry-after")) || data.job.next_poll_seconds || 30);
60
- }
174
+ const person = await client.entities.resolve({
175
+ q: "Gavin Baker",
176
+ type: "person",
177
+ context: "Technology investor discussing GPU financing",
178
+ });
179
+ if (!person.best) throw new Error("Confirm the person before continuing.");
180
+ console.log(`Speaker: ${person.best.name} (${person.best.id})`);
181
+
182
+ const related = await client.transcripts.search({
183
+ q: query,
184
+ by: person.best.id,
185
+ after, before,
186
+ limit: 20,
187
+ });
188
+ console.log(`${query} (${related.chunks.length} passages)`);
189
+ for (const hit of related.chunks) {
190
+ console.log(`\n${hit.text}\n`);
191
+ console.log(`Published: ${hit.published_at?.slice(0, 10) ?? "Unknown"}`);
192
+ console.log(`Watch: ${hit.watch_url}\n--`);
193
+ }
194
+ ```
195
+
196
+ ```text
197
+ Speaker: Gavin Baker (ent_158280)
198
+ GPU financing (3 passages)
199
+ ...
200
+ ```
201
+
202
+ This output is from the same captured window; your count may differ. A search filter uses the public entity ID. In a transcript response, `line.speaker` is a local numeric ID joined to `transcript.speakers`, as the preceding example shows.
203
+
204
+ Follow the companies and terms you discover, seek counterevidence, and deduplicate repeated clips before comparing sources.
205
+
206
+ Search and transcript reads use credits from your plan. See [Plans and usage](https://arcmira.com/docs/usage-and-billing). Publication dates can differ from recording dates. An empty search does not prove that a risk is absent. If coverage leaves a gap in your research, [tell us what you need](#help-shape-the-index).
207
+
208
+ ### Search the last 60 days from the CLI
209
+
210
+ The CLI takes ISO dates. Calculate the start date when you run the command:
211
+
212
+ ```sh
213
+ ARCMIRA_AFTER="$(node -e '
214
+ const now = Date.now();
215
+ const day = 86_400_000;
216
+ console.log(new Date(now - 60 * day).toISOString());
217
+ ')"
218
+ arcmira search "GPU financing" --after "$ARCMIRA_AFTER" --limit 20 --json
219
+ ```
220
+
221
+ Give your agent access to the latest indexed conversations, speaker-labeled Premium transcripts, and company alerts. The most up-to-date coverage is only available via paid plans, starting at $20/month. [Try Pro free for 7 days at no risk.](https://arcmira.com/pricing) Put Arcmira to work on a real research question, then keep it only if it earns a place in your research stack.
222
+
223
+ Not ready for a paid plan? [Tell us why and what you would pay for](https://arcmira.com/docs/feedback#not-ready-for-a-paid-plan). Feedback is free to give and helps us build what you want.
224
+
225
+ [Continue this investment research example workflow](https://arcmira.com/docs/workflows/investment-research). You will learn how to test competing explanations, compare demand with margins and financing, verify claims against disclosures, and turn the evidence into a research brief.
226
+
227
+ ## Compare a speaker's comments over time
228
+
229
+ Resolve Jensen Huang as NVIDIA's CEO, then compare several topics across two adjacent 30-day windows. Replace the person and topics to investigate another executive, expert, or supplier.
230
+
231
+ ```ts
232
+ import { ArcmiraClient } from "arcmira";
233
+
234
+ const client = new ArcmiraClient({ apiKey: process.env.ARCMIRA_API_KEY });
235
+ const match = await client.entities.resolve({
236
+ q: "Jensen Huang", type: "person", context: "NVIDIA CEO",
237
+ });
238
+ if (!match.best) throw new Error("Confirm the person before continuing.");
239
+
240
+ const now = Date.now();
241
+ const day = 86_400_000;
242
+ const windows = [
243
+ [now - 60 * day, now - 30 * day],
244
+ [now - 30 * day, now],
245
+ ];
246
+ for (const [start, end] of windows) {
247
+ for (const q of ["TSMC", "GPU demand", "capacity"]) {
248
+ const hits = await client.transcripts.search({
249
+ q, by: match.best.id, limit: 20,
250
+ after: new Date(start).toISOString(),
251
+ before: new Date(end).toISOString(),
252
+ });
253
+ console.log(`\n${q} (${hits.chunks.length} passages)`);
254
+ console.log(
255
+ `${hits.window.after?.slice(0, 10) ?? "unknown"} - ` +
256
+ `${hits.window.before?.slice(0, 10) ?? "unknown"}\n`,
257
+ );
258
+ for (const [i, hit] of hits.chunks.entries()) {
259
+ console.log(`${String(i + 1).padStart(2, "0")}\n${hit.text}\n`);
260
+ console.log(`Video: ${hit.video_title ?? hit.video_id}`);
261
+ console.log(`Channel: ${hit.channel_name ?? "Unknown"}`);
262
+ console.log(`Published: ${hit.published_at?.slice(0, 10) ?? "Unknown"}`);
263
+ console.log(`Transcript: ${hit.source_label ?? "Unknown"}`);
264
+ const watch = new URL(hit.watch_url, "https://arcmira.com").href;
265
+ console.log(`Watch: ${watch}\n--\n`);
266
+ }
267
+ }
268
+ }
269
+ ```
270
+
271
+ If there is no certain match, confirm the person before continuing. The `by` filter relies on speaker labels, which cover only part of the index. Want better coverage of a speaker or show? [Help us prioritize it](#help-shape-the-index).
272
+
273
+ Ask whether the newer passages add a commitment, name a constraint, or repeat an existing view. Check recording dates and earlier disclosures before concluding that a position changed.
274
+
275
+ ## Help shape the index
276
+
277
+ We want to build the index around work that matters to you. Use [`client.feedback.submit`](https://github.com/arcmira/arcmira/blob/master/reference.md#feedbacksubmit) with `type: "experience"`, `category: "missing"`, and `notes` describing the coverage you need. Include source links, your workflow, and how much better coverage would be worth to you and others doing similar work. Use `category: "other"` for a broader capability request.
278
+
279
+ Feedback is free to give and helps us prioritize the coverage and workflows you need. Keep it coming as your needs evolve. Your requests help us decide what to index and improve next. You can also [ask your agent to send feedback](https://arcmira.com/docs/feedback#help-shape-the-index).
280
+
281
+ ## Premium transcripts
282
+
283
+ A Premium read uses credits from your plan, then your on-demand budget. Get a free estimate for the whole video before reading it:
284
+
285
+ ```ts
286
+ import { ArcmiraClient } from "arcmira";
287
+
288
+ const client = new ArcmiraClient({ apiKey: process.env.ARCMIRA_API_KEY });
289
+ const videoId = "dQw4w9WgXcQ";
290
+ const estimate = await client.transcripts.quote({ video_id: videoId });
291
+ console.log(JSON.stringify(estimate, null, 2));
292
+ ```
293
+
294
+ A read with `quality: "premium"` returns one of three states:
295
+
296
+ | State | Next step |
297
+ | --- | --- |
298
+ | `ready` | Use the transcript and speaker labels. |
299
+ | `pending` | Wait for `Retry-After` or `job.next_poll_seconds`, then repeat the same read. |
300
+ | `failed` | Inspect `last_attempt`. To start a new transcription, pass `retry: true` once, then omit it while polling. This uses credits again. |
301
+
302
+ If your account does not yet own the transcript, the read starts transcription. Repeated and concurrent reads join the same job without using credits twice. A failed or refunded attempt returns `failed` without using credits until you request a retry.
303
+
304
+ The following standalone example polls up to six times. A timeout stops the script, not the job. Resume with the same video ID and `quality: "premium"`.
305
+
306
+ ```ts
307
+ import { Arcmira, ArcmiraClient } from "arcmira";
308
+
309
+ const client = new ArcmiraClient({ apiKey: process.env.ARCMIRA_API_KEY });
310
+ const videoId = "dQw4w9WgXcQ";
311
+ const sleep = (seconds: number) =>
312
+ new Promise(resolve => setTimeout(resolve, seconds * 1_000));
313
+
314
+ async function readPremium() {
315
+ for (let attempt = 0; attempt < 6; attempt++) {
316
+ const { data, rawResponse } = await client.transcripts.get({
317
+ video_id: videoId, quality: "premium",
318
+ }).withRawResponse();
319
+ if (data.state === "ready") return data;
320
+ if (data.state === "failed") {
321
+ throw new Error(`${data.last_attempt.status}: ${data.last_attempt.error}`);
322
+ }
323
+ if (attempt < 5) {
324
+ const seconds = Number(rawResponse.headers.get("retry-after"))
325
+ || data.job.next_poll_seconds || 30;
326
+ await sleep(seconds);
327
+ }
328
+ }
329
+ throw new Error("Still processing. Resume the same Premium read later.");
61
330
  }
331
+
62
332
  try {
63
- console.log((await premium("dQw4w9WgXcQ")).speakers);
64
- } catch (err) {
65
- if (err instanceof Arcmira.PaymentRequiredError || err instanceof Arcmira.ForbiddenError) console.log(err.body.error.code, err.body.error.details?.quote);
66
- else throw err;
333
+ const transcript = await readPremium();
334
+ const names = new Map(
335
+ (transcript.speakers ?? []).map(speaker => [speaker.id, speaker.name]),
336
+ );
337
+ for (const line of transcript.lines ?? []) {
338
+ const name = names.get(line.speaker ?? -1) ?? "Unknown speaker";
339
+ console.log(`${name}: ${line.text}\n`);
340
+ }
341
+ } catch (error) {
342
+ if (error instanceof Arcmira.PaymentRequiredError
343
+ || error instanceof Arcmira.ForbiddenError) {
344
+ console.log(`Reason: ${error.body.error.code}`);
345
+ console.log("Estimate:", JSON.stringify(error.body.error.details?.quote, null, 2));
346
+ } else {
347
+ throw error;
348
+ }
67
349
  }
68
350
  ```
69
351
 
70
- ## Quickstart
352
+ If your plan or budget cannot cover the read, `PaymentRequiredError` reports `quota_exceeded` or `spend_limit_exceeded`. On a free plan, `ForbiddenError` reports `paid_plan_required`. These refusals include the estimate in `error.body.error.details.quote`. Set your on-demand budget in the dashboard; requests do not take a spending amount. See [Plans and usage](https://arcmira.com/docs/usage-and-billing).
353
+
354
+ <a id="quickstart"></a>
355
+
356
+ ## Arcmira SDK building blocks
357
+
358
+ ### Find mentions of an entity
359
+
360
+ Find where people discuss a person, company, product, or topic. This example uses a company, PlanetScale.
71
361
 
72
362
  ```ts
73
363
  import { Arcmira, ArcmiraClient } from "arcmira";
74
364
 
75
365
  const client = new ArcmiraClient({ apiKey: process.env.ARCMIRA_API_KEY });
366
+ const resolved = await client.entities.resolve({
367
+ q: "PlanetScale", type: "organization", context: "Database platform",
368
+ });
369
+ const company = resolved.best ?? resolved.suggested;
370
+ if (!company) {
371
+ throw new Error(resolved.ask?.question ?? "Confirm the company first.");
372
+ }
373
+ if (resolved.suggested) console.log(`Assuming ${company.name}.`);
374
+ console.log(`Company: ${company.name} (${company.id})`);
375
+
376
+ // Look back over the last 60 days.
377
+ const now = Date.now();
378
+ const day = 86_400_000;
379
+ const after = new Date(now - 60 * day).toISOString();
380
+ const before = new Date(now).toISOString();
76
381
 
77
- // Who is "Ramp"? Reads take ids, so resolve the name first. The answer is best (one row is meant),
78
- // suggested (one row stands out: use it and say you assumed it), or ask (show the options to the user).
79
- // context carries the user's own words about the name and settles close calls.
80
- const resolved = await client.entities.resolve({ q: "Ramp", context: "the corporate card company" });
81
- const ramp = resolved.best ?? resolved.suggested;
82
- if (!ramp) throw new Error(resolved.ask ? `${resolved.ask.question} ${resolved.ask.options.map((o) => o.label).join("; ")}` : "no match");
83
- if (resolved.suggested) console.log(`Assuming ${ramp.name} (${ramp.type}): ${resolved.suggested.evidence}`);
84
- console.log(ramp.id, ramp.type, ramp.page);
85
-
86
- // Spoken passages that answer a phrase. about, by, entity_ids and channel_ids take ids only; a name answers 400 id_required.
87
- // kind is sponsored, organic or mention. after is inclusive and before exclusive, in UTC.
88
- const hits = await client.transcripts.search({ q: "corporate cards", about: ramp.id, kind: "sponsored", after: "2026-09-01", before: "2026-10-01", limit: 5 });
89
- for (const chunk of hits.chunks) console.log(chunk.channel_name, chunk.published_at, chunk.watch_url, chunk.text);
90
- // The window and index state come back with every search: say where the results stop.
91
- if (hits.window.before) console.log(`results stop before ${hits.window.before}`);
92
- if (hits.search_index.missing_before) console.log(`transcripts before ${hits.search_index.missing_before} are still being added`);
93
-
94
- // Catalog rows page themselves: iterate and the client follows next_cursor. Each row uses credits, so stop when you have enough.
95
382
  let seen = 0;
96
- for await (const mention of await client.mentions.list({ entity_id: ramp.id, after: "2026-09-01", limit: 25 })) {
97
- console.log(mention.media.title, mention.start_seconds);
98
- if (++seen === 40) break;
383
+ for await (const mention of await client.mentions.list({
384
+ entity_id: company.id, after, before, limit: 5,
385
+ })) {
386
+ console.log(`\n${mention.description ?? "No description available."}\n`);
387
+ console.log(`Video: ${mention.media.title ?? mention.media.video_id}`);
388
+ console.log(`Published: ${mention.media.published_at?.slice(0, 10) ?? "Unknown"}`);
389
+ const watch = new URL("https://arcmira.com/watch");
390
+ watch.searchParams.set("v", mention.media.video_id);
391
+ if (mention.start_seconds != null) {
392
+ watch.searchParams.set("t", String(mention.start_seconds));
393
+ }
394
+ console.log(`Watch: ${watch.href}\n--`);
395
+ if (++seen === 5) break;
99
396
  }
397
+ ```
100
398
 
101
- // Who recommends it on air, and whether they were paid.
102
- for await (const row of await client.recommendations.list({ entity_id: ramp.id, class: "organic", limit: 10 })) console.log(row.class, row.verbatim_quote);
399
+ `best` is a certain match. `suggested` is a likely match; state the assumption when using it. If the resolver returns `ask`, confirm the company before continuing. Entity filters take IDs. Date windows include `after` and exclude `before`.
103
400
 
104
- // Gates and failures are typed. The body is the API's error object.
105
- try {
106
- const momentum = await client.entities.momentum({ id: ramp.id });
107
- console.log(momentum.verdict, momentum.volume);
108
- } catch (err) {
109
- if (err instanceof Arcmira.PaymentRequiredError) console.log(err.body.error.gate, err.body.error.unlock?.url);
110
- else throw err;
401
+ List methods fetch more pages as you iterate. This example stops after five mentions.
402
+
403
+ ### Find a person's appearances
404
+
405
+ Find a person's media appearances across YouTube and podcasts. Arcmira records appearances as a type of mention, so the same `mentions.list` method finds both appearances and mentions by others.
406
+
407
+ | `is_appearance` | For a person, returns |
408
+ | --- | --- |
409
+ | `true` | Their appearances |
410
+ | `false` | Mentions of them by others |
411
+ | Omitted | Both |
412
+
413
+ Continue with the same `client`, `after`, and `before` to find Scott Wu's appearances in the last 60 days. Each result is an indexed video; separate clips from an interview can appear as separate results.
414
+
415
+ ```ts
416
+ const personMatch = await client.entities.resolve({ q: "Scott Wu", type: "person" });
417
+ const person = personMatch.best ?? personMatch.suggested;
418
+ if (!person) {
419
+ throw new Error(personMatch.ask?.question ?? "Confirm the person first.");
420
+ }
421
+ if (personMatch.suggested) console.log(`Assuming ${person.name}.`);
422
+ console.log(`\nAppearances: ${person.name}\n`);
423
+
424
+ let appearances = 0;
425
+ for await (const appearance of await client.mentions.list({
426
+ entity_id: person.id, is_appearance: true, after, before, limit: 5,
427
+ })) {
428
+ console.log(`Video: ${appearance.media.title ?? appearance.media.video_id}`);
429
+ console.log(`Channel: ${appearance.media.source_channel?.name ?? "Unknown"}`);
430
+ console.log(`Published: ${appearance.media.published_at?.slice(0, 10) ?? "Unknown"}`);
431
+ const watch = new URL("https://arcmira.com/watch");
432
+ watch.searchParams.set("v", appearance.media.video_id);
433
+ console.log(`Watch: ${watch.href}\n--\n`);
434
+ if (++appearances === 5) break;
435
+ }
436
+ ```
437
+
438
+ ### Narrow your search
439
+
440
+ Search transcript passages mentioning that subject for specific words or phrases. Continue with the same `client`, `company`, `after`, and `before` to search for "database" in passages associated with PlanetScale.
441
+
442
+ ```ts
443
+ const query = "database";
444
+ const hits = await client.transcripts.search({
445
+ q: query, about: company.id, after, before, limit: 20,
446
+ });
447
+ console.log(`\n${query} (${hits.chunks.length} passages)`);
448
+ console.log(
449
+ `${hits.window.after?.slice(0, 10) ?? "unknown"} - ` +
450
+ `${hits.window.before?.slice(0, 10) ?? "unknown"}\n`,
451
+ );
452
+ for (const [i, hit] of hits.chunks.entries()) {
453
+ console.log(`${String(i + 1).padStart(2, "0")}\n${hit.text}\n`);
454
+ console.log(`Video: ${hit.video_title ?? hit.video_id}`);
455
+ console.log(`Channel: ${hit.channel_name ?? "Unknown"}`);
456
+ console.log(`Published: ${hit.published_at?.slice(0, 10) ?? "Unknown"}`);
457
+ console.log(`Transcript: ${hit.source_label ?? "Unknown"}`);
458
+ const watch = new URL(hit.watch_url, "https://arcmira.com").href;
459
+ console.log(`Watch: ${watch}\n--\n`);
460
+ }
461
+ ```
462
+
463
+ ### Find organic endorsements
464
+
465
+ Continue with the same `client` and `company`. The `organic` filter selects unpaid personal recommendations. This example uses Pro+ commercial data.
466
+
467
+ ```ts
468
+ let recommendations = 0;
469
+ for await (const row of await client.recommendations.list({
470
+ entity_id: company.id, class: "organic", after, before, limit: 5,
471
+ })) {
472
+ console.log(`\n${row.verbatim_quote}\n`);
473
+ console.log(`Type: ${row.class}\n--`);
474
+ if (++recommendations === 5) break;
475
+ }
476
+ ```
477
+
478
+ ### Find ad reads and sponsors
479
+
480
+ Find a brand's ad reads, inspect the pitch, and discover which sponsors recur on a channel. These examples use Pro+ commercial data.
481
+
482
+ Continue with the same `client`, `company`, `after`, and `before` to find PlanetScale promotions in the last 60 days. `sponsored` includes ad reads, affiliate promotions, and other ad-style pitches.
483
+
484
+ ```ts
485
+ let promotions = 0;
486
+ for await (const row of await client.recommendations.list({
487
+ entity_id: company.id, class: "sponsored", after, before, limit: 5,
488
+ })) {
489
+ console.log(`\n${row.verbatim_quote ?? "No quote available."}\n`);
490
+ console.log(`Video: ${row.media.title ?? row.media.video_id}`);
491
+ console.log(`Channel: ${row.media.source_channel?.name ?? "Unknown"}`);
492
+ console.log(`Published: ${row.media.published_at?.slice(0, 10) ?? "Unknown"}`);
493
+ const watch = new URL("https://arcmira.com/watch");
494
+ watch.searchParams.set("v", row.media.video_id);
495
+ if (row.start_seconds != null) {
496
+ watch.searchParams.set("t", String(row.start_seconds));
497
+ }
498
+ console.log(`Watch: ${watch.href}\n--`);
499
+ if (++promotions === 5) break;
500
+ }
501
+ ```
502
+
503
+ To explore sponsorship opportunities, list a channel's recurring sponsors, ordered by ad-read count. This rollup covers its indexed history rather than the date window above.
504
+
505
+ ```ts
506
+ const channelMatch = await client.entities.resolve({
507
+ q: "ThePrimeTime", type: "channel",
508
+ });
509
+ const channel = channelMatch.best ?? channelMatch.suggested;
510
+ if (!channel?.youtube_channel_id) {
511
+ throw new Error(channelMatch.ask?.question ?? "Confirm the channel first.");
111
512
  }
513
+ if (channelMatch.suggested) console.log(`Assuming ${channel.name}.`);
514
+ const sponsors = await client.channels.sponsors.list({
515
+ channel_id: channel.youtube_channel_id, limit: 5,
516
+ });
517
+ console.log(`\nSponsors on ${sponsors.channel.name ?? channel.name}\n`);
518
+ for (const sponsor of sponsors.sponsors) {
519
+ console.log(`${sponsor.entity.name}: ${sponsor.ad_reads} ad reads`);
520
+ console.log(`Videos: ${sponsor.videos}`);
521
+ console.log(`Latest: ${sponsor.last_seen?.slice(0, 10) ?? "Unknown"}\n`);
522
+ }
523
+ ```
524
+
525
+ Other plans can preview the channel sponsor list by omitting `limit`. See [plans and usage](https://arcmira.com/docs/usage-and-billing) for access and credit usage. Missing a show or seeing a misclassified promotion? [Send feedback](#help-shape-the-index) to help us improve the coverage and classifications.
526
+
527
+ ### Check mention momentum
528
+
529
+ See whether a company is gaining attention, which shows mention it most, and where to look next. Compare a competitor's mentions with the previous period, then search its transcripts to understand what changed.
530
+
531
+ Continue with the same `client`. This example investigates Cloudflare. Choose a rolling window of 7 to 365 days. Momentum returns an `accelerating`, `flat`, `fading`, or `none` verdict, mention counts for both periods, the change, the latest source date, and the top shows.
532
+
533
+ ```ts
534
+ const match = await client.entities.resolve({
535
+ q: "Cloudflare", type: "organization",
536
+ context: "Internet infrastructure and developer platform",
537
+ });
538
+ const subject = match.best ?? match.suggested;
539
+ if (!subject) {
540
+ throw new Error(match.ask?.question ?? "Confirm the company first.");
541
+ }
542
+ if (match.suggested) console.log(`Assuming ${subject.name}.`);
543
+
544
+ // Compare the latest 7 days available on your plan with the prior 7 days.
545
+ const momentum = await client.entities.momentum({ id: subject.id, days: 7 });
546
+ const { volume, window } = momentum;
547
+ console.log(`\nCompany: ${momentum.entity.name}`);
548
+ console.log(`Momentum: ${momentum.verdict}`);
549
+ const start = window.after?.slice(0, 10) ?? "Unknown";
550
+ const end = window.before?.slice(0, 10) ?? "Unknown";
551
+ console.log(`Window: ${start} - ${end}`);
552
+ console.log(`Mentions: ${volume.mentions_window} vs ${volume.mentions_prior_window} prior`);
553
+ const delta = volume.delta_window_absolute;
554
+ const percent = volume.delta_window_pct;
555
+ const percentage = percent == null ? "" : ` (${percent > 0 ? "+" : ""}${percent}%)`;
556
+ console.log(`Change: ${delta > 0 ? "+" : ""}${delta} mentions${percentage}`);
557
+ console.log(`Latest: ${momentum.as_of?.slice(0, 10) ?? "No dated source"}`);
558
+
559
+ ```
560
+
561
+ Output captured on October 17, 2026. The code samples a new rolling window each time you run it; `window` records the dates actually returned. Save the response with your research brief to preserve the counts you used.
562
+
563
+ ```text
564
+ Company: Cloudflare
565
+ Momentum: accelerating
566
+ Window: 2026-10-10 - 2026-10-17
567
+ Mentions: 22 vs 17 prior
568
+ Change: +5 mentions (+29.4%)
569
+ Latest: 2026-10-16
570
+ ```
571
+
572
+ Available on every plan. Free coverage ends 30 days ago; paid plans include the latest indexed conversations. Pro+ and higher also return `paid_vs_organic`, with separate counts for ad reads, endorsements, and organic recommendations. Each momentum lookup uses 10 credits from your plan. See [plans and usage](https://arcmira.com/docs/usage-and-billing).
573
+
574
+ Search Cloudflare transcripts to find what drove the increase and whether people are enthusiastic, critical, or concerned. The response also includes `top_shows` when you want to choose which shows to investigate first.
575
+
576
+ [See which companies are gaining attention in Famous Rankings](https://arcmira.com/famous/companies/view/rising). Explore rising companies, the shows discussing them, and eight weeks of history to find your next research lead.
577
+
578
+ Momentum measures mention volume across indexed shows. Famous Rankings uses its own [ranking method](https://arcmira.com/famous/method) to compare companies. Follow the mentions to learn whether an increase reflects a product launch, customer enthusiasm, sponsorships, or controversy. Need more coverage for your market? [Help shape the index](#help-shape-the-index).
579
+
580
+ ### Set up YouTube monitoring
112
581
 
113
- // Every tracker lives in a monitor, which sets how it alerts. An indexed entity joins by id; an exact name
114
- // joins by name and type, and fires on newly analyzed media even before the name is indexed. A channel is
115
- // followed by its YouTube channel id. Each id or name gets one result; attached: false comes with a reason.
116
- const { monitor } = await client.monitors.create({ name: "Fintech", notify_frequency: "daily" });
117
- await client.monitors.entities.add({ id: monitor.id, entity_ids: [ramp.id], names: [{ name: "Mercury", type: "organization" }] });
582
+ Set up YouTube monitoring for a person, company, product, or topic to get alerts when they are mentioned across videos and podcasts.
583
+
584
+ This example creates a monitor in your account for PlanetScale, using the company resolved above. A monitor sets delivery preferences; each tracker follows a name or channel. See [monitor delivery options](https://arcmira.com/docs/monitors#delivery) to choose email, Slack or a webhook.
585
+
586
+ ```ts
587
+ const { monitor } = await client.monitors.create({
588
+ name: `${company.name} mentions`, notify_frequency: "daily",
589
+ });
590
+ const { results } = await client.monitors.entities.add({
591
+ id: monitor.id, entity_ids: [company.id],
592
+ });
593
+ for (const result of results) {
594
+ console.log(result.attached ? `Tracker: ${result.tracker_id}` : result.reason);
595
+ }
118
596
  ```
119
597
 
120
598
  Every method is listed with its request and response types in [reference.md](./reference.md). The same operations, with `curl` samples, are in the [API reference](https://arcmira.com/docs/api-reference).
@@ -127,7 +605,12 @@ A method that returns a `Page` is an async iterable over rows. `page.data` holds
127
605
 
128
606
  Every non-2xx answer throws a subclass of `ArcmiraError` named for the status: `BadRequestError`, `UnauthorizedError`, `PaymentRequiredError`, `ForbiddenError`, `NotFoundError`, `ConflictError`, `TooManyRequestsError`, `InternalServerError` and so on, all under the `Arcmira` namespace. `err.statusCode` is the status and `err.body.error` is the API's error object: `type`, `code`, `message`, `doc_url`, `request_id`, on a plan gate `gate` and `unlock.url`, and `details.quote` on a priced refusal. The envelope is `{ error }` alone. Switch on `type` and `gate` first; `code` is a string whose catalog is in the [errors page](https://arcmira.com/docs/errors).
129
607
 
130
- ### Options
608
+ ### Runtime and client options
609
+
610
+ The SDK has zero runtime dependencies and uses global `fetch`. It supports Node.js 18 and later, Cloudflare Workers, Deno, Bun and browsers, with ESM and CommonJS builds and TypeScript types. Keep your API key on the server in browser applications.
611
+
612
+ <a id="options"></a>
613
+
131
614
 
132
615
  `new ArcmiraClient({ apiKey, baseUrl, timeoutInSeconds, maxRetries, headers, fetch })`. `apiKey` falls back to `ARCMIRA_API_KEY`. On Cloudflare Workers pass `apiKey` from your binding; the environment fallback reads `process.env`, which exists there only with `nodejs_compat`.
133
616
 
@@ -136,15 +619,30 @@ Every non-2xx answer throws a subclass of `ArcmiraError` named for the status: `
136
619
  The package ships the `arcmira` binary. Its commands mirror the client of the [Arcmira MCP server](https://github.com/arcmira/mcp), so a workflow you prototype with an agent runs the same from a shell.
137
620
 
138
621
  ```sh
139
- npx arcmira login you@example.com # emails a six digit code
140
- npx arcmira login you@example.com --code 482913 # saves the key; later commands need no ARCMIRA_API_KEY
622
+ npx arcmira login you@example.com
623
+ # After the email arrives, replace 482913 with your code.
624
+ npx arcmira login you@example.com --code 482913
141
625
  npx arcmira whoami
142
- npx arcmira resolve Ramp # ent_14 organization Ramp
143
- npx arcmira mentions --entity ent_14 --after 2026-09-01 --before 2026-10-01
144
- npx arcmira search "agent payments" --limit 3
145
- npx arcmira resolve TBPN --type channel # the UC id: arcmira sponsors UC-DRzaGnL_vtBUpCFH5M0tg
146
- npx arcmira follow Ramp --type org --monitor <monitor-id>
147
- npx arcmira api GET /v1/mentions -f entity_id=ent_14 --paginate
626
+ npx arcmira resolve PlanetScale --type organization
627
+ ```
628
+
629
+ For a rolling window, calculate the start date when you run the command. PlanetScale resolved to `ent_141666` in this example; use the ID from your own resolve result.
630
+
631
+ ```sh
632
+ ARCMIRA_AFTER="$(node -e '
633
+ const now = Date.now();
634
+ const day = 86_400_000;
635
+ console.log(new Date(now - 60 * day).toISOString());
636
+ ')"
637
+ npx arcmira mentions --entity ent_141666 --after "$ARCMIRA_AFTER"
638
+ npx arcmira search "GPU demand" --after "$ARCMIRA_AFTER" --limit 20
639
+ npx arcmira api GET /v1/mentions -f entity_id=ent_141666 --paginate
640
+ ```
641
+
642
+ To add a tracker to an existing monitor, replace `MONITOR_ID` below. This changes your account.
643
+
644
+ ```sh
645
+ npx arcmira follow PlanetScale --type org --monitor MONITOR_ID
148
646
  ```
149
647
 
150
648
  ### Setup
@@ -258,20 +756,10 @@ Every dated command takes `--after` (inclusive) and `--before` (exclusive), as a
258
756
  - Developers page: https://arcmira.com/developers
259
757
  - Agent index: https://arcmira.com/llms.txt
260
758
 
261
- ## Development
759
+ ## Contributing
262
760
 
263
- `src/` is generated from the Arcmira OpenAPI document by [Fern](https://github.com/fern-api/fern); do not edit it by hand, a regeneration overwrites it. `cli/` (except `cli/operations.ts`), `tests/` (except `tests/fixtures/v1.json`) and this file are hand-written. `npm test` builds and runs the tests against a local fake of the API (`tests/fake-v1.mjs`, bodies in `tests/fixtures/v1.json`, written from `fern/openapi.json` by `scripts/build-fixtures.py`).
761
+ We are hiring. ASI-pilled technical people only. Figure it out.
264
762
 
265
763
  ## License
266
764
 
267
765
  Apache-2.0. See [LICENSE](./LICENSE).
268
-
269
- ## Regenerate the SDK
270
-
271
- Run `npm run generate -- <path to arcmira-v1.json>` with Node 22 or newer, Python 3, Docker, and Fern access for the `arcmira` organization. It vendors the spec into `fern/openapi.json` (omit the path to reuse the vendored copy), pins Fern CLI 5.131.1 and TypeScript generator 3.96.0, disables CLI version redirection and telemetry, and regenerates `src/`, `reference.md`, `cli/operations.ts` and the test fixtures.
272
-
273
- `fern/method-names.json` names the SDK group and method of every operation by its `operationId`; an operation it does not name, or a name for an operation the spec lacks, fails generation. The overlay combines success schemas into a `state` union and discovers cursor collections from their schemas. The installer rewrites the `exports` map in `package.json` from the generated resources. Unknown or ambiguous collections fail generation. An exact checked patch keeps request timer cleanup in `finally` until the pinned generator includes the fix. Generated source is never edited by hand.
274
-
275
- Run `npm test` for the SDK and CLI tests, and `npm run test:types` for the consumer type contract. Tests use local HTTP fixtures and use no credits.
276
-
277
- Upgrading from 0.3: see [CHANGELOG.md](./CHANGELOG.md) for every removed method and its replacement.