@plaud-ai/cli 0.3.3 → 0.3.5
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/dist/index.js +72 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19980,6 +19980,8 @@ var EMAIL_REGEX = /[\w.+-]+@[\w-]+\.[\w.-]+/;
|
|
|
19980
19980
|
var ALLOWED_PROPERTIES = /* @__PURE__ */ new Set([
|
|
19981
19981
|
// Global common properties (Plaud Common Event Properties + Spec §2)
|
|
19982
19982
|
"user_id",
|
|
19983
|
+
"client_user_id",
|
|
19984
|
+
// per-OAuth-client user id (JWT sub, `client_user_…`); DA common param across web/CLI/stdio/HTTP (Mirela 2026-06-29)
|
|
19983
19985
|
"member_id",
|
|
19984
19986
|
// fill-if-present; OAuth /users/current doesn't return it yet (Q16)
|
|
19985
19987
|
"workspace_id",
|
|
@@ -20110,6 +20112,7 @@ var state = {
|
|
|
20110
20112
|
memberId: null,
|
|
20111
20113
|
workspaceId: null,
|
|
20112
20114
|
role: null,
|
|
20115
|
+
clientUserId: null,
|
|
20113
20116
|
mcpHost: null
|
|
20114
20117
|
};
|
|
20115
20118
|
async function initTelemetry(options) {
|
|
@@ -20130,6 +20133,7 @@ async function initTelemetry(options) {
|
|
|
20130
20133
|
state.memberId = identity?.memberId ?? null;
|
|
20131
20134
|
state.workspaceId = identity?.workspaceId ?? null;
|
|
20132
20135
|
state.role = identity?.role ?? null;
|
|
20136
|
+
state.clientUserId = identity?.clientUserId ?? null;
|
|
20133
20137
|
state.currentDistinctId = identity?.idHash || userId || await getAnonymousId();
|
|
20134
20138
|
state.initialised = true;
|
|
20135
20139
|
}
|
|
@@ -20141,6 +20145,7 @@ async function setUser(userId, identity) {
|
|
|
20141
20145
|
state.memberId = identity?.memberId ?? null;
|
|
20142
20146
|
state.workspaceId = identity?.workspaceId ?? null;
|
|
20143
20147
|
state.role = identity?.role ?? null;
|
|
20148
|
+
state.clientUserId = identity?.clientUserId ?? null;
|
|
20144
20149
|
if (state.surface) {
|
|
20145
20150
|
try {
|
|
20146
20151
|
await saveUserIdentity(state.surface, userId, identity);
|
|
@@ -20166,6 +20171,7 @@ async function clearUser() {
|
|
|
20166
20171
|
state.memberId = null;
|
|
20167
20172
|
state.workspaceId = null;
|
|
20168
20173
|
state.role = null;
|
|
20174
|
+
state.clientUserId = null;
|
|
20169
20175
|
if (state.surface) {
|
|
20170
20176
|
try {
|
|
20171
20177
|
await clearUserIdentity(state.surface);
|
|
@@ -20208,6 +20214,8 @@ function buildCommonProperties() {
|
|
|
20208
20214
|
out.transport = state.transport;
|
|
20209
20215
|
if (state.currentUserId)
|
|
20210
20216
|
out.user_id = state.currentUserId;
|
|
20217
|
+
if (state.clientUserId)
|
|
20218
|
+
out.client_user_id = state.clientUserId;
|
|
20211
20219
|
if (state.memberId)
|
|
20212
20220
|
out.member_id = state.memberId;
|
|
20213
20221
|
if (state.workspaceId)
|
|
@@ -20356,7 +20364,7 @@ function isNewer(current, latest) {
|
|
|
20356
20364
|
return false;
|
|
20357
20365
|
}
|
|
20358
20366
|
var updateCommand = new Command("update").description("Check npm for the latest Plaud CLI and print the upgrade command").action(async () => {
|
|
20359
|
-
const current = "0.3.
|
|
20367
|
+
const current = "0.3.5";
|
|
20360
20368
|
const spinner = ora("Checking npm for latest version...").start();
|
|
20361
20369
|
const latest = await fetchLatestVersion();
|
|
20362
20370
|
spinner.stop();
|
|
@@ -20411,10 +20419,10 @@ async function checkForUpdate(current) {
|
|
|
20411
20419
|
return isNewer(current, latest) ? latest : null;
|
|
20412
20420
|
}
|
|
20413
20421
|
var versionCommand = new Command2("version").description("Show CLI version information").action(async () => {
|
|
20414
|
-
const current = "0.3.
|
|
20422
|
+
const current = "0.3.5";
|
|
20415
20423
|
console.log(`plaud ${current}`);
|
|
20416
|
-
if ("
|
|
20417
|
-
if ("2026-
|
|
20424
|
+
if ("3c993f6") console.log(`commit ${"3c993f6"}`);
|
|
20425
|
+
if ("2026-07-29T10:32:49.064Z") console.log(`built ${"2026-07-29T10:32:49.064Z"}`);
|
|
20418
20426
|
if (current === "unknown") return;
|
|
20419
20427
|
const newer = await checkForUpdate(current);
|
|
20420
20428
|
if (newer) {
|
|
@@ -20515,6 +20523,16 @@ function oauthCallbackErrorType(status) {
|
|
|
20515
20523
|
}
|
|
20516
20524
|
|
|
20517
20525
|
// ../shared/dist/oauth.js
|
|
20526
|
+
function clientUserIdFromAccessToken(token) {
|
|
20527
|
+
if (!token)
|
|
20528
|
+
return void 0;
|
|
20529
|
+
try {
|
|
20530
|
+
const payload = JSON.parse(Buffer.from(token.split(".")[1], "base64url").toString());
|
|
20531
|
+
return typeof payload.sub === "string" && payload.sub.length > 0 ? payload.sub : void 0;
|
|
20532
|
+
} catch {
|
|
20533
|
+
return void 0;
|
|
20534
|
+
}
|
|
20535
|
+
}
|
|
20518
20536
|
var DEFAULT_AUTHORIZATION_URL = "https://web.plaud.ai/platform/oauth";
|
|
20519
20537
|
var DEFAULT_TOKEN_URL = "https://platform.plaud.ai/developer/api/oauth/third-party/access-token";
|
|
20520
20538
|
var DEFAULT_REFRESH_URL = "https://platform.plaud.ai/developer/api/oauth/third-party/access-token/refresh";
|
|
@@ -20852,6 +20870,23 @@ function runOAuthCallback(opts) {
|
|
|
20852
20870
|
});
|
|
20853
20871
|
}
|
|
20854
20872
|
|
|
20873
|
+
// ../shared/dist/source-block.js
|
|
20874
|
+
async function loadBlockContent(block) {
|
|
20875
|
+
if (!block)
|
|
20876
|
+
return "";
|
|
20877
|
+
const inline = block.data_content;
|
|
20878
|
+
if (typeof inline === "string" && inline.length > 0)
|
|
20879
|
+
return inline;
|
|
20880
|
+
const link = block.data_link;
|
|
20881
|
+
if (typeof link === "string" && link.length > 0) {
|
|
20882
|
+
const res = await fetch(link);
|
|
20883
|
+
if (!res.ok)
|
|
20884
|
+
throw new Error(`Failed to fetch block content from data_link (HTTP ${res.status})`);
|
|
20885
|
+
return await res.text();
|
|
20886
|
+
}
|
|
20887
|
+
return "";
|
|
20888
|
+
}
|
|
20889
|
+
|
|
20855
20890
|
// src/config.ts
|
|
20856
20891
|
import { readFileSync, existsSync } from "fs";
|
|
20857
20892
|
import { homedir as homedir4 } from "os";
|
|
@@ -20981,7 +21016,11 @@ Opening browser for authentication...
|
|
|
20981
21016
|
try {
|
|
20982
21017
|
const user = await client2.getCurrentUser();
|
|
20983
21018
|
if (user && typeof user.id === "string") {
|
|
20984
|
-
await
|
|
21019
|
+
const token = await client2.auth.getAccessToken();
|
|
21020
|
+
await setUser(user.id, {
|
|
21021
|
+
...extractIdentity(user),
|
|
21022
|
+
clientUserId: clientUserIdFromAccessToken(token)
|
|
21023
|
+
});
|
|
20985
21024
|
}
|
|
20986
21025
|
} catch {
|
|
20987
21026
|
}
|
|
@@ -21246,23 +21285,43 @@ import { Command as Command9 } from "commander";
|
|
|
21246
21285
|
import chalk10 from "chalk";
|
|
21247
21286
|
import ora7 from "ora";
|
|
21248
21287
|
import { writeFile as writeFile4 } from "fs/promises";
|
|
21249
|
-
var
|
|
21288
|
+
var BLOCKS = ["transaction", "transaction_polish", "outline"];
|
|
21289
|
+
var transcriptCommand = new Command9("transcript").description("Get the transcript for a Plaud recording").argument("<file_id>", "The file ID to retrieve transcript for").option("-o, --output <file>", "Save transcript to a file").option(
|
|
21290
|
+
"--block <block>",
|
|
21291
|
+
`Which block to fetch: ${BLOCKS.join(" | ")} (default: transaction)`
|
|
21292
|
+
).option("--polished", "Shortcut for --block transaction_polish (AI-cleaned transcript)").action(async (fileId, opts) => {
|
|
21293
|
+
const block = opts.polished ? "transaction_polish" : opts.block ?? "transaction";
|
|
21294
|
+
if (!BLOCKS.includes(block)) {
|
|
21295
|
+
printError("BAD_ARGS", `Unknown --block "${block}". Choose one of: ${BLOCKS.join(", ")}.`);
|
|
21296
|
+
await telemetryExit(ExitCode.ERROR);
|
|
21297
|
+
}
|
|
21250
21298
|
const client2 = getClient2();
|
|
21251
21299
|
const spinner = ora7("Fetching transcript...").start();
|
|
21252
21300
|
try {
|
|
21253
21301
|
const file = await client2.getFile(fileId);
|
|
21254
|
-
spinner.stop();
|
|
21255
21302
|
const sourceList = file.source_list ?? [];
|
|
21256
|
-
const source = sourceList.find((s) => s.data_type ===
|
|
21303
|
+
const source = sourceList.find((s) => s.data_type === block);
|
|
21257
21304
|
if (!source) {
|
|
21258
|
-
|
|
21305
|
+
spinner.stop();
|
|
21306
|
+
const available = sourceList.map((s) => s.data_type).filter(Boolean).join(", ") || "(none)";
|
|
21307
|
+
console.log(chalk10.yellow(`No "${block}" transcript for this recording. Available: ${available}.`));
|
|
21308
|
+
return;
|
|
21309
|
+
}
|
|
21310
|
+
const content = await loadBlockContent(source);
|
|
21311
|
+
spinner.stop();
|
|
21312
|
+
if (!content) {
|
|
21313
|
+
console.log(
|
|
21314
|
+
chalk10.yellow(
|
|
21315
|
+
block === "transaction_polish" ? "The cleaned-up (polished) transcript hasn't been generated for this recording yet." : `The "${block}" transcript is not available for this recording.`
|
|
21316
|
+
)
|
|
21317
|
+
);
|
|
21259
21318
|
return;
|
|
21260
21319
|
}
|
|
21261
|
-
const segments = JSON.parse(
|
|
21320
|
+
const segments = JSON.parse(content);
|
|
21262
21321
|
const lines = segments.map((seg) => {
|
|
21263
21322
|
const time = `[${formatTime(seg.start_time)} - ${formatTime(seg.end_time)}]`;
|
|
21264
21323
|
const speaker = seg.speaker ? `${seg.speaker}: ` : "";
|
|
21265
|
-
return `${time} ${speaker}${seg.content}`;
|
|
21324
|
+
return `${time} ${speaker}${seg.content ?? seg.topic ?? ""}`;
|
|
21266
21325
|
});
|
|
21267
21326
|
const output = lines.join("\n");
|
|
21268
21327
|
if (opts.output) {
|
|
@@ -21637,7 +21696,7 @@ async function runWizard() {
|
|
|
21637
21696
|
try {
|
|
21638
21697
|
await initTelemetry({
|
|
21639
21698
|
surface: "cli",
|
|
21640
|
-
appVersion: "0.3.
|
|
21699
|
+
appVersion: "0.3.5"
|
|
21641
21700
|
});
|
|
21642
21701
|
} catch {
|
|
21643
21702
|
}
|
|
@@ -21646,7 +21705,7 @@ async function notifyUpdate() {
|
|
|
21646
21705
|
if (sub === "version" || sub === "update") return;
|
|
21647
21706
|
if (process.env.PLAUD_NO_UPDATE_NOTIFIER) return;
|
|
21648
21707
|
if (!process.stderr.isTTY) return;
|
|
21649
|
-
const current = "0.3.
|
|
21708
|
+
const current = "0.3.5";
|
|
21650
21709
|
if (current === "0.0.0") return;
|
|
21651
21710
|
try {
|
|
21652
21711
|
const newer = await checkForUpdate(current);
|