vana-cli 0.29.0 → 0.29.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/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +82 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/server-start.d.ts +12 -0
- package/dist/cli/server-start.d.ts.map +1 -1
- package/dist/cli/server-start.js +48 -1
- package/dist/cli/server-start.js.map +1 -1
- package/dist/personal-server/local/runtime-pkg/derived-config.mjs +64 -0
- package/dist/personal-server/local/runtime-pkg/entry.mjs +2 -56
- package/dist/personal-server/local/runtime.d.ts.map +1 -1
- package/dist/personal-server/local/runtime.js +12 -4
- package/dist/personal-server/local/runtime.js.map +1 -1
- package/dist/personal-server/local/server.d.ts +2 -0
- package/dist/personal-server/local/server.d.ts.map +1 -1
- package/dist/personal-server/local/server.js +1 -0
- package/dist/personal-server/local/server.js.map +1 -1
- package/dist/runtime/playwright/in-process-run.d.ts +11 -0
- package/dist/runtime/playwright/in-process-run.d.ts.map +1 -1
- package/dist/runtime/playwright/in-process-run.js +153 -6
- package/dist/runtime/playwright/in-process-run.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.d.ts
CHANGED
|
@@ -73,6 +73,13 @@ export declare function getSourceStatusPresentation(source: SourceStatus): {
|
|
|
73
73
|
export declare function toneForRuntime(runtime: CliStatus["runtime"]): RenderTone;
|
|
74
74
|
export declare function loadRegistrySources(): Promise<AvailableSource[]>;
|
|
75
75
|
export declare function compareSourceStatusOrder(left: SourceStatus, right: SourceStatus): number;
|
|
76
|
+
/**
|
|
77
|
+
* Why a connector result holds no data despite recorded errors, or null when
|
|
78
|
+
* it has data or recorded no error. A partial run (data plus errors) still
|
|
79
|
+
* counts as collected; an empty result with no errors is an empty account.
|
|
80
|
+
*/
|
|
81
|
+
export declare function failedEmptyResult(result: unknown): string | null;
|
|
82
|
+
export declare function browserStepMessage(message: string): string;
|
|
76
83
|
export declare function isSourceAttention(source: SourceStatus): boolean;
|
|
77
84
|
export declare function rankSourceStatus(source: SourceStatus): number;
|
|
78
85
|
export declare function readResultSummary(resultPath: string): Promise<{
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAQL,YAAY,EAIb,MAAM,kBAAkB,CAAC;AAgB1B,OAAO,KAAK,EACV,UAAU,EAEV,gBAAgB,EAEhB,SAAS,EACT,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAwKjE,UAAU,cAAc;IACtB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,UAAU,iBAAiB;IACzB,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;QAClD,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;KAC7B,CAAC;CACH;AA2BD,KAAK,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAehF,wBAAsB,MAAM,CAAC,IAAI,WAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CA+vBjE;AA+OD,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,QAAQ,EAAE,eAAe,GAAG,IAAI,EAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,OAAO,SAA0B,GAChC,OAAO,CAAC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AAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,GACA,MAAM,CAaR;AAsBD,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GACtD,OAAO,CAOT;AAqMD,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,GAAE,gBAAwC,EACvD,QAAQ,SAAmB,EAC3B,WAAW,SAAkB,GAC5B,MAAM,EAAE,CAkBV;AAgDD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EAAE,EACrB,eAAe,EAAE,MAAM,GACtB,MAAM,CA+BR"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1195,6 +1195,7 @@ async function runConnect(rawSource, options, connectOptions = {}) {
|
|
|
1195
1195
|
renderer?.resumeAfterPrompt();
|
|
1196
1196
|
return values;
|
|
1197
1197
|
};
|
|
1198
|
+
const shownBrowserPrompts = new Set();
|
|
1198
1199
|
for await (const event of runtime.runConnector({
|
|
1199
1200
|
connectorPath: resolution.connectorPath,
|
|
1200
1201
|
source: resolution.source,
|
|
@@ -1285,7 +1286,19 @@ async function runConnect(rawSource, options, connectOptions = {}) {
|
|
|
1285
1286
|
continue;
|
|
1286
1287
|
}
|
|
1287
1288
|
if (event.type === "headed-required") {
|
|
1288
|
-
//
|
|
1289
|
+
// The browser opens by itself, but the person has to act in it:
|
|
1290
|
+
// without this line an empty sign-in page appears and the terminal
|
|
1291
|
+
// says nothing. Each distinct message once.
|
|
1292
|
+
const message = event.message?.trim();
|
|
1293
|
+
if (message && !shownBrowserPrompts.has(message)) {
|
|
1294
|
+
// The bell once per run: the runtime's "opening a browser" line and
|
|
1295
|
+
// the connector's own instruction arrive back to back.
|
|
1296
|
+
if (shownBrowserPrompts.size === 0) {
|
|
1297
|
+
renderer?.bell();
|
|
1298
|
+
}
|
|
1299
|
+
shownBrowserPrompts.add(message);
|
|
1300
|
+
renderer?.note(browserStepMessage(message));
|
|
1301
|
+
}
|
|
1289
1302
|
continue;
|
|
1290
1303
|
}
|
|
1291
1304
|
if (event.type === "legacy-auth") {
|
|
@@ -1316,14 +1329,20 @@ async function runConnect(rawSource, options, connectOptions = {}) {
|
|
|
1316
1329
|
try {
|
|
1317
1330
|
const raw = await fsp.readFile(event.resultPath, "utf8");
|
|
1318
1331
|
const parsed = JSON.parse(raw);
|
|
1319
|
-
|
|
1332
|
+
const errorOnly = parsed &&
|
|
1320
1333
|
typeof parsed === "object" &&
|
|
1321
1334
|
"error" in parsed &&
|
|
1322
|
-
Object.keys(parsed).length <= 2
|
|
1335
|
+
Object.keys(parsed).length <= 2;
|
|
1336
|
+
// A full export shape can also carry errors and no data: the
|
|
1337
|
+
// connector stopped (e.g. at sign-in) or every stream failed, and it
|
|
1338
|
+
// wrote an empty result, which must not read as "Connected".
|
|
1339
|
+
const fatalReason = errorOnly ? null : failedEmptyResult(parsed);
|
|
1340
|
+
if (errorOnly || fatalReason) {
|
|
1323
1341
|
// Connector returned an error, not real data
|
|
1324
|
-
const errorMsg =
|
|
1325
|
-
|
|
1326
|
-
|
|
1342
|
+
const errorMsg = fatalReason ??
|
|
1343
|
+
(typeof parsed.error === "string"
|
|
1344
|
+
? parsed.error
|
|
1345
|
+
: "Collection returned an error");
|
|
1327
1346
|
await updateSourceState(source, {
|
|
1328
1347
|
lastRunAt: new Date().toISOString(),
|
|
1329
1348
|
lastRunOutcome: CliOutcomeStatus.RUNTIME_ERROR,
|
|
@@ -1335,9 +1354,10 @@ async function runConnect(rawSource, options, connectOptions = {}) {
|
|
|
1335
1354
|
lastLogPath: runLogPath ?? fetchLogPath,
|
|
1336
1355
|
});
|
|
1337
1356
|
renderer?.fail(`Problem connecting ${displayName}.`);
|
|
1338
|
-
renderer?.detail(
|
|
1339
|
-
|
|
1340
|
-
|
|
1357
|
+
renderer?.detail(fatalReason ??
|
|
1358
|
+
(typeof parsed.error === "string"
|
|
1359
|
+
? parsed.error
|
|
1360
|
+
: "The connector returned an error instead of data."));
|
|
1341
1361
|
emit.event({
|
|
1342
1362
|
type: "outcome",
|
|
1343
1363
|
status: CliOutcomeStatus.RUNTIME_ERROR,
|
|
@@ -4058,6 +4078,59 @@ export function compareSourceStatusOrder(left, right) {
|
|
|
4058
4078
|
authMode: right.authMode,
|
|
4059
4079
|
}));
|
|
4060
4080
|
}
|
|
4081
|
+
const RESULT_METADATA_KEYS = new Set([
|
|
4082
|
+
"requestedScopes",
|
|
4083
|
+
"timestamp",
|
|
4084
|
+
"version",
|
|
4085
|
+
"platform",
|
|
4086
|
+
"exportSummary",
|
|
4087
|
+
"errors",
|
|
4088
|
+
]);
|
|
4089
|
+
// Collected content, looked for inside the scope wrappers connectors build
|
|
4090
|
+
// (ChatGPT writes `{ conversations: [], total: 0 }`). Numbers and booleans on
|
|
4091
|
+
// their own are counters and flags, not content.
|
|
4092
|
+
function hasContent(value) {
|
|
4093
|
+
if (typeof value === "string")
|
|
4094
|
+
return value.trim() !== "";
|
|
4095
|
+
if (Array.isArray(value))
|
|
4096
|
+
return value.some(hasContent);
|
|
4097
|
+
if (value && typeof value === "object") {
|
|
4098
|
+
return Object.values(value).some(hasContent);
|
|
4099
|
+
}
|
|
4100
|
+
return false;
|
|
4101
|
+
}
|
|
4102
|
+
/**
|
|
4103
|
+
* Why a connector result holds no data despite recorded errors, or null when
|
|
4104
|
+
* it has data or recorded no error. A partial run (data plus errors) still
|
|
4105
|
+
* counts as collected; an empty result with no errors is an empty account.
|
|
4106
|
+
*/
|
|
4107
|
+
export function failedEmptyResult(result) {
|
|
4108
|
+
if (!result || typeof result !== "object")
|
|
4109
|
+
return null;
|
|
4110
|
+
const record = result;
|
|
4111
|
+
const errors = (Array.isArray(record.errors) ? record.errors : []).filter((entry) => Boolean(entry) && typeof entry === "object");
|
|
4112
|
+
// No recorded error: an empty result is an empty account, not a failure.
|
|
4113
|
+
if (errors.length === 0)
|
|
4114
|
+
return null;
|
|
4115
|
+
// Judge by the data itself, not exportSummary.count: some connectors count
|
|
4116
|
+
// one stream only (ChatGPT counts conversations, not memories).
|
|
4117
|
+
const hasData = Object.entries(record).some(([key, value]) => !RESULT_METADATA_KEYS.has(key) && hasContent(value));
|
|
4118
|
+
if (hasData)
|
|
4119
|
+
return null;
|
|
4120
|
+
const cause = errors.find((entry) => entry.disposition === "fatal") ?? errors[0];
|
|
4121
|
+
return typeof cause.reason === "string" && cause.reason.trim()
|
|
4122
|
+
? cause.reason
|
|
4123
|
+
: "The connector stopped before collecting any data.";
|
|
4124
|
+
}
|
|
4125
|
+
// Legacy connectors wrote their manual-step text for a host with a "Done"
|
|
4126
|
+
// button. The CLI has none: the runtime checks by itself until the step is
|
|
4127
|
+
// complete, so "click Done" would read as a button that never appears.
|
|
4128
|
+
const CLICK_DONE = /,?\s*(?:then\s+)?(?:return here and\s+)?click "Done"\.?\s*$/i;
|
|
4129
|
+
export function browserStepMessage(message) {
|
|
4130
|
+
if (!CLICK_DONE.test(message))
|
|
4131
|
+
return message;
|
|
4132
|
+
return `${message.replace(CLICK_DONE, ".")} Vana continues on its own once you're done.`;
|
|
4133
|
+
}
|
|
4061
4134
|
export function isSourceAttention(source) {
|
|
4062
4135
|
if (source.dataState === "ingest_failed" ||
|
|
4063
4136
|
source.dataState === "ingest_unavailable") {
|