@inetafrica/open-claudia 1.14.1 → 1.14.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/bot-agent.js +26 -4
- package/bot.js +26 -4
- package/package.json +1 -1
package/bot-agent.js
CHANGED
|
@@ -868,6 +868,19 @@ function runClaudeAuthStatusDiagnostic() {
|
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
870
|
|
|
871
|
+
|
|
872
|
+
async function sendClaudeAuthStatusSummary(prefix = "Claude auth status") {
|
|
873
|
+
const output = runClaudeAuthStatusDiagnostic();
|
|
874
|
+
const tokenInfo = getClaudeOAuthToken();
|
|
875
|
+
const lines = summarizeClaudeAuthStatus(output, isClaudeAuthErrorText(output) ? 1 : 0, tokenInfo);
|
|
876
|
+
await send([
|
|
877
|
+
prefix,
|
|
878
|
+
"",
|
|
879
|
+
...lines,
|
|
880
|
+
`Bot OAuth token: ${tokenInfo.value ? "configured via " + tokenInfo.source : "not configured"}`,
|
|
881
|
+
].join("\n"));
|
|
882
|
+
}
|
|
883
|
+
|
|
871
884
|
function claudeEmptyFailureMessage(code, stderrText = "") {
|
|
872
885
|
const stderr = redactSensitive(String(stderrText || "").trim());
|
|
873
886
|
if (isClaudeUsageLimitText(stderr)) return claudeUsageLimitMessage(stderr.slice(-1200));
|
|
@@ -955,9 +968,16 @@ async function runClaudeAuthCommand(args, label, opts = {}) {
|
|
|
955
968
|
const token = opts.captureToken ? extractClaudeToken(output) : null;
|
|
956
969
|
if (token && !tokenStored) tokenStored = saveClaudeOAuthToken(token);
|
|
957
970
|
const final = redactSensitive(output.trim());
|
|
958
|
-
if (tokenStored)
|
|
959
|
-
|
|
960
|
-
|
|
971
|
+
if (tokenStored) {
|
|
972
|
+
await send(`${label} finished. OAuth token stored for launchd/non-interactive Claude runs.`);
|
|
973
|
+
await sendClaudeAuthStatusSummary("Post-auth check:");
|
|
974
|
+
} else if (final) {
|
|
975
|
+
await send(`${label} finished (exit ${code}).\n\n${final.slice(-2500)}`);
|
|
976
|
+
await sendClaudeAuthStatusSummary("Post-auth check:");
|
|
977
|
+
} else {
|
|
978
|
+
await send(`${label} finished (exit ${code}).`);
|
|
979
|
+
await sendClaudeAuthStatusSummary("Post-auth check:");
|
|
980
|
+
}
|
|
961
981
|
});
|
|
962
982
|
proc.on("error", async (err) => {
|
|
963
983
|
pendingClaudeAuthProcess = null;
|
|
@@ -1694,6 +1714,7 @@ bot.onText(/\/use_oauth_token(?:\s+(.+))?$/, async (msg, match) => {
|
|
|
1694
1714
|
if (!looksLikeClaudeToken(token)) return send("That doesn't look like a Claude OAuth token. Not saved.");
|
|
1695
1715
|
saveClaudeOAuthToken(token);
|
|
1696
1716
|
await send(`Claude OAuth token stored in .env${vault.isUnlocked() ? " and vault" : ""}. Restart the bot so launchd picks it up, or use /restart.`);
|
|
1717
|
+
await sendClaudeAuthStatusSummary("Stored token. Current Claude auth status:");
|
|
1697
1718
|
});
|
|
1698
1719
|
|
|
1699
1720
|
bot.onText(/\/clear_oauth_token$/, async (msg) => {
|
|
@@ -1948,11 +1969,12 @@ bot.on("message", async (msg) => {
|
|
|
1948
1969
|
if (!looksLikeClaudeToken(text)) { await send("That doesn't look like a Claude OAuth token. Not saved."); return; }
|
|
1949
1970
|
saveClaudeOAuthToken(text);
|
|
1950
1971
|
await send(`Claude OAuth token stored in .env${vault.isUnlocked() ? " and vault" : ""}. Restart the bot so launchd picks it up, or use /restart.`);
|
|
1972
|
+
await sendClaudeAuthStatusSummary("Stored token. Current Claude auth status:");
|
|
1951
1973
|
return;
|
|
1952
1974
|
}
|
|
1953
1975
|
try {
|
|
1954
1976
|
pendingClaudeAuthProcess.stdin.write(text + "\n");
|
|
1955
|
-
await send("Sent to Claude auth process.");
|
|
1977
|
+
await send("Sent to Claude auth process. I’ll confirm when Claude finishes the auth check.");
|
|
1956
1978
|
} catch (e) {
|
|
1957
1979
|
pendingClaudeAuthProcess = null;
|
|
1958
1980
|
pendingClaudeAuthLabel = null;
|
package/bot.js
CHANGED
|
@@ -930,6 +930,19 @@ function runClaudeAuthStatusDiagnostic() {
|
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
|
|
933
|
+
|
|
934
|
+
async function sendClaudeAuthStatusSummary(prefix = "Claude auth status") {
|
|
935
|
+
const output = runClaudeAuthStatusDiagnostic();
|
|
936
|
+
const tokenInfo = getClaudeOAuthToken();
|
|
937
|
+
const lines = summarizeClaudeAuthStatus(output, isClaudeAuthErrorText(output) ? 1 : 0, tokenInfo);
|
|
938
|
+
await send([
|
|
939
|
+
prefix,
|
|
940
|
+
"",
|
|
941
|
+
...lines,
|
|
942
|
+
`Bot OAuth token: ${tokenInfo.value ? "configured via " + tokenInfo.source : "not configured"}`,
|
|
943
|
+
].join("\n"));
|
|
944
|
+
}
|
|
945
|
+
|
|
933
946
|
function claudeEmptyFailureMessage(code, stderrText = "") {
|
|
934
947
|
const stderr = redactSensitive(String(stderrText || "").trim());
|
|
935
948
|
if (isClaudeUsageLimitText(stderr)) return claudeUsageLimitMessage(stderr.slice(-1200));
|
|
@@ -1017,9 +1030,16 @@ async function runClaudeAuthCommand(args, label, opts = {}) {
|
|
|
1017
1030
|
const token = opts.captureToken ? extractClaudeToken(output) : null;
|
|
1018
1031
|
if (token && !tokenStored) tokenStored = saveClaudeOAuthToken(token);
|
|
1019
1032
|
const final = redactSensitive(output.trim());
|
|
1020
|
-
if (tokenStored)
|
|
1021
|
-
|
|
1022
|
-
|
|
1033
|
+
if (tokenStored) {
|
|
1034
|
+
await send(`${label} finished. OAuth token stored for launchd/non-interactive Claude runs.`);
|
|
1035
|
+
await sendClaudeAuthStatusSummary("Post-auth check:");
|
|
1036
|
+
} else if (final) {
|
|
1037
|
+
await send(`${label} finished (exit ${code}).\n\n${final.slice(-2500)}`);
|
|
1038
|
+
await sendClaudeAuthStatusSummary("Post-auth check:");
|
|
1039
|
+
} else {
|
|
1040
|
+
await send(`${label} finished (exit ${code}).`);
|
|
1041
|
+
await sendClaudeAuthStatusSummary("Post-auth check:");
|
|
1042
|
+
}
|
|
1023
1043
|
});
|
|
1024
1044
|
proc.on("error", async (err) => {
|
|
1025
1045
|
pendingClaudeAuthProcess = null;
|
|
@@ -1725,6 +1745,7 @@ bot.onText(/\/use_oauth_token(?:\s+(.+))?$/, async (msg, match) => {
|
|
|
1725
1745
|
if (!looksLikeClaudeToken(token)) return send("That doesn't look like a Claude OAuth token. Not saved.");
|
|
1726
1746
|
saveClaudeOAuthToken(token);
|
|
1727
1747
|
await send(`Claude OAuth token stored in .env${vault.isUnlocked() ? " and vault" : ""}. Restart the bot so launchd picks it up, or use /restart.`);
|
|
1748
|
+
await sendClaudeAuthStatusSummary("Stored token. Current Claude auth status:");
|
|
1728
1749
|
});
|
|
1729
1750
|
|
|
1730
1751
|
bot.onText(/\/clear_oauth_token$/, async (msg) => {
|
|
@@ -1987,11 +2008,12 @@ bot.on("message", async (msg) => {
|
|
|
1987
2008
|
if (!looksLikeClaudeToken(text)) { await send("That doesn't look like a Claude OAuth token. Not saved."); return; }
|
|
1988
2009
|
saveClaudeOAuthToken(text);
|
|
1989
2010
|
await send(`Claude OAuth token stored in .env${vault.isUnlocked() ? " and vault" : ""}. Restart the bot so launchd picks it up, or use /restart.`);
|
|
2011
|
+
await sendClaudeAuthStatusSummary("Stored token. Current Claude auth status:");
|
|
1990
2012
|
return;
|
|
1991
2013
|
}
|
|
1992
2014
|
try {
|
|
1993
2015
|
pendingClaudeAuthProcess.stdin.write(text + "\n");
|
|
1994
|
-
await send("Sent to Claude auth process.");
|
|
2016
|
+
await send("Sent to Claude auth process. I’ll confirm when Claude finishes the auth check.");
|
|
1995
2017
|
} catch (e) {
|
|
1996
2018
|
pendingClaudeAuthProcess = null;
|
|
1997
2019
|
pendingClaudeAuthLabel = null;
|